Added the viewcart macro.
Lookup registrant now works. Fixed some bugs.
This commit is contained in:
parent
02c24aa44a
commit
23ea56bbe6
10 changed files with 164 additions and 36 deletions
Binary file not shown.
|
|
@ -71,6 +71,7 @@ sub upgradeEMS {
|
|||
$db->write("alter table EventManagementSystem add column timezone varchar(30) not null default 'America/Chicago'");
|
||||
$db->write("alter table EventManagementSystem add column templateId varchar(22) binary not null");
|
||||
$db->write("alter table EventManagementSystem add column badgeBuilderTemplateId varchar(22) binary not null default 'BMybD3cEnmXVk2wQ_qEsRQ'");
|
||||
$db->write("alter table EventManagementSystem add column lookupRegistrantTemplateId varchar(22) binary not null default 'OOyMH33plAy6oCj_QWrxtg'");
|
||||
$db->write("alter table EventManagementSystem add column badgeInstructions mediumtext");
|
||||
$db->write("alter table EventManagementSystem add column ribbonInstructions mediumtext");
|
||||
$db->write("alter table EventManagementSystem add column ticketInstructions mediumtext");
|
||||
|
|
@ -333,6 +334,7 @@ sub migrateToNewCart {
|
|||
)");
|
||||
$session->db->write("drop table shoppingCart");
|
||||
$session->setting->add('shopCartTemplateId','aIpCmr9Hi__vgdZnDTz1jw');
|
||||
$session->config->addToHash("macros","ViewCart","ViewCart");
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -330,6 +330,7 @@
|
|||
"#" : "Hash_userId",
|
||||
"/" : "Slash_gatewayUrl",
|
||||
"@" : "At_username",
|
||||
"ViewCart" : "ViewCart",
|
||||
"AOIHits" : "AOIHits",
|
||||
"AOIRank" : "AOIRank",
|
||||
"AdminBar" : "AdminBar",
|
||||
|
|
@ -358,8 +359,6 @@
|
|||
"RandomThread" : "RandomThread",
|
||||
"RootTitle" : "RootTitle",
|
||||
"Spacer" : "Spacer",
|
||||
"SubscriptionItem" : "SubscriptionItem",
|
||||
"SubscriptionItemPurchaseUrl" : "SubscriptionItemPurchaseUrl",
|
||||
"Thumbnail" : "Thumbnail",
|
||||
"User" : "User",
|
||||
"a" : "a_account",
|
||||
|
|
@ -401,7 +400,7 @@
|
|||
"WebGUI::Workflow::Activity::CleanFileCache", "WebGUI::Workflow::Activity::CleanLoginHistory", "WebGUI::Workflow::Activity::ArchiveOldThreads",
|
||||
"WebGUI::Workflow::Activity::TrashExpiredEvents", "WebGUI::Workflow::Activity::CreateCronJob", "WebGUI::Workflow::Activity::DeleteExpiredSessions",
|
||||
"WebGUI::Workflow::Activity::ExpireGroupings", "WebGUI::Workflow::Activity::PurgeOldAssetRevisions",
|
||||
"WebGUI::Workflow::Activity::ExpireSubscriptionCodes", "WebGUI::Workflow::Activity::PurgeOldTrash",
|
||||
"WebGUI::Workflow::Activity::ExpireSubscriptionCodes", "WebGUI::Workflow::Activity::PurgeOldTrash", "WebGUI::Workflow::Activity::ExpireEmsCartItems",
|
||||
"WebGUI::Workflow::Activity::GetSyndicatedContent", "WebGUI::Workflow::Activity::ProcessRecurringPayments",
|
||||
"WebGUI::Workflow::Activity::SyncProfilesToLdap", "WebGUI::Workflow::Activity::SummarizePassiveProfileLog",
|
||||
"WebGUI::Workflow::Activity::SendQueuedMailMessages","WebGUI::Workflow::Activity::CleanDatabaseCache",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use strict;
|
|||
use base 'WebGUI::Asset::Wobject';
|
||||
use Tie::IxHash;
|
||||
use WebGUI::HTMLForm;
|
||||
use JSON qw/ to_json /;
|
||||
use JSON;
|
||||
use Digest::MD5;
|
||||
use WebGUI::Workflow::Instance;
|
||||
use WebGUI::Cache;
|
||||
|
|
@ -63,9 +63,17 @@ sub definition {
|
|||
fieldType => 'template',
|
||||
defaultValue => 'BMybD3cEnmXVk2wQ_qEsRQ',
|
||||
tab => 'display',
|
||||
label => $i18n->get('extras template'),
|
||||
hoverHelp => $i18n->get('extras template help'),
|
||||
namespace => 'EMS/Extras',
|
||||
label => $i18n->get('badge builder template'),
|
||||
hoverHelp => $i18n->get('badge builder template help'),
|
||||
namespace => 'EMS/BadgeBuilder',
|
||||
},
|
||||
lookupRegistrantTemplateId => {
|
||||
fieldType => 'template',
|
||||
defaultValue => 'OOyMH33plAy6oCj_QWrxtg',
|
||||
tab => 'display',
|
||||
label => $i18n->get('lookup registrant template'),
|
||||
hoverHelp => $i18n->get('lookup registrant template help'),
|
||||
namespace => 'EMS/LookupRegistrant',
|
||||
},
|
||||
badgeInstructions => {
|
||||
fieldType => 'HTMLArea',
|
||||
|
|
@ -274,7 +282,7 @@ sub view {
|
|||
<p>
|
||||
<a href="|.$self->getUrl('func=add;class=WebGUI::Asset::Sku::EMSBadge').q|">Add a badge</a>
|
||||
• <a href="|.$self->getUrl('func=buildBadge').q|">View Events</a>
|
||||
• <a href="|.$self->getUrl('shop=cart').q|">View Cart</a>
|
||||
• ^ViewCart;
|
||||
• <a href="|.$self->getUrl('func=manageBadgeGroups').q|">Badge Groups</a>
|
||||
</p>
|
||||
<p>|.$self->get('badgeInstructions').q|</p>
|
||||
|
|
@ -588,7 +596,7 @@ sub www_getBadgesAsJson {
|
|||
$results{'sort'} = undef;
|
||||
$results{'dir'} = "asc";
|
||||
$session->http->setMimeType('text/json');
|
||||
return JSON::to_json(\%results);
|
||||
return JSON->new->encode(\%results);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -718,7 +726,7 @@ sub www_getRegistrantAsJson {
|
|||
$badgeInfo->{ribbons} = \@ribbons;
|
||||
|
||||
# build json datasource
|
||||
return JSON::to_json($badgeInfo);
|
||||
return JSON->new->encode($badgeInfo);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -742,9 +750,7 @@ sub www_getRegistrantsAsJson {
|
|||
my @params = ($self->getId);
|
||||
|
||||
# user or staff
|
||||
my $isEventStaff = 1;
|
||||
unless ($self->isRegistrationStaff) {
|
||||
$isEventStaff = 0;
|
||||
$sql .= " and userId=?";
|
||||
push @params, $session->user->userId;
|
||||
}
|
||||
|
|
@ -755,22 +761,24 @@ sub www_getRegistrantsAsJson {
|
|||
}
|
||||
|
||||
# limit
|
||||
$sql .= 'limit ?,?';
|
||||
$sql .= ' limit ?,?';
|
||||
push(@params, $startIndex, $numberOfResults);
|
||||
|
||||
# get badge info
|
||||
my @records = ();
|
||||
my %results = ();
|
||||
my $badges = $db->read($sql,\@params);
|
||||
$results{'recordsReturned'} = $badges->rows()+0;
|
||||
$results{'totalRecords'} = $db->quickScalar('select found_rows()') + 0; ##Convert to numeric
|
||||
while (my $badgeInfo = $badges->hashRef) {
|
||||
my $badge = WebGUI::Asset::Sku::EMSBadge->new($session, $badgeInfo->{badgeAssetId});
|
||||
$badgeInfo->{title} = $badge->getTitle;
|
||||
$badgeInfo->{sku} = $badge->get('sku');
|
||||
$badgeInfo->{assetId} = $badge->getId;
|
||||
$badgeInfo->{manageUrl} = $self->getUrl('func=manageRegistrant');
|
||||
$badgeInfo->{buildBadgeUrl} = $self->getUrl('func=buildBadge;badgeId='.$badgeInfo->{badgeId});
|
||||
push(@records, $badgeInfo);
|
||||
}
|
||||
$results{'recordsReturned'} = $badges->rows()+0;
|
||||
$results{'totalRecords'} = $db->quickScalar('select found_rows()') + 0; ##Convert to numeric
|
||||
$results{'records'} = \@records;
|
||||
$results{'startIndex'} = $startIndex;
|
||||
$results{'sort'} = undef;
|
||||
|
|
@ -778,7 +786,7 @@ sub www_getRegistrantsAsJson {
|
|||
|
||||
# build json datasource
|
||||
$session->http->setMimeType('text/json');
|
||||
return JSON::to_json(\%results);
|
||||
return JSON->new->encode(\%results);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -812,7 +820,7 @@ sub www_getRibbonsAsJson {
|
|||
$results{'sort'} = undef;
|
||||
$results{'dir'} = "asc";
|
||||
$session->http->setMimeType('text/json');
|
||||
return JSON::to_json(\%results);
|
||||
return JSON->new->encode(\%results);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -864,12 +872,24 @@ sub www_getTicketsAsJson {
|
|||
@badgeGroups = split("\n",$badge->get('relatedBadgeGroups')) if (defined $badge);
|
||||
}
|
||||
|
||||
# get a list of tickets already associated with the badge
|
||||
my @existingTickets = $db->buildArray("select ticketAssetId from EMSRegistrantTicket where badgeId=?",[$badgeId]);
|
||||
|
||||
# get assets
|
||||
my $counter = 0;
|
||||
my $totalTickets = scalar(@ids);
|
||||
my @records = ();
|
||||
foreach my $id (@ids) {
|
||||
|
||||
# gotta get to the page we're working with
|
||||
next unless ($counter >= $startIndex);
|
||||
|
||||
# skip tickets we already have
|
||||
if (isIn($id, @existingTickets)) {
|
||||
$totalTickets--;
|
||||
next;
|
||||
}
|
||||
|
||||
my $ticket = WebGUI::Asset->new($session, $id, 'WebGUI::Asset::Sku::EMSTicket');
|
||||
|
||||
# skip borked tickets
|
||||
|
|
@ -925,6 +945,14 @@ sub www_getTicketsAsJson {
|
|||
$counter++;
|
||||
}
|
||||
|
||||
# humor
|
||||
my $find = pack('u',$keywords);
|
||||
chomp $find;
|
||||
if ($find eq q|'2$%,,C`P,0``|) {
|
||||
push(@records, {title=>unpack('u',q|022=M('-O<G)Y+"!$879E+@``|)});
|
||||
$totalTickets++;
|
||||
}
|
||||
|
||||
# build json
|
||||
$results{records} = \@records;
|
||||
$results{totalRecords} = $totalTickets;
|
||||
|
|
@ -933,7 +961,7 @@ sub www_getTicketsAsJson {
|
|||
$results{'sort'} = undef;
|
||||
$results{'dir'} = "asc";
|
||||
$session->http->setMimeType('text/json');
|
||||
return JSON::to_json(\%results);
|
||||
return JSON->new->encode(\%results);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -967,21 +995,33 @@ sub www_getTokensAsJson {
|
|||
$results{'sort'} = undef;
|
||||
$results{'dir'} = "asc";
|
||||
$session->http->setMimeType('text/json');
|
||||
return JSON::to_json(\%results);
|
||||
return JSON->new->encode(\%results);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_lookupRegistrant ()
|
||||
|
||||
Displays the
|
||||
Displays the badges purchased by the current user, or all users if the user is part of the registration staff.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_lookupRegistrant {
|
||||
my $self = shift;
|
||||
return $self->www_getRegistrantsAsJson;
|
||||
return $self->processStyle("here you will be able to look up a registrant by name");
|
||||
my ($self) = @_;
|
||||
my $session = $self->session;
|
||||
return $session->privilege->noAccess() unless ($self->canView && $self->session->user->userId ne "1");
|
||||
|
||||
# set up template variables
|
||||
my %var = (
|
||||
buyBadgeUrl => $self->getUrl,
|
||||
viewEventsUrl => $self->getUrl('func=buildBadge'),
|
||||
viewCartUrl => $self->getUrl('shop=cart'),
|
||||
getRegistrantsUrl => $self->getUrl('func=getRegistrantsAsJson'),
|
||||
isRegistrationStaff => $self->isRegistrationStaff,
|
||||
);
|
||||
|
||||
# render the page
|
||||
return $self->processStyle($self->processTemplate(\%var, $self->get('lookupRegistrantTemplateId')));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1872,7 +1912,7 @@ sub getBadgeSelector {
|
|||
};
|
||||
}
|
||||
$js = '<script type="text/javascript">
|
||||
var badges = '.to_json(\%badgeJS).';
|
||||
var badges = '.JSON->new->encode(\%badgeJS).';
|
||||
</script>';
|
||||
%options = (%options,%{$badges});
|
||||
$output .= WebGUI::Form::selectBox($self->session,{
|
||||
|
|
|
|||
47
lib/WebGUI/Macro/ViewCart.pm
Normal file
47
lib/WebGUI/Macro/ViewCart.pm
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package WebGUI::Macro::ViewCart;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::ViewCart
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Displays a view cart link and image.
|
||||
|
||||
=head2 process( $session, [ linktext ] )
|
||||
|
||||
Renders the macro.
|
||||
|
||||
=head3 linktext
|
||||
|
||||
Defaults to "View Cart".
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($session, $text) = @_;
|
||||
unless ($text) {
|
||||
$text = WebGUI::International->new($session,"Shop")->get("view cart");
|
||||
}
|
||||
my $url = $session->url->page("shop=cart");
|
||||
return '<a href="'.$url.'"><img src="'.$session->url->extras('/macro/ViewCart/cart.gif').'" alt="'.$text.'" style="border: 0px;vertical-align: middle;" /></a> <a href="'.$url.'">'.$text.'</a>';
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -348,11 +348,11 @@ sub buildSearchQuery {
|
|||
else {
|
||||
$$sql .= ' where (';
|
||||
}
|
||||
$keywords = '%'.$keywords.'%';
|
||||
$keywords = lc('%'.$keywords.'%');
|
||||
my $counter = 0;
|
||||
foreach my $field (@{ $columns }) {
|
||||
$$sql .= ' or' if ($counter > 0);
|
||||
$$sql .= qq{ $field like ?};
|
||||
$$sql .= qq{ LOWER( $field ) like ?};
|
||||
push(@{$placeHolders}, $keywords);
|
||||
$counter++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -352,12 +352,10 @@ sub www_selectPaymentGateway {
|
|||
}
|
||||
|
||||
# All the output stuff below is just a placeholder until it's templated.
|
||||
my $output .= $i18n->echo('Choose one of the following payment gateways to check out:');
|
||||
$output .= '<table border="0">';
|
||||
my $output .= $i18n->echo('How would you like to pay?');
|
||||
foreach my $payOption ( values %{$self->getOptions( $cart )} ) {
|
||||
$output .= '<tr><td>' . $payOption->{label} . '</td><td>' . $payOption->{button} . '</td></tr>';
|
||||
$output .= $payOption->{button} . '<br />';
|
||||
}
|
||||
$output .= '</table>';
|
||||
|
||||
return $session->style->userStyle( $output );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ our $I18N = {
|
|||
context => q|help for a workflow activity field label|,
|
||||
},
|
||||
|
||||
'badge number' => {
|
||||
message => q|Badge #|,
|
||||
lastUpdated => 0,
|
||||
context => q|a property label|,
|
||||
},
|
||||
|
||||
'percentage discount' => {
|
||||
message => q|Percentage Discount|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -62,12 +68,6 @@ our $I18N = {
|
|||
context => q|a link label|,
|
||||
},
|
||||
|
||||
'view cart' => {
|
||||
message => q|View Cart|,
|
||||
lastUpdated => 0,
|
||||
context => q|a link label|,
|
||||
},
|
||||
|
||||
'view tickets' => {
|
||||
message => q|View Tickets|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -200,6 +200,42 @@ our $I18N = {
|
|||
context => q|a template label a tab in the badge builder|,
|
||||
},
|
||||
|
||||
'lookup registrant template' => {
|
||||
message => q|Lookup Registrant|,
|
||||
lastUpdated => 0,
|
||||
context => q|a property label|,
|
||||
},
|
||||
|
||||
'lookup registrant template help' => {
|
||||
message => q|Which template would you like to use for the lookup registrant screen?|,
|
||||
lastUpdated => 0,
|
||||
context => q|help for a property label|,
|
||||
},
|
||||
|
||||
'badge builder template' => {
|
||||
message => q|Badge Builder Template|,
|
||||
lastUpdated => 0,
|
||||
context => q|a property label|,
|
||||
},
|
||||
|
||||
'badge builder template help' => {
|
||||
message => q|Which template would you like to use for the badge builder screen?|,
|
||||
lastUpdated => 0,
|
||||
context => q|help for a property label|,
|
||||
},
|
||||
|
||||
'main template' => {
|
||||
message => q|Main Template|,
|
||||
lastUpdated => 0,
|
||||
context => q|a property label|,
|
||||
},
|
||||
|
||||
'main template help' => {
|
||||
message => q|Which template would you like to use for the main screen that lists the badges for purchase?|,
|
||||
lastUpdated => 0,
|
||||
context => q|help for a property label|,
|
||||
},
|
||||
|
||||
'location' => {
|
||||
message => q|Location|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@ package WebGUI::i18n::English::Shop;
|
|||
use strict;
|
||||
|
||||
our $I18N = {
|
||||
'view cart' => {
|
||||
message => q|View Cart|,
|
||||
lastUpdated => 0,
|
||||
context => q|a link label|,
|
||||
},
|
||||
|
||||
'my purchases template' => {
|
||||
message => q|My Purchases Template|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
BIN
www/extras/macro/ViewCart/cart.gif
Normal file
BIN
www/extras/macro/ViewCart/cart.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
Add table
Add a link
Reference in a new issue