Index: openacs-4/packages/dotfolio/dotfolio.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/dotfolio.info,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/dotfolio/dotfolio.info 23 Jun 2005 01:38:48 -0000 1.3 +++ openacs-4/packages/dotfolio/dotfolio.info 2 Aug 2005 01:54:51 -0000 1.4 @@ -7,32 +7,31 @@ f f dotfolio - - + + Nick Carroll dotFOLIO is an ePortfolio application. WEG dotFOLIO is used to administer ePortfolio spaces mounted as subsites. + 0 - - - + - - + + + + + - - - + - + - - - - + + + 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 -N -r1.6 -r1.7 --- openacs-4/packages/dotfolio/catalog/dotfolio.en_US.ISO-8859-1.xml 27 May 2005 05:01:19 -0000 1.6 +++ openacs-4/packages/dotfolio/catalog/dotfolio.en_US.ISO-8859-1.xml 2 Aug 2005 01:54:51 -0000 1.7 @@ -9,20 +9,27 @@ Group Members No members have been added to this group. Delete + Directory Select adviser... Create Group Create Adviser Group Name + Directory listing of e-Portfolio owners No groups have been created. Group Members (Admin) Members of group: %group_name% Creating dotFOLIO site for Non-members that can be added to group: %group_name% Nuke You have been added as a user to %system_name% at %system_url% - You have been added as a user to %system_name% at %system_url%. - Login: %user_email% - Password: %user_password% + An account has been created for you on %system_name% at %system_url%. + +You may use your MyUni Key to login to %system_name%. + +OR if you don't have a MyUni Key, you may login with the following login details: + +Login: %user_username% +Password: %user_password% 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% @@ -63,6 +70,7 @@ Become this user Update Password Confirm + Manage user's portrait 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. @@ -125,21 +133,22 @@ %first_names% %last_name%, -You have been added as a user to %system_name% -at %system_url% +An account has been created for you on %system_name% at %system_url% -Login information: -Email %email% -Password: %password% +You may use your MyUni Key to login to %system_name%. -(you may change your password after you log in) +OR if you don't have a MyUni Key, you may login with the following login details: +Username: %username% +Password: %password% + 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 + There are no portfolios for this section. {Welcome to %first_names% %last_name%'s portfolio!} text/enhanced No. of Blog Entries 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 -N -r1.2 -r1.3 --- openacs-4/packages/dotfolio/tcl/dotfolio-procs-postgresql.xql 19 May 2005 15:19:32 -0000 1.2 +++ openacs-4/packages/dotfolio/tcl/dotfolio-procs-postgresql.xql 2 Aug 2005 01:54:52 -0000 1.3 @@ -36,5 +36,20 @@ SELECT dotfolio__has_p(:user_id) AS has_dotfolio_p - + + + + + SELECT group_id FROM dotfolio_user_types WHERE type = :user_type + + + + + + SELECT t.pretty_name FROM acs_object_types t, acs_objects o + WHERE o.object_id = :object_id + AND t.object_type = o.object_type + + + 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 -N -r1.5 -r1.6 --- openacs-4/packages/dotfolio/tcl/dotfolio-procs.tcl 23 Jun 2005 01:38:49 -0000 1.5 +++ openacs-4/packages/dotfolio/tcl/dotfolio-procs.tcl 2 Aug 2005 01:54:52 -0000 1.6 @@ -48,6 +48,18 @@ return [util_memoize [list dotfolio::packages_no_mem -node_id $subsite_node_id] 1200] } + ad_proc -private group_id_from_user_type { + {-user_type:required} + } { + Retrieves the group_id for the specific user_type. user_type can + be one of the following: admin, adviser, owner, or guest. + + @param user_type The user_type that we would like the group_id for. + @return Returns the group_id for the specified user_type. + } { + return [db_string get_group_id {} -default ""] + } + ad_proc -public create_dotfolio_for_user { {-username:required} } { @@ -134,14 +146,34 @@ permission::grant -party_id $owner_id -object_id $blog_id \ -privilege "admin" + set adviser_group_id [group_id_from_user_type -user_type "adviser"] + + # Grant advisers permission to add comments to blog entries. + permission::grant -party_id $adviser_group_id -object_id $blog_id \ + -privilege "general_comments_create" + + # Revoke permission for unregistered visitors to comment. + permission::revoke -party_id 0 -object_id $blog_id \ + -privilege "general_comments_create" + # 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" - + + # Do not let organiser node inherit permisisons. Only the + # owner should have access to the organise tab. + set organise_node_id [site_node::get_node_id -url $organise_url] + array set organise_node_info \ + [site_node::get -node_id $organise_node_id] + set organise_id $organise_node_info(package_id) + permission::set_not_inherit -object_id $organise_id + permission::grant -party_id $owner_id -object_id $organise_id \ + -privilege "admin" + db_exec_plsql create_dotfolio {} # Set success flag to 1 to reflect successful creation of @@ -220,12 +252,142 @@ ad_proc has_dotfolio_p { -user_id } { - Returns 1 if the specified user has a dotfolio. - Otherwise returns 0. + Returns t if the specified user has a dotfolio. + Otherwise returns f. @param user_id A user's user_id. } { - return [db_string has_dotfolio {} -default 0] + return [db_string has_dotfolio {} -default f] } + ad_proc object_type_pretty_name { + -object_id + } { + Returns the object type pretty name for the specified object. + + @param object_id The ID for a specific object. + } { + return [db_string pretty_name {} -default ""] + } + + ad_proc dimensional { + {-no_header:boolean} + {-no_bars:boolean} + {-link_all 0} + {-names_in_cells_p 1} + {-th_bgcolor ""} + {-td_align "center"} + {-extra_td_html ""} + {-table_html_args "border=0 cellspacing=0 cellpadding=3 width=100%"} + {-class_html ""} + {-pre_html ""} + {-post_html ""} + {-extra_td_selected_p 0} + option_list + {url {}} + {options_set ""} + {optionstype url} + } { + An enhanced ad_dimensional. see that proc for usage details. This proc + was taken from new-portal. + } { + if {[empty_string_p $option_list]} { + return + } + + if {[empty_string_p $options_set]} { + set options_set [ns_getform] + } + + if {[empty_string_p $url]} { + set url [ad_conn url] + } + + set html "\n\n" + + if {!$no_header_p} { + foreach option $option_list { + append html "\n" + } + } + + append html " \n" + + foreach option $option_list { + + if {!$no_bars_p} { + append html "\[" + } + + + if { $names_in_cells_p } { + set pre_td_html "" + set end_html "" + set break_html "" + set post_selected_html "$post_html" + } else { + append html " \n$end_html
[lindex $option 1]
" + set pre_selected_td_html "" + set post_html "$post_html" + set td_html "" + set pre_selected_td_html "" + set post_selected_html "$post_html" + set end_html "" + set td_html "" + post_html "$post_html" + if {!$no_bars_p} { + set break_html " | " + } else { + append break_html "   " + } + } + + # find out what the current option value is. + # check if a default is set otherwise the first value is used + set option_key [lindex $option 0] + set option_val [lindex $option 2] + if {![empty_string_p $options_set]} { + set options_set_val [ns_set get $options_set $option_key] + if { ![empty_string_p $options_set_val] } { + set option_val $options_set_val + } + } + + set first_p 1 + foreach option_value [lindex $option 3] { + set thisoption_name [lindex $option_value 0] + # We allow portal page names to have embedded message catalog keys + # that we localize on the fly + set thisoption_value [ad_quotehtml [lang::util::localize [lindex $option_value 1]]] + set thisoption_link_p 1 + if {[llength $option_value] > 3} { + set thisoption_link_p [lindex $option_value 3] + } + + if {$first_p} { + set first_p 0 + } else { + append html $break_html + } + + if {([string equal $option_val $thisoption_name] == 1 && !$link_all) || !$thisoption_link_p} { + append html "${pre_selected_td_html}${pre_html}${thisoption_value}${post_selected_html}\n" + } else { + append html "${pre_td_html}${pre_html}${thisoption_value}${post_html}\n" + } + } + + if {!$no_bars_p} { + append html "\]" + } + if {$extra_td_selected_p} { + append html "${pre_selected_td_html}${pre_html}$extra_td_html${post_html}\n" + } else { + append html "${pre_td_html}$extra_td_html${post_html}\n" + } + } + + append html "
\n" + } + } Index: openacs-4/packages/dotfolio/tcl/dotfolio-ui-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/tcl/dotfolio-ui-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/tcl/dotfolio-ui-procs-postgresql.xql 2 Aug 2005 01:54:52 -0000 1.1 @@ -0,0 +1,11 @@ + + + postgresql7.4 + + + + SELECT creation_user FROM acs_objects WHERE object_id = :rel_id + + + + 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 -N -r1.2 -r1.3 --- openacs-4/packages/dotfolio/tcl/dotfolio-ui-procs.tcl 23 Jun 2005 01:38:49 -0000 1.2 +++ openacs-4/packages/dotfolio/tcl/dotfolio-ui-procs.tcl 2 Aug 2005 01:54:52 -0000 1.3 @@ -8,14 +8,30 @@ namespace eval dotfolio::ui { + ad_proc -private users_organiser_url { + {-user_id:required} + } { + Returns the organise url for the specified user. Assumes that the + specified user has a dotfolio site. + + @param user_id The ID for a specific user. + @return Returns the organiser url for the specified user. + } { + set dotfolio_url [dotfolio::user::dotfolio_url -user_id $user_id] + append dotfolio_url "organise/" + + return $dotfolio_url + } + ad_proc -public organiser_url { {-node_id {}} } { - Returns the cop-ui URL for a given subsite. + Returns the organise URL for a given dotfolio site. - @param subsite_id the subsite for which to find the cop-ui url + @param node_id The dotfolio site for which to find the organise url. - @return a url for the dotfolio-ui package + @return Returns the url for the organise tab in 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] @@ -24,4 +40,23 @@ return [lindex [site_node::get_children -node_id $node_id -package_key dotfolio-ui -all] 0] } + ad_proc -private created_rel_p { + {-user_id:required} + {-rel_id:required} + } { + Checks if the user associated with the user_id created the relation + associated with the rel_id. + + @param user_id ID for a specific user. + @param rel_id ID for a relation. + + @return Returns 1 if the user created the relation, otherwise 0. + } { + set creation_user_id [db_string creation_user {} -default ""] + + if { [string equal $user_id $creation_user_id] } { + return 1 + } + return 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 -N -r1.6 -r1.7 --- openacs-4/packages/dotfolio/tcl/dotfolio-users-procs-postgresql.xql 5 Jun 2005 12:28:37 -0000 1.6 +++ openacs-4/packages/dotfolio/tcl/dotfolio-users-procs-postgresql.xql 2 Aug 2005 01:54:52 -0000 1.7 @@ -43,7 +43,7 @@ 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 + WHERE du.user_id = :user_id @@ -61,4 +61,11 @@ + + + SELECT type + FROM dotfolio_users + WHERE 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 -N -r1.7 -r1.8 --- openacs-4/packages/dotfolio/tcl/dotfolio-users-procs.tcl 23 Jun 2005 01:38:49 -0000 1.7 +++ openacs-4/packages/dotfolio/tcl/dotfolio-users-procs.tcl 2 Aug 2005 01:54:52 -0000 1.8 @@ -204,4 +204,72 @@ return $rel_id } + ad_proc -public get_user_type { + {-user_id:required} + } { + Returns the user type for the given user. + + @param user_id The ID for a specific user. + @return Returns the user type for the specified user. + } { + return [db_string user_type {} -default ""] + } + + ad_proc type_owner_p { + {-user_id:required} + } { + Checks if the specified user is of type "owner". + + @param user_id A user's user_id. + @return Returns 1 if the user is of type owner, otherwise 1 + is returned. + } { + set type [get_user_type -user_id $user_id] + + return [expr [string equal $type "owner"] ] + } + + ad_proc type_adviser_p { + {-user_id:required} + } { + Checks if the specified user is of type "adviser". + + @param user_id A user's user_id. + @return Returns 1 if the user is of type adviser, otherwise 1 + is returned. + } { + set type [get_user_type -user_id $user_id] + + return [expr [string equal $type "adviser"] ] + } + + ad_proc type_admin_p { + {-user_id:required} + } { + Checks if the specified user is of type "admin". Provides the same + result as admin_p, except that this proc is implemented differently. + + @param user_id A user's user_id. + @return Returns 1 if the user is of type admin, otherwise 1 + is returned. + } { + set type [get_user_type -user_id $user_id] + + return [expr [string equal $type "admin"] ] + } + + ad_proc type_guest_p { + {-user_id:required} + } { + Checks if the specified user is of type "guest". + + @param user_id A user's user_id. + @return Returns 1 if the user is of type guest, otherwise 1 + is returned. + } { + set type [get_user_type -user_id $user_id] + + return [expr [string equal $type "guest"] ] + } + } Index: openacs-4/packages/dotfolio/www/directory-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/directory-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/directory-postgresql.xql 2 Aug 2005 01:54:52 -0000 1.1 @@ -0,0 +1,41 @@ + + + + + + + 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 + FROM dotfolio_users du LEFT OUTER JOIN dotfolios d + ON du.user_id = d.owner_id + WHERE dotfolio__has_p(du.user_id) = 't' AND + upper(substr(du.last_name, 1, 1)) = :section + + + + + + 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 + FROM dotfolio_users du LEFT OUTER JOIN dotfolios d + ON du.user_id = d.owner_id + WHERE dotfolio__has_p(du.user_id) = 't' AND + upper(substr(du.last_name, 1, 1)) NOT IN ('[join $dimension_list "\', \'"]') + + + + + + 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 + FROM dotfolio_users du LEFT OUTER JOIN dotfolios d + ON du.user_id = d.owner_id + WHERE dotfolio__has_p(du.user_id) = 't' + ORDER BY lower(du.last_name) asc + + + + Index: openacs-4/packages/dotfolio/www/directory.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/directory.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/directory.adp 2 Aug 2005 01:54:52 -0000 1.1 @@ -0,0 +1,9 @@ + +@title@ +@context@ + +
@control_bar;noquote@
+

