You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/02/09 23:17:32 UTC

svn commit: r376456 - in /incubator/tobago/trunk/tobago-theme: tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/s...

Author: weber
Date: Thu Feb  9 14:17:18 2006
New Revision: 376456

URL: http://svn.apache.org/viewcvs?rev=376456&view=rev
Log:
cleanup autocomplete javacript code

Modified:
    incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
    incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js

Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java?rev=376456&r1=376455&r2=376456&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java Thu Feb  9 14:17:18 2006
@@ -134,15 +134,12 @@
     if (renderAjaxSuggest) {
 
       String popupId = id + SUBCOMPONENT_SEP + "ajaxPopup";
-      String viewId = facesContext.getViewRoot().getViewId();
-      ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
-      String actionURL = viewHandler.getActionURL(facesContext, viewId);
 
       final UIPage page = ComponentUtil.findPage(input);
-//      page.getScriptFiles().add("script/effects.js");
-//      page.getScriptFiles().add("script/dragdrop.js");
-//      page.getScriptFiles().add("script/controls.js");
-//      page.getScriptFiles().add("script/inputSuggest.js");
+      page.getScriptFiles().add("script/effects.js");
+      page.getScriptFiles().add("script/dragdrop.js");
+      page.getScriptFiles().add("script/controls.js");
+      page.getScriptFiles().add("script/inputSuggest.js");
 
       writer.startElement("div");
       writer.writeClassAttribute("tobago-in-suggest-popup");
@@ -156,13 +153,6 @@
           "script/controls.js",
           "script/inputSuggest.js"
       };
-      String function = "return entry";
-      if (facesContext.getApplication().getStateManager().isSavingStateInClient(facesContext)) {
-        function +=
-            "+'&jsf_tree_64='+encodeURIComponent($('jsf_tree_64').value)"
-                + "+'&jsf_state_64='+encodeURIComponent($('jsf_state_64').value)"
-                + "+'&jsf_viewid='+encodeURIComponent($('jsf_viewid').value)";
-      }
 
       final String[] cmds = {
           "new Tobago.Autocompleter(",
@@ -170,25 +160,11 @@
           "    '" + page.getClientId(facesContext) + "',",
           "    { method:       'post',",
           "      asynchronous: true,",
-          "      parameters: '',",
-          "      callback: function(element,entry) {" + function + ";}",
+          "      parameters: ''",
           "    });"
       };
 
       HtmlRendererUtil.writeScriptLoader(facesContext, scripts, cmds);
-
-//      HtmlRendererUtil.startJavascript(writer);
-//
-//      writer.writeText("{\n", null);
-//      writer.writeText("  var suggestDiv = document.getElementById('" + popupId + "');\n", null);
-//      writer.writeText("  var suggestParent = suggestDiv.parentNode;\n", null);
-//      writer.writeText("  var bodyNode = document.getElementById('" + page.getClientId(facesContext) + "');\n", null);
-//      writer.writeText("  suggestParent.removeChild(suggestDiv);\n", null);
-//      writer.writeText("  bodyNode.appendChild(suggestDiv);\n", null);
-//      writer.writeText("}\n", null);
-//
-//      HtmlRendererUtil.endJavascript(writer);
-
     }
 
   }
@@ -199,7 +175,7 @@
         org.apache.myfaces.tobago.component.UIInput.class);
 
 
-    org.apache.myfaces.tobago.component.UIInput input = 
+    org.apache.myfaces.tobago.component.UIInput input =
         (org.apache.myfaces.tobago.component.UIInput) uiComponent;
 
     MethodBinding mb;

Modified: incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js?rev=376456&r1=376455&r2=376456&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js (original)
+++ incubator/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js Thu Feb  9 14:17:18 2006
@@ -48,16 +48,16 @@
   },
 
   getUpdatedChoices: function() {
-    entry = encodeURIComponent(this.element.name) + '=' 
-        + encodeURIComponent(this.getToken());
-
-    this.options.parameters = this.options.callback
-        ? this.options.callback(this.element, entry) : entry;
+    // TODO: add client-side state to parameters
+    // TODO: this also needs updating state on client after getting response
+    this.options.parameters =
+        "affectedAjaxComponent=" + encodeURIComponent(this.element.id)
+        + "&" + encodeURIComponent(this.element.name) + '='
+        + encodeURIComponent(this.element.value);
 
     var form = Tobago.getFormElement(this.page);
-    var url = form.action + "?affectedAjaxComponent=" + this.element.id;
     LOG.debug("start new request");
-    new Ajax.Request(url, this.options);
+    new Ajax.Request(form.action, this.options);
   },
 
   onComplete: function(request) {