UI for customfields edit dialog:

- More space
- Show type specific help in options tooltip
- Disable length & rows when not needed
This commit is contained in:
Nathan Gray 2014-11-24 21:58:07 +00:00
parent fd191888bb
commit 7f7e013ecf
3 changed files with 46 additions and 15 deletions

View File

@ -64,6 +64,29 @@ class customfields
*/ */
var $tmpl; var $tmpl;
/**
* @var Description of the options or value format for each cf_type
*/
public static $type_option_help = array(
'select' => 'each value is a line like id[=label], or use @<path> to read options from a file',
'radio' => 'each value is a line like id[=label], or use @<path> to read options from a file',
'button' => 'each value is a line like label=[javascript]'
);
/**
* Custom fields can also have length and rows set, but these are't used for all types
* If not set to true here, the field will be disabled when selecting the type
*/
public static $type_attribute_flags = array(
'text' => array('cf_len' => true, 'cf_rows' => true),
'float' => array('cf_len' => true, 'cf_rows' => true),
'select' => array('cf_len' => false, 'cf_rows' => true),
'date' => array('cf_len' => true, 'cf_rows' => false),
'date-time' => array('cf_len' => true, 'cf_rows' => false),
'select-account' => array('cf_len' => false, 'cf_rows' => true),
'htmlarea' => array('cf_len' => true, 'cf_rows' => true),
);
/** /**
* Constructor * Constructor
* *
@ -373,6 +396,11 @@ class customfields
$content['no_types'] = true; $content['no_types'] = true;
} }
// Include type-specific value help
$content['options'] = lang(self::$type_option_help);
$content['statustext'] = $content['options'][$content['cf_type']];
$content['attributes'] = self::$type_attribute_flags;
$this->tmpl->exec('admin.customfields.edit',$content,$sel_options,$readonlys,array( $this->tmpl->exec('admin.customfields.edit',$content,$sel_options,$readonlys,array(
'cf_id' => $cf_id, 'cf_id' => $cf_id,
'cf_app' => $this->appname, 'cf_app' => $this->appname,

View File

@ -82,3 +82,9 @@ td.admin_userAgent span {
max-height: 300px; max-height: 300px;
overflow: auto; overflow: auto;
} }
#admin-customfield_edit tr:not([class]) td {
padding: 5px 0px;
}
#admin-customfield_edit .attributes .et2_label,#admin-customfield_edit .attributes input {
margin-right: 1em;
}

View File

@ -6,7 +6,7 @@
<columns> <columns>
<column width="130"/> <column width="130"/>
<column width="350"/> <column width="350"/>
<column/> <column width="45"/>
<column width="30"/> <column width="30"/>
</columns> </columns>
<rows> <rows>
@ -17,43 +17,40 @@
</row> </row>
<row disabled="@no_types"> <row disabled="@no_types">
<description value="Type"/> <description value="Type"/>
<menulist> <menulist span="3">
<menupopup id="cf_type2" no_lang="1" rows="3"/> <menupopup id="cf_type2" no_lang="1" rows="5"/>
</menulist> </menulist>
<description/> <description/>
</row> </row>
<row> <row>
<description value="Label"/> <description value="Label"/>
<textbox statustext="the text displayed to the user" id="cf_label" maxlength="255" class="et2_fullWidth"/> <textbox statustext="the text displayed to the user" id="cf_label" maxlength="255" class="et2_fullWidth" span="3"/>
<description/>
</row> </row>
<row> <row>
<description value="Type of field"/> <description value="Type of field"/>
<customfields-types statustext="Type of customfield" id="cf_type" class="et2_fullWidth"/> <customfields-types statustext="Type of customfield" id="cf_type" class="et2_fullWidth" span="2" onchange="widget.getRoot().getWidgetById('cf_values').set_statustext(widget.getArrayMgr('content').getEntry('options['+widget.getValue()+']')||'');widget.getRoot().getWidgetById('cf_len').set_disabled(!widget.getArrayMgr('content').getEntry('attributes['+widget.getValue()+'][cf_len]'));widget.getRoot().getWidgetById('cf_rows').set_disabled(!widget.getArrayMgr('content').getEntry('attributes['+widget.getValue()+'][cf_rows]'));"/>
<hbox> <hbox span="2">
<description value="Required"/> <description value="Required"/>
<checkbox id="cf_needed"/> <checkbox id="cf_needed"/>
</hbox> </hbox>
<description/>
</row> </row>
<row disabled="!@use_private"> <row disabled="!@use_private">
<description value="Private"/> <description value="Private"/>
<taglist-account class="et2_fullWidth" statustext="Select accounts for which the custom field should be visible" id="cf_private" rows="3" account_type="both" span="2"/> <taglist-account class="et2_fullWidth" statustext="Select accounts for which the custom field should be visible" id="cf_private" rows="3" account_type="both" span="3" empty_label="Add user or group"/>
<description/>
</row> </row>
<row> <row>
<description statustext="each value is a line like &lt;id&gt;[=&lt;label&gt;]" value="Options"/> <description statustext="each value is a line like &lt;id&gt;[=&lt;label&gt;]" value="Options"/>
<textbox multiline="true" statustext="each value is a line like id[=label]" id="cf_values" rows="4" cols="30" span="2" width="99%"/> <textbox multiline="true" statustext="@statustext" id="cf_values" rows="5" cols="30" span="3" width="99%"/>
</row> </row>
<row> <row>
<description value="Attributes"/> <description value="Attributes"/>
<box span="2"> <box span="3" class="attributes">
<description value="Length:"/> <description value="Length:"/>
<textbox statustext="max length of the input [, length of the inputfield (optional)]" id="cf_len" size="5"/> <textbox statustext="max length of the input [, length of the inputfield (optional)]" id="cf_len" size="4"/>
<description value="Rows:"/> <description value="Rows:"/>
<textbox type="integer" blur="1" statustext="number of row for a multiline inputfield or line of a multi-select-box" id="cf_rows" min="0" max="10" size="2"/> <textbox type="integer" blur="1" statustext="number of row for a multiline inputfield or line of a multi-select-box" id="cf_rows" min="0" max="10" size="4"/>
<description value="Order:"/> <description value="Order:"/>
<textbox type="integer" statustext="determines the order the fields are displayed" id="cf_order" min="1" size="3"/> <textbox type="integer" statustext="determines the order the fields are displayed" id="cf_order" min="1" size="4"/>
</box> </box>
<description/> <description/>
</row> </row>