<!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">

		<div tal:omit-tag="" tal:condition="python:here.kas_opetaja(request) or user.has_role('Manager')">
			<br />
			
			<span tal:omit-tag="" tal:condition="python:context.meta_type=='CourseManager'">
				<!-- no course context so we create a new course -->
				<span tal:omit-tag="" tal:define="global newCourse string:yes" />
			</span>
			<span tal:omit-tag="" tal:condition="python:context.meta_type=='Course'">
				<!-- change course info -->
				<span tal:omit-tag="" tal:define="global newCourse string:" />
			</span>
			
			<span tal:omit-tag="" tal:condition="newCourse">
				<h2 i18:translate="">Creating new course</h2>
			</span>
			<span tal:omit-tag="" tal:condition="not:newCourse">
				<h2>
					<label tal:omit-tag="" i18n:translate="">Editing course</label>&nbsp;
					<label tal:replace="context/get_name"></label>
				</h2>
			</span>
			
			<form action="add_course_form_handler" method="post" enctype="multipart/form-data">
			<span tal:omit-tag="" tal:condition="newCourse"><input type="hidden" value="" name="course_id" /></span>
			<span tal:omit-tag="" tal:condition="not:newCourse"><input type="hidden" value="" name="course_id" tal:attributes="value context/id" /></span>
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<td width="220">
						<strong i18n:translate="">Course title:</strong>
					</td>
					<td>
						<input type="text" name="my_name:string" value="" tal:attributes="value context/get_name | nothing" tabindex="1" />
					</td>
				</tr>
				<tr>
					<td i18n:translate="">Organization:</td>
					<td>
						<input type="text" name="organisation:string" value="" tal:attributes="value context/get_organisation | nothing" tabindex="2" />
					</td>
				</tr>
				<tr>

					<td i18n:translate="">Description:</td>
					<td>
						<textarea rows="3" cols="30" name="desc:string" tabindex="3"><span tal:omit-tag="" tal:content="context/get_description | nothing" /></textarea>
					</td>
				</tr>
				<tr>

					<td i18n:translate="">Methods:</td>
					<td>
						<input type="text" name="methods:string" value="" tal:attributes="value context/get_methods | nothing" tabindex="4" />
					</td>
				</tr>
				<tr>

					<td i18n:translate="">Starting date (YYYY-MM-DD):</td>
					<td>
						<input type="text" name="start_date:string" value="" tal:attributes="value python:context.get_printable_starting_date(request) or nothing" tabindex="1" />
					</td>
				</tr>
				<tr>

					<td i18n:translate="">Ending date (YYYY-MM-DD):</td>
					<td>
						<input type="text" name="end_date:string" value="" tal:attributes="value python:context.get_printable_ending_date(request) or nothing" tabindex="1" />
					</td>
				</tr>
				<tr>

					<td i18n:translate="">Quote:</td>
					<td>
						<input type="text" name="tekst" value="" tal:attributes="value context/kysiTekst | nothing" tabindex="1" />
					</td>
				</tr>
				<tr>

					<td i18n:translate="">Logo:</td>
					<td tal:content="structure context/kysiLogoViide | nothing"></td>
				</tr>
				<tr>
					<td></td>
					<td>
						<input type="file" name="logo_upload" />
					</td>
				</tr>
				<tr>

					<td i18n:translate="">State:</td>
					<td>
						<select name="staatus">
							<span tal:omit-tag="" tal:content="structure python:context.kysiStaatuseValikud(request)" />
						</select>
					</td>
				</tr>
				<tr>
					<td i18n:translate="">Category:</td>
					<td>
						<select name="cCat" tal:condition="python:len(context.getAllCategories())>0">
							<option value="0">None</option>
							<span tal:omit-tag="" tal:repeat="x context/treePrinter">
								<!-- We change course -->
								<option tal:condition="not:newCourse" selected="selected" tal:attributes="value python:x[1];selected python:x[1]==context.getCourseCategory()" tal:content="python:x[0]+' '+context.getNameForID(x[1])"></option>
								<!-- We create new course -->
								<option tal:condition="newCourse" tal:attributes="value python:x[1]" tal:content="python:x[0]+' '+context.getNameForID(x[1])"></option>
							</span>
						</select>
					</td>
				</tr>
				<tr>

					<td>
					</td>
					<td>
					<span tal:omit-tag="" tal:condition="newCourse"><input type="hidden" value="1" name="creating_new_course" /></span>
					<input type="submit" name="add" value="Submit" i18n:attributes="value" tabindex="11" />
					&nbsp; <input type="submit" name="cancel" value="Cancel" i18n:attributes="value" tabindex="12" />
					</td>

				</tr>
			</table>
			</form>
			
		</div>
</span>		
  
</html>
