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.
- Added "create shortcut" as a context menu option in the asset manager.
- Fixed generateContent.pl to work with the new asset tree.
- Updated TinyMCE to version 1.44.
6.5.6

View file

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

View file

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

View file

@ -72,7 +72,7 @@ sub definition {
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]'
},
preformated=>{
preformatted=>{
fieldType=>'yesNo',
defaultValue=>0
},
@ -96,10 +96,6 @@ sub definition {
fieldType=>'yesNo',
defaultValue=>0
},
convertNewLinesToBr=>{
fieldType=>'yesNo',
defaultValue=>0
},
removeLineBreaks=>{
fieldType=>'yesNo',
defaultValue=>0
@ -158,8 +154,7 @@ sub getEditForm {
tie %buttons, "Tie::IxHash";
%buttons = (
search => "Find",
replace => "Replace",
searchreplace => "Find and Replace",
replace => "Find and Replace",
cut => "Cut",
copy => "Copy",
paste => "Paste",
@ -181,7 +176,6 @@ sub getEditForm {
sup => "Superscript",
styleselect => "Apply Style",
formatselect => "Apply Format",
code => "Code",
fontselect => "Font",
fontsizeselect => "Font Size",
forecolor => "Foreground Color",
@ -192,13 +186,6 @@ sub getEditForm {
anchor => "Anchor",
'unlink' => "Unlink",
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",
# spacer => "Toolbar Spacer",
# separator => "Toolbar Separator",
@ -207,22 +194,21 @@ sub getEditForm {
advhr => "Advanced Horizontal Rule",
inserttime => "Insert Time",
insertdate => "Insert Date",
insertdatetime => "Insert Date and Time",
image => "Image",
insertImage => "WebGUI Image",
# advimage => "Advanced Image",
# flash => "Flash Movie",
flash => "Flash Movie",
charmap => "Special Character",
collateral => "WebGUI Macro",
emotions => "Emoticons",
help => "Help",
iespell => "Internet Explorer Spell Checker",
iespell => "Spell Checker (IE Only)",
removeformat => "Remove Formatting",
source => "View Source",
code => "View/Edit Source",
cleanup => "Clean Up Code",
# save => "Save",
save => "Save / Submit",
preview => "Preview",
zoom => "Zoom",
zoom => "Zoom (IE Only)",
'print' => "Print",
);
my $buttonGrid = '<table style="font-size: 11px;">
@ -269,12 +255,12 @@ sub getEditForm {
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("askAboutRichEdit"),
-label=>"Ask user about rich using rich edit?",
-label=>"Ask user about using rich edit?",
-name=>"askAboutRichEdit"
);
$tabform->getTab("properties")->yesNo(
-value=>$self->getValue("preformatted"),
-label=>"Edit preformmated text?",
-label=>"Preserve whitespace as preformatted text?",
-name=>"preformatted",
-uiLevel=>9
);
@ -313,19 +299,13 @@ sub getEditForm {
-name=>"useBr",
-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(
-value=>$self->getValue("removeLineBreaks"),
-label=>"Remove line breaks from HTML?",
-name=>"removeLineBreaks",
-uiLevel=>9
);
$tabform->getTab("properties")->yesNo(
$tabform->getTab("display")->yesNo(
-value=>$self->getValue("nowrap"),
-label=>"Do not wrap text in editor?",
-name=>"nowrap",
@ -413,7 +393,7 @@ sub getName {
#-------------------------------------------------------------------
sub view {
sub getRichEditor {
my $self = shift;
my $calledAsWebMethod = shift;
my @toolbarRow1 = split("\n",$self->getValue("toolbarRow1"));
@ -433,7 +413,8 @@ sub view {
ask => $self->getValue("askAboutRichEdit") ? "true" : "false",
preformatted => $self->getValue("preformatted") ? "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",
directionality => $self->getValue("directionality"),
theme_advanced_toolbar_location => $self->getValue("toolbarLocation"),
@ -486,7 +467,7 @@ sub view {
$config{plugins} = join(",",@plugins);
my @directives;
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});
} else {
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/webgui.js",{type=>"text/javascript"});
my $output = '<script type="text/javascript">
return '<script type="text/javascript">
tinyMCE.init({
'.join(",\n ",@directives).'
});
</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" ',
defaultValue=>$params->{defaultValue}
});
$output .= WebGUI::Asset::RichEdit->new($richEditId)->view;
$output .= WebGUI::Asset::RichEdit->new($richEditId)->getRichEditor;
return $output;
}