Index: openacs-4/packages/xcms-ui/xcms-ui.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/xcms-ui.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/xcms-ui.info 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,33 @@ + + + + + XCMS User Interface + XCMS User Interface + f + f + + + Dave Bauer + Jun Yamog + XCMS content management user interface + XCMS User Interface is a + content management system built on the OpenACS Content Repository + and BCMS CR Tcl API. It is a work in progress. Functionality + includes upload or text entry on content or files, categorization, + and template editing and assignment. + + + + + + + + + + + + + + + Index: openacs-4/packages/xcms-ui/lib/categories-form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/categories-form.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/categories-form.adp 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/xcms-ui/lib/categories-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/categories-form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/categories-form.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,45 @@ +# item_id Object ID to assign categories to +# parent_id Object ID to use to find out which category trees are available +# return_url +ns_log notice "DAVEB categories-form.tcl item_id = $item_id" + +ad_form -name categories -mode $form_mode -export {parent_id return_url} -has_edit 1 -form { + item_id:key + {edit:text(submit) {label "Edit Categories ->"}} + +} + +set category_trees [category_tree::get_mapped_trees $parent_id] +ns_log notice "DAVEB: parent_id $parent_id category trees $category_trees" + +foreach elm $category_trees { + foreach { tree_id name subtree_id } $elm {} + ad_form -extend -name categories -form \ + [list [list category_id_${tree_id}:integer(category) \ + {label $name} \ + {html {single single}} \ + {category_tree_id $tree_id} \ + {category_subtree_id $subtree_id} \ + {category_object_id {[value_if_exists item_id]}} ]] +} + +ad_form -extend -name categories -edit_request { + + +} -on_submit { + + set category_ids [list] + foreach elm $category_trees { + foreach { tree_id name dummy } $elm {} + set category_ids [concat $category_ids [set category_id_${tree_id}]] + } + +# set categories + + category::map_object -remove_old -object_id $item_id $category_ids + + ad_returnredirect $return_url +} + + + Index: openacs-4/packages/xcms-ui/lib/category-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/category-form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/category-form.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,57 @@ +ad_page_contract { + a form to create or edit a category + + this file is meant to be included with the following parameters + + category_id - if you are editing a category + parent_id - if you are adding a subcategory + return_url - requires a return_url, so after creating or editing a category it redirect to this url +} { +} + +if {![info exists parent_id]} { + set parent_id "" +} + + +ad_form -name simpleform -has_edit 1 -form { + + category_id:key + + {heading:text(text) {html {style "width: 20em"}} {label "Category Heading"}} + {description:text(textarea) {html {style "width: 40em; height: 20em"}} {label "Description"}} + {parent_id:integer(hidden),optional {value $parent_id}} + {return_url:text(hidden) {value $return_url}} + {formbutton:text(submit) {label "Edit Categories"}} +} -edit_request { + + array set category [bcms::category::get_category -category_id $category_id] + set heading $category(heading) + set description $category(description) + +} -edit_data { + + bcms::category::set_category -category_id $category_id -heading $heading -description $description + +} -new_data { + + set creation_user [ad_conn user_id] + set creation_ip [ad_conn peeraddr] + + bcms::category::create_category -heading $heading -description $description -parent_id $parent_id \ + -creation_user $creation_user -creation_ip $creation_ip + +} -after_submit { + + ad_returnredirect $return_url + ad_script_abort + +} + + +ad_return_template "/packages/bcms-ui-base/lib/simple-form" + + + + + Index: openacs-4/packages/xcms-ui/lib/file-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/file-form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/file-form.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,71 @@ +# this file is meant to be included with the following parameters +# +# folder_id - if you are creating a new file +# revision_id - if you are editing a file revision +# return_url - requires a return_url, so after creating or editing a folder it redirect to this url +# form_mode - either "edit" or "display" + +bcms_ui_base::check_include_vars + +ad_form -name simpleform -mode $form_mode -html {enctype multipart/form-data} -form { + revision_id:key + + {name:text(text) {help_text {no spaces, no special characters}} {label "File Name"}} + {title:text(text) {label "Title"}} + {description:text(textarea),optional {html {rows 5 cols 80}} {label "Description"}} + {upload_file:file(file),optional {label "File"}} + {parent_id:integer(hidden),optional {value $parent_id}} + {item_id:integer(hidden),optional {value $item_id}} + {return_url:text(hidden) {value $return_url}} + +} -validate { + {upload_file + {!$__new_p || [exists_and_not_null upload_file]} + # require file only we are uploading a new file, otherwise it ok to just edit the other fields + "File is required" + } + {name + {![bcms::item::is_item_duplicate_p -url $name -root_id $parent_id -item_id $item_id]} + "File Name already exists,
please use another File Name" + } +} -edit_request { + + array set one_revision [bcms::revision::get_revision -revision_id $revision_id] + set item_id $one_revision(item_id) + set name $one_revision(name) + set title $one_revision(title) + set content $one_revision(content) + set description $one_revision(description) + set parent_id $one_revision(parent_id) + +} -edit_data { + + if {[exists_and_not_null upload_file]} { + bcms::revision::set_revision -revision_id $revision_id \ + -title $title -description $description -upload_file $upload_file + } else { + bcms::revision::set_revision -revision_id $revision_id \ + -title $title -description $description + } + if {[info exists name]} { + bcms::item::set_item -item_id $item_id -name $name + # we have renamed the file, we need to redirect on the new name + bcms_ui_base::redirect_after_rename -item_id $item_id + } + +} -new_data { + + # create the file and revision + set item_id [bcms::upload_file -file_name $name -folder_id $parent_id \ + -title $title -description $description -upload_file $upload_file] + +} -after_submit { + + ad_returnredirect $return_url + ad_script_abort + +} + +ad_return_template "/packages/bcms-ui-base/lib/simple-form" + + Index: openacs-4/packages/xcms-ui/lib/folder-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/folder-form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/folder-form.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,95 @@ +#a form to create or edit a folder +# +# this file is meant to be included with the following parameters +# +# folder_id - if you are editing a folder +# parent_id - if you are creating a folder +# create_index_p - if true will create a blank page named "index" on the new folder, defaults to true +# return_url - requires a return_url, so after creating or editing a folder it redirect to this url +# form_mode - either "edit" or "display" + +# initialize the vars that don't exist +if {![info exists parent_id]} { + if {![info exists folder_id]} { + error "you are likely going to use this form to create a new folder, please include a parent_id parameter" + } + set parent_id "" +} +if {![info exists create_index_p]} { + set create_index_p true +} +if {![info exists form_mode]} { + set form_mode edit +} + +ad_form -name simpleform -mode $form_mode -has_edit 1 -form { + + folder_id:key + + {folder_name:text(text) {help_text {Name to be use in URL. No spaces, no special characters}} {label "Folder Name"}} + {folder_label:text(text) {label "Folder Label"}} + {description:text(textarea),optional {label "Folder Description"}} + {create_index_p:boolean(hidden),optional {value $create_index_p}} + {parent_id:integer(hidden),optional {value $parent_id}} + {return_url:text(hidden) {value $return_url}} + {edit:text(submit) {label "Edit Folder ^"}} + +} -edit_request { + + array set folder [bcms::folder::get_folder -folder_id $folder_id] + set folder_name $folder(name) + set folder_label $folder(label) + set description $folder(description) +} -edit_data { + + bcms::folder::set_folder -folder_id $folder_id -name $folder_name -label $folder_label -description $description + + if {[info exists folder_name]} { + # we have renamed the folder, we need to redirect on the new name + bcms_ui_base::redirect_after_rename -item_id $folder_id -url_base "[ad_conn package_url]manage" + } + +} -new_data { + + set creation_user [ad_conn user_id] + set creation_ip [ad_conn peeraddr] + + db_transaction { + # now that we have all the data create the folder + # TODO add create_index parameter?? + # TODO add additional content types somehow? + + set folder_id [bcms::folder::create_folder \ + -name $folder_name \ + -folder_label $folder_label \ + -parent_id $parent_id \ + -description $description \ + -content_types "content_revision image content_folder content_extlink content_symlink"] + + if {$create_index_p} { + # create the index page for the folder + set item_id [bcms::item::create_item -item_name index -parent_id $folder_id -content_type content_revision \ + -storage_type text -creation_user $creation_user -creation_ip $creation_ip] + + # create an initial revision, a blank page + set revision_id [bcms::revision::add_revision -item_id $item_id \ + -title $folder_label \ + -content "" \ + -description "" \ + -mime_type "text/html" \ + -creation_user $creation_user \ + -creation_ip $creation_ip] + } + + } + +} -after_submit { + + ad_returnredirect $return_url + ad_script_abort + +} + + +ad_return_template "/packages/bcms-ui-base/lib/simple-form" + Index: openacs-4/packages/xcms-ui/lib/folder-tree.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/folder-tree.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/folder-tree.adp 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,259 @@ + + + + + + + +
+ @list_properties.bulk_action_export_chunk@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + << + + + << + + + +  <  + + +  <  + + + + +   \@paginator_pages.page@ + + +   \@paginator_pages.page@ + + + + +  >  + + +  >  + + + + >> + + + >> + + +
+ + @actions.label@ + +
+ + + @elements.label@ + v^ + + + @elements.label@ + + + + @elements.label@ + +
+ @list_properties.no_data@ +
+   +
+ @list_properties.groupby_label@: +
+ +
+ + @elements.aggregate_group_label@ + + + \@@list_properties.multirow@.@elements.aggregate_group_col@@ + +
+   +
+ + @elements.aggregate_label@ + + + \@@list_properties.multirow@.@elements.aggregate_col@@ + +
+ + @bulk_actions.label@ + +
+ + Index: openacs-4/packages/xcms-ui/lib/form-template.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/form-template.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/form-template.adp 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,97 @@ +
+ + +
+ Unable to process the form due the following problem(s): +
    + + + + +
  1. + + \@formerror.@elements.id@\@ + +
  2. +
    +
    +
    + +
+
+
+
+ + + + + + @elements.section;noquote@ + + + + + + + + +
+ + +
+
+
+ + + + + + + + + + + + + + + + * + + + + +
+ +
+ \@formgroup.widget;noquote@ + +
+
+
+
+
+ + +
+
+
+ + + +
[i]
+
+
+ + +
+
+ +
+
+
+ + +
Index: openacs-4/packages/xcms-ui/lib/image-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/image-form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/image-form.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,96 @@ +# this file is meant to be included with the following parameters + +# parent_id - if you are creating a new image +# revision_id - if you are editing a image revision +# return_url - requires a return_url, so after creating or editing a folder it redirect to this url + +bcms_ui_base::check_include_vars + +ad_form -name simpleform -mode $form_mode -html {enctype multipart/form-data} -form { + revision_id:key + + {name:text(text) {help_text {no spaces, no special characters}} {label "Image Name"}} + {title:text(text) {label "Title"}} + {description:text(textarea),optional {html {rows 5 cols 80}} {label "Description"}} + {width:integer(text),optional {label "Width"}} + {height:integer(text),optional {label "Height"}} + {upload_file:file(file),optional {label "Image"}} + {parent_id:integer(hidden),optional {value $parent_id}} + {item_id:integer(hidden),optional {value $item_id}} + {return_url:text(hidden) {value $return_url}} + +} -validate { + {upload_file + {!$__new_p || [exists_and_not_null upload_file]} + # require file only we are uploading a new file, otherwise it ok to just edit the other fields + "Image is required" + } + {name + {![bcms::item::is_item_duplicate_p -url $name -root_id $parent_id -item_id $item_id]} + "Image Name already exists,
please use another Image Name" + } +} -edit_request { + + array set one_revision [bcms::revision::get_revision -revision_id $revision_id -additional_properties {width height}] + set item_id $one_revision(item_id) + set name $one_revision(name) + set title $one_revision(title) + set content $one_revision(content) + set description $one_revision(description) + set width $one_revision(width) + set height $one_revision(height) + set parent_id $one_revision(parent_id) + +} -edit_data { + + if {[exists_and_not_null upload_file]} { + bcms::revision::set_revision -revision_id $revision_id \ + -title $title -description $description -upload_file $upload_file + } else { + bcms::revision::set_revision -revision_id $revision_id \ + -title $title -description $description + } + + set additional_properties {} + if {[info exists width]} { + lappend additional_properties [list width $width] + } + if {[info exists height]} { + lappend additional_properties [list height $height] + } + + db_dml update_event "update images set [bcms::parse_properties -properties $additional_properties -return_format update] where image_id = :revision_id" + + if {[info exists name]} { + bcms::item::set_item -item_id $item_id -name $name + # we have renamed the image, we need to redirect on the new name + bcms_ui_base::redirect_after_rename -item_id $item_id + } + +} -new_data { + + db_transaction { + set item_id [bcms::item::create_item -item_name $name -parent_id $parent_id -content_type image \ + -storage_type file] + + set additional_properties {} + if {[exists_and_not_null width]} { lappend additional_properties [list width $width] } + if {[exists_and_not_null height]} { lappend additional_properties [list height $height] } + set revision_id [bcms::revision::upload_file_revision -item_id $item_id \ + -title $title -description $description \ + -upload_file $upload_file \ + -additional_properties $additional_properties] + + } + +} -after_submit { + + ad_returnredirect $return_url + ad_script_abort + +} + +set context "Add/Edit Image" +ad_return_template "/packages/bcms-ui-base/lib/simple-form" + + Index: openacs-4/packages/xcms-ui/lib/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/index.vuh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/index.vuh 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,51 @@ +################## KLUDGE BY STAS ############### +# Try and look up the item in the content repository +################################################# +ad_page_contract { + + @author Unknown + @creation-date Unknown + @cvs-id $Id: index.vuh,v 1.1 2004/05/01 12:09:16 daveb Exp $ +} { + { revision_id "" } +} + +# Get the paths +set the_root [ns_info pageroot] +set the_url "/[ad_conn path_info]" +ns_log notice "DAVEB start $the_root / $the_url" +# Get the IDs +# Ugly hack to workaround the fact that a URL on index will match +# index.vuh, causing path_info to be empty + +if {[string equal "index" [lindex [ad_conn urlv] end]] && ![string match "*index" $the_url]} { + append the_url "index" +} + + +set content_root [parameter::get -parameter root_folder_id -default "-100"] +set template_root [parameter::get -parameter template_folder_idi -default "-200"] +ns_log notice "content_root $content_root template_root $template_root" +set context [parameter::get -parameter cms_context -default "public"] + +# Serve the page + +# DRB: Note that content::init modifies the local variable the_root, which is treated +# as though it's been passed by reference. This requires that the redirect treat the +# path as an absolute path within the filesystem. + +if { [content::init -revision "best" the_url the_root $content_root $template_root $context $revision_id ] } { +set file "$the_root/$the_url" +ns_log notice "DAVEB! looking for $the_root/$the_url" +rp_internal_redirect -absolute_path $file +} else { + # ns_returnnotfound + set page "[ad_header {Content Item Not Found}]" + append page "

