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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/resource-list.info 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,24 @@ + + + + + Resource List + Resource Lists + f + f + + + Jade Rubick + Keeps track of a list of resources, under different categories. + Stop Abuse For Everyone + + + + + + + + + + + Index: openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-create.sql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,11 @@ +-- +-- packages/resource-list/sql/postgresql/resource-list-create.sql +-- +-- @author jade@safe4all.org +-- @creation-date 2003-05-15 +-- @cvs-id $Id: resource-list-create.sql,v 1.1 2003/11/30 02:15:48 jader Exp $ +-- +-- + +\i resource-list-table-create.sql +\i resource-list-functions-create.sql Index: openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-drop.sql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,73 @@ +-- packages/resource-list/sql/resource-list-drop.sql +-- drop script +-- +-- @author jade@bread.com +-- @creation-date 2003-05-15 +-- @cvs-id $Id: resource-list-drop.sql,v 1.1 2003/11/30 02:15:48 jader Exp $ +-- + +-------- +-- RESOURCES +-------- + +drop sequence rl_resources_number_seq; +drop sequence rl_resource_category_type_seq; +drop sequence rl_resource_category_seq; + +-- unregister content_types from folder +create function inline_0 () +returns integer as ' +declare + v_folder_id cr_folders.folder_id%TYPE; + v_item_id cr_items.item_id%TYPE; + v_item_cursor RECORD; +begin + + -- delete all contents of resources folder + FOR v_item_cursor IN + select + item_id + from + cr_items + where + content_type = ''rl_resource'' + LOOP + PERFORM rl_resource__delete_item(v_item_cursor.item_id); + END LOOP; + + select content_item__get_id(''resources'', null, ''f'') into v_folder_id from dual; + + -- unregister_content_types + PERFORM content_folder__unregister_content_type ( + v_folder_id, -- folder_id + ''rl_resource'', -- content_type + ''t'' -- include_subtypes + ); + + -- this table must not hold reference to ''rl_resource'' type + -- delete from cr_folder_type_map where content_type = ''rl_resource''; + + -- delete resources folder + PERFORM content_folder__delete(v_folder_id); + + return 0; +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + +drop table rl_resource_category_map; +drop table rl_resource_category; +drop table rl_resource_category_type; + +-- drop package, which drops all functions created with define_function_args +select drop_package('rl_resource'); + +drop table rl_resources; +drop table rl_resources_revisions; + +select content_type__drop_type('rl_resource', 't', 'f'); + +drop view rl_resources_revisionsx; +drop view rl_resources_revisionsi; Index: openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-functions-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-functions-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-functions-create.sql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,329 @@ +-- +-- packages/resource-list/sql/postgresql/resource-list-functions-create.sql +-- +-- @author jade@bread.com, ncarroll@ee.usyd.edu.au +-- @creation-date 2003-05-15 +-- @cvs-id $Id: resource-list-functions-create.sql,v 1.1 2003/11/30 02:15:48 jader Exp $ +-- +-- + +-- When we created the acs object type above, we specified a +-- 'name_method'. This is the name of a function that will return the +-- name of the object. This is a convention ensuring that all objects +-- can be identified. Now we have to build that function. In this case, +-- we'll return a field called title as the name. + +-- Create a new root folder + +select define_function_args('rl_resource__new_root_folder', 'package_id'); + +create or replace function rl_resource__new_root_folder (integer) +returns integer as ' +declare + p_package_id alias for $1; + + v_folder_id cr_folders.folder_id%TYPE; + v_folder_name cr_items.name%TYPE; +begin + + raise notice ''in new root folder''; + + -- Set the folder name + v_folder_name := rl_resource__new_name (p_package_id); + + v_folder_id := content_folder__new ( + v_folder_name, -- name + ''Resources'', -- label + ''Resources Repository'', -- description + 0 -- parent_id + ); + + -- Register the standard content types + PERFORM content_folder__register_content_type ( + v_folder_id, -- folder_id + ''rl_resource'', -- content_type + ''f'' -- include_subtypes + ); + + -- there is no facility in the API for adding in the package_id, + -- so we have to do it ourselves + + update cr_folders + set package_id = p_package_id + where folder_id = v_folder_id; + + -- TODO: Handle Permissions here for this folder. + + return v_folder_id; +end;' language 'plpgsql'; + + +-- Returns the root folder corresponding to a particular package instance. +-- Creates a new root folder if one does not exist for the specified package +-- instance. + +select define_function_args('rl_resource__get_root_folder', 'package_id,create_if_not_present_p'); + +create or replace function rl_resource__get_root_folder (integer, boolean) +returns integer as ' +declare + p_package_id alias for $1; + p_create_if_not_present_p alias for $2; + + v_folder_id cr_folders.folder_id%TYPE; + v_count integer; +begin + + -- raise notice ''in get root folder p_create_if_not_present_p = %'',p_create_if_not_present_p; + + select count(*) into v_count + from cr_folders + where package_id = p_package_id; + + -- raise notice ''count is % for package_id %'', v_count, p_package_id; + + if v_count > 1 then + raise exception ''More than one repository for this application instance''; + elsif v_count = 1 then + select folder_id into v_folder_id + from cr_folders + where package_id = p_package_id; + else + if p_create_if_not_present_p = true then + -- Must be a new instance. Create a new root folder. + raise notice ''creating a new root repository folder''; + v_folder_id := rl_resource__new_root_folder(p_package_id); + else + -- raise notice ''setting to null''; + v_folder_id := null; + end if; + end if; + + -- raise notice ''v_folder_id is %'', v_folder_id; + + return v_folder_id; + +end; ' language 'plpgsql'; + + +-- Create a resource item. + +create or replace function rl_resource__new_item ( + integer, -- resource_item_id + varchar, -- resource_name + varchar, -- description + timestamptz, -- creation_date + integer, -- creation_user + varchar, -- creation_ip + integer -- package_id +) returns integer +as ' +declare + p_resource_item_id alias for $1; + p_resource_name alias for $2; + p_description alias for $3; + p_creation_date alias for $4; + p_creation_user alias for $5; + p_creation_ip alias for $6; + p_package_id alias for $7; + + v_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_id cr_items.item_id%TYPE; + v_resource_item_id integer; + v_resource_number cr_items.item_id%TYPE; + v_parent_id cr_items.parent_id%TYPE; +begin + select acs_object_id_seq.nextval into v_id from dual; + + v_parent_id := rl_resource__get_root_folder (p_package_id, ''t''); + + -- raise notice ''v_parent_id (%) p_parent_id (%)'', v_parent_id, p_parent_id; + + v_item_id := content_item__new ( + v_id::varchar, -- name + v_parent_id, -- parent_id + v_id, -- item_id + null, -- locale + now(), -- creation_date + p_creation_user, -- creation_user + v_parent_id, -- context_id + p_creation_ip, -- creation_ip + ''content_item'', -- item_subtype + ''rl_resource'', -- content_type + p_resource_name, -- title + p_description, -- description + ''text/plain'', -- mime_type + null, -- nls_language + null -- data + ); + + v_revision_id := content_revision__new ( + p_resource_name, -- title + p_description, -- description + now(), -- publish_date + ''text/plain'', -- mime_type + NULL, -- nls_language + NULL, -- data + v_item_id, -- item_id + NULL, -- revision_id + now(), -- creation_date + p_creation_user, -- creation_user + p_creation_ip -- creation_ip + ); + + PERFORM content_item__set_live_revision (v_revision_id); + + -- select nextval(''rl_resources_number_seq.nextval'') into v_resource_number from dual; + + insert into rl_resources ( + resource_item_id, resource_number, approved_p) + values ( + v_item_id, v_id, ''f''); + + insert into rl_resources_revisions ( + resource_revision_id) + values ( + v_revision_id); + + PERFORM acs_permission__grant_permission( + v_revision_id, + p_creation_user, + ''admin'' + ); + + return v_revision_id; +end;' language 'plpgsql'; + + +-- The delete function deletes a record and all related overhead. + +select define_function_args('rl_resource__delete_item', 'resource_id'); + +create or replace function rl_resource__delete_item (integer) +returns integer as ' +declare + p_resource_item_id alias for $1; +begin + raise NOTICE ''Deleting rl_resource...''; + + delete from acs_permissions + where object_id = p_resource_item_id; + + delete from rl_resource_category_map where resource_item_id = p_resource_item_id; + + delete from rl_resources_revisions where resource_revision_id in (select revision_id from cr_revisions where item_id = p_resource_item_id); + + delete from rl_resources + where resource_item_id = p_resource_item_id; + + PERFORM content_item__delete(p_resource_item_id); + return 0; +end;' language 'plpgsql'; + + +select define_function_args('rl_resource__new_revision', 'resource_item_id, resource_name, description, creation_date, creation_user, creation_ip, package_id'); + +create or replace function rl_resource__new_revision ( + integer, -- resource_item_id + varchar, -- resource_name + varchar, -- description + timestamptz, -- creation_date + integer, -- creation_user + varchar, -- creation_ip + integer -- package_id +) returns integer +as ' +declare + p_resource_item_id alias for $1; + p_resource_name alias for $2; + p_description alias for $3; + p_creation_date alias for $4; + p_creation_user alias for $5; + p_creation_ip alias for $6; + p_package_id alias for $7; + + v_revision_id cr_revisions.revision_id%TYPE; +begin + + -- the item_id is the resource_id + + v_revision_id := content_revision__new ( + p_resource_name, -- title + p_description, -- description + now(), -- publish_date + ''text/plain'', -- mime_type + NULL, -- nls_language + NULL, -- data + p_resource_item_id, -- item_id + NULL, -- revision_id + now(), -- creation_date + p_creation_user, -- creation_user + p_creation_ip -- creation_ip + ); + + PERFORM content_item__set_live_revision (v_revision_id); + + insert into rl_resources_revisions ( + resource_revision_id) + values ( + v_revision_id); + + PERFORM acs_permission__grant_permission( + v_revision_id, + p_creation_user, + ''admin'' + ); + + return v_revision_id; +end;' language 'plpgsql'; + + + +-- Creates and returns a unique name. + +select define_function_args('rl_resource__new_name', 'package_id'); + +create or replace function rl_resource__new_name (integer) +returns text as ' +declare + p_package_id alias for $1; + + v_name cr_items.name%TYPE; + v_package_key apm_packages.package_key%TYPE; + v_id integer; +begin + select package_key into v_package_key from apm_packages + where package_id = p_package_id; + + select acs_object_id_seq.nextval into v_id from dual; + + -- Set the name + select v_package_key || ''_'' || + to_char(current_timestamp, ''YYYYMMDD'') || ''_'' || + v_id into v_name; + + return v_name; +end;' language 'plpgsql'; + +---------------------------------- +-- Resources +---------------------------------- + +-- When we created the acs object type above, we specified a +-- 'name_method'. This is the name of a function that will return the +-- name of the object. This is a convention ensuring that all objects +-- can be identified. Now we have to build that function. In this case, +-- we'll return a field called title as the name. + +select define_function_args('rl_resource__name', 'resource_item_id'); + +create or replace function rl_resource__name (integer) +returns varchar as ' +declare + p_rl_resource_item_id alias for $1; +begin + return p_rl_resource_item_id; +end; +' language 'plpgsql'; + Index: openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-table-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-table-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/sql/postgresql/resource-list-table-create.sql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,119 @@ + +-- packages/resources-list/sql/postgresql/resources-list-table-create.sql +-- +-- @author jade@safe4all.org +-- @creation-date 2003-08-26 +-- + +-- resources + + + +-- we create two tables to store resource information +-- the information that we keep revisions on is in the +-- rl_resource_revisions table, the rest is in rl_resource + +create sequence rl_resources_number_seq; + +create table rl_resources ( + resource_item_id integer + constraint rl_resources_resource_id_fk + references cr_items + on delete cascade + constraint rl_resource_resource_id_pk + primary key, + resource_number integer, + approved_p char(1) + constraint rl_resources_approved_ck + check(approved_p in ('t','f')) +); + + +create table rl_resources_revisions ( + resource_revision_id integer + constraint rl_resource_revs_id_fk + references cr_revisions + on delete cascade + constraint rl_resource_revs_id_pk + primary key +); + +-- create the content type +select content_type__create_type ( + 'rl_resource', -- content_type + 'content_revision', -- supertype + 'Resource', -- pretty_name + 'Resources', -- pretty_plural + 'rl_resources_revisions', -- table_name (should this be rl_resource?) + 'resource_revision_id', -- id_column + 'rl_resource__name' -- name_method +); + + +-- resource category_type + +create sequence rl_resource_category_type_seq; + +create table rl_resource_category_type ( + category_id integer + constraint rl_resource_category_pk + primary key, + short_name varchar(100), + description varchar(1000), + -- lower numbers go first in the hierarchy + ordering integer +); + +comment on table rl_resource_category_type is ' + A type of category, for example Country, or State, or Who services provided to +'; + +insert into rl_resource_category_type ( + category_id, short_name, description, ordering) +values (nextval('rl_resource_category_type_seq'),'Population', 'People who are served by this organization', '1'); + +insert into rl_resource_category_type ( + category_id, short_name, description, ordering) +values (nextval('rl_resource_category_type_seq'),'Location', 'Location this service is available in', '3'); + + +-- resource category + +create sequence rl_resource_category_seq; + +create table rl_resource_category ( + category_id integer + constraint rl_resource_category_id_pk + primary key, + category_type integer + constraint rl_resource_category_type_fk + references rl_resource_category_type, + short_name varchar(100), + description varchar(1000) +); + +comment on table rl_resource_category_type is ' + The actual category for the resource. For a category type of Country, this might be + Canada, for example. +'; + +-- mapping + +create table rl_resource_category_map ( + resource_item_id integer + constraint rl_resource_category_map_fk + references rl_resources + constraint rl_resource_category_nn + not null, + category_id integer + constraint rl_resource_category_fk + references rl_resource_category + constraint rl_resource_category_nn + not null +); + +comment on table rl_resource_category_map is ' + Keeps track of which resources are within each category +'; + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/add-edit-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,116 @@ + + + + + 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 + short_name, + category_id + FROM + rl_resource_category + WHERE + category_type = :category_type_id + ORDER BY + short_name + + + + + + insert into + rl_resource_category_map + (resource_item_id, category_id) + values + (:resource_item_id, :category_to_insert) + + + + + + select + c.category_id + FROM + rl_resource_category c, + rl_resource_category_map m, + rl_resources_revisionsx r + WHERE + m.resource_item_id = r.item_id and + c.category_id = m.category_id and + r.resource_revision_id = :resource_revision_id + + + + + + delete from rl_resource_category_map where resource_item_id = :resource_item_id + + + + + + select current_timestamp from dual; + + + + Index: openacs-4/contrib/packages/resource-list/www/add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/add-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/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/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/add-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/add-edit.tcl 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,148 @@ +ad_page_contract { + + Simple add/edit form for resources + + @author jade@safe4all.org + @creation-date 2003-08-27 + @cvs-id $Id: 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:array,multiple ""} + +} -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* }] + 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 + + ad_returnredirect "one?[export_url_vars 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 "one?[export_url_vars resource_item_id]" + ad_script_abort +} + + + +if {[exists_and_not_null resource_revision_id]} { + set values [db_list get_categories { }] +} else { + set values "" +} + + +foreach type [db_list_of_lists get_resource_types { }] { + + set category_type_id [lindex $type 0] + set type_short_name [lindex $type 1] + + ns_log Notice "category_type_id $category_type_id" + + set ae_def " + {categories.$category_type_id:text(checkbox),multiple + {label \"Select: [set type_short_name]\"} + {options {[db_list_of_lists get_category_items { }]} } + {values [list [set values]]} + } " + + ns_log Notice "ae_def: $ae_def" + + ad_form -extend -name add_edit -select_query_name do_nothing -form $ae_def + +} Index: openacs-4/contrib/packages/resource-list/www/approve-delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/approve-delete-2-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/approve-delete-2-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,66 @@ + + +postgresql7.2 + + + + select + item_id as resource_item_id + FROM + rl_resources_revisionsx + where resource_revision_id in ([join $approve ", "]) + + + + + + select + item_id as resource_item_id + FROM + rl_resources_revisionsx + where resource_revision_id in ([join $delete ","]) + + + + + + select + rl_resource__delete_item(:del) + + + + + + update + rl_resources + set approved_p = 't' + where + resource_item_id = :app + + + + + + select + item_id as resource_item_id + FROM + rl_resources_revisionsx + where resource_revision_id = :rev + + + + + + select rl_resource__new_revision ( + :resource_item_id, + :titl, + :desc, + now(), + :user_id, + :peeraddr, + :package_id + ); + + + + Index: openacs-4/contrib/packages/resource-list/www/approve-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/approve-delete-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/approve-delete-2.tcl 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,73 @@ +ad_page_contract { + + Approve or delete page + + @author jade@safe4all.org + @creation-date 2003-08-27 + @cvs-id $Id: approve-delete-2.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) + +} { + {approve:integer,multiple ""} + {delete:integer,multiple ""} + {resource_name:multiple ""} + {description:multiple,html ""} + {revisions:integer,multiple ""} +} + +# --------------------------------------------------------------- # + +# 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 admin + +# root CR folder +set root_folder [db_string get_root "select rl_resource__get_root_folder (:package_id, 'f')"] + +if {[llength $approve] > 0} { + + foreach app [db_list get_item_id_app { }] { + db_dml approve_item { } + } +} + +if {[llength $delete] > 0} { + + foreach del [db_list get_item_id_del { }] { + db_exec_plsql delete_item { } + } + +} + +set peeraddr [ad_conn peeraddr] + +set i 0 + +foreach rev $revisions { + + set resource_item_id [db_string get_item_id { } -default "-1"] + + set desc [lindex $description $i] + set desc [ad_html_to_text $desc] + set titl [lindex $resource_name $i] + + if {![string equal $resource_item_id -1]} { + db_exec_plsql update_resource { *SQL* } + } + + incr i +} + +ad_returnredirect index + +# ------------------------- END OF FILE ------------------------- # Index: openacs-4/contrib/packages/resource-list/www/approve-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/approve-delete-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/approve-delete-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,28 @@ + + +postgresql7.2 + + + + SELECT + r.title as resource_title, + r.description as resource_description, + r.revision_id as resource_revision_id, + r.item_id as resource_item_id, + c.short_name as category_name + FROM + rl_resources_revisionsx r, + rl_resources rl, + cr_items i, + rl_resource_category_map m, + rl_resource_category c + WHERE r.resource_revision_id = i.live_revision and + m.resource_item_id = r.item_id and + m.category_id = c.category_id and + r.item_id = rl.resource_item_id and + rl.approved_p = 'f' + ORDER BY r.item_id, r.title, c.short_name + + + + Index: openacs-4/contrib/packages/resource-list/www/approve-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/approve-delete.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/approve-delete.adp 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,39 @@ + + +Resource List +@context_bar@ + + + + + + + + + + + + + + + + + + + + + + + + + +
ApproveDeleteNameDescriptionCategories
  • @resources.category_name@
