many bug fixes

This commit is contained in:
JT Smith 2005-03-24 14:47:57 +00:00
parent c3273e1d53
commit b84ae38958
15 changed files with 88 additions and 97 deletions

View file

@ -369,11 +369,11 @@ sub definition {
},
startDate=>{
fieldType=>'dateTime',
defaultValue=>undef
defaultValue=>997995720
},
endDate=>{
fieldType=>'dateTime',
defaultValue=>undef
defaultValue=>32472169200
},
assetSize=>{
noFormPost=>1,
@ -684,7 +684,7 @@ sub getAssetAdderLinks {
my $getContainerLinks = shift;
my $type = "assets";
$type = "assetContainers" if ($getContainerLinks);
my @links;
my %links;
foreach my $class (@{$session{config}{$type}}) {
my $load = "use ".$class;
eval ($load);
@ -703,10 +703,7 @@ sub getAssetAdderLinks {
} else {
my $url = $self->getUrl("func=add&class=".$class);
$url = WebGUI::URL::append($url,$addToUrl) if ($addToUrl);
push(@links, {
label=>$label,
url=>$url
});
$links{$label} = $url;
}
}
}
@ -721,12 +718,16 @@ sub getAssetAdderLinks {
my $asset = WebGUI::Asset->newByDynamicClass($id,$class);
my $url = $self->getUrl("func=add&class=".$class."&prototype=".$id);
$url = WebGUI::URL::append($url,$addToUrl) if ($addToUrl);
push(@links,{
label=>$asset->get("title"),
url=>$url
});
$links{$asset->get("title")} = $url;
}
return \@links;
my @sortedLinks;
foreach my $label (sort keys %links) {
push(@sortedLinks,{
label=>$label,
url=>$links{$label}
});
}
return \@sortedLinks;
}
#-------------------------------------------------------------------

View file

