<?php
include("includes/site_info.php");
include('session_handler.inc');
include_once __INCLUDE_CLASS_PATH."/class.Picture.php";
$picture = new Picture();

$WUsername = $_SESSION['Sess_UserName'];
$WUserID = $_SESSION['Sess_UserId'];

$article_query=mysql_query("SELECT *, UNIX_TIMESTAMP(art_datetime) as artdate FROM articles WHERE art_userid = '$WUserID' AND art_approved='Y' ORDER BY art_datetime DESC",$link) or die(mysql_error());
$article_TOTAL = mysql_num_rows($article_query);



?>

<div id="top_panel" class="grey_row_back">
  <?php include ("panel_top.php"); ?>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5" class="white_back_t_xb">
        <tr>
          <td><div class="light_orang_h">
              <div style="background-color:#FF0000; width:10px; height:10px; float:left; margin-top:3px; margin-right:5px;"><img src="images/spacer.gif" width="10" height="10" /></div>
              Notes </div>
            <div class="dot_line"><img src="images/spacer.gif" width="1" height="1" /></div>
            <div class="solid_line"><img src="images/spacer.gif" width="1" height="1" /></div></td>
        </tr>
        <tr class="lightgrey_10">
          <td align="center"><a title="Add Note" href="#caddnote?tab=thought" onclick="javascript: callpage(this.href);" rel="subpage_link">Add Note</a> | <a href="#cthought" onclick="javascript: callpage(this.href);">Back to Thought</a></td>
        </tr>
        <tr>
          <td><?php if ($article_TOTAL > 0){ ?>
            <table border="0" cellpadding="5" cellspacing="0" class="white_back_t_xb">
              <?php 
			$i=1;
			while ($article = mysql_fetch_object($article_query) ) {
			if(file_exists($SITE_MAIN_ROOT."/members/".$WUsername."/article/".$article->art_picture."_small.".$article->art_ext)){ $image=$SITE_MAIN_WWW_ROOT."/members/".$WUsername."/article/".$article->art_picture."_small.".$article->art_ext ;}  else {$image="$CONST_LINK_ROOT/images/icon-post.gif";}
			if ($i>1) $tr='<tr class="solid_line_separator"><td colspan="4"><img src="images/spacer.gif" height="3"/></td></tr>'; else $tr='';
			?>
              <?=$tr?>
              <tr>
                <td width='50px' align='left' valign="top"><a title="View Note" href="#cshownote?tab=thought&aid=<?=$article->art_id?>" onclick="javascript: callpage(this.href);" rel="subpage_link"><img src='<?=$image?>' title='<?=$article->art_title?>' border="0" class="img_b_p3"/></a></td>
                <td width='100px' align='left' valign="top"><a href='#cshownote?tab=thought&aid=<?=$article->art_id?>' onclick="javascript: callpage(this.href);" rel="subpage_link"><b>
                  <?=$article->art_title?>
                  </b></a><br>
                  <span class="lightgrey_10">
                  <?php if($article->art_private=='Y') echo "Private"; elseif($article->art_private=='N') echo"Public";?>
                  <br />
                  <?=date("d M'y h:ia",$article->artdate)?>
                  </span><br />
                  <span class="line_height20 grey_10"><a title="Edit Note" href="#ceditnote?tab=thought&aid=<?=$article->art_id?>" onclick="javascript: callpage(this.href);" rel="subpage_link">Edit</a> | <a title="View Note" href="#cshownote?tab=thought&aid=<?=$article->art_id?>" onclick="javascript: callpage(this.href);" rel="subpage_link">View</a> | <a title="Delete Note" href="javascript: void(null)" rel="facebox" onclick="javascript: jQuery.facebox({ajax:'editartdelete.php?aid=<?=$article->art_id?>'}, 'Delete&nbsp;Note');">Delete</a></span></td>
                <td align='justify' valign="top">
				<?php 
				$short_msg_text=strip_tags(stripslashes(substr($article->art_message,0,450)));
				if (strlen (strip_tags($article->art_message))>450) $short_msg_text.="...";
				echo $short_msg_text;
				?>
				</td>
              </tr>
              <?php
    $i++;
	}
	?>
            </table>
            <?php
} else {
     print(NO_RECORDS_SECTION_NAME);
}
?>
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