Content Item Not Found

" + append page "The requested item is not available for viewing. " + append page "The item is either not available on this server or it is not in a publishable state " + append page "Unpublished items can be viewed via the CMS interface if the CMS package is installed.
" + append page "[ad_footer]" + doc_return 200 text/html $page +} + Index: openacs-4/packages/xcms-ui/lib/item-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/item-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/item-list.adp 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,244 @@ + + + + +
+ +
+ + + +
+ + @actions.label@ + +
+
+ + + + +
+ @list_properties.bulk_action_export_chunk@ + + + + + @bulk_actions.label@ + + + + +
+
+ + + + + + +
+ + + << + + + + + < + + + + + \@paginator_pages.page@ + + + \@paginator_pages.page@ + + + + + > + + + + >> + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + v + + + ^ + + @elements.label@ + + + @elements.label@ + + + + @elements.label@ + +
+ @list_properties.no_data@ +
+ +
+ + + + + + +
+ + + << + + + + + < + + + + + \@paginator_pages.page@ + + + \@paginator_pages.page@ + + + + + > + + + + >> + + +
+
+
+
+ + + + + +
+ + + + + @bulk_actions.label@ + + + + +
+
+ + +
+ +
+ + Index: openacs-4/packages/xcms-ui/lib/navbar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/navbar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/navbar.adp 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,6 @@ +
+
Index: openacs-4/packages/xcms-ui/lib/navbar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/navbar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/navbar.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,3 @@ +set content_url "[ad_conn package_url]manage/" +set template_url "[ad_conn package_url]template/" +set category_url "/categories/" Index: openacs-4/packages/xcms-ui/lib/page-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/page-form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/page-form.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,124 @@ +# this file is meant to be included with the following parameters +# +# parent_id - if you are creating a new page +# revision_id - if you are editing a page revision +# return_url - requires a return_url, so after creating or editing a folder it redirect to this url +# form_mode - either "edit" or "display" +set storage_type text +bcms_ui_base::check_include_vars +set package_id [ad_conn package_id] +ad_form -name simpleform -mode $form_mode -html {enctype multipart/form-data} -form { + revision_id:key + + {name:text(text) {help_text {no spaces, no special characters}} {label "Page Name"}} + {title:text(text) {label "Title"}} + {description:text(textarea),optional {html {rows 5 cols 80}} {label "Description"}} + {parent_id:integer(hidden),optional {value $parent_id}} + {item_id:integer(hidden),optional {value $item_id}} + {return_url:text(hidden) {value $return_url}} + {storage_type:text(hidden) {value $storage_type}} + {content:richtext_or_file(richtext_or_file),optional {html {rows 20 cols 80}} {label "Page Content"}} + +} -edit_request { + array set one_revision [bcms::revision::get_revision -revision_id $revision_id] + set item_id $one_revision(item_id) + + array set one_item [bcms::item::get_item -item_id $item_id] + + set name $one_revision(name) + set title $one_revision(title) + set description $one_revision(description) + + set storage_type $one_item(storage_type) + + set mime_type $one_revision(mime_type) + + if {[string equal "text" $storage_type]} { + + set content [template::util::richtext_or_file create $storage_type $mime_type $one_revision(content)] + + } else { + set content [template::util::richtext_or_file create $storage_type $mime_type "" $one_revision(content) "" ""] + } + + set parent_id $one_revision(parent_id) + +} -validate { + {name + {![bcms::item::is_item_duplicate_p -url $name -root_id $parent_id -item_id $item_id]} + "Page Name already exists,
please use another Page Name" + } +} -edit_data { + set mime_type [template::util::richtext_or_file::get_property mime_type $content] + set content [template::util::richtext_or_file::get_property text $content] +# DAVEB always create a new revision on edit +# have a RENAME function. name shouldn't be edited ususally. it breaks +# links +ns_log notice "DAVEB page-form edit_data" +# TODO: DAVEB Fix this to work with file upload!! + + if {[string equal "text" $storage_type]} { + + set revision_id [bcms::revision::add_revision -item_id $item_id \ + -title $title \ + -content $content \ + -description $description \ + -mime_type $mime_type \ + -creation_user [ad_conn user_id] \ + -creation_ip [ad_conn peeraddr]] + set return_url "${return_url}?[export_vars revision_id]" + } else { + + bcms::revision::upload_revision + + } + + ad_returnredirect $return_url + ad_script_abort + +} -new_data { + set mime_type [template::util::richtext_or_file::get_property mime_type $content] + set storage_type [template::util::richtext_or_file::get_property storage_type $content] + ns_log notice "DAVEB page-form storage_type = $storage_type" + if {[string equal "file" $storage_type]} { + set tmp_filename [template::util::richtext_or_file::get_property tmp_filename $content] + + if {![string equal "text/html" $mime_type]} { + ns_log notice "DAVEB upload page mime_type=$mime_type" + + set html_filename [mime_type_convert::convert_file $tmp_filename $mime_type "text/html"] + set upload_filename [template::util::richtext_or_file::get_property filename $content] + set upload_file [list $upload_filename $html_filename $mime_type] + set mime_type "text/html" + } else { + set html_filename $tmp_filename + } + set fd [open $html_filename] + set content [read $fd] + close $fd + #get just the content + + #might want to be clever and get title? + + regexp -nocase {(.*?)(.*)} $content match headers body + set content $body + + } elseif {[string equal "text" $storage_type]} { + ns_log notice "DAVEB! page-form content is $content" + set content [template::util::richtext_or_file::get_property text $content] + } + # create the page and revision + set item_id [bcms::create_page -page_name $name -folder_id $parent_id -mime_type $mime_type \ + -title $title -description $description -page_body $content] + + +} -after_submit { + + ad_returnredirect $return_url + ad_script_abort + +} + +ad_return_template "/packages/bcms-ui-base/lib/simple-form" + + Index: openacs-4/packages/xcms-ui/lib/search-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/search-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/search-postgresql.xql 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,59 @@ + + + + postgresql7.2 + + + + + select * from ( + select i.item_id, + i.name, + content_item__get_path(i.item_id, r.item_id) as path, + i.parent_id, + case when i.content_type = 'content_folder' then content_folder__get_label(i.item_id) else bcms__get_title(i.item_id, 'latest') end as title, + i.live_revision, + i.latest_revision, + i.content_type, + to_char(ao.last_modified,'YYYY-MM-DD HH:MM AM') as last_modified, + i.storage_type + from cr_items i, acs_objects ao, + (select tree_sortkey, item_id from cr_items where item_id = :root_folder_id) r $openfts_from + where tree_ancestor_p(r.tree_sortkey, i.tree_sortkey) + and ao.object_id = i.item_id + and i.item_id <> r.item_id + $openfts_where + [template::list::page_where_clause -key i.item_id -and -name search_results] + ) results + where 1 = 1 + [template::list::filter_where_clauses -and -name search_results] + [template::list::orderby_clause -orderby -name search_results] + + + + + + + select * from ( + select i.item_id, + i.name, + i.parent_id, + case when i.content_type = 'content_folder' then content_folder__get_label(i.item_id) else bcms__get_title(i.item_id, 'latest') end as title, + i.live_revision, + i.content_type, + to_char(ao.last_modified,'YYYY-MM-DD HH:MM AM') as last_modified + from cr_items i, acs_objects ao, + (select tree_sortkey, item_id from cr_items where item_id = :root_folder_id) r $openfts_from + where tree_ancestor_p(r.tree_sortkey, i.tree_sortkey) + and ao.object_id = i.item_id + and i.item_id <> r.item_id + $openfts_where + ) results + where 1 = 1 + [template::list::filter_where_clauses -and -name search_results] + [template::list::orderby_clause -orderby -name search_results] + + + + + Index: openacs-4/packages/xcms-ui/lib/search.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/search.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/search.adp 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,11 @@ + + +
+@title@ + +
+ +
+ + + Index: openacs-4/packages/xcms-ui/lib/search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/search.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/search.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,186 @@ +# display search results + +# supply the following vars: +# name_search:optional +# title_search:optional +# content_search:optional +# content_type_search:optional +# {display_search_results:optional 0} +# {bulk_actions:optional ""} +# {bulk_action_export_vars:optional ""} +# {orderby:optional} +# {page:optional} + + +if {[info exists name_search] && [empty_string_p $name_search]} { + unset name_search +} +if {[info exists title_search] && [empty_string_p $title_search]} { + unset title_search +} +if {[info exists content_search] && [empty_string_p $content_search]} { + unset content_search +} +if {[info exists content_type_search] && [empty_string_p $content_type_search]} { + unset content_type_search +} +if {![info exists display_search_results]} { + set display_search_results 0 +} +if {![info exists bulk_actions]} { + set bulk_actions "" +} +if {![info exists bulk_action_export_vars]} { + set bulk_action_export_vars "" +} + +if {$display_search_results} { + + set root_folder_id [parameter::get -parameter root_folder_id] + + set addtnl_where_list {} + if {[exists_and_not_null content_search]} { + set openfts_where "and txt.fts_index @@ '\\\'$content_search\\\'' and txt.tid = i.live_revision" + set openfts_from ", txt" + } else { + set openfts_where "" + set openfts_from "" + } + + set package_url [ad_conn package_url] + + if {![info exists folder_id]} { + set folder_id [parameter::get -parameter root_folder_id] + } + + # we need to construct the pass on bulk action export vars + # on the local tcl name space and also add them to the filters + set bulk_action_export_vars_filter "" + foreach export_var $bulk_action_export_vars { + if {![info exists $export_var]} { + # lets just make sure that it does not exist on the local namespace + upvar 1 $export_var $export_var + } + append bulk_action_export_vars_filter " + $export_var { + add_url_eval {[export_vars $export_var]} + } + " + } + set filters " + $bulk_action_export_vars_filter + display_search_results {} + title_search { + where_clause {title ilike '%' || :title_search || '%'} + } + name_search { + where_clause {name ilike '%' || :name_search || '%'} + } + content_search {} + content_type_search { + where_clause {content_type = :content_type_search} + } + " + + template::list::create \ + -name search_results \ + -multirow search_results \ + -key item_id \ + -pass_properties { package_url } \ + -bulk_actions $bulk_actions \ + -bulk_action_export_vars $bulk_action_export_vars \ + -elements { + name { + label "Name" + link_url_eval {${package_url}manage/switch-type?manage_type=content&return_url=[ad_urlencode "${package_url}$path"]} + } + title { + label "Title" + } + content_type { + label "Type" + display_template { + + + + + + + + + + + + + + + + + + + + + + + + } + html { style "width:70px" } + } + last_modified { + label "Last Modified" + html { style "width:180px" } + } + } \ + -filters $filters \ + -orderby { + default_value name,asc + name { + orderby name + } + title { + orderby title + } + content_type { + orderby content_type + } + last_modified { + orderby last_modified + } + } \ + -page_size 10 \ + -page_groupsize 10 \ + -page_flush_p 1 \ + -page_query_name get_results_page_query + + + db_multirow search_results get_results "SQL" + + + set title "Search Results" + +} else { + template::form::create simpleform + template::element::create simpleform name_search -widget text -label "Name" -datatype string -optional + template::element::create simpleform title_search -widget text -label "Title" -datatype string -optional + template::element::create simpleform content_search -widget text -label "Published Content" -datatype string -optional + if {[exists_and_not_null content_type_search]} { + template::element::create simpleform content_type_search -widget hidden -value $content_type_search + } + template::element::create simpleform display_search_results -widget hidden -value 1 + foreach export_var $bulk_action_export_vars { + upvar 1 $export_var export_var_local + if {![template::element::exists simpleform $export_var]} { + template::element::create simpleform $export_var -widget hidden -value $export_var_local -datatype string + } + } + + # we need to put this dummy one even we dont use it + template::list::create \ + -name search_results \ + -multirow search_results \ + -key item_id \ + -elements {} + + set title "Search" + +} Index: openacs-4/packages/xcms-ui/lib/simple-form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/simple-form.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/simple-form.adp 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/xcms-ui/lib/template-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/template-form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/template-form.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,97 @@ +# this file is meant to be included with the following parameters + +# parent_id - if you are creating a new template +# revision_id - if you are editing a template revision +# return_url - requires a return_url, so after creating or editing a folder it redirect to this url +# form_mode - either "edit" or "display" + +bcms_ui_base::check_include_vars + +set cms_context [parameter::get -parameter cms_context -default ""] +if {[string equal $cms_context ""]} { + error "no cms context defined" +} + +ad_form -name simpleform -mode $form_mode -form { + revision_id:key + + {name:text(text) {label "Template Name"}} + {title:text(text) {label "Title"}} + {description:text(textarea),optional {html {rows 5 cols 80}} {label "Description"}} + {content:text(textarea),optional {html {rows 20 cols 80}} {label "Template Content"}} + {parent_id:integer(hidden),optional {value $parent_id}} + {item_id:integer(hidden),optional {value $item_id}} + {return_url:text(hidden) {value $return_url}} + +} -validate { + {name + {![bcms::item::is_item_duplicate_p -url $name -root_id $parent_id -item_id $item_id]} + "Template Name already exists,
please use another Template Name" + } +} -edit_request { + + array set one_revision [bcms::revision::get_revision -revision_id $revision_id] + set item_id $one_revision(item_id) + set name $one_revision(name) + set title $one_revision(title) + set description $one_revision(description) + set folder_id $one_revision(parent_id) + +# For now, just show the template thats in the database +# DAVEB + +# set template_dir [parameter::get -parameter TemplateRoot] +# set template_root_id [parameter::get -parameter template_folder_id] +# set template_path [db_string get_url "select content_item__get_path(:item_id,:template_root_id)"] +# set template_root "[acs_root_dir]/${template_dir}" +#set template_filename "${template_root}/${template_path}.adp" +#ns_log notice "DAVEB: template-form template_filename $template_filename" +# # read the file contents from the file system +# if {[file exists $template_filename]} { +# set content [template::util::read_file $template_filename] +# } else { + set content $one_revision(content) +# } + +} -edit_data { + + bcms::revision::set_revision -revision_id $revision_id \ + -title $title -content $content -description $description + + array set template [bcms::item::get_item -item_id $item_id] + +# skip this, content::init will publish the template. Later we can +# add a feature to publish a revision of a template +# DAVEB + + if {![empty_string_p $template(live_revision)]} { + + set template_dir [parameter::get -parameter TemplateRoot] + set template_root_id [parameter::get -parameter template_folder_id] + set template_path [db_string get_url "select content_item__get_path(:item_id,:template_root_id)"] + set template_root "[acs_root_dir]/${template_dir}" +set template_filename "${template_root}/${template_path}.adp" +# + ns_log notice "DAVEB template-form writing template to $template_filename" + template::util::write_file $template_filename $content + } + +} -new_data { + + # create the template and revision + db_transaction { + set item_id [bcms::template::create_template -template_name $name -parent_id $parent_id] + set revision_id [bcms::template::add_template -template_id $item_id \ + -title $title -content $content -description $description] + } + +} -after_submit { + + ad_returnredirect $return_url + ad_script_abort + +} + +ad_return_template "/packages/bcms-ui-base/lib/simple-form" + + Index: openacs-4/packages/xcms-ui/lib/xcms-default.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/xcms-default.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/xcms-default.adp 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,9 @@ + +@title;noquote@ +@context;noquote@ +

