Index: openacs-4/packages/cms/tcl/content-method-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/content-method-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/cms/tcl/content-method-procs.tcl 14 Aug 2002 03:57:42 -0000 1.6 +++ openacs-4/packages/cms/tcl/content-method-procs.tcl 15 Aug 2002 03:39:34 -0000 1.7 @@ -110,16 +110,7 @@ set text_entry_filter_sql "" - template::query count_text_mime_types has_text_mime_type onevalue " - select - count(*) - from - cr_content_mime_type_map - where - mime_type like ('%text/%') - and - content_type = :content_type - " + set has_text_mime_type [db_string count_text_mime_types ""] if { $has_text_mime_type == 0 } { set text_entry_filter_sql \ @@ -145,6 +136,8 @@ } { if { [template::util::is_nil content_type] } { + # FIXME: figure out what to do with these after template::query calls + # are gone. # flush the entire content_method_types cache template::query::flush_cache "content_method_types*" Index: openacs-4/packages/cms/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/cms/tcl/form-procs.tcl 21 Sep 2001 05:01:38 -0000 1.17 +++ openacs-4/packages/cms/tcl/form-procs.tcl 15 Aug 2002 03:39:34 -0000 1.18 @@ -35,11 +35,12 @@ if { ![template::util::is_nil extra_orderby] } { append query ", $extra_orderby" } + if [string equal $datasource_type multirow] { + uplevel "db_multirow $datasource_name get_form_metadata \{$query\}" + } else { + uplevel "set $datasource_name [db_list_of_lists get_form_metadata {}]" + } - uplevel " - template::query get_form_metadata $datasource_name $datasource_type \{$query\} - " - } ad_proc -public content::assemble_form_element { datasource_ref the_attribute_name start_row {db {}}} { @@ -128,9 +129,7 @@ } elseif { ![template::util::is_nil opts(item_id)] } { set item_id $opts(item_id) - template::query get_revision_id revision_id onevalue " - select content_item.get_latest_revision(:item_id) from dual - " + set revision_id [db_string get_revision_id ""] } if { [info exists opts(content_type)] } { @@ -146,10 +145,7 @@ return } - template::query get_content_type content_type onevalue " - select content_type from cr_items i, cr_revisions r - where r.item_id = i.item_id - and r.revision_id = :revision_id" + set content_type [db_string get_content_type ""] } # Run the gigantic uber-query. This is somewhat wasteful; should @@ -182,9 +178,7 @@ } } - template::query get_element_value element_value onevalue " - select $what from ${table_name}x where revision_id = :revision_id - " + set element [db_string get_element_value ""] lappend code_params -value $element_value -values [list $element_value] } @@ -339,7 +333,7 @@ # build the option list if { [string equal $datatype "enumeration"] } { - template::query get_enum_values options multilist $__sql + set options [db_list_of_list get_enum_values $__sql] lappend code_params -options $options } @@ -350,7 +344,20 @@ if { [string equal $param_source "eval"] } { set source [eval $value] } elseif { [string equal $param_source "query"] } { - template::query revision_create_get_value source $param_type $value + switch $param_type { + onevalue { + set source [db_string revision_create_get_value $value] + } + onelist { + set source [db_list revision_create_get_value $value] + } + multilist { + set source [db_list_of_lists revision_create_get_value $value] + } + default { + error "invalid param_type" + } + } } else { set source $value } @@ -389,28 +396,7 @@ set last_table "" set last_id_column "" - template::query get_extended_attributes rows multirow " - select - types.table_name, types.id_column, attr.attribute_name, - attr.datatype - from - acs_attributes attr, - ( select - object_type, table_name, id_column, level as inherit_level - from - acs_object_types - where - object_type <> 'acs_object' - and - object_type <> 'content_revision' - connect by - prior supertype = object_type - start with - object_type = :content_type) types - where - attr.object_type (+) = types.object_type - order by - types.inherit_level desc" + db_multirow rows get_extended_attributes "" for { set i 1 } { $i <= ${rows:rowcount} } { incr i } { upvar 0 "rows:${i}" row @@ -507,7 +493,7 @@ set last_table "" set last_id_column "" - template::query insert_element_data rows multirow $query + db_multirow rows insert_element_data $query for { set i 1 } { $i <= ${rows:rowcount} } { incr i } { upvar 0 "rows:${i}" row @@ -726,11 +712,7 @@ ns_set put $bind_vars revision_id $revision_id # query for content_type and table_name - template::query addrev_get_content_type info onerow " - select object_type content_type, table_name - from acs_object_types - where object_type = (select content_type from cr_items - where item_id = :item_id)" + set info [db_1row addrev_get_content_type ""] set insert_statement [attribute_insert_statement \ $info(content_type) $info(table_name) $bind_vars $form_name] @@ -1407,19 +1389,7 @@ [template::element get_value $form_name content_type] # change mime types select widget to only allow text MIME types - template::query get_text_mime_types text_mime_types multilist " - select - label, map.mime_type as value - from - cr_mime_types types, cr_content_mime_type_map map - where - types.mime_type = map.mime_type - and - map.content_type = :content_type - and - lower(types.mime_type) like ('text/%') - order by - label" + set text_mime_types [db_list_of_lists get_text_mime_types ""] template::element set_properties $form_name mime_type \ -options $text_mime_types @@ -1485,39 +1455,22 @@ } # Get the parent type. If the parent is not an item, abort - template::query get_parent_type parent_type onevalue " - select content_type from cr_items - where item_id = :parent_id - " -cache "item_content_type $parent_id" -persistent \ - -timeout 3600 + set parent_type [db_string get_parent_type ""] if { [template::util::is_nil parent_type] } { return } # Get a multilist of all valid relation tags - template::query get_all_valid_relation_tags options multilist " - select - relation_tag as label, relation_tag as value - from - cr_type_children c - where - content_item.is_subclass(:parent_type, c.parent_type) = 't' - and - content_item.is_subclass(:content_type, c.child_type) = 't' - and - content_item.is_valid_child(:parent_id, c.child_type) = 't' - " + set options [db_list_of_lists get_all_valid_relation_tags ""] if { [template::util::is_nil options] } { return } # Create the section, if specified if { ![template::util::is_nil opts(section)] } { - template::query get_parent_title parent_title onevalue " - select content_item.get_title(:parent_id) from dual - " + set parent_title [db_string get_parent_title ""] if { ![template::util::is_nil parent_title] } { template::form section $form_name "Relationship to $parent_title" @@ -1566,7 +1519,17 @@ query { #set content_type content_revision set item_id {} - template::query set_content_values value $param(param_type) $param(value) + switch $param(param_type) { + onevalue { + set value [db_string set_content_values $param(value)] + } + onelist { + set value [db_list set_content_values $param(value)] + } + multilist { + set value [db_list_of_lists set_content_values $param(value)] + } + } } default { set value $param(value) @@ -1602,6 +1565,7 @@ lappend in_list [ns_dbquotevalue $object_type] } + template::query gtap_get_attribute_data attribute_data nestedlist " select [join $columns ","] @@ -1685,14 +1649,7 @@ # Query for values from a previous revision - template::query get_previous_version_values values onerow " - select - [join $columns ", "] - from - [get_type_info $content_type table_name]x - where - revision_id = :revision_id - " + db_1row get_previous_version_values "" -column_array values # Set the form values, handling dates with the date acquire function foreach pair $attr_types { @@ -1746,16 +1703,15 @@ } { - template::query count_mime_type is_text onevalue "select count(*) from cr_content_mime_type_map - where content_type = :content_type and mime_type like 'text/%'" + set is_text [db_string count_mime_type ""] - if { $is_text > 0 } { - set content_method text_entry - } else { - set content_method file_upload - } + if { $is_text > 0 } { + set content_method text_entry + } else { + set content_method file_upload + } - return $content_method + return $content_method } # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -1779,25 +1735,12 @@ if { [llength $args] == 0 } { - template::query get_type_info_1 info onevalue " - select - $ref - from - acs_object_types - where - object_type = :object_type" + set info [db_string get_type_info_1 ""] - return $info + return $info } else { - - template::query get_type_info_2 $ref onerow " - select - [join $args ","] - from - acs_object_types - where - object_type = :object_type" -uplevel + uplevel 1 "db_1row get_type_info_2 {} -column_array $ref" } } @@ -1837,31 +1780,12 @@ if { [llength $args] == 1 } { set type onelist + set attributes [db_list ga_get_attributes ""] } else { set type multilist + set attributes [db_list_of_lists ga_get_attributes ""] } - template::query ga_get_attributes attributes $type " - select - [join $args ","] - from - acs_attributes, - ( - select - object_type ancestor, level as type_order - from - acs_object_types - connect by - prior supertype = object_type - start with - object_type = :content_type - ) types - where - object_type = ancestor - and - attribute_name <> 'ldap dn' - order by type_order desc, sort_order" - return $attributes } @@ -1878,19 +1802,9 @@ } { - template::query gaev_get_enum_values enum multilist " - select - nvl(pretty_name,enum_value), - enum_value - from - acs_enum_values - where - attribute_id = :attribute_id - order by - sort_order" + set enum [db_list_of_lists gaev_get_enum_values ""] - - return $enum + return $enum } ad_proc -public content::get_latest_revision { item_id } { @@ -1903,10 +1817,9 @@ } { - template::query glr_get_latest_revision latest_revision onevalue " - select content_item.get_latest_revision(:item_id) from dual" + set latest_revision [db_string glr_get_latest_revision ""] - return $latest_revision + return $latest_revision } @@ -2040,15 +1953,10 @@ } # fetch the mime_type of the source revision - template::query cc_get_mime_type mime_type onevalue " - select mime_type from cr_revisions where revision_id = :revision_id_src" + set mime_type [db_string cc_get_mime_type ""] # copy the mime_type to the destination revision - db_dml cc_update_cr_revisions " - update cr_revisions - set mime_type = :mime_type - where revision_id = :revision_id_dest" - + db_dml cc_update_cr_revisions "" } } @@ -2094,23 +2002,9 @@ set parent_id [template::element get_value $form_name parent_id] if { [template::util::is_nil parent_id] } { - template::query vn_same_name_count1 same_name_count onevalue " - select - count(1) - from - cr_items - where - name = :name" + set same_name_count [db_string vn_same_name_count1 ""] } else { - template::query vn_same_name_count2 same_name_count onevalue " - select - count(1) - from - cr_items - where - name = :name - and - parent_id = :parent_id" + set same_name_count [db_string vn_same_name_count2 ""] } if { $same_name_count > 0 } { Index: openacs-4/packages/cms/tcl/item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/Attic/item-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/cms/tcl/item-procs.tcl 17 Sep 2001 05:16:40 -0000 1.6 +++ openacs-4/packages/cms/tcl/item-procs.tcl 15 Aug 2002 03:39:34 -0000 1.7 @@ -29,16 +29,14 @@ } { - template::query glr_get_live_revision live_revision onevalue " - select live_revision from cr_items - where item_id = :item_id" -cache "item_live_revision $item_id" + set live_revision [db_string glr_get_live_revision ""] - if { [template::util::is_nil live_revision] } { - ns_log notice "WARNING: No live revision for item $item_id" - return "" - } else { - return $live_revision - } + if { [template::util::is_nil live_revision] } { + ns_log notice "WARNING: No live revision for item $item_id" + return "" + } else { + return $live_revision + } } @@ -55,10 +53,8 @@ @see proc item::get_best_revision } { - template::query gifr_get_one_revision item_id onevalue " - select item_id from cr_revisions where revision_id = :revision_id - " -cache "item_from_revision $revision_id" - return $item_id + set item_id [db_string gifr_get_one_revision ""} + return $item_id } @@ -91,7 +87,7 @@ } # Get the path - template::query id_get_item_id item_id onevalue "select content_item__get_id(:url $root_sql) from dual" -cache "item_id $url $root_folder" + set item_id [db_string id_get_item_id ""] if { [info exists item_id] } { return $item_id @@ -117,16 +113,13 @@ } { - template::query gct_get_content_type content_type onevalue " - select content_type from cr_items where - item_id = :item_id - " -cache "item_content_type $item_id" + set content_type [db_string gct_get_content_type ""] - if { [info exists content_type] } { - return $content_type - } else { - return "" - } + if { [info exists content_type] } { + return $content_type + } else { + return "" + } } @@ -154,11 +147,7 @@ template::util::get_opts $args - template::query cmbt_get_content_mime_types types onelist " - select mime_type from cr_content_mime_type_map - where content_type = :content_type - and lower(mime_type) like 'text/%' - " -cache "content_mime_types $content_type" + set types [db_list cmbt_get_content_mime_types ""] set need_text [expr [llength $types] > 0] @@ -236,25 +225,10 @@ set content_type [get_content_type $item_id] # Get the table name - template::query grc_get_table_names table_name onevalue " - select table_name from acs_object_types - where object_type = :content_type - " -cache "type_table_name $content_type" -persistent \ - -timeout 3600 + set table_name [db_string grc_get_table_names ""] # Get (all) the content (note this is really dependent on file type) - template::query grc_get_all_content content onerow "select - x.*, - :item_id as item_id $text_sql, - :content_type as content_type - from - cr_revisions r, ${table_name}x x - where - r.revision_id = :revision_id - and - x.revision_id = r.revision_id - " -cache "content_for_revision $revision_id" -persistent \ - -timeout 3600 + db_0or1row grc_get_all_content "" -column_array content upvar content content @@ -286,11 +260,9 @@ @return 1 if the item is publishable, 0 otherwise } { - template::query ip_is_publishable_p is_publishable onevalue " - select content_item.is_publishable(:item_id) from dual - " -cache "item_is_publishable $item_id" + set is_publishable [db_string ip_is_publishable_p ""] - return [string equal $is_publishable t] + return [string equal $is_publishable t] } @@ -317,9 +289,7 @@ } { - template::query gps_get_publish_status publish_status onevalue " - select publish_status from cr_items where item_id = :item_id - " -cache "item_publish_status $item_id" + set publish_status [db_string gps_get_publish_status ""] return $publish_status } @@ -339,9 +309,8 @@ @see proc item::get_best_revision } { - template::query gt_get_title title onevalue " - select content_item.get_title(:item_id) from dual - " -cache "item_title $item_id" - return $title + set title [db_string gt_get_title ""] + + return $title } Index: openacs-4/packages/cms/tcl/module-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/module-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/cms/tcl/module-procs.tcl 20 Aug 2001 04:35:41 -0000 1.5 +++ openacs-4/packages/cms/tcl/module-procs.tcl 15 Aug 2002 03:39:34 -0000 1.6 @@ -38,10 +38,7 @@ Get the id of some module, return empty string on failure } { - template::query module_get_id id onevalue " - select module_id from cm_modules - where key = :module_name - " -cache "get_module_name $module_name" -persistent + set id [db_string module_get_id ""] return $id } @@ -51,13 +48,7 @@ Get a list of all the mount points } { - - template::query get_list mount_point_list multilist "select - key, name, '' as id, - '' as children, 't' as expandable, 'f' as symlink, - 0 as update_time - from cm_modules - order by sort_key" + set mount_point_list [db_list_of_lists get_list ""] # Append clipboard lappend mount_point_list [folderCreate "clipboard" "Clipboard" "" [list] t f 0] @@ -74,26 +65,7 @@ # query for child site nodes set module_name [namespace tail [namespace current]] - template::query module_get_result result multilist " - select - :mount_point as mount_point, - r.name, - r.item_id, - '' as children, - nvl((select 't' from dual where exists - (select 1 from cr_folders f_child, cr_resolved_items r_child - where r_child.parent_id = r.resolved_id - and f_child.folder_id = r_child.resolved_id)), 'f') expandable, - r.is_symlink symlink, - 0 update_time - from - cr_folders f, cr_resolved_items r - where - r.parent_id = :id - and - r.resolved_id = f.folder_id - order by - name" + set result [db_list_of_lists module_get_result ""] return $result } @@ -112,8 +84,7 @@ } { if { ![nsv_exists browser_state template_root] } { - template::query template_get_root_id root_id onevalue " - select content_template.get_root_folder() from dual" + set root_id [db_string template_get_root_id ""] nsv_set browser_state template_root $root_id return $root_id } else { @@ -158,8 +129,7 @@ } { if { ![nsv_exists browser_state sitemap_root] } { - template::query sitemap_get_root_id root_id onevalue " - select content_item.get_root_folder() from dual" + set root_id [db_string sitemap_get_root_id ""] nsv_set browser_state sitemap_root $root_id return $root_id } else { @@ -193,9 +163,7 @@ upvar sorted_paths_root_id _root_id set _root_id $root_id set sql [db_map sitemap_get_name] - uplevel " - template::query sitemap_get_name $name multirow \{$sql\} -eval \{$eval_code\} - " + uplevel "db_multirow $name sitemap_get_name \{$sql\} { $eval_code }" } @@ -208,17 +176,7 @@ } { - template::query types_get_result result multilist " - select - lpad(' ', level, '-') || pretty_name as label, - object_type as value - from - acs_object_types t - connect by - supertype = prior object_type - start with - object_type = 'content_revision' - " + set result [db_list_of_lists types_get_result ""] set result [concat [list [list "--" ""]] $result] @@ -241,25 +199,7 @@ # query for message categories set module_name [namespace tail [namespace current]] - template::query get_result result multilist "select - :module_name as mount_point, - t.pretty_name, - t.object_type, - '' as children, - NVL( - (select 't' from dual - where exists (select 1 from acs_object_types - where supertype = t.object_type)), - 'f' - ) as expandable, - 'f' as symlink, - 0 as update_time - from - acs_object_types t - where - supertype = :id - order by - t.pretty_name" + set result [db_list_of_lists get_result ""] return $result } @@ -292,27 +232,7 @@ # query for keyword categories - template::query category_get_children children multilist "select - :module_name as mount_point, - content_keyword.get_heading(keyword_id) as name, - keyword_id, - '' as children, - NVL( (select 't' from dual - where exists ( - select 1 from cr_keywords k2 - where k2.parent_id = k.keyword_id - and content_keyword.is_leaf(k2.keyword_id) = 'f')), - 'f') as expandable, - 'f' as symlink, - 0 as update_time - from - cr_keywords k - where - $where_clause - and - content_keyword.is_leaf(keyword_id) = 'f' - order by - name" + set children [db_list_of_lists category_get_children ""] return $children } @@ -327,7 +247,7 @@ append sql_id_list "'" set sql [db_map get_paths] - uplevel "template::query get_paths $name multirow \{$sql\} -eval \{$eval_code\}" + uplevel "db_multirow $name get_paths \{$sql\} \{$eval_code\}" } @@ -352,25 +272,8 @@ set module_name [namespace tail [namespace current]] - template::query users_get_result result multilist "select - :module_name as mount_point, - g.group_name as name, - g.group_id, '' as children, - NVL( - (select 't' from dual - where exists ( - select 1 from group_component_map m2 - where m2.group_id = g.group_id)), - 'f' - ) as expandable, - 'f' as symlink, - 0 as update_time - from - groups g $map_table - where - $where_clause - order by - name" + set result [db_list_of_lists users_get_result ""] + return $result } @@ -385,7 +288,7 @@ set sql [db_map users_get_paths] - uplevel "template::query users_get_paths $name multirow \{$sql\} -eval \{$eval_code\}" + uplevel "db_multirow $name users_get_paths \{$sql\} \{$eval_code\}" } @@ -406,13 +309,8 @@ set module_name [namespace tail [namespace current]] - template::query clip_get_result result multilist "select - :module_name as mount_point, - name, key, '' as children, - 'f' as expandable, - 'f' as symlink, - 0 as update_type - from cm_modules order by sort_key" + set result [db_multilist clip_get_result ""] + return $result } Index: openacs-4/packages/cms/tcl/pagination-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/Attic/pagination-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/cms/tcl/pagination-procs.tcl 20 Aug 2001 04:35:42 -0000 1.6 +++ openacs-4/packages/cms/tcl/pagination-procs.tcl 15 Aug 2002 03:39:34 -0000 1.7 @@ -56,12 +56,7 @@ } { - template::query gtp_get_total_pages total_pages onevalue " - select - ceil(count(*) / [pagination::get_rows_per_page] ) - from - ($sql) x - " + set total_pages [db_string gtp_get_total_pages ""] return $total_pages } Index: openacs-4/packages/cms/tcl/perm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/perm-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/cms/tcl/perm-procs.tcl 4 Sep 2001 04:50:05 -0000 1.5 +++ openacs-4/packages/cms/tcl/perm-procs.tcl 15 Aug 2002 03:39:34 -0000 1.6 @@ -73,15 +73,7 @@ set switches "" } - template::query ca_get_perm_list perm_list multilist " - select - p.privilege, - cms_permission.permission_p ( - :object_id, :user_id, p.privilege - ) as is_granted - from - acs_privileges p - " -cache "content::check_access $object_id $user_id" -persistent -timeout 300 $switches + set perm_list [db_list_of_lists ca_get_perm_list ""] template::util::list_of_lists_to_array $perm_list user_permissions @@ -92,24 +84,15 @@ } # See if the user is even logged in - template::query ca_get_user_name user_name onevalue " - select screen_name from users where user_id = :user_id - " + set user_name [db_string ca_get_user_name ""] if { [template::util::is_nil user_name] } { set msg "You are not logged in. Press Ok to go to the login screen." set return_url "[ad_conn package_url]signin" } else { # Get the error message - template::query ca_get_msg_info msg_info onerow " - select - acs_object.name(:object_id) as obj_name, - pretty_name as perm_name - from - acs_privileges - where - privilege = :privilege" + db_0or1row ca_get_msg_info "" -column_array msg_info if { ![info exists msg_info] } { set msg "Access Denied: no such privilege $privilege" @@ -164,11 +147,11 @@ set permission_options [list] set permission_values [list] - template::query pfg_execute_gpb permission_boxes multirow $__sql -eval { - if { [string equal $row(parent_permission_p) f] } { - lappend permission_options [list $row(label) $row(privilege)] - if { [string equal $row(permission_p) t] && $is_request } { - lappend permission_values $row(privilege) + db_multirow permission_boxes pfg_execute_gpb $__sql { + if { [string equal $parent_permission_p f] } { + lappend permission_options [list $label $privilege] + if { [string equal $permission_p t] && $is_request } { + lappend permission_values $privilege } } } @@ -230,10 +213,9 @@ foreach pair $permission_options { set privilege [lindex $pair 1] if { [lsearch $permission_values $privilege] >= 0 } { - template::query pfp_grant_permission grant_permission dml $__sql_grant - + db_dml pfp_grant_permission $__sql_grant } else { - template::query pfp_revoke_permission revoke_permission dml $__sql_revoke + db_dml pfp_revoke_permission $__sql_revoke } } Index: openacs-4/packages/cms/tcl/publish-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/publish-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/cms/tcl/publish-procs.tcl 19 Nov 2001 01:16:18 -0000 1.8 +++ openacs-4/packages/cms/tcl/publish-procs.tcl 15 Aug 2002 03:39:34 -0000 1.9 @@ -364,20 +364,7 @@ if { [catch { # Get all ready but nonlive items, make them live - template::query tps_get_items_multilist items multilist " - select - distinct i.item_id, i.live_revision - from - cr_items i, cr_release_periods p - where - i.publish_status = 'ready' - and - i.live_revision is not null - and - i.item_id = p.item_id - and - (sysdate between p.start_when and p.end_when) - " + set items [db_list_of_lists tps_get_items_multilist ""] # Have to do it this way, or else "no active select", since # the other queries will clobber the current query @@ -389,23 +376,7 @@ # Get all live but expired items, make them nonlive - template::query tps_get_items_onelist items onelist " - select - distinct i.item_id - from - cr_items i, cr_release_periods p - where - i.publish_status = 'live' - and - i.live_revision is not null - and - i.item_id = p.item_id - and - not exists (select 1 from cr_release_periods p2 - where p2.item_id = i.item_id - and (sysdate between p2.start_when and p2.end_when) - ) - " + set items [db_list tps_get_items_onelist ""] foreach item_id $items { publish::set_publish_status $db $item_id expired Index: openacs-4/packages/cms/tcl/rel-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/rel-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/cms/tcl/rel-procs.tcl 20 Aug 2001 04:35:42 -0000 1.3 +++ openacs-4/packages/cms/tcl/rel-procs.tcl 15 Aug 2002 03:39:34 -0000 1.4 @@ -24,16 +24,7 @@ db_transaction { # grab all related items ordered by order_n, rel_id - template::query srio_get_related_items related_items onelist " - select - rel_id - from - cr_item_rels - where - item_id = :item_id - order by - order_n, rel_id - " + set related_items [db_list srio_get_related_items ""] # assign each related items a new order_n set i 0 @@ -68,16 +59,7 @@ db_transaction { # grab all related items ordered by order_n, rel_id - template::query scio_get_child_order child_items onelist " - select - rel_id - from - cr_child_rels - where - parent_id = :item_id - order by - order_n, rel_id - " + set child_items [db_list scio_get_child_order ""] # assign each related items a new order_n set i 0 Index: openacs-4/packages/cms/tcl/user-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/Attic/user-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/cms/tcl/user-procs.tcl 11 Aug 2001 17:40:26 -0000 1.3 +++ openacs-4/packages/cms/tcl/user-procs.tcl 15 Aug 2002 03:39:34 -0000 1.4 @@ -53,14 +53,13 @@ # on the CMS pages root folder ad_proc cms_admin_exists {} { - template::query cae_admin_exists admin_exists onevalue " - select content_permission.cm_admin_exists from dual" + set_admin_exists [db_string cae_admin_exists ""] - if { [string equal $admin_exists t] } { - return 1 - } else { - return 0 - } + if { [string equal $admin_exists t] } { + return 1 + } else { + return 0 + } } } Index: openacs-4/packages/cms/tcl/workflow-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/Attic/workflow-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/cms/tcl/workflow-procs.tcl 24 Dec 2001 02:50:17 -0000 1.9 +++ openacs-4/packages/cms/tcl/workflow-procs.tcl 15 Aug 2002 03:39:34 -0000 1.10 @@ -18,35 +18,7 @@ } { - template::query noa_get_assignments assignments multilist " - select - transition_name, party_id, - content_item.get_title(i.item_id) title, - to_char(cd.deadline,'Month DD, YYYY') deadline_pretty, - nvl(party.name(party_id),person.name(party_id)) name - from - wf_transitions t, cr_items i, - wf_cases c, wf_case_assignments ca, wf_case_deadlines cd - where - c.workflow_key = 'publishing_wf' - and - c.workflow_key = t.workflow_key - and - ca.role_key = t.role_key - and - t.transition_key = cd.transition_key - and - c.case_id = ca.case_id - and - c.case_id = cd.case_id - and - c.case_id = :case_id - and - c.state = 'active' - and - c.object_id = i.item_id - " - + set assignments [db_list_of_lists noa_get_assignments ""] foreach assignment $assignments { set transition_name [lindex $assignment 0] @@ -96,39 +68,7 @@ } { - template::query naont_get_assignments assignments multilist " - select - o.creation_user as admin_id, transition_name, party_id, - content_item.get_title(i.item_id) title, - to_char(deadline,'Month DD, YYYY') deadline_pretty, - nvl(party.name(party_id),person.name(party_id)) name, - nvl(party.name(admin_id),person.name(admin_id)) admin_name - from - wf_cases c, wf_case_assignments ca, wf_case_deadlines cd, - wf_transitions t, cr_items i, acs_objects o - where - c.workflow_key = 'publishing_wf' - and - c.workflow_key = t.workflow_key - and - c.case_id = ca.case_id - and - c.case_id = cd.case_id - and - c.case_id = :case_id - and - ca.role_key = t.role_key - and - t.transition_key = cd.transition_key - and - t.transition_key = :transition_key - and - c.state = 'active' - and - c.object_id = i.item_id - and - c.case_id = o.object_id - " + set assignments [db_list_of_lists naont_get_assignments ""] foreach assignment $assignments { set admin_id [lindex $assignment 0] @@ -178,38 +118,11 @@ # the user who finished the task set user_id [User::getID] - template::query naoft_get_name name onevalue " - select person.name( :user_id ) from dual - " + set name [db_string naoft_get_name ""] # get the task name, the creation_user, title, and date of the item - template::query naoft_get_task_info task_info onerow " - select - transition_name, - content_item.get_title(i.item_id) as title, - o.creation_user as admin_id, - person.name( o.creation_user ) as admin_name, - to_char(sysdate,'Mon DD, YYYY') as today - from - wf_tasks t, wf_transitions tr, wf_cases c, - cr_items i, acs_objects o - where - tr.transition_key = t.transition_key - and - tr.workflow_key = t.workflow_key - and - t.case_id = c.case_id - and - c.object_id = i.item_id - and - i.item_id = o.object_id - and - t.task_id = :task_id - " + db_1row naoft_get_task_info "" - template::util::array_to_vars task_info - - set subject \ "Task Finished: $transition_name of $title" @@ -250,12 +163,7 @@ } { set user_id [User::getID] - template::query cwp_touch_info can_touch onevalue " - select - content_workflow.can_touch( :item_id, :user_id ) - from - dual - " + set can_touch [db_string cwp_touch_info ""] if { [string equal $can_touch t] } { return t