+
+Resource List
+@context_bar@
+
+@res.resource_title@
+
+
+ edit
+
+
+Description:
+
+
+
+
+
+@res.resource_description@
+ |
+
+
+Entered:
+@create.creation_date@ by @create.full_name@
+
+
+
+Categories:
+
+
+@comments@
+
+
+
+@comments_link@
Index: openacs-4/contrib/packages/resource-list/www/one.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/one.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/resource-list/www/one.tcl 30 Nov 2003 02:15:48 -0000 1.1
@@ -0,0 +1,71 @@
+ad_page_contract {
+
+ View page for a resource.
+
+ @author jade@safe4all.org
+ @creation-date 2003-08-27
+ @cvs-id $Id: one.tcl,v 1.1 2003/11/30 02:15:48 jader Exp $
+
+ @return title Page title.
+ @return context Context bar.
+ @return resources Multirow data set of resources.
+} {
+
+ resource_item_id:integer
+
+} -properties {
+
+ context_bar:onevalue
+ res:multirow
+ create:multirow
+ write_p:onevalue
+ create_p:onevalue
+ cats:multirow
+ comments:onevalue
+ comments_link:onevalue
+ edit_link:onevalue
+}
+
+# --------------------------------------------------------------- #
+
+# set up context bar
+set context_bar [ad_context_bar "View"]
+
+# the unique identifier for this package
+set package_id [ad_conn package_id]
+set user_id [ad_verify_and_get_user_id]
+
+
+db_1row res_query {} -column_array res
+
+set edit_link "add-edit?resource_revision_id=$res(resource_revision_id)"
+
+set res(resource_description) [ad_text_to_html $res(resource_description)]
+
+# permissions needs resource_item_id from res_query
+set resource_item_id $res(resource_item_id)
+
+permission::require_permission -party_id $user_id -object_id $package_id -privilege read
+
+set write_p [permission::permission_p -object_id $resource_item_id -privilege write]
+
+set create_p [permission::permission_p -object_id $package_id -privilege create]
+
+
+
+
+db_1row oldest_query {}
+
+ns_log Notice "oldest revision: $oldest_revision"
+
+db_1row create_query {} -column_array create
+
+set comments [general_comments_get_comments -print_content_p 1 $res(resource_item_id) "[ad_conn url]?resource_item_id=$res(resource_item_id)"]
+
+set comments_link [general_comments_create_link -object_name resource-list -link_text "Comment on this resource" -context_id $package_id $res(resource_item_id) "[ad_conn url]?resource_item_id=$resource_item_id"]
+
+db_multirow cats get_categories { }
+
+ad_return_template
+
+# ------------------------- END OF FILE ------------------------- #
Index: openacs-4/contrib/packages/resource-list/www/type-add-edit-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/type-add-edit-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/resource-list/www/type-add-edit-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1
@@ -0,0 +1,79 @@
+
+
+
+
+ select rl_resource__new_item (
+ null,
+ :resource_name,
+ :description,
+ now(),
+ :user_id,
+ :peeraddr,
+ :package_id
+ );
+
+
+
+
+
+ select rl_resource__new_revision (
+ :resource_item_id,
+ :resource_name,
+ :description,
+ now(),
+ :user_id,
+ :peeraddr,
+ :package_id
+ );
+
+
+
+
+
+ select
+ item_id as resource_item_id,
+ title as resource_name,
+ description
+ FROM
+ rl_resources_revisionsx
+ where resource_revision_id = :resource_revision_id
+
+
+
+
+
+ select
+ item_id as resource_item_id
+ FROM
+ rl_resources_revisionsx
+ where resource_revision_id = :resource_revision_id
+
+
+
+
+
+ select
+ category_id as category_type_id,
+ short_name as type_short_name
+ FROM
+ rl_resource_category_type
+ ORDER BY
+ ordering
+
+
+
+
+
+ select
+ category_id,
+ short_name
+ FROM
+ rl_resource_category_type
+ WHERE
+ category_id = :category_type_id
+ ORDER BY
+ ordering
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/resource-list/www/type-add-edit.adp 30 Nov 2003 02:15:48 -0000 1.1
@@ -0,0 +1,7 @@
+
+@context_bar@
+@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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/resource-list/www/type-add-edit.tcl 30 Nov 2003 02:15:48 -0000 1.1
@@ -0,0 +1,106 @@
+ad_page_contract {
+
+ Simple add/edit form for resources
+
+ @author jade@safe4all.org
+ @creation-date 2003-08-27
+ @cvs-id $Id: type-add-edit.tcl,v 1.1 2003/11/30 02:15:48 jader Exp $
+
+ @return context_bar Context bar.
+ @return title Page title.
+
+} {
+
+ resource_revision_id:integer,optional
+ {resource_name ""}
+ {description ""}
+ {categories ""}
+
+} -properties {
+
+ context_bar:onevalue
+ title:onevalue
+
+}
+
+# --------------------------------------------------------------- #
+# the unique identifier for this package
+set package_id [ad_conn package_id]
+set user_id [ad_maybe_redirect_for_registration]
+
+
+if {[exists_and_not_null resource_id]} {
+ set title "Edit a $resource_term_lower"
+ set context_bar [ad_context_bar "Edit $resource_term"]
+
+ # 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"]
+
+ # permissions
+ permission::require_permission -party_id $user_id -object_id $package_id -privilege create
+}
+
+
+
+ad_form -name add_edit -form {
+ resource_revision_id:key
+
+ {resource_name:text
+ {label "Resource name"}
+ {value $resource_name}
+ {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 {
+
+ 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* }]
+
+ ad_returnredirect "one?[export_url_vars resource_revision_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* }]
+
+} -after_submit {
+
+ ad_returnredirect "one?[export_url_vars resource_revision_id]"
+ 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]
+ }
+ ad_form -extend -name add_edit -form \
+ [list \
+ [list \
+ categories:text(checkbox),multiple \
+ {label "Select: [set type_short_name]"} \
+ {options [list $options]} \
+ {values $categories} \
+ ] \
+ ]
+
+}
Index: openacs-4/contrib/packages/resource-list/www/types-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/types-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/resource-list/www/types-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1
@@ -0,0 +1,33 @@
+
+
+postgresql7.2
+
+
+
+ SELECT
+ t.category_id,
+ t.short_name,
+ t.description,
+ t.ordering
+ FROM rl_resource_category_type t
+ ORDER BY t.ordering
+
+
+
+
+
+ SELECT
+ t.category_id as type_id,
+ t.short_name as type_short_name,
+ t.description as type_description,
+ t.ordering as type_ordering,
+ c.category_id,
+ c.short_name,
+ c.description
+ FROM rl_resource_category_type t, rl_resource_category c
+ WHERE t.category_id = c.category_type
+ ORDER BY t.ordering, c.short_name
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/resource-list/www/types.adp 30 Nov 2003 02:15:48 -0000 1.1
@@ -0,0 +1,38 @@
+
+
+Resource List
+@context_bar@
+
+Types:
+
+
+
+ @types.category_id@ |
+ @types.short_name@ |
+ @types.description@ |
+ @types.ordering@ |
+
+
+
+
+
+
+Categories:
+
+
+
+
+ @category.category_id@ |
+ @category.short_name@ |
+ @category.description@ |
+
+
+
+
+
+
+
+ Add Type
+ Add Category
+
+
Index: openacs-4/contrib/packages/resource-list/www/types.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/types.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/resource-list/www/types.tcl 30 Nov 2003 02:15:48 -0000 1.1
@@ -0,0 +1,51 @@
+ad_page_contract {
+
+ Main view page for resources.
+
+ @author jade@safe4all.org
+ @creation-date 2003-08-27
+ @cvs-id $Id: types.tcl,v 1.1 2003/11/30 02:15:48 jader Exp $
+
+ @return title Page title.
+ @return context Context bar.
+ @return resources Multirow data set of resources.
+ @return task_term Terminology for tasks
+ @return task_term_lower Terminology for tasks (lower case)
+ @return resource_term Terminology for resources
+ @return resource_term_lower Terminology for resources (lower case)
+
+} -properties {
+
+ context_bar:onevalue
+ types:multirow
+ category:multirow
+ write_p:onevalue
+ create_p:onevalue
+ admin_p:onevalue
+}
+
+# --------------------------------------------------------------- #
+
+# set up context bar
+set context_bar [ad_context_bar "Categories and category types"]
+
+# the unique identifier for this package
+set package_id [ad_conn package_id]
+set user_id [ad_maybe_redirect_for_registration]
+
+# permissions
+permission::require_permission -party_id $user_id -object_id $package_id -privilege read
+
+set write_p [permission::permission_p -object_id $package_id -privilege write]
+set create_p [permission::permission_p -object_id $package_id -privilege create]
+set admin_p [permission::permission_p -object_id $package_id -privilege admin]
+
+# root CR folder
+set root_folder [db_string get_root "select rl_resource__get_root_folder (:package_id, 'f')"]
+
+db_multirow types types_query {}
+db_multirow category category_query {}
+
+ad_return_template
+
+# ------------------------- END OF FILE ------------------------- #