From: artunit Date: Wed, 29 Sep 2010 03:51:42 +0000 (+0000) Subject: adding cocoon opensrf authentication setup X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fe2b9314ea0e0f0c093fda740075e949866509be;p=contrib%2FConifer.git adding cocoon opensrf authentication setup git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/branches/rel_1_6_1@1019 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/tools/authcon/README b/tools/authcon/README new file mode 100644 index 0000000000..6fa2838a2c --- /dev/null +++ b/tools/authcon/README @@ -0,0 +1,80 @@ +README - Sept. 2010 + +This is an implementation of OpenSRF support for authentication using +Cocoon. You have to get Cocoon directly at: + + http://cocoon.apache.org/mirror.cgi + +The version we have worked with is 2.1.11, Cocoon must be compiled directly +for the target machine and for that you need the JDK. Once the JDK is +installed, set an environmental variable called JAVA_HOME to the root of +the directory for the JDK. You can usually tell what this is by the location +of "lib/tools.jar", for example, on my version of ubuntu, JAVA_HOME is set to: + + /usr/lib/jvm/java-6-sun + +and this is verified by the existence of tools.jar: + + /usr/lib/jvm/java-6-sun/lib/tools.jar + +While you are setting the JAVA_HOME variable, it is a good time to set 2 +other variables: + + JAVA_OPTIONS="-Xms512M -Xmx512M" + JETTY_PORT=8080 + +Jetty has a weird port by default, and "JETTY_PORT" should be set to +whatever port is ok with your firewall setup. Both Jetty and Tomcat +typically are set to max out at 64M of memory so the "JAVA_OPTIONS" bumps +this up quite a bit. Reduce the numbers if your machine is very tight for +RAM but this will help ensure that Jetty won't fall over. + +Cocoon uses a very old version of httpclient, so replace it with version +3.1, it can be found here, for example: + + http://apache.parentinginformed.com/httpcomponents/commons-httpclient/binary/commons-httpclient-3.1.zip + +Unzip it and copy it to the lib directory of Cocoon, located at: + + cocoon-2.1.11/build/webapp/WEB-INF/lib + +also remove the older version: + + rm commons-httpclient-2.0.2.jar + +OpenSRF requires https and we use some special workarounds in case OpenSRF is on +a machine that has a temporary certificate. The component that pulls in +httpclient to do the network interactions is called "seth" and it is installed +by going into the "seth" directory and editing "build.xml". Look for this line: + + + +Adjust the path to reflect where Cocoon has been installed. The application is +compiled with Ant so go into the "seth" directory and issue a: + + ant deploy + +This should compile and install the component. Now copy the "auth" directory to +"build/webapp" directory of Cocoon. The "sitemap.xmap" file in "auth" contains +the parameters for an ezproxy installation. Modify these to reflect your environment +and start Cocoon by going to the "cocoon-2.1.11" directory and using either "cocoon.sh" +or "cocoon.bat". Note that the files won't be set to be executable by default: + + chmod +x *.sh + ./cocoon.sh + +If it looks like Cocoon started ok, try out the setup with a URL like: + + http://test.library.org:8080/auth/check?url=http://www.jstor.org + +You should see an authentication form, and be able to use a valid opac account +to be passed on to ezproxy. The form can be modified and styled in the "auth/forms" +directory. Cocoon featured an early implementation of XForms, and it's kind +of quirky. + +If all of this seems to work, specify the network location of Cocoon in the "ezproxy.usr" +file that EZproxy uses. + +And that's it! Feel free to contact me with any questions. + +Art Rhyno diff --git a/tools/authcon/auth/content/auth.xml b/tools/authcon/auth/content/auth.xml new file mode 100644 index 0000000000..c004df7649 --- /dev/null +++ b/tools/authcon/auth/content/auth.xml @@ -0,0 +1,9 @@ + + + + ${barcode} + + + ${pin} + + diff --git a/tools/authcon/auth/content/kickoff.xml b/tools/authcon/auth/content/kickoff.xml new file mode 100644 index 0000000000..8cc7d0ca6e --- /dev/null +++ b/tools/authcon/auth/content/kickoff.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/tools/authcon/auth/content/opensrf.xml b/tools/authcon/auth/content/opensrf.xml new file mode 100644 index 0000000000..b94c589d7f --- /dev/null +++ b/tools/authcon/auth/content/opensrf.xml @@ -0,0 +1,16 @@ + + + + ${service} + + + ${method} + + + + + ${parm} + + + + \ No newline at end of file diff --git a/tools/authcon/auth/flow/auth.js b/tools/authcon/auth/flow/auth.js new file mode 100644 index 0000000000..deac0e23a5 --- /dev/null +++ b/tools/authcon/auth/flow/auth.js @@ -0,0 +1,95 @@ +/* + auth.js - basic authentication support + + (c) Copyright GNU General Public License (GPL) + @author art rhyno + + Revised: +*/ +cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js"); + +function authorization() { + + var barcode; + var upassword; + + var theurl = cocoon.parameters["thisurl"]; + if (theurl.indexOf("url=") != -1) { + if (theurl.length > 4) + theurl = theurl.substring(4); + } + + var referer = cocoon.request.getHeader('Referer'); + + var theIP = cocoon.request.getRemoteAddr(); + var theDomain = cocoon.parameters["ipdomain"]; + var theOrg = cocoon.parameters["coniferorg"]; + + var probList = cocoon.parameters["problist"]; + var banList = cocoon.parameters["banlist"]; + if (banList == null) + banList="zipnada"; + if (probList == null) + probList="zipnada"; + + var ezHost = cocoon.parameters["ezhost"]; + var ezUser = cocoon.parameters["ezuser"]; + var ezPassword = cocoon.parameters["ezpassword"]; + var localAddr = false; + + if (theIP.startsWith(theDomain)) + localAddr = true; + + //basic cleanup of urls + var jsurl= new String(theurl); + jsurl = jsurl.replace(/\&/gi,'%26'); + jsurl = jsurl.replace(/%3F/gi,'?'); + + if (jsurl.length <= 1) { + print("zero length - redirecting"); + cocoon.sendPage("willnotmatchsoredirect"); + return; + } + + if (!localAddr) { + var form = new Form("forms/auth.xml"); + form.showForm("auth-display-pipeline"); + + var model = form.getModel(); + barcode = model.barcode.replace(' ',''); + barcode = barcode.replace('-',''); + + upassword = model.pin.replace(' ',''); + if (probList.indexOf(theIP) != -1 || banList.indexOf(barcode) != -1) { + cocoon.sendPage("willnotmatchsoredirect"); + return; + }//if + } else { + cocoon.sendPage("pass-on?url=" + theurl); + return; + }//if + + /* + OpenSRF support + */ + var authToken = setUpSession(barcode, upassword, "opac", + theOrg, ""); + + var authFlag = false; + if (authToken != null) { + authFlag = true; + //clean up connection + sessionDelete(authToken); + } + + if (!authFlag) { + cocoon.sendPage("authenticate.jx?flag=" + + authFlag + "&url=" + + theurl); + } else { + var passedUrl = ezHost + "/login%3Fuser=" + ezUser + + "%26pass=" + ezPassword + "%26url=" + jsurl; + cocoon.sendPage("pass-on?url=" + passedUrl); + + }//if +} diff --git a/tools/authcon/auth/flow/md5.js b/tools/authcon/auth/flow/md5.js new file mode 100644 index 0000000000..9d1ad2452b --- /dev/null +++ b/tools/authcon/auth/flow/md5.js @@ -0,0 +1,206 @@ +/* + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ +function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} +function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} +function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} +function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } +function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } +function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } +function md5_vm_test() +{ + return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; +} +function core_md5(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << ((len) % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); + d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); + c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); + b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); + a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); + d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); + c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); + b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); + a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); + d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); + c = md5_ff(c, d, a, b, x[i+10], 17, -42063); + b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); + a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); + d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); + c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); + b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); + + a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); + d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); + c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); + b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); + a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); + d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); + c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); + b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); + a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); + d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); + c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); + b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); + a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); + d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); + c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); + b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); + + a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); + d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); + c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); + b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); + a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); + d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); + c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); + b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); + a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); + d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); + c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); + b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); + a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); + d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); + c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); + b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); + + a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); + d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); + c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); + b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); + a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); + d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); + c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); + b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); + a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); + d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); + c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); + b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); + a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); + d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); + c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); + b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + } + return Array(a, b, c, d); + +} +function md5_cmn(q, a, b, x, s, t) +{ + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); +} +function md5_ff(a, b, c, d, x, s, t) +{ + return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); +} +function md5_gg(a, b, c, d, x, s, t) +{ + return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); +} +function md5_hh(a, b, c, d, x, s, t) +{ + return md5_cmn(b ^ c ^ d, a, b, x, s, t); +} +function md5_ii(a, b, c, d, x, s, t) +{ + return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); +} +function core_hmac_md5(key, data) +{ + var bkey = str2binl(key); + if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); + return core_md5(opad.concat(hash), 512 + 128); +} +function safe_add(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} +function bit_rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} +function str2binl(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + for(var i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); + return bin; +} +function binl2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + for(var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); + return str; +} +function binl2hex(binarray) +{ + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i++) + { + str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); + } + return str; +} +function binl2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i += 3) + { + var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} + diff --git a/tools/authcon/auth/flow/opensrf.js b/tools/authcon/auth/flow/opensrf.js new file mode 100644 index 0000000000..e1aa4d6804 --- /dev/null +++ b/tools/authcon/auth/flow/opensrf.js @@ -0,0 +1,186 @@ +/* + opensrf.js - opensrf convenience functions + + (c) Copyright GNU General Public License (GPL) + @author art rhyno + + Revised: +*/ + + +function setUpSession(userid, password, sessionType, org, workstation) +{ + var parms = []; + var authToken=null; + var osrfdata; + + parms[0] = "\"" + userid +"\""; + osrfdata = { + "service" : "open-ils.auth", + "method" : "open-ils.auth.authenticate.init", + "parms" : parms } + + var osrf = jsonify("opensrf",osrfdata); + print("init: " + osrf.status); + + if (parseInt(osrf.status) == 200) { + print("-> " + osrf.payload); + var md5Password = hex_md5(osrf.payload + hex_md5(password)); + print("-> " + md5Password); + parms[0] = "{\"password\":\"" + md5Password + "\",\"type\":\"" + sessionType + "\",\"org\":"; + if (sessionType == 'opac') { + parms[0] += ("\"" + org + "\",\"username\":\"" + userid + "\"}"); + } else { + parms[0] += ( + "\"" + org + "\",\"username\":\"" + userid +"\",\"workstation\":\"" + + workstation + "\"}"); + } + print("-> " + parms[0]); + osrfdata = { + "service" : "open-ils.auth", + "method" : "open-ils.auth.authenticate.complete", + "parms" : parms } + + osrf = jsonify("opensrf",osrfdata); + try { + authToken = osrf.payload[0].payload.authtoken; + } catch (er) { + //print("error " + er); + } + }//if + + return authToken; +}//setUpSession + +function patronUpdate(authToken, patronInfo) { + var parms = []; + var osrfdata; + + try { + parms[0] = "\"" + authToken + "\""; + parms[1] = patronInfo; + osrfdata = { + "service" : "open-ils.actor", + "method" : "open-ils.actor.patron.update", + "parms" : parms } + var osrf = jsonify("opensrf",osrfdata); + if (parseInt(osrf.status) == 200) + return true; + } catch (ex) { + print("problem with patron update: " + ex); + }//try + + return false; +}//patronUpdate + +function retrieveUsrByBarcode(authToken, barcode) { + var osrfstr = ""; + var parms = []; + + //check barcode + print(authToken + " - about to search"); + parms[0] = "\"" + authToken + "\""; + parms[1] = "\"" + barcode + "\""; + var osrfdata = { + "service" : "open-ils.actor", + "method" : "open-ils.actor.user.fleshed.retrieve_by_barcode", + "parms" : parms } + + //we don't want a json object in this case + osrfstr = dejsonify("opensrf",osrfdata); + + return osrfstr; +}//retrieveByBarcode + +/* + checkBarcode + + - return true if barcode is found, false if not +*/ +function checkBarcode(authToken, barcode) { + var found = true; + var parms = []; + + //check barcode + print(authToken + " - about to search"); + parms[0] = "\"" + authToken + "\""; + parms[1] = "\"" + barcode + "\""; + var osrfdata = { + "service" : "open-ils.actor", + "method" : "open-ils.actor.user.retrieve_id_by_barcode_or_username", + "parms" : parms } + var osrf = jsonify("opensrf",osrfdata); + + //this will be a string if found + if(typeof(osrf.payload[0].textcode) != "undefined") + found = false; + + //print("-> " + typeof(osrf.payload[0].textcode)); + + return found; +}//checkBarcode + +/* + checkOrgId + + - return true if ord id is found, false if not +*/ +function checkOrgId(authToken, orgId) { + var found = true; + var parms = []; + + parms[0] = "\"" + authToken + "\""; + //Group 2 are phone numbers and ID values. + parms[1] = "{\"ident\":{\"value\":\"" + orgId + "\",\"group\":2}}"; + + var osrfdata = { + "service" : "open-ils.actor", + "method" : "open-ils.actor.patron.search.advanced", + "parms" : parms } + var osrf = jsonify("opensrf",osrfdata); + + //this will be the db id if found + if((osrf.payload[0] + "").length == 0) + found = false; + + return found; +}//checkOrgId + +/* + sortOutVal + + - put value in opensrf-friendly syntax, e.g., "foo", null, "fee" +*/ +function sortOutVal(theVal) { + var newVal = theVal; + newVal = newVal.replace (/^\s+|\s+$/g,''); + if (newVal.length == 0) + return "null"; + + return "\"" + newVal + "\""; +}//sortOutVal + +/* + sessionDelete + + - delete existing session +*/ +function sessionDelete(authToken) { + var parms = []; + + try { + parms[0] = authToken; + var osrfdata = { + "service" : "open-ils.auth", + "method" : "open-ils.auth.session.delete", + "parms" : parms } + var osrf = jsonify("opensrf",osrfdata); + print("delete: " + osrf.status); + if (parseInt(osrf.status) == 200) + return true; + } catch (ex) { + print("problem with session delete: " + ex); + } + + return false; +}//sessionDelete diff --git a/tools/authcon/auth/flow/util.js b/tools/authcon/auth/flow/util.js new file mode 100644 index 0000000000..cd171efd8e --- /dev/null +++ b/tools/authcon/auth/flow/util.js @@ -0,0 +1,277 @@ +/* + * util.js - generic help functions + * + * Art Rhyno (arhyno@uwindsor.ca), August 2006 + * (c) Copyright GNU General Public License (GPL) + * + * Revised: +*/ + +var prob1 = ", {}]}{}"; +var prob2 = "{}"; +var prob3 = "\",{\"url"; + +/* + sleep() - the rhino implementation doesn't have a setTimeout + function, but this is a better approach anyway since + javascript still consumes CPU. Java has a true sleep + function and that is what we use here. +*/ + +function sleep (secs) +{ + //bump up to seconds + var theSecs = secs * 1000; + java.lang.Thread.sleep(theSecs); +}//sleep + +function endsWith(theStr, theEnd) { + var theStrEnd = theStr.substring(theStr.length - theEnd.length); + print("comparing " + theStrEnd + " to " + theEnd); + if (theStrEnd == theEnd) + return true; + + return false; +} + + +function extractAttribute(attribute, attrStr) { + var attrVal = attrStr.replace(/\s+=/,'=') + ""; + attrVal = attrVal.replace(/=\s+/,'='); + var attrLoc = attribute + "="; + var attrPos = attrVal.indexOf(attrLoc); + + if (attrPos != -1) { + attrVal = attrVal.substring(attrPos + + attrLoc.length); + attrPos = attrVal.indexOf(","); + + if (attrPos != -1) { + attrVal = attrVal.substring(0, + attrPos); + + }//if attrPos + + }//if + + return attrVal; +} + + +function figureOutPath(theBase, theApp, theFile) { + var fullFile = theFile; + var fullBase = theBase; + if (!endsWith(fullBase,'/')) + fullBase = fullBase + "/"; + + if (theFile.indexOf("/") != 0) + fullFile = fullBase + theApp + "/" + + fullFile; + + print("returning " + fullFile); + + return fullFile; +} + +function fixQuote(theVal) { + var retVal = theVal.replace(/\'/g,"\\\'"); + + return retVal; +} + +function countInstances(theVal, theChar) { + var substrings = theVal.split(theChar); + return substrings.length - 1; +} + +function fixCollection(theStr,theProb) { + var collStr = "collection\":{"; + var newStr = theStr; + + var thispos = theStr.indexOf(collStr); + + if (thispos != -1) { + newStr = theStr.substring(0,thispos) + "collection\":" + + "[{" + theStr.substring(thispos+collStr.length); + } + + thispos = newStr.indexOf(theProb); + if (thispos != -1) + newStr = newStr.substring(0,thispos) + "]}]}"; + + + return newStr; +} + +function sortOutDate(dateStr, dashed) { + print("dateStr - " + dateStr); + var theDate = new Date(); + if (dashed) + dateStr.match(/(\d{4})\-(\d{2})\-(\d{2})/); + else + dateStr.match(/(\d{4})\.(\d{2})\.(\d{2})/); + + print(RegExp.$1 + " - " + RegExp.$2 + " - " + RegExp.$3) + theDate.setYear(RegExp.$1); + theDate.setMonth(RegExp.$2); + theDate.setDate(RegExp.$3); + + print("returning " + theDate); + + return theDate; +}//sortOutDate + +function jsonEval(inStr) { + //print("starts " + inStr + " - " + countInstances(inStr,"}") + " - " + countInstances(inStr,"{")); + var theStr = inStr; + if (countInstances(theStr,"}") < countInstances(theStr,"{")) { + //theStr = theStr.substring(0,theStr.length - 1); + theStr += "}"; + //print("modified"); + } + + var evalObj = null; + try { + evalObj = eval('(' + theStr + ')'); + } catch (evalProb) { + print("jsonify can't convert: " + evalObj); + print("jsonify can't convert - " + evalProb); + } + + + return evalObj; +} + +//jsonify - put results of pipeline into JSON format +function jsonify(pipeline, pipeinfo) { + + //print("json pipeline is " + pipeline); + var stream = new java.io.ByteArrayOutputStream(); + cocoon.processPipelineTo( pipeline, pipeinfo, stream ); + var theVal = stream.toString() + ""; + //print("serviceVal is " + theVal); + var checkpos = -1; + /* this probably doesn't have to be in a try/catch block + but i had a problem with one range where it was an odd + character. i couldn't replicate it again. + */ + try { + checkpos = theVal.indexOf(prob1); + if (checkpos != -1) + theVal = fixCollection(theVal,prob1); + checkpos = theVal.indexOf(prob2); + if (checkpos != -1) + theVal = theVal.substring(0,checkpos); + checkpos = theVal.indexOf(prob3); + if (checkpos != -1) { + theVal = theVal.replace(/,\{\"url/g,'},{\"url') + ""; + theVal = theVal.replace(/\"\]/g,'\"}]'); + //print("now -> " + theVal + "<-"); + } + } catch (problem) { + print("nasty char issue " + problem); + } + + var theEval = jsonEval(theVal); + + //cocoon.dispose(stream); + + return theEval; + +}//jsonify + +//jsonify - get json results but leave in string format +function dejsonify(pipeline, pipeinfo) { + + //print("json pipeline is " + pipeline); + var stream = new java.io.ByteArrayOutputStream(); + cocoon.processPipelineTo( pipeline, pipeinfo, stream ); + return stream.toString() + ""; + +}//dejsonify + +//reportStatus - send message to status pipeline +function reportStatus(theReason) { + print("thereason is " + theReason); + var reason = { + "reason" : theReason + } + cocoon.sendPage("wagger-status-pipeline", reason); +}//reportStatus + +function reportStatusInJson(theReason) { + //print("sending " + theReason); + var reason = { + "reason" : theReason + } + cocoon.sendPage("wagger-status-pipeline-json", reason); +}//reportStatusInJson + +function Mod10(ccNumb) { // v2.0 +var valid = "0123456789" // Valid digits in a credit card number +var len = ccNumb.length; // The length of the submitted cc number +var iCCN = parseInt(ccNumb); // integer of ccNumb +var sCCN = ccNumb.toString(); // string of ccNumb +sCCN = sCCN.replace (/^\s+|\s+$/g,''); // strip spaces +var iTotal = 0; // integer total set at zero +var bNum = true; // by default assume it is a number +var bResult = false; // by default assume it is NOT a valid cc +var temp; // temp variable for parsing string +var calc; // used for calculation of each digit + +// Determine if the ccNumb is in fact all numbers +for (var j=0; j0;i--){ // LOOP throught the digits of the card + calc = parseInt(iCCN) % 10; // right most digit + calc = parseInt(calc); // assure it is an integer + iTotal += calc; // running total of the card number as we loop - Do Nothing to first digit + i--; // decrement the count - move to the next digit in the card + iCCN = iCCN / 10; // subtracts right most digit from ccNumb + calc = parseInt(iCCN) % 10 ; // NEXT right most digit + calc = calc *2; // multiply the digit by two + // Instead of some screwy method of converting 16 to a string and then parsing 1 and 6 and then adding them to make 7, + // I use a simple switch statement to change the value of calc2 to 7 if 16 is the multiple. + switch(calc){ + case 10: calc = 1; break; //5*2=10 & 1+0 = 1 + case 12: calc = 3; break; //6*2=12 & 1+2 = 3 + case 14: calc = 5; break; //7*2=14 & 1+4 = 5 + case 16: calc = 7; break; //8*2=16 & 1+6 = 7 + case 18: calc = 9; break; //9*2=18 & 1+8 = 9 + default: calc = calc; //4*2= 8 & 8 = 8 -same for all lower numbers + } + iCCN = iCCN / 10; // subtracts right most digit from ccNum + iTotal += calc; // running total of the card number as we loop + } // END OF LOOP + if ((iTotal%10)==0){ // check to see if the sum Mod 10 is zero + bResult = true; // This IS (or could be) a valid credit card number. + } else { + bResult = false; // This could NOT be a valid credit card number + } + } +} + return bResult; // Return the results +} + +function listProperties(obj) { + var propList = ""; + for(var propName in obj) { + if(typeof(obj[propName]) != "undefined") { + propList += (propName + ", " + typeof(obj[propName])); + } + } + print("--> " + propList); +} \ No newline at end of file diff --git a/tools/authcon/auth/forms/auth.xml b/tools/authcon/auth/forms/auth.xml new file mode 100644 index 0000000000..4c82da6a29 --- /dev/null +++ b/tools/authcon/auth/forms/auth.xml @@ -0,0 +1,38 @@ + + + + + + + Username or Barcode: + + + + + + + + + + + + Barcodes can be entered in any of these formats: +
    + 21862000111222 + 21862-000-111-222 +
