Index: openacs-4/packages/photo-album-portlet/photo-album-portlet.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album-portlet/photo-album-portlet.info,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/photo-album-portlet/photo-album-portlet.info	15 Oct 2003 08:09:19 -0000	1.1
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!-- Generated by the OpenACS Package Manager -->
+
+<package key="photo-album-portlet" url="http://openacs.org/repository/apm/packages/photo-album-portlet" type="apm_service">
+    <package-name>Photo Album Portlet</package-name>
+    <pretty-plural>Photo Album Portlets</pretty-plural>
+    <initial-install-p>f</initial-install-p>
+    <singleton-p>t</singleton-p>
+    
+    <version name="0.1" url="http://openacs.org/repository/download/apm/photo-album-portlet-0.1.apm">
+        <owner url="mailto:davis@xarg.net">Jeff Davis</owner>
+        <vendor url="http://xarg.net">Xarg</vendor>
+        <release-date>2003-05-15</release-date>
+
+        <!-- No dependency information -->
+
+        <callbacks>
+            <callback type="after-install"  proc="photo_album_portlet::after_install"/>
+            <callback type="before-uninstall"  proc="photo_album_portlet::before_uninstall"/>
+        </callbacks>
+        <parameters>
+        <!-- No version parameters -->
+        </parameters>
+
+    </version>
+</package>
Index: openacs-4/packages/photo-album-portlet/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album-portlet/tcl/apm-callback-procs.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/photo-album-portlet/tcl/apm-callback-procs.tcl	15 Oct 2003 08:09:20 -0000	1.1
@@ -0,0 +1,212 @@
+ad_library {
+    Procedures for initializing service contracts etc. for the
+    photo album portlet package. Should only be executed 
+    once upon installation.
+    
+    @creation-date  17 June 2003
+    @author Jeff Davis (davis@xarg.net)
+    @cvs-id $Id: apm-callback-procs.tcl,v 1.1 2003/10/15 08:09:20 lars Exp $
+}
+
+
+namespace eval photo_album_portlet {}
+namespace eval photo_album_admin_portlet {}
+
+ad_proc -private photo_album_portlet::after_install {} {
+    Create the datasources needed by the photo album portlet.
+} {
+    
+    db_transaction {
+	set ds_id [portal::datasource_new \
+                   -name "photo_album_portlet" \
+                   -description "Photo Album Portlet"]
+
+	portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key shadeable_p \
+            -value t
+
+	portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key hideable_p \
+            -value t
+
+        portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key user_editable_p \
+            -value f
+
+        portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key shaded_p \
+            -value f
+
+        portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key link_hideable_p \
+            -value f
+
+        portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p f \
+            -key package_id \
+            -value ""
+
+	register_portal_datasource_impl
+        
+        photo_album_admin_portlet::after_install
+
+    }
+}
+
+
+
+ad_proc -private photo_album_portlet::register_portal_datasource_impl {} {
+    Create the service contracts needed by the photo-album portlet.
+} {
+    set spec {
+        name "photo_album_portlet"
+	contract_name "portal_datasource"
+	owner "photo-album-portlet"
+        aliases {
+	    GetMyName photo_album_portlet::get_my_name
+	    GetPrettyName  photo_album_portlet::get_pretty_name
+	    Link photo_album_portlet::link
+	    AddSelfToPage photo_album_portlet::add_self_to_page
+	    Show photo_album_portlet::show
+	    Edit photo_album_portlet::edit
+	    RemoveSelfFromPage photo_album_portlet::remove_self_from_page
+        }
+    }
+    
+    acs_sc::impl::new_from_spec -spec $spec
+}
+
+
+
+ad_proc -private photo_album_portlet::uninstall {} {
+    Photo Album Portlet package uninstall proc
+} {
+    unregister_implementations
+
+    photo_album_admin_portlet::unregister_implementations
+}
+
+
+
+ad_proc -private photo_album_portlet::unregister_implementations {} {
+    Unregister service contract implementations
+} {
+    acs_sc::impl::delete \
+        -contract_name "portal_datasource" \
+        -impl_name "photo_album_portlet"
+}
+
+
+
+ad_proc -private photo_album_admin_portlet::after_install {} {
+    Create the datasources needed by the photo album portlet.
+} {
+    
+    db_transaction {
+	set ds_id [portal::datasource_new \
+                   -name "photo_album_admin_portlet" \
+                   -description "Photo Album Admin Portlet"]
+
+	portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key shadeable_p \
+            -value f
+
+	portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key hideable_p \
+            -value f
+
+        portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key user_editable_p \
+            -value f
+
+        portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key shaded_p \
+            -value f
+
+        portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p t \
+            -key link_hideable_p \
+            -value t
+
+        portal::datasource_set_def_param \
+            -datasource_id $ds_id \
+            -config_required_p t \
+            -configured_p f \
+            -key package_id \
+            -value ""
+
+	register_portal_datasource_impl
+    }
+}
+
+
+
+ad_proc -private photo_album_admin_portlet::register_portal_datasource_impl {} {
+    Create the service contracts needed by the photo-album admin portlet.
+} {
+    set spec {
+        name "photo_album_admin_portlet"
+	contract_name "portal_datasource"
+	owner "photo-album-portlet"
+        aliases {
+	    GetMyName photo_album_admin_portlet::get_my_name
+	    GetPrettyName  photo_album_admin_portlet::get_pretty_name
+	    Link photo_album_admin_portlet::link
+	    AddSelfToPage photo_album_admin_portlet::add_self_to_page
+	    Show photo_album_admin_portlet::show
+	    Edit photo_album_admin_portlet::edit
+	    RemoveSelfFromPage photo_album_admin_portlet::remove_self_from_page
+        }
+    }
+    
+    acs_sc::impl::new_from_spec -spec $spec
+}
+
+
+
+ad_proc -private photo_album_admin_portlet::before_uninstall {} {
+    Photo Album Portlet package uninstall proc
+} {
+    unregister_implementations
+}
+
+
+
+ad_proc -private photo_album_admin_portlet::unregister_implementations {} {
+    Unregister service contract implementations
+} {
+    acs_sc::impl::delete \
+        -contract_name "portal_datasource" \
+        -impl_name "photo_album_admin_portlet"
+}
Index: openacs-4/packages/photo-album-portlet/tcl/photo-album-admin-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album-portlet/tcl/photo-album-admin-portlet-procs.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/photo-album-portlet/tcl/photo-album-admin-portlet-procs.tcl	15 Oct 2003 08:09:20 -0000	1.1
@@ -0,0 +1,82 @@
+ad_library {
+
+    Procedures to support the photo album admin portlet
+
+    @creation-date  17 June 2003
+    @author Jeff Davis (davis@xarg.net)
+    @cvs-id $Id: photo-album-admin-portlet-procs.tcl,v 1.1 2003/10/15 08:09:20 lars Exp $
+}
+
+namespace eval photo_album_admin_portlet {}
+
+ad_proc -private photo_album_admin_portlet::get_my_name {
+} {
+    return "photo_album_admin_portlet"
+}
+
+
+
+ad_proc -public photo_album_admin_portlet::get_pretty_name {
+} {
+    return "Photo Album Administration"
+}
+
+
+
+ad_proc -private photo_album_admin_portlet::my_package_key {
+} {
+    return "photo-album-portlet"
+}
+
+
+
+ad_proc -public photo_album_admin_portlet::link {
+} {
+    return ""
+}
+
+
+
+ad_proc -public photo_album_admin_portlet::add_self_to_page {
+    {-portal_id:required}
+    {-page_name ""}
+    {-package_id:required}
+} {
+    Adds a photo-album admin PE to the given portal
+    
+    @param portal_id The page to add self to
+    @param package_id The package_id of the photo-album package
+    
+    @return element_id The new element's id
+} {
+    return [portal::add_element_parameters \
+                -portal_id $portal_id \
+                -portlet_name [get_my_name] \
+                -key package_id \
+                -value $package_id
+           ]
+}
+
+
+
+ad_proc -public photo_album_admin_portlet::remove_self_from_page {
+    {-portal_id:required}
+} {
+    Removes a photo-album admin PE from the given page
+} {
+    portal::remove_element \
+        -portal_id $portal_id \
+        -portlet_name [get_my_name]
+}
+
+
+
+ad_proc -public photo_album_admin_portlet::show {
+    cf
+} {
+    portal::show_proc_helper \
+        -package_key [my_package_key] \
+        -config_list $cf \
+        -template_src "photo-album-admin-portlet"
+    
+}
Index: openacs-4/packages/photo-album-portlet/tcl/photo-album-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album-portlet/tcl/photo-album-portlet-procs.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/photo-album-portlet/tcl/photo-album-portlet-procs.tcl	15 Oct 2003 08:09:20 -0000	1.1
@@ -0,0 +1,91 @@
+ad_library {
+    Procedures to support the photo-album portlet
+
+    @creation-date  17 June 2003
+    @author Jeff Davis (davis@xarg.net)
+    @cvs-id $Id: photo-album-portlet-procs.tcl,v 1.1 2003/10/15 08:09:20 lars Exp $
+}
+
+namespace eval photo_album_portlet {}
+
+
+ad_proc -private photo_album_portlet::get_my_name {
+} {
+    return "photo_album_portlet"
+}
+
+
+
+ad_proc -private photo_album_portlet::my_package_key {
+} {
+    return "photo-album-portlet"
+}
+
+
+
+ad_proc -public photo_album_portlet::get_pretty_name {
+} {
+    return "Photo Album"
+}
+
+
+
+ad_proc -public photo_album_portlet::link {
+} {
+    return ""
+}
+
+
+
+ad_proc -public photo_album_portlet::add_self_to_page {
+    {-portal_id:required}
+    {-package_id:required}
+    {-param_action:required}
+} {
+    Adds a photo-album PE to the given portal.
+    
+    @param portal_id The page to add self to
+    @param package_id The community with the folder
+    
+    @return element_id The new element's id
+} {
+    return [portal::add_element_parameters \
+                -portal_id $portal_id \
+                -portlet_name [get_my_name] \
+                -value $package_id \
+                -force_region [parameter::get_from_package_key \
+                                   -parameter "photo_album_portlet_force_region" \
+                                   -package_key [my_package_key]] \
+                -pretty_name [get_pretty_name] \
+                -param_action $param_action
+        ]
+}
+
+
+
+ad_proc -public photo_album_portlet::remove_self_from_page {
+    {-portal_id:required}
+    {-package_id:required}
+} {
+    Removes a photo-album PE from the given page or the package_id of the
+    photo-album package from the portlet if there are others remaining
+    
+    @param portal_id The page to remove self from
+    @param package_id
+} {
+    portal::remove_element_parameters \
+        -portal_id $portal_id \
+        -portlet_name [get_my_name] \
+        -value $package_id
+}
+
+
+
+ad_proc -public photo_album_portlet::show {
+    cf
+} {
+    portal::show_proc_helper \
+        -package_key [my_package_key] \
+        -config_list $cf \
+        -template_src "photo-album-portlet"
+}
Index: openacs-4/packages/photo-album-portlet/www/photo-album-admin-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album-portlet/www/photo-album-admin-portlet.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/photo-album-portlet/www/photo-album-admin-portlet.adp	15 Oct 2003 08:09:20 -0000	1.1
@@ -0,0 +1,6 @@
+<ul>
+<li> <a href="photo-album/">Admin</a>
+</ul>
+
+
+
Index: openacs-4/packages/photo-album-portlet/www/photo-album-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album-portlet/www/photo-album-portlet.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/photo-album-portlet/www/photo-album-portlet.adp	15 Oct 2003 08:09:20 -0000	1.1
@@ -0,0 +1,7 @@
+<if @read_p@ true>
+  <if @num_packages@ eq 1>
+    <include src="/packages/photo-album/www/album-chunk" package_id="@cfa.package_id@">
+
+    <a href="photo-album/">Add photos</a>
+  </if>
+</if>
Index: openacs-4/packages/photo-album-portlet/www/photo-album-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album-portlet/www/photo-album-portlet.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/photo-album-portlet/www/photo-album-portlet.tcl	15 Oct 2003 08:09:20 -0000	1.1
@@ -0,0 +1,12 @@
+array set cfa $cf
+
+set num_packages [llength $cfa(package_id)]
+
+set read_p 0
+foreach package_id $cfa(package_id) {
+    set package_read_p [permission::permission_p -object_id $package_id -privilege read]
+    if { $package_read_p } {
+        set read_p 1
+        break
+    }
+}