From 6c06cf542841b920e14d961e98dee7a479ac7a08 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Fri, 19 Dec 2008 00:12:54 +0000 Subject: [PATCH] Add info option widget type git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13372 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/options.php | 15 ++++++++++++++- include/constants.php | 1 + src/options.php | 2 +- templates/default/css/options.css | 5 +++++ templates/default/options.tpl | 26 ++++++++++++++++++++------ 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/functions/options.php b/functions/options.php index 8a623038..1795c226 100644 --- a/functions/options.php +++ b/functions/options.php @@ -213,7 +213,9 @@ class SquirrelOption { } /* Set the default save function. */ - if (($type != SMOPT_TYPE_HIDDEN) && ($type != SMOPT_TYPE_COMMENT)) { + if ($type != SMOPT_TYPE_HIDDEN + && $type != SMOPT_TYPE_INFO + && $type != SMOPT_TYPE_COMMENT) { $this->save_function = SMOPT_SAVE_DEFAULT; } else { $this->save_function = SMOPT_SAVE_NOOP; @@ -410,6 +412,9 @@ class SquirrelOption { case SMOPT_TYPE_SUBMIT: $result = $this->createWidget_Submit(); break; + case SMOPT_TYPE_INFO: + $result = $this->createWidget_Info(); + break; default: error_box ( sprintf(_("Option Type '%s' Not Found"), $this->type) @@ -428,6 +433,14 @@ class SquirrelOption { return $result; } + /** + * Creates info block + * @return string html formated output + */ + function createWidget_Info() { + return sq_htmlspecialchars($this->value); + } + /** * Create string field * @return string html formated option field diff --git a/include/constants.php b/include/constants.php index 9dae98ac..dbf32478 100644 --- a/include/constants.php +++ b/include/constants.php @@ -235,6 +235,7 @@ define('SMOPT_TYPE_BOOLEAN_CHECKBOX', 12); define('SMOPT_TYPE_BOOLEAN_RADIO', 13); define('SMOPT_TYPE_STRLIST_RADIO', 14); define('SMOPT_TYPE_SUBMIT', 15); +define('SMOPT_TYPE_INFO', 16); // Define constants for the layout scheme for edit lists define('SMOPT_EDIT_LIST_LAYOUT_LIST', 0); diff --git a/src/options.php b/src/options.php index ed0fb673..f11694dd 100644 --- a/src/options.php +++ b/src/options.php @@ -430,7 +430,7 @@ if ($optpage == SMOPT_PAGE_MAIN) { . create_optmode_element(SMOPT_MODE_SUBMIT); // This is the only variable that is needed by *just* the template. - $oTemplate->assign('options', $optpage_data['options']); + $oTemplate->assign('option_groups', $optpage_data['options']); global $ask_user_info, $org_name; if ( $optpage == SMOPT_PAGE_PERSONAL && $ask_user_info diff --git a/templates/default/css/options.css b/templates/default/css/options.css index b39d3638..a1e16cf7 100644 --- a/templates/default/css/options.css +++ b/templates/default/css/options.css @@ -28,6 +28,11 @@ height: 100%; } +#optionDisplay table.optionInfo { + width: 80%; + text-align: left; + border: 0px; +} #optionGroups td.optionName { background: #ababab; diff --git a/templates/default/options.tpl b/templates/default/options.tpl index 30c56226..ab4fc511 100644 --- a/templates/default/options.tpl +++ b/templates/default/options.tpl @@ -5,10 +5,11 @@ * Template for rendering the options page * * The following variables are available to this template: - * $options - array of options as built by SquirrelMail. Important fields - * in this array include (but are not limited to): - * $el['name'] - The name of the option group - * $el['options'] - array of squirrelOption objects + * $option_groups - array of option groups and their options as + * built by SquirrelMail. Important fields + * in this array include (but are not limited to): + * ['name'] - The name of the option group + * ['options'] - array of squirrelOption objects * * @copyright © 1999-2006 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License @@ -30,7 +31,7 @@ if ( !empty($topmessage) ) {
\n"; if (!empty($option['name'])) { @@ -43,7 +44,20 @@ foreach ($options as $option) { $hidden_widgets = ''; foreach ($option['options'] as $opt) { - if ($opt->type != SMOPT_TYPE_HIDDEN) { + if ($opt->type == SMOPT_TYPE_INFO) { + echo "\n" + . " \n" + . " \n" + . " \n" + . " \n" + . " \n" + . "
\n" + . $opt->createWidget() . "\n" + . "
\n" + . " \n" + . "\n"; + + } else if ($opt->type != SMOPT_TYPE_HIDDEN) { echo "\n" . " caption_wrap ? '' : ' style="white-space:nowrap"') . ">\n "; -- 2.25.1