Index: openacs-4/packages/download/download.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/download.info,v diff -u -r1.5 -r1.6 --- openacs-4/packages/download/download.info 30 Aug 2001 05:06:04 -0000 1.5 +++ openacs-4/packages/download/download.info 23 Feb 2002 05:15:27 -0000 1.6 @@ -1,5 +1,5 @@ - + Download @@ -18,11 +18,12 @@ 2001-01-19 OpenACS + + - Index: openacs-4/packages/download/sql/postgresql/download-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/sql/postgresql/download-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/download/sql/postgresql/download-create.sql 9 Jul 2001 15:34:05 -0000 1.4 +++ openacs-4/packages/download/sql/postgresql/download-create.sql 23 Feb 2002 05:15:27 -0000 1.5 @@ -1,3 +1,12 @@ +-- +-- packages/sdm/sql/download/download-create.sql +-- +-- +-- @author Vinod Kurup (vinod@kurup.com) +-- +-- @cvs-id $Id$ +-- + -- Note cr_items has available: -- parent_id -- name @@ -23,40 +32,16 @@ constraint download_repository_id_pk primary key ); -create function inline_0 () -returns integer as ' -begin - PERFORM content_type__create_type ( - ''cr_download_rep'', - ''content_revision'', - ''Download Repository'', - ''Download Repositories'', - ''download_repository'', - ''repository_id'', +select content_type__create_type ( + 'cr_download_rep', + 'content_revision', + 'Download Repository', + 'Download Repositories', + 'download_repository', + 'repository_id', null - ); +); - return 0; -end;' language 'plpgsql'; - -select inline_0 (); - -drop function inline_0 (); - ---begin --- content_type.create_type ( --- content_type => 'cr_download_rep', --- pretty_name => 'Download Repository', --- pretty_plural => 'Download Repositories', --- table_name => 'download_repository', --- id_column => 'repository_id' --- ); ---end; ---/ ---show errors - - - comment on table download_repository is ' This table stores the actual download repositories. Each repository has a title and description of the repository. Meta information about what can be stored in @@ -79,7 +64,6 @@ references download_repository (repository_id), pretty_name varchar(100) not null, description varchar(500) not null --- unique (repository_id, short_name) constraint download_archive_types_shrt_name_un unique ); comment on table download_archive_types is ' @@ -97,7 +81,6 @@ constraint download_reason_id_fk references download_repository (repository_id) , reason varchar(500) not null --- unique (repository_id, reason) constraint download_reason_un unique ); comment on table download_archive_types is ' @@ -215,8 +198,7 @@ -- vendor (via metadata) -- owner (via metadata) --- not sure where most of the above stuff is, --- but I added file_size, cuz the oracle version +-- I added file_size, cuz the oracle version -- keeps content in blobs and thus can easily -- get file_size from the database -- vinodk 2001-05-16 @@ -237,23 +219,6 @@ not null ); --- added table download_archive_descs - vinodk --- Normally this table is created during content_type__create_type --- but it only contains the primary key --- I want it to also contain file_size, since the oracle version --- calculates file_size in the database. - ---create table download_archive_descs ( --- archive_desc_id integer --- constraint download_ar_desc_id_fk --- references cr_items (item_id) on delete cascade --- constraint download_ar_desc_id_pk --- primary key, --- file_size integer --- constraint download_ar_desc_fs_nn --- not null ---); - -- Storage of the metadata per archive -- Long skinny table. create table download_revision_data ( @@ -308,94 +273,42 @@ reason text ); -create function inline_1 () -returns integer as ' -begin - PERFORM content_type__create_type ( - ''cr_download_archive'', - ''content_revision'', - ''Download Archive'', - ''Download Archives'', - ''download_archives'', - ''archive_id'', +select content_type__create_type ( + 'cr_download_archive', + 'content_revision', + 'Download Archive', + 'Download Archives', + 'download_archives', + 'archive_id', null - ); +); - PERFORM content_type__register_child_type( - ''cr_download_rep'', - ''cr_download_archive'', - ''generic'', +select content_type__register_child_type( + 'cr_download_rep', + 'cr_download_archive', + 'generic', 0, null - ); +); - return 0; -end;' language 'plpgsql'; - -select inline_1 (); - -drop function inline_1 (); - -create function inline_2 () -returns integer as ' -begin - PERFORM content_type__create_type ( - ''cr_download_archive_desc'', - ''content_revision'', - ''Download Archive Description'', - ''Download Archive Descriptions'', - ''download_archive_descs'', - ''archive_desc_id'', +select content_type__create_type ( + 'cr_download_archive_desc', + 'content_revision', + 'Download Archive Description', + 'Download Archive Descriptions', + 'download_archive_descs', + 'archive_desc_id', null - ); +); - PERFORM content_type__register_child_type( - ''cr_download_rep'', - ''cr_download_archive_desc'', - ''generic'', +select content_type__register_child_type( + 'cr_download_rep', + 'cr_download_archive_desc', + 'generic', 0, null - ); +); - return 0; -end;' language 'plpgsql'; - -select inline_2 (); - -drop function inline_2 (); - ---begin --- content_type.create_type ( --- content_type => 'cr_download_archive', --- pretty_name => 'Download Archive', --- pretty_plural => 'Download Archive', --- table_name => 'download_archives', --- id_column => 'archive_id' --- ); --- --- content_type.register_child_type( --- parent_type => 'cr_download_rep', --- child_type => 'cr_download_archive' --- ); --- --- --- content_type.create_type ( --- content_type => 'cr_download_archive_desc', --- pretty_name => 'Download Archive Description', --- pretty_plural => 'Download Archive Description', --- table_name => 'download_archive_descs', --- id_column => 'archive_desc_id' --- ); --- --- content_type.register_child_type( --- parent_type => 'cr_download_rep', --- child_type => 'cr_download_archive_desc' --- ); --- ---end; ---/ ---show errors - create view download_repository_obj as select repository_id, o.*, Index: openacs-4/packages/download/sql/postgresql/download-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/sql/postgresql/download-drop.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/download/sql/postgresql/download-drop.sql 23 May 2001 20:00:56 -0000 1.6 +++ openacs-4/packages/download/sql/postgresql/download-drop.sql 23 Feb 2002 05:15:35 -0000 1.7 @@ -1,4 +1,13 @@ -- +-- packages/sdm/sql/download/download-drop.sql +-- +-- +-- @author Vinod Kurup (vinod@kurup.com) +-- +-- @cvs-id $Id$ +-- + +-- -- Drop the data model and the PL/SQL packages. -- @@ -58,30 +67,6 @@ drop function inline_0 (); ---begin --- for archive_rec in (select item_id from cr_items where content_type = 'cr_download_archive_desc') --- loop --- content_item.delete(archive_rec.item_id); --- end loop; ---end; ---/ --- ---begin --- for archive_rec in (select item_id from cr_items where content_type = 'cr_download_archive') --- loop --- content_item.delete(archive_rec.item_id); --- end loop; ---end; ---/ --- ---begin --- for archive_rec in (select item_id from cr_items where content_type = 'cr_download_rep') --- loop --- content_item.delete(archive_rec.item_id); --- end loop; ---end; ---/ - /* acs_object_type */ create function inline_1 () @@ -124,48 +109,3 @@ drop function inline_1 (); ---begin --- content_type.unregister_child_type( --- parent_type => 'cr_download_rep', --- child_type => 'cr_download_archive', --- relation_tag => 'generic' --- ); --- --- content_type.unregister_child_type( --- parent_type => 'cr_download_rep', --- child_type => 'cr_download_archive_desc', --- relation_tag => 'generic' --- ); ---end; ---/ --- ---begin --- acs_object_type.drop_type( --- object_type => 'cr_download_archive_desc', --- cascade_p => 't' --- ); ---end; ---/ ---show errors --- ---begin --- acs_object_type.drop_type( --- object_type => 'cr_download_rep', --- cascade_p => 't' --- ); ---end; ---/ ---show errors --- ---begin --- acs_object_type.drop_type( --- object_type => 'cr_download_archive', --- cascade_p => 't' --- ); --- ---end; ---/ ---show errors --- - ---drop package download_rep; Index: openacs-4/packages/download/sql/postgresql/download-packages.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/sql/postgresql/download-packages.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/download/sql/postgresql/download-packages.sql 14 May 2001 20:31:08 -0000 1.3 +++ openacs-4/packages/download/sql/postgresql/download-packages.sql 23 Feb 2002 05:15:35 -0000 1.4 @@ -1,3 +1,12 @@ +-- +-- packages/sdm/sql/download/download-packages.sql +-- +-- +-- @author Vinod Kurup (vinod@kurup.com) +-- +-- @cvs-id $Id$ +-- + --Defines the following packages: -- -- Download Repository @@ -137,126 +146,3 @@ return 0; end;' language 'plpgsql'; ---create or replace package download_rep as --- --- function new ( --- repository_id in acs_objects.object_id%TYPE, --- title in cr_revisions.title%TYPE, --- description in cr_revisions.description%TYPE, --- help_text in varchar2 default null, --- creation_date in acs_objects.creation_date%TYPE default sysdate, --- creation_user in acs_objects.creation_user%TYPE default null, --- parent_id in cr_items.parent_id%TYPE default null, --- context_id in acs_objects.context_id%TYPE default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return download_repository.repository_id%TYPE; --- --- procedure edit ( --- repository_id in acs_objects.object_id%TYPE, --- title in cr_revisions.title%TYPE, --- description in cr_revisions.description%TYPE, --- help_text in varchar2 default null, --- last_modified in acs_objects.last_modified%TYPE default sysdate, --- modifying_user in acs_objects.modifying_user%TYPE default null, --- modifying_ip in acs_objects.modifying_ip%TYPE default null --- ); --- --- procedure delete ( --- repository_id in acs_objects.object_id%TYPE --- ); --- ---end download_rep; ---/ ---show errors --- --- ---create or replace package body download_rep as --- --- function new ( --- repository_id in acs_objects.object_id%TYPE, --- title in cr_revisions.title%TYPE, --- description in cr_revisions.description%TYPE, --- help_text in varchar2 default null, --- creation_date in acs_objects.creation_date%TYPE default sysdate, --- creation_user in acs_objects.creation_user%TYPE default null, --- parent_id in cr_items.parent_id%TYPE default null, --- context_id in acs_objects.context_id%TYPE default null, --- creation_ip in acs_objects.creation_ip%TYPE default null --- ) return download_repository.repository_id%TYPE --- is --- v_name cr_items.name%TYPE; --- v_repository_id integer; --- begin --- v_name := 'download_repository' || repository_id; --- v_repository_id := content_item.new ( --- content_type => 'cr_download_rep', --- item_id => new.repository_id, --- name => v_name, --- parent_id => new.parent_id, --- context_id => new.context_id, --- title => new.title, --- description => new.description, --- text => new.help_text, --- creation_date => new.creation_date, --- creation_user => new.creation_user, --- creation_ip => new.creation_ip, --- is_live => 't' --- ); --- --- insert into download_repository --- (repository_id) --- values --- (new.repository_id); --- --- return v_repository_id; --- end new; --- --- procedure edit ( --- repository_id in acs_objects.object_id%TYPE, --- title in cr_revisions.title%TYPE, --- description in cr_revisions.description%TYPE, --- help_text in varchar2 default null, --- last_modified in acs_objects.last_modified%TYPE default sysdate, --- modifying_user in acs_objects.modifying_user%TYPE default null, --- modifying_ip in acs_objects.modifying_ip%TYPE default null --- ) --- is --- v_revision_id integer; --- begin --- v_revision_id := content_revision.new ( --- item_id => edit.repository_id, --- title => edit.title, --- description => edit.description, --- text => edit.help_text, --- creation_date => edit.last_modified, --- creation_user => edit.modifying_user, --- creation_ip => edit.modifying_ip --- ); --- content_item.set_live_revision(v_revision_id); --- --- --- update acs_objects set --- last_modified = edit.last_modified, --- modifying_user = edit.modifying_user, --- modifying_ip = edit.modifying_ip --- where object_id = edit.repository_id; --- --- end edit; --- --- --- procedure delete ( --- repository_id in acs_objects.object_id%TYPE --- ) --- is --- begin --- update acs_objects set context_id = null where context_id = download_rep.delete.repository_id; --- --- delete from download_repository --- where repository_id = download_rep.delete.repository_id; --- --- acs_object.delete(repository_id); --- end; --- ---end download_rep; ---/ ---show errors Index: openacs-4/packages/download/tcl/download-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/tcl/download-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/download/tcl/download-procs.tcl 31 Oct 2001 20:42:07 -0000 1.6 +++ openacs-4/packages/download/tcl/download-procs.tcl 23 Feb 2002 05:15:35 -0000 1.7 @@ -69,7 +69,7 @@ } "text" { - append html "" + append html "" } "date" { append html "[ad_dateentrywidget $element_name $user_value]" @@ -245,18 +245,23 @@ dam.archive_type_id is null) order by sort_key } { - if { $data_type == "date" } { - if [catch { set metadata($metadata_id) [validate_ad_dateentrywidget "" metadata.$metadata_id [ns_getform]]} errmsg] { - ad_complain "$errmsg: Please make sure your dates are valid." - } - } + # date's are complex. convert them first + if { $data_type == "date" } { + if [catch { set metadata($metadata_id) [validate_ad_dateentrywidget "" metadata.$metadata_id [ns_getform]]} errmsg] { + if {$required_p == "t"} { + ad_complain "$errmsg: Please make sure your dates are valid." + } else { + set metadata($metadata_id) "" + } + } + } if { [exists_and_not_null metadata($metadata_id)] } { set response_value [string trim $metadata($metadata_id)] } elseif {$required_p == "t"} { lappend metadata_with_missing_responses $pretty_name continue } else { - set response_to_question($question_id) "" + set response_to_question($metadata_id) "" set response_value "" } if {![empty_string_p $response_value]} { @@ -271,11 +276,11 @@ ad_complain "The value for \"$metadata\" must be an integer. Your value was \"$response_value\"." continue } - } + } } - ns_log Notice "LOGGING: Metadata $pretty_name: $metadata($metadata_id)" +# ns_log Notice "LOGGING: Metadata $pretty_name: $metadata($metadata_id)" } if { [llength $metadata_with_missing_responses] > 0 } { ad_complain "You didn't respond to all required sections. You skipped:" Index: openacs-4/packages/download/www/doc/requirements.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/doc/requirements.html,v diff -u -r1.1 -r1.2 --- openacs-4/packages/download/www/doc/requirements.html 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/download/www/doc/requirements.html 23 Feb 2002 05:15:35 -0000 1.2 @@ -7,14 +7,14 @@

Download Package Requirements

by Joseph Bank - based largely on the ACS Repository requirements written by by Todd Nightingale + based largely on the ACS Repository requirements written by Todd Nightingale
This is a DRAFT

I. Introduction

-

ACS 4.x has a file storage module, so an obvious question is: +

OpenACS 4.x has a file storage module, so an obvious question is: "Why do we need a seperate download module?" The download module is targeted at a different usage pattern and interface. The intent of the download module is to provide an online repository @@ -33,7 +33,7 @@

There are thousands of independent developers all over the world - writing their own ACS packages. Without a canonical distribution + writing their own OpenACS packages. Without a canonical distribution point finding the packages you need becomes a formidable task, forcing developers to duplicating each others efforts. The download module allows us to setup a package repository service @@ -45,7 +45,7 @@

III. System/Application Overview

- The ACS download package provides an application for managing file + The OpenACS download package provides an application for managing file distribution.

@@ -74,9 +74,9 @@ Joe Contributer (currently working for Joe.com) writes a piece of software used to do knowledge management (KM) for the ACS. He packages his code using the APM. Joe - feels that others could gain from using his knew package so he uploads - it the the ArsDigita Package Repository. Since it is in APM format in + href=/doc/packages>APM. Joe + feels that others could gain from using his new package so he uploads + it to the OpenACS Package Repository. Since it is in APM format, in one step a package, version, vendor, owner and description data are all uploaded (extracted from the .info file). @@ -86,7 +86,7 @@ to not allow users to download versions pending approval. That forces her to download Joe's package from the admin pages and install it. She notices that it isn't malicious in any way and doesn't harm her - ACS installation so she approves it to go live on her package + OpenACS installation so she approves it to go live on her package repository. Joe is informed via email that his package was approved (because Jane set this configuration parameter). @@ -96,15 +96,15 @@ a package repository and finds Joe's KM package. He notices that many other users have downloaded the package and have made comments praising the package as well as Joe.com. Since Ben is a - follower by heart he decides to download the package as well and + follower by heart, he decides to download the package as well and install it on his system. (Ben's crafty friend Alyssa later informs Ben that he could have just had the APM install directly from the repository url).

Benny Beancounter loves to learn about who's downloading files from - his site and what reasons they give for downloads. On a frequent basis + his site and what reasons they give for downloads. On a frequent basis, Benny visits the download packages admin pages and views a report of how many downloads occured for each file. He then drills down on a particular file and views a list of the users who downloaded the file @@ -114,7 +114,8 @@

V. Related Links

@@ -123,19 +124,19 @@

10.0 Versioned File Storage

- ACS Download must provide versioned file storage. + OpenACS Download must provide versioned file storage.

20.0 User Tracking

- ACS Download must store information about which users have downloaded which files (including versions). + OpenACS Download must store information about which users have downloaded which files (including versions).

20.0 Package Based Meta Information

- ACS Download must be able to store arbitrary meta information on a per package basis. + OpenACS Download must be able to store arbitrary meta information on a per package basis. i.e. All files provided by this instance of the package require the fields x, y and z.

@@ -316,6 +317,13 @@ + 0.3 + Minor edits. Few typos & links fixed. ACS changed to OpenACS. + 2/16/2002 + Vinod Kurup + + + 0.2 Edited to include original requirements from the ACS Repository 12/10/2000