+
+ +Select the type of services you are looking for below: +

+ + +
Edit types + + Index: openacs-4/contrib/packages/resource-list/www/approve-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/approve-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/approve-delete.tcl 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,53 @@ +ad_page_contract { + + Main view page for resources. + + @author jade@safe4all.org + @creation-date 2003-08-27 + @cvs-id $Id: approve-delete.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) + +} { + {category:integer,multiple ""} +} -properties { + count:onevalue + pending:onevalue + context_bar:onevalue + types:multirow + resources:multirow + write_p:onevalue + create_p:onevalue + admin_p: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_maybe_redirect_for_registration] + +# permissions +permission::require_permission -party_id $user_id -object_id $package_id -privilege admin + +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 resources resource_query_by_category {} + +ad_return_template + +# ------------------------- END OF FILE ------------------------- # 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/category-add-edit-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,43 @@ + + + + + + + + + + + select + category_id, + category_type, + short_name, + description + from + rl_resource_category + where + category_id = :category_id + + + + + + select + short_name, + category_id as my_cat_id + from + rl_resource_category_type + + + + + + insert into + rl_resource_category + (category_id, category_type, short_name, description) + values + (:category_id, :category_type, :short_name, :description) + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/category-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/category-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/category-add-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/category-add-edit.tcl 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,86 @@ +ad_page_contract { + + Simple add/edit form for categories + + @author jade@safe4all.org + @creation-date 2003-09-02 + @cvs-id $Id: category-add-edit.tcl,v 1.1 2003/11/30 02:15:48 jader Exp $ + + @return context_bar Context bar. + @return title Page title. + +} { + + category_id:integer,optional + {category_type ""} + {short_name ""} + {description ""} + +} -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 category_id]} { + set title "Edit a category" + set context_bar [ad_context_bar "Edit category"] + + # permissions + permission::require_permission -party_id $user_id -object_id $package_id -privilege write +} else { + set title "Add a category" + set context_bar [ad_context_bar "New category"] + + # permissions + permission::require_permission -party_id $user_id -object_id $package_id -privilege create +} + + +ad_form -name add_edit -form { + category_id:key(rl_resource_category_seq) + + {category_type:text(select) + {label "Type"} + {options {[db_list_of_lists get_category_types { }]} } + } + + {short_name:text + {label "Category short name"} + {value $short_name} + {html {size 39}} + } + + {description:text(textarea) + {label "Description"} + {optional} + {value $description} + {html { rows 5 cols 40 wrap soft}}} + +} -select_query_name category_query -on_submit { + + set user_id [ad_conn user_id] + set peeraddr [ad_conn peeraddr] + +} -new_data { + db_dml new_category { } + + ad_returnredirect "types" + ad_script_abort + +} -edit_data { + + db_dml update_category { } + +} -after_submit { + + ad_returnredirect "types" + ad_script_abort +} Index: openacs-4/contrib/packages/resource-list/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/index-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/index-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,101 @@ + + +postgresql7.2 + + + + SELECT + r.title as resource_title, + r.description as resource_description, + r.revision_id as resource_revision_id + FROM rl_resources_revisionsx r, cr_items i, rl_resources rs + WHERE r.resource_revision_id = i.live_revision and + r.item_id = rs.resource_item_id and + rs.approved_p = 't' + ORDER BY r.title + + + + + + SELECT + c2.short_name, + r.title as resource_title, + substring(r.description,1,200) || '...' as resource_description, + r.revision_id as resource_revision_id, + r.item_id as resource_item_id + FROM + rl_resources_revisionsx r, + rl_resources rl, + cr_items i, + rl_resource_category_map m, + rl_resource_category_map m2, + rl_resource_category c, + rl_resource_category c2 + WHERE + r.resource_revision_id = i.live_revision and + m.resource_item_id = r.item_id and + m2.resource_item_id = r.item_id and + m.category_id = :category and + m.category_id = c.category_id and + m2.category_id = c2.category_id and + c.category_type != c2.category_type and + r.item_id = rl.resource_item_id and + rl.approved_p = 't' + ORDER BY c2.short_name, r.title + + + + + + SELECT + count(*) + FROM rl_resources_revisionsx r, cr_items i, rl_resources rl + WHERE r.resource_revision_id = i.live_revision + and r.item_id = rl.resource_item_id and + rl.approved_p = 't' + + + + + + SELECT + count(*) + FROM rl_resources_revisionsx r, cr_items i, rl_resources rl + WHERE r.resource_revision_id = i.live_revision + and r.item_id = rl.resource_item_id and + rl.approved_p = 'f' + + + + + + SELECT + t.short_name as type_name, + t.description as type_desc, + c.short_name as cat_name, + c.description as cat_desc, + c.category_id + FROM + rl_resource_category_type t, + rl_resource_category c + WHERE + c.category_type = t.category_id + ORDER BY t.ordering, c.short_name + + + + + + SELECT + t.short_name || ': ' || c.short_name as type_name + FROM + rl_resource_category_type t, + rl_resource_category c + WHERE + c.category_type = t.category_id + and c.category_id = :category + + + + Index: openacs-4/contrib/packages/resource-list/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/index.adp 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,67 @@ + + +Resource List +@context_bar@ + +

