<!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">
	<span tal:omit-tag="" tal:condition="exists:request/uname">
		<span tal:omit-tag="" tal:define="global username request/uname" />
	</span>
	<span tal:omit-tag="" tal:condition="not:exists:request/uname">
		<span tal:omit-tag="" tal:define="global username python:str(user)" />
	</span>

	<span tal:condition="python:username==str(user) or context.kas_opetaja(request)"><!--check start>-->
	<h2>Grading</h2>
	<!-- XXX: security check, only user itself and teachers should reach points and grades -->
		<form method="post" action="assignmentGrading_handler">
		<input type="hidden" value="" name="user" tal:attributes="value username" />
		<table border="0">
			<tr>
				<td colspan="2" tal:condition="python:context.tyyp==1"><label i18n:translate="">Grading for user </label><label tal:replace="python:context.firstAndLast(username)" /></td>
				<td colspan="2" tal:condition="python:context.tyyp!=1"><label i18n:translate="">Grading groupwork for group </label><label tal:replace="username" />
				<br />
				<label class="helpLabel"> Note:Points given here will be assigned to each student in subgroup</label>
				</td>
			</tr>
			<tr>
				<td i18n:translate="">Points:</td>
				<td tal:condition="python:context.kas_opetaja(request)">
					<input type="text" name="points" value="" tal:attributes="value python:context.getGrades(username, 'points')" />
				</td>
				<td tal:condition="python:not(context.kas_opetaja(request))" tal:content="python:context.getGrades(username, 'points')" />
			</tr>
			<tr>
				<td i18n:translate="">Comment:</td>
				<td tal:condition="python:context.kas_opetaja(request)"><textarea name="comment" tal:content="python:context.getGrades(username, 'comment')"></textarea></td>
				<td tal:condition="python:not(context.kas_opetaja(request))" tal:content="python:context.getGrades(username, 'comment')"></td>
			</tr>
			<tr tal:condition="python:context.kas_opetaja(request)">
				<td colspan="2"><input type="submit" value="Save" name="save" /></td>
			</tr>
		</table>
		</form>
	</span><!-- check end-->
	<h2>Assignment information</h2>
	
	<h3 i18n:translate="">Assignment:</h3> <label tal:replace="context/getTitle" />
	
	<h3 i18n:translate="">Type:</h3> <label tal:replace="python:context.getType(request)" />
	
	<h3 i18n:translate="">Max points:</h3> <label tal:replace="context/getPoints" />
	
	<h3 i18n:translate="">description</h3>
	<p tal:content="context/kirjeldus" />
	
</span>
  
</html>
