<?php
require_once('../Connections/PLT.php');
//setting these variables manually for test page purpose
$to = 'joshua';
$from = 'joshua';
mysql_select_db($database_PLT, $PLT); // Gets all wall posts
$query_wall_posts = "SELECT A1.user_id, A1.first_name, A1.last_name, A2.reply, A2.post_message, A2.timestamp, COALESCE(A2.reply_to_id, A2.post_id)reply_id FROM users A1, wall_posts A2 WHERE A1.username = A2.from AND A2.to = 'joshua' ORDER BY reply_id DESC, timestamp";
$wall_posts = mysql_query($query_wall_posts, $PLT) or die(mysql_error());
$row_wall_posts = mysql_fetch_assoc($wall_posts);
$totalRows_wall_posts = mysql_num_rows($wall_posts);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="../includes18/jQuery/css/plt-theme/jquery-ui-1.8.2.custom.css" rel="stylesheet" type="text/css" />
<link href="../main.css" rel="stylesheet" type="text/css" />
<script src="../includes18/jQuery/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="../includes18/jQuery/js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
<script src="../scripts/wall_buttons.js" type="text/javascript"></script>
<script type="text/javascript">
var data_part1 = "";
$(function() {
$("#comment_dialog").dialog({
autoOpen: false,
height: 180,
width: 560,
modal: true
});
$(".faux_link").click(function() {
$('#comment_dialog').dialog('open');
data_part1 = $(this).attr('name');
});
$("#add_comment_button").click(function() {
$("#comment_dialog").dialog('close');
var query_string = data_part1 + $('#comment_input').val();
$.ajax({
url: "../scripts/comment_dialog.php",
dataType: "html",
data: query_string,
success: function(data){
$('#wall_post_cont').html(data);
}
});
});
});
</script>
</head>
<body style="background-color:#FFF;">
<div id="desktop_right">
<div id="wall_post_cont">
<?php if($totalRows_wall_posts > 0) { //show if recordest is not empty ?>
<?php do { ?>
<?php if ($row_wall_posts['reply'] == 'N') { //show if not reply ?>
<div class = "wall_post">
<div class = "poster_img">
</div>
<div class = "post">
<a href="visitor.php?i=<?php echo $row_wall_posts['user_id']?>"><strong><?php echo $row_wall_posts['first_name'] . ' ' . $row_wall_posts['last_name']; ?></strong></a> <?php echo $row_wall_posts['post_message']; ?><br /><span style="line-height: 2.0; font-size:10px; "><?php echo date('F j, Y at g:ia', strtotime($row_wall_posts['timestamp'])); ?> | <span class="faux_link" name="<?php echo "reply_id=" . $row_wall_posts['reply_id'] . "&to=" . $to . "&from=" . $from . "&post_message="; ?>">Comment</span></span>
</div>
<div class="remove_button_cont">
<button style="float:right;">Remove</button>
</div>
</div>
<?php } // Show if not reply ?>
<?php if ($row_wall_posts['reply'] == 'Y') { //show if reply ?>
<div class="reply_cont">
<div class="reply_top">
</div>
<div class="reply_img">
</div>
<div class="reply">
<a href="visitor.php?i=<?php echo $row_wall_posts['user_id']?>"><strong><?php echo $row_wall_posts['first_name'] . ' ' . $row_wall_posts['last_name']; ?></strong></a> <?php echo $row_wall_posts['post_message']; ?><br /><span style="line-height: 2.0;"><?php echo date('F j, Y at g:ia', strtotime($row_wall_posts['timestamp'])); ?> | <span class="faux_link" name="<?php echo "reply_id=" . $row_wall_posts['reply_id'] . "&to=" . $to . "&from=" . $from . "&post_message="; ?>">Comment</span><!-- I'm setting this name attr with my ajax data to be sent--></span>
</div>
</div>
<?php } // Show if reply ?>
<?php } while ($row_wall_posts = mysql_fetch_assoc($wall_posts)); ?>
<?php } // Show if recordset is empty ?>
</div>
</div>
<div id="comment_dialog" title="Comment">
<textarea style="margin-top: 15px;" name="comment_input" rows="3" id="comment_input" ></textarea>
<span style="float:right; margin-top:10px; font-size:12px">
<input id="add_comment_button" class="input_button" name="submit" type="submit" value="Submit" />
</span>
</div>
</body>
</html>
|