From b3f0f852fa0d3e594a4cf28d000a4e19879bb6f3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 13 Sep 2010 23:11:16 +0000 Subject: [PATCH] Worked further on the menu block and the basic version works now --- root/adm/style/portal/acp_portal_menu.html | 5 +- root/includes/acp/acp_portal.php | 2 + root/portal/modules/portal_main_menu.php | 109 +++++++----------- .../portal/modules/main_menu_new.html | 14 +++ 4 files changed, 59 insertions(+), 71 deletions(-) create mode 100644 root/styles/prosilver/template/portal/modules/main_menu_new.html diff --git a/root/adm/style/portal/acp_portal_menu.html b/root/adm/style/portal/acp_portal_menu.html index c1c7bd71..cdc153c2 100644 --- a/root/adm/style/portal/acp_portal_menu.html +++ b/root/adm/style/portal/acp_portal_menu.html @@ -100,7 +100,10 @@ - +

+   + +

{S_FORM_TOKEN} diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php index 15f09ef0..725982b0 100644 --- a/root/includes/acp/acp_portal.php +++ b/root/includes/acp/acp_portal.php @@ -384,6 +384,8 @@ class acp_portal $db->sql_query($sql); $c_class->install($db->sql_nextid()); + + $cache->purge(); // make sure we don't get errors after re-adding a module trigger_error($user->lang['SUCCESS_ADD'] . adm_back_link($this->u_action)); } diff --git a/root/portal/modules/portal_main_menu.php b/root/portal/modules/portal_main_menu.php index 71d1ebfd..6b178696 100644 --- a/root/portal/modules/portal_main_menu.php +++ b/root/portal/modules/portal_main_menu.php @@ -50,19 +50,56 @@ class portal_main_menu_module * custom acp template * file must be in "adm/style/portal/" */ - var $custom_acp_tpl = 'acp_portal_links'; + var $custom_acp_tpl = 'acp_portal_menu'; function get_template_side($module_id) { global $config, $template, $phpEx, $phpbb_root_path; + + // @todo: merge into constants file, maybe even portal contants file + define('B3_LINKS_CAT', 0); + define('B3_LINKS_INT', 1); + define('B3_LINKS_EXT', 2); + $links_urls = $links_options = $links_titles = array(); + + $links_urls = explode(';', $config['board3_links_urls']); + $links_options = explode(';', $config['board3_links_options']); + $links_titles = explode(';', $config['board3_links_titles']); + + for ($i = 0; $i < sizeof($links_urls); $i++) + { + if($links_options[$i] == B3_LINKS_CAT) + { + $template->assign_block_vars('portalmenu', array( + 'CAT_TITLE' => $links_titles[$i], + )); + } + else + { + if($links_options[$i] == B3_LINKS_INT) + { + $cur_url = append_sid($phpbb_root_path . $links_urls[$i]); + } + else + { + $cur_url = $links_urls[$i]; + } + + $template->assign_block_vars('portalmenu.links', array( + 'LINK_TITLE' => $links_titles[$i], + 'LINK_URL' => $cur_url, + )); + } + } + $template->assign_vars(array( 'U_M_BBCODE' => append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode'), 'U_M_TERMS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), 'U_M_PRV' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), )); - return 'main_menu_side.html'; + return 'main_menu_new.html'; } function get_template_acp($module_id) @@ -331,74 +368,6 @@ class portal_main_menu_module 'S_LINK_IS_CAT' => ($links_options[$i] == B3_LINKS_CAT) ? true : false, )); } - $db->sql_freeresult($result); - } - - /* - * create a table that lets the user manage the links - * @todo: finish the main menu manage section - * links_options: - * 0 = category - * 1 = internal link - * 2 = external link - * links_urls: contains the URLs or titles (for categories) - */ - function manage_links_old($key) - { - global $config, $phpbb_admin_path, $user, $phpEx, $db; - - // @todo: merge into constants file, maybe even portal contants file - define('B3_LINKS_CAT', 0); - define('B3_LINKS_INT', 1); - define('B3_LINKS_EXT', 2); - - $sql = 'SELECT module_id FROM ' . PORTAL_MODULES_TABLE . " WHERE module_classname = 'main_menu'"; - $result = $db->sql_query($sql); - $module_id = $db->sql_fetchfield('module_id'); - $db->sql_freeresult($result); - - $u_action = append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=portal&mode=config&module_id=' . $module_id); - // opening code of the table - $table_begin = "\n\n\n\n\n\n"; - // code of the table end - $table_end = "\n"; - $table_content = ''; // make sure this is empty before we begin - - $links_urls = explode(';', $config['board3_links_urls']); - $links_options = explode(';', $config['board3_links_options']); - $links_titles = explode(';', $config['board3_links_titles']); - - $links = array(); - for ($i = 0; $i < sizeof($links_urls); $i++) - { - // Cats will have a blueish background, normal links have white - $table_row = ($links_options[$i] == B3_LINKS_CAT) ? "class='row2'": "class='row1'"; - - // Define the drop-down box for the type of the link - $drop_down_box = "'; - - // Define the links - $move_up_link = ($i == 0) ? '' . $user->lang['MOVE_UP'] . '' : '' . $user->lang['MOVE_UP'] . ''; - $move_down_link = ($i >= (sizeof($links_urls) - 1)) ? '' . $user->lang['MOVE_DOWN'] . '' : '' . $user->lang['MOVE_DOWN'] . ''; - $delete_link = '' . $user->lang['DELETE'] . ''; - - // Throw it all together - $table_content .= "$drop_down_box$move_up_link $move_down_link $delete_link"; - } - - $return_ary = ''; - - $return_ary .= $table_begin; - $return_ary .= $table_content; - $return_ary .= $table_end; - - //echo $config['board3_links_options']; // remove after testing - - return $return_ary; } function update_links($key) diff --git a/root/styles/prosilver/template/portal/modules/main_menu_new.html b/root/styles/prosilver/template/portal/modules/main_menu_new.html new file mode 100644 index 00000000..c72bcafc --- /dev/null +++ b/root/styles/prosilver/template/portal/modules/main_menu_new.html @@ -0,0 +1,14 @@ + +{$LR_BLOCK_H_L} {L_M_MENU}{$LR_BLOCK_H_R} +
+ + + +
+ +
+{$LR_BLOCK_F_L}{$LR_BLOCK_F_R} \ No newline at end of file