<html i18n:domain="iva" tal:define="x python:request.set('HTTP_ACCEPT_LANGUAGE', here.giveLanguage(request))">

<span metal:use-macro="container/main_macro/macros/head" tal:omit-tag=""></span>

  <body>
	<span metal:use-macro="container/main_macro/macros/menu" tal:omit-tag=""></span>
	<span metal:use-macro="container/main_macro/macros/kasutajateemataust" tal:omit-tag=""></span>

	<div style="position:absolute; top:182px; left:10px">
		<div style="float:left;width:200px">
			<!-- Siit algab vasaku menüü osa -->
			<p tal:on-error="string: Error: no mailbox!" metal:use-macro="container/main_macro/macros/mailboxLinks" tal:omit-tag="" />
			<p>
				<span metal:use-macro="container/main_macro/macros/vasak_menyy" tal:omit-tag=""></span>
			</p>
		</div>
		<span tal:omit-tag="" metal:use-macro="container/main_macro/macros/style_c"/>
		<div style="margin-left:200px" tal:attributes="style style_tmp" tal:condition="python:(here.jooksva_kursuse_nr(request)!=0) and (hasattr(here.fle_root().courses, here.jooksva_kursuse_nr(request))) and (here.kas_opetaja(here.REQUEST)) or (here.REQUEST.AUTHENTICATED_USER.has_role('Manager'))">
			<!-- Siin algab raja osa -->
			<span metal:use-macro="container/main_macro/macros/leivapuru" tal:omit-tag=""></span>

			<br />&nbsp;
			<!-- search form -->
			<div style="position:absolute; top:50px; margin-left:0px; width:450px">
			<form method="post">
				<input type="hidden" value="1" name="vormist" />
				<x tal:define="head python:'Adding new users to course '+context.jooksva_kursuse_nimi(request)">
				<h2 i18n:translate="" tal:content="head">Adding new users to course</h2>
				</x>
				<table>
					<tr>
						<td>Last Name:</td>
						<td><input type="text" name="pnimi" value="" tal:attributes="value python:getattr(request,'pnimi','')" /></td>
						<td><input type="submit" value="Search" name="" /></td>
					</tr>
					<tr>
						<td>First Name:</td>
						<td><input type="text" name="enimi" value="" tal:attributes="value python:getattr(request,'enimi','')" /></td>
					</tr>
					<tr>
						<td>Affiliation:</td>
						<td><span tal:replace="structure python:container.fle_users.erialadeKombo(request, vaikimisiID=getattr(request, 'eriala','-1'))" /></td>
					</tr>
				</table>
			</form>
			</div>
			
			<form action="add_users_form_handler" method="post" tal:define="course python:context.find_coursemanager().get_child(jnr)">
			<input type="hidden" value="" tal:attributes="value jnr" name="course_id" />
			
			<!-- search results -->
			<div class="t1" style="position:absolute; top:190px; margin-left:0px; width:320" tal:condition="python:getattr(request,'vormist','-1')=='1'">
			<table border="0" cellpadding="2" cellspacing="1" bgcolor="#EEEEEE" width="320">
				<tr>
					<th>IVA Users</th>
				</tr>
				<tr>
					<td class="t1">
				<span tal:repeat="newuser python:context.filtreeriKasutajad(request, context.get_users_not_on_the_course(jnr, getattr(request, 'jarjestus', ''),getattr(request, 'omadus', ''), getattr(request, 'alates', ''), getattr(request, 'kuni', '')), enimi=getattr(request, 'enimi', ''), pnimi=getattr(request, 'pnimi', ''),org=getattr(request, 'eriala', '') )">
		  			<input type="checkbox" value="" name="users_None" tal:attributes="value newuser/get_id" />
					 <span tal:content="python:newuser.firstAndLast(newuser.get_uname())" />
					 (<span tal:content="newuser/get_uname" />)
					 <span tal:content="newuser/get_organization" tal:condition="python:getattr(request, 'eriala','')=='1'" />
					 <br />
				</span>
				</td>
				</tr>
			</table>
			</div>
			<!-- buttons, teacher, participants -->
			<div style="position:absolute; top:190; margin-left:350px;">
				<!-- buttons -->
				<div>
				<input class="width100" type="submit" value="Add ->" name="None_to_Teacher" />
				<br />
				<input class="width100" type="submit" value="<- Remove" name="Teacher_to_None" />
				</div>
				<!-- teachers -->
				<div style="position:relative; margin-left:120px; margin-top:-50px;width:200">
					<table border="0" cellpadding="2" cellspacing="1" bgcolor="#EEEEEE" width="200">
						<tr>
							<th>Teachers</th>
						</tr>
						<tr>
							<td class="t1">
								<span tal:omit-tag="" tal:repeat="teacher python:course.get_users_with_role('Teacher')">
									<input type="checkbox" name="users_Teacher" value="" tal:attributes="value teacher/get_id" tal:condition="python:teacher.get_uname()!='admin'" />
									<span tal:omit-tag="" tal:condition="python:teacher.get_uname()!='admin'" tal:content="python:teacher.firstAndLast(teacher.get_uname())" />
									<br tal:condition="python:teacher.get_uname()!='admin'" />
								</span>
							</td>
				</div>
				<!-- buttons -->
				<div style="position:relative;margin-top:80px">
				<input class="width100" type="submit" value="Add ->" name="None_to_Student" />
				<br />
				<input class="width100" type="submit" value="<- Remove" name="Student_to_None" />
				</div>
				<!-- students -->
				<div style="position:relative;margin-left:120px; margin-top:-52px;width:200">
					<table border="0" cellpadding="2" cellspacing="1" bgcolor="#EEEEEE" width="200">
						<tr>
							<th>Students</th>
						</tr>
						<tr>
							<td class="t1">
							<span tal:omit-tag="" tal:repeat="stdent python:course.get_users_with_role('Student')">
								<input type="checkbox" value="" name="users_Student" tal:attributes="value stdent/get_id" />
								<span tal:omit-tag="" tal:content="python:stdent.firstAndLast(stdent.get_uname())" />
								(<span tal:omit-tag="" tal:content="stdent/get_uname" />)
								<br />
							</span>
							</td>				
				</div>
			</div>
			</form>
		</div>
	</div>
  <span metal:use-macro="container/main_macro/macros/cssJS" tal:omit-tag=""></span>
  </body>
  
</html>