+

+ +
Index: openacs-4/packages/dotfolio/www/directory.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/directory.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotfolio/www/directory.tcl 2 Aug 2005 01:54:52 -0000 1.1 @@ -0,0 +1,48 @@ +ad_page_contract { + Directory page lists all portfolios in the system. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-07-18 + @cvs-id $Id: directory.tcl,v 1.1 2005/08/02 01:54:52 ncarroll Exp $ +} -query { + {section All} +} -properties { + control_bar:onevalue +} + +set title [_ dotfolio.directory] +set context [_ dotfolio.directory] + +set dimension_list {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} +foreach dimension $dimension_list { + lappend dimensions [list $dimension $dimension {}] +} +lappend dimensions [list Other Other {}] +lappend dimensions [list All All {}] + +set control_bar [dotfolio::dimensional -no_bars [list [list section {} $section $dimensions]]] + + +set elements { + name { + label {\#dotfolio.directory_listing_of_eportfolios\#} + link_url_col url + } +} + +template::list::create \ + -name portfolios \ + -elements $elements \ + -no_data "#dotfolio.no_portfolios_in_section#" + +set query "portfolios" + +if { [string match Other $section] } { + append query "_other" +} elseif { [string match All $section] } { + append query "_all" +} + +db_multirow portfolios $query {} {} + +ad_return_template Index: openacs-4/packages/dotfolio/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/index.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/dotfolio/www/index.tcl 23 Jun 2005 01:38:49 -0000 1.5 +++ openacs-4/packages/dotfolio/www/index.tcl 2 Aug 2005 01:54:52 -0000 1.6 @@ -22,10 +22,12 @@ set root_object_id [acs_magic_object security_context_root] -set adviser_p [dotfolio::user::adviser_p $user_id] +# Determine the type of dotfolio user. +set type_adviser_p [dotfolio::user::type_adviser_p -user_id $user_id] +set type_admin_p [dotfolio::user::type_admin_p -user_id $user_id] # If user is not adviser then do some redirection. -if {!$adviser_p} { +if {!$type_adviser_p && !$type_admin_p} { # If user has a dotfolio, then redirect to the location of the dotfolio. # Otherwise redirect user back to index with message. 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 -N -r1.2 -r1.3 --- openacs-4/packages/dotfolio/www/admin/group-members.tcl 23 Jun 2005 01:38:49 -0000 1.2 +++ openacs-4/packages/dotfolio/www/admin/group-members.tcl 2 Aug 2005 01:54:52 -0000 1.3 @@ -14,7 +14,7 @@ set context_bar "[_ dotfolio.group_members_curly]" -set group_name [db_string group_name {} -default ""] +set group_name [lang::util::localize [db_string group_name {} -default ""]] db_multirow group_members group_members {} 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 -N -r1.3 -r1.4 --- openacs-4/packages/dotfolio/www/admin/user-add-2.tcl 23 Jun 2005 01:38:49 -0000 1.3 +++ openacs-4/packages/dotfolio/www/admin/user-add-2.tcl 2 Aug 2005 01:54:52 -0000 1.4 @@ -38,6 +38,7 @@ id:onevalue password:onevalue administration_name:onevalue + username:onevalue } # Get user info @@ -49,7 +50,7 @@ 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 add_membership_p}]" +set redirect "user-add-2?[export_vars {user_id password referer type can_browse_p read_private_data_p add_membership_p username}]" # Don't redirect back to the user-add-type page if we've already been there if {!$dotfolio_user_p} { set redirect "${redirect}" Index: openacs-4/packages/dotfolio/www/admin/users-bulk-upload-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users-bulk-upload-2.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/dotfolio/www/admin/users-bulk-upload-2.tcl 23 Jun 2005 01:38:49 -0000 1.3 +++ openacs-4/packages/dotfolio/www/admin/users-bulk-upload-2.tcl 2 Aug 2005 01:54:52 -0000 1.4 @@ -112,7 +112,7 @@ set msg_subst_list [list system_name [ad_system_name] \ system_url [ad_parameter -package_id [ad_acs_kernel_id] SystemURL] \ - user_email $row(email) \ + user_username $row(username) \ user_password $password] set message [_ dotfolio.user_add_confirm_email_body \ $msg_subst_list] Index: openacs-4/packages/dotfolio/www/admin/users-bulk-upload.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/www/admin/users-bulk-upload.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/dotfolio/www/admin/users-bulk-upload.adp 23 Jun 2005 01:38:49 -0000 1.2 +++ openacs-4/packages/dotfolio/www/admin/users-bulk-upload.adp 2 Aug 2005 01:54:52 -0000 1.3 @@ -78,7 +78,7 @@
     first_names,last_name,email,username,password,type
-    Joe,Student,joe@_somewhere_.net,joestue,4jfe3,student
+    Joe,Student,joe@_somewhere_.net,joestue,4jfe3,owner
     Albert,Einstein,al@_school_.edu,al,,adviser
     Systems,Hacker,syshacker@_company_.com,syshackr,,guest