+
+ Password: + +
+
+ +
diff --git a/tools/authcon/auth/forms/auth_template.xml b/tools/authcon/auth/forms/auth_template.xml new file mode 100644 index 0000000000..52d143c763 --- /dev/null +++ b/tools/authcon/auth/forms/auth_template.xml @@ -0,0 +1,44 @@ + + + + + Library E-Resources + + + + + + + + + + + + +
+ + + + + Authorization Information + + + + + + +
+
* - MUST be filled out.
+
+ + Login + + +
+
+
+
diff --git a/tools/authcon/auth/images/Thumbs.db b/tools/authcon/auth/images/Thumbs.db new file mode 100644 index 0000000000..aaecadc8ed Binary files /dev/null and b/tools/authcon/auth/images/Thumbs.db differ diff --git a/tools/authcon/auth/images/bback.gif b/tools/authcon/auth/images/bback.gif new file mode 100644 index 0000000000..7bd57699a1 Binary files /dev/null and b/tools/authcon/auth/images/bback.gif differ diff --git a/tools/authcon/auth/images/booking.gif b/tools/authcon/auth/images/booking.gif new file mode 100644 index 0000000000..3aef2e77d5 Binary files /dev/null and b/tools/authcon/auth/images/booking.gif differ diff --git a/tools/authcon/auth/images/button.jpg b/tools/authcon/auth/images/button.jpg new file mode 100644 index 0000000000..aebe00a756 Binary files /dev/null and b/tools/authcon/auth/images/button.jpg differ diff --git a/tools/authcon/auth/images/cal.gif b/tools/authcon/auth/images/cal.gif new file mode 100644 index 0000000000..681cd5dc76 Binary files /dev/null and b/tools/authcon/auth/images/cal.gif differ diff --git a/tools/authcon/auth/images/cancel.gif b/tools/authcon/auth/images/cancel.gif new file mode 100644 index 0000000000..b022e0693d Binary files /dev/null and b/tools/authcon/auth/images/cancel.gif differ diff --git a/tools/authcon/auth/images/delete.gif b/tools/authcon/auth/images/delete.gif new file mode 100644 index 0000000000..a0f48916e3 Binary files /dev/null and b/tools/authcon/auth/images/delete.gif differ diff --git a/tools/authcon/auth/images/eiu.jpg b/tools/authcon/auth/images/eiu.jpg new file mode 100644 index 0000000000..20deab46b3 Binary files /dev/null and b/tools/authcon/auth/images/eiu.jpg differ diff --git a/tools/authcon/auth/images/end.gif b/tools/authcon/auth/images/end.gif new file mode 100644 index 0000000000..99a2c30a97 Binary files /dev/null and b/tools/authcon/auth/images/end.gif differ diff --git a/tools/authcon/auth/images/help.gif b/tools/authcon/auth/images/help.gif new file mode 100644 index 0000000000..5a16b0bb6b Binary files /dev/null and b/tools/authcon/auth/images/help.gif differ diff --git a/tools/authcon/auth/images/loginwin.gif b/tools/authcon/auth/images/loginwin.gif new file mode 100644 index 0000000000..07d96a62d1 Binary files /dev/null and b/tools/authcon/auth/images/loginwin.gif differ diff --git a/tools/authcon/auth/images/move_down.gif b/tools/authcon/auth/images/move_down.gif new file mode 100644 index 0000000000..82ac5bf37d Binary files /dev/null and b/tools/authcon/auth/images/move_down.gif differ diff --git a/tools/authcon/auth/images/move_up.gif b/tools/authcon/auth/images/move_up.gif new file mode 100644 index 0000000000..c794d5dfaa Binary files /dev/null and b/tools/authcon/auth/images/move_up.gif differ diff --git a/tools/authcon/auth/images/new.gif b/tools/authcon/auth/images/new.gif new file mode 100644 index 0000000000..df044bbec7 Binary files /dev/null and b/tools/authcon/auth/images/new.gif differ diff --git a/tools/authcon/auth/images/ok.gif b/tools/authcon/auth/images/ok.gif new file mode 100644 index 0000000000..5bb323dccc Binary files /dev/null and b/tools/authcon/auth/images/ok.gif differ diff --git a/tools/authcon/auth/images/start.gif b/tools/authcon/auth/images/start.gif new file mode 100644 index 0000000000..789f70e491 Binary files /dev/null and b/tools/authcon/auth/images/start.gif differ diff --git a/tools/authcon/auth/images/status.gif b/tools/authcon/auth/images/status.gif new file mode 100644 index 0000000000..f202cc1f5d Binary files /dev/null and b/tools/authcon/auth/images/status.gif differ diff --git a/tools/authcon/auth/images/update.gif b/tools/authcon/auth/images/update.gif new file mode 100644 index 0000000000..e5f294a34d Binary files /dev/null and b/tools/authcon/auth/images/update.gif differ diff --git a/tools/authcon/auth/images/zap.gif b/tools/authcon/auth/images/zap.gif new file mode 100644 index 0000000000..463a1504dc Binary files /dev/null and b/tools/authcon/auth/images/zap.gif differ diff --git a/tools/authcon/auth/resources/blank_btn.gif b/tools/authcon/auth/resources/blank_btn.gif new file mode 100644 index 0000000000..b41bab9ded Binary files /dev/null and b/tools/authcon/auth/resources/blank_btn.gif differ diff --git a/tools/authcon/auth/resources/cal.gif b/tools/authcon/auth/resources/cal.gif new file mode 100644 index 0000000000..681cd5dc76 Binary files /dev/null and b/tools/authcon/auth/resources/cal.gif differ diff --git a/tools/authcon/auth/resources/close.gif b/tools/authcon/auth/resources/close.gif new file mode 100644 index 0000000000..807d354b4c Binary files /dev/null and b/tools/authcon/auth/resources/close.gif differ diff --git a/tools/authcon/auth/resources/close.gif.old b/tools/authcon/auth/resources/close.gif.old new file mode 100644 index 0000000000..19743353cd Binary files /dev/null and b/tools/authcon/auth/resources/close.gif.old differ diff --git a/tools/authcon/auth/resources/def2binding.xsl b/tools/authcon/auth/resources/def2binding.xsl new file mode 100644 index 0000000000..ac314a1eeb --- /dev/null +++ b/tools/authcon/auth/resources/def2binding.xsl @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/authcon/auth/resources/delete.gif b/tools/authcon/auth/resources/delete.gif new file mode 100644 index 0000000000..a0f48916e3 Binary files /dev/null and b/tools/authcon/auth/resources/delete.gif differ diff --git a/tools/authcon/auth/resources/forms-advanced-field-styling.xsl b/tools/authcon/auth/resources/forms-advanced-field-styling.xsl new file mode 100644 index 0000000000..35524305c3 --- /dev/null +++ b/tools/authcon/auth/resources/forms-advanced-field-styling.xsl @@ -0,0 +1,184 @@ + + + + + + + + + + resources + + + + + + + helppopup + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+ + + + + +   + + + disabled + + +   +
+   + + + disabled + + +   +
+   + + + disabled + + +   +
+   + + + disabled + + +   +
+ +
+ + +
+ +
+
+ + + +
diff --git a/tools/authcon/auth/resources/forms-calendar-styling.xsl b/tools/authcon/auth/resources/forms-calendar-styling.xsl new file mode 100644 index 0000000000..43b0a7ec2d --- /dev/null +++ b/tools/authcon/auth/resources/forms-calendar-styling.xsl @@ -0,0 +1,99 @@ + + + + + + + resources + + + + + + + +
+ + + + + + + + + + + + yyyy-MM-dd + + + + + + + + + + + + + Calendar + + + + + Calendar + + + + + + + + + diff --git a/tools/authcon/auth/resources/forms-calendar.css b/tools/authcon/auth/resources/forms-calendar.css new file mode 100644 index 0000000000..50703e9cd7 --- /dev/null +++ b/tools/authcon/auth/resources/forms-calendar.css @@ -0,0 +1,92 @@ +/* +* Copyright 1999-2004 The Apache Software Foundation +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#forms_calendarDiv { + position: absolute; + visibility: hidden; + background-color: white; + layer-background-color: white; +} + +.forms_cpYearNavigation, .forms_cpMonthNavigation { + background-color:#C0C0C0; + text-align:center; + vertical-align:center; + text-decoration:none; + color:#000000; + font-weight:bold; +} + +.forms_cpDayColumnHeader, .forms_cpYearNavigation, .forms_cpMonthNavigation, .forms_cpCurrentMonthDate, .forms_cpCurrentMonthDateDisabled, .forms_cpOtherMonthDate, .forms_cpOtherMonthDateDisabled, .forms_cpCurrentDate, .forms_cpCurrentDateDisabled, .forms_cpTodayText, .forms_cpTodayTextDisabled, .forms_cpText { + font-family:arial; + font-size:8pt; +} + +TD.forms_cpDayColumnHeader { + text-align:right; + border:solid thin #C0C0C0; + border-width:0 0 19 0; +} + +.forms_cpCurrentMonthDate, .forms_cpOtherMonthDate, .forms_cpCurrentDate { + text-align:right; + text-decoration:none; +} + +.forms_cpCurrentMonthDateDisabled, .forms_cpOtherMonthDateDisabled, .forms_cpCurrentDateDisabled { + color:#D0D0D0; + text-align:right; + text-decoration:line-through; +} + +.forms_cpCurrentMonthDate, .forms_cpCurrentDate { + color:#000000; +} + +.forms_cpOtherMonthDate { + color:#808080; +} + +TD.forms_cpCurrentDate { + color:white; background-color: #C0C0C0; + border-width:1; + border:solid thin #800000; +} + +TD.forms_cpCurrentDateDisabled { + border-width:1; + border:solid thin #FFAAAA; +} + +TD.forms_cpTodayText, TD.forms_cpTodayTextDisabled { + border:solid thin #C0C0C0; + border-width:1 0 0 0; +} + +A.forms_cpTodayText, SPAN.forms_cpTodayTextDisabled { + height:20px; +} + +A.forms_cpTodayText { + color:black; +} + +.forms_cpTodayTextDisabled { + color:#D0D0D0; +} + +.forms_cpBorder { + border:solid thin #808080; +} diff --git a/tools/authcon/auth/resources/forms-field-styling.xsl b/tools/authcon/auth/resources/forms-field-styling.xsl new file mode 100644 index 0000000000..408967ad5d --- /dev/null +++ b/tools/authcon/auth/resources/forms-field-styling.xsl @@ -0,0 +1,554 @@ + + + + + + + resources + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/authcon/auth/resources/forms-lib.js b/tools/authcon/auth/resources/forms-lib.js new file mode 100644 index 0000000000..6b7340a3cf --- /dev/null +++ b/tools/authcon/auth/resources/forms-lib.js @@ -0,0 +1,195 @@ +/* +* Copyright 1999-2004 The Apache Software Foundation +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * Runtime JavaScript library for Cocoon forms. + * + * @author Sylvain Wallez + * @version CVS $Id: forms-lib.js 57536 2004-11-12 18:33:30Z sylvain $ + */ + +// Handlers that are to be called in the document's "onload" event +var forms_onloadHandlers = new Array(); + +function forms_onload() { + for (var i = 0; i < forms_onloadHandlers.length; i++) { + forms_onloadHandlers[i].forms_onload(); + } + // Clear it (we no more need them) + forms_onloadHandlers = null; +} + +// Handlers that are to be called in form's "onsubmit" event +//FIXME: this single var implies only one form per page, and needs to be +// visited if we decide to support several forms per page. +var forms_onsubmitHandlers = new Array(); + +function forms_onsubmit() { + if (forms_onsubmitHandlers == null) { + //alert("onsubmit called twice!"); + } + + for (var i = 0; i < forms_onsubmitHandlers.length; i++) { + forms_onsubmitHandlers[i].forms_onsubmit(); + } + // clear it + forms_onsubmitHandlers = null; +} + +/** + * Submit the form containing an element, also storing in the hidden + * 'forms_submit_id' field the name of the element which triggered the submit. + */ +function forms_submitForm(element, name) { + if (name == undefined) { + name = element.name; + } + + var form = forms_getForm(element); + if (form == null) { + alert("Cannot find form for " + element); + } else { + form["forms_submit_id"].value = name; + // FIXME: programmatically submitting the form doesn't trigger onsubmit ? (both in IE and Moz) + forms_onsubmit(); + form.submit(); + } +} + +/** + * Crawl the parents of an element up to finding a form. + */ +function forms_getForm(element) { + while(element != null && element.tagName != "FORM") { + element = element.parentNode; + } + return element; +} + +/** + * Move a named element as an immediate child of the element. + * This is required for help popups inside tabs. The reason is that CSS positioning + * properties ("left" and "top") on a block with a "position: absolute" are actually relative to + * the nearest ancestor that has a position of "absolute", "relative" or "fixed". + * See http://www.w3.org/TR/CSS21/visudet.html#containing-block-details $4 + */ + +function forms_moveInBody(element) { + element.parentNode.removeChild(element); + document.body.appendChild(element); +} + +/** + * Create a popup window for a named element. + * + * @param id the ID of the element to make a popup with. + */ +function forms_createPopupWindow(id) { + var result = new PopupWindow(id); + result.autoHide(); + // add to onload handlers + result.forms_id = id; + result.forms_onload = function() { + forms_moveInBody(document.getElementById(this.forms_id)); + } + forms_onloadHandlers.push(result); + return result; +} + + +function forms_createOptionTransfer(id, submitOnChange) { + var result = new OptionTransfer(id + ".unselected", id); + result.setAutoSort(true); + // add to onload handlers + result.forms_id = id; + result.forms_onload = function() { + var form = forms_getForm(document.getElementById(this.forms_id)); + this.init(form); + sortSelect(this.left); + sortSelect(this.right); + } + result.submitOnChange = submitOnChange; + result.forms_transferLeft = function() { + this.transferLeft(); + if (this.submitOnChange) { + forms_submitForm(document.getElementById(this.forms_id)); + } + } + result.forms_transferRight = function() { + this.transferRight(); + if (this.submitOnChange) { + forms_submitForm(document.getElementById(this.forms_id)); + } + } + result.forms_transferAllLeft = function() { + this.transferAllLeft(); + if (this.submitOnChange) { + forms_submitForm(document.getElementById(this.forms_id)); + } + }; + result.forms_transferAllRight = function() { + this.transferAllRight(); + if (this.submitOnChange) { + forms_submitForm(document.getElementById(this.forms_id)); + } + }; + forms_onloadHandlers.push(result); + + // add to onsubmit handlers + result.forms_onsubmit = function() { + // Select all options in the "selected" list to that + // its values are sent. + selectAllOptions(this.right); + } + forms_onsubmitHandlers.push(result); + return result; +} + + +/** + * Show a tab in a + * + * @param tabgroup (string) name of the + * @param idx (integer) index of the selected tab + * @param length (integer) total number of tabs + * @param state (string, optional) name of the input storing the tabgroup state + */ +function forms_showTab(tabgroup, idx, length, state) { + // Change state value + if (state.length > 0) { + document.forms[0][state].value = idx; + } + for (var i = 0; i < length; i++) { + // Change tab status (selected/unselected) + var tab = document.getElementById(tabgroup + "_tab_" + i); + if (tab != null) { + tab.className = (i == idx) ? 'forms-tab forms-activeTab': 'forms-tab'; + } + // Change tab content visibilty + var tabitems = document.getElementById(tabgroup + "_items_" + i); + if (tabitems != null) { + tabitems.style.display = (i == idx) ? '' : 'none'; + // execute event handler if any + if (i == idx && + window.onTabShownHandlers != null && + window.onTabShownHandlers[tabgroup] != null) { + var onShowHandler = window.onTabShownHandlers[tabgroup][tabgroup + "_items_" + i]; + if (onShowHandler != null) { + eval(onShowHandler); + } + } + } + } +} \ No newline at end of file diff --git a/tools/authcon/auth/resources/forms-page-styling.xsl b/tools/authcon/auth/resources/forms-page-styling.xsl new file mode 100644 index 0000000000..de66576b8e --- /dev/null +++ b/tools/authcon/auth/resources/forms-page-styling.xsl @@ -0,0 +1,353 @@ + + + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + + 0 + + + + + + +
+ + + + + +
+ + + + + forms-tab + forms-activeTab + + + +  !  + + + +
+ + + +
+ + display:none + + +
+
+
+ + +
+ + + + + + + + + + + 0 + + + + + + +
+ + + + +  !  + + + + + +
+ + display:none + + +
+
+
+
+ + + +
+ + + +
+
+ + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/tools/authcon/auth/resources/forms-samples-styling.xsl b/tools/authcon/auth/resources/forms-samples-styling.xsl new file mode 100644 index 0000000000..67d8ec1d3a --- /dev/null +++ b/tools/authcon/auth/resources/forms-samples-styling.xsl @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/authcon/auth/resources/forms.css b/tools/authcon/auth/resources/forms.css new file mode 100644 index 0000000000..3a23ade32d --- /dev/null +++ b/tools/authcon/auth/resources/forms.css @@ -0,0 +1,75 @@ +/* +* Copyright 1999-2004 The Apache Software Foundation +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +.forms-tab { + background-color: white; + border: 1px solid black; + border-bottom-width: 0px; + padding: 2px 1em 2px 1em; + margin-right: 5px; + position: relative; + text-decoration: none; + top: -1px; + z-index: 1; + cursor: pointer; +} + +.forms-tab.forms-activeTab { + font-weight: bold; + padding-top: 5px; + cursor: default; + z-index: 3; +} + +.forms-tabContent { + background-color: white; + border: 1px solid black; + padding: 1em; + position: relative; + z-index: 2; +} + +.forms-validation-message, a.forms-validation-message:link { + color: red; + font-weight: bold; +} + +.forms-validation-errors { +} + +.forms-validation-error { +} + +.forms-field-required { + color:blue; + font-weight: bold; +} + +.forms-help { + border-style: dotted; + border-width: 1px; + padding: 5px; + background-color:#FFFFC0; /* light yellow */ + width: 200px; /* otherwise IE does a weird layout */ + z-index:1000; /* must be higher than forms-tabContent */ +} + +.forms-doubleList select { + width: 150px; +} + +.forms-doubleList input { + width: 40px; +} diff --git a/tools/authcon/auth/resources/help.gif b/tools/authcon/auth/resources/help.gif new file mode 100644 index 0000000000..5a16b0bb6b Binary files /dev/null and b/tools/authcon/auth/resources/help.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/.project b/tools/authcon/auth/resources/htmlarea/.project new file mode 100644 index 0000000000..aea9a89380 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/.project @@ -0,0 +1,11 @@ + + + htmlarea + + + + + + + + diff --git a/tools/authcon/auth/resources/htmlarea/ChangeLog b/tools/authcon/auth/resources/htmlarea/ChangeLog new file mode 100644 index 0000000000..8e185779ed --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/ChangeLog @@ -0,0 +1,1185 @@ +2004-02-17 Mihai Bazon + + * lang/el.js, plugins/ContextMenu/lang/el.js, plugins/TableOperations/lang/el.js: + updated headers + + * lang/no.js: updated (thanks havardw) + +2004-02-09 Mihai Bazon + + * plugins/EnterParagraphs/enter-paragraphs.js: + Plugin that enables Mozilla to create a

instead of
at ENTER. + Code contributed by Adam Wright. + + * htmlarea.js: code to call onKeyPress for plugins that define it + code that keeps single spaces as   + (thanks to hipikat @ IT forums (Adam Wright)) + + * ChangeLog: + ChangeLog is acutally automatically generated so there's no point keep it in CVS + +2004-02-08 Mihai Bazon + + * htmlarea.js: fixed possible bug + + * images/ed_align_center.gif, images/ed_align_justify.gif, images/ed_align_left.gif, images/ed_align_right.gif, images/ed_blank.gif, images/ed_charmap.gif, images/ed_color_bg.gif, images/ed_color_fg.gif, images/ed_copy.gif, images/ed_custom.gif, images/ed_cut.gif, images/ed_delete.gif, images/ed_format_bold.gif, images/ed_format_italic.gif, images/ed_format_strike.gif, images/ed_format_sub.gif, images/ed_format_sup.gif, images/ed_format_underline.gif, images/ed_help.gif, images/ed_hr.gif, images/ed_html.gif, images/ed_image.gif, images/ed_indent_less.gif, images/ed_indent_more.gif, images/ed_left_to_right.gif, images/ed_link.gif, images/ed_list_bullet.gif, images/ed_list_num.gif, images/ed_paste.gif, images/ed_redo.gif, images/ed_right_to_left.gif, images/ed_save.gif, images/ed_show_border.gif, images/ed_splitcel.gif, images/ed_undo.gif, images/fullscreen_maximize.gif, images/fullscreen_minimize.gif, images/insert_table.gif, images/ed_about.gif: + optimized images (thanks to Alexander Kandzior and OpenCMS group) + +2004-02-01 Mihai Bazon + + * project-config.xml: release candidate 1 + + * release-notes.html: updated release notes + + * examples/index.html, examples/makefile.xml: + added examples directory index + + * release-notes.html: fix + +2004-01-31 Mihai Bazon + + * makefile.xml: ensure correct file permissions + + * plugins/SpellChecker/spell-check-logic.cgi, plugins/SpellChecker/spell-check-ui.html, plugins/SpellChecker/spell-check-ui.js: + spell checker now reports some document information (such as total number of + words, number of mispelled words, number of suggestions, etc) + + * htmlarea.js: removed some custom attributes + + * plugins/SpellChecker/spell-check-ui.js: + fixed bug (frame scroll in IE) + +2004-01-30 Mihai Bazon + + * ChangeLog, release-notes.html: updated release notes, changelog + + * plugins/SpellChecker/readme-tech.html: + updated text about Aspell Unicode support + + * plugins/SpellChecker/spell-check-style.css: - lorem ipsum + + * plugins/SpellChecker/spell-check-logic.cgi: - optimization + + * plugins/SpellChecker/spell-check-logic.cgi: + - bugfix (removed tags) + + * plugins/SpellChecker/spell-check-logic.cgi: + bleah.. this version seems to be safer; no mo' HTML::Parser; DOM rulz. + + * plugins/SpellChecker/spell-check-logic.cgi: + seems to be better now :-\ hell knows how perl & unicode works :-/ + + * plugins/SpellChecker/spell-check-logic.cgi, plugins/SpellChecker/spell-check-ui.js: + - big performance improvement (suggestion is now passed only once for each + mispelled word) + - bugs fixed (text already corrected in Unicode is now correctly decoded) + + * plugins/SpellChecker/lang/en.js: - added word "Revert" + + * plugins/SpellChecker/spell-checker.js: - lorem ipsum + - window is a bit higher now (450px) + + * plugins/SpellChecker/spell-check-ui.js: + - fixed IE bug ("undefined is undefined or undefined", or something..) + - the highlighted word will now remain in view (window scrolls if necessary) + - functionality for "Revert" + - (tried to) eliminate some of the screen blinking in Mozilla + - select the current dictionary on first display + + * plugins/SpellChecker/spell-check-ui.html: + added "Revert" button (reverts the current word to the mispelled original) + + * plugins/SpellChecker/spell-check-style.css: *** empty log message *** + + * plugins/SpellChecker/spell-check-logic.cgi: + - fixed (hopefully) unicode support (by the way, it seems that Aspell _does_ + in fact know Unicode!!) + - remembers the selected dictionary in a cookie + - removed debug code + +2004-01-28 Mihai Bazon + + * index.html: updated main page + + * release-notes.html: updated release notes + + * htmlarea.js: jscrunch-safe + + * popups/about.html: + stop tab click event so that they don't get selected + + * reference.html: some parts updated + + * popups/about.html, examples/2-areas.html, examples/context-menu.html, examples/core.html, examples/css.html, examples/full-page.html, examples/fully-loaded.html, examples/spell-checker.html, examples/table-operations.html, plugins/SpellChecker/readme-tech.html, ChangeLog, dialog.js, htmlarea.js, index.html, license.txt, popupwin.js, release-notes.html: + ChangeLog updated; copyright years/info updated + +2004-01-27 Mihai Bazon + + * htmlarea.js: + Included an workaround for a strange IE problem: IE's getElementById can + return a field having the _name_ attribute equal to the searched ID, even if + it's not having any ID at all. This can sometimes lead to taking a + different field (even if it's not a textarea) as the replacement field which + trashes the whole layout, look, feel, and functionality :-( Need to say it + again, IE SUCKS. + + Thanks goes to Mike Dick for the bug report and for the patch ;-) + +2004-01-18 Mihai Bazon + + * plugins/SpellChecker/spell-check-ui.js: + fixed bug (thanks Bill Sechrist for report): + when you "ignore"-ed the last mispelled word, no changes were applied + +2004-01-16 Mihai Bazon + + * htmlarea.js: border: 0px on body,html in pageStyle + + * popups/about.html: report userAgent in plugins tab + +2004-01-12 Mihai Bazon + + * lang/ru.js: updated (thanks to Yulya Shtyryakova) + +2004-01-03 Mihai Bazon + + * plugins/ContextMenu/lang/de.js: updated + +2004-01-02 Mihai Bazon + + * plugins/ContextMenu/lang/de.js: + DE translation, thanks to Martin Jaggi + +2003-12-22 Mihai Bazon + + * lang/ee.js: Estonian translation + +2003-12-05 Mihai Bazon + + * htmlarea.js: word cleaner: now it actually works ;-) + + * plugins/ContextMenu/lang/el.js, lang/el.js, plugins/TableOperations/lang/el.js: + added Greek translation (thanks to Dimitris Glezos) + + * htmlarea.js: + call an onGenerate handler, if found on the editor object + + * popups/about.html, popups/popup.js: updated about box + + * plugins/SpellChecker/spell-check-ui.js: *** empty log message *** + + * plugins/ContextMenu/context-menu.js: + open the normal insert_link dialog on modify link + +2003-11-28 Mihai Bazon + + * htmlarea.css: -moz-opacity got back + + * popups/about.html: *** empty log message *** + + * htmlarea.js: added Word cleaner code (thanks weeezl) + fixed the bug concerning the url of relative link/images + +2003-11-24 Mihai Bazon + + * plugins/CSS/css.js: + allows updation of parent element's class (no span). thanks goes to Michael (pepl @ IT forums) + +2003-11-22 Mihai Bazon + + * plugins/ContextMenu/lang/nl.js, plugins/TableOperations/lang/nl.js: + translation thanks to mmcw /IT forums + + * lang/nl.js: updated (thanks to mmcw /IT forums) + +2003-11-21 Mihai Bazon + + * makefile.xml: added ChangeLog to project dist + + * ChangeLog: Updated ChangeLog + + * examples/context-menu.html, examples/fully-loaded.html, examples/pieng.png, index.html, plugins/ContextMenu/1.pl, plugins/ContextMenu/context-menu.js, plugins/ContextMenu/lang/en.js, plugins/ContextMenu/lang/makefile.xml, plugins/ContextMenu/makefile.xml, plugins/ContextMenu/menu.css, plugins/makefile.xml: + Added ContextMenu plugin (work sponsored by American Bible Society) + +2003-11-11 Mihai Bazon + + * lang/en.js, lang/ro.js: support for the link dialog + + * plugins/FullPage/popups/docprop.html, popups/popup.js: + support for I18N of core dialogs, added function to select a value in a + +


+
Mihai Bazon
+ + +Last modified on Sat Oct 25 01:06:59 2003 + + + + diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/img/makefile.xml b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/img/makefile.xml new file mode 100644 index 0000000000..19e075f892 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/img/makefile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/img/spell-check.gif b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/img/spell-check.gif new file mode 100644 index 0000000000..29bd11ae98 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/img/spell-check.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/cz.js b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/cz.js new file mode 100644 index 0000000000..108c037d11 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/cz.js @@ -0,0 +1,37 @@ +// I18N constants + +// LANG: "cz", ENCODING: UTF-8 | ISO-8859-2 +// Author: Jiri Löw, + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +SpellChecker.I18N = { + "CONFIRM_LINK_CLICK" : "Prosím potvrďte otevření tohoto odkazu", + "Cancel" : "Zrušit", + "Dictionary" : "Slovník", + "Finished list of mispelled words" : "Dokončen seznam chybných slov", + "I will open it in a new page." : "Bude otevřen jej v nové stránce.", + "Ignore all" : "Ignorovat vše", + "Ignore" : "Ignorovat", + "NO_ERRORS" : "Podle zvoleného slovníku nebyla nalezena žádná chybná slova.", + "NO_ERRORS_CLOSING" : "Kontrola správnosti slov dokončena, nebyla nalezena žádná chybná slova. Ukončování ...", + "OK" : "OK", + "Original word" : "Původní slovo", + "Please wait. Calling spell checker." : "Prosím čekejte. Komunikuace s kontrolou správnosti slov.", + "Please wait: changing dictionary to" : "Prosím čekejte: změna adresáře na", + "QUIT_CONFIRMATION" : "Změny budou zrušeny a kontrola správnosti slov ukončena. Prosím potvrďte.", + "Re-check" : "Překontrolovat", + "Replace all" : "Zaměnit všechno", + "Replace with" : "Zaměnit za", + "Replace" : "Zaměnit", + "SC-spell-check" : "Kontrola správnosti slov", + "Suggestions" : "Doporučení", + "pliz weit ;-)" : "strpení prosím ;-)" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/da.js b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/da.js new file mode 100644 index 0000000000..690293ec01 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/da.js @@ -0,0 +1,37 @@ +// I18N constants + +// LANG: "en", ENCODING: UTF-8 | ISO-8859-1 +// Author: Steen Sønderup, + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +SpellChecker.I18N = { + "CONFIRM_LINK_CLICK" : "Vil du følge dette link?", + "Cancel" : "Anuler", + "Dictionary" : "Ordbog", + "Finished list of mispelled words" : "Listen med stavefejl er gennemgået", + "I will open it in a new page." : "Jeg vil åbne det i en ny side.", + "Ignore all" : "Ignorer alle", + "Ignore" : "Ignorer", + "NO_ERRORS" : "Der blev ikke fundet nogle stavefejl med den valgte ordbog.", + "NO_ERRORS_CLOSING" : "Stavekontrollen er gennemført, der blev ikke fundet nogle stavefejl. Lukker...", + "OK" : "OK", + "Original word" : "Oprindeligt ord", + "Please wait. Calling spell checker." : "Vent venligst. Henter stavekontrol.", + "Please wait: changing dictionary to" : "Vent venligst: skifter ordbog til", + "QUIT_CONFIRMATION" : "Alle dine ændringer vil gå tabt, vil du fortsætte?", + "Re-check" : "Tjek igen", + "Replace all" : "Erstat alle", + "Replace with" : "Erstat med", + "Replace" : "Erstat", + "SC-spell-check" : "Stavekontrol", + "Suggestions" : "Forslag", + "pliz weit ;-)" : "Vent venligst" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/de.js b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/de.js new file mode 100644 index 0000000000..1a8f4b5287 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/de.js @@ -0,0 +1,28 @@ +// I18N constants + +// LANG: "en", ENCODING: UTF-8 | ISO-8859-1 +// Author: Broxx, + +SpellChecker.I18N = { + "CONFIRM_LINK_CLICK" : "Wollen Sie diesen Link oeffnen", + "Cancel" : "Abbrechen", + "Dictionary" : "Woerterbuch", + "Finished list of mispelled words" : "Liste der nicht bekannten Woerter", + "I will open it in a new page." : "Wird auf neuer Seite geoeffnet", + "Ignore all" : "Alle ignorieren", + "Ignore" : "Ignorieren", + "NO_ERRORS" : "Keine falschen Woerter mit gewaehlten Woerterbuch gefunden", + "NO_ERRORS_CLOSING" : "Rechtsschreibpruefung wurde ohne Fehler fertiggestellt. Wird nun geschlossen...", + "OK" : "OK", + "Original word" : "Original Wort", + "Please wait. Calling spell checker." : "Bitte warten. Woerterbuch wird durchsucht.", + "Please wait: changing dictionary to" : "Bitte warten: Woerterbuch wechseln zu", + "QUIT_CONFIRMATION" : "Aenderungen werden nicht uebernommen. Bitte bestaettigen.", + "Re-check" : "Neuueberpruefung", + "Replace all" : "Alle ersetzen", + "Replace with" : "Ersetzen mit", + "Replace" : "Ersetzen", + "SC-spell-check" : "Ueberpruefung", + "Suggestions" : "Vorschlag", + "pliz weit ;-)" : "bittsche wartn ;-)" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/en.js b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/en.js new file mode 100644 index 0000000000..529cc6c450 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/en.js @@ -0,0 +1,38 @@ +// I18N constants + +// LANG: "en", ENCODING: UTF-8 | ISO-8859-1 +// Author: Mihai Bazon, http://dynarch.com/mishoo + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +SpellChecker.I18N = { + "CONFIRM_LINK_CLICK" : "Please confirm that you want to open this link", + "Cancel" : "Cancel", + "Dictionary" : "Dictionary", + "Finished list of mispelled words" : "Finished list of mispelled words", + "I will open it in a new page." : "I will open it in a new page.", + "Ignore all" : "Ignore all", + "Ignore" : "Ignore", + "NO_ERRORS" : "No mispelled words found with the selected dictionary.", + "NO_ERRORS_CLOSING" : "Spell check complete, didn't find any mispelled words. Closing now...", + "OK" : "OK", + "Original word" : "Original word", + "Please wait. Calling spell checker." : "Please wait. Calling spell checker.", + "Please wait: changing dictionary to" : "Please wait: changing dictionary to", + "QUIT_CONFIRMATION" : "This will drop changes and quit spell checker. Please confirm.", + "Re-check" : "Re-check", + "Replace all" : "Replace all", + "Replace with" : "Replace with", + "Replace" : "Replace", + "Revert" : "Revert", + "SC-spell-check" : "Spell-check", + "Suggestions" : "Suggestions", + "pliz weit ;-)" : "pliz weit ;-)" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/hu.js b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/hu.js new file mode 100644 index 0000000000..64102c558e --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/hu.js @@ -0,0 +1,37 @@ +// I18N constants + +// LANG: "hu", ENCODING: UTF-8 +// Author: Miklós Somogyi, + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +SpellChecker.I18N = { + "CONFIRM_LINK_CLICK" : "Megerősítés", + "Cancel" : "Mégsem", + "Dictionary" : "Szótár", + "Finished list of mispelled words" : "A tévesztett szavak listájának vége", + "I will open it in a new page." : "Megnyitás új lapon", + "Ignore all" : "Minden elvetése", + "Ignore" : "Elvetés", + "NO_ERRORS" : "A választott szótár szerint nincs tévesztett szó.", + "NO_ERRORS_CLOSING" : "A helyesírásellenőrzés kész, tévesztett szó nem fordult elő. Bezárás...", + "OK" : "Rendben", + "Original word" : "Eredeti szó", + "Please wait. Calling spell checker." : "Kis türelmet, a helyesírásellenőrző hívása folyamatban.", + "Please wait: changing dictionary to" : "Kis türelmet, szótár cseréje", + "QUIT_CONFIRMATION" : "Kilépés a változások eldobásával. Jóváhagyja?", + "Re-check" : "Újraellenőrzés", + "Replace all" : "Mind cseréje", + "Replace with" : "Csere a következőre:", + "Replace" : "Csere", + "SC-spell-check" : "Helyesírásellenőrzés", + "Suggestions" : "Tippek", + "pliz weit ;-)" : "Kis türelmet ;-)" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/it.js b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/it.js new file mode 100644 index 0000000000..0af5f7705f --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/it.js @@ -0,0 +1,28 @@ +// I18N constants + +// LANG: "it", ENCODING: UTF-8 | ISO-8859-1 +// Author: Fabio Rotondo, + +SpellChecker.I18N = { + "CONFIRM_LINK_CLICK" : "Devi confermare l'apertura di questo link", + "Cancel" : "Annulla", + "Dictionary" : "Dizionario", + "Finished list of mispelled words" : "La lista delle parole scritte male è terminata", + "I will open it in a new page." : "Lo aprirò in una nuova pagina.", + "Ignore all" : "Ignora sempre", + "Ignore" : "Ignora", + "NO_ERRORS" : "Non sono state trovate parole scritte male con il dizionario selezionato.", + "NO_ERRORS_CLOSING" : "Controllo completato, non sono state trovate parole scritte male. Sto chiudendo...", + "OK" : "OK", + "Original word" : "Parola originale", + "Please wait. Calling spell checker." : "Attendere. Sto invocando lo Spell Checker.", + "Please wait: changing dictionary to" : "Attendere. Cambio il dizionario in", + "QUIT_CONFIRMATION" : "Questo annullerà le modifiche e chiuderà lo Spell Checker. Conferma.", + "Re-check" : "Ricontrolla", + "Replace all" : "Sostituisci sempre", + "Replace with" : "Stostituisci con", + "Replace" : "Sostituisci", + "SC-spell-check" : "Spell-check", + "Suggestions" : "Suggerimenti", + "pliz weit ;-)" : "Attendere Prego ;-)" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/makefile.xml b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/makefile.xml new file mode 100644 index 0000000000..0d645c96b3 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/makefile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/ro.js b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/ro.js new file mode 100644 index 0000000000..d8e96b9be2 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/lang/ro.js @@ -0,0 +1,37 @@ +// I18N constants + +// LANG: "ro", ENCODING: UTF-8 +// Author: Mihai Bazon, http://dynarch.com/mishoo + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +SpellChecker.I18N = { + "CONFIRM_LINK_CLICK" : "Vă rog confirmaţi că vreţi să deschideţi acest link", + "Cancel" : "Anulează", + "Dictionary" : "Dicţionar", + "Finished list of mispelled words" : "Am terminat lista de cuvinte greşite", + "I will open it in a new page." : "O voi deschide într-o altă fereastră.", + "Ignore all" : "Ignoră toate", + "Ignore" : "Ignoră", + "NO_ERRORS" : "Nu am găsit nici un cuvânt greşit cu acest dicţionar.", + "NO_ERRORS_CLOSING" : "Am terminat, nu am detectat nici o greşeală. Acum închid fereastra...", + "OK" : "OK", + "Original word" : "Cuvântul original", + "Please wait. Calling spell checker." : "Vă rog aşteptaţi. Apelez spell-checker-ul.", + "Please wait: changing dictionary to" : "Vă rog aşteptaţi. Schimb dicţionarul cu", + "QUIT_CONFIRMATION" : "Doriţi să renunţaţi la modificări şi să închid spell-checker-ul?", + "Re-check" : "Scanează", + "Replace all" : "Înlocuieşte toate", + "Replace with" : "Înlocuieşte cu", + "Replace" : "Înlocuieşte", + "SC-spell-check" : "Detectează greşeli", + "Suggestions" : "Sugestii", + "pliz weit ;-)" : "va rog ashteptatzi ;-)" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/makefile.xml b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/makefile.xml new file mode 100644 index 0000000000..cf040f5d78 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/makefile.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/readme-tech.html b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/readme-tech.html new file mode 100644 index 0000000000..1afdf6d3f8 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/readme-tech.html @@ -0,0 +1,114 @@ + + + + HTMLArea Spell Checker + + + +

