## <!-- chef_resources_create.vm, use with org.sakaiproject.tool.content.ResourcesAction.java -->

<script type="text/javascript" language="JavaScript">
  focus_path = ["filename1"];
</script>
<script type="text/javascript" language="JavaScript">
	<!--
	function submitform(id)
	{
		var theForm = document.getElementById(id);
		if(theForm && theForm.onsubmit)
		{
			theForm.onsubmit();
		}
		if(theForm && theForm.submit)
		{
			theForm.submit();
		}
	}
	function submitWithNumberOfItems(formName, element)
	{
		var theForm = document.getElementById(formName);
		var theNumber = element.value;
		
		theForm.action="#toolLinkParam("ResourcesAction" "doCreateitem" "special=upload&flow=updateNumber")&numberOfItems=" + theNumber;
		if(theForm && theForm.onsubmit)
		{
			theForm.onsubmit();
		}
		if(theForm && theForm.submit)
		{
			theForm.submit();
		}
	}
	//-->
</script>

<div class="portletBody">
	######################## ================ Title, Instructions, Breadcrumb ================ ########################
	<h3>
		#if($helper_title)
			$helper_title
		#elseif("$itemType" == "$TYPE_FOLDER")
			$tlang.getString("addf.addfolder")
		#else
			$tlang.getString("gen.additems") 
		#end
	</h3>
	#if ($alertMessage || $createAlertMessage)
		<div class="alertMessage">$tlang.getString("gen.alert") 
			#if ($alertMessage)
				$validator.escapeHtml($alertMessage)
			#end
			#if ($createAlertMessage)
				$validator.escapeHtml($createAlertMessage)
			#end
		</div>
		<div style="display:block;clear:both" ></div>
	#end
	<p class="instruction">
		#if($helper_instruction)
			$helper_instruction
		#elseif("$itemType" == "$TYPE_FOLDER")
			$tlang.getString("addf.instr")
		#else
			$tlang.getString("gen.instr1")
		#end
	</p>
	<p class="instruction">
		$tlang.getString("gen.instr2") <span class="reqStarInline">*</span>
	</p>	
	<div class ="breadCrumb">
		<h3>	
		$tlang.getString("gen.location")
		<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" alt="" />
		#foreach ($element in $collectionPath)
			#if ($dropboxMode && $element.id==$homeCollectionId)
				$siteTitle $tlang.getString("gen.drop")
			#elseif($element.id==$homeCollectionId)
				$siteTitle $tlang.getString("gen.reso")
			#else
				$validator.escapeHtml($element.name)
			#end
			#if(! $element.isLast())
				/
			#end
		#end
		</h3>
	</div>
	######################## ================ Change Item Type, Number of Items ================ ########################
	<form name="addItemForm" id="addItemForm" method="post" action="#toolForm("ResourcesAction")" >
		<input type="hidden" name="sakai_action" value="doCreate" />
		<input type="hidden" name="collectionId" value="$validator.escapeHtml($collectionId)" />
		<input type="hidden" name="suspended-operations-stack" id="suspended-operations-stack" value="push" />
		<p class="shorttext">
			<label for="itemType01">$tlang.getString("addi.add")</label><span class="skip">$tlang.getString("addi.selectmessage")</span>
			<select id="itemType01"  name="itemType" onchange="javascript:document.getElementById('suspended-operations-stack').value='peek';submitform('addItemForm');">
				<option value="$TYPE_FOLDER" id="$validator.escapeJavascript("$TYPE_FOLDER")"#if("$itemType" == "$TYPE_FOLDER") selected="selected"#end>$tlang.getString("addi.folder")</option>
				<option value="$TYPE_UPLOAD" id="$validator.escapeJavascript("$TYPE_UPLOAD")"#if("$itemType" == "$TYPE_UPLOAD") selected="selected"#end>$tlang.getString("addi.upload")</option>
				<option value="$TYPE_URL" id="$validator.escapeJavascript("$TYPE_URL")"#if("$itemType" == "$TYPE_URL") selected="selected"#end>$tlang.getString("addi.url")</option>
				<option value="$TYPE_HTML" id="$validator.escapeJavascript("$TYPE_HTML")"#if("$itemType" == "$TYPE_HTML") selected="selected"#end>$tlang.getString("addi.txthtml")</option>
				<option value="$TYPE_TEXT" id="$validator.escapeJavascript("$TYPE_TEXT")"#if("$itemType" == "$TYPE_TEXT") selected="selected"#end>$tlang.getString("addi.txttxt")</option>
				#if($show_form_items)
					<option value="$TYPE_FORM" id="$validator.escapeJavascript("$TYPE_FORM")"#if("$itemType" == "$TYPE_FORM") selected="selected"#end>$tlang.getString("addi.meta")</option>
				#end
			</select>
		</p>
	</form>
</div>
<!-- before parse -->
#parse("/vm/content/chef_resources_itemtype.vm")
<!-- after parse -->
