svn commit: r947394 - in /ofbiz/branches/release10.04: ./ framework/common/webcommon/includes/lookup.ftl framework/example/widget/example/FormWidgetExampleForms.xml framework/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: r947394 - in /ofbiz/branches/release10.04: ./ framework/common/webcommon/includes/lookup.ftl framework/example/widget/example/FormWidgetExampleForms.xml framework/images/webapp/images/fieldlookup.js

jleroux@apache.org
Author: jleroux
Date: Sun May 23 10:33:19 2010
New Revision: 947394

URL: http://svn.apache.org/viewvc?rev=947394&view=rev
Log:
"Applied fix from trunk for revision: 947392"
------------------------------------------------------------------------
r947392 | jleroux | 2010-05-23 12:08:21 +0200 (dim. 23 mai 2010) | 8 lignes

* Especially fix a bug in fieldlookup.js.
When using description-field-name in a layered lookup called from another layered lookup (recursively or not) the description-field-name parameter (target2) in the call from the 2d lookup button was not modified, therefore the link was not working.

Miscellaneous:
* Format and fix some typos in fieldlookup.js
* Removes now useless commented out functions set_value and set_values in lookup.ftl
* Improves comments in FormWidgetExampleForms.xml

------------------------------------------------------------------------

Modified:
    ofbiz/branches/release10.04/   (props changed)
    ofbiz/branches/release10.04/framework/common/webcommon/includes/lookup.ftl
    ofbiz/branches/release10.04/framework/example/widget/example/FormWidgetExampleForms.xml
    ofbiz/branches/release10.04/framework/images/webapp/images/fieldlookup.js

Propchange: ofbiz/branches/release10.04/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun May 23 10:33:19 2010
@@ -1,3 +1,3 @@
 /ofbiz/branches/addbirt:831210-885099,885686-886087
 /ofbiz/branches/multitenant20100310:921280-927264
-/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941109,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168,943271-943272,944614,944621,944623,944647,944669,944797,944895,945010,945018,945026,945118,945573,945578,945580,945582,945610,945619,945848,945852,945857,946061,946066,946073,946075,946080,946309,946313,946320,946322,946596,947004-947005
+/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941109,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168,943271-943272,944614,944621,944623,944647,944669,944797,944895,945010,945018,945026,945118,945573,945578,945580,945582,945610,945619,945848,945852,945857,946061,946066,946073,946075,946080,946309,946313,946320,946322,946596,947004-947005,947392

Modified: ofbiz/branches/release10.04/framework/common/webcommon/includes/lookup.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/common/webcommon/includes/lookup.ftl?rev=947394&r1=947393&r2=947394&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/common/webcommon/includes/lookup.ftl (original)
+++ ofbiz/branches/release10.04/framework/common/webcommon/includes/lookup.ftl Sun May 23 10:33:19 2010
@@ -85,29 +85,7 @@ under the License.
              src.style.backgroundColor = bkColor;
         }
         // function passing selected value to calling window