HTMLArea Spell Checker

+ +

The HTMLArea Spell Checker subsystem consists of the following + files:

+ +
    + +
  • spell-checker.js — the spell checker plugin interface for + HTMLArea
  • + +
  • spell-checker-ui.html — the HTML code for the user + interface
  • + +
  • spell-checker-ui.js — functionality of the user + interface
  • + +
  • spell-checker-logic.cgi — Perl CGI script that checks a text + given through POST for spelling errors
  • + +
  • spell-checker-style.css — style for mispelled words
  • + +
  • lang/en.js — main language file (English).
  • + +
+ +

Process overview

+ +

+ When an end-user clicks the "spell-check" button in the HTMLArea + editor, a new window is opened with the URL of "spell-check-ui.html". + This window initializes itself with the text found in the editor (uses + window.opener.SpellChecker.editor global variable) and it + submits the text to the server-side script "spell-check-logic.cgi". + The target of the FORM is an inline frame which is used both to + display the text and correcting. +

+ +

+ Further, spell-check-logic.cgi calls Aspell for each portion of plain + text found in the given HTML. It rebuilds an HTML file that contains + clear marks of which words are incorrect, along with suggestions for + each of them. This file is then loaded in the inline frame. Upon + loading, a JavaScript function from "spell-check-ui.js" is called. + This function will retrieve all mispelled words from the HTML of the + iframe and will setup the user interface so that it allows correction. +

+ +

The server-side script (spell-check-logic.cgi)

+ +

+ Unicode safety — the program is + Unicode safe. HTML entities are expanded into their corresponding + Unicode characters. These characters will be matched as part of the + word passed to Aspell. All texts passed to Aspell are in Unicode + (when appropriate). However, Aspell seems to not support Unicode + yet (thread concerning Aspell and Unicode). + This mean that words containing Unicode + characters that are not in 0..255 are likely to be reported as "mispelled" by Aspell. +

+ +

+ Update: though I've never seen it mentioned + anywhere, it looks that Aspell does, in fact, speak + Unicode. Or else, maybe Text::Aspell does + transparent conversion; anyway, this new version of our + SpellChecker plugin is, as tests show so far, fully + Unicode-safe... well, probably the only freeware + Web-based spell-checker which happens to have Unicode support. +

+ +

+ The Perl Unicode manual (man perluniintro) states: +

+ +
+ + Starting from Perl 5.6.0, Perl has had the capacity to handle Unicode + natively. Perl 5.8.0, however, is the first recommended release for + serious Unicode work. The maintenance release 5.6.1 fixed many of the + problems of the initial Unicode implementation, but for example regular + expressions still do not work with Unicode in 5.6.1. + +
+ +

In other words, do not assume that this script is + Unicode-safe on Perl interpreters older than 5.8.0.

+ +

The following Perl modules are required:

+ + + +

Of these, only Text::Aspell might need to be installed manually. The + others are likely to be available by default in most Perl distributions.

