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

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

fix security problem, fix sql fatal error, try to fix display on smartpocket

File size: 12.7 KB
RevLine 
[25657]1{strip}
[25617]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
[25654]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'}
[25675]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}
[25654]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}
[25657]27{/strip}
[25654]28
[25619]29<div id="ato_header_closed"><a href="#" class="icon-tools"></a></div>
30
[25617]31<div id="ato_header">
32  <ul id="ato_header_root">
[25619]33    <li><a href="#" class="icon-ato-cancel close-panel"></a></li>
[25675]34    <li class="parent"><a href="#" class="icon-menu">{'Administration'|translate}</a>
[25617]35      <ul>
[25629]36        <li><a class="icon-picture" href="{$ato.U_SITE_ADMIN}batch_manager">{'Photos'|translate}</a></li>
[25617]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>
[25654]47        <li><a href="#ato_quick_edit" class="icon-ato-flash edit-quick">{'Quick edit'|translate}</a></li>
[25617]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)}
[25629]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>
[25617]54  {/if}
55  {if isset($ato.U_CADDIE)}
[25629]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>
[25617]57  {/if}
[25629]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}
[25654]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}
[25629]64
[25617]65    <li class="parent right"><a class="icon-cog-alt" href="#">{'Tools'|translate}</a>
66      <ul>
[25655]67        <li><label>{'View as'|translate}</label>
[25617]68          <select class="switcher" data-type="view_as">
[25629]69            {html_options options=$ato.USERS selected=$ato.MULTIVIEW.view_as}
[25617]70          </select>
71        </li>
[25655]72        <li><label>{'Theme'|translate}</label>
[25617]73          <select class="switcher" data-type="theme">
[25629]74            {html_options options=$ato.THEMES selected=$ato.MULTIVIEW.theme}
[25617]75          </select>
76        </li>
[25655]77        <li><label>{'Language'|translate}</label>
[25617]78          <select class="switcher" data-type="lang">
[25629]79            {html_options options=$ato.LANGS selected=$ato.MULTIVIEW.lang}
[25617]80          </select>
81        </li>
[25655]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>
[25617]88      </ul>
89    </li>
[25629]90  {if $ato.USER.id != $ato.MULTIVIEW.view_as}
[25619]91    <li class="right">
[25655]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>
[25619]94    </li>
95  {/if}
[25617]96  </ul>
97</div>
98
[25654]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">
[25791]104        <img src="{$ato.QUICK_EDIT.img}" width="100" height="100">
[25655]105        <input type="submit" value="{'Save'|translate}">
106        <a href="#" class="icon-ato-cancel close-edit">{'Cancel'|translate}</a>
[25654]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
[25655]113      {if isset($ato.IS_PICTURE)}
[25654]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>
[25655]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>
[25654]136      </fieldset>
137
138      <input type="hidden" name="action" value="quick_edit">
139    </form>
140  </div>
141</div>
142{/if}
143
[25617]144{footer_script require='jquery'}
145(function($){
[25655]146  function moveBody(dir, anim) {
147    var operator = dir=='show' ? '+=' : '-=';
148   
149    if (anim) {
150      $('body').animate({ldelim}'margin-top': operator+ato_height});
151     
[25791]152      if ($('#the_page, [data-role="page"]').css('position')=='absolute') {
153        $('#the_page, [data-role="page"]').animate({ldelim}'top': operator+ato_height});
[25655]154      }
155    }
156    else {
157      $('body').css({ldelim}'margin-top': operator+ato_height});
158     
[25791]159      if ($('#the_page, [data-role="page"]').css('position')=='absolute') {
160        $('#the_page, [data-role="page"]').css({ldelim}'top': operator+ato_height});
[25655]161      }
162    }
163  }
164 
[25619]165  var $ato = $('#ato_header'),
166      $ato_closed = $('#ato_header_closed'),
167      ato_height = 28,
[25617]168      urlWS = '{$ROOT_URL}ws.php?format=json&method=';
169
[25791]170  $('body').prepend($ato); // ensure the bar is at the begining
171 
172  {if $themeconf.mobile}
173    var $headerbar = $('div[data-role="header"] .title');
174    if ($headerbar.length == 1) {
175      $ato_closed.addClass('smartpocket');
176      $ato_closed.find('a').attr({
177        'data-iconpos':'notext',
178        'data-role':'button'
179      });
180      $headerbar.prepend($ato_closed);   
181    }
182  {/if}
[25617]183
[25619]184  if (window.localStorage.ato_panel_open == null) {
185    window.localStorage.ato_panel_open = "true";
186  }
187
188  if (window.localStorage.ato_panel_open == "true") {
189    $ato.show();
[25655]190    moveBody('show', false);
[25619]191  }
192  else {
193    $ato_closed.show();
194  }
195
[25617]196{*<!-- sub menus -->*}
197  $ato.find('.parent').on({
198    'click': function(){
199      $(this).find('ul').toggle();
200    },
201    'mouseleave': function(e) {
202      if (e.target.tagName.toLowerCase() != "select") {
203        $(this).find('ul').hide();
204      }
205    }
206  });
207  $ato.find('.parent>a').on('click', function(e) {
208    e.preventDefault();
209  });
210  $ato.find('.parent ul').on('mouseleave', function(e) {
211    if (e.target.tagName.toLowerCase() != "select") {
212      $(this).hide();
213    }
214  });
215
[25654]216{*<!-- select boxes -->*}
[25617]217  $ato.find('.switcher').on({
218    'change': function() {
[25655]219      window.location.href = '{$ato.U_SELF}ato_'+ $(this).data('type') +'='+ $(this).val();
[25617]220    },
221    'click': function(e) {
222      e.stopPropagation();
223    }
224  });
225
[25654]226{*<!-- toggle toolbar -->*}
[25619]227  $ato.find('.close-panel').on('click', function(e) {
228    $ato.slideUp();
229    $ato_closed.slideDown();
[25655]230    moveBody('hide', true);
[25619]231
232    window.localStorage.ato_panel_open = "false";
233    e.preventDefault();
234  });
[25654]235
[25619]236  $ato_closed.on('click', function(e) {
237    $ato.slideDown();
238    $ato_closed.slideUp();
[25655]239    moveBody('show', true);
[25619]240
241    window.localStorage.ato_panel_open = "true";
242    e.preventDefault();
243  });
244
[25617]245{*<!-- set representative -->*}
246{if isset($ato.U_SET_REPRESENTATIVE)}
247  $ato.find('.set-representative').on('click', function(e) {
248
249    if (!$(this).parent().hasClass('disabled')) {
250      $(this).parent().addClass('disabled')
251
252      $.ajax({
253        method: 'POST',
254        url: urlWS + 'pwg.categories.setRepresentative',
255        dataType: 'json',
256        data: {
257          image_id: {$current.id},
258          category_id: {$ato.CATEGORY_ID}
259        },
260        success: function() {
261          alert('ok');
262        },
263        fail: function(num, text) {
264          alert(num + ' ' + text);
265        }
266      });
267    }
268
269    e.preventDefault();
270  });
271{/if}
272
273{*<!-- add to caddie -->*}
274{if isset($ato.U_CADDIE) and isset($ato.IS_PICTURE)}
275  $ato.find('.add-caddie').on('click', function(e) {
276
277    if (!$(this).parent().hasClass('disabled')) {
278      $(this).parent().addClass('disabled')
279
280      $.ajax({
281        method: 'POST',
282        url: urlWS + 'pwg.caddie.add',
283        dataType: 'json',
284        data: {
285          image_id: {$current.id}
286        },
287        success: function() {
288          alert('ok');
289        },
290        fail: function(num, text) {
291          alert(num + ' ' + text);
292        }
293      });
294    }
295
296    e.preventDefault();
297  });
298{/if}
299
[25654]300{* <!-- quick edit -->*}
301{if isset($ato.QUICK_EDIT)}
302  var $ato_edit = $('#ato_quick_edit');
[25791]303 
304 
305  setTimeout(function() {
306    var bg_color = 'white';
307    var selectors = ['#the_page #content', '[data-role="page"]', 'body'];
308   
309    for (var i=0; i<selectors.length; i++) {
310      var color = $(selectors[i]).css('background-color');
311      console.log(selectors[i], color);
312      if (color && color!='transparent') {
313        bg_color = color;
314        break;
315      }
316    }
[25654]317
[25791]318    $ato_edit.css('background-color', bg_color);
319  }, 1000);
[25654]320
321  $ato_edit.find('.close-edit').on('click', function(e) {
322    $.colorbox.close()
323    e.preventDefault();
324  });
325
[25655]326{if isset($ato.IS_PICTURE)}
[25654]327  $ato_edit.find('.datepicker').datepicker({
328    dateFormat: 'yy-mm-dd'
329  });
330
331  $ato_edit.find('.tags').tokenInput(
332    [{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}],
333    {
334      hintText: '{'Type in a search term'|@translate}',
335      noResultsText: '{'No results'|@translate}',
336      searchingText: '{'Searching...'|@translate}',
337      newText: ' ({'new'|@translate})',
338      animateDropdown: false,
339      preventDuplicates: true,
340      allowFreeTagging: true
341    }
342  );
[25655]343{/if}
[25654]344
345  $(".edit-quick").colorbox({
346    inline: true,
347    transition: 'none',
348    title: '{'Quick edit'|translate|escape:javascript}',
349    width: 500,
350    top: 50
351  });
352{/if}
353
[25617]354}(jQuery));
355{/footer_script}
Note: See TracBrowser for help on using the repository browser.