Implemented RFE 9204 - Add Reply Filter Code and Reply Rich Editor Option to Collaboration System - Provides ability to specify different Rich Editors and FilterCodes for posts (start of thread) and replies

This commit is contained in:
Eric Kennedy 2009-05-14 03:02:26 +00:00
parent 90717eee40
commit 2fb41ce8e8
5 changed files with 67 additions and 5 deletions

View file

@ -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

View file

@ -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 --------------------------------
#----------------------------------------------------------------------------

View file

@ -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) {

View file

@ -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,

View file

@ -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,
},