Fix file settings error "'0' is NOT allowed ('not found')!" for gid.

It did not have a '0' => 'root' option, which is what we were using for the value.
This commit is contained in:
nathan 2023-01-19 09:21:03 -07:00
parent 80fbd3cc26
commit 86917eff65
3 changed files with 43 additions and 19 deletions

View File

@ -58,10 +58,28 @@ export const SelectAccountMixin = <T extends Constructor<LitElement>>(superclass
return;
}
let val = Array.isArray(this.value) ? this.value : [this.value];
if(this.isConnected)
{
this._find_options(val)
}
else
{
// If not already connected, wait until any provided select_options have been found
this.updateComplete.then(() =>
{
this._find_options(val);
this.requestUpdate('select_options');
});
}
}
_find_options(val)
{
for(let id of val)
{
// Don't add if it's already there
if(this.account_options.findIndex(o => o.value == id) != -1)
if(this.select_options.findIndex(o => o.value == id) != -1)
{
continue;
}
@ -69,7 +87,7 @@ export const SelectAccountMixin = <T extends Constructor<LitElement>>(superclass
let account_name = null;
let option = <SelectOption>{value: id, label: id + " ..."};
this.account_options.push(option);
if(new_value && (account_name = this.egw().link_title('api-accounts', id, false)))
if(this.value && (account_name = this.egw().link_title('api-accounts', id, false)))
{
option.label = account_name;
}

View File

@ -1520,17 +1520,21 @@ class filemanager_ui
}
else
{
$sel_options['owner']=$sel_options['group']=$sel_options['other'] = array(
$sel_options['owner'] = $sel_options['group'] = $sel_options['other'] = array(
6 => lang('Read & write access'),
4 => lang('Read access only'),
0 => lang('No access'),
);
}
// Use 'root' for ID 0
$sel_options['gid'] = $sel_options['uid'] = array(
['value' => '0', 'label' => lang("root")]
);
// Times are in server time, convert to user timezone
foreach(['mtime','ctime'] as $date_field)
foreach(['mtime', 'ctime'] as $date_field)
{
$time = new Api\DateTime($content[$date_field],Api\DateTime::$server_timezone);
$time = new Api\DateTime($content[$date_field], Api\DateTime::$server_timezone);
$time->setUser();
$content[$date_field] = $time->format('ts');
}

View File

@ -88,20 +88,22 @@
<row>
<groupbox>
<caption label="Owner"/>
<grid>
<columns>
<column width="80"/>
<column/>
</columns>
<rows>
<row>
<et2-description value="User"></et2-description>
<et2-select-account label="@ro_uid_root" id="uid" emptyLabel="root" accountType="accounts"></et2-select-account>
</row>
<row>
<et2-description value="Group"></et2-description>
<et2-select-account label="@ro_gid_root" id="gid" emptyLabel="root" accountType="groups"></et2-select-account>
</row>
<grid width="100%">
<columns>
<column width="80"/>
<column/>
</columns>
<rows>
<row>
<et2-description value="User"></et2-description>
<et2-select-account label="@ro_uid_root" id="uid"
accountType="accounts"></et2-select-account>
</row>
<row>
<et2-description value="Group"></et2-description>
<et2-select-account label="@ro_gid_root" id="gid"
accountType="groups"></et2-select-account>
</row>
</rows>
</grid>
</groupbox>