Index: openacs-4/packages/lorsm/www/admin/course-structure.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/course-structure.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lorsm/www/admin/course-structure.adp 31 Dec 2006 00:36:04 -0000 1.1 +++ openacs-4/packages/lorsm/www/admin/course-structure.adp 6 Apr 2007 15:52:23 -0000 1.2 @@ -2,4 +2,4 @@ @title;noquote@ @context;noquote@ - \ No newline at end of file + \ No newline at end of file Index: openacs-4/packages/lorsm/www/admin/course-structure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/course-structure.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lorsm/www/admin/course-structure.tcl 31 Dec 2006 00:36:04 -0000 1.1 +++ openacs-4/packages/lorsm/www/admin/course-structure.tcl 6 Apr 2007 15:52:23 -0000 1.2 @@ -17,3 +17,29 @@ set context [list "[_ lorsm.Course_Structure]"] set title "[_ lorsm.Course_Structure]" + +set custom_page_types [list start end] +array set custom_page_pretty_names [list start "[_ lorsm.Start_Page]" end "[_ lorsm.End_Page]"] +array set custom_page_order [list start 0 end 1] +set lorsm_custom_page_ids [list] +set existing_custom_page_types [list] +db_multirow -extend {order pretty_name} custom_pages get_custom_pages "select i.ims_item_id, i.item_title, lcp.type, ci.item_id from lorsm_custom_pages lcp, ims_cp_manifests m, ims_cp_organizations o, ims_cp_items i, cr_items ci where +ci.item_id=lcp.page_id +and m.man_id=:man_id +and m.man_id=o.man_id +and o.org_id=i.org_id +and i.ims_item_id=ci.live_revision" { + lappend lorsm_custom_page_ids $ims_item_id + lappend existing_custom_page_types $type + set order $custom_page_order($type) +} +foreach type $custom_page_types { + if {[lsearch $existing_custom_page_types $type] <0} { + template::multirow append custom_pages "" "" $type "" $custom_page_order($type) $custom_page_pretty_names($type) + } +} +template::multirow sort custom_pages order + +set extra_admin_html [template::adp_include /packages/lorsm/lib/custom-page-admin [list &custom_pages custom_pages man_id $man_id]] + + Index: openacs-4/packages/lorsm/www/admin/item-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/item-add-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lorsm/www/admin/item-add-edit.adp 6 Apr 2007 15:52:23 -0000 1.1 @@ -0,0 +1,5 @@ + +@page_title@ +@context@ + + \ No newline at end of file Index: openacs-4/packages/lorsm/www/admin/item-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/item-add-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lorsm/www/admin/item-add-edit.tcl 6 Apr 2007 15:52:23 -0000 1.1 @@ -0,0 +1,83 @@ +ad_page_contract { + Edit an ims_cp_item that is webcontent type + item_id is a cr_items.item_id +} { + item_id:optional + man_id + type:optional + {return_url ""} +} + +ad_form -name item -export {man_id type} -form { + item_id:key + {title:text {label "acs-content-repository.Title"}} + {content:richtext {label "acs-content-repository.Content"}} +} -edit_request { + set content [template::util::richtext::create \ + [cr_write_content -string -item_id $item_id] \ + text/html] + set title [db_string get_title "select item_title from ims_cp_items where ims_item_id=(select live_revision from cr_items where item_id=:item_id)"] +} -new_data { + set content [template::util::richtext::get_property text $content] + set org_id [db_string get_org_id "select org_id from ims_cp_organizations where man_id=:man_id"] + set item_folder_id [db_string get_folder_id "select parent_id from cr_items where latest_revision=:org_id"] +# ad_return_complaint 1 "folder_id '${item_folder_id}'" + # TODO i bet we can make a generic webcontent + # a subset of lors::itemcp::item_add_from_object + # and handle all adding of objects from anywhere + # to a lors course, for now, this works, and is consistent + # with generic ims_cp webcontent objects + set ims_item_id [lors::imscp::item_add \ + -org_id $org_id \ + -item_id $item_id \ + -itm_folder_id $item_folder_id \ + -identifier $item_id \ + -title $title \ + -parent_item $org_id] + db_dml set_sort_order "update ims_cp_items set sort_order = (select max(sort_order)+1 from ims_cp_items where org_id=:org_id) where ims_item_id = :ims_item_id" + + set revision_id [content::item::get_live_revision -item_id $item_id] + content::revision::update_content \ + -revision_id $revision_id \ + -item_id $item_id \ + -content $content \ + -mime_type text/html \ + -storage_type [db_string get_storage_type "select storage_type from cr_items where item_id=:item_id"] + + set res_id [lors::imscp::resource_add \ + -identifier $revision_id \ + -man_id $man_id \ + -res_folder_id $item_folder_id] + + lors::imscp::item_to_resource_add \ + -item_id $ims_item_id \ + -res_id $res_id + + +} -edit_data { + set content [template::util::richtext::get_property text $content] + set ims_item_id [content::item::get_latest_revision -item_id $item_id] + content::revision::update_content \ + -revision_id $ims_item_id \ + -item_id $item_id \ + -content $content \ + -mime_type text/html \ + -storage_type [db_string get_storage_type "select storage_type from cr_items where item_id=:item_id"] + db_dml set_title "update ims_cp_items set item_title=:title where ims_item_id=:ims_item_id" +} -after_submit { + if {[info exists type]} { + lorsm::set_custom_page \ + -man_id $man_id \ + -item_id $item_id \ + -type $type + } + if {$return_url eq ""} { + set return_url [export_vars -base course-structure {man_id}] + } + ad_returnredirect -message "" $return_url +} + +set page_title [_ lorsm.Add_Content] +set context [list $page_title] + + Index: openacs-4/packages/lorsm/www/admin/remove-custom-page.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/remove-custom-page.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lorsm/www/admin/remove-custom-page.tcl 6 Apr 2007 15:52:23 -0000 1.1 @@ -0,0 +1,15 @@ +ad_page_contract { + Remove a custom page relationship +} { + man_id + type + {return_url ""} +} + +db_dml remove_page "delete from lorsm_custom_pages where man_id=:man_id and type=:type" + +if {$return_url eq ""} { + set return_url [export_vars -base course-structure {man_id}] +} + +ad_returnredirect $return_url Index: openacs-4/packages/lorsm/www/admin/reorder-items-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/reorder-items-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lorsm/www/admin/reorder-items-oracle.xql 6 Apr 2007 15:52:23 -0000 1.1 @@ -0,0 +1,13 @@ + + + oracle8.1.7 + + +select sort_order from (select sort_order from ims_cp_items where parent_item=:parent_item and sort_order > : sort_order order by sort_order) s where s.rownum = 1 + + + +select sort_order from (select sort_order from ims_cp_items where parent_item=:parent_item and sort_order < : sort_order order by sort_order) s where s.rownum = 1 + + + \ No newline at end of file Index: openacs-4/packages/lorsm/www/admin/reorder-items-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/reorder-items-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lorsm/www/admin/reorder-items-postgresql.xql 6 Apr 2007 15:52:23 -0000 1.1 @@ -0,0 +1,17 @@ + + + postgresql7.1 + + + +select sort_order from ims_cp_items where parent_item=:parent_item and sort_order > :sort_order order by sort_order limit 1 + + + + + +select sort_order from ims_cp_items where parent_item=:parent_item and sort_order < :sort_order order by sort_order limit 1 + + + + \ No newline at end of file Index: openacs-4/packages/lorsm/www/admin/reorder-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/admin/reorder-items.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lorsm/www/admin/reorder-items.tcl 31 Dec 2006 00:36:04 -0000 1.1 +++ openacs-4/packages/lorsm/www/admin/reorder-items.tcl 6 Apr 2007 15:52:23 -0000 1.2 @@ -13,9 +13,9 @@ db_list lock_rows "select ims_item_id from ims_cp_items where parent_item=:parent_item for update" if { $dir eq "up" } { - set next_sort_order [expr { $sort_order - 1 }] + set next_sort_order [db_string get_prev_sort_order ""] } else { - set next_sort_order [expr { $sort_order + 1 }] + set next_sort_order [db_string get_next_sort_order ""] } db_dml swap_sort_orders "