add NM-filter-header for type, entry-type and tab to custom-fields list

currently header is somehow readonly
This commit is contained in:
ralf 2024-04-23 10:42:00 +02:00
parent 834e4f7824
commit 8acfc4ed27
3 changed files with 36 additions and 23 deletions

View File

@ -261,7 +261,7 @@ class admin_customfields
$content['content_types']['no_edit_types'] = true;
}
// do NOT allow to delete original contact content-type for addressbook,
// as it only creates support problems as users incidently delete it
// as it only creates support problems as users accidentally delete it
if ($this->appname == 'addressbook' && $this->content_type == 'n')
{
$readonlys['content_types']['delete'] = true;
@ -273,6 +273,8 @@ class admin_customfields
// Disable content types
$this->tmpl->disableElement('content_types', true);
}
$sel_options['cf_type'] = Etemplate\Widget\Customfields::getCfTypes();
$sel_options['cf_tab'] = $this->so->query_list('cf_tab', '', ['cf_app' => $this->appname]);
$preserve = array(
'appname' => $this->appname,
'use_private' => $this->use_private,

View File

@ -44,20 +44,20 @@
</columns>
<rows>
<row class="th">
<nextmatch-header label="Type" id="cf_type2"/>
<et2-nextmatch-header-filter emptyLabel="Type" id="cf_type2"/>
<nextmatch-sortheader label="Name" id="cf_name"/>
<nextmatch-sortheader label="Label" id="cf_label"/>
<nextmatch-header label="Type of field" id="cf_type"/>
<et2-nextmatch-header-filter emptyLabel="Type of field" id="cf_type"/>
<nextmatch-header label="Required" id="cf_needed"/>
<nextmatch-header label="Private" id="cf_private"/>
<nextmatch-header label="Readonly" id="cf_readonly"/>
<nextmatch-header label="Options"/>
<nextmatch-header label="Options" id="cf_values"/>
<et2-vbox>
<nextmatch-header label="Length"/>
<nextmatch-header label="Rows"/>
<nextmatch-header label="Length" id="cf_len"/>
<nextmatch-header label="Rows" id="cf_rows"/>
</et2-vbox>
<nextmatch-sortheader label="Order" id="cf_order"/>
<nextmatch-sortheader label="Tab" id="cf_tab"/>
<et2-nextmatch-header-filter emptyLabel="Tab" id="cf_tab"/>
<nextmatch-sortheader label="Last modified" id="cf_modified"/>
</row>
<row class="row" valign="top">

View File

@ -22,7 +22,6 @@ use EGroupware\Api;
*/
class Customfields extends Transformer
{
/**
* Allowed types of customfields
*
@ -209,21 +208,7 @@ class Customfields extends Transformer
switch($type = $this->type)
{
case 'customfields-types':
foreach(self::$cf_types as $lname => $label)
{
$sel_options[$lname] = lang($label);
$fields_with_vals[]=$lname;
}
$link_types = array_intersect_key(Api\Link::app_list('query'), Api\Link::app_list('title'));
// Explicitly add in filemanager, which does not support query or title
$link_types['filemanager'] = lang('filemanager');
ksort($link_types);
foreach($link_types as $lname => $label)
{
$sel_options[$lname] = '- '.$label;
}
self::$transformation['type'][$type]['sel_options'] = $sel_options;
self::$transformation['type'][$type]['sel_options'] = self::getCfTypes($fields_with_vals);
self::$transformation['type'][$type]['no_lang'] = true;
return parent::beforeSendToClient($cname, $expand);
case 'customfields-list':
@ -294,6 +279,32 @@ class Customfields extends Transformer
}
}
/**
* Get cf types for sel_options
*
* @param array|null $fields_with_vals
* @return array
*/
public static function getCfTypes(?array &$fields_with_vals=null)
{
$sel_options = [];
foreach(self::$cf_types as $lname => $label)
{
$sel_options[$lname] = lang($label);
$fields_with_vals[]=$lname;
}
$link_types = array_intersect_key(Api\Link::app_list('query'), Api\Link::app_list('title'));
// Explicitly add in filemanager, which does not support query or title
$link_types['filemanager'] = lang('filemanager');
ksort($link_types);
foreach($link_types as $lname => $label)
{
$sel_options[$lname] = $label;
}
return $sel_options;
}
/**
* Instantiate (server-side) widget used to implement custom-field, to run its beforeSendToClient or validate method
*