diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index e19ebc027..2c3f9d4e1 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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 diff --git a/docs/upgrades/_upgrade.skeleton b/docs/upgrades/_upgrade.skeleton index ce2ab4743..cf2a0eff9 100644 --- a/docs/upgrades/_upgrade.skeleton +++ b/docs/upgrades/_upgrade.skeleton @@ -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(); } diff --git a/docs/upgrades/packages-7.8.1/article-with-pagination.wgpkg b/docs/upgrades/packages-7.8.1/article-with-pagination.wgpkg new file mode 100644 index 000000000..8b441cf73 Binary files /dev/null and b/docs/upgrades/packages-7.8.1/article-with-pagination.wgpkg differ diff --git a/docs/upgrades/packages-7.8.1/layout.css.wgpkg b/docs/upgrades/packages-7.8.1/layout.css.wgpkg new file mode 100644 index 000000000..c84b3a6f1 Binary files /dev/null and b/docs/upgrades/packages-7.8.1/layout.css.wgpkg differ diff --git a/docs/upgrades/packages-7.8.1/root_import_collaboration.wgpkg b/docs/upgrades/packages-7.8.1/root_import_collaboration.wgpkg new file mode 100644 index 000000000..ec10bf3e7 Binary files /dev/null and b/docs/upgrades/packages-7.8.1/root_import_collaboration.wgpkg differ diff --git a/docs/upgrades/packages-7.8.1/three-columns.wgpkg b/docs/upgrades/packages-7.8.1/three-columns.wgpkg new file mode 100644 index 000000000..6f2b7e2b2 Binary files /dev/null and b/docs/upgrades/packages-7.8.1/three-columns.wgpkg differ diff --git a/docs/upgrades/upgrade_7.6.14-7.7.0.pl b/docs/upgrades/upgrade_7.6.14-7.7.0.pl index 5c8d2f415..5576a1bf8 100644 --- a/docs/upgrades/upgrade_7.6.14-7.7.0.pl +++ b/docs/upgrades/upgrade_7.6.14-7.7.0.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.6.35-7.7.17.pl b/docs/upgrades/upgrade_7.6.35-7.7.17.pl index fd3b49f90..4444ab040 100644 --- a/docs/upgrades/upgrade_7.6.35-7.7.17.pl +++ b/docs/upgrades/upgrade_7.6.35-7.7.17.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.0-7.7.1.pl b/docs/upgrades/upgrade_7.7.0-7.7.1.pl index c43ddc5e9..9fd1c0d77 100644 --- a/docs/upgrades/upgrade_7.7.0-7.7.1.pl +++ b/docs/upgrades/upgrade_7.7.0-7.7.1.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.1-7.7.2.pl b/docs/upgrades/upgrade_7.7.1-7.7.2.pl index d8cf758b9..472d1a16b 100644 --- a/docs/upgrades/upgrade_7.7.1-7.7.2.pl +++ b/docs/upgrades/upgrade_7.7.1-7.7.2.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.10-7.7.11.pl b/docs/upgrades/upgrade_7.7.10-7.7.11.pl index d768908f6..bc6529e1a 100644 --- a/docs/upgrades/upgrade_7.7.10-7.7.11.pl +++ b/docs/upgrades/upgrade_7.7.10-7.7.11.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.11-7.7.12.pl b/docs/upgrades/upgrade_7.7.11-7.7.12.pl index f4d4e2030..2efdc9389 100644 --- a/docs/upgrades/upgrade_7.7.11-7.7.12.pl +++ b/docs/upgrades/upgrade_7.7.11-7.7.12.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.12-7.7.13.pl b/docs/upgrades/upgrade_7.7.12-7.7.13.pl index 40c8fbbd3..649d43179 100644 --- a/docs/upgrades/upgrade_7.7.12-7.7.13.pl +++ b/docs/upgrades/upgrade_7.7.12-7.7.13.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.13-7.7.14.pl b/docs/upgrades/upgrade_7.7.13-7.7.14.pl index d0c51c3aa..964378ebd 100644 --- a/docs/upgrades/upgrade_7.7.13-7.7.14.pl +++ b/docs/upgrades/upgrade_7.7.13-7.7.14.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.14-7.7.15.pl b/docs/upgrades/upgrade_7.7.14-7.7.15.pl index 8852c6eed..1480dfc02 100644 --- a/docs/upgrades/upgrade_7.7.14-7.7.15.pl +++ b/docs/upgrades/upgrade_7.7.14-7.7.15.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.15-7.7.16.pl b/docs/upgrades/upgrade_7.7.15-7.7.16.pl index 17441d1f2..4c92c0d07 100644 --- a/docs/upgrades/upgrade_7.7.15-7.7.16.pl +++ b/docs/upgrades/upgrade_7.7.15-7.7.16.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.16-7.7.17.pl b/docs/upgrades/upgrade_7.7.16-7.7.17.pl index 877a3834d..bae2730d3 100644 --- a/docs/upgrades/upgrade_7.7.16-7.7.17.pl +++ b/docs/upgrades/upgrade_7.7.16-7.7.17.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.17-7.7.18.pl b/docs/upgrades/upgrade_7.7.17-7.7.18.pl index b9ec5056d..cdb14def3 100644 --- a/docs/upgrades/upgrade_7.7.17-7.7.18.pl +++ b/docs/upgrades/upgrade_7.7.17-7.7.18.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.18-7.7.19.pl b/docs/upgrades/upgrade_7.7.18-7.7.19.pl index b28c1d16c..e9f3e3a2e 100644 --- a/docs/upgrades/upgrade_7.7.18-7.7.19.pl +++ b/docs/upgrades/upgrade_7.7.18-7.7.19.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.2-7.7.3.pl b/docs/upgrades/upgrade_7.7.2-7.7.3.pl index cf6479fad..8dcf2e68b 100644 --- a/docs/upgrades/upgrade_7.7.2-7.7.3.pl +++ b/docs/upgrades/upgrade_7.7.2-7.7.3.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.20-7.8.0.pl b/docs/upgrades/upgrade_7.7.20-7.8.0.pl index 4f11f654c..08ffebafe 100644 --- a/docs/upgrades/upgrade_7.7.20-7.8.0.pl +++ b/docs/upgrades/upgrade_7.7.20-7.8.0.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.3-7.7.4.pl b/docs/upgrades/upgrade_7.7.3-7.7.4.pl index ced0eec44..dd7e465b1 100644 --- a/docs/upgrades/upgrade_7.7.3-7.7.4.pl +++ b/docs/upgrades/upgrade_7.7.3-7.7.4.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.4-7.7.5.pl b/docs/upgrades/upgrade_7.7.4-7.7.5.pl index 81345892a..b9aa42acb 100644 --- a/docs/upgrades/upgrade_7.7.4-7.7.5.pl +++ b/docs/upgrades/upgrade_7.7.4-7.7.5.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.5-7.7.6.pl b/docs/upgrades/upgrade_7.7.5-7.7.6.pl index 1e6510595..4d60e49f4 100644 --- a/docs/upgrades/upgrade_7.7.5-7.7.6.pl +++ b/docs/upgrades/upgrade_7.7.5-7.7.6.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.6-7.7.7.pl b/docs/upgrades/upgrade_7.7.6-7.7.7.pl index 48921dbe6..7f9d33eab 100644 --- a/docs/upgrades/upgrade_7.7.6-7.7.7.pl +++ b/docs/upgrades/upgrade_7.7.6-7.7.7.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.7-7.7.8.pl b/docs/upgrades/upgrade_7.7.7-7.7.8.pl index e68ecaa94..3b3d3534e 100644 --- a/docs/upgrades/upgrade_7.7.7-7.7.8.pl +++ b/docs/upgrades/upgrade_7.7.7-7.7.8.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.8-7.7.9.pl b/docs/upgrades/upgrade_7.7.8-7.7.9.pl index f6a6365f2..06998f639 100644 --- a/docs/upgrades/upgrade_7.7.8-7.7.9.pl +++ b/docs/upgrades/upgrade_7.7.8-7.7.9.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.7.9-7.7.10.pl b/docs/upgrades/upgrade_7.7.9-7.7.10.pl index be4e8d1fe..feb8fecce 100644 --- a/docs/upgrades/upgrade_7.7.9-7.7.10.pl +++ b/docs/upgrades/upgrade_7.7.9-7.7.10.pl @@ -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(); } diff --git a/docs/upgrades/upgrade_7.8.0-7.8.1.pl b/docs/upgrades/upgrade_7.8.0-7.8.1.pl index 0d98ad45f..4ee26b19e 100644 --- a/docs/upgrades/upgrade_7.8.0-7.8.1.pl +++ b/docs/upgrades/upgrade_7.8.0-7.8.1.pl @@ -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(); } diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 202fab508..e8e222ec0 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -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 diff --git a/lib/WebGUI/Asset/File/Image.pm b/lib/WebGUI/Asset/File/Image.pm index d9ca122c2..c0d705a88 100644 --- a/lib/WebGUI/Asset/File/Image.pm +++ b/lib/WebGUI/Asset/File/Image.pm @@ -174,7 +174,7 @@ sub getEditForm { $tabform->getTab("properties")->readOnly( -label=>$i18n->get('thumbnail'), -hoverHelp=>$i18n->get('Thumbnail description'), - -value=>'thumbnail' + -value=>'thumbnail' ); my ($x, $y) = $self->getStorageLocation->getSizeInPixels($self->get("filename")); $tabform->getTab("properties")->readOnly( diff --git a/lib/WebGUI/Asset/MatrixListing.pm b/lib/WebGUI/Asset/MatrixListing.pm index 7539558bc..1ffd68b65 100644 --- a/lib/WebGUI/Asset/MatrixListing.pm +++ b/lib/WebGUI/Asset/MatrixListing.pm @@ -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=?"; diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index ad8d9e113..58729cf3c 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -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,] ); } diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index 0f3efef69..8d13c67a4 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -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"); diff --git a/lib/WebGUI/Asset/Wobject/DataForm.pm b/lib/WebGUI/Asset/Wobject/DataForm.pm index b00b53d17..98ad15708 100644 --- a/lib/WebGUI/Asset/Wobject/DataForm.pm +++ b/lib/WebGUI/Asset/Wobject/DataForm.pm @@ -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'); diff --git a/lib/WebGUI/Asset/Wobject/InOutBoard.pm b/lib/WebGUI/Asset/Wobject/InOutBoard.pm index b58daab24..88a3477b9 100644 --- a/lib/WebGUI/Asset/Wobject/InOutBoard.pm +++ b/lib/WebGUI/Asset/Wobject/InOutBoard.pm @@ -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", diff --git a/lib/WebGUI/Asset/Wobject/StoryArchive.pm b/lib/WebGUI/Asset/Wobject/StoryArchive.pm index c69cc0b91..2153afaf9 100644 --- a/lib/WebGUI/Asset/Wobject/StoryArchive.pm +++ b/lib/WebGUI/Asset/Wobject/StoryArchive.pm @@ -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 { diff --git a/lib/WebGUI/Asset/Wobject/Survey.pm b/lib/WebGUI/Asset/Wobject/Survey.pm index 58022db24..37bbbb0e0 100644 --- a/lib/WebGUI/Asset/Wobject/Survey.pm +++ b/lib/WebGUI/Asset/Wobject/Survey.pm @@ -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 = <processTemplate( $var, $self->get('answerEditTemplateId') ); } + WebGUI::Macro::process($self->session, \$editHtml); + # Generate the list of valid goto targets my $gotoTargets = $self->surveyJSON->getGotoTargets; diff --git a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm index aaaff5316..d11e31757 100644 --- a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm +++ b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm @@ -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}; diff --git a/lib/WebGUI/AssetClipboard.pm b/lib/WebGUI/AssetClipboard.pm index ab1ab2efb..5ff01f5ca 100644 --- a/lib/WebGUI/AssetClipboard.pm +++ b/lib/WebGUI/AssetClipboard.pm @@ -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})}) { diff --git a/lib/WebGUI/AssetExportHtml.pm b/lib/WebGUI/AssetExportHtml.pm index 708004fa1..a54566f59 100644 --- a/lib/WebGUI/AssetExportHtml.pm +++ b/lib/WebGUI/AssetExportHtml.pm @@ -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); diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm index 659b1d9f1..26f4a17e7 100644 --- a/lib/WebGUI/AssetLineage.pm +++ b/lib/WebGUI/AssetLineage.pm @@ -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"); diff --git a/lib/WebGUI/AssetPackage.pm b/lib/WebGUI/AssetPackage.pm index c0c5ab51b..8420444be 100644 --- a/lib/WebGUI/AssetPackage.pm +++ b/lib/WebGUI/AssetPackage.pm @@ -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 ); diff --git a/lib/WebGUI/AssetTrash.pm b/lib/WebGUI/AssetTrash.pm index 3b329d6e6..873d5404e 100644 --- a/lib/WebGUI/AssetTrash.pm +++ b/lib/WebGUI/AssetTrash.pm @@ -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() diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index 5db3c4919..ab4018a35 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -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')]); } diff --git a/lib/WebGUI/Auth.pm b/lib/WebGUI/Auth.pm index 9ddeb45ec..1355d24fb 100644 --- a/lib/WebGUI/Auth.pm +++ b/lib/WebGUI/Auth.pm @@ -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('
  • '.sprintf($i18n->get(77), $username,$username,$username,$self->session->datetime->epochToHuman($self->session->datetime->time(),"%y")).'
  • '); + $self->error('
  • '.sprintf($i18n->get(77), $username,$username,$username,$self->session->datetime->epochToHuman(time(),"%y")).'
  • '); 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(), ] ); } diff --git a/lib/WebGUI/Auth/WebGUI.pm b/lib/WebGUI/Auth/WebGUI.pm index 9321af0a9..75a86fb12 100644 --- a/lib/WebGUI/Auth/WebGUI.pm +++ b/lib/WebGUI/Auth/WebGUI.pm @@ -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, "

    ".$i18n->get(70)."

    ') 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(); } } } diff --git a/lib/WebGUI/Form/Date.pm b/lib/WebGUI/Form/Date.pm index 0cc454a8c..a3c62a0fd 100644 --- a/lib/WebGUI/Form/Date.pm +++ b/lib/WebGUI/Form/Date.pm @@ -82,7 +82,7 @@ sub definition { push(@{$definition}, { defaultValue=>{ - defaultValue=>$session->datetime->time() + defaultValue=>time() }, maxlength=>{ defaultValue=> 10 diff --git a/lib/WebGUI/Form/DateTime.pm b/lib/WebGUI/Form/DateTime.pm index 8a7f6b7d2..8938654c6 100644 --- a/lib/WebGUI/Form/DateTime.pm +++ b/lib/WebGUI/Form/DateTime.pm @@ -84,7 +84,7 @@ sub definition { my $definition = shift || []; push(@{$definition}, { defaultValue=>{ - defaultValue=>$session->datetime->time() + defaultValue=>time() }, maxlength=>{ defaultValue=> 19 diff --git a/lib/WebGUI/Group.pm b/lib/WebGUI/Group.pm index c7b594861..c141f9651 100644 --- a/lib/WebGUI/Group.pm +++ b/lib/WebGUI/Group.pm @@ -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; } diff --git a/lib/WebGUI/Help/Asset_Collaboration.pm b/lib/WebGUI/Help/Asset_Collaboration.pm index e830ad16f..4605ec3d4 100644 --- a/lib/WebGUI/Help/Asset_Collaboration.pm +++ b/lib/WebGUI/Help/Asset_Collaboration.pm @@ -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' }, diff --git a/lib/WebGUI/Macro/D_date.pm b/lib/WebGUI/Macro/D_date.pm index 397d10487..c30535061 100644 --- a/lib/WebGUI/Macro/D_date.pm +++ b/lib/WebGUI/Macro/D_date.pm @@ -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; } diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm index c8dfb8c27..a7c78e897 100644 --- a/lib/WebGUI/Operation/User.pm +++ b/lib/WebGUI/Operation/User.pm @@ -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 = ''; + $error = ''; } if ($isSecondary) { return _submenu($session,{workarea => $i18n->get(978)}); diff --git a/lib/WebGUI/PassiveProfiling.pm b/lib/WebGUI/PassiveProfiling.pm index 01c46fa01..5f5e84eb0 100644 --- a/lib/WebGUI/PassiveProfiling.pm +++ b/lib/WebGUI/PassiveProfiling.pm @@ -61,7 +61,7 @@ sub add { [ $session->id->generate(), $session->user->userId, $session->var->get("sessionId"), $assetId, - $session->datetime->time(), + time(), ]); return undef; } diff --git a/lib/WebGUI/Session/DateTime.pm b/lib/WebGUI/Session/DateTime.pm index 2230aabd4..1dab2cb20 100644 --- a/lib/WebGUI/Session/DateTime.pm +++ b/lib/WebGUI/Session/DateTime.pm @@ -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 diff --git a/lib/WebGUI/Session/Url.pm b/lib/WebGUI/Session/Url.pm index fe6a2daf1..750b68d4a 100644 --- a/lib/WebGUI/Session/Url.pm +++ b/lib/WebGUI/Session/Url.pm @@ -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); diff --git a/lib/WebGUI/Session/Var.pm b/lib/WebGUI/Session/Var.pm index d472c0cab..00eb08f7f 100644 --- a/lib/WebGUI/Session/Var.pm +++ b/lib/WebGUI/Session/Var.pm @@ -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, diff --git a/lib/WebGUI/User.pm b/lib/WebGUI/User.pm index 0008a94ce..cab115996 100644 --- a/lib/WebGUI/User.pm +++ b/lib/WebGUI/User.pm @@ -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}; } diff --git a/lib/WebGUI/VersionTag.pm b/lib/WebGUI/VersionTag.pm index 2ddc5d10b..a3c28e596 100644 --- a/lib/WebGUI/VersionTag.pm +++ b/lib/WebGUI/VersionTag.pm @@ -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; diff --git a/lib/WebGUI/Workflow/Activity/ArchiveOldStories.pm b/lib/WebGUI/Workflow/Activity/ArchiveOldStories.pm index 1e337b016..ef1ef36d5 100644 --- a/lib/WebGUI/Workflow/Activity/ArchiveOldStories.pm +++ b/lib/WebGUI/Workflow/Activity/ArchiveOldStories.pm @@ -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"); diff --git a/lib/WebGUI/Workflow/Activity/ArchiveOldThreads.pm b/lib/WebGUI/Workflow/Activity/ArchiveOldThreads.pm index 68dc2bd59..c55c66420 100644 --- a/lib/WebGUI/Workflow/Activity/ArchiveOldThreads.pm +++ b/lib/WebGUI/Workflow/Activity/ArchiveOldThreads.pm @@ -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"); diff --git a/lib/WebGUI/Workflow/Activity/ExpireUnvalidatedEmailUsers.pm b/lib/WebGUI/Workflow/Activity/ExpireUnvalidatedEmailUsers.pm index 50ba7697f..55c8a518d 100644 --- a/lib/WebGUI/Workflow/Activity/ExpireUnvalidatedEmailUsers.pm +++ b/lib/WebGUI/Workflow/Activity/ExpireUnvalidatedEmailUsers.pm @@ -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; } diff --git a/lib/WebGUI/Workflow/Activity/WaitUntil.pm b/lib/WebGUI/Workflow/Activity/WaitUntil.pm index 911cc95ec..42a66de91 100644 --- a/lib/WebGUI/Workflow/Activity/WaitUntil.pm +++ b/lib/WebGUI/Workflow/Activity/WaitUntil.pm @@ -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) { diff --git a/lib/WebGUI/i18n/English/Asset_Collaboration.pm b/lib/WebGUI/i18n/English/Asset_Collaboration.pm index 170eedc82..ad2d4d40c 100644 --- a/lib/WebGUI/i18n/English/Asset_Collaboration.pm +++ b/lib/WebGUI/i18n/English/Asset_Collaboration.pm @@ -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, diff --git a/lib/WebGUI/i18n/English/Asset_Template.pm b/lib/WebGUI/i18n/English/Asset_Template.pm index 5b4319033..f381d584e 100644 --- a/lib/WebGUI/i18n/English/Asset_Template.pm +++ b/lib/WebGUI/i18n/English/Asset_Template.pm @@ -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' => { diff --git a/sbin/changeIobStatus.pl b/sbin/changeIobStatus.pl index 777898af0..e42b76b6a 100755 --- a/sbin/changeIobStatus.pl +++ b/sbin/changeIobStatus.pl @@ -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) { diff --git a/sbin/userImport.pl b/sbin/userImport.pl index 3e547bc0c..c70ddfa42 100755 --- a/sbin/userImport.pl +++ b/sbin/userImport.pl @@ -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; } diff --git a/t/Asset/Asset.t b/t/Asset/Asset.t index c3342dff9..aaca25101 100644 --- a/t/Asset/Asset.t +++ b/t/Asset/Asset.t @@ -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' ); ################################################################ # diff --git a/t/Asset/Post.t b/t/Asset/Post.t index 81fa89265..ec495ae1a 100644 --- a/t/Asset/Post.t +++ b/t/Asset/Post.t @@ -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 < greater than >|, '... HTML escaped characters ($synopsis, $content) = $post->getSynopsisAndContent('', q|

    less than < greater than >

    |); 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 diff --git a/t/Asset/Template/packed.t b/t/Asset/Template/packed.t index 851937302..4d547d37d 100644 --- a/t/Asset/Template/packed.t +++ b/t/Asset/Template/packed.t @@ -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 diff --git a/t/Asset/Wobject/Collaboration/templateVariables.t b/t/Asset/Wobject/Collaboration/templateVariables.t new file mode 100644 index 000000000..c71790d45 --- /dev/null +++ b/t/Asset/Wobject/Collaboration/templateVariables.t @@ -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 diff --git a/t/Asset/Wobject/DataForm.t b/t/Asset/Wobject/DataForm.t index e268db0b5..0d3d7ab1e 100644 --- a/t/Asset/Wobject/DataForm.t +++ b/t/Asset/Wobject/DataForm.t @@ -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 diff --git a/t/Asset/Wobject/Survey.t b/t/Asset/Wobject/Survey.t index 05a7fdc4f..113277888 100644 --- a/t/Asset/Wobject/Survey.t +++ b/t/Asset/Wobject/Survey.t @@ -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'); diff --git a/t/Asset/Wobject/SyndicatedContent.t b/t/Asset/Wobject/SyndicatedContent.t index cec27fb6b..d0845ad43 100644 --- a/t/Asset/Wobject/SyndicatedContent.t +++ b/t/Asset/Wobject/SyndicatedContent.t @@ -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(< + +Revision Log - /WebGUI/ + + + + +1970-01-01T00:53:41 + +12312 - Ready for 7.7.20 development. + + + +colin + +https://svn.webgui.org/svnweb/plainblack/revision?rev=12312 +1970-01-01T00:53:41 +1970-01-01T00:53:41 + +EOFEED + +my $vars = $syndicated_content->getTemplateVariables($feed); +ok( defined $vars->{item_loop}->[0]->{description}, 'getTemplateVariables: description is not undefined'); diff --git a/t/Group.t b/t/Group.t index 61dd929e3..d1cf801c4 100644 --- a/t/Group.t +++ b/t/Group.t @@ -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"); diff --git a/t/PassiveProfiling.t b/t/PassiveProfiling.t index 4ff7820d1..0afe76f69 100644 --- a/t/PassiveProfiling.t +++ b/t/PassiveProfiling.t @@ -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]); diff --git a/t/Storage.t b/t/Storage.t index cac8dd8eb..caabc8be5 100644 --- a/t/Storage.t +++ b/t/Storage.t @@ -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; } diff --git a/t/templateSyntax.t b/t/templateSyntax.t new file mode 100644 index 000000000..b64437b63 --- /dev/null +++ b/t/templateSyntax.t @@ -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 + ); +} + +