Index: openacs-4/packages/cms/www/modules/items/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/index.tcl,v diff -u -r1.9.2.2 -r1.9.2.3 --- openacs-4/packages/cms/www/modules/items/index.tcl 29 Nov 2005 21:36:05 -0000 1.9.2.2 +++ openacs-4/packages/cms/www/modules/items/index.tcl 31 Aug 2006 19:59:06 -0000 1.9.2.3 @@ -7,18 +7,19 @@ @creation-date May 2005 } { { item_id:integer } + { revision_id:integer,optional } { mount_point:optional "sitemap" } - { item_props_tab:optional "editing" } + { tab:optional "item" } } set package_url [ad_conn package_url] # HACK: sometimes the query string does not get parsed when returning # from revision-add-2. The reason for this is unclear. -if { [string equal [ns_queryget item_id] {}] } { - ns_log Notice "ITEM ID NOT FOUND...PARSING QUERY STRING" - set item_id [lindex [split [ns_conn query] "="] 1] -} +# if { [string equal [ns_queryget item_id] {}] } { +# ns_log Notice "ITEM ID NOT FOUND...PARSING QUERY STRING" +# set item_id [lindex [split [ns_conn query] "="] 1] +# } # resolve any symlinks set item_id [content::symlink::resolve -item_id $item_id] @@ -27,18 +28,22 @@ permission::require_permission -party_id $user_id \ -object_id $item_id -privilege read -set can_edit_p [permission::permission_p -party_id $user_id \ +set write_p [permission::permission_p -party_id $user_id \ -object_id $item_id -privilege write] -# query the content_type of the item ID so we can check for a custom info page (among other things) -db_1row get_info "" -column_array info -template::util::array_to_vars info +content::item::get -item_id $item_id -revision latest +if { ![info exists revision_id] } { + set revision_id $content_item(latest_revision) +} -set page_title "Content Item - $title" +#db_1row get_info "" -column_array info +#template::util::array_to_vars info +set page_title "Content Item - $content_item(title)" + # build the path to the custom interface directory for this content type -set custom_dir [file dirname [ns_conn url]]/custom/$content_type +set custom_dir [file dirname [ns_conn url]]/custom/$content_item(content_type) # check for the custom info page and redirect if found @@ -47,6 +52,24 @@ template::forward $custom_dir/index?item_id=$item_id } -# The root ID is to determine the appropriate path to the item +if { [cms::item::storage_type -revision_id $revision_id] eq "text" } { + set revise_button "Author Revision" + if { [cms::item::has_text_content_p -revision_id $revision_id] } { + set content_method text_entry + } else { + set content_method no_content + } +} else { + set revise_button "Upload Revision" + set content_method file_upload +} -set root_id [cm::modules::${mount_point}::getRootFolderID [ad_conn subsite_id]] +set return_url [ad_return_url] +set revise_url [export_vars -base revision-add-2 {item_id revision_id mount_point tab content_method return_url}] +set rename_url [export_vars -base rename {item_id mount_point tab return_url}] + +# send over to manage-items-2 to delete +set action delete +set folder_id $content_item(parent_id) +set delete_url [export_vars -base ../sitemap/manage-items-2 {item_id mount_point folder_id action return_url}] +