mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
- Disable options according to type too
- Start options, value & rows disabled according to type when popup opens
This commit is contained in:
parent
586656289d
commit
81ef504361
@ -80,11 +80,16 @@ class customfields
|
||||
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),
|
||||
'label' => array('cf_values' => true),
|
||||
'select' => array('cf_len' => false, 'cf_rows' => true, 'cf_values' => 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),
|
||||
'button' => array('cf_values' => true),
|
||||
'ajax_select' => array('cf_values' => true),
|
||||
'radio' => array('cf_values' => true),
|
||||
'checkbox' => array('cf_values' => true),
|
||||
);
|
||||
|
||||
/**
|
||||
@ -400,6 +405,14 @@ class customfields
|
||||
$content['options'] = lang(self::$type_option_help);
|
||||
$content['statustext'] = $content['options'][$content['cf_type']];
|
||||
$content['attributes'] = self::$type_attribute_flags;
|
||||
|
||||
// Start disabled, but don't set read-only as that changes the widget to readonly
|
||||
$this->tmpl->setElementAttribute('cf_len', 'disabled', true);
|
||||
$this->tmpl->setElementAttribute('cf_rows', 'disabled', true);
|
||||
foreach(array('cf_len','cf_rows','cf_values') as $field)
|
||||
{
|
||||
$this->tmpl->setElementAttribute($field, 'disabled', !self::$type_attribute_flags[$content['cf_type']][$field]);
|
||||
}
|
||||
|
||||
$this->tmpl->exec('admin.customfields.edit',$content,$sel_options,$readonlys,array(
|
||||
'cf_id' => $cf_id,
|
||||
@ -432,14 +445,14 @@ class customfields
|
||||
'default' => true,
|
||||
'allowOnMultiple' => false,
|
||||
'url' => 'menuaction=admin.customfields.edit&cf_id=$id&use_private='.$this->use_private,
|
||||
'popup' => '450x380',
|
||||
'popup' => '500x380',
|
||||
'group' => $group=1,
|
||||
'disableClass' => 'th',
|
||||
),
|
||||
'add' => array(
|
||||
'caption' => 'Add',
|
||||
'url' => 'menuaction=admin.customfields.edit&appname='.$this->appname.'&use_private='.$this->use_private,
|
||||
'popup' => '450x380',
|
||||
'popup' => '500x380',
|
||||
'group' => $group,
|
||||
),
|
||||
'delete' => array(
|
||||
|
@ -2,9 +2,9 @@
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="admin.customfield_edit" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%">
|
||||
<grid width="450px">
|
||||
<columns>
|
||||
<column width="130"/>
|
||||
<column width="110"/>
|
||||
<column width="350"/>
|
||||
<column width="45"/>
|
||||
<column width="30"/>
|
||||
@ -28,7 +28,10 @@
|
||||
</row>
|
||||
<row>
|
||||
<description value="Type of field"/>
|
||||
<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]'));"/>
|
||||
<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]'));
|
||||
widget.getRoot().getWidgetById('cf_values').set_disabled(!widget.getArrayMgr('content').getEntry('attributes['+widget.getValue()+'][cf_values]'));"/>
|
||||
<hbox span="2">
|
||||
<description value="Required"/>
|
||||
<checkbox id="cf_needed"/>
|
||||
|
Loading…
Reference in New Issue
Block a user