TEST

+Manage Content

+@text;noquote@ + + + Index: openacs-4/packages/xcms-ui/lib/xcms-default.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/xcms-default.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/xcms-default.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,26 @@ +# Put the current revision's attributes in a onerow datasource named "content". +# The detected content type is "content_revision". + +content::get_content content_revision + +if { ![string equal -length 4 "text" $content(mime_type)] } { + # It's a file. + cr_write_content -revision_id $content(revision_id) + ad_script_abort +} + +# Ordinary text/* mime type. +template::util::array_to_vars content + +set text [cr_write_content -string -revision_id $revision_id] + +set text [ad_html_text_convert -from $mime_type -to text/html $text] + +set context [list $title] + +set admin_p [permission::permission_p -object_id [ad_conn package_id] -party_id [ad_conn user_id] -privilege "admin"] +set manage_url "[ad_conn package_url]manage/[ad_conn path_info]" + + +ad_return_template + Index: openacs-4/packages/xcms-ui/lib/xcms-folder-default.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/xcms-folder-default.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/xcms-folder-default.adp 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,14 @@ + +@label;noquote@ +@context;noquote@ + +

+ +

+ +

+

@folders.label@

+

+
+ + Index: openacs-4/packages/xcms-ui/lib/xcms-folder-default.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/lib/xcms-folder-default.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/lib/xcms-folder-default.tcl 1 May 2004 12:09:16 -0000 1.1 @@ -0,0 +1,30 @@ +# get a listing of all items in this folder and its direct children + +# get a sort_order for the folders and contents from cr_child_rels +if {![string equal "/" [string index [ad_conn url] end ]]} { + ad_returnredirect "[ad_conn url]/" +} +set folder_id [content::get_item_id] + +array set folder [bcms::folder::get_folder -folder_id $folder_id] +template::util::array_to_vars folder +set context "${label}" +bcms::folder::list_folders -parent_id $folder_id \ + -multirow_name folders + +db_multirow contents get_folder_contents { + select ci.name, + ci.item_id, + content_item__get_title(ci.item_id) as title, + ci.parent_id, + case when ci.content_type = 'content_folder' then 1 else 0 end as folder_p + from cr_items ci + where parent_id=:folder_id + order by tree_sortkey + limit 10 + } + +set admin_p [permission::permission_p -object_id [ad_conn package_id] -party_id [ad_conn user_id] -privilege "admin"] +set manage_url "[ad_conn package_url]manage/[ad_conn path_info]" +ad_return_template + Index: openacs-4/packages/xcms-ui/tcl/mime-type-convert-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/tcl/mime-type-convert-init.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/tcl/mime-type-convert-init.tcl 1 May 2004 12:09:17 -0000 1.1 @@ -0,0 +1,11 @@ + +set mime_convert_procs [list] + +lappend mime_convert_procs "application/msword_to_text/html" "mime_type_convert::doc_to_html" + +foreach {types c} $mime_convert_procs { + + nsv_set mime_convert_procs $types $c + +} + Index: openacs-4/packages/xcms-ui/tcl/mime-type-convert-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/tcl/mime-type-convert-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/tcl/mime-type-convert-procs.tcl 1 May 2004 12:09:17 -0000 1.1 @@ -0,0 +1,58 @@ +ad_library { + + @author Dave Bauer dave@thedesignexperience.org + @creation-date 2004-01-31 + @cvs-id $Id + +} + + +namespace eval mime_type_convert:: {} + + +ad_proc -public mime_type_convert::convert_file { + filename + from_type + to_type +} { + @param filename full path to file to be converted + @param to_type type to convert to +} { + + #get procedure to convert with + + set proc_name [nsv_get mime_convert_procs ${from_type}_to_${to_type}] + + $proc_name $filename + +} + +ad_proc -public mime_type_convert::doc_to_html { + filename +} { + @param filename full path to file to be converted +} { + + # let's just start with inputting a Word file and outputting some xhtml + + set tmpdir [lindex [parameter::get -package_id [ad_conn subsite_id] -parameter TmpDir -default "/tmp"] 0] + + # create a temporary file to hold the converted data + ns_log notice "DAVEB mime_type_convert ${filename} exists [file exists ${filename}]" + + set new_filename [file tail [ns_mktemp "${tmpdir}/fileXXXXXX"]] + + # convert to HTML + exec /usr/bin/wvHtml --targetdir=${tmpdir} ${filename} ${new_filename} + # clean up word HTML + set err [catch {exec sh -c "(tidy -c -i -q ${tmpdir}/${new_filename} 2> /dev/null ;/bin/true)" } msg] + + #exec /usr/bin/tidy -e -m ${tmpdir}/${new_filename} + # tidy is returning some info to STDERR and making this fail + # if I catch it, the file is empty, not sure where the output is going! + +# return ${tmpdir}/${new_filename} + return $msg + +} + Index: openacs-4/packages/xcms-ui/tcl/xcms-ui-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/tcl/xcms-ui-install-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/tcl/xcms-ui-install-procs.tcl 1 May 2004 12:09:17 -0000 1.1 @@ -0,0 +1,133 @@ +ad_library { + Install callback procedures for xcms-ui-base +} + +namespace eval xcms_ui_base::install {} + +ad_proc xcms_ui_base::install::package_install {} { + + +} + + +ad_proc xcms_ui_base::install::after_mount { + -package_id + -node_id +} { + After mount callback +} { + + register_default_templates -package_id $package_id -node_id $node_id + +} + +ad_proc xcms_ui_base::install::register_default_templates { + -package_id + -node_id +} { + Register default templates for content_folder + and content_revision. Import templates from + packages/xcms-ui-base/templates/ and create template folders + +} { + +# register public display templates + + set parent_subsite_package_id [site_node::closest_ancestor_package \ + -node_id $node_id \ + -package_key "acs-subsite" + ] + + set parent_subsite_url [apm_package_url_from_id $parent_subsite_package_id] + + set template_folder_id [parameter::get \ + -parameter "TemplateRoot" \ + -package_id $parent_subsite_package_id + ] + + if {![empty_string_p $template_folder_id]} { + + set template_folder_id [xcms::folder::create_folder \ + -name "xcms-${package_id}-templates" \ + -folder_label "XCMS ${package_id} Templates" \ + -parent_id "-200" \ + -content_types [list content_folder content_template]] + + parameter::set_value \ + -package_id $package_id \ + -parameter "template_folder_id" \ + -value $template_folder_id + + } + + set template_root "[acs_root_dir]/templates/${parent_subsite_url}" + + parameter::set_value \ + -package_id $package_id \ + -parameter TemplateRoot \ + -value $template_root + +# ideally we create a folder mapped to the site_node here set +# to the content_root_id parameter, problem is, if we +# want to manage the main site content, so default to subsite root +# which for now is just -100 + + set default_template_id [xcms::template::create_template \ + -template_name "xcms-default" \ + -parent_id $template_folder_id] + set default_template_dir [acs_r set template_root "[acs_root_dir]/templates/${parent_subsite_url}" + + set default_template_file [acs_root_dir]/packages/xcms-ui-base/lib/xcms-default + set fd [open ${default_template_file}.adp] + set default_template_content [read $fd] + close $fd + + xcms::template::add_template \ + -template_id $default_template_id \ + -title "Default Content Template" \ + -content $default_template_content + + set folder_template_id [xcms::template::create_template \ + -template_name "xcms-folder-default" \ + -parent_id $template_folder_id] + + set default_folder_template_file [acs_root_dir]/packages/xcms-ui-base/lib/xcms-folder-default + set fd [open ${default_folder_template_file}.adp] + set default_folder_template_content [read $fd] + close $fd + + + xcms::template::add_template \ + -template_id $folder_template_id \ + -title "Default Folder Template" \ + -content $default_folder_template_content + file mkdir $template_root + file copy ${default_template_dir}/public $template_root + file copy ${default_template_dir} ${template_root} + + xcms::template::register_template \ + -content_type "content_revision" \ + -template_id $default_template_id \ + -context "xcms-public" + + xcms::template::register_template \ + -content_type "content_folder" \ + -template_id $folder_template_id \ + -context "xcms-public" + +} + +ad_proc xcms_ui_base::install::package_uninstall {} { + +} { + unregister_templates +} + +ad_proc xcms_ui_base::install::unregister_templates {} { + + unregister templates for package removal + +} { + + +} Index: openacs-4/packages/xcms-ui/tcl/xcms-ui-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/tcl/xcms-ui-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/tcl/xcms-ui-procs-postgresql.xql 1 May 2004 12:09:17 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.2 + + + + select case when count(*) = 0 then true else false end + from cr_items + where content_type = 'content_folder' + and item_id in ($item_ids) + and not content_folder__is_empty(item_id) + + + + Index: openacs-4/packages/xcms-ui/tcl/xcms-ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/tcl/xcms-ui-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/tcl/xcms-ui-procs.tcl 1 May 2004 12:09:17 -0000 1.1 @@ -0,0 +1,386 @@ +ad_library { + + Procs specific for for this XCMS UI (xcms-ui) + + @author Jun Yamog + @creation-date Aug 2003 + @cvs-id $Id: xcms-ui-procs.tcl,v 1.1 2004/05/01 12:09:17 daveb Exp $ + +} + + +namespace eval bcms_ui_base {} + +ad_proc -public bcms_ui_base::move_url { + {-items_to_move:required} + {-destination_folder:required} + {-return_url:required} + {-redirect_to_folder "0"} +} { + returns the link to move an item to another folder + + @param items_to_move a list of item_id you wish to move + @param destination_folder folder_id of where the item will be be moved + @param return_url after moving, redirects to this url + @param redirect_to_folder if set to 1 then it will rebuild the return_url pointing to the new + folder being moved to + + @returns a link, normally used for the list builder +} { + set item_id $items_to_move + set folder_id $destination_folder + + # redirect the destination folder, normally you will need to do this if one of the item_id + # is the current return_url. So you will not redirect to a item that has moved + if {$redirect_to_folder} { + set path_list [bcms::item::get_item_path -item_id $destination_folder -prepend_path [ad_conn package_url] -return_list -no_parent] + set path "[ns_set get [lindex $path_list 0] path]" + set return_url $path + } + + set url [export_vars -url -base "[ad_conn package_url]manage/move-item" {item_id:multiple folder_id redirect_to_folder return_url}] + return $url +} + + +ad_proc -public bcms_ui_base::delete_url { + {-items_to_delete:required} + {-return_url:required} + {-confirm:boolean} +} { + returns the link to delete the items + + @param items_to_delete a list of item_id you wish to delet + @param return_url after deleting, move to this url + @param confirm if passed it will generate a link that will delete the items + without confirmation + + @returns a link to delete the items, but if a folder that will be deleted is not empty + it will return a null string +} { + set item_id $items_to_delete + + set item_ids [join $item_id ", "] + set can_delete_p [db_string can_delete "SQL"] + if {[string equal $can_delete_p "t"]} { + return [export_vars -url -base "[ad_conn package_url]manage/delete-item" {item_id:multiple confirm_p return_url}] + } else { + return {} + } +} + +ad_proc -public bcms_ui_base::apply_template_url { + {-item_id:required} + {-template_id:required} + {-return_url:required} +} { + returns a link to apply the template + + @param item_id id of the item to apply the template to + @param template_id id of which template to use + @param return_url after applying the template, redirect to this url + + @returns a link to apply the template +} { + + set url [export_vars -url -base "[ad_conn package_url]manage/apply-template" {item_id template_id return_url}] + return $url + +} + +ad_proc -public bcms_ui_base::delete_template_url { + {-templates_to_delete:required} + {-return_url:required} +} { + returns the link to delete the templates, use this when the user has confirmed + + @param templates_to_delete a list of template_id you wish to delet + @param return_url after deleting, move to this url + + @returns a link to delete the templates +} { + set confirm_p 1 + set template_id $templates_to_delete + + return [export_vars -url -base "[ad_conn package_url]manage/template-delete" {template_id:multiple confirm_p return_url}] + +} + +ad_proc -public bcms_ui_base::switch_cms_context_url { + {-cms_context:required} + {-return_url} +} { + create a link to switch to a cms_context + + @param cms_context switch to which cms_context + @param return_url set where to redirect after switching cms_context + + @returns a url to on how to switch to a cms_context +} { + + set package_url [ad_conn package_url] + if {![info exists return_url]} { + set return_url [ad_return_url] + } + + return [export_vars -base ${package_url}manage/switch-context {{cms_context $cms_context} {return_url $return_url}}] + +} + +ad_proc -public bcms_ui_base::context_action_link { + {-context_action:required} + {-export_vars:required} + {-context_action_label} +} { + create a html a href for a particular context action + + @param context_action context action you would like to generate a link + @parem export_vars vars to put on the get query +} { + + set package_url [ad_conn package_url] + + set context_action_link " " + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Apply Template" + } + append context_action_link "" + } + folder-set-category { + append context_action_link " id=\"folder-set-category\" href=\"${package_url}manage/folder-set-category?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Use Categories" + } + append context_action_link "" + } + folder-add { + append context_action_link " id=\"folder-add\" href=\"${package_url}manage/folder-add?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Add SubFolder" + } + append context_action_link "" + } + page-add { + append context_action_link " id=\"page-add\" href=\"${package_url}manage/page-add?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Add Page" + } + append context_action_link "" + } + image-add { + append context_action_link " id=\"image-add\" href=\"${package_url}manage/image-add?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Add Image" + } + append context_action_link "" + } + file-add { + append context_action_link " id=\"file-add\" href=\"${package_url}manage/file-add?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Add File" + } + append context_action_link "" + } + sb-event-add { + append context_action_link " id=\"sb-event-add\" href=\"${package_url}manage/sb-event-add?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Add Event & Gigs" + } + append context_action_link "" + } + sb-bio-add { + append context_action_link " id=\"sb-bio-add\" href=\"${package_url}manage/sb-bio-add?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Add Biography" + } + append context_action_link "" + } + template-add { + append context_action_link " id=\"template-add\" href=\"${package_url}manage/template-add?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Add Template" + } + append context_action_link "" + } + revision-publish { + append context_action_link " id=\"revision-publish\" href=\"${package_url}manage/revision-publish?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Publish" + } + append context_action_link "" + } + revision-unpublish { + append context_action_link " id=\"revision-unpublish\" href=\"${package_url}manage/revision-unpublish?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Unpublish" + } + append context_action_link "" + } + categorize-item { + append context_action_link " id=\"categorize-item\" href=\"${package_url}manage/categorize-item?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Categorize" + } + append context_action_link "" + } + revision-list { + append context_action_link " id=\"revision-list\" href=\"${package_url}manage/revision-list?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "View Version(s)" + } + append context_action_link "" + } + relate-page { + append context_action_link " id=\"relate-page\" href=\"${package_url}manage/relate-item?${export_vars}&[export_vars {{content_type_search content_revision} {relation_type pages}}]\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Relate Page" + } + append context_action_link "" + } + relate-image { + append context_action_link " id=\"relate-image\" href=\"${package_url}manage/relate-item?${export_vars}&[export_vars {{content_type_search image} {relation_type images}}]\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Relate Image" + } + append context_action_link "" + } + template-write { + append context_action_link " id=\"template-write\" href=\"${package_url}manage/template-write?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Write Template" + } + append context_action_link "" + } + sb-writing-add { + append context_action_link " id=\"sb-writing-add\" href=\"${package_url}manage/sb-writing-add?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Add Writing" + } + append context_action_link "" + } + sb-download-add { + append context_action_link " id=\"sb-download-add\" href=\"${package_url}manage/sb-download-add?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Add Download" + } + append context_action_link "" + } + sb-band-set { + append context_action_link " id=\"sb-band-set\" href=\"${package_url}manage/sb-band-set?$export_vars\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Select Band" + } + append context_action_link "" + } + sb-featured-set { + append context_action_link " id=\"sb-featured-set\" href=\"${package_url}manage/sb-featured-set?$export_vars&[export_vars {{action set}}]\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Set Featured" + } + append context_action_link "" + } + sb-featured-unset { + append context_action_link " id=\"sb-featured-set\" href=\"${package_url}manage/sb-featured-set?$export_vars&[export_vars {{action unset}}]\">" + if {[info exists context_action_label]} { + append context_action_link $context_action_label + } else { + append context_action_link "Unset Featured" + } + append context_action_link "" + } + default { error "context_action = $context_action is not a valid value" } + + } + + return $context_action_link + +} + + +ad_proc -public bcms_ui_base::redirect_after_rename { + {-item_id:required} + {-url_base "[ad_conn package_url]"} +} { + after renaming the url/name of an item. you will need to redirect to the new url/name + + @param item_id redirect to the url of this item +} { + set first_row [lindex [bcms::item::get_item_path -item_id $item_id -prepend_path [ad_conn package_url] -return_list -no_parent] 1] + if {[llength $first_row] > 0} { + set path [ns_set get $first_row path] + } else { + set path $url_base + } + + ns_log notice " DAVEB!! url_base '$url_base' path '$path'" + ad_returnredirect "${path}" + ad_script_abort +} + +ad_proc -public bcms_ui_base::check_include_vars { +} { + check item_id, folder_id, revision_id, form_mode and return_url vars. This is used for the forms that is included in /xcms-ui/lib +} { + upvar 1 item_id item_id parent_id parent_id revision_id revision_id form_mode form_mode return_url return_url + + # check if the parameters exists and set them to their defaults + if {![info exists parent_id]} { + if {![info exists revision_id]} { + error "parent_id does not exists, please pass in the parent_id if you are creating a new item" + } + set parent_id "" + set item_id "" + } else { + set item_id "" + } + if {![info exists form_mode]} { + set form_mode edit + } + if {![info exists return_url]} { + error "return_url does not exists, please pass in return_url" + } +} Index: openacs-4/packages/xcms-ui/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/index.vuh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/index.vuh 1 May 2004 12:09:17 -0000 1.1 @@ -0,0 +1,53 @@ +ns_log notice "RUNNING bcms-ui-base/www/index.vuh" +################## KLUDGE BY STAS ############### +# Try and look up the item in the content repository +################################################# +ad_page_contract { + + @author Unknown + @creation-date Unknown + @cvs-id $Id: index.vuh,v 1.1 2004/05/01 12:09:17 daveb Exp $ +} { + { revision_id "" } +} + +# Get the paths +set the_root [ns_info pageroot] +set the_url "/[ad_conn path_info]" +ns_log notice "DAVEB start $the_root / $the_url" +# Get the IDs +# Ugly hack to workaround the fact that a URL on index will match +# index.vuh, causing path_info to be empty + +if {[string equal "index" [lindex [ad_conn urlv] end]] && ![string match "*index" $the_url]} { + append the_url "index" +} + + +set content_root [parameter::get -parameter root_folder_id -default "-100"] +set template_root [parameter::get -parameter template_folder_id -default "-200"] + +ns_log notice "content_root $content_root template_root $template_root" +set context [parameter::get -parameter cms_context -default "xcms-public"] + +# Serve the page + +# DRB: Note that content::init modifies the local variable the_root, which is treated +# as though it's been passed by reference. This requires that the redirect treat the +# path as an absolute path within the filesystem. + +if { [content::init -resolve_index "t" -revision "live" the_url the_root $content_root $template_root $context $revision_id ] } { +set file "$the_root/$the_url" +ns_log notice "DAVEB! looking for $the_root/$the_url" +rp_internal_redirect -absolute_path $file +} else { + ns_returnnotfound + set page "[ad_header {Content Item Not Found}]" + append page "

