From 9db0baf400b685382b2771ea846a4df553cbe9e0 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 11 Mar 2011 14:00:32 +0100 Subject: [PATCH] Add feature to disable modules without having to remove them --- root/adm/style/portal/acp_portal_calendar.html | 7 +++++++ root/adm/style/portal/acp_portal_config.html | 7 +++++++ root/adm/style/portal/acp_portal_custom.html | 7 +++++++ root/adm/style/portal/acp_portal_links.html | 7 +++++++ root/adm/style/portal/acp_portal_menu.html | 7 +++++++ root/adm/style/portal/acp_portal_modules.html | 12 ++++++------ root/adm/style/portal/acp_portal_welcome.html | 7 +++++++ root/includes/acp/acp_portal.php | 5 +++++ root/install/index.php | 10 ++++++++-- root/language/de/mods/info_acp_portal.php | 1 + root/language/en/mods/info_acp_portal.php | 1 + root/portal.php | 5 +++++ root/portal/includes/constants.php | 3 +++ 13 files changed, 71 insertions(+), 8 deletions(-) diff --git a/root/adm/style/portal/acp_portal_calendar.html b/root/adm/style/portal/acp_portal_calendar.html index f6abb463..e77302f8 100644 --- a/root/adm/style/portal/acp_portal_calendar.html +++ b/root/adm/style/portal/acp_portal_calendar.html @@ -121,6 +121,13 @@

{L_MODULE_RESET_EXP}
+
+
+
+ + +
+

