/**
* options.php
*
- * Copyright (c) 1999-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
* Functions needed to display the options pages.
*
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
* @subpackage prefs
* @var bool
*/
var $htmlencoded=false;
+ /**
+ * Controls folder list limits in SMOPT_TYPE_FLDRLIST widget.
+ * See $flag argument in sqimap_mailbox_option_list() function.
+ * @var string
+ * @since 1.5.1
+ */
+ var $folder_filter='noselect';
/**
* Constructor function
$this->script = '';
$this->post_script = '';
- /* Check for a current value. */
- if (!empty($initial_value)) {
- $this->value = $initial_value;
- } else if (isset($GLOBALS[$name])) {
+ //Check for a current value.
+ if (isset($GLOBALS[$name])) {
$this->value = $GLOBALS[$name];
+ } else if (!empty($initial_value)) {
+ $this->value = $initial_value;
} else {
$this->value = '';
}
$this->save_function = $save_function;
}
+ /**
+ * Set the trailing_text for this option.
+ * @param string $folder_filter
+ * @since 1.5.1
+ */
+ function setFolderFilter($folder_filter) {
+ $this->folder_filter = $folder_filter;
+ }
+
/**
* Creates fields on option pages according to option type
*
function createWidget_FolderList() {
$selected = array(strtolower($this->value));
- /* Begin the select tag. */
- $result = "<select name=\"new_$this->name\" $this->script>\n";
+ /* set initial value */
+ $result = '';
/* Add each possible value to the select list. */
foreach ($this->possible_values as $real_value => $disp_value) {
if ( is_array($disp_value) ) {
/* For folder list, we passed in the array of boxes.. */
- $new_option = sqimap_mailbox_option_list(0, $selected, 0, $disp_value);
+ $new_option = sqimap_mailbox_option_list(0, $selected, 0, $disp_value, $this->folder_filter);
} else {
/* Start the next new option string. */
$new_option = '<option value="' . htmlspecialchars($real_value) . '"';
/* And add the new option string to our select tag. */
$result .= $new_option;
}
- /* Close the select tag and return our happy result. */
- $result .= "</select>\n";
- return ($result);
+
+
+ if (empty($result)) {
+ // string is displayed when interface can't build folder selection box
+ return _("unavailable");
+ } else {
+ /* Begin the select tag. */
+ $ret = "<select name=\"new_$this->name\" $this->script>\n";
+ $ret.= $result;
+ /* Close the select tag and return our happy result. */
+ $ret.= "</select>\n";
+ return ($ret);
+ }
}
/**
foreach ($grpopts as $optset) {
/* Create a new option with all values given. */
$next_option = new SquirrelOption(
- $optset['name'],
- $optset['caption'],
- $optset['type'],
- (isset($optset['refresh']) ? $optset['refresh'] : SMOPT_REFRESH_NONE),
- (isset($optset['initial_value']) ? $optset['initial_value'] : ''),
- (isset($optset['posvals']) ? $optset['posvals'] : ''),
- (isset($optset['htmlencoded']) ? $optset['htmlencoded'] : false)
- );
+ $optset['name'],
+ $optset['caption'],
+ $optset['type'],
+ (isset($optset['refresh']) ? $optset['refresh'] : SMOPT_REFRESH_NONE),
+ (isset($optset['initial_value']) ? $optset['initial_value'] : ''),
+ (isset($optset['posvals']) ? $optset['posvals'] : ''),
+ (isset($optset['htmlencoded']) ? $optset['htmlencoded'] : false)
+ );
/* If provided, set the size for this option. */
if (isset($optset['size'])) {
$next_option->setPostScript($optset['post_script']);
}
+ /* If provided, set the folder_filter for this option. */
+ if (isset($optset['folder_filter'])) {
+ $next_option->setFolderFilter($optset['folder_filter']);
+ }
+
/* Add this option to the option array. */
$result[$grpkey]['options'][] = $next_option;
}
}
// vim: et ts=4
-?>
\ No newline at end of file