source: extensions/AdminTools/template/public_controller.tpl @ 25654

Last change on this file since 25654 was 25654, checked in by mistic100, 10 years ago
  • add quick edit form for picture (todo: album)
  • add "Delete photo" button
File size: 11.4 KB
Line 
1{combine_css path=$ADMINTOOLS_PATH|cat:'template/style.css'}
2{combine_css path='admin/themes/default/fontello/css/fontello.css'}
3{combine_css path=$ADMINTOOLS_PATH|cat:'template/fontello/css/fontello-ato.css'}
4
5{if isset($ato.QUICK_EDIT)}
6  {*<!-- colorbox -->*}
7  {combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
8  {combine_css id='colorbox' path='themes/default/js/plugins/colorbox/style2/colorbox.css'}
9
10  {*<!-- tokeninput -->*}
11  {combine_script id='jquery.tokeninput' load='footer' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'}
12  {combine_css path='themes/default/js/plugins/jquery.tokeninput.css'}
13
14  {*<!-- datepicker -->*}
15  {combine_script id='jquery.ui.datepicker' load='footer' path='themes/default/js/ui/jquery.ui.datepicker.js'}
16
17  {assign var=datepicker_language value='themes/default/js/ui/i18n/jquery.ui.datepicker-'|cat:$lang_info.code|cat:'.js'}
18  {if 'PHPWG_ROOT_PATH'|@constant|@cat:$datepicker_language|@file_exists}
19  {combine_script id='jquery.ui.datepicker'|cat:$lang_info.code load='footer' path=$datepicker_language}
20  {/if}
21
22  {combine_css path='themes/default/js/ui/theme/jquery.ui.core.css'}
23  {combine_css path='themes/default/js/ui/theme/jquery.ui.theme.css'}
24  {combine_css path='themes/default/js/ui/theme/jquery.ui.datepicker.css'}
25{/if}
26
27
28<div id="ato_header_closed"><a href="#" class="icon-tools"></a></div>
29
30<div id="ato_header">
31  <ul id="ato_header_root">
32    <li><a href="#" class="icon-ato-cancel close-panel"></a></li>
33    <li class="parent"><a href="#" class="icon-menu">{'Admin panel'|translate}</a>
34      <ul>
35        <li><a class="icon-picture" href="{$ato.U_SITE_ADMIN}batch_manager">{'Photos'|translate}</a></li>
36        <li><a class="icon-sitemap" href="{$ato.U_SITE_ADMIN}cat_list">{'Albums'|translate}</a></li>
37        <li><a class="icon-users" href="{$ato.U_SITE_ADMIN}user_list">{'Users'|translate}</a></li>
38        <li><a class="icon-puzzle" href="{$ato.U_SITE_ADMIN}plugins">{'Plugins'|translate}</a></li>
39        <li><a class="icon-wrench" href="{$ato.U_SITE_ADMIN}maintenance">{'Tools'|translate}</a></li>
40        <li><a class="icon-cog" href="{$ato.U_SITE_ADMIN}configuration">{'Options'|translate}</a></li>
41      </ul>
42    </li>
43  {if isset($ato.U_EDIT)}
44    <li class="parent"><a href="#" class="icon-pencil">{'Edit'|translate}</a>
45      <ul>
46        <li><a href="#ato_quick_edit" class="icon-ato-flash edit-quick">{'Quick edit'|translate}</a></li>
47        <li><a class="icon-ato-doc-text-inv" href="{$ato.U_EDIT}">{'Properties page'|translate}</a></li>
48      </ul>
49    </li>
50  {/if}
51  {if isset($ato.U_SET_REPRESENTATIVE)}
52    <li {if $ato.IS_REPRESENTATIVE}class="disabled"{/if}><a class="icon-ato-trophy set-representative" href="{$ato.U_SET_REPRESENTATIVE}">{'representative'|translate|ucfirst}</a></li>
53  {/if}
54  {if isset($ato.U_CADDIE)}
55    <li {if $ato.IS_IN_CADDIE}class="disabled"{/if}><a class="icon-ato-flag add-caddie" href="{$ato.U_CADDIE}">{'Add to caddie'|translate}</a></li>
56  {/if}
57  {if isset($ato.IS_CATEGORY)}
58    <li><a class="icon-plus-circled" href="{$ato.U_SITE_ADMIN}photos_add&amp;album={$ato.CATEGORY_ID}">{'Add Photos'|translate}</a></li>
59  {/if}
60  {if isset($ato.IS_PICTURE)}
61    <li><a class="icon-ato-cancel" href="{$ato.U_SELF}delete&amp;pwg_token={$ato.PWG_TOKEN}" onclick="return confirm('{'Are you sure?'|translate|escape:javascript}')">{'delete photo'|translate|ucfirst}</a></li>
62  {/if}
63
64    <li class="parent right"><a class="icon-cog-alt" href="#">{'Tools'|translate}</a>
65      <ul>
66        <li><label>View as</label>
67          <select class="switcher" data-type="view_as">
68            {html_options options=$ato.USERS selected=$ato.MULTIVIEW.view_as}
69          </select>
70        </li>
71        <li><label>Theme</label>
72          <select class="switcher" data-type="theme">
73            {html_options options=$ato.THEMES selected=$ato.MULTIVIEW.theme}
74          </select>
75        </li>
76        <li><label>Language</label>
77          <select class="switcher" data-type="lang">
78            {html_options options=$ato.LANGS selected=$ato.MULTIVIEW.lang}
79          </select>
80        </li>
81        <li><a class="icon-ato-check{if !$ato.MULTIVIEW.show_queries}-empty{/if}" href="{$ato.U_SELF}show_queries={(int)!$ato.MULTIVIEW.show_queries}">{'Show SQL queries'|translate}</a></li>
82        <li><a class="icon-ato-check{if !$ato.MULTIVIEW.debug_l10n}-empty{/if}" href="{$ato.U_SELF}debug_l10n={(int)!$ato.MULTIVIEW.debug_l10n}">{'Debug languages'|translate}</a></li>
83        <li><a class="icon-ato-check{if !$ato.MULTIVIEW.debug_template}-empty{/if}" href="{$ato.U_SELF}debug_template={(int)!$ato.MULTIVIEW.debug_template}">{'Debug template'|translate}</a></li>
84        <li><a class="icon-ato-check{if !$ato.MULTIVIEW.template_combine_files}-empty{/if}" href="{$ato.U_SELF}template_combine_files={(int)!$ato.MULTIVIEW.template_combine_files}">{'Combine JS&amp;CSS'|translate}</a></li>
85        <li><a class="icon-ato-check{if $ato.MULTIVIEW.no_history}-empty{/if}" href="{$ato.U_SELF}no_history={(int)!$ato.MULTIVIEW.no_history}">{'Save visit in history'|translate}</a></li>
86        <li><a class="icon-ato-null" href="{$ato.U_SELF}purge_template=1">{'Purge compiled templates'|translate}</a></li>
87      </ul>
88    </li>
89  {if $ato.USER.id != $ato.MULTIVIEW.view_as}
90    <li class="right">
91      &nbsp;&nbsp;{'Logged as <b>%s</b>, viewing as <b>%s</b>.'|translate:$ato.USER.username:$ato.CURRENT_USERNAME}
92      <a href="{$ato.U_SELF}view_as={$ato.USER.id}">{'Revert'|translate}</a>
93    </li>
94  {/if}
95  </ul>
96</div>
97
98{if isset($ato.QUICK_EDIT)}
99<div style="display:none;">
100  <div id="ato_quick_edit">
101    <form method="post" action="{$ato.U_SELF}">
102      <fieldset class="left">
103        <img src="{$current.derivatives.square->get_url()}" width="100" height="100">
104        <br><input type="submit" value="{'Save'|translate}">
105        <br><a href="#" class="icon-ato-cancel close-edit">{'Cancel'|translate}</a>
106      </fieldset>
107
108      <fieldset class="main">
109        <label for="quick_edit_name">{'Name'|translate}</label>
110        <input type="text" name="name" id="quick_edit_name" value="{$ato.QUICK_EDIT.name|escape:html}">
111
112        <label for="quick_edit_author">{'Author'|translate}</label>
113        <input type="text" name="author" id="quick_edit_author" value="{$ato.QUICK_EDIT.author|escape:html}">
114
115
116        <label for="quick_edit_date_creation">{'Creation date'|translate}</label>
117        <input type="text" name="date_creation" id="quick_edit_date_creation" class="datepicker" value="{$ato.QUICK_EDIT.date_creation}">
118        <input type="hidden" name="date_creation_time" value="{$ato.QUICK_EDIT.date_creation_time}">
119
120        <label for="quick_edit_tags">{'Tags'|translate}</label>
121        <select name="tags" id="quick_edit_tags" class="tags">
122        {foreach from=$ato.QUICK_EDIT.tag_selection item=tag}
123          <option value="{$tag.id}" class="selected">{$tag.name}</option>
124        {/foreach}
125        </select>
126
127        <label for="quick_edit_comment">{'Description'|translate}</label>
128        <textarea name="comment" id="quick_edit_comment">{$ato.QUICK_EDIT.comment}</textarea>
129
130        <label for="quick_edit_level">{'Who can see this photo?'|@translate}</label>
131        <select name="level" size="1">
132          {html_options options=$available_permission_levels selected=$ato.QUICK_EDIT.level}
133        </select>
134      </fieldset>
135
136      <input type="hidden" name="action" value="quick_edit">
137    </form>
138  </div>
139</div>
140{/if}
141
142{footer_script require='jquery'}
143(function($){
144  var $ato = $('#ato_header'),
145      $ato_closed = $('#ato_header_closed'),
146      ato_height = 28,
147      urlWS = '{$ROOT_URL}ws.php?format=json&method=';
148
149  $('body').prepend($ato);
150
151  if (window.localStorage.ato_panel_open == null) {
152    window.localStorage.ato_panel_open = "true";
153  }
154
155  if (window.localStorage.ato_panel_open == "true") {
156    $ato.show();
157    $('body').css({ldelim}'margin-top': '+='+ato_height});
158  }
159  else {
160    $ato_closed.show();
161  }
162
163{*<!-- sub menus -->*}
164  $ato.find('.parent').on({
165    'click': function(){
166      $(this).find('ul').toggle();
167    },
168    'mouseleave': function(e) {
169      if (e.target.tagName.toLowerCase() != "select") {
170        $(this).find('ul').hide();
171      }
172    }
173  });
174  $ato.find('.parent>a').on('click', function(e) {
175    e.preventDefault();
176  });
177  $ato.find('.parent ul').on('mouseleave', function(e) {
178    if (e.target.tagName.toLowerCase() != "select") {
179      $(this).hide();
180    }
181  });
182
183{*<!-- select boxes -->*}
184  $ato.find('.switcher').on({
185    'change': function() {
186      window.location.href = '{$ato.U_SELF}'+ $(this).data('type') +'='+ $(this).val();
187    },
188    'click': function(e) {
189      e.stopPropagation();
190    }
191  });
192
193{*<!-- toggle toolbar -->*}
194  $ato.find('.close-panel').on('click', function(e) {
195    $ato.slideUp();
196    $ato_closed.slideDown();
197    $('body').animate({ldelim}'margin-top': '-='+ato_height});
198
199    window.localStorage.ato_panel_open = "false";
200    e.preventDefault();
201  });
202
203  $ato_closed.on('click', function(e) {
204    $ato.slideDown();
205    $ato_closed.slideUp();
206    $('body').animate({ldelim}'margin-top': '+='+ato_height});
207
208    window.localStorage.ato_panel_open = "true";
209    e.preventDefault();
210  });
211
212{*<!-- set representative -->*}
213{if isset($ato.U_SET_REPRESENTATIVE)}
214  $ato.find('.set-representative').on('click', function(e) {
215
216    if (!$(this).parent().hasClass('disabled')) {
217      $(this).parent().addClass('disabled')
218
219      $.ajax({
220        method: 'POST',
221        url: urlWS + 'pwg.categories.setRepresentative',
222        dataType: 'json',
223        data: {
224          image_id: {$current.id},
225          category_id: {$ato.CATEGORY_ID}
226        },
227        success: function() {
228          alert('ok');
229        },
230        fail: function(num, text) {
231          alert(num + ' ' + text);
232        }
233      });
234    }
235
236    e.preventDefault();
237  });
238{/if}
239
240{*<!-- add to caddie -->*}
241{if isset($ato.U_CADDIE) and isset($ato.IS_PICTURE)}
242  $ato.find('.add-caddie').on('click', function(e) {
243
244    if (!$(this).parent().hasClass('disabled')) {
245      $(this).parent().addClass('disabled')
246
247      $.ajax({
248        method: 'POST',
249        url: urlWS + 'pwg.caddie.add',
250        dataType: 'json',
251        data: {
252          image_id: {$current.id}
253        },
254        success: function() {
255          alert('ok');
256        },
257        fail: function(num, text) {
258          alert(num + ' ' + text);
259        }
260      });
261    }
262
263    e.preventDefault();
264  });
265{/if}
266
267{* <!-- quick edit -->*}
268{if isset($ato.QUICK_EDIT)}
269  var $ato_edit = $('#ato_quick_edit');
270
271  $ato_edit.css('background-color', $("#the_page #content").css('background-color'));
272
273  $ato_edit.find('.close-edit').on('click', function(e) {
274    $.colorbox.close()
275    e.preventDefault();
276  });
277
278  $ato_edit.find('.datepicker').datepicker({
279    dateFormat: 'yy-mm-dd'
280  });
281
282  $ato_edit.find('.tags').tokenInput(
283    [{foreach from=$ato.QUICK_EDIT.tags item=tag name=tags}{ldelim}"name":"{$tag.name|escape:javascript}","id":"{$tag.id}"{rdelim}{if !$smarty.foreach.tags.last},{/if}{/foreach}],
284    {
285      hintText: '{'Type in a search term'|@translate}',
286      noResultsText: '{'No results'|@translate}',
287      searchingText: '{'Searching...'|@translate}',
288      newText: ' ({'new'|@translate})',
289      animateDropdown: false,
290      preventDuplicates: true,
291      allowFreeTagging: true
292    }
293  );
294
295  $(".edit-quick").colorbox({
296    inline: true,
297    transition: 'none',
298    title: '{'Quick edit'|translate|escape:javascript}',
299    width: 500,
300    top: 50
301  });
302{/if}
303
304}(jQuery));
305{/footer_script}
Note: See TracBrowser for help on using the repository browser.