Index: openacs-4/packages/cms/www/modules/items/attributes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/attributes.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/cms/www/modules/items/attributes.tcl 16 Aug 2002 01:20:00 -0000 1.4 +++ openacs-4/packages/cms/www/modules/items/attributes.tcl 16 Aug 2002 03:57:48 -0000 1.5 @@ -39,8 +39,7 @@ set content_type $type_info(object_type) -db_multirow attributes get_attributes "" -template::query get_attributes attributes multirow "" { +db_multirow attributes get_attributes ""{ if { [catch { set value $info($attribute_name) } errmsg] } { # catch - value doesn't exist Index: openacs-4/packages/cms/www/modules/items/children.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/children.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/children.tcl 8 Jun 2001 01:44:53 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/children.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -14,15 +14,7 @@ # create a form to add child items -template::query get_child_types child_types multilist " - select - t.pretty_name, c.child_type - from - acs_object_types t, cr_type_children c - where - c.parent_type = content_item.get_content_type(:item_id) - and - c.child_type = t.object_type" +set child_types [db_list_of_lists get_child_types ""] # do not display template if this content type does not allow children if { [llength $child_types] == 0 } { adp_abort } @@ -35,55 +27,4 @@ -options $child_types -widget select } -set query " - select - rel_id, relation_tag, - i.item_id, i.name, trim(r.title) as title, t.pretty_name, - to_char(o.creation_date, 'MM/DD/YY HH24:MM') last_modified - from - cr_items i, acs_object_types t, acs_objects o, cr_revisions r, - cr_child_rels c - where - i.parent_id = :item_id - and - o.object_id = :item_id - and - i.content_type = t.object_type - and - r.revision_id = NVL(i.live_revision, i.latest_revision) - and - c.parent_id = i.parent_id - and - c.child_id = i.item_id - order by - t.pretty_name, title" - -#template::query children multirow $query - - - - -template::query get_children children multirow " - select - r.rel_id, - r.child_id item_id, - t.pretty_name as type_name, - NVL(r.relation_tag, '-') as tag, - trim(NVL(content_item.get_title(r.child_id), i.name)) title, - ot.pretty_name as content_type - from - cr_child_rels r, acs_objects o, acs_object_types t, - cr_items i, acs_object_types ot - where - r.parent_id = :item_id - and - o.object_id = r.rel_id - and - t.object_type = o.object_type - and - i.item_id = r.child_id - and - ot.object_type = i.content_type - order by - order_n, title -" +db_multirow children get_children "" Index: openacs-4/packages/cms/www/modules/items/comment-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/comment-add.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/comment-add.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/comment-add.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -4,9 +4,7 @@ item_id -datatype integer } -template::query get_title item_title onevalue " - select content_item.get_title(:item_id) from dual -" +set item_title [db_string get_title ""] form create add_comment -elements " journal_id -datatype integer -widget hidden @@ -18,10 +16,8 @@ " if { [form is_request add_comment] } { - template::query get_journal_id journal_id onevalue " - select acs_object_id_seq.nextval from dual - " - element set_properties add_comment journal_id -value $journal_id + set journal_id [db_string get_journal_id ""] + element set_properties add_comment journal_id -value $journal_id } if { [form is_valid add_comment] } { Index: openacs-4/packages/cms/www/modules/items/comments-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/comments-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/items/comments-oracle.xql 25 May 2001 04:56:36 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/comments-oracle.xql 16 Aug 2002 03:57:48 -0000 1.2 @@ -26,8 +26,11 @@ o.creation_user = p.person_id (+) and msg is not null + and + rowid < 11 order by o.creation_date desc + Index: openacs-4/packages/cms/www/modules/items/comments-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/comments-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/items/comments-postgresql.xql 25 May 2001 04:56:36 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/comments-postgresql.xql 16 Aug 2002 03:57:48 -0000 1.2 @@ -28,6 +28,7 @@ msg is not null order by o.creation_date desc + limit 10 Index: openacs-4/packages/cms/www/modules/items/comments.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/comments.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/comments.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/comments.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -13,28 +13,4 @@ # The creation_user may be null, in which case 'System' is substituted - -template::query get_comments comments multirow " - select - journal_id, action_pretty, msg, - decode(NVL(p.person_id, 0), - 0, 'System', - substr(p.first_names, 1, 1) || '. ' || p.last_name) person, - to_char(o.creation_date, 'MM/DD/YY HH24:MI:SS') when - from - journal_entries j, acs_objects o, persons p - where - ( - j.object_id = :item_id - or - j.object_id in (select case_id from wf_cases c - where c.object_id = :item_id) - ) and - j.journal_id = o.object_id - and - o.creation_user = p.person_id (+) - and - msg is not null - order by - o.creation_date desc -" -maxrows 10 +db_multirow comments get_comments "" Index: openacs-4/packages/cms/www/modules/items/content-add-1.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/content-add-1.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/items/content-add-1.tcl 27 May 2001 04:39:19 -0000 1.3 +++ openacs-4/packages/cms/www/modules/items/content-add-1.tcl 16 Aug 2002 03:57:48 -0000 1.4 @@ -4,20 +4,8 @@ request create request set_param revision_id -datatype integer +db_1row get_revision_one "" -template::query get_revision one_revision onerow " - select - i.item_id, content_type, title as name, mime_type - from - cr_revisions r, cr_items i - where - i.item_id = r.item_id - and - r.revision_id = :revision_id -" - -template::util::array_to_vars one_revision - # permissions check - must have cm_write on the item content::check_access $item_id cm_write -user_id [User::getID] Index: openacs-4/packages/cms/www/modules/items/content-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/content-add-2.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/content-add-2.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/content-add-2.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -4,17 +4,8 @@ request set_param content_method -datatype keyword request set_param revision_id -datatype integer -template::query get_revision one_revision onerow " - select - item_id, title as name - from - cr_revisions - where - revision_id = :revision_id -" +db_1row get_revision "" -template::util::array_to_vars one_revision - # permissions check - must have cm_write on the item content::check_access $item_id cm_write -user_id [User::getID] Index: openacs-4/packages/cms/www/modules/items/content-download.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/content-download.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/cms/www/modules/items/content-download.tcl 31 Oct 2001 20:42:07 -0000 1.4 +++ openacs-4/packages/cms/www/modules/items/content-download.tcl 16 Aug 2002 03:57:48 -0000 1.5 @@ -8,17 +8,8 @@ set user_id [User::getID] -template::query get_iteminfo iteminfo onerow " - select - item_id, content_revision.is_live( revision_id ) is_live - from - cr_revisions - where - revision_id = :revision_id -" +db_1row get_iteminfo "" -template::util::array_to_vars iteminfo - # item_id, is_live # check cm permissions on file Index: openacs-4/packages/cms/www/modules/items/create-1.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/create-1.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/create-1.tcl 24 May 2001 23:57:17 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/create-1.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -30,14 +30,7 @@ } -template::query get_content_typ_name content_type_name onevalue " - select - pretty_name - from - acs_object_types - where - object_type = :content_type -" +set content_type_name [db_string get_content_typ_name ""] if { [template::util::is_nil content_type_name] } { template::request::error bad_content_type \ Index: openacs-4/packages/cms/www/modules/items/create-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/create-2.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/cms/www/modules/items/create-2.tcl 17 Aug 2001 23:33:53 -0000 1.4 +++ openacs-4/packages/cms/www/modules/items/create-2.tcl 16 Aug 2002 03:57:48 -0000 1.5 @@ -25,15 +25,7 @@ # permissions check - need cm_new on the parent item content::check_access $parent_id cm_new -user_id [User::getID] -template::query get_item new_item onerow " - select - NVL(content_item.get_path(:parent_id), '/') as item_path, - pretty_name as content_type_name - from - acs_object_types - where - object_type = :content_type -" +db_0or1row get_item "" -column_array new_item # validate content_type and parent_id if { [template::util::is_nil new_item] } { Index: openacs-4/packages/cms/www/modules/items/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/delete.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/delete.tcl 24 May 2001 23:57:17 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/delete.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -10,14 +10,7 @@ # get all the parent_id's of the items being deleted # because we need to flush the paginator cache for each of these folders - template::query flush flush_list onelist " - select - parent_id - from - cr_resolved_items - where - resolved_id = :item_id -" + set flush_list [db_list flush ""] db_exec_plsql item_delete " begin Index: openacs-4/packages/cms/www/modules/items/export-xml.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/export-xml.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/export-xml.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/export-xml.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -8,9 +8,7 @@ :1 := content_revision.export_xml(:revision_id); end;"] - template::query get_xml_doc xml_doc onevalue " - select doc from cr_xml_docs where doc_id = :doc_id - " + set xml_doc [db_string get_xml_doc ""] } ns_return 200 text/xml $xml_doc Index: openacs-4/packages/cms/www/modules/items/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/index.tcl 24 May 2001 23:57:17 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/index.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -24,9 +24,7 @@ # resolve any symlinks -template::query get_item_id resolved_item_id onevalue " - select content_symlink.resolve(:item_id) from dual -" -cache "symlink_resolve $item_id" -persistent +set resolved_item_id [db_string get_item_id ""] set item_id $resolved_item_id @@ -36,17 +34,8 @@ -return_url "modules/sitemap/index" # query the content_type of the item ID so we can check for a custom info page -template::query get_info info onerow " - select - content_type, latest_revision - from - cr_items - where - item_id = :item_id" +db_1row get_info "" -template::util::array_to_vars info - - # build the path to the custom interface directory for this content type set custom_dir [file dirname [ns_conn url]]/custom/$content_type Index: openacs-4/packages/cms/www/modules/items/keywords.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/keywords.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/keywords.tcl 8 Jun 2001 01:44:53 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/keywords.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -13,18 +13,8 @@ -request_error -template::query get_name name onevalue "select name from cr_items where item_id = :item_id" +set name [db_string get_name ""] -template::query get_keywords keywords multirow "select - keyword_id, - content_keyword.get_heading(keyword_id) heading, - NVL(content_keyword.get_description(keyword_id), - '-') description - from - cr_item_keyword_map - where - item_id = :item_id - order by - heading" +db_multirow get_keywords "" set page_title "Content Keywords for $name" Index: openacs-4/packages/cms/www/modules/items/publish-status.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/publish-status.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/publish-status.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/publish-status.tcl 16 Aug 2002 03:57:48 -0000 1.3 @@ -9,19 +9,7 @@ # Query for publish status and release schedule, if any -template::query get_info info onerow " - select - NVL(initcap(publish_status), 'Production') publish_status, - NVL(to_char(start_when, 'MM/DD/YY HH:MI AM'), 'Immediate') start_when, - NVL(to_char(end_when, 'MM/DD/YY HH:MI AM'), 'Indefinite') end_when, - content_item.is_publishable(:item_id) is_publishable, - live_revision - from - cr_items i, cr_release_periods r - where - i.item_id = :item_id - and - i.item_id = r.item_id (+)" +db_string get_info "" -column_array info # Build a sentence describing the publishing status @@ -60,15 +48,7 @@ # determine whether the item is publishable or not -template::query get_publish_info publish_info onerow " - select - content_item.is_publishable( item_id ) is_publishable, - live_revision - from - cr_items - where - item_id = :item_id -" +db_1row get_publish_info "" template::util::array_to_vars publish_info @@ -80,9 +60,7 @@ # determine if there is an unfinished workflow -template::query unfinished_exists unfinished_workflow_exists onevalue " - select content_workflow.unfinished_workflow_exists( :item_id ) from dual -" +set unfinished_workflow_exists [db_string unfinished_exists ""] # determine if child type constraints have been satisfied Index: openacs-4/packages/cms/www/modules/items/publish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/publish.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/cms/www/modules/items/publish.tcl 5 Sep 2001 05:17:19 -0000 1.5 +++ openacs-4/packages/cms/www/modules/items/publish.tcl 16 Aug 2002 03:57:48 -0000 1.6 @@ -8,20 +8,8 @@ db_transaction { - template::query get_iteminfo iteminfo onerow " - select - item_id, - content_item.is_publishable( item_id ) as publish_p - from - cr_revisions - where - revision_id = :revision_id -" + db_1row get_iteminfo "" - - template::util::array_to_vars iteminfo - # item_id, publish_p - if { [string equal $publish_p t] } { # publish::publish_revision $revision_id Index: openacs-4/packages/cms/www/modules/items/relate-child-order.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/relate-child-order.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/cms/www/modules/items/relate-child-order.tcl 27 May 2001 00:22:34 -0000 1.4 +++ openacs-4/packages/cms/www/modules/items/relate-child-order.tcl 16 Aug 2002 03:57:48 -0000 1.5 @@ -9,9 +9,7 @@ db_transaction { # Get the irelated items - template::query get_rel_info rel_info onerow " - select parent_id as item_id, order_n from cr_child_rels - where rel_id = :rel_id" + db_0or1row get_rel_info "" -column_array rel_info if { ![info exists rel_info] } { db_abort_transaction @@ -26,24 +24,10 @@ if { [string equal $order up] } { # Get the previous item's order - template::query get_prev_swap_rel swap_rel onerow " - select rel_id, order_n from cr_child_rels r1 - where r1.parent_id = :item_id - and r1.order_n < :order_n - and not exists (select order_n from cr_child_rels r2 - where r2.parent_id = :item_id - and r2.order_n < :order_n - and r2.order_n > r1.order_n)" + db_0or1row get_prev_swap_rel "" -column_array swap_rel } else { # Get the next item's order - template::query get_next_swap_rel swap_rel onerow " - select rel_id, order_n from cr_child_rels r1 - where r1.parent_id = :item_id - and r1.order_n > :order_n - and not exists (select order_n from cr_child_rels r2 - where r2.parent_id = :item_id - and r2.order_n > :order_n - and r2.order_n < r1.order_n)" + db_0or1row get_next_swap_rel "" -column_array swap_rel } # Only need to perform DML if the rel is not already at the top/bottom Index: openacs-4/packages/cms/www/modules/items/relate-items-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/relate-items-2.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/cms/www/modules/items/relate-items-2.tcl 27 May 2001 04:39:19 -0000 1.5 +++ openacs-4/packages/cms/www/modules/items/relate-items-2.tcl 16 Aug 2002 03:57:48 -0000 1.6 @@ -33,10 +33,8 @@ upvar 0 "rel_attrs:rowcount" index set index 0 +set item_title [db_string get_title ""] -template::query get_title item_title onevalue " - select content_item.get_title(:item_id) from dual" - # Create the main multirow datasource set form_complete 1 @@ -70,16 +68,7 @@ set form_complete 0 # Get the header - template::query get_rel_info onerow " - select - content_item.get_title(:item_id) as item_title, - content_item.get_title(:related_id) as related_title, - pretty_name - from - acs_object_types - where - object_type = :relation_type - " + db_1row get_rel_info "" -column_array rel_info # Create the form section form section rel_form_2 \ @@ -131,14 +120,7 @@ # Insert at the end if no order if { [template::util::is_nil order_n] } { - template::query get_order order_n onevalue " - select - NVL(max(order_n) + 1, 1) - from - cr_item_rels - where - item_id = :item_id - " + set order_n [db_string get_order ""] } # Perform the insertion