	##<!-- $Header: /cvs/sakai2/legacy/tools/src/webapp/vm/discussion/chef_threaded_discussionsII-Control.vm,v 1.7 2005/06/09 14:46:22 zqian.umich.edu Exp $ -->
<div class="portletBody">
 	#if($menu)#toolbar($menu)#end
	 ## this is double deep
	<script type="text/javascript" language="JavaScript">
		doubleDeep = true;
	</script>
	## to prevent horiz scroll on IE
 ##(gsilver - no longer need this, but leave in case)
	<!--[if IE]>
		<script type="text/javascript" language="JavaScript">
			document.body.style.width='95%'
		</script>
	<![endif]--> 
		#set ($form="controlform")
		#set($id = $!currentMessage.getId())
		#if ($!id.length()>0)
			#set ($category = $currentMessage.getDiscussionHeader().getCategory())
			#set ($starOrThread = "thread")
			#set ($props = $topic.getProperties())
			#if ($!props)
				#set ($starOrThread = $props.getProperty($props.getNamePropReplyStyle()))
			#end
			#if ($currentMessage.getDiscussionHeader().getDraft()) ##looking at a draft message
				<script type="text/javascript">
					focus_path = [ "subject" ];
					if (parent) if (parent.parent) parent.parent.window.scrollTo(0,400);
				</script>
					<h3>
						$tlang.getString("control.edidra")
					</h3>
						#if ($alertMessage)<div class="alertMessage">$tlang.getString("gen.alert") $validator.escapeHtml($alertMessage)</div>#end
						<form action="#toolForm($action)" method="post">
							<input type="hidden" name="messageId" value="$id" />
							<input type="hidden" name="panel" value="main" />
							<table class="itemSummary" summary="$tlang.getString("control.thitabcon")">	
								<tr>
									<th>
										$tlang.getString("gen.cat")
									</th>
									<td>	
										$validator.escapeHtml($draftCategory)
									</td>
								</tr>
								#if ($currentMessage.ReplyToDepth != 0)
									<tr>
										<th>
											$tlang.getString("gen.top")
										</th>
										<td>
											$topic.getDiscussionHeader().getSubject()
										</td>
									</tr>
								#end
								<tr>
									<th>
										#if ($currentMessage.ReplyToDepth != 0)
											<span class="highlight">*</span>
											<label for="subject">
												$tlang.getString("gen.sub2")
											</label>
										#else
											<span class="highlight">*</span>
											<label for="subject">
													$tlang.getString("gen.sub2")											
											</label>
										#end
									</th>
									<td>
										<input type="text" name ="subject" id ="subject" value="$validator.escapeHtml($draftSubject)" />
									</td>
								</tr> 
								<tr>
									<th>
										$tlang.getString("gen.fro2")
									</th>
									<td>
										$validator.escapeHtml($currentMessage.getDiscussionHeader().getFrom().getDisplayName())
									</td>
								</tr> 
								<tr>
									<th>
										$tlang.getString("control.dat")
									</th>
									<td>
										$currentMessage.getDiscussionHeader().getDate().toStringLocalFullZ()
									</td>
								</tr>
							</table>

							<h4>$tlang.getString("control.reptyp")</h4>
							#if ($currentMessage.getReplyToDepth()==0)
								#if ($draftStyle.equals("thread"))
									<p class="checkbox"><input type="radio" name="style" value="thread" checked="checked" id="styleThread" /><label for="styleThread">$tlang.getString("control.allrep1")</label></p>
									<p class="checkbox"><input type="radio" name="style" value="star" id="styleStar" /><label for="styleStar">$tlang.getString("control.allrep2")</label></p>
								#else
									<p class="checkbox"><input type="radio" name="style" value="thread" /><label for="styleThread">$tlang.getString("control.allrep1")</label></p>
									<p class="checkbox"><input type="radio" name="style" value="star" checked="checked" id="styleStar"  /><label for="styleStar">$tlang.getString("control.allrep2")</label></p>
								#end
							#else
								#if ($starOrThread == "thread")
									$tlang.getString("control.allrep1")
								#else
									$tlang.getString("control.allrep2")
								#end
							#end

							<div class="longtext">
								<label for="body" class="block">
								<span class="reqStar">*</span>
									$tlang.getString("gen.mes")
								</label>
								<table border="0">
									<tr>
										<td>
											<textarea name = "body" id = "body" cols="80" rows="30" wrap="virtual">$validator.escapeHtmlFormattedTextarea($draftBody)</textarea>
											#chef_setupformattedtextarea("body")
										</td>
									</tr>
								</table>
							</div>	
							<h4>$tlang.getString("control.att2")</h4>
								#set ($size = 0)
								#set ($props = false)
								#foreach ($attachment in $attachments) 
									#set ($props = $attachment.Properties) 
									#if ($!props)
										#set ($size = $size + 1)
									#end
								#end
								#if ($size == 0)
									$tlang.getString("gen.noatt")
									<div class="act">
										<input type="submit" name="eventSubmit_doAttachments" value="$tlang.getString("gen.addatt")" />
									</div>
								#else
									<ul class="attachList indnt1">
										#foreach ($attachment in $attachments) 
											#set ($props = false)
											#set ($props = $attachment.Properties) 
											#if ($!props)
												<li>
													#if ($props.getBooleanProperty($props.NamePropIsCollection))
														<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" alt="$tlang.getString("gen.folatt")" />
													#else
														<img src = "#imageLink($contentTypeImageService.getContentTypeImage($props.getProperty($props.NamePropContentType)))" border="0" alt="$tlang.getString("gen.filatt")" />
													#end
													<a href="$attachment.Url" target="_blank">$validator.escapeHtml($props.getPropertyFormatted($props.NamePropDisplayName))</a>						
													#if (!$props.getBooleanProperty($props.NamePropIsCollection))
														($props.getPropertyFormatted($props.NamePropContentLength))
													#end
												</li>
											#end
										#end
									</ul>
									<div class="act">
										<input type="submit" name="eventSubmit_doAttachments" value="$tlang.getString("gen.addrem")" />
									</div>
								#end							
								<p class="act">
									#if ($currentMessage.getReplyToDepth()==0)
										## post topic
										<input type="submit" accesskey="s" class="active" name="eventSubmit_doPost" value="$tlang.getString("gen.pos")" />
									#else
										## post message
										<input type="submit" accesskey="s" class="active" name="eventSubmit_doPost" value="$tlang.getString("rep.addrep")" />
									#end
									<input type="submit" accesskey="d" name="eventSubmit_doSave" value="$tlang.getString("gen.savdra")" />
									<input type="submit" accesskey="x" name="eventSubmit_doCancel_draft" value="$tlang.getString("gen.can")" />
								</p>
						</form>
						#else
							## a posted message
