From dcc90c6b452de7e14e610c699873a97906fb0dad Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 26 Feb 2009 17:05:23 -0800 Subject: [PATCH 01/35] Utility script for Message Center install. --- sbin/installNotifications.pl | 161 +++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sbin/installNotifications.pl diff --git a/sbin/installNotifications.pl b/sbin/installNotifications.pl new file mode 100644 index 000000000..273637080 --- /dev/null +++ b/sbin/installNotifications.pl @@ -0,0 +1,161 @@ +#!/usr/bin/env perl + +#------------------------------------------------------------------- +# Copyright 2009 SDH Corporation. +#------------------------------------------------------------------- + +$|++; # disable output buffering +our ($webguiRoot, $configFile, $help, $man); + +BEGIN { + $webguiRoot = ".."; + unshift (@INC, $webguiRoot."/lib"); +} + +use strict; +use Pod::Usage; +use Getopt::Long; +use WebGUI::Session; +use WebGUI::ProfileField; + +# Get parameters here, including $help +GetOptions( + 'configFile=s' => \$configFile, + 'help' => \$help, + 'man' => \$man, +); + +pod2usage( verbose => 1 ) if $help; +pod2usage( verbose => 2 ) if $man; +pod2usage( msg => "Must specify a config file!" ) unless $configFile; + +my $session = start( $webguiRoot, $configFile ); + +installUserProfileFields($session); +installSettings($session); + +# Do your work here +finish($session); + +#---------------------------------------------------------------------------- +# Your sub here + +sub installUserProfileFields { + my $session = shift; + WebGUI::ProfileField->create( + $session, + 'receiveInboxEmailNotifications', + { + label => q!WebGUI::International::get('receive inbox notifications','Message_Center')!, + visible => 1, + required => 0, + protected => 1, + editable => 1, + fieldType => 'radioList', + dataDefault => 0, + possibleValues => q!{ +message => WebGUI::International::get('full message','Message_Center'), +note => WebGUI::International::get('short notification','Message_Center'), +}!, + }, + 4, + ); + WebGUI::ProfileField->create( + $session, + 'receiveInboxSMSNotifications', + { + label => q!WebGUI::International::get('receive inbox sms','Message_Center')!, + visible => 1, + required => 0, + protected => 1, + editable => 1, + fieldType => 'yesNo', + dataDefault => 0, + }, + 4, + ); +} + +sub installSettings { + my $session = shift; + $session->setting->add('smsGateway', ''); + $session->setting->add('sendInboxNotificationsOnly', ''); +} + +#---------------------------------------------------------------------------- +sub start { + my $webguiRoot = shift; + my $configFile = shift; + my $session = WebGUI::Session->open($webguiRoot,$configFile); + $session->user({userId=>3}); + + ## If your script is adding or changing content you need these lines, otherwise leave them commented + # + # my $versionTag = WebGUI::VersionTag->getWorking($session); + # $versionTag->set({name => 'Name Your Tag'}); + # + ## + + return $session; +} + +#---------------------------------------------------------------------------- +sub finish { + my $session = shift; + + ## If your script is adding or changing content you need these lines, otherwise leave them commented + # + # my $versionTag = WebGUI::VersionTag->getWorking($session); + # $versionTag->commit; + ## + + $session->var->end; + $session->close; +} + +__END__ + + +=head1 NAME + +utility - A template for WebGUI utility scripts + +=head1 SYNOPSIS + + utility --configFile config.conf ... + + utility --help + +=head1 DESCRIPTION + +This WebGUI utility script helps you... + +=head1 ARGUMENTS + +=head1 OPTIONS + +=over + +=item B<--configFile config.conf> + +The WebGUI config file to use. Only the file name needs to be specified, +since it will be looked up inside WebGUI's configuration directory. +This parameter is required. + +=item B<--help> + +Shows a short summary and usage + +=item B<--man> + +Shows this document + +=back + +=head1 AUTHOR + +Copyright 2001-2008 Plain Black Corporation. + +=cut + +#vim:ft=perl From 8dd59e5d9211b645bc842827c2d7e2a6f30f49ec Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 25 Mar 2009 10:47:50 -0700 Subject: [PATCH 02/35] Add Friends Manager Group setting w/ i18n and help. --- lib/WebGUI/Operation/Settings.pm | 1 + lib/WebGUI/i18n/English/WebGUI.pm | 10 ++++- ...tifications.pl => installFriendManager.pl} | 44 ++----------------- 3 files changed, 13 insertions(+), 42 deletions(-) rename sbin/{installNotifications.pl => installFriendManager.pl} (65%) diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm index 41677cc83..6af1ccb81 100644 --- a/lib/WebGUI/Operation/Settings.pm +++ b/lib/WebGUI/Operation/Settings.pm @@ -482,6 +482,7 @@ sub definition { groupIdAdminCache groupIdAdminCron groupIdAdminDatabaseLink + groupIdAdminFriends groupIdAdminGraphics groupIdAdminGroup groupIdAdminGroupAdmin diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index e177351d9..a8c37b59f 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -3728,7 +3728,6 @@ LongTruncOk=1

