{if not $smarty.session.uid} {* if unlogged *}
	{assign var=disabled value='onClick="alertNoChange();"'}
{else}
	{assign var=disabled value=""}
{/if}
<!-- File title : project title : next/previous links and back to list link -->
<table border="0">
	<tr>
		<td>
			<B> <!-- PAGE TITLE -->
				{$TITLE.file_edition} {$file.bug_id.value}
			</B>
			<b> <!-- file title -->
				<br>
				{$file.title.field_conf.title} : <i>{$file.title.value}</i>
			</b>
		</td>
		<!-- previous next links -->
		<!-- 
		<td align="right">
			{if $prevbug}
				<b>
					<a href="bug.php?op=show&bugid={$prevbug}&pos={$prevpos}">
						{$STRING.previous_bug}
					</a>
				</b>
			{/if}
			{if $prevbug and $nextbug}
				|
			{/if}
			{if $nextbug}
				<b><a href="bug.php?op=show&bugid={$nextbug}&pos={$nextpos}">{$STRING.next_bug}</a></b>
			{/if}
		</td>
		-->
	</tr> 
</table>
<br>
<table border="0" cellspacing="0" cellpadding="3">
	{if $error.status}
		<tr>
			<td class="error" colspan=6>
				{$error.status}
			</td>
		</tr>
	{/if}
	{assign var=Shift value='null'}
	{foreach key=k item=v name=std_fields from=$fc_filtered}
			{* if true, create a new table row *}
			{if $smarty.foreach.std_fields.iteration is odd && $Shift=='null'}
				<TR valign="top">
			{else}
				{if $smarty.foreach.std_fields.iteration is even && $Shift=='offset'}
					<TR valign="top">
				{else}
					{if $mpfile->sp_cache.$k->label}
						<TR valign="top">
					{/if}
				{/if}
			{/if}
			<TD align="left">
				<B>
					{if $mpfile->sp_cache.$k->highlight_url}
						<!-- convert the title into a link -->
						<A href="{$file.$k.value|url_with_header_encode}" target="new">
					{/if}
					{$v.title} :
					{if $mpfile->sp_cache.$k->highlight_url}
						</A>
					{/if}
				</B>
			</TD>
			<TD> <!-- 'k' is also the field_name  -->
				{if $k == 'assigned_to'}
					{build_dynamic_input 
						field_conf=$v 
						file_id=$file.bug_id.value
						name='_no_name'
						value=$file.$k.value
						mpfile=$mpfile
						read_only=1							
					}
				<!-- the project id is handled like a normal field
				{literal}					
				{elseif ($k == 'project_id')}
					{build_dynamic_input 
						field_conf=$v 
						file_id=$file.bug_id.value
						name='_no_name'
						value=$project_id
						mpfile=$mpfile
						read_only=1
					}
				{/literal}
				-->
				{else} 
					{build_dynamic_input 
						field_conf=$v 
						file_id=$file.bug_id.value
						name=$v.field_name
						value=$file.$k.value
						mpfile=$mpfile
						read_only=1
					}
				{/if}
			</TD>
			<TD>
			&nbsp;&nbsp;&nbsp;
			</TD>
			{if $mpfile->sp_cache.$k->dashAfter || $mpfile->sp_cache.$k->label}
				{if $mpfile->sp_cache.$k->dashAfter}
					</TR>
  					<tr>
		  			<td class="underlined"><img src="{$template_path}/images/title.gif"  width="32" height="1"></td>
					<td class="underlined"><img src="{$template_path}/images/title.gif"  width="32" height="1"></td>
					<td class="underlined"><img src="{$template_path}/images/title.gif"  width="32" height="1"></td>
					<td class="underlined"><img src="{$template_path}/images/title.gif"  width="32" height="1"></td>
					<td class="underlined"><img src="{$template_path}/images/title.gif"  width="32" height="1"></td>
					</TR>
				{/if}
				{if $smarty.foreach.std_fields.iteration is odd}
					{if $Shift=='null'}
						{assign var=Shift value='offset'}
					{else}
						{assign var=Shift value='offset'}
					{/if}
				{else}
					{if $Shift=='offset'}
						{assign var=Shift value='null'}
					{else}
						{assign var=Shift value='null'}
					{/if}
				{/if}
			{else}
				{if $smarty.foreach.std_fields.iteration is even && $Shift=='null'}
					</TR>		
				{/if}
				{if $smarty.foreach.std_fields.iteration is odd && $Shift=='offset'}
					</TR>		
				{/if}
			{/if}
	{/foreach}
