improved Rich Text selection list, changed CS and Wiki to use it

This commit is contained in:
Graham Knop 2008-08-26 21:10:18 +00:00
parent 7901eb9642
commit ac3070956d
6 changed files with 32 additions and 27 deletions

View file

@ -1,4 +1,5 @@
7.6.0
- improved Rich Text selection list, changed CS and Wiki to use it
- fixed: invalid HTML generated for Shortcut overrides tab
- fixed: copying or duplicating an asset in the asset manager never autocommits
- fixed: Server side spell checker errors when checking text with single quotes

View file

@ -2075,7 +2075,7 @@ sub processTemplate {
$template = WebGUI::Asset->new($self->session, $templateId,"WebGUI::Asset::Template") unless (defined $template);
if (defined $template) {
$var = { %{ $var }, %{ $self->getMetaDataAsTemplateVariables } };
$var->{'controls'} = $self->getToolbar;
$var->{'controls'} = $self->getToolbar if $self->session->var->isAdminOn;
my %vars = (
%{$self->{_properties}},
%{$var}

View file

@ -205,7 +205,7 @@ sub view {
}
my $output = $self->get("snippet");
WebGUI::Macro::process($self->session,\$output);
$output = $self->getToolbar.$output if ($self->session->var->get("adminOn") && !$calledAsWebMethod);
$output = $self->getToolbar.$output if ($self->session->var->isAdminOn && !$calledAsWebMethod);
if ($self->getValue("processAsTemplate")) {
$output = WebGUI::Asset::Template->processRaw($self->session, $output, $self->get);
}

View file

@ -414,8 +414,6 @@ sub definition {
($useKarma? (karmaRank=>$i18n->get('karma rank')) : ()),
);
my $richEditorOptions = $session->db->buildHashRef("select distinct(assetData.assetId), assetData.title from asset, assetData where asset.className='WebGUI::Asset::RichEdit' and asset.assetId=assetData.assetId order by assetData.title");
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
@ -612,12 +610,11 @@ sub definition {
hoverHelp=>$i18n->get('filter code description'),
},
richEditor =>{
fieldType=>"selectBox",
fieldType=>"selectRichEditor",
defaultValue=>"PBrichedit000000000002",
tab=>'display',
label=>$i18n->get('rich editor'),
hoverHelp=>$i18n->get('rich editor description'),
options=>$richEditorOptions,
},
attachmentsPerPost =>{
fieldType=>"integer",

View file

@ -181,9 +181,6 @@ sub definition {
my $definition = shift;
my $i18n = WebGUI::International->new($session, 'Asset_WikiMaster');
# BUGGO: duplication with Collaboration; move this into WebGUI::Asset::RichEdit
my $richEditorOptions = $session->db->buildHashRef("select distinct(assetData.assetId), assetData.title from asset, assetData where asset.className='WebGUI::Asset::RichEdit' and asset.assetId=assetData.assetId order by assetData.title");
my %properties;
tie %properties, 'Tie::IxHash';
%properties =
@ -200,8 +197,7 @@ sub definition {
hoverHelp => $i18n->get('groupToAdminister hoverHelp'),
label => $i18n->get('groupToAdminister label') },
richEditor => { fieldType => 'selectBox',
options => $richEditorOptions,
richEditor => { fieldType => 'selectRichEditor',
defaultValue => 'PBrichedit000000000001',
tab => 'display',
hoverHelp => $i18n->get('richEditor hoverHelp'),

View file

@ -111,23 +111,34 @@ the available Rich Text Editor assets.
=cut
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
# Get all the RTEs available to this site
my $options
= $self->session->db->buildHashRef( q{
SELECT DISTINCT(assetData.assetId), assetData.title
FROM asset, assetData
WHERE asset.className='WebGUI::Asset::RichEdit'
AND asset.assetId=assetData.assetId
ORDER BY assetData.title
});
$self->set( "options", $options );
sub getOptions {
my $self = shift;
my $editors = WebGUI::Asset->getRoot($self->session)->getLineage(['descendants'], {includeOnlyClasses => ['WebGUI::Asset::RichEdit'], returnObjects => 1});
my %options = map { $_->getId => $_->getTitle } @$editors;
return \%options;
}
return $self;
#-------------------------------------------------------------------
=head2 toHtmlWithWrapper ( )
Renders the form field to HTML as a table row complete with labels, subtext, hoverhelp, etc. Also adds manage and edit icons next to the field if the current user is in the admins group.
=cut
sub toHtmlWithWrapper {
my $self = shift;
my $editor = WebGUI::Asset::RichEdit->new($self->session,$self->getOriginalValue);
if (defined $editor && $editor->canEdit) {
my $returnUrl = '';
if (defined $self->session->asset && !$self->session->asset->isa("WebGUI::Asset::RichEdit")) {
$returnUrl = ";proceed=goBackToPage;returnUrl=".$self->session->url->escape($self->session->asset->getUrl);
}
my $buttons = $self->session->icon->edit("func=edit".$returnUrl,$editor->get("url"));
$buttons .= $self->session->icon->manage("op=assetManager",$editor->getParent->get("url"));
$self->set("subtext", $buttons . $self->get("subtext"));
}
return $self->SUPER::toHtmlWithWrapper;
}
1;