Skip to content

Commit

Permalink
add quote thingy to tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargaj committed Jun 20, 2015
1 parent f786ff4 commit 4642fc7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
10 changes: 10 additions & 0 deletions ajax_prodcomment.php
@@ -0,0 +1,10 @@
<?
require_once("bootstrap.inc.php");

header("Content-type: application/json; charset=utf-8");

$sql = sprintf_esc("select * from comments where id = %d limit 1",$_POST["id"]);
$r = SQLLib::selectRow($sql);

echo json_encode($r);
?>
17 changes: 16 additions & 1 deletion include_pouet/box-prod-post.php
Expand Up @@ -134,7 +134,7 @@ function RenderBody() {
echo " <input type='radio' name='rating' id='ratingsucks' value='sucks'/> <label for='ratingsucks'>sucks</label>\n";
echo " </div>\n";
}
echo " <textarea name='comment'></textarea>\n";
echo " <textarea name='comment' id='comment'></textarea>\n";
echo " <div><a href='faq.php#BB Code'><b>BB Code</b></a> is allowed here</div>\n";
echo "</div>\n";
echo "<div class='foot'>\n";
Expand All @@ -145,6 +145,21 @@ function RenderBody() {
<script language="JavaScript" type="text/javascript">
<!--
document.observe("dom:loaded",function(){
$$(".tools").each(function(item){
var cid = item.readAttribute("data-cid");
item.update("<a href='#'>quote</a> |");
item.down("a").observe("click",function(e){
e.stop();
new Ajax.Request("ajax_prodcomment.php",{
"method":"post",
"parameters":$H({"id":cid}).toQueryString(),
"onSuccess":function(transport){
$("comment").value += "[quote]" + transport.responseJSON.comment.strip() + "[/quote]";
}
});
try { $("comment").scrollTo(); } catch(ex) {} // needs try-catch because of some dumbass popup blockers
});
});
AddPreviewButton($('submit'));
PreparePostForm( $$("#pouetbox_prodpost form").first() );
});
Expand Down
2 changes: 1 addition & 1 deletion prod.php
Expand Up @@ -642,7 +642,7 @@ function RenderBody()
unset($main->userCDCs[$c->user->id]);
}

echo "added on the <a href='prod.php?post=".$c->id."'>".$c->addedDate."</a> by ";
echo "<span class='tools' data-cid='".$c->id."'></span> added on the <a href='prod.php?post=".$c->id."'>".$c->addedDate."</a> by ";
echo $c->user->PrintLinkedName()." ".$c->user->PrintLinkedAvatar();

echo "</div>\n";
Expand Down

0 comments on commit 4642fc7

Please sign in to comment.