Changed default view to display master events only.
Changed default view template to control display of events in relation to one another allowing each event's template to control formating of event details. Moved all of the search functionality into it's own view method. Added template for new search method. Fixed label and hover help in add/edit event screen.
This commit is contained in:
parent
7d94874bcc
commit
d70002dfed
5 changed files with 316 additions and 107 deletions
|
|
@ -0,0 +1,214 @@
|
|||
#EventManagerTmpl000006
|
||||
#title:Default Event Management System Search
|
||||
#menuTitle:Default Event Management System Search
|
||||
#url:default-ems-search-template
|
||||
#namespace:EventManagementSystem_search
|
||||
#create
|
||||
<a name="id<tmpl_var assetId>" id="id<tmpl_var assetId>"></a>
|
||||
|
||||
<tmpl_if session.var.adminOn>
|
||||
<p><tmpl_var controls></p><br /><br />
|
||||
</tmpl_if>
|
||||
<ul>
|
||||
<tmpl_if canManageEvents>
|
||||
<li><a href='<tmpl_var manageEvents.url>'><tmpl_var manageEvents.label></a></li>
|
||||
</tmpl_if>
|
||||
<li><a href='<tmpl_var managePurchases.url>'><tmpl_var managePurchases.label></a></li>
|
||||
<li><a href="<tmpl_var checkout.url>"><tmpl_var checkout.label></a></li>
|
||||
</ul>
|
||||
|
||||
<script type="text/javascript" src="<tmpl_var ems.wobject.dir>/script/dynamicForms.js"></script>
|
||||
<script type="text/javascript">
|
||||
<tmpl_var search.filters.options>
|
||||
var advanced = 0;
|
||||
var filterCount = 0;
|
||||
|
||||
function setSelectValue(selObj,newValue) {
|
||||
for (var i=0; i<selObj.options.length; i++) {
|
||||
selObj.options[i].selected = (selObj.options[i].value==newValue)?true:false;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAdvanced() {
|
||||
var ids = ["cParams","cResults","cSearch"];
|
||||
var toggle = "";
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
if(advanced == 1) {
|
||||
toggle = "none";
|
||||
}
|
||||
document.getElementById(ids[i]).style.display=toggle;
|
||||
}
|
||||
advanced = (advanced == 1)?0:1;
|
||||
return false;
|
||||
}
|
||||
|
||||
function toggleTitle(obj) {
|
||||
if (obj.checked) {
|
||||
document.getElementById('cs_search_title_td').style.display='inline';
|
||||
} else {
|
||||
document.getElementById('cs_search_title_td').style.display='none';
|
||||
}
|
||||
}
|
||||
|
||||
function openWin (url, name, param) {
|
||||
var newwin = window.open(url, name, param);
|
||||
newwin.focus();
|
||||
}
|
||||
|
||||
function buildFilterList() {
|
||||
return "Custom Filter";
|
||||
}
|
||||
|
||||
function stripDelim(value,delim) {
|
||||
value = value.replace(/delim/g,"");
|
||||
return value;
|
||||
}
|
||||
|
||||
function unset(array, valueToUnset){
|
||||
var output=new Array(0);
|
||||
for(var i in array){
|
||||
if(i==valueToUnset){continue;}
|
||||
output[i]=array[i];
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="basicSearch"<tmpl_if isAdvSearch> style="display:none"</tmpl_if>>
|
||||
<tmpl_var basicSearch.formHeader>
|
||||
<div style="cursor:pointer;text-align:right;" onclick="document.getElementById('basicSearch').style.display='none';document.getElementById('advSearch').style.display='block';" ><a href="#">Switch To Advanced Search</a></div>
|
||||
<table width="100%" border="0" padding="1" style="border-bottom:double gray 5px;border-top:solid gray 1px;margin-bottom:5px;margin-top:5px;"><tr><td style="font-weight:bold;width:40%;">Search Keywords:</td><td style="width:60%;"><input name="searchKeywords" style="width:100%;" /></td></tr></table>
|
||||
<tmpl_var search.formSubmit>
|
||||
<tmpl_var search.formFooter>
|
||||
</div>
|
||||
|
||||
<div id="advSearch"<tmpl_unless isAdvSearch> style="display:none"</tmpl_unless>>
|
||||
<tmpl_var advSearch.formHeader>
|
||||
<div style="cursor:pointer;text-align:right;" onclick="document.getElementById('basicSearch').style.display='block';document.getElementById('advSearch').style.display='none';" ><a href="#">Switch To Basic Search</a></div>
|
||||
<table width="100%" border="0" cellpadding="8" style="border-bottom:double gray 5px;border-top:solid gray 1px;margin-bottom:5px;margin-top:5px;">
|
||||
<tbody id="filterbody">
|
||||
<tr><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td align="left"><tmpl_var search.formSubmit></td>
|
||||
<td align="right" valign="top"><a href="#" onclick="addField();">Add another Filter Field</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<tmpl_var search.formFooter>
|
||||
<script type="text/javascript">
|
||||
// load autoSearch fields
|
||||
for (var word in filterList) {
|
||||
if (filterList[word]["autoSearch"]) {
|
||||
var compa = addField();
|
||||
setSelectValue(compa,word);
|
||||
changeToType(word,filterCount);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<table width="100%" border="0" cellpadding="8" cellspacing="0" style="border-top:solid gray 2px;border-bottom:solid gray 2px;">
|
||||
<tr><th><tmpl_var name.label></th>
|
||||
<th><tmpl_var starts.label></th>
|
||||
<th><tmpl_var ends.label></th>
|
||||
<th><tmpl_var seats.label></th>
|
||||
<th><tmpl_var price.label></th>
|
||||
<th><tmpl_var requirement.label></th>
|
||||
<th><tmpl_var addToCart.label></th></tr>
|
||||
<tmpl_loop events_loop>
|
||||
<tr<tmpl_unless __ODD__> class="oddRow"<tmpl_else> class="evenRow"</tmpl_unless>><td><tmpl_var title>
|
||||
</td><td><tmpl_var startDate.human>
|
||||
</td><td><tmpl_var endDate.human>
|
||||
</td><td><tmpl_var seatsRemaining>
|
||||
</td><td><tmpl_var price>
|
||||
</td><td><tmpl_var requirement>
|
||||
</td><td><tmpl_unless eventIsFull><a href="<tmpl_var purchase.url>"><tmpl_var purchase.label></a><tmpl_else><tmpl_var purchase.label><br /></tmpl_unless>
|
||||
</td></tr>
|
||||
</tmpl_loop>
|
||||
</table>
|
||||
<tmpl_var paginateBar>
|
||||
|
||||
~~~
|
||||
<style type="text/css">
|
||||
tr.oddRow td {
|
||||
background-color:#DADADA;
|
||||
border-right:solid gray 1px;
|
||||
}
|
||||
tr.evenRow td {
|
||||
background-color:#E8E8E8;
|
||||
border-right:solid gray 1px;
|
||||
}
|
||||
.manageEvents {
|
||||
margin-top:5px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
.datacardtitle {
|
||||
background: #3D5690;
|
||||
color: white;
|
||||
font-family: verdana;
|
||||
font-weight: bold;
|
||||
font-size:13px;
|
||||
}
|
||||
|
||||
.leftnav{
|
||||
padding: 1px 1px 1px 1px;
|
||||
background: white;
|
||||
color: black;
|
||||
font-family: verdana;
|
||||
font-weight: bold;
|
||||
font-size:11px;
|
||||
border: 2px #3D5690 ridge;
|
||||
}
|
||||
.leftnavon{
|
||||
padding: 1px 1px 1px 1px;
|
||||
background: yellow;
|
||||
color: black;
|
||||
font-family: verdana;
|
||||
font-weight: bold;
|
||||
font-size:11px;
|
||||
border: 2px #3D5690 ridge;
|
||||
}
|
||||
.calendartitle {
|
||||
background: #3D5690;
|
||||
color: white;
|
||||
font-family: verdana;
|
||||
font-weight: bold;
|
||||
font-size:11px;
|
||||
}
|
||||
.filter-select {
|
||||
font-family: verdana;
|
||||
font-size: 10px;
|
||||
font-weight: normal;
|
||||
color: black;
|
||||
width: 105px;
|
||||
}
|
||||
.compare-select {
|
||||
font-family: verdana;
|
||||
font-size: 10px;
|
||||
font-weight: normal;
|
||||
color: black;
|
||||
width: 76px;
|
||||
}
|
||||
.filter-text {
|
||||
font-family: verdana;
|
||||
font-size: 10px;
|
||||
font-weight: normal;
|
||||
color: black;
|
||||
width: 114px;
|
||||
}
|
||||
.smLink {
|
||||
font-family: verdana;
|
||||
font-size: 10px;
|
||||
font-weight: normal;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
#extendedSearchLayer {display: inline;}
|
||||
|
||||
</style>
|
||||
|
|
@ -17,99 +17,6 @@
|
|||
<li><a href="<tmpl_var checkout.url>"><tmpl_var checkout.label></a></li>
|
||||
</ul>
|
||||
|
||||
<script type="text/javascript" src="<tmpl_var ems.wobject.dir>/script/dynamicForms.js"></script>
|
||||
<script type="text/javascript">
|
||||
<tmpl_var search.filters.options>
|
||||
var advanced = 0;
|
||||
var filterCount = 0;
|
||||
|
||||
function setSelectValue(selObj,newValue) {
|
||||
for (var i=0; i<selObj.options.length; i++) {
|
||||
selObj.options[i].selected = (selObj.options[i].value==newValue)?true:false;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAdvanced() {
|
||||
var ids = ["cParams","cResults","cSearch"];
|
||||
var toggle = "";
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
if(advanced == 1) {
|
||||
toggle = "none";
|
||||
}
|
||||
document.getElementById(ids[i]).style.display=toggle;
|
||||
}
|
||||
advanced = (advanced == 1)?0:1;
|
||||
return false;
|
||||
}
|
||||
|
||||
function toggleTitle(obj) {
|
||||
if (obj.checked) {
|
||||
document.getElementById('cs_search_title_td').style.display='inline';
|
||||
} else {
|
||||
document.getElementById('cs_search_title_td').style.display='none';
|
||||
}
|
||||
}
|
||||
|
||||
function openWin (url, name, param) {
|
||||
var newwin = window.open(url, name, param);
|
||||
newwin.focus();
|
||||
}
|
||||
|
||||
function buildFilterList() {
|
||||
return "Custom Filter";
|
||||
}
|
||||
|
||||
function stripDelim(value,delim) {
|
||||
value = value.replace(/delim/g,"");
|
||||
return value;
|
||||
}
|
||||
|
||||
function unset(array, valueToUnset){
|
||||
var output=new Array(0);
|
||||
for(var i in array){
|
||||
if(i==valueToUnset){continue;}
|
||||
output[i]=array[i];
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="basicSearch"<tmpl_if isAdvSearch> style="display:none"</tmpl_if>>
|
||||
<tmpl_var basicSearch.formHeader>
|
||||
<div style="cursor:pointer;text-align:right;" onclick="document.getElementById('basicSearch').style.display='none';document.getElementById('advSearch').style.display='block';" ><a href="#">Switch To Advanced Search</a></div>
|
||||
<table width="100%" border="0" padding="1" style="border-bottom:double gray 5px;border-top:solid gray 1px;margin-bottom:5px;margin-top:5px;"><tr><td style="font-weight:bold;width:40%;">Search Keywords:</td><td style="width:60%;"><input name="searchKeywords" style="width:100%;" /></td></tr></table>
|
||||
<tmpl_var search.formSubmit>
|
||||
<tmpl_var search.formFooter>
|
||||
</div>
|
||||
|
||||
<div id="advSearch"<tmpl_unless isAdvSearch> style="display:none"</tmpl_unless>>
|
||||
<tmpl_var advSearch.formHeader>
|
||||
<div style="cursor:pointer;text-align:right;" onclick="document.getElementById('basicSearch').style.display='block';document.getElementById('advSearch').style.display='none';" ><a href="#">Switch To Basic Search</a></div>
|
||||
<table width="100%" border="0" cellpadding="8" style="border-bottom:double gray 5px;border-top:solid gray 1px;margin-bottom:5px;margin-top:5px;">
|
||||
<tbody id="filterbody">
|
||||
<tr><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td align="left"><tmpl_var search.formSubmit></td>
|
||||
<td align="right" valign="top"><a href="#" onclick="addField();">Add another Filter Field</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<tmpl_var search.formFooter>
|
||||
<script type="text/javascript">
|
||||
// load autoSearch fields
|
||||
for (var word in filterList) {
|
||||
if (filterList[word]["autoSearch"]) {
|
||||
var compa = addField();
|
||||
setSelectValue(compa,word);
|
||||
changeToType(word,filterCount);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
<br /><br />
|
||||
|
||||
|
|
@ -122,14 +29,7 @@
|
|||
<th><tmpl_var requirement.label></th>
|
||||
<th><tmpl_var addToCart.label></th></tr>
|
||||
<tmpl_loop events_loop>
|
||||
<tr<tmpl_unless __ODD__> class="oddRow"<tmpl_else> class="evenRow"</tmpl_unless>><td><tmpl_var title>
|
||||
</td><td><tmpl_var startDate.human>
|
||||
</td><td><tmpl_var endDate.human>
|
||||
</td><td><tmpl_var seatsRemaining>
|
||||
</td><td><tmpl_var price>
|
||||
</td><td><tmpl_var requirement>
|
||||
</td><td><tmpl_unless eventIsFull><a href="<tmpl_var purchase.url>"><tmpl_var purchase.label></a><tmpl_else><tmpl_var purchase.label><br /></tmpl_unless>
|
||||
</td></tr>
|
||||
<tmpl_var event>
|
||||
</tmpl_loop>
|
||||
</table>
|
||||
<tmpl_var paginateBar>
|
||||
|
|
@ -211,4 +111,4 @@ tr.evenRow td {
|
|||
|
||||
#extendedSearchLayer {display: inline;}
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -650,6 +650,7 @@ create table EventManagementSystem (
|
|||
checkoutTemplateId varchar(22) binary,
|
||||
managePurchasesTemplateId varchar(22) binary,
|
||||
viewPurchaseTemplateId varchar(22) binary,
|
||||
searchTemplateId varchar(22) binary,
|
||||
paginateAfter int(11) default 10,
|
||||
groupToAddEvents varchar(22) binary,
|
||||
groupToApproveEvents varchar(22) binary,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ sub _getFieldHash {
|
|||
|
||||
my %hash;
|
||||
tie %hash, "Tie::IxHash";
|
||||
my $i18n = WebGUI::International->new($session,'Asset_EventManagementSystem');
|
||||
my $i18n = WebGUI::International->new($self->session,'Asset_EventManagementSystem');
|
||||
%hash = (
|
||||
"eventName"=>{
|
||||
name=>$i18n->get('add/edit event title'),
|
||||
|
|
@ -304,7 +304,6 @@ sub checkConflicts {
|
|||
# my $eventsInCart = $self->getEventsInCart;
|
||||
my $checkSingleEvent = shift;
|
||||
my $eventsInCart = $self->getEventsInScratchCart;
|
||||
use Data::Dumper;
|
||||
# $self->session->errorHandler->warn(Dumper($eventsInCart));
|
||||
my @schedule;
|
||||
|
||||
|
|
@ -424,6 +423,14 @@ sub definition {
|
|||
hoverHelp=>$i18n->get('view purchase template description'),
|
||||
label=>$i18n->get('view purchase template')
|
||||
},
|
||||
searchTemplateId =>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'EventManagerTmpl000006',
|
||||
tab=>"display",
|
||||
namespace=>"EventManagementSystem_search",
|
||||
hoverHelp=>$i18n->get('search template description'),
|
||||
label=>$i18n->get('search template')
|
||||
},
|
||||
paginateAfter =>{
|
||||
fieldType=>"integer",
|
||||
defaultValue=>10,
|
||||
|
|
@ -1689,8 +1696,8 @@ sub www_editEvent {
|
|||
-name => "eventList",
|
||||
-options => $prerequisiteList,
|
||||
-vertical => 1,
|
||||
-label => "add/edit event required events",
|
||||
-hoverHelp => "add/edit event required events description",
|
||||
-label => $i18n->get("add/edit event required events"),
|
||||
-hoverHelp => $i18n->get("add/edit event required events description"),
|
||||
-sortByValue => 1
|
||||
);
|
||||
|
||||
|
|
@ -2409,7 +2416,7 @@ sub prepareView {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
sub www_search {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
my $keywords = $self->session->form->get("searchKeywords");
|
||||
|
|
@ -2619,9 +2626,84 @@ sub view {
|
|||
$p->appendTemplateVars(\%var);
|
||||
$self->buildMenu(\%var);
|
||||
$var{'ems.wobject.dir'} = $self->session->config->get("extrasURL")."/wobject/EventManagementSystem";
|
||||
|
||||
return $self->session->style->process($self->processTemplate(\%var,$self->getValue("searchTemplateId")),$self->getValue("styleTemplateId"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
|
||||
# If we're at the view method there is no reason we should have anything in our scratch cart
|
||||
# so let's empty it to prevent strange and awful things from happening
|
||||
$self->emptyScratchCart;
|
||||
$self->session->scratch->delete('EMS_add_purchase_badgeId');
|
||||
$self->session->scratch->delete('EMS_add_purchase_events');
|
||||
|
||||
my $i18n = WebGUI::International->new($self->session,'Asset_EventManagementSystem');
|
||||
# Get the products available for sale for this page
|
||||
my $sql = "select p.productId, p.title, p.description, p.price, p.templateId, e.approved, e.maximumAttendees
|
||||
from products as p, EventManagementSystem_products as e
|
||||
where
|
||||
p.productId = e.productId and approved=1
|
||||
and e.assetId =".$self->session->db->quote($self->get("assetId"))."
|
||||
and p.productId not in (select distinct(productId) from EventManagementSystem_prerequisites)";
|
||||
|
||||
my $p = WebGUI::Paginator->new($self->session,$self->getUrl,$self->get("paginateAfter"));
|
||||
$p->setDataByQuery($sql);
|
||||
my $eventData = $p->getPageData;
|
||||
my @events;
|
||||
|
||||
#We are getting each events information, passing it to the *events* template and processing it
|
||||
#The html returned from each events template is returned to the Event Manager Display Template for arranging
|
||||
#how the events are displayed in relation to one another.
|
||||
foreach my $event (@$eventData) {
|
||||
my %eventFields;
|
||||
|
||||
$eventFields{'title'} = $event->{'title'};
|
||||
$eventFields{'description'} = $event->{'description'};
|
||||
$eventFields{'price'} = $event->{'price'};
|
||||
my ($numberRegistered) = $self->session->db->quickArray("select count(*) from EventManagementSystem_registrations as r, EventManagementSystem_purchases as p
|
||||
where r.purchaseId = p.purchaseId and r.productId=".$self->session->db->quote($event->{'productId'}));
|
||||
$eventFields{'numberRegistered'} = $numberRegistered;
|
||||
$eventFields{'maximumAttendees'} = $event->{'maximumAttendees'};
|
||||
$eventFields{'seatsRemaining'} = $event->{'maximumAttendees'} - $numberRegistered;
|
||||
$eventFields{'eventIsFull'} = ($eventFields{'seatsRemaining'} == 0);
|
||||
|
||||
if ($eventFields{'eventIsFull'}) {
|
||||
$eventFields{'purchase.label'} = "Sold Out";;
|
||||
}
|
||||
else {
|
||||
$eventFields{'purchase.url'} = $self->getUrl('func=addToCart;pid='.$event->{'productId'});
|
||||
$eventFields{'purchase.label'} = $i18n->get('add to cart');
|
||||
}
|
||||
push (@events, {'event' => $self->processTemplate(\%eventFields, $event->{'templateId'}) });
|
||||
}
|
||||
$var{'checkout.url'} = $self->getUrl('op=viewCart');
|
||||
$var{'checkout.label'} = "Checkout";
|
||||
$var{'events_loop'} = \@events;
|
||||
$var{'paginateBar'} = $p->getBarTraditional;
|
||||
$var{'manageEvents.url'} = $self->getUrl('func=manageEvents');
|
||||
$var{'manageEvents.label'} = $i18n->get('manage events');
|
||||
$var{'managePurchases.url'} = $self->getUrl('func=managePurchases');
|
||||
$var{'managePurchases.label'} = $i18n->get('manage purchases');
|
||||
if ($self->session->user->isInGroup($self->get("groupToManageEvents"))) {
|
||||
$var{'canManageEvents'} = 1;
|
||||
}
|
||||
else {
|
||||
$var{'canManageEvents'} = 0;
|
||||
}
|
||||
$p->appendTemplateVars(\%var);
|
||||
|
||||
my $templateId = $self->get("displayTemplateId");
|
||||
|
||||
return $self->processTemplate(\%var, undef, $self->{_viewTemplate});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,18 @@
|
|||
package WebGUI::i18n::English::Asset_EventManagementSystem;
|
||||
|
||||
our $I18N = { ##hashref of hashes
|
||||
'search template' => {
|
||||
message => q|Search Template|,
|
||||
lastUpdated => 1131394070,
|
||||
context => q|Field label for template selector|
|
||||
},
|
||||
|
||||
'search template description' => {
|
||||
message => q|Controls the layout, look, and appearence of the Event Management System Search Page.|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|Describes this template field selector|
|
||||
},
|
||||
|
||||
'add/edit help title' => {
|
||||
message => q|Add/Edit Event Management System|,
|
||||
lastUpdated => 1131394070,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue