Index: openacs-4/packages/curriculum-central/tcl/uos-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/uos-procs.tcl,v
diff -u -r1.32 -r1.33
--- openacs-4/packages/curriculum-central/tcl/uos-procs.tcl 1 Jun 2006 12:44:03 -0000 1.32
+++ openacs-4/packages/curriculum-central/tcl/uos-procs.tcl 2 Jun 2006 11:55:58 -0000 1.33
@@ -756,16 +756,15 @@
ad_proc -public curriculum_central::uos::update_textbooks {
-textbook_set_id:required
- -textbook_ids:required
+ -uos_id:required
{-user_id ""}
{-creation_ip ""}
} {
Updates the textbooks component for a Unit of Study.
This update proc creates a new textbook revision.
@param textbook_set_id The ID for a set of textbooks.
- @param textbook_ids List of selected textbooks that need
- to be mapped to the textbook set.
+ @param Unit of Study ID.
@param user_id The ID of the user that updated the Unit of Study.
@param creation_ip The IP of the user that made the update.
@@ -782,11 +781,16 @@
# Set the default value for revision_id.
set revision_id ""
db_transaction {
+ # Retrieve textbook info for Unit of Study.
+ curriculum_central::uos::get_textbooks \
+ -uos_id $uos_id \
+ -array uos_textbook
+
set revision_id [db_exec_plsql update_textbook_set {}]
# Foreach textbook_id map to the newly created revision_id
# retrieved above.
- foreach textbook_id $textbook_ids {
+ foreach textbook_id $uos_textbook(textbook_ids) {
db_exec_plsql map_textbook_revision {}
}
}
Index: openacs-4/packages/curriculum-central/www/coordinate/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/index.adp,v
diff -u -r1.14 -r1.15
--- openacs-4/packages/curriculum-central/www/coordinate/index.adp 1 Jun 2006 12:46:39 -0000 1.14
+++ openacs-4/packages/curriculum-central/www/coordinate/index.adp 2 Jun 2006 12:01:41 -0000 1.15
@@ -5,7 +5,6 @@
Things to delete
Index: openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl,v
diff -u -r1.20 -r1.21
--- openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl 1 Jun 2006 12:42:59 -0000 1.20
+++ openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl 2 Jun 2006 11:56:58 -0000 1.21
@@ -315,18 +315,25 @@
-uos_id $uos_id \
-array uos_textbook
+set textbook_view_url [export_vars -url -base "iframe/textbooks-view" \
+ {uos_id {edit_p $edit_tl_p}}]
+
# Add widgets for textbook
ad_form -extend -name uos -form {
{textbook_set_id:integer(hidden),optional
{value $uos_textbook(textbook_set_id)}
}
- {textbook_ids:text(multiselect),multiple,optional
+ {textbook_ids:text(inform)
{label "[_ curriculum-central.textbooks]"}
- {options [curriculum_central::uos::textbook_get_options]}
- {html {size 5}}
- {values $uos_textbook(textbook_ids)}
{mode display}
- {help_text "[_ curriculum-central.help_select_textbook_ids]"}
+ {after_html
+ {
+
+ }
+ }
}
}
@@ -564,7 +571,7 @@
curriculum_central::uos::update_textbooks \
-textbook_set_id $textbook_set_id \
- -textbook_ids $textbook_ids
+ -uos_id $uos_id
curriculum_central::uos::update_graduate_attributes \
-gradattr_set_id $gradattr_set_id \
Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-ae-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-ae-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-ae-postgresql.xql 2 Jun 2006 11:57:50 -0000 1.1
@@ -0,0 +1,56 @@
+
+
+
+ postgresql 7.4
+
+
+
+ SELECT n.uos_code
+ FROM cc_uos_name n, cc_uos u
+ WHERE u.uos_name_id = n.name_id
+ AND u.uos_id = :uos_id
+
+
+
+
+
+ SELECT s.latest_revision_id
+ FROM cc_uos u, cc_uos_revisions r, cr_items i, cc_uos_textbook_set s
+ WHERE u.uos_id = :uos_id
+ AND i.item_id = u.uos_id
+ AND r.uos_revision_id = i.latest_revision
+ AND s.parent_uos_id = :uos_id
+
+
+
+
+
+ SELECT cc_uos_textbook__map (
+ :latest_revision_id,
+ :textbook_id
+ );
+
+
+
+
+
+ UPDATE cc_uos_textbook
+ SET title = :title,
+ author = :author,
+ publisher = :publisher,
+ isbn = :isbn
+ WHERE textbook_id = :textbook_id
+
+
+
+
+
+ UPDATE acs_objects
+ SET modifying_user = :modifying_user,
+ modifying_ip = :modifying_ip,
+ package_id = :package_id
+ WHERE object_id = :textbook_id
+
+
+
+
Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-ae.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-ae.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-ae.adp 2 Jun 2006 11:57:50 -0000 1.1
@@ -0,0 +1,10 @@
+
+@page_title;noquote@
+
+
+
+
+
+
+
+
Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-ae.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-ae.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-ae.tcl 2 Jun 2006 11:57:50 -0000 1.1
@@ -0,0 +1,80 @@
+ad_page_contract {
+ Add/Edit a textbook for a specific UoS.
+
+ @author Nick Carroll (nick.c@rroll.net)
+ @creation-date 2006-06-01
+ @cvs-id $Id: textbook-ae.tcl,v 1.1 2006/06/02 11:57:50 ncarroll Exp $
+} {
+ uos_id:integer
+ textbook_id:integer,optional
+ {return_url "[export_vars -url -base textbooks-view {uos_id {edit_p 1}}]"}
+}
+
+auth::require_login
+
+if { [info exists textbook_id] } {
+ set page_title [_ curriculum-central.edit_textbook]
+} else {
+ set page_title [_ curriculum-central.add_textbook]
+}
+
+set package_id [ad_conn package_id]
+set user_id [ad_conn user_id]
+
+set uos_code [db_string uos_code {} -default ""]
+
+ad_form -name textbook -cancel_url $return_url -form {
+ {textbook_id:key(acs_object_id_seq)}
+ {uos_id:text(hidden) {value $uos_id}}
+ {return_url:text(hidden) {value $return_url}}
+ {title:text
+ {html {size 50}}
+ {label "[_ curriculum-central.title]" }
+ {help_text "[_ curriculum-central.help_enter_textbook_title]"}
+ }
+ {author:text,optional
+ {html {size 50}}
+ {label "[_ curriculum-central.author]" }
+ {help_text "[_ curriculum-central.help_enter_textbook_author]"}
+ }
+ {publisher:text,optional
+ {html {size 50}}
+ {label "[_ curriculum-central.publisher]" }
+ {help_text "[_ curriculum-central.help_enter_textbook_publisher]"}
+ }
+ {isbn:text,optional
+ {html {size 15}}
+ {label "[_ curriculum-central.isbn]" }
+ {help_text "[_ curriculum-central.help_enter_textbook_isbn]"}
+ }
+} -select_query {
+ SELECT title, author, publisher, isbn
+ FROM cc_uos_textbook WHERE textbook_id = :textbook_id
+} -new_data {
+
+ db_transaction {
+ set textbook_id [package_instantiate_object \
+ -var_list [list [list package_id $package_id] \
+ [list object_type cc_uos_textbook] \
+ [list title $title] \
+ [list author $author] \
+ [list publisher $publisher] \
+ [list isbn $isbn]] \
+ -form_id textbook cc_uos_textbook]
+
+ # Retrieve the latest textbook version.
+ db_1row latest_textbook {}
+ # Map the textbook_id to the latest textbook version.
+ db_exec_plsql map_textbook_to_revision {}
+ }
+
+} -edit_data {
+ set modifying_user [ad_conn user_id]
+ set modifying_ip [ad_conn peeraddr]
+
+ db_dml textbook_update {}
+ db_dml object_update {}
+} -after_submit {
+ ad_returnredirect $return_url
+ ad_script_abort
+}
Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-del-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-del-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-del-postgresql.xql 2 Jun 2006 11:57:50 -0000 1.1
@@ -0,0 +1,19 @@
+
+
+
+ postgresql 7.4
+
+
+
+ SELECT cc_uos_textbook__del(:textbook_id)
+
+
+
+
+
+ UPDATE cc_uos_textbook_map SET textbook_id = NULL
+ WHERE textbook_id = :textbook_id
+
+
+
+
Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-del.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-del.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/iframe/textbook-del.tcl 2 Jun 2006 11:57:50 -0000 1.1
@@ -0,0 +1,21 @@
+ad_page_contract {
+ Deletes a textbook.
+
+ @author Nick Carroll (nick.c@rroll.net)
+ @creation-date 2006-06-01
+ @cvs-id $Id: textbook-del.tcl,v 1.1 2006/06/02 11:57:50 ncarroll Exp $
+} {
+ textbook_id:integer
+ uos_id:integer
+ {return_url "[export_vars -url -base textbooks-view {uos_id {edit_p 1}}]"}
+}
+
+set package_id [ad_conn package_id]
+
+db_transaction {
+ db_dml textbook_map_update {}
+ db_exec_plsql textbook_delete {}
+}
+
+ad_returnredirect $return_url
+ad_script_abort
Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/textbooks-view-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/textbooks-view-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/iframe/textbooks-view-postgresql.xql 2 Jun 2006 11:57:50 -0000 1.1
@@ -0,0 +1,29 @@
+
+
+
+ postgresql 7.4
+
+
+
+ SELECT s.textbook_set_id, s.latest_revision_id
+ FROM cc_uos u, cc_uos_revisions r, cr_items i, cc_uos_textbook_set s
+ WHERE u.uos_id = :uos_id
+ AND i.item_id = u.uos_id
+ AND r.uos_revision_id = i.latest_revision
+ AND s.parent_uos_id = :uos_id
+
+
+
+
+
+ SELECT t.textbook_id, t.title, t.author, t.publisher, t.isbn
+ FROM cc_uos_textbook t, acs_objects o, cc_uos_textbook_map m
+ WHERE o.package_id = :package_id
+ AND t.textbook_id = o.object_id
+ AND m.revision_id = :latest_revision_id
+ AND t.textbook_id = m.textbook_id
+ [template::list::orderby_clause -orderby -name "textbooks"]
+
+
+
+
Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/textbooks-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/textbooks-view.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/iframe/textbooks-view.adp 2 Jun 2006 11:57:50 -0000 1.1
@@ -0,0 +1,9 @@
+
+@page_title;noquote@
+
+
+
+
+
+
+
Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/textbooks-view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/textbooks-view.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/curriculum-central/www/coordinate/iframe/textbooks-view.tcl 2 Jun 2006 11:57:50 -0000 1.1
@@ -0,0 +1,96 @@
+ad_page_contract {
+ Page for listing textbooks for a specific UoS.
+
+ @author Nick Carroll (nick.c@rroll.net)
+ @creation-date 2006-06-01
+ @cvs-id $Id: textbooks-view.tcl,v 1.1 2006/06/02 11:57:50 ncarroll Exp $
+} {
+ uos_id:integer,notnull
+ edit_p:integer,notnull
+ {orderby "title,asc"}
+}
+
+auth::require_login
+
+set page_title "[_ curriculum-central.textbooks]"
+set context [list [list . [_ curriculum-central.coordinate]] $page_title]
+set package_id [ad_conn package_id]
+set user_id [ad_conn user_id]
+
+if { $edit_p } {
+ set elements {
+ edit {
+ sub_class narrow
+ display_template {
+
+ }
+ link_url_eval {[export_vars -url -base textbook-ae { uos_id textbook_id }]}
+ link_html {title "#curriculum-central.edit_textbook#"}
+ }
+ title {
+ label "#curriculum-central.title#"
+ }
+ author {
+ label "#curriculum-central.author#"
+ }
+ publisher {
+ label "#curriculum-central.publisher#"
+ }
+ isbn {
+ label "#curriculum-central.isbn#"
+ }
+ delete {
+ sub_class narrow
+ display_template {
+
+ }
+ link_url_eval {[export_vars -base textbook-del { uos_id textbook_id }]}
+ link_html {title "#curriculum-central.delete_textbook#" onclick "return confirm(\'[_ curriculum-central.want_to_delete_textbook]\');"}
+ }
+ }
+
+ template::list::create \
+ -name textbooks \
+ -actions [list "#curriculum-central.add_textbook#" [export_vars -base textbook-ae { uos_id }] "#curriculum-central.add_textbook_to_list#"] \
+ -multirow textbooks \
+ -no_data "#curriculum-central.no_textbooks_created#" \
+ -elements $elements \
+ -orderby {
+ title {orderby {lower(t.title)}}
+ } \
+ -filters {uos_id {} edit_p {}} \
+ -pass_properties {uos_id}
+} else {
+ set elements {
+ title {
+ label "#curriculum-central.title#"
+ }
+ author {
+ label "#curriculum-central.author#"
+ }
+ publisher {
+ label "#curriculum-central.publisher#"
+ }
+ isbn {
+ label "#curriculum-central.isbn#"
+ }
+ }
+
+ template::list::create \
+ -name textbooks \
+ -multirow textbooks \
+ -no_data "#curriculum-central.no_textbooks_created#" \
+ -elements $elements \
+ -orderby {
+ title {orderby {lower(t.title)}}
+ } \
+ -filters {uos_id {} edit_p {}} \
+ -pass_properties {uos_id}
+}
+
+set latest_revision_id ""
+db_0or1row latest_textbooks {}
+
+db_multirow textbooks get_textbooks {}
+
+ad_return_template