diff --git a/docs/migration.txt b/docs/migration.txt index c9f227582..0e7c45a45 100644 --- a/docs/migration.txt +++ b/docs/migration.txt @@ -184,6 +184,10 @@ Asset API ->get will still work, but will be slightly slower since inside it calls the direct Moose accessor. Similarly, getId is slightly slower than ->assetId. +processPropertiesFromFormPost +----------------------------- +Absurdly long and non-descriptive name, changed to processEditForm + WebGUI::Shop::Vendor ==================== Object properties are no longer written to the database when an object is created from scratch. The write method needs diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 4c91ca3ce..0a401cbfc 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -870,53 +870,43 @@ sub getEditForm { my $session = $self->session; my $i18n = WebGUI::International->new( $session, "Asset" ); my $f = WebGUI::FormBuilder->new( $session ); - my $overrides = $session->config->get( "assets/" . $self->get("className") ); + my $overrides = $session->config->get( "assets/" . $self->get("className") . '/fields' ) || {}; ### # Buttons - $f->addField( 'Submit', + my $buttonGroup = $f->addField( 'ButtonGroup', name => "saveButtons", rowClass => 'saveButtons' ); + $buttonGroup->addButton( "submit", { name => "save", value => $i18n->get('save'), - ); + } ); if ( $session->config->get("enableSaveAndCommit") ) { - $f->addField( 'Submit', + $buttonGroup->addButton( 'Submit', { name => "saveAndCommit", value => $i18n->get("save and commit"), - ); + } ); } - $f->addField( 'Submit', + $buttonGroup->addButton( 'Submit', { name => "saveAndReturn", value => $i18n->get("apply"), - ); + } ); - $f->addField( 'Submit', + $buttonGroup->addButton( 'Submit', { name => 'cancel', - value => $i18n->get('cancel'), - ); + value => $i18n->get('cancel','WebGUI'), + } ); ### # Create the main tabset - + # Not using loop to maintain correct order + $f->addTab( name => "properties", label => $i18n->get("properties") ); + $f->addTab( name => "display", label => $i18n->get(105) ); + $f->addTab( name => "security", label => $i18n->get(107) ); + $f->addTab( name => "meta", label => $i18n->get("Metadata") ); ### # Asset ID and class name - # assetId => { - # fieldType => "guid", - # label => [ "asset id", 'Asset' ], - # value => $assetId, - # hoverHelp => [ 'asset id description', 'Asset' ], - # uiLevel => 9, - # tab => "meta", - # }, - # class => { - # fieldType => "className", - # label => [ "class name", 'WebGUI' ], - # value => $class, - # uiLevel => 9, - # tab => "meta", - # }, my $assetId; my $class; if ( $self->getId eq "new" ) { @@ -927,41 +917,56 @@ sub getEditForm { $assetId = $self->getId; $class = $self->get('className'); } + $f->getTab("meta")->addField( "Guid", + name => "assetId", + value => $assetId, + label => $i18n->get( 'asset id' ), + hoverHelp => $i18n->get('asset id description'), + uiLevel => 9, + ); + $f->getTab("meta")->addField( "ClassName", + name => "class", + value => $class, + label => $i18n->get('class name', 'WebGUI'), + uiLevel => 9, + ); ### # Keywords - # keywords => { - # label => [ 'keywords', 'Asset' ], - # hoverHelp => [ 'keywords help', 'Asset' ], - # value => $self->get('keywords'), - # fieldType => 'keywords', - # tab => 'meta', - # }, + $f->getTab( "meta" )->addField( 'Keywords', + name => 'keywords', + value => $self->get('keywords'), + label => $i18n->get( 'keywords' ), + hoverHelp => $i18n->get( 'keywords help' ), + ); ### # Properties foreach my $property ( $self->getProperties ) { next if $self->meta->find_attribute_by_name( $property )->noFormPost; - $self->session->log->warn( "Property: $property" ); - $self->session->log->warn( Dumper $self->meta->find_attribute_by_name( $property )->form ); - $self->session->log->warn( Dumper $self->getFormProperties( $property ) ); - my $fieldHash = { - tab => "properties", - name => $property, - value => $self->$property, - %{ $self->getFormProperties( $property ) }, - }; - my $fieldType = $self->meta->find_attribute_by_name( $property )->fieldType; + my $fieldType = $self->meta->find_attribute_by_name( $property )->fieldType; + my $fieldOverrides = $overrides->{ $property } || {}; + my $fieldHash = { + tab => "properties", + %{ $self->getFormProperties( $property ) }, + %{ $overrides }, + name => $property, + value => $self->$property, + }; - if ( !$f->getTab( $fieldHash->{tab} ) ) { - $f->addTab( name => $fieldHash->{tab} ); + # Kludge... + if ( isIn( $fieldHash->{fieldType}, 'selectBox', 'workflow' ) and ref $fieldHash->{value} ne 'ARRAY' ) { + $fieldHash->{value} = [ $fieldHash->{value} ]; } + + # Create tabs to have labels added later + if ( !$f->getTab( $fieldHash->{tab} ) ) { + $f->addTab( name => $fieldHash->{tab}, label => $fieldHash->{tab} ); + } + $f->getTab( $fieldHash->{tab} )->addField( $fieldType, %{$fieldHash} ); } - return $f; -} -=cut ### # Meta data if ( $session->setting->get("metaDataEnabled") ) { @@ -975,66 +980,22 @@ sub getEditForm { if ( "\l$fieldType" eq "selectBox" ) { $options = "|" . $i18n->get("Select") . "\n" . $options; } - push @properties, "metadata_" - . $meta->{$field}{fieldId} => { - tab => "meta", + my $fieldName = "metadata_" . $meta->{$field}{fieldId}; + my $fieldData = { label => $meta->{$field}{fieldName}, uiLevel => 5, value => $meta->{$field}{value}, - extras => qq/title="$meta->{$field}{description}"/, + hoverHelp => $meta->{$field}{description}, options => $options, defaultValue => $meta->{$field}{defaultValue}, - fieldType => $fieldType - }; - } ## end foreach my $field ( keys %$meta) - - # add metadata management - if ( $session->user->isAdmin ) { - push @properties, '_metadatamanagement' => { - tab => "meta", - fieldType => "readOnly", - value => '

' - . $i18n->get('Add new field') - . '

', - hoverHelp => $i18n->get('Add new field description'), }; - } + $f->getTab('meta')->addField( $fieldType, %{ $fieldData } ); + } ## end foreach my $field ( keys %$meta) } ## end if ( $session->setting...) - # generate the form - for ( my $i = 0; $i < @properties; $i += 2 ) { - my $fieldName = $properties[$i]; - my %fieldHash = %{ $properties[ $i + 1 ] }; - my %params = ( name => $fieldName, value => $self->get($fieldName) ); - - # apply config file changes - foreach my $key ( keys %{ $overrides->{fields}{$fieldName} } ) { - $fieldHash{$key} = $overrides->{fields}{$fieldName}{$key}; - } - - # Kludge. - if ( isIn( $fieldHash{fieldType}, 'selectBox', 'workflow' ) and ref $params{value} ne 'ARRAY' ) { - $params{value} = [ $params{value} ]; - } - - %params = ( %fieldHash, %params ); - delete $params{tab}; - delete $params{tableName}; - - # if there isnt a tab specified lets define one - my $tab = $fieldHash{tab} || "properties"; - - #draw the field - $tabform->getTab($tab)->dynamicField(%params); - } ## end for ( my $i = 0; $i < @properties...) - - # send back the object - return $tabform; + return $f; } ## end sub getEditForm -=cut - sub setupFormField { my ( $self, $tabform, $fieldName, $extraFields, $overrides ) = @_; my %params = %{ $extraFields->{$fieldName} }; @@ -2083,7 +2044,7 @@ sub prepareWidgetView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Updates current Asset with data from Form. You can feed back errors by returning an arrayref containing the error messages. If there is no error you do not have to return @@ -2091,14 +2052,14 @@ anything. =cut -sub processPropertiesFromFormPost { +sub processEditForm { my $self = shift; my %data; my $form = $self->session->form; my $overrides = $self->session->config->get("assets/".$self->get("className")."/fields"); foreach my $property ($self->getProperties) { - my %params = %{$self->getProperty($property)}; + my %params = %{$self->getFormProperties($property)}; # apply config file changes foreach my $key (keys %{$overrides->{$property}}) { @@ -2115,7 +2076,7 @@ sub processPropertiesFromFormPost { # process the form element $params{name} = $property; - $params{value} = $self->get($property); + $params{value} = $self->$property; $data{$property} = $form->process( $property, $params{fieldType}, @@ -2604,10 +2565,19 @@ sub www_edit { return $self->session->privilege->insufficient() unless $self->canEdit; return $self->session->privilege->locked() unless $self->canEditIfLocked; - my $f = $self->getEditForm; + my $f = eval { $self->getEditForm }; + return $@ if $@; $f->addField( "Hidden", name => "func", value => "editSave" ); $f->action( $self->getUrl ); + # TODO: Make this whole thing a template instead! + $self->session->style->setRawHeadTags( + '' + ); + return $self->session->style->process( '
' . $f->toHtml . '
', "PBtmpl0000000000000137" @@ -2620,7 +2590,7 @@ sub www_edit { Saves and updates history. If canEdit, returns www_manageAssets() if a new Asset is created, otherwise returns www_view(). Will return an insufficient Privilege if canEdit returns False, or if the submitted form does not pass the C<$session->form->validToken> check. -NOTE: Don't try to override or overload this method. It won't work. What you are looking for is processPropertiesFromFormPost(). +NOTE: Don't try to override or overload this method. It won't work. What you are looking for is processEditForm(). =cut @@ -2654,7 +2624,7 @@ sub www_editSave { } # Process properties from form post - my $errors = $object->processPropertiesFromFormPost; + my $errors = $object->processEditForm; if (ref $errors eq 'ARRAY') { $session->stow->set('editFormErrors', $errors); if ($session->form->process('assetId') eq 'new') { diff --git a/lib/WebGUI/Asset/EMSSubmission.pm b/lib/WebGUI/Asset/EMSSubmission.pm index f7e819a5f..a1387917b 100644 --- a/lib/WebGUI/Asset/EMSSubmission.pm +++ b/lib/WebGUI/Asset/EMSSubmission.pm @@ -484,7 +484,6 @@ the shop tab is created here to mimic the function of the sku-created shop tab. this class holds data like Sku assets so that they can be assigned in the future when the sku asset is created from this data. -=cut override getEditTabs => sub { my $self = shift; @@ -492,6 +491,8 @@ override getEditTabs => sub { return (super(), ['shop', $sku_i18n->get('shop'), 9],); }; +=cut + #------------------------------------------------------------------- =head2 getQueueUrl diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index 2dac1fca3..963e22500 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -1297,7 +1297,7 @@ sub prepareView { #################################################################### -=head2 processPropertiesFromFormPost +=head2 processEditForm Processes the Event Edit form. @@ -1316,7 +1316,7 @@ Requests that the events be committed =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; super(); my $session = $self->session; diff --git a/lib/WebGUI/Asset/File.pm b/lib/WebGUI/Asset/File.pm index ddc48677c..78cb0a7dd 100644 --- a/lib/WebGUI/Asset/File.pm +++ b/lib/WebGUI/Asset/File.pm @@ -394,13 +394,13 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost +=head2 processEditForm Extend the master method to handle file uploads and applying constraints. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; my $session = $self->session; diff --git a/lib/WebGUI/Asset/File/GalleryFile.pm b/lib/WebGUI/Asset/File/GalleryFile.pm index 21fad7b3b..787676db5 100644 --- a/lib/WebGUI/Asset/File/GalleryFile.pm +++ b/lib/WebGUI/Asset/File/GalleryFile.pm @@ -715,12 +715,12 @@ sub processCommentEditForm { #---------------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; my $i18n = WebGUI::International->new( $self->session,'Asset_Photo' ); my $form = $self->session->form; diff --git a/lib/WebGUI/Asset/File/GalleryFile/Photo.pm b/lib/WebGUI/Asset/File/GalleryFile/Photo.pm index 738e07cf7..64f006baa 100644 --- a/lib/WebGUI/Asset/File/GalleryFile/Photo.pm +++ b/lib/WebGUI/Asset/File/GalleryFile/Photo.pm @@ -76,7 +76,7 @@ These methods are available from this class: =head2 applyConstraints ( options ) Apply the constraints to the original file. Called automatically by C -and C. +and C. This is a sort of catch-all method for applying things to the file after it's uploaded. This method simply calls other methods to do its work. @@ -411,7 +411,7 @@ sub makeResolutions { #---------------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Process the asset edit form. @@ -419,7 +419,7 @@ Make the default title into the file name minus the extention. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; my $i18n = WebGUI::International->new( $self->session,'Asset_Photo' ); my $form = $self->session->form; diff --git a/lib/WebGUI/Asset/File/ZipArchive.pm b/lib/WebGUI/Asset/File/ZipArchive.pm index 237018691..97148def8 100644 --- a/lib/WebGUI/Asset/File/ZipArchive.pm +++ b/lib/WebGUI/Asset/File/ZipArchive.pm @@ -135,14 +135,14 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Used to process properties from the form posted. In this asset, we use this method to deflate the zip file into the proper folder =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; #File should be saved here by the superclass super(); diff --git a/lib/WebGUI/Asset/MatrixListing.pm b/lib/WebGUI/Asset/MatrixListing.pm index f6c9fbb7e..15c8cdeb8 100644 --- a/lib/WebGUI/Asset/MatrixListing.pm +++ b/lib/WebGUI/Asset/MatrixListing.pm @@ -420,13 +420,13 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Used to process properties from the form posted. =cut -sub processPropertiesFromFormPost { +sub processEditForm { my $self = shift; my $session = $self->session; my $score = 0; diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 2a9ba3c56..0050422b5 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -1068,14 +1068,14 @@ override paste => sub { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost +=head2 processEditForm Extend the base method to handle archiving and unarchiving, making sticky and non-sticky, locking and unlocking posts. Calls postProcess when it is done. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; super(); my $session = $self->session; diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index 213d43150..e73689f0e 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -742,13 +742,13 @@ override postProcess => sub { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost +=head2 processEditForm Extend the base method to do captcha processing. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; if ($self->isNew && $self->getParent->useCaptcha) { diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index 00bc84110..4f02f02ae 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -808,14 +808,14 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) -See WebGUI::Asset::processPropertiesFromFormPost () for details. Extends the base class to delete +See WebGUI::Asset::processEditForm () for details. Extends the base class to delete the scratch variables, and to uncache the overrides. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; super(); my $scratchId = "Shortcut_" . $self->getId; diff --git a/lib/WebGUI/Asset/Sku.pm b/lib/WebGUI/Asset/Sku.pm index 0bff8a03a..68b451962 100644 --- a/lib/WebGUI/Asset/Sku.pm +++ b/lib/WebGUI/Asset/Sku.pm @@ -218,7 +218,6 @@ override getEditForm => sub { Not to be modified, just defines a new tab. -=cut override getEditTabs => sub { my $self = shift; @@ -226,6 +225,8 @@ override getEditTabs => sub { return (super(), ['shop', $i18n->get('shop'), 9]); }; +=cut + #------------------------------------------------------------------- =head2 getOptions ( ) @@ -565,13 +566,13 @@ sub onRemoveFromCart { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Extends the base class to process the tax data. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; my $output = super(); diff --git a/lib/WebGUI/Asset/Sku/EMSTicket.pm b/lib/WebGUI/Asset/Sku/EMSTicket.pm index 23688db94..87908472d 100644 --- a/lib/WebGUI/Asset/Sku/EMSTicket.pm +++ b/lib/WebGUI/Asset/Sku/EMSTicket.pm @@ -422,15 +422,15 @@ sub onRemoveFromCart { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Extended to support event meta fields. =cut -sub processPropertiesFromFormPost { +sub processEditForm { my $self = shift; - $self->SUPER::processPropertiesFromFormPost(@_); + $self->SUPER::processEditForm(@_); my $form = $self->session->form; my %metadata = (); foreach my $field (@{$self->getParent->getEventMetaFields}) { diff --git a/lib/WebGUI/Asset/Story.pm b/lib/WebGUI/Asset/Story.pm index 3131e90d7..46939687b 100644 --- a/lib/WebGUI/Asset/Story.pm +++ b/lib/WebGUI/Asset/Story.pm @@ -559,13 +559,13 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Handle photos and photo metadata, like captions, etc. =cut -sub processPropertiesFromFormPost { +sub processEditForm { my $self = shift; my $session = $self->session; $self->next::method; diff --git a/lib/WebGUI/Asset/Template.pm b/lib/WebGUI/Asset/Template.pm index f2974bb48..6340539c8 100644 --- a/lib/WebGUI/Asset/Template.pm +++ b/lib/WebGUI/Asset/Template.pm @@ -568,13 +568,13 @@ sub process { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost +=head2 processEditForm Extends the master class to handle template parsers, namespaces and template attachments. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; super(); my $session = $self->session; diff --git a/lib/WebGUI/Asset/WikiPage.pm b/lib/WebGUI/Asset/WikiPage.pm index e849d84b7..63293eb96 100644 --- a/lib/WebGUI/Asset/WikiPage.pm +++ b/lib/WebGUI/Asset/WikiPage.pm @@ -350,13 +350,13 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost +=head2 processEditForm Extends the master method to handle properties and attachments. =cut -sub processPropertiesFromFormPost { +sub processEditForm { my $self = shift; my $session = $self->session; $self->next::method(@_); diff --git a/lib/WebGUI/Asset/Wobject/Article.pm b/lib/WebGUI/Asset/Wobject/Article.pm index 6d5f51324..ec223e65f 100644 --- a/lib/WebGUI/Asset/Wobject/Article.pm +++ b/lib/WebGUI/Asset/Wobject/Article.pm @@ -243,14 +243,14 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Extend the super class to calculate total asset size from any files stored in the storage location. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; super(); my $size = 0; diff --git a/lib/WebGUI/Asset/Wobject/Calendar.pm b/lib/WebGUI/Asset/Wobject/Calendar.pm index 23f88abc3..08c0aa0f4 100644 --- a/lib/WebGUI/Asset/Wobject/Calendar.pm +++ b/lib/WebGUI/Asset/Wobject/Calendar.pm @@ -855,7 +855,7 @@ sub prepareView { #---------------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Process the Calendar Edit form. @@ -865,7 +865,7 @@ Adds / removes feeds from the feed trough. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; my $session = $self->session; my $form = $self->session->form; diff --git a/lib/WebGUI/Asset/Wobject/Carousel.pm b/lib/WebGUI/Asset/Wobject/Carousel.pm index 8ccef37fd..49f3510d4 100644 --- a/lib/WebGUI/Asset/Wobject/Carousel.pm +++ b/lib/WebGUI/Asset/Wobject/Carousel.pm @@ -157,13 +157,13 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Used to process properties from the form posted. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; my $form = $self->session->form; my (@items,$items); diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index b8abc3a76..bf3ff325a 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -982,7 +982,6 @@ sub duplicateBranch { Add a tab for the mail interface. -=cut sub getEditTabs { my $self = shift; @@ -990,6 +989,8 @@ sub getEditTabs { return ($self->next::method, ['mail', $i18n->get('mail'), 9]); } +=cut + #------------------------------------------------------------------- =head2 getNewThreadUrl( ) @@ -1389,7 +1390,7 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost +=head2 processEditForm Extend the base method to handle creating subscription groups, propagating group privileges to all descendants and clearing scratch variables for sort key @@ -1397,7 +1398,7 @@ and direction. =cut -sub processPropertiesFromFormPost { +sub processEditForm { my $self = shift; my $updatePrivs = ($self->session->form->process("groupIdView") ne $self->groupIdView || $self->session->form->process("groupIdEdit") ne $self->groupIdEdit); $self->next::method; diff --git a/lib/WebGUI/Asset/Wobject/Dashboard.pm b/lib/WebGUI/Asset/Wobject/Dashboard.pm index 3807eec01..18ef8e79c 100644 --- a/lib/WebGUI/Asset/Wobject/Dashboard.pm +++ b/lib/WebGUI/Asset/Wobject/Dashboard.pm @@ -280,13 +280,13 @@ override prepareView => sub { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost +=head2 processEditForm Extends the base method to handle assetsToHide. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; super(); if ($self->session->form->process("assetId") eq "new" && $self->session->form->process("class") eq 'WebGUI::Asset::Wobject::Dashboard') { diff --git a/lib/WebGUI/Asset/Wobject/DataTable.pm b/lib/WebGUI/Asset/Wobject/DataTable.pm index adbd3e061..a75fe8f18 100644 --- a/lib/WebGUI/Asset/Wobject/DataTable.pm +++ b/lib/WebGUI/Asset/Wobject/DataTable.pm @@ -152,8 +152,6 @@ override getEditForm => sub { Add a tab for the data table. -=cut - override getEditTabs => sub { my $self = shift; my $i18n = WebGUI::International->new( $self->session, "Asset_DataTable" ); @@ -161,6 +159,8 @@ override getEditTabs => sub { return ( super(), [ "data" => $i18n->get("tab label data") ], ); }; +=cut + #---------------------------------------------------------------------------- =head2 getTemplateVars ( ) diff --git a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm index 6fb344ca6..93dc1db31 100644 --- a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm +++ b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm @@ -803,14 +803,14 @@ sub processStyle { #---------------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Process the form to save the asset. Request approval from the Gallery's approval workflow. =cut -sub processPropertiesFromFormPost { +sub processEditForm { my $self = shift; my $form = $self->session->form; my $errors = $self->next::method || []; diff --git a/lib/WebGUI/Asset/Wobject/Poll.pm b/lib/WebGUI/Asset/Wobject/Poll.pm index 9f96e0deb..57cbd37ea 100644 --- a/lib/WebGUI/Asset/Wobject/Poll.pm +++ b/lib/WebGUI/Asset/Wobject/Poll.pm @@ -353,13 +353,13 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost +=head2 processEditForm Extend the base method to handle the answers and the Graphing plugin. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; super(); my $property = {}; diff --git a/lib/WebGUI/Asset/Wobject/WikiMaster.pm b/lib/WebGUI/Asset/Wobject/WikiMaster.pm index db2be6fab..f52eb94c2 100644 --- a/lib/WebGUI/Asset/Wobject/WikiMaster.pm +++ b/lib/WebGUI/Asset/Wobject/WikiMaster.pm @@ -727,13 +727,13 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost +=head2 processEditForm Extend the master method to propagate view and edit permissions down to the wiki pages. =cut -override processPropertiesFromFormPost => sub { +override processEditForm => sub { my $self = shift; my $groupsChanged = (($self->session->form->process('groupIdView') ne $self->groupIdView) diff --git a/lib/WebGUI/Asset/_NewAsset.skeleton b/lib/WebGUI/Asset/_NewAsset.skeleton index bb27448c2..c83e6da56 100644 --- a/lib/WebGUI/Asset/_NewAsset.skeleton +++ b/lib/WebGUI/Asset/_NewAsset.skeleton @@ -168,7 +168,7 @@ sub prepareView { #------------------------------------------------------------------- -=head2 processPropertiesFromFormPost ( ) +=head2 processEditForm ( ) Used to process properties from the form posted. Do custom things with noFormPost fields here, or do whatever you want. This method is called @@ -176,9 +176,9 @@ when /yourAssetUrl?func=editSave is requested/posted. =cut -sub processPropertiesFromFormPost { +sub processEditForm { my $self = shift; - $self->SUPER::processPropertiesFromFormPost; + $self->SUPER::processEditForm; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Form/Control.pm b/lib/WebGUI/Form/Control.pm index bd6ef9c61..a052face9 100644 --- a/lib/WebGUI/Form/Control.pm +++ b/lib/WebGUI/Form/Control.pm @@ -133,7 +133,7 @@ A text string that will be appended after the field when toHtmlWithWrapper() is =head4 labelClass -A stylesheet class assigned to the label with toHtmlWithWrapper() is called. Defaults to "formDescription". +A stylesheet class assigned to the label with toHtmlWithWrapper() is called. =head4 fieldClass @@ -176,7 +176,7 @@ sub definition { defaultValue=>1 }, labelClass=>{ - defaultValue=>"formDescription" + defaultValue=>"" }, fieldClass=>{ defaultValue=>"tableData" @@ -333,8 +333,10 @@ sub getDatabaseFieldType { sub getLabel { my ( $self ) = @_; - my $labelClass = $self->get("labelClass"); - $labelClass = qq| class="$labelClass" | if($self->get("labelClass")); + return '' if !$self->get('label'); + + my $labelClass = " " . $self->get("labelClass"); + $labelClass = qq| class="formDescription${labelClass}"|; my $hoverHelp = $self->get("hoverHelp") || ''; $hoverHelp =~ s/^\s+//; diff --git a/lib/WebGUI/FormBuilder.pm b/lib/WebGUI/FormBuilder.pm index 8349aac7f..7618bad34 100644 --- a/lib/WebGUI/FormBuilder.pm +++ b/lib/WebGUI/FormBuilder.pm @@ -162,6 +162,8 @@ sub toHtml { my ( $style, $url ) = $self->session->quick(qw{ style url }); $style->setLink( $url->extras('hoverhelp.css'), { rel => "stylesheet", type => "text/css" } ); + $style->setScript( $url->extras('yui/build/yahoo-dom-event/yahoo-dom-event.js') ); + $style->setScript( $url->extras('yui/build/container/container-min.js') ); $style->setScript( $url->extras('hoverhelp.js') ); my $html = $self->getHeader; diff --git a/lib/WebGUI/FormBuilder/Tabset.pm b/lib/WebGUI/FormBuilder/Tabset.pm index e02adfca2..9881bd227 100644 --- a/lib/WebGUI/FormBuilder/Tabset.pm +++ b/lib/WebGUI/FormBuilder/Tabset.pm @@ -75,7 +75,9 @@ sub toHtml { for ( my $i = 0; $i < @{$self->tabs}; $i++ ) { my $tab = $self->tabs->[$i]; - $html .= sprintf '
  • %s
  • ', $i, $tab->label; + $html .= '' + . sprintf( '%s', $i, $tab->label ) + . ''; } $html .= '' diff --git a/lib/WebGUI/Role/Asset/RssFeed.pm b/lib/WebGUI/Role/Asset/RssFeed.pm index b70cb8864..7f37ab13d 100644 --- a/lib/WebGUI/Role/Asset/RssFeed.pm +++ b/lib/WebGUI/Role/Asset/RssFeed.pm @@ -577,7 +577,6 @@ sub www_viewRss { Adds an RSS tab to the Edit Tabs. -=cut around getEditTabs => sub { my $orig = shift; @@ -588,5 +587,7 @@ around getEditTabs => sub { return $tabs; }; +=cut + 1; diff --git a/www/extras/admin/admin.js b/www/extras/admin/admin.js index 0f59d5e0c..32fda07cb 100644 --- a/www/extras/admin/admin.js +++ b/www/extras/admin/admin.js @@ -101,14 +101,15 @@ appendToUrl */ WebGUI.Admin.prototype.editAsset = function ( url ) { + // Show the view tab + this.tabBar.selectTab( 0 ); + this.currentTab = "view"; + // Open the edit form window.frames["view"].location.href = appendToUrl( url, "func=edit" ); // Mark undirty, as we'll clean it ourselves this.viewDirty = 0; - - // Show the view tab - this.tabBar.selectTab( 0 ); }; /**