diff --git a/root/adm/style/portal/acp_portal_modules.html b/root/adm/style/portal/acp_portal_modules.html index f779a445..22053e2e 100644 --- a/root/adm/style/portal/acp_portal_modules.html +++ b/root/adm/style/portal/acp_portal_modules.html @@ -95,9 +95,9 @@ {modules_center.MODULE_IMAGE} {modules_center.MODULE_NAME}

{ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  - {ICON_MOVE_RIGHT}  + {ICON_MOVE_RIGHT}  {ICON_EDIT} {ICON_DELETE}
- {ICON_MOVE_LEFT}  + {ICON_MOVE_LEFT}  {ICON_MOVE_DOWN_DISABLED}{ICON_MOVE_DOWN} @@ -124,7 +124,7 @@ {ICON_MOVE_UP_DISABLED}{ICON_MOVE_UP}  {ICON_MOVE_RIGHT_DISABLED}  {ICON_EDIT} {ICON_DELETE}
- {ICON_MOVE_LEFT}  + {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 021ad486..74ad5860 100644 --- a/root/includes/acp/acp_portal.php +++ b/root/includes/acp/acp_portal.php @@ -355,6 +355,106 @@ class acp_portal } } } + elseif($action == 'move_right') + { + $sql = 'SELECT module_order, module_column, module_classname + FROM ' . PORTAL_MODULES_TABLE . ' + WHERE module_id = ' . $module_id; + $result = $db->sql_query_limit($sql, 1); + $module_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $class = 'portal_' . $module_data['module_classname'] . '_module'; + if (!class_exists($class)) + { + include($phpbb_root_path . 'portal/modules/portal_' . $module_data['module_classname'] . '.' . $phpEx); + } + if (!class_exists($class)) + { + trigger_error('CLASS_NOT_FOUND', E_USER_ERROR); + } + $c_class = new $class(); + + if($c_class->columns & column_string_const(column_num_string($module_data['module_column'] + 1))) + { + if ($module_data !== false) + { + $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . ' + SET module_order = module_order + 1 + WHERE module_order >= ' . $module_data['module_order'] . ' + AND module_column = ' . ($module_data['module_column'] + 1); + $db->sql_query($sql); + $updated = $db->sql_affectedrows(); + if ($updated) + { + $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . ' + SET module_column = module_column + 1 + WHERE module_id = ' . $module_id; + $db->sql_query($sql); + + $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . ' + SET module_order = module_order - 1 + WHERE module_order >= ' . $module_data['module_order'] . ' + AND module_column = ' . $module_data['module_column']; + $db->sql_query($sql); + } + } + } + else + { + trigger_error($user->lang['UNABLE_TO_MOVE'] . adm_back_link($this->u_action)); + } + } + elseif($action == 'move_left') + { + $sql = 'SELECT module_order, module_column, module_classname + FROM ' . PORTAL_MODULES_TABLE . ' + WHERE module_id = ' . $module_id; + $result = $db->sql_query_limit($sql, 1); + $module_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $class = 'portal_' . $module_data['module_classname'] . '_module'; + if (!class_exists($class)) + { + include($phpbb_root_path . 'portal/modules/portal_' . $module_data['module_classname'] . '.' . $phpEx); + } + if (!class_exists($class)) + { + trigger_error('CLASS_NOT_FOUND', E_USER_ERROR); + } + $c_class = new $class(); + + if($c_class->columns & column_string_const(column_num_string($module_data['module_column'] - 1))) + { + if ($module_data !== false) + { + $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . ' + SET module_order = module_order + 1 + WHERE module_order >= ' . $module_data['module_order'] . ' + AND module_column = ' . ($module_data['module_column'] - 1); + $db->sql_query($sql); + $updated = $db->sql_affectedrows(); + if ($updated) + { + $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . ' + SET module_column = module_column - 1 + WHERE module_id = ' . $module_id; + $db->sql_query($sql); + + $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . ' + SET module_order = module_order - 1 + WHERE module_order >= ' . $module_data['module_order'] . ' + AND module_column = ' . $module_data['module_column']; + $db->sql_query($sql); + } + } + } + else + { + trigger_error($user->lang['UNABLE_TO_MOVE'] . adm_back_link($this->u_action)); + } + } elseif ($action == 'delete') { $sql = 'SELECT * diff --git a/root/language/de/mods/info_acp_portal.php b/root/language/de/mods/info_acp_portal.php index 6cae58b0..d65c870f 100644 --- a/root/language/de/mods/info_acp_portal.php +++ b/root/language/de/mods/info_acp_portal.php @@ -53,6 +53,7 @@ $lang = array_merge($lang, array( 'MOVE_RIGHT' => 'Nach rechts', 'MOVE_LEFT' => 'Nach links', 'B3P_FILE_NOT_FOUND' => 'Die angegebene Datei konnte nicht gefunden werden', + 'UNABLE_TO_MOVE' => 'Es ist nicht möglich den Block in die gewählte Spalte zu verschieben.', '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 8bd80596..0f52a6ef 100644 --- a/root/language/en/mods/info_acp_portal.php +++ b/root/language/en/mods/info_acp_portal.php @@ -52,6 +52,7 @@ $lang = array_merge($lang, array( 'MOVE_RIGHT' => 'Move right', 'MOVE_LEFT' => 'Move left', 'B3P_FILE_NOT_FOUND' => 'The requested file could not be found', + 'UNABLE_TO_MOVE' => 'It is not possible to move the block to the selected column.', 'MODULE_OPTIONS' => 'Module options', 'MODULE_NAME' => 'Module name',