@ -163,6 +163,8 @@ sub editSave {
$data{className} = $className;
$data{storageId} = $storage->getId;
$data{filename} = $data{title} = $data{menuTitle} = $filename;
$data{templateId} = 'PBtmpl0000000000000024';
$data{templateId} = 'PBtmpl0000000000000088' if ($className eq "WebGUI::Asset::File::Image");
$data{url} = $class->getParent->getUrl.'/'.$filename;
my $newAsset = $class->getParent->addChild(\%data);
$newAsset->setSize($storage->getFileSize($filename));

View file

@ -469,27 +469,16 @@ sub rate {
#-------------------------------------------------------------------
=head2 setLastPost ( lastPostDate, lastPostId )
=head2 setStatusApproved ( )
Sets the pertinent details for the last post. Can also be done directly using the set method.
=head3 lastPostDate
The epoch date of the post.
=head3 lastPostId
The unique id of the post.
Sets the post to approved and sends any necessary notifications.
=cut
sub setLastPost {
my ($self, $postDate, $postId) = @_;
$self->update({
lastPostId=>$postId,
lastPostDate=>$postDate
});
$self->getParent->setLastPost($postDate, $postId);
sub setStatusApproved {
my $self = shift;
$self->SUPER::setStatusApproved;
$self->getParent->incrementThreads($self->get("dateUpdated"),$self->getId) unless ($self->isReply);
}

View file

@ -137,7 +137,10 @@ Returns the TabForm object that will be used in generating the edit page for thi
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
# $tabform->getTab("properties")->raw('<input type="hidden" name="op2" value="'.$session{form}{afterEdit}.'" />');
$tabform->hidden({
name=>"returnUrl",
value=>$session{form}{returnUrl}
});
if ($self->getValue("namespace") eq "") {
my $namespaces = WebGUI::SQL->buildHashRef("select distinct(namespace),namespace
from template order by namespace");
@ -334,6 +337,14 @@ sub www_edit {
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get('edit template', 'Template'));
}
#-------------------------------------------------------------------
sub www_goBackToPage {
my $self = shift;
WebGUI::HTTP::setRedirect($session{form}{returnUrl}) if ($session{form}{returnUrl});
return "";
}
#-------------------------------------------------------------------
sub www_manage {
my $self = shift;

View file

@ -755,31 +755,6 @@ sub recalculateRating {
}
#-------------------------------------------------------------------
=head2 setLastPost ( lastPostDate, lastPostId )
Sets the pertinent details for the last post. Can also be done directly using the set method.
=head3 lastPostDate
The epoch date of the post.
=head3 lastPostId
The asset id of the post.
=cut
sub setLastPost {
my ($self, $postDate, $postId) = @_;
$self->update({
lastPostId=>$postId,
lastPostDate=>$postDate
});
}
#-------------------------------------------------------------------
=head2 subscribe ( )

View file

@ -165,6 +165,8 @@ sub view {
type=>$child->getName,
url=>$child->getUrl,
isImage=>$isImage,
canEdit=>$child->canEdit,
controls=>$child->getToolbar,
isFile=>$isFile,
"thumbnail.url"=>$thumbnail,
"file.url"=>$file

View file

@ -81,6 +81,10 @@ sub getEditForm {
-value=>$self->getValue('templateId'),
-namespace=>"Navigation"
);
$tabform->hidden({
name=>"returnUrl",
value=>$session{form}{returnUrl}
});
my ($descendantsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
my @assetsToInclude = split("\n",$self->getValue("assetsToInclude"));
my $afterScript;
@ -239,7 +243,11 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar {
my $self = shift;
if ($self->getToolbarState) {
my $toolbar = editIcon('func=edit',$self->get("url"));
my $returnUrl;
if (exists $session{asset}) {
$returnUrl = "&proceed=goBackToPage&returnUrl=".WebGUI::URL::escape($session{asset}->getUrl);
}
my $toolbar = editIcon('func=edit'.$returnUrl,$self->get("url"));
return '<img src="'.$self->getIcon(1).'" border="0" title="'.$self->getName.'" alt="'.$self->getName.'" align="absmiddle">'.$toolbar;
}
return $self->SUPER::getToolbar();
@ -388,6 +396,14 @@ sub www_edit {
}
#-------------------------------------------------------------------
sub www_goBackToPage {
my $self = shift;
WebGUI::HTTP::setRedirect($session{form}{returnUrl}) if ($session{form}{returnUrl});
return "";
}
#-------------------------------------------------------------------
# we eventually should reaadd this
sub www_preview {

View file

@ -2138,10 +2138,6 @@ The left column label for this form row.
The namespace (or type) of templates to show in this list.
=head3 afterEdit
A URL that will be acted upon after editing a template. Typically there is a link next to the select list that reads "Edit this template" and this is the URL to go to after editing is complete.
=head3 extras
If you want to add anything special to this form element like javascript actions, or stylesheet information, you'd add it in here as follows:
@ -2171,11 +2167,12 @@ sub template {
$label = $label || WebGUI::International::get(356);
my $template = WebGUI::Asset->newByDynamicClass($value);
if (defined $template && $template->canEdit) {
# if ($afterEdit) {
$buttons = editIcon("func=edit",$template->get("url"));
#"&namespace=".$namespace."&afterEdit=".WebGUI::URL::escape($afterEdit));
# }
$buttons .= manageIcon("func=manage",$template->get("url"));
my $returnUrl;
if (exists $session{asset}) {
$returnUrl = "&proceed=goBackToPage&returnUrl=".WebGUI::URL::escape($session{asset}->getUrl);
}
$buttons = editIcon("func=edit".$returnUrl,$template->get("url"));
$buttons .= manageIcon("",$template->getParent->get("url"));
}
$output = WebGUI::Form::template({
"name"=>$name,

View file

@ -1,6 +1,7 @@
package WebGUI::Operation::Subscription;
use strict;
use WebGUI::DateTime;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::HTMLForm;
@ -268,6 +269,8 @@ sub www_listSubscriptionCodeBatches {
$output .= '</table>';
$output .= $p->getBarTraditional($session{form}{pn});
$output = $i18n->get('no subscription code batches') unless (@{$batches});
return _submenu($output, 'Manage subscription code batches', 'manage batch');
}
@ -279,9 +282,9 @@ sub www_listSubscriptionCodes {
my $i18n = WebGUI::International->new("Subscription");
my $dcStart = WebGUI::FormProcessor::date('dcStart');
my $dcStop = WebGUI::FormProcessor::date('dcStop');
my $dcStop = WebGUI::DateTime::addToTime(WebGUI::FormProcessor::date('dcStop'),23,59);
my $duStart = WebGUI::FormProcessor::date('duStart');
my $duStop = WebGUI::FormProcessor::date('duStop');
my $duStop = WebGUI::DateTime::addToTime(WebGUI::FormProcessor::date('duStop'),23,59);
my $batches = WebGUI::SQL->buildHashRef("select batchId, description from subscriptionCodeBatch");
$output .= $i18n->get('selection message');

View file

@ -1,6 +1,12 @@
package WebGUI::i18n::English::Subscription;
our $I18N = {
'no subscription code batches' => {
message => q|No subscription code batches have been created yet. Use the submenu on the right to generate a batch.|,
lastUpdated => 1101228391,
context => q|Displayed if no subscription code batches have been created|
},
'listSubscriptionCodes title' => {
message => q|Manage Subscription Codes|,
lastUpdated => 1101228391,