merged with HEAD and other interesting changes
This commit is contained in:
parent
66c6c0fae5
commit
856cc06d04
151 changed files with 7335 additions and 2602 deletions
|
|
@ -1,3 +1,38 @@
|
|||
7.7.0
|
||||
- fixed #9913: New Content Side Bar missing in Asset window
|
||||
- fixed: New Mail macro never returns any messages
|
||||
- fixed: Template parser cannot be set
|
||||
- fixed #9836: Matrix: Group to Add Listings is missing
|
||||
- fixed #9924: WebGUI::Shop::Cart::readyForCheckout fails randomly (Henry Tang, Long Term Results B.v.)
|
||||
- fixed #9873: third-> first in post template help
|
||||
- fixed #9892: Typo in "Default Gallery View Album" Template [TEMPLATE]
|
||||
- fixed #9826: Inbox messages sent by email don't include from username
|
||||
- rfe: added Asset History browser (perlDreamer Consulting, LLC and Plain Black)
|
||||
- fixed: Commit w/ approval workflow can crash under race conditions resulting in permanently locked content (Martin Kamerbeek / Oqapi )
|
||||
- fixed: Each textarea inserts identical JS that should be inserted only once ( Martin Kamerbeek / Oqapi )
|
||||
- added: Vendor payout system ( Martin Kamerbeek / Oqapi )
|
||||
- fixed #9942: Upgrade script fails with ITransact driver (William McKee, Knowmad Technologies)
|
||||
- fixed #9943: Upgrade script fails with Payment Gateways
|
||||
- fixed #9948: Data form cannot be deleted.
|
||||
- fixed #9950: Wrong var in help for thread
|
||||
- fixed #9956: Product Import
|
||||
- added Survey now has a loading mask on Survey edit ajax calls.
|
||||
- fixed: Sliders fixed. Improved algorithm for determining pixel step size.
|
||||
- rfe #9355: Password Recovery email subject (SDH Consulting Group)
|
||||
- added: Users can now set a minimum cart amount required for checkout. ( Martin Kamerbeek / Oqapi )
|
||||
- fixed validation issue in the donation asset ( Martin kamerbeek / Oqapi )
|
||||
- rfe #9354: Account activation email template (SDH Consulting Group)
|
||||
|
||||
7.6.14
|
||||
- fixed: IE6 shows Admin Bar over Asset Manager
|
||||
- fixed #9808: Search i18n
|
||||
- fixed #9818: deleteAttachedFiles bug (THE REVENGE)
|
||||
- fixed #9809: Pagination list up to 10/20: not working correctly on last pages.
|
||||
- fixed #9820: Survey: political party spelled wrong
|
||||
- fixed #9819: Survey: hoverhelp showing instead of field name
|
||||
- fixed #9822: Matrix: Wrong field label
|
||||
- fixed #9823: Matrix: no cancel button in add/edit listing
|
||||
|
||||
7.6.13
|
||||
- fixed AdSpace bug: impressions and clicks for most non-human web clients will not be counted.
|
||||
- fixed #9760: DataForm not working in demo.plainblack.com
|
||||
|
|
@ -9,6 +44,10 @@
|
|||
- fixed #9779: Gallery: js for search (datepicker?) included in album view
|
||||
- fixed #9783: payment methods are not added
|
||||
- fixed #9785: Delete All button not working in Account/Inbox [TEMPLATE]
|
||||
- fixed #9803: Survey 2.0- Gradebook spelled wrong
|
||||
- fixed #9801: Survey 2.0- Template spelled wrong
|
||||
- fixed #9802: Survey Template field names to be consistent
|
||||
- fixed: HTMLForm generated forms have an extra double quote in the table tag.
|
||||
|
||||
7.6.12
|
||||
- fixed: During postback on a recurring transaction, the routine could error out instead of catching an error.
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7,6 +7,10 @@ upgrading from one version to the next, or even between multiple
|
|||
versions. Be sure to heed the warnings contained herein as they will
|
||||
save you many hours of grief.
|
||||
|
||||
7.7.0
|
||||
--------------------------------------------------------------------
|
||||
* WebGUI now requires Params::Validate version 0.81 or greater.
|
||||
|
||||
7.6.11
|
||||
--------------------------------------------------------------------
|
||||
* If upgrading from WebGUI 7.5, you should upgrade to 7.5.40 first,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.6.14/matrix-default-view-template.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.14/matrix-default-view-template.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.14/matrix-search-template.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.14/matrix-search-template.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.14/matrix_equal-cols.js.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.14/matrix_equal-cols.js.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.14/new-matrix_matrix-nav-tmpl.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.14/new-matrix_matrix-nav-tmpl.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.14/new-matrix_matrix-nav.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.14/new-matrix_matrix-nav.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.14/new-matrix_matrix.css.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.14/new-matrix_matrix.css.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/admin_console.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/admin_console.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/admin_console2.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/admin_console2.wgpkg
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/matrix-default-screenshots.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/matrix-default-screenshots.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/matrix-default-view-template.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/matrix-default-view-template.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/root_import_account_shop.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/root_import_account_shop.wgpkg
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/survey-root_import_prop-style.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/survey-root_import_prop-style.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/survey.css.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/survey.css.wgpkg
Normal file
Binary file not shown.
|
|
@ -254,7 +254,7 @@ sub upgradeMatrix {
|
|||
my $session = shift;
|
||||
print "\tUpgrading matrix assets... \n" unless $quiet;
|
||||
my $db = $session->db;
|
||||
$db->write("alter table Matrix drop column groupToRate, drop column groupToAdd, drop column privilegedGroup,
|
||||
$db->write("alter table Matrix drop column groupToRate, drop column privilegedGroup,
|
||||
drop column ratingTimeout, drop column ratingTimeoutPrivileged, drop column ratingDetailTemplateId,
|
||||
drop column visitorCacheTimeout");
|
||||
$db->write("alter table Matrix add column defaultSort char(22) not null default 'score',
|
||||
|
|
@ -295,7 +295,8 @@ sub upgradeMatrix {
|
|||
$db->write("alter table Matrix_rating rename MatrixListing_rating");
|
||||
$db->write("alter table Matrix_ratingSummary rename MatrixListing_ratingSummary");
|
||||
$db->write("alter table Matrix_field rename Matrix_attribute");
|
||||
$db->write("alter table Matrix_attribute drop column label");
|
||||
$db->write("alter table Matrix_attribute drop column name");
|
||||
$db->write("alter table Matrix_attribute change label name char(255)");
|
||||
$db->write("alter table Matrix_attribute add column options text");
|
||||
$db->write("alter table Matrix_attribute change fieldType fieldType char(255) not null default 'MatrixCompare'");
|
||||
$db->write("alter table Matrix_attribute change fieldId attributeId char(22) not null");
|
||||
|
|
@ -336,6 +337,7 @@ sub upgradeMatrix {
|
|||
$listing->{title} = $listing->{productName};
|
||||
$listing->{version} = $listing->{versionNumber};
|
||||
$listing->{screenshots} = $listing->{storageId};
|
||||
$listing->{ownerUserId} = $listing->{maintainerId};
|
||||
$listing->{productURL} = $listing->{productUrl};
|
||||
$listing->{manufacturerURL} = $listing->{manufacturerUrl};
|
||||
my $newMatrixListing = $matrix->addChild($listing,undef,undef,{skipAutoCommitWorkflows=>1});
|
||||
|
|
|
|||
125
docs/upgrades/upgrade_7.6.13-7.6.14.pl
Normal file
125
docs/upgrades/upgrade_7.6.13-7.6.14.pl
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
#!/usr/bin/env 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "../..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
|
||||
|
||||
my $toVersion = '7.6.14';
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
#sub exampleFunction {
|
||||
# my $session = shift;
|
||||
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
|
||||
# # and here's our code
|
||||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add a package to the import node
|
||||
sub addPackage {
|
||||
my $session = shift;
|
||||
my $file = shift;
|
||||
|
||||
# Make a storage location for the package
|
||||
my $storage = WebGUI::Storage->createTemp( $session );
|
||||
$storage->addFileFromFilesystem( $file );
|
||||
|
||||
# Import the package into the import node
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
|
||||
|
||||
# Make the package not a package anymore
|
||||
$package->update({ isPackage => 0 });
|
||||
|
||||
# Set the default flag for templates added
|
||||
my $assetIds
|
||||
= $package->getLineage( ['self','descendants'], {
|
||||
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
|
||||
} );
|
||||
for my $assetId ( @{ $assetIds } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
if ( !$asset ) {
|
||||
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
|
||||
next;
|
||||
}
|
||||
$asset->update( { isDefault => 1 } );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $configFile;
|
||||
$|=1; #disable output buffering
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
$session->user({userId=>3});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Upgrade to ".$toVersion});
|
||||
return $session;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub finish {
|
||||
my $session = shift;
|
||||
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->close();
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateTemplates {
|
||||
my $session = shift;
|
||||
return undef unless (-d "packages-".$toVersion);
|
||||
print "\tUpdating packages.\n" unless ($quiet);
|
||||
opendir(DIR,"packages-".$toVersion);
|
||||
my @files = readdir(DIR);
|
||||
closedir(DIR);
|
||||
my $newFolder = undef;
|
||||
foreach my $file (@files) {
|
||||
next unless ($file =~ /\.wgpkg$/);
|
||||
# Fix the filename to include a path
|
||||
$file = "packages-" . $toVersion . "/" . $file;
|
||||
addPackage( $session, $file );
|
||||
}
|
||||
}
|
||||
|
||||
#vim:ft=perl
|
||||
422
docs/upgrades/upgrade_7.6.14-7.7.0.pl
Normal file
422
docs/upgrades/upgrade_7.6.14-7.7.0.pl
Normal file
|
|
@ -0,0 +1,422 @@
|
|||
#!/usr/bin/env 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "../..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::PassiveAnalytics::Rule;
|
||||
use WebGUI::Utility;
|
||||
|
||||
my $toVersion = '7.7.0';
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
|
||||
addAccountActivationTemplateToSettings( $session );
|
||||
addGroupToAddToMatrix( $session );
|
||||
addScreenshotTemplatesToMatrix( $session );
|
||||
surveyDoAfterTimeLimit($session);
|
||||
surveyRemoveResponseTemplate($session);
|
||||
surveyEndWorkflow($session);
|
||||
installAssetHistory($session);
|
||||
addMinimumCartCheckoutSetting( $session );
|
||||
|
||||
# Passive Analytics
|
||||
pa_installLoggingTables($session);
|
||||
pa_installPassiveAnalyticsRule($session);
|
||||
pa_installPassiveAnalyticsConfig($session);
|
||||
pa_installWorkflow($session);
|
||||
pa_addPassiveAnalyticsSettings($session);
|
||||
pa_addPassiveAnalyticsStatus($session);
|
||||
|
||||
# vendor payouts
|
||||
addTransactionItemFlags( $session );
|
||||
createShopAcccountPluginSettings( $session );
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addAccountActivationTemplateToSettings {
|
||||
my $session = shift;
|
||||
print "\tAdding account activation template to settings \n" unless $quiet;
|
||||
|
||||
$session->db->write("insert into settings (name, value) values ('webguiAccountActivationTemplate','PBtmpl0000000000000016')");
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addGroupToAddToMatrix {
|
||||
my $session = shift;
|
||||
print "\tAdding groupToAdd to Matrix table, if needed... \n" unless $quiet;
|
||||
my $sth = $session->db->read('describe Matrix groupToAdd');
|
||||
if (! defined $sth->hashRef) {
|
||||
$session->db->write("alter table Matrix add column groupToAdd char(22) default 2");
|
||||
}
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addScreenshotTemplatesToMatrix {
|
||||
my $session = shift;
|
||||
print "\tAdding screenshot templates to Matrix table \n" unless $quiet;
|
||||
|
||||
$session->db->write("alter table Matrix add screenshotsConfigTemplateId char(22);");
|
||||
$session->db->write("update Matrix set screenshotsConfigTemplateId = 'matrixtmpl000000000007';");
|
||||
$session->db->write("alter table Matrix add screenshotsTemplateId char(22);");
|
||||
$session->db->write("update Matrix set screenshotsTemplateId = 'matrixtmpl000000000006';");
|
||||
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub surveyDoAfterTimeLimit {
|
||||
my $session = shift;
|
||||
print "\tAdding column doAfterTimeLimit to Survey table... " unless $quiet;
|
||||
$session->db->write('alter table Survey add doAfterTimeLimit char(22)');
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub surveyEndWorkflow {
|
||||
my $session = shift;
|
||||
print "\tAdding column onSurveyEndWorkflowId to Survey table... " unless $quiet;
|
||||
$session->db->write('alter table Survey add onSurveyEndWorkflowId varchar(22) character set utf8 collate utf8_bin');
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub surveyRemoveResponseTemplate {
|
||||
my $session = shift;
|
||||
print "\tRemoving responseTemplate... " unless $quiet;
|
||||
$session->db->write('alter table Survey drop responseTemplateId');
|
||||
if (my $template = WebGUI::Asset->new($session, 'PBtmpl0000000000000064')) {
|
||||
$template->purge();
|
||||
}
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub installAssetHistory {
|
||||
my $session = shift;
|
||||
print "\tAdding Asset History content handler... \n" unless $quiet;
|
||||
##Content Handler
|
||||
my $contentHandlers = $session->config->get('contentHandlers');
|
||||
if (! isIn('WebGUI::Content::Handler', @{ $contentHandlers }) ) {
|
||||
my @newHandlers = ();
|
||||
foreach my $handler (@{ $contentHandlers }) {
|
||||
push @newHandlers, $handler;
|
||||
push @newHandlers, 'WebGUI::Content::AssetHistory' if
|
||||
$handler eq 'WebGUI::Content::Account';
|
||||
}
|
||||
$session->config->set('contentHandlers', \@newHandlers);
|
||||
}
|
||||
##Admin Console
|
||||
$session->config->addToHash('adminConsole', 'assetHistory', {
|
||||
"icon" => "assetHistory.gif",
|
||||
"groupSetting" => "groupIdAdminHistory",
|
||||
"uiLevel" => 5,
|
||||
"url" => "^PageUrl(\"\",op=assetHistory);",
|
||||
"title" => "^International(assetHistory,Asset);"
|
||||
});
|
||||
##Setting for custom group
|
||||
$session->setting->add('groupIdAdminHistory', 12);
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub pa_installLoggingTables {
|
||||
my $session = shift;
|
||||
print "\tInstall logging tables... " unless $quiet;
|
||||
my $db = $session->db;
|
||||
$db->write(<<EOT1);
|
||||
DROP TABLE IF EXISTS `passiveLog`
|
||||
EOT1
|
||||
$db->write(<<EOT1);
|
||||
CREATE TABLE `passiveLog` (
|
||||
`userId` varchar(22) character set utf8 collate utf8_bin NOT NULL default '',
|
||||
`assetId` varchar(22) character set utf8 collate utf8_bin NOT NULL default '',
|
||||
`sessionId` varchar(22) character set utf8 collate utf8_bin NOT NULL default '',
|
||||
`timeStamp` bigint(20),
|
||||
`url` varchar(255) character set utf8 collate utf8_bin NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
EOT1
|
||||
$db->write(<<EOT2);
|
||||
DROP TABLE IF EXISTS `deltaLog`
|
||||
EOT2
|
||||
$db->write(<<EOT2);
|
||||
CREATE TABLE `deltaLog` (
|
||||
`userId` varchar(22) character set utf8 collate utf8_bin NOT NULL default '',
|
||||
`assetId` varchar(22) character set utf8 collate utf8_bin NOT NULL default '',
|
||||
`delta` integer,
|
||||
`timeStamp` bigint(20),
|
||||
`url` varchar(255) character set utf8 collate utf8_bin NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
EOT2
|
||||
$db->write(<<EOT3);
|
||||
DROP TABLE IF EXISTS `bucketLog`
|
||||
EOT3
|
||||
$db->write(<<EOT3);
|
||||
CREATE TABLE `bucketLog` (
|
||||
`userId` varchar(22) character set utf8 collate utf8_bin NOT NULL default '',
|
||||
`Bucket` varchar(22) character set utf8 collate utf8_bin NOT NULL default '',
|
||||
`duration` integer,
|
||||
`timeStamp` datetime
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
EOT3
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the PassiveAnalytics Rule table
|
||||
sub pa_installPassiveAnalyticsRule {
|
||||
my $session = shift;
|
||||
print "\tInstall Passive Analytics rule table, via Crud... " unless $quiet;
|
||||
# and here's our code
|
||||
WebGUI::PassiveAnalytics::Rule->crud_createTable($session);
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the PassiveAnalytics Settings
|
||||
sub pa_addPassiveAnalyticsSettings {
|
||||
my $session = shift;
|
||||
print "\tInstall Passive Analytics settings... " unless $quiet;
|
||||
# and here's our code
|
||||
$session->setting->add('passiveAnalyticsInterval', 300);
|
||||
$session->setting->add('passiveAnalyticsDeleteDelta', 0);
|
||||
$session->setting->add('passiveAnalyticsEnabled', 0);
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the PassiveAnalytics Rule table
|
||||
sub pa_addPassiveAnalyticsStatus {
|
||||
my $session = shift;
|
||||
my $db = $session->db;
|
||||
print "\tInstall Passive Analytics status table... " unless $quiet;
|
||||
# and here's our code
|
||||
$db->write(<<EOT2);
|
||||
DROP TABLE if exists passiveAnalyticsStatus;
|
||||
EOT2
|
||||
$db->write(<<EOT3);
|
||||
CREATE TABLE `passiveAnalyticsStatus` (
|
||||
`startDate` datetime,
|
||||
`endDate` datetime,
|
||||
`running` integer(2) DEFAULT 0,
|
||||
`userId` varchar(22) character set utf8 collate utf8_bin NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
EOT3
|
||||
$db->write('insert into passiveAnalyticsStatus (userId) VALUES (3)');
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the Passive Analytics config file entry
|
||||
# for the adminConsole and the content handler
|
||||
sub pa_installPassiveAnalyticsConfig {
|
||||
my $session = shift;
|
||||
print "\tAdd Passive Analytics entry to the config file... " unless $quiet;
|
||||
# Admin Bar/Console
|
||||
my $adminConsole = $session->config->get('adminConsole');
|
||||
if (!exists $adminConsole->{'passiveAnalytics'}) {
|
||||
$adminConsole->{'passiveAnalytics'} = {
|
||||
"icon" => "passiveAnalytics.png",
|
||||
"uiLevel" => 1,
|
||||
"url" => "^PageUrl(\"\",op=passiveAnalytics;func=editRuleflow);",
|
||||
"title" => "^International(Passive Analytics,PassiveAnalytics);",
|
||||
"groupSetting" => "3",
|
||||
};
|
||||
$session->config->set('adminConsole', $adminConsole);
|
||||
}
|
||||
# Content Handler
|
||||
my $contentHandlers = $session->config->get('contentHandlers');
|
||||
if (!isIn('WebGUI::Content::PassiveAnalytics',@{ $contentHandlers} ) ) {
|
||||
my $contentIndex = 0;
|
||||
HANDLER: while ($contentIndex <= $#{ $contentHandlers } ) {
|
||||
##Insert before Operation
|
||||
if($contentHandlers->[$contentIndex] eq 'WebGUI::Content::Operation') {
|
||||
splice @{ $contentHandlers }, $contentIndex, 0, 'WebGUI::Content::PassiveAnalytics';
|
||||
last HANDLER;
|
||||
}
|
||||
++$contentIndex;
|
||||
}
|
||||
$session->config->set('contentHandlers', $contentHandlers);
|
||||
}
|
||||
# Workflow Activities
|
||||
my $workflowActivities = $session->config->get('workflowActivities');
|
||||
my @none = @{ $workflowActivities->{'None'} };
|
||||
if (!isIn('WebGUI::Workflow::Activity::SummarizePassiveAnalytics', @none)) {
|
||||
push @none, 'WebGUI::Workflow::Activity::SummarizePassiveAnalytics';
|
||||
}
|
||||
if (!isIn('WebGUI::Workflow::Activity::BucketPassiveAnalytics', @none)) {
|
||||
push @none, 'WebGUI::Workflow::Activity::BucketPassiveAnalytics';
|
||||
}
|
||||
$workflowActivities->{'None'} = [ @none ];
|
||||
$session->config->set('workflowActivities', $workflowActivities);
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the Passive Analytics Workflow
|
||||
sub pa_installWorkflow {
|
||||
my $session = shift;
|
||||
print "\tAdd Passive Analytics Workflow... " unless $quiet;
|
||||
my $workflow = WebGUI::Workflow->create(
|
||||
$session,
|
||||
{
|
||||
title => 'Analyze Passive Analytics',
|
||||
mode => 'singleton',
|
||||
type => 'None',
|
||||
description => 'Manual changes to this workflow will be lost. Please only use the Passive Analytics screen to make changes',
|
||||
},
|
||||
'PassiveAnalytics000001',
|
||||
);
|
||||
my $summarize = $workflow->addActivity('WebGUI::Workflow::Activity::SummarizePassiveAnalytics');
|
||||
my $bucket = $workflow->addActivity('WebGUI::Workflow::Activity::BucketPassiveAnalytics');
|
||||
$summarize->set('title', 'Perform duration analysis');
|
||||
$bucket->set( 'title', 'Please log entries into buckets');
|
||||
$workflow->set({enabled => 1});
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addTransactionItemFlags {
|
||||
my $session = shift;
|
||||
print "\tAdding columns for vendor payout tracking to transaction items..." unless $quiet;
|
||||
|
||||
$session->db->write('alter table transactionItem add column vendorPayoutStatus char(10) default \'NotPaid\'');
|
||||
$session->db->write('alter table transactionItem add column vendorPayoutAmount float (6,2) default 0.00');
|
||||
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub createShopAcccountPluginSettings {
|
||||
my $session = shift;
|
||||
print "\tCreating default settings for the account plugin..." unless $quiet;
|
||||
|
||||
$session->setting->add('shopMySalesTemplateId', '-zxyB-O50W8YnL39Ouoc4Q');
|
||||
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addMinimumCartCheckoutSetting {
|
||||
my $session = shift;
|
||||
print "\tAdding setting for minimum cart checkout..." unless $quiet;
|
||||
|
||||
$session->setting->add( 'shopCartCheckoutMinimum', '0.00' );
|
||||
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
#sub exampleFunction {
|
||||
# my $session = shift;
|
||||
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
|
||||
# # and here's our code
|
||||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add a package to the import node
|
||||
sub addPackage {
|
||||
my $session = shift;
|
||||
my $file = shift;
|
||||
|
||||
# Make a storage location for the package
|
||||
my $storage = WebGUI::Storage->createTemp( $session );
|
||||
$storage->addFileFromFilesystem( $file );
|
||||
|
||||
# Import the package into the import node
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
|
||||
|
||||
# Make the package not a package anymore
|
||||
$package->update({ isPackage => 0 });
|
||||
|
||||
# Set the default flag for templates added
|
||||
my $assetIds
|
||||
= $package->getLineage( ['self','descendants'], {
|
||||
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
|
||||
} );
|
||||
for my $assetId ( @{ $assetIds } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
if ( !$asset ) {
|
||||
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
|
||||
next;
|
||||
}
|
||||
$asset->update( { isDefault => 1 } );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $configFile;
|
||||
$|=1; #disable output buffering
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
$session->user({userId=>3});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Upgrade to ".$toVersion});
|
||||
return $session;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub finish {
|
||||
my $session = shift;
|
||||
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->close();
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateTemplates {
|
||||
my $session = shift;
|
||||
return undef unless (-d "packages-".$toVersion);
|
||||
print "\tUpdating packages.\n" unless ($quiet);
|
||||
opendir(DIR,"packages-".$toVersion);
|
||||
my @files = readdir(DIR);
|
||||
closedir(DIR);
|
||||
my $newFolder = undef;
|
||||
foreach my $file (@files) {
|
||||
next unless ($file =~ /\.wgpkg$/);
|
||||
# Fix the filename to include a path
|
||||
$file = "packages-" . $toVersion . "/" . $file;
|
||||
addPackage( $session, $file );
|
||||
}
|
||||
}
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
@ -61,7 +61,7 @@ sub upgradeMatrix {
|
|||
my $session = shift;
|
||||
print "\tUpgrading matrix assets... \n" unless $quiet;
|
||||
my $db = $session->db;
|
||||
$db->write("alter table Matrix drop column groupToRate, drop column groupToAdd, drop column privilegedGroup,
|
||||
$db->write("alter table Matrix drop column groupToRate, drop column privilegedGroup,
|
||||
drop column ratingTimeout, drop column ratingTimeoutPrivileged, drop column ratingDetailTemplateId,
|
||||
drop column visitorCacheTimeout");
|
||||
$db->write("alter table Matrix add column defaultSort char(22) not null default 'score',
|
||||
|
|
@ -102,7 +102,8 @@ sub upgradeMatrix {
|
|||
$db->write("alter table Matrix_rating rename MatrixListing_rating");
|
||||
$db->write("alter table Matrix_ratingSummary rename MatrixListing_ratingSummary");
|
||||
$db->write("alter table Matrix_field rename Matrix_attribute");
|
||||
$db->write("alter table Matrix_attribute drop column label");
|
||||
$db->write("alter table Matrix_attribute drop column name");
|
||||
$db->write("alter table Matrix_attribute change label name char(255)");
|
||||
$db->write("alter table Matrix_attribute add column options text");
|
||||
$db->write("alter table Matrix_attribute change fieldType fieldType char(255) not null default 'MatrixCompare'");
|
||||
$db->write("alter table Matrix_attribute change fieldId attributeId char(22) not null");
|
||||
|
|
@ -143,6 +144,7 @@ sub upgradeMatrix {
|
|||
$listing->{title} = $listing->{productName};
|
||||
$listing->{version} = $listing->{versionNumber};
|
||||
$listing->{screenshots} = $listing->{storageId};
|
||||
$listing->{ownerUserId} = $listing->{maintainerId};
|
||||
$listing->{productURL} = $listing->{productUrl};
|
||||
$listing->{manufacturerURL} = $listing->{manufacturerUrl};
|
||||
my $newMatrixListing = $matrix->addChild($listing,undef,undef,{skipAutoCommitWorkflows=>1});
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ sub setDefaultItransactCredentialTemplate {
|
|||
my $drivers = $pay->getPaymentGateways($session);
|
||||
DRIVER: foreach my $driver (@{ $drivers }) {
|
||||
##Only work on ITransact drivers
|
||||
next DRIVER unless $driver->className eq "WebGUI::Shop::PayDriver::ITransact";
|
||||
next DRIVER unless $driver && $driver->className eq "WebGUI::Shop::PayDriver::ITransact";
|
||||
my $properties = $driver->get();
|
||||
##And only ones that don't already have a template set
|
||||
next DRIVER if $properties->{credentialsTemplateId};
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ sub fixPayDriverLabels {
|
|||
print "\tGet rid of the duplicate label properties in the PayDrivers... " unless $quiet;
|
||||
my $pay = WebGUI::Shop::Pay->new($session);
|
||||
my $gateways = $pay->getPaymentGateways;
|
||||
foreach my $gateway (@{ $gateways }) {
|
||||
GATEWAY: foreach my $gateway (@{ $gateways }) {
|
||||
next GATEWAY unless $gateway;
|
||||
my $gatewayId = $gateway->getId;
|
||||
my $jsonLabel = $gateway->get('label');
|
||||
next if $jsonLabel;
|
||||
|
|
|
|||
|
|
@ -331,6 +331,13 @@
|
|||
"url" : "^PageUrl(\"\",op=assetManager);",
|
||||
"title" : "^International(assets,Asset);"
|
||||
},
|
||||
"assetHistory" : {
|
||||
"icon" : "assetHistory.gif",
|
||||
"groupSetting" : "groupIdAdminHistory",
|
||||
"uiLevel" : 5,
|
||||
"url" : "^PageUrl(\"\",op=assetHistory);",
|
||||
"title" : "^International(assetHistory,Asset);"
|
||||
},
|
||||
"graphics" : {
|
||||
"icon" : "graphics.gif",
|
||||
"uiLevel" : 5,
|
||||
|
|
@ -895,6 +902,7 @@
|
|||
"WebGUI::Content::AssetDiscovery",
|
||||
"WebGUI::Content::AjaxI18N",
|
||||
"WebGUI::Content::Account",
|
||||
"WebGUI::Content::AssetHistory",
|
||||
"WebGUI::Content::Operation",
|
||||
"WebGUI::Content::Setup",
|
||||
"WebGUI::Content::Shop",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ print "start of script\n";
|
|||
use lib '/data/WebGUI/lib';
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset::Sku::Ad ;
|
||||
use WebGUI::AssetCollateral::Sku::Ad::Ad;
|
||||
sub install {
|
||||
print "inside install function\n";
|
||||
my $confg = $ARGV[0];
|
||||
|
|
@ -12,7 +13,10 @@ sub install {
|
|||
}
|
||||
print "Installing asset.\n";
|
||||
my $session = WebGUI::Session->open($home, $confg);
|
||||
print "Add wobject to confg fle\n";
|
||||
print "create crud table";
|
||||
WebGUI::AssetCollateral::Sku::Ad::Ad->crud_createTable($session);
|
||||
if(0) {
|
||||
print "Add wobject to confg file\n";
|
||||
$session->config->addToHash("assets",$className => { category => 'shop' } );
|
||||
print "Create database tables\n";
|
||||
$session->db->write("CREATE TABLE AdSku (
|
||||
|
|
@ -112,7 +116,7 @@ sub install {
|
|||
<td><tmpl_if rowDeleted>
|
||||
^International("manage form table value deleted","Asset_AdSku");
|
||||
<tmpl_else>
|
||||
<a href="rowRenewLink">^International("manage form table value renew","Asset_AdSku");</a>
|
||||
<a href="<tmpl_var rowRenewLink>">^International("manage form table value renew","Asset_AdSku");</a>
|
||||
</tmpl_if></td>
|
||||
</tr>
|
||||
</tmpl_loop>
|
||||
|
|
@ -142,6 +146,7 @@ sub install {
|
|||
namespace=>"AdSku/manage",
|
||||
template=>$manageAdTmpl,
|
||||
},'AdSku000000002');
|
||||
}
|
||||
print "Commit the working version tag\n";
|
||||
my $workingTag = WebGUI::VersionTag->getWorking($session);
|
||||
my $workingTagId = $workingTag->getId;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package WebGUI;
|
||||
|
||||
|
||||
our $VERSION = '7.6.13';
|
||||
our $STATUS = 'stable';
|
||||
our $VERSION = '7.7.0';
|
||||
our $STATUS = 'beta';
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
|
|
|||
|
|
@ -433,5 +433,15 @@ sub showError {
|
|||
return $self->processTemplate($var,$templateId)
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 store ( )
|
||||
|
||||
This method returns an internal hash where you can store things for your Account Plugin.
|
||||
The store is private to your plugin, to each user's copy of the plugin, and only lasts as
|
||||
long as the session does.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ sub www_removeFriend {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_removeFriend ( )
|
||||
=head2 www_removeFriendConfirm ( )
|
||||
|
||||
This is a confirmation page of whether or not the user wishes to remove the selected user from friend
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,11 @@ sub appendCommonVars {
|
|||
my $user = $session->user;
|
||||
my $method = $session->form->get("do");
|
||||
|
||||
$var->{'manage_purchases_url' } = $self->getUrl("module=shop;do=managePurchases");
|
||||
$var->{'managesPurchasesIsActive'} = WebGUI::Utility::isIn($method,("","managePurchases","view","viewTransaction"));
|
||||
$var->{ 'manage_purchases_url' } = $self->getUrl("module=shop;do=managePurchases");
|
||||
$var->{ 'managesPurchasesIsActive' } = WebGUI::Utility::isIn($method,("","managePurchases","view","viewTransaction"));
|
||||
|
||||
$var->{ 'view_sales_url' } = $self->getUrl( 'module=shop;do=viewSales' );
|
||||
$var->{ 'viewSalesIsActive' } = $method eq 'viewSales';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -108,6 +111,13 @@ sub editSettingsForm {
|
|||
label => $shopi18n->get("my purchases detail template"),
|
||||
hoverHelp => $shopi18n->get("my purchases detail template help")
|
||||
);
|
||||
$f->template(
|
||||
name => 'shopMySalesTemplateId',
|
||||
value => $self->session->setting->get('shopMySalesTemplateId'),
|
||||
namespace => 'Shop/MySales',
|
||||
label => $shopi18n->echo('my sales template'),
|
||||
hoverHelp => $shopi18n->echo('my sales template help'),
|
||||
);
|
||||
|
||||
return $f->printRowsOnly;
|
||||
}
|
||||
|
|
@ -130,6 +140,7 @@ sub editSettingsFormSave {
|
|||
$setting->set("shopLayoutTemplateId", $form->process("shopLayoutTemplateId","template"));
|
||||
$setting->set("shopMyPurchasesTemplateId", $form->process("shopMyPurchasesTemplateId","template"));
|
||||
$setting->set("shopMyPurchasesDetailTemplateId", $form->process("shopMyPurchasesDetailTemplateId","template"));
|
||||
$setting->set("shopMySalesTemplateId", $form->process("shopMySalesTemplateId","template"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -208,6 +219,43 @@ sub www_view {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewSales ( )
|
||||
|
||||
Page that show your earnings if you are a vendor.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewSales {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $vendor = WebGUI::Shop::Vendor->newByUserId( $session, $session->user->userId );
|
||||
|
||||
my $var = $vendor->getPayoutTotals;
|
||||
my $totalSales = 0;
|
||||
my @products;
|
||||
|
||||
my $sth = $session->db->read(
|
||||
'select *, sum(quantity) as quantity, sum(vendorPayoutAmount) as payoutAmount from transactionItem '
|
||||
.'where vendorId=? group by assetId order by quantity desc',
|
||||
[ $vendor->getId ]
|
||||
);
|
||||
while (my $row = $sth->hashRef) {
|
||||
push @products, $row;
|
||||
$totalSales += $row->{quantity};
|
||||
}
|
||||
$sth->finish;
|
||||
|
||||
$var->{ product_loop } = \@products;
|
||||
$var->{ total_products } = scalar @products;
|
||||
$var->{ total_sales } = $totalSales;
|
||||
|
||||
$self->appendCommonVars( $var );
|
||||
|
||||
return $self->processTemplate( $var, $session->setting->get('shopMySalesTemplateId') );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewTransaction ( )
|
||||
|
||||
The main view page for editing the user's profile.
|
||||
|
|
@ -294,4 +342,5 @@ sub www_viewTransaction {
|
|||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -262,27 +262,32 @@ sub set {
|
|||
$self->{_properties}{priority} = exists $properties->{priority} ? $properties->{priority} : $self->{_properties}{priority};
|
||||
# prerender the ad for faster display
|
||||
my $adSpace = WebGUI::AdSpace->new($self->session, $self->get("adSpaceId"));
|
||||
if ($self->get("type") eq "text") {
|
||||
$self->{_properties}{renderedAd} = '<div style="position:relative; width:' . ($adSpace->get("width")-2) . 'px; height:' .
|
||||
($adSpace->get("height")-2) . 'px; margin:0px; overflow:hidden; border:solid ' . $self->get("borderColor") .
|
||||
q{ 1px;"><a href='#' OnClick="window.location.assign('} .
|
||||
$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId) .
|
||||
q{')" style="position:absolute; padding: 3px; top:0px; left:0px; width:100%; height:100%; z-index:10;} .
|
||||
' display:block; text-decoration:none; vertical-align:top; background-color:' . $self->get("backgroundColor") .
|
||||
'; font-size: 13px; font-weight: normal;"><b><span style="color:' . $self->get("textColor") . ';">' .
|
||||
$self->get("title") . '</span></b><br /><span style="color:' . $self->get("textColor") . ';">' .
|
||||
$self->get("adText") . '</span></a></div>';
|
||||
} elsif ($self->get("type") eq "image") {
|
||||
my $storage = WebGUI::Storage->get($self->session, $self->get("storageId"));
|
||||
$self->{_properties}{renderedAd} = '<div style="position:relative; width:' . $adSpace->get("width") . 'px; height:' .
|
||||
$adSpace->get("height") . 'px; margin:0px; overflow:hidden; border:0px;"><a href="#" ' .
|
||||
q{onClick="window.location.assign('} .
|
||||
$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId) . q{')" style="position:absolute; padding: } .
|
||||
'3px; top:0px; left:0px; width:100%; height:100%; z-index:10; display:block; text-decoration:none; ' .
|
||||
'vertical-align:top;"><img ' .
|
||||
'src="' . $storage->getUrl($storage->getFiles->[0]) . '" alt="' . $self->get("title") .
|
||||
'" style="z-index:0;position:relative;border-style:none;border: 0px;" /></a></div>';
|
||||
} elsif ($self->get("type") eq "rich") {
|
||||
if ($self->get("type") eq "text") {
|
||||
$self->{_properties}{renderedAd} =
|
||||
q{<div style="position:relative; width:} . ($adSpace->get("width")-2) . q{px; height:}
|
||||
. ($adSpace->get("height")-2) . q{px; margin:0px; overflow:hidden; border:solid }
|
||||
. $self->get("borderColor") . q{ 1px;"><a href='#' onclick="window.location.assign('}
|
||||
. $self->session->url->gateway(undef, "op=clickAd;id=".$self->getId)
|
||||
. q{')" style="position:absolute; padding: 3px; top:0px; left:0px; width:100%; height:100%; z-index:10;}
|
||||
. q{ display:block; text-decoration:none; vertical-align:top; background-color:}
|
||||
. $self->get("backgroundColor") . q{; font-size: 13px; font-weight: normal;"><b><span style="color:}
|
||||
. $self->get("textColor") . q{;">} . $self->get("title")
|
||||
. q{</span></b><br /><span style="color:} . $self->get("textColor") . q{;">}
|
||||
. $self->get("adText") . q{</span></a></div>};
|
||||
}
|
||||
elsif ($self->get("type") eq "image") {
|
||||
my $storage = WebGUI::Storage->get($self->session, $self->get("storageId"));
|
||||
$self->{_properties}{renderedAd} =
|
||||
q{<div style="position:relative; width:} . $adSpace->get("width") . q{px; height:}
|
||||
. $adSpace->get("height") . q{px; margin:0px; overflow:hidden; border:0px;"><a href="#" }
|
||||
. q{onclick="window.location.assign('} .$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId)
|
||||
. q{')" style="position:absolute; padding: }
|
||||
. q{3px; top:0px; left:0px; width:100%; height:100%; z-index:10; display:block; text-decoration:none; }
|
||||
. q{vertical-align:top;"><img }
|
||||
. q{src="} . $storage->getUrl($storage->getFiles->[0]) . q{" alt="} . $self->get("title")
|
||||
. q{" style="z-index:0;position:relative;border-style:none;border: 0px;" /></a></div>};
|
||||
}
|
||||
elsif ($self->get("type") eq "rich") {
|
||||
my $ad = $self->get("richMedia");
|
||||
WebGUI::Macro::process($self->session, \$ad);
|
||||
$self->{_properties}{renderedAd} = $ad;
|
||||
|
|
|
|||
|
|
@ -215,17 +215,27 @@ A reference to the current session.
|
|||
|
||||
If supplied, provides a list of defaults such as title and icons for the admin console.
|
||||
|
||||
=head3 options
|
||||
|
||||
A hash reference of options with the following keys
|
||||
|
||||
=head4 showAdminBar
|
||||
|
||||
If true, will show the admin bar on this admin console page
|
||||
|
||||
=cut
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $id = shift;
|
||||
my $options = shift;
|
||||
my $self;
|
||||
$self->{_session} = $session;
|
||||
bless $self, $class;
|
||||
$self->{_function} = {};
|
||||
$self->{_functionId} = $id;
|
||||
$self->{_options} = $options;
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +299,17 @@ sub render {
|
|||
}
|
||||
|
||||
$var{"backtosite.url"} = $self->session->url->getBackToSiteURL();
|
||||
return $self->session->style->process(WebGUI::Asset::Template->new($self->session,$self->session->setting->get("AdminConsoleTemplate"))->process(\%var),"PBtmpl0000000000000137");
|
||||
my $template
|
||||
= WebGUI::Asset::Template->new(
|
||||
$self->session,
|
||||
$self->session->setting->get("AdminConsoleTemplate")
|
||||
);
|
||||
if ( $self->{_options}->{showAdminBar} ) {
|
||||
$var{adminBar}
|
||||
= WebGUI::Macro::AdminBar::process($self->session);
|
||||
}
|
||||
my $output = $template->process(\%var);
|
||||
return $self->session->style->process($output,"PBtmpl0000000000000137");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -58,6 +58,43 @@ sub addRevision {
|
|||
return $newSelf;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 canAdd ( )
|
||||
|
||||
Override canAdd to ignore its permissions check. Permissions are handled
|
||||
by the parent Matrix.
|
||||
|
||||
=cut
|
||||
|
||||
sub canAdd {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 canEdit ( )
|
||||
|
||||
Returns true if the user can edit this asset. C<userId> is a WebGUI user ID.
|
||||
|
||||
Users can edit this Matrix listing if they are the owner, or if they can edit
|
||||
the parent Matrix.
|
||||
|
||||
=cut
|
||||
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
|
||||
if ( $self->session->form->process("assetId") eq "new" ) {
|
||||
return $self->getParent->canAddMatrixListing();
|
||||
}
|
||||
else {
|
||||
return 1 if $self->session->user->userId eq $self->get("ownerUserId");
|
||||
|
||||
return $self->getParent->canEdit();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, definition )
|
||||
|
|
@ -313,11 +350,27 @@ sub getEditForm {
|
|||
$attribute->{label} = $attribute->{name};
|
||||
$attribute->{subtext} = $attribute->{description};
|
||||
$attribute->{name} = 'attribute_'.$attribute->{attributeId};
|
||||
if($attribute->{fieldType} eq 'Combo'){
|
||||
my %options;
|
||||
tie %options, 'Tie::IxHash';
|
||||
%options = $db->buildHash("select value, value from MatrixListing_attribute
|
||||
where attributeId = ? and value != '' order by value",[$attribute->{attributeId}]);
|
||||
$attribute->{options} = \%options;
|
||||
$attribute->{extras} = "style='width:120px'";
|
||||
}
|
||||
$form->dynamicField(%{$attribute});
|
||||
}
|
||||
}
|
||||
|
||||
$form->submit();
|
||||
$form->raw(
|
||||
'<tr><td COLSPAN=2>'.
|
||||
WebGUI::Form::Submit($session, {}).
|
||||
WebGUI::Form::Button($session, {
|
||||
-value => $i18n->get('cancel', 'WebGUI'),
|
||||
-extras => q|onclick="history.go(-1);" class="backwardButton"|
|
||||
}).
|
||||
'</td></tr>'
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
|
@ -564,6 +617,16 @@ sub view {
|
|||
if ($emailSent){
|
||||
$var->{emailSent} = 1;
|
||||
}
|
||||
|
||||
unless($self->hasBeenCommitted){
|
||||
my $workflowInstanceId = $db->quickScalar("select workflowInstanceId from assetVersionTag where tagId =?"
|
||||
,[$self->get('tagId')]);
|
||||
$var->{canApprove} = $self->getParent->canEdit;
|
||||
$var->{approveOrDenyUrl} = $self->getUrl("op=manageRevisionsInTag;workflowInstanceId=".$workflowInstanceId
|
||||
.";tagId=".$self->get('tagId'));
|
||||
}
|
||||
$var->{canEdit} = $self->canEdit;
|
||||
$var->{editUrl} = $self->getUrl("func=edit");
|
||||
$var->{controls} = $self->getToolbar;
|
||||
$var->{comments} = $self->getFormattedComments();
|
||||
$var->{productName} = $var->{title};
|
||||
|
|
@ -629,33 +692,10 @@ sub view {
|
|||
my $storage = $file->getStorageLocation;
|
||||
my @files;
|
||||
@files = @{ $storage->getFiles } if (defined $storage);
|
||||
|
||||
$var->{screenshots} = qq|
|
||||
<script type="text/javascript" src="/extras/ukplayer/swfobject.js"></script>
|
||||
<script type="text/javascript">
|
||||
swfobject.registerObject("myFlashContent","9.0.0","/extras/ukplayer/expressInstall.swf");
|
||||
</script>
|
||||
<div>
|
||||
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="400" height="300" id="myFlashContent">
|
||||
<param name="movie" value="/extras/ukplayer/slideShow.swf" />
|
||||
<param name="flashvars" value="config=?func=getScreenshotsConfig" />
|
||||
<!--[if !IE]>-->
|
||||
<object type="application/x-shockwave-flash" data="/extras/ukplayer/slideShow.swf" width="400"
|
||||
height="300">
|
||||
<param name="flashvars" value="config=?func=getScreenshotsConfig" />
|
||||
<!--<![endif]-->
|
||||
<a href="http:/www.adobe.com/go/getflashplayer">
|
||||
<img src="http:/www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe
|
||||
Flash player" />
|
||||
</a>
|
||||
<!--[if !IE]>-->
|
||||
</object>
|
||||
<!--<![endif]-->
|
||||
</object>
|
||||
</div>
|
||||
|;
|
||||
$var->{screenshotsUrl} = $self->getUrl('func=viewScreenshots');
|
||||
$var->{screenshotThumbnail} = $storage->getUrl('thumb-'.$files[0]);
|
||||
}
|
||||
|
||||
|
||||
# Rating form
|
||||
|
||||
my %rating;
|
||||
|
|
@ -817,12 +857,14 @@ Web facing method which is the default edit page
|
|||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->noAccess() unless $self->getParent->canAddMatrixListing();
|
||||
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_MatrixListing");
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
|
||||
if($self->session->form->process('func') eq 'add'){
|
||||
return $self->session->privilege->noAccess() unless $self->getParent->canAddMatrixListing();
|
||||
}else{
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
}
|
||||
|
||||
my $var = $self->get;
|
||||
my $matrix = $self->getParent;
|
||||
|
|
@ -912,9 +954,7 @@ sub www_getScreenshots {
|
|||
my $thumb = 'thumb-'.$file;
|
||||
$xml .= "
|
||||
<slide>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<title><![CDATA[<b>Slide</b> One]]></title>
|
||||
<title></title>
|
||||
<description><![CDATA[ Screenshots ]]></description>
|
||||
<image_source>".$storage->getUrl($file)."</image_source>
|
||||
<duration>5</duration>
|
||||
|
|
@ -942,56 +982,14 @@ Returns the xml config file for the ukplayer that displays the screenshots.
|
|||
=cut
|
||||
|
||||
sub www_getScreenshotsConfig {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
|
||||
return $self->session->privilege->noAccess() unless $self->canView;
|
||||
|
||||
$self->session->http->setMimeType('text/xml');
|
||||
|
||||
my $xml = qq|<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config>
|
||||
|
||||
<content_url>?func=getScreenshots</content_url>
|
||||
|
||||
<width>400</width><!-- this value is overwritten by the flashVars but the tag needs to be here (and it is
|
||||
useful for offline testing) -->
|
||||
<height>300</height><!-- this value is overwritten by the flashVars but the tag needs to be here (and it is
|
||||
useful for offline testing) -->
|
||||
<background_color>0xDDDDEE</background_color>
|
||||
<default_duration>20</default_duration>
|
||||
<default_slidewidth>100</default_slidewidth>
|
||||
<default_slideheight>100</default_slideheight>
|
||||
|
||||
<font>Verdana</font>
|
||||
<font_size>12</font_size>
|
||||
<font_color>0xCCCCCC</font_color>
|
||||
<text_border_color>0xCCCCCC</text_border_color>
|
||||
<text_bg_color>0x000000</text_bg_color>
|
||||
<text_autohide>true</text_autohide>
|
||||
|
||||
<controls_color>0xCCCCCC</controls_color>
|
||||
<controls_border_color>0xCCCCCC</controls_border_color>
|
||||
<controls_bg_color>0x000000</controls_bg_color>
|
||||
<controls_autohide>false</controls_autohide>
|
||||
|
||||
<thumbnail_width>48</thumbnail_width>
|
||||
<thumbnail_height>36</thumbnail_height>
|
||||
<thumbnail_border_color>0x000000</thumbnail_border_color>
|
||||
<menu_autohide>true</menu_autohide>
|
||||
<menu_dead_zone_width>100</menu_dead_zone_width>
|
||||
<menu_gaps>5</menu_gaps>
|
||||
|
||||
<mute_at_start>false</mute_at_start>
|
||||
<autostart>true</autostart>
|
||||
<autopause>false</autopause>
|
||||
<loop>false</loop>
|
||||
<error_message_content><![CDATA[XML not found: ]]></error_message_content>
|
||||
<error_message_image><![CDATA[Image not found]]></error_message_image>
|
||||
|
||||
</config>
|
||||
|;
|
||||
|
||||
return $xml;
|
||||
return $self->processTemplate($var,$self->getParent->get("screenshotsConfigTemplateId"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1099,7 +1097,24 @@ sub www_view {
|
|||
return $self->view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewScreenshots ( )
|
||||
|
||||
Returns this listing's screenshots in a ukplayer.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewScreenshots {
|
||||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
|
||||
$var->{configUrl} = 'config='.$self->getUrl("func=getScreenshotsConfig");
|
||||
|
||||
return $self->session->privilege->noAccess() unless $self->canView;
|
||||
|
||||
return $self->processTemplate($var,$self->getParent->get("screenshotsTemplateId"));
|
||||
}
|
||||
1;
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -292,6 +292,31 @@ sub getThumbnailUrl {
|
|||
return undef;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
=head2 getVendorId ( )
|
||||
|
||||
Returns the vendorId of the vendor for this sku. Defaults to the default
|
||||
vendor with id defaultvendor000000000.
|
||||
|
||||
=cut
|
||||
|
||||
sub getVendorId {
|
||||
my $self = shift;
|
||||
return 'defaultvendor000000000';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getVendorPayout ( )
|
||||
|
||||
Returns the amount that should be payed to the vendor for this sku.
|
||||
|
||||
=cut
|
||||
|
||||
sub getVendorPayout {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getWeight ( )
|
||||
|
|
|
|||
|
|
@ -140,6 +140,25 @@ sub definition {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDiscountAmount -- class level function
|
||||
|
||||
returns the amount of discount to apply to this purchase
|
||||
|
||||
=cut
|
||||
|
||||
sub getDiscountAmount {
|
||||
my($discounts,$count) = @_;
|
||||
my @discounts = parseDiscountText( $discounts );
|
||||
my $previousDiscount = 0;
|
||||
foreach my $discountSet ( @discounts ) {
|
||||
last if $count < $discountSet->[1];
|
||||
$previousDiscount = $discountSet->[0];
|
||||
}
|
||||
return $previousDiscount;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDiscountText -- class level function
|
||||
|
||||
returns a string with a coma seperated list of counts fromt he discount text
|
||||
|
|
@ -181,6 +200,24 @@ sub getImpressionDiscountText {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getPrice
|
||||
|
||||
get the price for this purchase
|
||||
|
||||
sub getPrice {
|
||||
my $self = shift;
|
||||
my $options = $self->getOptions;
|
||||
my $impressionCount = $options->{impressions};
|
||||
my $clickCount = $options->{clicks};
|
||||
my $impressionDiscount = getDiscountAmount($self->get('impressionDiscounts'),$impressionCount );
|
||||
my $clickDiscount = getDiscountAmount($self->get('clickDiscounts'),$clickCount );
|
||||
my $impressionPrice = $self->get('pricePerImpression') - ( $impressionDiscount / 100 );
|
||||
my $clickPrice = $self->get('pricePerClick') - ( $clickDiscount / 100 );
|
||||
return sprintf "%.2f", $impressionPrice * $impressionCount + $clickPrice * $clickCount;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 i18n
|
||||
|
||||
returns an internationalization object for this class
|
||||
|
|
@ -235,7 +272,7 @@ sub manage {
|
|||
|
||||
=head2 onCompletePurchase
|
||||
|
||||
Applies the first term of the subscription. This method is called when the payment is successful.
|
||||
inserts the ad intothe adspace...
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -265,7 +302,7 @@ sub parseDiscountText {
|
|||
push @discounts, [ $1, $2 ];
|
||||
}
|
||||
}
|
||||
return @discounts;
|
||||
return sort { $a->[1] <=> $b->[1] } @discounts;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -325,40 +362,40 @@ sub view {
|
|||
manageLink => $self->getUrl("func=manage"),
|
||||
adSkuTitle => $self->get('title'),
|
||||
adSkuDescription => $self->get('description'),
|
||||
form_title => WebGUI::Form::text($session, {
|
||||
-name=>"form_title",
|
||||
formTitle => WebGUI::Form::text($session, {
|
||||
-name=>"formTitle",
|
||||
-value=>$self->{title},
|
||||
-size=>40
|
||||
-default=>'untitled',
|
||||
}),
|
||||
form_link => WebGUI::Form::Url($session, {
|
||||
-name=>"form_link",
|
||||
formLink => WebGUI::Form::Url($session, {
|
||||
-name=>"formLink",
|
||||
-value=>$self->{link},
|
||||
-size=>40
|
||||
-required=>1,
|
||||
}),
|
||||
form_image => WebGUI::Form::Image($session, {
|
||||
-name=>"form_image",
|
||||
formImage => WebGUI::Form::Image($session, {
|
||||
-name=>"formImage",
|
||||
-value=>$self->{image},
|
||||
-size=>40
|
||||
-required=>1,
|
||||
-forceImageOnly=>1,
|
||||
}),
|
||||
form_clicks => WebGUI::Form::Integer($session, {
|
||||
-name=>"form_clicks",
|
||||
formClicks => WebGUI::Form::Integer($session, {
|
||||
-name=>"formClicks",
|
||||
-value=>$self->{clicks},
|
||||
-size=>40
|
||||
-required=>1,
|
||||
}),
|
||||
form_impressions => WebGUI::Form::Integer($session, {
|
||||
-name=>"form_impressions",
|
||||
formImpressions => WebGUI::Form::Integer($session, {
|
||||
-name=>"formImpressions",
|
||||
-value=>$self->{impressions},
|
||||
-size=>40
|
||||
-required=>1,
|
||||
}),
|
||||
click_price => $self->get('pricePerClick'),
|
||||
impression_price => $self->get('pricePerImpression'),
|
||||
click_discount => $self->getClickDiscountText,
|
||||
impression_discount => $self->getImpressionDiscountText,
|
||||
clickPrice => $self->get('pricePerClick'),
|
||||
impressionPrice => $self->get('pricePerImpression'),
|
||||
clickDiscount => $self->getClickDiscountText,
|
||||
impressionDiscount => $self->getImpressionDiscountText,
|
||||
);
|
||||
return $self->processTemplate(\%var,undef,$self->{_viewTemplate});
|
||||
}
|
||||
|
|
@ -398,7 +435,14 @@ sub www_addToCart {
|
|||
my $self = shift;
|
||||
if ($self->canView) {
|
||||
$self->{_hasAddedToCart} = 1;
|
||||
$self->addToCart({price => $self->getPrice});
|
||||
my $form = $self->session->form;
|
||||
$self->addToCart({
|
||||
title => $form->get('formTitle'),
|
||||
link => $form->get('formLink','url'),
|
||||
image => $form->get('formImage'),
|
||||
clicks => $form->get('formClicks'),
|
||||
impressions => $form->get('formImpressions'),
|
||||
});
|
||||
}
|
||||
return $self->www_view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,11 +169,14 @@ Accepts the information from the donation form and adds it to the cart.
|
|||
=cut
|
||||
|
||||
sub www_donate {
|
||||
my $self = shift;
|
||||
if ($self->canView) {
|
||||
my $self = shift;
|
||||
my $price = $self->session->form->get("price") || $self->getPrice;
|
||||
|
||||
if ($self->canView && $price > 0) {
|
||||
$self->{_hasAddedToCart} = 1;
|
||||
$self->addToCart({price => ($self->session->form->get("price") || $self->getPrice) });
|
||||
$self->addToCart( { price => $price } );
|
||||
}
|
||||
|
||||
return $self->www_view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ sub definition {
|
|||
},
|
||||
parser => {
|
||||
noFormPost => 1,
|
||||
fieldType => 'selectList',
|
||||
fieldType => 'selectBox',
|
||||
defaultValue => [$session->config->get("defaultTemplateParser")],
|
||||
},
|
||||
namespace => {
|
||||
|
|
@ -144,6 +144,7 @@ sub processPropertiesFromFormPost {
|
|||
my %data;
|
||||
my $needsUpdate = 0;
|
||||
if ($self->getValue("parser") ne $self->session->form->process("parser","className") && ($self->session->form->process("parser","className") ne "")) {
|
||||
$needsUpdate = 1;
|
||||
if (isIn($self->session->form->process("parser","className"),@{$self->session->config->get("templateParsers")})) {
|
||||
%data = ( parser => $self->session->form->process("parser","className") );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -391,12 +391,13 @@ sub _cacheFieldConfig {
|
|||
my $fieldData;
|
||||
if ($jsonData && eval { $jsonData = JSON::from_json($jsonData) ; 1 }) {
|
||||
# jsonData is an array in the order the fields should be
|
||||
$self->{_fieldConfig} = {
|
||||
map { $_->{name}, $_ } @{ $jsonData }
|
||||
};
|
||||
$self->{_fieldOrder} = [
|
||||
map { $_->{name} } @{ $jsonData }
|
||||
];
|
||||
$self->{_fieldConfig} = {};
|
||||
$self->{_fieldOrder} = [];
|
||||
FIELD: foreach my $field (@{ $jsonData } ) {
|
||||
next FIELD unless ref $field eq 'HASH';
|
||||
$self->{_fieldConfig}->{$field->{name}} = $field;
|
||||
push @{ $self->{_fieldOrder} }, $field->{name};
|
||||
}
|
||||
}
|
||||
else {
|
||||
$self->{_fieldConfig} = {};
|
||||
|
|
@ -484,9 +485,7 @@ sub deleteAttachedFiles {
|
|||
my $form = $self->_createForm($fieldConfig->{$field}, $entryData->{$field});
|
||||
if ($form->can('getStorageLocation')) {
|
||||
my $storage = $form->getStorageLocation;
|
||||
if ($storage) {
|
||||
$storage->delete;
|
||||
}
|
||||
$storage->delete if $storage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -498,7 +497,7 @@ sub deleteAttachedFiles {
|
|||
my $form = $self->_createForm($fieldConfig->{$field}, $entryData->{$field});
|
||||
if ($form->can('getStorageLocation')) {
|
||||
my $storage = $form->getStorageLocation;
|
||||
$storage->delete;
|
||||
$storage->delete if $storage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1104,6 +1104,7 @@ sub www_addAlbumService {
|
|||
description => $form->get('synopsis','textarea'),
|
||||
synopsis => $form->get('synopsis','textarea'),
|
||||
othersCanAdd => $form->get('othersCanAdd','yesNo'),
|
||||
ownerUserId => $session->user->userId,
|
||||
});
|
||||
|
||||
$album->requestAutoCommit;
|
||||
|
|
|
|||
|
|
@ -1019,6 +1019,7 @@ sub www_addFileService {
|
|||
title => $form->get('title','text'),
|
||||
description => $form->get('synopsis','textarea'),
|
||||
synopsis => $form->get('synopsis','textarea'),
|
||||
ownerUserId => $session->user->userId,
|
||||
});
|
||||
|
||||
my $storage = $file->getStorageLocation;
|
||||
|
|
|
|||
|
|
@ -30,10 +30,46 @@ Returns true if able to add MatrixListings.
|
|||
|
||||
sub canAddMatrixListing {
|
||||
my $self = shift;
|
||||
my $user = $self->session->user;
|
||||
|
||||
return 0 if $self->session->user->isVisitor;
|
||||
# Users in the groupToAdd group can add listings
|
||||
if ( $user->isInGroup( $self->get("groupToAdd") ) ) {
|
||||
return 1;
|
||||
}
|
||||
# Users who can edit matrix can add listings
|
||||
else {
|
||||
return $self->canEdit;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 canEdit ( [userId] )
|
||||
|
||||
Returns true if the user can edit this Matrix.
|
||||
|
||||
Also checks if a user is adding a Matrix Listing and allows them to if they are
|
||||
part of the C<groupToAdd> group.
|
||||
|
||||
=cut
|
||||
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
|
||||
my $form = $self->session->form;
|
||||
if ( $form->get('func') eq "editSave" && $form->get('assetId') eq "new" && $form->get( 'class' )->isa(
|
||||
'WebGUI::Asset::MatrixListing' ) ) {
|
||||
return $self->canAddMatrixListing();
|
||||
}
|
||||
else {
|
||||
if ($userId eq $self->get("ownerUserId")) {
|
||||
return 1;
|
||||
}
|
||||
my $user = WebGUI::User->new($self->session, $userId);
|
||||
return $user->isInGroup($self->get("groupIdEdit"));
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -94,6 +130,22 @@ sub definition {
|
|||
hoverHelp =>$i18n->get('edit listing template description'),
|
||||
label =>$i18n->get('edit listing template label'),
|
||||
},
|
||||
screenshotsTemplateId=>{
|
||||
defaultValue =>"matrixtmpl000000000006",
|
||||
fieldType =>"template",
|
||||
tab =>"display",
|
||||
namespace =>"Matrix/Screenshots",
|
||||
hoverHelp =>$i18n->get('screenshots template description'),
|
||||
label =>$i18n->get('screenshots template label'),
|
||||
},
|
||||
screenshotsConfigTemplateId=>{
|
||||
defaultValue =>"matrixtmpl000000000007",
|
||||
fieldType =>"template",
|
||||
tab =>"display",
|
||||
namespace =>"Matrix/ScreenshotsConfig",
|
||||
hoverHelp =>$i18n->get('screenshots config template description'),
|
||||
label =>$i18n->get('screenshots config template label'),
|
||||
},
|
||||
defaultSort=>{
|
||||
fieldType =>"selectBox",
|
||||
tab =>"display",
|
||||
|
|
@ -164,6 +216,13 @@ sub definition {
|
|||
hoverHelp =>$i18n->get('max comparisons privileged description'),
|
||||
label =>$i18n->get('max comparisons privileged label'),
|
||||
},
|
||||
groupToAdd=>{
|
||||
fieldType =>"group",
|
||||
tab =>"security",
|
||||
defaultValue =>2,
|
||||
hoverHelp =>$i18n->get('group to add description'),
|
||||
label =>$i18n->get('group to add label'),
|
||||
},
|
||||
submissionApprovalWorkflowId=>{
|
||||
fieldType =>"workflow",
|
||||
tab =>"security",
|
||||
|
|
@ -442,6 +501,8 @@ sub view {
|
|||
# javascript and css files for compare form datatable
|
||||
$self->session->style->setLink($self->session->url->extras('yui/build/datatable/assets/skins/sam/datatable.css'),
|
||||
{type =>'text/css', rel=>'stylesheet'});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/yahoo-dom-event/yahoo-dom-event.js'), {type =>
|
||||
'text/javascript'});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/json/json-min.js'), {type =>
|
||||
'text/javascript'});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/connection/connection-min.js'), {type =>
|
||||
|
|
@ -541,7 +602,8 @@ sub view {
|
|||
}) };
|
||||
foreach my $pendingListing (@pendingListings){
|
||||
push (@{ $var->{pending_loop} }, {
|
||||
url => $pendingListing->getUrl,
|
||||
url => $pendingListing->getUrl
|
||||
."?func=view;revision=".$pendingListing->get('revisionDate'),
|
||||
name => $pendingListing->get('title'),
|
||||
});
|
||||
}
|
||||
|
|
@ -1024,6 +1086,7 @@ sub www_getCompareListData {
|
|||
unless (scalar(@listingIds)) {
|
||||
@listingIds = $self->session->form->checkList("listingId");
|
||||
}
|
||||
my @responseFields = ("attributeId", "name", "description","fieldType", "checked");
|
||||
|
||||
foreach my $listingId (@listingIds){
|
||||
$listingId =~ s/_____/-/g;
|
||||
|
|
@ -1038,11 +1101,13 @@ sub www_getCompareListData {
|
|||
url =>$listing->getUrl,
|
||||
lastUpdated =>$session->datetime->epochToHuman( $listing->get('revisonDate'),"%z" ),
|
||||
});
|
||||
push(@responseFields, $listingId_safe, $listingId_safe."_compareColor");
|
||||
}
|
||||
push(@results,{name=>$i18n->get('last updated label'),fieldType=>'lastUpdated'});
|
||||
|
||||
my $jsonOutput;
|
||||
$jsonOutput->{ColumnDefs} = \@columnDefs;
|
||||
$jsonOutput->{ColumnDefs} = \@columnDefs;
|
||||
$jsonOutput->{ResponseFields} = \@responseFields;
|
||||
|
||||
foreach my $category (keys %{$self->getCategories}) {
|
||||
push(@results,{name=>$category,fieldType=>'category'});
|
||||
|
|
@ -1144,6 +1209,7 @@ sub www_search {
|
|||
|
||||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
my $db = $self->session->db;
|
||||
|
||||
$var->{compareForm} = $self->getCompareForm;
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/yahoo/yahoo-min.js'),
|
||||
|
|
@ -1175,7 +1241,7 @@ sub www_search {
|
|||
my $attributes;
|
||||
my @attribute_loop;
|
||||
my $categoryLoopName = $self->session->url->urlize($category)."_loop";
|
||||
$attributes = $self->session->db->read("select * from Matrix_attribute where category =? and assetId = ?",
|
||||
$attributes = $db->read("select * from Matrix_attribute where category =? and assetId = ?",
|
||||
[$category,$self->getId]);
|
||||
while (my $attribute = $attributes->hashRef) {
|
||||
$attribute->{label} = $attribute->{name};
|
||||
|
|
@ -1184,10 +1250,14 @@ sub www_search {
|
|||
$attribute->{extras} = " class='attributeSelect'";
|
||||
if($attribute->{fieldType} eq 'Combo'){
|
||||
$attribute->{fieldType} = 'SelectBox';
|
||||
}
|
||||
if($attribute->{fieldType} eq 'SelectBox'){
|
||||
$attribute->{options} = "blank\n".$attribute->{options};
|
||||
my %options;
|
||||
tie %options, 'Tie::IxHash';
|
||||
%options = $db->buildHash('select value, value from MatrixListing_attribute
|
||||
where attributeId = ? order by value',[$attribute->{attributeId}]);
|
||||
$options{'blank'} = 'blank';
|
||||
$attribute->{options} = \%options;
|
||||
$attribute->{value} = 'blank';
|
||||
$attribute->{extras} = "style='width:120px'";
|
||||
}
|
||||
$attribute->{form} = WebGUI::Form::DynamicField->new($self->session,%{$attribute})->toHtml;
|
||||
push(@attribute_loop,$attribute);
|
||||
|
|
|
|||
|
|
@ -210,7 +210,11 @@ sub importProducts {
|
|||
}
|
||||
|
||||
if ($productRow{title} ne $product->getTitle) {
|
||||
$product->update({ title => $product->fixTitle($productRow{title}) });
|
||||
my $newTitle = $product->fixTitle($productRow{title});
|
||||
$product->update({
|
||||
title => $newTitle,
|
||||
menuTitle => $newTitle,
|
||||
});
|
||||
}
|
||||
|
||||
my $collaterals = $product->getAllCollateral('variantsJSON');
|
||||
|
|
@ -230,10 +234,12 @@ sub importProducts {
|
|||
##Insert a new product;
|
||||
$session->log->warn("Making a new product: $productRow{sku}\n");
|
||||
my $newProduct = $node->addChild({className => 'WebGUI::Asset::Sku::Product'});
|
||||
my $newTitle = $newProduct->fixTitle($productRow{title});
|
||||
$newProduct->update({
|
||||
title => $newProduct->fixTitle($productRow{title}),
|
||||
url => $newProduct->fixUrl($productRow{title}),
|
||||
sku => $productRow{mastersku},
|
||||
title => $newTitle,
|
||||
menuTitle => $newTitle,
|
||||
url => $newProduct->fixUrl($productRow{title}),
|
||||
sku => $productRow{mastersku},
|
||||
});
|
||||
$newProduct->setCollateral('variantsJSON', 'variantId', 'new', \%productCollateral);
|
||||
$newProduct->commit;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -212,6 +212,7 @@ sub purgeRevision {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 view ( )
|
||||
|
||||
method called by the container www_view method.
|
||||
|
|
@ -261,6 +262,7 @@ our @EXPORT = qw(install uninstall);
|
|||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub install {
|
||||
my $config = $ARGV[0];
|
||||
my $home = $ARGV[1] || "/data/WebGUI";
|
||||
|
|
@ -279,6 +281,7 @@ sub install {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub uninstall {
|
||||
my $config = $ARGV[0];
|
||||
my $home = $ARGV[1] || "/data/WebGUI";
|
||||
|
|
|
|||
|
|
@ -273,10 +273,13 @@ sub createAccountSave {
|
|||
to => $profile->{email},
|
||||
subject => $i18n->get('email address validation email subject','AuthWebGUI')
|
||||
});
|
||||
$mail->addText(
|
||||
$i18n->get('email address validation email body','AuthWebGUI') . "\n\n"
|
||||
. $session->url->page("op=auth;method=validateEmail;key=".$key, 'full') . "\n\n"
|
||||
);
|
||||
my $var;
|
||||
$var->{newUser_username} = $username;
|
||||
$var->{activationUrl} = $session->url->page("op=auth;method=validateEmail;key=".$key, 'full');
|
||||
my $text =
|
||||
WebGUI::Asset::Template->new($self->session,$self->getSetting('accountActivationTemplate'))->process($var);
|
||||
WebGUI::Macro::process($self->session,\$text);
|
||||
$mail->addText($text);
|
||||
$mail->addFooter;
|
||||
$mail->send;
|
||||
$self->user->status("Deactivated");
|
||||
|
|
@ -574,7 +577,14 @@ sub editUserSettingsForm {
|
|||
-label => $i18n->get("password recovery template"),
|
||||
-hoverHelp => $i18n->get("password recovery template help")
|
||||
);
|
||||
return $f->printRowsOnly;
|
||||
$f->template(
|
||||
-name => "webguiAccountActivationTemplate",
|
||||
-value => $self->session->setting->get("webguiAccountActivationTemplate"),
|
||||
-namespace => "Auth/WebGUI/Activation",
|
||||
-label => $i18n->get("account activation template"),
|
||||
-hoverHelp => $i18n->get("account activation template help")
|
||||
);
|
||||
return $f->printRowsOnly;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -625,6 +635,7 @@ sub editUserSettingsFormSave {
|
|||
$s->set("webguiExpiredPasswordTemplate", $f->process("webguiExpiredPasswordTemplate","template"));
|
||||
$s->set("webguiLoginTemplate", $f->process("webguiLoginTemplate","template"));
|
||||
$s->set("webguiPasswordRecoveryTemplate", $f->process("webguiPasswordRecoveryTemplate","template"));
|
||||
$s->set("webguiAccountActivationTemplate", $f->process("webguiAccountActivationTemplate","template"));
|
||||
|
||||
if (@errors) {
|
||||
return \@errors;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use strict;
|
|||
use LWP::MediaTypes qw(guess_media_type);
|
||||
use Time::HiRes;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::PassiveAnalytics::Logging;
|
||||
|
||||
use Apache2::Const -compile => qw(OK);
|
||||
|
||||
|
|
@ -170,6 +171,9 @@ sub page {
|
|||
$method = "view";
|
||||
}
|
||||
}
|
||||
##Passive Analytics Logging
|
||||
WebGUI::PassiveAnalytics::Logging::log($session, $asset);
|
||||
|
||||
$output = tryAssetMethod($session,$asset,$method);
|
||||
$output = tryAssetMethod($session,$asset,"view") unless ($output || ($method eq "view"));
|
||||
}
|
||||
|
|
|
|||
165
lib/WebGUI/Content/AssetHistory.pm
Normal file
165
lib/WebGUI/Content/AssetHistory.pm
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
package WebGUI::Content::AssetHistory;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Content::AssetHistory
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Give the admins an interface to view the history of assets on their site.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use WebGUI::Content::AssetHistory;
|
||||
my $output = WebGUI::Content::AssetHistory::handler($session);
|
||||
|
||||
=head1 SUBROUTINES
|
||||
|
||||
These subroutines are available from this package:
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 handler ( session )
|
||||
|
||||
The content handler for this package.
|
||||
|
||||
=cut
|
||||
|
||||
sub handler {
|
||||
my ($session) = @_;
|
||||
return undef unless ($session->form->get('op') eq 'assetHistory');
|
||||
my $method = $session->form->get( 'method' )
|
||||
? 'www_' . $session->form->get( 'method' )
|
||||
: 'www_view'
|
||||
;
|
||||
|
||||
# Validate the method name
|
||||
if ( !__PACKAGE__->can( $method ) ) {
|
||||
return "Invalid method";
|
||||
}
|
||||
else {
|
||||
return __PACKAGE__->can( $method )->( $session );
|
||||
}
|
||||
my $output = "";
|
||||
# ...
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_getHistoryAsJson ( )
|
||||
|
||||
Servers side pagination for asset history data displayed in a YUI DataTable.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_getHistoryAsJson {
|
||||
my ($session) = @_;
|
||||
return $session->privilege->insufficient
|
||||
unless $session->user->isInGroup(12);
|
||||
my ($db, $form) = $session->quick(qw(db form));
|
||||
my $startIndex = $form->get('startIndex') || 0;
|
||||
my $numberOfResults = $form->get('results') || 25;
|
||||
my %goodKeys = qw/assetId 1 url 1 username 1 dateStamp 1/;
|
||||
my $sortKey = $form->get('sortKey');
|
||||
$sortKey = $goodKeys{$sortKey} == 1 ? $sortKey : 'dateStamp';
|
||||
my $sortDir = $form->get('sortDir');
|
||||
$sortDir = lc($sortDir) eq 'desc' ? 'desc' : 'asc';
|
||||
my @placeholders = ();
|
||||
my $sql = <<EOSQL;
|
||||
select SQL_CALC_FOUND_ROWS assetHistory.*,users.username from assetHistory join users on assetHistory.userId=users.userId
|
||||
EOSQL
|
||||
my $keywords = $form->get("keywords");
|
||||
if ($keywords ne "") {
|
||||
$db->buildSearchQuery(\$sql, \@placeholders, $keywords, [qw{url assetId username}])
|
||||
}
|
||||
push(@placeholders, $startIndex, $numberOfResults);
|
||||
$sql .= sprintf (" order by %s limit ?,?","$sortKey $sortDir");
|
||||
my %results = ();
|
||||
my @records = ();
|
||||
my $sth = $db->read($sql, \@placeholders);
|
||||
while (my $record = $sth->hashRef) {
|
||||
push(@records,$record);
|
||||
}
|
||||
$results{'recordsReturned'} = $sth->rows()+0;
|
||||
$sth->finish;
|
||||
$results{'records'} = \@records;
|
||||
$results{'totalRecords'} = $db->quickScalar('select found_rows()')+0; ##Convert to numeric
|
||||
$results{'startIndex'} = $startIndex;
|
||||
$results{'sort'} = undef;
|
||||
$results{'dir'} = $sortDir;
|
||||
$session->http->setMimeType('application/json');
|
||||
my $json = JSON::to_json(\%results);
|
||||
return $json;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_view
|
||||
|
||||
YUI DataTable for browsing asset history.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_view {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient
|
||||
unless $session->user->isInGroup(12);
|
||||
##YUI specific datatable CSS
|
||||
my $ac = WebGUI::AdminConsole->new( $session, "assetHistory", {
|
||||
showAdminBar => 1
|
||||
} );
|
||||
my ($style, $url) = $session->quick(qw(style url));
|
||||
$style->setLink($url->extras('/yui/build/fonts/fonts-min.css'), {rel=>'stylesheet', type=>'text/css'});
|
||||
$style->setLink($url->extras('yui/build/datatable/assets/skins/sam/datatable.css'), {rel=>'stylesheet', type => 'text/CSS'});
|
||||
$style->setLink($url->extras('yui/build/paginator/assets/skins/sam/paginator.css'), {rel=>'stylesheet', type => 'text/CSS'});
|
||||
$style->setScript($url->extras('/yui/build/utilities/utilities.js'), {type=>'text/javascript'});
|
||||
$style->setScript($url->extras('yui/build/json/json-min.js'), {type => 'text/javascript'});
|
||||
$style->setScript($url->extras('yui/build/paginator/paginator-min.js'), {type => 'text/javascript'});
|
||||
$style->setScript($url->extras('yui/build/datasource/datasource-min.js'), {type => 'text/javascript'});
|
||||
##YUI Datatable
|
||||
$style->setScript($url->extras('yui/build/datatable/datatable-min.js'), {type => 'text/javascript'});
|
||||
##WebGUI YUI AssetHistory
|
||||
$style->setScript( $url->extras( 'yui-webgui/build/i18n/i18n.js' ), {type => 'text/javascript'} );
|
||||
$style->setScript( $url->extras('yui-webgui/build/assetHistory/assetHistory.js'), {type => 'text/javascript'});
|
||||
##Default CSS
|
||||
$style->setRawHeadTags('<style type="text/css"> #paging a { color: #0000de; } #search form { display: inline; } </style>');
|
||||
my $i18n=WebGUI::International->new($session);
|
||||
|
||||
my $output;
|
||||
|
||||
$output .= q|
|
||||
<div class="yui-skin-sam">
|
||||
<div id="search"><form id="keywordSearchForm"><input type="text" name="keywords" id="keywordsField" /><input type="submit" value="|.$i18n->get(364, 'WebGUI').q|" /></form></div>
|
||||
<div id="dynamicdata"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.onDOMReady( WebGUI.AssetHistory.initManager );
|
||||
</script>
|
||||
|;
|
||||
|
||||
return $ac->render( $output );
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
@ -323,7 +323,9 @@ JavaScript that will take over if the browser has the cojones.
|
|||
|
||||
sub www_manage {
|
||||
my ( $session ) = @_;
|
||||
my $ac = WebGUI::AdminConsole->new( $session, "assets" );
|
||||
my $ac = WebGUI::AdminConsole->new( $session, "assets", {
|
||||
showAdminBar => 1
|
||||
} );
|
||||
my $currentAsset = getCurrentAsset( $session );
|
||||
my $i18n = WebGUI::International->new( $session, "Asset" );
|
||||
|
||||
|
|
@ -413,7 +415,7 @@ sub www_manage {
|
|||
YAHOO.util.Event.onDOMReady( WebGUI.AssetManager.initManager );
|
||||
</script>
|
||||
ENDHTML
|
||||
my $output = WebGUI::Macro::AdminBar::process($session).'<div class="yui-skin-sam" id="assetManager">' . getHeader( $session );
|
||||
my $output = '<div class="yui-skin-sam" id="assetManager">' . getHeader( $session );
|
||||
|
||||
### Crumbtrail
|
||||
my $crumb_markup = '<li><a href="%s">%s</a> ></li>';
|
||||
|
|
|
|||
49
lib/WebGUI/Content/PassiveAnalytics.pm
Normal file
49
lib/WebGUI/Content/PassiveAnalytics.pm
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
package WebGUI::Content::PassiveAnalytics;
|
||||
|
||||
use strict;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::Exception;
|
||||
use WebGUI::PassiveAnalytics::Flow;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Content::PassiveAnalytics
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Handle all requests for building and editing Passive Analytic flows.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use WebGUI::Content::PassiveAnalytics;
|
||||
my $output = WebGUI::Content::PassiveAnalytics::handler($session);
|
||||
|
||||
=head1 SUBROUTINES
|
||||
|
||||
These subroutines are available from this package:
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 handler ( session )
|
||||
|
||||
The content handler for this package.
|
||||
|
||||
=cut
|
||||
|
||||
sub handler {
|
||||
my ($session) = @_;
|
||||
my $output = undef;
|
||||
return undef unless $session->form->get('op') eq 'passiveAnalytics';
|
||||
my $function = "www_".$session->form->get('func');
|
||||
if ($function ne "www_" && (my $sub = WebGUI::PassiveAnalytics::Flow->can($function))) {
|
||||
$output = $sub->($session);
|
||||
}
|
||||
else {
|
||||
WebGUI::Error::MethodNotFound->throw(error=>"Couldn't call non-existant method $function inside PassiveAnalytics", method=>$function);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -159,11 +159,16 @@ sub toHtml {
|
|||
$url->extras( 'yui-webgui/build/form/textarea.js' ),
|
||||
{ type => 'text/javascript' },
|
||||
);
|
||||
$style->setRawHeadTags( q|
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.onDOMReady( function () { WebGUI.Form.Textarea.setMaxLength() } );
|
||||
</script>
|
||||
| );
|
||||
|
||||
unless ( $self->session->stow->get( 'texareaHeadTagsLoaded' ) ) {
|
||||
$style->setRawHeadTags( q|
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.onDOMReady( function () { WebGUI.Form.Textarea.setMaxLength() } );
|
||||
</script>
|
||||
| );
|
||||
|
||||
$self->session->stow->set( 'texareaHeadTagsLoaded', 1 )
|
||||
}
|
||||
|
||||
if ($self->get("resizable")) {
|
||||
$style->setLink($url->extras("resize.css"), {type=>"text/css", rel=>"stylesheet"});
|
||||
|
|
|
|||
|
|
@ -543,7 +543,8 @@ sub getAllGroupsFor {
|
|||
=head2 getAllUsers ( [ withoutExpired ] )
|
||||
|
||||
Returns an array reference containing a list of users that belong to this group
|
||||
and in any group that belongs to this group.
|
||||
and in any group that belongs to this group. The list is unique, so that each
|
||||
userId is only in it one time.
|
||||
|
||||
=head3 withoutExpired
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ sub fieldSetEnd {
|
|||
my $legend = shift;
|
||||
$self->{_data} .= "</tbody></table>\n"
|
||||
."</fieldset>\n"
|
||||
."<table ".$self->{_tableExtras}.'" style="width: 100%;"><tbody>'
|
||||
."<table ".$self->{_tableExtras}.' style="width: 100%;"><tbody>'
|
||||
."\n";
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ sub fieldSetStart {
|
|||
my $legend = shift;
|
||||
$self->{_data} .= "</tbody></table>\n"
|
||||
."<fieldset>\n<legend>".$legend."</legend>\n"
|
||||
."<table ".$self->{_tableExtras}.'" style="width: 100%;"><tbody>'
|
||||
."<table ".$self->{_tableExtras}.' style="width: 100%;"><tbody>'
|
||||
."\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ our $HELP = {
|
|||
{ 'name' => 'open.label' },
|
||||
{ 'name' => 'close.label' },
|
||||
{ 'name' => 'closed.label' },
|
||||
{ 'name' => 'collaborationAssetId' },
|
||||
{ 'name' => 'critical.label' },
|
||||
{ 'name' => 'minor.label' },
|
||||
{ 'name' => 'cosmetic.label' },
|
||||
|
|
@ -155,6 +154,7 @@ our $HELP = {
|
|||
{ 'name' => 'sortby.views.url' },
|
||||
{ 'name' => 'sortby.replies.url' },
|
||||
{ 'name' => 'sortby.rating.url' }
|
||||
{ 'name' => 'collaborationAssetId' },
|
||||
],
|
||||
related => [
|
||||
{ tag => 'collaboration template labels',
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ our $HELP = {
|
|||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'canEdit' },
|
||||
{ 'name' => 'editUrl' },
|
||||
{ 'name' => 'canApprove' },
|
||||
{ 'name' => 'approveOrDenyUrl' },
|
||||
{ 'name' => 'screenshots' },
|
||||
{ 'name' => 'emailForm' },
|
||||
{ 'name' => 'emailSent' },
|
||||
|
|
|
|||
|
|
@ -163,6 +163,16 @@ our $HELP = {
|
|||
related => [],
|
||||
},
|
||||
|
||||
'account activation template' => {
|
||||
title => 'account activation template title',
|
||||
body => '',
|
||||
variables => [
|
||||
{ 'name' => 'newUser_username' },
|
||||
{ 'name' => 'activationUrl' },
|
||||
],
|
||||
fields => [],
|
||||
related => []
|
||||
},
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ sub process {
|
|||
|
||||
my $db = $session->db;
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my ($count) = $db->quickArray("select count(*) from inbox where userId=? and status='unread'",[$session->user->userId]);
|
||||
my $count = WebGUI::Inbox->new($session)->getUnreadMessageCount;
|
||||
my $output = "";
|
||||
|
||||
if($count > 0) {
|
||||
|
|
|
|||
|
|
@ -485,6 +485,7 @@ sub definition {
|
|||
groupIdAdminGraphics
|
||||
groupIdAdminGroup
|
||||
groupIdAdminGroupAdmin
|
||||
groupIdAdminHistory
|
||||
groupIdAdminHelp
|
||||
groupIdAdminLDAPLink
|
||||
groupIdAdminLoginHistory
|
||||
|
|
|
|||
|
|
@ -504,6 +504,10 @@ sub getPageLinks {
|
|||
my $start = ($minPage > 0) ? $minPage : 1;
|
||||
my $maxPage = $start + $limit - 1;
|
||||
my $end = ($maxPage < $self->getPageNumber) ? $self->getPageNumber : $maxPage;
|
||||
if ($maxPage > $self->getNumberOfPages) {
|
||||
$end = $self->getNumberOfPages;
|
||||
$start = $self->getNumberOfPages - $limit + 1;
|
||||
}
|
||||
my @temp;
|
||||
foreach my $page (@pages) {
|
||||
if ($i <= $end && $i >= $start) {
|
||||
|
|
@ -754,5 +758,24 @@ sub setAlphabeticalKey {
|
|||
return 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setPageNumber ( pageNumber )
|
||||
|
||||
Sets the page number. This is really a convenience method for testing.
|
||||
Returns the page number that was set.
|
||||
|
||||
=head3 pageNumber
|
||||
|
||||
Sets the pageNumber. Setting the pageNumber outside of the set of
|
||||
pages would cause the Paginator to behave poorly.
|
||||
|
||||
=cut
|
||||
|
||||
sub setPageNumber {
|
||||
my $self = shift;
|
||||
$self->{_pn} = shift;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
458
lib/WebGUI/PassiveAnalytics/Flow.pm
Normal file
458
lib/WebGUI/PassiveAnalytics/Flow.pm
Normal file
|
|
@ -0,0 +1,458 @@
|
|||
package WebGUI::PassiveAnalytics::Flow;
|
||||
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Pluggable;
|
||||
use WebGUI::PassiveAnalytics::Rule;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Workflow;
|
||||
use WebGUI::Workflow::Instance;
|
||||
use WebGUI::User;
|
||||
use WebGUI::Text;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::PassiveAnalytics::Flow
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Web interface for making sets of rules for doing passive analytics, and
|
||||
running them.
|
||||
|
||||
=cut
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 analysisActive ( session )
|
||||
|
||||
Returns true if an instance of the PassiveAnalytics workflow is active.
|
||||
|
||||
=cut
|
||||
|
||||
sub analysisActive {
|
||||
my $session = shift;
|
||||
my ($running, $startDate, $endDate, $userId) = $session->db->quickArray(q!select running, startDate, endDate, userId from passiveAnalyticsStatus!);
|
||||
if (wantarray) {
|
||||
return $running, $startDate, $endDate, WebGUI::User->new($session, $userId);
|
||||
}
|
||||
return $running;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 canView ( session [, user] )
|
||||
|
||||
Returns true if the user can administrate this operation. user defaults to
|
||||
the current user.
|
||||
|
||||
=cut
|
||||
|
||||
sub canView {
|
||||
my $session = shift;
|
||||
my $user = shift || $session->user;
|
||||
return $user->isInGroup( 3 );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 exportSomething ( session, sth, filename )
|
||||
|
||||
Generates CSV data from the supplied statement handle and generates
|
||||
a temporary WebGUI::Storage object containing that data in the requested
|
||||
filename.
|
||||
|
||||
This subroutine also does a setRedirect to the URL of the file in
|
||||
the storage object.
|
||||
|
||||
=head3 session
|
||||
|
||||
Session variable, to set the http redirect correctly.
|
||||
|
||||
=head3 sth
|
||||
|
||||
Statement handle for reading data and getting column names
|
||||
|
||||
=head3 filename
|
||||
|
||||
The name of the file to create inside the storage object.
|
||||
|
||||
=cut
|
||||
|
||||
sub exportSomething {
|
||||
my ($session, $sth, $filename) = @_;
|
||||
my $storage = WebGUI::Storage->createTemp($session);
|
||||
my @columns = $sth->getColumnNames;
|
||||
my $csvData = WebGUI::Text::joinCSV( @columns ). "\n";
|
||||
while (my $row = $sth->hashRef()) {
|
||||
my @row = @{ $row }{@columns};
|
||||
$csvData .= WebGUI::Text::joinCSV(@row) . "\n";
|
||||
}
|
||||
$storage->addFileFromScalar($filename, $csvData);
|
||||
$session->http->setRedirect($storage->getUrl($filename));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteRule ( )
|
||||
|
||||
Deletes an activity from a workflow.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_deleteRule {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless canView($session);
|
||||
my $rule = WebGUI::PassiveAnalytics::Rule->new($session, $session->form->get("ruleId"));
|
||||
if (defined $rule) {
|
||||
$rule->delete;
|
||||
}
|
||||
return www_editRuleflow($session);
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------
|
||||
|
||||
=head2 www_demoteRule ( session )
|
||||
|
||||
Moves a Rule down one position in the execution order.
|
||||
|
||||
=head3 session
|
||||
|
||||
A reference to the current session.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_demoteRule {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless canView($session);
|
||||
my $rule = WebGUI::PassiveAnalytics::Rule->new($session, $session->form->get("ruleId"));
|
||||
if (defined $rule) {
|
||||
$rule->demote;
|
||||
}
|
||||
return www_editRuleflow($session);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editRuleflow ( session )
|
||||
|
||||
Configure a set of analyses to run on the passive logs. The analysis is destructive.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editRuleflow {
|
||||
my $session = shift;
|
||||
my $error = shift;
|
||||
return $session->privilege->insufficient() unless canView($session);
|
||||
my ($running, $startDate, $endDate, $user) = analysisActive($session);
|
||||
if ($error) {
|
||||
$error = qq|<div class="error">$error</div>\n|;
|
||||
}
|
||||
elsif (!$running) {
|
||||
$error = qq|<div class="error">Passive Analytics analysis completed on $endDate</div>\n|;
|
||||
}
|
||||
my $i18n = WebGUI::International->new($session, "PassiveAnalytics");
|
||||
my $addmenu = '<div style="float: left; width: 200px; font-size: 11px;">';
|
||||
$addmenu .= sprintf '<a href="%s">%s</a>',
|
||||
$session->url->page('op=passiveAnalytics;func=editRule'),
|
||||
$i18n->get('Add a bucket');
|
||||
$addmenu .= '</div>';
|
||||
my $f = WebGUI::HTMLForm->new($session);
|
||||
$f->hidden(
|
||||
name=>'op',
|
||||
value=>'passiveAnalytics'
|
||||
);
|
||||
$f->hidden(
|
||||
name=>'func',
|
||||
value=>'editRuleflowSave'
|
||||
);
|
||||
$f->integer(
|
||||
name => 'pauseInterval',
|
||||
value => $session->form->get('pauseInterval') || $session->setting->get('passiveAnalyticsInterval') || 300,
|
||||
label => $i18n->get('pause interval'),
|
||||
hoverHelp => $i18n->get('pause interval help'),
|
||||
);
|
||||
if ($running) {
|
||||
$f->raw(sprintf <<EOD, $startDate, $user->username);
|
||||
<tr><td colspan="2">Passive Analytics analysis is currently active. Analysis was begun at %s by %s</td></tr>
|
||||
EOD
|
||||
}
|
||||
else {
|
||||
$f->submit(value => $i18n->get('Begin analysis'));
|
||||
}
|
||||
my $steps = '<table class="content"><tbody>';
|
||||
my $getARule = WebGUI::PassiveAnalytics::Rule->getAllIterator($session);
|
||||
my $icon = $session->icon;
|
||||
while (my $rule = $getARule->()) {
|
||||
my $id = $rule->getId;
|
||||
my $bucket = $rule->get('bucketName');
|
||||
$steps .= '<tr><td>'
|
||||
. $icon->delete( 'op=passiveAnalytics;func=deleteRule;ruleId='.$id, undef, $i18n->get('confirm delete rule'))
|
||||
. $icon->edit( 'op=passiveAnalytics;func=editRule;ruleId='.$id)
|
||||
. $icon->moveDown('op=passiveAnalytics;func=demoteRule;ruleId='.$id)
|
||||
. $icon->moveUp( 'op=passiveAnalytics;func=promoteRule;ruleId='.$id)
|
||||
. '</td><td>'.$bucket.'</td></tr>';
|
||||
|
||||
}
|
||||
$steps .= '<tr><td> </td><td>Other</td></tbody></table><div style="clear: both;"></div>';
|
||||
my $ac = WebGUI::AdminConsole->new($session,'passiveAnalytics');
|
||||
$ac->addSubmenuItem($session->url->page('op=passiveAnalytics;func=settings'), $i18n->get('Passive Analytics Settings'));
|
||||
if (!$running) {
|
||||
$ac->addSubmenuItem($session->url->page('op=passiveAnalytics;func=exportBucketData'), $i18n->get('Export bucket data'));
|
||||
$ac->addSubmenuItem($session->url->page('op=passiveAnalytics;func=exportDeltaData'), $i18n->get('Export delta data'));
|
||||
$ac->addSubmenuItem($session->url->page('op=passiveAnalytics;func=exportLogs'), $i18n->get('Export raw logs'));
|
||||
}
|
||||
return $ac->render($error.$f->print.$addmenu.$steps, 'Passive Analytics');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editRuleflowSave ( )
|
||||
|
||||
Saves the results of www_editRuleflow()
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editRuleflowSave {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless canView($session);
|
||||
return www_editRuleflow($session, 'Passive Analytics is already active. Please do not try to subvert the UI in the future')
|
||||
if analysisActive($session);
|
||||
my $workflow = WebGUI::Workflow->new($session, 'PassiveAnalytics000001');
|
||||
return www_editRuleflow($session, "The Passive Analytics workflow has been deleted. Please contact an Administrator immediately.") unless defined $workflow;
|
||||
my $delta = $session->form->process('pauseInterval','integer');
|
||||
my $activities = $workflow->getActivities();
|
||||
##Note, they're in order, and the order is known.
|
||||
$activities->[0]->set('deltaInterval', $delta);
|
||||
$activities->[1]->set('userId', $session->user->userId);
|
||||
my $instance = WebGUI::Workflow::Instance->create($session, {
|
||||
workflowId => $workflow->getId,
|
||||
priority => 1,
|
||||
});
|
||||
if (!defined $instance) {
|
||||
return www_editRuleflow($session, "A Passive Analytics analysis is currently running.") if $session->stow->get('singletonWorkflowClash');
|
||||
return www_editRuleflow($session, "Error creating the workflow instance.");
|
||||
}
|
||||
$instance->start('skipRealtime');
|
||||
$session->db->write('update passiveAnalyticsStatus set startDate=NOW(), userId=?, endDate=?, running=1', [$session->user->userId, '']);
|
||||
return www_editRuleflow($session);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editRule ( )
|
||||
|
||||
Displays a form to edit the properties rule.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editRule {
|
||||
my ($session, $error) = @_;
|
||||
return $session->privilege->insufficient() unless canView($session);
|
||||
|
||||
if ($error) {
|
||||
$error = qq|<div class="error">$error</div>\n|;
|
||||
}
|
||||
##Make a PassiveAnalytics rule to use to populate the form.
|
||||
my $ruleId = $session->form->get('ruleId');
|
||||
my $rule;
|
||||
if ($ruleId) {
|
||||
$rule = WebGUI::PassiveAnalytics::Rule->new($session, $ruleId);
|
||||
}
|
||||
else {
|
||||
##We need a temporary rule so that we can call dynamicForm, below
|
||||
$ruleId = 'new';
|
||||
$rule = WebGUI::PassiveAnalytics::Rule->create($session, {});
|
||||
}
|
||||
|
||||
##Build the form
|
||||
my $form = WebGUI::HTMLForm->new($session);
|
||||
$form->hidden( name=>"op", value=>"passiveAnalytics");
|
||||
$form->hidden( name=>"func", value=>"editRuleSave");
|
||||
$form->hidden( name=>"ruleId", value=>$ruleId);
|
||||
$form->dynamicForm([WebGUI::PassiveAnalytics::Rule->crud_definition($session)], 'properties', $rule);
|
||||
$form->submit;
|
||||
|
||||
my $i18n = WebGUI::International->new($session, 'PassiveAnalytics');
|
||||
my $ac = WebGUI::AdminConsole->new($session,'passiveAnalytics');
|
||||
$ac->addSubmenuItem($session->url->page("op=passiveAnalytics;func=editRuleflow"), $i18n->get("manage ruleset"));
|
||||
if ($ruleId eq 'new') {
|
||||
$rule->delete;
|
||||
}
|
||||
return $ac->render($error.$form->print,$i18n->get('Edit Rule'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editRuleSave ( )
|
||||
|
||||
Saves the results of www_editRule().
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editRuleSave {
|
||||
my $session = shift;
|
||||
my $form = $session->form;
|
||||
return $session->privilege->insufficient() unless canView($session);
|
||||
my $regexp = $form->get('regexp');
|
||||
eval {
|
||||
'fooBarBaz' =~ qr/$regexp/;
|
||||
};
|
||||
if ($@) {
|
||||
my $error = $@;
|
||||
$error =~ s/at \S+?\.pm line \d+.*$//;
|
||||
my $i18n = WebGUI::International->new($session, 'PassiveAnalytics');
|
||||
$error = join ' ', $i18n->get('Regular Expression Error:'), $error;
|
||||
return www_editRule($session, $error);
|
||||
}
|
||||
my $ruleId = $form->get('ruleId');
|
||||
my $rule;
|
||||
if ($ruleId eq 'new') {
|
||||
$rule = WebGUI::PassiveAnalytics::Rule->create($session, {});
|
||||
}
|
||||
else {
|
||||
$rule = WebGUI::PassiveAnalytics::Rule->new($session, $ruleId);
|
||||
}
|
||||
$rule->updateFromFormPost if $rule;
|
||||
return www_editRuleflow($session);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_exportBucketData ( )
|
||||
|
||||
Dump the contents of the bucket log.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_exportBucketData {
|
||||
my ($session) = @_;
|
||||
my $bucket = $session->db->read('select * from bucketLog order by userId, Bucket, timeStamp');
|
||||
exportSomething($session, $bucket, 'bucketData.csv');
|
||||
return "redirect";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_exportDeltaData ( )
|
||||
|
||||
Dump the contents of the delta log.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_exportDeltaData {
|
||||
my ($session) = @_;
|
||||
my $delta = $session->db->read('select * from deltaLog order by userId, timeStamp');
|
||||
exportSomething($session, $delta, 'deltaData.csv');
|
||||
return "redirect";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_exportLogs ( )
|
||||
|
||||
Dump the contents of the raw log.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_exportLogs {
|
||||
my ($session) = @_;
|
||||
my $raw = $session->db->read('select * from passiveLog order by userId, timeStamp');
|
||||
exportSomething($session, $raw, 'passiveData.csv');
|
||||
return "redirect";
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------
|
||||
|
||||
=head2 www_promoteRule ( session )
|
||||
|
||||
Moves a rule up one position in the execution order.
|
||||
|
||||
=head3 session
|
||||
|
||||
A reference to the current session.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_promoteRule {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless canView($session);
|
||||
my $rule = WebGUI::PassiveAnalytics::Rule->new($session, $session->form->get("ruleId"));
|
||||
if (defined $rule) {
|
||||
$rule->promote;
|
||||
}
|
||||
return www_editRuleflow($session);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_settings ( session )
|
||||
|
||||
Configure Passive Analytics settings.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_settings {
|
||||
my $session = shift;
|
||||
my $error = shift;
|
||||
return $session->privilege->insufficient() unless canView($session);
|
||||
if ($error) {
|
||||
$error = qq|<div class="error">$error</div>\n|;
|
||||
}
|
||||
my $i18n = WebGUI::International->new($session, "PassiveAnalytics");
|
||||
my $f = WebGUI::HTMLForm->new($session);
|
||||
$f->hidden(
|
||||
name=>'op',
|
||||
value=>'passiveAnalytics'
|
||||
);
|
||||
$f->hidden(
|
||||
name=>'func',
|
||||
value=>'settingsSave'
|
||||
);
|
||||
$f->integer(
|
||||
name => 'pauseInterval',
|
||||
value => $session->form->get('pauseInterval') || $session->setting->get('passiveAnalyticsInterval') || 300,
|
||||
label => $i18n->get('default pause interval'),
|
||||
hoverHelp => $i18n->get('default pause interval help'),
|
||||
);
|
||||
$f->yesNo(
|
||||
name => 'deleteDelta',
|
||||
value => $session->form->get('deleteDelta') || $session->setting->get('passiveAnalyticsDeleteDelta') || 0,
|
||||
label => $i18n->get('Delete Delta Table?'),
|
||||
hoverHelp => $i18n->get('Delete Delta Table? help'),
|
||||
);
|
||||
$f->yesNo(
|
||||
name => 'enabled',
|
||||
value => $session->form->get('enabled') || $session->setting->get('passiveAnalyticsEnabled') || 0,
|
||||
label => $i18n->get('Enabled?'),
|
||||
hoverHelp => $i18n->get('Enabled? help'),
|
||||
);
|
||||
$f->submit();
|
||||
my $ac = WebGUI::AdminConsole->new($session,'passiveAnalytics');
|
||||
$ac->addSubmenuItem($session->url->page('op=passiveAnalytics;func=editRuleflow'), $i18n->get('Passive Analytics'));
|
||||
return $ac->render($error.$f->print, 'Passive Analytics Settings');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_settingsSave ( session )
|
||||
|
||||
Save Passive Analytics settings.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_settingsSave {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient() unless canView($session);
|
||||
my $form = $session->form;
|
||||
$session->setting->set('passiveAnalyticsInterval', $form->process('pauseInterval', 'integer'));
|
||||
$session->setting->set('passiveAnalyticsDeleteDelta', $form->process('deleteDelta', 'yesNo' ));
|
||||
$session->setting->set('passiveAnalyticsEnabled', $form->process('enabled', 'yesNo' ));
|
||||
return www_settings($session);
|
||||
}
|
||||
|
||||
1;
|
||||
47
lib/WebGUI/PassiveAnalytics/Logging.pm
Normal file
47
lib/WebGUI/PassiveAnalytics/Logging.pm
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package WebGUI::PassiveAnalytics::Logging;
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::PassiveAnalytics::Logging
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Encapsulate all logging functions in here.
|
||||
|
||||
=cut
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 log ( session, asset )
|
||||
|
||||
Log Passive Analytics data to the db.
|
||||
|
||||
=head3 session
|
||||
|
||||
A session variable.
|
||||
|
||||
=head3 asset
|
||||
|
||||
The asset to log.
|
||||
|
||||
=cut
|
||||
|
||||
sub log {
|
||||
my ($session, $asset) = @_;
|
||||
return unless $session->setting->get('passiveAnalyticsEnabled');
|
||||
my $assetClass = $asset->get('className');
|
||||
$assetClass =~ s/^WebGUI::Asset:://;
|
||||
if ( $assetClass ne 'Snippet'
|
||||
&& substr($assetClass,0,4) ne 'File') {
|
||||
$session->db->write(
|
||||
q|INSERT INTO `passiveLog` (userId, sessionId, assetId, timestamp, url) VALUES (?,?,?,?,?)|,
|
||||
[ $session->user->userId, $session->getId, $asset->getId, time(), $session->request->unparsed_uri,]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
92
lib/WebGUI/PassiveAnalytics/Rule.pm
Normal file
92
lib/WebGUI/PassiveAnalytics/Rule.pm
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
package WebGUI::PassiveAnalytics::Rule;
|
||||
|
||||
use base qw/WebGUI::Crud/;
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::PassiveAnalytics::Rule;
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Base class for rules that are used to analyze the Passive Analytics log.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 crud_definition ( )
|
||||
|
||||
WebGUI::Crud definition for this class.
|
||||
|
||||
=head3 tableName
|
||||
|
||||
analyticRule.
|
||||
|
||||
=head3 tableKey
|
||||
|
||||
ruleId
|
||||
|
||||
=head3 sequenceKey
|
||||
|
||||
None. There is only 1 sequence of rules for a site.
|
||||
|
||||
=head3 properties
|
||||
|
||||
=head4 bucketName
|
||||
|
||||
The name of a bucket to hold results for this rule.
|
||||
|
||||
=head4 rules
|
||||
|
||||
JSON blob with configuration data for the individual rules.
|
||||
|
||||
=cut
|
||||
|
||||
sub crud_definition {
|
||||
my ($class, $session) = @_;
|
||||
my $definition = $class->SUPER::crud_definition($session);
|
||||
$definition->{tableName} = 'analyticRule';
|
||||
$definition->{tableKey} = 'ruleId';
|
||||
$definition->{sequenceKey} = '';
|
||||
my $properties = $definition->{properties};
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
$properties->{bucketName} = {
|
||||
fieldType => 'text',
|
||||
label => $i18n->get('Bucket Name','PassiveAnalytics'),
|
||||
hoverHelp => $i18n->get('Bucket Name help','PassiveAnalytics'),
|
||||
defaultValue => '',
|
||||
};
|
||||
$properties->{regexp} = {
|
||||
fieldType => 'text',
|
||||
label => $i18n->get('regexp','PassiveAnalytics'),
|
||||
hoverHelp => $i18n->get('regexp help','PassiveAnalytics'),
|
||||
defaultValue => '.+',
|
||||
};
|
||||
return $definition;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 matchesBucket ( $logLine )
|
||||
|
||||
Executes the rule to determine if a log file entry matches the rule.
|
||||
|
||||
=head3 $logLine
|
||||
|
||||
A hashref of information from 1 line of the logs.
|
||||
|
||||
=cut
|
||||
|
||||
sub matchesBucket {
|
||||
my ($self, $logLine) = @_;
|
||||
my $regexp = $self->get('regexp');
|
||||
return $logLine->{url} =~ m/$regexp/;
|
||||
}
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
|
|
@ -220,12 +220,13 @@ sub buildHashRef {
|
|||
|
||||
=head2 buildArrayRefOfHashRefs ( sql )
|
||||
|
||||
Builds an array reference of hash references of data
|
||||
from a series of rows. Useful for returning many rows at once.
|
||||
Builds an array reference of hash references of data from a series of rows.
|
||||
Useful for returning many rows at once. Each element of the returned array
|
||||
reference is a hash of column names to column values.
|
||||
|
||||
=head3 sql
|
||||
|
||||
An SQL query. The query must select at least two columns of data, the first being the key for the hash, the second being the value. If the query selects more than two columns, then the last column will be the value and the remaining columns will be joined together by a colon ":" to form a complex key. If the query selects only one column, then the key and the value will be the same.
|
||||
An SQL query.
|
||||
|
||||
=head3 params
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ returns true if the remote address matches a site which is a known indexer or sp
|
|||
sub callerIsSearchSite {
|
||||
|
||||
my $self = shift;
|
||||
my $remoteAddress = $self->get('REMOTE_ADDR');
|
||||
my $remoteAddress = $self->getIp;
|
||||
|
||||
return 1 if $remoteAddress =~ /203\.87\.123\.1../ # Blaiz Enterprise Rawgrunt search
|
||||
|| $remoteAddress =~ /123\.113\.184\.2../ # Unknown Yahoo Robot
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ An address object's unique id.
|
|||
|
||||
sub getAddress {
|
||||
my ($self, $addressId) = @_;
|
||||
my $id = ref $self;
|
||||
my $id = id $self;
|
||||
unless (exists $addressCache{$id}{$addressId}) {
|
||||
$addressCache{$id}{$addressId} = WebGUI::Shop::Address->new($self, $addressId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ sub getAdminConsole {
|
|||
$ac->addSubmenuItem($url->page("shop=ship;method=manage"), $i18n->get("shipping methods"));
|
||||
$ac->addSubmenuItem($url->page("shop=transaction;method=manage"), $i18n->get("transactions"));
|
||||
$ac->addSubmenuItem($url->page("shop=vendor;method=manage"), $i18n->get("vendors"));
|
||||
$ac->addSubmenuItem($url->page("shop=vendor;method=managePayouts"), $i18n->get("vendor payouts"));
|
||||
$ac->addSubmenuItem($url->page("shop=credit;method=manage"), $i18n->get("in shop credit"));
|
||||
return $ac;
|
||||
}
|
||||
|
|
@ -151,6 +152,13 @@ sub www_editSettings {
|
|||
label => $i18n->get('who is a cashier'),
|
||||
hoverHelp => $i18n->get('who is a cashier help'),
|
||||
);
|
||||
$form->float(
|
||||
name => 'shopCartCheckoutMinimum',
|
||||
value => $setting->get('shopCartCheckoutMinimum'),
|
||||
defaultValue=> '0.00',
|
||||
label => $i18n->get('cart checkout minimum'),
|
||||
hoverHelp => $i18n->get('cart checkout minimum help'),
|
||||
);
|
||||
$form->template(
|
||||
name => "shopCartTemplateId",
|
||||
value => $setting->get("shopCartTemplateId"),
|
||||
|
|
@ -202,13 +210,21 @@ sub www_editSettingsSave {
|
|||
my $self = shift;
|
||||
return $self->session->privilege->adminOnly() unless ($self->session->user->isAdmin);
|
||||
my ($setting, $form) = $self->session->quick(qw(setting form));
|
||||
|
||||
# Save shop templates
|
||||
foreach my $template (qw(shopMyPurchasesDetailTemplateId shopMyPurchasesTemplateId
|
||||
shopCartTemplateId shopAddressBookTemplateId shopAddressTemplateId)) {
|
||||
$setting->set($template, $form->get($template, "template"));
|
||||
}
|
||||
|
||||
# Save group settings
|
||||
foreach my $group (qw(groupIdCashier groupIdAdminCommerce)) {
|
||||
$setting->set($group, $form->get($group, "group"));
|
||||
}
|
||||
|
||||
# Save mininmum cart checkout
|
||||
$setting->set( 'shopCartCheckoutMinimum', $form->get( 'shopCartCheckoutMinimum', 'float' ) );
|
||||
|
||||
return $self->www_editSettings();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ Returns a reference to the address book for the user who's cart this is.
|
|||
|
||||
sub getAddressBook {
|
||||
my $self = shift;
|
||||
my $id = ref $self;
|
||||
my $id = id $self;
|
||||
unless (exists $addressBookCache{$id}) {
|
||||
$addressBookCache{$id} = WebGUI::Shop::AddressBook->newBySession($self->session);
|
||||
}
|
||||
|
|
@ -297,7 +297,6 @@ sub getItem {
|
|||
unless (defined $itemId && $itemId =~ m/^[A-Za-z0-9_-]{22}$/) {
|
||||
WebGUI::Error::InvalidParam->throw(error=>"Need an itemId.");
|
||||
}
|
||||
my $id = ref $self;
|
||||
my $item = WebGUI::Shop::CartItem->new($self, $itemId);
|
||||
return $item;
|
||||
}
|
||||
|
|
@ -499,7 +498,7 @@ Returns whether all the required properties of the the cart are set.
|
|||
|
||||
sub readyForCheckout {
|
||||
my $self = shift;
|
||||
|
||||
|
||||
# Check if the shipping address is set and correct
|
||||
my $address = eval{$self->getShippingAddress};
|
||||
return 0 if WebGUI::Error->caught;
|
||||
|
|
@ -514,6 +513,12 @@ sub readyForCheckout {
|
|||
# fail if there are multiple recurring items or if
|
||||
return 0 if ($self->hasMixedItems);
|
||||
|
||||
# Check minimum cart checkout requirement
|
||||
my $requiredAmount = $self->session->setting->get( 'shopCartCheckoutMinimum' );
|
||||
if ( $requiredAmount > 0 ) {
|
||||
return 0 if $self->calculateTotal < $requiredAmount;
|
||||
}
|
||||
|
||||
# All checks passed so return true
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -802,6 +807,10 @@ sub www_view {
|
|||
shipToButton => WebGUI::Form::submit($session, {value=>$i18n->get("ship to button"),
|
||||
extras=>q|onclick="setCallbackForAddressChooser(this.form);"|}),
|
||||
subtotalPrice => $self->formatCurrency($self->calculateSubtotal()),
|
||||
minimumCartAmount => $session->setting->get( 'shopCartCheckoutMinimum' ) > 0
|
||||
? sprintf( '%.2f', $session->setting->get( 'shopCartCheckoutMinimum' ) )
|
||||
: 0
|
||||
,
|
||||
);
|
||||
|
||||
# get the shipping address
|
||||
|
|
@ -847,10 +856,11 @@ sub www_view {
|
|||
# calculate price adjusted for in-store credit
|
||||
$var{totalPrice} = $var{subtotalPrice} + $var{shippingPrice} + $var{tax};
|
||||
my $credit = WebGUI::Shop::Credit->new($session, $posUser->userId);
|
||||
$var{inShopCreditAvailable} = $credit->getSum;
|
||||
$var{inShopCreditDeduction} = $credit->calculateDeduction($var{totalPrice});
|
||||
$var{totalPrice} = $self->formatCurrency($var{totalPrice} + $var{inShopCreditDeduction});
|
||||
|
||||
$var{ inShopCreditAvailable } = $credit->getSum;
|
||||
$var{ inShopCreditDeduction } = $credit->calculateDeduction($var{totalPrice});
|
||||
$var{ totalPrice } = $self->formatCurrency($var{totalPrice} + $var{inShopCreditDeduction});
|
||||
$var{ readyForCheckout } = $self->readyForCheckout;
|
||||
|
||||
# render the cart
|
||||
my $template = WebGUI::Asset::Template->new($session, $session->setting->get("shopCartTemplateId"));
|
||||
return $session->style->userStyle($template->process(\%var));
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ Returns an instanciated WebGUI::Asset::Sku object for this cart item.
|
|||
|
||||
sub getSku {
|
||||
my ($self) = @_;
|
||||
my $id = ref $self;
|
||||
my $asset = '';
|
||||
$asset = WebGUI::Asset->newByDynamicClass($self->cart->session, $self->get("assetId"));
|
||||
$asset->applyOptions($self->get("options"));
|
||||
|
|
|
|||
|
|
@ -267,11 +267,14 @@ sub update {
|
|||
if (exists $newProperties->{item}) {
|
||||
my $item = $newProperties->{ item };
|
||||
my $sku = $item->getSku;
|
||||
$newProperties->{ options } = $sku->getOptions;
|
||||
$newProperties->{ assetId } = $sku->getId;
|
||||
$newProperties->{ price } = $sku->getPrice;
|
||||
$newProperties->{ configuredTitle } = $item->get('configuredTitle');
|
||||
$newProperties->{ quantity } = $item->get('quantity');
|
||||
$newProperties->{ options } = $sku->getOptions;
|
||||
$newProperties->{ assetId } = $sku->getId;
|
||||
$newProperties->{ price } = $sku->getPrice;
|
||||
$newProperties->{ configuredTitle } = $item->get('configuredTitle');
|
||||
$newProperties->{ quantity } = $item->get('quantity');
|
||||
$newProperties->{ vendorId } = $sku->getVendorId;
|
||||
$newProperties->{ vendorPayoutAmount } = sprintf '%.2f', $sku->getVendorPayout * $item->get('quantity');
|
||||
|
||||
my $address = $item->getShippingAddress;
|
||||
$newProperties->{ shippingAddressId } = $address->getId;
|
||||
$newProperties->{ shippingAddressName } = $address->get('name');
|
||||
|
|
@ -289,7 +292,8 @@ sub update {
|
|||
}
|
||||
my @fields = (qw(assetId configuredTitle options shippingAddressId shippingTrackingNumber orderStatus
|
||||
shippingName shippingAddress1 shippingAddress2 shippingAddress3 shippingCity shippingState
|
||||
shippingCountry shippingCode shippingPhoneNumber quantity price vendorId));
|
||||
shippingCountry shippingCode shippingPhoneNumber quantity price vendorId
|
||||
vendorPayoutStatus vendorPayoutAmount));
|
||||
foreach my $field (@fields) {
|
||||
$properties{$id}{$field} = (exists $newProperties->{$field}) ? $newProperties->{$field} : $properties{$id}{$field};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ use Class::InsideOut qw{ :std };
|
|||
use WebGUI::Shop::Admin;
|
||||
use WebGUI::Exception::Shop;
|
||||
use WebGUI::International;
|
||||
|
||||
use WebGUI::Utility qw{ isIn };
|
||||
use List::Util qw{ sum };
|
||||
use JSON qw{ encode_json };
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -117,6 +119,48 @@ sub getId {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getPayoutTotals ( )
|
||||
|
||||
Returns a hash ref, containing the payout details for this vendor. The keys in the hash are:
|
||||
|
||||
=head3 paid
|
||||
|
||||
The amount of money already transfered to the vendor.
|
||||
|
||||
=head3 scheduled
|
||||
|
||||
The amount of money scheduled to be transfered to the vendor.
|
||||
|
||||
=head3 notPaid
|
||||
|
||||
The amount of money that is yet to be scheduled for payment to the vendor.
|
||||
|
||||
=head3 total
|
||||
|
||||
The sum of these three values.
|
||||
|
||||
=cut
|
||||
|
||||
sub getPayoutTotals {
|
||||
my $self = shift;
|
||||
|
||||
my %totals = $self->session->db->buildHash(
|
||||
'select vendorPayoutStatus, sum(vendorPayoutAmount) as amount from transactionItem '
|
||||
.'where vendorId=? group by vendorPayoutStatus ',
|
||||
[ $self->getId ]
|
||||
);
|
||||
|
||||
# Format the payout categories and calc the total those.
|
||||
%totals =
|
||||
map { lcfirst $_ => sprintf '%.2f', $totals{ $_ } }
|
||||
qw( Paid Scheduled NotPaid );
|
||||
$totals{ total } = sprintf '%.2f', sum values %totals;
|
||||
|
||||
return \%totals;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getVendors ( session, options )
|
||||
|
||||
Class method. Returns an array reference of WebGUI::Shop::Vendor objects.
|
||||
|
|
@ -150,6 +194,26 @@ sub getVendors {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isVendorInfoComplete ( )
|
||||
|
||||
Returns a boolean indicating whether the payoutinformation entered by the vendor is complete.
|
||||
|
||||
=cut
|
||||
|
||||
sub isVendorInfoComplete {
|
||||
my $self = shift;
|
||||
|
||||
my $complete =
|
||||
defined $self->get( 'name' )
|
||||
&& defined $self->get( 'userId' )
|
||||
&& defined $self->get( 'preferredPaymentType' )
|
||||
&& defined $self->get( 'paymentInformation' );
|
||||
|
||||
return $complete
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 new ( session, vendorId )
|
||||
|
||||
Constructor. Returns a WebGUI::Shop::Vendor object.
|
||||
|
|
@ -405,5 +469,215 @@ sub www_manage {
|
|||
return $console->render($output, $i18n->get("vendors"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_managePayouts ( )
|
||||
|
||||
Displays the payout manager.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_managePayouts {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
||||
my $admin = WebGUI::Shop::Admin->new($session);
|
||||
return $session->privilege->adminOnly() unless ($admin->canManage);
|
||||
|
||||
# Load the required YUI stuff.
|
||||
$session->style->setLink('/extras/yui/build/paginator/assets/skins/sam/paginator.css', {type=>'text/css', rel=>'stylesheet'});
|
||||
$session->style->setLink('/extras/yui/build/datatable/assets/skins/sam/datatable.css', {type=>'text/css', rel=>'stylesheet'});
|
||||
$session->style->setLink('/extras/yui/build/button/assets/skins/sam/button.css', {type=>'text/css', rel=>'stylesheet'});
|
||||
$session->style->setScript('/extras/yui/build/yahoo-dom-event/yahoo-dom-event.js', {type=>'text/javascript'});
|
||||
$session->style->setScript('/extras/yui/build/element/element-beta-min.js', {type=>'text/javascript'});
|
||||
$session->style->setScript('/extras/yui/build/connection/connection-min.js', {type=>'text/javascript'});
|
||||
$session->style->setScript('/extras/yui/build/json/json-min.js', {type=>'text/javascript'});
|
||||
$session->style->setScript('/extras/yui/build/paginator/paginator-min.js', {type=>'text/javascript'});
|
||||
$session->style->setScript('/extras/yui/build/datasource/datasource.js', {type=>'text/javascript'});
|
||||
$session->style->setScript('/extras/yui/build/datatable/datatable-min.js', {type=>'text/javascript'});
|
||||
$session->style->setScript('/extras/yui/build/button/button-min.js', {type=>'text/javascript'});
|
||||
$session->style->setScript('/extras/VendorPayout/vendorPayout.js', {type=>'text/javascript'});
|
||||
|
||||
# Add css for scheduled payout highlighting
|
||||
$session->style->setRawHeadTags(<<CSS);
|
||||
<style type="text/css">
|
||||
.yui-skin-sam .yui-dt tr.scheduled,
|
||||
.yui-skin-sam .yui-dt tr.scheduled td.yui-dt-asc,
|
||||
.yui-skin-sam .yui-dt tr.scheduled td.yui-dt-desc,
|
||||
.yui-skin-sam .yui-dt tr.scheduled td.yui-dt-asc,
|
||||
.yui-skin-sam .yui-dt tr.scheduled td.yui-dt-desc {
|
||||
background-color : #080;
|
||||
color : #fff;
|
||||
}
|
||||
</style>
|
||||
CSS
|
||||
|
||||
my $output = q{<div id="vendorPayoutContainer" class="yui-skin-sam"></div>}
|
||||
.q{<script type="text/javascript">var vp = new WebGUI.VendorPayout( 'vendorPayoutContainer' );</script>};
|
||||
|
||||
my $console = WebGUI::Shop::Admin->new($session)->getAdminConsole;
|
||||
return $console->render($output, 'Vendor payout'); #$i18n->get("vendors"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_payoutDataAsJSON ( )
|
||||
|
||||
Returns a JSON string containing paginated payout data for a specific vendor.
|
||||
The following form params should be passed:
|
||||
|
||||
=head3 vendorId
|
||||
|
||||
The vendorId of the vendor you want the payout data for.
|
||||
|
||||
=head3 results
|
||||
|
||||
The number of results to be returned. Defaults to 100.
|
||||
|
||||
=head3 startIndex
|
||||
|
||||
The index of the record at which the payout data should start.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_payoutDataAsJSON {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
||||
my $admin = WebGUI::Shop::Admin->new($session);
|
||||
return $session->privilege->adminOnly() unless ($admin->canManage);
|
||||
|
||||
my $vendorId = $session->form->process('vendorId');
|
||||
my $startIndex = $session->form->process('startIndex');
|
||||
my $rowsPerPage = $session->form->process('results') || 100;
|
||||
my $pageNumber = int( $startIndex / $rowsPerPage ) + 1;
|
||||
|
||||
my $sql =
|
||||
"select t1.* from transactionItem as t1 join transaction as t2 on t1.transactionId=t2.transactionId "
|
||||
." where vendorId=? and vendorPayoutAmount > 0 and vendorPayoutStatus <> 'Paid' order by t2.orderNumber";
|
||||
my $placeholders = [ $vendorId ];
|
||||
|
||||
my $paginator = WebGUI::Paginator->new( $session, '', $rowsPerPage, '', $pageNumber );
|
||||
$paginator->setDataByQuery( $sql, undef, 0, $placeholders );
|
||||
|
||||
my $data = {
|
||||
totalRecords => $paginator->getRowCount,
|
||||
results => $paginator->getPageData,
|
||||
};
|
||||
|
||||
$session->http->setMimeType( 'application/json' );
|
||||
|
||||
return JSON::to_json( $data );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_setPayoutStatus ( )
|
||||
|
||||
Sets the vendorPayoutStatus flag for each transaction passed by the form param 'itemId'. The new status is passed
|
||||
by the form param 'status'. Status can either be 'NotPaid' or 'Scheduled' and may only be applied on items that do
|
||||
not have their vendorPayoutStatus set to 'Paid'.
|
||||
|
||||
Returns the status to which the item(s) are set.
|
||||
=cut
|
||||
|
||||
sub www_setPayoutStatus {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
||||
my $admin = WebGUI::Shop::Admin->new($session);
|
||||
return $session->privilege->adminOnly() unless ($admin->canManage);
|
||||
|
||||
my @itemIds = $session->form->process('itemId');
|
||||
my $status = $session->form->process('status');
|
||||
return "error: wrong status [$status]" unless isIn( $status, qw{ NotPaid Scheduled } );
|
||||
|
||||
foreach my $itemId (@itemIds) {
|
||||
my $item = WebGUI::Shop::TransactionItem->newByDynamicTransaction( $session, $itemId );
|
||||
return "error: invalid transactionItemId [$itemId]" unless $item;
|
||||
return "error: cannot change status of a Paid item" if $item->get('vendorPayoutStatus') eq 'Paid';
|
||||
|
||||
$item->update({ vendorPayoutStatus => $status });
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_submitScheduledPayouts ()
|
||||
|
||||
Sets the vendorPayoutStatus flag of scheduled payments to 'Paid'.
|
||||
|
||||
NOTE: This method does no payments at all. In the future this method should trigger some automated payout
|
||||
mechanism.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_submitScheduledPayouts {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
||||
my $admin = WebGUI::Shop::Admin->new($session);
|
||||
return $session->privilege->adminOnly() unless ($admin->canManage);
|
||||
|
||||
$session->db->write(
|
||||
q{ update transactionItem set vendorPayoutStatus = 'Paid' where vendorPayoutStatus = 'Scheduled' }
|
||||
);
|
||||
|
||||
return $class->www_managePayouts( $session );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_vendorTotalsAsJSON ( )
|
||||
|
||||
Returns a JSON string containing all vendors and their payout details. The following
|
||||
form parameters can be passed:
|
||||
|
||||
=head3 vendorId
|
||||
|
||||
If passed, the results will include only the totals of this vendor.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_vendorTotalsAsJSON {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
||||
my $admin = WebGUI::Shop::Admin->new($session);
|
||||
return $session->privilege->adminOnly() unless ($admin->canManage);
|
||||
|
||||
my $vendorId = $session->form->process('vendorId');
|
||||
my ($vendorPayoutData, @placeholders);
|
||||
|
||||
my @sql;
|
||||
push @sql,
|
||||
'select vendorId, vendorPayoutStatus, sum(vendorPayoutAmount) as total from transactionItem';
|
||||
push @sql, ' where vendorId=? ' if $vendorId;
|
||||
push @sql, ' group by vendorId, vendorPayoutStatus ';
|
||||
|
||||
push @placeholders, $vendorId if $vendorId;
|
||||
|
||||
my $sth = $session->db->read( join( ' ', @sql) , \@placeholders );
|
||||
while (my $row = $sth->hashRef) {
|
||||
$vendorPayoutData->{ $row->{vendorId} }->{ $row->{vendorPayoutStatus} } = $row->{total};
|
||||
}
|
||||
$sth->finish;
|
||||
|
||||
my @dataset;
|
||||
foreach my $vendorId (keys %{ $vendorPayoutData }) {
|
||||
my $vendor = WebGUI::Shop::Vendor->new( $session, $vendorId );
|
||||
|
||||
push @dataset, {
|
||||
%{ $vendor->get },
|
||||
%{ $vendorPayoutData->{ $vendorId } },
|
||||
}
|
||||
}
|
||||
|
||||
$session->http->setMimeType( 'application/json' );
|
||||
return JSON::to_json( { vendors => \@dataset } );
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ sub acceptsPrivateMessages {
|
|||
my $userId = shift;
|
||||
|
||||
return 0 if ($self->isVisitor); #Visitor can't get private messages
|
||||
return 0 if ($userId eq "1"); # Visitor can't send private messages
|
||||
return 0 if ($self->userId eq $userId); #Can't send private messages to yourself
|
||||
|
||||
my $pmSetting = $self->profileField('allowPrivateMessages');
|
||||
|
|
|
|||
153
lib/WebGUI/Workflow/Activity/BucketPassiveAnalytics.pm
Normal file
153
lib/WebGUI/Workflow/Activity/BucketPassiveAnalytics.pm
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
package WebGUI::Workflow::Activity::BucketPassiveAnalytics;
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Workflow::Activity';
|
||||
use WebGUI::PassiveAnalytics::Rule;
|
||||
use WebGUI::Inbox;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Workflow::Activity::BucketPassiveAnalytics
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Run through a set of rules to figure out how to classify log file entries.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See WebGUI::Workflow::Activity for details on how to use any activity.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, definition )
|
||||
|
||||
See WebGUI::Workflow::Activity::defintion() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session, "PassiveAnalytics");
|
||||
push( @{$definition}, {
|
||||
name=>$i18n->get("Bucket Passive Analytics"),
|
||||
properties=> {
|
||||
notifyUser => {
|
||||
fieldType => 'user',
|
||||
label => $i18n->get('User'),
|
||||
hoverHelp => $i18n->get('User help'),
|
||||
defaultValue => $session->user->userId,
|
||||
},
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($session,$definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 execute ( [ object ] )
|
||||
|
||||
Analyze the deltaLog table, and generate the bucketLog table.
|
||||
|
||||
=head3 notes
|
||||
|
||||
=cut
|
||||
|
||||
sub execute {
|
||||
my ($self, undef, $instance) = @_;
|
||||
my $session = $self->session;
|
||||
my $endTime = time() + $self->getTTL;
|
||||
my $expired = 0;
|
||||
|
||||
##Load all the rules into an array
|
||||
my @rules = ();
|
||||
my $getARule = WebGUI::PassiveAnalytics::Rule->getAllIterator($session);
|
||||
while (my $rule = $getARule->()) {
|
||||
my $regexp = $rule->get('regexp');
|
||||
push @rules, [ $rule->get('bucketName'), qr/$regexp/];
|
||||
}
|
||||
|
||||
##Get the index stored from the last invocation of the Activity. If this is
|
||||
##the first run, then clear out the table.
|
||||
my $logIndex = $instance->getScratch('lastPassiveLogIndex') || 0;
|
||||
if ($logIndex == 0) {
|
||||
$session->db->write('delete from bucketLog');
|
||||
}
|
||||
my %bucketCache = ();
|
||||
|
||||
##Configure all the SQL
|
||||
my $deltaSql = <<"EOSQL1";
|
||||
select userId, assetId, url, delta, from_unixtime(timeStamp) as stamp
|
||||
from deltaLog order by timestamp limit $logIndex, 1234567890
|
||||
EOSQL1
|
||||
my $deltaSth = $session->db->read($deltaSql);
|
||||
my $bucketSth = $session->db->prepare('insert into bucketLog (userId, Bucket, duration, timeStamp) VALUES (?,?,?,?)');
|
||||
|
||||
##Walk through the log file entries, one by one. Run each entry against
|
||||
##all the rules until 1 matches. If it doesn't match any rule, then bin it
|
||||
##into the "Other" bucket.
|
||||
DELTA_ENTRY: while (my $entry = $deltaSth->hashRef()) {
|
||||
++$logIndex;
|
||||
my $bucketFound = 0;
|
||||
my $url = $entry->{url};
|
||||
if (exists $bucketCache{$url}) {
|
||||
$bucketSth->execute([$entry->{userId}, $bucketCache{$url}, $entry->{delta}, $entry->{stamp}]);
|
||||
}
|
||||
else {
|
||||
RULE: foreach my $rule (@rules) {
|
||||
next RULE unless $url =~ $rule->[1];
|
||||
|
||||
# Into the bucket she goes..
|
||||
$bucketCache{$url} = $rule->[0];
|
||||
$bucketSth->execute([$entry->{userId}, $rule->[0], $entry->{delta}, $entry->{stamp}]);
|
||||
$bucketFound = 1;
|
||||
last RULE;
|
||||
}
|
||||
if (!$bucketFound) {
|
||||
$bucketCache{$url} = 'Other';
|
||||
$bucketSth->execute([$entry->{userId}, 'Other', $entry->{delta}, $entry->{stamp}]);
|
||||
}
|
||||
}
|
||||
if (time() > $endTime) {
|
||||
$expired = 1;
|
||||
last DELTA_ENTRY;
|
||||
}
|
||||
}
|
||||
|
||||
if ($expired) {
|
||||
$instance->setScratch('logIndex', $logIndex);
|
||||
return $self->WAITING(1);
|
||||
}
|
||||
my $message = 'Passive analytics is done.';
|
||||
if ($session->setting->get('passiveAnalyticsDeleteDelta')) {
|
||||
$session->log->info('Clearing Passive Analytics delta log');
|
||||
$session->db->write('delete from deltaLog');
|
||||
$message .= ' The delta log has been cleaned up.';
|
||||
}
|
||||
##If userId was set to 0, do not send any emails.
|
||||
if ($self->get('userId')) {
|
||||
my $inbox = WebGUI::Inbox->new($self->session);
|
||||
$inbox->addMessage({
|
||||
status => 'unread',
|
||||
subject => 'Passive analytics is done',
|
||||
userId => $self->get('userId'),
|
||||
message => $message,
|
||||
});
|
||||
}
|
||||
$session->db->write('update passiveAnalyticsStatus set endDate=NOW(), running=0');
|
||||
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
#vim:ft=perl
|
||||
152
lib/WebGUI/Workflow/Activity/ExpireIncompleteSurveyResponses.pm
Normal file
152
lib/WebGUI/Workflow/Activity/ExpireIncompleteSurveyResponses.pm
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
package WebGUI::Workflow::Activity::ExpireIncompleteSurveyResponses;
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2008 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
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Workflow::Activity';
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::DateTime;
|
||||
use DateTime::Duration;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Workflow::Activity::ExpireIncompleteSurveyResponses
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This activity deletes the survey responses for which the allowed time has expired and emails the survey user.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See WebGUI::Workflow::Activity for details on how to use any activity.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, definition )
|
||||
|
||||
See WebGUI::Workflow::Activity::defintion() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session, "Workflow_Activity_ExpireIncompleteSurveyResponses");
|
||||
push(@{$definition}, {
|
||||
name => $i18n->get("name"),
|
||||
properties => {
|
||||
deleteExpired=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get("Delete expired survey responses"),
|
||||
hoverHelp=>$i18n->get("delete expired")
|
||||
},
|
||||
emailUsers=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get("Email users that responses were deleted"),
|
||||
hoverHelp=>$i18n->get("email users")
|
||||
},
|
||||
emailTemplateId => {
|
||||
fieldType => "template",
|
||||
defaultValue => 'ExpireIncResptmpl00001',
|
||||
namespace => "ExpireIncompleteSurveyResponses",
|
||||
label => $i18n->get('Email template sent to user'),
|
||||
hoverHelp => $i18n->get('email template'),
|
||||
},
|
||||
from => {
|
||||
fieldType=>"text",
|
||||
label=>$i18n->get("from"),
|
||||
defaultValue=>$session->setting->get("companyEmail"),
|
||||
hoverHelp=>$i18n->get("from mouse over"),
|
||||
},
|
||||
subject => {
|
||||
fieldType=>"text",
|
||||
label=>$i18n->get("subject"),
|
||||
defaultValue=>"Expired Survey",
|
||||
hoverHelp=>$i18n->get("subject mouse over"),
|
||||
},
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($session,$definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 execute ( [ object ] )
|
||||
|
||||
Finds all the expired Survey Responses on the system. If delete is selected, they are removed. Then if
|
||||
email is selected, the users are emailed the template.
|
||||
|
||||
=cut
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
my $sql = "select r.Survey_responseId, r.username, r.userId, upd.email,upd.firstName,upd.lastName, r.startDate, s.timeLimit, ad.title, ad.url
|
||||
from Survey s, Survey_response r, assetData ad, userProfileData upd
|
||||
where r.isComplete = 0 and s.timeLimit > 0 and (unix_timestamp() - r.startDate) > (s.timeLimit * 60)
|
||||
and r.assetId = s.assetId and s.revisionDate = (select max(revisionDate) from Survey where assetId = s.assetId)
|
||||
and ad.assetId = s.assetId and ad.revisionDate = s.revisionDate and upd.userId = r.userId";
|
||||
my $refs = $self->session->db->buildArrayRefOfHashRefs($sql);
|
||||
for my $ref (@{$refs}) {
|
||||
if($self->get("deleteExpired") == 1){
|
||||
$self->session->db->write("delete from Survey_response where Survey_responseId = ?",[$ref->{Survey_responseId}]);
|
||||
}else{#else sent to expired but not deleted
|
||||
$self->session->db->write("update Survey_response set isComplete = 99 where Survey_responseId = ?",[$ref->{Survey_responseId}]);
|
||||
}
|
||||
if($self->get("emailUsers") == 1 && $ref->{email} =~ /\@/){
|
||||
|
||||
my $var = {
|
||||
to => $ref->{email},
|
||||
from => $self->get("from"),
|
||||
firstName => $ref->{firstName},
|
||||
lastName => $ref->{lastName},
|
||||
surveyTitle => $ref->{title},
|
||||
surveyUrl => $ref->{url},
|
||||
responseId => $ref->{Survey_responseId},
|
||||
deleted => $self->get("deleteExpired"),
|
||||
companyName => $self->session->setting->get("companyName"),
|
||||
};
|
||||
my $template = WebGUI::Asset->newByDynamicClass($self->session,$self->get('emailTemplateId'));
|
||||
my $message = $template->processTemplate($var, $self->get("emailTemplateId"));
|
||||
WebGUI::Macro::process($self->session,\$message);
|
||||
my $mail = WebGUI::Mail::Send->create($self->session,{
|
||||
to => $ref->{email},
|
||||
subject => $self->get("subject"),
|
||||
from => $self->get('from'),
|
||||
});
|
||||
$mail->addHtml($message);
|
||||
$mail->addFooter;
|
||||
$mail->queue;
|
||||
}
|
||||
}
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -342,8 +342,10 @@ sub setMessageCompleted {
|
|||
|
||||
# Set all messages to completed
|
||||
for my $messageId ( split /,/, $instance->getScratch("messageId") ) {
|
||||
my $message = $inbox->getMessage( $messageId );
|
||||
$message->setCompleted;
|
||||
if($messageId){
|
||||
my $message = $inbox->getMessage( $messageId );
|
||||
$message->setCompleted if $message;
|
||||
}
|
||||
}
|
||||
|
||||
$instance->deleteScratch( "messageId" );
|
||||
|
|
|
|||
148
lib/WebGUI/Workflow/Activity/SummarizePassiveAnalytics.pm
Normal file
148
lib/WebGUI/Workflow/Activity/SummarizePassiveAnalytics.pm
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
package WebGUI::Workflow::Activity::SummarizePassiveAnalytics;
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Workflow::Activity';
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Workflow::Activity::SummarizePassiveAnalytics
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Summarize how long a user stayed on a page, using a user supplied interval.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See WebGUI::Workflow::Activity for details on how to use any activity.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, definition )
|
||||
|
||||
See WebGUI::Workflow::Activity::defintion() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session, 'PassiveAnalytics');
|
||||
push(@{$definition}, {
|
||||
name=>$i18n->get('Summarize Passive Analytics'),
|
||||
properties=> {
|
||||
deltaInterval => {
|
||||
fieldType => 'interval',
|
||||
label => $i18n->get('pause interval'),
|
||||
defaultValue => 15,
|
||||
hoverHelp => $i18n->get('pause interval help'),
|
||||
},
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($session,$definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 execute ( [ object ] )
|
||||
|
||||
Analyze the passiveLog table, and generate the deltaLog table.
|
||||
|
||||
=head3 notes
|
||||
|
||||
If there is only 1 line in the table for a particular sessionId or
|
||||
userId, no conclusions as to how long the user viewed a page can be
|
||||
drawn from that. Similarly, the last entry in their browsing log
|
||||
yields no data, since we require another entry in the passiveLog to
|
||||
determine a delta.
|
||||
|
||||
=cut
|
||||
|
||||
sub execute {
|
||||
my ($self, undef, $instance) = @_;
|
||||
my $session = $self->session;
|
||||
my $endTime = time() + $self->getTTL;
|
||||
my $deltaInterval = $self->get('deltaInterval');
|
||||
|
||||
my $passive = q{select * from passiveLog where userId <> '1' order by userId, sessionId, timeStamp};
|
||||
my $sth;
|
||||
my $lastUserId;
|
||||
my $lastSessionId;
|
||||
my $lastTimeStamp;
|
||||
my $lastAssetId;
|
||||
my $lastUrl;
|
||||
my $counter = $instance->getScratch('counter');
|
||||
if ($counter) {
|
||||
$passive .= ' limit '. $counter .', 1234567890';
|
||||
$sth = $session->db->read($passive);
|
||||
$lastUserId = $instance->getScratch('lastUserId');
|
||||
$lastSessionId = $instance->getScratch('lastSessionId');
|
||||
$lastTimeStamp = $instance->getScratch('lastTimeStamp');
|
||||
$lastAssetId = $instance->getScratch('lastAssetId');
|
||||
$lastUrl = $instance->getScratch('lastUrl');
|
||||
}
|
||||
else {
|
||||
$sth = $session->db->read($passive);
|
||||
my $logLine = $sth->hashRef();
|
||||
$lastUserId = $logLine->{userId};
|
||||
$lastSessionId = $logLine->{sessionId};
|
||||
$lastTimeStamp = $logLine->{timeStamp};
|
||||
$lastAssetId = $logLine->{assetId};
|
||||
$lastUrl = $logLine->{url};
|
||||
}
|
||||
|
||||
$session->db->write('delete from deltaLog'); ##Only if we're starting out
|
||||
my $deltaLog = $session->db->prepare('insert into deltaLog (userId, assetId, delta, timeStamp, url) VALUES (?,?,?,?,?)');
|
||||
|
||||
my $expired = 0;
|
||||
LOG_ENTRY: while (my $logLine = $sth->hashRef()) {
|
||||
$counter++;
|
||||
my $delta = $logLine->{timeStamp} - $lastTimeStamp;
|
||||
if ( $logLine->{userId} eq $lastUserId
|
||||
&& $logLine->{sessionId} eq $lastSessionId
|
||||
&& $delta < $deltaInterval ) {
|
||||
$deltaLog->execute([$lastUserId, $lastAssetId, $delta, $lastTimeStamp, $lastUrl]);
|
||||
}
|
||||
$lastUserId = $logLine->{userId};
|
||||
$lastSessionId = $logLine->{sessionId};
|
||||
$lastTimeStamp = $logLine->{timeStamp};
|
||||
$lastAssetId = $logLine->{assetId};
|
||||
$lastUrl = $logLine->{url};
|
||||
if (time() > $endTime) {
|
||||
$instance->setScratch('lastUserId', $lastUserId);
|
||||
$instance->setScratch('lastSessionId', $lastSessionId);
|
||||
$instance->setScratch('lastTimeStamp', $lastTimeStamp);
|
||||
$instance->setScratch('lastAssetId', $lastAssetId);
|
||||
$instance->setScratch('lastUrl', $lastUrl);
|
||||
$instance->setScratch('counter', $counter);
|
||||
$expired = 1;
|
||||
last LOG_ENTRY;
|
||||
}
|
||||
}
|
||||
|
||||
if ($expired) {
|
||||
return $self->WAITING(1);
|
||||
}
|
||||
|
||||
$instance->deleteScratch('lastUserId');
|
||||
$instance->deleteScratch('lastSessionId');
|
||||
$instance->deleteScratch('lastTimeStamp');
|
||||
$instance->deleteScratch('lastAssetId');
|
||||
$instance->deleteScratch('lastUrl');
|
||||
$instance->deleteScratch('counter');
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
@ -49,6 +49,11 @@ our $I18N = {
|
|||
lastUpdated => 1230867169,
|
||||
},
|
||||
|
||||
'my sales label' => {
|
||||
message => q{Sales},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -1190,6 +1190,12 @@ Couldn't open %-s because %-s <br />
|
|||
context => q{Asset Manager label, as in "locked by admin"},
|
||||
},
|
||||
|
||||
'assetHistory' => {
|
||||
message => q{Asset History},
|
||||
lastUpdated => 0,
|
||||
context => q{Admin Console label. Shows the history of assets in this site.},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -231,6 +231,36 @@ our $I18N = {
|
|||
context => q|add the described item to the shopping cart|
|
||||
},
|
||||
|
||||
'form purchase ad title' => {
|
||||
message => q|Ad Title|,
|
||||
lastUpdated => 0,
|
||||
context => q|the title chosen by the buyer for the advertisement|
|
||||
},
|
||||
|
||||
'form purchase ad link' => {
|
||||
message => q|Ad Link|,
|
||||
lastUpdated => 0,
|
||||
context => q|the link the advertisement leads to|
|
||||
},
|
||||
|
||||
'form purchase ad image' => {
|
||||
message => q|Image|,
|
||||
lastUpdated => 0,
|
||||
context => q|the image to be displayed in the ad|
|
||||
},
|
||||
|
||||
'form purchase number of clicks' => {
|
||||
message => q|Number of Clicks|,
|
||||
lastUpdated => 0,
|
||||
context => q|the number of clicks the buyer wishes to purchase|
|
||||
},
|
||||
|
||||
'form purchase number of impressions' => {
|
||||
message => q|Number of Impressions|,
|
||||
lastUpdated => 0,
|
||||
context => q|the number of impressions the user wishes to purchase|
|
||||
},
|
||||
|
||||
'TODO' => {
|
||||
message => q|TODO|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -372,6 +372,11 @@ listing,|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'group to add description' => {
|
||||
message => q|Select the group that is allowed to add listings to this matrix.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'ratings duration description' => {
|
||||
message => q|Select the interval after which old ratings are cleaned out.|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -418,8 +423,8 @@ listing,|,
|
|||
},
|
||||
|
||||
'max comparisons privileged description' => {
|
||||
message => q|Specifies how many comparisons are allowed in searches and comparisons for users in the privileged group.|,
|
||||
lastUpdated => 0,
|
||||
message => q|Specifies how many comparisons are allowed in searches and comparisons for users who have accounts on the site.|,
|
||||
lastUpdated => 1235681965,
|
||||
},
|
||||
|
||||
'rating timeout description' => {
|
||||
|
|
@ -476,6 +481,16 @@ listing,|,
|
|||
message => q|Select a template to be used to show the listing edit screen.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'screenshots template description' => {
|
||||
message => q|Select a template to be used to show a listing's screenshots.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'screenshots config template description' => {
|
||||
message => q|Select a template for a listing's screenshots configuration.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'categories label' => {
|
||||
message => q|Categories|,
|
||||
|
|
@ -487,6 +502,11 @@ listing,|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'group to add label' => {
|
||||
message => q|Group To Add|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'ratings duration label' => {
|
||||
message => q|Ratings Duration|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -548,8 +568,8 @@ listing,|,
|
|||
},
|
||||
|
||||
'max comparisons privileged label' => {
|
||||
message => q|Maximum Comparisons (For Privileged Users)|,
|
||||
lastUpdated => 0,
|
||||
message => q|Maximum Comparisons (For Registered Users)|,
|
||||
lastUpdated => 1235681967,
|
||||
},
|
||||
|
||||
'rating timeout' => {
|
||||
|
|
@ -602,6 +622,16 @@ listing,|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'screenshots template label' => {
|
||||
message => q|Listing Screenshots Template|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'screenshots config template label' => {
|
||||
message => q|Listing Screenshots Config Template|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'edit listing template label' => {
|
||||
message => q|Edit Listing Template|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -750,6 +780,12 @@ selectBox.</p>|
|
|||
message => q|Hide/show stickied|,
|
||||
},
|
||||
|
||||
'approve or deny label' => {
|
||||
lastUpdated => 0,
|
||||
message => q|Approve/Deny|,
|
||||
context => q|Label for the approve or deny link on the matrix listing detail screen.|,
|
||||
},
|
||||
|
||||
'matrix asset template variables title' => {
|
||||
lastUpdated => 0,
|
||||
message => q|Matrix Asset Template Variables|,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ fields below.|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'edit label' => {
|
||||
message => q|Edit|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'version description' => {
|
||||
message => q|Enter the version/edition/model number for the product.|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -221,6 +226,30 @@ it would be best to make sure the names are the same.|,
|
|||
context => q|Description of the form tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'canEdit' => {
|
||||
message => q|A boolean indicating whether the user can edit this listing.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Description of the screenshots tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'editUrl' => {
|
||||
message => q|The url to this listing's edit screen.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Description of the screenshots tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'canApprove' => {
|
||||
message => q|A boolean indicating whether the user can approve or deny this listing.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Description of the screenshots tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'approveOrDenyUrl' => {
|
||||
message => q|The url to this listing's approve or deny screen.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Description of the screenshots tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'screenshots' => {
|
||||
message => q|This listings screenshots displayed using the ukplayer.|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -487,8 +487,8 @@ editing an existing Post, and a thread containing the Post exists.|,
|
|||
},
|
||||
|
||||
'userDefined3' => {
|
||||
message => q|The value contained in the first user defined variable.|,
|
||||
lastUpdated => 1150167057,
|
||||
message => q|The value contained in the third user defined variable.|,
|
||||
lastUpdated => 1236354498,
|
||||
},
|
||||
|
||||
'userDefined4' => {
|
||||
|
|
|
|||
|
|
@ -161,12 +161,14 @@ our $I18N = { ##hashref of hashes
|
|||
|
||||
'no results' => {
|
||||
message => q|No results were found.|,
|
||||
context => q|An internationalized label for telling the user that no results were found.|,
|
||||
lastUpdated => 1170549113,
|
||||
},
|
||||
|
||||
'no_results' => {
|
||||
message => q|An internationalized label for telling the user that no results were found.|,
|
||||
lastUpdated => 1170549119,
|
||||
context => q|Template variable in the view method.|,
|
||||
lastUpdated => 1236101532,
|
||||
},
|
||||
|
||||
};
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue