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.3 -r1.3.2.1 --- openacs-4/packages/photo-album/tcl/photo-album-procs-oracle.xql 12 Mar 2005 22:13:03 -0000 1.3 +++ openacs-4/packages/photo-album/tcl/photo-album-procs-oracle.xql 31 Jan 2006 03:08:00 -0000 1.3.2.1 @@ -186,17 +186,63 @@ - - - - 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 - - + + + SELECT + ci.item_id as photo_id, + u.user_id, + u.first_names || ' ' || u.last_name as username, + pp.caption, + pp.story, + cr.title, + cr.description, + ci.parent_id as album_id, + to_char(o.creation_date,'YYYY-MM-DD HH24:MI:SS') as created_ansi, + 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, + acs_objects o, + acs_users_all u + WHERE cr.revision_id = pp.pa_photo_id + and ci.live_revision = cr.revision_id + and o.object_id = ci.item_id + and u.user_id = o.creation_user + and ci.item_id = :photo_id + + + + SELECT n.node_id, item_id + FROM cr_items, pa_package_root_folder_map m, site_nodes n + WHERE m.folder_id = item_id + and item_id = nvl((select item_id from cr_revisions where revision_id = :photo_id),:photo_id) + and n.object_id = m.package_id + connect by prior cr_items.parent_id = item_id + and rownum = 1 + + + + + + select cr.title, ci1.item_id as album_id + from cr_revisions cr, (select ci.item_id, ci.live_revision, level as level_num from + cr_items ci + where content_type = 'pa_album' + connect by prior ci.item_id=ci.parent_id + start with ci.item_id = :root_folder_id) ci1 +where ci1.live_revision = cr.revision_id +and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = cr.revision_id + and m.party_id = :user_id + and m.privilege = 'read') + order by level_num, cr.title + + + 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.5 -r1.5.2.1 --- openacs-4/packages/photo-album/tcl/photo-album-procs-postgresql.xql 12 Mar 2005 22:13:03 -0000 1.5 +++ openacs-4/packages/photo-album/tcl/photo-album-procs-postgresql.xql 31 Jan 2006 03:08:00 -0000 1.5.2.1 @@ -146,38 +146,6 @@ - - - - UPDATE pa_photos - SET camera_model = :tmp_exif_Cameramodel, - user_filename = :upload_name, - date_taken = to_timestamp(: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.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 - - - - SELECT @@ -207,4 +175,35 @@ + + + SELECT n.node_id, i1.item_id + FROM cr_items i1, cr_items i2, pa_package_root_folder_map m, site_nodes n + WHERE m.folder_id = i2.item_id + and i1.item_id = coalesce((select item_id from cr_revisions where revision_id = :photo_id),:photo_id) + and n.object_id = m.package_id + and i1.tree_sortkey between i2.tree_sortkey and tree_right(i2.tree_sortkey) + limit 1 + + + + + + select cr.title, ci1.item_id as album_id, ci1.tree_sortkey + from cr_revisions cr, + (select ci.item_id, ci.live_revision, ci.tree_sortkey from + cr_items ci, cr_items ci2 + where ci.content_type = 'pa_album' + and ci.tree_sortkey between ci2.tree_sortkey and tree_right(ci2.tree_sortkey) + and ci2.item_id = :root_folder_id) ci1 +where ci1.live_revision = cr.revision_id +and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = cr.revision_id + and m.party_id = :user_id + and m.privilege = 'read') + order by cr.title + + + 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.14.2.2 -r1.14.2.3 --- openacs-4/packages/photo-album/tcl/photo-album-procs.tcl 19 Jul 2005 21:19:04 -0000 1.14.2.2 +++ openacs-4/packages/photo-album/tcl/photo-album-procs.tcl 31 Jan 2006 03:08:00 -0000 1.14.2.3 @@ -1247,16 +1247,26 @@ does not include the site part just the path. } { - db_0or1row package { - SELECT n.node_id, i1.item_id - FROM cr_items i1, cr_items i2, pa_package_root_folder_map m, site_nodes n - WHERE m.folder_id = i2.item_id - and i1.item_id = coalesce((select item_id from cr_revisions where revision_id = :photo_id),:photo_id) - and n.object_id = m.package_id - and i1.tree_sortkey between i2.tree_sortkey and tree_right(i2.tree_sortkey) - limit 1 - } + db_0or1row package_url {} return [site_node::get_element -node_id $node_id -element url] } +ad_proc -public photo_album::get_package_id_from_url { + -url +} { + Returns package_id of instance from URL +} { + array set site_node [site_node::get_from_url -url $url] + return $site_node(package_id) +} + +ad_proc -public photo_album::list_albums_in_root_folder { + -root_folder_id +} { + Returns a list of albums for a specific instance of photo-album +} { + # only return albums the current user can see + set user_id [ad_conn user_id] + return [db_list_of_lists list_albums {} ] +} 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.4.2.2 -r1.4.2.3 --- openacs-4/packages/photo-album/tcl/photo-album-procs.xql 19 Jul 2005 21:19:04 -0000 1.4.2.2 +++ openacs-4/packages/photo-album/tcl/photo-album-procs.xql 31 Jan 2006 03:08:00 -0000 1.4.2.3 @@ -46,8 +46,40 @@ and image_items.item_id = ccr.child_id and image_items.live_revision = i.image_id and image_revs.revision_id = image_items.live_revision - and photo.item_id = :photo_id; + and photo.item_id = :photo_id + + + + UPDATE pa_photos + SET camera_model = :tmp_exif_Cameramodel, + user_filename = :upload_name, + date_taken = to_timestamp(: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.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 + + + +