mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
multibyte content fixes for forms ui.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5084 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -42,32 +42,34 @@ public class AjaxServlet extends BaseServlet
|
|||||||
/**
|
/**
|
||||||
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||||
*/
|
*/
|
||||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
protected void service(final HttpServletRequest request,
|
||||||
|
final HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
|
request.setCharacterEncoding("utf-8");
|
||||||
|
|
||||||
long startTime = 0;
|
long startTime = 0;
|
||||||
|
String uri = request.getRequestURI();
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
final String queryString = request.getQueryString();
|
||||||
|
logger.debug("Processing URL: " + uri +
|
||||||
|
((queryString != null && queryString.length() > 0) ? ("?" + queryString) : ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
// dump the request headers
|
||||||
|
if (headersLogger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
final Enumeration headers = request.getHeaderNames();
|
||||||
|
while (headers.hasMoreElements())
|
||||||
|
{
|
||||||
|
final String name = (String)headers.nextElement();
|
||||||
|
headersLogger.debug(name + ": " + request.getHeader(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String uri = request.getRequestURI();
|
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
String queryString = request.getQueryString();
|
|
||||||
logger.debug("Processing URL: " + uri +
|
|
||||||
((queryString != null && queryString.length() > 0) ? ("?" + queryString) : ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
// dump the request headers
|
|
||||||
if (headersLogger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
Enumeration headers = request.getHeaderNames();
|
|
||||||
while (headers.hasMoreElements())
|
|
||||||
{
|
|
||||||
String name = (String)headers.nextElement();
|
|
||||||
headersLogger.debug(name + ": " + request.getHeader(name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure the user is authenticated, if not throw an error to return the
|
// Make sure the user is authenticated, if not throw an error to return the
|
||||||
// 500 Internal Server Error code back to the client
|
// 500 Internal Server Error code back to the client
|
||||||
@@ -86,12 +88,12 @@ public class AjaxServlet extends BaseServlet
|
|||||||
throw new AlfrescoRuntimeException("Servlet URL did not contain all required args: " + uri);
|
throw new AlfrescoRuntimeException("Servlet URL did not contain all required args: " + uri);
|
||||||
}
|
}
|
||||||
// retrieve the command from the URL
|
// retrieve the command from the URL
|
||||||
String commandName = tokens[1];
|
final String commandName = tokens[1];
|
||||||
// retrieve the binding expression from the URL
|
// retrieve the binding expression from the URL
|
||||||
String expression = tokens[2];
|
final String expression = tokens[2];
|
||||||
|
|
||||||
// setup the faces context
|
// setup the faces context
|
||||||
FacesContext facesContext = FacesHelper.getFacesContext(request, response, getServletContext());
|
final FacesContext facesContext = FacesHelper.getFacesContext(request, response, getServletContext());
|
||||||
|
|
||||||
// start a timer
|
// start a timer
|
||||||
if (perfLogger.isDebugEnabled())
|
if (perfLogger.isDebugEnabled())
|
||||||
@@ -124,8 +126,7 @@ public class AjaxServlet extends BaseServlet
|
|||||||
// measure the time taken
|
// measure the time taken
|
||||||
if (perfLogger.isDebugEnabled())
|
if (perfLogger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
long endTime = System.currentTimeMillis();
|
perfLogger.debug("Time to execute command: " + (System.currentTimeMillis() - startTime) + "ms");
|
||||||
perfLogger.debug("Time to execute command: " + (endTime - startTime) + "ms");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -467,7 +467,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
// put the content of the file into the AVM store
|
// put the content of the file into the AVM store
|
||||||
avmService.createFile(path,
|
avmService.createFile(path,
|
||||||
fileName,
|
fileName,
|
||||||
new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes()));
|
new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes("UTF-8")));
|
||||||
|
|
||||||
// remember the created path
|
// remember the created path
|
||||||
this.createdPath = AVMNodeConverter.ExtendAVMPath(path, fileName);
|
this.createdPath = AVMNodeConverter.ExtendAVMPath(path, fileName);
|
||||||
|
@@ -116,7 +116,7 @@ public class XMLUtil
|
|||||||
throws SAXException,
|
throws SAXException,
|
||||||
IOException
|
IOException
|
||||||
{
|
{
|
||||||
return XMLUtil.parse(new ByteArrayInputStream(source.getBytes()));
|
return XMLUtil.parse(new ByteArrayInputStream(source.getBytes("UTF-8")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** utility function for parsing xml */
|
/** utility function for parsing xml */
|
||||||
|
@@ -315,7 +315,7 @@ public class XFormsBean
|
|||||||
final ChibaBean chibaBean = this.xformsSession.chibaBean;
|
final ChibaBean chibaBean = this.xformsSession.chibaBean;
|
||||||
if (chibaBean.getContainer().lookup(id) instanceof Upload)
|
if (chibaBean.getContainer().lookup(id) instanceof Upload)
|
||||||
{
|
{
|
||||||
chibaBean.updateControlValue(id, null, value, value.getBytes());
|
chibaBean.updateControlValue(id, null, value, value.getBytes("UTF-8"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
//
|
//
|
||||||
// Initiliaze dojo requirements, tinymce, and add a hook to load the xform.
|
// Initiliaze dojo requirements, tinymce, and add a hook to load the xform.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
djConfig.bindEncoding = "UTF-8";
|
||||||
dojo.require("dojo.debug.console");
|
dojo.require("dojo.debug.console");
|
||||||
dojo.require("dojo.date.common");
|
dojo.require("dojo.date.common");
|
||||||
dojo.require("dojo.widget.DebugConsole");
|
dojo.require("dojo.widget.DebugConsole");
|
||||||
@@ -52,7 +53,7 @@ tinyMCE.init({
|
|||||||
width: -1,
|
width: -1,
|
||||||
auto_resize: false,
|
auto_resize: false,
|
||||||
force_p_newlines: false,
|
force_p_newlines: false,
|
||||||
encoding: null,
|
encoding: "UTF-8",
|
||||||
add_unload_trigger: false,
|
add_unload_trigger: false,
|
||||||
add_form_submit_trigger: false,
|
add_form_submit_trigger: false,
|
||||||
theme_advanced_toolbar_location: "top",
|
theme_advanced_toolbar_location: "top",
|
||||||
@@ -500,8 +501,6 @@ dojo.declare("alfresco.xforms.Widget",
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of RepeatIndexDatas corresponding to all enclosing repeats.
|
|
||||||
* The closest repeat will be at index 0.
|
|
||||||
*/
|
*/
|
||||||
getParentGroups: function(appearance)
|
getParentGroups: function(appearance)
|
||||||
{
|
{
|
||||||
@@ -756,6 +755,7 @@ dojo.declare("alfresco.xforms.PlainTextEditor",
|
|||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// overridden methods
|
// overridden methods
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
render: function(attach_point)
|
render: function(attach_point)
|
||||||
{
|
{
|
||||||
attach_point.appendChild(this.domNode);
|
attach_point.appendChild(this.domNode);
|
||||||
@@ -2972,32 +2972,7 @@ dojo.declare("alfresco.xforms.Submit",
|
|||||||
submit_buttons[i].widget = this;
|
submit_buttons[i].widget = this;
|
||||||
dojo.event.browser.addListener(submit_buttons[i],
|
dojo.event.browser.addListener(submit_buttons[i],
|
||||||
"onclick",
|
"onclick",
|
||||||
function(event)
|
this._submitButton_clickHandler,
|
||||||
{
|
|
||||||
if (!event.target.widget)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var xform = event.target.widget.xform;
|
|
||||||
if (xform.submitWidget && xform.submitWidget.done)
|
|
||||||
{
|
|
||||||
dojo.debug("done - doing base click on " + xform.submitWidget.currentButton.id);
|
|
||||||
xform.submitWidget.currentButton = null;
|
|
||||||
xform.submitWidget = null;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dojo.debug("triggering submit from handler " + event.target.id);
|
|
||||||
dojo.event.browser.stopEvent(event);
|
|
||||||
_hide_errors();
|
|
||||||
xform.submitWidget = event.target.widget;
|
|
||||||
xform.submitWidget.currentButton = event.target;
|
|
||||||
xform.submitWidget.widget.buttonClick();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3012,6 +2987,34 @@ dojo.declare("alfresco.xforms.Submit",
|
|||||||
this.done = false;
|
this.done = false;
|
||||||
_hide_errors();
|
_hide_errors();
|
||||||
this.fire();
|
this.fire();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** */
|
||||||
|
_submitButton_clickHandler: function(event)
|
||||||
|
{
|
||||||
|
if (!event.target.widget)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var xform = event.target.widget.xform;
|
||||||
|
if (xform.submitWidget && xform.submitWidget.done)
|
||||||
|
{
|
||||||
|
dojo.debug("done - doing base click on " + xform.submitWidget.currentButton.id);
|
||||||
|
xform.submitWidget.currentButton = null;
|
||||||
|
xform.submitWidget = null;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dojo.debug("triggering submit from handler " + event.target.id);
|
||||||
|
dojo.event.browser.stopEvent(event);
|
||||||
|
_hide_errors();
|
||||||
|
xform.submitWidget = event.target.widget;
|
||||||
|
xform.submitWidget.currentButton = event.target;
|
||||||
|
xform.submitWidget.widget.buttonClick();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3104,7 +3107,6 @@ dojo.declare("alfresco.xforms.Binding",
|
|||||||
(_hasAttribute(this.xformsNode, alfresco_xforms_constants.XFORMS_PREFIX + ":required")
|
(_hasAttribute(this.xformsNode, alfresco_xforms_constants.XFORMS_PREFIX + ":required")
|
||||||
? this.xformsNode.getAttribute(alfresco_xforms_constants.XFORMS_PREFIX + ":required") == "true()"
|
? this.xformsNode.getAttribute(alfresco_xforms_constants.XFORMS_PREFIX + ":required") == "true()"
|
||||||
: null);
|
: null);
|
||||||
|
|
||||||
this._type =
|
this._type =
|
||||||
(_hasAttribute(this.xformsNode, alfresco_xforms_constants.XFORMS_PREFIX + ":type")
|
(_hasAttribute(this.xformsNode, alfresco_xforms_constants.XFORMS_PREFIX + ":type")
|
||||||
? this.xformsNode.getAttribute(alfresco_xforms_constants.XFORMS_PREFIX + ":type")
|
? this.xformsNode.getAttribute(alfresco_xforms_constants.XFORMS_PREFIX + ":type")
|
||||||
@@ -3748,6 +3750,7 @@ AjaxHelper.createRequest = function(target, serverMethod, methodArgs, load, erro
|
|||||||
AjaxHelper.sendRequest = function(req)
|
AjaxHelper.sendRequest = function(req)
|
||||||
{
|
{
|
||||||
AjaxHelper._sendHandler(req);
|
AjaxHelper._sendHandler(req);
|
||||||
|
req.encoding = "utf-8";
|
||||||
dojo.io.queueBind(req);
|
dojo.io.queueBind(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4012,10 +4015,12 @@ FilePickerWidget._upload_completeHandler = function(id, path, fileName, fileType
|
|||||||
// instance methods and properties
|
// instance methods and properties
|
||||||
|
|
||||||
FilePickerWidget.prototype = {
|
FilePickerWidget.prototype = {
|
||||||
|
|
||||||
getValue: function()
|
getValue: function()
|
||||||
{
|
{
|
||||||
return this.value;
|
return this.value;
|
||||||
},
|
},
|
||||||
|
|
||||||
setValue: function(v)
|
setValue: function(v)
|
||||||
{
|
{
|
||||||
this.value = (v == null || v.length == 0 ? null : v);
|
this.value = (v == null || v.length == 0 ? null : v);
|
||||||
@@ -4026,6 +4031,7 @@ setValue: function(v)
|
|||||||
|
|
||||||
this.change_callback(this);
|
this.change_callback(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
setReadonly: function(r)
|
setReadonly: function(r)
|
||||||
{
|
{
|
||||||
this.readonly = r;
|
this.readonly = r;
|
||||||
@@ -4038,10 +4044,12 @@ setReadonly: function(r)
|
|||||||
this._showSelectedValue();
|
this._showSelectedValue();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function()
|
render: function()
|
||||||
{
|
{
|
||||||
this._showSelectedValue();
|
this._showSelectedValue();
|
||||||
},
|
},
|
||||||
|
|
||||||
_showStatus: function(text, isError)
|
_showStatus: function(text, isError)
|
||||||
{
|
{
|
||||||
var d = this.node.ownerDocument;
|
var d = this.node.ownerDocument;
|
||||||
@@ -4069,6 +4077,7 @@ _showStatus: function(text, isError)
|
|||||||
setTimeout("var _status = document.getElementById('" + this.uploadId +
|
setTimeout("var _status = document.getElementById('" + this.uploadId +
|
||||||
"-status'); if (_status && _status) { _status.widget._hideStatus(); }", 5000);
|
"-status'); if (_status && _status) { _status.widget._hideStatus(); }", 5000);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideStatus: function()
|
_hideStatus: function()
|
||||||
{
|
{
|
||||||
if (this.statusDiv)
|
if (this.statusDiv)
|
||||||
@@ -4091,6 +4100,7 @@ _hideStatus: function()
|
|||||||
anim.play();
|
anim.play();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showSelectedValue: function()
|
_showSelectedValue: function()
|
||||||
{
|
{
|
||||||
var d = this.node.ownerDocument;
|
var d = this.node.ownerDocument;
|
||||||
@@ -4150,6 +4160,7 @@ _navigateToNode: function(path)
|
|||||||
req.content.currentPath = path;
|
req.content.currentPath = path;
|
||||||
AjaxHelper.sendRequest(req);
|
AjaxHelper.sendRequest(req);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showPicker: function(data)
|
_showPicker: function(data)
|
||||||
{
|
{
|
||||||
while (this.node.hasChildNodes() &&
|
while (this.node.hasChildNodes() &&
|
||||||
@@ -4341,6 +4352,7 @@ _showPicker: function(data)
|
|||||||
this.contentDiv.appendChild(row);
|
this.contentDiv.appendChild(row);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_createRow: function(fileName, webappRelativePath, isDirectory, fileTypeImage, rowClass)
|
_createRow: function(fileName, webappRelativePath, isDirectory, fileTypeImage, rowClass)
|
||||||
{
|
{
|
||||||
var d = this.contentDiv.ownerDocument;
|
var d = this.contentDiv.ownerDocument;
|
||||||
@@ -4417,6 +4429,7 @@ _createRow: function(fileName, webappRelativePath, isDirectory, fileTypeImage,
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideAddContent: function()
|
_hideAddContent: function()
|
||||||
{
|
{
|
||||||
if (this.addContentDiv)
|
if (this.addContentDiv)
|
||||||
@@ -4426,6 +4439,7 @@ _hideAddContent: function()
|
|||||||
this.addContentDiv = null;
|
this.addContentDiv = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showAddContent: function(currentPath)
|
_showAddContent: function(currentPath)
|
||||||
{
|
{
|
||||||
if (this.addContentDiv)
|
if (this.addContentDiv)
|
||||||
@@ -4490,6 +4504,7 @@ _showAddContent: function(currentPath)
|
|||||||
w);
|
w);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_upload_completeHandler: function(fileName, webappRelativePath, fileTypeImage, error)
|
_upload_completeHandler: function(fileName, webappRelativePath, fileTypeImage, error)
|
||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
@@ -4515,6 +4530,7 @@ _upload_completeHandler: function(fileName, webappRelativePath, fileTypeImage, e
|
|||||||
this.addContentDiv = null;
|
this.addContentDiv = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeParentPathMenu: function()
|
_closeParentPathMenu: function()
|
||||||
{
|
{
|
||||||
if (this.parentPathMenu)
|
if (this.parentPathMenu)
|
||||||
@@ -4525,6 +4541,7 @@ _closeParentPathMenu: function()
|
|||||||
}
|
}
|
||||||
this.headerMenuTriggerLink.style.borderStyle = "solid";
|
this.headerMenuTriggerLink.style.borderStyle = "solid";
|
||||||
},
|
},
|
||||||
|
|
||||||
_openParentPathMenu: function(target, path)
|
_openParentPathMenu: function(target, path)
|
||||||
{
|
{
|
||||||
var d = target.ownerDocument;
|
var d = target.ownerDocument;
|
||||||
|
Reference in New Issue
Block a user