{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/adm/style/portal/acp_portal_config.html b/root/adm/style/portal/acp_portal_config.html index 7ecc39fe..ba281440 100644 --- a/root/adm/style/portal/acp_portal_config.html +++ b/root/adm/style/portal/acp_portal_config.html @@ -67,6 +67,13 @@

{L_MODULE_RESET_EXP}
+
+
+
+ + +
+

{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/adm/style/portal/acp_portal_custom.html b/root/adm/style/portal/acp_portal_custom.html index 76cacfdf..0c1c0f87 100644 --- a/root/adm/style/portal/acp_portal_custom.html +++ b/root/adm/style/portal/acp_portal_custom.html @@ -39,6 +39,13 @@

{L_MODULE_RESET_EXP}
+
+
+
+ + +
+

{L_ACP_PORTAL_CUSTOM_PERMISSION_EXP}
diff --git a/root/adm/style/portal/acp_portal_links.html b/root/adm/style/portal/acp_portal_links.html index 3e450710..d4ac0432 100644 --- a/root/adm/style/portal/acp_portal_links.html +++ b/root/adm/style/portal/acp_portal_links.html @@ -90,6 +90,13 @@

{L_MODULE_RESET_EXP}
+
+
+
+ + +
+

{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/adm/style/portal/acp_portal_menu.html b/root/adm/style/portal/acp_portal_menu.html index fb42d17f..cb2d230a 100644 --- a/root/adm/style/portal/acp_portal_menu.html +++ b/root/adm/style/portal/acp_portal_menu.html @@ -97,6 +97,13 @@

{L_MODULE_RESET_EXP}
+
+
+
+ + +
+

{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/adm/style/portal/acp_portal_modules.html b/root/adm/style/portal/acp_portal_modules.html index dc9c64a0..5d5d9627 100644 --- a/root/adm/style/portal/acp_portal_modules.html +++ b/root/adm/style/portal/acp_portal_modules.html @@ -36,7 +36,7 @@ {L_MODULE_POS_TOP} - + {modules_top.MODULE_IMAGE} {modules_top.MODULE_NAME}

@@ -63,13 +63,13 @@ {L_MODULE_POS_LEFT} - + {modules_left.MODULE_IMAGE} {modules_left.MODULE_NAME}

{ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  {ICON_MOVE_RIGHT}{ICON_MOVE_RIGHT_DISABLED}  - {ICON_EDIT} {ICON_DELETE}
+ {ICON_EDIT} {ICON_DELETE}
{ICON_MOVE_LEFT_DISABLED}  {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN} @@ -90,7 +90,7 @@ {L_MODULE_POS_CENTER} - + {modules_center.MODULE_IMAGE} {modules_center.MODULE_NAME}

@@ -117,7 +117,7 @@ {L_MODULE_POS_RIGHT} - + {modules_right.MODULE_IMAGE} {modules_right.MODULE_NAME}

@@ -147,7 +147,7 @@ {L_MODULE_POS_BOTTOM} - + {modules_bottom.MODULE_IMAGE} {modules_bottom.MODULE_NAME}

diff --git a/root/adm/style/portal/acp_portal_welcome.html b/root/adm/style/portal/acp_portal_welcome.html index 2346669f..f5d2a21f 100644 --- a/root/adm/style/portal/acp_portal_welcome.html +++ b/root/adm/style/portal/acp_portal_welcome.html @@ -39,6 +39,13 @@

{L_MODULE_RESET_EXP}
+
+
+
+ + +
+

{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php index 71a895a1..79120f5c 100644 --- a/root/includes/acp/acp_portal.php +++ b/root/includes/acp/acp_portal.php @@ -109,6 +109,7 @@ class acp_portal 'MODULE_IMAGE_WIDTH' => $module_data['module_image_width'], 'MODULE_IMAGE_HEIGHT' => $module_data['module_image_height'], 'MODULE_IMAGE_SRC' => ($module_data['module_image_src']) ? $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $module_data['module_image_src'] : '', + 'MODULE_ENABLED' => ($module_data['module_status']) ? true : false, )); if($module_data['module_classname'] != 'custom') @@ -170,6 +171,7 @@ class acp_portal 'module_group_ids' => '', 'module_image_height' => 16, 'module_image_width' => 16, + 'module_status' => B3_MODULE_ENABLED, ); $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' @@ -263,6 +265,7 @@ class acp_portal 'module_image_width' => request_var('module_img_width', 0), 'module_image_height' => request_var('module_img_height', 0), 'module_group_ids' => $module_permission, + 'module_status' => request_var('module_status', B3_MODULE_ENABLED), ); // check if module image file actually exists @@ -729,6 +732,7 @@ class acp_portal 'module_group_ids' => '', 'module_image_height' => 16, 'module_image_width' => 16, + 'module_status' => B3_MODULE_ENABLED, ); $sql = 'INSERT INTO ' . PORTAL_MODULES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $db->sql_query($sql); @@ -852,6 +856,7 @@ class acp_portal $template->assign_block_vars('modules_' . $template_column, array( 'MODULE_NAME' => (isset($user->lang[$row['module_name']])) ? $user->lang[$row['module_name']] : $row['module_name'], 'MODULE_IMAGE' => ($row['module_image_src']) ? '' . $row['module_name'] . '' : '', + 'MODULE_ENABLED' => ($row['module_status']) ? true : false, 'U_DELETE' => $this->u_action . '&module_id=' . $row['module_id'] . '&module_classname=' . $row['module_classname'] . '&action=delete', 'U_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=portal&mode=config&module_id=' . $row['module_id']), diff --git a/root/install/index.php b/root/install/index.php index 89d086d5..4158399e 100644 --- a/root/install/index.php +++ b/root/install/index.php @@ -94,7 +94,7 @@ $versions = array( ), 'table_add' => array( - array('phpbb_portal_config', array( + array(PORTAL_CONFIG_TABLE, array( 'COLUMNS' => array( 'config_name' => array('VCHAR:255', ''), 'config_value'=> array('MTEXT', ''), @@ -267,7 +267,7 @@ $versions = array( ), 'table_add' => array( - array('phpbb_portal_modules', array( + array(PORTAL_MODULES_TABLE, array( 'COLUMNS' => array( 'module_id' => array('UINT:3', NULL, 'auto_increment'), 'module_classname' => array('VCHAR:64', ''), @@ -347,6 +347,12 @@ $versions = array( 'custom' => array('board3_basic_install'), ), + + '2.0.0a2' => array( + 'table_column_add' => array( + array(PORTAL_MODULES_TABLE, 'module_status', array('TINT:1', 1)), + ), + ), ); // Include the UMIL Auto file, it handles the rest diff --git a/root/language/de/mods/info_acp_portal.php b/root/language/de/mods/info_acp_portal.php index 75c46278..67a314ea 100644 --- a/root/language/de/mods/info_acp_portal.php +++ b/root/language/de/mods/info_acp_portal.php @@ -70,6 +70,7 @@ $lang = array_merge($lang, array( 'MODULE_IMAGE_HEIGHT_EXP' => 'Gebe die Höhe des Modul Bildes in Pixeln ein', 'MODULE_RESET' => 'Modul Einstellungen zurücksetzen', 'MODULE_RESET_EXP' => 'Dies wird alle Einstellungen des Moduls auf die Standardeinstellungen zurücksetzen!', + 'MODULE_STATUS' => 'Aktiviere Modul', // general 'ACP_PORTAL' => 'Portal', diff --git a/root/language/en/mods/info_acp_portal.php b/root/language/en/mods/info_acp_portal.php index 62dd38e5..8b22e263 100755 --- a/root/language/en/mods/info_acp_portal.php +++ b/root/language/en/mods/info_acp_portal.php @@ -69,6 +69,7 @@ $lang = array_merge($lang, array( 'MODULE_IMAGE_HEIGHT_EXP' => 'Enter the height of the module image in pixels', 'MODULE_RESET' => 'Reset module configuration', 'MODULE_RESET_EXP' => 'This will reset all settings to the default!', + 'MODULE_STATUS' => 'Enable module', // general 'ACP_PORTAL' => 'Portal', diff --git a/root/portal.php b/root/portal.php index 4f581cd2..0c68e942 100755 --- a/root/portal.php +++ b/root/portal.php @@ -61,6 +61,11 @@ $module_count = array( */ foreach ($portal_modules as $row) { + if($row['module_status'] == B3_MODULE_DISABLED) + { + continue; + } + $class_name = 'portal_' . $row['module_classname'] . '_module'; if (!class_exists($class_name)) { diff --git a/root/portal/includes/constants.php b/root/portal/includes/constants.php index d9cbfd74..9f94c592 100644 --- a/root/portal/includes/constants.php +++ b/root/portal/includes/constants.php @@ -19,6 +19,9 @@ define('B3_LINKS_CAT', 0); define('B3_LINKS_INT', 1); define('B3_LINKS_EXT', 2); +define('B3_MODULE_DISABLED', 0); +define('B3_MODULE_ENABLED', 1); + // Tables and paths define('PORTAL_ROOT_PATH', 'portal/'); define('PORTAL_MODULES_TABLE', $table_prefix . 'portal_modules');