Preferences: Get preferences mostly displaying again

There's still something wrong validation.
This commit is contained in:
nathan 2022-07-13 10:52:11 -06:00
parent 2c08542529
commit f8f7d1621e
4 changed files with 46 additions and 32 deletions

View File

@ -36,10 +36,15 @@ export function et2_compileLegacyJS(_code, _widget, _context)
{
// Get the content array manager for the widget
var mgr = _widget.getArrayMgr("content");
if (mgr)
if(mgr)
{
_code = mgr.expandName(_code);
}
// If replacement cleared the code, skip the rest
if(!_code)
{
return false;
}
}
// Context is the context in which the function will run. Set context to

View File

@ -299,15 +299,15 @@ class preferences_hooks
'default'=> $lang,
),
'country' => array(
'type' => 'select-country',
'label' => 'Country',
'name' => 'country',
'help' => 'In which country are you. This is used to set certain defaults for you.',
'xmlrpc' => True,
'admin' => False,
'values' => array(''),
'default'=> strtoupper($country),
'attributes' => array (
'type' => 'et2-select-country',
'label' => 'Country',
'name' => 'country',
'help' => 'In which country are you. This is used to set certain defaults for you.',
'xmlrpc' => True,
'admin' => False,
'values' => array(),
'default' => strtoupper($country),
'attributes' => array(
'tags' => true
)
),

View File

@ -431,14 +431,13 @@ class preferences_settings
$setting['run_lang'] = false; // already done now
// handle as textarea
case 'textarea':
$setting['type'] = is_a($tpl, 'etemplate') ? 'textarea' : 'textbox';
$tpl->setElementAttribute($tab.'['.$setting['name'].']', 'multiline', 'true');
$tpl->setElementAttribute($tab. '[' . $setting['name'] . ']','width', '99%' );
$setting['type'] = is_a($tpl, 'etemplate') ? 'textarea' : 'et2-textbox';
$tpl->setElementAttribute($tab . '[' . $setting['name'] . ']', 'multiline', 'true');
// anyway setting via css: width: 99%, height: 5em
// for old eT use size attribute
if (is_a($tpl, 'etemplate') && (!empty($setting['cols']) || !empty($setting['rows'])))
if(is_a($tpl, 'etemplate') && (!empty($setting['cols']) || !empty($setting['rows'])))
{
$setting['size'] = $setting['rows'].','.$setting['cols'];
$setting['size'] = $setting['rows'] . ',' . $setting['cols'];
}
break;
case 'password':
@ -446,33 +445,41 @@ class preferences_settings
case 'vfs_dir':
case 'vfs_dirs':
case 'input':
$setting['type'] = 'textbox';
$setting['type'] = 'et2-textbox';
break;
case 'check':
$setting['type'] = 'select';
$setting['type'] = 'et2-select';
$setting['values'] = array('1' => lang('yes'), '0' => lang('no'));
break;
case 'select':
$setting['type'] = 'et2-select';
break;
case 'multiselect':
$setting['type'] = 'select';
$tpl->setElementAttribute($tab.'['.$setting['name'].']', 'rows', 5);
if (!isset($setting['size'])) $setting['size'] = '5'; // old eT
$setting['type'] = 'et2-select';
$tpl->setElementAttribute($tab . '[' . $setting['name'] . ']', 'multiple', true);
break;
case 'color':
$setting['type'] = 'colorpicker';
$setting['type'] = 'et2-colorpicker';
break;
case 'date-duration':
if (!isset($setting['size'])) $setting['size'] = 'm,dhm,24,1';
if(!isset($setting['size']))
{
$setting['size'] = 'm,dhm,24,1';
}
$attrs = explode(',', $setting['size']);
foreach(array("data_format","display_format", "hours_per_day", "empty_not_0", "short_labels") as $n => $name)
{
if ((string)$attrs[$n] !== '') $tpl->setElementAttribute($tab.'['.$setting['name'].']', $name, $attrs[$n]);
}
$setting['type'] = 'et2-date-duration';
break;
case 'taglist':
if ($setting['no_sel_options'])
if($setting['no_sel_options'])
{
$tpl->setElementAttribute ($tab.'['.$setting['name'].']', 'autocomplete_url', '');
$tpl->setElementAttribute($tab . '[' . $setting['name'] . ']', 'autocomplete_url', '');
}
$setting['type'] = 'et2-select';
$tpl->setElementAttribute($tab . '[' . $setting['name'] . ']', 'multiple', true);
break;
}
// move values/options to sel_options array
@ -517,14 +524,15 @@ class preferences_settings
$setting['help'] = lang($setting['help']);
}
$content[$tab][] = array(
'name' => $setting['name'],
'type' => $setting['type'],
'label' => preg_replace('|<br[ /]*>|i', "\n", $setting['label']),
'help' => lang($setting['help']), // is html
'default' => (string)$default !== '' ? lang('Default').': '.$default : null,
'onchange' => $setting['onchange'],
'attributes' => $setting['attributes']
'name' => $setting['name'],
'type' => $setting['type'],
'label' => preg_replace('|<br[ /]*>|i', "\n", $setting['label']),
'help' => lang($setting['help']), // is html
'default' => (string)$default !== '' ? lang('Default') . ': ' . $default : null,
'onchange' => $setting['onchange']
);
// 'attributes' => $setting['attributes']
//error_log("appname=$appname, attribute=$attribute, setting=".array2string($setting));
$content[$tab][$setting['name']] = $GLOBALS['egw']->preferences->{$attribute}[$appname][$setting['name']];
//if ($old_type == 'multiselect') $content[$tab][$setting['name']] = explode(',', $content[$tab][$setting['name']]);

View File

@ -16,7 +16,8 @@
<description id="${row}[default]" no_lang="1" class="prefDefault"/>
</vbox>
<box class="prefValueColumn">
<widget type="@${row}[type]" id="@${row}[name]" onchange="@${row}[onchange]" no_lang="1" class="prefValue" attributes="@${row}[attributes]"/>
<widget type="@${row}[type]" id="@${row}[name]" onchange="@${row}[onchange]" no_lang="1"
class="prefValue"/>
</box>
<box class="prefHelpColumn">
<html id="${row}[help]" class="prefHelp"/>