processPropertiesFromFormPost to processEditForm
This commit is contained in:
parent
ad96c88a36
commit
3c17dafeb4
32 changed files with 154 additions and 169 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 => '<p><a href="'
|
||||
. $self->session->url->page("func=editMetaDataField;fid=new") . '">'
|
||||
. $i18n->get('Add new field')
|
||||
. '</a></p>',
|
||||
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(
|
||||
'<style type="text/css">
|
||||
label.formDescription { display: block; margin-top: 1em; font-weight: bold }
|
||||
.saveButtons { position: absolute; top: 3px; right: 5px; z-index: 9001; }
|
||||
</style>'
|
||||
);
|
||||
|
||||
return $self->session->style->process(
|
||||
'<div class="yui-skin-sam">' . $f->toHtml . '</div>',
|
||||
"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') {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<setFile>
|
||||
and C<processPropertiesFromFormPost>.
|
||||
and C<processEditForm>.
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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}) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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(@_);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
|
|
|||
|
|
@ -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 ( )
|
||||
|
|
|
|||
|
|
@ -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 || [];
|
||||
|
|
|
|||
|
|
@ -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 = {};
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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+//;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,9 @@ sub toHtml {
|
|||
|
||||
for ( my $i = 0; $i < @{$self->tabs}; $i++ ) {
|
||||
my $tab = $self->tabs->[$i];
|
||||
$html .= sprintf '<li><a href="#tab%i"><em>%s</em></a></li>', $i, $tab->label;
|
||||
$html .= '<li' . ( $i == 0 ? ' class="selected"' : '' ) . '>'
|
||||
. sprintf( '<a href="#tab%i"><em>%s</em></a>', $i, $tab->label )
|
||||
. '</li>';
|
||||
}
|
||||
|
||||
$html .= '</ul>'
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue