mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
10982: Merged V2.1 to V2.2 10273: Fix for ETWOONE-317: Error from regenerate renditions wizard when templates are updated 10985: Merged V2.1 to V2.2 10717: Fix for ETWOONE-14: System Error message appears while clicking 'Manage Task' icon in ... 10742: Fix for ETWOONE-119: A user created with space characters at the begin and at the end can't login 10758: Fix for ETWOONE-183: URL addressability of forum spaces and topics 10760: Fix for ETWOONE-339: URL Addressability to discussions causes display issue 10761: Fix for ETWOONE-196: Attempt to post to the same forum by two or more users simultaneously leads to error appearance and impossibility to post for some of them 10772: Fix for ETWOONE-225: Validation.js does not properly handle trailing whitespace 10986: Added Hibernate src to Eclipse project 11004: Remove annoying exceptions on shutdown 11005: Minor javadoc fix 11012: Fixed ETWOTWO-423: Optionally inject the Open Office document converter instance to the transformer git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11202 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -98,7 +98,7 @@ function validateRegex(control, expression, requiresMatch, matchMessage, noMatch
|
||||
{
|
||||
var result = true;
|
||||
|
||||
var pattern = new RegExp(unescape(expression));
|
||||
var pattern = new RegExp(decode(expression));
|
||||
var matches = pattern.test(control.value);
|
||||
|
||||
if (matches != requiresMatch)
|
||||
@@ -135,4 +135,104 @@ function validateName(control, message, showMessage)
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the given string
|
||||
*
|
||||
* @param str The string to decode
|
||||
* @return The decoded string
|
||||
*/
|
||||
function decode(str)
|
||||
{
|
||||
var s0, i, j, s, ss, u, n, f;
|
||||
|
||||
s0 = ""; // decoded str
|
||||
|
||||
for (i = 0; i < str.length; i++)
|
||||
{
|
||||
// scan the source str
|
||||
s = str.charAt(i);
|
||||
|
||||
if (s == "+")
|
||||
{
|
||||
// "+" should be changed to SP
|
||||
s0 += " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s != "%")
|
||||
{
|
||||
// add an unescaped char
|
||||
s0 += s;
|
||||
}
|
||||
else
|
||||
{
|
||||
// escape sequence decoding
|
||||
u = 0; // unicode of the character
|
||||
|
||||
f = 1; // escape flag, zero means end of this sequence
|
||||
|
||||
while (true)
|
||||
{
|
||||
ss = ""; // local str to parse as int
|
||||
for (j = 0; j < 2; j++ )
|
||||
{
|
||||
// get two maximum hex characters for parse
|
||||
sss = str.charAt(++i);
|
||||
|
||||
if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f")) || ((sss >= "A") && (sss <= "F")))
|
||||
{
|
||||
ss += sss; // if hex, add the hex character
|
||||
}
|
||||
else
|
||||
{
|
||||
// not a hex char., exit the loop
|
||||
--i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// parse the hex str as byte
|
||||
n = parseInt(ss, 16);
|
||||
|
||||
// single byte format
|
||||
if (n <= 0x7f) { u = n; f = 1; }
|
||||
|
||||
// double byte format
|
||||
if ((n >= 0xc0) && (n <= 0xdf)) { u = n & 0x1f; f = 2; }
|
||||
|
||||
// triple byte format
|
||||
if ((n >= 0xe0) && (n <= 0xef)) { u = n & 0x0f; f = 3; }
|
||||
|
||||
// quaternary byte format (extended)
|
||||
if ((n >= 0xf0) && (n <= 0xf7)) { u = n & 0x07; f = 4; }
|
||||
|
||||
// not a first, shift and add 6 lower bits
|
||||
if ((n >= 0x80) && (n <= 0xbf)) { u = (u << 6) + (n & 0x3f); --f; }
|
||||
|
||||
// end of the utf byte sequence
|
||||
if (f <= 1) { break; }
|
||||
|
||||
if (str.charAt(i + 1) == "%")
|
||||
{
|
||||
// test for the next shift byte
|
||||
i++ ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// abnormal, format error
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// add the escaped character
|
||||
s0 += String.fromCharCode(u);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s0;
|
||||
|
||||
}
|
Reference in New Issue
Block a user