diff --git a/include/class.forms.php b/include/class.forms.php index 877a6a086880ca1979c10bb8904545b3ecdb3c96..8e58ca494da7fb5c2b17f19b5c1599eefb6923a3 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1016,7 +1016,7 @@ class Widget { class TextboxWidget extends Widget { static $input_type = 'text'; - function render() { + function render($mode=false) { $config = $this->field->getConfiguration(); if (isset($config['size'])) $size = "size=\"{$config['size']}\""; @@ -1056,7 +1056,7 @@ class PasswordWidget extends TextboxWidget { } class TextareaWidget extends Widget { - function render() { + function render($mode=false) { $config = $this->field->getConfiguration(); $class = $cols = $rows = $maxlength = ""; if (isset($config['rows'])) @@ -1080,7 +1080,7 @@ class TextareaWidget extends Widget { } class PhoneNumberWidget extends Widget { - function render() { + function render($mode=false) { $config = $this->field->getConfiguration(); list($phone, $ext) = explode("X", $this->value); ?> @@ -1109,6 +1109,15 @@ class PhoneNumberWidget extends Widget { class ChoicesWidget extends Widget { function render($mode=false) { + + if ($mode && $mode =='view') { + if (!($val = (string) $this->field)) + $val = '<span class="faded">None</span>'; + + echo $val; + return; + } + $config = $this->field->getConfiguration(); // Determine the value for the default (the one listed if nothing is // selected) @@ -1178,7 +1187,7 @@ class CheckboxWidget extends Widget { $this->name = '_field-checkboxes'; } - function render() { + function render($mode=false) { $config = $this->field->getConfiguration(); if (!isset($this->value)) $this->value = $this->field->get('default'); @@ -1202,7 +1211,7 @@ class CheckboxWidget extends Widget { } class DatetimePickerWidget extends Widget { - function render() { + function render($mode=false) { global $cfg; $config = $this->field->getConfiguration(); @@ -1272,7 +1281,7 @@ class DatetimePickerWidget extends Widget { } class SectionBreakWidget extends Widget { - function render() { + function render($mode=false) { ?><div class="form-header section-break"><h3><?php echo Format::htmlchars($this->field->get('label')); ?></h3><em><?php echo Format::htmlchars($this->field->get('hint')); diff --git a/include/class.user.php b/include/class.user.php index b137d49ee8e0de97d63db576baab32569a92cfbb..9129b1e2e7fcf50094e11b3571310d624cdc7190 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -254,6 +254,10 @@ class User extends UserModel { return JsonDataEncoder::encode($info); } + function __toString() { + return $this->asVar(); + } + function asVar() { return (string) $this->getName(); } diff --git a/include/staff/templates/list-item-properties.tmpl.php b/include/staff/templates/list-item-properties.tmpl.php index ef7158d03c78fb746cb100575bc54b34ab65f722..6c6f09656ae9fe1e58fcf622612c8e73b1adc1ac 100644 --- a/include/staff/templates/list-item-properties.tmpl.php +++ b/include/staff/templates/list-item-properties.tmpl.php @@ -33,16 +33,20 @@ </td><td> <span style="display:inline-block;width:100%"> <?php - $f->render(); - if ($f->get('required')) { ?> - <font class="error">*</font> - <?php - } - if ($f->get('hint')) { ?> - <br /><em style="color:gray;display:inline-block"><?php - echo Format::htmlchars($f->get('hint')); ?></em> - <?php - } + if ($item->isInternal() && $f->isConfigurable()) + $f->render('view'); + else { + $f->render(); + if ($f->get('required')) { ?> + <font class="error">*</font> + <?php + } + if ($f->get('hint')) { ?> + <br /><em style="color:gray;display:inline-block"><?php + echo Format::htmlchars($f->get('hint')); ?></em> + <?php + } + } ?> </span> <?php