fix getEditForm

This commit is contained in:
Doug Bell 2010-06-16 11:40:56 -05:00
parent 1caef590cc
commit 3934a6704c
27 changed files with 357 additions and 809 deletions

View file

@ -205,242 +205,128 @@ Returns the TabForm object that will be used in generating the edit page for thi
=cut
override getEditForm => sub {
my $self = shift;
my $tabform = super();
my $i18n = WebGUI::International->new($self->session,'Asset_RichEdit');
my %buttons;
tie %buttons, "Tie::IxHash";
%buttons = (
'search' => $i18n->get('search'),
'replace' => $i18n->get('replace'),
'cut' => $i18n->get('cut'),
'copy' => $i18n->get('Copy'),
'paste' => $i18n->get('paste'),
'pastetext' => $i18n->get('pastetext'),
'pasteword' => $i18n->get('pasteword'),
'undo' => $i18n->get('undo'),
'redo' => $i18n->get('redo'),
'bold' => $i18n->get('bold'),
'italic' => $i18n->get('italic'),
'underline' => $i18n->get('underline'),
'strikethrough' => $i18n->get('strikethrough'),
'justifyleft' => $i18n->get('justifyleft'),
'justifycenter' => $i18n->get('justifycenter'),
'justifyright' => $i18n->get('justifyright'),
'justifyfull' => $i18n->get('justifyfull'),
'bullist' => $i18n->get('bullist'),
'numlist' => $i18n->get('numlist'),
'outdent' => $i18n->get('outdent'),
'indent' => $i18n->get('indent'),
'sub' => $i18n->get('sub'),
'sup' => $i18n->get('sup'),
'styleselect' => $i18n->get('styleselect'),
'formatselect' => $i18n->get('formatselect'),
'fontselect' => $i18n->get('fontselect'),
'fontsizeselect' => $i18n->get('fontsizeselect'),
'forecolor' => $i18n->get('forecolor'),
'backcolor' => $i18n->get('backcolor'),
'link' => $i18n->get('link'),
'wgpagetree' => $i18n->get('pagetree'),
'anchor' => $i18n->get('anchor'),
'unlink' => $i18n->get('unlink'),
'tablecontrols' => $i18n->get('tablecontrols'),
'visualaid' => $i18n->get('visualaid'),
'hr' => $i18n->get('hr'),
'advhr' => $i18n->get('advhr'),
'inserttime' => $i18n->get('inserttime'),
'insertdate' => $i18n->get('insertdate'),
'image' => $i18n->get('image'),
'wginsertimage' => $i18n->get('insertImage'),
'media' => $i18n->get('media'),
'charmap' => $i18n->get('charmap'),
'wgmacro' => $i18n->get('collateral'),
'emotions' => $i18n->get('emotions'),
'help' => $i18n->get('help'),
'iespell' => $i18n->get('iespell'),
'removeformat' => $i18n->get('removeformat'),
'code' => $i18n->get('code'),
'cleanup' => $i18n->get('cleanup'),
'save' => $i18n->get('save'),
'preview' => $i18n->get('preview'),
'fullscreen' => $i18n->get('fullscreen'),
'print' => $i18n->get('print'),
'spellchecker' => $i18n->get('Server Side Spell Checker'),
# 'advlink' => "Advanced Link",
# 'spacer' => "Toolbar Spacer",
# 'separator' => "Toolbar Separator",
# 'rowseparator' => "Toolbar Row Separator",
# 'advimage' => "Advanced Image",
);
my $buttonGrid = sprintf qq!<table style="font-size: 11px;">
<tr style="font-weight: bold;">
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td></td>
</tr>!,
$i18n->get('button'),
$i18n->get('row 1'),
$i18n->get('row 2'),
$i18n->get('row 3');
my @toolbarRow1 = split("\n",$self->toolbarRow1);
my @toolbarRow2 = split("\n",$self->toolbarRow2);
my @toolbarRow3 = split("\n",$self->toolbarRow3);
my $evenOddToggle = 0;
foreach my $key (keys %buttons) {
$evenOddToggle = $evenOddToggle ? 0 : 1;
my $checked1 = isIn($key,@toolbarRow1);
my $checked2 = isIn($key,@toolbarRow2);
my $checked3 = isIn($key,@toolbarRow3);
$buttonGrid .= '
<tr'.($evenOddToggle ? ' style="background-color: #eeeeee;"' : undef).'>
<td>'.$buttons{$key}.'</td>
<td>'.WebGUI::Form::checkbox($self->session, {
value=>$key,
name=>"toolbarRow1",
checked=>$checked1
}).'</td>
<td>'.WebGUI::Form::checkbox($self->session, {
value=>$key,
name=>"toolbarRow2",
checked=>$checked2
}).'</td>
<td>'.WebGUI::Form::checkbox($self->session, {
value=>$key,
name=>"toolbarRow3",
checked=>$checked3
}).'</td><td>';
if ($key eq 'spellchecker' && !($self->session->config->get('availableDictionaries'))) {
$buttonGrid .= $i18n->get('no dictionaries');
}
$buttonGrid .= '</td>
</tr>
';
}
$buttonGrid .= "</table>";
$tabform->getTab("properties")->readOnly(
-label=>$i18n->get('toolbar buttons'),
-hoverHelp=>$i18n->get('toolbar buttons description'),
-value=>$buttonGrid
);
$tabform->getTab("properties")->yesNo(
-value=>$self->disableRichEditor,
-label=>$i18n->get('disable rich edit'),
-hoverHelp=>$i18n->get('disable rich edit description'),
-name=>"disableRichEditor"
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("askAboutRichEdit"),
-label=>$i18n->get('using rich edit'),
-hoverHelp=>$i18n->get('using rich edit description'),
-name=>"askAboutRichEdit"
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("preformatted"),
-label=>$i18n->get('preformatted'),
-hoverHelp=>$i18n->get('preformatted description'),
-name=>"preformatted",
-uiLevel=>9
);
$tabform->getTab("security")->textarea(
-value=>$self->getValue("validElements"),
-name=>"validElements",
-label=>$i18n->get('elements'),
-hoverHelp=>$i18n->get('elements description'),
-subtext=>$i18n->get('elements subtext'),
-uiLevel=>9
);
$tabform->getTab("display")->integer(
-value=>$self->getValue("editorHeight"),
-label=>$i18n->get('editor height'),
-hoverHelp=>$i18n->get('editor height description'),
-name=>"editorHeight",
-uiLevel=>9
);
$tabform->getTab("display")->integer(
-value=>$self->getValue("editorWidth"),
-label=>$i18n->get('editor width'),
-hoverHelp=>$i18n->get('editor width description'),
-name=>"editorWidth",
-uiLevel=>9
);
$tabform->getTab("display")->integer(
-value=>$self->getValue("sourceEditorHeight"),
-label=>$i18n->get('source editor height'),
-hoverHelp=>$i18n->get('source editor height description'),
-name=>"sourceEditorHeight"
);
$tabform->getTab("display")->integer(
-value=>$self->getValue("sourceEditorWidth"),
-label=>$i18n->get('source editor width'),
-hoverHelp=>$i18n->get('source editor width description'),
-name=>"sourceEditorWidth"
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("useBr"),
-label=>$i18n->get('use br'),
-hoverHelp=>$i18n->get('use br description'),
-name=>"useBr",
-uiLevel=>9
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("removeLineBreaks"),
-label=>$i18n->get('remove line breaks'),
-hoverHelp=>$i18n->get('remove line breaks description'),
-name=>"removeLineBreaks",
-uiLevel=>9
);
$tabform->getTab("display")->yesNo(
-value=>$self->getValue("nowrap"),
-label=>$i18n->get('no wrap'),
-hoverHelp=>$i18n->get('no wrap description'),
-name=>"nowrap",
-uiLevel=>9
);
$tabform->getTab("properties")->selectBox(
-value=>[$self->getValue("directionality")],
-label=>$i18n->get('directionality'),
-hoverHelp=>$i18n->get('directionality description'),
-name=>"directionality",
-options=>{
}
);
$tabform->getTab("display")->selectBox(
-value=>[$self->getValue("toolbarLocation")],
-label=>$i18n->get('toolbar location'),
-hoverHelp=>$i18n->get('toolbar location description'),
-name=>"toolbarLocation",
-options=>{
top=>$i18n->get('top'),
bottom=>$i18n->get('bottom'),
}
);
$tabform->getTab("properties")->text(
-value=>$self->getValue("cssFile"),
-label=>$i18n->get('css file'),
-hoverHelp=>$i18n->get('css file description'),
-name=>"cssFile"
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("enableContextMenu"),
-label=>$i18n->get('enable context menu'),
-hoverHelp=>$i18n->get('enable context menu description'),
-name=>"enableContextMenu"
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("inlinePopups"),
-label=>$i18n->get('inline popups'),
-hoverHelp=>$i18n->get('inline popups description'),
-name=>"inlinePopups"
my $self = shift;
my $f = super();
my $i18n = WebGUI::International->new($self->session,'Asset_RichEdit');
my %buttons;
tie %buttons, "Tie::IxHash";
%buttons = (
'search' => $i18n->get('search'),
'replace' => $i18n->get('replace'),
'cut' => $i18n->get('cut'),
'copy' => $i18n->get('Copy'),
'paste' => $i18n->get('paste'),
'pastetext' => $i18n->get('pastetext'),
'pasteword' => $i18n->get('pasteword'),
'undo' => $i18n->get('undo'),
'redo' => $i18n->get('redo'),
'bold' => $i18n->get('bold'),
'italic' => $i18n->get('italic'),
'underline' => $i18n->get('underline'),
'strikethrough' => $i18n->get('strikethrough'),
'justifyleft' => $i18n->get('justifyleft'),
'justifycenter' => $i18n->get('justifycenter'),
'justifyright' => $i18n->get('justifyright'),
'justifyfull' => $i18n->get('justifyfull'),
'bullist' => $i18n->get('bullist'),
'numlist' => $i18n->get('numlist'),
'outdent' => $i18n->get('outdent'),
'indent' => $i18n->get('indent'),
'sub' => $i18n->get('sub'),
'sup' => $i18n->get('sup'),
'styleselect' => $i18n->get('styleselect'),
'formatselect' => $i18n->get('formatselect'),
'fontselect' => $i18n->get('fontselect'),
'fontsizeselect' => $i18n->get('fontsizeselect'),
'forecolor' => $i18n->get('forecolor'),
'backcolor' => $i18n->get('backcolor'),
'link' => $i18n->get('link'),
'wgpagetree' => $i18n->get('pagetree'),
'anchor' => $i18n->get('anchor'),
'unlink' => $i18n->get('unlink'),
'tablecontrols' => $i18n->get('tablecontrols'),
'visualaid' => $i18n->get('visualaid'),
'hr' => $i18n->get('hr'),
'advhr' => $i18n->get('advhr'),
'inserttime' => $i18n->get('inserttime'),
'insertdate' => $i18n->get('insertdate'),
'image' => $i18n->get('image'),
'wginsertimage' => $i18n->get('insertImage'),
'media' => $i18n->get('media'),
'charmap' => $i18n->get('charmap'),
'wgmacro' => $i18n->get('collateral'),
'emotions' => $i18n->get('emotions'),
'help' => $i18n->get('help'),
'iespell' => $i18n->get('iespell'),
'removeformat' => $i18n->get('removeformat'),
'code' => $i18n->get('code'),
'cleanup' => $i18n->get('cleanup'),
'save' => $i18n->get('save'),
'preview' => $i18n->get('preview'),
'fullscreen' => $i18n->get('fullscreen'),
'print' => $i18n->get('print'),
'spellchecker' => $i18n->get('Server Side Spell Checker'),
# 'advlink' => "Advanced Link",
# 'spacer' => "Toolbar Spacer",
# 'separator' => "Toolbar Separator",
# 'rowseparator' => "Toolbar Row Separator",
# 'advimage' => "Advanced Image",
);
my $buttonGrid = sprintf qq!<table style="font-size: 11px;">
<tr style="font-weight: bold;">
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td></td>
</tr>!,
$i18n->get('button'),
$i18n->get('row 1'),
$i18n->get('row 2'),
$i18n->get('row 3');
my @toolbarRow1 = split("\n",$self->toolbarRow1);
my @toolbarRow2 = split("\n",$self->toolbarRow2);
my @toolbarRow3 = split("\n",$self->toolbarRow3);
my $evenOddToggle = 0;
foreach my $key (keys %buttons) {
$evenOddToggle = $evenOddToggle ? 0 : 1;
my $checked1 = isIn($key,@toolbarRow1);
my $checked2 = isIn($key,@toolbarRow2);
my $checked3 = isIn($key,@toolbarRow3);
$buttonGrid .= '
<tr'.($evenOddToggle ? ' style="background-color: #eeeeee;"' : undef).'>
<td>'.$buttons{$key}.'</td>
<td>'.WebGUI::Form::checkbox($self->session, {
value=>$key,
name=>"toolbarRow1",
checked=>$checked1
}).'</td>
<td>'.WebGUI::Form::checkbox($self->session, {
value=>$key,
name=>"toolbarRow2",
checked=>$checked2
}).'</td>
<td>'.WebGUI::Form::checkbox($self->session, {
value=>$key,
name=>"toolbarRow3",
checked=>$checked3
}).'</td><td>';
if ($key eq 'spellchecker' && !($self->session->config->get('availableDictionaries'))) {
$buttonGrid .= $i18n->get('no dictionaries');
}
$buttonGrid .= '</td>
</tr>
';
}
$buttonGrid .= "</table>";
my $tab = $f->addTab(name => "buttons", label => $i18n->get("buttons") );
$tab->addField( "ReadOnly",
label => $i18n->get('toolbar buttons'),
hoverHelp => $i18n->get('toolbar buttons description'),
value => $buttonGrid,
);
$tabform->getTab("properties")->yesNo(
value => $self->allowMedia,
label => $i18n->get('editForm allowMedia label'),
hoverHelp => $i18n->get('editForm allowMedia description'),
name => "allowMedia",
);
return $tabform;
return $f;
};