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 @@ - \ No newline at end of file + 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 @@ - \ No newline at end of file + 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 "
@folder_contents.copy;noquote@
" } 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 { - View + View Revise + + Unpublish + + Publish + } } } @@ -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 @@ - + to_char($attribute_name, 'YYYY MM DD HH24 MI SS') @@ -73,13 +73,13 @@ - + select content_item.get_latest_revision(:item_id) from dual - + select nvl(pretty_name,enum_value), enum_value from acs_enum_values @@ -88,7 +88,7 @@ - + begin :revision_id := content_revision.new( @@ -104,7 +104,7 @@ - + select @@ -132,7 +132,7 @@ - + select @@ -156,15 +156,15 @@ - + begin :1 := content_item.new( [join $params ","] ); end; - + select @@ -182,7 +182,7 @@ - + update cr_revisions @@ -192,7 +192,7 @@ - + update cr_revisions @@ -204,7 +204,7 @@ - + update cr_revisions @@ -216,15 +216,15 @@ - + to_date(:$name, 'YYYY MM DD HH24 MI SS') - + select @@ -241,15 +241,15 @@ - + to_char($attr, 'YYYY MM DD HH24 MI SS') as $attr - + select @@ -273,15 +273,15 @@ - + select content_item.get_latest_revision(:item_id) from dual - + select @@ -298,7 +298,7 @@ - + begin :1 := content_revision.new( item_id => content_symlink.resolve(:item_id), @@ -309,7 +309,7 @@ - + select @@ -327,7 +327,7 @@ - + update cr_revisions @@ -338,7 +338,7 @@ - + update cr_revisions @@ -350,7 +350,7 @@ - + update cr_revisions @@ -363,7 +363,7 @@ - + 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 @@ - + to_date(:$name, 'YYYY MM DD HH24 MI SS') @@ -325,7 +325,7 @@ - + select @@ -341,7 +341,7 @@ - + select content_revision__new( @@ -361,7 +361,7 @@ - + update cr_revisions @@ -371,7 +371,7 @@ - + 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 {]*>(.*?)} $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 @@ 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 ) 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 @@ + + + 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) + + + + + + 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) + + + + + + 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 + ) + + + + + + delete from cr_child_rels where rel_id = :rel_id + + + 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 @@ - + + + + + + + + @@ -90,6 +101,17 @@ + + + + +
+ Admin +
+
+ 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 "up  |  \ - down" + display_template { + Up + Down + } } } 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 @@ 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 @@
Related Items

- +

Child Items

- +

@@ -56,6 +56,14 @@

+ +
+ +
+ + + +
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 @@