Changeset 6573 for extensions/nbc_ThemeChanger
- Timestamp:
- Jun 22, 2010, 9:32:27 PM (14 years ago)
- Location:
- extensions/nbc_ThemeChanger
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/nbc_ThemeChanger/Version.txt
r4083 r6573 1 Version 2.1.0.b 2 3 [lang=fr] 4 5 Correction du bug sur les noms de menu avec espace. 6 Correction du bug sur la fonctionnalité "modifiée" (lorsqu'on clique sur "modifier l'association", la catégorie sélectionnée par défaut est celle à modifier (et non plus la première de la liste)) 7 8 Fichiers impactés : 9 main.inc.php 10 admin/nbc_ThemeChanger_admin.php 11 admin/nbc_ThemeChanger_admin.tpl 12 [/lang=fr] 13 [lang=en] 14 15 Correction of the bug on menu name with spaces. 16 Correction of a regretion bug on the "Modify" functionality , "Modify association" will now correctly fill in the form. 17 18 Files modifies: 19 main.inc.php 20 admin/nbc_ThemeChanger_admin.php 21 admin/nbc_ThemeChanger_admin.tpl 22 [/lang=en] 23 24 [lang=it] 25 26 Correzione del bug sulla denominazione delle teme con spazio. 27 Correzione della funzionalità "Modificare". "Modificare l'associazione" riempirà correttamente il formulario. 28 29 File modificati : 30 main.inc.php 31 admin/nbc_ThemeChanger_admin.php 32 admin/nbc_ThemeChanger_admin.tpl 33 34 35 [/lang=it] 36 -------------------------------------------------- 37 Version 2.1.0.a 38 39 [lang=fr] 40 Portage plugin on piwigo 2.1.x 41 [/lang=fr] 42 [lang=en] 43 compatibility for piwigo 2.1.x 44 [/lang=en] 45 [lang=it] 46 compatibilità per la versione piwigo 2.1.x 47 [/lang=it] 48 -------------------------------------------------- 1 49 Version 2.0.1.b 2 50 [lang=fr] … … 11 59 admin/nbc_ThemeChanger_admin.tpl 12 60 [/lang=fr] 13 [lang= US]61 [lang=en] 14 62 Add of the possibility of applying the theme modification on all the sub-categories of the category selected. 15 63 Add of the full category's name path ("Photo/Nuit" instead of "Nuit" only) … … 21 69 admin/nbc_ThemeChanger_admin.php 22 70 admin/nbc_ThemeChanger_admin.tpl 23 [/lang= US]71 [/lang=en] 24 72 25 73 [lang=IT] -
extensions/nbc_ThemeChanger/admin/nbc_ThemeChanger_admin.php
r6552 r6573 1 1 <?php 2 //if (!defined(PHPWG_ROOT_PATH)) die('Hacking attempt!'); 2 3 include_once (NBC_ThemeChanger_PATH.'include/functions_ThemeChanger.inc.php'); 3 4 4 5 global $user, $conf, $template; 6 7 $__BEBUG = 0; 5 8 6 9 // Check Access and exit when user status is not ok … … 8 11 9 12 $me = get_plugin_data($plugin_id); 10 11 13 load_language('plugin.lang', NBC_ThemeChanger_PATH); 12 14 $page_ThemeChanger_admin = get_admin_plugin_menu_link(__FILE__); 13 15 14 16 15 16 $cat=array();17 $categories = array();18 19 20 17 //chargement des catégories 21 $query = ' 22 SELECT id, name, uppercats, global_rank 23 FROM '.CATEGORIES_TABLE.' ; 24 '; 25 $result = pwg_query($query); 26 27 while (($cat = mysql_fetch_array($result)) <> null) 28 { 29 array_push($categories , array("id" => $cat['id'], 30 "name" => $cat['name'], 31 "uppercats" =>$cat['uppercats'], 32 "longName" => get_cat_display_name_cache($cat['uppercats'], null, false), 33 "global_rank" => $cat['global_rank'], 34 )); 35 } 36 18 $categories = my_get_pwg_categories(); 19 37 20 38 21 //chargement des thèmes 39 $themes = array(); 40 foreach (get_pwg_themes() as $pwg_template) 41 { 42 $selected = $pwg_template; 43 array_push($themes, $selected); 44 } 45 22 $themes = my_get_pwg_themes(); 23 if ($__BEBUG) 24 { 25 echo '0 '.$themes[0]['id'] .':'. $themes[0]['name'] .'<br>'; 26 echo '0 '.$themes[1]['id'] .':'. $themes[1]['name'] .'<br>'; 27 echo '0 '.$themes[2]['id'] .':'. $themes[2]['name'] .'<br>'; 28 echo '0 '.$themes[3]['id'] .':'. $themes[3]['name'] .'<br>'; 29 } 46 30 47 31 // Configuration du template … … 51 35 'F_ACTION' => add_url_params($page_ThemeChanger_admin, array()), 52 36 'U_ADD_ASSOC' => add_url_params($page_ThemeChanger_admin, array('action' => 'add_assoc')), 53 'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=ThemeChanger _admin',37 'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=ThemeChanger', 54 38 'Themes' => $themes, 55 39 'Categories' => $categories, 40 'page_banner' => $conf['page_banner'], 41 'gallery_title' => $conf['gallery_title'] 56 42 )); 57 43 58 // Mise a jour de la base de donnee 44 // Configuration du formulaire 45 $template->assign('formulaire',array( 46 'DESCRIPION' => $lang['add_assoc'], 47 )); 48 49 //Recupération options du plugin 50 $conf_nbc_ThemeChanger = isset($conf['nbc_ThemeChanger']) ? explode(";" , $conf['nbc_ThemeChanger']) : array(); 51 52 53 // Mise a jour des paramètres du plugin 59 54 if (isset($_POST['submit']) and !is_adviser()) 60 55 if ( (isset($_POST['categorychoise']) or isset($_POST['category_id'])) and isset($_POST['template'])) 61 { 62 $conf_nbc_ThemeChanger = isset($conf['nbc_ThemeChanger']) ? explode(";" , $conf['nbc_ThemeChanger']) : array();56 { 57 63 58 $listcategory = array(); 64 59 $newconf_nbc_ThemeChanger = ''; 65 //evol $theme = explode("/" , $_POST['template']); 60 $add_ok = false; 61 //recupération des variables 66 62 $theme = $_POST['template']; 67 $add_ok = false;68 69 63 $applysubcategory = isset($_POST['ApplySubCategories']) ? $_POST['ApplySubCategories'] : ''; 70 64 $thecategory = isset($_POST['categorychoise']) ? $_POST['categorychoise'] : ( isset($_POST['category_id']) ? $_POST['category_id'] : ''); … … 136 130 } 137 131 138 $conf_nbc_ThemeChanger = isset($conf['nbc_ThemeChanger']) ? explode(";" , $conf['nbc_ThemeChanger']) : array();139 140 $catsused = array();141 $assoc_ThemeChanger = array();142 143 foreach ($conf_nbc_ThemeChanger as $Theme_Cat)144 {145 $element_ThemeChanger = explode("," , $Theme_Cat);146 147 if ($element_ThemeChanger[0] <> '' and $element_ThemeChanger[1] <> '')148 {149 array_push($catsused, $element_ThemeChanger[0]);150 151 $query = '152 SELECT uppercats153 FROM '.CATEGORIES_TABLE.'154 WHERE id = \''.$element_ThemeChanger[0].'\'155 ;';156 157 $result = pwg_query($query);158 $row = mysql_fetch_array($result);159 160 $assoc_ThemeChanger[$element_ThemeChanger[0]] = array(161 'CATEGORY_NAME' => get_cat_display_name_cache($row['uppercats'], null, false),162 'TEMPLATE' => $element_ThemeChanger[1],163 );164 }165 }166 132 167 133 //delete an association 168 134 if ( isset($_GET['action']) and ($_GET['action']=='del_assoc') and isset($_GET['id_cat']) and is_numeric($_GET['id_cat']) and !is_adviser() ) 169 135 { 170 $conf_nbc_ThemeChanger = isset($conf['nbc_ThemeChanger']) ? explode(";" , $conf['nbc_ThemeChanger']) : array(); 171 172 $newconf_nbc_ThemeChanger = ''; 136 137 $newconf_nbc_ThemeChanger = ''; 173 138 174 139 foreach ($conf_nbc_ThemeChanger as $Theme_Cat) … … 198 163 199 164 //modify an association 200 else if ( isset($_GET['action']) and ($_GET['action']=='mod_assoc') and isset($_GET['id_cat']) and is_numeric($_GET['id_cat']) )165 else if ( isset($_GET['action']) and ($_GET['action']=='mod_assoc') and isset($_GET['id_cat']) and is_numeric($_GET['id_cat']) and isset($_GET['id_theme']) ) 201 166 { 202 167 $template->assign('formulaire',array( 203 'DESCRIPION' => $lang['modify_assoc'].' : '.$assoc_ThemeChanger[$_GET['id_cat']]['CATEGORY_NAME'], 204 'NAMETOMODIFY' => $assoc_ThemeChanger[$_GET['id_cat']]['CATEGORY_NAME'], 168 'DESCRIPION' => $lang['modify_assoc'].' : '.get_long_categorie_name($_GET['id_cat']), 169 'THEMETOMODIFY' => $_GET['id_theme'], 170 'NAMETOMODIFY' => get_long_categorie_name($_GET['id_cat']), 205 171 'IDTOMODIFY' => $_GET['id_cat'], 206 172 )); 207 208 $template->assign('formulaire.categoryfield', array(209 'NAME' => $assoc_ThemeChanger[$_GET['id_cat']]['CATEGORY_NAME'],210 'ID' => $_GET['id_cat'],211 ));212 213 $blockname = 'formulaire.template_option';214 215 foreach (get_pwg_themes() as $pwg_template)216 {217 if ($assoc_ThemeChanger[$_GET['id_cat']]['TEMPLATE'] == $pwg_template)218 {219 $selected = 'selected="selected"';220 }221 else222 {223 $selected = '';224 }225 226 $template->assign(227 $blockname,228 array(229 'VALUE'=> $pwg_template,230 'CONTENT' => $pwg_template,231 'SELECTED' => $selected232 ));233 }234 173 } 235 174 … … 237 176 else if ( isset($_GET['action']) and ($_GET['action']=='add_assoc') ) 238 177 { 239 //$template->assign_var('formulaire',array( 240 $template->assign( 241 'formulaire', 242 array('DESCRIPION' => $lang['add_assoc'], 243 ) 244 ); 245 246 $template->assign('formulaire.categorylist', array()); 247 $blockname = 'formulaire.categorylist.parent_option'; 248 249 $template->assign($blockname, array()); 250 251 252 $query = ' 253 SELECT id, name, uppercats, global_rank 254 FROM '.CATEGORIES_TABLE.' 255 '; 256 if (!empty($catsused)) 257 { 258 $query .= ' 259 WHERE id NOT IN ('.implode(',', $catsused).') 260 '; 261 } 262 $query .= ' ;'; 263 display_select_cat_wrapper($query, array(), $blockname); 264 265 $blockname = 'formulaire.template_option'; 266 267 foreach (get_pwg_themes() as $pwg_template) 268 { 269 $template->assign( 270 $blockname, 271 array( 272 'VALUE'=> $pwg_template, 273 'CONTENT' => $pwg_template, 274 'SELECTED' => '', 275 ) 276 ); 277 } 278 } 279 178 $template->assign('formulaire', array( 179 'DESCRIPION' => $lang['add_assoc'], 180 )); 181 } 182 183 184 //needed to relaod the good configuration after delete 280 185 $conf_nbc_ThemeChanger = isset($conf['nbc_ThemeChanger']) ? explode(";" , $conf['nbc_ThemeChanger']) : array(); 281 186 282 187 $num = 0; 283 188 $catsused = array(); 284 $assoc_ThemeChanger = array();285 189 $assoc = array(); 286 190 191 //reconstruction du tableau d'association. 287 192 foreach ($conf_nbc_ThemeChanger as $Theme_Cat) 288 193 { … … 304 209 array_push($assoc , array( 305 210 'CLASS' => ($num++ % 2 == 1) ? 'row2' : 'row1', 306 'CATEGORY_NAME' 307 'CATEGORY_ID' 308 'TEMPLATE' => $element_ThemeChanger[1],211 'CATEGORY_NAME' => get_cat_display_name_cache($row['uppercats'], null, false), 212 'CATEGORY_ID' => $element_ThemeChanger[0], 213 'TEMPLATE' => my_get_pwg_themeName($element_ThemeChanger[1]), 309 214 'U_MODIFY' => add_url_params($page_ThemeChanger_admin, array( 310 'action' => 'mod_assoc', 311 'id_cat' => $element_ThemeChanger[0], 312 )), 313 'U_DELETE' => add_url_params($page_ThemeChanger_admin, array( 314 'action' => 'del_assoc', 315 'id_cat' => $element_ThemeChanger[0], 316 )),)); 317 318 $assoc_ThemeChanger[$element_ThemeChanger[0]] = array( 319 'CATEGORY_NAME' => get_cat_display_name_cache($row['uppercats'], null, false), 320 'TEMPLATE' => $element_ThemeChanger[1], 321 ); 215 'action' => 'mod_assoc', 216 'id_cat' => $element_ThemeChanger[0], 217 'id_theme' => $element_ThemeChanger[1], 218 )), 219 'U_DELETE' => add_url_params($page_ThemeChanger_admin, array( 220 'action' => 'del_assoc', 221 'id_cat' => $element_ThemeChanger[0], 222 )), 223 )); 322 224 } 323 225 } 324 $template->assign( 325 'assoc',$assoc ); 226 $template->assign('assoc',$assoc ); 326 227 327 228 -
extensions/nbc_ThemeChanger/admin/nbc_ThemeChanger_admin.tpl
r3954 r6573 3 3 </div> 4 4 <ul class="categoryActions"> 5 < li><a href="{$params.U_HELP}" onclick="popuphelp(this.href); return false;" title="{'HELP'|@translate}"><img src="{$themeconf.icon_dir}/help.png" class="button" alt="(?)"></a></li>5 <!--li><a href="{$params.U_HELP}" onclick="popuphelp(this.href); return false;" title="{'HELP'|@translate}"><img src="{$themeconf.icon_dir}/help.png" class="button" alt="(?)"></a></li--> 6 6 </ul> 7 7 … … 62 62 <!-- BEGIN template_option --> 63 63 {foreach from=$params.Themes item=Themes key=i} 64 <option value="{$Themes}" {$Themes}>{$Themes}</option> 64 {if ($formulaire.THEMETOMODIFY==$Themes.id)} 65 <option value="{$Themes.id}" selected ="selected">{$Themes.name}</option> 66 67 {else} 68 <option value="{$Themes.id}" {$Themes.id}>{$Themes.name}</option> 69 {/if} 70 65 71 {/foreach} 66 72 <!-- END template_option --> -
extensions/nbc_ThemeChanger/main.inc.php
r6553 r6573 2 2 /* 3 3 Plugin Name: NBC ThemeChanger 4 Version: 2.1.0. a4 Version: 2.1.0.B 5 5 Description: Permet d'associer à chaque catégorie virtuel ou physique un thème spécifique. 6 ThemeChanger vous permet de spécifier pour chaque caté gorie un thème différent.6 ThemeChanger vous permet de spécifier pour chaque catérie un thème différent. 7 7 Pour les catégories non spécifiées, le thème par défaut s'applique. 8 8 ThemeChanger allow you to associate for each category a specific theme. … … 17 17 define('NBC_ThemeChanger_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 18 18 19 //if (!defined(NBC_ThemeChanger_PATH)) die('Hacking attempt - ThemeChanger main.inc.php - NBC_ThemeChanger_PATH!');19 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 20 20 21 21 /* Set the administration panel of the plugin */ 22 22 23 23 24 class ThemeChanger … … 57 58 { 58 59 $user['theme'] = $category_theme[$page['category']['id']]; 59 $template = new Template(PHPWG_ROOT_PATH.'themes', $user['theme'] ); 60 61 $template = new Template(PHPWG_ROOT_PATH.'themes', $user['theme']); 60 62 } 61 63 }
Note: See TracChangeset
for help on using the changeset viewer.