Ignore:
Timestamp:
Nov 23, 2013, 5:47:04 PM (10 years ago)
Author:
mistic100
Message:

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

Location:
extensions/AdminTools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/AdminTools/include/MultiView.class.php

    r25619 r25655  
    11<?php
    2 defined('ADMINTOOLS_ID') or die('Hacking attempt!');
     2defined('ADMINTOOLS_PATH') or die('Hacking attempt!');
    33
    44/**
     
    129129
    130130      // view_as
    131       if (isset($_GET['view_as']))
    132       {
    133         $this->data['view_as'] = (int)$_GET['view_as'];
     131      if (isset($_GET['ato_view_as']))
     132      {
     133        $this->data['view_as'] = (int)$_GET['ato_view_as'];
    134134      }
    135135      if ($this->data['view_as'] != $user['id'])
     
    141141
    142142      // theme
    143       if (isset($_GET['theme']))
    144       {
    145         $this->data['theme'] = $_GET['theme'];
     143      if (isset($_GET['ato_theme']))
     144      {
     145        $this->data['theme'] = $_GET['ato_theme'];
    146146      }
    147147      $user['theme'] = $this->data['theme'];
    148148
    149149      // lang
    150       if (isset($_GET['lang']))
    151       {
    152         $this->data['lang'] = $_GET['lang'];
     150      if (isset($_GET['ato_lang']))
     151      {
     152        $this->data['lang'] = $_GET['ato_lang'];
    153153      }
    154154      $user['language'] = $this->data['lang'];
    155155
    156156      // show_queries
    157       if (isset($_GET['show_queries']))
    158       {
    159         $this->data['show_queries'] = (bool)$_GET['show_queries'];
     157      if (isset($_GET['ato_show_queries']))
     158      {
     159        $this->data['show_queries'] = (bool)$_GET['ato_show_queries'];
    160160      }
    161161      $conf['show_queries'] = $this->data['show_queries'];
    162162
    163163      // debug_l10n
    164       if (isset($_GET['debug_l10n']))
    165       {
    166         $this->data['debug_l10n'] = (bool)$_GET['debug_l10n'];
     164      if (isset($_GET['ato_debug_l10n']))
     165      {
     166        $this->data['debug_l10n'] = (bool)$_GET['ato_debug_l10n'];
    167167      }
    168168      $conf['debug_l10n'] = $this->data['debug_l10n'];
    169169
    170170      // debug_template
    171       if (isset($_GET['debug_template']))
    172       {
    173         $this->data['debug_template'] = (bool)$_GET['debug_template'];
     171      if (isset($_GET['ato_debug_template']))
     172      {
     173        $this->data['debug_template'] = (bool)$_GET['ato_debug_template'];
    174174      }
    175175      $conf['debug_template'] = $this->data['debug_template'];
    176176
    177177      // template_combine_files
    178       if (isset($_GET['template_combine_files']))
    179       {
    180         $this->data['template_combine_files'] = (bool)$_GET['template_combine_files'];
     178      if (isset($_GET['ato_template_combine_files']))
     179      {
     180        $this->data['template_combine_files'] = (bool)$_GET['ato_template_combine_files'];
    181181      }
    182182      $conf['template_combine_files'] = $this->data['template_combine_files'];
    183183
    184184      // no_history
    185       if (isset($_GET['no_history']))
    186       {
    187         $this->data['no_history'] = (bool)$_GET['no_history'];
     185      if (isset($_GET['ato_no_history']))
     186      {
     187        $this->data['no_history'] = (bool)$_GET['ato_no_history'];
    188188      }
    189189      if ($this->data['no_history'])
     
    201201  public function init()
    202202  {
    203     if (isset($_GET['purge_template']))
     203    if (isset($_GET['ato_purge_template']))
    204204    {
    205205      global $template;
  • extensions/AdminTools/include/events.inc.php

    r25654 r25655  
    22defined('ADMINTOOLS_PATH') or die('Hacking attempt!');
    33
     4/**
     5 * Add main toolbar to current page
     6 * @trigger loc_after_page_header
     7 */
    48function admintools_add_public_controller()
    59{
     
    2428    );
    2529
     30  if (!is_admin())
     31  {
     32    load_language('admin.lang');
     33  }
     34
     35  switch_lang_to(get_default_language());
     36
    2637  // TODO : param to allow owner modification
    2738  if (script_basename() == 'picture')
     
    8697
    8798    $tpl_vars['QUICK_EDIT'] = array(
    88       'file' => $picture['current']['file'],
     99      'img' => $picture['current']['derivatives']['square'],
    89100      'name' => $picture['current']['name'],
    90101      'comment' => $picture['current']['comment'],
     
    118129        );
    119130    }
     131
     132    $query = 'SELECT * FROM '.IMAGES_TABLE.' WHERE id = '. $page['category']['representative_picture_id'] .';';
     133    $image_infos = pwg_db_fetch_assoc(pwg_query($query));
     134
     135    $tpl_vars['QUICK_EDIT'] = array(
     136      'img' => DerivativeImage::get_one(IMG_SQUARE, $image_infos),
     137      'name' => $page['category']['name'],
     138      'comment' => $page['category']['comment'],
     139      );
    120140  }
    121141
     
    134154  include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
    135155  $themes = new themes();
    136   foreach (array_keys($themes->fs_themes) as $theme)
    137   {
    138     $tpl_vars['THEMES'][$theme] = $theme;
     156  foreach (array_keys($themes->db_themes_by_id) as $theme)
     157  {
     158    if (!empty($theme))
     159    {
     160      $tpl_vars['THEMES'][$theme] = $theme;
     161    }
    139162  }
    140163
     
    153176  $template->set_filename('ato', realpath(ADMINTOOLS_PATH . 'template/public_controller.tpl'));
    154177  $template->parse('ato');
    155 }
    156 
     178
     179  switch_lang_back();
     180}
     181
     182/**
     183 * Disable privacy level switchbox
     184 */
    157185function admintools_remove_privacy($content)
    158186{
     
    162190}
    163191
     192/**
     193 * Save picture form
     194 * @trigger loc_begin_picture
     195 */
    164196function admintools_save_picture()
    165197{
     
    225257  }
    226258}
     259
     260/**
     261 * Save category form
     262 * @trigger loc_begin_index
     263 */
     264function admintools_save_category()
     265{
     266  global $page, $conf;
     267 
     268  if (@$_POST['action'] == 'quick_edit')
     269  {
     270    $data = array(
     271      'name' => $_POST['name'],
     272      );
     273
     274    if ($conf['allow_html_descriptions'])
     275    {
     276      $data['comment'] = @$_POST['comment'];
     277    }
     278    else
     279    {
     280      $data['comment'] = strip_tags(@$_POST['comment']);
     281    }
     282
     283    single_update(
     284      CATEGORIES_TABLE,
     285      $data,
     286      array('id' => $page['category']['id'])
     287      );
     288     
     289    redirect(duplicate_index_url());
     290  }
     291}
  • extensions/AdminTools/language/en_UK/plugin.lang.php

    r25617 r25655  
    11<?php
    22
     3$lang['Admin panel'] = 'Admin panel';
     4$lang['Combine JS&CSS'] = 'Combine JS&CSS';
     5$lang['Debug languages'] = 'Debug languages';
     6$lang['Debug template'] = 'Debug template';
     7$lang['Viewing as <b>%s</b>.'] = 'Viewing as <b>%s</b>.';
     8$lang['Properties page'] = 'Properties page';
     9$lang['Quick edit'] = 'Quick edit';
     10$lang['Revert'] = 'Revert';
     11$lang['Save'] = 'Save';
     12$lang['Save visit in history'] = 'Save visit in history';
     13$lang['Show SQL queries'] = 'Show SQL queries';
     14$lang['View as'] = 'View as';
     15
    316?>
  • extensions/AdminTools/language/fr_FR/plugin.lang.php

    r25617 r25655  
    11<?php
    22
     3$lang['Admin panel'] = 'Panneau d\'administration';
     4$lang['Combine JS&CSS'] = 'Combiner JS&CSS';
     5$lang['Debug languages'] = 'Debuguer les langues';
     6$lang['Debug template'] = 'Debuguer le template';
     7$lang['Viewing as <b>%s</b>.'] = 'Vue simulée de <b>%s</b>.';
     8$lang['Properties page'] = 'Page d\'administration';
     9$lang['Quick edit'] = 'Édition rapide';
     10$lang['Revert'] = 'Annuler';
     11$lang['Save'] = 'Sauvegarder';
     12$lang['Save visit in history'] = 'Sauvegarder la viste dans l\'historique';
     13$lang['Show SQL queries'] = 'Afficher les requêtes SQL';
     14$lang['View as'] = 'Voir en tant que';
     15
    316?>
  • extensions/AdminTools/main.inc.php

    r25654 r25655  
    2929$MultiView = new MultiView();
    3030
    31 // add_event_handler('init', 'admintools_init');
     31add_event_handler('init', 'admintools_init');
    3232
    3333if (!defined('IN_ADMIN'))
     
    3535  add_event_handler('loc_after_page_header', 'admintools_add_public_controller');
    3636  add_event_handler('loc_begin_picture', 'admintools_save_picture');
     37  add_event_handler('loc_begin_index', 'admintools_save_category');
    3738}
    3839
     
    4445// | Plugin initialization                                                 |
    4546// +-----------------------------------------------------------------------+
    46 // function admintools_init()
    47 // {
     47function admintools_init()
     48{
    4849  // global $conf;
    4950
     
    5253  // $maintain->autoUpdate(ADMINTOOLS_VERSION, 'install');
    5354
    54   // load_language('plugin.lang', ADMINTOOLS_PATH);
     55  load_language('plugin.lang', ADMINTOOLS_PATH);
    5556
    5657  // $conf['AdminTools'] = unserialize($conf['AdminTools']);
    57 // }
     58}
  • extensions/AdminTools/template/public_controller.tpl

    r25654 r25655  
    6464    <li class="parent right"><a class="icon-cog-alt" href="#">{'Tools'|translate}</a>
    6565      <ul>
    66         <li><label>View as</label>
     66        <li><label>{'View as'|translate}</label>
    6767          <select class="switcher" data-type="view_as">
    6868            {html_options options=$ato.USERS selected=$ato.MULTIVIEW.view_as}
    6969          </select>
    7070        </li>
    71         <li><label>Theme</label>
     71        <li><label>{'Theme'|translate}</label>
    7272          <select class="switcher" data-type="theme">
    7373            {html_options options=$ato.THEMES selected=$ato.MULTIVIEW.theme}
    7474          </select>
    7575        </li>
    76         <li><label>Language</label>
     76        <li><label>{'Language'|translate}</label>
    7777          <select class="switcher" data-type="lang">
    7878            {html_options options=$ato.LANGS selected=$ato.MULTIVIEW.lang}
    7979          </select>
    8080        </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>
     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>
    8787      </ul>
    8888    </li>
    8989  {if $ato.USER.id != $ato.MULTIVIEW.view_as}
    9090    <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>
     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>
    9393    </li>
    9494  {/if}
     
    101101    <form method="post" action="{$ato.U_SELF}">
    102102      <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>
     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>
    106106      </fieldset>
    107107
     
    110110        <input type="text" name="name" id="quick_edit_name" value="{$ato.QUICK_EDIT.name|escape:html}">
    111111
     112      {if isset($ato.IS_PICTURE)}
    112113        <label for="quick_edit_author">{'Author'|translate}</label>
    113114        <input type="text" name="author" id="quick_edit_author" value="{$ato.QUICK_EDIT.author|escape:html}">
    114 
    115115
    116116        <label for="quick_edit_date_creation">{'Creation date'|translate}</label>
     
    125125        </select>
    126126
    127         <label for="quick_edit_comment">{'Description'|translate}</label>
    128         <textarea name="comment" id="quick_edit_comment">{$ato.QUICK_EDIT.comment}</textarea>
    129 
    130127        <label for="quick_edit_level">{'Who can see this photo?'|@translate}</label>
    131128        <select name="level" size="1">
    132129          {html_options options=$available_permission_levels selected=$ato.QUICK_EDIT.level}
    133130        </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>
    134135      </fieldset>
    135136
     
    142143{footer_script require='jquery'}
    143144(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 
    144164  var $ato = $('#ato_header'),
    145165      $ato_closed = $('#ato_header_closed'),
     
    155175  if (window.localStorage.ato_panel_open == "true") {
    156176    $ato.show();
    157     $('body').css({ldelim}'margin-top': '+='+ato_height});
     177    moveBody('show', false);
    158178  }
    159179  else {
     
    184204  $ato.find('.switcher').on({
    185205    'change': function() {
    186       window.location.href = '{$ato.U_SELF}'+ $(this).data('type') +'='+ $(this).val();
     206      window.location.href = '{$ato.U_SELF}ato_'+ $(this).data('type') +'='+ $(this).val();
    187207    },
    188208    'click': function(e) {
     
    195215    $ato.slideUp();
    196216    $ato_closed.slideDown();
    197     $('body').animate({ldelim}'margin-top': '-='+ato_height});
     217    moveBody('hide', true);
    198218
    199219    window.localStorage.ato_panel_open = "false";
     
    204224    $ato.slideDown();
    205225    $ato_closed.slideUp();
    206     $('body').animate({ldelim}'margin-top': '+='+ato_height});
     226    moveBody('show', true);
    207227
    208228    window.localStorage.ato_panel_open = "true";
     
    269289  var $ato_edit = $('#ato_quick_edit');
    270290
    271   $ato_edit.css('background-color', $("#the_page #content").css('background-color'));
     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);
    272296
    273297  $ato_edit.find('.close-edit').on('click', function(e) {
     
    276300  });
    277301
     302{if isset($ato.IS_PICTURE)}
    278303  $ato_edit.find('.datepicker').datepicker({
    279304    dateFormat: 'yy-mm-dd'
     
    292317    }
    293318  );
     319{/if}
    294320
    295321  $(".edit-quick").colorbox({
  • extensions/AdminTools/template/style.css

    r25654 r25655  
    9595    color:#777;
    9696    display:inline-block;
    97     width:60px;
    98     padding:5px 10px;
     97    width:80px;
     98    padding:5px;
    9999    text-align:right;
     100    font-size:11px;
    100101  }
    101102  #ato_header_root ul select, #ato_header_root ul option {
     
    144145    text-align:center;
    145146  }
    146     #ato_quick_edit input[type="submit"] {
    147       margin:1.5em 0;
     147    #ato_quick_edit fieldset.left img {
     148      border-radius:2px;
     149      border:1px solid #111;
    148150    }
    149151  #ato_quick_edit fieldset.main {
     
    165167      height:110px;
    166168    }
     169    #ato_quick_edit input[type="submit"] {
     170      margin:1.5em 0;
     171      cursor:pointer;
     172      background:#e60;
     173      border:none;
     174      color:#fff;
     175    }
     176      #ato_quick_edit input[type="submit"]:hover {
     177        background:#EF962F;
     178      }
    167179    #ato_quick_edit ul.token-input-list {
    168180      width:100%;
Note: See TracChangeset for help on using the changeset viewer.