rich editor is now working

This commit is contained in:
JT Smith 2005-05-03 16:26:07 +00:00
parent 379dce7a54
commit ccc90fff17
5 changed files with 30 additions and 43 deletions

View file

@ -53,6 +53,7 @@
for more familiarity with mac users. for more familiarity with mac users.
- Added "create shortcut" as a context menu option in the asset manager. - Added "create shortcut" as a context menu option in the asset manager.
- Fixed generateContent.pl to work with the new asset tree. - Fixed generateContent.pl to work with the new asset tree.
- Updated TinyMCE to version 1.44.
6.5.6 6.5.6

View file

@ -245,9 +245,9 @@ $importNode->addChild({
ownerUserId=>3, ownerUserId=>3,
groupIdView=>12, groupIdView=>12,
groupIdEdit=>4, groupIdEdit=>4,
toolbarRow1=>"bold\nitalic\njustifyleft\njustifyright\njustifycenter\njustifyfull\nindent\noutdent\nstyleselect\nremoveformat", toolbarRow1=>"bold\nitalic\njustifyleft\njustifyright\njustifycenter\njustifyfull\nindent\noutdent\nsub\nsup\nformatselect\nremoveformat",
toolbarRow2=>"bullist\nnumlist\nsub\nsup\nlink\npagetree\nanchor\nunlink\nadvhr\nimage\ninsertImage\ncharmap\ncollateral", toolbarRow2=>"bullist\nnumlist\nlink\npagetree\nanchor\nunlink\nadvhr\nimage\ninsertImage\ncharmap\ncollateral",
toolbarRow3=>"tablecontrols\nvisualaid\npreview\nsource\nsearchreplace", toolbarRow3=>"tablecontrols\nvisualaid\npreview\ncode\ncleanup\nreplace",
sourceEditorWidth=>600, sourceEditorWidth=>600,
sourceEditorHeight=>500, sourceEditorHeight=>500,
enableContextMenu=>1 enableContextMenu=>1
@ -260,7 +260,7 @@ $importNode->addChild({
ownerUserId=>3, ownerUserId=>3,
groupIdView=>7, groupIdView=>7,
groupIdEdit=>4, groupIdEdit=>4,
toolbarRow1=>"bold\nitalic\nbullist\nnumlist\nlink\nunlink\ncode\nemotions" toolbarRow1=>"bold\nitalic\nbullist\nnumlist\nlink\nunlink\nemotions"
},"PBrichedit000000000002"); },"PBrichedit000000000002");

View file