+ +
+
Mihai Bazon
+ + Last modified: Fri Jan 30 19:14:11 EET 2004 + + + diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-logic.cgi b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-logic.cgi new file mode 100644 index 0000000000..4a1256ba08 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-logic.cgi @@ -0,0 +1,210 @@ +#! /usr/bin/perl -w + +# Spell Checker Plugin for HTMLArea-3.0 +# Sponsored by www.americanbible.org +# Implementation by Mihai Bazon, http://dynarch.com/mishoo/ +# +# (c) dynarch.com 2003. +# Distributed under the same terms as HTMLArea itself. +# This notice MUST stay intact for use (see license.txt). +# +# $Id: spell-check-logic.cgi,v 1.10 2004/01/31 13:47:05 mishoo Exp $ + +use strict; +use utf8; +use Encode; +use Text::Aspell; +use XML::DOM; +use CGI; + +my $TIMER_start = undef; +eval { + use Time::HiRes qw( gettimeofday tv_interval ); + $TIMER_start = [gettimeofday()]; +}; +# use POSIX qw( locale_h ); + +binmode STDIN, ':utf8'; +binmode STDOUT, ':utf8'; + +my $debug = 0; + +my $speller = new Text::Aspell; +my $cgi = new CGI; + +my $total_words = 0; +my $total_mispelled = 0; +my $total_suggestions = 0; +my $total_words_suggested = 0; + +# FIXME: report a nice error... +die "Can't create speller!" unless $speller; + +my $dict = $cgi->param('dictionary') || $cgi->cookie('dictionary') || 'en'; + +# add configurable option for this +$speller->set_option('lang', $dict); +$speller->set_option('encoding', 'UTF-8'); +#setlocale(LC_CTYPE, $dict); + +# ultra, fast, normal, bad-spellers +# bad-spellers seems to cause segmentation fault +$speller->set_option('sug-mode', 'normal'); + +my %suggested_words = (); +keys %suggested_words = 128; + +my $file_content = decode('UTF-8', $cgi->param('content')); +$file_content = parse_with_dom($file_content); + +my $ck_dictionary = $cgi->cookie(-name => 'dictionary', + -value => $dict, + -expires => '+30d'); + +print $cgi->header(-type => 'text/html; charset: utf-8', + -cookie => $ck_dictionary); + +my $js_suggested_words = make_js_hash(\%suggested_words); +my $js_spellcheck_info = make_js_hash_from_array + ([ + [ 'Total words' , $total_words ], + [ 'Mispelled words' , $total_mispelled . ' in dictionary \"'.$dict.'\"' ], + [ 'Total suggestions' , $total_suggestions ], + [ 'Total words suggested' , $total_words_suggested ], + [ 'Spell-checked in' , defined $TIMER_start ? (tv_interval($TIMER_start) . ' seconds') : 'n/a' ] + ]); + +print qq^ + + + + + + +^; + +print $file_content; +if ($cgi->param('init') eq '1') { + my @dicts = $speller->dictionary_info(); + my $dictionaries = ''; + foreach my $i (@dicts) { + next if $i->{jargon}; + my $name = $i->{name}; + if ($name eq $dict) { + $name = '@'.$name; + } + $dictionaries .= ',' . $name; + } + $dictionaries =~ s/^,//; + print qq^
$dictionaries
^; +} + +print ''; + +# Perl is beautiful. +sub spellcheck { + my $node = shift; + my $doc = $node->getOwnerDocument; + my $check = sub { # called for each word in the text + # input is in UTF-8 + my $word = shift; + my $already_suggested = defined $suggested_words{$word}; + ++$total_words; + if (!$already_suggested && $speller->check($word)) { + return undef; + } else { + # we should have suggestions; give them back to browser in UTF-8 + ++$total_mispelled; + if (!$already_suggested) { + # compute suggestions for this word + my @suggestions = $speller->suggest($word); + my $suggestions = decode($speller->get_option('encoding'), join(',', @suggestions)); + $suggested_words{$word} = $suggestions; + ++$total_suggestions; + $total_words_suggested += scalar @suggestions; + } + # HA-spellcheck-error + my $err = $doc->createElement('span'); + $err->setAttribute('class', 'HA-spellcheck-error'); + my $tmp = $doc->createTextNode; + $tmp->setNodeValue($word); + $err->appendChild($tmp); + return $err; + } + }; + while ($node->getNodeValue =~ /([\p{IsWord}']+)/) { + my $word = $1; + my $before = $`; + my $after = $'; + my $df = &$check($word); + if (!$df) { + $before .= $word; + } + { + my $parent = $node->getParentNode; + my $n1 = $doc->createTextNode; + $n1->setNodeValue($before); + $parent->insertBefore($n1, $node); + $parent->insertBefore($df, $node) if $df; + $node->setNodeValue($after); + } + } +}; + +sub check_inner_text { + my $node = shift; + my $text = ''; + for (my $i = $node->getFirstChild; defined $i; $i = $i->getNextSibling) { + if ($i->getNodeType == TEXT_NODE) { + spellcheck($i); + } + } +}; + +sub parse_with_dom { + my ($text) = @_; + $text = ''.$text.''; + + my $parser = new XML::DOM::Parser; + if ($debug) { + open(FOO, '>:utf8', '/tmp/foo'); + print FOO $text; + close FOO; + } + my $doc = $parser->parse($text); + my $nodes = $doc->getElementsByTagName('*'); + my $n = $nodes->getLength; + + for (my $i = 0; $i < $n; ++$i) { + my $node = $nodes->item($i); + if ($node->getNodeType == ELEMENT_NODE) { + check_inner_text($node); + } + } + + my $ret = $doc->toString; + $ret =~ s{(.*)}{$1}sg; + return $ret; +}; + +sub make_js_hash { + my ($hash) = @_; + my $js_hash = ''; + while (my ($key, $val) = each %$hash) { + $js_hash .= ',' if $js_hash; + $js_hash .= '"'.$key.'":"'.$val.'"'; + } + return $js_hash; +}; + +sub make_js_hash_from_array { + my ($array) = @_; + my $js_hash = ''; + foreach my $i (@$array) { + $js_hash .= ',' if $js_hash; + $js_hash .= '"'.$i->[0].'":"'.$i->[1].'"'; + } + return $js_hash; +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-style.css b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-style.css new file mode 100644 index 0000000000..1408ba0626 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-style.css @@ -0,0 +1,10 @@ +.HA-spellcheck-error { border-bottom: 1px dashed #f00; cursor: default; } +.HA-spellcheck-same { background-color: #cef; color: #000; } +.HA-spellcheck-hover { background-color: #433; color: white; } +.HA-spellcheck-fixed { border-bottom: 1px dashed #0b8; } +.HA-spellcheck-current { background-color: #9be; color: #000; } +.HA-spellcheck-suggestions { display: none; } + +#HA-spellcheck-dictionaries { display: none; } + +a:link, a:visited { color: #55e; } diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-ui.html b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-ui.html new file mode 100644 index 0000000000..a008bf47d9 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-ui.html @@ -0,0 +1,122 @@ + + + + + Spell Checker + + + + + + + + + +
+ + + + + + + + + + + + + +
+
Dictionary + + +
+ Please wait. Calling spell checker. +
+
+ +
+
Original word
+
pliz weit ;-)
+
+ +
+
Replace with
+
+
+
+
+
+
+
Suggestions
+
+ +
+
+ +
+
+ + +
+
+
+ + + + diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-ui.js b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-ui.js new file mode 100644 index 0000000000..7bea11f307 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-check-ui.js @@ -0,0 +1,397 @@ +// Spell Checker Plugin for HTMLArea-3.0 +// Sponsored by www.americanbible.org +// Implementation by Mihai Bazon, http://dynarch.com/mishoo/ +// +// (c) dynarch.com 2003. +// Distributed under the same terms as HTMLArea itself. +// This notice MUST stay intact for use (see license.txt). +// +// $Id: spell-check-ui.js 30938 2004-07-29 19:08:16Z vgritsenko $ + +// internationalization file was already loaded in parent ;-) +var SpellChecker = window.opener.SpellChecker; +var i18n = SpellChecker.I18N; + +var HTMLArea = window.opener.HTMLArea; +var is_ie = HTMLArea.is_ie; +var editor = SpellChecker.editor; +var frame = null; +var currentElement = null; +var wrongWords = null; +var modified = false; +var allWords = {}; +var fixedWords = []; +var suggested_words = {}; + +function makeCleanDoc(leaveFixed) { + // document.getElementById("status").innerHTML = 'Please wait: rendering valid HTML'; + var words = wrongWords.concat(fixedWords); + for (var i = words.length; --i >= 0;) { + var el = words[i]; + if (!(leaveFixed && /HA-spellcheck-fixed/.test(el.className))) { + el.parentNode.insertBefore(el.firstChild, el); + el.parentNode.removeChild(el); + } else + el.className = "HA-spellcheck-fixed"; + } + // we should use innerHTML here, but IE6's implementation fucks up the + // HTML to such extent that our poor Perl parser doesn't understand it + // anymore. + return window.opener.HTMLArea.getHTML(frame.contentWindow.document.body, false, editor); +}; + +function recheckClicked() { + document.getElementById("status").innerHTML = i18n["Please wait: changing dictionary to"] + ': "' + document.getElementById("f_dictionary").value + '".'; + var field = document.getElementById("f_content"); + field.value = makeCleanDoc(true); + field.form.submit(); +}; + +function saveClicked() { + if (modified) { + editor.setHTML(makeCleanDoc(false)); + } + window.close(); + return false; +}; + +function cancelClicked() { + var ok = true; + if (modified) { + ok = confirm(i18n["QUIT_CONFIRMATION"]); + } + if (ok) { + window.close(); + } + return false; +}; + +function replaceWord(el) { + var replacement = document.getElementById("v_replacement").value; + var this_word_modified = (el.innerHTML != replacement); + if (this_word_modified) + modified = true; + if (el) { + el.className = el.className.replace(/\s*HA-spellcheck-(hover|fixed)\s*/g, " "); + } + el.className += " HA-spellcheck-fixed"; + el.__msh_fixed = true; + if (!this_word_modified) { + return false; + } + el.innerHTML = replacement; +}; + +function replaceClicked() { + replaceWord(currentElement); + var start = currentElement.__msh_id; + var index = start; + do { + ++index; + if (index == wrongWords.length) { + index = 0; + } + } while ((index != start) && wrongWords[index].__msh_fixed); + if (index == start) { + index = 0; + alert(i18n["Finished list of mispelled words"]); + } + wrongWords[index].__msh_wordClicked(true); + return false; +}; + +function revertClicked() { + document.getElementById("v_replacement").value = currentElement.__msh_origWord; + replaceWord(currentElement); + currentElement.className = "HA-spellcheck-error HA-spellcheck-current"; + return false; +}; + +function replaceAllClicked() { + var replacement = document.getElementById("v_replacement").value; + var ok = true; + var spans = allWords[currentElement.__msh_origWord]; + if (spans.length == 0) { + alert("An impossible condition just happened. Call FBI. ;-)"); + } else if (spans.length == 1) { + replaceClicked(); + return false; + } + /* + var message = "The word \"" + currentElement.__msh_origWord + "\" occurs " + spans.length + " times.\n"; + if (replacement == currentElement.__msh_origWord) { + ok = confirm(message + "Ignore all occurrences?"); + } else { + ok = confirm(message + "Replace all occurrences with \"" + replacement + "\"?"); + } + */ + if (ok) { + for (var i in spans) { + if (spans[i] != currentElement) { + replaceWord(spans[i]); + } + } + // replace current element the last, so that we jump to the next word ;-) + replaceClicked(); + } + return false; +}; + +function ignoreClicked() { + document.getElementById("v_replacement").value = currentElement.__msh_origWord; + replaceClicked(); + return false; +}; + +function ignoreAllClicked() { + document.getElementById("v_replacement").value = currentElement.__msh_origWord; + replaceAllClicked(); + return false; +}; + +function learnClicked() { + alert("Not [yet] implemented"); + return false; +}; + +function internationalizeWindow() { + var types = ["div", "span", "button"]; + for (var i in types) { + var tag = types[i]; + var els = document.getElementsByTagName(tag); + for (var j = els.length; --j >= 0;) { + var el = els[j]; + if (el.childNodes.length == 1 && /\S/.test(el.innerHTML)) { + var txt = el.innerHTML; + if (typeof i18n[txt] != "undefined") { + el.innerHTML = i18n[txt]; + } + } + } + } +}; + +function initDocument() { + internationalizeWindow(); + modified = false; + frame = document.getElementById("i_framecontent"); + var field = document.getElementById("f_content"); + field.value = HTMLArea.getHTML(editor._doc.body, false, editor); + field.form.submit(); + document.getElementById("f_init").value = "0"; + + // assign some global event handlers + + var select = document.getElementById("v_suggestions"); + select.onchange = function() { + document.getElementById("v_replacement").value = this.value; + }; + if (is_ie) { + select.attachEvent("ondblclick", replaceClicked); + } else { + select.addEventListener("dblclick", replaceClicked, true); + } + + document.getElementById("b_replace").onclick = replaceClicked; + // document.getElementById("b_learn").onclick = learnClicked; + document.getElementById("b_replall").onclick = replaceAllClicked; + document.getElementById("b_ignore").onclick = ignoreClicked; + document.getElementById("b_ignall").onclick = ignoreAllClicked; + document.getElementById("b_recheck").onclick = recheckClicked; + document.getElementById("b_revert").onclick = revertClicked; + document.getElementById("b_info").onclick = displayInfo; + + document.getElementById("b_ok").onclick = saveClicked; + document.getElementById("b_cancel").onclick = cancelClicked; + + select = document.getElementById("v_dictionaries"); + select.onchange = function() { + document.getElementById("f_dictionary").value = this.value; + }; +}; + +function getAbsolutePos(el) { + var r = { x: el.offsetLeft, y: el.offsetTop }; + if (el.offsetParent) { + var tmp = getAbsolutePos(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; +}; + +function wordClicked(scroll) { + var self = this; + if (scroll) (function() { + var pos = getAbsolutePos(self); + var ws = { x: frame.offsetWidth - 4, + y: frame.offsetHeight - 4 }; + var wp = { x: frame.contentWindow.document.body.scrollLeft, + y: frame.contentWindow.document.body.scrollTop }; + pos.x -= Math.round(ws.x/2); + if (pos.x < 0) pos.x = 0; + pos.y -= Math.round(ws.y/2); + if (pos.y < 0) pos.y = 0; + frame.contentWindow.scrollTo(pos.x, pos.y); + })(); + if (currentElement) { + var a = allWords[currentElement.__msh_origWord]; + currentElement.className = currentElement.className.replace(/\s*HA-spellcheck-current\s*/g, " "); + for (var i in a) { + var el = a[i]; + if (el != currentElement) { + el.className = el.className.replace(/\s*HA-spellcheck-same\s*/g, " "); + } + } + } + currentElement = this; + this.className += " HA-spellcheck-current"; + var a = allWords[currentElement.__msh_origWord]; + for (var i in a) { + var el = a[i]; + if (el != currentElement) { + el.className += " HA-spellcheck-same"; + } + } + // document.getElementById("b_replall").disabled = (a.length <= 1); + // document.getElementById("b_ignall").disabled = (a.length <= 1); + var txt; + if (a.length == 1) { + txt = "one occurrence"; + } else if (a.length == 2) { + txt = "two occurrences"; + } else { + txt = a.length + " occurrences"; + } + var suggestions = suggested_words[this.__msh_origWord]; + if (suggestions) + suggestions = suggestions.split(/,/); + else + suggestions = []; + var select = document.getElementById("v_suggestions"); + document.getElementById("statusbar").innerHTML = "Found " + txt + + ' for word "' + currentElement.__msh_origWord + '"'; + for (var i = select.length; --i >= 0;) { + select.remove(i); + } + for (var i = 0; i < suggestions.length; ++i) { + var txt = suggestions[i]; + var option = document.createElement("option"); + option.value = txt; + option.appendChild(document.createTextNode(txt)); + select.appendChild(option); + } + document.getElementById("v_currentWord").innerHTML = this.__msh_origWord; + if (suggestions.length > 0) { + select.selectedIndex = 0; + select.onchange(); + } else { + document.getElementById("v_replacement").value = this.innerHTML; + } + select.style.display = "none"; + select.style.display = "block"; + return false; +}; + +function wordMouseOver() { + this.className += " HA-spellcheck-hover"; +}; + +function wordMouseOut() { + this.className = this.className.replace(/\s*HA-spellcheck-hover\s*/g, " "); +}; + +function displayInfo() { + var info = frame.contentWindow.spellcheck_info; + if (!info) + alert("No information available"); + else { + var txt = "** Document information **"; + for (var i in info) { + txt += "\n" + i + " : " + info[i]; + } + alert(txt); + } + return false; +}; + +function finishedSpellChecking() { + // initialization of global variables + currentElement = null; + wrongWords = null; + allWords = {}; + fixedWords = []; + suggested_words = frame.contentWindow.suggested_words; + + document.getElementById("status").innerHTML = "HTMLArea Spell Checker (info)"; + var doc = frame.contentWindow.document; + var spans = doc.getElementsByTagName("span"); + var sps = []; + var id = 0; + for (var i = 0; i < spans.length; ++i) { + var el = spans[i]; + if (/HA-spellcheck-error/.test(el.className)) { + sps.push(el); + el.__msh_wordClicked = wordClicked; + el.onclick = function(ev) { + ev || (ev = window.event); + ev && HTMLArea._stopEvent(ev); + return this.__msh_wordClicked(false); + }; + el.onmouseover = wordMouseOver; + el.onmouseout = wordMouseOut; + el.__msh_id = id++; + var txt = (el.__msh_origWord = el.firstChild.data); + el.__msh_fixed = false; + if (typeof allWords[txt] == "undefined") { + allWords[txt] = [el]; + } else { + allWords[txt].push(el); + } + } else if (/HA-spellcheck-fixed/.test(el.className)) { + fixedWords.push(el); + } + } + wrongWords = sps; + if (sps.length == 0) { + if (!modified) { + alert(i18n["NO_ERRORS_CLOSING"]); + window.close(); + } else { + alert(i18n["NO_ERRORS"]); + } + return false; + } + (currentElement = sps[0]).__msh_wordClicked(true); + var as = doc.getElementsByTagName("a"); + for (var i = as.length; --i >= 0;) { + var a = as[i]; + a.onclick = function() { + if (confirm(i18n["CONFIRM_LINK_CLICK"] + ":\n" + + this.href + "\n" + i18n["I will open it in a new page."])) { + window.open(this.href); + } + return false; + }; + } + var dicts = doc.getElementById("HA-spellcheck-dictionaries"); + if (dicts) { + dicts.parentNode.removeChild(dicts); + dicts = dicts.innerHTML.split(/,/); + var select = document.getElementById("v_dictionaries"); + for (var i = select.length; --i >= 0;) { + select.remove(i); + } + for (var i = 0; i < dicts.length; ++i) { + var txt = dicts[i]; + var option = document.createElement("option"); + if (/^@(.*)$/.test(txt)) { + txt = RegExp.$1; + option.selected = true; + } + option.value = txt; + option.appendChild(document.createTextNode(txt)); + select.appendChild(option); + } + } +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-checker.js b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-checker.js new file mode 100644 index 0000000000..646969e383 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/SpellChecker/spell-checker.js @@ -0,0 +1,79 @@ +// Spell Checker Plugin for HTMLArea-3.0 +// Sponsored by www.americanbible.org +// Implementation by Mihai Bazon, http://dynarch.com/mishoo/ +// +// (c) dynarch.com 2003. +// Distributed under the same terms as HTMLArea itself. +// This notice MUST stay intact for use (see license.txt). +// +// $Id: spell-checker.js 30938 2004-07-29 19:08:16Z vgritsenko $ + +function SpellChecker(editor) { + this.editor = editor; + + var cfg = editor.config; + var tt = SpellChecker.I18N; + var bl = SpellChecker.btnList; + var self = this; + + // register the toolbar buttons provided by this plugin + var toolbar = []; + for (var i in bl) { + var btn = bl[i]; + if (!btn) { + toolbar.push("separator"); + } else { + var id = "SC-" + btn[0]; + cfg.registerButton(id, tt[id], editor.imgURL(btn[0] + ".gif", "SpellChecker"), false, + function(editor, id) { + // dispatch button press event + self.buttonPress(editor, id); + }, btn[1]); + toolbar.push(id); + } + } + + for (var i in toolbar) { + cfg.toolbar[0].push(toolbar[i]); + } +}; + +SpellChecker._pluginInfo = { + name : "SpellChecker", + version : "1.0", + developer : "Mihai Bazon", + developer_url : "http://dynarch.com/mishoo/", + c_owner : "Mihai Bazon", + sponsor : "American Bible Society", + sponsor_url : "http://www.americanbible.org", + license : "htmlArea" +}; + +SpellChecker.btnList = [ + null, // separator + ["spell-check"] + ]; + +SpellChecker.prototype.buttonPress = function(editor, id) { + switch (id) { + case "SC-spell-check": + SpellChecker.editor = editor; + SpellChecker.init = true; + var uiurl = _editor_url + "plugins/SpellChecker/spell-check-ui.html"; + var win; + if (HTMLArea.is_ie) { + win = window.open(uiurl, "SC_spell_checker", + "toolbar=no,location=no,directories=no,status=no,menubar=no," + + "scrollbars=no,resizable=yes,width=600,height=450"); + } else { + win = window.open(uiurl, "SC_spell_checker", + "toolbar=no,menubar=no,personalbar=no,width=600,height=450," + + "scrollbars=no,resizable=yes"); + } + win.focus(); + break; + } +}; + +// this needs to be global, it's accessed from spell-check-ui.html +SpellChecker.editor = null; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-delete.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-delete.gif new file mode 100644 index 0000000000..df9594f44f Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-delete.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-insert-after.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-insert-after.gif new file mode 100644 index 0000000000..6ff2154baf Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-insert-after.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-insert-before.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-insert-before.gif new file mode 100644 index 0000000000..632b315c41 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-insert-before.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-merge.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-merge.gif new file mode 100644 index 0000000000..35e4af1077 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-merge.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-prop.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-prop.gif new file mode 100644 index 0000000000..2f71bae6f8 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-prop.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-split.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-split.gif new file mode 100644 index 0000000000..8bd011e194 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/cell-split.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-delete.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-delete.gif new file mode 100644 index 0000000000..565afdc523 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-delete.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-insert-after.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-insert-after.gif new file mode 100644 index 0000000000..648e54f018 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-insert-after.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-insert-before.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-insert-before.gif new file mode 100644 index 0000000000..9be8a6e4e9 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-insert-before.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-split.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-split.gif new file mode 100644 index 0000000000..83f21d14b3 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/col-split.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/makefile.xml b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/makefile.xml new file mode 100644 index 0000000000..19e075f892 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/makefile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-delete.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-delete.gif new file mode 100644 index 0000000000..e649d9f5c8 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-delete.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-insert-above.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-insert-above.gif new file mode 100644 index 0000000000..e39c948b03 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-insert-above.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-insert-under.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-insert-under.gif new file mode 100644 index 0000000000..200535855f Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-insert-under.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-prop.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-prop.gif new file mode 100644 index 0000000000..76397253fb Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-prop.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-split.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-split.gif new file mode 100644 index 0000000000..0df4697de6 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/row-split.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/table-prop.gif b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/table-prop.gif new file mode 100644 index 0000000000..e15a4a4445 Binary files /dev/null and b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/img/table-prop.gif differ diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/cz.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/cz.js new file mode 100644 index 0000000000..d407dae007 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/cz.js @@ -0,0 +1,90 @@ +// I18N constants + +// LANG: "cz", ENCODING: UTF-8 | ISO-8859-2 +// Author: Jiri Löw, + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +TableOperations.I18N = { + "Align": "Zarovnání", + "All four sides": "VÅ¡echny čtyři strany", + "Background": "Pozadí", + "Baseline": "Základní linka", + "Border": "Obrys", + "Borders": "Obrysy", + "Bottom": "Dolů", + "CSS Style": "Kaskádové styly (CSS)", + "Caption": "Titulek", + "Cell Properties": "Vlastnosti buňky", + "Center": "Na střed", + "Char": "Znak", + "Collapsed borders": "Stlačené okraje", + "Color": "Barva", + "Description": "Popis", + "FG Color": "Barva popředí", + "Float": "Obtékání", + "Frames": "Rámečky", + "Height": "Výška", + "How many columns would you like to merge?": "Kolik sloupců si přejete spojit?", + "How many rows would you like to merge?": "Kolik řádků si přejete spojit?", + "Image URL": "Adresa obrázku", + "Justify": "Do stran", + "Layout": "Rozložení", + "Left": "Vlevo", + "Margin": "Okraj", + "Middle": "Na střed", + "No rules": "Žádné čáry", + "No sides": "Žádné strany", + "None": "Žádné", + "Padding": "Odsazování", + "Please click into some cell": "Prosím klikněte do některé buňky", + "Right": "Vpravo", + "Row Properties": "Vlastnosti řádku", + "Rules will appear between all rows and columns": "Čáry mezi vÅ¡emi řádky i sloupci", + "Rules will appear between columns only": "Čáry pouze mezi sloupci", + "Rules will appear between rows only": "Čáry pouze mezi řádky", + "Rules": "Čáry", + "Spacing and padding": "Mezery a odsazování", + "Spacing": "Mezery", + "Summary": "Shrnutí", + "TO-cell-delete": "Smazat buňku", + "TO-cell-insert-after": "Vložit buňku za", + "TO-cell-insert-before": "Vložit buňku před", + "TO-cell-merge": "Spojit buňky", + "TO-cell-prop": "Vlastnosti buňky", + "TO-cell-split": "Rozdělit buňku", + "TO-col-delete": "Smazat sloupec", + "TO-col-insert-after": "Vložit sloupec za", + "TO-col-insert-before": "Vložit sloupec před", + "TO-col-split": "Rozdělit sloupec", + "TO-row-delete": "Smazat řádek", + "TO-row-insert-above": "Smazat řádek nad", + "TO-row-insert-under": "Smazat řádek pod", + "TO-row-prop": "Vlastnosti řádku", + "TO-row-split": "Rozdělit řádek", + "TO-table-prop": "Vlastnosti tabulky", + "Table Properties": "Vlastnosti tabulky", + "Text align": "Zarovnání textu", + "The bottom side only": "Pouze spodní strana", + "The left-hand side only": "Pouze levá strana", + "The right and left sides only": "Pouze levá a pravá strana", + "The right-hand side only": "Pouze pravá strana", + "The top and bottom sides only": "Pouze horní a dolní strana", + "The top side only": "Pouze horní strana", + "Top": "Nahoru", + "Unset color": "ZruÅ¡it barvu", + "Vertical align": "Svislé zarovnání", + "Width": "Šířka", + "not-del-last-cell": "HTMLArea zbaběle odmítá smazat poslední buňku v řádku.", + "not-del-last-col": "HTMLArea zbaběle odmítá smazat poslední sloupec v tabulce.", + "not-del-last-row": "HTMLArea zbaběle odmítá smazat poslední řádek v tabulce.", + "percent": "procent", + "pixels": "pixelů" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/da.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/da.js new file mode 100644 index 0000000000..08a6f1b117 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/da.js @@ -0,0 +1,90 @@ +// I18N constants + +// LANG: "da", ENCODING: UTF-8 | ISO-8859-1 +// Author: Steen Sønderup, + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +TableOperations.I18N = { + "Align": "Placer", + "All four sides": "Alle fire sider", + "Background": "Baggrund", + "Baseline": "Bundlinie", + "Border": "Kant", + "Borders": "Kanter", + "Bottom": "Bund", + "CSS Style": "Stil [CSS]", + "Caption": "Titel", + "Cell Properties": "Celle egenskaber", + "Center": "Centrer", + "Char": "Plads", + "Collapsed borders": "Sammensmelt rammer", + "Color": "Farve", + "Description": "Beskrivelse", + "FG Color": "Font farve", + "Float": "Justering", + "Frames": "Udvendig", + "Height": "Højde", + "How many columns would you like to merge?": "Hvor mange kollonner vil du samle?", + "How many rows would you like to merge?": "Hvor mange rækker vil du samle?", + "Image URL": "Billede URL", + "Justify": "Lige margener", + "Layout": "Opsætning", + "Left": "Venstre", + "Margin": "Margen", + "Middle": "Centrer", + "No rules": "Ingen rammer", + "No sides": "Ingen sider", + "None": "Ingen", + "Padding": "Margen", + "Please click into some cell": "Klik pÃ¥ en celle", + "Right": "Højre", + "Row Properties": "Række egenskaber", + "Rules will appear between all rows and columns": "Rammer mellem rækker og kolonner", + "Rules will appear between columns only": "Kun rammer mellem kolonner", + "Rules will appear between rows only": "Kun rammer mellem rækker", + "Rules": "Invendig", + "Spacing and padding": "Afstand og margen", + "Spacing": "Afstand", + "Summary": "Beskrivelse", + "TO-cell-delete": "Slet celle", + "TO-cell-insert-after": "Indsæt celle efter", + "TO-cell-insert-before": "Indsæt celle før", + "TO-cell-merge": "Sammensæt celler", + "TO-cell-prop": "Celle egenskaber", + "TO-cell-split": "Opdel celle", + "TO-col-delete": "Slet kollonne", + "TO-col-insert-after": "Indsæt kolonne efter", + "TO-col-insert-before": "Indsæt kolonne før", + "TO-col-split": "Opdel kolonne", + "TO-row-delete": "Slet række", + "TO-row-insert-above": "Indsæt række før", + "TO-row-insert-under": "Indsæt række efter", + "TO-row-prop": "Række egenskaber", + "TO-row-split": "Opdel række", + "TO-table-prop": "Tabel egenskaber", + "Table Properties": "Tabel egenskaber", + "Text align": "Tekst", + "The bottom side only": "Kun i bunden", + "The left-hand side only": "Kun i højre side", + "The right and left sides only": "Kun i siderne", + "The right-hand side only": "Kun i venstre side", + "The top and bottom sides only": "Kun i top og bund", + "The top side only": "Kun i toppen", + "Top": "Top", + "Unset color": "Farve ikke valgt", + "Vertical align": "Vertikal placering", + "Width": "Bredde", + "not-del-last-cell": "Du kan ikke slette den sidste celle i en række.", + "not-del-last-col": "Du kan ikke slette den sidste kolonne i en tabel.", + "not-del-last-row": "Du kan ikke slette den sidste række i en tabel.", + "percent": "procent", + "pixels": "pixel" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/de.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/de.js new file mode 100644 index 0000000000..1128cff6fb --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/de.js @@ -0,0 +1,81 @@ +// I18N constants + +// LANG: "de", ENCODING: UTF-8 | ISO-8859-1 +// Author: broxx, + +TableOperations.I18N = { + "Align": "Ausrichten", + "All four sides": "Alle 4 Seiten", + "Background": "Hintergrund", + "Baseline": "Basislinie", + "Border": "Rand", + "Borders": "Raender", + "Bottom": "Unten", + "CSS Style": "Style [CSS]", + "Caption": "Ueberschrift", + "Cell Properties": "Zellen", + "Center": "Zentrieren", + "Char": "Zeichen", + "Collapsed borders": "Collapsed borders", + "Color": "Farbe", + "Description": "Beschreibung", + "FG Color": "FG Farbe", + "Float": "Ausrichtung", + "Frames": "Rahmen", + "Height": "Hoehe", + "How many columns would you like to merge?": "Wieviele Spalten willst du verbinden?", + "How many rows would you like to merge?": "Wieviele Zeilen willst du verbinden?", + "Image URL": "Bild URL", + "Justify": "Justieren", + "Layout": "Layout", + "Left": "Links", + "Margin": "Rand", + "Middle": "Mitte", + "No rules": "Keine Balken", + "No sides": "Keine Seiten", + "None": "Keine", + "Padding": "Auffuellung", + "Please click into some cell": "Waehle eine Zelle", + "Right": "Rechts", + "Row Properties": "Reihen", + "Rules will appear between all rows and columns": "Balken zwischen Reihen und Spalten", + "Rules will appear between columns only": "Balken zwischen Spalten", + "Rules will appear between rows only": "Balken zwischen Reihen", + "Rules": "Balken", + "Spacing and padding": "Abstaende", + "Spacing": "Abstand", + "Summary": "Zusammenfassung", + "TO-cell-delete": "Zelle loeschen", + "TO-cell-insert-after": "Zelle einfuegen nach", + "TO-cell-insert-before": "Zelle einfuegen bevor", + "TO-cell-merge": "Zellen zusammenfuegen", + "TO-cell-prop": "Zelleinstellungen", + "TO-cell-split": "Zellen aufteilen", + "TO-col-delete": "Spalte loeschen", + "TO-col-insert-after": "Spalte einfuegen nach", + "TO-col-insert-before": "Spalte einfuegen bevor", + "TO-col-split": "Spalte aufteilen", + "TO-row-delete": "Reihe loeschen", + "TO-row-insert-above": "Reihe einfuegen vor", + "TO-row-insert-under": "Reihe einfuegen nach", + "TO-row-prop": "Reiheneinstellungen", + "TO-row-split": "Reihen aufteilen", + "TO-table-prop": "Tabelle", + "Table Properties": "Tabelle", + "Text align": "Ausrichtung", + "The bottom side only": "Nur untere Seite", + "The left-hand side only": "Nur linke Seite", + "The right and left sides only": "Nur linke und rechte Seite", + "The right-hand side only": "Nur rechte Seite", + "The top and bottom sides only": "Nur obere und untere Seite", + "The top side only": "Nur obere Seite", + "Top": "Oben", + "Unset color": "Farbe", + "Vertical align": "Ausrichtung", + "Width": "Breite", + "not-del-last-cell": "Letzte Zelle in dieser Reihe!", + "not-del-last-col": "Letzte Spalte in dieser Tabelle!", + "not-del-last-row": "Letzte Reihe in dieser Tabelle", + "percent": "%", + "pixels": "pixels" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/el.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/el.js new file mode 100644 index 0000000000..06bae5cf7d --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/el.js @@ -0,0 +1,81 @@ +// I18N constants + +// LANG: "el", ENCODING: UTF-8 | ISO-8859-7 +// Author: Dimitris Glezos, dimitris@glezos.com + +TableOperations.I18N = { + "Align": "Στοίχηση", + "All four sides": "Και οι 4 πλευρές", + "Background": "Φόντο", + "Baseline": "Baseline", + "Border": "Περίγραμμα", + "Borders": "Περιγράμματα", + "Bottom": "Κάτω μέρος", + "CSS Style": "Στυλ [CSS]", + "Caption": "Λεζάντα", + "Cell Properties": "Ιδιότητες Κελιού", + "Center": "Κέντρο", + "Char": "Χαρακτήρας", + "Collapsed borders": "Συμπτυγμένα περιγράμματα", + "Color": "Χρώμα", + "Description": "Περιγραφή", + "FG Color": "Χρώμα αντικειμένων", + "Float": "Float", + "Frames": "Frames", + "Height": "Ύψος", + "How many columns would you like to merge?": "Πόσες στήλες θέλετε να ενώσετε;", + "How many rows would you like to merge?": "Πόσες γραμμές θέλετε να ενώσετε;", + "Image URL": "URL εικόνας", + "Justify": "Πλήρης στοίχηση", + "Layout": "Διάταξη", + "Left": "Αριστερά", + "Margin": "Περιθώριο", + "Middle": "Κέντρο", + "No rules": "Χωρίς Γραμμές", + "No sides": "No sides", + "None": "Τίποτα", + "Padding": "Εσοχή", + "Please click into some cell": "Κάντε κλικ μέσα σε κάποιο κελί", + "Right": "Δεξιά", + "Row Properties": "Ιδιότητες Γραμμής", + "Rules will appear between all rows and columns": "Γραμμές θα εμφανίζονται μεταξύ όλων των γραμμών και στηλών", + "Rules will appear between columns only": "Γραμμές θα εμφανίζονται μόνο μεταξύ στηλών", + "Rules will appear between rows only": "Γραμμές θα εμφανίζονται μόνο μεταξύ γραμμών", + "Rules": "Γραμμές", + "Spacing and padding": "Αποστάσεις και εσοχές", + "Spacing": "Αποστάσεις", + "Summary": "Σύνοψη", + "TO-cell-delete": "Διαγραφή κελιού", + "TO-cell-insert-after": "Εισαγωγή κελιού μετά", + "TO-cell-insert-before": "Εισαγωγή κελιού πριν", + "TO-cell-merge": "Συγχώνευση κελιών", + "TO-cell-prop": "Ιδιότητες κελιού", + "TO-cell-split": "Διαίρεση κελιού", + "TO-col-delete": "Διαγραφή στήλης", + "TO-col-insert-after": "Εισαγωγή στήλης μετά", + "TO-col-insert-before": "Εισαγωγή στήλης πριν", + "TO-col-split": "Διαίρεση στήλης", + "TO-row-delete": "Διαγραφή γραμμής", + "TO-row-insert-above": "Εισαγωγή γραμμής μετά", + "TO-row-insert-under": "Εισαγωγή γραμμής πριν", + "TO-row-prop": "Ιδιότητες γραμμής", + "TO-row-split": "Διαίρεση γραμμής", + "TO-table-prop": "Ιδιότητες πίνακα", + "Table Properties": "Ιδιότητες πίνακα", + "Text align": "Στοίχηση κειμένου", + "The bottom side only": "Η κάτω πλευρά μόνο", + "The left-hand side only": "Η αριστερή πλευρά μόνο", + "The right and left sides only": "Οι δεξιές και αριστερές πλευρές μόνο", + "The right-hand side only": "Η δεξιά πλευρά μόνο", + "The top and bottom sides only": "Οι πάνω και κάτω πλευρές μόνο", + "The top side only": "Η πάνω πλευρά μόνο", + "Top": "Πάνω", + "Unset color": "Αναίρεση χρώματος", + "Vertical align": "Κατακόρυφη στοίχηση", + "Width": "Πλάτος", + "not-del-last-cell": "Δεν μπορεί να διαγραφεί το τελευταίο κελί σε μια γραμμή.", + "not-del-last-col": "Δεν μπορεί να διαγραφεί η τελευταία στήλη σε ένα πίνακα.", + "not-del-last-row": "Δεν μπορεί να διαγραφεί η τελευταία γραμμή σε ένα πίνακα.", + "percent": "τοις εκατόν", + "pixels": "pixels" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/en.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/en.js new file mode 100644 index 0000000000..7168e09783 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/en.js @@ -0,0 +1,90 @@ +// I18N constants + +// LANG: "en", ENCODING: UTF-8 | ISO-8859-1 +// Author: Mihai Bazon, http://dynarch.com/mishoo + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +TableOperations.I18N = { + "Align": "Align", + "All four sides": "All four sides", + "Background": "Background", + "Baseline": "Baseline", + "Border": "Border", + "Borders": "Borders", + "Bottom": "Bottom", + "CSS Style": "Style [CSS]", + "Caption": "Caption", + "Cell Properties": "Cell Properties", + "Center": "Center", + "Char": "Char", + "Collapsed borders": "Collapsed borders", + "Color": "Color", + "Description": "Description", + "FG Color": "FG Color", + "Float": "Float", + "Frames": "Frames", + "Height": "Height", + "How many columns would you like to merge?": "How many columns would you like to merge?", + "How many rows would you like to merge?": "How many rows would you like to merge?", + "Image URL": "Image URL", + "Justify": "Justify", + "Layout": "Layout", + "Left": "Left", + "Margin": "Margin", + "Middle": "Middle", + "No rules": "No rules", + "No sides": "No sides", + "None": "None", + "Padding": "Padding", + "Please click into some cell": "Please click into some cell", + "Right": "Right", + "Row Properties": "Row Properties", + "Rules will appear between all rows and columns": "Rules will appear between all rows and columns", + "Rules will appear between columns only": "Rules will appear between columns only", + "Rules will appear between rows only": "Rules will appear between rows only", + "Rules": "Rules", + "Spacing and padding": "Spacing and padding", + "Spacing": "Spacing", + "Summary": "Summary", + "TO-cell-delete": "Delete cell", + "TO-cell-insert-after": "Insert cell after", + "TO-cell-insert-before": "Insert cell before", + "TO-cell-merge": "Merge cells", + "TO-cell-prop": "Cell properties", + "TO-cell-split": "Split cell", + "TO-col-delete": "Delete column", + "TO-col-insert-after": "Insert column after", + "TO-col-insert-before": "Insert column before", + "TO-col-split": "Split column", + "TO-row-delete": "Delete row", + "TO-row-insert-above": "Insert row before", + "TO-row-insert-under": "Insert row after", + "TO-row-prop": "Row properties", + "TO-row-split": "Split row", + "TO-table-prop": "Table properties", + "Table Properties": "Table Properties", + "Text align": "Text align", + "The bottom side only": "The bottom side only", + "The left-hand side only": "The left-hand side only", + "The right and left sides only": "The right and left sides only", + "The right-hand side only": "The right-hand side only", + "The top and bottom sides only": "The top and bottom sides only", + "The top side only": "The top side only", + "Top": "Top", + "Unset color": "Unset color", + "Vertical align": "Vertical align", + "Width": "Width", + "not-del-last-cell": "HTMLArea cowardly refuses to delete the last cell in row.", + "not-del-last-col": "HTMLArea cowardly refuses to delete the last column in table.", + "not-del-last-row": "HTMLArea cowardly refuses to delete the last row in table.", + "percent": "percent", + "pixels": "pixels" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/fi.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/fi.js new file mode 100644 index 0000000000..891f16885d --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/fi.js @@ -0,0 +1,66 @@ +TableOperations.I18N = { + "Align": "Kohdistus", + "All four sides": "Kaikki neljä sivua", + "Background": "Tausta", + "Baseline": "Takaraja", + "Border": "Reuna", + "Borders": "Reunat", + "Bottom": "Alle", + "CSS Style": "Tyyli [CSS]", + "Caption": "Otsikko", + "Cell Properties": "Solun asetukset", + "Center": "Keskelle", + "Char": "Merkki", + "Collapsed borders": "Luhistetut reunat", + "Color": "Väri", + "Description": "Kuvaus", + "FG Color": "FG Väri", + "Frames": "Kehykset", + "Image URL": "Kuvan osoite", + "Layout": "Sommittelu", + "Left": "Vasen", + "Margin": "Marginaali", + "Middle": "Keskelle", + "No rules": "Ei viivoja", + "No sides": "Ei sivuja", + "Padding": "Palstantäyte", + "Right": "Oikea", + "Row Properties": "Rivin asetukset", + "Rules will appear between all rows and columns": "Viivat jokaisen rivin ja sarakkeen välillä", + "Rules will appear between columns only": "Viivat ainoastaan sarakkeiden välillä", + "Rules will appear between rows only": "Viivat ainoastaan rivien välillä", + "Rules": "Viivat", + "Spacing": "Palstatila", + "Summary": "Yhteenveto", + "TO-cell-delete": "Poista solu", + "TO-cell-insert-after": "Lisää solu perään", + "TO-cell-insert-before": "Lisää solu ennen", + "TO-cell-merge": "Yhdistä solut", + "TO-cell-prop": "Solun asetukset", + "TO-cell-split": "Jaa solu", + "TO-col-delete": "Poista sarake", + "TO-col-insert-after": "Lisää sarake perään", + "TO-col-insert-before": "Lisää sarake ennen", + "TO-col-split": "Jaa sarake", + "TO-row-delete": "Poista rivi", + "TO-row-insert-above": "Lisää rivi yläpuolelle", + "TO-row-insert-under": "Lisää rivi alapuolelle", + "TO-row-prop": "Rivin asetukset", + "TO-row-split": "Jaa rivi", + "TO-table-prop": "Taulukon asetukset", + "Top": "Ylös", + "Table Properties": "Taulukon asetukset", + "The bottom side only": "Ainoastaan alapuolelle", + "The left-hand side only": "Ainoastaan vasenreuna", + "The right and left sides only": "Oikea- ja vasenreuna", + "The right-hand side only": "Ainoastaan oikeareuna", + "The top and bottom sides only": "Ylä- ja alapuoli.", + "The top side only": "Ainoastaan yläpuoli", + "Vertical align": "Vertikaali kohdistus", + "Width": "Leveys", + "not-del-last-cell": "Ei voida poistaa viimeistä solua rivistä.", + "not-del-last-col": "Ei voida poistaa viimeistä saraketta taulusta.", + "not-del-last-row": "Ei voida poistaa viimeistä riviä taulusta.", + "percent": "prosenttia", + "pixels": "pikseliä" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/hu.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/hu.js new file mode 100644 index 0000000000..828aec1523 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/hu.js @@ -0,0 +1,63 @@ +// I18N constants + +// LANG: "hu", ENCODING: UTF-8 +// Author: Miklós Somogyi, + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +HTMLArea.I18N = { + + // the following should be the filename without .js extension + // it will be used for automatically load plugin language. + lang: "hu", + + tooltips: { + bold: "Félkövér", + italic: "Dőlt", + underline: "Aláhúzott", + strikethrough: "Áthúzott", + subscript: "Alsó index", + superscript: "Felső index", + justifyleft: "Balra zárt", + justifycenter: "Középre zárt", + justifyright: "Jobbra zárt", + justifyfull: "Sorkizárt", + orderedlist: "Számozott lista", + unorderedlist: "Számozatlan lista", + outdent: "Behúzás csökkentése", + indent: "Behúzás növelése", + forecolor: "Karakterszín", + hilitecolor: "Háttérszín", + horizontalrule: "Elválasztó vonal", + createlink: "Hiperhivatkozás beszúrása", + insertimage: "Kép beszúrása", + inserttable: "Táblázat beszúrása", + htmlmode: "HTML forrás be/ki", + popupeditor: "Szerkesztő külön ablakban", + about: "Névjegy", + showhelp: "Súgó", + textindicator: "Aktuális stílus", + undo: "Visszavonás", + redo: "Újra végrehajtás", + cut: "Kivágás", + copy: "Másolás", + paste: "Beillesztés" + }, + + buttons: { + "ok": "Rendben", + "cancel": "Mégsem" + }, + + msg: { + "Path": "Hierarchia", + "TEXT_MODE": "Forrás mód. Visszaváltás [<>] gomb" + } +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/it.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/it.js new file mode 100644 index 0000000000..ccbdc94dbf --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/it.js @@ -0,0 +1,81 @@ +// I18N constants + +// LANG: "it", ENCODING: UTF-8 | ISO-8859-1 +// Author: Fabio Rotondo + +TableOperations.I18N = { + "Align": "Allinea", + "All four sides": "Tutti e quattro i lati", + "Background": "Sfondo", + "Baseline": "Allineamento", + "Border": "Bordo", + "Borders": "Bordi", + "Bottom": "Basso", + "CSS Style": "Stile [CSS]", + "Caption": "Titolo", + "Cell Properties": "Proprietà della Cella", + "Center": "Centra", + "Char": "Carattere", + "Collapsed borders": "Bordi chiusi", + "Color": "Colore", + "Description": "Descrizione", + "FG Color": "Colore Principale", + "Float": "Fluttuante", + "Frames": "Frames", + "Height": "Altezza", + "How many columns would you like to merge?": "Quante colonne vuoi unire?", + "How many rows would you like to merge?": "Quante righe vuoi unire?", + "Image URL": "URL dell'Immagine", + "Justify": "Justifica", + "Layout": "Layout", + "Left": "Sinistra", + "Margin": "Margine", + "Middle": "Centrale", + "No rules": "Nessun righello", + "No sides": "Nessun lato", + "None": "Nulla", + "Padding": "Padding", + "Please click into some cell": "Per favore, clicca in una cella", + "Right": "Destra", + "Row Properties": "Proprietà della Riga", + "Rules will appear between all rows and columns": "Le linee appariranno tra tutte le righe e colonne", + "Rules will appear between columns only": "Le linee appariranno solo tra le colonne", + "Rules will appear between rows only": "Le linee appariranno solo tra le righe", + "Rules": "Linee", + "Spacing and padding": "Spaziatura e Padding", + "Spacing": "Spaziatura", + "Summary": "Sommario", + "TO-cell-delete": "Cancella cella", + "TO-cell-insert-after": "Inserisci cella dopo", + "TO-cell-insert-before": "Inserisci cella prima", + "TO-cell-merge": "Unisci celle", + "TO-cell-prop": "Proprietà della cella", + "TO-cell-split": "Dividi cella", + "TO-col-delete": "Cancella colonna", + "TO-col-insert-after": "Inserisci colonna dopo", + "TO-col-insert-before": "Inserisci colonna prima", + "TO-col-split": "Dividi colonna", + "TO-row-delete": "Cancella riga", + "TO-row-insert-above": "Inserisci riga prima", + "TO-row-insert-under": "Inserisci riga dopo", + "TO-row-prop": "Proprietà della riga", + "TO-row-split": "Dividi riga", + "TO-table-prop": "Proprietà della Tabella", + "Table Properties": "Proprietà della Tabella", + "Text align": "Allineamento del Testo", + "The bottom side only": "Solo la parte inferiore", + "The left-hand side only": "Solo la parte sinistra", + "The right and left sides only": "Solo destra e sinistra", + "The right-hand side only": "Solo la parte destra", + "The top and bottom sides only": "Solo sopra e sotto", + "The top side only": "Solo la parte sopra", + "Top": "Alto", + "Unset color": "Rimuovi colore", + "Vertical align": "Allineamento verticale", + "Width": "Larghezza", + "not-del-last-cell": "HTMLArea si rifiuta codardamente di cancellare l'ultima cella nella riga.", + "not-del-last-col": "HTMLArea si rifiuta codardamente di cancellare l'ultima colonna nella tabella.", + "not-del-last-row": "HTMLArea si rifiuta codardamente di cancellare l'ultima riga nella tabella.", + "percent": "percento", + "pixels": "pixels" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/makefile.xml b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/makefile.xml new file mode 100644 index 0000000000..0d645c96b3 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/makefile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/nl.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/nl.js new file mode 100644 index 0000000000..ce9eb305c7 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/nl.js @@ -0,0 +1,90 @@ +// I18N constants + +// LANG: "nl", ENCODING: UTF-8 | ISO-8859-1 +// Author: Michel Weegeerink (info@mmc-shop.nl), http://mmc-shop.nl + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +TableOperations.I18N = { + "Align": "Uitlijning", + "All four sides": "Alle 4 zijden", + "Background": "Achtergrond", + "Baseline": "Basis", + "Border": "Rand", + "Borders": "Randen", + "Bottom": "Onder", + "CSS Style": "CSS Style", + "Caption": "Opmerking", + "Cell Properties": "Celeigenschappen", + "Center": "Centreren", + "Char": "Karakter", + "Collapsed borders": "Geen randen", + "Color": "Kleur", + "Description": "Omschrijving", + "FG Color": "Voorgrond", + "Float": "Zwevend", + "Frames": "Frames", + "Height": "Hoogte", + "How many columns would you like to merge?": "Hoeveel kolommen wilt u samenvoegen?", + "How many rows would you like to merge?": "Hoeveel rijen wilt u samenvoegen?", + "Image URL": "Afbeelding URL", + "Justify": "Uitvullen", + "Layout": "Opmaak", + "Left": "Links", + "Margin": "Marge", + "Middle": "Midden", + "No rules": "Geen regels", + "No sides": "Geen zijlijnen", + "None": "Geen", + "Padding": "Celmarge", + "Please click into some cell": "Klik in een cel a.u.b.", + "Right": "Rechts", + "Row Properties": "Rijeigenschappen", + "Rules will appear between all rows and columns": "Regels verschijnen tussen alle rijen en kolommen", + "Rules will appear between columns only": "Regels verschijnen enkel tussen de kolommen", + "Rules will appear between rows only": "Regels verschijnen enkel tussen de rijen", + "Rules": "Regels", + "Spacing and padding": "Celmarge en afstand tussen cellen", + "Spacing": "marge", + "Summary": "Overzicht", + "TO-cell-delete": "Cel verwijderen", + "TO-cell-insert-after": "Voeg cel toe achter", + "TO-cell-insert-before": "Voeg cel toe voor", + "TO-cell-merge": "Cellen samenvoegen", + "TO-cell-prop": "Celeigenschappen", + "TO-cell-split": "Cel splitsen", + "TO-col-delete": "Kolom verwijderen", + "TO-col-insert-after": "Kolom invoegen achter", + "TO-col-insert-before": "Kolom invoegen voor", + "TO-col-split": "Kolom splitsen", + "TO-row-delete": "Rij verwijderen", + "TO-row-insert-above": "Rij invoegen boven", + "TO-row-insert-under": "Rij invoegen onder", + "TO-row-prop": "Rij eigenschappen", + "TO-row-split": "Rij splitsen", + "TO-table-prop": "Tabel eigenschappen", + "Table Properties": "Tabel eigenschappen", + "Text align": "Text uitlijning", + "The bottom side only": "Enkel aan de onderkant", + "The left-hand side only": "Enkel aan de linkerkant", + "The right and left sides only": "Enkel aan de linker en rechterkant", + "The right-hand side only": "Enkel aan de rechterkant", + "The top and bottom sides only": "Enkel aan de bovenen onderkant", + "The top side only": "Enkel aan de bovenkant", + "Top": "Boven", + "Unset color": "Wis kleur", + "Vertical align": "Vertikale uitlijning", + "Width": "Breedte", + "not-del-last-cell": "HTMLArea kan de laatste cel in deze tabel niet verwijderen.", + "not-del-last-col": "HTMLArea kan de laatste kolom in deze tabel niet verwijderen.", + "not-del-last-row": "HTMLArea kan de laatste rij in deze tabel niet verwijderen.", + "percent": "procent", + "pixels": "pixels" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/no.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/no.js new file mode 100644 index 0000000000..a29e9034eb --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/no.js @@ -0,0 +1,91 @@ +// I18N constants + +// LANG: "en", ENCODING: UTF-8 | ISO-8859-1 +// Author: Mihai Bazon, +// translated into Norwegia: ses@online.no 11.11.03 + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +TableOperations.I18N = { + "Align": "Juster", + "All four sides": "Alle fire sider", + "Background": "Bakgrund", + "Baseline": "Grunnlinje", + "Border": "Kantlinje", + "Borders": "Kantlinjer", + "Bottom": "Bunn", + "CSS Style": "Stil [CSS]", + "Caption": "Overskrift", + "Cell Properties": "Celleegenskaper", + "Center": "Sentrer", + "Char": "Tegn", + "Collapsed borders": "Fjern kantlinjer", + "Color": "Farge", + "Description": "Beskrivelse", + "FG Color": "FG farge", + "Float": "Flytende", + "Frames": "rammer", + "Height": "Høyde", + "How many columns would you like to merge?": "Hvor mange kolonner vil du slå sammen?", + "How many rows would you like to merge?": "Hvor mange rader vil du slå sammen?", + "Image URL": "Bildets URL", + "Justify": "Juster", + "Layout": "Layout", + "Left": "Venstre", + "Margin": "Marg", + "Middle": "Midten", + "No rules": "Ingen linjal", + "No sides": "Ingen sider", + "None": "Ingen", + "Padding": "Luft", + "Please click into some cell": "Klikk i en eller annen celle", + "Right": "Høyre", + "Row Properties": "Egenskaper for rad", + "Rules will appear between all rows and columns": "Linjer vil synes mellom alle rader og kolonner", + "Rules will appear between columns only": "Linjer vil synes kun mellom kolonner", + "Rules will appear between rows only": "Linjer vil synes kun mellom rader", + "Rules": "Linjer", + "Spacing and padding": "Luft", + "Spacing": "Luft", + "Summary": "Sammendrag", + "TO-cell-delete": "Slett celle", + "TO-cell-insert-after": "Sett inn celle etter", + "TO-cell-insert-before": "Sett inn celle foran", + "TO-cell-merge": "Slå sammen celler", + "TO-cell-prop": "Egenskaper for celle", + "TO-cell-split": "Del celle", + "TO-col-delete": "Slett kolonne", + "TO-col-insert-after": "Skyt inn kolonne etter", + "TO-col-insert-before": "Skyt inn kolonne før", + "TO-col-split": "Del kolonne", + "TO-row-delete": "Slett rad", + "TO-row-insert-above": "Skyt inn rad foran", + "TO-row-insert-under": "Skyt inn rad etter", + "TO-row-prop": "Egenskaper for rad", + "TO-row-split": "Del rad", + "TO-table-prop": "Tabellegenskaper", + "Table Properties": "Tabellegenskaper", + "Text align": "Juster tekst", + "The bottom side only": "Bunnen kun", + "The left-hand side only": "Venstresiden kun", + "The right and left sides only": "Høyre- og venstresiden kun", + "The right-hand side only": "Høyresiden kun", + "The top and bottom sides only": "The top and bottom sides only", + "The top side only": "Overkanten kun", + "Top": "Overkant", + "Unset color": "Ikke-bestemt farge", + "Vertical align": "Vertikal justering", + "Width": "Bredde", + "not-del-last-cell": "HTMLArea nekter å slette siste cellen i tabellen.", + "not-del-last-col": "HTMLArea nekter å slette siste kolonnen i tabellen.", + "not-del-last-row": "HTMLArea nekter å slette siste raden i tabellen.", + "percent": "prosent", + "pixels": "billedpunkter" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/ro.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/ro.js new file mode 100644 index 0000000000..a008f21a23 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/lang/ro.js @@ -0,0 +1,90 @@ +// I18N constants + +// LANG: "ro", ENCODING: UTF-8 +// Author: Mihai Bazon, http://dynarch.com/mishoo + +// FOR TRANSLATORS: +// +// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE +// (at least a valid email address) +// +// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; +// (if this is not possible, please include a comment +// that states what encoding is necessary.) + +TableOperations.I18N = { + "Align": "Aliniere", + "All four sides": "Toate părÅ£ile", + "Background": "Fundal", + "Baseline": "Baseline", + "Border": "Chenar", + "Borders": "Chenare", + "Bottom": "Jos", + "CSS Style": "Stil [CSS]", + "Caption": "Titlu de tabel", + "Cell Properties": "Proprietăţile celulei", + "Center": "Centru", + "Char": "Caracter", + "Collapsed borders": "Chenare asimilate", + "Color": "Culoare", + "Description": "Descriere", + "FG Color": "Culoare text", + "Float": "PoziÅ£ie", + "Frames": "Chenare", + "Height": "ÎnălÅ£imea", + "How many columns would you like to merge?": "Câte coloane vrei să uneşti?", + "How many rows would you like to merge?": "Câte linii vrei să uneşti?", + "Image URL": "URL-ul imaginii", + "Justify": "Justify", + "Layout": "Aranjament", + "Left": "Stânga", + "Margin": "Margine", + "Middle": "Mijloc", + "No rules": "Fără linii", + "No sides": "Fără părÅ£i", + "None": "Nimic", + "Padding": "SpaÅ£iere", + "Please click into some cell": "Vă rog să daÅ£i click într-o celulă", + "Right": "Dreapta", + "Row Properties": "Proprietăţile liniei", + "Rules will appear between all rows and columns": "Vor apărea linii între toate rândurile şi coloanele", + "Rules will appear between columns only": "Vor apărea doar linii verticale", + "Rules will appear between rows only": "Vor apărea doar linii orizontale", + "Rules": "Linii", + "Spacing and padding": "SpaÅ£ierea", + "Spacing": "Între celule", + "Summary": "Sumar", + "TO-cell-delete": "Şterge celula", + "TO-cell-insert-after": "Inserează o celulă la dreapta", + "TO-cell-insert-before": "Inserează o celulă la stânga", + "TO-cell-merge": "Uneşte celulele", + "TO-cell-prop": "Proprietăţile celulei", + "TO-cell-split": "Împarte celula", + "TO-col-delete": "Şterge coloana", + "TO-col-insert-after": "Inserează o coloană la dreapta", + "TO-col-insert-before": "Inserează o coloană la stânga", + "TO-col-split": "Împarte coloana", + "TO-row-delete": "Şterge rândul", + "TO-row-insert-above": "Inserează un rând înainte", + "TO-row-insert-under": "Inserează un rând după", + "TO-row-prop": "Proprietăţile rândului", + "TO-row-split": "Împarte rândul", + "TO-table-prop": "Proprietăţile tabelei", + "Table Properties": "Proprietăţile tabelei", + "Text align": "Aliniere", + "The bottom side only": "Doar partea de jos", + "The left-hand side only": "Doar partea din stânga", + "The right and left sides only": "Partea din stânga şi cea din dreapta", + "The right-hand side only": "Doar partea din dreapta", + "The top and bottom sides only": "Partea de sus si cea de jos", + "The top side only": "Doar partea de sus", + "Top": "Sus", + "Unset color": "Dezactivează culoarea", + "Vertical align": "Aliniere pe verticală", + "Width": "Lăţime", + "not-del-last-cell": "HTMLArea refuză cu laşitate să şteargă ultima celulă din rând.", + "not-del-last-col": "HTMLArea refuză cu laşitate să şteargă ultima coloamă din tabela.", + "not-del-last-row": "HTMLArea refuză cu laşitate să şteargă ultimul rând din tabela.", + "percent": "procente", + "pixels": "pixeli" +}; diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/makefile.xml b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/makefile.xml new file mode 100644 index 0000000000..cf040f5d78 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/makefile.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/table-operations.js b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/table-operations.js new file mode 100644 index 0000000000..05908d6944 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/plugins/TableOperations/table-operations.js @@ -0,0 +1,1160 @@ +// Table Operations Plugin for HTMLArea-3.0 +// Implementation by Mihai Bazon. Sponsored by http://www.bloki.com +// +// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc. +// This notice MUST stay intact for use (see license.txt). +// +// A free WYSIWYG editor replacement for + + + diff --git a/tools/authcon/auth/resources/htmlarea/popups/insert_image.html b/tools/authcon/auth/resources/htmlarea/popups/insert_image.html new file mode 100644 index 0000000000..1a0e9604a0 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/popups/insert_image.html @@ -0,0 +1,191 @@ + + + + Insert Image + + + + + + + + + + + +
Insert Image
+ +
+ + + + + + + + + + + + + +
Image URL: + +
Alternate text:
+ +

