зеркало из https://github.com/mozilla/pjs.git
139 строки
6.1 KiB
Plaintext
139 строки
6.1 KiB
Plaintext
TemplateToolkit
|
|
1
|
|
|
|
[% INCLUDE template.header
|
|
title = 'User Preferences' -%]
|
|
[%- manyUsers = userIDs.size >= 2 %]
|
|
[%- IF manyUsers %]
|
|
[%- indent = ' ' -%]
|
|
[%- ELSE -%]
|
|
[%- indent = '' -%]
|
|
[%- END %]
|
|
|
|
<form action="./" method="post" enctype="multipart/form-data">
|
|
[%- "\n <ol>" IF manyUsers -%]
|
|
[%- FOREACH userID = userIDs -%]
|
|
[%- user = userData.$userID -%]
|
|
|
|
[%- "\n <li>" IF manyUsers -%]
|
|
|
|
[%- FILTER indent(indent) -%]
|
|
|
|
[%- IF session.right.${'userPrefs.editOthers.adminMessage'} or session.right.${'userPrefs.editOthers.mode'} -%]
|
|
<h2> Administration </h2>
|
|
[%- IF session.right.${'userPrefs.editOthers.adminMessage'} %]
|
|
<p> Admin Message: <input type="text" name="userPrefs.[% userID | html %].adminMessage" value="[% user.adminMessage | html %]"> </p>
|
|
[%- END -%]
|
|
[%- IF session.right.${'userPrefs.editOthers.mode'} %]
|
|
<p> Mode:
|
|
<select name="userPrefs.[% userID | html %].mode">
|
|
<option value="0"[% ' selected="selected"' IF user.mode == 0 %]>Normal</option>
|
|
<option value="1"[% ' selected="selected"' IF user.mode == 1 %]>Disabled</option>
|
|
</select>
|
|
</p>
|
|
[%- END -%]
|
|
[%- END -%]
|
|
|
|
[%- IF (session.right.${'userPrefs.editOthers.contactMethods'} or user.editingUserIsTargetUser) and metaData.contact.keys.size %]
|
|
<h2> Contact Methods </h2>
|
|
[%- FOREACH field = metaData.contact.keys %]
|
|
<p>
|
|
<label>
|
|
[% field WRAPPER dictionary section='contact' %]:
|
|
[% metaData.contact.$field.type WRAPPER dictionary section='fields.control' name="userPrefs.${userID}.fields.contact.${field}" value=user.fields.contact.$field %]
|
|
</label>
|
|
</p>
|
|
[%- END -%]
|
|
[%- END -%]
|
|
|
|
[%- IF (session.right.${'userPrefs.editOthers.personalDetails'} or user.editingUserIsTargetUser) and metaData.personal.keys.size %]
|
|
<h2> Personal Details </h2>
|
|
[%- FOREACH field = metaData.personal.keys %]
|
|
<p>
|
|
<label>
|
|
[% field WRAPPER dictionary section='personal' %]:
|
|
[% metaData.personal.$field.type WRAPPER dictionary section='fields.control' name="userPrefs.${userID}.fields.personal.${field}" value=user.fields.personal.$field %]
|
|
</label>
|
|
</p>
|
|
[%- END -%]
|
|
[%- END -%]
|
|
|
|
[%- IF session.right.${'userPrefs.editOthers.settings'} -%]
|
|
[%- importantSettings = metaData.settings.keys -%]
|
|
[%- ELSE -%]
|
|
[%-# hide the less interesting settings #-%]
|
|
[%- importantSettings = [] -%]
|
|
[%- FOREACH field = metaData.settings.keys -%]
|
|
[%- SWITCH field -%]
|
|
[%- CASE [ 'cosesEditor.index.variantsSortColumn'
|
|
'cosesEditor.index.stringsSortColumn' ] -%]
|
|
[%- CASE DEFAULT %]
|
|
[%- importantSettings.push(field) -%]
|
|
[%- END -%]
|
|
[%- END -%]
|
|
[%- END -%]
|
|
|
|
[%- IF (session.right.${'userPrefs.editOthers.settings'} or user.editingUserIsTargetUser) and importantSettings.size %]
|
|
<h2> Settings </h2>
|
|
[%- FOREACH field = importantSettings %]
|
|
<p>
|
|
<label>
|
|
[% field WRAPPER dictionary section='settings' %]:
|
|
[% metaData.settings.$field.type WRAPPER dictionary section='fields.control' name="userPrefs.${userID}.fields.settings.${field}" value=user.fields.settings.$field %]
|
|
</label>
|
|
</p>
|
|
[%- END -%]
|
|
[%- END -%]
|
|
|
|
[%- IF user.groups.values.size %]
|
|
<h2> Groups </h2>
|
|
[%- FOREACH group = user.groups.keys %]
|
|
<p> [% groupNames.$group WRAPPER dictionary section='groups' %]:
|
|
[%- IF session.right.${'userPrefs.editOthers.groups'} or session.groupsByID.$group.level >= 3 %]
|
|
<!-- editing user is an owner of this group and can do anything -->
|
|
<label><input type="radio" name="[% "userPrefs.${userID}.groups.${group}" %]" value="0"[% ' checked="checked"' IF user.groups.$group == 0 %]> None</label>
|
|
<label><input type="radio" name="[% "userPrefs.${userID}.groups.${group}" %]" value="1"[% ' checked="checked"' IF user.groups.$group == 1 %]> Member</label>
|
|
<label><input type="radio" name="[% "userPrefs.${userID}.groups.${group}" %]" value="2"[% ' checked="checked"' IF user.groups.$group == 2 %]> Administrator</label>
|
|
<label><input type="radio" name="[% "userPrefs.${userID}.groups.${group}" %]" value="3"[% ' checked="checked"' IF user.groups.$group == 3 %]> Owner</label>
|
|
[%- ELSIF session.groupsByID.$group.level == 2 and session.groupsByID.$group.level > user.groups.$group %]
|
|
<!-- editing user is an administrator of this group, and the user in question is not -->
|
|
<label><input type="radio" name="[% "userPrefs.${userID}.groups.${group}" %]" value="0"[% ' checked="checked"' IF user.groups.$group == 0 %]> None</label>
|
|
<label><input type="radio" name="[% "userPrefs.${userID}.groups.${group}" %]" value="1"[% ' checked="checked"' IF user.groups.$group == 1 %]> Member</label>
|
|
[%- ELSE %]
|
|
<!-- editing user may not change the level of the user in question -->
|
|
[% IF user.groups.$group == 0 %]<label><input type="radio" checked="checked"> None</label>
|
|
[% ELSIF user.groups.$group == 1 %]<label><input type="radio" checked="checked"> Member</label>
|
|
[% ELSIF user.groups.$group == 2 %]<label><input type="radio" checked="checked"> Administrator</label>
|
|
[% ELSIF user.groups.$group == 3 %]<label><input type="radio" checked="checked"> Owner</label>[% END %]
|
|
[%- END %]
|
|
</p>
|
|
[%- END -%]
|
|
[%- END -%]
|
|
|
|
[%- IF session.right.${'userPrefs.editOthers.passwords'} or user.editingUserIsTargetUser %]
|
|
<h2> Password </h2>
|
|
[%- IF user.editingUserIsTargetUser %]
|
|
<p> Old password: <input type="password" name="userPrefs.[% userID | html %].password.old" value=""> </p>
|
|
<p> New password: <input type="password" name="userPrefs.[% userID | html %].password" value=""> </p>
|
|
<p> New password again: <input type="password" name="userPrefs.[% userID | html %].password.confirmation" value=""> </p>
|
|
[%- ELSE %]
|
|
<p> Change password: <input type="password" name="userPrefs.[% userID | html %].password" value=""> </p>
|
|
[%- END -%]
|
|
[%- END -%]
|
|
|
|
[%- END -%]
|
|
[%- "\n </li>" IF manyUsers -%]
|
|
[%- END -%]
|
|
[%- "\n </ol>" IF manyUsers -%]
|
|
|
|
<p>
|
|
[%- FOREACH userID = userIDs %]
|
|
<input type="hidden" name="userPrefs.userID" value="[% userID %]">
|
|
[%- END %]
|
|
<input type="hidden" name="command" value="userPrefsSet">
|
|
<input type="submit" value="Submit">
|
|
</p>
|
|
</form>
|
|
|
|
[% INCLUDE template.footer %]
|