app/soc/templates/soc/student_proposal/review.html
changeset 2051 cecbef1289a5
parent 2028 df97cade97ac
child 2085 2f04b8ec3b96
equal deleted inserted replaced
2050:b3b235acdc6e 2051:cecbef1289a5
    59  </table>
    59  </table>
    60 </p>
    60 </p>
    61 
    61 
    62 <hr />
    62 <hr />
    63 <form method="POST">
    63 <form method="POST">
    64   <tr>
    64 <b>Score and Review</b>
    65   <td><b>Score and Review</b></td>
    65 
    66   </tr>
    66 <div class="box" style="border: 1px solid blue;">
    67   <table>
    67   <table id="commentcommon">
    68     {% block form_table %}
    68     <!-- By default this is not displayed, so that all options work on non-javascript browsers -->
    69       {% as_table form %}
    69     <tr style="display: none;">
    70     {% endblock %}
    70       <td class="formfieldlabel">
       
    71         Comment Type:
       
    72       </td>
       
    73       <td class="formfieldvalue" colspan=3>
       
    74         <select id="commenttypeselector" onchange="commentType();">
       
    75           <option value="Public">Public Comment</option>
       
    76           <option value="Private">Private Comment</option>
       
    77          {% if is_org_admin %}
       
    78           <option value="Admin">Admin Comment</option>
       
    79          {% endif %} 
       
    80         </select>
       
    81       </td>
       
    82     </tr>
       
    83     <tbody id="commentpublic">
       
    84       {% block comment_public_form_table %}
       
    85         {% as_table comment_public %}
       
    86       {% endblock %}
       
    87     </tbody>
       
    88     <tbody id="commentprivate">
       
    89       {% block comment_private_form_table %}
       
    90         {% as_table comment_private %}
       
    91       {% endblock %}
       
    92     </tbody>
       
    93     <tbody id="commentadmin">
       
    94       {% block comment_admin_form_table %}
       
    95         {% as_table comment_admin %}
       
    96       {% endblock %}
       
    97     </tbody>
    71   </table>
    98   </table>
       
    99 </div>
    72  <table>
   100  <table>
    73   <tr>
   101   <tr>
    74    <td colspan="4">&nbsp;</td>
   102    <td colspan="4">&nbsp;</td>
    75   </tr>
   103   </tr>
    76   <tr>
   104   <tr>
   115 {% for review in private_reviews %}
   143 {% for review in private_reviews %}
   116   {% as_student_proposal_review review student %}
   144   {% as_student_proposal_review review student %}
   117 {% endfor %}
   145 {% endfor %}
   118 <hr />
   146 <hr />
   119 
   147 
       
   148 {% comment %}
       
   149   TODO(pawel.solyga): Put this javascript into separate file
       
   150 {% endcomment %}
       
   151 <script type="text/javascript"/>
       
   152 function commentType() {
       
   153   var commentTypeSelector = document.getElementById("commenttypeselector");
       
   154   var type = commentTypeSelector[commentTypeSelector.options.selectedIndex].value;
       
   155 
       
   156   var commentPublic = document.getElementById("commentpublic");
       
   157   var commentPrivate = document.getElementById("commentprivate");
       
   158   var commentAdmin = document.getElementById("commentadmin");
       
   159 
       
   160   var publicCheckbox = document.getElementById("id_public");
       
   161 
       
   162   switch (type) {
       
   163     case "Public":
       
   164       commentPublic.style.display = "";
       
   165       commentPrivate.style.display = "none";
       
   166       commentAdmin.style.display = "none";
       
   167       publicCheckbox.value = true;
       
   168       break;
       
   169     case "Private":
       
   170       commentPublic.style.display = "";
       
   171       commentPrivate.style.display = "";
       
   172       commentAdmin.style.display = "none";
       
   173       publicCheckbox.value = false;
       
   174       break;
       
   175     case "Admin":
       
   176       commentPublic.style.display = "";
       
   177       commentPrivate.style.display = "";
       
   178       commentAdmin.style.display = "";
       
   179       publicCheckbox.value = false;
       
   180       break;
       
   181     default:
       
   182       alert("Unknown value");
       
   183       alert(type);
       
   184       break;
       
   185   }
       
   186 }
       
   187 
       
   188 // Set the comment type selector to be displayed
       
   189 var commentTypeSelector = document.getElementById("commenttypeselector");
       
   190 commentTypeSelector.parentNode.parentNode.style.display = "";
       
   191 commentTypeSelector.options.selectedIndex = 0;
       
   192 var publicCheckbox = document.getElementById("id_public");
       
   193 publicCheckbox.parentNode.parentNode.style.display = "none";
       
   194 
       
   195 // Set the comment view to default to what ever is selected
       
   196 commentType();
       
   197 </script>
       
   198 
   120 {% endblock %}
   199 {% endblock %}