+ +

+Layout + +
+ +
Alignment:
+ + +

+ +

Border thickness:
+ + +
+ +
+ +
+Spacing + +
+ +
Horizontal:
+ + +

+ +

Vertical:
+ + +
+ +
+
+ + + + + +
+ Image Preview:
+ +
+
+ +
+
+ + diff --git a/tools/authcon/auth/resources/htmlarea/popups/insert_table.html b/tools/authcon/auth/resources/htmlarea/popups/insert_table.html new file mode 100644 index 0000000000..508dbf8e15 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/popups/insert_table.html @@ -0,0 +1,174 @@ + + + + Insert Table + + + + + + + + + + + +
Insert Table
+ +
+ + + + + + + + + + + + + + + + + + + +
Rows:
Cols:Width:
+ +

+ +

+Layout + +
+ +
Alignment:
+ + +

+ +

Border thickness:
+ + +
+ +
+ +
+Spacing + +
+ +
Cell spacing:
+ + +

+ +

Cell padding:
+ + +
+ +
+ +
+ + +
+ +
+ + + diff --git a/tools/authcon/auth/resources/htmlarea/popups/link.html b/tools/authcon/auth/resources/htmlarea/popups/link.html new file mode 100644 index 0000000000..41780e4c56 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/popups/link.html @@ -0,0 +1,142 @@ + + + + Insert/Modify Link + + + + + + + + +
Insert/Modify Link
+ + + + + + + + + + + + + + +
URL:
Title (tooltip):
Target: + +
+ +
+ + +
+ + + diff --git a/tools/authcon/auth/resources/htmlarea/popups/makefile.xml b/tools/authcon/auth/resources/htmlarea/popups/makefile.xml new file mode 100644 index 0000000000..83bc7fbee3 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/popups/makefile.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tools/authcon/auth/resources/htmlarea/popups/old-fullscreen.html b/tools/authcon/auth/resources/htmlarea/popups/old-fullscreen.html new file mode 100644 index 0000000000..7c00d916cb --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/popups/old-fullscreen.html @@ -0,0 +1,131 @@ + +Fullscreen Editor + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/tools/authcon/auth/resources/htmlarea/popups/old_insert_image.html b/tools/authcon/auth/resources/htmlarea/popups/old_insert_image.html new file mode 100644 index 0000000000..613f460131 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/popups/old_insert_image.html @@ -0,0 +1,206 @@ + + + + + + + +Insert Image + + + + + +
Image URL:
+ + +
Alternate Text:
+ + +
+Layout +
+ +
+Spacing +
+ +
Alignment:
+ + +
Horizontal:
+ + +
Border Thickness:
+ + +
Vertical:
+ + + + + + + \ No newline at end of file diff --git a/tools/authcon/auth/resources/htmlarea/popups/popup.js b/tools/authcon/auth/resources/htmlarea/popups/popup.js new file mode 100644 index 0000000000..ce4517b594 --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/popups/popup.js @@ -0,0 +1,109 @@ +// htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc. +// This copyright notice MUST stay intact for use (see license.txt). +// +// Portions (c) dynarch.com, 2003 +// +// A free WYSIWYG editor replacement for + + +

Where can I find out more info, download the latest version and talk to +other HTMLArea users?

+ +

You can find out more about HTMLArea and download the latest version on +the HTMLArea +homepage and you can talk to other HTMLArea users and post any comments +or suggestions you have in the HTMLArea forum.

+ +

Keyboard shortcuts

+ +

The editor provides the following key combinations:

+ +
    +
  • CTRL-A -- select all
  • +
  • CTRL-B -- bold
  • +
  • CTRL-I -- italic
  • +
  • CTRL-U -- underline
  • +
  • CTRL-S -- strikethrough
  • +
  • CTRL-L -- justify left
  • +
  • CTRL-E -- justify center
  • +
  • CTRL-R -- justify right
  • +
  • CTRL-J -- justify full
  • +
  • CTRL-1 .. CTRL-6 -- headings (<h1> .. <h6>)
  • +
  • CTRL-0 (zero) -- clean content pasted from Word
  • +
+ +

Installation

+ +

How do I add HTMLArea to my web page?

+ +

It's easy. First you need to upload HTMLArea files to your website. +Just follow these steps.

+ +
    +
  1. Download the latest version from the htmlArea + homepage.
  2. +
  3. Unzip the files onto your local computer (making sure to maintain the + directory structure contained in the zip).
  4. +
  5. Create a new folder on your website called /htmlarea/ (make sure it's + NOT inside the cgi-bin).
  6. +
  7. Transfer all the HTMLArea files from your local computer into the + /htmlarea/ folder on your website.
  8. +
  9. Open the example page /htmlarea/examples/core.html with your browser to make + sure everything works.
  10. +
+ +

Once htmlArea is on your website all you need to do is add some +JavaScript to any pages that you want to add WYSIWYG editors to. Here's how +to do that.

+ +
    + +
  1. Define some global variables. "_editor_url" has to be the absolute + URL where HTMLArea resides within your + website; as we discussed, this would be “/htmlarea/”. "_editor_lang" must + be the language code in which you want HTMLArea to appear. This defaults + to "en" (English); for a list of supported languages, please look into + the "lang" subdirectory in the distribution. +
    <script type="text/javascript">
    +   _editor_url = "/htmlarea/";
    +   _editor_lang = "en";
    +</script>
    + +
  2. Include the "htmlarea.js" script: +
    <script type="text/javascript" src="/htmlarea/htmlarea.js"></script>
    +
  3. + +
  4. If you want to change all your <textarea>-s into + HTMLArea-s then you can use the simplest way to create HTMLArea:

    +
    <script type="text/javascript" defer="1">
    +    HTMLArea.replaceAll();
    +</script>
    +

    Note: you can also add the + HTMLArea.replaceAll() code to the onload + event handler for the body element, if you find it more appropriate.

    + +

    A different approach, if you have more than one textarea and only want + to change one of them, is to use HTMLArea.replace("id") -- + pass the id of your textarea. Do not use the + name attribute anymore, it's not a standard solution!

    + +
+ +

This section applies to HTMLArea-3.0 release candidate 1 or later; prior +to this version, one needed to include more files; however, now HTMLArea is +able to include other files too (such as stylesheet, language definition +file, etc.) so you only need to define the editor path and load +"htmlarea.js". Nice, eh? ;-)

+ +

I want to change the editor settings, how do I do that?

+ +

While it's true that all you need is one line of JavaScript to create an +htmlArea WYSIWYG editor, you can also specify more config settings in the +code to control how the editor works and looks. Here's an example of some of +the available settings:

+ +
var config = new HTMLArea.Config(); // create a new configuration object
+                                    // having all the default values
+config.width = '90%';
+config.height = '200px';
+
+// the following sets a style for the page body (black text on yellow page)
+// and makes all paragraphs be bold by default
+config.pageStyle =
+  'body { background-color: yellow; color: black; font-family: verdana,sans-serif } ' +
+  'p { font-width: bold; } ';
+
+// the following replaces the textarea with the given id with a new
+// HTMLArea object having the specified configuration
+HTMLArea.replace('id', config);
+ +

Important: It's recommended that you add +custom features and configuration to a separate file. This will ensure you +that when we release a new official version of HTMLArea you'll have less +trouble upgrading it.

+ +

How do I customize the toolbar?

+ +

Using the configuration object introduced above allows you to completely +control what the toolbar contains. Following is an example of a one-line, +customized toolbar, much simpler than the default one:

+ +
var config = new HTMLArea.Config();
+config.toolbar = [
+  ['fontname', 'space',
+   'fontsize', 'space',
+   'formatblock', 'space',
+   'bold', 'italic', 'underline']
+];
+HTMLArea.replace('id', config);
+ +

The toolbar is an Array of Array objects. Each array in the toolbar +defines a new line. The default toolbar looks like this:

+ +
config.toolbar = [
+[ "fontname", "space",
+  "fontsize", "space",
+  "formatblock", "space",
+  "bold", "italic", "underline", "separator",
+  "strikethrough", "subscript", "superscript", "separator",
+  "copy", "cut", "paste", "space", "undo", "redo" ],
+		
+[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
+  "insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",
+  "forecolor", "hilitecolor", "textindicator", "separator",
+  "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode", "separator",
+  "popupeditor", "separator", "showhelp", "about" ]
+];
+ +

Except three strings, all others in the examples above need to be defined +in the config.btnList object (detailed a bit later in this +document). The three exceptions are: 'space', 'separator' and 'linebreak'. +These three have the following meaning, and need not be present in +btnList:

+ +
    +
  • 'space' -- Inserts a space of 5 pixels (the width is configurable by external + CSS) at the current + position in the toolbar.
  • +
  • 'separator' -- Inserts a small vertical separator, for visually grouping related + buttons.
  • +
  • 'linebreak' -- Starts a new line in the toolbar. Subsequent controls will be + inserted on the new line.
  • +
+ +

Important: It's recommended that you add +custom features and configuration to a separate file. This will ensure you +that when we release a new official version of HTMLArea you'll have less +trouble upgrading it.

+ +

How do I create custom buttons?

+ +

By design, the toolbar is easily extensible. For adding a custom button +one needs to follow two steps.

+ +

1. Register the button in config.btnList.

+ +

For each button in the toolbar, HTMLArea needs to know the following +information:

+
    +
  • a name for it (we call it the ID of the button);
  • +
  • the path to an image to be displayed in the toolbar;
  • +
  • a tooltip for it;
  • +
  • whether the button is enabled or not in text mode;
  • +
  • what to do when the button is clicked;
  • +
+

You need to provide all this information for registering a new button +too. The button ID can be any string identifier and it's used when +defining the toolbar, as you saw above. We recommend starting +it with "my-" so that it won't clash with the standard ID-s (those from +the default toolbar).

+ +

Register button example #1

+ +
// get a default configuration
+var config = new HTMLArea.Config();
+// register the new button using Config.registerButton.
+// parameters:        button ID,   tooltip,          image,           textMode,
+config.registerButton("my-hilite", "Highlight text", "my-hilite.gif", false,
+// function that gets called when the button is clicked
+  function(editor, id) {
+    editor.surroundHTML('<span class="hilite">', '</span>');
+  }
+);
+ +

An alternate way of calling registerButton is exemplified above. Though +the code might be a little bit larger, using this form makes your code more +maintainable. It doesn't even needs comments as it's pretty clear.

+ +

Register button example #2

+ +
var config = new HTMLArea.Config();
+config.registerButton({
+  id        : "my-hilite",
+  tooltip   : "Highlight text",
+  image     : "my-hilite.gif",
+  textMode  : false,
+  action    : function(editor, id) {
+                editor.surroundHTML('<span class="hilite">', '</span>');
+              }
+});
+ +

You might notice that the "action" function receives two parameters: +editor and id. In the examples above we only used the +editor parameter. But it could be helpful for you to understand +both:

+ +
    +
  • editor is a reference to the HTMLArea object. Since our entire + code now has an OOP-like + design, you need to have a reference to + the editor object in order to do things with it. In previous versions of + HTMLArea, in order to identify the object an ID was used -- the ID of the + HTML element. In this version ID-s are no longer necessary.
  • + +
  • id is the button ID. Wondering why is this useful? Well, you + could use the same handler function (presuming that it's not an anonymous + function like in the examples above) for more buttons. You can see an example a bit later in this document.
  • +
+ +

2. Inserting it into the toolbar

+ +

At this step you need to specify where in the toolbar to insert the +button, or just create the whole toolbar again as you saw in the previous +section. You use the button ID, as shown in the examples of customizing the +toolbar in the previous section.

+ +

For the sake of completion, following there are another examples.

+ +

Append your button to the default toolbar

+ +
config.toolbar.push([ "my-hilite" ]);
+ +

Customized toolbar

+ +
config.toolbar = [
+  ['fontname', 'space',
+   'fontsize', 'space',
+   'formatblock', 'space',
+   'separator', 'my-hilite', 'separator', 'space', // here's your button
+   'bold', 'italic', 'underline', 'space']
+];
+ +

Note: in the example above our new button is +between two vertical separators. But this is by no means required. You can +put it wherever you like. Once registered in the btnList (step 1) your custom button behaves just like a default +button.

+ +

Important: It's recommended that you add +custom features and configuration to a separate file. This will ensure you +that when we release a new official version of HTMLArea you'll have less +trouble upgrading it.

+ +

A complete example

+ +

Please note that it is by no means necessary to include the following +code into the htmlarea.js file. On the contrary, it might not work there. +The configuration system is designed such that you can always customize the +editor from outside files, thus keeping the htmlarea.js file +intact. This will make it easy for you to upgrade your HTMLArea when we +release a new official version. OK, I promise it's the last time I said +this. ;)

+ +
// All our custom buttons will call this function when clicked.
+// We use the buttonId parameter to determine what button
+// triggered the call.
+function clickHandler(editor, buttonId) {
+  switch (buttonId) {
+    case "my-toc":
+      editor.insertHTML("<h1>Table Of Contents</h1>");
+      break;
+    case "my-date":
+      editor.insertHTML((new Date()).toString());
+      break;
+    case "my-bold":
+      editor.execCommand("bold");
+      editor.execCommand("italic");
+      break;
+    case "my-hilite":
+      editor.surroundHTML("<span class=\"hilite\">", "</span>");
+      break;
+  }
+};
+
+// Create a new configuration object
+var config = new HTMLArea.Config();
+
+// Register our custom buttons
+config.registerButton("my-toc",  "Insert TOC", "my-toc.gif", false, clickHandler);
+config.registerButton("my-date", "Insert date/time", "my-date.gif", false, clickHandler);
+config.registerButton("my-bold", "Toggle bold/italic", "my-bold.gif", false, clickHandler);
+config.registerButton("my-hilite", "Hilite selection", "my-hilite.gif", false, clickHandler);
+
+// Append the buttons to the default toolbar
+config.toolbar.push(["linebreak", "my-toc", "my-date", "my-bold", "my-hilite"]);
+
+// Replace an existing textarea with an HTMLArea object having the above config.
+HTMLArea.replace("textAreaID", config);
+ + +
+
© InteractiveTools.com 2002-2004. +
+© dynarch.com 2003-2004
+HTMLArea v3.0 developed by Mihai Bazon. +
+Documentation written by Mihai Bazon. +
+ Last modified: Wed Jan 28 12:18:23 EET 2004 + + diff --git a/tools/authcon/auth/resources/htmlarea/release-notes.html b/tools/authcon/auth/resources/htmlarea/release-notes.html new file mode 100644 index 0000000000..f2200d50ed --- /dev/null +++ b/tools/authcon/auth/resources/htmlarea/release-notes.html @@ -0,0 +1,165 @@ + + + + HTMLArea-3.0-rc1 release notes + + + + + +

HTMLArea-3.0-rc1 release notes

+ +

This release was compiled on Mar 1, 2004 [19:37] GMT.

+ +

3.0-rc1

+ +

Changes since 3.0-Beta:

+ +
    +
  • + New plugins +
      +
    • + ContextMenu plugin (provides a nice context menu with common + operations, including table ops, link ops, etc.) +
    • +
    • + CSS plugin (provides an easy way to insert/change CSS classes) +
    • +
    • + FullPage plugin (allows HTMLArea to edit a whole HTML file, + not only the content within <body>.) +
    • +
    +
  • +
  • + Changes in the SpellChecker plugin +
      +
    • + Many bugfixes: now it works ;-) Fully Unicode-safe. +
    • +
    • + Speed and bandwidth optimization: reports the list of + suggestions only once for each mispelled word; this helps + in cases where you have, for instance, the word “HTMLArea” + in 10 places all over the document; the list of + suggestions for it--which is kind of huge--will only be + included once. +
    • +
    • + User interface improvements: the highlighted word will + remain in view; in cases where it's normally outside, the + window will be scrolled to it. +
    • +
    • + Added a "Revert" button for those that change their minds ;-) +
    • +
    • + Added a "Info" button which reports information about the + document, retrieved by the server-side spell checker: + total number of words, total number of mispelled words, + number of suggestions made, spell check time, etc. More + can be easily added. FIXME: this part + is not yet internationalized. +
    • +
    • + The server-side spell checker now uses XML::DOM instead of + HTML::Parser, which means that it will be unable to parse + “tag-soup” HTML. It needs valid code. Usually HTMLArea + generates valid code, but on rare occasions it might fail + and the spell checker will report a gross error message. + This gonna have to be fixed, but instead of making the + spell checker accept invalid HTML I prefer to make + HTMLArea generate valid code, so changes are to be done in + other places ;-) +
    • +
    +
  • +
  • + Changes in the core editor +
      +
    • + Easier to setup: you only need to load + htmlarea.js; other scripts will be loaded + automatically. Documentation + and examples updated. +
    • +
    • + Better plugin support (they register information about + themselves with the editor; can register event handlers for + the editor, etc.) +
    • +
    • + New about box; check it out, it's cool ;-) +
    • +
    • + Word cleaner (can be enabled to automatically kill Word crap + on paste (see Config.killWordOnPaste); otherwise accessible by + pressing CTRL-0 in the editor; a toolbar button will come up + soon) +
    • +
    • + Image preview in "insert image" dialog. Also allows + modification of current image, if selected. +
    • +
    • + New "insert link" dialog, allows target and title + specification, allows editing links. +
    • +
    • + Implemented support for text direction (left-to-right or + right-to-left). +
    • +
    • + Lots of bug fixes! ... and more, I guess ;-) an + automatically generated change log + is now available. +
    • +
    +
  • +
+ +

I don't have the power to go through the bug +system at SourceForge + now. Some of the bugs reported there may be fixed; I'll update + their status, some other time. If you reported bugs there and now + find them to be fixed, please let me know.

+ +

3.0-Beta

+ +

Changes since 3.0-Alpha:

+ +
    + +
  • Performance improvements.
  • + +
  • Many bugs fixed.
  • + +
  • Plugin infrastructure.
  • + +
  • TableOperations plugin.
  • + +
  • SpellChecker plugin.
  • + +
  • Status bar.
  • + +
  • API for registering custom buttons and drop-down boxes in the + toolbar.
  • + +
  • Toolbar can contain text labels.
  • + +
  • Cut, copy, paste, undo, redo buttons.
  • + +
