Ignore:
Timestamp:
12/20/13 21:14:40 (6 years ago)
Author:
mistic100
Message:

add configuration page

Location:
extensions/AdminTools
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/AdminTools/include/events.inc.php

    r25979 r26061  
    3232    } 
    3333  } 
    34   else if (script_basename() == 'picture' and $picture['current']['added_by'] == $user['id']) 
     34  else if ($conf['AdminTools']['public_quick_edit'] and 
     35      script_basename() == 'picture' and $picture['current']['added_by'] == $user['id'] 
     36    ) 
    3537  { // only "edit" button for photo owner 
    3638  } 
     
    4042  } 
    4143 
     44  $tpl_vars['POSITION'] = $conf['AdminTools']['closed_position']; 
     45  $tpl_vars['DEFAULT_OPEN'] = $conf['AdminTools']['default_open']; 
    4246  $tpl_vars['U_SELF'] = $MultiView->get_clean_url(true); 
    4347 
  • extensions/AdminTools/language/en_UK/plugin.lang.php

    r25839 r26061  
    1313$lang['Show SQL queries'] = 'Show SQL queries'; 
    1414$lang['View as'] = 'View as'; 
     15$lang['Closed icon position'] = 'Closed icon position'; 
     16$lang['Give access to quick edit to photo owners even if they are not admin'] = 'Give access to quick edit to photo owners even if they are not admin'; 
     17$lang['Open toolbar by default'] = 'Open toolbar by default'; 
     18$lang['left'] = 'left'; 
     19$lang['right'] = 'right'; 
    1520 
    1621?> 
  • extensions/AdminTools/language/fr_FR/plugin.lang.php

    r25839 r26061  
    1313$lang['Show SQL queries'] = 'Afficher les requêtes SQL'; 
    1414$lang['View as'] = 'Voir en tant que'; 
     15$lang['Closed icon position'] = 'Position the l\'icône fermé'; 
     16$lang['Give access to quick edit to photo owners even if they are not admin'] = 'Autoriser l\'accès à l\'édition rapide aux propriétaires des photos même s\'ils ne sont pas admin'; 
     17$lang['Open toolbar by default'] = 'Ouvrir la barre par défaut'; 
     18$lang['left'] = 'gauche'; 
     19$lang['right'] = 'droite'; 
    1520 
    1621?> 
  • extensions/AdminTools/main.inc.php

    r25916 r26061  
    1717define('ADMINTOOLS_ID',       basename(dirname(__FILE__))); 
    1818define('ADMINTOOLS_PATH' ,    PHPWG_PLUGINS_PATH . ADMINTOOLS_ID . '/'); 
    19 // define('ADMINTOOLS_ADMIN',    get_root_url() . 'admin.php?page=plugin-' . ADMINTOOLS_ID); 
     19define('ADMINTOOLS_ADMIN',    get_root_url() . 'admin.php?page=plugin-' . ADMINTOOLS_ID); 
    2020define('ADMINTOOLS_VERSION',  'auto'); 
    2121 
     
    4545  add_event_handler('loc_begin_index', 'admintools_save_category'); 
    4646} 
     47else 
     48{ 
     49  add_event_handler('get_admin_plugin_menu_links', 'admintools_admin_link'); 
     50} 
    4751 
    4852 
     
    5256function admintools_init() 
    5357{ 
    54   global $MultiView; 
     58  global $conf; 
     59 
     60  include_once(ADMINTOOLS_PATH . 'maintain.inc.php'); 
     61  $maintain = new AdminTools_maintain(ADMINTOOLS_ID); 
     62  $maintain->autoUpdate(ADMINTOOLS_VERSION, 'install'); 
    5563 
    5664  load_language('plugin.lang', ADMINTOOLS_PATH); 
    5765 
    58   // global $conf; 
     66  $conf['AdminTools'] = unserialize($conf['AdminTools']); 
     67} 
    5968 
    60   // include_once(ADMINTOOLS_PATH . 'maintain.inc.php'); 
    61   // $maintain = new AdminTools_maintain(ADMINTOOLS_ID); 
    62   // $maintain->autoUpdate(ADMINTOOLS_VERSION, 'install'); 
     69function admintools_admin_link($menu)  
     70{ 
     71  $menu[] = array( 
     72    'NAME' => 'Admin Tools', 
     73    'URL' => ADMINTOOLS_ADMIN, 
     74    ); 
    6375 
    64   // $conf['AdminTools'] = unserialize($conf['AdminTools']); 
     76  return $menu; 
    6577} 
  • extensions/AdminTools/maintain.inc.php

    r25617 r26061  
    22defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 
    33 
    4 // class AdminTools_maintain extends PluginMaintain 
    5 // { 
    6   // private $installed = false; 
     4class AdminTools_maintain extends PluginMaintain 
     5{ 
     6  private $installed = false; 
     7   
     8  private $default_conf = array( 
     9    'default_open' => true, 
     10    'closed_position' => 'left', 
     11    'public_quick_edit' => true, 
     12    ); 
    713 
    8   // function install($plugin_version, &$errors=array()) 
    9   // { 
    10     // global $conf; 
     14  function install($plugin_version, &$errors=array()) 
     15  { 
     16    global $conf; 
    1117 
    12     // if (empty($conf['AdminTools'])) 
    13     // { 
    14       // $conf['AdminTools'] = serialize(array( 
    15         // )); 
     18    if (empty($conf['AdminTools'])) 
     19    { 
     20      $conf['AdminTools'] = serialize($this->default_conf); 
     21      conf_update_param('AdminTools', $conf['AdminTools']); 
     22    } 
    1623 
    17       // conf_update_param('AdminTools', $conf['AdminTools']); 
    18     // } 
     24    $this->installed = true; 
     25  } 
    1926 
    20     // $this->installed = true; 
    21   // } 
     27  function activate($plugin_version, &$errors=array()) 
     28  { 
     29    if (!$this->installed) 
     30    { 
     31      $this->install($plugin_version, $errors); 
     32    } 
     33  } 
    2234 
    23   // function activate($plugin_version, &$errors=array()) 
    24   // { 
    25     // if (!$this->installed) 
    26     // { 
    27       // $this->install($plugin_version, $errors); 
    28     // } 
    29   // } 
     35  function deactivate() 
     36  { 
     37  } 
    3038 
    31   // function deactivate() 
    32   // { 
    33   // } 
    34  
    35   // function uninstall() 
    36   // { 
    37     // conf_delete_param('AdminTools'); 
    38   // } 
    39 // } 
     39  function uninstall() 
     40  { 
     41    conf_delete_param('AdminTools'); 
     42  } 
     43} 
  • extensions/AdminTools/template/public_controller.js

    r25979 r26061  
    33 
    44  this.urlWS; 
     5  this.urlSelf; 
    56  this.multiView; 
    67 
     
    101102 
    102103  // attach jquery handlers 
    103   this.init = function(urlSelf) { 
     104  this.init = function(open) { 
    104105    $('body').prepend($ato); // ensure the bar is at the begining 
    105106     
     
    109110    if ('localStorage' in window) { 
    110111      if (window.localStorage.ato_panel_open == null) { 
    111         window.localStorage.ato_panel_open = "true"; 
    112       } 
    113  
    114       if (window.localStorage.ato_panel_open == "true") { 
     112        window.localStorage.ato_panel_open = open; 
     113      } 
     114 
     115      if (window.localStorage.ato_panel_open == 1) { 
    115116        moveBody('show', false); 
    116117      } 
     
    151152    $ato.find('.switcher').on({ 
    152153      'change': function() { 
    153         window.location.href = urlSelf + 'ato_'+ $(this).data('type') +'='+ $(this).val(); 
     154        window.location.href = __this.urlSelf + 'ato_'+ $(this).data('type') +'='+ $(this).val(); 
    154155      }, 
    155156      'click': function(e) { 
     
    164165      moveBody('hide', true); 
    165166 
    166       if ('localStorage' in window) window.localStorage.ato_panel_open = "false"; 
     167      if ('localStorage' in window) window.localStorage.ato_panel_open = 0; 
    167168      e.preventDefault(); 
    168169    }); 
     
    173174      moveBody('show', true); 
    174175 
    175       if ('localStorage' in window) window.localStorage.ato_panel_open = "true"; 
     176      if ('localStorage' in window) window.localStorage.ato_panel_open = 1; 
    176177      e.preventDefault(); 
    177178    }); 
  • extensions/AdminTools/template/public_controller.tpl

    r25924 r26061  
    3333{footer_script require='admintools.controller'} 
    3434AdminTools.urlWS = '{$ROOT_URL}ws.php?format=json&method='; 
     35AdminTools.urlSelf = '{$ato.U_SELF}'; 
    3536 
    3637{if isset($ato.MULTIVIEW)} 
     
    4546  AdminTools.deleteCache(); 
    4647{/if} 
    47   AdminTools.init("{$ato.U_SELF}"); 
     48  AdminTools.init({intval($ato.DEFAULT_OPEN)}); 
    4849{if $themeconf.mobile} 
    4950  AdminTools.initMobile(); 
     
    6566{/footer_script} 
    6667 
    67 <div id="ato_header_closed"><a href="#" class="icon-tools"></a></div> 
     68<div id="ato_header_closed"{if $ato.POSITION=='right'} class="right"{/if}><a href="#" class="icon-tools"></a></div> 
    6869 
    6970<div id="ato_header"> 
    7071  <ul> 
    71     <li><a href="#" class="icon-ato-cancel close-panel"></a></li> 
     72    <li{if $ato.POSITION=='right'} class="right"{/if}><a href="#" class="icon-ato-cancel close-panel"></a></li> 
    7273  {if isset($ato.U_SITE_ADMIN)} 
    7374    <li class="parent"><a href="#" class="icon-menu ato-min-1">{'Administration'|translate}</a> 
  • extensions/AdminTools/template/style.css

    r25979 r26061  
    1 .icon-ato-null:before { content: ' '; } 
     1.icon-ato-null:before { content:' '; } 
    22 
    33.token-input-dropdown { 
     
    5454    float:right; 
    5555  } 
    56   #ato_header>ul>li:not(:first-child) { 
     56  #ato_header>ul>li { 
    5757    border-left:1px solid #666; 
    5858  } 
    59   #ato_header>ul>li:not(:last-child) { 
     59  #ato_header>ul>li { 
    6060    border-right:1px solid #222; 
    6161  } 
     
    128128  height:35px; 
    129129} 
     130  #ato_header_closed:not(.smartpocket).right { 
     131    left:auto; 
     132    right:10px; 
     133  } 
    130134  #ato_header_closed:not(.smartpocket)>* { 
    131135    padding:4px; 
Note: See TracChangeset for help on using the changeset viewer.