Content Item Not Found

" + append page "The requested item is not available for viewing. " + append page "The item is either not available on this server or it is not in a publishable state " + append page "Unpublished items can be viewed via the CMS interface if the CMS package is installed.
" + append page "[ad_footer]" + doc_return 200 text/html $page +} + Index: openacs-4/packages/xcms-ui/www/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/master.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/master.adp 1 May 2004 12:09:17 -0000 1.1 @@ -0,0 +1,6 @@ + +@context;noquote@ +@title@ +@subnavbar_link;noquote@ + + Index: openacs-4/packages/xcms-ui/www/master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/master.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/master.tcl 1 May 2004 12:09:17 -0000 1.1 @@ -0,0 +1,15 @@ +# + +set bcms_package_id [site_node::get_children -package_key "bcms-ui-base" -element "package_id" -node_id [ad_conn node_id]] +set subnavbar_link "Manage Content" + +set context [bcms::widget::item_context -item_id $::content::item_id -root_id $::content::root_folder_id] +if {[llength $context] > 1} { + set last_page [lindex $context end] + set last_page [lindex $last_page end] + + set context [lrange $context 1 [expr [llength $context] -2]] + lappend context $last_page +} else { + set context "" +} Index: openacs-4/packages/xcms-ui/www/admin/create-folder.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/create-folder.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/create-folder.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,5 @@ + +@title@ +@context@ + + Index: openacs-4/packages/xcms-ui/www/admin/create-folder.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/create-folder.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/create-folder.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,9 @@ +ad_page_contract { + create a subfolder +} { + parent_id:notnull,integer + return_url:notnull +} + +set title "Create Sub-Folder" +set context [list [list $return_url "Set Folder"] $title] Index: openacs-4/packages/xcms-ui/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/index.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,18 @@ + + +

