Index: openacs-4/packages/cms/todo =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/todo,v diff -u -N -r1.7.2.2 -r1.7.2.3 --- openacs-4/packages/cms/todo 6 Jun 2005 18:05:43 -0000 1.7.2.2 +++ openacs-4/packages/cms/todo 9 Jun 2005 21:15:26 -0000 1.7.2.3 @@ -12,7 +12,7 @@ basic/cosmetic --------- -add preview functionality +add preview functionality (add ad_properties to index.vuh with preview/printer-friendly option?) printer friendly template (steal from xcms-ui) clean up www/modules/items/relate-items (remove old table format) new icon for "clipping" items - competing with new listbuilder checkboxes, confuse UI a bit Index: openacs-4/packages/cms/sql/oracle/cms-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/sql/oracle/cms-create.sql,v diff -u -N -r1.4.2.2 -r1.4.2.3 --- openacs-4/packages/cms/sql/oracle/cms-create.sql 7 Jun 2005 20:53:48 -0000 1.4.2.2 +++ openacs-4/packages/cms/sql/oracle/cms-create.sql 9 Jun 2005 21:15:26 -0000 1.4.2.3 @@ -83,6 +83,7 @@ package_id integer constraint cm_modules_pkg_id_fk references apm_packages + on delete cascade ); comment on column cm_modules.root_key is ' @@ -229,7 +230,7 @@ -- show errors -- map subsites to cms package -create table subsite_package_map ( +create table cms_subsite_package_map ( subsite_id integer, package_id integer constraint subsite_package_map_pkg_id_fk references 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 -N -r1.11.2.3 -r1.11.2.4 --- openacs-4/packages/cms/sql/postgresql/cms-create.sql 7 Jun 2005 20:51:49 -0000 1.11.2.3 +++ openacs-4/packages/cms/sql/postgresql/cms-create.sql 9 Jun 2005 21:15:26 -0000 1.11.2.4 @@ -125,6 +125,7 @@ package_id integer constraint cm_modules_pkg_id_fk references apm_packages + on delete cascade ); comment on column cm_modules.root_key is ' @@ -300,7 +301,7 @@ -- drop function inline_1 (); -- map subsites to cms package -create table subsite_package_map ( +create table cms_subsite_package_map ( subsite_id integer, package_id integer constraint subsite_package_map_pkg_id_fk references 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 -N -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/tcl/install-procs.tcl 6 Jun 2005 15:34:55 -0000 1.1.2.1 +++ openacs-4/packages/cms/tcl/install-procs.tcl 9 Jun 2005 21:15:26 -0000 1.1.2.2 @@ -10,15 +10,18 @@ # create modules for new instance cm::modules::install::create_modules -package_id $package_id - set subsite_dir "/www" + set subsite_id [ad_conn subsite_id] + db_dml map_subsite {} + + set subsite_dir "[acs_root_dir]/www" append subsite_dir [site_node::get_url_from_object_id -object_id [ad_conn subsite_id]] # check that directory exists and... if { ![file exists $subsite_dir] } { file mkdir $subsite_dir } # copy content delivery .vuh file to subsite root - file copy -force /packages/cms/www/index.vuh $subsite_dir + file copy -force [acs_root_dir]/packages/cms/www/index.vuh $subsite_dir } Index: openacs-4/packages/cms/tcl/install-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/Attic/install-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/cms/tcl/install-procs.xql 9 Jun 2005 21:15:26 -0000 1.1.2.1 @@ -0,0 +1,13 @@ + + + + + + insert into cms_subsite_package_map + (subsite_id,package_id) + values + (:subsite_id,:package_id) + + + + 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 -N -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/cms/tcl/module-procs.tcl 6 Jun 2005 17:07:23 -0000 1.9.2.1 +++ openacs-4/packages/cms/tcl/module-procs.tcl 9 Jun 2005 21:15:26 -0000 1.9.2.2 @@ -344,6 +344,9 @@ -context_id $package_id \ -parent_id "0" \ -label "$instance_name $module" ] + # register content_revision and subtypes to main folder + content::folder::register_content_type -folder_id $root_key \ + -content_type content_revision -include_subtypes t } "Templates" { set root_key [content::folder::new -name pkg_${package_id}_templates \ @@ -358,10 +361,11 @@ set root_key 0 } } + set module_id [db_exec_plsql create_module {}] + # assign context_id of package_id db_dml update_module_context {} - db_dml map_subsite {} } } Index: openacs-4/packages/cms/tcl/module-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/module-procs.xql,v diff -u -N -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/cms/tcl/module-procs.xql 6 Jun 2005 17:07:23 -0000 1.4.2.1 +++ openacs-4/packages/cms/tcl/module-procs.xql 9 Jun 2005 21:15:26 -0000 1.4.2.2 @@ -7,7 +7,7 @@ select module_id from cm_modules where key = :module_name and package_id = - (select package_id from subsite_package_map + (select package_id from cms_subsite_package_map where subsite_id = :subsite_id) @@ -43,7 +43,7 @@ select root_key from cm_modules where key = 'templates' and package_id = - (select package_id from subsite_package_map + (select package_id from cms_subsite_package_map where subsite_id = :subsite_id) @@ -54,7 +54,7 @@ select root_key from cm_modules where key = 'sitemap' and package_id = - (select package_id from subsite_package_map + (select package_id from cms_subsite_package_map where subsite_id = :subsite_id) @@ -65,9 +65,9 @@ - + - insert into subsite_package_map + insert into cms_subsite_package_map (subsite_id,package_id) values (:subsite_id,:package_id) @@ -79,7 +79,7 @@ select module_id from cm_modules where key = :module_name and package_id = - (select package_id from subsite_package_map + (select package_id from cms_subsite_package_map where subsite_id = :subsite_id) Index: openacs-4/packages/cms/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/index.vuh,v diff -u -N -r1.2 -r1.2.12.1 --- openacs-4/packages/cms/www/index.vuh 24 Sep 2002 00:14:43 -0000 1.2 +++ openacs-4/packages/cms/www/index.vuh 9 Jun 2005 21:15:26 -0000 1.2.12.1 @@ -1,29 +1,67 @@ -################## KLUDGE BY STAS ############### -# Try and look up the item in the content repository -################################################# +# try to find/serve the requested content -# Get the paths - set the_url [ad_conn path_info] -set package_key [ad_conn package_key] set the_root [ns_info pageroot] -# Get the IDs -set content_root \ - [db_string content_root "select content_item.get_root_folder from dual"] -set template_root \ - [db_string template_root "select content_template.get_root_folder from dual"] +# get roots +set content_root [cm::modules::sitemap::getRootFolderID [ad_conn subsite_id]] +set template_root [cm::modules::templates::getRootFolderID [ad_conn subsite_id]] -# Serve the page +# get item id from url +set item_id [content::item::get_id -item_path $the_url -root_folder_id $content_root] -# DRB: Note that content::init modifies the local variable the_root, which is treated -# as though it's been passed by reference. This requires that the redirect treat the -# path as an absolute path within the filesystem. +# if there's no id, must not be a cr_item +if { [template::util::is_nil item_id] } { + ns_log notice "CMS index.vuh: bailing out on $the_url; not a CR item!" + ns_returnnotfound + ad_script_abort +} -if { [content::init the_url the_root $content_root $template_root] } { - set file "$the_root/$the_url" - rp_internal_redirect -absolute_path $file -} else { - ns_returnnotfound +if { [string match [content::item::get_content_type -item_id $item_id] content_folder] } { + # it's a folder, so set item_id to nil + set folder_id $item_id + set item_id "" + + # look for index page + set item_id [content::folder::get_index_page -folder_id $folder_id] } +# no index page for folder +if { [template::util::is_nil item_id] } { + ns_log notice "CMS index.vuh: bailing out on $the_url; no index page for folder!" + ns_returnnotfound + ad_script_abort +} + +# check perms (want to allow for unregistered users to view public content) +permission::require_permission -object_id $item_id \ + -party_id [ad_conn user_id] -privilege read + +# grab mime info +set revision_id [content::item::get_best_revision -item_id $item_id] +item::get_mime_info $revision_id + +switch $mime_info(mime_type) { + + text/html - text/plain - "text/plain; format=flowed" - text/enriched { + # parameter to determine whether or not to call content::init or serve from db? + set template_id [content::item::get_template -item_id $item_id -use_context public] + # if there's no template, just write content and hope for the best + 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] + + # put item_id into form so template can get it out ... + # and then redirect to template + rp_form_put item_id $item_id + rp_internal_redirect $path + } + + default { + cr_write_content -revision_id $revision_id + } + +} + Index: openacs-4/packages/cms/www/modules/sitemap/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/sitemap/index.xql,v diff -u -N -r1.5.2.2 -r1.5.2.3 --- openacs-4/packages/cms/www/modules/sitemap/index.xql 6 Jun 2005 18:05:43 -0000 1.5.2.2 +++ openacs-4/packages/cms/www/modules/sitemap/index.xql 9 Jun 2005 21:15:26 -0000 1.5.2.3 @@ -7,7 +7,7 @@ select name from cm_modules where key = 'sitemap' and package_id = - (select package_id from subsite_package_map + (select package_id from cms_subsite_package_map where subsite_id = :subsite_id)