fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [14269] add jquery theme


From: Saul
Subject: [Fmsystem-commits] [14269] add jquery theme
Date: Mon, 02 Nov 2015 23:54:59 +0000

Revision: 14269
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14269
Author:   psaul
Date:     2015-11-02 23:54:58 +0000 (Mon, 02 Nov 2015)
Log Message:
-----------
add jquery theme

Modified Paths:
--------------
    branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
    branches/dev-syncromind/booking/inc/class.uicommon.inc.php
    branches/dev-syncromind/booking/js/booking/application.js

Modified: branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiapplication.inc.php     
2015-10-31 00:26:28 UTC (rev 14268)
+++ branches/dev-syncromind/booking/inc/class.uiapplication.inc.php     
2015-11-02 23:54:58 UTC (rev 14269)
@@ -791,17 +791,21 @@
 
                        $GLOBALS['phpgw']->jqcal->add_listener('start_date', 
'datetime');
                        $GLOBALS['phpgw']->jqcal->add_listener('end_date', 
'datetime');
-
-                       $tabs = array();
-                       $tabs['generic'] = array('label' => lang('Application 
Add'), 'link' => '#application_add');
-                       $active_tab = 'generic';
-
-                       $application['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
-                       
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security', 
'file'), 'application_form');
                         
                        self::add_javascript('booking', 'booking', 
'application.js');
                        self::adddatetimepicker();
+            
+            if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 
'bookingfrontend') {
+                self::add_stylesheet('phpgwapi/templates/portico/base.css');   
             
+            } else {
+                $tabs = array();
+                $tabs['generic'] = array('label' => lang('Application Add'), 
'link' => '#application_add');
+                $active_tab = 'generic';
 
+                $application['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
+                phpgwapi_jquery::formvalidator_generate(array('location', 
'date', 'security', 'file'), 'application_form');
+            }
+
                        self::render_template_xsl('application_new', 
array('application' => $application, 'activities' => $activities, 'agegroups' 
=> $agegroups, 'audience' => $audience,'config' => $application_text));
                }
 

Modified: branches/dev-syncromind/booking/inc/class.uicommon.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uicommon.inc.php  2015-10-31 
00:26:28 UTC (rev 14268)
+++ branches/dev-syncromind/booking/inc/class.uicommon.inc.php  2015-11-02 
23:54:58 UTC (rev 14269)
@@ -718,8 +718,12 @@
                public function adddatetimepicker($type = 'datetime')
                {
                        phpgwapi_jquery::load_widget('datepicker');
-
-                       $theme = 'ui-lightness';
+            if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 
'bookingfrontend') {
+                $theme = 'humanity';
+            } else {
+                $theme = 'ui-lightness';
+            }
+//                     $theme = 'ui-lightness';
                        
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/css/{$theme}/jquery-ui-1.10.4.custom.css");
 
                        switch($type)
@@ -743,7 +747,37 @@
                        $lang_select_date = lang('select date');
                        $lang_from = lang('from');
                        $lang_to = lang('to');
+            
+            if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 
'bookingfrontend') {
+                $html = 'var html = "<div class=\'date-container\'>"+
+                            "<a class=\'close-btn btnclose\' 
href=\'javascript:void(0);\'>-</a>"+
+                            "<dt><label 
for=\'new_start_date_"+this.counter+"\'>'.$lang_from.'</label></dt>"+
+                            "<dd><input class=\'new_datepicker time\' 
name=\'from_[]\' id=\'new_start_date_"+this.counter+"\' type=\'text\'>"+
+                            "</input></dd>"+
+                            "<dt><label for=\'new_end_date_"+this.counter+"\' 
>'.$lang_to.'</label></dt>"+
+                            "<dd><input class=\'new_datepicker time\' 
name=\'to_[]\' id=\'new_end_date_"+this.counter+"\' type=\'text\'>"+
+                            "</input></dd>"+
+                        "</div>"';
+            } else {
+                $html = 'var html = "<div class=\'date-container\'>"+
+                                               "<a class=\'close-btn 
btnclose\' href=\'javascript:void(0);\'>-</a>"+
+                                               "<div 
class=\'pure-control-group\'>"+
+                                                       "<label 
for=\'new_start_date_"+this.counter+"\'><h4>'.$lang_from.'</h4></label>"+
+                                                       "<input 
class=\'new_datepicker time pure-input-2-3\' name=\'from_[]\' 
id=\'new_start_date_"+this.counter+"\' type=\'text\'>"+
+                                                       "</input>"+
+                                               "</div>"+
+                                               "<div 
class=\'pure-control-group\'>"+
+                                                       "<label 
for=\'new_end_date_"+this.counter+"\' ><h4>'.$lang_to.'</h4></label>"+
+                                                       "<input 
class=\'new_datepicker time pure-input-2-3\' name=\'to_[]\' 
id=\'new_end_date_"+this.counter+"\' type=\'text\'>"+
+                                                       "</input>"+
+                                               "</div>"+
+                                       "</div>"';
+            }
 
