39 lines
1.6 KiB
Cheetah
39 lines
1.6 KiB
Cheetah
[%# Autocompleted editbox for selecting users
|
|
# License: Dual-license GPL 3.0+ or MPL 1.1+
|
|
# Author: Vitaliy Filippov <vitalif@mail.ru>
|
|
#%]
|
|
|
|
[%# INTERFACE:
|
|
# name: mandatory; field name
|
|
# id: optional; field id
|
|
# value: optional; default field value/selection
|
|
# onchange: optional; onchange attribute value (FIXME may not work)
|
|
# disabled: optional; if true, the field is disabled
|
|
# accesskey: optional; accesskey attribute value
|
|
# size: optional; size attribute value
|
|
# multiple: optional; select several users at once (delimiter is ',')
|
|
# custom_userlist: optional, specify a limited list of users to use
|
|
# tabindex: optional, HTML tabindex
|
|
#%]
|
|
|
|
[% id = id || name %]
|
|
<input
|
|
name="[% name FILTER html %]"
|
|
id="[% id FILTER html %]"
|
|
value="[% value FILTER html %]"
|
|
[% IF tabindex %] tabindex="[% tabindex FILTER html %]" [% END %]
|
|
[% IF onchange %] onchange="[% onchange FILTER html %]" [% END %]
|
|
[% IF disabled %] disabled="[% disabled FILTER html %]" [% END %]
|
|
[% IF accesskey %] accesskey="[% accesskey FILTER html %]" [% END %]
|
|
[% IF size %] size="[% size FILTER html %]" [% END %]
|
|
/>
|
|
<script language="JavaScript">
|
|
addListener(window, 'load', function() {
|
|
[%-# FIXME: remove hardcoded i18n message, also from js/field.js::userAutocomplete() %]
|
|
var emptyOptions = [% custom_userlist ? json(custom_userlist) : "null" %];
|
|
new SimpleAutocomplete("[% id | js %]",
|
|
function(h) { userAutocomplete(h, emptyOptions, [% Param('usemenuforusers') ? 1 : 0 %]); },
|
|
{ emptyText: 'No users found'[% ', multipleDelimiter: ","' IF multiple %] });
|
|
});
|
|
</script>
|