From ac39689ddbcdecefe094847129d676e77df515bc Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 14 Feb 2006 23:43:32 +0000 Subject: [PATCH] Add an option to disable a given rich editor Asset site wide. Added new column in table(default 0), label, hoverHelp and help field entry. --- docs/changelog/6.x.x.txt | 2 ++ docs/upgrades/upgrade_6.8.6-6.9.0.pl | 7 +++++++ lib/WebGUI/Asset/RichEdit.pm | 11 +++++++++++ lib/WebGUI/Help/Asset_RichEdit.pm | 5 +++++ lib/WebGUI/i18n/English/Asset_RichEdit.pm | 11 +++++++++++ 5 files changed, 36 insertions(+) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 5de6d6bd9..890bcbd92 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -27,6 +27,8 @@ if they are separated by commas. Whitespace is ignored. The upgrade script will migrate the data automatically, and hoverHelp documentation has been updated to reflect the changes as well. + - The Rich Editor now has a master reset that allows disabling any individual + Rich Editor across the entire site without querying the user. 6.8.7 - fix [ 1431098 ] op=becomeUser can become non-existent userIds diff --git a/docs/upgrades/upgrade_6.8.6-6.9.0.pl b/docs/upgrades/upgrade_6.8.6-6.9.0.pl index 793c1bc5f..08c60390b 100644 --- a/docs/upgrades/upgrade_6.8.6-6.9.0.pl +++ b/docs/upgrades/upgrade_6.8.6-6.9.0.pl @@ -31,6 +31,7 @@ updateTemplates(); updateDatabaseLinksAndSQLReport(); addWorkflow(); ipsToCIDR(); +addDisabletoRichEditor(); finish($session); # this line required @@ -393,6 +394,12 @@ sub removeFiles { rmtree('../../lib/WebGUI/Asset/Wobject/IndexedSearch'); } +#------------------------------------------------- +sub addDisabletoRichEditor { + print "\tUpdating Rich Editor to add master disable.\n" unless ($quiet); + $session->db->write("alter table RichEdit add column disableRichEditor int(11) default '0'"); +} + #------------------------------------------------- sub ipsToCIDR { print "\tTranslating IP addresses to CIDR format.\n" unless ($quiet); diff --git a/lib/WebGUI/Asset/RichEdit.pm b/lib/WebGUI/Asset/RichEdit.pm index f1588e61d..e7605175f 100644 --- a/lib/WebGUI/Asset/RichEdit.pm +++ b/lib/WebGUI/Asset/RichEdit.pm @@ -68,6 +68,10 @@ sub definition { tableName=>'RichEdit', className=>'WebGUI::Asset::RichEdit', properties=>{ + disableRichEditor=>{ + fieldType=>'yesNo', + defaultValue=>0 + }, askAboutRichEdit=>{ fieldType=>'yesNo', defaultValue=>0 @@ -266,6 +270,12 @@ sub getEditForm { -hoverHelp=>$i18n->get('toolbar buttons description'), -value=>$buttonGrid ); + $tabform->getTab("properties")->yesNo( + -value=>$self->getValue("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'), @@ -390,6 +400,7 @@ sub getToolbar { #------------------------------------------------------------------- sub getRichEditor { my $self = shift; + return '' if $self->getValue('disableRichEditor'); my $nameId = shift; my @toolbarRow1 = split("\n",$self->getValue("toolbarRow1")); push(@toolbarRow1,"contextmenu") if ($self->getValue("enableContextMenu")); diff --git a/lib/WebGUI/Help/Asset_RichEdit.pm b/lib/WebGUI/Help/Asset_RichEdit.pm index 639f56949..101413fd5 100644 --- a/lib/WebGUI/Help/Asset_RichEdit.pm +++ b/lib/WebGUI/Help/Asset_RichEdit.pm @@ -6,6 +6,11 @@ our $HELP = { title => 'rich edit add/edit title', body => 'rich edit add/edit body', fields => [ + { + title => 'disable rich edit', + description => 'disable rich edit description', + namespace => 'Asset_RichEdit', + }, { title => 'using rich edit', description => 'using rich edit description', diff --git a/lib/WebGUI/i18n/English/Asset_RichEdit.pm b/lib/WebGUI/i18n/English/Asset_RichEdit.pm index 942fbb848..62857ddaf 100644 --- a/lib/WebGUI/i18n/English/Asset_RichEdit.pm +++ b/lib/WebGUI/i18n/English/Asset_RichEdit.pm @@ -365,6 +365,17 @@ our $I18N = { lastUpdated => 1119584956, }, + 'disable rich edit' => { + message => q|Disable this Rich Editor?|, + lastUpdated => 1139957794, + }, + + 'disable rich edit description' => { + message => q|This is a master disable for the rich editor, and will turn off the Rich + Edit across the entire site without any user intervention.|, + lastUpdated => 1139958262, + }, + 'using rich edit description' => { message => q|Ask the user whether or not to use the Rich Editor on this form.|, lastUpdated => 1119584875,