Changeset 4389
- Timestamp:
- Nov 29, 2009, 4:49:03 PM (14 years ago)
- Location:
- extensions/AMenuManager
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMenuManager/admin/amm_sections.tpl
r4382 r4389 3 3 4 4 <div id="containerMenu"> 5 {foreach from=$sections item=section }5 {foreach from=$sections item=sectionName key=section} 6 6 <div id="containerMenu_{$section}" class="containerMenuSection"> 7 <h3>{$section }</h3>7 <h3>{$sectionName|@translate}</h3> 8 8 <ul class="connectedSortable categoryUl" id="menu_{$section}"> 9 9 {foreach from=$items item=data key=id} 10 10 {if $data.container==$section} 11 11 <li class="categoryLi menuItem {if $id=='qsearch'}menuItemDisabled{/if}" id="i{$id}"> 12 {if $id=="qsearch"} 13 {else} 12 14 <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}"/> 15 {/if} 13 16 {$data.translation|@translate} 17 <a onclick="switchVisibility('i{$id}_visibility');"> 18 <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/permissions.png" class="button drag_button" alt="{'g002_click_to_manage_rights'|@translate}" title="{'g002_click_to_manage_rights'|@translate}" 19 style="float:right;"/></a> 20 <div id="i{$id}_visibility" class="visibility"> 21 {$data.visibilityForm} 22 </div> 14 23 </li> 15 24 {/if} … … 18 27 </div> 19 28 {/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>29 <br/> 30 <input type="button" value="{'g002_cancel'|@translate}" onclick="resetMenu('cancel');"/> 31 <input type="button" value="{'g002_piwigo_default'|@translate}" onclick="resetMenu('default');"/> 32 <p><input type="button" value="{'g002_apply_changes'|@translate}" onclick="submitChanges();"></p> 24 33 <form id="submitForm" method="POST" action=""> 25 34 <input type="hidden" name="fList" id="iList" value=""/> 26 35 </form> 27 36 </div> 28 29 30 37 31 38 … … 39 46 // initialization for cancel et reset functions 40 47 {foreach from=$defaultValues item=value key=id} 41 resetValues[0].push( {literal} { {/literal} id:"{$id}", section:"{$value.container}", order:{$value.order} 48 resetValues[0].push( {literal} { {/literal} id:"{$id}", section:"{$value.container}", order:{$value.order}, visibility:"{$value.visibility}" {literal} } {/literal} ); 42 49 {/foreach} 43 50 {foreach from=$items item=value key=id} 44 resetValues[1].push( {literal} { {/literal} id:"{$id}", section:"{$value.container}", order:{$value.order} 51 resetValues[1].push( {literal} { {/literal} id:"{$id}", section:"{$value.container}", order:{$value.order}, visibility:"{$value.visibility}" {literal} } {/literal} ); 45 52 {/foreach} 46 53 {literal} … … 63 70 { 64 71 $("#menu_"+resetValues[key][i].section).get(0).appendChild($("#i"+resetValues[key][i].id).get(0)); 72 73 {/literal} 74 {foreach from=$visibility.users item=value} 75 $("#i"+resetValues[key][i].id+"_vis_user_{$value.id}").get(0).checked=/(.*,|^){$value.id}(?!\w)(\/)?/.test(resetValues[key][i].visibility); 76 {/foreach} 77 78 {foreach from=$visibility.groups item=value} 79 $("#i"+resetValues[key][i].id+"_vis_group_{$value.id}").get(0).checked=/(\/.*,|\/){$value.id}(?!\w)(\/)?/.test(resetValues[key][i].visibility); 80 {/foreach} 81 {literal} 82 65 83 } 66 84 } … … 73 91 for(i=0;i<items.length;i++) 74 92 { 75 datas+=items.get(i).id.substr(1)+",menu,"+i+" ,();";93 datas+=items.get(i).id.substr(1)+",menu,"+i+"#"+makeVisibility(items.get(i).id)+";"; 76 94 } 77 95 … … 79 97 for(i=0;i<items.length;i++) 80 98 { 81 datas+=items.get(i).id.substr(1)+",special,"+i+" ,();";99 datas+=items.get(i).id.substr(1)+",special,"+i+"#"+makeVisibility(items.get(i).id)+";"; 82 100 } 83 101 … … 86 104 } 87 105 106 function switchVisibility(id) 107 { 108 if($("#"+id).css('display')!='none') 109 { 110 $("#"+id).css({display:'none'}); 111 } 112 else 113 { 114 $("#"+id).css({display:'block'}); 115 } 116 } 117 118 function makeVisibility(id) 119 { 120 {/literal} 121 returned=""; 122 {foreach from=$visibility.users item=value} 123 returned+=($("#"+id+"_vis_user_{$value.id}").get(0).checked)?((returned=="")?"":",")+"{$value.id}":""; 124 {/foreach} 125 126 returned2=""; 127 {foreach from=$visibility.groups item=value} 128 returned2+=($("#"+id+"_vis_group_{$value.id}").get(0).checked)?((returned2=="")?"":",")+"{$value.id}":""; 129 {/foreach} 130 {literal} 131 132 return(returned+"/"+returned2); 133 } 134 88 135 </script> 89 136 {/literal} -
extensions/AMenuManager/amm.css
r4382 r4389 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; }6 .containerMenuSection { width:250px; margin:auto; padding:10px; display:inline-block; vertical-align:top; } 7 7 li.menuItem { padding:4px; width:230px; cursor:move;} 8 8 li.menuItemDisabled { cursor:defaut;} 9 div.visibility { width:100%;overflow:hidden;display:none;margin-left:30px; } 10 11 div.visibility p { margin:0px; } 12 div.visibility input { margin-right:8px; } 13 div.visibility h3 { position:relative; font-size:14px; height:auto; margin:5px 0px 0px;padding:0px;text-align:left;} -
extensions/AMenuManager/amm_aip.class.inc.php
r4382 r4389 28 28 protected $tabsheet; 29 29 protected $ajax; 30 protected $sectionsId=array('menu' , 'special');30 protected $sectionsId=array('menu' => 'title_menu', 'special' => 'special_categories'); 31 31 32 32 protected $urls_modes=array(0 => 'new_window', 1 => 'current_window'); … … 501 501 for($i=0;$i<count($items)-1;$i++) 502 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]; 503 $properties=explode("#", $items[$i]); 504 $properties[0]=explode(",", $properties[0]); 505 $this->my_config['amm_sections_items'][$properties[0][0]]['container']=$properties[0][1]; 506 $this->my_config['amm_sections_items'][$properties[0][0]]['order']=$properties[0][2]; 507 $this->my_config['amm_sections_items'][$properties[0][0]]['visibility']=$properties[1]; 507 508 } 508 509 $this->sortSectionsItems(); 509 510 if($this->save_config()) 510 511 { 511 array_push($page['infos'], l10n(' AMM_config_saved'));512 array_push($page['infos'], l10n('g002_config_saved')); 512 513 } 513 514 else 514 515 { 515 array_push($page['errors'], l10n('AMM_adviser_not_authorized')); 516 } 517 } 518 516 array_push($page['errors'], l10n('g002_adviser_not_allowed')); 517 } 518 } 519 520 foreach($this->my_config['amm_sections_items'] as $key=>$val) 521 { 522 $this->my_config['amm_sections_items'][$key]['visibilityForm'] = $this->makeVisibility($val['visibility'], $key); 523 $this->defaultMenus[$key]['visibilityForm'] = $this->makeVisibility("guest,generic,normal,admin/", $key); 524 } 525 526 $users=new users(""); 527 $groups=new groups(""); 528 529 530 $template->assign("visibility", Array('users' => $users->access_list, 'groups' => $groups->access_list)); 519 531 $template->assign("sections", $this->sectionsId); 520 532 $template->assign("defaultValues", $this->defaultMenus); … … 732 744 733 745 746 /* this function returns an HTML FORM to use with each menu items 747 * $visibility is a formatted string looking this : 748 * users type1(,users typeX)/(groupId0)(,groupIdX)) 749 */ 750 private function makeVisibility($visibility, $id) 751 { 752 $local_tpl = new Template(AMM_PATH."admin/", ""); 753 $local_tpl->set_filename('body_page', 754 dirname($this->filelocation).'/admin/amm_sections_visibility.tpl'); 755 756 757 $parameters=explode("/", $visibility); 758 759 $users=new users(str_replace(",", "/", $parameters[0])); 760 $users->set_allowed('admin', true); 761 $groups=new groups(str_replace(",", "/", $parameters[1])); 762 763 $local_tpl->assign('name', $id); 764 $local_tpl->assign('users', $users->access_list); 765 $local_tpl->assign('groups', $groups->access_list); 766 767 return($local_tpl->parse('body_page', true)); 768 } 769 734 770 735 771 … … 747 783 return(false); 748 784 } 785 786 749 787 750 788 /* --------------------------------------------------------------------------- … … 823 861 } 824 862 863 864 825 865 /* --------------------------------------------------------------------------- 826 866 functions to manage sections tables … … 883 923 return(0); 884 924 } 925 926 927 885 928 886 929 … … 997 1040 998 1041 999 1000 /*1001 *1002 // return a html formatted list of special menu sections items1003 private function ajax_amm_setmenu_mod_section_list($menuname)1004 {1005 1006 1007 1008 $local_tpl = new Template(AMM_PATH."admin/", "");1009 $local_tpl->set_filename('body_page',1010 dirname($this->filelocation).'/admin/amm_sectionsmod_detail.tpl');1011 1012 $template_datas = array('LIST' => array());1013 foreach($this->my_config[$menuname] as $key => $val)1014 {1015 $template_datas['LIST'][] = array(1016 'ID' => base64_encode($key),1017 'LABEL' => $labels[$menuname][$key],1018 'VISIBLE' => 'g002_yesno_'.$val1019 );1020 }1021 1022 $local_tpl->assign('datas', $template_datas);1023 $local_tpl->assign('plugin', array('PATH' => AMM_PATH));1024 1025 return($local_tpl->parse('body_page', true));1026 }1027 1028 1029 // move item to the specified position1030 private function ajax_amm_setmenu_mod_section_showhide($menuname, $urlid)1031 {1032 $switchvisible=array('y'=>'n', 'n'=>'y');1033 1034 $this->my_config[$menuname][base64_decode($urlid)]=$switchvisible[$this->my_config[$menuname][base64_decode($urlid)]];1035 $this->save_config();1036 1037 return($this->ajax_amm_setmenu_mod_section_list($menuname));1038 }1039 * */1040 1041 1042 1042 } // AMM_AIP class 1043 1043 -
extensions/AMenuManager/amm_pip.class.inc.php
r4382 r4389 141 141 142 142 143 /* 144 hide items from special & menu sections 143 /* manage items from special & menu sections 144 * reordering items 145 * grouping items 146 * managing rights to access 145 147 */ 146 148 $blocks=Array(); … … 154 156 $blocks['special']->data=Array(); 155 157 158 $users=new users(""); 159 $groups=new groups(""); 160 $user_groups=$this->get_user_groups($user['id']); 161 156 162 foreach($this->my_config['amm_sections_items'] as $key => $val) 157 163 { 158 164 if(isset($menuItems[$key])) 159 165 { 160 $blocks[$val['container']]->data[$key]=$menuItems[$key]; 166 $access=explode("/",$val['visibility']); 167 $users->set_alloweds(str_replace(",", "/", $access[0])); 168 $groups->set_alloweds(str_replace(",", "/", $access[1])); 169 170 /* test if user status is allowed to access the menu item 171 * if access is managed by group, the user have to be associated with an allowed group to access the menu item 172 */ 173 if($users->is_allowed($user['status']) && ( 174 ($access[1]=='') || 175 (($access[1]!='') && $groups->are_allowed($user_groups))) 176 ) 177 { 178 $blocks[$val['container']]->data[$key]=$menuItems[$key]; 179 } 161 180 } 162 181 } 163 182 if(count($blocks['menu']->data)==0) $menu->hide_block('mbMenu'); 164 183 if(count($blocks['special']->data)==0) $menu->hide_block('mbSpecials'); 184 } 185 186 187 protected function get_user_groups($user_id) 188 { 189 $returned=array(); 190 $sql="SELECT group_id FROM ".USER_GROUP_TABLE." 191 WHERE user_id = ".$user_id." "; 192 $result=pwg_query($sql); 193 if($result) 194 { 195 while($row=mysql_fetch_assoc($result)) 196 { 197 array_push($returned, $row['group_id']); 198 } 199 } 200 return($returned); 165 201 } 166 202 -
extensions/AMenuManager/amm_root.class.inc.php
r4382 r4389 18 18 19 19 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php'); 20 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/users_groups.class.inc.php'); 20 21 include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/css.class.inc.php'); 21 22 … … 25 26 protected $css; //the css object 26 27 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')28 'favorites' => array('container' => 'special', 'visibility' => 'guest,generic,normal,admin/', 'order' => 0, 'translation' => 'favorite_cat'), 29 'most_visited' => array('container' => 'special', 'visibility' => 'guest,generic,normal,admin/', 'order' => 1, 'translation' => 'most_visited_cat'), 30 'best_rated' => array('container' => 'special', 'visibility' => 'guest,generic,normal,admin/', 'order' => 2, 'translation' => 'best_rated_cat'), 31 'random' => array('container' => 'special', 'visibility' => 'guest,generic,normal,admin/', 'order' => 3, 'translation' => 'random_cat'), 32 'recent_pics' => array('container' => 'special', 'visibility' => 'guest,generic,normal,admin/', 'order' => 4, 'translation' => 'recent_pics_cat'), 33 'recent_cats' => array('container' => 'special', 'visibility' => 'guest,generic,normal,admin/', 'order' => 5, 'translation' => 'recent_cats_cat'), 34 'calendar' => array('container' => 'special', 'visibility' => 'guest,generic,normal,admin/', 'order' => 6, 'translation' => 'calendar'), 35 'qsearch' => array('container' => 'menu', 'visibility' => 'guest,generic,normal,admin/', 'order' => 0, 'translation' => 'qsearch'), 36 'tags' => array('container' => 'menu', 'visibility' => 'guest,generic,normal,admin/', 'order' => 1, 'translation' => 'Tags'), 37 'search' => array('container' => 'menu', 'visibility' => 'guest,generic,normal,admin/', 'order' => 2, 'translation' => 'Search'), 38 'comments' => array('container' => 'menu', 'visibility' => 'guest,generic,normal,admin/', 'order' => 3, 'translation' => 'comments'), 39 'about' => array('container' => 'menu', 'visibility' => 'guest,generic,normal,admin/', 'order' => 4, 'translation' => 'About'), 40 'rss' => array('container' => 'menu', 'visibility' => 'guest,generic,normal,admin/', 'order' => 5, 'translation' => 'Notification') 40 41 ); 41 42 -
extensions/AMenuManager/language/en_UK/plugin.lang.php
r4383 r4389 98 98 $lang['g002_config_saved'] = "The configuration is saved"; 99 99 $lang['g002_adviser_not_allowed'] = "Adviser is not allowed to make changes"; 100 $lang['g002_click_to_manage_rights'] = "Rights management"; 100 101 101 102 ?> -
extensions/AMenuManager/language/fr_FR/plugin.lang.php
r4383 r4389 98 98 $lang['g002_config_saved'] = "Configuration sauvegardée"; 99 99 $lang['g002_adviser_not_allowed'] = "Le conseiller n'est pas autorisé à effectuer des modifications"; 100 $lang['g002_click_to_manage_rights'] = "Gérer les droits d'accès"; 100 101 101 102 -
extensions/AMenuManager/main.inc.php
r4382 r4389 28 28 | | | * bug resolved : random image block is displayed only 29 29 | | | if user have accessibility to more than 0 images 30 | | | random images are choosen in the accessible images for31 | | | a user (permission + level)30 | | | random images are choosen in the accessible images 31 | | | for a user (permission + level) 32 32 | | | (cf. post:107877 on french forum) 33 33 | | | (cf. topic:14374 on french forum) 34 | 2.1.1 | 2009/07/27 | * random picture is preloaded before the first ajax call35 | | | assuming the display of a thumbnail even if javascript36 | | | is disabled on the browser34 | 2.1.1 | 2009/07/27 | * random picture is preloaded before the first ajax 35 | | | call assuming the display of a thumbnail even if 36 | | | javascript is disabled on the browser 37 37 | | | (cf. post:116807 on french forum) 38 38 | | | * give the possibility to choose between an automatic … … 44 44 | | | - es_ES 45 45 | | | - hu_HU (thx to sámli) 46 | 2.1.3 | 2009/11/24 | * mantis: 128546 | 2.1.3 | 2009/11/24 | * mantis: feature 1285 47 47 | | | move the js for "random image" in the the footer 48 48 | | | (having the js inside the <dl> tag was not w3c 49 49 | | | compliant) 50 | | | * mantis:1132 51 | | | Allowing order management for items in Piwigo's core blocks 52 | | | * mantis:1133 50 | | | * mantis: feature 1132 51 | | | Allowing order management for items in Piwigo's core 52 | | | blocks 53 | | | * mantis: feature 1133 53 54 | | | Allowing to group content from Piwigo's core blocks 54 | | | 55 | | | * mantis: feature 1278 56 | | | Allowing to manage access to menu items with a right 57 | | | management system 55 58 | | | 56 59 | | | … … 84 87 define('AMM_PATH' , PHPWG_PLUGINS_PATH . AMM_DIR . '/'); 85 88 86 define('AMM_VERSION' , '2.1.3'); // 89 define('AMM_VERSION' , '2.1.3'); //=> ne pas oublier la version dans l'entête !! 87 90 88 91 global $prefixeTable, $page;
Note: See TracChangeset
for help on using the changeset viewer.