forked from extern/egroupware
implement some missing features from old eTemplate:
- evaluate class set on a grid cell as done for the widget contained (probably more a bug-fix then a feature) - allow to preset query for link-entry widget by passing an object with a query attribute - allow to overwrite not only $readonlys[__ALL__] but also widget readonly attribute with a $readonlys value of false
This commit is contained in:
parent
5bc4dc90e3
commit
0463b796ce
@ -499,9 +499,9 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
|
|||||||
cell.nm_id = node.getAttribute('id');
|
cell.nm_id = node.getAttribute('id');
|
||||||
}
|
}
|
||||||
// Apply widget's class to td, for backward compatability
|
// Apply widget's class to td, for backward compatability
|
||||||
if(node.getAttribute("class"))
|
if (node.getAttribute("class"))
|
||||||
{
|
{
|
||||||
cell.class += (cell.class ? " " : "") + node.getAttribute("class");
|
cell.class += (cell.class ? " " : "") + this.getArrayMgr("content").expandName(node.getAttribute("class"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the element
|
// Create the element
|
||||||
|
@ -1014,6 +1014,13 @@ export class et2_link_entry extends et2_inputWidget
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// display a search query, not a selected entry
|
||||||
|
else if (_value !== null && typeof _value === 'object' && typeof _value.query === 'string')
|
||||||
|
{
|
||||||
|
this.options.value = { app: _value.app || this.options.only_app, id: null };
|
||||||
|
this.search.val(_value.query);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._oldValue = this.options.value;
|
this._oldValue = this.options.value;
|
||||||
if(!_value || _value.length == 0 || _value == null || jQuery.isEmptyObject(_value))
|
if(!_value || _value.length == 0 || _value == null || jQuery.isEmptyObject(_value))
|
||||||
{
|
{
|
||||||
|
@ -923,9 +923,10 @@ class Widget
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a widget is readonly:
|
* Checks if a widget is readonly:
|
||||||
* - readonly attribute set
|
* 1. $readonlys set to true for $form_name:
|
||||||
* - $readonlys[__ALL__] set and $readonlys[$form_name] !== false
|
* a) $readonlys[$form_name] is set to true (flat array)
|
||||||
* - $readonlys[$form_name] evaluates to true
|
* b) self::get_array($readonlys, $form_name) is set to true (hierarchical)
|
||||||
|
* 2. ($readonlys[__ALL__] or widget readonly attribute) is true AND NOT $readonlys set to false for $form_name
|
||||||
*
|
*
|
||||||
* @param string $cname =''
|
* @param string $cname =''
|
||||||
* @param string $form_name =null form_name, to not calculate him again
|
* @param string $form_name =null form_name, to not calculate him again
|
||||||
@ -940,13 +941,12 @@ class Widget
|
|||||||
);
|
);
|
||||||
$form_name = self::form_name($cname, $this->id, $expand);
|
$form_name = self::form_name($cname, $this->id, $expand);
|
||||||
}
|
}
|
||||||
$readonly = $this->attrs['readonly'] || self::$request->readonlys[$form_name] ||
|
// readonlys can either be set / used as flat array with complete form-name, hierarchical
|
||||||
self::get_array(self::$request->readonlys,$form_name) === true ||
|
$readonlys = self::$request->readonlys[$form_name] ?? self::get_array(self::$request->readonlys,$form_name);
|
||||||
isset(self::$request->readonlys['__ALL__']) && (
|
|
||||||
// Exceptions to all
|
$readonly = $readonlys === true ||
|
||||||
self::$request->readonlys[$form_name] !== false &&
|
// exception to __ALL__ or readonly="true" attribute by setting $readonlys[$from_name] === false
|
||||||
self::get_array(self::$request->readonlys,$form_name) !== false
|
($this->attrs['readonly'] || isset(self::$request->readonlys['__ALL__'])) && $readonlys !== false;
|
||||||
);
|
|
||||||
|
|
||||||
//error_log(__METHOD__."('$cname') this->id='$this->id' --> form_name='$form_name': attrs[readonly]=".array2string($this->attrs['readonly']).", readonlys['$form_name']=".array2string(self::$request->readonlys[$form_name]).", readonlys[$form_name]=".array2string(self::get_array(self::$request->readonlys,$form_name)).", readonlys['__ALL__']=".array2string(self::$request->readonlys['__ALL__'])." returning ".array2string($readonly));
|
//error_log(__METHOD__."('$cname') this->id='$this->id' --> form_name='$form_name': attrs[readonly]=".array2string($this->attrs['readonly']).", readonlys['$form_name']=".array2string(self::$request->readonlys[$form_name]).", readonlys[$form_name]=".array2string(self::get_array(self::$request->readonlys,$form_name)).", readonlys['__ALL__']=".array2string(self::$request->readonlys['__ALL__'])." returning ".array2string($readonly));
|
||||||
return $readonly;
|
return $readonly;
|
||||||
|
Loading…
Reference in New Issue
Block a user