## $Header: /cvs/sakai2/legacy/tools/src/webapp/vm/content/chef_resources_properties.vm,v 1.19 2005/06/03 15:50:41 jimeng.umich.edu Exp $ 
###############################################################
##### deprecated -- not used in refactored resources tool #####
###############################################################
##<!-- chef_resources_properties.vm, use with org.chefproject.ResourcesAction.java -->
##
############################################# macro prop_dateSelection 
#macro(prop_dateSelectionWidget $propName $propValue)
## Setup a date selection widget
#set($theDate = $propValue.breakdownLocal())
#set($year = $theDate.year)
#set($earliestYear = $year - 10)
#set($latestYear = $year + 10)	
#set($month = $theDate.month)
#set($day = $theDate.day)
<!-- $propValue $theDate -->
<!-- year: $year month: $month day: $day y0: $earliestYear yn: $latestYear -->
#chef_dateselectionwidget("${propName}_year" "${propName}_month" "${propName}_day" $earliestYear $latestYear $year $month $day)
#end
############################################# end of macro prop_dateSelection 
##
############################################# macro prop_timeSelection 
#macro(prop_timeSelectionWidget $propName $propValue)
## Setup a time selection widget
#set($theTime = $propValue.breakdownLocal())
<!-- $propValue $theTime -->
#set($hour = $theTime.hour)
#set($minute = $theTime.min)
#set($second = $theTime.sec)
<!-- hour: $hour minute: $minute second: $second -->
#set($timeType = "am")
#if($hour == 12 && $minute > 0)
#set($timeType = "pm")
#end
#if($hour == 0 && $minute == 0)
#set($timeType = "pm")
#end
#if($hour>12)
#set($hour = $hour - 12)
#set($timeType = "pm")
#elseif ($hour == 0)
#set($hour = 12)
#end
<!-- hour: $hour minute: $minute second: $second ampm: $ampm -->
<select name="${propName}_hour" id="${propName}_hour">
#foreach($hr in [1..12])
	<option#if($hr == $hour) selected="selected"#end value="$hr">$hr</option>
#end
</select>
:
<select name="${propName}_minute" id="${propName}_minute">
#foreach($min in [0..59])
	<option value="$min"#if($min == $minute) selected="selected"#end>#if($min < 10)0#end$min</option>
#end
</select>
:
<select name="${propName}_second" id="${propName}_second">
#foreach($sec in [0..59])
	<option value="$sec"#if($sec == $second) selected="selected"#end>#if($sec < 10)0#end$sec</option>
#end
</select>
<select name="${propName}_ampm" id="${propName}_ampm">
    #if($timeType =="am") <option selected="selected">am</option> #else <option>am</option> #end
    #if($timeType =="pm") <option selected="selected">pm</option> #else <option>pm</option> #end
</select>
#end
############################################# end of macro prop_timeSelection 

<script language="JavaScript" type="text/JavaScript">
	function openSampleCopyrightWindow() 
	{ 
	  window.open("$copyright_alert_url","SampleCopyrightAlert","scrollbars=no,menubar=no,height=400,width=700,resizable=no,toolbar=no,location=no,status=no");
	  return false;
	}
	function enableNewCopyright(obj_mycopyright, obj_newcopyright)
	{
		obj_mycopyright.checked = false;
		obj_newcopyright.checked = true;
	}

	function clearNewCopyright(obj_textarea)
	{
		obj_textarea.value = "";
	}
	
	function checkItem(copyrightIndex)
	{
		var obj_alert_name="copyrightAlert";
		var obj_alert_item=document.getElementById(obj_alert_name);
		var obj_newcopyright_name="newcopyright";
		var obj_newcopyright_item=document.getElementById(obj_newcopyright_name);
		if (copyrightIndex == 0)
		{
			obj_alert_item.checked=false;
			obj_newcopyright_item.disabled=true;
		}
		else if (copyrightIndex < 5)
		{
			obj_alert_item.checked=true;
			obj_newcopyright_item.disabled=true;
		}
		else if (copyrightIndex == 5)
		{
			obj_alert_item.checked=true;
			obj_newcopyright_item.disabled=false;
		}
	}