+
+
Mihai Bazon
+ + Last modified: Sun Feb 1 13:16:10 EET 2004 + + + + + diff --git a/tools/authcon/auth/resources/mattkruse-lib.js b/tools/authcon/auth/resources/mattkruse-lib.js new file mode 100644 index 0000000000..c7230c1c38 --- /dev/null +++ b/tools/authcon/auth/resources/mattkruse-lib.js @@ -0,0 +1,124 @@ +// =================================================================== +// Author: Matt Kruse +// WWW: http://www.mattkruse.com/ +// +// NOTICE: You may use this code for any purpose, commercial or +// private, without any further permission from the author. You may +// remove this notice from your final code if you wish, however it is +// appreciated by the author if at least my web site address is kept. +// +// You may *NOT* re-distribute this code in any way except through its +// use. That means, you can include it in your product, or your web +// site, or any other form where the code is actually being used. You +// may not put the plain javascript up on your site for download or +// include it in your javascript libraries for download. +// If you wish to share this code with others, please just point them +// to the URL instead. +// Please DO NOT link directly to my .js files from your site. Copy +// the files to your server and use them there. Thank you. +// =================================================================== + +/* SOURCE FILE: selectbox.js */ +function selectUnselectMatchingOptions(obj,regex,which,only){if(window.RegExp){if(which == "select"){var selected1=true;var selected2=false;}else if(which == "unselect"){var selected1=false;var selected2=true;}else{return;}var re = new RegExp(regex);for(var i=0;i(b.text+"")){return 1;}return 0;});for(var i=0;i3){var regex = arguments[3];if(regex != ""){unSelectMatchingOptions(from,regex);}}for(var i=0;i=0;i--){var o = from.options[i];if(o.selected){from.options[i] = null;}}if((arguments.length<3) ||(arguments[2]==true)){sortSelect(from);sortSelect(to);}from.selectedIndex = -1;to.selectedIndex = -1;} +function copySelectedOptions(from,to){var options = new Object();for(var i=0;i=0;i--){var o=from.options[i];if(o.selected){from.options[i] = null;}}from.selectedIndex = -1;} + + +/* SOURCE FILE: OptionTransfer.js */ + +function OT_transferLeft(){moveSelectedOptions(this.right,this.left,this.autoSort);this.update();} +function OT_transferRight(){moveSelectedOptions(this.left,this.right,this.autoSort);this.update();} +function OT_transferAllLeft(){moveAllOptions(this.right,this.left,this.autoSort);this.update();} +function OT_transferAllRight(){moveAllOptions(this.left,this.right,this.autoSort);this.update();} +function OT_saveRemovedLeftOptions(f){this.removedLeftField = f;} +function OT_saveRemovedRightOptions(f){this.removedRightField = f;} +function OT_saveAddedLeftOptions(f){this.addedLeftField = f;} +function OT_saveAddedRightOptions(f){this.addedRightField = f;} +function OT_saveNewLeftOptions(f){this.newLeftField = f;} +function OT_saveNewRightOptions(f){this.newRightField = f;} +function OT_update(){var removedLeft = new Object();var removedRight = new Object();var addedLeft = new Object();var addedRight = new Object();var newLeft = new Object();var newRight = new Object();for(var i=0;i0){str=str+delimiter;}str=str+val;}return str;} +function OT_setDelimiter(val){this.delimiter=val;} +function OT_setAutoSort(val){this.autoSort=val;} +function OT_init(theform){this.form = theform;if(!theform[this.left]){alert("OptionTransfer init(): Left select list does not exist in form!");return false;}if(!theform[this.right]){alert("OptionTransfer init(): Right select list does not exist in form!");return false;}this.left=theform[this.left];this.right=theform[this.right];for(var i=0;i9?"":"0")+x} +function isDate(val,format){var date=getDateFromFormat(val,format);if(date==0){return false;}return true;} +function compareDates(date1,dateformat1,date2,dateformat2){var d1=getDateFromFormat(date1,dateformat1);var d2=getDateFromFormat(date2,dateformat2);if(d1==0 || d2==0){return -1;}else if(d1 > d2){return 1;}return 0;} +function formatDate(date,format){format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getYear()+"";var M=date.getMonth()+1;var d=date.getDate();var E=date.getDay();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;var value=new Object();if(y.length < 4){y=""+(y-0+1900);}value["y"]=""+y;value["yyyy"]=y;value["yy"]=y.substring(2,4);value["M"]=M;value["MM"]=LZ(M);value["MMM"]=MONTH_NAMES[M-1];value["NNN"]=MONTH_NAMES[M+11];value["d"]=d;value["dd"]=LZ(d);value["E"]=DAY_NAMES[E+7];value["EE"]=DAY_NAMES[E];value["H"]=H;value["HH"]=LZ(H);if(H==0){value["h"]=12;}else if(H>12){value["h"]=H-12;}else{value["h"]=H;}value["hh"]=LZ(value["h"]);if(H>11){value["K"]=H-12;}else{value["K"]=H;}value["k"]=H+1;value["KK"]=LZ(value["K"]);value["kk"]=LZ(value["k"]);if(H > 11){value["a"]="PM";}else{value["a"]="AM";}value["m"]=m;value["mm"]=LZ(m);value["s"]=s;value["ss"]=LZ(s);while(i_format < format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c) &&(i_format < format.length)){token += format.charAt(i_format++);}if(value[token] != null){result=result + value[token];}else{result=result + token;}}return result;} +function _isInteger(val){var digits="1234567890";for(var i=0;i < val.length;i++){if(digits.indexOf(val.charAt(i))==-1){return false;}}return true;} +function _getInt(str,i,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var token=str.substring(i,i+x);if(token.length < minlength){return null;}if(_isInteger(token)){return token;}}return null;} +function getDateFromFormat(val,format){val=val+"";format=format+"";var i_val=0;var i_format=0;var c="";var token="";var token2="";var x,y;var now=new Date();var year=now.getYear();var month=now.getMonth()+1;var date=1;var hh=now.getHours();var mm=now.getMinutes();var ss=now.getSeconds();var ampm="";while(i_format < format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c) &&(i_format < format.length)){token += format.charAt(i_format++);}if(token=="yyyy" || token=="yy" || token=="y"){if(token=="yyyy"){x=4;y=4;}if(token=="yy"){x=2;y=2;}if(token=="y"){x=2;y=4;}year=_getInt(val,i_val,x,y);if(year==null){return 0;}i_val += year.length;if(year.length==2){if(year > 70){year=1900+(year-0);}else{year=2000+(year-0);}}}else if(token=="MMM"||token=="NNN"){month=0;for(var i=0;i11)){month=i+1;if(month>12){month -= 12;}i_val += month_name.length;break;}}}if((month < 1)||(month>12)){return 0;}}else if(token=="EE"||token=="E"){for(var i=0;i12)){return 0;}i_val+=month.length;}else if(token=="dd"||token=="d"){date=_getInt(val,i_val,token.length,2);if(date==null||(date<1)||(date>31)){return 0;}i_val+=date.length;}else if(token=="hh"||token=="h"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>12)){return 0;}i_val+=hh.length;}else if(token=="HH"||token=="H"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>23)){return 0;}i_val+=hh.length;}else if(token=="KK"||token=="K"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>11)){return 0;}i_val+=hh.length;}else if(token=="kk"||token=="k"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>24)){return 0;}i_val+=hh.length;hh--;}else if(token=="mm"||token=="m"){mm=_getInt(val,i_val,token.length,2);if(mm==null||(mm<0)||(mm>59)){return 0;}i_val+=mm.length;}else if(token=="ss"||token=="s"){ss=_getInt(val,i_val,token.length,2);if(ss==null||(ss<0)||(ss>59)){return 0;}i_val+=ss.length;}else if(token=="a"){if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ampm="AM";}else if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ampm="PM";}else{return 0;}i_val+=2;}else{if(val.substring(i_val,i_val+token.length)!=token){return 0;}else{i_val+=token.length;}}}if(i_val != val.length){return 0;}if(month==2){if( ((year%4==0)&&(year%100 != 0) ) ||(year%400==0) ){if(date > 29){return 0;}}else{if(date > 28){return 0;}}}if((month==4)||(month==6)||(month==9)||(month==11)){if(date > 30){return 0;}}if(hh<12 && ampm=="PM"){hh=hh-0+12;}else if(hh>11 && ampm=="AM"){hh-=12;}var newdate=new Date(year,month-1,date,hh,mm,ss);return newdate.getTime();} +function parseDate(val){var preferEuro=(arguments.length==2)?arguments[1]:false;generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M');var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst');var d=null;for(var i=0;i screen.availHeight){this.y = screen.availHeight - this.height;}}if(screen && screen.availWidth){if((this.x + this.width) > screen.availWidth){this.x = screen.availWidth - this.width;}}var avoidAboutBlank = window.opera ||( document.layers && !navigator.mimeTypes['*']) || navigator.vendor == 'KDE' ||( document.childNodes && !document.all && !navigator.taintEnabled);this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");}this.refresh();}} +function PopupWindow_hidePopup(){if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).style.visibility = "hidden";}else if(this.use_css){document.all[this.divName].style.visibility = "hidden";}else if(this.use_layers){document.layers[this.divName].visibility = "hidden";}}else{if(this.popupWindow && !this.popupWindow.closed){this.popupWindow.close();this.popupWindow = null;}}} +function PopupWindow_isClicked(e){if(this.divName != null){if(this.use_layers){var clickX = e.pageX;var clickY = e.pageY;var t = document.layers[this.divName];if((clickX > t.left) &&(clickX < t.left+t.clip.width) &&(clickY > t.top) &&(clickY < t.top+t.clip.height)){return true;}else{return false;}}else if(document.all){var t = window.event.srcElement;while(t.parentElement != null){if(t.id==this.divName){return true;}t = t.parentElement;}return false;}else if(this.use_gebi){var t = e.originalTarget;while(t.parentNode != null){if(t.id==this.divName){return true;}t = t.parentNode;}return false;}return false;}return false;} +function PopupWindow_hideIfNotClicked(e){if(this.autoHideEnabled && !this.isClicked(e)){this.hidePopup();}} +function PopupWindow_autoHide(){this.autoHideEnabled = true;} +function PopupWindow_hidePopupWindows(e){for(var i=0;i0){this.type="DIV";this.divName = arguments[0];}else{this.type="WINDOW";}this.use_gebi = false;this.use_css = false;this.use_layers = false;if(document.getElementById){this.use_gebi = true;}else if(document.all){this.use_css = true;}else if(document.layers){this.use_layers = true;}else{this.type = "WINDOW";}this.offsetX = 0;this.offsetY = 0;this.getXYPosition = PopupWindow_getXYPosition;this.populate = PopupWindow_populate;this.setUrl = PopupWindow_setUrl;this.setWindowProperties = PopupWindow_setWindowProperties;this.refresh = PopupWindow_refresh;this.showPopup = PopupWindow_showPopup;this.hidePopup = PopupWindow_hidePopup;this.setSize = PopupWindow_setSize;this.isClicked = PopupWindow_isClicked;this.autoHide = PopupWindow_autoHide;this.hideIfNotClicked = PopupWindow_hideIfNotClicked;} + + +/* SOURCE FILE: CalendarPopup.js */ + +function CalendarPopup(){var c;if(arguments.length>0){c = new PopupWindow(arguments[0]);}else{c = new PopupWindow();c.setSize(150,175);}c.offsetX = -152;c.offsetY = 25;c.autoHide();c.monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");c.monthAbbreviations = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");c.dayHeaders = new Array("S","M","T","W","T","F","S");c.returnFunction = "CP_tmpReturnFunction";c.returnMonthFunction = "CP_tmpReturnMonthFunction";c.returnQuarterFunction = "CP_tmpReturnQuarterFunction";c.returnYearFunction = "CP_tmpReturnYearFunction";c.weekStartDay = 0;c.isShowYearNavigation = false;c.displayType = "date";c.disabledWeekDays = new Object();c.disabledDatesExpression = "";c.yearSelectStartOffset = 2;c.currentDate = null;c.todayText="Today";c.cssPrefix="";c.isShowYearNavigationInput=false;window.CP_targetInput = null;window.CP_dateFormat = "MM/dd/yyyy";c.setReturnFunction = CP_setReturnFunction;c.setReturnMonthFunction = CP_setReturnMonthFunction;c.setReturnQuarterFunction = CP_setReturnQuarterFunction;c.setReturnYearFunction = CP_setReturnYearFunction;c.setMonthNames = CP_setMonthNames;c.setMonthAbbreviations = CP_setMonthAbbreviations;c.setDayHeaders = CP_setDayHeaders;c.setWeekStartDay = CP_setWeekStartDay;c.setDisplayType = CP_setDisplayType;c.setDisabledWeekDays = CP_setDisabledWeekDays;c.addDisabledDates = CP_addDisabledDates;c.setYearSelectStartOffset = CP_setYearSelectStartOffset;c.setTodayText = CP_setTodayText;c.showYearNavigation = CP_showYearNavigation;c.showCalendar = CP_showCalendar;c.hideCalendar = CP_hideCalendar;c.getStyles = getCalendarStyles;c.refreshCalendar = CP_refreshCalendar;c.getCalendar = CP_getCalendar;c.select = CP_select;c.setCssPrefix = CP_setCssPrefix;c.showYearNavigationInput = CP_showYearNavigationInput +return c;} +function CP_tmpReturnFunction(y,m,d){if(window.CP_targetInput!=null){var dt = new Date(y,m-1,d,0,0,0);window.CP_targetInput.value = formatDate(dt,window.CP_dateFormat);}else{alert('Use setReturnFunction() to define which function will get the clicked results!');}} +function CP_tmpReturnMonthFunction(y,m){alert('Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , month='+m);} +function CP_tmpReturnQuarterFunction(y,q){alert('Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , quarter='+q);} +function CP_tmpReturnYearFunction(y){alert('Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year='+y);} +function CP_setReturnFunction(name){this.returnFunction = name;} +function CP_setReturnMonthFunction(name){this.returnMonthFunction = name;} +function CP_setReturnQuarterFunction(name){this.returnQuarterFunction = name;} +function CP_setReturnYearFunction(name){this.returnYearFunction = name;} +function CP_setMonthNames(){for(var i=0;i0)?arguments[0]:true;} +function CP_setDisplayType(type){if(type!="date"&&type!="week-end"&&type!="month"&&type!="quarter"&&type!="year"){alert("Invalid display type! Must be one of: date,week-end,month,quarter,year");return false;}this.displayType=type;} +function CP_setYearSelectStartOffset(num){this.yearSelectStartOffset=num;} +function CP_setDisabledWeekDays(){this.disabledWeekDays = new Object();for(var i=0;i="+start+")";}else{this.disabledDatesExpression+="(ds>="+start+"&&ds<="+end+")";}} +function CP_setTodayText(text){this.todayText = text;} +function CP_setCssPrefix(val){this.cssPrefix = val;} +function CP_showYearNavigationInput(){this.isShowYearNavigationInput =(arguments.length>0)?arguments[0]:true;} +function CP_hideCalendar(){if(arguments.length > 0){window.popupWindowObjects[arguments[0]].hidePopup();}else{this.hidePopup();}} +function CP_refreshCalendar(index){var calObject = window.popupWindowObjects[index];if(arguments.length>1){calObject.populate(calObject.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]));}else{calObject.populate(calObject.getCalendar());}calObject.refresh();} +function CP_showCalendar(anchorname){if(arguments.length>1){if(arguments[1]==null||arguments[1]==""){this.currentDate=new Date();}else{this.currentDate=new Date(parseDate(arguments[1]));}}this.populate(this.getCalendar());this.showPopup(anchorname);} +function CP_select(inputobj, linkname, format){var selectedDate=(arguments.length>3)?arguments[3]:null;if(!window.getDateFromFormat){alert("calendar.select: To use this method you must also include 'date.js' for date formatting");return;}if(this.displayType!="date"&&this.displayType!="week-end"){alert("calendar.select: This function can only be used with displayType 'date' or 'week-end'");return;}if(inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea"){alert("calendar.select: Input object passed is not a valid form input object");window.CP_targetInput=null;return;}window.CP_targetInput = inputobj;this.currentDate=null;var time=0;if(selectedDate!=null){time = getDateFromFormat(selectedDate,format)}else if(inputobj.value!=""){time = getDateFromFormat(inputobj.value,format);}if(selectedDate!=null || inputobj.value!=""){if(time==0){this.currentDate=null;}else{this.currentDate=new Date(time);}}window.CP_dateFormat = format;this.showCalendar(linkname);} +function getCalendarStyles(){var result = "";var p = "";if(this!=null && typeof(this.cssPrefix)!="undefined" && this.cssPrefix!=null && this.cssPrefix!=""){p=this.cssPrefix;}result += "\n";return result;} +function CP_getCalendar(){var now = new Date();if(this.type == "WINDOW"){var windowref = "window.opener.";}else{var windowref = "";}var result = "";if(this.type == "WINDOW"){result += "Calendar"+this.getStyles()+"\n";result += '
\n';}else{result += '
\n';result += '
\n';result += '
\n';}if(this.displayType=="date" || this.displayType=="week-end"){if(this.currentDate==null){this.currentDate = now;}if(arguments.length > 0){var month = arguments[0];}else{var month = this.currentDate.getMonth()+1;}if(arguments.length > 1 && arguments[1]>0 && arguments[1]-0==arguments[1]){var year = arguments[1];}else{var year = this.currentDate.getFullYear();}var daysinmonth= new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);if( ((year%4 == 0)&&(year%100 != 0) ) ||(year%400 == 0) ){daysinmonth[2] = 29;}var current_month = new Date(year,month-1,1);var display_year = year;var display_month = month;var display_date = 1;var weekday= current_month.getDay();var offset = 0;offset =(weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 7-this.weekStartDay+weekday ;if(offset > 0){display_month--;if(display_month < 1){display_month = 12;display_year--;}display_date = daysinmonth[display_month]-offset+1;}var next_month = month+1;var next_month_year = year;if(next_month > 12){next_month=1;next_month_year++;}var last_month = month-1;var last_month_year = year;if(last_month < 1){last_month=12;last_month_year--;}var date_class;if(this.type!="WINDOW"){result += "";}result += '\n';var refresh = 'javascript:'+windowref+'CP_refreshCalendar';if(this.isShowYearNavigation){result += '';result += '';result += '';result += '';result += '';if(this.isShowYearNavigationInput){result += '';}else{result += '';}result += '';}else{result += '\n';result += '\n';result += '\n';}result += '
<'+this.monthNames[month-1]+'> <'+year+'><<'+this.monthNames[month-1]+' '+year+'>>
\n';result += '\n';result += '\n';for(var j=0;j<7;j++){result += '\n';}result += '\n';for(var row=1;row<=6;row++){result += '\n';for(var col=1;col<=7;col++){var disabled=false;if(this.disabledDatesExpression!=""){var ds=""+display_year+LZ(display_month)+LZ(display_date);eval("disabled=("+this.disabledDatesExpression+")");}var dateClass = "";if((display_month == this.currentDate.getMonth()+1) &&(display_date==this.currentDate.getDate()) &&(display_year==this.currentDate.getFullYear())){dateClass = "cpCurrentDate";}else if(display_month == month){dateClass = "cpCurrentMonthDate";}else{dateClass = "cpOtherMonthDate";}if(disabled || this.disabledWeekDays[col-1]){result += ' \n';}else{var selected_date = display_date;var selected_month = display_month;var selected_year = display_year;if(this.displayType=="week-end"){var d = new Date(selected_year,selected_month-1,selected_date,0,0,0,0);d.setDate(d.getDate() +(7-col));selected_year = d.getYear();if(selected_year < 1000){selected_year += 1900;}selected_month = d.getMonth()+1;selected_date = d.getDate();}result += ' \n';}display_date++;if(display_date > daysinmonth[display_month]){display_date=1;display_month++;}if(display_month > 12){display_month=1;display_year++;}}result += '';}var current_weekday = now.getDay() - this.weekStartDay;if(current_weekday < 0){current_weekday += 7;}result += '\n';result += '
'+this.dayHeaders[(this.weekStartDay+j)%7]+'
'+display_date+''+display_date+'
\n';if(this.disabledDatesExpression!=""){var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate());eval("disabled=("+this.disabledDatesExpression+")");}if(disabled || this.disabledWeekDays[current_weekday+1]){result += ' '+this.todayText+'\n';}else{result += ' '+this.todayText+'\n';}result += '
\n';result += '
\n';}if(this.displayType=="month" || this.displayType=="quarter" || this.displayType=="year"){if(arguments.length > 0){var year = arguments[0];}else{if(this.displayType=="year"){var year = now.getFullYear()-this.yearSelectStartOffset;}else{var year = now.getFullYear();}}if(this.displayType!="year" && this.isShowYearNavigation){result += "";result += '\n';result += ' \n';result += ' \n';result += ' \n';result += '
<<'+year+'>>
\n';}}if(this.displayType=="month"){result += '\n';for(var i=0;i<4;i++){result += '';for(var j=0;j<3;j++){var monthindex =((i*3)+j);result += '';}result += '';}result += '
'+this.monthAbbreviations[monthindex]+'
\n';}if(this.displayType=="quarter"){result += '
\n';for(var i=0;i<2;i++){result += '';for(var j=0;j<2;j++){var quarter =((i*2)+j+1);result += '';}result += '';}result += '

Q'+quarter+'

\n';}if(this.displayType=="year"){var yearColumnSize = 4;result += "";result += '\n';result += ' \n';result += ' \n';result += '
<<>>
\n';result += '\n';for(var i=0;i'+currentyear+'';}result += '';}result += '
\n';}if(this.type == "WINDOW"){result += "\n";}return result;} + diff --git a/tools/authcon/auth/resources/mattkruse-lib/AnchorPosition.js b/tools/authcon/auth/resources/mattkruse-lib/AnchorPosition.js new file mode 100644 index 0000000000..deb7922afe --- /dev/null +++ b/tools/authcon/auth/resources/mattkruse-lib/AnchorPosition.js @@ -0,0 +1,147 @@ +// =================================================================== +// Author: Matt Kruse +// WWW: http://www.mattkruse.com/ +// +// NOTICE: You may use this code for any purpose, commercial or +// private, without any further permission from the author. You may +// remove this notice from your final code if you wish, however it is +// appreciated by the author if at least my web site address is kept. +// +// You may *NOT* re-distribute this code in any way except through its +// use. That means, you can include it in your product, or your web +// site, or any other form where the code is actually being used. You +// may not put the plain javascript up on your site for download or +// include it in your javascript libraries for download. +// If you wish to share this code with others, please just point them +// to the URL instead. +// Please DO NOT link directly to my .js files from your site. Copy +// the files to your server and use them there. Thank you. +// =================================================================== + +/* +AnchorPosition.js +Author: Matt Kruse +Last modified: 10/11/02 + +DESCRIPTION: These functions find the position of an tag in a document, +so other elements can be positioned relative to it. + +COMPATIBILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small +positioning errors - usually with Window positioning - occur on the +Macintosh platform. + +FUNCTIONS: +getAnchorPosition(anchorname) + Returns an Object() having .x and .y properties of the pixel coordinates + of the upper-left corner of the anchor. Position is relative to the PAGE. + +getAnchorWindowPosition(anchorname) + Returns an Object() having .x and .y properties of the pixel coordinates + of the upper-left corner of the anchor, relative to the WHOLE SCREEN. + +NOTES: + +1) For popping up separate browser windows, use getAnchorWindowPosition. + Otherwise, use getAnchorPosition + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. +*/ + +// getAnchorPosition(anchorname) +// This function returns an object having .x and .y properties which are the coordinates +// of the named anchor, relative to the page. +function getAnchorPosition(anchorname) { + // This function will return an Object with x and y properties + var useWindow=false; + var coordinates=new Object(); + var x=0,y=0; + // Browser capability sniffing + var use_gebi=false, use_css=false, use_layers=false; + if (document.getElementById) { use_gebi=true; } + else if (document.all) { use_css=true; } + else if (document.layers) { use_layers=true; } + // Logic to find position + if (use_gebi && document.all) { + x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); + y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); + } + else if (use_gebi) { + var o=document.getElementById(anchorname); + x=AnchorPosition_getPageOffsetLeft(o); + y=AnchorPosition_getPageOffsetTop(o); + } + else if (use_css) { + x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); + y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); + } + else if (use_layers) { + var found=0; + for (var i=0; i +// WWW: http://www.mattkruse.com/ +// +// NOTICE: You may use this code for any purpose, commercial or +// private, without any further permission from the author. You may +// remove this notice from your final code if you wish, however it is +// appreciated by the author if at least my web site address is kept. +// +// You may *NOT* re-distribute this code in any way except through its +// use. That means, you can include it in your product, or your web +// site, or any other form where the code is actually being used. You +// may not put the plain javascript up on your site for download or +// include it in your javascript libraries for download. +// If you wish to share this code with others, please just point them +// to the URL instead. +// Please DO NOT link directly to my .js files from your site. Copy +// the files to your server and use them there. Thank you. +// =================================================================== + +// HISTORY +// ------------------------------------------------------------------ +// March 24, 2004: Fixed bug - when month name and abbreviations were +// changed, date format still used original values. +// January 26, 2004: Added support for drop-down month and year +// navigation (Thanks to Chris Reid for the idea) +// September 22, 2003: Fixed a minor problem in YEAR calendar with +// CSS prefix. +// August 19, 2003: Renamed the function to get styles, and made it +// work correctly without an object reference +// August 18, 2003: Changed showYearNavigation and +// showYearNavigationInput to optionally take an argument of +// true or false +// July 31, 2003: Added text input option for year navigation. +// Added a per-calendar CSS prefix option to optionally use +// different styles for different calendars. +// July 29, 2003: Fixed bug causing the Today link to be clickable +// even though today falls in a disabled date range. +// Changed formatting to use pure CSS, allowing greater control +// over look-and-feel options. +// June 11, 2003: Fixed bug causing the Today link to be unselectable +// under certain cases when some days of week are disabled +// March 14, 2003: Added ability to disable individual dates or date +// ranges, display as light gray and strike-through +// March 14, 2003: Removed dependency on graypixel.gif and instead +/// use table border coloring +// March 12, 2003: Modified showCalendar() function to allow optional +// start-date parameter +// March 11, 2003: Modified select() function to allow optional +// start-date parameter +/* +DESCRIPTION: This object implements a popup calendar to allow the user to +select a date, month, quarter, or year. + +COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small +positioning errors - usually with Window positioning - occur on the +Macintosh platform. +The calendar can be modified to work for any location in the world by +changing which weekday is displayed as the first column, changing the month +names, and changing the column headers for each day. + +USAGE: +// Create a new CalendarPopup object of type WINDOW +var cal = new CalendarPopup(); + +// Create a new CalendarPopup object of type DIV using the DIV named 'mydiv' +var cal = new CalendarPopup('mydiv'); + +// Easy method to link the popup calendar with an input box. +cal.select(inputObject, anchorname, dateFormat); +// Same method, but passing a default date other than the field's current value +cal.select(inputObject, anchorname, dateFormat, '01/02/2000'); +// This is an example call to the popup calendar from a link to populate an +// input box. Note that to use this, date.js must also be included!! +Select + +// Set the type of date select to be used. By default it is 'date'. +cal.setDisplayType(type); + +// When a date, month, quarter, or year is clicked, a function is called and +// passed the details. You must write this function, and tell the calendar +// popup what the function name is. +// Function to be called for 'date' select receives y, m, d +cal.setReturnFunction(functionname); +// Function to be called for 'month' select receives y, m +cal.setReturnMonthFunction(functionname); +// Function to be called for 'quarter' select receives y, q +cal.setReturnQuarterFunction(functionname); +// Function to be called for 'year' select receives y +cal.setReturnYearFunction(functionname); + +// Show the calendar relative to a given anchor +cal.showCalendar(anchorname); + +// Hide the calendar. The calendar is set to autoHide automatically +cal.hideCalendar(); + +// Set the month names to be used. Default are English month names +cal.setMonthNames("January","February","March",...); + +// Set the month abbreviations to be used. Default are English month abbreviations +cal.setMonthAbbreviations("Jan","Feb","Mar",...); + +// Show navigation for changing by the year, not just one month at a time +cal.showYearNavigation(); + +// Show month and year dropdowns, for quicker selection of month of dates +cal.showNavigationDropdowns(); + +// Set the text to be used above each day column. The days start with +// sunday regardless of the value of WeekStartDay +cal.setDayHeaders("S","M","T",...); + +// Set the day for the first column in the calendar grid. By default this +// is Sunday (0) but it may be changed to fit the conventions of other +// countries. +cal.setWeekStartDay(1); // week is Monday - Saturday + +// Set the weekdays which should be disabled in the 'date' select popup. You can +// then allow someone to only select week end dates, or Tuedays, for example +cal.setDisabledWeekDays(0,1); // To disable selecting the 1st or 2nd days of the week + +// Selectively disable individual days or date ranges. Disabled days will not +// be clickable, and show as strike-through text on current browsers. +// Date format is any format recognized by parseDate() in date.js +// Pass a single date to disable: +cal.addDisabledDates("2003-01-01"); +// Pass null as the first parameter to mean "anything up to and including" the +// passed date: +cal.addDisabledDates(null, "01/02/03"); +// Pass null as the second parameter to mean "including the passed date and +// anything after it: +cal.addDisabledDates("Jan 01, 2003", null); +// Pass two dates to disable all dates inbetween and including the two +cal.addDisabledDates("January 01, 2003", "Dec 31, 2003"); + +// When the 'year' select is displayed, set the number of years back from the +// current year to start listing years. Default is 2. +// This is also used for year drop-down, to decide how many years +/- to display +cal.setYearSelectStartOffset(2); + +// Text for the word "Today" appearing on the calendar +cal.setTodayText("Today"); + +// The calendar uses CSS classes for formatting. If you want your calendar to +// have unique styles, you can set the prefix that will be added to all the +// classes in the output. +// For example, normal output may have this: +// Today +// But if you set the prefix like this: +cal.setCssPrefix("Test"); +// The output will then look like: +// Today +// And you can define that style somewhere in your page. + +// When using Year navigation, you can make the year be an input box, so +// the user can manually change it and jump to any year +cal.showYearNavigationInput(); + +// Set the calendar offset to be different than the default. By default it +// will appear just below and to the right of the anchorname. So if you have +// a text box where the date will go and and anchor immediately after the +// text box, the calendar will display immediately under the text box. +cal.offsetX = 20; +cal.offsetY = 20; + +NOTES: +1) Requires the functions in AnchorPosition.js and PopupWindow.js + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. + +4) When a CalendarPopup object is created, a handler for 'onmouseup' is + attached to any event handler you may have already defined. Do NOT define + an event handler for 'onmouseup' after you define a CalendarPopup object + or the autoHide() will not work correctly. + +5) The calendar popup display uses style sheets to make it look nice. + +*/ + +// CONSTRUCTOR for the CalendarPopup Object +function CalendarPopup() { + var c; + if (arguments.length>0) { + c = new PopupWindow(arguments[0]); + } + else { + c = new PopupWindow(); + c.setSize(150,175); + } + c.offsetX = -152; + c.offsetY = 25; + c.autoHide(); + // Calendar-specific properties + c.monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); + c.monthAbbreviations = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); + c.dayHeaders = new Array("S","M","T","W","T","F","S"); + c.returnFunction = "CP_tmpReturnFunction"; + c.returnMonthFunction = "CP_tmpReturnMonthFunction"; + c.returnQuarterFunction = "CP_tmpReturnQuarterFunction"; + c.returnYearFunction = "CP_tmpReturnYearFunction"; + c.weekStartDay = 0; + c.isShowYearNavigation = false; + c.displayType = "date"; + c.disabledWeekDays = new Object(); + c.disabledDatesExpression = ""; + c.yearSelectStartOffset = 2; + c.currentDate = null; + c.todayText="Today"; + c.cssPrefix=""; + c.isShowNavigationDropdowns=false; + c.isShowYearNavigationInput=false; + window.CP_calendarObject = null; + window.CP_targetInput = null; + window.CP_dateFormat = "MM/dd/yyyy"; + // Method mappings + c.copyMonthNamesToWindow = CP_copyMonthNamesToWindow; + c.setReturnFunction = CP_setReturnFunction; + c.setReturnMonthFunction = CP_setReturnMonthFunction; + c.setReturnQuarterFunction = CP_setReturnQuarterFunction; + c.setReturnYearFunction = CP_setReturnYearFunction; + c.setMonthNames = CP_setMonthNames; + c.setMonthAbbreviations = CP_setMonthAbbreviations; + c.setDayHeaders = CP_setDayHeaders; + c.setWeekStartDay = CP_setWeekStartDay; + c.setDisplayType = CP_setDisplayType; + c.setDisabledWeekDays = CP_setDisabledWeekDays; + c.addDisabledDates = CP_addDisabledDates; + c.setYearSelectStartOffset = CP_setYearSelectStartOffset; + c.setTodayText = CP_setTodayText; + c.showYearNavigation = CP_showYearNavigation; + c.showCalendar = CP_showCalendar; + c.hideCalendar = CP_hideCalendar; + c.getStyles = getCalendarStyles; + c.refreshCalendar = CP_refreshCalendar; + c.getCalendar = CP_getCalendar; + c.select = CP_select; + c.setCssPrefix = CP_setCssPrefix; + c.showNavigationDropdowns = CP_showNavigationDropdowns; + c.showYearNavigationInput = CP_showYearNavigationInput; + c.copyMonthNamesToWindow(); + // Return the object + return c; + } +function CP_copyMonthNamesToWindow() { + // Copy these values over to the date.js + if (typeof(window.MONTH_NAMES)!="undefined" && window.MONTH_NAMES!=null) { + window.MONTH_NAMES = new Array(); + for (var i=0; i\n"; + result += '
\n'; + } + else { + result += '
\n'; + result += '
\n'; + result += '
\n'; + } + // Code for DATE display (default) + // ------------------------------- + if (this.displayType=="date" || this.displayType=="week-end") { + if (this.currentDate==null) { this.currentDate = now; } + if (arguments.length > 0) { var month = arguments[0]; } + else { var month = this.currentDate.getMonth()+1; } + if (arguments.length > 1 && arguments[1]>0 && arguments[1]-0==arguments[1]) { var year = arguments[1]; } + else { var year = this.currentDate.getFullYear(); } + var daysinmonth= new Array(0,31,28,31,30,31,30,31,31,30,31,30,31); + if ( ( (year%4 == 0)&&(year%100 != 0) ) || (year%400 == 0) ) { + daysinmonth[2] = 29; + } + var current_month = new Date(year,month-1,1); + var display_year = year; + var display_month = month; + var display_date = 1; + var weekday= current_month.getDay(); + var offset = 0; + + offset = (weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 7-this.weekStartDay+weekday ; + if (offset > 0) { + display_month--; + if (display_month < 1) { display_month = 12; display_year--; } + display_date = daysinmonth[display_month]-offset+1; + } + var next_month = month+1; + var next_month_year = year; + if (next_month > 12) { next_month=1; next_month_year++; } + var last_month = month-1; + var last_month_year = year; + if (last_month < 1) { last_month=12; last_month_year--; } + var date_class; + if (this.type!="WINDOW") { + result += ""; + } + result += '\n'; + var refresh = windowref+'CP_refreshCalendar'; + var refreshLink = 'javascript:' + refresh; + if (this.isShowNavigationDropdowns) { + result += ''; + result += ''; + + result += ''; + } + else { + if (this.isShowYearNavigation) { + result += ''; + result += ''; + result += ''; + result += ''; + + result += ''; + if (this.isShowYearNavigationInput) { + result += ''; + } + else { + result += ''; + } + result += ''; + } + else { + result += '\n'; + result += '\n'; + result += '\n'; + } + } + result += '
 <'+this.monthNames[month-1]+'> <'+year+'><<'+this.monthNames[month-1]+' '+year+'>>
