Pluggable Account system added to WebGUI with new Profile, Inbox, Friends, User, and Shop interfaces.

This commit is contained in:
Frank Dillon 2008-11-15 11:39:23 +00:00
commit 4ff722bd5d
56 changed files with 6954 additions and 1090 deletions

View file

@ -1,5 +1,10 @@
7.6.4
- Brand new Survey system. Make sure to export your old results as they will
- New pluggable framework added for cutsomizing WebGUI's Account system
- New Profile Account module added providing a better interface for users to view and update their profile
- New Inbox Account module added providing a better interface into WebGUI's various messaging systems
- New Friends Account module added providing a better interface into WebGUI's friends system
- The Display Account and My Purchases interfaces have been added to the new Account system
not be imported, only the surveys themselves.
- Made syndicated content asset use cache.
- Added Cashier/Point of Sale mode for the Shop.

View file

@ -9,6 +9,12 @@ save you many hours of grief.
7.6.4
--------------------------------------------------------------------
* The user facing portions of WebGUI's profile, inbox, and friends systems
have been completely updated. No data will be lost but all templates
including custom templates that are related to these systems will be deleted
on upgrade. Please make sure you export your custom templates prior to
upgrading as you will need to modify them for the new system.
* The Survey system has been completely updated. Please make sure you
create full backups of your survey results and export them as needed.
Results will not be imported into the new Survey system. Your old surveys

Binary file not shown.

View file