</table>
<br>
{if $smarty.session.uid}  {* if logged *}
<table cellspacing=8>		
	<tr>
		<td colspan="2" valign="top">
		{$STRING.BUGDISPLAY.bugdependency} : {$bug_dependencies} <br>
		</td>
	</tr>
	<tr>
		<td colspan="2" valign="top">
			{$STRING.BUGDISPLAY.contact_list} : 
			<br>
			{if count($contact_list)}
			{foreach key=k item=v name=cclist from=$contact_list}
				<a href="mailto:{$v.email|htmlspecialchars}">
					{$v.first_name|htmlspecialchars} {$v.last_name|htmlspecialchars}
				</a>
			{/foreach}
			{else}
				{$STRING.nobody}
			{/if}	
		</td>
	</tr>	
</table>
{/if}
<br>

<!-----------------------------COMMENTS-------------------------------->
<table border="0" cellpadding="2" cellspacing="0" width="100%">
	<tr>
		<td>
			<table border="0" cellpadding="0">
				{if $attachments}
				<tr>
					<!-----------------------------ATTACHMENTS-------------------------------->
					<td colspan="7">
						{$STRING.BUGDISPLAY.attachments} :
					</td>					
				</tr>
				<tr>
					<td align="center"><b>{$STRING.BUGDISPLAY.name}</b></td>
					<td>|</td>
					<td align="center"><b>{$STRING.BUGDISPLAY.size}</b></a></td>
					<td>|</td>
					<td align="center"><b>{$STRING.BUGDISPLAY.type}</b></a></td>
					<td>|</td>
					<td align="center"><b>{$STRING.BUGDISPLAY.created}</b></a></td>
					<td align="center">&nbsp;</a></td>
				</tr>
				{section name=attachment loop=$attachments}
				<tr title="{$attachments[attachment].description|stripslashes}">
					<td>
						{$attachments[attachment].file_name|stripslashes}
					</td>
					<td>|</td>
					<td align="right">
						{if $attachments[attachment].file_size > 1024}
							{math equation="(round(x) / 1024 * 100) / 100" x=$attachments[attachment].file_size assign=file_size}
							{$file_size|number_format}k
						{else}
							{$attachments[attachment].file_size|number_format}b
						{/if}
					</td>
					<td>|</td>
					<td align="center">{$attachments[attachment].mime_type}</td>
					<td>|</td>
					<td align="center">{$attachments[attachment].created_date|date:DATE_FORMAT}</td>
					<td>|</td>
					<td align="center">
						<a href='attachment.php?attachid={$attachments[attachment].attachment_id}'>View</a>						
					</td>
				</tr>
				{/section}
			{else}
				<tr>
					<td colspan="5" align="center">{$STRING.BUGDISPLAY.noattachments}</td>
				</tr>
			{/if}				
			</table>
		</td>
	</tr>
</table>
<br>
<br>
<table border="0" cellpadding="2" cellspacing="0">
	<tr>
		<td>
			{$STRING.BUGDISPLAY.comments} :
		</td>
	</tr>
	<tr>
		<td>
			<i>
				--- {$STRING.BUGDISPLAY.postedby} : 
				{build_dynamic_input 
					field_conf=$file.created_by.field_conf
					file_id=$file.bug_id.value
					name='_no_name'
					value=$file.created_by.value
					mpfile=$mpfile
					read_only=1
					no_html=1
				}
				{$STRING.BUGDISPLAY.date} : {$file.created_date.value|date:TIME_FORMAT} {$STRING.BUGDISPLAY.dateon} {$file.created_date.value|date:DATE_FORMAT} ---
			</i>
		</td>
	</tr>
	<tr>
		<td>
			{$STRING.description_of_file} : 				
			<br>
			{$file.description.value|htmltruespace|nl2br|format_comments}
			<br>
			<br>
		</td>
    </tr>
	{section name=comment loop=$comments}
	<tr>
		<td>
			<i>
				--- {$STRING.BUGDISPLAY.postedby} : {$comments[comment].login|maskemail}
				{$STRING.BUGDISPLAY.date} : {$comments[comment].created_date|date:TIME_FORMAT} {$STRING.BUGDISPLAY.dateon} {$comments[comment].created_date|date:DATE_FORMAT} ---
			</i>
		</td>
	</tr>
	<tr>
		<td>
			{* $comments[comment].comment_text|stripslashes|htmltruespace|nl2br|format_comments *}
			{* I consider that the comment has been stripslashed before being inserted in DB *}
			{$comments[comment].comment_text|htmltruespace|nl2br|format_comments}
			<br><br>
		</td>
	</tr>
{/section}
</table>
<br>
&nbsp;&nbsp;&nbsp;<a href="bug.php?op=show&file_id={$file.bug_id.value}">{$STRING.back} FM {$file.bug_id.value}</a>
