From 9962527a7289f92defa53f2efff43bfff2447c39 Mon Sep 17 00:00:00 2001 From: thomppj Date: Fri, 9 Nov 2001 05:39:16 +0000 Subject: [PATCH] Working on code that will provide for more standardized code, presentation, etc, of Squirrelmail option pages, etc. Please look into it. I am really excited at where I am going with this. :) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1710 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/constants.php | 21 ++++ functions/options.php | 218 ++++++++++++++++++++++++---------------- 2 files changed, 152 insertions(+), 87 deletions(-) diff --git a/functions/constants.php b/functions/constants.php index 37d4c46a..fd98ff32 100644 --- a/functions/constants.php +++ b/functions/constants.php @@ -12,6 +12,27 @@ * $Id$ */ + /******************************************************/ + /* Set values for constants used in the options code. */ + /******************************************************/ + + /* Define constants for the various option types. */ + define('SMOPT_TYPE_STRING', 0); + define('SMOPT_TYPE_STRLIST', 1); + define('SMOPT_TYPE_TEXTAREA', 2); + define('SMOPT_TYPE_INTEGER', 3); + define('SMOPT_TYPE_FLOAT', 4); + define('SMOPT_TYPE_BOOLEAN', 5); + + /* Define constants for the options refresh levels. */ + define('SMOPT_REFRESH_NONE', 0); + define('SMOPT_REFRESH_FOLDERLIST', 1); + define('SMOPT_REFRESH_ALL', 2); + + /**************************************************************/ + /* Set values for constants used by Squirrelmail preferences. */ + /**************************************************************/ + /* Define constants for javascript settings. */ define('SMPREF_JS_ON', 1); define('SMPREF_JS_OFF', 2); diff --git a/functions/options.php b/functions/options.php index 29f5a9c4..2f7d3036 100644 --- a/functions/options.php +++ b/functions/options.php @@ -1,99 +1,143 @@ $title: " . - "\n"; + } + function hasChanged() { + return ($this->changed); } +} - function OptionRadio( $title, $name, $data, $default, $show = '', $store = '', $sep = '   ' ) { +function OptionSelect( $title, $name, $data, $default, $show = '', $store = '' ) { - echo "$title: "; - foreach( $data as $key => $opt ) { - if ( $store == '' ) { - $vl = $key; - } else{ - $vl = $opt[$store]; - } - if ( $show == '' ) { - $nm = $opt; - } else{ - $nm = $opt[$show]; - } - if ( $nm <> '') { - echo "$nm $sep\n"; + echo "$title: " . + "" . - "\n"; - } - - function OptionHidden( $name, $value ) { - echo "\n"; } - - function OptionCheck( $title, $name, $value, $comment ) { - - if ( $value ) - $chk = 'checked'; - echo "$title: " . - " $comment" . - "\n"; - - } - - function OptionTitle( $title ) { - - echo "$title\n"; - - } - - function OptionSubmit( $name ) { - - echo ' ' . - ''; - + echo "\n"; +} + +function OptionRadio( $title, $name, $data, $default, $show = '', $store = '', $sep = '   ' ) { + echo "$title: "; + foreach( $data as $key => $opt ) { + if ( $store == '' ) { + $vl = $key; + } else{ + $vl = $opt[$store]; + } + if ( $show == '' ) { + $nm = $opt; + } else{ + $nm = $opt[$show]; + } + if ( $nm <> '') { + echo "$nm $sep\n"; + } } + echo "\n"; +} + +function OptionText( $title, $name, $value, $size ) { + echo "$title: " . + "" . + "\n"; +} + +function OptionHidden( $name, $value ) { + echo "\n"; +} + +function OptionCheck( $title, $name, $value, $comment ) { + if ( $value ) + $chk = 'checked'; + echo "$title: " . + " $comment" . + "\n"; +} + +function OptionTitle( $title ) { + echo "$title\n"; +} + +function OptionSubmit( $name ) { + echo ' ' . + ''; +} ?> -- 2.25.1