|
1 {% extends "soc/models/edit.html" %} |
|
2 {% comment %} |
|
3 Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 you may not use this file except in compliance with the License. |
|
5 You may obtain a copy of the License at |
|
6 |
|
7 http://www.apache.org/licenses/LICENSE-2.0 |
|
8 |
|
9 Unless required by applicable law or agreed to in writing, software |
|
10 distributed under the License is distributed on an "AS IS" BASIS, |
|
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 See the License for the specific language governing permissions and |
|
13 limitations under the License. |
|
14 {% endcomment %} |
|
15 |
|
16 {% load forms_helpers %} |
|
17 |
|
18 {% block scripts %} |
|
19 {{ block.super }} |
|
20 <script type="text/javascript" src="/soc/content/js/default-text.js"></script> |
|
21 <script type="text/javascript" src="/jquery/jquery-ui.draggable.js"></script> |
|
22 <script type="text/javascript" src="/jquery/jquery-ui.sortable.js"></script> |
|
23 <script type="text/javascript" src="/jquery/jquery-ui.dialog.js"></script> |
|
24 <script type="text/javascript" src="/jquery/jquery-growfield.js"></script> |
|
25 <script type="text/javascript" src="/jquery/jquery-editable-1.3.3.js"></script> |
|
26 <script type="text/javascript" src="/soc/content/js/edit_survey.js"></script> |
|
27 |
|
28 {% endblock %} |
|
29 |
|
30 |
|
31 {# cannot add an id for the main form with inheritance #} |
|
32 {% block body %} |
|
33 <p> {# TODO: check if can be changed to div #} |
|
34 <p> |
|
35 {% block instructions %} |
|
36 Please use this form to edit the {{ entity_type }}. |
|
37 {% endblock %} |
|
38 </p> |
|
39 |
|
40 {% if error_message %} |
|
41 <div class="error">{{ error_message|safe }}</div> |
|
42 {% endif %} |
|
43 |
|
44 <form id="EditForm" method="POST"> |
|
45 |
|
46 <table> |
|
47 {% block form_table %} |
|
48 {% as_table form %} |
|
49 {% endblock %} |
|
50 </table> |
|
51 |
|
52 <span class="formfieldlabel">Survey content:</span> |
|
53 |
|
54 <div style="width:100%; float:left;"> |
|
55 <div class="survey_admin" id="survey_widget"> |
|
56 <table> |
|
57 {% block survey_content %} |
|
58 {% if survey_form %} |
|
59 {% as_twoline_table survey_form %} |
|
60 {% else %} |
|
61 <tbody></tbody> |
|
62 {% endif %} |
|
63 {% endblock %} |
|
64 </table> |
|
65 |
|
66 <div id="survey_options"> |
|
67 {% for type_id, type_info in question_types.items %} |
|
68 <button id="{{ type_id }}" class="AddQuestion" onClick="return false;"> |
|
69 Add {{ type_info|first }} Question |
|
70 </button> |
|
71 |
|
72 <script type="text/javascript"> |
|
73 $(document).ready( function() { |
|
74 var tooltip = ("<div class='tooltip'><div class='tooltip-body'>" + |
|
75 "<img src='/soc/content/images/purrInfo.png' alt='' /><h3>Info</h3>" + |
|
76 "<p>Add a {{ type_info|first }} question:<br/> {{ type_info|last }}" + |
|
77 "</p></div><div class='tooltip-bottom'></div></div>"); |
|
78 var tooltip_object=null; |
|
79 $('#{{ type_id }}').hover(function() { |
|
80 if (tooltip_object==null) { |
|
81 tooltip_object = $(tooltip).purr({usingTransparentPNG: true}); |
|
82 } |
|
83 }, |
|
84 function() { |
|
85 if (tooltip_object!==null) { |
|
86 tooltip_object.remove(); |
|
87 tooltip_object=null; |
|
88 } |
|
89 }); |
|
90 }); |
|
91 </script> |
|
92 |
|
93 {% endfor %} |
|
94 </div> |
|
95 </div> {# end survey_widget #} |
|
96 </div> |
|
97 |
|
98 <table> |
|
99 <tr> |
|
100 <td colspan="4"> </td> |
|
101 </tr> |
|
102 <tr> |
|
103 {% block submit_buttons %} |
|
104 {% block save_button %} |
|
105 {% if entity %} |
|
106 <td> |
|
107 <input style="font-weight: bold" type="submit" value="Save Changes"/> |
|
108 </td> |
|
109 {% else %} |
|
110 <td> |
|
111 <input style="font-weight: bold" type="submit" value="Submit"/></span> |
|
112 </td> |
|
113 {% endif %} |
|
114 {% endblock %} |
|
115 <td> |
|
116 {% if edit_cancel_redirect %} |
|
117 <input type="button" onclick="location.href='{{ edit_cancel_redirect }}'" value="Cancel"/> |
|
118 {% else %} |
|
119 <input type="button" value="Back to Previous Page" onClick="javascript: history.go(-1)"> |
|
120 {% endif %} |
|
121 </td> |
|
122 {% if entity %} |
|
123 {% block delete_button %} |
|
124 <td> |
|
125 <input type="button" class="button" value="Delete" |
|
126 onclick="if(confirm('Are you sure you want to delete this {{ entity_type }}?')) { |
|
127 location.href='/{{ entity_type_url|lower }}/delete/{{ entity_suffix }}';}"/> |
|
128 |
|
129 </td> |
|
130 {% endblock %} |
|
131 {% if export_link %} |
|
132 <td> |
|
133 <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/export/{{ entity_suffix }}'" value="Export"/> |
|
134 </td> |
|
135 {% endif %} |
|
136 {% ifequal entity.taking_access "mentor evaluation" %} |
|
137 <td> |
|
138 <input id="activate" {% if not passed_deadline %}class="disabled"{% endif %} onclick="if (!$(this).hasClass('disabled')) location.href='/{{ entity_type_url|lower }}/activate/{{ entity_suffix }}'" type="button" value="Activate Grades"/> |
|
139 </td> |
|
140 {% endifequal %} |
|
141 |
|
142 {% endif %} |
|
143 {% endblock %} |
|
144 </tr> |
|
145 </table> |
|
146 <input type='hidden' id='delete_item_field' /> |
|
147 <input type='hidden' id='new_item_field_ul_id' /> |
|
148 <input type='hidden' id='new_question_button_id' /> |
|
149 |
|
150 |
|
151 <div id="delete_item_dialog" title="Delete this field?" style="margin: 10px -7px; text-align: center;"> |
|
152 <p> |
|
153 <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"> |
|
154 </span> |
|
155 <div style="width:200px;"> This item will be permanently deleted and cannot be recovered. Are you sure?</div> |
|
156 </p> |
|
157 </div> |
|
158 |
|
159 </form> |
|
160 |
|
161 <div id="new_item_dialog" title="Name new option"> |
|
162 <form> |
|
163 <fieldset style="width: 50px;"> |
|
164 |
|
165 <label for="new_item_name">Name</label> |
|
166 <input type="text" name="new_item_name" id="new_item_name" |
|
167 class="text ui-widget-content ui-corner-all" value="" /> |
|
168 |
|
169 </fieldset> |
|
170 </form> |
|
171 </div> |
|
172 |
|
173 <div id="new_question_dialog" title="Name new question"> |
|
174 <form> |
|
175 <fieldset style="width: 50px;"> |
|
176 |
|
177 <label for="new_question_name">ID (link_id-like)</label> |
|
178 <input type="text" name="new_question_name" id="new_question_name" |
|
179 class="text ui-widget-content ui-corner-all" value="" /> |
|
180 |
|
181 <label for="new_question_content">Title</label> |
|
182 <input type="text" name="new_question_content" id="new_question_content" |
|
183 class="text ui-widget-content ui-corner-all" value="" /> |
|
184 |
|
185 <div id='question_options_div'> |
|
186 <label for="new_question_options">Options</label> |
|
187 <textarea name="new_question_options" |
|
188 id="new_question_options" class="text ui-widget-content ui-corner-all" |
|
189 rows="7" cols="20"></textarea> |
|
190 </div> |
|
191 |
|
192 </fieldset> |
|
193 </form> |
|
194 </div> |
|
195 |
|
196 </p> |
|
197 |
|
198 {% if not new_survey %} |
|
199 {% if survey_records %} |
|
200 {{ survey_records|safe }} |
|
201 {% endif %} |
|
202 {% endif %} |
|
203 |
|
204 {% endblock %} |