From 96ee5575868e8a0b00ec0fe6defd7d2970223bde Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 11 Apr 2011 15:48:15 -0700 Subject: [PATCH] Allow the Rich Editor used by the Carousel to be customized for each Carousel asset instead of inheriting the Editor from the site's Settings. Fixes bug #12100. --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.10.13-7.10.14.pl | 12 ++++++++++++ lib/WebGUI/Asset/Wobject/Carousel.pm | 11 ++++++++++- lib/WebGUI/i18n/English/Asset_Carousel.pm | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 087f3e370..f1cf529da 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -9,6 +9,7 @@ - fixed #12056: Adding a Thing always creates a table - fixed #11955: Rich Text Editor for Forums doesn't work on the iPad - fixed #11992: html source editor + - fixed #12100: Carousel and/or RichEdit 7.10.13 - added #12079: Carousel Auto Play diff --git a/docs/upgrades/upgrade_7.10.13-7.10.14.pl b/docs/upgrades/upgrade_7.10.13-7.10.14.pl index 4a3ae5bb3..777e30838 100644 --- a/docs/upgrades/upgrade_7.10.13-7.10.14.pl +++ b/docs/upgrades/upgrade_7.10.13-7.10.14.pl @@ -33,6 +33,7 @@ my $session = start(); # this line required # upgrade functions go here addOrganizationsToTransaction($session); removeDuplicateUndergroundStyleTemplates($session); +addRichEditToCarousel($session); finish($session); # this line required @@ -73,6 +74,17 @@ sub removeDuplicateUndergroundStyleTemplates { print "DONE!\n" unless $quiet; } +#---------------------------------------------------------------------------- +# Describe what our function does +sub addRichEditToCarousel { + my $session = shift; + print "\tAdd RichEdit option to the Carousel" unless $quiet; + # and here's our code + $session->db->write('ALTER TABLE Carousel ADD COLUMN richEditor CHAR(22) BINARY'); + $session->db->write(q!update Carousel set richEditor='PBrichedit000000000001'!); + print "DONE!\n" unless $quiet; +} + # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- #---------------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/Carousel.pm b/lib/WebGUI/Asset/Wobject/Carousel.pm index c5c48407d..d4075efc9 100644 --- a/lib/WebGUI/Asset/Wobject/Carousel.pm +++ b/lib/WebGUI/Asset/Wobject/Carousel.pm @@ -60,6 +60,13 @@ sub definition { hoverHelp => $i18n->get('carousel slideHeight description'), label => $i18n->get('carousel slideHeight label'), }, + richEditor =>{ + fieldType => "selectRichEditor", + defaultValue => "PBrichedit000000000001", + tab => 'display', + label => $i18n->get('rich editor', 'Asset_Collaboration'), + hoverHelp => $i18n->get('rich editor description'), + }, items =>{ noFormPost =>1, fieldType =>'text', @@ -152,7 +159,9 @@ sub getEditForm { $tabform->getTab("properties")->raw($tableRowStart); - my $richedit = WebGUI::Asset->newByDynamicClass( $self->session, $self->session->setting->get('richEditor') ); + $self->session->log->warn('richedit:' .$self->get('richEditor')); + my $richEditId = $self->get('richEditor') || "PBrichedit000000000001"; + my $richedit = WebGUI::Asset->newByDynamicClass( $self->session, $richEditId ); my $config = JSON->new->encode( $richedit->getConfig ); my $loadMcePlugins = $richedit->getLoadPlugins; my $items = $self->get('items') ? JSON->new->decode($self->get('items'))->{items} : []; diff --git a/lib/WebGUI/i18n/English/Asset_Carousel.pm b/lib/WebGUI/i18n/English/Asset_Carousel.pm index 4413256d4..745e9369f 100644 --- a/lib/WebGUI/i18n/English/Asset_Carousel.pm +++ b/lib/WebGUI/i18n/English/Asset_Carousel.pm @@ -140,6 +140,13 @@ our $I18N = { lastUpdated => 0, context => 'Description of asset property', }, + + 'rich editor description' => { + message => q{Choose a rich editor to use for entering content in each pane of the Carousel. The new setting will take effect the next time the Carousel is edited.}, + lastUpdated => 0, + context => 'Description of asset property', + }, + }; 1;