From 74d1be77992bad16c56b2c3a13557eb7fc65f4cb Mon Sep 17 00:00:00 2001 From: Patrick Donelan Date: Tue, 28 Jul 2009 05:00:09 +0000 Subject: [PATCH] fixed #10706: FriendManager Style/Layout template options --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.7.16-7.7.17.pl | 8 +++ lib/WebGUI/Account/FriendManager.pm | 54 ++++++++++++++++--- .../i18n/English/Account_FriendManager.pm | 20 +++++++ 4 files changed, 77 insertions(+), 6 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6a3340a8e..a7f0e36c6 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -10,6 +10,7 @@ - fixed #10704: Commit version tag from AdminBar is not working - fixed #10510: Product Thumbnails overlap Controls - fixed #10705: 7.7.2 upgrade script (sometimes) removes a table that the 7.7.7 upgrade script assumes is present + - fixed #10706: FriendManager Style/Layout template options 7.7.16 - fixed #10590: Session::DateTime->secondsToInterval doesn't allow 7 weeks diff --git a/docs/upgrades/upgrade_7.7.16-7.7.17.pl b/docs/upgrades/upgrade_7.7.16-7.7.17.pl index a34691af5..eeca9facf 100644 --- a/docs/upgrades/upgrade_7.7.16-7.7.17.pl +++ b/docs/upgrades/upgrade_7.7.16-7.7.17.pl @@ -31,6 +31,7 @@ my $quiet; # this line required my $session = start(); # this line required # upgrade functions go here +addFriendManagerSettings($session); finish($session); # this line required @@ -44,6 +45,13 @@ finish($session); # this line required # print "DONE!\n" unless $quiet; #} +sub addFriendManagerSettings { + my $session = shift; + print "\tAdding Friend Manager Style and Layout template settings... " unless $quiet; + $session->setting->add('fmStyleTemplateId', $session->setting->get("userFunctionStyleId")); + $session->setting->add('fmLayoutTemplateId', 'N716tpSna0iIQTKxS4gTWA'); + print "DONE!\n" unless $quiet; +} # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- diff --git a/lib/WebGUI/Account/FriendManager.pm b/lib/WebGUI/Account/FriendManager.pm index 44bcf36e9..1e387e897 100644 --- a/lib/WebGUI/Account/FriendManager.pm +++ b/lib/WebGUI/Account/FriendManager.pm @@ -50,6 +50,33 @@ sub canView { #------------------------------------------------------------------- +=head2 getLayoutTemplateId ( ) + +Returns the template Id for the account layout. See L. + +=cut + +sub getLayoutTemplateId { + my $self = shift; + return $self->session->setting->get("fmLayoutTemplateId") || $self->SUPER::getLayoutTemplateId; +} + + +#------------------------------------------------------------------- + +=head2 getStyleTemplateId ( ) + +Returns the template Id for the main style. See L. + +=cut + +sub getStyleTemplateId { + my $self = shift; + return $self->session->setting->get("fmStyleTemplateId") || $self->SUPER::getStyleTemplateId; +} + +#------------------------------------------------------------------- + =head2 editSettingsForm ( ) Creates form elements for the settings page custom to this account module. @@ -62,6 +89,20 @@ sub editSettingsForm { my $i18n = WebGUI::International->new($session,'Account_FriendManager'); my $f = WebGUI::HTMLForm->new($session); + $f->template( + name => "fmStyleTemplateId", + value => $self->getStyleTemplateId, + namespace => "style", + label => $i18n->get("style template label"), + hoverHelp => $i18n->get("style template hoverHelp"), + ); + $f->template( + name => "fmLayoutTemplateId", + value => $self->getLayoutTemplateId, + namespace => "Account/Layout", + label => $i18n->get("layout template label"), + hoverHelp => $i18n->get("layout template hoverHelp"), + ); $f->group( name => "groupIdAdminFriends", value => $session->setting->get('groupIdAdminFriends'), @@ -115,12 +156,13 @@ sub editSettingsFormSave { my $setting = $session->setting; my $form = $session->form; - $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("overrideAbleToBeFriend", $form->process("overrideAbleToBeFriend", "yesNo")); + $setting->set( "fmStyleTemplateId", $form->process( "fmStyleTemplateId", "template" ) ); + $setting->set( "fmLayoutTemplateId", $form->process( "fmLayoutTemplateId", "template" ) ); + $setting->set( "fmViewTemplateId", $form->process( "fmViewTemplateId", "template" ) ); + $setting->set( "fmEditTemplateId", $form->process( "fmEditTemplateId", "template" ) ); + $setting->set( "groupsToManageFriends", $form->process( "groupsToManageFriends", "group" ) ); + $setting->set( "groupIdAdminFriends", $form->process( "groupIdAdminFriends", "group" ) ); + $setting->set( "overrideAbleToBeFriend", $form->process( "overrideAbleToBeFriend", "yesNo" ) ); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/i18n/English/Account_FriendManager.pm b/lib/WebGUI/i18n/English/Account_FriendManager.pm index 4fbc13e42..c504d6700 100644 --- a/lib/WebGUI/i18n/English/Account_FriendManager.pm +++ b/lib/WebGUI/i18n/English/Account_FriendManager.pm @@ -12,6 +12,26 @@ our $I18N = { message => q{Group to manage friends, to assign people to one another and to view the interface for managing friends.}, lastUpdated => 0, }, + + 'style template label' => { + message => q|Style Template|, + lastUpdated => 0 + }, + + 'style template hoverHelp' => { + message => q|Select a style template from the list to enclose the Friend Manager tab in.|, + lastUpdated => 0 + }, + + 'layout template label' => { + message => q|Layout Template|, + lastUpdated => 0 + }, + + 'layout template hoverHelp' => { + message => q{Choose a layout template in which to enclose the content from the various methods within the Friend Manager tab}, + lastUpdated => 0 + }, 'view template label' => { message => q{View Template},