Index: openacs-4/packages/attachments/attachments.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/attachments.info,v diff -u -r1.4 -r1.5 --- openacs-4/packages/attachments/attachments.info 11 Jul 2002 04:39:58 -0000 1.4 +++ openacs-4/packages/attachments/attachments.info 12 Jul 2002 14:19:06 -0000 1.5 @@ -24,7 +24,10 @@ + + + @@ -46,13 +49,15 @@ + + - + Index: openacs-4/packages/attachments/sql/postgresql/attachments-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/sql/postgresql/attachments-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attachments/sql/postgresql/attachments-create.sql 12 Jul 2002 14:19:06 -0000 1.1 @@ -0,0 +1,46 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- this is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- this is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- attachments +-- +-- @author arjun (arjun@openforce.net) +-- @version $Id: attachments-create.sql,v 1.1 2002/07/12 14:19:06 ben Exp $ +-- + +create table attachments_fs_root_folder_map ( + package_id integer + constraint attach_fldr_map_package_id_fk + references apm_packages (package_id) + constraint attach_fldr_map_package_id_un + unique, + folder_id integer + constraint attach_fldr_map_folder_id_fk + references fs_root_folders (folder_id), + constraint attach_fldr_map_pk + primary key (package_id, folder_id) +); + +create table attachments ( + object_id integer + constraint attachments_object_id_fk + references acs_objects(object_id) + on delete cascade, + item_id integer + constraint attachments_item_id_fk + references acs_objects(object_id) + on delete cascade, + constraint attachments_pk + primary key (object_id, item_id) +); Index: openacs-4/packages/attachments/sql/postgresql/attachments-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/sql/postgresql/attachments-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attachments/sql/postgresql/attachments-drop.sql 12 Jul 2002 14:19:06 -0000 1.1 @@ -0,0 +1,23 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- this is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- this is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- attachments +-- +-- @author arjun (arjun@openforce.net) +-- @version $Id: attachments-drop.sql,v 1.1 2002/07/12 14:19:06 ben Exp $ +-- + +drop table attachments; +drop table attachment_root_folders; Index: openacs-4/packages/attachments/tcl/attachments-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/tcl/Attic/attachments-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attachments/tcl/attachments-procs-postgresql.xql 12 Jul 2002 14:19:26 -0000 1.1 @@ -0,0 +1,12 @@ + + +postgresql7.1 + + + +select item_id, acs_object__name(item_id) from attachments +where object_id= :object_id + + + + Index: openacs-4/packages/attachments/www/attach-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/attach-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/attachments/www/attach-2.tcl 2 Jul 2002 04:18:54 -0000 1.1 +++ openacs-4/packages/attachments/www/attach-2.tcl 12 Jul 2002 14:19:06 -0000 1.2 @@ -14,8 +14,13 @@ # Perms permission::require_permission -object_id $object_id -privilege write -# Perform the attachment -attachments::attach -object_id $object_id -attachment_id $item_id +if {[catch { + # Perform the attachment + attachments::attach -object_id $object_id -attachment_id $item_id +} errmsg]} { + # Attachment already exists, just keep going + ns_log Notice "Attachment $item_id to Object $object_id already exists" +} ad_returnredirect $return_url Index: openacs-4/packages/attachments/www/file-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/file-add.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/attachments/www/file-add.adp 2 Jul 2002 19:41:20 -0000 1.2 +++ openacs-4/packages/attachments/www/file-add.adp 12 Jul 2002 14:19:06 -0000 1.3 @@ -2,7 +2,7 @@ Upload New Attachment @context_bar@ -You are attaching a document to @pretty_object_name@.

+You are attaching a new document to @pretty_object_name@.

Index: openacs-4/packages/attachments/www/simple-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/simple-add.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/attachments/www/simple-add.adp 2 Jul 2002 19:41:20 -0000 1.2 +++ openacs-4/packages/attachments/www/simple-add.adp 12 Jul 2002 14:19:06 -0000 1.3 @@ -2,7 +2,7 @@ Attach URL @context_bar@ -You are attaching a document to @pretty_object_name@.

+You are attaching a new url to @pretty_object_name@.