lastUpdated => 0, }, - 'settings groupIdAdminAdSpace label' => { message => q{AdSpace}, lastUpdated => 0, @@ -3770,6 +3769,15 @@ LongTruncOk=1

}, + 'settings groupIdAdminFriends label' => { + message => q{Friends}, + lastUpdated => 0, + }, + 'settings groupIdAdminFriends hoverHelp' => { + message => q{Group to manage friends.}, + lastUpdated => 0, + }, + 'settings groupIdAdminGraphics label' => { message => q{Graphics}, lastUpdated => 0, diff --git a/sbin/installNotifications.pl b/sbin/installFriendManager.pl similarity index 65% rename from sbin/installNotifications.pl rename to sbin/installFriendManager.pl index 273637080..754846f21 100644 --- a/sbin/installNotifications.pl +++ b/sbin/installFriendManager.pl @@ -31,8 +31,7 @@ pod2usage( msg => "Must specify a config file!" ) unless $configFile; my $session = start( $webguiRoot, $configFile ); -installUserProfileFields($session); -installSettings($session); +installFriendManagerGroup($session); # Do your work here finish($session); @@ -40,46 +39,9 @@ finish($session); #---------------------------------------------------------------------------- # Your sub here -sub installUserProfileFields { +sub installFriendManagerGroup { my $session = shift; - WebGUI::ProfileField->create( - $session, - 'receiveInboxEmailNotifications', - { - label => q!WebGUI::International::get('receive inbox notifications','Message_Center')!, - visible => 1, - required => 0, - protected => 1, - editable => 1, - fieldType => 'radioList', - dataDefault => 0, - possibleValues => q!{ -message => WebGUI::International::get('full message','Message_Center'), -note => WebGUI::International::get('short notification','Message_Center'), -}!, - }, - 4, - ); - WebGUI::ProfileField->create( - $session, - 'receiveInboxSMSNotifications', - { - label => q!WebGUI::International::get('receive inbox sms','Message_Center')!, - visible => 1, - required => 0, - protected => 1, - editable => 1, - fieldType => 'yesNo', - dataDefault => 0, - }, - 4, - ); -} - -sub installSettings { - my $session = shift; - $session->setting->add('smsGateway', ''); - $session->setting->add('sendInboxNotificationsOnly', ''); + $session->setting->add('groupIdAdminFriends', 3); } #---------------------------------------------------------------------------- From 968544580abcc802a6e2a8886d1906ca53f5199a Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 26 Mar 2009 10:49:54 -0700 Subject: [PATCH 03/35] Install, config and base module for FriendManager. --- lib/WebGUI/Account/FriendManager.pm | 119 ++++++++++++++++++ .../i18n/English/Account_FriendManager.pm | 43 +++++++ 2 files changed, 162 insertions(+) create mode 100644 lib/WebGUI/Account/FriendManager.pm create mode 100644 lib/WebGUI/i18n/English/Account_FriendManager.pm diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm new file mode 100644 index 000000000..5d899e269 --- /dev/null +++ b/lib/WebGUI/Account/FriendManager.pm @@ -0,0 +1,119 @@ +package WebGUI::Account::FriendManager; + +use strict; + +use WebGUI::Exception; +use WebGUI::International; +use WebGUI::Pluggable; +use WebGUI::Utility; +use base qw/WebGUI::Account/; + +=head1 NAME + +Package WebGUI::Account::FriendManager + +=head1 DESCRIPTION + +Allow friends to be assigned to one another instead of the usual social +networking. + +The style and layout settings are always inherited from the main Account +module. + +=head1 SYNOPSIS + +use WebGUI::Account::FriendManager; + +=head1 METHODS + +These methods are available from this class: + +=cut + +#------------------------------------------------------------------- + +=head2 canView ( ) + + Returns whether or not the user can view the the tab for this module + +=cut + +sub canView { + my $self = shift; + my $session = $self->session; + return $session->user->isInGroup($session->setting->get('groupIdAdminFriends')); +} + +#------------------------------------------------------------------- + +=head2 editSettingsForm ( ) + +Creates form elements for the settings page custom to this account module. + +=cut + +sub editSettingsForm { + my $self = shift; + my $session = $self->session; + my $i18n = WebGUI::International->new($session,'Account_FriendManager'); + my $f = WebGUI::HTMLForm->new($session); + + $f->group( + name => "groupIdAdminFriends", + value => $session->setting->get('groupIdAdminFriends'), + label => $i18n->get("setting groupIdAdminFriends label"), + hoverHelp => $i18n->get("setting groupIdAdminFriends hoverHelp") + ); + $f->group( + name => "groupsToManageFriends", + value => $session->setting->get('groupsToManageFriends'), + multiple => 1, + label => $i18n->get("groupsToManageFriends label"), + hoverHelp => $i18n->get("groupsToManageFriends hoverHelp") + ); + $f->template( + name => "friendManagerViewTemplateId", + value => $self->session->setting->get("friendManagerViewTemplateId"), + namespace => "Account/FriendManager/View", + label => $i18n->get("view template label"), + hoverHelp => $i18n->get("view template hoverHelp") + ); + + return $f->printRowsOnly; +} + +#------------------------------------------------------------------- + +=head2 editSettingsFormSave ( ) + + Creates form elements for the settings page custom to this account module + +=cut + +sub editSettingsFormSave { + my $self = shift; + my $session = $self->session; + my $setting = $session->setting; + my $form = $session->form; + + $setting->set("moduleViewTemplateId", $form->process("moduleViewTemplateId","template")); +} + +#------------------------------------------------------------------- + +=head2 www_view ( ) + +The main view page for editing the user's profile. + +=cut + +sub www_view { + my $self = shift; + my $session = $self->session; + my $var = {}; + + return $self->processTemplate($var,$session->setting->get("moduleViewTemplateId")); +} + + +1; diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm new file mode 100644 index 000000000..eb41d37b6 --- /dev/null +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -0,0 +1,43 @@ +package WebGUI::i18n::English::FriendManager; +use strict; + +our $I18N = { + + 'settings groupIdAdminFriends label' => { + message => q{Friends Manager}, + lastUpdated => 0, + }, + + 'settings groupIdAdminFriends hoverHelp' => { + message => q{Group to manage friends, to assign people to one another and to view the interface for managing friends.}, + lastUpdated => 0, + }, + + 'view template label' => { + message => q{View Template}, + lastUpdated => 0, + }, + + 'view template hoverHelp' => { + message => q{This template renders the Friend Manager itself, inside the layout and style templates.}, + lastUpdated => 0, + }, + + 'groupsToManageFriends label' => { + message => q{Groups to Manage as Friends}, + lastUpdated => 0, + }, + + 'groupsToManageFriends hoverHelp' => { + message => q{Choose groups of users whose Friends Networks you want to Manage.}, + lastUpdated => 0, + }, + + 'title' => { + message => q{Friend Manager}, + lastUpdated => 0, + }, + +}; + +1; From 11ae97e0c5d0466f9f4f7c9fe45d246aed591f06 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 26 Mar 2009 15:07:02 -0700 Subject: [PATCH 04/35] Add Friend Manager to default config file. --- etc/WebGUI.conf.original | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index 47690798c..efb9ee79f 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -668,6 +668,11 @@ "title" : "^International(title,Account_User);", "className" : "WebGUI::Account::User" }, + { + "identifier" : "friendManager", + "title" : "^International(title,Account_FriendManager);", + "className" : "WebGUI::Account::FriendManager" + }, ], # Specify which of the modules in the above list is used From 229ae88881c9abb35767ff648e755d896783a7bd Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 26 Mar 2009 15:07:27 -0700 Subject: [PATCH 05/35] Remove friends manager admin from global settings. --- lib/WebGUI/Operation/Settings.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm index 6af1ccb81..41677cc83 100644 --- a/lib/WebGUI/Operation/Settings.pm +++ b/lib/WebGUI/Operation/Settings.pm @@ -482,7 +482,6 @@ sub definition { groupIdAdminCache groupIdAdminCron groupIdAdminDatabaseLink - groupIdAdminFriends groupIdAdminGraphics groupIdAdminGroup groupIdAdminGroupAdmin From 2af14e6bf644dbb4085881b38c635b3736ec26b3 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 26 Mar 2009 15:31:50 -0700 Subject: [PATCH 06/35] Friend Manager settings, i18n, save form. --- lib/WebGUI/Account/FriendManager.pm | 33 +++++++++++-------- .../i18n/English/Account_FriendManager.pm | 6 ++-- sbin/installFriendManager.pl | 26 +++++++++++++-- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 5d899e269..708af72cd 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -59,24 +59,26 @@ sub editSettingsForm { my $f = WebGUI::HTMLForm->new($session); $f->group( - name => "groupIdAdminFriends", - value => $session->setting->get('groupIdAdminFriends'), - label => $i18n->get("setting groupIdAdminFriends label"), - hoverHelp => $i18n->get("setting groupIdAdminFriends hoverHelp") + name => "groupIdAdminFriends", + value => $session->setting->get('groupIdAdminFriends'), + label => $i18n->get("setting groupIdAdminFriends label"), + hoverHelp => $i18n->get("setting groupIdAdminFriends hoverHelp"), ); $f->group( - name => "groupsToManageFriends", - value => $session->setting->get('groupsToManageFriends'), + name => "groupsToManageFriends", + value => $session->setting->get('groupsToManageFriends'), multiple => 1, - label => $i18n->get("groupsToManageFriends label"), - hoverHelp => $i18n->get("groupsToManageFriends hoverHelp") + size => 5, + label => $i18n->get("groupsToManageFriends label"), + hoverHelp => $i18n->get("groupsToManageFriends hoverHelp"), + defaultValue => [2,3], ); $f->template( - name => "friendManagerViewTemplateId", - value => $self->session->setting->get("friendManagerViewTemplateId"), - namespace => "Account/FriendManager/View", - label => $i18n->get("view template label"), - hoverHelp => $i18n->get("view template hoverHelp") + name => "friendManagerViewTemplateId", + value => $self->session->setting->get("friendManagerViewTemplateId"), + namespace => "Account/FriendManager/View", + label => $i18n->get("view template label"), + hoverHelp => $i18n->get("view template hoverHelp"), ); return $f->printRowsOnly; @@ -96,7 +98,10 @@ sub editSettingsFormSave { my $setting = $session->setting; my $form = $session->form; - $setting->set("moduleViewTemplateId", $form->process("moduleViewTemplateId","template")); + $setting->set("moduleViewTemplateId", $form->process("moduleViewTemplateId", "template")); + my $groupsToManageFriends = $form->process("groupsToManageFriends", "group"); + $setting->set("groupsToManageFriends", $groupsToManageFriends); + $setting->set("groupIdAdminFriends", $form->process("groupIdAdminFriends", "group")); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index eb41d37b6..a61afe96c 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -1,14 +1,14 @@ -package WebGUI::i18n::English::FriendManager; +package WebGUI::i18n::English::Account_FriendManager; use strict; our $I18N = { - 'settings groupIdAdminFriends label' => { + 'setting groupIdAdminFriends label' => { message => q{Friends Manager}, lastUpdated => 0, }, - 'settings groupIdAdminFriends hoverHelp' => { + 'setting groupIdAdminFriends hoverHelp' => { message => q{Group to manage friends, to assign people to one another and to view the interface for managing friends.}, lastUpdated => 0, }, diff --git a/sbin/installFriendManager.pl b/sbin/installFriendManager.pl index 754846f21..33ad98c1a 100644 --- a/sbin/installFriendManager.pl +++ b/sbin/installFriendManager.pl @@ -16,7 +16,7 @@ use strict; use Pod::Usage; use Getopt::Long; use WebGUI::Session; -use WebGUI::ProfileField; +use WebGUI::Utility; # Get parameters here, including $help GetOptions( @@ -31,7 +31,8 @@ pod2usage( msg => "Must specify a config file!" ) unless $configFile; my $session = start( $webguiRoot, $configFile ); -installFriendManagerGroup($session); +installFriendManagerSettings($session); +installFriendManagerConfig($session); # Do your work here finish($session); @@ -39,9 +40,28 @@ finish($session); #---------------------------------------------------------------------------- # Your sub here -sub installFriendManagerGroup { +sub installFriendManagerSettings { my $session = shift; $session->setting->add('groupIdAdminFriends', 3); + $session->setting->add('friendManagerViewTemplate', ''); + $session->setting->add('groupsToManageFriends', '2'); +} + +sub installFriendManagerConfig { + my $session = shift; + my $config = $session->config; + my $account = $config->get('account'); + my @classes = map { $_->{className} } @{ $account }; + return if isIn('WebGUI::Account::FriendManager', @classes); + print "Installing FriendManager\n"; + push @{ $account }, + { + identifier => 'friendManager', + title => '^International(title,Account_FriendManager);', + className => 'WebGUI::Account::FriendManager', + } + ; + $config->set('account', $account); } #---------------------------------------------------------------------------- From 49b01e92cebe7b12dbf21d587911b1c84ae42d16 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 27 Mar 2009 10:49:53 -0700 Subject: [PATCH 07/35] FriendManager template work, view screen. --- lib/WebGUI/Account/FriendManager.pm | 22 ++++++++++++++++++---- sbin/installFriendManager.pl | 11 +++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 708af72cd..4f42a0080 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -8,6 +8,8 @@ use WebGUI::Pluggable; use WebGUI::Utility; use base qw/WebGUI::Account/; +use JSON qw(from_json to_json); + =head1 NAME Package WebGUI::Account::FriendManager @@ -34,7 +36,7 @@ These methods are available from this class: =head2 canView ( ) - Returns whether or not the user can view the the tab for this module +Returns whether or not the user can view the the tab for this module =cut @@ -88,7 +90,7 @@ sub editSettingsForm { =head2 editSettingsFormSave ( ) - Creates form elements for the settings page custom to this account module +Save =cut @@ -98,7 +100,7 @@ sub editSettingsFormSave { my $setting = $session->setting; my $form = $session->form; - $setting->set("moduleViewTemplateId", $form->process("moduleViewTemplateId", "template")); + $setting->set("friendManagerViewTemplateId", $form->process("friendManagerViewTemplateId", "template")); my $groupsToManageFriends = $form->process("groupsToManageFriends", "group"); $setting->set("groupsToManageFriends", $groupsToManageFriends); $setting->set("groupIdAdminFriends", $form->process("groupIdAdminFriends", "group")); @@ -116,8 +118,20 @@ sub www_view { my $self = shift; my $session = $self->session; my $var = {}; + $var->{group_loop} = []; - return $self->processTemplate($var,$session->setting->get("moduleViewTemplateId")); + my $groupIds = $session->setting->get('groupsToManageFriends'); + my @groupIds = split "\n", $groupIds; + GROUP: foreach my $groupId (@groupIds) { + my $group = WebGUI::Group->new($session, $groupId); + next GROUP unless $group->getId || $group->getId eq 'new'; + push @{ $var->{group_loop} }, { + groupId => $groupId, + groupName => $group->getName, + }; + } + + return $self->processTemplate($var,$session->setting->get("friendManagerViewTemplateId")); } diff --git a/sbin/installFriendManager.pl b/sbin/installFriendManager.pl index 33ad98c1a..d8c880b93 100644 --- a/sbin/installFriendManager.pl +++ b/sbin/installFriendManager.pl @@ -42,9 +42,11 @@ finish($session); sub installFriendManagerSettings { my $session = shift; - $session->setting->add('groupIdAdminFriends', 3); - $session->setting->add('friendManagerViewTemplate', ''); - $session->setting->add('groupsToManageFriends', '2'); + print "Installing FriendManager into settings..."; + $session->setting->add('groupIdAdminFriends', '3'); + $session->setting->add('friendManagerViewTemplate', '64tqS80D53Z0JoAs2cX2VQ'); + $session->setting->add('groupsToManageFriends', '2'); + print "\tDone"; } sub installFriendManagerConfig { @@ -53,7 +55,7 @@ sub installFriendManagerConfig { my $account = $config->get('account'); my @classes = map { $_->{className} } @{ $account }; return if isIn('WebGUI::Account::FriendManager', @classes); - print "Installing FriendManager\n"; + print "Installing FriendManager into config file..."; push @{ $account }, { identifier => 'friendManager', @@ -62,6 +64,7 @@ sub installFriendManagerConfig { } ; $config->set('account', $account); + print "\tDone"; } #---------------------------------------------------------------------------- From 7a1a0f75b752f9839257557952e31fc80b2a40f1 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 27 Mar 2009 10:51:17 -0700 Subject: [PATCH 08/35] Add a template for view. --- .../root_import_account_friendmanager.wgpkg | Bin 0 -> 1464 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 sbin/packages/root_import_account_friendmanager.wgpkg diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg new file mode 100644 index 0000000000000000000000000000000000000000..7e2e57a433742971201b5f3f6779b3dd60d79c01 GIT binary patch literal 1464 zcmV;p1xNZHiwFP!00000|Ls^?Q`!V zDlT`;^SpZ1cQ-c!e+_w_>%$K$dHO4r3Jcg;$YaW`7yC;k5pwacJ{(-;aOQW()E{Zc z?An{XXD?iD<4SV&=Y@?Q%)ek+ky%qM*N__}@G-$r z2lvdv%8u@A)EDIP*Ne(Ohk9K8Y{?wI3e&(fm;U_UQ~83*qshbe-VaY;BHJDEF}Tg@|rTZ^R0WblC+fo8B~1js^9a`qJKV4>qfRx^H+>`r+^X#}DP)RKx}|1n0`3 z0}WXY4nv+Yx-N=D^6DvxOt5jG1_RGta0xQ@r{P*3nQX+?(-Rc5GG zT2o{IN6RsBC!#|X0)$HFCFr4bjR@-i2w6iYnEE;9JVC~wdDJi?6U>TbX6O_T2&~yL zD~4EP3-sGv2pmk;%bdcV`3rpSmiwZtPXtxxB0ds)aE1k8+1@Q!*15>(qB1KTT%#Q( z0;05QPNz3w0`ZA-U!S)cjiv^`Mx!$c#x!5-_c7}gWMg5xCYyIWqL&nC#1N5R-SUE3 z)elOKimEvCc4V^pF3T$V2w6q*9`ju3QDf4wM5WH4M(oU4=>zhVoN@&l39+Jlt~LgQ zrJdFGp_wwxhzlpc!b6)WO`W&tzxhULp2ffk7C?y0!rN#Zciz37KRT6fd3Zeu^b~JX zc|b048qd{$A@n>!#^?5Su)PiP-KrBohEzgS4kmT(-H|3}9~@p6`iJ?A8RwkU$aF_P%6(lJWvTfu>xLjUF4ORFEe;N-N0hrgXCHwT}; zw7!f!H!E7M-M+Yem>OKvzTZdrXL|x4%k;k=)aUfSUk{%3|HCr6+NxFcf6mAyrdeG% z{cSJ<*FWaB!4%fnB4RL^(t^+xz9vl(euSxJyY6|HGq*c1=U-1_yDS( z4$u_Ue>i6K&bBxYP9$qr{|MZZ{nJjb%vd5QGlI0Ozq2OowK#Pz So+I#oh`@g)uNhYW8UO&mZ_JGV literal 0 HcmV?d00001 From 537bd17224151ff314ba83e422fc920920e3e0f9 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 27 Mar 2009 15:59:25 -0700 Subject: [PATCH 09/35] Install a default template for friend manager view. --- sbin/installFriendManager.pl | 56 +++++++++++++++++- .../root_import_account_friendmanager.wgpkg | Bin 1464 -> 1425 bytes 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/sbin/installFriendManager.pl b/sbin/installFriendManager.pl index d8c880b93..7fe2c77ac 100644 --- a/sbin/installFriendManager.pl +++ b/sbin/installFriendManager.pl @@ -89,15 +89,65 @@ sub finish { my $session = shift; ## If your script is adding or changing content you need these lines, otherwise leave them commented - # - # my $versionTag = WebGUI::VersionTag->getWorking($session); - # $versionTag->commit; + updateTemplates($session); + my $versionTag = WebGUI::VersionTag->getWorking($session); + $versionTag->commit; ## $session->var->end; $session->close; } +#------------------------------------------------- +sub updateTemplates { + my $session = shift; + my $packageDir = "packages"; + return undef unless (-d $packageDir); + print "\tUpdating packages.\n"; + opendir(DIR,$packageDir); + my @files = readdir(DIR); + closedir(DIR); + my $newFolder = undef; + foreach my $file (@files) { + next unless ($file =~ /\.wgpkg$/); + # Fix the filename to include a path + $file = $packageDir . "/" . $file; + addPackage( $session, $file ); + } +} + +sub addPackage { + my $session = shift; + my $file = shift; + + # Make a storage location for the package + my $storage = WebGUI::Storage->createTemp( $session ); + $storage->addFileFromFilesystem( $file ); + + # Import the package into the import node + my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage ); + + # Make the package not a package anymore + $package->update({ isPackage => 0 }); + + # Set the default flag for templates added + my $assetIds + = $package->getLineage( ['self','descendants'], { + includeOnlyClasses => [ 'WebGUI::Asset::Template' ], + } ); + for my $assetId ( @{ $assetIds } ) { + my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId ); + if ( !$asset ) { + print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n"; + next; + } + $asset->update( { isDefault => 1 } ); + } + + return; +} + + __END__ diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index 7e2e57a433742971201b5f3f6779b3dd60d79c01..3ae43b1abf21e2da27a819b7bedd4560b8efd901 100644 GIT binary patch literal 1425 zcmV;C1#bEuiwF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ue>i6K&bBxYP9$qr{|MZZ{nJjb%vd5QGlI0Ozq2OowK#Pz So+I#oh`@g)uNhYW8UO&mZ_JGV From 3c7e7ab23101a869915b0d3e355274cf29a68af4 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 1 Apr 2009 14:43:50 -0700 Subject: [PATCH 10/35] Checkpoint. Too many changes to enumerate. --- lib/WebGUI/Account.pm | 8 ++- lib/WebGUI/Account/FriendManager.pm | 48 +++++++++++++++++- sbin/installFriendManager.pl | 6 +-- .../root_import_account_friendmanager.wgpkg | Bin 1425 -> 1168 bytes 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/lib/WebGUI/Account.pm b/lib/WebGUI/Account.pm index 2d62b3f1c..bae617837 100644 --- a/lib/WebGUI/Account.pm +++ b/lib/WebGUI/Account.pm @@ -34,7 +34,9 @@ readonly module => my %module; public method => my %method; public uid => my %uid; public store => my %store; #This is an all purpose hash to store stuff in: $self->store->{something} = "something" - +public bare => my %bare; #This flag indicates that neither the layout nor style template should be applied + #to the output of the method. Think JSON/XML, etc. + #------------------------------------------------------------------- =head2 appendCommonVars ( var ) @@ -139,6 +141,9 @@ sub displayContent { my $noStyle = shift; my $session = $self->session; + ##Don't do any templating if we're sending back data like JSON or XML. + return $content if $self->bare; + #Wrap content into the layout my $var = {}; $var->{content} = $content; @@ -344,6 +349,7 @@ sub new { $store { $id } = {}; $method { $id } = "view"; $uid { $id } = undef; + $bare { $id } = 0; return $self; } diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 4f42a0080..16e67b587 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -108,6 +108,52 @@ sub editSettingsFormSave { #------------------------------------------------------------------- +=head2 www_getFriendsAsJson ( ) + +For each user in a group, count how many friends they have and return that data +as JSON. + +=cut + +sub www_getFriendsAsJson { + my $self = shift; + my $session = $self->session; + return $session->privilege->insufficient + unless $session->user->isInGroup($session->setting->get('groupIdAdminFriends')); + my $form = $session->form; + my $groupId = $form->get('groupId'); + if (! $groupId) {; + $session->log->warn("No groupId: >$groupId<"); + return '{}'; + } + my $group = WebGUI::Group->new($session, $groupId); + return '{}' if $group->getId eq 'new'; + if ($group->getId eq 'new') {; + $session->log->warn("New group created"); + return '{}'; + } + my @records = (); + USER: foreach my $userId (@{ $group->getUsers} ) { + my $user = WebGUI::User->new($session, $userId); + next USER unless $user; + my $friendsCount = scalar $user->friends->getUsers(); + push @records, { + userId => $userId, + username => $user->username, + friends => $friendsCount, + }; + } + my %results; + $results{totalRecords} = scalar @records; + $results{records} = \@records; + #$results{'sort'} = undef; + $session->http->setMimeType('application/json'); + my $json = JSON::to_json(\%results); + return $json; +} + +#------------------------------------------------------------------- + =head2 www_view ( ) The main view page for editing the user's profile. @@ -127,7 +173,7 @@ sub www_view { next GROUP unless $group->getId || $group->getId eq 'new'; push @{ $var->{group_loop} }, { groupId => $groupId, - groupName => $group->getName, + groupName => $group->name, }; } diff --git a/sbin/installFriendManager.pl b/sbin/installFriendManager.pl index 7fe2c77ac..64d12fc76 100644 --- a/sbin/installFriendManager.pl +++ b/sbin/installFriendManager.pl @@ -43,9 +43,9 @@ finish($session); sub installFriendManagerSettings { my $session = shift; print "Installing FriendManager into settings..."; - $session->setting->add('groupIdAdminFriends', '3'); - $session->setting->add('friendManagerViewTemplate', '64tqS80D53Z0JoAs2cX2VQ'); - $session->setting->add('groupsToManageFriends', '2'); + $session->setting->add('groupIdAdminFriends', '3'); + $session->setting->add('friendManagerViewTemplateId', '64tqS80D53Z0JoAs2cX2VQ'); + $session->setting->add('groupsToManageFriends', '2'); print "\tDone"; } diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index 3ae43b1abf21e2da27a819b7bedd4560b8efd901..207e3e061cf76b193713b83e1df0a49fa1d76a34 100644 GIT binary patch literal 1168 zcmV;B1aJEviwFP!00000|Ls;=bK*7>=6QdG#(CM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#6K2s}pMJBYx4-tTp{02%-QLod0N From 996e3a7053694bd7e762d168a18df8e3b74cbdfd Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 1 Apr 2009 15:34:06 -0700 Subject: [PATCH 11/35] Fix JSON, and ordering in the table. --- lib/WebGUI/Account/FriendManager.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 16e67b587..15c10eff7 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -143,10 +143,14 @@ sub www_getFriendsAsJson { friends => $friendsCount, }; } + @records = map { $_->[1] } + sort { $a->[0] cmp $b->[0] } + map { [ $_->{username}, $_ ] } @records; my %results; $results{totalRecords} = scalar @records; $results{records} = \@records; - #$results{'sort'} = undef; + $results{'sort'} = 'username'; + $self->bare(1); $session->http->setMimeType('application/json'); my $json = JSON::to_json(\%results); return $json; From f851a91b01c8f0fda5923dffea32ef7371e4bef6 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 1 Apr 2009 15:41:29 -0700 Subject: [PATCH 12/35] Update template and fix multiple errors. --- .../root_import_account_friendmanager.wgpkg | Bin 1168 -> 1541 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index 207e3e061cf76b193713b83e1df0a49fa1d76a34..c1d3027068cd6266ae4325a849ddb0f8ec73efda 100644 GIT binary patch literal 1541 zcmV+g2KxCQiwFP!00000|Ls^?Z`(E$&U1f-;J$P~6G^^Ej++K>lcw>KbP4SAwrmA0 zF*XyKR7uLNSM(ykKgW#2Xj`wLNfhP7 zkY!TKuf$0|B4UWcVlBm!w}gglqJ=uefS6Ji3$iGVO(^DuB4cqakahNbYv-oK(tK?}?ffk99|!Zs2D1H8B;6z*tb=R^5MHU%1^0ig(d zy$G5Q-5(T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$a_rH^~<+3>!7Gwk}QMO5C-C3F?zZ^loE zzj?21%K(GH5?U+cgL%iTgX7dI Date: Wed, 1 Apr 2009 16:58:23 -0700 Subject: [PATCH 13/35] Stub in www_editFriends. --- lib/WebGUI/Account/FriendManager.pm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 15c10eff7..fc950a037 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -108,10 +108,30 @@ sub editSettingsFormSave { #------------------------------------------------------------------- +=head2 www_editFriends ( ) + +Edit the friends for a user. Uses the form variable userId, to determine which user. + +=cut + +sub www_editFriends { + my $self = shift; + my $session = $self->session; + my $form = $session->form; + my $userId = $form->get('userId'); + + ##List users in my friends group. Each friend gets a delete link. + ##List users in all administrated groups. Friends are added one at a time. + + return $self->processTemplate($var,$session->setting->get("friendManagerViewTemplateId")); +} + +#------------------------------------------------------------------- + =head2 www_getFriendsAsJson ( ) For each user in a group, count how many friends they have and return that data -as JSON. +as JSON. Uses the form variable, groupId, to return users for that group. =cut @@ -143,6 +163,7 @@ sub www_getFriendsAsJson { friends => $friendsCount, }; } + ##Sort by username to make the datatable happy @records = map { $_->[1] } sort { $a->[0] cmp $b->[0] } map { [ $_->{username}, $_ ] } @records; From 100b900dd29085e73a94d3b69c44aefd43881315 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 6 Apr 2009 10:34:54 -0700 Subject: [PATCH 14/35] Beginning of edit user friend interface. Change prefix of templates from friendManager to fm. --- lib/WebGUI/Account/FriendManager.pm | 50 ++++++++++++++++-- .../i18n/English/Account_FriendManager.pm | 10 ++++ sbin/installFriendManager.pl | 3 +- .../root_import_account_friendmanager.wgpkg | Bin 1541 -> 1609 bytes 4 files changed, 57 insertions(+), 6 deletions(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index fc950a037..d2c4b35cd 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -8,6 +8,7 @@ use WebGUI::Pluggable; use WebGUI::Utility; use base qw/WebGUI::Account/; +use List::MoreUtils qw/uniq/; use JSON qw(from_json to_json); =head1 NAME @@ -76,12 +77,19 @@ sub editSettingsForm { defaultValue => [2,3], ); $f->template( - name => "friendManagerViewTemplateId", - value => $self->session->setting->get("friendManagerViewTemplateId"), + name => "fmViewTemplateId", + value => $self->session->setting->get("fmViewTemplateId"), namespace => "Account/FriendManager/View", label => $i18n->get("view template label"), hoverHelp => $i18n->get("view template hoverHelp"), ); + $f->template( + name => "fmEditTemplateId", + value => $self->session->setting->get("fmEditTemplateId"), + namespace => "Account/FriendManager/Edit", + label => $i18n->get("edit template label"), + hoverHelp => $i18n->get("edit template hoverHelp"), + ); return $f->printRowsOnly; } @@ -100,7 +108,8 @@ sub editSettingsFormSave { my $setting = $session->setting; my $form = $session->form; - $setting->set("friendManagerViewTemplateId", $form->process("friendManagerViewTemplateId", "template")); + $setting->set("fmViewTemplateId", $form->process("fmViewTemplateId", "template")); + $setting->set("fmEditTemplateId", $form->process("fmEditTemplateId", "template")); my $groupsToManageFriends = $form->process("groupsToManageFriends", "group"); $setting->set("groupsToManageFriends", $groupsToManageFriends); $setting->set("groupIdAdminFriends", $form->process("groupIdAdminFriends", "group")); @@ -111,6 +120,8 @@ sub editSettingsFormSave { =head2 www_editFriends ( ) Edit the friends for a user. Uses the form variable userId, to determine which user. +Only users in the managed groups are shown. Group inheritance is supported, but +only for WebGUI defined groups. =cut @@ -119,11 +130,40 @@ sub www_editFriends { my $session = $self->session; my $form = $session->form; my $userId = $form->get('userId'); + my $user = WebGUI::User->new($session, $userId); ##List users in my friends group. Each friend gets a delete link. + my $friendsList = $user->friends->getUserList(); ##List users in all administrated groups. Friends are added one at a time. + my @manageableUsers = (); + my $groupIds = $session->setting->get('groupsToManageFriends'); + my @groupIds = split "\n", $groupIds; + foreach my $groupId (@groupIds) { + my $group = WebGUI::Group->new($session, $groupId); + next GROUP unless $group->getId || $group->getId eq 'new'; + push @manageableUsers, @{ $group->getUsersNotIn($user->get('friendsGroup'), 'withoutExpired') }; + } + @manageableUsers = uniq @manageableUsers; + my %usersToAdd = (); + my $manager = $session->user; + foreach my $userId (@manageableUsers) { + my $user = WebGUI::User->new($session, $userId); + ##We don't use acceptsFriendsRequests here because it's overkill. + ##No need to check invitations, since friends are managed. + ##Existing friends are already filtered out. + next unless $user->profileField('ableToBeFriend'); + $usersToAdd{$userId} = $user->username; + } - return $self->processTemplate($var,$session->setting->get("friendManagerViewTemplateId")); + my $var; + $var->{formHeader} = WebGUI::Form::header($session); + $var->{addUserForm} = WebGUI::Form::selectBox($session, { + name => 'userToAdd', + options => \%usersToAdd, + sortByValue => 1, + }); + $var->{formFooter} = WebGUI::Form::footer($session);; + return $self->processTemplate($var,$session->setting->get("fmEditTemplateId")); } #------------------------------------------------------------------- @@ -202,7 +242,7 @@ sub www_view { }; } - return $self->processTemplate($var,$session->setting->get("friendManagerViewTemplateId")); + return $self->processTemplate($var,$session->setting->get("fmViewTemplateId")); } diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index a61afe96c..32ce9a895 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -23,6 +23,16 @@ our $I18N = { lastUpdated => 0, }, + 'edit template label' => { + message => q{Edit Friends Template}, + lastUpdated => 0, + }, + + 'edit template hoverHelp' => { + message => q{This template renders the interface for adding or removing friends for a user.}, + lastUpdated => 0, + }, + 'groupsToManageFriends label' => { message => q{Groups to Manage as Friends}, lastUpdated => 0, diff --git a/sbin/installFriendManager.pl b/sbin/installFriendManager.pl index 64d12fc76..c6d7e1ad4 100644 --- a/sbin/installFriendManager.pl +++ b/sbin/installFriendManager.pl @@ -44,7 +44,8 @@ sub installFriendManagerSettings { my $session = shift; print "Installing FriendManager into settings..."; $session->setting->add('groupIdAdminFriends', '3'); - $session->setting->add('friendManagerViewTemplateId', '64tqS80D53Z0JoAs2cX2VQ'); + $session->setting->add('fmViewTemplateId', '64tqS80D53Z0JoAs2cX2VQ'); + $session->setting->add('fmEditTemplateId', '64tqS80D53Z0JoAs2cX2VQ'); $session->setting->add('groupsToManageFriends', '2'); print "\tDone"; } diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index c1d3027068cd6266ae4325a849ddb0f8ec73efda..7a5526b315059589fe7503b502e28653324f6f2c 100644 GIT binary patch literal 1609 zcmV-P2DbShiwFP!00000|Ls{@bJI8!&NIJ46JFREQeRR#X(*iuy-}7znFh-4c9&6X zHBswGUP(>~4F7$PWXG4p31uf`_JSWA)koH+bN}RSHSYhiZM)O)8V&vHZ<}9d8-7uK z*$u~We9v=i+qWCYacrmEK=8`_Ux`#$z}5mDQFgN$FOfvZ)nct2Tt+$byJqS?Nn~~n zW{1n%Jue+^T}#e3v{6{m&-`BJe}CI`7W}{M`d$NpHShnrFaK}d|JFBw@c98GVN)tD z@Q5@~5B>K0WAi8$JSIX>BK1=2_n z$TDTtZ^p?mqH;{aLdeMN1!W<>HE-F4K+YJCC0)iLACgPf@x|N6L_Wo z*n(H#iM4mhYC#Lk5QElu7!eCgNdR8nPzHBAv2szqkxhZdctjZnhc1KWqVEYhOqAjk zd*4}8Ft7{+jTMq2D7m$;aH42Lb&y*52rAdIW6SQl##5Xwd)eIEwbG$>=2x(EMYQzI z#7`Yc8bh1Fn&C0$t&mSzWJ;K_7XHq4+yoYh$V6jgzbm!d1Xdn_Rz9l5+XR+QG077V z5R+}`um){YSZSu`iCu$)DrMyF#$lRJP}X!_)uL=54qLZmILeDBb-K*bw>AN?3S`8MGu}RsNde-xW`n@XF>)?cPHVP56xvMxPNdKQ4Ocp(Z{dd4j&6 zhmv3sjL{Vr6POTE8Ao{5LzF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ofhpP>jvjV(FER@y+UjI8h3u|bT?hPUKH!yPD5q2yXJ^p^E+ zZ~(06h(*dTxp&paj3un6;Z+Ui%(I@EGKH8mMCb3&nMHtmFqoQeY<&$4F^#XA@9wU@ zyW8-qMii_d8)fsXBpcAx_1R%f$oU4jyc3=1o?dpwX9r2AcQ6?qo*sShPW;B8@Wd)Q zp>nbv#Y5D`5{P9KrQfyYbFC{98<5i%P;*CLA$m0zH@T$x@Ra5 rb3!#Q?yB?SET2}J5Wc7X2ieNE=!icsepulDV}U;b)xV`-02}}S8_W2> From 98d7318d6421c6df557f647054117f7dcb1d6693 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 6 Apr 2009 15:32:13 -0700 Subject: [PATCH 15/35] Add a Select One label to WebGUI --- lib/WebGUI/i18n/English/WebGUI.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index a8c37b59f..4dfdebdd9 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -4346,6 +4346,12 @@ Users may override this setting in their profile. 'recaptcha public key' => { message => 'reCAPTCHA Public Key' }, + + 'Select One' => { + message => q|Select One|, + context => q|Label in dropdown lists, indicating that the user should use the list to select 1 entry. It is implied that if nothing is chosen, that nothing will happen.|, + lastUpdated => 1239057119, + }, }; 1; From a67907308f4f5c8a61d2eb2ea2cf3c907411e469 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 6 Apr 2009 16:52:23 -0700 Subject: [PATCH 16/35] Edit friends interface. New edit template with i18n and variables. Edit with save, to add and remove friends. --- lib/WebGUI/Account/FriendManager.pm | 81 +++++++++++++++--- sbin/installFriendManager.pl | 2 +- .../root_import_account_friendmanager.wgpkg | Bin 1609 -> 1926 bytes 3 files changed, 72 insertions(+), 11 deletions(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index d2c4b35cd..4d737b0e3 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -129,11 +129,23 @@ sub www_editFriends { my $self = shift; my $session = $self->session; my $form = $session->form; - my $userId = $form->get('userId'); + my $userId = shift || $form->get('userId', 'guid'); my $user = WebGUI::User->new($session, $userId); ##List users in my friends group. Each friend gets a delete link. my $friendsList = $user->friends->getUserList(); + my @friends_loop = (); + while (my ($userId, $username) = each %{ $friendsList }) { + push @friends_loop, { + userId => $userId, + username => $username, + checkForm => WebGUI::Form::checkbox($session, { + name => 'friendToAxe', + value => $userId, + }), + }; + } + ##List users in all administrated groups. Friends are added one at a time. my @manageableUsers = (); my $groupIds = $session->setting->get('groupsToManageFriends'); @@ -141,33 +153,82 @@ sub www_editFriends { foreach my $groupId (@groupIds) { my $group = WebGUI::Group->new($session, $groupId); next GROUP unless $group->getId || $group->getId eq 'new'; - push @manageableUsers, @{ $group->getUsersNotIn($user->get('friendsGroup'), 'withoutExpired') }; + push @manageableUsers, @{ $group->getUsersNotIn($user->{_user}->{'friendsGroup'}, 'withoutExpired') }; } @manageableUsers = uniq @manageableUsers; my %usersToAdd = (); + tie %usersToAdd, 'Tie::IxHash'; my $manager = $session->user; - foreach my $userId (@manageableUsers) { - my $user = WebGUI::User->new($session, $userId); + my $i18n = WebGUI::International->new($session); + $usersToAdd{0} = $i18n->get('Select One'); + my @usersToAdd = (); + USERID: foreach my $newFriendId (@manageableUsers) { + next USERID if $newFriendId eq $userId; + my $user = WebGUI::User->new($session, $newFriendId); ##We don't use acceptsFriendsRequests here because it's overkill. ##No need to check invitations, since friends are managed. ##Existing friends are already filtered out. - next unless $user->profileField('ableToBeFriend'); - $usersToAdd{$userId} = $user->username; + next USERID unless $user->profileField('ableToBeFriend'); + push @usersToAdd, [ $newFriendId, $user->username ]; + } + + @usersToAdd = sort { $a->[1] cmp $b->[1] } @usersToAdd; + foreach my $newFriend (@usersToAdd) { + $usersToAdd{$newFriend->[0]} = $newFriend->[1]; } my $var; - $var->{formHeader} = WebGUI::Form::header($session); + $var->{formHeader} = WebGUI::Form::formHeader($session, { + action => $self->getUrl('module=friendManager;do=editFriendsSave'), + }) + . WebGUI::Form::hidden($session, { name => 'userId', value => $userId } ); $var->{addUserForm} = WebGUI::Form::selectBox($session, { name => 'userToAdd', options => \%usersToAdd, - sortByValue => 1, }); - $var->{formFooter} = WebGUI::Form::footer($session);; + $var->{friends_loop} = \@friends_loop; + $var->{has_friends} = scalar @friends_loop; + $var->{submit} = WebGUI::Form::submit($session); + $var->{formFooter} = WebGUI::Form::formFooter($session); + $var->{username} = $user->username; + $var->{userId} = $user->userId; return $self->processTemplate($var,$session->setting->get("fmEditTemplateId")); } #------------------------------------------------------------------- +=head2 www_editFriendsSave ( ) + +Handle adding and removing people from a user's friend group. The userId of +the user to modify will be in the userId from variable. One userId to add will be +in userToAdd. + +Users to delete will be listed in checkboxes with the name, friendToAxe + +=cut + +sub www_editFriendsSave () { + my $self = shift; + my $session = $self->session; + my $form = $session->form; + my $userId = $form->process('userId', 'guid'); + my $user = WebGUI::User->new($session, $userId); + my $userToAdd = $form->process('userToAdd', 'guid'); + + if ($userToAdd) { + $user->friends->addUsers([$userToAdd]); + } + + my @usersToRemove = $form->process('friendToAxe', 'checkList'); + if (scalar @usersToRemove) { + $user->friends->deleteUsers(\@usersToRemove); + } + + return $self->www_editFriends($userId); +} + +#------------------------------------------------------------------- + =head2 www_getFriendsAsJson ( ) For each user in a group, count how many friends they have and return that data @@ -196,7 +257,7 @@ sub www_getFriendsAsJson { USER: foreach my $userId (@{ $group->getUsers} ) { my $user = WebGUI::User->new($session, $userId); next USER unless $user; - my $friendsCount = scalar $user->friends->getUsers(); + my $friendsCount = scalar @{ $user->friends->getUsers() }; push @records, { userId => $userId, username => $user->username, diff --git a/sbin/installFriendManager.pl b/sbin/installFriendManager.pl index c6d7e1ad4..bc1f6e54b 100644 --- a/sbin/installFriendManager.pl +++ b/sbin/installFriendManager.pl @@ -45,7 +45,7 @@ sub installFriendManagerSettings { print "Installing FriendManager into settings..."; $session->setting->add('groupIdAdminFriends', '3'); $session->setting->add('fmViewTemplateId', '64tqS80D53Z0JoAs2cX2VQ'); - $session->setting->add('fmEditTemplateId', '64tqS80D53Z0JoAs2cX2VQ'); + $session->setting->add('fmEditTemplateId', 'lG2exkH9FeYvn4pA63idNg'); $session->setting->add('groupsToManageFriends', '2'); print "\tDone"; } diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index 7a5526b315059589fe7503b502e28653324f6f2c..c4f2deba23ef66e3a4ef5e745945bef203f29eb3 100644 GIT binary patch literal 1926 zcmV;12YL7(iwFP!00000|Lq!UZ`(F7pZhBW7Z^IAi7eTcW7iGfw0Uh!mn=@Rc3A^j zqHV^qsF9Qtujqf@k$T&*;}mky4bcZl=23U#y?77rY;FFkR;$fsV{1!3t-5*|b$DvY zRoyZS!?GHN*)Zx`nqgE;b4!CyHh%?NAO=gbsY|@^a(V&Bj4ubv&B3KMr=BaO{zxFT zY9qZj8tUELx#iR=X`z78isW7-{~8E=PX2YXS=-Wpo14EjCI6kxFTD&3U!H*xR=A)H z4RJ+lYk&UrQVscx`j`oVxg1r~(_P8R9ld%@5#Mote67oqgd!|W0a_QaWA zN5EV)#3&UynaGXk$hK+V34Oo__M8dwfE7%~4iV`}5a(D#=-eX{-;a-5hxp^vtNUH6 zMx6JeHW`2w$~A(y`Q{3 z_g{5%c$GgtpLjyz7leAqebK1Cyu$sX%afm9#gtr1eJw(GBY#B5B-{ZU@jC4hw#SFC zBv>c_=E0e5giu|mW$Ow-j8_-&a>H>lP>5n0$Z@3f6_t2>l1Dt~Pl(7(mCQK=T>$2! zEGOOwGa@dTd&ubI3^DA5V#!DnP755FOeJ-nRpm-!Cz@hZ>i=ehykU`X*kD!sJqS<9 zKICk>-IXfWZuesOC$=PQ@RT}aK){HkwisruRke&=vzbziH0lGvp;cu-f(SPxCG|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*5rSeR0#kFk~ z8!45~X&4f=_W7H)7?}ml&{WhIv-~w9dW9!MmtFJ56pQo){ZyA?n66*bU^E1zg=r_@o+;TNH>;c8 z03*Fls6H&uMo$rN3v@w-$8S%zj>>Vhb&7AuKsV<{^*E2~A46|p<)&ffy6Y`jdTWIZ zDH{_()msrA2|hW)0_yCd3v@_j+^d;#@8UjZ8`ZHa;~{NK1CpxU>-9DH z==BD3hvuYAletqK(klvVOcOT8ZFf66-L~%+h*^ld(_yLSbPAE8DoUX$rbT)#T84v| ziC=LAZ~<17F9jo&Iu5l<(#;e=CJWB#r&Qp&_5!m^QVxh?V6D?KvxLT$48CobF&2=) z>kQcIJs+IDT-J}umpr(c`=!E*sXQQ8IEhm4JB4Ote;Ul4ozBjV*KtcMSdb}|V6TID zHrBZbk{<^*c_5V##{Bk#9YHBejZ^|>5GjyzL2A~1R*ovZw2a^Lh#@Qxvsj(g;3z!G z>eThY!MpdbMxVk{wsU+n>3;Im;jmxqh|2Ssgz{qaE$IpVHz$j_2rxF7o3>ff!JIf2 zjpMs^*Y6gH;8V!FY(2jfr|m7A|J!~WJ_Fg`!;U}B|KD`}&$v)gQx{V)&(Tte{>n##4SyS0 z!@`z68&ryPnQN^m5_uuKGoLGpkOa>6T7+3|>7VZxq6$4LS#%Af(=7oG`TIB+lL4I& zo}|5{?c1f2y2$Sww*WN^cHYIZ+IaR%(-~6~@|#~;?=FNUB!}Fzd~>8&6KtJQ*S-_k z@Lnr&G`@L%{^Dia+II&^wofnmg(p^#4V{hsC?4Y>QNTx|DE(wviuEexD3!ByJY@wP zsT!z4N6wxZcjf732BkEO1!aa5pX(FnJd;+N5dM?$KjkvtgD(8Q_+f$nk_G+(;VXe6 H03HAU*bf+_ From 8e2716f4aa28345cc3a09f84200bbcba9a8c5736 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 09:34:58 -0700 Subject: [PATCH 17/35] Template variable help for view screen. --- lib/WebGUI/Help/Account_FriendManager.pm | 26 ++++++++++++++++ .../i18n/English/Account_FriendManager.pm | 30 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 lib/WebGUI/Help/Account_FriendManager.pm diff --git a/lib/WebGUI/Help/Account_FriendManager.pm b/lib/WebGUI/Help/Account_FriendManager.pm new file mode 100644 index 000000000..136fa518c --- /dev/null +++ b/lib/WebGUI/Help/Account_FriendManager.pm @@ -0,0 +1,26 @@ +package WebGUI::Help::Account_FriendManager; + +use strict; + +our $HELP = { + + 'view friend manager' => { + title => 'Friend Manager View Template', + body => '', + isa => [ + ], + fields => [ ], + variables => [ + { name => 'group_loop', + variables => [ + { name => 'groupId', }, + { name => 'groupName', }, + ] + }, + ], + related => [ ], + }, +}; + +1; +#vim:ft=perl diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index 32ce9a895..4aba25a1c 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -48,6 +48,36 @@ our $I18N = { lastUpdated => 0, }, + 'remove friends' => { + message => q{Remove Friends}, + lastUpdated => 0, + }, + + 'add new friends' => { + message => q{Add New Friends}, + lastUpdated => 0, + }, + + 'Friend Manager View Template' => { + message => q{Friend Manager View Template}, + lastUpdated => 0, + }, + + 'group_loop' => { + message => q{A loop containing 1 entry for each group that is set to be managed.}, + lastUpdated => 0, + }, + + 'groupId' => { + message => q{The GUID of the group.}, + lastUpdated => 0, + }, + + 'groupName' => { + message => q{The name of the group.}, + lastUpdated => 0, + }, + }; 1; From b5ccf765762901763457b50f651a9967b65807ed Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 09:35:23 -0700 Subject: [PATCH 18/35] Template fixes for edit screen. --- .../root_import_account_friendmanager.wgpkg | Bin 1926 -> 1968 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import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#sm=7;ZqpV zWr$HkG^ObvI1i;m)zz8FbvSfAxTA@lfRcrjMbt+_0x=wAi$oL9_axd6grGTouf0=X zFt-`;g~pkk5o^lfKoFP6{6$aRz^N??HY>hcG({oW>k7oD;j0wp1GHqatjn9ypCT%u zCY3>JhDMZbJ9M&*r*L@cbH9^4mO%@<7(z3lN6)3ZD}z>|fqL>*NUsc9(!@9on2nXS zg|7wF%AyrodSciGl(d{1`Bps)4GP?vw5viYCFtSy9qtbk=ShrRPnWku@#dW7Iy_uq zVR>p{f*HraxnD8;b?HeLo@2W5-Fw<|rG7&VX(?lzGP_HXfMvyn74?X<>kbZ?YAQ_yUkg5VTOL>2a9V+%1mPvgxuy^%`9CBvUhT&ZAn-J!UU(11dMmF^*}7UcM+ z$;yJZm~2NHRaAFaUN?BC;*hTothJ7n^@e<%!ZfRyO67l}&am5T?bfV}m^M{sP=ZWc z%vyB@e&=6Y9W~HsHvaVH;#ADeiTiubPZif0^0kDFNI-Fx79fi13=7P8sxvIhoEP(d zI7dtC{Df42#;X1g^m-a|{hyjuYd+=w%VbvO_+$G&QNWWHYqMw5vgXf^TN}s~gR?Q3 zTU?Ax9O2qAT6&Oj=r#SupbewytKEw?DJU1YWjMMba+9TJ$mHK3XsGna1k)g_Vb`o` zrbHc`#z|kvFjJx`OpOolC^S9Wmw}mb3dzmN;9I9N;@~hagW|8+X~*A-sf0}{F~U*P zL5m{!j_zlorU!zSm5rBldn=nNSG0eNZRoBXQddeOk?S{wMDaFKG%KQ@Z;5pl2|Oaa zsacJ5VJmteS++l><*{p-4a>}HZE?#3dJC$RxkA~RyXjgt8f-{w?7IF4^|63Hm+OWt z>x{0K7mmy`C>M^L?JK{Nn45aZn5oZ*r|Jh6GOdg)X*mnwpEOTBlQNIUCtOb)_}_Bi MUqP&=F90Y204 Date: Tue, 7 Apr 2009 10:01:48 -0700 Subject: [PATCH 19/35] Template variable help for edit screen. --- lib/WebGUI/Help/Account_FriendManager.pm | 32 +++++++++ .../i18n/English/Account_FriendManager.pm | 70 +++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/lib/WebGUI/Help/Account_FriendManager.pm b/lib/WebGUI/Help/Account_FriendManager.pm index 136fa518c..6514ed285 100644 --- a/lib/WebGUI/Help/Account_FriendManager.pm +++ b/lib/WebGUI/Help/Account_FriendManager.pm @@ -20,6 +20,38 @@ our $HELP = { ], related => [ ], }, + + 'edit friend manager' => { + title => 'Friend Manager Edit Template', + body => '', + isa => [ + ], + fields => [ ], + variables => [ + { name => 'formHeader', + required => 1, }, + { name => 'username', }, + { name => 'userId', }, + { name => 'manageUrl', }, + { name => 'addUserForm', }, + { name => 'hasFriends', }, + { name => 'friend_loop', + variables=> [ + { name => 'userId', + description => 'new userId', }, + { name => 'username', + description => 'new username', }, + { name => 'checkForm', }, + ], + }, + { name => 'submit', + required => 1, }, + { name => 'formFooter', + required => 1, }, + ], + related => [ ], + }, + }; 1; diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index 4aba25a1c..612c67bd3 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -78,6 +78,76 @@ our $I18N = { lastUpdated => 0, }, + 'Friend Manager Edit Template' => { + message => q{Friend Manager Edit Template}, + lastUpdated => 0, + }, + + 'formHeader' => { + message => q{HTML code to begin the form for editing a user's list of friends.}, + lastUpdated => 0, + }, + + 'username' => { + message => q{The name of the user whose friends you are managing.}, + lastUpdated => 0, + }, + + 'userId' => { + message => q{The GUID of the user whose friends you are managing.}, + lastUpdated => 0, + }, + + 'manageUrl' => { + message => q{The GUID of the user whose friends you are managing.}, + lastUpdated => 0, + }, + + 'back to friend manager' => { + message => q{Back to the Friend Manager.}, + lastUpdated => 0, + }, + + 'addUserForm' => { + message => q{A dropdown box with a list of users who can be added to this user's Friends.}, + lastUpdated => 0, + }, + + 'hasFriends' => { + message => q{A boolean which is true if the user currently has friends.}, + lastUpdated => 0, + }, + + 'friend_loop' => { + message => q{A loop containing a list of the this user's current friends.}, + lastUpdated => 0, + }, + + 'new userId' => { + message => q{The GUID of a user.}, + lastUpdated => 0, + }, + + 'new username' => { + message => q{The username of a user.}, + lastUpdated => 0, + }, + + 'checkForm' => { + message => q{A checkbox for this user. If set when the form is submitted, this user will be removed from the user's list of friends.}, + lastUpdated => 0, + }, + + 'submit' => { + message => q{A button with internationalized label to submit the form.}, + lastUpdated => 0, + }, + + 'formFooter' => { + message => q{HTML code to end the form.}, + lastUpdated => 0, + }, + }; 1; From 7682b6a3d6003315243be1940843a6bc26774649 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 10:29:04 -0700 Subject: [PATCH 20/35] Friends relationships are reciprocal. Fix manageUrl to really work in edit screen. --- lib/WebGUI/Account/FriendManager.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 4d737b0e3..92f2f5b85 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -3,6 +3,7 @@ package WebGUI::Account::FriendManager; use strict; use WebGUI::Exception; +use WebGUI::Friends; use WebGUI::International; use WebGUI::Pluggable; use WebGUI::Utility; @@ -192,6 +193,7 @@ sub www_editFriends { $var->{formFooter} = WebGUI::Form::formFooter($session); $var->{username} = $user->username; $var->{userId} = $user->userId; + $var->{manageUrl} = $self->getUrl('module=friendManager;do=view'); return $self->processTemplate($var,$session->setting->get("fmEditTemplateId")); } @@ -213,15 +215,16 @@ sub www_editFriendsSave () { my $form = $session->form; my $userId = $form->process('userId', 'guid'); my $user = WebGUI::User->new($session, $userId); - my $userToAdd = $form->process('userToAdd', 'guid'); + my $ufriend = WebGUI::Friends->new($session, $user); + my $userToAdd = $form->process('userToAdd', 'guid'); if ($userToAdd) { - $user->friends->addUsers([$userToAdd]); + $ufriend->add([$userToAdd]); } my @usersToRemove = $form->process('friendToAxe', 'checkList'); if (scalar @usersToRemove) { - $user->friends->deleteUsers(\@usersToRemove); + $ufriend->delete(\@usersToRemove); } return $self->www_editFriends($userId); From 851912712fb2173a4467abf568c1c1ec43e1ea31 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 10:46:46 -0700 Subject: [PATCH 21/35] Adding JS for friendManager. --- .../build/friendManager/friendManager.js | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 www/extras/yui-webgui/build/friendManager/friendManager.js diff --git a/www/extras/yui-webgui/build/friendManager/friendManager.js b/www/extras/yui-webgui/build/friendManager/friendManager.js new file mode 100644 index 000000000..c318ac299 --- /dev/null +++ b/www/extras/yui-webgui/build/friendManager/friendManager.js @@ -0,0 +1,112 @@ +/*** The WebGUI Asset History Viewer + * Requires: YAHOO, Dom, Event + * With all due credit to Doug Bell, who wrote the AssetManager. FriendManager + * is a blatant copy/paste/modify of it. + */ + +//Container for functions used by many datatables. +if ( typeof WebGUI == "undefined" ) { + WebGUI = {}; +} +if ( typeof WebGUI.FriendManager == "undefined" ) { + WebGUI.FriendManager = {}; +} + +/*--------------------------------------------------------------------------- + WebGUI.FriendManager.initManager ( ) + Initialize the i18n interface +WebGUI.FriendManager.initManager = function (o) { + WebGUI.FriendManager.i18n + = new WebGUI.i18n( { + namespaces : { + 'WebGUI' : [ + "50", + ], + 'Account_Friends' : [ + "title", + ] + }, + onpreload : { + fn : WebGUI.FriendManager.init + } + } ); +}; +*/ + +/*--------------------------------------------------------------------------- + Initialize objects that are shared across many datatables. +*/ +WebGUI.FriendManager.responseSchema + = { + resultsList: 'records', + fields: [ + { key: 'userId', parser: 'string' }, + { key: 'username', parser: 'string' }, + { key: 'friends', parser: 'number' }, + ], + metaFields: { + totalRecords: "recordsReturned" // Access to value in the server response + } + }; + +WebGUI.FriendManager.formatUsername = function ( el, oRecord, oColumn, oData ) { +// var link = document.createElement('a'); +// var myId = YAHOO.util.Dom.generateId(); +// elCell.innerHTML = ''; +// var editButton = new YAHOO.widget.Button( myId, +// { +// type : "link", +// href : "?op=account;module=friendManager;do=editFriends;uid="+oRecord.getData('userId'), +// label : "EDIT", +// } +// ); + var userId = oRecord.getData('userId'); + el.innerHTML = 'edit '; + el.innerHTML += '' + oData + ''; +} + +WebGUI.FriendManager.ColumnDefs = [ // sortable:true enables sorting + //{key:"username", label:WebGUI.FriendManager.i18n.get('WebGUI', '50' ), sortable: true}, + //{key:"friends", label:WebGUI.FriendManager.i18n.get('Account_Friends', 'title' ), sortable: true}, + {key:"username", label:"username", sortable: true, formatter: WebGUI.FriendManager.formatUsername }, + {key:"friends", label:"friends", sortable: true}, + {key:"userId", label:"userId", sortable: true}, +]; + +//Per object code + +WebGUI.FriendManager.MakeTable = function (groupId, containerId) { + var that = this; + + // Initialize the data table + var myPaginator = new YAHOO.widget.Paginator({ + containers : ['pagination'], + pageLinks : 7, + rowsPerPage : 15, + template : "{CurrentPageReport} {PreviousPageLink} {PageLinks} {NextPageLink}" + }); + + that.DataSource + = new YAHOO.util.DataSource('?op=account;module=friendManager;do=getFriendsAsJson;groupId='+groupId+';',{connTimeout:30000} ); + that.DataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; + that.DataSource.responseSchema = WebGUI.FriendManager.responseSchema; + that.DataTable = new YAHOO.widget.DataTable( + containerId, + WebGUI.FriendManager.ColumnDefs, + that.DataSource, + { + initialRequest : '', + paginator : myPaginator, + sortedBy : { "key" : "username", "dir" : YAHOO.widget.DataTable.CLASS_ASC }, + } + ); + + that.DataTable.handleDataReturnPayload = function(oRequest, oResponse, oPayload) { + oPayload.totalRecords = oResponse.meta.totalRecords; + return oPayload; + } + + return that; + +}; + From 7316f267fa9efa85b5b95513bb0183f392eaa41a Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 11:31:34 -0700 Subject: [PATCH 22/35] Allow UserAdmin to view another person's inbox. --- lib/WebGUI/Account/Inbox.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Account/Inbox.pm b/lib/WebGUI/Account/Inbox.pm index 57d6b5af1..8f44fe7b3 100644 --- a/lib/WebGUI/Account/Inbox.pm +++ b/lib/WebGUI/Account/Inbox.pm @@ -77,7 +77,9 @@ Returns whether or not the user can view the inbox tab sub canView { my $self = shift; - return ($self->uid eq ""); + my $session = $self->session; + return $self->uid eq "" + || $self->uid ne "" && $session->user->isInGroup($session->setting->get('groupIdAdminUser')); } #------------------------------------------------------------------- From 263bb9bbdfb36969b7f1a73b039b01690b746110 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 13:00:53 -0700 Subject: [PATCH 23/35] Handle the uid parameter, easily. Add the getUser method, to return the right user, based on the uid URL parameter. Change appendCommonVars to use getUser so that it always dispays the correct username. --- lib/WebGUI/Account.pm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Account.pm b/lib/WebGUI/Account.pm index bae617837..ee5ffd194 100644 --- a/lib/WebGUI/Account.pm +++ b/lib/WebGUI/Account.pm @@ -53,7 +53,7 @@ sub appendCommonVars { my $self = shift; my $var = shift; my $session = $self->session; - my $user = $session->user; + my $user = $self->getUser; $var->{'user_full_name' } = $user->getWholeName; $var->{'user_member_since'} = $user->dateCreated; @@ -314,6 +314,25 @@ sub getUrl { #------------------------------------------------------------------- +=head2 getUser + +Gets the user, either specified by the uid URL parameter, or the +session user. + +=cut + +sub getUser { + my $self = shift; + if ($self->uid) { + return WebGUI::User->new($self->session, $self->uid); + } + else { + return $self->session->user; + } +} + +#------------------------------------------------------------------- + =head2 new ( session, module [,method ,uid] ) Constructor. From 0b878fd288dffd1b93102ce9b139936769d7da8d Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 13:02:43 -0700 Subject: [PATCH 24/35] Overrides allow groupIdAdminUser to view Inbox. Modified Account/Inbox, and Inbox->canRead. Anyone in groupIdAdminUser can now read messages in any user's inbox. --- lib/WebGUI/Account/Inbox.pm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/WebGUI/Account/Inbox.pm b/lib/WebGUI/Account/Inbox.pm index 8f44fe7b3..d880b458f 100644 --- a/lib/WebGUI/Account/Inbox.pm +++ b/lib/WebGUI/Account/Inbox.pm @@ -49,16 +49,16 @@ sub appendCommonVars { my $session = $self->session; my $var = shift; my $inbox = shift || WebGUI::Inbox->new($session); - my $user = $session->user; + my $user = $self->getUser; my $method = $self->method; $self->SUPER::appendCommonVars($var); - $var->{'view_inbox_url' } = $self->getUrl("module=inbox;do=view"); + $var->{'view_inbox_url' } = $self->getUrl("module=inbox;do=view", 'useUid'); $var->{'view_invitations_url' } = $self->getUrl("module=inbox;do=manageInvitations"); - $var->{'unread_message_count' } = $inbox->getUnreadMessageCount; + $var->{'unread_message_count' } = $inbox->getUnreadMessageCount($user->userId); $var->{'invitation_count' } = $self->getInvitationCount; - $var->{'invitations_enabled' } = $session->user->profileField('ableToBeFriend'); + $var->{'invitations_enabled' } = $user->profileField('ableToBeFriend'); $var->{'user_invitations_enabled'} = $session->setting->get("inboxInviteUserEnabled"); $var->{'invite_friend_url' } = $self->getUrl("module=inbox;do=inviteUser"); @@ -1180,7 +1180,8 @@ The main view page for editing the user's profile. sub www_view { my $self = shift; my $session = $self->session; - my $user = $session->user; + my $user = $self->getUser; + my $var = {}; $self->store->{tab} = "inbox"; @@ -1198,7 +1199,7 @@ sub www_view { my $rpp_url = ";rpp=$rpp"; #Cache the base url - my $inboxUrl = $self->getUrl; + my $inboxUrl = $self->getUrl('', 'useUid'); #Create sortBy headers $var->{'subject_url' } = $inboxUrl.";sortBy=subject".$sortDir_url.$rpp_url; @@ -1209,7 +1210,7 @@ sub www_view { #Create the paginator my $inbox = WebGUI::Inbox->new($session); - my $p = $inbox->getMessagesPaginator($session->user,{ + my $p = $inbox->getMessagesPaginator($user,{ sortBy => $sortBy, sortDir => $sortDir, baseUrl => $inboxUrl.$sort_url.";sortDir=".$sortDir.$rpp_url, @@ -1224,7 +1225,7 @@ sub www_view { my $hash = {}; $hash->{'message_id' } = $message->getId; - $hash->{'message_url' } = $self->getUrl("module=inbox;do=viewMessage;messageId=".$message->getId); + $hash->{'message_url' } = $self->getUrl("module=inbox;do=viewMessage;messageId=".$message->getId,'useUid'); $hash->{'subject' } = $message->get("subject"); $hash->{'status_class' } = $message->get("status"); $hash->{'status' } = $message->getStatus; @@ -1261,7 +1262,7 @@ sub www_view { }); $var->{'form_header'} = WebGUI::Form::formHeader($session,{ - action => $self->getUrl("module=inbox;do=deleteMessages") + action => $self->getUrl("module=inbox;do=deleteMessages"), }); $var->{'form_footer'} = WebGUI::Form::formFooter($session); @@ -1377,7 +1378,7 @@ The page on which users view their messages sub www_viewMessage { my $self = shift; my $session = $self->session; - my $user = $session->user; + my $user = $self->getUser; my $var = {}; my $messageId = shift || $session->form->get("messageId"); From 9985f3768f3a0bd0420a0f9eb5ebd5c12a60bc3b Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 13:40:41 -0700 Subject: [PATCH 25/35] Allow groupIdAdminUser to view Inbox messages. --- lib/WebGUI/Inbox.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/WebGUI/Inbox.pm b/lib/WebGUI/Inbox.pm index 4b7d322d0..765848a8a 100644 --- a/lib/WebGUI/Inbox.pm +++ b/lib/WebGUI/Inbox.pm @@ -98,18 +98,22 @@ WebGUI::User object to test against. Defaults to the current user. sub canRead { my $self = shift; + my $session = $self->session; my $message = shift; - my $user = shift || $self->session->user; + my $user = shift || $session->user; unless (ref $message eq "WebGUI::Inbox::Message") { - $self->session->log->warn("Message passed in was either empty or not a valid WebGUI::Inbox::Message. Got: ".(ref $message)); + $session->log->warn("Message passed in was either empty or not a valid WebGUI::Inbox::Message. Got: ".(ref $message)); return 0 } - my $userId = $message->get("userId"); + my $userId = $message->get("userId"); my $groupId = $message->get("groupId"); - return ($user->userId eq $userId || (defined $groupId && $user->isInGroup($groupId))); + return ($user->userId eq $userId + || (defined $groupId && $user->isInGroup($groupId)) + || ($user->isInGroup($session->setting->get('groupIdAdminUser'))) + ); } From 54a8167ea9a5aa4ebf5dd93ef555f76f1695fc96 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 13:56:21 -0700 Subject: [PATCH 26/35] Support for removing all users. --- lib/WebGUI/Account/FriendManager.pm | 8 +++++++- lib/WebGUI/Help/Account_FriendManager.pm | 1 + .../i18n/English/Account_FriendManager.pm | 11 +++++++++++ .../root_import_account_friendmanager.wgpkg | Bin 1968 -> 2069 bytes 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 92f2f5b85..5bfc4e666 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -194,6 +194,7 @@ sub www_editFriends { $var->{username} = $user->username; $var->{userId} = $user->userId; $var->{manageUrl} = $self->getUrl('module=friendManager;do=view'); + $var->{removeAll} = WebGUI::Form::checkbox($session, { name => 'removeAllFriends', value => 'all', }); return $self->processTemplate($var,$session->setting->get("fmEditTemplateId")); } @@ -222,8 +223,13 @@ sub www_editFriendsSave () { $ufriend->add([$userToAdd]); } + ##Remove all has priority, that way we don't delete friends twice. + my $removeAll = $form->process('removeAllFriends','checkbox'); my @usersToRemove = $form->process('friendToAxe', 'checkList'); - if (scalar @usersToRemove) { + if ($removeAll eq 'all') { + $ufriend->delete($user->friends->getUsers()); + } + elsif (scalar @usersToRemove) { $ufriend->delete(\@usersToRemove); } diff --git a/lib/WebGUI/Help/Account_FriendManager.pm b/lib/WebGUI/Help/Account_FriendManager.pm index 6514ed285..3bece6aaf 100644 --- a/lib/WebGUI/Help/Account_FriendManager.pm +++ b/lib/WebGUI/Help/Account_FriendManager.pm @@ -44,6 +44,7 @@ our $HELP = { { name => 'checkForm', }, ], }, + { name => 'removeAll', }, { name => 'submit', required => 1, }, { name => 'formFooter', diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index 612c67bd3..56bac13fa 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -138,6 +138,17 @@ our $I18N = { lastUpdated => 0, }, + 'removeAll' => { + message => q{A checkbox to remove all friends from this user.}, + lastUpdated => 0, + }, + + 'remove all' => { + message => q{Remove all}, + context => q{Template label. To remove all members of a set, to emtpy it.}, + lastUpdated => 0, + }, + 'submit' => { message => q{A button with internationalized label to submit the form.}, lastUpdated => 0, diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index ab0ddd050f5b3651e6678a59addca7627401794e..d8e25e82e6f340e75a5a3c8a2629d83284dcb609 100644 GIT binary patch literal 2069 zcmV+w2vlR_AO2c<$aR~3XAi-a-9M>RSO97Pk0_h2hnGqsVF8 z&@yGtZzSn3qH;pQaxWt{A1Dj?jXAVgPRKdqiKMH?@f$|Odr-;Ka2XMDs|0>caCnKw zW@F<>s(D0?uUJTD2cviphEI@veMe$GBk0o=)23(?ajg0%A|v(Gj>K4uDeI$la+{4L zI1DKp_mOXgK3}mbcH~$9CEi#{qB7K?S01^YzV4lnpJ%L<3_3my-;B$(sff%K1n0`3 zv8JGdgMg<@IU_*{3uDZHIl>_!RpmY^U(+xoY?)?Mo(rzHnkSat6>^RRPm|N|r9MZq zuT`F=NSs7Di;gDV@reN~(TEFlq+s%Th6U1Akl~mdA33lFuAUqpVKfnB^xajXTxKzT zFQVhC#_?~bOzB;Ua)zVFLmW(z;>g|&WtV$0uvfmeaL??OzkPb-V1SiqPz4fzQmh$F zL@`W9XoBUnJyYsoU@!_mC?y~^iY=o78JL;)%P0ve2HEcQsK8E*2Ob(}vIs?-C)r)( zwfhm;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tu>s{#e7#$7%7xq8F(@OPda&w>F=5L!}p=#2-!uf53g&m80dkZV2 z3*P=nU1(agxQ`ae?22v7siwr&N}_ZdIhzGl(D!s3ashWJZz@hLpSPe*P*nR}x&aNx zt~vI&*Us(+z_q(>WiD{GdZ8Jz(qaRnan}!fq)ip{eSAOeXcv5ayd&^E<;bLh#>$bC zJ&g^saMKTkFbxF@^!>pp!pby~=Bp5H(*L=3!osuWo_Mc;dky?t8u%L!qb|DuC;$K? CBHKLx From 03b777ee1ef9415d16ef624356c67c8e66796c32 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Apr 2009 15:54:30 -0700 Subject: [PATCH 27/35] Add button to add all Friend Managers to friends. Help, i18n, template and code. --- lib/WebGUI/Account/FriendManager.pm | 6 ++++++ lib/WebGUI/Help/Account_FriendManager.pm | 3 ++- .../i18n/English/Account_FriendManager.pm | 11 +++++++++++ .../root_import_account_friendmanager.wgpkg | Bin 2069 -> 2130 bytes 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 5bfc4e666..0270dbc34 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -195,6 +195,7 @@ sub www_editFriends { $var->{userId} = $user->userId; $var->{manageUrl} = $self->getUrl('module=friendManager;do=view'); $var->{removeAll} = WebGUI::Form::checkbox($session, { name => 'removeAllFriends', value => 'all', }); + $var->{addManagers} = WebGUI::Form::checkbox($session, { name => 'addManagers', value => 'addManagers', }); return $self->processTemplate($var,$session->setting->get("fmEditTemplateId")); } @@ -222,6 +223,11 @@ sub www_editFriendsSave () { if ($userToAdd) { $ufriend->add([$userToAdd]); } + my $addManagers = $form->process('addManagers', 'checkbox'); + if ($addManagers eq 'addManagers') { + my $managerGroup = WebGUI::Group->new($session, $session->setting->get('groupIdAdminFriends')); + $ufriend->add($managerGroup->getUsers()); + } ##Remove all has priority, that way we don't delete friends twice. my $removeAll = $form->process('removeAllFriends','checkbox'); diff --git a/lib/WebGUI/Help/Account_FriendManager.pm b/lib/WebGUI/Help/Account_FriendManager.pm index 3bece6aaf..06bf30e89 100644 --- a/lib/WebGUI/Help/Account_FriendManager.pm +++ b/lib/WebGUI/Help/Account_FriendManager.pm @@ -44,7 +44,8 @@ our $HELP = { { name => 'checkForm', }, ], }, - { name => 'removeAll', }, + { name => 'removeAll', }, + { name => 'addManagers', }, { name => 'submit', required => 1, }, { name => 'formFooter', diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index 56bac13fa..d80a6d8f7 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -149,6 +149,17 @@ our $I18N = { lastUpdated => 0, }, + 'addManagers' => { + message => q{A checkbox to add all users in the Friend Manager group to this users's list of Friends.}, + lastUpdated => 0, + }, + + 'Add Friend Managers' => { + message => q{Add Friend Managers}, + context => q{Template label. To add all Friend Managers to this list of friends.}, + lastUpdated => 0, + }, + 'submit' => { message => q{A button with internationalized label to submit the form.}, lastUpdated => 0, diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index d8e25e82e6f340e75a5a3c8a2629d83284dcb609..6991502087cab747053dfe53e6107952c9707905 100644 GIT binary patch literal 2130 zcmV-Y2(9-YiwFP!00000|Ls~^bKAHT_VfMSaBzXAX0~-G z)jT3cmn@*Oy-7R@f@jD+{++~pM$p$wrsK^d;#dt)L?-IF9f`4+QZ_{W9klDmj>^r*rSv#0wgqNB^!(eI~B>9-W+3`bAL*uO@KBP$1#3F6tvis#DGeP_k<^YcRo1Fb}p zDwqJ4Vy$~3ieWlIA(mHmPpOAN_s9opmB82}wl)CFz)a{avm~sAWN$aK0&i+Q@Yood zWhml2$<89L^dDx4=x;7FoI!Wg!t%fft+z9-m=Bn032~r$Ws^vcTIalW^N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i>a>(beJl|7wCQGn*xDlAZVhH6ai2_XKP8}RMCj){M9Mmz^JV zr0yYe^hY6hOE&W^G~A$Ji_mO}o=3h5zjF9@g{Nym3q&`z`xrek;x|SZeL_$a=Aw@t z=_n~APtj-eNJ8EjOmtZ!h6N#&P&S$O5oJ0{)GP98kgg1s5w)@MS$NxNssCOaHea;; zUz*?Zf%Jl(ydU3|YwunWn&}*_61DHHB2>-!!N%@uceM}R%BKEBkph|IvZ#YV>cUW7 zg)vh)G1j)VNYsl_NaFQ!ZEZC$8iG|{T6PL`lS;B*m}gy?3f1-MYV@6{KiDMvU?FWf zIKxwNsXg%HdN@z&hrxkBMWO(m6-M#`jVV=BII^AULM74KeRTmcvqNt~bs;Y<==uR# zO|idPb>Rzm+@reSdCf{8`>#=5IPCTg{Z55VyQ(gjGEre-?o?fnH_63^S8Y6*Pk(uS zai->PY4mQvPTi%tP+`e^s|zc{0iHfo7i!bV)%+j)=+-)a79_yf)c^CketRkZ_dD%} z{$DM>wmo>?{67nL%2IFDH~sZ`g9|0#YK#`ummmv6c;^_c3LeUMqJY8^xO#V5B#?mE?2~Tb1+V3D}kCKM()6~(DeM74$O>E zC_Xxs^X}3v35ku4pyX?A3O&Lcift#V3CX$=d8a~m_^ODN75AD(^TuvWdCJB}=>s2r zBmp#JPI#m_Qt(x`u~!-{UkZuxYm~=qh=Tq|C#3{%kMIVJX}NDh2gJ1Ke@CO^u;aBm z-lEjjH#(rBV4BPugspp6;=0pdLu=z8N+x(n6!f&B$o@w|Mb;Oa9e*SoStigzICB2X z*quV%%u7X06G54&A6)2+HP@u|B!vH@dgzpF+f6>4_dtQaB?bNu3i=k`04e|gJzx6Q From d13d1bac8c51bb20714d418b7ae646998ec91e6d Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 9 Apr 2009 16:02:58 -0700 Subject: [PATCH 28/35] Group filters and list of names. For each group, show all other managed groups. Also provide an edit all link. Show list of names up to 45 characters, with no truncation. --- lib/WebGUI/Account/FriendManager.pm | 32 ++++++++++++--- .../build/friendManager/friendManager.js | 40 ++++++++++--------- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 0270dbc34..b44658d19 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -182,7 +182,7 @@ sub www_editFriends { $var->{formHeader} = WebGUI::Form::formHeader($session, { action => $self->getUrl('module=friendManager;do=editFriendsSave'), }) - . WebGUI::Form::hidden($session, { name => 'userId', value => $userId } ); + . WebGUI::Form::hidden($session, { name => 'userId', value => $user->userId } ); $var->{addUserForm} = WebGUI::Form::selectBox($session, { name => 'userToAdd', options => \%usersToAdd, @@ -269,14 +269,36 @@ sub www_getFriendsAsJson { return '{}'; } my @records = (); + my $groups = $session->setting->get('groupsToManageFriends'); + my @groupIds = split "\n", $groups; + @groupIds = grep { $_ ne $groupId } @groupIds; + my $groupNames = join "\n", + map { $_->name } + map { WebGUI::Group->new($session, $_) } + @groupIds; USER: foreach my $userId (@{ $group->getUsers} ) { my $user = WebGUI::User->new($session, $userId); next USER unless $user; - my $friendsCount = scalar @{ $user->friends->getUsers() }; + my $friendsList = $user->friends->getUserList(); + my $friendsCount = scalar keys %{ $friendsList }; + my $friends = ''; + NAME: foreach my $name ( values %{ $friendsList }) { + if (length $friends + length $name < 45) { + if ($friends) { + $friends .= ', '; + } + $friends .= $name; + } + else { + last NAME; + } + } push @records, { - userId => $userId, - username => $user->username, - friends => $friendsCount, + userId => $userId, + username => $user->username, + friendsCount => $friendsCount, + friends => $friends, + groups => $groupNames, }; } ##Sort by username to make the datatable happy diff --git a/www/extras/yui-webgui/build/friendManager/friendManager.js b/www/extras/yui-webgui/build/friendManager/friendManager.js index c318ac299..f439b51f7 100644 --- a/www/extras/yui-webgui/build/friendManager/friendManager.js +++ b/www/extras/yui-webgui/build/friendManager/friendManager.js @@ -40,9 +40,11 @@ WebGUI.FriendManager.responseSchema = { resultsList: 'records', fields: [ - { key: 'userId', parser: 'string' }, - { key: 'username', parser: 'string' }, - { key: 'friends', parser: 'number' }, + { key: 'userId', parser: 'string' }, + { key: 'username', parser: 'string' }, + { key: 'friendsCount', parser: 'number' }, + { key: 'friends', parser: 'string' }, + { key: 'groups', parser: 'string' }, ], metaFields: { totalRecords: "recordsReturned" // Access to value in the server response @@ -50,27 +52,29 @@ WebGUI.FriendManager.responseSchema }; WebGUI.FriendManager.formatUsername = function ( el, oRecord, oColumn, oData ) { -// var link = document.createElement('a'); -// var myId = YAHOO.util.Dom.generateId(); -// elCell.innerHTML = ''; -// var editButton = new YAHOO.widget.Button( myId, -// { -// type : "link", -// href : "?op=account;module=friendManager;do=editFriends;uid="+oRecord.getData('userId'), -// label : "EDIT", -// } -// ); var userId = oRecord.getData('userId'); - el.innerHTML = 'edit '; - el.innerHTML += '' + oData + ''; + el.innerHTML = '' + oData + ''; +} + +WebGUI.FriendManager.formatGroups = function ( el, oRecord, oColumn, oData ) { + var userId = oRecord.getData('userId'); + el.innerHTML = 'Edit all'; + var groups = oData.split("\n"); + for (var idx=0; idx < groups.length; idx++) { + var group = groups[idx]; + el.innerHTML += ' '; + el.innerHTML += ''+group+''; + } } WebGUI.FriendManager.ColumnDefs = [ // sortable:true enables sorting //{key:"username", label:WebGUI.FriendManager.i18n.get('WebGUI', '50' ), sortable: true}, //{key:"friends", label:WebGUI.FriendManager.i18n.get('Account_Friends', 'title' ), sortable: true}, - {key:"username", label:"username", sortable: true, formatter: WebGUI.FriendManager.formatUsername }, - {key:"friends", label:"friends", sortable: true}, - {key:"userId", label:"userId", sortable: true}, + {key:"groups", label:"groups", sortable: false, formatter: WebGUI.FriendManager.formatGroups }, + {key:"username", label:"username", sortable: true, formatter: WebGUI.FriendManager.formatUsername }, + {key:"friendsCount", label:"friendsCount", sortable: true}, + {key:"friends", label:"friends", sortable: false}, + {key:"userId", label:"userId", sortable: true}, ]; //Per object code From c6468321c159cef7f6da6f4a8aa5fce36d8d328e Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 9 Apr 2009 16:30:20 -0700 Subject: [PATCH 29/35] Pass groupName down to editFriends. Do not display add managers if a groupname is passed. --- lib/WebGUI/Account/FriendManager.pm | 24 +++++++++++++----- .../root_import_account_friendmanager.wgpkg | Bin 2130 -> 2210 bytes .../build/friendManager/friendManager.js | 5 ++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index b44658d19..ff37b33cb 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -133,6 +133,8 @@ sub www_editFriends { my $userId = shift || $form->get('userId', 'guid'); my $user = WebGUI::User->new($session, $userId); + my $groupName = shift || $form->get('groupName'); + ##List users in my friends group. Each friend gets a delete link. my $friendsList = $user->friends->getUserList(); my @friends_loop = (); @@ -149,14 +151,20 @@ sub www_editFriends { ##List users in all administrated groups. Friends are added one at a time. my @manageableUsers = (); - my $groupIds = $session->setting->get('groupsToManageFriends'); - my @groupIds = split "\n", $groupIds; - foreach my $groupId (@groupIds) { - my $group = WebGUI::Group->new($session, $groupId); - next GROUP unless $group->getId || $group->getId eq 'new'; + if ($groupName) { + my $group = WebGUI::Group->find($session, $groupName); push @manageableUsers, @{ $group->getUsersNotIn($user->{_user}->{'friendsGroup'}, 'withoutExpired') }; } - @manageableUsers = uniq @manageableUsers; + else { + my $groupIds = $session->setting->get('groupsToManageFriends'); + my @groupIds = split "\n", $groupIds; + foreach my $groupId (@groupIds) { + my $group = WebGUI::Group->new($session, $groupId); + next GROUP unless $group->getId || $group->getId eq 'new'; + push @manageableUsers, @{ $group->getUsersNotIn($user->{_user}->{'friendsGroup'}, 'withoutExpired') }; + } + @manageableUsers = uniq @manageableUsers; + } my %usersToAdd = (); tie %usersToAdd, 'Tie::IxHash'; my $manager = $session->user; @@ -195,7 +203,9 @@ sub www_editFriends { $var->{userId} = $user->userId; $var->{manageUrl} = $self->getUrl('module=friendManager;do=view'); $var->{removeAll} = WebGUI::Form::checkbox($session, { name => 'removeAllFriends', value => 'all', }); - $var->{addManagers} = WebGUI::Form::checkbox($session, { name => 'addManagers', value => 'addManagers', }); + if (! $groupName) { + $var->{addManagers} = WebGUI::Form::checkbox($session, { name => 'addManagers', value => 'addManagers', }); + } return $self->processTemplate($var,$session->setting->get("fmEditTemplateId")); } diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index 6991502087cab747053dfe53e6107952c9707905..403432270ba96782b324d7e93c31f14246cb8bc7 100644 GIT binary patch literal 2210 zcmV;T2wnFdiwFP!00000|Ls~^bK5o+_H%y)MtNvD6PqF>QMTfGM!7h4Qpe8PX|}0b z4@5!|VhZ2_kZf%x|9uYt-b9g#yd!(kHhPd~0K_>s_w&I!TlfEIHk;jUXKPFU`fc;; zw&53LpXQe9x_-CQ^gOSHEZip(o|IuHcI%(JJ@*DG3GoO%i#$!pB>5y9`@Dah`1s<8%#=cbZ zh#Xw9kj{37lYSUJLH6-qWWr|zeZFKm-V7s-RS!jEsGi!92^J&DdZ-iMCL=KpL&`=y z)G|X~F4-m9cPxRNIex>4cn@LWI4qxbDk3u^I9CpxXmL3>2>6sKXDBFP;RG`fxNt~F zRlX&blBi_6=#@uquaEW)$!{~(j{AO#hHpptS}M;3S6t0wE7yY9s63)!NLX2%Bf+Qf zarjcx)cR@XyD2h>qf|xvWAEV5uqn}y3$(9b@@j?!(ovA%2|3tzU=2tmKG?@-EXeTZ z%SOJ;p6hUpNEvAnW-N<9p^M*&!?1jdFFYXiUx%#2%QmV~vCoP`HD)4`Yo*N4D497ly_QE|E;SUc+|vxj3&y<%U>dq0Yb`<6tW zoDYMe){41AH9eyPa@5RPKIl+CFNzjCtxm4sMhJX66;D0!M6juq!F$@TjI^}C^*Cr4 zh7-Fm8jj0q1Wu4OAC#`EBiSq1baC6n)QYD~C7@4jLI4<45D_eT1Fpt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git a/www/extras/yui-webgui/build/friendManager/friendManager.js b/www/extras/yui-webgui/build/friendManager/friendManager.js index f439b51f7..126d4adb0 100644 --- a/www/extras/yui-webgui/build/friendManager/friendManager.js +++ b/www/extras/yui-webgui/build/friendManager/friendManager.js @@ -61,9 +61,10 @@ WebGUI.FriendManager.formatGroups = function ( el, oRecord, oColumn, oData ) { el.innerHTML = 'Edit all'; var groups = oData.split("\n"); for (var idx=0; idx < groups.length; idx++) { - var group = groups[idx]; + var group = groups[idx]; + var groupUri = encodeURI(group); el.innerHTML += ' '; - el.innerHTML += ''+group+''; + el.innerHTML += ''+group+''; } } From 1f5a83d0c6f38f44fa68a0a3423b2cda839ac87b Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 9 Apr 2009 16:43:41 -0700 Subject: [PATCH 30/35] Maintain group filter setting after saving. --- lib/WebGUI/Account/FriendManager.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index ff37b33cb..571a127fe 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -191,6 +191,9 @@ sub www_editFriends { action => $self->getUrl('module=friendManager;do=editFriendsSave'), }) . WebGUI::Form::hidden($session, { name => 'userId', value => $user->userId } ); + if ($groupName) { + $var->{formHeader} .= WebGUI::Form::hidden($session, { name => 'groupName', value => $groupName }); + } $var->{addUserForm} = WebGUI::Form::selectBox($session, { name => 'userToAdd', options => \%usersToAdd, @@ -249,7 +252,8 @@ sub www_editFriendsSave () { $ufriend->delete(\@usersToRemove); } - return $self->www_editFriends($userId); + my $groupName = $form->process('groupName'); + return $self->www_editFriends($userId, $groupName); } #------------------------------------------------------------------- From a5c7e2b39b02088af11d8631724916b7bf5e6548 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 9 Apr 2009 17:22:07 -0700 Subject: [PATCH 31/35] Fix JS errors, add ableToBeFriend profile override. --- lib/WebGUI/Account/FriendManager.pm | 14 +++++++++++--- .../i18n/English/Account_FriendManager.pm | 10 ++++++++++ sbin/installFriendManager.pl | 1 + .../root_import_account_friendmanager.wgpkg | Bin 2210 -> 2126 bytes .../build/friendManager/friendManager.js | 3 +++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 571a127fe..809c52959 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -91,6 +91,12 @@ sub editSettingsForm { label => $i18n->get("edit template label"), hoverHelp => $i18n->get("edit template hoverHelp"), ); + $f->yesNo( + name => "overrideAbleToBeFriend", + value => $self->session->setting->get("overrideAbleToBeFriend"), + label => $i18n->get("override abletobefriend label"), + hoverHelp => $i18n->get("override abletobefriend hoverHelp"), + ); return $f->printRowsOnly; } @@ -112,8 +118,9 @@ sub editSettingsFormSave { $setting->set("fmViewTemplateId", $form->process("fmViewTemplateId", "template")); $setting->set("fmEditTemplateId", $form->process("fmEditTemplateId", "template")); my $groupsToManageFriends = $form->process("groupsToManageFriends", "group"); - $setting->set("groupsToManageFriends", $groupsToManageFriends); - $setting->set("groupIdAdminFriends", $form->process("groupIdAdminFriends", "group")); + $setting->set("groupsToManageFriends", $groupsToManageFriends); + $setting->set("groupIdAdminFriends", $form->process("groupIdAdminFriends", "group")); + $setting->set("overrideAbleToBeFriend", $form->process("overrideAbleToBeFriend", "yesNo")); } #------------------------------------------------------------------- @@ -171,13 +178,14 @@ sub www_editFriends { my $i18n = WebGUI::International->new($session); $usersToAdd{0} = $i18n->get('Select One'); my @usersToAdd = (); + my $overrideProfile = $session->setting->get('overrideAbleToBeFriend'); USERID: foreach my $newFriendId (@manageableUsers) { next USERID if $newFriendId eq $userId; my $user = WebGUI::User->new($session, $newFriendId); ##We don't use acceptsFriendsRequests here because it's overkill. ##No need to check invitations, since friends are managed. ##Existing friends are already filtered out. - next USERID unless $user->profileField('ableToBeFriend'); + next USERID unless $user->profileField('ableToBeFriend') || $overrideProfile; push @usersToAdd, [ $newFriendId, $user->username ]; } diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index d80a6d8f7..ead739a8b 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -43,6 +43,16 @@ our $I18N = { lastUpdated => 0, }, + 'override abletobefriend label' => { + message => q{Override ableToBeFriend profile setting?}, + lastUpdated => 0, + }, + + 'override abletobefriend hoverHelp' => { + message => q{If a user has set their ableToBeFriend profile option to 'No', then the Friend Manager will not display them as a friend to be added. If this option is set to Yes, then the Friend Manager will allow managing them.}, + lastUpdated => 0, + }, + 'title' => { message => q{Friend Manager}, lastUpdated => 0, diff --git a/sbin/installFriendManager.pl b/sbin/installFriendManager.pl index bc1f6e54b..bdfb04dbe 100644 --- a/sbin/installFriendManager.pl +++ b/sbin/installFriendManager.pl @@ -47,6 +47,7 @@ sub installFriendManagerSettings { $session->setting->add('fmViewTemplateId', '64tqS80D53Z0JoAs2cX2VQ'); $session->setting->add('fmEditTemplateId', 'lG2exkH9FeYvn4pA63idNg'); $session->setting->add('groupsToManageFriends', '2'); + $session->setting->add('overrideAbleToBeFriend', 0); print "\tDone"; } diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index 403432270ba96782b324d7e93c31f14246cb8bc7..dd4d8d933a9e89e09f4d728b69cea3d79bae72bd 100644 GIT binary patch literal 2126 zcmV-U2(kAciwFP!00000|Lq!SbK5r7pZhB?%7>&gu_%!`EXDPVV#kTQan@NoO|y0D zfk;R~OaWW~l&xm+-}eFF0iBVvvZvXGA1E5vdwBQZ>dyT?wOXy+Ztm>p-&Vu?)*JAP zil??yuh(1cX1&%3nmedould0af-U#|q*7r4sD(VH?0Pl4R1zUqPwUIUV=iZY*DU=j zO&P4~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Dc%3I zd>HzE|Mvg@z+L Date: Thu, 9 Apr 2009 20:06:15 -0700 Subject: [PATCH 32/35] Add script for user priming. --- sbin/addUsersForTesting.pl | 132 +++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 sbin/addUsersForTesting.pl diff --git a/sbin/addUsersForTesting.pl b/sbin/addUsersForTesting.pl new file mode 100644 index 000000000..cf637f191 --- /dev/null +++ b/sbin/addUsersForTesting.pl @@ -0,0 +1,132 @@ +#!/usr/bin/env perl + +#------------------------------------------------------------------- +# Copyright 2009 SDH Corporation. +#------------------------------------------------------------------- + +$|++; # disable output buffering +our ($webguiRoot, $configFile, $help, $man); + +BEGIN { + $webguiRoot = ".."; + unshift (@INC, $webguiRoot."/lib"); +} + +use strict; +use Pod::Usage; +use Getopt::Long; +use WebGUI::Session; +use WebGUI::Utility; + +# Get parameters here, including $help +GetOptions( + 'configFile=s' => \$configFile, + 'help' => \$help, + 'man' => \$man, +); + +pod2usage( verbose => 1 ) if $help; +pod2usage( verbose => 2 ) if $man; +pod2usage( msg => "Must specify a config file!" ) unless $configFile; + +my $session = start( $webguiRoot, $configFile ); + +my $inmates = WebGUI::Group->new($session, 'new'); +$inmates->name("Inmates"); + +my $staff = WebGUI::Group->new($session, 'new'); +$staff->name("Corrections Staff"); + +my @inmateNames = qw/Red Andy Bogs Brooks Tommy Heywood/; +my @staffNames = qw/Norton Hadley Trout/; + +foreach my $con (@inmateNames) { + my $user = WebGUI::User->create($session); + $user->username($con); + $user->addToGroups([$inmates->getId]); +} + +foreach my $guy (@staffNames) { + my $user = WebGUI::User->create($session); + $user->username($guy); + $user->addToGroups([$staff->getId]); +} + +# Do your work here +finish($session); + +#---------------------------------------------------------------------------- +sub start { + my $webguiRoot = shift; + my $configFile = shift; + my $session = WebGUI::Session->open($webguiRoot,$configFile); + $session->user({userId=>3}); + + ## If your script is adding or changing content you need these lines, otherwise leave them commented + # + # my $versionTag = WebGUI::VersionTag->getWorking($session); + # $versionTag->set({name => 'Name Your Tag'}); + # + ## + + return $session; +} + +#---------------------------------------------------------------------------- +sub finish { + my $session = shift; + + ## If your script is adding or changing content you need these lines, otherwise leave them commented + my $versionTag = WebGUI::VersionTag->getWorking($session); + $versionTag->commit; + + $session->var->end; + $session->close; +} + +__END__ + + +=head1 NAME + +utility - A template for WebGUI utility scripts + +=head1 SYNOPSIS + + utility --configFile config.conf ... + + utility --help + +=head1 DESCRIPTION + +This WebGUI utility script helps you... + +=head1 ARGUMENTS + +=head1 OPTIONS + +=over + +=item B<--configFile config.conf> + +The WebGUI config file to use. Only the file name needs to be specified, +since it will be looked up inside WebGUI's configuration directory. +This parameter is required. + +=item B<--help> + +Shows a short summary and usage + +=item B<--man> + +Shows this document + +=back + +=head1 AUTHOR + +Copyright 2001-2008 Plain Black Corporation. + +=cut + +#vim:ft=perl From 8f5e9aac1fa58b65de329f6498cb211fd84da299 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 10 Apr 2009 10:04:43 -0700 Subject: [PATCH 33/35] Change display of groups on manage friends screen If 1 group, display it. If more than 1, display all groups but this one. --- lib/WebGUI/Account/FriendManager.pm | 6 ++++-- www/extras/yui-webgui/build/friendManager/friendManager.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 809c52959..2038b0b47 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -293,7 +293,9 @@ sub www_getFriendsAsJson { my @records = (); my $groups = $session->setting->get('groupsToManageFriends'); my @groupIds = split "\n", $groups; - @groupIds = grep { $_ ne $groupId } @groupIds; + if (scalar @groupIds > 1) { + @groupIds = grep { $_ ne $groupId } @groupIds; + } my $groupNames = join "\n", map { $_->name } map { WebGUI::Group->new($session, $_) } @@ -341,7 +343,7 @@ sub www_getFriendsAsJson { =head2 www_view ( ) -The main view page for editing the user's profile. +The main view page for editing the user's friends. =cut diff --git a/www/extras/yui-webgui/build/friendManager/friendManager.js b/www/extras/yui-webgui/build/friendManager/friendManager.js index 0aabf67e9..b44537dcb 100644 --- a/www/extras/yui-webgui/build/friendManager/friendManager.js +++ b/www/extras/yui-webgui/build/friendManager/friendManager.js @@ -61,12 +61,14 @@ WebGUI.FriendManager.formatUsername = function ( el, oRecord, oColumn, oData ) { WebGUI.FriendManager.formatGroups = function ( el, oRecord, oColumn, oData ) { var userId = oRecord.getData('userId'); - el.innerHTML = 'Edit all'; + el.innerHTML = ''; var groups = oData.split("\n"); for (var idx=0; idx < groups.length; idx++) { var group = groups[idx]; var groupUri = encodeURI(group); - el.innerHTML += ' '; + if (el.innerHTML) { + el.innerHTML += ' '; + } el.innerHTML += ''+group+''; } } From ad025a26a1ad49a9dbce5330746032506b90e840 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 10 Apr 2009 10:18:35 -0700 Subject: [PATCH 34/35] Move view all users filter into edit friends. --- lib/WebGUI/Account/FriendManager.pm | 4 ++++ .../i18n/English/Account_FriendManager.pm | 5 +++++ .../root_import_account_friendmanager.wgpkg | Bin 2126 -> 2226 bytes 3 files changed, 9 insertions(+) diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 2038b0b47..44bcf36e9 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -217,6 +217,10 @@ sub www_editFriends { if (! $groupName) { $var->{addManagers} = WebGUI::Form::checkbox($session, { name => 'addManagers', value => 'addManagers', }); } + if ($groupName) { + $var->{groupName} = $groupName; + $var->{viewAllUrl} = $self->getUrl('module=friendManager;do=editFriends;userId='.$userId); + } return $self->processTemplate($var,$session->setting->get("fmEditTemplateId")); } diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index ead739a8b..fd54a01f8 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -180,6 +180,11 @@ our $I18N = { lastUpdated => 0, }, + 'view users from all groups' => { + message => q{View users from all groups.}, + lastUpdated => 0, + }, + }; 1; diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index dd4d8d933a9e89e09f4d728b69cea3d79bae72bd..f3015ae421e161e616eef7df537a677aa02ac2b4 100644 GIT binary patch literal 2226 zcmV;j2u=4NiwFP!00000|Ls~?bKABS_H%y)MtMjwV~g5l$*yOV#j$(i)Qz3Ei`xuD zLK0#UU;$9Jn#q5^2LM-zl$Vh^Z6|t=XaK}HIQw_t`qtxr8jVK3-`(2MzrBw6ZFb-n zrJu%Dv)SzRd;NZ=(cePNW~0;CLh#DteS=vA_?W|)-!)7B zNmGXFX7=6fn&(#iv*c_;jKYq+Snp-}?||Ny^xtW>dRqvj`S_p5(trK&S>FVOFW-R^ z)}-PBPe~08(Qm(Ro1swfkO)PI)T3sZUg=}0Uf+aVDB_LG6pMV{yrQRFK`_j`Sm>8( z?OHkkUZ%|cwJ;j{RL+Q(O)_$QL7B&|&0CFZLM|8&C0(UMZj``B1bgRrYG!NuQZ0OP zaLGJ6uTO%J=WQeV_?`rOPSBT2rsK`T=U5GqPbO;5js#dtDI210coUC=*z+ix4pG|- zeZ6FtY~Qg2GUoU-BjN*ug=25|w2|=5klx83Tn|kl2*;*=31y@`xLMzvt*r+_Bo=4cSIH!U~;j#Bx z)71LuWVC8k?vV@DDuJ;{U~K@Hftgu*nI&N@B!0V^6?jwgfyc(sEJHr$ zVSE<(N&jJ%SkAnIjA?g9+^a+29FC(rvnW5E6Re$el-a{Er(UzK<$dJ)`F)o}9-j|` zqgIM}iE4622jr-kwS3TtelCg@JgrKu;6@01I}uMc@mR3h%0QFGOy6lM17hK_vdrxE z1sT8jaQu94m^04oy*eth$~h(1AgFS))RV@%!Q=%G5D3dMBCFX>O*1c@)J);@IyxAg zYqN<@2g9*-8#`S&AIK9~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(5;jj~CB){5$%|)FqbgJH^-JLVM;X%i%v=J`9e9 zEj@1?9@Qf-La`Eyxrd9OiGQl;C844^c|+ zgQinMo-ZY2dX99l04?Uz+bbnFw_a9C_yQhxC?)totyA*sTPY>@vuwJrQi7=o71nH{ zQi5o`4*dQuCWGTa^1;WuEWSE*OzCE&1c&{1FD2BPwN`V6r{7X3VKM&)Kf1NfpUq$a z#=8EW--e#=Z2vcCHNN-%9wPnUxoiHP1w3W3)zO`Aus1kUgmq)IczF@9uudDtXr*P4 z(AoQ^fUcFPYxd3$%c+^j&7tU;UY;)bLMDHRp|Ny9$AqW0b{w>7PH8xEkwwR^?w3GK z5hM4iS!jCpTnA>xC={=jbKWKmi-_2e1&XfbrqCnIq1bk!8j-m^jc&WRh?O<(C5`5_ z{gCpMwc*Qq-v3BKXo(#2SaYP{t8Qa|b<3kXW=&}Fzw|On0C$Kv0@ppQ=|Pwl{a3Ua z_F8_k<T=X^i7j_jj*-%$~$fp0eo#UL2F|#PDZ#-6m*s1*#1X@BkNmhH!Kin zrrmJ%+}NE$-OPuhriq};bH3`9!{-5?L9>gJj2lAZ)e Date: Fri, 10 Apr 2009 15:05:14 -0700 Subject: [PATCH 35/35] I18n the javascript. --- .../i18n/English/Account_FriendManager.pm | 5 ++ .../root_import_account_friendmanager.wgpkg | Bin 2226 -> 2295 bytes .../build/friendManager/friendManager.js | 67 ++++++++++-------- 3 files changed, 42 insertions(+), 30 deletions(-) diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index fd54a01f8..4fbc13e42 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -185,6 +185,11 @@ our $I18N = { lastUpdated => 0, }, + 'friends count' => { + message => q{Friends Count}, + lastUpdated => 0, + }, + }; 1; diff --git a/sbin/packages/root_import_account_friendmanager.wgpkg b/sbin/packages/root_import_account_friendmanager.wgpkg index f3015ae421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U{gH_!9=GaxKFzaN(&7GRr(g9-r-hezipZ&$@hmvgBny?P36dV9kJONI6lVPTm}y_LLdp@> z`AUY^wPK9}pks9zdzfQVVrnsjxndEj(-JxgPviVNzj-@2z4&$Xx-%y?ql=FxKZX}k zAwQojB&1by-rPAs|E7K_vj8K5M6|Ws8BATZBAn)+H^?mlor32j6 zIr=L#yrr0V7a6Ycup%`J(UYpJ@K-|ruJm-fs33F`yARM4V}4VF(H8_wVJ?Q~iLR17 zvWLE+ClWA|JJW5E02X*uLfd39M3iZSqgN!2BHc8~>QfWtOoXrT6PS5lN?Y@!?Q&&^+HKsH$EqSd%C*E)8Ene zrY}+Y-U+@U=Q=Y#E2qC*J`9P4mF~BWkNPVJM21*>Mm_S9`%%E2J=M*iWACZn5`<#X zoEA&57i8diPWhVw;W;>QPney@c&q*23J~6E^at4)mXUVs=SZV+w2DO6VD@T|T?)^0 z@T?3=-@=DJc_lV4g8Ejwkvs3d1%$U+?QX6Y@mL_-G+*uq!Y^8lAMnxQ1HV)`Ii_jmd<@UQvtKTEGWPx_2IVoJ>BvkBmqMDJV8xDP8k!K8Az?I$q^*0IGE^Et| z3qJl#T(~Yc^>cSJcWT2wv;xrHIP$|89uoyOHNJ2EWg%zl8>R diff --git a/www/extras/yui-webgui/build/friendManager/friendManager.js b/www/extras/yui-webgui/build/friendManager/friendManager.js index b44537dcb..dad4ad717 100644 --- a/www/extras/yui-webgui/build/friendManager/friendManager.js +++ b/www/extras/yui-webgui/build/friendManager/friendManager.js @@ -1,7 +1,5 @@ -/*** The WebGUI Asset History Viewer +/*** The WebGUI Friend Manager * Requires: YAHOO, Dom, Event - * With all due credit to Doug Bell, who wrote the AssetManager. FriendManager - * is a blatant copy/paste/modify of it. */ //Container for functions used by many datatables. @@ -17,24 +15,29 @@ if ( typeof WebGUI.FriendManager.tables == "undefined" ) { /*--------------------------------------------------------------------------- WebGUI.FriendManager.initManager ( ) - Initialize the i18n interface -WebGUI.FriendManager.initManager = function (o) { - WebGUI.FriendManager.i18n - = new WebGUI.i18n( { - namespaces : { - 'WebGUI' : [ - "50", - ], - 'Account_Friends' : [ - "title", - ] - }, - onpreload : { - fn : WebGUI.FriendManager.init - } - } ); -}; + Initialize the i18n interface, and then call the function to build + the DataTables. */ +WebGUI.FriendManager.initI18N = function (o) { + WebGUI.FriendManager.i18n + = new WebGUI.i18n( { + namespaces : { + "WebGUI" : [ + "50", + "89", + ], + "Account_Friends" : [ + "title", + ], + "Account_FriendManager" : [ + "friends count", + ] + }, + onpreload : { + fn : WebGUI.FriendManager.initTables + } + } ); +}; /*--------------------------------------------------------------------------- Initialize objects that are shared across many datatables. @@ -73,21 +76,25 @@ WebGUI.FriendManager.formatGroups = function ( el, oRecord, oColumn, oData ) { } } -WebGUI.FriendManager.ColumnDefs = [ // sortable:true enables sorting - //{key:"username", label:WebGUI.FriendManager.i18n.get('WebGUI', '50' ), sortable: true}, - //{key:"friends", label:WebGUI.FriendManager.i18n.get('Account_Friends', 'title' ), sortable: true}, - {key:"groups", label:"groups", sortable: false, formatter: WebGUI.FriendManager.formatGroups }, - {key:"username", label:"username", sortable: true, formatter: WebGUI.FriendManager.formatUsername }, - {key:"friendsCount", label:"friendsCount", sortable: true}, - {key:"friends", label:"friends", sortable: false}, - {key:"userId", label:"userId", sortable: true}, -]; - //Per object code WebGUI.FriendManager.MakeTable = function (groupId, containerId) { var that = this; + if (typeof WebGUI.FriendManager.ColumnDefs == "undefined" ) { + WebGUI.FriendManager.ColumnDefs = [ // sortable:true enables sorting + { key:"groups", sortable: false, formatter: WebGUI.FriendManager.formatGroups, + label:WebGUI.FriendManager.i18n.get('WebGUI', '89' ), }, + { key:"username", sortable: true, formatter: WebGUI.FriendManager.formatUsername, + label:WebGUI.FriendManager.i18n.get('WebGUI', '50' ), }, + { key:"friendsCount", sortable: true, + label:WebGUI.FriendManager.i18n.get('Account_FriendManager', 'friends count' ), }, + { key:"friends", sortable: false, + label:WebGUI.FriendManager.i18n.get('Account_Friends', 'title' ), }, + { key:"userId", label:"userId", sortable: true}, + ]; + } + // Initialize the data table var myPaginator = new YAHOO.widget.Paginator({ containers : ['pagination'],