-     /*   function set_value(value) {
-                if (!obj_caller) return;
-                setSourceColor(obj_caller.target);
-                obj_caller.target.value = value;
-                obj_caller.target.fire("lookup:changed");
-                if (obj_caller.target.onchange != null) {
-                    obj_caller.target.onchange();                      
-                }
-                window.close();
-        }
-       // function passing selected value to calling window
-        function set_values(value, value2) {
-                set_value(value);
-                if (!obj_caller.target2) return;
-                if (obj_caller.target2 == null) return;
-                setSourceColor(obj_caller.target2);
-                obj_caller.target2.value = value2;
-                obj_caller.target2.fire("lookup:changed");
-                if (obj_caller.target2.onchange != null) {
-                    obj_caller.target2.onchange();
-                }
-        }
-      */  function set_multivalues(value) {
+        function set_multivalues(value) {
             obj_caller.target.value = value;
             var thisForm = obj_caller.target.form;
             var evalString = "";

Modified: ofbiz/branches/release10.04/framework/example/widget/example/FormWidgetExampleForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/example/widget/example/FormWidgetExampleForms.xml?rev=947394&r1=947393&r2=947394&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/example/widget/example/FormWidgetExampleForms.xml (original)
+++ ofbiz/branches/release10.04/framework/example/widget/example/FormWidgetExampleForms.xml Sun May 23 10:33:19 2010
@@ -282,12 +282,12 @@ under the License.
 
     <!-- Lookup Layer Example -->
     <form name="ExampleLookupFields" type="single" title="">
-        <!-- Lookup (in a popup windows, old style) -->
-        <!-- Using separated labels is not recommended (it's better using sentences than words for translation) but here we use only Common labels to avoid dependencies from application to framework -->
+        <!-- Old style lookup (in a popup window) -->
+        <!-- Using separated labels is not recommended (it's better using sentences than words for translation) -->
         <field name="partyIdFrom" title="${uiLabelMap.CommonPartyID} ${uiLabelMap.CommonFrom}">
             <lookup target-form-name="LookupPartyExample" presentation="window"/>
         </field>
-        <!-- Standard Lookup in a layer (new style)-->
+        <!-- Standard lookup (in a layer)-->
         <!-- passes the name in one and the id in another field, the layer is centered -->
         <field name="partyName" title="${uiLabelMap.CommonName}">
             <lookup target-form-name="LookupPartyExampleByName" description-field-name="partyIdTo" presentation="layer"/>

Modified: ofbiz/branches/release10.04/framework/images/webapp/images/fieldlookup.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/images/webapp/images/fieldlookup.js?rev=947394&r1=947393&r2=947394&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/images/webapp/images/fieldlookup.js (original)
+++ ofbiz/branches/release10.04/framework/images/webapp/images/fieldlookup.js Sun May 23 10:33:19 2010
@@ -84,10 +84,8 @@ function fieldLookup1(obj_target, args)
     this.popup2 = lookup_popup2;
     
     // validate input parameters
-    if (! obj_target)
-    return lookup_error("Error calling the field lookup: no target control specified");
-    if (obj_target.value == null)
-    return lookup_error("Error calling the field lookup: parameter specified is not valid target control");
+    if (! obj_target) return lookup_error("Error calling the field lookup: no target control specified");
+    if (obj_target.value == null) return lookup_error("Error calling the field lookup: parameter specified is not valid target control");
     //this.target = obj_target;
     targetW = obj_target;
     
@@ -100,16 +98,12 @@ function fieldLookup2(obj_target, obj_ta
     this.popup = lookup_popup1;
     this.popup2 = lookup_popup2;
     // validate input parameters
-    if (! obj_target)
-    return lookup_error("Error calling the field lookup: no target control specified");
-    if (obj_target.value == null)
-    return lookup_error("Error calling the field lookup: parameter specified is not valid target control");
+    if (! obj_target) return lookup_error("Error calling the field lookup: no target control specified");
+    if (obj_target.value == null) return lookup_error("Error calling the field lookup: parameter specified is not valid target control");
     targetW = obj_target;
     // validate input parameters
-    if (! obj_target2)
-    return lookup_error("Error calling the field lookup: no target2 control specified");
-    if (obj_target2.value == null)
-    return lookup_error("Error calling the field lookup: parameter specified is not valid target2 control");
+    if (! obj_target2) return lookup_error("Error calling the field lookup: no target2 control specified");
+    if (obj_target2.value == null) return lookup_error("Error calling the field lookup: parameter specified is not valid target2 control");
     target2 = obj_target2;
     
     
@@ -182,7 +176,6 @@ var FieldLookupCounter = Class.create({
         for (itm in this.refArr) {
             count++;
         }
-        
         return count;
     },
     
@@ -308,7 +301,7 @@ var FieldLookupPopup = Class.create({
         //set the layer position
         this.setPosition(lookupDiv);
 
-        this.divRef = lookupDiv;
+        this.divRef = lookupDiv;        
 
         //make layer draggable
         this.makeDraggable(lookupDiv);
@@ -530,7 +523,7 @@ var FieldLookupPopup = Class.create({
 });
 
 /**
-* returns true if a Stirng is empty
+* returns true if a String is empty
 * @param value - String value
 * @return
 */
@@ -559,7 +552,7 @@ function getNextCollapseSeq() {
     return COLLAPSE;
 }
 
-//modify epande/ collapse button
+//modify expande/collapse button
 function modifyCollapseable(lookupDiv){
     if (!lookupDiv) {
         return;
@@ -620,7 +613,8 @@ function modifySubmitButton (lookupDiv)
         var newLookups = $A(lookupDiv.getElementsByClassName('field-lookup'));
         newLookups.each(function(newLookup){
             var link = newLookup.getElementsByTagName('a')[0].href;
-            newLookup.getElementsByTagName('a')[0].href = String.replace(link, 'document.'+oldFormName, 'document.'+'form_' + GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).globalRef);
+            var replaced = new  RegExp('document.' + oldFormName, 'g');
+            newLookup.getElementsByTagName('a')[0].href = link.replace(replaced, 'document.'+'form_' + GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).globalRef);
         });
 
         //disable the form action
@@ -654,7 +648,7 @@ function modifySubmitButton (lookupDiv)
                     }
                 });
                 ele.parentNode.removeChild(ele);
-                // modifay nav-pager
+                // modify nav-pager
                 var navPager = null;
                 navPager = lookupDiv.getElementsByClassName("nav-pager");
                 if (navPager.length > 0) {
@@ -735,17 +729,15 @@ function modifySubmitButton (lookupDiv)
                                     cellElement.href = "javascript:lookupAjaxRequest('" + liSub + "')";
                                 }
                             }
-                            
                         }
                     }
-                }
-                
+                }                
             }
         }
     }
 }
 /**
- * Createan ajax Request
+ * Create an ajax Request
  */
 function lookupAjaxRequest(request) {
     lookupDiv = (GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).divRef);
@@ -811,7 +803,7 @@ function lookupFormAjaxRequest(formActio
 
             lookupCont.insert({
                 bottom: "" + formRequest + ""
-            });
+            });          
             GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).contentRef = lookupCont;
             modifySubmitButton(lookupDiv);
         }
@@ -873,10 +865,10 @@ function setSourceColor(src) {
 // function passing selected value to calling window
 function set_value (value) {
     if(GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP)){
-    obj_caller.target = $(GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).parentTarget);
+        obj_caller.target = $(GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).parentTarget);
     }
     else{
-    obj_caller.target = obj_caller.targetW;        
+        obj_caller.target = obj_caller.targetW;
     }    
     var target = obj_caller.target;
     
@@ -887,10 +879,10 @@ function set_value (value) {
 // function passing selected value to calling window
 function set_values (value, value2) {
     if(GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP)){
-    obj_caller.target = $(GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).parentTarget.id);
+        obj_caller.target = $(GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).parentTarget.id);
     }
     else{
-    obj_caller.target = obj_caller.targetW;        
+        obj_caller.target = obj_caller.targetW;        
     }
     var target = obj_caller.target;
     var target2 = obj_caller.target2;