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 -r1.4 -r1.5 --- openacs-4/packages/dotfolio/catalog/dotfolio.en_US.ISO-8859-1.xml 15 May 2005 02:36:43 -0000 1.4 +++ openacs-4/packages/dotfolio/catalog/dotfolio.en_US.ISO-8859-1.xml 19 May 2005 15:19:32 -0000 1.5 @@ -7,12 +7,16 @@ Groups {Group Members} Group Members + No members have been added to this group. Delete Select adviser... Create Group Create Adviser Group Name No groups have been created. + Group Members (Admin) + Members of group: %group_name% + Non-members that can be added to group: %group_name% Nuke You have been added as a user to %system_name% at %system_url% Enter a valid username. The username will be used to create the dotfolio space. @@ -70,6 +74,7 @@ Adviser Guest Owner + Role Type User Site-Wide Admin User Type 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 -r1.1 -r1.2 --- openacs-4/packages/dotfolio/tcl/dotfolio-procs-postgresql.xql 5 May 2005 08:51:31 -0000 1.1 +++ openacs-4/packages/dotfolio/tcl/dotfolio-procs-postgresql.xql 19 May 2005 15:19:32 -0000 1.2 @@ -32,4 +32,9 @@ + + + SELECT dotfolio__has_p(:user_id) AS has_dotfolio_p + + 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 -r1.1 -r1.2 --- openacs-4/packages/dotfolio/tcl/dotfolio-procs.tcl 5 May 2005 08:51:31 -0000 1.1 +++ openacs-4/packages/dotfolio/tcl/dotfolio-procs.tcl 19 May 2005 15:19:32 -0000 1.2 @@ -212,4 +212,15 @@ return "dotfolio_${type}_profile_rel" } + ad_proc has_dotfolio_p { + -user_id + } { + Returns 1 if the specified user has a dotfolio. + Otherwise returns 0. + + @param user_id A user's user_id. + } { + return [db_string has_dotfolio {} -default 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 -r1.2 -r1.3 --- openacs-4/packages/dotfolio/tcl/dotfolio-users-procs-postgresql.xql 14 May 2005 14:27:44 -0000 1.2 +++ openacs-4/packages/dotfolio/tcl/dotfolio-users-procs-postgresql.xql 19 May 2005 15:19:32 -0000 1.3 @@ -32,4 +32,20 @@ + + + SELECT adviser_id FROM dotfolio_group_adviser_map + WHERE adviser_id = :user_id GROUP BY adviser_id + + + + + + SELECT site_node__url(d.node_id) AS url + FROM dotfolio_users du LEFT OUTER JOIN dotfolios d + ON du.user_id = d.owner_id + WHERE du.type = 'owner' AND du.user_id = :user_id + + + 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 -r1.2 -r1.3 --- openacs-4/packages/dotfolio/tcl/dotfolio-users-procs.tcl 14 May 2005 14:27:44 -0000 1.2 +++ openacs-4/packages/dotfolio/tcl/dotfolio-users-procs.tcl 19 May 2005 15:19:32 -0000 1.3 @@ -123,4 +123,26 @@ return $list_of_advisers } + ad_proc adviser_p { + user_id + } { + Returns 1 if the specified user_id is an adviser. + Otherwise returns 0. + + @param user_id A user's user_id. + } { + return [db_0or1row adviser_p {}] + } + + ad_proc dotfolio_url { + -user_id + } { + Returns the url of the user's dotfolio. + + @param user_id A user's user_id. + @return Returns the url of the user's dotfolio + } { + return [db_string dotfolio_url {} -default ""] + } + } 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 -r1.1 -r1.2 --- openacs-4/packages/dotfolio/www/index-postgresql.xql 5 May 2005 08:51:31 -0000 1.1 +++ openacs-4/packages/dotfolio/www/index-postgresql.xql 19 May 2005 15:19:32 -0000 1.2 @@ -17,6 +17,9 @@ FROM dotfolio_users du LEFT OUTER JOIN dotfolios d ON du.user_id = d.owner_id WHERE du.type = 'owner' + AND du.user_id IN (SELECT member_id FROM group_member_map g, + dotfolio_group_adviser_map m + WHERE m.adviser_id = :user_id and m.group_id = g.group_id) [template::list::orderby_clause -orderby -name "portfolios"] Index: openacs-4/packages/dotfolio/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotfolio/www/index.tcl 5 May 2005 08:51:31 -0000 1.1 +++ openacs-4/packages/dotfolio/www/index.tcl 19 May 2005 15:19:32 -0000 1.2 @@ -22,6 +22,23 @@ set root_object_id [acs_magic_object security_context_root] +set adviser_p [dotfolio::user::adviser_p $user_id] +ns_log Warning "NC: adviser_p $adviser_p" + +# If user is not adviser then do some redirection. +if {!$adviser_p} { + + # If user has a dotfolio, then redirect to the location of the dotfolio. + # Otherwise redirect user back to index with message. + if {[dotfolio::has_dotfolio_p -user_id $user_id]} { + ad_returnredirect [dotfolio::user::dotfolio_url -user_id $user_id] + } else { + # TODO - user must be guest so display dotfolios that + # guest has access to. + ad_returnredirect -message "You do not have the permissions to access dotfolio." index + } +} + set elements { name { label {\#dotfolio.name\#} Index: openacs-4/packages/dotfolio/www/admin/group-members-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/group-members-add.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/group-members-add.tcl 19 May 2005 15:19:32 -0000 1.1 @@ -0,0 +1,21 @@ +ad_page_contract { + + Adds the given list of users to the specified group. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-02 + @version $Id: group-members-add.tcl,v 1.1 2005/05/19 15:19:32 ncarroll Exp $ + +} { + group_id:integer,notnull + user_id:integer,multiple +} + +set count 0 +# For each member in the list of user IDs, add that user to the group. +foreach user $user_id { + group::add_member -group_id $group_id -user_id $user + incr count +} + +ad_returnredirect -message "Added $count users to group" [export_vars -url -base {group-members} {group_id}] Index: openacs-4/packages/dotfolio/www/admin/group-members-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/group-members-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/group-members-postgresql.xql 19 May 2005 15:19:32 -0000 1.1 @@ -0,0 +1,36 @@ + + + + postgresql7.4 + + + + SELECT group_name + FROM groups + WHERE group_id = :group_id + + + + + + SELECT d.last_name || ', ' || d.first_names AS name, + pretty_type, d.user_id + FROM dotfolio_users d, group_member_map g + WHERE g.group_id = :group_id AND g.member_id = d.user_id + ORDER BY name ASC + + + + + + SELECT d.last_name || ', ' || d.first_names AS name, + pretty_type, d.user_id + FROM dotfolio_users d LEFT OUTER JOIN group_member_map g + ON g.member_id = d.user_id + WHERE g.member_id NOT IN (SELECT member_id + FROM group_member_map WHERE group_id = :group_id) + GROUP BY d.user_id, d.last_name, d.first_names, pretty_type + + + + Index: openacs-4/packages/dotfolio/www/admin/group-members-rem.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/group-members-rem.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/group-members-rem.tcl 19 May 2005 15:19:32 -0000 1.1 @@ -0,0 +1,21 @@ +ad_page_contract { + + Removes the given list of users to the specified group. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-02 + @version $Id: group-members-rem.tcl,v 1.1 2005/05/19 15:19:32 ncarroll Exp $ + +} { + group_id:integer,notnull + user_id:integer,multiple +} + +set count 0 +# For each member in the list of user IDs, add that user to the group. +foreach user $user_id { + group::remove_member -group_id $group_id -user_id $user + incr count +} + +ad_returnredirect -message "Removed $count users from group" [export_vars -url -base {group-members} {group_id}] Index: openacs-4/packages/dotfolio/www/admin/group-members.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/group-members.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/group-members.adp 19 May 2005 15:19:32 -0000 1.1 @@ -0,0 +1,33 @@ +<% +# +# 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. +# +%> + + +#dotfolio.group_members_admin# +@context_bar;noquote@ + +#dotfolio.members_of_group# +
+ +
+
+

+#dotfolio.non_members_that_can_be_added# + +

+ +
Index: openacs-4/packages/dotfolio/www/admin/group-members.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/group-members.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/admin/group-members.tcl 19 May 2005 15:19:32 -0000 1.1 @@ -0,0 +1,63 @@ +ad_page_contract { + + Displays members for a given group ID. + + @author Nick Carroll (ncarroll@ee.usyd.edu.au) + @creation-date 2005-01-02 + @version $Id: group-members.tcl,v 1.1 2005/05/19 15:19:32 ncarroll Exp $ + +} { + group_id:integer,notnull +} -properties { + context_bar:onevalue +} + +set context_bar "[_ dotfolio.group_members_curly]" + +set group_name [db_string group_name {} -default ""] + +db_multirow group_members group_members {} + +template::list::create \ + -name group_members \ + -multirow group_members \ + -key user_id \ + -bulk_actions { + "Remove" "group-members-rem" "Remove user from group" + } \ + -bulk_action_method post -bulk_action_export_vars { + user_id group_id + } \ + -no_data {#dotfolio.no_members_added_to_group#} \ + -elements { + name { + label #dotfolio.name# + } + pretty_type { + label #dotfolio.role_type# + } + } + +db_multirow non_group_members non_group_members {} + +template::list::create \ + -name non_group_members \ + -multirow non_group_members \ + -key user_id \ + -bulk_actions { + "Add" "group-members-add" "Add user to group" + } \ + -bulk_action_method post -bulk_action_export_vars { + user_id group_id + } \ + -no_data {#dotfolio.no_members_added_to_group#} \ + -elements { + name { + label #dotfolio.name# + } + pretty_type { + label #dotfolio.role_type# + } + } + +ad_return_template Index: openacs-4/packages/dotfolio/www/admin/groups.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/groups.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotfolio/www/admin/groups.tcl 14 May 2005 14:27:44 -0000 1.1 +++ openacs-4/packages/dotfolio/www/admin/groups.tcl 19 May 2005 15:19:32 -0000 1.2 @@ -25,7 +25,10 @@ group_name { label "#dotfolio.group_name#" display_template { - @groups.group_name;noquote@ + + @groups.group_name;noquote@ + + @groups.group_name;noquote@ } } adviser {