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

Last change on this file since 25655 was 25655, checked in by mistic100, 10 years ago

quick edit for album
add language files
force default language for the toolbar
fix $_GET collision
orange save button
fix popup background color

File size: 12.0 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'|translate}</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'|translate}</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'|translate}</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}ato_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}ato_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}ato_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}ato_template_combine_files={(int)!$ato.MULTIVIEW.template_combine_files}">{'Combine JS&CSS'|translate}</a></li>
85        <li><a class="icon-ato-check{if $ato.MULTIVIEW.no_history}-empty{/if}" href="{$ato.U_SELF}ato_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}ato_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;{'Viewing as <b>%s</b>.'|translate:$ato.CURRENT_USERNAME}
92      <a href="{$ato.U_SELF}ato_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="{$ato.QUICK_EDIT.img->get_url()}" width="100" height="100">
104        <input type="submit" value="{'Save'|translate}">
105        <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      {if isset($ato.IS_PICTURE)}
113        <label for="quick_edit_author">{'Author'|translate}</label>
114        <input type="text" name="author" id="quick_edit_author" value="{$ato.QUICK_EDIT.author|escape:html}">
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_level">{'Who can see this photo?'|@translate}</label>
128        <select name="level" size="1">
129          {html_options options=$available_permission_levels selected=$ato.QUICK_EDIT.level}
130        </select>
131      {/if}
132
133        <label for="quick_edit_comment">{'Description'|translate}</label>
134        <textarea name="comment" id="quick_edit_comment">{$ato.QUICK_EDIT.comment}</textarea>
135      </fieldset>
136
137      <input type="hidden" name="action" value="quick_edit">
138    </form>
139  </div>
140</div>
141{/if}
142
143{footer_script require='jquery'}
144(function($){
145  function moveBody(dir, anim) {
146    var operator = dir=='show' ? '+=' : '-=';
147   
148    if (anim) {
149      $('body').animate({ldelim}'margin-top': operator+ato_height});
150     
151      if ($('#the_page').css('position')=='absolute') {
152        $('#the_page').animate({ldelim}'top': operator+ato_height});
153      }
154    }
155    else {
156      $('body').css({ldelim}'margin-top': operator+ato_height});
157     
158      if ($('#the_page').css('position')=='absolute') {
159        $('#the_page').css({ldelim}'top': operator+ato_height});
160      }
161    }
162  }
163 
164  var $ato = $('#ato_header'),
165      $ato_closed = $('#ato_header_closed'),
166      ato_height = 28,
167      urlWS = '{$ROOT_URL}ws.php?format=json&method=';
168
169  $('body').prepend($ato);
170
171  if (window.localStorage.ato_panel_open == null) {
172    window.localStorage.ato_panel_open = "true";
173  }
174
175  if (window.localStorage.ato_panel_open == "true") {
176    $ato.show();
177    moveBody('show', false);
178  }
179  else {
180    $ato_closed.show();
181  }
182
183{*<!-- sub menus -->*}
184  $ato.find('.parent').on({
185    'click': function(){
186      $(this).find('ul').toggle();
187    },
188    'mouseleave': function(e) {
189      if (e.target.tagName.toLowerCase() != "select") {
190        $(this).find('ul').hide();
191      }
192    }
193  });
194  $ato.find('.parent>a').on('click', function(e) {
195    e.preventDefault();
196  });
197  $ato.find('.parent ul').on('mouseleave', function(e) {
198    if (e.target.tagName.toLowerCase() != "select") {
199      $(this).hide();
200    }
201  });
202
203{*<!-- select boxes -->*}
204  $ato.find('.switcher').on({
205    'change': function() {
206      window.location.href = '{$ato.U_SELF}ato_'+ $(this).data('type') +'='+ $(this).val();
207    },
208    'click': function(e) {
209      e.stopPropagation();
210    }
211  });
212
213{*<!-- toggle toolbar -->*}
214  $ato.find('.close-panel').on('click', function(e) {
215    $ato.slideUp();
216    $ato_closed.slideDown();
217    moveBody('hide', true);
218
219    window.localStorage.ato_panel_open = "false";
220    e.preventDefault();
221  });
222
223  $ato_closed.on('click', function(e) {
224    $ato.slideDown();
225    $ato_closed.slideUp();
226    moveBody('show', true);
227
228    window.localStorage.ato_panel_open = "true";
229    e.preventDefault();
230  });
231
232{*<!-- set representative -->*}
233{if isset($ato.U_SET_REPRESENTATIVE)}
234  $ato.find('.set-representative').on('click', function(e) {
235
236    if (!$(this).parent().hasClass('disabled')) {
237      $(this).parent().addClass('disabled')
238
239      $.ajax({
240        method: 'POST',
241        url: urlWS + 'pwg.categories.setRepresentative',
242        dataType: 'json',
243        data: {
244          image_id: {$current.id},
245          category_id: {$ato.CATEGORY_ID}
246        },
247        success: function() {
248          alert('ok');
249        },
250        fail: function(num, text) {
251          alert(num + ' ' + text);
252        }
253      });
254    }
255
256    e.preventDefault();
257  });
258{/if}
259
260{*<!-- add to caddie -->*}
261{if isset($ato.U_CADDIE) and isset($ato.IS_PICTURE)}
262  $ato.find('.add-caddie').on('click', function(e) {
263
264    if (!$(this).parent().hasClass('disabled')) {
265      $(this).parent().addClass('disabled')
266
267      $.ajax({
268        method: 'POST',
269        url: urlWS + 'pwg.caddie.add',
270        dataType: 'json',
271        data: {
272          image_id: {$current.id}
273        },
274        success: function() {
275          alert('ok');
276        },
277        fail: function(num, text) {
278          alert(num + ' ' + text);
279        }
280      });
281    }
282
283    e.preventDefault();
284  });
285{/if}
286
287{* <!-- quick edit -->*}
288{if isset($ato.QUICK_EDIT)}
289  var $ato_edit = $('#ato_quick_edit');
290
291  var bg_color = $('#the_page #content').css('background-color');
292  if (!bg_color || bg_color=='transparent') {
293    bg_color = $('body').css('background-color');
294  }
295  $ato_edit.css('background-color', bg_color);
296
297  $ato_edit.find('.close-edit').on('click', function(e) {
298    $.colorbox.close()
299    e.preventDefault();
300  });
301
302{if isset($ato.IS_PICTURE)}
303  $ato_edit.find('.datepicker').datepicker({
304    dateFormat: 'yy-mm-dd'
305  });
306
307  $ato_edit.find('.tags').tokenInput(
308    [{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}],
309    {
310      hintText: '{'Type in a search term'|@translate}',
311      noResultsText: '{'No results'|@translate}',
312      searchingText: '{'Searching...'|@translate}',
313      newText: ' ({'new'|@translate})',
314      animateDropdown: false,
315      preventDuplicates: true,
316      allowFreeTagging: true
317    }
318  );
319{/if}
320
321  $(".edit-quick").colorbox({
322    inline: true,
323    transition: 'none',
324    title: '{'Quick edit'|translate|escape:javascript}',
325    width: 500,
326    top: 50
327  });
328{/if}
329
330}(jQuery));
331{/footer_script}
Note: See TracBrowser for help on using the repository browser.