Index: openacs-4/packages/photo-album/photo-album.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/photo-album.info,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/photo-album.info 10 Jun 2003 10:04:23 -0000 1.1 +++ openacs-4/packages/photo-album/photo-album.info 12 Jun 2003 06:55:44 -0000 1.2 @@ -6,82 +6,101 @@ Photo Albums f f - - + + oracle postgresql Jeff Davis Walter McGinnis Tom Baginski - A photo album application that provides photo display + A photo album application that provides photo display and grouping functionality using the ACS Content Repository. - 2002-10-29 + 2003-04-30 OpenACS - -A photo album application that provides photo display and grouping -functionality using the ACS Content Repository. + A photo album application that provides photo display and grouping +functionality using the ACS Content Repository. + +Allows users to upload photos, store and edit attributes, and group +photos into albums and folders. Allows site administrators to set +permissions that control who can do and see what within a photo album +application. Includes sub-site support. + +Requires installation of ImageMagick and jhead on host machine. See design doc +for details. + +Heavily modified from the original Ars Digita version by +davis@xarg.net. -Allows users to upload photos, store and edit attributes, and group -photos into albums and folders. Allows site administrators to set -permissions that control who can do and see what within a photo album -application. Includes sub-site support. - -Requires installation of ImageMagick on host machine. See design doc -for details. - -Heavily modified from the original Ars Digita version by -davis@xarg.net. In progres. Please do not fork it up and feed fixes -back to me. thanks. - - - + + + + + + - - + - + - - + - + - + + + + + + + + + + + + + + + + + + + + @@ -92,74 +111,80 @@ - + - + - + - + - + - + - - + - + + + - + + + + + + - + + - - - + + Index: openacs-4/packages/photo-album/sql/test.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/Attic/test.sql,v diff -u -N --- openacs-4/packages/photo-album/sql/test.sql 10 Jun 2003 10:04:57 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -select * from acs_objects where object_id > 18553; - -select * from cr_items where item_id > 18553; - -select * from cr_revisions where revision_id > 18553; - -select * from images where image_id > 18553; - -select * from pa_photos where pa_photo_id > 18553; - -select * from cr_child_rels where rel_id > 18553; - -select object_id, acs_object__name(object_id) from acs_objects where object_id > 18553; - Index: openacs-4/packages/photo-album/sql/oracle/pa-clip-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/oracle/pa-clip-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/sql/oracle/pa-clip-drop.sql 12 Jun 2003 06:55:44 -0000 1.1 @@ -0,0 +1,32 @@ +-- /packages/photo-album/sql/oracle/pa-clip-drop.sql + +-- drop the clip stuff +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2003-04-30 +-- @cvs-id $Id: pa-clip-drop.sql,v 1.1 2003/06/12 06:55:44 vinodk Exp $ + +declare + cursor coll_cursor is + select object_id + from acs_objects + where object_type = 'photo_collection'; + coll_val coll_cursor%ROWTYPE; +begin + for coll_val in coll_cursor + loop + acs_object.delete (object_id => coll_val.object_id); + end loop; +end; +/ +show errors; + +begin + acs_object_type.drop_type('photo_collection'); +end; +/ +show errors; + +drop package pa_collection; + +drop table pa_collection_photo_map; +drop table pa_collections; Index: openacs-4/packages/photo-album/sql/oracle/photo-album-clip.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/oracle/photo-album-clip.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/sql/oracle/photo-album-clip.sql 12 Jun 2003 06:55:44 -0000 1.1 @@ -0,0 +1,159 @@ +-- /packages/photo-album/sql/postgresql/photo-album-clip.sql +-- +-- +-- Extremely simple image clipboard to support photo +-- ordering and presentation generation +-- +-- Oracle support added: vinod@kurup.com +-- +-- Copyright (C) 2002 Jeff Davis +-- @author Jeff Davis davis@xarg.net +-- @creation-date 10/30/2002 +-- +-- @cvs-id $Id: photo-album-clip.sql,v 1.1 2003/06/12 06:55:44 vinodk Exp $ +-- +-- This is free software distributed under the terms of the GNU Public +-- License. Full text of the license is available from the GNU Project: +-- http://www.fsf.org/copyleft/gpl.html + +create table pa_collections ( + collection_id integer + constraint pa_collection_id_fk + references acs_objects(object_id) + constraint pa_collections_pk + primary key, + owner_id integer + constraint pa_collections_owner_id_fk + references users(user_id) on delete cascade + constraint pa_collections_owner_id_nn + not null, + title varchar(255) + constraint pa_collections_title_nn + not null +); + +comment on table pa_collections is ' + Table for saving a collection of photos +'; + +create table pa_collection_photo_map ( + collection_id integer + constraint pa_collections_fk + references pa_collections(collection_id) on delete cascade, + photo_id integer + constraint pa_photos_fk + references cr_items(item_id) on delete cascade, + constraint pa_collection_photo_map_pk + primary key (collection_id, photo_id) +); + +comment on table pa_collections is ' + Map a photo into the collection. +'; + + +begin + acs_object_type.create_type( + object_type => 'photo_collection', + pretty_name => 'Photo Collection', + pretty_plural => 'Photo Collections', + supertype => 'acs_object', + table_name => 'pa_collections', + id_column => 'collection_id' + ); +end; +/ +show errors + +create or replace package pa_collection +as + function new ( + p_collection_id in pa_collections.collection_id%TYPE default null, + p_owner_id in pa_collections.owner_id%TYPE default null, + p_title in pa_collections.title%TYPE, + p_creation_date in acs_objects.creation_date%TYPE default sysdate, + p_creation_user in acs_objects.creation_user%TYPE default null, + p_creation_ip in acs_objects.creation_ip%TYPE default null, + p_context_id in acs_objects.context_id%TYPE default null + ) return pa_collections.collection_id%TYPE; + + procedure delete ( + p_collection_id in pa_collections.collection_id%TYPE + ); + + function title ( + p_collection_id in pa_collections.collection_id%TYPE + ) return pa_collections.title%TYPE; + +end pa_collection; +/ +show errors + +create or replace package body pa_collection +as + function new ( + p_collection_id in pa_collections.collection_id%TYPE default null, + p_owner_id in pa_collections.owner_id%TYPE default null, + p_title in pa_collections.title%TYPE, + p_creation_date in acs_objects.creation_date%TYPE default sysdate, + p_creation_user in acs_objects.creation_user%TYPE default null, + p_creation_ip in acs_objects.creation_ip%TYPE default null, + p_context_id in acs_objects.context_id%TYPE default null + ) return pa_collections.collection_id%TYPE + is + v_collection_id pa_collections.collection_id%TYPE; + begin + v_collection_id := acs_object.new ( + object_id => p_collection_id, + object_type => 'photo_collection', + creation_date => p_creation_date, + creation_user => p_creation_user, + creation_ip => p_creation_ip, + context_id => p_context_id + ); + + insert into pa_collections + (collection_id, owner_id, title) + values + (v_collection_id, p_owner_id, p_title); + + acs_permission.grant_permission ( + v_collection_id, + p_owner_id, + 'admin' + ); + + return v_collection_id; + end new; + + + procedure delete ( + p_collection_id in pa_collections.collection_id%TYPE + ) + is + begin + delete from acs_permissions + where object_id = p_collection_id; + + delete from pa_collections + where collection_id = p_collection_id; + + acs_object.delete(p_collection_id); + end delete; + + + function title ( + p_collection_id in pa_collections.collection_id%TYPE + ) return pa_collections.title%TYPE + is + v_title pa_collections.title%TYPE; + begin + select title into v_title + from pa_collections + where collection_id = p_collection_id; + return v_title; + end title; + +end pa_collection; +/ +show errors; Index: openacs-4/packages/photo-album/sql/oracle/photo-album-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/oracle/photo-album-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/sql/oracle/photo-album-create.sql 10 Jun 2003 10:05:46 -0000 1.1 +++ openacs-4/packages/photo-album/sql/oracle/photo-album-create.sql 12 Jun 2003 06:55:44 -0000 1.2 @@ -22,11 +22,17 @@ create table pa_albums ( pa_album_id integer - constraint pa_albums_id_fk - references cr_revisions on delete cascade - constraint pa_alubms_id_pk - primary key, - story varchar2(4000) + constraint pa_albums_id_fk + references cr_revisions on delete cascade + constraint pa_albums_id_pk + primary key, + story varchar2(4000), + photographer varchar2(200), + taken_start date, + taken_end date, + iconic integer + constraint pa_albums_iconic_fk + references cr_items on delete set null ); comment on table pa_albums is ' @@ -41,7 +47,25 @@ varchar2(4000) used for ease of development. '; +comment on column pa_albums.iconic is ' + The photo to use as an icon for this album. If it is null a + default icon is chosen +'; +comment on column pa_albums.photographer is ' + The photographer who took the pictures. +'; + +comment on column pa_albums.taken_start is ' + The date the photos were taken (start of range) +'; + +comment on column pa_albums.taken_end is ' + The date the photos were taken (end of range) +'; + + + declare attr_id acs_attributes.attribute_id%TYPE; begin @@ -63,9 +87,21 @@ pretty_plural => 'Stories', column_spec => 'varchar2(4000)' ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_album', + attribute_name => 'photographer', + datatype => 'text', + pretty_name => 'Photographer', + pretty_plural => 'Photographers', + sort_order => null, + default_value => null, + column_spec => 'varchar2(200)' + ); + end; / -show errors; +show errors create table pa_photos ( @@ -74,9 +110,19 @@ references cr_revisions on delete cascade constraint pa_photo_pk primary key, - caption varchar2(500), - story varchar2(4000), - user_filename varchar2(250) + caption varchar2(500), + story varchar2(4000), + user_filename varchar2(250), + camera_model varchar2(250), + date_taken date, + flash char(1), + focal_length number, + exposure_time number, + aperture varchar2(32), + focus_distance number, + metering varchar2(100), + sha256 varchar2(64), + photographer varchar2(200) ); comment on table pa_photos is ' @@ -104,8 +150,8 @@ content_type => 'pa_photo', attribute_name => 'caption', datatype => 'text', - pretty_name => 'Short caption for display under photo', - pretty_plural => 'Short captions for display under photos', + pretty_name => 'Short photo caption', + pretty_plural => 'Short photo captions', column_spec => 'varchar2(500)' ); @@ -126,9 +172,94 @@ pretty_plural => 'User filenames', column_spec => 'varchar2(250)' ); + +-- +-- JCD Added for exif data 2002-07-01 +-- + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'camera_model', + datatype => 'text', + pretty_name => 'Camera', + pretty_plural => 'Cameras', + column_spec => 'varchar2(500)' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'date_taken', + datatype => 'date', + pretty_name => 'Date taken', + pretty_plural => 'Dates taken', + column_spec => 'date' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'flash', + datatype => 'boolean', + pretty_name => 'Flash used', + pretty_plural => 'Flash used', + column_spec => 'char(1)' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'exposure_time', + datatype => 'number', + pretty_name => 'Exposure time', + pretty_plural => 'Exposure times', + column_spec => 'number' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'aperture', + datatype => 'string', + pretty_name => 'Aperture', + pretty_plural => 'Apertures', + column_spec => 'varchar2(100)' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'focus_distance', + datatype => 'number', + pretty_name => 'Focus distance', + pretty_plural => 'Focus distances', + column_spec => 'number' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'metering', + datatype => 'string', + pretty_name => 'Metering', + pretty_plural => 'Meterings', + column_spec => 'varchar2(100)' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'sha256', + datatype => 'string', + pretty_name => 'SHA256', + pretty_plural => 'SHA256', + column_spec => 'varchar2(100)' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'photographer', + datatype => 'text', + pretty_name => 'Photographer', + pretty_plural => 'Photographers', + column_spec => 'varchar2(200)' + ); + end; / -show errors; +show errors -- wtem@olywa.net, 2001-08-3 -- now that we are going with the new content-repository @@ -150,16 +281,17 @@ ); end; / +show errors create table pa_package_root_folder_map ( package_id constraint pa_pack_fldr_map_pk - primary key + primary key constraint pa_pack_fldr_map_pack_id_fk - references apm_packages, - folder_id constraint pa_pack_fldr_map_fldr_id_fk - references cr_folders - constraint pa_pack_fldr_map_fldr_id_unq - unique + references apm_packages, + folder_id constraint pa_pack_fldr_map_fldr_id_fk + references cr_folders + constraint pa_pack_fldr_map_fldr_id_unq + unique ); create index pa_package_folder_map_by_pack on pa_package_root_folder_map (package_id, folder_id); @@ -185,7 +317,7 @@ select count(*) into v_count from cr_mime_types where mime_type = 'image/jpeg'; if v_count = 0 then - insert into cr_mime_types values ('JPEG image', 'image/jpeg', 'jpeg'); + insert into cr_mime_types values ('JPEG image', 'image/jpeg', 'jpg'); end if; select count(*) into v_count from cr_mime_types where mime_type = 'image/gif'; @@ -207,8 +339,22 @@ end if; end; / -show errors; +show errors +create view all_photo_images as select i.item_id, ccr.relation_tag, im.*, p.* + from cr_items i, + cr_items i2, + pa_photos p, + cr_child_rels ccr, + images im + where i.item_id = ccr.parent_id + and p.pa_photo_id = i.live_revision + and ccr.child_id = i2.item_id + and i2.live_revision = im.image_id; + + @@ plsql-packages.sql @@ permissions.sql + +@@ photo-album-clip.sql Index: openacs-4/packages/photo-album/sql/oracle/photo-album-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/oracle/photo-album-drop.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/sql/oracle/photo-album-drop.sql 10 Jun 2003 10:05:46 -0000 1.1 +++ openacs-4/packages/photo-album/sql/oracle/photo-album-drop.sql 12 Jun 2003 06:55:44 -0000 1.2 @@ -1,4 +1,9 @@ +-- /packages/photo-album/sql/oracle/photo-album-drop.sql +-- @cvs-id $Id$ + +@@ pa-clip-drop.sql + declare cursor priv_cursor is select object_id, grantee_id, privilege @@ -10,12 +15,13 @@ loop acs_permission.revoke_permission ( object_id => priv_val.object_id, - grantee_id => priv_val.grantee_id, - privilege => priv_val.privilege + grantee_id => priv_val.grantee_id, + privilege => priv_val.privilege ); end loop; end; / +show errors declare cursor priv_cursor is @@ -28,12 +34,13 @@ loop acs_permission.revoke_permission ( object_id => priv_val.object_id, - grantee_id => priv_val.grantee_id, - privilege => priv_val.privilege + grantee_id => priv_val.grantee_id, + privilege => priv_val.privilege ); end loop; end; / +show errors declare cursor priv_cursor is @@ -52,6 +59,7 @@ end loop; end; / +show errors begin -- kill stuff in permissions.sql @@ -66,6 +74,7 @@ end; / +show errors begin content_type.unregister_child_type ( @@ -76,30 +85,40 @@ content_type.unregister_child_type ( parent_type => 'pa_photo', - child_type => 'pa_image', + child_type => 'image', relation_tag => 'generic' ); end; / +show errors -- clear out all the reference that cause key violations when droping type -- delete images -declare - cursor image_cursor is - select item_id - from cr_items - where content_type = 'pa_image'; - image_val image_cursor%ROWTYPE; -begin - for image_val in image_cursor - loop - pa_image.delete ( - item_id => image_val.item_id - ); - end loop; -end; -/ +-- now that pa_image is just image +-- the query needs to be adjusted to be specific to photo-album +-- this needs to be standardized with content-repository (clearing out files) +-- there isn't currently a image__delete function +-- so this bit won't work +-- declare +-- cursor image_cursor is +-- select i.item_id +-- from cr_items i, cr_child_rels rels, cr_items i2 +-- where i.content_type = 'image' +-- and i2.content_type = 'pa_photo' +-- and rels.child_id = i.item_id +-- and rels.parent_id = i2.item_id; +-- image_val image_cursor%ROWTYPE; +--begin +-- for image_val in image_cursor +-- loop +-- image.delete ( +-- item_id => image_val.item_id +-- ); +-- end loop; +--end; +--/ +--show errors; -- delete photos declare @@ -117,6 +136,7 @@ end loop; end; / +show errors -- delete albums declare @@ -134,6 +154,7 @@ end loop; end; / +show errors declare cursor folder_cursor is @@ -145,38 +166,32 @@ loop content_folder.unregister_content_type ( folder_id => folder_val.folder_id, - content_type => folder_val.content_type + content_type => folder_val.content_type ); end loop; end; / +show errors drop package photo_album; drop package pa_album; drop package pa_photo; -drop package pa_image; - begin - acs_object_type.drop_type('pa_image'); -end; -/ - -drop table pa_images; - -begin acs_object_type.drop_type('pa_photo'); end; / +show errors drop table pa_photos; begin acs_object_type.drop_type('pa_album'); end; / +show errors; drop table pa_albums; @@ -187,7 +202,7 @@ from cr_items where content_type = 'content_folder' connect by prior item_id = parent_id - start with item_id in (select folder_id from pa_package_root_folder_map) + start with item_id in (select folder_id from pa_package_root_folder_map) order by level desc; folder_val folder_cur%ROWTYPE; begin @@ -201,12 +216,12 @@ end loop; end; / +show errors; drop table pa_package_root_folder_map; -drop table pa_files_to_delete; +--drop table pa_files_to_delete; +drop view all_photo_images; - - Index: openacs-4/packages/photo-album/sql/oracle/plsql-packages.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/oracle/plsql-packages.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/sql/oracle/plsql-packages.sql 10 Jun 2003 10:05:46 -0000 1.1 +++ openacs-4/packages/photo-album/sql/oracle/plsql-packages.sql 12 Jun 2003 06:55:44 -0000 1.2 @@ -40,8 +40,7 @@ mime_type in cr_revisions.mime_type%TYPE default null, nls_language in cr_revisions.nls_language%TYPE default null, caption in pa_photos.caption%TYPE default null, - story in pa_photos.story%TYPE default null, - user_filename in pa_photos.user_filename%TYPE default null + story in pa_photos.story%TYPE default null ) return cr_items.item_id%TYPE; --/** @@ -86,8 +85,7 @@ mime_type in cr_revisions.mime_type%TYPE default null, nls_language in cr_revisions.nls_language%TYPE default null, caption in pa_photos.caption%TYPE default null, - story in pa_photos.story%TYPE default null, - user_filename in pa_photos.user_filename%TYPE default null + story in pa_photos.story%TYPE default null ) return cr_items.item_id%TYPE is v_item_id cr_items.item_id%TYPE; @@ -123,7 +121,7 @@ insert into pa_photos (pa_photo_id, caption, story, user_filename) values - (v_revision_id, caption, story, user_filename); + (v_revision_id, caption, story, title); -- is_live => 't' not used as part of content_item.new -- because content_item.new does not let developer specify revision_id and doesn't return revision_id, @@ -185,7 +183,7 @@ end pa_photo; / -show errors; +show errors create or replace package pa_album @@ -197,21 +195,22 @@ name in cr_items.name%TYPE, album_id in cr_items.item_id%TYPE default null, parent_id in cr_items.parent_id%TYPE default null, - revision_id in cr_revisions.revision_id%TYPE default null, - content_type in acs_object_types.object_type%TYPE default 'pa_album', is_live in char default 'f', - creation_date in acs_objects.creation_date%TYPE default sysdate, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null, - locale in cr_items.locale%TYPE default null, + title in cr_revisions.title%TYPE default null, + description in cr_revisions.description%TYPE default null, + story in pa_albums.story%TYPE default null, + photographer in pa_albums.photographer%TYPE default null, + revision_id in cr_revisions.revision_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + locale in cr_items.locale%TYPE default null, context_id in acs_objects.context_id%TYPE default null, - relation_tag in cr_child_rels.relation_tag%TYPE default null, publish_date in cr_revisions.publish_date%TYPE default sysdate, - mime_type in cr_revisions.mime_type%TYPE default null, nls_language in cr_revisions.nls_language%TYPE default null, - title in cr_revisions.title%TYPE default null, - description in cr_revisions.description%TYPE default null, - story in pa_albums.story%TYPE default null + content_type in acs_object_types.object_type%TYPE default 'pa_album', + relation_tag in cr_child_rels.relation_tag%TYPE default null, + mime_type in cr_revisions.mime_type%TYPE default null ) return cr_items.item_id%TYPE; --/** @@ -232,29 +231,30 @@ end pa_album; / -show errors; +show errors create or replace package body pa_album as function new ( name in cr_items.name%TYPE, album_id in cr_items.item_id%TYPE default null, parent_id in cr_items.parent_id%TYPE default null, - revision_id in cr_revisions.revision_id%TYPE default null, - content_type in acs_object_types.object_type%TYPE default 'pa_album', is_live in char default 'f', - creation_date in acs_objects.creation_date%TYPE default sysdate, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null, - locale in cr_items.locale%TYPE default null, + title in cr_revisions.title%TYPE default null, + description in cr_revisions.description%TYPE default null, + story in pa_albums.story%TYPE default null, + photographer in pa_albums.photographer%TYPE default null, + revision_id in cr_revisions.revision_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + locale in cr_items.locale%TYPE default null, context_id in acs_objects.context_id%TYPE default null, - relation_tag in cr_child_rels.relation_tag%TYPE default null, publish_date in cr_revisions.publish_date%TYPE default sysdate, - mime_type in cr_revisions.mime_type%TYPE default null, nls_language in cr_revisions.nls_language%TYPE default null, - title in cr_revisions.title%TYPE default null, - description in cr_revisions.description%TYPE default null, - story in pa_albums.story%TYPE default null + content_type in acs_object_types.object_type%TYPE default 'pa_album', + relation_tag in cr_child_rels.relation_tag%TYPE default null, + mime_type in cr_revisions.mime_type%TYPE default null ) return cr_items.item_id%TYPE is v_item_id integer; @@ -286,14 +286,10 @@ creation_ip => creation_ip ); - insert into pa_albums (pa_album_id, story) + insert into pa_albums (pa_album_id, story, photographer) values - (v_revision_id, story); + (v_revision_id, story, photographer); - -- is_live => 't' not used as part of content_item.new - -- because content_item.new does not let developer specify revision_id and doesn't return revision_id, - -- revision_id needed for the insert to pa_albums - if is_live = 't' then content_item.set_live_revision ( revision_id => v_revision_id @@ -346,7 +342,7 @@ end pa_album; / -show errors; +show errors --/** -- Package does not contain new or delete procedure because Index: openacs-4/packages/photo-album/sql/oracle/upgrade/upgrade-4.0.1-4.5.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/oracle/upgrade/upgrade-4.0.1-4.5.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/sql/oracle/upgrade/upgrade-4.0.1-4.5.sql 12 Jun 2003 06:55:44 -0000 1.1 @@ -0,0 +1,178 @@ +-- /packages/photo-album/sql/postgresql/upgrade-4.0.1-4.5.sql + +-- upgrade to Jeff's version +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2003-04-30 +-- @cvs-id $Id: upgrade-4.0.1-4.5.sql,v 1.1 2003/06/12 06:55:44 vinodk Exp $ + +update cr_mime_types + set file_extension='jpg' + where mime_type='image/jpg'; + +@@ ../photo-album-clip.sql + +alter table pa_albums add ( + photographer varchar2(200), + taken_start date, + taken_end date, + iconic integer + constraint pa_albums_iconic_fk + references cr_items on delete set null +); + +comment on column pa_albums.iconic is ' + The photo to use as an icon for this album. If it is null a + default icon is chosen +'; + +comment on column pa_albums.photographer is ' + The photographer who took the pictures. +'; + +comment on column pa_albums.taken_start is ' + The date the photos were taken (start of range) +'; + +comment on column pa_albums.taken_start is ' + The date the photos were taken (end of range) +'; + + +declare + attr_id acs_attributes.attribute_id%TYPE; +begin + attr_id := content_type.create_attribute ( + content_type => 'pa_album', + attribute_name => 'photographer', + datatype => 'text', + pretty_name => 'Photographer', + pretty_plural => 'Photographers', + sort_order => null, + default_value => null, + column_spec => 'varchar2(200)' + ); + +end; +/ +show errors + + +alter table pa_photos add ( + camera_model varchar2(250), + date_taken date, + flash char(1), + focal_length number, + exposure_time number, + aperture varchar(32), + focus_distance number, + metering varchar2(100), + sha256 varchar2(64), + photographer varchar2(200) +); + + +-- +-- JCD Added for exif data 2002-07-01 +-- +declare + attr_id acs_attributes.attribute_id%TYPE; +begin + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'camera_model', + datatype => 'text', + pretty_name => 'Camera', + pretty_plural => 'Cameras', + column_spec => 'varchar2(500)' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'date_taken', + datatype => 'date', + pretty_name => 'Date taken', + pretty_plural => 'Dates taken', + column_spec => 'date' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'flash', + datatype => 'boolean', + pretty_name => 'Flash used', + pretty_plural => 'Flash used', + column_spec => 'char(1)' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'exposure_time', + datatype => 'number', + pretty_name => 'Exposure time', + pretty_plural => 'Exposure times', + column_spec => 'number' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'aperture', + datatype => 'string', + pretty_name => 'Aperture', + pretty_plural => 'Apertures', + column_spec => 'varchar2(100)' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'focus_distance', + datatype => 'number', + pretty_name => 'Focus distance', + pretty_plural => 'Focus distances', + column_spec => 'number' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'metering', + datatype => 'string', + pretty_name => 'Metering', + pretty_plural => 'Meterings', + column_spec => 'varchar2(100)' + ); + + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'sha256', + datatype => 'string', + pretty_name => 'SHA256', + pretty_plural => 'SHA256', + column_spec => 'varchar2(100)' + ); + + attr_id := content_type.create_attribute ( + content_type => 'pa_photo', + attribute_name => 'photographer', + datatype => 'text', + pretty_name => 'Photographer', + pretty_plural => 'Photographers', + column_spec => 'varchar2(200)' + ); +end; +/ +show errors + + +create view all_photo_images as select i.item_id, ccr.relation_tag, im.*, p.* + from cr_items i, + cr_items i2, + pa_photos p, + cr_child_rels ccr, + images im + where i.item_id = ccr.parent_id + and p.pa_photo_id = i.live_revision + and ccr.child_id = i2.item_id + and i2.live_revision = im.image_id; + + +@@ ../plsql-packages.sql Index: openacs-4/packages/photo-album/sql/postgresql/pa-clip-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/postgresql/pa-clip-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/sql/postgresql/pa-clip-drop.sql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,35 @@ +-- /packages/photo-album/sql/postgresql/pa-clip-drop.sql + +-- drop the clip stuff +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2003-04-30 +-- @cvs-id $Id: pa-clip-drop.sql,v 1.1 2003/06/12 06:55:45 vinodk Exp $ + + +create function tmp_pa_delete () +returns integer as ' +declare + coll_rec RECORD; +begin + for coll_rec in select object_id + from acs_objects + where object_type = ''photo_collection'' + loop + PERFORM acs_object__delete (coll_rec.object_id); + end loop; + + return 1; +end; ' language 'plpgsql'; + +select tmp_pa_delete (); + +drop function tmp_pa_delete (); + +select acs_object_type__drop_type('photo_collection', 'f'); + +drop function pa_collection__new (integer,integer,varchar,timestamp,integer,varchar,integer); +drop function pa_collection__delete (integer); +drop function pa_collection__title (integer); + +drop table pa_collection_photo_map; +drop table pa_collections; Index: openacs-4/packages/photo-album/sql/postgresql/photo-album-clip.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/postgresql/photo-album-clip.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/sql/postgresql/photo-album-clip.sql 10 Jun 2003 10:06:19 -0000 1.1 +++ openacs-4/packages/photo-album/sql/postgresql/photo-album-clip.sql 12 Jun 2003 06:55:45 -0000 1.2 @@ -64,7 +64,7 @@ ); -create function pa_collection__new (integer,integer,varchar,timestamp,integer,varchar,integer) +create or replace function pa_collection__new (integer,integer,varchar,timestamp,integer,varchar,integer) returns integer as ' declare p_collection_id alias for $1; -- default null @@ -100,7 +100,7 @@ end;' language 'plpgsql'; -create function pa_collection__delete (integer) +create or replace function pa_collection__delete (integer) returns integer as ' declare p_collection_id alias for $1; @@ -119,7 +119,7 @@ end;' language 'plpgsql'; -create function pa_collection__title (integer) +create or replace function pa_collection__title (integer) returns varchar as ' declare p_collection_id alias for $1; Index: openacs-4/packages/photo-album/sql/postgresql/photo-album-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/postgresql/photo-album-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/sql/postgresql/photo-album-create.sql 10 Jun 2003 10:06:19 -0000 1.1 +++ openacs-4/packages/photo-album/sql/postgresql/photo-album-create.sql 12 Jun 2003 06:55:45 -0000 1.2 @@ -386,5 +386,3 @@ \i permissions.sql \i pl-pgsql.sql \i photo-album-clip.sql - - Index: openacs-4/packages/photo-album/sql/postgresql/photo-album-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/postgresql/photo-album-drop.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/photo-album/sql/postgresql/photo-album-drop.sql 11 Jun 2003 13:36:12 -0000 1.2 +++ openacs-4/packages/photo-album/sql/postgresql/photo-album-drop.sql 12 Jun 2003 06:55:45 -0000 1.3 @@ -1,5 +1,9 @@ --- postgresql/photo-album-drop.sql +-- /packages/photo-album/sql/postgresql/photo-album-drop.sql +-- @cvs-id $Id$ + +\i pa-clip-drop.sql + create function tmp_pa_revoke () returns integer as ' declare @@ -11,8 +15,8 @@ loop PERFORM acs_permission__revoke_permission ( priv_rec.object_id, - priv_rec.grantee_id, - priv_rec.privilege + priv_rec.grantee_id, + priv_rec.privilege ); end loop; return 1; @@ -33,8 +37,8 @@ loop PERFORM acs_permission__revoke_permission ( priv_rec.object_id, - priv_rec.grantee_id, - priv_rec.privilege + priv_rec.grantee_id, + priv_rec.privilege ); end loop; return 1; @@ -55,8 +59,8 @@ loop PERFORM acs_permission__revoke_permission ( priv_rec.object_id, - priv_rec.grantee_id, - priv_rec.privilege + priv_rec.grantee_id, + priv_rec.privilege ); end loop; return 1; @@ -166,7 +170,7 @@ loop PERFORM content_folder__unregister_content_type ( folder_rec.folder_id, - folder_rec.content_type, + folder_rec.content_type, ''t'' ); end loop; @@ -185,7 +189,7 @@ -- drop package pa_album; drop function pa_album__delete_revision (integer); drop function pa_album__delete (integer); -drop function pa_album__new (varchar, integer, integer, boolean, integer, varchar, varchar, varchar, text, varchar, integer, timestamp, varchar, integer, timestamp, varchar); +drop function pa_album__new (varchar, integer, integer, boolean, integer, varchar, varchar, varchar, text, varchar, integer, timestamp, varchar, integer, timestamp, varchar) ; -- this needs to drop the pa_photo__ functions -- drop package pa_photo; @@ -204,14 +208,15 @@ declare folder_rec RECORD; begin - for folder_rec in select i1.item_id, tree_level(i1.tree_sortkey) - tree_level(i2.tree_sortkey) as level - from cr_items i1, cr_items i2 - where i1.tree_sortkey between i2.tree_sortkey and tree_right(i2.tree_sortkey) - and i2.item_id in (select folder_id from pa_package_root_folder_map) - order by i2.item_id, level desc + for folder_rec in select i1.item_id, + tree_level(i1.tree_sortkey) - tree_level(i2.tree_sortkey) as level + from cr_items i1, cr_items i2 + where i1.tree_sortkey between i2.tree_sortkey and tree_right(i2.tree_sortkey) + and i2.item_id in (select folder_id from pa_package_root_folder_map) + order by i2.item_id, level desc loop if folder_rec.level = 0 then - -- folder is a root folder, delete it from maping table to avoid fk constraint violation + -- folder is a root folder, delete it from maping table to avoid fk constraint violation delete from pa_package_root_folder_map where folder_id = folder_rec.item_id; end if; PERFORM content_folder__delete (folder_rec.item_id); @@ -222,17 +227,5 @@ select tmp_pa_folder_delete2 (); drop function tmp_pa_folder_delete2 (); - + drop table pa_package_root_folder_map; - --- jarkko: this does NOT delete the table, so we do it --- below -select acs_object_type__drop_type('photo_collection', 'f'); - -drop table pa_collections; -drop table pa_collection_photo_map; -drop view all_photo_images; - -drop function pa_collection__new (integer, integer, varchar, timestamp, integer, varchar, integer); -drop function pa_collection__delete (integer); -drop function pa_collection__title (integer); Index: openacs-4/packages/photo-album/sql/postgresql/photo-album-upgrade.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/postgresql/Attic/photo-album-upgrade.sql,v diff -u -N --- openacs-4/packages/photo-album/sql/postgresql/photo-album-upgrade.sql 10 Jun 2003 10:06:20 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,137 +0,0 @@ --- Add new photo attributes... - -alter table pa_photos add camera_model varchar(250); -alter table pa_photos add date_taken timestamp; -alter table pa_photos add flash boolean; -alter table pa_photos add focal_length numeric; -alter table pa_photos add exposure_time numeric; -alter table pa_photos add focus_distance numeric; -alter table pa_photos add aperture varchar(32); -alter table pa_photos add metering varchar(100); -alter table pa_photos add sha256 varchar(64); - - select content_type__create_attribute ( - 'pa_photo', -- content_type - 'camera_model', -- attribute_name - 'text', -- datatype - 'Camera', -- pretty_name - 'Cameras', -- pretty_plural - null, -- sort_order - null, -- default_value - 'text' -- column_spec - ); - -select content_type__create_attribute ( - 'pa_photo', -- content_type - 'date_taken', -- attribute_name - 'date', -- datatype - 'Date taken', -- pretty_name - 'Dates taken', -- pretty_plural - null, -- sort_order - null, -- default_value - 'timestamp' -- column_spec - ); - -select content_type__create_attribute ( - 'pa_photo', -- content_type - 'flash', -- attribute_name - 'boolean', -- datatype - 'Flash used', -- pretty_name - 'Flash used', -- pretty_plural - null, -- sort_order - null, -- default_value - 'boolean' -- column_spec - ); - -select content_type__create_attribute ( - 'pa_photo', -- content_type - 'exposure_time', -- attribute_name - 'number', -- datatype - 'Exposure time', -- pretty_name - 'Exposure times', -- pretty_plural - null, -- sort_order - null, -- default_value - 'number' -- column_spec - ); - -select content_type__create_attribute ( - 'pa_photo', -- content_type - 'aperture', -- attribute_name - 'string', -- datatype - 'Aperture', -- pretty_name - 'Apertures', -- pretty_plural - null, -- sort_order - null, -- default_value - 'varchar' -- column_spec - ); - -select content_type__create_attribute ( - 'pa_photo', -- content_type - 'focus_distance', -- attribute_name - 'number', -- datatype - 'Focus distance', -- pretty_name - 'Focus distances', -- pretty_plural - null, -- sort_order - null, -- default_value - 'number' -- column_spec - ); - -select content_type__create_attribute ( - 'pa_photo', -- content_type - 'metering', -- attribute_name - 'string', -- datatype - 'Metering', -- pretty_name - 'Meterings', -- pretty_plural - null, -- sort_order - null, -- default_value - 'varchar' -- column_spec - ); - -select content_type__create_attribute ( - 'pa_photo', -- content_type - 'sha256', -- attribute_name - 'string', -- datatype - 'SHA256', -- pretty_name - 'SHA256', -- pretty_plural - null, -- sort_order - null, -- default_value - 'varchar' -- column_spec - ); - --- --- Add new mime types --- -create function inline_0 () returns integer as ' -declare - v_count integer; -begin - select count(*) into v_count from cr_mime_types where mime_type = ''image/jpeg''; - - if v_count = 0 then - insert into cr_mime_types values (''JPEG image'', ''image/jpeg'', ''jpeg''); - end if; - - select count(*) into v_count from cr_mime_types where mime_type = ''image/gif''; - - if v_count = 0 then - insert into cr_mime_types values (''GIF image'', ''image/gif'', ''gif''); - end if; - - select count(*) into v_count from cr_mime_types where mime_type = ''image/png''; - - if v_count = 0 then - insert into cr_mime_types values (''PNG image'', ''image/png'', ''png''); - end if; - - select count(*) into v_count from cr_mime_types where mime_type = ''image/tiff''; - - if v_count = 0 then - insert into cr_mime_types values (''TIFF image'', ''image/tiff'', ''tiff''); - end if; - - return 1; -end; ' language 'plpgsql'; - -select inline_0 (); - -drop function inline_0 (); Index: openacs-4/packages/photo-album/sql/postgresql/upgrade.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/postgresql/Attic/upgrade.sql,v diff -u -N --- openacs-4/packages/photo-album/sql/postgresql/upgrade.sql 10 Jun 2003 10:06:20 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,13 +0,0 @@ -\i photo-album-clip.sql - -create view all_photo_images as select i.item_id, ccr.relation_tag, im.*, p.* - from cr_items i, - cr_items i2, - pa_photos p, - cr_child_rels ccr, - images im - where i.item_id = ccr.parent_id - and p.pa_photo_id = i.live_revision - and ccr.child_id = i2.item_id - and i2.live_revision = im.image_id; - Index: openacs-4/packages/photo-album/sql/postgresql/upgrade/upgrade-4.0.1-4.5.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/sql/postgresql/upgrade/upgrade-4.0.1-4.5.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/sql/postgresql/upgrade/upgrade-4.0.1-4.5.sql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,178 @@ +-- /packages/photo-album/sql/postgresql/upgrade-4.0.1-4.5.sql + +-- upgrade to Jeff's version +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2003-04-30 +-- @cvs-id $Id: upgrade-4.0.1-4.5.sql,v 1.1 2003/06/12 06:55:45 vinodk Exp $ + +update cr_mime_types + set file_extension='jpg' + where mime_type='image/jpg'; + +\i ../photo-album-clip.sql + +alter table pa_albums add photographer varchar(200); +alter table pa_albums add taken_start timestamp; +alter table pa_albums add taken_end timestamp; +alter table pa_albums add iconic integer + constraint pa_albums_iconic_fk + references cr_items on delete set null; + +comment on column pa_albums.iconic is ' + The photo to use as an icon for this album. If it is null a + default icon is chosen +'; + +comment on column pa_albums.photographer is ' + The photographer who took the pictures. +'; + +comment on column pa_albums.taken_start is ' + The date the photos were taken (start of range) +'; + +comment on column pa_albums.taken_start is ' + The date the photos were taken (end of range) +'; + + + select content_type__create_attribute ( + 'pa_album', -- content_type + 'photographer', -- attribute_name + 'text', -- datatype + 'Photographer', -- pretty_name + 'Photographers', -- pretty_plural + null, -- sort_order + null, -- default_value + 'varchar(200)' -- column_spec + ); + + +alter table pa_photos add camera_model varchar(250); +alter table pa_photos add date_taken timestamp; +alter table pa_photos add flash boolean; +alter table pa_photos add focal_length numeric; +alter table pa_photos add exposure_time numeric; +alter table pa_photos add aperture varchar(32); +alter table pa_photos add focus_distance numeric; +alter table pa_photos add metering varchar(100); +alter table pa_photos add sha256 varchar(64); +alter table pa_photos add photographer varchar(200); + + +-- +-- JCD Added for exif data 2002-07-01 +-- + select content_type__create_attribute ( + 'pa_photo', -- content_type + 'camera_model', -- attribute_name + 'text', -- datatype + 'Camera', -- pretty_name + 'Cameras', -- pretty_plural + null, -- sort_order + null, -- default_value + 'text' -- column_spec + ); + +select content_type__create_attribute ( + 'pa_photo', -- content_type + 'date_taken', -- attribute_name + 'date', -- datatype + 'Date taken', -- pretty_name + 'Dates taken', -- pretty_plural + null, -- sort_order + null, -- default_value + 'timestamp' -- column_spec + ); + +select content_type__create_attribute ( + 'pa_photo', -- content_type + 'flash', -- attribute_name + 'boolean', -- datatype + 'Flash used', -- pretty_name + 'Flash used', -- pretty_plural + null, -- sort_order + null, -- default_value + 'boolean' -- column_spec + ); + +select content_type__create_attribute ( + 'pa_photo', -- content_type + 'exposure_time', -- attribute_name + 'number', -- datatype + 'Exposure time', -- pretty_name + 'Exposure times', -- pretty_plural + null, -- sort_order + null, -- default_value + 'numeric' -- column_spec + ); + +select content_type__create_attribute ( + 'pa_photo', -- content_type + 'aperture', -- attribute_name + 'string', -- datatype + 'Aperture', -- pretty_name + 'Apertures', -- pretty_plural + null, -- sort_order + null, -- default_value + 'varchar' -- column_spec + ); + +select content_type__create_attribute ( + 'pa_photo', -- content_type + 'focus_distance', -- attribute_name + 'number', -- datatype + 'Focus distance', -- pretty_name + 'Focus distances', -- pretty_plural + null, -- sort_order + null, -- default_value + 'numeric' -- column_spec + ); + +select content_type__create_attribute ( + 'pa_photo', -- content_type + 'metering', -- attribute_name + 'string', -- datatype + 'Metering', -- pretty_name + 'Meterings', -- pretty_plural + null, -- sort_order + null, -- default_value + 'varchar' -- column_spec + ); + + +select content_type__create_attribute ( + 'pa_photo', -- content_type + 'sha256', -- attribute_name + 'string', -- datatype + 'SHA256', -- pretty_name + 'SHA256', -- pretty_plural + null, -- sort_order + null, -- default_value + 'varchar' -- column_spec + ); + + select content_type__create_attribute ( + 'pa_photo', -- content_type + 'photographer', -- attribute_name + 'text', -- datatype + 'Photographer', -- pretty_name + 'Photographers', -- pretty_plural + null, -- sort_order + null, -- default_value + 'varchar(200)' -- column_spec + ); + +drop view all_photo_images; +create view all_photo_images as select i.item_id, ccr.relation_tag, im.*, p.* + from cr_items i, + cr_items i2, + pa_photos p, + cr_child_rels ccr, + images im + where i.item_id = ccr.parent_id + and p.pa_photo_id = i.live_revision + and ccr.child_id = i2.item_id + and i2.live_revision = im.image_id; + +\i ../pl-pgsql.sql Index: openacs-4/packages/photo-album/tcl/photo-album-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/tcl/photo-album-procs-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/tcl/photo-album-procs-oracle.xql 10 Jun 2003 10:06:42 -0000 1.1 +++ openacs-4/packages/photo-album/tcl/photo-album-procs-oracle.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -110,64 +110,92 @@ - + - - declare - dummy integer; - begin + declare + dummy integer; + begin - dummy := pa_photo.new ( - name => :image_name, - parent_id => :album_id, - item_id => :photo_id, - revision_id => :photo_rev_id, - creation_date => sysdate, - creation_user => :user_id, - creation_ip => :peeraddr, - context_id => :album_id, - title => :client_filename, - description => :description, - is_live => 't', - caption => :caption, - story => :story, - user_filename => :client_filename - ); - end; - - + dummy := pa_photo.new ( + name => :image_name, + parent_id => :album_id, + item_id => :photo_id, + revision_id => :photo_rev_id, + creation_user => :user_id, + creation_ip => :peeraddr, + context_id => :album_id, + title => :client_filename, + description => :description, + is_live => 't', + caption => :caption, + story => :story + ); + end; + + declare - dummy integer; + dummy integer; begin dummy := image.new ( - name => :name, - parent_id => :photo_id, - item_id => :item_id, - revision_id => :rev_id, - creation_date => sysdate, - creation_user => :user_id, - creation_ip => :peeraddr, - context_id => :context_id, - title => :title, - description => :description, - mime_type => :mime_type, - relation_tag => :relation, - is_live => :is_live, - path => :path, - height => :height, - width => :width, - file_size => :size - ); + name => :name, + parent_id => :photo_id, + item_id => :item_id, + revision_id => :rev_id, + mime_type => :mime_type, + creation_user => :user_id, + creation_ip => :peeraddr, + relation_tag => :relation, + title => :title, + description => :description, + is_live => :is_live, + file_size => :size, + filename => :path, + height => :height, + width => :width, + context_id => :context_id + ); end; + + + + UPDATE pa_photos + SET camera_model = :tmp_exif_Cameramodel, + user_filename = :upload_name, + date_taken = to_date(:tmp_exif_DateTime, 'YYYY-MM-DD HH24:MI:SS'), + flash = :tmp_exif_Flashused, + aperture = :tmp_exif_Aperture, + metering = :tmp_exif_MeteringMode, + focal_length = :tmp_exif_Focallength, + exposure_time = :tmp_exif_Exposuretime, + focus_distance = :tmp_exif_FocusDist, + sha256 = :base_sha256 + WHERE pa_photo_id = :photo_rev_id + + + + + + + + select i.image_id, crr.filename, i.width, i.height + from cr_items cri, cr_revisions crr, images i + where cri.parent_id = :id + and crr.revision_id = cri.latest_revision + and i.image_id = cri.latest_revision + order by crr.content_length desc + + + + Index: openacs-4/packages/photo-album/tcl/photo-album-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/tcl/photo-album-procs-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/tcl/photo-album-procs-postgresql.xql 10 Jun 2003 10:06:42 -0000 1.1 +++ openacs-4/packages/photo-album/tcl/photo-album-procs-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -145,4 +145,36 @@ + + + + UPDATE pa_photos + SET camera_model = :tmp_exif_Cameramodel, + user_filename = :upload_name, + date_taken = datetime(:tmp_exif_DateTime), + flash = :tmp_exif_Flashused, + aperture = :tmp_exif_Aperture, + metering = :tmp_exif_MeteringMode, + focal_length = :tmp_exif_Focallength, + exposure_time = :tmp_exif_Exposuretime, + focus_distance = :tmp_exif_FocusDist, + sha256 = :base_sha256 + WHERE pa_photo_id = :photo_rev_id + + + + + + + + select i.image_id, crr.content as filename, i.width, i.height + from cr_items cri, cr_revisions crr, images i + where cri.parent_id = :id + and crr.revision_id = cri.latest_revision + and i.image_id = cri.latest_revision + order by crr.content_length desc + + + + Index: openacs-4/packages/photo-album/tcl/photo-album-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/tcl/photo-album-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/tcl/photo-album-procs.tcl 10 Jun 2003 10:06:42 -0000 1.1 +++ openacs-4/packages/photo-album/tcl/photo-album-procs.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -3,7 +3,7 @@ TCL library for the photo-album system @author Tom Baginski (bags@arsdigita.com) - @author Jeff Davis (davis@xarg.net) + @author Jeff Davis (davis@xorch.net) @creation-date December 14, 2000 @cvs-id $Id$ @@ -335,7 +335,7 @@ Sets height to the variable named in height_var in the calling level. Sets width_var to the variable named in width_var in the calling level. - I Use ImageMagick instead of aolsever funcition because it can handle more than + I Use ImageMagick instead of aolserver function because it can handle more than just gifs and jpegs. } { set identify_string [exec identify $filename] @@ -354,11 +354,7 @@ be used for both width and height. ImageMagick will retain the aspect ratio of the base_image when creating the new_image - - jhead -dt is called to delete any embeded thumbnail since digital camera thumbnails - can be quite large and imagemagick does not remove them when converting (so thumbnails - can end up being 8k for the thumbnail + 32k for the embeded thumbnail). - + @param base_image original image filename @param new_image new image filename @param geometry string as passed to convert @@ -369,8 +365,7 @@ set geometry ${geometry}x${geometry} } ns_log debug "pa_make_new_image: Start convert, making $new_image geometry $geometry" - exec convert -geometry $geometry -interlace None -sharpen 1x2 $base_image $new_image - exec jhead -dt $new_image + exec convert -interlace NONE -geometry $geometry $base_image $new_image ns_log debug "pa_make_new_image: Done convert for $new_image" } @@ -639,7 +634,7 @@ } elseif {[regexp {.zip$} $upload_file]} { set type zip } else { - set type "Uknown type" + set type "Unknown type" } switch $type { @@ -660,7 +655,7 @@ } default { set errp 1 - set errMsg "Unknown file type. Dont know how to extract $upload_file" + set errMsg "don't know how to extract $upload_file" } } @@ -728,7 +723,7 @@ } } - return [list $size $width $height $type $mime $colors $quantum $sha256] + return [list $size $width $height $type $mime $colors $quantum [string trim $sha256]] } @@ -825,12 +820,7 @@ set client_filename $upload_name } - if {[catch {set base_info [pa_file_info $image_file]} errMsg]} { - ns_log Warning "Error parsing file data $image_file Error: $errMsg" - continue - } - - foreach {base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256} $base_info { break } + foreach {base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256} [pa_file_info $image_file] {} # If we don't have a mime type we like we try to make a jpg or png # @@ -861,13 +851,13 @@ } # get info again - foreach {base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256} [pa_file_info $image_file] { break } + foreach {base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256} [pa_file_info $image_file] {} } if {[string equal $base_mime image/jpeg]} { array set exif [pa_get_exif_data ${image_file}] } else { - array unset exif + array set exif {} } set BaseExt [string tolower $base_type] @@ -953,21 +943,8 @@ if {[catch {clock scan $tmp_exif_DateTime}]} { set tmp_exif_DateTime {} } - - db_dml update_photo_data { - UPDATE pa_photos - SET camera_model = :tmp_exif_Cameramodel, - user_filename = :upload_name, - date_taken = datetime(:tmp_exif_DateTime), - flash = :tmp_exif_Flashused, - aperture = :tmp_exif_Aperture, - metering = :tmp_exif_MeteringMode, - focal_length = :tmp_exif_Focallength, - exposure_time = :tmp_exif_Exposuretime, - focus_distance = :tmp_exif_FocusDist, - sha256 = :base_sha256 - WHERE pa_photo_id = :photo_rev_id - } + + db_dml update_photo_data {} } pa_insert_image $base_image_name $photo_id $base_item_id $base_rev_id $user_id $peeraddr $photo_id $base_image_name "original image" $base_mime "base" "t" $base_filename_relative $base_height $base_width $base_bytes @@ -1086,7 +1063,7 @@ @param create_new add a "Create new folder" entry to list @param force_default create the datasource with a default folder even if none exist @param user_id the owner id for the folders - @param the datasource name to use. + @param datasource the datasource name to use. @author Jeff Davis davis@xarg.net @creation-date 2002-10-30 @@ -1108,3 +1085,50 @@ return [template::multirow size $datasource] } +ad_proc pa_rotate {id rotation} { + Rotate a pic + + @param id the photo_id to rotate + @param rotation the number of degrees to rotate + + @author Jeff Davis davis@xarg.net + @creation-date 2002-10-30 + +} { + if {![empty_string_p $rotation] && ![string equal $rotation 0]} { + set flop [list] + set files [list] + + # get a list of files to handle sorted by size... + db_foreach get_image_files {} { + ns_log Notice "pa_rotate $id $rotation [cr_fs_path] $filename $image_id $width $height" + if {[catch {exec convert -rotate $rotation [cr_fs_path]$filename [cr_fs_path]${filename}.new } errMsg]} { + ns_log Notice "Failed rotation of image $image_id -- $errMsg" + } + lappend flop $image_id + lappend files [cr_fs_path]$filename + } + + # rename files in catch. + if { [catch { + foreach fnm $files { + file rename -force $fnm ${fnm}.old + file rename -force ${fnm}.new $fnm + } } errMsg ] } { + # problem with the renaming. Make an attempt to rename them back + catch { + foreach fnm $files { + file rename -force ${fnm}.old $fnm + file delete -force ${fnm}.new + } + } errMsg + } else { + # flop images that need flopping. + if {[string equal $rotation 90] || [string equal $rotation 270]} { + db_dml flop_image_size "update images set width = height, height = width where image_id in ([join $flop ,])" + } + } + } +} + + Index: openacs-4/packages/photo-album/tcl/photo-album-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/tcl/photo-album-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/tcl/photo-album-procs.xql 10 Jun 2003 10:06:42 -0000 1.1 +++ openacs-4/packages/photo-album/tcl/photo-album-procs.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -34,5 +34,5 @@ - + Index: openacs-4/packages/photo-album/www/album-add-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/album-add-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/album-add-oracle.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/album-add-oracle.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -11,13 +11,13 @@ name => :name, album_id => :album_id, parent_id => :parent_id, - is_live => 't', + is_live => 't', creation_user => :user_id, creation_ip => :peeraddr, title => :title, description => :description, - story => :story - photographer => :photographer + story => :story, + photographer => :photographer ); end; Index: openacs-4/packages/photo-album/www/album-move-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/album-move-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/album-move-oracle.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/album-move-oracle.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -3,13 +3,6 @@ oracle8.1.6 - - - select title, description, story from pa_albumsx where object_id = content_item.get_live_revision(:album_id) - - - - select Index: openacs-4/packages/photo-album/www/album-move-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/album-move-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/album-move-postgresql.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/album-move-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -3,13 +3,6 @@ postgresql7.1 - - - select title, description, story from pa_albumsx where object_id = content_item__get_live_revision(:album_id) - - - - select Index: openacs-4/packages/photo-album/www/album-move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/album-move.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/album-move.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/album-move.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -25,7 +25,7 @@ ad_require_permission $album_id write ad_require_permission $old_folder_id write -db_1row get_album_info {select title, description, story from pa_albumsx where object_id = content_item.get_live_revision(:album_id)} +db_1row get_album_info {} # build form Index: openacs-4/packages/photo-album/www/album-move.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/album-move.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/album-move.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/album-move.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -1,6 +1,16 @@ + + + select cr.title,cr.description,pa.story + from pa_albums pa, cr_items ci, cr_revisions cr + where ci.live_revision = cr.revision_id + and ci.live_revision = pa_album_id + and ci.item_id = :album_id + + + select parent_id from cr_items where item_id = :album_id Index: openacs-4/packages/photo-album/www/album-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/album-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/album-oracle.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,28 @@ + + + + oracle8.1.6 + + + + + select cr.title, + cr.description, + pa.story, + ci.parent_id as parent_folder_id, + case when acs_permission.permission_p(ci.item_id, :user_id, 'admin') = 't' then 1 else 0 end as admin_p, + case when acs_permission.permission_p(ci.item_id, :user_id, 'pa_create_photo') = 't' then 1 else 0 end as photo_p, + case when acs_permission.permission_p(ci.item_id, :user_id, 'write') ='t' then 1 else 0 end as write_p, + case when acs_permission.permission_p(ci.parent_id, :user_id, 'write') = 't' then 1 else 0 end as folder_write_p, + case when acs_permission.permission_p(ci.item_id, :user_id, 'delete') = 't' then 1 else 0 end as album_delete_p + from cr_items ci, + cr_revisions cr, + pa_albums pa + where ci.live_revision = cr.revision_id + and ci.live_revision = pa_album_id + and ci.item_id = :album_id + + + + + Index: openacs-4/packages/photo-album/www/album-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/album-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/album-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,28 @@ + + + + postgresql7.1 + + + + + select cr.title, + cr.description, + pa.story, + ci.parent_id as parent_folder_id, + case when acs_permission__permission_p(ci.item_id, :user_id, 'admin') = 't' then 1 else 0 end as admin_p, + case when acs_permission__permission_p(ci.item_id, :user_id, 'pa_create_photo') = 't' then 1 else 0 end as photo_p, + case when acs_permission__permission_p(ci.item_id, :user_id, 'write') ='t' then 1 else 0 end as write_p, + case when acs_permission__permission_p(ci.parent_id, :user_id, 'write') = 't' then 1 else 0 end as folder_write_p, + case when acs_permission__permission_p(ci.item_id, :user_id, 'delete') = 't' then 1 else 0 end as album_delete_p + from cr_items ci, + cr_revisions cr, + pa_albums pa + where ci.live_revision = cr.revision_id + and ci.live_revision = pa_album_id + and ci.item_id = :album_id + + + + + Index: openacs-4/packages/photo-album/www/album.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/album.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/album.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/album.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -22,25 +22,5 @@ - - -select cr.title, - cr.description, - pa.story, - ci.parent_id as parent_folder_id, - case when acs_permission__permission_p(ci.item_id, :user_id, 'admin') = 't' then 1 else 0 end as admin_p, - case when acs_permission__permission_p(ci.item_id, :user_id, 'pa_create_photo') = 't' then 1 else 0 end as photo_p, - case when acs_permission__permission_p(ci.item_id, :user_id, 'write') ='t' then 1 else 0 end as write_p, - case when acs_permission__permission_p(ci.parent_id, :user_id, 'write') = 't' then 1 else 0 end as folder_write_p, - case when acs_permission__permission_p(ci.item_id, :user_id, 'delete') = 't' then 1 else 0 end as album_delete_p -from cr_items ci, - cr_revisions cr, - pa_albums pa -where ci.live_revision = cr.revision_id - and ci.live_revision = pa_album_id - and ci.item_id = :album_id - - - Index: openacs-4/packages/photo-album/www/clipboard-ae-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboard-ae-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/clipboard-ae-oracle.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,23 @@ + + + + oracle8.1.6 + + + + begin + :1 := pa_collection.new( + p_collection_id => :collection_id, + p_owner_id => :user_id, + p_title => :title, + p_creation_date => sysdate, + p_creation_user => :user_id, + p_creation_ip => :peeraddr, + p_context_id => :context + ); + end; + + + + + Index: openacs-4/packages/photo-album/www/clipboard-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboard-ae-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/clipboard-ae-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,15 @@ + + + + postgresql7.1 + + + + +select pa_collection__new(:collection_id, :user_id, :title, now(), :user_id, :peeraddr, :context) + + + + + + Index: openacs-4/packages/photo-album/www/clipboard-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboard-ae.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/clipboard-ae.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/clipboard-ae.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -29,7 +29,7 @@ "You must provide a non-empty name for the clipboard" } } -new_data { - db_0or1row new_collection {select pa_collection__new(:collection_id, :user_id, :title, now(), :user_id, :peeraddr, :context);} + db_exec_plsql new_collection {} } -edit_data { db_dml do_update " update pa_collections Index: openacs-4/packages/photo-album/www/clipboard-attach-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboard-attach-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/clipboard-attach-oracle.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,36 @@ + + + + oracle8.1.6 + + + + + begin + :1 := pa_collection.new ( + p_collection_id => :collection_id, + p_owner_id => :user_id, + p_title => :title, + p_creation_date => sysdate, + p_creation_user => :user_id, + p_creation_ip => :peeraddr, + p_context_id => :context + ); + end; + + + + + + + + insert into pa_collection_photo_map + (collection_id, photo_id) + select :collection_id, :photo_id from dual where + acs_permission.permission_p(:collection_id, :user_id, 'write') = 't' + + + + + + Index: openacs-4/packages/photo-album/www/clipboard-attach-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboard-attach-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/clipboard-attach-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,25 @@ + + + + postgresql7.1 + + + + +select pa_collection__new(:collection_id, :user_id, :title, now(), :user_id, :peeraddr, :context) + + + + + + + + insert into pa_collection_photo_map + (collection_id, photo_id) + select :collection_id, :photo_id where + acs_permission__permission_p(:collection_id, :user_id, 'write') = 't' + + + + + Index: openacs-4/packages/photo-album/www/clipboard-attach.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboard-attach.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/clipboard-attach.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/clipboard-attach.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -29,18 +29,16 @@ set collection_id [db_nextval acs_object_id_seq] - if {[catch {db_1row new_collection {select pa_collection__new(:collection_id, :user_id, :title, now(), :user_id, :peeraddr, :context)}} errMsg]} { - ad_return_error "Clipboard Insert error" "Error putting photo into clipboard
$errMsg
" + if {[catch {db_exec_plsql new_collection {}} errMsg]} { + ad_return_error "Clipboard Insert error" "Error putting photo into clipboard (query name new_collection)
$errMsg
" } } if {$collection_id > 0} { - if {[catch {db_dml map_photo {insert into pa_collection_photo_map (collection_id, photo_id) select :collection_id, :photo_id where - acs_permission__permission_p(:collection_id, :user_id, 'write') = 't'}} errMsg]} { + if {[catch {db_dml map_photo {}} errMsg]} { # Check if it was a pk violation (i.e. already inserted) - # JCD: should check if this works for oracle. Might have case problem. if {![string match "*pa_collection_photo_map_pk*" $errMsg]} { - ad_return_error "Clipboard Insert error" "Error putting photo into clipboard
$errMsg
" + ad_return_error "Clipboard Insert error" "Error putting photo into clipboard (query name map_photo)
$errMsg
" ad_script_abort } } Index: openacs-4/packages/photo-album/www/clipboard-remove-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboard-remove-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/clipboard-remove-oracle.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,17 @@ + + + + oracle8.1.6 + + + + + delete from pa_collection_photo_map + where collection_id = :collection_id + and photo_id = :photo_id + and acs_permission.permission_p(:collection_id, :user_id, 'write') = 't' + + + + + Index: openacs-4/packages/photo-album/www/clipboard-remove-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboard-remove-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/clipboard-remove-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,17 @@ + + + + postgresql7.1 + + + + + delete from pa_collection_photo_map + where collection_id = :collection_id + and photo_id = :photo_id + and acs_permission__permission_p(:collection_id, :user_id, 'write') = 't' + + + + + Index: openacs-4/packages/photo-album/www/clipboard-remove.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboard-remove.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/clipboard-remove.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/clipboard-remove.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -23,7 +23,7 @@ } if {$collection_id > 0} { - if {[catch {db_dml unmap_photo {delete from pa_collection_photo_map where collection_id = :collection_id and photo_id = :photo_id and acs_permission__permission_p(:collection_id, :user_id, 'write') = 't'}} errMsg]} { + if {[catch {db_dml unmap_photo {}} errMsg]} { ad_return_error "Clipboard Remove error" "Error removing photo from clipboard
$errMsg
" ad_script_abort } Index: openacs-4/packages/photo-album/www/clipboards-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboards-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/clipboards-oracle.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,20 @@ + + + + oracle8.1.6 + + + + + SELECT c.collection_id, title, + sum(case when m.photo_id is not null then 1 else 0 end) as photos + FROM pa_collections c, pa_collection_photo_map m + WHERE m.collection_id(+) = c.collection_id + AND c.owner_id = :user_id + GROUP BY c.collection_id, title + ORDER BY title + + + + + Index: openacs-4/packages/photo-album/www/clipboards-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboards-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/clipboards-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,20 @@ + + + + postgresql7.1 + + + + + SELECT c.collection_id, title, + sum(case when m.photo_id is not null then 1 else 0 end) as photos + FROM pa_collections as c left outer join pa_collection_photo_map as m + on (m.collection_id = c.collection_id) + WHERE c.owner_id = :user_id + GROUP BY c.collection_id, title + ORDER BY title + + + + + Index: openacs-4/packages/photo-album/www/clipboards.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/clipboards.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/clipboards.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/clipboards.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -1,11 +1,3 @@ set user_id [ad_conn user_id] -db_multirow clipboards clipboards { - SELECT c.collection_id, title, - sum(case when m.photo_id is not null then 1 else 0 end) as photos - FROM pa_collections as c left outer join pa_collection_photo_map as m - on (m.collection_id = c.collection_id) - WHERE c.owner_id = :user_id - GROUP BY c.collection_id, title - ORDER BY title -} +db_multirow clipboards clipboards {} Index: openacs-4/packages/photo-album/www/folder-move.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/folder-move.adp,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/folder-move.adp 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/folder-move.adp 12 Jun 2003 06:55:45 -0000 1.2 @@ -1,5 +1,5 @@ @title@ @context_list@ -