\n'; + result += '\n'; + result += '\n'; + for (var j=0; j<7; j++) { + + result += '\n'; + } + result += '\n'; + for (var row=1; row<=6; row++) { + result += '\n'; + for (var col=1; col<=7; col++) { + var disabled=false; + if (this.disabledDatesExpression!="") { + var ds=""+display_year+LZ(display_month)+LZ(display_date); + eval("disabled=("+this.disabledDatesExpression+")"); + } + var dateClass = ""; + if ((display_month == this.currentDate.getMonth()+1) && (display_date==this.currentDate.getDate()) && (display_year==this.currentDate.getFullYear())) { + dateClass = "cpCurrentDate"; + } + else if (display_month == month) { + dateClass = "cpCurrentMonthDate"; + } + else { + dateClass = "cpOtherMonthDate"; + } + if (disabled || this.disabledWeekDays[col-1]) { + result += ' \n'; + } + else { + var selected_date = display_date; + var selected_month = display_month; + var selected_year = display_year; + if (this.displayType=="week-end") { + var d = new Date(selected_year,selected_month-1,selected_date,0,0,0,0); + d.setDate(d.getDate() + (7-col)); + selected_year = d.getYear(); + if (selected_year < 1000) { selected_year += 1900; } + selected_month = d.getMonth()+1; + selected_date = d.getDate(); + } + result += ' \n'; + } + display_date++; + if (display_date > daysinmonth[display_month]) { + display_date=1; + display_month++; + } + if (display_month > 12) { + display_month=1; + display_year++; + } + } + result += ''; + } + var current_weekday = now.getDay() - this.weekStartDay; + if (current_weekday < 0) { + current_weekday += 7; + } + result += '\n'; + result += '
'+this.dayHeaders[(this.weekStartDay+j)%7]+'
'+display_date+''+display_date+'
\n'; + if (this.disabledDatesExpression!="") { + var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate()); + eval("disabled=("+this.disabledDatesExpression+")"); + } + if (disabled || this.disabledWeekDays[current_weekday+1]) { + result += ' '+this.todayText+'\n'; + } + else { + result += ' '+this.todayText+'\n'; + } + result += '
\n'; + result += '
\n'; + } + + // Code common for MONTH, QUARTER, YEAR + // ------------------------------------ + if (this.displayType=="month" || this.displayType=="quarter" || this.displayType=="year") { + if (arguments.length > 0) { var year = arguments[0]; } + else { + if (this.displayType=="year") { var year = now.getFullYear()-this.yearSelectStartOffset; } + else { var year = now.getFullYear(); } + } + if (this.displayType!="year" && this.isShowYearNavigation) { + result += ""; + result += '\n'; + result += ' \n'; + result += ' \n'; + result += ' \n'; + result += '
<<'+year+'>>
\n'; + } + } + + // Code for MONTH display + // ---------------------- + if (this.displayType=="month") { + // If POPUP, write entire HTML document + result += '\n'; + for (var i=0; i<4; i++) { + result += ''; + for (var j=0; j<3; j++) { + var monthindex = ((i*3)+j); + result += ''; + } + result += ''; + } + result += '
'+this.monthAbbreviations[monthindex]+'
\n'; + } + + // Code for QUARTER display + // ------------------------ + if (this.displayType=="quarter") { + result += '
\n'; + for (var i=0; i<2; i++) { + result += ''; + for (var j=0; j<2; j++) { + var quarter = ((i*2)+j+1); + result += ''; + } + result += ''; + } + result += '

Q'+quarter+'

\n'; + } + + // Code for YEAR display + // --------------------- + if (this.displayType=="year") { + var yearColumnSize = 4; + result += ""; + result += '\n'; + result += ' \n'; + result += ' \n'; + result += '
<<>>
\n'; + result += '\n'; + for (var i=0; i'+currentyear+''; + } + result += ''; + } + result += '
\n'; + } + // Common + if (this.type == "WINDOW") { + result += "\n"; + } + return result; + } diff --git a/tools/authcon/auth/resources/mattkruse-lib/OptionTransfer.js b/tools/authcon/auth/resources/mattkruse-lib/OptionTransfer.js new file mode 100644 index 0000000000..4e19afa86d --- /dev/null +++ b/tools/authcon/auth/resources/mattkruse-lib/OptionTransfer.js @@ -0,0 +1,187 @@ +// =================================================================== +// Author: Matt Kruse +// WWW: http://www.mattkruse.com/ +// +// NOTICE: You may use this code for any purpose, commercial or +// private, without any further permission from the author. You may +// remove this notice from your final code if you wish, however it is +// appreciated by the author if at least my web site address is kept. +// +// You may *NOT* re-distribute this code in any way except through its +// use. That means, you can include it in your product, or your web +// site, or any other form where the code is actually being used. You +// may not put the plain javascript up on your site for download or +// include it in your javascript libraries for download. +// If you wish to share this code with others, please just point them +// to the URL instead. +// Please DO NOT link directly to my .js files from your site. Copy +// the files to your server and use them there. Thank you. +// =================================================================== + +/* +OptionTransfer.js +Last Modified: 11/18/2002 + +DESCRIPTION: This widget is used to easily and quickly create an interface +where the user can transfer choices from one select box to another. For +example, when selecting which columns to show or hide in search results. +This object adds value by automatically storing the values that were added +or removed from each list, as well as the state of the final list. + +COMPATIBILITY: Should work on all Javascript-compliant browsers. + +USAGE: +// Create a new OptionTransfer object. Pass it the field names of the left +// select box and the right select box. +var ot = new OptionTransfer("from","to"); + +// Optionally tell the lists whether or not to auto-sort when options are +// moved. By default, the lists will be sorted. +ot.setAutoSort(true); + +// Optionally set the delimiter to be used to separate values that are +// stored in hidden fields for the added and removed options, as well as +// final state of the lists. Defaults to a comma. +ot.setDelimiter("|"); + +// These functions assign the form fields which will store the state of +// the lists. Each one is optional, so you can pick to only store the +// new options which were transferred to the right list, for example. +// Each function takes the name of a HIDDEN or TEXT input field. + +// Store list of options removed from left list into an input field +ot.saveRemovedLeftOptions("removedLeft"); +// Store list of options removed from right list into an input field +ot.saveRemovedRightOptions("removedRight"); +// Store list of options added to left list into an input field +ot.saveAddedLeftOptions("addedLeft"); +// Store list of options radded to right list into an input field +ot.saveAddedRightOptions("addedRight"); +// Store all options existing in the left list into an input field +ot.saveNewLeftOptions("newLeft"); +// Store all options existing in the right list into an input field +ot.saveNewRightOptions("newRight"); + +// IMPORTANT: This step is required for the OptionTransfer object to work +// correctly. +// Add a call to the BODY onLoad="" tag of the page, and pass a reference to +// the form which contains the select boxes and input fields. +BODY onLoad="ot.init(document.forms[0])" + +// ADDING ACTIONS INTO YOUR PAGE +// Finally, add calls to the object to move options back and forth, either +// from links in your page or from double-clicking the options themselves. +// See example page, and use the following methods: +ot.transferRight(); +ot.transferAllRight(); +ot.transferLeft(); +ot.transferAllLeft(); + + +NOTES: +1) Requires the functions in selectbox.js + +*/ +function OT_transferLeft() { moveSelectedOptions(this.right,this.left,this.autoSort); this.update(); } +function OT_transferRight() { moveSelectedOptions(this.left,this.right,this.autoSort); this.update(); } +function OT_transferAllLeft() { moveAllOptions(this.right,this.left,this.autoSort); this.update(); } +function OT_transferAllRight() { moveAllOptions(this.left,this.right,this.autoSort); this.update(); } +function OT_saveRemovedLeftOptions(f) { this.removedLeftField = f; } +function OT_saveRemovedRightOptions(f) { this.removedRightField = f; } +function OT_saveAddedLeftOptions(f) { this.addedLeftField = f; } +function OT_saveAddedRightOptions(f) { this.addedRightField = f; } +function OT_saveNewLeftOptions(f) { this.newLeftField = f; } +function OT_saveNewRightOptions(f) { this.newRightField = f; } +function OT_update() { + var removedLeft = new Object(); + var removedRight = new Object(); + var addedLeft = new Object(); + var addedRight = new Object(); + var newLeft = new Object(); + var newRight = new Object(); + for (var i=0;i0) { str=str+delimiter; } + str=str+val; + } + return str; + } +function OT_setDelimiter(val) { this.delimiter=val; } +function OT_setAutoSort(val) { this.autoSort=val; } +function OT_init(theform) { + this.form = theform; + if(!theform[this.left]){alert("OptionTransfer init(): Left select list does not exist in form!");return false;} + if(!theform[this.right]){alert("OptionTransfer init(): Right select list does not exist in form!");return false;} + this.left=theform[this.left]; + this.right=theform[this.right]; + for(var i=0;i +// WWW: http://www.mattkruse.com/ +// +// NOTICE: You may use this code for any purpose, commercial or +// private, without any further permission from the author. You may +// remove this notice from your final code if you wish, however it is +// appreciated by the author if at least my web site address is kept. +// +// You may *NOT* re-distribute this code in any way except through its +// use. That means, you can include it in your product, or your web +// site, or any other form where the code is actually being used. You +// may not put the plain javascript up on your site for download or +// include it in your javascript libraries for download. +// If you wish to share this code with others, please just point them +// to the URL instead. +// Please DO NOT link directly to my .js files from your site. Copy +// the files to your server and use them there. Thank you. +// =================================================================== + +/* +PopupWindow.js +Author: Matt Kruse +Last modified: 02/16/04 + +DESCRIPTION: This object allows you to easily and quickly popup a window +in a certain place. The window can either be a DIV or a separate browser +window. + +COMPATIBILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small +positioning errors - usually with Window positioning - occur on the +Macintosh platform. Due to bugs in Netscape 4.x, populating the popup +window with + + + + + + +
+ <? + + + + + + ?> +
+
+ + + +
+ + + +
+
+ + + +
+ - + <!-- + +
+               
+            
+
+ --> +
+
+ + + + + + + =" + + + + " + + + + + + + +
+ < + + + + + + + + + /> +
+
+ + + +
+ < + + + + + + + + + + > + + + + + </ + + + + + > + +
+
+ + +
+
+ - + < + + + + + + + + + + > + +
+
+ +
+ </ + + + + + > + +
+
+
+
+ + + + + + + + + + + + + + + + + xmlns + + : + + + + =" + + + + " + + + + + + diff --git a/tools/authcon/seth/build.xml b/tools/authcon/seth/build.xml new file mode 100644 index 0000000000..bf921c4f2d --- /dev/null +++ b/tools/authcon/seth/build.xml @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/authcon/seth/src/EasySSLProtocolSocketFactory.java b/tools/authcon/seth/src/EasySSLProtocolSocketFactory.java new file mode 100644 index 0000000000..cd332abd01 --- /dev/null +++ b/tools/authcon/seth/src/EasySSLProtocolSocketFactory.java @@ -0,0 +1,238 @@ +package org.apache.cocoon.transformation; + +/* + * $HeadURL$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + */ + +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.UnknownHostException; + +import javax.net.SocketFactory; +//import javax.net.ssl.SSLContext; +//import javax.net.ssl.TrustManager; +import com.sun.net.ssl.SSLContext; +import com.sun.net.ssl.TrustManagerFactory; +import com.sun.net.ssl.TrustManager; +import com.sun.net.ssl.X509TrustManager; + +import org.apache.commons.httpclient.ConnectTimeoutException; +import org.apache.commons.httpclient.HttpClientError; +import org.apache.commons.httpclient.params.HttpConnectionParams; +import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +//import org.apache.commons.httpclient.contrib.ssl.EasyX509TrustManager; + +/** + *

+ * EasySSLProtocolSocketFactory can be used to creats SSL {@link Socket}s + * that accept self-signed certificates. + *

+ *

+ * This socket factory SHOULD NOT be used for productive systems + * due to security reasons, unless it is a concious decision and + * you are perfectly aware of security implications of accepting + * self-signed certificates + *

+ * + *

+ * Example of using custom protocol socket factory for a specific host: + *

+ *     Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
+ *
+ *     URI uri = new URI("https://localhost/", true);
+ *     // use relative url only
+ *     GetMethod httpget = new GetMethod(uri.getPathQuery());
+ *     HostConfiguration hc = new HostConfiguration();
+ *     hc.setHost(uri.getHost(), uri.getPort(), easyhttps);
+ *     HttpClient client = new HttpClient();
+ *     client.executeMethod(hc, httpget);
+ *     
+ *

+ *

+ * Example of using custom protocol socket factory per default instead of the standard one: + *

+ *     Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
+ *     Protocol.registerProtocol("https", easyhttps);
+ *
+ *     HttpClient client = new HttpClient();
+ *     GetMethod httpget = new GetMethod("https://localhost/");
+ *     client.executeMethod(httpget);
+ *     
+ *

+ * + * @author Oleg Kalnichevski + * + *

+ * DISCLAIMER: HttpClient developers DO NOT actively support this component. + * The component is provided as a reference material, which may be inappropriate + * for use without additional customization. + *

+ */ + +public class EasySSLProtocolSocketFactory implements SecureProtocolSocketFactory { + + /** Log object for this class. */ + private static final Log LOG = LogFactory.getLog(EasySSLProtocolSocketFactory.class); + + private SSLContext sslcontext = null; + + /** + * Constructor for EasySSLProtocolSocketFactory. + */ + public EasySSLProtocolSocketFactory() { + super(); + } + + private static SSLContext createEasySSLContext() { + try { + SSLContext context = SSLContext.getInstance("SSL"); + context.init( + null, + new TrustManager[] {new EasyX509TrustManager(null)}, + null); + return context; + } catch (Exception e) { + LOG.error(e.getMessage(), e); + throw new HttpClientError(e.toString()); + } + } + + private SSLContext getSSLContext() { + if (this.sslcontext == null) { + this.sslcontext = createEasySSLContext(); + } + return this.sslcontext; + } + + /** + * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int) + */ + public Socket createSocket( + String host, + int port, + InetAddress clientHost, + int clientPort) + throws IOException, UnknownHostException { + + return getSSLContext().getSocketFactory().createSocket( + host, + port, + clientHost, + clientPort + ); + } + + /** + * Attempts to get a new socket connection to the given host within the given time limit. + *

+ * To circumvent the limitations of older JREs that do not support connect timeout a + * controller thread is executed. The controller thread attempts to create a new socket + * within the given limit of time. If socket constructor does not return until the + * timeout expires, the controller terminates and throws an {@link ConnectTimeoutException} + *

+ * + * @param host the host name/IP + * @param port the port on the host + * @param clientHost the local host name/IP to bind the socket to + * @param clientPort the port on the local machine + * @param params {@link HttpConnectionParams Http connection parameters} + * + * @return Socket a new socket + * + * @throws IOException if an I/O error occurs while creating the socket + * @throws UnknownHostException if the IP address of the host cannot be + * determined + */ + public Socket createSocket( + final String host, + final int port, + final InetAddress localAddress, + final int localPort, + final HttpConnectionParams params + ) throws IOException, UnknownHostException, ConnectTimeoutException { + if (params == null) { + throw new IllegalArgumentException("Parameters may not be null"); + } + int timeout = params.getConnectionTimeout(); + SocketFactory socketfactory = getSSLContext().getSocketFactory(); + if (timeout == 0) { + return socketfactory.createSocket(host, port, localAddress, localPort); + } else { + Socket socket = socketfactory.createSocket(); + SocketAddress localaddr = new InetSocketAddress(localAddress, localPort); + SocketAddress remoteaddr = new InetSocketAddress(host, port); + socket.bind(localaddr); + socket.connect(remoteaddr, timeout); + return socket; + } + } + + /** + * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int) + */ + public Socket createSocket(String host, int port) + throws IOException, UnknownHostException { + return getSSLContext().getSocketFactory().createSocket( + host, + port + ); + } + + /** + * @see SecureProtocolSocketFactory#createSocket(java.net.Socket,java.lang.String,int,boolean) + */ + public Socket createSocket( + Socket socket, + String host, + int port, + boolean autoClose) + throws IOException, UnknownHostException { + return getSSLContext().getSocketFactory().createSocket( + socket, + host, + port, + autoClose + ); + } + + public boolean equals(Object obj) { + return ((obj != null) && obj.getClass().equals(EasySSLProtocolSocketFactory.class)); + } + + public int hashCode() { + return EasySSLProtocolSocketFactory.class.hashCode(); + } + +} diff --git a/tools/authcon/seth/src/EasyX509TrustManager.java b/tools/authcon/seth/src/EasyX509TrustManager.java new file mode 100644 index 0000000000..0090dd0f14 --- /dev/null +++ b/tools/authcon/seth/src/EasyX509TrustManager.java @@ -0,0 +1,121 @@ +package org.apache.cocoon.transformation; +/* + * ==================================================================== + * + * Copyright 2002-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + */ + + +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import com.sun.net.ssl.TrustManagerFactory; +import com.sun.net.ssl.TrustManager; +import com.sun.net.ssl.X509TrustManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + *

+ * EasyX509TrustManager unlike default {@link X509TrustManager} accepts + * self-signed certificates. + *

+ *

+ * This trust manager SHOULD NOT be used for productive systems + * due to security reasons, unless it is a concious decision and + * you are perfectly aware of security implications of accepting + * self-signed certificates + *

+ * + * @author Adrian Sutton + * @author Oleg Kalnichevski + * + *

+ * DISCLAIMER: HttpClient developers DO NOT actively support this component. + * The component is provided as a reference material, which may be inappropriate + * for use without additional customization. + *

