[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14233] validations
From: |
Saul |
Subject: |
[Fmsystem-commits] [14233] validations |
Date: |
Fri, 23 Oct 2015 20:59:18 +0000 |
Revision: 14233
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14233
Author: psaul
Date: 2015-10-23 20:59:17 +0000 (Fri, 23 Oct 2015)
Log Message:
-----------
validations
Modified Paths:
--------------
branches/dev-syncromind/booking/inc/class.uiresource.inc.php
branches/dev-syncromind/booking/js/booking/application.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/building_schedule.xsl
branches/dev-syncromind/booking/templates/base/event_edit.xsl
branches/dev-syncromind/booking/templates/base/event_new.xsl
branches/dev-syncromind/booking/templates/base/resource_schedule.xsl
Modified: branches/dev-syncromind/booking/inc/class.uiresource.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiresource.inc.php
2015-10-22 22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/inc/class.uiresource.inc.php
2015-10-23 20:59:17 UTC (rev 14233)
@@ -255,6 +255,13 @@
public function schedule()
{
$resource =
$this->bo->get_schedule(phpgw::get_var('id', 'GET'), 'booking.uibuilding',
'booking.uiresource');
+ $resource['application_link'] = self::link(array(
+ 'menuaction' => 'booking.uiapplication.add',
+ 'building_id' => $resource['building_id'],
+ 'building_name' => $resource['building_name'],
+ 'activity_id' => $resource['activity_id'],
+ 'resource' => $resource['id']
+ ));
$resource['datasource_url'] = self::link(array(
'menuaction' =>
'booking.uibooking.resource_schedule',
'resource_id' => $resource['id'],
Modified: branches/dev-syncromind/booking/js/booking/application.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/application.js 2015-10-22
22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/js/booking/application.js 2015-10-23
20:59:17 UTC (rev 14233)
@@ -159,7 +159,51 @@
errorMessageKey: ''
});
+$.formUtils.addValidator({
+ name: 'customer_identifier',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var v = false;
+ var customer_ssn = $('#field_customer_ssn').val();
+ var customer_organization_number =
$('#field_customer_organization_number').val();
+ if (customer_ssn != "" || customer_organization_number != "") {
+ v = true;
+ }
+ return v;
+ },
+ errorMessage: 'Customer identifier type is required',
+ errorMessageKey: ''
+});
+$.formUtils.addValidator({
+ name: 'application_dates',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var n = 0;
+ if ($('input[name="from_[]"]').length == 0 ||
$('input[name="from_[]"]').length == 0) {
+ return false;
+ }
+ $('input[name="from_[]"]').each(function(){
+ if ($(this).val() == "") {
+ $($(this).addClass("error").css("border-color","red"));
+ n++;
+ } else {
+ $($(this).removeClass("error").css("border-color",""));
+ }
+ });
+ $('input[name="to_[]"]').each(function(){
+ if ($(this).val() == "") {
+ $($(this).addClass("error").css("border-color","red"));
+ n++;
+ } else {
+ $($(this).removeClass("error").css("border-color",""));
+ }
+ });
+ var v = (n == 0) ? true : false;
+ return v;
+ },
+ errorMessage: 'Invalida date',
+ 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/event.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/event.js 2015-10-22 22:38:13 UTC
(rev 14232)
+++ branches/dev-syncromind/booking/js/booking/event.js 2015-10-23 20:59:17 UTC
(rev 14233)
@@ -65,6 +65,13 @@
building_id_selection = building_id;
}
});
+
+// $('#form').submit(function(e){
+// if(!validate_documents()){
+// e.preventDefault();
+// alert(lang['You must accept to follow all terms and conditions
of lease first.']);
+// }
+// });
});
$.formUtils.addValidator({
@@ -99,6 +106,52 @@
errorMessageKey: ''
});
+$.formUtils.addValidator({
+ name: 'customer_identifier',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var v = true;
+ var customer_ssn = $('#field_customer_ssn').val();
+ var customer_organization_number =
$('#field_customer_organization_number').val();
+ var cost = $('#field_cost').val();
+ if ( (customer_ssn == "" && customer_organization_number == "") &&
(cost > 0) ) {
+ v = false;
+ }
+ return v;
+ },
+ errorMessage: 'There is set a cost, but no invoice data is filled inn',
+ errorMessageKey: ''
+});
+
+$.formUtils.addValidator({
+ name: 'application_dates',
+ validatorFunction: function(value, $el, config, languaje, $form) {
+ var n = 0;
+ if ($('input[name="from_[]"]').length == 0 ||
$('input[name="from_[]"]').length == 0) {
+ return false;
+ }
+ $('input[name="from_[]"]').each(function(){
+ if ($(this).val() == "") {
+ $($(this).addClass("error").css("border-color","red"));
+ n++;
+ } else {
+ $($(this).removeClass("error").css("border-color",""));
+ }
+ });
+ $('input[name="to_[]"]').each(function(){
+ if ($(this).val() == "") {
+ $($(this).addClass("error").css("border-color","red"));
+ n++;
+ } else {
+ $($(this).removeClass("error").css("border-color",""));
+ }
+ });
+ var v = (n == 0) ? true : false;
+ return v;
+ },
+ errorMessage: 'Invalida date',
+ 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';
Modified: branches/dev-syncromind/booking/templates/base/allocation_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/allocation_edit.xsl
2015-10-22 22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/templates/base/allocation_edit.xsl
2015-10-23 20:59:17 UTC (rev 14233)
@@ -67,12 +67,18 @@
<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">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="allocation/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">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="allocation/to_"/></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 22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/templates/base/allocation_new.xsl
2015-10-23 20:59:17 UTC (rev 14233)
@@ -83,12 +83,18 @@
<div class="pure-control-group">
<label for="field_from"><xsl:value-of
select="php:function('lang', 'From')" /></label>
<input id="field_from" name="from_" type="text">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="allocation/from_"/></xsl:attribute>
</input>
</div>
<div class="pure-control-group">
<label for="field_to"><xsl:value-of
select="php:function('lang', 'To')" /></label>
<input id="field_to" name="to_" type="text">
+ <xsl:attribute name="data-validation">
+ <xsl:text>required</xsl:text>
+ </xsl:attribute>
<xsl:attribute name="value"><xsl:value-of
select="allocation/to_"/></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 22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/templates/base/application_edit.xsl
2015-10-23 20:59:17 UTC (rev 14233)
@@ -98,6 +98,7 @@
<legend><h3>3. <xsl:value-of
select="php:function('lang', 'When?')" /></h3></legend>
</div>
<div id="dates-container">
+ <input type="hidden"
data-validation="application_dates" />
<input type="hidden" id="date_format" />
<xsl:for-each select="application/dates">
<xsl:variable name="index"
select="position()-2"/>
@@ -277,5 +278,6 @@
var initialAcceptAllTerms = true;
var initialSelection = <xsl:value-of
select="application/resources_json"/>;
var initialAudience = <xsl:value-of
select="application/audience_json"/>;
+
$('#field_customer_identifier_type').attr("data-validation","customer_identifier");
</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 22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/templates/base/application_new.xsl
2015-10-23 20:59:17 UTC (rev 14233)
@@ -130,6 +130,7 @@
<p><xsl:value-of
select="config/application_when"/></p>
</xsl:if>
<div id="dates-container">
+ <input type="hidden"
data-validation="application_dates" />
<input type="hidden" id="date_format" />
<xsl:for-each select="application/dates">
<xsl:variable name="index"
select="position()-2"/>
@@ -257,9 +258,9 @@
<xsl:attribute name="data-validation">
<xsl:text>confirmation</xsl:text>
</xsl:attribute>
- <xsl:atrribute
name="data-validation-confirm">
+ <xsl:attribute
name="data-validation-confirm">
<xsl:text>contact_email</xsl:text>
- </xsl:atrribute>
+ </xsl:attribute>
<xsl:attribute
name="data-validation-error-msg">
<xsl:text>the e-mail addresses you
entered do not match</xsl:text>
</xsl:attribute>
@@ -341,5 +342,6 @@
var initialSelection = <xsl:value-of
select="application/resources_json"/>;
var initialAudience = <xsl:value-of
select="application/audience_json"/>;
var lang = <xsl:value-of select="php:function('js_lang', 'From', 'To',
'Resource Type', 'Name', 'Accepted', 'Document', 'You must accept to follow all
terms and conditions of lease first.')"/>
+
$('#field_customer_identifier_type').attr("data-validation","customer_identifier");
</script>
</xsl:template>
Modified: branches/dev-syncromind/booking/templates/base/building_schedule.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/building_schedule.xsl
2015-10-22 22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/templates/base/building_schedule.xsl
2015-10-23 20:59:17 UTC (rev 14233)
@@ -44,12 +44,13 @@
schedule.colFormatter = 'backendScheduleDateColumn';
var handleHistoryNavigation = function (state) {
schedule.date = parseISO8601(state);
- schedule.renderSchedule('schedule_container',
schedule.datasourceUrl, schedule.date, schedule.colFormatter, true);
+ schedule.renderSchedule('schedule_container',
schedule.datasourceUrl, schedule.date, schedule.colFormatter,
schedule.includeResource);
};
var initialRequest = getUrlData("date") || '<xsl:value-of
select="building/date"/>';
var state = getUrlData("date") || initialRequest;
+ schedule.state = state;
if (state){
handleHistoryNavigation(state);
schedule.week = $.datepicker.iso8601Week(schedule.date);
Modified: branches/dev-syncromind/booking/templates/base/event_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/event_edit.xsl
2015-10-22 22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/templates/base/event_edit.xsl
2015-10-23 20:59:17 UTC (rev 14233)
@@ -363,5 +363,6 @@
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')"/>;
+
$('#field_customer_identifier_type').attr("data-validation","customer_identifier");
</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 22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/templates/base/event_new.xsl
2015-10-23 20:59:17 UTC (rev 14233)
@@ -92,6 +92,7 @@
<legend><h3><xsl:value-of
select="php:function('lang', 'When?')" /></h3></legend>
</div>
<div id="dates-container"
class="pure-control-group">
+ <input type="hidden"
data-validation="application_dates" />
<xsl:for-each select="event/dates">
<xsl:variable name="index"
select="position()-2"/>
<xsl:choose>
@@ -320,5 +321,6 @@
$('#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 lang = <xsl:value-of select="php:function('js_lang', 'Name',
'From', 'To', 'Resource Type')"/>;
+
$('#field_customer_identifier_type').attr("data-validation","customer_identifier");
</script>
</xsl:template>
Modified: branches/dev-syncromind/booking/templates/base/resource_schedule.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/resource_schedule.xsl
2015-10-22 22:38:13 UTC (rev 14232)
+++ branches/dev-syncromind/booking/templates/base/resource_schedule.xsl
2015-10-23 20:59:17 UTC (rev 14233)
@@ -40,6 +40,7 @@
$(window).load(function() {
schedule.setupWeekPicker('cal_container');
schedule.datasourceUrl = '<xsl:value-of
select="resource/datasource_url"/>';
+ schedule.newApplicationUrl = '<xsl:value-of
select="resource/application_link"/>';
schedule.includeResource = false;
schedule.colFormatter = 'backendScheduleDateColumn';
var handleHistoryNavigation = function (state) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14233] validations,
Saul <=