Update of /cvsroot/phpwebapp/top10/templates/proj_details/comments
In directory sc8-pr-cvs1:/tmp/cvs-serv15358/templates/proj_details/comments
Modified Files:
comments.php comments.js comments.db
Log Message:
keep comment count up to date
Index: comments.php
===================================================================
RCS file: /cvsroot/phpwebapp/top10/templates/proj_details/comments/comments.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** comments.php 29 Dec 2003 14:59:40 -0000 1.4
--- comments.php 29 Dec 2003 15:56:37 -0000 1.5
***************
*** 11,15 ****
--- 11,26 ----
$params["date"] = date("Y-m-d");
$params["ip"] = $_SERVER["REMOTE_ADDR"];
+ //add the comment record
WebApp::execDBCmd("insert_comment", $params);
+
+ $this->update_comment_count();
+ }
+
+ function update_comment_count()
+ {
+ //update the comment count of the project
+ $rs = WebApp::openRS("comment_list");
+ $nr_comments = $rs->count;
+ WebApp::execDBCmd("update_comment_count", compact("nr_comments"));
}
***************
*** 19,22 ****
--- 30,34 ----
{
WebApp::execDBCmd("delete_comment", $event_args);
+ $this->update_comment_count();
return;
}
Index: comments.js
===================================================================
RCS file: /cvsroot/phpwebapp/top10/templates/proj_details/comments/comments.js,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** comments.js 29 Dec 2003 14:59:40 -0000 1.3
--- comments.js 29 Dec 2003 15:56:37 -0000 1.4
***************
*** 28,32 ****
+ "title=" + title + ";"
+ "comment=" + comment;
! alert(event_args);
SendEvent("comments", "add_comment", event_args);
}
--- 28,32 ----
+ "title=" + title + ";"
+ "comment=" + comment;
!
SendEvent("comments", "add_comment", event_args);
}
Index: comments.db
===================================================================
RCS file: /cvsroot/phpwebapp/top10/templates/proj_details/comments/comments.db,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** comments.db 29 Dec 2003 14:59:40 -0000 1.4
--- comments.db 29 Dec 2003 15:56:37 -0000 1.5
***************
*** 29,32 ****
--- 29,40 ----
</dbCommand>
+ <dbCommand ID="update_comment_count">
+ <Query>
+ UPDATE proj_list
+ SET nr_comments = '{{nr_comments}}'
+ WHERE proj_id = '{{proj_id}}'
+ </Query>
+ </dbCommand>
+
<Recordset ID="get_comment">
<Query>
|