svn commit: r1000587 - in /ofbiz/branches/jquery/framework: common/webcommon/WEB-INF/ common/webcommon/includes/ common/widget/ images/webapp/images/

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

svn commit: r1000587 - in /ofbiz/branches/jquery/framework: common/webcommon/WEB-INF/ common/webcommon/includes/ common/widget/ images/webapp/images/

jleroux@apache.org
Author: jleroux
Date: Thu Sep 23 19:17:30 2010
New Revision: 1000587

URL: http://svn.apache.org/viewvc?rev=1000587&view=rev
Log:
Merges the trunk at r1000586

Later I will create an AjaxFunctions.js where I will put all of them (geDependentDropDown, selectMultipleRelatedValues.js, selectall.js, etc.).
I think I will not do that in trunk, not sure because not doing it will be maybe more merging work :/

Added:
    ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl
      - copied, changed from r1000113, ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl
    ofbiz/branches/jquery/framework/images/webapp/images/selectMultipleRelatedValues.js   (with props)
Removed:
    ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl
Modified:
    ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/common-controller.xml
    ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml

Modified: ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/common-controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/common-controller.xml?rev=1000587&r1=1000586&r2=1000587&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/common-controller.xml (original)
+++ ofbiz/branches/jquery/framework/common/webcommon/WEB-INF/common-controller.xml Thu Sep 23 19:17:30 2010
@@ -218,13 +218,14 @@ under the License.
         <response name="success" type="request" value="json"/>
         <response name="error" type="request" value="json"/>
     </request-map>
-
+    
     <request-map uri="getRelatedGeos">
         <security https="true" auth="true"/>
         <event type="service" invoke="getRelatedGeos"/>
         <response name="success" type="request" value="json"/>
         <response name="error" type="request" value="json"/>
     </request-map>
+    
     <!--========================== AJAX events =====================-->
 
     <!-- View Mappings -->

Copied: ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl (from r1000113, ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl)
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl?p2=ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl&p1=ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl&r1=1000113&r2=1000587&rev=1000587&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/common/webcommon/includes/setMutipleSelectJs.ftl (original)
+++ ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl Thu Sep 23 19:17:30 2010
@@ -19,25 +19,25 @@ under the License.
 <script type="text/javascript">
   jQuery(document).ready(function() {
 
-    jQuery("#${multipleSelectForm}_${multipleSelect}").asmSelect({
+    // use asmSelect
+    jQuery("#${multipleSelect}").asmSelect({
       addItemTarget: 'top',
       sortable: ${sortable},
       removeLabel: '${uiLabelMap.CommonRemove}'
     });
-
-    // track changes with our own event
-    jQuery("#${multipleSelect}").change(function(e, data) {
-      // if it's a sort or an add, then give it a little color animation to highlight it
-      if(data.type != 'drop') data.item.animate({ 'backgroundColor': '#ffffcc' }, 20, 'linear', function() {
-        data.item.animate({ 'backgroundColor': '#dddddd' }, 500);
-      });
-    });
-
+    
+    // track possible relatedField changes
+    if (jQuery('#${multipleSelectForm}')) {
+      // on initial focus or if the field value changes, select related multi values.
+      // FIXME : not sure why focus does not work here, must be added as event/action in the multipleSelectForm.relatedField
+      jQuery("#${relatedField}").bind('change focus', function() {
+        selectMultipleRelatedValues('${requestName}', '${paramKey}', '${relatedField}', '${multipleSelect}', '${type}', '${typeValue}', '${responseName}');
+      });
+    }
   });
 </script>
 
 <style type="text/css">
-
 #${multipleSelectForm} {
     width: ${formSize}px;
     position: relative;
@@ -46,4 +46,4 @@ under the License.
 .asmListItem {
   width: ${asmListItemPercentOfForm}%;
 }
-</style>
+</style>
\ No newline at end of file

Modified: ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml?rev=1000587&r1=1000586&r2=1000587&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml (original)
+++ ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml Thu Sep 23 19:17:30 2010
@@ -130,7 +130,8 @@ under the License.
                 <set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true"/>
                 <set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/>
                 <set field="layoutSettings.javaScripts[]" value="/images/GooglemapMarkers.js" global="true"/>
-                <set field="layoutSettings.javaScripts[]" value="/images/getDependentDropdownValues.js" global="true"/>                
+                <set field="layoutSettings.javaScripts[]" value="/images/getDependentDropdownValues.js" global="true"/>
+                <set field="layoutSettings.javaScripts[]" value="/images/selectMultipleRelatedValues.js" global="true"/>                                                                        
                 <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/prototype.js" global="true"/>
                 
                     <!-- Prototype temporarily re-added to avoid issues while working with jQuery Branch-->

Added: ofbiz/branches/jquery/framework/images/webapp/images/selectMultipleRelatedValues.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/selectMultipleRelatedValues.js?rev=1000587&view=auto
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/selectMultipleRelatedValues.js (added)
+++ ofbiz/branches/jquery/framework/images/webapp/images/selectMultipleRelatedValues.js Thu Sep 23 19:17:30 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+// *** selectMultipleRelatedValues:  Select multi related values
+// request      = request calling the service which retrieve the info from the DB, ex: getAssociatedStateList
+// paramKey     = parameter value used in the called service
+// paramField   = parent dropdown field Id
+// targetField  = dependend dropdown field Id
+// type         = type of values to retrieve
+// typeValue    = value of type to retrieve
+// responseName = result returned by the service (using a standard json response, ie chaining json request)
+
+function selectMultipleRelatedValues(request, paramKey, paramField, targetField, type, typeValue, responseName) {
+    data = [ { name: paramKey, value: jQuery('#' + paramField).val()}, { name: type, value: typeValue} ];  // get requested value from parent dropdown field
+    list = jQuery.post(request, data, function(result) {
+        selectedOptions = result[responseName];
+        jQuery("#" + targetField).val(selectedOptions).click().change(); // .change() for asmselect, .click() specifically for IE8
+    }, 'json');
+}

Propchange: ofbiz/branches/jquery/framework/images/webapp/images/selectMultipleRelatedValues.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/jquery/framework/images/webapp/images/selectMultipleRelatedValues.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/branches/jquery/framework/images/webapp/images/selectMultipleRelatedValues.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain