Index: openacs-4/packages/cms/todo =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/todo,v diff -u -r1.7.2.6 -r1.7.2.7 --- openacs-4/packages/cms/todo 15 Nov 2006 20:21:03 -0000 1.7.2.6 +++ openacs-4/packages/cms/todo 19 Feb 2007 22:17:42 -0000 1.7.2.7 @@ -1,9 +1,10 @@ -tasks +tasks (as of 02/07) ===== -can rename template folders? how? -root template/content folder procs returning correct info? -clean up www/modules/items/relate-items (convert old table/grid format to listbuilder ala perm-include from acs-subsite) +display tabs based on rel seg membership (i.e., designer, editor, publisher, author) +go through various listbuilder lists and remove "un-xxx" links in favor of bulk actions +handle rename/deletion of templates/template folders? +clean up www/modules/items/relate-items finish moving the content_method stuff to tcl api (then delete many of the xql files under types) - [content::revision::delete], content method stuff using package_plsql broken? make content_method stuff make sense (ok for now, if developer sets up the type information [content_method, mime_type] correctly?) @@ -12,11 +13,10 @@ continue cleanup/removal of xql files add interface to allow admin to map subsite to cms instance - should copy index.vuh to /www/subsite and add entry to subsite_package_map -printer friendly template (steal from xcms-ui? add ad_page_contract to index.vuh with preview/printer-friendly option? pass in use_context?) +printer friendly templates/alternate templates - + steal from x|bcms-ui? add ad_page_contract to index.vuh with preview/printer-friendly option? use_context cookie? new icon for "clipping" items - competing with new listbuilder checkboxes, confuses UI a bit -go through various listbuilder lists and remove "un-xxx" links in favor of bulk actions unregister item templates - types/content methods & templates -redo tab files - just cycle through list of tabs to create the tab html? floating clipboard working? (done, except for storage type) hide data model for users creating/editing items: - for new items, if: @@ -33,7 +33,7 @@ -------- dav for templates root internationalization -integrate categories and workflow packages +integrate workflow packages fix search module questions/ideas Index: openacs-4/packages/cms/lib/ancestors-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/lib/Attic/ancestors-postgresql.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/lib/ancestors-postgresql.xql 31 Aug 2006 19:59:04 -0000 1.1.2.1 +++ openacs-4/packages/cms/lib/ancestors-postgresql.xql 19 Feb 2007 22:17:42 -0000 1.1.2.2 @@ -27,12 +27,12 @@ from (select * from cr_items where item_id = :item_id) i1, cr_items i2 where - i2.parent_id != 0 + i2.parent_id != '0' and i1.tree_sortkey between i2.tree_sortkey and tree_right(i2.tree_sortkey) ) t where - i.item_id = t.parent_id and t.tree_level > 1 + i.item_id = t.parent_id and t.tree_level > 3 order by tree_level asc Index: openacs-4/packages/cms/lib/folder-items-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/lib/folder-items-oracle.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/cms/lib/folder-items-oracle.xql 9 May 2005 22:44:47 -0000 1.1 +++ openacs-4/packages/cms/lib/folder-items-oracle.xql 19 Feb 2007 22:17:42 -0000 1.1.2.1 @@ -40,6 +40,7 @@ nvl(v.title, i.name))), '-') title, o.object_type, t.pretty_name as pretty_content_type, last_modified, + '/' || content_item__get_path(r.item_id,:root_id) as path, v.content_length from cr_resolved_items r, cr_items i, cr_folders f, cr_revisions v, @@ -64,4 +65,4 @@ </querytext> </partialquery> -</queryset> \ No newline at end of file +</queryset> Index: openacs-4/packages/cms/lib/folder-items-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/lib/folder-items-postgresql.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/cms/lib/folder-items-postgresql.xql 9 May 2005 22:44:47 -0000 1.1 +++ openacs-4/packages/cms/lib/folder-items-postgresql.xql 19 Feb 2007 22:17:42 -0000 1.1.2.1 @@ -39,6 +39,7 @@ when i.content_type = 'content_folder' then f.label else coalesce(v.title, i.name) end),'-') as title, t.pretty_name as pretty_content_type, last_modified, + '/' || content_item__get_path(r.item_id,:root_id) as path, v.content_length from cr_items i @@ -63,4 +64,4 @@ </querytext> </fullquery> -</queryset> \ No newline at end of file +</queryset> Index: openacs-4/packages/cms/lib/folder-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/lib/folder-items.tcl,v diff -u -r1.1.2.4 -r1.1.2.5 --- openacs-4/packages/cms/lib/folder-items.tcl 31 Aug 2006 19:59:04 -0000 1.1.2.4 +++ openacs-4/packages/cms/lib/folder-items.tcl 19 Feb 2007 22:17:42 -0000 1.1.2.5 @@ -1,5 +1,7 @@ # expects folder_id, parent_id, actions, orderby, page, mount_point +set root_id [cm::modules::${mount_point}::getRootFolderID [ad_conn subsite_id]] + template::list::create \ -name folder_items \ -multirow folder_contents \ @@ -16,14 +18,21 @@ display_template "<center>@folder_contents.copy;noquote@</center>" } title { - label "Name" - link_html { title "View this item"} + label "Title" + display_template { @folder_contents.title;noquote@ } + link_html { title "@folder_contents.full_title@"} link_url_col item_url orderby title } + path { + label "URL" + } file_size { label "Size" } + pretty_content_type { + label "Content Type" + } publish_date { label "Publish Date" display_eval { @@ -32,9 +41,6 @@ "-"] } } - pretty_content_type { - label "Type" - } last_modified { label "Last Modified" orderby last_modified @@ -47,7 +53,7 @@ mount_point {} } -db_multirow -extend { item_url copy file_size } folder_contents get_folder_contents "" { +db_multirow -extend { item_url copy file_size full_title } folder_contents get_folder_contents "" { switch $content_type { content_folder { set folder_id $item_id @@ -61,6 +67,8 @@ } } + set full_title $title + set title [string_truncate -len 30 $title] if { ![ template::util::is_nil content_length ] } { set file_size "[lc_numeric [expr $content_length / 1000.00] "%.2f"] Kb" } else { Index: openacs-4/packages/cms/lib/revisions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/lib/Attic/revisions.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/lib/revisions.tcl 31 Aug 2006 19:59:04 -0000 1.1.2.1 +++ openacs-4/packages/cms/lib/revisions.tcl 19 Feb 2007 22:17:42 -0000 1.1.2.2 @@ -1,4 +1,4 @@ -set action delete +set list_action delete set template_id $item_id set return_url [ad_return_url] @@ -9,13 +9,14 @@ -bulk_actions [list "Delete Revisions" \ ../items/revision-handler \ "Delete checked revisions"] \ - -bulk_action_export_vars { item_id mount_point action return_url } \ + -bulk_action_export_vars { item_id mount_point list_action return_url } \ -elements { revision_number { label "\#" } title { label "Title" + display_template { @revisions.title;noquote@ } } description { label "Description" @@ -34,9 +35,14 @@ } options { display_template { - <a href=\"@revisions.view_url;noquote@\" class=\"button\" title=\"View revision\">View</a> + <a href=\"@revisions.view_url;noquote@\" class=\"button\" title=\"View revision\" target=\"_new\">View</a> <a href=\"@revisions.revise_url;noquote@\" class=\"button\" title=\"Author new revision based on this revision\">Revise</a> + <if @revisions.status@ eq "Live"> + <a href=\"@revisions.unpublish_url;noquote@\" class=\"button\" title=\"Unpublish item\">Unpublish</a> + </if> + <else> <a href=\"@revisions.publish_url;noquote@\" class=\"button\" title=\"Publish item\">Publish</a> + </else> } } } @@ -54,6 +60,7 @@ view_url revise_url publish_url + unpublish_url revision_number file_size status @@ -84,10 +91,11 @@ set pretty_date [lc_time_fmt $publish_date "%q %X"] set revise_url [export_vars -base $revise_url_base {item_id template_id revision_id mount_point content_method return_url}] set publish_url [export_vars -base publish { item_id revision_id return_url }] - set action view - set view_url [export_vars -base ../items/revision-handler {item_id revision_id mount_point action return_url}] + set unpublish_url [export_vars -base unpublish { item_id return_url }] + set list_action view + set view_url [export_vars -base ../items/view {item_id revision_id mount_point list_action return_url}] } # sort by revision_number, not date -template::multirow sort revisions -decreasing revision_number +template::multirow sort revisions -decreasing -integer revision_number Index: openacs-4/packages/cms/sql/postgresql/cms-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/sql/postgresql/cms-create.sql,v diff -u -r1.11.2.5 -r1.11.2.6 --- openacs-4/packages/cms/sql/postgresql/cms-create.sql 4 Oct 2005 22:17:08 -0000 1.11.2.5 +++ openacs-4/packages/cms/sql/postgresql/cms-create.sql 19 Feb 2007 22:17:42 -0000 1.11.2.6 @@ -200,6 +200,7 @@ end;' language 'plpgsql'; -- function new +select define_function_args('content_module__new','name,key,root_key,sort_key,parent_id,package_id,object_id,creation_date,creation_user,creation_ip,object_type'); create or replace function content_module__new (varchar,varchar,varchar,integer,integer,integer,integer,timestamptz,integer,varchar,varchar) returns integer as ' declare Index: openacs-4/packages/cms/sql/postgresql/upgrade/upgrade-5.0d-5.1d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/sql/postgresql/upgrade/upgrade-5.0d-5.1d.sql,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/cms/sql/postgresql/upgrade/upgrade-5.0d-5.1d.sql 31 Aug 2006 19:59:04 -0000 1.1.2.3 +++ openacs-4/packages/cms/sql/postgresql/upgrade/upgrade-5.0d-5.1d.sql 19 Feb 2007 22:17:42 -0000 1.1.2.4 @@ -6,15 +6,21 @@ -- @cvs-id $Id$ -- +update apm_package_types set singleton_p = 'f' where package_key = 'cms'; + +insert into acs_rel_roles (role,pretty_name,pretty_plural) values ('author','Author','Authors'); +insert into acs_rel_roles (role,pretty_name,pretty_plural) values ('editor','Editor','Editors'); +insert into acs_rel_roles (role,pretty_name,pretty_plural) values ('publisher','Publisher','Publishers'); -- adds package_id to call to content_item__new +select define_function_args('content_module__new','name,key,root_key,sort_key,parent_id,package_id,object_id,creation_date,creation_user,creation_ip,object_type'); create or replace function content_module__new (varchar,varchar,varchar,integer,integer,integer,integer,timestamptz,integer,varchar,varchar) returns integer as ' declare p_name alias for $1; p_key alias for $2; p_root_key alias for $3; p_sort_key alias for $4; - p_parent_id alias for $5; -- null + p_parent_id alias for $5; p_package_id alias for $6; p_object_id alias for $7; -- null p_creation_date alias for $8; -- now() @@ -58,4 +64,4 @@ select define_function_args('content_method__add_all_methods','content_type'); select define_function_args('content_method__add_method','content_type,content_method,is_default'); select define_function_args('content_method__is_mapped','content_type,content_method'); -select define_function_args('content_method__get_method','content_type'); \ No newline at end of file +select define_function_args('content_method__get_method','content_type'); Index: openacs-4/packages/cms/tcl/form-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs-oracle.xql,v diff -u -r1.17.2.1 -r1.17.2.2 --- openacs-4/packages/cms/tcl/form-procs-oracle.xql 31 Aug 2006 19:59:05 -0000 1.17.2.1 +++ openacs-4/packages/cms/tcl/form-procs-oracle.xql 19 Feb 2007 22:17:42 -0000 1.17.2.2 @@ -63,7 +63,7 @@ </querytext> </partialquery> -<partialquery name="content::create_form_element.cfe_attribute_name_to_char"> +<partialquery name="cms::form::create_form_element.cfe_attribute_name_to_char"> <querytext> to_char($attribute_name, 'YYYY MM DD HH24 MI SS') @@ -73,13 +73,13 @@ </partialquery> -<fullquery name="content::create_form_element.get_revision_id"> +<fullquery name="cms::form::create_form_element.get_revision_id"> <querytext> select content_item.get_latest_revision(:item_id) from dual </querytext> </fullquery> -<partialquery name="content::get_revision_create_element.get_enum_1"> +<partialquery name="cms::form::get_revision_create_element.get_enum_1"> <querytext> select nvl(pretty_name,enum_value), enum_value from acs_enum_values @@ -88,7 +88,7 @@ </querytext> </partialquery> -<fullquery name="content::process_revision_form.new_content_revision"> +<fullquery name="cms::form::process_revision_form.new_content_revision"> <querytext> begin :revision_id := content_revision.new( @@ -104,7 +104,7 @@ </querytext> </fullquery> -<fullquery name="content::process_revision_form.get_extended_attributes"> +<fullquery name="cms::form::process_revision_form.get_extended_attributes"> <querytext> select @@ -132,7 +132,7 @@ </querytext> </fullquery> -<partialquery name="content::insert_element_data.ied_get_objects_tree"> +<partialquery name="cms::form::insert_element_data.ied_get_objects_tree"> <querytext> select @@ -156,15 +156,15 @@ </querytext> </partialquery> -<fullquery name="content::new_item.get_item_id"> +<fullquery name="cms::form::new_item.get_item_id"> <querytext> begin :1 := content_item.new( [join $params ","] ); end; </querytext> </fullquery> -<fullquery name="content::upload_content.get_storage_type"> +<fullquery name="cms::form::upload_content.get_storage_type"> <querytext> select @@ -182,7 +182,7 @@ </fullquery> -<fullquery name="content::upload_content.upload_file_revision"> +<fullquery name="cms::form::upload_content.upload_file_revision"> <querytext> update cr_revisions @@ -192,7 +192,7 @@ </querytext> </fullquery> -<fullquery name="content::upload_content.upload_text_revision"> +<fullquery name="cms::form::upload_content.upload_text_revision"> <querytext> update cr_revisions @@ -204,7 +204,7 @@ </querytext> </fullquery> -<fullquery name="content::upload_content.upload_revision"> +<fullquery name="cms::form::upload_content.upload_revision"> <querytext> update cr_revisions @@ -216,15 +216,15 @@ </querytext> </fullquery> -<partialquery name="content::get_sql_value.string_to_timestamp"> +<partialquery name="cms::form::get_sql_value.string_to_timestamp"> <querytext> to_date(:$name, 'YYYY MM DD HH24 MI SS') </querytext> </partialquery> -<fullquery name="content::add_child_relation_element.get_all_valid_relation_tags"> +<fullquery name="cms::form::add_child_relation_element.get_all_valid_relation_tags"> <querytext> select @@ -241,15 +241,15 @@ </querytext> </fullquery> -<partialquery name="content::set_attribute_values.timestamp_to_string"> +<partialquery name="cms::form::set_attribute_values.timestamp_to_string"> <querytext> to_char($attr, 'YYYY MM DD HH24 MI SS') as $attr </querytext> </partialquery> -<fullquery name="content::get_attributes.ga_get_attributes"> +<fullquery name="cms::form::get_attributes.ga_get_attributes"> <querytext> select @@ -273,15 +273,15 @@ </querytext> </fullquery> -<fullquery name="content::get_latest_revision.glr_get_latest_revision"> +<fullquery name="cms::form::get_latest_revision.glr_get_latest_revision"> <querytext> select content_item.get_latest_revision(:item_id) from dual </querytext> </fullquery> -<fullquery name="content::get_attribute_enum_values.gaev_get_enum_values"> +<fullquery name="cms::form::get_attribute_enum_values.gaev_get_enum_values"> <querytext> select @@ -298,7 +298,7 @@ </fullquery> -<fullquery name="content::add_basic_revision.basic_get_revision_id"> +<fullquery name="cms::form::add_basic_revision.basic_get_revision_id"> <querytext> begin :1 := content_revision.new( item_id => content_symlink.resolve(:item_id), @@ -309,7 +309,7 @@ </querytext> </fullquery> -<fullquery name="content::update_content_from_file.get_storage_type"> +<fullquery name="cms::form::update_content_from_file.get_storage_type"> <querytext> select @@ -327,7 +327,7 @@ </fullquery> -<fullquery name="content::update_content_from_file.upload_file_revision"> +<fullquery name="cms::form::update_content_from_file.upload_file_revision"> <querytext> update cr_revisions @@ -338,7 +338,7 @@ </querytext> </fullquery> -<fullquery name="content::update_content_from_file.upload_text_revision"> +<fullquery name="cms::form::update_content_from_file.upload_text_revision"> <querytext> update cr_revisions @@ -350,7 +350,7 @@ </querytext> </fullquery> -<fullquery name="content::update_content_from_file.upload_revision"> +<fullquery name="cms::form::update_content_from_file.upload_revision"> <querytext> update cr_revisions @@ -363,7 +363,7 @@ </fullquery> -<fullquery name="content::copy_content.cc_copy_content"> +<fullquery name="cms::form::copy_content.cc_copy_content"> <querytext> begin Index: openacs-4/packages/cms/tcl/form-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs-postgresql.xql,v diff -u -r1.21.2.1 -r1.21.2.2 --- openacs-4/packages/cms/tcl/form-procs-postgresql.xql 31 Aug 2006 19:59:05 -0000 1.21.2.1 +++ openacs-4/packages/cms/tcl/form-procs-postgresql.xql 19 Feb 2007 22:17:42 -0000 1.21.2.2 @@ -262,7 +262,7 @@ -<partialquery name="content::get_sql_value.string_to_timestamp"> +<partialquery name="cms::form::get_sql_value.string_to_timestamp"> <querytext> to_date(:$name, 'YYYY MM DD HH24 MI SS') @@ -325,7 +325,7 @@ </querytext> </fullquery> -<fullquery name="content::get_attribute_enum_values.gaev_get_enum_values"> +<fullquery name="cms::form::get_attribute_enum_values.gaev_get_enum_values"> <querytext> select @@ -341,7 +341,7 @@ </querytext> </fullquery> -<fullquery name="content::add_basic_revision.basic_get_revision_id"> +<fullquery name="cms::form::add_basic_revision.basic_get_revision_id"> <querytext> select content_revision__new( @@ -361,7 +361,7 @@ </fullquery> -<fullquery name="content::update_content_from_file.upcff_update_cr_revisions"> +<fullquery name="cms::form::update_content_from_file.upcff_update_cr_revisions"> <querytext> update cr_revisions @@ -371,7 +371,7 @@ </querytext> </fullquery> -<fullquery name="content::copy_content.cc_copy_content"> +<fullquery name="cms::form::copy_content.cc_copy_content"> <querytext> select content_revision__content_copy (:revision_id_src, :revision_id_dest) Index: openacs-4/packages/cms/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs.tcl,v diff -u -r1.27.2.3 -r1.27.2.4 --- openacs-4/packages/cms/tcl/form-procs.tcl 31 Aug 2006 19:59:05 -0000 1.27.2.3 +++ openacs-4/packages/cms/tcl/form-procs.tcl 19 Feb 2007 22:17:42 -0000 1.27.2.4 @@ -1,11 +1,7 @@ ad_library { These procs manage building and processing the forms used in CMS. } -# MS: old namespace stuff - now converted to cms::form -#namespace eval content { - # namespace import seems to prevent content:: procs from being recognized - # namespace import ::template::query ::template::form ::template::element -#} + namespace eval cms::form {} ad_proc -private cms::form::query_form_metadata { @@ -650,15 +646,6 @@ add_revision $form_name $tmpfile $prefix [expr !$exists] } - # flush the sitemap folder listing cache - #if { [template::element exists $form_name parent_id] } { - # set parent_id [template::element get_value $form_name parent_id] - # if { $parent_id == [cm::modules::sitemap::getRootFolderID] } { - # set parent_id "" - # } - # cms_folder::flush sitemap $parent_id - #} - return $item_id } @@ -693,11 +680,34 @@ # initialize an ns_set to hold bind values set bind_vars [ns_set create] - # get the item_id and revision_id and content_method + # get the item_id and revision_id, content_method and category_id foreach var {item_id revision_id content_method} { set $var [template::element get_values $form_name ${prefix}$var] } + # manually pull out category ids + set form [ns_getform] + set form_size [ns_set size $form] + set form_counter_i 0 + set category_ids "" + while {$form_counter_i < $form_size} { + ns_log notice "[ns_set key $form $form_counter_i]: [ns_set value $form $form_counter_i]\n" + if { [string match "__category__ad_form__category_id_*" [ns_set key $form $form_counter_i]] } { + ns_log notice "[ns_set key $form $form_counter_i]: [ns_set value $form $form_counter_i]\n" + append category_ids "[ns_set value $form $form_counter_i] " + } + incr form_counter_i + } + + + foreach tree [category_tree::get_mapped_trees [ad_conn package_id]] { + ns_log notice "==================== looking for categories for tree [lindex $tree 0] " + append category_ids "[category::ad_form::get_categories -container_object_id [lindex $tree 0]] " + } + + ns_log debug "cms::form::add_revision: form:$form_name category_ids = $category_ids" + category::map_object -remove_old -object_id $item_id $category_ids + # MS: new items were bombing with a null revision_id if {[empty_string_p $revision_id]} { set revision_id [db_nextval acs_object_id_seq] @@ -764,6 +774,7 @@ if { [template::element exists $form_name $prefix$attribute_name] } { set value [template::element get_value $form_name $prefix$attribute_name] + ns_log debug "cms::form::attribute_insert_statement: fetching attribute values: $attribute ($datatype) $value" # Convert dates to linear "YYYY MM DD HH24 MI SS" format if { [string equal $datatype date] } { @@ -777,7 +788,6 @@ if { ! [string equal $value {}] && ![expr { [string equal $ancestor "content_revision"] && [string equal $attribute_name "title"] }] } { ns_set put $bind_vars $attribute_name $value - lappend columns $attribute_name lappend values [get_sql_value $attribute_name $datatype] } @@ -801,6 +811,7 @@ set insert_statement "insert into ${table_name}i ( [join [concat $columns $missing_columns] ", "] )\nselect [join [concat $values $missing_columns] ", "]\nfrom ${table_name}i\nwhere revision_id = content_item.get_latest_revision(:item_id)" } + ns_log debug "cms::form::attribute_insert_statement: returning $insert_statement" return $insert_statement } @@ -860,7 +871,7 @@ # if it is HTML then strip out the body set mime_type [ns_guesstype $filename] - ns_log debug "content::upload_content: guessed mime_type: $mime_type, filename = $filename" + ns_log debug "cms::form::upload_content: guessed mime_type: $mime_type, filename = $filename" if { [string equal $mime_type text/html] } { set text [template::util::read_file $tmpfile] if { [regexp {<body[^>]*>(.*?)</body>} $text x body] } { @@ -1058,7 +1069,8 @@ template::util::get_opts $args if { ! [template::form exists $opts(form_name)] } { - template::form create $opts(form_name) \ + ad_form -name $opts(form_name) -html { enctype multipart/form-data } +# template::form create $opts(form_name) \ -html { enctype multipart/form-data } } @@ -1094,39 +1106,64 @@ if {[lsearch $opts(exclude) name] == -1} { if {[lsearch $opts(hidden) name] == -1} { - template::element create $opts(form_name) "$opts(prefix)name" \ +# template::element create $opts(form_name) "$opts(prefix)name" \ -datatype filename \ -html { maxlength 400 } \ -widget text \ - -label Name + -label "Name" + ad_form -extend -name $form_name -form { + {$opts(prefix)name:filename(text) + {label "Name"} + {html {maxlength 400}} + } + } } else { - template::element create $opts(form_name) "$opts(prefix)name" \ +# template::element create $opts(form_name) "$opts(prefix)name" \ -datatype filename \ -widget hidden \ -sign + ad_form -extend -name $form_name -form { + {$opts(prefix)name:filename(hidden)} + } } } if {[lsearch $opts(exclude) parent_id] == -1} { - template::element create $opts(form_name) "$opts(prefix)parent_id" \ + ad_form -extend -name $form_name -form { + {$opts(prefix)parent_id:integer(hidden),optional + {value $opts(parent_id)} + } + } +# template::element create $opts(form_name) "$opts(prefix)parent_id" \ -datatype integer \ -widget hidden \ -optional \ -sign + # ATS doesn't like "-value -100" so use set_value to get around it - template::element set_value $opts(form_name) "$opts(prefix)parent_id" $opts(parent_id) +# template::element set_value $opts(form_name) "$opts(prefix)parent_id" $opts(parent_id) } if {[lsearch $opts(exclude) relation_tag] == -1 && ![string equal {} $opts(relation)]} { - template::element create $opts(form_name) "$opts(prefix)relation_tag" \ + ad_form -extend -name $form_name -form { + {$opts(prefix)relation_tag:text(hidden),optional + {value $opts(relation)} + } + } +# template::element create $opts(form_name) "$opts(prefix)relation_tag" \ -datatype text \ -widget hidden \ -optional \ -value $opts(relation) } if {[lsearch $opts(exclude) parent_id] == -1} { - template::element create $opts(form_name) "$opts(prefix)content_type" \ + ad_form -extend -name $form_name -form { + {$opts(prefix)content_type:text(hidden),optional + {value $opts(content_type)} + } + } +# template::element create $opts(form_name) "$opts(prefix)content_type" \ -datatype keyword \ -widget hidden \ -value $opts(content_type) \ @@ -1146,7 +1183,7 @@ if { [template::form is_request $opts(form_name)] } { if {[template::util::is_nil item_id]} { - set item_id [new_object_id] + set item_id [db_nextval "acs_object_id_seq"] template::element set_properties $opts(form_name) "$opts(prefix)item_id" -value $item_id @@ -1208,7 +1245,8 @@ } if { ! [template::form exists $opts(form_name)] } { - template::form create $opts(form_name) \ + ad_form -name $opts(form_name) -html { enctype multipart/form-data } +# template::form create $opts(form_name) \ -html { enctype multipart/form-data } } @@ -1231,7 +1269,7 @@ -sign } - set attributes [add_attribute_elements $opts(form_name) $opts(content_type) {} $opts(prefix) $opts(section) $opts(exclude) $opts(hidden)] + set attributes [add_attribute_elements $opts(form_name) $opts(content_type) $opts(item_id) {} $opts(prefix) $opts(section) $opts(exclude) $opts(hidden)] ns_log debug "cms::form::add_revision_form: content method $opts(content_method); revision id $opts(revision_id)" @@ -1274,7 +1312,7 @@ ad_proc -public cms::form::add_attribute_elements { - form_name content_type { revision_id "" } {prefix {}} {section {}} {exclude {}} {hidden {}} + form_name content_type item_id { revision_id "" } {prefix {}} {section {}} {exclude {}} {hidden {}} } { Add form elements to an ATS form object for all attributes of a @@ -1284,13 +1322,14 @@ should be added. @param content_type The content type keyword for which attribute widgets should be added. + @option item_id @param revision_id The revision from which default values should be queried @param prefix a prefix for the form variables. @param section a section name - @option exclude a list of object attributes to exclude from the form - @option hidden a list of attributes to hide but leave in form + @option exclude a list of object attributes to exclude from the form + @option hidden a list of attributes to hide but leave in form @return The list of attributes that were added. } { @@ -1336,6 +1375,14 @@ } } + # add category widget if there is at least one mapped tree + if { [expr [llength [category_tree::get_mapped_trees [ad_conn package_id]]] > 0] } { + category::ad_form::add_widgets \ + -container_object_id [ad_conn package_id] \ + -categorized_object_id $item_id \ + -form_name $form_name + } + if { ![template::util::is_nil revision_id] } { if { [template::form is_request $form_name] } { @@ -1430,7 +1477,7 @@ lappend command -optional } - # ns_log debug "content::add_attribute_element: command = $command" + ns_log debug "cms::form::add_attribute_element: command = $command" eval $command } @@ -1451,7 +1498,7 @@ @param section A section name for the added elements @param prefix A prefix for the form element name } { - ns_log debug "content::add_content_element: content method $content_method" + ns_log debug "cms::form::add_content_element: content method $content_method" template::element create $form_name "${prefix}content_method" \ -datatype keyword \ @@ -1466,9 +1513,18 @@ -widget richtext \ -label {} \ -datatype text \ - -html { cols 80 rows 20 wrap physical } + -html { cols 80 rows 20 wrap physical } \ + -options {editor xinha plugins {Stylist} height 350px javascript { + xinha_config.toolbar = [ + ['popupeditor','createlink','insertimage'], + ['separator','insertorderedlist','insertunorderedlist'], + ['separator','bold','italic'], + ['separator','undo','redo','cut','copy','paste'], + ['separator','htmlmode','killword','removeformat'] + ]; + xinha_config.stylistLoadStylesheet('/definitions.css'); }} - if { [template::element exists $form_name "${prefix}mime_type"] + if { [template::element exists $form_name "${prefix}mime_type"] && [template::element exists $form_name "${prefix}content_type"] } { set content_type \ @@ -1821,16 +1877,6 @@ } -ad_proc -public cms::form::new_object_id {} { - - Grab an object ID for creating a new ACS object. - -} { - - return [db_string nextval "select acs_object_id_seq.nextval from dual"] -} - - ad_proc -private cms::form::get_attributes { content_type args } { Returns columns from the acs_attributes table for all attributes @@ -1912,8 +1958,7 @@ db_transaction { - set revision_id [db_exec_plsql basic_get_revision_id {}] - + #set revision_id [db_exec_plsql basic_get_revision_id {}] if { [info exists opts(tmpfile)] } { update_content_from_file $revision_id $opts(tmpfile) Index: openacs-4/packages/cms/tcl/install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/install-procs.tcl,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/cms/tcl/install-procs.tcl 31 Aug 2006 19:59:05 -0000 1.1.2.3 +++ openacs-4/packages/cms/tcl/install-procs.tcl 19 Feb 2007 22:17:42 -0000 1.1.2.4 @@ -38,27 +38,33 @@ cms::install::unregister_implementations } +ad_proc -public cms::install::before_instantiate {} { + Check to be sure there isn't already a CMS instance under this subsite. + not a callback but we need to check this somewhere below and bomb if nec. +} { + +} + ad_proc -public cms::install::package_instantiate { -package_id } { Procedures to run on package instantiation } { # create modules and clone workflow for new instance cm::modules::install::create_modules -package_id $package_id - cms::workflow::instance_workflow_create -package_id $package_id +# cms::workflow::instance_workflow_create -package_id $package_id - array set package_info [site_node::get_from_object_id -object_id $package_id] - set subsite_package [site_node::closest_ancestor_package -url $package_info(url) -element package_id] - array set subsite_info [site_node::get_from_object_id -object_id $subsite_package] - + # assumes we are mounting from the subsite + array set subsite_info [site_node::get -node_id [ad_conn subsite_node_id]] + set subsite_package $subsite_info(package_id) db_dml map_subsite {} set subsite_dir "[acs_root_dir]/www/$subsite_info(url)" # check that directory exists and... - if { ![file exists $subsite_dir] } { - file mkdir $subsite_dir - } +# if { ![file exists $subsite_dir] } { +# file mkdir $subsite_dir +# } # copy content delivery .vuh file to subsite root - file copy -force [acs_root_dir]/packages/cms/www/index.vuh $subsite_dir +# file copy -force [acs_root_dir]/packages/cms/www/index.vuh $subsite_dir # set up subsite segments for for workflow set app_group [application_group::group_id_from_package_id -package_id $subsite_package] @@ -70,7 +76,8 @@ set template_root [cm::modules::templates::getRootFolderID $subsite_package] foreach { role pn pp } $roles { - set rel [rel_types::new -supertype membership_rel -role_one "" -role_two $role ${role}_rel_${subsite_package} \ + # boy, this is really convoluted; we've (i??) gotta do better + set rel [rel_types::new -supertype membership_rel -role_one "" -role_two $role ${role}_rel_${subsite_info(package_id)} \ "$subsite_info(instance_name) $pn" "$subsite_info(instance_name) $pp" group 0 0 person 0 0] rel_types::add_permissible application_group $rel # MS: move to tcl API with 5.2 @@ -93,9 +100,9 @@ } # register template folder with dav module - #set subsite_node [site_node::get_node_id_from_object_id -object_id [ad_conn subsite_id]] - #set templates_node [site_node::new -name templates -parent_id $subsite_node] - #oacs_dav::register_folder $templates_folder $templates_node + #set subsite_node site_node::get_node_id_from_object_id -object_id [ad_conn subsite_id] + #set templates_node site_node::new -name templates -parent_id $subsite_node + #oacs_dav::register_folder $templates_root $templates_node } ad_proc -public cms::install::package_uninstantiate { -package_id:required } { Index: openacs-4/packages/cms/tcl/module-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/module-procs-postgresql.xql,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/cms/tcl/module-procs-postgresql.xql 6 Jun 2005 17:07:23 -0000 1.8.2.1 +++ openacs-4/packages/cms/tcl/module-procs-postgresql.xql 19 Feb 2007 22:17:42 -0000 1.8.2.2 @@ -177,12 +177,17 @@ <fullquery name="cm::modules::install::create_modules.create_module"> <querytext> select content_module__new ( - :module_name, --name + :module_name, -- name lower(:module), :root_key, :sort_key, - :package_id, -- parent_id - :package_id -- subsite_id + :package_id, -- package_id + :package_id, -- subsite_id + null, -- object_id + current_timestamp, -- creation_date + null, -- creation_user + null, -- creation_ip + null -- object_type ) </querytext> </fullquery> Index: openacs-4/packages/cms/tcl/module-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/module-procs.tcl,v diff -u -r1.9.2.4 -r1.9.2.5 --- openacs-4/packages/cms/tcl/module-procs.tcl 19 Nov 2005 23:13:12 -0000 1.9.2.4 +++ openacs-4/packages/cms/tcl/module-procs.tcl 19 Feb 2007 22:17:42 -0000 1.9.2.5 @@ -332,17 +332,16 @@ } { set instance_name [apm_instance_name_from_id $package_id] set subsite_id [ad_conn subsite_id] - set modules [list Sitemap Templates Types Categories Search] - set sort_key 0 + set modules [list Sitemap Templates Types Keywords Search] + set sort_key 1 set root_key "" foreach module $modules { - incr sort_key set module_name "$instance_name $module" switch $module { "Sitemap" { set root_key [content::folder::new -name pkg_${package_id}_content \ -context_id $package_id \ - -parent_id "0" \ + -package_id $package_id \ -label "$instance_name $module" ] # register content_revision and subtypes to main folder content::folder::register_content_type -folder_id $root_key \ @@ -353,7 +352,7 @@ "Templates" { set root_key [content::folder::new -name pkg_${package_id}_templates \ -context_id $package_id \ - -parent_id "0" \ + -package_id $package_id \ -label "$instance_name $module" ] content::folder::register_content_type -folder_id $root_key \ -content_type content_template -include_subtypes t @@ -372,6 +371,7 @@ # assign context_id of package_id db_dml update_module_context {} + incr sort_key } } Index: openacs-4/packages/cms/tcl/rel-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/rel-procs.tcl,v diff -u -r1.5.8.1 -r1.5.8.2 --- openacs-4/packages/cms/tcl/rel-procs.tcl 31 Aug 2006 19:59:05 -0000 1.5.8.1 +++ openacs-4/packages/cms/tcl/rel-procs.tcl 19 Feb 2007 22:17:42 -0000 1.5.8.2 @@ -67,3 +67,63 @@ } } + +ad_proc -public cms::rel::valid_cr_item_rel_relation_p { + -item_id:required + -object_id:required +} { + Determine if target item can be related to item + @return boolean +} { + set content_type [content::item::content_type -item_id $item_id] + set target_type [content::item::content_type -item_id $object_id] + return [db_string valid_relation_p {} -default 0] +} + +ad_proc -public cms::rel::valid_cr_item_child_rel_relation_p { + -item_id:required + -object_id:required +} { + Determine if target item can be related to item + @return boolean +} { + set parent_type [content::item::content_type -item_id $item_id] + set child_type [content::item::content_type -item_id $object_id] + return [db_string valid_relation_p {} -default 0] +} + +ad_proc -public cms::rel::add_child { + -item_id:required + -object_id:required + -relation_tag:required + -relation_type:required + -order_n:required +} { + Add a child (object_id) to item_id. Why is this stuff not in the CR? +} { + set title "$relation_tag: $item_id - $object_id" + db_transaction { + set rel_id [package_exec_plsql -var_list \ + [list \ + [list object_id null ] \ + [list object_type cr_item_child_rel ] \ + [list creation_date null] \ + [list creation_user null] \ + [list creation_ip null] \ + [list context_id $item_id] \ + [list title $title] \ + ] acs_object new] + db_dml add_child {} + } +} + +ad_proc -public cms::rel::remove_child { + -rel_id:required +} { + Remove child +} { + db_transaction { + db_dml remove_child {} + package_exec_plsql -var_list [list rel_id $rel_id ] acs_rel delete + } +} Index: openacs-4/packages/cms/tcl/rel-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/rel-procs.xql,v diff -u -r1.2.8.1 -r1.2.8.2 --- openacs-4/packages/cms/tcl/rel-procs.xql 31 Aug 2006 19:59:05 -0000 1.2.8.1 +++ openacs-4/packages/cms/tcl/rel-procs.xql 19 Feb 2007 22:17:42 -0000 1.2.8.2 @@ -49,4 +49,52 @@ </querytext> </fullquery> +<fullquery name="cms::rel::valid_cr_item_rel_relation_p.valid_relation_p"> + <querytext> + select 1 + from cr_type_relations tr + where tr.content_type = :content_type + and tr.target_type = :target_type + and (tr.max_n is null + or (select count(*) from cr_item_rels + where item_id = :item_id + and relation_tag = tr.relation_tag) < tr.max_n) + and not exists (select 1 from cr_item_rels ir + where related_object_id = :object_id + and item_id = :item_id) + </querytext> +</fullquery> + +<fullquery name="cms::rel::valid_cr_item_child_rel_relation_p.valid_relation_p"> + <querytext> + select 1 + from cr_type_children tc + where tc.parent_type = :parent_type + and tc.child_type = :child_type + and (tc.max_n is null + or (select count(*) from cr_child_rels + where parent_id = :item_id + and relation_tag = tc.relation_tag) < tc.max_n) + and not exists (select 1 from cr_child_rels cr + where child_id = :object_id + and parent_id = :item_id) + </querytext> +</fullquery> + +<fullquery name="cms::rel::add_child.add_child"> + <querytext> + insert into cr_child_rels ( + rel_id, parent_id, child_id, relation_tag, order_n + ) values ( + :rel_id, :item_id, :object_id, :relation_tag, :order_n + ) + </querytext> +</fullquery> + +<fullquery name="cms::rel::remove_child.remove_child"> + <querytext> + delete from cr_child_rels where rel_id = :rel_id + </querytext> +</fullquery> + </queryset> Index: openacs-4/packages/cms/tcl/type-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/Attic/type-procs.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/tcl/type-procs.tcl 31 Aug 2006 19:59:05 -0000 1.1.2.1 +++ openacs-4/packages/cms/tcl/type-procs.tcl 19 Feb 2007 22:17:42 -0000 1.1.2.2 @@ -248,7 +248,7 @@ @return integer } { - return [package_exec_plsql -var_list [list [list content_type $content_type] [list content_method $content_method] \ + return [package_exec_plsql -var_list [list [list content_type $content_type] [list content_method $content_method]] \ content_method add_method] } Index: openacs-4/packages/cms/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/index.vuh,v diff -u -r1.2.12.1 -r1.2.12.2 --- openacs-4/packages/cms/www/index.vuh 9 Jun 2005 21:15:26 -0000 1.2.12.1 +++ openacs-4/packages/cms/www/index.vuh 19 Feb 2007 22:17:43 -0000 1.2.12.2 @@ -50,8 +50,7 @@ if { [template::util::is_nil template_id] } { cr_write_content -revision_id $revision_id } - set path "/templates/" - append path [content::template::get_path -template_id $template_id] + set path [content::template::get_path -template_id $template_id -root_folder_id $template_root] # put item_id into form so template can get it out ... # and then redirect to template Index: openacs-4/packages/cms/www/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/master.adp,v diff -u -r1.6.2.2 -r1.6.2.3 --- openacs-4/packages/cms/www/master.adp 31 Aug 2006 19:59:05 -0000 1.6.2.2 +++ openacs-4/packages/cms/www/master.adp 19 Feb 2007 22:17:43 -0000 1.6.2.3 @@ -8,7 +8,7 @@ } div#section-header { - background-color: grey; + background-color: #888888; color: white; font: bold; padding-left: 10px; @@ -56,8 +56,19 @@ </div> </else> - <if @section@ eq "categories"> + <if @section@ eq "sw-categories"> <div class="tab" id="subnavbar-here"> + Categories + </div> + </if> + <else> + <div class="tab"> + <a href="@package_url@modules/sw-categories/index" title="">Categories</a> + </div> + </else> + + <if @section@ eq "keywords"> + <div class="tab" id="subnavbar-here"> Keywords </div> </if> @@ -90,6 +101,17 @@ </div> </else> + <if @section@ eq "admin"> + <div class="tab" id="subnavbar-here"> + Admin + </div> + </if> + <else> + <div class="tab"> + <a href="@package_url@modules/admin/index" title="">Admin</a> + </div> + </else> + </div> </div> </div> Index: openacs-4/packages/cms/www/master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/master.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/cms/www/master.tcl 16 May 2005 22:59:24 -0000 1.4 +++ openacs-4/packages/cms/www/master.tcl 19 Feb 2007 22:17:43 -0000 1.4.2.1 @@ -4,6 +4,7 @@ set url [ad_conn url] set package_url [ad_conn package_url] +set package_id [ad_conn package_id] if {[template::util::is_nil mount_point]} { @@ -24,8 +25,12 @@ set section workspace } elseif {[string match *clipboard* $url]} { set section clipboard + } elseif {[string match *keywords* $url]} { + set section keywords + } elseif {[string match *sw-categories* $url]} { + set section sw-categories } elseif {[string match *categories* $url]} { - set section categories + set section keywords } elseif {[string match *users* $url]} { set section users } @@ -34,4 +39,4 @@ } -set clipboard_js "${package_url}modules/clipboard/clipboard.js" \ No newline at end of file +set clipboard_js "${package_url}modules/clipboard/clipboard.js" Index: openacs-4/packages/cms/www/modules/categories/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/categories/delete.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/cms/www/modules/categories/delete.tcl 31 Aug 2006 19:59:05 -0000 1.6.2.1 +++ openacs-4/packages/cms/www/modules/categories/delete.tcl 19 Feb 2007 22:17:43 -0000 1.6.2.2 @@ -11,7 +11,7 @@ # If nonempty, show error if { [string equal $is_empty "f"] } { - ad_complain "This category contains subcategories and cannot be deleted." + util_user_message -message "This category contains subcategories and cannot be deleted." } else { @@ -21,10 +21,9 @@ } # Remove it from the clipboard, if it exists - set clip [cms::clipboard::parse_cookie] - cms::clipboard::remove_item $clip $mount_point $id - cms::clipboard::set_cookie $clip - cms::clipboard::free $clip + set new_clip [cms::clipboard::remove_item [cms::clipboard::parse_cookie] $mount_point $id] + ad_set_cookie content_marks [cms::clipboard::reassemble_cookie $new_clip] + cms::clipboard::free $new_clip ad_returnredirect "index?id=$parent_id&mount_point=$mount_point" } Index: openacs-4/packages/cms/www/modules/clipboard/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/clipboard/index.tcl,v diff -u -r1.6.2.2 -r1.6.2.3 --- openacs-4/packages/cms/www/modules/clipboard/index.tcl 31 Aug 2006 19:59:05 -0000 1.6.2.2 +++ openacs-4/packages/cms/www/modules/clipboard/index.tcl 19 Feb 2007 22:17:43 -0000 1.6.2.3 @@ -55,31 +55,35 @@ label "Type" } path { - label "Path" + label "URL" } } template::multirow create marked_items item_id title type path item_url + set content_root [cm::modules::sitemap::getRootFolderID [ad_conn subsite_id]] + set template_root [cm::modules::templates::getRootFolderID [ad_conn subsite_id]] set item_list [cms::clipboard::get_items $clip $id] - ns_log notice " ------------------> $item_list" + foreach item $item_list { switch $id { sitemap - templates { set title [content::item::get_title -item_id $item] set type [content::item::content_type -item_id $item] - set path [content::item::get_path -item_id $item] switch $type { content_folder { set base_url "../${id}/index" set item_var folder_id + set path "/[content::item::get_path -item_id $item -root_folder_id $content_root]" } content_template { set base_url "../templates/properties" set item_var item_id + set path "/[content::item::get_path -item_id $item -root_folder_id $template_root]" } default { set base_url "../items/index" set item_var item_id + set path "/[content::item::get_path -item_id $item -root_folder_id $content_root]" } } } Index: openacs-4/packages/cms/www/modules/items/attributes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/attributes.tcl,v diff -u -r1.11.2.5 -r1.11.2.6 --- openacs-4/packages/cms/www/modules/items/attributes.tcl 31 Aug 2006 19:59:06 -0000 1.11.2.5 +++ openacs-4/packages/cms/www/modules/items/attributes.tcl 19 Feb 2007 22:17:43 -0000 1.11.2.6 @@ -28,7 +28,7 @@ # query the attributes for this content type -set content_type $type_info(object_type) +set content_type [content::item::get_content_type -item_id $info(item_id)] template::list::create \ -name attributes \ Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/items/categories.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/items/categories.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cms/www/modules/items/children.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/children.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/cms/www/modules/items/children.tcl 31 Aug 2006 19:59:06 -0000 1.7.2.1 +++ openacs-4/packages/cms/www/modules/items/children.tcl 19 Feb 2007 22:17:43 -0000 1.7.2.2 @@ -19,20 +19,23 @@ -options $child_types -widget select } +set relation cr_item_child_rel template::list::create \ -name children \ -key rel_id \ + -bulk_action_export_vars {item_id relation}\ -no_data "No child items" \ -multirow children \ -actions [list "Relate marked items to this item" \ - "relate-items?item_id=$item_id" \ + [export_vars -base relate-items {item_id relation mount_point}] \ "Relate marks items to this item"] \ -bulk_actions [list "Remove marked relations" \ - "[export_vars -base unrelate-item?mount_point=sitemap { rel_id }]" \ + [export_vars -base unrelate-item {item_id rel_id mount_point}] \ "Remove marked relations from this item"] \ -elements { title { label "Title" + display_template { @children.title;noquote@ } link_url_col title_url link_html { title "View child item" } } @@ -46,14 +49,15 @@ label "Tag" } reorder { - label "Move" - display_template "<nobr><a href=\"@children.move_up_url@\" title=\"Move item up\">up</a> | \ - <a href=\"@children.move_down_url@\" title=\"Move item down\">down</a></nobr>" + display_template { + <nobr><a href=\"@children.move_up_url@\" title=\"Move item up\" class=\"button\">Up</a> + <a href=\"@children.move_down_url@\" title=\"Move item down\" class=\"button\">Down</a></nobr> + } } } db_multirow -extend { title_url relation_view_url move_up_url move_down_url reorder } children get_children "" { - set title_url "index?item_id=$item_id&mount_point=$mount_point" + set title_url [export_vars -base index {item_id mount_point}] set move_up_url "relate-order?rel_id=$rel_id&order=up&mount_point=$mount_point&tab=children&relation_type=relation" set move_down_url "relate-order?rel_id=$rel_id&order=down&mount_point=$mount_point&tab=children&relation_type=relation" } Index: openacs-4/packages/cms/www/modules/items/create-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/create-2-postgresql.xql,v diff -u -r1.1 -r1.1.14.1 --- openacs-4/packages/cms/www/modules/items/create-2-postgresql.xql 25 May 2001 04:56:36 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/create-2-postgresql.xql 19 Feb 2007 22:17:43 -0000 1.1.14.1 @@ -7,7 +7,7 @@ <querytext> select - coalesce(content_item__get_path(:parent_id,null), '/') as item_path, + coalesce('/' || content_item__get_path(:parent_id, :content_root), '/') as item_path, pretty_name as content_type_name from acs_object_types Index: openacs-4/packages/cms/www/modules/items/create-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/create-2.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/cms/www/modules/items/create-2.tcl 31 Aug 2006 19:59:06 -0000 1.7.2.1 +++ openacs-4/packages/cms/www/modules/items/create-2.tcl 19 Feb 2007 22:17:43 -0000 1.7.2.2 @@ -22,6 +22,7 @@ request set_param page_title -datatype text -optional request set_param is_wizard -datatype keyword -value f +set content_root [cm::modules::sitemap::getRootFolderID [ad_conn subsite_id]] permission::require_permission -party_id [auth::require_login] \ -object_id $parent_id -privilege write Index: openacs-4/packages/cms/www/modules/items/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/index.adp,v diff -u -r1.7.2.5 -r1.7.2.6 --- openacs-4/packages/cms/www/modules/items/index.adp 15 Nov 2006 20:21:03 -0000 1.7.2.5 +++ openacs-4/packages/cms/www/modules/items/index.adp 19 Feb 2007 22:17:43 -0000 1.7.2.6 @@ -40,14 +40,14 @@ <div id=section> <div id=section-header>Related Items</div> <p/> - <include src="related-items" item_id="@item_id;noquote@"> + <include src="related-items" item_id="@item_id;noquote@" mount_point="@mount_point;noquote@"> </div> <p> <div id=section> <div id=section-header>Child Items</div> <p/> - <include src="children" item_id="@item_id;noquote@"> + <include src="children" item_id="@item_id;noquote@" mount_point="@mount_point;noquote@"> </div> <p> @@ -56,6 +56,14 @@ <if @tab@ eq categories> <div id=section> + <include src="categories" item_id="@item_id;noquote@" mount_point="@mount_point;noquote@"> + </div> + +</if> + +<if @tab@ eq keywords> + + <div id=section> <include src="keywords" item_id="@item_id;noquote@" mount_point="@mount_point;noquote@"> </div> Index: openacs-4/packages/cms/www/modules/items/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/index.tcl,v diff -u -r1.9.2.5 -r1.9.2.6 --- openacs-4/packages/cms/www/modules/items/index.tcl 15 Nov 2006 20:21:03 -0000 1.9.2.5 +++ openacs-4/packages/cms/www/modules/items/index.tcl 19 Feb 2007 22:17:43 -0000 1.9.2.6 @@ -9,7 +9,7 @@ { item_id:integer } { revision_id:integer,optional } { mount_point:optional "sitemap" } - { tab:optional "item" } + { tab:optional "revisions" } } set package_url [ad_conn package_url] @@ -75,6 +75,6 @@ } # send over to manage-items-2 to delete -set action delete +set list_action delete set folder_id $content_item(parent_id) set delete_url [export_vars -base ../sitemap/manage-items-2 {item_id mount_point folder_id action return_url}] Index: openacs-4/packages/cms/www/modules/items/item-tabs.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/item-tabs.adp,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/www/modules/items/item-tabs.adp 31 Aug 2006 19:59:06 -0000 1.1.2.1 +++ openacs-4/packages/cms/www/modules/items/item-tabs.adp 19 Feb 2007 22:17:43 -0000 1.1.2.2 @@ -2,7 +2,7 @@ <div id="subnavbar-container"> <div id="subnavbar"> - <if @tab@ eq item> +<!-- <if @tab@ eq item> <div class="tab" id="subnavbar-here"> Item </div> @@ -12,7 +12,7 @@ <a href="@package_url@modules/items/index?item_id=@item_id@&mount_point=sitemap&tab=item" title="" class="subnavbar-unselected">Item</a> </div> </else> - +--> <if @tab@ eq revisions> <div class="tab" id="subnavbar-here"> Revisions @@ -46,6 +46,17 @@ </div> </else> + <if @tab@ eq keywords> + <div class="tab" id="subnavbar-here"> + Keywords + </div> + </if> + <else> + <div class="tab"> + <a href="@package_url@modules/items/index?item_id=@item_id@&mount_point=sitemap&tab=keywords" title="" class="subnavbar-unselected">Keywords</a> + </div> + </else> + <if @tab@ eq templates> <div class="tab" id="subnavbar-here"> Templates Index: openacs-4/packages/cms/www/modules/items/one-revision.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/Attic/one-revision.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/www/modules/items/one-revision.tcl 31 Aug 2006 19:59:06 -0000 1.1.2.1 +++ openacs-4/packages/cms/www/modules/items/one-revision.tcl 19 Feb 2007 22:17:43 -0000 1.1.2.2 @@ -1,4 +1,4 @@ - +set content_p 1 switch $content_method { text_entry { set content [content::get_content_value $revision_id] @@ -12,4 +12,7 @@ set file_type file } } -} \ No newline at end of file + no_content { + set content_p 0 + } +} Fisheye: Tag 1.1.14.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/items/relate-items-2-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.14.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/items/relate-items-2-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2.8.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/items/relate-items-2.adp'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cms/www/modules/items/relate-items-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/relate-items-2.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/cms/www/modules/items/relate-items-2.tcl 31 Aug 2006 19:59:06 -0000 1.8.2.1 +++ openacs-4/packages/cms/www/modules/items/relate-items-2.tcl 19 Feb 2007 22:17:43 -0000 1.8.2.2 @@ -1,145 +1,60 @@ -# Step 2 in the relate item wizard - presents a custom form -# for each relation +ad_page_contract { -request create -params { - item_id -datatype integer - mount_point -datatype keyword -value sitemap -optional - rel_list -datatype text - page_title -datatype text -optional -value "Relate Items" - tab -datatype text -optional -value related + Relate target items to item_id + + @author Michael Steigman + @creation-date February 2007 +} { + { target_items:integer,multiple ""} + { item_id:integer } + { target_item_id:integer,array,optional } + { relate_p:array "" } + { relation_type:array "" } + { relation_tag:array "" } + { order_n:array "" } + { tab:optional "related" } } -# rel_list is a list of lists in form of -# {item_id relation_tag order_n relation_type} +set item_title [content::item::get_title -item_id $item_id] -permission::require_permission -party_id [auth::require_login] \ - -object_id $item_id -privilege write - -# Create the basic form -form create rel_form_2 - -element create rel_form_2 item_id -label "Item Id" \ - -widget hidden -datatype integer -value $item_id -element create rel_form_2 mount_point -label "Mount Point" \ - -widget hidden -datatype keyword -value $mount_point -optional -element create rel_form_2 rel_list -label "Rel List" \ - -widget hidden -datatype text -value $rel_list -element create rel_form_2 page_title -label "Page Title" \ - -widget hidden -datatype text -value $page_title - -# Create extra widgets; one widget for each relationship, and a -# multirow datasource that encompasses them all -upvar 0 "rel_attrs:rowcount" index -set index 0 - -set item_title [db_string get_title ""] - -# Create the main multirow datasource - -set form_complete 1 - -foreach rel $rel_list { - incr index - upvar 0 "rel_attrs:$index" rel_row - set rel_row(rownum) $index - - set related_id [lindex $rel 0] - set relation_tag [lindex $rel 1] - set order_n [lindex $rel 2] - set relation_type [lindex $rel 3] - - set rel_row(related_id) $related_id - set rel_row(relation_tag) $relation_tag - set rel_row(order_n) $order_n - set rel_row(relation_type) $relation_type - set rel_row(elements) [list] - set row(dmls) [list] - - # Get all elements, if any - # FIXME: - set content_type $relation_type - cms::form::query_form_metadata params multirow { - object_type <> 'cr_item_rel' - } - - if { ${params:rowcount} > 0 } { - - set form_complete 0 - - # Get the header - db_1row get_rel_info "" -column_array rel_info - - # Create the form section - form section rel_form_2 \ - "$rel_info(pretty_name) : $rel_info(item_title) relates to $rel_info(related_title)" - - element create rel_form_2 tag_info_$index -label "Relation Tag" \ - -datatype text -widget inform -value $rel_row(relation_tag) - - # Create all the custom elements - set j 1 - set last_table {} - set element_list [list] - while { 1 } { - upvar 0 "params:$j" el_row - template::util::array_to_vars el_row - lappend rel_row(elements) $attribute_name - - set j [cms::form::assemble_form_element params $attribute_name $j] - ns_log notice "$j : $attribute_name, $code_params" - eval "template::element create rel_form_2 ${attribute_name}_$index $code_params" - - if { $j > ${params:rowcount} } { - break - } - +set num_related 0 +# loop through target items, check if they can be related +# - if possible, do so. tell the user in either case. +foreach target_item_num $target_items { + if { [info exists relate_p($target_item_num)] } { + set target_title [content::item::get_title -item_id $target_item_id($target_item_num)] + set relation [lindex [array get relation_type $target_item_num] 1] + set proc "valid_${relation}_relation_p" + if { [cms::rel::${proc} -item_id $item_id -object_id $target_item_id($target_item_num)] } { + switch $relation { + cr_item_rel { + cms::rel::sort_related_item_order $item_id + content::item::relate -item_id $item_id \ + -object_id $target_item_id($target_item_num) \ + -relation_tag $relation_tag($target_item_num) \ + -relation_type $relation_type($target_item_num) \ + -order_n $order_n($target_item_num) + } + cr_item_child_rel { + cms::rel::sort_child_item_order $item_id + cms::rel::add_child -item_id $item_id \ + -object_id $target_item_id($target_item_num) \ + -relation_tag $relation_tag($target_item_num) \ + -relation_type $relation_type($target_item_num) \ + -order_n $order_n($target_item_num) + } + } + util_user_message -message "Related $target_title to $item_title" + incr num_related + } else { + util_user_message -message "Could not relate $target_title to $item_title" + } } - } } - - -# Process the form -if { [form is_valid rel_form_2] || $form_complete } { - - # sort order_n for all related items for consistency - form get_values rel_form_2 item_id - cms::rel::sort_related_item_order $item_id - - - db_transaction { - - unset row - - for { set i 1 } { $i <= ${rel_attrs:rowcount} } {incr i} { - upvar 0 "rel_attrs:$i" row - template::util::array_to_vars row - - # Insert the basic data - - # Insert at the end if no order - if { [template::util::is_nil order_n] } { - set order_n [db_string get_order ""] - } - - # Perform the insertion - set rel_id [db_exec_plsql relate {}] - - # Insert any extra attributes - if { [llength $elements] > 0 } { - set attr_list [template::util::tcl_to_sql_list $elements] - ns_log notice "$i : $attr_list" - cms::form::insert_element_data rel_form_2 $relation_type \ - [list acs_object cr_item_rel] $rel_id "_$i" \ - " attribute_name in ($attr_list)" - } - } - } - - ad_returnredirect [export_vars -index { item_id mount_point tab }] - ad_script_abort +if { $num_related == 0 } { + util_user_message -message "Unable to relate any items" } - - +ad_returnredirect [export_vars -base index {item_id tab}] Fisheye: Tag 1.1.14.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/items/relate-items-2.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cms/www/modules/items/relate-items-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/relate-items-oracle.xql,v diff -u -r1.1 -r1.1.14.1 --- openacs-4/packages/cms/www/modules/items/relate-items-oracle.xql 25 May 2001 04:56:36 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/relate-items-oracle.xql 19 Feb 2007 22:17:43 -0000 1.1.14.1 @@ -3,32 +3,18 @@ <queryset> <rdbms><type>oracle</type><version>8.1.6</version></rdbms> -<fullquery name="get_item_info"> +<fullquery name="get_relation_type_options"> <querytext> select - content_item.get_title(i.item_id) as title, - i.content_type - from - cr_items i - where - i.item_id = :item_id - </querytext> -</fullquery> - - -<fullquery name="get_options"> - <querytext> - - select - lpad(' ', level, '-') || pretty_name as pretty_name, + pretty_name, object_type from acs_object_types connect by prior object_type = supertype start with - object_type = 'cr_item_rel' + object_type = :relation </querytext> </fullquery> Index: openacs-4/packages/cms/www/modules/items/relate-items-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/relate-items-postgresql.xql,v diff -u -r1.4 -r1.4.12.1 --- openacs-4/packages/cms/www/modules/items/relate-items-postgresql.xql 25 Sep 2002 16:12:11 -0000 1.4 +++ openacs-4/packages/cms/www/modules/items/relate-items-postgresql.xql 19 Feb 2007 22:17:43 -0000 1.4.12.1 @@ -3,30 +3,14 @@ <queryset> <rdbms><type>postgresql</type><version>7.1</version></rdbms> -<fullquery name="get_item_info"> +<fullquery name="get_relation_type_options"> <querytext> - - select - content_item__get_title(i.item_id,'f') as title, - i.content_type - from - cr_items i - where - i.item_id = :item_id - </querytext> -</fullquery> - - -<fullquery name="get_options"> - <querytext> - select - lpad(' ', tree_level(ot1.tree_sortkey), '-') || ot1.pretty_name as pretty_name, - ot1.object_type + ot1.pretty_name, ot1.object_type from acs_object_types ot1, acs_object_types ot2 - where ot2.object_type = 'cr_item_rel' + where ot2.object_type = :relation and ot1.tree_sortkey between ot2.tree_sortkey and tree_right(ot2.tree_sortkey) </querytext> Index: openacs-4/packages/cms/www/modules/items/relate-items.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/relate-items.adp,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/cms/www/modules/items/relate-items.adp 31 Aug 2006 19:59:06 -0000 1.3.2.1 +++ openacs-4/packages/cms/www/modules/items/relate-items.adp 19 Feb 2007 22:17:43 -0000 1.3.2.2 @@ -8,27 +8,37 @@ <div id="subnavbar-body"> <div id=section> - <div id=section-header>@page_title@ (Step 1)</div> - <p/> - <a href="index?item_id=@item_id@">@item_title@</a> - <hr> - <if @no_items_on_clipboard@ eq "t"> - <p>No items are currently available for relating. Please mark - your choices and return to this form.</p> + <div id=section-header>@page_title@</div> + <p></p> + + <if @target_items:rowcount@ gt 0> + <form action="relate-items-2" method="post"> + <table class="list" cellpadding="3" cellspacing="1"> + <tr class="list-header"> + <th class="list" align="left"></td> + <th class="list" align="left">Title</td> + <th class="list" align="left">Type</td> + <th class="list" align="left">Tag</td> + <th class="list" align="left">Order</td> + </tr> + <multiple name=target_items> + <tr class="<if @target_items.rownum@ even>list-even</if><else>list-odd</else><if @target_items.rownum@ eq @target_items:rowcount@> last</if>"> + <input type="hidden" name="target_item_id.@target_items.rownum@" value="@target_items.item_id@"> + <input type="hidden" name="target_items" value="@target_items.rownum@"> + <td class="list" align="left"><input name="relate_p.@target_items.rownum@" type="checkbox"></td> + <td class="list" align="left">@target_items.title;noquote@</td> + <td class="list" align="left">@target_items.type_options;noquote@</td> + <td class="list" align="left">@target_items.tag_options;noquote@</td> + <td class="list" align="left"><input name="order_n.@target_items.rownum@" type="text" size="1"></td> + </tr> + </multiple> + <input type="hidden" name="item_id" value="@item_id@"> + </table> + <p> + <input type="submit" value="Relate Checked Items"> + </form> </if> - <else> - <if @no_valid_items@ eq "t"> - <p>None of the marked items may be related to "@item_title@"</p> - </if> - <else> - <formtemplate id=rel_form style=grid cols=8 - headers="Check Title Type Tag Order" title="Choose items to relate"></formtemplate> - </else> - </else> + </div> </div> - - - - Index: openacs-4/packages/cms/www/modules/items/relate-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/relate-items.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/cms/www/modules/items/relate-items.tcl 31 Aug 2006 19:59:06 -0000 1.6.2.1 +++ openacs-4/packages/cms/www/modules/items/relate-items.tcl 19 Feb 2007 22:17:43 -0000 1.6.2.2 @@ -2,155 +2,69 @@ # and confirm that the user wishes to link them all to the current item request create -params { item_id -datatype integer - mount_point -datatype keyword -value sitemap + relation -datatype text -optional -value cr_item_rel + mount_point -datatype text -value sitemap + tab -datatype text -value related } permission::require_permission -party_id [auth::require_login] \ -object_id $item_id -privilege write -######################## BASIC PHASE: create default elements ################### +set page_title "Relate Items to [content::item::get_title -item_id $item_id]" +set content_type [content::item::content_type -item_id $item_id] - # Get the item title and type - db_1row get_item_info "" -column_array item_info +# get related items from the clipboard +set clip [cms::clipboard::parse_cookie] +set items [cms::clipboard::get_items $clip $mount_point] - set item_title $item_info(title) - set item_type $item_info(content_type) - set page_title "Relate Items to \"$item_title\"" +set type_options_list [db_list_of_lists get_relation_type_options {}] - # get related items from the clipboard - set clip [cms::clipboard::parse_cookie] - set items [cms::clipboard::get_items $clip $mount_point] - - # If no items are clipped, abort - if { [llength $items] < 1 } { - set no_items_on_clipboard t - return - } else { - set no_items_on_clipboard f - } - - # Get all possible relation types - set type_options [db_list_of_lists get_options ""] - - # Prepare the query - set sql_items "('" - append sql_items [join $items "','"] - append sql_items "')" - - - - db_multirow clip_items get_clip_items "" - - if { ${clip_items:rowcount} < 1} { - set no_valid_items t - return - } else { - set no_valid_items f - } - - # Process the query - cms::clipboard::ui::form_create rel_form - - # A short proc to add a row - proc add_row { } { - uplevel { - upvar 0 "clip_items:[expr $j - 1]" prev_row - cms::clipboard::ui::add_row rel_form $mount_point $prev_row(related_id) $prev_row(title) -checked - cms::clipboard::ui::element_create rel_form path -datatype text -widget hidden \ - -value $prev_row(path) - cms::clipboard::ui::element_create rel_form relation_type -datatype keyword -widget select \ - -options $type_options - cms::clipboard::ui::element_create rel_form relation_tag -datatype text -widget select \ - -options $item_tags - cms::clipboard::ui::element_create rel_form order_n -datatype integer -widget text \ - -html { size 3 } -optional +set target_item_num 0 +multirow create target_items item_id title type_options tag_options +if { $relation eq "cr_item_rel" } { + foreach clipped_item $items { + if {[cms::rel::valid_item_relation_p -item_id $item_id -target_item_id $clipped_item]} { + incr target_item_num + set target_type [content::item::content_type -item_id $clipped_item] + set tag_options "\n<select name=relation_tag.$target_item_num>\n" + foreach option [db_list ${relation}_tag_options {}] { + append tag_options "<option value=$option>$option</option>\n" + } + append tag_options "</select>" + + set type_options "\n<select name=relation_type.$target_item_num>\n" + foreach type_option $type_options_list { + append type_options "<option value=\"[lindex $type_option 1]\">[lindex $type_option 0]</option>\n" + } + append type_options "</select>" + + multirow append target_items $clipped_item "[content::item::get_title -item_id $clipped_item]" $type_options $tag_options + } } - } - - for { set j 1 } { $j <= ${clip_items:rowcount}} {incr j} { - upvar 0 "clip_items:$j" clip_row - - if { $j == 1 } { - - set prev_item $clip_row(related_id) - set item_tags [list [list $clip_row(relation_tag) $clip_row(relation_tag)]] - - } elseif { $prev_item != $clip_row(related_id) && [llength $item_tags] > 0 } { - - # Apppend another row - add_row - - set item_tags [list [list $clip_row(relation_tag) $clip_row(relation_tag)]] - set prev_item $clip_row(related_id) - - } else { - - # Append a tag - lappend item_tags [list $clip_row(relation_tag) $clip_row(relation_tag)] +} else { + # $relation eq "cr_item_child_rel" + foreach clipped_item $items { + if {[cms::rel::valid_child_relation_p -item_id $item_id -child_item_id $clipped_item]} { + incr target_item_num + set child_type [content::item::content_type -item_id $clipped_item] + set tag_options "\n<select name=relation_tag.$target_item_num>\n" + foreach option [db_list ${relation}_tag_options {}] { + append tag_options "<option value=$option>$option</option>\n" + } + append tag_options "</select>" + + set type_options "\n<select name=relation_type.$target_item_num>\n" + foreach type_option $type_options_list { + append type_options "<option value=\"[lindex $type_option 1]\">[lindex $type_option 0]</option>\n" + } + append type_options "</select>" + + multirow append target_items $clipped_item "[content::item::get_title -item_id $clipped_item]" $type_options $tag_options + } } +} - } - - # Add the last row - add_row - - # Add passthrough - element create rel_form item_id -label "Item ID" \ - -datatype integer -widget hidden -param - element create rel_form mount_point -label "Mount Point" \ - -datatype keyword -widget hidden -param -optional -value sitemap - element create rel_form next_button -label "Next >>" \ - -widget submit -datatype text - element create rel_form checked_rows -label "Checked Rows" \ - -widget hidden -datatype text -optional - element create rel_form phase -label "Phase" \ - -widget hidden -datatype keyword -value "basic" - element create rel_form item_title -label "Item Title" \ - -widget hidden -datatype text -value $item_title - element create rel_form item_type -label "Item Type" \ - -widget hidden -datatype keyword -value $item_type - - # See if any items were valid for relating - if { ![info exists rel_form_data:rowcount] || ${rel_form_data:rowcount} < 1 } { - set no_valid_items t - return - } else { - set no_valid_items f - } - - # Process the form - remember which rows were checked, prepare - # hidden variables - if { [form is_valid rel_form] } { - set rel_list [list] - set source_id $item_id - - db_transaction { - cms::clipboard::ui::process_form rel_form { - if { $row(checked) } { - - template::util::array_to_vars row - - lappend rel_list [list $item_id $relation_tag $order_n $relation_type] - } - } - } - - # If no rows are checked, we're done - if { [llength $rel_list] < 1 } { - template::forward "index?item_id=$source_id&mount_point=$mount_point" - return - } - - # There are checked rows - create a custom form for each row - template::forward "relate-items-2?item_id=$source_id&mount_point=$mount_point&rel_list=$rel_list&page_title=$page_title" - - } - - - - - - - - - +if { $target_item_num eq 0 } { + ad_returnredirect -message "No valid items on clipboard" [export_vars -base index {item_id tab}] + ad_script_abort +} Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/items/relate-items.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cms/www/modules/items/relate-order.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/relate-order.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/cms/www/modules/items/relate-order.tcl 31 Aug 2006 19:59:06 -0000 1.7.2.1 +++ openacs-4/packages/cms/www/modules/items/relate-order.tcl 19 Feb 2007 22:17:43 -0000 1.7.2.2 @@ -73,5 +73,5 @@ } } -ad_returnredirect [export_vars -base $return_url tab] +ad_returnredirect [export_vars -base $return_url {tab item_id}] ad_script_abort Index: openacs-4/packages/cms/www/modules/items/related-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/related-items.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/cms/www/modules/items/related-items.tcl 31 Aug 2006 19:59:06 -0000 1.7.2.1 +++ openacs-4/packages/cms/www/modules/items/related-items.tcl 19 Feb 2007 22:17:43 -0000 1.7.2.2 @@ -19,20 +19,23 @@ -options $related_types -widget select } +set relation cr_item_rel template::list::create \ -name related \ -key rel_id \ + -bulk_action_export_vars {item_id relation}\ -no_data "No related items" \ -multirow related \ -actions [list "Relate marked items to this item" \ - [export_vars -base relate-items {item_id tab mount_point}] \ + [export_vars -base relate-items {item_id tab mount_point relation}] \ "Relate marks items to this item"] \ -bulk_actions [list "Remove marked relations" \ [export_vars -base unrelate-item { rel_id mount_point}] \ "Remove marked relations from this item"] \ -elements { title { label "Title" + display_template { @related.title;noquote@ } link_url_col title_url link_html { title "View related item" } } @@ -46,9 +49,10 @@ label "Tag" } reorder { - label "Move" - display_template "<nobr><a href=\"@related.move_up_url@\" title=\"Move item up\">up</a> | \ - <a href=\"@related.move_down_url@\" title=\"Move item down\">down</a></nobr>" + display_template { + <nobr><a href=\"@related.move_up_url@\" title=\"Move item up\" class=\"button\">Move up</a> + <a href=\"@related.move_down_url@\" title=\"Move item down\" class=\"button\">Move down</a></nobr> + } } } Index: openacs-4/packages/cms/www/modules/items/rename.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/rename.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/cms/www/modules/items/rename.tcl 31 Aug 2006 19:59:06 -0000 1.8.2.1 +++ openacs-4/packages/cms/www/modules/items/rename.tcl 19 Feb 2007 22:17:43 -0000 1.8.2.2 @@ -19,7 +19,7 @@ } elseif { $content_type eq "image" } { cms::image::get -image_id $item_id } else { - content::item::get -item_id $item_id + content::item::get -item_id $item_id -revision latest } set name $content_item(name) @@ -52,7 +52,7 @@ element create rename_item name \ -label "Rename $name to" \ - -datatype keyword \ + -datatype text \ -widget text \ -html { size 20 } \ -validate { { expr ![string match $value "/"] } \ @@ -68,7 +68,7 @@ # handle file system stuff for templates if { $content_type eq "content_template" } { - cms::template::rename -template_id $template_id -name $name + #cms::template::rename -template_id $item_id -name $name } content::item::rename -item_id $item_id -name $name Index: openacs-4/packages/cms/www/modules/items/revision-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/revision-add-2.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/cms/www/modules/items/revision-add-2.tcl 31 Aug 2006 19:59:06 -0000 1.7.2.1 +++ openacs-4/packages/cms/www/modules/items/revision-add-2.tcl 19 Feb 2007 22:17:43 -0000 1.7.2.2 @@ -59,7 +59,6 @@ if { [form is_valid add_revision] } { form get_values add_revision item_id - ns_log notice "WHAT THE FUCK ????" # autoprocess the revision form cms::form::add_revision add_revision Index: openacs-4/packages/cms/www/modules/items/revision-handler.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/Attic/revision-handler.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/cms/www/modules/items/revision-handler.tcl 1 Sep 2006 21:41:28 -0000 1.1.2.2 +++ openacs-4/packages/cms/www/modules/items/revision-handler.tcl 19 Feb 2007 22:17:43 -0000 1.1.2.3 @@ -5,13 +5,13 @@ } { { item_id:integer } { revision_id:integer,multiple } - { action:optional "view" } + { list_action:optional "view" } { mount_point:optional "sitemap" } { tab:optional "revisions" } { return_url } } -if { $action eq "view" } { +if { $list_action eq "view" } { set revision_name [content::revision::revision_name -revision_id $revision_id] util_user_message -message "$revision_name. Select \"Author Revision\" to base a new revision on this revision." if { $mount_point eq "templates" } { Index: openacs-4/packages/cms/www/modules/items/template-register.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/template-register.tcl,v diff -u -r1.4.12.2 -r1.4.12.3 --- openacs-4/packages/cms/www/modules/items/template-register.tcl 31 Aug 2006 19:59:06 -0000 1.4.12.2 +++ openacs-4/packages/cms/www/modules/items/template-register.tcl 19 Feb 2007 22:17:43 -0000 1.4.12.3 @@ -14,6 +14,8 @@ set clip [cms::clipboard::parse_cookie] set templates [cms::clipboard::get_items $clip templates] +set template_root [cm::modules::templates::getRootFolderID [ad_conn subsite_id]] + # if no templates are clipped, send user a message and abort if { [llength $templates] < 1 } { util_user_message -message "There are no templates on the clipboard" @@ -29,7 +31,7 @@ if { [llength $templates] > 1 } { set options [list] foreach template_id $templates { - set path [content::template::get_path -template_id $template_id] + set path "/[content::template::get_path -template_id $template_id -root_folder_id $template_root]" lappend options [list $path $template_id] } ad_form -extend -name select_template -form { @@ -39,7 +41,7 @@ } } else { - set path [content::template::get_path -template_id $templates] + set path "/[content::template::get_path -template_id $templates -root_folder_id $template_root]" ad_form -extend -name select_template -form { {path:text(inform) {label "Template"} Index: openacs-4/packages/cms/www/modules/items/templates-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/templates-postgresql.xql,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/cms/www/modules/items/templates-postgresql.xql 23 May 2005 01:50:23 -0000 1.4.2.1 +++ openacs-4/packages/cms/www/modules/items/templates-postgresql.xql 19 Feb 2007 22:17:43 -0000 1.4.2.2 @@ -24,7 +24,7 @@ select template_id, use_context, - content_item__get_path( template_id, null ) as path, + '/' || content_item__get_path( template_id, :template_root ) as path, acs_permission__permission_p( template_id, :user_id, 'read') as can_read_template from @@ -43,7 +43,7 @@ select template_id, use_context, is_default, - content_item__get_path( template_id, null ) as path, + '/' || content_item__get_path( template_id, :template_root ) as path, acs_permission__permission_p( template_id, :user_id, 'read') as can_read_template, (select 1 Index: openacs-4/packages/cms/www/modules/items/templates.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/templates.adp,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/cms/www/modules/items/templates.adp 31 May 2005 04:55:51 -0000 1.3.2.1 +++ openacs-4/packages/cms/www/modules/items/templates.adp 19 Feb 2007 22:17:43 -0000 1.3.2.2 @@ -1,7 +1,7 @@ Templates Registered to content item "@iteminfo.name@": -<listtemplate name="registered_templates"></listtemplate> +<listtemplate name="item_templates"></listtemplate> <p> </p> Index: openacs-4/packages/cms/www/modules/items/templates.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/templates.tcl,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/cms/www/modules/items/templates.tcl 31 May 2005 04:55:51 -0000 1.5.2.1 +++ openacs-4/packages/cms/www/modules/items/templates.tcl 19 Feb 2007 22:17:43 -0000 1.5.2.2 @@ -21,10 +21,11 @@ db_1row get_iteminfo "" -column_array iteminfo set content_type $iteminfo(object_type) +set template_root [cm::modules::templates::getRootFolderID [ad_conn subsite_id]] template::list::create \ - -name registered_templates \ - -multirow registered_templates \ + -name item_templates \ + -multirow item_templates \ -actions [list "Assign marked templates to this item" \ [export_vars -base template-register {item_id}] \ "Assign marked templates to this item"] \ @@ -38,15 +39,14 @@ label "Use Context" } action { - label "Action" display_template { - <if @registered_templates.unreg_url@ not nil><a href=@registered_templates.unreg_url@>unregister</a></if> + <if @item_templates.unreg_url@ not nil><a href=@item_templates.unreg_url@ class=button>Unregister</a></if> } } } # templates registered to this item -db_multirow -extend {unreg_url context} registered_templates get_reg_templates {} { +db_multirow -extend {unreg_url context} item_templates get_reg_templates {} { if { [permission::permission_p -party_id $user_id -object_id $item_id -privilege write] } { set context $use_context set unreg_url [export_vars -base template-unregister {item_id template_id context}] @@ -90,9 +90,9 @@ # templates registered to this content type db_multirow -extend { set_default_url register_template_url} type_templates get_type_templates {} { set context $use_context - if {$can_read_template && $can_set_default_template} { + if {!$is_default && $can_read_template && $can_set_default_template} { set set_default_url [export_vars -base ../types/set-default-template {template_id context content_type return_url}] - if {[string match $already_registered_p f] && {$registered_templates:rowcount == 0}} { + if {[string match $already_registered_p f] && {$item_templates:rowcount == 0}} { set register_template_url [export_vars -base template-register {item_id template_id context return_url}] } else { set register_template_url "" Index: openacs-4/packages/cms/www/modules/items/unpublish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/unpublish.tcl,v diff -u -r1.2.14.2 -r1.2.14.3 --- openacs-4/packages/cms/www/modules/items/unpublish.tcl 31 Aug 2006 19:59:06 -0000 1.2.14.2 +++ openacs-4/packages/cms/www/modules/items/unpublish.tcl 19 Feb 2007 22:17:43 -0000 1.2.14.3 @@ -5,7 +5,7 @@ } { { item_id:naturalnum } { mount_point "sitemap" } - { tab:optional "item" } + { tab:optional "revisions" } } content::item::unset_live_revision -item_id $item_id Index: openacs-4/packages/cms/www/modules/items/unrelate-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/unrelate-item.tcl,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/cms/www/modules/items/unrelate-item.tcl 31 Aug 2006 19:59:06 -0000 1.9.2.1 +++ openacs-4/packages/cms/www/modules/items/unrelate-item.tcl 19 Feb 2007 22:17:43 -0000 1.9.2.2 @@ -5,26 +5,29 @@ @creation-date October 2004 } { { rel_id:integer,multiple } + { item_id:integer } + { relation } { mount_point:optional "sitemap" } { return_url:optional "index" } { tab:optional "related" } } -set item_id "" +set rel_table [ad_decode $relation cr_item_rel cr_item_rels cr_item_child_rel cr_child_rels ""] foreach rel $rel_id { - - # Get the item_id; determine if the relationship exists - set item_id [db_string get_item_id "" -default ""] - if { [string equal $item_id ""] } { - db_abort_transaction - ad_return_complaint "The relationship $rel_id does not exist." + # determine if the relationship exists + if { [db_string rel_exists_p {} -default 0] } { + # check permissions + permission::require_permission -party_id [auth::require_login] \ + -object_id $item_id -privilege write + if { $relation eq "cr_item_rel" } { + content::item::unrelate -rel_id $rel + } else { + cms::rel::remove_child -rel_id $rel + } + } else { + ad_return_complaint 0 "The relationship $rel_id does not exist." ad_script_abort - } - # Check permissions - permission::require_permission -party_id [auth::require_login] \ - -object_id $item_id -privilege write - content::item::unrelate -rel_id $rel - + } } ad_returnredirect [export_vars -base $return_url {item_id mount_pount tab}] Index: openacs-4/packages/cms/www/modules/items/unrelate-item.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/unrelate-item.xql,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/cms/www/modules/items/unrelate-item.xql 16 Nov 2004 22:32:48 -0000 1.2 +++ openacs-4/packages/cms/www/modules/items/unrelate-item.xql 19 Feb 2007 22:17:43 -0000 1.2.2.1 @@ -1,17 +1,10 @@ <?xml version="1.0"?> <queryset> -<fullquery name="abort"> +<fullquery name="rel_exists_p"> <querytext> - abort transaction - </querytext> -</fullquery> - - -<fullquery name="get_item_id"> - <querytext> - select item_id from cr_item_rels where rel_id = :rel + select 1 from $rel_table where rel_id = :rel </querytext> </fullquery> Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/items/view.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/items/view.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cms/www/modules/sitemap/folder-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/Attic/folder-delete.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/www/modules/sitemap/folder-delete.tcl 31 Aug 2006 19:59:06 -0000 1.1.2.1 +++ openacs-4/packages/cms/www/modules/sitemap/folder-delete.tcl 19 Feb 2007 22:17:43 -0000 1.1.2.2 @@ -25,7 +25,7 @@ # Remove it from the clipboard, if it exists set clip [cms::clipboard::parse_cookie] cms::clipboard::remove_item $clip $mount_point $folder_id - cms::clipboard::set_cookie $clip + ad_set_cookie content_marks [cms::clipboard::reassemble_cookie $clip] cms::clipboard::free $clip # Redirect to parent folder Index: openacs-4/packages/cms/www/modules/sitemap/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/index.tcl,v diff -u -r1.12.2.2 -r1.12.2.3 --- openacs-4/packages/cms/www/modules/sitemap/index.tcl 31 Aug 2006 19:59:06 -0000 1.12.2.2 +++ openacs-4/packages/cms/www/modules/sitemap/index.tcl 19 Feb 2007 22:17:43 -0000 1.12.2.3 @@ -114,10 +114,10 @@ \"Delete Folder\" [export_vars -base folder-delete {mount_point folder_id parent_id}] \"Delete this folder\" \"Edit Folder Info\" [export_vars -base folder-ae?mount_point=sitemap {folder_id return_url}] \"Edit folder information\" \"New Folder\" [export_vars -base folder-ae?parent_id=$folder_id {mount_point return_url}] \"Create a new folder within this folder\" -\"Move Items\" [export_vars -base manage-items?action=move {mount_point folder_id return_url}] \"Move marked items to this folder\" -\"Copy Items\" [export_vars -base manage-items?action=copy {mount_point folder_id return_url}] \"Copy marked items to this folder\" -\"Link Items\" [export_vars -base manage-items?action=link {mount_point folder_id return_url}] \"Link marked items to this folder\" -\"Delete Items\" [export_vars -base manage-items?action=delete {mount_point folder_id return_url}] \"Delete marked items\" +\"Move Items\" [export_vars -base manage-items?list_action=move {mount_point folder_id return_url}] \"Move marked items to this folder\" +\"Copy Items\" [export_vars -base manage-items?list_action=copy {mount_point folder_id return_url}] \"Copy marked items to this folder\" +\"Link Items\" [export_vars -base manage-items?list_action=link {mount_point folder_id return_url}] \"Link marked items to this folder\" +\"Delete Items\" [export_vars -base manage-items?list_action=delete {mount_point folder_id return_url}] \"Delete marked items\" " } Index: openacs-4/packages/cms/www/modules/sitemap/manage-items-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/Attic/manage-items-2.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/www/modules/sitemap/manage-items-2.tcl 31 Aug 2006 19:59:06 -0000 1.1.2.1 +++ openacs-4/packages/cms/www/modules/sitemap/manage-items-2.tcl 19 Feb 2007 22:17:43 -0000 1.1.2.2 @@ -6,7 +6,7 @@ } { { folder_id:integer } { item_id:multiple } - { action } + { list_action } { mount_point } { return_url } } @@ -17,29 +17,29 @@ set actions_completed 0 foreach item_id $item_id_list { set content_type [content::item::content_type -item_id $item_id] - switch $action { + switch $list_action { move - copy { if { [lsearch [cms::folder::get_registered_types $folder_id list] $content_type] > -1 } { if { [ catch { switch $content_type { content_symlink { - if { $action eq "copy" } { + if { $list_action eq "copy" } { content::symlink::copy -target_folder_id $folder_id -symlink_id $item_id } else { lappend errors "Content symlinks cannot be moved." continue } } content_template { - if { $action eq "move" } { + if { $list_action eq "move" } { cms::template::move -target_folder_id $folder_id -template_id $item_id content::item::move -target_folder_id $folder_id -item_id $item_id } else { content::item::copy -target_folder_id $folder_id -item_id $item_id } } default { - content::item::${action} -target_folder_id $folder_id -item_id $item_id + content::item::${list_action} -target_folder_id $folder_id -item_id $item_id } } } err ] } { Index: openacs-4/packages/cms/www/modules/sitemap/manage-items-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/Attic/manage-items-postgresql.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/www/modules/sitemap/manage-items-postgresql.xql 31 Aug 2006 19:59:06 -0000 1.1.2.1 +++ openacs-4/packages/cms/www/modules/sitemap/manage-items-postgresql.xql 19 Feb 2007 22:17:43 -0000 1.1.2.2 @@ -7,7 +7,7 @@ <querytext> select content_item__get_title(item_id, 'f') as title, - content_item__get_path(item_id,:root_id) as path, + '/' || content_item__get_path(item_id,:root_id) as path, item_id, parent_id from cr_items where item_id in ([join $clip_items ","]) Index: openacs-4/packages/cms/www/modules/sitemap/manage-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/Attic/manage-items.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/www/modules/sitemap/manage-items.tcl 31 Aug 2006 19:59:06 -0000 1.1.2.1 +++ openacs-4/packages/cms/www/modules/sitemap/manage-items.tcl 19 Feb 2007 22:17:43 -0000 1.1.2.2 @@ -8,13 +8,13 @@ @creation-date March 2006 } { { folder_id:integer } - { action } + { list_action } { mount_point:optional "sitemap" } { return_url } } cms::folder::get -folder_id $folder_id -switch $action { +switch $list_action { move { set action_title "Move Items" set title "Move Items to $folder_info(label)" @@ -53,12 +53,12 @@ -multirow marked_items \ -key item_id \ -bulk_actions [list "$action_title" \ - "[export_vars -base manage-items-2 {mount_point action folder_id}]" \ + "[export_vars -base manage-items-2 {mount_point list_action folder_id}]" \ "$title" \ "Cancel" \ "$return_url" \ "Cancel action and return to previous page"] \ - -bulk_action_export_vars { folder_id action mount_point return_url } \ + -bulk_action_export_vars { folder_id list_action mount_point return_url } \ -elements { title { label "Title" @@ -68,7 +68,7 @@ label "Content Type" } path { - label "Path" + label "URL" } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/sw-categories/index.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/sw-categories/index.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cms/www/modules/templates/properties.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/properties.tcl,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/cms/www/modules/templates/properties.tcl 31 Aug 2006 19:59:07 -0000 1.5.2.1 +++ openacs-4/packages/cms/www/modules/templates/properties.tcl 19 Feb 2007 22:17:44 -0000 1.5.2.2 @@ -9,7 +9,7 @@ { revision_id:integer,optional } { path:optional "" } { mount_point "templates"} - { tab:optional "template"} + { tab:optional "revisions"} } set template_id $item_id set user_id [auth::require_login] @@ -43,7 +43,7 @@ set return_url [ad_return_url] set revise_url [export_vars -base template-ae {template_id revision_id mount_point tab return_url}] set rename_url [export_vars -base ../items/rename {item_id mount_point tab return_url}] -set upload_url [export_vars -base upload {template_id tab return_url}] +set upload_url [export_vars -base upload {template_id revision_id tab return_url}] set download_url [export_vars -base download {template_id tab return_url}] # send over to manage-items-2 to delete Index: openacs-4/packages/cms/www/modules/templates/publish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/publish.tcl,v diff -u -r1.3.12.1 -r1.3.12.2 --- openacs-4/packages/cms/www/modules/templates/publish.tcl 31 Aug 2006 19:59:07 -0000 1.3.12.1 +++ openacs-4/packages/cms/www/modules/templates/publish.tcl 19 Feb 2007 22:17:44 -0000 1.3.12.2 @@ -11,11 +11,11 @@ # write the template to the file system set text [content::get_content_value $revision_id] -set template_root [cm::modules::templates::getRootFolderID [ad_conn subsite_id]] -set path [content::template::get_path -template_id $template_id -root_folder_id $template_root] +set path "/templates/" +append path [content::template::get_path -template_id $template_id -root_folder_id "-100"] if { [ catch { - util::write_file [acs_root_dir]/templates/$path.adp $text + util::write_file [acs_root_dir]$path.adp $text content::item::set_live_revision -revision_id $revision_id } err ] } { util_user_message -message "There was an error writing the file and/or setting the live revision: $err" } else { Index: openacs-4/packages/cms/www/modules/templates/template-tabs.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/template-tabs.adp,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/www/modules/templates/template-tabs.adp 31 Aug 2006 19:59:07 -0000 1.1.2.1 +++ openacs-4/packages/cms/www/modules/templates/template-tabs.adp 19 Feb 2007 22:17:44 -0000 1.1.2.2 @@ -4,7 +4,7 @@ <div id="subnavbar-container"> <div id="subnavbar"> - <if @tab@ eq template> +<!-- <if @tab@ eq template> <div class="tab" id="subnavbar-here"> Template </div> @@ -14,7 +14,7 @@ <a href="@package_url@modules/templates/properties?item_id=@item_id@&mount_point=@mount_point@&tab=template" title="" class="subnavbar-unselected">Template</a> </div> </else> - +--> <if @tab@ eq revisions> <div class="tab" id="subnavbar-here"> Revisions Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/cms/www/modules/templates/unpublish.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/cms/www/modules/templates/upload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/templates/upload.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/cms/www/modules/templates/upload.tcl 31 Aug 2006 19:59:07 -0000 1.4.2.1 +++ openacs-4/packages/cms/www/modules/templates/upload.tcl 19 Feb 2007 22:17:44 -0000 1.4.2.2 @@ -4,6 +4,7 @@ @creation-date May 2005 } { { template_id:integer } + { revision_id:integer } { mount_point "templates"} { tab:optional "revision"} { return_url } @@ -12,7 +13,7 @@ if { ! [request is_valid] } { return } set template_root [cm::modules::templates::getRootFolderID [ad_conn subsite_id]] -set path [content::template::get_path -template_id $template_id -root_folder_id $template_root] +set path "/[content::template::get_path -template_id $template_id -root_folder_id $template_root]" form create edit_template -html { enctype multipart/form-data } -cancel_url $return_url @@ -29,7 +30,7 @@ if { [form is_request edit_template] } { element set_properties edit_template revision_id \ - -value [cms::form::new_object_id] + -value $revision_id element set_properties edit_template return_url -value $return_url @@ -44,8 +45,11 @@ form get_values edit_template template_id revision_id set tmpfile [cms::form::prepare_content_file edit_template] - - cms::form::add_basic_revision $template_id $revision_id "Template" \ + cms::template::get -template_id $template_id -revision_id $revision_id + set new_revision_id [cms::template::add_revision -template_id $template_id -title $template_info(title) \ + -description $template_info(description) \ + -mime_type $template_info(mime_type) -creation_user [ad_conn user_id]] + cms::form::add_basic_revision $template_id $new_revision_id $template_info(title) \ -tmpfile $tmpfile template::forward $return_url Index: openacs-4/packages/cms/www/modules/types/attributes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/attributes.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/cms/www/modules/types/attributes.tcl 13 Apr 2005 21:32:34 -0000 1.2 +++ openacs-4/packages/cms/www/modules/types/attributes.tcl 19 Feb 2007 22:17:44 -0000 1.2.2.1 @@ -32,9 +32,9 @@ if {$can_edit_widgets_p} { if {[string match $object_type $content_type] && [expr ! [string match $object_type "content_revision"]]} { if {[template::util::is_nil widget]} { - set widget_links "<a href=\"$edit_widget_url\">Register Widget</a>" + set widget_links "<a href=\"$edit_widget_url\" class=\"button\">Register Widget</a>" } else { - set widget_links "\[ <a href=\"$edit_widget_url\">Edit Widget</a> | <a href=\"$unregister_widget_url\">Unregister Widget</a> \]" + set widget_links "<a href=\"$edit_widget_url\" class=\"button\">Edit Widget</a> <a href=\"$unregister_widget_url\" class=\"button\">Unregister Widget</a>" } } } Index: openacs-4/packages/cms/www/modules/types/content-method.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/content-method.adp,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/cms/www/modules/types/content-method.adp 16 Nov 2004 22:32:52 -0000 1.3 +++ openacs-4/packages/cms/www/modules/types/content-method.adp 19 Feb 2007 22:17:44 -0000 1.3.2.1 @@ -4,10 +4,6 @@ <listtemplate name="content_methods"></listtemplate> <p/> -<formtemplate id="register"> -Register Content Insertion Method:</b> -<formwidget id="content_type"> -<formwidget id="return_url"> -<formwidget id="content_method"> -<formwidget id="submit"> -</formtemplate> +<if @form_p@> + <formtemplate id="register"></formtemplate> +</if> Index: openacs-4/packages/cms/www/modules/types/content-method.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/content-method.tcl,v diff -u -r1.8.2.3 -r1.8.2.4 --- openacs-4/packages/cms/www/modules/types/content-method.tcl 31 Aug 2006 19:59:07 -0000 1.8.2.3 +++ openacs-4/packages/cms/www/modules/types/content-method.tcl 19 Feb 2007 22:17:44 -0000 1.8.2.4 @@ -1,15 +1,14 @@ + request create -request set_param content_type -datatype keyword -value content_revision +request set_param content_type -datatype text -value content_revision request set_param type_props_tab -datatype text -value content_method +request set_param mount_point -datatype text -value types # permissions check - user must have read on the types module permission::require_permission -party_id [auth::require_login] \ -object_id [cm::modules::get_module_id -module_name types -subsite_id [ad_conn subsite_id]] -privilege read -# default return_url -if { [template::util::is_nil return_url] } { - set return_url "index?content_type=$content_type" -} +set return_url [export_vars -base index {content_type content_method type_props_tab}] template::list::create \ -name content_methods \ @@ -26,28 +25,28 @@ pretty_is_default { label "Is default?" } - unreg_default_links { - display_template "<center>@content_methods.unreg_default_links;noquote@</center>" + action_links { + display_template "@content_methods.action_links;noquote@" } } # fetch the content methods registered to this content type -db_multirow -extend {pretty_is_default unreg_default_links} content_methods get_methods "" { - set content_method_unset_default_url [export_vars -base content-method-unset-default {content_type}] - set content_method_set_default_url [export_vars -base content-method-set-default {content_type content_method}] - set content_method_unregister_url [export_vars -base content-method-unregister {content_type content_method}] +db_multirow -extend {pretty_is_default action_links} content_methods get_methods "" { + set content_method_unset_default_url [export_vars -base content-method-unset-default {content_type return_url}] + set content_method_set_default_url [export_vars -base content-method-set-default {content_type content_method return_url}] + set content_method_unregister_url [export_vars -base content-method-unregister {content_type content_method return_url}] - set unreg_default_links "\[ " + set action_links "" if {[string match $is_default "t"]} { set pretty_is_default "Yes" - append unreg_default_links "<a href=\"$content_method_unset_default_url\">unset default</a>" + append action_links "<a href=\"$content_method_unset_default_url\" class=\"button\">Unset default</a> " } else { set pretty_is_default "No" - append unreg_default_links "<a href=\"$content_method_set_default_url\">set as default</a>" + append action_links "<a href=\"$content_method_set_default_url\" class=\"button\">Set as default</a> " } - append unreg_default_links " | <a href=\"$content_method_unregister_url\">unregister</a> ]" + append action_links " <a href=\"$content_method_unregister_url\" class=\"button\">Unregister</a>" } @@ -67,43 +66,31 @@ set unregistered_method_count [llength $unregistered_content_methods] - # form to register unregistered content methods to this content type -form create register -action content-method - -element create register content_type \ - -datatype keyword \ - -widget hidden \ - -value $content_type - -element create register return_url \ - -datatype text \ - -widget hidden \ - -value $return_url - -element create register content_method \ - -datatype keyword \ - -widget select \ - -options $unregistered_content_methods +if { [llength $unregistered_content_methods] > 0 } { + set form_p 1 + ad_form -name register -action content-method -form { -element create register submit \ - -datatype keyword \ - -widget submit \ - -label "Register" - - - -if { [form is_valid register] } { - - form get_values register content_type content_method - - db_transaction { - - db_exec_plsql add_method {} - + {content_type:text(hidden) + {value $content_type} + } + {return_url:text(hidden) + {value $return_url} + } + {content_method:text(select) + {label "Register Content Method"} + {options $unregistered_content_methods} + } + + } -on_submit { + + cms::type::add_content_method -content_type $content_type \ + -content_method $content_method + cms::type::flush_content_methods_cache $content_type + ad_returnredirect [export_vars -base index { mount_point type_props_tab content_type return_url}] + ad_script_abort + } - - cms::type::flush_content_methods_cache $content_type - - ad_returnredirect [export_vars -base index { mount_point type_props_tab content_type }] +} else { + set form_p 0 } Index: openacs-4/packages/cms/www/modules/types/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/index-postgresql.xql,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/cms/www/modules/types/index-postgresql.xql 16 Nov 2004 22:32:52 -0000 1.6 +++ openacs-4/packages/cms/www/modules/types/index-postgresql.xql 19 Feb 2007 22:17:44 -0000 1.6.2.1 @@ -58,17 +58,19 @@ <querytext> select - template_id, ttmap.content_type, use_context, is_default, name, - content_item__get_path( + template_id, ttmap.content_type, use_context, is_default, title, + '/' || content_item__get_path( template_id,:root_id) as path, (select pretty_name from acs_object_types where object_type = :content_type) as pretty_name from - cr_type_template_map ttmap, cr_items i + cr_type_template_map ttmap, cr_items i, cr_revisions r where i.item_id = ttmap.template_id and + r.revision_id = content_item__get_best_revision(i.item_id) + and ttmap.content_type = :content_type order by upper(name) Index: openacs-4/packages/cms/www/modules/types/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/index.tcl,v diff -u -r1.10.2.2 -r1.10.2.3 --- openacs-4/packages/cms/www/modules/types/index.tcl 31 Aug 2006 19:59:08 -0000 1.10.2.2 +++ openacs-4/packages/cms/www/modules/types/index.tcl 19 Feb 2007 22:17:44 -0000 1.10.2.3 @@ -41,7 +41,7 @@ -no_data "There are no templates registered to this content type." \ -actions [list "Register marked templates to this content type" [export_vars -base register-templates {content_type type_props_tab}] "Register marked templates to this content type"] \ -elements { - name { + title { label "Template Name" } path { @@ -55,10 +55,13 @@ } is_default { label "Default?" - display_template "<if @type_templates.is_default@ eq t>Yes</if><else><a href=\"@type_templates.set_default_url@\">set as default</a></else>" + display_template { + <if @type_templates.is_default@ eq t>Yes</if> + <else><a href=\"@type_templates.set_default_url@\" class=\"button\">Set as default</a></else> + } } unreg_link { - display_template "<center><a href=\"@type_templates.unreg_link_url;noquote@\">unregister</a></center>" + display_template "<a href=\"@type_templates.unreg_link_url;noquote@\" class=\"button\">Unregister</a>" } } Index: openacs-4/packages/cms/www/modules/types/register-templates-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/register-templates-postgresql.xql,v diff -u -r1.2 -r1.2.14.1 --- openacs-4/packages/cms/www/modules/types/register-templates-postgresql.xql 8 Jun 2001 01:44:53 -0000 1.2 +++ openacs-4/packages/cms/www/modules/types/register-templates-postgresql.xql 19 Feb 2007 22:17:44 -0000 1.2.14.1 @@ -21,7 +21,7 @@ select template_id, - content_item__get_path( template_id, content_template__get_root_folder() ) + '/' || content_item__get_path( template_id, :template_root ) as name from cr_templates t, cr_items i Index: openacs-4/packages/cms/www/modules/types/register-templates.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/register-templates.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/cms/www/modules/types/register-templates.tcl 31 Aug 2006 19:59:08 -0000 1.6.2.1 +++ openacs-4/packages/cms/www/modules/types/register-templates.tcl 19 Feb 2007 22:17:44 -0000 1.6.2.2 @@ -4,8 +4,8 @@ request create request set_param content_type -datatype keyword request set_param type_props_tab -datatype text -optional -value attributes +set template_root [cm::modules::templates::getRootFolderID [ad_conn subsite_id]] - # get the content type pretty name set object_type_pretty [db_string get_pretty_type "" -default ""] @@ -81,7 +81,7 @@ -datatype text \ -widget inform \ -label "Template" \ - -value "/$t_name" + -value "$t_name" element create register_templates $id_name \ -datatype integer \ Index: openacs-4/packages/cms/www/modules/types/relations.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/types/relations.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/cms/www/modules/types/relations.tcl 6 Jun 2005 17:07:24 -0000 1.8.2.1 +++ openacs-4/packages/cms/www/modules/types/relations.tcl 19 Feb 2007 22:17:44 -0000 1.8.2.2 @@ -29,7 +29,7 @@ label "Max Relations" } item_unreg_link { - display_template "<center><a href=\"@rel_types.item_unreg_link;noquote@\">unregister</a></center>" + display_template "<a href=\"@rel_types.item_unreg_link;noquote@\" class=\"button\">Unregister</a>" } } @@ -59,7 +59,7 @@ label "Max Relations" } child_unreg_link { - display_template "<center><a href=\"@child_types.child_unreg_link;noquote@\">unregister</a></center>" + display_template "<a href=\"@child_types.child_unreg_link;noquote@\" class=\"button\">Unregister</a></center>" } }