From c10f287751ad0b1926bca72b1a732d8f7785de7d Mon Sep 17 00:00:00 2001 From: David M Date: Sun, 22 Jan 2006 05:33:09 +0000 Subject: [PATCH] - Imagesets can now be edited! Hooray! ( Might need to add something.. ) git-svn-id: file:///svn/phpbb/trunk@5483 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_styles.html | 45 +++++++++++++ phpBB/includes/acp/acp_styles.php | 104 +++++++++++++++++++++++++++++- phpBB/language/en/acp/common.php | 1 + phpBB/language/en/acp/styles.php | 11 ++++ 4 files changed, 159 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index a9bd2932cd..0c7a6a21ed 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -30,6 +30,51 @@ + + + « {L_BACK} + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_IMAGE_CONFIGURATION}
{L_IMAGESET_NAME}: {NAME}
{L_IMAGE_NAME}{L_IMAGE}{L_IMAGE_LOCATION}{L_IMAGE_WIDTH}{L_IMAGE_HEIGHT}
{element.NAME}
+ +
+   + +
+ +
+ « {L_BACK} diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 57c9fbfeaf..759ad47dcd 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -258,8 +258,14 @@ pagination_sep = \'{PAGINATION_SEP}\' break; case 'imageset': - - $this->frontend('imageset', array('details', 'delete', 'export')); + switch ($action) + { + case 'edit': + $this->edit_imageset($style_id); + break; + default: + $this->frontend('imageset', array('details', 'delete', 'export')); + } break; } } @@ -410,6 +416,100 @@ pagination_sep = \'{PAGINATION_SEP}\' } + /** + * Edit imagesets + */ + function edit_imageset($style_id) + { + global $db, $template, $user, $phpbb_root_path, $cache; + + $update = (isset($_POST['submit'])) ? true : false; + + $sql = 'SELECT imageset_name, ' . $this->imageset_keys . ' + FROM ' . STYLES_IMAGE_TABLE . ' + WHERE imageset_id = ' . $style_id; + $result = $db->sql_query($sql); + $style_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$style_row) + { + trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action)); + } + + $name = $style_row['imageset_name']; + unset($style_row['imageset_name']); + + if ($update) + { + $images = (isset($_POST['src'])) ? request_var('src', array('' => '')) : array(); + $image_width = (isset($_POST['width'])) ? array_map('intval', $_POST['width']) : array(); + $image_height = (isset($_POST['height'])) ? array_map('intval', $_POST['height']) : array(); + + $img_array = array(); + + foreach ($images as $image_name => $value) + { + if (!empty($value)) + { + $width = ($image_width[$image_name] == 0) ? '' : $image_width[$image_name]; + $img_array[$image_name] = $value . '*' . $image_height[$image_name] . '*' . $width; + } + else + { + $img_array[$image_name] = ''; + } + } + + $sql = 'UPDATE ' . STYLES_IMAGE_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $img_array) . " + WHERE imageset_id = $style_id"; + $db->sql_query($sql); + + $cache->destroy('sql', STYLES_IMAGE_TABLE); + + add_log('admin', 'LOG_IMAGESET_EDIT', $name); + trigger_error($user->lang['EDITED_IMAGESET'] . adm_back_link($this->u_action)); + } + + $this->page_title = 'EDIT_IMAGESET'; + + foreach ($style_row as $key => $value) + { + $src = ''; + + $width = $height = $imgsrc = ''; + if (!empty($value)) + { + $values = explode('*',$value); + $imgsrc = $values[0]; + $height = (!empty($values[1])) ? $values[1] : ''; + $width = (!empty($values[2])) ? $values[2] : ''; + } + + $template->assign_block_vars('element', array( + 'NAME' => $key, + 'SRC' => $imgsrc, + 'HEIGHT' => $height, + 'WIDTH' => $width, + 'IMG_SRC' => $phpbb_root_path . 'styles/' . $user->theme['imageset_path'] . '/imageset/' . str_replace('{LANG}', $user->img_lang, $imgsrc) + ) + ); + } + + + $template->assign_vars(array( + 'S_EDIT_IMAGESET' => true, + 'L_TITLE' => $user->lang[$this->page_title], + 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN'], + + 'U_ACTION' => $this->u_action . "&action=edit&id=$style_id", + 'U_BACK' => $this->u_action, + 'NAME' => $name, + ) + ); + } + /** * Remove style/template/theme/imageset */ diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 89feb93e3c..b70b5c33ec 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -338,6 +338,7 @@ $lang = array_merge($lang, array( 'LOG_IMAGESET_ADD_FS' => 'Add new imageset on filesystem
» %s', 'LOG_IMAGESET_DELETE' => 'Deleted imageset
» %s', 'LOG_IMAGESET_EDIT_DETAILS' => 'Edited imageset details
» %s', + 'LOG_IMAGESET_EDIT' => 'Edited imageset
» %s', 'LOG_IMAGESET_EXPORT' => 'Exported imageset
» %s', 'LOG_INDEX_ACTIVATE' => 'Activated inactive users
» %s', diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index a83ffcc6ce..cffb03bdab 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -62,6 +62,15 @@ $lang = array_merge($lang, array( 'DELETE_THEME_EXPLAIN' => 'Here you can remove the selected theme from the database. Additionally, if you have permission you can elect to remove the theme from the filesystem. Please note that there is no undo capability. When the theme is deleted it is gone for good. It is recommended that you first export your theme for possible future use.', 'DETAILS' => 'Details', + 'EDIT_IMAGESET' => 'Edit imageset', + 'EDIT_IMAGESET_EXPLAIN' => 'Here you can modify the images stored in the currently selected imageset.', + 'IMAGE_CONFIGURATION' => 'Image configuration', + 'IMAGE_WIDTH' => 'Image width', + 'IMAGE_HEIGHT' => 'Image height', + 'IMAGE' => 'Image', + 'IMAGE_NAME' => 'Image name', + 'IMAGE_LOCATION' => 'Image location', + 'EDIT_DETAILS_IMAGESET' => 'Edit imageset details', 'EDIT_DETAILS_IMAGESET_EXPLAIN' => 'Here you can edit certain imageset details such as its name.', 'EDIT_DETAILS_STYLE' => 'Edit Style', @@ -106,6 +115,8 @@ $lang = array_merge($lang, array( 'INSTALLED_TEMPLATE' => 'Installed templates', 'INSTALLED_THEME' => 'Installed themes', + 'EDITED_IMAGESET' => 'Edited imageset', + 'NO_IMAGESET' => 'Cannot find imageset on filesystem', 'NO_STYLE' => 'Cannot find style on filesystem', 'NO_TEMPLATE' => 'Cannot find template on filesystem',