Index: openacs-4/packages/imsld/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/index.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/imsld/www/admin/index.tcl 30 Mar 2006 16:01:46 -0000 1.5
+++ openacs-4/packages/imsld/www/admin/index.tcl 16 May 2006 09:24:36 -0000 1.6
@@ -7,20 +7,33 @@
} {
{return_url "index"}
{set_imsld_id_live ""}
+ {set_run_id_live ""}
+ {run_imsld_id ""}
+ {run_orderby ""}
+ {imsld_orderby ""}
} -properties {
upload_file
context:onevalue
}
+set community_id [dotlrn_community::get_community_id]
+
+# check action...
if { ![string eq "" $set_imsld_id_live] } {
content::item::set_live_revision -revision_id [content::item::get_best_revision -item_id $set_imsld_id_live]
}
+if { ![string eq "" $set_run_id_live] } {
+ db_dml make_run_live { *SQL* }
+}
+if { ![string eq "" $run_imsld_id] } {
+ imsld::instance::instantiate_imsld -imsld_id $run_imsld_id -community_id $community_id
+}
set package_id [ad_conn package_id]
permission::require_permission -object_id $package_id -privilege create
-set page_title "Admin IMS LD"
-set context [list "Admin IMS LD"]
+set page_title "[_ imsld.Admin_IMS_LD]"
+set context [list "[_ imsld.Admin_IMS_LD]"]
set user_id [ad_conn user_id]
set manifest_id [db_nextval acs_object_id_seq]
@@ -33,60 +46,98 @@
{manifest_id:integer {widget hidden} {value $manifest_id}}
}
-
template::list::create \
-name imslds \
-multirow imslds \
-key imsld_id \
+ -orderby_name imsld_orderby \
+ -orderby { default_value imsld_title } \
-elements {
imsld_title {
label "[_ imsld.IMS_LD_Name]"
orderby_asc {imsld_title asc}
orderby_desc {imsld_title desc}
}
+ creation_date {
+ label "[_ imsld.Creation_Date]"
+ orderby_asc {creation_date asc}
+ orderby_desc {creation_date desc}
+ }
+ create_run {
+ label {}
+ display_template {@imslds.create_run;noquote@}
+ }
delete {
label {}
sub_class narrow
display_template {@imslds.delete_template;noquote@}
link_html { title "[_ imsld.Delete_IMS_LD]" }
}
- manage {
- label {}
- display_template {@imslds.manage;noquote@}
- }
}
-set orderby [template::list::orderby_clause -orderby -name imslds]
+set imsld_orderby [template::list::orderby_clause -orderby -name imslds]
-if {[string equal $orderby ""]} {
- set orderby " order by imsld_title asc"
-}
-
-set community_id [dotlrn_community::get_community_id]
set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id]
-db_multirow -extend { delete_template manage} imslds get_imslds {
- select imsld.imsld_id,
- coalesce(imsld.title, imsld.identifier) as imsld_title,
- cr3.item_id,
- cr3.live_revision
- from cr_items cr1, cr_items cr2, cr_items cr3, cr_items cr4,
- imsld_cp_manifests icm, imsld_cp_organizations ico, imsld_imsldsi imsld
- where cr1.live_revision = icm.manifest_id
- and cr1.parent_id = cr4.item_id
- and cr4.parent_id = :cr_root_folder_id
- and ico.manifest_id = cr1.item_id
- and imsld.organization_id = cr2.item_id
- and cr2.live_revision = ico.organization_id
- and cr3.item_id = imsld.item_id
-} {
+db_multirow -extend { delete_template create_run } imslds get_imslds { *SQL* } {
if { [empty_string_p $live_revision] } {
- set delete_template "Deleted [_ imsld.Make_it_live]"
- set manage none
+ set delete_template "[_ imsld.Deleted] [_ imsld.Make_it_live]"
+ set create_run ""
} else {
set delete_template ""
- set manage "Manage Members"
-
+ set create_run " [_ imsld.create_new_run] "
}
}
+
+set imsld_package_id [site_node_apm_integration::get_child_package_id \
+ -package_id [dotlrn_community::get_package_id $community_id] \
+ -package_key "[imsld::package_key]"]
+set imsld_url "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]"
+
+template::list::create \
+ -name imsld_runs \
+ -multirow imsld_runs \
+ -key run_id \
+ -elements {
+ imsld_title {
+ label "[_ imsld.Run_IMS-LD_Name]"
+ orderby_asc {imsld_title asc}
+ orderby_desc {imsld_title desc}
+ display_template {@imsld_runs.imsld_title@}
+ }
+ creation_date {
+ label "[_ imsld.Creation_Date]"
+ orderby_asc {creation_date asc}
+ orderby_desc {creation_date desc}
+ }
+ manage {
+ label ""
+ display_template {@imsld_runs.manage;noquote@}
+ }
+ delete {
+ label {}
+ sub_class narrow
+ display_template {@imsld_runs.delete_template;noquote@}
+ link_html { title "[_ imsld.Delete_Run]" }
+ }
+ } \
+ -orderby_name run_orderby \
+ -orderby { default_value creation_date desc }
+
+
+set run_orderby [template::list::orderby_clause -orderby -name imsld_runs]
+
+set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id]
+
+db_multirow -extend { manage delete_template } imsld_runs get_runs { *SQL* } {
+
+ if { [string eq $status "deleted"] } {
+ set delete_template "[_ imsld.Deleted] [_ imsld.Make_it_live]"
+ set manage ""
+ } else {
+ set delete_template ""
+ set create_run " [_ imsld.create_new_run] "
+ set manage "[_ imsld.Manage_Members]"
+ }
+}