XOOPS Cube Legacy base repository
Revision | 415bd2cf056ab85464df7c76b4022592a6d46af1 (tree) |
---|---|
Zeit | 2011-11-10 23:46:31 |
Autor | nbuy <nbuy@704c...> |
Commiter | nbuy |
enhance mainmenu block. cache enabled. show all submenus.
git-svn-id: https://xoopscube.svn.sourceforge.net/svnroot/xoopscube/Package_Legacy/trunk@1043 704cf05f-ae62-4b0e-a484-234ee0250e75
@@ -34,4 +34,7 @@ define('_MB_LEGACY_LANG_THWIDTH', "V | ||
34 | 34 | define('_MB_LEGACY_LANG_RECOMMENDSITE', "Doporu鑼e tento web p?tel?"); |
35 | 35 | |
36 | 36 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "Promi?e, nyn nelze 啾blonu m?it."); |
37 | + | |
38 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "Show all submenus"); | |
39 | + | |
37 | 40 | ?> |
@@ -34,4 +34,6 @@ define('_MB_LEGACY_LANG_RECOMMENDSITE', "Recommender ce Site a un(e) Ami(e)"); | ||
34 | 34 | |
35 | 35 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "Désolé, Il est actuellement impossible de changer les themes."); |
36 | 36 | |
37 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "Voir toutes les sous-menus"); | |
38 | + | |
37 | 39 | ?> |
\ No newline at end of file |
@@ -35,4 +35,6 @@ define("_MB_LEGACY_LANG_RECOMMENDSITE", "Recommender ce Site a un(e) Ami(e)"); | ||
35 | 35 | |
36 | 36 | define("_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE", "D駸ol? Il est actuellement impossible de changer les themes."); |
37 | 37 | |
38 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "Voir toutes les sous-menus"); | |
39 | + | |
38 | 40 | ?> |
@@ -36,6 +36,8 @@ define('_MB_LEGACY_LANG_THWIDTH', "Screenshot image width"); | ||
36 | 36 | |
37 | 37 | define('_MB_LEGACY_LANG_RECOMMENDSITE', "Recommend this Site to a Friend"); |
38 | 38 | |
39 | -define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "Sorry, you can't change themes now."); | |
39 | +define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "Λυπούμαστε, αλλά δεν μπορείτε να αλλάξετε τα θέματα τώρα."); | |
40 | + | |
41 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "Εμφάνιση όλων των υπομενού"); | |
40 | 42 | |
41 | 43 | ?> |
@@ -35,4 +35,6 @@ define('_MB_LEGACY_LANG_RECOMMENDSITE', "当サイトを友達に薦める"); | ||
35 | 35 | |
36 | 36 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "ただいまテーマチェンジャーはご利用になれません"); |
37 | 37 | |
38 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "全てのサブメニューを表示する"); | |
39 | + | |
38 | 40 | ?> |
@@ -35,4 +35,6 @@ define('_MB_LEGACY_LANG_RECOMMENDSITE', " | ||
35 | 35 | |
36 | 36 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "ただいまテーマチェンジャーはご利用になれません"); |
37 | 37 | |
38 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "全てのサブメニューを表示する"); | |
39 | + | |
38 | 40 | ?> |
@@ -65,4 +65,6 @@ define('_MB_LEGACY_LANG_RECOMMENDSITE', "친구에게 이 사이트를 추천"); | ||
65 | 65 | |
66 | 66 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "지금은 테마를 변경하실 수 없습니다."); |
67 | 67 | |
68 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "모든 하위 메뉴를 표시"); | |
69 | + | |
68 | 70 | ?> |
\ No newline at end of file |
@@ -65,4 +65,6 @@ define('_MB_LEGACY_LANG_RECOMMENDSITE', "庁 | ||
65 | 65 | |
66 | 66 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "走榎精 砺原研 痕井馬叔 呪 蒸柔艦陥."); |
67 | 67 | |
68 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "乞窮 馬是 五敢研 妊獣"); | |
69 | + | |
68 | 70 | ?> |
\ No newline at end of file |
@@ -43,4 +43,7 @@ define("_MB_LEGACY_SUBMS","Conte | ||
43 | 43 | define("_MB_LEGACY_VACNT","Informa鋏es"); |
44 | 44 | define("_MB_LEGACY_WDLS","Arquivos pendentes"); |
45 | 45 | define("_MB_LEGACY_WLNKS","Endere輟s pendentes"); |
46 | + | |
47 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "Mostrar todos os submenus"); | |
48 | + | |
46 | 49 | ?> |
\ No newline at end of file |
@@ -43,4 +43,7 @@ define("_MB_LEGACY_SUBMS","Conteúdo pendente"); | ||
43 | 43 | define("_MB_LEGACY_VACNT","Informações"); |
44 | 44 | define("_MB_LEGACY_WDLS","Arquivos pendentes"); |
45 | 45 | define("_MB_LEGACY_WLNKS","Endereços pendentes"); |
46 | + | |
47 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "Mostrar todos os submenus"); | |
48 | + | |
46 | 49 | ?> |
\ No newline at end of file |
@@ -57,4 +57,6 @@ define('_MD_LEGACY_MESSAGE_LOGGEDOUT', " | ||
57 | 57 | |
58 | 58 | define('_MD_LEGACY_MESSAGE_THANKYOUFORVISIT', "廷瘰 闔聳謗矗鴾 轢 轢 騾蜥!"); |
59 | 59 | |
60 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "Show all submenus"); | |
61 | + | |
60 | 62 | ?> |
@@ -36,4 +36,6 @@ define('_MB_LEGACY_LANG_RECOMMENDSITE', " | ||
36 | 36 | |
37 | 37 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "宇埜?艇?壓涙隈延厚麼籾。"); |
38 | 38 | |
39 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "顯示所有子菜單"); | |
40 | + | |
39 | 41 | ?> |
@@ -36,4 +36,6 @@ define('_MB_LEGACY_LANG_RECOMMENDSITE', "推薦本站"); | ||
36 | 36 | |
37 | 37 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "抱歉,您現在無法變更佈景。"); |
38 | 38 | |
39 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "顯示所有子菜單"); | |
40 | + | |
39 | 41 | ?> |
@@ -35,4 +35,6 @@ define('_MB_LEGACY_LANG_RECOMMENDSITE', '推薦這個網站給一個朋友'); | ||
35 | 35 | |
36 | 36 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', '抱歉,您現在不能修改佈景。'); |
37 | 37 | |
38 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "顯示所有子菜單"); | |
39 | + | |
38 | 40 | ?> |
@@ -19,7 +19,7 @@ | ||
19 | 19 | // This file has been modified for Legacy from XOOPS2 System module block // |
20 | 20 | // ------------------------------------------------------------------------- // |
21 | 21 | |
22 | -function b_legacy_mainmenu_show() { | |
22 | +function b_legacy_mainmenu_show( $options ) { | |
23 | 23 | $root =& XCube_Root::getSingleton(); |
24 | 24 | $xoopsModule =& $root->mContext->mXoopsModule; |
25 | 25 | $xoopsUser =& $root->mController->mRoot->mContext->mXoopsUser; |
@@ -35,20 +35,38 @@ function b_legacy_mainmenu_show() { | ||
35 | 35 | $moduleperm_handler =& xoops_gethandler('groupperm'); |
36 | 36 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
37 | 37 | $read_allowed = $moduleperm_handler->getItemIds('module_read', $groups); |
38 | + $all_links = (int)$options[0]; | |
39 | + $mid = is_object($xoopsModule)?$xoopsModule->getVar('mid', 'N'):''; | |
38 | 40 | foreach (array_keys($modules) as $i) { |
39 | 41 | if (in_array($i, $read_allowed)) { |
40 | - $block['modules'][$i]['name'] = $modules[$i]->getVar('name'); | |
41 | - $block['modules'][$i]['directory'] = $modules[$i]->getVar('dirname'); | |
42 | - $sublinks =& $modules[$i]->subLink(); | |
43 | - if ((count($sublinks) > 0) && (!empty($xoopsModule)) && ($i == $xoopsModule->getVar('mid'))) { | |
42 | + $module = &$modules[$i]; | |
43 | + $blockm = &$block['modules'][$i]; | |
44 | + $blockm['name'] = $module->getVar('name'); | |
45 | + $moddir = XOOPS_URL.'/modules/'; | |
46 | + $moddir .= $blockm['directory'] = $module->getVar('dirname', 'N'); | |
47 | + $info = $module->getInfo(); | |
48 | + $sublinks =& $module->subLink(); | |
49 | + if (count($sublinks)>0 && ($all_links || $i==$mid)) { | |
44 | 50 | foreach($sublinks as $sublink){ |
45 | - $block['modules'][$i]['sublinks'][] = array('name' => $sublink['name'], 'url' => XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url']); | |
51 | + $blockm['sublinks'][] = array('name' => $sublink['name'], 'url' => $moddir.'/'.$sublink['url']); | |
46 | 52 | } |
47 | 53 | } else { |
48 | - $block['modules'][$i]['sublinks'] = array(); | |
54 | + $blockm['sublinks'] = array(); | |
49 | 55 | } |
50 | 56 | } |
51 | 57 | } |
52 | 58 | return $block; |
53 | 59 | } |
60 | + | |
61 | +function b_legacy_mainmenu_edit( $options ) { | |
62 | + $off='checked="checked"'; | |
63 | + $on=''; | |
64 | + if ($options[0]) { | |
65 | + $on = $off; | |
66 | + $off = ''; | |
67 | + } | |
68 | + return "<div>"._MB_LEGACY_MAINMENU_EXPAND_SUB. | |
69 | + "<input type=\"radio\" name=\"options[0]\" value=\"0\" $off>"._NO. | |
70 | + " <input type=\"radio\" name=\"options[0]\" value=\"1\" $on>"._YES."</div>"; | |
71 | +} | |
54 | 72 | ?> |
@@ -216,8 +216,8 @@ class Legacy_BlockCacheInformation extends Legacy_AbstractCacheInformation | ||
216 | 216 | $this->mGetCacheFilePath->call(new XCube_Ref($filepath), $this); |
217 | 217 | |
218 | 218 | if (!$filepath) { |
219 | - $id = md5(XOOPS_SALT . $this->mBlock->get('bid') . "(" . implode("_", $this->mIdentityArr) . ")" . implode("_", $this->mGroupArr)); | |
220 | - $filepath = XOOPS_CACHE_PATH . "/" . $id . ".cache.html"; | |
219 | + $id = md5(XOOPS_SALT . "(" . implode("_", $this->mIdentityArr) . ")" . implode("_", $this->mGroupArr)); | |
220 | + $filepath = XOOPS_CACHE_PATH . "/bid".$this->mBlock->get('bid') . '_' . $id . ".cache.html"; | |
221 | 221 | } |
222 | 222 | |
223 | 223 | return $filepath; |
@@ -35,4 +35,6 @@ define('_MB_LEGACY_LANG_RECOMMENDSITE', "Recommend this Site to a Friend"); | ||
35 | 35 | |
36 | 36 | define('_MB_LEGACY_MESSAGE_CAN_NOT_THEME_CHANGE', "Sorry, you can't change themes now."); |
37 | 37 | |
38 | +define('_MB_LEGACY_MAINMENU_EXPAND_SUB', "Show all submenus"); | |
39 | + | |
38 | 40 | ?> |
@@ -9,7 +9,7 @@ | ||
9 | 9 | */ |
10 | 10 | |
11 | 11 | $modversion['name'] = _MI_LEGACY_NAME; |
12 | -$modversion['version'] = 2.01; | |
12 | +$modversion['version'] = 2.02; | |
13 | 13 | $modversion['description'] = _MI_LEGACY_NAME_DESC; |
14 | 14 | $modversion['author'] = ""; |
15 | 15 | $modversion['credits'] = "XOOPS Cube Project"; |
@@ -151,9 +151,11 @@ $modversion['blocks'][2]['file'] = "legacy_mainmenu.php"; | ||
151 | 151 | $modversion['blocks'][2]['name'] = _MI_LEGACY_BLOCK_MAINMENU_NAME; |
152 | 152 | $modversion['blocks'][2]['description'] = _MI_LEGACY_BLOCK_MAINMENU_DESC; |
153 | 153 | $modversion['blocks'][2]['show_func'] = "b_legacy_mainmenu_show"; |
154 | +$modversion['blocks'][2]['edit_func'] = "b_legacy_mainmenu_edit"; | |
154 | 155 | $modversion['blocks'][2]['template'] = 'legacy_block_mainmenu.html'; |
155 | 156 | $modversion['blocks'][2]['visible_any'] = true; |
156 | 157 | $modversion['blocks'][2]['show_all_module'] = true; |
158 | +$modversion['blocks'][2]['options'] = '0'; | |
157 | 159 | |
158 | 160 | $modversion['blocks'][3]['func_num'] = 3; |
159 | 161 | $modversion['blocks'][3]['file'] = "legacy_search.php"; |
@@ -17,6 +17,16 @@ class StdCache_Initialize extends XCube_ActionFilter | ||
17 | 17 | function setForBlock($cacheInfo) |
18 | 18 | { |
19 | 19 | $user =& $this->mRoot->mContext->mXoopsUser; |
20 | + $block =& $cacheInfo->mBlock; | |
21 | + switch ($block->getVar('show_func','n')) { | |
22 | + case 'b_legacy_mainmenu_show': // mainmenu context | |
23 | + list($option) = explode('|', $block->getVar('options','n')); | |
24 | + if ($option) break; // but options setting no context | |
25 | + $module = $this->mRoot->mContext->mXoopsModule; | |
26 | + $cacheInfo->mIdentityArr['dirname'] = is_object($module)?$module->getVar('dirname'):''; | |
27 | + break; | |
28 | + // something other block with context cache | |
29 | + } | |
20 | 30 | if (is_object($user)) { |
21 | 31 | $cacheInfo->mGroupArr = $user->getGroups(); |
22 | 32 | $cacheInfo->setEnableCache(!in_array(XOOPS_GROUP_ADMIN, $user->getGroups())); |