@current_category@

+ +

+ + Suggest a resource + + + If you were logged in, you could suggest a resource + + + +
Edit types +
+

+ + + + + + + + + + + +
+ @resources.short_name@
+ +

@resources.resource_title@

@resources.resource_description@

+ +

+ + +

+ + + No resources found. Please help someone else out by entering any resources you find in other locations.


+
+
+ + Select the type of services you are looking for below: +

+ + + + By @types.type_name@ +

+ + +

+ + +@count@ resources and
+@pending@ resources pending +(approve) +
+

+ Index: openacs-4/contrib/packages/resource-list/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/index.tcl 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,83 @@ +ad_page_contract { + + Main view page for resources. + + @author jade@safe4all.org + @creation-date 2003-08-27 + @cvs-id $Id: index.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) + +} { + {category:integer ""} +} -properties { + count:onevalue + pending:onevalue + context_bar:onevalue + types:multirow + resources:multirow + has_category_p:onevalue + current_category:onevalue + categories_url:onevalue + write_p:onevalue + create_p:onevalue + admin_p:onevalue + +} + +# --------------------------------------------------------------- # + +# set up context bar +if {[exists_and_not_null category]} { + set context_bar [ad_context_bar "Index"] + set current_category [db_string get_category_name { }] +} else { + set context_bar [list] + + set current_category "" + +} + +# the unique identifier for this package +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] + +# 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 get_category_types { } + +set count [db_string resource_count { }] +set pending [db_string resource_count_pending { }] + +if {[exists_and_not_null category]} { + set where_clause "" + foreach catg $category { + append where_clause "m.category_id = $catg and " + } + + db_multirow resources resource_query_by_category {} { + set resource_description [ad_text_to_html $resource_description] + } + set has_category_p t +} else { + db_multirow resources resource_query {} + set has_category_p f +} + +ad_return_template + +# ------------------------- END OF FILE ------------------------- # Index: openacs-4/contrib/packages/resource-list/www/one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/one-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/one-postgresql.xql 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,59 @@ + + +postgresql7.2 + + + + SELECT + r.title as resource_title, + r.description as resource_description, + r.revision_id as resource_revision_id, + r.item_id as resource_item_id + FROM + rl_resources_revisionsx r, cr_items i + WHERE + r.item_id = :resource_item_id and + i.live_revision = r.revision_id + + + + + + SELECT + min(revision_id) as oldest_revision + FROM + rl_resources_revisionsx r + WHERE + r.item_id = '$res(resource_item_id)' + + + + + + SELECT + to_char(r.creation_date,'Month DD YYYY') as creation_date, + c.first_names || ' ' || c.last_name as full_name + FROM + rl_resources_revisionsx r, cc_users c + WHERE + r.revision_id = :oldest_revision and + r.creation_user = c.user_id + + + + + + select + short_name + FROM + rl_resource_category c, + rl_resource_category_map m, + rl_resources_revisionsx r + WHERE + m.resource_item_id = r.item_id and + c.category_id = m.category_id and + r.revision_id = $res(resource_revision_id) + + + + Index: openacs-4/contrib/packages/resource-list/www/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/resource-list/www/one.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/resource-list/www/one.adp 30 Nov 2003 02:15:48 -0000 1.1 @@ -0,0 +1,38 @@ + + +Resource List +@context_bar@ + +

@res.resource_title@

+ + + edit

+ + +Description: +

+ + + + + +
+@res.resource_description@ +
+Entered: +@create.creation_date@ by @create.full_name@ + +

+ +Categories: +

    + +
  • @cats.short_name@ + +
+ +@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 ------------------------- #