Changeset 4382
- Timestamp:
- Nov 28, 2009, 7:20:01 PM (14 years ago)
- Location:
- extensions/AMenuManager
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMenuManager/admin/amm_sections.tpl
r3681 r4382 1 {known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"} 2 {known_script id="jquery.ui.sortable" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.sortable.packed.js"} 3 4 <div id="containerMenu"> 5 {foreach from=$sections item=section} 6 <div id="containerMenu_{$section}" class="containerMenuSection"> 7 <h3>{$section}</h3> 8 <ul class="connectedSortable categoryUl" id="menu_{$section}"> 9 {foreach from=$items item=data key=id} 10 {if $data.container==$section} 11 <li class="categoryLi menuItem {if $id=='qsearch'}menuItemDisabled{/if}" id="i{$id}"> 12 <img src="{$themeconf.admin_icon_dir}/cat_move.png" class="button drag_button" alt="{'Drag to re-order'|@translate}" title="{'Drag to re-order'|@translate}"/> 13 {$data.translation|@translate} 14 </li> 15 {/if} 16 {/foreach} 17 </ul> 18 </div> 19 {/foreach} 20 21 <input type="button" value="{'cancel'|@translate}" onclick="resetMenu('cancel');"/> 22 <input type="button" value="{'piwigo_default'|@translate}" onclick="resetMenu('default');"/> 23 <p><input type="button" value="{'apply_changes'|@translate}" onclick="submitChanges();"></p> 24 <form id="submitForm" method="POST" action=""> 25 <input type="hidden" name="fList" id="iList" value=""/> 26 </form> 27 </div> 28 29 30 31 1 32 {literal} 2 33 <script type="text/javascript"> 3 34 4 function load_list(do_action, item, position) 35 var resetValues = new Array(new Array(), new Array()); 36 37 {/literal} 38 39 // initialization for cancel et reset functions 40 {foreach from=$defaultValues item=value key=id} 41 resetValues[0].push( {literal} { {/literal} id:"{$id}", section:"{$value.container}", order:{$value.order} {literal} } {/literal} ); 42 {/foreach} 43 {foreach from=$items item=value key=id} 44 resetValues[1].push( {literal} { {/literal} id:"{$id}", section:"{$value.container}", order:{$value.order} {literal} } {/literal} ); 45 {/foreach} 46 {literal} 47 48 $("#containerMenu").sortable( 49 { 50 connectWith: '.connectedSortable', 51 cursor: 'move', 52 opacity:0.6, 53 items: 'li:not(.menuItemDisabled)', 54 tolerance:'pointer' 55 } 56 ); 57 58 function resetMenu(mode) 5 59 { 6 /* 7 do_action 8 'list' : just load list 9 'permut' : permut items in list 10 'delete' : delete the item in list 11 */ 12 var doc = document.getElementById("isections"); 60 (mode=='default')?key=0:key=1; 13 61 14 action_todo=''; 15 if(do_action=='position') 62 for(i=0;i<resetValues[key].length;i++) 16 63 { 17 action_todo='sections_position&fItem='+item+'&fPosition='+position;64 $("#menu_"+resetValues[key][i].section).get(0).appendChild($("#i"+resetValues[key][i].id).get(0)); 18 65 } 19 else if(do_action=='showhide') 66 } 67 68 function submitChanges() 69 { 70 datas=""; 71 72 items=$("#menu_menu").children(); 73 for(i=0;i<items.length;i++) 20 74 { 21 action_todo='sections_showhide&fItem='+item; 22 } 23 else 24 { 25 action_todo='sections_list'; 75 datas+=items.get(i).id.substr(1)+",menu,"+i+",();"; 26 76 } 27 77 28 if(action_todo!='') 78 items=$("#menu_special").children(); 79 for(i=0;i<items.length;i++) 29 80 { 30 http_request=create_httpobject('get', '', '{/literal}{$datas.AMM_AJAX_URL_LIST}{literal}'+action_todo, false); 31 http_request.send(null); 32 doc.innerHTML=http_request.responseText; 81 datas+=items.get(i).id.substr(1)+",special,"+i+",();"; 33 82 } 83 84 $("#iList").val(datas); 85 $("#submitForm").get(0).submit(); 34 86 } 35 87 36 88 </script> 37 89 {/literal} 38 39 40 <h3>41 {foreach from=$datas.LIST item=data}42 {$data.separator}43 {if $data.link!=''}44 <span style="font-weight:normal"><a href="{$data.link}" title="{$data.label|@translate}">45 {/if}46 {$data.label|@translate}47 {if $data.link!=''}48 </a></span>49 {/if}50 {/foreach}51 </h3>52 53 <div id="isections"></div>54 55 56 <script type="text/javascript">57 load_list('list', 0, 0);58 </script> -
extensions/AMenuManager/amm.css
r3681 r4382 4 4 table.littlefont td { text-align:left; padding:0px;padding-left:3px;padding-right:3px; } 5 5 6 .containerMenuSection { width:250px; margin:auto; padding:10px; } 7 li.menuItem { padding:4px; width:230px; cursor:move;} 8 li.menuItemDisabled { cursor:defaut;} -
extensions/AMenuManager/amm_aip.class.inc.php
r3690 r4382 4 4 Author : Grum 5 5 email : grum@grum.dnsalias.com 6 website : http://photos.grum. dnsalias.com6 website : http://photos.grum.fr 7 7 PWG user : http://forum.phpwebgallery.net/profile.php?id=3706 8 8 … … 17 17 18 18 include_once(PHPWG_PLUGINS_PATH.'AMenuManager/amm_root.class.inc.php'); 19 include_once(PHPWG_ROOT_PATH.'include/block.class.php'); 19 20 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 20 21 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/ajax.class.inc.php'); … … 27 28 protected $tabsheet; 28 29 protected $ajax; 30 protected $sectionsId=array('menu', 'special'); 29 31 30 32 protected $urls_modes=array(0 => 'new_window', 1 => 'current_window'); … … 65 67 public function manage() 66 68 { 67 global $template; 68 69 global $page; 69 global $template, $page; 70 70 71 71 $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/amm_admin.tpl"); … … 176 176 { 177 177 $page_nfo=l10n('g002_setmenu_nfo'); 178 $this->display_sections_ list_page($_REQUEST['action']);178 $this->display_sections_page(); 179 179 } 180 180 … … 221 221 break; 222 222 223 /* 223 224 case 'setmenu_modmenu_sections_list': 224 225 $result=$this->ajax_amm_setmenu_mod_section_list('amm_sections_modmenu'); … … 234 235 $result=$this->ajax_amm_setmenu_mod_section_showhide('amm_sections_modspecials', $_REQUEST['fItem']); 235 236 break; 237 */ 236 238 237 239 case 'personalised_list': … … 484 486 manage display for sections table page 485 487 */ 486 private function display_sections_list_page($action) 487 { 488 global $template, $user; 489 $template->set_filename('body_page', 490 dirname($this->filelocation).'/admin/amm_sections.tpl'); 491 492 switch($action) 493 { 494 case 'modmenu': 495 $tmp_list=array( 496 array('separator' => '', 'link' => '', 'label' => 'g002_modmenu'), 497 array('separator' => ' / ', 'link' => $this->page_link.'&fAMM_tabsheet=setmenu&action=modspecial', 'label' => 'g002_modspecial') 498 ); 499 break; 500 case 'modspecial': 501 $tmp_list=array( 502 array('separator' => '', 'link' => $this->page_link.'&fAMM_tabsheet=setmenu&action=modmenu', 'label' => 'g002_modmenu'), 503 array('separator' => ' / ', 'link' => '', 'label' => 'g002_modspecial') 504 ); 505 break; 506 } 507 508 $template_datas=array( 509 'AMM_AJAX_URL_LIST' => $this->page_link."&ajaxfct=setmenu_".$action."_", 510 'LIST' => $tmp_list 511 ); 512 513 $template->assign("datas", $template_datas); 488 private function display_sections_page() 489 { 490 global $template, $user, $page; 491 $template->set_filename('body_page', dirname($this->filelocation).'/admin/amm_sections.tpl'); 492 493 if(isset($_POST['fList']) && !$this->adviser_abort()) 494 { 495 /* the returned information in the fList form element are 496 * a list of ecah item, separate with a ";" 497 * each item have properties separated by a "," 498 * id, container, order, visibility 499 */ 500 $items=explode(";",$_POST['fList']); 501 for($i=0;$i<count($items)-1;$i++) 502 { 503 $properties=explode(",", $items[$i]); 504 $this->my_config['amm_sections_items'][$properties[0]]['container']=$properties[1]; 505 $this->my_config['amm_sections_items'][$properties[0]]['order']=$properties[2]; 506 $this->my_config['amm_sections_items'][$properties[0]]['visibility']=$properties[3]; 507 } 508 $this->sortSectionsItems(); 509 if($this->save_config()) 510 { 511 array_push($page['infos'], l10n('AMM_config_saved')); 512 } 513 else 514 { 515 array_push($page['errors'], l10n('AMM_adviser_not_authorized')); 516 } 517 } 518 519 $template->assign("sections", $this->sectionsId); 520 $template->assign("defaultValues", $this->defaultMenus); 521 $template->assign("items", $this->my_config['amm_sections_items']); 514 522 $template->assign_var_from_handle('AMM_BODY_PAGE', 'body_page'); 515 523 } … … 990 998 991 999 992 1000 /* 1001 * 993 1002 // return a html formatted list of special menu sections items 994 1003 private function ajax_amm_setmenu_mod_section_list($menuname) 995 1004 { 996 $labels=array( 997 'amm_sections_modspecials' => array( 998 'favorites' => 'favorite_cat', 999 'most_visited' => 'most_visited_cat', 1000 'best_rated' => 'best_rated_cat', 1001 'random' => 'random_cat', 1002 'recent_pics' => 'recent_pics_cat', 1003 'recent_cats' => 'recent_cats_cat', 1004 'calendar' => 'calendar' ), 1005 'amm_sections_modmenu' => array( 1006 'qsearch' => 'qsearch', 1007 'tags' => 'Tags', 1008 'search' => 'Search', 1009 'comments' => 'comments', 1010 'about' => 'About', 1011 'rss' => 'Notification' 1012 ) 1013 ); 1005 1014 1006 1015 1007 … … 1045 1037 return($this->ajax_amm_setmenu_mod_section_list($menuname)); 1046 1038 } 1039 * */ 1040 1047 1041 1048 1042 } // AMM_AIP class -
extensions/AMenuManager/amm_pip.class.inc.php
r4363 r4382 22 22 { 23 23 protected $ajax; 24 protected $displayRandomImageBlock=true; 24 25 25 26 function AMM_PIP($prefixeTable, $filelocation) … … 68 69 public function blockmanager_apply( $menu_ref_arr ) 69 70 { 70 global $user ;71 global $user, $page; 71 72 $menu = & $menu_ref_arr[0]; 72 73 73 global $page;74 74 75 75 /* … … 85 85 ); 86 86 $block->template = dirname(__FILE__).'/menu_templates/menubar_randompic.tpl'; 87 } 88 else 89 { 90 $this->displayRandomImageBlock=false; 87 91 } 88 92 … … 136 140 } 137 141 142 138 143 /* 139 144 hide items from special & menu sections 140 145 */ 141 foreach(array('mbMenu' => 'amm_sections_modmenu', 'mbSpecials' =>'amm_sections_modspecials') as $key0 => $val0) 142 { 143 if ( ($block = $menu->get_block( $key0 ) ) != null ) 144 { 145 foreach($this->my_config[$val0] as $key => $val) 146 { 147 if($val=='n') 148 { 149 unset( $block->data[$key] ); 150 } 151 } 152 } 153 } 154 } 146 $blocks=Array(); 147 $blocks['menu']=$menu->get_block('mbMenu'); 148 $blocks['special']=$menu->get_block('mbSpecials'); 149 150 $menuItems=array_merge($blocks['menu']->data, $blocks['special']->data); 151 $this->sortSectionsItems(); 152 153 $blocks['menu']->data=Array(); 154 $blocks['special']->data=Array(); 155 156 foreach($this->my_config['amm_sections_items'] as $key => $val) 157 { 158 if(isset($menuItems[$key])) 159 { 160 $blocks[$val['container']]->data[$key]=$menuItems[$key]; 161 } 162 } 163 if(count($blocks['menu']->data)==0) $menu->hide_block('mbMenu'); 164 if(count($blocks['special']->data)==0) $menu->hide_block('mbSpecials'); 165 } 155 166 156 167 /* … … 236 247 global $user, $template; 237 248 238 $menu = new BlockManager("menubar"); 239 $menu->load_registered_blocks(); 240 $menu->prepare_display(); 241 242 if ( ( ($block = $menu->get_block( 'mbAMM_randompict' ) ) != null ) && ($user['nb_total_images'] > 0) ) 249 if($this->displayRandomImageBlock) 243 250 { 244 251 $local_tpl = new Template(AMM_PATH."admin/", ""); -
extensions/AMenuManager/amm_root.class.inc.php
r3690 r4382 4 4 Author : Grum 5 5 email : grum@grum.fr 6 website : http://photos. fr6 website : http://photos.grum.fr 7 7 PWG user : http://forum.piwigo.org/profile.php?id=3706 8 8 … … 11 11 See main.inc.php for release information 12 12 13 AMM_root : root class efor plugin13 AMM_root : root class for plugin 14 14 15 15 --------------------------------------------------------------------------- */ … … 19 19 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'); 20 20 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/css.class.inc.php'); 21 21 22 22 23 class AMM_root extends common_plugin 23 24 { 24 25 protected $css; //the css object 26 protected $defaultMenus = array( 27 'favorites' => array('container' => 'special', 'visibility' => '', 'order' => 0, 'translation' => 'favorite_cat'), 28 'most_visited' => array('container' => 'special', 'visibility' => '', 'order' => 1, 'translation' => 'most_visited_cat'), 29 'best_rated' => array('container' => 'special', 'visibility' => '', 'order' => 2, 'translation' => 'best_rated_cat'), 30 'random' => array('container' => 'special', 'visibility' => '', 'order' => 3, 'translation' => 'random_cat'), 31 'recent_pics' => array('container' => 'special', 'visibility' => '', 'order' => 4, 'translation' => 'recent_pics_cat'), 32 'recent_cats' => array('container' => 'special', 'visibility' => '', 'order' => 5, 'translation' => 'recent_cats_cat'), 33 'calendar' => array('container' => 'special', 'visibility' => '', 'order' => 6, 'translation' => 'calendar'), 34 'qsearch' => array('container' => 'menu', 'visibility' => '', 'order' => 0, 'translation' => 'qsearch'), 35 'tags' => array('container' => 'menu', 'visibility' => '', 'order' => 1, 'translation' => 'Tags'), 36 'search' => array('container' => 'menu', 'visibility' => '', 'order' => 2, 'translation' => 'Search'), 37 'comments' => array('container' => 'menu', 'visibility' => '', 'order' => 3, 'translation' => 'comments'), 38 'about' => array('container' => 'menu', 'visibility' => '', 'order' => 4, 'translation' => 'About'), 39 'rss' => array('container' => 'menu', 'visibility' => '', 'order' => 5, 'translation' => 'Notification') 40 ); 25 41 26 42 function AMM_root($prefixeTable, $filelocation) … … 49 65 'amm_randompicture_height' => 0, //0: automatic, otherwise it's the fixed height in pixels 50 66 'amm_randompicture_title' => array(), 51 'amm_sections_modspecials' => array( 52 'favorites' => 'y', 53 'most_visited' => 'y', 54 'best_rated' => 'y', 55 'random' => 'y', 56 'recent_pics' => 'y', 57 'recent_cats' => 'y', 58 'calendar' => 'y' 59 ), 60 'amm_sections_modmenu' => array( 61 'qsearch' => 'y', 62 'tags' => 'y', 63 'search' => 'y', 64 'comments' => 'y', 65 'about' => 'y', 66 'rss' => 'y' 67 ) 67 'amm_sections_items' => $this->defaultMenus 68 68 ); 69 69 … … 191 191 192 192 193 protected function sortSectionsItemsCompare($a, $b) 194 { 195 if($a['container']==$b['container']) 196 { 197 if($a['order']==$b['order']) return(0); 198 return(($a['order']<$b['order'])?-1:1); 199 } 200 else return(($a['container']<$b['container'])?-1:1); 201 } 202 203 protected function sortSectionsItems() 204 { 205 uasort($this->my_config['amm_sections_items'], array($this, "sortSectionsItemsCompare")); 206 } 193 207 194 208 } // amm_root class 195 209 196 210 211 197 212 ?> -
extensions/AMenuManager/main.inc.php
r4363 r4382 13 13 Author : Grum 14 14 email : grum@grum.fr 15 website : http://photos. fr15 website : http://photos.grum.fr 16 16 PWG user : http://forum.piwigo.org/profile.php?id=3706 17 17 … … 44 44 | | | - es_ES 45 45 | | | - hu_HU (thx to sámli) 46 | 2.1.3 | 2009/11/24 | * move the js for "random image" in the the footer 46 | 2.1.3 | 2009/11/24 | * mantis:1285 47 | | | move the js for "random image" in the the footer 47 48 | | | (having the js inside the <dl> tag was not w3c 48 49 | | | compliant) 50 | | | * mantis:1132 51 | | | Allowing order management for items in Piwigo's core blocks 52 | | | * mantis:1133 53 | | | Allowing to group content from Piwigo's core blocks 54 | | | 55 | | | 56 | | | 57 | | | 58 | | | 59 | | | 60 | | | 61 | | | 49 62 | | | 50 63
Note: See TracChangeset
for help on using the changeset viewer.