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,18 +42,17 @@ public class AjaxServlet extends BaseServlet
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
request.setCharacterEncoding("utf-8");
|
||||
|
||||
long startTime = 0;
|
||||
|
||||
try
|
||||
{
|
||||
String uri = request.getRequestURI();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
String queryString = request.getQueryString();
|
||||
final String queryString = request.getQueryString();
|
||||
logger.debug("Processing URL: " + uri +
|
||||
((queryString != null && queryString.length() > 0) ? ("?" + queryString) : ""));
|
||||
}
|
||||
@@ -61,14 +60,17 @@ public class AjaxServlet extends BaseServlet
|
||||
// dump the request headers
|
||||
if (headersLogger.isDebugEnabled())
|
||||
{
|
||||
Enumeration headers = request.getHeaderNames();
|
||||
final Enumeration headers = request.getHeaderNames();
|
||||
while (headers.hasMoreElements())
|
||||
{
|
||||
String name = (String)headers.nextElement();
|
||||
final String name = (String)headers.nextElement();
|
||||
headersLogger.debug(name + ": " + request.getHeader(name));
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// Make sure the user is authenticated, if not throw an error to return the
|
||||
// 500 Internal Server Error code back to the client
|
||||
AuthenticationStatus status = servletAuthenticate(request, response, false);
|
||||
@@ -86,12 +88,12 @@ public class AjaxServlet extends BaseServlet
|
||||
throw new AlfrescoRuntimeException("Servlet URL did not contain all required args: " + uri);
|
||||
}
|
||||
// retrieve the command from the URL
|
||||
String commandName = tokens[1];
|
||||
final String commandName = tokens[1];
|
||||
// retrieve the binding expression from the URL
|
||||
String expression = tokens[2];
|
||||
final String expression = tokens[2];
|
||||
|
||||
// setup the faces context
|
||||
FacesContext facesContext = FacesHelper.getFacesContext(request, response, getServletContext());
|
||||
final FacesContext facesContext = FacesHelper.getFacesContext(request, response, getServletContext());
|
||||
|
||||
// start a timer
|
||||
if (perfLogger.isDebugEnabled())
|
||||
@@ -124,8 +126,7 @@ public class AjaxServlet extends BaseServlet
|
||||
// measure the time taken
|
||||
if (perfLogger.isDebugEnabled())
|
||||
{
|
||||
long endTime = System.currentTimeMillis();
|
||||
perfLogger.debug("Time to execute command: " + (endTime - startTime) + "ms");
|
||||
perfLogger.debug("Time to execute command: " + (System.currentTimeMillis() - startTime) + "ms");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -467,7 +467,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
||||
// put the content of the file into the AVM store
|
||||
avmService.createFile(path,
|
||||
fileName,
|
||||
new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes()));
|
||||
new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes("UTF-8")));
|
||||
|
||||
// remember the created path
|
||||
this.createdPath = AVMNodeConverter.ExtendAVMPath(path, fileName);
|
||||
|
@@ -116,7 +116,7 @@ public class XMLUtil
|
||||
throws SAXException,
|
||||
IOException
|
||||
{
|
||||
return XMLUtil.parse(new ByteArrayInputStream(source.getBytes()));
|
||||
return XMLUtil.parse(new ByteArrayInputStream(source.getBytes("UTF-8")));
|
||||
}
|
||||
|
||||
/** utility function for parsing xml */
|
||||
|
@@ -315,7 +315,7 @@ public class XFormsBean
|
||||
final ChibaBean chibaBean = this.xformsSession.chibaBean;
|
||||
if (chibaBean.getContainer().lookup(id) instanceof Upload)
|
||||
{
|
||||
chibaBean.updateControlValue(id, null, value, value.getBytes());
|
||||
chibaBean.updateControlValue(id, null, value, value.getBytes("UTF-8"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -29,6 +29,7 @@
|
||||
//
|
||||
// Initiliaze dojo requirements, tinymce, and add a hook to load the xform.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
djConfig.bindEncoding = "UTF-8";
|
||||
dojo.require("dojo.debug.console");
|
||||
dojo.require("dojo.date.common");
|
||||
dojo.require("dojo.widget.DebugConsole");
|
||||
@@ -52,7 +53,7 @@ tinyMCE.init({
|
||||
width: -1,
|
||||
auto_resize: false,
|
||||
force_p_newlines: false,
|
||||
encoding: null,
|
||||
encoding: "UTF-8",
|
||||
add_unload_trigger: false,
|
||||
add_form_submit_trigger: false,
|
||||
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)
|
||||
{
|
||||
@@ -756,6 +755,7 @@ dojo.declare("alfresco.xforms.PlainTextEditor",
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// overridden methods
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
render: function(attach_point)
|
||||
{
|
||||
attach_point.appendChild(this.domNode);
|
||||
@@ -2972,7 +2972,25 @@ dojo.declare("alfresco.xforms.Submit",
|
||||
submit_buttons[i].widget = this;
|
||||
dojo.event.browser.addListener(submit_buttons[i],
|
||||
"onclick",
|
||||
function(event)
|
||||
this._submitButton_clickHandler,
|
||||
false);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// DOM event handlers
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
_clickHandler: function(event)
|
||||
{
|
||||
this.done = false;
|
||||
_hide_errors();
|
||||
this.fire();
|
||||
},
|
||||
|
||||
/** */
|
||||
_submitButton_clickHandler: function(event)
|
||||
{
|
||||
if (!event.target.widget)
|
||||
{
|
||||
@@ -2997,21 +3015,6 @@ dojo.declare("alfresco.xforms.Submit",
|
||||
xform.submitWidget.widget.buttonClick();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
false);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// DOM event handlers
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
_clickHandler: function(event)
|
||||
{
|
||||
this.done = false;
|
||||
_hide_errors();
|
||||
this.fire();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3104,7 +3107,6 @@ dojo.declare("alfresco.xforms.Binding",
|
||||
(_hasAttribute(this.xformsNode, alfresco_xforms_constants.XFORMS_PREFIX + ":required")
|
||||
? this.xformsNode.getAttribute(alfresco_xforms_constants.XFORMS_PREFIX + ":required") == "true()"
|
||||
: null);
|
||||
|
||||
this._type =
|
||||
(_hasAttribute(this.xformsNode, 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._sendHandler(req);
|
||||
req.encoding = "utf-8";
|
||||
dojo.io.queueBind(req);
|
||||
}
|
||||
|
||||
@@ -4012,10 +4015,12 @@ FilePickerWidget._upload_completeHandler = function(id, path, fileName, fileType
|
||||
// instance methods and properties
|
||||
|
||||
FilePickerWidget.prototype = {
|
||||
|
||||
getValue: function()
|
||||
{
|
||||
return this.value;
|
||||
},
|
||||
|
||||
setValue: function(v)
|
||||
{
|
||||
this.value = (v == null || v.length == 0 ? null : v);
|
||||
@@ -4026,6 +4031,7 @@ setValue: function(v)
|
||||
|
||||
this.change_callback(this);
|
||||
},
|
||||
|
||||
setReadonly: function(r)
|
||||
{
|
||||
this.readonly = r;
|
||||
@@ -4038,10 +4044,12 @@ setReadonly: function(r)
|
||||
this._showSelectedValue();
|
||||
}
|
||||
},
|
||||
|
||||
render: function()
|
||||
{
|
||||
this._showSelectedValue();
|
||||
},
|
||||
|
||||
_showStatus: function(text, isError)
|
||||
{
|
||||
var d = this.node.ownerDocument;
|
||||
@@ -4069,6 +4077,7 @@ _showStatus: function(text, isError)
|
||||
setTimeout("var _status = document.getElementById('" + this.uploadId +
|
||||
"-status'); if (_status && _status) { _status.widget._hideStatus(); }", 5000);
|
||||
},
|
||||
|
||||
_hideStatus: function()
|
||||
{
|
||||
if (this.statusDiv)
|
||||
@@ -4091,6 +4100,7 @@ _hideStatus: function()
|
||||
anim.play();
|
||||
}
|
||||
},
|
||||
|
||||
_showSelectedValue: function()
|
||||
{
|
||||
var d = this.node.ownerDocument;
|
||||
@@ -4150,6 +4160,7 @@ _navigateToNode: function(path)
|
||||
req.content.currentPath = path;
|
||||
AjaxHelper.sendRequest(req);
|
||||
},
|
||||
|
||||
_showPicker: function(data)
|
||||
{
|
||||
while (this.node.hasChildNodes() &&
|
||||
@@ -4341,6 +4352,7 @@ _showPicker: function(data)
|
||||
this.contentDiv.appendChild(row);
|
||||
}
|
||||
},
|
||||
|
||||
_createRow: function(fileName, webappRelativePath, isDirectory, fileTypeImage, rowClass)
|
||||
{
|
||||
var d = this.contentDiv.ownerDocument;
|
||||
@@ -4417,6 +4429,7 @@ _createRow: function(fileName, webappRelativePath, isDirectory, fileTypeImage,
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
_hideAddContent: function()
|
||||
{
|
||||
if (this.addContentDiv)
|
||||
@@ -4426,6 +4439,7 @@ _hideAddContent: function()
|
||||
this.addContentDiv = null;
|
||||
}
|
||||
},
|
||||
|
||||
_showAddContent: function(currentPath)
|
||||
{
|
||||
if (this.addContentDiv)
|
||||
@@ -4490,6 +4504,7 @@ _showAddContent: function(currentPath)
|
||||
w);
|
||||
});
|
||||
},
|
||||
|
||||
_upload_completeHandler: function(fileName, webappRelativePath, fileTypeImage, error)
|
||||
{
|
||||
if (error)
|
||||
@@ -4515,6 +4530,7 @@ _upload_completeHandler: function(fileName, webappRelativePath, fileTypeImage, e
|
||||
this.addContentDiv = null;
|
||||
}
|
||||
},
|
||||
|
||||
_closeParentPathMenu: function()
|
||||
{
|
||||
if (this.parentPathMenu)
|
||||
@@ -4525,6 +4541,7 @@ _closeParentPathMenu: function()
|
||||
}
|
||||
this.headerMenuTriggerLink.style.borderStyle = "solid";
|
||||
},
|
||||
|
||||
_openParentPathMenu: function(target, path)
|
||||
{
|
||||
var d = target.ownerDocument;
|
||||
|
Reference in New Issue
Block a user