</script>
<div class="portletBody">
	<h3>
		#if($properties.getPropertyFormatted($properties.NamePropIsCollection)=="true")
			$tlang.getString("edit.folder")
		#else
			$tlang.getString("edit.edit") 
		#end
	</h3>
	
	#if ($alertMessage)<div class="alertMessage">$tlang.getString("gen.alert") $validator.escapeHtml($alertMessage)</div>#end
	<p class="instruction">
		$tlang.getString("edit.instr") <span class="reqStarInline">*</span>
	</p>
		
	<div class ="breadCrumb">
		$tlang.getString("gen.location")
		<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" />
		#foreach ($item in $collectionPath)
			#if ($dropboxMode && $item.id==$homeCollectionId)
				$siteTitle $tlang.getString("gen.drop")
			#elseif($item.id==$homeCollectionId)
				$siteTitle $tlang.getString("gen.reso")
			#else
				$validator.escapeHtml($item.name)
			#end
			#if(! $item.isLast())
				/
			#end
		#end
	</div>		
	#set($i = 1)
		<form name="propertyForm" action="#toolForm("ResourcesAction")&special=upload" method="post" enctype="multipart/form-data">
			<input type="hidden" name="collectionId" value="$validator.escapeHtml($collectionId)" />
			<input type="hidden" name="stateName" value = "list" />
			<input type="hidden" name="from" value="list" />
			<input type="hidden" name="option" id="option" value="replace" />
			<input type="hidden" name="eventSubmit_doModifyproperties" value="x" />
			<input type="hidden" name="flow" id="flow" value="update" />
			<input type="hidden" name="$properties.NamePropContentType" value="$properties.getProperty($properties.NamePropContentType)" />
			<input type="hidden" name="metadataGroup" id="metadataGroup" value="" />
				#if ($properties.getPropertyFormatted($properties.NamePropIsCollection)=="false") 
					<p class="shorttext">
						<span class="reqStar">*</span>
						<label for="$properties.NamePropDisplayName">
							$tlang.getString("gen.title") 
						</label>
						#if (!$homeCollectionId.equals($id))						 
							<input type="text" size="40" id = "$properties.NamePropDisplayName" name = "$properties.NamePropDisplayName" value="$validator.escapeHtml($properties.getPropertyFormatted($properties.NamePropDisplayName))" />
						#elseif ($dropboxMode)
							$siteTitle Drop Box
						#else
							$properties.getPropertyFormatted($properties.NamePropDisplayName)
						#end
					</p>	
					#if ($properties.getProperty($properties.NamePropContentType).equalsIgnoreCase($properties.TypeUrl))
						<p class="shorttext">
							<label for="Url">$tlang.getString("edit.replace2")</label>
							<input type="text" name="Url" id="Url" size="60" value="" />
						</p>
					#elseif ($properties.getProperty($properties.NamePropContentType)== "text/plain" || $properties.getProperty($properties.NamePropContentType)== "text/html") 
						<p class="shorttext">
							<label for="intent">$tlang.getString("gen.content")</label>
							<select name="intent" id="intent" onchange="javascript:document.propertyForm.submit();">
								<option id="intent-revise" value="revise"#if("$intent" == "$REVISE") selected="selected"#end>Revise document contents below</option><br />
								<option id="intent-replace" value="replace"#if("$intent" == "$REPLACE") selected="selected"#end>Replace with document from my computer</option>
							</select>
						</p>
						#if("$REVISE" == "$intent")
							#if ($properties.getProperty($properties.NamePropContentType) == "text/plain") 
								<p class="shorttext"> 
									<label for="content">&nbsp;</label>
									<textarea name="content" id="content" rows="10" cols="40" wrap="virtual">$validator.escapeHtmlTextarea($content)</textarea>
								</p>
							#elseif ($properties.getProperty($properties.NamePropContentType) == "text/html")
								<p class="shorttext"> 
									<label for="content">&nbsp;</label>
									<table border="0"><tr><td>
									<textarea name="content" id="content" rows="30" cols="80" wrap="virtual">$validator.escapeHtmlTextarea($content)</textarea>
									#chef_setupformattedtextarea("content")
									</td></tr></table>
								</p>
							#end
						#else
							<p class="shorttext">
								<label for="fileName">$tlang.getString("rep.thisfile")</label>
								<input type="file" name="fileName" id="fileName" class="upload" />
							</p>
						#end
					#else
						<p class="shorttext">
							<label for="fileName">$tlang.getString("rep.thisfile")</label>
							<input type="file" name="fileName" id="fileName"  class ="upload" />
						</p>
					#end
				#end
					<p class="shorttext">
						<label for="$properties.NamePropDescription">
							$tlang.getString("gen.description")
						</label>
						<textarea id="$properties.NamePropDescription" name="$properties.NamePropDescription" rows="2" cols="40" wrap="virtual">$validator.escapeHtmlTextarea($properties.getPropertyFormatted($properties.NamePropDescription))</textarea>
					</p>	
					#if ($properties.getPropertyFormatted($properties.NamePropIsCollection)=="false") 
					#if (! $properties.getProperty($properties.NamePropContentType).equalsIgnoreCase($properties.TypeUrl)) 
					#if ($!copyrightTypes)
						<p class="shorttext">
							<span class="reqStar">*</span>
								<label for="copyright">
									$tlang.getString("edit.cstatus")
								</label>	
								<select name="copyright" id ="copyright">
									#foreach ($copyright in $copyrightTypes)
										<option value="$copyright"#if($copyrightChoice == $copyright) selected="selected"#end>$copyright</option>
									#end
								</select>
								#if ($!fairuseurl)
									(<a href="$fairuseurl" target="_blank">$tlang.getString("edit.fairuse")</a>)
								#end
						</p>
						<p class="shorttext">
							<label for="newcopyright">
								$tlang.getString("edit.cinfo")
							</label>	
							<textarea name="newcopyright" id="newcopyright" rows="2" cols="40" wrap="virtual" >$validator.escapeHtmlTextarea("$!newcopyright")</textarea>
						</p>	
						<p class="shorttext">
							<label for="copyrightAlert">
								$tlang.getString("edit.calert")
							</label>
								<input type="checkbox" name="copyrightAlert" id ="copyrightAlert" value="true" #if($copyrightAlert)checked="checked"#end) style="border:none" />
								$tlang.getString("edit.display1")
								<a href="#" onclick="javascript:openSampleCopyrightWindow();">$tlang.getString("edit.display2")</a>
								$tlang.getString("edit.display3")
							</p>	
					#end
				#end
				#end
				#if (!$dropboxMode)
					## not show the public view in dropbox
					<p class="shorttext">
						<label for="pubview">
							$tlang.getString("edit.access1")
						</label>	
						#if ($pubviewset)
							$tlang.getString("gen.setyes")
						#else
							<input type="checkbox" name="pubview" id="pubview" value="true" #if($pubview) checked="checked"#end  style="border:none" />
							$tlang.getString("edit.access2")
						#end
					</p>	
				#end
				#if($setQuota)
					<p class="shorttext">
						<label for="hasQuota">
							$tlang.getString("gen.quota") ($tlang.getString("gen.kb")):
						</label>	
						<input type="hidden" name="setQuota" value="true" />
						<input type="checkbox" name="hasQuota" id="hasQuota" value="true" #if ($hasQuota) checked="checked" #end style="border:none" />
						<input type="text" size="10" name="quota" id="quota" value="$!quota" />
					</p>	
				#end
				<table class="itemSummaryForm" border="0" style="clear:both;margin:left:.5em">
					#if (!($dropboxMode && $collectionId==$homeCollectionId))
						<tr> 
							<th> 
								$tlang.getString("gen.created")
							</th>
							<td>
								$validator.escapeHtml($properties.getPropertyFormatted($properties.NamePropCreator))
							</td>
						</tr>
					#end
					<tr> 
						<th> 
							$tlang.getString("gen.creatime")
						</th>
						<td>
							$properties.getPropertyFormatted($properties.NamePropCreationDate)
						</td>
					</tr>
					<tr> 
						<th> 
							$tlang.getString("gen.last")
						</th>
						<td>
							$properties.getPropertyFormatted($properties.NamePropModifiedDate)
						</td>
					</tr>
					#if (!($dropboxMode && $collectionId==$homeCollectionId))
						<tr>
							<th> 
								$tlang.getString("gen.lastby")
							</th>
							<td>
								$validator.escapeHtml($properties.getPropertyFormatted($properties.NamePropModifiedBy))
							</td>
						</tr>
					#end
					#if ($properties.getPropertyFormatted($properties.NamePropIsCollection)=="false")
						<tr> 
							<th> 
								$tlang.getString("gen.stored")
							</th>
							<td>
								$service.getUrl($id)
							</td>
						</tr>
						<tr> 
							<th> 
								$tlang.getString("gen.type")
							</th>
							<td>
								$properties.getProperty($properties.NamePropContentType)
							</td>
						</tr>
						<tr> 
							<th> 
								$tlang.getString("gen.size")
							</th>
							<td>
								$properties.getPropertyFormatted($properties.NamePropContentLength) ($validator.getFileSizeWithDividor($properties.getProperty($properties.NamePropContentLength)) bytes)
							</td>
						</tr>
				  #end
		  </table> 
		  ############################################# this is the section to show ematadata  
		  #if($metadataGroups)
		  	#foreach($group in $metadataGroups)				  
				#if ($group.isShowing())
					<p class="discTria">
						<a href="#" onclick="location='#toolLinkParam("ResourcesAction" "doHide_metadata" "metadataGroup=$validator.escapeUrl($group.name)")'; return false;" title="$tlang.getString("edit.hide") group.name">
							<img src="#imageLink("sakai/collapse.gif")" alt="$tlang.getString("edit.hide") group.name" border="0" width="15" height="15" align="top" />
						</a>
						$validator.escapeHtml($group.name)
					</p>
					#foreach($tag in $group)
						<p class="shorttext">
							#if("$!tag.widget" == "$!STRING")
							<label for ="$validator.escapeJsQuoted("$!tag.fullname")">
								$tag.label
							</label>
								<input type="text" size="40"
									name="$!tag.fullname" 
									id="$validator.escapeJsQuoted("$!tag.fullname")" 
									value="$!properties.getProperty("$tag.fullname")" 
								/>
							#elseif("$!tag.widget" == "$!TEXTAREA")
								<label for ="$validator.escapeJsQuoted("$!tag.fullname")">
									$tag.label
								</label>
								<textarea rows="4" cols="30" 
									name="$!tag.fullname" 
									id="$validator.escapeJsQuoted("$!tag.fullname")" 
								>$!properties.getProperty("$tag.fullname")
								</textarea>
							#elseif("$!tag.widget" == "$!DATE")
								<label for ="http://purl.org/dc/terms/created_month">
									$tag.label
								</label>

								#if($!properties.getProperty("$tag.fullname"))
									#set($theValue = $!properties.getTimeProperty("$tag.fullname"))
								#else
									#set($theValue = $today)
								#end 
								#prop_dateSelectionWidget(${tag.fullname} $theValue)
							#elseif("$!tag.widget" == "$!DATETIME")
								#if($!properties.getProperty("$tag.fullname"))
									#set($theValue = $!properties.getTimeProperty("$tag.fullname"))
								#else
									#set($theValue = $today)
								#end 
								#prop_dateSelectionWidget(${tag.fullname} $theValue)
								#prop_timeSelectionWidget(${tag.fullname} $theValue)
							#elseif("$!tag.widget" == "$!TIME")
								#if($!properties.getProperty("$tag.fullname"))
									#set($theValue = $!properties.getTimeProperty("$tag.fullname"))
								#else
									#set($theValue = $today)
								#end 
								#prop_timeSelectionWidget(${tag.fullname} $theValue)
							#else
							$tag.fullname<br />
							$tag.widget<br />
							$!properties.getProperty("$tag.fullname")<br />
					#end
