UI and schema update for CF tab and readonly

This commit is contained in:
ralf 2024-03-20 15:05:40 +02:00
parent 2ed34a39c6
commit ee9c657fb6
9 changed files with 55 additions and 15 deletions

View File

@ -43,6 +43,11 @@ class admin_customfields
*/
protected $use_private = false;
/**
* Allow custom fields to be readonly for certain users/groups
*/
protected $use_readonly = false;
/**
* userdefiened types e.g. type of infolog
*
@ -341,6 +346,7 @@ class admin_customfields
die(lang('Error! No appname found'));
}
$this->use_private = !isset($_GET['use_private']) || (boolean)$_GET['use_private'] || !empty($content['use_private']);
$this->use_readonly = !isset($_GET['use_readonly']) || (boolean)$_GET['use_readonly'] || !empty($content['use_readonly']);
// Read fields, constructor doesn't always know appname
$this->fields = Api\Storage\Customfields::get($this->appname,true);
@ -453,6 +459,7 @@ class admin_customfields
//echo 'customfields=<pre style="text-align: left;">'; print_r($this->fields); echo "</pre>\n";
$content['cf_order'] = (count($this->fields)+1) * 10;
$content['use_private'] = $this->use_private;
$content['use_readonly'] = $this->use_readonly;
if($cf_id)
{

View File

@ -269,6 +269,7 @@ custom 1 admin de Benutzerdefiniert 1
custom 2 admin de Benutzerdefiniert 2
custom 3 admin de Benutzerdefiniert 3
custom fields admin de Benutzerdefinierte Felder
custom fields tab admin de Benutzerdefinierte Felder Tab
custom translation admin de Eigene Übersetzung
customfield '%1' added admin de Benutzerdefiniertes Feld '%1' hinzugefügt
customfield '%1' deleted admin de Benutzerdefiniertes Feld '%1' gelöscht
@ -660,6 +661,7 @@ must change password upon next login admin de Muss das Passwort beim nächsten L
name must not be empty !!! admin de Name darf nicht leer sein!
name of account admin de Name des Kontos
name of organisation admin de Name der Organisation
name of tab to create and show field in admin de Name des anzulegenden Tabs in dem das Feld angezeigt wird
name of the egroupware instance, eg. default admin de Name der EGroupware-Instanz, z.B. default
new group name admin de Neuer Gruppenname
new name admin de Neuer Name
@ -813,6 +815,7 @@ search peer servers admin de Serververbund durchsuchen
secret deleted, two factor authentication disabled. admin de Geheimnis gelöscht, 2-Faktor-Authentifizierung deaktiviert.
secure connection admin de Sichere Verbindung
security admin de Sicherheit
select accounts for which the custom field should be readonly admin de Benutzer auswählen, für die dieses benutzerdefinierte Feld schreibgeschützt sein soll.
select accounts for which the custom field should be visible admin de Benutzer auswählen, für die dieses benutzerdefinierte Feld sichtbar sein soll.
select group managers admin de Gruppenmanager auswählen
select language to define language based message. language 'english' is default page for all languages therefore for setting a general message across all languages you only need to set the 'english' page. admin de Wählen Sie die Sprache, um eine sprachabhängige Nachricht zu definieren. Sprache 'Englisch' ist die Standardseite für alle Sprachen, daher müssen Sie für die Einstellung einer allgemeinen Nachricht für allen Sprachen nur die Seite 'Englisch' erstellen.

View File

@ -269,6 +269,7 @@ custom 1 admin en Custom 1
custom 2 admin en Custom 2
custom 3 admin en Custom 3
custom fields admin en Custom fields
custom fields tab admin en custom fields tab
custom translation admin en Custom translation
customfield '%1' added admin en Customfield '%1' added
customfield '%1' deleted admin en Customfield '%1' deleted
@ -660,6 +661,7 @@ must change password upon next login admin en Must change password upon next log
name must not be empty !!! admin en Name must not be empty!
name of account admin en Name of account
name of organisation admin en Name of organization
name of tab to create and show field in admin en Name of tab to create and show field in
name of the egroupware instance, eg. default admin en Name of the EGroupware instance
new group name admin en New group name
new name admin en New name
@ -813,6 +815,7 @@ search peer servers admin en Search peer servers
secret deleted, two factor authentication disabled. admin en Secret deleted, two factor authentication disabled.
secure connection admin en Secure connection
security admin en Security
select accounts for which the custom field should be readonly admin en Select accounts for which the custom field should be readonly
select accounts for which the custom field should be visible admin en Select accounts the custom field should be visible for.
select group managers admin en Select group managers
select language to define language based message. language 'english' is default page for all languages therefore for setting a general message across all languages you only need to set the 'english' page. admin en Select language to define language based message. Language 'english' is default page for all languages therefore for setting a general message across all languages you only need to set the 'english' page.

View File

@ -31,22 +31,29 @@
<et2-description value="Private"></et2-description>
<et2-select-account statustext="Select accounts for which the custom field should be visible" id="cf_private" rows="3" span="3" multiple="1" placeholder="Add user or group" accountType="both"></et2-select-account>
</row>
<row disabled="!@use_readonly">
<et2-description value="Readonly"></et2-description>
<et2-select-account statustext="Select accounts for which the custom field should be readonly" id="cf_readonly" rows="3" span="3" multiple="1" placeholder="Add user or group" accountType="both"></et2-select-account>
</row>
<row>
<et2-description statustext="each value is a line like id[=label], or use @path to read options from a file in EGroupware directory" value="Options"></et2-description>
<et2-textarea statustext="@statustext" id="cf_values" rows="5" cols="30" span="3" width="99%"></et2-textarea>
</row>
<row>
<et2-description value="Attributes"></et2-description>
<et2-box span="3" class="attributes">
<et2-description value="Length"></et2-description>
<et2-number statustext="displayed length of input field (set rows=1 to limit length)" id="cf_len" precision="0"></et2-number>
<et2-description value="Rows"></et2-description>
<et2-number statustext="number of row for a multiline inputfield or line of a multi-select-box" id="cf_rows" min="0" precision="0" placeholder="1"></et2-number>
<et2-description value="Order"></et2-description>
<et2-description value="Length"></et2-description>
<et2-hbox span="all">
<et2-number statustext="displayed length of input field (set rows=1 to limit length)" id="cf_len" precision="0"></et2-number>
<et2-description value="Rows"></et2-description>
<et2-number statustext="number of row for a multiline inputfield or line of a multi-select-box" id="cf_rows" min="0" precision="0" placeholder="1"></et2-number>
</et2-hbox>
</row>
<row>
<et2-description value="Order"></et2-description>
<et2-hbox span="all">
<et2-number statustext="determines the order the fields are displayed" id="cf_order" min="1" precision="0"></et2-number>
</et2-box>
<et2-description></et2-description>
<et2-description value="Tab"></et2-description>
<et2-textbox id="cf_tab" size="32" maxlength="64" placeholder="custom fields tab" statustext="Name of tab to create and show field in"></et2-textbox>
</et2-hbox>
</row>
</rows>
</grid>

View File

@ -35,10 +35,12 @@
<column width="100px"/>
<column width="50px"/>
<column width="100px" disabled="!@use_private"/>
<column width="100px" disabled="!@use_readonly"/>
<column width="60%"/>
<column width="50px"/>
<column width="50px"/>
<column width="120px"/>
<column width="120px"/>
</columns>
<rows>
<row class="th">
@ -48,12 +50,14 @@
<nextmatch-header label="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"/>
<et2-vbox>
<nextmatch-header label="Length"/>
<nextmatch-header label="Rows"/>
</et2-vbox>
<nextmatch-sortheader label="Order" id="cf_order"/>
<nextmatch-sortheader label="Tab" id="cf_tab"/>
<nextmatch-sortheader label="Last modified" id="cf_modified"/>
</row>
<row class="row" valign="top">
@ -66,13 +70,15 @@
<customfields-types statustext="Type of customfield" id="{$row}[cf_type]" readonly="true"
app="$cont[appname]"/>
<et2-checkbox id="${row}[cf_needed]" readonly="true" selectedValue="1" unselectedValue="0"></et2-checkbox>
<et2-select-account id="${row}[cf_private]" readonly="true" accountType="both"></et2-select-account>
<et2-select-account id="${row}[cf_private]" readonly="true" accountType="both"></et2-select-account>
<et2-select-account id="${row}[cf_readonly]" readonly="true" accountType="both"></et2-select-account>
<et2-description id="${row}[cf_values]" class="values" noLang="1"></et2-description>
<et2-vbox>
<et2-description id="${row}[cf_len]" noLang="1"></et2-description>
<et2-description id="${row}[cf_rows]" noLang="1"></et2-description>
</et2-vbox>
<et2-description id="${row}[cf_order]" noLang="1"></et2-description>
<et2-description id="${row}[cf_tab]" noLang="1"></et2-description>
<et2-vbox>
<et2-date-time id="${row}[cf_modified]" readonly="true"></et2-date-time>
<et2-select-account id="${row}[cf_modifier]" readonly="true"></et2-select-account>

View File

@ -11,7 +11,7 @@
/* Basic information about this app */
$setup_info['api']['name'] = 'api';
$setup_info['api']['title'] = 'EGroupware API';
$setup_info['api']['version'] = '23.1.005';
$setup_info['api']['version'] = '23.1.006';
$setup_info['api']['versions']['current_header'] = '1.29';
// maintenance release in sync with changelog in doc/rpm-build/debian.changes
$setup_info['api']['versions']['maintenance_release'] = '23.1.20240304';
@ -139,4 +139,4 @@ $setup_info['groupdav']['author'] = $setup_info['groupdav']['maintainer'] = arra
);
$setup_info['groupdav']['license'] = 'GPL';
$setup_info['groupdav']['hooks']['preferences'] = 'EGroupware\\Api\\CalDAV\\Hooks::menus';
$setup_info['groupdav']['hooks']['settings'] = 'EGroupware\\Api\\CalDAV\\Hooks::settings';
$setup_info['groupdav']['hooks']['settings'] = 'EGroupware\\Api\\CalDAV\\Hooks::settings';