@ -51,14 +51,13 @@ alter table transaction add column trackingNumber varchar(255);
create table RichEdit ( create table RichEdit (
assetId varchar(22) not null primary key, assetId varchar(22) not null primary key,
askAboutRichEdit int not null default 0, askAboutRichEdit int not null default 0,
preformated int not null default 0, preformatted int not null default 0,
editorWidth int not null default 0, editorWidth int not null default 0,
editorHeight int not null default 0, editorHeight int not null default 0,
sourceEditorWidth int not null default 0, sourceEditorWidth int not null default 0,
sourceEditorHeight int not null default 0, sourceEditorHeight int not null default 0,
useBr int not null default 0, useBr int not null default 0,
nowrap int not null default 0, nowrap int not null default 0,
convertNewLinesToBr int not null default 0,
removeLineBreaks int not null default 0, removeLineBreaks int not null default 0,
npwrap int not null default 0, npwrap int not null default 0,
directionality varchar(3) not null default 'ltr', directionality varchar(3) not null default 'ltr',

View file

@ -72,7 +72,7 @@ sub definition {
fieldType=>'textarea', fieldType=>'textarea',
defaultValue=>'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]' defaultValue=>'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'
}, },
preformated=>{ preformatted=>{
fieldType=>'yesNo', fieldType=>'yesNo',
defaultValue=>0 defaultValue=>0
}, },
@ -96,10 +96,6 @@ sub definition {
fieldType=>'yesNo', fieldType=>'yesNo',
defaultValue=>0 defaultValue=>0
}, },
convertNewLinesToBr=>{
fieldType=>'yesNo',
defaultValue=>0
},
removeLineBreaks=>{ removeLineBreaks=>{
fieldType=>'yesNo', fieldType=>'yesNo',
defaultValue=>0 defaultValue=>0
@ -158,8 +154,7 @@ sub getEditForm {
tie %buttons, "Tie::IxHash"; tie %buttons, "Tie::IxHash";
%buttons = ( %buttons = (
search => "Find", search => "Find",
replace => "Replace", replace => "Find and Replace",
searchreplace => "Find and Replace",
cut => "Cut", cut => "Cut",
copy => "Copy", copy => "Copy",
paste => "Paste", paste => "Paste",
@ -181,7 +176,6 @@ sub getEditForm {
sup => "Superscript", sup => "Superscript",
styleselect => "Apply Style", styleselect => "Apply Style",
formatselect => "Apply Format", formatselect => "Apply Format",
code => "Code",
fontselect => "Font", fontselect => "Font",
fontsizeselect => "Font Size", fontsizeselect => "Font Size",
forecolor => "Foreground Color", forecolor => "Foreground Color",
@ -192,13 +186,6 @@ sub getEditForm {
anchor => "Anchor", anchor => "Anchor",
'unlink' => "Unlink", 'unlink' => "Unlink",
tablecontrols => "Table Controls", tablecontrols => "Table Controls",
table => "Create Table",
row_before => "Insert Table Row Before",
row_after => "Insert Table Row After",
delete_row => "Delete Table Row",
col_before => "Insert Table Column Before",
col_after => "Insert Table Column After",
delete_col => "Delete Table Column",
visualaid => "Toggle Table Visual Aid", visualaid => "Toggle Table Visual Aid",
# spacer => "Toolbar Spacer", # spacer => "Toolbar Spacer",
# separator => "Toolbar Separator", # separator => "Toolbar Separator",
@ -207,22 +194,21 @@ sub getEditForm {
advhr => "Advanced Horizontal Rule", advhr => "Advanced Horizontal Rule",
inserttime => "Insert Time", inserttime => "Insert Time",
insertdate => "Insert Date", insertdate => "Insert Date",
insertdatetime => "Insert Date and Time",
image => "Image", image => "Image",
insertImage => "WebGUI Image", insertImage => "WebGUI Image",
# advimage => "Advanced Image", # advimage => "Advanced Image",
# flash => "Flash Movie", flash => "Flash Movie",
charmap => "Special Character", charmap => "Special Character",
collateral => "WebGUI Macro", collateral => "WebGUI Macro",
emotions => "Emoticons", emotions => "Emoticons",
help => "Help", help => "Help",
iespell => "Internet Explorer Spell Checker", iespell => "Spell Checker (IE Only)",
removeformat => "Remove Formatting", removeformat => "Remove Formatting",
source => "View Source", code => "View/Edit Source",
cleanup => "Clean Up Code", cleanup => "Clean Up Code",
# save => "Save", save => "Save / Submit",
preview => "Preview", preview => "Preview",
zoom => "Zoom", zoom => "Zoom (IE Only)",
'print' => "Print", 'print' => "Print",
); );
my $buttonGrid = '<table style="font-size: 11px;"> my $buttonGrid = '<table style="font-size: 11px;">
@ -269,12 +255,12 @@ sub getEditForm {
); );
$tabform->getTab("properties")->yesNo( $tabform->getTab("properties")->yesNo(
-value=>$self->getValue("askAboutRichEdit"), -value=>$self->getValue("askAboutRichEdit"),
-label=>"Ask user about rich using rich edit?", -label=>"Ask user about using rich edit?",
-name=>"askAboutRichEdit" -name=>"askAboutRichEdit"
); );
$tabform->getTab("properties")->yesNo( $tabform->getTab("properties")->yesNo(
-value=>$self->getValue("preformatted"), -value=>$self->getValue("preformatted"),
-label=>"Edit preformmated text?", -label=>"Preserve whitespace as preformatted text?",
-name=>"preformatted", -name=>"preformatted",
-uiLevel=>9 -uiLevel=>9
); );
@ -313,19 +299,13 @@ sub getEditForm {
-name=>"useBr", -name=>"useBr",
-uiLevel=>9 -uiLevel=>9
); );
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("convertNewLinesToBr"),
-label=>"Convert new lines to &lt;br /&gt; on paste?",
-name=>"convertNewLinesToBr",
-uiLevel=>9
);
$tabform->getTab("properties")->yesNo( $tabform->getTab("properties")->yesNo(
-value=>$self->getValue("removeLineBreaks"), -value=>$self->getValue("removeLineBreaks"),
-label=>"Remove line breaks from HTML?", -label=>"Remove line breaks from HTML?",
-name=>"removeLineBreaks", -name=>"removeLineBreaks",
-uiLevel=>9 -uiLevel=>9
); );
$tabform->getTab("properties")->yesNo( $tabform->getTab("display")->yesNo(
-value=>$self->getValue("nowrap"), -value=>$self->getValue("nowrap"),
-label=>"Do not wrap text in editor?", -label=>"Do not wrap text in editor?",
-name=>"nowrap", -name=>"nowrap",
@ -413,7 +393,7 @@ sub getName {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub view { sub getRichEditor {
my $self = shift; my $self = shift;
my $calledAsWebMethod = shift; my $calledAsWebMethod = shift;
my @toolbarRow1 = split("\n",$self->getValue("toolbarRow1")); my @toolbarRow1 = split("\n",$self->getValue("toolbarRow1"));
@ -433,7 +413,8 @@ sub view {
ask => $self->getValue("askAboutRichEdit") ? "true" : "false", ask => $self->getValue("askAboutRichEdit") ? "true" : "false",
preformatted => $self->getValue("preformatted") ? "true" : "false", preformatted => $self->getValue("preformatted") ? "true" : "false",
force_br_newlines => $self->getValue("useBr") ? "true" : "false", force_br_newlines => $self->getValue("useBr") ? "true" : "false",
convert_newlines_to_brs => $self->getValue("removeLineBreaks") ? "true" : "false", force_p_newlines => $self->getValue("useBr") ? "false" : "true",
remove_linebreaks => $self->getValue("removeLineBreaks") ? "true" : "false",
nowrap => $self->getValue("nowrap") ? "true" : "false", nowrap => $self->getValue("nowrap") ? "true" : "false",
directionality => $self->getValue("directionality"), directionality => $self->getValue("directionality"),
theme_advanced_toolbar_location => $self->getValue("toolbarLocation"), theme_advanced_toolbar_location => $self->getValue("toolbarLocation"),
@ -486,7 +467,7 @@ sub view {
$config{plugins} = join(",",@plugins); $config{plugins} = join(",",@plugins);
my @directives; my @directives;
foreach my $key (keys %config) { foreach my $key (keys %config) {
if ($config{$key} eq "true" || $config{key} eq "false") { if ($config{$key} eq "true" || $config{$key} eq "false") {
push(@directives,$key." : ".$config{$key}); push(@directives,$key." : ".$config{$key});
} else { } else {
push(@directives,$key." : '".$config{$key}."'"); push(@directives,$key." : '".$config{$key}."'");
@ -494,13 +475,19 @@ sub view {
} }
WebGUI::Style::setScript($session{config}{extrasURL}."/tinymce/jscripts/tiny_mce/tiny_mce.js",{type=>"text/javascript"}); WebGUI::Style::setScript($session{config}{extrasURL}."/tinymce/jscripts/tiny_mce/tiny_mce.js",{type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}."/tinymce/jscripts/webgui.js",{type=>"text/javascript"}); WebGUI::Style::setScript($session{config}{extrasURL}."/tinymce/jscripts/webgui.js",{type=>"text/javascript"});
my $output = '<script type="text/javascript"> return '<script type="text/javascript">
tinyMCE.init({ tinyMCE.init({
'.join(",\n ",@directives).' '.join(",\n ",@directives).'
}); });
</script>'; </script>';
$output = '<p>'.$self->getToolbar.'</p>'.$output if ($session{var}{adminOn} && !$calledAsWebMethod); }
return $output;
#-------------------------------------------------------------------
sub view {
my $self = shift;
return '<p>'.$self->getToolbar.'</p>' if ($session{var}{adminOn});
return undef;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -1188,7 +1188,7 @@ sub HTMLArea {
extras=>$params->{extras}.' onBlur="fixChars(this.form.'.$params->{name}.')" id="'.$params->{name}.'"'.' mce_editable="true" ', extras=>$params->{extras}.' onBlur="fixChars(this.form.'.$params->{name}.')" id="'.$params->{name}.'"'.' mce_editable="true" ',
defaultValue=>$params->{defaultValue} defaultValue=>$params->{defaultValue}
}); });
$output .= WebGUI::Asset::RichEdit->new($richEditId)->view; $output .= WebGUI::Asset::RichEdit->new($richEditId)->getRichEditor;
return $output; return $output;
} }