#end
				
#else

					<p class="discTria">
						<a href="#" onclick="location='#toolLinkParam("ResourcesAction" "doShow_metadata" "metadataGroup=$validator.escapeUrl($group.name)")'; return false;" title="$tlang.getString("edit.show") group.name">	
							<img src="#imageLink("sakai/expand.gif")" alt="$tlang.getString("edit.show") group.name" border="0" width="15" height="15" align="top" />
						</a>
						$validator.escapeHtml($group.name)
					</p>

#end
#end
#end
############################################# end of section to show metadata 
		#if (!$dropboxMode)
			#if ((!$properties.getBooleanProperty($properties.NamePropIsCollection)))
				#if ($notification)
					<p class="shorttext">
						<label for="notify">
							$tlang.getString("gen.email1")
						</label>	
						<select name="notify" id="notify">
							<option value="r">$tlang.getString("gen.email2")</option>
							<option value="o">$tlang.getString("gen.email3")</option>
							<option value="n" selected="selected">$tlang.getString("gen.email4")</option>
						</select>
					</p>	
				#end
			#end
		#end
		<p class="act">
			<input type="submit" name="eventSubmit_doModifyproperties" onclick="javascript:document.getElementById('flow').value='update';return true;" value="$tlang.getString("edit.update")" accesskey="s" />
			<input type="submit" name="eventSubmit_doCancel" onclick="javascript:document.getElementById('flow').value='cancel';return true;" value="$tlang.getString("gen.cancel")" accesskey="x" />
		</p>
	</form>
</div>