Configure this BCMS UI instance

+ + + + + + + + Index: openacs-4/packages/xcms-ui/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/index.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,15 @@ +array set subsite_sn [site_node::get_from_object_id -object_id [ad_conn subsite_id]] +set subsite_id [ad_conn subsite_id] +set subsite_url $subsite_sn(url) + +set subsite_name $subsite_sn(instance_name) + +set subsite_admin_p [permission::permission_p \ + -party_id [ad_conn user_id] \ + -object_id [ad_conn subsite_id] \ + -privilege "admin"] + +set package_url [ad_conn package_url] +set package_name [ad_conn instance_name] + +set template_root "[acs_root_dir]templates${subsite_sn(url)}" Index: openacs-4/packages/xcms-ui/www/admin/set-parameter.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/set-parameter.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/set-parameter.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,12 @@ +ad_page_contract { + sets the package parameter based from the name and value +} { + parameter_name:notnull + value:notnull + return_url:notnull +} + +parameter::set_value -parameter $parameter_name -value $value + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/xcms-ui/www/admin/set-root-folder.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/set-root-folder.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/set-root-folder.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,36 @@ + +@title@ +@context@ + + + + + + + + + + + + + + + + +
Path
+ @folders.path@ + + make this folder your root folder + + create a subfolder + + current root folder + + create a subfolder +
+ + +
+ Register New Content Type: +
+
Index: openacs-4/packages/xcms-ui/www/admin/set-template-folder.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/set-template-folder.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/set-template-folder.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,30 @@ + +@title@ +@context@ + + + + + + + + + + + + + + + + +
Path
+ @folders.path@ + + make this folder your template folder + + create a subfolder + + current template folder + + create a subfolder +
Index: openacs-4/packages/xcms-ui/www/admin/set-template-folder.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/set-template-folder.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/set-template-folder.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,14 @@ +ad_page_contract { + this page is set the root_folder_id and template_folder_id of this package instance + TODO revisit this page to make sure its able to handle multi level folders +} { +} + +bcms::folder::tree_folders -parent_id [bcms::template::get_cr_root_template_folder] -multirow_name folders -include_parent + +set current_template_folder_id [parameter::get -parameter template_folder_id] + +set current_url [ad_return_url -urlencode] + +set title "Set Folder" +set context [list $title] Index: openacs-4/packages/xcms-ui/www/admin/setup.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/setup.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/setup.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1 @@ +Done Index: openacs-4/packages/xcms-ui/www/admin/setup.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/admin/setup.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/admin/setup.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,130 @@ +ad_page_contract { + + setup folders and templates + +} -query { + + {type "package"} + +} + +set user_id [ad_conn user_id] +set this_package_id [ad_conn package_id] +set subsite_id [ad_conn subsite_id] + +# if type of subsite is requested make sure we have pemission to +# admin the subsite + +if {[string equal "subsite" $type]} { + permission::require_permission \ + -object_id $subsite_id \ + -party_id $user_id \ + -privilege "admin" + + # if we are setting up the subsite, use that package_id + + set package_id $subsite_id + +} else { + + set package_id $this_package_id +} + +array set sn [site_node::get_from_object_id -object_id $package_id] + +# see if there is a folder for this subsite + +if {[string equal $sn(node_id) [site_node::get_node_id -url "/"]]} { + set folder_id "-100" + set template_folder_id "-200" +} else { + set folder_id [bcms::folder::get_id_by_package_id -package_id $package_id] + + # create a new folder for this package_id + set folder_id [bcms::folder::create_folder \ + -name "pages-${package_id}" \ + -folder_label "Pages" \ + -parent_id "0" \ + -description "Content Managed Pages" \ + -package_id $package_id \ + -context_id $this_package_id \ + -content_types "content_revision content_folder content_extlink content_symlink image" \ + -subtypes + ] + + # Main Subsite folder -100 already has a corresponding template + # folder. If we are not setting up for folder_id -100 create + # a template folder also + set template_folder_id [bcms::folder::create_folder \ + -name "templates-${package_id}" \ + -folder_label "Templates" \ + -parent_id "0" \ + -description "Content Templates" \ + -package_id $package_id \ + -context_id $this_package_id \ + -content_types "content_template" \ + -subtypes + ] +} + +# load in default templates + +set template_root "/templates${sn(url)}" +set template_dir "[acs_root_dir]${template_root}" +set www_dir "[acs_root_dir]/www${sn(url)}" + +if {![file exists $template_dir]} { + file mkdir $template_dir +} + +if {![file exists $www_dir]} { + file mkdir $www_dir +} + +set templates [list bcms-default content_revision "Default Content Template" bcms-folder-default content_folder "Default Folder Template"] +set template_base "[acs_root_dir]/packages/bcms-ui-base/lib/" +foreach {filename content_type title } $templates { + + set template_id [bcms::template::create_template \ + -template_name $filename \ + -parent_id $template_folder_id] + + set fd [open "${template_base}$filename.adp"] + set content [read $fd] + close $fd + + bcms::template::register_template \ + -template_id $template_id \ + -content_type $content_type \ + -context "public" \ + -is_default_p "t" + + bcms::template::add_template \ + -template_id $template_id \ + -title $title \ + -content $content + + file copy -force "${template_base}${filename}.adp" "${template_base}${filename}.tcl" $template_dir + +} + +# set parameters + +parameter::set_value -parameter "root_folder_id" -value $folder_id +parameter::set_value -parameter "template_folder_id" -value $template_folder_id +parameter::set_value -parameter "TemplateRoot" -value $template_root + +# get default index.vuh file +# substitute default folder ids + +set fd [open "${template_base}index.vuh"] +set index_content [read $fd] +close $fd + +set index_content [regsub -- {-100} $index_content $folder_id] +set index_content [regsub -- {-200} $index_content $template_folder_id] + +set fd [open "${www_dir}index.vuh" w] +puts $fd $index_content +close $fd + Index: openacs-4/packages/xcms-ui/www/manage/add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/add.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,2 @@ + + Index: openacs-4/packages/xcms-ui/www/manage/add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/add.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,9 @@ +ad_page_contract { + +} -query { + parent_id:integer + item_type + return_url +} + +ad_return_template Index: openacs-4/packages/xcms-ui/www/manage/apply-template.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/apply-template.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/apply-template.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,13 @@ + +@title;noquote@ +@context;noquote@ + +Current Template: +@current_template.title@ + Unregister Template Cancel + + + none + + + Index: openacs-4/packages/xcms-ui/www/manage/apply-template.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/apply-template.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/apply-template.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,46 @@ +ad_page_contract { + apply a template to an item +} { + item_id:notnull,naturalnum + template_id:optional,naturalnum + return_url:notnull +} + +set package_url [ad_conn package_url] +set current_url [ad_return_url -urlencode] + +if {[info exists template_id]} { + + bcms::template::apply_template -item_id $item_id -template_id $template_id -context public + ad_returnredirect $return_url + ad_script_abort + +} else { + + template::list::create \ + -name template_list \ + -pass_properties { item_id return_url } \ + -multirow template_list \ + -key item_id \ + -elements { + title { + label "Title" + link_url_eval {[bcms_ui_base::apply_template_url -item_id $item_id -template_id $template_id -return_url $return_url]} + } + description { + label "Description" + } + } + bcms::template::list_templates -parent_id [parameter::get -parameter template_folder_id] -multirow_name template_list -revision live + + + set title "Apply Template" + set context_help "" + + array set current_template [bcms::template::get_template -item_id $item_id -context public] + if {[array size current_template] > 0 && ![string equal $current_template(name) default_template]} { + array set current_template [bcms::item::get_item -item_id $current_template(item_id) -revision live] + } + + set context "Change Template" +} Index: openacs-4/packages/xcms-ui/www/manage/categorize-item.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/categorize-item.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/categorize-item.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,8 @@ + +@title@ +@return_url@ +@context@ +
+@title@ + +
Index: openacs-4/packages/xcms-ui/www/manage/categorize-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/categorize-item.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/categorize-item.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,42 @@ +ad_page_contract { + set the categeries of a particular item +} { + item_id:naturalnum,notnull + return_url:notnull + category_id:naturalnum,multiple,optional +} + +set context "Categorize Item" +if {[info exists category_id]} { + # process the category assignments + + bcms::item::clear_categories -item_id $item_id + foreach category $category_id { + bcms::item::assign_category -item_id $item_id -category_id $category + } + ad_returnredirect $return_url + ad_script_abort + +} else { + # display the form to select the categories + array set item [bcms::item::get_item -item_id $item_id] + set folder_id $item(parent_id) + set parent_id [lindex [bcms::item::get_categories -item_id $folder_id] 0] +ns_log notice "DAVEB categorize-item folder_id $folder_id parent_id $parent_id" + set option_list [bcms::widget::extract_values -list_of_ns_sets \ + [bcms::category::tree_categories -parent_id $parent_id -return_list] \ + -keys_to_extract {path category_id}] + + set category_list [bcms::item::get_categories -item_id $item_id] + + template::form::create simpleform + template::element::create simpleform category_id -widget multiselect \ + -datatype integer -label "Categories" -options $option_list -values $category_list + template::element::create simpleform return_url -widget hidden -datatype text -value $return_url + template::element::create simpleform item_id -widget hidden -datatype integer -value $item_id + template::element::create simpleform folder_id -widget hidden -datatype integer -value $folder_id + + + set title "Set Category" + +} Index: openacs-4/packages/xcms-ui/www/manage/delete-item.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/delete-item.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/delete-item.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,6 @@ + +@title@ +@return_url@ +context + + Index: openacs-4/packages/xcms-ui/www/manage/delete-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/delete-item.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/delete-item.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,63 @@ +ad_page_contract { + delete items +} { + item_id:notnull + {confirm_p:optional,boolean 0} + return_url:notnull +} + + + template::list::create \ + -name delete_list \ + -multirow delete_list \ + -key item_id \ + -elements { + title { + label "Item" + } + can_delete { + label "Can be deleted" + } + } + + set item_ids [join $item_id ", "] + db_multirow delete_list get_to_be_deleted " + select i.item_id, + i.name, + i.live_revision, + i.latest_revision, + i.publish_status, + i.content_type, + i.storage_type, + i.tree_sortkey, + case when i.content_type = 'content_folder' then content_folder__get_label(i.item_id) else bcms__get_title(i.item_id, 'latest') end as title, + case when i.content_type = 'content_folder' then content_folder__is_empty(i.item_id) else true end as can_delete + from cr_items i + where + i.item_id in ($item_ids)" + + ad_form -name delete_confirm -cancel_url $return_url -form { + {notice:text(inform) {label ""} {value "The listed items will be deleted."}} + {item_id:text(hidden) {value $item_id}} + {return_url:text(hidden) {value $return_url}} + } -on_submit { + set item_id [split $item_id] + db_transaction { + foreach one_item $item_id { + array set item [bcms::item::get_item -item_id $one_item] + if {[string equal $item(content_type) "content_folder"]} { + bcms::folder::delete_folder -folder_id $one_item + } else { + bcms::item::delete_item -item_id $one_item + } + } + } + ad_returnredirect $return_url + ad_script_abort +} + + +set confirm_link [bcms_ui_base::delete_url -items_to_delete $item_id -return_url $return_url -confirm] + + set title "Delete" + Index: openacs-4/packages/xcms-ui/www/manage/file-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/file-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/file-add.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,8 @@ + +@title@ +@return_url@ +context +
+@title@ + +
Index: openacs-4/packages/xcms-ui/www/manage/file-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/file-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/file-add.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,9 @@ +ad_page_contract { + create a file +} { + parent_id:notnull,integer + return_url:notnull +} + + +set title "Add File" Index: openacs-4/packages/xcms-ui/www/manage/file-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/file-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/file-view.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,16 @@ + +@title@ +@context@ +@context_action@ +@context_help@ +1 + +
+@title@ + +
+ +Download + + + Index: openacs-4/packages/xcms-ui/www/manage/file-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/file-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/file-view.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,53 @@ +ad_page_contract { + view a file revision, if no revision_id is passed then latest revision is used +} { + {revision_id:optional,naturalnum $current_item(latest_revision)} + {preview_p:optional 0} + {return_url:optional [ad_return_url]} +} + +set package_url [ad_conn package_url] + +# if we are previewing lets serve the file +if {$preview_p} { + cr_write_content -revision_id $revision_id + ad_script_abort +} + +array set file_revision [bcms::revision::get_revision -revision_id $revision_id] + +# we will only allow edits on the latest version, else you can only view them +if {$revision_id == $file_revision(latest_revision)} { + + set context_action "" + if {[empty_string_p $current_item(live_revision)]} { + append context_action [bcms::ui::base::context_action_link -context_action revision-publish \ + -export_vars [export_vars {revision_id return_url}]] + } else { + append context_action [bcms::ui::base::context_action_link -context_action revision-unpublish \ + -export_vars [export_vars {{revision_id $current_item(live_revision)} return_url}]] + } + append context_action [bcms::ui::base::context_action_link -context_action categorize-item \ + -export_vars [export_vars {{item_id $current_item(item_id)} {folder_id $current_item(parent_id)} return_url}]] + append context_action [bcms::ui::base::context_action_link -context_action revision-list \ + -export_vars [export_vars {{item_id $current_item(item_id)} return_url}]] + + set context_help "You can edit this file, etc." + + set title "View file" + set context [bcms::widget::item_context -item_id $current_item(item_id) -root_id $root_id] + set context [lrange $context 0 [expr [llength $context] - 2]] + lappend context "$file_revision(title)" + +} else { + set context_action [bcms::ui::base::context_action_link -context_action revision-list \ + -export_vars [export_vars {{item_id $current_item(item_id)} return_url}]] + + set context_help "This is a version of a file. You can only view this file" + + set title "View File Version" + set context [bcms::widget::item_context -item_id $current_item(item_id) -root_id $root_id] + lappend context "version $revision_id" + +} + Index: openacs-4/packages/xcms-ui/www/manage/folder-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/folder-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/folder-add.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,9 @@ + +@title@ +@context_help@ +@return_url@ +@context@ +
+@title@ + +
Index: openacs-4/packages/xcms-ui/www/manage/folder-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/folder-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/folder-add.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + create a subfolder +} { + parent_id:notnull,integer + return_url:notnull +} + +set title "Add Folder" +set context_help "Enter the folder name which will be part of the url. And the folder label" + +set context "Add Folder" Index: openacs-4/packages/xcms-ui/www/manage/folder-set-category.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/folder-set-category.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/folder-set-category.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,22 @@ + +@title@ +@return_url@ +context + +
+ Assigned Root Category +
+
+ +
@category.heading@
+
+
+ +
@category.description@
+
+
+
+
+ + + Index: openacs-4/packages/xcms-ui/www/manage/folder-set-category.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/folder-set-category.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/folder-set-category.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,56 @@ +ad_page_contract { + set the root category to be used by this folder's content +} { + folder_id:integer,notnull + category_id:naturalnum,optional + return_url:notnull +} + +if {[info exists category_id]} { + # we need to assign the root category_id to this folder_id + bcms::item::assign_category -item_id $folder_id -category_id $category_id +} + +set categories [bcms::item::get_categories -item_id $folder_id] +if {[llength $categories] > 0} { + # if its already assigned a category, display it only + set category_id [lindex $categories 0] + array set category [bcms::category::get_category -category_id $category_id] + + # there is a bug listtemplate seems not to obey if, we will create + # a blank list template + # TODO fix this bug + template::list::create \ + -name category_list \ + -multirow category_list \ + -elements {} + +} else { + # we need to display the root categories + + set package_url [ad_conn package_url] + set return_url_encoded [ad_urlencode $return_url] + + bcms::category::list_categories -multirow_name category_list + + template::list::create \ + -pass_properties { folder_id return_url_encoded package_url } \ + -name category_list \ + -multirow category_list \ + -key category_id \ + -elements { + category_id { + label "Root Category" + display_col heading + link_url_eval "${package_url}manage/folder-set-category?folder_id=$folder_id&category_id=$category_id&return_url=$return_url_encoded" + } + description { + label "Description" + } + } + +} + + + +set title "Assign Root Category" Index: openacs-4/packages/xcms-ui/www/manage/folder-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/folder-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/folder-view.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,17 @@ + +@title@ +@context;noquote@ +@context_action;noquote@ +@context_help;noquote@ +1 +
+Folder Properties + + +
+ +
+Folder Contents + + +
Index: openacs-4/packages/xcms-ui/www/manage/folder-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/folder-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/folder-view.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,163 @@ +ad_page_contract { + lists the items under a folder. we need to use different queries on template and content manage_type +} { + item + {orderby:optional} + {page:optional} + {return_url "[ad_conn url]"} +} +if {![regexp {/$} [ad_conn url]]} { + ad_returnredirect "[ad_conn url]/" + ad_script_abort +} + +set root_id [parameter::get -parameter root_folder_id -default "-100"] +array set current_item $item +set folder_id $current_item(item_id) +array set folder [bcms::folder::get_folder -folder_id $folder_id] +set package_url [ad_conn package_url] + +#set type_options [bcms::folder::content_types_select -folder_id $folder_id] + +set type_options { {Page page-add} {Folder folder-add} {Image image-add} } + +ad_form -name add-item -export {return_url} -form { + {submit:text(submit) {label "Add New"} {value "Add New"}} + {item_type:text(select) {label ""} {options $type_options } } + {parent_id:text(hidden) {value $folder_id}} +} -on_submit { + ad_returnredirect "[ad_conn package_url]manage/${item_type}?[export_vars {{parent_id $folder_id} return_url}]" +} + + template::list::create \ + -name item_list \ + -multirow item_list \ + -pass_properties { package_url } \ + -key item_id \ + -actions [list \ + "Set Folder Category" "/categories/cadmin/one-object?[export_vars {{object_id $folder_id} return_url}]" "Set the root category for the currently displayed folder" \ + "Change Template" "${url_base}apply-template?[export_vars { {item_id $folder_id} return_url}]" "Change the template used to display this item."] \ + ] \ + -bulk_actions [list \ + "Delete" "${package_url}manage/delete-item" "Delete checked items" \ + "Move" "${package_url}manage/move-item" "Move checked items" \ + ]\ + -bulk_action_export_vars { + return_url + } \ + -elements { + name { + label "Name" + link_url_col name + } + title { + label "Title" + } + content_type { + label "Type" + display_template { + + + + + + + + + + + + + + + + + + + + + + + + + + + } + html { style "width:70px" } + } + last_modified_pretty { + label "Last Modified" + html { style "width:180px" } + } + publish_status { + label "Status" + } + } \ + -orderby { + default_value name,asc + name { + orderby name + } + title { + orderby title + } + content_type { + orderby content_type + } + last_modified { + orderby last_modified + } + } \ + -page_size 10 \ + -page_groupsize 10 \ + -page_query { + select i.item_id, + i.name, + i.live_revision, + i.latest_revision, + i.publish_status, + i.content_type, + i.storage_type, + i.tree_sortkey, + last_modified, + r.title, + r.description + from cr_items i, cr_revisionsx r + where + i.parent_id = $current_item(item_id) + and i.latest_revision = r.revision_id + union + + select i.item_id, + i.name, + i.live_revision, + i.latest_revision, + i.publish_status, + i.content_type, + i.storage_type, + i.tree_sortkey, + null as last_modified, + f.label as title, + f.description + from cr_items i, cr_folders f + where + i.parent_id = $current_item(item_id) + and i.item_id = f.folder_id + [template::list::orderby_clause -orderby -name item_list] + } \ + -page_flush_p 1 + + + bcms::item::list_items -parent_id $folder_id -multirow_name item_list -orderby [template::list::orderby_clause -name item_list] -show_only [template::list::page_get_ids -name item_list] + +set context_action "" +# this can be used to show help text on the page +set context_help "" + +set title "View Folder" + +set context [bcms::widget::item_context -item_id $folder_id -root_id $root_id -root_url [ad_conn package_url]manage/ ] + +set context [lrange $context 0 [expr [llength $context] - 2]] + +lappend context $folder(label) Index: openacs-4/packages/xcms-ui/www/manage/image-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/image-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/image-add.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,7 @@ + +@title@ +@context@ +
+@title@ + +
Index: openacs-4/packages/xcms-ui/www/manage/image-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/image-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/image-add.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,10 @@ +ad_page_contract { + create a image +} { + parent_id:notnull,integer + return_url:notnull +} + + +set title "Add Image" +set context "Add Image" \ No newline at end of file Index: openacs-4/packages/xcms-ui/www/manage/image-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/image-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/image-view.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,27 @@ + +@title@ +@context@ +@context_help@ + + +
+

+ +@actions.label@ + +

+
+ + +
+@title@ + +
+ +

+ +

+
+ + + Index: openacs-4/packages/xcms-ui/www/manage/image-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/image-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/image-view.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,64 @@ +ad_page_contract { + view a image revision, if no revision_id is passed then latest revision is used +} { + item + {revision_id:optional,naturalnum} + {preview_p:optional ""} + {return_url "[ad_conn url]"} +} + + +set package_url [ad_conn package_url] +array set current_item $item +set item_id $current_item(item_id) +if {![exists_and_not_null revision_id]} { + set revision_id [item::get_best_revision $item_id] +} +# if we are previewing lets serve the file +if {[string equal $preview_p "t"]} { + cr_write_content -revision_id $revision_id + ad_script_abort +} +set root_id [parameter::get -parameter root_folder_id] +array set image_revision [bcms::revision::get_revision -revision_id $revision_id] + +# we will only allow edits on the latest version, else you can only view them +if {$revision_id == $image_revision(latest_revision)} { + +set url_base "[ad_conn package_url]manage/" +template::multirow create actions url label title +if {![string equal "live" $current_item(publish_status)]} { + template::multirow append actions "${url_base}item-publish?[export_vars {item_id return_url}]" "Publish Item" "Publish the latest revision of this item" +} { + template::multirow append actions "${url_base}item-unpublish?[export_vars {item_id return_url}]" "Unpublish Item" "Publish the latest revision of this item" + + +} + +template::multirow append actions "${url_base}categorize-item?[export_vars {item_id return_url}]" "Categorize Item" "Set the categories assigned to this item" + + +template::multirow append actions "${url_base}delete-item?[export_vars {item_id return_url}]" "Delete" "Delete this item." + + + + +set context_help "You can edit this image, etc." + + set title "View image" + set context [bcms::widget::item_context -item_id $current_item(item_id) -root_id $root_id] + set context [lrange $context 0 [expr [llength $context] - 2]] + lappend context "$image_revision(title)" + +} else { + set context_action [bcms_ui_base::context_action_link -context_action revision-list \ + -export_vars [export_vars {{item_id $current_item(item_id)} return_url}]] + + set context_help "This is a version of a image. You can only view this image" + + set title "View Image Version" + set context [bcms::widget::item_context -item_id $current_item(item_id) -root_id $root_id] + lappend context "version $revision_id" + +} + Index: openacs-4/packages/xcms-ui/www/manage/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/index-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/index-postgresql.xql 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,15 @@ + + + + postgresql7.1 + + + + + select content_template__get_root_folder() + + + + + + Index: openacs-4/packages/xcms-ui/www/manage/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/index.vuh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/index.vuh 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,61 @@ +################## KLUDGE BY STAS ############### +# Try and look up the item in the content repository +################################################# +ad_page_contract { + + @author Unknown + @creation-date Unknown + @cvs-id $Id: index.vuh,v 1.1 2004/05/01 12:09:18 daveb Exp $ +} { + { revision_id "" } +} + +# Get the paths +#set the_root [ns_info pageroot] +set the_url "/[ad_conn path_info]" + +# Ugly hack to workaround the fact that a URL on index will match +# index.vuh, causing path_info to be empty + + +if {[string equal "index" [lindex [ad_conn urlv] end]] && ![string match "*index" $the_url]} { + append the_url "index" +} + +ns_log notice "DAVEB url [ad_conn url] path_info [ad_conn path_info] the_url $the_url" +# Get the IDs + +set content_root [parameter::get -parameter root_folder_id -default "-100"] +namespace eval content { + variable root_folder_id + set root_folder_id "" +} +set ::content::root_folder_id $content_root +ns_log notice "DAVEB content_root $content_root" + +array set item [bcms::item::get_item_by_url -root_id $content_root \ + -url $the_url \ + ] + +if {[array size item] == 0} { + ns_returnnotfound +} +rp_form_put item [array get item] +switch -- $item(content_type) { + + content_folder { + rp_internal_redirect "folder-view" + } + image { + rp_internal_redirect "image-view" + } + default { # content_revision + + rp_internal_redirect "item-view" + } + + + +} + + Index: openacs-4/packages/xcms-ui/www/manage/item-publish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/item-publish.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/item-publish.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,27 @@ +ad_page_contract { + Set live_revision, publish_status, publish_date + for a cr_item +} -query { + item_id:integer,notnull + return_url:notnull + {revision_id:integer,optional} +} -properties { + + +} + +set user_id [ad_conn user_id] + +permission::require_permission \ + -object_id $item_id \ + -party_id $user_id \ + -privilege "admin" + +if {![exists_and_not_null revision_id]} { + set revision_id [item::get_best_revision $item_id] +} + +item::publish -item_id $item_id -revision_id $revision_id + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/xcms-ui/www/manage/item-unpublish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/item-unpublish.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/item-unpublish.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,23 @@ +ad_page_contract { + Set live_revision, publish_status, publish_date + for a cr_item +} -query { + item_id:integer,notnull + return_url:notnull +} -properties { + + +} + +set user_id [ad_conn user_id] + +permission::require_permission \ + -object_id $item_id \ + -party_id $user_id \ + -privilege "admin" +set revision_id [item::get_best_revision $item_id] + +item::unpublish -item_id $item_id + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/xcms-ui/www/manage/item-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/item-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/item-view.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,22 @@ + +@title@ +@context@ + + + + + +
+@title@ + + +
+
+Additional Properties + +
+ Index: openacs-4/packages/xcms-ui/www/manage/item-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/item-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/item-view.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,54 @@ +ad_page_contract { + view a page revision, if no revision_id is passed then latest revision is used +} { + item + {object_id ""} + {revision_id ""} + {return_url:optional [ad_return_url]} +} + +array set content $item +set item_id $content(item_id) +if {[empty_string_p $revision_id]} { + if {![empty_string_p $content(live_revision)]} { + set revision_id $content(live_revision) + } elseif {![empty_string_p $content(latest_revision)]} { + set revision_id $content(latest_revision) + } else { + ns_returnnotfound + } +} + +set return_url [ad_conn url] +set package_url [ad_conn package_url] + + set context_help "You can edit this page, etc." + + set title "View Page" + if {![string equal $revision_id $content(live_revision)]} { + append title " -- Revision $revision_id" + } + + set context [bcms::widget::item_context -item_id $item_id -root_id $::content::root_folder_id -root_url [ad_conn package_url]manage/] +set page_title [lindex [lindex $context end] end ] + set context [lrange $context 0 [expr [llength $context] - 2]] + lappend context "View Page: $page_title" + + +set url_base "[ad_conn package_url]/manage/" + +template::multirow create actions url label title + +template::multirow append actions "${url_base}apply-template?[export_vars {item_id return_url}]" "Change Template" "Change the template used to display this item." +#template::multirow append actions "${url_base}categorize-item?[export_vars {item_id return_url}]" "Categorize Item" "Set the categories assigned to this item" + +if {![string equal "live" $content(publish_status)]} { + template::multirow append actions "${url_base}item-publish?[export_vars {item_id return_url}]" "Publish Item" "Publish this item." +} else { + template::multirow append actions "${url_base}item-unpublish?[export_vars {item_id return_url}]" "Unpublish Item" "Unpublish this item." +} +template::multirow append actions "${url_base}delete-item?[export_vars {item_id {return_url $package_url}}]" "Delete" "Delete this item." + + + + Index: openacs-4/packages/xcms-ui/www/manage/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/master.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/master.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,29 @@ + +@context;noquote@ +@title@ +
+ +
+ +
+ @context_action;noquote@ +
+
+
+ +

@context_help;noquote@

+
+ +

no help available

+
+
+
+ +
+ +
+ +
+ + + Index: openacs-4/packages/xcms-ui/www/manage/master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/master.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/master.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,8 @@ +set package_url [ad_conn package_url] +set current_url [ad_return_url] + +#if {[info exists context]} { +# set context_bar [ad_context_bar_html $context] +#} else { +# set context_bar [ad_context_bar] +#} Index: openacs-4/packages/xcms-ui/www/manage/move-item.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/move-item.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/move-item.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,6 @@ + +@title@ +@return_url@ +context +

Move item to:

+ Index: openacs-4/packages/xcms-ui/www/manage/move-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/move-item.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/move-item.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,40 @@ +ad_page_contract { + moves item_id to folder_id +} { + item_id:notnull,naturalnum,multiple + folder_id:optional,integer + return_url:notnull + {redirect_to_folder:optional,boolean 0} +} + +# we already have a destination folder, that means move the items +# otherwise list the folders +if {[info exists folder_id]} { + + foreach one_item $item_id { + bcms::item::set_item -item_id $one_item -parent_id $folder_id + } + + ad_returnredirect $return_url + ad_script_abort + +} else { + + template::list::create \ + -name folder_tree \ + -pass_properties { item_id redirect_to_folder return_url } \ + -multirow folder_tree \ + -key folder_id \ + -elements { + label { + label "Folder" + link_url_eval {[bcms_ui_base::move_url -items_to_move "$item_id" -destination_folder $folder_id -redirect_to_folder $redirect_to_folder -return_url $return_url]} + display_template {
@folder_tree.label@
} + } + } + + bcms::folder::tree_folders -parent_id [bcms::folder::get_bcms_root_folder] -prepend_path [ad_conn package_url] -multirow_name folder_tree + + set title "Move" + +} Index: openacs-4/packages/xcms-ui/www/manage/page-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/page-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/page-add.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,9 @@ + +@title@ +@context_help@ +@return_url@ +context +
+@title@ + +
Index: openacs-4/packages/xcms-ui/www/manage/page-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/page-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/page-add.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,10 @@ +ad_page_contract { + create a page +} { + parent_id:notnull,integer + return_url:notnull +} + + +set title "Add Page" +set context_help "You may add a new page, by putting... etc." Index: openacs-4/packages/xcms-ui/www/manage/page-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/page-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/page-view.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,11 @@ + +@title@ +@context@ + +
+@title@ + + +
+ + Index: openacs-4/packages/xcms-ui/www/manage/page-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/page-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/page-view.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,34 @@ +ad_page_contract { + view a page revision, if no revision_id is passed then latest revision is used +} { + {revision_id:optional,naturalnum $content(latest_revision)} + {return_url:optional [ad_return_url]} +} + +set package_url [ad_conn package_url] + +array set page_revision [bcms::revision::get_revision -revision_id $revision_id] + +# we will only allow edits on the latest version, else you can only view them +if {$revision_id == $page_revision(latest_revision)} { + + + + set context_help "You can edit this page, etc." + + set title "View Page" + set context [bcms::widget::item_context -item_id $current_item(item_id) -root_id $root_id] + set context [lrange $context 0 [expr [llength $context] - 2]] + lappend context "$page_revision(title)" + +} else { + + + set context_help "This is a version of a page. You can only view this page" + + set title "View Page Version" + set context [bcms::widget::item_context -item_id $current_item(item_id) -root_id $root_id] + lappend context "version $revision_id" + +} + Index: openacs-4/packages/xcms-ui/www/manage/relate-item.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/relate-item.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/relate-item.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,10 @@ + +@title@ +@return_url@ + + + + + Index: openacs-4/packages/xcms-ui/www/manage/relate-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/relate-item.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/relate-item.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,52 @@ +ad_page_contract { + relate item_id_one with one or more content item +} { + item_id_one:notnull + item_id:optional,multiple + return_url:notnull + {name_search:optional ""} + {title_search:optional ""} + {content_search:optional ""} + {display_search_results:optional 0} + {orderby:optional name,asc} + {page:optional 1} + {content_type_search:notnull} + {relation_type:notnull} +} + +if {[info exists item_id]} { + foreach related_object_id $item_id { + bcms::item::relate_item -relation_type $relation_type -item_id $item_id_one -related_object_id $related_object_id + } + + ad_returnredirect $return_url + ad_script_abort +} + +set package_url [ad_conn package_url] +set bulk_actions [list "Relate" "${package_url}manage/relate-item" "Relate checked items"] +set bulk_action_export_vars {item_id_one return_url content_type_search relation_type} + +template::list::create \ + -name related_items \ + -multirow related_items \ + -key rel_id \ + -pass_properties { package_url } \ + -bulk_actions [list "Unrelate" "${package_url}manage/unrelate-item" "Unrelate checked items"] \ + -bulk_action_export_vars { + return_url + } \ + -elements { + name { + label "Name" + } + title { + label "Title" + } + } + + +bcms::item::list_related_items -item_id $item_id_one -relation_tag $relation_type -multirow_name related_items -revision latest + + +set title "Relate Content" Index: openacs-4/packages/xcms-ui/www/manage/revision-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/revision-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/revision-add.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,19 @@ +ad_page_contract { + add a revision, copy from the latest one +} { + item_id:notnull,naturalnum + return_url:notnull +} + +array set item [bcms::item::get_item -item_id $item_id] + +if {[array size item] > 0} { + bcms::revision::copy_revision -revision_id $item(latest_revision) +} else { + error "item does not exist" +} + +ad_returnredirect $return_url +ad_script_abort + + Index: openacs-4/packages/xcms-ui/www/manage/revision-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/revision-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/revision-list.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,3 @@ + + + Index: openacs-4/packages/xcms-ui/www/manage/revision-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/revision-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/revision-list.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,30 @@ +ad_page_contract { + list the revision of a item +} { +} + +set package_url [ad_conn package_url] +set url_base "${package_url}manage/" +set current_url [ad_conn url] +set return_url [ad_conn url] +template::list::create \ + -name revision_list \ + -multirow revision_list \ + -key revision_id \ + -elements { + creation_date {label "Date"} + last_name { + label "Author" + display_template {@revision_list.first_names@ @revision_list.last_name@} + } + live_revision_id { + label "Status" + display_template {published} + } + revision_id { + display_template {View Publish Revision} + } + + } + +bcms::revision::list_revisions -item_id $item_id -multirow_name revision_list Index: openacs-4/packages/xcms-ui/www/manage/revision-publish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/revision-publish.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/revision-publish.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,20 @@ +ad_page_contract { + publish this revision +} { + revision_id:notnull,naturalnum + return_url:notnull +} + +array set revision [bcms::revision::get_revision -revision_id $revision_id] + +if {[array size revision] > 0} { + # publish it if the revision is not live, otherwise its has already been published + if {$revision(live_revision) != $revision_id} { + bcms::revision::set_revision_status -revision_id $revision_id -status live + } +} else { + error "revision does not exist" +} + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/xcms-ui/www/manage/revision-unpublish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/revision-unpublish.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/revision-unpublish.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + unpublish this revision +} { + revision_id:notnull,naturalnum + return_url:notnull +} + +bcms::revision::set_revision_status -revision_id $revision_id -status production + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/xcms-ui/www/manage/search-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/search-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/search-view.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,7 @@ + +@title@ +@context@ + + + Index: openacs-4/packages/xcms-ui/www/manage/search-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/search-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/search-view.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,27 @@ +ad_page_contract { + display search results +} { + {display_search_results:optional 0} + {name_search:optional ""} + {title_search:optional ""} + {content_search:optional ""} + {orderby:optional name,asc} + {page:optional 1} +} + +if {$display_search_results} { + set title "Search Results" +} else { + set title "Search Form" +} + +set package_url [ad_conn package_url] +set context [list [list $package_url "Search"] $title] + +# check the permission if user has permission for the package +if {![permission::permission_p -object_id [ad_conn package_id] -privilege admin]} { + ad_return_forbidden "Serurity Violation" "You don't have permission to administer. This incident has been logged." + ad_script_abort +} + + Index: openacs-4/packages/xcms-ui/www/manage/symlink-item.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/symlink-item.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/symlink-item.adp 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,6 @@ + +@title@ +@return_url@ +context +

