Index: openacs-4/packages/general-comments/tcl/general-comments-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/general-comments/tcl/general-comments-procs-oracle.xql 14 Jun 2001 19:38:05 -0000 1.1
@@ -0,0 +1,87 @@
+
+
+
+ oracle8.1.6
+
+
+
+
+ select g.comment_id,
+ r.title,
+ r.mime_type,
+ o.creation_user,
+ acs_object.name(o.creation_user) as author,
+ to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date,
+ to_char(o.creation_date, 'Month DD, YYYY HH12:MI PM') as pretty_date2
+ $content_select
+ from general_comments g,
+ cr_revisions r,
+ acs_objects o
+ where g.object_id = :object_id and
+ r.revision_id = content_item.get_live_revision(g.comment_id) and
+ o.object_id = g.comment_id
+ order by o.creation_date
+
+
+
+
+
+
+
+ select site_node.url(s.node_id) as package_url
+ from site_nodes s, apm_packages a
+ where s.object_id = a.package_id and
+ lower(a.package_key) = 'general-comments' and
+ RowNum = 1
+
+
+
+
+
+
+
+ select site_node.url(s.node_id)
+ from site_nodes s, apm_packages a
+ where s.object_id = a.package_id and
+ a.package_key = 'general-comments'
+
+
+
+
+
+
+
+ select g.comment_id,
+ r.title,
+ r.content,
+ r.mime_type,
+ o.creation_user,
+ to_char(o.creation_date, 'MM-DD-YYYY') as creation_date,
+ p.first_names || ' ' || p.last_name as author
+ from general_comments g,
+ cr_items i,
+ cr_revisions r,
+ acs_objects o,
+ persons p
+ where g.object_id = :object_id and
+ i.item_id = g.comment_id and
+ r.revision_id = i.live_revision and
+ o.object_id = g.comment_id and
+ p.person_id = o.creation_user
+ order by creation_date
+
+
+
+
+
+
+
+ select site_node.url(s.node_id)
+ from site_nodes s, apm_packages a
+ where s.object_id = a.package_id and
+ a.package_key = 'general-comments'
+
+
+
+
+
Index: openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql 14 Jun 2001 19:38:05 -0000 1.1
@@ -0,0 +1,87 @@
+
+
+
+ postgresql7.1
+
+
+
+
+ select g.comment_id,
+ r.title,
+ r.mime_type,
+ o.creation_user,
+ acs_object__name(o.creation_user) as author,
+ to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date,
+ to_char(o.creation_date, 'Month DD, YYYY HH12:MI PM') as pretty_date2
+ $content_select
+ from general_comments g,
+ cr_revisions r,
+ acs_objects o
+ where g.object_id = :object_id and
+ r.revision_id = content_item__get_live_revision(g.comment_id) and
+ o.object_id = g.comment_id
+ order by o.creation_date
+
+
+
+
+
+
+
+ select site_node__url(s.node_id) as package_url
+ from site_nodes s, apm_packages a
+ where s.object_id = a.package_id and
+ lower(a.package_key) = 'general-comments'
+ LIMIT 1
+
+
+
+
+
+
+
+ select site_node__url(s.node_id)
+ from site_nodes s, apm_packages a
+ where s.object_id = a.package_id and
+ a.package_key = 'general-comments'
+
+
+
+
+
+
+
+ select g.comment_id,
+ r.title,
+ r.content,
+ r.mime_type,
+ o.creation_user,
+ to_char(o.creation_date, 'MM-DD-YYYY') as creation_date,
+ p.first_names || ' ' || p.last_name as author
+ from general_comments g,
+ cr_items i,
+ cr_revisions r,
+ acs_objects o,
+ persons p
+ where g.object_id = :object_id and
+ i.item_id = g.comment_id and
+ r.revision_id = i.live_revision and
+ o.object_id = g.comment_id and
+ p.person_id = o.creation_user
+ order by creation_date
+
+
+
+
+
+
+
+ select site_node__url(s.node_id)
+ from site_nodes s, apm_packages a
+ where s.object_id = a.package_id and
+ a.package_key = 'general-comments'
+
+
+
+
+
Index: openacs-4/packages/general-comments/tcl/general-comments-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 20 Apr 2001 20:51:11 -0000 1.1
+++ openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 14 Jun 2001 19:38:05 -0000 1.2
@@ -1,9 +1,16 @@
# /packages/general-comments/tcl/general-comments-procs.tcl
+# Porting: Moved most queries from variables to in-line
+# for the QueryExtractor, appended '_deprecated' to
+# query-names in 'ad_proc -deprecated' functions.
+# Left one duplicate with 100% identical SQL (pascal)
+
ad_library {
Utility procs for general-comments
@author Phong Nguyen
+ @author Pascal Scheffers
+
@creation-date 2000-10-12
@cvs-id $Id$
}
@@ -33,11 +40,13 @@
set content_select ""
set content ""
} else {
- set content_select ", r.content"
+ set content_select [db_map content_select] ;# ", r.content"
}
-
+ ns_log notice "content_select: $content_select"
+
set html ""
- set sql "select g.comment_id,
+ db_foreach get_comments "
+ select g.comment_id,
r.title,
r.mime_type,
o.creation_user,
@@ -51,9 +60,7 @@
where g.object_id = :object_id and
r.revision_id = content_item.get_live_revision(g.comment_id) and
o.object_id = g.comment_id
- order by o.creation_date"
-
- db_foreach get_comments $sql {
+ order by o.creation_date" {
# call on helper proc to print out comment
append html [general_comments_print_comment $comment_id $title $mime_type \
$creation_user $author $pretty_date $pretty_date2 $content \
@@ -91,25 +98,9 @@
@param return_url A url for the user to return to after viewing a comment.
} {
- # create query statements to retrieve attachments
- set attachment_sql "
- select r.title,
- r.mime_type,
- i.name,
- i.item_id
- from cr_items i,
- cr_revisions r
- where i.parent_id = :comment_id and
- r.revision_id = i.live_revision"
- set link_sql "
- select i.item_id,
- e.label,
- e.url
- from cr_items i, cr_extlinks e
- where i.parent_id = :comment_id and
- e.extlink_id = i.item_id"
+ # -- create query statements to retrieve attachments
+ # PRS: Moved inline for QueryExtractor
-
# This part is really ugly. This will remain here until we figure out a way to
# move this into a template.
set html ""
@@ -122,15 +113,24 @@
}
if { $print_attachments_p == 1 } {
set attachments_html ""
- db_foreach get_attachments $attachment_sql {
+ db_foreach get_attachments "
+ select r.title, r.mime_type, i.name, i.item_id
+ from cr_items i, cr_revisions r
+ where i.parent_id = :comment_id
+ and r.revision_id = i.live_revision" {
+
append attachments_html "$title "
if { $mime_type == "image_gif" || $mime_type == "image/jpeg" } {
append attachments_html "($name)\n"
} else {
append attachments_html "($name)\n"
}
}
- db_foreach get_links $link_sql {
+
+ db_foreach get_links "
+ select i.item_id, e.label, e.url
+ from cr_items i, cr_extlinks e
+ where i.parent_id = :comment_id and e.extlink_id = i.item_id" {
append attachments_html "$label\n"
}
if { ![empty_string_p $attachments_html] } {
@@ -181,12 +181,13 @@
ad_proc -private general_comments_package_url {} {
Returns a url pointing to the mounted general-comments package.
} {
- set sql "select site_node.url(s.node_id) as package_url
+
+ if { [db_0or1row get_package_url "
+ select site_node.url(s.node_id) as package_url
from site_nodes s, apm_packages a
where s.object_id = a.package_id and
lower(a.package_key) = 'general-comments' and
- RowNum = 1"
- if { [db_0or1row get_package_url $sql] } {
+ RowNum = 1" ] } {
return $package_url
} else {
# log an error message
@@ -205,14 +206,15 @@
} {
# get the package url
- set sql "select site_node.url(s.node_id)
+ set package_url [db_string get_package_url_deprecated "
+ select site_node.url(s.node_id)
from site_nodes s, apm_packages a
where s.object_id = a.package_id and
- a.package_key = 'general-comments'"
- set package_url [db_string get_package_url $sql]
+ a.package_key = 'general-comments'"]
set html ""
- set sql "select g.comment_id,
+ db_foreach get_comments_deprecated "
+ select g.comment_id,
r.title,
r.content,
r.mime_type,
@@ -229,8 +231,7 @@
r.revision_id = i.live_revision and
o.object_id = g.comment_id and
p.person_id = o.creation_user
- order by creation_date"
- db_foreach get_comments $sql {
+ order by creation_date" {
append html "$title by $author, $creation_date
\n"
}
return "$html"
@@ -245,14 +246,17 @@
@param category A category to associate comment to.
} {
# get the package url
- set sql "select site_node.url(s.node_id)
+ set package_url [db_string get_package_url_deprecated "
+ select site_node.url(s.node_id)
from site_nodes s, apm_packages a
where s.object_id = a.package_id and
- a.package_key = 'general-comments'"
- set package_url [db_string get_package_url $sql]
+ a.package_key = 'general-comments'"]
set html "$link_text"
return $html
}
}
+
+
+
Index: openacs-4/packages/general-comments/tcl/general-comments-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/general-comments/tcl/general-comments-procs.xql 14 Jun 2001 19:38:05 -0000 1.1
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ , r.content
+
+
+
+
+
+
+
+ select r.title, r.mime_type, i.name, i.item_id
+ from cr_items i, cr_revisions r
+ where i.parent_id = :comment_id
+ and r.revision_id = i.live_revision
+
+
+
+
+
+
+
+ select i.item_id, e.label, e.url
+ from cr_items i, cr_extlinks e
+ where i.parent_id = :comment_id and e.extlink_id = i.item_id
+
+
+
+
+