[ofbiz-framework] branch trunk updated: Fixed: CommonTheme has a dependency on Flatgrey application.js

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: CommonTheme has a dependency on Flatgrey application.js

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3181200  Fixed: CommonTheme has a dependency on Flatgrey application.js
3181200 is described below

commit 31812009ebd9642158b4ca5359b6234f8a6c8049
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Thu Mar 19 11:14:12 2020 +0100

    Fixed: CommonTheme has a dependency on Flatgrey application.js
   
    (OFBIZ-11466)
   
    In theme.xml of common-theme there is a reference to application.js residing in
    the Flatgrey theme. This should not be. The file should be in common-theme.
   
    Thanks: Pierre Smits for report and fix. I have just also removed
    rainbowstone/js/application.js since it's now in common-theme
---
 .../webapp/common/js/util/application.js           | 199 ++++++++++++++++++++
 themes/common-theme/widget/Theme.xml               |   2 +-
 themes/flatgrey/webapp/flatgrey/js/application.js  | 201 ---------------------
 themes/flatgrey/widget/Theme.xml                   |   2 -
 .../webapp/rainbowstone/js/application.js          | 201 ---------------------
 5 files changed, 200 insertions(+), 405 deletions(-)

diff --git a/themes/common-theme/webapp/common/js/util/application.js b/themes/common-theme/webapp/common/js/util/application.js
new file mode 100644
index 0000000..ec6c0db
--- /dev/null
+++ b/themes/common-theme/webapp/common/js/util/application.js
@@ -0,0 +1,199 @@
+/***********************************************
+APACHE OFBiz
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+***********************************************/
+
+/*********************
+JQuery Columns
+*********************/
+var j = 1;
+
+(function(jQuery) {
+    jQuery.fn.columns = function(options) {
+    
+    var defaults = {
+        colNumber: 2,
+        direction: 'vertical'
+    };
+            
+    this.each(function() {
+        var settings = jQuery.extend(defaults, options);
+        var totalListElements = jQuery(this).children('li').size();
+        var baseColItems = Math.ceil(totalListElements / settings.colNumber);
+        var listClass = jQuery(this).attr('class');
+        
+        for (let i=1;i<=settings.colNumber;i++) {
+            if(i==1){
+                jQuery(this).addClass('listCol1').wrap('<div class="listContainer'+j+'"></div>');
+            }
+            else if(jQuery(this).is('ul')) {
+                jQuery(this).parents('.listContainer'+j).append('<ul class="listCol'+i+'"></ul>');
+            }
+            else {
+                jQuery(this).parents('.listContainer'+j).append('<ol class="listCol'+i+'"></ol>');
+            }
+                jQuery('.listContainer'+j+' > ul,.listContainer'+j+' > ol').addClass(listClass);
+        }
+        
+        var listItem = 0;
+        var k = 1;
+        var l = 0;    
+        
+        if(settings.direction == 'vertical') {
+            jQuery(this).children('li').each(function() {
+                listItem = listItem+1;
+                if (listItem > baseColItems*(settings.colNumber-1) ) {
+                    jQuery(this).parents('.listContainer'+j).find('.listCol'+settings.colNumber).append(this);
+                }
+                else {
+                    if(listItem<=(baseColItems*k)) {
+                        jQuery(this).parents('.listContainer'+j).find('.listCol'+k).append(this);
+                    }
+                    else {
+                        jQuery(this).parents('.listContainer'+j).find('.listCol'+(k+1)).append(this);
+                        k = k+1;
+                    }
+                }
+            });
+            
+            jQuery('.listContainer'+j).find('ol,ul').each(function(){
+                if(jQuery(this).children().size() == 0) {
+                jQuery(this).remove();
+                }
+            });    
+            
+        }
+        
+        else {
+            jQuery(this).children('li').each(function(){
+                l = l+1;
+                if(l <= settings.colNumber) {
+                    jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this);
+                }
+                else {
+                    l = 1;
+                    jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this);
+                }
+            });
+        }
+        
+        jQuery('.listContainer'+j).find('ol:last,ul:last').addClass('last');
+        j = j+1;
+        
+    });
+    };
+})(jQuery);
+
+/*********************
+JQuery Formalize
+*********************/
+var FORMALIZE = (function($, window, document, undefined) {
+    var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
+    var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
+    var WEBKIT = 'webkitAppearance' in document.createElement('select').style;
+    var IE6 = !!($.browser.msie && parseInt($.browser.version, 10) === 6);
+    var IE7 = !!($.browser.msie && parseInt($.browser.version, 10) === 7);
+    return {
+        go: function() {
+            for (var i in FORMALIZE.init) {
+                FORMALIZE.init[i]();
+            }
+        },
+        init: {
+            detect_webkit: function() {
+                if (!WEBKIT) {
+                    return;
+                }
+                $('html').addClass('is_webkit');
+            },
+            full_input_size: function() {
+                if (!IE7 || !$('textarea, input.input_full').length) {
+                    return;
+                }
+                $('textarea, input.input_full').wrap('<span class="input_full_wrap"></span>');
+            },
+            ie6_skin_inputs: function() {
+                if (!IE6 || !$('input, select, textarea').length) {
+                    return;
+                }
+                var button_regex = /button|submit|reset/;
+                var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
+                $('input').each(function() {
+                    var el = $(this);
+                    if (this.getAttribute('type').match(button_regex)) {
+                        el.addClass('ie6_button');
+                        if (this.disabled) {
+                            el.addClass('ie6_button_disabled');
+                        }
+                    }
+                    else if (this.getAttribute('type').match(type_regex)) {
+                        el.addClass('ie6_input');
+                        if (this.disabled) {
+                            el.addClass('ie6_input_disabled');
+                        }
+                    }
+                });
+                $('textarea, select').each(function() {
+                    if (this.disabled) {
+                        $(this).addClass('ie6_input_disabled');
+                    }
+                });
+            },
+            placeholder: function() {
+                if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
+                    return;
+                }
+                $(':input[placeholder]').each(function() {
+                    var el = $(this);
+                    var text = el.attr('placeholder');
+                    function add_placeholder() {
+                        if (!el.val() || el.val() === text) {
+                            el.val(text).addClass('placeholder_text');
+                        }
+                    }
+                    add_placeholder();
+                    el.focus(function() {
+                        if (el.val() === text) {
+                            el.val('').removeClass('placeholder_text');
+                        }
+                    }).blur(function() {
+                        add_placeholder();
+                    });
+                    el.closest('form').submit(function() {
+                        if (el.val() === text) {
+                            el.val('');
+                        }
+                    }).on('reset', function() {
+                        setTimeout(add_placeholder, 50);
+                    });
+                });
+            },
+            autofocus: function() {
+                if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
+                    return;
+                }
+                $(':input[autofocus]:visible:first').select();
+            }
+        }
+    };
+})(jQuery, this);
+
+jQuery(document).ready(function() {
+    FORMALIZE.go();
+});
+
diff --git a/themes/common-theme/widget/Theme.xml b/themes/common-theme/widget/Theme.xml
index 9ead18d..9b708c5 100644
--- a/themes/common-theme/widget/Theme.xml
+++ b/themes/common-theme/widget/Theme.xml
@@ -79,7 +79,7 @@ under the License.
         <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/jsTree/jquery.jstree.js"/>
         <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/ui/js/jquery.cookie-1.4.0.js"/>
         <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/plugins/date/FromThruDateCheck.js"/>
