Index: openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl,v
diff -u -r1.81 -r1.82
--- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 8 Sep 2008 20:14:58 -0000 1.81
+++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 30 May 2009 20:42:11 -0000 1.82
@@ -953,8 +953,8 @@
# Update person.bio
if { [info exists user_info(bio)] } {
- person::update_bio \
- -person_id $user_id \
+ acs_user::update_bio \
+ -user_id $user_id \
-bio $user_info(bio)
}
} {
@@ -1067,8 +1067,8 @@
# Update person.bio
if { [info exists user_info(bio)] } {
- person::update_bio \
- -person_id $user_id \
+ acs_user::update_bio \
+ -user_id $user_id \
-bio $user_info(bio)
}
Index: openacs-4/packages/acs-kernel/acs-kernel.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/acs-kernel.info,v
diff -u -r1.104 -r1.105
--- openacs-4/packages/acs-kernel/acs-kernel.info 17 May 2009 15:57:28 -0000 1.104
+++ openacs-4/packages/acs-kernel/acs-kernel.info 30 May 2009 20:42:12 -0000 1.105
@@ -7,15 +7,15 @@
t
t
-
+
OpenACS Core Team
Routines and data models providing the foundation for OpenACS-based Web services.
2008-05-31
OpenACS
The OpenACS kernel contains the core datamodel create and drop scripts for such things as objects, groups, partiies and the supporting PL/SQL and PL/pgSQL procedures.
3
-
+
Index: openacs-4/packages/acs-kernel/sql/postgresql/community-core-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/community-core-create.sql,v
diff -u -r1.25 -r1.26
--- openacs-4/packages/acs-kernel/sql/postgresql/community-core-create.sql 7 Jun 2008 20:28:52 -0000 1.25
+++ openacs-4/packages/acs-kernel/sql/postgresql/community-core-create.sql 30 May 2009 20:42:12 -0000 1.26
@@ -495,6 +495,7 @@
screen_name varchar(100)
constraint users_screen_name_un
unique,
+ bio text,
priv_name integer default 0 not null,
priv_email integer default 5 not null,
email_verified_p boolean default 't',
Index: openacs-4/packages/acs-subsite/www/shared/community-member.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/community-member.tcl,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/acs-subsite/www/shared/community-member.tcl 6 Jan 2009 02:25:34 -0000 1.15
+++ openacs-4/packages/acs-subsite/www/shared/community-member.tcl 30 May 2009 20:42:12 -0000 1.16
@@ -69,7 +69,7 @@
set url "http://$url"
}
-set bio [ad_text_to_html -- [person::get_bio -person_id $user_id]]
+set bio [ad_text_to_html -- [acs_user::get_bio -user_id $user_id]]
# Do we show the portrait?
set inline_portrait_state "none"
Index: openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl,v
diff -u -r1.56 -r1.57
--- openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 22 Mar 2008 18:31:32 -0000 1.56
+++ openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 30 May 2009 20:42:12 -0000 1.57
@@ -250,77 +250,56 @@
name_flush -person_id $person_id
}
-ad_proc -public person::get_bio {
- {-person_id {}}
+# DRB: Though I've moved the bio field to type specific rather than generic storage, I've
+# maintained the API semantics exactly as they were before (other than changing person to user),
+# mostly in order to make upgrade possible. In the future, the number of database hits can
+# be diminished by getting rid of the seperate queries for bio stuff. However, I have removed
+# bio_mime_type because it's unused and unsupported in the existing code.
+
+ad_proc -public acs_user::get_bio {
+ {-user_id {}}
{-exists_var {}}
} {
Get the value of the user's bio(graphy) field.
- @option person_id The person_id of the person to get the bio for. Leave blank for currently logged in user.
+ @option user_id The user_id of the person to get the bio for. Leave blank for
+ currently logged in user.
@option exists_var The name of a variable in the caller's namespace, which will be set to 1
- if a bio was found, or 0 if no bio was found. Leave blank if you're not
+ if the bio column is not null. Leave blank if you're not
interested in this information.
@return The bio of the user as a text string.
@author Lars Pind (lars@collaboraid.biz)
} {
- if { $person_id eq "" } {
- set person_id [ad_conn user_id]
+ if { $user_id eq "" } {
+ set user_id [ad_conn user_id]
}
if { $exists_var ne "" } {
upvar $exists_var exists_p
}
- set exists_p [db_0or1row select_bio {}]
+ db_1row select_bio {}
- if { !$exists_p } {
- set bio {}
- }
+ set exists_p [expr {$bio ne ""}]
return $bio
}
-ad_proc -public person::update_bio {
- {-person_id:required}
+ad_proc -public acs_user::update_bio {
+ {-user_id:required}
{-bio:required}
} {
Update the bio for a person.
- @param person_id The ID of the person to edit bio for
+ @param user_id The ID of the person to edit bio for
@param bio The new bio for the person
@author Lars Pind (lars@collaboraid.biz)
} {
- # This will set exists_p to whether or not a row for the bio existed
- set bio_old [get_bio -person_id $person_id -exists_var exists_p]
-
- # bio_change_to = 0 -> insert
- # bio_change_to = 1 -> don't change
- # bio_change_to = 2 -> update
-
- if { !$exists_p } {
- # There is no bio yet.
- # If new bio is empty, that's a don't change (1)
- # If new bio is non-empty, that's an insert (0)
- set bio_change_to [expr {$bio eq ""}]
- } else {
- if {$bio eq $bio_old} {
- set bio_change_to 1
- } else {
- set bio_change_to 2
- }
- }
-
- if { $bio_change_to == 0 } {
- # perform the insert
- db_dml insert_bio {}
- } elseif { $bio_change_to == 2 } {
- # perform the update
- db_dml update_bio {}
- }
+ db_dml update_bio {}
}
@@ -497,7 +476,7 @@
}
if { $include_bio_p } {
- set row(bio) [person::get_bio -person_id $user_id]
+ set row(bio) [acs_user::get_bio -user_id $user_id]
}
}
Index: openacs-4/packages/acs-tcl/tcl/community-core-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/community-core-procs.xql,v
diff -u -r1.21 -r1.22
--- openacs-4/packages/acs-tcl/tcl/community-core-procs.xql 20 Aug 2007 21:47:38 -0000 1.21
+++ openacs-4/packages/acs-tcl/tcl/community-core-procs.xql 30 May 2009 20:42:12 -0000 1.22
@@ -88,44 +88,22 @@
-
+
- select attr_value as bio
- from acs_attribute_values
- where object_id = :person_id
- and attribute_id =
- (select attribute_id
- from acs_attributes
- where object_type = 'person'
- and attribute_name = 'bio')
+ select bio
+ from users
+ where user_id = :user_id
-
+
- insert into acs_attribute_values
- (object_id, attribute_id, attr_value)
- values
- (:person_id, (select attribute_id
- from acs_attributes
- where object_type = 'person'
- and attribute_name = 'bio'), :bio)
+ update users
+ set bio = :bio
+ where user_id = :user_id
-
-
- update acs_attribute_values
- set attr_value = :bio
- where object_id = :person_id
- and attribute_id =
- (select attribute_id
- from acs_attributes
- where object_type = 'person'
- and attribute_name = 'bio')
-
-
-
Index: openacs-4/packages/acs-tcl/tcl/test/community-core-test-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/community-core-test-procs.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-tcl/tcl/test/community-core-test-procs.tcl 10 Jan 2007 21:22:12 -0000 1.2
+++ openacs-4/packages/acs-tcl/tcl/test/community-core-test-procs.tcl 30 May 2009 20:42:12 -0000 1.3
@@ -36,8 +36,8 @@
}
aa_register_case \
-cats {api smoke} \
- -procs {person::person_p person::get person::new person::update person::get_bio person::update_bio} \
- person_procs_test \
+ -procs {person::person_p person::get person::new person::update acs_user::get_bio acs_user::update_bio} \
+ person_user_procs_test \
{
test if the values returned by the person procs are correct
} {
@@ -69,9 +69,6 @@
aa_true "party is a person" [person::person_p -party_id $user_id]
- #person::delete -person_id $user_info(user_id)
- #aa_true "person was deleted" [![person::person_p -party_id $user_id]]
-
array set user_inf [person::get -person_id $user_info(user_id)]
aa_true "first_names correct" [string match $user_inf(first_names) $first_names]
@@ -87,14 +84,13 @@
aa_true "name changed" [string match [person::name -person_id $prs_id] "hh$first_names hh$last_name"]
set bio "bio :: [ad_generate_random_string] :: bio"
- person::update_bio -person_id $prs_id -bio $bio
+ acs_user::update_bio -user_id $prs_id -bio $bio
- aa_true "bio(graphy) ok" [string match $bio [person::get_bio -person_id $prs_id -exists_var bio_p]]
+ aa_true "bio(graphy) ok" [string match $bio [acs_user::get_bio -user_id $prs_id -exists_var bio_p]]
person::delete -person_id $prs_id
aa_true "person deleted" ![person::person_p -party_id $prs_id]
-
}
}