Changeset 25655 for extensions/AdminTools
- Timestamp:
- Nov 23, 2013, 5:47:04 PM (10 years ago)
- Location:
- extensions/AdminTools
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AdminTools/include/MultiView.class.php
r25619 r25655 1 1 <?php 2 defined('ADMINTOOLS_ ID') or die('Hacking attempt!');2 defined('ADMINTOOLS_PATH') or die('Hacking attempt!'); 3 3 4 4 /** … … 129 129 130 130 // 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']; 134 134 } 135 135 if ($this->data['view_as'] != $user['id']) … … 141 141 142 142 // 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']; 146 146 } 147 147 $user['theme'] = $this->data['theme']; 148 148 149 149 // 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']; 153 153 } 154 154 $user['language'] = $this->data['lang']; 155 155 156 156 // 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']; 160 160 } 161 161 $conf['show_queries'] = $this->data['show_queries']; 162 162 163 163 // 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']; 167 167 } 168 168 $conf['debug_l10n'] = $this->data['debug_l10n']; 169 169 170 170 // 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']; 174 174 } 175 175 $conf['debug_template'] = $this->data['debug_template']; 176 176 177 177 // 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']; 181 181 } 182 182 $conf['template_combine_files'] = $this->data['template_combine_files']; 183 183 184 184 // 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']; 188 188 } 189 189 if ($this->data['no_history']) … … 201 201 public function init() 202 202 { 203 if (isset($_GET[' purge_template']))203 if (isset($_GET['ato_purge_template'])) 204 204 { 205 205 global $template; -
extensions/AdminTools/include/events.inc.php
r25654 r25655 2 2 defined('ADMINTOOLS_PATH') or die('Hacking attempt!'); 3 3 4 /** 5 * Add main toolbar to current page 6 * @trigger loc_after_page_header 7 */ 4 8 function admintools_add_public_controller() 5 9 { … … 24 28 ); 25 29 30 if (!is_admin()) 31 { 32 load_language('admin.lang'); 33 } 34 35 switch_lang_to(get_default_language()); 36 26 37 // TODO : param to allow owner modification 27 38 if (script_basename() == 'picture') … … 86 97 87 98 $tpl_vars['QUICK_EDIT'] = array( 88 ' file' => $picture['current']['file'],99 'img' => $picture['current']['derivatives']['square'], 89 100 'name' => $picture['current']['name'], 90 101 'comment' => $picture['current']['comment'], … … 118 129 ); 119 130 } 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 ); 120 140 } 121 141 … … 134 154 include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php'); 135 155 $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 } 139 162 } 140 163 … … 153 176 $template->set_filename('ato', realpath(ADMINTOOLS_PATH . 'template/public_controller.tpl')); 154 177 $template->parse('ato'); 155 } 156 178 179 switch_lang_back(); 180 } 181 182 /** 183 * Disable privacy level switchbox 184 */ 157 185 function admintools_remove_privacy($content) 158 186 { … … 162 190 } 163 191 192 /** 193 * Save picture form 194 * @trigger loc_begin_picture 195 */ 164 196 function admintools_save_picture() 165 197 { … … 225 257 } 226 258 } 259 260 /** 261 * Save category form 262 * @trigger loc_begin_index 263 */ 264 function 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 1 1 <?php 2 2 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 3 16 ?> -
extensions/AdminTools/language/fr_FR/plugin.lang.php
r25617 r25655 1 1 <?php 2 2 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 3 16 ?> -
extensions/AdminTools/main.inc.php
r25654 r25655 29 29 $MultiView = new MultiView(); 30 30 31 //add_event_handler('init', 'admintools_init');31 add_event_handler('init', 'admintools_init'); 32 32 33 33 if (!defined('IN_ADMIN')) … … 35 35 add_event_handler('loc_after_page_header', 'admintools_add_public_controller'); 36 36 add_event_handler('loc_begin_picture', 'admintools_save_picture'); 37 add_event_handler('loc_begin_index', 'admintools_save_category'); 37 38 } 38 39 … … 44 45 // | Plugin initialization | 45 46 // +-----------------------------------------------------------------------+ 46 //function admintools_init()47 //{47 function admintools_init() 48 { 48 49 // global $conf; 49 50 … … 52 53 // $maintain->autoUpdate(ADMINTOOLS_VERSION, 'install'); 53 54 54 //load_language('plugin.lang', ADMINTOOLS_PATH);55 load_language('plugin.lang', ADMINTOOLS_PATH); 55 56 56 57 // $conf['AdminTools'] = unserialize($conf['AdminTools']); 57 //}58 } -
extensions/AdminTools/template/public_controller.tpl
r25654 r25655 64 64 <li class="parent right"><a class="icon-cog-alt" href="#">{'Tools'|translate}</a> 65 65 <ul> 66 <li><label> View as</label>66 <li><label>{'View as'|translate}</label> 67 67 <select class="switcher" data-type="view_as"> 68 68 {html_options options=$ato.USERS selected=$ato.MULTIVIEW.view_as} 69 69 </select> 70 70 </li> 71 <li><label> Theme</label>71 <li><label>{'Theme'|translate}</label> 72 72 <select class="switcher" data-type="theme"> 73 73 {html_options options=$ato.THEMES selected=$ato.MULTIVIEW.theme} 74 74 </select> 75 75 </li> 76 <li><label> Language</label>76 <li><label>{'Language'|translate}</label> 77 77 <select class="switcher" data-type="lang"> 78 78 {html_options options=$ato.LANGS selected=$ato.MULTIVIEW.lang} 79 79 </select> 80 80 </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&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> 87 87 </ul> 88 88 </li> 89 89 {if $ato.USER.id != $ato.MULTIVIEW.view_as} 90 90 <li class="right"> 91 {' 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 {'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 93 </li> 94 94 {/if} … … 101 101 <form method="post" action="{$ato.U_SELF}"> 102 102 <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> 106 106 </fieldset> 107 107 … … 110 110 <input type="text" name="name" id="quick_edit_name" value="{$ato.QUICK_EDIT.name|escape:html}"> 111 111 112 {if isset($ato.IS_PICTURE)} 112 113 <label for="quick_edit_author">{'Author'|translate}</label> 113 114 <input type="text" name="author" id="quick_edit_author" value="{$ato.QUICK_EDIT.author|escape:html}"> 114 115 115 116 116 <label for="quick_edit_date_creation">{'Creation date'|translate}</label> … … 125 125 </select> 126 126 127 <label for="quick_edit_comment">{'Description'|translate}</label>128 <textarea name="comment" id="quick_edit_comment">{$ato.QUICK_EDIT.comment}</textarea>129 130 127 <label for="quick_edit_level">{'Who can see this photo?'|@translate}</label> 131 128 <select name="level" size="1"> 132 129 {html_options options=$available_permission_levels selected=$ato.QUICK_EDIT.level} 133 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> 134 135 </fieldset> 135 136 … … 142 143 {footer_script require='jquery'} 143 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 144 164 var $ato = $('#ato_header'), 145 165 $ato_closed = $('#ato_header_closed'), … … 155 175 if (window.localStorage.ato_panel_open == "true") { 156 176 $ato.show(); 157 $('body').css({ldelim}'margin-top': '+='+ato_height});177 moveBody('show', false); 158 178 } 159 179 else { … … 184 204 $ato.find('.switcher').on({ 185 205 '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(); 187 207 }, 188 208 'click': function(e) { … … 195 215 $ato.slideUp(); 196 216 $ato_closed.slideDown(); 197 $('body').animate({ldelim}'margin-top': '-='+ato_height});217 moveBody('hide', true); 198 218 199 219 window.localStorage.ato_panel_open = "false"; … … 204 224 $ato.slideDown(); 205 225 $ato_closed.slideUp(); 206 $('body').animate({ldelim}'margin-top': '+='+ato_height});226 moveBody('show', true); 207 227 208 228 window.localStorage.ato_panel_open = "true"; … … 269 289 var $ato_edit = $('#ato_quick_edit'); 270 290 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); 272 296 273 297 $ato_edit.find('.close-edit').on('click', function(e) { … … 276 300 }); 277 301 302 {if isset($ato.IS_PICTURE)} 278 303 $ato_edit.find('.datepicker').datepicker({ 279 304 dateFormat: 'yy-mm-dd' … … 292 317 } 293 318 ); 319 {/if} 294 320 295 321 $(".edit-quick").colorbox({ -
extensions/AdminTools/template/style.css
r25654 r25655 95 95 color:#777; 96 96 display:inline-block; 97 width: 60px;98 padding:5px 10px;97 width:80px; 98 padding:5px; 99 99 text-align:right; 100 font-size:11px; 100 101 } 101 102 #ato_header_root ul select, #ato_header_root ul option { … … 144 145 text-align:center; 145 146 } 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; 148 150 } 149 151 #ato_quick_edit fieldset.main { … … 165 167 height:110px; 166 168 } 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 } 167 179 #ato_quick_edit ul.token-input-list { 168 180 width:100%;
Note: See TracChangeset
for help on using the changeset viewer.