+//            echo $html;
+//            exit();
+                
+
                        $js =<<<JS
 
                        $(function() {
@@ -771,21 +805,9 @@
                                         this.counter = 
$('.date-container').length - 1;
 
                                        if (!this.counter) { this.counter = 0; }
+                                    
+                    {$html}
 
-                                       html = '<div class="date-container">'+
-                                               '<a class="close-btn btnclose" 
href="javascript:void(0);">-</a>'+
-                                               '<div 
class="pure-control-group">'+
-                                                       '<label 
for="new_start_date_'+this.counter+'"><h4>{$lang_from}</h4></label>'+
-                                                       '<input 
class="new_datepicker time pure-input-2-3" name="from_[]" 
id="new_start_date_'+this.counter+'" type="text">'+
-                                                       '</input>'+
-                                               '</div>'+
-                                               '<div 
class="pure-control-group">'+
-                                                       '<label 
for="new_end_date_'+this.counter+'" ><h4>{$lang_to}</h4></label>'+
-                                                       '<input 
class="new_datepicker time pure-input-2-3" name="to_[]" 
id="new_end_date_'+this.counter+'" type="text">'+
-                                                       '</input>'+
-                                               '</div>'
-                                       '</div>';
-
                                        
add.parent().parent().children('#dates-container').append(html);
 
                                        $( ".new_datepicker" ).{$_type}picker({

Modified: branches/dev-syncromind/booking/js/booking/application.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/application.js   2015-10-31 
00:26:28 UTC (rev 14268)
+++ branches/dev-syncromind/booking/js/booking/application.js   2015-11-02 
23:54:58 UTC (rev 14269)
@@ -16,7 +16,7 @@
             success: function(data) {
                 var html_agegroups = '';
                 var html_audience = '';
-
+                
                 if( data != null)
                 {
                     var agegroups = data.agegroups;
@@ -91,118 +91,121 @@
         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.']);
-//        }
-//    });
-    
-});
-
-//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++;
+    if (!$.formUtils) {
+        $('#application_form').submit(function(e){
+            if(!validate_documents()){
+                e.preventDefault();
+                alert(lang['You must accept to follow all terms and conditions 
of lease first.']);
             }
         });
-        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: ''
-})
+if ($.formUtils) {
+    $.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: '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: ''
-});
+    $.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: '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: '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: ''
+    });
 
-$.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",""));
+    $.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;
             }
-        });
-        $('input[name="to_[]"]').each(function(){
-            if ($(this).val() == "") {
-                $($(this).addClass("error").css("border-color","red"));
-                n++;
-            } else {
-                $($(this).removeClass("error").css("border-color",""));
+            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: ''
+    });
+} else {
+    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;
-    },
-    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&';
@@ -226,11 +229,20 @@
 }
 
 function populateTableResources (url, container, colDefs) {
-    createTable(container,url,colDefs,'results');
+    if (tableClass) {
+        createTable(container,url,colDefs,'results', tableClass);
+    } else {
+        createTable(container,url,colDefs,'results');
+    }
 }
 
 function populateTableRegulations (url, container, colDefs) {
-    createTable(container,url,colDefs);
+    if (tableClass) {
+        createTable(container,url,colDefs,'', tableClass);
+    } else {
+        createTable(container,url,colDefs);
+    }
+    
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]