<?php

// -----------------------------------------------------------------------
// This file is part of aroundme
// 
// Copyright (C) 2003, 2005 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
// 
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option) any
// later version.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
// -----------------------------------------------------------------------

?>


<form action="msg_item.php<?php if(isset($message_box)) echo "?".$message_box."=";?>" method="post" name="action">
<input type="hidden" name="message_id" value="<?php echo $message['message_id'];?>" />

<table width="770" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="180" valign="top">

			<?php
			include $templatePath . "msg_menu.inc.tpl.php";
			?>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />

			<table border="0" width="100%" cellspacing="0" cellpadding="4">
				<tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['section_action'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<?php echo $lang['txt_reply_help'];?><br />
					</td>
				</tr>
				<tr>
					<td valign="top" align="right">
						<input type="submit" name="reply" value="<?php echo $lang['sub_reply'];?>" class="formInput"><br />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<?php echo $lang['txt_delete_help'];?><br />
					</td>
				</tr>
				<tr>
					<td valign="top" align="right">
						<input type="submit" name="delete_messages" value="<?php echo $lang['sub_delete'];?>" class="formInput"><br />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<?php echo $lang['txt_mess-status_help'];?><br />
					</td>
				</tr>
				<tr>
					<td valign="top" align="right">
						<input type="submit" name="set_read_messages" value="<?php echo $lang['sub_read'];?>" class="formInput" />&nbsp;&nbsp;&nbsp;
						<input type="submit" name="set_unread_messages" value="<?php echo $lang['sub_unread'];?>" class="formInput" /><br />
					</td>
				</tr>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="52" alt="" /><br />

			<?php
			include $templatePath . "logo.inc.tpl.php";
			?>
		</td>

		<td width="20">&nbsp;</td>

		<td width="370" valign="top">

			<table cellpadding="4" cellspacing="0" border="0" width="100%">
			    <tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['hdr_message'];?><br />
						<hr />
					</td>
				</tr>

				<tr>
					<td>
						<em><?php echo $lang['hdr_message_subject'];?>:</em>
					</td>
					<td>
						<?php echo $message['message_subject'];?>
					</td>
				</tr>
				<tr>
					<td>
						<em><?php echo $lang['hdr_message_sent'];?>:</em>
					</td>
					<td>
					<?php echo $message['message_create_datetime'];?><br />
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<?php echo $message['message_body'];?><br />
					</td>
				</tr>
				<?php
				if (isset($message['message_type']) && $message['message_type'] == 1) { //we display the "add friedn" button
				?>
				<tr>
					<td colspan="2" height="50" valign="middle">
						<a href="add_friend.php?friend=<?php echo $message['from_user_id'];?>" class="error"><?php echo $lang['txt_message_type1'];?></a><br />

					</td>
				</tr>

				<?php }?>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="4" alt="" /><br />

			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td align="right" class="txt_footer">
						<?php echo $lang['txt_message_size'];?>&nbsp;&nbsp;<b><?php echo strlen($message['message_body']);?></b><br />
					</td>
				</tr>
			</table>
		</td>

		<td width="20">&nbsp;</td>

		<td width="180" valign="top">

			<table cellpadding="4" cellspacing="0" border="0" width="100%">
			    <tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['txt_from'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($message['image'])) {
				?>
				<tr>
					<td valign="top">
						<a href="sn_profile.php?user_id=<?php echo $message['from_user_id'];?>"><img src="get_file.php?file=<?php echo $message['image']['file'];?>" align="left" border="0" class="picture" alt="<?php echo $message['image']['file_title'];?>" /></a><br />
					</td>
				</tr>
				<?php }?>
				<tr>
					<td valign="top">
						<a href="sn_profile.php?user_id=<?php echo $message['from_user_id'];?>"><?php echo $message['profile_nic'];?></a><br />
					</td>
				</tr>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />

			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td colspan="3" class="txt_title" align="right">
						<?php echo $lang['hdr_message_statistics'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<table width="100%" cellpadding="4" cellspacing="2" border="0" class="picture">
			    			<tr>
								<td class="bg2">
									<span class="txt_footer">
									<b><?php echo $lang['txt_box'];?></b><br />
									</span>
								</td>
								<td class="bg2">
									<span class="txt_footer">
									<b><?php echo $lang['txt_messages'];?></b><br />
									</span>
								</td>
								<td class="bg2">
									<span class="txt_footer">
									<b><?php echo $lang['txt_size'];?></b><br />
									</span>
								</td>
							</tr>

							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_box_in'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php echo $message_statistics['in_box_messages'];?>&nbsp;(<?php echo $message_statistics['unread'];?>)<br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php echo $message_statistics['in_box_size'];?><br />
									</span>
								</td>
							</tr>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_box_out'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php echo $message_statistics['out_box_messages'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php echo $message_statistics['out_box_size'];?><br />
									</span>
								</td>
							</tr>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_box_save'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php echo $message_statistics['save_box_messages'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php echo $message_statistics['save_box_size'];?><br />
									</span>
								</td>
							</tr>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_totals'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<b><?php echo $message_statistics['total_messages'];?></b><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<b><?php echo $message_statistics['total_size'];?></b><br />
									</span>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<?php
				$percentage_used = floor((100/$message_statistics['total_size_allowed']) * $message_statistics['total_size']);
				if ($percentage_used > 100) {
				    $percentage_used = 100;
				}
				?>
				<tr>
					<td colspan="3">
						<table border="0" cellspacing="2" cellpadding="0" width="100%" class="picture">
							<tr>
								<?php if($percentage_used>0) {?>
								<td width="<?php echo $percentage_used;?>%" class="bg1">
									<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="7" alt="" /><br />
								</td>
								<?php }?>
								<td class="bg2">
									<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="7" alt="" /><br />
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td class="txt_footer" align="right" colspan="3">
						<?php echo $percentage_used;?>&#37; used<br />
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</form>
