From df162ac76c44921d57ec46ff40335195f53a3748 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 12 Sep 2010 16:11:24 +0000 Subject: [PATCH] Partially added main menu block; There is still a lot of work to do, look for @todo --- root/includes/acp/acp_portal.php | 2 + .../mods/portal/portal_main_menu_module.php | 56 ++++++ root/portal/modules/portal_main_menu.php | 173 ++++++++++++++++++ .../portal/modules/main_menu_side.html | 29 +++ .../theme/images/portal/portal_menu.png | Bin 0 -> 855 bytes 5 files changed, 260 insertions(+) create mode 100644 root/language/en/mods/portal/portal_main_menu_module.php create mode 100644 root/portal/modules/portal_main_menu.php create mode 100644 root/styles/prosilver/template/portal/modules/main_menu_side.html create mode 100644 root/styles/prosilver/theme/images/portal/portal_menu.png diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php index 73979106..9336674e 100644 --- a/root/includes/acp/acp_portal.php +++ b/root/includes/acp/acp_portal.php @@ -39,6 +39,8 @@ class acp_portal $form_key = 'acp_portal'; add_form_key($form_key); + + // @todo: add a way to show custom HTML files, instead of the standard board3 portal one, on the settings page of the modules /** * Validation types are: diff --git a/root/language/en/mods/portal/portal_main_menu_module.php b/root/language/en/mods/portal/portal_main_menu_module.php new file mode 100644 index 00000000..bc293cd1 --- /dev/null +++ b/root/language/en/mods/portal/portal_main_menu_module.php @@ -0,0 +1,56 @@ + 'Menu', + 'M_CONTENT' => 'Content', + 'M_ACP' => 'ACP', + 'M_HELP' => 'Help', + 'M_BBCODE' => 'BBCode FAQ', + 'M_TERMS' => 'Terms of use', + 'M_PRV' => 'Privacy policy', + 'M_SEARCH' => 'Search', + + // ACP + 'ACP_PORTAL_MENU' => 'Menu settings', + 'ACP_PORTAL_MENU_EXP' => 'Manage your main menu', + 'ACP_PORTAL_MENU_MANAGE' => 'Manage menu', + 'ACP_PORTAL_MENU_MANAGE_EXP' => 'You can manage the links of your main menu here.
Change the type of link by changing the selected option in the drop-down list next to the link.', + 'ACP_PORTAL_MENU_CAT' => 'Category', + 'ACP_PORTAL_MENU_INT' => 'Internal link', + 'ACP_PORTAL_MENU_EXT' => 'External link', + 'ACP_PORTAL_MENU_TITLE' => 'Title', + 'ACP_PORTAL_MENU_URL' => 'URL', + 'ACP_PORTAL_MENU_TYPE' => 'Type', +)); + +?> \ No newline at end of file diff --git a/root/portal/modules/portal_main_menu.php b/root/portal/modules/portal_main_menu.php new file mode 100644 index 00000000..6b9be633 --- /dev/null +++ b/root/portal/modules/portal_main_menu.php @@ -0,0 +1,173 @@ +lang}/mods/portal/" + */ + var $language = 'portal_main_menu_module'; + + function get_template_side($module_id) + { + global $config, $template, $phpEx, $phpbb_root_path; + + $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'; + } + + function get_template_acp($module_id) + { + return array( + 'title' => 'ACP_PORTAL_MENU', + 'vars' => array( + 'legend1' => 'ACP_PORTAL_MENU', + 'board3_links_urls' => array('lang' => 'ACP_PORTAL_MENU_MANAGE', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'manage_links', 'submit' => 'update_links'), + ), + ); + } + + /** + * API functions + */ + function install($module_id) + { + set_config('board3_links_manage', ''); + set_config('board3_links_options', ''); + return true; + } + + function uninstall($module_id) + { + global $db; + + $del_config = array( + 'board3_links_manage', + 'board3_links_options', + ); + $sql = 'DELETE FROM ' . CONFIG_TABLE . ' + WHERE ' . $db->sql_in_set('config_name', $del_config); + return $db->sql_query($sql); + } + + /* + * 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($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) + { + global $db, $cache; + + $values = + + print_r($values); + } +} + +?> \ No newline at end of file diff --git a/root/styles/prosilver/template/portal/modules/main_menu_side.html b/root/styles/prosilver/template/portal/modules/main_menu_side.html new file mode 100644 index 00000000..1b38e7df --- /dev/null +++ b/root/styles/prosilver/template/portal/modules/main_menu_side.html @@ -0,0 +1,29 @@ + +{$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 diff --git a/root/styles/prosilver/theme/images/portal/portal_menu.png b/root/styles/prosilver/theme/images/portal/portal_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..a4da1c1561f03d65ef948a4c28b9fd1bfa8cc016 GIT binary patch literal 855 zcmV-d1E~CoP)Qe@#_!*M{%>iin+*^^EGjDUXQZSgg#P~h`wya#5oj(G10y37*nofk{{DUb{0+B` zp)QNKgeb$$pFbJc**O^Azx&9*!op$>5I`&zmPT^+cIJ#5u@nn{X*gPDy1Ab?mDSdTF} z{Xfp|^DjsrP&-H`$bO(RSpG9I{0HLC|D71#a>_9X^8I1>^P7QzjSVQqEXeSW;Ufb; z0I~dF{Qmy~+ZzU;{XlI%1DK$}3uLe`{s$WLkKr%NPlg|26Byo$voZYq^@o9zlbzwq zhp!C(m=YKO0*K`|UkJlz)mnxhKYl@+&j{5IbO{qP&@`Y+{=U7#!0_iY!;hbQ48MQ> z0ekh&?|;BRW?=&eAQl!@R>q${{xkge{tx1Os24zi$i(!Yft7`g;l+!m|2J)1|BaKA z6BN9RKuy2^{KNG4@%@_s0mSm<%a8wGzy1Q6{2S~ACMLKaz){M|!p!jc)yv;ox2}i; z3SI(YPNa173Lt=3L_~xbrKN=#zJLD#b^$D5LL9@$z{SPQz{A4@5_$o|4;i3g1#%(K ze+&Qt#Pa&}yZ?9ZK8Cu03F-rgH$bl8;^JZW`t>J>#|hE^(Z~pQ0zd$<$jM1F85!v^ zeEaqT;e8}8aC7r8?AcokqMFU{xLwj!oUC!K#Y=-@@+uc0*HS@5)r}x5Sy8qiS^5uPfy>ydszV#c#57I h0Ro7T((DWnU;v-V`~~Z;X