View File

@ -382,7 +382,8 @@ $phpgw_baseline = array(
'cf_private' => array('type' => 'ascii','meta' => 'account-commasep','precision' => '2048','comment' => 'comma-separated account_id'),
'cf_modifier' => array('type' => 'int','meta' => 'account','precision' => '4','comment' => 'last modifier'),
'cf_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'last modification time'),
'cf_tab' => array('type' => 'varchar','precision' => '64','comment' => 'tab customfield should be shown')
'cf_tab' => array('type' => 'varchar','precision' => '64','comment' => 'tab customfield should be shown'),
'cf_readonly' => array('type' => 'ascii','meta' => 'account-commasep','precision' => '2048','comment' => 'comma-separated account_id')
),
'pk' => array('cf_id'),
'fk' => array(),
@ -552,4 +553,4 @@ $phpgw_baseline = array(
'ix' => array('account_id'),
'uc' => array()
)
);
);

View File

@ -954,4 +954,15 @@ function api_upgrade23_1_004()
));
return $GLOBALS['setup_info']['api']['currentver'] = '23.1.005';
}
function api_upgrade23_1_005()
{
$GLOBALS['egw_setup']->oProc->AddColumn('egw_customfields','cf_readonly',array(
'type' => 'ascii',
'meta' => 'account-commasep',
'precision' => '2048',
'comment' => 'comma-separated account_id'
));
return $GLOBALS['setup_info']['api']['currentver'] = '23.1.006';
}

View File

@ -435,8 +435,10 @@ class Customfields implements \IteratorAggregate
'cf_len' => (string)$cf['len'] !== '' ? $cf['len'] : null,
'cf_rows' => (string)$cf['rows'] !== '' ? $cf['rows'] : null,
'cf_order' => $cf['order'],
'cf_tab' => $cf['tab'] ?? null ?: null,
'cf_needed' => $cf['needed'],
'cf_private' => $cf['private'] ? implode(',', $cf['private']) : null,
'cf_readonly' => $cf['readonly'] ? implode(',', $cf['readonly']) : null,
'cf_modifier' => $GLOBALS['egw_info']['user']['account_id'],
'cf_modified' => time(),
), array(