*
* Functions needed to display the options pages.
*
- * @copyright © 1999-2007 The SquirrelMail Project Team
+ * @copyright 1999-2010 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
}
/* 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;
/* Get the widget for this option type. */
switch ($this->type) {
+ case SMOPT_TYPE_PASSWORD:
+ $result = $this->createWidget_String(TRUE);
+ break;
case SMOPT_TYPE_STRING:
$result = $this->createWidget_String();
break;
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)
return $result;
}
+ /**
+ * Creates info block
+ * @return string html formated output
+ */
+ function createWidget_Info() {
+ return sq_htmlspecialchars($this->value);
+ }
+
/**
* Create string field
+ *
+ * @param boolean $password When TRUE, the text in the input
+ * widget will be obscured (OPTIONAL;
+ * default = FALSE).
+ *
* @return string html formated option field
+ *
*/
- function createWidget_String() {
+ function createWidget_String($password=FALSE) {
switch ($this->size) {
case SMOPT_SIZE_TINY:
$width = 5;
$width = 25;
}
- return addInput('new_' . $this->name, $this->value, $width, 0, $this->aExtraAttribs) . htmlspecialchars($this->trailing_text);
+//TODO: might be better to have a separate template file for all widgets, because then the layout of the widget and the "trailing text" can be customized - they are still hard coded here
+ if ($password)
+ return addPwField('new_' . $this->name, $this->value, $width, 0, $this->aExtraAttribs) . ' ' . htmlspecialchars($this->trailing_text);
+ else
+ return addInput('new_' . $this->name, $this->value, $width, 0, $this->aExtraAttribs) . ' ' . htmlspecialchars($this->trailing_text);
}
/**