Index: openacs-4/packages/dotfolio/dotfolio.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/dotfolio.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/dotfolio.info 5 May 2005 08:51:30 -0000 1.1 @@ -0,0 +1,38 @@ + + + + + dotFOLIO + dotFOLIOs + f + f + dotfolio + + + Nick Carroll + dotFOLIO is an ePortfolio application. + WEG + dotFOLIO is used to administer ePortfolio spaces mounted as subsites. + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/dotfolio/catalog/dotfolio.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/catalog/dotfolio.en_US.ISO-8859-1.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/catalog/dotfolio.en_US.ISO-8859-1.xml 5 May 2005 08:51:30 -0000 1.1 @@ -0,0 +1,105 @@ + + + + Revoke site-wide administrative privileges. + Grant site-wide administrative privileges. + Username + Nuke + Enter a valid username. The username will be used to create the dotfolio space. + Successfully created a dotfolio space for %username% + Error creating a dotfolio space for %username% + Create a new dotFOLIO + Select User Type + Please select a user type for + dotFOLIO Admin + Create a folio space + Add A New User + Add A User + Add User + Admin + Username must not be null. + Username does not exist. + ID + Name + Edit + dotFOLIO properties for this user. + Email + Screen name + Registration date + Last Visit + User has not visited yet + Portrait + Member state + dotFOLIO Information + None set up + Message + Users + User ID + General Information + Administrative Actions + Update this user's password + Become this user + Update Password + Confirm + New Password + You need to confirm the password that you typed. (Type the same password again.) + Your passwords don't match! Presumably, you made a typing error while entering one of them. + Your password on %system_name% + Please follow the following link to reset your password: + +%change_password_url% + + Error sending email to %email% from password-update-2.tcl + Error sending email + There was an error sending email to %email%. + Update + Create A New User + Search Users + Bulk Upload + No Users + Adviser + Guest + Owner + User + Site-Wide Admin + User Type + Staff + .FOLIO Administration + Yes + No + Create + Edit User + You've chosen to add + You've chosen to edit + has been added to + Edit the message below and hit "Send Email" to notify this user. + Send Email + The following email was just sent from %system_name% + The following email was just sent from %system_name% + +Sent by: %email_from% +Sent to: %email% +Subject: %subject% +Message: %message% + + %first_names% %last_name%, + +You have been added as a user to %system_name% +at %system_url% + +Login information: +Email %email% +Password: %password% + +(you may change your password after you log in) + +Thank you +%administration_name% + + Your %system_name% membership has been approved. + Your %system_name% membership has been approved. Please return to %system_url% to log into %system_name%. + dotFOLIO Space + {Welcome to %first_names% %last_name%'s portfolio!} text/enhanced + No. of Blog Entries + + Index: openacs-4/packages/dotfolio/lib/install.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/lib/install.xml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/lib/install.xml 5 May 2005 08:51:30 -0000 1.1 @@ -0,0 +1,23 @@ + + + + + + + + > + + + " + + + + + + + + + + + + Index: openacs-4/packages/dotfolio/sql/postgresql/admin-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/admin-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/admin-profile-provider-create.sql 5 May 2005 08:51:30 -0000 1.1 @@ -0,0 +1,77 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- Implementation of the profile provider interface for dotFOLIO Admins. +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: admin-profile-provider-create.sql,v 1.1 2005/05/05 08:51:30 ncarroll Exp $ +-- + + +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotfolio_admin_profile_provider'', + ''dotfolio_admin_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_admin_profile_provider'', + ''name'', + ''dotfolio_admin_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_admin_profile_provider'', + ''prettyName'', + ''dotfolio_admin_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_admin_profile_provider'', + ''render'', + ''dotfolio_admin_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotfolio_admin_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/admin-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/admin-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/admin-profile-provider-drop.sql 5 May 2005 08:51:30 -0000 1.1 @@ -0,0 +1,72 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop implementation of the profile provider interface for dotFOLIO Admins. +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: admin-profile-provider-drop.sql,v 1.1 2005/05/05 08:51:30 ncarroll Exp $ +-- + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotfolio_admin_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_admin_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_admin_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_admin_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotfolio_admin_profile_provider'' + ); + + return 0; +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/admins-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/admins-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/admins-create.sql 5 May 2005 08:51:30 -0000 1.1 @@ -0,0 +1,35 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: admins-create.sql,v 1.1 2005/05/05 08:51:30 ncarroll Exp $ +-- + + +create table dotfolio_admin_profile_rels ( + rel_id integer + constraint dotfolio_adm_prfl_rels_rel_id_fk + references dotfolio_user_profile_rels (rel_id) + constraint dotfolio_admin_prfl_rels_pk + primary key +); + +\i admin-profile-provider-create.sql +\i admins-init.sql +\i admins-package-create.sql Index: openacs-4/packages/dotfolio/sql/postgresql/admins-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/admins-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/admins-drop.sql 5 May 2005 08:51:30 -0000 1.1 @@ -0,0 +1,28 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Admins package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: admins-drop.sql,v 1.1 2005/05/05 08:51:30 ncarroll Exp $ +-- + + +\i admins-package-drop.sql +\i admin-profile-provider-drop.sql + +drop table dotfolio_admin_profile_rels; Index: openacs-4/packages/dotfolio/sql/postgresql/admins-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/admins-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/admins-init.sql 5 May 2005 08:51:30 -0000 1.1 @@ -0,0 +1,91 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- Initialize the dotFOLIO Admins package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: admins-init.sql,v 1.1 2005/05/05 08:51:30 ncarroll Exp $ +-- + + +create function inline_1() +returns integer as ' +declare + foo integer; + gid integer; + sid integer; + dotfolio_users_group_id integer; +begin + + PERFORM acs_rel_type__create_type( + ''dotfolio_admin_profile_rel'', + ''dotFOLIO Profile Admin'', + ''dotFOLIO Profile Admins'', + ''dotfolio_user_profile_rel'', + ''dotfolio_admin_profile_rels'', + ''rel_id'', + ''dotfolio_admin_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotfolio_admin_profile_provider''; + + gid := profiled_group__new( + foo, + ''dotFOLIO Admins'' + ); + + sid := rel_segment__new( + ''dotFOLIO Admins'', + gid, + ''dotfolio_admin_profile_rel'' + ); + + insert + into dotfolio_user_types + (type, pretty_name, rel_type, group_id, segment_id) + values + (''admin'', ''#dotfolio.staff_role_pretty_name#'', ''dotfolio_admin_profile_rel'', gid, sid); + + select group_id + into dotfolio_users_group_id + from groups + where group_name = ''dotFOLIO Users''; + + foo := composition_rel__new( + dotfolio_users_group_id, + gid + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotfolio/sql/postgresql/admins-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/admins-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/admins-package-create.sql 5 May 2005 08:51:30 -0000 1.1 @@ -0,0 +1,86 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Create the Admin package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: admins-package-create.sql,v 1.1 2005/05/05 08:51:30 ncarroll Exp $ +-- + + +select define_function_args ('dotfolio_admin_profile_rel__new','rel_id,user_id,id,rel_type;dotfolio_admin_profile_rel,group_id,creation_user,creation_ip'); + +create function dotfolio_admin_profile_rel__new(integer,integer,varchar,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_user_id alias for $2; + p_id alias for $3; + p_rel_type alias for $4; + p_group_id alias for $5; + p_creation_user alias for $6; + p_creation_ip alias for $7; + v_rel_id dotfolio_user_profile_rels.rel_id%TYPE; + v_group_id groups.group_id%TYPE; +BEGIN + if p_group_id is null then + select min(group_id) + into v_group_id + from profiled_groups + where profile_provider = (select min(impl_id) + from acs_sc_impls + where impl_name = ''dotfolio_admin_profile_provider''); + else + v_group_id := p_group_id; + end if; + + v_rel_id := dotfolio_user_profile_rel__new( + v_rel_id, + p_user_id, + p_id, + p_rel_type, + v_group_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotfolio_admin_profile_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +select define_function_args ('dotfolio_admin_profile_rel__delete','rel_id'); + +create function dotfolio_admin_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotfolio_admin_profile_rels + where rel_id = p_rel_id; + + PERFORM dotfolio_user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; Index: openacs-4/packages/dotfolio/sql/postgresql/admins-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/admins-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/admins-package-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,25 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Admins package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: admins-package-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +select drop_package('dotfolio_admin_profile_rel'); Index: openacs-4/packages/dotfolio/sql/postgresql/adviser-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/adviser-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/adviser-profile-provider-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,75 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Implementation of the profile provider interface for dotFOLIO Advisers. +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: adviser-profile-provider-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'', + ''dotfolio_adviser_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'', + ''name'', + ''dotfolio_adviser_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'', + ''prettyName'', + ''dotfolio_adviser_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'', + ''render'', + ''dotfolio_adviser_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/adviser-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/adviser-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/adviser-profile-provider-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,72 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Advisers package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: adviser-profile-provider-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements. + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotfolio_adviser_profile_provider'' + ); + + return 0; +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/advisers-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/advisers-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/advisers-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,35 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Create the dotFOLIO Advisers package. +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: advisers-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create table dotfolio_adviser_profile_rels ( + rel_id integer + constraint dotfolio_advsr_rels_rel_id_fk + references dotfolio_user_profile_rels (rel_id) + constraint dotfolio_advsr_profile_rels_pk + primary key +); + +\i adviser-profile-provider-create.sql +\i advisers-init.sql +\i advisers-package-create.sql Index: openacs-4/packages/dotfolio/sql/postgresql/advisers-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/advisers-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/advisers-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,28 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Advisers package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: advisers-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +\i advisers-package-drop.sql +\i adviser-profile-provider-drop.sql + +drop table dotfolio_adviser_profile_rels; Index: openacs-4/packages/dotfolio/sql/postgresql/advisers-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/advisers-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/advisers-init.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,90 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Initialise the dotFOLIO Advisers package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: advisers-init.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create function inline_1() +returns integer as ' +declare + foo integer; + gid integer; + sid integer; + dotfolio_users_group_id integer; +begin + + PERFORM acs_rel_type__create_type( + ''dotfolio_adviser_profile_rel'', + ''dotFOLIO Adviser Profile Adviser'', + ''dotFOLIO Adviser Profile Advisers'', + ''dotfolio_user_profile_rel'', + ''dotfolio_adviser_profile_rels'', + ''rel_id'', + ''dotfolio_adviser_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotfolio_adviser_profile_provider''; + + gid := profiled_group__new( + foo, + ''dotFOLIO Advisers'' + ); + + sid := rel_segment__new( + ''dotFOLIO Advisers'', + gid, + ''dotfolio_adviser_profile_rel'' + ); + + insert + into dotfolio_user_types + (type, pretty_name, rel_type, group_id, segment_id) + values + (''adviser'', ''#dotfolio.adviser_role_pretty_name#'', ''dotfolio_adviser_profile_rel'', gid, sid); + + select group_id + into dotfolio_users_group_id + from groups + where group_name = ''dotFOLIO Users''; + + foo := composition_rel__new( + dotfolio_users_group_id, + gid + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotfolio/sql/postgresql/advisers-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/advisers-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/advisers-package-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,86 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Create the Adviser package. +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: advisers-package-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +select define_function_args ('dotfolio_adviser_profile_rel__new','rel_id,user_id,id,rel_type;dotfolio_adviser_profile_rel,group_id,creation_user,creation_ip'); + +create function dotfolio_adviser_profile_rel__new(integer,integer,varchar,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_user_id alias for $2; + p_id alias for $3; + p_rel_type alias for $4; + p_group_id alias for $5; + p_creation_user alias for $6; + p_creation_ip alias for $7; + v_rel_id dotfolio_user_profile_rels.rel_id%TYPE; + v_group_id groups.group_id%TYPE; +BEGIN + if p_group_id is null then + select min(group_id) + into v_group_id + from profiled_groups + where profile_provider = (select min(impl_id) + from acs_sc_impls + where impl_name = ''dotfolio_adviser_profile_provider''); + else + v_group_id := p_group_id; + end if; + + v_rel_id := dotfolio_user_profile_rel__new( + p_rel_id, + p_user_id, + p_id, + p_rel_type, + v_group_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotfolio_adviser_profile_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +select define_function_args ('dotfolio_adviser_profile_rel__delete','rel_id'); + +create function dotfolio_adviser_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotfolio_adviser_profile_rels + where rel_id = p_rel_id; + + PERFORM dotfolio_user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; Index: openacs-4/packages/dotfolio/sql/postgresql/advisers-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/advisers-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/advisers-package-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,25 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Advisers package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: advisers-package-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +select drop_package('dotfolio_adviser_profile_rel'); \ No newline at end of file Index: openacs-4/packages/dotfolio/sql/postgresql/dotfolio-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/dotfolio-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/dotfolio-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,168 @@ +-- +-- packages/dotfolio/sql/dotfolio-create.sql +-- +-- @author Nick Carroll (nick.c@rroll.net) +-- @creation-date 2005-03-21 +-- @cvs-id $Id: dotfolio-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- +-- + +create function inline_0 () +returns integer as ' +begin + PERFORM acs_object_type__create_type ( + ''dotfolio'', -- object_type + ''dotFOLIO'', -- pretty_name + ''dotFOLIOs'', -- pretty_plural + ''acs_object'', -- supertype + ''dotfolios'', -- table_name + ''dotfolio_id'', -- id_column + null, -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + ''dotfolio__name'' -- name_method + ); + + return 0; +end;' language 'plpgsql'; + +select inline_0 (); +drop function inline_0 (); + + +create table dotfolios ( + dotfolio_id integer + constraint dotfolios_dotfolio_id_fk + references acs_objects(object_id) + constraint dotfolios_dotfolio_id_pk + primary key, + owner_id integer + constraint dotfolios_owner_id_fk + references users(user_id) + constraint dotfolios_owner_id_nn + not null + constraint dotfolios_owner_id_un + unique, + node_id integer + constraint dotfolios_node_id_fk + references site_nodes(node_id) + constraint dotfolios_url_nn + not null, + package_id integer + constraint dotfolios_package_id_fk + references apm_packages(package_id) + constraint dotfolios_package_id_nn + not null, + name varchar(128) + constraint dotfolios_name_nn + not null +); + +select define_function_args('dotfolio__new','dotfolio_id,owner_id,node_id,package_id,name,creation_date;now,creation_user,creation_ip,context_id'); + +create function dotfolio__new (integer,integer,integer,integer,varchar,timestamptz,integer,varchar,integer) +returns integer as ' +declare + p_dotfolio_id alias for $1; -- default null + p_owner_id alias for $2; + p_node_id alias for $3; + p_package_id alias for $4; + p_name alias for $5; + p_creation_date alias for $6; -- default now() + p_creation_user alias for $7; -- default null + p_creation_ip alias for $8; -- default null + p_context_id alias for $9; -- default null + v_dotfolio_id dotfolios.dotfolio_id%TYPE; +begin + + v_dotfolio_id := acs_object__new ( + p_dotfolio_id, + ''dotfolio'', + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + insert into dotfolios + (dotfolio_id, owner_id, node_id, package_id, name) + values + (v_dotfolio_id, p_owner_id, p_node_id, p_package_id, p_name); + + PERFORM acs_permission__grant_permission( + v_dotfolio_id, + p_creation_user, + ''admin'' + ); + +-- PERFORM acs_permission__grant_permission( +-- v_dotfolio_id, +-- p_owner_id, +-- ''owner'' +-- ); + + return v_dotfolio_id; + +end;' language 'plpgsql'; + + +select define_function_args('dotfolio__del','dotfolio_id'); + +create function dotfolio__del (integer) +returns integer as ' +declare + p_dotfolio_id alias for $1; +begin + delete from acs_permissions + where object_id = p_dotfolio_id; + + delete from dotfolios + where dotfolio_id = p_dotfolio_id; + + raise NOTICE ''Deleting dotfolio...''; + PERFORM acs_object__delete(p_dotfolio_id); + + return 0; + +end;' language 'plpgsql'; + + +select define_function_args('dotfolio__name','dotfolio_id'); + +create function dotfolio__name (integer) +returns varchar as ' +declare + p_dotfolio_id alias for $1; + v_dotfolio_name dotfolios.name%TYPE; +begin + select name into v_dotfolio_name + from dotfolios + where dotfolio_id = p_dotfolio_id; + + return v_dotfolio_name; +end; +' language 'plpgsql'; + + +select define_function_args('dotfolio__has_p','user_id'); + +create function dotfolio__has_p (integer) returns bool as ' +declare + p_user_id alias for $1; + v_has_p integer; +begin + select count(owner_id) into v_has_p + from dotfolios + where owner_id = p_user_id; + + if v_has_p <> 0 then + return ''t''; + else + return ''f''; + end if; +end; +' language 'plpgsql'; + + +\i users-create.sql +\i dotfolio-identification-create.sql Index: openacs-4/packages/dotfolio/sql/postgresql/dotfolio-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/dotfolio-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/dotfolio-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,25 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: dotfolio-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + +\i users-drop.sql +\i dotfolio-identification-drop.sql Index: openacs-4/packages/dotfolio/sql/postgresql/dotfolio-identification-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/dotfolio-identification-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/dotfolio-identification-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,101 @@ +-- +-- packages/dotfolio/sql/dotfolio-identification-create.sql +-- +-- @author Nick Carroll (nick.c@rroll.net) +-- @creation-date 2005-04-25 +-- @cvs-id $Id: dotfolio-identification-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- +-- + + +create function inline_0 () +returns integer as ' +begin + PERFORM acs_object_type__create_type ( + ''ident-profile'', -- object_type + ''Identification Profile'', -- pretty_name + ''Identification Profiles'', -- pretty_plural + ''acs_object'', -- supertype + ''dotfolio_owner_identification'', -- table_name + ''owner_id'', -- id_column + null, -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + return 0; +end;' language 'plpgsql'; + +select inline_0 (); + +drop function inline_0 (); + + +create table dotfolio_owner_identification ( + ident_id integer + constraint dotfolio_ident_id_pk + primary key, + owner_id integer + constraint dotfolio_ident_owner_id_fk + references dotfolios(owner_id), + pref_name varchar(64), + tele_work varchar(32), + tele_home varchar(32), + mobile varchar(32), + im_msn varchar(64), + im_aim varchar(64), + interests varchar(256), + company varchar(64), + job_desc varchar(256), + goals varchar(256), + edu_level varchar(256), + university varchar(64), + main_skills varchar(256) +); + +select define_function_args('dotfolio_owner_identification__new','owner_id,pref_name,tele_work,tele_home,mobile,im_msn,im_aim,interests,company,job_desc,goals,edu_level,university,main_skills'); + +create function dotfolio_owner_identification__new (integer,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar) +returns integer as ' +declare + p_owner_id alias for $1; + p_pref_name alias for $2; + p_tele_work alias for $3; + p_tele_home alias for $4; + p_mobile alias for $5; + p_im_msn alias for $6; + p_im_aim alias for $7; + p_interests alias for $8; + p_company alias for $9; + p_job_desc alias for $10; + p_goals alias for $11; + p_edu_level alias for $12; + p_university alias for $13; + p_main_skills alias for $14; + v_profile_id integer; +begin + + v_profile_id := acs_object__new ( + null, + ''ident-profile'', + now(), + p_owner_id, + NULL, + NULL + ); + + INSERT INTO dotfolio_owner_identification + (ident_id, owner_id, pref_name, tele_work, tele_home, mobile, im_msn, im_aim, interests, company, job_desc, goals, edu_level, university, main_skills) + VALUES + (v_profile_id, p_owner_id, p_pref_name, p_tele_work, p_tele_home, p_mobile, p_im_msn, p_im_aim, p_interests, p_company, p_job_desc, p_goals, p_edu_level, p_university, p_main_skills); + + PERFORM acs_permission__grant_permission( + v_profile_id, + p_owner_id, + ''admin'' + ); + + return v_profile_id; + +end;' language 'plpgsql'; Index: openacs-4/packages/dotfolio/sql/postgresql/dotfolio-identification-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/dotfolio-identification-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/dotfolio-identification-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,27 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: dotfolio-identification-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +drop table dotfolio_owner_identification; + +drop function dotfolio_owner_identification__new (integer,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar,varchar); Index: openacs-4/packages/dotfolio/sql/postgresql/guest-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/guest-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/guest-profile-provider-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,76 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Implementation of the profile provider interface for dotFOLIO Guests. +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: guest-profile-provider-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotfolio_guest_profile_provider'', + ''dotfolio_guest_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_guest_profile_provider'', + ''name'', + ''dotfolio_guest_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_guest_profile_provider'', + ''prettyName'', + ''dotfolio_guest_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_guest_profile_provider'', + ''render'', + ''dotfolio_guest_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotfolio_guest_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/guest-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/guest-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/guest-profile-provider-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,73 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop implementation of the profile provider interface for dotFOLIO Guests. +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: guest-profile-provider-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements. + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotfolio_guest_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_guest_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_guest_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_guest_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotfolio_guest_profile_provider'' + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/guests-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/guests-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/guests-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,35 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Create the dotFOLIO Guests package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: guests-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create table dotfolio_guest_profile_rels ( + rel_id integer + constraint dotfolio_guest_profile_rels_rel_fk + references dotfolio_user_profile_rels (rel_id) + constraint dotfolio_guest_profile_rels_pk + primary key +); + +\i guest-profile-provider-create.sql +\i guests-init.sql +\i guests-package-create.sql Index: openacs-4/packages/dotfolio/sql/postgresql/guests-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/guests-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/guests-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,28 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Guests package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: guests-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +\i guests-package-drop.sql +\i guest-profile-provider-drop.sql + +drop table dotfolio_guest_profile_rels; Index: openacs-4/packages/dotfolio/sql/postgresql/guests-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/guests-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/guests-init.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,90 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Initialise the dotFOLIO Guests package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: guests-init.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create function inline_1() +returns integer as ' +declare + foo integer; + gid integer; + sid integer; + dotfolio_users_group_id integer; +begin + + PERFORM acs_rel_type__create_type( + ''dotfolio_guest_profile_rel'', + ''dotFOLIO Profile Guest'', + ''dotFOLIO Profile Guests'', + ''dotfolio_user_profile_rel'', + ''dotfolio_guest_profile_rels'', + ''rel_id'', + ''dotfolio_guest_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotfolio_guest_profile_provider''; + + gid := profiled_group__new( + foo, + ''dotFOLIO Guests'' + ); + + sid := rel_segment__new( + ''dotFOLIO Guests'', + gid, + ''dotfolio_guest_profile_rel'' + ); + + insert + into dotfolio_user_types + (type, pretty_name, rel_type, group_id, segment_id) + values + (''guest'', ''#dotfolio.guest_role_pretty_name#'', ''dotfolio_guest_profile_rel'', gid, sid); + + select group_id + into dotfolio_users_group_id + from groups + where group_name = ''dotFOLIO Users''; + + foo := composition_rel__new( + dotfolio_users_group_id, + gid + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotfolio/sql/postgresql/guests-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/guests-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/guests-package-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,86 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Create the dotFOLIO Guests package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: guests-package-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +select define_function_args ('dotfolio_guest_profile_rel__new','rel_id,user_id,id,rel_type;dotfolio_guest_profile_rel,group_id,creation_user,creation_ip'); + +create function dotfolio_guest_profile_rel__new(integer,integer,varchar,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_user_id alias for $2; + p_id alias for $3; + p_rel_type alias for $4; + p_group_id alias for $5; + p_creation_user alias for $6; + p_creation_ip alias for $7; + v_rel_id dotfolio_user_profile_rels.rel_id%TYPE; + v_group_id groups.group_id%TYPE; +BEGIN + if p_group_id is null then + select min(group_id) + into v_group_id + from profiled_groups + where profile_provider = (select min(impl_id) + from acs_sc_impls + where impl_name = ''dotfolio_guest_profile_provider''); + else + v_group_id := p_group_id; + end if; + + v_rel_id := dotfolio_user_profile_rel__new( + p_rel_id, + p_user_id, + p_id, + p_rel_type, + v_group_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotfolio_guest_profile_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +select define_function_args ('dotfolio_guest_profile_rel__delete','rel_id'); + +create function dotfolio_guest_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotfolio_guest_profile_rels + where rel_id = p_rel_id; + + PERFORM dotfolio_user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; Index: openacs-4/packages/dotfolio/sql/postgresql/guests-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/guests-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/guests-package-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,25 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Guests package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: guests-package-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +select drop_package('dotfolio_guest_profile_rel'); \ No newline at end of file Index: openacs-4/packages/dotfolio/sql/postgresql/owner-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/owner-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/owner-profile-provider-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,76 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Implementation of the profile provider interface for dotFOLIO Owners. +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: owner-profile-provider-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotfolio_owner_profile_provider'', + ''dotfolio_owner_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_owner_profile_provider'', + ''name'', + ''dotfolio_owner_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_owner_profile_provider'', + ''prettyName'', + ''dotfolio_owner_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_owner_profile_provider'', + ''render'', + ''dotfolio_owner_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotfolio_owner_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/owner-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/owner-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/owner-profile-provider-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,71 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Owners package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: owner-profile-provider-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements__ + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotfolio_owner_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_owner_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_owner_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_owner_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotfolio_owner_profile_provider'' + ); + + return 0; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/owners-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/owners-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/owners-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,35 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Create the dotFOLIO Owners package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: owners-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create table dotfolio_owner_profile_rels ( + rel_id integer + constraint dotfolio_owner_p_rels_rel_fk + references dotfolio_user_profile_rels (rel_id) + constraint dotfolio_owner_p_rels_pk + primary key +); + +\i owner-profile-provider-create.sql +\i owners-init.sql +\i owners-package-create.sql Index: openacs-4/packages/dotfolio/sql/postgresql/owners-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/owners-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/owners-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,28 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Owners package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: owners-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +\i owners-package-drop.sql +\i owner-profile-provider-drop.sql + +drop table dotfolio_owner_profile_rels; Index: openacs-4/packages/dotfolio/sql/postgresql/owners-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/owners-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/owners-init.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,90 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Initialise the dotFOLIO Owners package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: owners-init.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create function inline_1() +returns integer as ' +declare + foo integer; + gid integer; + sid integer; + dotfolio_users_group_id integer; +begin + + PERFORM acs_rel_type__create_type( + ''dotfolio_owner_profile_rel'', + ''dotFOLIO Profile Owner'', + ''dotFOLIO Profile Owners'', + ''dotfolio_user_profile_rel'', + ''dotfolio_owner_profile_rels'', + ''rel_id'', + ''dotfolio_owner_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotfolio_owner_profile_provider''; + + gid := profiled_group__new( + foo, + ''dotFOLIO Owners'' + ); + + sid := rel_segment__new( + ''dotFOLIO Owners'', + gid, + ''dotfolio_owner_profile_rel'' + ); + + insert + into dotfolio_user_types + (type, pretty_name, rel_type, group_id, segment_id) + values + (''owner'', ''#dotfolio.owner_role_pretty_name#'', ''dotfolio_owner_profile_rel'', gid, sid); + + select group_id + into dotfolio_users_group_id + from groups + where group_name = ''dotFOLIO Users''; + + foo := composition_rel__new( + dotfolio_users_group_id, + gid + ); + + return 0; + +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotfolio/sql/postgresql/owners-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/owners-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/owners-package-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,86 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Create the Owners package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: owners-package-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +select define_function_args ('dotfolio_owner_profile_rel__new','rel_id,user_id,id,rel_type;dotfolio_owner_profile_rel,group_id,creation_user,creation_ip'); + +create function dotfolio_owner_profile_rel__new(integer,integer,varchar,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_user_id alias for $2; + p_id alias for $3; + p_rel_type alias for $4; + p_group_id alias for $5; + p_creation_user alias for $6; + p_creation_ip alias for $7; + v_rel_id dotfolio_user_profile_rels.rel_id%TYPE; + v_group_id groups.group_id%TYPE; +BEGIN + if p_group_id is null then + select min(group_id) + into v_group_id + from profiled_groups + where profile_provider = (select min(impl_id) + from acs_sc_impls + where impl_name = ''dotfolio_owner_profile_provider''); + else + v_group_id := p_group_id; + end if; + + v_rel_id := dotfolio_user_profile_rel__new( + v_rel_id, + p_user_id, + p_id, + p_rel_type, + v_group_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotfolio_owner_profile_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +select define_function_args ('dotfolio_owner_profile_rel__delete','rel_id'); + +create function dotfolio_owner_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotfolio_owner_profile_rels + where rel_id = p_rel_id; + + PERFORM dotfolio_user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; Index: openacs-4/packages/dotfolio/sql/postgresql/owners-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/owners-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/owners-package-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,25 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the dotFOLIO Owners package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: owners-package-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +select drop_package('dotfolio_owner_profile_rel'); \ No newline at end of file Index: openacs-4/packages/dotfolio/sql/postgresql/user-profile-provider-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/user-profile-provider-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/user-profile-provider-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,77 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: user-profile-provider-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + +-- Implementation of the profile provider interface for dotfolio users. + +create function inline_0() +returns integer as ' +begin + + -- create the implementation + perform acs_sc_impl__new( + ''profile_provider'', + ''dotfolio_user_profile_provider'', + ''dotfolio_user_profile_provider'' + ); + + -- add the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_user_profile_provider'', + ''name'', + ''dotfolio_user_profile_provider::name'', + ''TCL'' + ); + + -- prettyName method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_user_profile_provider'', + ''prettyName'', + ''dotfolio_user_profile_provider::prettyName'', + ''TCL'' + ); + + -- render method + perform acs_sc_impl_alias__new( + ''profile_provider'', + ''dotfolio_user_profile_provider'', + ''render'', + ''dotfolio_user_profile_provider::render'', + ''TCL'' + ); + + -- bind this implementation to the interface it implements + perform acs_sc_binding__new( + ''profile_provider'', + ''dotfolio_user_profile_provider'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/user-profile-provider-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/user-profile-provider-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/user-profile-provider-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,71 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: user-profile-provider-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- drop the binding between this implementation and the interface it + -- implements. + perform acs_sc_binding__delete( + ''profile_provider'', + ''dotfolio_user_profile_provider'' + ); + + -- drop the bindings to the method implementations + + -- name method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_user_profile_provider'', + ''name'' + ); + + -- prettyName method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_user_profile_provider'', + ''prettyName'' + ); + + -- render method + perform acs_sc_impl_alias__delete( + ''profile_provider'', + ''dotfolio_user_profile_provider'', + ''render'' + ); + + -- drop the implementation + perform acs_sc_impl__delete( + ''profile_provider'', + ''dotfolio_user_profile_provider'' + ); + + return 0; +END;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotfolio/sql/postgresql/users-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/users-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/users-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,98 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: users-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +create table dotfolio_user_profile_rels ( + rel_id integer + constraint dotfolio_user_profile_rels_rel_id_fk + references dotfolio_user_profile_rels (rel_id) + constraint dotfolio_user_profile_rels_pk + primary key, + id varchar(100) +); + +create table dotfolio_user_types ( + type varchar(100) + constraint dotfolio_user_types_pk + primary key, + pretty_name varchar(200), + rel_type varchar(100) + constraint dotfolio_user_types_rel_type_fk + references acs_rel_types (rel_type) + constraint dotfolio_user_types_rel_type_nn + not null, + group_id integer + constraint dotfolio_user_types_group_id_fk + references profiled_groups (group_id) + constraint dotfolio_user_types_group_id_nn + not null, + segment_id integer + constraint dotfolio_user_types_segment_fk + references rel_segments (segment_id) + constraint dotfolio_user_types_segment_nn + not null +); + +create view dotfolio_users +as + select acs_rels.rel_id, + dotfolio_user_profile_rels.id, + users.user_id, + users.username, + persons.first_names, + persons.last_name, + parties.email, + dotfolio_user_types.type, + dotfolio_user_types.pretty_name as pretty_type, + dotfolio_user_types.rel_type, + dotfolio_user_types.group_id, + dotfolio_user_types.segment_id + from dotfolio_user_profile_rels, + dotfolio_user_types, + acs_rels, + parties, + users, + persons + where dotfolio_user_profile_rels.rel_id = acs_rels.rel_id + and acs_rels.object_id_one = dotfolio_user_types.group_id + and acs_rels.object_id_two = parties.party_id + and parties.party_id = users.user_id + and users.user_id = persons.person_id; + + +-- create users, then create user groups. +\i user-profile-provider-create.sql +\i users-init.sql +\i users-package-create.sql + +-- create administrators (eg dotFOLIO Staff) +\i admins-create.sql + +-- create advisers +\i advisers-create.sql + +-- create owner +\i owners-create.sql + +-- create guest +\i guests-create.sql Index: openacs-4/packages/dotfolio/sql/postgresql/users-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/users-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/users-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,43 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: users-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +-- drop guest users +\i guests-drop.sql + +-- drop owners +\i owners-drop.sql + +-- drop advisers +\i advisers-drop.sql + +-- drop admins +\i admins-drop.sql + +\i users-package-drop.sql +\i user-profile-provider-drop.sql + +drop view dotfolio_users; + +drop table dotfolio_user_types; +drop table dotfolio_user_profile_rels; \ No newline at end of file Index: openacs-4/packages/dotfolio/sql/postgresql/users-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/users-init.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/users-init.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,71 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: users-init.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + +-- Initialize the User Profile package + +create function inline_1() +returns integer as ' +declare + foo integer; +begin + + perform acs_rel_type__create_type( + ''dotfolio_user_profile_rel'', + ''dotFOLIO Profile User'', + ''dotFOLIO Profile Users'', + ''user_profile_rel'', + ''dotfolio_user_profile_rels'', + ''rel_id'', + ''dotfolio_user_profile_rel'', + ''profiled_group'', + null, + 0, + null, + ''user'', + null, + 0, + 1 + ); + + select min(impl_id) + into foo + from acs_sc_impls + where impl_name = ''dotfolio_user_profile_provider''; + + foo := profiled_group__new( + foo, + ''dotFOLIO Users'' + ); + + foo := rel_segment__new( + ''dotFOLIO Users'', + foo, + ''dotfolio_user_profile_rel'' + ); + + return(0); +end; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); Index: openacs-4/packages/dotfolio/sql/postgresql/users-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/users-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/users-package-create.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,86 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- The dotFOLIO system +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: users-package-create.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + +-- Create the User Profile package + +select define_function_args ('dotfolio_user_profile_rel__new','rel_id,user_id,id,rel_type;dotfolio_user_profile_rel,group_id,creation_user,creation_ip'); + +create function dotfolio_user_profile_rel__new(integer,integer,varchar,varchar,integer,integer,varchar) +returns integer as ' +DECLARE + p_rel_id alias for $1; + p_user_id alias for $2; + p_id alias for $3; + p_rel_type alias for $4; + p_group_id alias for $5; + p_creation_user alias for $6; + p_creation_ip alias for $7; + v_rel_id user_profile_rels.rel_id%TYPE; + v_group_id groups.group_id%TYPE; +BEGIN + if p_group_id is null then + select min(group_id) + into v_group_id + from profiled_groups + where profile_provider = (select min(impl_id) + from acs_sc_impls + where impl_name = ''dotfolio_user_profile_provider''); + else + v_group_id := p_group_id; + end if; + + v_rel_id := user_profile_rel__new( + p_rel_id, + p_rel_type, + v_group_id, + p_user_id, + p_creation_user, + p_creation_ip + ); + + insert + into dotfolio_user_profile_rels + (rel_id, id) + values + (v_rel_id, p_id); + + return v_rel_id; +END; +' language 'plpgsql'; + + +select define_function_args ('dotfolio_user_profile_rel__delete','rel_id'); + +create function dotfolio_user_profile_rel__delete(integer) +returns integer as ' +DECLARE + p_rel_id alias for $1; +BEGIN + delete + from dotfolio_user_profile_rels + where rel_id = p_rel_id; + + PERFORM user_profile_rel__delete(p_rel_id); + return (0); +END; +' language 'plpgsql'; Index: openacs-4/packages/dotfolio/sql/postgresql/users-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/sql/postgresql/users-package-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/sql/postgresql/users-package-drop.sql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,25 @@ +-- +-- Copyright (C) 2005 WEG +-- +-- This file is part of dotFOLIO. +-- +-- dotFOLIO 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. +-- +-- dotFOLIO 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. +-- + +-- +-- Drop the User Profile package +-- +-- @author ncarroll@ee.usyd.edu.au +-- @version $Id: users-package-drop.sql,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +-- + + +select drop_package('dotfolio_user_profile_rel'); \ No newline at end of file Index: openacs-4/packages/dotfolio/tcl/dotfolio-apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/tcl/dotfolio-apm-callback-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/tcl/dotfolio-apm-callback-procs.tcl 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,26 @@ +ad_library { + + APM callbacks for the dotfolio package + + @author nick.c@rroll.net + @creation-date 2005-04-04 + @cvs-id $Id: dotfolio-apm-callback-procs.tcl,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +} + +namespace eval dotfolio::install { + + ad_proc -public after_install { + } { + Configure kernel to use usernames instead of email for logins. + dotfolio relies on usernames to create portfolio spaces for users. + + @return + + @error + } { + parameter::set_from_package_key -package_key "acs-kernel" \ + -parameter "UseEmailForLoginP" \ + -value "0" + } + +} \ No newline at end of file Index: openacs-4/packages/dotfolio/tcl/dotfolio-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/tcl/dotfolio-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/tcl/dotfolio-procs-postgresql.xql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,35 @@ + + + postgresql7.4 + + + + select dotfolio__new ( + null, -- dotfolio_id, + :owner_id, + :node_id, + :package_id, + :username, + current_timestamp, -- creation_date + :user_id, + :peeraddr, -- creation_ip, + null -- context_id + ) + + + + + + UPDATE cr_items SET live_revision=latest_revision + WHERE item_id=:welcome_content_id + + + + + + SELECT first_names, last_name FROM dotfolio_users + WHERE user_id = :owner_id + + + + Index: openacs-4/packages/dotfolio/tcl/dotfolio-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/tcl/dotfolio-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/tcl/dotfolio-procs.tcl 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,215 @@ +ad_library { + dotfolio procs + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-03-22 + @cvs-id $Id: dotfolio-procs.tcl,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +} + +namespace eval dotfolio { + + ad_proc -private packages_no_mem { + -node_id + } { + return a list of packages for the subsite containing node_id + + @author Jeff Davis davis@xarg.net + @creation-date 2004-05-07 + @see dotfolio::packages + } { + # need to strip nodes which have no mounted package... + set packages [list] + foreach package [site_node::get_children -all -node_id $node_id -element package_id] { + if {![empty_string_p $package]} { + lappend packages $package + } + } + + return $packages + } + + ad_proc -public packages { + -node_id + } { + Return a list of packages for the subsite containing node_id + + Memoized function. + + @author Jeff Davis davis@xarg.net + @creation-date 2004-05-07 + @see dotfolio::packages_no_mem + } { + set subsite_node_id [site_node::closest_ancestor_package \ + -package_key acs-subsite \ + -node_id $node_id \ + -include_self \ + -element node_id] + + return [util_memoize [list dotfolio::packages_no_mem -node_id $subsite_node_id] 1200] + } + + ad_proc -public create_dotfolio_for_user { + {-username:required} + } { + Creates a dotfolio space for the a user with the specified username. + + @param username Must supply a valid username. A dotfolio space is + created with the given username. + @return Returns 1 if the dotfolio space was successfully created, + otherwise 0 is returned. + } { + set user_id [ad_conn user_id] + set peeraddr [ad_conn peeraddr] + + set base_url "/$username" + + # Set success flag to fail by default. + set success 0 + + db_transaction { + + # set the mount location for the blogger + set blog_url "$base_url/blog" + + # set the mount location for file-storage + set files_url "$base_url/files" + + # set the mount location for dotfolio-ui + set organise_url "$base_url/organise" + + set out [apm::process_install_xml \ + /packages/dotfolio/lib/install.xml \ + [list base_url $base_url \ + name $username \ + blog_url $blog_url \ + files_url $files_url \ + organise_url $organise_url]] + + set owner_id [acs_user::get_by_username -username $username] + set node_id [site_node::get_node_id -url $base_url] + array set node_info [site_node::get -node_id $node_id] + set package_id $node_info(package_id) + + # create new folder + set folder_id [content::folder::new \ + -name $package_id \ + -label "dotFOLIO Folder" \ + -package_id $package_id \ + -context_id $package_id] + + # register content types + content::folder::register_content_type \ + -folder_id $folder_id \ + -content_type "content_revision" \ + -include_subtypes "t" + + # Get first names and last name of user for default + # welcome note. + db_1row get_users_names {} + + # Create a default welcome note for user's portfolio. + set welcome_content_id [content::item::new \ + -name "welcome" \ + -parent_id $folder_id \ + -title "$first_names $last_name" \ + -text [_ dotfolio.default_welcome_note] \ + -storage_type "text"] + + db_dml set_live {} + + # Add the owner as a member of their dotfolio. + set group_id [application_group::group_id_from_package_id \ + -package_id $package_id] + group::add_member -group_id $group_id -user_id $owner_id \ + -rel_type "admin_rel" + + # Give dotfolio owner admin permission for their blog. + array set blog_node_info [site_node::get -url $blog_url] + set blog_id $blog_node_info(object_id) + permission::grant -party_id $owner_id -object_id $blog_id \ + -privilege "admin" + + # Give dotfolio owner write and delete permissions for their files. + array set files_node_info [site_node::get -url $files_url] + set files_id $files_node_info(object_id) + permission::grant -party_id $owner_id -object_id $files_id \ + -privilege "write" + permission::grant -party_id $owner_id -object_id $files_id \ + -privilege "delete" + + db_exec_plsql create_dotfolio {} + + # Set success flag to 1 to reflect successful creation of + # the user's dotfolio space. + set success 1 + } + + return $success + } + + ad_proc -public get_folder_id { + {-package_id ""} + } { + Return content repository folder_id for the + specified dotfolio package_id. + + @param package_id If not speicifed use the current package_id from + ad_conn. It there is no current connection or folder does not + exist, returns empty string. + + @return + + @error + } { + + if {$package_id eq ""} { + if {[ad_conn -connected_p]} { + set package_id [ad_conn package_id] + } else { + return "" + } + } + return [db_string get_folder_id \ + "select folder_id from cr_folders where package_id=:package_id" \ + -default ""] + } + + ad_proc -public package_key {} { + returns the package key + } { + return dotfolio + } + + ad_proc -public get_url {} { + returns the root URL for dotFOLIO + } { + return "/[package_key]" + } + + ad_proc -public get_admin_url {} { + returns the root admin URL for dotFOLIO + } { + return "[get_url]/admin" + } + + ad_proc -public get_node_id {} { + return the root node id for dotFOLIO + } { + return [site_node::get_node_id -url [get_url]] + } + + ad_proc -public get_package_id {} { + return the package ID for dotFOLIO + } { + return [site_node::get_object_id -node_id [get_node_id]] + } + + ad_proc -public get_rel_type_from_user_type { + -type + } { + Returns the appropriate rel_type base on user type and access level. + } { + return "dotfolio_${type}_profile_rel" + } + +} Index: openacs-4/packages/dotfolio/tcl/dotfolio-security-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/tcl/dotfolio-security-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/tcl/dotfolio-security-procs-postgresql.xql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,41 @@ + + + + postgresql7.1 + + + + SELECT count(*) + FROM dual + WHERE exists (SELECT 1 + FROM dotfolio_users + WHERE user_id = :user_id) + + + + + + SELECT pretty_name, type + FROM dotfolio_user_types + WHERE type != 'guest' + ORDER BY pretty_name + + + + + + SELECT pretty_name, type + FROM dotfolio_user_types + ORDER BY pretty_name + + + + + + SELECT rel_id + FROM dotfolio_users + WHERE user_id = :user_id + + + + \ No newline at end of file Index: openacs-4/packages/dotfolio/tcl/dotfolio-security-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/tcl/dotfolio-security-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/tcl/dotfolio-security-procs.tcl 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,131 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + Procs to manage dotFOLIO Security + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: dotfolio-security-procs.tcl,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +} + +namespace eval dotfolio { + + ad_proc -private do_abort {} { + Do an abort if security violation + } { + ad_returnredirect "not-allowed" + return -code error + } + + ad_proc -public admin_p { + {-user_id ""} + } { + check if a user is admin for dotFOLIO + } { + return [permission::permission_p -party_id $user_id -object_id \ + [dotfolio::get_package_id] -privilege admin] + } + + ad_proc -public require_admin { + {-user_id ""} + } { + Require that a user have admin privileges on all of dotfolio + } { + if {![admin_p -user_id $user_id]} { + do_abort + } + } + + ad_proc -public user_p { + {-user_id:required} + } { + Check if a user is a dotFOLIO user + } { + return [db_string select_count {}] + } + + ad_proc -public get_user_types_as_options { + {-ignore_guest "false"} +} { + Returns the list of possible user types as a list of options + + @param ignore_guest True if guest should be ignored from the list of + user types. Set to false to include the guest user type. The default + is false. + } { + if { $ignore_guest } { + # Get list of users. Note that query ignores guest user type. + # We do not want to revert admins, owners or advisers back to guest. + set unlocalized_list [db_list_of_lists select_user_types_as_options_without_guest {}] + } else { + set unlocalized_list [db_list_of_lists select_user_types_as_options {}] + } + + set localized_list [list] + foreach type_pair $unlocalized_list { + lappend localized_list [list [lang::util::localize [lindex $type_pair 0]] [lindex $type_pair 1]] + } + + return $localized_list + } + + ad_proc -public user_add { + {-type owner} + {-id ""} + {-user_id:required} + } { + Add a user as a dotfolio user. + } { + # Check if the user is already a dotfolio user + if {[user_p -user_id $user_id]} { + return + } + + # Set default ID to email address + if {[empty_string_p $id]} { + set id [cc_email_from_party $user_id] + } + + # set up extra vars + set extra_vars [ns_set create] + ns_set put $extra_vars user_id $user_id + ns_set put $extra_vars id $id + + # Add the relation (no need for object_id_one or two). + set rel_id [relation_add \ + -extra_vars $extra_vars \ + -member_state approved \ + [get_rel_type_from_user_type -type $type] \ + "" \ + $user_id \ + ] + + return $rel_id + } + + ad_proc -public user_remove { + {-user_id:required} + } { + Remove a user from the set of dotFOLIO users + } { + set rel_id [db_string select_rel_id {} -default ""] + + if {![empty_string_p $rel_id]} { + relation_remove $rel_id + } + } +} \ No newline at end of file Index: openacs-4/packages/dotfolio/tcl/dotfolio-ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/tcl/dotfolio-ui-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/tcl/dotfolio-ui-procs.tcl 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,27 @@ +ad_library { + dotfolio procs + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-03-22 + @cvs-id $Id: dotfolio-ui-procs.tcl,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +} + +namespace eval dotfolio::ui { + + ad_proc -public organiser_url { + {-node_id {}} + } { + Returns the cop-ui URL for a given subsite. + + @param subsite_id the subsite for which to find the cop-ui url + + @return a url for the dotfolio-ui package + } { + if {[empty_string_p $node_id]} { + set node_id [site_node::closest_ancestor_package -package_key acs-subsite -node_id [ad_conn node_id] -include_self -element node_id] + } + + return [lindex [site_node::get_children -node_id $node_id -package_key dotfolio-ui -all] 0] + } + +} Index: openacs-4/packages/dotfolio/tcl/dotfolio-users-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/tcl/dotfolio-users-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/tcl/dotfolio-users-procs-postgresql.xql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,27 @@ + + + postgresql7.1 + + + + SELECT owner_id FROM dotfolios WHERE node_id = :node_id + + + + + + SELECT username FROM users WHERE user_id = :owner_id + + + + + + SELECT live_revision as revision_id, item_id + FROM acs_rels a, cr_items c + WHERE a.object_id_two = c.item_id + AND a.object_id_one = :owner_id + AND a.rel_type = 'user_portrait_rel' + + + + Index: openacs-4/packages/dotfolio/tcl/dotfolio-users-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/tcl/dotfolio-users-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/tcl/dotfolio-users-procs.tcl 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,95 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + Procs for basic dotFOLIO + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: dotfolio-users-procs.tcl,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +} + +namespace eval dotfolio::user { + + ad_proc get_owner_id { + { -node_id "" } + } { + Returns the user_id for the owner of a dotfolio that is mounted + at a node_id. + + @param node_id The node_id for a mounted dotfolio instance. + This is optional as ad_conn node_id will be used by default. + @return Returns the owner_id for a dotfolio node_id. + } { + if { [empty_string_p $node_id] } { + set node_id [ad_conn node_id] + } + + db_1row select_owner_id {} + return $owner_id + } + + ad_proc get_owner_username { + owner_id + } { + Gets the username for the given owner_id. + + @param owner_id The user ID of the dotfolio owner. + @return Returnshe username for the dotfolio owner that + matches the given owner_id. Otherwise returns the empty string. + } { + return [db_string select_username {} -default ""] + } + + ad_proc owner_p { + { -node_id "" } + user_id + } { + Returns 1 if the specified user_id is the owner of a dotfolio mounted + at a node_id. Otherwise returns 0. + + @param node_id Optional. Specify if you need to check that a user + is the owner of a dotfolio mounted at a specific node_id. + @param user_id A user's user_id. + } { + set owner_id [get_owner_id -node_id $node_id] + + return [expr [string equal $user_id $owner_id] ] + } + + ad_proc portrait_p { + owner_id + } { + Returns 1 if the dotfolio owner has a portrait, other returns 0. + + @param owner_id The ID of the dotfolio owner. + @return Returns 1 if the dotfolio owner has a portrait, + otherwise returns 0. + } { + if {![db_0or1row select_portrait {}] || \ + [empty_string_p $revision_id]} { + + # The user doesn't have a portrait yet + return 0 + + } else { + return 1 + } + + return 0 + } + +} \ No newline at end of file Index: openacs-4/packages/dotfolio/www/blog-entries-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/blog-entries-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/blog-entries-postgresql.xql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,17 @@ + + + + + + + SELECT be.entry_id, be.title, be.category_id, + to_char(be.entry_date, 'HH24:MI:SS, DD Mon YYYY') AS entry_date + FROM pinds_blog_entries be, acs_objects ao + WHERE ao.creation_user = :owner_id + AND ao.object_type = 'pinds_blog_entry' + AND be.entry_id = ao.object_id + [template::list::orderby_clause -orderby -name "entries"] + + + + Index: openacs-4/packages/dotfolio/www/blog-entries.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/blog-entries.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/blog-entries.adp 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,3 @@ + + + \ No newline at end of file Index: openacs-4/packages/dotfolio/www/blog-entries.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/blog-entries.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/blog-entries.tcl 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,48 @@ +ad_page_contract { + + Display all blog entries for a specific owner_id. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-03-24 + @cvs-id $Id: blog-entries.tcl,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +} { + owner_id + url + {orderby "entry_date,asc"} +} + +set user_id [auth::require_login] + +set elements { + title { + label {Title} + link_url_col blog_entry_url + } + + entry_date { + label {Entry Date} + } +} + +# Maybe add category to listing too. + +template::list::create \ + -name entries \ + -multirow entries \ + -elements $elements \ + -html {width "100%"} \ + -orderby { + title {orderby {lower(be.title)}} + entry_date {orderby entry_date} + } \ + -filters { + url {} + owner_id {} + } + +set one_entry_url "blog/one-entry" +db_multirow -extend {blog_entry_url} entries entries {} { + set blog_entry_url [export_vars -url -base $url$one_entry_url {entry_id}] +} + +ad_return_template Index: openacs-4/packages/dotfolio/www/index-not-a-user.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/index-not-a-user.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/index-not-a-user.tcl 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,36 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + Filters out non-dotfolio users, and redirects to relevant pages. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: index-not-a-user.tcl,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +} + +if { [dotfolio::user_p -user_id [ad_conn user_id]] } { + # Already a user + ad_returnredirect . + ad_script_abort +} + +if { [dotfolio::admin_p] } { + set return_url [export_vars -base "[dotfolio::get_admin_url]/user-add-type" { { user_id {[ad_conn user_id]} } { referer "[dotfolio::get_url]/"} }] + set self_approve_url [export_vars -base "[apm_package_url_from_key "acs-admin"]users/member-state-change" { { user_id {[ad_conn user_id]} } { member_state approved} return_url }] + ad_returnredirect $self_approve_url + ad_script_abort +} \ No newline at end of file Index: openacs-4/packages/dotfolio/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/index-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/index-postgresql.xql 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,24 @@ + + + + + + + SELECT du.last_name || ', ' || du.first_names AS name, + d.owner_id, du.email, d.node_id, + site_node__url(d.node_id) AS url, + dotfolio__has_p(du.user_id) AS has_dotfolio_p, + acs_permission__permission_p( + :root_object_id,du.user_id, + 'admin') AS site_wide_admin_p, + (SELECT count(*) FROM acs_objects + WHERE creation_user = du.user_id + AND object_type = 'pinds_blog_entry') AS blog_entries + FROM dotfolio_users du LEFT OUTER JOIN dotfolios d + ON du.user_id = d.owner_id + WHERE du.type = 'owner' + [template::list::orderby_clause -orderby -name "portfolios"] + + + + Index: openacs-4/packages/dotfolio/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/index.adp 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,31 @@ + + + + + +

+

+ + + + + + + +
+
+
+ + + +
+
+ +
+
+
+
+
+ Index: openacs-4/packages/dotfolio/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/index.tcl 5 May 2005 08:51:31 -0000 1.1 @@ -0,0 +1,57 @@ +ad_page_contract { + + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-03-24 + @cvs-id $Id: index.tcl,v 1.1 2005/05/05 08:51:31 ncarroll Exp $ +} { + {orderby "name,asc"} +} + +set package_id [ad_conn package_id] + +set user_id [auth::require_login] + +set admin_p [ad_permission_p $package_id admin] + +# Redirect if user is not a dotfolio user. +if {![dotfolio::user_p -user_id $user_id]} { + ad_returnredirect "index-not-a-user" + ad_script_abort +} + +set root_object_id [acs_magic_object security_context_root] + +set elements { + name { + label {\#dotfolio.name\#} + link_url_col dotfolio_url + } + + email { + label {\#dotfolio.email\#} + display_template {(@portfolios.email@)} + } + + blog_entries { + label {\#dotfolio.num_of_blog_entries\#} + link_url_col blog_entries_url + } +} + +template::list::create \ + -name portfolios \ + -multirow portfolios \ + -elements $elements \ + -orderby { + name {orderby {lower(name)}} + blog_entries {orderby blog_entries} + } + +set one_entry_url "blog/one-entry" +db_multirow -extend {dotfolio_url blog_entries_url} portfolios portfolios {} { + set dotfolio_url $url + set blog_entries_url [export_vars -url -base {blog-entries} {owner_id url}] +} + +ad_return_template Index: openacs-4/packages/dotfolio/www/admin/create-folio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/create-folio.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/create-folio.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,36 @@ +ad_page_contract { + Creates a dotfolio for the specified username. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-03-10 + @cvs-id $Id: create-folio.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ +} { + username:notnull +} -validate { + username_notnull { + if { ![exists_and_not_null username] } { + ad_complain + } + } + + username_exists -requires { username_notnull } { + if { [empty_string_p [acs_user::get_by_username \ + -username $username]] } { + ad_complain + } + } +} -errors { + username_notnull "#dotfolio.username_must_not_be_null#" + username_exists "#dotfolio.username_does_not_exist#" +} + +set message [_ dotfolio.error_creating_dotfolio] +set success_p [dotfolio::create_dotfolio_for_user -username $username] + +if { $success_p } { + set message [_ dotfolio.successfully_created_dotfolio] +} + +ad_returnredirect \ + -message $message \ + "users" Index: openacs-4/packages/dotfolio/www/admin/dotfolio-admin-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/dotfolio-admin-master.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/dotfolio-admin-master.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,42 @@ +<% + +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# + +%> + + + + + @title@ + 1 + @focus;noquote@ + @context;noquote@ + @context_bar;noquote@ + @doc_type;noquote@ + + + + + Index: openacs-4/packages/dotfolio/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/index.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,34 @@ +<% + +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# + +%> + + + + +#dotfolio.dotfolio_admin_pretty_name# +@context_bar@ + + + + Index: openacs-4/packages/dotfolio/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/index.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,30 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + Displays main dotFOLIO admin page + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: index.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ +} + +#Pages in this directory are only runnable by dotfolio-wide admins. +dotfolio::require_admin + +set context_bar {} + +ad_return_template Index: openacs-4/packages/dotfolio/www/admin/password-update-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/password-update-2-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/password-update-2-postgresql.xql 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,12 @@ + + + + + + + SELECT email + FROM registered_users + WHERE user_id = :user_id + + + \ No newline at end of file Index: openacs-4/packages/dotfolio/www/admin/password-update-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/password-update-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/password-update-2.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,84 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + + Updates the user's password if password_1 matches password_2. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: password-update-2.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ + +} { + + user_id:integer,notnull + password_1:notnull + password_2:notnull + {return_url ""} + +} -validate { + + confirm_password -requires {password_2:notnull} { + if {[empty_string_p $password_2]} { + ad_complain "[_ dotfolio.need_to_confirm]" + } + } + new_password_match -requires {password_1:notnull password_2:notnull confirm_password} { + if {![string equal $password_1 $password_2]} { + ad_complain "[_ dotfolio.passwords_dont_match]" + } + } + +} + +ad_change_password $user_id $password_1 + +set system_owner [ad_system_owner] +set system_name [ad_system_name] + +set subject "[_ dotfolio.your_password_on_syst]" +set change_password_url "[ad_url]/user/password-update?[export_vars {user_id {password_old $password_1}}]" +set message "[_ dotfolio.password_url]" + +set email [db_string select_user_email {}] + +# Send email +if [catch {ns_sendmail $email $system_owner $subject $message} errmsg] { + ns_log Error "[_ dotfolio.error_sending_email_to]" $errmsg + ad_return_error \ + "[_ dotfolio.error_sending_email]" \ + "[_ dotfolio.error_sending_email_2]" +} else { + + set system_name [ad_system_name] + set email_from [ad_system_owner] + set admin_subject "[_ dotfolio.email_was_just_sent]" + set admin_message "[_ dotfolio.email_was_just_sent_msg]" + + if [catch {ns_sendmail $system_owner $system_owner $admin_subject $admin_message} errmsg] { + + ns_log Error "[_ dotfolio.error_sending_email_to]" $errmsg + ad_return_error \ + "[_ dotfolio.error_sending_email]" \ + "[_ dotfolio.error_sending_email_2]" + } +} + +if {[empty_string_p $return_url]} { + set return_url "user?user_id=$user_id" +} + +ad_returnredirect $return_url Index: openacs-4/packages/dotfolio/www/admin/password-update-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/password-update-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/password-update-postgresql.xql 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,15 @@ + + + + + + SELECT first_names, + last_name, + email, + url + FROM cc_users + WHERE user_id = :user_id + + + + \ No newline at end of file Index: openacs-4/packages/dotfolio/www/admin/password-update.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/password-update.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/password-update.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,45 @@ +<% +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# +%> + + +#dotfolio.update_password# +@context_bar@ + +
+ + + + + + + + + + + + + +
#dotfolio.new_password#
#dotfolio.confirm#
+ +
+
+ +
+ +
+
Index: openacs-4/packages/dotfolio/www/admin/password-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/password-update.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/password-update.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,35 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + Update password for a specific user. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: password-update.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ +} { + {user_id:integer} + {return_url ""} + {password_old ""} +} + +db_1row user_information {} + +set context_bar [list [list users Users] [list "user.tcl?user_id=$user_id" "$first_names $last_name"] "[_ dotfolio.update_password]"] + +set site_link [ad_site_home_link] + +ad_return_template Index: openacs-4/packages/dotfolio/www/admin/user-add-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add-2-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add-2-postgresql.xql 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + + SELECT first_names || ' ' || last_name + FROM persons + WHERE person_id = :admin_user_id + + + + Index: openacs-4/packages/dotfolio/www/admin/user-add-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add-2.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add-2.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,48 @@ +<% + +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# + +%> + + + + +#dotfolio.add_a_user# +@context_bar@ + +@first_names@ @last_name@ #dotfolio.has_been_added_to# @system_name@. +#dotfolio.edit_message_and_hit_send# + +

+ +
+ @export_vars;noquote@ + #dotfolio.message# + +

+ + + +

+ + +
Index: openacs-4/packages/dotfolio/www/admin/user-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add-2.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,67 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + Processes a new dotFOLIO user created by an admin. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: user-add-2.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ +} -query { + + user_id + password + type + {referer "[dotfolio::get_admin_url]/users"} + +} -properties { + context_bar:onevalue + export_vars:onevalue + system_name:onevalue + system_url:onevalue + first_names:onevalue + last_name:onevalue + email:onevalue + id:onevalue + password:onevalue + administration_name:onevalue +} + +# Get user info +acs_user::get -user_id $user_id -array user +# easier to work with scalar vars than array +foreach var_name [array names user] { + set $var_name $user($var_name) +} + +set dotfolio_user_p [dotfolio::user_p -user_id $user_id] + +set redirect "user-add-2?[export_vars {user_id password referer type can_browse_p read_private_data_p dotlrn_interactive_p add_membership_p}]" +# Don't redirect back to the user-add-type page if we've already been there +if {!$dotfolio_user_p} { + set redirect "${redirect}" + ad_returnredirect "user-add-type?[export_vars {user_id {referer $redirect}}]" + ad_script_abort +} + + +set admin_user_id [ad_verify_and_get_user_id] +set administration_name [db_string select_admin_name {}] + +set context_bar [list [_ dotfolio.add_user]] +set system_name [ad_system_name] +set system_url [ad_parameter -package_id [ad_acs_kernel_id] SystemURL ""] +set export_vars [export_vars -form {email referer type}] Index: openacs-4/packages/dotfolio/www/admin/user-add-3-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add-3-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add-3-postgresql.xql 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + + SELECT email + FROM parties + WHERE party_id = :admin_user_id + + + + Index: openacs-4/packages/dotfolio/www/admin/user-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add-3.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add-3.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,43 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + Sends email confirmation to user after they've been created + + @Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: user-add-3.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ +} -query { + email + message + {referer "[dotfolio::get_admin_url]/users"} +} + +set admin_user_id [ad_verify_and_get_user_id] +set admin_email [db_string select_admin_email {}] + +set msg_subst_values [list system_name [ad_system_name] \ + system_url [ad_parameter SystemUrl]] +set email_subject [_ dotlrn.user_add_confirm_email_subject $msg_subst_values] +if [catch {ns_sendmail "$email" "$admin_email" "$email_subject" "$message"} \ + errmsg] { + set quotehtml_errmsg [ad_quotehtml $errmsg] + ad_return_error "[_ dotfolio.error_sending_email]" \ + "[_ dotfolio.system_was_unable]" + ad_script_abort +} + +ad_returnredirect $referer \ No newline at end of file Index: openacs-4/packages/dotfolio/www/admin/user-add-type-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add-type-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add-type-postgresql.xql 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.1 + + + + SELECT email, + first_names, + last_name, + username + FROM registered_users + WHERE user_id = :user_id + + + \ No newline at end of file Index: openacs-4/packages/dotfolio/www/admin/user-add-type.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add-type.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add-type.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,27 @@ +<% +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# +%> + + +#dotfolio.select_user_type# +@context_bar@ + +#dotfolio.select_a_user_type# @first_names@ @last_name@. + +

+ + Index: openacs-4/packages/dotfolio/www/admin/user-add-type.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add-type.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add-type.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,94 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + + Displays main dotFOLIO admin page + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: user-add-type.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ + +} -query { + user_id + {referer "[dotfolio::get_admin_url]/users"} +} -properties { + context_bar:onevalue +} + +#Pages in this directory are only runnable by dotfolio-wide admins. +dotfolio::require_admin + +set system_name [ad_system_name] +set system_url [ad_url] + +db_1row select_user_info {} + +ad_form -name add_user -export {referer user_id} -form { + + {id:text(hidden) + {value $username} + } + + {type:text(select) + {label "[_ dotfolio.user_type]"} + {options [dotfolio::get_user_types_as_options]} + } + +} -on_submit { + + set subject [_ dotfolio.subject_membership_has_been_approved] + set message [_ dotfolio.message_membership_has_been_approved] + set email_from [ad_parameter -package_id [ad_acs_kernel_id] SystemOwner] + + # Add the user as a dotfolio user. + dotfolio::user_add -id $id -type $type -user_id $user_id + + # If the user is of type "owner", then create a dotfolio space for + # the user. + if { [string equal $type "owner"] } { + dotfolio::create_dotfolio_for_user -username $username + } + + if [catch {ns_sendmail $email $email_from $subject $message} errmsg] { + + ns_log Error "[_ dotfolio.user_new_2_log_error]" $errmsg + ad_return_error \ + "[_ dotfolio.error_sending_email]" \ + "[_ dotfolio.error_sending_email_to]" + } else { + + set admin_subject "[_ dotfolio.email_was_just_sent]" + set admin_message "[_ dotfolio.email_was_just_sent_msg]" + + if [catch {ns_sendmail $email_from $email_from $admin_subject $admin_message} errmsg] { + + ns_log Error "[_ dotfolio.user_new_2_log_error]" $errmsg + ad_return_error \ + "[_ dotfolio.error_sending_email]" \ + "[_ dotfolio.error_sending_email_to]" + } + + } + +} -after_submit { + ad_returnredirect $referer + ad_script_abort +} + +set context_bar [list [list users [_ dotfolio.users]] [_ dotfolio.new]] + +ad_return_template Index: openacs-4/packages/dotfolio/www/admin/user-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,32 @@ +<% +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# +%> + + + + +#dotfolio.add_a_user# +@context_bar;noquote@ +register.email + +

