Index: openacs-4/packages/dotfolio/dotfolio.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/dotfolio.info,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotfolio/dotfolio.info 21 May 2006 03:17:55 -0000 1.5 +++ openacs-4/packages/dotfolio/dotfolio.info 5 May 2007 17:22:58 -0000 1.6 @@ -8,21 +8,21 @@ f dotfolio - + Nick Carroll dotFOLIO is an ePortfolio application. WEG dotFOLIO is used to administer ePortfolio spaces mounted as subsites. 0 - - + + - - + + - + @@ -31,7 +31,10 @@ + + + Index: openacs-4/packages/dotfolio/lib/install.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotfolio/lib/install.xml,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotfolio/lib/install.xml 3 Jun 2005 06:49:05 -0000 1.2 +++ openacs-4/packages/dotfolio/lib/install.xml 5 May 2007 17:22:58 -0000 1.3 @@ -10,12 +10,12 @@ " - + - + - + 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 -r1.4 -r1.5 --- openacs-4/packages/dotfolio/tcl/dotfolio-apm-callback-procs.tcl 2 Aug 2005 01:54:52 -0000 1.4 +++ openacs-4/packages/dotfolio/tcl/dotfolio-apm-callback-procs.tcl 5 May 2007 17:22:59 -0000 1.5 @@ -29,3 +29,15 @@ } } + +ad_proc -public -callback dotfolio::create_dotfolio { +} { + -blog_id + -base_url +} { + Callback to execute actions on the mounted dotfolio after the regular operations have already happend + + @param blog_id Blog ID of the Weblog instantiated + @param base_url URL where the dotfolio is based +} - + 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.3 -r1.4 --- openacs-4/packages/dotfolio/tcl/dotfolio-procs-postgresql.xql 2 Aug 2005 01:54:52 -0000 1.3 +++ openacs-4/packages/dotfolio/tcl/dotfolio-procs-postgresql.xql 5 May 2007 17:22:59 -0000 1.4 @@ -18,13 +18,6 @@ - - - UPDATE cr_items SET live_revision=latest_revision - WHERE item_id=:welcome_content_id - - - SELECT first_names, last_name FROM dotfolio_users 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.6 -r1.7 --- openacs-4/packages/dotfolio/tcl/dotfolio-procs.tcl 2 Aug 2005 01:54:52 -0000 1.6 +++ openacs-4/packages/dotfolio/tcl/dotfolio-procs.tcl 5 May 2007 17:22:59 -0000 1.7 @@ -62,6 +62,7 @@ ad_proc -public create_dotfolio_for_user { {-username:required} + {-owner_id ""} } { Creates a dotfolio space for the a user with the specified username. @@ -89,15 +90,19 @@ # set the mount location for dotfolio-ui set organise_url "$base_url/organise" + set dotfolio_xml [parameter::get -parameter DotfolioXML -package_id [package_id_from_key dotfolio]] set out [apm::process_install_xml \ - /packages/dotfolio/lib/install.xml \ + $dotfolio_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] + if {$owner_id eq ""} { + 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) @@ -125,10 +130,9 @@ -parent_id $folder_id \ -title "$first_names $last_name" \ -text [_ dotfolio.default_welcome_note] \ - -storage_type "text"] + -storage_type "text" \ + -is_live] - 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] @@ -158,12 +162,17 @@ # 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" + # If the package_key is not file storage, the file storage + # was not mounted, which might be due to not using it in install.xml + if {$files_node_info(package_key) eq "file-storage"} { + 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] @@ -174,6 +183,7 @@ permission::grant -party_id $owner_id -object_id $organise_id \ -privilege "admin" + callback dotfolio::create_dotfolio -base_url $base_url db_exec_plsql create_dotfolio {} # Set success flag to 1 to reflect successful creation of 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 -r1.2 -r1.3 --- openacs-4/packages/dotfolio/tcl/dotfolio-security-procs-postgresql.xql 5 Jun 2005 12:28:37 -0000 1.2 +++ openacs-4/packages/dotfolio/tcl/dotfolio-security-procs-postgresql.xql 5 May 2007 17:22:59 -0000 1.3 @@ -13,6 +13,15 @@ + + + + SELECT 1 + FROM dotfolios + WHERE owner_id = :user_id + + + SELECT pretty_name, type @@ -30,4 +39,4 @@ - \ 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 -r1.5 -r1.6 --- openacs-4/packages/dotfolio/tcl/dotfolio-security-procs.tcl 2 Aug 2005 01:54:52 -0000 1.5 +++ openacs-4/packages/dotfolio/tcl/dotfolio-security-procs.tcl 5 May 2007 17:22:59 -0000 1.6 @@ -58,6 +58,14 @@ return [db_string select_count {}] } + ad_proc -public dotfolio_p { + {-user_id:required} + } { + Check if a user has a dotfolio created + } { + return [db_string dotfolio_count {} -default 0] + } + ad_proc -public get_user_types_as_options { {-ignore_guest "false"} } { @@ -83,4 +91,4 @@ return $localized_list } -} \ No newline at end of file +} 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.7 -r1.8 --- openacs-4/packages/dotfolio/tcl/dotfolio-users-procs-postgresql.xql 2 Aug 2005 01:54:52 -0000 1.7 +++ openacs-4/packages/dotfolio/tcl/dotfolio-users-procs-postgresql.xql 5 May 2007 17:22:59 -0000 1.8 @@ -21,6 +21,7 @@ WHERE a.object_id_two = c.item_id AND a.object_id_one = :owner_id AND a.rel_type = 'user_portrait_rel' + order by item_id desc limit 1 @@ -40,10 +41,9 @@ - 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.user_id = :user_id + SELECT node_id + FROM dotfolios d + WHERE owner_id = :user_id @@ -61,7 +61,7 @@ - + SELECT type FROM dotfolio_users 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.9 -r1.10 --- openacs-4/packages/dotfolio/tcl/dotfolio-users-procs.tcl 5 Oct 2005 03:38:19 -0000 1.9 +++ openacs-4/packages/dotfolio/tcl/dotfolio-users-procs.tcl 5 May 2007 17:22:59 -0000 1.10 @@ -142,7 +142,7 @@ @param user_id A user's user_id. @return Returns the url of the user's dotfolio } { - return [db_string dotfolio_url {} -default ""] + return [site_node::get_url -node_id [db_string dotfolio_url {} -default ""]] } ad_proc get_user_id_from_username { @@ -204,6 +204,8 @@ return $rel_id } + + ad_proc -public get_user_type { {-user_id:required} } { @@ -212,6 +214,17 @@ @param user_id The ID for a specific user. @return Returns the user type for the specified user. } { + return [util_memoize [list dotfolio::user::get_user_type_not_cached -user_id $user_id]] + } + + ad_proc -public get_user_type_not_cached { + {-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 ""] }