Merge branch 'master' into survey
* master: (127 commits) Prefill in the email address in the ITransact credentials form from the user's Shop address. fixed Matrix best/worst rated lists Fix bad form variable for phone number in EMS Badge address info. - Added a switch to allow the use of non-WebGUI objects with the Workflow fixing a problem with previous survey fix fixed #9671: Survey - breaks admin bar fixed a Matrix sql problem i18n the image labels and title for the asset manager, manage screen. Prevent an imported package from changing the a current asset's status from pending to anything else. Remove trailing comma in Shop/Transaction JS so IE6 works. fixed documentation fixed a bug when a matrix listing didn't have a forum attached small char encoding fix to merged upgrade fix small issue in addChild adding merge point Fix a problem with purging an EMS. Update this template so that it passes the template i18n test. Fix a broken i18n label in answer edit template for the Survey. Unify all Survey CSS into 1 file, and use it. Adding/fixing Survey i18n and Help ... Conflicts: lib/WebGUI/Asset/Wobject/Survey.pm lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm lib/WebGUI/i18n/English/Asset_Survey.pm www/extras/wobject/Survey/editsurvey/object.js
This commit is contained in:
commit
b0c5c09461
127 changed files with 5481 additions and 677 deletions
|
|
@ -1,6 +1,61 @@
|
|||
7.6.11
|
||||
- Added a switch to allow the use of non-WebGUI objects with the Workflow
|
||||
engine.
|
||||
- fixed #9579: initialize keyword field because get fills it in now due to a recent code change
|
||||
- fixed #9596: caching now takes into account the correct parameter for pagination
|
||||
- fixed #9596: Articles now use a semi-unique pagination variable based on asset id
|
||||
- fixed: Syndicated Content asset doesn't work with feeds that specify their encodings via HTTP headers
|
||||
- fixed #9375: Syndicated Content asset improperly decodes wide XML entities
|
||||
- fixed #9592: DataForm deleteAttachedFiles method can crash
|
||||
- fixed #9580: Gallery: albums shown in navigation
|
||||
- fixed #9578: Use of "quotes" in badge name causes error
|
||||
- fixed #9603: moving wiki page
|
||||
- fixed #9302: Spectre Problem...
|
||||
- fixed #9635: Matrix - Add attributes not working
|
||||
- fixed #9597: Survey 2.0 Help not complete
|
||||
- fixed: Many child assets, including WikiPage, Post and Event, will no longer let you add or paste them in places where they do not belong.
|
||||
- fixed: Hardcoded extras url in templates and in extra head tags in assets were replaced with the Extras macro.
|
||||
- fixed: Fixed bad gateway macros in the Matrix templates.
|
||||
- fixed #9535: Bad characters in dom element ids when generated from assetId
|
||||
- fixed #9542: Default WebGUI config contains invalid workflow activity
|
||||
- fixed #9623: preload.custom paths not included during upgrade
|
||||
- fixed #9638: Survey - Submit of survey creates new demo
|
||||
- fixed #9669: Folder: synopsis var of a subfolder broken
|
||||
- fixed #9658: gallery advanced search dates do not work
|
||||
- fixed #8965: Dashboard update profile url wrong
|
||||
- fixed #9050: Safari Hover Help Hosed (and funny survey hover help in Firefox)
|
||||
- fixed #9675: gallary search list displays wrong date for pictures
|
||||
- fixed: Added survey.css as a snippet. Had been left out.
|
||||
- fixed: Permissions aren't correctly applied to Article attachments
|
||||
- fixed #9681: Form-related template errors in gallery
|
||||
- fixed #9683: Problem with EMS related workflow
|
||||
- fixed #9611: Transaction Manage View, no go in ie6 (Henry Tang, Long Term Results B.v.)
|
||||
- fixed #9686: Importing a package twice locks assets forever.
|
||||
- fixed #9671: Survey - breaks admin bar
|
||||
- fixed #9702: Phone number on EMS badges not saving
|
||||
- fixed: Email address is not filled in for ITransact credentials.
|
||||
|
||||
7.6.10
|
||||
- fixed #9577: WebGUI::Form::Url::getValue returns blank rather than undef for blank fields
|
||||
- added test for splitTag function recently added to HTML module
|
||||
- fixed #9455: fixed synopsis to pick out html paragraphs, fixed FeedPP fields to scalar when blank
|
||||
- fixed: With autocommit and no comments on, making a shortcut of an asset takes you to that asset's view.
|
||||
- fixed #9506: Choose billing address
|
||||
- fixed #9541: assets with uncommitted parent.
|
||||
- reverted #9386: Gallery: "Image resolutions" issue. This is a feature of the Galley.
|
||||
- fixed #9236: Survey 2.0 missing hoverhelp
|
||||
- added: Widget Macro now uses a style, defaulting to the users.
|
||||
- added ability to select which rich editor is used to compose messages in the inbox
|
||||
- removed random questions display from Survey Questions Edit template until
|
||||
that feature is added.
|
||||
- fixed #9115: WebGUI::ProfileField->formField doesn't always show the submitted value
|
||||
- fixed: utf8 issues with Survey should be correct. JSON fields are now longText instead of longBlob.
|
||||
- fixed #9522: Time tracker does not display
|
||||
- fixed #9215: Survey 2.0 results screens missing
|
||||
- fixed #9018: orphan workflows from upgrade.
|
||||
|
||||
7.6.9
|
||||
- fixed: ukplayer example is now loaded with swfobject.js released under the
|
||||
MIT licence, see gotcha's and /extras/ukplayer
|
||||
- fixed: ukplayer example is now loaded with swfobject.js released under the MIT licence, see gotcha's and /extras/ukplayer
|
||||
- fixed #9264: new slideShow.swf uploaded in extras/ukplayer (United Knowledge/Arjan Widlak)
|
||||
- fixed #9428: added code to ASSET::get to include keywords when no property name is requested
|
||||
- marked sbin scripts as executable
|
||||
|
|
@ -10,8 +65,10 @@
|
|||
- fixed a bug where no Payment Gateway labels show up when checking out.
|
||||
- fixed #9511: Subcategories displayed incorrectly (Henry Tang, Long Term Results B.v.)
|
||||
- fixed #4137: Calendar Search page has head tags in body
|
||||
- reverted #9386: Gallery: "Image resolutions" issue. This is a feature of the Galley.
|
||||
- fixed: HTTP Proxy doesn't serve new content to visitors
|
||||
- fixed: Exporting to static files can leak large amounts of memory
|
||||
- fixed: Paginator generates bad markup for next page links
|
||||
|
||||
7.6.8
|
||||
- added #!/usr/bin/env perl to all utility scripts
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7,6 +7,11 @@ 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.6.10
|
||||
--------------------------------------------------------------------
|
||||
* The Survey JSON fields (Survey.surveyJSON and Survey_response.responseJSON)
|
||||
will alter to longText from LongBlob's.
|
||||
|
||||
7.6.9
|
||||
--------------------------------------------------------------------
|
||||
* The ukplayer example, slideshow.html in /extras/ukplayer, used
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
BIN
docs/upgrades/packages-7.5.40-7.6.10/merged.wgpkg
Normal file
BIN
docs/upgrades/packages-7.5.40-7.6.10/merged.wgpkg
Normal file
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.6.10/root_import_matrix.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.10/root_import_matrix.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.
BIN
docs/upgrades/packages-7.6.11/matrix-default-view-template.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.11/matrix-default-view-template.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.11/matrix-search-template.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.11/matrix-search-template.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.11/root_import_account.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.11/root_import_account.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.
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.6.11/survey.css.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.11/survey.css.wgpkg
Normal file
Binary file not shown.
|
|
@ -23,6 +23,7 @@ use WebGUI::Session;
|
|||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::Sku::Product;
|
||||
use WebGUI::Utility qw(isIn);
|
||||
|
||||
|
||||
my $toVersion = '7.6.0';
|
||||
|
|
|
|||
1874
docs/upgrades/upgrade_7.5.40-7.6.10.pl
Normal file
1874
docs/upgrades/upgrade_7.5.40-7.6.10.pl
Normal file
File diff suppressed because it is too large
Load diff
198
docs/upgrades/upgrade_7.6.10-7.6.11.pl
Normal file
198
docs/upgrades/upgrade_7.6.10-7.6.11.pl
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "../..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::Wobject::GalleryAlbum;
|
||||
|
||||
|
||||
my $toVersion = '7.6.11';
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
hideGalleryAlbums($session);
|
||||
removeBrokenWorkflowInstances($session);
|
||||
undotBinaryExtensions($session);
|
||||
removeProcessRecurringPaymentsFromConfig($session);
|
||||
noSessionSwitch($session);
|
||||
|
||||
fixDottedAssetIds($session); ##This one should run last
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub noSessionSwitch {
|
||||
my $session = shift;
|
||||
print "\tAdding noSession switch to Workflow Instances..." unless $quiet;
|
||||
$session->db->write("alter table WorkflowInstance add column noSession boolean not null default 0");
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub removeProcessRecurringPaymentsFromConfig {
|
||||
my $session = shift;
|
||||
print "\tRemoving old ProcessRecurringPayments workflow activity from config..." unless $quiet;
|
||||
|
||||
$session->config->deleteFromArray('workflowActivities/None',
|
||||
'WebGUI::Workflow::Activity::ProcessRecurringPayments');
|
||||
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub hideGalleryAlbums {
|
||||
my $session = shift;
|
||||
print "\tHiding all Gallery Albums from Navigation... " unless $quiet;
|
||||
# and here's our code
|
||||
my $getAnAlbum = WebGUI::Asset::Wobject::GalleryAlbum->getIsa($session);
|
||||
while (my $album = $getAnAlbum->()) {
|
||||
$album->update({}); ##The album will do the hiding automatically now
|
||||
}
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub undotBinaryExtensions {
|
||||
my $session = shift;
|
||||
print "\tRemoving dots from list of exportBinaryExtensions... " unless $quiet;
|
||||
# and here's our code
|
||||
my $extensions = $session->config->get('exportBinaryExtensions');
|
||||
my @newExtensions = map { s/\.//; $_ } @{ $extensions };
|
||||
$session->config->set('exportBinaryExtensions', \@newExtensions);
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub fixDottedAssetIds {
|
||||
my $session = shift;
|
||||
print "\tRemoving dots from Asset IDs... " unless $quiet;
|
||||
my @assetIds = $session->db->buildArray("select distinct(assetId) from asset where assetId like '%.%'");
|
||||
my %assetIds = map { my $id = $_; $id =~ tr/./-/; $_ => $id } @assetIds;
|
||||
# and here's our code
|
||||
while (my ($fromId, $toId) = each %assetIds) {
|
||||
$session->db->write('UPDATE `assetData` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
|
||||
$session->db->write('UPDATE `asset` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
|
||||
$session->db->write('UPDATE `assetIndex` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
|
||||
$session->db->write('UPDATE `wobject` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
|
||||
$session->db->write('UPDATE `Folder` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
|
||||
$session->db->write('UPDATE `Navigation` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
|
||||
$session->db->write('UPDATE `FileAsset` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
|
||||
$session->db->write('UPDATE `ImageAsset` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
|
||||
$session->db->write('UPDATE `snippet` SET `assetId`=? WHERE `assetId`=?', [$toId, $fromId]);
|
||||
|
||||
$session->db->write('UPDATE `asset` SET `parentId`=? WHERE `parentId`=?', [$toId, $fromId]);
|
||||
}
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub removeBrokenWorkflowInstances {
|
||||
my $session = shift;
|
||||
print "\tRemove Workflow Instances whose Workflows have been deleted... " unless $quiet;
|
||||
# and here's our code
|
||||
my $instances = WebGUI::Workflow::Instance->getAllInstances($session);
|
||||
foreach my $instance (@{ $instances }) {
|
||||
my $workflow = $instance->getWorkflow;
|
||||
$instance->delete('skipNotify') if !defined $workflow;
|
||||
}
|
||||
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
|
||||
|
|
@ -27,6 +27,7 @@ use WebGUI::Asset::Wobject::Survey;
|
|||
use WebGUI::Asset::Wobject::Survey::SurveyJSON;
|
||||
use WebGUI::Asset::Wobject::Survey::ResponseJSON;
|
||||
use WebGUI::ProfileField;
|
||||
use WebGUI::Utility qw(isIn);
|
||||
use JSON;
|
||||
|
||||
my $toVersion = '7.6.4';
|
||||
|
|
|
|||
146
docs/upgrades/upgrade_7.6.9-7.6.10.pl
Normal file
146
docs/upgrades/upgrade_7.6.9-7.6.10.pl
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
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.10';
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
addRichEditorInboxSetting( $session );
|
||||
alterSurveyJSONFields($session);
|
||||
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
#Change the Survey and Survey_response tables' json fields to longText instead of longBlob to get back non-binary text
|
||||
#----------------------------------------------------------------------------
|
||||
sub alterSurveyJSONFields{
|
||||
my $session = shift;
|
||||
$session->db->write("alter table Survey modify surveyJSON longText");
|
||||
$session->db->write("alter table Survey_response modify responseJSON longText");
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# 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;
|
||||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add ability to select which rich editor for messages between users
|
||||
sub addRichEditorInboxSetting {
|
||||
my $session = shift;
|
||||
print "\tAdding rich editor selection to Inbox... " unless $quiet;
|
||||
|
||||
$session->setting->add("inboxRichEditId","PBrichedit000000000001");
|
||||
|
||||
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
|
||||
|
|
@ -533,7 +533,6 @@
|
|||
"category" : "utilities"
|
||||
},
|
||||
"WebGUI::Asset::Sku::Product" : {
|
||||
"isContainer" : 1,
|
||||
"category" : "shop"
|
||||
},
|
||||
"WebGUI::Asset::Wobject::WeatherData" : {
|
||||
|
|
@ -803,7 +802,6 @@
|
|||
"WebGUI::Workflow::Activity::ExpireSubscriptionCodes",
|
||||
"WebGUI::Workflow::Activity::GetSyndicatedContent",
|
||||
"WebGUI::Workflow::Activity::NotifyAdminsWithOpenVersionTags",
|
||||
"WebGUI::Workflow::Activity::ProcessRecurringPayments",
|
||||
"WebGUI::Workflow::Activity::PurgeOldAssetRevisions",
|
||||
"WebGUI::Workflow::Activity::PurgeOldTrash",
|
||||
"WebGUI::Workflow::Activity::SendQueuedMailMessages",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package WebGUI;
|
||||
|
||||
|
||||
our $VERSION = '7.6.9';
|
||||
our $VERSION = '7.6.11';
|
||||
our $STATUS = "beta";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -539,6 +539,7 @@ sub www_view {
|
|||
next if($displayView && !$friend->profileField('ableToBeFriend'));
|
||||
|
||||
my $hash = {};
|
||||
# TODO Move this into a sub that can be more easily overridden
|
||||
$hash->{'friend_full_name' } = $friend->getWholeName;
|
||||
$hash->{'isViewable' } = $friend->profileIsViewable;
|
||||
$hash->{'friend_id' } = $friend->userId;
|
||||
|
|
|
|||
|
|
@ -217,6 +217,12 @@ sub editSettingsForm {
|
|||
label => $i18n->get("invite user confirm template label"),
|
||||
hoverHelp => $i18n->get("invite user confirm template hoverHelp")
|
||||
);
|
||||
$f->selectRichEditor(
|
||||
name => "inboxRichEditorId",
|
||||
value => $self->getRichEditorId,
|
||||
label => $i18n->get("inbox rich editor label"),
|
||||
hoverHelp => $i18n->get("inbox rich editor description"),
|
||||
);
|
||||
|
||||
return $f->printRowsOnly;
|
||||
}
|
||||
|
|
@ -257,6 +263,7 @@ sub editSettingsFormSave {
|
|||
$setting->set("inboxInviteUserTemplateId",$form->process("inboxInviteUserTemplateId","template"));
|
||||
$setting->set("inboxInviteUserConfirmTemplateId",$form->process("inboxInviteUserConfirmTemplateId","template"));
|
||||
|
||||
$setting->set("inboxRichEditorId", $form->process("inboxRichEditorId", "selectRichEditor") );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -382,6 +389,18 @@ sub getMessageConfirmTemplateId {
|
|||
return $self->session->setting->get("inboxMessageConfirmationTemplateId") || "DUoxlTBXhVS-Zl3CFDpt9g";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getRichEditorId
|
||||
|
||||
This method returns the rich editor ID users compose messages with.
|
||||
|
||||
=cut
|
||||
|
||||
sub getRichEditorId {
|
||||
my $self = shift;
|
||||
return $self->session->setting->get("inboxRichEditorId") || "PBrichedit000000000001";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -668,6 +687,7 @@ sub www_inviteUser {
|
|||
name => "message",
|
||||
value => $message,
|
||||
width => "600",
|
||||
richEditId => $self->getRichEditorId,
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
|
@ -1037,6 +1057,7 @@ sub www_sendMessage {
|
|||
name => "message",
|
||||
value => $var->{'message_body'} || "",
|
||||
width => "600",
|
||||
richEditId => $self->getRichEditorId,
|
||||
});
|
||||
|
||||
$var->{'form_header' } = WebGUI::Form::formHeader($session,{
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ sub editSettingsForm {
|
|||
name => "userAccountLayoutTemplateId",
|
||||
value => $self->getLayoutTemplateId,
|
||||
namespace => "Account/Layout",
|
||||
label => $i18n->get("layout template label"),
|
||||
hoverHelp => $i18n->get("layout template hoverHelp")
|
||||
label => $i18n->get("user layout template label"),
|
||||
hoverHelp => $i18n->get("user layout template hoverHelp")
|
||||
);
|
||||
$f->raw(q{<tr><td class="formDescription" colspan="2"> </td></tr>});
|
||||
$f->readOnly (
|
||||
|
|
|
|||
|
|
@ -182,7 +182,8 @@ sub assetExists {
|
|||
|
||||
=head2 canAdd ( session, [userId, groupId] )
|
||||
|
||||
Verifies that the user has the privileges necessary to add this type of asset. Return a boolean.
|
||||
Verifies that the user has the privileges necessary to add this type of asset and that the requested asset
|
||||
can be added as a child of this asset. Return a boolean.
|
||||
|
||||
A class method.
|
||||
|
||||
|
|
@ -224,7 +225,8 @@ sub canAdd {
|
|||
my $subclassGroupId = shift;
|
||||
my $addPrivsGroup = $session->config->get("assets/".$className."/addGroup");
|
||||
my $groupId = $addPrivsGroup || $subclassGroupId || '12';
|
||||
return $user->isInGroup($groupId);
|
||||
my $validParent = $className->validParent($session);
|
||||
return $user->isInGroup($groupId) && $validParent;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1857,7 +1859,7 @@ sub newPending {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 outputWidgetMarkup ( width, height, templateId )
|
||||
=head2 outputWidgetMarkup ( width, height, templateId, [styleTemplateId] )
|
||||
|
||||
Output the markup required for the widget view. Includes markup to handle the
|
||||
widget macro in the iframe holding the widgetized asset. This does the following:
|
||||
|
|
@ -1909,12 +1911,20 @@ widget-in-widget function properly.
|
|||
|
||||
=cut
|
||||
|
||||
=head3 styleTemplateId
|
||||
|
||||
The style templateId for this widgetized asset to use. Not required for making
|
||||
widget-in-widget function properly.
|
||||
|
||||
=cut
|
||||
|
||||
sub outputWidgetMarkup {
|
||||
# get our parameters.
|
||||
my $self = shift;
|
||||
my $width = shift;
|
||||
my $height = shift;
|
||||
my $templateId = shift;
|
||||
my $self = shift;
|
||||
my $width = shift;
|
||||
my $height = shift;
|
||||
my $templateId = shift;
|
||||
my $styleTemplateId = shift;
|
||||
|
||||
# construct / retrieve the values we'll use later.
|
||||
my $assetId = $self->getId;
|
||||
|
|
@ -1938,6 +1948,11 @@ sub outputWidgetMarkup {
|
|||
# we'll be serializing the content of the asset which is being widgetized.
|
||||
my $storage = WebGUI::Storage->get($session, $assetId);
|
||||
my $content = $self->view;
|
||||
if($styleTemplateId eq '' or $styleTemplateId eq 'none'){
|
||||
$content = $self->session->style->userStyle($content);
|
||||
}else{
|
||||
$content = $self->session->style->process($content,$styleTemplateId);
|
||||
}
|
||||
WebGUI::Macro::process($session, \$content);
|
||||
my $jsonContent = to_json( { "asset$assetId" => { content => $content } } );
|
||||
$storage->addFileFromScalar("$assetId.js", "data = $jsonContent");
|
||||
|
|
@ -2418,6 +2433,22 @@ sub urlExists {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 validParent ( )
|
||||
|
||||
Make sure that the current session asset is a valid parent for the child and return true or false.
|
||||
For example, a WikiPage would check for a WikiMaster. It should be overridden by those children
|
||||
that need to perform that kind of check.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=cut
|
||||
|
||||
sub validParent {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 view ( )
|
||||
|
|
@ -2721,9 +2752,10 @@ sub www_widgetView {
|
|||
|
||||
return $session->privilege->noAccess() unless $self->canView;
|
||||
|
||||
my $templateId = $session->form->process('templateId');
|
||||
my $width = $session->form->process('width');
|
||||
my $height = $session->form->process('height');
|
||||
my $templateId = $session->form->process('templateId');
|
||||
my $width = $session->form->process('width');
|
||||
my $height = $session->form->process('height');
|
||||
my $styleTemplateId = $session->form->process('styleTemplateId');
|
||||
|
||||
if($templateId eq 'none') {
|
||||
$self->prepareView;
|
||||
|
|
@ -2731,7 +2763,7 @@ sub www_widgetView {
|
|||
else {
|
||||
$self->prepareWidgetView($templateId);
|
||||
}
|
||||
return $self->outputWidgetMarkup($width, $height, $templateId);
|
||||
return $self->outputWidgetMarkup($width, $height, $templateId, $styleTemplateId);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -1855,6 +1855,22 @@ sub update {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 validParent
|
||||
|
||||
Make sure that the current session asset is a Calendar for pasting and adding checks.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=cut
|
||||
|
||||
sub validParent {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
return $session->asset->isa('WebGUI::Asset::Wobject::Calendar');
|
||||
}
|
||||
|
||||
####################################################################
|
||||
|
||||
=head2 view
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ sub definition {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = __PACKAGE__->i18n($session);
|
||||
my $i18n = WebGUI::International->new($session,'Asset_Photo');
|
||||
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
views => {
|
||||
|
|
@ -508,23 +508,6 @@ sub getTemplateVars {
|
|||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 i18n ( session )
|
||||
|
||||
Get the i18n object for this class. This sub must not be inherited, so always
|
||||
call it using C<__PACKAGE__>, not C<$self>.
|
||||
|
||||
=cut
|
||||
|
||||
sub i18n {
|
||||
my $self = shift;
|
||||
my $session = shift;
|
||||
# TODO: Make a migration script to move the appropriate parts from
|
||||
# Asset_Photo to Asset_GalleryFile
|
||||
return WebGUI::International->new( $session, "Asset_Photo" );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 isFriendsOnly ( )
|
||||
|
|
@ -610,7 +593,7 @@ sub processCommentEditForm {
|
|||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $now = WebGUI::DateTime->new( $session, time );
|
||||
my $i18n = __PACKAGE__->i18n( $session );
|
||||
my $i18n = WebGUI::International->new( $session,'Asset_Photo' );
|
||||
|
||||
# Using die here to suppress line number and file path info
|
||||
die $i18n->get("commentForm error no commentId") . "\n"
|
||||
|
|
@ -649,7 +632,7 @@ sub processCommentEditForm {
|
|||
|
||||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session,'Asset_Photo' );
|
||||
my $form = $self->session->form;
|
||||
my $errors = $self->SUPER::processPropertiesFromFormPost || [];
|
||||
|
||||
|
|
@ -794,6 +777,7 @@ sub view {
|
|||
# Keywords
|
||||
my $k = WebGUI::Keyword->new( $session );
|
||||
my $keywords = $k->getKeywordsForAsset( { asArrayRef => 1, asset => $self } );
|
||||
$var->{keywords} = [ ];
|
||||
for my $keyword ( @{ $keywords } ) {
|
||||
push @{ $var->{keywords} }, {
|
||||
keyword => $keyword,
|
||||
|
|
@ -871,7 +855,7 @@ sub www_deleteComment {
|
|||
|
||||
return $session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $i18n = __PACKAGE__->i18n( $session );
|
||||
my $i18n = WebGUI::International->new( $session,'Asset_Photo' );
|
||||
my $commentId = $session->form->get('commentId');
|
||||
|
||||
$self->deleteComment( $commentId );
|
||||
|
|
@ -893,7 +877,7 @@ sub www_deleteConfirm {
|
|||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session,'Asset_Photo' );
|
||||
|
||||
$self->purge;
|
||||
|
||||
|
|
@ -965,7 +949,7 @@ Save a comment being edited
|
|||
sub www_editCommentSave {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = __PACKAGE__->i18n( $session );
|
||||
my $i18n = WebGUI::International->new( $session,'Asset_Photo' );
|
||||
|
||||
# Process the form first, so we can know how to check permissions
|
||||
my $comment = eval { $self->processCommentEditForm };
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ use Image::ExifTool qw( :Public );
|
|||
use JSON qw/ to_json from_json /;
|
||||
use URI::Escape;
|
||||
use Tie::IxHash;
|
||||
use List::MoreUtils;
|
||||
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Friends;
|
||||
|
|
@ -71,7 +70,7 @@ sub definition {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = __PACKAGE__->i18n($session);
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_Photo');
|
||||
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
exifData => {
|
||||
|
|
@ -318,27 +317,6 @@ sub getThumbnailUrl {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 i18n ( [ session ] )
|
||||
|
||||
Get a WebGUI::International object for this class.
|
||||
|
||||
Can be called as a class method, in which case a WebGUI::Session object
|
||||
must be passed in.
|
||||
|
||||
NOTE: This method can NOT be inherited, due to a current limitation
|
||||
in the i18n system. You must ALWAYS call this with C<__PACKAGE__>
|
||||
|
||||
=cut
|
||||
|
||||
sub i18n {
|
||||
my $self = shift;
|
||||
my $session = shift;
|
||||
|
||||
return WebGUI::International->new($session, "Asset_Photo");
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 makeResolutions ( [resolutions] )
|
||||
|
||||
Create the specified resolutions for this Photo. If resolutions is not
|
||||
|
|
@ -361,19 +339,14 @@ sub makeResolutions {
|
|||
my $storage = $self->getStorageLocation;
|
||||
$self->session->errorHandler->info(" Making resolutions for '" . $self->get("filename") . q{'});
|
||||
|
||||
my $filename = $self->get('filename');
|
||||
RESOLUTION: for my $res ( @$resolutions ) {
|
||||
for my $res ( @$resolutions ) {
|
||||
# carp if resolution is bad
|
||||
if ( $res !~ /^\d+$/ && $res !~ /^\d*x\d*/ ) {
|
||||
carp "Geometry '$res' is invalid. Skipping.";
|
||||
next RESOLUTION;
|
||||
next;
|
||||
}
|
||||
##Only resize images if the image is too big!
|
||||
my ($imageX, $imageY) = $storage->getSizeInPixels($filename);
|
||||
my @resolutions = split /x/, $res;
|
||||
next RESOLUTION if List::MoreUtils::any { $imageX < $_ && $imageY < $_ } @resolutions;
|
||||
my $newFilename = $res . ".jpg";
|
||||
$storage->copyFile( $filename, $newFilename );
|
||||
$storage->copyFile( $self->get("filename"), $newFilename );
|
||||
$storage->resize( $newFilename, $res, undef, $self->getGallery->get( 'imageDensity' ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -623,7 +596,7 @@ Provides links to view the photo and add more photos.
|
|||
|
||||
sub www_showConfirmation {
|
||||
my $self = shift;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session, 'Asset_Photo' );
|
||||
|
||||
return $self->processStyle(
|
||||
sprintf( $i18n->get('save message'),
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use WebGUI::HTMLForm;
|
|||
use WebGUI::Form::DynamicField;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Inbox;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Mail::Send;
|
||||
use WebGUI::Operation;
|
||||
use WebGUI::Paginator;
|
||||
|
|
@ -548,11 +549,19 @@ sub getSynopsisAndContent {
|
|||
my $synopsis = shift;
|
||||
my $body = shift;
|
||||
unless ($synopsis) {
|
||||
$body =~ s/\n/\^\-\;/ unless ($body =~ m/\^\-\;/);
|
||||
my @content = split(/\^\-\;/,$body);
|
||||
$synopsis = WebGUI::HTML::filter($content[0],"all");
|
||||
my @content;
|
||||
if( $body =~ /\^\-\;/ ) {
|
||||
@content = split(/\^\-\;/, $body ,2);
|
||||
}
|
||||
elsif( $body =~ /<p>/ ) {
|
||||
@content = WebGUI::HTML::splitTag($body);
|
||||
}
|
||||
else {
|
||||
@content = split("\n",$body);
|
||||
}
|
||||
shift @content if $content[0] =~ /^\s*$/;
|
||||
$synopsis = WebGUI::HTML::filter($content[0],"all");
|
||||
}
|
||||
$body =~ s/\^\-\;/\n/;
|
||||
return ($synopsis,$body);
|
||||
}
|
||||
|
||||
|
|
@ -843,6 +852,7 @@ sub notifySubscribers {
|
|||
$var->{unsubscribeUrl} = $siteurl.$subscriptionAsset->getUnsubscribeUrl;
|
||||
$var->{unsubscribeLinkText} = $i18n->get("unsubscribe","Asset_Collaboration");
|
||||
my $message = $self->processTemplate($var, $cs->get("notificationTemplateId"));
|
||||
WebGUI::Macro::process($self->session, \$message);
|
||||
my $groupId = $subscriptionAsset->get('subscriptionGroupId');
|
||||
my $mail = WebGUI::Mail::Send->create($self->session, {
|
||||
from=>"<".$from.">",
|
||||
|
|
|
|||
|
|
@ -868,6 +868,22 @@ sub updateThreadRating {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 validParent
|
||||
|
||||
Make sure that the current session asset is a CS for pasting and adding checks.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=cut
|
||||
|
||||
sub validParent {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
return $session->asset->isa('WebGUI::Asset::Wobject::Collaboration');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ use WebGUI::Asset::RSSFromParent;
|
|||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
|
@ -58,6 +63,11 @@ sub definition {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 update
|
||||
|
||||
=cut
|
||||
|
||||
sub update {
|
||||
# Re-force isHidden to 1 on each update; these should always be hidden.
|
||||
my $self = shift;
|
||||
|
|
@ -66,6 +76,11 @@ sub update {
|
|||
}
|
||||
|
||||
#------------------------------------------------
|
||||
|
||||
=head2 _escapeXml
|
||||
|
||||
=cut
|
||||
|
||||
sub _escapeXml {
|
||||
my $text = shift;
|
||||
return $text unless (ref $text eq "");
|
||||
|
|
@ -73,6 +88,11 @@ sub _escapeXml {
|
|||
}
|
||||
|
||||
#------------------------------------------------
|
||||
|
||||
=head2 _tlsOfAsset
|
||||
|
||||
=cut
|
||||
|
||||
sub _tlsOfAsset {
|
||||
my $self = shift;
|
||||
my $asset = shift;
|
||||
|
|
@ -86,12 +106,27 @@ sub _tlsOfAsset {
|
|||
}
|
||||
|
||||
#------------------------------------------------
|
||||
|
||||
=head2 {
|
||||
|
||||
=cut
|
||||
|
||||
sub isValidRssItem { 0 }
|
||||
|
||||
#------------------------------------------------
|
||||
|
||||
=head2 displayInFolder2
|
||||
|
||||
=cut
|
||||
|
||||
sub displayInFolder2 { 0 }
|
||||
|
||||
#------------------------------------------------
|
||||
|
||||
=head2 www_view
|
||||
|
||||
=cut
|
||||
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
return '' unless $self->session->asset->getId eq $self->getId;
|
||||
|
|
|
|||
|
|
@ -804,8 +804,9 @@ sub www_getUserPrefsForm {
|
|||
}
|
||||
$f->submit({extras=>'className="nothing"'});
|
||||
$f->raw('</table>');
|
||||
my $tags = join "", values %{ $self->session->style->{_javascript} };
|
||||
my $tags = $self->session->style->generateAdditionalHeadTags();
|
||||
$output .= $tags.$f->print;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -855,7 +856,7 @@ sub www_saveUserPrefs {
|
|||
}
|
||||
$u->profileField($field->getId,$data{$field->getId});
|
||||
}
|
||||
return $self->www_view;
|
||||
return $self->getParent->www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -463,10 +463,10 @@ sub www_addToCart {
|
|||
foreach my $field (qw(name address1 address2 address3 city state organization)) {
|
||||
$badgeInfo{$field} = $form->get($field, "text");
|
||||
}
|
||||
$badgeInfo{'phoneNumber'} = $form->get('phoneNumber', 'phone');
|
||||
$badgeInfo{'email'} = $form->get('email', 'email');
|
||||
$badgeInfo{'country'} = $form->get('country', 'country');
|
||||
$badgeInfo{'zipcode'} = $form->get('zipcode', 'zipcode');
|
||||
$badgeInfo{'phoneNumber'} = $form->get('phone', 'phone');
|
||||
$badgeInfo{'email'} = $form->get('email', 'email');
|
||||
$badgeInfo{'country'} = $form->get('country', 'country');
|
||||
$badgeInfo{'zipcode'} = $form->get('zipcode', 'zipcode');
|
||||
|
||||
|
||||
# check for required fields
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ use HTML::Template::Expr;
|
|||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _rewriteVars
|
||||
|
||||
=cut
|
||||
|
||||
sub _rewriteVars { # replace dots with underscrores in keys (except in keys that aren't usable as variables (URLs etc.))
|
||||
my $vars = shift;
|
||||
my $newVars = {};
|
||||
|
|
|
|||
|
|
@ -51,18 +51,24 @@ sub addRevision {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub canAdd {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
$class->next::method($session, undef, '7');
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
return $class->next::method($session, undef, '7');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
return (($form->process("func") eq "add" || ($form->process("assetId") eq "new" && $form->process("func") eq "editSave" && $form->process("class","className") eq "WebGUI::Asset::WikiPage")) && $self->getWiki->canEditPages) # account for new pages
|
||||
|| (!$self->isProtected && $self->getWiki->canEditPages) # account for normal editing
|
||||
|| $self->getWiki->canAdminister; # account for admins
|
||||
my $wiki = $self->getWiki;
|
||||
return undef unless defined $wiki;
|
||||
|
||||
my $form = $self->session->form;
|
||||
my $addNew = $form->process("func" ) eq "add";
|
||||
my $editSave = $form->process("assetId" ) eq "new"
|
||||
&& $form->process("func" ) eq "editSave"
|
||||
&& $form->process("class","className" ) eq "WebGUI::Asset::WikiPage";
|
||||
return $wiki->canAdminister
|
||||
|| ( $wiki->canEditPages && ( $addNew || $editSave || !$self->isProtected) );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -313,6 +319,22 @@ sub update {
|
|||
return $self->next::method($properties);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 validParent
|
||||
|
||||
Make sure that the current session asset is a WikiMaster for pasting and adding checks.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=cut
|
||||
|
||||
sub validParent {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
return $session->asset->isa('WebGUI::Asset::Wobject::WikiMaster');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
|
|
|
|||
|
|
@ -234,6 +234,23 @@ sub processPropertiesFromFormPost {
|
|||
$self->setSize($size);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub update {
|
||||
my $self = shift;
|
||||
my $previousStorageId = $self->get('storageId');
|
||||
$self->SUPER::update(@_);
|
||||
##update may have entered a new storageId. Reset the cached one just in case.
|
||||
if ($self->get("storageId") ne $previousStorageId) {
|
||||
delete $self->{_storageLocation};
|
||||
}
|
||||
$self->getStorageLocation->setPrivileges(
|
||||
$self->get("ownerUserId"),
|
||||
$self->get("groupIdView"),
|
||||
$self->get("groupIdEdit"),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub purge {
|
||||
|
|
@ -280,7 +297,8 @@ returns the output.
|
|||
|
||||
sub view {
|
||||
my $self = shift;
|
||||
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10 && !$self->session->form->process("overrideTemplateId") && !$self->session->form->process("pn") && !$self->session->form->process("makePrintable")) {
|
||||
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10 && !$self->session->form->process("overrideTemplateId") &&
|
||||
!$self->session->form->process($self->paginateVar) && !$self->session->form->process("makePrintable")) {
|
||||
my $out = WebGUI::Cache->new($self->session,"view_".$self->getId)->get;
|
||||
return $out if $out;
|
||||
}
|
||||
|
|
@ -332,7 +350,7 @@ sub view {
|
|||
$var{"description.first.2sentences"} =~ s/^((.*?\.){2}).*/$1/s;
|
||||
$var{"description.first.sentence"} = $var{"description.first.2sentences"};
|
||||
$var{"description.first.sentence"} =~ s/^(.*?\.).*/$1/s;
|
||||
my $p = WebGUI::Paginator->new($self->session,$self->getUrl,1);
|
||||
my $p = WebGUI::Paginator->new($self->session,$self->getUrl,1,$self->paginateVar);
|
||||
if ($self->session->form->process("makePrintable") || $var{description} eq "") {
|
||||
$var{description} =~ s/\^\-\;//g;
|
||||
$p->setDataByArrayRef([$var{description}]);
|
||||
|
|
@ -343,7 +361,8 @@ sub view {
|
|||
}
|
||||
$p->appendTemplateVars(\%var);
|
||||
my $out = $self->processTemplate(\%var,undef,$self->{_viewTemplate});
|
||||
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10 && !$self->session->form->process("overrideTemplateId") && !$self->session->form->process("pn") && !$self->session->form->process("makePrintable")) {
|
||||
if (!$self->session->var->isAdminOn && $self->get("cacheTimeout") > 10 && !$self->session->form->process("overrideTemplateId") &&
|
||||
!$self->session->form->process($self->paginateVar) && !$self->session->form->process("makePrintable")) {
|
||||
WebGUI::Cache->new($self->session,"view_".$self->getId)->set($out,$self->get("cacheTimeout"));
|
||||
}
|
||||
return $out;
|
||||
|
|
@ -351,6 +370,20 @@ sub view {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 paginateVar ( )
|
||||
|
||||
create a semi-unique variable for pagination based on the Asset Id
|
||||
|
||||
=cut
|
||||
|
||||
sub paginateVar {
|
||||
my $self = shift;
|
||||
my $id = $self->getId();
|
||||
return 'pn' . substr($id,0,2) . substr($id,-2,2) ;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteFile ( )
|
||||
|
||||
Deletes and attached file.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use WebGUI::DateTime;
|
|||
use base 'WebGUI::Asset::Wobject';
|
||||
|
||||
use DateTime;
|
||||
use JSON qw/encode_json/;
|
||||
use JSON;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
|
|||
|
|
@ -484,7 +484,9 @@ sub deleteAttachedFiles {
|
|||
my $form = $self->_createForm($fieldConfig->{$field}, $entryData->{$field});
|
||||
if ($form->can('getStorageLocation')) {
|
||||
my $storage = $form->getStorageLocation;
|
||||
$storage->delete;
|
||||
if ($storage) {
|
||||
$storage->delete;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -364,9 +364,9 @@ sub purge {
|
|||
my $db = $self->session->db;
|
||||
|
||||
# delete registrations
|
||||
my $deleteTicket = $db->prepare("delete from EMSRegistrantTicket=?");
|
||||
my $deleteToken = $db->prepare("delete from EMSRegistrantToken=?");
|
||||
my $deleteRibbon = $db->prepare("delete from EMSRegistrantRibbon=?");
|
||||
my $deleteTicket = $db->prepare("delete from EMSRegistrantTicket where badgeId=?");
|
||||
my $deleteToken = $db->prepare("delete from EMSRegistrantToken where badgeId=?");
|
||||
my $deleteRibbon = $db->prepare("delete from EMSRegistrantRibbon where badgeId=?");
|
||||
my $sth = $db->read("select badgeId from EMSRegistrant where emsAssetId=?",[$self->getId]);
|
||||
while (my ($id) = $sth->array) {
|
||||
$deleteTicket->execute([$id]);
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ sub view {
|
|||
url => $child->getUrl,
|
||||
title => $child->get("title"),
|
||||
menuTitle => $child->get("menuTitle"),
|
||||
synopsis => $child->get("synopsis") || '',
|
||||
canView => $child->canView(),
|
||||
"icon.small" => $child->getIcon(1),
|
||||
"icon.big" => $child->getIcon,
|
||||
|
|
|
|||
|
|
@ -1349,11 +1349,13 @@ sub www_search {
|
|||
|
||||
if ( $doSearch ) {
|
||||
# Keywords to search on
|
||||
my $keywords = join " ", $form->get('basicSearch'),
|
||||
$form->get('keywords'),
|
||||
$form->get('title'),
|
||||
$form->get('description')
|
||||
;
|
||||
# Do not add a space to the
|
||||
my $keywords;
|
||||
FORMVAR: foreach my $formVar (qw/ basicSearch keywords title description /) {
|
||||
my $var = $form->get($formVar);
|
||||
next FORMVAR unless $var;
|
||||
$keywords = join ' ', $keywords, $var;
|
||||
}
|
||||
|
||||
# Build a where clause from the advanced options
|
||||
# Lineage search can capture gallery
|
||||
|
|
@ -1374,6 +1376,16 @@ sub www_search {
|
|||
;
|
||||
}
|
||||
|
||||
my $dateAfter = $form->get("creationDate_after", "dateTime");
|
||||
my $dateBefore = $form->get("creationDate_before", "dateTime");
|
||||
my $creationDate = {};
|
||||
if ($dateAfter) {
|
||||
$creationDate->{start} = $dateAfter;
|
||||
}
|
||||
if ($dateBefore) {
|
||||
$creationDate->{end } = $dateBefore;
|
||||
}
|
||||
|
||||
# Classes
|
||||
my $joinClass = [
|
||||
'WebGUI::Asset::Wobject::GalleryAlbum',
|
||||
|
|
@ -1407,6 +1419,7 @@ sub www_search {
|
|||
keywords => $keywords,
|
||||
where => $where,
|
||||
joinClass => $joinClass,
|
||||
creationDate => $creationDate,
|
||||
} );
|
||||
|
||||
$var->{ keywords } = $keywords;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ sub definition {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = __PACKAGE__->i18n($session);
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_GalleryAlbum');
|
||||
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
allowComments => {
|
||||
|
|
@ -352,27 +352,6 @@ sub DESTROY {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 i18n ( session )
|
||||
|
||||
Get a WebGUI::International object for this class.
|
||||
|
||||
Can be called as a class method, in which case a WebGUI::Session object
|
||||
must be passed in.
|
||||
|
||||
NOTE: This method can NOT be inherited, due to a current limitation
|
||||
in the i18n system. You must ALWAYS call this with C<__PACKAGE__>
|
||||
|
||||
=cut
|
||||
|
||||
sub i18n {
|
||||
my $self = shift;
|
||||
my $session = shift;
|
||||
|
||||
return WebGUI::International->new($session, "Asset_GalleryAlbum");
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getAutoCommitWorkflowId ( )
|
||||
|
||||
Returns the workflowId of the Gallery's approval workflow.
|
||||
|
|
@ -773,6 +752,20 @@ sub sendChunkedContent {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 update ( )
|
||||
|
||||
Override update to force isHidden=1 on all albums.
|
||||
|
||||
=cut
|
||||
|
||||
sub update {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
return $self->SUPER::update({ %{ $properties }, isHidden=>1 });
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 view ( )
|
||||
|
||||
method called by the www_view method. Returns a processed template
|
||||
|
|
@ -937,7 +930,7 @@ sub www_addArchiveSave {
|
|||
|
||||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $i18n = __PACKAGE__->i18n( $session );
|
||||
my $i18n = WebGUI::International->new( $session, 'Asset_GalleryAlbum' );
|
||||
my $properties = {
|
||||
keywords => $form->get("keywords"),
|
||||
friendsOnly => $form->get("friendsOnly"),
|
||||
|
|
@ -1093,7 +1086,7 @@ sub www_deleteConfirm {
|
|||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $gallery = $self->getParent;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session, 'Asset_GalleryAlbum' );
|
||||
|
||||
$self->purge;
|
||||
|
||||
|
|
@ -1119,7 +1112,7 @@ sub www_edit {
|
|||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $var = $self->getTemplateVars;
|
||||
my $i18n = __PACKAGE__->i18n($session);
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_GalleryAlbum');
|
||||
|
||||
return $session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
|
|
@ -1299,7 +1292,7 @@ Provides links to view the album.
|
|||
|
||||
sub www_showConfirmation {
|
||||
my $self = shift;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session, 'Asset_GalleryAlbum' );
|
||||
|
||||
my $output = '<p>' . sprintf( $i18n->get('save message'), $self->getUrl ) . '</p>'
|
||||
. '<p>' . $i18n->get('what next') . '</p>'
|
||||
|
|
|
|||
|
|
@ -550,22 +550,20 @@ sub view {
|
|||
foreach my $category (keys %{$self->getCategories}) {
|
||||
my $data;
|
||||
my $sql = "
|
||||
select
|
||||
select
|
||||
assetData.title as productName,
|
||||
assetData.url,
|
||||
listing.assetId,
|
||||
rating.meanValue,
|
||||
rating.medianValue,
|
||||
rating.countValue
|
||||
from MatrixListing as listing
|
||||
left join asset on listing.assetId = asset.assetId
|
||||
left join MatrixListing_ratingSummary as rating on rating.listingId = listing.assetId
|
||||
left join assetData on assetData.assetId = listing.assetId and listing.revisionDate =
|
||||
assetData.revisionDate
|
||||
where
|
||||
asset.parentId=?
|
||||
and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::MatrixListing'
|
||||
rating.listingId,
|
||||
rating.meanValue,
|
||||
asset.parentId
|
||||
from
|
||||
MatrixListing_ratingSummary as rating
|
||||
left join asset on (rating.listingId = asset.assetId)
|
||||
left join assetData on assetData.assetId = rating.listingId
|
||||
where
|
||||
rating.category =?
|
||||
and asset.parentId=?
|
||||
and asset.state='published'
|
||||
and assetData.revisionDate=(
|
||||
select
|
||||
max(revisionDate)
|
||||
|
|
@ -575,13 +573,11 @@ assetData.revisionDate
|
|||
assetData.assetId=asset.assetId
|
||||
and (status='approved' or status='archived')
|
||||
)
|
||||
and status='approved'
|
||||
and rating.category=?
|
||||
group by
|
||||
assetData.assetId
|
||||
order by rating.meanValue ";
|
||||
|
||||
$data = $db->quickHashRef($sql." desc limit 1",[$self->getId,$category]);
|
||||
$data = $db->quickHashRef($sql." desc limit 1",[$category,$self->getId]);
|
||||
push(@{ $var->{best_rating_loop} },{
|
||||
url=>'/'.$data->{url},
|
||||
category=>$category,
|
||||
|
|
@ -590,7 +586,7 @@ assetData.revisionDate
|
|||
median=>$data->{medianValue},
|
||||
count=>$data->{countValue}
|
||||
});
|
||||
$data = $db->quickHashRef($sql." asc limit 1",[$self->getId,$category]);
|
||||
$data = $db->quickHashRef($sql." asc limit 1",[$category,$self->getId]);
|
||||
push(@{ $var->{worst_rating_loop} },{
|
||||
url=>'/'.$data->{url},
|
||||
category=>$category,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ use POSIX qw(ceil floor);
|
|||
use base 'WebGUI::Asset::Wobject';
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _addDaysForMonth
|
||||
|
||||
=cut
|
||||
|
||||
sub _addDaysForMonth {
|
||||
my $self = shift;
|
||||
my $dt = $self->session->datetime;
|
||||
|
|
@ -53,6 +58,11 @@ sub _addDaysForMonth {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _clobberImproperDependants
|
||||
|
||||
=cut
|
||||
|
||||
sub _clobberImproperDependants {
|
||||
my $self = shift;
|
||||
my $projectId = shift;
|
||||
|
|
@ -62,6 +72,11 @@ sub _clobberImproperDependants {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _doGanttTaskResourceDisplay
|
||||
|
||||
=cut
|
||||
|
||||
sub _doGanttTaskResourceDisplay {
|
||||
my $self = shift;
|
||||
my $hash = shift;
|
||||
|
|
@ -96,6 +111,11 @@ sub _doGanttTaskResourceDisplay {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _getDurationUnitHash
|
||||
|
||||
=cut
|
||||
|
||||
sub _getDurationUnitHash {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$dt,$i18n,$user) = $self->setSessionVars;
|
||||
|
|
@ -107,6 +127,11 @@ sub _getDurationUnitHash {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _getDurationUnitHashAbbrev
|
||||
|
||||
=cut
|
||||
|
||||
sub _getDurationUnitHashAbbrev {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$dt,$i18n,$user) = $self->setSessionVars;
|
||||
|
|
@ -118,6 +143,11 @@ sub _getDurationUnitHashAbbrev {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _groupSearchQuery
|
||||
|
||||
=cut
|
||||
|
||||
sub _groupSearchQuery {
|
||||
my $self = shift;
|
||||
my $exclude = shift;
|
||||
|
|
@ -136,6 +166,11 @@ SQL
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _htmlOfResourceList
|
||||
|
||||
=cut
|
||||
|
||||
sub _htmlOfResourceList {
|
||||
my $self = shift;
|
||||
my %args = %{+shift};
|
||||
|
|
@ -188,6 +223,11 @@ sub _htmlOfResourceList {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _innerHtmlOfResources
|
||||
|
||||
=cut
|
||||
|
||||
sub _innerHtmlOfResources {
|
||||
my $self = shift;
|
||||
my @resources = @_;
|
||||
|
|
@ -196,6 +236,11 @@ sub _innerHtmlOfResources {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _resourceListOfTask
|
||||
|
||||
=cut
|
||||
|
||||
sub _resourceListOfTask {
|
||||
my $self = shift;
|
||||
my $taskId = shift;
|
||||
|
|
@ -219,6 +264,11 @@ sub _resourceListOfTask {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _resourceSearchPopup
|
||||
|
||||
=cut
|
||||
|
||||
sub _resourceSearchPopup {
|
||||
my $self = shift;
|
||||
my %args = @_;
|
||||
|
|
@ -260,6 +310,11 @@ sub _resourceSearchPopup {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _userSearchQuery
|
||||
|
||||
=cut
|
||||
|
||||
sub _userSearchQuery {
|
||||
my $self = shift;
|
||||
my $exclude = shift;
|
||||
|
|
@ -280,6 +335,11 @@ SQL
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _updateDependantDates
|
||||
|
||||
=cut
|
||||
|
||||
sub _updateDependantDates {
|
||||
my $self = shift;
|
||||
my $db = $self->session->db;
|
||||
|
|
@ -335,6 +395,11 @@ sub _updateDependantDates {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _userCanManageProject
|
||||
|
||||
=cut
|
||||
|
||||
sub _userCanManageProject {
|
||||
my $self = shift;
|
||||
my $user = shift;
|
||||
|
|
@ -344,6 +409,11 @@ sub _userCanManageProject {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _userCanManageProjectList
|
||||
|
||||
=cut
|
||||
|
||||
sub _userCanManageProjectList {
|
||||
my $self = shift;
|
||||
my $user = shift;
|
||||
|
|
@ -351,6 +421,11 @@ sub _userCanManageProjectList {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _userCanObserveProject
|
||||
|
||||
=cut
|
||||
|
||||
sub _userCanObserveProject {
|
||||
my $self = shift;
|
||||
my $user = shift;
|
||||
|
|
@ -360,6 +435,11 @@ sub _userCanObserveProject {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
|
@ -439,6 +519,11 @@ sub definition {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
#API method called by Time Tracker to return the instance of the PM wobject which this project blongs
|
||||
|
||||
=head2 getProjectInstance
|
||||
|
||||
=cut
|
||||
|
||||
sub getProjectInstance {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
|
@ -454,6 +539,11 @@ sub getProjectInstance {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
#API method called by Time Tracker to return all projects in all assets for which the user passed in has tasks assigned
|
||||
|
||||
=head2 getProjectList
|
||||
|
||||
=cut
|
||||
|
||||
sub getProjectList {
|
||||
my $self = shift;
|
||||
my $db = $self->session->db;
|
||||
|
|
@ -474,6 +564,11 @@ SQL
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
#API method called by Time Tracker to return all tasks for the projectId passed in
|
||||
|
||||
=head2 getTaskList
|
||||
|
||||
=cut
|
||||
|
||||
sub getTaskList {
|
||||
my $self = shift;
|
||||
my $db = $self->session->db;
|
||||
|
|
@ -494,6 +589,11 @@ SQL
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 i18n
|
||||
|
||||
=cut
|
||||
|
||||
sub i18n {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
|
@ -507,6 +607,11 @@ sub i18n {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 prepareView
|
||||
|
||||
=cut
|
||||
|
||||
sub prepareView {
|
||||
my $self = shift;
|
||||
$self->SUPER::prepareView();
|
||||
|
|
@ -516,6 +621,11 @@ sub prepareView {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 processErrors
|
||||
|
||||
=cut
|
||||
|
||||
sub processErrors {
|
||||
my $self = shift;
|
||||
my $errors = "";
|
||||
|
|
@ -531,6 +641,11 @@ sub processErrors {
|
|||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 purge
|
||||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
#purge your wobject-specific data here. This does not include fields
|
||||
|
|
@ -539,6 +654,11 @@ sub purge {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setSessionVars
|
||||
|
||||
=cut
|
||||
|
||||
sub setSessionVars {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
|
@ -556,6 +676,11 @@ sub setSessionVars {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
# API method called by Time Tracker to set percent complete field in the task and update the project cache
|
||||
|
||||
=head2 updateProjectTask
|
||||
|
||||
=cut
|
||||
|
||||
sub updateProjectTask {
|
||||
my $self = shift;
|
||||
my $db = $self->session->db;
|
||||
|
|
@ -594,6 +719,11 @@ sub updateProjectTask {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 updateProject
|
||||
|
||||
=cut
|
||||
|
||||
sub updateProject {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$dt,$i18n,$user) = $self->setSessionVars;
|
||||
|
|
@ -614,6 +744,11 @@ sub updateProject {
|
|||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 view
|
||||
|
||||
=cut
|
||||
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
|
|
@ -681,6 +816,11 @@ sub view {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteProject
|
||||
|
||||
=cut
|
||||
|
||||
sub www_deleteProject {
|
||||
my $self = shift;
|
||||
#Set Method Helpers
|
||||
|
|
@ -700,6 +840,11 @@ sub www_deleteProject {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteTask
|
||||
|
||||
=cut
|
||||
|
||||
sub www_deleteTask {
|
||||
my $self = shift;
|
||||
#Set Method Helpers
|
||||
|
|
@ -743,6 +888,11 @@ sub www_deleteTask {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_drawGanttChart
|
||||
|
||||
=cut
|
||||
|
||||
sub www_drawGanttChart {
|
||||
my $self = shift;
|
||||
my $var = {};
|
||||
|
|
@ -988,6 +1138,11 @@ sub www_drawGanttChart {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editProject
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editProject {
|
||||
my $self = shift;
|
||||
#Set Method Helpers
|
||||
|
|
@ -1101,6 +1256,11 @@ sub www_editProject {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editProjectSave
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editProjectSave {
|
||||
my $self = shift;
|
||||
#Set Method Helpers
|
||||
|
|
@ -1166,6 +1326,11 @@ sub www_editProjectSave {
|
|||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editTask
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editTask {
|
||||
my $self = shift;
|
||||
my $var = {};
|
||||
|
|
@ -1362,6 +1527,11 @@ sub www_editTask {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editTaskSave
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editTaskSave {
|
||||
my $self = shift;
|
||||
my $var = {};
|
||||
|
|
@ -1452,6 +1622,11 @@ sub www_editTaskSave {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_groupSearchPopup
|
||||
|
||||
=cut
|
||||
|
||||
sub www_groupSearchPopup {
|
||||
my $self = shift;
|
||||
my %args = (func => 'groupSearchPopup',
|
||||
|
|
@ -1462,6 +1637,11 @@ sub www_groupSearchPopup {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_innerHtmlOfResources
|
||||
|
||||
=cut
|
||||
|
||||
sub www_innerHtmlOfResources {
|
||||
my $self = shift;
|
||||
my @resources = map {
|
||||
|
|
@ -1472,6 +1652,11 @@ sub www_innerHtmlOfResources {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_saveExistingTasks
|
||||
|
||||
=cut
|
||||
|
||||
sub www_saveExistingTasks {
|
||||
my $self = shift;
|
||||
my $var = {};
|
||||
|
|
@ -1515,6 +1700,11 @@ sub www_saveExistingTasks {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_userSearchPopup
|
||||
|
||||
=cut
|
||||
|
||||
sub www_userSearchPopup {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -1526,6 +1716,11 @@ sub www_userSearchPopup {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewProject
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewProject {
|
||||
my $self = shift;
|
||||
my $var = {};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use Tie::IxHash;
|
|||
use JSON;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Form::File;
|
||||
use WebGUI::Utility;
|
||||
use base 'WebGUI::Asset::Wobject';
|
||||
use WebGUI::Asset::Wobject::Survey::SurveyJSON;
|
||||
use WebGUI::Asset::Wobject::Survey::ResponseJSON;
|
||||
|
|
@ -22,6 +23,17 @@ use WebGUI::Asset::Wobject::Survey::ResponseJSON;
|
|||
use Data::Dumper;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, [definition] )
|
||||
|
||||
Returns an array reference of definitions. Adds tableName, className, properties to array definition.
|
||||
|
||||
=head3 definition
|
||||
|
||||
An array of hashes to prepend to the list
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
|
@ -31,31 +43,33 @@ sub definition {
|
|||
tie %properties, 'Tie::IxHash';
|
||||
%properties = (
|
||||
templateId => {
|
||||
fieldType => "template",
|
||||
fieldType => 'template',
|
||||
defaultValue => 'PBtmpl0000000000000061',
|
||||
tab => "display",
|
||||
namespace => "Survey",
|
||||
hoverHelp => "A Survey System",
|
||||
label => "Template ID"
|
||||
tab => 'display',
|
||||
namespace => 'Survey',
|
||||
label => $i18n->get('survey template'),
|
||||
hoverHelp => $i18n->get('survey template help'),
|
||||
},
|
||||
showProgress => {
|
||||
fieldType => "yesNo",
|
||||
fieldType => 'yesNo',
|
||||
defaultValue => 0,
|
||||
tab => 'properties',
|
||||
label => "Show user their progress"
|
||||
label => $i18n->get('Show user their progress'),
|
||||
hoverHelp => $i18n->get('Show user their progress help'),
|
||||
},
|
||||
showTimeLimit => {
|
||||
fieldType => "yesNo",
|
||||
fieldType => 'yesNo',
|
||||
defaultValue => 0,
|
||||
tab => 'properties',
|
||||
label => "Show user their time remaining"
|
||||
label => $i18n->get('Show user their time remaining'),
|
||||
hoverHelp => $i18n->get('Show user their time remaining'),
|
||||
},
|
||||
timeLimit => {
|
||||
fieldType => 'integer',
|
||||
defaultValue => 0,
|
||||
tab => 'properties',
|
||||
label => $i18n->get('timelimit'),
|
||||
hoverHelp => $i18n->get('timelimit hoverHelp'),
|
||||
label => $i18n->get('timelimit')
|
||||
},
|
||||
doAfterTimeLimit => {
|
||||
fieldType => 'selectBox',
|
||||
|
|
@ -71,90 +85,92 @@ sub definition {
|
|||
groupToEditSurvey => {
|
||||
fieldType => 'group',
|
||||
defaultValue => 4,
|
||||
label => "Group to edit survey",
|
||||
label => $i18n->get('Group to edit survey'),
|
||||
hoverHelp => $i18n->get('Group to edit survey help'),
|
||||
},
|
||||
groupToTakeSurvey => {
|
||||
fieldType => 'group',
|
||||
defaultValue => 2,
|
||||
label => "Group to take survey",
|
||||
label => $i18n->get('Group to take survey'),
|
||||
hoverHelp => $i18n->get('Group to take survey help'),
|
||||
},
|
||||
groupToViewReports => {
|
||||
fieldType => 'group',
|
||||
defaultValue => 4,
|
||||
label => "Group to view reports",
|
||||
label => $i18n->get('Group to view reports'),
|
||||
hoverHelp => $i18n->get('Group to view reports help'),
|
||||
},
|
||||
exitURL => {
|
||||
fieldType => 'text',
|
||||
defaultValue => undef,
|
||||
label => "Set the URL that the survey will exit to",
|
||||
hoverHelp =>
|
||||
"When the user finishes the survey, they will be sent to this URL. Leave blank if no forwarding required.",
|
||||
label => $i18n->get('Survey Exit URL'),
|
||||
hoverHelp => $i18n->get('Survey Exit URL help'),
|
||||
},
|
||||
maxResponsesPerUser => {
|
||||
fieldType => 'integer',
|
||||
defaultValue => 1,
|
||||
label => "Max user reponses",
|
||||
label => 'Max user reponses',
|
||||
},
|
||||
overviewTemplateId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
defaultValue => 'PBtmpl0000000000000063',
|
||||
label => "Overview template id",
|
||||
label => 'Overview template id',
|
||||
namespace => 'Survey/Overview',
|
||||
},
|
||||
gradebookTemplateId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
label => "Grabebook template id",
|
||||
label => 'Grabebook template id',
|
||||
defaultValue => 'PBtmpl0000000000000062',
|
||||
namespace => 'Survey/Gradebook',
|
||||
},
|
||||
responseTemplateId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
label => "Response template id",
|
||||
label => 'Response template id',
|
||||
defaultValue => 'PBtmpl0000000000000064',
|
||||
namespace => 'Survey/Response',
|
||||
},
|
||||
surveyEditTemplateId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
label => "Survey edit template id",
|
||||
label => 'Survey edit template id',
|
||||
defaultValue => 'GRUNFctldUgop-qRLuo_DA',
|
||||
namespace => 'Survey/Edit',
|
||||
},
|
||||
surveyTakeTemplateId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
label => "Take survey template id",
|
||||
label => 'Take survey template id',
|
||||
defaultValue => 'd8jMMMRddSQ7twP4l1ZSIw',
|
||||
namespace => 'Survey/Take',
|
||||
},
|
||||
surveyQuestionsId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
label => "Questions template id",
|
||||
label => 'Questions template id',
|
||||
defaultValue => 'CxMpE_UPauZA3p8jdrOABw',
|
||||
namespace => 'Survey/Take',
|
||||
},
|
||||
sectionEditTemplateId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
label => "Section Edit Tempalte",
|
||||
label => 'Section Edit Tempalte',
|
||||
defaultValue => '1oBRscNIcFOI-pETrCOspA',
|
||||
namespace => 'Survey/Edit',
|
||||
},
|
||||
questionEditTemplateId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
label => "Question Edit Tempalte",
|
||||
label => 'Question Edit Tempalte',
|
||||
defaultValue => 'wAc4azJViVTpo-2NYOXWvg',
|
||||
namespace => 'Survey/Edit',
|
||||
},
|
||||
answerEditTemplateId => {
|
||||
tab => 'display',
|
||||
fieldType => 'template',
|
||||
label => "Answer Edit Tempalte",
|
||||
label => 'Answer Edit Tempalte',
|
||||
defaultValue => 'AjhlNO3wZvN5k4i4qioWcg',
|
||||
namespace => 'Survey/Edit',
|
||||
},
|
||||
|
|
@ -248,7 +264,6 @@ Saves the survey collateral to the DB
|
|||
|
||||
=cut
|
||||
|
||||
sub survey { return shift->{survey}; }
|
||||
|
||||
sub saveSurveyJSON {
|
||||
my $self = shift;
|
||||
|
|
@ -260,6 +275,19 @@ sub saveSurveyJSON {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 survey ( )
|
||||
|
||||
Helper to access the survey object.
|
||||
|
||||
=cut
|
||||
|
||||
sub survey { return shift->{survey}; }
|
||||
sub littleBuddy { return shift->{survey}; }
|
||||
sub allyourbases { return shift->{survey}; }
|
||||
sub helpmehelpme { return shift->{survey}; }
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editSurvey ( )
|
||||
|
||||
Loads the initial edit survey page. All other edit actions are JSON calls from this page.
|
||||
|
|
@ -279,6 +307,14 @@ sub www_editSurvey {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_submitObjectEdit ( )
|
||||
|
||||
This is called when an edit is submitted to a survey object. The POST should contain the id and updated params
|
||||
of the object, and also if the object is being deleted or copied.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_submitObjectEdit {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -355,6 +391,15 @@ sub www_jumpTo {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 copyObject ( )
|
||||
|
||||
Takes the address of a survey object and creates a copy. The copy is placed at the end of this object's parent's list.
|
||||
|
||||
Returns the address to the new object.
|
||||
|
||||
=cut
|
||||
|
||||
sub copyObject {
|
||||
my ( $self, $address ) = @_;
|
||||
|
||||
|
|
@ -371,13 +416,28 @@ sub copyObject {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 deleteObject( $address )
|
||||
|
||||
Deletes the object matching the passed in address.
|
||||
|
||||
Returns the address to the parent object, or the very first section.
|
||||
|
||||
=head3 $address
|
||||
|
||||
An array ref. The first element of the array ref is the index of
|
||||
the section. The second element is the index of the question in
|
||||
that section. The third element is the index of the answer.
|
||||
|
||||
=cut
|
||||
|
||||
sub deleteObject {
|
||||
my ( $self, $address ) = @_;
|
||||
|
||||
$self->loadSurveyJSON();
|
||||
|
||||
my $message = $self->survey->remove($address)
|
||||
; #each object checks the ref and then either updates or passes it to the correct child. New objects will have an index of -1.
|
||||
#each object checks the ref and then either updates or passes it to the correct child. New objects will have an index of -1.
|
||||
my $message = $self->survey->remove($address);
|
||||
|
||||
$self->saveSurveyJSON();
|
||||
|
||||
|
|
@ -393,6 +453,13 @@ sub deleteObject {
|
|||
} ## end sub deleteObject
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_newObject()
|
||||
|
||||
Creates a new object from a POST param containing the new objects id concat'd on hyphens.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_newObject {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -417,6 +484,13 @@ sub www_newObject {
|
|||
} ## end sub www_newObject
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_dragDrop
|
||||
|
||||
Takes two ids from a form POST. The "target" is the object being moved, the "before" is the object directly preceding the "target".
|
||||
|
||||
=cut
|
||||
|
||||
sub www_dragDrop {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -483,6 +557,18 @@ sub www_dragDrop {
|
|||
} ## end sub www_dragDrop
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_loadSurvey([options])
|
||||
|
||||
For loading the survey during editing. Returns the survey meta list and the html data for editing a particular survey object.
|
||||
|
||||
=head3 options
|
||||
|
||||
Can either be a hashref containing the address to be edited. And/or a the specific variables to be edited.
|
||||
If undef, the address is pulled form the form POST.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_loadSurvey {
|
||||
my ( $self, $options ) = @_;
|
||||
my $editflag = 1;
|
||||
|
|
@ -503,7 +589,6 @@ sub www_loadSurvey {
|
|||
$address = [0];
|
||||
}
|
||||
}
|
||||
my $message = defined $options->{message} ? $options->{message} : '';
|
||||
my $var
|
||||
= defined $options->{var}
|
||||
? $options->{var}
|
||||
|
|
@ -605,6 +690,12 @@ sub prepareView {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 purge
|
||||
|
||||
Completely remove from WebGUI.
|
||||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
$self->session->db->write( "delete from Survey_response where assetId = ?", [ $self->getId() ] );
|
||||
|
|
@ -628,7 +719,6 @@ sub purgeCache {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub purgeRevision {
|
||||
my $self = shift;
|
||||
return $self->SUPER::purgeRevision;
|
||||
|
|
@ -644,9 +734,30 @@ returns the output.
|
|||
=cut
|
||||
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my $var = $self->getMenuVars;
|
||||
|
||||
my ( $code, $overTakeLimit ) = $self->getResponseInfoForView();
|
||||
$var->{'lastResponseCompleted'} = $code;
|
||||
$var->{'lastResponseTimedOut'} = $code > 1 ? 1 : 0;
|
||||
$var->{'maxResponsesSubmitted'} = $overTakeLimit;
|
||||
my $out = $self->processTemplate( $var, undef, $self->{_viewTemplate} );
|
||||
|
||||
return $out;
|
||||
} ## end sub view
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getMenuVars ( )
|
||||
|
||||
Returns the top menu template variables as a hashref.
|
||||
|
||||
=cut
|
||||
|
||||
sub getMenuVars {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
|
||||
|
||||
$var{'edit_survey_url'} = $self->getUrl('func=editSurvey');
|
||||
$var{'take_survey_url'} = $self->getUrl('func=takeSurvey');
|
||||
$var{'view_simple_results_url'} = $self->getUrl('func=exportSimpleResults');
|
||||
|
|
@ -656,15 +767,9 @@ sub view {
|
|||
$var{'user_canTakeSurvey'} = $self->session->user->isInGroup( $self->get("groupToTakeSurvey") );
|
||||
$var{'user_canViewReports'} = $self->session->user->isInGroup( $self->get("groupToViewReports") );
|
||||
$var{'user_canEditSurvey'} = $self->session->user->isInGroup( $self->get("groupToEditSurvey") );
|
||||
$var{'user_canEditSurvey'} = $self->session->user->isInGroup( $self->get("groupToEditSurvey") );
|
||||
my ( $code, $overTakeLimit ) = $self->getResponseInfoForView();
|
||||
$var{'lastResponseCompleted'} = $code;
|
||||
$var{'lastResponseTimedOut'} = $code > 1 ? 1 : 0;
|
||||
$var{'maxResponsesSubmitted'} = $overTakeLimit;
|
||||
my $out = $self->processTemplate( \%var, undef, $self->{_viewTemplate} );
|
||||
|
||||
return $out;
|
||||
} ## end sub view
|
||||
return \%var;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -747,6 +852,12 @@ sub www_view {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_takeSurvey
|
||||
|
||||
Returns the template needed to take the survey. This template dynamically loads the survey via async requests.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_takeSurvey {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
|
|
@ -763,11 +874,37 @@ sub www_takeSurvey {
|
|||
}
|
||||
};
|
||||
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/utilities/utilities.js'), {type =>
|
||||
'text/javascript'});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/container/container-min.js'), {type =>
|
||||
'text/javascript'});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/menu/menu-min.js'), {type =>
|
||||
'text/javascript'});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/button/button-min.js'), {type =>
|
||||
'text/javascript'});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/calendar/calendar-min.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/logger/logger-min.js'), {type =>
|
||||
'text/javascript'});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/resize/resize-min.js'), {type =>
|
||||
'text/javascript'});
|
||||
$self->session->style->setScript($self->session->url->extras('yui/build/slider/slider-min.js'), {type =>
|
||||
'text/javascript'});
|
||||
|
||||
my $out = $self->processTemplate( \%var, $self->get("surveyTakeTemplateId") );
|
||||
return $self->session->style->process( $out, $self->get("styleTemplateId") );
|
||||
} ## end sub www_takeSurvey
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteResponses
|
||||
|
||||
Deletes all the responses from the survey.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_deleteResponses {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -779,8 +916,14 @@ sub www_deleteResponses {
|
|||
return;
|
||||
}
|
||||
|
||||
#handles questions that were submitted
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_submitQuestions
|
||||
|
||||
Handles questions submitted by the survey taker, adding them to their response.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_submitQuestions {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -845,8 +988,14 @@ sub www_submitQuestions {
|
|||
return $self->www_loadQuestions($responseId);
|
||||
} ## end sub www_submitQuestions
|
||||
|
||||
#finds the questions to display next and builds the data structre to hold them
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_loadQuestions
|
||||
|
||||
Determines which questions to display to the survey taker next, loads and returns them.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_loadQuestions {
|
||||
my $self = shift;
|
||||
my $wasRestarted = shift;
|
||||
|
|
@ -941,12 +1090,21 @@ sub surveyEnd {
|
|||
}
|
||||
}
|
||||
}
|
||||
# $self->session->http->setRedirect($url);
|
||||
return to_json( { "type", "forward", "url", $url } );
|
||||
$url = $self->session->url->gateway($url);
|
||||
#$self->session->http->setRedirect($url);
|
||||
#$self->session->http->setMimeType('application/json');
|
||||
my $json = to_json( { "type", "forward", "url", $url } );
|
||||
return $json;
|
||||
} ## end sub surveyEnd
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
#sends the processed template and questions structure to the client
|
||||
|
||||
=head2 prepareShowSurveyTemplate
|
||||
|
||||
Sends the processed template and questions structure to the client
|
||||
|
||||
=cut
|
||||
|
||||
sub prepareShowSurveyTemplate {
|
||||
my ( $self, $section, $questions ) = @_;
|
||||
my %multipleChoice = (
|
||||
|
|
@ -1011,6 +1169,16 @@ sub prepareShowSurveyTemplate {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 loadBothJSON($rId)
|
||||
|
||||
Loads both the Survey and the appropriate response objects from JSON.
|
||||
|
||||
=head3 $rId
|
||||
|
||||
The reponse id to load.
|
||||
|
||||
=cut
|
||||
|
||||
sub loadBothJSON {
|
||||
my $self = shift;
|
||||
my $rId = shift;
|
||||
|
|
@ -1025,6 +1193,21 @@ sub loadBothJSON {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 loadResponseJSON([$jsonHash],[$rId])
|
||||
|
||||
Loads the response object from JSON.
|
||||
|
||||
=head3 $jsonHash
|
||||
|
||||
Optional, but if the hash has been pulled from the DB before, there is no need to pull it again.
|
||||
|
||||
=head3 $rId
|
||||
|
||||
Optional, but if not passed in, it is grabbed.
|
||||
|
||||
=cut
|
||||
|
||||
sub loadResponseJSON {
|
||||
my $self = shift;
|
||||
my $jsonHash = shift;
|
||||
|
|
@ -1043,16 +1226,31 @@ sub loadResponseJSON {
|
|||
} ## end sub loadResponseJSON
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head3 saveResponseJSON
|
||||
|
||||
Turns the response object into JSON and saves it to the DB.
|
||||
|
||||
=cut
|
||||
|
||||
sub saveResponseJSON {
|
||||
my $self = shift;
|
||||
|
||||
my $data = $self->response->freeze();
|
||||
|
||||
$self->session->db->write( "update Survey_response set responseJSON = ? where Survey_responseId = ?",
|
||||
|
||||
[ $data, $self->{responseId} ] );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 response
|
||||
|
||||
Helper to easily grab the response object and prevent typos.
|
||||
|
||||
=cut
|
||||
|
||||
sub response {
|
||||
my $self = shift;
|
||||
return $self->{response};
|
||||
|
|
@ -1060,6 +1258,13 @@ sub response {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getResponseId
|
||||
|
||||
Determines the response id of the current user. If there is not a response for the user, a new one is created.
|
||||
If the user is anonymous, the IP is used. Or an email'd or linked code can be used.
|
||||
|
||||
=cut
|
||||
|
||||
sub getResponseId {
|
||||
my $self = shift;
|
||||
return $self->{responseId} if ( defined $self->{responseId} );
|
||||
|
|
@ -1148,6 +1353,12 @@ sub getResponseId {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 canTakeSurvey
|
||||
|
||||
Determines if the current user has permissions to take the survey.
|
||||
|
||||
=cut
|
||||
|
||||
sub canTakeSurvey {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -1187,24 +1398,144 @@ sub canTakeSurvey {
|
|||
} ## end sub canTakeSurvey
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewGradeBook (){
|
||||
|
||||
Returns the Grade Book screen.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewGradeBook {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $db = $self->session->db;
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get("groupToViewReports") ) );
|
||||
|
||||
my $var = $self->getMenuVars;
|
||||
|
||||
$self->loadTempReportTable();
|
||||
|
||||
my $paginator = WebGUI::Paginator->new($self->session,$self->getUrl('func=viewGradebook'));
|
||||
$paginator->setDataByQuery("select userId,username,ipAddress,Survey_responseId,startDate,endDate
|
||||
from Survey_response
|
||||
where assetId=".$db->quote($self->getId)." order by username,ipAddress,startDate");
|
||||
my $users = $paginator->getPageData;
|
||||
|
||||
$self->loadSurveyJSON();
|
||||
$var->{question_count} = $self->survey->questionCount;
|
||||
|
||||
my @responseloop;
|
||||
foreach my $user (@$users) {
|
||||
my ($correctCount) = $db->quickArray("select count(*) from Survey_tempReport
|
||||
where Survey_responseId=? and isCorrect=1",[$user->{Survey_responseId}]);
|
||||
push(@responseloop, {
|
||||
# response_url is left out because it looks like Survey doesn't have a viewIndividualSurvey feature
|
||||
# yet.
|
||||
#'response_url'=>$self->getUrl('func=viewIndividualSurvey;responseId='.$user->{Survey_responseId}),
|
||||
'response_user_name'=>($user->{userId} eq '1') ? $user->{ipAddress} : $user->{username},
|
||||
'response_count_correct' => $correctCount,
|
||||
'response_percent' => round(($correctCount/$var->{question_count})*100)
|
||||
});
|
||||
}
|
||||
$var->{response_loop} = \@responseloop;
|
||||
$paginator->appendTemplateVars($var);
|
||||
|
||||
my $out = $self->processTemplate( $var, $self->get("gradebookTemplateId") );
|
||||
return $self->session->style->process( $out, $self->get("styleTemplateId") );
|
||||
|
||||
} ## end sub www_viewGradeBook
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewStatisticalOverview (){
|
||||
|
||||
Returns the Statistical Overview screen.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewStatisticalOverview {
|
||||
my $self = shift;
|
||||
my $db = $self->session->db;
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get("groupToViewReports") ) );
|
||||
|
||||
$self->loadTempReportTable();
|
||||
$self->loadSurveyJSON();
|
||||
my $survey = $self->survey;
|
||||
my $var = $self->getMenuVars;
|
||||
|
||||
my $paginator = WebGUI::Paginator->new($self->session,$self->getUrl('func=viewStatisticalOverview'));
|
||||
my @questionloop;
|
||||
for ( my $sectionIndex = 0; $sectionIndex <= $#{ $survey->sections() }; $sectionIndex++ ) {
|
||||
for ( my $questionIndex = 0; $questionIndex <= $#{ $survey->questions([$sectionIndex]) }; $questionIndex++ ) {
|
||||
my $question = $survey->question( [ $sectionIndex, $questionIndex ] );
|
||||
my $questionType = $question->{questionType};
|
||||
my (@answerloop, $totalResponses);;
|
||||
|
||||
my @peoples
|
||||
= $self->session->db->quickArray( "SELECT UNIQUE(Survey_responseId) from Survey_tempReport where assetId = ?",
|
||||
[ $self->getId() ] );
|
||||
for my $people (@peoples) {
|
||||
|
||||
#my $
|
||||
if ($questionType eq "Multiple Choice"){
|
||||
$totalResponses = $db->quickScalar("select count(*) from Survey_tempReport
|
||||
where sectionNumber=? and questionNumber=?",[$sectionIndex,$questionIndex]);
|
||||
|
||||
for ( my $answerIndex = 0; $answerIndex <= $#{ $survey->answers([$sectionIndex,$questionIndex]) }; $answerIndex++ ) {
|
||||
my $numResponses = $db->quickScalar("select count(*) from Survey_tempReport
|
||||
where sectionNumber=? and questionNumber=? and answerNumber=?",
|
||||
[$sectionIndex,$questionIndex,$answerIndex]);
|
||||
my $responsePercent;
|
||||
if ($totalResponses) {
|
||||
$responsePercent = round(($numResponses/$totalResponses)*100);
|
||||
} else {
|
||||
$responsePercent = 0;
|
||||
}
|
||||
my @commentloop;
|
||||
my $comments = $db->read("select answerComment from Survey_tempReport
|
||||
where sectionNumber=? and questionNumber=? and answerNumber=?",
|
||||
[$sectionIndex,$questionIndex,$answerIndex]);
|
||||
while (my ($comment) = $comments->array) {
|
||||
push(@commentloop,{
|
||||
'answer_comment'=>$comment
|
||||
});
|
||||
}
|
||||
push(@answerloop,{
|
||||
'answer_isCorrect'=>$survey->answer( [ $sectionIndex, $questionIndex, $answerIndex ] )->{isCorrect},
|
||||
'answer' => $survey->answer( [ $sectionIndex, $questionIndex, $answerIndex ] )->{text},
|
||||
'answer_response_count' =>$numResponses,
|
||||
'answer_response_percent' =>$responsePercent,
|
||||
'comment_loop'=>\@commentloop
|
||||
});
|
||||
}
|
||||
}
|
||||
else{
|
||||
my $responses = $db->read("select value,answerComment from Survey_tempReport
|
||||
where sectionNumber=? and questionNumber=?",
|
||||
[$sectionIndex,$questionIndex]);
|
||||
while (my $response = $responses->hashRef) {
|
||||
push(@answerloop,{
|
||||
'answer_value' =>$response->{value},
|
||||
'answer_comment' =>$response->{answerComment}
|
||||
});
|
||||
}
|
||||
}
|
||||
push(@questionloop,{
|
||||
'question' => $question->{text},
|
||||
'question_id' => $sectionIndex.'_'.$questionIndex,
|
||||
'question_isMultipleChoice' => ($questionType eq "Multiple Choice"),
|
||||
'question_response_total' => $totalResponses,
|
||||
'answer_loop' => \@answerloop,
|
||||
'questionallowComment' => $question->{allowComment}
|
||||
});
|
||||
} ## end for ( my $questionIndex = 0; $questionIndex <= ...
|
||||
}
|
||||
$paginator->setDataByArrayRef(\@questionloop);
|
||||
@questionloop = @{$paginator->getPageData};
|
||||
|
||||
} ## end sub www_viewGradeBook
|
||||
$var->{question_loop} = \@questionloop;
|
||||
$paginator->appendTemplateVars($var);
|
||||
|
||||
my $out = $self->processTemplate( $var, $self->get("overviewTemplateId") );
|
||||
return $self->session->style->process( $out, $self->get("styleTemplateId") );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_exportSimpleResults {
|
||||
|
|
@ -1224,6 +1555,48 @@ sub www_exportSimpleResults {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_exportTransposedResults (){
|
||||
|
||||
Returns transposed results as a tabbed file.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_exportTransposedResults {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get("groupToViewReports") ) );
|
||||
|
||||
$self->loadTempReportTable();
|
||||
|
||||
my $filename = $self->session->url->escape( $self->get("title") . "_transposedResults.tab" );
|
||||
my $content
|
||||
= $self->session->db->quickTab(
|
||||
"select r.userId, r.username, r.ipAddress, r.startDate, r.endDate, r.isComplete, t.*
|
||||
from Survey_tempReport t
|
||||
left join Survey_response r using(Survey_responseId)
|
||||
where t.assetId=?
|
||||
order by r.userId, r.Survey_responseId, t.order",
|
||||
[ $self->getId() ] );
|
||||
return $self->export( $filename, $content );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 export($filename,$content)
|
||||
|
||||
Exports the data in $content to $filename, then forwards the user to $filename.
|
||||
|
||||
=head3 $filename
|
||||
|
||||
The name of the file you want exported.
|
||||
|
||||
=head3 $content
|
||||
|
||||
The data you want exported (CSV, tab, whatever).
|
||||
|
||||
=cut
|
||||
|
||||
sub export {
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
|
|
@ -1246,6 +1619,16 @@ sub export {
|
|||
return undef;
|
||||
} ## end sub export
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 loadTempReportTable
|
||||
|
||||
Loads the responses from the survey into the Survey_tempReport table, so that other or custom reports can be ran against this data.
|
||||
|
||||
=cut
|
||||
|
||||
sub loadTempReportTable {
|
||||
my $self = shift;
|
||||
|
||||
|
|
|
|||
|
|
@ -1086,6 +1086,12 @@ sub aIndexes {
|
|||
|
||||
=head2 returnResponsesForReporting
|
||||
|
||||
Used to extract JSON responses for use in reporting results.
|
||||
|
||||
Returns an array ref containing the current responses to the survey. The array ref contains a list of hashes with the section, question,
|
||||
sectionName, questionName, questionComment, and an answer array ref. The answer array ref contains a list of hashes, with isCorrect (1 true, 0 false),
|
||||
recorded value, and the id of the answer.
|
||||
|
||||
=cut
|
||||
|
||||
# TODO: This sub should make use of recordedResponses
|
||||
|
|
|
|||
|
|
@ -1253,6 +1253,25 @@ sub question {
|
|||
return $self->sections->[ $address->[0] ]->{questions}->[ $address->[1] ];
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 questionCount (){
|
||||
|
||||
Return the total number of questions in this survey.
|
||||
|
||||
=cut
|
||||
|
||||
sub questionCount {
|
||||
my $self = shift;
|
||||
my $count;
|
||||
for ( my $s = 0; $s <= $#{ $self->sections() }; $s++ ) {
|
||||
$count = $count + scalar @{$self->questions( [$s] )};
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 answers ($address)
|
||||
|
||||
Return a reference to all answers from a particular question.
|
||||
|
|
|
|||
|
|
@ -146,14 +146,17 @@ sub generateFeed {
|
|||
$value = $cache->setByHTTP($url, $self->get("cacheTimeout"));
|
||||
$newlyCached = 1;
|
||||
}
|
||||
utf8::downgrade($value);
|
||||
# if the content can be downgraded, it is either valid latin1 or didn't have
|
||||
# an HTTP Content-Encoding header. In the second case, XML::FeedPP will take
|
||||
# care of any encoding specified in the XML prolog
|
||||
utf8::downgrade($value, 1);
|
||||
eval {
|
||||
my $singleFeed = XML::FeedPP->new($value, utf8_flag => 1);
|
||||
$feed->merge($singleFeed);
|
||||
};
|
||||
if (my $e = WebGUI::Error->caught()) {
|
||||
$log->error("Syndicated Content asset (".$self->getId.") has a bad feed URL (".$url."). Failed with ".$e->message);
|
||||
}
|
||||
if ($@) {
|
||||
$log->error("Syndicated Content asset (".$self->getId.") has a bad feed URL (".$url."). Failed with ".$@);
|
||||
}
|
||||
}
|
||||
|
||||
# build a new feed that matches the term the user is interested in
|
||||
|
|
@ -196,9 +199,9 @@ sub getTemplateVariables {
|
|||
my @items = $feed->get_item;
|
||||
my %var;
|
||||
$var{channel_title} = WebGUI::HTML::filter($feed->title, 'javascript');
|
||||
$var{channel_description} = WebGUI::HTML::filter($feed->description, 'javascript');
|
||||
$var{channel_date} = WebGUI::HTML::filter($feed->get_pubDate_epoch, 'javascript');
|
||||
$var{channel_copyright} = WebGUI::HTML::filter($feed->copyright, 'javascript');
|
||||
$var{channel_description} = WebGUI::HTML::filter(scalar($feed->description), 'javascript');
|
||||
$var{channel_date} = WebGUI::HTML::filter(scalar($feed->get_pubDate_epoch), 'javascript');
|
||||
$var{channel_copyright} = WebGUI::HTML::filter(scalar($feed->copyright), 'javascript');
|
||||
$var{channel_link} = WebGUI::HTML::filter($feed->link, 'javascript');
|
||||
my @image = $feed->image;
|
||||
$var{channel_image_url} = WebGUI::HTML::filter($image[0], 'javascript');
|
||||
|
|
@ -215,7 +218,7 @@ sub getTemplateVariables {
|
|||
$item{author} = WebGUI::HTML::filter($object->author, 'javascript');
|
||||
$item{guid} = WebGUI::HTML::filter($object->guid, 'javascript');
|
||||
$item{link} = WebGUI::HTML::filter($object->link, 'javascript');
|
||||
$item{description} = WebGUI::HTML::filter($object->description, 'javascript');
|
||||
$item{description} = WebGUI::HTML::filter(scalar($object->description), 'javascript');
|
||||
$item{descriptionFirst100words} = $item{description};
|
||||
$item{descriptionFirst100words} =~ s/(((\S+)\s+){100}).*/$1/s;
|
||||
$item{descriptionFirst75words} = $item{descriptionFirst100words};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ use base 'WebGUI::Asset::Wobject';
|
|||
use WebGUI::Asset::Wobject::ProjectManager;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
|
@ -82,6 +87,11 @@ sub definition {
|
|||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 prepareView
|
||||
|
||||
=cut
|
||||
|
||||
sub prepareView {
|
||||
my $self = shift;
|
||||
$self->SUPER::prepareView();
|
||||
|
|
@ -96,6 +106,11 @@ sub prepareView {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 processErrors
|
||||
|
||||
=cut
|
||||
|
||||
sub processErrors {
|
||||
my $self = shift;
|
||||
my $errors = "";
|
||||
|
|
@ -111,6 +126,11 @@ sub processErrors {
|
|||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 purge
|
||||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
#purge your wobject-specific data here. This does not include fields
|
||||
|
|
@ -119,6 +139,11 @@ sub purge {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDaysInWeek
|
||||
|
||||
=cut
|
||||
|
||||
sub getDaysInWeek {
|
||||
my $self = shift;
|
||||
my $week = $_[0];
|
||||
|
|
@ -142,6 +167,11 @@ sub getDaysInWeek {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getSessionVars
|
||||
|
||||
=cut
|
||||
|
||||
sub getSessionVars {
|
||||
my $self = shift;
|
||||
my @vars = @_;
|
||||
|
|
@ -159,6 +189,11 @@ sub getSessionVars {
|
|||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 view
|
||||
|
||||
=cut
|
||||
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
|
|
@ -197,6 +232,11 @@ sub view {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editTimeEntrySave
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editTimeEntrySave {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$user,$eh,$dt) = $self->getSessionVars("privilege","form","db","user","errorHandler","datetime");
|
||||
|
|
@ -271,6 +311,11 @@ sub www_editTimeEntrySave {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteProject
|
||||
|
||||
=cut
|
||||
|
||||
sub www_deleteProject {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$user,$eh,$config) = $self->getSessionVars("privilege","form","db","user","errorHandler","config");
|
||||
|
|
@ -293,6 +338,11 @@ sub www_deleteProject {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editProject
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editProject {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$user,$eh,$config) = $self->getSessionVars("privilege","form","db","user","errorHandler","config");
|
||||
|
|
@ -393,6 +443,11 @@ sub www_editProject {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editProjectSave
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editProjectSave {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$dt,$user,$eh) = $self->getSessionVars("privilege","form","db","datetime","user","errorHandler");
|
||||
|
|
@ -453,6 +508,11 @@ sub www_editProjectSave {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_manageProjects
|
||||
|
||||
=cut
|
||||
|
||||
sub www_manageProjects {
|
||||
my $self = shift;
|
||||
my ($session,$privilege,$form,$db,$dt,$user,$eh,$config) = $self->getSessionVars("privilege","form","db","datetime","user","errorHandler","config");
|
||||
|
|
@ -574,6 +634,11 @@ sub www_manageProjects {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_buildTimeTable
|
||||
|
||||
=cut
|
||||
|
||||
sub www_buildTimeTable {
|
||||
my $self = shift;
|
||||
my $viewVar = $_[0];
|
||||
|
|
@ -738,6 +803,11 @@ sub www_buildTimeTable {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _buildRow
|
||||
|
||||
=cut
|
||||
|
||||
sub _buildRow {
|
||||
my $self = shift;
|
||||
my ($session,$dt,$eh,$form,$db,$user) = $self->getSessionVars("datetime","errorHandler","form","db","user");
|
||||
|
|
@ -762,20 +832,41 @@ sub _buildRow {
|
|||
-name=>"taskEntryId_$rowCount",
|
||||
-value=>$entryId
|
||||
});
|
||||
|
||||
#Entry Date
|
||||
|
||||
##Handle cases when a user has been removed from a project. The projectList
|
||||
##and taskList hash refs that have been passed in will not contain entries for
|
||||
##their old project info
|
||||
|
||||
#Entry Task
|
||||
tie my %taskHash, "Tie::IxHash";
|
||||
if ($projectId) {
|
||||
if (! exists $projectList->{$projectId}) {
|
||||
my $projectName = $db->quickScalar('select projectName from TT_projectList where projectId=?',[$projectId]);
|
||||
$projectList->{$projectId} = $projectName;
|
||||
}
|
||||
if (! exists $taskList->{$projectId}) {
|
||||
%taskHash = $db->buildHash("select taskId, taskName from TT_projectTasks where projectId=?",[$projectId]);
|
||||
}
|
||||
else {
|
||||
%taskHash = %{$taskList->{$projectId}};
|
||||
}
|
||||
#$eh->warn($projectId);
|
||||
}
|
||||
my $chooseLabel = $i18n->get("Choose One");
|
||||
%taskHash = (""=>$chooseLabel,%taskHash);
|
||||
|
||||
#Entry Date
|
||||
$var->{'entry.hours'} = $entry->{hours};
|
||||
if($reportComplete) {
|
||||
$var->{'form.date'} = $entry->{taskDate};
|
||||
$var->{'form.project'} = $projectList->{$projectId};
|
||||
|
||||
my $taskHash = $taskList->{$projectId};
|
||||
$var->{'form.task'} = $taskHash->{$entry->{taskId}};
|
||||
$var->{'form.task'} = $taskHash{$entry->{taskId}};
|
||||
$var->{'form.hours'} = $var->{'entry.hours'};
|
||||
$var->{'form.comments'} = $entry->{comments};
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
tie my %days, "Tie::IxHash";
|
||||
%days = (""=>$chooseLabel, %{$daysInWeek});
|
||||
$var->{'form.date'} = WebGUI::Form::selectBox($session,{
|
||||
|
|
@ -793,15 +884,7 @@ sub _buildRow {
|
|||
-value=>$projectId,
|
||||
-extras=>qq|onchange="changeOptions(this,document.getElementById('$taskId'));" class="pt-select"|
|
||||
});
|
||||
|
||||
#Entry Task
|
||||
tie my %taskHash, "Tie::IxHash";
|
||||
%taskHash = (""=>$chooseLabel,%taskHash);
|
||||
if($projectId) {
|
||||
#$eh->warn($projectId);
|
||||
%taskHash = %{$taskList->{$projectId}};
|
||||
}
|
||||
|
||||
|
||||
$var->{'form.task'} = WebGUI::Form::selectBox($session,{
|
||||
-name=>$taskName,
|
||||
-options=>\%taskHash,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,20 @@ These methods are available from this class:
|
|||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 canPaste ( )
|
||||
|
||||
Allows assets to have a say if they can be pasted. For example, it makes no sense to
|
||||
paste a wiki page anywhere else but a wiki master.
|
||||
|
||||
=cut
|
||||
|
||||
sub canPaste {
|
||||
my $self = shift;
|
||||
return $self->validParent($self->session); ##Lazy call to a class method
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 cut ( )
|
||||
|
|
@ -47,12 +61,13 @@ Removes asset from lineage, places it in clipboard state. The "gap" in the linea
|
|||
=cut
|
||||
|
||||
sub cut {
|
||||
my $self = shift;
|
||||
return undef if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage"));
|
||||
$self->session->db->beginTransaction;
|
||||
$self->session->db->write("update asset set state='clipboard-limbo' where lineage like ? and state='published'",[$self->get("lineage").'%']);
|
||||
$self->session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$self->session->user->userId, $self->session->datetime->time(), $self->getId]);
|
||||
$self->session->db->commit;
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
return undef if ($self->getId eq $session->setting->get("defaultPage") || $self->getId eq $session->setting->get("notFoundPage"));
|
||||
$session->db->beginTransaction;
|
||||
$session->db->write("update asset set state='clipboard-limbo' where lineage like ? and state='published'",[$self->get("lineage").'%']);
|
||||
$session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$session->user->userId, $session->datetime->time(), $self->getId]);
|
||||
$session->db->commit;
|
||||
$self->updateHistory("cut");
|
||||
$self->{_properties}{state} = "clipboard";
|
||||
$self->purgeCache;
|
||||
|
|
@ -172,6 +187,7 @@ sub paste {
|
|||
my $assetId = shift;
|
||||
my $pastedAsset = WebGUI::Asset->newByDynamicClass($self->session,$assetId);
|
||||
return 0 unless ($self->get("state") eq "published");
|
||||
return 0 unless ($pastedAsset->canPaste()); ##Allow pasted assets to have a say about pasting.
|
||||
|
||||
# Don't allow a shortcut to create an endless loop
|
||||
return 0 if ($pastedAsset->get("className") eq "WebGUI::Asset::Shortcut" && $pastedAsset->get("shortcutToAssetId") eq $self->getId);
|
||||
|
|
@ -261,11 +277,12 @@ sub www_copyList {
|
|||
=cut
|
||||
|
||||
sub www_createShortcut {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless ($self->session->user->isInGroup(4));
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
return $session->privilege->insufficient() unless ($self->session->user->isInGroup(4));
|
||||
my $isOnDashboard = $self->getParent->isa('WebGUI::Asset::Wobject::Dashboard');
|
||||
|
||||
my $shortcutParent = $isOnDashboard? $self->getParent : WebGUI::Asset->getImportNode($self->session);
|
||||
my $shortcutParent = $isOnDashboard? $self->getParent : WebGUI::Asset->getImportNode($session);
|
||||
my $child = $shortcutParent->addChild({
|
||||
className=>'WebGUI::Asset::Shortcut',
|
||||
shortcutToAssetId=>$self->getId,
|
||||
|
|
@ -283,11 +300,11 @@ sub www_createShortcut {
|
|||
if (! $isOnDashboard) {
|
||||
$child->cut;
|
||||
}
|
||||
if (WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session, {
|
||||
if (WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, {
|
||||
allowComments => 1,
|
||||
returnUrl => $self->getUrl,
|
||||
})) {
|
||||
return undef;
|
||||
}) eq 'redirect') {
|
||||
return 'redirect';
|
||||
};
|
||||
|
||||
if ($isOnDashboard) {
|
||||
|
|
@ -467,11 +484,12 @@ Returns "". Pastes an asset. If canEdit is False, returns an insufficient privil
|
|||
=cut
|
||||
|
||||
sub www_paste {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
my $pasteAssetId = $self->session->form->process('assetId');
|
||||
my $pasteAsset = WebGUI::Asset->newPending($self->session, $pasteAssetId);
|
||||
return $self->session->privilege->insufficient() unless $pasteAsset->canEdit;
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
my $pasteAssetId = $session->form->process('assetId');
|
||||
my $pasteAsset = WebGUI::Asset->newPending($session, $pasteAssetId);
|
||||
return $session->privilege->insufficient() unless $pasteAsset->canEdit;
|
||||
$self->paste($pasteAssetId);
|
||||
return "";
|
||||
}
|
||||
|
|
@ -487,10 +505,9 @@ Returns a www_manageAssets() method. Pastes a selection of assets. If canEdit is
|
|||
sub www_pasteList {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
foreach my $clipId ($self->session->form->param("assetId")) {
|
||||
ASSET: foreach my $clipId ($self->session->form->param("assetId")) {
|
||||
my $pasteAsset = WebGUI::Asset->newPending($self->session, $clipId);
|
||||
next
|
||||
unless $pasteAsset->canEdit;
|
||||
next ASSET unless $pasteAsset->canEdit;
|
||||
$self->paste($clipId);
|
||||
}
|
||||
return $self->www_manageAssets();
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ sub addChild {
|
|||
# Check if it is possible to add a child to this asset. If not add it as a sibling of this asset.
|
||||
if (length($self->get("lineage")) >= 252) {
|
||||
$self->session->errorHandler->warn('Tried to add child to asset "'.$self->getId.'" which is already on the deepest level. Adding it as a sibling instead.');
|
||||
return $self->getParent->addChild($properties, $id, $now);
|
||||
return $self->getParent->addChild($properties, $id, $now, $options);
|
||||
}
|
||||
my $lineage = $self->get("lineage").$self->getNextChildRank;
|
||||
$self->{_hasChildren} = 1;
|
||||
|
|
|
|||
|
|
@ -149,13 +149,20 @@ sub importAssetData {
|
|||
}
|
||||
if ($revisionExists) { # update an existing revision
|
||||
$asset = WebGUI::Asset->new($self->session, $id, $class, $version);
|
||||
|
||||
##If the existing asset is not committed, do not allow the new package data to
|
||||
##change the version control status.
|
||||
if ( $asset->get('status') eq 'pending'
|
||||
&& $properties{'status'} ne 'pending' ) {
|
||||
delete $properties{status};
|
||||
}
|
||||
$error->info("Updating an existing revision of asset $id");
|
||||
$asset->update($data->{properties});
|
||||
$asset->update(\%properties);
|
||||
##Pending assets are assigned a new version tag
|
||||
if ($data->{properties}->{status} eq 'pending') {
|
||||
if ($properties{status} eq 'pending') {
|
||||
$self->session->db->write(
|
||||
'update assetData set tagId=? where assetId=? and revisionDate='.$data->{properties}->{revisionDate},
|
||||
[WebGUI::VersionTag->getWorking($self->session)->getId, $data->{properties}->{assetId}]
|
||||
'update assetData set tagId=? where assetId=? and revisionDate=?',
|
||||
[WebGUI::VersionTag->getWorking($self->session)->getId, $properties{assetId}, $properties{revisionDate},]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ sub www_ajaxGetManagerPage {
|
|||
revisionDate => $asset->get( "revisionDate" ),
|
||||
childCount => $asset->getChildCount,
|
||||
assetSize => $asset->get( 'assetSize' ),
|
||||
lockedBy => $asset->get( 'isLockedBy' ),
|
||||
lockedBy => ($asset->get( 'isLockedBy' ) ? $asset->lockedBy->username : ''),
|
||||
actions => $asset->canEdit && $asset->canEditIfLocked,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use strict;
|
|||
use base 'WebGUI::Form::List';
|
||||
use WebGUI::Form::Checkbox;
|
||||
use WebGUI::Form::Button;
|
||||
use WebGUI::Form::Hidden;
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -129,6 +130,18 @@ sub isDynamicCompatible {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isInRequest ( )
|
||||
|
||||
=cut
|
||||
|
||||
sub isInRequest {
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
return $form->hasParam($self->privateName('isIn'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders a series of checkboxes.
|
||||
|
|
@ -136,8 +149,10 @@ Renders a series of checkboxes.
|
|||
=cut
|
||||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $output = '<fieldset style="border:none;margin:0;padding:0">';
|
||||
$output .= WebGUI::Form::Hidden($session, { name => $self->privateName('isIn'), value => 1, });
|
||||
my $alignment = $self->alignmentSeparator;
|
||||
|
||||
# Add the select all button
|
||||
|
|
@ -153,7 +168,7 @@ sub toHtml {
|
|||
? 1
|
||||
: 0
|
||||
;
|
||||
$output .= WebGUI::Form::Checkbox->new($self->session, {
|
||||
$output .= WebGUI::Form::Checkbox->new($session, {
|
||||
name => $self->get('name'),
|
||||
value => $key,
|
||||
extras => $self->get('extras'),
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ sub getOriginalValue {
|
|||
|
||||
=head2 getDefaultValue ( )
|
||||
|
||||
Returns the "defaultValue" passed in to the object in that order
|
||||
Returns the "defaultValue".
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -454,10 +454,8 @@ Depricated. See getValue().
|
|||
# getValueFromPost is deprecated, use getValue
|
||||
sub getValueFromPost {
|
||||
my $self = shift;
|
||||
if ($self->session->request) {
|
||||
my $value = $self->session->form->param($self->get("name"));
|
||||
return $value if (defined $value);
|
||||
}
|
||||
my $value = $self->session->form->param($self->get("name"));
|
||||
return $value if (defined $value);
|
||||
return $self->getDefaultValue;
|
||||
}
|
||||
|
||||
|
|
@ -475,6 +473,25 @@ sub isDynamicCompatible {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isInRequest ( )
|
||||
|
||||
Object method that returns true if the form variables for this control exist in the
|
||||
posted data from the client. This is required for all controls that are dynamic
|
||||
compatible (->isDynamicCompatible=1). It should be overridden by any class that
|
||||
changes the name of the form variable, or uses more than 1 named element per form.
|
||||
|
||||
This method should only depend on the form name, and not secondary form properties
|
||||
such as value, defaultValue or storage or asset id's.
|
||||
|
||||
=cut
|
||||
|
||||
sub isInRequest {
|
||||
my $self = shift;
|
||||
return $self->session->form->hasParam($self->get('name'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isProfileEnabled ( session )
|
||||
|
||||
Depricated. See isDynamicCompatible().
|
||||
|
|
@ -484,7 +501,6 @@ Depricated. See isDynamicCompatible().
|
|||
|
||||
sub isProfileEnabled {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
return $class->isDynamicCompatible();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -240,6 +240,21 @@ sub isDynamicCompatible {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isInRequest ( )
|
||||
|
||||
=cut
|
||||
|
||||
sub isInRequest {
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
my $name = $self->get('name');
|
||||
my $isInRequest = $form->hasParam($name.'_file')
|
||||
|| $form->hasParam($self->privateName('action'));
|
||||
return $isInRequest;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders a file upload control.
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ Package WebGUI::Form::HexSlider
|
|||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Creates a slider control that controls hex values, as in the red, gree, blue values for HTML colors.
|
||||
Creates a slider control that controls hex values, as in the red, green, blue values for HTML colors.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
This is a subclass of WebGUI::Form::Control.
|
||||
This is a subclass of WebGUI::Form::Slider.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
|
|
|
|||
|
|
@ -123,22 +123,6 @@ sub getName {
|
|||
return WebGUI::International->new($session, 'WebGUI')->get('image');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getStorageLocation ( )
|
||||
|
||||
Returns the WebGUI::Storage object for this control.
|
||||
|
||||
=cut
|
||||
|
||||
sub getStorageLocation {
|
||||
my $self = shift;
|
||||
my $value = $self->getOriginalValue;
|
||||
my $storage = WebGUI::Storage->get($self->session, $value) if ($value);
|
||||
return $storage;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValue ( )
|
||||
|
|
|
|||
|
|
@ -143,6 +143,20 @@ sub isDynamicCompatible {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isInRequest ( )
|
||||
|
||||
=cut
|
||||
|
||||
sub isInRequest {
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
my $name = $self->get('name');
|
||||
return $form->hasParam($name.'_interval')
|
||||
|| $form->hasParam($name.'_units');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders an interval control.
|
||||
|
|
|
|||
|
|
@ -268,27 +268,16 @@ sub getOriginalValue {
|
|||
@values = @{$value};
|
||||
}
|
||||
else {
|
||||
$value =~ s/\r//g;
|
||||
$value =~ s/\r//g;
|
||||
@values = split "\n", $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(@values){
|
||||
return wantarray ? @values : join("\n",@values);
|
||||
if (@values) {
|
||||
return wantarray ? @values : join("\n",@values);
|
||||
}
|
||||
|
||||
foreach my $value ($self->getDefaultValue()) {
|
||||
if (scalar @values < 1 && defined $value) {
|
||||
if (ref $value eq "ARRAY") {
|
||||
@values = @{$value};
|
||||
}
|
||||
else {
|
||||
$value =~ s/\r//g;
|
||||
@values = split "\n", $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return wantarray ? @values : join("\n",@values);
|
||||
|
||||
return $self->getDefaultValue;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ Returns the human readable name of this control.
|
|||
|
||||
sub getName {
|
||||
my ($self, $session) = @_;
|
||||
return WebGUI::International->new($session, 'Form_MatrixCompare')->get('topicName');
|
||||
return WebGUI::International->new($session, 'Form_MatrixCompare')->get('matrix compare');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ sub definition {
|
|||
my $i18n = WebGUI::International->new($session);
|
||||
push(@{$definition}, {
|
||||
label=>{
|
||||
defaultValue=>$i18n->get("matrix fieldtype","WebGUI")
|
||||
defaultValue=>$i18n->get("matrix fieldtype","Asset_Matrix")
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
|
|
@ -95,7 +95,7 @@ Returns the human readable name of this control.
|
|||
|
||||
sub getName {
|
||||
my ($self, $session) = @_;
|
||||
return WebGUI::International->new($session, 'WebGUI')->get('matrix fieldtype');
|
||||
return WebGUI::International->new($session, 'Asset_Matrix')->get('matrix fieldtype');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -98,6 +98,19 @@ sub isDynamicCompatible {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isInRequest ( )
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub isInRequest {
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
return $form->hasParam($self->privateName('isIn'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders a select list form control.
|
||||
|
|
@ -105,9 +118,10 @@ Renders a select list form control.
|
|||
=cut
|
||||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $multiple = $self->get("multiple") ? ' multiple="multiple"' : '';
|
||||
my $output = '<select name="'.($self->get("name")||'').'" size="'.($self->get("size")||'').'" id="'.($self->get('id')||'').'" '.($self->get("extras")||'').$multiple.'>';
|
||||
my $output = '<select name="'.($self->get("name")||'').'" size="'.($self->get("size")||'').'" id="'.($self->get('id')||'').'" '.($self->get("extras")||'').$multiple.'>';
|
||||
my $options = $self->getOptions;
|
||||
my @values = $self->getOriginalValue();
|
||||
foreach my $key (keys %{$options}) {
|
||||
|
|
@ -120,6 +134,7 @@ sub toHtml {
|
|||
$output .= '>'.$options->{$key}.'</option>';
|
||||
}
|
||||
$output .= '</select>'."\n";
|
||||
$output .= WebGUI::Form::Hidden($session, { name => $self->privateName('isIn'), value => 1, });
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,15 +21,16 @@ use WebGUI::International;
|
|||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Form::HexSlider
|
||||
Package WebGUI::Form::SelectSlider
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Creates a slider control that controls hex values, as in the red, gree, blue values for HTML colors.
|
||||
Creates a slider control that chooses arbitrary, programmer supplied values. Similar
|
||||
to a SelectBox, but with a different UI.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
This is a subclass of WebGUI::Form::Control.
|
||||
This is a subclass of WebGUI::Form::Slider.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Package WebGUI::Form::TimeZone
|
|||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Creates a template chooser control.
|
||||
Creates a time zone chooser control.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ sub getValue {
|
|||
$value =~ tr/\r\n//d;
|
||||
# empty
|
||||
if ($value eq "" || $value =~ m{^http://$}i) {
|
||||
return undef;
|
||||
return "";
|
||||
}
|
||||
# proper email url
|
||||
elsif ($value =~ /mailto:/) {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ sub approveAddRequest {
|
|||
|
||||
=head2 delete ( \@userIds )
|
||||
|
||||
Remove friends.
|
||||
Remove friends. Also removes the reciprocal relationship.
|
||||
|
||||
=head3 userIds
|
||||
|
||||
|
|
@ -116,7 +116,13 @@ An array reference of userIds to remove from friends list.
|
|||
sub delete {
|
||||
my $self = shift;
|
||||
my $userIds = shift;
|
||||
$self->user->friends->deleteUsers($userIds);
|
||||
my $me = $self->user;
|
||||
|
||||
$me->friends->deleteUsers($userIds);
|
||||
foreach my $userId (@{$userIds}) {
|
||||
my $friend = WebGUI::User->new($self->session, $userId);
|
||||
$friend->friends->deleteUsers([$me->userId]);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ package WebGUI::HTML;
|
|||
|
||||
=cut
|
||||
|
||||
use HTML::TokeParser;
|
||||
use HTML::TagFilter;
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
|
|
@ -36,6 +37,7 @@ A package for manipulating and massaging HTML.
|
|||
$html = WebGUI::HTML::html2text($html);
|
||||
$html = WebGUI::HTML::makeAbsolute($session, $html);
|
||||
$html = WebGUI::HTML::processReplacements($session, $html);
|
||||
$html = WebGUI::HTML::splitTag([$tag,]$html[,$count]); # defaults to ( 'p', $html, 1 )
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
|
|
@ -396,5 +398,50 @@ sub processReplacements {
|
|||
return $content;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 WebGUI::HTML::splitTag([$tag,]$html[,$count]);
|
||||
|
||||
splits an block of HTML into an array based on the contents of a single tag
|
||||
|
||||
=head3 tag
|
||||
|
||||
The HTML tag top extract from the text. this defaults to 'p' giving a list of paragraphs
|
||||
|
||||
=head3 html
|
||||
|
||||
The block of HTML text that will be disected
|
||||
|
||||
=head3 count
|
||||
|
||||
How many items do we want? defaults to 1; returns 1 non-blank item; -1 returns all items
|
||||
|
||||
=cut
|
||||
|
||||
sub splitTag {
|
||||
|
||||
my $tag = shift;
|
||||
my $html = shift;
|
||||
my $count = shift || 1;
|
||||
if( not defined $html or $html =~ /^(-?\d+)$/ ) {
|
||||
$count = $html if $1;
|
||||
$html = $tag;
|
||||
$tag = 'p'; # the default tag is 'p' -- grabs a paragraph
|
||||
}
|
||||
my @result;
|
||||
|
||||
my $p = HTML::TokeParser->new(\$html);
|
||||
|
||||
while (my $token = $p->get_tag($tag)) {
|
||||
my $text = $p->get_trimmed_text("/$tag");
|
||||
next if $text =~ /^([[:space:]]|[[:^print:]])*$/; # skip whitespace
|
||||
push @result, $text; # add the text between the tags to the result array
|
||||
last if @result == $count; # if we have a full count then quit
|
||||
}
|
||||
|
||||
return @result if wantarray;
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use strict;
|
|||
|
||||
our $HELP = {
|
||||
'survey template' => {
|
||||
title => '88',
|
||||
title => 'survey template title',
|
||||
body => '',
|
||||
fields => [],
|
||||
isa => [
|
||||
|
|
@ -15,93 +15,50 @@ our $HELP = {
|
|||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'question.add.url' },
|
||||
{ 'name' => 'question.add.label' },
|
||||
{ 'name' => 'section.add.url' },
|
||||
{ 'name' => 'section.add.label' },
|
||||
{ 'name' => 'user.canTakeSurvey' },
|
||||
{ 'name' => 'form.header' },
|
||||
{ 'name' => 'form.footer' },
|
||||
{ 'name' => 'form.submit' },
|
||||
{ 'name' => 'questions.sofar.label' },
|
||||
{ 'name' => 'start.newresponse.label' },
|
||||
{ 'name' => 'start.newresponse.url' },
|
||||
{ 'name' => 'thanks.survey.label' },
|
||||
{ 'name' => 'thanks.quiz.label' },
|
||||
{ 'name' => 'questions.total' },
|
||||
{ 'name' => 'questions.correct.count.label' },
|
||||
{ 'name' => 'questions.correct.percent.label' },
|
||||
{ 'name' => 'mode.isSurvey' },
|
||||
{ 'name' => 'survey.noprivs.label' },
|
||||
{ 'name' => 'quiz.noprivs.label' },
|
||||
{ 'name' => 'response.id' },
|
||||
{ 'name' => 'response.count' },
|
||||
{ 'name' => 'user.isFirstResponse' },
|
||||
{ 'name' => 'user.canRespondAgain' },
|
||||
{ 'name' => 'questions.sofar.count' },
|
||||
{ 'name' => 'questions.correct.count' },
|
||||
{ 'name' => 'questions.correct.percent' },
|
||||
{ 'name' => 'response.isComplete' },
|
||||
{ 'name' => 'section.edit_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'section.edit.controls' },
|
||||
{ 'name' => 'section.edit.sectionName' },
|
||||
{ 'name' => 'section.edit.id' },
|
||||
{ 'name' => 'section.questions_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'question.edit.controls' },
|
||||
{ 'name' => 'question.edit.question' },
|
||||
{ 'name' => 'question.edit.id' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{ 'name' => 'question_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'question.question' },
|
||||
{ 'name' => 'question.allowComment' },
|
||||
{ 'name' => 'question.id' },
|
||||
{ 'name' => 'question.comment.field' },
|
||||
{ 'name' => 'question.comment.label' },
|
||||
{ 'name' => 'question.answer.field' }
|
||||
]
|
||||
},
|
||||
{ 'name' => 'lastResponseCompleted' },
|
||||
{ 'name' => 'lastResponseTimedOut' },
|
||||
{ 'name' => 'maxResponsesSubmitted' },
|
||||
],
|
||||
related => []
|
||||
related => [
|
||||
{ tag => 'gradebook report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'statistical overview report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey section edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey question edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey answer edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'survey template common vars' => {
|
||||
title => '90',
|
||||
private => 1,
|
||||
title => 'survey template common vars title',
|
||||
body => '',
|
||||
fields => [],
|
||||
variables => [
|
||||
{ 'name' => 'user.canViewReports' },
|
||||
{ 'name' => 'delete.all.responses.url' },
|
||||
{ 'name' => 'delete.all.responses.label' },
|
||||
{ 'name' => 'export.answers.url' },
|
||||
{ 'name' => 'export.answers.label' },
|
||||
{ 'name' => 'export.questions.url' },
|
||||
{ 'name' => 'export.questions.label' },
|
||||
{ 'name' => 'export.responses.url' },
|
||||
{ 'name' => 'export.responses.label' },
|
||||
{ 'name' => 'export.composite.url' },
|
||||
{ 'name' => 'export.composite.label' },
|
||||
{ 'name' => 'report.gradebook.url' },
|
||||
{ 'name' => 'report.gradebook.label' },
|
||||
{ 'name' => 'report.overview.url' },
|
||||
{ 'name' => 'report.overview.label' },
|
||||
{ 'name' => 'survey.url' },
|
||||
{ 'name' => 'survey.label' }
|
||||
{ 'name' => 'user_canTakeSurvey' },
|
||||
{ 'name' => 'user_canViewReports' },
|
||||
{ 'name' => 'user_canEditSurvey' },
|
||||
{ 'name' => 'edit_survey_url' },
|
||||
{ 'name' => 'take_survey_url' },
|
||||
{ 'name' => 'view_simple_results_url' },
|
||||
{ 'name' => 'view_transposed_results_url' },
|
||||
{ 'name' => 'view_statistical_overview_url' },
|
||||
{ 'name' => 'view_grade_book_url' },
|
||||
],
|
||||
related => [
|
||||
{ tag => 'survey template',
|
||||
namespace => 'Asset_Survey'
|
||||
}
|
||||
]
|
||||
related => []
|
||||
},
|
||||
|
||||
'gradebook report template' => {
|
||||
title => '1087',
|
||||
title => 'gradebook report template title',
|
||||
body => '',
|
||||
fields => [],
|
||||
isa => [
|
||||
|
|
@ -116,17 +73,12 @@ our $HELP = {
|
|||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'title' },
|
||||
{ 'name' => 'question.count' },
|
||||
{ 'name' => 'response.user.label' },
|
||||
{ 'name' => 'response.count.label' },
|
||||
{ 'name' => 'response.percent.label' },
|
||||
{ 'name' => 'question_count' },
|
||||
{ 'name' => 'response_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'response.url' },
|
||||
{ 'name' => 'response.user.name' },
|
||||
{ 'name' => 'response.count.correct' },
|
||||
{ 'name' => 'response.percent' }
|
||||
{ 'name' => 'response_user_name' },
|
||||
{ 'name' => 'response_count_correct' },
|
||||
{ 'name' => 'response_percent' }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -134,13 +86,26 @@ our $HELP = {
|
|||
{ tag => 'survey template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'statistical overview report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey section edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey question edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey answer edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'survey response template' => {
|
||||
title => '1089',
|
||||
body => '',
|
||||
isa => [
|
||||
'survey questions template' => {
|
||||
title => 'survey questions template title',
|
||||
body => '',
|
||||
fields => [],
|
||||
isa => [
|
||||
{ namespace => 'Asset_Survey',
|
||||
tag => 'survey template common vars'
|
||||
},
|
||||
|
|
@ -148,44 +113,190 @@ our $HELP = {
|
|||
tag => 'survey asset template variables'
|
||||
},
|
||||
],
|
||||
fields => [],
|
||||
variables => [
|
||||
{ 'name' => 'title', },
|
||||
{ 'name' => 'delete.url' },
|
||||
{ 'name' => 'delete.label' },
|
||||
{ 'name' => 'start.date.label' },
|
||||
{ 'name' => 'start.date.epoch' },
|
||||
{ 'name' => 'start.date.human' },
|
||||
{ 'name' => 'start.time.human' },
|
||||
{ 'name' => 'end.date.label' },
|
||||
{ 'name' => 'end.date.epoch' },
|
||||
{ 'name' => 'end.date.human' },
|
||||
{ 'name' => 'end.time.human' },
|
||||
{ 'name' => 'duration.label' },
|
||||
{ 'name' => 'duration.minutes' },
|
||||
{ 'name' => 'duration.minutes.label' },
|
||||
{ 'name' => 'duration.seconds' },
|
||||
{ 'name' => 'duration.seconds.label' },
|
||||
{ 'name' => 'answer.label' },
|
||||
{ 'name' => 'response.label' },
|
||||
{ 'name' => 'comment.label' },
|
||||
{ 'name' => 'question_loop',
|
||||
{ 'name' => 'questionsAnswered' },
|
||||
{ 'name' => 'totalQuestions' },
|
||||
{ 'name' => 'showProgress' },
|
||||
{ 'name' => 'showTimeLimit' },
|
||||
{ 'name' => 'minutesLeft' },
|
||||
{ 'name' => 'questions',
|
||||
'variables' => [
|
||||
{ 'name' => 'question' },
|
||||
{ 'name' => 'question.id', },
|
||||
{ 'name' => 'question.isRadioList' },
|
||||
{ 'name' => 'question.response' },
|
||||
{ 'name' => 'question.comment' },
|
||||
{ 'name' => 'question.isCorrect' },
|
||||
{ 'name' => 'question.answer' }
|
||||
],
|
||||
{ 'name' => 'id' },
|
||||
{ 'name' => 'sid' },
|
||||
{ 'name' => 'text' },
|
||||
{ 'name' => 'fileLoader' },
|
||||
{ 'name' => 'textType' },
|
||||
{ 'name' => 'multipleChoice' },
|
||||
{ 'name' => 'maxAnswers' },
|
||||
{ 'name' => 'maxMoreOne' },
|
||||
{ 'name' => 'dateType' },
|
||||
{ 'name' => 'slider' },
|
||||
{ 'name' => 'dualSlider' },
|
||||
{ 'name' => 'a1' },
|
||||
{ 'name' => 'a2' },
|
||||
{ 'name' => 'verticalDisplay' },
|
||||
{ 'name' => 'verts' },
|
||||
{ 'name' => 'verte' },
|
||||
{ 'name' => 'answers',
|
||||
'variables' => [
|
||||
{ 'name' => 'id' },
|
||||
{ 'name' => 'text' },
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
related => []
|
||||
related => [
|
||||
{ tag => 'survey template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'statistical overview report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'gradebook report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey section edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey question edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey answer edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'survey section edit template' => {
|
||||
title => 'survey section edit template title',
|
||||
body => '',
|
||||
fields => [],
|
||||
isa => [],
|
||||
variables => [
|
||||
{ 'name' => 'id' },
|
||||
{ 'name' => 'displayed_id' },
|
||||
{ 'name' => 'text' },
|
||||
{ 'name' => 'everyPageText' },
|
||||
{ 'name' => 'title' },
|
||||
{ 'name' => 'everyPageTitle' },
|
||||
{ 'name' => 'variable' },
|
||||
{ 'name' => 'goto' },
|
||||
{ 'name' => 'randomizeQuestions' },
|
||||
{ 'name' => 'terminal' },
|
||||
{ 'name' => 'terminalUrl' },
|
||||
{ 'name' => 'questionsOnSectionPage' },
|
||||
{ 'name' => 'questionsPerPage',
|
||||
'variables' => [
|
||||
{ 'name' => 'index' },
|
||||
{ 'name' => 'selected' },
|
||||
]
|
||||
}
|
||||
],
|
||||
related => [
|
||||
{ tag => 'survey template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey question edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey answer edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'gradebook report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'statistical overview report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'survey question edit template' => {
|
||||
title => 'survey question edit template title',
|
||||
body => '',
|
||||
fields => [],
|
||||
isa => [],
|
||||
variables => [
|
||||
{ 'name' => 'id' },
|
||||
{ 'name' => 'displayed_id' },
|
||||
{ 'name' => 'text' },
|
||||
{ 'name' => 'variable' },
|
||||
{ 'name' => 'randomizeAnswers' },
|
||||
{ 'name' => 'questionType' ,
|
||||
'variables' => [
|
||||
{ 'name' => 'selected' },
|
||||
]
|
||||
},
|
||||
{ 'name' => 'textInButton' },
|
||||
{ 'name' => 'required' },
|
||||
{ 'name' => 'allowComment' },
|
||||
{ 'name' => 'verticalDisplay' },
|
||||
{ 'name' => 'commentCols' },
|
||||
{ 'name' => 'commentRows' },
|
||||
{ 'name' => 'maxAnswers' },
|
||||
{ 'name' => 'value' },
|
||||
],
|
||||
related => [
|
||||
{ tag => 'survey template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey section edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey answer edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'gradebook report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'statistical overview report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'survey answer edit template' => {
|
||||
title => 'survey answer edit template title',
|
||||
body => '',
|
||||
fields => [],
|
||||
isa => [],
|
||||
variables => [
|
||||
{ 'name' => 'id' },
|
||||
{ 'name' => 'displayed_id' },
|
||||
{ 'name' => 'text' },
|
||||
{ 'name' => 'goto' },
|
||||
{ 'name' => 'value' },
|
||||
{ 'name' => 'isCorrect' },
|
||||
{ 'name' => 'textCols' },
|
||||
{ 'name' => 'textRows' },
|
||||
{ 'name' => 'min' },
|
||||
{ 'name' => 'max' },
|
||||
{ 'name' => 'step' },
|
||||
{ 'name' => 'verbatim' },
|
||||
{ 'name' => 'recordedAnswer' },
|
||||
],
|
||||
related => [
|
||||
{ tag => 'survey template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey section edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'survey question edit template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'gradebook report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'statistical overview report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'statistical overview report template' => {
|
||||
title => '1091',
|
||||
title => 'statistical overview template title',
|
||||
body => '',
|
||||
fields => [],
|
||||
isa => [
|
||||
|
|
@ -200,38 +311,37 @@ our $HELP = {
|
|||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'title', },
|
||||
{ 'name' => 'answer.label',
|
||||
'description' => 'report answer.label'
|
||||
},
|
||||
{ 'name' => 'response.count.label',
|
||||
'description' => 'report response.count.label'
|
||||
},
|
||||
{ 'name' => 'response.percent.label', },
|
||||
{ 'name' => 'show.responses.label' },
|
||||
{ 'name' => 'show.comments.label' },
|
||||
{ 'name' => 'question_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'question', },
|
||||
{ 'name' => 'question.id', },
|
||||
{ 'name' => 'question.isRadioList', },
|
||||
{ 'name' => 'question.response.total' },
|
||||
{ 'name' => 'question.allowComment', },
|
||||
{ 'name' => 'question_id', },
|
||||
{ 'name' => 'question_isMultipleChoice', },
|
||||
{ 'name' => 'question_response_total' },
|
||||
{ 'name' => 'question_allowComment', },
|
||||
{ 'name' => 'answer_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'answer.isCorrect' },
|
||||
{ 'name' => 'answer_isCorrect' },
|
||||
{ 'name' => 'answer' },
|
||||
{ 'name' => 'answer.response.count' },
|
||||
{ 'name' => 'answer.response.percent' },
|
||||
{ 'name' => 'answer_response_count' },
|
||||
{ 'name' => 'answer_response_percent' },
|
||||
{ 'name' => 'answer_comment' },
|
||||
{ 'name' => 'answer_value' },
|
||||
{ 'name' => 'comment_loop',
|
||||
'variables' => [ { 'name' => 'answer.comment' } ]
|
||||
'variables' => [ { 'name' => 'answer_comment' } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
],
|
||||
related => []
|
||||
related => [
|
||||
{ tag => 'survey template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
{ tag => 'gradebook report template',
|
||||
namespace => 'Asset_Survey'
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
'survey asset template variables' => {
|
||||
|
|
@ -246,18 +356,12 @@ our $HELP = {
|
|||
fields => [],
|
||||
variables => [
|
||||
{ 'name' => 'templateId' },
|
||||
{ 'name' => 'Survey_id' },
|
||||
{ 'name' => 'questionOrder' },
|
||||
{ 'name' => 'groupToTakeSurvey' },
|
||||
{ 'name' => 'groupToViewReports' },
|
||||
{ 'name' => 'mode' },
|
||||
{ 'name' => 'anonymous' },
|
||||
{ 'name' => 'maxResponsesPerUser' },
|
||||
{ 'name' => 'questionsPerPage' },
|
||||
{ 'name' => 'overviewTemplateId' },
|
||||
{ 'name' => 'gradebookTemplateId' },
|
||||
{ 'name' => 'responseTemplateId' },
|
||||
{ 'name' => 'defaultSectionId' },
|
||||
],
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@ use strict;
|
|||
use WebGUI::Storage;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 canDelete
|
||||
|
||||
=cut
|
||||
|
||||
sub canDelete {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -12,6 +17,11 @@ sub canDelete {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 delete
|
||||
|
||||
=cut
|
||||
|
||||
sub delete {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -26,6 +36,11 @@ sub delete {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getId
|
||||
|
||||
=cut
|
||||
|
||||
sub getId {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -33,6 +48,11 @@ sub getId {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFontList
|
||||
|
||||
=cut
|
||||
|
||||
sub getFontList {
|
||||
my $self = shift;
|
||||
my $session = shift || $self->session;
|
||||
|
|
@ -41,6 +61,11 @@ sub getFontList {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFile
|
||||
|
||||
=cut
|
||||
|
||||
sub getFile {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -52,6 +77,11 @@ sub getFile {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFilename
|
||||
|
||||
=cut
|
||||
|
||||
sub getFilename {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -59,6 +89,11 @@ sub getFilename {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName
|
||||
|
||||
=cut
|
||||
|
||||
sub getName {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -66,6 +101,11 @@ sub getName {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getStorageId
|
||||
|
||||
=cut
|
||||
|
||||
sub getStorageId {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -73,6 +113,11 @@ sub getStorageId {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 new
|
||||
|
||||
=cut
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
|
@ -102,6 +147,11 @@ sub new {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 session
|
||||
|
||||
=cut
|
||||
|
||||
sub session {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -109,6 +159,11 @@ sub session {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setFilename
|
||||
|
||||
=cut
|
||||
|
||||
sub setFilename {
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
|
|
@ -122,6 +177,11 @@ sub setFilename {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setName
|
||||
|
||||
=cut
|
||||
|
||||
sub setName {
|
||||
my $self = shift;
|
||||
my $name = shift;
|
||||
|
|
@ -135,6 +195,11 @@ sub setName {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setStorageId
|
||||
|
||||
=cut
|
||||
|
||||
sub setStorageId {
|
||||
my $self = shift;
|
||||
my $storageId = shift;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package WebGUI::Inbox::Message;
|
|||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
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
|
||||
|
|
@ -67,11 +67,11 @@ May be "unread", "pending", or "completed". Defaults to "pending".
|
|||
|
||||
You should set this to "pending" if the message requires an action which will later be completed.
|
||||
|
||||
WebGUI::Inbox->create( $session, { status => "pending"} )
|
||||
WebGUI::Inbox::Message->create( $session, { status => "pending"} )
|
||||
|
||||
You should set this to "unread" if this is a message without an action, such as a notification.
|
||||
|
||||
WebGUI::Inbox->create( $session, { status => "unread" } );
|
||||
WebGUI::Inbox::Message->create( $session, { status => "unread" } );
|
||||
|
||||
You should only set this to "completed" if this is an action that would normally be "pending" but for some reason
|
||||
requries no further action. For instance, if the user submitting some content is also the approver you may choose
|
||||
|
|
@ -109,10 +109,12 @@ sub create {
|
|||
$self->{_properties}{subject} = $properties->{subject} || WebGUI::International->new($session)->get(523);
|
||||
$self->{_properties}{message} = $properties->{message};
|
||||
$self->{_properties}{dateStamp} = time();
|
||||
$self->{_properties}{userId} = $properties->{userId} || $session->user->userId;
|
||||
$self->{_properties}{userId} = $properties->{userId};
|
||||
$self->{_properties}{groupId} = $properties->{groupId};
|
||||
$self->{_properties}{sentBy} = $properties->{sentBy} || 3;
|
||||
|
||||
unless ( $self->{_properties}{userId} || $self->{_properties}{groupId} ) {
|
||||
$self->{_properties}{userId} = $session->user->userId;
|
||||
}
|
||||
my $status = $self->{_properties}{status};
|
||||
|
||||
if ($status eq "completed") {
|
||||
|
|
@ -635,4 +637,4 @@ sub statusCodes {
|
|||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ package WebGUI::Macro::Widget;
|
|||
use strict;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 process
|
||||
|
||||
=cut
|
||||
|
||||
sub process {
|
||||
|
||||
# get passed parameters
|
||||
|
|
@ -21,6 +26,7 @@ sub process {
|
|||
my $width = shift || 600;
|
||||
my $height = shift || 400;
|
||||
my $templateId = shift || 'none';
|
||||
my $styleTemplateId = shift || 'none';
|
||||
|
||||
# Get location for CSS and JS files
|
||||
my $conf = $session->config;
|
||||
|
|
@ -85,7 +91,7 @@ sub process {
|
|||
<script type='text/javascript'>
|
||||
function setupPage() {
|
||||
WebGUI.widgetBox.retargetLinksAndForms();
|
||||
WebGUI.widgetBox.initButton( { 'wgWidgetPath' : '$wgWidgetPath', 'fullUrl' : '$fullUrl', 'assetId' : '$assetId', 'width' : $width, 'height' : $height, 'templateId' : '$templateId' } );
|
||||
WebGUI.widgetBox.initButton( { 'wgWidgetPath' : '$wgWidgetPath', 'fullUrl' : '$fullUrl', 'assetId' : '$assetId', 'width' : $width, 'height' : $height, 'templateId' : '$templateId', 'styleTemplateId' : $styleTemplateId } );
|
||||
}
|
||||
YAHOO.util.Event.addListener(window, 'load', setupPage);
|
||||
</script>
|
||||
|
|
@ -108,7 +114,7 @@ OUTPUT
|
|||
my $output = <<EOHTML;
|
||||
<a href="#$assetId" id="show$assetId" name="show$assetId"><img src="$imgSrc" /></a>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, 'load', WebGUI.widgetBox.initButton, { 'wgWidgetPath' : '$wgWidgetPath', 'fullUrl' : '$fullUrl', 'assetId' : '$assetId', 'width' : $width, 'height' : $height, 'templateId' : '$templateId' } );
|
||||
YAHOO.util.Event.addListener(window, 'load', WebGUI.widgetBox.initButton, { 'wgWidgetPath' : '$wgWidgetPath', 'fullUrl' : '$fullUrl', 'assetId' : '$assetId', 'width' : $width, 'height' : $height, 'templateId' : '$templateId', 'styleTemplateId' : '$styleTemplateId' } );
|
||||
</script>
|
||||
EOHTML
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,10 @@ sub www_spectreStatus {
|
|||
|
||||
=head2 www_spectreTest ( )
|
||||
|
||||
Spectre executes this function to see if WebGUI connectivity is working.
|
||||
Spectre executes this function to see if WebGUI connectivity is working. Note, the subnet checking
|
||||
is done in here because it is only, ever intended that Spectre use this method. If a user were to
|
||||
call this method, it would lie, since it would be checking if the user's IP address was a valid
|
||||
spectreSubnet, instead of checking the IP address of the spectre process.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -172,6 +175,20 @@ sub www_spectreTest {
|
|||
my $session = shift;
|
||||
$session->http->setMimeType("text/plain");
|
||||
$session->http->setCacheControl("none");
|
||||
|
||||
my $subnets = $session->config->get("spectreSubnets");
|
||||
if (!defined $subnets) {
|
||||
$subnets = [];
|
||||
}
|
||||
|
||||
my $sessionIp = $session->env->getIp;
|
||||
unless (isInSubnet($sessionIp, $subnets)) {
|
||||
$session->errorHandler->security(
|
||||
sprintf "Tried to make a Spectre workflow runner request from %s, but we're only allowed to accept requests from %s",
|
||||
$sessionIp, join(",",@{$subnets})
|
||||
);
|
||||
return "subnet";
|
||||
}
|
||||
return WebGUI::Operation::Spectre::spectreTest($session);
|
||||
}
|
||||
|
||||
|
|
@ -179,21 +196,13 @@ sub www_spectreTest {
|
|||
|
||||
=head2 spectreTest ( )
|
||||
|
||||
Spectre executes this function to see if WebGUI connectivity is working.
|
||||
Spectre executes this function to see if WebGUI connectivity is working. It does not
|
||||
do subnet checking, yet.
|
||||
|
||||
=cut
|
||||
|
||||
sub spectreTest{
|
||||
my $session = shift;
|
||||
my $subnets = $session->config->get("spectreSubnets");
|
||||
|
||||
if (!defined $subnets) {
|
||||
$subnets = [];
|
||||
}
|
||||
unless (isInSubnet($session->env->getIp, $subnets)) {
|
||||
$session->errorHandler->security("Tried to make a Spectre workflow runner request, but we're only allowed to accept requests from ".join(",",@{$subnets}).".");
|
||||
return "subnet";
|
||||
}
|
||||
my $remote = create_ikc_client(
|
||||
port=>$session->config->get("spectrePort"),
|
||||
ip=>$session->config->get("spectreIp"),
|
||||
|
|
@ -205,6 +214,13 @@ sub spectreTest{
|
|||
my $result = $remote->post_respond('admin/ping');
|
||||
$remote->disconnect;
|
||||
return "spectre" unless defined $result;
|
||||
##A real spectre subnet test would go here, and would consist of the following
|
||||
##events:
|
||||
## 1) WebGUI talks to spectre.
|
||||
## 2) Spectre makes a request of WebGUI
|
||||
## 3) WebGUI returns a token or an error
|
||||
## 4) spectre returns the result of the request to WebGUI
|
||||
## 5) WebGUI lets the user know how it all ended up.
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -350,18 +350,18 @@ Returns a link to the next page's data.
|
|||
=cut
|
||||
|
||||
sub getNextPageLink {
|
||||
my ($self) = @_;
|
||||
my ($text, $pn, $ctext);
|
||||
$pn = $self->getPageNumber;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$ctext = $i18n->get(92);
|
||||
$text = $ctext.'»';
|
||||
if ($pn < $self->getNumberOfPages) {
|
||||
my $url = $self->session->url->append($self->{_url},($self->{_formVar}.'='.($pn+1)));
|
||||
return wantarray ? ($url,$ctext,'<span id="nextPageLink"><a href="'.$url.'">'.$text.'</a>') : '<a href="'.$url.'">'.$text.'</a></span>';
|
||||
} else {
|
||||
return wantarray ? (undef,$ctext,$text) : $text;
|
||||
}
|
||||
my ($self) = @_;
|
||||
my ($text, $pn, $ctext);
|
||||
$pn = $self->getPageNumber;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$ctext = $i18n->get(92);
|
||||
$text = $ctext.'»';
|
||||
my $url = undef;
|
||||
if ($pn < $self->getNumberOfPages) {
|
||||
$url = $self->session->url->append($self->{_url},($self->{_formVar}.'='.($pn+1)));
|
||||
$text = '<span id="nextPageLink"><a href="'.$url.'">' . $text . '</a></span>';
|
||||
}
|
||||
return wantarray ? ($url, $ctext, $text) : $text;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -528,18 +528,18 @@ Returns a link to the previous page's data.
|
|||
=cut
|
||||
|
||||
sub getPreviousPageLink {
|
||||
my ($self) = @_;
|
||||
my ($text, $pn, $ctext);
|
||||
$pn = $self->getPageNumber;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$ctext = $i18n->get(91);
|
||||
$text = '«'.$ctext;
|
||||
if ($pn > 1) {
|
||||
my $url = $self->session->url->append($self->{_url},($self->{_formVar}.'='.($pn-1)));
|
||||
return wantarray ? ($url,$ctext,'<span id="previousPageLink"><a href="'.$url.'">'.$text.'</a>') : '<a href="'.$url.'">'.$text.'</a></span>';
|
||||
} else {
|
||||
return wantarray ? (undef,$ctext,$text) : $text;
|
||||
}
|
||||
my ($self) = @_;
|
||||
my ($text, $pn, $ctext);
|
||||
$pn = $self->getPageNumber;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$ctext = $i18n->get(91);
|
||||
$text = '«'.$ctext;
|
||||
my $url = undef;
|
||||
if ($pn > 1) {
|
||||
$url = $self->session->url->append($self->{_url},($self->{_formVar}.'='.($pn-1)));
|
||||
$text = '<span id="previousPageLink"><a href="'.$url.'">'.$text.'</a></span>';
|
||||
}
|
||||
return wantarray ? ($url, $ctext, $text) : $text;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ sub create {
|
|||
|
||||
# Get the field's data type
|
||||
$properties->{fieldType} ||= "ReadOnly";
|
||||
my $formClass = 'WebGUI::Form::' . ucfirst $properties->{fieldType};
|
||||
my $formClass = $self->getFormControlClass;
|
||||
eval "use $formClass;";
|
||||
my $dbDataType = $formClass->getDatabaseFieldType;
|
||||
|
||||
|
|
@ -545,6 +545,25 @@ sub isEditable {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isInRequest ( )
|
||||
|
||||
Returns a boolean indicating whether this field was in the posted data.
|
||||
|
||||
=cut
|
||||
|
||||
sub isInRequest {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $form = WebGUI::Form::DynamicField->new($session,
|
||||
fieldType => $self->get('fieldType'),
|
||||
name => $self->getId,
|
||||
);
|
||||
return $form->isInRequest;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isProtected ( )
|
||||
|
|
@ -812,7 +831,7 @@ sub set {
|
|||
# If the fieldType has changed, modify the userProfileData column
|
||||
if ($properties->{fieldType} ne $self->get("fieldType")) {
|
||||
# Create a copy of the new properties so we don't mess them up
|
||||
my $fieldClass = "WebGUI::Form::".ucfirst($properties->{fieldType});
|
||||
my $fieldClass = $self->getFormControlClass;
|
||||
eval "use $fieldClass;";
|
||||
my $dbDataType
|
||||
= $fieldClass->new($session, $self->formProperties($properties))->getDatabaseFieldType;
|
||||
|
|
|
|||
|
|
@ -66,6 +66,24 @@ sub AUTOLOAD {
|
|||
return $self->$method(@args);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 hasParam ( $param )
|
||||
|
||||
Returns true if the param is part of the submitted form data, or a URL param.
|
||||
|
||||
=cut
|
||||
|
||||
sub hasParam {
|
||||
my $self = shift;
|
||||
my $param = shift;
|
||||
return undef unless $param;
|
||||
return undef unless $self->session->request;
|
||||
my $hashRef = $self->session->request->param();
|
||||
return exists $hashRef->{$param};
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 paramsHashRef ( )
|
||||
|
|
@ -103,27 +121,18 @@ The name of the field to retrieve if you want to retrieve just one specific fiel
|
|||
|
||||
sub param {
|
||||
my $self = shift;
|
||||
return undef unless $self->session->request;
|
||||
my $field = shift;
|
||||
if ($field) {
|
||||
if ($self->session->request) {
|
||||
my @data = $self->session->request->param($field);
|
||||
foreach my $value (@data) {
|
||||
$value = Encode::decode_utf8($value);
|
||||
}
|
||||
return wantarray ? @data : $data[0];
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
} else {
|
||||
if ($self->session->request) {
|
||||
my %params;
|
||||
foreach ($self->session->request->param) {
|
||||
$params{$_} = 1;
|
||||
}
|
||||
return keys %params;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
my @data = $self->session->request->param($field);
|
||||
foreach my $value (@data) {
|
||||
$value = Encode::decode_utf8($value);
|
||||
}
|
||||
return wantarray ? @data : $data[0];
|
||||
}
|
||||
else {
|
||||
my $paramRef = $self->session->request->param;
|
||||
return keys %{ $paramRef };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -154,8 +163,8 @@ A full set of form params just as you'd pass into any of the form controls when
|
|||
sub process {
|
||||
my ($self, $name, $type, $default, $params) = @_;
|
||||
|
||||
$type = ucfirst($type);
|
||||
return $self->param($name) if ($type eq "");
|
||||
$type = ucfirst($type);
|
||||
|
||||
return $self->SUPER::process({
|
||||
name => $name,
|
||||
|
|
|
|||
|
|
@ -216,7 +216,14 @@ sub getBackToSiteURL {
|
|||
$url = WebGUI::Asset->getDefault($self->session)->getUrl;
|
||||
}
|
||||
else {
|
||||
$url = $self->session->asset->getContainer->getUrl;
|
||||
my $container = $self->session->asset->getContainer;
|
||||
##Container may be under a different version tag if this asset has been moved.
|
||||
if (defined $container) {
|
||||
$url = $container->getUrl;
|
||||
}
|
||||
else {
|
||||
$url = $self->session->url->page();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$url = $self->session->url->page();
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ sub cancelRecurringPayment {
|
|||
|
||||
# Get the payment definition XML
|
||||
my $xml = $self->_generateCancelRecurXml( $transaction );
|
||||
$session->errorHandler->info("XML Request: $xml");
|
||||
$session->errorHandler->debug("XML Request: $xml");
|
||||
|
||||
# Post the xml to ITransact
|
||||
my $response = $self->doXmlRequest( $xml, 1 );
|
||||
|
|
@ -424,8 +424,8 @@ sub doXmlRequest {
|
|||
|
||||
# Create a request and stuff the xml in it
|
||||
my $request = HTTP::Request->new( POST => $xmlTransactionScript );
|
||||
$request->content_type( 'application/x-www-form-urlencoded' );
|
||||
$request->content( 'xml='.$xml );
|
||||
$request->content_type( 'text/xml' );
|
||||
$request->content( $xml );
|
||||
|
||||
# Do the request
|
||||
my $response = $userAgent->request($request);
|
||||
|
|
@ -487,31 +487,71 @@ sub processCredentials {
|
|||
push @error, $i18n->get('invalid expiration date') unless $expires =~ m{^\d{6}$};
|
||||
push @error, $i18n->get('expired expiration date') unless $expires >= $now;
|
||||
|
||||
return \@error if scalar @error;
|
||||
# Everything ok process the actual data
|
||||
unless (@error) {
|
||||
$self->{ _cardData } = {
|
||||
acct => $form->integer( 'cardNumber' ),
|
||||
expMonth => $form->integer( 'expMonth' ),
|
||||
expYear => $form->integer( 'expYear' ),
|
||||
cvv2 => $form->integer( 'cvv2' ),
|
||||
};
|
||||
|
||||
$self->{ _billingAddress } = {
|
||||
address1 => $form->process( 'address' ),
|
||||
code => $form->zipcode( 'zipcode' ),
|
||||
city => $form->process( 'city' ),
|
||||
firstName => $form->process( 'firstName' ),
|
||||
lastName => $form->process( 'lastName' ),
|
||||
email => $form->email ( 'email' ),
|
||||
state => $form->process( 'state' ),
|
||||
country => $form->process( 'country' ),
|
||||
phoneNumber => $form->process( 'phone' ),
|
||||
};
|
||||
$self->{ _cardData } = {
|
||||
acct => $form->integer( 'cardNumber' ),
|
||||
expMonth => $form->integer( 'expMonth' ),
|
||||
expYear => $form->integer( 'expYear' ),
|
||||
cvv2 => $form->integer( 'cvv2' ),
|
||||
};
|
||||
|
||||
$self->{ _billingAddress } = {
|
||||
address1 => $form->process( 'address' ),
|
||||
code => $form->zipcode( 'zipcode' ),
|
||||
city => $form->process( 'city' ),
|
||||
firstName => $form->process( 'firstName' ),
|
||||
lastName => $form->process( 'lastName' ),
|
||||
email => $form->email ( 'email' ),
|
||||
state => $form->process( 'state' ),
|
||||
country => $form->process( 'country' ),
|
||||
phoneNumber => $form->process( 'phone' ),
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return \@error;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getBillingAddress ( $addressId )
|
||||
|
||||
The billing address is not handled by WebGUI::Shop::Address, it comes from
|
||||
www_getCredentials. However, WebGUI::Shop::Transaction requires an
|
||||
WebGUI::Shop::Address object. The billing address is seeded with information
|
||||
from the shipping address. If this address info is different, then create
|
||||
a new address to hand to Transaction.
|
||||
|
||||
=head3 $addressId
|
||||
|
||||
The id of a WebGUI::Shop::Address. If not present, then use the shipping
|
||||
address instead.
|
||||
|
||||
=cut
|
||||
|
||||
sub getBillingAddress {
|
||||
my ($self, $addressId) = @_;
|
||||
|
||||
my $address = $addressId
|
||||
? $self->getAddress( $addressId )
|
||||
: $self->getCart->getShippingAddress
|
||||
;
|
||||
|
||||
##If the user made any changes to the default address, create a new billing address
|
||||
##and use it instead
|
||||
if( $address->get('firstName' ) ne $self->{_billingAddress}->{ 'firstName' }
|
||||
|| $address->get('lastName' ) ne $self->{_billingAddress}->{ 'lastName' }
|
||||
|| $address->get('address1' ) ne $self->{_billingAddress}->{ 'address1' }
|
||||
|| $address->get('city' ) ne $self->{_billingAddress}->{ 'city' }
|
||||
|| $address->get('state' ) ne $self->{_billingAddress}->{ 'state' }
|
||||
|| $address->get('code' ) ne $self->{_billingAddress}->{ 'code' }
|
||||
|| $address->get('country' ) ne $self->{_billingAddress}->{ 'country' }
|
||||
|| $address->get('phoneNumber' ) ne $self->{_billingAddress}->{ 'phoneNumber' }
|
||||
|| $address->get('email' ) ne $self->{_billingAddress}->{ 'email' }
|
||||
) {
|
||||
my $billingAddress = $self->getCart->getAddressBook->addAddress( $self->{_billingAddress} );
|
||||
return $billingAddress;
|
||||
}
|
||||
return $address;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -522,7 +562,7 @@ sub processPayment {
|
|||
|
||||
# Get the payment definition XML
|
||||
my $xml = $self->_generatePaymentRequestXML( $transaction );
|
||||
$session->errorHandler->info("XML Request: $xml");
|
||||
$session->errorHandler->debug("XML Request: $xml");
|
||||
|
||||
# Send the xml to ITransact
|
||||
my $response = $self->doXmlRequest( $xml );
|
||||
|
|
@ -637,7 +677,6 @@ sub www_getCredentials {
|
|||
}
|
||||
|
||||
$var->{getSelectAddressButton} = $self->getSelectAddressButton( 'getCredentials' );
|
||||
$self->session->log->warn("selectAddressButton: ".$var->{getSelectAddressButton});
|
||||
|
||||
$var->{formHeader} = WebGUI::Form::formHeader($session)
|
||||
. $self->getDoFormTags('pay');
|
||||
|
|
@ -647,8 +686,6 @@ sub www_getCredentials {
|
|||
}
|
||||
|
||||
$var->{formFooter} = WebGUI::Form::formFooter();
|
||||
$self->session->log->warn("formHeader: ".$var->{formHeader});
|
||||
|
||||
|
||||
# Address data form
|
||||
$var->{firstNameField} = WebGUI::Form::text($session, {
|
||||
|
|
@ -685,7 +722,7 @@ sub www_getCredentials {
|
|||
});
|
||||
$var->{emailField} = WebGUI::Form::email($session, {
|
||||
name => 'email',
|
||||
value => $self->session->form->process("email") || $u->profileField('email'),
|
||||
value => $form->process('email', 'email') || $addressData->{ email } || $u->profileField('email'),
|
||||
});
|
||||
|
||||
# Credit card information
|
||||
|
|
@ -714,20 +751,22 @@ sub www_getCredentials {
|
|||
sub www_pay {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $addressId = $session->form->process( 'addressId' );
|
||||
my $address = $addressId
|
||||
? $self->getAddress( $addressId )
|
||||
: $self->getCart->getShippingAddress
|
||||
;
|
||||
|
||||
# Check whether the user filled in the checkout form and process those.
|
||||
my $credentialsErrors = $self->processCredentials;
|
||||
|
||||
# Go back to checkout form if credentials are not ok
|
||||
return $self->www_getCredentials( $credentialsErrors ) if $credentialsErrors;
|
||||
|
||||
my $addressId = $session->form->process( 'addressId' );
|
||||
my $billingAddress = $self->getBillingAddress($addressId);
|
||||
|
||||
# Payment time!
|
||||
my $transaction = $self->processTransaction( $address );
|
||||
my $transaction = $self->processTransaction( $billingAddress );
|
||||
## The billing address object is temporary, just to send to the transaction.
|
||||
## Delete it if we don't need it.
|
||||
if ($billingAddress->getId ne $addressId) {
|
||||
$billingAddress->delete;
|
||||
}
|
||||
if ($transaction->get('isSuccessful')) {
|
||||
return $transaction->thankYou();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -794,7 +794,7 @@ STOP
|
|||
$output .= '{key:"amount", label:"'.$i18n->get('price').'",formatter:YAHOO.widget.DataTable.formatCurrency},';
|
||||
$output .= '{key:"statusCode", label:"'.$i18n->get('status code').'"},';
|
||||
$output .= '{key:"statusMessage", label:"'.$i18n->get('status message').'"},';
|
||||
$output .= '{key:"paymentDriverLabel", label:"'.$i18n->get('payment method').'"},';
|
||||
$output .= '{key:"paymentDriverLabel", label:"'.$i18n->get('payment method').'"}';
|
||||
$output .= <<STOP;
|
||||
];
|
||||
var myTable = new DataTable('dt', myColumnDefs, mySource, myTableConfig);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,4 @@ The use of this module is deprecated and is only here for backward compatibility
|
|||
|
||||
=cut
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1170,23 +1170,21 @@ sub validateProfileDataFromForm {
|
|||
my $errorFields = [];
|
||||
my $warnFields = [];
|
||||
|
||||
foreach my $field (@{$fields}) {
|
||||
FIELD: foreach my $field (@{$fields}) {
|
||||
my $fieldId = $field->getId;
|
||||
my $fieldLabel = $field->getLabel;
|
||||
my $fieldValue = $field->formProcess;
|
||||
my $isValid = $field->isValid($fieldValue);
|
||||
|
||||
$data->{$fieldId} = (ref $fieldValue eq "ARRAY") ? $fieldValue->[0] : $fieldValue;
|
||||
|
||||
if(!$isValid) {
|
||||
$errorCat = $field->get("profileCategoryId") unless (defined $errorCat);
|
||||
push (@{$errors}, sprintf($i18n->get("required error"),$fieldLabel));
|
||||
push(@{$errorFields},$fieldId);
|
||||
}
|
||||
#The language field is special and must be always be valid or WebGUI will croak
|
||||
elsif($fieldId eq "language" && !(exists $i18n->getLanguages()->{$data->{$fieldId}})) {
|
||||
elsif($fieldId eq "language" && !(exists $i18n->getLanguages()->{$fieldValue})) {
|
||||
$errorCat = $field->get("profileCategoryId") unless (defined $errorCat);
|
||||
push (@{$errors}, sprintf($i18n->get("language not available error"),$data->{$fieldId}));
|
||||
push (@{$errors}, sprintf($i18n->get("language not available error"),$fieldValue));
|
||||
push(@{$errorFields},$fieldId);
|
||||
}
|
||||
#Duplicate emails throw warnings
|
||||
|
|
@ -1195,6 +1193,11 @@ sub validateProfileDataFromForm {
|
|||
push (@{$warnings},$i18n->get(1072));
|
||||
push(@{$warnFields},$fieldId);
|
||||
}
|
||||
|
||||
##Do not return data unless the form field was actually in the posted data.
|
||||
next FIELD unless $field->isInRequest;
|
||||
$data->{$fieldId} = (ref $fieldValue eq "ARRAY") ? $fieldValue->[0] : $fieldValue;
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
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