Add space to Add/Edit Event in the EMS.

Allow the Navigation Asset to set the MIME type of its output.
Upgrade script, Wobject code, documentation.
Add a new MimeType form element, stolen out of the Snippet and
generalized for use.
This commit is contained in:
Colin Kuskie 2006-02-17 01:23:31 +00:00
parent 3f7bffef88
commit e06331cae9
10 changed files with 175 additions and 16 deletions

View file

@ -76,7 +76,7 @@ sub definition {
defaultValue=>0
},
mimeType=>{
fieldType=>'text',
fieldType=>'mimeType',
defaultValue=>'text/html'
}
@ -99,10 +99,6 @@ sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_Snippet");
my %mimeTypes;
foreach ('text/html','text/css','text/javascript','text/plain','text/xml','application/xml') {
$mimeTypes{$_}=$_;
}
$tabform->getTab("properties")->codearea(
-name=>"snippet",
-label=>$i18n->get('assetName'),
@ -115,12 +111,11 @@ sub getEditForm {
-hoverHelp=>$i18n->get('process as template description'),
-value=>$self->getValue("processAsTemplate")
);
$tabform->getTab("properties")->combo(
$tabform->getTab("properties")->mimeType(
-name=>"mimeType",
-label=>$i18n->get('mimeType'),
-hoverHelp=>$i18n->get('mimeType description'),
-value=>[$self->getValue('mimeType')],
-options=>\%mimeTypes
);
return $tabform;

View file

@ -642,7 +642,7 @@ sub www_editEvent {
my $output = $f->print;
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=manageEvents'),$i18n->get("manage events"));
my $addEdit = ($pid eq "new" or !$pid) ? $i18n->get('add', 'Wobject') : $i18n->get('edit', 'Wobject');
return $self->getAdminConsole->render($output, $addEdit.$i18n->get('event'));
return $self->getAdminConsole->render($output, $addEdit.' '.$i18n->get('event'));
}
#-------------------------------------------------------------------

View file

@ -38,6 +38,10 @@ sub definition {
fieldType=>"template",
defaultValue=>'PBtmpl0000000000000048'
},
mimeType =>{
fieldType=>"mimeType",
defaultValue=>'text/html'
},
assetsToInclude=>{
fieldType=>'checkList',
defaultValue=>"descendants"
@ -86,6 +90,12 @@ sub getEditForm {
-label=>$i18n->get(1096),
-hoverHelp=>$i18n->get('1096 description'),
);
$tabform->getTab("display")->mimeType(
-value=>$self->getValue('mimeType'),
-name=>"mimeType",
-label=>$i18n->get('mimeType'),
-hoverHelp=>$i18n->get('mimeType description'),
);
$tabform->hidden({
name=>"returnUrl",
value=>$self->session->form->process("returnUrl")
@ -447,7 +457,6 @@ sub view {
($lastChildren{@{$var->{page_loop}}[$counter]->{"page.parent.assetId"}}
eq @{$var->{page_loop}}[$counter]->{"page.assetId"});
}
#use Data::Dumper;$self->session->errorHandler->warn(Dumper($var));
return $self->processTemplate($var,undef,$self->{_viewTemplate});
}
@ -502,4 +511,24 @@ sub www_preview {
return _submenu($output,"preview");
}
1;
#-------------------------------------------------------------------
=head2 www_view
A web accessible version of the view method. The SUPER method is overridden so that we can serve
other types aside from text/html.
=cut
sub www_view {
my $self = shift;
my $mimeType = $self->getValue('mimeType') || 'text/html';
if ($mimeType eq 'text/html') {
return $self->SUPER->www_view();
}
else {
$self->prepareView();
$self->session->http->setMimeType($mimeType || 'text/html');
return $self->view();
}
}1;

View file

@ -0,0 +1,94 @@
package WebGUI::Form::MimeType;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2006 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Combo';
use WebGUI::International;
=head1 NAME
Package WebGUI::Form::MimeType
=head1 DESCRIPTION
Creates an Mime Type chooser control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Combo.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head4 afterEdit
A URL that will be acted upon after editing an LDAP link.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session, 'Form_MimeType');
push(@{$definition}, {
formName=>{
defaultValue=>$i18n->get('mimeType'),
},
label=>{
defaultValue=>$i18n->get('mimeType'),
},
profileEnabled=>{
defaultValue=>0
}
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a database connection picker control.
=cut
sub toHtml {
my $self = shift;
my $mimeTypes;
foreach ('text/html','text/css','text/javascript','text/plain','text/xml','application/xml') {
$mimeTypes->{$_}=$_;
}
$self->set("options", $mimeTypes);
return $self->SUPER::toHtml();
}
1;

View file

@ -9,6 +9,10 @@ our $HELP = {
title => '1096',
description => '1096 description',
namespace => 'Asset_Navigation',
{
title => 'mimeType',
description => 'mimeType description',
namespace => 'Asset_Navigation',
},
{
title => 'Start Point Type',

View file

@ -197,13 +197,17 @@ the Navigation Template to determine who can see them in the menu.</P>
'1093' => {
message => q|<P>The Add/Edit Navigation form allows you to do choose the which pages are shown in
your site navigation, and how to display them. Some of the default Navigation templates that come with WebGUI are
vertical, horizontal and crumbtrail. These templates can often be styled via CSS to match your site's design, instead
of rewriting the templates.</P>
message => q|<p>Navigation Assets will help you build sets of links so that users can get around in your
site. You can customize a Navigation form to choose the which pages are shown in
your site navigation and how to display them. Some of the default Navigation templates that come with WebGUI are
vertical, horizontal and crumbtrail. These templates can often be styled via CSS to match your site's design, instead
of rewriting the templates.</P>
<p>The Navigation Asset can also be used to generate XML output by creating a
template and setting the MIME Type appropriately. This could be useful for building
a Google sitemap of your site.
|,
lastUpdated => 1121969647,
lastUpdated => 1140139614,
},
'1096' => {
@ -297,6 +301,17 @@ the Navigation Template to determine who can see them in the menu.</P>
lastUpdated => 1101774239
},
'mimeType' => {
message => q|MIME Type|,
lastUpdated => 1140129010,
},
'mimeType description' => {
message => q|Allows you to specify the MIME type of this asset when viewed via the web; useful if you'd like to serve CSS, plain text, javascript or other text files directly from the WebGUI asset system. Defaults to <b>text/html</b>.|,
lastUpdated => 1140129008,
},
};
1;

View file

@ -44,7 +44,7 @@ our $I18N = {
},
'mimeType description' => {
message => q|Allows you to specify the MIME type of this asset when viewed via the web, useful if you'd like to serve CSS, plain text, javascript or other text files directly from the WebGUI asset system. Defaults to <b>text/html</b>.|,
message => q|Allows you to specify the MIME type of this asset when viewed via the web; useful if you'd like to serve CSS, plain text, javascript or other text files directly from the WebGUI asset system. Defaults to <b>text/html</b>.|,
lastUpdated => 1130880372,
},

View file

@ -0,0 +1,12 @@
package WebGUI::i18n::English::Form_MimeType; ##Be sure to change the package name to match the filename
our $I18N = { ##hashref of hashes
'mimeType' => {
message => q|MIME Type|,
lastUpdated => 1140129496,
context => q|Name of form field|
},
};
1;