Merge branch 'master' of git@github.com:plainblack/webgui

Conflicts:

	docs/upgrades/upgrade_7.8.0-7.8.1.pl
This commit is contained in:
daviddelikat 2009-10-05 09:13:21 -05:00
commit f26d9f4570
78 changed files with 521 additions and 226 deletions

View file

@ -1,4 +1,5 @@
7.8.1
- mark $session->datetime->time as deprecated and remove its use from core code
- fixed: Wikis broken by 7.8.0 upgrade
- fixed #11024: In/Out Board Busted
- fixed #11025: Yo dudely in Wiki Keyword Search Template
@ -32,6 +33,14 @@
- fixed #11076: WebGUI::Account::Friends message_rpp
- fixed #11067: My Purchases Detail Template - Status Message broken
- fixed #11081: Prop style in 7.8.0?
- fixed #11083: TGC template bug fixes, round #1
- fixed #10544: Child assets under uncommitted parents
- fixed failure in test 250 of t/00_compile.t
- fixed #11084: option to view private profiles
- fixed #11082: Admin group in Visitor group?
- fixed #11049: form caching incorrectly
- fixed #11088: i18n Survey Section Information
- fixed #11087: SC asset repeats its own description in feeds
7.8.0
- upgraded YUI to 2.8.0r4

View file

@ -106,7 +106,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

Binary file not shown.

Binary file not shown.

View file

