<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html metal:use-macro="container/page_macro/macros/master_page">

<span tal:omit-tag="" metal:fill-slot="main_content_slot" 
	tal:define="add_new context/add_new_quiz;
	curr_type context/kysiTyyp | request/tyyp | python:0;">
	
  <h2 tal:condition="not:add_new" i18n:translate="">Changing the quiz settings</h2>
  <h2 tal:condition="add_new" i18n:translate="">Add new quiz</h2>

  <form action="pealkirjaMuutmisLeht" tal:attributes="action python:test(add_new, 'add_new_quiz_handler', 'quiz_settings_handler')" method="post">
     <table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="eeeeee">
        <tr tal:define="title context/annaPealkiri | request/pealkiri | nothing">
          <td class="t1" width="25%" i18n:translate="">Title:</td>
          <td class="t1"><input type="text" name="pealkiri" tal:attributes="value title"></td>
        </tr>
        <tr tal:define="descr context/annaKirjeldus | request/kirjeldus | nothing">
           <td class="t1" i18n:translate="">Description:</td>
           <td><textarea name="kirjeldus" tal:content="descr"></textarea></td>
        </tr>
        <tr>
           <td class="t1" i18n:translate="">Type:</td>
           <td>
             <select name="tyyp">
                <span tal:repeat="t python:context.getTypesPretty(request)" tal:omit-tag="">
                    <option tal:define="nr repeat/t/index" 
		    	tal:attributes="value repeat/t/index; 
			selected python:test(nr==int(curr_type), 'selected', nothing)" 
			tal:content="t"></option>
                </span>
             </select>
           </td>
        </tr>
        <tr tal:condition="python:int(curr_type)==0">
           <td class="t1" i18n:translate="">Quiz has timelimit:</td>
	   <td tal:define="time_limited context/kasLahendusaegPiiratud | request/lahendusaegPiiratud | python:0">
		   <input 
		   	type="checkbox" 
			name="lahendusaegPiiratud" 
			value="1"
			tal:attributes="checked python:test(time_limited!='0' and time_limited!=0, 'checked', nothing)" 
		   />
	   </td>
        </tr>
        <tr tal:condition="python:int(curr_type)==0">
           <td class="t1" i18n:translate="">Time for answering:</td>
	   <td tal:define="time_hours context/kysiLahendusajaTunnid | request/lahendusaegTunnid | python:24;
		   time_minutes context/kysiLahendusajaMinutid | request/lahendusaegMinutid | python:0">
		   <span tal:omit-tag="" i18n:translate="">Hours:</span>
		   <input type="text" name="lahendusaegTunnid" tal:attributes="value time_hours" size="5" /> :
		   <span tal:omit-tag="" i18n:translate="">Minutes:</span>
			   <input type="text" name="lahendusaegMinutid" tal:attributes="value time_minutes" size="5" />
           </td>
        </tr>

        <tr class="t1">
           <td class="t1" i18n:translate="">Randomize questions:</td>
	   <td class="t1" tal:define="random_order context/kasKysimusteJuhuslikJarjekord | request/juhujarjestus | python:0">
              <input type="checkbox" name="juhujarjestus" value="1" tal:attributes="checked python:test(int(random_order), 'checked', nothing)" />
           </td>
        </tr>
        <tr>
           <td class="t1" i18n:translate="">Answers visible:</td>
           <td>
              <select name="nahtavus" 
	      		tal:define="ans_visible context/kysiVastusteNahtavus | request/nahtavus | python:0">
                 <span tal:repeat="t context/getAnswerVisibilityPretty">
                    <option tal:define="nr repeat/t/index" 
		    	tal:attributes="value nr; 
					selected python:test(nr==int(ans_visible), 'selected', nothing)" 
			tal:content="t" i18n:translate=""></option>
                 </span>
              </select>
           </td>
        </tr>
        <tr><td colspan="2"><h3 i18n:translate="">Permissions</h3></td></tr>
        <tr>
		<td class="t1" colspan="2" tal:define="vv context/isQuizClosed">
              <input type="radio" name="testipass" value="suletud" 
	      tal:attributes="checked python:test(vv, 'checked', nothing)"/>
                 <span i18n:translate="" tal:omit-tag="">Not public yet</span>
           </td>
        </tr>
        <tr>
		<td class="t1" colspan="2" tal:define="vv context/isQuizTimelimited;">
			<input type="radio" name="testipass" value="ajapiirang" tal:attributes="checked python:test(vv, 'checked', nothing)" />
	   		<span i18n:translate="">Open for all timelimit</span>
			<a i18n:translate="" tal:attributes="href python:'koigiLuba?liikumisURL='+kursus.absolute_url()+'/testid/'" tal:condition="vv">restrictions</a>
           </td>
        </tr>
        <tr>
           <td class="t1" colspan="2">
              <input type="radio" name="testipass" value="sisegr" tal:attributes="checked python:test(context.isQuizPublicForGroups(), 'checked', nothing)" />
              <span i18n:translate="">Open for subgroups</span>
                  <a i18n:translate="" tal:attributes="href python:'grupiLubadeLisamisVorm'" tal:condition="python:context.isQuizPublicForGroups()">restrictions</a>
           </td>
        </tr>
        <tr>
           <td class="t1" colspan="2">
              <input type="radio" name="testipass" value="isikuline" tal:attributes="checked python:test(context.isQuizPublicForUsers(), 'checked', nothing)" />
              <span i18n:translate="">Open for persons</span>
                  <a i18n:translate="" tal:attributes="href python:'isikuLubadeLisamisVorm'" tal:condition="python:context.isQuizPublicForUsers()">restrictions</a>
           </td>
        </tr>
     </table>
     <input type="hidden" 
     	name="liikumisURL" 
	tal:attributes="value python:request.get('liikumisURL', nothing)" />
     <input type="submit" value="OK" />
  </form>
</span>
</html>