+ */ + +public class EasyX509TrustManager implements X509TrustManager +{ + private X509TrustManager standardTrustManager = null; + + /** Log object for this class. */ + private static final Log LOG = LogFactory.getLog(EasyX509TrustManager.class); + + /** + * Constructor for EasyX509TrustManager. + */ + public EasyX509TrustManager(KeyStore keystore) throws NoSuchAlgorithmException, KeyStoreException { + super(); + TrustManagerFactory factory = TrustManagerFactory.getInstance("SunX509"); + factory.init(keystore); + TrustManager[] trustmanagers = factory.getTrustManagers(); + if (trustmanagers.length == 0) { + throw new NoSuchAlgorithmException("SunX509 trust manager not supported"); + } + this.standardTrustManager = (X509TrustManager)trustmanagers[0]; + } + + /** + * @see com.sun.net.ssl.X509TrustManager#isClientTrusted(X509Certificate[]) + */ + public boolean isClientTrusted(X509Certificate[] certificates) { + return this.standardTrustManager.isClientTrusted(certificates); + } + + /** + * @see com.sun.net.ssl.X509TrustManager#isServerTrusted(X509Certificate[]) + */ + public boolean isServerTrusted(X509Certificate[] certificates) { + if ((certificates != null) && LOG.isDebugEnabled()) { + LOG.debug("Server certificate chain:"); + for (int i = 0; i < certificates.length; i++) { + LOG.debug("X509Certificate[" + i + "]=" + certificates[i]); + } + } + if ((certificates != null) && (certificates.length == 1)) { + X509Certificate certificate = certificates[0]; + try { + certificate.checkValidity(); + } + catch (CertificateException e) { + LOG.error(e.toString()); + return false; + } + return true; + } else { + return this.standardTrustManager.isServerTrusted(certificates); + } + } + + /** + * @see com.sun.net.ssl.X509TrustManager#getAcceptedIssuers() + */ + public X509Certificate[] getAcceptedIssuers() { + return this.standardTrustManager.getAcceptedIssuers(); + } +} diff --git a/tools/authcon/seth/src/sethTransformer.java b/tools/authcon/seth/src/sethTransformer.java new file mode 100644 index 0000000000..99caf63500 --- /dev/null +++ b/tools/authcon/seth/src/sethTransformer.java @@ -0,0 +1,1517 @@ +/* + sethTransformer - written in May 2004 + * updated 2005 for hackfest + * updated 2009 for ssl sockets/certificate handling + + (c) Copyright GNU General Public License (GPL) + @author art rhyno +*/ +package org.apache.cocoon.transformation; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; + +import java.net.*; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +import java.util.ArrayList; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.Vector; + +import org.apache.avalon.framework.logger.Logger; +import org.apache.avalon.framework.parameters.Parameters; +import org.apache.cocoon.ProcessingException; +import org.apache.cocoon.environment.SourceResolver; + +import org.apache.cocoon.xml.dom.DOMStreamer; +import org.apache.cocoon.xml.XMLConsumer; +import org.apache.cocoon.xml.XMLUtils; + +import org.apache.commons.httpclient.*; +import org.apache.commons.httpclient.auth.AuthPolicy; +import org.apache.commons.httpclient.auth.AuthScope; +import org.apache.commons.httpclient.util.HttpURLConnection; +import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.httpclient.methods.*; +import org.apache.commons.httpclient.HttpMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.protocol.Protocol; +import org.apache.commons.httpclient.util.URIUtil; + +//import org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory; + +import org.apache.regexp.RE; +import org.apache.regexp.RESyntaxException; + +import org.xml.sax.Attributes; +import org.xml.sax.ext.LexicalHandler; +import org.xml.sax.helpers.AttributesImpl; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; + +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.tidy.Tidy; + +/** + * SETH Transformer - May, 2004 + * + * @author art rhyno + */ +public class sethTransformer extends AbstractTransformer { + + public static final String my_uri = "http://seth.sourceforge.net"; + public static final String my_name = "sethTransformer"; + + /** Outgoing tags */ + public static final String RESULTS_ELEMENT = "retrieval-results"; + public static final String URL_ELEMENT = "url"; + public static final String RESPONSE_ELEMENT = "responses"; + public static final String REQUEST_ELEMENT = "requests"; + public static final String COOKIES_ELEMENT = "cookies"; + public static final String CONTENTS_ELEMENT = "contents"; + public static final String REGEXP_ELEMENT = "regexpval"; + + /** Our allowed tags */ + public static final String MAGIC_EXECUTE_RETRIEVAL = "execute-retrieval"; + public static final String MAGIC_URL_ELEMENT = "url"; + public static final String MAGIC_USERNAME_ELEMENT = "username"; + public static final String MAGIC_PASSWORD_ELEMENT = "password"; + public static final String MAGIC_LIMIT_ELEMENT = "limit"; + public static final String MAGIC_USERAGENT_ELEMENT = "useragent"; + public static final String MAGIC_TIMEOUT_ELEMENT = "timeout"; + public static final String MAGIC_REDIRECT_LIMIT_ELEMENT = "redirect_limit"; + public static final String MAGIC_REGEXP_ELEMENT = "regexp"; + public static final String MAGIC_NVP_ELEMENT = "nvp"; + public static final String MAGIC_COOKIE_ELEMENT = "cookie"; + public static final String MAGIC_METHOD_ELEMENT = "method"; + public static final String MAGIC_REDIRECT_ELEMENT = "redirect"; + public static final String MAGIC_DEBUG_ELEMENT = "debug"; + + /** The states we are allowed to be in */ + public static final int STATE_OUTSIDE = 0; + public static final int STATE_INSIDE_EXECUTE_RETRIEVAL = 1; + public static final int STATE_INSIDE_URL_ELEMENT = 2; + public static final int STATE_INSIDE_USERNAME_ELEMENT = 3; + public static final int STATE_INSIDE_PASSWORD_ELEMENT = 4; + public static final int STATE_INSIDE_LIMIT_ELEMENT = 5; + public static final int STATE_INSIDE_USERAGENT_ELEMENT = 6; + public static final int STATE_INSIDE_TIMEOUT_ELEMENT = 7; + public static final int STATE_INSIDE_REDIRECT_LIMIT_ELEMENT = 8; + public static final int STATE_INSIDE_REGEXP_ELEMENT = 9; + public static final int STATE_INSIDE_NVP_ELEMENT = 10; + public static final int STATE_INSIDE_COOKIE_ELEMENT = 11; + public static final int STATE_INSIDE_METHOD_ELEMENT = 12; + public static final int STATE_INSIDE_REDIRECT_ELEMENT = 13; + public static final int STATE_INSIDE_DEBUG_ELEMENT = 14; + + /** Default parameters that might apply to all retrievals */ + protected Properties default_properties = new Properties(); + + /** The name of the value element we're currently receiving */ + protected String current_name; + + /** The current state of the event receiving FSM */ + protected int current_state = STATE_OUTSIDE; + + /** The value of the value element we're currently receiving */ + protected StringBuffer current_value = new StringBuffer(); + + /** The list of retrievals that we're currently working on */ + protected Vector retrievals = new Vector(); + + /** The offset of the current retrieval in the retrievals list */ + protected int current_retrieval_index = -1; + + /** SAX producing state information */ + protected XMLConsumer xml_consumer; + protected LexicalHandler lexical_handler; + + /** BEGIN SitemapComponent methods */ + + public void setup(SourceResolver resolver, Map objectModel, String source, Parameters parameters) + throws ProcessingException, SAXException, IOException { + current_state = STATE_OUTSIDE; + + String parameter; + + // Check the url + parameter = parameters.getParameter(MAGIC_URL_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_URL_ELEMENT, parameter); + } + + // Check the username + parameter = parameters.getParameter(MAGIC_USERNAME_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_USERNAME_ELEMENT, parameter); + } + + // Check the password + parameter = parameters.getParameter(MAGIC_PASSWORD_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_PASSWORD_ELEMENT, parameter); + } + + // Check the limit + parameter = parameters.getParameter(MAGIC_LIMIT_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_LIMIT_ELEMENT, parameter); + } + + // Check the useragent + parameter = parameters.getParameter(MAGIC_USERAGENT_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_USERAGENT_ELEMENT, parameter); + } + + // Check the timeout + parameter = parameters.getParameter(MAGIC_TIMEOUT_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_TIMEOUT_ELEMENT, parameter); + } + + // Check the redirect_limit + parameter = parameters.getParameter(MAGIC_REDIRECT_LIMIT_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_REDIRECT_LIMIT_ELEMENT, parameter); + } + + // Check the regexp + parameter = parameters.getParameter(MAGIC_REGEXP_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_REGEXP_ELEMENT, parameter); + } + + // Check the method + parameter = parameters.getParameter(MAGIC_METHOD_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_METHOD_ELEMENT, parameter); + } + + // Check the nvp + parameter = parameters.getParameter(MAGIC_NVP_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_NVP_ELEMENT, parameter); + } + + // Check the cookie + parameter = parameters.getParameter(MAGIC_COOKIE_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_COOKIE_ELEMENT, parameter); + } + + // Check the redirect element + parameter = parameters.getParameter(MAGIC_REDIRECT_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_REDIRECT_ELEMENT, parameter); + } + + // Check the debug element + parameter = parameters.getParameter(MAGIC_DEBUG_ELEMENT, null); + if (parameter != null) { + default_properties.setProperty(MAGIC_DEBUG_ELEMENT, parameter); + } + + } + + /** END SitemapComponent methods */ + + /** + * This will be the meat of sethTransformer, where the retrieval is run. + */ + protected void executeRetrieval(int index) throws SAXException { + // this.contentHandler.startPrefixMapping("", sethTransformer.my_uri); + HTMLRetrieval retrieval = (HTMLRetrieval) retrievals.elementAt(index); + try { + retrieval.execute(); + } catch (Exception e) { + System.out.println("error " + e.toString()); + getLogger().error(e.toString()); + throw new SAXException(e); + } + + this.contentHandler.endPrefixMapping(""); + } + + protected static void throwIllegalStateException(String message) { + throw new IllegalStateException(my_name + ": " + message); + } + + /** Move into elements */ + protected void startExecuteRetrieval(Attributes attributes) { + HTMLRetrieval retrieval; + switch (current_state) { + case sethTransformer.STATE_OUTSIDE : + current_state = sethTransformer.STATE_INSIDE_EXECUTE_RETRIEVAL; + current_retrieval_index = retrievals.size(); + retrieval = new HTMLRetrieval(this); + retrievals.addElement(retrieval); + getCurrentRetrieval().toDo = sethTransformer.STATE_INSIDE_EXECUTE_RETRIEVAL; + getCurrentRetrieval().retrieval_index = current_retrieval_index; + break; + default : + throwIllegalStateException("Not expecting a start execute-retrieval element"); + } + } + + protected void endExecuteRetrieval() throws SAXException { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + executeRetrieval(current_retrieval_index); + retrievals.remove(current_retrieval_index); + --current_retrieval_index; + if (current_retrieval_index > -1) { + current_state = getCurrentRetrieval().toDo; + } else { + retrievals.removeAllElements(); + current_state = sethTransformer.STATE_OUTSIDE; + } + break; + default : + throwIllegalStateException("Not expecting a end execute-retrieval element"); + } + } + + protected void startNvpElement(Attributes attributes) { + String thisName = attributes.getValue("name"); + + if (thisName != null) + getCurrentRetrieval().nvpName = thisName; + else + throwIllegalStateException("value without name"); + + String checkJsonSpace = attributes.getValue("jsspace"); + if (checkJsonSpace != null) + getCurrentRetrieval().jsspace = checkJsonSpace; + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_NVP_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start nvp element"); + } + } + + protected void endNvpElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_NVP_ELEMENT : + String parmVal = current_value.toString().trim(); + //examples of extra encoding options + /* + try { + parmVal = URIUtil.encodeQuery(parmVal); + } catch (URIException uriEx) { + System.out.println("prob: " + uriEx.toString()); + parmVal = current_value.toString().trim(); + } */ + /* + try { + parmVal = URLEncoder.encode(parmVal,"UTF-8"); + } catch (UnsupportedEncodingException uriEx) { + System.out.println("prob: " + uriEx.toString()); + parmVal = current_value.toString().trim(); + } + */ + + //we can't always rely on uri encodings for whitespaces + if (getCurrentRetrieval().jsspace != null) + parmVal = parmVal.replaceAll(" ","\\\\u0020"); + + NameValuePair thisNVP = new NameValuePair( + getCurrentRetrieval().nvpName, + parmVal); + getCurrentRetrieval().nvps.addElement(thisNVP); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end nvp element"); + } + } + + protected void startCookieElement(Attributes attributes) { + String checkDomain = attributes.getValue("domain"); + if (checkDomain != null) + getCurrentRetrieval().thisDomain = checkDomain; + + if (checkDomain == null) { + try { + InetAddress localaddr = InetAddress.getLocalHost(); + String thisHost = localaddr.getHostAddress().toString(); + int firstPart = thisHost.indexOf("."); + if (firstPart != -1) + getCurrentRetrieval().thisDomain = + thisHost.substring(firstPart); + } catch (UnknownHostException uhe) { + getCurrentRetrieval().thisDomain = "*"; + + } + } + getCurrentRetrieval().thisName = attributes.getValue("name"); + getCurrentRetrieval().thisPath = attributes.getValue("path"); + String checkDate = attributes.getValue("date"); + if (checkDate != null) { + DateFormat theFormat = new + SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy"); + try { + getCurrentRetrieval().thisDate = + theFormat.parse(checkDate); + } catch (Exception e) { + throwIllegalStateException("Problem with cookie date"); + } + } + String checkAge = attributes.getValue("age"); + if (checkAge != null) + getCurrentRetrieval().thisAge = Integer.parseInt(checkAge); + String checkSecure = attributes.getValue("secure"); + if (checkSecure != null) { + if (checkSecure.trim().toUpperCase().equals("TRUE")) + getCurrentRetrieval().isSecure = true; + } + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_COOKIE_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start cookie element"); + } + } + + protected void endCookieElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_COOKIE_ELEMENT : + String thisValue = current_value.toString().trim(); + Cookie thisCookie; + System.out.println("-> domain: " + + getCurrentRetrieval().thisDomain + "\n name: " + + getCurrentRetrieval().thisName + "\n value: " + + thisValue + "\n path: " + + getCurrentRetrieval().thisPath + "\n date: " + + getCurrentRetrieval().thisDate +"\n secure: " + + getCurrentRetrieval().isSecure); + + if (getCurrentRetrieval().thisPath != null && + getCurrentRetrieval().thisDate != null) + { + System.out.println("1"); + thisCookie = new Cookie(getCurrentRetrieval().thisDomain, + getCurrentRetrieval().thisName, + thisValue, + getCurrentRetrieval().thisPath, + getCurrentRetrieval().thisDate, + getCurrentRetrieval().isSecure); + } else if (getCurrentRetrieval().thisPath != null && + getCurrentRetrieval().thisAge >= 0) + { + System.out.println("2"); + thisCookie = new Cookie(getCurrentRetrieval().thisDomain, + getCurrentRetrieval().thisName, + thisValue, + getCurrentRetrieval().thisPath, + getCurrentRetrieval().thisAge, + getCurrentRetrieval().isSecure); + } else { + System.out.println("3"); + thisCookie = new Cookie(getCurrentRetrieval().thisDomain, + getCurrentRetrieval().thisName, + thisValue); + } + getCurrentRetrieval().sethcookies.addElement(thisCookie); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end cookie element"); + } + } + + protected void startMethodElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_METHOD_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start method element"); + } + } + + protected void endMethodElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_METHOD_ELEMENT : + getCurrentRetrieval().method = current_value.toString().trim().toUpperCase(); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end method element"); + } + } + + protected void startUrlElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_URL_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start url element"); + } + } + + protected void endUrlElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_URL_ELEMENT : + getCurrentRetrieval().url = current_value.toString(); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end url element"); + } + } + + protected void startUsernameElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_USERNAME_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start username element"); + } + } + + protected void endUsernameElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_USERNAME_ELEMENT : + getCurrentRetrieval().username = current_value.toString(); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end username element"); + } + } + + protected void startPasswordElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_PASSWORD_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start password element"); + } + } + + protected void endPasswordElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_PASSWORD_ELEMENT : + getCurrentRetrieval().password = current_value.toString(); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end password element"); + } + } + + protected void startLimitElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_LIMIT_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start limit element"); + } + } + + protected void endLimitElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_LIMIT_ELEMENT : + getCurrentRetrieval().limit = current_value.toString().trim().toUpperCase(); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end limit element"); + } + } + protected void startUserAgentElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_USERAGENT_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start useragent element"); + } + } + + protected void endUserAgentElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_USERAGENT_ELEMENT : + getCurrentRetrieval().useragent = current_value.toString().trim(); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end useragent element"); + } + } + + protected void startTimeoutElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_TIMEOUT_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start timeout element"); + } + } + + protected void endTimeoutElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_TIMEOUT_ELEMENT : + getCurrentRetrieval().timeout = Integer.parseInt(current_value.toString()); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end timeout element"); + } + } + + protected void startRedirectLimitElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_REDIRECT_LIMIT_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start redirect_limit element"); + } + } + + protected void endRedirectLimitElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_REDIRECT_LIMIT_ELEMENT : + getCurrentRetrieval().redirect_limit = Integer.parseInt(current_value.toString()); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end redirect_limit element"); + } + } + + protected void startRegExpElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_REGEXP_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start regexp element"); + } + } + + protected void endRegExpElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_REGEXP_ELEMENT : + getCurrentRetrieval().regexp = current_value.toString(); + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end regexp element"); + } + } + + protected void startRedirectElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_REDIRECT_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start redirect element"); + } + } + + protected void endRedirectElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_REDIRECT_ELEMENT : + if (current_value.toString().toUpperCase().equals("FALSE")) { + getCurrentRetrieval().redirect = false; + } + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end redirect element"); + } + } + + protected void startDebugElement(Attributes attributes) { + switch (current_state) { + case STATE_INSIDE_EXECUTE_RETRIEVAL : + current_value.setLength(0); + current_state = sethTransformer.STATE_INSIDE_DEBUG_ELEMENT; + break; + default : + throwIllegalStateException("Not expecting a start debug element"); + } + } + + protected void endDebugElement() { + switch (current_state) { + case sethTransformer.STATE_INSIDE_DEBUG_ELEMENT : + if (current_value.toString().toUpperCase().equals("TRUE")) { + getCurrentRetrieval().debug = true; + } + current_state = getCurrentRetrieval().toDo; + break; + default : + throwIllegalStateException("Not expecting a end debug element"); + } + } + + protected HTMLRetrieval getCurrentRetrieval() { + return (HTMLRetrieval) retrievals.elementAt(current_retrieval_index); + } + + protected HTMLRetrieval getRetrieval(int i) { + return (HTMLRetrieval) retrievals.elementAt(i); + } + + /** END my very own methods */ + + /** BEGIN SAX ContentHandler handlers */ + + public void setDocumentLocator(Locator locator) { + if (getLogger().isDebugEnabled()) { + getLogger().debug("PUBLIC ID: " + locator.getPublicId()); + getLogger().debug("SYSTEM ID: " + locator.getSystemId()); + } + if (super.contentHandler != null) + super.contentHandler.setDocumentLocator(locator); + } + + public void startElement(String uri, String name, String raw, Attributes attributes) throws SAXException { + if (!uri.equals(my_uri)) { + super.startElement(uri, name, raw, attributes); + return; + } + getLogger().debug("RECEIVED START ELEMENT " + name + "(" + uri + ")"); + + if (name.equals(sethTransformer.MAGIC_EXECUTE_RETRIEVAL)) { + startExecuteRetrieval(attributes); + } else if (name.equals(sethTransformer.MAGIC_NVP_ELEMENT)) { + startNvpElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_COOKIE_ELEMENT)) { + startCookieElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_METHOD_ELEMENT)) { + startMethodElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_URL_ELEMENT)) { + startUrlElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_USERNAME_ELEMENT)) { + startUsernameElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_PASSWORD_ELEMENT)) { + startPasswordElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_LIMIT_ELEMENT)) { + startLimitElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_USERAGENT_ELEMENT)) { + startUserAgentElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_TIMEOUT_ELEMENT)) { + startTimeoutElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_REDIRECT_LIMIT_ELEMENT)) { + startRedirectLimitElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_REGEXP_ELEMENT)) { + startRegExpElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_REDIRECT_ELEMENT)) { + startRedirectElement(attributes); + } else if (name.equals(sethTransformer.MAGIC_DEBUG_ELEMENT)) { + startDebugElement(attributes); + } + } + + public void endElement(String uri, String name, String raw) throws SAXException { + if (!uri.equals(my_uri)) { + super.endElement(uri, name, raw); + return; + } + getLogger().debug("RECEIVED END ELEMENT " + name + "(" + uri + ")"); + + if (name.equals(sethTransformer.MAGIC_EXECUTE_RETRIEVAL)) { + endExecuteRetrieval(); + } else if (name.equals(sethTransformer.MAGIC_NVP_ELEMENT)) { + endNvpElement(); + } else if (name.equals(sethTransformer.MAGIC_COOKIE_ELEMENT)) { + endCookieElement(); + } else if (name.equals(sethTransformer.MAGIC_METHOD_ELEMENT)) { + endMethodElement(); + } else if (name.equals(sethTransformer.MAGIC_URL_ELEMENT)) { + endUrlElement(); + } else if (name.equals(sethTransformer.MAGIC_USERNAME_ELEMENT)) { + endUsernameElement(); + } else if (name.equals(sethTransformer.MAGIC_PASSWORD_ELEMENT)) { + endPasswordElement(); + } else if (name.equals(sethTransformer.MAGIC_LIMIT_ELEMENT)) { + endLimitElement(); + } else if (name.equals(sethTransformer.MAGIC_USERAGENT_ELEMENT)) { + endUserAgentElement(); + } else if (name.equals(sethTransformer.MAGIC_TIMEOUT_ELEMENT)) { + endTimeoutElement(); + } else if (name.equals(sethTransformer.MAGIC_REDIRECT_LIMIT_ELEMENT)) { + endRedirectLimitElement(); + } else if (name.equals(sethTransformer.MAGIC_REGEXP_ELEMENT)) { + endRegExpElement(); + } else if (name.equals(sethTransformer.MAGIC_REDIRECT_ELEMENT)) { + endRedirectElement(); + } else if (name.equals(sethTransformer.MAGIC_DEBUG_ELEMENT)) { + endDebugElement(); + } + } + + public void characters(char ary[], int start, int length) throws SAXException { + if (current_state != sethTransformer.STATE_INSIDE_NVP_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_COOKIE_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_METHOD_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_URL_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_USERNAME_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_PASSWORD_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_LIMIT_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_USERAGENT_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_TIMEOUT_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_REDIRECT_LIMIT_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_REGEXP_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_REDIRECT_ELEMENT + && current_state != sethTransformer.STATE_INSIDE_DEBUG_ELEMENT) + { + super.characters(ary, start, length); + } + getLogger().debug("RECEIVED CHARACTERS: " + new String(ary, start, length)); + current_value.append(ary, start, length); + } + + private void attribute(AttributesImpl attr, String name, String value) { + attr.addAttribute("", name, name, "CDATA", value); + } + + private void start(String name, AttributesImpl attr) throws SAXException { + super.contentHandler.startElement("", name, name, attr); + attr.clear(); + } + + private void end(String name) throws SAXException { + super.contentHandler.endElement("", name, name); + } + + private void data(String data) throws SAXException { + if (data != null) + super.contentHandler.characters(data.toCharArray(), 0, data.length()); + } + + protected static String getStringValue(Object object) { + if (object instanceof byte[]) { + return new String((byte[]) object); + } else if (object instanceof char[]) { + return new String((char[]) object); + } else if (object != null) { + return object.toString(); + } else { + return ""; + } + } + + public final Logger getTheLogger() { + return getLogger(); + } + + class HTMLRetrieval { + + /** Index for retrievals list */ + protected int retrieval_index; + + /** The current state of the event */ + protected int current_state; + + protected sethTransformer transformer; + + protected String url = "http://127.0.0.1"; + + protected String username = null; + + protected String password = null; + + protected String limit = null; + + protected String useragent = null; + + protected int timeout = 0; + + protected int redirect_limit = 5; + + protected String regexp = null; + + protected RE sethRE; + + protected String method = "GET"; + + protected String cookieType = "NAME"; + + protected Vector nvps = new Vector(); + + protected Vector sethcookies = new Vector(); + + protected int toDo; + + //NVP values + protected String nvpName = null; + protected String jsspace = null; + + //Cookie values + protected String thisDomain = null; + protected String thisName = null; + protected String thisPath = null; + protected Date thisDate = null; + protected int thisAge = -1; + protected boolean isSecure = false; + + protected int sequence = 1; + + protected StringBuffer textBucket = new StringBuffer(); + + protected AttributesImpl attr = new AttributesImpl(); + + protected HttpClient _httpClient; + + protected HttpMethod _httpMethod; + + protected boolean redirect = true; + + protected int limitTagBlock = 0; + + protected boolean debug = false; + + //work through elements + protected HTMLRetrieval(sethTransformer transformer) { + this.transformer = transformer; + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_NVP_ELEMENT)) + { + nvps.addElement(transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_NVP_ELEMENT)); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_COOKIE_ELEMENT)) + { + sethcookies.addElement(transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_COOKIE_ELEMENT)); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_METHOD_ELEMENT)) + { + method = transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_METHOD_ELEMENT); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_URL_ELEMENT)) + { + url = transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_URL_ELEMENT); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_USERNAME_ELEMENT)) + { + username = transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_USERNAME_ELEMENT); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_PASSWORD_ELEMENT)) + { + password = transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_PASSWORD_ELEMENT); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_LIMIT_ELEMENT)) + { + limit = transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_LIMIT_ELEMENT); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_USERAGENT_ELEMENT)) + { + useragent = transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_USERAGENT_ELEMENT); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_TIMEOUT_ELEMENT)) + { + timeout = Integer.parseInt(transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_TIMEOUT_ELEMENT)); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_REDIRECT_LIMIT_ELEMENT)) + { + redirect_limit = Integer.parseInt(transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_REDIRECT_LIMIT_ELEMENT)); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_REGEXP_ELEMENT)) + { + regexp = transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_REGEXP_ELEMENT); + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_REDIRECT_ELEMENT)) + { + redirect = transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_REDIRECT_ELEMENT).equals("TRUE") ? true : false; + } + + if (null != transformer. + default_properties. + getProperty(sethTransformer.MAGIC_DEBUG_ELEMENT)) + { + debug = transformer. + default_properties. + getProperty(sethTransformer. + MAGIC_DEBUG_ELEMENT).equals("TRUE") ? true : false; + } + + + } //HTMLRetrieval + + // set up DOM and execute http request + protected void execute() throws Exception { + int ret; + + //start with regexp + if (regexp != null) { + try { + sethRE = new RE(regexp); + } catch (RESyntaxException reex) { + transformer.getTheLogger().debug("[sethTransformer] " + + "compiling regular expression problem " + + reex.toString()); + regexp = null; + } + } + + if (debug) + debugPrint(); + try { + // Setup an instance of Tidy. + Tidy tidy = new Tidy(); + tidy.setXmlOut(true); + tidy.setXHTML(true); + tidy.setIndentAttributes(true); + + tidy.setShowWarnings(getLogger().isWarnEnabled()); + + tidy.setQuiet(!getLogger().isInfoEnabled()); + StringWriter stringWriter = new StringWriter(); + PrintWriter errorWriter = new PrintWriter(stringWriter); + + tidy.setErrout(errorWriter); + + + HttpMethod _httpMethod = workOutHttpMethod(url, username, password); + URL thisUrl = new URL(url); + HttpURLConnection _httpURLConnection = new HttpURLConnection(_httpMethod, thisUrl); + System.out.println("lm: " + _httpURLConnection.getLastModified()); + Date last_modified = new Date(_httpURLConnection.getLastModified()); + + org.w3c.dom.Document doc = tidy.parseDOM(new + BufferedInputStream(_httpMethod.getResponseBodyAsStream()), null); + + XMLUtils.stripDuplicateAttributes(doc, null); + + Element docRoot = doc.getDocumentElement(); + + Cookie[] cookies = _httpClient.getState().getCookies(); + + Header[] responseHeaders = _httpMethod.getResponseHeaders(); + + Header[] requestHeaders = _httpMethod.getRequestHeaders(); + + //_httpClient.endSession(); + transformer.start(RESULTS_ELEMENT, attr); + + transformer.start(URL_ELEMENT, attr); + transformer.data(url); + transformer.end(URL_ELEMENT); + + transformer.start(RESPONSE_ELEMENT, attr); + for (int i=0; i 0) { + String qs = ((HttpMethod) _httpMethod).getQueryString(); + NameValuePair nvpa[] = new NameValuePair[nvps.size()]; + ((HttpMethod) _httpMethod).setQueryString((NameValuePair []) + nvps.toArray(nvpa)); + if (qs != null) { + ((HttpMethod) _httpMethod). + setQueryString(qs + "&" + + ((HttpMethod) _httpMethod). + getQueryString()); + } + } + } + System.out.println("0"); + + if (timeout > 0) + _httpClient.setTimeout(timeout * 1000); + + + if (method.equals("GET")) + ((HttpMethod) _httpMethod).setFollowRedirects(redirect); + /* setFollowRedirects won't work for a post, need somethng like this + if (method.equals("POST")) { + URI redirectLocation = new URI( + ((HttpMethod) _httpMethod).getURI(), + ((HttpMethod) _httpMethod).getResponseHeader("location"). + getValue() + ); + */ + + System.out.println("1"); + + // HTTPSession + //_httpClient.startSession(u); + HostConfiguration hostConfig = _httpClient.getHostConfiguration(); + System.out.println("3"); + hostConfig.setHost(u.getHost(),u.getPort(),u.getProtocol()); + + /* - would we ever set these? + for(int i = 0; i < this.header.size(); i++) { + ((HttpMethod) _httpMethod).setRequestHeader( + (Header) this.header.elementAt(i)); + } + */ + + System.out.println("4"); + // value for "accept-encoding" must be empty + ((HttpMethod) _httpMethod). + setRequestHeader("accept-encoding", ""); + + /* + ((HttpMethod) _httpMethod). + setRequestHeader( + "Content-Type", + "text/plain; charset=utf-8"); + */ + + + System.out.println("username is " + + username + " and " + password); + if (username != null && password != null) { + System.out.println("host is " + u.getHost()); + /* + Credentials defaultcreds = new UsernamePasswordCredentials(username, password); + _httpClient.getState().setCredentials(null, u.getHost(), defaultcreds); + _httpClient.getState().setAuthenticationPreemptive(true); + */ + + List authPrefs = new ArrayList(2); + authPrefs.add(AuthPolicy.DIGEST ); + authPrefs.add(AuthPolicy.BASIC); + _httpClient.getParams().setParameter (AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs); + _httpClient.getParams().setAuthenticationPreemptive(true); + Credentials defaultcreds = new UsernamePasswordCredentials(username, password); + //_httpClient.getState().setCredentials(new AuthScope( u.getHost(), 443, AuthScope.ANY_REALM), defaultcreds); + _httpClient.getState().setCredentials(null, u.getHost(), defaultcreds); + } + + try { + System.out.println("here goes"); + result = _httpClient.executeMethod(_httpMethod); + System.out.println("the result - " + result); + } catch (Exception ex) { + System.out.println("oh oh"); + System.out.println(ex.toString()); + } + int num_redirects = 0; + + while (result == HttpStatus.SC_MOVED_TEMPORARILY && + num_redirects++ < redirect_limit) { + //will need to make this a parameter at some point + locationHeader = + ((HttpMethod) _httpMethod). + getResponseHeader("location"); + if (locationHeader != null) { + redirectLocation = + locationHeader.getValue(); + System.out.println("suggesting " + + redirectLocation); + //I am assuming a redirect is always a GET + //If not, we would need something like this +/* + if (method.equals("GET")) { + _httpMethod = new GetMethod(redirectLocation); + } else { + _httpMethod = new PostMethod( + redirectLocation); + } +*/ + _httpMethod = new GetMethod(redirectLocation); + System.out.println("result is now - " + result); + result = _httpClient.executeMethod(_httpMethod); + } + } + + Cookie[] cookies = _httpClient.getState().getCookies(); + if (username != null && password != null) + _httpMethod.setDoAuthentication( true ); + + return _httpMethod; + } catch (Exception e){ + getLogger().error("problem: ", e); + } + + return null; + } + + // Traverse DOM Tree. Print out Element Names + protected void traverse (Node node) + throws IOException, SAXException { + String name = ""; + String value = ""; + int numChildren = 0; + + int type = node.getNodeType(); + NodeList children = node.getChildNodes(); + if (children != null) + numChildren = children.getLength(); + + transformer.getTheLogger().debug("[sethTransformer] node type: " + type); + if (type == Node.ELEMENT_NODE) { + name = + node.getNodeName().trim(); + if (!checkLimitTags(name)) + transformer.start(name, copyAttributes(node)); + } + if (type == Node.TEXT_NODE) { + value = + node.getNodeValue().trim(); + if (textBucket.length() > 0) + textBucket.append(" "); + textBucket.append(value); + } + if (children != null) { + for (int i=0; i< numChildren; i++) + traverse (children.item(i)); + } + if (type == Node.ELEMENT_NODE) { + if (regexp != null && textBucket.length() > 0) { + try { + String newText = + textBucket.toString(); + + if (sethRE.match(newText)) { + transformer.getTheLogger().debug("[sethTransformer] regexp: " + regexp + + " matches on " + newText); + /* RE matches ok, but doesn't extract properly, may not need */ + /* + System.out.println("1> " + sethRE.getParenStart(0)); + System.out.println("2> " + sethRE.getParenStart(1)); + System.out.println("3> " + sethRE.getParenEnd(0)); + System.out.println("4> " + sethRE.getParenEnd(1)); + System.out.println("5> " + sethRE.getParen(0)); + System.out.println("6> " + sethRE.getParen(1)); + */ + + transformer.start(REGEXP_ELEMENT,attr); + transformer.data(newText); + transformer.end(REGEXP_ELEMENT); + textBucket.setLength(0); + } + } catch (Exception reex) { + System.out.println("matching regular expression problem " + reex.toString()); + regexp = null; + } + } + if (textBucket.length() > 0) { + if (!checkLimitTags(name)) + transformer.data(textBucket.toString()); + textBucket.setLength(0); + } + if (!checkLimitTags(name)) + transformer.end(name); + } + } + + protected boolean checkLimitTags(String currentTag) { + if (limit != null) { + String thisLimit = "," + limit + ","; + int limitNum = thisLimit.indexOf("," + currentTag.trim().toUpperCase() + ","); + if (limitNum == -1 ) + return true; + } + + return false; + } +/* + protected boolean checkLimitTags(String currentTag,boolean atEnd,int numKids) { + if (limit != null) { + String thisLimit = "," + limit + ","; + int limitNum = thisLimit.indexOf("," + currentTag.trim().toUpperCase() + ","); + System.out.println("working with " + currentTag); + if (limitTagBlock > 0 && limitNum != -1 && atEnd) { + System.out.println("stopping block for " + currentTag); + limitTagBlock--; + System.out.println("value is now " + limitTagBlock); + } else { + if (limitNum == -1 && limitTagBlock <= 0) { + System.out.println("stop printing for " + currentTag); + return true; + } else { + if (limitNum != -1 && numKids > 0) { + System.out.println("set block to true for " + currentTag); + limitTagBlock++; + System.out.println("value is now " + limitTagBlock); + } + } + } + } + + return false; + } +*/ + + + protected AttributesImpl copyAttributes(Node currentNode) + throws IOException, SAXException + { + AttributesImpl currentAtts = new AttributesImpl(); + NamedNodeMap map = currentNode.getAttributes(); + currentAtts.clear(); + + for (int i = map.getLength() - 1; i >= 0; i--) { + Attr att = (Attr) map.item(i); + /* + currentAtts.addAttribute( att.getNamespaceURI(), + att.getLocalName(), att.getName(), + "CDATA", att.getValue()); + */ + currentAtts.addAttribute(null,att.getName(), att.getName(), + "CDATA", att.getValue()); + } + + return currentAtts; + } + + //show every element if working in DEBUG mode + protected void debugPrint() { + transformer.getTheLogger().debug("[sethTransformer] retrieval_index: " + retrieval_index); + transformer.getTheLogger().debug("[sethTransformer] # of nvps: " + nvps.size()); + transformer.getTheLogger().debug("[sethTransformer] # of cookies: " + sethcookies.size()); + transformer.getTheLogger().debug("[sethTransformer] url: " + url); + transformer.getTheLogger().debug("[sethTransformer] limit: " + limit); + transformer.getTheLogger().debug("[sethTransformer] redirect_limit: " + redirect_limit); + transformer.getTheLogger().debug("[sethTransformer] useragent: " + useragent); + transformer.getTheLogger().debug("[sethTransformer] timeout: " + timeout); + transformer.getTheLogger().debug("[sethTransformer] redirect: " + redirect); + transformer.getTheLogger().debug("[sethTransformer] regexp: " + regexp); + } + + } +}