facebook style comments

This commit is contained in:
Mike Macgirvin 2010-07-12 00:49:06 -07:00
parent 4e40156607
commit b0f8cd5fe6
3 changed files with 21 additions and 12 deletions

View file

@ -7,6 +7,14 @@
document.getElementById(theID).style.display = "block" document.getElementById(theID).style.display = "block"
} }
} }
function openMenu(theID) { function openMenu(theID) {
document.getElementById(theID).style.display = "block" document.getElementById(theID).style.display = "block"
} }
function closeMenu(theID) {
document.getElementById(theID).style.display = "none"
}

View file

@ -216,16 +216,17 @@ dbg(2);
$tpl = file_get_contents('view/wall_item.tpl'); $tpl = file_get_contents('view/wall_item.tpl');
if(count($r)) { if(count($r)) {
foreach($r as $rr) { for($x = 0; $x < count($r); $x ++) {
$rr = $r[$x];
$comment = '';
if(can_write_wall($a,$a->profile['profile_uid'])) { if(can_write_wall($a,$a->profile['profile_uid'])) {
if((($x + 1) < count($r)) && ($r[$x+1]['parent'] != $rr['parent'])) {
$comment = replace_macros($template,array( $comment = replace_macros($template,array(
'$id' => $rr['item_id'], '$id' => $rr['item_id'],
'$parent' => $rr['parent'], '$parent' => $rr['parent'],
'$profile_uid' => $a->profile['profile_uid'] '$profile_uid' => $a->profile['profile_uid']
)); ));
} }
else {
$comment = '';
} }
$o .= item_display($a,$rr,$tpl,$comment); $o .= item_display($a,$rr,$tpl,$comment);
} }

View file

@ -1,14 +1,14 @@
<div class="comment-edit" id="comment-edit-$id" onclick="openClose('comment-edit-wrapper-$id');" >Comments</div> <div class="comment-edit" id="comment-edit-$id" onclick="openClose('comment-edit-wrapper-$id');" >Comments</div>
<div class="comment-edit-wrapper" id="comment-edit-wrapper-$id" style="display: none;"> <div class="comment-edit-wrapper" id="comment-edit-wrapper-$id" style="display: block;">
<form class="comment-edit-form" id="comment-edit-form-$id" action="item" method="post" > <form class="comment-edit-form" id="comment-edit-form-$id" action="item" method="post" >
<input type="hidden" name="type" value="jot" /> <input type="hidden" name="type" value="jot" />
<input type="hidden" name="profile_uid" value="$profile_uid" /> <input type="hidden" name="profile_uid" value="$profile_uid" />
<input type="hidden" name="parent" value="$parent" /> <input type="hidden" name="parent" value="$parent" />
<textarea rows="3" cols="40" id="comment-edit-text-$id" name="body" ></textarea> <textarea rows="2" cols="24" id="comment-edit-text-$id" name="body" onFocus="this.rows=5; this.cols=40; openMenu('comment-edit-submit-$id');" onBlur="this.rows=2; this.cols=24; closeMenu('comment-edit-submit-$id'); this.value='';"></textarea>
<div id="comment-edit-submit-wrapper" > <div class="comment-edit-submit-wrapper" id="comment-edit-submit-$id" style="display: none;" >
<input type="submit" id="comment-edit-submit" name="submit" value="Submit" /> <input type="submit" id="comment-edit-submit" name="submit" value="Submit" />
</div> </div>
<div id="comment-edit-end"></div> <div id="comment-edit-end"></div>