##<!-- $Header: /cvs/sakai2/legacy/tools/src/webapp/vm/sitesetup/chef_site-modifyENW.vm,v 1.4 2005/06/04 02:41:43 ggolden.umich.edu Exp $ -->
## modify Email Archive, News and Web Content tool 
##   - did some work on producing valid ids for inputs that would be good to validate 
<div class="portletBody">
	<h3>
		$tlang.getString("enw.custom")
	</h3>           
	#if ($alertMessage)
		<div class="alertMessage">$tlang.getString("gen.alert") $validator.escapeHtml($alertMessage)</div>
		<div class="clear"></div>
	#end
	#if (!$!existingSite)                 
		<p class="step">
			$tlang.getString("enw.these") 
		</p>
		<p class="instruction">
		$tlang.getString("enw.custom1")
		</p>
	#else
		<p class="instruction">
		$tlang.getString("enw.custom2")
		</p>
	#end
	<form name = "ENWForm" method = "post" action="#toolForm("SiteAction")">
		<input type="hidden" name="option" value="add" />
		<input type="hidden" name="$function" value="x" />
			#foreach($toolId in $!toolRegistrationSelectedList)
				## set up a hidden input field for every selected tool except for Email Archive, News and Web Content tool
				#if ($toolId != "sakai.mailbox" && $toolId.indexOf("sakai.news") == -1 && $toolId.indexOf("sakai.iframe") == -1)
					<input type="hidden" name="selectedTools" value="$toolId" />
				#end
			#end
			#set($hasEmail = false)
			#set($hasNews = false)
			#set($hasWC = false)
			#foreach($toolId in $!toolRegistrationSelectedList)
				#if ($toolId == "sakai.mailbox")
					#set($hasEmail = true)
				#elseif ($toolId.indexOf("sakai.news") != -1)
					#set($hasNews = true)
				#elseif ($toolId.indexOf("sakai.iframe") != -1)
					#set($hasWC = true)
				#end
			#end
			#if ($hasEmail)
				##if the email archive tool is being added, show the input field for email alias
				#set($toolExist=false)
				#foreach ($oldTool in $oldSelectedTools)
					#if ($oldTool == "sakai.mailbox")
						#set($toolExist=true)
					#end
				#end
				#if(!$toolExist)
					<input type="hidden" name="selectedTools" value="sakai.mailbox" />
					<h4>
						$tlang.getString("enw.email")
					</h4>
					<div class="indnt1">
						<p class="shorttext required">
							<span class="reqStar">*</span>
							<label for="emailId">
								$tlang.getString("enw.site")
							</label>
							<input type="text" title="$tlang.getString('enw.emailreq')" name="emailId" id="emailId" value="$!emailId" size="10" maxlength="32" />@$serverName
						</p>
					</div>
				#end	
			#end
			#if ($hasNews)
				#set ($Newscount=0)			
				#set($newNewsTool=false)
				#foreach($toolId in $toolRegistrationSelectedList)
					#if ($toolId.indexOf("sakai.news") != -1)
						#set ($Newscount=$Newscount +1)			
						<input type="hidden" name="selectedTools" value="$toolId" />
						## if this news tool is being added, show those input areas
						#set($toolExist=false)
						#if ($oldSelectedTools.contains($toolId))
							#set($toolExist=true)
						#else
							#if (!$newNewsTool)
								#set($newNewsTool=true)
								## show lab for News tool
								<h4>
									$tlang.getString("enw.news")
								</h4>
								<div class="indnt1">
							#end
						#end
						#set($name = "titlefor")
						#set($name = $name.concat($toolId))
						#if(!$toolExist)
							<p class="shorttext">
								## commenting - as not really required - if empty a default is used (gsilver)
								##<span class="reqStar">*</span>
								<label for="${name}${Newscount}-NewsT">
									$tlang.getString("enw.title")
								</label>
								<input type="text" id="${name}${Newscount}-NewsT" name="$name" value="$validator.escapeHtml($!newsTitles.get($toolId))" size="15" maxlength="32"  /><span class="inlinstruction"> $tlang.getString("enw.suggest")</span>
							</p>
						#else
							<input type="hidden" id="${name}${Newscount}-NewsT" name="$name" value="$validator.escapeHtml($!newsTitles.get($toolId))" />
						#end
						#set($name = "urlfor")
						#set($name = $name.concat($toolId))
						#if(!$toolExist)
							<p class="shorttext">
								## commenting - as not really required - if empty a default is used (gsilver)
								##<span class="reqStar">*</span>
								<label for ="${name}${Newscount}-NewsU">
									$tlang.getString("enw.url")
								</label>
								<input type="text" id="${name}${Newscount}-NewsU"  name="$name" value="$validator.escapeHtml($!newsUrls.get($toolId))" size="50" />
							</p>
						#else
							<input type="hidden" id="${name}${Newscount}-NewsU"  name="$name" value="$validator.escapeHtml($!newsUrls.get($toolId))" />
						#end
					#end
				#end
				#if ($newNewsTool)
						<div class="labelindnt" style="text-indent:.5em"><label for="newsNum" class="skip">$tlang.getString("enw.more")</label>
							<select name="newsNum" id="newsNum" onchange="document.ENWForm.option.value='addNews';javascript:document.ENWForm.submit();">
								<option value="$j" selected="selected">$tlang.getString("enw.morent")</option>
									#foreach ($j in [1 .. 3])
										<option value="$j">$j $tlang.getString("enw.more")</option>
									#end
							</select>	
						</div>
					</div>
				#end
			#end
			#if ($hasWC)
				#set ($WCcount=0)
				#set($newWCTool=false)
				#foreach($toolId in $toolRegistrationSelectedList)
					#if ($toolId.indexOf("sakai.iframe") != -1)
						#set ($WCcount=$WCcount +1)			
						<input type="hidden" name="selectedTools" value="$toolId" />
						## if this news tool is being added, show those input areas
						#set($toolExist=false)
						#if ($oldSelectedTools.contains($toolId))
							#set($toolExist=true)
						#else
							#if (!$newWCTool)
								#set($newWCTool=true)
								<h4>
									$tlang.getString("enw.web")
								</h4>
								<div class="indnt1">
							#end
						#end
						#set($name = "titlefor")
						#set($name = $name.concat($toolId))
						#if (!$toolExist)
							<p class="shorttext">
								## commenting - as not really required - if empty a default is used (gsilver)
								##<span class="reqStar">*</span>
								<label for="${name}${WCcount}-WCT">
									$tlang.getString("enw.title")
								</label>
								<input type="text" id="${name}${WCcount}-WCT" name="$name" value="$validator.escapeHtml($!wcTitles.get($toolId))" size="15" maxlength="32" /> <span class="inlinstruction">$tlang.getString("enw.suggest")</span><br />
							</p>
						#else
							<input type="hidden" id="${name}${WCcount}-WCT" name="$name" value="$validator.escapeHtml($!wcTitles.get($toolId))" />
						#end
						#set($name = "urlfor")
						#set($name = $name.concat($toolId))
						#if (!$toolExist)
							<p class="shorttext">
								<label for="${name}${WCcount}-WCU">
									$tlang.getString("enw.url")
								</label>
								<input type="text"  id="${name}${WCcount}-WCU" name="$name" value="$validator.escapeHtml($!wcUrls.get($toolId))" size="50" />
							</p>
						#else
							<input type="hidden"  id="${name}${WCcount}-WCU" name="$name" value="$validator.escapeHtml($!wcUrls.get($toolId))" />
						#end
					#end
				#end
				#if($newWCTool)
						<div class="labelindnt" style="text-indent:.5em"><label for="wcNum" class="skip">$tlang.getString("enw.morewct")</label>
							<select name="wcNum" id="wcNum" onchange="document.ENWForm.option.value='addWC';javascript:document.ENWForm.submit();">
								<option value="$j" selected="selected">$tlang.getString("enw.morewct")</option>
								#foreach ($j in [1 .. 3])
									<option value="$j">$j $tlang.getString("enw.more")</option>
								#end
							</select>
						</div>	
					</div>
				#end
			#end
		<input type="hidden" name="back" value="$back" />
		<input type="hidden" name="template-index" value="26" />
		<input type="hidden" name="continue" value="$continue" />
		<div class="act">
			<input type="button" name="Continue" 
				accesskey="s"
				class="active"
				value="$tlang.getString('gen.continue')" 
				onclick="document.ENWForm.option.value='continue';javascript:document.ENWForm.submit();" />
			<input type="button" name="Back" 
				value="$tlang.getString('gen.back')"
				accesskey="b"
				onclick="document.ENWForm.option.value='back';javascript:document.ENWForm.submit();" />
			<input type="button" name="Cancel" 
				value="$tlang.getString('gen.cancel')"
				accesskey="x"
				onclick="document.ENWForm.option.value='cancel';javascript:document.ENWForm.submit();" />
		</div>
	</form>
</div>
<script type="text/javascript" language="JavaScript">
	firstFocus();
</script>
