[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14232] validations
From: |
Saul |
Subject: |
[Fmsystem-commits] [14232] validations |
Date: |
Thu, 22 Oct 2015 22:38:14 +0000 |
Revision: 14232
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14232
Author: psaul
Date: 2015-10-22 22:38:13 +0000 (Thu, 22 Oct 2015)
Log Message:
-----------
validations
Modified Paths:
--------------
branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
branches/dev-syncromind/booking/inc/class.uibooking.inc.php
branches/dev-syncromind/booking/inc/class.uievent.inc.php
branches/dev-syncromind/booking/js/booking/application.js
branches/dev-syncromind/booking/js/booking/booking.js
branches/dev-syncromind/booking/js/booking/event.js
branches/dev-syncromind/booking/templates/base/allocation_edit.xsl
branches/dev-syncromind/booking/templates/base/allocation_new.xsl
branches/dev-syncromind/booking/templates/base/application_edit.xsl
branches/dev-syncromind/booking/templates/base/application_new.xsl
branches/dev-syncromind/booking/templates/base/booking_edit.xsl
branches/dev-syncromind/booking/templates/base/booking_new.xsl
branches/dev-syncromind/booking/templates/base/event_edit.xsl
branches/dev-syncromind/booking/templates/base/event_new.xsl
Modified: branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
2015-10-22 16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
2015-10-22 22:38:13 UTC (rev 14232)
@@ -657,10 +657,10 @@
$application = $this->extract_form_data();
foreach ($_POST['from_'] as &$from) {
- $from = date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($from));
+ $from = ($from) ? date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($from)) : "";
}
foreach ($_POST['to_'] as &$to) {
- $to = date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($to));
+ $to = ($to) ? date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($to)) : "";
}
$application['dates'] = array_map(array(self,
'_combine_dates'), $_POST['from_'], $_POST['to_']);
@@ -755,6 +755,7 @@
$activity_id = phpgw::get_var('activity_id', 'int',
'REQUEST', -1);
$activity_path =
$this->activity_bo->get_path($activity_id);
$top_level_activity = $activity_path ?
$activity_path[0]['id'] : -1;
+ array_set_default($application, 'activity_id',
$activity_id);
$activities = $this->activity_bo->fetch_activities();
$activities = $activities['results'];
$agegroups =
$this->agegroup_bo->fetch_age_groups($top_level_activity);
@@ -796,7 +797,7 @@
$active_tab = 'generic';
$application['tabs'] =
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
- $application['validator'] =
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
'file'));
+
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
'file'), 'application_form');
self::add_javascript('booking', 'booking',
'application.js');
self::adddatetimepicker();
@@ -878,13 +879,14 @@
$audience = $audience['results'];
$this->install_customer_identifier_ui($application);
$application['customer_identifier_types']['ssn'] =
'Date of birth or SSN';
+ $application['audience_json'] =
json_encode(array_map('intval',$application['audience']));
//test
$GLOBALS['phpgw']->jqcal->add_listener('start_date',
'datetime');
$GLOBALS['phpgw']->jqcal->add_listener('end_date',
'datetime');
// self::render_template('application_edit',
array('application' => $application, 'activities' => $activities, 'agegroups'
=> $agegroups, 'audience' => $audience));
$application['tabs'] =
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
- $application['validator'] =
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
'file'));
+ $application['validator'] =
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
'file'), 'application_form');
self::render_template_xsl('application_edit',
array('application' => $application, 'activities' => $activities, 'agegroups'
=> $agegroups, 'audience' => $audience));
}
@@ -959,7 +961,7 @@
$activity_path =
$this->activity_bo->get_path($application['activity_id']);
$top_level_activity = $activity_path ?
$activity_path[0]['id'] : 0;
- $tabs = array();
+ $tabs = array();
$tabs['generic'] = array('label' =>
lang('Application'), 'link' => '#application');
$active_tab = 'generic';
Modified: branches/dev-syncromind/booking/inc/class.uibooking.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uibooking.inc.php 2015-10-22
16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/inc/class.uibooking.inc.php 2015-10-22
22:38:13 UTC (rev 14232)
@@ -369,9 +369,6 @@
$booking['from_'] = date("Y-m-d
H:i:s",$timestamp);
$timestamp = strtotime($booking['to_']);
$booking['to_'] = date("Y-m-d
H:i:s",$timestamp);
-
- $booking['from_'] =
pretty_timestamp($booking['from_']);
- $booking['to_'] =
pretty_timestamp($booking['to_']);
if(strlen($_POST['from_']) < 6)
{
@@ -526,6 +523,8 @@
}
}
}
+ $booking['from_'] =
pretty_timestamp($booking['from_']);
+ $booking['to_'] =
pretty_timestamp($booking['to_']);
}
if($allocation['cost'] > 0) {
$errors['cost'] = lang('There is a cost of %1
assosiated with the allocation you are useing',$allocation['cost']);
@@ -533,15 +532,40 @@
$this->flash_form_errors($errors);
unset($errors['cost']);
self::add_javascript('booking', 'booking',
'booking.js');
- array_set_default($booking, 'resources', array());
+
+ if(phpgw::get_var('resource', 'GET') == 'null')
+ {
+ array_set_default($application, 'resources',
array());
+ }
+ else
+ {
+ $resources =
explode(",",phpgw::get_var('resource', 'GET'));
+ array_set_default($booking, 'resources',
$resources);
+ }
+ array_set_default($booking, 'season_id',
phpgw::get_var('season_id', 'GET'));
+ array_set_default($booking, 'group_id',
phpgw::get_var('group_id', 'GET'));
+ array_set_default($booking, 'building_id',
phpgw::get_var('building_id', 'GET'));
+ array_set_default($booking, 'building_name',
phpgw::get_var('building_name', 'GET'));
+ if (strstr($application['building_name'],"%")){
+ $search = array('%C3%85', '%C3%A5', '%C3%98',
'%C3%B8', '%C3%86', '%C3%A6');
+ $replace = array ('Å','å','Ø','ø','Æ','æ');
+ $application['building_name'] =
str_replace($search, $replace, $application['building_name']);
+ }
+
$booking['resources_json'] =
json_encode(array_map('intval', $booking['resources']));
$booking['cancel_link'] = self::link(array('menuaction'
=> 'booking.uimassbooking.index'));
- $agegroups = $this->agegroup_bo->fetch_age_groups();
+
+ $activity_id = phpgw::get_var('activity_id', 'int',
'REQUEST', -1);
+ $activity_path =
$this->activity_bo->get_path($activity_id);
+ $top_level_activity = $activity_path ?
$activity_path[0]['id'] : -1;
+ $activities = $this->activity_bo->fetch_activities();
+ $activities = $activities['results'];
+ $agegroups =
$this->agegroup_bo->fetch_age_groups($top_level_activity);
$agegroups = $agegroups['results'];
- $audience = $this->audience_bo->fetch_target_audience();
+ $audience =
$this->audience_bo->fetch_target_audience($top_level_activity);
$audience = $audience['results'];
- $activities = $this->activity_bo->fetch_activities();
- $activities = $activities['results'];
+ $booking['audience_json'] =
json_encode(array_map('intval',$booking['audience']));
+
$groups =
$this->group_bo->so->read(array('filters'=>array('organization_id'=>$allocation['organization_id'],
'active'=>1)));
$groups = $groups['results'];
@@ -573,10 +597,9 @@
'date_from' => $time_from[0],
'date_to' => $time_to[0],
'application_id' => $application_id,
- 'noallocation' => $noallocation)
-
+ 'noallocation' => $noallocation)
);
- }
+ }
else if ($step == 2)
{
self::render_template_xsl('booking_new_preview', array('booking' => $booking,
@@ -594,7 +617,7 @@
'invalid_dates' => $invalid_dates,
'groups' => $groups,
'application_id' => $application_id,
- 'noallocation' => $noallocation)
+ 'noallocation' => $noallocation)
);
}
}
@@ -631,6 +654,10 @@
{
$id = intval(phpgw::get_var('id', 'GET'));
$booking = $this->bo->read_single($id);
+
+ $activity_path =
$this->activity_bo->get_path($booking['activity_id']);
+ $top_level_activity = $activity_path ?
$activity_path[0]['id'] : 0;
+
$booking['group'] =
$this->group_bo->so->read_single($booking['group_id']);
$booking['organization_id'] =
$booking['group']['organization_id'];
$booking['organization_name'] =
$booking['group']['organization_name'];
@@ -674,12 +701,13 @@
$booking['resources_json'] =
json_encode(array_map('intval', $booking['resources']));
$booking['cancel_link'] = self::link(array('menuaction'
=> 'booking.uibooking.show', 'id' => $booking['id']));
$booking['application_link'] =
self::link(array('menuaction' => 'booking.uiapplication.show', 'id' =>
$booking['application_id']));
- $agegroups = $this->agegroup_bo->fetch_age_groups();
+ $agegroups =
$this->agegroup_bo->fetch_age_groups($top_level_activity);
$agegroups = $agegroups['results'];
- $audience = $this->audience_bo->fetch_target_audience();
+ $audience =
$this->audience_bo->fetch_target_audience($top_level_activity);
$audience = $audience['results'];
$activities = $this->activity_bo->fetch_activities();
$activities = $activities['results'];
+ $booking['audience_json'] =
json_encode(array_map('intval',$booking['audience']));
$GLOBALS['phpgw']->jqcal->add_listener('field_from',
'datetime');
$GLOBALS['phpgw']->jqcal->add_listener('field_to',
'datetime');
@@ -858,6 +886,10 @@
public function show()
{
$booking = $this->bo->read_single(phpgw::get_var('id',
'GET'));
+
+ $activity_path =
$this->activity_bo->get_path($booking['activity_id']);
+ $top_level_activity = $activity_path ?
$activity_path[0]['id'] : 0;
+
$booking['bookings_link'] =
self::link(array('menuaction' => 'booking.uibooking.index'));
$booking['edit_link'] = self::link(array('menuaction'
=> 'booking.uibooking.edit', 'id' => $booking['id']));
$booking['delete_link'] = self::link(array('menuaction'
=> 'booking.uibooking.delete', 'id' => $booking['id']));
Modified: branches/dev-syncromind/booking/inc/class.uievent.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uievent.inc.php 2015-10-22
16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/inc/class.uievent.inc.php 2015-10-22
22:38:13 UTC (rev 14232)
@@ -515,36 +515,41 @@
{
$this->flash_form_errors($errors);
}
-
+
self::add_javascript('booking', 'booking', 'event.js');
array_set_default($event, 'resources', array());
$event['resources_json'] = json_encode(array_map('intval',
$event['resources']));
$event['cancel_link'] = self::link(array('menuaction' =>
'booking.uievent.index'));
array_set_default($event, 'cost', '0');
+
+ $activity_id = phpgw::get_var('activity_id', 'int', 'REQUEST',
-1);
+ $activity_path = $this->activity_bo->get_path($activity_id);
+ $top_level_activity = $activity_path ? $activity_path[0]['id']
: -1;
$activities = $this->activity_bo->fetch_activities();
$activities = $activities['results'];
- $agegroups = $this->agegroup_bo->fetch_age_groups();
+ $agegroups =
$this->agegroup_bo->fetch_age_groups($top_level_activity);
$agegroups = $agegroups['results'];
- $audience = $this->audience_bo->fetch_target_audience();
+ $audience =
$this->audience_bo->fetch_target_audience($top_level_activity);
$audience = $audience['results'];
$this->install_customer_identifier_ui($event);
-
- foreach ($event['dates'] as &$date) {
- $date['from_'] = pretty_timestamp($date['from_']);
- $date['to_'] = pretty_timestamp($date['to_']);
- }
-
- $GLOBALS['phpgw']->jqcal->add_listener('start_date',
'datetime');
- $GLOBALS['phpgw']->jqcal->add_listener('end_date', 'datetime');
- $tabs = array();
- $tabs['generic'] = array('label' => lang('Event New'), 'link'
=> '#event_new');
- $active_tab = 'generic';
+ foreach ($event['dates'] as &$date) {
+ $date['from_'] = pretty_timestamp($date['from_']);
+ $date['to_'] = pretty_timestamp($date['to_']);
+ }
- $event['tabs'] = phpgwapi_jquery::tabview_generate($tabs,
$active_tab);
- self::adddatetimepicker();
-
+ $GLOBALS['phpgw']->jqcal->add_listener('start_date',
'datetime');
+ $GLOBALS['phpgw']->jqcal->add_listener('end_date', 'datetime');
+
+ $tabs = array();
+ $tabs['generic'] = array('label' => lang('Event New'), 'link'
=> '#event_new');
+ $active_tab = 'generic';
+
+ $event['tabs'] = phpgwapi_jquery::tabview_generate($tabs,
$active_tab);
+ $application['validator'] =
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
'file'));
+ self::adddatetimepicker();
+
$this->add_template_helpers();
self::render_template_xsl('event_new', array('event' => $event,
'activities' => $activities, 'agegroups' => $agegroups, 'audience' =>
$audience));
}
@@ -579,6 +584,10 @@
{
$id = intval(phpgw::get_var('id', 'GET'));
$event = $this->bo->read_single($id);
+
+ $activity_path =
$this->activity_bo->get_path($event['activity_id']);
+ $top_level_activity = $activity_path ? $activity_path[0]['id']
: 0;
+
$building_info = $this->bo->so->get_building_info($id);
$event['building_id'] = $building_info['id'];
$event['building_name'] = $building_info['name'];
@@ -896,14 +905,16 @@
$activities = $activities['results'];
# $comments = array_reverse($event['comments']);
$comments = $this->bo->so->get_ordered_comments($id);
- $agegroups = $this->agegroup_bo->fetch_age_groups();
+ $agegroups =
$this->agegroup_bo->fetch_age_groups($top_level_activity);
$agegroups = $agegroups['results'];
- $audience = $this->audience_bo->fetch_target_audience();
+ $audience =
$this->audience_bo->fetch_target_audience($top_level_activity);
$audience = $audience['results'];
+ $event['audience_json'] =
json_encode(array_map('intval',$event['audience']));
+
$this->install_customer_identifier_ui($event);
$this->add_template_helpers();
-// phpgwapi_jquery::formvalidator_generate(array('location',
'date', 'security', 'file'),'activity_form');
+ phpgwapi_jquery::formvalidator_generate(array('location',
'date', 'security', 'file'));
$event['tabs'] = phpgwapi_jquery::tabview_generate($tabs,
$active_tab);
// echo '<pre>'; print_r($event);echo '</pre>';
Modified: branches/dev-syncromind/booking/js/booking/application.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/application.js 2015-10-22
16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/js/booking/application.js 2015-10-22
22:38:13 UTC (rev 14232)
@@ -5,61 +5,62 @@
JqueryPortico.autocompleteHelper('index.php?menuaction=bookingfrontend.uibuilding.index&phpgw_return_as=json&',
'field_building_name',
'field_building_id', 'building_container');
- $("#field_activity").change(function(){
- var oArgs =
{menuaction:'bookingfrontend.uiapplication.get_activity_data',
activity_id:$(this).val()};
- var requestUrl = phpGWLink('index.php', oArgs, true);
+ $("#field_activity").change(function(){
+ var oArgs =
{menuaction:'bookingfrontend.uiapplication.get_activity_data',
activity_id:$(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl,
- success: function(data) {
- var html_agegroups = '';
- var html_audience = '';
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data) {
+ var html_agegroups = '';
+ var html_audience = '';
- if( data != null)
- {
- var agegroups = data.agegroups;
- for ( var i = 0; i < agegroups.length;
++i )
- {
+ if( data != null)
+ {
+ var agegroups = data.agegroups;
+ for ( var i = 0; i < agegroups.length; ++i )
+ {
html_agegroups += "<tr>";
html_agegroups += "<th>" + agegroups[i]['name'] +
"</th>";
html_agegroups += "<td>";
html_agegroups += "<input class=\"input50\"
type=\"text\" name='male[" +agegroups[i]['id'] + "]' value='0'></input>";
- html_agegroups += "</td>";
+ html_agegroups += "</td>";
html_agegroups += "<td>";
- html_agegroups += "<input
class=\"input50\" type=\"text\" name='female[" +agegroups[i]['id'] + "]'
value='0'></input>";
- html_agegroups += "</td>";
- html_agegroups += "</tr>";
- }
- $("#agegroup_tbody").html(
html_agegroups );
+ html_agegroups += "<input class=\"input50\"
type=\"text\" name='female[" +agegroups[i]['id'] + "]' value='0'></input>";
+ html_agegroups += "</td>";
+ html_agegroups += "</tr>";
+ }
+ $("#agegroup_tbody").html( html_agegroups );
- var audience = data.audience;
- var checked = '';
- for ( var i = 0; i < audience.length;
++i )
- {
- checked = '';
- for ( var j = 0; j <
initialAudience.length; ++j )
- {
- if(audience[i]['id'] ==
initialAudience[j])
- {
- checked = "
checked='checked'";
- }
- }
- html_audience += "<li>";
- html_audience += "<label>";
- html_audience += "<input
type=\"radio\" name=\"audience[]\" value='" +audience[i]['id'] + "'" + checked+
"></input>";
- html_audience +=
audience[i]['name'];
- html_audience += "</label>";
- html_audience += "</li>";
- }
- $("#audience").html( html_audience );
+ var audience = data.audience;
+ var checked = '';
+ for ( var i = 0; i < audience.length; ++i )
+ {
+ checked = '';
+ if (initialAudience) {
+ for ( var j = 0; j < initialAudience.length; ++j )
+ {
+ if(audience[i]['id'] == initialAudience[j])
+ {
+ checked = " checked='checked'";
+ }
+ }
+ }
+ html_audience += "<li>";
+ html_audience += "<label>";
+ html_audience += "<input type=\"radio\"
name=\"audience[]\" value='" +audience[i]['id'] + "'" + checked+ "></input>";
+ html_audience += audience[i]['name'];
+ html_audience += "</label>";
+ html_audience += "</li>";
+ }
+ $("#audience").html( html_audience );
+ }
+ }
+ });
+ });
- }
- }
- });
- });
-
});
$(window).load(function(){
@@ -90,27 +91,75 @@
populateTableChkRegulations(building_id_selection, selection,
resources);
});
- $('#application_form').submit(function(e){
- if(!validate_documents()){
- e.preventDefault();
- alert(lang['You must accept to follow all terms and conditions of
lease first.']);
- }
- });
+// $('#application_form').submit(function(e){
+// if(!validate_documents()){
+// e.preventDefault();
+// alert(lang['You must accept to follow all terms and conditions
of lease first.']);
+// }
+// });
});
-function validate_documents() {
- var n = 0;
- $('#regulation_documents
input[name="accepted_documents[]"]').each(function(){
- if(!$(this).is(':checked')) {
- n++;
- }
- });
- var v = (n == 0) ? true : false;
- return v;
-}
+//function validate_documents() {
+// var n = 0;
+// $('#regulation_documents
input[name="accepted_documents[]"]').each(function(){
+// if(!$(this).is(':checked')) {
+// n++;
+// }
+// });
+// var v = (n == 0) ? true : false;
+// return v;
+//}
+$.formUtils.addValidator({
+ name: 'regulations_documents',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var n = 0;
+ $('#regulation_documents
input[name="accepted_documents[]"]').each(function(){
+ if(!$(this).is(':checked')) {
+ n++;
+ }
+ });
+ var v = (n == 0) ? true : false;
+ return v;
+ },
+ errorMessage: 'You must accept to follow all terms and conditions of lease
first.',
+ errorMessageKey: ''
+})
+$.formUtils.addValidator({
+ name: 'target_audience',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var n = 0;
+ $('#audience input[name="audience[]"]').each(function(){
+ if ($(this).is(':checked')) {
+ n++;
+ }
+ });
+ var v = (n > 0) ? true : false;
+ return v;
+ },
+ errorMessage: 'Please choose at least 1 target audience',
+ errorMessageKey: ''
+})
+
+$.formUtils.addValidator({
+ name: 'number_participants',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var n = 0;
+ $('#agegroup_tbody input').each(function() {
+ if ($(this).val() != "" && $(this).val() > 0) {
+ n++;
+ }
+ });
+ var v = (n > 0) ? true : false;
+ return v;
+ },
+ errorMessage: 'Number of participants is required',
+ errorMessageKey: ''
+});
+
+
function populateTableChkResources (building_id, selection) {
var url =
'index.php?menuaction=bookingfrontend.uiresource.index_json&sort=name&filter_building_id='
+ building_id + '&phpgw_return_as=json&';
var container = 'resources_container';
Modified: branches/dev-syncromind/booking/js/booking/booking.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/booking.js 2015-10-22
16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/js/booking/booking.js 2015-10-22
22:38:13 UTC (rev 14232)
@@ -6,6 +6,62 @@
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.uiorganization.index&phpgw_return_as=json&',
'field_org_name', 'field_org_id',
'org_container');
+
+ $("#field_activity").change(function(){
+ var oArgs =
{menuaction:'bookingfrontend.uiapplication.get_activity_data',
activity_id:$(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data) {
+ var html_agegroups = '';
+ var html_audience = '';
+
+ if( data != null)
+ {
+ var agegroups = data.agegroups;
+ for ( var i = 0; i < agegroups.length; ++i )
+ {
+ html_agegroups += "<tr>";
+ html_agegroups += "<th>" + agegroups[i]['name'] +
"</th>";
+ html_agegroups += "<td>";
+ html_agegroups += "<input class=\"input50\"
type=\"text\" name='male[" +agegroups[i]['id'] + "]' value='0'></input>";
+ html_agegroups += "</td>";
+ html_agegroups += "<td>";
+ html_agegroups += "<input class=\"input50\"
type=\"text\" name='female[" +agegroups[i]['id'] + "]' value='0'></input>";
+ html_agegroups += "</td>";
+ html_agegroups += "</tr>";
+ }
+ $("#agegroup_tbody").html( html_agegroups );
+
+ var audience = data.audience;
+ var checked = '';
+ for ( var i = 0; i < audience.length; ++i )
+ {
+ checked = '';
+ if (initialAudience) {
+ for ( var j = 0; j < initialAudience.length; ++j )
+ {
+ if(audience[i]['id'] == initialAudience[j])
+ {
+ checked = " checked='checked'";
+ }
+ }
+ }
+ html_audience += "<li>";
+ html_audience += "<label>";
+ html_audience += "<input type=\"radio\"
name=\"audience[]\" value='" +audience[i]['id'] + "'" + checked+ "></input>";
+ html_audience += audience[i]['name'];
+ html_audience += "</label>";
+ html_audience += "</li>";
+ }
+ $("#audience").html( html_audience );
+ }
+ }
+ });
+ });
});
@@ -40,6 +96,38 @@
});
});
+$.formUtils.addValidator({
+ name: 'target_audience',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var n = 0;
+ $('#audience input[name="audience[]"]').each(function(){
+ if ($(this).is(':checked')) {
+ n++;
+ }
+ });
+ var v = (n > 0) ? true : false;
+ return v;
+ },
+ errorMessage: 'Please choose at least 1 target audience',
+ errorMessageKey: ''
+})
+
+$.formUtils.addValidator({
+ name: 'number_participants',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var n = 0;
+ $('#agegroup_tbody input').each(function() {
+ if ($(this).val() != "" && $(this).val() > 0) {
+ n++;
+ }
+ });
+ var v = (n > 0) ? true : false;
+ return v;
+ },
+ errorMessage: 'Number of participants is required',
+ errorMessageKey: ''
+});
+
function populateSelectSeason (building_id, selection) {
var url =
'index.php?menuaction=booking.uiseason.index&sort=name&filter_building_id=' +
building_id + '&phpgw_return_as=json&';
var container = $('#season_container');
Modified: branches/dev-syncromind/booking/js/booking/event.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/event.js 2015-10-22 16:43:19 UTC
(rev 14231)
+++ branches/dev-syncromind/booking/js/booking/event.js 2015-10-22 22:38:13 UTC
(rev 14232)
@@ -5,10 +5,53 @@
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.uiorganization.index&phpgw_return_as=json&',
'field_org_name', 'field_org_id',
'org_container');
+
+ $("#field_activity").change(function(){
+ var oArgs =
{menuaction:'bookingfrontend.uiapplication.get_activity_data',
activity_id:$(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data) {
+ var html_agegroups = '';
+ var html_audience = '';
+
+ if( data != null)
+ {
+ var agegroups = data.agegroups;
+ for ( var i = 0; i < agegroups.length; ++i )
+ {
+ html_agegroups += "<tr>";
+ html_agegroups += "<th>" + agegroups[i]['name'] +
"</th>";
+ html_agegroups += "<td>";
+ html_agegroups += "<input class=\"input50\"
type=\"text\" name='male[" +agegroups[i]['id'] + "]' value='0'></input>";
+ html_agegroups += "</td>";
+ html_agegroups += "<td>";
+ html_agegroups += "<input class=\"input50\"
type=\"text\" name='female[" +agegroups[i]['id'] + "]' value='0'></input>";
+ html_agegroups += "</td>";
+ html_agegroups += "</tr>";
+ }
+ $("#agegroup_tbody").html( html_agegroups );
+
+ var audience = data.audience;
+ for ( var i = 0; i < audience.length; ++i )
+ {
+ html_audience += "<li>";
+ html_audience += "<label>";
+ html_audience += "<input type=\"radio\"
name=\"audience[]\" value='" +audience[i]['id'] + "'></input>";
+ html_audience += audience[i]['name'];
+ html_audience += "</label>";
+ html_audience += "</li>";
+ }
+ $("#audience").html( html_audience );
+ }
+ }
+ });
+ });
+});
-
-});
-
$(window).load(function() {
var building_id = $('#field_building_id').val();
if(building_id) {
@@ -24,10 +67,42 @@
});
});
+$.formUtils.addValidator({
+ name: 'target_audience',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var n = 0;
+ $('#audience input[name="audience[]"]').each(function(){
+ if ($(this).is(':checked')) {
+ n++;
+ }
+ });
+ var v = (n > 0) ? true : false;
+ return v;
+ },
+ errorMessage: 'Please choose at least 1 target audience',
+ errorMessageKey: ''
+})
+
+$.formUtils.addValidator({
+ name: 'number_participants',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var n = 0;
+ $('#agegroup_tbody input').each(function() {
+ if ($(this).val() != "" && $(this).val() > 0) {
+ n++;
+ }
+ });
+ var v = (n > 0) ? true : false;
+ return v;
+ },
+ errorMessage: 'Number of participants is required',
+ errorMessageKey: ''
+});
+
function populateTableChkResources (building_id, selection) {
var url =
'index.php?menuaction=booking.uiresource.index&sort=name&filter_building_id=' +
building_id + '&phpgw_return_as=json&';
var container = 'resources_container';
- var colDefsResources = [{label: '', object: [{type: 'input', attrs:
[{name: 'type', value: 'checkbox'},{name: 'name', value: 'resources[]'}]}],
value: 'id', checked: selection},{key: 'name', label: lang['Name']}, {key:
'type', label: lang['Resource Type']}];
+ var colDefsResources = [{label: '', object: [{type: 'input', attrs:
[{name: 'type', value: 'checkbox'},{name: 'name', value: 'resources[]'},{name:
'data-validation', value: 'checkbox_group'},{name: 'data-validation-qty',
value: 'min1'},{name: 'data-validation-error-msg', value: 'Please choose at
least 1 resource'}]}], value: 'id', checked: selection},{key: 'name', label:
lang['Name']}, {key: 'type', label: lang['Resource Type']}];
populateTableChk(url, container, colDefsResources);
}
Modified: branches/dev-syncromind/booking/templates/base/allocation_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/allocation_edit.xsl
2015-10-22 16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/templates/base/allocation_edit.xsl
2015-10-22 22:38:13 UTC (rev 14232)
@@ -57,7 +57,7 @@
<xsl:attribute name="value"><xsl:value-of
select="allocation/organization_id"/></xsl:attribute>
</input>
<input id="field_org_name" name="organization_name"
type="text">
- <xsl:attribute name="data-validate">
+ <xsl:attribute name="data-validation">
<xsl:text>required</xsl:text>
</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="allocation/organization_name"/></xsl:attribute>
@@ -79,9 +79,9 @@
<div class="pure-control-group">
<label for="field_cost"><xsl:value-of
select="php:function('lang', 'Cost')" /></label>
<input id="field_cost" name="cost" type="text">
- <xsl:attributes name="data-validation">
+ <xsl:attribute name="data-validation">
<xsl:text>required</xsl:text>
- </xsl:attributes>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="allocation/cost"/></xsl:attribute>
</input>
</div>
Modified: branches/dev-syncromind/booking/templates/base/allocation_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/allocation_new.xsl
2015-10-22 16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/templates/base/allocation_new.xsl
2015-10-22 22:38:13 UTC (rev 14232)
@@ -138,9 +138,9 @@
<div class="pure-control-group">
<label for="field_cost"><xsl:value-of
select="php:function('lang', 'Cost')" /></label>
<input id="field_cost" name="cost" type="text">
- <xsl:attributes name="data-validation">
+ <xsl:attribute name="data-validation">
<xsl:text>required</xsl:text>
- </xsl:attributes>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="allocation/cost"/></xsl:attribute>
</input>
</div>
Modified: branches/dev-syncromind/booking/templates/base/application_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/application_edit.xsl
2015-10-22 16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/templates/base/application_edit.xsl
2015-10-22 22:38:13 UTC (rev 14232)
@@ -153,11 +153,12 @@
<div class="pure-g">
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<label for="field_from"><xsl:value-of
select="php:function('lang', 'Target audience')" /></label>
- <ul
style="list-style:none;padding-left:10px;">
+ <input type="hidden"
data-validation="target_audience"></input>
+ <ul id="audience"
style="list-style:none;padding-left:10px;">
<xsl:for-each select="audience">
<li>
<label>
- <input type="checkbox"
name="audience[]">
+ <input type="radio"
name="audience[]">
<xsl:attribute
name="value"><xsl:value-of select="id"/></xsl:attribute>
<xsl:if
test="../application/audience=id">
<xsl:attribute
name="checked">checked</xsl:attribute>
@@ -169,8 +170,9 @@
</xsl:for-each>
</ul>
</div>
- <div class="pure-control pure-u-1
pure-u-md-1-2 pure-u-lg-1">
+ <div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<label for="field_from"><xsl:value-of
select="php:function('lang', 'Number of participants')" /></label>
+ <input type="hidden"
data-validation="number_participants"></input>
<table id="agegroup" class="pure-table
pure-table-bordered">
<thead>
<tr>
@@ -179,7 +181,7 @@
<th><xsl:value-of
select="php:function('lang', 'Female')" /></th>
</tr>
</thead>
- <tbody>
+ <tbody id="agegroup_tbody">
<xsl:for-each select="agegroups">
<xsl:variable
name="id"><xsl:value-of select="id"/></xsl:variable>
<tr>
@@ -248,6 +250,7 @@
<div class="heading">
<legend><h3><xsl:value-of
select="php:function('lang', 'Terms and conditions')" /></h3></legend>
</div>
+ <input type="hidden"
data-validation="regulations_documents"></input>
<div id='regulation_documents'></div>
</div>
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1"></div>
@@ -273,5 +276,6 @@
var initialDocumentSelection = <xsl:value-of
select="application/accepted_documents_json"/>;
var initialAcceptAllTerms = true;
var initialSelection = <xsl:value-of
select="application/resources_json"/>;
+ var initialAudience = <xsl:value-of
select="application/audience_json"/>;
</script>
</xsl:template>
Modified: branches/dev-syncromind/booking/templates/base/application_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/application_new.xsl
2015-10-22 16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/templates/base/application_new.xsl
2015-10-22 22:38:13 UTC (rev 14232)
@@ -24,9 +24,9 @@
<p><xsl:value-of
select="config/application_activities"/></p>
</xsl:if>
<select name="activity_id" id="field_activity"
class="pure-input-1">
- <xsl:attributes name="date-validtion">
+ <xsl:attribute name="data-validation">
<xsl:text>required</xsl:text>
- </xsl:attributes>
+ </xsl:attribute>
<option value=""><xsl:value-of
select="php:function('lang', '-- select an activity --')" /></option>
<xsl:for-each select="activities">
<option>
@@ -60,6 +60,7 @@
<p><xsl:value-of
select="config/application_howmany"/></p>
</xsl:if>
<label><xsl:value-of select="php:function('lang',
'Estimated number of participants')" /></label>
+ <input type="hidden"
data-validation="number_participants"></input>
<table id="agegroup" class="pure-table
pure-table-bordered">
<thead>
<tr>
@@ -206,6 +207,7 @@
<p><xsl:value-of
select="config/application_who"/></p>
</xsl:if>
<label><xsl:value-of select="php:function('lang',
'Target audience')" /></label>
+ <input type="hidden"
data-validation="target_audience"></input>
<ul id= "audience"
style="list-style:none;padding-left:10px;">
<xsl:for-each select="audience">
<li>
@@ -218,7 +220,7 @@
</input>
<xsl:value-of select="name"/>
</label>
- </li>
+ </li>
</xsl:for-each>
</ul>
</fieldset>
@@ -252,6 +254,15 @@
<div class="pure-control-group">
<label
for="field_contact_email2"><xsl:value-of select="php:function('lang', 'Confirm
e-mail address')" /></label>
<input id="field_contact_email2"
class="pure-input-1" name="contact_email2" type="text">
+ <xsl:attribute name="data-validation">
+ <xsl:text>confirmation</xsl:text>
+ </xsl:attribute>
+ <xsl:atrribute
name="data-validation-confirm">
+ <xsl:text>contact_email</xsl:text>
+ </xsl:atrribute>
+ <xsl:attribute
name="data-validation-error-msg">
+ <xsl:text>the e-mail addresses you
entered do not match</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="application/contact_email2"/></xsl:attribute>
</input>
</div>
@@ -286,6 +297,7 @@
<div class="heading"><legend><h3>8. <xsl:value-of
select="php:function('lang', 'Terms and conditions')" /></h3></legend></div>
<p>Alle som leier lokaler hos Bergen kommune må
bekrefte at de har lest betingelsene, dette gjelder som regel brannforskrifter
og husreglement.</p>
<div class="pure-control-group">
+ <input type="hidden"
data-validation="regulations_documents"></input>
<xsl:if test="config/application_terms">
<p><xsl:value-of
select="config/application_terms"/></p>
</xsl:if>
Modified: branches/dev-syncromind/booking/templates/base/booking_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/booking_edit.xsl
2015-10-22 16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/templates/base/booking_edit.xsl
2015-10-22 22:38:13 UTC (rev 14232)
@@ -39,6 +39,9 @@
<div class="pure-control-group">
<label for="field_activity"><xsl:value-of
select="php:function('lang', 'Activity')" /></label>
<select name="activity_id" id="field_activity">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<option value=""><xsl:value-of
select="php:function('lang', '-- select an activity --')" /></option>
<xsl:for-each select="activities">
<option>
@@ -61,7 +64,11 @@
<div class="pure-control-group">
<label for="field_building_name"><xsl:value-of
select="php:function('lang', 'Building')"/></label>
<input id="field_building_id"
name="building_id" type="hidden" value="{booking/building_id}"/>
- <input id="field_building_name"
name="building_name" type="text" value="{booking/building_name}"/>
+ <input id="field_building_name"
name="building_name" type="text" value="{booking/building_name}">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
+ </input>
<div id="building_container"></div>
</div>
<div class="pure-control-group">
@@ -94,18 +101,28 @@
<div class="pure-control-group">
<label for="field_from"><xsl:value-of
select="php:function('lang', 'From')"/></label>
<input class="datetime" id="field_from"
name="from_" type="text" style="display:inline-block;">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="booking/from_"/></xsl:attribute>
</input>
</div>
<div class="pure-control-group">
<label for="field_to"><xsl:value-of
select="php:function('lang', 'To')"/></label>
<input class="datetime" id="field_to"
name="to_" type="text" style="display:inline-block;">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="booking/to_"/></xsl:attribute>
</input>
</div>
<div class="pure-control-group">
<label for="field_cost"><xsl:value-of
select="php:function('lang', 'Cost')" /></label>
- <input id="field_cost" name="cost" type="text"
value="{booking/cost}"/>
+ <input id="field_cost" name="cost" type="text"
value="{booking/cost}">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
+ </input>
</div>
</div>
<div class="pure-u-1 pure-u-md-1 pure-u-lg-1-3">
@@ -115,11 +132,12 @@
<div class="pure-g">
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<label for="field_from"><xsl:value-of
select="php:function('lang', 'Target audience')" /></label>
- <ul
style="list-style:none;padding-left:10px;">
+ <input type="hidden"
data-validation="target_audience"></input>
+ <ul
style="list-style:none;padding-left:10px;" id="audience">
<xsl:for-each select="audience">
<li>
<label>
- <input type="checkbox"
name="audience[]">
+ <input type="radio"
name="audience[]">
<xsl:attribute
name="value"><xsl:value-of select="id"/></xsl:attribute>
<xsl:if
test="../booking/audience=id">
<xsl:attribute
name="checked">checked</xsl:attribute>
@@ -134,6 +152,7 @@
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<div class="pure-control-group">
<label for="field_from"><xsl:value-of
select="php:function('lang', 'Number of participants')" /></label>
+ <input type="hidden"
data-validation="number_participants"></input>
<table id="agegroup" class="pure-table
pure-table-bordered">
<thead>
<tr>
@@ -142,7 +161,7 @@
<th><xsl:value-of
select="php:function('lang', 'Female')" /></th>
</tr>
</thead>
- <tbody>
+ <tbody id="agegroup_tbody">
<xsl:for-each
select="agegroups">
<xsl:variable
name="id"><xsl:value-of select="id"/></xsl:variable>
<tr>
@@ -236,6 +255,7 @@
var season_id = '<xsl:value-of select="booking/season_id"/>';
var group_id = '<xsl:value-of select="booking/group_id"/>';
var initialSelection = <xsl:value-of select="booking/resources_json"/>;
+ var initialAudience = <xsl:value-of select="booking/audience_json"/>;
var lang = <xsl:value-of select="php:function('js_lang','Name',
'Resource Type')"/>;
</script>
</xsl:template>
Modified: branches/dev-syncromind/booking/templates/base/booking_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/booking_new.xsl
2015-10-22 16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/templates/base/booking_new.xsl
2015-10-22 22:38:13 UTC (rev 14232)
@@ -62,9 +62,15 @@
<div class="pure-control-group">
<label for="field_org_name"><xsl:value-of
select="php:function('lang', 'Organization')"/></label>
<input id="field_org_id"
name="organization_id" type="hidden">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="booking/organization_id"/></xsl:attribute>
</input>
<input id="field_org_name"
name="organization_name" type="text" class="pure-u-1 pure-u-sm-1-2 pure-u-md-1">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="booking/organization_name"/></xsl:attribute>
</input>
<div id="org_container"></div>
@@ -76,7 +82,7 @@
<div class="pure-control-group">
<label><xsl:value-of
select="php:function('lang', 'From')"/></label>
<input class="datetime pure-input-2-3"
id="start_date" name="from_" type="text" style="display:inline-block;">
- <xsl:attribute name="data-validate">
+ <xsl:attribute name="data-validation">
<xsl:text>required</xsl:text>
</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="booking/from_"/></xsl:attribute>
@@ -85,7 +91,7 @@
<div class="pure-control-group">
<label><xsl:value-of
select="php:function('lang', 'To')"/></label>
<input class="datetime pure-input-2-3"
id="end_date" name="to_" type="text" style="display:inline-block;">
- <xsl:attribute name="data-validate">
+ <xsl:attribute name="data-validation">
<xsl:text>required</xsl:text>
</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="booking/to_"/></xsl:attribute>
@@ -93,7 +99,11 @@
</div>
<div class="pure-control-group">
<label><xsl:value-of
select="php:function('lang', 'Cost')" /></label>
- <input id="field_cost" name="cost" type="text"
value="{booking/cost}"/>
+ <input id="field_cost" name="cost" type="text"
value="{booking/cost}">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
+ </input>
</div>
<div class="pure-control-group">
<label for="field_repeat_until"><xsl:value-of
select="php:function('lang', 'Recurring booking')" /></label>
@@ -122,11 +132,7 @@
<!--input id="field_repeat_until"
name="repeat_until" type="text">
<xsl:attribute name="value"><xsl:value-of
select="repeat_until"/></xsl:attribute>
</input-->
- <input class="datetime pure-input-2-3"
id="field_repeat_until" name="repeat_until" type="text"
style="display:inline-block;">
- <xsl:attribute name="data-validation">
- <xsl:text>required</xsl:text>
- </xsl:attribute>
- </input>
+ <input class="datetime pure-input-2-3"
id="field_repeat_until" name="repeat_until" type="text"
style="display:inline-block;" />
</div>
<div class="pure-control-group">
<label><xsl:value-of
select="php:function('lang', 'Interval')" /></label>
@@ -164,11 +170,12 @@
<div class="pure-g">
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<label><xsl:value-of
select="php:function('lang', 'Target audience')" /></label>
- <ul
style="list-style:none;padding-left:10px;">
+ <input type="hidden"
data-validation="target_audience"></input>
+ <ul
style="list-style:none;padding-left:10px;" id="audience">
<xsl:for-each select="audience">
<li>
<label>
- <input type="checkbox"
name="audience[]">
+ <input type="radio"
name="audience[]">
<xsl:attribute
name="value"><xsl:value-of select="id"/></xsl:attribute>
<xsl:if
test="../booking/audience=id">
<xsl:attribute
name="checked">checked</xsl:attribute>
@@ -182,6 +189,7 @@
</div>
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<label><xsl:value-of
select="php:function('lang', 'Number of participants')" /></label>
+ <input type="hidden"
data-validation="number_participants"></input>
<table id="agegroup" class="pure-table
pure-table-bordered">
<thead>
<tr>
@@ -189,7 +197,7 @@
<th><xsl:value-of
select="php:function('lang', 'Male')" /></th>
<th><xsl:value-of
select="php:function('lang', 'Female')" /></th></tr>
</thead>
- <tbody>
+ <tbody id="agegroup_tbody">
<xsl:for-each select="agegroups">
<xsl:variable
name="id"><xsl:value-of select="id"/></xsl:variable>
<tr>
@@ -244,6 +252,7 @@
season_id = '<xsl:value-of select="booking/season_id"/>';
group_id = '<xsl:value-of select="booking/group_id"/>';
initialSelection = <xsl:value-of select="booking/resources_json"/>;
+ var initialAudience = <xsl:value-of select="booking/audience_json"/>;
var lang = <xsl:value-of select="php:function('js_lang', 'Name',
'Resource Type')"/>;
</script>
</xsl:template>
Modified: branches/dev-syncromind/booking/templates/base/event_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/event_edit.xsl
2015-10-22 16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/templates/base/event_edit.xsl
2015-10-22 22:38:13 UTC (rev 14232)
@@ -60,6 +60,9 @@
<div class="pure-control-group">
<label for="field_activity"><xsl:value-of
select="php:function('lang', 'Activity')" /></label>
<select name="activity_id" id="field_activity"
class="pure-u-1 pure-u-sm-1-2 pure-u-lg-1-3">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<option value=""><xsl:value-of
select="php:function('lang', '-- select an activity --')" /></option>
<xsl:for-each select="activities">
<option>
@@ -74,7 +77,12 @@
</div>
<div class="pure-control-group">
<label for="field_description"><xsl:value-of
select="php:function('lang', 'Description')" /></label>
- <textarea id="field_description"
class="full-width pure-u-1 pure-u-sm-1-2 pure-u-lg-1-3"
name="description"><xsl:value-of select="event/description"/></textarea>
+ <textarea id="field_description"
class="full-width pure-u-1 pure-u-sm-1-2 pure-u-lg-1-3" name="description">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="event/description"/>
+ </textarea>
</div>
<div class="pure-control-group">
<label for="field_public"><xsl:value-of
select="php:function('lang', 'Event type')"/></label>
@@ -103,9 +111,15 @@
<div class="pure-control-group">
<label for="field_building_name"><xsl:value-of
select="php:function('lang', 'Building')" /></label>
<input id="field_building_id"
name="building_id" type="hidden">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="event/building_id"/></xsl:attribute>
</input>
<input id="field_building_name"
name="building_name" type="text" class="pure-u-1 pure-u-sm-1-2 pure-u-md-1">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="event/building_name"/></xsl:attribute>
</input>
</div>
@@ -152,11 +166,12 @@
<div class="pure-g">
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<label><xsl:value-of
select="php:function('lang', 'Target audience')" /></label>
- <ul style="list-style:none;padding: 0 0 0
10px;">
+ <input type="hidden"
data-validation="target_audience"></input>
+ <ul id="audience"
style="list-style:none;padding: 0 0 0 10px;">
<xsl:for-each select="audience">
<li>
<label
style="display:inline-block">
- <input type="checkbox"
name="audience[]">
+ <input type="radio"
name="audience[]">
<xsl:attribute
name="value"><xsl:value-of select="id"/></xsl:attribute>
<xsl:if
test="../event/audience=id">
<xsl:attribute
name="checked">checked</xsl:attribute>
@@ -170,6 +185,7 @@
</div>
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<label for="field_from"><xsl:value-of
select="php:function('lang', 'Number of participants')" /></label>
+ <input type="hidden"
data-validation="number_participants"></input>
<table id="agegroup" class="pure-table
pure-table-bordered">
<thead>
<tr>
@@ -178,7 +194,7 @@
<th><xsl:value-of
select="php:function('lang', 'Female')" /></th>
</tr>
</thead>
- <tbody>
+ <tbody id="agegroup_tbody">
<xsl:for-each select="agegroups">
<xsl:variable
name="id"><xsl:value-of select="id"/></xsl:variable>
<tr>
@@ -215,6 +231,9 @@
<div class="pure-control-group">
<label for="field_contact_name"><xsl:value-of
select="php:function('lang', 'Name')" /></label>
<input id="field_contact_name"
name="contact_name" type="text" class="pure-u-1 pure-u-sm-1-2 pure-u-md-1">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="event/contact_name"/></xsl:attribute>
</input>
</div>
@@ -233,6 +252,9 @@
<div class="pure-control-group">
<label for="field_cost"><xsl:value-of
select="php:function('lang', 'Cost')" /></label>
<input id="field_cost" name="cost" type="text"
class="pure-u-1 pure-u-sm-1-2 pure-u-md-1">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="event/cost"/></xsl:attribute>
</input>
</div>
@@ -339,6 +361,7 @@
<script type="text/javascript">
$('#field_customer_identifier_type,#field_customer_ssn,#field_customer_organization_number').removeClass('pure-input-1').addClass('pure-u-1
pure-u-sm-1-2 pure-u-md-1');
var initialSelection = <xsl:value-of select="event/resources_json"/>;
+ var initialAudience = <xsl:value-of select="event/audience_json"/>;
var lang = <xsl:value-of select="php:function('js_lang', 'Name',
'Resource Type')"/>;
</script>
</xsl:template>
Modified: branches/dev-syncromind/booking/templates/base/event_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/event_new.xsl
2015-10-22 16:43:19 UTC (rev 14231)
+++ branches/dev-syncromind/booking/templates/base/event_new.xsl
2015-10-22 22:38:13 UTC (rev 14232)
@@ -21,6 +21,9 @@
<option value=""><xsl:value-of
select="php:function('lang', '-- select an activity --')" /></option>
<xsl:for-each select="activities">
<option>
+ <xsl:attribute
name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:if test="../event/activity_id
= id">
<xsl:attribute
name="selected">selected</xsl:attribute>
</xsl:if>
@@ -32,7 +35,12 @@
</div>
<div class="pure-control-group">
<label for="field_description"><xsl:value-of
select="php:function('lang', 'Description')" /></label>
- <textarea id="field_description"
class="full-width pure-u-1 pure-u-sm-1-2 pure-u-lg-1-3"
name="description"><xsl:value-of select="event/description"/></textarea>
+ <textarea id="field_description"
class="full-width pure-u-1 pure-u-sm-1-2 pure-u-lg-1-3" name="description">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="event/description"/>
+ </textarea>
</div>
<div class="pure-control-group">
<label for="field_public"><xsl:value-of
select="php:function('lang', 'Event type')"/></label>
@@ -61,9 +69,15 @@
<div class="pure-control-group">
<label><xsl:value-of
select="php:function('lang', 'Building')" /></label>
<input id="field_building_id"
name="building_id" type="hidden">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="event/building_id"/></xsl:attribute>
</input>
<input id="field_building_name"
name="building_name" type="text" class="pure-u-1 pure-u-sm-1-2 pure-u-md-1">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="event/building_name"/></xsl:attribute>
</input>
</div>
@@ -138,11 +152,12 @@
<div class="pure-g">
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<label><xsl:value-of
select="php:function('lang', 'Target audience')" /></label>
- <ul style="list-style:none;">
+ <input type="hidden"
data-validation="target_audience"></input>
+ <ul id="audience" style="list-style:none;">
<xsl:for-each select="audience">
<li>
<label
style="display:inline-block;">
- <input type="checkbox"
name="audience[]">
+ <input type="radio"
name="audience[]">
<xsl:attribute
name="value"><xsl:value-of select="id"/></xsl:attribute>
<xsl:if
test="../event/audience=id">
<xsl:attribute
name="checked">checked</xsl:attribute>
@@ -156,6 +171,7 @@
</div>
<div class="pure-control-group pure-u-1
pure-u-md-1-2 pure-u-lg-1">
<label><xsl:value-of
select="php:function('lang', 'Number of participants')" /></label>
+ <input type="hidden"
data-validation="number_participants"></input>
<table id="agegroup" class="pure-table
pure-table-bordered">
<thead>
<tr>
@@ -164,7 +180,7 @@
<th><xsl:value-of
select="php:function('lang', 'Female')" /></th>
</tr>
</thead>
- <tbody>
+ <tbody id="agegroup_tbody">
<xsl:for-each select="agegroups">
<xsl:variable
name="id"><xsl:value-of select="id"/></xsl:variable>
<tr>
@@ -197,6 +213,9 @@
<div class="pure-control-group">
<label style="margin-top:10px;"> </label>
<input id="field_cost" name="cost" type="text">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="event/cost"/></xsl:attribute>
</input>
</div>
@@ -252,6 +271,9 @@
<div class="pure-control-group">
<label for="field_contact_name"><xsl:value-of
select="php:function('lang', 'Name')" /></label>
<input id="field_contact_name"
name="contact_name" type="text" class="pure-u-1 pure-u-sm-1-2 pure-u-md-1">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="event/contact_name"/></xsl:attribute>
</input>
</div>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14232] validations,
Saul <=