Merge commit 'v7.10.19' into WebGUI8
This commit is contained in:
commit
4fea10a1f5
52 changed files with 490 additions and 77 deletions
|
|
@ -1,3 +1,12 @@
|
|||
7.10.19
|
||||
- fixed #12169: extras uploads symlink export
|
||||
- Added ability to pass caller assetId to RenderThingMacro
|
||||
- Allow specific expirations for groups in userImport.pl
|
||||
- fixed #12164: Calendar feeds with tons of ;adminId=XXXXXX added
|
||||
- fixed #12167: Calendar Next/Prev Month/Year confusion
|
||||
- fixed #12172: Underground User Style template shows up in Style wizard during site creation
|
||||
- fixed #12157: www_editThingSave
|
||||
|
||||
7.10.18
|
||||
- fixed #12138: Version tag gets create by entering and direct leaving
|
||||
- Added the WebGUI::Event API
|
||||
|
|
|
|||
Binary file not shown.
177
docs/upgrades/upgrade_7.10.18-7.10.19.pl
Normal file
177
docs/upgrades/upgrade_7.10.18-7.10.19.pl
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "../..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::Wobject::Calendar;
|
||||
use Exception::Class;
|
||||
|
||||
|
||||
my $toVersion = '7.10.19';
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
addTicketLimitToBadgeGroup( $session );
|
||||
fixBrokenCalendarFeedUrls ( $session );
|
||||
removeUndergroundUserStyleTemplate ( $session );
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
#sub exampleFunction {
|
||||
# my $session = shift;
|
||||
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
|
||||
# # and here's our code
|
||||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Fix calendar feed urls that had adminId attached to them until they blew up
|
||||
sub fixBrokenCalendarFeedUrls {
|
||||
my $session = shift;
|
||||
print "\tChecking all calendar feed URLs for adminId brokenness... " unless $quiet;
|
||||
my $getCalendar = WebGUI::Asset::Wobject::Calendar->getIsa($session);
|
||||
CALENDAR: while (1) {
|
||||
my $calendar = eval { $getCalendar->(); };
|
||||
next CALENDAR if Exception::Class->caught;
|
||||
last CALENDAR unless $calendar;
|
||||
FEED: foreach my $feed (@{ $calendar->getFeeds }) {
|
||||
$feed->{url} =~ s/adminId=[^;]{22};?//g;
|
||||
$feed->{url} =~ s/\?$//;
|
||||
$calendar->setFeed($feed->{feedId}, $feed);
|
||||
}
|
||||
}
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add a ticket limit to badges in a badge group
|
||||
sub removeUndergroundUserStyleTemplate {
|
||||
my $session = shift;
|
||||
print "\tRemove Underground User Style template... " unless $quiet;
|
||||
if ($session->setting->get('userFunctionStyleId') eq 'zfDnOJgeiybz9vnmoEXRXA') {
|
||||
$session->setting->set('userFunctionStyleId', 'Qk24uXao2yowR6zxbVJ0xA');
|
||||
}
|
||||
my $underground_user = WebGUI::Asset->newByDynamicClass($session, 'zfDnOJgeiybz9vnmoEXRXA');
|
||||
if ($underground_user) {
|
||||
$underground_user->purge;
|
||||
}
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add a ticket limit to badges in a badge group
|
||||
sub addTicketLimitToBadgeGroup {
|
||||
my $session = shift;
|
||||
print "\tAdd ticket limit to badge groups... " unless $quiet;
|
||||
# Make sure it hasn't been done already...
|
||||
my $columns = $session->db->buildHashRef('describe EMSBadgeGroup');
|
||||
use List::MoreUtils qw(any);
|
||||
if(!any { $_ eq 'ticketsPerBadge' } keys %{$columns}) {
|
||||
$session->db->write(q{
|
||||
ALTER TABLE EMSBadgeGroup ADD COLUMN `ticketsPerBadge` INTEGER
|
||||
});
|
||||
}
|
||||
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;
|
||||
|
||||
print "\tUpgrading package $file\n" unless $quiet;
|
||||
# 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 = eval {
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
$node->importPackage( $storage, {
|
||||
overwriteLatest => 1,
|
||||
clearPackageFlag => 1,
|
||||
setDefaultTemplate => 1,
|
||||
} );
|
||||
};
|
||||
|
||||
if ($package eq 'corrupt') {
|
||||
die "Corrupt package found in $file. Stopping upgrade.\n";
|
||||
}
|
||||
if ($@ || !defined $package) {
|
||||
die "Error during package import on $file: $@\nStopping upgrade\n.";
|
||||
}
|
||||
|
||||
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',".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
|
||||
|
|
@ -868,15 +868,75 @@ sub www_addTicketsToBadge {
|
|||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
return $session->privilege->insufficient() unless $self->canView;
|
||||
my $form = $session->form;
|
||||
my ( $form, $db ) = $session->quick(qw{ form db });
|
||||
my $i18n = WebGUI::International->new($self->session,'Asset_EventManagementSystem');
|
||||
|
||||
# get badge's badge groups
|
||||
my $badgeId = $form->get('badgeId');
|
||||
my %badgeGroups = (); # Hash of badgeGroupId => ticketsPerBadge
|
||||
if (defined $badgeId) {
|
||||
my $assetId = $db->quickScalar("select badgeAssetId from EMSRegistrant where badgeId=?",[$badgeId]);
|
||||
my $badge = WebGUI::Asset->new($session, $assetId, 'WebGUI::Asset::Sku::EMSBadge');
|
||||
if ( defined $badge ) {
|
||||
my @badgeGroups = split("\n",$badge->get('relatedBadgeGroups'));
|
||||
%badgeGroups = $db->buildHash(
|
||||
"SELECT badgeGroupId, ticketsPerBadge FROM EMSBadgeGroup WHERE badgeGroupId IN (" . $db->quoteAndJoin(\@badgeGroups) . ")",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# get a list of tickets already associated with the badge
|
||||
my @existingTickets = $db->buildArray("select ticketAssetId from EMSRegistrantTicket where badgeId=?",[$badgeId]);
|
||||
|
||||
# Determine the ticket limits per badge group
|
||||
my %fullBadgeGroups = ();
|
||||
for my $ticketId ( @existingTickets ) {
|
||||
my $ticket = WebGUI::Asset->new( $session, $ticketId, 'WebGUI::Asset::Sku::EMSTicket' );
|
||||
next unless $ticket;
|
||||
# Every ticket takes one spot from every related badge group
|
||||
# So a badge can never have more than the limit defined in any related badge group
|
||||
# Badge groups that start at 0 are not limited
|
||||
for my $badgeGroupId ( split "\n", $ticket->get('relatedBadgeGroups') ) {
|
||||
if ( $badgeGroups{ $badgeGroupId } ) {
|
||||
$badgeGroups{ $badgeGroupId }--;
|
||||
# If we're reduced to 0 now, keep track
|
||||
if ( $badgeGroups{ $badgeGroupId } == 0 ) {
|
||||
$fullBadgeGroups{ $badgeGroupId } = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Add the tickets
|
||||
my @ids = $form->param('assetId');
|
||||
foreach my $id (@ids) {
|
||||
my @errors = (); # Error messages
|
||||
TICKET: foreach my $id (@ids) {
|
||||
my $ticket = WebGUI::Asset->newById($session, $id);
|
||||
if (defined $ticket) {
|
||||
$ticket->addToCart({badgeId=>$form->get('badgeId')});
|
||||
# Make sure we're allowed to add this ticket
|
||||
my @ticketBadgeGroups = ( split "\n", $ticket->get('relatedBadgeGroups') );
|
||||
for my $badgeGroupId ( @ticketBadgeGroups ) {
|
||||
if ( $fullBadgeGroups{ $badgeGroupId } ) {
|
||||
push @errors, sprintf( $i18n->get('error badge group ticket limit'), $ticket->getTitle );
|
||||
next TICKET;
|
||||
}
|
||||
}
|
||||
|
||||
# Reduce our numbers
|
||||
for my $badgeGroupId ( @ticketBadgeGroups ) {
|
||||
if ( $badgeGroups{ $badgeGroupId } ) {
|
||||
$badgeGroups{ $badgeGroupId }--;
|
||||
# If we're reduced to 0 now, keep track
|
||||
if ( $badgeGroups{ $badgeGroupId } == 0 ) {
|
||||
$fullBadgeGroups{ $badgeGroupId } = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ticket->addToCart({badgeId=>$badgeId});
|
||||
}
|
||||
}
|
||||
return $self->www_getRegistrantAsJson();
|
||||
return $self->www_getRegistrantAsJson( { errors => \@errors } );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1007,6 +1067,12 @@ sub www_editBadgeGroup {
|
|||
label => $i18n->get('badge group name'),
|
||||
hoverHelp => $i18n->get('badge group name help'),
|
||||
);
|
||||
$f->addField( "integer",
|
||||
name => 'ticketsPerBadge',
|
||||
value => $badgeGroup->{ticketsPerBadge} || 0,
|
||||
label => $i18n->get('badge group ticketsPerBadge'),
|
||||
hoverHelp => $i18n->get('badge group ticketsPerBadge help'),
|
||||
);
|
||||
$f->addField( "submit", name => "send" );
|
||||
return $self->processStyle('<h1>'.$i18n->get('badge groups').'</h1>'.$f->toHtml);
|
||||
}
|
||||
|
|
@ -1029,6 +1095,7 @@ sub www_editBadgeGroupSave {
|
|||
badgeGroupId => $id,
|
||||
emsAssetId => $self->getId,
|
||||
name => $form->get('name'),
|
||||
ticketsPerBadge => $form->get('ticketsPerBadge','Integer'),
|
||||
});
|
||||
return $self->www_manageBadgeGroups;
|
||||
}
|
||||
|
|
@ -1458,7 +1525,7 @@ Retrieves the properties of a specific badge and the items attached to it. Expec
|
|||
=cut
|
||||
|
||||
sub www_getRegistrantAsJson {
|
||||
my ($self) = @_;
|
||||
my ($self, $opt) = @_;
|
||||
my $session = $self->session;
|
||||
my $db = $session->db;
|
||||
return $session->privilege->insufficient() unless $self->canView;
|
||||
|
|
@ -1477,6 +1544,11 @@ sub www_getRegistrantAsJson {
|
|||
$badgeInfo->{assetId} = $badge->getId;
|
||||
$badgeInfo->{hasPurchased} = ($badgeInfo->{purchaseComplete}) ? 1 : 0;
|
||||
|
||||
# Add errors, if any
|
||||
if ( $opt->{errors} && @{ $opt->{errors} } ) {
|
||||
$badgeInfo->{errors} = $opt->{errors};
|
||||
}
|
||||
|
||||
# get existing tickets
|
||||
my $existingTickets = $db->read("select ticketAssetId from EMSRegistrantTicket where badgeId=? and purchaseComplete=1",[$badgeId]);
|
||||
while (my ($id) = $existingTickets->array) {
|
||||
|
|
@ -1838,16 +1910,39 @@ className='WebGUI::Asset::Sku::EMSTicket' and state='published' and revisionDate
|
|||
|
||||
# get badge's badge groups
|
||||
my $badgeId = $form->get('badgeId');
|
||||
my @badgeGroups = ();
|
||||
my %badgeGroups = (); # Hash of badgeGroupId => ticketsPerBadge
|
||||
if (defined $badgeId) {
|
||||
my $assetId = $db->quickScalar("select badgeAssetId from EMSRegistrant where badgeId=?",[$badgeId]);
|
||||
my $badge = eval { WebGUI::Asset->newById($session, $assetId); };
|
||||
@badgeGroups = split("\n",$badge->relatedBadgeGroups) if (defined $badge);
|
||||
my $badge = eval { WebGUI::Asset->newById ($session, $assetId, 'WebGUI::Asset::Sku::EMSBadge'); };
|
||||
if ( defined $badge ) {
|
||||
my @badgeGroups = split("\n",$badge->get('relatedBadgeGroups'));
|
||||
%badgeGroups = $db->buildHash(
|
||||
"SELECT badgeGroupId, ticketsPerBadge FROM EMSBadgeGroup WHERE badgeGroupId IN (" . $db->quoteAndJoin(\@badgeGroups) . ")",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# get a list of tickets already associated with the badge
|
||||
my @existingTickets = $db->buildArray("select ticketAssetId from EMSRegistrantTicket where badgeId=?",[$badgeId]);
|
||||
|
||||
# Determine the ticket limits per badge group
|
||||
my %fullBadgeGroups = ();
|
||||
for my $ticketId ( @existingTickets ) {
|
||||
my $ticket = WebGUI::Asset->new( $session, $ticketId, 'WebGUI::Asset::Sku::EMSTicket' );
|
||||
next unless $ticket;
|
||||
# Every ticket takes one spot from every related badge group
|
||||
# So a badge can never have more than the limit defined in any related badge group
|
||||
for my $badgeGroupId ( split "\n", $ticket->get('relatedBadgeGroups') ) {
|
||||
if ( $badgeGroups{ $badgeGroupId } ) {
|
||||
$badgeGroups{ $badgeGroupId }--;
|
||||
# If we're reduced to 0 now, keep track
|
||||
if ( $badgeGroups{ $badgeGroupId } == 0 ) {
|
||||
$fullBadgeGroups{ $badgeGroupId } = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# get assets
|
||||
my $counter = 0;
|
||||
my $totalTickets = scalar(@ids);
|
||||
|
|
@ -1870,19 +1965,18 @@ className='WebGUI::Asset::Sku::EMSTicket' and state='published' and revisionDate
|
|||
next TICKETID if !$ticket;
|
||||
|
||||
# skip tickets not in our badge's badge groups
|
||||
if ($badgeId ne "" && scalar(@badgeGroups) > 0 && $ticket->relatedBadgeGroups ne '') { # skip check if it has no badge groups
|
||||
my @groups = split("\n",$ticket->relatedBadgeGroups);
|
||||
if ($badgeId ne "" && keys %badgeGroups > 0 && $ticket->get('relatedBadgeGroups') ne '') { # skip check if it has no badge groups
|
||||
my @badgeGroupIds = split("\n",$ticket->get('relatedBadgeGroups'));
|
||||
my $found = 0;
|
||||
BADGE: {
|
||||
foreach my $a (@badgeGroups) {
|
||||
foreach my $b (@groups) {
|
||||
if ($a eq $b) {
|
||||
$found = 1;
|
||||
last BADGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for my $badgeGroupId ( @badgeGroupIds ) {
|
||||
# Hash lookup is faster than array lookup
|
||||
if ( exists $badgeGroups{ $badgeGroupId } ) {
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
unless ($found) {
|
||||
$totalTickets--;
|
||||
next;
|
||||
|
|
@ -1907,20 +2001,30 @@ className='WebGUI::Asset::Sku::EMSTicket' and state='published' and revisionDate
|
|||
my $date = WebGUI::DateTime->new($session, mysql => $ticket->startDate)
|
||||
->set_time_zone($self->timezone)
|
||||
->webguiDate("%W %z %Z");
|
||||
push(@records, {
|
||||
title => $ticket->getTitle,
|
||||
description => $description,
|
||||
price => $ticket->getPrice+0,
|
||||
quantityAvailable => $ticket->getQuantityAvailable,
|
||||
url => $ticket->getUrl,
|
||||
editUrl => $ticket->getUrl('func=edit'),
|
||||
deleteUrl => $ticket->getUrl('func=delete'),
|
||||
assetId => $ticket->getId,
|
||||
eventNumber => $ticket->eventNumber,
|
||||
location => $ticket->location,
|
||||
startDate => $date,
|
||||
duration => $ticket->duration,
|
||||
});
|
||||
|
||||
my $properties = {
|
||||
title => $ticket->getTitle,
|
||||
description => $description,
|
||||
price => $ticket->getPrice+0,
|
||||
quantityAvailable => $ticket->getQuantityAvailable,
|
||||
url => $ticket->getUrl,
|
||||
editUrl => $ticket->getUrl('func=edit'),
|
||||
deleteUrl => $ticket->getUrl('func=delete'),
|
||||
assetId => $ticket->getId,
|
||||
eventNumber => $ticket->eventNumber,
|
||||
location => $ticket->location,
|
||||
startDate => $date,
|
||||
duration => $ticket->duration,
|
||||
};
|
||||
|
||||
# Determine if we're able to add this ticket due to Badge Group limits
|
||||
for my $badgeGroupId ( split /\n/, $ticket->get('relatedBadgeGroups') ) {
|
||||
if ( $fullBadgeGroups{ $badgeGroupId } ) {
|
||||
$properties->{ limitReached } = 1;
|
||||
}
|
||||
}
|
||||
|
||||
push(@records, $properties);
|
||||
last unless (scalar(@records) < $numberOfResults);
|
||||
}
|
||||
|
||||
|
|
@ -2490,6 +2594,13 @@ sub www_printBadge {
|
|||
my $registrant = $self->getRegistrant($form->get('badgeId'));
|
||||
my $badge = WebGUI::Asset::Sku::EMSBadge->newById($session, $registrant->{badgeAssetId});
|
||||
$registrant->{badgeTitle} = $badge->getTitle;
|
||||
|
||||
# Add badge metadata
|
||||
my $meta = $badge->getMetaDataAsTemplateVariables;
|
||||
for my $key ( keys %{$meta} ) {
|
||||
$registrant->{ "badgeMeta_" . $key } = $meta->{ $key };
|
||||
}
|
||||
|
||||
return $self->processTemplate($registrant,$self->printBadgeTemplateId);
|
||||
}
|
||||
|
||||
|
|
@ -2583,7 +2694,12 @@ sub www_printTicket {
|
|||
$registrant->{ticketDuration} = $ticket->duration;
|
||||
$registrant->{ticketLocation} = $ticket->location;
|
||||
$registrant->{ticketEventNumber} = $ticket->eventNumber;
|
||||
return $self->processTemplate($registrant,$self->printTicketTemplateId);
|
||||
# Add ticket metadata
|
||||
my $meta = $ticket->getEventMetaData;
|
||||
for my $key ( keys %{$meta} ) {
|
||||
$registrant->{ "ticketMeta_" . $key } = $meta->{ $key };
|
||||
}
|
||||
return $self->processTemplate($registrant,$self->printTicketTemplateId);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2494,6 +2494,12 @@ sub www_editThingSave {
|
|||
my $thingId = $self->session->form->process("thingId");
|
||||
my $fields = $self->getFields($thingId);
|
||||
|
||||
if($fields->rows < 1){
|
||||
$self->session->log->warn("Thing failed to create because it had no fields");
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_Thingy");
|
||||
return $self->www_editThing($i18n->get("thing must have fields"));
|
||||
}
|
||||
|
||||
my $thing = {
|
||||
thingId => $thingId,
|
||||
label => $form->process("label"),
|
||||
|
|
@ -2524,12 +2530,6 @@ sub www_editThingSave {
|
|||
};
|
||||
$self->setCollateral("Thingy_things", "thingId", $thing, 0, 1);
|
||||
|
||||
if($fields->rows < 1){
|
||||
$self->session->log->warn("Thing failed to create because it had no fields");
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_Thingy");
|
||||
return $self->www_editThing($i18n->get("thing must have fields"));
|
||||
}
|
||||
|
||||
while (my $field = $fields->hashRef) {
|
||||
my $display = $self->session->form->process("display_".$field->{fieldId}) || 0;
|
||||
my $viewScreenTitle = $self->session->form->process("viewScreenTitle_".$field->{fieldId}) || 0;
|
||||
|
|
@ -3921,6 +3921,7 @@ sub www_viewThingData {
|
|||
my $thingId = shift || $session->form->process('thingId');
|
||||
my $thingDataId = shift || $session->form->process('thingDataId');
|
||||
my $templateId = shift || $session->form->process('templateId');
|
||||
my $callerAssetId = shift || $session->form->process('callerAssetId');
|
||||
my $var = $self->get;
|
||||
my $url = $self->getUrl;
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_Thingy");
|
||||
|
|
@ -3933,6 +3934,7 @@ sub www_viewThingData {
|
|||
$var->{"addThing_url"} = $session->url->append($url, 'func=editThing;thingId=new');
|
||||
$var->{"manage_url"} = $session->url->append($url, 'func=manage');
|
||||
$var->{"thing_label"} = $thingProperties->{label};
|
||||
$var->{"callerAssetId"} = $callerAssetId;
|
||||
|
||||
if($self->hasPrivileges($thingProperties->{groupIdEdit})){
|
||||
$var->{"edit_url"} = $session->url->append($url,'func=editThingData;thingId='
|
||||
|
|
|
|||
|
|
@ -162,9 +162,7 @@ sub www_exportStatus {
|
|||
return $session->privilege->insufficient
|
||||
unless $session->user->isInGroup(13);
|
||||
my $form = $session->form;
|
||||
my @vars = qw(
|
||||
index depth userId extrasUploadsAction rootUrlAction exportUrl exportRelated
|
||||
);
|
||||
my @vars = qw(index depth userId rootUrlAction exportUrl exportRelated);
|
||||
$asset->forkWithStatusPage({
|
||||
plugin => 'ProgressTree',
|
||||
title => 'Page Export Status',
|
||||
|
|
@ -173,6 +171,9 @@ sub www_exportStatus {
|
|||
message => 'Your assets have been exported!',
|
||||
groupId => 13,
|
||||
args => {
|
||||
# Note the difference in spelling...
|
||||
# v---no s s-----v
|
||||
extrasUploadAction => scalar $form->get('extrasUploadsAction'),
|
||||
assetId => $asset->getId,
|
||||
map { $_ => scalar $form->get($_) } @vars
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ our $HELP = {
|
|||
{ 'name' => 'purchaseComplete'},
|
||||
{ 'name' => 'hasCheckedIn'},
|
||||
{ 'name' => 'transactionItemId'},
|
||||
{ 'name' => 'badgeMeta_', description => 'help badgeMeta' },
|
||||
],
|
||||
isa => [
|
||||
{ namespace => "Asset_Template",
|
||||
|
|
@ -217,6 +218,7 @@ our $HELP = {
|
|||
{ 'name' => 'purchaseComplete'},
|
||||
{ 'name' => 'hasCheckedIn'},
|
||||
{ 'name' => 'transactionItemId'},
|
||||
{ 'name' => 'ticketMeta_', description => 'help ticketMeta' },
|
||||
],
|
||||
isa => [
|
||||
{ namespace => "Asset_Template",
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ our $HELP = {
|
|||
{
|
||||
'name' => 'variables by label',
|
||||
},
|
||||
{ 'name' => 'callerAssetId' },
|
||||
],
|
||||
related => [
|
||||
{ tag => 'edit thing template',
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Package WebGUI::Macro::RenderThingData
|
|||
|
||||
Macro that allows users to render thing data.
|
||||
|
||||
=head2 process ( thingURL, templateHint )
|
||||
=head2 process ( thingURL, templateHint, callerAssetId )
|
||||
|
||||
=head3 thingHint
|
||||
|
||||
|
|
@ -33,12 +33,17 @@ The URL from which to pull the thingId and thingDataId
|
|||
|
||||
Optional. Specifies the templateId or template url to use. If omitted, the default thingy view template will be used.
|
||||
|
||||
=head3 callerAssetId
|
||||
|
||||
Optional. Passes an assetId to the template (as a template var named callerAssetId) so that the the assetId of of
|
||||
the caller can be known by the called template. Generally you should pass <tmpl_var assetId>.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($session, $thingDataUrl, $templateHint ) = @_;
|
||||
my ($session, $thingDataUrl, $templateHint, $callerAssetId ) = @_;
|
||||
my $i18n = WebGUI::International->new($session, 'Macro_RenderThingData');
|
||||
return $i18n->get('no template') if !$templateHint;
|
||||
|
||||
|
|
@ -57,7 +62,7 @@ sub process {
|
|||
return ( $i18n->get('bad url') . $thingDataUrl ) if !$thing || !$thingId || !$thingDataId;
|
||||
|
||||
# Render
|
||||
my $output = $thing->www_viewThingData( $thingId, $thingDataId, $templateHint );
|
||||
my $output = $thing->www_viewThingData( $thingId, $thingDataId, $templateHint, $callerAssetId );
|
||||
|
||||
# FIX: Temporary solution (broken map due to template rendering <script> tags)
|
||||
return $i18n->get('bad tags') if $output =~ /script>/;
|
||||
|
|
|
|||
|
|
@ -120,22 +120,23 @@ sub execute {
|
|||
# and send the appropriate cookie with the request.
|
||||
my $sitename = $session->config->get("sitename")->[0];
|
||||
FEED: foreach my $feed (@{ $calendar->getFeeds }) {
|
||||
if ($feed->{url} =~ m{http://[^/]*$sitename}) {
|
||||
$feed->{url} .= ( $feed->{url} =~ /[?]/ ? ";" : "?" ) . "adminId=".$session->getId;
|
||||
my $url = $feed->{url};
|
||||
if ($url =~ m{http://[^/]*$sitename}) {
|
||||
$url .= ( $url =~ /[?]/ ? ";" : "?" ) . "adminId=".$session->getId;
|
||||
$session->db->write("REPLACE INTO userSessionScratch (sessionId,name,value) VALUES (?,?,?)",
|
||||
[$session->getId,$calendar->getId,"SPECTRE"]);
|
||||
}
|
||||
|
||||
# Get the feed
|
||||
$session->log->info( "Trying Calendar feed ".$feed->{url}." for $calendarTitle" );
|
||||
my $response = $ua->get($feed->{url});
|
||||
$session->log->info( "Trying Calendar feed ".$url." for $calendarTitle" );
|
||||
my $response = $ua->get($url);
|
||||
|
||||
if (!$response->is_success) {
|
||||
# Update the result and last updated fields
|
||||
$feed->{lastResult} = $response->message || $response->content;
|
||||
$feed->{lastUpdated} = $dt;
|
||||
$calendar->setFeed($feed->{feedId}, $feed);
|
||||
$session->log->info( "Calendar feed ".$feed->{url}." for $calendarTitle failed" );
|
||||
$session->log->warn( "Calendar feed ".$url." for $calendarTitle failed" );
|
||||
next FEED;
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +147,8 @@ sub execute {
|
|||
$feed->{lastResult} = "Error parsing iCal feed";
|
||||
$feed->{lastUpdated} = $dt;
|
||||
$calendar->setFeed($feed->{feedId}, $feed);
|
||||
#next FEED;
|
||||
$session->log->warn( "Calendar feed ".$url." for $calendarTitle could not be parsed" );
|
||||
next FEED;
|
||||
}
|
||||
my $feedData = $feedList->{$feed->{feedId}} = {
|
||||
added => 0,
|
||||
|
|
|
|||
|
|
@ -954,13 +954,13 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'pageNextUrl monthVar' => {
|
||||
message => q|A URL to the next month in the calendar.|,
|
||||
lastUpdated => 1269839944,
|
||||
message => q|A URL to the next year in the calendar.|,
|
||||
lastUpdated => 1309212604,
|
||||
},
|
||||
|
||||
'pagePrevUrl monthVar' => {
|
||||
message => q|A URL to the previous month in the calendar.|,
|
||||
lastUpdated => 1269839951,
|
||||
message => q|A URL to the previous year in the calendar.|,
|
||||
lastUpdated => 1309212606,
|
||||
},
|
||||
|
||||
'pageNextYear' => {
|
||||
|
|
|
|||
|
|
@ -2277,6 +2277,36 @@ normal templates.|,
|
|||
# },
|
||||
|
||||
|
||||
'help badgeMeta' => {
|
||||
message => 'Add a metadata value to the template by adding the name after "badgeMeta_". ex: badgeMeta_department',
|
||||
lastUpdated => 0,
|
||||
context => 'help text for template variable',
|
||||
},
|
||||
|
||||
'help ticketMeta' => {
|
||||
message => 'Add a metadata value to the template by adding the name after "ticketMeta_". ex: ticketMeta_department',
|
||||
lastUpdated => 0,
|
||||
context => 'help text for template variable',
|
||||
},
|
||||
|
||||
'badge group ticketsPerBadge' => {
|
||||
message => 'Tickets Per Badge',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for badge group property',
|
||||
},
|
||||
|
||||
'badge group ticketsPerBadge help' => {
|
||||
message => "The number of tickets each badge in this group is allowed to purchase",
|
||||
lastUpdated => 0,
|
||||
context => 'Help text for badge group property',
|
||||
},
|
||||
|
||||
'error badge group ticket limit' => {
|
||||
message => q{Cannot add %s because ticket limit reached},
|
||||
lastUpdated => 0,
|
||||
context => q{Error message when trying to add too many tickets to a badge},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -1162,6 +1162,12 @@ below/after the form element.|,
|
|||
context => q|Hoverhelp for edit field screen|,
|
||||
},
|
||||
|
||||
'callerAssetId' => {
|
||||
message => q|When passed into the www_viewThingData, provides the assetId of the caller asset. Used by RenderThingMacro. See POD.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Template variable help for www_viewThingData|,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ if (!($^O =~ /^Win/i) && $> != 0 && !$override) {
|
|||
print "Starting up..." unless ($quiet);
|
||||
my $session = WebGUI::Session->open($configFile);
|
||||
$session->user({userId=>3});
|
||||
open(FILE,"<".$usersFile);
|
||||
open(FILE,"<".$usersFile) || die("Could not open $usersFile for reading: $!");
|
||||
print "OK\n" unless ($quiet);
|
||||
|
||||
my $lineNumber = 0;
|
||||
|
|
@ -81,6 +81,7 @@ my @field;
|
|||
my @profileFields = $session->db->buildArray("select fieldName from userProfileField");
|
||||
while(my $line = <FILE>) {
|
||||
$lineNumber++;
|
||||
|
||||
chomp $line;
|
||||
next
|
||||
if $line eq '';
|
||||
|
|
@ -179,7 +180,25 @@ while(my $line = <FILE>) {
|
|||
}
|
||||
if ($user{groups}) {
|
||||
my @groups = split(/,/,$user{groups});
|
||||
$u->addToGroups(\@groups,$user{expireOffset});
|
||||
# Groups that have : in them have unique expiration dates
|
||||
$u->addToGroups([grep { !/:/ } @groups],$user{expireOffset});
|
||||
for my $groupDef ( grep { /:/ } @groups ) {
|
||||
my ( $groupId, $expireDate ) = split /:/, $groupDef, 2;
|
||||
|
||||
# Calculate expiration offset
|
||||
my $dtparse = DateTime::Format::Strptime->new(
|
||||
pattern => '%F %T',
|
||||
on_error => 'croak',
|
||||
);
|
||||
|
||||
eval {
|
||||
my $expireOffset = $dtparse->parse_datetime( $expireDate )->epoch - time;
|
||||
$u->addToGroups( [$groupId], $expireOffset );
|
||||
};
|
||||
if ( $@ ) {
|
||||
print "Could not add user $user{username} to group $groupId: $@";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -345,6 +364,12 @@ Specify a comma separated list of WebGUI Group Ids that each loaded
|
|||
user will be set to. It can be overridden in the import file for
|
||||
specific users.
|
||||
|
||||
You can specify a unique expiration date for a group by adding it
|
||||
after the group ID, seperated by a colon. The date/time should be in
|
||||
"YYYY-MM-DD HH:NN:SS" format.
|
||||
|
||||
groupId:2000-01-01 01:00:00,groupId2:2001-01-02 02:00:00
|
||||
|
||||
=item B<--ldapUrl uri>
|
||||
|
||||
Specify the URI used to connect to the LDAP server for authentication.
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -32,7 +32,7 @@ my $session = WebGUI::Test->session;
|
|||
$templateMock->mock_id( $templateId );
|
||||
$templateMock->mock_url( $templateUrl );
|
||||
|
||||
plan tests => 6;
|
||||
plan tests => 7;
|
||||
|
||||
my $node = WebGUI::Test->asset;
|
||||
my $thingy = $node->addChild({
|
||||
|
|
@ -107,3 +107,6 @@ $output = WebGUI::Macro::RenderThingData::process($session, $thing_url, $templat
|
|||
ok $templateProcessed, '... passed template url, template processed';
|
||||
$templateProcessed = 0;
|
||||
|
||||
$output = WebGUI::Macro::RenderThingData::process($session, $thing_url, $templateUrl, "fakeAssetId");
|
||||
ok $templateVars->{'callerAssetId'} eq 'fakeAssetId', '... passed callerAssetId, template var was passed';
|
||||
$templateProcessed = 0;
|
||||
|
|
|
|||
|
|
@ -13,17 +13,16 @@ use strict;
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Workflow::Activity::CalendarUpdateFeeds;
|
||||
use WebGUI::Asset::Wobject::Calendar;
|
||||
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
use Test::LongString;
|
||||
use Data::Dumper;
|
||||
use WebGUI::Asset::Wobject::Calendar;
|
||||
|
||||
plan skip_all => 'set WEBGUI_LIVE to enable this test'
|
||||
unless $ENV{WEBGUI_LIVE};
|
||||
|
||||
plan tests => 23; # increment this value for each test you create
|
||||
plan tests => 27; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
@ -173,7 +172,7 @@ SKIP: {
|
|||
##Add an ical feed to check time zone processing
|
||||
|
||||
$receiver->deleteFeed($feedId);
|
||||
$receiver->addFeed({
|
||||
$feedId = $receiver->addFeed({
|
||||
url => $session->url->getSiteURL.$snippet_feed->getUrl,
|
||||
lastUpdated => 'never',
|
||||
});
|
||||
|
|
@ -201,4 +200,36 @@ $newEvents = $receiver->getLineage(['children'], { returnObjects => 1, });
|
|||
|
||||
my $got_cpr = is(scalar @{ $newEvents }, 1, 'ical import of 1 event');
|
||||
|
||||
##Add a feed that will fail, to test that feeds are not modified
|
||||
$receiver->deleteFeed($feedId);
|
||||
my $feedUrl = $session->url->getSiteURL.'do_not_hack_my_url';
|
||||
$feedId = $receiver->addFeed({
|
||||
url => $feedUrl,
|
||||
lastUpdated => 'never',
|
||||
});
|
||||
|
||||
$instance1->delete('skipNotify');
|
||||
$instance1 = WebGUI::Workflow::Instance->create($session,
|
||||
{
|
||||
workflowId => $workflow->getId,
|
||||
skipSpectreNotification => 1,
|
||||
}
|
||||
);
|
||||
|
||||
my $retVal;
|
||||
|
||||
$retVal = $instance1->run();
|
||||
is($retVal, 'complete', 'cleanup: activity complete');
|
||||
$retVal = $instance1->run();
|
||||
is($retVal, 'done', 'cleanup: activity is done');
|
||||
$instance1->delete;
|
||||
|
||||
$receiver = $receiver->cloneFromDb;
|
||||
my $feed = $receiver->getFeed($feedId);
|
||||
|
||||
##Note, cannot use Test::Deep in here because Asset/Event.pm use Test::Deep::NoTest
|
||||
|
||||
is $feed->{lastResult}, 'Error parsing iCal feed', 'After fetching a bad feed it updated the lastResult';
|
||||
is $feed->{url}, $feedUrl, '... nothing added to feed URL';
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
10
www/extras/yui-webgui/build/layout/draggable.js
vendored
10
www/extras/yui-webgui/build/layout/draggable.js
vendored
|
|
@ -8,17 +8,17 @@ var draggableObjectList=new Array();
|
|||
//Internal Config (Do not Edit)
|
||||
|
||||
//browser check
|
||||
var dom=document.getElementById&&!document.all
|
||||
//var dom=document.getElementById&&!document.all
|
||||
var docElement = document.documentElement;
|
||||
var pageURL = "";
|
||||
var topelement=dom? "HTML" : "BODY"
|
||||
//var topelement=dom? "HTML" : "BODY"
|
||||
var pageHeight=0;
|
||||
var pageWidth=0;
|
||||
var scrollJump=50;
|
||||
var blankCount=1;
|
||||
|
||||
var Dom = YAHOO.util.Dom;
|
||||
var Event = YAHOO.util.Event;
|
||||
//var Event = YAHOO.util.Event;
|
||||
var DDM = YAHOO.util.DragDropMgr;
|
||||
|
||||
|
||||
|
|
@ -26,6 +26,8 @@ var DDM = YAHOO.util.DragDropMgr;
|
|||
//goes up the parent tree until class is found. If not found, returns null
|
||||
function dragable_getObjectByClass(target,clazz) {
|
||||
var classMatch = new RegExp("\\b" + clazz + "\\b");
|
||||
var dom=document.getElementById&&!document.all;
|
||||
var topelement=dom? "HTML" : "BODY";
|
||||
while (target.tagName!=topelement && target.className.search(classMatch) == -1){
|
||||
target=dom? target.parentNode : target.parentElement
|
||||
}
|
||||
|
|
@ -153,7 +155,7 @@ YAHOO.extend(YAHOO.webgui.DDList, YAHOO.util.DDProxy, {
|
|||
|
||||
onDrag: function(e) {
|
||||
// Keep track of the direction of the drag for use during onDragOver
|
||||
var y = Event.getPageY(e);
|
||||
var y = YAHOO.util.Event.getPageY(e);
|
||||
if (y < this.lastY) {
|
||||
this.goingUp = true;
|
||||
} else if (y > this.lastY) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue