Implemented RFE 10253 - Select DataForm HTMLArea Rich Text Editor - Provides ability to specify the Rich Editor to be used for htmlArea fields on a given DataForm Wobject

This commit is contained in:
Eric Kennedy 2009-05-13 23:53:41 +00:00
parent b877e8fa05
commit b361e5db9c
4 changed files with 50 additions and 0 deletions

View file

@ -29,6 +29,7 @@ use WebGUI::DateTime;
use WebGUI::User;
use WebGUI::Group;
use WebGUI::AssetCollateral::DataForm::Entry;
use WebGUI::Form::SelectRichEditor;
use JSON ();
our @ISA = qw(WebGUI::Asset::Wobject);
@ -72,6 +73,9 @@ sub _createForm {
elsif ( $class->isa('WebGUI::Form::List') ) {
delete $param{size};
}
elsif ( $type eq 'HTMLArea' && $data->{htmlAreaRichEditor} ne '**Use_Default_Editor**') {
$param{richEditId} = $data->{htmlAreaRichEditor} ;
}
return $class->new($self->session, \%param);
}
@ -220,6 +224,12 @@ sub definition {
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_DataForm");
my %properties;
# populate hash of Rich Editors and add an entry to the list to use the default
my $selectRichEditor = WebGUI::Form::SelectRichEditor->new($session,{}) ;
my $richEditorOptions = $selectRichEditor->getOptions() ;
$richEditorOptions->{'**Use_Default_Editor**'} = "Use Default Rich Editor" ;
tie %properties, 'Tie::IxHash';
%properties = (
templateId => {
@ -231,6 +241,14 @@ sub definition {
hoverHelp => $i18n->get('82 description'),
afterEdit => 'func=edit',
},
htmlAreaRichEditor =>{
fieldType=>"selectBox",
defaultValue=>0,
options=>$richEditorOptions,
tab=>'display',
label=>$i18n->get('htmlAreaRichEditor'),
hoverHelp=>$i18n->get('htmlAreaRichEditor description'),
},
emailTemplateId => {
fieldType => "template",
defaultValue => 'PBtmpl0000000000000085',
@ -686,6 +704,11 @@ sub getRecordTemplateVars {
my $hidden
= ($field->{status} eq 'hidden' && !$session->var->isAdminOn)
|| ($field->{isMailField} && !$self->get('mailData'));
# populate Rich Editor field if the field is an HTMLArea
if ($field->{type} eq "HTMLArea") {
$field->{htmlAreaRichEditor} = $self->get("htmlAreaRichEditor") ;
}
my $form = $self->_createForm($field, $value);
$value = $form->getValueAsHtml;
my %fieldProperties = (

View file

@ -2,6 +2,18 @@ package WebGUI::i18n::English::Asset_DataForm;
use strict;
our $I18N = {
'htmlAreaRichEditor' => {
message => q|HTML Area Rich Editor|,
lastUpdated => 0,
context => 'label for HTMLArea field Rich Editor selector.',
},
'htmlAreaRichEditor description' => {
message => q|Select the Rich Editor you want to use for HTML Area fields.|,
lastUpdated => 0,
context => 'hover help for HTMLArea field Rich Editor selector.',
},
'delete file' => {
message => q|Delete Attached File|,
lastUpdated => 0,