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 00000000..a4da1c15 Binary files /dev/null and b/root/styles/prosilver/theme/images/portal/portal_menu.png differ