@ -34,7 +34,8 @@ my $session = start(); # this line required
migrateSurvey($session);
addVersionTagMode($session);
addPosMode($session);
fixFriendsGroups( $session );
upgradeAccount( $session );
finish($session); # this line required
@ -305,6 +306,195 @@ CREATE TABLE `Survey_tempReport` (
");
}
#----------------------------------------------------------------------------
sub fixFriendsGroups {
my $session = shift;
my $users = $session->db->buildArrayRef("select userId from users where friendsGroup is not null && friendsGroup != ''");
foreach my $userId (@{$users}) {
#purge the admin group
WebGUI::User->new($session,$userId)->friends->deleteGroups([3]);
}
}
#----------------------------------------------------------------------------
sub upgradeAccount {
my $session = shift;
my $config = $session->config;
my $setting = $session->setting;
print "\tUpgrading WebGUI Account System... " unless $quiet;
#Add account properties to config file
$session->config->delete("account"); #Delete account if it exists
$session->config->set("account",[
{
identifier => "profile",
title => "^International(title,Account_Profile);",
className => "WebGUI::Account::Profile"
},
{
identifier => "inbox",
title => "^International(title,Account_Inbox);",
className => "WebGUI::Account::Inbox"
},
{
identifier => "friends",
title => "^International(title,Account_Friends);",
className => "WebGUI::Account::Friends"
},
{
identifier => "shop",
title => "^International(title,Account_Shop);",
className => "WebGUI::Account::Shop"
},
{
identifier => "user",
title => "^International(title,Account_User);",
className => "WebGUI::Account::User"
},
]);
$session->config->set("profileModuleIdentifier","profile");
#Add the content handler to the config file if it's not there
my $oldHandlers = $session->config->get( "contentHandlers" );
unless (isIn("WebGUI::Content::Account",@{$oldHandlers})) {
my @newHandlers;
for my $handler ( @{ $oldHandlers } ) {
if ( $handler eq "WebGUI::Content::Operation" ) {
push @newHandlers, "WebGUI::Content::Account";
}
push @newHandlers, $handler;
}
$session->config->set( "contentHandlers", \@newHandlers );
}
#Add the settings for the profile module
$setting->add("profileStyleTemplateId",""); #Use the userStyle by default
$setting->add("profileLayoutTemplateId","N716tpSna0iIQTKxS4gTWA");
$setting->add("profileEditLayoutTemplateId","FJbUTvZ2nUTn65LpW6gjsA");
$setting->add("profileEditTemplateId","75CmQgpcCSkdsL-oawdn3Q");
$setting->add("profileViewTempalteId","2CS-BErrjMmESOtGT90qOg");
$setting->add("profileErrorTempalteId","MBmWlA_YEA2I6D29OMGtRg");
#Add the settings for the inbox module
$setting->add("inboxStyleTemplateId",""); #Use the userStyle by default
$setting->add("inboxLayoutTempalteId","N716tpSna0iIQTKxS4gTWA");
$setting->add("inboxViewTemplateId","c8xrwVuu5QE0XtF9DiVzLw");
$setting->add("inboxViewMessageTemplateId","0n4HtbXaWa_XJHkFjetnLQ");
$setting->add("inboxSendMessageTemplateId","6uQEULvXFgCYlRWnYzZsuA");
$setting->add("inboxErrorTemplateId","ErEzulFiEKDkaCDVmxUavw");
$setting->add("inboxMessageConfirmationTemplateId","DUoxlTBXhVS-Zl3CFDpt9g");
#Invitations
$setting->add("inboxManageInvitationsTemplateId","1Q4Je3hKCJzeo0ZBB5YB8g");
$setting->add("inboxViewInvitationTemplateId","VBkY05f-E3WJS50WpdKd1Q");
$setting->add("inboxInvitationConfirmTemplateId","5A8Hd9zXvByTDy4x-H28qw");
#Add the settings for the friends module
$setting->add("friendsStyleTemplateId",""); #Use the userStyle by default
$setting->add("friendsLayoutTempalteId","N716tpSna0iIQTKxS4gTWA");
$setting->add("friendsViewTemplateId","1Yn_zE_dSiNuaBGNLPbxtw");
$setting->add("friendsEditTemplateId","AZFU33p0jpPJ-E6qLSWZng");
$setting->add("friendsSendRequestTemplateId","AGJBGviWGAwjnwziiPjvDg");
$setting->add("friendsErrorTemplateId","7Ijdd8SW32lVgg2H8R-Aqw");
$setting->add("friendsConfirmTemplateId","K8F0j_cq_jgo8dvWY_26Ag");
$setting->add("friendsRemoveConfirmTemplateId","G5V6neXIDiFXN05oL-U3AQ");
#Add the settings for the user module
$setting->add("userAccountStyleTemplateId",""); #Use the userStyle by default
$setting->add("userAccountLayoutTemplateId","9ThW278DWLV0-Svf68ljFQ");
#Add the settings for the shop module
$setting->add("shopStyleTemplateId",""); #Use the userStyle by default
$setting->add("shopLayoutTemplateId","aUDsJ-vB9RgP-AYvPOy8FQ");
#Add inbox changes
$session->db->write(q{
create table inbox_messageState (
messageId char(22) binary not null,
userId char(22) binary not null,
isRead tinyint(4) not null default 0,
repliedTo tinyint(4) not null default 0,
deleted tinyint(4) not null default 0,
primary key (messageId, userId)
)
});
#Update the inbox
my $sth = $session->db->read("select messageId, groupId, userId, status from inbox");
while(my ($messageId,$groupId,$userId,$status) = $sth->array) {
my $repliedTo = $status eq "replied";
my $isRead = ($status ne "unread" && $status ne "pending")?1:0;
my $deleted = 0;
if($status eq "deleted") {
#Purge deleted messages
$session->db->write("delete from inbox where messageId=?",[$messageId]);
next;
}
if($groupId) {
my $g = WebGUI::Group->new($session,$groupId);
my $users = $g->getAllUsers;
foreach my $userId (@{$users}) {
$session->db->write(
q{ REPLACE INTO inbox_messageState (messageId,userId,isRead,repliedTo,deleted) VALUES (?,?,?,?,?) },
[$messageId,$userId,$isRead,$repliedTo,$deleted]
);
}
}
if($userId) {
$session->db->write(
q{ REPLACE INTO inbox_messageState (messageId,userId,isRead,repliedTo,deleted) VALUES (?,?,?,?,?) },
[$messageId,$userId,$isRead,$repliedTo,$deleted]
);
}
if($status ne "completed" && $status ne "pending") {
$session->db->write(
q{ UPDATE inbox SET status='active' WHERE messageId=? },
[$messageId]
);
}
}
#Add the profile field changes
$session->db->write(q{alter table userProfileCategory add column shortLabel char(255) default NULL after label});
$session->db->write(q{update userProfileCategory set shortLabel='WebGUI::International::get("misc info short","WebGUI");' where profileCategoryId='1'});
$session->db->write(q{update userProfileCategory set shortLabel='WebGUI::International::get("contact info short","WebGUI");' where profileCategoryId='2'});
$session->db->write(q{update userProfileCategory set shortLabel='WebGUI::International::get("personal info short","WebGUI");' where profileCategoryId='3'});
$session->db->write(q{update userProfileCategory set shortLabel='WebGUI::International::get("preferences short","WebGUI");' where profileCategoryId='4'});
$session->db->write(q{update userProfileCategory set shortLabel='WebGUI::International::get("home info short","WebGUI");' where profileCategoryId='5'});
$session->db->write(q{update userProfileCategory set shortLabel='WebGUI::International::get("work info short","WebGUI");' where profileCategoryId='6'});
$session->db->write(q{update userProfileCategory set shortLabel='WebGUI::International::get("demographic info short","WebGUI");' where profileCategoryId='7'});
$session->db->write(q{alter table userProfileData modify publicProfile char(10) default 'none'});
$session->db->write(q{update userProfileData set publicProfile='none' where publicProfile='0' || publicProfile is NULL || publicProfile=''});
$session->db->write(q{update userProfileData set publicProfile='all' where publicProfile='1'});
$session->db->write(q{REPLACE INTO `userProfileField` VALUES ('publicProfile','WebGUI::International::get(861)',1,0,'RadioList','{ all=>WebGUI::International::get(\'public label\',\'Account_Profile\'), friends=>WebGUI::International::get(\'friends only label\',\'Account_Profile\'), none=>WebGUI::International::get(\'private label\',\'Account_Profile\')}','[\"none\"]',8,'4',1,1,0,0,0,'')});
#Clean up old templates and settings
my $oldtemplates = {
editUserProfileTemplate => 'Operation/Profile/Edit',
viewUserProfileTemplate => 'Operation/Profile/View',
manageFriendsTemplateId => 'friends/manage',
sendPrivateMessageTemplateId => 'Inbox/SendPrivateMessage',
viewInboxTemplateId => 'Inbox',
viewInboxMessageTemplateId => 'Inbox/Message',
};
foreach my $setting (keys %{$oldtemplates}) {
#Remove the setting
$session->db->write("delete from settings where name=?",[$setting]);
#Remove all the templates with the related namespace
my $assets = $session->db->buildArrayRef("select distinct assetId from template where namespace=?",[$oldtemplates->{$setting}]);
#Purge the template
foreach my $assetId (@{$assets}) {
WebGUI::Asset->newByDynamicClass($session,$assetId)->purge;
}
}
print "DONE!\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------