Index: openacs-4/contrib/packages/resource-list/resource-list.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/resource-list.info,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/resource-list/resource-list.info 6 Jun 2004 17:54:33 -0000 1.4 +++ openacs-4/contrib/packages/resource-list/resource-list.info 22 Jun 2004 19:30:21 -0000 1.5 @@ -7,14 +7,14 @@ f f - + Jade Rubick Keeps track of a list of resources, under different categories. - 2004-06-06 + 2004-06-22 Stop Abuse For Everyone - You can see a demonstration of this package on the <a href="http://www.safe4all.org/resource-list">SAFE website</a>. + You can see a demonstration of this package at the <a href="http://www.safe4all.org/resource-list">SAFE website</a>. - + Index: openacs-4/contrib/packages/resource-list/www/add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/add-edit-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/resource-list/www/add-edit-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1 +++ openacs-4/contrib/packages/resource-list/www/add-edit-postgresql.xql 22 Jun 2004 19:30:21 -0000 1.2 @@ -71,8 +71,8 @@ rl_resource_category WHERE category_type = :category_type_id - ORDER BY - short_name + ORDER BY + short_name @@ -107,10 +107,4 @@ - - - select current_timestamp from dual; - - - Index: openacs-4/contrib/packages/resource-list/www/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/add-edit.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/resource-list/www/add-edit.tcl 6 Jun 2004 17:39:00 -0000 1.4 +++ openacs-4/contrib/packages/resource-list/www/add-edit.tcl 22 Jun 2004 19:30:21 -0000 1.5 @@ -59,70 +59,9 @@ {value $description} {html { rows 5 cols 40 wrap soft}}} -} -select_query_name resource_query -on_submit { - - set user_id [ad_conn user_id] - set peeraddr [ad_conn peeraddr] - -} -new_data { - - set resource_revision_id [db_exec_plsql new_resource_item { *SQL* }] - set resource_item_id [db_string get_item_id { }] - - if {[info exists categories]} { - set searchToken [array startsearch categories] - - while {[array anymore categories $searchToken]} { - - set keyname [array nextelement categories $searchToken] - - set categories_to_insert $categories($keyname) - - foreach category_to_insert $categories_to_insert { - db_dml insert_category { } - } - } - } - - permission::grant -party_id $user_id -object_id $resource_item_id -privilege write - - util_memoize_flush "resource_list_pending_get_count_cached" - util_memoize_flush "resource_list_get_count_cached" - - ad_returnredirect "[set url]view/$resource_item_id" - ad_script_abort - -} -edit_data { - set resource_item_id [db_string get_item_id { }] - - set resource_revision_id [db_exec_plsql new_resource_revision { *SQL* }] - - db_dml delete_categories { } - - if {[info exists categories]} { - set searchToken [array startsearch categories] - - while {[array anymore categories $searchToken]} { - - set keyname [array nextelement categories $searchToken] - - set categories_to_insert $categories($keyname) - - foreach category_to_insert $categories_to_insert { - db_dml insert_category { } - } - } - } - permission::grant -party_id $user_id -object_id $resource_item_id -privilege write - -} -after_submit { - - ad_returnredirect "[set url]view/$resource_item_id" - ad_script_abort } - if {[exists_and_not_null resource_revision_id]} { set values [db_list get_categories { }] } else { @@ -149,3 +88,68 @@ ad_form -extend -name add_edit -form $ae_def } + + +ad_form -extend -name add_edit \ + -select_query_name resource_query \ + -on_submit { + + set user_id [ad_conn user_id] + set peeraddr [ad_conn peeraddr] + + } -new_data { + + set resource_revision_id [db_exec_plsql new_resource_item { *SQL* }] + set resource_item_id [db_string get_item_id { }] + + if {[info exists categories]} { + set searchToken [array startsearch categories] + + while {[array anymore categories $searchToken]} { + + set keyname [array nextelement categories $searchToken] + + set categories_to_insert $categories($keyname) + + foreach category_to_insert $categories_to_insert { + db_dml insert_category { } + } + } + } + + permission::grant -party_id $user_id -object_id $resource_item_id -privilege write + + util_memoize_flush "resource_list_pending_get_count_cached" + util_memoize_flush "resource_list_get_count_cached" + + ad_returnredirect "[set url]view/$resource_item_id" + ad_script_abort + + } -edit_data { + set resource_item_id [db_string get_item_id { }] + + set resource_revision_id [db_exec_plsql new_resource_revision { *SQL* }] + + db_dml delete_categories { } + + if {[info exists categories]} { + set searchToken [array startsearch categories] + + while {[array anymore categories $searchToken]} { + + set keyname [array nextelement categories $searchToken] + + set categories_to_insert $categories($keyname) + + foreach category_to_insert $categories_to_insert { + db_dml insert_category { } + } + } + } + permission::grant -party_id $user_id -object_id $resource_item_id -privilege write + + } -after_submit { + + ad_returnredirect "[set url]view/$resource_item_id" + ad_script_abort + } Index: openacs-4/contrib/packages/resource-list/www/category-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/category-add-edit-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/resource-list/www/category-add-edit-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1 +++ openacs-4/contrib/packages/resource-list/www/category-add-edit-postgresql.xql 22 Jun 2004 19:30:21 -0000 1.2 @@ -30,6 +30,19 @@ + + + UPDATE + rl_resource_category + SET + category_type = :category_type, + short_name = :short_name, + description = :description + WHERE + category_id = :category_id + + + insert into Index: openacs-4/contrib/packages/resource-list/www/category-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/category-add-edit.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/resource-list/www/category-add-edit.adp 30 Nov 2003 02:15:48 -0000 1.1 +++ openacs-4/contrib/packages/resource-list/www/category-add-edit.adp 22 Jun 2004 19:30:21 -0000 1.2 @@ -1,5 +1,5 @@ -@context_bar@ +@context_bar;noquote@ @title@
Index: openacs-4/contrib/packages/resource-list/www/type-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/type-add-edit.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/resource-list/www/type-add-edit.adp 30 Nov 2003 02:15:48 -0000 1.1 +++ openacs-4/contrib/packages/resource-list/www/type-add-edit.adp 22 Jun 2004 19:30:21 -0000 1.2 @@ -1,5 +1,5 @@ -@context_bar@ +@context_bar;noquote@ @title@
Index: openacs-4/contrib/packages/resource-list/www/type-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/type-add-edit.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/resource-list/www/type-add-edit.tcl 2 Mar 2004 21:32:32 -0000 1.3 +++ openacs-4/contrib/packages/resource-list/www/type-add-edit.tcl 22 Jun 2004 19:30:21 -0000 1.4 @@ -11,10 +11,7 @@ } { - resource_revision_id:integer,optional - {resource_name ""} - {description ""} - {categories ""} + category_id:integer,optional } -properties { @@ -30,14 +27,14 @@ if {[exists_and_not_null resource_id]} { - set title "Edit a $resource_term_lower" - set context_bar [ad_context_bar "Edit $resource_term"] + set title "Edit a resource type" + set context_bar [ad_context_bar "Edit resource type"] # permissions permission::require_permission -party_id $user_id -object_id $package_id -privilege write } else { - set title "Add a resource" - set context_bar [ad_context_bar "New resource"] + set title "Add a resource type" + set context_bar [ad_context_bar "New resource type"] # permissions permission::require_permission -party_id $user_id -object_id $package_id -privilege create @@ -46,64 +43,71 @@ ad_form -name add_edit -form { - resource_revision_id:key + category_id:key - {resource_name:text - {label "Resource name"} - {value $resource_name} + {short_name:text + {label "Type description"} {html {size 39}} } {description:text(textarea) {label "Description"} {optional} - {value $description} {html { rows 5 cols 40 wrap soft}}} -} -select_query_name resource_query -on_submit { + {ordering:integer(text) + {label "Ordering"} + {html {size 5}} + } +} -select_query { + SELECT + t.short_name, + t.description, + t.ordering + FROM rl_resource_category_type t + WHERE category_id = :category_id +} -on_submit { + set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] - + } -new_data { - set resource_revision_id [db_exec_plsql new_resource_item { *SQL* }] + + set category_id [db_nextval rl_resource_category_type_seq] - ad_returnredirect "one?[export_url_vars resource_revision_id]" + db_dml insert_category_type { + INSERT INTO + rl_resource_category_type + (category_id, + short_name, + description, + ordering) + VALUES + (:category_id, + :short_name, + :description, + :ordering) + } + + ad_returnredirect "types" ad_script_abort - + } -edit_data { - set resource_item_id [db_string get_item_id { }] - set resource_revision_id [db_exec_plsql new_resource_revision { *SQL* }] - + db_dml update_category_type { + UPDATE rl_resource_category_type + SET + short_name = :short_name, + description = :description, + ordering = :ordering + WHERE + category_id = :category_id + } + } -after_submit { - - ad_returnredirect "one?[export_url_vars resource_revision_id]" + + ad_returnredirect "types" ad_script_abort } - - -foreach type [db_list_of_lists get_resource_types { } ] { - - set category_type_id [lindex $type 0] - set type_short_name [lindex $type 1] - - set options [list] - db_foreach get_category_items { } { - lappend options [list $short_name $category_id] - } - - set select_name "Select: $type_short_name" - - ad_form -extend -name add_edit -form \ - [list \ - [list \ - categories:text(checkbox),multiple \ - {label $selectname} \ - {options [list $options]} \ - {values $categories} \ - ] \ - ] - -} Index: openacs-4/contrib/packages/resource-list/www/types.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/types.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/resource-list/www/types.adp 30 Nov 2003 02:15:48 -0000 1.1 +++ openacs-4/contrib/packages/resource-list/www/types.adp 22 Jun 2004 19:30:21 -0000 1.2 @@ -1,13 +1,20 @@ Resource List -@context_bar@ +@context_bar;noquote@ Types: - +
+ + + + + + + - + @@ -19,10 +26,16 @@ Categories: -
IDNameDescriptionOrdering
@types.category_id@@types.category_id@ @types.short_name@ @types.description@ @types.ordering@
+
+ + + + + + - +
IDNameDescription
@category.category_id@@category.category_id@ @category.short_name@ @category.description@