blob: 4d62ab2adbeb372f39272c134881038245b98d55 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001[# Diplay a widget to choose group visibility level, or read-only text showing
2 the visibility level. Read-only text is used when the user does not have
3 permission to edit, or if there is only one available choice.
4]
5
6[define vis_menu_was_shown]False[end]
7
8[if-any read_only][else]
9 <select name="visibility" id="visibility" [if-any import_group]disabled="disabled"[end]>
10 <option value="" disabled="disabled" [if-any initial_visibility][else]selected="selected"[end]>
11 Select a visibility level...
12 </option>
13 [for visibility_levels]
14 <option value="[visibility_levels.key]"
15 [if-any initial_visibility]
16 [is initial_visibility.key visibility_levels.key]selected="selected"[end]
17 [end]>
18 [visibility_levels.name]
19 </option>
20 [end]
21 </select>
22 [define vis_menu_was_shown]True[end]
23
24 <br><br>
25 Friend projects: <br>
26 <input size="60" type="text" id="friendprojects" name="friendprojects" value="[initial_friendprojects]">
27 <div class="fielderror">
28 <span id="friendprojectsfeedback"></span>
29 [if-any errors.friendprojects][errors.friendprojects][end]
30 </div>
31
32 <br><br>
33 <input type="checkbox" name="import_group" id="import_group"
34 [if-any import_group]checked="checked"[end]
35 [if-any groupadmin]disabled="disabled"[end] >
36 <label for="import_group">Import from external group</label>
37
38 <div class="fielderror">
39 <span id="groupimportfeedback"></span>
40 [if-any errors.groupimport][errors.groupimport][end]
41 </div>
42
43 <br>
44 &nbsp;&nbsp;External group type:
45 <select name="group_type" id="group_type"
46 [if-any import_group][else]disabled="disabled"[end]
47 [if-any groupadmin]disabled="disabled"[end] >
48 <option value="" disabled="disabled" [if-any initial_group_type][else]selected="selected"[end]>
49 Select a group type...
50 </option>
51 [for group_types]
52 <option value="[group_types.key]"
53 [if-any initial_group_type]
54 [is initial_group_type.key group_types.key]selected="selected"[end]
55 [end]>
56 [group_types.name]
57 </option>
58 [end]
59 </select>
60 <br><br>
61
62 <script type="text/javascript" nonce="[nonce]">
63runOnLoad(function() {
64 cur_vis_value = $("visibility").value;
65
66 function _updateSettings() {
67 if ($("import_group").checked) {
68 $("group_type").disabled = false;
69 cur_vis_value = $("visibility").value;
70 $("visibility").value = 0;
71 $("visibility").disabled = true;
72 $("friendprojects").disabled = true;
73 } else {
74 $("group_type").disabled = true;
75 $("visibility").value = cur_vis_value;
76 $("visibility").disabled = false;
77 $("friendprojects").disabled = false;
78 }
79 }
80
81 $("import_group").addEventListener("click", _updateSettings);
82});
83 </script>
84[end]
85
86[is vis_menu_was_shown "False"]
87 [initial_visibility.name]
88 <input type="hidden" name="visibility" value="[initial_visibility.key]">
89[end]
90
91<div class="formerror">
92 [if-any errors.access]
93 <div class="emphasis">[errors.access]</div>
94 [end]
95</div>