Move folder to new older: +

Move folder to new folder: \ No newline at end of file Index: openacs-4/packages/photo-album/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/index-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/index-oracle.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/index-oracle.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -28,30 +28,43 @@ - select * from ( - select i.item_id, + select * from + (select i.item_id, r.title as name, r.description, 'Album' as type, - 1 as ordering_key + 1 as ordering_key, + icon.image_id as iconic, + icon.width, + icon.height from cr_items i, - cr_revisions r + cr_revisions r, + pa_albums a, + (select item_id, image_id, height, width + from all_photo_images + where relation_tag = 'thumb') icon where i.content_type = 'pa_album' and i.parent_id = :folder_id and i.live_revision = r.revision_id + and a.pa_album_id = i.live_revision + and icon.item_id(+) = a.iconic UNION ALL select i.item_id, f.label as name, f.description, - 'Folder', + 'Folder' as type, + 0 as ordering_key, + 0 as iconic, + 0, 0 from cr_items i, cr_folders f where i.parent_id = :folder_id and i.item_id = f.folder_id - ) + ) x where acs_permission.permission_p(item_id, :user_id, 'read') = 't' order by ordering_key,name + Index: openacs-4/packages/photo-album/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/index-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/index-postgresql.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/index-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -31,25 +31,33 @@ r.title as name, r.description, 'Album' as type, - 1 as ordering_key + 1 as ordering_key, + ic.image_id as iconic, + ic.width, + ic.height from cr_items i, - cr_revisions r + cr_revisions r, + pa_albums a left outer join all_photo_images ic + on (ic.item_id = a.iconic and ic.relation_tag='thumb') where i.content_type = 'pa_album' and i.parent_id = :folder_id and i.live_revision = r.revision_id + and a.pa_album_id = i.live_revision UNION ALL select i.item_id, f.label as name, f.description, 'Folder', - 0 + 0, + null as iconic,0,0 from cr_items i, cr_folders f where i.parent_id = :folder_id and i.item_id = f.folder_id - ) as albums_and_folders + ) as x where acs_permission__permission_p(item_id, :user_id, 'read') = 't' order by ordering_key,name + Index: openacs-4/packages/photo-album/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/index.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/index.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/index.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -49,38 +49,7 @@ set delete_p [expr !($has_children_p) && !($folder_id == $root_folder_id) && $folder_delete_p && $parent_folder_write_p] if $has_children_p { - db_multirow child get_childrenX " - select * from ( - select i.item_id, - r.title as name, - r.description, - 'Album' as type, - 1 as ordering_key, - ic.image_id as iconic, - ic.width, - ic.height - from cr_items i, - cr_revisions r, - pa_albums a left outer join all_photo_images ic - on (ic.item_id = a.iconic and ic.relation_tag='thumb') - where i.content_type = 'pa_album' - and i.parent_id = :folder_id - and i.live_revision = r.revision_id - and a.pa_album_id = i.live_revision - UNION ALL - select i.item_id, - f.label as name, - f.description, - 'Folder', - 0, - null as iconic,0,0 - from cr_items i, - cr_folders f - where i.parent_id = :folder_id - and i.item_id = f.folder_id - ) as x - where acs_permission__permission_p(item_id, :user_id, 'read') = 't' - order by ordering_key,name" + db_multirow child get_children {} } else { set child:rowcount 0 } Index: openacs-4/packages/photo-album/www/photo-add-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/Attic/photo-add-2-oracle.xql,v diff -u -N --- openacs-4/packages/photo-album/www/photo-add-2-oracle.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,133 +0,0 @@ - - - - oracle8.1.6 - - - - - declare - dummy integer; - begin - - dummy := pa_photo.new ( - name => :image_name, - parent_id => :album_id, - item_id => :photo_id, - revision_id => :photo_rev_id, - creation_date => sysdate, - creation_user => :user_id, - creation_ip => :peeraddr, - context_id => :album_id, - title => :client_filename, - description => :description, - is_live => 't', - caption => :caption, - story => :story, - user_filename => :client_filename - ); - - end; - - - - - - - - - declare - dummy integer; - begin - dummy := image.new ( - name => :base_image_name, - parent_id => :photo_id, - item_id => :base_item_id, - revision_id => :base_rev_id, - creation_date => sysdate, - creation_user => :user_id, - creation_ip => :peeraddr, - context_id => :photo_id, - title => :client_filename, - description => :description, - mime_type => :base_mime_type, - relation_tag => 'base', - is_live => 't', - filename => :base_filename_with_rel_path, - height => :base_height, - width => :base_width, - file_size => :base_n_bytes - ); - - end; - - - - - - - - declare - dummy integer; - begin - - dummy := image.new ( - name => :th_image_name, - parent_id => :photo_id, - item_id => :thumb_item_id, - revision_id => :thumb_rev_id, - creation_date => sysdate, - creation_user => :user_id, - creation_ip => :peeraddr, - context_id => :photo_id, - title => :client_filename, - description => :description, - mime_type => :thumb_mime_type, - relation_tag => 'thumb', - is_live => 't', - filename => :thumb_filename_with_rel_path, - height => :thumb_height, - width => :thumb_width, - file_size => :thumb_n_bytes - ); - - - end; - - - - - - - - declare - dummy integer; - begin - - dummy := image.new ( - name => :vw_image_name, - parent_id => :photo_id, - item_id => :viewer_item_id, - revision_id => :viewer_rev_id, - creation_date => sysdate, - creation_user => :user_id, - creation_ip => :peeraddr, - context_id => :photo_id, - title => :client_filename, - description => :description, - mime_type => :viewer_mime_type, - relation_tag => 'viewer', - is_live => 't', - filename => :viewer_filename_with_rel_path, - height => :viewer_height, - width => :viewer_width, - file_size => :viewer_n_bytes - ); - - end; - - - - - - Index: openacs-4/packages/photo-album/www/photo-add-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/Attic/photo-add-2-postgresql.xql,v diff -u -N --- openacs-4/packages/photo-album/www/photo-add-2-postgresql.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,100 +0,0 @@ - - - - postgresql7.1 - - - - select pa_photo__new ( - :image_name, -- name - :album_id, -- parent_id - :photo_id, -- item_id - :photo_rev_id, -- revision_id - current_timestamp, -- creation_date - :user_id, -- creation_user - :peeraddr, -- creation_ip - null, -- locale - :album_id, -- context_id - :client_filename, -- title - :description, -- description - 't', -- is_live - current_timestamp, -- publish_date - null, -- nls_language - :caption, -- caption - :story -- story - ) - - - - - - select image__new ( - :base_image_name, -- name - :photo_id, -- parent_id - :base_item_id, -- item_id - :base_rev_id, -- revision_id - :base_mime_type, -- mime_type - :user_id, -- creation_user - :peeraddr, -- creation_ip - 'base', -- relation_tag - :base_image_name, -- title - 'original image', -- description - 't', -- is_live - current_timestamp, -- publish_date - :base_filename_with_rel_path, -- path - :base_n_bytes, -- file_size - :base_height, -- height - :base_width -- width - ) - - - - - - - select image__new ( - :th_image_name, -- name - :photo_id, -- parent_id - :thumb_item_id, -- item_id - :thumb_rev_id, -- revision_id - :thumb_mime_type, -- mime_type - :user_id, -- creation_user - :peeraddr, -- creation_ip - 'thumb', -- relation_tag - :th_image_name, -- title - 'thumbnail', -- description - 't', -- is_live - current_timestamp, -- publish_date - :thumb_filename_with_rel_path, -- path - :thumb_n_bytes, -- file_size - :thumb_height, -- height - :thumb_width -- width - ) - - - - - - select image__new ( - :vw_image_name, -- name - :photo_id, -- parent_id - :viewer_item_id, -- item_id - :viewer_rev_id, -- revision_id - :viewer_mime_type, -- mime_type - :user_id, -- creation_user - :peeraddr, -- creation_ip - 'viewer', -- relation_tag - :vw_image_name, -- title - 'web sized image', -- description - 't', -- is_live - current_timestamp, -- publish_date - :viewer_filename_with_rel_path, -- path - :viewer_n_bytes, -- file_size - :viewer_height, -- height - :viewer_width -- width - ) - - - - - Index: openacs-4/packages/photo-album/www/photo-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-add-2.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photo-add-2.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photo-add-2.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -23,7 +23,7 @@ } valid_photo_id -requires {photo_id:integer} { # supplied photo_id must not already exist - if {[db_string check_photo_id "select count(*) from cr_items where item_id = :photo_id"]} { + if {[db_string check_photo_id {}]} { ad_complain "The photo already exists. Check if it is already in the album." } } Index: openacs-4/packages/photo-album/www/photo-add-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-add-2.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photo-add-2.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photo-add-2.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -7,16 +7,4 @@ - - - - - select count(*) - from cr_items - where (item_id = :photo_id or name = :client_filename) - and parent_id = :album_id - - - - Index: openacs-4/packages/photo-album/www/photo-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-edit-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photo-edit-oracle.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photo-edit-oracle.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -32,6 +32,31 @@ + + + UPDATE pa_photos + SET user_filename = prev.user_filename, + camera_model = prev.camera_model, + date_taken = prev.date_taken, + flash = prev.flash, + aperture = prev.aperture, + metering = prev.metering, + focal_length = prev.focal_length, + exposure_time = prev.exposure_time, + focus_distance = prev.focus_distance, + sha256 = prev.sha256, + photographer = prev.photographer + FROM ( + SELECT user_filename,camera_model,date_taken,flash, + aperture,metering,focal_length,exposure_time, + focus_distance,sha256,photographer + FROM pa_photos prev + WHERE prev.pa_photo_id = :previous_revision + ) prev + WHERE pa_photo_id = :revision_id + + + begin Index: openacs-4/packages/photo-album/www/photo-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-edit-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photo-edit-postgresql.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photo-edit-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -29,6 +29,31 @@ + + + UPDATE pa_photos + SET user_filename = prev.user_filename, + camera_model = prev.camera_model, + date_taken = prev.date_taken, + flash = prev.flash, + aperture = prev.aperture, + metering = prev.metering, + focal_length = prev.focal_length, + exposure_time = prev.exposure_time, + focus_distance = prev.focus_distance, + sha256 = prev.sha256, + photographer = prev.photographer + FROM ( + SELECT user_filename,camera_model,date_taken,flash, + aperture,metering,focal_length,exposure_time, + focus_distance,sha256,photographer + FROM pa_photos prev + WHERE prev.pa_photo_id = :previous_revision + ) prev + WHERE pa_photo_id = :revision_id + + + select content_item__set_live_revision (:revision_id) Index: openacs-4/packages/photo-album/www/photo-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-edit.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photo-edit.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photo-edit.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -85,7 +85,7 @@ # not allowing users to modify the binary yet # will need to modify thumb and view binaries when photo binary is changed - db_dml update_photo_user_filename {} +# db_dml update_photo_user_filename {} db_exec_plsql set_live_revision {} @@ -97,7 +97,7 @@ } ad_returnredirect "photo?photo_id=$photo_id" - ad_abort_script + ad_script_abort } ad_return_template Index: openacs-4/packages/photo-album/www/photo-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-edit.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photo-edit.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photo-edit.xql 12 Jun 2003 06:55:45 -0000 1.2 @@ -31,37 +31,21 @@ - insert into pa_photos (pa_photo_id, story, caption) - values - (:revision_id, :new_story, :new_caption) + insert into pa_photos + (pa_photo_id, story, caption, + user_filename,camera_model,date_taken,flash, + aperture,metering,focal_length,exposure_time, + focus_distance,sha256,photographer) + SELECT :revision_id, :new_story, :new_caption, + user_filename,camera_model,date_taken,flash, + aperture,metering,focal_length,exposure_time, + focus_distance,sha256,photographer + FROM pa_photos prev + WHERE prev.pa_photo_id = :previous_revision + - - - UPDATE pa_photos - SET user_filename = prev.user_filename, - camera_model = prev.camera_model, - date_taken = prev.date_taken, - flash = prev.flash, - aperture = prev.aperture, - metering = prev.metering, - focal_length = prev.focal_length, - exposure_time = prev.exposure_time, - focus_distance = prev.focus_distance, - sha256 = prev.sha256, - photographer = prev.photographer - FROM ( - SELECT user_filename,camera_model,date_taken,flash, - aperture,metering,focal_length,exposure_time, - focus_distance,sha256,photographer - FROM pa_photos prev - WHERE prev.pa_photo_id = :previous_revision - ) prev - WHERE pa_photo_id = :revision_id - - - Index: openacs-4/packages/photo-album/www/photo-iconic-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-iconic-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/photo-iconic-oracle.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,16 @@ + + + + oracle8.1.6 + + + + + UPDATE pa_albums + SET iconic = :photo_id + WHERE pa_album_id = content_item.get_live_revision(:album_id) + + + + + Index: openacs-4/packages/photo-album/www/photo-iconic-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-iconic-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/photo-iconic-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.1 + + + + + UPDATE pa_albums + SET iconic = :photo_id + WHERE pa_album_id = content_item__get_live_revision(:album_id) + + + + + Index: openacs-4/packages/photo-album/www/photo-iconic.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-iconic.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photo-iconic.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photo-iconic.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -26,10 +26,6 @@ ad_require_permission $album_id "write" -db_dml photo_iconic { - UPDATE pa_albums - SET iconic = :photo_id - WHERE pa_album_id = content_item__get_live_revision(:album_id) -} +db_dml photo_iconic {} ad_returnredirect "album?album_id=$album_id" Index: openacs-4/packages/photo-album/www/photo-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/photo-oracle.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,40 @@ + + + + oracle8.1.6 + + + + +select + pp.caption, + pp.story, + cr.title, + cr.description, + i.height as height, + i.width as width, + i.image_id as image_id, + ci.parent_id as album_id, + case when acs_permission.permission_p(ci.item_id, :user_id, 'admin') ='t' then 1 else 0 end as admin_p, + case when acs_permission.permission_p(ci.item_id, :user_id, 'write') = 't' then 1 else 0 end as write_p, + case when acs_permission.permission_p(ci.parent_id, :user_id, 'write') = 't' then 1 else 0 end as album_write_p, + case when acs_permission.permission_p(ci.item_id, :user_id, 'delete') = 't' then 1 else 0 end as photo_delete_p +from cr_items ci, + cr_revisions cr, + pa_photos pp, + cr_items ci2, + cr_child_rels ccr2, + images i +where cr.revision_id = pp.pa_photo_id + and ci.live_revision = cr.revision_id + and ci.item_id = ccr2.parent_id + and ccr2.child_id = ci2.item_id + and ccr2.relation_tag = 'viewer' + and ci2.live_revision = i.image_id + and ci.item_id = :photo_id + + + + + + Index: openacs-4/packages/photo-album/www/photo-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/photo-postgresql.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,38 @@ + + + + postgresql7.1 + + + +select + pp.caption, + pp.story, + cr.title, + cr.description, + i.height as height, + i.width as width, + i.image_id as image_id, + ci.parent_id as album_id, + case when acs_permission__permission_p(ci.item_id, :user_id, 'admin') ='t' then 1 else 0 end as admin_p, + case when acs_permission__permission_p(ci.item_id, :user_id, 'write') = 't' then 1 else 0 end as write_p, + case when acs_permission__permission_p(ci.parent_id, :user_id, 'write') = 't' then 1 else 0 end as album_write_p, + case when acs_permission__permission_p(ci.item_id, :user_id, 'delete') = 't' then 1 else 0 end as photo_delete_p +from cr_items ci, + cr_revisions cr, + pa_photos pp, + cr_items ci2, + cr_child_rels ccr2, + images i +where cr.revision_id = pp.pa_photo_id + and ci.live_revision = cr.revision_id + and ci.item_id = ccr2.parent_id + and ccr2.child_id = ci2.item_id + and ccr2.relation_tag = 'viewer' + and ci2.live_revision = i.image_id + and ci.item_id = :photo_id + + + + + Index: openacs-4/packages/photo-album/www/photo.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo.xql,v diff -u -N --- openacs-4/packages/photo-album/www/photo.xql 10 Jun 2003 10:07:11 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,38 +0,0 @@ - - - - - - -select - pp.caption, - pp.story, - cr.title, - cr.description, - i.height as height, - i.width as width, - i.image_id as image_id, - ci.parent_id as album_id, - case when acs_permission__permission_p(ci.item_id, :user_id, 'admin') ='t' then 1 else 0 end as admin_p, - case when acs_permission__permission_p(ci.item_id, :user_id, 'write') = 't' then 1 else 0 end as write_p, - case when acs_permission__permission_p(ci.parent_id, :user_id, 'write') = 't' then 1 else 0 end as album_write_p, - case when acs_permission__permission_p(ci.item_id, :user_id, 'delete') = 't' then 1 else 0 end as photo_delete_p -from cr_items ci, - cr_revisions cr, - pa_photos pp, - cr_items ci2, - cr_child_rels ccr2, - images i -where cr.revision_id = pp.pa_photo_id - and ci.live_revision = cr.revision_id - and ci.item_id = ccr2.parent_id - and ccr2.child_id = ci2.item_id - and ccr2.relation_tag = 'viewer' - and ci2.live_revision = i.image_id - and ci.item_id = :photo_id - - - - - - Index: openacs-4/packages/photo-album/www/photos-add-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/Attic/photos-add-2.adp,v diff -u -N --- openacs-4/packages/photo-album/www/photos-add-2.adp 10 Jun 2003 10:07:11 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1 +0,0 @@ \ No newline at end of file Index: openacs-4/packages/photo-album/www/photos-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photos-add-2.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photos-add-2.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photos-add-2.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -4,7 +4,7 @@ Process and insert photos. - @author Jeff Davis (davis@xarg.net) + @author Jeff Davis (davis@xorch.net) @creation-date 6/28/2002 @cvs_id $Id$ } { @@ -25,42 +25,37 @@ } directory_exists -requires {directory:notnull} { if {![empty_string_p $directory] && ![file isdirectory $directory]} { - ad_complain "The directory file does not exist" + ad_complain "The directory file does not exist" } } directory_tmp -requires {directory:notnull} { - if {![empty_string_p $directory] - && !([ad_conn user_id] == 2599 || [ad_conn user_id] == 2601) - && ( ![string match "/tmp/pa-tmp" $directory ] || [string match ".." $directory]) } { + if {!([ad_conn user_id] == 287 || [ad_conn user_id] == 2601) && ( ![string match "/tmp/pa-tmp" $directory ] || [string match ".." $directory]) } { ad_complain "You can currently only load images from /tmp/pa-tmp for security" } } + one_or_other { + if {[empty_string_p $upload_file] && [empty_string_p $directory]} { + ad_complain "Either upload a file or specify a directory to load" + } + } } + #check permission set user_id [ad_conn user_id] - ad_require_permission $album_id "pa_create_photo" if { ![empty_string_p $upload_file] && [ catch {set tmp_dir [pa_expand_archive $upload_file ${upload_file.tmpfile} pa-$album_id] } errMsg] } { ad_return_complaint 1 "Unable to expand your archive file" ad_script_abort } -ReturnHeaders text/html -ns_write "Upload Log

Upload log


\n" - if {![empty_string_p $upload_file]} { - if {[info exists directory] && ![empty_string_p $directory]} { - ns_write "Uploading file only...please submit your directory based upload seperately
" - } - ns_write "starting to load images from file $upload_file
\n" ns_log Debug "made directory $tmp_dir to extract from ${upload_file.tmpfile} ($upload_file)\n" set allfiles [pa_walk $tmp_dir] set remove 1 } else { - ns_write "starting to load images from directory $directory
\n" set allfiles [pa_walk $directory] set remove 0 } @@ -70,8 +65,7 @@ pa_flush_photo_in_album_cache $album_id set page [pa_page_of_photo_in_album [lindex $new_photo_ids 0] $album_id] -ns_write "View the images" -ns_write "" +ad_returnredirect "album?album_id=$album_id&page=$page" # Now that we are done working on the upload we delete the tmp file if [info exists tmp_dir] { Index: openacs-4/packages/photo-album/www/photos-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photos-add.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photos-add.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photos-add.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -4,7 +4,7 @@ Upload a collection of photos from a tar or zip file. Initial form data - @author Jeff Davis (davis@xarg.net) + @author Jeff Davis (davis@xorch.net) @creation-date 6/28/2002 @cvs_id $Id$ } { Index: openacs-4/packages/photo-album/www/photos-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photos-edit-2.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photos-edit-2.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photos-edit-2.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -50,51 +50,6 @@ ad_returnredirect "album?album_id=$album_id&page=$page&msg=1" -proc pa_rotate {id rotation} { - if {![empty_string_p $rotation] && ![string equal $rotation 0]} { - set flop [list] - set files [list] - - # get a list of files to handle sorted by size... - db_foreach get_image_files { - select i.image_id, crr.content, i.width, i.height - from cr_items cri, cr_revisions crr, images i - where cri.parent_id = :id - and crr.revision_id = cri.latest_revision - and i.image_id = cri.latest_revision - order by crr.content_length desc - } { - ns_log Notice "pa_rotate $id $rotation [cr_fs_path] $content $image_id $width $height" - if {[catch {exec convert -rotate $rotation [cr_fs_path]$content [cr_fs_path]${content}.new } errMsg]} { - ns_log Notice "Failed rotation of image $image_id -- $errMsg" - } - lappend flop $image_id - lappend files [cr_fs_path]$content - } - - # rename files in catch. - if { [catch { - foreach fnm $files { - file rename -force $fnm ${fnm}.old - file rename -force ${fnm}.new $fnm - } } errMsg ] } { - # problem with the renaming. Make an attempt to rename them back - catch { - foreach fnm $files { - file rename -force ${fnm}.old $fnm - file delete -force ${fnm}.new - } - } errMsg - } else { - # flop images that need flopping. - if {[string equal $rotation 90] || [string equal $rotation 270]} { - db_dml flop_image_size "update images set width = height, height = width where image_id in ([join $flop ,])" - } - } - } -} - - foreach id [array names d] { if { $d($id) > 0 } { pa_rotate $id $d($id) Index: openacs-4/packages/photo-album/www/photos-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photos-edit-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/photo-album/www/photos-edit-oracle.xql 12 Jun 2003 06:55:45 -0000 1.1 @@ -0,0 +1,29 @@ + + + + oracle8.1.6 + + + + +select cr.title, + cr.description, + pa.story, + ci.parent_id as parent_folder_id, + case when acs_permission.permission_p(ci.item_id, :user_id, 'admin') = 't' then 1 else 0 end as admin_p, + case when acs_permission.permission_p(ci.item_id, :user_id, 'pa_create_photo') = 't' then 1 else 0 end as photo_p, + case when acs_permission.permission_p(ci.item_id, :user_id, 'write') ='t' then 1 else 0 end as write_p, + case when acs_permission.permission_p(ci.parent_id, :user_id, 'write') = 't' then 1 else 0 end as folder_write_p, + case when acs_permission.permission_p(ci.item_id, :user_id, 'delete') = 't' then 1 else 0 end as album_delete_p +from cr_items ci, + cr_revisions cr, + pa_albums pa +where ci.live_revision = cr.revision_id + and ci.live_revision = pa_album_id + and ci.item_id = :album_id + + + + + + Index: openacs-4/packages/photo-album/www/photos-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photos-edit.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photos-edit.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photos-edit.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -3,7 +3,7 @@ ad_page_contract { Bulk edit photos in a given album - @author Jeff Davis (davis@xarg.net) + @author Jeff Davis (davis@xorch.net) @creation-date 7/1/2002 @cvs-id $Id$ } {