Added check for existence of clock file;

Added basic set of files for moving blocks right & left (still missing the functions in includes/acp/acp_portal.php)
This commit is contained in:
Marc Alexander
2011-01-10 23:35:20 +00:00
parent 9ce0695824
commit 488deca772
9 changed files with 58 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

View File

@@ -68,8 +68,10 @@
{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 -->&nbsp;
<!-- IF modules_left.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_left.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->&nbsp;
<a href="{modules_left.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_left.U_DELETE}">{ICON_DELETE}</a>
<a href="{modules_left.U_MOVE_RIGHT}">{ICON_MOVE_RIGHT}</a>&nbsp;
<a href="{modules_left.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_left.U_DELETE}">{ICON_DELETE}</a><br/>
{ICON_MOVE_LEFT_DISABLED}&nbsp;
<!-- IF modules_left.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_left.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
</td>
</tr>
<!-- BEGINELSE -->
@@ -93,8 +95,10 @@
{modules_center.MODULE_IMAGE} {modules_center.MODULE_NAME}<br />
<br />
<!-- IF modules_center.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{modules_center.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->&nbsp;
<!-- IF modules_center.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_center.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->&nbsp;
<a href="{modules_center.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_center.U_DELETE}">{ICON_DELETE}</a>
<a href="{modules_left.U_MOVE_RIGHT}">{ICON_MOVE_RIGHT}</a>&nbsp;
<a href="{modules_center.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_center.U_DELETE}">{ICON_DELETE}</a><br />
<a href="{modules_left.U_MOVE_LEFT}">{ICON_MOVE_LEFT}</a>&nbsp;
<!-- IF modules_center.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_center.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
</td>
</tr>
<!-- BEGINELSE -->
@@ -118,8 +122,10 @@
{modules_right.MODULE_IMAGE} {modules_right.MODULE_NAME}<br />
<br />
<!-- IF modules_right.S_FIRST_ROW -->{ICON_MOVE_UP_DISABLED}<!-- ELSE --><a href="{modules_right.U_MOVE_UP}">{ICON_MOVE_UP}</a><!-- ENDIF -->&nbsp;
<!-- IF modules_right.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_right.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->&nbsp;
<a href="{modules_right.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_right.U_DELETE}">{ICON_DELETE}</a>
{ICON_MOVE_RIGHT_DISABLED}&nbsp;
<a href="{modules_right.U_EDIT}">{ICON_EDIT}</a> <a href="{modules_right.U_DELETE}">{ICON_DELETE}</a><br />
<a href="{modules_left.U_MOVE_LEFT}">{ICON_MOVE_LEFT}</a>&nbsp;
<!-- IF modules_right.S_LAST_ROW -->{ICON_MOVE_DOWN_DISABLED}<!-- ELSE --><a href="{modules_right.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a><!-- ENDIF -->
</td>
</tr>
<!-- BEGINELSE -->

View File

@@ -156,10 +156,10 @@ class acp_portal
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null)
{
if ($submit && isset($null['submit']))
if ($submit && ($null['type'] == 'custom' || $null['submit_type'] == 'custom'))
{
$func = array($c_class, $null['submit']);
$args = ($module_id != 0) ? array($config_name, $module_id) : $config_name;
$args = ($module_id != 0) ? array($cfg_array[$config_name], $config_name, $module_id) : $config_name;
call_user_func_array($func, $args);
}
@@ -246,6 +246,7 @@ class acp_portal
'U_ACTION' => $this->u_action . (($module_id) ? '&amp;module_id=' . $module_id : ''),
));
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars)
{
@@ -549,9 +550,18 @@ class acp_portal
'U_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=portal&amp;mode=config&amp;module_id=' . $row['module_id']),
'U_MOVE_UP' => $this->u_action . '&amp;module_id=' . $row['module_id'] . '&amp;action=move_up',
'U_MOVE_DOWN' => $this->u_action . '&amp;module_id=' . $row['module_id'] . '&amp;action=move_down',
'U_MOVE_RIGHT' => $this->u_action . '&amp;module_id=' . $row['module_id'] . '&amp;action=move_right',
'U_MOVE_LEFT' => $this->u_action . '&amp;module_id=' . $row['module_id'] . '&amp;action=move_left',
));
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'ICON_MOVE_LEFT' => '<img src="' . $phpbb_admin_path . 'images/icon_left.gif" alt="' . $user->lang['MOVE_LEFT'] . '" title="' . $user->lang['MOVE_LEFT'] . '" />',
'ICON_MOVE_LEFT_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_left_disabled.gif" alt="' . $user->lang['MOVE_LEFT'] . '" title="' . $user->lang['MOVE_LEFT'] . '" />',
'ICON_MOVE_RIGHT' => '<img src="' . $phpbb_admin_path . 'images/icon_right.gif" alt="' . $user->lang['MOVE_RIGHT'] . '" title="' . $user->lang['MOVE_RIGHT'] . '" />',
'ICON_MOVE_RIGHT_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_right_disabled.gif" alt="' . $user->lang['MOVE_RIGHT'] . '" title="' . $user->lang['MOVE_RIGHT'] . '" />',
));
}
$this->tpl_name = 'portal/acp_portal_modules';