Create link in

+ Index: openacs-4/packages/xcms-ui/www/manage/symlink-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/symlink-item.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/symlink-item.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,43 @@ +ad_page_contract { + moves item_id to folder_id +} { + item_id:notnull,naturalnum + folder_id:optional,integer + {return_url:optional "[ad_return_url]"} +} + +# we already have a destination folder, that means move the items +# otherwise list the folders +if {[info exists folder_id]} { + array set item [bcms::item::get_item -item_id $item_id] + set link_item_id [bcms::item::create_link \ + -target_id $item_id \ + -parent_id $folder_id \ + -name $item(name) \ + -label $item(name)] + + set return_url "./[bcms::item::get_url -item_id $link_item_id] -root_id [parameter::get -parameter root_folder_id]]" + + ad_returnredirect $return_url + ad_script_abort + +} else { + + template::list::create \ + -name folder_tree \ + -pass_properties { item_id redirect_to_folder return_url } \ + -multirow folder_tree \ + -key folder_id \ + -elements { + label { + label "Folder" + link_url_eval {[set link_url "./symlink-item?[export_vars {folder_id item_id}]"]} + display_template {
@folder_tree.label@
} + } + } + + bcms::folder::tree_folders -parent_id [bcms::folder::get_bcms_root_folder] -prepend_path [ad_conn package_url] -multirow_name folder_tree + + set title "Create Link to Exising Page " + +} Index: openacs-4/packages/xcms-ui/www/manage/unregister-template.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/unregister-template.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/unregister-template.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,13 @@ +ad_page_contract { + unregister a template from a content item +} { + item_id:notnull,naturalnum + template_id:notnull,naturalnum + context:notnull + return_url:notnull +} + +bcms::template::unregister_template -item_id $item_id -template_id $template_id -context $context + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/xcms-ui/www/manage/unrelate-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/manage/unrelate-item.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/manage/unrelate-item.tcl 1 May 2004 12:09:18 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + remove a relation of an item +} { + rel_id:naturalnum,notnull + return_url:notnull +} + +bcms::item::unrelate_item -rel_id $rel_id + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/xcms-ui/www/resources/apply-template.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/apply-template.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/arrow-down.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/arrow-down.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/arrow-first.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/arrow-first.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/arrow-last.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/arrow-last.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/arrow-left.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/arrow-left.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/arrow-right.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/arrow-right.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/arrow-up.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/arrow-up.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/blue_stripe.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/blue_stripe.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/bulb.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/bulb.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/contract_revision.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/contract_revision.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/delete-item.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/delete-item.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/file.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/file.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/folder-add.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/folder-add.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/folder-edit.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/folder-edit.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/folder.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/folder.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/image.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/image.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/move-item.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/move-item.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/page-add.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/page-add.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/page-edit.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/page-edit.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/page.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/page.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/sec_doc.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/sec_doc.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/warning-small.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/warning-small.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/resources/warning.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/resources/warning.png,v diff -u Binary files differ Index: openacs-4/packages/xcms-ui/www/template/folder-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/folder-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/folder-add.adp 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,9 @@ + +@title@ +@context_help@ +@return_url@ +context +
+@title@ + +
Index: openacs-4/packages/xcms-ui/www/template/folder-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/folder-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/folder-add.tcl 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,11 @@ +ad_page_contract { + create a subfolder +} { + parent_id:notnull,integer + return_url:notnull +} + +set title "Add Folder" +set context_help "Enter the folder name which will be part of the url. And the folder label" + + Index: openacs-4/packages/xcms-ui/www/template/folder-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/folder-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/folder-view.adp 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,16 @@ + +@title@ +@context;noquote@ +@context_action;noquote@ +@context_help;noquote@ +1 +
+Folder Properties + +
+ +
+Folder Contents + + +
Index: openacs-4/packages/xcms-ui/www/template/folder-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/folder-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/folder-view.tcl 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,155 @@ +ad_page_contract { + lists the items under a folder. we need to use different queries on template and content manage_type +} { + item + {orderby:optional} + {page:optional} + {return_url "[ad_conn url]"} +} +if {![regexp {/$} [ad_conn url]]} { + ad_returnredirect "[ad_conn url]/" + ad_script_abort +} + +set root_id [parameter::get -parameter template_folder_id] +array set current_item $item +set folder_id $current_item(item_id) +array set folder [bcms::folder::get_folder -folder_id $folder_id] +set package_url [ad_conn package_url] + + +#set type_options [bcms::folder::content_types_select -folder_id $folder_id] +set type_options {{Template template-add} {Folder folder-add} } +ad_form -name add-item -export {return_url} -form { + {submit:text(submit) {label "Add New"} {value "Add New"}} + {item_type:text(select) {label ""} {options $type_options } } + {parent_id:text(hidden) {value $folder_id}} +} -on_submit { + ad_returnredirect "[ad_conn package_url]template/${item_type}?[export_vars {parent_id return_url}]" +} + + template::list::create \ + -name item_list \ + -multirow item_list \ + -pass_properties { package_url } \ + -key item_id \ + -actions [list \ + ] \ + -bulk_actions [list \ + "Delete" "${package_url}template/template-delete" "Delete checked items" \ + ]\ + -bulk_action_export_vars { + return_url + } \ + -elements { + name { + label "Name" + link_url_col name + } + title { + label "Title" + } + content_type { + label "Type" + display_template { + + + + + + + + + + + + + + + + + + + + + + + + } + html { style "width:70px" } + } + last_modified_pretty { + label "Last Modified" + html { style "width:180px" } + } + publish_status { + label "Status" + } + } \ + -orderby { + default_value name,asc + name { + orderby name + } + title { + orderby title + } + content_type { + orderby content_type + } + last_modified { + orderby last_modified + } + } \ + -page_size 10 \ + -page_groupsize 10 \ + -page_query { + select i.item_id, + i.name, + i.live_revision, + i.latest_revision, + i.publish_status, + i.content_type, + i.storage_type, + i.tree_sortkey, + last_modified, + r.title, + r.description + from cr_items i, cr_revisionsx r + where + i.parent_id = $current_item(item_id) + and i.latest_revision = r.revision_id + union + + select i.item_id, + i.name, + i.live_revision, + i.latest_revision, + i.publish_status, + i.content_type, + i.storage_type, + i.tree_sortkey, + null as last_modified, + f.label as title, + f.description + from cr_items i, cr_folders f + where + i.parent_id = $current_item(item_id) + and i.item_id = f.folder_id + [template::list::orderby_clause -orderby -name item_list] + } \ + -page_flush_p 1 + + + bcms::item::list_items -parent_id $folder_id -multirow_name item_list -orderby [template::list::orderby_clause -name item_list] -show_only [template::list::page_get_ids -name item_list] + +set context_action "" +# this can be used to show help text on the page +set context_help "" + +set title "View Folder" + +set context [bcms::widget::item_context -item_id $folder_id -root_id $root_id -root_url [ad_conn package_url]manage/ ] + +set context [lrange $context 0 [expr [llength $context] - 2]] +lappend context $folder(label) Index: openacs-4/packages/xcms-ui/www/template/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/index.vuh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/index.vuh 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,53 @@ +################## KLUDGE BY STAS ############### +# Try and look up the item in the content repository +################################################# +ad_page_contract { + + @author Unknown + @creation-date Unknown + @cvs-id $Id: index.vuh,v 1.1 2004/05/01 12:09:21 daveb Exp $ +} { + { revision_id "" } +} + +# Get the paths +#set the_root [ns_info pageroot] +set the_url "/[ad_conn path_info]" + +# Ugly hack to workaround the fact that a URL on index will match +# index.vuh, causing path_info to be empty + + +if {[string equal "index" [lindex [ad_conn urlv] end]] && ![string match "*index" $the_url]} { + append the_url "index" +} + +ns_log notice "DAVEB url [ad_conn url] path_info [ad_conn path_info] the_url $the_url" +# Get the IDs + +set content_root [parameter::get -parameter template_folder_id -default "-200"] +ns_log notice "DAVEB content_root $content_root" + +array set item [bcms::item::get_item_by_url -root_id $content_root \ + -url $the_url \ + ] + +if {[array size item] == 0} { + ns_returnnotfound +} +rp_form_put item [array get item] +switch -- $item(content_type) { + + content_folder { + rp_internal_redirect "folder-view" + } + + default { # content_template + rp_internal_redirect "template-view" + } + + + +} + + Index: openacs-4/packages/xcms-ui/www/template/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/master.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/master.adp 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,29 @@ + +@context;noquote@ +@title@ +
+ +
+ +
+ @context_action;noquote@ +
+
+
+ +

