fix bugs revealed by Test::Class tests
This commit is contained in:
parent
1de9a12365
commit
664e7686c6
16 changed files with 93 additions and 75 deletions
|
|
@ -2282,8 +2282,6 @@ sub processEditForm {
|
|||
}
|
||||
}
|
||||
|
||||
$self->session->log->info( Dumper \%data );
|
||||
|
||||
$self->session->db->beginTransaction;
|
||||
$self->update( \%data );
|
||||
$self->session->db->commit;
|
||||
|
|
@ -2939,7 +2937,7 @@ sub www_editSave {
|
|||
});
|
||||
if ($commitStatus eq 'redirect') {
|
||||
##Redirect set by tag. Return nothing to send the user over to the redirect.
|
||||
return undef;
|
||||
return 'redirect';
|
||||
}
|
||||
elsif ($commitStatus eq 'commit') {
|
||||
##Commit was successful. Update the local object cache so that it will no longer
|
||||
|
|
|
|||
|
|
@ -628,25 +628,6 @@ sub view {
|
|||
return $out;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit
|
||||
|
||||
Display the edit form to the user. Manually handles the template for displaying
|
||||
the inline view of the asset.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
my $f = $self->getEditForm;
|
||||
return $self->getAdminConsole->render($f->print,$self->addEditLabel);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_view
|
||||
|
|
|
|||
|
|
@ -237,24 +237,6 @@ sub view {
|
|||
return $out;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit ( )
|
||||
|
||||
Web facing method which is the default edit page
|
||||
|
||||
=cut
|
||||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
my $i18n = WebGUI::International->new($self->session, 'Asset_Wobject');
|
||||
my $addEdit = ($self->session->form->process("func") eq 'add') ? $i18n->get('add') : $i18n->get('edit');
|
||||
return $self->getAdminConsole->render($self->getEditForm->toHtml, $self->addEditLabel);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_view ( )
|
||||
|
|
|
|||
|
|
@ -833,7 +833,7 @@ sub www_edit {
|
|||
my $var = $self->get;
|
||||
my $matrix = $self->getParent;
|
||||
# TODO: Change to FormBuilder
|
||||
$var->{form} = $self->getEditForm->print;
|
||||
$var->{form} = $self->getEditForm->toHtml;
|
||||
|
||||
return $matrix->processStyle($self->processTemplate($var,$matrix->get("editListingTemplateId")));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1128,6 +1128,7 @@ override processEditForm => sub {
|
|||
}
|
||||
delete $self->{_storageLocation};
|
||||
$self->postProcess;
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1593,7 +1594,7 @@ sub www_edit {
|
|||
});
|
||||
$var{'form.header'} .= WebGUI::Form::hidden($session, {
|
||||
name=>"revision",
|
||||
value=>$form->param("revision")
|
||||
value=>$form->param("revision") || $self->revisionDate
|
||||
});
|
||||
$var{'form.header'} .= WebGUI::Form::hidden($session, {
|
||||
name=>"ownerUserId",
|
||||
|
|
|
|||
|
|
@ -122,12 +122,14 @@ sub www_view {
|
|||
my $url = $self->redirectUrl;
|
||||
WebGUI::Macro::process($self->session, \$url);
|
||||
if ($self->session->isAdminOn() && $self->canEdit) {
|
||||
return $self->getAdminConsole->render($i18n->get("what do you want to do with this redirect").'
|
||||
return '<h1>' . $i18n->get('assetName') . '</h1>'
|
||||
. $i18n->get("what do you want to do with this redirect").'
|
||||
<ul>
|
||||
<li><a href="'.$url.'">'.$i18n->get("go to the redirect url").'</a></li>
|
||||
<li><a href="'.$self->getUrl("func=edit").'">'.$i18n->get("edit the redirect properties").'</a></li>
|
||||
<li><a href="'.$self->getParent->getUrl.'">'.$i18n->get("go to the redirect parent page").'</a></li>
|
||||
</ul>',$i18n->get("assetName"));
|
||||
</ul>'
|
||||
;
|
||||
}
|
||||
unless ($url eq $self->url) {
|
||||
$self->session->response->setRedirect($url,$self->redirectType);
|
||||
|
|
|
|||
|
|
@ -94,14 +94,11 @@ override getEditForm => sub {
|
|||
$self->session->style->setScript($self->session->url->extras('wobject/Carousel/carousel.js'), {type =>
|
||||
'text/javascript'});
|
||||
|
||||
my $tableRowStart =
|
||||
'<tr id="items_row">'
|
||||
.' <td class="formDescription" valign="top" style="width: 180px;"><label for="item1">'
|
||||
.$i18n->get("items label").'</label><div class="wg-hoverhelp">'.$i18n->get("items description").'</div></td>'
|
||||
.' <td id="items_td" valign="top" class="tableData">'
|
||||
.' <input type="hidden" id="items_formId" name="items" />'
|
||||
.' <input type="button" value="Add item" onclick="window.carouselEditor.addTab()"></input><br />'
|
||||
." <br />\n";
|
||||
my $tableRowStart = ' <label for="item1">'
|
||||
. $i18n->get("items label").'</label><div class="wg-hoverhelp">'.$i18n->get("items description").'</div>'
|
||||
. ' <input type="hidden" id="items_formId" name="items" />'
|
||||
. ' <input type="button" value="Add item" onclick="window.carouselEditor.addTab()"></input><br />'
|
||||
. " <br />\n";
|
||||
|
||||
$tabform->getTab("properties")->addField('ReadOnly', value => $tableRowStart);
|
||||
|
||||
|
|
@ -161,7 +158,7 @@ onClick='javascript:deleteItem(this.id)'></input>\n"
|
|||
$items = JSON->new->encode( $items );
|
||||
my $i18nJson = JSON->new->encode( { "delete" => $i18n->get("delete") } );
|
||||
|
||||
$tabform->getTab('properties')->raw(<<"ENDHTML");
|
||||
$tabform->getTab('properties')->addField( "ReadOnly", name => 'editor', value => <<"ENDHTML");
|
||||
<div id="carouselEditor"></div>
|
||||
<script type="text/javascript">
|
||||
$loadMcePlugins
|
||||
|
|
@ -171,12 +168,6 @@ onClick='javascript:deleteItem(this.id)'></input>\n"
|
|||
</script>
|
||||
ENDHTML
|
||||
|
||||
my $tableRowEnd = qq|
|
||||
</td>
|
||||
</tr>
|
||||
|;
|
||||
$tabform->getTab("properties")->addField('ReadOnly', value => $tableRowEnd);
|
||||
|
||||
return $tabform;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,6 @@ sub getLanguages {
|
|||
my ($self) = @_;
|
||||
my $hashRef;
|
||||
for my $lang ( findsubmod 'WebGUI::i18n' ) {
|
||||
$self->session->log->info( "Found language $lang" );
|
||||
$lang =~ s/^WebGUI::i18n:://;
|
||||
$hashRef->{$lang} = $self->getLanguage($lang, "label");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package WebGUI::Role::Asset::Dashlet;
|
||||
|
||||
use Moose::Role;
|
||||
use JSON;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -38,7 +39,7 @@ sub fetchUserOverrides {
|
|||
my $userId = shift || $self->session->user->userId;
|
||||
my $properties_json = $self->session->db->quickScalar('select properties from Dashboard_userPrefs where dashboardAssetId=? and userId=? and dashletAssetId=?',[$dashboardAssetId, $userId, $self->getId,]);
|
||||
$properties_json ||= '{}';
|
||||
my $properties = from_json($properties_json);
|
||||
my $properties = JSON->new->decode($properties_json);
|
||||
return $properties;
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +116,7 @@ sub storeUserOverrides {
|
|||
my $dashboardAssetId = shift;
|
||||
my $properties = shift;
|
||||
my $userId = shift || $session->user->userId;
|
||||
my $properties_json = to_json($properties);
|
||||
my $properties_json = JSON->new->encode($properties);
|
||||
$session->db->write('DELETE FROM Dashboard_userPrefs where dashboardAssetId=? and userId=? and dashletAssetId=?',[$dashboardAssetId, $userId, $self->getId]);
|
||||
$session->db->write('INSERT INTO Dashboard_userPrefs (dashboardAssetId, userId, dashletAssetId, properties) VALUES (?,?,?,?)', [$dashboardAssetId, $userId, $self->getId, $properties_json]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue