From 488deca772e5d3b1c7178114363d9cd097b2d293 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 10 Jan 2011 23:35:20 +0000 Subject: [PATCH] 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) --- root/adm/images/icon_left.gif | Bin 0 -> 240 bytes root/adm/images/icon_left_disabled.gif | Bin 0 -> 166 bytes root/adm/images/icon_right.gif | Bin 0 -> 241 bytes root/adm/images/icon_right_disabled.gif | Bin 0 -> 166 bytes root/adm/style/portal/acp_portal_modules.html | 18 +++++++---- root/includes/acp/acp_portal.php | 14 +++++++-- root/language/de/mods/info_acp_portal.php | 3 ++ root/language/en/mods/info_acp_portal.php | 3 ++ root/portal/modules/portal_clock.php | 29 +++++++++++++++++- 9 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 root/adm/images/icon_left.gif create mode 100644 root/adm/images/icon_left_disabled.gif create mode 100644 root/adm/images/icon_right.gif create mode 100644 root/adm/images/icon_right_disabled.gif diff --git a/root/adm/images/icon_left.gif b/root/adm/images/icon_left.gif new file mode 100644 index 0000000000000000000000000000000000000000..a9f4dd7dc2b6a4203c4f011a964f406776a8f0a5 GIT binary patch literal 240 zcmV?n+mRJRE%B@XFyW|c)OTCFZ7!(_r+8K>*vG%8_Tz^M~V qG-=PK2z(@$2p>N{9vDI+IfODjE(2s^8#gT^0}28H3L7jVApkqVA$auw literal 0 HcmV?d00001 diff --git a/root/adm/images/icon_left_disabled.gif b/root/adm/images/icon_left_disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..6bec14519c6076e559b11b4b7062997a595645f0 GIT binary patch literal 166 zcmZ?wbhEHb6krfw*v!E2eMX`-$WA))0^-l0+KXidF8~&{L##5hmcv!<1VLDDjS}i Sa%P)mH6=k|!9yP<25SIG%T2BT literal 0 HcmV?d00001 diff --git a/root/adm/images/icon_right.gif b/root/adm/images/icon_right.gif new file mode 100644 index 0000000000000000000000000000000000000000..19f0edd4f38fc6ca474e0d72d95e859490aaea53 GIT binary patch literal 241 zcmVKDW+K>a0?=ru(um0dUYS;#3ChBranur-VUb#gN(IYJ&pB87$?JuU-iX9+hgBm)l%3l9k_BOw4g3$cAi literal 0 HcmV?d00001 diff --git a/root/adm/images/icon_right_disabled.gif b/root/adm/images/icon_right_disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..8a28f6b3d47f1ebf57a6c03a40f7e36bda4735c1 GIT binary patch literal 166 zcmZ?wbhEHb6krfw*v!E21nYxkUR
{ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  - {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}  - {ICON_EDIT} {ICON_DELETE} + {ICON_MOVE_RIGHT}  + {ICON_EDIT} {ICON_DELETE}
+ {ICON_MOVE_LEFT_DISABLED}  + {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN} @@ -93,8 +95,10 @@ {modules_center.MODULE_IMAGE} {modules_center.MODULE_NAME}

{ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  - {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}  - {ICON_EDIT} {ICON_DELETE} + {ICON_MOVE_RIGHT}  + {ICON_EDIT} {ICON_DELETE}
+ {ICON_MOVE_LEFT}  + {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN} @@ -118,8 +122,10 @@ {modules_right.MODULE_IMAGE} {modules_right.MODULE_NAME}

{ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  - {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN}  - {ICON_EDIT} {ICON_DELETE} + {ICON_MOVE_RIGHT_DISABLED}  + {ICON_EDIT} {ICON_DELETE}
+ {ICON_MOVE_LEFT}  + {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN} diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php index 7aeddd51..021ad486 100644 --- a/root/includes/acp/acp_portal.php +++ b/root/includes/acp/acp_portal.php @@ -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); } @@ -245,6 +245,7 @@ class acp_portal 'U_ACTION' => $this->u_action . (($module_id) ? '&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&mode=config&module_id=' . $row['module_id']), 'U_MOVE_UP' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_up', 'U_MOVE_DOWN' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_down', + 'U_MOVE_RIGHT' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_right', + 'U_MOVE_LEFT' => $this->u_action . '&module_id=' . $row['module_id'] . '&action=move_left', )); } $db->sql_freeresult($result); + + $template->assign_vars(array( + 'ICON_MOVE_LEFT' => '' . $user->lang['MOVE_LEFT'] . '', + 'ICON_MOVE_LEFT_DISABLED' => '' . $user->lang['MOVE_LEFT'] . '', + 'ICON_MOVE_RIGHT' => '' . $user->lang['MOVE_RIGHT'] . '', + 'ICON_MOVE_RIGHT_DISABLED' => '' . $user->lang['MOVE_RIGHT'] . '', + )); } $this->tpl_name = 'portal/acp_portal_modules'; diff --git a/root/language/de/mods/info_acp_portal.php b/root/language/de/mods/info_acp_portal.php index 7c37e933..6cae58b0 100644 --- a/root/language/de/mods/info_acp_portal.php +++ b/root/language/de/mods/info_acp_portal.php @@ -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', diff --git a/root/language/en/mods/info_acp_portal.php b/root/language/en/mods/info_acp_portal.php index 7ca1bfe7..8bd80596 100644 --- a/root/language/en/mods/info_acp_portal.php +++ b/root/language/en/mods/info_acp_portal.php @@ -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', diff --git a/root/portal/modules/portal_clock.php b/root/portal/modules/portal_clock.php index 8e73fc2c..638ffaca 100644 --- a/root/portal/modules/portal_clock.php +++ b/root/portal/modules/portal_clock.php @@ -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 . '
'; + } + } + $db->sql_freeresult($result); + + if(isset($error)) + { + trigger_error($error . adm_back_link(append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=portal&mode=config&module_id=' . $module_id))); + } + } } ?> \ No newline at end of file