You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2010/10/27 20:37:25 UTC

svn commit: r1028062 - in /ofbiz/branches/jquery/specialpurpose/webpos: webapp/webpos/images/js/SearchProducts.js webapp/webpos/includes/Header.ftl widget/CommonScreens.xml widget/WebPosScreens.xml

Author: jleroux
Date: Wed Oct 27 18:37:24 2010
New Revision: 1028062

URL: http://svn.apache.org/viewvc?rev=1028062&view=rev
Log:
A patch from Sascha Rodekamp "webPos Migration and Cleanup" (https://issues.apache.org/jira/browse/OFBIZ-3986) - OFBIZ-3986

I forgot the webPos patch, thanks to Sascha for the reminder

Modified:
    ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js
    ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/includes/Header.ftl
    ofbiz/branches/jquery/specialpurpose/webpos/widget/CommonScreens.xml
    ofbiz/branches/jquery/specialpurpose/webpos/widget/WebPosScreens.xml

Modified: ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js?rev=1028062&r1=1028061&r2=1028062&view=diff
==============================================================================
--- ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js (original)
+++ ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js Wed Oct 27 18:37:24 2010
@@ -17,87 +17,77 @@ specific language governing permissions 
 under the License.
 */
 
-document.observe('dom:loaded', function() {
+jQuery(document).ready( function() { 
 
     // Autocompleter for good identification field
-    var j = 0;
-    var autoCompleteIdent = null;
     var productsIdent = [];
     var productsIdIdent = [];
-    var previousIdent = '';
-    Event.observe($('productGoodIdentification'), 'focus', function(s) {
-        var ident = $('productGoodIdentification').value;
-        if (j == 0 || previousIdent != ident) {
-            var pars = 'productGoodIdentification' + $('productGoodIdentification').value;
-            new Ajax.Request("FindProductsByIdentification",
-            {
-                asynchronous: false,
-                parameters: pars,
-                onSuccess: function(transport) {
-                var data = transport.responseText.evalJSON(true);
-                productsIdent = data.productsList;
-                productsIdIdent = data.productsId;
-                autoComplete = new Autocompleter.Local('productGoodIdentification', 'productsIdent', productsIdent, {partialSearch: false});
-            }
-        });
-        previousIdent = ident;
-        j++;
+            
+    jQuery( "#productGoodIdentification" ).autocomplete({
+        minLength: 2,
+        source: function( request, response ) {
+            var term = request.term;
+            term = 'productGoodIdentification=' + term;
+            jQuery.ajax({
+                url: "FindProductsByIdentification",
+                type: 'POST',
+                async: false,
+                data: term,
+                success: function(data) {
+                    productsIdent = data.productsList;
+                    productsIdIdent = data.productsId;
+                    response( productsIdent );    
+                }
+    
+            });
+        },
+        select: function( event, ui ) {
+            var identValues = ui.item.value;
+    
+            jQuery.each(productsIdent, function(product) {
+                if (identValues == this) {
+                    document.getElementById('add_product_id').value = productsIdIdent[product];
+                    return false;
+                }
+            });
         }
     });
 
-    Event.observe($('productGoodIdentification'), 'blur', function(s) {
-        identValues = $('productGoodIdentification').value;
-        var l = 0;
-        productsIdent.each(function(product) {
-            if (identValues == product) {
-                $('add_product_id').value = productsIdIdent[l];
-                throw $break;
-            }
-            l++;
-        });
-    });
-
     // Autocompleter for search by field
-    Event.observe($('searchBy'), 'change', function(s) {
-        $('add_product_id').value = '';
-        $('productToSearch').value = '';
-        Form.Element.focus('productToSearch');
+    jQuery('#searchBy').change( function(s) {
+        document.getElementById('add_product_id').value = '';
+        document.getElementById('productToSearch').value = '';
+        jQuery('#productToSearch').focus();
     });
-
-    var i = 0;
-    var autoComplete = null;
-    var products = [];
-    var productsId = [];
-    var previousSearchBy = '';
-    Event.observe($('productToSearch'), 'focus', function(s) {
-        var searchBy = $('searchBy').value;
-        if (i == 0 || previousSearchBy != searchBy) {
-            var pars = 'searchBy=' + $('searchBy').value + '&productToSearch=' + $('productToSearch').value;
-            new Ajax.Request("FindProducts",
-            {
-                asynchronous: false,
-                parameters: pars,
-                onSuccess: function(transport) {
-                var data = transport.responseText.evalJSON(true);
-                products = data.productsList;
-                productsId = data.productsId;
-                autoComplete = new Autocompleter.Local('productToSearch', 'products', products, {partialSearch: false});
-            }
-        });
-        previousSearchBy = searchBy;
-        i++;
+    
+    jQuery( "#productToSearch" ).autocomplete({
+        minLength: 2,
+        source: function( request, response ) {
+            var term = request.term;
+            term = 'searchBy=' + document.getElementById('searchBy').value + '&productToSearch=' + term;
+            jQuery.ajax({
+                url: "FindProducts",
+                async: false,
+                type: 'POST',
+                data: term,
+                success: function(data) {
+                    products = data.productsList;
+                    productsId = data.productsId;
+                    response( products );    
+                }
+    
+            });
+        },
+        select: function( event, ui ) {
+            var productToSearchValues = ui.item.value;
+    
+            jQuery.each(products, function(product){
+                if (productToSearchValues == this) {
+                    document.getElementById('add_product_id').value = productsId[product];
+                    return false;
+                }
+            });
         }
     });
-
-    Event.observe($('productToSearch'), 'blur', function(s) {
-        productToSearchValues = $('productToSearch').value;
-        var p = 0;
-        products.each(function(product){
-            if (productToSearchValues == product) {
-                $('add_product_id').value = productsId[p];
-                throw $break;
-            }
-            p++;
-        });
-    });
+    
 });
\ No newline at end of file

Modified: ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/includes/Header.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/includes/Header.ftl?rev=1028062&r1=1028061&r2=1028062&view=diff
==============================================================================
--- ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/includes/Header.ftl (original)
+++ ofbiz/branches/jquery/specialpurpose/webpos/webapp/webpos/includes/Header.ftl Wed Oct 27 18:37:24 2010
@@ -53,12 +53,6 @@ under the License.
     <#if metaKeywords?exists>
         <meta name="keywords" content="${metaKeywords}"/>
     </#if>
-
-    <#if requireDojo?exists>
-        <script type="text/javascript">
-          dojo.require("dojo.widget.*");
-        </script>
-    </#if>
 </head>
 
 <body>

Modified: ofbiz/branches/jquery/specialpurpose/webpos/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/specialpurpose/webpos/widget/CommonScreens.xml?rev=1028062&r1=1028061&r2=1028062&view=diff
==============================================================================
--- ofbiz/branches/jquery/specialpurpose/webpos/widget/CommonScreens.xml (original)
+++ ofbiz/branches/jquery/specialpurpose/webpos/widget/CommonScreens.xml Wed Oct 27 18:37:24 2010
@@ -42,8 +42,14 @@ under the License.
                 <!-- NOTE: this should be included on each screen that uses it to avoid including it in all screens: -->
                 <set field="layoutSettings.javaScripts[+0]" value="/images/fieldlookup.js" global="true"/>
                 <set field="layoutSettings.javaScripts[+0]" value="/images/selectall.js" global="true"/>
-                <set field="layoutSettings.javaScripts[+0]" value="/images/calendar1.js" global="true"/>
-                <set field="layoutSettings.javaScripts[+0]" value="/images/prototypejs/prototype.js" global="true"/>
+
+                <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/js/jquery-ui-1.8.2.custom.min.js" global="true"/>
+                <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-0.5.js" global="true"/>
+                <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/validate/jquery.validate.min.js" global="true"/>
+                <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/development-bundle/ui/jquery.ui.datepicker.js" global="true"/>
+                <set field="initialLocale" type="String" value="${parameters.userLogin.lastLocale}" default-value="${groovy:locale.toString()}"/>
+                <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/development-bundle/ui/i18n/jquery.ui.datepicker-${initialLocale}.js" global="true"/>
+                <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.min.js" global="true"/>
 
                 <script location="component://webpos/widget/WebPosSetup.groovy"/>
 

Modified: ofbiz/branches/jquery/specialpurpose/webpos/widget/WebPosScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/specialpurpose/webpos/widget/WebPosScreens.xml?rev=1028062&r1=1028061&r2=1028062&view=diff
==============================================================================
--- ofbiz/branches/jquery/specialpurpose/webpos/widget/WebPosScreens.xml (original)
+++ ofbiz/branches/jquery/specialpurpose/webpos/widget/WebPosScreens.xml Wed Oct 27 18:37:24 2010
@@ -25,10 +25,6 @@ under the License.
         <section>
             <actions>
                 <set field="MainColumnStyle" value="rightonly"/>
-
-                <set field="layoutSettings.javaScripts[+0]" value="/images/prototypejs/scriptaculous.js" global="true"/>
-                <set field="layoutSettings.javaScripts[+0]" value="/images/prototypejs/effects.js" global="true"/>
-                <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/controls.js" global="true"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">