Index: openacs-4/packages/dotlrn-ecommerce/lib/fs-cms.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/fs-cms.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/lib/fs-cms.adp 21 Jul 2005 22:09:39 -0000 1.1 @@ -0,0 +1,3 @@ + +@current_item.title;noquote@ +@current_item.content;noquote@ Index: openacs-4/packages/dotlrn-ecommerce/lib/fs-cms.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/fs-cms.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/lib/fs-cms.tcl 21 Jul 2005 22:09:39 -0000 1.1 @@ -0,0 +1,34 @@ +ad_page_contract { + serve the correct template based from what is template assigned + on the cms_context of public +} { + file_id +} + +if {![db_0or1row get_item "select cr.*, + ci.* + from cr_revisions cr, + cr_items ci + where ci.live_revision = cr.revision_id + and ci.item_id=:file_id" -column_array current_item]} { + + set current_item(title) "Section Details placeholder" + set current_item(content) "Empty" + set current_item(name) "" + set current_item(mime_type) "text/html" +} else { +if { ![string equal -length 4 "text" $current_item(mime_type)] } { + # It's a file. + cr_write_content -revision_id $current_item(revision_id) + ad_script_abort +} else { + set current_item(content) [cr_write_content -string -revision_id $current_item(revision_id)] +} + +} + + +ad_return_template + + + Index: openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl,v diff -u -r1.24 -r1.25 --- openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 21 Jul 2005 19:06:50 -0000 1.24 +++ openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 21 Jul 2005 22:09:39 -0000 1.25 @@ -294,7 +294,7 @@ display_template { - Section: @course_list.section_name@ + Section: @course_list.section_name@ Section @course_list.section_name@ Index: openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 19 Jul 2005 18:50:39 -0000 1.11 +++ openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 21 Jul 2005 22:09:39 -0000 1.12 @@ -391,3 +391,26 @@ limit 1 } -default ""] } + +ad_proc -public dotlrn_ecommerce::section::get_public_folder_id { + section_id +} { + @param section_id + @return the file storage folder for the section's Public Files +} { + return [util_memoize [list dotlrn_ecommerce::section::get_public_folder_id_not_cached $section_id]] +} + +ad_proc -private dotlrn_ecommerce::section::get_public_folder_id_not_cached { + section_id +} { + @param section_id + @return the file storage folder for the section's Public Files +} { + set section_package_id [db_string get_package_id "select package_id from dotlrn_communities_all dc, dotlrn_ecommerce_section ds where ds.community_id=dc.community_id and ds.section_id=:section_id" -default 0] + set section_community_node_id [site_node::get_node_id_from_object_id -object_id $section_package_id] + set fs_package_id [site_node::get_children -node_id $section_community_node_id -package_key file-storage -element package_id] + set fs_root_folder [fs::get_root_folder -package_id $fs_package_id] + set section_folder_id [content::item::get_id -root_folder_id $fs_root_folder -item_path "public"] + return $section_folder_id +} \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/admin/pages/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/pages/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/pages/index.adp 21 Jul 2005 22:09:39 -0000 1.1 @@ -0,0 +1,5 @@ + +@page_title@ +@context@ + + \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/admin/pages/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/pages/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/pages/index.tcl 21 Jul 2005 22:09:39 -0000 1.1 @@ -0,0 +1,37 @@ +ad_page_contract { + Publically viewable pages + stored in file-storage that belongs to a section +} -query { + +} -properties { + page_title + context +} + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] + +set urlv [split [ad_conn path_info] "/"] +set section_id [lindex $urlv 0] +set the_url [lrange $urlv 1 end] + +# TODO DAVEB Make this a procedure +set section_package_id [db_string get_package_id "select package_id from dotlrn_communities_all dc, dotlrn_ecommerce_section ds where ds.community_id=dc.community_id and ds.section_id=:section_id" -default 0] +if {$section_package_id == 0} { +# ad_returnnotfound +# ad_script_abort + ad_return_complaint 1 "section_id '${section_id}' urlv '${urlv}' section_package_id '${section_package_id}'" +} + +set section_community_node_id [site_node::get_node_id_from_object_id -object_id $section_package_id] +set fs_package_id [site_node::get_children -node_id $section_community_node_id -package_key file-storage -element package_id] +set fs_root_folder [fs::get_root_folder -package_id $fs_package_id] +set pages_folder [content::item::get_id -root_folder_id $fs_root_folder -item_path "public"] + +#ad_return_complaint 1 "pages_folder '${pages_folder}'" + +set page_title "Section Pages" +set context [list $page_title] + +set return_url [ad_return_url] +ad_return_template \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/admin/pages/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/pages/index.vuh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/pages/index.vuh 21 Jul 2005 22:09:39 -0000 1.1 @@ -0,0 +1,27 @@ +# internally redirect to file-storage + +set urlv [split [ad_conn path_info] "/"] +set section_id [lindex $urlv 0] +set the_url [lrange $urlv 1 end] + +# TODO DAVEB Make this a procedure +set section_package_id [db_string get_package_id "select package_id from dotlrn_communities_all dc, dotlrn_ecommerce_section ds where ds.community_id=dc.community_id and ds.section_id=:section_id" -default 0] +if {$section_package_id == 0} { +# ad_returnnotfound +# ad_script_abort + ad_return_complaint 1 "404 section_id '${section_id}' urlv '${urlv}' section_package_id '${section_package_id}'" +} +# ad_return_complaint 1 "200 section_id '${section_id}' urlv '${urlv}' section_package_id '${section_package_id}'" +set section_community_node_id [site_node::get_node_id_from_object_id -object_id $section_package_id] +set fs_package_id [site_node::get_children -node_id $section_community_node_id -package_key file-storage -element package_id] +set fs_root_folder [fs::get_root_folder -package_id $fs_package_id] +set pages_folder [content::item::get_id -root_folder_id $fs_root_folder -item_path "public"] + +# FIXME breaks on FORMS! +if {![string match "*folder%5fid=*" [ad_conn query]] || [string match "*folder_id=*" [ad_conn query]]} { + rp_form_put folder_id $pages_folder +} +if {[string equal "" [lindex $the_url 0]]} { + set the_url "index" +} +rp_internal_redirect /packages/file-storage/www/${the_url} \ No newline at end of file