svn commit: r1034378 - in /ofbiz/branches/jquery/framework: common/widget/CommonScreens.xml images/webapp/images/fieldlookup.js

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

svn commit: r1034378 - in /ofbiz/branches/jquery/framework: common/widget/CommonScreens.xml images/webapp/images/fieldlookup.js

jleroux@apache.org
Author: jleroux
Date: Fri Nov 12 12:39:45 2010
New Revision: 1034378

URL: http://svn.apache.org/viewvc?rev=1034378&view=rev
Log:
Prevent a small error when used with Lookup pop-up windows (notably in ListVisualThemes)

Modified:
    ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml
    ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js

Modified: ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml?rev=1034378&r1=1034377&r2=1034378&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml (original)
+++ ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml Fri Nov 12 12:39:45 2010
@@ -228,7 +228,7 @@ under the License.
         </section>
     </screen>
 
-    <!-- Global decorator for Lookup pop-up windows -->
+    <!-- Global decorator for Lookup pop-up windows or layered CSS -->
     <screen name="LookupDecorator">
         <section>
             <condition>

Modified: ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js?rev=1034378&r1=1034377&r2=1034378&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js (original)
+++ ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js Fri Nov 12 12:39:45 2010
@@ -700,41 +700,42 @@ var lookupDescriptionLoaded = function(f
   this.init(fieldId, url, params, formName);
 }
 
-jQuery.extend(lookupDescriptionLoaded.prototype, {
-
-   init: function(fieldId, url, params, formName) {
-     this.fieldId = fieldId;
-     this.url = url;
-     this.params = params;
-     this.formName = formName;
-   },
-   update: function(){
-     var tooltipElement = jQuery("#" + this.fieldId + '_lookupDescription');
-     if (tooltipElement.length) {//first remove current description
-         tooltipElement.remove();
-     }
+if (typeof jQuery != 'undefined') {
+  jQuery.extend(lookupDescriptionLoaded.prototype, {
+  
+    init: function(fieldId, url, params, formName){
+      this.fieldId = fieldId;
+      this.url = url;
+      this.params = params;
+      this.formName = formName;
+    },
+    update: function(){
+      var tooltipElement = jQuery("#" + this.fieldId + '_lookupDescription');
+      if (tooltipElement.length) {//first remove current description
+        tooltipElement.remove();
+      }
       //actual server call
       var fieldName = this.params.substring(this.params.indexOf("searchValueFieldName"));
       fieldName = fieldName.substring(fieldName.indexOf("=") + 1);
-      var fieldSerialized = jQuery("input[name=" + fieldName  + "]", jQuery("form[name=" + this.formName  + "]")).serialize();
+      var fieldSerialized = jQuery("input[name=" + fieldName + "]", jQuery("form[name=" + this.formName + "]")).serialize();
       this.allParams = this.params + '&' + fieldSerialized + '&' + 'searchType=EQUALS';
       _fieldId = this.fieldId;
-
-     jQuery.ajax({
-       url: this.url,
-       type: "POST",
-       data: this.allParams,
-       async: false,
-       success: function(result){
-           // This would be far more reliable if we would remove the widget boundaries in LookupDecorator using widgetVerbose in context
-           if (result.split("ajaxAutocompleteOptions.ftl -->")[1]) {
-               setLookDescription(_fieldId, result.split("ajaxAutocompleteOptions.ftl -->")[1].trim().split("<!--")[0].trim(), "", "");
-           }
-      }
-    });
-  }
-});
-
+      
+      jQuery.ajax({
+        url: this.url,
+        type: "POST",
+        data: this.allParams,
+        async: false,
+        success: function(result){
+          // This would be far more reliable if we would remove the widget boundaries in LookupDecorator using widgetVerbose in context
+          if (result.split("ajaxAutocompleteOptions.ftl -->")[1]) {
+            setLookDescription(_fieldId, result.split("ajaxAutocompleteOptions.ftl -->")[1].trim().split("<!--")[0].trim(), "", "");
+          }
+        }
+      });
+    }
+  });
+}
 if(typeof String.prototype.trim !== 'function') { // Needed because IE8 does not implement trim yet
   String.prototype.trim = function() {
     return this.replace(/^\s+|\s+$/g, '');