Add feature to disable modules without having to remove them
This commit is contained in:
@@ -121,6 +121,13 @@
|
||||
<dt><label for="module_reset">{L_MODULE_RESET}:</label><br /><span style="color: #BC2A4D;">{L_MODULE_RESET_EXP}</span></dt>
|
||||
<dd><input id="module_reset" type="checkbox" value="1" name="module_reset" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="module_status">{L_MODULE_STATUS}:</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" class="radio" name="module_status" value="1" id="module_status"<!-- IF MODULE_ENABLED --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
||||
<label><input type="radio" class="radio" name="module_status" value="0"<!-- IF not MODULE_ENABLED --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- IF permission_setting -->
|
||||
<dl>
|
||||
<dt><label for="permission-setting">{L_MODULE_PERMISSIONS}:</label><br /><span>{L_MODULE_PERMISSIONS_EXP}</span></dt>
|
||||
|
||||
@@ -67,6 +67,13 @@
|
||||
<dt><label for="module_reset">{L_MODULE_RESET}:</label><br /><span style="color: #BC2A4D;">{L_MODULE_RESET_EXP}</span></dt>
|
||||
<dd><input id="module_reset" type="checkbox" value="1" name="module_reset" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="module_status">{L_MODULE_STATUS}:</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" class="radio" name="module_status" value="1" id="module_status"<!-- IF MODULE_ENABLED --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
||||
<label><input type="radio" class="radio" name="module_status" value="0"<!-- IF not MODULE_ENABLED --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- IF permission_setting -->
|
||||
<dl>
|
||||
<dt><label for="permission-setting">{L_MODULE_PERMISSIONS}:</label><br /><span>{L_MODULE_PERMISSIONS_EXP}</span></dt>
|
||||
|
||||
@@ -39,6 +39,13 @@
|
||||
<dt><label for="module_reset">{L_MODULE_RESET}:</label><br /><span style="color: #BC2A4D;">{L_MODULE_RESET_EXP}</span></dt>
|
||||
<dd><input id="module_reset" type="checkbox" value="1" name="module_reset" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="module_status">{L_MODULE_STATUS}:</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" class="radio" name="module_status" value="1" id="module_status"<!-- IF MODULE_ENABLED --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
||||
<label><input type="radio" class="radio" name="module_status" value="0"<!-- IF not MODULE_ENABLED --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- IF permission_setting -->
|
||||
<dl>
|
||||
<dt><label for="permission-setting">{L_ACP_PORTAL_CUSTOM_PERMISSION}:</label><br /><span>{L_ACP_PORTAL_CUSTOM_PERMISSION_EXP}</span></dt>
|
||||
|
||||
@@ -90,6 +90,13 @@
|
||||
<dt><label for="module_reset">{L_MODULE_RESET}:</label><br /><span style="color: #BC2A4D;">{L_MODULE_RESET_EXP}</span></dt>
|
||||
<dd><input id="module_reset" type="checkbox" value="1" name="module_reset" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="module_status">{L_MODULE_STATUS}:</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" class="radio" name="module_status" value="1" id="module_status"<!-- IF MODULE_ENABLED --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
||||
<label><input type="radio" class="radio" name="module_status" value="0"<!-- IF not MODULE_ENABLED --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- IF permission_setting -->
|
||||
<dl>
|
||||
<dt><label for="permission-setting">{L_MODULE_PERMISSIONS}:</label><br /><span>{L_MODULE_PERMISSIONS_EXP}</span></dt>
|
||||
|
||||
@@ -97,6 +97,13 @@
|
||||
<dt><label for="module_reset">{L_MODULE_RESET}:</label><br /><span style="color: #BC2A4D;">{L_MODULE_RESET_EXP}</span></dt>
|
||||
<dd><input id="module_reset" type="checkbox" value="1" name="module_reset" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="module_status">{L_MODULE_STATUS}:</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" class="radio" name="module_status" value="1" id="module_status"<!-- IF MODULE_ENABLED --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
||||
<label><input type="radio" class="radio" name="module_status" value="0"<!-- IF not MODULE_ENABLED --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- IF permission_setting -->
|
||||
<dl>
|
||||
<dt><label for="permission-setting">{L_MODULE_PERMISSIONS}:</label><br /><span>{L_MODULE_PERMISSIONS_EXP}</span></dt>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<th style="text-align: center;" colspan="3">{L_MODULE_POS_TOP}</th>
|
||||
</tr>
|
||||
<!-- BEGIN modules_top -->
|
||||
<!-- IF modules_top.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<!-- IF not modules_top.MODULE_ENABLED --><tr class="row3"><!-- ELSEIF modules_top.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td colspan="3">
|
||||
{modules_top.MODULE_IMAGE} {modules_top.MODULE_NAME}<br />
|
||||
<br />
|
||||
@@ -63,13 +63,13 @@
|
||||
<th>{L_MODULE_POS_LEFT}</th>
|
||||
</tr>
|
||||
<!-- BEGIN modules_left -->
|
||||
<!-- IF modules_left.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<!-- IF not modules_left.MODULE_ENABLED --><tr class="row3"><!-- ELSEIF modules_left.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td>
|
||||
{modules_left.MODULE_IMAGE} {modules_left.MODULE_NAME}<br />
|
||||
<br />
|
||||
<!-- IF modules_left.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{modules_left.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->
|
||||
<!-- IF modules_left.U_MOVE_RIGHT --><a href="{modules_left.U_MOVE_RIGHT}">{ICON_MOVE_RIGHT}</a><!-- ELSE -->{ICON_MOVE_RIGHT_DISABLED}<!-- ENDIF -->
|
||||
<a href="{modules_left.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_left.U_DELETE}">{ICON_DELETE}</a><br/>
|
||||
<a href="{modules_left.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_left.U_DELETE}">{ICON_DELETE}</a><br />
|
||||
{ICON_MOVE_LEFT_DISABLED}
|
||||
<!-- IF modules_left.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_left.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
|
||||
</td>
|
||||
@@ -90,7 +90,7 @@
|
||||
<th style="text-align: center;">{L_MODULE_POS_CENTER}</th>
|
||||
</tr>
|
||||
<!-- BEGIN modules_center -->
|
||||
<!-- IF modules_center.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<!-- IF not modules_center.MODULE_ENABLED --><tr class="row3"><!-- ELSEIF modules_center.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td>
|
||||
{modules_center.MODULE_IMAGE} {modules_center.MODULE_NAME}<br />
|
||||
<br />
|
||||
@@ -117,7 +117,7 @@
|
||||
<th>{L_MODULE_POS_RIGHT}</th>
|
||||
</tr>
|
||||
<!-- BEGIN modules_right -->
|
||||
<!-- IF modules_right.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<!-- IF not modules_right.MODULE_ENABLED --><tr class="row3"><!-- ELSEIF modules_right.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td>
|
||||
{modules_right.MODULE_IMAGE} {modules_right.MODULE_NAME}<br />
|
||||
<br />
|
||||
@@ -147,7 +147,7 @@
|
||||
<th style="text-align: center;" colspan="3">{L_MODULE_POS_BOTTOM}</th>
|
||||
</tr>
|
||||
<!-- BEGIN modules_bottom -->
|
||||
<!-- IF modules_bottom.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<!-- IF not modules_bottom.MODULE_ENABLED --><tr class="row3"><!-- ELSEIF modules_bottom.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td colspan="3">
|
||||
{modules_bottom.MODULE_IMAGE} {modules_bottom.MODULE_NAME}<br />
|
||||
<br />
|
||||
|
||||
@@ -39,6 +39,13 @@
|
||||
<dt><label for="module_reset">{L_MODULE_RESET}:</label><br /><span style="color: #BC2A4D;">{L_MODULE_RESET_EXP}</span></dt>
|
||||
<dd><input id="module_reset" type="checkbox" value="1" name="module_reset" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="module_status">{L_MODULE_STATUS}:</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" class="radio" name="module_status" value="1" id="module_status"<!-- IF MODULE_ENABLED --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
|
||||
<label><input type="radio" class="radio" name="module_status" value="0"<!-- IF not MODULE_ENABLED --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- IF permission_setting -->
|
||||
<dl>
|
||||
<dt><label for="permission-setting">{L_MODULE_PERMISSIONS}:</label><br /><span>{L_MODULE_PERMISSIONS_EXP}</span></dt>
|
||||
|
||||
@@ -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']) ? '<img src="' . $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'] . '" alt="' . $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']),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user