diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index d16a91758..c8ab8562f 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -33,6 +33,7 @@ - rfe #9134: Pluggable Storage to support Amazon S3 and Cloudfront (Funded by donor.com, coded by Whizman) - Added PayPal paydriver. (Thanks to Paul Wrightson) - rfe #9908: Inbox: SMS delivery + - rfe #9204: Add Reply Filter Code Option to Collaboration System - provides ability to specify a code filter for collaboration system replies which might be different than the one used for posts. - rfe #10384: Change the view Groups in this Group area 7.7.5 diff --git a/docs/upgrades/upgrade_7.7.5-7.7.6.pl b/docs/upgrades/upgrade_7.7.5-7.7.6.pl index 02ff94694..b60d43041 100644 --- a/docs/upgrades/upgrade_7.7.5-7.7.6.pl +++ b/docs/upgrades/upgrade_7.7.5-7.7.6.pl @@ -45,6 +45,7 @@ installSMSUserProfileFields($session); installSMSSettings($session); upgradeSMSMailQueue($session); addPayDrivers($session); +addCollaborationColumns($session); installFriendManagerSettings($session); installFriendManagerConfig($session); @@ -234,6 +235,26 @@ sub addPayDrivers { print "DONE!\n" unless $quiet; } +sub addCollaborationColumns { + my $session = shift; + print "\tAdding columns to store htmlArea Rich Editor and Filter Code for Replies in Collaboration Table ..." unless $quiet; + + my $sth = $session->db->read( 'show columns in Collaboration where field = "replyRichEditor"' ); + if ($sth->rows() == 0) { # only add columns if it hasn't been added already + $session->db->write( 'alter TABLE `Collaboration` add column `replyRichEditor` varchar(22) default "PBrichedit000000000002"') ; + $session->db->write( 'update `Collaboration` set `replyRichEditor` = `richEditor` ') ; + } + + $sth = $session->db->read( 'show columns in Collaboration where field = "replyFilterCode"' ); + if ($sth->rows() == 0) { # only add columns if it hasn't been added already + $session->db->write( 'alter TABLE `Collaboration` add column `replyFilterCode` varchar(30) default "javascript"') ; + $session->db->write( 'update `Collaboration` set `replyFilterCode` = `filterCode` ') ; + } + + print "Done\n" unless $quiet; + +} + sub installFriendManagerSettings { my $session = shift; print "\tInstalling FriendManager into settings..."; @@ -263,7 +284,6 @@ sub installFriendManagerConfig { print "\tDone\n"; } - # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- #---------------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index dac794d7d..1cf389df8 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -374,7 +374,12 @@ sub formatContent { my $self = shift; my $content = shift || $self->get("content"); my $contentType = shift || $self->get("contentType"); - my $msg = WebGUI::HTML::filter($content,$self->getThread->getParent->get("filterCode")); + my $msg = undef ; + if (!$self->isa("WebGUI::Asset::Post::Thread")) { # apply appropriate content filter + $msg = WebGUI::HTML::filter($content,$self->getThread->getParent->get("replyFilterCode")); + } else { + $msg = WebGUI::HTML::filter($content,$self->getThread->getParent->get("filterCode")); + } $msg = WebGUI::HTML::format($msg, $contentType); if ($self->getThread->getParent->get("useContentFilter")) { $msg = WebGUI::HTML::processReplacements($self->session,$msg); @@ -1422,7 +1427,9 @@ sub www_edit { $var{'content.form'} = WebGUI::Form::HTMLArea($session, { name=>"content", value=>$content, - richEditId=>$self->getThread->getParent->get("richEditor") + richEditId=>($self->isa("WebGUI::Asset::Post::Thread") ? + $self->getThread->getParent->get("richEditor") : + $self->getThread->getParent->get("replyRichEditor")), }); ##Edit variables just for Threads if ($className eq 'WebGUI::Asset::Post::Thread' && $self->getThread->getParent->canEdit) { diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index 1cf47d4cf..b0fddaf10 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -593,6 +593,13 @@ sub definition { label=>$i18n->get('filter code'), hoverHelp=>$i18n->get('filter code description'), }, + replyFilterCode =>{ + fieldType=>"filterContent", + defaultValue=>'javascript', + tab=>'security', + label=>$i18n->get('reply filter code'), + hoverHelp=>$i18n->get('reply filter code description'), + }, richEditor =>{ fieldType=>"selectRichEditor", defaultValue=>"PBrichedit000000000002", @@ -600,6 +607,13 @@ sub definition { label=>$i18n->get('rich editor'), hoverHelp=>$i18n->get('rich editor description'), }, + replyRichEditor =>{ + fieldType=>"selectRichEditor", + defaultValue=>"PBrichedit000000000002", + tab=>'display', + label=>$i18n->get('reply rich editor'), + hoverHelp=>$i18n->get('reply rich editor description'), + }, attachmentsPerPost =>{ fieldType=>"integer", defaultValue=>0, diff --git a/lib/WebGUI/i18n/English/Asset_Collaboration.pm b/lib/WebGUI/i18n/English/Asset_Collaboration.pm index 2a6a7e1c0..170eedc82 100644 --- a/lib/WebGUI/i18n/English/Asset_Collaboration.pm +++ b/lib/WebGUI/i18n/English/Asset_Collaboration.pm @@ -677,6 +677,11 @@ our $I18N = { lastUpdated => 1109698614, }, + 'reply filter code' => { + message => q|Reply Filter Code|, + lastUpdated => 1109698614, + }, + 'sort by' => { message => q|Sort By|, lastUpdated => 1109698614, @@ -717,6 +722,11 @@ our $I18N = { lastUpdated => 0, }, + 'reply rich editor' => { + message => q|Reply Rich Editor|, + lastUpdated => 0, + }, + 'content filter' => { message => q|Use content filter?|, lastUpdated => 1109698614, @@ -1140,7 +1150,12 @@ submitted by a user.|, }, 'filter code description' => { - message => q|Sets the level of HTML filtering done on each Post.|, + message => q|Sets the level of HTML filtering done on each Post (the start of each thread).|, + lastUpdated => 1119070429, + }, + + 'reply filter code description' => { + message => q|Sets the level of HTML filtering done on each Reply.|, lastUpdated => 1119070429, }, @@ -1183,7 +1198,12 @@ the original poster.|, }, 'rich editor description' => { - message => q|Select which Rich Editor to use for the content of Posts.|, + message => q|Select which Rich Editor to use for the content of Posts (the start of each thread).|, + lastUpdated => 1187991394, + }, + + 'reply rich editor description' => { + message => q|Select which Rich Editor to use for the content of Replies.|, lastUpdated => 1187991394, },