##							<div class="breadCrumb">
								## (gsilver) should trim the subject below as is done in the list	
								## below - if the top topic subject and the subject of this message parents is the same, just do one, as it is likely I am seeing a reply to a topic.
								##$validator.escapeHtml($category) &gt; $topic.getDiscussionHeader().getSubject() &gt; $validator.escapeHtml($currentMessage.getDiscussionHeader().getSubject())
##							</div>
								<h3 class="textPanelHeader">$!messagePath</h3> 


								<div class="textPanelFooter"> 
								$tlang.getString("gen.fro")
								$validator.escapeHtml($currentMessage.getDiscussionHeader().getFrom().getDisplayName()) ($currentMessage.getDiscussionHeader().getDate().toStringLocalFullZ())
								</div>

								<div class="textPanel">
									<div class="disc">
									$validator.escapeHtmlFormattedText($currentMessage.getBody())
								</div>
								</div>
								#set ($size = 0)
								#set ($props = false)
								#foreach ($attachment in $currentMessage.Header.Attachments) 
									#set ($props = $attachment.Properties) 
									#if ($!props)
										#set ($size = $size + 1)
									#end
								#end
								#if ($size != 0)
									<ul class="attachList">
										#foreach ($attachment in $currentMessage.Header.Attachments) 
											#set ($props = false)
											#set ($props = $attachment.Properties) 
											#if ($!props)
												<li>
													#if ($props.getBooleanProperty($props.NamePropIsCollection))
														<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" alt="$tlang.getString("genl.folatt")" />
													#else
														<img src = "#imageLink($contentTypeImageService.getContentTypeImage($props.getProperty($props.NamePropContentType)))" border="0" alt="$tlang.getString("gen.filatt")" />
													#end
													<a href="$attachment.Url" target="_blank">$validator.escapeHtml($props.getPropertyFormatted($props.NamePropDisplayName))</a>						
													#if (!$props.getBooleanProperty($props.NamePropIsCollection))
														($props.getPropertyFormatted($props.NamePropContentLength))
													#end
												</li>
											#end
										#end
									</ul>
								#end

							#if ($!allow-send)
								<form action="#toolForm($action)" method="post">
									<input type="hidden" name="topicId" value="$!topic.getId()" />
									<div class="act" style="padding:0">
										#if ($currentMessage.ReplyToDepth != 0 && $!style == "thread")
											<input type="submit" name="eventSubmit_doSet_reply_msg" value="$tlang.getString("control.repmsg")" />
										#end
										<input type="submit" name="eventSubmit_doSet_reply_topic" value="$tlang.getString("control.reptop")" />
									</div>
								</form>
							#end
						#end
					#else
						<form action="#toolForm($action)" method="post">
						</form>
					#end
	</div>

