Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.148.2.6 -r1.148.2.7 --- openacs-4/packages/xowiki/xowiki.info 7 Nov 2013 11:52:25 -0000 1.148.2.6 +++ openacs-4/packages/xowiki/xowiki.info 11 Feb 2014 11:58:17 -0000 1.148.2.7 @@ -10,10 +10,10 @@ t xowiki - + Gustaf Neumann A xotcl-based enterprise wiki system with multiple object types - 2013-09-08 + 2014-02-11 Gustaf Neumann, WU Wien <pre> XoWiki is a Wiki implementation for OpenACS in XOTcl. Instead of @@ -55,13 +55,13 @@ BSD-Style 2 - + - + Index: openacs-4/packages/xowiki/tcl/folder-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/folder-procs.tcl,v diff -u -r1.27.2.2 -r1.27.2.3 --- openacs-4/packages/xowiki/tcl/folder-procs.tcl 30 Sep 2013 11:37:17 -0000 1.27.2.2 +++ openacs-4/packages/xowiki/tcl/folder-procs.tcl 11 Feb 2014 11:58:18 -0000 1.27.2.3 @@ -103,7 +103,7 @@ set target [$l get_target_from_link_page] # the following clause needs an oracle counter-part - set tree_sortkey [::xo::db_string get_tree_sort_key \ + set tree_sortkey [::xo::dc get_value get_tree_sort_key \ "select tree_sortkey from acs_objects where object_id = [$target item_id]"] set extra_where "and bt.item_id in (select object_id from acs_objects \ where tree_sortkey between '$tree_sortkey' and tree_right('$tree_sortkey') \ Index: openacs-4/packages/xowiki/tcl/form-field-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/form-field-procs.tcl,v diff -u -r1.239.2.5 -r1.239.2.6 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 11 Oct 2013 10:14:01 -0000 1.239.2.5 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 11 Feb 2014 11:58:18 -0000 1.239.2.6 @@ -1344,7 +1344,7 @@ -extend_slot validator party_id_check party_id instproc check=party_id_check {value} { if {$value eq ""} {return 1} - return [::xo::db_0or1row check_party {select 1 from parties where party_id = :value}] + return [::xo::dc 0or1row check_party {select 1 from parties where party_id = :value}] } ########################################################### @@ -2452,10 +2452,11 @@ # We should support as well user level instance attributes. set entry_label [string trimleft $entry_label _] - ::xo::db_1row [self proc] "select $entry_label from cr_items ci, cr_revisions cr + ::xo::dc 1row [self proc] "select $entry_label from cr_items ci, cr_revisions cr where cr.revision_id = ci.live_revision and ci.item_id = :item_id" return [set $entry_label] } + abstract_page instproc get_entry_label {value} { set item_id [[my set package_id] lookup -parent_id [[my object] parent_id] -name $value] if {$item_id} { @@ -2617,7 +2618,7 @@ set package_id [[my object] package_id] set options [list] - db_foreach [my qn instance_select] \ + ::xo::dc foreach instance_select \ [$type instance_select_query \ -folder_id [$package_id folder_id] \ -with_subtypes $with_subtypes \ @@ -3584,3 +3585,10 @@ } ::xo::library source_dependent + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/import-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/import-procs.tcl,v diff -u -r1.27.2.2 -r1.27.2.3 --- openacs-4/packages/xowiki/tcl/import-procs.tcl 13 Oct 2013 18:13:58 -0000 1.27.2.2 +++ openacs-4/packages/xowiki/tcl/import-procs.tcl 11 Feb 2014 11:58:18 -0000 1.27.2.3 @@ -306,7 +306,7 @@ # check for child objects of the item # set sql [::xowiki::Page instance_select_query -folder_id $item_id -with_subtypes true] - db_foreach [my qn export_child_obj] $sql { + ::xo::dc foreach export_child_obj $sql { if {![info exists items($item_id)]} { ::xo::db::CrClass get_instance_from_db -item_id $item_id ns_log notice "--export including child $item_id [$item_id name]" Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v diff -u -r1.191.2.6 -r1.191.2.7 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 7 Nov 2013 11:52:26 -0000 1.191.2.6 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 11 Feb 2014 11:58:18 -0000 1.191.2.7 @@ -274,7 +274,7 @@ append extra_where_clause [::xowiki::Includelet glob_clause -base_table i $glob] } - set sql [::xo::db::sql select \ + set sql [::xo::dc select \ -vars $attribute_selection \ -from "cr_items i, cr_revisions r, xowiki_page p, acs_objects o" \ -where "$parent_id_clause \ @@ -286,7 +286,7 @@ -limit $limit -offset $offset] if {$count} { - return [::xo::db_string count_listing $sql] + return [::xo::dc get_value count_listing $sql] } else { set s [::xowiki::Page instantiate_objects -sql $sql] return $s @@ -797,7 +797,7 @@ append sql $locale_clause if {$count} { - db_foreach [my qn get_counts] \ + ::xo::dc foreach get_counts \ "select count(*) as nr,category_id from $sql group by category_id" { $category($category_id) set count $nr set s [expr {$summary ? "&summary=$summary" : ""}] @@ -810,7 +810,7 @@ set increasing [expr {$direction ne "desc"}] set order_column ", p.page_order" - db_foreach [my qn get_pages] \ + ::xo::dc foreach get_pages \ "select ci.item_id, ci.name, ci.parent_id, r.title, category_id $order_column from $sql" { if {$title eq ""} {set title $name} set itemobj [Object new] @@ -889,7 +889,7 @@ } else { set tree_select_clause "" } - set sql [::xo::db::sql select \ + set sql [::xo::dc select \ -vars "c.category_id, ci.name, ci.parent_id, r.title, r.publish_date, \ to_char(r.publish_date,'YYYY-MM-DD HH24:MI:SS') as formatted_date" \ -from "category_object_map_tree c, cr_items ci, cr_revisions r, xowiki_page p" \ @@ -899,7 +899,7 @@ and ci.publish_status <> 'production'" \ -orderby "publish_date desc" \ -limit $max_entries] - db_foreach [my qn get_pages] $sql { + ::xo::dc foreach get_pages $sql { if {$title eq ""} {set title $name} set itemobj [Object new] set prefix "" @@ -1053,14 +1053,14 @@ -columns { AnchorField title -label [::xowiki::Page::slot::title set pretty_name] } - - db_foreach [my qn get_pages] \ - [::xo::db::sql select \ + + xo::dc foreach get_pages \ + [::xo::dc select \ -vars "i.parent_id, r.title,i.name, to_char(time,'YYYY-MM-DD HH24:MI:SS') as visited_date" \ -from "xowiki_last_visited x, xowiki_page p, cr_items i, cr_revisions r" \ -where "x.page_id = i.item_id and i.live_revision = p.page_id \ and r.revision_id = p.page_id and x.user_id = [::xo::cc set untrusted_user_id] \ - and x.package_id = $package_id and i.publish_status <> 'production'" \ + and x.package_id = :package_id and i.publish_status <> 'production'" \ -orderby "visited_date desc" \ -limit $max_entries] \ { @@ -1106,12 +1106,12 @@ AnchorField title -label [::xowiki::Page::slot::title set pretty_name] Field users -label Visitors -html { align right } } - set since_condition [::xo::db::sql since_interval_condition time $interval] - db_foreach [my qn get_pages] \ - [::xo::db::sql select \ + set since_condition [::xo::dc since_interval_condition time $interval] + xo::dc foreach get_pages \ + [::xo::dc select \ -vars "count(x.user_id) as nr_different_users, x.page_id, r.title,i.name, i.parent_id" \ -from "xowiki_last_visited x, xowiki_page p, cr_items i, cr_revisions r" \ - -where "x.package_id = $package_id and x.page_id = i.item_id and \ + -where "x.package_id = :package_id and x.page_id = i.item_id and \ i.publish_status <> 'production' and i.live_revision = r.revision_id \ and $since_condition" \ -groupby "x.page_id, r.title, i.name, i.parent_id" \ @@ -1130,11 +1130,11 @@ Field count -label [_ xowiki.includelets-visits] -html { align right } Field users -label [_ xowiki.includelet-visitors] -html { align right } } - db_foreach [my qn get_pages] \ - [::xo::db::sql select \ + xo::dc foreach get_pages \ + [::xo::dc select \ -vars "sum(x.count) as sum, count(x.user_id) as nr_different_users, x.page_id, r.title,i.name, i.parent_id" \ -from "xowiki_last_visited x, cr_items i, cr_revisions r" \ - -where "x.package_id = $package_id and x.page_id = i.item_id and \ + -where "x.package_id = :package_id and x.page_id = i.item_id and \ i.publish_status <> 'production' and i.live_revision = r.revision_id" \ -groupby "x.page_id, r.title, i.name, i.parent_id" \ -orderby "sum desc" \ @@ -1221,11 +1221,11 @@ Field user -label Visitors -html { align right } Field count -label Visits -html { align right } } - db_foreach [my qn get_pages] \ - [::xo::db::sql select \ + ::xo::dc foreach most-frequent-visistors \ + [::xo::dc select \ -vars "sum(count) as sum, user_id" \ -from "xowiki_last_visited" \ - -where "package_id = $package_id" \ + -where "package_id = :package_id" \ -groupby "user_id" \ -orderby "sum desc" \ -limit $max_entries] { @@ -1267,29 +1267,30 @@ -columns { AnchorField title -label [::xowiki::Page::slot::title set pretty_name] } - + set user_id [::xo::cc user_id] set or_clause "or i.item_id in ( select x.page_id - from xowiki_last_visited x, acs_objects o \ + from xowiki_last_visited x, acs_objects o where x.time < o.last_modified and x.page_id = o.object_id - and x.package_id = $package_id - and x.user_id = [::xo::cc user_id] + and x.package_id = :package_id + and x.user_id = :user_id )" set or_clause "" + set folder_id [$package_id folder_id] - db_foreach [my qn get_pages] \ - [::xo::db::sql select \ + ::xo::dc foreach unread-items \ + [::xo::dc select \ -vars "a.title, i.name, i.parent_id" \ -from "xowiki_page p, cr_items i, acs_objects a " \ -where "(i.item_id not in ( select x.page_id from xowiki_last_visited x - where x.user_id = [::xo::cc user_id] and x.package_id = $package_id + where x.user_id = [::xo::cc user_id] and x.package_id = :package_id ) $or_clause ) and i.live_revision = p.page_id - and i.parent_id = [$package_id folder_id] + and i.parent_id = :folder_id and i.publish_status <> 'production' and a.object_id = i.item_id" \ -orderby "a.creation_date desc" \ @@ -1331,7 +1332,7 @@ if {$popular} { set label [_ xowiki.popular_tags_label] set tag_type ptag - set sql [::xo::db::sql select \ + set sql [::xo::dc select \ -vars "count(*) as nr,tag" \ -from xowiki_tags \ -where "package_id=$package_id" \ @@ -1349,7 +1350,7 @@ if {![info exists page]} {set page [$package_id get_parameter weblog_page]} set href [$package_id package_url]tag/ - db_foreach [my qn get_counts] $sql { + ::xo::dc foreach get_tag_counts $sql { set q [list] if {$summary} {lappend q "summary=$summary"} if {$popular} {lappend q "popular=$popular"} @@ -1588,12 +1589,12 @@ # The same image might be linked both, as img or file on one page, # so we need DISTINCT. - db_foreach [my qn get_references] "SELECT DISTINCT page,ci.name,ci.parent_id,o.package_id as pid \ + xo::dc foreach get_references "SELECT DISTINCT page,ci.name,ci.parent_id,o.package_id as pid \ from xowiki_references,cr_items ci,acs_objects o \ - where reference=$item_id and ci.item_id = page and ci.item_id = o.object_id" { + where reference = :item_id and ci.item_id = page and ci.item_id = o.object_id" { if {$pid eq ""} { # in version less then oacs 5.2, this returns empty - set pid [::xo::db_string _ {select package_id from cr_folders where folder_id = :parent_id}] + set pid [::xo::dc get_value 5.2 {select package_id from cr_folders where folder_id = :parent_id}] } if {$pid ne ""} { ::xowiki::Package require $pid @@ -1633,12 +1634,12 @@ set item_id [$__including_page item_id] set refs [list] - db_foreach [my qn get_refers] "SELECT DISTINCT reference,ci.name,ci.parent_id,o.package_id as pid \ + ::xo::dc foreach get_refers "SELECT DISTINCT reference,ci.name,ci.parent_id,o.package_id as pid \ from xowiki_references,cr_items ci,acs_objects o \ where page=$item_id and ci.item_id = reference and ci.item_id = o.object_id" { if {$pid eq ""} { # in version less then oacs 5.2, this returns empty - set pid [::xo::db_string _ {select package_id from cr_folders where folder_id = :parent_id}] + set pid [::xo::dc get_value 5.2 {select package_id from cr_folders where folder_id = :parent_id}] } if {$pid ne ""} { ::xowiki::Package require $pid @@ -1707,18 +1708,22 @@ if {!$summary} { set select_users "user_id, to_char(max(time),'YYYY-MM-DD HH24:MI:SS') as max_time from xowiki_last_visited " } - set since_condition [::xo::db::sql since_interval_condition time $interval] - set where_clause "package_id=$package_id and $since_condition $extra_where_clause" + + # allow for caching prepared value. + set since [::xo::dc interval $interval] + set since_condition "time > TO_TIMESTAMP(:since,'YYYY-MM-DD HH24:MI:SS')" + + set where_clause "package_id=:package_id and $since_condition $extra_where_clause" set when "
in last $interval" set output "" if {$summary} { - set count [::xo::db_string presence_count_users \ + set count [::xo::dc get_value presence_count_users \ "select count(distinct user_id) from xowiki_last_visited WHERE $where_clause"] } else { - set values [::xo::db_list_of_lists get_users \ - [::xo::db::sql select \ + set values [::xo::dc list_of_lists get_users \ + [::xo::dc select \ -vars "user_id, to_char(max(time),'YYYY-MM-DD HH24:MI:SS') as max_time" \ -from xowiki_last_visited \ -where $where_clause \ @@ -1728,7 +1733,7 @@ set count [llength $values] if {$count == $max_users} { # we have to check, whether there were more users... - set count [::xo::db_string presence_count_users \ + set count [::xo::dc get_value presence_count_users \ "select count(distinct user_id) from xowiki_last_visited WHERE $where_clause"] } foreach value $values { @@ -1887,7 +1892,7 @@ set parent_id [$__including_page parent_id] } - set sql [::xo::db::sql select \ + set sql [::xo::dc select \ -vars "page_id, $page_order_att name, title" \ -from "xowiki_page_live_revision p" \ -where "parent_id=$parent_id \ @@ -3170,7 +3175,7 @@ if {![info exists user_id]} {set user_id [::xo::cc user_id]} set folder_id [$package_id folder_id] - db_foreach [my qn get_collaborators] { + ::xo::dc foreach get_collaborators { select count(revision_id), item_id, creation_user from cr_revisions r, acs_objects o where item_id in @@ -3255,7 +3260,7 @@ #my msg "tmp exists [::xo::db::require exists_table $tmp_table_name]" set tt [::xo::db::temp_table new \ -name $tmp_table_name \ - -query [::xo::db::sql select \ + -query [::xo::dc select \ -vars "i.item_id, revision_id, creation_user" \ -from "cr_revisions cr, cr_items i, acs_objects o" \ -where "cr.item_id = i.item_id \ @@ -3266,7 +3271,7 @@ -vars "item_id, revision_id, creation_user"] set total 0 - db_foreach [my qn get_activities] " + ::xo::dc foreach get_activities " select count(revision_id) as count, item_id, creation_user from $tmp_table_name where creation_user is not null @@ -4559,3 +4564,9 @@ ::xo::library source_dependent +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/notification-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/notification-procs.tcl,v diff -u -r1.19.2.1 -r1.19.2.2 --- openacs-4/packages/xowiki/tcl/notification-procs.tcl 17 Sep 2013 17:49:24 -0000 1.19.2.1 +++ openacs-4/packages/xowiki/tcl/notification-procs.tcl 11 Feb 2014 11:58:18 -0000 1.19.2.2 @@ -62,11 +62,11 @@ namespace eval ::xowiki::notification { ad_proc -private get_url {id} { - if {[::xo::db_0or1row is_package_id {select 1 from apm_packages where package_id = :id}]} { + if {[::xo::dc 0or1row is_package_id {select 1 from apm_packages where package_id = :id}]} { # # the specified id is an package_id # - set node_id [::xo::db_string get_node_id {select node_id from site_nodes where object_id = :id}] + set node_id [::xo::dc get_value get_node_id {select node_id from site_nodes where object_id = :id}] set url [site_node::get_url -node_id $node_id] return $url } @@ -175,3 +175,9 @@ } ::xo::library source_dependent +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -r1.279.2.5 -r1.279.2.6 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 7 Nov 2013 11:52:26 -0000 1.279.2.5 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 11 Feb 2014 11:58:18 -0000 1.279.2.6 @@ -35,7 +35,7 @@ } else { error "Either item_id or revision_id must be provided" } - return [::xo::db_string get_pid {select package_id from acs_objects where object_id = :object_id}] + return [::xo::dc get_value get_pid {select package_id from acs_objects where object_id = :object_id}] } Package ad_proc instantiate_page_from_id { @@ -1758,7 +1758,7 @@ reindex all items of this package } { my instvar folder_id id - set pages [::xo::db_list qn get_pages { + set pages [::xo::dc list get_pages { select page_id,package_id from xowiki_page, cr_revisions r, cr_items ci, acs_objects o where page_id = r.revision_id and ci.item_id = r.item_id and ci.live_revision = page_id and publish_status = 'ready' @@ -1942,16 +1942,17 @@ http://www.google.com/schemas/sitemap/0.84/sitemap.xsd"> } - set sql [::xo::db::sql select \ + set sql [::xo::dc select \ -vars "ci.parent_id, s.body, p.name, p.creator, p.title, p.page_id,\ p.object_type as content_type, p.last_modified, p.description" \ -from "xowiki_pagex p, syndication s, cr_items ci" \ - -where "ci.parent_id = $folder_id and ci.live_revision = s.object_id \ + -where "ci.parent_id = :folder_id and ci.live_revision = s.object_id \ and s.object_id = p.page_id $timerange_clause" \ -orderby "p.last_modified desc" \ -limit $max_entries] - #my log $sql - db_foreach [my qn get_pages] $sql { + # my log $sql + + ::xo::dc foreach get_pages $sql { #my log "--found $name" if {[string match "::*" $name]} continue if {$content_type eq "::xowiki::PageTemplate::"} continue @@ -1996,7 +1997,7 @@ -parameter include_in_google_sitemap_index -default 1]} { continue } - set last_modified [::xo::db_string get_newest_modification_date \ + set last_modified [::xo::dc get_value get_newest_modification_date \ {select last_modified from acs_objects where package_id = :package_id order by last_modified desc limit 1}] @@ -2194,7 +2195,7 @@ # We have general comments. In a first step, we have to delete # these, before we are able to delete the item. # - set comment_ids [::xo::db_list get_comments { + set comment_ids [::xo::dc list get_comments { select comment_id from general_comments where object_id = :item_id }] foreach comment_id $comment_ids { @@ -2501,5 +2502,11 @@ ::xo::library source_dependent +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/syndicate-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/syndicate-procs.tcl,v diff -u -r1.40.2.1 -r1.40.2.2 --- openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 17 Sep 2013 17:49:24 -0000 1.40.2.1 +++ openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 11 Feb 2014 11:58:18 -0000 1.40.2.2 @@ -107,7 +107,7 @@ } if {$days ne ""} { append extra_where_clause "and " \ - [::xo::db::sql since_interval_condition p.publish_date "$days days"] + [::xo::dc since_interval_condition p.publish_date "$days days"] } if {$entries_of ne ""} { if {[regexp {^[0-9 ]+$} $entries_of]} { @@ -154,7 +154,7 @@ xowiki_page_instance on (p.revision_id = page_instance_id)" } - set sql [::xo::db::sql select \ + set sql [::xo::dc select \ -vars "s.body, s.rss_xml_frag, p.name, p.creator, p.title, p.page_id, instance_attributes, \ p.object_type as content_type, p.publish_date, p.description" \ -from "syndication s, cr_items ci, $base_table p $extra_from" \ @@ -167,7 +167,7 @@ -limit [my limit]] set content [my head] - db_foreach [my qn get_pages] $sql { + ::xo::dc foreach get_pages $sql { if {[string match "::*" $name]} continue if {$content_type eq "::xowiki::PageTemplate" || $content_type eq "::xowiki::Form"} continue append content $rss_xml_frag @@ -234,7 +234,7 @@ my set link $siteurl[lindex [site_node::get_url_from_object_id -object_id $package_id] 0] set content [my head] - set sql [::xo::db::sql select \ + set sql [::xo::dc select \ -vars * \ -from "xowiki_podcast_itemi p, cr_items ci, cr_mime_types m" \ -where "ci.parent_id in ([join $folder_ids ,]) and ci.item_id = p.item_id \ @@ -244,7 +244,7 @@ -orderby "p.pub_date asc" \ -limit [my limit]] - db_foreach [my qn get_pages] $sql { + ::xo::dc foreach get_pages $sql { if {$content_type ne "::xowiki::PodcastItem"} continue if {$title eq ""} {set title $name} set link [::$package_id pretty_link -download true -absolute true -siteurl $siteurl \ @@ -285,7 +285,7 @@ if {[my exists limit]} { set limit [my limit] } ::xo::OrderedComposite items -destroy_on_cleanup - set sql [::xo::db::sql select \ + set sql [::xo::dc select \ -vars "ci.name, ci.parent_id, o.creation_user, cr.publish_date, o2.creation_date, \ cr.item_id, cr.title" \ -from "cr_items ci, cr_revisions cr, acs_objects o, acs_objects o2" \ @@ -295,7 +295,8 @@ $where_clause" \ -orderby "revision_id desc" \ -limit $limit] - db_foreach [my qn get_pages] $sql { + + ::xo::dc foreach timeline-get_pages $sql { set publish_date [::xo::db::tcl_date $publish_date tz] set creation_date [::xo::db::tcl_date $creation_date tz] set clock [clock scan $publish_date] @@ -567,3 +568,9 @@ ::xo::library source_dependent +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/weblog-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/weblog-procs.tcl,v diff -u -r1.63.2.2 -r1.63.2.3 --- openacs-4/packages/xowiki/tcl/weblog-procs.tcl 17 Sep 2013 17:49:24 -0000 1.63.2.2 +++ openacs-4/packages/xowiki/tcl/weblog-procs.tcl 11 Feb 2014 11:58:18 -0000 1.63.2.3 @@ -68,7 +68,7 @@ if {$date ne ""} { #set date_clause "and date_trunc('day',bt.publish_date) = '$date'" - set date_clause "and [::xo::db::sql date_trunc_expression day bt.publish_date $date]" + set date_clause "and [::xo::dc date_trunc_expression day bt.publish_date $date]" set filter_msg "Filtered by date $date" set query_parm "&date=$date" set query [::xo::update_query $query date $date] @@ -189,8 +189,8 @@ if {$page_number ne ""} { lappend sql -page_number $page_number -page_size $page_size } - - set nr_items [::xo::db_string count [$base_type instance_select_query {*}$sql -count true]] + set nr_items [::xo::dc get_value count-weblog-entries \ + [$base_type instance_select_query {*}$sql -count true]] #my msg count=$nr_items set s [$base_type instantiate_objects -sql [$base_type instance_select_query {*}$sql]] @@ -348,3 +348,10 @@ } ::xo::library source_dependent + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl,v diff -u -r1.73 -r1.73.2.1 --- openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 11 Apr 2013 21:53:25 -0000 1.73 +++ openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 11 Feb 2014 11:58:19 -0000 1.73.2.1 @@ -39,15 +39,15 @@ set root_folder_id [::xo::db::CrClass lookup -name "xowiki: $package_id" -parent_id -100] if {$root_folder_id ne "0"} { # we deal with a correctly installed package - if {[::xo::db_0or1row is_transformed_folder { + if {[::xo::dc 0or1row is_transformed_folder { select 1 from cr_folders where folder_id = :root_folder_id} ]} { ::xo::db::sql::content_folder delete -folder_id $root_folder_id -cascade_p 1 } else { ::xo::db::sql::content_item delete -item_id $root_folder_id } } - ns_log notice " before-uninstantiate DONE" + ns_log notice "before-uninstantiate DONE" } @@ -59,7 +59,7 @@ @author Gustaf Neumann } { - set comment_ids [::xo::db_list get_comments { + set comment_ids [::xo::dc list get_comments { select g.comment_id from general_comments g, cr_items i,acs_objects o where i.item_id = g.object_id @@ -102,3 +102,9 @@ } ::xo::library source_dependent +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl,v diff -u -r1.132.2.4 -r1.132.2.5 --- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 7 Nov 2013 11:52:26 -0000 1.132.2.4 +++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 11 Feb 2014 11:58:19 -0000 1.132.2.5 @@ -153,7 +153,7 @@ -folder_id $folder_id \ -with_subtypes false \ -select_attributes {name}] - db_foreach [$form qn get_page_templates] $q { + xo::dc foreach get_page_templates $q { lappend lpairs [list $name $item_id] } if_no_rows { lappend lpairs [list "(No Page Template available)" ""] @@ -501,7 +501,7 @@ $data set upload_file $upload_file $data set import_file [$data form_parameter upload_file.tmpfile] set mime_type [$data form_parameter upload_file.content-type] - if {[::xo::db_0or1row check_mimetype { + if {[::xo::dc 0or1row check_mimetype { select 1 from cr_mime_types where mime_type = :mime_type }] == 0 || $mime_type eq "application/octet-stream" @@ -877,3 +877,9 @@ } ::xo::library source_dependent +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v diff -u -r1.472.2.7 -r1.472.2.8 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 18 Nov 2013 09:23:01 -0000 1.472.2.7 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 11 Feb 2014 11:58:19 -0000 1.472.2.8 @@ -146,7 +146,7 @@ ::xo::db::require table xowiki_references \ "reference integer references cr_items(item_id) on delete cascade, - link_type [::xo::db::sql map_datatype text], + link_type [::xo::dc map_datatype text], page integer references cr_items(item_id) on delete cascade" ::xo::db::require index -table xowiki_references -col reference @@ -176,7 +176,7 @@ ::xo::db::require index -table xowiki_tags -col package_id ::xo::db::require index -table xowiki_page -col page_order \ - -using [expr {[::xo::db::has_ltree] ? "gist" : ""}] + -using [expr {[::xo::dc has_ltree] ? "gist" : ""}] set sortkeys [expr {[db_driverkey ""] eq "oracle" ? "" : ", ci.tree_sortkey, ci.max_child_sortkey"}] ::xo::db::require view xowiki_page_live_revision \ @@ -212,8 +212,8 @@ ::xotcl::Object create autoname autoname proc generate {-parent_id -name} { - db_transaction { - set already_recorded [::xo::db_0or1row autoname_query { + ::xo::dc transaction { + set already_recorded [::xo::dc 0or1row autoname_query { select count from xowiki_autonames where parent_id = :parent_id and name = :name}] @@ -843,14 +843,14 @@ -user_id:required tags } { - db_dml [my qn delete_tags] \ - "delete from xowiki_tags where item_id = $item_id and user_id = $user_id" + ::xo::dc dml [my qn delete_tags] \ + "delete from xowiki_tags where item_id = :item_id and user_id = :user_id" foreach tag [split $tags " ,;"] { if {$tag ne ""} { - db_dml [my qn insert_tag] \ + ::xo::dc dml [my qn insert_tag] \ "insert into xowiki_tags (item_id,package_id, user_id, tag, time) \ - values ($item_id, $package_id, $user_id, :tag, current_timestamp)" + values (:item_id, :package_id, :user_id, :tag, now())" } } search::queue -object_id $revision_id -event UPDATE @@ -860,27 +860,27 @@ if {[info exists item_id]} { if {[info exists user_id]} { # tags for item and user - set tags [::xo::db_list get_tags { + set tags [::xo::dc list get_tags { SELECT distinct tag from xowiki_tags where user_id = :user_id and item_id = :item_id and package_id = :package_id }] } else { # all tags for this item - set tags [::xo::db_list get_tags { + set tags [::xo::dc list get_tags { SELECT distinct tag from xowiki_tags where item_id = :item_id and package_id = :package_id }] } } else { if {[info exists user_id]} { # all tags for this user - set tags [::xo::db_list get_tags { + set tags [::xo::dc list get_tags { SELECT distinct tag from xowiki_tags where user_id = :user_id and package_id :package_id }] } else { # all tags for the package - set tags [::xo::db_list get_tags { + set tags [::xo::dc list get_tags { SELECT distinct tag from xowiki_tags where package_id = :package_id }] @@ -1781,7 +1781,7 @@ set description [ad_html_text_convert -from text/html -to text/plain -- $content] } if {$description eq "" && $revision_id > 0} { - set body [::xo::db_string get_description_from_syndication \ + set body [::xo::dc get_value get_description_from_syndication \ "select body from syndication where object_id = $revision_id" \ -default ""] set description [ad_html_text_convert -from text/html -to text/plain -- $body] @@ -1849,11 +1849,11 @@ Page instproc references_update {references} { #my msg $references my instvar item_id - db_dml [my qn delete_references] \ + ::xo::dc dml delete_references \ "delete from xowiki_references where page = :item_id" foreach ref $references { lassign $ref r link_type - db_dml [my qn insert_reference] \ + ::xo::dc dml insert_reference \ "insert into xowiki_references (reference, link_type, page) \ values (:r,:link_type,:item_id)" } @@ -2037,13 +2037,14 @@ if {![info exists user_id]} {set user_id [::xo::cc set untrusted_user_id]} if {$user_id > 0} { # only record information for authenticated users - db_dml [my qn update_last_visisted] \ - "update xowiki_last_visited set time = current_timestamp, count = count + 1 \ - where page_id = :item_id and user_id = :user_id" - if {[db_resultrows] < 1} { - db_dml [my qn insert_last_visisted] \ + set rows [xo::dc dml update_last_visisted { + update xowiki_last_visited set time = now(), count = count + 1 + where page_id = :item_id and user_id = :user_id + }] + if {$rows ne "" && $rows < 1} { + ::xo::dc dml insert_last_visisted \ "insert into xowiki_last_visited (page_id, package_id, user_id, count, time) \ - values (:item_id, :package_id, :user_id, 1, current_timestamp)" + values (:item_id, :package_id, :user_id, 1, now())" } } } @@ -2302,7 +2303,7 @@ if {![my exists full_file_name]} { if {[my exists item_id]} { my instvar text mime_type package_id item_id revision_id - set storage_area_key [::xo::db_string get_storage_key \ + set storage_area_key [::xo::dc get_value get_storage_key \ "select storage_area_key from cr_items where item_id=:item_id"] my set full_file_name [cr_fs_path $storage_area_key]/$text #my log "--F setting FILE=[my set full_file_name]" @@ -2503,17 +2504,17 @@ set publish_status_clause [::xowiki::Includelet publish_status_clause -base_table i $publish_status] if {$package_id} { set bt "xowiki_page_instancei" - set package_clause "and object_package_id = $package_id" + set package_clause "and object_package_id = :package_id" } else { set bt "xowiki_page_instance" set package_clause "" } if {$parent_id} { - set parent_id_clause "and parent_id = $parent_id" + set parent_id_clause "and parent_id = :parent_id" } else { set parent_id_clause "" } - set count [::xo::db_string [my qn count_usages] \ + set count [::xo::dc get_value count_usages \ "select count(page_instance_id) from $bt, cr_items i \ where page_template = $item_id \ $publish_status_clause $package_clause $parent_id_clause \ @@ -3142,7 +3143,7 @@ # set filter_clause "" array set wc $h_where - set use_hstore [expr {[::xo::db::has_hstore] && + set use_hstore [expr {[::xo::dc has_hstore] && [$package_id get_parameter use_hstore 0] }] if {$use_hstore && $wc(h) ne ""} { @@ -3163,6 +3164,8 @@ set package_clause "and object_package_id = $package_id" } elseif {$from_package_ids eq "*"} { set package_clause "" + } elseif {[llength $from_package_ids] == 1} { + set package_clause "and object_package_id = $from_package_ids" } else { set package_clause "and object_package_id in ([join $from_package_ids ,])" } @@ -3754,7 +3757,7 @@ my instvar package_id name - db_transaction { + ::xo::dc transaction { # # if the newly created item was in production mode, but ordinary entries # are not, change on the first save the status to ready @@ -3767,9 +3770,7 @@ my map_categories $category_ids my save -use_given_publish_date $use_given_publish_date - #my log "-- old_name $old_name, name $name" if {$old_name ne $name} { - #my msg "do rename from $old_name to $name" $package_id flush_name_cache -name $old_name -parent_id [my parent_id] my rename -old_name $old_name -new_name $name } @@ -3781,3 +3782,9 @@ ::xo::library source_dependent +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl,v diff -u -r1.31.2.2 -r1.31.2.3 --- openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 30 Sep 2013 11:37:18 -0000 1.31.2.2 +++ openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 11 Feb 2014 11:58:19 -0000 1.31.2.3 @@ -97,8 +97,8 @@ set package_ids [list] foreach package_id [::xowiki::Package instances] { ns_log notice "checking package_id $package_id" - set folder_id [::xo::db_list get_folder_id "select f.folder_id from cr_items c, cr_folders f \ - where c.name = 'xowiki: $package_id' and c.item_id = f.folder_id"] + set folder_id [::xo::dc list get_folder_id "select f.folder_id from cr_items c, cr_folders f \ + where c.name = 'xowiki: :package_id' and c.item_id = f.folder_id"] if {$folder_id ne ""} { db_dml update_package_id {update acs_objects set package_id = :package_id where object_id in @@ -145,10 +145,10 @@ -attribute_name page_order \ -datatype text \ -pretty_name Order \ - -column_spec [::xo::db::sql map_datatype ltree]} + -column_spec [::xo::dc map_datatype ltree]} ::xo::db::require index -table xowiki_page -col page_order \ - -using [expr {[::xo::db::has_ltree] ? "gist" : ""}] + -using [expr {[::xo::dc has_ltree] ? "gist" : ""}] ::xowiki::update_views return 1 } @@ -174,10 +174,10 @@ } { set extra_clause "" if {[info exists package_id]} { - append extra_clause " and o.package_id = $package_id" + append extra_clause " and o.package_id = :package_id" } if {[info exists item_id]} { - append extra_clause " and i.item_id = $item_id" + append extra_clause " and i.item_id = :item_id" } # only delete revisions older than this date @@ -196,7 +196,7 @@ and i.publish_status = 'production' and i.name = r.revision_id::varchar $extra_clause " - foreach tuple [::xo::db_list_of_lists get_revisions $sql] { + ::xo::dc foreach get_revisions $sql { #::xotcl::Object msg "tuple = $tuple" lassign $tuple name package_id item_id revision_id last_modified set time [clock scan [::xo::db::tcl_date $last_modified tz_var]] @@ -227,7 +227,7 @@ set last_user "" set last_revision "" - foreach tuple [::xo::db_list_of_lists get_revisions $sql] { + xo::dc foreach get_revisions $sql { #::xotcl::Object msg "tuple = $tuple" lassign $tuple name item_id revision_id last_modified user package_id set time [clock scan [::xo::db::tcl_date $last_modified tz_var]] @@ -253,7 +253,7 @@ } proc unmounted_instances {} { - return [::xo::db_list unmounted_instances { + return [::xo::dc list unmounted_instances { select package_id from apm_packages p where not exists (select 1 from site_nodes where object_id = p.package_id) and p.package_key = 'xowiki' @@ -282,9 +282,9 @@ } proc ::xowiki::page_order_uses_ltree {} { - if {[::xo::db::has_ltree]} { + if {[::xo::dc has_ltree]} { ns_cache eval xotcl_object_cache ::xowiki::page_order_uses_ltree { - return [::xo::db_string check_po_ltree { + return [::xo::dc get_value check_po_ltree { select count(*) from pg_attribute a, pg_type t, pg_class c where attname = 'page_order' and a.atttypid = t.oid and c.oid = a.attrelid and relname = 'xowiki_page'}] @@ -301,7 +301,7 @@ ::xo::clusterwide ns_cache flush xotcl_object_type_cache $item_id set form_id [::xowiki::Weblog instantiate_forms -forms en:folder.form -package_id $package_id] - if {[::xo::db_0or1row check { + if {[::xo::dc 0or1row check { select 1 from cr_items where content_type = '::xowiki::FormPage' and item_id = :item_id }]} { ns_log notice "folder $item_id is already converted" @@ -319,9 +319,9 @@ db_dml chg2 "insert into xowiki_page_instance (page_instance_id, page_template) values ($revision_id, $form_id)" db_dml chg3 "insert into xowiki_form_page (xowiki_form_page_id) values ($revision_id)" - db_dml chg4 "update acs_objects set object_type = 'content_item' where object_id = $item_id" - db_dml chg5 "update acs_objects set object_type = '::xowiki::FormPage' where object_id = $revision_id" - db_dml chg6 "update cr_items set content_type = '::xowiki::FormPage', publish_status = 'ready', live_revision = $revision_id, latest_revision = $revision_id where item_id = $item_id" + db_dml chg4 "update acs_objects set object_type = 'content_item' where object_id = :item_id" + db_dml chg5 "update acs_objects set object_type = '::xowiki::FormPage' where object_id = :revision_id" + db_dml chg6 "update cr_items set content_type = '::xowiki::FormPage', publish_status = 'ready', live_revision = :revision_id, latest_revision = :revision_id where item_id = :item_id" } ad_proc -public -callback subsite::url -impl apm_package { @@ -488,7 +488,7 @@ and ci.parent_id = $parent_id \ and ([join $likes { or }])" #my log $sql - set pages [::xo::db_list_of_lists get_pages_with_page_order $sql] + set pages [::xo::dc list_of_lists get_pages_with_page_order $sql] return $pages } @@ -716,4 +716,10 @@ return [$root asList] } -::xo::library source_dependent \ No newline at end of file +::xo::library source_dependent +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v diff -u -r1.320.2.8 -r1.320.2.9 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 4 Dec 2013 12:10:53 -0000 1.320.2.8 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 11 Feb 2014 11:58:19 -0000 1.320.2.9 @@ -206,6 +206,7 @@ ::xowiki::FormPage get_instance_from_db -item_id $id $f copy_content_vars -from_object $id $f item_id $id + $f save } } @@ -327,7 +328,7 @@ Page instproc delete-revision {} { my instvar revision_id package_id item_id - ::xo::db_1row get_revision { + ::xo::dc 1row get_revision { select latest_revision,live_revision from cr_items where item_id = :item_id } # do real deletion via package @@ -337,7 +338,7 @@ [export_vars -base [$package_id url] {{m revisions}}]] if {$live_revision == $revision_id} { # latest revision might have changed by delete_revision, so we have to fetch here - xo::db_1row [my qn get_revision] "select latest_revision from cr_items where item_id = $item_id" + xo::dc 1row get_revision "select latest_revision from cr_items where item_id = :item_id" if {$latest_revision eq ""} { # we are out of luck, this was the final revision, delete the item my instvar package_id name @@ -763,7 +764,7 @@ # roughly the counterpart to edit_data and save_data in ad_forms. # set content [my render -update_references true] - #my msg "after save refs=[expr {[my exists references]?[my set references] : {NONE}}]" + #my log "after save refs=[expr {[my exists references]?[my set references] : {NONE}}]" set redirect_method [my form_parameter __form_redirect_method "view"] if {$redirect_method eq "__none"} { @@ -1023,11 +1024,11 @@ set href [$package_id pretty_link $weblog_page]?summary=1 set entries [list] - db_foreach [my qn get_popular_tags] \ - [::xo::db::sql select \ + xo::dc foreach get_popular_tags \ + [::xo::dc select \ -vars "count(*) as nr, tag" \ -from "xowiki_tags" \ - -where "item_id=$item_id" \ + -where "item_id = :item_id" \ -groupby "tag" \ -orderby "nr" \ -limit $limit] { @@ -1042,7 +1043,7 @@ Page ad_instproc save-attributes {} { The method save-attributes is typically callable over the - REST interface. It allows to save attributes of a + REST interface. It allows to save attributes of a page without adding a new revision. } { my instvar package_id @@ -2182,3 +2183,10 @@ } ::xo::library source_dependent + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowiki/www/admin/delete-type.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/delete-type.tcl,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/xowiki/www/admin/delete-type.tcl 13 Sep 2012 16:05:32 -0000 1.12 +++ openacs-4/packages/xowiki/www/admin/delete-type.tcl 11 Feb 2014 11:58:19 -0000 1.12.2.1 @@ -13,7 +13,7 @@ } set sql [$object_type instance_select_query -with_subtypes 0 -folder_id [::$package_id folder_id]] -db_foreach retrieve_instances $sql { +xo::dc foreach retrieve_instances $sql { permission::require_write_permission -object_id $item_id $package_id delete -item_id $item_id -name $name } Index: openacs-4/packages/xowiki/www/admin/export.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/export.tcl,v diff -u -r1.21 -r1.21.2.1 --- openacs-4/packages/xowiki/www/admin/export.tcl 20 Jul 2013 15:48:35 -0000 1.21 +++ openacs-4/packages/xowiki/www/admin/export.tcl 11 Feb 2014 11:58:19 -0000 1.21.2.1 @@ -18,7 +18,7 @@ # if {$objects eq ""} { set sql [$object_type instance_select_query -folder_id $folder_id -with_subtypes true] - db_foreach instance_select $sql { set items($item_id) 1 } + xo::dc foreach instance_select $sql { set items($item_id) 1 } } else { foreach o $objects { $package_id get_lang_and_name -default_lang [::xo::cc lang] -path $o lang stripped_name Index: openacs-4/packages/xowiki/www/admin/list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/list.tcl,v diff -u -r1.34.2.1 -r1.34.2.2 --- openacs-4/packages/xowiki/www/admin/list.tcl 17 Sep 2013 17:49:25 -0000 1.34.2.1 +++ openacs-4/packages/xowiki/www/admin/list.tcl 11 Feb 2014 11:58:20 -0000 1.34.2.2 @@ -58,7 +58,7 @@ set ::individual_permissions [expr {[$package_id set policy] eq "::xowiki::policy3"}] set ::with_publish_status 1 -TableWidget t1 -volatile \ +TableWidget create t1 -volatile \ -actions $actions \ -columns { BulkAction objects -id name -actions { @@ -98,12 +98,12 @@ "to_char(last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified" ] set folder_id [::$package_id folder_id] -foreach i [db_list get_syndicated { +foreach i [xo::dc list get_syndicated { select s.object_id from syndication s, cr_items ci where s.object_id = ci.live_revision and ci.parent_id = :folder_id }] { set syndicated($i) 1 } -db_foreach instance_select \ +xo::dc foreach instance_select \ [$object_type instance_select_query \ -folder_id $folder_id \ -with_subtypes $with_subtypes \ @@ -116,7 +116,7 @@ set page_link [::$package_id pretty_link -parent_id $parent_id $name] set name [::$package_id external_name -parent_id $parent_id $name] - t1 add \ + ::template::t1 add \ -name $name \ -title $title \ -object_type [string map [list "::xowiki::" ""] $object_type] \ @@ -131,8 +131,9 @@ -delete "" \ -delete.href [export_vars -base [$package_id package_url] {{delete 1} item_id name return_url}] \ -delete.title #xowiki.delete# + if {$::individual_permissions} { - [t1 last_child] set permissions.href \ + [::template::t1 last_child] set permissions.href \ [export_vars -base permissions {item_id return_url}] } if {$::with_publish_status} { @@ -144,12 +145,12 @@ set image inactive.png set state "ready" } - [t1 last_child] set publish_status.src /resources/xowiki/$image - [t1 last_child] set publish_status.href \ + [::template::t1 last_child] set publish_status.src /resources/xowiki/$image + [::template::t1 last_child] set publish_status.href \ [export_vars -base [$package_id package_url]admin/set-publish-state \ {state revision_id return_url}] } - [t1 last_child] set page_order $page_order + [::template::t1 last_child] set page_order $page_order } set t1 [t1 asHTML] Index: openacs-4/packages/xowiki/www/admin/portal-element-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/portal-element-add.tcl,v diff -u -r1.14 -r1.14.2.1 --- openacs-4/packages/xowiki/www/admin/portal-element-add.tcl 13 Sep 2012 16:05:33 -0000 1.14 +++ openacs-4/packages/xowiki/www/admin/portal-element-add.tcl 11 Feb 2014 11:58:20 -0000 1.14.2.1 @@ -31,7 +31,7 @@ # for the time being, we add the portlet on the first page (page 0) set portal_page_id [portal::get_page_id -portal_id $portal_id -sort_key 0] - if {[db_string check_unique_name_on_page { + if {[xo::dc get_value check_unique_name_on_page { select 1 from portal_element_map where page_id = :portal_page_id and pretty_name = :page_title Index: openacs-4/packages/xowiki/www/admin/set-publish-state.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/set-publish-state.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/xowiki/www/admin/set-publish-state.tcl 13 Sep 2012 16:05:33 -0000 1.9 +++ openacs-4/packages/xowiki/www/admin/set-publish-state.tcl 11 Feb 2014 11:58:20 -0000 1.9.2.1 @@ -13,7 +13,7 @@ {-return_url "."} } -set item_id [db_string get_item_id \ +set item_id [xo::dc get_value get_item_id \ {select item_id from cr_revisions where revision_id = :revision_id}] ns_cache flush xotcl_object_cache ::$item_id Index: openacs-4/packages/xowiki/www/admin/test.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/Attic/test.tcl,v diff -u -r1.36 -r1.36.2.1 --- openacs-4/packages/xowiki/www/admin/test.tcl 2 Apr 2013 10:44:27 -0000 1.36 +++ openacs-4/packages/xowiki/www/admin/test.tcl 11 Feb 2014 11:58:20 -0000 1.36.2.1 @@ -107,14 +107,14 @@ "the test instance does not exist" #set root_id [site_node::get_root_node_id] -set root_id [db_string "" {select node_id from site_nodes where parent_id is null}] +set root_id [xo::dc get_value "" {select node_id from site_nodes where parent_id is null}] -if {[db_0or1row check_broken_site_nodes { +if {[xo::dc 0or1row check_broken_site_nodes { select node_id, name from site_nodes where name = :instance_name and parent_id = :root_id }]} { test hint "... site nodes seem broken, since we have an entry, but site_node::exists_p returns false" test hint "... try to fix anyhow" - db_dml fix_broken_entry { + xo::dc dml fix_broken_entry { delete from site_nodes where name = :instance_name and parent_id = :root_id } } @@ -167,7 +167,7 @@ ? {::$folder_id parent_id} -100 "parent_id of folder object is -100" ? {expr {[::$folder_id item_id]>0}} 1 "item_id given" ? {expr {[::$folder_id revision_id]>0}} 1 "revision_id given" -? {db_string count "select count(*) from cr_items where parent_id = $folder_id"} 0 \ +? {xo::dc get_value count "select count(*) from cr_items where parent_id = $folder_id"} 0 \ "folder contains no objects" ############################################## @@ -191,7 +191,7 @@ ? {expr {$content_length > 1000}} 1 \ "page rendered, content-length $content_length > 1000" ? {string first Error $content} -1 "page contains no error" -? {db_string count "select count(*) from cr_items where parent_id = $folder_id"} 1 \ +? {xo::dc get_value count "select count(*) from cr_items where parent_id = $folder_id"} 1 \ "folder contains the index page" #test code [$page_item_id serialize] @@ -262,7 +262,7 @@ ? {::$folder_id parent_id} -100 "parent_id of folder object is -100" ? {expr {[::$folder_id item_id]>0}} 1 "item_id given" ? {expr {[::$folder_id revision_id]>0}} 1 "revision_id given" -? {db_string count "select count(*) from cr_items where parent_id = $folder_id"} 1 \ +? {xo::dc get_value count "select count(*) from cr_items where parent_id = $folder_id"} 1 \ "folder contains the index" ######################################### @@ -317,7 +317,7 @@ ? {string first Error $content} -1 "page contains no error" #test hint $content -? {db_string count "select count(*) from cr_items where parent_id = $folder_id"} 3 \ +? {xo::dc get_value count "select count(*) from cr_items where parent_id = $folder_id"} 3 \ "folder contains: index and weblog page (+1 includelet)" ::xo::at_cleanup @@ -373,7 +373,7 @@ test section "Testing as SWA: query /$instance_name/" ##################################################### -set swas [db_list get_swa "select grantee_id from acs_permissions \ +set swas [xo::dc list get_swa "select grantee_id from acs_permissions \ where object_id = -4 and privilege = 'admin'"] ::xowiki::Package initialize -parameter $index_vuh_parms \ @@ -393,7 +393,7 @@ "SWA sees the delete link" ? {expr {[::$package_id make_link -privilege admin -link admin/ $package_id {} {}] ne ""}} 1 \ "SWA sees admin link" -? {db_string count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 3 \ +? {xo::dc get_value count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 3 \ "folder contains: index and weblog page (+1 includelet)" ::xo::at_cleanup @@ -412,7 +412,7 @@ ? {::xo::cc exists __continuation} 1 "continuation exists" ? {::xo::cc set __continuation} "ad_returnredirect /$instance_name/" \ "redirect to main instance" -? {db_string count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 2 \ +? {xo::dc get_value count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 2 \ "folder contains: index and weblog page (+0 includelet)" ############################################################################ @@ -431,7 +431,7 @@ $page initialize_loaded_object $page save_new ? {$page set package_id} $package_id "package_id $package_id not modified" -? {db_string count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 3 \ +? {xo::dc get_value count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 3 \ "folder contains: index and weblog, hello page (+0 includelet)" ? {expr {[$page revision_id]>0}} 1 "revision_id given" ? {expr {[$page item_id]>0}} 1 "item_id given" @@ -440,7 +440,7 @@ $page append title "- V.2" $page save -? {db_string count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 3 \ +? {xo::dc get_value count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 3 \ "still 3 pages" ? {expr {[$page revision_id]>$revision_id1}} 1 "revision_id > old revision_id" ? {expr {[$page item_id] == $item_id1}} 1 "item id the same" @@ -464,7 +464,7 @@ ? {expr {$content_length > 1000}} 1 \ "page rendered, content-length $content_length > 1000" ? {string first Error $content} -1 "page contains no error" -? {db_string count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 4 \ +? {xo::dc get_value count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 4 \ "again, 4 pages" ::xo::at_cleanup @@ -1498,4 +1498,4 @@ Tests passed: [test set passed]
Tests failed: [test set failed]
Tests Time: [t1 diff -start]ms
-" \ No newline at end of file +" Index: openacs-4/packages/xowiki/www/ckeditor-images/thumb-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/ckeditor-images/thumb-view.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/xowiki/www/ckeditor-images/thumb-view.tcl 13 Sep 2012 16:05:34 -0000 1.4 +++ openacs-4/packages/xowiki/www/ckeditor-images/thumb-view.tcl 11 Feb 2014 11:58:20 -0000 1.4.2.1 @@ -4,7 +4,7 @@ {parent_id ""} } -validate { parent_id_exists -requires {parent_id} { - if {[db_0or1row object_exists "select item_id from cr_items where item_id =:parent_id"] == 0} { + if {[xo::dc 0or1row object_exists "select item_id from cr_items where item_id =:parent_id"] == 0} { #ad_complain "Das angegebene Objekt existiert nicht." } } Index: openacs-4/packages/xowiki/www/ckeditor-images/upload_image.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/ckeditor-images/upload_image.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/xowiki/www/ckeditor-images/upload_image.tcl 13 Oct 2013 18:13:59 -0000 1.7.2.1 +++ openacs-4/packages/xowiki/www/ckeditor-images/upload_image.tcl 11 Feb 2014 11:58:20 -0000 1.7.2.2 @@ -32,13 +32,13 @@ break } - #set parent_id [db_string _ "select parent_id from cr_items where item_id=:fs_package_id"] + #set parent_id [xo::dc get_value _ "select parent_id from cr_items where item_id=:fs_package_id"] set title $file_name - set existing_filenames [db_list _ "select name from cr_items where parent_id = :parent_id" ] + set existing_filenames [xo::dc list _ "select name from cr_items where parent_id = :parent_id" ] ns_log notice "util_text_to_url -text ${title} -existing_urls \"$existing_filenames\" -replacement \"_\"" set filename [util_text_to_url -text "${title}" -existing_urls "$existing_filenames" -replacement "_"] - set package_id [db_string _ "select package_id from acs_objects where object_id=:parent_id"] + set package_id [xo::dc get_value _ "select package_id from acs_objects where object_id=:parent_id"] ::xowiki::Package initialize -package_id $package_id set file_object [::xowiki::File new -destroy_on_cleanup \ -title $title \ Index: openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/weblog-mini-calendar.tcl,v diff -u -r1.17.2.1 -r1.17.2.2 --- openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl 13 Oct 2013 18:13:59 -0000 1.17.2.1 +++ openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl 11 Feb 2014 11:58:20 -0000 1.17.2.2 @@ -56,11 +56,11 @@ and ci.item_id != $including_item_id \ and ci.publish_status <> 'production' " -db_foreach entries_this_month "select count(ci.item_id) as c, - [::xo::db::sql date_trunc day p.publish_date] as d \ +xo::dc foreach entries_this_month "select count(ci.item_id) as c, + [::xo::dc date_trunc day p.publish_date] as d \ $innersql - and [::xo::db::sql date_trunc_expression month p.publish_date $year-$month-01] \ - group by [::xo::db::sql date_trunc day p.publish_date]" { + and [::xo::dc date_trunc_expression month p.publish_date $year-$month-01] \ + group by [::xo::dc date_trunc day p.publish_date]" { set entries([lindex $d 0]) $c } @@ -75,9 +75,9 @@ # # Compute the available time range # -set dates [db_list_of_lists get_dates "select min([::xo::db::sql date_trunc day p.publish_date]),max([::xo::db::sql date_trunc day p.publish_date]) $innersql"] +set dates [db_list_of_lists get_dates "select min([::xo::dc date_trunc day p.publish_date]),max([::xo::dc date_trunc day p.publish_date]) $innersql"] set earliest_date [::xo::db::tcl_date [lindex $dates 0 0] _] -set latest_date [::xo::db::::tcl_date [lindex $dates 0 end] _] +set latest_date [::xo::db::tcl_date [lindex $dates 0 end] _] if {$prev_mon < [clock scan $earliest_date]} { set prev_month_url "" Index: openacs-4/packages/xowiki/www/prototypes/categories-portlet.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/categories-portlet.page,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/packages/xowiki/www/prototypes/categories-portlet.page 13 Sep 2012 16:05:37 -0000 1.7 +++ openacs-4/packages/xowiki/www/prototypes/categories-portlet.page 11 Feb 2014 11:58:20 -0000 1.7.2.1 @@ -80,7 +80,7 @@ } if {$count} { - db_foreach get_counts \ + xo::dc foreach get_counts \ "select count(*) as nr,category_id from $sql group by category_id" { $category($category_id) set count $nr set s [expr {$summary ? "&summary=$summary" : ""}] @@ -89,7 +89,7 @@ } append content [$cattree(0) render -tree_style $tree_style] } else { - db_foreach get_pages \ + xo::dc foreach get_pages \ "select ci.item_id, ci.name, ci.content_type, r.title, category_id from $sql" { if {$title eq ""} {set title $name} set itemobj [Object new] Index: openacs-4/packages/xowiki/www/prototypes/contributors.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/contributors.page,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/xowiki/www/prototypes/contributors.page 13 Sep 2012 16:05:37 -0000 1.6 +++ openacs-4/packages/xowiki/www/prototypes/contributors.page 11 Feb 2014 11:58:21 -0000 1.6.2.1 @@ -12,7 +12,7 @@ Field count -label "Page Revisions" -html { align right } } - db_foreach get_contributors {select count(object_id) as count, creation_user + xo::dc foreach get_contributors {select count(object_id) as count, creation_user from acs_objects o, cr_revisions cr,cr_items ci where object_id = revision_id and parent_id = :folder_id