<!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">
		&gt; <label tal:omit-tag="" i18n:translate="">Course info</label>

		<div tal:omit-tag="" tal:condition="python:here.kas_opetaja(request) or user.has_role(('Manager','IVAAdmin',),context)">
			<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 i18n: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>
			<p i18n:translate="">Fields marked in bold are required!</p>
			<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 style="width:20%">
						<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><strong i18n:translate="">Organization:</strong></td>
					<td>
						<input type="text" name="organisation:string" value="" tal:attributes="value context/get_organisation | nothing" tabindex="3" />
					</td>
				</tr>
				<tr tal:define="cats context/getAllCategories">
					<td tal:condition="cats"><strong i18n:translate="">Category:</strong></td>
					<td>
						<select name="cCat" tal:condition="cats" tabindex="5">
							<option value="0" i18n:translate="">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><strong i18n:translate="">Description:</strong></td>
					<td>
						<textarea style="width:90%" rows="10" name="desc:string" tabindex="7"><span tal:omit-tag="" tal:content="context/get_description | nothing" /></textarea>
					</td>
				</tr>
				<tr>

					<td><strong i18n:translate="">Methods:</strong></td>
					<td>
						<textarea style="width:90%" rows="10" name="methods:string" tal:content="context/get_methods |nothing" tabindex="9"></textarea>
<!--						<input type="text" name="methods:string" value="" tal:attributes="value context/get_methods | nothing" tabindex="4" />-->
					</td>
				</tr>
				<tr>
					<td><strong i18n:translate="">Credits:</strong></td>
					<td>
						<input type="text" name="credits" value="" tal:attributes="value context/get_credits | nothing" tabindex="11" />
					</td>
				</tr>
				<tr>
					<td><strong i18n:translate="">Course ID:</strong></td>
					<td>
						<input type="text" name="courseID" value="" tal:attributes="value context/get_courseID | nothing" tabindex="13" />
					</td>
				</tr>
				<tr>

					<td><strong i18n:translate="">Starting time:</strong></td>
					<td>
						<input type="text" name="start_date:string" value="" tal:attributes="value python:context.get_printable_starting_date(request) or nothing" tabindex="15" />
					</td>
				</tr>
				<tr>

					<td><strong i18n:translate="">Ending time:</strong></td>
					<td>
						<input type="text" name="end_date:string" value="" tal:attributes="value python:context.get_printable_ending_date(request) or nothing" tabindex="17" />
					</td>
				</tr>
				<tr>

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

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

					<td i18n:translate="">State:</td>
					<td>
						<select name="staatus" tabindex="23" tal:define="cstat context/getStatus|string:-1">
							<span tal:repeat="stat context/getStatuses" tal:omit-tag="">
								<option 
									value="" 
									i18n:translate=""
									tal:attributes="value stat;
										selected python:test(stat==int(cstat), 'selected', 0)"
									tal:content="python:context.getPrintableStatus(stat)"
								></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="Save" i18n:attributes="value" tabindex="25" />
					&nbsp; <input type="submit" name="cancel" value="Cancel" i18n:attributes="value" tabindex="27" />
					</td>

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

