Index: openacs-4/packages/cms/www/modules/templates/properties.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/properties.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/cms/www/modules/templates/properties.tcl 16 May 2005 20:47:56 -0000 1.5 +++ openacs-4/packages/cms/www/modules/templates/properties.tcl 31 Aug 2006 19:59:07 -0000 1.5.2.1 @@ -6,42 +6,47 @@ @creation-date October 2004 } { { item_id:integer ""} + { revision_id:integer,optional } { path:optional "" } { mount_point "templates"} - { template_props_tab:optional "revisions"} + { tab:optional "template"} } +set template_id $item_id +set user_id [auth::require_login] -if { ! [string equal $path {}] } { +permission::require_permission -party_id $user_id \ + -object_id $template_id -privilege read - set item_id [db_string get_id ""] - - if { [string equal $item_id {}] } { - - set msg "The requested folder $path does not exist." - request error invalid_path $msg +# the ability to pass in a path is not currently utilized by any CMS pages +if { $path ne "" } { + set item_id [content::item::get_id -item_path $path] + if { $item_id eq "" } { + ad_return_complaint 1 "The requested folder \"$path\" does not exist." } - -} else { - - if { [string equal $item_id {}] } { - set id [db_string get_root_id ""] - } - - set path [db_string get_path ""] +} elseif { $item_id eq "" } { + set folder_id [cm::modules::templates::getRootFolderID [ad_conn subsite_id]] + ad_returnredirect [export_vars -base index {mount_point folder_id}] + ad_script_abort } -# query for the content type and redirect if a folder - -set type [db_string get_type ""] - -if { [string equal $type content_folder] } { - template::forward index?id=$item_id +cms::template::get -template_id $item_id +if { ![info exists revision_id] } { + set revision_id [content::item::get_latest_revision -item_id $item_id] } -# query the content_type of the item ID so we can check for a custom info page -db_1row get_info "" -column_array info -template::util::array_to_vars info +set page_title "Content Template - $template_info(title)" -set item_title [db_string get_item_title ""] -set page_title "Content Template - $item_title" +set write_p [permission::permission_p -party_id $user_id \ + -object_id $template_id -privilege write] +# set up links that will appear on all tabs +set return_url [ad_return_url] +set revise_url [export_vars -base template-ae {template_id revision_id mount_point tab return_url}] +set rename_url [export_vars -base ../items/rename {item_id mount_point tab return_url}] +set upload_url [export_vars -base upload {template_id tab return_url}] +set download_url [export_vars -base download {template_id tab return_url}] + +# send over to manage-items-2 to delete +set action delete +set folder_id $template_info(parent_id) +set delete_url [export_vars -base ../sitemap/manage-items-2 {item_id mount_point folder_id action return_url}]