@ -398,7 +398,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -2015,7 +2015,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -213,7 +213,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -262,7 +262,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -175,7 +175,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -150,7 +150,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -129,7 +129,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -105,7 +105,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -199,7 +199,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -174,7 +174,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -221,7 +221,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -166,7 +166,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -215,7 +215,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -184,7 +184,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -280,7 +280,7 @@ sub finish {
upgradeToYUI28( $session );
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -323,7 +323,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -317,7 +317,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -413,7 +413,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -348,7 +348,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -187,7 +187,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -169,7 +169,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -112,7 +112,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -38,6 +38,7 @@ removeSQLFormTables( $session );
fixBadRevisionDateColumns( $session );
addEMSSubmission( $session );
removeImportCruft( $session );
removeAdminFromVisitorGroup( $session );
finish($session); # this line required
@ -51,6 +52,7 @@ finish($session); # this line required
# print "DONE!\n" unless $quiet;
#}
#----------------------------------------------------------------------------
# Describe what our function does
sub fixBadRevisionDateColumns {
my $session = shift;
@ -63,6 +65,7 @@ sub fixBadRevisionDateColumns {
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub removeSQLFormTables {
my $session = shift;
@ -70,11 +73,12 @@ sub removeSQLFormTables {
my $tablesUsed = $session->db->quickScalar("select count(*) from asset where className='WebGUI::Asset::Wobject::SQLForm'");
if (!$tablesUsed) {
$session->db->write('DROP TABLE IF EXISTS SQLForm_fieldOrder');
print "\n\t\tSQL Form not used, dropping table...";
print "\n\t\tSQL Form not used, dropping table..." unless $quiet;
}
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub removeOldSubscriptionTables {
my $session = shift;
@ -85,6 +89,7 @@ sub removeOldSubscriptionTables {
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub removeOldITransactTables {
my $session = shift;
@ -93,6 +98,17 @@ sub removeOldITransactTables {
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub removeAdminFromVisitorGroup {
my $session = shift;
print "\tRemoving Admin group from Visitor group... " unless $quiet;
$session->db->write("delete from groupGroupings where groupId='3' and inGroup='1'");
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub fixWikis {
my $session = shift;
@ -102,6 +118,7 @@ sub fixWikis {
print "Done.\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub fixEMSTemplates {
my $session = shift;
@ -163,6 +180,7 @@ ESQL
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub removeImportCruft {
my $session = shift;
@ -236,7 +254,7 @@ sub finish {
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".time().")");
$session->close();
}

View file

@ -2344,7 +2344,7 @@ sub publish {
my $assetIds = $self->session->db->buildArrayRef("select assetId from asset where lineage like ".$self->session->db->quote($self->get("lineage").'%')." $where");
my $idList = $self->session->db->quoteAndJoin($assetIds);
$self->session->db->write("update asset set state='published', stateChangedBy=".$self->session->db->quote($self->session->user->userId).", stateChanged=".$self->session->datetime->time()." where assetId in (".$idList.")");
$self->session->db->write("update asset set state='published', stateChangedBy=".$self->session->db->quote($self->session->user->userId).", stateChanged=".time()." where assetId in (".$idList.")");
my $cache = WebGUI::Cache->new($self->session);
foreach my $id (@{$assetIds}) {
# we do the purge directly cuz it's a lot faster than instantiating all these assets

View file

@ -174,7 +174,7 @@ sub getEditForm {
$tabform->getTab("properties")->readOnly(
-label=>$i18n->get('thumbnail'),
-hoverHelp=>$i18n->get('Thumbnail description'),
-value=>'<a href="'.$self->getFileUrl.'"><img src="'.$self->getThumbnailUrl.'?noCache='.$self->session->datetime->time().'" alt="thumbnail" /></a>'
-value=>'<a href="'.$self->getFileUrl.'"><img src="'.$self->getThumbnailUrl.'?noCache='.time().'" alt="thumbnail" /></a>'
);
my ($x, $y) = $self->getStorageLocation->getSizeInPixels($self->get("filename"));
$tabform->getTab("properties")->readOnly(

View file

@ -597,7 +597,7 @@ sub setRatings {
if ($ratings->{$category}) {
$db->write("insert into MatrixListing_rating
(userId, category, rating, timeStamp, listingId, ipAddress, assetId) values (?,?,?,?,?,?,?)",
[$session->user->userId,$category,$ratings->{$category},$session->datetime->time(),$self->getId,
[$session->user->userId,$category,$ratings->{$category},time(),$self->getId,
$session->env->get("HTTP_X_FORWARDED_FOR"),$matrixId]);
}
my $sql = "from MatrixListing_rating where listingId=? and category=?";

View file

@ -710,30 +710,31 @@ Returns a hash reference of template variables for this Post.
=cut
sub getTemplateVars {
my $self = shift;
my $self = shift;
my $session = $self->session;
my %var = %{$self->get};
my %var = %{$self->get};
my $postUser = WebGUI::User->new($session, $self->get("ownerUserId"));
$var{"userId"} = $self->get("ownerUserId");
$var{"user.isPoster"} = $self->isPoster;
$var{"avatar.url"} = $self->getAvatarUrl;
$var{"userProfile.url"} = $postUser->getProfileUrl($self->getUrl());
$var{"dateSubmitted.human"} =$self->session->datetime->epochToHuman($self->get("creationDate"));
$var{"dateUpdated.human"} =$self->session->datetime->epochToHuman($self->get("revisionDate"));
$var{'title.short'} = $self->chopTitle;
$var{content} = $self->formatContent if ($self->getThread);
$var{'user.canEdit'} = $self->canEdit if ($self->getThread);
$var{"delete.url"} = $self->getDeleteUrl;
$var{"edit.url"} = $self->getEditUrl;
$var{"status"} = $self->getStatus;
$var{"reply.url"} = $self->getReplyUrl;
$var{'reply.withquote.url'} = $self->getReplyUrl(1);
$var{'url'} = $self->getUrl.'#id'.$self->getId;
$var{'url.raw'} = $self->getUrl;
$var{'rating.value'} = $self->get("rating")+0;
$var{'rate.url.thumbsUp'} = $self->getRateUrl(1);
$var{'rate.url.thumbsDown'} = $self->getRateUrl(-1);
$var{'hasRated'} = $self->hasRated;
$var{"userId"} = $self->get("ownerUserId");
$var{"user.isPoster"} = $self->isPoster;
$var{"avatar.url"} = $self->getAvatarUrl;
$var{"userProfile.url"} = $postUser->getProfileUrl($self->getUrl());
$var{"hideProfileUrl" } = $self->get('ownerUserId') eq '1' || $session->user->isVisitor;
$var{"dateSubmitted.human"} = $self->session->datetime->epochToHuman($self->get("creationDate"));
$var{"dateUpdated.human"} = $self->session->datetime->epochToHuman($self->get("revisionDate"));
$var{'title.short'} = $self->chopTitle;
$var{content} = $self->formatContent if ($self->getThread);
$var{'user.canEdit'} = $self->canEdit if ($self->getThread);
$var{"delete.url"} = $self->getDeleteUrl;
$var{"edit.url"} = $self->getEditUrl;
$var{"status"} = $self->getStatus;
$var{"reply.url"} = $self->getReplyUrl;
$var{'reply.withquote.url'} = $self->getReplyUrl(1);
$var{'url'} = $self->getUrl.'#id'.$self->getId;
$var{'url.raw'} = $self->getUrl;
$var{'rating.value'} = $self->get("rating")+0;
$var{'rate.url.thumbsUp'} = $self->getRateUrl(1);
$var{'rate.url.thumbsDown'} = $self->getRateUrl(-1);
$var{'hasRated'} = $self->hasRated;
my $gotImage;
my $gotAttachment;
@{$var{'attachment_loop'}} = ();
@ -890,7 +891,7 @@ sub insertUserPostRating {
[$self->getId,
$self->session->user->userId,
$self->session->env->getIp,
$self->session->datetime->time(),
time(),
$rating,]
);
}

View file

@ -100,14 +100,16 @@ A reference to a WebGUI::Paginator object.
=cut
sub appendPostListTemplateVars {
my $self = shift;
my $var = shift;
my $p = shift;
my $page = $p->getPageData;
my $i = 0;
my ($icon, $datetime) = $self->session->quick(qw(icon datetime));
my $self = shift;
my $session = $self->session;
my $var = shift;
my $p = shift;
my $page = $p->getPageData;
my $i = 0;
my ($icon, $datetime) = $session->quick(qw(icon datetime));
my $isVisitor = $session->user->isVisitor;
foreach my $row (@$page) {
my $post = WebGUI::Asset->new($self->session,$row->{assetId}, $row->{className}, $row->{revisionDate});
my $post = WebGUI::Asset->new($session,$row->{assetId}, $row->{className}, $row->{revisionDate});
$post->{_parent} = $self; # caching parent for efficiency
my $controls = $icon->delete('func=delete',$post->get("url"),"Delete") . $icon->edit('func=edit',$post->get("url"));
if ($self->get("sortBy") eq "lineage") {
@ -132,6 +134,7 @@ sub appendPostListTemplateVars {
"lastReply.title" => $lastPost->get("title"),
"lastReply.user.isVisitor" => $lastPost->get("ownerUserId") eq "1",
"lastReply.username" => $lastPost->get("username"),
"lastReply.hideProfileUrl" => $lastPost->get("ownerUserId") eq "1" || $isVisitor,
"lastReply.userProfile.url" => $lastPost->getPosterProfileUrl(),
"lastReply.dateSubmitted.human" => $datetime->epochToHuman($lastPost->get("creationDate"),"%z"),
"lastReply.timeSubmitted.human" => $datetime->epochToHuman($lastPost->get("creationDate"),"%Z"),
@ -158,6 +161,7 @@ sub appendPostListTemplateVars {
"dateUpdated.human" => $datetime->epochToHuman($post->get("revisionDate"),"%z"),
"timeSubmitted.human" => $datetime->epochToHuman($post->get("creationDate"),"%Z"),
"timeUpdated.human" => $datetime->epochToHuman($post->get("revisionDate"),"%Z"),
"hideProfileUrl" => $post->get('ownerUserId') eq '1' || $isVisitor,
"userProfile.url" => $post->getPosterProfileUrl,
"user.isVisitor" => $post->get("ownerUserId") eq "1",
"edit.url" => $post->getEditUrl,
@ -175,7 +179,7 @@ sub appendPostListTemplateVars {
if ($row->{className} =~ m/^WebGUI::Asset::Post::Thread/) {
$postVars{'rating'} = $post->get('threadRating');
}
push(@{$var->{post_loop}}, \%postVars );
push(@{$var->{post_loop}}, \%postVars );
$i++;
}
$p->appendTemplateVars($var);
@ -1222,10 +1226,10 @@ sub getViewTemplateVars {
my %var;
$var{'user.canPost'} = $self->canPost;
$var{'user.canStartThread'} = $self->canStartThread;
$var{"add.url"} = $self->getNewThreadUrl;
$var{"rss.url"} = $self->getRssFeedUrl;
$var{'user.isModerator'} = $self->canModerate;
$var{'user.isVisitor'} = ($self->session->user->isVisitor);
$var{"add.url"} = $self->getNewThreadUrl;
$var{"rss.url"} = $self->getRssFeedUrl;
$var{'user.isModerator'} = $self->canModerate;
$var{'user.isVisitor'} = ($self->session->user->isVisitor);
$var{'user.isSubscribed'} = $self->isSubscribed;
$var{'sortby.title.url'} = $self->getSortByUrl("title");
$var{'sortby.username.url'} = $self->getSortByUrl("username");

View file

@ -27,6 +27,7 @@ use WebGUI::Asset::Wobject;
use WebGUI::Pluggable;
use WebGUI::DateTime;
use WebGUI::User;
use WebGUI::Utility;
use WebGUI::Group;
use WebGUI::AssetCollateral::DataForm::Entry;
use WebGUI::Form::SelectRichEditor;
@ -225,7 +226,8 @@ an entry is being viewed, bypass caching altogether.
sub getContentLastModified {
my $self = shift;
if ($self->currentView eq 'list' || $self->session->form->process('entryId')) {
my $hasCaptcha = isIn('Captcha', map { $_->{type} } map { $self->getFieldConfig($_) } @{ $self->getFieldOrder });
if ($self->currentView eq 'list' || $self->session->form->process('entryId') || $hasCaptcha) {
return time;
}
return $self->SUPER::getContentLastModified;
@ -1597,7 +1599,7 @@ sub www_editFieldSave {
$newSelf->createField($newName, \%field);
}
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session);
my $freshSelf = $newSelf->cloneFromDb();
if ($form->process("proceed") eq "editField") {
return $freshSelf->www_editField('new');

View file

@ -414,11 +414,11 @@ sub www_setStatus {
$db->write("delete from InOutBoard_status where userId=? and assetId=?", [ $sessionUserId, $self->getId ]);
$db->write(
"insert into InOutBoard_status (assetId,userId,status,dateStamp,message) values (?,?,?,?,?)",
[$self->getId, $sessionUserId, $status, $session->datetime->time(), $message ],
[$self->getId, $sessionUserId, $status, time(), $message ],
);
$db->write(
"insert into InOutBoard_statusLog (assetId,userId,createdBy,status,dateStamp,message) values (?,?,?,?,?,?)",
[$self->getId, $sessionUserId, $session->user->userId, $status, $session->datetime->time(), $message ],
[$self->getId, $sessionUserId, $session->user->userId, $status, time(), $message ],
);
}
else {
@ -452,7 +452,7 @@ sub www_viewReport {
-name=>"doit",
-value=>"1"
);
my $startDate = $self->session->datetime->addToDate($self->session->datetime->time(),0,0,-15);
my $startDate = $self->session->datetime->addToDate(time(),0,0,-15);
$startDate = $self->session->form->date("startDate") if ($self->session->form->process("doit"));
$f->date(
-name=>"startDate",

View file

@ -380,7 +380,7 @@ sub getKeywordStaticURL {
my $url = $self->getUrl;
my @parts = split /\//, $url;
my $lastPart = pop @parts;
if (index $lastPart, '.' == -1) {
if (index( $lastPart, '.' ) == -1) {
return join '/', $self->getUrl, $self->getKeywordFilename($keyword);
}
else {

View file

@ -24,6 +24,7 @@ use WebGUI::Form::Country;
use WebGUI::VersionTag;
use Text::CSV_XS;
use Params::Validate qw(:all);
use WebGUI::Macro;
Params::Validate::validation_options( on_fail => sub { WebGUI::Error::InvalidParam->throw( error => shift ) } );
my $TAP_PARSER_MISSING = <<END_WARN;
@ -1256,6 +1257,8 @@ sub www_loadSurvey {
$editHtml = $self->processTemplate( $var, $self->get('answerEditTemplateId') );
}
WebGUI::Macro::process($self->session, \$editHtml);
# Generate the list of valid goto targets
my $gotoTargets = $self->surveyJSON->getGotoTargets;

View file

@ -266,7 +266,8 @@ sub getTemplateVariables {
$item{author} = WebGUI::HTML::filter(scalar $object->author, 'javascript');
$item{guid} = WebGUI::HTML::filter(scalar $object->guid, 'javascript');
$item{link} = WebGUI::HTML::filter(scalar $object->link, 'javascript');
$item{description} = WebGUI::HTML::filter(scalar($object->description), 'javascript');
my $description = WebGUI::HTML::filter(scalar($object->description), 'javascript');
$item{description} = defined $description ? $description : '';
$item{descriptionFirst100words} = $item{description};
$item{descriptionFirst100words} =~ s/(((\S+)\s+){100}).*/$1/s;
$item{descriptionFirst75words} = $item{descriptionFirst100words};

View file

@ -64,7 +64,7 @@ sub cut {
return undef if ($self->getId eq $session->setting->get("defaultPage") || $self->getId eq $session->setting->get("notFoundPage"));
$session->db->beginTransaction;
$session->db->write("update asset set state='clipboard-limbo' where lineage like ? and state='published'",[$self->get("lineage").'%']);
$session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$session->user->userId, $session->datetime->time(), $self->getId]);
$session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$session->user->userId, time(), $self->getId]);
$session->db->commit;
$self->{_properties}{state} = "clipboard";
foreach my $asset ($self, @{$self->getLineage(['descendants'], {returnObjects => 1})}) {

View file

@ -204,7 +204,7 @@ sub exportAsHtml {
my $i18n = WebGUI::International->new($self->session, 'Asset');
# take down when we started to tell the user how long the process took.
my $startTime = $session->datetime->time;
my $startTime = time;
# get the export path and ensure it is valid.
my $exportPath = $self->exportCheckPath;
@ -298,7 +298,7 @@ sub exportAsHtml {
}
# we're done. give the user a status report.
my $timeRequired = $session->datetime->time - $startTime;
my $timeRequired = time - $startTime;
my $message = sprintf $i18n->get('export information'), $exportedCount, $timeRequired;
return $message;
}
@ -791,14 +791,15 @@ sub exportWriteFile {
my $dest = $self->exportGetUrlAsPath;
my $parent = $dest->parent;
eval { $parent->absolute->mkpath };
if($@) {
WebGUI::Error->throw(error => "could not make directory " . $parent->absolute->stringify);
$parent->absolute->mkpath( {error => \my $err} );
if (@$err) {
(undef, my $message) = %{ $err->[0] };
WebGUI::Error->throw(error => "Could not make directory " . $parent->absolute->stringify . ": " . $message);
}
# next, get the contents, open the file, and write the contents to the file.
my $fh = eval { $dest->open('>:utf8') };
if($@) {
if(! $fh) {
WebGUI::Error->throw(error => "can't open " . $dest->absolute->stringify . " for writing: $!");
}
$self->session->asset($self);

View file

@ -68,7 +68,7 @@ sub addChild {
my $self = shift;
my $properties = shift;
my $id = shift || $self->session->id->generate();
my $now = shift || $self->session->datetime->time();
my $now = shift || time();
my $options = shift;
# Check if it is possible to add a child to this asset. If not add it as a sibling of this asset.
@ -85,7 +85,8 @@ sub addChild {
$properties->{assetId} = $id;
$properties->{parentId} = $self->getId;
my $temp = WebGUI::Asset->newByPropertyHashRef($self->session,$properties) || croak "Couldn't create a new $properties->{className} asset!";
$temp->{_parent} = $self;
# Do not set the parent here, since it could be stale and poison the child
#$temp->{_parent} = $self;
my $newAsset = $temp->addRevision($properties, $now, $options);
$self->updateHistory("added child ".$id);
$self->session->http->setStatus(201,"Asset Creation Successful");

View file

@ -137,7 +137,7 @@ sub importAssetData {
my $error = $self->session->errorHandler;
my $id = $data->{properties}{assetId};
my $class = $data->{properties}{className};
my $version = $options->{overwriteLatest} ? 0 : $data->{properties}{revisionDate};
my $version = $options->{overwriteLatest} ? time : $data->{properties}{revisionDate};
# Load the class
WebGUI::Asset->loadModule( $self->session, $class );

View file

@ -289,7 +289,7 @@ sub trash {
$db->beginTransaction;
$outputSub->($i18n->get('Clearing asset tables'));
$db->write("update asset set state='trash-limbo' where lineage like ?",[$self->get("lineage").'%']);
$db->write("update asset set state='trash', stateChangedBy=?, stateChanged=? where assetId=?",[$session->user->userId, $session->datetime->time(), $self->getId]);
$db->write("update asset set state='trash', stateChangedBy=?, stateChanged=? where assetId=?",[$session->user->userId, time(), $self->getId]);
$db->commit;
# Update ourselves since we didn't use update()

View file

@ -65,7 +65,7 @@ A hash reference containing a list of properties to associate with the child.
=head3 revisionDate
An epoch date representing the date/time stamp that this revision was
created. Defaults to $self->session->datetime->time().
created. Defaults to time().
=head3 options
@ -87,7 +87,7 @@ Posts) will know not to send them under certain conditions.
sub addRevision {
my $self = shift;
my $properties = shift || {};
my $now = shift || $self->session->datetime->time();
my $now = shift || time();
my $options = shift;
my $autoCommitId = $self->getAutoCommitWorkflowId() unless ($options->{skipAutoCommitWorkflows});
@ -101,7 +101,16 @@ sub addRevision {
} );
}
else {
$workingTag = WebGUI::VersionTag->getWorking($self->session);
my $parentAsset;
if ( not defined( $parentAsset = $self->getParent ) ) {
$parentAsset = WebGUI::Asset->newPending( $self->session, $self->get('parentId') );
}
if ( $parentAsset->hasBeenCommitted ) {
$workingTag = WebGUI::VersionTag->getWorking( $self->session );
}
else {
$workingTag = WebGUI::VersionTag->new( $self->session, $parentAsset->get('tagId') );
}
}
#Create a dummy revision to be updated with real data later
@ -564,7 +573,7 @@ sub updateHistory {
my $session = $self->session;
my $action = shift;
my $userId = shift || $session->user->userId || '3';
my $dateStamp =$session->datetime->time();
my $dateStamp =time();
$session->db->write("insert into assetHistory (assetId, userId, actionTaken, dateStamp, url) values (?,?,?,?,?)", [$self->getId, $userId, $action, $dateStamp, $self->get('url')]);
}

View file

@ -64,7 +64,7 @@ sub _isDuplicateUsername {
my ($otherUser) = $self->session->db->quickArray("select count(*) from users where username=".$self->session->db->quote($username));
return 0 if !$otherUser;
my $i18n = WebGUI::International->new($self->session);
$self->error('<li>'.sprintf($i18n->get(77), $username,$username,$username,$self->session->datetime->epochToHuman($self->session->datetime->time(),"%y")).'</li>');
$self->error('<li>'.sprintf($i18n->get(77), $username,$username,$username,$self->session->datetime->epochToHuman(time(),"%y")).'</li>');
return 1;
}
@ -108,11 +108,11 @@ sub _logLogin {
[
$_[0],
$_[1],
$self->session->datetime->time(),
time(),
$self->session->env->getIp,
$self->session->env->get("HTTP_USER_AGENT"),
$self->session->getId,
$self->session->datetime->time(),
time(),
]
);
}

View file

@ -266,7 +266,7 @@ sub createAccountSave {
$properties->{ changeUsername } = $setting->get("webguiChangeUsername");
$properties->{ changePassword } = $setting->get("webguiChangePassword");
$properties->{ identifier } = $self->hashPassword($password);
$properties->{ passwordLastUpdated } = $session->datetime->time();
$properties->{ passwordLastUpdated } = time();
$properties->{ passwordTimeout } = $setting->get("webguiPasswordTimeout");
$properties->{ status } = 'Deactivated' if ($setting->get("webguiValidateEmail"));
@ -433,16 +433,16 @@ sub editUserFormSave {
unless (!$identifier || $identifier eq "password") {
$properties->{identifier} = $self->hashPassword($self->session->form->process('authWebGUI.identifier'));
if($userData->{identifier} ne $properties->{identifier}){
$properties->{passwordLastUpdated} =$self->session->datetime->time();
$properties->{passwordLastUpdated} =time();
}
}
$properties->{passwordTimeout} = $self->session->form->interval('authWebGUI.passwordTimeout');
$properties->{changeUsername} = $self->session->form->process('authWebGUI.changeUsername');
$properties->{changePassword} = $self->session->form->process('authWebGUI.changePassword');
if($userId eq "new") {
$properties->{passwordLastUpdated} =$self->session->datetime->time();
$properties->{passwordLastUpdated} =time();
if ($self->session->setting->get("webguiExpirePasswordOnCreation")){
$properties->{passwordLastUpdated} =$self->session->datetime->time() - $properties->{passwordTimeout};
$properties->{passwordLastUpdated} =time() - $properties->{passwordTimeout};
}
}
@ -753,7 +753,7 @@ sub login {
my $userData = $self->getParams;
if($self->getSetting("passwordTimeout") && $userData->{passwordTimeout}){
my $expireTime = $userData->{passwordLastUpdated} + $userData->{passwordTimeout};
if ($self->session->datetime->time() >= $expireTime){
if (time() >= $expireTime){
my $userId = $self->userId;
$self->logout;
return $self->resetExpiredPassword($userId);
@ -1031,7 +1031,7 @@ sub profileRecoverPasswordFinish {
$self->user( $user );
$self->saveParams($userId, $self->authMethod,
{ identifier => $self->hashPassword($password),
passwordLastUpdated => $self->session->datetime->time });
passwordLastUpdated => time });
$self->_logSecurityMessage;
return $self->SUPER::login;
} else {
@ -1182,7 +1182,7 @@ sub emailResetPasswordFinish {
$self->user(WebGUI::User->new($self->session, $userId));
$self->saveParams($userId, $self->authMethod,
{ identifier => $self->hashPassword($password),
passwordLastUpdated => $self->session->datetime->time });
passwordLastUpdated => time });
$self->_logSecurityMessage;
# delete the emailRecoverPasswordVerificationNumber
@ -1236,7 +1236,7 @@ sub resetExpiredPasswordSave {
return $self->resetExpiredPassword($u->userId, "<h1>".$i18n->get(70)."</h1><ul>".$error.'</ul>') if ($error);
$properties->{identifier} = $self->hashPassword($self->session->form->process("identifier"));
$properties->{passwordLastUpdated} =$self->session->datetime->time();
$properties->{passwordLastUpdated} =time();
$self->saveParams($u->userId,$self->authMethod,$properties);
$self->_logSecurityMessage();
@ -1314,7 +1314,7 @@ sub updateAccount {
$properties->{identifier} = $self->hashPassword($password);
$self->_logSecurityMessage();
if($userData->{identifier} ne $properties->{identifier}){
$properties->{passwordLastUpdated} =$self->session->datetime->time();
$properties->{passwordLastUpdated} =time();
}
}
}

View file

@ -82,7 +82,7 @@ sub definition {
push(@{$definition}, {
defaultValue=>{
defaultValue=>$session->datetime->time()
defaultValue=>time()
},
maxlength=>{
defaultValue=> 10

View file

@ -84,7 +84,7 @@ sub definition {
my $definition = shift || [];
push(@{$definition}, {
defaultValue=>{
defaultValue=>$session->datetime->time()
defaultValue=>time()
},
maxlength=>{
defaultValue=> 19

View file

@ -92,7 +92,7 @@ sub _defaults {
my $self = shift;
return {
groupId=>"new",
dateCreated=>$self->session->datetime->time(),
dateCreated=>time(),
expireOffset=>314496000,
karmaThreshold=>1000000000,
groupName=>"New Group",
@ -101,7 +101,7 @@ sub _defaults {
expireNotify=>0,
databaseLinkId=>0,
groupCacheTimeout=>3600,
lastUpdated=>$self->session->datetime->time(),
lastUpdated=>time(),
autoAdd=>0,
autoDelete=>0,
isEditable=>1,
@ -168,10 +168,10 @@ sub addUsers {
foreach my $uid (@{$users}) {
my ($isIn) = $self->session->db->quickArray("select count(*) from groupings where groupId=? and userId=?", [$self->getId, $uid]);
unless ($isIn) {
$self->session->db->write("insert into groupings (groupId,userId,expireDate) values (?,?,?)", [$self->getId, $uid, ($self->session->datetime->time()+$expireOffset)]);
$self->session->db->write("insert into groupings (groupId,userId,expireDate) values (?,?,?)", [$self->getId, $uid, (time()+$expireOffset)]);
$self->session->stow->delete("gotGroupsForUser");
} else {
$self->userGroupExpireDate($uid,($self->session->datetime->time()+$expireOffset));
$self->userGroupExpireDate($uid,(time()+$expireOffset));
}
}
}
@ -732,14 +732,14 @@ sub getIpUsers {
my $IpFilter;
return [] unless $IpFilter = $self->ipFilter();
my $time = $self->session->datetime->time();
my $time = time();
$IpFilter =~ s/\s//g;
my @filters = split /;/, $IpFilter;
my $query = "select userId,lastIP from userSession where expires > ?";
my $sth = $self->session->db->read($query, [ $self->session->datetime->time() ]);
my $sth = $self->session->db->read($query, [ time() ]);
my %localCache = ();
my @ipUsers = ();
while (my ($userId, $lastIP) = $sth->array() ) {
@ -837,7 +837,7 @@ sub getScratchUsers {
my $scratchFilter;
return [] unless $scratchFilter = $self->scratchFilter();
my $time = $self->session->datetime->time();
my $time = time();
$scratchFilter =~ s/\s//g;
my @filters = split /;/, $scratchFilter;
@ -878,7 +878,7 @@ sub getUserList {
my $withoutExpired = shift;
my $expireTime = 0;
if ($withoutExpired) {
$expireTime = $self->session->datetime->time();
$expireTime = time();
}
return $self->session->db->buildHashRef("select users.userId, users.username from users join groupings using(userId) where expireDate > ? and groupId = ? order by username asc", [$expireTime, $self->getId]);
}
@ -903,7 +903,7 @@ sub getUsers {
my $withoutExpired = shift;
my $expireTime = 0;
if ($withoutExpired) {
$expireTime = $self->session->datetime->time();
$expireTime = time();
}
my @users = $self->session->db->buildArray("select userId from groupings where expireDate > ? and groupId = ?", [$expireTime, $self->getId]);
return \@users;
@ -938,7 +938,7 @@ sub getUsersNotIn {
my $expireTime = 0;
if ($withoutExpired) {
$expireTime = $self->session->datetime->time();
$expireTime = time();
}
my $sql = q{
@ -1496,7 +1496,7 @@ sub set {
my $value = shift;
$self->get("groupId") unless ($self->{_group}); # precache group stuff
$self->{_group}{$name} = $value;
$self->session->db->setRow("groups","groupId",{groupId=>$self->getId, $name=>$value, lastUpdated=>$self->session->datetime->time()});
$self->session->db->setRow("groups","groupId",{groupId=>$self->getId, $name=>$value, lastUpdated=>time()});
$self->clearCaches;
}

View file

@ -103,7 +103,9 @@ our $HELP = {
{ 'name' => 'timeSubmitted.human' },
{ 'name' => 'timeUpdated.human' },
{ 'name' => 'userProfile.url' },
{ 'name' => 'user.isVisitor' },
{ 'name' => 'hideProfileUrl' },
{ 'name' => 'user.isVisitor',
'description' => 'post_loop_user.isVisitor' },
{ 'name' => 'edit.url' },
{ 'name' => 'controls' },
{ 'name' => 'isSecond' },
@ -116,6 +118,7 @@ our $HELP = {
{ 'name' => 'lastReply.url' },
{ 'name' => 'lastReply.title' },
{ 'name' => 'lastReply.user.isVisitor' },
{ 'name' => 'lastReply.hideProfileUrl' },
{ 'name' => 'lastReply.username' },
{ 'name' => 'lastReply.userProfile.url' },
{ 'name' => 'lastReply.dateSubmitted.human' },

View file

@ -40,7 +40,7 @@ sub process {
my $session = shift;
my (@param, $temp, $time);
@param = @_;
$time = $param[1] ||$session->datetime->time();
$time = $param[1] ||time();
$temp =$session->datetime->epochToHuman($time,$param[0]);
return $temp;
}

View file

@ -840,7 +840,7 @@ sub www_editUserSave {
}
# Display an error telling them the username they are trying to use is not available and suggest alternatives
} else {
$error = '<ul>' . sprintf($i18n->get(77), $postedUsername, $postedUsername, $postedUsername, $session->datetime->epochToHuman($session->datetime->time(),"%y")).'</ul>';
$error = '<ul>' . sprintf($i18n->get(77), $postedUsername, $postedUsername, $postedUsername, $session->datetime->epochToHuman(time(),"%y")).'</ul>';
}
if ($isSecondary) {
return _submenu($session,{workarea => $i18n->get(978)});

View file

@ -61,7 +61,7 @@ sub add {
[
$session->id->generate(), $session->user->userId,
$session->var->get("sessionId"), $assetId,
$session->datetime->time(),
time(),
]);
return undef;
}

View file

@ -950,7 +950,7 @@ sub setToEpoch {
}
unless ($dt) {
$self->session->errorHandler->warn("Could not format date $set for epoch. Returning current time");
return $self->time();
return time();
}
return $dt->epoch;
}
@ -959,7 +959,8 @@ sub setToEpoch {
=head2 time ( )
Returns an epoch date for now.
DEPRECATED - This method is deprecated, and should not be used in new code. Use
the perl built in function time().
=cut

View file

@ -193,7 +193,7 @@ sub gateway {
my $url = $self->session->config->get("gateway").'/'.$pageUrl;
$url =~ s/\/+/\//g;
if ($self->session->setting->get("preventProxyCache") == 1 and !$skipPreventProxyCache) {
$url = $self->append($url,"noCache=".randint(0,1000).':'.$self->session->datetime->time());
$url = $self->append($url,"noCache=".randint(0,1000).':'.time());
}
if ($pairs) {
$url = $self->append($url,$pairs);

View file

@ -184,14 +184,14 @@ sub new {
$self->session->{_sessionId} = $self->{_var}{sessionId};
return $self;
}
if ($self->{_var}{expires} && $self->{_var}{expires} < $session->datetime->time()) { ##Session expired, start a new one with the same Id
if ($self->{_var}{expires} && $self->{_var}{expires} < time()) { ##Session expired, start a new one with the same Id
$self->end;
$self->start(1,$sessionId);
}
elsif ($self->{_var}{sessionId} ne "") { ##Fetched an existing session. Update variables with recent data.
$self->{_var}{lastPageView} = $session->datetime->time();
$self->{_var}{lastPageView} = time();
$self->{_var}{lastIP} = $session->env->getIp;
$self->{_var}{expires} = $session->datetime->time() + $session->setting->get("sessionTimeout");
$self->{_var}{expires} = time() + $session->setting->get("sessionTimeout");
$self->session->{_sessionId} = $self->{_var}{sessionId};
$session->db->setRow("userSession","sessionId",$self->{_var});
return $self;
@ -241,7 +241,7 @@ sub start {
$userId = 1 if ($userId eq "");
my $sessionId = shift;
$sessionId = $self->session->id->generate if ($sessionId eq "");
my $time = $self->session->datetime->time();
my $time = time();
$self->{_var} = {
expires => $time + $self->session->setting->get("sessionTimeout"),
lastPageView => $time,

View file

@ -544,9 +544,9 @@ sub friends {
$myFriends->isEditable(0);
$self->uncache;
$self->{_user}{"friendsGroup"} = $myFriends->getId;
$self->{_user}{"lastUpdated"} = $self->session->datetime->time();
$self->{_user}{"lastUpdated"} = time();
$self->session->db->write("update users set friendsGroup=?, lastUpdated=? where userId=?",
[$myFriends->getId, $self->session->datetime->time(), $self->userId]);
[$myFriends->getId, time(), $self->userId]);
$self->{_friendsGroup} = $myFriends;
}
@ -642,7 +642,7 @@ sub getGroups {
my $withoutExpired = shift;
my $clause = "";
if ($withoutExpired) {
$clause = "and expireDate>".$self->session->datetime->time();
$clause = "and expireDate>".time();
}
my $gotGroupsForUser = $self->session->stow->get("gotGroupsForUser");
if (exists $gotGroupsForUser->{$self->userId}) {
@ -1016,7 +1016,7 @@ sub karma {
$self->uncache;
$self->{_user}{karma} += $amount;
$self->session->db->write("update users set karma=karma+? where userId=?", [$amount, $self->userId]);
$self->session->db->write("insert into karmaLog values (?,?,?,?,?)",[$self->userId, $amount, $source, $description, $self->session->datetime->time()]);
$self->session->db->write("insert into karmaLog values (?,?,?,?,?)",[$self->userId, $amount, $source, $description, time()]);
}
return $self->{_user}{karma};
}

View file

@ -137,7 +137,7 @@ sub create {
my $properties = shift;
my $tagId = $session->db->setRow("assetVersionTag","tagId",{
tagId=>"new",
creationDate=>$session->datetime->time(),
creationDate=>time(),
createdBy=>$session->user->userId
});
my $tag = $class->new($session, $tagId);
@ -178,7 +178,7 @@ sub commit {
if ($finished) {
$self->{_data}{isCommitted} = 1;
$self->{_data}{committedBy} = $self->session->user->userId unless ($self->{_data}{committedBy});
$self->{_data}{commitDate} = $self->session->datetime->time();
$self->{_data}{commitDate} = time();
$self->session->db->setRow("assetVersionTag", "tagId", $self->{_data});
$self->clearWorking;
return 1;
@ -674,7 +674,7 @@ sub set {
my $self = shift;
my $properties = shift;
my $now = $self->session->datetime->time();
my $now = time();
my $startTime = WebGUI::DateTime->new($self->session,$now)->toDatabase;
my $endTime = WebGUI::DateTime->new($self->session,'2036-01-01 00:00:00')->toDatabase;

View file

@ -71,7 +71,7 @@ See WebGUI::Workflow::Activity::execute() for details.
sub execute {
my $self = shift;
my $session = $self->session;
my $epoch = $self->session->datetime->time();
my $epoch = time();
my $getAnArchive = WebGUI::Asset::Wobject::StoryArchive->getIsa($session);
ARCHIVE: while (my $archive = $getAnArchive->()) {
next ARCHIVE unless $archive && $archive->get("archiveAfter");

View file

@ -69,7 +69,7 @@ See WebGUI::Workflow::Activity::execute() for details.
sub execute {
my $self = shift;
my $epoch = $self->session->datetime->time();
my $epoch = time();
my $a = $self->session->db->read("select assetId from asset where className='WebGUI::Asset::Wobject::Collaboration'");
while (my ($assetId) = $a->array) {
my $cs = WebGUI::Asset->new($self->session, $assetId, "WebGUI::Asset::Wobject::Collaboration");

View file

@ -81,7 +81,7 @@ sub execute {
return $self->COMPLETE;
}
my @userIds = $self->session->db->buildArray("SELECT a.userId FROM authentication AS a INNER JOIN users AS u ON a.userId = u.userId WHERE a.authMethod = 'WebGUI' AND a.fieldName = 'emailValidationKey' AND u.status = 'Deactivated' AND u.dateCreated < ?", [$self->session->datetime->time - $self->get('interval')]);
my @userIds = $self->session->db->buildArray("SELECT a.userId FROM authentication AS a INNER JOIN users AS u ON a.userId = u.userId WHERE a.authMethod = 'WebGUI' AND a.fieldName = 'emailValidationKey' AND u.status = 'Deactivated' AND u.dateCreated < ?", [time - $self->get('interval')]);
foreach my $userId (@userIds) {
WebGUI::User->new($self->session, $userId)->delete;
}

View file

@ -84,7 +84,7 @@ sub execute {
my $urlOfSingleAsset = "";
#By default, we'll make it so that things happen now.
my $time = $session->datetime->time();
my $time = time();
#If the type is startTime, we'll wait until the version tag starttime to proceed
if($self->get("type") eq "startTime") {
@ -98,7 +98,7 @@ sub execute {
my $dt = WebGUI::DateTime->new($session,$time);
#Get the current UTC time
my $now = WebGUI::DateTime->new($session,$session->datetime->time());
my $now = WebGUI::DateTime->new($session,time());
#Workflow is complete if the time has passed.
if($now->epoch >= $dt->epoch) {

View file

@ -1293,11 +1293,21 @@ the preview is displayed, the Post can either be edited or canceled.|,
lastUpdated => 1149655722,
},
'user.isVisitor' => {
'post_loop_user.isVisitor' => {
message => q|A conditional that is true if the poster is a visitor.|,
lastUpdated => 1149655722,
},
'user.isVisitor' => {
message => q|A conditional that is true if the current user is a visitor.|,
lastUpdated => 1149655722,
},
'hideProfileUrl' => {
message => q|A conditional that is true if the poster is a visitor, or the current user is a visitor. In the first case, Visitor's profile is not visible to any user. In the second case, Visitor is not allowed to view any user's profile|,
lastUpdated => 1254506340,
},
'edit.url' => {
message => q|The URL to edit this Post.|,
lastUpdated => 1149655722,
@ -1359,6 +1369,11 @@ user has an avatar.|,
lastUpdated => 1149655722,
},
'lastReply.hideProfileUrl' => {
message => q|A conditional that is true if the poster of the last reply is a visitor, or the current user is a visitor. In the first case, Visitor's profile is not visible to any user. In the second case, Visitor is not allowed to view any user's profile|,
lastUpdated => 1254506340,
},
'lastReply.username' => {
message => q|The name of user who submitted the last reply.|,
lastUpdated => 1149655722,

View file

@ -33,9 +33,9 @@ our $I18N = {
},
'template error' => {
message => q|There is a syntax error in this template, %s, %s. Please correct.|,
message => q|There is a syntax error in this template, %s, %s, %s. Please correct.|,
context => q|Error when executing template|,
lastUpdated => 1244476530,
lastUpdated => 1254512327,
},
'namespace description' => {

View file

@ -74,7 +74,7 @@ if ($userMessageFile) {
print "Searching for users with a status of $currentStatus ...\n" unless ($quiet);
my $userList;
my $now = $session->datetime->time();
my $now = time();
my $inbox = WebGUI::Inbox->new($session);
my $sth = $session->db->read("select userId,assetId from InOutBoard_status where status=?",[$currentStatus]);
while (my ($userId,$assetId) = $sth->array) {

View file

@ -213,7 +213,7 @@ sub calculateExpireOffset {
}
}
if ($units eq "fixed") {
my $seconds = (($offset - $session->datetime->time()));
my $seconds = (($offset - time()));
if ($seconds < 1) {
return undef;
}

View file

@ -815,67 +815,83 @@ is($iufpAsset2->get('url'), 'inheriturlfromparent01/iufp2', '... update works pr
################################################################
#
# requestAutoCommit to move uncommitted child to uncommitted parent
# addRevision to uncommitted child of uncommitted parent
#
################################################################
my $versionTag5 = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->tagsToRollback($versionTag5);
$versionTag5->set( { name => 'move commit of child to uncommitted parent on requestAutoCommit tests vt1' } );
$versionTag5->set( { name => 'move revision of uncommitted child to uncommitted parent tests vt1' } );
$properties = {
# '1234567890123456789012'
id => 'moveVersionToParent_01',
title => 'moveVersionToParent_01',
className => 'WebGUI::Asset::Wobject::Layout',
url => 'moveVersionToParent_01',
id => 'moveVersionToParent_01',
title => 'moveVersionToParent_01',
className => 'WebGUI::Asset::Wobject::Layout',
url => 'moveVersionToParent_01',
};
my $parentAsset = $defaultAsset->addChild($properties, $properties->{id});
my $parentVersionTag = WebGUI::VersionTag->new($session, $parentAsset->get('tagId'));
is($parentVersionTag->get('isCommitted'),0, 'built non-committed parent asset');
my $parentAsset = $defaultAsset->addChild( $properties, $properties->{id}, undef, { skipAutoCommitWorkflows => 1 } );
my $parentVersionTag = WebGUI::VersionTag->new( $session, $parentAsset->get('tagId') );
is( $parentVersionTag->get('isCommitted'), 0, 'built non-committed parent asset' );
my $versionTag6 = WebGUI::VersionTag->create($session, {});
WebGUI::Test->tagsToRollback($versionTag6);
$versionTag6->set( { name => 'move commit of child to uncommitted parent on requestAutoCommit tests vt2' } );
my $versionTag6 = WebGUI::VersionTag->create( $session, {} );
$versionTag6->set( { name => 'move revision of uncommitted child to uncommitted parent tests vt2' } );
$versionTag6->setWorking;
$properties2 = {
# '1234567890123456789012'
id => 'moveVersionToParent_03',
title => 'moveVersionToParent_03',
className => 'WebGUI::Asset::Wobject::Layout',
url => 'moveVersionToParent_03',
id => 'moveVersionToParent_03',
title => 'moveVersionToParent_03',
className => 'WebGUI::Asset::Wobject::Layout',
url => 'moveVersionToParent_03',
};
my $childAsset = $parentAsset->addChild($properties, $properties2->{id});
my $testAsset = WebGUI::Asset->newPending($session, $childAsset->get('parentId'));
my $testVersionTag = WebGUI::VersionTag->new($session, $testAsset->get('tagId'));
my $childAsset = $parentAsset->addChild(
$properties2, $properties2->{id},
time(),
{ skipAutoCommitWorkflows => 1 }
);
my $testAsset = WebGUI::Asset->newPending( $session, $childAsset->get('parentId') );
my $testVersionTag = WebGUI::VersionTag->new( $session, $testAsset->get('tagId') );
my $childVersionTag;
$childVersionTag = WebGUI::VersionTag->new($session, $childAsset->get('tagId'));
is($childVersionTag->get('isCommitted'),0, 'built non-committed child asset');
$childVersionTag = WebGUI::VersionTag->new( $session, $childAsset->get('tagId') );
is( $childVersionTag->get('isCommitted'), 0, 'built non-committed child asset' );
isnt($testAsset->get('tagId'),$childAsset->get('tagId'),'parent asset and child asset have different version tags');
isnt($testVersionTag->getId,$childVersionTag->getId,'parent asset and child asset version tags unmatched');
is( $testAsset->get('tagId'),
$childAsset->get('tagId'),
'uncommitted parent asset and uncommitted child asset have same version tag at addChild'
);
eval {
$childAsset->requestAutoCommit;
$childVersionTag = WebGUI::VersionTag->new($session, $childAsset->get('tagId'));
$properties2 = {
# '1234567890123456789012'
id => 'moveVersionToParent_03',
title => 'moveVersionToParent_03a',
className => 'WebGUI::Asset::Wobject::Layout',
url => 'moveVersionToParent_03a',
};
is($childVersionTag->get('isCommitted'),0, 'confirm non-committed child asset');
sleep 2;
$childAsset->addRevision( $properties2, time(), { skipAutoCommitWorkflows => 1 } );
is($testAsset->get('tagId'),$childAsset->get('tagId'),'parent asset and child asset have same version tags');
is( $parentVersionTag->get('isCommitted'), 0, 'confimr non-committed parent asset after revision' );
is( $childVersionTag->get('isCommitted'), 0, 'confirm non-committed child asset after revision' );
eval {
$testVersionTag->commit;
};
is( $testAsset->get('tagId'),
$childAsset->get('tagId'),
'uncommitted parent asset and uncommitted child asset have same version tag after addRevision'
);
is($testVersionTag->get('isCommitted'),1,'parent asset is now committed');
eval { $testVersionTag->commit; };
$childVersionTag = WebGUI::VersionTag->new($session, $childAsset->get('tagId'));
is($childVersionTag->get('isCommitted'),1,'child asset is now committed');
$session->log->warn('parent asset is now committed');
is( $testVersionTag->get('isCommitted'), 1, 'parent asset is now committed' );
$childVersionTag = WebGUI::VersionTag->new( $session, $childAsset->get('tagId') );
$session->log->warn('child asset is now committed');
is( $childVersionTag->get('isCommitted'), 1, 'child asset is now committed' );
################################################################
#

View file

@ -8,13 +8,6 @@
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
# XXX I (chrisn) started this file to test the features I added to the
# Collaboration / Post system for 7.5, but didn't have the time available to me
# to do a full test suite for the Post Wobject. This means that this test suite
# is *largely incomplete* and should be finished. What is here *is* the
# following:
#
#
# 1. The basic framework for a test suite for the Post Asset.
# Includes setup, cleanup, boilerplate, etc. Basically the really boring,
# repetitive parts of the test that you don't want to write yourself.
@ -26,7 +19,7 @@ use strict;
use lib "$FindBin::Bin/../lib";
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 9; # increment this value for each test you create
use Test::More tests => 16; # increment this value for each test you create
use WebGUI::Asset::Wobject::Collaboration;
use WebGUI::Asset::Post;
use WebGUI::Asset::Post::Thread;
@ -114,7 +107,11 @@ ok($post->canEdit(), "User in groupToEditPost group can edit post after the time
$session->user({userId => $groupIdEditUser->userId});
ok($post->canEdit(), "User in groupIdEditUserGroup group can edit post after the timeout");
######################################################################
#
# getSynopsisAndContent
#
######################################################################
my ($synopsis, $content) = $post->getSynopsisAndContent('', q|Brandheiße Neuigkeiten rund um's Klettern für euch aus der Region |);
is($synopsis, q|Brandheiße Neuigkeiten rund um's Klettern für euch aus der Region |, 'getSynopsisAndContent: UTF8 characters okay');
@ -132,9 +129,40 @@ is($synopsis, q|less than &lt; greater than &gt;|, '... HTML escaped characters
($synopsis, $content) = $post->getSynopsisAndContent('', q|<p>less than &lt; greater than &gt;</p>|);
is($synopsis, q|less than < greater than >|, '... HTML entities decoded by HTML::splitTag');
TODO: {
local $TODO = "Tests to make later";
ok(0, 'Whole lot more work to do here');
}
######################################################################
#
# getTemplateVars
#
######################################################################
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
my $post1 = $collab->addChild({
className => 'WebGUI::Asset::Post::Thread',
content => 'hello, world!',
ownerUserId => 3,
}, @addArgs);
my $post2 = $collab->addChild({
className => 'WebGUI::Asset::Post::Thread',
content => 'hello, world!',
ownerUserId => 1,
}, @addArgs);
$versionTag2->commit();
WebGUI::Test->tagsToRollback($versionTag);
my $variables;
$session->user({userId => 1});
$variables = $post1->getTemplateVars();
is( $variables->{'ownerUserId'}, 3, 'first post owned by admin');
ok( $variables->{'hideProfileUrl'}, 'hide profile url, since current user is visitor');
$variables = $post2->getTemplateVars();
is( $variables->{'ownerUserId'}, 1, 'first post owned by admin');
ok( $variables->{'hideProfileUrl'}, 'hide profile url, since current user is visitor');
$session->user({userId => 3});
$variables = $post1->getTemplateVars();
is( $variables->{'ownerUserId'}, 3, 'first post owned by admin');
ok( !$variables->{'hideProfileUrl'}, 'show profile url');
$variables = $post2->getTemplateVars();
is( $variables->{'ownerUserId'}, 1, 'first post owned by admin');
ok( $variables->{'hideProfileUrl'}, 'hide profile url, since poster is visitor');
# vim: syntax=perl filetype=perl

View file

@ -25,6 +25,10 @@ use CSS::Packer;
use JavaScript::Packer;
use WebGUI::Asset::Template;
if ( !$ENV{CODE_COP} ) {
plan skip_all => "Set CODE_COP to enable these tests";
}
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
@ -32,6 +36,7 @@ my $templates = WebGUI::Asset->getRoot( $session )
->getLineage( ['descendants'], {
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
} );
WebGUI::Test->tagsToRollback( WebGUI::VersionTag->getWorking( $session ) );
#----------------------------------------------------------------------------
# Tests
@ -66,9 +71,4 @@ for my $templateId ( @$templates ) {
}
#----------------------------------------------------------------------------
# Cleanup
END {
WebGUI::VersionTag->getWorking( $session )->rollback;
}
#vim:ft=perl

View file

@ -0,0 +1,92 @@
# vim:syntax=perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 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
#------------------------------------------------------------------
# Test the Collaboration system template variables
#
#
use FindBin;
use strict;
use lib "$FindBin::Bin/../../../lib";
use WebGUI::Test; # Must use this before any other WebGUI modules
use Test::More;
use Test::Deep;
use Data::Dumper;
use WebGUI::Session;
#----------------------------------------------------------------------------
# Tests
plan tests => 20; # Increment this number for each test you create
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
my @addChildArgs = ( {skipAutoCommitWorkflows=>1} );
my $collab = WebGUI::Asset->getImportNode( $session )->addChild({
className => 'WebGUI::Asset::Wobject::Collaboration',
threadsPerPage => 20,
displayLastReply => 1,
});
my @threads = (
$collab->addChild( {
className => 'WebGUI::Asset::Post::Thread',
title => "X - Foo",
isSticky => 0,
ownerUserId => 1,
}, undef, 1, @addChildArgs),
$collab->addChild( {
className => 'WebGUI::Asset::Post::Thread',
title => "X - Bar",
isSticky => 0,
ownerUserId => 3,
}, undef, 2, @addChildArgs),
);
$_->setSkipNotification for @threads; # 100+ messages later...
my $versionTag = WebGUI::VersionTag->getWorking( $session );
$versionTag->commit;
WebGUI::Test->tagsToRollback($versionTag);
my $templateVars;
my $posts;
$session->user({userId => 3});
$templateVars = $collab->getViewTemplateVars();
##Threads come in reverse order, most recent first
$posts = $templateVars->{post_loop};
is( $posts->[1]->{'ownerUserId'}, 1, 'first post owned by visitor');
ok( $posts->[1]->{'user.isVisitor'}, 'first post made by visitor');
ok( $posts->[1]->{'hideProfileUrl'}, 'hide profile url, since post made by visitor');
ok( $posts->[1]->{'lastReply.user.isVisitor'}, 'lastReply not made by visitor');
ok( $posts->[1]->{'lastReply.hideProfileUrl'}, 'lastReply show profile url, since post not made by visitor, and user is not visitor');
is( $posts->[0]->{'ownerUserId'}, 3, 'second post owned by admin');
ok( !$posts->[0]->{'user.isVisitor'}, 'first post made by visitor');
ok( !$posts->[0]->{'hideProfileUrl'}, 'show profile url, since post made by admin, and user is not visitor');
ok( !$posts->[0]->{'lastReply.user.isVisitor'}, 'lastReply not made by visitor');
ok( !$posts->[0]->{'lastReply.hideProfileUrl'}, 'lastReply show profile url, since post not made by visitor, and user is not visitor');
$session->user({userId => 1});
$templateVars = $collab->getViewTemplateVars();
##Threads come in reverse order, most recent first
$posts = $templateVars->{post_loop};
is( $posts->[1]->{'ownerUserId'}, 1, 'first post owned by visitor');
ok( $posts->[1]->{'user.isVisitor'}, 'first post made by visitor');
ok( $posts->[1]->{'hideProfileUrl'}, 'hide profile url, since current user is visitor');
ok( $posts->[1]->{'lastReply.user.isVisitor'}, 'lastReply not made by visitor');
ok( $posts->[1]->{'lastReply.hideProfileUrl'}, 'lastReply hide profile url, since user is visitor');
is( $posts->[0]->{'ownerUserId'}, 3, 'second post owned by admin');
ok( !$posts->[0]->{'user.isVisitor'}, 'first post made by visitor');
ok( $posts->[0]->{'hideProfileUrl'}, 'hide profile url, and user is visitor');
ok( !$posts->[0]->{'lastReply.user.isVisitor'}, 'lastReply not made by visitor');
ok( $posts->[0]->{'lastReply.hideProfileUrl'}, 'lastReply hide profile url, since user is visitor');
#vim:ft=perl

View file

@ -36,6 +36,12 @@ my $df = WebGUI::Asset->getImportNode( $session )
fieldConfiguration => '[]',
} );
my $dform = WebGUI::Asset->getDefault($session)->addChild({
className => "WebGUI::Asset::Wobject::DataForm",
mailData => 0,
});
$dform->createField('gotCaptcha', { type => 'Captcha', name => 'humanCheck', });
my $versionTag = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->tagsToRollback($versionTag);
$versionTag->commit;
@ -43,7 +49,7 @@ $versionTag->commit;
#----------------------------------------------------------------------------
# Tests
plan tests => 1; # Increment this number for each test you create
plan tests => 4; # Increment this number for each test you create
#----------------------------------------------------------------------------
# _createForm
@ -60,4 +66,26 @@ $df->_createForm(
is($WebGUI::Test::logger_error, "Unable to load form control - MASSIVE FORM FAILURE", '_createForm logs when it cannot load a form type');
#----------------------------------------------------------------------------
# getContentLastModified
sleep 3;
$df->{_mode} = 'form';
is($df->getContentLastModified, $df->get('lastModified'), 'getContentLastModified: form normally returns lastModified');
$df->{_mode} = 'list';
cmp_ok(
$df->getContentLastModified,
'>',
$df->get('lastModified'),
'... form in list mode does not return lastModified'
);
$dform->{_mode} = 'form';
cmp_ok(
$dform->getContentLastModified,
'>',
$dform->get('lastModified'),
'... form with a captcha does not return lastModified, even in form mode'
);
#vim:ft=perl

View file

@ -18,18 +18,13 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
my $tests = 46;
plan tests => $tests + 1;
plan tests => 47;
#----------------------------------------------------------------------------
# put your tests here
my $usedOk = use_ok('WebGUI::Asset::Wobject::Survey');
my ($survey);
SKIP: {
skip $tests, "Unable to load Survey" unless $usedOk;
my $user = WebGUI::User->new( $session, 'new' );
WebGUI::Test->usersToDelete($user);
my $import_node = WebGUI::Asset->getImportNode($session);
@ -252,7 +247,6 @@ cmp_deeply(from_json($surveyEnd), { type => 'forward', url => '/getting_started'
is($survey->responseJSON->nextResponseSection()->{text}, 'new text', '..wheras the original response uses the original text');
}
}
# Test visualization
eval 'use GraphViz';
@ -314,3 +308,13 @@ cmp_deeply(
],
"Admin console submenu",
);
####################################################
#
# www_loadSurvey
#
####################################################
my $survey_json = $survey->www_loadSurvey({});
my $survey_data = JSON::from_json($survey_json);
unlike($survey_data->{edithtml}, qr/\^International/, 'www_loadSurvey process macros');

View file

@ -20,13 +20,12 @@ use Data::Dumper;
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 19; # increment this value for each test you create
use Test::More tests => 20; # increment this value for each test you create
use WebGUI::Asset::Wobject::SyndicatedContent;
use XML::FeedPP;
my $session = WebGUI::Test->session;
my %var;
my (@rss_feeds);
##############################
## SETUP ##
@ -37,6 +36,7 @@ my $node = WebGUI::Asset->getImportNode($session);
# Create a version tag to work in
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"SyndicatedContent Test"});
WebGUI::Test->tagsToRollback($versionTag);
my $syndicated_content = $node->addChild({className=>'WebGUI::Asset::Wobject::SyndicatedContent'});
##############################
@ -106,8 +106,35 @@ cmp_ok(scalar(@{$var->{item_loop}}), '>', 0, 'the item loop has items');
my $processed_template = eval {$syndicated_content->processTemplate($var,undef,$template) };
ok($processed_template, "A response was received from processTemplate.");
END {
# Clean up after thy self
$versionTag->rollback();
}
####################################################################
#
# getTemplateVariables
#
####################################################################
##Construct a feed with no description, so the resulting template variables can
##be checked for an undef description
my $feed = XML::FeedPP->new(<<EOFEED);
<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://purl.org/atom/ns#" version="0.3" xmlns:admin="http://webns.net/mvcb/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/">
<title type="text/plain">Revision Log - /WebGUI/</title>
<link rel="alternate" type="text/html" href="https://svn.webgui.org/svnweb/plainblack/log/WebGUI/" />
<author>
<name></name>
</author>
<modified>1970-01-01T00:53:41</modified>
<entry>
<title type="text/plain">12312 - Ready for 7.7.20 development.
</title>
<link rel="alternate" type="text/html" href="https://svn.webgui.org/svnweb/plainblack/revision?rev=12312" />
<author>
<name>colin</name>
</author>
<id>https://svn.webgui.org/svnweb/plainblack/revision?rev=12312</id>
<issued>1970-01-01T00:53:41</issued>
<modified>1970-01-01T00:53:41</modified>
</entry>
EOFEED
my $vars = $syndicated_content->getTemplateVariables($feed);
ok( defined $vars->{item_loop}->[0]->{description}, 'getTemplateVariables: description is not undefined');

View file

@ -75,7 +75,7 @@ my @ipTests = (
);
plan tests => (152 + scalar(@scratchTests) + scalar(@ipTests)); # increment this value for each test you create
plan tests => (151 + scalar(@scratchTests) + scalar(@ipTests)); # increment this value for each test you create
my $session = WebGUI::Test->session;
my $testCache = WebGUI::Cache->new($session, 'myTestKey');
@ -660,10 +660,6 @@ ok( !$cacheDude->isInGroup($gB->getId), "Cache dude is not a member of group B")
##Admin group inclusion check.
my $vgroup = WebGUI::Group->new($session, 1);
my $vgroups = $vgroup->getGroupsIn();
ok( isIn(3, @{ $vgroups }), 'Admin Group is in Group Visitor');
SKIP: {
skip("need to test expiration date in groupings interacting with recursive or not", 1);
ok(undef, "expiration date in groupings for getUser");

View file

@ -23,7 +23,7 @@ use WebGUI::Asset;
use Test::More;
use Test::Deep;
my $startingTime = $session->datetime->time();
my $startingTime = time();
my $numTests = 5; # increment this value for each test you create
plan tests => 1 + $numTests;
@ -77,7 +77,7 @@ is($count, 0, 'add: Nothing added if passive profiling is not enabled');
$session->setting->set('passiveProfilingEnabled', 1);
my $timeLogged;
$timeLogged = $session->datetime->time();
$timeLogged = time();
WebGUI::PassiveProfiling::add( $session, $page->getId );
my $count = $session->db->quickScalar('select count(*) from passiveProfileLog where assetId=? and dateOfEntry >= ?',[$page->getId, $startingTime]);

View file

@ -91,10 +91,8 @@ is($guidStorage->getDirectoryId, $newGuid, '... getDirectoryId');
#
####################################################
my $savecdn = $session->config->get('cdn');
if ($savecdn) {
$session->config->delete('cdn');
}
WebGUI::Test->originalConfig('cdn');
$session->config->delete('cdn');
# Note: the CDN configuration will be reverted after CDN tests below
my $storageDir1 = join '/', $uploadDir, '7e', '8a', '7e8a1b6a';
@ -530,10 +528,7 @@ my $cdnCfg = {
"syncProgram" => "cp -r -- '%s' $cdnTestPath/",
"deleteProgram" => "rm -r -- '$cdnTestPath/%s' > /dev/null 2>&1"
};
my ($addedCdnQ, $addedCdnU);
$addedCdnQ = mkdir $cdnCfg->{'queuePath'} unless -e $cdnCfg->{'queuePath'};
my $dest = substr($cdnCfg->{'url'}, 7);
$addedCdnU = mkdir $dest unless -e $dest;
$session->config->set('cdn', $cdnCfg);
my $cdnUrl = $cdnCfg->{'url'};
my $cdnUlen = length $cdnUrl;
@ -715,11 +710,4 @@ END {
) {
ref $stor eq "WebGUI::Storage" and $stor->delete;
}
if ($savecdn) {
$session->config->set('cdn', $savecdn);
} else {
$session->config->delete('cdn');
}
$addedCdnQ and rmdir $addedCdnQ;
$addedCdnU and rmdir $addedCdnU;
}

48
t/templateSyntax.t Normal file
View file

@ -0,0 +1,48 @@
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 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
#-------------------------------------------------------------------
use FindBin;
use strict;
use warnings;
use lib "$FindBin::Bin/lib"; ##t/lib
use WebGUI::Test;
use WebGUI::Session;
use Data::Dumper;
use WebGUI::Asset::Template;
#The goal of this test is to locate poorly used macros in the default
#templates;
use Test::More; # increment this value for each test you create
my $numTests = 0;
my $session = WebGUI::Test->session;
my $lib = WebGUI::Test->lib;
# put your tests here
$numTests = $session->db->quickScalar('select count(distinct(assetId)) from template');
plan tests => $numTests;
my $getATemplate = WebGUI::Asset::Template->getIsa($session);
while (my $templateAsset = $getATemplate->()) {
my $output = $templateAsset->process({});
unlike(
$output,
qr/\AError processing template:/,
sprintf "%s: %s (%s) has no syntax errors",
$templateAsset->getTitle, $templateAsset->getId, $templateAsset->getUrl
);
}