#dotfolio.add_a_new_user#

+ + + Index: openacs-4/packages/dotfolio/www/admin/user-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-add.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,39 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + Adds a user to dotFOLIO. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: user-add.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ +} { + + {type owner} + {referer "[dotfolio::get_admin_url]/users"} + +} -properties { + context_bar:onevalue +} + +set current_user_id [ad_maybe_redirect_for_registration] + +#Pages in this directory are only runnable by dotfolio-wide admins. +dotfolio::require_admin +set context_bar [list [list users [_ dotfolio.users]] [_ dotfolio.add_user]] + +# Export dotlrn-specific vars in the next_url +set next_url [export_vars -base user-add-2 {type referer}] Index: openacs-4/packages/dotfolio/www/admin/user-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-edit-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-edit-postgresql.xql 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,17 @@ + + + + postgresql7.1 + + + + SELECT email, + first_names, + last_name, + pretty_type, + username + FROM dotfolio_users + WHERE user_id = :user_id + + + \ No newline at end of file Index: openacs-4/packages/dotfolio/www/admin/user-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-edit.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,31 @@ +<% +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# +%> + + +#dotfolio.edit_user# +@context_bar@ + +#dotfolio.youve_chosen_to_edit# @first_names@ @last_name@. + +
    +
  • Current user type is: @pretty_type@
  • +