View File

@@ -50,6 +50,9 @@ $lang = array_merge($lang, array(
'SUCCESS_ADD' => 'Das Modul wurde erfolgreich hinzugefügt.',
'SUCCESS_DELETE' => 'Das Modul wurde erfolgreich entfernt.',
'NO_MODULES' => 'Es wurden keine Module gefunden.',
'MOVE_RIGHT' => 'Nach rechts',
'MOVE_LEFT' => 'Nach links',
'B3P_FILE_NOT_FOUND' => 'Die angegebene Datei konnte nicht gefunden werden',
'MODULE_OPTIONS' => 'Modul Optionen',
'MODULE_NAME' => 'Modul Name',

View File

@@ -49,6 +49,9 @@ $lang = array_merge($lang, array(
'SUCCESS_ADD' => 'The module was added successfully.',
'SUCCESS_DELETE' => 'The module was removed successfully.',
'NO_MODULES' => 'No modules have been detected.',
'MOVE_RIGHT' => 'Move right',
'MOVE_LEFT' => 'Move left',
'B3P_FILE_NOT_FOUND' => 'The requested file could not be found',
'MODULE_OPTIONS' => 'Module options',
'MODULE_NAME' => 'Module name',

View File

@@ -63,7 +63,7 @@ class portal_clock_module
'title' => 'ACP_PORTAL_CLOCK_SETTINGS',
'vars' => array(
'legend1' => 'ACP_PORTAL_CLOCK_SETTINGS',
'board3_clock_src_' . $module_id => array('lang' => 'ACP_PORTAL_CLOCK_SRC', 'validate' => 'string', 'type' => 'text:50:200', 'explain' => false),
'board3_clock_src_' . $module_id => array('lang' => 'ACP_PORTAL_CLOCK_SRC', 'validate' => 'string', 'type' => 'text:50:200', 'explain' => true, 'submit_type' => 'custom', 'submit' => 'check_clock_src'),
),
);
}
@@ -88,6 +88,33 @@ class portal_clock_module
WHERE ' . $db->sql_in_set('config_name', $del_config);
return $db->sql_query($sql);
}
/*
* check if the entered clock src file actually exists
*/
function check_clock_src($value, $key, $module_id)
{
global $db, $phpbb_root_path, $phpEx, $user;
$sql = 'SELECT style_name
FROM ' . STYLES_TABLE . '
WHERE style_active = 1';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
if(!file_exists($phpbb_root_path . 'styles/' . $row['style_name'] . '/theme/images/portal/' . $value))
{
$error .= $user->lang['B3P_FILE_NOT_FOUND'] . ': styles/' . $row['style_name'] . '/theme/images/portal/' . $value . '<br />';
}
}
$db->sql_freeresult($result);
if(isset($error))
{
trigger_error($error . adm_back_link(append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=portal&amp;mode=config&amp;module_id=' . $module_id)));
}
}
}
?>