-        <property name="VT_HDR_JAVASCRIPT['add']" value="/flatgrey/js/application.js"/>
+        <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/util/application.js"/>
         <!--Css styles: don't load them since they differ depending on theme -->
         <property name="VT_STYLESHEET['add']" value="/common/js/jquery/plugins/elrte-1.3/css/elrte.min.css"/>
         <property name="VT_STYLESHEET['add']" value="/common/js/jquery/ui/jquery-ui-1.12.1.min.css"/>
diff --git a/themes/flatgrey/webapp/flatgrey/js/application.js b/themes/flatgrey/webapp/flatgrey/js/application.js
deleted file mode 100644
index 9a30e73..0000000
--- a/themes/flatgrey/webapp/flatgrey/js/application.js
+++ /dev/null
@@ -1,201 +0,0 @@
-/***********************************************
-APACHE OFBiz
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
-***********************************************/
-
-/*********************
-JQuery Columns
-*********************/
-var j = 1;
-
-(function(jQuery) {
- jQuery.fn.columns = function(options) {
-
- var defaults = {
- colNumber: 2,
- direction: 'vertical'
- };
-
- this.each(function() {
-
- var obj = jQuery(this);
- var settings = jQuery.extend(defaults, options);
- var totalListElements = jQuery(this).children('li').size();
- var baseColItems = Math.ceil(totalListElements / settings.colNumber);
- var listClass = jQuery(this).attr('class');
-
- for (i=1;i<=settings.colNumber;i++) {
- if(i==1){
- jQuery(this).addClass('listCol1').wrap('<div class="listContainer'+j+'"></div>');
- }
- else if(jQuery(this).is('ul')) {
- jQuery(this).parents('.listContainer'+j).append('<ul class="listCol'+i+'"></ul>');
- }
- else {
- jQuery(this).parents('.listContainer'+j).append('<ol class="listCol'+i+'"></ol>');
- }
- jQuery('.listContainer'+j+' > ul,.listContainer'+j+' > ol').addClass(listClass);
- }
-
- var listItem = 0;
- var k = 1;
- var l = 0;
-
- if(settings.direction == 'vertical') {
- jQuery(this).children('li').each(function() {
- listItem = listItem+1;
- if (listItem > baseColItems*(settings.colNumber-1) ) {
- jQuery(this).parents('.listContainer'+j).find('.listCol'+settings.colNumber).append(this);
- }
- else {
- if(listItem<=(baseColItems*k)) {
- jQuery(this).parents('.listContainer'+j).find('.listCol'+k).append(this);
- }
- else {
- jQuery(this).parents('.listContainer'+j).find('.listCol'+(k+1)).append(this);
- k = k+1;
- }
- }
- });
-
- jQuery('.listContainer'+j).find('ol,ul').each(function(){
- if(jQuery(this).children().size() == 0) {
- jQuery(this).remove();
- }
- });
-
- }
-
- else {
- jQuery(this).children('li').each(function(){
- l = l+1;
- if(l <= settings.colNumber) {
- jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this);
- }
- else {
- l = 1;
- jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this);
- }
- });
- }
-
- jQuery('.listContainer'+j).find('ol:last,ul:last').addClass('last');
- j = j+1;
-
- });
-    };
-})(jQuery);
-
-/*********************
-JQuery Formalize
-*********************/
-var FORMALIZE = (function($, window, document, undefined) {
- var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
- var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
- var WEBKIT = 'webkitAppearance' in document.createElement('select').style;
- var IE6 = !!($.browser.msie && parseInt($.browser.version, 10) === 6);
- var IE7 = !!($.browser.msie && parseInt($.browser.version, 10) === 7);
- return {
- go: function() {
- for (var i in FORMALIZE.init) {
- FORMALIZE.init[i]();
- }
- },
- init: {
- detect_webkit: function() {
- if (!WEBKIT) {
- return;
- }
- $('html').addClass('is_webkit');
- },
- full_input_size: function() {
- if (!IE7 || !$('textarea, input.input_full').length) {
- return;
- }
- $('textarea, input.input_full').wrap('<span class="input_full_wrap"></span>');
- },
- ie6_skin_inputs: function() {
- if (!IE6 || !$('input, select, textarea').length) {
- return;
- }
- var button_regex = /button|submit|reset/;
- var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
- $('input').each(function() {
- var el = $(this);
- if (this.getAttribute('type').match(button_regex)) {
- el.addClass('ie6_button');
- if (this.disabled) {
- el.addClass('ie6_button_disabled');
- }
- }
- else if (this.getAttribute('type').match(type_regex)) {
- el.addClass('ie6_input');
- if (this.disabled) {
- el.addClass('ie6_input_disabled');
- }
- }
- });
- $('textarea, select').each(function() {
- if (this.disabled) {
- $(this).addClass('ie6_input_disabled');
- }
- });
- },
- placeholder: function() {
- if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
- return;
- }
- $(':input[placeholder]').each(function() {
- var el = $(this);
- var text = el.attr('placeholder');
- function add_placeholder() {
- if (!el.val() || el.val() === text) {
- el.val(text).addClass('placeholder_text');
- }
- }
- add_placeholder();
- el.focus(function() {
- if (el.val() === text) {
- el.val('').removeClass('placeholder_text');;
- }
- }).blur(function() {
- add_placeholder();
- });
- el.closest('form').submit(function() {
- if (el.val() === text) {
- el.val('');
- }
- }).on('reset', function() {
- setTimeout(add_placeholder, 50);
- });
- });
- },
- autofocus: function() {
- if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
- return;
- }
- $(':input[autofocus]:visible:first').select();
- }
- }
- };
-})(jQuery, this, this.document);
-
-jQuery(document).ready(function() {
- FORMALIZE.go();
-});
-
diff --git a/themes/flatgrey/widget/Theme.xml b/themes/flatgrey/widget/Theme.xml
index 057e3eb..ab48837 100644
--- a/themes/flatgrey/widget/Theme.xml
+++ b/themes/flatgrey/widget/Theme.xml
@@ -36,8 +36,6 @@ under the License.
         <property name="VT_HDR_TMPLT_LOC" value="component://flatgrey/template/Header.ftl"/>
         <property name="VT_FTR_TMPLT_LOC" value="component://flatgrey/template/Footer.ftl"/>
         <property name="VT_NAV_TMPLT_LOC" value="component://flatgrey/template/AppBar.ftl"/>
