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

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

fix typo + indent code

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