Added templates considering Surveys.
Patch by: Daniel Diniz, James Levy
Reviewed by: Lennard de Rijk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/edit.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,204 @@
+{% extends "soc/models/edit.html" %}
+{% comment %}
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+
+{% load forms_helpers %}
+
+{% block scripts %}
+{{ block.super }}
+<script type="text/javascript" src="/soc/content/js/default-text.js"></script>
+<script type="text/javascript" src="/jquery/jquery-ui.draggable.js"></script>
+<script type="text/javascript" src="/jquery/jquery-ui.sortable.js"></script>
+<script type="text/javascript" src="/jquery/jquery-ui.dialog.js"></script>
+<script type="text/javascript" src="/jquery/jquery-growfield.js"></script>
+<script type="text/javascript" src="/jquery/jquery-editable-1.3.3.js"></script>
+<script type="text/javascript" src="/soc/content/js/edit_survey.js"></script>
+
+{% endblock %}
+
+
+{# cannot add an id for the main form with inheritance #}
+{% block body %}
+<p> {# TODO: check if can be changed to div #}
+<p>
+{% block instructions %}
+Please use this form to edit the {{ entity_type }}.
+{% endblock %}
+</p>
+
+{% if error_message %}
+ <div class="error">{{ error_message|safe }}</div>
+{% endif %}
+
+<form id="EditForm" method="POST">
+
+ <table>
+ {% block form_table %}
+ {% as_table form %}
+ {% endblock %}
+ </table>
+
+ <span class="formfieldlabel">Survey content:</span>
+
+<div style="width:100%; float:left;">
+ <div class="survey_admin" id="survey_widget">
+ <table>
+ {% block survey_content %}
+ {% if survey_form %}
+ {% as_twoline_table survey_form %}
+ {% else %}
+ <tbody></tbody>
+ {% endif %}
+ {% endblock %}
+ </table>
+
+ <div id="survey_options">
+ {% for type_id, type_info in question_types.items %}
+ <button id="{{ type_id }}" class="AddQuestion" onClick="return false;">
+ Add {{ type_info|first }} Question
+ </button>
+
+ <script type="text/javascript">
+ $(document).ready( function() {
+ var tooltip = ("<div class='tooltip'><div class='tooltip-body'>" +
+ "<img src='/soc/content/images/purrInfo.png' alt='' /><h3>Info</h3>" +
+ "<p>Add a {{ type_info|first }} question:<br/> {{ type_info|last }}" +
+ "</p></div><div class='tooltip-bottom'></div></div>");
+ var tooltip_object=null;
+ $('#{{ type_id }}').hover(function() {
+ if (tooltip_object==null) {
+ tooltip_object = $(tooltip).purr({usingTransparentPNG: true});
+ }
+ },
+ function() {
+ if (tooltip_object!==null) {
+ tooltip_object.remove();
+ tooltip_object=null;
+ }
+ });
+ });
+ </script>
+
+ {% endfor %}
+ </div>
+ </div> {# end survey_widget #}
+ </div>
+
+ <table>
+ <tr>
+ <td colspan="4"> </td>
+ </tr>
+ <tr>
+ {% block submit_buttons %}
+ {% block save_button %}
+ {% if entity %}
+ <td>
+ <input style="font-weight: bold" type="submit" value="Save Changes"/>
+ </td>
+ {% else %}
+ <td>
+ <input style="font-weight: bold" type="submit" value="Submit"/></span>
+ </td>
+ {% endif %}
+ {% endblock %}
+ <td>
+ {% if edit_cancel_redirect %}
+ <input type="button" onclick="location.href='{{ edit_cancel_redirect }}'" value="Cancel"/>
+ {% else %}
+ <input type="button" value="Back to Previous Page" onClick="javascript: history.go(-1)">
+ {% endif %}
+ </td>
+ {% if entity %}
+ {% block delete_button %}
+ <td>
+ <input type="button" class="button" value="Delete"
+ onclick="if(confirm('Are you sure you want to delete this {{ entity_type }}?')) {
+ location.href='/{{ entity_type_url|lower }}/delete/{{ entity_suffix }}';}"/>
+
+ </td>
+ {% endblock %}
+ {% if export_link %}
+ <td>
+ <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/export/{{ entity_suffix }}'" value="Export"/>
+ </td>
+ {% endif %}
+ {% ifequal entity.taking_access "mentor evaluation" %}
+ <td>
+ <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"/>
+ </td>
+ {% endifequal %}
+
+ {% endif %}
+ {% endblock %}
+ </tr>
+ </table>
+ <input type='hidden' id='delete_item_field' />
+ <input type='hidden' id='new_item_field_ul_id' />
+ <input type='hidden' id='new_question_button_id' />
+
+
+ <div id="delete_item_dialog" title="Delete this field?" style="margin: 10px -7px; text-align: center;">
+ <p>
+ <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;">
+ </span>
+ <div style="width:200px;"> This item will be permanently deleted and cannot be recovered. Are you sure?</div>
+ </p>
+ </div>
+
+</form>
+
+<div id="new_item_dialog" title="Name new option">
+ <form>
+ <fieldset style="width: 50px;">
+
+ <label for="new_item_name">Name</label>
+ <input type="text" name="new_item_name" id="new_item_name"
+ class="text ui-widget-content ui-corner-all" value="" />
+
+ </fieldset>
+ </form>
+</div>
+
+<div id="new_question_dialog" title="Name new question">
+ <form>
+ <fieldset style="width: 50px;">
+
+ <label for="new_question_name">ID (link_id-like)</label>
+ <input type="text" name="new_question_name" id="new_question_name"
+ class="text ui-widget-content ui-corner-all" value="" />
+
+ <label for="new_question_content">Title</label>
+ <input type="text" name="new_question_content" id="new_question_content"
+ class="text ui-widget-content ui-corner-all" value="" />
+
+ <div id='question_options_div'>
+ <label for="new_question_options">Options</label>
+ <textarea name="new_question_options"
+ id="new_question_options" class="text ui-widget-content ui-corner-all"
+ rows="7" cols="20"></textarea>
+ </div>
+
+ </fieldset>
+ </form>
+</div>
+
+</p>
+
+ {% if not new_survey %}
+ {% if survey_records %}
+ {{ survey_records|safe }}
+ {% endif %}
+ {% endif %}
+
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/list/heading.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,9 @@
+<tr align="left">
+ <th>Path</th>
+ <th>Title</th>
+ <th>Link ID</th>
+ <th>Featured</th>
+ <th>Created By</th>
+ <th>Created On</th>
+ <th>Modified</th>
+</tr>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/list/results_heading.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,16 @@
+<tr align="left">
+ {% for property in properties %}
+ <th>{{ property }}</th>
+ {% endfor %}
+ <th>Taken By</th>
+
+ <th>Created On</th>
+
+ <th>Last Modified</th>
+
+ <th>Answer</th>
+
+ {% if grades %}
+ <th>Grade</th>
+ {% endif %}
+</tr>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/list/results_row.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,51 @@
+<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
+onclick="return false; document.location.href='{{ list.redirect }}'" name="name">
+
+ {% for value in list.item.getValues %}
+ <td>
+ <div class="{{ value }}">
+ {{ value }}
+ </div>
+ </td>
+ {% endfor %}
+
+ <td>
+ <div class="author">
+ {{ list.item.user.link_id }}
+ </div>
+ </td>
+
+ <td>
+ <div class="created">
+ {{ list.item.created|date:"Y-m-d H:i" }}
+ </div>
+ </td>
+
+ <td>
+ <div class="modified">
+ {{ list.item.modified|date:"Y-m-d H:i" }}
+ </div>
+ </td>
+
+ <td>
+ <a class="fetch_answers" id="results_for_{{ list.item.user.link_id }}">View</a>
+ </td>
+
+ {% if grades %}
+ <td>
+ <div class="grade">
+ <select id="id_survey__{{ list.item.user.link_id }}__selection__grade"
+ name="id_survey__{{ list.item.user.link_id }}__selection__grade">
+
+ <option value='' {% ifequal list.item.grade '' %} selected="selected" {% endifequal %} >
+ None</option>
+ <option value='pass' {% ifequal list.item.grade 'Pass' %} selected="selected" {% endifequal %} >
+ Pass</option>
+ <option value='fail' {% ifequal list.item.grade 'Fail' %} selected="selected" {% endifequal %} >
+ Fail</option>
+
+ </select>
+ </div>
+ </td>
+ {% endif %}
+</tr>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/list/row.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,15 @@
+<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
+ onclick="document.location.href='{{ list.redirect }}'" name="name">
+ <td align="right">
+ <div class="title">
+ <a class="noul"
+ href="{{ list.redirect }}">{{ list.item.scope_path}}/{{ list.item.link_id }}</a>
+ </div>
+ </td>
+ <td><div class="title">{{ list.item.title }}</div></td>
+ <td><div class="link_id">{{ list.item.link_id }}</div></td>
+ <td><div class="featured">{{ list.item.is_featured }}</div></td>
+ <td><div class="author">{{ list.item.author.link_id }}</div></td>
+ <td><div class="created">{{ list.item.created }}</div></td>
+ <td><div class="modified">{{ list.item.modified }}</div></td>
+</tr>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/messages/new_survey.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,21 @@
+{% extends "soc/notification/messages/base.html" %}
+{% comment %}
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+{% block content %}
+There is a new Survey available for your program.<br />
+Please visit <a href="{{ survey_url }}">{{ survey_title}}</a>
+to take the survey.<br />
+
+Keep in mind that taking a survey might be mandatory!
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/public.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,88 @@
+{% extends "soc/base.html" %}
+{% comment %}
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+
+{% block scripts %}
+{{ block.super }}
+
+<script type="text/javascript" src="/soc/content/js/take_survey.js"></script>
+<script type="text/javascript" src="/soc/content/js/default-text.js"></script>
+<script type="text/javascript" src="/jquery/jquery-growfield.js"></script>
+{% endblock %}
+
+{% block page_title %}
+{{ entity.title }}
+{% endblock %}
+
+{% block header_title %}
+{{ entity.title }}
+{% endblock %}
+
+{% block body %}
+<div id="created">Last modified on {{ entity.modified }} by {{ entity.modified_by.name }}</div>
+
+{% if survey_form %}
+
+ {% load forms_helpers %}
+
+ {% if not read_only %}
+ <form method="post">
+ {% endif %}
+
+ {% if read_only %}
+ <form method="get" onsubmit="javascript:return false">
+ {% endif %}
+
+ {{ help_text }}
+
+<div style="width:100%; float:left;">
+ <div class="{{ status }}" id="survey_widget">
+
+ <table>
+
+ {# Project Selected for this Survey #}
+ {% if project %}
+ <div id="project_link" style="font-size:.8em; margin:3px; display:none;">
+ view project:
+ <a target="_blank" href="/student_project/show/{{ project.key.name }}" >
+ {{ project.title }}
+ </a>
+ </div>
+ {% endif %}
+
+ {% block form_table %}
+ {% as_twoline_table survey_form %}
+ {% endblock %}
+
+ </table>
+ </div> {# end survey_widget #}
+ </div>
+
+<br/><br/>
+ <table>
+ <tbody>
+ <tr>
+ <td>
+ {% if not read_only %}
+ <input type="submit" value="Submit" style="font-weight: bold;"/>
+ {% endif %}
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ </form>
+{% endif %}
+
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/results.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,21 @@
+{% if grades %}
+ <form id='GradesForm' method='post' action="{{ grade_action }}" >
+{% endif %}
+{% if list_msg %}
+ {{ list_msg|safe }}
+{% endif %}
+
+{% if list.empty %}
+ {{ no_lists_msg }}
+{% endif %}
+
+{% for list_number in list.lists %}
+ <p>
+ {% include list.nextList %}
+ </p>
+{% endfor %}
+
+{% if grades %}
+ <input type='submit' value='Update Grades'/>
+ </form>
+{% endif %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/results_page.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,109 @@
+{% extends "soc/models/edit.html" %}
+{% comment %}
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+
+{% load forms_helpers %}
+
+{% block scripts %}
+{{ block.super }}
+<script type="text/javascript" src="/soc/content/js/default-text.js"></script>
+<script type="text/javascript" src="/jquery/jquery-ui.draggable.js"></script>
+<script type="text/javascript" src="/jquery/jquery-ui.sortable.js"></script>
+<script type="text/javascript" src="/jquery/jquery-ui.dialog.js"></script>
+<script type="text/javascript" src="/jquery/jquery-growfield.js"></script>
+<script type="text/javascript" src="/jquery/jquery-editable-1.3.3.js"></script>
+<script type="text/javascript" src="/soc/content/js/edit_survey.js"></script>
+
+{% endblock %}
+
+{% block body %}
+
+{% if not new_survey %}
+ {% if results %}
+ <table> <tr>
+ {% for user_role in results %}
+ <td>
+ <div class="list">
+ <table style="width:100%">
+
+ <th>Taken By</th>
+
+ <th>Survey</th>
+
+ <th>Last Modified</th>
+
+ <th>Answer</th>
+
+ {% if grades %}
+ <th>Grade</th>
+ {% endif %}
+</tr>
+ {% for record in user_role %}
+<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'"
+onclick="return false; document.location.href='{{ record.redirect }}'" name="name">
+
+
+ <td>
+ <div class="author">
+ {{ record.user.name }} ({{ record.user.link_id }})
+ </div>
+ </td>
+
+ <td>
+ <div class="title">
+ {{ record.survey.title }}
+ </div>
+ </td>
+
+
+ <td>
+ <div class="modified">
+ {{ record.modified|date:"Y-m-d H:i" }}
+ </div>
+ </td>
+
+ <td>
+ <a class="fetch_answers" id="results_for_{{ record.user.link_id }}">View</a>
+ </td>
+
+ {% if grades %}
+ <td>
+ <div class="grade">
+ <select id="id_survey__{{ record.user.link_id }}__selection__grade"
+ name="id_survey__{{ record.user.link_id }}__selection__grade">
+
+ <option value='' {% ifequal record.grade '' %} selected="selected" {% endifequal %} >
+ None</option>
+ <option value='pass' {% ifequal record.grade 'Pass' %} selected="selected" {% endifequal %} >
+ Pass</option>
+ <option value='fail' {% ifequal record.grade 'Fail' %} selected="selected" {% endifequal %} >
+ Fail</option>
+
+ </select>
+</div>
+</td>
+{% endif %}
+</tr>
+
+ {% endfor %}
+ </table>
+ </div>
+ </td>
+ {% endfor %}
+</tr>
+</table>
+ {% endif %}
+{% endif %}
+
+{% endblock %}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/survey/universal_choice_editor.html Fri Jun 26 21:58:12 2009 +0200
@@ -0,0 +1,43 @@
+<fieldset>
+
+{# Question type drop-down #}
+ <label for="type_for_{{ name }}">Question Type</label>
+ <select id="type_for_{{ name }}" name="type_for_{{ name }}">
+ <option value="selection" {{ is_selection|safe }}>selection</option>
+ <option value="pick_multi" {{ is_pick_multi }}>pick_multi</option>
+ <option value="pick_quant" {{ is_pick_quant }}>pick_quant</option>
+ </select>
+
+{# Render widget drop-down #}
+ <label for="render_for_{{ name }}">Render as</label>
+ <select id="render_for_{{ name }}" name="render_for_{{ name }}">
+ <option value="select" {{ is_select|safe }}>select</option>
+ <option value="checkboxes" {{ is_checkboxes|safe }}>checkboxes</option>
+ <option value="radio_buttons" {{ is_radio_buttons }}>radio_buttons</option>
+ </select>
+
+{# Each choice field has a hidden input where its options' order is stored. #}
+ <input type="hidden" id="order_for_{{ name }}" name="order_for_{{ name }}"
+ value=""/>
+
+{# Open the ordered list. #}
+ <ol id="{{ name }}" class="sortable">
+{# Template for each option #}
+ {% for i, option_value in choices.items %}
+ <li id="id-li-{{ name }}_{{ i }}" class="ui-state-default sortable_li">
+ <span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
+ <span id="id_{{ name }}_{{ i }}" class="editable_option" name="id_{{ name }}_{{ i }}__field">
+ {{ option_value }}
+ </span>
+ <input type="hidden" id="id_{{ name }}_{{ i }}__field"
+ name="id_{{ name }}_{{ i }}__field" value="{{ option_value }}"/>
+ </li>
+ {% endfor %}
+
+{# Close the ordered list and add the 'add option' button. #}
+ </ol>
+ <button name="create-option-button" id="create-option-button__{{ name }}"
+ class="ui-button ui-state-default ui-corner-all" value="{{ name }}"
+ onClick="return false;">Create new option</button>
+
+</fieldset>