diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index a4c11fa8c..b3a250791 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -31,6 +31,9 @@ Rich Editor across the entire site without querying the user. - Commit options have been removed from the Asset Manager "More" and Wobject type icon context menus. + - The Navigation Asset now allows setting the MIME type of its output so that + you can generate non-HTML navigations or take advantate of the Google + SiteMap feature. 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 ddc819e35..f9e6859af 100644 --- a/docs/upgrades/upgrade_6.8.6-6.9.0.pl +++ b/docs/upgrades/upgrade_6.8.6-6.9.0.pl @@ -33,6 +33,7 @@ updateDatabaseLinksAndSQLReport(); addWorkflow(); ipsToCIDR(); addDisabletoRichEditor(); +addNavigationMimeType(); finish($session); # this line required @@ -408,6 +409,12 @@ sub addDisabletoRichEditor { $session->db->write("alter table RichEdit add column disableRichEditor int(11) default '0'"); } +#------------------------------------------------- +sub addNavigationMimeType { + print "\tAdding Mime Type to Navigations.\n" unless ($quiet); + $session->db->write("alter table Navigation add column mimeType varchar(50) default 'text/html'"); +} + #------------------------------------------------- sub ipsToCIDR { print "\tTranslating IP addresses to CIDR format.\n" unless ($quiet); diff --git a/lib/WebGUI/Asset/Snippet.pm b/lib/WebGUI/Asset/Snippet.pm index d0c04f2e5..00dbcc42b 100644 --- a/lib/WebGUI/Asset/Snippet.pm +++ b/lib/WebGUI/Asset/Snippet.pm @@ -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; diff --git a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm index c7b4e3fb3..5720006d4 100644 --- a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm +++ b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm @@ -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')); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/Navigation.pm b/lib/WebGUI/Asset/Wobject/Navigation.pm index fa293f4e3..e3ac2436a 100644 --- a/lib/WebGUI/Asset/Wobject/Navigation.pm +++ b/lib/WebGUI/Asset/Wobject/Navigation.pm @@ -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; diff --git a/lib/WebGUI/Form/MimeType.pm b/lib/WebGUI/Form/MimeType.pm new file mode 100644 index 000000000..92b457890 --- /dev/null +++ b/lib/WebGUI/Form/MimeType.pm @@ -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; + diff --git a/lib/WebGUI/Help/Asset_Navigation.pm b/lib/WebGUI/Help/Asset_Navigation.pm index 07ead7c1d..15846df18 100644 --- a/lib/WebGUI/Help/Asset_Navigation.pm +++ b/lib/WebGUI/Help/Asset_Navigation.pm @@ -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', diff --git a/lib/WebGUI/i18n/English/Asset_Navigation.pm b/lib/WebGUI/i18n/English/Asset_Navigation.pm index 4683bfc6e..9ddd57e5c 100644 --- a/lib/WebGUI/i18n/English/Asset_Navigation.pm +++ b/lib/WebGUI/i18n/English/Asset_Navigation.pm @@ -197,13 +197,17 @@ the Navigation Template to determine who can see them in the menu.

'1093' => { - message => q|

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.

+ message => q|

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.

+

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.

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 text/html.|, + lastUpdated => 1140129008, + }, + }; 1; diff --git a/lib/WebGUI/i18n/English/Asset_Snippet.pm b/lib/WebGUI/i18n/English/Asset_Snippet.pm index 9d7427de6..bb35e3e05 100644 --- a/lib/WebGUI/i18n/English/Asset_Snippet.pm +++ b/lib/WebGUI/i18n/English/Asset_Snippet.pm @@ -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 text/html.|, + 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 text/html.|, lastUpdated => 1130880372, }, diff --git a/lib/WebGUI/i18n/English/Form_MimeType.pm b/lib/WebGUI/i18n/English/Form_MimeType.pm new file mode 100644 index 000000000..ebd54c958 --- /dev/null +++ b/lib/WebGUI/i18n/English/Form_MimeType.pm @@ -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;