Index: openacs-4/packages/cms/www/register.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/Attic/register.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/register.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/register.tcl 25 May 2001 02:15:56 -0000 1.3 @@ -45,28 +45,29 @@ password screen_name set db [template::begin_db_transaction] - - set user_id [ad_user_new $email $first_name $last_name $password \ - "" "" "" "" "" $user_id] + db_transaction { + + set user_id [ad_user_new $email $first_name $last_name $password \ + "" "" "" "" "" $user_id] - ns_ora dml $db " + db_dml update_users " update users set screen_name = :screen_name where user_id = :user_id" - # if there are no users with the 'cm_admin' privilege - # (the CMS has never been used), then this user will be the admin - set cms_admin_exists [User::cms_admin_exists $db] - if { $cms_admin_exists == 0 } { - set is_admin t - } else { - set is_admin f - } + # if there are no users with the 'cm_admin' privilege + # (the CMS has never been used), then this user will be the admin + set cms_admin_exists [User::cms_admin_exists $db] + if { $cms_admin_exists == 0 } { + set is_admin t + } else { + set is_admin f + } - # make admin - grant 'cm_admin' privileges for all content items - # and for content modules - if { [string equal $is_admin t] } { - ns_ora dml $db " + # make admin - grant 'cm_admin' privileges for all content items + # and for content modules + if { [string equal $is_admin t] } { + db_dml grant_permissions " declare cursor c_item_cur is select item_id from cr_items @@ -96,11 +97,10 @@ end; " + } + + User::login $db $user_id } - User::login $db $user_id - - template::end_db_transaction - template::forward index } Index: openacs-4/packages/cms/www/item/create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/item/create.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/item/create.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/item/create.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -34,27 +34,24 @@ if { [form is_valid create_item] } { - set db [ns_db gethandle] # set the date value from the form form get_values create_item name context_id item_id title description \ publish_date mime_type text revision_id set publish_date [util::date::get_property sql_date $publish_date] - ns_ora exec_plsql_bind $db "begin - :retval := content_item.new(:name, :context_id, :item_id, sysdate, NULL, + set retval [db_exec_plsql new_content_item "begin + :1 := content_item.new(:name, :context_id, :item_id, sysdate, NULL, '[ns_conn peeraddr]', 'content_item'); - end;" retval + end;"] - ns_ora exec_plsql_bind $db "begin - :retval := content_revision.new(:title, :description, $publish_date, + set retval [db_exec_plsql new_revision "begin + :1 := content_revision.new(:title, :description, $publish_date, :mime_type, NULL, :text, 'content_revision', :item_id, :revision_id); - end;" retval + end;"] - ns_db releasehandle $db - template::forward item?item_id=$item_id } Index: openacs-4/packages/cms/www/modules/items/revision-upload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/revision-upload.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/revision-upload.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/revision-upload.tcl 25 May 2001 02:15:56 -0000 1.3 @@ -87,41 +87,40 @@ form get_values upload revision_id create_p - set db [template::begin_db_transaction] + db_transaction { - # create the new item first, if necessary - # otherwise read item_id from the form - if { [string equal $create_p "t"] } { - - form get_values upload name parent_id content_type + # create the new item first, if necessary + # otherwise read item_id from the form + if { [string equal $create_p "t"] } { + + form get_values upload name parent_id content_type - ns_log Notice "revision-upload.tcl - Creating content item... $name" - ns_ora exec_plsql_bind $db "begin + ns_log Notice "revision-upload.tcl - Creating content item... $name" + set item_id [db_exec_plsql new_content "begin :item_id := content_item.new( name => :name, parent_id => :parent_id, content_type => :content_type, creation_user => [User::getID], creation_ip => '[ns_conn peeraddr]' ); - end;" item_id - } else { - form get_values upload item_id - } + end;"] + } else { + form get_values upload item_id + } - ns_log Notice "XML [ns_queryget xml_file.tmpfile]" - set tmp_filename [ns_queryget xml_file.tmpfile] - set doc [template::util::read_file $tmp_filename] + ns_log Notice "XML [ns_queryget xml_file.tmpfile]" + set tmp_filename [ns_queryget xml_file.tmpfile] + set doc [template::util::read_file $tmp_filename] - ns_ora clob_dml $db "insert into cr_xml_docs + db_clob_dml insert_content "insert into cr_xml_docs values ($revision_id, empty_clob()) returning doc into :1" $doc - ns_ora exec_plsql_bind $db "begin + set revision_id [db_exec_plsql import_xml "begin :revision_id := content_revision.import_xml( :item_id, :revision_id, :revision_id); - end;" revision_id + end;"] - template::end_db_transaction - template::release_db_handle + } template::forward index?item_id=$item_id } Index: openacs-4/packages/cms/www/modules/items/revision.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/revision.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/items/revision.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/revision.tcl 25 May 2001 02:15:56 -0000 1.3 @@ -231,8 +231,6 @@ set revision_attr_html "" } -template::release_db_handle - set page_title \ "$title : Revision $revision_number of $revision_count for $name" Index: openacs-4/packages/cms/www/modules/items/custom/cr_demo_article_image/create-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/custom/cr_demo_article_image/create-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/items/custom/cr_demo_article_image/create-2.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/custom/cr_demo_article_image/create-2.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -119,57 +119,52 @@ set user_id [User::getID] set ip_address [ns_conn peeraddr] + db_transaction { + + # create a new cr_demo_article_image item - - set db [ns_db gethandle] - ns_ora dml $db "begin transaction" - - # create a new cr_demo_article_image item - set sql " + if { [catch {db_exec_plsql new_content" begin - :item_id := content_item.new( + :1 := content_item.new( name => :name, item_id => :item_id, parent_id => :parent_id, content_type => :content_type, creation_user => :user_id, creation_ip => :ip_address ); - end;" - - if { [catch {ns_ora exec_plsql_bind $db $sql item_id} errmsg] } { - ns_log notice "custom/cr_demo_article_image/create-1.tcl caught error + end;" } item_id] } { + ns_log notice "custom/cr_demo_article_image/create-1.tcl caught error - $errmsg" - # check for double click - query clicks onevalue " + # check for double click + template::query get_clicks clicks onevalue " select count(1) from cr_items where item_id = :item_id - " -db $db + " - ns_ora dml $db "abort transaction" - ns_db releasehandle $db + db_dml abort "abort transaction" - if { $clicks > 0 } { - # double click error - do nothing, forward to view the item - template::forward \ + if { $clicks > 0 } { + # double click error - do nothing, forward to view the item + template::forward \ "../../index?item_id=$item_id" - } else { - template::request::error new_item_error \ + } else { + template::request::error new_item_error \ "custom/cr_demo_article_image/create-1.tcl - while creating new $content_type item - $errmsg" - return - } - } + return + } + } - # create the revision - ns_ora exec_plsql_bind $db " + # create the revision + set revision_id [db_exec_plsql new_revision " begin - :revision_id := content_revision.new ( + :1 := content_revision.new ( item_id => :item_id, title => :title, description => :description, @@ -178,37 +173,36 @@ creation_ip => :ip_address ); end; - " revision_id + "] - # insert the extended attributes - ns_ora dml $db " + # insert the extended attributes + db_dml insert_image " insert into images ( image_id, width, height ) values ( :revision_id, :width, :height )" - ns_ora dml $db " + db_dml insert_art_image " insert into cr_demo_article_images ( article_image_id, caption ) values ( :revision_id, :caption )" - if { [string equal $content_method "file_upload"] } { - # upload the image - ns_ora blob_dml_file $db " + if { [string equal $content_method "file_upload"] } { + # upload the image + db_dml update_content " update cr_revisions set content = empty_blob() where revision_id = $revision_id - returning content into :1" $tmp_filename + returning content into :1" -blob_files $tmp_filename + } } - ns_ora dml $db "end transaction" - ns_db releasehandle $db # flush the paginator cache cms_folder::flush sitemap $parent_id template::forward "../../index?item_id=$item_id" -} \ No newline at end of file +} Index: openacs-4/packages/cms/www/modules/items/custom/image/attributes-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/custom/image/attributes-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/items/custom/image/attributes-edit.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/custom/image/attributes-edit.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -4,8 +4,6 @@ request create request set_param item_id -datatype integer -set db [ns_db gethandle] - # permissions check - need cm_write on item_id to add a revision content::check_access $item_id cm_write -user_id [User::getID] -db $db @@ -14,7 +12,7 @@ revision_id -datatype integer -widget hidden } -query item_info onerow " +template::query get_item_info item_info onerow " select i.name, i.latest_revision, r.title from @@ -29,9 +27,7 @@ template::util::array_to_vars item_info -ns_db releasehandle $db - content::add_attribute_elements image image $latest_revision element set_properties image mime_type -widget hidden @@ -54,75 +50,68 @@ set user_id [User::getID] set ip_address [ns_conn peeraddr] - set db [ns_db gethandle] - ns_ora dml $db "begin transaction" - - query latest_revision onevalue " + db_transaction { + template::query get_latest latest_revision onevalue " select latest_revision from cr_items where item_id = :item_id - " -db $db + " - set sql " + # create the revision + if { [catch {db_exec_plsql " begin - :revision_id := content_revision.copy( + :1 := content_revision.copy( target_item_id => :item_id, copy_id => :revision_id, revision_id => :latest_revision, creation_user => :user_id, creation_ip => :ip_address ); - end;" + end;" } revision_id] } { - # create the revision - if { [catch {ns_ora exec_plsql_bind $db $sql revision_id} errmsg] } { - - # check for dupe submit - query clicks onevalue " + # check for dupe submit + template::query get_clicks clicks onevalue " select count(1) from cr_revisions where revision_id = :revision_id - " -db $db + " - ns_ora dml $db "abort transaction" - ns_db releasehandle $db + db_dml abort "abort transaction" - if { $clicks > 0 } { - # double click error - forward to view the item - template::forward \ + if { $clicks > 0 } { + # double click error - forward to view the item + template::forward \ "../../index?item_id=$item_id" - return - } else { - template::request::error new_revision_error \ + return + } else { + template::request::error new_revision_error \ "custom/image/attributes-edit.tcl - while creation new revision for item $item_id - $errmsg" - return - } - } + return + } + } - # update the new title and description - ns_ora dml $db " + # update the new title and description + db_dml update_revisions " update cr_revisions set title = :title, description = :description where revision_id = :revision_id" - # update image dimensions - ns_ora dml $db " + # update image dimensions + db_dml update_images " update images set width = :width, height = :height where image_id = :revision_id" + } - ns_ora dml $db "end transaction" - ns_db releasehandle $db - template::forward "../../index?item_id=$item_id" } Index: openacs-4/packages/cms/www/modules/items/custom/image/content-add-1.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/custom/image/content-add-1.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/items/custom/image/content-add-1.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/custom/image/content-add-1.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -61,26 +61,24 @@ set height [lindex $image_size 1] - set db [ns_db gethandle] - ns_ora dml $db "begin transaction" - - # insert the extended attributes - ns_ora dml $db " + db_transaction { + + # insert the extended attributes + db_dml update_images " update images set width = :width, height = :height where image_id = :revision_id" - # upload the image - ns_ora blob_dml_file $db " + # upload the image + db_dml update_revisions " update cr_revisions set content = empty_blob() where revision_id = $revision_id - returning content into :1" $tmp_filename + returning content into :1" -blob_files $tmp_filename - ns_ora dml $db "end transaction" - ns_db releasehandle $db + } template::forward "../../index?item_id=$item_id" -} \ No newline at end of file +} Index: openacs-4/packages/cms/www/modules/items/custom/image/create-1.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/custom/image/create-1.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/items/custom/image/create-1.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/custom/image/create-1.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -102,11 +102,11 @@ - set db [ns_db gethandle] - ns_ora dml $db "begin transaction" - - # create a new image item - set sql " + db_transaction { + + # create a new image item + + if { [catch {db_exec_plsql " begin :item_id := content_item.new( name => :name, @@ -117,70 +117,65 @@ creation_ip => :ip_address, relation_tag => :relation_tag ); - end;" + end;"} item_id] } { + ns_log notice "custom/image/create-1.tcl caught error - $errmsg" - if { [catch {ns_ora exec_plsql_bind $db $sql item_id} errmsg] } { - ns_log notice "custom/image/create-1.tcl caught error - $errmsg" - - # check for double click - query clicks onevalue " + # check for double click + template::query get_clicks clicks onevalue " select count(1) from cr_items where item_id = :item_id - " -db $db + " - ns_ora dml $db "abort transaction" - ns_db releasehandle $db + db_dml abort "abort transaction" - if { $clicks > 0 } { - # double click error - do nothing, forward to view the item - template::forward \ + if { $clicks > 0 } { + # double click error - do nothing, forward to view the item + template::forward \ "../../index?item_id=$item_id" - } else { - template::request::error new_item_error \ + } else { + template::request::error new_item_error \ "custom/image/create-1.tcl - while creating new $content_type item - $errmsg" - return - } - } + return + } + } - # create the revision - ns_ora exec_plsql_bind $db " + # create the revision + set revision_id [db_exec_plsql new_revision " begin - :revision_id := content_revision.new ( + :1 := content_revision.new ( item_id => :item_id, title => :title, description => :description, mime_type => :mime_type, creation_user => :user_id, creation_ip => :ip_address ); - end; - " revision_id + end;"] - # insert the extended attributes - ns_ora dml $db " + # insert the extended attributes + db_dml insert_images " insert into images ( image_id, width, height ) values ( :revision_id, :width, :height )" - # upload the image - ns_ora blob_dml_file $db " + # upload the image + db_dml insert_revisions " update cr_revisions set content = empty_blob() where revision_id = $revision_id - returning content into :1" $tmp_filename + returning content into :1" -blob_files $tmp_filename - ns_ora dml $db "end transaction" - ns_db releasehandle $db + } # flush the paginator cache cms_folder::flush sitemap $parent_id template::forward "../../index?item_id=$item_id" -} \ No newline at end of file +} Index: openacs-4/packages/cms/www/modules/items/custom/image/revision-add-1.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/custom/image/revision-add-1.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/items/custom/image/revision-add-1.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/custom/image/revision-add-1.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -46,12 +46,12 @@ -widget file \ -label "Upload Image" - -if { [form is_request image] } { +# a noop ? +# if { [form is_request image] } { - set db [template::get_db_handle] - ns_db releasehandle $db -} +# set db [template::get_db_handle] +# ns_db releasehandle $db +# } @@ -102,13 +102,12 @@ set user_id [User::getID] set ip_address [ns_conn peeraddr] - set db [ns_db gethandle] - ns_ora dml $db "begin transaction" + db_transaction { - # create the revision - ns_ora exec_plsql_bind $db " + # create the revision + set revision_id [db_exec_plsql new_revision " begin - :revision_id := content_revision.new ( + :1 := content_revision.new ( item_id => :item_id, title => :title, description => :description, @@ -117,29 +116,27 @@ creation_ip => :ip_address ); end; - " revision_id + "] - # insert the extended attributes - ns_ora dml $db " + # insert the extended attributes + db_dml insert_images " insert into images ( image_id, width, height ) values ( :revision_id, :width, :height )" - # upload the image - ns_ora blob_dml_file $db " + # upload the image + db_dml update_revisions " update cr_revisions set content = empty_blob() where revision_id = $revision_id - returning content into :1" $tmp_filename + returning content into :1" -blob_files $tmp_filename + } - ns_ora dml $db "end transaction" - ns_db releasehandle $db - template::forward "../../index?item_id=$item_id" } Index: openacs-4/packages/cms/www/modules/search/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/search/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/search/index.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/search/index.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -3,13 +3,12 @@ request set_param mount_point -datatype keyword -optional -value search request set_param parent_id -datatype keyword -optional -set db [template::get_db_handle] # Get the tabulated list of content types set content_types [cm::modules::types::getTypesTree] # Get a list of mime-types -query mime_types multilist " +template::query get_mime_types mime_types multilist " select label, mime_type as value from @@ -146,7 +145,7 @@ ns_log notice $sql_query # Perform the query and get the total results - template::query total_results onevalue " + template::query get_results total_results onevalue " select count(*) from ($sql_query) " Index: openacs-4/packages/cms/www/modules/sitemap/attributes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/attributes.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/sitemap/attributes.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/sitemap/attributes.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -9,7 +9,6 @@ set folder_id [cm::modules::${mount_point}::getRootFolderID] } -set db [template::get_db_handle] # permissions check - user must have cm_examine on this folder content::check_access $folder_id cm_examine -user_id [User::getID] -db $db @@ -20,7 +19,7 @@ cms_folder::get_registered_types $folder_id multirow content_types # Get other misc values -query folder_name onevalue " +template::query get_folder_name folder_name onevalue " select label from cr_folders where folder_id = :folder_id " @@ -39,15 +38,14 @@ # Determine registered types -query folder_options onerow " +template::query get_options folder_options onerow " select content_folder.is_registered(:folder_id,'content_folder') allow_subfolders, content_folder.is_registered(:folder_id,'content_symlink') allow_symlinks, content_folder.is_registered(:folder_id,'content_template') allow_templates from dual " -template::release_db_handle # Create the form for registering special types to the folder @@ -95,33 +93,32 @@ form get_values register_types \ allow_subfolders allow_symlinks folder_resolved_id mount_point - set db [template::begin_db_transaction] + db_transaction { - # permissions check - must have cm_write on folder to modify its options - content::check_access $folder_resolved_id cm_write \ + # permissions check - must have cm_write on folder to modify its options + content::check_access $folder_resolved_id cm_write \ -user_id [User::getID] -db $db - if { [string equal $allow_subfolders "t"] } { - set subfolder_sql "content_folder.register_content_type(:folder_resolved_id,'content_folder');" - } else { - set subfolder_sql "content_folder.unregister_content_type(:folder_resolved_id,'content_folder');" - } + if { [string equal $allow_subfolders "t"] } { + set subfolder_sql "content_folder.register_content_type(:folder_resolved_id,'content_folder');" + } else { + set subfolder_sql "content_folder.unregister_content_type(:folder_resolved_id,'content_folder');" + } - if { [string equal $allow_symlinks "t"] } { - set symlink_sql "content_folder.register_content_type(:folder_resolved_id,'content_symlink');" - } else { - set symlink_sql "content_folder.unregister_content_type(:folder_resolved_id,'content_symlink');" - } + if { [string equal $allow_symlinks "t"] } { + set symlink_sql "content_folder.register_content_type(:folder_resolved_id,'content_symlink');" + } else { + set symlink_sql "content_folder.unregister_content_type(:folder_resolved_id,'content_symlink');" + } - set sql "begin + set sql + + db_exec_plsql content "begin $subfolder_sql $symlink_sql end;" + } - ns_ora dml $db $sql - template::end_db_transaction - template::release_db_handle - forward "attributes?folder_id=$folder_id&mount_point=$mount_point" } Index: openacs-4/packages/cms/www/modules/sitemap/copy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/copy.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/sitemap/copy.tcl 24 May 2001 01:30:52 -0000 1.2 +++ openacs-4/packages/cms/www/modules/sitemap/copy.tcl 25 May 2001 02:15:56 -0000 1.3 @@ -92,15 +92,15 @@ form get_values copy id mount_point set copied_items [element get_values copy copied_items] - set db [template::begin_db_transaction] + db_transaction { - set folder_flush_list [list] - foreach cp_item_id $copied_items { - set parent_id [element get_values copy "parent_id_$cp_item_id"] + set folder_flush_list [list] + foreach cp_item_id $copied_items { + set parent_id [element get_values copy "parent_id_$cp_item_id"] - set sql + set sql - if { [catch {db_exec_plsql copy_item " + if { [catch {db_exec_plsql copy_item " begin content_item.copy( item_id => :cp_item_id, @@ -109,21 +109,19 @@ creation_ip => :ip ); end;"} errmsg] } { - # possibly a duplicate name - ns_log notice "ERROR: copy.tcl - while copying $errmsg" - } + # possibly a duplicate name + ns_log notice "ERROR: copy.tcl - while copying $errmsg" + } - # flush the cache - if { [lsearch -exact $folder_flush_list $parent_id] == -1 } { - lappend folder_flush_list $parent_id - cms_folder::flush $mount_point $parent_id - } + # flush the cache + if { [lsearch -exact $folder_flush_list $parent_id] == -1 } { + lappend folder_flush_list $parent_id + cms_folder::flush $mount_point $parent_id + } + } } - template::end_db_transaction - template::release_db_handle - # flush cache for destination folder if { $folder_id == [cm::modules::${mount_point}::getRootFolderID] } { set folder_id "" Index: openacs-4/packages/cms/www/modules/sitemap/create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/create.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/sitemap/create.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/sitemap/create.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -11,17 +11,15 @@ set create_parent_id $parent_id } -set db [template::get_db_handle] # permissions check - user must have cm_new on parent content::check_access $create_parent_id cm_new -user_id [User::getID] # Get the path -query path onevalue " +template::query get_path path onevalue " select content_item.get_path(:create_parent_id) from dual " -template::release_db_handle # Create the form @@ -66,33 +64,33 @@ set ip [ns_conn peeraddr] set db [template::begin_db_transaction] + db_transaction { - ns_ora exec_plsql_bind $db " + set folder_id [db_exec_plsql new_folder " begin - :folder_id := content_folder.new( + :1 := content_folder.new( name => :name, label => :label, description => :description, parent_id => :create_parent_id, creation_user => :user_id, creation_ip => :ip ); - end;" folder_id + end;"] - if { [string equal $mount_point "templates"] } { + if { [string equal $mount_point "templates"] } { - template::query register_content_type dml " + db_exec_plsql register_content_type " begin content_folder.register_content_type( folder_id => :folder_id, content_type => 'content_template', include_subtypes => 'f' ); end;" + } + } - template::end_db_transaction - template::release_db_handle - # Flush the paginator cache cms_folder::flush $mount_point $parent_id Index: openacs-4/packages/cms/www/modules/sitemap/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/delete.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/sitemap/delete.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/sitemap/delete.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -7,18 +7,15 @@ request set_param mount_point -datatype keyword -optional -value sitemap -set db [template::get_db_handle] # permission check - user must have cm_write on this folder to delete it -content::check_access $id cm_write -user_id [User::getID] -db $db +content::check_access $id cm_write -user_id [User::getID] # Determine if the folder is empty -template::query is_empty onevalue " +template::query check_empty is_empty onevalue " select content_folder.is_empty(:id) from dual " -template::release_db_handle - # If nonempty, show error if { [string equal $is_empty "f"] } { @@ -30,10 +27,9 @@ } else { # Otherwise, delete the folder - set db [template::begin_db_transaction] - template::query delete_folder dml "begin content_folder.delete(:id); end;" - template::end_db_transaction - template::release_db_handle + db_transaction { + db_exec_plsql delete_folder "begin content_folder.delete(:id); end;" + } # Remove it from the clipboard, if it exists set clip [clipboard::parse_cookie] Index: openacs-4/packages/cms/www/modules/sitemap/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/sitemap/index.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/sitemap/index.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -19,15 +19,14 @@ set user_id [User::getID] set root_id [cm::modules::${mount_point}::getRootFolderID] -set db [template::get_db_handle] # Get the folder label/description # If :id does not exist, then use :root_id if { [template::util::is_nil id] } { set parent_var :root_id - template::query module_name onevalue " + template::query get_module_name module_name onevalue " select name from cm_modules where key = :mount_point " @@ -38,7 +37,7 @@ # get all the content types registered to this folder # check whether this folder allows subfolders, symlinks, and templates - template::query registered_types onelist " + template::query get_reg_types registered_types onelist " select content_type from @@ -67,7 +66,7 @@ set parent_var :id # Resolve the symlink, if any - template::query resolved_id onevalue " + template::query get_resolved_id resolved_id onevalue " select content_symlink.resolve( :id ) from dual " @@ -80,7 +79,7 @@ set what "Folder" } - template::query info onerow " + template::query get_info info onerow " select parent_id, NVL(label, name) label, description from @@ -100,7 +99,7 @@ # get all the content types registered to this folder # check whether this folder allows subfolders, symlinks, and templates - template::query registered_types onelist " + template::query get_types registered_types onelist " select content_type from @@ -156,7 +155,7 @@ # Get the index page ID -template::query index_page_id onevalue " +template::query get_index_page_id index_page_id onevalue " select content_folder.get_index_page($parent_var) from dual " @@ -254,7 +253,6 @@ is_index_page desc $orderby_clause" -template::release_db_handle # paginator set p_name "folder_contents_${mount_point}_$id" @@ -269,8 +267,6 @@ paginator get_context $p_name groups [paginator get_groups $p_name $group 10] -set db [template::get_db_handle] - # determine whether item is marked (on clipboard), its link and icon for { set i 1 } { $i <= [multirow size items] } { incr i } { multirow get items $i @@ -313,7 +309,7 @@ # symlinks to this folder/item -template::query symlinks multirow " +template::query get_symlinks symlinks multirow " select i.item_id id, content_item.get_path(i.item_id) path @@ -325,9 +321,7 @@ i.item_id = :original_id " -template::release_db_handle - form create add_item if { [template::util::is_nil id] } { Index: openacs-4/packages/cms/www/modules/sitemap/type-register.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/type-register.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/sitemap/type-register.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/sitemap/type-register.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -7,21 +7,18 @@ set clip [clipboard::parse_cookie] set marked_types [clipboard::get_items $clip "types"] -set sql "begin +db_transaction { + foreach type $marked_types { + + db_exec_plsql register_type "begin content_folder.register_content_type( folder_id => :folder_id, content_type => :type, include_subtypes => 'f' ); end;" - -set db [template::begin_db_transaction] -foreach type $marked_types { - - ns_ora dml $db $sql + } } -template::end_db_transaction -template::release_db_handle cms_folder::flush_registered_types $folder_id Index: openacs-4/packages/cms/www/modules/sitemap/type-unregister.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/type-unregister.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/sitemap/type-unregister.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/sitemap/type-unregister.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -5,19 +5,19 @@ request set_param type_key -datatype keyword -set sql "begin + +set db [template::begin_db_transaction] +db_transaction { + db_exec_plsql unregister " + begin content_folder.unregister_content_type( folder_id => :folder_id, content_type => :type_key, include_subtypes => 'f' ); end;" +} -set db [template::begin_db_transaction] -ns_ora dml $db $sql -template::end_db_transaction -template::release_db_handle - cms_folder::flush_registered_types $folder_id forward "attributes?folder_id=$folder_id" Index: openacs-4/packages/cms/www/modules/templates/copy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/copy.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/templates/copy.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/templates/copy.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -10,23 +10,22 @@ if { $submit == "Copy" } { - set db [begin_db_transaction] - set creation_user [User::getID] - set creation_ip [ns_conn peeraddr] + db_transaction { + set creation_user [User::getID] + set creation_ip [ns_conn peeraddr] - foreach template_id [ns_querygetall template_id] { - ns_ora dml $db "declare copy_id integer; begin + foreach template_id [ns_querygetall template_id] { + db_exec_plsql copy_item "declare copy_id integer; begin copy_id := content_item.copy2( :template_id, :folder_id, :creation_user, :creation_ip ); insert into cr_templates (template_id) values (copy_id); end;" - } - - end_db_transaction + } + } } template::forward [ns_queryget return_url] } -query path onevalue "select content_item.get_path(:folder_id) from dual" \ No newline at end of file +template::query get_path path onevalue "select content_item.get_path(:folder_id) from dual" Index: openacs-4/packages/cms/www/modules/templates/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/delete.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/templates/delete.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/templates/delete.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -12,13 +12,12 @@ if { $submit == "Delete" } { - set db [begin_db_transaction] + db_transaction { - foreach template_id [ns_querygetall template_id] { - ns_ora dml $db "begin content_template.delete(:template_id); end;" - } - - end_db_transaction + foreach template_id [ns_querygetall template_id] { + db_exec_plsql delete "begin content_template.delete(:template_id); end;" + } + } } template::forward [ns_queryget return_url] Index: openacs-4/packages/cms/www/modules/templates/move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/move.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/templates/move.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/templates/move.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -10,23 +10,22 @@ if { $submit == "Move" } { - set db [begin_db_transaction] - set creation_user [User::getID] - set creation_ip [ns_conn peeraddr] + db_transaction { + set creation_user [User::getID] + set creation_ip [ns_conn peeraddr] - foreach template_id [ns_querygetall template_id] { - ns_ora dml $db "begin + foreach template_id [ns_querygetall template_id] { + db_exec_plsql move_item "begin content_item.move( :template_id, :folder_id ); end;" + } } - - end_db_transaction } template::forward [ns_queryget return_url] } -query path onevalue "select content_item.get_path(:folder_id) from dual" +template::query get_path path onevalue "select content_item.get_path(:folder_id) from dual" Index: openacs-4/packages/cms/www/modules/templates/new-folder.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/new-folder.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/templates/new-folder.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/templates/new-folder.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -39,24 +39,21 @@ set creation_ip [ns_conn peeraddr] set creation_user [User::getID] - set db [template::begin_db_transaction] + db_transaction { - set sql "begin :folder_id := content_folder.new( + set folder_id [db_exec_plsql "begin :folder_id := content_folder.new( folder_id => :folder_id, name => :name, label => :label, description => :description, parent_id => :parent_id, creation_ip => :creation_ip, creation_user => :creation_user - ); end;" + ); end;"] - ns_ora exec_plsql_bind $db $sql folder_id + content::add_basic_revision $folder_id "" "Template" \ + -text "" + } - content::add_basic_revision $folder_id "" "Template" \ - -text "" - - template::end_db_transaction - template::forward $return_url -} \ No newline at end of file +} Index: openacs-4/packages/cms/www/modules/templates/new-template.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/new-template.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/templates/new-template.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/templates/new-template.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -46,21 +46,20 @@ set creation_user [User::getID] set db [template::begin_db_transaction] + db_transaction { - set sql "begin :template_id := content_template.new( + + set template_id [db_exec_plsql new_template "begin :1 := content_template.new( template_id => :template_id, name => :name, parent_id => :folder_id, creation_ip => :creation_ip, creation_user => :creation_user - ); end;" + ); end;"] - ns_ora exec_plsql_bind $db $sql template_id + content::add_basic_revision $template_id "" "Template" \ + -text "" -mime_type $mime_type + } - content::add_basic_revision $template_id "" "Template" \ - -text "" -mime_type $mime_type - - template::end_db_transaction - template::forward $return_url -} \ No newline at end of file +} Index: openacs-4/packages/cms/www/modules/templates/publish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/publish.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/templates/publish.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/templates/publish.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -2,11 +2,10 @@ revision_id -datatype integer } -set db [get_db_handle] # query for the path and ID of the template -query info onerow " +template::query get_info info onerow " select content_item.get_path(item_id) path, item_id from @@ -26,10 +25,9 @@ set template_id $info(item_id) -ns_ora dml $db "update cr_items set live_revision = :revision_id +db_dml update_items "update cr_items set live_revision = :revision_id where item_id = :template_id" -release_db_handle set return_url [ns_set iget [ns_conn headers] Referer] template::forward $return_url Index: openacs-4/packages/cms/www/modules/templates/template-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/template-create.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/templates/template-create.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/templates/template-create.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -47,10 +47,9 @@ set parent_id [cm::modules::templates::getRootFolderID] } + db_transaction { - set db [template::begin_db_transaction] - - ns_ora exec_plsql_bind $db "begin + db_exec_plsql new_template "begin :ret_val := content_template.new( template_id => :template_id, name => :name, @@ -59,10 +58,8 @@ creation_ip => :ip_address ); end;" ret_val + } - template::end_db_transaction - template::release_db_handle - template::forward ../templates/template?template_id=$template_id } Index: openacs-4/packages/cms/www/modules/types/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/types/index.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/types/index.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -17,19 +17,17 @@ set user_id [User::getID] set root_id [cm::modules::templates::getRootFolderID] -set db [template::get_db_handle] - -query module_id onevalue " +template::query get_module_id module_id onevalue " select module_id from cm_modules where key = 'types' " -content::check_access $module_id cm_examine -user_id $user_id -db $db +content::check_access $module_id cm_examine -user_id $user_id set can_edit_widgets $user_permissions(cm_write) # get the content type pretty name -query object_type_pretty onevalue " +template::query get_object_type object_type_pretty onevalue " select pretty_name from @@ -41,13 +39,12 @@ if { [string equal $object_type_pretty ""] } { # error - invalid content_type - template::release_db_handle template::forward index } # get all the content types that this content type inherits from -query content_type_tree multirow " +template::query get_content_type content_type_tree multirow " select decode (supertype, 'acs_object', '', supertype) as parent_type, decode (object_type, 'content_revision', '', object_type) as object_type, @@ -65,7 +62,7 @@ " # get all the attribute properties for this object_type -query attribute_types multirow " +template::query get_attr_types attribute_types multirow " select attr.attribute_id, attr.attribute_name, attr.object_type, attr.pretty_name as attribute_name_pretty, @@ -97,7 +94,7 @@ " # get template information -query type_templates multirow " +template::query get_type_templates type_templates multirow " select template_id, ttmap.content_type, use_context, is_default, name, content_item.get_path( @@ -115,8 +112,6 @@ upper(name) " -template::release_db_handle - set page_title "Content Type - $object_type_pretty" # for the permissions include Index: openacs-4/packages/cms/www/modules/types/widget-register-1.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/widget-register-1.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/types/widget-register-1.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/types/widget-register-1.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -98,32 +98,31 @@ form get_values widget_register \ widget is_required attribute_name content_type - set db [ns_db gethandle] - ns_ora dml $db "begin transaction" + db_transaction { - query already_registered onevalue " + template::query check_registered already_registered onevalue " select 1 from cm_attribute_widgets where attribute_id = :attribute_id and widget = :widget - " -db $db + " - # just update the is_required column if this widget is already registered - # this way we don't overwrite the existing attribute widget params - if { ![template::util::is_nil already_registered] && \ - $already_registered } { - ns_ora dml $db " + # just update the is_required column if this widget is already registered + # this way we don't overwrite the existing attribute widget params + if { ![template::util::is_nil already_registered] && \ + $already_registered } { + db_dml update_widgets " update cm_attribute_widgets set is_required = decode(is_required,'t','f','t') where attribute_id = :attribute_id and widget = :widget" - } else { + } else { - # (re)register a widget to an attribute - ns_ora dml $db " + # (re)register a widget to an attribute + db_exec_plsql register_widget " begin cm_form_widget.register_attribute_widget( content_type => :content_type, @@ -132,9 +131,8 @@ is_required => :is_required ); end;" + } } - ns_ora dml $db "end transaction" - ns_db releasehandle $db wizard set_param widget $widget wizard forward Index: openacs-4/packages/cms/www/modules/users/make-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/users/make-admin.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/users/make-admin.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/users/make-admin.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -10,14 +10,14 @@ # to do this set user_id [User::getID] -set db [template::begin_db_transaction] +db_transaction { -content::check_access [cm::modules::sitemap::getRootFolderID] "cm_admin" \ - -mount_point $mount_point -parent_id $parent_id -db $db + content::check_access [cm::modules::sitemap::getRootFolderID] "cm_admin" \ + -mount_point $mount_point -parent_id $parent_id -db $db -# Grant cm_admin on sitemap, templates, users + # Grant cm_admin on sitemap, templates, users -ns_ora dml $db " + db_exec_plsql grant_permission " declare cursor c_module_cur is select module_id from cm_modules; @@ -41,7 +41,6 @@ content_template.get_root_folder, :user_id, 'cm_admin', :target_user_id, 't' ); end;" +} -template::end_db_transaction - -template::forward $return_url \ No newline at end of file +template::forward $return_url Index: openacs-4/packages/cms/www/modules/workflow/case-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/workflow/case-create.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/workflow/case-create.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/workflow/case-create.tcl 25 May 2001 02:15:56 -0000 1.2 @@ -12,7 +12,6 @@ set user_id [User::getID] set is_edit [element get_value case_create is_edit] -set db [template::get_db_handle] # check if this user has permission to create a workflow set item_id [element get_value case_create item_id] @@ -23,7 +22,7 @@ -request_error # get a list of users (this should be context-specific) -query users multilist " +template::query get_users users multilist " select person.name(user_id) name, user_id from @@ -35,19 +34,18 @@ " # Prepare the form elements -set query " + +set transition_list [list] +template::query get_name_key iterate " select transition_name, transition_key from wf_transitions where workflow_key = 'publishing_wf' order by - sort_order" + sort_order" { -set transition_list [list] -query::iterate $db $query { - form section case_create $row(transition_name) element create case_create ${row(transition_key)}_assign \ @@ -94,17 +92,16 @@ # Get existing case assignments set case_id [element get_value case_create case_id] - set sql_query " + + template::query get_key_id iterate " select transition_key, party_id from wf_case_assignments where workflow_key = 'publishing_wf' and - case_id = :case_id" - - query::iterate $db $sql_query { + case_id = :case_id" { lappend case_values($row(transition_key)) $row(party_id) } @@ -118,7 +115,8 @@ } # Get existing deadlines - set sql_query " + + template::query get_key_deadline iterate " select transition_key, to_char(deadline, 'YYYY MM DD HH24 MI SS') as deadline @@ -127,52 +125,49 @@ where workflow_key = 'publishing_wf' and - case_id = :case_id" - - query::iterate $db $sql_query { + case_id = :case_id" { element set_properties case_create \ "${row(transition_key)}_deadline" \ -value [util::date acquire sql_date $row(deadline)] } } else { - query case_id onevalue " + template::query get_case_id case_id onevalue " select acs_object_id_seq.nextval from dual " element set_properties case_create case_id -value $case_id } } -template::release_db_handle - if { [form is_valid case_create] } { form get_values case_create item_id case_id is_edit transitions msg set creation_ip [ns_conn peeraddr] set db [template::begin_db_transaction] + db_transaction { - if { ![string equal $is_edit t] } { + if { ![string equal $is_edit t] } { - # create the workflow - ns_ora exec_plsql_bind $db "begin :1 := workflow_case.new( + # create the workflow + set case_id [db_exec_plsql new_case "begin :1 := workflow_case.new( workflow_key => 'publishing_wf', context_key => NULL, object_id => :item_id, creation_user => :user_id, creation_ip => :creation_ip, case_id => :case_id ); - end;" [list 1] case_id + end;"] - # make assignments for each transition - foreach transition $transitions { - foreach value [element get_values case_create \ - ${transition}_assign] { + # make assignments for each transition + foreach transition $transitions { + foreach value [element get_values case_create \ + ${transition}_assign] { - ns_ora dml $db " + db_exec_plsql add_assignment " begin workflow_case.add_manual_assignment( case_id => :case_id, @@ -181,32 +176,32 @@ ); end; " - } + } - set deadline [element get_value case_create \ - ${transition}_deadline] - set dead_sql [util::date get_property sql_date $deadline] + set deadline [element get_value case_create \ + ${transition}_deadline] + set dead_sql [util::date get_property sql_date $deadline] - ns_ora dml $db " + db_dml insert_deadlines " insert into wf_case_deadlines ( case_id, workflow_key, transition_key, deadline ) values ( :case_id, 'publishing_wf', :transition, $dead_sql )" - } - } else { + } + } else { - # Modify the workflow - foreach transition $transitions { - set new_values \ + # Modify the workflow + foreach transition $transitions { + set new_values \ [element get_values case_create ${transition}_assign] - set old_values \ + set old_values \ [element get_value case_create ${transition}_assign_old] - # Remove cleared values - if { [llength $old_values] > 0 } { - - set query " + # Remove cleared values + if { [llength $old_values] > 0 } { + + set query " delete from wf_case_assignments where @@ -218,17 +213,17 @@ and party_id in ([join $old_values ,])" - if { [llength $new_values] > 0 } { - append query " and party_id not in ([join $new_values ,])" - } - ns_ora dml $db $query - } - - # Update existing deadlines - set new_deadline \ + if { [llength $new_values] > 0 } { + append query " and party_id not in ([join $new_values ,])" + } + db_dml delete_assignments $query + } + + # Update existing deadlines + set new_deadline \ [element get_value case_create ${transition}_deadline] - set new_dead_sql [util::date get_property sql_date $new_deadline] - ns_ora dml $db " + set new_dead_sql [util::date get_property sql_date $new_deadline] + db_dml update_deadlines " update wf_case_deadlines set @@ -240,11 +235,11 @@ and case_id = :case_id" - # Insert new values - foreach new_value $new_values { - if { [lsearch $old_values $new_value] == -1 } { + # Insert new values + foreach new_value $new_values { + if { [lsearch $old_values $new_value] == -1 } { - ns_ora dml $db " + db_exec_plsql add_new_assignment " begin workflow_case.add_manual_assignment( case_id => :case_id, @@ -253,13 +248,13 @@ ); end; " - } - } - } - } + } + } + } + } - # enable the transitions (insert tasks for each transition) - ns_ora dml $db " + # enable the transitions (insert tasks for each transition) + db_exec_plsql start_case " begin workflow_case.start_case( case_id => :case_id, @@ -270,13 +265,11 @@ end; " - # email notifications of task assignments - workflow::notify_of_assignments $db $case_id $user_id + # email notifications of task assignments + workflow::notify_of_assignments $db $case_id $user_id + } - template::end_db_transaction - template::release_db_handle - # Flush the access cache in order to clear permissions content::flush_access_cache $item_id Index: openacs-4/packages/cms/www/modules/workflow/task-checkin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/workflow/task-checkin.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/workflow/task-checkin.tcl 24 May 2001 23:57:17 -0000 1.2 +++ openacs-4/packages/cms/www/modules/workflow/task-checkin.tcl 25 May 2001 02:15:56 -0000 1.3 @@ -9,12 +9,11 @@ set user_id [User::getID] # check that the task is still valid -query is_valid_task onevalue " +template::query check_valid is_valid_task onevalue " select content_workflow.can_approve( :task_id, :user_id ) from dual " if { [string equal $is_valid_task f] } { - template::release_db_handle template::forward $return_url } @@ -99,21 +98,20 @@ set ip_address [ns_conn peeraddr] set user_id [User::getID] - set db [template::begin_db_transaction] - - # check that the task is still valid - template::query get_task_status is_valid_task onevalue " + db_transaction { + # check that the task is still valid + template::query get_task_status is_valid_task onevalue " select content_workflow.can_approve( :task_id, :user_id ) from dual " - if { [string equal $is_valid_task f] } { - db_dml abort "abort transaction" - template::request::error invalid_task \ + if { [string equal $is_valid_task f] } { + db_dml abort "abort transaction" + template::request::error invalid_task \ "task-checkin.tcl - invalid task - $task_id" - return - } + return + } - db_exec_plsql workflow_checkin " + db_exec_plsql workflow_checkin " begin content_workflow.checkin( task_id => :task_id, @@ -123,5 +121,6 @@ ); end; " + } template::forward $return_url } Index: openacs-4/packages/cms/www/modules/workflow/task-finish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/workflow/task-finish.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/cms/www/modules/workflow/task-finish.tcl 24 May 2001 23:57:17 -0000 1.2 +++ openacs-4/packages/cms/www/modules/workflow/task-finish.tcl 25 May 2001 02:15:56 -0000 1.3 @@ -9,15 +9,13 @@ set user_id [User::getID] -set db [template::get_db_handle] # check that the task is still valid template::query get_status is_valid_task onevalue " select content_workflow.can_approve( :task_id, :user_id ) from dual " if { [string equal $is_valid_task f] } { - template::release_db_handle template::forward $return_url } @@ -44,7 +42,6 @@ content_workflow.can_approve( tk.task_id, :user_id ) = 't' " -template::release_db_handle form create task_finish -elements {