Index: openacs-4/packages/cards-portlet/cards-portlet.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/cards-portlet.info,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/cards-portlet.info	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!-- Generated by the OpenACS Package Manager -->
+
+<package key="cards-portlet" url="http://openacs.org/repository/apm/packages/cards-portlet" type="apm_service">
+    <package-name>Cards Portlet</package-name>
+    <pretty-plural>Cards Portlets</pretty-plural>
+    <initial-install-p>f</initial-install-p>
+    <singleton-p>t</singleton-p>
+    
+    <version name="0.1d" url="http://openacs.org/repository/download/apm/cards-portlet-0.1d.apm">
+        <owner url="http://openacs.org">OpenACS</owner>
+        <release-date>2005-05-10</release-date>
+        <vendor url="http://openacs.org">OpenACS</vendor>
+
+        <provides url="cards-portlet" version="0.1d"/>
+        <requires url="new-portal" version="0.1a"/>
+        <requires url="cards" version="0.1d"/>
+
+    </version>
+</package>
Index: openacs-4/packages/cards-portlet/catalog/cards-portlet.ca_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/catalog/cards-portlet.ca_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/catalog/cards-portlet.ca_ES.ISO-8859-1.xml	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<message_catalog package_key="cards-portlet" package_version="0.1d" locale="ca_ES" charset="ISO-8859-1">
+
+  <msg key="admin_pretty_name">Administraci� de fitxes</msg>
+  <msg key="pretty_name">Fitxes</msg>
+  <msg key="cards">Fitxes d'estudiants</msg>  
+</message_catalog>
Index: openacs-4/packages/cards-portlet/catalog/cards-portlet.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/catalog/cards-portlet.en_US.ISO-8859-1.xml,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/catalog/cards-portlet.en_US.ISO-8859-1.xml	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<message_catalog package_key="cards-portlet" package_version="0.1d" locale="en_US" charset="ISO-8859-1">
+
+  <msg key="admin_pretty_name">Cards administration</msg>
+  <msg key="pretty_name">Cards</msg>
+  <msg key="cards">Student cards</msg>  
+</message_catalog>
Index: openacs-4/packages/cards-portlet/catalog/cards-portlet.es_ES.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/catalog/cards-portlet.es_ES.ISO-8859-1.xml,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/catalog/cards-portlet.es_ES.ISO-8859-1.xml	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<message_catalog package_key="cards-portlet" package_version="0.1d" locale="es_ES" charset="ISO-8859-1">
+
+  <msg key="admin_pretty_name">Administraci�n de fichas</msg>
+  <msg key="pretty_name">Fichas</msg>
+  <msg key="cards">Fichas de estudiantes</msg>  
+</message_catalog>
Index: openacs-4/packages/cards-portlet/sql/postgresql/cards-admin-portlet-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/sql/postgresql/cards-admin-portlet-create.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/sql/postgresql/cards-admin-portlet-create.sql	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,179 @@
+--
+-- Copyright (C) 2004 University of Valencia
+--
+--  This file is part of dotLRN.
+--
+--  dotLRN is free software; you can redistribute it and/or modify it under the
+--  terms of the GNU General Public License as published by the Free Software
+--  Foundation; either version 2 of the License, or (at your option) any later
+--  version.
+--
+--  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+--  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+--  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+--  details.
+--
+--
+--   Procedures to support the cards portlet
+--
+--   @author fransola (fransola@uv.es)
+--   @creation-date 2004-10-10
+--   @version $Id: cards-admin-portlet-create.sql,v 0.1 2004/10/10
+
+create function inline_0()
+returns integer as '
+declare
+  ds_id portal_datasources.datasource_id%TYPE;
+begin
+
+  ds_id  = portal_datasource__new( ''cards_admin_portlet'', ''Cards Admin portlet'');
+
+
+  --  the standard 4 params
+
+  -- shadeable_p 
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''t'',
+        ''shadeable_p'',
+        ''f''
+);      
+
+
+  -- hideable_p 
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''t'',
+        ''hideable_p'',
+        ''f''
+);      
+
+  -- user_editable_p 
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''t'',
+        ''user_editable_p'',
+        ''f''
+);      
+
+  -- shaded_p 
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''t'',
+        ''shaded_p'',
+        ''f''
+);      
+
+  -- link_hideable_p 
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''t'',
+        ''link_hideable_p'',
+        ''t''
+);  
+
+-- cards_admin-specific params
+
+  -- package_id must be configured
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''f'',
+        ''package_id'',
+        ''''
+);
+
+  return 0;
+
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
+
+
+create function inline_1()
+returns integer as '
+begin
+
+        -- create the implementation
+        perform acs_sc_impl__new (
+                ''portal_datasource'',
+                ''cards_admin_portlet'',
+                ''cards_admin_portlet''
+        );
+
+        -- add all the hooks
+        perform acs_sc_impl_alias__new(
+               ''portal_datasource'',
+               ''cards_admin_portlet'',
+               ''GetMyName'',
+               ''cards_admin_portlet::get_my_name'',
+               ''TCL''
+        );
+
+        perform acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_admin_portlet'',
+               ''GetPrettyName'',
+               ''cards_admin_portlet::get_pretty_name'',
+               ''TCL''
+        );
+
+        perform acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_admin_portlet'',
+               ''Link'',
+               ''cards_admin_portlet::link'',
+               ''TCL''
+        );
+
+        perform acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_admin_portlet'',
+               ''AddSelfToPage'',
+               ''cards_admin_portlet::add_self_to_page'',
+               ''TCL''
+        );
+
+        perform acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_admin_portlet'',
+               ''Show'',
+               ''cards_admin_portlet::show'',
+               ''TCL''
+        );
+
+        perform acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_admin_portlet'',
+               ''Edit'',
+               ''cards_admin_portlet::edit'',
+               ''TCL''
+        );
+
+        perform acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_admin_portlet'',
+               ''RemoveSelfFromPage'',
+               ''cards_admin_portlet::remove_self_from_page'',
+               ''TCL''
+        );
+
+        -- Add the binding
+        perform acs_sc_binding__new (
+            ''portal_datasource'',
+            ''cards_admin_portlet''
+        );
+
+        return 0;
+end;' language 'plpgsql';
+
+select inline_1();
+drop function inline_1();
+
+
Index: openacs-4/packages/cards-portlet/sql/postgresql/cards-admin-portlet-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/sql/postgresql/cards-admin-portlet-drop.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/sql/postgresql/cards-admin-portlet-drop.sql	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,104 @@
+--
+-- Copyright (C) 2004 University of Valencia
+--
+--  This file is part of dotLRN.
+--
+--  dotLRN is free software; you can redistribute it and/or modify it under the
+--  terms of the GNU General Public License as published by the Free Software
+--  Foundation; either version 2 of the License, or (at your option) any later
+--  version.
+--
+--  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+--  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+--  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+--  details.
+--
+--
+--   Procedures to support the cards portlet
+--
+--   @author fransola (fransola@uv.es)
+--   @creation-date 2004-10-10
+--   @version $Id: cards-admin-portlet-drop.sql,v 0.1 2004/10/10
+
+create function inline_0 ()
+returns integer as '
+declare  
+  ds_id portal_datasources.datasource_id%TYPE;
+begin
+
+  select datasource_id into ds_id
+    from portal_datasources
+    where name = ''cards_admin_portlet'';
+
+    if not found then
+        raise exception ''No datasource_id found here '',ds_id ;
+        ds_id := null;        
+    end if;
+
+      
+  if ds_id is NOT null then
+    perform portal_datasource__delete(ds_id);
+  end if;
+
+return 0;
+
+end;' language 'plpgsql';
+
+select inline_0 ();
+
+drop function inline_0 ();
+
+-- create the implementation
+select acs_sc_impl__delete (
+                'portal_datasource',
+                'cards_admin_portlet'
+);
+
+-- delete all the hooks
+select acs_sc_impl_alias__delete (
+               'portal_datasource',
+               'cards_admin_portlet',
+               'GetMyName'
+);
+
+select acs_sc_impl_alias__delete (
+               'portal_datasource',
+               'cards_admin_portlet',
+               'GetPrettyName'
+);
+
+select acs_sc_impl_alias__delete (
+               'portal_datasource',
+               'cards_admin_portlet',
+               'Link'
+);
+
+select acs_sc_impl_alias__delete (
+               'portal_datasource',
+               'cards_admin_portlet',
+               'AddSelfToPage'
+);
+
+select acs_sc_impl_alias__delete (
+               'portal_datasource',
+               'cards_admin_portlet',
+               'Show'
+);
+
+select acs_sc_impl_alias__delete (
+               'portal_datasource',
+               'cards_admin_portlet',
+               'Edit'
+);
+
+select acs_sc_impl_alias__delete (
+               'portal_datasource',
+               'cards_admin_portlet',
+               'RemoveSelfFromPage'
+);
+
+-- Add the binding
+select acs_sc_binding__delete (
+                'portal_datasource',
+                'cards_admin_portlet'
+);
Index: openacs-4/packages/cards-portlet/sql/postgresql/cards-portlet-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/sql/postgresql/cards-portlet-create.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/sql/postgresql/cards-portlet-create.sql	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,184 @@
+--
+-- Copyright (C) 2004 University of Valencia
+--
+--  This file is part of dotLRN.
+--
+--  dotLRN is free software; you can redistribute it and/or modify it under the
+--  terms of the GNU General Public License as published by the Free Software
+--  Foundation; either version 2 of the License, or (at your option) any later
+--  version.
+--
+--  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+--  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+--  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+--  details.
+--
+--
+--   Procedures to support the cards portlet
+--
+--   @author fransola (fransola@uv.es)
+--   @creation-date 2004-10-10
+--   @version $Id: cards-portlet-create.sql,v 0.1 2004/10/10
+
+create function inline_0()
+returns integer as '
+declare
+  ds_id portal_datasources.datasource_id%TYPE;
+begin
+
+  ds_id = portal_datasource__new(
+    ''cards_portlet'',                                           -- Name
+    ''Cards portlet''                                            -- description     
+  );
+
+  --  the standard 4 params
+
+  -- shadeable_p 
+  perform portal_datasource__set_def_param (
+        ds_id,                                          -- datasource_id
+        ''t'',                                          -- config_required_p
+        ''t'',                                          -- configured_p 
+        ''shadeable_p'',                        -- key 
+        ''t''                                           -- value
+);      
+
+
+  -- hideable_p 
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''t'',
+        ''hideable_p'',
+        ''t''
+);      
+
+  -- user_editable_p 
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''t'',
+        ''user_editable_p'',
+        ''f''
+);      
+
+  -- shaded_p 
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''t'',
+        ''shaded_p'',
+        ''f''
+);      
+
+  -- link_hideable_p 
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''t'',
+        ''link_hideable_p'',
+        ''t''
+);  
+
+-- cards-specific params
+
+  -- community_id must be configured
+  perform portal_datasource__set_def_param (
+        ds_id,
+        ''t'',
+        ''f'',
+        ''package_id'',
+        ''''
+);
+
+  return 0;
+
+end;' language 'plpgsql';
+
+select inline_0();
+
+drop function inline_0();
+
+
+create function inline_1()
+returns integer as '
+begin
+
+        -- create the implementation
+        perform acs_sc_impl__new (
+                ''portal_datasource'',
+                ''cards_portlet'',
+                ''cards_portlet''
+        );
+
+        -- add all the hooks
+        perform  acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''GetMyName'',
+               ''cards_portlet::get_my_name'',
+               ''TCL''
+        );
+
+        perform  acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''GetPrettyName'',
+               ''cards_portlet::get_pretty_name'',
+               ''TCL''
+        );
+
+        perform  acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''Link'',
+               ''cards_portlet::link'',
+               ''TCL''
+        );
+
+        perform  acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''AddSelfToPage'',
+               ''cards_portlet::add_self_to_page'',
+               ''TCL''
+        );
+
+        perform  acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''Show'',
+               ''cards_portlet::show'',
+               ''TCL''
+        );
+
+        perform  acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''Edit'',
+               ''cards_portlet::edit'',
+               ''TCL''
+        );
+
+        perform  acs_sc_impl_alias__new (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''RemoveSelfFromPage'',
+               ''cards_portlet::remove_self_from_page'',
+               ''TCL''
+        );
+
+        -- Add the binding
+        perform acs_sc_binding__new (
+            ''portal_datasource'',
+            ''cards_portlet''
+        );
+
+        return 0;
+end;' language 'plpgsql';
+
+select inline_1();
+
+drop function inline_1();
+
+
+\i cards-admin-portlet-create.sql
Index: openacs-4/packages/cards-portlet/sql/postgresql/cards-portlet-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/sql/postgresql/cards-portlet-drop.sql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/sql/postgresql/cards-portlet-drop.sql	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,108 @@
+--
+-- Copyright (C) 2004 University of Valencia
+--
+--  This file is part of dotLRN.
+--
+--  dotLRN is free software; you can redistribute it and/or modify it under the
+--  terms of the GNU General Public License as published by the Free Software
+--  Foundation; either version 2 of the License, or (at your option) any later
+--  version.
+--
+--  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+--  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+--  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+--  details.
+--
+--
+--   Procedures to support the cards portlet
+--
+--   @author fransola (fransola@uv.es)
+--   @creation-date 2004-10-10
+--   @version $Id: cards-portlet-drop.sql,v 0.1 2004/10/10
+
+create function inline_1()
+returns integer as '
+declare  
+  ds_id portal_datasources.datasource_id%TYPE;
+begin
+
+  select datasource_id into ds_id
+      from portal_datasources
+     where name = ''cards_portlet'';
+
+   if not found then
+     RAISE EXCEPTION '' No datasource id found '', ds_id;
+     ds_id := null;
+   end if;
+
+  if ds_id is NOT null then
+    perform portal_datasource__delete(ds_id);
+  end if;
+
+        -- drop the hooks
+        perform acs_sc_impl_alias__delete (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''GetMyName''
+        );
+
+        perform acs_sc_impl_alias__delete (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''GetPrettyName''
+        );
+
+
+        perform acs_sc_impl_alias__delete (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''Link''
+        );
+
+        perform acs_sc_impl_alias__delete (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''AddSelfToPage''
+        );
+
+        perform acs_sc_impl_alias__delete (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''Show''
+        );
+
+        perform acs_sc_impl_alias__delete (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''Edit''
+        );
+
+        perform acs_sc_impl_alias__delete (
+               ''portal_datasource'',
+               ''cards_portlet'',
+               ''RemoveSelfFromPage''
+        );
+
+        -- Drop the binding
+        perform acs_sc_binding__delete (
+            ''portal_datasource'',
+            ''cards_portlet''
+        );
+
+        -- drop the impl
+        perform acs_sc_impl__delete (
+                ''portal_datasource'',
+                ''cards_portlet''
+        );
+        
+        return 0;
+end;' language 'plpgsql';
+
+select inline_1();
+drop function inline_1();
+
+\i cards-admin-portlet-drop.sql
+
+
+
+
Index: openacs-4/packages/cards-portlet/tcl/cards-admin-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/tcl/cards-admin-portlet-procs.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/tcl/cards-admin-portlet-procs.tcl	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,90 @@
+#
+#  Copyright (C) 2004 University of Valencia
+#
+#  This file is part of dotLRN.
+#
+#  dotLRN is free software; you can redistribute it and/or modify it under the
+#  terms of the GNU General Public License as published by the Free Software
+#  Foundation; either version 2 of the License, or (at your option) any later
+#  version.
+#
+#  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+#  details.
+#
+
+ad_library {
+
+    Procedures to support the cards admin portlet
+
+    @author fransola (fransola@uv.es)
+    @creation-date 2004-10-10
+    @version $Id: cards-admin-portlet-procs.tcl,v 0.1 2004/10/10
+
+}
+
+namespace eval cards_admin_portlet {
+
+    ad_proc -private get_my_name {
+    } {
+        return "cards_admin_portlet"
+    }
+
+    ad_proc -public get_pretty_name {
+    } {
+        return "#cards-portlet.admin_pretty_name#"
+    }
+
+    ad_proc -private my_package_key {
+    } {
+        return "cards-portlet"
+    }
+
+    ad_proc -public link {
+    } {
+        return ""
+    }
+
+    ad_proc -public add_self_to_page {
+        {-portal_id:required}
+        {-page_name ""}
+        {-package_id:required}
+    } {
+        Adds a cards admin PE to the given portal
+
+        @param portal_id The page to add self to
+        @param package_id The package_id of the cards 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 remove_self_from_page {
+        {-portal_id:required}
+    } {
+          Removes a cards admin PE from the given page
+    } {
+        portal::remove_element \
+            -portal_id $portal_id \
+            -portlet_name [get_my_name]
+    }
+
+    ad_proc -public show {
+         cf
+    } {
+    } {
+        portal::show_proc_helper \
+            -package_key [my_package_key] \
+            -config_list $cf \
+            -template_src "cards-admin-portlet"
+
+    }
+
+}
Index: openacs-4/packages/cards-portlet/tcl/cards-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/tcl/cards-portlet-procs.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/tcl/cards-portlet-procs.tcl	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,98 @@
+#
+#  Copyright (C) 2004 University of Valencia
+#
+#  This file is part of dotLRN.
+#
+#  dotLRN is free software; you can redistribute it and/or modify it under the
+#  terms of the GNU General Public License as published by the Free Software
+#  Foundation; either version 2 of the License, or (at your option) any later
+#  version.
+#
+#  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+#  details.
+#
+
+ad_library {
+
+    Procedures to support the cards portlet
+
+    @author fransola (fransola@uv.es)
+    @creation-date 2004-10-10
+    @version $Id: cards-portlet-procs.tcl,v 0.1 2004/10/10
+
+}
+
+namespace eval cards_portlet {
+
+    ad_proc -private get_my_name {
+    } {
+        return "cards_portlet"
+    }
+
+    ad_proc -private my_package_key {
+    } {
+        return "cards-portlet"
+    }
+
+    ad_proc -public get_pretty_name {
+    } {
+        return "#cards-portlet.pretty_name#"
+    }
+
+    ad_proc -public link {
+    } {
+        return ""
+    }
+
+    ad_proc -public add_self_to_page {
+        {-portal_id:required}
+        {-page_name ""}
+        {-package_id:required}
+        {-extra_params ""}
+        {-force_region ""}
+        {-param_action:required}
+    } {
+        add the portlet element to the given portal
+    } {
+        return [portal::add_element_parameters \
+            -portal_id $portal_id \
+            -page_name $page_name \
+            -pretty_name [get_pretty_name] \
+            -portlet_name [get_my_name] \
+            -key package_id \
+            -value $package_id \
+            -force_region $force_region \
+            -extra_params $extra_params \
+            -param_action $param_action
+            ]
+    }
+
+    ad_proc -public remove_self_from_page {
+        {-portal_id:required}
+        {-package_id:required}
+    } {
+        Removes a cards PE from the given page or the package_id of the
+        cards 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 show {
+         cf
+    } {
+    } {
+        portal::show_proc_helper \
+            -package_key [my_package_key] \
+            -config_list $cf \
+            -template_src "cards-portlet"
+    }
+
+}
Index: openacs-4/packages/cards-portlet/www/cards-admin-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/www/cards-admin-portlet.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/www/cards-admin-portlet.adp	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,22 @@
+<%
+    #
+    #  Copyright (C) 2004 University of Valencia
+    #
+    #  This file is part of dotLRN.
+    #
+    #  dotLRN is free software; you can redistribute it and/or modify it under the
+    #  terms of the GNU General Public License as published by the Free Software
+    #  Foundation; either version 2 of the License, or (at your option) any later
+    #  version.
+    #
+    #  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+    #  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+    #  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+    #  details.
+    #
+%>
+
+<ul>
+  <li><a href="@url@cards">#cards-portlet.cards#</a>
+</ul>
+
Index: openacs-4/packages/cards-portlet/www/cards-admin-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/www/cards-admin-portlet.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/www/cards-admin-portlet.tcl	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,40 @@
+#
+#  Copyright (C) 2004 University of Valencia
+#
+#  This file is part of dotLRN.
+#
+#  dotLRN is free software; you can redistribute it and/or modify it under the
+#  terms of the GNU General Public License as published by the Free Software
+#  Foundation; either version 2 of the License, or (at your option) any later
+#  version.
+#
+#  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+#  details.
+#
+
+ad_page_contract {
+    The display logic for the cards admin portlet
+
+    @author fransola (fransola@uv.es)
+    @creation-date 2004-10-10
+    @version $Id: cards-admin-portlet.tcl,v 0.1 2004/10/10
+
+} -properties {
+}
+
+array set config $cf
+set user_id [ad_conn user_id]
+set list_of_package_ids $config(package_id)
+
+if {[llength $list_of_package_ids] > 1} {
+    # We have a problem!
+    return -code error "There should be only one instance of cards for admin purposes"
+}        
+
+set package_id [lindex $list_of_package_ids 0]        
+
+set url [lindex [site_node::get_url_from_object_id -object_id $package_id] 0]
+
+ad_return_template 
Index: openacs-4/packages/cards-portlet/www/cards-portlet-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/www/cards-portlet-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/www/cards-portlet-postgresql.xql	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+     
+<queryset>
+<rdbms><type>postgresql</type><version>7.1</version></rdbms>
+
+</queryset>
+
Index: openacs-4/packages/cards-portlet/www/cards-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/www/cards-portlet.adp,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/www/cards-portlet.adp	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,24 @@
+<%
+    #
+    #  Copyright (C) 2004 University of Valencia
+    #
+    #  This file is part of dotLRN.
+    #
+    #  dotLRN is free software; you can redistribute it and/or modify it under the
+    #  terms of the GNU General Public License as published by the Free Software
+    #  Foundation; either version 2 of the License, or (at your option) any later
+    #  version.
+    #
+    #  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+    #  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+    #  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+    #  details.
+    #
+%>
+
+<property name="context">@context;noquote@</property>
+<property name="title">#cards.Cards_main_page#</property>
+
+<A HREF="@url_to_cards@">#cards-portlet.cards#</A>
+
+
Index: openacs-4/packages/cards-portlet/www/cards-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cards-portlet/www/cards-portlet.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cards-portlet/www/cards-portlet.tcl	10 Jun 2005 08:46:09 -0000	1.1
@@ -0,0 +1,57 @@
+#
+#  Copyright (C) 2004 University of Valencia
+#
+#  This file is part of dotLRN.
+#
+#  dotLRN is free software; you can redistribute it and/or modify it under the
+#  terms of the GNU General Public License as published by the Free Software
+#  Foundation; either version 2 of the License, or (at your option) any later
+#  version.
+#
+#  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+#  details.
+#
+
+ad_page_contract {
+    The display logic for the cards portlet
+
+    @author fransola (fransola@uv.es)
+    @creation-date 2004-10-10
+    @version $Id: cards-portlet.tcl,v 0.1 2004/10/10
+
+} -properties {
+    context:onevalue
+    user_id:onevalue
+}
+
+array set config $cf
+set list_of_package_ids $config(package_id)
+set user_id [ad_conn user_id]
+set sep_package_ids [join $list_of_package_ids ", "]
+if {[llength $list_of_package_ids] == 1} { set single_p "t"} else {set single_p "f"}
+set context [list]
+set shaded_p $config(shaded_p)
+set cards_url "[ad_conn package_url]/cards/cards"
+set community_id [dotlrn_community::get_community_id]
+
+if {$sep_package_ids == ""} {
+  set sep_package_ids [dotlrn_community::get_package_id $community_id]
+}
+set one_instance_p [ad_decode [llength $list_of_package_ids] 1 1 0]
+
+if {[exists_and_not_null community_id]} {
+    #We are in portal for one class or community
+    set inside_comm_p 1
+    set url_to_cards $cards_url
+} else {
+    #We are in user portal
+    set inside_comm_p 0
+    set url_to_cards ""
+}
+ad_return_template
+
+
+
+