Merge branch 'master' of git@github.com:plainblack/webgui

Conflicts:

	lib/WebGUI/Asset/Wobject/EventManagementSystem.pm
	lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm
This commit is contained in:
daviddelikat 2009-10-31 10:05:59 -05:00
commit b645d3e1b2
44 changed files with 941 additions and 577 deletions

View file

@ -212,6 +212,14 @@ sub definition {
hoverHelp => $i18n->get('event submission queue template help'),
namespace => 'EMS/SubmissionQueue',
},
printRemainingTicketsTemplateId => {
fieldType => 'template',
defaultValue => 'hreA_bgxiTX-EzWCSZCZJw',
tab => 'display',
label => $i18n->get('print remaining ticket template'),
hoverHelp => $i18n->get('print remaining ticket template help'),
namespace => 'EMS/PrintRemainingTickets',
},
badgeInstructions => {
fieldType => 'HTMLArea',
defaultValue => $i18n->get('default badge instructions'),
@ -854,6 +862,7 @@ sub www_buildBadge {
importTicketsUrl => $self->getUrl('func=importEvents'),
exportTicketsUrl => $self->getUrl('func=exportEvents'),
getTicketsUrl => $self->getUrl('func=getTicketsAsJson;badgeId='.$badgeId),
printRemainingTicketsUrl => $self->getUrl('func=printRemainingTickets'),
canEdit => $self->canEdit,
hasBadge => ($badgeId ne ""),
badgeId => $badgeId,
@ -2435,6 +2444,61 @@ sub www_printBadge {
#-------------------------------------------------------------------
=head2 www_printRemainingTickets ()
Displays all of the remaining tickets for this EMS
=cut
sub www_printRemainingTickets {
my $self = shift;
my $session = $self->session;
return $session->privilege->insufficient() unless ($self->isRegistrationStaff);
my $var = $self->get;
my $sth = $session->db->read(qq{
SELECT
asset.creationDate,
assetData.*,
assetData.title as ticketTitle,
EMSTicket.price,
EMSTicket.seatsAvailable,
EMSTicket.startDate as ticketStart,
EMSTicket.duration as ticketDuration,
EMSTicket.eventNumber as ticketEventNumber,
EMSTicket.location as ticketLocation,
EMSTicket.relatedBadgeGroups,
EMSTicket.relatedRibbons,
(seatsAvailable - (select count(*) from EMSRegistrantTicket where ticketAssetId = asset.assetId)) as seatsRemaining
FROM
asset
join assetData using (assetId)
left join EMSTicket using (assetId)
WHERE
parentId=?
and className='WebGUI::Asset::Sku::EMSTicket'
and state='published'
and EMSTicket.revisionDate=(select max(revisionDate) from EMSTicket where assetId=asset.assetId)
and (seatsAvailable - (select count(*) from EMSRegistrantTicket where ticketAssetId = asset.assetId)) > 0
GROUP BY
asset.assetId
ORDER BY
title desc
},[$self->getId]);
$var->{'tickets_loop'} = [];
while (my $hash = $sth->hashRef) {
my $seatsRemaining = $hash->{seatsRemaining};
for (my $i = 0; $i < $seatsRemaining; $i++ ) {
push(@{$var->{'tickets_loop'}},$hash);
}
}
return $self->processTemplate($var,$self->get('printRemainingTicketsTemplateId'));
}
#-------------------------------------------------------------------
=head2 www_printTicket ( )
Prints a ticket using a template.
@ -2515,7 +2579,7 @@ Toggles the registrant checked in flag.
sub www_toggleRegistrantCheckedIn {
my $self = shift;
return $self->session->privilege->insfufficient() unless ($self->isRegistrationStaff);
return $self->session->privilege->insufficient() unless ($self->isRegistrationStaff);
my $db = $self->session->db;
my $badgeId = $self->session->form->param('badgeId');
my $flag = $db->quickScalar("select hasCheckedIn from EMSRegistrant where badgeId=?",[$badgeId]);
@ -2524,7 +2588,6 @@ sub www_toggleRegistrantCheckedIn {
return $self->www_manageRegistrant;
}
#-------------------------------------------------------------------
=head2 www_viewSchedule ()

View file

@ -42,6 +42,7 @@ our $HELP = {
{ 'name' => 'addTokenUrl'},
{ 'name' => 'importTicketsUrl'},
{ 'name' => 'exportTicketsUrl'},
{ 'name' => 'printRemainingTicketsUrl'},
{ 'name' => 'canEdit'},
{ 'name' => 'hasBadge'},
{ 'name' => 'badgeId'},
@ -226,6 +227,66 @@ our $HELP = {
related => [],
},
'ems print remaining ticket template' => {
source => 'sub www_printRemainingTickets',
title => 'print remaining ticket template help',
body => '',
variables => [
{ 'name' => 'tickets_loop',
'variables' => [
{ 'name' => 'ticketTitle'},
{ 'name' => 'ticketStart'},
{ 'name' => 'ticketDuration'},
{ 'name' => 'ticketLocation'},
{ 'name' => 'ticketEventNumber'},
{ 'name' => 'seatsRemaining'},
{ 'name' => 'seatsAvailable'},
{ 'name' => 'price'},
{ 'name' => 'relatedRibbons'},
{ 'name' => 'relatedBadgeGroups'},
{ 'name' => 'title'},
{ 'name' => 'menuTitle'},
{ 'name' => 'url'},
{ 'name' => 'synopsis'},
{ 'name' => 'assetId'},
{ 'name' => 'assetSize'},
{ 'name' => 'creationDate'},
{ 'name' => 'encryptPage'},
{ 'name' => 'extraHeadTags'},
{ 'name' => 'extraHeadTagsPacked'},
{ 'name' => 'groupIdEdit'},
{ 'name' => 'groupIdView'},
{ 'name' => 'inheritUrlFromParent'},
{ 'name' => 'isExportable'},
{ 'name' => 'isHidden'},
{ 'name' => 'isPrototype'},
{ 'name' => 'isPackage'},
{ 'name' => 'lastModified'},
{ 'name' => 'newWindow'},
{ 'name' => 'ownerUserId'},
{ 'name' => 'revisedBy'},
{ 'name' => 'revisionDate'},
{ 'name' => 'skipNotification'},
{ 'name' => 'tagId'},
{ 'name' => 'usePackedHeadTags'},
],
},
],
isa => [
{ namespace => "Asset_EventManagementSystem",
tag => "ems asset template variables"
},
{ namespace => "Asset_Template",
tag => "template variables"
},
{ namespace => "Asset_Wobject",
tag => "wobject template variables"
},
],
fields => [],
related => [],
},
'ems asset template variables' => {
source => 'sub definition',
title => 'ems asset template variables',

View file

@ -26,6 +26,12 @@ our $HELP = {
},
],
},
{
name => "delete_url",
},
{
name => "delete_label",
},
],
related => [
],

View file

@ -383,6 +383,80 @@ sub getMatchingAssets {
return $self->session->db->buildArrayRef($query, \@params);
}
#-------------------------------------------------------------------
=head2 getTopKeywords ( $options )
Returns a hashref of the the top N keywords as well as the total number returned sorted in alphabetical order
=head3 $options
A hashref of options to change the behavior of the method.
=head4 asset
Find all keywords for all assets below an asset, providing a WebGUI::Asset object.
=head4 assetId
Find all keywords for all assets below an asset, providing an assetId.
=head4 search
Find all keywords using the SQL clause LIKE. This can be used in tandem with asset or assetId.
=head4 limit
Limit the number of top keywords that are returned.
=cut
sub getTopKeywords {
my $self = shift;
my $options = shift;
my $sql = q|
SELECT
keyword,occurrance
FROM (
SELECT
keyword, count(keyword) as occurrance
FROM
assetKeyword
|;
my @where;
my @placeholders;
my $parentAsset;
if ($options->{asset}) {
$parentAsset = $options->{asset};
}
if ($options->{assetId}) {
$parentAsset = WebGUI::Asset->new($self->session, $options->{assetId});
}
if ($parentAsset) {
$sql .= ' INNER JOIN asset USING (assetId)';
push @where, 'lineage LIKE ?';
push @placeholders, $parentAsset->get('lineage') . '%';
}
if ($options->{search}) {
push @where, 'keyword LIKE ?';
push @placeholders, '%' . $options->{search} . '%';
}
if (@where) {
$sql .= ' WHERE ' . join(' AND ', @where);
}
$sql .= ' GROUP BY keyword';
$sql .= ' ORDER BY occurrance desc';
if ($options->{limit}) {
$sql .= ' LIMIT ' . $options->{limit};
}
$sql .= q|
) as keywords
order by keyword
|;
my $keywords = $self->session->db->buildHashRef($sql, \@placeholders);
return $keywords;
}
#-------------------------------------------------------------------

View file

@ -11,6 +11,7 @@ package WebGUI::Macro::PickLanguage; # edit this line to match your own macro na
#-------------------------------------------------------------------
use strict;
use WebGUI::Asset::Template;
=head1 NAME
@ -47,17 +48,23 @@ sub process {
return "Could not instanciate template with id [$templateId]" unless $template;
my $i18n = WebGUI::International->new($session);
my $languages = $i18n->getLanguages();
my $vars = {'lang_loop' => []};
my @lang_loop = ();
foreach my $language ( keys %$languages ) {
my $langVars = {};
$langVars->{ 'language_url' } = '?op=setLanguage;language=' . $language ;
$langVars->{ 'language_lang' } = $i18n->getLanguage($language , 'label');
$langVars->{ 'language_langAbbr' } = $i18n->getLanguage($language, 'languageAbbreviation');
$langVars->{ 'language_langAbbrLoc' } = $i18n->getLanguage($language, 'locale');
$langVars->{ 'language_langEng' } = $language;
push(@{$vars->{lang_loop}}, $langVars);
push @lang_loop, {
language_url => '?op=setLanguage;language=' . $language,
language_lang => $i18n->getLanguage($language , 'label'),
language_langAbbr => $i18n->getLanguage($language, 'languageAbbreviation'),
language_langAbbrLoc => $i18n->getLanguage($language, 'locale'),
language_langEng => $language,
};
}
return $template->process($vars);
my %vars = (
lang_loop => \@lang_loop,
delete_url => '?op=setLanguage;language=delete;',
delete_label => $i18n->get('delete',"Macro_PickLanguage"),
);
return $template->process(\%vars);
}
1;

View file

@ -560,6 +560,25 @@ our $I18N = {
context => q|help for a property label|,
},
'print remaining ticket template' => {
message => q|Print Remaining Tickets Template|,
lastUpdated => 0,
context => q|a property label|,
},
'print remaining ticket template help' => {
message => q|Which template would you like to use for printing remaining tickets?|,
lastUpdated => 0,
context => q|help for a property label|,
},
'print remaining tickets' => {
message => q|Print Remaining Tickets|,
lastUpdated => 0,
context => q|a link label on the builder page|,
},
'badge builder template' => {
message => q|Badge Builder Template|,
lastUpdated => 0,
@ -2044,12 +2063,200 @@ normal templates.|,
lastUpdated => 1131394072,
context => q|This is the help text for the 'next submission id' field, the user should be reminded not to edit this field.|
},
'print remaining ticket template help' => {
message => q|EMS Print Remaining Ticket Template|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'tickets_loop' => {
message => q|A loop containing all of the remaining tickets and their associated data|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'seatsRemaining' => {
message => q|Total number of seats remaining for the ticket|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'seatsAvailable' => {
message => q|Total number of seats available for the ticket|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'relatedRibbons' => {
message => q|Ribbons related to the ticket|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'relatedBadgeGroups' => {
message => q|Badge groups related to the ticket|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'title' => {
message => q|The title of the ticket to be printed.|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'menuTitle' => {
message => q|The title of the ticket to be displayed in the menu.|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'synopsis' => {
message => q|Synopsis of the description for the ticket.|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'assetId' => {
message => q|Asset Id of the ticket.|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'assetSize' => {
message => q|Size of this ticket asset|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'creationDate' => {
message => q|Epoch value date for when the asset was created|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'encryptPage' => {
message => q|Whether or not to encrypt the page that the ticket is dipslayed on|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'extraHeadTags' => {
message => q|Extra tags that should be displayed in the header that this ticket is displayed on|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'extraHeadTagsPacked' => {
message => q|Extra tags that should be displayed in the header that this tikcet is displayed on minimized so no whitespace exists|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'groupIdEdit' => {
message => q|The id of the group that can edit this ticket.|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'groupIdView' => {
message => q|The id of the group that can view this ticket.|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'inheritUrlFromParent' => {
message => q|Whether or not to inherit the url from the parent|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'isExportable' => {
message => q|Whether or not this ticket is exportable|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'isHidden' => {
message => q|Whether or not this ticket should be hidden from the menu.|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'isPrototype' => {
message => q|Whether or not this ticket asset is a prototype|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'isPackage' => {
message => q|Whether or not this ticket asset is a package|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'lastModified' => {
message => q|Epoch date for when this ticket was last modified|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'newWindow' => {
message => q|Whether this ticket should be displayed in a new window|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'ownerUserId' => {
message => q|User Id of the owner of this ticket|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'revisedBy' => {
message => q|Id of the user who last modified this ticket|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'revisionDate' => {
message => q|Epoch date for when this ticket was last revised|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'skipNotification' => {
message => q|Whether or not notifications for this ticket should be skipped.|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'tagId' => {
message => q|Tag Id for this asset|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'usePackedHeadTags' => {
message => q|Whether or not packed head tags should be used for this ticket|,
lastUpdated => 1147050475,
context => q|help text label|,
},
'printRemainingTicketsUrl' => {
message => q|URL to the print remaining tickets page|,
lastUpdated => 1147050475,
context => q|Field Label|,
},
# 'TODO' => {
# message => q|TODO|,
# lastUpdated => 1147050475,
# context => q|TODO|,
# },
};
1;

View file

@ -40,6 +40,21 @@ our $I18N = { ##hashref of hashes
lastUpdated => 1131394072,
context => q|The url to change languages|
},
'delete_url' => {
message => q|The url that deletes the scratch language from the session.|,
lastUpdated => 1131394072,
context => q|A template var to remove the scratch language|
},
'delete' => {
message => q|Go back to profile language.|,
lastUpdated => 1131394072,
context => q|An internationalized label to go back to the profile language|
},
'delete_label' => {
message => q|A label for the link to go back to the profile language.|,
lastUpdated => 1131394072,
context => q|Help for delete_label|
},
};