@context_help;noquote@

+
+ +

no help available

+
+
+
+ +
+ +
+ +
+ + + Index: openacs-4/packages/xcms-ui/www/template/master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/master.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/master.tcl 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,9 @@ +set package_url [ad_conn package_url] +set current_url [ad_return_url] + +if {[info exists context]} { + set context_bar [ad_context_bar_html $context] +} else { + set context_bar [ad_context_bar] +} +set manage_type [ad_get_client_property -default content [ad_conn package_id] manage_type] Index: openacs-4/packages/xcms-ui/www/template/template-add-version.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/template-add-version.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/template-add-version.adp 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,6 @@ + +@title@ +@context_help@ +@return_url@ + + Index: openacs-4/packages/xcms-ui/www/template/template-add-version.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/template-add-version.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/template-add-version.tcl 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,10 @@ +ad_page_contract { + create a version +} { + template_id:notnull,integer + return_url:notnull +} + + +set title "Add Version" +set context_help "" Index: openacs-4/packages/xcms-ui/www/template/template-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/template-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/template-add.adp 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,6 @@ + +@title@ +@context_help@ +@return_url@ +context + Index: openacs-4/packages/xcms-ui/www/template/template-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/template-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/template-add.tcl 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,10 @@ +ad_page_contract { + create a template +} { + parent_id:notnull,integer + return_url:notnull +} + + +set title "Add Template" +set context_help "" Index: openacs-4/packages/xcms-ui/www/template/template-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/template-delete.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/template-delete.adp 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,6 @@ + +@title@ +@return_url@ +context + + Index: openacs-4/packages/xcms-ui/www/template/template-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/template-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/template-delete.tcl 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,56 @@ +ad_page_contract { + delete templates +} { + item_id:notnull,naturalnum,multiple + {confirm_p:optional,boolean 0} + return_url:notnull +} + + + + template::list::create \ + -name delete_list \ + -multirow delete_list \ + -key item_id \ + -elements [subst { + title { + label "Item" + } + }] + + set template_ids [join $item_id ", "] + db_multirow delete_list get_to_be_deleted " + select i.item_id, + i.name, + i.live_revision, + i.latest_revision, + i.publish_status, + i.content_type, + i.storage_type, + i.tree_sortkey, + r.title + from cr_items i, cr_revisions r + where + i.item_id in ($template_ids) + and r.revision_id = i.latest_revision" + + + + set title "Delete" + + ad_form -name delete_confirm -cancel_url $return_url -form { + {notice:text(inform) {label ""} {value "The listed items will be deleted."}} + {item_id:text(hidden) {value $item_id}} + {return_url:text(hidden) {value $return_url}} + } -on_submit { + + + db_transaction { + foreach one_item $item_id { + bcms::template::delete_template -template_id $one_item + } + } + ad_returnredirect $return_url + ad_script_abort + +} Index: openacs-4/packages/xcms-ui/www/template/template-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/template-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/template-view.adp 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,14 @@ + +@title@ +@context@ +@context_help@ + + + + + + + + Index: openacs-4/packages/xcms-ui/www/template/template-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/template-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/template-view.tcl 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,44 @@ +ad_page_contract { + view a template revision, if no revision_id is passed then latest revision is used +} { + item + {revision_id ""} + {return_url:optional "[ad_conn url]"} +} + + +set package_url [ad_conn package_url] + +#if {![exists_and_not_null revision_id]} { +#set revision_id [item::get_best_revision $item_id] +#} +set root_id [parameter::get -parameter template_folder_id] +array set content $item +set item_id $content(item_id) +if {[empty_string_p $revision_id]} { + if {![empty_string_p $content(live_revision)]} { + set revision_id $content(live_revision) + } elseif {![empty_string_p $content(latest_revision)]} { + set revision_id $content(latest_revision) + } else { + ns_returnnotfound + } +} + + +array set template_revision [bcms::revision::get_revision -revision_id $revision_id] + +set context_help "" + +set url_stub "[ad_conn package_url]/manage/" +template::multirow create actions url label title + + template::multirow append actions "./template-write?[export_vars {revision_id return_url}]" "Publish Template" "Publish this template." +template::multirow append actions "${url_stub}delete-item?[export_vars {item_id return_url}]" "Delete" "Delete this item." + + + +set title "View Template" +set context [bcms::widget::item_context -item_id $item_id -root_id $root_id] +set context [lrange $context 0 [expr [llength $context] - 2]] +lappend context "$template_revision(title)" Index: openacs-4/packages/xcms-ui/www/template/template-write.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xcms-ui/www/template/template-write.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xcms-ui/www/template/template-write.tcl 1 May 2004 12:09:21 -0000 1.1 @@ -0,0 +1,27 @@ +ad_page_contract { + write the template to the file system and set the revision to live +} { + revision_id:notnull,naturalnum + return_url:notnull +} + +set cms_context [parameter::get -parameter cms_context -default ""] + +set template_root [parameter::get -parameter TemplateRoot -default "templates"] + +if {[string equal $cms_context ""]} { + error "no cms context defined" +} + +array set template [bcms::revision::get_revision -revision_id $revision_id] + +if {[array size template] > 0} { + bcms::revision::set_revision_status -revision_id $revision_id -status live + set template_file "[acs_root_dir]/${template_root}/${template(name)}.adp" + template::util::write_file $template_file $template(content) +} else { + error "revision does not exist" +} + +ad_returnredirect $return_url +ad_script_abort