+ +

+ + Index: openacs-4/packages/dotfolio/www/admin/user-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-edit.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,68 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + + Displays admin page for editing a dotFOLIO user's properties. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: user-edit.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ + +} -query { + user_id + {referer "[dotfolio::get_admin_url]/users"} +} -properties { + context_bar:onevalue +} + +#Pages in this directory are only runnable by dotfolio-wide admins. +dotfolio::require_admin + +db_1row select_user_info {} + +set options [dotfolio::get_user_types_as_options -ignore_guest "true"] + +ad_form -name edit_user -export {referer user_id} -form { + + # Use the user's username for their dotfolio id. + {id:text(hidden) + {value $username} + } + + {type:text(select) + {label "[_ dotfolio.user_type]"} + {options $options} + } + +} -on_submit { + + db_transaction { + # remove the user + dotfolio::user_remove -user_id $user_id + + # add the user + dotfolio::user_add -id $id -type $type -user_id $user_id + } + +} -after_submit { + ad_returnredirect $referer + ad_script_abort +} + +set context_bar [list [list users [_ dotfolio.users]] [_ dotfolio.edit]] + +ad_return_template Index: openacs-4/packages/dotfolio/www/admin/user-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user-postgresql.xql 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,43 @@ + + + + + + + SELECT first_names, + last_name, + email, + screen_name, + creation_date as registration_date, + creation_ip, + last_visit, + member_state, + email_verified_p + FROM cc_users + WHERE user_id = :user_id + + + + + + SELECT * FROM dotfolio_users + WHERE dotfolio_users.user_id = :user_id + + + + + + SELECT cr_items.live_revision as revision_id, + coalesce(cr_revisions.title, 'view this portrait') + as portrait_title + FROM acs_rels, + cr_items, + cr_revisions + WHERE acs_rels.object_id_two = cr_items.item_id + AND cr_items.live_revision = cr_revisions.revision_id + AND acs_rels.object_id_one = :user_id + AND acs_rels.rel_type = 'user_portrait_rel' + + + + Index: openacs-4/packages/dotfolio/www/admin/user.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,139 @@ +<% +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# +%> + + +@first_names@ @last_name@ +@context_bar@ + +

#dotfolio.general_information#

+ +
    + +
  • + #dotfolio.name# + @first_names@ @last_name@ + + [ #dotfolio.edit# ] + +
  • + +
  • + #dotfolio.Username#: + @username@ +
  • + +
  • + #dotfolio.email# + @email@ + + [ #dotfolio.edit# ] + +
  • + +
  • + #dotfolio.screen_name#: + @screen_name;noquote@ + + [ #dotfolio.edit# ] + +
  • + +
  • + #dotfolio.user_id_1#: + @user_id@ +
  • + +
  • + #dotfolio.registration_date#: + @registration_date@ +
  • + + +
  • + #dotfolio.last_visit#: + @last_visit@ +
  • +
    + +
  • + #dotfolio.not_visited#: @remove_user_url;noquote@ +
  • +
    + + +
  • + #dotfolio.portrait#: @portrait_title@ +
  • +
    + +
  • + #dotfolio.member_state# + @member_state@ + + @change_state_links;noquote@ + +
  • + +
+ +<% +# Modify +%> + +

#dotfolio.dotfolio_info#

+ + + +
    + +
  • + #dotfolio.user_type#: + <%= [lang::util::localize @pretty_type@] %> + [ #dotfolio.edit# ] +
  • + +
  • + #dotfolio.id_1#: + #dotfolio.ltnone_set_upgt#@id@ +
  • + +
+ +
+ +

+ + #dotfolio.add_to_dotfolio# + + +#dotfolio.user_is_current#. + +

+
+ +

#dotfolio.administrative_actions#

+ + Index: openacs-4/packages/dotfolio/www/admin/user.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/user.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/user.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,90 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + One user view by a dotFOLIO admin. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-01 + @version $Id: user.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ +} { + user_id:integer,notnull +} -properties { + context_bar:onevalue + return_url:onevalue + export_edit_vars:onevalue + first_names:onevalue + last_name:onevalue + email:onevalue + screen_name:onevalue + last_visit:onevalue + user_id:onevalue +} + +#Pages in this directory are only runnable by dotfolio-wide admins. +dotfolio::require_admin + +set oacs_site_wide_admin_p [acs_user::site_wide_admin_p] + +set return_url "[ad_parameter -package_id [ad_acs_kernel_id] CommunityMemberAdminURL]?user_id=$user_id" +set export_edit_vars "user_id=$user_id&return_url=$return_url" + +set dotfolio_url [dotfolio::get_url] +set root_object_id [acs_magic_object security_context_root] +if {![db_0or1row select_user_info {}]} { + ad_return_complaint 1 "
  • [_ dotfolio.couldnt_find_user_id [list user_id $user_id]]
  • " + ad_script_abort +} +if {[empty_string_p $screen_name]} { + set screen_name "<[_ dotfolio.none_set_up]>" +} +set registration_date [lc_time_fmt $registration_date "%q"] +if {![empty_string_p $last_visit]} { + set last_visit [lc_time_fmt $last_visit "%q"] +} + +set dotfolio_package_id [dotfolio::get_package_id] +set dotfolio_user_p 0 +if {[db_0or1row select_dotfolio_user_info {}]} { + set dotfolio_user_p 1 +} + +set portrait_p 0 +if {[ad_parameter "show_portrait_p" dotfolio] && [db_0or1row select_portrait_info {}]} { + set portrait_p 1 +} + +set change_state_links "\[[join [ad_registration_finite_state_machine_admin_links $member_state $email_verified_p $user_id $return_url] " | "]\]" + +set site_wide_admin_p [permission::permission_p \ + -party_id $user_id \ + -object_id [acs_magic_object "security_context_root"] \ + -privilege admin \ + ] + +set dotfolio_admin_p [dotfolio::admin_p] + +set context_bar [list [list users [_ dotfolio.users]] "$first_names $last_name"] + +set dual_approve_return_url [ns_urlencode [dotfolio::get_admin_url]/user-add-type?user_id=$user_id&referer=$return_url] + +set approve_user_url "/acs-admin/users/member-state-change?user_id=$user_id&member_state=approved&return_url=$dual_approve_return_url" + +set remove_user_url "\[[_ dotfolio.nuke]\]" + +set dual_approve_return_url [ns_urlencode [dotfolio::get_admin_url]/user-add-type?user_id=$user_id&referer=$return_url] + +ad_return_template Index: openacs-4/packages/dotfolio/www/admin/users-chunk-small-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users-chunk-small-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/users-chunk-small-postgresql.xql 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,24 @@ + + + + postgresql7.1 + + + + SELECT dotfolio_users.user_id, + dotfolio_users.username, + dotfolio_users.first_names, + dotfolio_users.last_name, + dotfolio_users.email, + dotfolios.node_id, + site_node__url(dotfolios.node_id) as url, + dotfolio__has_p(dotfolio_users.user_id) as has_dotfolio_p, + acs_permission__permission_p(:root_object_id,dotfolio_users.user_id, 'admin') as site_wide_admin_p + FROM dotfolio_users LEFT OUTER JOIN dotfolios + ON dotfolio_users.user_id = dotfolios.owner_id + WHERE dotfolio_users.type = :type + ORDER BY dotfolio_users.last_name + + + + \ No newline at end of file Index: openacs-4/packages/dotfolio/www/admin/users-chunk-small.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users-chunk-small.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/users-chunk-small.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,19 @@ +<% +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# +%> + + \ No newline at end of file Index: openacs-4/packages/dotfolio/www/admin/users-chunk-small.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users-chunk-small.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/users-chunk-small.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,45 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + + Displays a small set of users. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-02 + @version $Id: users-chunk-small.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ + +} -query { +} -properties { + user_id:onevalue + users:multirow +} + +set user_id [ad_conn user_id] +set dotfolio_package_id [dotfolio::get_package_id] +set root_object_id [acs_magic_object security_context_root] + +if {![exists_and_not_null type]} { + set type admin +} + +if {![exists_and_not_null referer]} { + set referer "[dotfolio::get_admin_url]/users" +} + +db_multirow users select_dotfolio_users {} {} + +ad_return_template \ No newline at end of file Index: openacs-4/packages/dotfolio/www/admin/users-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users-chunk.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/users-chunk.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,82 @@ +<% +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# +%> + +<% +# TODO +# 1. Fix translations +# 2. Add Site-Wide Admin functionality. +%> + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    #dotfolio.user##dotfolio.Username##dotfolio.has_dotfolio_space##dotfolio.site_wide_admin#
    + @users.last_name@, @users.first_names@ (@users.email@) + @users.username@#dotfolio.yes##dotfolio.create# + + + #dotfolio.yes# | #dotfolio.no# + + + #dotfolio.yes# | #dotfolio.no# + + + #dotfolio.yes# +
    #dotfolio.no_users#
    +
    Index: openacs-4/packages/dotfolio/www/admin/users-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users-chunk.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/users-chunk.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,39 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2004-01-02 + @version $Id: users-chunk.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ +} -query { + {section ""} +} -properties { + user_id:onevalue +} + +set oacs_site_wide_admin_p [acs_user::site_wide_admin_p] +set user_id [ad_conn user_id] + +if {![exists_and_not_null referer]} { + set referer "[dotfolio::get_admin_url]/users" +} + +set guest_p "false" +if { [string equal $type "guest"] } { + set guest_p "true" +} + +ad_return_template Index: openacs-4/packages/dotfolio/www/admin/users.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/users.adp 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,35 @@ +<% +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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. +# +%> + + +#dotfolio.users# +@context_bar;noquote@ + +[ + #dotfolio.create_a_new_user# + | + #dotfolio.search_users# + | + #dotfolio.bulk_upload# +] + +

    + +

    @control_bar;noquote@

    + + Index: openacs-4/packages/dotfolio/www/admin/users.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/users.tcl 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,52 @@ +# +# Copyright (C) 2001, 2002 WEG +# +# This file is part of dotFOLIO. +# +# dotFOLIO 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. +# +# dotFOLIO 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 { + + Displays the admin users page. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-02 + @version $Id: users.tcl,v 1.1 2005/05/05 08:51:32 ncarroll Exp $ + +} -query { + {type "admin"} +} -properties { + context_bar:onevalue + control_bar:onevalue + referer:onevalue +} + +#Pages in this directory are only runnable by dotfolio-wide admins. +dotfolio::require_admin + +set context_bar [_ dotfolio.users] +set referer "[dotfolio::get_admin_url]/users" + +set dotfolio_roles [db_list_of_lists select_dotfolio_roles {}] + +# The roles are stored as message keys in the database so we +# need to localize them on the fly here +set dotfolio_roles_localized [list] +foreach role_pair $dotfolio_roles { + lappend dotfolio_roles_localized [list [lindex $role_pair 0] \ + [lang::util::localize [lindex $role_pair 1]]] +} + +set control_bar [ad_dimensional [list \ + [list type "[_ dotfolio.user_type]:" $type $dotfolio_roles_localized]]] + +ad_return_template \ No newline at end of file Index: openacs-4/packages/dotfolio/www/admin/users.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/users.xql 5 May 2005 08:51:32 -0000 1.1 @@ -0,0 +1,17 @@ + + + + + + + SELECT dotfolio_user_types.type, + dotfolio_user_types.pretty_name || ' (' || + (SELECT count(*) FROM dotfolio_users + WHERE dotfolio_users.type = dotfolio_user_types.type) || + ')', '' + FROM dotfolio_user_types + ORDER BY dotfolio_user_types.pretty_name + + + +