-        <!--javascript lib-->
-        <property name="VT_HDR_JAVASCRIPT['add']" value="/flatgrey/js/application.js"/>
         <!--Css style-->
         <property name="VT_STYLESHEET['add']" value="/flatgrey/style.css"/>
         <property name="VT_STYLESHEET['add']" value="/flatgrey/javascript.css"/>
diff --git a/themes/rainbowstone/webapp/rainbowstone/js/application.js b/themes/rainbowstone/webapp/rainbowstone/js/application.js
deleted file mode 100644
index 923a464..0000000
--- a/themes/rainbowstone/webapp/rainbowstone/js/application.js
+++ /dev/null
@@ -1,201 +0,0 @@
-/***********************************************
-APACHE OPEN FOR BUSINESS
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
-***********************************************/
-
-/*********************
-JQuery Columns
-*********************/
-var j = 1;
-
-(function(jQuery) {
- jQuery.fn.columns = function(options) {
-
- var defaults = {
- colNumber: 2,
- direction: 'vertical'
- };
-
- this.each(function() {
-
- var obj = jQuery(this);
- var settings = jQuery.extend(defaults, options);
- var totalListElements = jQuery(this).children('li').size();
- var baseColItems = Math.ceil(totalListElements / settings.colNumber);
- var listClass = jQuery(this).attr('class');
-
- for (i=1;i<=settings.colNumber;i++) {
- if(i==1){
- jQuery(this).addClass('listCol1').wrap('<div class="listContainer'+j+'"></div>');
- }
- else if(jQuery(this).is('ul')) {
- jQuery(this).parents('.listContainer'+j).append('<ul class="listCol'+i+'"></ul>');
- }
- else {
- jQuery(this).parents('.listContainer'+j).append('<ol class="listCol'+i+'"></ol>');
- }
- jQuery('.listContainer'+j+' > ul,.listContainer'+j+' > ol').addClass(listClass);
- }
-
- var listItem = 0;
- var k = 1;
- var l = 0;
-
- if(settings.direction == 'vertical') {
- jQuery(this).children('li').each(function() {
- listItem = listItem+1;
- if (listItem > baseColItems*(settings.colNumber-1) ) {
- jQuery(this).parents('.listContainer'+j).find('.listCol'+settings.colNumber).append(this);
- }
- else {
- if(listItem<=(baseColItems*k)) {
- jQuery(this).parents('.listContainer'+j).find('.listCol'+k).append(this);
- }
- else {
- jQuery(this).parents('.listContainer'+j).find('.listCol'+(k+1)).append(this);
- k = k+1;
- }
- }
- });
-
- jQuery('.listContainer'+j).find('ol,ul').each(function(){
- if(jQuery(this).children().size() == 0) {
- jQuery(this).remove();
- }
- });
-
- }
-
- else {
- jQuery(this).children('li').each(function(){
- l = l+1;
- if(l <= settings.colNumber) {
- jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this);
- }
- else {
- l = 1;
- jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this);
- }
- });
- }
-
- jQuery('.listContainer'+j).find('ol:last,ul:last').addClass('last');
- j = j+1;
-
- });
-    };
-})(jQuery);
-
-/*********************
-JQuery Formalize
-*********************/
-var FORMALIZE = (function($, window, document, undefined) {
- var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
- var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
- var WEBKIT = 'webkitAppearance' in document.createElement('select').style;
- var IE6 = !!($.browser.msie && parseInt($.browser.version, 10) === 6);
- var IE7 = !!($.browser.msie && parseInt($.browser.version, 10) === 7);
- return {
- go: function() {
- for (var i in FORMALIZE.init) {
- FORMALIZE.init[i]();
- }
- },
- init: {
- detect_webkit: function() {
- if (!WEBKIT) {
- return;
- }
- $('html').addClass('is_webkit');
- },
- full_input_size: function() {
- if (!IE7 || !$('textarea, input.input_full').length) {
- return;
- }
- $('textarea, input.input_full').wrap('<span class="input_full_wrap"></span>');
- },
- ie6_skin_inputs: function() {
- if (!IE6 || !$('input, select, textarea').length) {
- return;
- }
- var button_regex = /button|submit|reset/;
- var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
- $('input').each(function() {
- var el = $(this);
- if (this.getAttribute('type').match(button_regex)) {
- el.addClass('ie6_button');
- if (this.disabled) {
- el.addClass('ie6_button_disabled');
- }
- }
- else if (this.getAttribute('type').match(type_regex)) {
- el.addClass('ie6_input');
- if (this.disabled) {
- el.addClass('ie6_input_disabled');
- }
- }
- });
- $('textarea, select').each(function() {
- if (this.disabled) {
- $(this).addClass('ie6_input_disabled');
- }
- });
- },
- placeholder: function() {
- if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
- return;
- }
- $(':input[placeholder]').each(function() {
- var el = $(this);
- var text = el.attr('placeholder');
- function add_placeholder() {
- if (!el.val() || el.val() === text) {
- el.val(text).addClass('placeholder_text');
- }
- }
- add_placeholder();
- el.focus(function() {
- if (el.val() === text) {
- el.val('').removeClass('placeholder_text');;
- }
- }).blur(function() {
- add_placeholder();
- });
- el.closest('form').submit(function() {
- if (el.val() === text) {
- el.val('');
- }
- }).on('reset', function() {
- setTimeout(add_placeholder, 50);
- });
- });
- },
- autofocus: function() {
- if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
- return;
- }
- $(':input[autofocus]:visible:first').select();
- }
- }
- };
-})(jQuery, this, this.document);
-
-jQuery(document).ready(function() {
- FORMALIZE.go();
-});
-