Author: trong.tran
Date: 2011-10-18 00:40:20 -0400 (Tue, 18 Oct 2011)
New Revision: 7762
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUserSelector.js
portal/trunk/web/portal/src/main/webapp/groovy/webui/organization/account/UIUserSelector.gtmpl
Log:
GTNPORTAL-2180 Javascript popup error when using UIUserSelector
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUserSelector.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUserSelector.js 2011-10-18
04:34:01 UTC (rev 7761)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUserSelector.js 2011-10-18
04:40:20 UTC (rev 7762)
@@ -102,30 +102,21 @@
}
return keynum ;
} ;
+
/**
- * Process event when user presses a key
- * @param {Object} evt event
+ * Return true if the key pressed is the Enter.
+ * Otherwise return false.
*/
-UIUserSelector.prototype.captureInput = function(input, action) {
- if(typeof(input) == "string") input = document.getElementById(input) ;
- input.form.onsubmit = eXo.webui.UIUserSelector.cancelSubmit ;
- input.onkeypress= eXo.webui.UIUserSelector.onEnter ;
-} ;
-/**
- * Process event when user presses a Enter key
- * @param {Object} evt event
- */
-UIUserSelector.prototype.onEnter = function(evt) {
+UIUserSelector.prototype.isEnterPress = function(evt) {
var _e = evt || window.event ;
- _e.cancelBubble = true ;
var keynum = eXo.webui.UIUserSelector.getKeynum(_e) ;
- if (keynum == 13) {
- var action = eXo.core.DOMUtil.findNextElementByTagName(this, "a");
- if(!action) action = eXo.core.DOMUtil.findPreviousElementByTagName(this, "a")
;
- action =
String(action.href).replace("javascript:","").replace("%20","")
;
- eval(action) ;
+ if (keynum == 13)
+ {
+ return true;
}
+ return false;
} ;
+
/**
* Cancel submit action
*/
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/webui/organization/account/UIUserSelector.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/webui/organization/account/UIUserSelector.gtmpl 2011-10-18
04:34:01 UTC (rev 7761)
+++
portal/trunk/web/portal/src/main/webapp/groovy/webui/organization/account/UIUserSelector.gtmpl 2011-10-18
04:40:20 UTC (rev 7762)
@@ -5,8 +5,16 @@
def rcontext = _ctx.getRequestContext();
boolean isMulti = uicomponent.getMulti();
rcontext.getJavascriptManager().addJavascript('eXo.webui.UIUserSelector.init("'+uiform.id+'");
');
-
rcontext.getJavascriptManager().addJavascript('eXo.webui.UIUserSelector.captureInput("'+uiform.FIELD_KEYWORD+'","'+uicomponent.event('Search')+'");
');
- if(uicomponent.isShowSearchGroup())
rcontext.getJavascriptManager().addJavascript('eXo.webui.UIUserSelector.captureInput("'+uiform.FIELD_GROUP+'","'+uicomponent.event('FindGroup',uicomponent.getSelectedGroup())+'");
');
+
+ String js = "if (eXo.webui.UIUserSelector.isEnterPress(event)) {" +
uicomponent.event('Search') + "; return false;}";
+ uiform.getUIStringInput(uiform.FIELD_KEYWORD).setHTMLAttribute("onkeypress",
js);
+
+ if(uicomponent.isShowSearchGroup())
+ {
+ js = "if (eXo.webui.UIUserSelector.isEnterPress(event)) {" +
uicomponent.event('FindGroup',uicomponent.getSelectedGroup()) + "; return
false;}";
+ uiform.getUIStringInput(uiform.FIELD_GROUP).setHTMLAttribute("onkeypress",
js);
+ }
+
%>
<div class="UIUserSelector">
<div class="SelectUserContainer">
Show replies by date