mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
WIP allow to place custom-fields in tabs: 2 new custom-field types:
- header: (like label with a bigger font and bold) - serial: auto-incremented serial number
This commit is contained in:
parent
8e4160c6c9
commit
254fdc0fa3
@ -88,7 +88,8 @@ class admin_customfields
|
||||
'select' => 'each value is a line like id[=label], or use @path to read options from a file in EGroupware directory',
|
||||
'radio' => 'each value is a line like id[=label], or use @path to read options from a file in EGroupware directory',
|
||||
'button' => 'each value is a line like label=[javascript]',
|
||||
'password'=> 'set length=# for minimum password length, strength=# for password strength'
|
||||
'password' => 'set length=# for minimum password length, strength=# for password strength',
|
||||
'serial' => 'you can set an initial value, which gets incremented every time a new serial get generated'
|
||||
);
|
||||
|
||||
/**
|
||||
@ -473,6 +474,10 @@ class admin_customfields
|
||||
{
|
||||
$readonlys['cf_name'] = true;
|
||||
}
|
||||
if ($content['cf_type'] === 'serial')
|
||||
{
|
||||
$readonlys['cf_values'] = true; // only allow to set start-value, but not change it after
|
||||
}
|
||||
if (!isset($GLOBALS['egw_info']['apps'][$content['cf_type']]))
|
||||
{
|
||||
$content['cf_values'] = json_decode($content['cf_values'], true);
|
||||
|
@ -834,6 +834,7 @@ select where you want to store/retrieve user accounts admin de Wo möchten Sie d
|
||||
select which location this app should appear on the navbar, lowest (left) to highest (right) admin de An welcher Position soll die Anwendung in der Navigationsleiste erscheinen, von ganz unten (links) bis ganz oben (rechts)
|
||||
selectbox admin de Auswahlfeld
|
||||
send using this email-address admin de Zum Versenden wird diese E-Mail-Adresse benutzt
|
||||
serial number admin de Fortlaufende Nummer
|
||||
server %1 has been updated admin de Server %1 wurde aktualisiert
|
||||
server list admin de Server-Liste
|
||||
server password admin de Server-Passwort
|
||||
@ -1051,6 +1052,7 @@ yes, use credentials of current user or if given credentials below admin de Ja,
|
||||
yes, use webspellchecker admin de Ja, benutze nur den WebSpellChecker (online)
|
||||
you can not use --dry-run together with --skip-checks! admin de Die Verwendung von --dry-run und --skip-checks zusammen ist nicht möglich!
|
||||
you can only change the hash, if you set a random password or currently use plaintext passwords! admin de Sie können die Passwort-Verschlüsselung nur ändern, wenn sie ein zufälliges Passwort setzen oder bisher Passworte im Klartext gespeichert haben!
|
||||
you can set an initial value, which gets incremented every time a new serial get generated admin de Sie können einen initialen Wert setzen, dieser wird hochgezählt um eine neue Nummer zu generieren
|
||||
you can use wizard to fix account settings or delete account. admin de Sie können jetzt den Assistenten verwenden um die Konteneinstellungen zu ändern oder das Konto löschen.
|
||||
you have entered an invalid expiration date admin de Sie haben ein ungültiges Ablaufdatum angegeben
|
||||
you have no email address for your user set !!! admin de Sie haben noch keine E-Mail für den Benutzer vergeben.
|
||||
|
@ -834,6 +834,7 @@ select where you want to store/retrieve user accounts admin en Select where you
|
||||
select which location this app should appear on the navbar, lowest (left) to highest (right) admin en Select which location this app should appear on the navbar, lowest (left) to highest (right).
|
||||
selectbox admin en Select box
|
||||
send using this email-address admin en Send using this email address
|
||||
serial number admin en Serial number
|
||||
server %1 has been updated admin en Server %1 has been updated
|
||||
server list admin en Server list
|
||||
server password admin en Server password
|
||||
@ -1051,6 +1052,7 @@ yes, use credentials of current user or if given credentials below admin en Yes,
|
||||
yes, use webspellchecker admin en Yes, use online WebSpellChecker
|
||||
you can not use --dry-run together with --skip-checks! admin en You can NOT use --dry-run together with --skip-checks!
|
||||
you can only change the hash, if you set a random password or currently use plaintext passwords! admin en You can change the hash only, if you set a random password or currently use plaintext passwords!
|
||||
you can set an initial value, which gets incremented every time a new serial get generated admin en you can set an initial value, which gets incremented every time a new serial get generated
|
||||
you can use wizard to fix account settings or delete account. admin en You can use wizard to fix account settings or delete account.
|
||||
you have entered an invalid expiration date admin en You have entered an invalid expiration date!
|
||||
you have no email address for your user set !!! admin en You have no email address set for your user!
|
||||
|
@ -367,9 +367,11 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
|
||||
{
|
||||
// Label in first column, widget in 2nd
|
||||
const label = this.options.label || field.label || '';
|
||||
jQuery(document.createElement("td"))
|
||||
.attr('colspan', (attrs.type || field.type) === 'label' ? 2 : 1)
|
||||
.prependTo(row);
|
||||
const label_td = jQuery(document.createElement("td")).prependTo(row);
|
||||
if (['label','header'].indexOf(attrs.type || field.type) !== -1)
|
||||
{
|
||||
label_td.attr('colspan', 2).addClass('et2_customfield_'+(attrs.type || field.type));
|
||||
}
|
||||
et2_createWidget("label", {id: id + "_label", value: label.trim(), for: id}, this);
|
||||
}
|
||||
|
||||
@ -685,6 +687,15 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
|
||||
return true;
|
||||
}
|
||||
|
||||
_setup_serial(field_name, field, attrs)
|
||||
{
|
||||
delete (attrs.label);
|
||||
field.type = "number"
|
||||
attrs.precision = 0;
|
||||
attrs.readonly = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
_setup_int(field_name, field, attrs)
|
||||
{
|
||||
delete (attrs.label);
|
||||
|
@ -38,6 +38,7 @@ class Customfields extends Transformer
|
||||
'int' => 'Integer',
|
||||
'float' => 'Float',
|
||||
'label' => 'Label',
|
||||
'header' => 'Header',
|
||||
'select' => 'Selectbox',
|
||||
'ajax_select' => 'Search',
|
||||
'radio' => 'Radiobutton',
|
||||
@ -51,6 +52,7 @@ class Customfields extends Transformer
|
||||
'url-phone'=> 'Phone number',
|
||||
'htmlarea' => 'Formatted Text (HTML)',
|
||||
'link-entry' => 'Select entry', // should be last type, as the individual apps get added behind
|
||||
'serial' => 'Serial number',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -541,6 +543,20 @@ class Customfields extends Transformer
|
||||
}
|
||||
//error_log(__METHOD__."() $field_name: ".array2string($value).' --> '.array2string($valid));
|
||||
}
|
||||
// serials do NOT return a value, as they are always readonly
|
||||
foreach(array_filter($customfields, static function($field)
|
||||
{
|
||||
return $field['type'] === 'serial';
|
||||
}) as $field)
|
||||
{
|
||||
$valid =& self::get_array($validated, self::$prefix.$field['name'], true);
|
||||
if (empty($valid = self::$request->content[self::$prefix.$field['name']]))
|
||||
{
|
||||
$content = self::$request->content;
|
||||
$valid = $content[self::$prefix.$field['name']] = Api\Storage\Customfields::getSerial($field['id']);
|
||||
self::$request->content = $content;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($this->type == 'customfields-types')
|
||||
{
|
||||
|
@ -649,6 +649,38 @@ class Customfields implements \IteratorAggregate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a new serial-number from the database
|
||||
*
|
||||
* @param int $id cf_id for custom-field
|
||||
* @return int the new serial number
|
||||
*/
|
||||
public static function getSerial(int $id) : int
|
||||
{
|
||||
self::$db->transaction_begin();
|
||||
foreach(self::$db->select(self::TABLE, 'cf_values', $where=[
|
||||
'cf_id' => $id,
|
||||
'cf_type' => 'serial',
|
||||
], __LINE__, __FILE__, false, 'FOR UPDATE') as $row)
|
||||
{
|
||||
if (empty($row['cf_values']) || !is_numeric($row['cf_values']))
|
||||
{
|
||||
$row['cf_values'] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['cf_values'] += 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (isset($row) && self::$db->update(self::TABLE, $row, $where, __LINE__, __FILE__) && self::$db->transaction_commit())
|
||||
{
|
||||
return $row['cf_values'];
|
||||
}
|
||||
self::$db->transaction_abort();
|
||||
throw new Api\Db\Exception("Could not generate serial number for custom-field #$id!");
|
||||
}
|
||||
}
|
||||
|
||||
Customfields::init_static();
|
@ -797,6 +797,11 @@ et2-dialog et2-button {
|
||||
max-width: 100ex;
|
||||
}
|
||||
|
||||
td.et2_customfield_header et2-label {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Custom field list inside nextmatch rows gets an icon for each row */
|
||||
.et2_nextmatch .egwGridView_grid .et2_customfield_list > tbody > tr {
|
||||
background-image: url('images/dialog_info.svg');
|
||||
|
Loading…
Reference in New Issue
Block a user