From 8a5c99744192f7cded4e195ce49317c2829296a7 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 5 Aug 2005 22:06:14 +0000 Subject: [PATCH] updated rich edit to 1.45 fixed cache privileges problem added new buttons to rich edit rich edit now defaults to allow any HTML tags --- docs/changelog/6.x.x.txt | 6 +++++ docs/upgrades/upgrade_6.6.5-6.7.0.pl | 11 ++++++++ lib/WebGUI/Asset.pm | 2 +- lib/WebGUI/Asset/RichEdit.pm | 21 ++++++++++----- lib/WebGUI/Cache/FileCache.pm | 5 +++- lib/WebGUI/Help/Asset_RichEdit.pm | 4 +-- lib/WebGUI/i18n/English/Asset_RichEdit.pm | 24 +++++++++++++----- .../{adminConsole => assets}/richEdit.gif | Bin .../small/richEdit.gif | Bin 9 files changed, 56 insertions(+), 17 deletions(-) rename www/extras/{adminConsole => assets}/richEdit.gif (100%) rename www/extras/{adminConsole => assets}/small/richEdit.gif (100%) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 9f76d23f8..035dbf786 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -1,4 +1,10 @@ 6.7.0 + - Upgraded the rich editor to 1.45. + - Rich edit now has three new buttons: paste from word, paste as plain text, + and fullscreen. + - Rich editor defaultly does not validate HTML tags and therefore will allow + the slop that it was stripping out before. While less strict, this is less + confusing to end users. - Being in the admins group automatically results in a UI level capable of seeing everything. - fix [ 1251390 ] Security tab doesn't appear for member of Admins diff --git a/docs/upgrades/upgrade_6.6.5-6.7.0.pl b/docs/upgrades/upgrade_6.6.5-6.7.0.pl index 8e44861b3..f0f7284ea 100644 --- a/docs/upgrades/upgrade_6.6.5-6.7.0.pl +++ b/docs/upgrades/upgrade_6.6.5-6.7.0.pl @@ -31,9 +31,20 @@ makeSyndicatedContentChanges(); removeOldThemeSystem(); addSectionsToSurveys(); increaseProxyUrlLength(); +upgradeRichEdit(); WebGUI::Session::close(); +#------------------------------------------------- +sub upgradeRichEdit { + print "\tUpgrade rich editor to version 1.45.\n" unless ($quiet); + WebGUI::SQL->write("update RichEdit set extendedValidElements='*[*]' where assetId='PBrichedit000000000001'"); + my $prepend = 'a[name|href|target|title],strong/b[class],em\/i[class],strike[class],u[class],p[dir|class|align],ol,ul,li,br,img[class|src|border=0|alt|title|hspace|vspace|width|height|align],sub,sup,blockquote[dir|style],table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],div[dir|class|align],span[class|align],pre[class|align],address[class|align],h1[dir|class|align],h2[dir|class|align],h3[dir|class|align],h4[dir|class|align],h5[dir|class|align],h6[dir|class|align],hr'; + WebGUI::SQL->write("update RichEdit set extendedValidElements=concat(".quote($prepend).",',',extendedValidElements) where assetId<>'PBrichedit000000000001'"); + WebGUI::SQL->write("alter table RichEdit change extendedValidElements validElements mediumtext"); +} + + #------------------------------------------------- sub increaseProxyUrlLength { print "\tMaking HTTP Proxy URLs accept lengths of up to 2048 characters.\n" unless ($quiet); diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index ce85af7e1..d8f086e7c 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1458,7 +1458,7 @@ sub www_manageAssets { ."','".formatBytes($child->get("assetSize"))."','getUrl("func=manageRevisions")."\">".$locked."');\n"; $output .= "assetManager.AddLineSortData('','','','".$title."','".$child->getName ."','".$child->get("revisionDate")."','".$child->get("assetSize")."','".$locked."'); - assetManager.addAssetMetaData('".$child->getUrl."', '".$child->getRank."', '".$child->getTitle."');\n"; + assetManager.addAssetMetaData('".$child->getUrl."', '".$child->getRank."', '".$title."');\n"; } $output .= ' assetManager.AddButton("'.$i18n->get("delete").'","deleteList","manageAssets"); diff --git a/lib/WebGUI/Asset/RichEdit.pm b/lib/WebGUI/Asset/RichEdit.pm index c6eda5a3a..cc7ffb169 100644 --- a/lib/WebGUI/Asset/RichEdit.pm +++ b/lib/WebGUI/Asset/RichEdit.pm @@ -72,7 +72,7 @@ sub definition { fieldType=>'yesNo', defaultValue=>0 }, - extendedValidElements=>{ + validElements=>{ 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]' }, @@ -162,6 +162,8 @@ sub getEditForm { 'cut' => WebGUI::International::get('cut', 'Asset_RichEdit'), 'copy' => WebGUI::International::get('copy', 'Asset_RichEdit'), 'paste' => WebGUI::International::get('paste', 'Asset_RichEdit'), + 'pastetext' => WebGUI::International::get('pastetext', 'Asset_RichEdit'), + 'pasteword' => WebGUI::International::get('pasteword', 'Asset_RichEdit'), 'undo' => WebGUI::International::get('undo', 'Asset_RichEdit'), 'redo' => WebGUI::International::get('redo', 'Asset_RichEdit'), 'bold' => WebGUI::International::get('bold', 'Asset_RichEdit'), @@ -207,6 +209,7 @@ sub getEditForm { 'cleanup' => WebGUI::International::get('cleanup', 'Asset_RichEdit'), 'save' => WebGUI::International::get('save', 'Asset_RichEdit'), 'preview' => WebGUI::International::get('preview', 'Asset_RichEdit'), + 'fullscreen' => WebGUI::International::get('fullscreen', 'Asset_RichEdit'), 'zoom' => WebGUI::International::get('zoom', 'Asset_RichEdit'), 'print' => WebGUI::International::get('print', 'Asset_RichEdit'), # 'advlink' => "Advanced Link", @@ -276,11 +279,11 @@ sub getEditForm { -uiLevel=>9 ); $tabform->getTab("security")->textarea( - -value=>$self->getValue("extendedValidElements"), - -name=>"extendedValidElements", - -label=>WebGUI::International::get('extended elements', 'Asset_RichEdit'), - -hoverHelp=>WebGUI::International::get('extended elements description', 'Asset_RichEdit'), - -subtext=>WebGUI::International::get('extended elements subtext', 'Asset_RichEdit'), + -value=>$self->getValue("validElements"), + -name=>"validElements", + -label=>WebGUI::International::get('elements', 'Asset_RichEdit'), + -hoverHelp=>WebGUI::International::get('elements description', 'Asset_RichEdit'), + -subtext=>WebGUI::International::get('elements subtext', 'Asset_RichEdit'), -uiLevel=>9 ); $tabform->getTab("display")->integer( @@ -412,12 +415,13 @@ sub getRichEditor { nowrap => $self->getValue("nowrap") ? "true" : "false", directionality => $self->getValue("directionality"), theme_advanced_toolbar_location => $self->getValue("toolbarLocation"), - extended_valid_elements => $self->getValue("extendedValidElements"), + valid_elements => $self->getValue("validElements"), ); foreach my $button (@toolbarButtons) { push(@plugins,"table") if ($button eq "tablecontrols"); push(@plugins,"save") if ($button eq "save"); push(@plugins,"advhr") if ($button eq "advhr"); + push(@plugins,"fullscreen") if ($button eq "fullscreen"); if ($button eq "advimage") { push(@plugins,"advimage"); $config{external_link_list_url} = ""; @@ -429,6 +433,9 @@ sub getRichEditor { } push(@plugins,"emotions") if ($button eq "emotions"); push(@plugins,"iespell") if ($button eq "iespell"); + if ($button eq "paste" || $button eq "pastetext" || $button eq "pasteword") { + push(@plugins,"paste"); + } if ($button eq "insertdate" || $button eq "inserttime" || $button eq "insertdatetime") { $config{plugin_insertdate_dateFormat} = "%Y-%m-%d"; $config{plugin_insertdate_timeFormat} = "%H:%M:%S"; diff --git a/lib/WebGUI/Cache/FileCache.pm b/lib/WebGUI/Cache/FileCache.pm index 37820c8ab..8956380a6 100644 --- a/lib/WebGUI/Cache/FileCache.pm +++ b/lib/WebGUI/Cache/FileCache.pm @@ -232,7 +232,10 @@ sub set { my $ttl = shift || 60; my $path = $self->getFolder(); unless (-e $path) { - eval {mkpath($path)}; + my $oldumask = umask(); + umask(0000); + eval {mkpath($path,0)}; + umask($oldumask); if ($@) { WebGUI::ErrorHandler::error("Couldn't create cache folder: ".$path." : ".$@); return; diff --git a/lib/WebGUI/Help/Asset_RichEdit.pm b/lib/WebGUI/Help/Asset_RichEdit.pm index 7080726c3..50fe17f08 100644 --- a/lib/WebGUI/Help/Asset_RichEdit.pm +++ b/lib/WebGUI/Help/Asset_RichEdit.pm @@ -17,8 +17,8 @@ our $HELP = { namespace => 'Asset_RichEdit', }, { - title => 'extended elements', - description => 'extended elements description', + title => 'elements', + description => 'elements description', namespace => 'Asset_RichEdit', }, { diff --git a/lib/WebGUI/i18n/English/Asset_RichEdit.pm b/lib/WebGUI/i18n/English/Asset_RichEdit.pm index fbf53aa1f..f30b158db 100644 --- a/lib/WebGUI/i18n/English/Asset_RichEdit.pm +++ b/lib/WebGUI/i18n/English/Asset_RichEdit.pm @@ -17,13 +17,13 @@ our $I18N = { lastUpdated => 1115139859, }, - 'extended elements' => { - message => q|Extended Valid Elements|, + 'elements' => { + message => q|Valid Elements|, lastUpdated => 1115148094, }, - 'extended elements subtext' => { - message => q|
Must appear on one line, no carriage returns.|, + 'elements subtext' => { + message => q|
Must appear on one line, no carriage returns, and in the format of tag1[attr1\|attr2],tag2[attr1].|, lastUpdated => 1115148094, }, @@ -122,6 +122,18 @@ our $I18N = { message => q|Paste|, lastUpdated => 1115150778, }, + 'pastetext' => { + message => q|Paste as Plain Text|, + lastUpdated => 1115150778, + }, + 'pasteword' => { + message => q|Paste from Word|, + lastUpdated => 1115150778, + }, + 'fullscreen' => { + message => q|Fullscreen|, + lastUpdated => 1115150778, + }, 'undo' => { message => q|Undo|, lastUpdated => 1115150778, @@ -354,8 +366,8 @@ option is set to Yes, then all whitespace entered into the form will be preserve lastUpdated => 1119584875, }, - 'extended elements description' => { - message => q|A list of HTML tags and which elements are allowed inside of them.|, + 'elements description' => { + message => q|A list of HTML tags and their attributes that the rich editor will accept. All others will be stripped. To allow anything set it to *[*]. |, lastUpdated => 1119584875, }, diff --git a/www/extras/adminConsole/richEdit.gif b/www/extras/assets/richEdit.gif similarity index 100% rename from www/extras/adminConsole/richEdit.gif rename to www/extras/assets/richEdit.gif diff --git a/www/extras/adminConsole/small/richEdit.gif b/www/extras/assets/small/richEdit.gif similarity index 100% rename from www/extras/adminConsole/small/richEdit.gif rename to www/extras/assets/small/richEdit.gif