##<!-- $Header: /cvs/sakai2/legacy/tools/src/webapp/vm/email/chef_mailbox-List.vm,v 1.9 2005/06/06 18:47:18 ggolden.umich.edu Exp $ -->
<script type="text/javascript" language="JavaScript">
  focus_path = ["search"];
</script>
<div class="portletBody">
	#if($menu)#toolbar($menu)#end
	<form name="toolbar" action="#toolForm("$action")" method="post">
		<div class="navPanel">
			<div class="searchNav"> 
				<label for="search" class="skip">$tlang.getString('lis.search')</label>
				<input size="15" value="$!search" name="search" id="search" type="text" class="searchField" onkeypress="formSubmitOnEnter(this, event)" />
				<input type="hidden" name="eventSubmit_doSearch" id="eventSubmit_doSearch" value="Search for emails" />
				<a href="#" title="$tlang.getString('lis.search')" onclick="location = '#toolLink("$action" "doSearch")'+buildQueryString('toolbar');return false;">
					<input type="button" value="$tlang.getString('lis.search')" />
				</a>
				#if (($!search) && (!$search.equals("")))
					<a href="#" title="Search" onclick="location = '#toolLink("$action" "doSearch_clear")';return false;" onkeypress="location = '#toolLink("$action" "doSearch_clear")';return false;">
						<input type="button" value="$tlang.getString('lis.clear')" />
					</a>
				#end
			</div>
		</div>	
	</form>	
	#if ($alertMessage)<div class="alertMessage">$tlang.getString("gen.alert") $validator.escapeHtml($alertMessage)</div><div class="clear"></div>#end
	#if ($sort-order)
		#set ($sort-img = "sakai/sortascending.gif")
		#set ($sort-dir = "ascending")
	#else
		#set ($sort-img = "sakai/sortdescending.gif")
		#set ($sort-dir = "descending")
	#end


	<div class="instruction">
		#if ($validFrom)
			#if ($!validFrom.length() == 0)
				$tlang.getString("lis.noemail")<br />
			#else
				$tlang.getString("lis.youare")#if($validFrom != "*") $tlang.getString("gen.fro2") $validFrom#else.#end<br />
			#end
			$tlang.getString("lis.emasen")<br />
			<ul  class="attachList indnt3">
				#foreach ($alias in $aliases)
					<li><a href="mailto:${alias.getId()}@${serverName}" title="$tlang.getString("lis.sendmailto") ${alias.getId()}@${serverName}">${alias.getId()}@${serverName}</a></li>
				#end
				<li><a href="mailto:${nonAlias}@${serverName}" title="$tlang.getString("lis.sendmailto") ${nonAlias}@${serverName}">${nonAlias}@${serverName}</a></li>
			</ul>
		#else
			$tlang.getString("lis.youarenot")<hr class="itemSeparator" />
		#end
	</div>	
	#if($allMsgNumberInt > 0)
		<div class="navPanel">	
			<div class="listNav">
				<div class="instruction">$tlang.getString("list.viewing") $topMsgPos - $btmMsgPos $tlang.getString("list.of") $allMsgNumber $tlang.getString("list.items")</div>
				#if ($pagesize != 0)
					#if ($goPPButton == "true")
						<form name="firstpageForm" class="inlineForm" method="post" action="#toolForm("$action")">
							<input type="submit" name="eventSubmit_doList_first" value="|&lt;" title="$tlang.getString("list.first")" />
						</form>
					#else
						<form name="firstpageForm" class="inlineForm" method="post" action="#toolForm("$action")">
							<input type="submit" name="eventSubmit_doList_first" value="|&lt;" disabled="disabled" />
						</form>
					#end
					#if ($goPPButton == "true")
						<form name="nextpageForm" class="inlineForm" method="post" action="#toolForm("$action")">
							<input type="submit" name="eventSubmit_doList_prev" value="&lt;" title="$tlang.getString("list.prev") $pagesize"  accesskey="p" />
						</form>
					#else
						<form name="nextpageForm" class="inlineForm" method="post" action="#toolForm("$action")">
							<input type="submit" name="eventSubmit_doList_prev" value="&lt;" disabled="disabled" />
						</form>
					#end
				#end
				<form name="pagesizeForm" class="inlineForm" method="post" action="#toolForm("$action")">
					<input type="hidden" name="eventSubmit_doChange_pagesize" value="changepagesize" />
					<span class="skip">$tlang.getString("lis.select")</span>
					<select name="selectPageSize" onchange="blur();document.pagesizeForm.submit();">
					<option value="5" #if($pagesize == 5) selected="selected" #end>$tlang.getString("lis.show5")</option>
						<option value="10" #if($pagesize == 10) selected="selected" #end>$tlang.getString("lis.show10")</option>
						<option value="20" #if($pagesize == 20) selected="selected" #end>$tlang.getString("lis.show20")</option>
						<option value="50" #if($pagesize == 50) selected="selected" #end>$tlang.getString("lis.show50")</option>
						<option value="100" #if($pagesize == 100) selected="selected" #end>$tlang.getString("lis.show100")</option>
						<option value="200" #if($pagesize == 200) selected="selected" #end>$tlang.getString("lis.show200")</option>
					</select>
				</form>
				#if ($pagesize != 0)
					#if ($goNPButton == "true")
						<form name="nextpageForm" class="inlineForm" method="post" action="#toolForm("$action")">
							<input type="submit" name="eventSubmit_doList_next" value="&gt;" title="$tlang.getString("list.next") $pagesize"  accesskey="n" />
						</form>
					#else
						<form name="nextpageForm" class="inlineForm" method="post" action="#toolForm("$action")">
							<input type="submit" name="eventSubmit_doList_next" value="&gt;" disabled="disabled" />
						</form>
					#end
					#if ($goNPButton == "true")
						<form name="lastpageForm" class="inlineForm" method="post" action="#toolForm("$action")">
							<input type="submit" name="eventSubmit_doList_last" value="&gt;|" title="$tlang.getString("list.last")" />
						</form>
					#else
						<form name="lastpageForm" class="inlineForm" method="post" action="#toolForm("$action")">
							<input type="submit" name="eventSubmit_doList_last" value="&gt;|" disabled="disabled" />
						</form>
	
					#end
				#end
	
			</div>
		</div>	
		<table class ="listHier lines nolines specialLink" cellspacing="0" summary ="$tlang.getString("lis.summary")">
			<tr>
				<th id="from">
					<a href="#" onclick = "location = '#toolLink($action "doSort_from")';return false;" onkeypress = "location = '#toolLink($action "doSort_from")';return false;" title ="$tlang.getString("lis.sortbysen")">
						$tlang.getString("gen.fro")
						#if ($sort-by == 0)<img border="0" src="#imageLink($sort-img)" alt="$tlang.getString("lis.sortbysen") $sort-dir" />#end
					</a>
				</th>
				<th id="subject">
					<a href="#" onclick = "location = '#toolLink($action "doSort_subject")';return false;" onkeypress = "location = '#toolLink($action "doSort_subject")';return false;"  title = "$tlang.getString("lis.sortbysub")">
						$tlang.getString("gen.sub")
						#if ($sort-by == 2)<img border="0" src="#imageLink($sort-img)" alt="$tlang.getString("lis.sortbysub") $sort-dir" />#end
					</a>
				</th>
				<th id="date">
					<a href="#" onclick = "location = '#toolLink($action "doSort_date")';return false;" onkeypress = "location = '#toolLink($action "doSort_date")';return false;"  title ="$tlang.getString("lis.sortbydat")">
						$tlang.getString("gen.datre")
						#if ($sort-by == 1)<img border="0" src="#imageLink($sort-img)" alt ="$tlang.getString("lis.sortbydat") $sort-dir" />#end
					</a>
				</th>
			</tr>
			#foreach ($item in $messages)
				<tr>
					<td headers="from">$validator.escapeHtml($item.Header.FromAddress)</td>
					<td headers="subject">
						<h4><a href="#" onclick="location = '#toolLinkParam($action "doView" "$view-id=$validator.escapeUrl($item.Header.Id)")';return false;" onkeypress="location = '#toolLinkParam($action "doView" "$view-id=$validator.escapeUrl($item.Header.Id)")';return false;" title="$tlang.getString("lis.viewmessage") $validator.escapeHtml($item.Header.Subject)">
							$validator.escapeHtml($item.Header.Subject)

							## show the paperclip if existing
							#set ($size = 0)
							#if (!$item.Header.Attachments.isEmpty())
								#set ($props = false)
								#set ($size = $item.Header.Attachments.size())
								#foreach ($attachment in $item.Header.Attachments)
									#set ($props = $attachment.Properties)
									#if (!$props)
											#if ($size > 0) #set ($size = $size - 1) #end
									#end
								#end
							#end
							#if ($size == 0)
							#else
								<img src = "#imageLink("sakai/attachments.gif")" border="0" alt="$tlang.getString("lis.att")" />
							#end
						</a></h4>
					</td>
					<td headers="date">$item.Header.DateSent.toStringLocalFullZ()</td>
				</tr>
			#end		
		</table>
	#else
		<p class="instruction">
			$tlang.getString("lis.noema")
		</p>
	#end	
</div>	
