code
stringlengths
1
2.08M
language
stringclasses
1 value
/** * TrimPath Template. Release 1.0.35. * Copyright (C) 2004, 2005 Metaha. * * TrimPath Template is licensed under the GNU General Public License * and the Apache License, Version 2.0, as follows: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 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. */ var TrimPath; // TODO: Debugging mode vs stop-on-error mode - runtime flag. // TODO: Handle || (or) characters and backslashes. // TODO: Add more modifiers. (function() { // Using a closure to keep global namespace clean. if (TrimPath == null) TrimPath = new Object(); if (TrimPath.evalEx == null) TrimPath.evalEx = function(src) { return eval(src); }; var UNDEFINED; if (Array.prototype.pop == null) // IE 5.x fix from Igor Poteryaev. Array.prototype.pop = function() { if (this.length === 0) {return UNDEFINED;} return this[--this.length]; }; if (Array.prototype.push == null) // IE 5.x fix from Igor Poteryaev. Array.prototype.push = function() { for (var i = 0; i < arguments.length; ++i) {this[this.length] = arguments[i];} return this.length; }; TrimPath.parseTemplate = function(tmplContent, optTmplName, optEtc) { if (optEtc == null) optEtc = TrimPath.parseTemplate_etc; var funcSrc = parse(tmplContent, optTmplName, optEtc); var func = TrimPath.evalEx(funcSrc, optTmplName, 1); if (func != null) return new optEtc.Template(optTmplName, tmplContent, funcSrc, func, optEtc); return null; } try { String.prototype.process = function(context, optFlags) { var template = TrimPath.parseTemplate(this, null); if (template != null) return template.process(context, optFlags); return this; } } catch (e) { // Swallow exception, such as when String.prototype is sealed. } TrimPath.parseTemplate_etc = {}; // Exposed for extensibility. TrimPath.parseTemplate_etc.statementTag = "forelse|for|if|elseif|else|var|macro"; TrimPath.parseTemplate_etc.statementDef = { // Lookup table for statement tags. "if" : { delta: 1, prefix: "if (", suffix: ") {", paramMin: 1 }, "else" : { delta: 0, prefix: "} else {" }, "elseif" : { delta: 0, prefix: "} else if (", suffix: ") {", paramDefault: "true" }, "/if" : { delta: -1, prefix: "}" }, "for" : { delta: 1, paramMin: 3, prefixFunc : function(stmtParts, state, tmplName, etc) { if (stmtParts[2] != "in") throw new etc.ParseError(tmplName, state.line, "bad for loop statement: " + stmtParts.join(' ')); var iterVar = stmtParts[1]; var listVar = "__LIST__" + iterVar; return [ "var ", listVar, " = ", stmtParts[3], ";", // Fix from Ross Shaull for hash looping, make sure that we have an array of loop lengths to treat like a stack. "var __LENGTH_STACK__;", "if (typeof(__LENGTH_STACK__) == 'undefined' || !__LENGTH_STACK__.length) __LENGTH_STACK__ = new Array();", "__LENGTH_STACK__[__LENGTH_STACK__.length] = 0;", // Push a new for-loop onto the stack of loop lengths. "if ((", listVar, ") != null) { ", "var ", iterVar, "_ct = 0;", // iterVar_ct variable, added by B. Bittman "for (var ", iterVar, "_index in ", listVar, ") { ", iterVar, "_ct++;", "if (typeof(", listVar, "[", iterVar, "_index]) == 'function') {continue;}", // IE 5.x fix from Igor Poteryaev. "__LENGTH_STACK__[__LENGTH_STACK__.length - 1]++;", "var ", iterVar, " = ", listVar, "[", iterVar, "_index];" ].join(""); } }, "forelse" : { delta: 0, prefix: "} } if (__LENGTH_STACK__[__LENGTH_STACK__.length - 1] == 0) { if (", suffix: ") {", paramDefault: "true" }, "/for" : { delta: -1, prefix: "} }; delete __LENGTH_STACK__[__LENGTH_STACK__.length - 1];" }, // Remove the just-finished for-loop from the stack of loop lengths. "var" : { delta: 0, prefix: "var ", suffix: ";" }, "macro" : { delta: 1, prefix: "function ", suffix: "{ var _OUT_arr = []; var _OUT = { write: function(m) { if (m) _OUT_arr.push(m); } }; " }, "/macro" : { delta: -1, prefix: " return _OUT_arr.join(''); }" } } TrimPath.parseTemplate_etc.modifierDef = { "eat" : function(v) { return ""; }, "escape" : function(s) { return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"); }, "capitalize" : function(s) { return String(s).toUpperCase(); }, "default" : function(s, d) { return s != null ? s : d; } } TrimPath.parseTemplate_etc.modifierDef.h = TrimPath.parseTemplate_etc.modifierDef.escape; TrimPath.parseTemplate_etc.Template = function(tmplName, tmplContent, funcSrc, func, etc) { this.process = function(context, flags) { if (context == null) context = {}; if (context._MODIFIERS == null) context._MODIFIERS = {}; if (context.defined == null) context.defined = function(str) { return (context[str] != undefined); }; for (var k in etc.modifierDef) { if (context._MODIFIERS[k] == null) context._MODIFIERS[k] = etc.modifierDef[k]; } if (flags == null) flags = {}; var resultArr = []; var resultOut = { write: function(m) { resultArr.push(m); } }; try { func(resultOut, context, flags); } catch (e) { if (flags.throwExceptions == true) throw e; var result = new String(resultArr.join("") + "[ERROR: " + e.toString() + "]"); result["exception"] = e; return result; } return resultArr.join(""); } this.name = tmplName; this.source = tmplContent; this.sourceFunc = funcSrc; this.toString = function() { return "TrimPath.Template [" + tmplName + "]"; } } TrimPath.parseTemplate_etc.ParseError = function(name, line, message) { this.name = name; this.line = line; this.message = message; } TrimPath.parseTemplate_etc.ParseError.prototype.toString = function() { return ("TrimPath template ParseError in " + this.name + ": line " + this.line + ", " + this.message); } var parse = function(body, tmplName, etc) { body = cleanWhiteSpace(body); var funcText = [ "var TrimPath_Template_TEMP = function(_OUT, _CONTEXT, _FLAGS) { with (_CONTEXT) {" ]; var state = { stack: [], line: 1 }; // TODO: Fix line number counting. var endStmtPrev = -1; while (endStmtPrev + 1 < body.length) { var begStmt = endStmtPrev; // Scan until we find some statement markup. begStmt = body.indexOf("{", begStmt + 1); while (begStmt >= 0) { var endStmt = body.indexOf('}', begStmt + 1); var stmt = body.substring(begStmt, endStmt); var blockrx = stmt.match(/^\{(cdata|minify|eval)/); // From B. Bittman, minify/eval/cdata implementation. if (blockrx) { var blockType = blockrx[1]; var blockMarkerBeg = begStmt + blockType.length + 1; var blockMarkerEnd = body.indexOf('}', blockMarkerBeg); if (blockMarkerEnd >= 0) { var blockMarker; if( blockMarkerEnd - blockMarkerBeg <= 0 ) { blockMarker = "{/" + blockType + "}"; } else { blockMarker = body.substring(blockMarkerBeg + 1, blockMarkerEnd); } var blockEnd = body.indexOf(blockMarker, blockMarkerEnd + 1); if (blockEnd >= 0) { emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText); var blockText = body.substring(blockMarkerEnd + 1, blockEnd); if (blockType == 'cdata') { emitText(blockText, funcText); } else if (blockType == 'minify') { emitText(scrubWhiteSpace(blockText), funcText); } else if (blockType == 'eval') { try { eval(blockText); } catch (e) { throw "Error eval'ing block:\n" + e + "\n" + blockText; } } begStmt = endStmtPrev = blockEnd + blockMarker.length - 1; } } } else if (body.charAt(begStmt - 1) != '$' && // Not an expression or backslashed, body.charAt(begStmt - 1) != '\\') { // so check if it is a statement tag. var offset = (body.charAt(begStmt + 1) == '/' ? 2 : 1); // Close tags offset of 2 skips '/'. // 10 is larger than maximum statement tag length. if (body.substring(begStmt + offset, begStmt + 10 + offset).search(TrimPath.parseTemplate_etc.statementTag) == 0) break; // Found a match. } begStmt = body.indexOf("{", begStmt + 1); } if (begStmt < 0) // In "a{for}c", begStmt will be 1. break; var endStmt = body.indexOf("}", begStmt + 1); // In "a{for}c", endStmt will be 5. if (endStmt < 0) break; emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText); emitStatement(body.substring(begStmt, endStmt + 1), state, funcText, tmplName, etc); endStmtPrev = endStmt; } emitSectionText(body.substring(endStmtPrev + 1), funcText); if (state.stack.length != 0) throw new etc.ParseError(tmplName, state.line, "unclosed, unmatched statement(s): " + state.stack.join(",")); funcText.push("}}; TrimPath_Template_TEMP"); return funcText.join(""); } var emitStatement = function(stmtStr, state, funcText, tmplName, etc) { var parts = stmtStr.slice(1, -1).split(' '); var stmt = etc.statementDef[parts[0]]; // Here, parts[0] == for/if/else/... if (stmt == null) { // Not a real statement. emitSectionText(stmtStr, funcText); return; } if (stmt.delta < 0) { if (state.stack.length <= 0) throw new etc.ParseError(tmplName, state.line, "close tag does not match any previous statement: " + stmtStr); state.stack.pop(); } if (stmt.delta > 0) state.stack.push(stmtStr); if (stmt.paramMin != null && stmt.paramMin >= parts.length) throw new etc.ParseError(tmplName, state.line, "statement needs more parameters: " + stmtStr); if (stmt.prefixFunc != null) funcText.push(stmt.prefixFunc(parts, state, tmplName, etc)); else funcText.push(stmt.prefix); if (stmt.suffix != null) { if (parts.length <= 1) { if (stmt.paramDefault != null) funcText.push(stmt.paramDefault); } else { for (var i = 1; i < parts.length; i++) { if (i > 1) funcText.push(' '); funcText.push(parts[i]); } } funcText.push(stmt.suffix); } } var emitSectionText = function(text, funcText) { if (text.length <= 0) return; var nlPrefix = 0; // Index to first non-newline in prefix. var nlSuffix = text.length - 1; // Index to first non-space/tab in suffix. while (nlPrefix < text.length && (text.charAt(nlPrefix) == '\n')) nlPrefix++; while (nlSuffix >= 0 && (text.charAt(nlSuffix) == ' ' || text.charAt(nlSuffix) == '\t')) nlSuffix--; if (nlSuffix < nlPrefix) nlSuffix = nlPrefix; if (nlPrefix > 0) { funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("'); var s = text.substring(0, nlPrefix).replace('\n', '\\n'); // A macro IE fix from BJessen. if (s.charAt(s.length - 1) == '\n') s = s.substring(0, s.length - 1); funcText.push(s); funcText.push('");'); } var lines = text.substring(nlPrefix, nlSuffix + 1).split('\n'); for (var i = 0; i < lines.length; i++) { emitSectionTextLine(lines[i], funcText); if (i < lines.length - 1) funcText.push('_OUT.write("\\n");\n'); } if (nlSuffix + 1 < text.length) { funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("'); var s = text.substring(nlSuffix + 1).replace('\n', '\\n'); if (s.charAt(s.length - 1) == '\n') s = s.substring(0, s.length - 1); funcText.push(s); funcText.push('");'); } } var emitSectionTextLine = function(line, funcText) { var endMarkPrev = '}'; var endExprPrev = -1; while (endExprPrev + endMarkPrev.length < line.length) { var begMark = "${", endMark = "}"; var begExpr = line.indexOf(begMark, endExprPrev + endMarkPrev.length); // In "a${b}c", begExpr == 1 if (begExpr < 0) break; if (line.charAt(begExpr + 2) == '%') { begMark = "${%"; endMark = "%}"; } var endExpr = line.indexOf(endMark, begExpr + begMark.length); // In "a${b}c", endExpr == 4; if (endExpr < 0) break; emitText(line.substring(endExprPrev + endMarkPrev.length, begExpr), funcText); // Example: exprs == 'firstName|default:"John Doe"|capitalize'.split('|') var exprArr = line.substring(begExpr + begMark.length, endExpr).replace(/\|\|/g, "#@@#").split('|'); for (var k in exprArr) { if (exprArr[k].replace) // IE 5.x fix from Igor Poteryaev. exprArr[k] = exprArr[k].replace(/#@@#/g, '||'); } funcText.push('_OUT.write('); emitExpression(exprArr, exprArr.length - 1, funcText); funcText.push(');'); endExprPrev = endExpr; endMarkPrev = endMark; } emitText(line.substring(endExprPrev + endMarkPrev.length), funcText); } var emitText = function(text, funcText) { if (text == null || text.length <= 0) return; text = text.replace(/\\/g, '\\\\'); text = text.replace(/\n/g, '\\n'); text = text.replace(/"/g, '\\"'); funcText.push('_OUT.write("'); funcText.push(text); funcText.push('");'); } var emitExpression = function(exprArr, index, funcText) { // Ex: foo|a:x|b:y1,y2|c:z1,z2 is emitted as c(b(a(foo,x),y1,y2),z1,z2) var expr = exprArr[index]; // Ex: exprArr == [firstName,capitalize,default:"John Doe"] if (index <= 0) { // Ex: expr == 'default:"John Doe"' funcText.push(expr); return; } var parts = expr.split(':'); funcText.push('_MODIFIERS["'); funcText.push(parts[0]); // The parts[0] is a modifier function name, like capitalize. funcText.push('"]('); emitExpression(exprArr, index - 1, funcText); if (parts.length > 1) { funcText.push(','); funcText.push(parts[1]); } funcText.push(')'); } var cleanWhiteSpace = function(result) { result = result.replace(/\t/g, " "); result = result.replace(/\r\n/g, "\n"); result = result.replace(/\r/g, "\n"); result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); // Right trim by Igor Poteryaev. return result; } var scrubWhiteSpace = function(result) { result = result.replace(/^\s+/g, ""); result = result.replace(/\s+$/g, ""); result = result.replace(/\s+/g, " "); result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); // Right trim by Igor Poteryaev. return result; } // The DOM helper functions depend on DOM/DHTML, so they only work in a browser. // However, these are not considered core to the engine. // TrimPath.parseDOMTemplate = function(elementId, optDocument, optEtc) { if (optDocument == null) optDocument = document; var element = optDocument.getElementById(elementId); var content = element.value; // Like textarea.value. if (content == null) content = element.innerHTML; // Like textarea.innerHTML. content = content.replace(/&lt;/g, "<").replace(/&gt;/g, ">"); return TrimPath.parseTemplate(content, elementId, optEtc); } TrimPath.processDOMTemplate = function(elementId, context, optFlags, optDocument, optEtc) { return TrimPath.parseDOMTemplate(elementId, optDocument, optEtc).process(context, optFlags); } }) ();
JavaScript
// script.aculo.us unittest.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com) // (c) 2005, 2006 Michael Schuerig (http://www.schuerig.de/michael/) // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ // experimental, Firefox-only Event.simulateMouse = function(element, eventName) { var options = Object.extend({ pointerX: 0, pointerY: 0, buttons: 0, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false }, arguments[2] || {}); var oEvent = document.createEvent("MouseEvents"); oEvent.initMouseEvent(eventName, true, true, document.defaultView, options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element)); if(this.mark) Element.remove(this.mark); this.mark = document.createElement('div'); this.mark.appendChild(document.createTextNode(" ")); document.body.appendChild(this.mark); this.mark.style.position = 'absolute'; this.mark.style.top = options.pointerY + "px"; this.mark.style.left = options.pointerX + "px"; this.mark.style.width = "5px"; this.mark.style.height = "5px;"; this.mark.style.borderTop = "1px solid red;" this.mark.style.borderLeft = "1px solid red;" if(this.step) alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options)); $(element).dispatchEvent(oEvent); }; // Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2. // You need to downgrade to 1.0.4 for now to get this working // See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much Event.simulateKey = function(element, eventName) { var options = Object.extend({ ctrlKey: false, altKey: false, shiftKey: false, metaKey: false, keyCode: 0, charCode: 0 }, arguments[2] || {}); var oEvent = document.createEvent("KeyEvents"); oEvent.initKeyEvent(eventName, true, true, window, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.keyCode, options.charCode ); $(element).dispatchEvent(oEvent); }; Event.simulateKeys = function(element, command) { for(var i=0; i<command.length; i++) { Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)}); } }; var Test = {} Test.Unit = {}; // security exception workaround Test.Unit.inspect = Object.inspect; Test.Unit.Logger = Class.create(); Test.Unit.Logger.prototype = { initialize: function(log) { this.log = $(log); if (this.log) { this._createLogTable(); } }, start: function(testName) { if (!this.log) return; this.testName = testName; this.lastLogLine = document.createElement('tr'); this.statusCell = document.createElement('td'); this.nameCell = document.createElement('td'); this.nameCell.className = "nameCell"; this.nameCell.appendChild(document.createTextNode(testName)); this.messageCell = document.createElement('td'); this.lastLogLine.appendChild(this.statusCell); this.lastLogLine.appendChild(this.nameCell); this.lastLogLine.appendChild(this.messageCell); this.loglines.appendChild(this.lastLogLine); }, finish: function(status, summary) { if (!this.log) return; this.lastLogLine.className = status; this.statusCell.innerHTML = status; this.messageCell.innerHTML = this._toHTML(summary); this.addLinksToResults(); }, message: function(message) { if (!this.log) return; this.messageCell.innerHTML = this._toHTML(message); }, summary: function(summary) { if (!this.log) return; this.logsummary.innerHTML = this._toHTML(summary); }, _createLogTable: function() { this.log.innerHTML = '<div id="logsummary"></div>' + '<table id="logtable">' + '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' + '<tbody id="loglines"></tbody>' + '</table>'; this.logsummary = $('logsummary') this.loglines = $('loglines'); }, _toHTML: function(txt) { return txt.escapeHTML().replace(/\n/g,"<br/>"); }, addLinksToResults: function(){ $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log td.title = "Run only this test" Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;}); }); $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log td.title = "Run all tests" Event.observe(td, 'click', function(){ window.location.search = "";}); }); } } Test.Unit.Runner = Class.create(); Test.Unit.Runner.prototype = { initialize: function(testcases) { this.options = Object.extend({ testLog: 'testlog' }, arguments[1] || {}); this.options.resultsURL = this.parseResultsURLQueryParameter(); this.options.tests = this.parseTestsQueryParameter(); if (this.options.testLog) { this.options.testLog = $(this.options.testLog) || null; } if(this.options.tests) { this.tests = []; for(var i = 0; i < this.options.tests.length; i++) { if(/^test/.test(this.options.tests[i])) { this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"])); } } } else { if (this.options.test) { this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])]; } else { this.tests = []; for(var testcase in testcases) { if(/^test/.test(testcase)) { this.tests.push( new Test.Unit.Testcase( this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, testcases[testcase], testcases["setup"], testcases["teardown"] )); } } } } this.currentTest = 0; this.logger = new Test.Unit.Logger(this.options.testLog); setTimeout(this.runTests.bind(this), 1000); }, parseResultsURLQueryParameter: function() { return window.location.search.parseQuery()["resultsURL"]; }, parseTestsQueryParameter: function(){ if (window.location.search.parseQuery()["tests"]){ return window.location.search.parseQuery()["tests"].split(','); }; }, // Returns: // "ERROR" if there was an error, // "FAILURE" if there was a failure, or // "SUCCESS" if there was neither getResult: function() { var hasFailure = false; for(var i=0;i<this.tests.length;i++) { if (this.tests[i].errors > 0) { return "ERROR"; } if (this.tests[i].failures > 0) { hasFailure = true; } } if (hasFailure) { return "FAILURE"; } else { return "SUCCESS"; } }, postResults: function() { if (this.options.resultsURL) { new Ajax.Request(this.options.resultsURL, { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false }); } }, runTests: function() { var test = this.tests[this.currentTest]; if (!test) { // finished! this.postResults(); this.logger.summary(this.summary()); return; } if(!test.isWaiting) { this.logger.start(test.name); } test.run(); if(test.isWaiting) { this.logger.message("Waiting for " + test.timeToWait + "ms"); setTimeout(this.runTests.bind(this), test.timeToWait || 1000); } else { this.logger.finish(test.status(), test.summary()); this.currentTest++; // tail recursive, hopefully the browser will skip the stackframe this.runTests(); } }, summary: function() { var assertions = 0; var failures = 0; var errors = 0; var messages = []; for(var i=0;i<this.tests.length;i++) { assertions += this.tests[i].assertions; failures += this.tests[i].failures; errors += this.tests[i].errors; } return ( (this.options.context ? this.options.context + ': ': '') + this.tests.length + " tests, " + assertions + " assertions, " + failures + " failures, " + errors + " errors"); } } Test.Unit.Assertions = Class.create(); Test.Unit.Assertions.prototype = { initialize: function() { this.assertions = 0; this.failures = 0; this.errors = 0; this.messages = []; }, summary: function() { return ( this.assertions + " assertions, " + this.failures + " failures, " + this.errors + " errors" + "\n" + this.messages.join("\n")); }, pass: function() { this.assertions++; }, fail: function(message) { this.failures++; this.messages.push("Failure: " + message); }, info: function(message) { this.messages.push("Info: " + message); }, error: function(error) { this.errors++; this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")"); }, status: function() { if (this.failures > 0) return 'failed'; if (this.errors > 0) return 'error'; return 'passed'; }, assert: function(expression) { var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"'; try { expression ? this.pass() : this.fail(message); } catch(e) { this.error(e); } }, assertEqual: function(expected, actual) { var message = arguments[2] || "assertEqual"; try { (expected == actual) ? this.pass() : this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertInspect: function(expected, actual) { var message = arguments[2] || "assertInspect"; try { (expected == actual.inspect()) ? this.pass() : this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertEnumEqual: function(expected, actual) { var message = arguments[2] || "assertEnumEqual"; try { $A(expected).length == $A(actual).length && expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ? this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + ', actual ' + Test.Unit.inspect(actual)); } catch(e) { this.error(e); } }, assertNotEqual: function(expected, actual) { var message = arguments[2] || "assertNotEqual"; try { (expected != actual) ? this.pass() : this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertIdentical: function(expected, actual) { var message = arguments[2] || "assertIdentical"; try { (expected === actual) ? this.pass() : this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertNotIdentical: function(expected, actual) { var message = arguments[2] || "assertNotIdentical"; try { !(expected === actual) ? this.pass() : this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertNull: function(obj) { var message = arguments[1] || 'assertNull' try { (obj==null) ? this.pass() : this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); } catch(e) { this.error(e); } }, assertMatch: function(expected, actual) { var message = arguments[2] || 'assertMatch'; var regex = new RegExp(expected); try { (regex.exec(actual)) ? this.pass() : this.fail(message + ' : regex: "' + Test.Unit.inspect(expected) + ' did not match: ' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertHidden: function(element) { var message = arguments[1] || 'assertHidden'; this.assertEqual("none", element.style.display, message); }, assertNotNull: function(object) { var message = arguments[1] || 'assertNotNull'; this.assert(object != null, message); }, assertType: function(expected, actual) { var message = arguments[2] || 'assertType'; try { (actual.constructor == expected) ? this.pass() : this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + (actual.constructor) + '"'); } catch(e) { this.error(e); } }, assertNotOfType: function(expected, actual) { var message = arguments[2] || 'assertNotOfType'; try { (actual.constructor != expected) ? this.pass() : this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + (actual.constructor) + '"'); } catch(e) { this.error(e); } }, assertInstanceOf: function(expected, actual) { var message = arguments[2] || 'assertInstanceOf'; try { (actual instanceof expected) ? this.pass() : this.fail(message + ": object was not an instance of the expected type"); } catch(e) { this.error(e); } }, assertNotInstanceOf: function(expected, actual) { var message = arguments[2] || 'assertNotInstanceOf'; try { !(actual instanceof expected) ? this.pass() : this.fail(message + ": object was an instance of the not expected type"); } catch(e) { this.error(e); } }, assertRespondsTo: function(method, obj) { var message = arguments[2] || 'assertRespondsTo'; try { (obj[method] && typeof obj[method] == 'function') ? this.pass() : this.fail(message + ": object doesn't respond to [" + method + "]"); } catch(e) { this.error(e); } }, assertReturnsTrue: function(method, obj) { var message = arguments[2] || 'assertReturnsTrue'; try { var m = obj[method]; if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; m() ? this.pass() : this.fail(message + ": method returned false"); } catch(e) { this.error(e); } }, assertReturnsFalse: function(method, obj) { var message = arguments[2] || 'assertReturnsFalse'; try { var m = obj[method]; if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; !m() ? this.pass() : this.fail(message + ": method returned true"); } catch(e) { this.error(e); } }, assertRaise: function(exceptionName, method) { var message = arguments[2] || 'assertRaise'; try { method(); this.fail(message + ": exception expected but none was raised"); } catch(e) { ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); } }, assertElementsMatch: function() { var expressions = $A(arguments), elements = $A(expressions.shift()); if (elements.length != expressions.length) { this.fail('assertElementsMatch: size mismatch: ' + elements.length + ' elements, ' + expressions.length + ' expressions'); return false; } elements.zip(expressions).all(function(pair, index) { var element = $(pair.first()), expression = pair.last(); if (element.match(expression)) return true; this.fail('assertElementsMatch: (in index ' + index + ') expected ' + expression.inspect() + ' but got ' + element.inspect()); }.bind(this)) && this.pass(); }, assertElementMatches: function(element, expression) { this.assertElementsMatch([element], expression); }, benchmark: function(operation, iterations) { var startAt = new Date(); (iterations || 1).times(operation); var timeTaken = ((new Date())-startAt); this.info((arguments[2] || 'Operation') + ' finished ' + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); return timeTaken; }, _isVisible: function(element) { element = $(element); if(!element.parentNode) return true; this.assertNotNull(element); if(element.style && Element.getStyle(element, 'display') == 'none') return false; return this._isVisible(element.parentNode); }, assertNotVisible: function(element) { this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1])); }, assertVisible: function(element) { this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1])); }, benchmark: function(operation, iterations) { var startAt = new Date(); (iterations || 1).times(operation); var timeTaken = ((new Date())-startAt); this.info((arguments[2] || 'Operation') + ' finished ' + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); return timeTaken; } } Test.Unit.Testcase = Class.create(); Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), { initialize: function(name, test, setup, teardown) { Test.Unit.Assertions.prototype.initialize.bind(this)(); this.name = name; if(typeof test == 'string') { test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,'); test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)'); this.test = function() { eval('with(this){'+test+'}'); } } else { this.test = test || function() {}; } this.setup = setup || function() {}; this.teardown = teardown || function() {}; this.isWaiting = false; this.timeToWait = 1000; }, wait: function(time, nextPart) { this.isWaiting = true; this.test = nextPart; this.timeToWait = time; }, run: function() { try { try { if (!this.isWaiting) this.setup.bind(this)(); this.isWaiting = false; this.test.bind(this)(); } finally { if(!this.isWaiting) { this.teardown.bind(this)(); } } } catch(e) { this.error(e); } } }); // *EXPERIMENTAL* BDD-style testing to please non-technical folk // This draws many ideas from RSpec http://rspec.rubyforge.org/ Test.setupBDDExtensionMethods = function(){ var METHODMAP = { shouldEqual: 'assertEqual', shouldNotEqual: 'assertNotEqual', shouldEqualEnum: 'assertEnumEqual', shouldBeA: 'assertType', shouldNotBeA: 'assertNotOfType', shouldBeAn: 'assertType', shouldNotBeAn: 'assertNotOfType', shouldBeNull: 'assertNull', shouldNotBeNull: 'assertNotNull', shouldBe: 'assertReturnsTrue', shouldNotBe: 'assertReturnsFalse', shouldRespondTo: 'assertRespondsTo' }; Test.BDDMethods = {}; for(m in METHODMAP) { Test.BDDMethods[m] = eval( 'function(){'+ 'var args = $A(arguments);'+ 'var scope = args.shift();'+ 'scope.'+METHODMAP[m]+'.apply(scope,(args || []).concat([this])); }'); } [Array.prototype, String.prototype, Number.prototype].each( function(p){ Object.extend(p, Test.BDDMethods) } ); } Test.context = function(name, spec, log){ Test.setupBDDExtensionMethods(); var compiledSpec = {}; var titles = {}; for(specName in spec) { switch(specName){ case "setup": case "teardown": compiledSpec[specName] = spec[specName]; break; default: var testName = 'test'+specName.gsub(/\s+/,'-').camelize(); var body = spec[specName].toString().split('\n').slice(1); if(/^\{/.test(body[0])) body = body.slice(1); body.pop(); body = body.map(function(statement){ return statement.strip() }); compiledSpec[testName] = body.join('\n'); titles[testName] = specName; } } new Test.Unit.Runner(compiledSpec, { titles: titles, testLog: log || 'testlog', context: name }); };
JavaScript
// script.aculo.us slider.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // Copyright (c) 2005, 2006 Marty Haught, Thomas Fuchs // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ if(!Control) var Control = {}; Control.Slider = Class.create(); // options: // axis: 'vertical', or 'horizontal' (default) // // callbacks: // onChange(value) // onSlide(value) Control.Slider.prototype = { initialize: function(handle, track, options) { var slider = this; if(handle instanceof Array) { this.handles = handle.collect( function(e) { return $(e) }); } else { this.handles = [$(handle)]; } this.track = $(track); this.options = options || {}; this.axis = this.options.axis || 'horizontal'; this.increment = this.options.increment || 1; this.step = parseInt(this.options.step || '1'); this.range = this.options.range || $R(0,1); this.value = 0; // assure backwards compat this.values = this.handles.map( function() { return 0 }); this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; this.options.startSpan = $(this.options.startSpan || null); this.options.endSpan = $(this.options.endSpan || null); this.restricted = this.options.restricted || false; this.maximum = this.options.maximum || this.range.end; this.minimum = this.options.minimum || this.range.start; // Will be used to align the handle onto the track, if necessary this.alignX = parseInt(this.options.alignX || '0'); this.alignY = parseInt(this.options.alignY || '0'); this.trackLength = this.maximumOffset() - this.minimumOffset(); this.handleLength = this.isVertical() ? (this.handles[0].offsetHeight != 0 ? this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : this.handles[0].style.width.replace(/px$/,"")); this.active = false; this.dragging = false; this.disabled = false; if(this.options.disabled) this.setDisabled(); // Allowed values array this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false; if(this.allowedValues) { this.minimum = this.allowedValues.min(); this.maximum = this.allowedValues.max(); } this.eventMouseDown = this.startDrag.bindAsEventListener(this); this.eventMouseUp = this.endDrag.bindAsEventListener(this); this.eventMouseMove = this.update.bindAsEventListener(this); // Initialize handles in reverse (make sure first handle is active) this.handles.each( function(h,i) { i = slider.handles.length-1-i; slider.setValue(parseFloat( (slider.options.sliderValue instanceof Array ? slider.options.sliderValue[i] : slider.options.sliderValue) || slider.range.start), i); Element.makePositioned(h); // fix IE Event.observe(h, "mousedown", slider.eventMouseDown); }); Event.observe(this.track, "mousedown", this.eventMouseDown); Event.observe(document, "mouseup", this.eventMouseUp); Event.observe(document, "mousemove", this.eventMouseMove); this.initialized = true; }, dispose: function() { var slider = this; Event.stopObserving(this.track, "mousedown", this.eventMouseDown); Event.stopObserving(document, "mouseup", this.eventMouseUp); Event.stopObserving(document, "mousemove", this.eventMouseMove); this.handles.each( function(h) { Event.stopObserving(h, "mousedown", slider.eventMouseDown); }); }, setDisabled: function(){ this.disabled = true; }, setEnabled: function(){ this.disabled = false; }, getNearestValue: function(value){ if(this.allowedValues){ if(value >= this.allowedValues.max()) return(this.allowedValues.max()); if(value <= this.allowedValues.min()) return(this.allowedValues.min()); var offset = Math.abs(this.allowedValues[0] - value); var newValue = this.allowedValues[0]; this.allowedValues.each( function(v) { var currentOffset = Math.abs(v - value); if(currentOffset <= offset){ newValue = v; offset = currentOffset; } }); return newValue; } if(value > this.range.end) return this.range.end; if(value < this.range.start) return this.range.start; return value; }, setValue: function(sliderValue, handleIdx){ if(!this.active) { this.activeHandleIdx = handleIdx || 0; this.activeHandle = this.handles[this.activeHandleIdx]; this.updateStyles(); } handleIdx = handleIdx || this.activeHandleIdx || 0; if(this.initialized && this.restricted) { if((handleIdx>0) && (sliderValue<this.values[handleIdx-1])) sliderValue = this.values[handleIdx-1]; if((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1])) sliderValue = this.values[handleIdx+1]; } sliderValue = this.getNearestValue(sliderValue); this.values[handleIdx] = sliderValue; this.value = this.values[0]; // assure backwards compat this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = this.translateToPx(sliderValue); this.drawSpans(); if(!this.dragging || !this.event) this.updateFinished(); }, setValueBy: function(delta, handleIdx) { this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, handleIdx || this.activeHandleIdx || 0); }, translateToPx: function(value) { return Math.round( ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * (value - this.range.start)) + "px"; }, translateToValue: function(offset) { return ((offset/(this.trackLength-this.handleLength) * (this.range.end-this.range.start)) + this.range.start); }, getRange: function(range) { var v = this.values.sortBy(Prototype.K); range = range || 0; return $R(v[range],v[range+1]); }, minimumOffset: function(){ return(this.isVertical() ? this.alignY : this.alignX); }, maximumOffset: function(){ return(this.isVertical() ? (this.track.offsetHeight != 0 ? this.track.offsetHeight : this.track.style.height.replace(/px$/,"")) - this.alignY : (this.track.offsetWidth != 0 ? this.track.offsetWidth : this.track.style.width.replace(/px$/,"")) - this.alignY); }, isVertical: function(){ return (this.axis == 'vertical'); }, drawSpans: function() { var slider = this; if(this.spans) $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) }); if(this.options.startSpan) this.setSpan(this.options.startSpan, $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); if(this.options.endSpan) this.setSpan(this.options.endSpan, $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); }, setSpan: function(span, range) { if(this.isVertical()) { span.style.top = this.translateToPx(range.start); span.style.height = this.translateToPx(range.end - range.start + this.range.start); } else { span.style.left = this.translateToPx(range.start); span.style.width = this.translateToPx(range.end - range.start + this.range.start); } }, updateStyles: function() { this.handles.each( function(h){ Element.removeClassName(h, 'selected') }); Element.addClassName(this.activeHandle, 'selected'); }, startDrag: function(event) { if(Event.isLeftClick(event)) { if(!this.disabled){ this.active = true; var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; var track = handle; if(track==this.track) { var offsets = Position.cumulativeOffset(this.track); this.event = event; this.setValue(this.translateToValue( (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) )); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } else { // find the handle (prevents issues with Safari) while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; if(this.handles.indexOf(handle)!=-1) { this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } } } Event.stop(event); } }, update: function(event) { if(this.active) { if(!this.dragging) this.dragging = true; this.draw(event); // fix AppleWebKit rendering if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); Event.stop(event); } }, draw: function(event) { var pointer = [Event.pointerX(event), Event.pointerY(event)]; var offsets = Position.cumulativeOffset(this.track); pointer[0] -= this.offsetX + offsets[0]; pointer[1] -= this.offsetY + offsets[1]; this.event = event; this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] )); if(this.initialized && this.options.onSlide) this.options.onSlide(this.values.length>1 ? this.values : this.value, this); }, endDrag: function(event) { if(this.active && this.dragging) { this.finishDrag(event, true); Event.stop(event); } this.active = false; this.dragging = false; }, finishDrag: function(event, success) { this.active = false; this.dragging = false; this.updateFinished(); }, updateFinished: function() { if(this.initialized && this.options.onChange) this.options.onChange(this.values.length>1 ? this.values : this.value, this); this.event = null; } }
JavaScript
// script.aculo.us scriptaculous.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // For details, see the script.aculo.us web site: http://script.aculo.us/ var Scriptaculous = { Version: '1.7.0', require: function(libraryName) { // inserting via DOM fails in Safari 2.0, so brute force approach document.write('<script type="text/javascript" src="'+libraryName+'"></script>'); }, load: function() { if((typeof Prototype=='undefined') || (typeof Element == 'undefined') || (typeof Element.Methods=='undefined') || parseFloat(Prototype.Version.split(".")[0] + "." + Prototype.Version.split(".")[1]) < 1.5) throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0"); $A(document.getElementsByTagName("script")).findAll( function(s) { return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) }).each( function(s) { var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); var includes = s.src.match(/\?.*load=([a-z,]*)/); (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each( function(include) { Scriptaculous.require(path+include+'.js') }); }); } } Scriptaculous.load();
JavaScript
// script.aculo.us builder.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ var Builder = { NODEMAP: { AREA: 'map', CAPTION: 'table', COL: 'table', COLGROUP: 'table', LEGEND: 'fieldset', OPTGROUP: 'select', OPTION: 'select', PARAM: 'object', TBODY: 'table', TD: 'table', TFOOT: 'table', TH: 'table', THEAD: 'table', TR: 'table' }, // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, // due to a Firefox bug node: function(elementName) { elementName = elementName.toUpperCase(); // try innerHTML approach var parentTag = this.NODEMAP[elementName] || 'div'; var parentElement = document.createElement(parentTag); try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 parentElement.innerHTML = "<" + elementName + "></" + elementName + ">"; } catch(e) {} var element = parentElement.firstChild || null; // see if browser added wrapping tags if(element && (element.tagName.toUpperCase() != elementName)) element = element.getElementsByTagName(elementName)[0]; // fallback to createElement approach if(!element) element = document.createElement(elementName); // abort if nothing could be created if(!element) return; // attributes (or text) if(arguments[1]) if(this._isStringOrNumber(arguments[1]) || (arguments[1] instanceof Array)) { this._children(element, arguments[1]); } else { var attrs = this._attributes(arguments[1]); if(attrs.length) { try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 parentElement.innerHTML = "<" +elementName + " " + attrs + "></" + elementName + ">"; } catch(e) {} element = parentElement.firstChild || null; // workaround firefox 1.0.X bug if(!element) { element = document.createElement(elementName); for(attr in arguments[1]) element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; } if(element.tagName.toUpperCase() != elementName) element = parentElement.getElementsByTagName(elementName)[0]; } } // text, or array of children if(arguments[2]) this._children(element, arguments[2]); return element; }, _text: function(text) { return document.createTextNode(text); }, ATTR_MAP: { 'className': 'class', 'htmlFor': 'for' }, _attributes: function(attributes) { var attrs = []; for(attribute in attributes) attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + '="' + attributes[attribute].toString().escapeHTML() + '"'); return attrs.join(" "); }, _children: function(element, children) { if(typeof children=='object') { // array can hold nodes and text children.flatten().each( function(e) { if(typeof e=='object') element.appendChild(e) else if(Builder._isStringOrNumber(e)) element.appendChild(Builder._text(e)); }); } else if(Builder._isStringOrNumber(children)) element.appendChild(Builder._text(children)); }, _isStringOrNumber: function(param) { return(typeof param=='string' || typeof param=='number'); }, build: function(html) { var element = this.node('div'); $(element).update(html.strip()); return element.down(); }, dump: function(scope) { if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); tags.each( function(tag){ scope[tag] = function() { return Builder.node.apply(Builder, [tag].concat($A(arguments))); } }); } }
JavaScript
//后台管理界面用到的一些函数 function batch_do(entityName, action) { if (confirm("确定要" + entityName + "?")) { if (!atleaseOneCheck()) { alert('请至少选择一' + entityName + '!'); return; } var form = document.forms.ec; form.action = action + '&autoInc=false'; form.submit(); } } function openwin(url, width, height, scroll) { if (!document.all) { document.captureEvents(Event.MOUSEMOVE); x = e.pageX + width - 30; y = e.pageY + height - 30; } else { x = document.body.scrollLeft + event.clientX + width - 30; y = document.body.scrollTop + event.clientY + height - 30; } window.open(url, "newWindow", "height=" + height + ", width=" + width + ", toolbar =no, menubar=no, scrollbars=" + scroll + ", resizable=no, location=no, status=no, top=" + y + ", left=" + x + "") //写成一行 } function win(url, width, height) { var win = window.open(url, "viewImage", "height=" + height + ",width=" + width + ",toolbar=no,menubar=0,scrollbars=no,resizable=no,location=no,status=no,top=20,left=20"); return win; } //checkbox中至少有一项被选中 function atleaseOneCheck() { var items = document.getElementsByName('itemlist'); if (items.length > 0) { for (var i = 0; i < items.length; i++) { if (items[i].checked == true) { return true; } } } else { if (items.checked == true) { return true; } } return false; } // 全选,全不选 function selectAll(item) { var value = false; if (item.checked) { value = true; } else { value = false; } var items = document.getElementsByName('itemlist'); for (var i = 0; i < items.length; i++) { items[i].checked = value; } } function info(item) { var buff = ""; for (var i in item) { try { buff += i + ":" + item[i] + "\n"; } catch (e) { alert(e); } } alert(buff); }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: zh-cn.js * Chinese Simplified language file. * * File Authors: * NetRube (NetRube@gmail.com) */ var FCKLang = { // Language direction : "ltr" (left to right) or "rtl" (right to left). Dir : "ltr", ToolbarCollapse : "折叠工具栏", ToolbarExpand : "展开工具栏", // Toolbar Items and Context Menu Save : "保存", NewPage : "新建", Preview : "预览", Cut : "剪切", Copy : "复制", Paste : "粘贴", PasteText : "粘贴为无格式文本", PasteWord : "从 MS Word 粘贴", Print : "打印", SelectAll : "全选", RemoveFormat : "清除格式", InsertLinkLbl : "超链接", InsertLink : "插入/编辑超链接", RemoveLink : "取消超链接", Anchor : "插入/编辑锚点链接", InsertImageLbl : "图象", InsertImage : "插入/编辑图象", InsertFlashLbl : "Flash", InsertFlash : "插入/编辑 Flash", InsertTableLbl : "表格", InsertTable : "插入/编辑表格", InsertLineLbl : "水平线", InsertLine : "插入水平线", InsertSpecialCharLbl: "特殊符号", InsertSpecialChar : "插入特殊符号", InsertSmileyLbl : "表情符", InsertSmiley : "插入表情图标", About : "关于 FCKeditor", Bold : "加粗", Italic : "倾斜", Underline : "下划线", StrikeThrough : "删除线", Subscript : "下标", Superscript : "上标", LeftJustify : "左对齐", CenterJustify : "居中对齐", RightJustify : "右对齐", BlockJustify : "两端对齐", DecreaseIndent : "减少缩进量", IncreaseIndent : "增加缩进量", Undo : "撤消", Redo : "重做", NumberedListLbl : "编号列表", NumberedList : "插入/删除编号列表", BulletedListLbl : "项目列表", BulletedList : "插入/删除项目列表", ShowTableBorders : "显示表格边框", ShowDetails : "显示详细资料", Style : "样式", FontFormat : "格式", Font : "字体", FontSize : "大小", TextColor : "文本颜色", BGColor : "背景颜色", Source : "源代码", Find : "查找", Replace : "替换", SpellCheck : "拼写检查", UniversalKeyboard : "软键盘", PageBreakLbl : "分页符", PageBreak : "插入分页符", Form : "表单", Checkbox : "复选框", RadioButton : "单选按钮", TextField : "单行文本", Textarea : "多行文本", HiddenField : "隐藏域", Button : "按钮", SelectionField : "列表/菜单", ImageButton : "图像域", FitWindow : "全屏编辑", // Context Menu EditLink : "编辑超链接", CellCM : "单元格", RowCM : "行", ColumnCM : "列", InsertRow : "插入行", DeleteRows : "删除行", InsertColumn : "插入列", DeleteColumns : "删除列", InsertCell : "插入单元格", DeleteCells : "删除单元格", MergeCells : "合并单元格", SplitCell : "拆分单元格", TableDelete : "删除表格", CellProperties : "单元格属性", TableProperties : "表格属性", ImageProperties : "图象属性", FlashProperties : "Flash 属性", AnchorProp : "锚点链接属性", ButtonProp : "按钮属性", CheckboxProp : "复选框属性", HiddenFieldProp : "隐藏域属性", RadioButtonProp : "单选按钮属性", ImageButtonProp : "图像域属性", TextFieldProp : "单行文本属性", SelectionFieldProp : "菜单/列表属性", TextareaProp : "多行文本属性", FormProp : "表单属性", FontFormats : "普通;已编排格式;地址;标题 1;标题 2;标题 3;标题 4;标题 5;标题 6;段落(DIV)", // Alerts and Messages ProcessingXHTML : "正在处理 XHTML,请稍等...", Done : "完成", PasteWordConfirm : "您要粘贴的内容好像是来自 MS Word,是否要清除 MS Word 格式后再粘贴?", NotCompatiblePaste : "该命令需要 Internet Explorer 5.5 或更高版本的支持,是否按常规粘贴进行?", UnknownToolbarItem : "未知工具栏项目 \"%1\"", UnknownCommand : "未知命令名称 \"%1\"", NotImplemented : "命令无法执行", UnknownToolbarSet : "工具栏设置 \"%1\" 不存在", NoActiveX : "浏览器安全设置限制了本编辑器的某些功能。您必须启用安全设置中的“运行 ActiveX 控件和插件”,否则将出现某些错误并缺少功能。", BrowseServerBlocked : "无法打开资源浏览器,请确认是否启用了禁止弹出窗口。", DialogBlocked : "无法打开对话框窗口,请确认是否启用了禁止弹出窗口或网页对话框(IE)。", // Dialogs DlgBtnOK : "确定", DlgBtnCancel : "取消", DlgBtnClose : "关闭", DlgBtnBrowseServer : "浏览服务器", DlgAdvancedTag : "高级", DlgOpOther : "<其它>", DlgInfoTab : "信息", DlgAlertUrl : "请插入 URL", // General Dialogs Labels DlgGenNotSet : "<没有设置>", DlgGenId : "ID", DlgGenLangDir : "语言方向", DlgGenLangDirLtr : "从左到右 (LTR)", DlgGenLangDirRtl : "从右到左 (RTL)", DlgGenLangCode : "语言代码", DlgGenAccessKey : "访问键", DlgGenName : "名称", DlgGenTabIndex : "Tab 键次序", DlgGenLongDescr : "详细说明地址", DlgGenClass : "样式类名称", DlgGenTitle : "标题", DlgGenContType : "内容类型", DlgGenLinkCharset : "字符编码", DlgGenStyle : "行内样式", // Image Dialog DlgImgTitle : "图象属性", DlgImgInfoTab : "图象", DlgImgBtnUpload : "发送到服务器上", DlgImgURL : "源文件", DlgImgUpload : "上传", DlgImgAlt : "替换文本", DlgImgWidth : "宽度", DlgImgHeight : "高度", DlgImgLockRatio : "锁定比例", DlgBtnResetSize : "恢复尺寸", DlgImgBorder : "边框大小", DlgImgHSpace : "水平间距", DlgImgVSpace : "垂直间距", DlgImgAlign : "对齐方式", DlgImgAlignLeft : "左对齐", DlgImgAlignAbsBottom: "绝对底边", DlgImgAlignAbsMiddle: "绝对居中", DlgImgAlignBaseline : "基线", DlgImgAlignBottom : "底边", DlgImgAlignMiddle : "居中", DlgImgAlignRight : "右对齐", DlgImgAlignTextTop : "文本上方", DlgImgAlignTop : "顶端", DlgImgPreview : "预览", DlgImgAlertUrl : "请输入图象地址", DlgImgLinkTab : "链接", // Flash Dialog DlgFlashTitle : "Flash 属性", DlgFlashChkPlay : "自动播放", DlgFlashChkLoop : "循环", DlgFlashChkMenu : "启用 Flash 菜单", DlgFlashScale : "缩放", DlgFlashScaleAll : "全部显示", DlgFlashScaleNoBorder : "无边框", DlgFlashScaleFit : "严格匹配", // Link Dialog DlgLnkWindowTitle : "超链接", DlgLnkInfoTab : "超链接信息", DlgLnkTargetTab : "目标", DlgLnkType : "超链接类型", DlgLnkTypeURL : "超链接", DlgLnkTypeAnchor : "页内锚点链接", DlgLnkTypeEMail : "电子邮件", DlgLnkProto : "协议", DlgLnkProtoOther : "<其它>", DlgLnkURL : "地址", DlgLnkAnchorSel : "选择一个锚点", DlgLnkAnchorByName : "按锚点名称", DlgLnkAnchorById : "按锚点 ID", DlgLnkNoAnchors : "<此文档没有可用的锚点>", DlgLnkEMail : "地址", DlgLnkEMailSubject : "主题", DlgLnkEMailBody : "内容", DlgLnkUpload : "上传", DlgLnkBtnUpload : "发送到服务器上", DlgLnkTarget : "目标", DlgLnkTargetFrame : "<框架>", DlgLnkTargetPopup : "<弹出窗口>", DlgLnkTargetBlank : "新窗口 (_blank)", DlgLnkTargetParent : "父窗口 (_parent)", DlgLnkTargetSelf : "本窗口 (_self)", DlgLnkTargetTop : "整页 (_top)", DlgLnkTargetFrameName : "目标框架名称", DlgLnkPopWinName : "弹出窗口名称", DlgLnkPopWinFeat : "弹出窗口属性", DlgLnkPopResize : "调整大小", DlgLnkPopLocation : "地址栏", DlgLnkPopMenu : "菜单栏", DlgLnkPopScroll : "滚动条", DlgLnkPopStatus : "状态栏", DlgLnkPopToolbar : "工具栏", DlgLnkPopFullScrn : "全屏 (IE)", DlgLnkPopDependent : "依附 (NS)", DlgLnkPopWidth : "宽", DlgLnkPopHeight : "高", DlgLnkPopLeft : "左", DlgLnkPopTop : "右", DlnLnkMsgNoUrl : "请输入超链接地址", DlnLnkMsgNoEMail : "请输入电子邮件地址", DlnLnkMsgNoAnchor : "请选择一个锚点", // Color Dialog DlgColorTitle : "选择颜色", DlgColorBtnClear : "清除", DlgColorHighlight : "预览", DlgColorSelected : "选择", // Smiley Dialog DlgSmileyTitle : "插入表情图标", // Special Character Dialog DlgSpecialCharTitle : "选择特殊符号", // Table Dialog DlgTableTitle : "表格属性", DlgTableRows : "行数", DlgTableColumns : "列数", DlgTableBorder : "边框", DlgTableAlign : "对齐", DlgTableAlignNotSet : "<没有设置>", DlgTableAlignLeft : "左对齐", DlgTableAlignCenter : "居中", DlgTableAlignRight : "右对齐", DlgTableWidth : "宽度", DlgTableWidthPx : "像素", DlgTableWidthPc : "百分比", DlgTableHeight : "高度", DlgTableCellSpace : "间距", DlgTableCellPad : "边距", DlgTableCaption : "标题", DlgTableSummary : "摘要", // Table Cell Dialog DlgCellTitle : "单元格属性", DlgCellWidth : "宽度", DlgCellWidthPx : "像素", DlgCellWidthPc : "百分比", DlgCellHeight : "高度", DlgCellWordWrap : "自动换行", DlgCellWordWrapNotSet : "<没有设置>", DlgCellWordWrapYes : "是", DlgCellWordWrapNo : "否", DlgCellHorAlign : "水平对齐", DlgCellHorAlignNotSet : "<没有设置>", DlgCellHorAlignLeft : "左对齐", DlgCellHorAlignCenter : "居中", DlgCellHorAlignRight: "右对齐", DlgCellVerAlign : "垂直对齐", DlgCellVerAlignNotSet : "<没有设置>", DlgCellVerAlignTop : "顶端", DlgCellVerAlignMiddle : "居中", DlgCellVerAlignBottom : "底部", DlgCellVerAlignBaseline : "基线", DlgCellRowSpan : "纵跨行数", DlgCellCollSpan : "横跨列数", DlgCellBackColor : "背景颜色", DlgCellBorderColor : "边框颜色", DlgCellBtnSelect : "选择...", // Find Dialog DlgFindTitle : "查找", DlgFindFindBtn : "查找", DlgFindNotFoundMsg : "指定文本没有找到。", // Replace Dialog DlgReplaceTitle : "替换", DlgReplaceFindLbl : "查找:", DlgReplaceReplaceLbl : "替换:", DlgReplaceCaseChk : "区分大小写", DlgReplaceReplaceBtn : "替换", DlgReplaceReplAllBtn : "全部替换", DlgReplaceWordChk : "全字匹配", // Paste Operations / Dialog PasteErrorPaste : "您的浏览器安全设置不允许编辑器自动执行粘贴操作,请使用键盘快捷键(Ctrl+V)来完成。", PasteErrorCut : "您的浏览器安全设置不允许编辑器自动执行剪切操作,请使用键盘快捷键(Ctrl+X)来完成。", PasteErrorCopy : "您的浏览器安全设置不允许编辑器自动执行复制操作,请使用键盘快捷键(Ctrl+C)来完成。", PasteAsText : "粘贴为无格式文本", PasteFromWord : "从 MS Word 粘贴", DlgPasteMsg2 : "请使用键盘快捷键(<STRONG>Ctrl+V</STRONG>)把内容粘贴到下面的方框里,再按 <STRONG>确定</STRONG>。", DlgPasteIgnoreFont : "忽略 Font 标签", DlgPasteRemoveStyles : "清理 CSS 样式", DlgPasteCleanBox : "清空上面内容", // Color Picker ColorAutomatic : "自动", ColorMoreColors : "其它颜色...", // Document Properties DocProps : "页面属性", // Anchor Dialog DlgAnchorTitle : "命名锚点", DlgAnchorName : "锚点名称", DlgAnchorErrorName : "请输入锚点名称", // Speller Pages Dialog DlgSpellNotInDic : "没有在字典里", DlgSpellChangeTo : "更改为", DlgSpellBtnIgnore : "忽略", DlgSpellBtnIgnoreAll : "全部忽略", DlgSpellBtnReplace : "替换", DlgSpellBtnReplaceAll : "全部替换", DlgSpellBtnUndo : "撤消", DlgSpellNoSuggestions : "- 没有建议 -", DlgSpellProgress : "正在进行拼写检查...", DlgSpellNoMispell : "拼写检查完成:没有发现拼写错误", DlgSpellNoChanges : "拼写检查完成:没有更改任何单词", DlgSpellOneChange : "拼写检查完成:更改了一个单词", DlgSpellManyChanges : "拼写检查完成:更改了 %1 个单词", IeSpellDownload : "拼写检查插件还没安装,你是否想现在就下载?", // Button Dialog DlgButtonText : "标签(值)", DlgButtonType : "类型", // Checkbox and Radio Button Dialogs DlgCheckboxName : "名称", DlgCheckboxValue : "选定值", DlgCheckboxSelected : "已勾选", // Form Dialog DlgFormName : "名称", DlgFormAction : "动作", DlgFormMethod : "方法", // Select Field Dialog DlgSelectName : "名称", DlgSelectValue : "选定", DlgSelectSize : "高度", DlgSelectLines : "行", DlgSelectChkMulti : "允许多选", DlgSelectOpAvail : "列表值", DlgSelectOpText : "标签", DlgSelectOpValue : "值", DlgSelectBtnAdd : "新增", DlgSelectBtnModify : "修改", DlgSelectBtnUp : "上移", DlgSelectBtnDown : "下移", DlgSelectBtnSetValue : "设为初始化时选定", DlgSelectBtnDelete : "删除", // Textarea Dialog DlgTextareaName : "名称", DlgTextareaCols : "字符宽度", DlgTextareaRows : "行数", // Text Field Dialog DlgTextName : "名称", DlgTextValue : "初始值", DlgTextCharWidth : "字符宽度", DlgTextMaxChars : "最多字符数", DlgTextType : "类型", DlgTextTypeText : "文本", DlgTextTypePass : "密码", // Hidden Field Dialog DlgHiddenName : "名称", DlgHiddenValue : "初始值", // Bulleted List Dialog BulletedListProp : "项目列表属性", NumberedListProp : "编号列表属性", DlgLstType : "列表类型", DlgLstTypeCircle : "圆圈", DlgLstTypeDisc : "圆点", DlgLstTypeSquare : "方块", DlgLstTypeNumbers : "数字 (1, 2, 3)", DlgLstTypeLCase : "小写字母 (a, b, c)", DlgLstTypeUCase : "大写字母 (A, B, C)", DlgLstTypeSRoman : "小写罗马数字 (i, ii, iii)", DlgLstTypeLRoman : "大写罗马数字 (I, II, III)", // Document Properties Dialog DlgDocGeneralTab : "常规", DlgDocBackTab : "背景", DlgDocColorsTab : "颜色和边距", DlgDocMetaTab : "Meta 数据", DlgDocPageTitle : "页面标题", DlgDocLangDir : "语言方向", DlgDocLangDirLTR : "从左到右 (LTR)", DlgDocLangDirRTL : "从右到左 (RTL)", DlgDocLangCode : "语言代码", DlgDocCharSet : "字符编码", DlgDocCharSetOther : "其它字符编码", DlgDocDocType : "文档类型", DlgDocDocTypeOther : "其它文档类型", DlgDocIncXHTML : "包含 XHTML 声明", DlgDocBgColor : "背景颜色", DlgDocBgImage : "背景图像", DlgDocBgNoScroll : "不滚动背景图像", DlgDocCText : "文本", DlgDocCLink : "超链接", DlgDocCVisited : "已访问的超链接", DlgDocCActive : "活动超链接", DlgDocMargins : "页面边距", DlgDocMaTop : "上", DlgDocMaLeft : "左", DlgDocMaRight : "右", DlgDocMaBottom : "下", DlgDocMeIndex : "页面索引关键字 (用半角逗号[,]分隔)", DlgDocMeDescr : "页面说明", DlgDocMeAuthor : "作者", DlgDocMeCopy : "版权", DlgDocPreview : "预览", // Templates Dialog Templates : "模板", DlgTemplatesTitle : "内容模板", DlgTemplatesSelMsg : "请选择编辑器内容模板<br>(当前内容将会被清除替换):", DlgTemplatesLoading : "正在加载模板列表,请稍等...", DlgTemplatesNoTpl : "(没有模板)", // About Dialog DlgAboutAboutTab : "关于", DlgAboutBrowserInfoTab : "浏览器信息", DlgAboutLicenseTab : "许可证", DlgAboutVersion : "版本", DlgAboutLicense : "基于 GNU 通用公共许可证授权发布 ", DlgAboutInfo : "要获得更多信息请访问 " }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: en.js * English language file. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ var FCKLang = { // Language direction : "ltr" (left to right) or "rtl" (right to left). Dir : "ltr", ToolbarCollapse : "Collapse Toolbar", ToolbarExpand : "Expand Toolbar", // Toolbar Items and Context Menu Save : "Save", NewPage : "New Page", Preview : "Preview", Cut : "Cut", Copy : "Copy", Paste : "Paste", PasteText : "Paste as plain text", PasteWord : "Paste from Word", Print : "Print", SelectAll : "Select All", RemoveFormat : "Remove Format", InsertLinkLbl : "Link", InsertLink : "Insert/Edit Link", RemoveLink : "Remove Link", Anchor : "Insert/Edit Anchor", InsertImageLbl : "Image", InsertImage : "Insert/Edit Image", InsertFlashLbl : "Flash", InsertFlash : "Insert/Edit Flash", InsertTableLbl : "Table", InsertTable : "Insert/Edit Table", InsertLineLbl : "Line", InsertLine : "Insert Horizontal Line", InsertSpecialCharLbl: "Special Character", InsertSpecialChar : "Insert Special Character", InsertSmileyLbl : "Smiley", InsertSmiley : "Insert Smiley", About : "About FCKeditor", Bold : "Bold", Italic : "Italic", Underline : "Underline", StrikeThrough : "Strike Through", Subscript : "Subscript", Superscript : "Superscript", LeftJustify : "Left Justify", CenterJustify : "Center Justify", RightJustify : "Right Justify", BlockJustify : "Block Justify", DecreaseIndent : "Decrease Indent", IncreaseIndent : "Increase Indent", Undo : "Undo", Redo : "Redo", NumberedListLbl : "Numbered List", NumberedList : "Insert/Remove Numbered List", BulletedListLbl : "Bulleted List", BulletedList : "Insert/Remove Bulleted List", ShowTableBorders : "Show Table Borders", ShowDetails : "Show Details", Style : "Style", FontFormat : "Format", Font : "Font", FontSize : "Size", TextColor : "Text Color", BGColor : "Background Color", Source : "Source", Find : "Find", Replace : "Replace", SpellCheck : "Check Spelling", UniversalKeyboard : "Universal Keyboard", PageBreakLbl : "Page Break", PageBreak : "Insert Page Break", Form : "Form", Checkbox : "Checkbox", RadioButton : "Radio Button", TextField : "Text Field", Textarea : "Textarea", HiddenField : "Hidden Field", Button : "Button", SelectionField : "Selection Field", ImageButton : "Image Button", FitWindow : "Maximize the editor size", // Context Menu EditLink : "Edit Link", CellCM : "Cell", RowCM : "Row", ColumnCM : "Column", InsertRow : "Insert Row", DeleteRows : "Delete Rows", InsertColumn : "Insert Column", DeleteColumns : "Delete Columns", InsertCell : "Insert Cell", DeleteCells : "Delete Cells", MergeCells : "Merge Cells", SplitCell : "Split Cell", TableDelete : "Delete Table", CellProperties : "Cell Properties", TableProperties : "Table Properties", ImageProperties : "Image Properties", FlashProperties : "Flash Properties", AnchorProp : "Anchor Properties", ButtonProp : "Button Properties", CheckboxProp : "Checkbox Properties", HiddenFieldProp : "Hidden Field Properties", RadioButtonProp : "Radio Button Properties", ImageButtonProp : "Image Button Properties", TextFieldProp : "Text Field Properties", SelectionFieldProp : "Selection Field Properties", TextareaProp : "Textarea Properties", FormProp : "Form Properties", FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)", // Alerts and Messages ProcessingXHTML : "Processing XHTML. Please wait...", Done : "Done", PasteWordConfirm : "The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?", NotCompatiblePaste : "This command is available for Internet Explorer version 5.5 or more. Do you want to paste without cleaning?", UnknownToolbarItem : "Unknown toolbar item \"%1\"", UnknownCommand : "Unknown command name \"%1\"", NotImplemented : "Command not implemented", UnknownToolbarSet : "Toolbar set \"%1\" doesn't exist", NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", // Dialogs DlgBtnOK : "OK", DlgBtnCancel : "Cancel", DlgBtnClose : "Close", DlgBtnBrowseServer : "Browse Server", DlgAdvancedTag : "Advanced", DlgOpOther : "<Other>", DlgInfoTab : "Info", DlgAlertUrl : "Please insert the URL", // General Dialogs Labels DlgGenNotSet : "<not set>", DlgGenId : "Id", DlgGenLangDir : "Language Direction", DlgGenLangDirLtr : "Left to Right (LTR)", DlgGenLangDirRtl : "Right to Left (RTL)", DlgGenLangCode : "Language Code", DlgGenAccessKey : "Access Key", DlgGenName : "Name", DlgGenTabIndex : "Tab Index", DlgGenLongDescr : "Long Description URL", DlgGenClass : "Stylesheet Classes", DlgGenTitle : "Advisory Title", DlgGenContType : "Advisory Content Type", DlgGenLinkCharset : "Linked Resource Charset", DlgGenStyle : "Style", // Image Dialog DlgImgTitle : "Image Properties", DlgImgInfoTab : "Image Info", DlgImgBtnUpload : "Send it to the Server", DlgImgURL : "URL", DlgImgUpload : "Upload", DlgImgAlt : "Alternative Text", DlgImgWidth : "Width", DlgImgHeight : "Height", DlgImgLockRatio : "Lock Ratio", DlgBtnResetSize : "Reset Size", DlgImgBorder : "Border", DlgImgHSpace : "HSpace", DlgImgVSpace : "VSpace", DlgImgAlign : "Align", DlgImgAlignLeft : "Left", DlgImgAlignAbsBottom: "Abs Bottom", DlgImgAlignAbsMiddle: "Abs Middle", DlgImgAlignBaseline : "Baseline", DlgImgAlignBottom : "Bottom", DlgImgAlignMiddle : "Middle", DlgImgAlignRight : "Right", DlgImgAlignTextTop : "Text Top", DlgImgAlignTop : "Top", DlgImgPreview : "Preview", DlgImgAlertUrl : "Please type the image URL", DlgImgLinkTab : "Link", // Flash Dialog DlgFlashTitle : "Flash Properties", DlgFlashChkPlay : "Auto Play", DlgFlashChkLoop : "Loop", DlgFlashChkMenu : "Enable Flash Menu", DlgFlashScale : "Scale", DlgFlashScaleAll : "Show all", DlgFlashScaleNoBorder : "No Border", DlgFlashScaleFit : "Exact Fit", // Link Dialog DlgLnkWindowTitle : "Link", DlgLnkInfoTab : "Link Info", DlgLnkTargetTab : "Target", DlgLnkType : "Link Type", DlgLnkTypeURL : "URL", DlgLnkTypeAnchor : "Anchor in this page", DlgLnkTypeEMail : "E-Mail", DlgLnkProto : "Protocol", DlgLnkProtoOther : "<other>", DlgLnkURL : "URL", DlgLnkAnchorSel : "Select an Anchor", DlgLnkAnchorByName : "By Anchor Name", DlgLnkAnchorById : "By Element Id", DlgLnkNoAnchors : "<No anchors available in the document>", DlgLnkEMail : "E-Mail Address", DlgLnkEMailSubject : "Message Subject", DlgLnkEMailBody : "Message Body", DlgLnkUpload : "Upload", DlgLnkBtnUpload : "Send it to the Server", DlgLnkTarget : "Target", DlgLnkTargetFrame : "<frame>", DlgLnkTargetPopup : "<popup window>", DlgLnkTargetBlank : "New Window (_blank)", DlgLnkTargetParent : "Parent Window (_parent)", DlgLnkTargetSelf : "Same Window (_self)", DlgLnkTargetTop : "Topmost Window (_top)", DlgLnkTargetFrameName : "Target Frame Name", DlgLnkPopWinName : "Popup Window Name", DlgLnkPopWinFeat : "Popup Window Features", DlgLnkPopResize : "Resizable", DlgLnkPopLocation : "Location Bar", DlgLnkPopMenu : "Menu Bar", DlgLnkPopScroll : "Scroll Bars", DlgLnkPopStatus : "Status Bar", DlgLnkPopToolbar : "Toolbar", DlgLnkPopFullScrn : "Full Screen (IE)", DlgLnkPopDependent : "Dependent (Netscape)", DlgLnkPopWidth : "Width", DlgLnkPopHeight : "Height", DlgLnkPopLeft : "Left Position", DlgLnkPopTop : "Top Position", DlnLnkMsgNoUrl : "Please type the link URL", DlnLnkMsgNoEMail : "Please type the e-mail address", DlnLnkMsgNoAnchor : "Please select an anchor", // Color Dialog DlgColorTitle : "Select Color", DlgColorBtnClear : "Clear", DlgColorHighlight : "Highlight", DlgColorSelected : "Selected", // Smiley Dialog DlgSmileyTitle : "Insert a Smiley", // Special Character Dialog DlgSpecialCharTitle : "Select Special Character", // Table Dialog DlgTableTitle : "Table Properties", DlgTableRows : "Rows", DlgTableColumns : "Columns", DlgTableBorder : "Border size", DlgTableAlign : "Alignment", DlgTableAlignNotSet : "<Not set>", DlgTableAlignLeft : "Left", DlgTableAlignCenter : "Center", DlgTableAlignRight : "Right", DlgTableWidth : "Width", DlgTableWidthPx : "pixels", DlgTableWidthPc : "percent", DlgTableHeight : "Height", DlgTableCellSpace : "Cell spacing", DlgTableCellPad : "Cell padding", DlgTableCaption : "Caption", DlgTableSummary : "Summary", // Table Cell Dialog DlgCellTitle : "Cell Properties", DlgCellWidth : "Width", DlgCellWidthPx : "pixels", DlgCellWidthPc : "percent", DlgCellHeight : "Height", DlgCellWordWrap : "Word Wrap", DlgCellWordWrapNotSet : "<Not set>", DlgCellWordWrapYes : "Yes", DlgCellWordWrapNo : "No", DlgCellHorAlign : "Horizontal Alignment", DlgCellHorAlignNotSet : "<Not set>", DlgCellHorAlignLeft : "Left", DlgCellHorAlignCenter : "Center", DlgCellHorAlignRight: "Right", DlgCellVerAlign : "Vertical Alignment", DlgCellVerAlignNotSet : "<Not set>", DlgCellVerAlignTop : "Top", DlgCellVerAlignMiddle : "Middle", DlgCellVerAlignBottom : "Bottom", DlgCellVerAlignBaseline : "Baseline", DlgCellRowSpan : "Rows Span", DlgCellCollSpan : "Columns Span", DlgCellBackColor : "Background Color", DlgCellBorderColor : "Border Color", DlgCellBtnSelect : "Select...", // Find Dialog DlgFindTitle : "Find", DlgFindFindBtn : "Find", DlgFindNotFoundMsg : "The specified text was not found.", // Replace Dialog DlgReplaceTitle : "Replace", DlgReplaceFindLbl : "Find what:", DlgReplaceReplaceLbl : "Replace with:", DlgReplaceCaseChk : "Match case", DlgReplaceReplaceBtn : "Replace", DlgReplaceReplAllBtn : "Replace All", DlgReplaceWordChk : "Match whole word", // Paste Operations / Dialog PasteErrorPaste : "Your browser security settings don't permit the editor to automatically execute pasting operations. Please use the keyboard for that (Ctrl+V).", PasteErrorCut : "Your browser security settings don't permit the editor to automatically execute cutting operations. Please use the keyboard for that (Ctrl+X).", PasteErrorCopy : "Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl+C).", PasteAsText : "Paste as Plain Text", PasteFromWord : "Paste from Word", DlgPasteMsg2 : "Please paste inside the following box using the keyboard (<STRONG>Ctrl+V</STRONG>) and hit <STRONG>OK</STRONG>.", DlgPasteIgnoreFont : "Ignore Font Face definitions", DlgPasteRemoveStyles : "Remove Styles definitions", DlgPasteCleanBox : "Clean Up Box", // Color Picker ColorAutomatic : "Automatic", ColorMoreColors : "More Colors...", // Document Properties DocProps : "Document Properties", // Anchor Dialog DlgAnchorTitle : "Anchor Properties", DlgAnchorName : "Anchor Name", DlgAnchorErrorName : "Please type the anchor name", // Speller Pages Dialog DlgSpellNotInDic : "Not in dictionary", DlgSpellChangeTo : "Change to", DlgSpellBtnIgnore : "Ignore", DlgSpellBtnIgnoreAll : "Ignore All", DlgSpellBtnReplace : "Replace", DlgSpellBtnReplaceAll : "Replace All", DlgSpellBtnUndo : "Undo", DlgSpellNoSuggestions : "- No suggestions -", DlgSpellProgress : "Spell check in progress...", DlgSpellNoMispell : "Spell check complete: No misspellings found", DlgSpellNoChanges : "Spell check complete: No words changed", DlgSpellOneChange : "Spell check complete: One word changed", DlgSpellManyChanges : "Spell check complete: %1 words changed", IeSpellDownload : "Spell checker not installed. Do you want to download it now?", // Button Dialog DlgButtonText : "Text (Value)", DlgButtonType : "Type", // Checkbox and Radio Button Dialogs DlgCheckboxName : "Name", DlgCheckboxValue : "Value", DlgCheckboxSelected : "Selected", // Form Dialog DlgFormName : "Name", DlgFormAction : "Action", DlgFormMethod : "Method", // Select Field Dialog DlgSelectName : "Name", DlgSelectValue : "Value", DlgSelectSize : "Size", DlgSelectLines : "lines", DlgSelectChkMulti : "Allow multiple selections", DlgSelectOpAvail : "Available Options", DlgSelectOpText : "Text", DlgSelectOpValue : "Value", DlgSelectBtnAdd : "Add", DlgSelectBtnModify : "Modify", DlgSelectBtnUp : "Up", DlgSelectBtnDown : "Down", DlgSelectBtnSetValue : "Set as selected value", DlgSelectBtnDelete : "Delete", // Textarea Dialog DlgTextareaName : "Name", DlgTextareaCols : "Columns", DlgTextareaRows : "Rows", // Text Field Dialog DlgTextName : "Name", DlgTextValue : "Value", DlgTextCharWidth : "Character Width", DlgTextMaxChars : "Maximum Characters", DlgTextType : "Type", DlgTextTypeText : "Text", DlgTextTypePass : "Password", // Hidden Field Dialog DlgHiddenName : "Name", DlgHiddenValue : "Value", // Bulleted List Dialog BulletedListProp : "Bulleted List Properties", NumberedListProp : "Numbered List Properties", DlgLstType : "Type", DlgLstTypeCircle : "Circle", DlgLstTypeDisc : "Disc", DlgLstTypeSquare : "Square", DlgLstTypeNumbers : "Numbers (1, 2, 3)", DlgLstTypeLCase : "Lowercase Letters (a, b, c)", DlgLstTypeUCase : "Uppercase Letters (A, B, C)", DlgLstTypeSRoman : "Small Roman Numerals (i, ii, iii)", DlgLstTypeLRoman : "Large Roman Numerals (I, II, III)", // Document Properties Dialog DlgDocGeneralTab : "General", DlgDocBackTab : "Background", DlgDocColorsTab : "Colors and Margins", DlgDocMetaTab : "Meta Data", DlgDocPageTitle : "Page Title", DlgDocLangDir : "Language Direction", DlgDocLangDirLTR : "Left to Right (LTR)", DlgDocLangDirRTL : "Right to Left (RTL)", DlgDocLangCode : "Language Code", DlgDocCharSet : "Character Set Encoding", DlgDocCharSetOther : "Other Character Set Encoding", DlgDocDocType : "Document Type Heading", DlgDocDocTypeOther : "Other Document Type Heading", DlgDocIncXHTML : "Include XHTML Declarations", DlgDocBgColor : "Background Color", DlgDocBgImage : "Background Image URL", DlgDocBgNoScroll : "Nonscrolling Background", DlgDocCText : "Text", DlgDocCLink : "Link", DlgDocCVisited : "Visited Link", DlgDocCActive : "Active Link", DlgDocMargins : "Page Margins", DlgDocMaTop : "Top", DlgDocMaLeft : "Left", DlgDocMaRight : "Right", DlgDocMaBottom : "Bottom", DlgDocMeIndex : "Document Indexing Keywords (comma separated)", DlgDocMeDescr : "Document Description", DlgDocMeAuthor : "Author", DlgDocMeCopy : "Copyright", DlgDocPreview : "Preview", // Templates Dialog Templates : "Templates", DlgTemplatesTitle : "Content Templates", DlgTemplatesSelMsg : "Please select the template to open in the editor<br>(the actual contents will be lost):", DlgTemplatesLoading : "Loading templates list. Please wait...", DlgTemplatesNoTpl : "(No templates defined)", // About Dialog DlgAboutAboutTab : "About", DlgAboutBrowserInfoTab : "Browser Info", DlgAboutLicenseTab : "License", DlgAboutVersion : "version", DlgAboutLicense : "Licensed under the terms of the GNU Lesser General Public License", DlgAboutInfo : "For further information go to" }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: fck_select.js * Scripts for the fck_select.html page. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ function Select( combo ) { var iIndex = combo.selectedIndex ; oListText.selectedIndex = iIndex ; oListValue.selectedIndex = iIndex ; var oTxtText = document.getElementById( "txtText" ) ; var oTxtValue = document.getElementById( "txtValue" ) ; oTxtText.value = oListText.value ; oTxtValue.value = oListValue.value ; } function Add() { var oTxtText = document.getElementById( "txtText" ) ; var oTxtValue = document.getElementById( "txtValue" ) ; AddComboOption( oListText, oTxtText.value, oTxtText.value ) ; AddComboOption( oListValue, oTxtValue.value, oTxtValue.value ) ; oListText.selectedIndex = oListText.options.length - 1 ; oListValue.selectedIndex = oListValue.options.length - 1 ; oTxtText.value = '' ; oTxtValue.value = '' ; oTxtText.focus() ; } function Modify() { var iIndex = oListText.selectedIndex ; if ( iIndex < 0 ) return ; var oTxtText = document.getElementById( "txtText" ) ; var oTxtValue = document.getElementById( "txtValue" ) ; oListText.options[ iIndex ].innerHTML = oTxtText.value ; oListText.options[ iIndex ].value = oTxtText.value ; oListValue.options[ iIndex ].innerHTML = oTxtValue.value ; oListValue.options[ iIndex ].value = oTxtValue.value ; oTxtText.value = '' ; oTxtValue.value = '' ; oTxtText.focus() ; } function Move( steps ) { ChangeOptionPosition( oListText, steps ) ; ChangeOptionPosition( oListValue, steps ) ; } function Delete() { RemoveSelectedOptions( oListText ) ; RemoveSelectedOptions( oListValue ) ; } function SetSelectedValue() { var iIndex = oListValue.selectedIndex ; if ( iIndex < 0 ) return ; var oTxtValue = document.getElementById( "txtSelValue" ) ; oTxtValue.value = oListValue.options[ iIndex ].value ; } // Moves the selected option by a number of steps (also negative) function ChangeOptionPosition( combo, steps ) { var iActualIndex = combo.selectedIndex ; if ( iActualIndex < 0 ) return ; var iFinalIndex = iActualIndex + steps ; if ( iFinalIndex < 0 ) iFinalIndex = 0 ; if ( iFinalIndex > ( combo.options.length - 1 ) ) iFinalIndex = combo.options.length - 1 ; if ( iActualIndex == iFinalIndex ) return ; var oOption = combo.options[ iActualIndex ] ; var sText = oOption.innerHTML ; var sValue = oOption.value ; combo.remove( iActualIndex ) ; oOption = AddComboOption( combo, sText, sValue, null, iFinalIndex ) ; oOption.selected = true ; } // Remove all selected options from a SELECT object function RemoveSelectedOptions(combo) { // Save the selected index var iSelectedIndex = combo.selectedIndex ; var oOptions = combo.options ; // Remove all selected options for ( var i = oOptions.length - 1 ; i >= 0 ; i-- ) { if (oOptions[i].selected) combo.remove(i) ; } // Reset the selection based on the original selected index if ( combo.options.length > 0 ) { if ( iSelectedIndex >= combo.options.length ) iSelectedIndex = combo.options.length - 1 ; combo.selectedIndex = iSelectedIndex ; } } // Add a new option to a SELECT object (combo or list) function AddComboOption( combo, optionText, optionValue, documentObject, index ) { var oOption ; if ( documentObject ) oOption = documentObject.createElement("OPTION") ; else oOption = document.createElement("OPTION") ; if ( index != null ) combo.options.add( oOption, index ) ; else combo.options.add( oOption ) ; oOption.innerHTML = optionText.length > 0 ? optionText : '&nbsp;' ; oOption.value = optionValue ; return oOption ; }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: dialogue.js * Scripts for the fck_universalkey.html page. * * File Authors: * Michel Staelens (michel.staelens@wanadoo.fr) * Bernadette Cierzniak * Abdul-Aziz Al-Oraij (top7up@hotmail.com) * Frederico Caldeira Knabben (fredck@fckeditor.net) */ function afficher(txt) { document.getElementById( 'uni_area' ).value = txt ; } function rechercher() { return document.getElementById( 'uni_area' ).value ; }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: diacritic.js * Scripts for the fck_universalkey.html page. * * File Authors: * Michel Staelens (michel.staelens@wanadoo.fr) * Abdul-Aziz Al-Oraij (top7up@hotmail.com) */ var dia = new Array() dia["0060"]=new Array();dia["00B4"]=new Array();dia["005E"]=new Array();dia["00A8"]=new Array();dia["007E"]=new Array();dia["00B0"]=new Array();dia["00B7"]=new Array();dia["00B8"]=new Array();dia["00AF"]=new Array();dia["02D9"]=new Array();dia["02DB"]=new Array();dia["02C7"]=new Array();dia["02D8"]=new Array();dia["02DD"]=new Array();dia["031B"]=new Array(); dia["0060"]["0061"]="00E0";dia["00B4"]["0061"]="00E1";dia["005E"]["0061"]="00E2";dia["00A8"]["0061"]="00E4";dia["007E"]["0061"]="00E3";dia["00B0"]["0061"]="00E5";dia["00AF"]["0061"]="0101";dia["02DB"]["0061"]="0105";dia["02D8"]["0061"]="0103"; dia["00B4"]["0063"]="0107";dia["005E"]["0063"]="0109";dia["00B8"]["0063"]="00E7";dia["02D9"]["0063"]="010B";dia["02C7"]["0063"]="010D"; dia["02C7"]["0064"]="010F"; dia["0060"]["0065"]="00E8";dia["00B4"]["0065"]="00E9";dia["005E"]["0065"]="00EA";dia["00A8"]["0065"]="00EB";dia["00AF"]["0065"]="0113";dia["02D9"]["0065"]="0117";dia["02DB"]["0065"]="0119";dia["02C7"]["0065"]="011B";dia["02D8"]["0065"]="0115"; dia["005E"]["0067"]="011D";dia["00B8"]["0067"]="0123";dia["02D9"]["0067"]="0121";dia["02D8"]["0067"]="011F"; dia["005E"]["0068"]="0125"; dia["0060"]["0069"]="00EC";dia["00B4"]["0069"]="00ED";dia["005E"]["0069"]="00EE";dia["00A8"]["0069"]="00EF";dia["007E"]["0069"]="0129";dia["00AF"]["0069"]="012B";dia["02DB"]["0069"]="012F";dia["02D8"]["0069"]="012D"; dia["005E"]["006A"]="0135"; dia["00B8"]["006B"]="0137"; dia["00B4"]["006C"]="013A";dia["00B7"]["006C"]="0140";dia["00B8"]["006C"]="013C";dia["02C7"]["006C"]="013E"; dia["00B4"]["006E"]="0144";dia["007E"]["006E"]="00F1";dia["00B8"]["006E"]="0146";dia["02D8"]["006E"]="0148"; dia["0060"]["006F"]="00F2";dia["00B4"]["006F"]="00F3";dia["005E"]["006F"]="00F4";dia["00A8"]["006F"]="00F6";dia["007E"]["006F"]="00F5";dia["00AF"]["006F"]="014D";dia["02D8"]["006F"]="014F";dia["02DD"]["006F"]="0151";dia["031B"]["006F"]="01A1"; dia["00B4"]["0072"]="0155";dia["00B8"]["0072"]="0157";dia["02C7"]["0072"]="0159"; dia["00B4"]["0073"]="015B";dia["005E"]["0073"]="015D";dia["00B8"]["0073"]="015F";dia["02C7"]["0073"]="0161"; dia["00B8"]["0074"]="0163";dia["02C7"]["0074"]="0165"; dia["0060"]["0075"]="00F9";dia["00B4"]["0075"]="00FA";dia["005E"]["0075"]="00FB";dia["00A8"]["0075"]="00FC";dia["007E"]["0075"]="0169";dia["00B0"]["0075"]="016F";dia["00AF"]["0075"]="016B";dia["02DB"]["0075"]="0173";dia["02D8"]["0075"]="016D";dia["02DD"]["0075"]="0171";dia["031B"]["0075"]="01B0"; dia["005E"]["0077"]="0175"; dia["00B4"]["0079"]="00FD";dia["005E"]["0079"]="0177";dia["00A8"]["0079"]="00FF"; dia["00B4"]["007A"]="017A";dia["02D9"]["007A"]="017C";dia["02C7"]["007A"]="017E"; dia["00B4"]["00E6"]="01FD"; dia["00B4"]["00F8"]="01FF"; dia["0060"]["0041"]="00C0";dia["00B4"]["0041"]="00C1";dia["005E"]["0041"]="00C2";dia["00A8"]["0041"]="00C4";dia["007E"]["0041"]="00C3";dia["00B0"]["0041"]="00C5";dia["00AF"]["0041"]="0100";dia["02DB"]["0041"]="0104";dia["02D8"]["0041"]="0102"; dia["00B4"]["0043"]="0106";dia["005E"]["0043"]="0108";dia["00B8"]["0043"]="00C7";dia["02D9"]["0043"]="010A";dia["02C7"]["0043"]="010C"; dia["02C7"]["0044"]="010E"; dia["0060"]["0045"]="00C8";dia["00B4"]["0045"]="00C9";dia["005E"]["0045"]="00CA";dia["00A8"]["0045"]="00CB";dia["00AF"]["0045"]="0112";dia["02D9"]["0045"]="0116";dia["02DB"]["0045"]="0118";dia["02C7"]["0045"]="011A";dia["02D8"]["0045"]="0114"; dia["005E"]["0047"]="011C";dia["00B8"]["0047"]="0122";dia["02D9"]["0047"]="0120";dia["02D8"]["0047"]="011E"; dia["005E"]["0048"]="0124"; dia["0060"]["0049"]="00CC";dia["00B4"]["0049"]="00CD";dia["005E"]["0049"]="00CE";dia["00A8"]["0049"]="00CF";dia["007E"]["0049"]="0128";dia["00AF"]["0049"]="012A";dia["02D9"]["0049"]="0130";dia["02DB"]["0049"]="012E";dia["02D8"]["0049"]="012C"; dia["005E"]["004A"]="0134"; dia["00B8"]["004B"]="0136"; dia["00B4"]["004C"]="0139";dia["00B7"]["004C"]="013F";dia["00B8"]["004C"]="013B";dia["02C7"]["004C"]="013D"; dia["00B4"]["004E"]="0143";dia["007E"]["004E"]="00D1";dia["00B8"]["004E"]="0145";dia["02D8"]["004E"]="0147"; dia["0060"]["004F"]="00D2";dia["00B4"]["004F"]="00D3";dia["005E"]["004F"]="00D4";dia["00A8"]["004F"]="00D6";dia["007E"]["004F"]="00D5";dia["00AF"]["004F"]="014C";dia["02D8"]["004F"]="014E";dia["02DD"]["004F"]="0150";dia["031B"]["004F"]="01A0"; dia["00B4"]["0052"]="0154";dia["00B8"]["0052"]="0156";dia["02C7"]["0052"]="0158"; dia["00B4"]["0053"]="015A";dia["005E"]["0053"]="015C";dia["00B8"]["0053"]="015E";dia["02C7"]["0053"]="0160"; dia["00B8"]["0054"]="0162";dia["02C7"]["0054"]="0164"; dia["0060"]["0055"]="00D9";dia["00B4"]["0055"]="00DA";dia["005E"]["0055"]="00DB";dia["00A8"]["0055"]="00DC";dia["007E"]["0055"]="0168";dia["00B0"]["0055"]="016E";dia["00AF"]["0055"]="016A";dia["02DB"]["0055"]="0172";dia["02D8"]["0055"]="016C";dia["02DD"]["0055"]="0170";dia["031B"]["0055"]="01AF"; dia["005E"]["0057"]="0174"; dia["00B4"]["0059"]="00DD";dia["005E"]["0059"]="0176";dia["00A8"]["0059"]="0178"; dia["00B4"]["005A"]="0179";dia["02D9"]["005A"]="017B";dia["02C7"]["005A"]="017D"; dia["00B4"]["00C6"]="01FC"; dia["00B4"]["00D8"]="01FE";
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: multihexa.js * Scripts for the fck_universalkey.html page. * Definition des 104 caracteres en hexa unicode. * * File Authors: * Michel Staelens (michel.staelens@wanadoo.fr) * Bernadette Cierzniak * Abdul-Aziz Al-Oraij (top7up@hotmail.com) */ var caps=0, lock=0, hexchars="0123456789ABCDEF", accent="0000", keydeb=0 var key=new Array();j=0;for (i in Maj){key[j]=i;j++} var ns6=((!document.all)&&(document.getElementById)) var ie=document.all var langue=getCk(); if (langue==""){ langue=key[keydeb] } CarMaj=Maj[langue].split("|");CarMin=Min[langue].split("|") /*unikey*/ var posUniKeyLeft=0, posUniKeyTop=0 if (ns6){posUniKeyLeft=0;posUniKeyTop=60} else if (ie){posUniKeyLeft=0;posUniKeyTop=60} tracer("fond",posUniKeyLeft,posUniKeyTop,'<img src="fck_universalkey/keyboard_layout.gif" width=404 height=152 border="0"><br />',"sign") /*touches*/ var posX=new Array(0,28,56,84,112,140,168,196,224,252,280,308,336,42,70,98,126,154,182,210,238,266,294,322,350,50,78,106,134,162,190,218,246,274,302,330,64,92,120,148,176,204,232,260,288,316,28,56,84,294,322,350) var posY=new Array(14,14,14,14,14,14,14,14,14,14,14,14,14,42,42,42,42,42,42,42,42,42,42,42,42,70,70,70,70,70,70,70,70,70,70,70,98,98,98,98,98,98,98,98,98,98,126,126,126,126,126,126) var nbTouches=52 for (i=0;i<nbTouches;i++){ CarMaj[i]=((CarMaj[i]!="0000")?(fromhexby4tocar(CarMaj[i])):"") CarMin[i]=((CarMin[i]!="0000")?(fromhexby4tocar(CarMin[i])):"") if (CarMaj[i]==CarMin[i].toUpperCase()){ cecar=((lock==0)&&(caps==0)?CarMin[i]:CarMaj[i]) tracer("car"+i,posUniKeyLeft+6+posX[i],posUniKeyTop+3+posY[i],cecar,((dia[hexa(cecar)]!=null)?"simpledia":"simple")) tracer("majus"+i,posUniKeyLeft+15+posX[i],posUniKeyTop+1+posY[i],"&nbsp;","double") tracer("minus"+i,posUniKeyLeft+3+posX[i],posUniKeyTop+9+posY[i],"&nbsp;","double") } else{ tracer("car"+i,posUniKeyLeft+6+posX[i],posUniKeyTop+3+posY[i],"&nbsp;","simple") cecar=CarMin[i] tracer("minus"+i,posUniKeyLeft+3+posX[i],posUniKeyTop+9+posY[i],cecar,((dia[hexa(cecar)]!=null)?"doubledia":"double")) cecar=CarMaj[i] tracer("majus"+i,posUniKeyLeft+15+posX[i],posUniKeyTop+1+posY[i],cecar,((dia[hexa(cecar)]!=null)?"doubledia":"double")) } } /*touches de fonctions*/ var actC1=new Array(0,371,364,0,378,0,358,0,344,0,112,378) var actC2=new Array(0,0,14,42,42,70,70,98,98,126,126,126) var actC3=new Array(32,403,403,39,403,47,403,61,403,25,291,403) var actC4=new Array(11,11,39,67,67,95,95,123,123,151,151,151) var act =new Array(" « KB"," KB » ","Delete","Clear","Back","Caps<br> Lock","Enter","Shift","Shift","<|<","Space",">|>") var effet=new Array("keyscroll(-3)","keyscroll(3)","faire(\"del\")","RAZ()","faire(\"bck\")","bloq()","faire(\"\\n\")","haut()","haut()","faire(\"ar\")","faire(\" \")","faire(\"av\")") var nbActions=12 for (i=0;i<nbActions;i++){ tracer("act"+i,posUniKeyLeft+1+actC1[i],posUniKeyTop-1+actC2[i],act[i],"action") } /*navigation*/ var keyC1=new Array(35,119,203,287) var keyC2=new Array(0,0,0,0) var keyC3=new Array(116,200,284,368) var keyC4=new Array(11,11,11,11) for (i=0;i<4;i++){ tracer("key"+i,posUniKeyLeft+5+keyC1[i],posUniKeyTop-1+keyC2[i],key[i],"unikey") } /*zones reactives*/ tracer("masque",posUniKeyLeft,posUniKeyTop,'<img src="fck_universalkey/00.gif" width=404 height=152 border="0" usemap="#unikey">') document.write('<map name="unikey">') for (i=0;i<nbTouches;i++){ document.write('<area coords="'+posX[i]+','+posY[i]+','+(posX[i]+25)+','+(posY[i]+25)+'" href=# onClick=\'javascript:ecrire('+i+')\'>') } for (i=0;i<nbActions;i++){ document.write('<area coords="'+actC1[i]+','+actC2[i]+','+actC3[i]+','+actC4[i]+'" href=# onClick=\'javascript:'+effet[i]+'\'>') } for (i=0;i<4;i++){ document.write('<area coords="'+keyC1[i]+','+keyC2[i]+','+keyC3[i]+','+keyC4[i]+'" onclick=\'javascript:charger('+i+')\'>') } document.write('</map>') /*fonctions*/ function ecrire(i){ txt=rechercher()+"|";subtxt=txt.split("|") ceci=(lock==1)?CarMaj[i]:((caps==1)?CarMaj[i]:CarMin[i]) if (test(ceci)){subtxt[0]+=cardia(ceci);distinguer(false)} else if(dia[accent]!=null&&dia[hexa(ceci)]!=null){distinguer(false);accent=hexa(ceci);distinguer(true)} else if(dia[accent]!=null){subtxt[0]+=fromhexby4tocar(accent)+ceci;distinguer(false)} else if(dia[hexa(ceci)]!=null){accent=hexa(ceci);distinguer(true)} else {subtxt[0]+=ceci} txt=subtxt[0]+"|"+subtxt[1] afficher(txt) if (caps==1){caps=0;MinusMajus()} } function faire(ceci){ txt=rechercher()+"|";subtxt=txt.split("|") l0=subtxt[0].length l1=subtxt[1].length c1=subtxt[0].substring(0,(l0-2)) c2=subtxt[0].substring(0,(l0-1)) c3=subtxt[1].substring(0,1) c4=subtxt[1].substring(0,2) c5=subtxt[0].substring((l0-2),l0) c6=subtxt[0].substring((l0-1),l0) c7=subtxt[1].substring(1,l1) c8=subtxt[1].substring(2,l1) if(dia[accent]!=null){if(ceci==" "){ceci=fromhexby4tocar(accent)}distinguer(false)} switch (ceci){ case("av") :if(escape(c4)!="%0D%0A"){txt=subtxt[0]+c3+"|"+c7}else{txt=subtxt[0]+c4+"|"+c8}break case("ar") :if(escape(c5)!="%0D%0A"){txt=c2+"|"+c6+subtxt[1]}else{txt=c1+"|"+c5+subtxt[1]}break case("bck"):if(escape(c5)!="%0D%0A"){txt=c2+"|"+subtxt[1]}else{txt=c1+"|"+subtxt[1]}break case("del"):if(escape(c4)!="%0D%0A"){txt=subtxt[0]+"|"+c7}else{txt=subtxt[0]+"|"+c8}break default:txt=subtxt[0]+ceci+"|"+subtxt[1];break } afficher(txt) } function RAZ(){txt="";if(dia[accent]!=null){distinguer(false)}afficher(txt)} function haut(){caps=1;MinusMajus()} function bloq(){lock=(lock==1)?0:1;MinusMajus()} /*fonctions de traitement du unikey*/ function tracer(nom,gauche,haut,ceci,classe){ceci="<span class="+classe+">"+ceci+"</span>";document.write('<div id="'+nom+'" >'+ceci+'</div>');if (ns6){document.getElementById(nom).style.left=gauche+"px";document.getElementById(nom).style.top=haut+"px";}else if (ie){document.all(nom).style.left=gauche;document.all(nom).style.top=haut}} function retracer(nom,ceci,classe){ceci="<span class="+classe+">"+ceci+"</span>";if (ns6){document.getElementById(nom).innerHTML=ceci}else if (ie){doc=document.all(nom);doc.innerHTML=ceci}} function keyscroll(n){ keydeb+=n if (keydeb<0){ keydeb=0 } if (keydeb>key.length-4){ keydeb=key.length-4 } for (i=keydeb;i<keydeb+4;i++){ retracer("key"+(i-keydeb),key[i],"unikey") } if (keydeb==0){ retracer("act0","&nbsp;","action") }else { retracer("act0",act[0],"action") } if (keydeb==key.length-4){ retracer("act1","&nbsp;","action") }else { retracer("act1",act[1],"action") } } function charger(i){ langue=key[i+keydeb];setCk(langue);accent="0000" CarMaj=Maj[langue].split("|");CarMin=Min[langue].split("|") for (i=0;i<nbTouches;i++){ CarMaj[i]=((CarMaj[i]!="0000")?(fromhexby4tocar(CarMaj[i])):"") CarMin[i]=((CarMin[i]!="0000")?(fromhexby4tocar(CarMin[i])):"") if (CarMaj[i]==CarMin[i].toUpperCase()){ cecar=((lock==0)&&(caps==0)?CarMin[i]:CarMaj[i]) retracer("car"+i,cecar,((dia[hexa(cecar)]!=null)?"simpledia":"simple")) retracer("minus"+i,"&nbsp;") retracer("majus"+i,"&nbsp;") } else{ retracer("car"+i,"&nbsp;") cecar=CarMin[i] retracer("minus"+i,cecar,((dia[hexa(cecar)]!=null)?"doubledia":"double")) cecar=CarMaj[i] retracer("majus"+i,cecar,((dia[hexa(cecar)]!=null)?"doubledia":"double")) } } } function distinguer(oui){ for (i=0;i<nbTouches;i++){ if (CarMaj[i]==CarMin[i].toUpperCase()){ cecar=((lock==0)&&(caps==0)?CarMin[i]:CarMaj[i]) if(test(cecar)){retracer("car"+i,oui?(cardia(cecar)):cecar,oui?"simpledia":"simple")} } else{ cecar=CarMin[i] if(test(cecar)){retracer("minus"+i,oui?(cardia(cecar)):cecar,oui?"doubledia":"double")} cecar=CarMaj[i] if(test(cecar)){retracer("majus"+i,oui?(cardia(cecar)):cecar,oui?"doubledia":"double")} } } if (!oui){accent="0000"} } function MinusMajus(){ for (i=0;i<nbTouches;i++){ if (CarMaj[i]==CarMin[i].toUpperCase()){ cecar=((lock==0)&&(caps==0)?CarMin[i]:CarMaj[i]) retracer("car"+i,(test(cecar)?cardia(cecar):cecar),((dia[hexa(cecar)]!=null||test(cecar))?"simpledia":"simple")) } } } function test(cecar){return(dia[accent]!=null&&dia[accent][hexa(cecar)]!=null)} function cardia(cecar){return(fromhexby4tocar(dia[accent][hexa(cecar)]))} function fromhex(inval){out=0;for (a=inval.length-1;a>=0;a--){out+=Math.pow(16,inval.length-a-1)*hexchars.indexOf(inval.charAt(a))}return out} function fromhexby4tocar(ceci){out4=new String();for (l=0;l<ceci.length;l+=4){out4+=String.fromCharCode(fromhex(ceci.substring(l,l+4)))}return out4} function tohex(inval){return hexchars.charAt(inval/16)+hexchars.charAt(inval%16)} function tohex2(inval){return tohex(inval/256)+tohex(inval%256)} function hexa(ceci){out="";for (k=0;k<ceci.length;k++){out+=(tohex2(ceci.charCodeAt(k)))}return out} function getCk(){ fromN=document.cookie.indexOf("langue=")+0; if((fromN)!=-1){ fromN+=7; toN=document.cookie.indexOf(";",fromN)+0; if(toN==-1){ toN=document.cookie.length } return unescape(document.cookie.substring(fromN,toN)) } return "" } function setCk(inval){ if(inval!=null){ exp=new Date(); time=365*60*60*24*1000; exp.setTime(exp.getTime()+time); document.cookie=escape("langue")+"="+escape(inval)+"; "+"expires="+exp.toGMTString() } } // Arabic Keystroke Translator function arkey(e) { if ((document.layers)|(navigator.userAgent.indexOf("MSIE 4")>-1)|(langue!="Arabic")) return true; if (!e) var e = window.event; if (e.keyCode) keyCode = e.keyCode; else if (e.which) keyCode = e.which; var character = String.fromCharCode(keyCode); entry = true; cont=e.srcElement || e.currentTarget || e.target; if (keyCode>64 && keyCode<91) { entry=false; source='ش لاؤ ي ث ب ل ا ه ت ن م ة ى خ ح ض ق س ف ع ر ص ء غ ئ '; shsource='ِ لآ} ] ُ [ لأأ ÷ ـ ، / آ × ؛ َ ٌ ٍ لإ { ً ْ إ ~'; if (e.shiftKey) cont.value += shsource.substr((keyCode-64)*2-2,2); else cont.value += source.substr((keyCode-64)*2-2,2); if (cont.value.substr(cont.value.length-1,1)==' ') cont.value=cont.value.substr(0,cont.value.length-1); } if (e.shiftKey) { if (keyCode==186) {cont.value += ':';entry=false;} if (keyCode==188) {cont.value += ',';entry=false;} if (keyCode==190) {cont.value += '.';entry=false;} if (keyCode==191) {cont.value += '؟';entry=false;} if (keyCode==192) {cont.value += 'ّ';entry=false;} if (keyCode==219) {cont.value += '<';entry=false;} if (keyCode==221) {cont.value += '>';entry=false;} } else { if (keyCode==186||keyCode==59) {cont.value += 'ك';entry=false;} if (keyCode==188) {cont.value += 'و';entry=false;} if (keyCode==190) {cont.value += 'ز';entry=false;} if (keyCode==191) {cont.value += 'ظ';entry=false;} if (keyCode==192) {cont.value += 'ذ';entry=false;} if (keyCode==219) {cont.value += 'ج';entry=false;} if (keyCode==221) {cont.value += 'د';entry=false;} if (keyCode==222) {cont.value += 'ط';entry=false;} } return entry; } function hold_it(e){ if ((document.layers)|(navigator.userAgent.indexOf("MSIE 4")>-1)|(langue!="Arabic")) return true; var keyCode; if (!e) var e = window.event; if (e.keyCode) keyCode = e.keyCode; else if (e.which) keyCode = e.which; var character = String.fromCharCode(keyCode); switch(keyCode){ case 186: case 188: case 190: case 191: case 192: case 219: case 221: case 222: case 116: case 59: case 47: case 46: case 44: case 39: return false; case 92: return true; } if (keyCode<63) return true; return false; } var obj = document.getElementById( 'uni_area' ); if ( obj && langue=="Arabic"){ with (navigator) { if (appName=="Netscape") obj.onkeypress = hold_it; } obj.onkeydown = arkey; } // Arabic Keystroke Translator End
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: fck_flash.js * Scripts related to the Flash dialog window (see fck_flash.html). * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ var oEditor = window.parent.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; //#### Dialog Tabs // Set the dialog tabs. window.parent.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ; if ( FCKConfig.FlashUpload ) window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; if ( !FCKConfig.FlashDlgHideAdvanced ) window.parent.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; } // Get the selected flash embed (if available). var oFakeImage = FCK.Selection.GetSelectedElement() ; var oEmbed ; if ( oFakeImage ) { if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckflash') ) oEmbed = FCK.GetRealElement( oFakeImage ) ; else oFakeImage = null ; } window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; // Load the selected element information (if any). LoadSelection() ; // Show/Hide the "Browse Server" button. GetE('tdBrowse').style.display = FCKConfig.FlashBrowser ? '' : 'none' ; // Set the actual uploader URL. if ( FCKConfig.FlashUpload ) GetE('frmUpload').action = FCKConfig.FlashUploadURL ; window.parent.SetAutoSize( true ) ; // Activate the "OK" button. window.parent.SetOkButton( true ) ; } function LoadSelection() { if ( ! oEmbed ) return ; var sUrl = GetAttribute( oEmbed, 'src', '' ) ; GetE('txtUrl').value = GetAttribute( oEmbed, 'src', '' ) ; GetE('txtWidth').value = GetAttribute( oEmbed, 'width', '' ) ; GetE('txtHeight').value = GetAttribute( oEmbed, 'height', '' ) ; // Get Advances Attributes GetE('txtAttId').value = oEmbed.id ; GetE('chkAutoPlay').checked = GetAttribute( oEmbed, 'play', 'true' ) == 'true' ; GetE('chkLoop').checked = GetAttribute( oEmbed, 'loop', 'true' ) == 'true' ; GetE('chkMenu').checked = GetAttribute( oEmbed, 'menu', 'true' ) == 'true' ; GetE('cmbScale').value = GetAttribute( oEmbed, 'scale', '' ).toLowerCase() ; GetE('txtAttTitle').value = oEmbed.title ; if ( oEditor.FCKBrowserInfo.IsIE ) { GetE('txtAttClasses').value = oEmbed.getAttribute('className') || '' ; GetE('txtAttStyle').value = oEmbed.style.cssText ; } else { GetE('txtAttClasses').value = oEmbed.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) ; } UpdatePreview() ; } //#### The OK button was hit. function Ok() { if ( GetE('txtUrl').value.length == 0 ) { window.parent.SetSelectedTab( 'Info' ) ; GetE('txtUrl').focus() ; alert( oEditor.FCKLang.DlgAlertUrl ) ; return false ; } if ( !oEmbed ) { oEmbed = FCK.EditorDocument.createElement( 'EMBED' ) ; oFakeImage = null ; } UpdateEmbed( oEmbed ) ; if ( !oFakeImage ) { oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ; oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ; oFakeImage = FCK.InsertElementAndGetIt( oFakeImage ) ; } else oEditor.FCKUndo.SaveUndoStep() ; oEditor.FCKFlashProcessor.RefreshView( oFakeImage, oEmbed ) ; return true ; } function UpdateEmbed( e ) { SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ; SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ; e.src = GetE('txtUrl').value ; SetAttribute( e, "width" , GetE('txtWidth').value ) ; SetAttribute( e, "height", GetE('txtHeight').value ) ; // Advances Attributes SetAttribute( e, 'id' , GetE('txtAttId').value ) ; SetAttribute( e, 'scale', GetE('cmbScale').value ) ; SetAttribute( e, 'play', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ; SetAttribute( e, 'loop', GetE('chkLoop').checked ? 'true' : 'false' ) ; SetAttribute( e, 'menu', GetE('chkMenu').checked ? 'true' : 'false' ) ; SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { SetAttribute( e, 'className', GetE('txtAttClasses').value ) ; e.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( e, 'class', GetE('txtAttClasses').value ) ; SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; } } var ePreview ; function SetPreviewElement( previewEl ) { ePreview = previewEl ; if ( GetE('txtUrl').value.length > 0 ) UpdatePreview() ; } function UpdatePreview() { if ( !ePreview ) return ; while ( ePreview.firstChild ) ePreview.removeChild( ePreview.firstChild ) ; if ( GetE('txtUrl').value.length == 0 ) ePreview.innerHTML = '&nbsp;' ; else { var oDoc = ePreview.ownerDocument || ePreview.document ; var e = oDoc.createElement( 'EMBED' ) ; e.src = GetE('txtUrl').value ; e.type = 'application/x-shockwave-flash' ; e.width = '100%' ; e.height = '100%' ; ePreview.appendChild( e ) ; } } // <embed id="ePreview" src="fck_flash/claims.swf" width="100%" height="100%" style="visibility:hidden" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> function BrowseServer() { OpenFileBrowser( FCKConfig.FlashBrowserURL, FCKConfig.FlashBrowserWindowWidth, FCKConfig.FlashBrowserWindowHeight ) ; } function SetUrl( url, width, height ) { GetE('txtUrl').value = url ; if ( width ) GetE('txtWidth').value = width ; if ( height ) GetE('txtHeight').value = height ; UpdatePreview() ; window.parent.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.FlashUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.FlashUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.FlashUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.FlashUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } return true ; }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: fck_image.js * Scripts related to the Image dialog window (see fck_image.html). * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ var oEditor = window.parent.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKDebug = oEditor.FCKDebug ; var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ; //#### Dialog Tabs // Set the dialog tabs. window.parent.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ; if ( !bImageButton && !FCKConfig.ImageDlgHideLink ) window.parent.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ; if ( FCKConfig.ImageUpload ) window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; if ( !FCKConfig.ImageDlgHideAdvanced ) window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divLink' , ( tabCode == 'Link' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; } // Get the selected image (if available). var oImage = FCK.Selection.GetSelectedElement() ; if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) ) oImage = null ; // Get the active link. var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; var oImageOriginal ; function UpdateOriginal( resetSize ) { if ( !eImgPreview ) return ; oImageOriginal = document.createElement( 'IMG' ) ; // new Image() ; if ( resetSize ) { oImageOriginal.onload = function() { this.onload = null ; ResetSizes() ; } } oImageOriginal.src = eImgPreview.src ; } var bPreviewInitialized ; window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; GetE('btnLockSizes').title = FCKLang.DlgImgLockRatio ; GetE('btnResetSize').title = FCKLang.DlgBtnResetSize ; // Load the selected element information (if any). LoadSelection() ; // Show/Hide the "Browse Server" button. GetE('tdBrowse').style.display = FCKConfig.ImageBrowser ? '' : 'none' ; GetE('divLnkBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; UpdateOriginal() ; // Set the actual uploader URL. if ( FCKConfig.ImageUpload ) GetE('frmUpload').action = FCKConfig.ImageUploadURL ; window.parent.SetAutoSize( true ) ; // Activate the "OK" button. window.parent.SetOkButton( true ) ; } function LoadSelection() { if ( ! oImage ) return ; var sUrl = GetAttribute( oImage, '_fcksavedurl', '' ) ; if ( sUrl.length == 0 ) sUrl = GetAttribute( oImage, 'src', '' ) ; // TODO: Wait stable version and remove the following commented lines. // if ( sUrl.startsWith( FCK.BaseUrl ) ) // sUrl = sUrl.remove( 0, FCK.BaseUrl.length ) ; GetE('txtUrl').value = sUrl ; GetE('txtAlt').value = GetAttribute( oImage, 'alt', '' ) ; GetE('txtVSpace').value = GetAttribute( oImage, 'vspace', '' ) ; GetE('txtHSpace').value = GetAttribute( oImage, 'hspace', '' ) ; GetE('txtBorder').value = GetAttribute( oImage, 'border', '' ) ; GetE('cmbAlign').value = GetAttribute( oImage, 'align', '' ) ; var iWidth, iHeight ; var regexSize = /^\s*(\d+)px\s*$/i ; if ( oImage.style.width ) { var aMatch = oImage.style.width.match( regexSize ) ; if ( aMatch ) { iWidth = aMatch[1] ; oImage.style.width = '' ; } } if ( oImage.style.height ) { var aMatch = oImage.style.height.match( regexSize ) ; if ( aMatch ) { iHeight = aMatch[1] ; oImage.style.height = '' ; } } GetE('txtWidth').value = iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ; GetE('txtHeight').value = iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ; // Get Advances Attributes GetE('txtAttId').value = oImage.id ; GetE('cmbAttLangDir').value = oImage.dir ; GetE('txtAttLangCode').value = oImage.lang ; GetE('txtAttTitle').value = oImage.title ; GetE('txtAttClasses').value = oImage.getAttribute('class',2) || '' ; GetE('txtLongDesc').value = oImage.longDesc ; if ( oEditor.FCKBrowserInfo.IsIE ) GetE('txtAttStyle').value = oImage.style.cssText ; else GetE('txtAttStyle').value = oImage.getAttribute('style',2) ; if ( oLink ) { var sUrl = GetAttribute( oLink, '_fcksavedurl', '' ) ; if ( sUrl.length == 0 ) sUrl = oLink.getAttribute('href',2) ; GetE('txtLnkUrl').value = sUrl ; GetE('cmbLnkTarget').value = oLink.target ; } UpdatePreview() ; } //#### The OK button was hit. function Ok() { if ( GetE('txtUrl').value.length == 0 ) { window.parent.SetSelectedTab( 'Info' ) ; GetE('txtUrl').focus() ; alert( FCKLang.DlgImgAlertUrl ) ; return false ; } var bHasImage = ( oImage != null ) ; if ( bHasImage && bImageButton && oImage.tagName == 'IMG' ) { if ( confirm( 'Do you want to transform the selected image on a image button?' ) ) oImage = null ; } else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' ) { if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) ) oImage = null ; } if ( !bHasImage ) { if ( bImageButton ) { oImage = FCK.EditorDocument.createElement( 'INPUT' ) ; oImage.type = 'image' ; oImage = FCK.InsertElementAndGetIt( oImage ) ; } else oImage = FCK.CreateElement( 'IMG' ) ; } else oEditor.FCKUndo.SaveUndoStep() ; UpdateImage( oImage ) ; var sLnkUrl = GetE('txtLnkUrl').value.trim() ; if ( sLnkUrl.length == 0 ) { if ( oLink ) FCK.ExecuteNamedCommand( 'Unlink' ) ; } else { if ( oLink ) // Modifying an existent link. oLink.href = sLnkUrl ; else // Creating a new link. { if ( !bHasImage ) oEditor.FCKSelection.SelectNode( oImage ) ; oLink = oEditor.FCK.CreateLink( sLnkUrl ) ; if ( !bHasImage ) { oEditor.FCKSelection.SelectNode( oLink ) ; oEditor.FCKSelection.Collapse( false ) ; } } SetAttribute( oLink, '_fcksavedurl', sLnkUrl ) ; SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ; } return true ; } function UpdateImage( e, skipId ) { e.src = GetE('txtUrl').value ; SetAttribute( e, "_fcksavedurl", GetE('txtUrl').value ) ; SetAttribute( e, "alt" , GetE('txtAlt').value ) ; SetAttribute( e, "width" , GetE('txtWidth').value ) ; SetAttribute( e, "height", GetE('txtHeight').value ) ; SetAttribute( e, "vspace", GetE('txtVSpace').value ) ; SetAttribute( e, "hspace", GetE('txtHSpace').value ) ; SetAttribute( e, "border", GetE('txtBorder').value ) ; SetAttribute( e, "align" , GetE('cmbAlign').value ) ; // Advances Attributes if ( ! skipId ) SetAttribute( e, 'id', GetE('txtAttId').value ) ; SetAttribute( e, 'dir' , GetE('cmbAttLangDir').value ) ; SetAttribute( e, 'lang' , GetE('txtAttLangCode').value ) ; SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; SetAttribute( e, 'class' , GetE('txtAttClasses').value ) ; SetAttribute( e, 'longDesc' , GetE('txtLongDesc').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) e.style.cssText = GetE('txtAttStyle').value ; else SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; } var eImgPreview ; var eImgPreviewLink ; function SetPreviewElements( imageElement, linkElement ) { eImgPreview = imageElement ; eImgPreviewLink = linkElement ; UpdatePreview() ; UpdateOriginal() ; bPreviewInitialized = true ; } function UpdatePreview() { if ( !eImgPreview || !eImgPreviewLink ) return ; if ( GetE('txtUrl').value.length == 0 ) eImgPreviewLink.style.display = 'none' ; else { UpdateImage( eImgPreview, true ) ; if ( GetE('txtLnkUrl').value.trim().length > 0 ) eImgPreviewLink.href = 'javascript:void(null);' ; else SetAttribute( eImgPreviewLink, 'href', '' ) ; eImgPreviewLink.style.display = '' ; } } var bLockRatio = true ; function SwitchLock( lockButton ) { bLockRatio = !bLockRatio ; lockButton.className = bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ; lockButton.title = bLockRatio ? 'Lock sizes' : 'Unlock sizes' ; if ( bLockRatio ) { if ( GetE('txtWidth').value.length > 0 ) OnSizeChanged( 'Width', GetE('txtWidth').value ) ; else OnSizeChanged( 'Height', GetE('txtHeight').value ) ; } } // Fired when the width or height input texts change function OnSizeChanged( dimension, value ) { // Verifies if the aspect ration has to be mantained if ( oImageOriginal && bLockRatio ) { var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ; if ( value.length == 0 || isNaN( value ) ) { e.value = '' ; return ; } if ( dimension == 'Width' ) value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value / oImageOriginal.width ) ) ; else value = value == 0 ? 0 : Math.round( oImageOriginal.width * ( value / oImageOriginal.height ) ) ; if ( !isNaN( value ) ) e.value = value ; } UpdatePreview() ; } // Fired when the Reset Size button is clicked function ResetSizes() { if ( ! oImageOriginal ) return ; GetE('txtWidth').value = oImageOriginal.width ; GetE('txtHeight').value = oImageOriginal.height ; UpdatePreview() ; } function BrowseServer() { OpenServerBrowser( 'Image', FCKConfig.ImageBrowserURL, FCKConfig.ImageBrowserWindowWidth, FCKConfig.ImageBrowserWindowHeight ) ; } function LnkBrowseServer() { OpenServerBrowser( 'Link', FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; } function OpenServerBrowser( type, url, width, height ) { sActualBrowser = type ; OpenFileBrowser( url, width, height ) ; } var sActualBrowser ; function SetUrl( url, width, height, alt ) { if ( sActualBrowser == 'Link' ) { GetE('txtLnkUrl').value = url ; UpdatePreview() ; } else { GetE('txtUrl').value = url ; GetE('txtWidth').value = width ? width : '' ; GetE('txtHeight').value = height ? height : '' ; if ( alt ) GetE('txtAlt').value = alt; UpdatePreview() ; UpdateOriginal( true ) ; } window.parent.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } sActualBrowser = '' SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.ImageUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.ImageUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.ImageUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.ImageUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } return true ; }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: fck_link.js * Scripts related to the Link dialog window (see fck_link.html). * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) * Dominik Pesch ?dom? (empty selection patch) (d.pesch@11com7.de) */ var oEditor = window.parent.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; //#### Dialog Tabs // Set the dialog tabs. window.parent.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ; if ( !FCKConfig.LinkDlgHideTarget ) window.parent.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ; if ( FCKConfig.LinkUpload ) window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ; if ( !FCKConfig.LinkDlgHideAdvanced ) window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divTarget' , ( tabCode == 'Target' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAttribs' , ( tabCode == 'Advanced' ) ) ; window.parent.SetAutoSize( true ) ; } //#### Regular Expressions library. var oRegex = new Object() ; oRegex.UriProtocol = new RegExp('') ; oRegex.UriProtocol.compile( '^(((http|https|ftp|news):\/\/)|mailto:)', 'gi' ) ; oRegex.UrlOnChangeProtocol = new RegExp('') ; oRegex.UrlOnChangeProtocol.compile( '^(http|https|ftp|news)://(?=.)', 'gi' ) ; oRegex.UrlOnChangeTestOther = new RegExp('') ; //oRegex.UrlOnChangeTestOther.compile( '^(javascript:|#|/)', 'gi' ) ; oRegex.UrlOnChangeTestOther.compile( '^((javascript:)|[#/\.])', 'gi' ) ; oRegex.ReserveTarget = new RegExp('') ; oRegex.ReserveTarget.compile( '^_(blank|self|top|parent)$', 'i' ) ; oRegex.PopupUri = new RegExp('') ; oRegex.PopupUri.compile( "^javascript:void\\(\\s*window.open\\(\\s*'([^']+)'\\s*,\\s*(?:'([^']*)'|null)\\s*,\\s*'([^']*)'\\s*\\)\\s*\\)\\s*$" ) ; oRegex.PopupFeatures = new RegExp('') ; oRegex.PopupFeatures.compile( '(?:^|,)([^=]+)=(\\d+|yes|no)', 'gi' ) ; //#### Parser Functions var oParser = new Object() ; oParser.ParseEMailUrl = function( emailUrl ) { // Initializes the EMailInfo object. var oEMailInfo = new Object() ; oEMailInfo.Address = '' ; oEMailInfo.Subject = '' ; oEMailInfo.Body = '' ; var oParts = emailUrl.match( /^([^\?]+)\??(.+)?/ ) ; if ( oParts ) { // Set the e-mail address. oEMailInfo.Address = oParts[1] ; // Look for the optional e-mail parameters. if ( oParts[2] ) { var oMatch = oParts[2].match( /(^|&)subject=([^&]+)/i ) ; if ( oMatch ) oEMailInfo.Subject = unescape( oMatch[2] ) ; oMatch = oParts[2].match( /(^|&)body=([^&]+)/i ) ; if ( oMatch ) oEMailInfo.Body = unescape( oMatch[2] ) ; } } return oEMailInfo ; } oParser.CreateEMailUri = function( address, subject, body ) { var sBaseUri = 'mailto:' + address ; var sParams = '' ; if ( subject.length > 0 ) sParams = '?subject=' + escape( subject ) ; if ( body.length > 0 ) { sParams += ( sParams.length == 0 ? '?' : '&' ) ; sParams += 'body=' + escape( body ) ; } return sBaseUri + sParams ; } //#### Initialization Code // oLink: The actual selected link in the editor. var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; if ( oLink ) FCK.Selection.SelectNode( oLink ) ; window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; // Fill the Anchor Names and Ids combos. LoadAnchorNamesAndIds() ; // Load the selected link information (if any). LoadSelection() ; // Update the dialog box. SetLinkType( GetE('cmbLinkType').value ) ; // Show/Hide the "Browse Server" button. GetE('divBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; // Show the initial dialog content. GetE('divInfo').style.display = '' ; // Set the actual uploader URL. if ( FCKConfig.LinkUpload ) GetE('frmUpload').action = FCKConfig.LinkUploadURL ; // Activate the "OK" button. window.parent.SetOkButton( true ) ; } var bHasAnchors ; function LoadAnchorNamesAndIds() { // Since version 2.0, the anchors are replaced in the DOM by IMGs so the user see the icon // to edit them. So, we must look for that images now. var aAnchors = new Array() ; var oImages = oEditor.FCK.EditorDocument.getElementsByTagName( 'IMG' ) ; for( var i = 0 ; i < oImages.length ; i++ ) { if ( oImages[i].getAttribute('_fckanchor') ) aAnchors[ aAnchors.length ] = oEditor.FCK.GetRealElement( oImages[i] ) ; } var aIds = oEditor.FCKTools.GetAllChildrenIds( oEditor.FCK.EditorDocument.body ) ; bHasAnchors = ( aAnchors.length > 0 || aIds.length > 0 ) ; for ( var i = 0 ; i < aAnchors.length ; i++ ) { var sName = aAnchors[i].name ; if ( sName && sName.length > 0 ) oEditor.FCKTools.AddSelectOption( GetE('cmbAnchorName'), sName, sName ) ; } for ( var i = 0 ; i < aIds.length ; i++ ) { oEditor.FCKTools.AddSelectOption( GetE('cmbAnchorId'), aIds[i], aIds[i] ) ; } ShowE( 'divSelAnchor' , bHasAnchors ) ; ShowE( 'divNoAnchor' , !bHasAnchors ) ; } function LoadSelection() { if ( !oLink ) return ; var sType = 'url' ; // Get the actual Link href. var sHRef = oLink.getAttribute( '_fcksavedurl' ) ; if ( !sHRef || sHRef.length == 0 ) sHRef = oLink.getAttribute( 'href' , 2 ) + '' ; // TODO: Wait stable version and remove the following commented lines. // if ( sHRef.startsWith( FCK.BaseUrl ) ) // sHRef = sHRef.remove( 0, FCK.BaseUrl.length ) ; // Look for a popup javascript link. var oPopupMatch = oRegex.PopupUri.exec( sHRef ) ; if( oPopupMatch ) { GetE('cmbTarget').value = 'popup' ; sHRef = oPopupMatch[1] ; FillPopupFields( oPopupMatch[2], oPopupMatch[3] ) ; SetTarget( 'popup' ) ; } // Search for the protocol. var sProtocol = oRegex.UriProtocol.exec( sHRef ) ; if ( sProtocol ) { sProtocol = sProtocol[0].toLowerCase() ; GetE('cmbLinkProtocol').value = sProtocol ; // Remove the protocol and get the remainig URL. var sUrl = sHRef.replace( oRegex.UriProtocol, '' ) ; if ( sProtocol == 'mailto:' ) // It is an e-mail link. { sType = 'email' ; var oEMailInfo = oParser.ParseEMailUrl( sUrl ) ; GetE('txtEMailAddress').value = oEMailInfo.Address ; GetE('txtEMailSubject').value = oEMailInfo.Subject ; GetE('txtEMailBody').value = oEMailInfo.Body ; } else // It is a normal link. { sType = 'url' ; GetE('txtUrl').value = sUrl ; } } else if ( sHRef.substr(0,1) == '#' && sHRef.length > 1 ) // It is an anchor link. { sType = 'anchor' ; GetE('cmbAnchorName').value = GetE('cmbAnchorId').value = sHRef.substr(1) ; } else // It is another type of link. { sType = 'url' ; GetE('cmbLinkProtocol').value = '' ; GetE('txtUrl').value = sHRef ; } if ( !oPopupMatch ) { // Get the target. var sTarget = oLink.target ; if ( sTarget && sTarget.length > 0 ) { if ( oRegex.ReserveTarget.test( sTarget ) ) { sTarget = sTarget.toLowerCase() ; GetE('cmbTarget').value = sTarget ; } else GetE('cmbTarget').value = 'frame' ; GetE('txtTargetFrame').value = sTarget ; } } // Get Advances Attributes GetE('txtAttId').value = oLink.id ; GetE('txtAttName').value = oLink.name ; GetE('cmbAttLangDir').value = oLink.dir ; GetE('txtAttLangCode').value = oLink.lang ; GetE('txtAttAccessKey').value = oLink.accessKey ; GetE('txtAttTabIndex').value = oLink.tabIndex <= 0 ? '' : oLink.tabIndex ; GetE('txtAttTitle').value = oLink.title ; GetE('txtAttContentType').value = oLink.type ; GetE('txtAttCharSet').value = oLink.charset ; if ( oEditor.FCKBrowserInfo.IsIE ) { GetE('txtAttClasses').value = oLink.getAttribute('className',2) || '' ; GetE('txtAttStyle').value = oLink.style.cssText ; } else { GetE('txtAttClasses').value = oLink.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oLink.getAttribute('style',2) ; } // Update the Link type combo. GetE('cmbLinkType').value = sType ; } //#### Link type selection. function SetLinkType( linkType ) { ShowE('divLinkTypeUrl' , (linkType == 'url') ) ; ShowE('divLinkTypeAnchor' , (linkType == 'anchor') ) ; ShowE('divLinkTypeEMail' , (linkType == 'email') ) ; if ( !FCKConfig.LinkDlgHideTarget ) window.parent.SetTabVisibility( 'Target' , (linkType == 'url') ) ; if ( FCKConfig.LinkUpload ) window.parent.SetTabVisibility( 'Upload' , (linkType == 'url') ) ; if ( !FCKConfig.LinkDlgHideAdvanced ) window.parent.SetTabVisibility( 'Advanced' , (linkType != 'anchor' || bHasAnchors) ) ; if ( linkType == 'email' ) window.parent.SetAutoSize( true ) ; } //#### Target type selection. function SetTarget( targetType ) { GetE('tdTargetFrame').style.display = ( targetType == 'popup' ? 'none' : '' ) ; GetE('tdPopupName').style.display = GetE('tablePopupFeatures').style.display = ( targetType == 'popup' ? '' : 'none' ) ; switch ( targetType ) { case "_blank" : case "_self" : case "_parent" : case "_top" : GetE('txtTargetFrame').value = targetType ; break ; case "" : GetE('txtTargetFrame').value = '' ; break ; } if ( targetType == 'popup' ) window.parent.SetAutoSize( true ) ; } //#### Called while the user types the URL. function OnUrlChange() { var sUrl = GetE('txtUrl').value ; var sProtocol = oRegex.UrlOnChangeProtocol.exec( sUrl ) ; if ( sProtocol ) { sUrl = sUrl.substr( sProtocol[0].length ) ; GetE('txtUrl').value = sUrl ; GetE('cmbLinkProtocol').value = sProtocol[0].toLowerCase() ; } else if ( oRegex.UrlOnChangeTestOther.test( sUrl ) ) { GetE('cmbLinkProtocol').value = '' ; } } //#### Called while the user types the target name. function OnTargetNameChange() { var sFrame = GetE('txtTargetFrame').value ; if ( sFrame.length == 0 ) GetE('cmbTarget').value = '' ; else if ( oRegex.ReserveTarget.test( sFrame ) ) GetE('cmbTarget').value = sFrame.toLowerCase() ; else GetE('cmbTarget').value = 'frame' ; } //#### Builds the javascript URI to open a popup to the specified URI. function BuildPopupUri( uri ) { var oReg = new RegExp( "'", "g" ) ; var sWindowName = "'" + GetE('txtPopupName').value.replace(oReg, "\\'") + "'" ; var sFeatures = '' ; var aChkFeatures = document.getElementsByName('chkFeature') ; for ( var i = 0 ; i < aChkFeatures.length ; i++ ) { if ( i > 0 ) sFeatures += ',' ; sFeatures += aChkFeatures[i].value + '=' + ( aChkFeatures[i].checked ? 'yes' : 'no' ) ; } if ( GetE('txtPopupWidth').value.length > 0 ) sFeatures += ',width=' + GetE('txtPopupWidth').value ; if ( GetE('txtPopupHeight').value.length > 0 ) sFeatures += ',height=' + GetE('txtPopupHeight').value ; if ( GetE('txtPopupLeft').value.length > 0 ) sFeatures += ',left=' + GetE('txtPopupLeft').value ; if ( GetE('txtPopupTop').value.length > 0 ) sFeatures += ',top=' + GetE('txtPopupTop').value ; return ( "javascript:void(window.open('" + uri + "'," + sWindowName + ",'" + sFeatures + "'))" ) ; } //#### Fills all Popup related fields. function FillPopupFields( windowName, features ) { if ( windowName ) GetE('txtPopupName').value = windowName ; var oFeatures = new Object() ; var oFeaturesMatch ; while( ( oFeaturesMatch = oRegex.PopupFeatures.exec( features ) ) != null ) { var sValue = oFeaturesMatch[2] ; if ( sValue == ( 'yes' || '1' ) ) oFeatures[ oFeaturesMatch[1] ] = true ; else if ( ! isNaN( sValue ) && sValue != 0 ) oFeatures[ oFeaturesMatch[1] ] = sValue ; } // Update all features check boxes. var aChkFeatures = document.getElementsByName('chkFeature') ; for ( var i = 0 ; i < aChkFeatures.length ; i++ ) { if ( oFeatures[ aChkFeatures[i].value ] ) aChkFeatures[i].checked = true ; } // Update position and size text boxes. if ( oFeatures['width'] ) GetE('txtPopupWidth').value = oFeatures['width'] ; if ( oFeatures['height'] ) GetE('txtPopupHeight').value = oFeatures['height'] ; if ( oFeatures['left'] ) GetE('txtPopupLeft').value = oFeatures['left'] ; if ( oFeatures['top'] ) GetE('txtPopupTop').value = oFeatures['top'] ; } //#### The OK button was hit. function Ok() { var sUri, sInnerHtml ; switch ( GetE('cmbLinkType').value ) { case 'url' : sUri = GetE('txtUrl').value ; if ( sUri.length == 0 ) { alert( FCKLang.DlnLnkMsgNoUrl ) ; return false ; } sUri = GetE('cmbLinkProtocol').value + sUri ; if( GetE('cmbTarget').value == 'popup' ) sUri = BuildPopupUri( sUri ) ; break ; case 'email' : sUri = GetE('txtEMailAddress').value ; if ( sUri.length == 0 ) { alert( FCKLang.DlnLnkMsgNoEMail ) ; return false ; } sUri = oParser.CreateEMailUri( sUri, GetE('txtEMailSubject').value, GetE('txtEMailBody').value ) ; break ; case 'anchor' : var sAnchor = GetE('cmbAnchorName').value ; if ( sAnchor.length == 0 ) sAnchor = GetE('cmbAnchorId').value ; if ( sAnchor.length == 0 ) { alert( FCKLang.DlnLnkMsgNoAnchor ) ; return false ; } sUri = '#' + sAnchor ; break ; } // No link selected, so try to create one. if ( !oLink ) oLink = oEditor.FCK.CreateLink( sUri ) ; if ( oLink ) sInnerHtml = oLink.innerHTML ; // Save the innerHTML (IE changes it if it is like a URL). else { // If no selection, use the uri as the link text (by dom, 2006-05-26) sInnerHtml = sUri; // try to built better text for empty link switch (GetE('cmbLinkType').value) { // anchor: use old behavior --> return true case 'anchor': sInnerHtml = sInnerHtml.replace( /^#/, '' ) ; break; // url: try to get path case 'url': var oLinkPathRegEx = new RegExp("//?([^?\"']+)([?].*)?$"); var asLinkPath = oLinkPathRegEx.exec( sUri ); if (asLinkPath != null) sInnerHtml = asLinkPath[1]; // use matched path break; // mailto: try to get email address case 'email': sInnerHtml = GetE('txtEMailAddress').value break; } // built new anchor and add link text oLink = oEditor.FCK.CreateElement( 'a' ) ; } oEditor.FCKUndo.SaveUndoStep() ; oLink.href = sUri ; SetAttribute( oLink, '_fcksavedurl', sUri ) ; oLink.innerHTML = sInnerHtml ; // Set (or restore) the innerHTML // Target if( GetE('cmbTarget').value != 'popup' ) SetAttribute( oLink, 'target', GetE('txtTargetFrame').value ) ; else SetAttribute( oLink, 'target', null ) ; // Advances Attributes SetAttribute( oLink, 'id' , GetE('txtAttId').value ) ; SetAttribute( oLink, 'name' , GetE('txtAttName').value ) ; // No IE. Set but doesnt't update the outerHTML. SetAttribute( oLink, 'dir' , GetE('cmbAttLangDir').value ) ; SetAttribute( oLink, 'lang' , GetE('txtAttLangCode').value ) ; SetAttribute( oLink, 'accesskey', GetE('txtAttAccessKey').value ) ; SetAttribute( oLink, 'tabindex' , ( GetE('txtAttTabIndex').value > 0 ? GetE('txtAttTabIndex').value : null ) ) ; SetAttribute( oLink, 'title' , GetE('txtAttTitle').value ) ; SetAttribute( oLink, 'type' , GetE('txtAttContentType').value ) ; SetAttribute( oLink, 'charset' , GetE('txtAttCharSet').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { SetAttribute( oLink, 'className', GetE('txtAttClasses').value ) ; oLink.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( oLink, 'class', GetE('txtAttClasses').value ) ; SetAttribute( oLink, 'style', GetE('txtAttStyle').value ) ; } // Select the link. oEditor.FCKSelection.SelectNode(oLink); return true ; } function BrowseServer() { OpenFileBrowser( FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; } function SetUrl( url ) { document.getElementById('txtUrl').value = url ; OnUrlChange() ; window.parent.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.LinkUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.LinkUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.LinkUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.LinkUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } return true ; }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: fck_dialog_common.js * Useful functions used by almost all dialog window pages. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ // Gets a element by its Id. Used for shorter coding. function GetE( elementId ) { return document.getElementById( elementId ) ; } function ShowE( element, isVisible ) { if ( typeof( element ) == 'string' ) element = GetE( element ) ; element.style.display = isVisible ? '' : 'none' ; } function SetAttribute( element, attName, attValue ) { if ( attValue == null || attValue.length == 0 ) element.removeAttribute( attName, 0 ) ; // 0 : Case Insensitive else element.setAttribute( attName, attValue, 0 ) ; // 0 : Case Insensitive } function GetAttribute( element, attName, valueIfNull ) { var oAtt = element.attributes[attName] ; if ( oAtt == null || !oAtt.specified ) return valueIfNull ? valueIfNull : '' ; var oValue ; if ( !( oValue = element.getAttribute( attName, 2 ) ) ) oValue = oAtt.nodeValue ; return ( oValue == null ? valueIfNull : oValue ) ; } // Functions used by text fiels to accept numbers only. function IsDigit( e ) { e = e || event ; var iCode = ( e.keyCode || e.charCode ) ; event.returnValue = ( ( iCode >= 48 && iCode <= 57 ) // Numbers || (iCode >= 37 && iCode <= 40) // Arrows || iCode == 8 // Backspace || iCode == 46 // Delete ) ; return event.returnValue ; } String.prototype.trim = function() { return this.replace( /(^\s*)|(\s*$)/g, '' ) ; } String.prototype.startsWith = function( value ) { return ( this.substr( 0, value.length ) == value ) ; } String.prototype.remove = function( start, length ) { var s = '' ; if ( start > 0 ) s = this.substring( 0, start ) ; if ( start + length < this.length ) s += this.substring( start + length , this.length ) ; return s ; } function OpenFileBrowser( url, width, height ) { // oEditor must be defined. var iLeft = ( oEditor.FCKConfig.ScreenWidth - width ) / 2 ; var iTop = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ; var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes" ; sOptions += ",width=" + width ; sOptions += ",height=" + height ; sOptions += ",left=" + iLeft ; sOptions += ",top=" + iTop ; // The "PreserveSessionOnFileBrowser" because the above code could be // blocked by popup blockers. if ( oEditor.FCKConfig.PreserveSessionOnFileBrowser && oEditor.FCKBrowserInfo.IsIE ) { // The following change has been made otherwise IE will open the file // browser on a different server session (on some cases): // http://support.microsoft.com/default.aspx?scid=kb;en-us;831678 // by Simone Chiaretta. var oWindow = oEditor.window.open( url, 'FCKBrowseWindow', sOptions ) ; if ( oWindow ) { // Detect Yahoo popup blocker. try { var sTest = oWindow.name ; // Yahoo returns "something", but we can't access it, so detect that and avoid strange errors for the user. oWindow.opener = window ; } catch(e) { alert( oEditor.FCKLang.BrowseServerBlocked ) ; } } else alert( oEditor.FCKLang.BrowseServerBlocked ) ; } else window.open( url, 'FCKBrowseWindow', sOptions ) ; }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: fckxml.js * Defines the FCKXml object that is used for XML data calls * and XML processing. * This script is shared by almost all pages that compose the * File Browser frameset. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ var FCKXml = function() {} FCKXml.prototype.GetHttpRequest = function() { if ( window.XMLHttpRequest ) // Gecko return new XMLHttpRequest() ; else if ( window.ActiveXObject ) // IE return new ActiveXObject("MsXml2.XmlHttp") ; } FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer ) { var oFCKXml = this ; var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ; var oXmlHttp = this.GetHttpRequest() ; oXmlHttp.open( "GET", urlToCall, bAsync ) ; if ( bAsync ) { oXmlHttp.onreadystatechange = function() { if ( oXmlHttp.readyState == 4 ) { oFCKXml.DOMDocument = oXmlHttp.responseXML ; if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 ) asyncFunctionPointer( oFCKXml ) ; else alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ; } } } oXmlHttp.send( null ) ; if ( ! bAsync ) { if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 ) this.DOMDocument = oXmlHttp.responseXML ; else { alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ; } } } FCKXml.prototype.SelectNodes = function( xpath ) { if ( document.all ) // IE return this.DOMDocument.selectNodes( xpath ) ; else // Gecko { var aNodeArray = new Array(); var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument, this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ; if ( xPathResult ) { var oNode = xPathResult.iterateNext() ; while( oNode ) { aNodeArray[aNodeArray.length] = oNode ; oNode = xPathResult.iterateNext(); } } return aNodeArray ; } } FCKXml.prototype.SelectSingleNode = function( xpath ) { if ( document.all ) // IE return this.DOMDocument.selectSingleNode( xpath ) ; else // Gecko { var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument, this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null); if ( xPathResult && xPathResult.singleNodeValue ) return xPathResult.singleNodeValue ; else return null ; } }
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: common.js * Common objects and functions shared by all pages that compose the * File Browser dialog window. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ function AddSelectOption( selectElement, optionText, optionValue ) { var oOption = document.createElement("OPTION") ; oOption.text = optionText ; oOption.value = optionValue ; selectElement.options.add(oOption) ; return oOption ; } var oConnector = window.parent.oConnector ; var oIcons = window.parent.oIcons ;
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: fckconfig.js * Editor configuration settings. * See the documentation for more info. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ FCKConfig.CustomConfigurationsPath = '' ; FCKConfig.EditorAreaCSS = FCKConfig.BasePath + 'css/fck_editorarea.css' ; FCKConfig.DocType = '' ; FCKConfig.BaseHref = '' ; FCKConfig.FullPage = false ; FCKConfig.Debug = true ; FCKConfig.AllowQueryStringDebug = true ; FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/office2003/' ; FCKConfig.PreloadImages = [ FCKConfig.SkinPath + 'images/toolbar.start.gif', FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif' ] ; FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ; // FCKConfig.Plugins.Add( 'autogrow' ) ; FCKConfig.AutoGrowMax = 400 ; FCKConfig.ProtectedSource.Add( /<script[\s\S]*?\/script>/gi ) ; // <SCRIPT> tags. // FCKConfig.ProtectedSource.Add( /<%[\s\S]*?%>/g ) ; // ASP style server side code <%...%> // FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code // FCKConfig.ProtectedSource.Add( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ) ; // ASP.Net style tags <asp:control> FCKConfig.AutoDetectLanguage = true ; FCKConfig.DefaultLanguage = 'zh-cn' ; FCKConfig.ContentLangDirection = 'ltr' ; FCKConfig.ProcessHTMLEntities = true ; FCKConfig.IncludeLatinEntities = true ; FCKConfig.IncludeGreekEntities = true ; FCKConfig.FillEmptyBlocks = true ; FCKConfig.FormatSource = true ; FCKConfig.FormatOutput = true ; FCKConfig.FormatIndentator = ' ' ; FCKConfig.ForceStrongEm = true ; FCKConfig.GeckoUseSPAN = false ; FCKConfig.StartupFocus = false ; FCKConfig.ForcePasteAsPlainText = false ; FCKConfig.AutoDetectPasteFromWord = true ; // IE only. FCKConfig.ForceSimpleAmpersand = false ; FCKConfig.TabSpaces = 0 ; FCKConfig.ShowBorders = true ; FCKConfig.SourcePopup = false ; FCKConfig.UseBROnCarriageReturn = false ; // IE only. FCKConfig.ToolbarStartExpanded = true ; FCKConfig.ToolbarCanCollapse = true ; FCKConfig.IgnoreEmptyParagraphValue = true ; FCKConfig.PreserveSessionOnFileBrowser = false ; FCKConfig.FloatingPanelsZIndex = 10000 ; FCKConfig.ToolbarLocation = 'In' ; FCKConfig.ToolbarSets["Default"] = [ ['Source','DocProps','-','Save','NewPage','Preview','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteWord','-','Print'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], ['OrderedList','UnorderedList','-','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], ['Link','Unlink','Anchor'], ['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak','UniversalKey'], ['TextColor','BGColor'],['FitWindow','-','About'], '/', ['Style','FontFormat','FontName','FontSize'] ] ; FCKConfig.ToolbarSets["Basic"] = [ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About'] ] ; FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form'] ; FCKConfig.FontColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ; FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ; FCKConfig.FontSizes = '1/xx-small;2/x-small;3/small;4/medium;5/large;6/x-large;7/xx-large' ; FCKConfig.FontFormats = 'p;div;pre;address;h1;h2;h3;h4;h5;h6' ; FCKConfig.StylesXmlPath = FCKConfig.EditorPath + 'fckstyles.xml' ; FCKConfig.TemplatesXmlPath = FCKConfig.EditorPath + 'fcktemplates.xml' ; FCKConfig.MaxUndoLevels = 15 ; FCKConfig.DisableObjectResizing = false ; FCKConfig.DisableFFTableHandles = true ; FCKConfig.LinkDlgHideTarget = false ; FCKConfig.LinkDlgHideAdvanced = false ; FCKConfig.ImageDlgHideLink = false ; FCKConfig.ImageDlgHideAdvanced = false ; FCKConfig.FlashDlgHideAdvanced = false ; // The following value defines which File Browser connector and Quick Upload // "uploader" to use. It is valid for the default implementaion and it is here // just to make this configuration file cleaner. // It is not possible to change this value using an external file or even // inline when creating the editor instance. In that cases you must set the // values of LinkBrowserURL, ImageBrowserURL and so on. // Custom implementations should just ignore it. var _FileBrowserLanguage = 'asp' ; // asp | aspx | cfm | lasso | perl | php | py var _QuickUploadLanguage = 'asp' ; // asp | aspx | cfm | lasso | php // Don't care about the following line. It just calculates the correct connector // extension to use for the default File Browser (Perl uses "cgi"). var _FileBrowserExtension = _FileBrowserLanguage == 'perl' ? 'cgi' : _FileBrowserLanguage ; FCKConfig.LinkBrowser = true ; FCKConfig.LinkBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% FCKConfig.LinkBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% FCKConfig.ImageBrowser = true ; FCKConfig.ImageBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% ; FCKConfig.ImageBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% ; FCKConfig.FlashBrowser = true ; FCKConfig.FlashBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; //70% ; FCKConfig.FlashBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; //70% ; FCKConfig.LinkBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Connector=connectors/jsp/connector" ; FCKConfig.ImageBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector" ; FCKConfig.FlashBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" ; FCKConfig.LinkUpload = true ; FCKConfig.LinkUploadAllowedExtensions = "" ; // empty for all FCKConfig.LinkUploadDeniedExtensions = ".(php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi)$" ; // empty for no one FCKConfig.ImageUpload = true ; FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png)$" ; // empty for all FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one FCKConfig.FlashUpload = true ; FCKConfig.FlashUploadAllowedExtensions = ".(swf|fla)$" ; // empty for all FCKConfig.FlashUploadDeniedExtensions = "" ; // empty for no one FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=File' ; FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Flash' ; FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/upload/simpleuploader?Type=Image' ; FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/msn/' ; FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ; FCKConfig.SmileyColumns = 8 ; FCKConfig.SmileyWindowWidth = 320 ; FCKConfig.SmileyWindowHeight = 240 ;
JavaScript
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2006 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * "Support Open Source software. What about a donation today?" * * File Name: fckeditor.js * This is the integration file for JavaScript. * * It defines the FCKeditor class that can be used to create editor * instances in a HTML page in the client side. For server side * operations, use the specific integration system. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */ // FCKeditor Class var FCKeditor = function( instanceName, width, height, toolbarSet, value ) { // Properties this.InstanceName = instanceName ; this.Width = width || '100%' ; this.Height = height || '200' ; this.ToolbarSet = toolbarSet || 'Default' ; this.Value = value || '' ; this.BasePath = '/fckeditor/' ; this.CheckBrowser = true ; this.DisplayErrors = true ; this.EnableSafari = false ; // This is a temporary property, while Safari support is under development. this.EnableOpera = false ; // This is a temporary property, while Opera support is under development. this.Config = new Object() ; // Events this.OnError = null ; // function( source, errorNumber, errorDescription ) } FCKeditor.prototype.Create = function() { // Check for errors if ( !this.InstanceName || this.InstanceName.length == 0 ) { this._ThrowError( 701, 'You must specify an instance name.' ) ; return ; } document.write( '<div>' ) ; if ( !this.CheckBrowser || this._IsCompatibleBrowser() ) { document.write( '<input type="hidden" id="' + this.InstanceName + '" name="' + this.InstanceName + '" value="' + this._HTMLEncode( this.Value ) + '" style="display:none" />' ) ; document.write( this._GetConfigHtml() ) ; document.write( this._GetIFrameHtml() ) ; } else { var sWidth = this.Width.toString().indexOf('%') > 0 ? this.Width : this.Width + 'px' ; var sHeight = this.Height.toString().indexOf('%') > 0 ? this.Height : this.Height + 'px' ; document.write('<textarea name="' + this.InstanceName + '" rows="4" cols="40" style="WIDTH: ' + sWidth + '; HEIGHT: ' + sHeight + '">' + this._HTMLEncode( this.Value ) + '<\/textarea>') ; } document.write( '</div>' ) ; } FCKeditor.prototype.ReplaceTextarea = function() { if ( !this.CheckBrowser || this._IsCompatibleBrowser() ) { // We must check the elements firstly using the Id and then the name. var oTextarea = document.getElementById( this.InstanceName ) ; var colElementsByName = document.getElementsByName( this.InstanceName ) ; var i = 0; while ( oTextarea || i == 0 ) { if ( oTextarea && oTextarea.tagName == 'TEXTAREA' ) break ; oTextarea = colElementsByName[i++] ; } if ( !oTextarea ) { alert( 'Error: The TEXTAREA with id or name set to "' + this.InstanceName + '" was not found' ) ; return ; } oTextarea.style.display = 'none' ; this._InsertHtmlBefore( this._GetConfigHtml(), oTextarea ) ; this._InsertHtmlBefore( this._GetIFrameHtml(), oTextarea ) ; } } FCKeditor.prototype._InsertHtmlBefore = function( html, element ) { if ( element.insertAdjacentHTML ) // IE element.insertAdjacentHTML( 'beforeBegin', html ) ; else // Gecko { var oRange = document.createRange() ; oRange.setStartBefore( element ) ; var oFragment = oRange.createContextualFragment( html ); element.parentNode.insertBefore( oFragment, element ) ; } } FCKeditor.prototype._GetConfigHtml = function() { var sConfig = '' ; for ( var o in this.Config ) { if ( sConfig.length > 0 ) sConfig += '&amp;' ; sConfig += escape(o) + '=' + escape( this.Config[o] ) ; } return '<input type="hidden" id="' + this.InstanceName + '___Config" value="' + sConfig + '" style="display:none" />' ; } FCKeditor.prototype._GetIFrameHtml = function() { var sFile = (/fcksource=true/i).test( window.top.location.search ) ? 'fckeditor.original.html' : 'fckeditor.html' ; var sLink = this.BasePath + 'editor/' + sFile + '?InstanceName=' + this.InstanceName ; if (this.ToolbarSet) sLink += '&Toolbar=' + this.ToolbarSet ; return '<iframe id="' + this.InstanceName + '___Frame" src="' + sLink + '" width="' + this.Width + '" height="' + this.Height + '" frameborder="0" scrolling="no"></iframe>' ; } FCKeditor.prototype._IsCompatibleBrowser = function() { var sAgent = navigator.userAgent.toLowerCase() ; // Internet Explorer if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 ) { var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ; return ( sBrowserVersion >= 5.5 ) ; } // Gecko if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 ) return true ; // Opera if ( this.EnableOpera ) { var aMatch = sAgent.match( /^opera\/(\d+\.\d+)/ ) ; if ( aMatch && aMatch[1] >= 9.0 ) return true ; } // Safari if ( this.EnableSafari && sAgent.indexOf( 'safari' ) != -1 ) return ( sAgent.match( /safari\/(\d+)/ )[1] >= 312 ) ; // Build must be at least 312 (1.3) return false ; } FCKeditor.prototype._ThrowError = function( errorNumber, errorDescription ) { this.ErrorNumber = errorNumber ; this.ErrorDescription = errorDescription ; if ( this.DisplayErrors ) { document.write( '<div style="COLOR: #ff0000">' ) ; document.write( '[ FCKeditor Error ' + this.ErrorNumber + ': ' + this.ErrorDescription + ' ]' ) ; document.write( '</div>' ) ; } if ( typeof( this.OnError ) == 'function' ) this.OnError( this, errorNumber, errorDescription ) ; } FCKeditor.prototype._HTMLEncode = function( text ) { if ( typeof( text ) != "string" ) text = text.toString() ; text = text.replace(/&/g, "&amp;") ; text = text.replace(/"/g, "&quot;") ; text = text.replace(/</g, "&lt;") ; text = text.replace(/>/g, "&gt;") ; text = text.replace(/'/g, "&#39;") ; return text ; }
JavaScript
// ** I18N Calendar._DN = new Array ("Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă", "Duminică"); Calendar._SDN_len = 2; Calendar._MN = new Array ("Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Despre calendar"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "Pentru ultima versiune vizitaţi: http://www.dynarch.com/projects/calendar/\n" + "Distribuit sub GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "Selecţia datei:\n" + "- Folosiţi butoanele \xab, \xbb pentru a selecta anul\n" + "- Folosiţi butoanele " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pentru a selecta luna\n" + "- Tineţi butonul mouse-ului apăsat pentru selecţie mai rapidă."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Selecţia orei:\n" + "- Click pe ora sau minut pentru a mări valoarea cu 1\n" + "- Sau Shift-Click pentru a micşora valoarea cu 1\n" + "- Sau Click şi drag pentru a selecta mai repede."; Calendar._TT["PREV_YEAR"] = "Anul precedent (lung pt menu)"; Calendar._TT["PREV_MONTH"] = "Luna precedentă (lung pt menu)"; Calendar._TT["GO_TODAY"] = "Data de azi"; Calendar._TT["NEXT_MONTH"] = "Luna următoare (lung pt menu)"; Calendar._TT["NEXT_YEAR"] = "Anul următor (lung pt menu)"; Calendar._TT["SEL_DATE"] = "Selectează data"; Calendar._TT["DRAG_TO_MOVE"] = "Trage pentru a mişca"; Calendar._TT["PART_TODAY"] = " (astăzi)"; Calendar._TT["DAY_FIRST"] = "Afişează %s prima zi"; Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Închide"; Calendar._TT["TODAY"] = "Astăzi"; Calendar._TT["TIME_PART"] = "(Shift-)Click sau drag pentru a selecta"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; Calendar._TT["TT_DATE_FORMAT"] = "%A, %d %B"; Calendar._TT["WK"] = "spt"; Calendar._TT["TIME"] = "Ora:";
JavaScript
// ** I18N Afrikaans Calendar._DN = new Array ("Sondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrydag", "Saterdag", "Sondag"); Calendar._MN = new Array ("Januarie", "Februarie", "Maart", "April", "Mei", "Junie", "Julie", "Augustus", "September", "Oktober", "November", "Desember"); // tooltips Calendar._TT = {}; Calendar._TT["TOGGLE"] = "Verander eerste dag van die week"; Calendar._TT["PREV_YEAR"] = "Vorige jaar (hou vir keuselys)"; Calendar._TT["PREV_MONTH"] = "Vorige maand (hou vir keuselys)"; Calendar._TT["GO_TODAY"] = "Gaan na vandag"; Calendar._TT["NEXT_MONTH"] = "Volgende maand (hou vir keuselys)"; Calendar._TT["NEXT_YEAR"] = "Volgende jaar (hou vir keuselys)"; Calendar._TT["SEL_DATE"] = "Kies datum"; Calendar._TT["DRAG_TO_MOVE"] = "Sleep om te skuif"; Calendar._TT["PART_TODAY"] = " (vandag)"; Calendar._TT["MON_FIRST"] = "Vertoon Maandag eerste"; Calendar._TT["SUN_FIRST"] = "Display Sunday first"; Calendar._TT["CLOSE"] = "Close"; Calendar._TT["TODAY"] = "Today";
JavaScript
// ** I18N Calendar._DN = new Array ("Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag"); Calendar._SDN_len = 2; Calendar._MN = new Array ("Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Info"; Calendar._TT["ABOUT"] = "DHTML Datum/Tijd Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + "Ga voor de meest recente versie naar: http://www.dynarch.com/projects/calendar/\n" + "Verspreid onder de GNU LGPL. Zie http://gnu.org/licenses/lgpl.html voor details." + "\n\n" + "Datum selectie:\n" + "- Gebruik de \xab \xbb knoppen om een jaar te selecteren\n" + "- Gebruik de " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " knoppen om een maand te selecteren\n" + "- Houd de muis ingedrukt op de genoemde knoppen voor een snellere selectie."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Tijd selectie:\n" + "- Klik op een willekeurig onderdeel van het tijd gedeelte om het te verhogen\n" + "- of Shift-klik om het te verlagen\n" + "- of klik en sleep voor een snellere selectie."; //Calendar._TT["TOGGLE"] = "Selecteer de eerste week-dag"; Calendar._TT["PREV_YEAR"] = "Vorig jaar (ingedrukt voor menu)"; Calendar._TT["PREV_MONTH"] = "Vorige maand (ingedrukt voor menu)"; Calendar._TT["GO_TODAY"] = "Ga naar Vandaag"; Calendar._TT["NEXT_MONTH"] = "Volgende maand (ingedrukt voor menu)"; Calendar._TT["NEXT_YEAR"] = "Volgend jaar (ingedrukt voor menu)"; Calendar._TT["SEL_DATE"] = "Selecteer datum"; Calendar._TT["DRAG_TO_MOVE"] = "Klik en sleep om te verplaatsen"; Calendar._TT["PART_TODAY"] = " (vandaag)"; //Calendar._TT["MON_FIRST"] = "Toon Maandag eerst"; //Calendar._TT["SUN_FIRST"] = "Toon Zondag eerst"; Calendar._TT["DAY_FIRST"] = "Toon %s eerst"; Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Sluiten"; Calendar._TT["TODAY"] = "(vandaag)"; Calendar._TT["TIME_PART"] = "(Shift-)Klik of sleep om de waarde te veranderen"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b %Y"; Calendar._TT["WK"] = "wk"; Calendar._TT["TIME"] = "Tijd:";
JavaScript
// ** I18N // Calendar pt_BR language // Author: Adalberto Machado, <betosm@terra.com.br> // Encoding: any // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("Domingo", "Segunda", "Terca", "Quarta", "Quinta", "Sexta", "Sabado", "Domingo"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab", "Dom"); // full month names Calendar._MN = new Array ("Janeiro", "Fevereiro", "Marco", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"); // short month names Calendar._SMN = new Array ("Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Sobre o calendario"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "Ultima versao visite: http://www.dynarch.com/projects/calendar/\n" + "Distribuido sobre GNU LGPL. Veja http://gnu.org/licenses/lgpl.html para detalhes." + "\n\n" + "Selecao de data:\n" + "- Use os botoes \xab, \xbb para selecionar o ano\n" + "- Use os botoes " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para selecionar o mes\n" + "- Segure o botao do mouse em qualquer um desses botoes para selecao rapida."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Selecao de hora:\n" + "- Clique em qualquer parte da hora para incrementar\n" + "- ou Shift-click para decrementar\n" + "- ou clique e segure para selecao rapida."; Calendar._TT["PREV_YEAR"] = "Ant. ano (segure para menu)"; Calendar._TT["PREV_MONTH"] = "Ant. mes (segure para menu)"; Calendar._TT["GO_TODAY"] = "Hoje"; Calendar._TT["NEXT_MONTH"] = "Prox. mes (segure para menu)"; Calendar._TT["NEXT_YEAR"] = "Prox. ano (segure para menu)"; Calendar._TT["SEL_DATE"] = "Selecione a data"; Calendar._TT["DRAG_TO_MOVE"] = "Arraste para mover"; Calendar._TT["PART_TODAY"] = " (hoje)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "Mostre %s primeiro"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Fechar"; Calendar._TT["TODAY"] = "Hoje"; Calendar._TT["TIME_PART"] = "(Shift-)Click ou arraste para mudar valor"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %e %b"; Calendar._TT["WK"] = "sm"; Calendar._TT["TIME"] = "Hora:";
JavaScript
// ** I18N // Calendar NO language // Author: Daniel Holmen, <daniel.holmen@ciber.no> // Encoding: UTF-8 // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"); // full month names Calendar._MN = new Array ("Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"); // short month names Calendar._SMN = new Array ("Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Om kalenderen"; Calendar._TT["ABOUT"] = "DHTML Dato-/Tidsvelger\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For nyeste versjon, gå til: http://www.dynarch.com/projects/calendar/\n" + "Distribuert under GNU LGPL. Se http://gnu.org/licenses/lgpl.html for detaljer." + "\n\n" + "Datovalg:\n" + "- Bruk knappene \xab og \xbb for å velge år\n" + "- Bruk knappene " + String.fromCharCode(0x2039) + " og " + String.fromCharCode(0x203a) + " for å velge måned\n" + "- Hold inne musknappen eller knappene over for raskere valg."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Tidsvalg:\n" + "- Klikk på en av tidsdelene for å øke den\n" + "- eller Shift-klikk for å senke verdien\n" + "- eller klikk-og-dra for raskere valg.."; Calendar._TT["PREV_YEAR"] = "Forrige. år (hold for meny)"; Calendar._TT["PREV_MONTH"] = "Forrige. måned (hold for meny)"; Calendar._TT["GO_TODAY"] = "Gå til idag"; Calendar._TT["NEXT_MONTH"] = "Neste måned (hold for meny)"; Calendar._TT["NEXT_YEAR"] = "Neste år (hold for meny)"; Calendar._TT["SEL_DATE"] = "Velg dato"; Calendar._TT["DRAG_TO_MOVE"] = "Dra for å flytte"; Calendar._TT["PART_TODAY"] = " (idag)"; Calendar._TT["MON_FIRST"] = "Vis mandag først"; Calendar._TT["SUN_FIRST"] = "Vis søndag først"; Calendar._TT["CLOSE"] = "Lukk"; Calendar._TT["TODAY"] = "Idag"; Calendar._TT["TIME_PART"] = "(Shift-)Klikk eller dra for å endre verdi"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "uke";
JavaScript
/* calendar-cs-win.js language: Czech encoding: windows-1250 author: Lubos Jerabek (xnet@seznam.cz) Jan Uhlir (espinosa@centrum.cz) */ // ** I18N Calendar._DN = new Array('Neděle','Pondělí','Úterý','Středa','Čtvrtek','Pátek','Sobota','Neděle'); Calendar._SDN = new Array('Ne','Po','Út','St','Čt','Pá','So','Ne'); Calendar._MN = new Array('Leden','Únor','Březen','Duben','Květen','Červen','Červenec','Srpen','Září','Říjen','Listopad','Prosinec'); Calendar._SMN = new Array('Led','Úno','Bře','Dub','Kvě','Črv','Čvc','Srp','Zář','Říj','Lis','Pro'); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "O komponentě kalendář"; Calendar._TT["TOGGLE"] = "Změna prvního dne v týdnu"; Calendar._TT["PREV_YEAR"] = "Předchozí rok (přidrž pro menu)"; Calendar._TT["PREV_MONTH"] = "Předchozí měsíc (přidrž pro menu)"; Calendar._TT["GO_TODAY"] = "Dnešní datum"; Calendar._TT["NEXT_MONTH"] = "Další měsíc (přidrž pro menu)"; Calendar._TT["NEXT_YEAR"] = "Další rok (přidrž pro menu)"; Calendar._TT["SEL_DATE"] = "Vyber datum"; Calendar._TT["DRAG_TO_MOVE"] = "Chyť a táhni, pro přesun"; Calendar._TT["PART_TODAY"] = " (dnes)"; Calendar._TT["MON_FIRST"] = "Ukaž jako první Pondělí"; //Calendar._TT["SUN_FIRST"] = "Ukaž jako první Neděli"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For latest version visit: http://www.dynarch.com/projects/calendar/\n" + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "Výběr datumu:\n" + "- Use the \xab, \xbb buttons to select year\n" + "- Použijte tlačítka " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " k výběru měsíce\n" + "- Podržte tlačítko myši na jakémkoliv z těch tlačítek pro rychlejší výběr."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Výběr času:\n" + "- Klikněte na jakoukoliv z částí výběru času pro zvýšení.\n" + "- nebo Shift-click pro snížení\n" + "- nebo klikněte a táhněte pro rychlejší výběr."; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "Zobraz %s první"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Zavřít"; Calendar._TT["TODAY"] = "Dnes"; Calendar._TT["TIME_PART"] = "(Shift-)Klikni nebo táhni pro změnu hodnoty"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "d.m.yy"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "wk"; Calendar._TT["TIME"] = "Čas:";
JavaScript
// ** I18N // Calendar PL language // Author: Dariusz Pietrzak, <eyck@ghost.anime.pl> // Author: Janusz Piwowarski, <jpiw@go2.pl> // Encoding: utf-8 // Distributed under the same terms as the calendar itself. Calendar._DN = new Array ("Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela"); Calendar._SDN = new Array ("Nie", "Pn", "Wt", "Śr", "Cz", "Pt", "So", "Nie"); Calendar._MN = new Array ("Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"); Calendar._SMN = new Array ("Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "O kalendarzu"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "Aby pobrać najnowszą wersję, odwiedź: http://www.dynarch.com/projects/calendar/\n" + "Dostępny na licencji GNU LGPL. Zobacz szczegóły na http://gnu.org/licenses/lgpl.html." + "\n\n" + "Wybór daty:\n" + "- Użyj przycisków \xab, \xbb by wybrać rok\n" + "- Użyj przycisków " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " by wybrać miesiąc\n" + "- Przytrzymaj klawisz myszy nad jednym z powyższych przycisków dla szybszego wyboru."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Wybór czasu:\n" + "- Kliknij na jednym z pól czasu by zwiększyć jego wartość\n" + "- lub kliknij trzymając Shift by zmiejszyć jego wartość\n" + "- lub kliknij i przeciągnij dla szybszego wyboru."; //Calendar._TT["TOGGLE"] = "Zmień pierwszy dzień tygodnia"; Calendar._TT["PREV_YEAR"] = "Poprzedni rok (przytrzymaj dla menu)"; Calendar._TT["PREV_MONTH"] = "Poprzedni miesiąc (przytrzymaj dla menu)"; Calendar._TT["GO_TODAY"] = "Idź do dzisiaj"; Calendar._TT["NEXT_MONTH"] = "Następny miesiąc (przytrzymaj dla menu)"; Calendar._TT["NEXT_YEAR"] = "Następny rok (przytrzymaj dla menu)"; Calendar._TT["SEL_DATE"] = "Wybierz datę"; Calendar._TT["DRAG_TO_MOVE"] = "Przeciągnij by przesunąć"; Calendar._TT["PART_TODAY"] = " (dzisiaj)"; Calendar._TT["MON_FIRST"] = "Wyświetl poniedziałek jako pierwszy"; Calendar._TT["SUN_FIRST"] = "Wyświetl niedzielę jako pierwszą"; Calendar._TT["CLOSE"] = "Zamknij"; Calendar._TT["TODAY"] = "Dzisiaj"; Calendar._TT["TIME_PART"] = "(Shift-)Kliknij lub przeciągnij by zmienić wartość"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%e %B, %A"; Calendar._TT["WK"] = "ty";
JavaScript
// ** I18N // Calendar EN language // Author: Mihai Bazon, <mihai_bazon@yahoo.com> // Translation: Yourim Yi <yyi@yourim.net> // Encoding: EUC-KR // lang : ko // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일", "일요일"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("일", "월", "화", "수", "목", "금", "토", "일"); // full month names Calendar._MN = new Array ("1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"); // short month names Calendar._SMN = new Array ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "calendar 에 대해서"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "\n"+ "최신 버전을 받으시려면 http://www.dynarch.com/projects/calendar/ 에 방문하세요\n" + "\n"+ "GNU LGPL 라이센스로 배포됩니다. \n"+ "라이센스에 대한 자세한 내용은 http://gnu.org/licenses/lgpl.html 을 읽으세요." + "\n\n" + "날짜 선택:\n" + "- 연도를 선택하려면 \xab, \xbb 버튼을 사용합니다\n" + "- 달을 선택하려면 " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " 버튼을 누르세요\n" + "- 계속 누르고 있으면 위 값들을 빠르게 선택하실 수 있습니다."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "시간 선택:\n" + "- 마우스로 누르면 시간이 증가합니다\n" + "- Shift 키와 함께 누르면 감소합니다\n" + "- 누른 상태에서 마우스를 움직이면 좀 더 빠르게 값이 변합니다.\n"; Calendar._TT["PREV_YEAR"] = "지난 해 (길게 누르면 목록)"; Calendar._TT["PREV_MONTH"] = "지난 달 (길게 누르면 목록)"; Calendar._TT["GO_TODAY"] = "오늘 날짜로"; Calendar._TT["NEXT_MONTH"] = "다음 달 (길게 누르면 목록)"; Calendar._TT["NEXT_YEAR"] = "다음 해 (길게 누르면 목록)"; Calendar._TT["SEL_DATE"] = "날짜를 선택하세요"; Calendar._TT["DRAG_TO_MOVE"] = "마우스 드래그로 이동 하세요"; Calendar._TT["PART_TODAY"] = " (오늘)"; Calendar._TT["MON_FIRST"] = "월요일을 한 주의 시작 요일로"; Calendar._TT["SUN_FIRST"] = "일요일을 한 주의 시작 요일로"; Calendar._TT["CLOSE"] = "닫기"; Calendar._TT["TODAY"] = "오늘"; Calendar._TT["TIME_PART"] = "(Shift-)클릭 또는 드래그 하세요"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%b/%e [%a]"; Calendar._TT["WK"] = "주";
JavaScript
// ** I18N // Calendar EN language // Author: Mihai Bazon, <mihai_bazon@yahoo.com> // Translator: Fabio Di Bernardini, <altraqua@email.it> // Encoding: any // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato", "Domenica"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab", "Dom"); // full month names Calendar._MN = new Array ("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Augosto", "Settembre", "Ottobre", "Novembre", "Dicembre"); // short month names Calendar._SMN = new Array ("Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Informazioni sul calendario"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "Per gli aggiornamenti: http://www.dynarch.com/projects/calendar/\n" + "Distribuito sotto licenza GNU LGPL. Vedi http://gnu.org/licenses/lgpl.html per i dettagli." + "\n\n" + "Selezione data:\n" + "- Usa \xab, \xbb per selezionare l'anno\n" + "- Usa " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " per i mesi\n" + "- Tieni premuto a lungo il mouse per accedere alle funzioni di selezione veloce."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Selezione orario:\n" + "- Clicca sul numero per incrementarlo\n" + "- o Shift+click per decrementarlo\n" + "- o click e sinistra o destra per variarlo."; Calendar._TT["PREV_YEAR"] = "Anno prec.(clicca a lungo per il menù)"; Calendar._TT["PREV_MONTH"] = "Mese prec. (clicca a lungo per il menù)"; Calendar._TT["GO_TODAY"] = "Oggi"; Calendar._TT["NEXT_MONTH"] = "Pross. mese (clicca a lungo per il menù)"; Calendar._TT["NEXT_YEAR"] = "Pross. anno (clicca a lungo per il menù)"; Calendar._TT["SEL_DATE"] = "Seleziona data"; Calendar._TT["DRAG_TO_MOVE"] = "Trascina per spostarlo"; Calendar._TT["PART_TODAY"] = " (oggi)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "Mostra prima %s"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Chiudi"; Calendar._TT["TODAY"] = "Oggi"; Calendar._TT["TIME_PART"] = "(Shift-)Click o trascina per cambiare il valore"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; Calendar._TT["TT_DATE_FORMAT"] = "%a:%b:%e"; Calendar._TT["WK"] = "set"; Calendar._TT["TIME"] = "Ora:";
JavaScript
// ** I18N // Calendar EN language // Author: Mihai Bazon, <mishoo@infoiasi.ro> // Encoding: any // Translator : Niko <nikoused@gmail.com> // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("\u5468\u65e5",//\u5468\u65e5 "\u5468\u4e00",//\u5468\u4e00 "\u5468\u4e8c",//\u5468\u4e8c "\u5468\u4e09",//\u5468\u4e09 "\u5468\u56db",//\u5468\u56db "\u5468\u4e94",//\u5468\u4e94 "\u5468\u516d",//\u5468\u516d "\u5468\u65e5");//\u5468\u65e5 // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("\u5468\u65e5", "\u5468\u4e00", "\u5468\u4e8c", "\u5468\u4e09", "\u5468\u56db", "\u5468\u4e94", "\u5468\u516d", "\u5468\u65e5"); // full month names Calendar._MN = new Array ("\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"); // short month names Calendar._SMN = new Array ("\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "\u5173\u4e8e"; Calendar._TT["ABOUT"] = " DHTML \u65e5\u8d77/\u65f6\u95f4\u9009\u62e9\u63a7\u4ef6\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For latest version visit: \u6700\u65b0\u7248\u672c\u8bf7\u767b\u9646http://www.dynarch.com/projects/calendar/\u5bdf\u770b\n" + "\u9075\u5faaGNU LGPL. \u7ec6\u8282\u53c2\u9605 http://gnu.org/licenses/lgpl.html" + "\n\n" + "\u65e5\u671f\u9009\u62e9:\n" + "- \u70b9\u51fb\xab(\xbb)\u6309\u94ae\u9009\u62e9\u4e0a(\u4e0b)\u4e00\u5e74\u5ea6.\n" + "- \u70b9\u51fb" + String.fromCharCode(0x2039) + "(" + String.fromCharCode(0x203a) + ")\u6309\u94ae\u9009\u62e9\u4e0a(\u4e0b)\u4e2a\u6708\u4efd.\n" + "- \u957f\u65f6\u95f4\u6309\u7740\u6309\u94ae\u5c06\u51fa\u73b0\u66f4\u591a\u9009\u62e9\u9879."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "\u65f6\u95f4\u9009\u62e9:\n" + "-\u5728\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\u4e0a\u5355\u51fb\u9f20\u6807\u5de6\u952e\u6765\u589e\u52a0\u5f53\u524d\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\n" + "-\u5728\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)\u4e0a\u6309\u4f4fShift\u952e\u540e\u5355\u51fb\u9f20\u6807\u5de6\u952e\u6765\u51cf\u5c11\u5f53\u524d\u65f6\u95f4\u90e8\u5206(\u5206\u6216\u8005\u79d2)."; Calendar._TT["PREV_YEAR"] = "\u4e0a\u4e00\u5e74"; Calendar._TT["PREV_MONTH"] = "\u4e0a\u4e2a\u6708"; Calendar._TT["GO_TODAY"] = "\u5230\u4eca\u5929"; Calendar._TT["NEXT_MONTH"] = "\u4e0b\u4e2a\u6708"; Calendar._TT["NEXT_YEAR"] = "\u4e0b\u4e00\u5e74"; Calendar._TT["SEL_DATE"] = "\u9009\u62e9\u65e5\u671f"; Calendar._TT["DRAG_TO_MOVE"] = "\u62d6\u52a8"; Calendar._TT["PART_TODAY"] = " (\u4eca\u5929)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "%s\u4e3a\u8fd9\u5468\u7684\u7b2c\u4e00\u5929"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "\u5173\u95ed"; Calendar._TT["TODAY"] = "\u4eca\u5929"; Calendar._TT["TIME_PART"] = "(\u6309\u7740Shift\u952e)\u5355\u51fb\u6216\u62d6\u52a8\u6539\u53d8\u503c"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e\u65e5"; Calendar._TT["WK"] = "\u5468"; Calendar._TT["TIME"] = "\u65f6\u95f4:";
JavaScript
/* Slovenian language file for the DHTML Calendar version 0.9.2 * Author David Milost <mercy@volja.net>, January 2004. * Feel free to use this script under the terms of the GNU Lesser General * Public License, as long as you do not remove or alter this notice. */ // full day names Calendar._DN = new Array ("Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota", "Nedelja"); // short day names Calendar._SDN = new Array ("Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob", "Ned"); // short month names Calendar._SMN = new Array ("Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Avg", "Sep", "Okt", "Nov", "Dec"); // full month names Calendar._MN = new Array ("Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"); // tooltips // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "O koledarju"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "Za zadnjo verzijo pojdine na naslov: http://www.dynarch.com/projects/calendar/\n" + "Distribuirano pod GNU LGPL. Poglejte http://gnu.org/licenses/lgpl.html za podrobnosti." + "\n\n" + "Izbor datuma:\n" + "- Uporabite \xab, \xbb gumbe za izbor leta\n" + "- Uporabite " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " gumbe za izbor meseca\n" + "- Zadržite klik na kateremkoli od zgornjih gumbov za hiter izbor."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Izbor ćasa:\n" + "- Kliknite na katerikoli del ćasa za poveć. le-tega\n" + "- ali Shift-click za zmanj. le-tega\n" + "- ali kliknite in povlecite za hiter izbor."; Calendar._TT["TOGGLE"] = "Spremeni dan s katerim se prićne teden"; Calendar._TT["PREV_YEAR"] = "Predhodnje leto (dolg klik za meni)"; Calendar._TT["PREV_MONTH"] = "Predhodnji mesec (dolg klik za meni)"; Calendar._TT["GO_TODAY"] = "Pojdi na tekoći dan"; Calendar._TT["NEXT_MONTH"] = "Naslednji mesec (dolg klik za meni)"; Calendar._TT["NEXT_YEAR"] = "Naslednje leto (dolg klik za meni)"; Calendar._TT["SEL_DATE"] = "Izberite datum"; Calendar._TT["DRAG_TO_MOVE"] = "Pritisni in povleci za spremembo pozicije"; Calendar._TT["PART_TODAY"] = " (danes)"; Calendar._TT["MON_FIRST"] = "Prikaži ponedeljek kot prvi dan"; Calendar._TT["SUN_FIRST"] = "Prikaži nedeljo kot prvi dan"; Calendar._TT["CLOSE"] = "Zapri"; Calendar._TT["TODAY"] = "Danes"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "Ted";
JavaScript
// ** I18N // Calendar ZH language // Author: muziq, <muziq@sina.com> // Encoding: GB2312 or GBK // Distributed under the same terms as the calendar itself. // full day names Calendar._DN = new Array ("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("日", "一", "二", "三", "四", "五", "六", "日"); // First day of the week. "0" means display Sunday first, "1" means display // Monday first, etc. Calendar._FD = 0; // full month names Calendar._MN = new Array ("一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"); // short month names Calendar._SMN = new Array ("一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "帮助"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For latest version visit: http://www.dynarch.com/projects/calendar/\n" + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "选择日期:\n" + "- 点击 \xab, \xbb 按钮选择年份\n" + "- 点击 " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " 按钮选择月份\n" + "- 长按以上按钮可从菜单中快速选择年份或月份"; Calendar._TT["ABOUT_TIME"] = "\n\n" + "选择时间:\n" + "- 点击小时或分钟可使改数值加一\n" + "- 按住Shift键点击小时或分钟可使改数值减一\n" + "- 点击拖动鼠标可进行快速选择"; Calendar._TT["PREV_YEAR"] = "上一年 (按住出菜单)"; Calendar._TT["PREV_MONTH"] = "上一月 (按住出菜单)"; Calendar._TT["GO_TODAY"] = "转到今日"; Calendar._TT["NEXT_MONTH"] = "下一月 (按住出菜单)"; Calendar._TT["NEXT_YEAR"] = "下一年 (按住出菜单)"; Calendar._TT["SEL_DATE"] = "选择日期"; Calendar._TT["DRAG_TO_MOVE"] = "拖动"; Calendar._TT["PART_TODAY"] = " (今日)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "最左边显示%s"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "关闭"; Calendar._TT["TODAY"] = "今日"; Calendar._TT["TIME_PART"] = "(Shift-)点击鼠标或拖动改变值"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%A, %b %e日"; Calendar._TT["WK"] = "周"; Calendar._TT["TIME"] = "时间:";
JavaScript
// ** I18N // Calendar EN language // Author: Idan Sofer, <idan@idanso.dyndns.org> // Encoding: UTF-8 // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("א", "ב", "ג", "ד", "ה", "ו", "ש", "א"); // full month names Calendar._MN = new Array ("ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"); // short month names Calendar._SMN = new Array ("ינא", "פבר", "מרץ", "אפר", "מאי", "יונ", "יול", "אוג", "ספט", "אוק", "נוב", "דצמ"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "אודות השנתון"; Calendar._TT["ABOUT"] = "בחרן תאריך/שעה DHTML\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "הגירסא האחרונה זמינה ב: http://www.dynarch.com/projects/calendar/\n" + "מופץ תחת זיכיון ה GNU LGPL. עיין ב http://gnu.org/licenses/lgpl.html לפרטים נוספים." + "\n\n" + בחירת תאריך:\n" + "- השתמש בכפתורים \xab, \xbb לבחירת שנה\n" + "- השתמש בכפתורים " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " לבחירת חודש\n" + "- החזק העכבר לחוץ מעל הכפתורים המוזכרים לעיל לבחירה מהירה יותר."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "בחירת זמן:\n" + "- לחץ על כל אחד מחלקי הזמן כדי להוסיף\n" + "- או shift בשילוב עם לחיצה כדי להחסיר\n" + "- או לחץ וגרור לפעולה מהירה יותר."; Calendar._TT["PREV_YEAR"] = "שנה קודמת - החזק לקבלת תפריט"; Calendar._TT["PREV_MONTH"] = "חודש קודם - החזק לקבלת תפריט"; Calendar._TT["GO_TODAY"] = "עבור להיום"; Calendar._TT["NEXT_MONTH"] = "חודש הבא - החזק לתפריט"; Calendar._TT["NEXT_YEAR"] = "שנה הבאה - החזק לתפריט"; Calendar._TT["SEL_DATE"] = "בחר תאריך"; Calendar._TT["DRAG_TO_MOVE"] = "גרור להזזה"; Calendar._TT["PART_TODAY"] = " )היום("; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "הצג %s קודם"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "6"; Calendar._TT["CLOSE"] = "סגור"; Calendar._TT["TODAY"] = "היום"; Calendar._TT["TIME_PART"] = "(שיפט-)לחץ וגרור כדי לשנות ערך"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "wk"; Calendar._TT["TIME"] = "שעה::";
JavaScript
/* Croatian language file for the DHTML Calendar version 0.9.2 * Author Krunoslav Zubrinic <krunoslav.zubrinic@vip.hr>, June 2003. * Feel free to use this script under the terms of the GNU Lesser General * Public License, as long as you do not remove or alter this notice. */ Calendar._DN = new Array ("Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota", "Nedjelja"); Calendar._MN = new Array ("Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"); // tooltips Calendar._TT = {}; Calendar._TT["TOGGLE"] = "Promjeni dan s kojim počinje tjedan"; Calendar._TT["PREV_YEAR"] = "Prethodna godina (dugi pritisak za meni)"; Calendar._TT["PREV_MONTH"] = "Prethodni mjesec (dugi pritisak za meni)"; Calendar._TT["GO_TODAY"] = "Idi na tekući dan"; Calendar._TT["NEXT_MONTH"] = "Slijedeći mjesec (dugi pritisak za meni)"; Calendar._TT["NEXT_YEAR"] = "Slijedeća godina (dugi pritisak za meni)"; Calendar._TT["SEL_DATE"] = "Izaberite datum"; Calendar._TT["DRAG_TO_MOVE"] = "Pritisni i povuci za promjenu pozicije"; Calendar._TT["PART_TODAY"] = " (today)"; Calendar._TT["MON_FIRST"] = "Prikaži ponedjeljak kao prvi dan"; Calendar._TT["SUN_FIRST"] = "Prikaži nedjelju kao prvi dan"; Calendar._TT["CLOSE"] = "Zatvori"; Calendar._TT["TODAY"] = "Danas"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y"; Calendar._TT["TT_DATE_FORMAT"] = "DD, dd.mm.y"; Calendar._TT["WK"] = "Tje";
JavaScript
// ** I18N // Calendar pt-BR language // Author: Fernando Dourado, <fernando.dourado@ig.com.br> // Encoding: any // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sabádo", "Domingo"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names // [No changes using default values] // full month names Calendar._MN = new Array ("Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"); // short month names // [No changes using default values] // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Sobre o calendário"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For latest version visit: http://www.dynarch.com/projects/calendar/\n" + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "Translate to portuguese Brazil (pt-BR) by Fernando Dourado (fernando.dourado@ig.com.br)\n" + "Tradução para o português Brasil (pt-BR) por Fernando Dourado (fernando.dourado@ig.com.br)" + "\n\n" + "Selecionar data:\n" + "- Use as teclas \xab, \xbb para selecionar o ano\n" + "- Use as teclas " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para selecionar o mês\n" + "- Clique e segure com o mouse em qualquer botão para selecionar rapidamente."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Selecionar hora:\n" + "- Clique em qualquer uma das partes da hora para aumentar\n" + "- ou Shift-clique para diminuir\n" + "- ou clique e arraste para selecionar rapidamente."; Calendar._TT["PREV_YEAR"] = "Ano anterior (clique e segure para menu)"; Calendar._TT["PREV_MONTH"] = "Mês anterior (clique e segure para menu)"; Calendar._TT["GO_TODAY"] = "Ir para a data atual"; Calendar._TT["NEXT_MONTH"] = "Próximo mês (clique e segure para menu)"; Calendar._TT["NEXT_YEAR"] = "Próximo ano (clique e segure para menu)"; Calendar._TT["SEL_DATE"] = "Selecione uma data"; Calendar._TT["DRAG_TO_MOVE"] = "Clique e segure para mover"; Calendar._TT["PART_TODAY"] = " (hoje)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "Exibir %s primeiro"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Fechar"; Calendar._TT["TODAY"] = "Hoje"; Calendar._TT["TIME_PART"] = "(Shift-)Clique ou arraste para mudar o valor"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; Calendar._TT["TT_DATE_FORMAT"] = "%d de %B de %Y"; Calendar._TT["WK"] = "sem"; Calendar._TT["TIME"] = "Hora:";
JavaScript
// ** I18N // Calendar SK language // Author: Peter Valach (pvalach@gmx.net) // Encoding: utf-8 // Last update: 2003/10/29 // Distributed under the same terms as the calendar itself. // full day names Calendar._DN = new Array ("Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota", "Nedeľa"); // short day names Calendar._SDN = new Array ("Ned", "Pon", "Uto", "Str", "Štv", "Pia", "Sob", "Ned"); // full month names Calendar._MN = new Array ("Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"); // short month names Calendar._SMN = new Array ("Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "O kalendári"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + "Poslednú verziu nájdete na: http://www.dynarch.com/projects/calendar/\n" + "Distribuované pod GNU LGPL. Viď http://gnu.org/licenses/lgpl.html pre detaily." + "\n\n" + "Výber dátumu:\n" + "- Použite tlačidlá \xab, \xbb pre výber roku\n" + "- Použite tlačidlá " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " pre výber mesiaca\n" + "- Ak ktorékoľvek z týchto tlačidiel podržíte dlhšie, zobrazí sa rýchly výber."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Výber času:\n" + "- Kliknutie na niektorú položku času ju zvýši\n" + "- Shift-klik ju zníži\n" + "- Ak podržíte tlačítko stlačené, posúvaním meníte hodnotu."; Calendar._TT["PREV_YEAR"] = "Predošlý rok (podržte pre menu)"; Calendar._TT["PREV_MONTH"] = "Predošlý mesiac (podržte pre menu)"; Calendar._TT["GO_TODAY"] = "Prejsť na dnešok"; Calendar._TT["NEXT_MONTH"] = "Nasl. mesiac (podržte pre menu)"; Calendar._TT["NEXT_YEAR"] = "Nasl. rok (podržte pre menu)"; Calendar._TT["SEL_DATE"] = "Zvoľte dátum"; Calendar._TT["DRAG_TO_MOVE"] = "Podržaním tlačítka zmeníte polohu"; Calendar._TT["PART_TODAY"] = " (dnes)"; Calendar._TT["MON_FIRST"] = "Zobraziť pondelok ako prvý"; Calendar._TT["SUN_FIRST"] = "Zobraziť nedeľu ako prvú"; Calendar._TT["CLOSE"] = "Zavrieť"; Calendar._TT["TODAY"] = "Dnes"; Calendar._TT["TIME_PART"] = "(Shift-)klik/ťahanie zmení hodnotu"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "$d. %m. %Y"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %e. %b"; Calendar._TT["WK"] = "týž";
JavaScript
// ** I18N Calendar._DN = new Array ("Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο", "Κυριακή"); Calendar._SDN = new Array ("Κυ", "Δε", "Tρ", "Τε", "Πε", "Πα", "Σα", "Κυ"); Calendar._MN = new Array ("Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάϊος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"); Calendar._SMN = new Array ("Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαι", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Για το ημερολόγιο"; Calendar._TT["ABOUT"] = "Επιλογέας ημερομηνίας/ώρας σε DHTML\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "Για τελευταία έκδοση: http://www.dynarch.com/projects/calendar/\n" + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "Επιλογή ημερομηνίας:\n" + "- Χρησιμοποιείστε τα κουμπιά \xab, \xbb για επιλογή έτους\n" + "- Χρησιμοποιείστε τα κουμπιά " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " για επιλογή μήνα\n" + "- Κρατήστε κουμπί ποντικού πατημένο στα παραπάνω κουμπιά για πιο γρήγορη επιλογή."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Επιλογή ώρας:\n" + "- Κάντε κλικ σε ένα από τα μέρη της ώρας για αύξηση\n" + "- ή Shift-κλικ για μείωση\n" + "- ή κλικ και μετακίνηση για πιο γρήγορη επιλογή."; Calendar._TT["TOGGLE"] = "Μπάρα πρώτης ημέρας της εβδομάδας"; Calendar._TT["PREV_YEAR"] = "Προηγ. έτος (κρατήστε για το μενού)"; Calendar._TT["PREV_MONTH"] = "Προηγ. μήνας (κρατήστε για το μενού)"; Calendar._TT["GO_TODAY"] = "Σήμερα"; Calendar._TT["NEXT_MONTH"] = "Επόμενος μήνας (κρατήστε για το μενού)"; Calendar._TT["NEXT_YEAR"] = "Επόμενο έτος (κρατήστε για το μενού)"; Calendar._TT["SEL_DATE"] = "Επιλέξτε ημερομηνία"; Calendar._TT["DRAG_TO_MOVE"] = "Σύρτε για να μετακινήσετε"; Calendar._TT["PART_TODAY"] = " (σήμερα)"; Calendar._TT["MON_FIRST"] = "Εμφάνιση Δευτέρας πρώτα"; Calendar._TT["SUN_FIRST"] = "Εμφάνιση Κυριακής πρώτα"; Calendar._TT["CLOSE"] = "Κλείσιμο"; Calendar._TT["TODAY"] = "Σήμερα"; Calendar._TT["TIME_PART"] = "(Shift-)κλικ ή μετακίνηση για αλλαγή"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "dd-mm-y"; Calendar._TT["TT_DATE_FORMAT"] = "D, d M"; Calendar._TT["WK"] = "εβδ";
JavaScript
// Calendar ALBANIAN language //author Rigels Gordani rige@hotmail.com // ditet Calendar._DN = new Array ("E Diele", "E Hene", "E Marte", "E Merkure", "E Enjte", "E Premte", "E Shtune", "E Diele"); //ditet shkurt Calendar._SDN = new Array ("Die", "Hen", "Mar", "Mer", "Enj", "Pre", "Sht", "Die"); // muajt Calendar._MN = new Array ("Janar", "Shkurt", "Mars", "Prill", "Maj", "Qeshor", "Korrik", "Gusht", "Shtator", "Tetor", "Nentor", "Dhjetor"); // muajte shkurt Calendar._SMN = new Array ("Jan", "Shk", "Mar", "Pri", "Maj", "Qes", "Kor", "Gus", "Sht", "Tet", "Nen", "Dhj"); // ndihmesa Calendar._TT = {}; Calendar._TT["INFO"] = "Per kalendarin"; Calendar._TT["ABOUT"] = "Zgjedhes i ores/dates ne DHTML \n" + "\n\n" +"Zgjedhja e Dates:\n" + "- Perdor butonat \xab, \xbb per te zgjedhur vitin\n" + "- Perdor butonat" + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " per te zgjedhur muajin\n" + "- Mbani shtypur butonin e mousit per nje zgjedje me te shpejte."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Zgjedhja e kohes:\n" + "- Kliko tek ndonje nga pjeset e ores per ta rritur ate\n" + "- ose kliko me Shift per ta zvogeluar ate\n" + "- ose cliko dhe terhiq per zgjedhje me te shpejte."; Calendar._TT["PREV_YEAR"] = "Viti i shkuar (prit per menune)"; Calendar._TT["PREV_MONTH"] = "Muaji i shkuar (prit per menune)"; Calendar._TT["GO_TODAY"] = "Sot"; Calendar._TT["NEXT_MONTH"] = "Muaji i ardhshem (prit per menune)"; Calendar._TT["NEXT_YEAR"] = "Viti i ardhshem (prit per menune)"; Calendar._TT["SEL_DATE"] = "Zgjidh daten"; Calendar._TT["DRAG_TO_MOVE"] = "Terhiqe per te levizur"; Calendar._TT["PART_TODAY"] = " (sot)"; // "%s" eshte dita e pare e javes // %s do te zevendesohet me emrin e dite Calendar._TT["DAY_FIRST"] = "Trego te %s te paren"; Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Mbyll"; Calendar._TT["TODAY"] = "Sot"; Calendar._TT["TIME_PART"] = "Kliko me (Shift-)ose terhiqe per te ndryshuar vleren"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "Java"; Calendar._TT["TIME"] = "Koha:";
JavaScript
// ** I18N // Calendar EN language // Author: Mihai Bazon, <mihai_bazon@yahoo.com> // Encoding: any // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"); // First day of the week. "0" means display Sunday first, "1" means display // Monday first, etc. Calendar._FD = 0; // full month names Calendar._MN = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); // short month names Calendar._SMN = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "About the calendar"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For latest version visit: http://www.dynarch.com/projects/calendar/\n" + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "Date selection:\n" + "- Use the \xab, \xbb buttons to select year\n" + "- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" + "- Hold mouse button on any of the above buttons for faster selection."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Time selection:\n" + "- Click on any of the time parts to increase it\n" + "- or Shift-click to decrease it\n" + "- or click and drag for faster selection."; Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; Calendar._TT["GO_TODAY"] = "Go Today"; Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; Calendar._TT["SEL_DATE"] = "Select date"; Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; Calendar._TT["PART_TODAY"] = " (today)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "Display %s first"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Close"; Calendar._TT["TODAY"] = "Today"; Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "wk"; Calendar._TT["TIME"] = "Time:";
JavaScript
// ** I18N // Calendar PL language // Author: Artur Filipiak, <imagen@poczta.fm> // January, 2004 // Encoding: UTF-8 Calendar._DN = new Array ("Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela"); Calendar._SDN = new Array ("N", "Pn", "Wt", "Śr", "Cz", "Pt", "So", "N"); Calendar._MN = new Array ("Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"); Calendar._SMN = new Array ("Sty", "Lut", "Mar", "Kwi", "Maj", "Cze", "Lip", "Sie", "Wrz", "Paź", "Lis", "Gru"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "O kalendarzu"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For latest version visit: http://www.dynarch.com/projects/calendar/\n" + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "Wybór daty:\n" + "- aby wybrać rok użyj przycisków \xab, \xbb\n" + "- aby wybrać miesiąc użyj przycisków " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" + "- aby przyspieszyć wybór przytrzymaj wciśnięty przycisk myszy nad ww. przyciskami."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Wybór czasu:\n" + "- aby zwiększyć wartość kliknij na dowolnym elemencie selekcji czasu\n" + "- aby zmniejszyć wartość użyj dodatkowo klawisza Shift\n" + "- możesz również poruszać myszkę w lewo i prawo wraz z wciśniętym lewym klawiszem."; Calendar._TT["PREV_YEAR"] = "Poprz. rok (przytrzymaj dla menu)"; Calendar._TT["PREV_MONTH"] = "Poprz. miesiąc (przytrzymaj dla menu)"; Calendar._TT["GO_TODAY"] = "Pokaż dziś"; Calendar._TT["NEXT_MONTH"] = "Nast. miesiąc (przytrzymaj dla menu)"; Calendar._TT["NEXT_YEAR"] = "Nast. rok (przytrzymaj dla menu)"; Calendar._TT["SEL_DATE"] = "Wybierz datę"; Calendar._TT["DRAG_TO_MOVE"] = "Przesuń okienko"; Calendar._TT["PART_TODAY"] = " (dziś)"; Calendar._TT["MON_FIRST"] = "Pokaż Poniedziałek jako pierwszy"; Calendar._TT["SUN_FIRST"] = "Pokaż Niedzielę jako pierwszą"; Calendar._TT["CLOSE"] = "Zamknij"; Calendar._TT["TODAY"] = "Dziś"; Calendar._TT["TIME_PART"] = "(Shift-)klik | drag, aby zmienić wartość"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y.%m.%d"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "wk";
JavaScript
// ** I18N // Calendar RU language // Translation: Sly Golovanov, http://golovanov.net, <sly@golovanov.net> // Encoding: any // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота", "воскресенье"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("вск", "пон", "втр", "срд", "чет", "пят", "суб", "вск"); // full month names Calendar._MN = new Array ("январь", "февраль", "март", "апрель", "май", "июнь", "июль", "август", "сентябрь", "октябрь", "ноябрь", "декабрь"); // short month names Calendar._SMN = new Array ("янв", "фев", "мар", "апр", "май", "июн", "июл", "авг", "сен", "окт", "ноя", "дек"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "О календаре..."; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For latest version visit: http://www.dynarch.com/projects/calendar/\n" + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "Как выбрать дату:\n" + "- При помощи кнопок \xab, \xbb можно выбрать год\n" + "- При помощи кнопок " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " можно выбрать месяц\n" + "- Подержите эти кнопки нажатыми, чтобы появилось меню быстрого выбора."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Как выбрать время:\n" + "- При клике на часах или минутах они увеличиваются\n" + "- при клике с нажатой клавишей Shift они уменьшаются\n" + "- если нажать и двигать мышкой влево/вправо, они будут меняться быстрее."; Calendar._TT["PREV_YEAR"] = "На год назад (удерживать для меню)"; Calendar._TT["PREV_MONTH"] = "На месяц назад (удерживать для меню)"; Calendar._TT["GO_TODAY"] = "Сегодня"; Calendar._TT["NEXT_MONTH"] = "На месяц вперед (удерживать для меню)"; Calendar._TT["NEXT_YEAR"] = "На год вперед (удерживать для меню)"; Calendar._TT["SEL_DATE"] = "Выберите дату"; Calendar._TT["DRAG_TO_MOVE"] = "Перетаскивайте мышкой"; Calendar._TT["PART_TODAY"] = " (сегодня)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "Первый день недели будет %s"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Закрыть"; Calendar._TT["TODAY"] = "Сегодня"; Calendar._TT["TIME_PART"] = "(Shift-)клик или нажать и двигать"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%e %b, %a"; Calendar._TT["WK"] = "нед"; Calendar._TT["TIME"] = "Время:";
JavaScript
// ** I18N // Calendar DE language // Author: Jack (tR), <jack@jtr.de> // Encoding: any // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"); // full month names Calendar._MN = new Array ("Januar", "Februar", "M\u00e4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"); // short month names Calendar._SMN = new Array ("Jan", "Feb", "M\u00e4r", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "\u00DCber dieses Kalendarmodul"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this ;-) "For latest version visit: http://www.dynarch.com/projects/calendar/\n" + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "Datum ausw\u00e4hlen:\n" + "- Benutzen Sie die \xab, \xbb Buttons um das Jahr zu w\u00e4hlen\n" + "- Benutzen Sie die " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " Buttons um den Monat zu w\u00e4hlen\n" + "- F\u00fcr eine Schnellauswahl halten Sie die Maustaste \u00fcber diesen Buttons fest."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Zeit ausw\u00e4hlen:\n" + "- Klicken Sie auf die Teile der Uhrzeit, um diese zu erh\u00F6hen\n" + "- oder klicken Sie mit festgehaltener Shift-Taste um diese zu verringern\n" + "- oder klicken und festhalten f\u00fcr Schnellauswahl."; Calendar._TT["TOGGLE"] = "Ersten Tag der Woche w\u00e4hlen"; Calendar._TT["PREV_YEAR"] = "Voriges Jahr (Festhalten f\u00fcr Schnellauswahl)"; Calendar._TT["PREV_MONTH"] = "Voriger Monat (Festhalten f\u00fcr Schnellauswahl)"; Calendar._TT["GO_TODAY"] = "Heute ausw\u00e4hlen"; Calendar._TT["NEXT_MONTH"] = "N\u00e4chst. Monat (Festhalten f\u00fcr Schnellauswahl)"; Calendar._TT["NEXT_YEAR"] = "N\u00e4chst. Jahr (Festhalten f\u00fcr Schnellauswahl)"; Calendar._TT["SEL_DATE"] = "Datum ausw\u00e4hlen"; Calendar._TT["DRAG_TO_MOVE"] = "Zum Bewegen festhalten"; Calendar._TT["PART_TODAY"] = " (Heute)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "Woche beginnt mit %s "; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Schlie\u00dfen"; Calendar._TT["TODAY"] = "Heute"; Calendar._TT["TIME_PART"] = "(Shift-)Klick oder Festhalten und Ziehen um den Wert zu \u00e4ndern"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "wk"; Calendar._TT["TIME"] = "Zeit:";
JavaScript
// ** I18N // Calendar LT language // Author: Martynas Majeris, <martynas@solmetra.lt> // Encoding: UTF-8 // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Pentadienis", "Šeštadienis", "Sekmadienis"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš", "Sek"); // full month names Calendar._MN = new Array ("Sausis", "Vasaris", "Kovas", "Balandis", "Gegužė", "Birželis", "Liepa", "Rugpjūtis", "Rugsėjis", "Spalis", "Lapkritis", "Gruodis"); // short month names Calendar._SMN = new Array ("Sau", "Vas", "Kov", "Bal", "Geg", "Bir", "Lie", "Rgp", "Rgs", "Spa", "Lap", "Gru"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Apie kalendorių"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "Naujausią versiją rasite: http://www.dynarch.com/projects/calendar/\n" + "Platinamas pagal GNU LGPL licenciją. Aplankykite http://gnu.org/licenses/lgpl.html" + "\n\n" + "Datos pasirinkimas:\n" + "- Metų pasirinkimas: \xab, \xbb\n" + "- Mėnesio pasirinkimas: " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "\n" + "- Nuspauskite ir laikykite pelės klavišą greitesniam pasirinkimui."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Laiko pasirinkimas:\n" + "- Spustelkite ant valandų arba minučių - skaičius padidės vienetu.\n" + "- Jei spausite kartu su Shift, skaičius sumažės.\n" + "- Greitam pasirinkimui spustelkite ir pajudinkite pelę."; Calendar._TT["PREV_YEAR"] = "Ankstesni metai (laikykite, jei norite meniu)"; Calendar._TT["PREV_MONTH"] = "Ankstesnis mėnuo (laikykite, jei norite meniu)"; Calendar._TT["GO_TODAY"] = "Pasirinkti šiandieną"; Calendar._TT["NEXT_MONTH"] = "Kitas mėnuo (laikykite, jei norite meniu)"; Calendar._TT["NEXT_YEAR"] = "Kiti metai (laikykite, jei norite meniu)"; Calendar._TT["SEL_DATE"] = "Pasirinkite datą"; Calendar._TT["DRAG_TO_MOVE"] = "Tempkite"; Calendar._TT["PART_TODAY"] = " (šiandien)"; Calendar._TT["MON_FIRST"] = "Pirma savaitės diena - pirmadienis"; Calendar._TT["SUN_FIRST"] = "Pirma savaitės diena - sekmadienis"; Calendar._TT["CLOSE"] = "Uždaryti"; Calendar._TT["TODAY"] = "Šiandien"; Calendar._TT["TIME_PART"] = "Spustelkite arba tempkite jei norite pakeisti"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%A, %Y-%m-%d"; Calendar._TT["WK"] = "sav";
JavaScript
// ** I18N // Calendar FI language (Finnish, Suomi) // Author: Jarno Käyhkö, <gambler@phnet.fi> // Encoding: UTF-8 // Distributed under the same terms as the calendar itself. // full day names Calendar._DN = new Array ("Sunnuntai", "Maanantai", "Tiistai", "Keskiviikko", "Torstai", "Perjantai", "Lauantai", "Sunnuntai"); // short day names Calendar._SDN = new Array ("Su", "Ma", "Ti", "Ke", "To", "Pe", "La", "Su"); // full month names Calendar._MN = new Array ("Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"); // short month names Calendar._SMN = new Array ("Tam", "Hel", "Maa", "Huh", "Tou", "Kes", "Hei", "Elo", "Syy", "Lok", "Mar", "Jou"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Tietoja kalenterista"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "Uusin versio osoitteessa: http://www.dynarch.com/projects/calendar/\n" + "Julkaistu GNU LGPL lisenssin alaisuudessa. Lisätietoja osoitteessa http://gnu.org/licenses/lgpl.html" + "\n\n" + "Päivämäärä valinta:\n" + "- Käytä \xab, \xbb painikkeita valitaksesi vuosi\n" + "- Käytä " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " painikkeita valitaksesi kuukausi\n" + "- Pitämällä hiiren painiketta minkä tahansa yllä olevan painikkeen kohdalla, saat näkyviin valikon nopeampaan siirtymiseen."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Ajan valinta:\n" + "- Klikkaa kellonajan numeroita lisätäksesi aikaa\n" + "- tai pitämällä Shift-näppäintä pohjassa saat aikaa taaksepäin\n" + "- tai klikkaa ja pidä hiiren painike pohjassa sekä liikuta hiirtä muuttaaksesi aikaa nopeasti eteen- ja taaksepäin."; Calendar._TT["PREV_YEAR"] = "Edell. vuosi (paina hetki, näet valikon)"; Calendar._TT["PREV_MONTH"] = "Edell. kuukausi (paina hetki, näet valikon)"; Calendar._TT["GO_TODAY"] = "Siirry tähän päivään"; Calendar._TT["NEXT_MONTH"] = "Seur. kuukausi (paina hetki, näet valikon)"; Calendar._TT["NEXT_YEAR"] = "Seur. vuosi (paina hetki, näet valikon)"; Calendar._TT["SEL_DATE"] = "Valitse päivämäärä"; Calendar._TT["DRAG_TO_MOVE"] = "Siirrä kalenterin paikkaa"; Calendar._TT["PART_TODAY"] = " (tänään)"; Calendar._TT["MON_FIRST"] = "Näytä maanantai ensimmäisenä"; Calendar._TT["SUN_FIRST"] = "Näytä sunnuntai ensimmäisenä"; Calendar._TT["CLOSE"] = "Sulje"; Calendar._TT["TODAY"] = "Tänään"; Calendar._TT["TIME_PART"] = "(Shift-) Klikkaa tai liikuta muuttaaksesi aikaa"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y"; Calendar._TT["TT_DATE_FORMAT"] = "%d.%m.%Y"; Calendar._TT["WK"] = "Vko";
JavaScript
// ** I18N Calendar._DN = new Array ("Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag"); Calendar._MN = new Array ("Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"); // tooltips Calendar._TT = {}; Calendar._TT["TOGGLE"] = "Toggle startdag van de week"; Calendar._TT["PREV_YEAR"] = "Vorig jaar (indrukken voor menu)"; Calendar._TT["PREV_MONTH"] = "Vorige month (indrukken voor menu)"; Calendar._TT["GO_TODAY"] = "Naar Vandaag"; Calendar._TT["NEXT_MONTH"] = "Volgende Maand (indrukken voor menu)"; Calendar._TT["NEXT_YEAR"] = "Volgend jaar (indrukken voor menu)"; Calendar._TT["SEL_DATE"] = "Selecteer datum"; Calendar._TT["DRAG_TO_MOVE"] = "Sleep om te verplaatsen"; Calendar._TT["PART_TODAY"] = " (vandaag)"; Calendar._TT["MON_FIRST"] = "Toon Maandag eerst"; Calendar._TT["SUN_FIRST"] = "Toon Zondag eerst"; Calendar._TT["CLOSE"] = "Sluiten"; Calendar._TT["TODAY"] = "Vandaag"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd"; Calendar._TT["TT_DATE_FORMAT"] = "D, M d"; Calendar._TT["WK"] = "wk";
JavaScript
// ** I18N // Calendar DA language // Author: Michael Thingmand Henriksen, <michael (a) thingmand dot dk> // Encoding: any // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"); // full month names Calendar._MN = new Array ("Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"); // short month names Calendar._SMN = new Array ("Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "Om Kalenderen"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For den seneste version besøg: http://www.dynarch.com/projects/calendar/\n"; + "Distribueret under GNU LGPL. Se http://gnu.org/licenses/lgpl.html for detajler." + "\n\n" + "Valg af dato:\n" + "- Brug \xab, \xbb knapperne for at vælge år\n" + "- Brug " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " knapperne for at vælge måned\n" + "- Hold knappen på musen nede på knapperne ovenfor for hurtigere valg."; Calendar._TT["ABOUT_TIME"] = "\n\n" + "Valg af tid:\n" + "- Klik på en vilkårlig del for større værdi\n" + "- eller Shift-klik for for mindre værdi\n" + "- eller klik og træk for hurtigere valg."; Calendar._TT["PREV_YEAR"] = "Ét år tilbage (hold for menu)"; Calendar._TT["PREV_MONTH"] = "Én måned tilbage (hold for menu)"; Calendar._TT["GO_TODAY"] = "Gå til i dag"; Calendar._TT["NEXT_MONTH"] = "Én måned frem (hold for menu)"; Calendar._TT["NEXT_YEAR"] = "Ét år frem (hold for menu)"; Calendar._TT["SEL_DATE"] = "Vælg dag"; Calendar._TT["DRAG_TO_MOVE"] = "Træk vinduet"; Calendar._TT["PART_TODAY"] = " (i dag)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "Vis %s først"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "Luk"; Calendar._TT["TODAY"] = "I dag"; Calendar._TT["TIME_PART"] = "(Shift-)klik eller træk for at ændre værdi"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%d-%m-%Y"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "Uge"; Calendar._TT["TIME"] = "Tid:";
JavaScript
// ** I18N // Calendar big5-utf8 language // Author: Gary Fu, <gary@garyfu.idv.tw> // Encoding: utf8 // Distributed under the same terms as the calendar itself. // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. // full day names Calendar._DN = new Array ("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"); // Please note that the following array of short day names (and the same goes // for short month names, _SMN) isn't absolutely necessary. We give it here // for exemplification on how one can customize the short day names, but if // they are simply the first N letters of the full name you can simply say: // // Calendar._SDN_len = N; // short day name length // Calendar._SMN_len = N; // short month name length // // If N = 3 then this is not needed either since we assume a value of 3 if not // present, to be compatible with translation files that were written before // this feature. // short day names Calendar._SDN = new Array ("日", "一", "二", "三", "四", "五", "六", "日"); // full month names Calendar._MN = new Array ("一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"); // short month names Calendar._SMN = new Array ("一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"); // tooltips Calendar._TT = {}; Calendar._TT["INFO"] = "關於"; Calendar._TT["ABOUT"] = "DHTML Date/Time Selector\n" + "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) "For latest version visit: http://www.dynarch.com/projects/calendar/\n" + "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + "\n\n" + "日期選擇方法:\n" + "- 使用 \xab, \xbb 按鈕可選擇年份\n" + "- 使用 " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " 按鈕可選擇月份\n" + "- 按住上面的按鈕可以加快選取"; Calendar._TT["ABOUT_TIME"] = "\n\n" + "時間選擇方法:\n" + "- 點擊任何的時間部份可增加其值\n" + "- 同時按Shift鍵再點擊可減少其值\n" + "- 點擊並拖曳可加快改變的值"; Calendar._TT["PREV_YEAR"] = "上一年 (按住選單)"; Calendar._TT["PREV_MONTH"] = "下一年 (按住選單)"; Calendar._TT["GO_TODAY"] = "到今日"; Calendar._TT["NEXT_MONTH"] = "上一月 (按住選單)"; Calendar._TT["NEXT_YEAR"] = "下一月 (按住選單)"; Calendar._TT["SEL_DATE"] = "選擇日期"; Calendar._TT["DRAG_TO_MOVE"] = "拖曳"; Calendar._TT["PART_TODAY"] = " (今日)"; // the following is to inform that "%s" is to be the first day of week // %s will be replaced with the day name. Calendar._TT["DAY_FIRST"] = "將 %s 顯示在前"; // This may be locale-dependent. It specifies the week-end days, as an array // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 // means Monday, etc. Calendar._TT["WEEKEND"] = "0,6"; Calendar._TT["CLOSE"] = "關閉"; Calendar._TT["TODAY"] = "今日"; Calendar._TT["TIME_PART"] = "點擊or拖曳可改變時間(同時按Shift為減)"; // date formats Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; Calendar._TT["WK"] = "週"; Calendar._TT["TIME"] = "Time:";
JavaScript
<?xml version="1.0" encoding="utf-8"?> <project path="" name="Ext - Resources" author="Ext JS, LLC" version="1.1 RC 1" copyright="Ext JS Library $version&#xD;&#xA;Copyright(c) 2006-2007, $author.&#xD;&#xA;licensing@extjs.com&#xD;&#xA;&#xD;&#xA;http://www.extjs.com/license" output="C:\apps\www\deploy\ext-1.1-rc1\resources" source="true" source-dir="$output" minify="False" min-dir="$output\build" doc="False" doc-dir="$output\docs" master="true" master-file="$output\yui-ext.js" zip="true" zip-file="$output\yuo-ext.$version.zip"> <directory name="" /> <target name="All css" file="$output\css\ext-all.css" debug="True" shorthand="False" shorthand-list="YAHOO.util.Dom.setStyle&#xD;&#xA;YAHOO.util.Dom.getStyle&#xD;&#xA;YAHOO.util.Dom.getRegion&#xD;&#xA;YAHOO.util.Dom.getViewportHeight&#xD;&#xA;YAHOO.util.Dom.getViewportWidth&#xD;&#xA;YAHOO.util.Dom.get&#xD;&#xA;YAHOO.util.Dom.getXY&#xD;&#xA;YAHOO.util.Dom.setXY&#xD;&#xA;YAHOO.util.CustomEvent&#xD;&#xA;YAHOO.util.Event.addListener&#xD;&#xA;YAHOO.util.Event.getEvent&#xD;&#xA;YAHOO.util.Event.getTarget&#xD;&#xA;YAHOO.util.Event.preventDefault&#xD;&#xA;YAHOO.util.Event.stopEvent&#xD;&#xA;YAHOO.util.Event.stopPropagation&#xD;&#xA;YAHOO.util.Event.stopEvent&#xD;&#xA;YAHOO.util.Anim&#xD;&#xA;YAHOO.util.Motion&#xD;&#xA;YAHOO.util.Connect.asyncRequest&#xD;&#xA;YAHOO.util.Connect.setForm&#xD;&#xA;YAHOO.util.Dom&#xD;&#xA;YAHOO.util.Event"> <include name="css\reset-min.css" /> <include name="css\core.css" /> <include name="css\tabs.css" /> <include name="css\form.css" /> <include name="css\button.css" /> <include name="css\toolbar.css" /> <include name="css\resizable.css" /> <include name="css\grid.css" /> <include name="css\layout.css" /> <include name="css\basic-dialog.css" /> <include name="css\dd.css" /> <include name="css\tree.css" /> <include name="css\qtips.css" /> <include name="css\date-picker.css" /> <include name="css\menu.css" /> <include name="css\box.css" /> <include name="css\debug.css" /> <include name="css\combo.css" /> <include name="css\grid3.css" /> <include name="css\panel.css" /> <include name="css\window.css" /> <include name="css\tabs2.css" /> <include name="css\editor.css" /> <include name="css\layout2.css" /> <include name="css\borders.css" /> </target> <file name="images\basic-dialog\gray\close.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\dlg-bg.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\e-handle.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\hd-sprite.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\s-handle.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\gray\se-handle.gif" path="images\basic-dialog\gray" /> <file name="images\basic-dialog\btn-sprite.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\close.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\e-handle.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\hd-sprite.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\s-handle.gif" path="images\basic-dialog" /> <file name="images\basic-dialog\se-handle.gif" path="images\basic-dialog" /> <file name="images\grid\arrow-left-white.gif" path="images\grid" /> <file name="images\grid\arrow-right-white.gif" path="images\grid" /> <file name="images\grid\done.gif" path="images\grid" /> <file name="images\grid\drop-no.gif" path="images\grid" /> <file name="images\grid\drop-yes.gif" path="images\grid" /> <file name="images\grid\footer-bg.gif" path="images\grid" /> <file name="images\grid\grid-blue-hd.gif" path="images\grid" /> <file name="images\grid\grid-blue-split.gif" path="images\grid" /> <file name="images\grid\grid-loading.gif" path="images\grid" /> <file name="images\grid\grid-split.gif" path="images\grid" /> <file name="images\grid\grid-vista-hd.gif" path="images\grid" /> <file name="images\grid\invalid_line.gif" path="images\grid" /> <file name="images\grid\loading.gif" path="images\grid" /> <file name="images\grid\mso-hd.gif" path="images\grid" /> <file name="images\grid\nowait.gif" path="images\grid" /> <file name="images\grid\page-first-disabled.gif" path="images\grid" /> <file name="images\grid\page-first.gif" path="images\grid" /> <file name="images\grid\page-last-disabled.gif" path="images\grid" /> <file name="images\grid\page-last.gif" path="images\grid" /> <file name="images\grid\page-next-disabled.gif" path="images\grid" /> <file name="images\grid\page-next.gif" path="images\grid" /> <file name="images\grid\page-prev-disabled.gif" path="images\grid" /> <file name="images\grid\page-prev.gif" path="images\grid" /> <file name="images\grid\pick-button.gif" path="images\grid" /> <file name="images\grid\refresh.gif" path="images\grid" /> <file name="images\grid\sort_asc.gif" path="images\grid" /> <file name="images\grid\sort_desc.gif" path="images\grid" /> <file name="images\grid\wait.gif" path="images\grid" /> <file name="images\layout\gray\collapse.gif" path="images\layout\gray" /> <file name="images\layout\gray\expand.gif" path="images\layout\gray" /> <file name="images\layout\gray\gradient-bg.gif" path="images\layout\gray" /> <file name="images\layout\gray\ns-collapse.gif" path="images\layout\gray" /> <file name="images\layout\gray\ns-expand.gif" path="images\layout\gray" /> <file name="images\layout\gray\panel-close.gif" path="images\layout\gray" /> <file name="images\layout\gray\panel-title-bg.gif" path="images\layout\gray" /> <file name="images\layout\gray\panel-title-light-bg.gif" path="images\layout\gray" /> <file name="images\layout\gray\screenshot.gif" path="images\layout\gray" /> <file name="images\layout\gray\tab-close-on.gif" path="images\layout\gray" /> <file name="images\layout\gray\tab-close.gif" path="images\layout\gray" /> <file name="images\layout\collapse.gif" path="images\layout" /> <file name="images\layout\expand.gif" path="images\layout" /> <file name="images\layout\gradient-bg.gif" path="images\layout" /> <file name="images\layout\ns-collapse.gif" path="images\layout" /> <file name="images\layout\ns-expand.gif" path="images\layout" /> <file name="images\layout\panel-close.gif" path="images\layout" /> <file name="images\layout\panel-title-bg.gif" path="images\layout" /> <file name="images\layout\panel-title-light-bg.gif" path="images\layout" /> <file name="images\layout\tab-close-on.gif" path="images\layout" /> <file name="images\layout\tab-close.gif" path="images\layout" /> <file name="images\sizer\gray\e-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\e-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\ne-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\ne-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\nw-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\nw-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\s-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\s-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\se-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\se-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\sw-handle-dark.gif" path="images\sizer\gray" /> <file name="images\sizer\gray\sw-handle.gif" path="images\sizer\gray" /> <file name="images\sizer\e-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\e-handle.gif" path="images\sizer" /> <file name="images\sizer\ne-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\ne-handle.gif" path="images\sizer" /> <file name="images\sizer\nw-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\nw-handle.gif" path="images\sizer" /> <file name="images\sizer\s-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\s-handle.gif" path="images\sizer" /> <file name="images\sizer\se-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\se-handle.gif" path="images\sizer" /> <file name="images\sizer\square.gif" path="images\sizer" /> <file name="images\sizer\sw-handle-dark.gif" path="images\sizer" /> <file name="images\sizer\sw-handle.gif" path="images\sizer" /> <file name="images\tabs\gray\tab-btm-inactive-left-bg.gif" path="images\tabs\gray" /> <file name="images\tabs\gray\tab-btm-inactive-right-bg.gif" path="images\tabs\gray" /> <file name="images\tabs\gray\tab-btm-left-bg.gif" path="images\tabs\gray" /> <file name="images\tabs\gray\tab-btm-right-bg.gif" path="images\tabs\gray" /> <file name="images\tabs\gray\tab-sprite.gif" path="images\tabs\gray" /> <file name="images\tabs\tab-btm-inactive-left-bg.gif" path="images\tabs" /> <file name="images\tabs\tab-btm-inactive-right-bg.gif" path="images\tabs" /> <file name="images\tabs\tab-btm-left-bg.gif" path="images\tabs" /> <file name="images\tabs\tab-btm-right-bg.gif" path="images\tabs" /> <file name="images\tabs\tab-sprite.gif" path="images\tabs" /> <file name="images\toolbar\gray-bg.gif" path="images\toolbar" /> <file name="images\gradient-bg.gif" path="images" /> <file name="images\s.gif" path="images" /> <file name="images\toolbar\btn-over-bg.gif" path="images\toolbar" /> <file name="images\dd\drop-add.gif" path="images\dd" /> <file name="images\dd\drop-no.gif" path="images\dd" /> <file name="images\dd\drop-yes.gif" path="images\dd" /> <file name="images\qtip\bg.gif" path="images\qtip" /> <file name="images\tree\drop-add.gif" path="images\tree" /> <file name="images\tree\drop-between.gif" path="images\tree" /> <file name="images\tree\drop-no.gif" path="images\tree" /> <file name="images\tree\drop-over.gif" path="images\tree" /> <file name="images\tree\drop-under.gif" path="images\tree" /> <file name="images\tree\drop-yes.gif" path="images\tree" /> <file name="images\tree\elbow-end-minus-nl.gif" path="images\tree" /> <file name="images\tree\elbow-end-minus.gif" path="images\tree" /> <file name="images\tree\elbow-end-plus-nl.gif" path="images\tree" /> <file name="images\tree\elbow-end-plus.gif" path="images\tree" /> <file name="images\tree\elbow-end.gif" path="images\tree" /> <file name="images\tree\elbow-line.gif" path="images\tree" /> <file name="images\tree\elbow-minus-nl.gif" path="images\tree" /> <file name="images\tree\elbow-minus.gif" path="images\tree" /> <file name="images\tree\elbow-plus-nl.gif" path="images\tree" /> <file name="images\tree\elbow-plus.gif" path="images\tree" /> <file name="images\tree\elbow.gif" path="images\tree" /> <file name="images\tree\folder-open.gif" path="images\tree" /> <file name="images\tree\folder.gif" path="images\tree" /> <file name="images\tree\leaf.gif" path="images\tree" /> <file name="images\tree\s.gif" path="images\tree" /> <file name="images\qtip\gray\bg.gif" path="images\qtip\gray" /> <file name="css\aero.css" path="css" /> <file name="images\grid\grid-hrow.gif" path="images\grid" /> <file name="images\aero\toolbar\gray-bg.gif" path="images\aero\toolbar" /> <file name="css\basic-dialog.css" path="css" /> <file name="css\button.css" path="css" /> <file name="css\core.css" path="css" /> <file name="css\dd.css" path="css" /> <file name="css\grid.css" path="css" /> <file name="css\inline-editor.css" path="css" /> <file name="css\layout.css" path="css" /> <file name="css\qtips.css" path="css" /> <file name="css\reset-min.css" path="css" /> <file name="css\resizable.css" path="css" /> <file name="css\tabs.css" path="css" /> <file name="css\toolbar.css" path="css" /> <file name="css\tree.css" path="css" /> <file name="css\ytheme-aero.css" path="css" /> <file name="css\ytheme-gray.css" path="css" /> <file name="css\ytheme-vista.css" path="css" /> <file name="images\aero\basic-dialog\aero-close-over.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\aero-close.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\bg-center.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\bg-left.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\bg-right.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\close.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\dlg-bg.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\e-handle.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\hd-sprite.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\s-handle.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\se-handle.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\w-handle.gif" path="images\aero\basic-dialog" /> <file name="images\aero\grid\grid-blue-split.gif" path="images\aero\grid" /> <file name="images\aero\grid\grid-hrow.gif" path="images\aero\grid" /> <file name="images\aero\grid\grid-split.gif" path="images\aero\grid" /> <file name="images\aero\grid\grid-vista-hd.gif" path="images\aero\grid" /> <file name="images\aero\grid\sort-col-bg.gif" path="images\aero\grid" /> <file name="images\aero\grid\sort_asc.gif" path="images\aero\grid" /> <file name="images\aero\grid\sort_desc.gif" path="images\aero\grid" /> <file name="images\aero\layout\collapse.gif" path="images\aero\layout" /> <file name="images\aero\layout\expand.gif" path="images\aero\layout" /> <file name="images\aero\layout\gradient-bg.gif" path="images\aero\layout" /> <file name="images\aero\layout\ns-collapse.gif" path="images\aero\layout" /> <file name="images\aero\layout\ns-expand.gif" path="images\aero\layout" /> <file name="images\aero\layout\panel-close.gif" path="images\aero\layout" /> <file name="images\aero\layout\panel-title-bg.gif" path="images\aero\layout" /> <file name="images\aero\layout\panel-title-light-bg.gif" path="images\aero\layout" /> <file name="images\aero\layout\tab-close-on.gif" path="images\aero\layout" /> <file name="images\aero\layout\tab-close.gif" path="images\aero\layout" /> <file name="images\aero\qtip\bg.gif" path="images\aero\qtip" /> <file name="images\aero\sizer\e-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\e-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\ne-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\ne-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\nw-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\nw-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\s-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\s-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\se-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\se-handle.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\sw-handle-dark.gif" path="images\aero\sizer" /> <file name="images\aero\sizer\sw-handle.gif" path="images\aero\sizer" /> <file name="images\aero\tabs\tab-btm-inactive-left-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-btm-inactive-right-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-btm-left-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-btm-right-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-sprite.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-strip-bg.gif" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-strip-bg.png" path="images\aero\tabs" /> <file name="images\aero\tabs\tab-strip-btm-bg.gif" path="images\aero\tabs" /> <file name="images\aero\toolbar\bg.gif" path="images\aero\toolbar" /> <file name="images\aero\gradient-bg.gif" path="images\aero" /> <file name="images\aero\s.gif" path="images\aero" /> <file name="images\default\basic-dialog\btn-sprite.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\close.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\e-handle.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\hd-sprite.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\progress.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\progress2.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\s-handle.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\se-handle.gif" path="images\default\basic-dialog" /> <file name="images\default\dd\drop-add.gif" path="images\default\dd" /> <file name="images\default\dd\drop-no.gif" path="images\default\dd" /> <file name="images\default\dd\drop-yes.gif" path="images\default\dd" /> <file name="images\default\grid\arrow-left-white.gif" path="images\default\grid" /> <file name="images\default\grid\arrow-right-white.gif" path="images\default\grid" /> <file name="images\default\grid\done.gif" path="images\default\grid" /> <file name="images\default\grid\drop-no.gif" path="images\default\grid" /> <file name="images\default\grid\drop-yes.gif" path="images\default\grid" /> <file name="images\default\grid\footer-bg.gif" path="images\default\grid" /> <file name="images\default\grid\grid-blue-hd.gif" path="images\default\grid" /> <file name="images\default\grid\grid-blue-split.gif" path="images\default\grid" /> <file name="images\default\grid\grid-hrow.gif" path="images\default\grid" /> <file name="images\default\grid\grid-loading.gif" path="images\default\grid" /> <file name="images\default\grid\grid-split.gif" path="images\default\grid" /> <file name="images\default\grid\grid-vista-hd.gif" path="images\default\grid" /> <file name="images\default\grid\invalid_line.gif" path="images\default\grid" /> <file name="images\default\grid\loading.gif" path="images\default\grid" /> <file name="images\default\grid\mso-hd.gif" path="images\default\grid" /> <file name="images\default\grid\nowait.gif" path="images\default\grid" /> <file name="images\default\grid\page-first-disabled.gif" path="images\default\grid" /> <file name="images\default\grid\page-first.gif" path="images\default\grid" /> <file name="images\default\grid\page-last-disabled.gif" path="images\default\grid" /> <file name="images\default\grid\page-last.gif" path="images\default\grid" /> <file name="images\default\grid\page-next-disabled.gif" path="images\default\grid" /> <file name="images\default\grid\page-next.gif" path="images\default\grid" /> <file name="images\default\grid\page-prev-disabled.gif" path="images\default\grid" /> <file name="images\default\grid\page-prev.gif" path="images\default\grid" /> <file name="images\default\grid\pick-button.gif" path="images\default\grid" /> <file name="images\default\grid\refresh.gif" path="images\default\grid" /> <file name="images\default\grid\sort_asc.gif" path="images\default\grid" /> <file name="images\default\grid\sort_desc.gif" path="images\default\grid" /> <file name="images\default\grid\wait.gif" path="images\default\grid" /> <file name="images\default\layout\collapse.gif" path="images\default\layout" /> <file name="images\default\layout\expand.gif" path="images\default\layout" /> <file name="images\default\layout\gradient-bg.gif" path="images\default\layout" /> <file name="images\default\layout\ns-collapse.gif" path="images\default\layout" /> <file name="images\default\layout\ns-expand.gif" path="images\default\layout" /> <file name="images\default\layout\panel-close.gif" path="images\default\layout" /> <file name="images\default\layout\panel-title-bg.gif" path="images\default\layout" /> <file name="images\default\layout\panel-title-light-bg.gif" path="images\default\layout" /> <file name="images\default\layout\tab-close-on.gif" path="images\default\layout" /> <file name="images\default\layout\tab-close.gif" path="images\default\layout" /> <file name="images\default\qtip\bg.gif" path="images\default\qtip" /> <file name="images\default\sizer\e-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\e-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\ne-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\ne-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\nw-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\nw-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\s-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\s-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\se-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\se-handle.gif" path="images\default\sizer" /> <file name="images\default\sizer\square.gif" path="images\default\sizer" /> <file name="images\default\sizer\sw-handle-dark.gif" path="images\default\sizer" /> <file name="images\default\sizer\sw-handle.gif" path="images\default\sizer" /> <file name="images\default\tabs\tab-btm-inactive-left-bg.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-btm-inactive-right-bg.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-btm-left-bg.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-btm-right-bg.gif" path="images\default\tabs" /> <file name="images\default\tabs\tab-sprite.gif" path="images\default\tabs" /> <file name="images\default\toolbar\btn-over-bg.gif" path="images\default\toolbar" /> <file name="images\default\toolbar\gray-bg.gif" path="images\default\toolbar" /> <file name="images\default\tree\drop-add.gif" path="images\default\tree" /> <file name="images\default\tree\drop-between.gif" path="images\default\tree" /> <file name="images\default\tree\drop-no.gif" path="images\default\tree" /> <file name="images\default\tree\drop-over.gif" path="images\default\tree" /> <file name="images\default\tree\drop-under.gif" path="images\default\tree" /> <file name="images\default\tree\drop-yes.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end-minus-nl.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end-minus.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end-plus-nl.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end-plus.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-end.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-line.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-minus-nl.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-minus.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-plus-nl.gif" path="images\default\tree" /> <file name="images\default\tree\elbow-plus.gif" path="images\default\tree" /> <file name="images\default\tree\elbow.gif" path="images\default\tree" /> <file name="images\default\tree\folder-open.gif" path="images\default\tree" /> <file name="images\default\tree\folder.gif" path="images\default\tree" /> <file name="images\default\tree\leaf.gif" path="images\default\tree" /> <file name="images\default\tree\loading.gif" path="images\default\tree" /> <file name="images\default\tree\s.gif" path="images\default\tree" /> <file name="images\default\gradient-bg.gif" path="images\default" /> <file name="images\default\s.gif" path="images\default" /> <file name="images\gray\basic-dialog\close.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\dlg-bg.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\e-handle.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\hd-sprite.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\s-handle.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\se-handle.gif" path="images\gray\basic-dialog" /> <file name="images\gray\layout\collapse.gif" path="images\gray\layout" /> <file name="images\gray\layout\expand.gif" path="images\gray\layout" /> <file name="images\gray\layout\gradient-bg.gif" path="images\gray\layout" /> <file name="images\gray\layout\ns-collapse.gif" path="images\gray\layout" /> <file name="images\gray\layout\ns-expand.gif" path="images\gray\layout" /> <file name="images\gray\layout\panel-close.gif" path="images\gray\layout" /> <file name="images\gray\layout\panel-title-bg.gif" path="images\gray\layout" /> <file name="images\gray\layout\panel-title-light-bg.gif" path="images\gray\layout" /> <file name="images\gray\layout\tab-close-on.gif" path="images\gray\layout" /> <file name="images\gray\layout\tab-close.gif" path="images\gray\layout" /> <file name="images\gray\qtip\bg.gif" path="images\gray\qtip" /> <file name="images\gray\sizer\e-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\e-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\ne-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\ne-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\nw-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\nw-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\s-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\s-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\se-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\se-handle.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\sw-handle-dark.gif" path="images\gray\sizer" /> <file name="images\gray\sizer\sw-handle.gif" path="images\gray\sizer" /> <file name="images\gray\tabs\tab-btm-inactive-left-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-btm-inactive-right-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-btm-left-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-btm-right-bg.gif" path="images\gray\tabs" /> <file name="images\gray\tabs\tab-sprite.gif" path="images\gray\tabs" /> <file name="images\gray\toolbar\gray-bg.gif" path="images\gray\toolbar" /> <file name="images\gray\gradient-bg.gif" path="images\gray" /> <file name="images\gray\s.gif" path="images\gray" /> <file name="images\vista\basic-dialog\bg-center.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\bg-left.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\bg-right.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\close.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\dlg-bg.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\e-handle.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\hd-sprite.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\s-handle.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\se-handle.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\w-handle.gif" path="images\vista\basic-dialog" /> <file name="images\vista\grid\grid-split.gif" path="images\vista\grid" /> <file name="images\vista\grid\grid-vista-hd.gif" path="images\vista\grid" /> <file name="images\vista\layout\collapse.gif" path="images\vista\layout" /> <file name="images\vista\layout\expand.gif" path="images\vista\layout" /> <file name="images\vista\layout\gradient-bg.gif" path="images\vista\layout" /> <file name="images\vista\layout\ns-collapse.gif" path="images\vista\layout" /> <file name="images\vista\layout\ns-expand.gif" path="images\vista\layout" /> <file name="images\vista\layout\panel-close.gif" path="images\vista\layout" /> <file name="images\vista\layout\panel-title-bg.gif" path="images\vista\layout" /> <file name="images\vista\layout\panel-title-light-bg.gif" path="images\vista\layout" /> <file name="images\vista\layout\tab-close-on.gif" path="images\vista\layout" /> <file name="images\vista\layout\tab-close.gif" path="images\vista\layout" /> <file name="images\vista\qtip\bg.gif" path="images\vista\qtip" /> <file name="images\vista\sizer\e-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\e-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\ne-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\ne-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\nw-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\nw-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\s-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\s-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\se-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\se-handle.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\sw-handle-dark.gif" path="images\vista\sizer" /> <file name="images\vista\sizer\sw-handle.gif" path="images\vista\sizer" /> <file name="images\vista\tabs\tab-btm-inactive-left-bg.gif" path="images\vista\tabs" /> <file name="images\vista\tabs\tab-btm-inactive-right-bg.gif" path="images\vista\tabs" /> <file name="images\vista\tabs\tab-btm-left-bg.gif" path="images\vista\tabs" /> <file name="images\vista\tabs\tab-btm-right-bg.gif" path="images\vista\tabs" /> <file name="images\vista\tabs\tab-sprite.gif" path="images\vista\tabs" /> <file name="images\vista\toolbar\gray-bg.gif" path="images\vista\toolbar" /> <file name="images\vista\gradient-bg.gif" path="images\vista" /> <file name="images\vista\s.gif" path="images\vista" /> <file name="images\default\grid\col-move.gif" path="images\default\grid" /> <file name="images\default\grid\col-move-bottom.gif" path="images\default\grid" /> <file name="images\default\grid\col-move-top.gif" path="images\default\grid" /> <file name="images\default\basic-dialog\btn-arrow.gif" path="images\default\basic-dialog" /> <file name="images\default\toolbar\tb-btn-sprite.gif" path="images\default\toolbar" /> <file name="images\aero\toolbar\tb-btn-sprite.gif" path="images\aero\toolbar" /> <file name="images\vista\toolbar\tb-btn-sprite.gif" path="images\vista\toolbar" /> <file name="images\default\toolbar\btn-arrow.gif" path="images\default\toolbar" /> <file name="images\default\menu\menu.gif" path="images\default\menu" /> <file name="images\default\menu\unchecked.gif" path="images\default\menu" /> <file name="images\default\menu\checked.gif" path="images\default\menu" /> <file name="images\default\menu\menu-parent.gif" path="images\default\menu" /> <file name="images\default\menu\group-checked.gif" path="images\default\menu" /> <file name="css\menu.css" path="css" /> <file name="css\grid2.css" path="css" /> <file name="css\README.txt" path="css" /> <file name="images\default\grid\hmenu-asc.gif" path="images\default\grid" /> <file name="images\default\grid\hmenu-desc.gif" path="images\default\grid" /> <file name="images\default\grid\hmenu-lock.png" path="images\default\grid" /> <file name="images\default\grid\hmenu-unlock.png" path="images\default\grid" /> <file name="images\default\grid\Thumbs.db" path="images\default\grid" /> <file name="images\default\menu\shadow-lite.png" path="images\default\menu" /> <file name="images\default\menu\shadow.png" path="images\default\menu" /> <file name="license.txt" path="" /> <file name="css\date-picker.css" path="css" /> <file name="images\default\basic-dialog\collapse.gif" path="images\default\basic-dialog" /> <file name="images\default\basic-dialog\expand.gif" path="images\default\basic-dialog" /> <file name="images\aero\basic-dialog\collapse.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\collapse-over.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\expand.gif" path="images\aero\basic-dialog" /> <file name="images\aero\basic-dialog\expand-over.gif" path="images\aero\basic-dialog" /> <file name="images\gray\basic-dialog\collapse.gif" path="images\gray\basic-dialog" /> <file name="images\gray\basic-dialog\expand.gif" path="images\gray\basic-dialog" /> <file name="images\vista\basic-dialog\collapse.gif" path="images\vista\basic-dialog" /> <file name="images\vista\basic-dialog\expand.gif" path="images\vista\basic-dialog" /> <file name="css\.DS_Store" path="css" /> <file name="images\default\grid\.DS_Store" path="images\default\grid" /> <file name="images\default\toolbar\btn-arrow-light.gif" path="images\default\toolbar" /> <file name="images\default\.DS_Store" path="images\default" /> <file name="images\default\shared\left-btn.gif" path="images\default\shared" /> <file name="images\default\shared\right-btn.gif" path="images\default\shared" /> <file name="images\default\shared\calendar.gif" path="images\default\shared" /> <file name="css\form.css" path="css" /> <file name="images\aero\grid\pspbrwse.jbf" path="images\aero\grid" /> <file name="images\default\bg.png" path="images\default" /> <file name="images\default\shadow.png" path="images\default" /> <file name="images\default\shadow-lr.png" path="images\default" /> <file name="images\.DS_Store" path="images" /> <file name=".DS_Store" path="" /> <file name="yui-ext-resources.jsb" path="" /> <file name="resources.jsb" path="" /> <file name="css\box.css" path="css" /> <file name="images\default\box\.DS_Store" path="images\default\box" /> <file name="images\default\box\corners-blue.gif" path="images\default\box" /> <file name="images\default\box\corners.gif" path="images\default\box" /> <file name="images\default\box\l-blue.gif" path="images\default\box" /> <file name="images\default\box\l.gif" path="images\default\box" /> <file name="images\default\box\r-blue.gif" path="images\default\box" /> <file name="images\default\box\r.gif" path="images\default\box" /> <file name="images\default\box\tb-blue.gif" path="images\default\box" /> <file name="images\default\box\tb.gif" path="images\default\box" /> <file name="raw-images\shadow.psd" path="raw-images" /> <file name="images\gray\menu\checked.gif" path="images\gray\menu" /> <file name="images\gray\menu\group-checked.gif" path="images\gray\menu" /> <file name="images\gray\menu\menu-parent.gif" path="images\gray\menu" /> <file name="images\gray\menu\menu.gif" path="images\gray\menu" /> <file name="images\gray\menu\unchecked.gif" path="images\gray\menu" /> <file name="images\default\layout\stick.gif" path="images\default\layout" /> <file name="images\default\layout\stuck.gif" path="images\default\layout" /> <file name="images\gray\layout\stick.gif" path="images\gray\layout" /> <file name="images\vista\layout\stick.gif" path="images\vista\layout" /> <file name="images\gray\grid\grid-hrow.gif" path="images\gray\grid" /> <file name="images\default\toolbar\tb-bg.gif" path="images\default\toolbar" /> <file name="images\gray\toolbar\tb-btn-sprite.gif" path="images\gray\toolbar" /> <file name="css\debug.css" path="css" /> <file name="images\default\form\trigger.gif" path="images\default\form" /> <file name="css\combo.css" path="css" /> <file name="images\default\form\date-trigger.gif" path="images\default\form" /> <file name="images\default\shared\warning.gif" path="images\default\shared" /> <file name="images\default\grid\dirty.gif" path="images\default\grid" /> <file name="images\default\grid\hmenu-lock.gif" path="images\default\grid" /> <file name="images\default\grid\hmenu-unlock.gif" path="images\default\grid" /> <file name="images\default\form\text-bg.gif" path="images\default\form" /> <file name="images\default\form\exclamation.png" path="images\default\form" /> <file name="images\default\form\exclamation.gif" path="images\default\form" /> <file name="images\default\form\error-tip-bg.gif" path="images\default\form" /> <file name="images\default\form\error-tip-corners.gif" path="images\default\form" /> <file name="images\default\qtip\tip-sprite.gif" path="images\default\qtip" /> <file name="images\default\qtip\close.gif" path="images\default\qtip" /> <file name="images\gray\qtip\tip-sprite.gif" path="images\gray\qtip" /> <file name="images\vista\qtip\tip-sprite.gif" path="images\vista\qtip" /> <file name="images\default\grid\hd-pop.gif" path="images\default\grid" /> <file name="css\panel.css" path="css" /> <file name="images\default\panel\panel-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\panel-blue-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\toggle-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\close-sprite.gif" path="images\default\panel" /> <file name="images\default\window\corners-sprite.gif" path="images\default\window" /> <file name="images\default\window\left-right.gif" path="images\default\window" /> <file name="images\default\window\top-bottom.gif" path="images\default\window" /> <file name="css\window.css" path="css" /> <file name="images\default\window\corners-sprite.png" path="images\default\window" /> <file name="images\default\window\corners-sprite.psd" path="images\default\window" /> <file name="images\default\shadow-c.png" path="images\default" /> <file name="css\grid3.css" path="css" /> <file name="css\layout2.css" path="css" /> <file name="css\tabs2.css" path="css" /> <file name="images\default\panel\corners-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\left-right.gif" path="images\default\panel" /> <file name="images\default\panel\tool-sprite-tpl.gif" path="images\default\panel" /> <file name="images\default\panel\tool-sprites.gif" path="images\default\panel" /> <file name="images\default\panel\top-bottom.gif" path="images\default\panel" /> <file name="images\default\panel\top-bottom.png" path="images\default\panel" /> <file name="images\default\panel\white-corners-sprite.gif" path="images\default\panel" /> <file name="images\default\panel\white-left-right.gif" path="images\default\panel" /> <file name="images\default\panel\white-top-bottom.gif" path="images\default\panel" /> <file name="images\default\window\left-corners.png" path="images\default\window" /> <file name="images\default\window\left-corners.psd" path="images\default\window" /> <file name="images\default\window\left-right.png" path="images\default\window" /> <file name="images\default\window\left-right.psd" path="images\default\window" /> <file name="images\default\window\right-corners.png" path="images\default\window" /> <file name="images\default\window\right-corners.psd" path="images\default\window" /> <file name="images\default\window\top-bottom.png" path="images\default\window" /> <file name="images\default\window\top-bottom.psd" path="images\default\window" /> <file name="images\default\._.DS_Store" path="images\default" /> <file name="images\._.DS_Store" path="images" /> <file name="._.DS_Store" path="" /> <file name="css\editor.css" path="css" /> <file name="images\default\editor\tb-sprite.gif" path="images\default\editor" /> <file name="css\borders.css" path="css" /> <file name="images\default\form\clear-trigger.gif" path="images\default\form" /> <file name="images\default\form\search-trigger.gif" path="images\default\form" /> <file name="images\default\form\trigger-tpl.gif" path="images\default\form" /> <file name="images\default\grid\row-over.gif" path="images\default\grid" /> <file name="images\default\grid\row-sel.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-hrow.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-hrow-over.gif" path="images\default\grid" /> <file name="images\default\grid\row-collapse.gif" path="images\default\grid" /> <file name="images\default\grid\row-expand.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-hd-btn.gif" path="images\default\grid" /> <file name="images\aero\menu\menu.gif" path="images\aero\menu" /> <file name="images\aero\menu\item-over.gif" path="images\aero\menu" /> <file name="images\aero\menu\checked.gif" path="images\aero\menu" /> <file name="images\aero\menu\unchecked.gif" path="images\aero\menu" /> <file name="images\default\grid\grid3-expander-b-bg.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-expander-c-bg.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-special-col-bg.gif" path="images\default\grid" /> <file name="images\default\grid\row-expand-sprite.gif" path="images\default\grid" /> <file name="images\default\grid\row-check-sprite.gif" path="images\default\grid" /> <file name="images\default\grid\grid3-special-col-sel-bg.gif" path="images\default\grid" /> <file name="images\default\shared\glass-bg.gif" path="images\default\shared" /> <file name="legacy\grid.css" path="legacy" /> <file name="css\xtheme-aero.css" path="css" /> <file name="css\xtheme-gray.css" path="css" /> <file name="css\xtheme-vista.css" path="css" /> <file name="images\default\form\clear-trigger.psd" path="images\default\form" /> <file name="images\default\form\date-trigger.psd" path="images\default\form" /> <file name="images\default\form\search-trigger.psd" path="images\default\form" /> <file name="images\default\form\trigger.psd" path="images\default\form" /> </project>
JavaScript
Ext.data.DWRProxy = function(dwrCall, pagingAndSort) { Ext.data.DWRProxy.superclass.constructor.call(this); this.dwrCall = dwrCall; //this.args = args; this.pagingAndSort = (pagingAndSort!=undefined ? pagingAndSort : true); }; Ext.extend(Ext.data.DWRProxy, Ext.data.DataProxy, { load : function(params, reader, callback, scope, arg) { if(this.fireEvent("beforeload", this, params) !== false) { //var sort; // if(params.sort && params.dir) sort = params.sort + ' ' + params.dir; //else sort = ''; var delegate = this.loadResponse.createDelegate(this, [reader, callback, scope, arg], 1); var callParams = new Array(); //if(arg.arg) { // callParams = arg.arg.slice(); //} //if(this.pagingAndSort) { //callParams.push(params.start); //callParams.push(params.limit); //callParams.push(sort); //} callParams.push(arg.params); callParams.push(delegate); this.dwrCall.apply(this, callParams); } else { callback.call(scope || this, null, arg, false); } }, loadResponse : function(listRange, reader, callback, scope, arg) { var result; try { result = reader.read(listRange); } catch(e) { this.fireEvent("loadexception", this, null, response, e); callback.call(scope, null, arg, false); return; } callback.call(scope, result, arg, true); }, update : function(dataSet){}, updateResponse : function(dataSet) {} }); Ext.data.ListRangeReader = function(meta, recordType){ Ext.data.ListRangeReader.superclass.constructor.call(this, meta, recordType); this.recordType = recordType; }; Ext.extend(Ext.data.ListRangeReader, Ext.data.DataReader, { getJsonAccessor: function(){ var re = /[\[\.]/; return function(expr) { try { return(re.test(expr)) ? new Function("obj", "return obj." + expr) : function(obj){ return obj[expr]; }; } catch(e){} return Ext.emptyFn; }; }(), read : function(o){ var recordType = this.recordType, fields = recordType.prototype.fields; //Generate extraction functions for the totalProperty, the root, the id, and for each field if (!this.ef) { if(this.meta.totalProperty) { this.getTotal = this.getJsonAccessor(this.meta.totalProperty); } if(this.meta.successProperty) { this.getSuccess = this.getJsonAccessor(this.meta.successProperty); } if (this.meta.id) { var g = this.getJsonAccessor(this.meta.id); this.getId = function(rec) { var r = g(rec); return (r === undefined || r === "") ? null : r; }; } else { this.getId = function(){return null;}; } this.ef = []; for(var i = 0; i < fields.length; i++){ f = fields.items[i]; var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name; this.ef[i] = this.getJsonAccessor(map); } } var records = []; var root = o.result, c = root.length, totalRecords = c, success = true; if(this.meta.totalProperty){ var v = parseInt(this.getTotal(o), 10); if(!isNaN(v)){ totalRecords = v; } } if(this.meta.successProperty){ var v = this.getSuccess(o); if(v === false || v === 'false'){ success = false; } } for(var i = 0; i < c; i++){ var n = root[i]; var values = {}; var id = this.getId(n); for(var j = 0; j < fields.length; j++){ f = fields.items[j]; try { var v = this.ef[j](n); values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue); } catch(e) { values[f.name] = ""; } } var record = new recordType(values, id); records[i] = record; } return { success : success, records : records, totalRecords : totalRecords }; } });
JavaScript
Ext.namespace('Tipos'); Tipos.DD = { init: function() { var dropEls = Ext.get('container').query('.slot'); //结合实际makeup 这里循环了两次 for(var i = 0; i < dropEls.length; i++) { new Ext.dd.DDTarget(dropEls[i]); } var dragEls = Ext.get('container').query('.block'); for(var i = 0; i < dragEls.length; i++) { new Tipos.DDList(dragEls[i]); } /* // Add a new slot Ext.get('add-slot').on('click', function(e) { e.preventDefault(); // Insert the new block in the first slot. var new_slot = Ext.DomHelper.insertFirst('container', { tag:'div', cls:'slot' }, true); new Ext.dd.DDTarget(new_slot); }); */ Ext.select('.add-block').on('click', function(e) { e.preventDefault(); var id = e.target.id; var name = e.target.innerHTML; var newId = id + "_" + new Date().getTime(); var newBlock = Ext.DomHelper.insertFirst("slot1", { tag: "div", cls: "block" }, true); newBlock.dom.id = "block" + newId; newBlock.dom.innerHTML = "<div class='operation'>[<a href='#' class='add-line' id='addLine" + newId + "' onclick='addLine(event)'>+</a>][<a href='#' class='delete-line' id='deleteLine" + newId + "' onclick='deleteLine(event)'>-</a>][<a href='#' class='delete-block' id='deleteBlock" + newId + "' onclick='deleteBlock(event)'>x</a>]</div>\r\n" + "<div class='title'>" + name + "</div>\r\n" + "<div class='content'>\r\n" + "<p>&nbsp;新闻</p>\r\n" + "<p>&nbsp;新闻</p>\r\n" + "<p>&nbsp;新闻</p>\r\n" + "<p>&nbsp;新闻</p>\r\n" + "<p>&nbsp;新闻</p>\r\n" + "</div>\r\n" + "<div class='foot'>更多</div>"; new Tipos.DDList(newBlock); }); Ext.select(".add-line").on("click", addLine); Ext.select(".delete-line").on("click", deleteLine); Ext.select(".delete-block").on("click", deleteBlock); } }; function addLine(e) { var id = e.target.id; var contents = Ext.get("block" + id.substring(7)).query(".content"); for(var i = 0; i < contents.length; i++) { var content = Ext.DomHelper.insertFirst(contents[i], { tag: "p" }, true); content.dom.innerHTML = "&nbsp;新闻" } } function deleteLine(e) { var id = e.target.id; var contents = Ext.get("block" + id.substring(10)).query(".content"); //[0].query("p")[0]; var item = Ext.get(contents[0]).query("p")[0]; Ext.get(item).remove(); } function deleteBlock(e) { var id = e.target.id; Ext.get("block" + id.substring(11)).remove(); } Tipos.DDList = function(id, sGroup, config) { Tipos.DDList.superclass.constructor.call(this, id, sGroup, config); // The proxy is slightly transparent Ext.get(this.getDragEl()).setStyle('opacity', 0.67); this.goingUp = false; this.lastY = 0; }; Ext.extend(Tipos.DDList, Ext.dd.DDProxy, { startDrag: function(x, y) { // make the proxy look like the source element //得到这个被拖动的元素。因为我们不直接对这个元素拖放,而是通过代理proxy,所以把这个元素隐藏 var dragEl = Ext.get(this.getDragEl()); var clickEl = Ext.get(this.getEl()); clickEl.setStyle('visibility', 'hidden'); //dragEl.dom.innerHTML = clickEl.dom.innerHTML; //取出样式,组成字符串 var padding = clickEl.getPadding('t') + 'px ' + clickEl.getPadding('r') + 'px ' + clickEl.getPadding('b') + 'px ' + clickEl.getPadding('l') + 'px'; dragEl.dom.innerHTML = '<div style="padding:' + padding + '">' + clickEl.dom.innerHTML + '</div>'; //一取一应用 dragEl.setStyle(clickEl.getStyles('background-color', 'color', 'padding')); dragEl.setStyle('border', '1px solid gray'); }, endDrag: function(e) { var srcEl = Ext.get(this.getEl()); var proxy = Ext.get(this.getDragEl()); // Hide the proxy and show the source element when finished with the animation //当动画完成后,隐藏proxy,显示源。 var onComplete = function() { proxy.setStyle('visibility', 'hidden'); srcEl.setStyle('visibility', ''); }; // Show the proxy element and animate it to the src element's location // shift()、easeOut实际上是“proxy”缩小到src的尺寸的动画(视觉上)。最后执行回调 proxy.setStyle('visibility', ''); proxy.shift({ x: srcEl.getX(), y: srcEl.getY(), easing: 'easeOut', duration: .2, callback: onComplete, scope: this }); }, onDragDrop: function(e, id) { // DragDropMgr is a singleton that tracks the element interaction for all DragDrop items in the window. // DragDropMgr是一个单例,负责跟踪window内所有拖放元素间的相互影响 // Generally, you will not call this class directly // 一般来说,你不会直接调用这个类, // but it does have helper methods that could be useful in your DragDrop implementations. // 但是它带有辅助性的方法,会在你拖放的实现中,发挥其用处。 // *******关于DDM的属性和方法,还需更多的研究****** var DDM = Ext.dd.DragDropMgr; var pt = e.getPoint(); var region = DDM.getLocation(DDM.getDDById(id)); if(e.browserEvent.type == 'mousedown') { // Check to see if we are over the source element's location. We will // append to the bottom of the list once we are sure it was a drop in // the negative space (the area of the list without any list items) //判断我们是否在“源”元素所处的位置的上面。 //如果我们在空白的地方(没有任何items列表的地方)“放下”,就在这个列表的底部新添加。 if (!region.intersect(pt)) { var destEl = Ext.get(id);//目标元素 var srcEl = Ext.get(this.getEl());//"源"元素 var destDD = DDM.getDDById(id);//返回 drag drop对象 if(destEl.is('div.block')) { if (this.goingUp) { srcEl.insertBefore(destEl); } else { srcEl.insertAfter(destEl); } } else { destEl.appendChild(srcEl); } destDD.isEmpty = false;//我在API中找不到isEmpty属性:( DDM.refreshCache(); } } }, onDrag: function(e) { // Keep track of the direction of the drag for use during onDragOver //为在onDragOver过程中,保持对拖动方向的跟踪 var y = e.getPageY(); if (y < this.lastY) { this.goingUp = true; } else if (y > this.lastY) { this.goingUp = false; } this.lastY = y; }, onDragOver: function(e, id) { //乍一看,和上面的代码相似,但主要区别是,上面的情况是你的鼠标键还没松开,而这个是决定“放在这里”,鼠标键松开的。 var DDM = Ext.dd.DragDropMgr; var srcEl = Ext.get(this.getEl()); var destEl = Ext.get(id); // We are only concerned with list items, we ignore the dragover // notifications for the list.我们只关心列表items,忽略其他的通知列表的dragover if (destEl.is('div.block')) { if (this.goingUp) { // insert above上方插入 srcEl.insertBefore(destEl); } else { // insert below下方插入 srcEl.insertAfter(destEl); } DDM.refreshCache(); } else if (destEl.is('div.slot')) { destEl.appendChild(srcEl); DDM.refreshCache(); } } }); Ext.onReady(Tipos.DD.init, Tipos.DD, true);
JavaScript
Ext.namespace('Ext.ux'); // --- Ext.ux.CheckRowSelectionGrid --- // Ext.ux.CheckRowSelectionGrid = function(container, config) { var id = this.root_cb_id = Ext.id(null, 'cbsm-'); var cb_html = String.format("<input type='checkbox' id='{0}'/>", this.root_cb_id); var grid = this; var cm = config.cm; // Hack var cm = config.cm || config.colModel; cm.config.unshift({ id: id, header: cb_html, width: 20, resizable: false, fixed: true, sortable: false, dataIndex: -1, renderer: function(data, cell, record, rowIndex, columnIndex, store) { return String.format( "<input type='checkbox' id='{0}-{1}' {2}/>", id, rowIndex, grid.getSelectionModel().isSelected(rowIndex) ? "checked='checked'" : '' ); } }); cm.lookup[id] = cm.config[0]; Ext.ux.CheckRowSelectionGrid.superclass.constructor.call(this, container, config); } Ext.extend(Ext.ux.CheckRowSelectionGrid, Ext.grid.Grid, { root_cb_id : null, getSelectionModel: function() { if (!this.selModel) { this.selModel = new Ext.ux.CheckRowSelectionModel(); } return this.selModel; } }); Ext.ux.CheckRowSelectionModel = function(options) { Ext.ux.CheckRowSelectionModel.superclass.constructor.call(this, options); } Ext.extend(Ext.ux.CheckRowSelectionModel, Ext.grid.RowSelectionModel, { init: function(grid) { Ext.ux.CheckRowSelectionModel.superclass.init.call(this, grid); // Start of dirty hacking // Hacking grid if (grid.processEvent) { grid.__oldProcessEvent = grid.processEvent; grid.processEvent = function(name, e) { // The scope of this call is the grid object var target = e.getTarget(); var view = this.getView(); var header_index = view.findHeaderIndex(target); if (name == 'contextmenu' && header_index === 0) { return; } this.__oldProcessEvent(name, e); } } // Hacking view var gv = grid.getView(); if (gv.beforeColMenuShow) { gv.__oldBeforeColMenuShow = gv.beforeColMenuShow; gv.beforeColMenuShow = function() { // The scope of this call is the view object this.__oldBeforeColMenuShow(); // Removing first - checkbox column from the column menu this.colMenu.remove(this.colMenu.items.first()); // he he } } // End of dirty hacking }, initEvents: function() { Ext.ux.CheckRowSelectionModel.superclass.initEvents.call(this); this.grid.getView().on('refresh', this.onGridRefresh, this); }, selectRow: function(index, keepExisting, preventViewNotify) { Ext.ux.CheckRowSelectionModel.superclass.selectRow.call( this, index, keepExisting, preventViewNotify ); var row_id = this.grid.root_cb_id + '-' + index; var cb_dom = Ext.fly(row_id).dom; cb_dom.checked = true; }, deselectRow: function(index, preventViewNotify) { Ext.ux.CheckRowSelectionModel.superclass.deselectRow.call( this, index, preventViewNotify ); var row_id = this.grid.root_cb_id + '-' + index; var cb_dom = Ext.fly(row_id).dom; cb_dom.checked = false; }, onGridRefresh: function() { Ext.fly(this.grid.root_cb_id).on('click', this.onAllRowsCheckboxClick, this, {stopPropagation:true}); // Attaching to row checkboxes events for (var i = 0; i < this.grid.getDataSource().getCount(); i++) { var cb_id = this.grid.root_cb_id + '-' + i; Ext.fly(cb_id).on('mousedown', this.onRowCheckboxClick, this, {stopPropagation:true}); } }, onAllRowsCheckboxClick: function(event, el) { if (el.checked) { this.selectAll(); } else { this.clearSelections(); } }, onRowCheckboxClick: function(event, el) { var rowIndex = /-(\d+)$/.exec(el.id)[1]; if (el.checked) { this.deselectRow(rowIndex); el.checked = true; } else { this.selectRow(rowIndex, true); el.checked = false; } } }); // --- end of Ext.ux.CheckRowSelectionGrid --- //
JavaScript
Ext.apply( Ext.lib.Ajax , { forceActiveX:false, createXhrObject:function(transactionId) { var obj,http; try { if(Ext.isIE7 && !!this.forceActiveX){throw("IE7forceActiveX");} http = new XMLHttpRequest(); obj = { conn:http, tId:transactionId }; } catch(e) { for (var i = 0; i < this.activeX.length; ++i) { try { http = new ActiveXObject(this.activeX[i]); obj = { conn:http, tId:transactionId }; break; } catch(e) { } } } finally { return obj; } }, getHttpStatus: function(reqObj){ var statObj = { status:0 ,statusText:'' ,isError:false ,isLocal:false ,isOK:false }; try { if(!reqObj)throw('noobj'); statObj.status = reqObj.status || 0; statObj.isLocal = !reqObj.status && location.protocol == "file:" || Ext.isSafari && reqObj.status == undefined; statObj.statusText = reqObj.statusText || ''; statObj.isOK = (statObj.isLocal || (statObj.status > 199 && statObj.status < 300) || statObj.status == 304); } catch(e){ statObj.isError = true;} //status may not avail/valid yet. return statObj; }, handleTransactionResponse:function(o, callback, isAbort) { var responseObject; callback = callback || {}; o.status = this.getHttpStatus(o.conn); if(!o.status.isError){ /* create and enhance the response with proper status and XMLDOM if necessary */ responseObject = this.createResponseObject(o, callback.argument); } if(o.status.isError){ /* checked again in case exception was raised - ActiveX was disabled during XML-DOM creation? */ responseObject = this.createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false)); } if (o.status.isOK && !o.status.isError) { if (callback.success) { if (!callback.scope) { callback.success(responseObject); } else { callback.success.apply(callback.scope, [responseObject]); } } } else { if (callback.failure) { if (!callback.scope) { callback.failure(responseObject); } else { callback.failure.apply(callback.scope, [responseObject]); } } } this.releaseObject(o); responseObject = null; }, createResponseObject:function(o, callbackArg) { var obj = {}; var headerObj = {}; try { var headerStr = o.conn.getAllResponseHeaders(); var header = headerStr.split('\n'); for (var i = 0; i < header.length; i++) { var delimitPos = header[i].indexOf(':'); if (delimitPos != -1) { headerObj[header[i].substring(0, delimitPos)] = header[i].substring(delimitPos + 2); } } } catch(e) { } obj.tId = o.tId; obj.status = o.status.status; obj.statusText = o.status.statusText; obj.getResponseHeader = headerObj; obj.getAllResponseHeaders = headerStr; obj.responseText = o.conn.responseText; obj.responseXML = o.conn.responseXML; if(o.status.isLocal){ o.status.isOK = ((obj.status = o.status.status = (!!obj.responseText.length)?200:404) == 200); if(o.status.isOK && (!obj.responseXML || obj.responseXML.childNodes.length == 0)){ var xdoc=null; try{ //ActiveX may be disabled if(typeof(DOMParser) == 'undefined'){ xdoc=new ActiveXObject("Microsoft.XMLDOM"); xdoc.async="false"; xdoc.loadXML(obj.responseText); }else{ var domParser = new DOMParser(); xdoc = domParser.parseFromString(obj.responseText, 'application/xml'); domParser = null; } } catch(ex){ o.status.isError = true; } obj.responseXML = xdoc; if ( xdoc && typeof (obj.getResponseHeader['Content-Type']) == 'undefined' && !!xdoc.childNodes.length ) /* Got valid nodes? then set the response header */ { obj.getResponseHeader['Content-Type'] == 'text/xml'; } } } if (typeof callbackArg !== undefined) { obj.argument = callbackArg; } return obj; }, asyncRequest:function(method, uri, callback, postData) { var o = this.getConnectionObject(); if (!o) { return null; } else { try{ o.conn.open(method, uri, true); } catch(ex){ this.handleTransactionResponse(o, callback); return o; } if (this.useDefaultXhrHeader) { if (!this.defaultHeaders['X-Requested-With']) { this.initHeader('X-Requested-With', this.defaultXhrHeader, true); } } if(postData && this.useDefaultHeader){ this.initHeader('Content-Type', this.defaultPostHeader); } if (this.hasDefaultHeaders || this.hasHeaders) { this.setHeader(o); } this.handleReadyState(o, callback); try{ o.conn.send(postData || null); } catch(ex){ this.handleTransactionResponse(o, callback);} return o; } }}); Ext.lib.Ajax.forceActiveX = (document.location.protocol == 'file:');/* or other true/false mechanism */
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license */ /** * @class Ext.data.JsonReader * @extends Ext.data.DataReader * Data reader class to create an Array of Ext.data.Record objects from a JSON response * based on mappings in a provided Ext.data.Record constructor. * <p> * Example code: * <pre><code> var RecordDef = Ext.data.Record.create([ {name: 'name', mapping: 'name'}, // "mapping" property not needed if it's the same as "name" {name: 'occupation'} // This field will use "occupation" as the mapping. ]); var myReader = new Ext.data.JsonReader({ totalProperty: "results", // The property which contains the total dataset size (optional) root: "rows", // The property which contains an Array of row objects id: "id" // The property within each row object that provides an ID for the record (optional) }, RecordDef); </code></pre> * <p> * This would consume a JSON file like this: * <pre><code> { 'results': 2, 'rows': [ { 'id': 1, 'name': 'Bill', occupation: 'Gardener' }, { 'id': 2, 'name': 'Ben', occupation: 'Horticulturalist' } ] } </code></pre> * @cfg {String} totalProperty Name of the property from which to retrieve the total number of records * in the dataset. This is only needed if the whole dataset is not passed in one go, but is being * paged from the remote server. * @cfg {String} successProperty Name of the property from which to retrieve the success attribute used by forms. * @cfg {String} root name of the property which contains the Array of row objects. * @cfg {String} id Name of the property within a row object that contains a record identifier value. * @constructor * Create a new JsonReader * @param {Object} meta Metadata configuration options * @param {Object} recordType Either an Array of field definition objects, * or an {@link Ext.data.Record} object created using {@link Ext.data.Record#create}. */ Ext.data.JsonReader = function(meta, recordType){ meta = meta || {}; Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType||meta.fields); }; Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, { /** * This method is only used by a DataProxy which has retrieved data from a remote server. * @param {Object} response The XHR object which contains the JSON data in its responseText. * @return {Object} data A data block which is used by an Ext.data.Store object as * a cache of Ext.data.Records. */ read : function(response){ var json = response.responseText; var o = eval("("+json+")"); if(!o) { throw {message: "JsonReader.read: Json object not found"}; } if(o.metaData){ delete this.ef; this.meta = o.metaData; this.recordType = Ext.data.Record.create(o.metaData.fields); this.onMetaChange(this.meta, this.recordType, o); } return this.readRecords(o); }, // private function a store will implement onMetaChange : function(meta, recordType, o){ }, /** * @ignore */ simpleAccess: function(obj, subsc) { return obj[subsc]; }, /** * @ignore */ getJsonAccessor: function(){ var re = /[\[\.]/; return function(expr) { try { return(re.test(expr)) ? new Function("obj", "return obj." + expr) : function(obj){ return obj[expr]; }; } catch(e){} return Ext.emptyFn; }; }(), /** * Create a data block containing Ext.data.Records from an XML document. * @param {Object} o An object which contains an Array of row objects in the property specified * in the config as 'root, and optionally a property, specified in the config as 'totalProperty' * which contains the total size of the dataset. * @return {Object} data A data block which is used by an Ext.data.Store object as * a cache of Ext.data.Records. */ readRecords : function(o){ /** * After any data loads, the raw JSON data is available for further custom processing. * @type Object */ this.jsonData = o; var s = this.meta, Record = this.recordType, f = Record.prototype.fields, fi = f.items, fl = f.length; // Generate extraction functions for the totalProperty, the root, the id, and for each field if (!this.ef) { if(s.totalProperty) { this.getTotal = this.getJsonAccessor(s.totalProperty); } if(s.successProperty) { this.getSuccess = this.getJsonAccessor(s.successProperty); } this.getRoot = s.root ? this.getJsonAccessor(s.root) : function(p){return p;}; if (s.id) { var g = this.getJsonAccessor(s.id); this.getId = function(rec) { var r = g(rec); return (r === undefined || r === "") ? null : r; }; } else { this.getId = function(){return null;}; } this.ef = []; for(var i = 0; i < fl; i++){ f = fi[i]; var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name; this.ef[i] = this.getJsonAccessor(map); } } var root = this.getRoot(o), c = root.length, totalRecords = c, success = true; if(s.totalProperty){ var v = parseInt(this.getTotal(o), 10); if(!isNaN(v)){ totalRecords = v; } } if(s.successProperty){ var v = this.getSuccess(o); if(v === false || v === 'false'){ success = false; } } var records = []; for(var i = 0; i < c; i++){ var n = root[i]; var values = {}; var id = this.getId(n); for(var j = 0; j < fl; j++){ f = fi[j]; try { var v = this.ef[j](n); values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue); } catch (e) { // } } var record = new Record(values, id); record.json = n; records[i] = record; } return { success : success, records : records, totalRecords : totalRecords }; } });
JavaScript
Ext.onReady(function() { Ext.QuickTips.init(); var areaid; var AreaDef = Ext.data.Record.create([ {name: 'id'},{name: 'name'} ]); var BuildingDef = Ext.data.Record.create([ {name: 'id'},{name: 'name'} ]); var areastore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'roomArea.json'}), reader: new Ext.data.JsonReader({id:'id',totalProperty:'results',root:'rows'},AreaDef) }); areastore.load(); var buildingstore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'roomBuilding.json'}), reader: new Ext.data.JsonReader({id:'id',totalProperty:'results',root:'rows'},BuildingDef) }); // buildingstore.load(); var top = new Ext.form.Form({ labelAlign: 'top' }); var area = new Ext.form.ComboBox({ fieldLabel: '校区', hiddenName:'area', store: areastore, valueField:'id', displayField:'name', typeAhead: true, mode: 'local', triggerAction: 'all', emptyText:'请选择', selectOnFocus:true, width:200 }); area.on('select',function() { areaid = area.getValue(); buildingstore.load({ params:{areaId:areaid} }); }); var building = new Ext.form.ComboBox({ fieldLabel: '楼号', hiddenName:'building', store: buildingstore, valueField:'id', displayField:'name', typeAhead: true, mode: 'local', triggerAction: 'all', emptyText:'请选择', selectOnFocus:true, width:200 }); top.column( {width:272}, area,building ); top.end(); top.render('room'); });
JavaScript
Ext.namespace("Ext.ux.form"); Ext.ux.form.HistoryClearableComboBox = function(config) { Ext.ux.form.HistoryClearableComboBox.superclass.constructor.call(this, config); this.addEvents({ 'change' : true }); //this.store = new Ext.data.SimpleStore({ // fields: ['query'], // data: [] //}); this.historyRecord = Ext.data.Record.create([ {name: 'query', type: 'string'} ]); this.triggerConfig = { tag:'span', cls:'x-form-twin-triggers', style:'padding-right:2px', // padding needed to prevent IE from clipping 2nd trigger button cn:[{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger", style:config.hideComboTrigger?"display:none":""}, {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger x-form-clear-trigger", style: config.hideClearTrigger?"display:none":""} ]}; }; Ext.extend(Ext.ux.form.HistoryClearableComboBox, Ext.form.ComboBox, { //store: undefined, //displayField: 'query', //typeAhead: false, //mode: 'local', //triggerAction: 'all', //hideTrigger: false, //historyRecord: undefined, //maxInHistory: 10, //rememberOn: 'enter', getTrigger : function(index){ return this.triggers[index]; }, initTrigger : function(){ var ts = this.trigger.select('.x-form-trigger', true); this.wrap.setStyle('overflow', 'hidden'); var triggerField = this; ts.each(function(t, all, index){ t.hide = function(){ var w = triggerField.wrap.getWidth(); this.dom.style.display = 'none'; triggerField.el.setWidth(w-triggerField.trigger.getWidth()); }; t.show = function(){ var w = triggerField.wrap.getWidth(); this.dom.style.display = ''; triggerField.el.setWidth(w-triggerField.trigger.getWidth()); }; var triggerIndex = 'Trigger'+(index+1); if(this['hide'+triggerIndex]){ t.dom.style.display = 'none'; } t.on("click", this['on'+triggerIndex+'Click'], this, {preventDefault:true}); t.addClassOnOver('x-form-trigger-over'); t.addClassOnClick('x-form-trigger-click'); }, this); this.triggers = ts.elements; }, onTrigger1Click : function() {this.onTriggerClick()}, // pass to original combobox trigger handler onTrigger2Click : function() {this.reset()}, // clear contents of combobox onRender: function(ct) { Ext.ux.form.HistoryClearableComboBox.superclass.onRender.call(this, ct); }, initEvents : function() { Ext.ux.form.HistoryClearableComboBox.superclass.initEvents.call(this); this.el.on("keyup", this.onHistoryKeyUp, this); }, historyChange : function(value) { var value = this.getValue().replace(/^\s+|\s+$/g, ""); if (value.length==0) return; this.store.clearFilter(); var vr_insert = true; if (this.rememberOn=="all") { this.store.each(function(r) { if (r.data['query'].indexOf(value)==0) { // backspace vr_insert = false; return false; }else if (value.indexOf(r.data['query'])==0) { // forward typing this.store.remove(r); } }); } if (vr_insert==true) { this.store.each(function(r) { if (r.data['query']==value) { vr_insert = false; } }); } if (vr_insert==true) { var vr = new this.historyRecord({query: value}); this.store.insert(0, vr); } var ss_max = this.maxInHistory; if (this.store.getCount()>ss_max) { var ssc = this.store.getCount(); var overflow = this.store.getRange(ssc-(ssc-ss_max), ssc); for (var i=0; i<overflow.length; i++) { this.store.remove(overflow[i]); } } }, onHistoryKeyUp : function(e) { if ( (this.rememberOn=="enter" && e.getKey()==13) || (this.rememberOn=="all") ) { this.historyChange(this.getValue()); this.fireEvent('change', this.getValue()); } }, setValue : function(v) { Ext.ux.form.HistoryClearableComboBox.superclass.setValue.call(this, v); this.fireEvent('change', this.getValue()); }, clearValue : function() { this.setValue(""); }, EOJ : function(){} });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-19 * http://code.google.com/p/anewssystem/ */ /** * 声明Ext.lingo命名控件 * TODO: 完全照抄,作用不明 */ Ext.namespace("Ext.lingo"); /** * 封装表单操作的工具类. * */ Ext.lingo.FormUtils = function() { var isApply = true; return { // 创建<input type="text">输入框 createTextField : function(meta) { var field = new Ext.form.TextField({ allowBlank : meta.allowBlank == undefined ? false : meta.allowBlank , vType : meta.vType , cls : meta.type == "password" ? meta.cls : null , width : meta.vWidth , id : meta.id , name : meta.id , style : (meta.vType == "integer" || meta.vType == "number" ? "text-align: right;" : "") , readOnly : meta.readOnly , defValue : meta.defValue , alt : meta.alt , maxLength : meta.maxlength ? meta.maxlength : Number.MAX_VALUE , minLength : meta.minlength ? meta.minlength : 0 , minValue : meta.minvalue ? meta.minvalue : 0 , maxValue : meta.maxvalue ? meta.maxvalue : Number.MAX_VALUE , mapping : meta.mapping }); if(meta.readOnly) { field.style += "color:#656B86;"; } //if(meta.value != "" && meta.format == "date") { // field.value = datagrids[0].date(meta.value); //} if(meta.defValue) { field.setValue(meta.defValue); } if (isApply) { field.applyTo(meta.id); } return field; } // 数字输入框 , createNumberField : function(meta) { var field = new Ext.form.NumberField({ allowBlank : meta.allowBlank == undefined ? false : meta.allowBlank , cls : meta.type == "password" ? meta.cls : null , width : meta.vWidth , id : meta.id , name : meta.id , style : (meta.vType == "integer" || meta.vType == "number" ? "text-align: right;" : "") , readOnly : meta.readOnly , defValue : meta.defValue , alt : meta.alt , maxLength : meta.maxlength ? meta.maxlength : Number.MAX_VALUE , minLength : meta.minlength ? meta.minlength : 0 , minValue : meta.minvalue ? meta.minvalue : Number.NEGATIVE_INFINITY , maxValue : meta.maxvalue ? meta.maxvalue : Number.MAX_VALUE , mapping : meta.mapping }); field.parseValue = function(value){ value = parseFloat(String(value).replace(this.decimalSeparator, ".")); return isNaN(value) ? '' : value; }; if(meta.readOnly) { field.style += "color:#656B86;"; } //if(meta.value != "" && meta.format == "date") { // field.value = datagrids[0].date(meta.value); //} if(meta.defValue) { field.setValue(meta.defValue); } else { field.setValue(0); } if (isApply) { field.applyTo(meta.id); } return field; } // 创建textarea文本框 , createTextArea : function(meta) { var field = new Ext.form.TextArea({ allowBlank : meta.allowBlank == undefined ? false : meta.allowBlank , vType : meta.vType , width : meta.vWidth , id : meta.id , name : meta.id , readOnly : meta.readOnly , defValue : meta.defValue , alt : meta.alt , maxLength : meta.maxlength ? meta.maxlength : Number.MAX_VALUE , minLength : meta.minlength ? meta.minlength : 0 , minValue : meta.minvalue ? meta.minvalue : 0 , maxValue : meta.maxvalue ? meta.maxvalue : Number.MAX_VALUE , mapping : meta.mapping }); if(meta.readOnly) { field.style += "color:#656B86;"; } if(meta.defValue) { field.setValue(meta.defValue); } if (isApply) { field.applyTo(meta.id); } return field; } // 创建日期选择框 , createDateField : function(meta) { var field = new Ext.form.DateField({ id : meta.id , name : meta.id , allowBlank : meta.allowBlank == undefined ? false : eval(meta.allowBlank) , format : meta.format ? meta.format : "Y年m月d日" , readOnly : true , width : meta.vWidth , defValue : meta.defValue , vType : "date" , alt : meta.alt , setAllMonth : meta.setAllMonth ? el.setAllMonth : false , mapping : meta.mapping }); if(meta.defValue) { field.setValue(meta.defValue); } else { field.setValue(new Date()); } if (isApply) { field.applyTo(meta.id); } return field; } // 创建下拉框 , createComboBox : function(meta) { var field = new Ext.form.ComboBox({ id : meta.id , name : meta.id , readOnly : meta.readOnly !== false , triggerAction : "all" , allowBlank : meta.allowBlank == undefined ? false : eval(meta.allowBlank) , transform : meta.id , vType : "comboBox" , width : meta.vWidth , mapping : meta.mapping }); return field; } // 创建单选框 , createRadio : function(meta) { var fields = new Array(); for (var k = 0; k < meta.values.length; k++) { var value = meta.values[k]; var field = new Ext.form.Radio({ fieldLabel : meta.qtip , name : meta.id , boxLabel : value.name , value : value.id , vType : "radio" , mapping : meta.mapping }); if (meta.defValue && value.id == meta.defValue) { field.fireEvent("check"); field.checked = true; document.getElementById(meta.id + value.id).checked = true;; } if (isApply) { field.applyTo(meta.id + value.id); } // 横向排列 field.el.dom.parentNode.style.display = "inline"; fields[fields.length] = field; } return fields; } // 创建复选框 , createCheckBox : function(meta) { var field = new Ext.form.Checkbox({ id: meta.id , name: meta.id , vType: 'checkbox' , inputValue: meta.inputValue , mapping: meta.mapping }); if (isApply) { field.applyTo(meta.id); } return field; } // 创建treeField , createTreeField : function(meta) { var el = Ext.get(meta.id).dom; var config = { title : meta.qtip , rootId : 0 , height : 200 , dataTag : meta.url , treeHeight : 150 , beforeSelect : function(){} }; var field = new Ext.lingo.TreeField({ id : el.id , name : el.id , allowBlank : false , treeConfig : config , mapping : meta.mapping }); field.vType = "treeField"; //if(不是EditorGrid && 不是Form) object.applyTo(el.id); if (isApply) { field.applyTo(el.id); } return field; } // 生成密码框 , createPasswordField : function(meta) { var field = new Ext.form.TextField({ id : meta.id , allowBlank : meta.allowBlank == undefined ? false : meta.allowBlank , cls : 'password' , name : meta.id , mapping : meta.mapping }); field.vType = "password"; if (isApply) { field.applyTo(meta.id); } return field; } // 生成检测密码强度的密码框 , createPasswordFieldMeta : function(meta) { var field = new Ext.ux.PasswordMeter({ id : meta.id , allowBlank : meta.allowBlank == undefined ? false : meta.allowBlank , cls : 'password' , name : meta.id , mapping : meta.mapping }); field.vType = "password"; if (isApply) { field.applyTo(meta.id); } return field; } // 生成在线编辑器 , createHtmlEditor : function(meta) { var field = new Ext.form.HtmlEditor({ id : meta.id , name : meta.name , mapping : meta.mapping , width : '100%' , height : '40%' }); field.vType = "editor"; if (isApply) { //field.render(body); field.applyTo(meta.id); } return field; } // 根据输入的数组,生成所有的表单字段 , createAll : function(metaArray) { var columns = {}; for (var i = 0; i < metaArray.length; i++) { var meta = metaArray[i]; if (meta.skip === true) { continue; } try { if (meta.vType == "date") { var field = Ext.lingo.FormUtils.createDateField(meta); columns[meta.id] = field; } else if (meta.vType == "comboBox") { var field = Ext.lingo.FormUtils.createComboBox(meta); columns[meta.id] = field; } else if (meta.vType == "textArea") { var field = Ext.lingo.FormUtils.createTextArea(meta); columns[meta.id] = field; } else if (meta.vType == "password") { var field = Ext.lingo.FormUtils.createPasswordField(meta); columns[meta.id] = field; } else if (meta.vType == "passwordmeta") { var field = Ext.lingo.FormUtils.createPasswordFieldMeta(meta); columns[meta.id] = field; } else if (meta.vType == "treeField") { var field = Ext.lingo.FormUtils.createTreeField(meta); columns[meta.id] = field; } else if (meta.vType == "checkbox") { var field = Ext.lingo.FormUtils.createCheckBox(meta); columns[meta.id] = field; } else if (meta.vType == "radio") { var fields = Ext.lingo.FormUtils.createRadio(meta); for (var j = 0; j < fields.length; j++) { columns[meta.id + fields[j].el.dom.value] = fields[j]; } } else if (meta.vType == "editor") { var field = Ext.lingo.FormUtils.createHtmlEditor(meta); columns[meta.id] = field; } else if (meta.vType == "number") { var field = Ext.lingo.FormUtils.createNumberField(meta); columns[meta.id] = field; } else { var field = Ext.lingo.FormUtils.createTextField(meta); columns[meta.id] = field; } } catch (e) { console.error(e); console.error(meta); } } return columns; } // 根据field数组,生成一组用来发送到服务器端的json // columns = [TextField, TreeField, Radio, CheckBox, ComboBox, DateField] , serialFields : function(columns) { var item = {}; for (var i in columns) { var obj = columns[i]; if(!obj.isValid()) { Ext.suggest.msg('错误:', String.format(obj.invalidText, obj.id)); obj.focus(); return false; } var key = obj.mapping ? obj.mapping : obj.id; if (obj.vType == "radio") { key = key ? key : obj.name; if (obj.el.dom.checked) { item[key] = obj.el.dom.value; } } else if (obj.vType == "treeField") { item[key] = obj.selectedId; } else if (obj.vType == "date") { item[key] = obj.getRawValue(); } else { item[key] = obj.getValue(); } } return item; } // 传入field数组,全部reset,为添加信息做准备 , resetFields : function(columns) { for (var i in columns) { var obj = columns[i]; if (obj.vType == "integer") { obj.setValue(0); } else if(obj.vType == "date") { if(obj.defValue) { obj.setValue(obj.defValue); } else { obj.setValue(new Date()); } } else { obj.reset(); } } } // 为对话框,生成div结构 , createDialogContent : function(meta) { var id = meta.id; var title = meta.title ? meta.title : " 详细配置 "; // 内容 var dialogContent = document.getElementById(id); var contentDiv = document.createElement("div"); contentDiv.id = id + "-content"; contentDiv.appendChild(dialogContent); // 消息 var dialogMessage = document.createElement("div"); var waitMessage = document.createElement("div"); var waitText = document.createElement("div"); dialogMessage.id = "dlg-msg"; waitMessage.id = "post-wait"; waitMessage.className = "posting-msg"; waitText.className = "waitting"; waitText.innerHTML = "正在保存,请稍候..."; waitMessage.appendChild(waitText); dialogMessage.appendChild(waitMessage); // 对话框需要的外框 var dialogDiv = document.createElement("div"); var dialog_head = document.createElement("div"); var dialog_body = document.createElement("div"); var dlg_tab = document.createElement("div"); var dlg_help = document.createElement("div"); var helpContent = document.createElement("div"); var dialog_foot = document.createElement("div"); dialogDiv.id = id + "-dialog-content"; dialogDiv.style.visibility = "hidden"; dialog_head.className = "x-dlg-hd"; dialog_body.className = "x-dlg-bd"; dialog_foot.className = "x-dlg-ft"; dlg_tab.className = "x-dlg-tab"; dlg_tab.title = title; dlg_help.className = "x-dlg-tab"; dlg_help.title = " 帮助 "; helpContent.innerHTML = "<div id='help-content'><div id='standard-panel'>帮助...</div></div><div id='temp-content'></div>"; dlg_help.appendChild(helpContent); dialog_body.appendChild(dlg_tab); dialog_body.appendChild(dlg_help); dialog_foot.appendChild(dialogMessage); dialogDiv.appendChild(dialog_head); dialogDiv.appendChild(dialog_body); dialogDiv.appendChild(dialog_foot); document.body.appendChild(dialogDiv); document.body.appendChild(contentDiv); } // 生成一个有指定tab的对话框,各自对话框的标题与id都被分别指定了 // id = id // titles = ['title1','title2'] , createTabedDialog : function(id, titles, width, height) { // 消息 var dialogMessage = document.createElement("div"); var waitMessage = document.createElement("div"); var waitText = document.createElement("div"); dialogMessage.id = "dlg-msg"; waitMessage.id = "post-wait"; waitMessage.className = "posting-msg"; waitText.className = "waitting"; waitText.innerHTML = "正在保存,请稍候..."; waitMessage.appendChild(waitText); dialogMessage.appendChild(waitMessage); // 对话框 var dialogDiv = document.createElement("div"); dialogDiv.id = id; dialogDiv.style.visibility = "hidden"; var dialog_head = document.createElement("div"); // 页头 dialog_head.className = "x-dlg-hd"; var dialog_body = document.createElement("div"); // 内容 dialog_body.className = "x-dlg-bd"; var dialog_foot = document.createElement("div"); // 页脚 dialog_foot.className = "x-dlg-ft"; for (var i = 0; i < titles.length; i++) { var tab = document.createElement("div"); tab.className = "x-dlg-tab"; tab.title = titles[i]; dialog_body.appendChild(tab); } dialogDiv.appendChild(dialog_head); dialogDiv.appendChild(dialog_body); dialogDiv.appendChild(dialog_foot); document.body.appendChild(dialogDiv); var dialog = new Ext.BasicDialog(id, { modal : false , autoTabs : true , width : width ? width : 600 , height : height ? height : 400 , shadow : false , minWidth : 200 , minHeight : 100 , closable : true , autoCreate : true , title : '&nbsp;' }); // ESC键关闭对话框 dialog.addKeyListener(27, dialog.hide, dialog); return dialog; } // 生成一个modal为true的对话框 , createDialog : function(meta) { var id = meta.id; var width = meta.width ? meta.width : 600; var height = meta.height ? meta.height : 400; var dialog = new Ext.BasicDialog(id, { modal : false , autoTabs : true , width : width , height : height , shadow : false , minWidth : 200 , minHeight : 100 , closable : true , autoCreate : true }); return dialog; } // 新建可布局的对话框 , createLayoutDialog : function(dialogName, width, height) { var thisDialog = new Ext.LayoutDialog(dialogName, { modal : false , autoTabs : true , proxyDrag : true , resizable : true , width : width ? width : 650 , height : height ? height : 500 , shadow : true , center : { autoScroll : true , tabPosition : 'top' , closeOnTab : true , alwaysShowTabs : false } }); thisDialog.addKeyListener(27, thisDialog.hide, thisDialog); thisDialog.addButton('关闭', function() {thisDialog.hide();}); return thisDialog; } // 为grid渲染性别 , renderSex : function(value) { return value == '0' ? '<span style="font-weight:bold;color:red">男</span>' : '<span style="font-weight:bold;color:green;">女</span>'; } }; }();
JavaScript
var Example = { init : function(){ // basic record var Skill = Ext.data.Record.create([ {name: 'id', type: 'int'}, {name: 'name', type: 'string'}, {name: 'description', type: 'string'}, {name: 'rating', type: 'int'} ]); // tree setup var skillsTreeLoader = new Ext.tree.TreeLoader({ dataUrl : 'ddtree.json' }); /* skillsTreeLoader.on('beforeload', function(treeLoader, node) { this.baseParams.level = node.attributes.level; }); */ var skillsTree = new Ext.tree.TreePanel('tree-div', { animate : true, loader : skillsTreeLoader, containerScroll : true, rootVisible : true, enableDD : true, ddGroup : 'TreeDD'/*, dropConfig: { appendOnly : true }*/ }); skillsTree.on('nodedragover', function(e) { console.error("tree"); }); skillsTree.on('beforenodedrop', function(e){ console.error(e); /* var s = e.data.selections, r = []; for(var i = 0, len = s.length; i < len; i++){ var ticket = s[i].data.ticket; // s[i] is a Record from the grid if(!watchList.findChild('ticket', ticket)){ // <-- filter duplicates r.push(new xt.TreeNode({ // build array of TreeNodes to add allowDrop:false, text: 'Ticket #' + ticket, ticket: ticket, action: 'view', qtip: String.format('<b>{0}</b><br />{1}', s[i].data.summary, s[i].data.excerpt) })); } } e.dropNode = r; // return the new nodes to the Tree DD e.cancel = r.length < 1; // cancel if all nodes were duplicates */ }); // Set the root node var skillsTreeRoot = new Ext.tree.AsyncTreeNode({ text : 'Skills', draggable : true, id : 'root' }); /* skillsTreeRoot.attributes.level = 'root'; skillsTreeRoot.attributes.selectable = true; skillsTreeRoot.attributes.description = ''; */ skillsTree.setRootNode(skillsTreeRoot); // grid setup var skillsColumnModel = new Ext.grid.ColumnModel([{ header : "Skill name", dataIndex : 'name', width : 160 },{ header : "Rating", dataIndex : 'rating', width : 100 }]); skillsColumnModel.defaultSortable = true; var skillsDataStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url : 'ddtree2.json' }), reader: new Ext.data.JsonReader({ root : 'result', id : 'id' }, Skill) }); var ds2 = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url : 'ddtree2.json' }), reader: new Ext.data.JsonReader({ root : 'result', id : 'id' }, Skill) }); var skillsGrid = new Ext.grid.Grid('grid-div', { ds : skillsDataStore, cm : skillsColumnModel, enableDragDrop : true }); var grid2 = new Ext.grid.Grid('grid-div2', { ds : ds2, cm : skillsColumnModel, enableDragDrop : true }); /* var dropTree = new Ext.dd.DropTarget(skillsTree.el, { ddGroup : 'TreeDD', notifyOver: function(dd, e, data) { console.debug(" - tree"); return true; }, notifyDrop : function(dd, e, data){ console.debug(" - tree"); } }); */ grid2.on("dragover", function() { console.debug("dragover"); }); var dropGrid = new Ext.dd.DropTarget(skillsGrid.container, { ddGroup : 'TreeDD', notifyOver: function(dd, e, data) { console.error(" -- grid"); return true; }, notifyDrop : function(dd, e, data){ console.error(" -- grid"); return true; //i want to know the id of the tree node ive dropped it on. } }); var dropGrid2 = new Ext.dd.DropTarget(grid2.container, { ddGroup : 'TreeDD', notifyOver: function(dd, e, data) { console.error(" -- -- grid2"); return true; }, notifyDrop : function(dd, e, data){ console.error(" -- -- grid2"); //i want to know the id of the tree node ive dropped it on. } }); var layout = Ext.BorderLayout.create({ center: { margins : {left:1,top:1,right:1,bottom:1}, panels : [new Ext.GridPanel(skillsGrid)] }, south : { margins : {left:2,top:2,right:2,bottom:2}, panels : [new Ext.GridPanel(grid2)] } }, 'grid-panel'); // Render the tree, and expand the root note //skillsTree.render(); //skillsTreeRoot.expand(); // render it skillsDataStore.load(); skillsGrid.render(); // render it grid2.render(); } }; Ext.onReady(Example.init, Example);
JavaScript
/* * Ext JS Library 1.0 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license */ var Example = { init : function(){ // some data yanked off the web var myData = [ ['3m Co', 71.72, 0.02, 0.03, '9/1 12:00am'], ['Alcoa Inc' , 29.01, 0.42, 1.47, '9/1 12:00am'], ['Walt Disney Company (The) (Holding Company)', 29.89, 0.24, 0.81, '9/1 12:00am'] ]; var myData2 = [ ['临远', '0.0', '0.0', '0.0', '9/24 12:00am'], ['test', '1.0', '1.0', '1.0', '9/24 12:00am'], ['dodo', '2.0', '-2.0', '2.0', '9/24 12:00am'] ]; var ds = new Ext.data.Store({ proxy: new Ext.data.MemoryProxy(myData), reader: new Ext.data.ArrayReader({}, [ {name: 'company'}, {name: 'price', type: 'float'}, {name: 'change', type: 'float'}, {name: 'pctChange', type: 'float'}, {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'} ]) }); ds.load(); var ds2 = new Ext.data.Store({ proxy: new Ext.data.MemoryProxy(myData2), reader: new Ext.data.ArrayReader({}, [ {name: 'company'}, {name: 'price', type: 'float'}, {name: 'change', type: 'float'}, {name: 'pctChange', type: 'float'}, {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'} ]) }); ds2.load(); // example of custom renderer function function italic(value){ return '<i>' + value + '</i>'; } // example of custom renderer function function change(val){ if(val > 0){ return '<span style="color:green;">' + val + '</span>'; }else if(val < 0){ return '<span style="color:red;">' + val + '</span>'; } return val; } // example of custom renderer function function pctChange(val){ if(val > 0){ return '<span style="color:green;">' + val + '%</span>'; }else if(val < 0){ return '<span style="color:red;">' + val + '%</span>'; } return val; } // the DefaultColumnModel expects this blob to define columns. It can be extended to provide // custom or reusable ColumnModels var colModel = new Ext.grid.ColumnModel([ {header: "Company", width: 260, sortable: true, dataIndex: 'company', locked:false}, {header: "Price", width: 75, sortable: true, dataIndex: 'price', renderer: Ext.util.Format.usMoney}, {header: "Change", width: 75, sortable: true, dataIndex: 'change', renderer: change}, {header: "% Change", width: 75, sortable: true, dataIndex: 'pctChange', renderer: pctChange}, {header: "Last Updated", width: 85, sortable: true, dataIndex: 'lastChange', renderer: Ext.util.Format.dateRenderer('m/d/Y')} ]); // create the Grid var grid = new Ext.grid.Grid('grid-div', { ds : ds, cm : colModel, enableDragDrop : true }); var grid2 = new Ext.grid.Grid('grid-div2', { ds : ds2, cm : colModel, enableDragDrop : true }); var ddrow = new Ext.dd.DropTarget(grid.container, { ddGroup : 'GridDD', copy : false, notifyDrop : function(dd, e, data){ } }); var ddrow2 = new Ext.dd.DropTarget(grid2.container, { ddGroup : 'GridDD', copy : false, notifyDrop : function(dd, e, data){ } }); var layout = Ext.BorderLayout.create({ center: { margins : {left:1,top:1,right:1,bottom:1}, panels : [new Ext.GridPanel(grid)] }, south : { margins : {left:2,top:2,right:2,bottom:2}, panels : [new Ext.GridPanel(grid2)] } }, 'grid-panel'); // basic record var Skill = Ext.data.Record.create([ {name: 'id', type: 'int'}, {name: 'name', type: 'string'}, {name: 'description', type: 'string'}, {name: 'rating', type: 'int'} ]); // tree setup var skillsTreeLoader = new Ext.tree.TreeLoader({ dataUrl : 'ddtree.json' }); var skillsTree = new Ext.tree.TreePanel('tree-div', { animate : true, loader : skillsTreeLoader, containerScroll : true, rootVisible : true, enableDD : true, ddGroup : 'GridDD'/*, dropConfig: { appendOnly : true }*/ }); skillsTree.on('nodedragover', function(e) { //console.error("tree"); }); skillsTree.on('beforenodedrop', function(e){ //console.error(e); }); // Set the root node var skillsTreeRoot = new Ext.tree.AsyncTreeNode({ text : 'Skills', draggable : true, id : 'root' }); skillsTree.setRootNode(skillsTreeRoot); skillsTree.render(); skillsTreeRoot.expand(); grid.render(); grid2.render(); grid.getSelectionModel().selectFirstRow(); } }; Ext.onReady(Example.init, Example);
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-21 * http://code.google.com/p/anewssystem/ */ /** * 声明Ext.lingo命名控件 * TODO: 完全照抄,作用不明 */ Ext.namespace("Ext.lingo"); /** * 弹出式登录对话框. * */ Ext.lingo.LoginDialog = function() { var loginDialog, loginBtn, resetBtn, tabs; var userAccount, userPwd, rememberMe, j_captcha_response; return { // 初始化对话框 init : function(callback) { this.callback = callback; userAccount = new Ext.lingo.FormUtils.createTextField({ id : 'userAccount', type : 'text', vType : 'alphanum', allowBlank : false, maxLength : 18 }); userPwd = new Ext.lingo.FormUtils.createTextField({ id : 'userPassword', type : 'password', vType : 'alphanum', allowBlank : false, maxLength : 18, cls : 'x-form-text' }); rememberMe = new Ext.lingo.FormUtils.createCheckBox({ id : '_acegi_security_remember_me', type : 'checkbox', vType : 'integer', allowBlank : 'true', cls : 'x-form-text' }); j_captcha_response = new Ext.lingo.FormUtils.createTextField({ id : 'j_captcha_response', type : 'text', vType : 'alphanum', allowBlank : false, maxLength : 18 }); this.showLoginDialog(); } // 显示对话框 , showLoginDialog : function() { if(!loginDialog) { loginDialog = new Ext.BasicDialog("login-dlg", { title : '&nbsp;', modal : true, autoTabs : true, width : 500, height : 300, shadow : true, minWidth : 300, minHeight : 300, closable : false, resizable : true }); loginBtn = loginDialog.addButton('登陆', this.logIn, this); resetBtn = loginDialog.addButton('重写', this.loginReset, this); tabs =loginDialog.getTabs(); tabs.getTab(0).on('activate', function() { resetBtn.show(); loginBtn.show() }, this, true); tabs.getTab(1).on('activate', function() { resetBtn.hide(); loginBtn.hide() }, this, true); } loginDialog.show(); } // 隐藏对话框 , hideLoginDialog : function() { loginDialog.hide(); } // 显示按钮 , showHideBtns : function(f) { var msg = Ext.get('post-wait'); if (f) { tabs.getTab(1).enable(); resetBtn.enable(); loginBtn.enable(); msg.removeClass('active-msg') } else { tabs.getTab(1).disable(); resetBtn.disable(); loginBtn.disable(); msg.radioClass('active-msg'); } } // 验证输入的数据 , checkInput : function() { if(userAccount.isValid() == false) { Msg.suggest('错误:', String.format(userAccount.invalidText, userAccount.el.dom.alt)); userAccount.focus(); return false; } if(userPwd.isValid() == false) { Msg.suggest('错误:', String.format(userPwd.invalidText, userPwd.el.dom.alt)); userPwd.focus(); return false; } if(j_captcha_response.isValid() == false) { Msg.suggest('错误:', String.format(j_captcha_response.invalidText, j_captcha_response.el.dom.alt)); j_captcha_response.focus(); return false; } return true; } // 重置 , loginReset : function() { userAccount.setValue(""); userPwd.setValue(""); rememberMe.setValue(false); j_captcha_response.setValue(""); } // 进行登录 , logIn : function() { if(this.checkInput()) { this.showHideBtns(false); var data = "j_username=" + userAccount.getValue() + "&j_password=" + userPwd.getValue() + "&_acegi_security_remember_me=" + rememberMe.getValue() + "&j_captcha_response=" + j_captcha_response.getValue(); Ext.lib.Ajax.request( 'POST', "../j_acegi_security_check", {success:this.loginSuccess.createDelegate(this),failure:this.loginFailure.createDelegate(this)}, data ); } } // 登录成功 , loginSuccess : function(data) { try { eval("var json=" + data.responseText + ";"); if (json.success) { this.callback(data); this.showHideBtns(true); this.hideLoginDialog(true); } else { this.loginFailure(data); } } catch (e) { this.loginFailure("{response:'服务器错误,请刷新页面重新进入'}"); } } // 登录失败 , loginFailure : function(data) { try { eval("var json=" + data.responseText + ";"); Msg.suggest('错误:', json.response); } catch (e) { } this.showHideBtns(true); } }; }();
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-21 * http://code.google.com/p/anewssystem/ */ /** * 声明Ext.lingo命名控件 * TODO: 完全照抄,作用不明 */ Ext.namespace("Ext.lingo"); /** * 下拉框. * * 下拉出现一个面板,可以选择一个或多个关键字的面板 */ Ext.lingo.TagField = function(config) { config.readOnly = false; // inwei是选择关键字,所以text也是可以编辑的 this.url = config.tagConfig.dataTag; this.start = 0; this.limit = 12; Ext.lingo.TagField.superclass.constructor.call(this, config); }; Ext.extend(Ext.lingo.TagField, Ext.form.TriggerField, { triggerClass : 'x-form-date-trigger', defaultAutoCreate : { tag : "input", type : "text", size : "10", autocomplete : "off" }, getValue : function() { return Ext.lingo.TagField.superclass.getValue.call(this) || ""; }, setValue : function(val) { Ext.lingo.TreeField.superclass.setValue.call(this, val); }, menuListeners : { select:function (item, picker, node) { var v = node.text; var ed = this.ed; if(this.selfunc) { v = this.selfunc(node); } if(ed) { var r= ed.record; r.set(this.fn, v); } else { this.focus(); this.setValue(v); // document.getElementById("category_id").value = node.id; this.selectedId = node.id; } }, hide : function(){ } }, onTriggerClick : function(){ if(this.disabled){ return; } if(this.menu == null){ this.menu = new Ext.menu.TagMenu(this.initialConfig); } Ext.apply(this.menu.picker, { url : this.url }); this.menu.on(Ext.apply({}, this.menuListeners, { scope : this })); this.menu.picker.setValue(this.getValue()); this.menu.show(this.el, "tl-bl?"); }, invalidText : "{0} is not a valid date - it must be in the format {1}" }); Ext.menu.TagMenu = function(config) { Ext.menu.TagMenu.superclass.constructor.call(this, config); this.plain = true; var di = new Ext.menu.TagItem(config); this.add(di); this.picker = di.picker; this.relayEvents(di, ["select"]); this.relayEvents(di, ["beforesubmit"]); }; Ext.extend(Ext.menu.TagMenu, Ext.menu.Menu); Ext.menu.TagItem = function(config){ Ext.menu.TagItem.superclass.constructor.call(this, new Ext.TagPicker(config), config); this.picker = this.component; this.addEvents({select: true}); this.picker.on("render", function(picker){ picker.getEl().swallowEvent("click"); //picker.container.addClass("x-menu-date-item"); }); this.picker.on("select", this.onSelect, this); }; Ext.extend(Ext.menu.TagItem, Ext.menu.Adapter, { onSelect : function(picker, node) { this.fireEvent("select", this, picker, node); Ext.menu.TagItem.superclass.handleClick.call(this); } }); Ext.TagPicker = function(config){ Ext.TagPicker.superclass.constructor.call(this, config); this.addEvents({select: true}); if(this.handler){ this.on("select", this.handler, this.scope || this); } }; Ext.extend(Ext.TagPicker, Ext.Component, { setValue : function(value) { this.value = value; if(this.tag) this.tag.selectPath(value, 'text'); }, getValue : function() { return this.value; }, onRender : function(container) { var me = this; var dh = Ext.DomHelper; var el = document.createElement("div"); el.className = "x-date-picker"; el.innerHTML = ''; var eo = Ext.get(el); this.el = eo; container.dom.appendChild(el); var tag = this.createTag(el, me.url, function() { var tag = this; tag.render(); tag.selectPath(me.getValue(), 'text'); }); tag.on('click',function(node,e){ me.fireEvent("select", me, node); }); this.tag = tag; } , createTag : function(el, url, callback) { var Tree = Ext.tree; // id var tag = new Tree.TreePanel(el, { animate : true, loader : new Tree.TreeLoader({dataUrl:url}), // c.dataTag enableDD : false, containerScroll : true }); // 设置根节点 var root = new Tree.AsyncTreeNode({ text : this.initialConfig.tagConfig.title, // c.title draggable : false, id : 'source' }); tree.setRootNode(root); // 渲染 tree.render(); root.expand(); return tree; } });
JavaScript
/* * Ext JS Library 1.0 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license */ var Example = { init : function(){ // some data yanked off the web var myData = [ ['3m Co', 71.72, 0.02, 0.03, '9/1 12:00am'], ['Alcoa Inc' , 29.01, 0.42, 1.47, '9/1 12:00am'], ['Walt Disney Company (The) (Holding Company)', 29.89, 0.24, 0.81, '9/1 12:00am'] ]; var myData2 = [ ['临远', '0.0', '0.0', '0.0', '9/24 12:00am'], ['test', '1.0', '1.0', '1.0', '9/24 12:00am'], ['dodo', '2.0', '-2.0', '2.0', '9/24 12:00am'] ]; var ds = new Ext.data.Store({ proxy: new Ext.data.MemoryProxy(myData), reader: new Ext.data.ArrayReader({}, [ {name: 'company'}, {name: 'price', type: 'float'}, {name: 'change', type: 'float'}, {name: 'pctChange', type: 'float'}, {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'} ]) }); ds.load(); var ds2 = new Ext.data.Store({ proxy: new Ext.data.MemoryProxy(myData2), reader: new Ext.data.ArrayReader({}, [ {name: 'company'}, {name: 'price', type: 'float'}, {name: 'change', type: 'float'}, {name: 'pctChange', type: 'float'}, {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'} ]) }); ds2.load(); // example of custom renderer function function italic(value){ return '<i>' + value + '</i>'; } // example of custom renderer function function change(val){ if(val > 0){ return '<span style="color:green;">' + val + '</span>'; }else if(val < 0){ return '<span style="color:red;">' + val + '</span>'; } return val; } // example of custom renderer function function pctChange(val){ if(val > 0){ return '<span style="color:green;">' + val + '%</span>'; }else if(val < 0){ return '<span style="color:red;">' + val + '%</span>'; } return val; } // the DefaultColumnModel expects this blob to define columns. It can be extended to provide // custom or reusable ColumnModels var colModel = new Ext.grid.ColumnModel([ {header: "Company", width: 260, sortable: true, dataIndex: 'company', locked:false}, {header: "Price", width: 75, sortable: true, dataIndex: 'price', renderer: Ext.util.Format.usMoney}, {header: "Change", width: 75, sortable: true, dataIndex: 'change', renderer: change}, {header: "% Change", width: 75, sortable: true, dataIndex: 'pctChange', renderer: pctChange}, {header: "Last Updated", width: 85, sortable: true, dataIndex: 'lastChange', renderer: Ext.util.Format.dateRenderer('m/d/Y')} ]); // create the Grid var grid = new Ext.grid.Grid('grid-example', { ds : ds, cm : colModel, enableDragDrop : true }); var grid2 = new Ext.grid.Grid('grid-example2', { ds : ds2, cm : colModel, enableDragDrop : true }); var ddrow = new Ext.dd.DropTarget(grid.container, { ddGroup : 'GridDD', copy : false, notifyDrop : function(dd, e, data){ // 判断是本表格内拖动,还是表格间拖动 var rows = grid2.getSelectionModel().getSelections(); var source; if (rows.length > 0) { source = ds2; } else { rows = grid.getSelectionModel().getSelections(); source = ds; } var index; try { index = dd.getDragData(e).rowIndex; if (typeof(index) == "undefined") { index = 0; } } catch (e) { index = 0; } for(i = 0; i < rows.length; i++) { var rowData = source.getById(rows[i].id); if(!this.copy) source.remove(rowData); ds.insert(index, rowData); } } }); var ddrow2 = new Ext.dd.DropTarget(grid2.container, { ddGroup : 'GridDD', copy : false, notifyDrop : function(dd, e, data){ // 判断是本表格内拖动,还是表格间拖动 var rows = grid.getSelectionModel().getSelections(); var source; if (rows.length > 0) { source = ds; } else { rows = grid2.getSelectionModel().getSelections(); source = ds2; } var index; try { index = dd.getDragData(e).rowIndex; if (typeof(index) == "undefined") { index = 0; } } catch (e) { index = 0; } for(var i = 0; i < rows.length; i++) { var rowData = source.getById(rows[i].id); if(!this.copy) source.remove(rowData); ds2.insert(index, rowData); } } }); var layout = Ext.BorderLayout.create({ center: { margins : {left:1,top:1,right:1,bottom:1}, panels : [new Ext.GridPanel(grid)] }, south : { margins : {left:2,top:2,right:2,bottom:2}, panels : [new Ext.GridPanel(grid2)] } }, 'grid-panel'); grid.render(); grid2.render(); grid.getSelectionModel().selectFirstRow(); } }; Ext.onReady(Example.init, Example);
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-21 * http://code.google.com/p/anewssystem/ */ /** * 声明Ext.lingo命名控件 * TODO: 完全照抄,作用不明 */ Ext.namespace("Ext.lingo"); /** * 下拉树形. * */ // // var tree = new Ext.tree.TreePanel(el,{containerScroll: true}); // var p = new Ext.data.HttpProxy({url:url}); // p.on("loadexception", function(o, response, e) { // if (e) throw e; // }); // p.load(null, { // read: function(response) { // var doc = response.responseXML; // tree.setRootNode(rpTreeNodeFromXml(doc.documentElement || doc)); // } // }, callback || tree.render, tree); // return tree; // //} // 从xml中创建树 /* function rpTreeNodeFromXml(XmlEl) { // 如果是text节点,就取节点值,如果不是text节点,就取tagName var t = ((XmlEl.nodeType == 3) ? XmlEl.nodeValue : XmlEl.tagName); // 没有text,没有节点的时候 if (t.replace(/\s/g,'').length == 0) { return null; } // 特别指定一个没有任何属性,并且只包含一个text节点的元素 var leafTextNode = ((XmlEl.attributes.length == 0) && (XmlEl.childNodes.length == 1) && (XmlEl.firstChild.nodeType == 3)); if (leafTextNode ) { return new Ext.tree.TreeNode({ tagName: XmlEl.tagName, text: XmlEl.firstChild.nodeValue }); } var result = new Ext.tree.TreeNode({ text : t }); result.tagName=XmlEl.tagName; // 为元素处理属性和子节点 if (XmlEl.nodeType == 1) { Ext.each(XmlEl.attributes, function(a) { result.attributes[a.nodeName]=a.nodeValue; if(a.nodeName=='text') result.setText(a.nodeValue); }); if (!leafTextNode) { Ext.each(XmlEl.childNodes, function(el) { // 只处理元素和text节点 if ((el.nodeType == 1) || (el.nodeType == 3)) { var c = rpTreeNodeFromXml(el); if (c) { result.appendChild(c); } } }); } } return result; } */ Ext.lingo.TreeField = function(config) { config.readOnly = true; this.url = config.treeConfig.dataTag; Ext.lingo.TreeField.superclass.constructor.call(this, config); }; Ext.extend(Ext.lingo.TreeField, Ext.form.TriggerField, { triggerClass : 'x-form-date-trigger', defaultAutoCreate : { tag : "input", type : "text", size : "10", autocomplete : "off" }, onRender : function(ct, position) { Ext.lingo.TreeField.superclass.onRender.call(this, ct, position); var hiddenId = this.el.id + "_id"; this.hiddenField = this.el.insertSibling( {tag:'input', type:'hidden', name: hiddenId, id: hiddenId}, 'before', true); }, getValue : function() { return Ext.lingo.TreeField.superclass.getValue.call(this) || ""; //return this.selectedId; }, setValue : function(val) { Ext.lingo.TreeField.superclass.setValue.call(this, val); }, menuListeners : { select:function (item, picker, node) { var v = node.text; //var v = node.id; var ed = this.ed; if(this.selfunc) { v = this.selfunc(node); } if(ed) { var r = ed.record; r.set(this.fn, v); } else { this.focus(); this.setValue(v); // document.getElementById("category_id").value = node.id; this.selectedId = node.id; document.getElementById(this.el.id + "_id").value = node.id; } }, hide : function(){ } }, onTriggerClick : function(){ if(this.disabled){ return; } if(this.menu == null){ this.menu = new Ext.menu.TreeMenu(this.initialConfig); } Ext.apply(this.menu.picker, { url : this.url }); this.menu.on(Ext.apply({}, this.menuListeners, { scope : this })); this.menu.picker.setValue(this.getValue()); this.menu.show(this.el, "tl-bl?"); }, invalidText : "{0} is not a valid date - it must be in the format {1}" }); Ext.menu.TreeMenu = function(config) { Ext.menu.TreeMenu.superclass.constructor.call(this, config); this.plain = true; var di = new Ext.menu.TreeItem(config); this.add(di); this.picker = di.picker; this.relayEvents(di, ["select"]); this.relayEvents(di, ["beforesubmit"]); }; Ext.extend(Ext.menu.TreeMenu, Ext.menu.Menu); Ext.menu.TreeItem = function(config){ Ext.menu.TreeItem.superclass.constructor.call(this, new Ext.TreePicker(config), config); this.picker = this.component; this.addEvents({select: true}); this.picker.on("render", function(picker){ picker.getEl().swallowEvent("click"); //picker.container.addClass("x-menu-date-item"); }); this.picker.on("select", this.onSelect, this); }; Ext.extend(Ext.menu.TreeItem, Ext.menu.Adapter, { onSelect : function(picker, node) { this.fireEvent("select", this, picker, node); Ext.menu.TreeItem.superclass.handleClick.call(this); } }); Ext.TreePicker = function(config){ Ext.TreePicker.superclass.constructor.call(this, config); this.addEvents({select: true}); if(this.handler){ this.on("select", this.handler, this.scope || this); } }; Ext.extend(Ext.TreePicker, Ext.Component, { setValue : function(value) { this.value = value; if(this.tree) this.tree.selectPath(value, 'text'); }, getValue : function() { return this.value; }, onRender : function(container) { var me = this; var dh = Ext.DomHelper; var el = document.createElement("div"); el.className = "x-date-picker"; el.innerHTML = ''; var eo = Ext.get(el); this.el = eo; container.dom.appendChild(el); var tree = this.createTree(el, me.url, function() { var tree = this; tree.render(); tree.selectPath(me.getValue(), 'text'); }); tree.on('click',function(node,e){ me.fireEvent("select", me, node); }); this.tree=tree; } , createTree : function(el, url, callback) { var Tree = Ext.tree; // id var tree = new Tree.TreePanel(el, { animate : true, loader : new Tree.TreeLoader({dataUrl:url}), // c.dataTag enableDD : false, rootVisible : false, containerScroll : true }); // 设置根节点 var root = new Tree.AsyncTreeNode({ text : this.initialConfig.treeConfig.title, // c.title draggable : false, id : 'source' }); tree.setRootNode(root); // 渲染 tree.render(); root.expand(); return tree; } });
JavaScript
/* * Ext JS Library 1.0 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license */ Ext.BLANK_IMAGE_URL = '../../extjs/1.1/resources/images/default/s.gif'; var Example = { init : function(){ // some data yanked off the web var myData = [ ['3m Co', 71.72, 0.02, 0.03, '9/1 12:00am'], ['Alcoa Inc' , 29.01, 0.42, 1.47, '9/1 12:00am'], ['Walt Disney Company (The) (Holding Company)', 29.89, 0.24, 0.81, '9/1 12:00am'] ]; var ds = new Ext.data.Store({ proxy: new Ext.data.MemoryProxy(myData), reader: new Ext.data.ArrayReader({}, [ {name: 'company'}, {name: 'price', type: 'float'}, {name: 'change', type: 'float'}, {name: 'pctChange', type: 'float'}, {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'} ]) }); ds.load(); // example of custom renderer function function italic(value){ return '<i>' + value + '</i>'; } // example of custom renderer function function change(val){ if(val > 0){ return '<span style="color:green;">' + val + '</span>'; }else if(val < 0){ return '<span style="color:red;">' + val + '</span>'; } return val; } // example of custom renderer function function pctChange(val){ if(val > 0){ return '<span style="color:green;">' + val + '%</span>'; }else if(val < 0){ return '<span style="color:red;">' + val + '%</span>'; } return val; } function renderCompany(value, cellmeta, record, RowIndex, ColumnIndex, store) { var str = "<input type='text' id='inputGrid_" + record.id + "' value='"; if (value != null) { str += value; } str += "'>"; return str; } // the DefaultColumnModel expects this blob to define columns. It can be extended to provide // custom or reusable ColumnModels var colModel = new Ext.grid.ColumnModel([ {header: "Company", width: 260, sortable: true, dataIndex: 'company', renderer: renderCompany, unselectable:false, locked:false}, {header: "Price", width: 75, sortable: true, dataIndex: 'price', renderer: Ext.util.Format.usMoney}, {header: "Change", width: 75, sortable: true, dataIndex: 'change', renderer: change}, {header: "% Change", width: 75, sortable: true, dataIndex: 'pctChange', renderer: pctChange}, {header: "Last Updated", width: 85, sortable: true, dataIndex: 'lastChange', renderer: Ext.util.Format.dateRenderer('m/d/Y')} ]); // create the Grid var grid = new Ext.grid.Grid('grid-example', { ds : ds, cm : colModel, enableDragDrop : false }); grid.on('rowdblclick', function() { var selections = grid.getSelections(); var company = document.getElementById("inputGrid_" + selections[0].id).value; Ext.MessageBox.alert("警告撒", company); }); var layout = Ext.BorderLayout.create({ center: { margins : {left:1,top:1,right:1,bottom:1}, panels : [new Ext.GridPanel(grid)] } }, 'grid-panel'); grid.render(); grid.getSelectionModel().selectFirstRow(); } }; Ext.onReady(Example.init, Example);
JavaScript
/* * Ext JS Library 1.1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license */ /** * @class Ext.form.HtmlEditor * @extends Ext.form.Field * Provides a lightweight HTML Editor component. * <br><br><b>Note: The focus/blur and validation marking functionality inherited from Ext.form.Field is NOT * supported by this editor.</b><br/><br/> * An Editor is a sensitive component that can't be used in all spots standard fields can be used. Putting an Editor within * any element that has display set to 'none' can cause problems in Safari and Firefox.<br/><br/> * <b>Note:</b> In Ext 1.1 there can only be one HtmlEditor on a page at a time. This restriction does not apply in Ext 2.0+. */ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { /** * @cfg {Boolean} enableFormat Enable the bold, italic and underline buttons (defaults to true) */ enableFormat : true, /** * @cfg {Boolean} enableFontSize Enable the increase/decrease font size buttons (defaults to true) */ enableFontSize : true, /** * @cfg {Boolean} enableColors Enable the fore/highlight color buttons (defaults to true) */ enableColors : true, /** * @cfg {Boolean} enableAlignments Enable the left, center, right alignment buttons (defaults to true) */ enableAlignments : true, /** * @cfg {Boolean} enableLists Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true) */ enableLists : true, /** * @cfg {Boolean} enableSourceEdit Enable the switch to source edit button. Not available in Safari. (defaults to true) */ enableSourceEdit : true, /** * @cfg {Boolean} enableLinks Enable the create link button. Not available in Safari. (defaults to true) */ enableLinks : true, /** * @cfg {Boolean} enableFont Enable font selection. Not available in Safari. (defaults to true) */ enableFont : true, /** * @cfg {String} createLinkText The default text for the create link prompt */ createLinkText : 'Please enter the URL for the link:', /** * @cfg {String} defaultLinkValue The default value for the create link prompt (defaults to http:/ /) */ defaultLinkValue : 'http:/'+'/', /** * @cfg {Array} fontFamilies An array of available font families */ fontFamilies : [ '仿宋', '黑体' ], defaultFont: '仿宋', // private properties validationEvent : false, deferHeight: true, initialized : false, activated : false, sourceEditMode : false, onFocus : Ext.emptyFn, iframePad:3, hideMode:'offsets', defaultAutoCreate : { tag: "textarea", style:"width:500px;height:300px;", autocomplete: "off" }, // private initComponent : function(){ this.addEvents({ /** * @event initialize * Fires when the editor is fully initialized (including the iframe) * @param {HtmlEditor} this */ initialize: true, /** * @event activate * Fires when the editor is first receives the focus. Any insertion must wait * until after this event. * @param {HtmlEditor} this */ activate: true, /** * @event beforesync * Fires before the textarea is updated with content from the editor iframe. Return false * to cancel the sync. * @param {HtmlEditor} this * @param {String} html */ beforesync: true, /** * @event beforepush * Fires before the iframe editor is updated with content from the textarea. Return false * to cancel the push. * @param {HtmlEditor} this * @param {String} html */ beforepush: true, /** * @event sync * Fires when the textarea is updated with content from the editor iframe. * @param {HtmlEditor} this * @param {String} html */ sync: true, /** * @event push * Fires when the iframe editor is updated with content from the textarea. * @param {HtmlEditor} this * @param {String} html */ push: true, /** * @event editmodechange * Fires when the editor switches edit modes * @param {HtmlEditor} this * @param {Boolean} sourceEdit True if source edit, false if standard editing. */ editmodechange: true }) }, createFontOptions : function(){ var buf = [], fs = this.fontFamilies, ff, lc; for(var i = 0, len = fs.length; i< len; i++){ ff = fs[i]; lc = ff.toLowerCase(); buf.push( '<option value="',lc,'" style="font-family:',ff,';"', (this.defaultFont == lc ? ' selected="true">' : '>'), ff, '</option>' ); } return buf.join(''); }, /** * Protected method that will not generally be called directly. It * is called when the editor creates its toolbar. Override this method if you need to * add custom toolbar buttons. * @param {HtmlEditor} editor */ createToolbar : function(editor){ function btn(id, toggle, handler){ return { id : id, cls : 'x-btn-icon x-edit-'+id, enableToggle:toggle !== false, scope: editor, handler:handler||editor.relayBtnCmd, clickEvent:'mousedown', tooltip: editor.buttonTips[id] || undefined, tabIndex:-1 }; } // build the toolbar var tb = new Ext.Toolbar(this.wrap.dom.firstChild); // stop form submits tb.el.on('click', function(e){ e.preventDefault(); }); if(this.enableFont && !Ext.isSafari){ this.fontSelect = tb.el.createChild({ tag:'select', tabIndex: -1, cls:'x-font-select', html: this.createFontOptions() }); this.fontSelect.on('change', function(){ var font = this.fontSelect.dom.value; this.relayCmd('fontname', font); this.deferFocus(); }, this); tb.add( this.fontSelect.dom, '-' ); }; if(this.enableFormat){ tb.add( btn('bold'), btn('italic'), btn('underline') ); }; if(this.enableFontSize){ tb.add( '-', btn('increasefontsize', false, this.adjustFont), btn('decreasefontsize', false, this.adjustFont) ); }; if(this.enableColors){ tb.add( '-', { id:'forecolor', cls:'x-btn-icon x-edit-forecolor', clickEvent:'mousedown', tooltip: editor.buttonTips['forecolor'] || undefined, tabIndex:-1, menu : new Ext.menu.ColorMenu({ allowReselect: true, focus: Ext.emptyFn, value:'000000', plain:true, selectHandler: function(cp, color){ this.execCmd('forecolor', Ext.isSafari || Ext.isIE ? '#'+color : color); this.deferFocus(); }, scope: this, clickEvent:'mousedown' }) }, { id:'backcolor', cls:'x-btn-icon x-edit-backcolor', clickEvent:'mousedown', tooltip: editor.buttonTips['backcolor'] || undefined, tabIndex:-1, menu : new Ext.menu.ColorMenu({ focus: Ext.emptyFn, value:'FFFFFF', plain:true, allowReselect: true, selectHandler: function(cp, color){ if(Ext.isGecko){ this.execCmd('useCSS', false); this.execCmd('hilitecolor', color); this.execCmd('useCSS', true); this.deferFocus(); }else{ this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isSafari || Ext.isIE ? '#'+color : color); this.deferFocus(); } }, scope:this, clickEvent:'mousedown' }) } ); }; if(this.enableAlignments){ tb.add( '-', btn('justifyleft'), btn('justifycenter'), btn('justifyright') ); }; if(!Ext.isSafari){ if(this.enableLinks){ tb.add( '-', btn('createlink', false, this.createLink), btn('createImg', false, this.createImg), btn('createPageBreak', false, this.createPageBreak) ); }; if(this.enableLists){ tb.add( '-', btn('insertorderedlist'), btn('insertunorderedlist') ); } if(this.enableSourceEdit){ tb.add( '-', btn('sourceedit', true, function(btn){ this.toggleSourceEdit(btn.pressed); }) ); } } this.tb = tb; }, /** * Protected method that will not generally be called directly. It * is called when the editor initializes the iframe with HTML contents. Override this method if you * want to change the initialization markup of the iframe (e.g. to add stylesheets). */ getDocMarkup : function(){ return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>'; }, // private onRender : function(ct, position){ Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position); this.el.dom.style.border = '0 none'; this.el.dom.setAttribute('tabIndex', -1); this.el.addClass('x-hidden'); if(Ext.isIE){ // fix IE 1px bogus margin this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;') } this.wrap = this.el.wrap({ cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'} }); this.createToolbar(this); this.tb.items.each(function(item){ if(item.id != 'sourceedit'){ item.disable(); } }); var iframe = document.createElement('iframe'); iframe.name = Ext.id(); iframe.frameBorder = 'no'; iframe.src = (Ext.SSL_SECURE_URL || "javascript:false"); this.wrap.dom.appendChild(iframe); this.iframe = iframe; if(Ext.isIE){ this.doc = iframe.contentWindow.document; this.win = iframe.contentWindow; } else { this.doc = (iframe.contentDocument || window.frames[iframe.name].document); this.win = window.frames[iframe.name]; } this.doc.designMode = 'on'; this.doc.open(); this.doc.write(this.getDocMarkup()) this.doc.close(); var task = { // must defer to wait for browser to be ready run : function(){ if(this.doc.body || this.doc.readyState == 'complete'){ this.doc.designMode="on"; Ext.TaskMgr.stop(task); this.initEditor.defer(10, this); } }, interval : 10, duration:10000, scope: this }; Ext.TaskMgr.start(task); if(!this.width){ this.setSize(this.el.getSize()); } }, // private onResize : function(w, h){ Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments); if(this.el && this.iframe){ if(typeof w == 'number'){ var aw = w - this.wrap.getFrameWidth('lr'); this.el.setWidth(this.adjustWidth('textarea', aw)); this.iframe.style.width = aw + 'px'; } if(typeof h == 'number'){ var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight(); this.el.setHeight(this.adjustWidth('textarea', ah)); this.iframe.style.height = ah + 'px'; if(this.doc){ (this.doc.body || this.doc.documentElement).style.height = (ah - (this.iframePad*2)) + 'px'; } } } }, /** * Toggles the editor between standard and source edit mode. * @param {Boolean} sourceEdit (optional) True for source edit, false for standard */ toggleSourceEdit : function(sourceEditMode){ if(sourceEditMode === undefined){ sourceEditMode = !this.sourceEditMode; } this.sourceEditMode = sourceEditMode === true; var btn = this.tb.items.get('sourceedit'); if(btn.pressed !== this.sourceEditMode){ btn.toggle(this.sourceEditMode); return; } if(this.sourceEditMode){ this.tb.items.each(function(item){ if(item.id != 'sourceedit'){ item.disable(); } }); this.syncValue(); this.iframe.className = 'x-hidden'; this.el.removeClass('x-hidden'); this.el.dom.removeAttribute('tabIndex'); this.el.focus(); }else{ if(this.initialized){ this.tb.items.each(function(item){ item.enable(); }); } this.pushValue(); this.iframe.className = ''; this.el.addClass('x-hidden'); this.el.dom.setAttribute('tabIndex', -1); this.deferFocus(); } this.setSize(this.wrap.getSize()); this.fireEvent('editmodechange', this, this.sourceEditMode); }, // private used internally createLink : function(){ var url = prompt(this.createLinkText, this.defaultLinkValue); if(url && url != 'http:/'+'/'){ this.relayCmd('createlink', url); } }, // ==================================================== // modify by 2007-10-06 // I want image createImg : function() { var url = prompt("输入图片的url", this.defaultLinkValue); if (url && url != 'http:/' + '/') { this.insertAtCursor("<img src='" + url + "' />"); } }, // ==================================================== // modify by 2007-10-06 // I want page break createPageBreak : function() { this.insertAtCursor("<div style=\"page-break-after: always;\"><span style=\"display: none;\">&nbsp;</span></div>"); }, // private (for BoxComponent) adjustSize : Ext.BoxComponent.prototype.adjustSize, // private (for BoxComponent) getResizeEl : function(){ return this.wrap; }, // private (for BoxComponent) getPositionEl : function(){ return this.wrap; }, // private initEvents : function(){ this.originalValue = this.getValue(); }, /** * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide * @method */ markInvalid : Ext.emptyFn, /** * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide * @method */ clearInvalid : Ext.emptyFn, setValue : function(v){ Ext.form.HtmlEditor.superclass.setValue.call(this, v); this.pushValue(); }, /** * Protected method that will not generally be called directly. If you need/want * custom HTML cleanup, this is the method you should override. * @param {String} html The HTML to be cleaned * return {String} The cleaned HTML */ cleanHtml : function(html){ html = String(html); if(html.length > 5){ if(Ext.isSafari){ // strip safari nonsense html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, ''); } } if(html == '&nbsp;'){ html = ''; } return html; }, /** * Protected method that will not generally be called directly. Syncs the contents * of the editor iframe with the textarea. */ syncValue : function(){ if(this.initialized){ var bd = (this.doc.body || this.doc.documentElement); var html = bd.innerHTML; if(Ext.isSafari){ var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element! var m = bs.match(/text-align:(.*?);/i); if(m && m[1]){ html = '<div style="'+m[0]+'">' + html + '</div>'; } } html = this.cleanHtml(html); if(this.fireEvent('beforesync', this, html) !== false){ this.el.dom.value = html; this.fireEvent('sync', this, html); } } }, /** * Protected method that will not generally be called directly. Pushes the value of the textarea * into the iframe editor. */ pushValue : function(){ if(this.initialized){ var v = this.el.dom.value; if(v.length < 1){ v = '&nbsp;'; } if(this.fireEvent('beforepush', this, v) !== false){ (this.doc.body || this.doc.documentElement).innerHTML = v; this.fireEvent('push', this, v); } } }, // private deferFocus : function(){ this.focus.defer(10, this); }, // doc'ed in Field focus : function(){ if(this.win && !this.sourceEditMode){ this.win.focus(); }else{ this.el.focus(); } }, // private initEditor : function(){ var dbody = (this.doc.body || this.doc.documentElement); var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat'); ss['background-attachment'] = 'fixed'; // w3c dbody.bgProperties = 'fixed'; // ie Ext.DomHelper.applyStyles(dbody, ss); Ext.EventManager.on(this.doc, { 'mousedown': this.onEditorEvent, 'dblclick': this.onEditorEvent, 'click': this.onEditorEvent, 'keyup': this.onEditorEvent, buffer:100, scope: this }); if(Ext.isGecko){ Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this); } if(Ext.isIE || Ext.isSafari || Ext.isOpera){ Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this); } this.initialized = true; this.fireEvent('initialize', this); this.pushValue(); }, // private onDestroy : function(){ if(this.rendered){ this.tb.items.each(function(item){ if(item.menu){ item.menu.removeAll(); if(item.menu.el){ item.menu.el.destroy(); } } item.destroy(); }); this.wrap.dom.innerHTML = ''; this.wrap.remove(); } }, // private onFirstFocus : function(){ this.activated = true; this.tb.items.each(function(item){ item.enable(); }); if(Ext.isGecko){ // prevent silly gecko errors this.win.focus(); var s = this.win.getSelection(); if(!s.focusNode || s.focusNode.nodeType != 3){ var r = s.getRangeAt(0); r.selectNodeContents((this.doc.body || this.doc.documentElement)); r.collapse(true); this.deferFocus(); } try{ this.execCmd('useCSS', true); this.execCmd('styleWithCSS', false); }catch(e){} } this.fireEvent('activate', this); }, // private adjustFont: function(btn){ var adjust = btn.id == 'increasefontsize' ? 1 : -1; if(Ext.isSafari){ // safari adjust *= 2; } var v = parseInt(this.doc.queryCommandValue('FontSize')|| 3, 10); v = Math.max(1, v+adjust); this.execCmd('FontSize', v + (Ext.isSafari ? 'px' : 0)); }, onEditorEvent : function(e){ this.updateToolbar(); }, /** * Protected method that will not generally be called directly. It triggers * a toolbar update by reading the markup state of the current selection in the editor. */ updateToolbar: function(){ if(!this.activated){ this.onFirstFocus(); return; } var btns = this.tb.items.map, doc = this.doc; if(this.enableFont && !Ext.isSafari){ var name = (this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase(); if(name != this.fontSelect.dom.value){ this.fontSelect.dom.value = name; } } if(this.enableFormat){ btns.bold.toggle(doc.queryCommandState('bold')); btns.italic.toggle(doc.queryCommandState('italic')); btns.underline.toggle(doc.queryCommandState('underline')); } if(this.enableAlignments){ btns.justifyleft.toggle(doc.queryCommandState('justifyleft')); btns.justifycenter.toggle(doc.queryCommandState('justifycenter')); btns.justifyright.toggle(doc.queryCommandState('justifyright')); } if(!Ext.isSafari && this.enableLists){ btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist')); btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist')); } Ext.menu.MenuMgr.hideAll(); this.syncValue(); }, // private relayBtnCmd : function(btn){ this.relayCmd(btn.id); }, /** * Executes a Midas editor command on the editor document and performs necessary focus and * toolbar updates. <b>This should only be called after the editor is initialized.</b> * @param {String} cmd The Midas command * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null) */ relayCmd : function(cmd, value){ this.win.focus(); this.execCmd(cmd, value); this.updateToolbar(); this.deferFocus(); }, /** * Executes a Midas editor command directly on the editor document. * For visual commands, you should use {@link #relayCmd} instead. * <b>This should only be called after the editor is initialized.</b> * @param {String} cmd The Midas command * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null) */ execCmd : function(cmd, value){ this.doc.execCommand(cmd, false, value === undefined ? null : value); this.syncValue(); }, // private applyCommand : function(e){ if(e.ctrlKey){ var c = e.getCharCode(), cmd; if(c > 0){ c = String.fromCharCode(c); switch(c){ case 'b': cmd = 'bold'; break; case 'i': cmd = 'italic'; break; case 'u': cmd = 'underline'; break; } if(cmd){ this.win.focus(); this.execCmd(cmd); this.deferFocus(); e.preventDefault(); } } } }, /** * Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated * to insert text. * @param {String} text */ insertAtCursor : function(text){ if(!this.activated){ return; } if(Ext.isIE){ this.win.focus(); var r = this.doc.selection.createRange(); if(r){ r.collapse(true); r.pasteHTML(text); this.syncValue(); this.deferFocus(); } }else if(Ext.isGecko || Ext.isOpera){ this.win.focus(); this.execCmd('InsertHTML', text); this.deferFocus(); }else if(Ext.isSafari){ this.execCmd('InsertText', text); this.deferFocus(); } }, // private fixKeys : function(){ // load time branching for fastest keydown performance if(Ext.isIE){ return function(e){ var k = e.getKey(), r; if(k == e.TAB){ e.stopEvent(); r = this.doc.selection.createRange(); if(r){ r.collapse(true); r.pasteHTML('&nbsp;&nbsp;&nbsp;&nbsp;'); this.deferFocus(); } }else if(k == e.ENTER){ r = this.doc.selection.createRange(); if(r){ var target = r.parentElement(); if(!target || target.tagName.toLowerCase() != 'li'){ e.stopEvent(); r.pasteHTML('<br />'); r.collapse(false); r.select(); } } } }; }else if(Ext.isOpera){ return function(e){ var k = e.getKey(); if(k == e.TAB){ e.stopEvent(); this.win.focus(); this.execCmd('InsertHTML','&nbsp;&nbsp;&nbsp;&nbsp;'); this.deferFocus(); } }; }else if(Ext.isSafari){ return function(e){ var k = e.getKey(); if(k == e.TAB){ e.stopEvent(); this.execCmd('InsertText','\t'); this.deferFocus(); } }; } }(), /** * Returns the editor's toolbar. <b>This is only available after the editor has been rendered.</b> * @return {Ext.Toolbar} */ getToolbar : function(){ return this.tb; }, /** * Object collection of toolbar tooltips for the buttons in the editor. The key * is the command id associated with that button and the value is a valid QuickTips object. * For example: <pre><code> { bold : { title: 'Bold (Ctrl+B)', text: 'Make the selected text bold.', cls: 'x-html-editor-tip' }, italic : { title: 'Italic (Ctrl+I)', text: 'Make the selected text italic.', cls: 'x-html-editor-tip' }, ... </code></pre> * @type Object */ buttonTips : { bold : { title: 'Bold (Ctrl+B)', text: 'Make the selected text bold.', cls: 'x-html-editor-tip' }, italic : { title: 'Italic (Ctrl+I)', text: 'Make the selected text italic.', cls: 'x-html-editor-tip' }, underline : { title: 'Underline (Ctrl+U)', text: 'Underline the selected text.', cls: 'x-html-editor-tip' }, increasefontsize : { title: 'Grow Text', text: 'Increase the font size.', cls: 'x-html-editor-tip' }, decreasefontsize : { title: 'Shrink Text', text: 'Decrease the font size.', cls: 'x-html-editor-tip' }, backcolor : { title: 'Text Highlight Color', text: 'Change the background color of the selected text.', cls: 'x-html-editor-tip' }, forecolor : { title: 'Font Color', text: 'Change the color of the selected text.', cls: 'x-html-editor-tip' }, justifyleft : { title: 'Align Text Left', text: 'Align text to the left.', cls: 'x-html-editor-tip' }, justifycenter : { title: 'Center Text', text: 'Center text in the editor.', cls: 'x-html-editor-tip' }, justifyright : { title: 'Align Text Right', text: 'Align text to the right.', cls: 'x-html-editor-tip' }, insertunorderedlist : { title: 'Bullet List', text: 'Start a bulleted list.', cls: 'x-html-editor-tip' }, insertorderedlist : { title: 'Numbered List', text: 'Start a numbered list.', cls: 'x-html-editor-tip' }, createlink : { title: 'Hyperlink', text: 'Make the selected text a hyperlink.', cls: 'x-html-editor-tip' }, // ==================================================== // modify by 2007-10-06 // I want image createImg : { title: '插入图片', text: '插入图片', cls: 'x-html-editor-tip' }, // ==================================================== // modify by 2007-10-06 // I want page break createPageBreak : { title: '分页符', text: '手工插入分页符', cls: 'x-html-editor-tip' }, sourceedit : { title: 'Source Edit', text: 'Switch to source editing mode.', cls: 'x-html-editor-tip' } } // hide stuff that is not compatible /** * @event blur * @hide */ /** * @event change * @hide */ /** * @event focus * @hide */ /** * @event specialkey * @hide */ /** * @cfg {String} fieldClass @hide */ /** * @cfg {String} focusClass @hide */ /** * @cfg {String} autoCreate @hide */ /** * @cfg {String} inputType @hide */ /** * @cfg {String} invalidClass @hide */ /** * @cfg {String} invalidText @hide */ /** * @cfg {String} msgFx @hide */ /** * @cfg {String} validateOnBlur @hide */ });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-21 * http://code.google.com/p/anewssystem/ */ /** * 声明Ext.lingo命名控件 * TODO: 完全照抄,作用不明 */ Ext.namespace("Ext.lingo"); /** * 下拉框. * * 下拉出现一个面板,可以选择一个或多个关键字的面板 */ Ext.lingo.SearchField = function(config) { Ext.lingo.SearchField.superclass.constructor.call(this, config); }; Ext.extend(Ext.lingo.SearchField, Ext.form.TriggerField, { defaultAutoCreate : { tag : "input", type : "text", size : "10", autocomplete : "off" }, onRender : function(ct, position) { Ext.lingo.SearchField.superclass.onRender.call(this, ct, position); var hiddenId = this.el.id + "_id"; this.hiddenField = this.el.insertSibling( {tag:'input', type:'hidden', name: hiddenId, id: hiddenId}, 'before', true); }, onTriggerClick : function(){ if(this.disabled){ return; } if(this.menu == null){ this.menu = new Ext.lingo.SearchMenu(this.initialConfig); } // this.menu.picker.setValue(this.getValue()); this.menu.show(this.el, "tl-bl?"); } }); Ext.lingo.SearchMenu = function(config) { Ext.lingo.SearchMenu.superclass.constructor.call(this, config); var item = new Ext.lingo.SearchItem(config); this.add(item); }; Ext.extend(Ext.lingo.SearchMenu, Ext.menu.Menu); Ext.lingo.SearchItem = function(config){ Ext.lingo.SearchItem.superclass.constructor.call(this, new Ext.lingo.SearchPicker(config), config); this.picker = this.component; this.addEvents({select: true}); this.picker.on("render", function(picker){ //picker.getEl().swallowEvent("click"); //picker.container.addClass("x-menu-date-item"); }); this.picker.on("select", this.onSelect, this); }; Ext.extend(Ext.lingo.SearchItem, Ext.menu.Adapter); Ext.lingo.SearchPicker = function(config){ Ext.lingo.SearchPicker.superclass.constructor.call(this, config); var ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'Ext.lingo.SearchField.json' }), reader: new Ext.data.JsonReader({ root: 'topics', totalProperty: 'totalCount', id: 'post_id' }, [ {name: 'postId', mapping: 'post_id'}, {name: 'title', mapping: 'topic_title'}, {name: 'topicId', mapping: 'topic_id'}, {name: 'author', mapping: 'author'}, {name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'Y-m-d'}, {name: 'excerpt', mapping: 'post_text'} ]), baseParams: {limit:20, forumId: 4} }); // Custom rendering Template for the View var resultTpl = new Ext.Template( '<div class="search-item">', '<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>', '<a href="http://extjs.com/forum/showthread.php?t={topicId}&p={postId}" target="_blank">{title}</a></h3>', '<p>{excerpt}</p>', '</div>' ); this.ds = ds; this.resultTpl = resultTpl; //var view = new Ext.View('test', resultTpl, {store: ds}); //ds.load(); }; Ext.extend(Ext.lingo.SearchPicker, Ext.Component, { onRender : function(container) { var el = document.createElement("div"); el.className = "x-date-picker"; el.innerHTML = ''; var eo = Ext.get(el); this.el = eo; container.dom.appendChild(el); var view = new Ext.View(this.el, this.resultTpl, {store:this.ds}); this.ds.load(); } });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-13 * http://code.google.com/p/anewssystem/ */ /** * 声明Ext.lingo命名控件 * TODO: 完全照抄,作用不明 */ Ext.namespace("Ext.lingo"); /** * 拥有CRUD功能的树形. * * @param container 被渲染的html元素的id,<div id="lighttree"></div> * @param config 需要的配置{} */ Ext.lingo.JsonTree = function(container, config) { // <div id="container"></div>没有找到 // 这个配置这里不是不清楚?是不是获得MenuTree.js中创建树形下的数据,为什么用了条件表达式 // by 250678089 死胖子 2007-09-16 22:13 // // container是一个变量,值是一个div的id。 // 比如调用new Ext.lingo.JsonTree("jsonTree",{}); // html就会有一个<div id="jsonTree"></div>,这样container的值就是"jsonTree" this.container = Ext.get(container); this.id = this.container.id; this.config = config; this.rootName = config.rootName ? config.rootName : '分类'; this.metaData = config.metaData; this.urlGetAllTree = config.urlGetAllTree ? config.urlGetAllTree : "getAllTree.htm"; this.urlInsertTree = config.urlInsertTree ? config.urlInsertTree : "insertTree.htm"; this.urlRemoveTree = config.urlRemoveTree ? config.urlRemoveTree : "removeTree.htm"; this.urlSortTree = config.urlSortTree ? config.urlSortTree : "sortTree.htm"; this.urlLoadData = config.urlLoadData ? config.urlLoadData : "loadData.htm"; this.urlUpdateTree = config.urlUpdateTree ? config.urlUpdateTree : "updateTree.htm"; // 什么意思这句,作用? // by 250678089 死胖子 2007-09-16 22:13 // // 具体细节不明,猜想是调用父类的构造函数,进行初始化 Ext.lingo.JsonTree.superclass.constructor.call(this); }; Ext.extend(Ext.lingo.JsonTree, Ext.util.Observable, { init : function() { // 生成代理,具体的意思呢,是调用那个工具栏里的操作吗? // Ext.util.Observable,Ext.lingo.JsonTree 自己写的吗? // by 250678089 死胖子 2007-09-16 22:13 // // Ext.util.Observable是Ext中一个基类,提供了事件绑定与监听的一些方法 var createChild = this.createChild.createDelegate(this); var createBrother = this.createBrother.createDelegate(this); var updateNode = this.updateNode.createDelegate(this); var removeNode = this.removeNode.createDelegate(this); var save = this.save.createDelegate(this); var expandAll = this.expandAll.createDelegate(this); var collapseAll = this.collapseAll.createDelegate(this); var refresh = this.refresh.createDelegate(this); var configInfo = this.configInfo.createDelegate(this); var prepareContext = this.prepareContext.createDelegate(this); // 创建树形 if (this.treePanel == null) { var treeLoader = new Ext.tree.TreeLoader({dataUrl:this.urlGetAllTree}); this.treePanel = new Ext.tree.TreePanel(this.id, { animate : true, containerScroll : true, enableDD : true, lines : true, loader : treeLoader }); // DEL快捷键,删除节点 this.treePanel.el.addKeyListener(Ext.EventObject.DELETE, removeNode); // 自动排序 if (this.config.folderSort) { new Ext.tree.TreeSorter(this.treePanel, {folderSort:true}); } } // 生成工具条 if (this.toolbar == null) { this.buildToolbar(); } // 设置编辑器 if (this.treeEditor == null) { this.treeEditor = new Ext.tree.TreeEditor(this.treePanel, { allowBlank : false, blankText : '请添写名称', selectOnFocus : true }); // 这里不是很明白,什么意思? // by 250678089 死胖子 2007-09-16 22:13 // // 绑定before edit事件,就是在鼠标双击节点,打算编辑这个节点的文字之前做判断 // 1.如果这个节点的allowEdit属性不是true,就不让编辑这个节点 // 2.如果节点可以编辑,就把当前的text保存到oldText属性中,为了在之后判断这个节点的文字是否被修改了 this.treeEditor.on('beforestartedit', function() { var node = this.treeEditor.editNode; if(!node.attributes.allowEdit) { return false; } else { node.attributes.oldText = node.text; } }.createDelegate(this)); this.treeEditor.on('complete', function() { var node = this.treeEditor.editNode; // 如果节点没有改变,就向服务器发送修改信息 if (node.attributes.oldText == node.text) { node.attributes.oldText = null; return true; } var item = { id : node.id, name : node.text, parentId : node.parentNode.id }; this.treePanel.el.mask('提交数据,请稍候...', 'x-mask-loading'); var hide = this.treePanel.el.unmask.createDelegate(this.treePanel.el); var doSuccess = function(responseObject) { eval("var o = " + responseObject.responseText + ";"); this.treeEditor.editNode.id = o.id; hide(); }.createDelegate(this); Ext.lib.Ajax.request( 'POST', this.urlInsertTree, {success:doSuccess,failure:hide}, 'data=' + encodeURIComponent(Ext.encode(item)) ); }.createDelegate(this)); } // 右键菜单 this.treePanel.on('contextmenu', prepareContext); if (this.contextMenu == null) { this.buildContextMenu(); } // 拖拽判断 this.treePanel.on("nodedragover", function(e){ var n = e.target; if (n.leaf) { n.leaf = false; } return true; }); // 拖拽后,就向服务器发送消息,更新数据 // 本人不喜欢这种方式 if (this.config.dropUpdate) { this.treePanel.on('nodedrop', function(e) { var n = e.dropNode; var item = { id : n.id, text : n.text, parentId : e.target.id }; // 我用的连接不是这样的,用的或是,这里没有用Ajax,如果用你的Ext.lib.Ajax.request,用引是什么东西吗? // by 250678089 死胖子 2007-09-16 22:13 // // 没用过connection。估计跟ajax的功能差不多 /* var url = 'rssreaderAction.do?method=reNameChannel'; var params = {data:Ext.util.JSON.encode({ channelName:channelName, id:id, channelUrl:channelUrl, time_stamp:(new Date()).getTime()}) }; var connection = new Ext.data.Connection(); connection.request({url:url,method:'POST',params:params,callback:handle}); */ this.treePanel.el.mask('提交数据,请稍候...', 'x-mask-loading'); var hide = this.treePanel.el.unmask.createDelegate(this.treePanel.el); Ext.lib.Ajax.request( 'POST', this.urlInsertTree, {success:hide,failure:hide}, 'data=' + encodeURIComponent(Ext.encode(item)) ); }); } else { this.treePanel.on('nodedrop', function(e) { var n = e.dropNode; n.ui.textNode.style.fontWeight = "bold"; n.ui.textNode.style.color = "red"; n.ui.textNode.style.border = "1px red dotted"; }); } } // 生成工具条 , buildToolbar : function() { this.toolbar = new Ext.Toolbar(this.treePanel.el.createChild({tag:'div'})); this.toolbar.add({ text : '新增下级分类', icon : '../widgets/lingo/list-items.gif', cls : 'x-btn-text-icon album-btn', tooltip : '添加选中节点的下级分类', handler : this.createChild.createDelegate(this) }, { text : '新增同级分类', icon : '../widgets/lingo/list-items.gif', cls : 'x-btn-text-icon album-btn', tooltip : '添加选中节点的同级分类', handler : this.createBrother.createDelegate(this) }, { text : '修改分类', icon : '../widgets/lingo/list-items.gif', cls : 'x-btn-text-icon album-btn', tooltip : '修改选中分类', handler : this.updateNode.createDelegate(this) }, { text : '删除分类', icon : '../widgets/lingo/list-items.gif', cls : 'x-btn-text-icon album-btn', tooltip : '删除一个分类', handler : this.removeNode.createDelegate(this) }, '-', { text : '保存排序', icon : '../widgets/lingo/list-items.gif', cls : 'x-btn-text-icon album-btn', tooltip : '保存排序结果', handler : this.save.createDelegate(this) }, '-', { text : '展开', icon : '../widgets/lingo/list-items.gif', cls : 'x-btn-text-icon album-btn', tooltip : '展开所有分类', handler : this.expandAll.createDelegate(this) }, { text : '合拢', icon : '../widgets/lingo/list-items.gif', cls : 'x-btn-text-icon album-btn', tooltip : '合拢所有分类', handler : this.collapseAll.createDelegate(this) }, { text : '刷新', icon : '../widgets/lingo/list-items.gif', cls : 'x-btn-text-icon album-btn', tooltip : '刷新所有节点', handler : this.refresh.createDelegate(this) }); } // 生成右键菜单 , buildContextMenu : function() { this.contextMenu = new Ext.menu.Menu({ id : 'copyCtx', items : [{ id : 'createChild', icon : '../widgets/lingo/list-items.gif', handler : this.createChild.createDelegate(this), cls : 'create-mi', text : '新增下级节点' },{ id : 'createBrother', icon : '../widgets/lingo/list-items.gif', handler : this.createBrother.createDelegate(this), cls : 'create-mi', text : '新增同级节点' },{ id : 'updateNode', icon : '../widgets/lingo/list-items.gif', handler : this.updateNode.createDelegate(this), cls : 'update-mi', text : '修改节点' },{ id : 'remove', icon : '../widgets/lingo/list-items.gif', handler : this.removeNode.createDelegate(this), cls : 'remove-mi', text : '删除节点' },'-',{ id : 'expand', icon : '../widgets/lingo/list-items.gif', handler : this.expandAll.createDelegate(this), cls : 'expand-all', text : '展开' },{ id : 'collapse', icon : '../widgets/lingo/list-items.gif', handler : this.collapseAll.createDelegate(this), cls : 'collapse-all', text : '合拢' },{ id : 'refresh', icon : '../widgets/lingo/list-items.gif', handler : this.refresh.createDelegate(this), cls : 'refresh', text : '刷新' },{ id : 'config', icon : '../widgets/lingo/list-items.gif', handler : this.configInfo.createDelegate(this), text : '详细配置' }] }); } // 渲染树形 , render : function() { this.init(); // 创建根节点,下面比较乱,最好整理一下!你这里用一个右键处理我认为更好些! // by 250678089 死胖子 2007-09-16 22:13 // // 不知道具体是哪里乱,另外,这个里边是包含了右键功能的 var root = new Ext.tree.AsyncTreeNode({ text : this.rootName, draggable : true, id : '-1' }); this.treePanel.setRootNode(root); this.treePanel.render(); root.expand(false, false); }, createChild : function() { var sm = this.treePanel.getSelectionModel(); var n = sm.getSelectedNode(); if (!n) { n = this.treePanel.getRootNode(); } else { n.expand(false, false); } this.createNode(n); }, createBrother : function() { var n = this.treePanel.getSelectionModel().getSelectedNode(); if (!n) { Ext.Msg.alert('提示', "请选择一个节点"); } else if (n == this.treePanel.getRootNode()) { Ext.Msg.alert('提示', "不能为根节点增加同级节点"); } else { this.createNode(n.parentNode); } }, createNode : function(n) { var node = n.appendChild(new Ext.tree.TreeNode({ id : -1, text : '请输入分类名', cls : 'album-node', allowDrag : true, allowDelete : true, allowEdit : true, allowChildren : true })); this.treePanel.getSelectionModel().select(node); setTimeout(function(){ this.treeEditor.editNode = node; this.treeEditor.startEdit(node.ui.textNode); }.createDelegate(this), 10); }, updateNode : function() { var n = this.treePanel.getSelectionModel().getSelectedNode(); if (!n) { Ext.Msg.alert('提示', "请选择一个节点"); } else if (n == this.treePanel.getRootNode()) { Ext.Msg.alert('提示', "不能修改根节点"); } else { setTimeout(function(){ this.treeEditor.editNode = n; this.treeEditor.startEdit(n.ui.textNode); }.createDelegate(this), 10); } }, removeNode : function() { var sm = this.treePanel.getSelectionModel(); var n = sm.getSelectedNode(); if (n == null) { Ext.Msg.alert('提示', "请选择一个节点"); } else if(n.attributes.allowDelete) { Ext.Msg.confirm("提示", "是否确定删除?", function(btn, text) { if (btn == 'yes') { this.treePanel.getSelectionModel().selectPrevious(); this.treePanel.el.mask('提交数据,请稍候...', 'x-mask-loading'); // var hide = this.treePanel.el.unmask.createDelegate(this.treePanel.el); var hide = function() { this.treePanel.el.unmask(this.treePanel.el); n.parentNode.removeChild(n); }.createDelegate(this); Ext.lib.Ajax.request( 'POST', this.urlRemoveTree, {success:hide,failure:hide}, 'id=' + n.id ); } }.createDelegate(this)); } else { Ext.Msg.alert("提示", "这个节点不能删除"); } }, appendNode : function(node, array) { if (!node || node.childNodes.length < 1) { return; } for (var i = 0; i < node.childNodes.length; i++) { var child = node.childNodes[i]; array.push({id:child.id,parentId:child.parentNode.id}); this.appendNode(child, array); } }, save : function() { // 向数据库发送一个json数组,保存排序信息 this.treePanel.el.mask('提交数据,请稍候...', 'x-mask-loading'); // var hide = this.treePanel.el.unmask.createDelegate(this.treePanel.el); var hide = function() { this.treePanel.el.unmask(this.treePanel.el); this.refresh(); }.createDelegate(this); var ch = []; this.appendNode(this.treePanel.root, ch); Ext.lib.Ajax.request( 'POST', this.urlSortTree, {success:hide,failure:hide}, 'data=' + encodeURIComponent(Ext.encode(ch)) ); }, collapseAll : function() { this.contextMenu.hide(); setTimeout(function() { var node = this.getSelectedNode(); if (node == null) { this.treePanel.getRootNode().eachChild(function(n) { n.collapse(true, false); }); } else { node.collapse(true, false); } }.createDelegate(this), 10); }, expandAll : function() { this.contextMenu.hide(); setTimeout(function() { var node = this.getSelectedNode(); if (node == null) { this.treePanel.getRootNode().eachChild(function(n) { n.expand(false, false); }); } else { node.expand(false, false); } }.createDelegate(this), 10); }, prepareContext : function(node, e) { node.select(); this.contextMenu.items.get('remove')[node.attributes.allowDelete ? 'enable' : 'disable'](); this.contextMenu.showAt(e.getXY()); }, refresh : function() { this.treePanel.root.reload(); this.treePanel.root.expand(false, false); }, configInfo : function() { if (!this.dialog) { this.createDialog(); } var n = this.getSelectedNode(); //if (n == null) { // Ext.MessageBox.alert("提示", "需要选中一个节点"); //} this.menuData = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({url:this.urlLoadData + "?id=" + n.id}), reader : new Ext.data.JsonReader({},this.headers), remoteSort : false }); this.menuData.on('load', function() { for (var i = 0; i < this.metaData.length; i++) { var meta = this.metaData[i]; var id = meta.id; var value; if (meta.mapping) { try { value = eval("this.menuData.getAt(0).data." + meta.mapping); } catch (e) { value = this.menuData.getAt(0).data[meta.mapping]; } } else { value = this.menuData.getAt(0).data[id]; } if (meta.vType == "radio") { for (var j = 0; j < meta.values.length; j++) { var theId = meta.values[j].id; var theName = meta.values[j].name; if (value == theId) { this.columns[id + theId].checked = true; this.columns[id + theId].el.dom.checked = true; } else { this.columns[id + theId].checked = false; this.columns[id + theId].el.dom.checked = false; } } } else if (meta.vType == "date") { if (value == null ) { this.columns[id].setValue(new Date()); } else { this.columns[id].setValue(value); } } else { this.columns[id].setValue(value); } } this.dialog.show(this.treePanel.getSelectionModel().getSelectedNode().ui.textNode); }.createDelegate(this)); this.menuData.load(); } // 生成对话框 , createDialog : function() { this.dialog = Ext.lingo.FormUtils.createTabedDialog(this.config.dialogContent + "-dialog", ['详细配置','帮助']); this.yesBtn = this.dialog.addButton("确定", function() { var item = Ext.lingo.FormUtils.serialFields(this.columns); if (!item) { return; } this.dialog.el.mask('提交数据,请稍候...', 'x-mask-loading'); var hide = function() { this.dialog.el.unmask(); this.dialog.hide(); this.refresh(); }.createDelegate(this); Ext.lib.Ajax.request( 'POST', this.urlUpdateTree, {success:hide,failure:hide}, 'data=' + encodeURIComponent(Ext.encode(item)) ); }.createDelegate(this), this.dialog); this.tabs = this.dialog.getTabs(); this.tabs.getTab(0).on("activate", function() { this.yesBtn.show(); }, this, true); this.tabs.getTab(1).on("activate", function(){ this.yesBtn.hide(); }, this, true); var dialogContent = Ext.get(this.config.dialogContent); this.tabs.getTab(0).setContent(dialogContent.dom.innerHTML); document.body.removeChild(document.getElementById(this.config.dialogContent)); this.applyElements(); this.noBtn = this.dialog.addButton("取消", this.dialog.hide, this.dialog); } // 自动生成一切的地方 , applyElements : function() { if (this.columns == null || this.headers == null) { this.headers = new Array(); for (var i = 0; i < this.config.metaData.length; i++) { if (this.metaData[i].mapping) { this.headers[this.headers.length] = this.metaData[i].mapping; } else { this.headers[this.headers.length] = this.metaData[i].id; } } // 打开验证功能 //Ext.form.Field.prototype.msgTarget = 'side'; //Ext.form.Field.prototype.height = 20; //Ext.form.Field.prototype.fieldClass = 'text-field-default'; //Ext.form.Field.prototype.focusClass = 'text-field-focus'; //Ext.form.Field.prototype.invalidClass = 'text-field-invalid'; this.columns = Ext.lingo.FormUtils.createAll(this.metaData); } } // 返回当前选中的节点,可能为null , getSelectedNode : function() { var selectionModel = this.treePanel.getSelectionModel(); var node = selectionModel.getSelectedNode(); return node; } });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-13 * http://code.google.com/p/anewssystem/ */ Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // 布局管理器 var layout = new Ext.BorderLayout(document.body, { center: { autoScroll : true, titlebar : false, tabPosition : 'top', closeOnTab : true, alwaysShowTabs : true, resizeTabs : true, fillToFrame : true } }); // 设置布局 layout.beginUpdate(); layout.add('center', new Ext.ContentPanel('tab1', { title : '菜单设置', toolbar : null, closable : false, fitToFrame : true })); layout.add('center', new Ext.ContentPanel('tab2', { title: "帮助", toolbar: null, closable: false, fitToFrame: true })); layout.restoreState(); layout.endUpdate(); layout.getRegion("center").showPanel("tab1"); // 默认需要id, name, theSort, parent, children // 其他随意定制 var metaData = [ {id : 'id', qtip : "ID", vType : "integer", allowBlank : true, defValue : -1}, {id : 'name', qtip : "菜单名称", vType : "chn", allowBlank : false}, {id : 'qtip', qtip : "提示", vType : "chn", allowBlank : true}, {id : 'url', qtip : "访问路径", vType : "url", allowBlank : true}, {id : 'image', qtip : "图片", vType : "alphanum", allowBlank : true, defValue : "user.gif"}, {id : 'updateDate', qtip : "更新时间", vType : "date", allowBlank : false}, {id : 'descn', qtip : "描述", vType : "chn", allowBlank : true} ]; // 创建树形 var lightTree = new Ext.lingo.JsonTree("lighttree", { metaData : metaData, dialogContent : "content", urlGetAllTree : "getAll.json", urlInsertTree : "success.json", urlRemoveTree : "success.json", urlSortTree : "success.json", urlLoadData : "loadData.json", urlUpdateTree : "success.json" }); // 渲染树形 lightTree.render(); });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-13 * http://code.google.com/p/anewssystem/ */ /** * 声明Ext.lingo命名控件 * TODO: 完全照抄,作用不明 */ Ext.namespace('Ext.lingo'); /** * 带checkbox的多选grid. * * @param container 被渲染的html元素的id,<div id="lightgrid"></div> * @param config 需要的配置{} * @see http://extjs.com/forum/showthread.php?t=8162 Ext.ux.CheckRowSelectionGrid */ Ext.lingo.CheckRowSelectionGrid = function(container, config) { // id var id = this.root_cb_id = Ext.id(null, 'cbsm-'); // checkbox模板 var cb_html = String.format("<input class='l-tcb' type='checkbox' id='{0}'/>", this.root_cb_id); // grid var grid = this; // columnModel var cm = config.cm; // Hack var cm = config.cm || config.colModel; // 操作columnModel cm.config.unshift({ id : id, header : cb_html, width : 20, resizable : false, fixed : true, sortable : false, dataIndex : -1, renderer : function(data, cell, record, rowIndex, columnIndex, store) { return String.format( "<input class='l-tcb' type='checkbox' id='{0}-{1}' {2}/>", id, rowIndex, grid.getSelectionModel().isSelected(rowIndex) ? "checked='checked'" : '' ); } }); cm.lookup[id] = cm.config[0]; Ext.lingo.CheckRowSelectionGrid.superclass.constructor.call(this, container, config); } Ext.extend(Ext.lingo.CheckRowSelectionGrid, Ext.grid.Grid, { root_cb_id : null // 获得选择模型,如果当前没有设置,就返回咱们定义的这个带checkbox的东东 , getSelectionModel: function() { if (!this.selModel) { this.selModel = new Ext.lingo.CheckRowSelectionModel(); } return this.selModel; } }); Ext.lingo.Store = function(config){ Ext.lingo.Store.superclass.constructor.call(this, config); } Ext.extend(Ext.lingo.Store, Ext.data.Store, { // 重写sort方法,让我们可以用mapping代替name进行排序 sort : function(fieldName, dir){ var f = this.fields.get(fieldName); // 如果存在mapping,就使用mapping替换name实现排序 var sortName = f.name; if (f.mapping) { sortName = f.mapping; } if(!dir){ if(this.sortInfo && this.sortInfo.field == sortName){ dir = (this.sortToggle[sortName] || "ASC").toggle("ASC", "DESC"); }else{ dir = f.sortDir; } } this.sortToggle[sortName] = dir; this.sortInfo = {field: sortName, direction: dir}; if(!this.remoteSort){ this.applySort(); this.fireEvent("datachanged", this); }else{ this.load(this.lastOptions); } } }); // 行模型 Ext.lingo.CheckRowSelectionModel = function(options) { Ext.lingo.CheckRowSelectionModel.superclass.constructor.call(this, options); this.useHistory = options.useHistory === true; if (this.useHistory) { this.Set = { items : {} , add : function(r) { this.items[r.id] = r; } , remove : function(r) { this.items[r.id] = null; } , clear : function() { this.items = {}; } , values : function() { var array = new Array(); for (var i in this.items) { if (this.items[i]) { array[array.length] = this.items[i]; } } return array; } }; } } Ext.extend(Ext.lingo.CheckRowSelectionModel, Ext.grid.RowSelectionModel, { init: function(grid) { Ext.lingo.CheckRowSelectionModel.superclass.init.call(this, grid); // Start of dirty hacking // Hacking grid if (grid.processEvent) { grid.__oldProcessEvent = grid.processEvent; grid.processEvent = function(name, e) { // The scope of this call is the grid object var target = e.getTarget(); var view = this.getView(); var header_index = view.findHeaderIndex(target); if (name == 'contextmenu' && header_index === 0) { return; } this.__oldProcessEvent(name, e); } } // Hacking view var gv = grid.getView(); if (gv.beforeColMenuShow) { gv.__oldBeforeColMenuShow = gv.beforeColMenuShow; gv.beforeColMenuShow = function() { // The scope of this call is the view object this.__oldBeforeColMenuShow(); // Removing first - checkbox column from the column menu this.colMenu.remove(this.colMenu.items.first()); // he he } } // End of dirty hacking }, initEvents: function() { Ext.lingo.CheckRowSelectionModel.superclass.initEvents.call(this); this.grid.getView().on('refresh', this.onGridRefresh, this); }, // 选择这一行 selectRow: function(index, keepExisting, preventViewNotify) { try { Ext.lingo.CheckRowSelectionModel.superclass.selectRow.call( this, index, keepExisting, preventViewNotify ); var row_id = this.grid.root_cb_id + '-' + index; var cb_dom = Ext.fly(row_id).dom; cb_dom.checked = true; if (this.useHistory) { // change var r = this.grid.dataSource.getAt(index); this.Set.add(r); } } catch(e) { if (this.useHistory) { this.Set.clear(); } } }, // 反选,取消选择,这一行 deselectRow: function(index, preventViewNotify) { try { Ext.lingo.CheckRowSelectionModel.superclass.deselectRow.call( this, index, preventViewNotify ); var row_id = this.grid.root_cb_id + '-' + index; var cb_dom = Ext.fly(row_id).dom; cb_dom.checked = false; if (this.useHistory) { // change var r = this.grid.dataSource.getAt(index); this.Set.remove(r); } } catch (e) { if (this.useHistory) { this.Set.clear(); } } }, onGridRefresh: function() { Ext.fly(this.grid.root_cb_id).on('click', this.onAllRowsCheckboxClick, this, {stopPropagation:true}); // Attaching to row checkboxes events for (var i = 0; i < this.grid.getDataSource().getCount(); i++) { var cb_id = this.grid.root_cb_id + '-' + i; Ext.fly(cb_id).on('mousedown', this.onRowCheckboxClick, this, {stopPropagation:true}); } if (this.useHistory) { // change var ds = this.grid.dataSource, i, v = this.grid.view; var values = this.Set.values(); for (var i = 0; i < values.length; i++) { var r = values[i]; var id = r.id; if((index = ds.indexOfId(id)) != -1){ // 让GridView看起来是选中的样子 v.onRowSelect(index); // 让checkbox看起来是选中的样子 var row_id = this.grid.root_cb_id + '-' + index; var cb_dom = Ext.fly(row_id).dom; cb_dom.checked = true; } // 让this.selections里边是选中的样子 this.selections.add(r); } } }, onAllRowsCheckboxClick: function(event, el) { if (el.checked) { this.selectAll(); } else { this.clearSelections(); } }, onRowCheckboxClick: function(event, el) { var rowIndex = /-(\d+)$/.exec(el.id)[1]; if (el.checked) { this.deselectRow(rowIndex); el.checked = true; } else { this.selectRow(rowIndex, true); el.checked = false; } } });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-13 * http://code.google.com/p/anewssystem/ */ Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // 布局管理器 var layout = new Ext.BorderLayout(document.body, { center: { autoScroll : true, titlebar : false, tabPosition : 'top', closeOnTab : true, alwaysShowTabs : true, resizeTabs : true, fillToFrame : true } }); // 设置布局 layout.beginUpdate(); layout.add('center', new Ext.ContentPanel('tab1', { title : '菜单设置', toolbar : null, closable : false, fitToFrame : true })); layout.add('center', new Ext.ContentPanel('tab2', { title: "帮助", toolbar: null, closable: false, fitToFrame: true })); layout.restoreState(); layout.endUpdate(); layout.getRegion("center").showPanel("tab1"); // 默认需要id, name, theSort, parent, children // 其他随意定制 var metaData = [ {id : 'id', qtip : "ID", vType : "number", allowBlank : false, defValue : 0, w:50}, {id : 'name', qtip : "菜单名称", vType : "chn", allowBlank : false, defValue : '', w:100}, {id : 'qtip', qtip : "提示", vType : "chn", allowBlank : true, defValue : '', w:100}, {id : 'url', qtip : "访问路径", vType : "url", allowBlank : true, defValue : '', w:100}, {id : 'image', qtip : "图片", vType : "alphanum", allowBlank : true, defValue : "user.gif", w:100}, {id : 'updateDate', qtip : "更新时间", vType : "date", allowBlank : false, defValue : '', w:120}, {id : 'descn', qtip : "描述", vType : "chn", allowBlank : true, defValue : '', w:150}, {id : 'checkbox', qtip : "checkbox", vType : "checkbox", inputValue : 'true', defValue: '', renderer: function(value) { return value == 'true' ? '是' : '否'; }} ]; // 创建表格 var lightGrid = new Ext.lingo.JsonGrid("lightgrid", { metaData : metaData, dialogContent : "content", urlPagedQuery : "pagedQuery.json", urlSave : "success.json", urlLoadData : "loadData.json", urlRemove : "success.json" }); // 渲染表格 lightGrid.render(); });
JavaScript
Ext.ux.PageSizePlugin = function() { Ext.ux.PageSizePlugin.superclass.constructor.call(this, { store: new Ext.data.SimpleStore({ fields: ['text', 'value'], data: [['5', 5], ['15', 15], ['30', 30], ['50', 50], ['100', 100]] }), mode: 'local', displayField: 'text', valueField: 'value', editable: false, allowBlank: false, triggerAction: 'all', width: 40 }); }; Ext.extend(Ext.ux.PageSizePlugin, Ext.form.ComboBox, { init: function(paging) { //paging.on('render', this.onInitView, this); this.onInitView(paging); }, onInitView: function(paging) { paging.add('-', this, '每页' ); this.setValue(paging.pageSize); this.on('select', this.onPageSizeChanged, paging); }, onPageSizeChanged: function(combo) { this.pageSize = parseInt(combo.getValue()); //this.doLoad(0); this.onClick('refresh'); } });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-19 * http://code.google.com/p/anewssystem/ */ /** * 声明Ext.lingo命名控件 * TODO: 完全照抄,作用不明 */ Ext.namespace("Ext.lingo"); /** * 拥有CRUD功能的表格. * * @param container 被渲染的html元素的id,<div id="lightgrid"></div> * @param config 需要的配置{} */ Ext.lingo.JsonGrid = function(container, config) { this.container = Ext.get(container); this.id = container; this.config = config; this.metaData = config.metaData; this.genHeader = config.genHeader !== false; //this.useHistory = config.useHistory !== false; this.useHistory = false; this.pageSize = config.pageSize ? config.pageSize : 15; this.dialogWidth = config.dialogWidth; this.dialogHeight = config.dialogHeight; this.urlPagedQuery = config.urlPagedQuery ? config.urlPagedQuery : "pagedQuery.htm"; this.urlLoadData = config.urlLoadData ? config.urlLoadData : "loadData.htm"; this.urlSave = config.urlSave ? config.urlSave : "save.htm"; this.urlRemove = config.urlRemove ? config.urlRemove : "remove.htm"; this.filterTxt = ""; Ext.lingo.JsonGrid.superclass.constructor.call(this); } Ext.extend(Ext.lingo.JsonGrid, Ext.util.Observable, { // 初始化 init : function() { // 根据this.headers生成columnModel if (!this.columnModel) { this.initColumnModel(); } // 生成data record if (!this.dataRecord) { var recordHeaders = new Array(); for (var i = 0; i < this.metaData.length; i++) { var meta = this.metaData[i]; var item = {}; item.name = meta.id; item.type = "string"; if (meta.mapping) { item.mapping = meta.mapping; } item.defaultValue = ""; //item.dateFormat = "yyyy-MM-dd"; recordHeaders[recordHeaders.length] = item; } this.dataRecord = Ext.data.Record.create(recordHeaders); } // 生成data store if (!this.dataStore) { this.dataStore = new Ext.lingo.Store({ proxy : new Ext.data.HttpProxy({url:this.urlPagedQuery}), reader : new Ext.data.JsonReader({ root : "result", totalProperty : "totalCount", id : "id" }, recordHeaders), remoteSort : true }); // this.dataStore.setDefaultSort("enterDate", "ASC"); } // 生成表格 if (!this.grid) { this.grid = new Ext.lingo.CheckRowSelectionGrid(this.id, { ds : this.dataStore , cm : this.columnModel // selModel: new Ext.grid.CellSelectionModel(), // selModel: new Ext.grid.RowSelectionModel({singleSelect:false}), , selModel : new Ext.lingo.CheckRowSelectionModel({useHistory:this.useHistory}) , enableColLock : false , loadMask : true }); this.grid.on('rowdblclick', this.edit, this); } //右键菜单 this.grid.addListener('rowcontextmenu', this.contextmenu, this); } // 初始化ColumnModel , initColumnModel : function() { var columnHeaders = new Array(); for (var i = 0; i < this.metaData.length; i++) { var meta = this.metaData[i]; if (meta.showInGrid === false) { continue; } var item = {}; item.header = meta.qtip; item.sortable = true; item.dataIndex = meta.id; item.mapping = meta.mapping; item.width = meta.w ? meta.w : 110; item.defaultValue = ""; // item.hidden = false; if (meta.renderer) { item.renderer = meta.renderer; } columnHeaders[columnHeaders.length] = item; } this.columnModel = new Ext.grid.ColumnModel(columnHeaders); this.columnModel.defaultSortable = false; } // 渲染 , postRender : function() { // 生成头部工具栏 if (this.genHeader) { var gridHeader = this.grid.getView().getHeaderPanel(true); this.toolbar = new Ext.Toolbar(gridHeader); var checkItems = new Array(); for (var i = 0; i < this.metaData.length; i++) { var meta = this.metaData[i]; if (meta.showInGrid === false) { continue; } var item = new Ext.menu.CheckItem({ text : meta.qtip, value : meta.id, checked : true, group : "filter", checkHandler : this.onItemCheck.createDelegate(this) }); checkItems[checkItems.length] = item; } this.filterButton = new Ext.Toolbar.MenuButton({ icon : "../widgets/lingo/list-items.gif", cls : "x-btn-text-icon", text : "请选择", tooltip : "选择搜索的字段", menu : checkItems, minWidth : 105 }); this.toolbar.add({ icon : "../widgets/lingo/list-items.gif", id : 'add', text : '新增', cls : 'add', tooltip : '新增', handler : this.add.createDelegate(this) }, { icon : "../widgets/lingo/list-items.gif", id : 'edit', text : '修改', cls : 'edit', tooltip : '修改', handler : this.edit.createDelegate(this) }, { icon : "../widgets/lingo/list-items.gif", id : 'del', text : '删除', cls : 'del', tooltip : '删除', handler : this.del.createDelegate(this) }, '->', this.filterButton); // 输入框 this.filter = Ext.get(this.toolbar.addDom({ tag : 'input', type : 'text', size : '20', value : '', style : 'background: #F0F0F9;' }).el); this.filter.on('keypress', function(e) { if(e.getKey() == e.ENTER && this.filter.getValue().length > 0) { this.dataStore.reload(); } }.createDelegate(this)); this.filter.on('keyup', function(e) { if(e.getKey() == e.BACKSPACE && this.filter.getValue().length === 0) { this.dataStore.reload(); } }.createDelegate(this)); // 设置baseParams this.setBaseParams(); } // 页脚 var gridFooter = this.grid.getView().getFooterPanel(true); // 把分页工具条,放在页脚 var paging = new Ext.PagingToolbar(gridFooter, this.dataStore, { pageSize : this.pageSize , displayInfo : true , displayMsg : '显示: {0} - {1} 共 {2} 条记录' , emptyMsg : "没有找到相关数据" , beforePageText : "第" , afterPageText : "页,共{0}页" }); var pageSizePlugin = new Ext.ux.PageSizePlugin(); pageSizePlugin.init(paging); this.dataStore.load({ params:{start:0, limit:paging.pageSize} }); } // 设置baseParams , setBaseParams : function() { // 读取数据 this.dataStore.on('beforeload', function() { this.dataStore.baseParams = { filterValue : this.filter.getValue(), filterTxt : this.filterTxt }; }.createDelegate(this)); } // 进行渲染 , render : function() { this.init(); this.grid.render(); this.postRender(); } // 弹出添加对话框,添加一条新记录 , add : function() { if (!this.dialog) { this.createDialog(); } Ext.lingo.FormUtils.resetFields(this.columns); this.dialog.show(Ext.get("add")); } // 弹出修改对话框 , edit : function() { if (!this.dialog) { this.createDialog(); } var selections = this.grid.getSelections(); if (selections.length == 0) { Ext.MessageBox.alert("提示", "请选择希望修改的记录!"); return; } else if (selections.length != 1) { Ext.MessageBox.alert("提示", "只允许选择单行记录进行修改!"); return; } this.menuData = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({url:this.urlLoadData + "?id=" + selections[0].id}), reader : new Ext.data.JsonReader({},this.headers), remoteSort : false }); this.menuData.on('load', function() { for (var i = 0; i < this.metaData.length; i++) { var meta = this.metaData[i]; var id = meta.id; var value; if (meta.mapping) { try { value = eval("this.menuData.getAt(0).data." + meta.mapping); } catch (e) { value = this.menuData.getAt(0).data[meta.mapping]; } } else { value = this.menuData.getAt(0).data[id]; } if (meta.vType == "radio") { for (var j = 0; j < meta.values.length; j++) { var theId = meta.values[j].id; var theName = meta.values[j].name; if (value == theId) { this.columns[id + theId].checked = true; this.columns[id + theId].el.dom.checked = true; } else { this.columns[id + theId].checked = false; this.columns[id + theId].el.dom.checked = false; } } } else if (meta.vType == "date") { if (value == null ) { this.columns[id].setValue(new Date()); } else { this.columns[id].setValue(value); } } else { this.columns[id].setValue(value); } } this.dialog.show(Ext.get("edit")); }.createDelegate(this)); this.menuData.load(); } // 删除记录 , del : function() { var selections = this.grid.getSelections(); if (selections.length == 0) { Ext.MessageBox.alert("提示", "请选择希望删除的记录!"); return; } else { Ext.Msg.confirm("提示", "是否确定删除?", function(btn, text) { if (btn == 'yes') { var selections = this.grid.getSelections(); var ids = new Array(); for(var i = 0, len = selections.length; i < len; i++){ try { // 如果选中的record没有在这一页显示,remove就会出问题 selections[i].get("id"); ids[i] = selections[i].get("id"); this.dataStore.remove(selections[i]);//从表格中删除 } catch (e) { } if (this.useHistory) { this.grid.selModel.Set.clear(); } } Ext.Ajax.request({ url : this.urlRemove + '?ids=' + ids, success : function() { Ext.MessageBox.alert(' 提示', '删除成功!'); this.refresh(); }.createDelegate(this), failure : function(){Ext.MessageBox.alert('提示', '删除失败!');} }); } }.createDelegate(this)); } } // 创建弹出式对话框 , createDialog : function() { this.dialog = Ext.lingo.FormUtils.createTabedDialog('dialog', ['详细配置','帮助'], this.dialogWidth, this.dialogHeight); this.yesBtn = this.dialog.addButton("确定", function() { var item = Ext.lingo.FormUtils.serialFields(this.columns); if (!item) { return; } this.submitForm(item); }.createDelegate(this), this.dialog); // 设置两个tab this.tabs = this.dialog.getTabs(); this.tabs.getTab(0).on("activate", function() { this.yesBtn.show(); }, this, true); this.tabs.getTab(1).on("activate", function(){ this.yesBtn.hide(); }, this, true); var dialogContent = Ext.get(this.config.dialogContent); this.tabs.getTab(0).setContent(dialogContent.dom.innerHTML); document.body.removeChild(document.getElementById(this.config.dialogContent)); this.applyElements(); this.noBtn = this.dialog.addButton("取消", this.dialog.hide, this.dialog); } // 提交添加,修改表单 , submitForm : function(item) { this.dialog.el.mask('提交数据,请稍候...', 'x-mask-loading'); var hide = function() { this.dialog.el.unmask(); this.dialog.hide(); this.refresh.apply(this); }.createDelegate(this); console.error(Ext.encode(item)); Ext.lib.Ajax.request( 'POST', this.urlSave, {success:hide,failure:hide}, 'data=' + encodeURIComponent(Ext.encode(item)) ); } // 超级重要的一个方法,自动生成表头,自动生成form,都是在这里进行的 , applyElements : function() { if (this.columns == null || this.headers == null) { this.headers = new Array(); for (var i = 0; i < this.metaData.length; i++) { if (this.metaData[i].mapping) { this.headers[this.headers.length] = this.metaData[i].mapping; } else { this.headers[this.headers.length] = this.metaData[i].id; } } // 打开验证功能 //Ext.form.Field.prototype.msgTarget = 'side'; //Ext.form.Field.prototype.height = 20; //Ext.form.Field.prototype.fieldClass = 'text-field-default'; //Ext.form.Field.prototype.focusClass = 'text-field-focus'; //Ext.form.Field.prototype.invalidClass = 'text-field-invalid'; this.columns = Ext.lingo.FormUtils.createAll(this.metaData); } } // 选中搜索属性选项时 , onItemCheck : function(item, checked) { if(checked) { this.filterButton.setText(item.text + ':'); this.filterTxt = item.value; } } // 弹出右键菜单 // 修改,和批量删除的功能 // 多选的时候,不允许修改就好了 , contextmenu : function(grid, rowIndex, e) { e.preventDefault(); e.stopEvent(); var updateMenu = new Ext.menu.Item({ icon : '../widgets/lingo/list-items.gif' , id : 'updateMenu' , text : '修改' , handler : this.edit.createDelegate(this) }); var removeMenu = new Ext.menu.Item({ icon : '../widgets/lingo/list-items.gif' , id : 'removeMenu' , text : '删除' , handler : this.del.createDelegate(this) }); var selections = this.grid.getSelections(); if (selections.length > 1) { updateMenu.disable(); } var menuList = [updateMenu, removeMenu]; grid_menu = new Ext.menu.Menu({ id : 'mainMenu' , items : menuList }); var coords = e.getXY(); grid_menu.showAt([coords[0], coords[1]]); } // 刷新表格数据 , refresh : function() { this.dataStore.reload(); } });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-21 * http://code.google.com/p/anewssystem/ */ // 闭包,只创建一次 Ext.form.VTypes = function() { // 英文字母,空格,下划线 var alpha = /^[a-zA-Z\ _]+$/; // 英文字幕,数字,空格,下划线 var alphanum = /^[a-zA-Z0-9\ _]+$/; // 电子邮件 var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/; // url var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; // 中文 var chn = /[^\xB0-\xF7]+$/; // davi // 下列信息和方法都是可配置的 return { // email 'email' : function(v){ return email.test(v); }, 'emailText' : 'This field should be an e-mail address in the format "user@domain.com"', 'emailMask' : /[a-z0-9_\.\-@]/i, // url 'url' : function(v){ return url.test(v); }, 'urlText' : 'This field should be a URL in the format "http:/'+'/www.domain.com"', // 英文字母 'alpha' : function(v){ return alpha.test(v); }, 'alphaText' : 'This field should only contain letters and _', 'alphaMask' : /[a-z\ _]/i, // 英文字母和数字和下划线和点 'alphanum' : function(v){ return alphanum.test(v); }, 'alphanumText' : 'This field should only contain letters, numbers and _', 'alphanumMask' : /[a-z0-9\.\ _]/i,//davi // 整数------ 'integer' : function(v){ return alphanum.test(v); }, 'integerText' : 'This field should only contain letters, integer', 'integerMask' : /[0-9]/i, // 数值型 'number' : function(v){ var sign = v.indexOf('-')>=0 ? '-' : '+'; return IsNumber(v, sign); // double.test(v); }, 'numberText' : 'This field should only contain letters, number', 'numberMask' : /[0-9\.]/i, // 汉字和英文字母 'chn' : function(v){ return chn.test(v); }, 'chnText' : 'This field should only contain letters, number', 'chnMask' : /[\xB0-\xF7a-z0-9\.\/\#\,\ _-]/i }; }();
JavaScript
/* Extending/depending on: ~ = modified function (when updating from SVN be sure to check these for changes, especially to Ext.tree.TreeNodeUI.render() ) + = added function TreeSelectionModel.js Ext.tree.CheckNodeMultiSelectionModel : ~init(), ~onNodeClick(), +extendSelection(), ~onKeyDown() TreeNodeUI.js Ext.tree.CheckboxNodeUI : ~render(), +checked(), +check(), +toggleCheck() TreePanel.js Ext.tree.TreePanel : +getChecked() TreeLoader.js Ext.tree.TreeLoader : ~createNode() */ /** * Retrieve an array of ids of checked nodes * @return {Array} array of ids of checked nodes */ Ext.tree.TreePanel.prototype.getChecked = function(node){ var checked = [], i; if( typeof node == 'undefined' ) { node = this.rootVisible ? this.getRootNode() : this.getRootNode().firstChild; } if( node.attributes.checked ) { checked.push(node.id); if( !node.isLeaf() ) { for( i = 0; i < node.childNodes.length; i++ ) { checked = checked.concat( this.getChecked(node.childNodes[i]) ); } } } return checked; }; /** * @class Ext.tree.CustomUITreeLoader * @extends Ext.tree.TreeLoader * Overrides createNode to force uiProvider to be an arbitrary TreeNodeUI to save bandwidth */ Ext.tree.CustomUITreeLoader = function() { Ext.tree.CustomUITreeLoader.superclass.constructor.apply(this, arguments); }; Ext.extend(Ext.tree.CustomUITreeLoader, Ext.tree.TreeLoader, { createNode : function(attr){ Ext.apply(attr, this.baseAttr || {}); if(this.applyLoader !== false){ attr.loader = this; } if(typeof attr.uiProvider == 'string'){ attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider); } return(attr.leaf ? new Ext.tree.TreeNode(attr) : new Ext.tree.AsyncTreeNode(attr)); } }); /** * @class Ext.tree.CheckboxNodeUI * @extends Ext.tree.TreeNodeUI * Adds a checkbox to all nodes */ Ext.tree.CheckboxNodeUI = function() { Ext.tree.CheckboxNodeUI.superclass.constructor.apply(this, arguments); }; Ext.extend(Ext.tree.CheckboxNodeUI, Ext.tree.TreeNodeUI, { /** * This is virtually identical to Ext.tree.TreeNodeUI.render, modifications are indicated inline */ render : function(bulkRender){ var n = this.node; /* in later svn builds this changes to n.ownerTree.innerCt.dom */ var targetNode = n.parentNode ? n.parentNode.ui.getContainer() : n.ownerTree.container.dom; if(!this.rendered){ this.rendered = true; var a = n.attributes; // add some indent caching, this helps performance when rendering a large tree this.indentMarkup = ""; if(n.parentNode){ this.indentMarkup = n.parentNode.ui.getChildIndent(); } // modification: added checkbox var buf = ['<li class="x-tree-node"><div class="x-tree-node-el ', n.attributes.cls,'">', '<span class="x-tree-node-indent">',this.indentMarkup,"</span>", '<img src="', this.emptyIcon, '" class="x-tree-ec-icon">', '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on">', '<input class="l-tcb" type="checkbox" ', (a.checked ? "checked>" : '>'), '<a hidefocus="on" href="',a.href ? a.href : "#",'" ', a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '>', '<span unselectable="on">',n.text,"</span></a></div>", '<ul class="x-tree-node-ct" style="display:none;"></ul>', "</li>"]; if(bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()){ this.wrap = Ext.DomHelper.insertHtml("beforeBegin", n.nextSibling.ui.getEl(), buf.join("")); }else{ this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join("")); } this.elNode = this.wrap.childNodes[0]; this.ctNode = this.wrap.childNodes[1]; var cs = this.elNode.childNodes; this.indentNode = cs[0]; this.ecNode = cs[1]; this.iconNode = cs[2]; this.checkbox = cs[3]; // modification: inserted checkbox this.anchor = cs[4]; this.textNode = cs[4].firstChild; if(a.qtip){ if(this.textNode.setAttributeNS){ this.textNode.setAttributeNS("ext", "qtip", a.qtip); if(a.qtipTitle){ this.textNode.setAttributeNS("ext", "qtitle", a.qtipTitle); } }else{ this.textNode.setAttribute("ext:qtip", a.qtip); if(a.qtipTitle){ this.textNode.setAttribute("ext:qtitle", a.qtipTitle); } } } else if(a.qtipCfg) { a.qtipCfg.target = Ext.id(this.textNode); Ext.QuickTips.register(a.qtipCfg); } this.initEvents(); // modification: Add additional handlers here to avoid modifying Ext.tree.TreeNodeUI Ext.fly(this.checkbox).on('click', this.check.createDelegate(this, [null])); n.on('dblclick', function(e) { if( this.isLeaf() ) { this.getUI().toggleCheck(); } }); if(!this.node.expanded){ this.updateExpandIcon(); } }else{ if(bulkRender === true) { targetNode.appendChild(this.wrap); } } }, checked : function() { return this.checkbox.checked; }, /** * Sets a checkbox appropriately. By default only walks down through child nodes * if called with no arguments (onchange event from the checkbox), otherwise * it's assumed the call is being made programatically and the correct arguments are provided. * @param {Boolean} state true to check the checkbox, false to clear it. (defaults to the opposite of the checkbox.checked) * @param {Boolean} descend true to walk through the nodes children and set their checkbox values. (defaults to false) */ check : function(state, descend, bulk) { var n = this.node; var tree = n.getOwnerTree(); var parentNode = n.parentNode;n if( !n.expanded && !n.childrenRendered ) { n.expand(false, false, this.check.createDelegate(this, arguments)); } if( typeof bulk == 'undefined' ) { bulk = false; } if( typeof state == 'undefined' || state === null ) { state = this.checkbox.checked; descend = !state; if( state ) { n.expand(false, false); } } else { this.checkbox.checked = state; } n.attributes.checked = state; // do we have parents? if( parentNode !== null && state ) { // if we're checking the box, check it all the way up if( parentNode.getUI().check ) { parentNode.getUI().check(state, false, true); } } if( descend && !n.isLeaf() ) { var cs = n.childNodes; for(var i = 0; i < cs.length; i++) { cs[i].getUI().check(state, true, true); } } if( !bulk ) { tree.fireEvent('check', n, state); } }, toggleCheck : function(state) { this.check(!this.checkbox.checked, true); } }); /** * @class Ext.tree.CheckNodeMultiSelectionModel * @extends Ext.tree.MultiSelectionModel * Multi selection for a TreePanel containing Ext.tree.CheckboxNodeUI. * Adds enhanced selection routines for selecting multiple items * and key processing to check/clear checkboxes. */ Ext.tree.CheckNodeMultiSelectionModel = function(){ Ext.tree.CheckNodeMultiSelectionModel.superclass.constructor.call(this); }; Ext.extend(Ext.tree.CheckNodeMultiSelectionModel, Ext.tree.MultiSelectionModel, { init : function(tree){ this.tree = tree; tree.el.on("keydown", this.onKeyDown, this); tree.on("click", this.onNodeClick, this); }, /** * Handle a node click * If ctrl key is down and node is selected will unselect the node. * If the shift key is down it will create a contiguous selection * (see {@link Ext.tree.CheckNodeMultiSelectionModel#extendSelection} for the limitations) */ onNodeClick : function(node, e){ if( e.shiftKey && this.extendSelection(node) ) { return true; } if( e.ctrlKey && this.isSelected(node) ) { this.unselect(node); } else { this.select(node, e, e.ctrlKey); } }, /** * Selects all nodes between the previously selected node and the one that the user has just selected. * Will not span multiple depths, so only children of the same parent will be selected. */ extendSelection : function(node) { var last = this.lastSelNode; if( node == last || !last ) { return false; /* same selection, process normally normally */ } if( node.parentNode == last.parentNode ) { var cs = node.parentNode.childNodes; var i = 0, attr='id', selecting=false, lastSelect=false; this.clearSelections(true); for( i = 0; i < cs.length; i++ ) { // We have to traverse the entire tree b/c don't know of a way to find // a numerical representation of a nodes position in a tree. if( cs[i].attributes[attr] == last.attributes[attr] || cs[i].attributes[attr] == node.attributes[attr] ) { // lastSelect ensures that we select the final node in the list lastSelect = selecting; selecting = !selecting; } if( selecting || lastSelect ) { this.select(cs[i], null, true); // if we're selecting the last node break to avoid traversing the entire tree if( lastSelect ) { break; } } } return true; } else { return false; } }, /** * Traps the press of the SPACE bar and sets the check state of selected nodes to the opposite state of * the selected or last selected node. Assume you have the following five Ext.tree.CheckboxNodeUIs: * [X] One, [X] Two, [X] Three, [ ] Four, [ ] Five * If you select them in this order: One, Two, Three, Four, Five and press the space bar they all * will be <b>checked</b> (the opposite of the checkbox state of Five). * If you select them in this order: Five, Four, Three, Two, One and press the space bar they all * will be <b>unchecked</b> which is the opposite of the checkbox state of One. */ onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown.createInterceptor(function(e) { var s = this.selNode || this.lastSelNode; // undesirable, but required var sm = this; if(!s) { return; } var k = e.getKey(); switch(k) { case e.SPACE: e.stopEvent(); var sel = this.getSelectedNodes(); var state = !s.getUI().checked(); if( sel.length == 1 ) { s.getUI().check(state, !s.isLeaf()); } else { for( var i = 0; i < sel.length; i++ ) { sel[i].getUI().check(state, !sel[i].isLeaf() ); } } break; } return true; }) });
JavaScript
/* Extending/depending on: ~ = modified function (when updating from SVN be sure to check these for changes, especially to Ext.tree.TreeNodeUI.render() ) + = added function TreeSelectionModel.js Ext.tree.CheckNodeMultiSelectionModel : ~init(), ~onNodeClick(), +extendSelection(), ~onKeyDown() TreeNodeUI.js Ext.tree.CheckboxNodeUI : ~render(), +checked(), +check(), +toggleCheck() TreePanel.js Ext.tree.TreePanel : +getChecked() TreeLoader.js Ext.tree.TreeLoader : ~createNode() */ /** * 原始功能只能实现选中或不选两种状态 * 但我们现在需要非叶子节点可以实现三种状态,既: * 节点的子节点都被选中时,显示都被选中的图标 * 节点的子节点都没选中时,显示都没选中的图标 * 节点的子节点部分选中时,显示部分选中的图标 * * 显示都被选中,和部分选中时,当前节点的状态是被选中 * 显示都没选中时,当前节点的状态是没选中 * * 显示都被选中时,单击当前节点,触发的事件是,当前节点变成未选中状态,所有子节点变成未选中状态 * 显示都没选中时,单击当前节点,触发的事件是,当前节点变成都选中状态,所有子节点变成选中状态 * 显示部分选中时,单击当前节点,触发的事件是,当前节点变成都选中状态,所有子节点变成选中状态 * * 子节点变成未选中状态时,对应父节点判断所有子节点是否未选中,如果都未选中,变成未选中状态,否则变成部分选中状态 * 子节点变成选中状态时,对应父节点判断所有子节点是否都选中,如果都选中,变成都选中状态,否则变成部分选中状态 * * @return {Array} 选中节点的id数组 */ Ext.tree.TreePanel.prototype.getChecked = function(node){ var checked = [], i; if( typeof node == 'undefined' ) { node = this.rootVisible ? this.getRootNode() : this.getRootNode().firstChild; } if( node.attributes.checked ) { checked.push(node.id); if( !node.isLeaf() ) { for( i = 0; i < node.childNodes.length; i++ ) { checked = checked.concat( this.getChecked(node.childNodes[i]) ); } } } return checked; }; /** * @class Ext.tree.CustomUITreeLoader * @extends Ext.tree.TreeLoader * 重写createNode(),强制uiProvider是任意的TreeNodeUI来保存广度 */ Ext.tree.CustomUITreeLoader = function() { Ext.tree.CustomUITreeLoader.superclass.constructor.apply(this, arguments); }; Ext.extend(Ext.tree.CustomUITreeLoader, Ext.tree.TreeLoader, { createNode : function(attr){ Ext.apply(attr, this.baseAttr || {}); if(this.applyLoader !== false){ attr.loader = this; } // 如果uiProvider是字符串,那么要么从uiProviders数组里取一个对应的,要么解析字符串获得uiProvider if(typeof attr.uiProvider == 'string'){ attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider); } // 返回的时候,如果是叶子,就返回普通TreeNode,如果不是叶子,就返回异步读取树 return(attr.leaf ? new Ext.tree.TreeNode(attr) : new Ext.tree.AsyncTreeNode(attr)); } }); /** * @class Ext.tree.CheckboxNodeUI * @extends Ext.tree.TreeNodeUI * 给所有节点添加checkbox */ Ext.tree.CheckboxNodeUI = function() { Ext.tree.CheckboxNodeUI.superclass.constructor.apply(this, arguments); }; Ext.extend(Ext.tree.CheckboxNodeUI, Ext.tree.TreeNodeUI, { /** * 重写render() */ render : function(bulkRender) { var n = this.node; /* 在未来的svn里,这个变成了n.ownerTree.innerCt.dom */ var targetNode = n.parentNode ? n.parentNode.ui.getContainer() : n.ownerTree.container.dom; if (!this.rendered) { this.rendered = true; var a = n.attributes; // 为缩进添加缓存,在显示非常大的树的时候有帮助 this.indentMarkup = ""; if (n.parentNode) { // 根据父节点,计算子节点缩进 this.indentMarkup = n.parentNode.ui.getChildIndent(); } // modification,添加checkbox var buf = ['<li class="x-tree-node"><div class="x-tree-node-el ', n.attributes.cls,'">', '<span class="x-tree-node-indent">',this.indentMarkup,"</span>", '<img src="', this.emptyIcon, '" class="x-tree-ec-icon">', '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on">', /* '<input class="l-tcb" type="checkbox" ', (a.checked ? "checked>" : '>'), */ '<img src="',this.emptyIcon,'" class="',this.isAllChildrenChecked(),'">', '<a hidefocus="on" href="',a.href ? a.href : "#",'" ', a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '>', '<span unselectable="on">',n.text,"</span></a></div>", '<ul class="x-tree-node-ct" style="display:none;"></ul>', "</li>"]; if (bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()) { this.wrap = Ext.DomHelper.insertHtml("beforeBegin", n.nextSibling.ui.getEl(), buf.join("")); } else { this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join("")); } this.elNode = this.wrap.childNodes[0]; this.ctNode = this.wrap.childNodes[1]; var cs = this.elNode.childNodes; this.indentNode = cs[0]; this.ecNode = cs[1]; this.iconNode = cs[2]; this.checkbox = cs[3]; // modification,添加checkbox this.checkboxImg = cs[3]; // 修改,添加仿造checkbox的图片 this.anchor = cs[4]; this.textNode = cs[4].firstChild; if (a.qtip) { if (this.textNode.setAttributeNS) { this.textNode.setAttributeNS("ext", "qtip", a.qtip); if (a.qtipTitle) { this.textNode.setAttributeNS("ext", "qtitle", a.qtipTitle); } } else { this.textNode.setAttribute("ext:qtip", a.qtip); if (a.qtipTitle) { this.textNode.setAttribute("ext:qtitle", a.qtipTitle); } } } else if(a.qtipCfg) { a.qtipCfg.target = Ext.id(this.textNode); Ext.QuickTips.register(a.qtipCfg); } this.initEvents(); // modification: 添加handlers,避免修改Ext.tree.TreeNodeUI Ext.fly(this.checkbox).on('click', this.check.createDelegate(this, [null])); n.on('dblclick', function(e) { if (this.isLeaf()) { this.getUI().toggleCheck(); } }); if (!this.node.expanded) { this.updateExpandIcon(); } } else { if (bulkRender === true) { targetNode.appendChild(this.wrap); } } } // 这个节点是否被选中了 , checked : function() { // return this.checkbox.checked; return this.checkboxImg.className != "x-tree-node-checkbox-none"; }, // flag可能是:(NULL)以当前节点状态为准判断,ALL -> NONE -> SOME -> ALL // 否则按照设置的flag为准:SOME,ALL,NONE check : function(forParent, forChildren) { var flag = null; if (this.node.isLeaf) { flag = (this.checkboxImg.className == "x-tree-node-checkbox-all") ? "x-tree-node-checkbox-none" : "x-tree-node-checkbox-all"; } else { if (this.checkboxImg.className == "x-tree-node-checkbox-all") { // 全部反选 flag = "x-tree-node-checkbox-none"; } else if (this.checkboxImg.className == "x-tree-node-checkbox-none") { // 全部选中 flag = "x-tree-node-checkbox-some"; } else { // 全部选中 flag = "x-tree-node-checkbox-all"; } } if (typeof forParent == "undefined" || forParent == null) { forParent = typeof this.node.parentNode != "undefined" && this.node.parentNode != null; } if (typeof forChildren == "undefined" || forChildren == null) { forChildren = !this.node.ifLeaf; } console.error(this); console.error(flag + "," + forParent + "," + forChildren); var n = this.node; var tree = n.getOwnerTree(); var parentNode = n.parentNode; // 如果下级节点都尚未渲染过,就展开当前节点,并渲染下面的所有节点 if (!n.isLeaf && !n.expanded && !n.childrenRendered) { n.expand(false, false, this.check.createDelegate(this, [forParent, forChildren])); return; } // 如果包含子节点 if (forChildren && !n.isLeaf) { var cs = n.childNodes; for(var i = 0; i < cs.length; i++) { cs[i].getUI().checkChild(flag == "x-tree-node-checkbox-all"); } } this.checkboxImg.className = "x-tree-node-checkbox-" + this.isAllChildrenChecked(); if (this.checkboxImg.className == "x-tree-node-checkbox-none") { this.node.attributes.checked = false; } else { this.node.attributes.checked = true; } if (parentNode.getUI().checkParent) { parentNode.getUI().checkParent(); } } , checkParent : function() { this.checkboxImg.className = "x-tree-node-checkbox-" + this.isAllChildrenChecked(); if (this.checkboxImg.className == "x-tree-node-checkbox-none") { this.node.attributes.checked = false; } else { this.node.attributes.checked = true; } if (this.node.parentNode.getUI().checkParent) { this.node.parentNode.getUI().checkParent(); } } , checkChild : function(flag) { this.node.attributes.checked = flag; if (!node.isLeaf) { node.getUI().checkChild(flag); } } , onDblClick : function(e){ e.preventDefault(); if(this.disabled){ return; } if(this.checkbox){ this.toggleCheck(); } //if(!this.animating && this.node.hasChildNodes()){ // this.node.toggle(); //} this.fireEvent("dblclick", this.node, e); } , toggleCheck : function(state) { this.check(); } // 是否为叶子节点 , isLeaf : function() { return this.node.attributes.leaf; } // 获得子节点 , getChildren : function() { return this.node.attributes.children; } // 是否为选中状态 , isChecked : function() { return this.node.attributes.checked; } // 获得className , getClassName : function() { return this.checkboxImg.className; } // 初始化时,决定显示的图片 , isAllChildrenChecked : function() { if (!this.isLeaf()) { var n = 0; var children = this.getChildren(); for (var i = 0; i < children.length; i++) { if (children[i].checked) { n++; } } if (this.isChecked()) { return (n == children.length) ? "x-tree-node-checkbox-all" : "x-tree-node-checkbox-some"; } else { return "x-tree-node-checkbox-none"; } } else { return this.isChecked() ? "x-tree-node-checkbox-all" : "x-tree-node-checkbox-none"; } } // 计算点击后,应该显示的图片 , getNextStatus : function() { if (this.isLeaf()) { return this.getClassName() == "x-tree-node-checkbox-all" ? "x-tree-node-checkbox-none" : "x-tree-node-checkbox-all"; } else { if (this.getClassName() == "x-tree-node-checkbox-all") { return "x-tree-node-checkbox-none"; } else if (this.getClassName() == "x-tree-node-checkbox-none") { return "x-tree-node-checkbox-some"; } else { return "x-tree-node-checkbox-all"; } } } // 改变父节点的className , changeParentStatus : function() { var n = 0; var children = this.getChildren(); for (var i = 0; i < children.length; i++) { if (children[i].checked) { n++; } } if (n == children.length) { return "x-tree-node-checkbox-all"; } else if (n == 0) { return "x-tree-node-checkbox-none"; } else { return "x-tree-node-checkbox-some"; } } // 处理点击节点事件 , check : function() { this.checkboxImg.className = this.getNextStatus(); this.node.attributes.checked = "x-tree-node-checkbox-none" != this.getClassName(); if (this.node.parentNode.getUI().checkParent) { this.node.parentNode.getUI().checkParent(); } if (!this.isLeaf()) { this.node.expand(false, false); var children = this.node.childNodes; for (var i = 0; i < children.length; i++) { children[i].getUI().checkChild("x-tree-node-checkbox-all" == this.getClassName()); } } } // 点击节点后,事件传播到父节点 , checkParent : function() { this.checkboxImg.className = this.changeParentStatus(); this.node.attributes.checked = "x-tree-node-checkbox-none" != this.getClassName(); if (this.node.parentNode.getUI().checkParent) { this.node.parentNode.getUI().checkParent(); } } // 点击节点后,事件传播到子节点 , checkChild : function(isCheck) { if (this.isLeaf()) { this.checkboxImg.className = isCheck ? "x-tree-node-checkbox-all" : "x-tree-node-checkbox-none"; this.node.attributes.checked = "x-tree-node-checkbox-none" != this.checkboxImg.className; } else { if (isCheck) { // 只当下面节点没选中的时候,才强制改变成some // 否则保持some或all状态 if (this.checkboxImg.className == "x-tree-node-checkbox-none") { this.checkboxImg.className = "x-tree-node-checkbox-some"; } this.node.attributes.checked = true; } else { this.checkboxImg.className = "x-tree-node-checkbox-none"; this.node.attributes.checked = false; this.node.expand(false, false); var children = this.node.childNodes; for (var i = 0; i < children.length; i++) { children[i].getUI().checkChild("x-tree-node-checkbox-all" == this.getClassName()); } } } } }); /** * @class Ext.tree.CheckNodeMultiSelectionModel * @extends Ext.tree.MultiSelectionModel * Multi selection for a TreePanel containing Ext.tree.CheckboxNodeUI. * Adds enhanced selection routines for selecting multiple items * and key processing to check/clear checkboxes. */ Ext.tree.CheckNodeMultiSelectionModel = function(){ Ext.tree.CheckNodeMultiSelectionModel.superclass.constructor.call(this); }; Ext.extend(Ext.tree.CheckNodeMultiSelectionModel, Ext.tree.MultiSelectionModel, { init : function(tree){ this.tree = tree; tree.el.on("keydown", this.onKeyDown, this); tree.on("click", this.onNodeClick, this); }, /** * Handle a node click * If ctrl key is down and node is selected will unselect the node. * If the shift key is down it will create a contiguous selection * (see {@link Ext.tree.CheckNodeMultiSelectionModel#extendSelection} for the limitations) */ onNodeClick : function(node, e){ if( e.shiftKey && this.extendSelection(node) ) { return true; } if( e.ctrlKey && this.isSelected(node) ) { this.unselect(node); } else { this.select(node, e, e.ctrlKey); } }, /** * Selects all nodes between the previously selected node and the one that the user has just selected. * Will not span multiple depths, so only children of the same parent will be selected. */ extendSelection : function(node) { var last = this.lastSelNode; if( node == last || !last ) { return false; /* same selection, process normally normally */ } if( node.parentNode == last.parentNode ) { var cs = node.parentNode.childNodes; var i = 0, attr='id', selecting=false, lastSelect=false; this.clearSelections(true); for( i = 0; i < cs.length; i++ ) { // We have to traverse the entire tree b/c don't know of a way to find // a numerical representation of a nodes position in a tree. if( cs[i].attributes[attr] == last.attributes[attr] || cs[i].attributes[attr] == node.attributes[attr] ) { // lastSelect ensures that we select the final node in the list lastSelect = selecting; selecting = !selecting; } if( selecting || lastSelect ) { this.select(cs[i], null, true); // if we're selecting the last node break to avoid traversing the entire tree if( lastSelect ) { break; } } } return true; } else { return false; } } });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-09-13 * http://code.google.com/p/anewssystem/ */ Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // 布局管理器 var layout = new Ext.BorderLayout(document.body, { center: { autoScroll : true, titlebar : false, tabPosition : 'top', closeOnTab : true, alwaysShowTabs : true, resizeTabs : true, fillToFrame : true } }); // 设置布局 layout.beginUpdate(); layout.add('center', new Ext.ContentPanel('tab1', { title : '分类管理', toolbar : null, closable : false, fitToFrame : true })); layout.add('center', new Ext.ContentPanel('tab2', { title: "帮助", toolbar: null, closable: false, fitToFrame: true })); layout.restoreState(); layout.endUpdate(); layout.getRegion("center").showPanel("tab1"); // 默认需要id, name, theSort, parent, children // 其他随意定制 var metaData = [ {id : 'id', qtip : "ID", vType : "integer", allowBlank : true, defValue : -1}, {id : 'name', qtip : "分类名称", vType : "chn", allowBlank : false}, {id : 'descn', qtip : "描述", vType : "chn", allowBlank : true} ]; // 创建树形 var lightTree = new Ext.lingo.JsonTree("lighttree", { metaData : metaData, dlgWidth : 500, dlgHeight : 300, dialogContent : "content" }); // 渲染树形 lightTree.render(); });
JavaScript
/** * Copyright(c) 2006-2007, FeyaSoft Inc. * * This JS is mainly used to handle action in the list * and create, edit, delete. * There includes Search function, paging function etc * Create/update is using pop-up dialog * Delete can select multiple line */ Ext.onReady(function(){ var myPageSize = 10; // shorthand alias var fm = Ext.form, Ed = Ext.grid.GridEditor; //we enable the QuickTips for the later Pagebar Ext.QuickTips.init(); function formatBoolean(value){ return value ? 'Yes' : 'No'; } function formatDate(value){ return value ? value.dateFormat('m d, Y') : ''; } /************************************************************ * Display the result in page * the column model has information about grid columns * dataIndex maps the column to the specific data field in * the data store (created below) ************************************************************/ var cm = new Ext.grid.ColumnModel([{ id: 'id', header: "序号", dataIndex: 'id', width: 150 }, { header: "关键字", dataIndex: 'name', width: 90 } ]); // by default columns are sortable cm.defaultSortable = false; // this could be inline, but we want to define the NewAccount record // type so we can add records dynamically var Tag = Ext.data.Record.create([ {name: 'id', type: 'int'}, {name: 'name', type: 'string'} ]); /************************************************************ * connect to backend - grid - core part * create the Data Store * connect with backend and list the result in page * through JSON format ************************************************************/ var ds = new Ext.data.Store({ proxy: new Ext.data.DWRProxy(NewsTagHelper.getItems, true), reader: new Ext.data.ListRangeReader({ totalProperty: 'totalCount', id: 'id' }, Tag), remoteSort: true }); ds.setDefaultSort('id', 'ASC'); // create the editor grid var grid = new Ext.ux.CheckRowSelectionGrid('editor-grid', { ds: ds, cm: cm, //selModel: new Ext.grid.CellSelectionModel(), //selModel: new Ext.grid.RowSelectionModel({singleSelect:false}), enableColLock:false }); var layout = Ext.BorderLayout.create({ center: { margins:{left:2,top:3,right:2,bottom:3}, panels: [new Ext.GridPanel(grid)] } }, 'grid-panel'); // render it grid.render(); /************************************************************ * create header panel * add filter field - search function ************************************************************/ var gridHead = grid.getView().getHeaderPanel(true); var tb = new Ext.Toolbar(gridHead); filterButton = new Ext.Toolbar.MenuButton({ icon: 'public/image/list-items.gif', cls: 'x-btn-text-icon', text: 'Choose Filter', tooltip: 'Select one of filter', menu: {items: [ new Ext.menu.CheckItem({ text: 'name', value: 'name', checked: true, group: 'filter', checkHandler: onItemCheck }) ]}, minWidth: 105 }); tb.add(filterButton); // Create the filter field var filter = Ext.get(tb.addDom({ // add a DomHelper config to the toolbar and return a reference to it tag: 'input', type: 'text', size: '30', value: '', style: 'background: #F0F0F9;' }).el); // press enter keyboard filter.on('keypress', function(e) { // setup an onkeypress event handler if(e.getKey() == e.ENTER && this.getValue().length > 0) {// listen for the ENTER key ds.load({params:{start:0, limit:myPageSize}}); } }); filter.on('keyup', function(e) { // setup an onkeyup event handler if(e.getKey() == e.BACKSPACE && this.getValue().length === 0) {// listen for the BACKSPACE key and the field being empty ds.load({params:{start:0, limit:myPageSize}}); } }); // Update search button text with selected item function onItemCheck(item, checked) { if(checked) { filterButton.setText(item.text + ':'); } } /************************************************************ * create footer panel * actions and paging ************************************************************/ var gridFoot = grid.getView().getFooterPanel(true); // add a paging toolbar to the grid's footer var paging = new Ext.PagingToolbar(gridFoot, ds, { pageSize: myPageSize, displayInfo: true, displayMsg: 'total {2} results found. Current shows {0} - {1}', emptyMsg: "not result to display" }); // add the detailed add button paging.add('-', { pressed: true, enableToggle:true, text: 'Add', cls: '', toggleHandler: doAdd }); // add the detailed delete button paging.add('-', { pressed: true, enableToggle:true, text: 'Delete', cls: '', toggleHandler: doDel }); // --- end -- create foot panel /************************************************************ * load parameter to backend * have beforelaod function ************************************************************/ ds.on('beforeload', function() { ds.baseParams = { // modify the baseParams setting for this request filterValue: filter.getValue(),// retrieve the value of the filter input and assign it to a property named filter filterTxt: filterButton.getText() }; }); // trigger the data store load ds.load({params:{start:0, limit:myPageSize}}); /************************************************************ * Action - delete * start to handle delete function * need confirm to delete ************************************************************/ function doDel(){ var m = grid.getSelections(); if(m.length > 0) { Ext.MessageBox.confirm('Message', 'Do you really want to delete them?' , doDel2); } else { Ext.MessageBox.alert('Error', 'Please select at least one item to delete'); } } function doDel2(btn) { if(btn == 'yes') { var m = grid.getSelections(); var data = new Array(); for (var i = 0, len = m.length; i < len; i++) { data.push(m[i].get("id")); ds.remove(m[i]); } NewsTagHelper.removeAll(data); } } /************************************************************ * Add an "clickoutside" event to a Grid. * @param grid {Ext.grid.Grid} The grid to add a clickoutside event to. * The handler is passed the Event and the Grid. ************************************************************/ function addClickOutsideEvent(grid) { if (!grid.events.clickoutside) { grid.addEvents({"clickoutside": true}); } if (!Ext.grid.Grid.prototype.handleClickOutside) { Ext.grid.Grid.override({ handleClickOutside: function(e) { var p = Ext.get(e.getTarget()).findParent(".x-grid-container"); if (p != this.container.dom) { this.fireEvent("clickoutside", e, grid); } } }); } Ext.get(document.body).on("click", grid.handleClickOutside, grid); } /************************************************************ * Create a new dialog - reuse by create and edit part ************************************************************/ function createNewDialog(dialogName) { var thisDialog = new Ext.LayoutDialog(dialogName, { modal:true, autoTabs:true, proxyDrag:true, resizable:false, width: 480, height: 302, shadow:true, center: { autoScroll: true, tabPosition: 'top', closeOnTab: true, alwaysShowTabs: false } }); thisDialog.addKeyListener(27, thisDialog.hide, thisDialog); thisDialog.addButton('Cancel', function() {thisDialog.hide();}); return thisDialog; }; /************************************************************ * Action - update * handle double click * user select one of the item and want to update it ************************************************************/ grid.on('rowdblclick', function(grid, rowIndex, e) { var selectedId = ds.data.items[rowIndex].id; // get information from DB and set form now... var account_data = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'loadData.htm?id=' + selectedId}), reader: new Ext.data.JsonReader({},['id','name']), remoteSort: false }); account_data.on('load', function() { console.info(account_data); // set value now var updateId = account_data.getAt(0).data['id']; name_show.setValue(account_data.getAt(0).data['name']); console.info(account_data.getAt(0).data['name']); var updateInstanceDlg; if (!updateInstanceDlg) { updateInstanceDlg = createNewDialog("a-updateInstance-dlg"); updateInstanceDlg.addButton('Save', function() { // submit now... all the form information are submit to the server // handle response after that... if (form_instance_update.isValid()) { form_instance_update.submit({ params:{id : updateId}, waitMsg:'更新数据...', reset: false, failure: function(form_instance_update, action) { Ext.MessageBox.alert('Error Message', action.result.errorInfo); }, success: function(form_instance_update, action) { Ext.MessageBox.alert('Confirm', action.result.info); updateInstanceDlg.hide(); ds.load({params:{start:0, limit:myPageSize}}); } }); }else{ Ext.MessageBox.alert('Errors', 'Please fix the errors noted.'); } }); var layout = updateInstanceDlg.getLayout(); layout.beginUpdate(); layout.add('center', new Ext.ContentPanel('a-updateInstance-inner', {title: 'Update Account'})); layout.endUpdate(); updateInstanceDlg.show(); } }); account_data.load(); }); /************************************************************ * Action - add * start to handle add function * new page appear and allow to submit ************************************************************/ /************************************************************ * To create add new account dialog now.... ************************************************************/ function doAdd() { var aAddInstanceDlg; if (!aAddInstanceDlg) { aAddInstanceDlg = createNewDialog("a-addInstance-dlg"); aAddInstanceDlg.addButton('Reset', resetForm, aAddInstanceDlg); aAddInstanceDlg.addButton('Save', function() { // submit now... all the form information are submit to the server // handle response after that... if (form_instance_create.isValid()) { form_instance_create.submit({ waitMsg:'Creating new account now...', reset: false, failure: function(form_instance_create, action) { var info = Ext.MessageBox.alert('Error Message', action.result.errorInfo); }, success: function(form_instance_create, action) { Ext.MessageBox.alert('Confirm', action.result.info); aAddInstanceDlg.hide(); ds.load({params:{start:0, limit:myPageSize}}); } }); }else{ Ext.MessageBox.alert('Errors', 'Please fix the errors noted.'); } }); var layout = aAddInstanceDlg.getLayout(); layout.beginUpdate(); layout.add('center', new Ext.ContentPanel('a-addInstance-inner', {title: 'create account'})); layout.endUpdate(); resetForm(); aAddInstanceDlg.show(); } } /************************************************************ * Form information - pop-up dialog * turn on validation errors beside the field globally ************************************************************/ Ext.form.Field.prototype.msgTarget = 'side'; Ext.form.Field.prototype.height = 20; Ext.form.Field.prototype.fieldClass = 'text-field-default'; Ext.form.Field.prototype.focusClass = 'text-field-focus'; Ext.form.Field.prototype.invalidClass = 'text-field-invalid'; /************************************************************ * Create new form to hold user enter information * This form is used to create new instance ************************************************************/ var name_tf = new Ext.form.TextField({ fieldLabel: '关键字', name: 'name', allowBlank:false }); var form_instance_create = new Ext.form.Form({ labelAlign: 'right', url:'insertRow.htm' }); form_instance_create.column({width: 430, labelWidth:120, style:'margin-left:8px;margin-top:8px'}); form_instance_create.fieldset( {id:'desc', legend:'Please fill the field'}, name_tf ); form_instance_create.applyIfToFields({width:255}); form_instance_create.render('a-addInstance-form'); form_instance_create.end(); resetForm = function() { name_tf.setValue(''); }; /************************************************************ * Create form to hold user enter information * This form is used to update current instance ************************************************************/ var name_show = new Ext.form.TextField({ // labelStyle: 'display: none', fieldLabel: '关键字', name: 'name', readOnly: false, allowBlank:false }); var form_instance_update = new Ext.form.Form({ labelAlign: 'right', url:'updateRow.htm' }); form_instance_update.column({width: 430, labelWidth:120, style:'margin-left:8px;margin-top:8px'}); form_instance_update.fieldset( {id:'', legend:'修改'}, name_show ); form_instance_update.applyIfToFields({width:255}); form_instance_update.render('a-updateInstance-form'); form_instance_update.end(); //右键菜单 function contextmenu(grid, rowIndex,e){ e.preventDefault(); e.stopEvent(); var infoMenu = new Ext.menu.Item({ id:'infoMenu', text: 'infoMenu', handler:function(){ Ext.MessageBox.alert("info",Ext.util.JSON.encode(grid.dataSource.getAt(rowIndex).data)); } }); var menuList = [infoMenu]; grid_menu = new Ext.menu.Menu({ id: 'mainMenu', items: menuList }); var coords = e.getXY(); grid_menu.showAt([coords[0], coords[1]]); } grid.addListener('rowcontextmenu', contextmenu); });
JavaScript
// JavaScript Document Ext.onReady (function() { function formatBoolean(value){ return value ? 'Yes' : 'No'; }; function formatDate(value){ return value ? value.dateFormat('M, d, Y') : ''; }; deleteRow = function(){ alert('确定要删除?'); var sm = grid.getSelectionModel(); var cell = sm.getSelectedCell(); var ds = grid.getDataSource(); var record = ds.getAt(cell[0]); var doSuccess = function() { ds.remove(record); }; NewsTagHelper.removeRow(record.id, doSuccess); } function deleteRowRender(value){ var htmlString = '<input title="delete" value="x" type="button" class="delete" onclick="deleteRow()"/>'; return htmlString; } var cm = new Ext.grid.ColumnModel([{ header: "序号", dataIndex: "id", width: 100 }, { header: "关键字", dataIndex: "name", width: 100, editor: new Ext.grid.GridEditor(new Ext.form.TextField({allowBlank: false})) }, { id: "deleteRow", header: "删除", dataIndex: "deleteRow", renderer: deleteRowRender, width: 50 }]); cm.defaultSortable = true;//排序 var Tag = Ext.data.Record.create([ {name: "id", type: "int"}, {name: "name", type: "string"} ]); var ds = new Ext.data.Store({ proxy: new Ext.data.DWRProxy(NewsTagHelper.getItems, true), reader: new Ext.data.ListRangeReader({ totalProperty: 'totalCount', id: 'id' }, Tag), remoteSort: true }); var grid = new Ext.grid.EditorGrid("grid-example", {ds: ds, cm: cm, enableColLock: false}); var layout = Ext.BorderLayout.create({ center: {margins:{left:30,top:30,right:100,bottom:100}, panels: [new Ext.GridPanel(grid)]} }, document.body); // make the grid resizable, do before render for better performance var rz = new Ext.Resizable('grid-example', { wrap:true, minHeight:100, pinned:true, handles:'s' }); rz.on('resize', grid.autoSize, grid); grid.render(); var gridHead = grid.getView().getHeaderPanel(true); var tb = new Ext.Toolbar(gridHead, [{ text: '新增关键字', handler : function(){ var tag = new Tag({ id: -1, name: '' }); grid.stopEditing(); ds.insert(0, tag); grid.startEditing(0, 1); } }, { text: '保存', handler: function() { grid.stopEditing(); var data = new Array(); for (var i = 0; i < ds.getCount(); i++) { var record = ds.getAt(i); if (record.data.id == -1 || record.dirty) { data.push(record.data.name); } } var doSuccess = function() { //alert("完成"); ds.load({start:0,limit:10}); }; NewsTagHelper.save(data, doSuccess); } }]); var gridFoot = grid.getView().getFooterPanel(true); // add a paging toolbar to the grid's footer var paging = new Ext.PagingToolbar(gridFoot, ds, { pageSize: 10, displayInfo: true, displayMsg: '显示 {0} - {1} 共 {2}', emptyMsg: "没有数据" }); //查询时需要用到的参数 //ds.on('beforeload', function() { // ds.baseParams = { // param1: 'test111', // param2: true // }; //}); //分页基本参数 ds.load({params:{start:0, limit:10}}); });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-10-02 * http://code.google.com/p/anewssystem/ */ Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); var form = new Ext.form.Form({ fileUpload:true, labelAlign:'right', labelWidth:75, url:'insert.htm', method: 'POST', enctype:"multipart/form-data" }); form.column({width:400, labelWidth:75}); form.fieldset( {legend:'基本信息', hideLabels:false}, new Ext.form.TextField({ id:'name', name:'name', allowBlank:false, fieldLabel:'新闻标题' }) /* , new Ext.form.TextField({ id:'subtitle', name:'subtitle', fieldLabel:'副标题' }) */ , new Ext.lingo.TreeField({ id:'category', name:'category', fieldLabel:'新闻分类', allowBlank:false, treeConfig:{ title:'新闻分类', rootId:0, dataTag:'../newscategory/getChildren.htm', height:200, treeHeight:150 } }) , new Ext.form.TextField({ id:'source', name:'source', fieldLabel:'来源', allowBlank:false, value:'原创' }) , new Ext.form.TextField({ id:'editor', name:'editor', fieldLabel:'编辑', allowBlank:false, value:'管理员' }) , new Ext.form.DateField({ id:'updateDate', name:'updateDate', format:'Y-m-d', fieldLabel:'发布日期', allowBlank:false, readOnly:true, value:new Date() }) , new Ext.form.TextField({ id:'tags', name:'tags', fieldLabel:'关键字' }) ); form.end(); form.column( {width:250, style:'margin-left:10px', clear:true} ); form.fieldset( {id:'photo', legend:'图片', hideLabels:true} , new Ext.form.TextField({ id:'image', name:'image', inputType:'file', width:100, fieldLabel:'图片' }) ); form.fieldset( {legend:'内容分页', hideLabels:false}, new Ext.form.ComboBox({ id:'pageValue', fieldLabel:'分页方式', hiddenName:'pageType', store: new Ext.data.SimpleStore({ fields:['value', 'text'], data:[ ['0','不分页'], ['1','自动分页'], ['2','手工分页'] ] }), value:0, displayField:'text', valueField:'value', typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, editable:false, width:100 }) , new Ext.form.TextField({ id:'pageSize', name:'pageSize', width:100, fieldLabel:'分页字数', value:1000 }) ); form.end(); form.column( //{width:650, style:'margin-left:0px', clear:true, labelAlign: 'top'} {width:650, style:'margin-left:0px'} ); form.fieldset( {legend:'简介', hideLabels:true}, new Ext.form.TextArea({ id:'summary', name:'summary', width:'100%' }) ); form.fieldset( {legend:'内容', hideLabels:true}, new Ext.form.HtmlEditor({ id:'content', name:'content', width:'100%', height:'40%' }) ); form.end(); form.applyIfToFields({ width:230 }); form.addButton('提交'); form.addButton('保存到草稿箱'); form.addButton('重置'); form.buttons[0].addListener("click", function() { if (form.isValid()) { form.submit({ success:function(){ form.reset(); Ext.MessageBox.alert("提示", "修改成功"); } }); } }); form.buttons[1].addListener("click", function() { if (form.isValid()) { form.submit({ params:{status:3}, success:function(){ Ext.MessageBox.alert("提示", "修改成功"); } }); } }); form.buttons[2].addListener("click", function() { form.reset(); }); form.render('news-form'); // 添加图片 var photo = Ext.get('photo'); var c = photo.createChild({ tag:'center', cn:[{ tag:'img', id:'imagePreview', src: '../images/no.jpg', style:'margin-bottom:5px;width:80px;height:80px;' },{ tag:'div', id:'tip', style:'text-align:left;color:red;display:none;', html:'Firefox需要修改默认安全策略,才能预览本地图片:<br>1.在Firefox的地址栏中输入“about:config”<br>2.继续输入“security.checkloaduri”<br>3.双击下面列出来的一行文字,把它的值由true改为false' }] }); var button = new Ext.Button(c, { text:'修改图片' }); // 让input=file消失,然后漂浮到修改图片的按钮上面 var imageField = Ext.get("image"); if (document.all) { // ie imageField.setStyle({ border:'medium none', position:'absolute', fontSize:'18px', left:'50px', top:'90px', opacity:'0.0' }); } else { // firefox imageField.setStyle({ border:'medium none', position:'absolute', fontSize:'18px', left:'-125px', top:'85px', opacity:'0.0' }); } imageField.on('change', function(e) { var imagePath = e.target.value; var imageUrl = "file:///" + imagePath.replace(/\\/g, "/"); if (document.all) { document.getElementById('imagePreview').src = imageUrl; } else { // document.getElementById("tip").style.display = 'block'; document.getElementById('imagePreview').src = imageUrl; } }); });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-10-02 * http://code.google.com/p/anewssystem/ */ Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); layout = new Ext.BorderLayout(document.body, { north: { autoScroll : true, titlebar : true, tabPosition : 'top', closeOnTab : false, alwaysShowTabs : true, resizeTabs : true, fillToFrame : true }, south: { split:true, initialSize: 22, titlebar: true, collapsible: true, collapsed:true, autoScroll:true, useShim:true, animate: false }, center: { titlebar: false, autoScroll:false, tabPosition: 'top', closeOnTab: true, alwaysShowTabs: false, resizeTabs: true } }); layout.beginUpdate(); layout.add('north', new Ext.ContentPanel('tab1', { title : '已发布', toolbar : null, closable : false, fitToFrame : true })); layout.add('north', new Ext.ContentPanel('tab2', { title : '待审批', toolbar : null, closable : false, fitToFrame : true })); layout.add('north', new Ext.ContentPanel('tab3', { title : '被驳回', toolbar : null, closable : false, fitToFrame : true })); layout.add('north', new Ext.ContentPanel('tab4', { title : '草稿箱', toolbar : null, closable : false, fitToFrame : true })); layout.add('north', new Ext.ContentPanel('tab5', { title : '垃圾箱', toolbar : null, closable : false, fitToFrame : true })); layout.add('center', new Ext.ContentPanel('gridPanel', { toolbar : null, closable : false, fitToFrame : true })); layout.add('south', new Ext.ContentPanel('editGrid', { resizeEl:'editGridContent' })); layout.restoreState(); layout.endUpdate(); var tabs = layout.getRegion('north').getTabs(); layout.getRegion("north").showPanel("tab1"); layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(0).getText() + ")</b>"; var currentStatus = 0; // JsonGrid var metaData = [ {id:'id', qtip:"ID", vType:"integer", allowBlank:true, defValue:-1}, {id:'category', qtip:"分类", vType:"treeField", allowBlank:false, mapping:"newsCategory.name", url:"../newscategory/getChildren.htm"}, {id:'name', qtip:"标题", vType:"chn", allowBlank:true}, {id:'subtitle', qtip:'副标题', vType:'chn', allowBlank:true}, {id:'link', qtip:'跳转链接', vType:'url', allowBlank:true}, {id:'editor', qtip:'编辑', vType:'chn', allowBlank:true}, {id:'updateDate', qtip:'发布日期', vType:'date'}, {id:'source', qtip:'来源', vType:'chn', allowBlank:true, showInGrid:false}, {id:'summary', qtip:'简介', vType:'textArea', allowBlank:true, showInGrid:false}, {id:'content', qtip:'内容', vType:'editor', allowBlank:true, showInGrid:false} ]; // 创建表格 var lightGrid = new Ext.lingo.JsonGrid("lightgrid", { metaData : metaData, genHeader : true, dialogWidth : 750, dialogHeight : 400, dialogContent : "news-content" }); lightGrid.applyElements = function() { if (this.columns == null || this.headers == null) { this.headers = new Array(); for (var i = 0; i < this.metaData.length; i++) { this.headers[this.headers.length] = this.metaData[i].id; } this.columns = Ext.lingo.FormUtils.createAll(this.metaData); this.columns.tags = Ext.lingo.FormUtils.createTextField({ id:'tags' ,name:'tags' ,allowBlank:true }); this.columns.page = Ext.lingo.FormUtils.createComboBox({ id:'page' ,name:'page' ,allowBlank:false }); this.columns.pageSize = Ext.lingo.FormUtils.createTextField({ id:'pagesize' ,name:'pagesize' ,allowBlank:false }); this.columns.quick = Ext.lingo.FormUtils.createCheckBox({ id:'quick' ,name:'quick' ,allowBlank:false }); } }.createDelegate(lightGrid); lightGrid.edit = function() { if (!this.dialog) { this.createDialog(); } var selections = this.grid.getSelections(); if (selections.length == 0) { Ext.MessageBox.alert("提示", "请选择希望修改的记录!"); return; } else if (selections.length != 1) { Ext.MessageBox.alert("提示", "只允许选择单行记录进行修改!"); return; } menuData = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({url:this.urlLoadData + "?id=" + selections[0].id}), reader : new Ext.data.JsonReader({},['id','newsCategory','name','subtitle','link','author','updateDate','source','summary','content','newsTags']), remoteSort : false }); menuData.on('load', function() { for (var i = 0; i < this.metaData.length; i++) { var meta = this.metaData[i]; var id = meta.id; var value = menuData.getAt(0).data[id]; if (meta.mapping) { try { value = eval("menuData.getAt(0).data." + meta.mapping); } catch (e) { } } if (meta.vType == "radio") { for (var j = 0; j < meta.values.length; j++) { var theId = meta.values[j].id; var theName = meta.values[j].name; if (value == theId) { this.columns[id + theId].checked = true; this.columns[id + theId].el.dom.checked = true; } else { this.columns[id + theId].checked = false; this.columns[id + theId].el.dom.checked = false; } } } else if (meta.vType == "date") { if (value == null ) { this.columns[id].setValue(new Date()); } else { this.columns[id].setValue(value); } } else { this.columns[id].setValue(value); } } // 设置关键字 var value = ""; for (var i = 0; i < menuData.getAt(0).data.newsTags.length; i++) { this.columns.tags.setValue(menuData.getAt(0).data.newsTags.join(",")); value += menuData.getAt(0).data.newsTags[i].name + "," } this.columns.tags.setValue(value.substring(0, value.length - 1)); // 设置分类 var newsCategory = menuData.getAt(0).data.newsCategory; this.columns.category.setValue(newsCategory.name); this.columns.category.selectedId = newsCategory.id; this.dialog.show(Ext.get("edit")); }.createDelegate(this)); menuData.reload(); }.createDelegate(lightGrid); // 渲染表格 lightGrid.render(); // 读取数据 lightGrid.dataStore.on('beforeload', function() { lightGrid.dataStore.baseParams = { filterValue : this.filter.getValue(), filterTxt : this.filterTxt, status : currentStatus }; }.createDelegate(lightGrid)); lightGrid.dataStore.reload(); var changeStatus = function(status, operation) { var selections = lightGrid.grid.getSelections(); if (selections.length == 0) { Ext.MessageBox.alert("提示", "请选择希望" + operation + "的记录!"); return; } else { Ext.Msg.confirm("提示", "是否确定" + operation + "?", function(btn, text) { if (btn == 'yes') { var selections = lightGrid.grid.getSelections(); var ids =new Array(); for(var i = 0, len = selections.length; i < len; i++){ selections[i].get("id"); ids[i] = selections[i].get("id"); lightGrid.dataStore.remove(selections[i]); } Ext.Ajax.request({ url : 'changeStatus.htm?ids=' + ids + "&status=" + status, success : function() { Ext.MessageBox.alert(' 提示', operation + '成功!'); lightGrid.dataStore.reload(); }.createDelegate(this), failure : function(){Ext.MessageBox.alert('提示', operation + '失败!');} }); } }); } lightGrid.grid.selModel.Set.clear(); }; var draftButton = new Ext.Toolbar.Button({ icon : "../widgets/lingo/list-items.gif", id : 'draftButton', text : '放入草稿箱', cls : 'add', tooltip : '放入草稿箱', hidden : true, handler : changeStatus.createDelegate(lightGrid,[3, "放入草稿箱"]) }); var rubbishButton = new Ext.Toolbar.Button({ icon : "../widgets/lingo/list-items.gif", id : 'rubbishButton', text : '放入垃圾箱', cls : 'add', tooltip : '放入垃圾箱', hidden : true, handler : changeStatus.createDelegate(lightGrid,[4, "放入垃圾箱"]) }); lightGrid.toolbar.insertButton(3, draftButton); lightGrid.toolbar.insertButton(4, rubbishButton); // Tabs tabs.getTab(0).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(0).getText() + ")</b>"; currentStatus = 0; lightGrid.dataStore.reload(); draftButton.hide(); rubbishButton.hide(); }); tabs.getTab(1).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(1).getText() + ")</b>"; currentStatus = 1; lightGrid.dataStore.reload(); draftButton.show(); rubbishButton.show(); }); tabs.getTab(2).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(2).getText() + ")</b>"; currentStatus = 2; lightGrid.dataStore.reload(); draftButton.show(); rubbishButton.show(); }); tabs.getTab(3).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(3).getText() + ")</b>"; currentStatus = 3; lightGrid.dataStore.reload(); draftButton.hide(); rubbishButton.show(); }); tabs.getTab(4).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(4).getText() + ")</b>"; currentStatus = 4; lightGrid.dataStore.reload(); draftButton.show(); rubbishButton.hide(); }); // ==== // form var form = new Ext.form.Form({ fileUpload:true, labelAlign:'right', labelWidth:75, url:'insert.htm', method: 'POST', enctype:"multipart/form-data" }); form.add( new Ext.form.TextField({ id:'id', name:'id', inputType:'hidden', hidden:true }) ); form.column({width:400, labelWidth:75}); form.fieldset( {legend:'基本信息', hideLabels:false}, new Ext.form.TextField({ id:'name', name:'name', allowBlank:false, fieldLabel:'新闻标题' }) /* , new Ext.form.TextField({ id:'subtitle', name:'subtitle', fieldLabel:'副标题' }) */ , new Ext.lingo.TreeField({ id:'category', name:'category', fieldLabel:'新闻分类', allowBlank:false, treeConfig:{ title:'新闻分类', rootId:0, dataTag:'../newscategory/getChildren.htm', height:200, treeHeight:150 } }) , new Ext.form.TextField({ id:'source', name:'source', fieldLabel:'来源', allowBlank:false, value:'东方之子' }) , new Ext.form.TextField({ id:'editor', name:'editor', fieldLabel:'编辑', allowBlank:false, value:'东方之子' }) , new Ext.form.DateField({ id:'updateDate', name:'updateDate', format:'Y-m-d', fieldLabel:'发布日期', allowBlank:false, readOnly:true, value:new Date() }) , new Ext.form.TextField({ id:'tags', name:'tags', fieldLabel:'关键字' }) ); form.end(); form.column( {width:250, style:'margin-left:10px', clear:true} ); form.fieldset( {id:'photo', legend:'图片', hideLabels:true} , new Ext.form.TextField({ id:'image', name:'image', inputType:'file', width:100, fieldLabel:'图片' }) ); form.fieldset( {legend:'内容分页', hideLabels:false}, new Ext.form.ComboBox({ id:'pageValue', fieldLabel:'分页方式', hiddenName:'pageType', store: new Ext.data.SimpleStore({ fields:['value', 'text'], data:[ ['0','不分页'], ['1','自动分页'], ['2','手工分页'] ] }), value:0, displayField:'text', valueField:'value', typeAhead:true, mode:'local', triggerAction:'all', selectOnFocus:true, editable:false, width:100 }) , new Ext.form.TextField({ id:'pageSize', name:'pageSize', width:100, fieldLabel:'分页字数', value:1000 }) ); form.end(); form.column( //{width:650, style:'margin-left:0px', clear:true, labelAlign: 'top'} {width:650, style:'margin-left:0px'} ); form.fieldset( {legend:'简介', hideLabels:true}, new Ext.form.TextArea({ id:'summary', name:'summary', width:'100%' }) ); form.fieldset( {legend:'内容', hideLabels:true}, new Ext.form.HtmlEditor({ id:'content', name:'content', width:'100%', height:'40%' }) ); form.end(); form.applyIfToFields({ width:230 }); form.addButton('提交'); form.addButton('保存到草稿箱'); form.addButton('重置'); form.buttons[0].addListener("click", function() { if (form.isValid()) { form.submit({ success:function(){ form.reset(); Ext.MessageBox.alert("提示", "修改成功"); } }); } }); form.buttons[1].addListener("click", function() { if (form.isValid()) { form.submit({ params:{status:3}, success:function(){ Ext.MessageBox.alert("提示", "修改成功"); lightGrid.grid.reload(); } }); } }); form.buttons[2].addListener("click", function() { form.reset(); }); form.render('news-form'); // 添加图片 var photo = Ext.get('photo'); var c = photo.createChild({ tag:'center', cn:[{ tag:'img', id:'imagePreview', src: '../images/no.jpg', style:'margin-bottom:5px;width:80px;height:80px;' },{ tag:'div', id:'tip', style:'text-align:left;color:red;display:none;', html:'Firefox需要修改默认安全策略,才能预览本地图片:<br>1.在Firefox的地址栏中输入“about:config”<br>2.继续输入“security.checkloaduri”<br>3.双击下面列出来的一行文字,把它的值由true改为false' }] }); var button = new Ext.Button(c, { text:'修改图片' }); // 让input=file消失,然后漂浮到修改图片的按钮上面 var imageField = Ext.get("image"); if (document.all) { // ie imageField.setStyle({ border:'medium none', position:'absolute', fontSize:'18px', left:'50px', top:'90px', opacity:'0.0' }); } else { // firefox imageField.setStyle({ border:'medium none', position:'absolute', fontSize:'18px', left:'-125px', top:'85px', opacity:'0.0' }); } imageField.on('change', function(e) { var imagePath = e.target.value; var imageUrl = "file:///" + imagePath.replace(/\\/g, "/"); if (document.all) { document.getElementById('imagePreview').src = imageUrl; } else { // document.getElementById("tip").style.display = 'block'; document.getElementById('imagePreview').src = imageUrl; } }); // ==== // 处理添加和修改事件 var grid = lightGrid.grid; // 取消双击修改 grid.events["rowdblclick"].clearListeners(); // 取消右键菜单 grid.events["rowcontextmenu"].clearListeners(); var addNews = function() { form.reset(); document.getElementById('imagePreview').src = '../images/no.jpg'; if (layout.getRegion('south').collapsed) { layout.getRegion('south').expand(); } }; var editNews = function() { var selections = lightGrid.grid.getSelections(); if (selections.length == 0) { Ext.MessageBox.alert("提示", "请选择希望修改的记录!"); return; } else if (selections.length != 1) { Ext.MessageBox.alert("提示", "只允许选择单行记录进行修改!"); return; } var menuData = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({url:lightGrid.urlLoadData + "?id=" + selections[0].id}), reader : new Ext.data.JsonReader({},[ 'id', 'name', 'newsCategory', 'summary', 'content', 'updateDate', 'newsTags', 'editor', 'source', 'image', 'pageType', 'pageSize']), remoteSort : false }); menuData.on('load', function() { var id = menuData.getAt(0).data["id"]; var name = menuData.getAt(0).data["name"]; var newsCategory = menuData.getAt(0).data["newsCategory"]; var summary = menuData.getAt(0).data["summary"]; var content = menuData.getAt(0).data["content"]; var updateDate = menuData.getAt(0).data["updateDate"]; var newsTags = menuData.getAt(0).data["newsTags"]; var editor = menuData.getAt(0).data["editor"]; var source = menuData.getAt(0).data["source"]; var image = menuData.getAt(0).data["image"]; var pageType = menuData.getAt(0).data["pageType"]; var pageSize = menuData.getAt(0).data["pageSize"]; var tags = []; for (var i = 0; i < newsTags.length; i++) { tags.push(newsTags[i].name); } form.setValues([ {id:'id',value:id}, {id:'name',value:name}, {id:'category',value:newsCategory==null ? '' : newsCategory.name}, {id:'summary',value:summary}, {id:'updateDate',value:updateDate}, {id:'tags',value:tags.join(",")}, {id:'content',value:content}, {id:'editor',value:editor}, {id:'source',value:source}, //{id:'image',value:image}, {id:'pageType',value:pageType}, {id:'pageSize',value:pageSize} ]); document.getElementById("category_id").value = newsCategory.id; if (image == null || image == "") { document.getElementById('imagePreview').src = '../images/no.jpg'; } else { document.getElementById('imagePreview').src = "../" + image; } if (layout.getRegion('south').collapsed) { layout.getRegion('south').expand(); } }); menuData.load(); }; lightGrid.toolbar.items.items[0].setHandler(addNews) lightGrid.toolbar.items.items[1].setHandler(editNews) });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-10-14 * http://code.google.com/p/anewssystem/ */ Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // 布局管理器 var layout = new Ext.BorderLayout(document.body, { center: { autoScroll : true, titlebar : false, tabPosition : 'top', closeOnTab : true, alwaysShowTabs : true, resizeTabs : true, fillToFrame : true } }); // 设置布局 layout.beginUpdate(); layout.add('center', new Ext.ContentPanel('tab1', { title : '审批新闻', toolbar : null, closable : false, fitToFrame : true })); layout.add('center', new Ext.ContentPanel('tab2', { title: "帮助", toolbar: null, closable: false, fitToFrame: true })); layout.restoreState(); layout.endUpdate(); layout.getRegion("center").showPanel("tab1"); var renderStatus = function(value) { if (value == 0) { return "已发布"; } else if (value == 1) { return "<span style='color:red'>待审</span>"; } else if (value == 5) { return "<span style='color:green;font-weight:bold;'>推荐</span>"; } else if (value == 6) { return "<span style='color:gray;font-style:italic;'>隐藏</span>"; } }; // 默认需要id, name, theSort, parent, children // 其他随意定制 var metaData = [ {id:'id', qtip:"ID", vType:"integer", allowBlank:true, defValue:-1, w:40}, {id:'category', qtip:"分类", vType:"treeField", allowBlank:false, mapping:"newsCategory.name", url:"../newscategory/getChildren.htm"}, {id:'name', qtip:"标题", vType:"chn", allowBlank:true}, {id:'subtitle', qtip:'副标题', vType:'chn', allowBlank:true}, {id:'link', qtip:'跳转链接', vType:'url', allowBlank:true}, {id:'editor', qtip:'编辑', vType:'chn', allowBlank:true}, {id:'updateDate', qtip:'发布日期', vType:'date'}, {id:'status', qtip:'状态', vType:'integer', allowBlank:true, defValue:0, renderer:renderStatus}, {id:'source', qtip:'来源', vType:'chn', allowBlank:true, showInGrid:false}, {id:'summary', qtip:'简介', vType:'textArea', allowBlank:true, showInGrid:false}, {id:'content', qtip:'内容', vType:'editor', allowBlank:true, showInGrid:false} ]; // 创建表格 var lightGrid = new Ext.lingo.JsonGrid("lightgrid", { metaData : metaData, dialogContent : "content", urlPagedQuery : "pagedQueryManage.htm" }); // 渲染表格 lightGrid.render(); // 取消双击修改 //lightGrid.grid.un("rowdblclick", lightGrid.edit); lightGrid.grid.events["rowdblclick"].clearListeners(); // 取消右键菜单 //lightGrid.grid.un("rowcontextmenu", lightGrid.contextmenu); lightGrid.grid.events["rowcontextmenu"].clearListeners(); var changeStatus = function(status, operation) { var selections = lightGrid.grid.getSelections(); if (selections.length == 0) { Ext.MessageBox.alert("提示", "请选择希望" + operation + "的记录!"); return; } else { Ext.Msg.confirm("提示", "是否确定" + operation + "?", function(btn, text) { if (btn == 'yes') { var selections = lightGrid.grid.getSelections(); var ids =new Array(); for(var i = 0, len = selections.length; i < len; i++){ selections[i].get("id"); ids[i] = selections[i].get("id"); lightGrid.dataStore.remove(selections[i]); } Ext.Ajax.request({ url : 'changeStatus.htm?ids=' + ids + "&status=" + status, success : function() { Ext.MessageBox.alert(' 提示', operation + '成功!'); lightGrid.dataStore.reload(); }.createDelegate(this), failure : function(){Ext.MessageBox.alert('提示', operation + '失败!');} }); } }); } lightGrid.grid.selModel.Set.clear(); }; var hideButton = new Ext.Toolbar.Button({ icon : "../widgets/lingo/list-items.gif", id : 'hideButton', text : '隐藏', cls : 'add', tooltip : '隐藏', handler : changeStatus.createDelegate(lightGrid,[6, "隐藏"]) }); var recommendButton = new Ext.Toolbar.Button({ icon : "../widgets/lingo/list-items.gif", id : 'recommendButton', text : '推荐', cls : 'add', tooltip : '推荐', handler : changeStatus.createDelegate(lightGrid,[5, "推荐"]) }); var permissionButton = new Ext.Toolbar.Button({ icon : "../widgets/lingo/list-items.gif", id : 'permissionButton', text : '审批', cls : 'add', tooltip : '审批', hidden : false, handler : changeStatus.createDelegate(lightGrid,[0, "审批"]) }); var dismissButton = new Ext.Toolbar.Button({ icon : "../widgets/lingo/list-items.gif", id : 'dismissButton', text : '驳回', cls : 'add', tooltip : '驳回', hidden : false, handler : changeStatus.createDelegate(lightGrid,[2, "驳回"]) }); var cancelButton = new Ext.Toolbar.Button({ icon : "../widgets/lingo/list-items.gif", id : 'submitButton', text : '恢复发布状态', cls : 'add', tooltip : '恢复发布状态', hidden : false, handler : changeStatus.createDelegate(lightGrid,[0, "恢复发布状态"]) }); lightGrid.toolbar.insertButton(3, hideButton); lightGrid.toolbar.insertButton(4, recommendButton); lightGrid.toolbar.insertButton(5, permissionButton); lightGrid.toolbar.insertButton(6, dismissButton); lightGrid.toolbar.insertButton(7, cancelButton); Ext.get("add").setStyle("display", "none"); Ext.get("edit").setStyle("display", "none"); Ext.get("del").setStyle("display", "none"); });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-10-02 * http://code.google.com/p/anewssystem/ */ Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // 布局管理器 var layout = new Ext.BorderLayout(document.body, { north: { autoScroll : true, titlebar : true, tabPosition : 'top', closeOnTab : false, alwaysShowTabs : true, resizeTabs : true, fillToFrame : true }, center: { autoScroll : true, titlebar : false, closeOnTab : false, alwaysShowTabs : false, resizeTabs : true, fillToFrame : true } }); // 设置布局 layout.beginUpdate(); layout.add('north', new Ext.ContentPanel('tab1', { title : '已发布', toolbar : null, closable : false, fitToFrame : true })); layout.add('north', new Ext.ContentPanel('tab2', { title : '待审批', toolbar : null, closable : false, fitToFrame : true })); layout.add('north', new Ext.ContentPanel('tab3', { title : '被驳回', toolbar : null, closable : false, fitToFrame : true })); layout.add('north', new Ext.ContentPanel('tab4', { title : '草稿箱', toolbar : null, closable : false, fitToFrame : true })); layout.add('north', new Ext.ContentPanel('tab5', { title : '垃圾箱', toolbar : null, closable : false, fitToFrame : true })); layout.add('center', new Ext.ContentPanel('gridPanel', { toolbar : null, closable : false, fitToFrame : true })); layout.restoreState(); layout.endUpdate(); var tabs = layout.getRegion('north').getTabs(); layout.getRegion("north").showPanel("tab1"); layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(0).getText() + ")</b>"; var currentStatus = 0; // JsonGrid var metaData = [ {id:'id', qtip:"ID", vType:"integer", allowBlank:true, defValue:-1}, {id:'category', qtip:"分类", vType:"treeField", allowBlank:false, mapping:"newsCategory.name", url:"../newscategory/getChildren.htm"}, {id:'name', qtip:"标题", vType:"chn", allowBlank:true}, {id:'subtitle', qtip:'副标题', vType:'chn', allowBlank:true}, {id:'link', qtip:'跳转链接', vType:'url', allowBlank:true}, {id:'editor', qtip:'编辑', vType:'chn', allowBlank:true}, {id:'updateDate', qtip:'发布日期', vType:'date'}, {id:'source', qtip:'来源', vType:'chn', allowBlank:true, showInGrid:false}, {id:'summary', qtip:'简介', vType:'textArea', allowBlank:true, showInGrid:false}, {id:'content', qtip:'内容', vType:'editor', allowBlank:true, showInGrid:false} ]; // 创建表格 var lightGrid = new Ext.lingo.JsonGrid("lightgrid", { metaData : metaData, genHeader : true, dialogWidth : 750, dialogHeight : 400, dialogContent : "news-content" }); lightGrid.applyElements = function() { if (this.columns == null || this.headers == null) { this.headers = new Array(); for (var i = 0; i < this.metaData.length; i++) { this.headers[this.headers.length] = this.metaData[i].id; } this.columns = Ext.lingo.FormUtils.createAll(this.metaData); this.columns.tags = Ext.lingo.FormUtils.createTextField({ id:'tags' ,name:'tags' ,allowBlank:true }); this.columns.page = Ext.lingo.FormUtils.createComboBox({ id:'page' ,name:'page' ,allowBlank:false }); this.columns.pageSize = Ext.lingo.FormUtils.createTextField({ id:'pagesize' ,name:'pagesize' ,allowBlank:false }); this.columns.quick = Ext.lingo.FormUtils.createCheckBox({ id:'quick' ,name:'quick' ,allowBlank:false }); } }.createDelegate(lightGrid); lightGrid.edit = function() { if (!this.dialog) { this.createDialog(); } var selections = this.grid.getSelections(); if (selections.length == 0) { Ext.MessageBox.alert("提示", "请选择希望修改的记录!"); return; } else if (selections.length != 1) { Ext.MessageBox.alert("提示", "只允许选择单行记录进行修改!"); return; } this.menuData = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({url:this.urlLoadData + "?id=" + selections[0].id}), reader : new Ext.data.JsonReader({},['id','newsCategory','name','subtitle','link','author','updateDate','source','summary','content','newsTags']), remoteSort : false }); this.menuData.on('load', function() { for (var i = 0; i < this.metaData.length; i++) { var meta = this.metaData[i]; var id = meta.id; var value = this.menuData.getAt(0).data[id]; if (meta.mapping) { try { value = eval("this.menuData.getAt(0).data." + meta.mapping); } catch (e) { } } if (meta.vType == "radio") { for (var j = 0; j < meta.values.length; j++) { var theId = meta.values[j].id; var theName = meta.values[j].name; if (value == theId) { this.columns[id + theId].checked = true; this.columns[id + theId].el.dom.checked = true; } else { this.columns[id + theId].checked = false; this.columns[id + theId].el.dom.checked = false; } } } else if (meta.vType == "date") { if (value == null ) { this.columns[id].setValue(new Date()); } else { this.columns[id].setValue(value); } } else { this.columns[id].setValue(value); } } // 设置关键字 var value = ""; for (var i = 0; i < this.menuData.getAt(0).data.newsTags.length; i++) { this.columns.tags.setValue(this.menuData.getAt(0).data.newsTags.join(",")); value += this.menuData.getAt(0).data.newsTags[i].name + "," } this.columns.tags.setValue(value.substring(0, value.length - 1)); // 设置分类 var newsCategory = this.menuData.getAt(0).data.newsCategory; this.columns.category.setValue(newsCategory.name); this.columns.category.selectedId = newsCategory.id; this.dialog.show(Ext.get("edit")); }.createDelegate(this)); this.menuData.reload(); }.createDelegate(lightGrid); // 渲染表格 lightGrid.render(); // 读取数据 lightGrid.dataStore.on('beforeload', function() { lightGrid.dataStore.baseParams = { filterValue : this.filter.getValue(), filterTxt : this.filterTxt, status : currentStatus }; }.createDelegate(lightGrid)); lightGrid.dataStore.reload(); var changeStatus = function(status, operation) { var selections = lightGrid.grid.getSelections(); if (selections.length == 0) { Ext.MessageBox.alert("提示", "请选择希望" + operation + "的记录!"); return; } else { Ext.Msg.confirm("提示", "是否确定" + operation + "?", function(btn, text) { if (btn == 'yes') { var selections = lightGrid.grid.getSelections(); var ids =new Array(); for(var i = 0, len = selections.length; i < len; i++){ selections[i].get("id"); ids[i] = selections[i].get("id"); lightGrid.dataStore.remove(selections[i]); } Ext.Ajax.request({ url : 'changeStatus.htm?ids=' + ids + "&status=" + status, success : function() { Ext.MessageBox.alert(' 提示', operation + '成功!'); lightGrid.dataStore.reload(); }.createDelegate(this), failure : function(){Ext.MessageBox.alert('提示', operation + '失败!');} }); } }); } lightGrid.grid.selModel.Set.clear(); }; var draftButton = new Ext.Toolbar.Button({ icon : "../widgets/lingo/list-items.gif", id : 'draftButton', text : '放入草稿箱', cls : 'add', tooltip : '放入草稿箱', hidden : true, handler : changeStatus.createDelegate(lightGrid,[3, "放入草稿箱"]) }); var rubbishButton = new Ext.Toolbar.Button({ icon : "../widgets/lingo/list-items.gif", id : 'rubbishButton', text : '放入垃圾箱', cls : 'add', tooltip : '放入垃圾箱', hidden : true, handler : changeStatus.createDelegate(lightGrid,[4, "放入垃圾箱"]) }); lightGrid.toolbar.insertButton(3, draftButton); lightGrid.toolbar.insertButton(4, rubbishButton); // Tabs tabs.getTab(0).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(0).getText() + ")</b>"; currentStatus = 0; lightGrid.dataStore.reload(); draftButton.hide(); rubbishButton.hide(); }); tabs.getTab(1).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(1).getText() + ")</b>"; currentStatus = 1; lightGrid.dataStore.reload(); draftButton.show(); rubbishButton.show(); }); tabs.getTab(2).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(2).getText() + ")</b>"; currentStatus = 2; lightGrid.dataStore.reload(); draftButton.show(); rubbishButton.show(); }); tabs.getTab(3).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(3).getText() + ")</b>"; currentStatus = 3; lightGrid.dataStore.reload(); draftButton.hide(); rubbishButton.show(); }); tabs.getTab(4).on("activate", function(e) { layout.getRegion('north').titleTextEl.innerHTML = "<b>新闻管理 - (" + tabs.getTab(4).getText() + ")</b>"; currentStatus = 4; lightGrid.dataStore.reload(); draftButton.show(); rubbishButton.hide(); }); });
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-10-02 * http://code.google.com/p/anewssystem/ */ Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // 布局管理器 var layout = new Ext.BorderLayout(document.body, { center: { autoScroll : true, titlebar : false, tabPosition : 'top', closeOnTab : true, alwaysShowTabs : true, resizeTabs : true, fillToFrame : true } }); // 设置布局 layout.beginUpdate(); layout.add('center', new Ext.ContentPanel('tab1', { title : '关键字管理', toolbar : null, closable : false, fitToFrame : true })); layout.add('center', new Ext.ContentPanel('tab2', { title: "帮助", toolbar: null, closable: false, fitToFrame: true })); layout.restoreState(); layout.endUpdate(); layout.getRegion("center").showPanel("tab1"); // 默认需要id, name, theSort, parent, children // 其他随意定制 var metaData = [ {id : 'id', qtip : "ID", vType : "integer", allowBlank : true, defValue : -1, w:260}, {id : 'name', qtip : "关键字", vType : "chn", allowBlank : false, w:260}, {id : 'theSort', qtip : "排序", vType : "integer", allowBlank : true, w:260} ]; // 创建表格 var lightGrid = new Ext.lingo.JsonGrid("lightgrid", { metaData : metaData, dialogContent : "content" }); // 渲染表格 lightGrid.render(); });
JavaScript
/*--------------Ext.form.TreeField--------------------*/ function createXmlTree(el, url, callback) { /* */ var Tree = Ext.tree; var tree = new Tree.TreePanel(el, {//id animate:true, loader: new Tree.TreeLoader({dataUrl:'/anews/newscategory/getChildren.htm'}),//c.dataTag enableDD:false, containerScroll: true }); // set the root node var root = new Tree.AsyncTreeNode({ text: '分类',//c.title draggable:false, id:'source'//c.rootId }); tree.setRootNode(root); // render the tree tree.render(); root.expand(); return tree; /* var tree = new Ext.tree.TreePanel(el,{containerScroll: true}); var p = new Ext.data.HttpProxy({url:url}); p.on("loadexception", function(o, response, e) { if (e) throw e; }); p.load(null, { read: function(response) { var doc = response.responseXML; tree.setRootNode(rpTreeNodeFromXml(doc.documentElement || doc)); } }, callback || tree.render, tree); return tree; */ } //rp tree from xml function rpTreeNodeFromXml(XmlEl) { // Text is nodeValue to text node, otherwise it's the tag name var t = ((XmlEl.nodeType == 3) ? XmlEl.nodeValue : XmlEl.tagName); // No text, no node. if (t.replace(/\s/g,'').length == 0) { return null; } // Special case of an element containing no attributes and just one text node var leafTextNode = ((XmlEl.attributes.length == 0) && (XmlEl.childNodes.length == 1) && (XmlEl.firstChild.nodeType == 3)); if (leafTextNode ) { return new Ext.tree.TreeNode({ tagName: XmlEl.tagName, text: XmlEl.firstChild.nodeValue }); } var result = new Ext.tree.TreeNode({ text : t }); result.tagName=XmlEl.tagName; // For Elements, process attributes and children if (XmlEl.nodeType == 1) { Ext.each(XmlEl.attributes, function(a) { result.attributes[a.nodeName]=a.nodeValue; if(a.nodeName=='text') result.setText(a.nodeValue); }); if (!leafTextNode) { Ext.each(XmlEl.childNodes, function(el) { // Only process Elements and TextNodes if ((el.nodeType == 1) || (el.nodeType == 3)) { var c = rpTreeNodeFromXml(el); if (c) { result.appendChild(c); } } }); } } return result; } Ext.form.TreeField = function(config) { config.readOnly = true; Ext.form.TreeField.superclass.constructor.call(this, config); }; Ext.extend(Ext.form.TreeField, Ext.form.TriggerField, { triggerClass : 'x-form-date-trigger', defaultAutoCreate : {tag: "input", type: "text", size: "10", autocomplete: "off"}, getValue : function() { return Ext.form.TreeField.superclass.getValue.call(this)|| ""; }, setValue : function(val) { Ext.form.TreeField.superclass.setValue.call(this, val); }, menuListeners : { select:function (item, picker, node) { var v = node.text; var ed = this.ed; if(this.selfunc) { v = this.selfunc(node); } if(ed) { var r= ed.record; r.set(this.fn, v); } else { this.focus(); this.setValue(v); //Ext.get("category_id").value = node.id; //alert(Ext.get("category_id").value); document.getElementById("category_id").value = node.id; //alert(document.getElementById("category_id")); //alert(document.getElementById("category_id").value); } }, hide : function(){ } }, onTriggerClick : function(){ if(this.disabled){ return; } if(this.menu == null){ this.menu = new Ext.menu.TreeMenu(); } Ext.apply(this.menu.picker, { url:this.url }); this.menu.on(Ext.apply({}, this.menuListeners, { scope:this })); this.menu.picker.setValue(this.getValue()); this.menu.show(this.el, "tl-bl?"); }, invalidText : "{0} is not a valid date - it must be in the format {1}" }); Ext.menu.TreeMenu = function(config){ Ext.menu.TreeMenu.superclass.constructor.call(this, config); this.plain = true; var di = new Ext.menu.TreeItem(config); this.add(di); this.picker = di.picker; this.relayEvents(di, ["select"]); this.relayEvents(di, ["beforesubmit"]); }; Ext.extend(Ext.menu.TreeMenu, Ext.menu.Menu); Ext.menu.TreeItem = function(config){ Ext.menu.TreeItem.superclass.constructor.call(this, new Ext.TreePicker(config), config); this.picker = this.component; this.addEvents({select: true}); this.picker.on("render", function(picker){ picker.getEl().swallowEvent("click"); //picker.container.addClass("x-menu-date-item"); }); this.picker.on("select", this.onSelect, this); }; Ext.extend(Ext.menu.TreeItem, Ext.menu.Adapter, { onSelect : function(picker, node){ this.fireEvent("select", this, picker, node); Ext.menu.TreeItem.superclass.handleClick.call(this); } }); Ext.TreePicker = function(config){ Ext.TreePicker.superclass.constructor.call(this, config); this.addEvents({select: true}); if(this.handler){ this.on("select", this.handler, this.scope || this); } }; Ext.extend(Ext.TreePicker, Ext.Component, { setValue : function(value){ this.value=value; if(this.tree) this.tree.selectPath(value,'text'); }, getValue : function(){ return this.value; }, onRender : function(container){ var me=this; var dh = Ext.DomHelper; var el = document.createElement("div"); el.className = "x-date-picker"; el.innerHTML=''; var eo= Ext.get(el); this.el=eo; container.dom.appendChild(el); var tree=createXmlTree(el,me.url,function(){ var tree=this; tree.render(); tree.selectPath(me.getValue(),'text'); }); tree.on('click',function(node,e){ me.fireEvent("select", me, node); }); this.tree=tree; } } );
JavaScript
Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 创建树形 var tree = new Ext.tree.TreePanel('main', { animate:true, containerScroll: true, enableDD:true, lines: true, //loader: new Ext.tree.TreeLoader({dataUrl:'getChildren.htm'}) loader: new Ext.tree.TreeLoader({dataUrl:'getAllTree.htm'}) }); tree.el.addKeyListener(Ext.EventObject.DELETE, removeNode); //new Ext.tree.TreeSorter(tree, {folderSort:true}); var tb = new Ext.Toolbar(tree.el.createChild({tag:'div'})); tb.add({ text: '新增子分类', icon: '../widgets/anews/list-items.gif', cls: 'x-btn-text-icon album-btn', tooltip: '添加选中节点的下级分类', handler: createChild }, { text: '新增兄弟分类', icon: '../widgets/anews/list-items.gif', cls: 'x-btn-text-icon album-btn', tooltip: '添加选中节点的同级分类', handler: createBrother }, { text: '修改分类', icon: '../widgets/anews/list-items.gif', cls: 'x-btn-text-icon album-btn', tooltip: '修改选中分类', handler: updateNode }, { text: '删除分类', icon: '../widgets/anews/list-items.gif', cls: 'x-btn-text-icon album-btn', tooltip:'删除一个分类', handler:removeNode }, '-', { text: '排序', icon: '../widgets/anews/list-items.gif', cls: 'x-btn-text-icon album-btn', tooltip:'保存排序结果', handler:save }, '-', { text: '展开', icon: '../widgets/anews/list-items.gif', cls: 'x-btn-text-icon album-btn', tooltip:'展开所有分类', handler:expandAll }, { text: '关闭', icon: '../widgets/anews/list-items.gif', cls: 'x-btn-text-icon album-btn', tooltip:'关闭所有分类', handler:collapseAll }, { text: '刷新', icon: '../widgets/anews/list-items.gif', cls: 'x-btn-text-icon album-btn', tooltip:'刷新所有节点', handler:refresh }); // 设置inlineEditor var ge = new Ext.tree.TreeEditor(tree, { allowBlank:false, blankText:'请添写名称', selectOnFocus:true }); ge.on('beforestartedit', function(){ var node = ge.editNode; if(!node.attributes.allowEdit){ return false; } else { node.attributes.oldText = node.text; } }); ge.on('complete', function() { var node = ge.editNode; // 如果节点没有改变,就向服务器发送修改信息 if (node.attributes.oldText == node.text) { node.attributes.oldText = null; return true; } var item = { id: node.id, text: node.text, parentId: node.parentNode.id }; tree.el.mask('正在与服务器交换数据...', 'x-mask-loading'); var hide = tree.el.unmask.createDelegate(tree.el); var doSuccess = function(responseObject) { eval("var o = " + responseObject.responseText + ";"); ge.editNode.id = o.id; hide(); }; Ext.lib.Ajax.request( 'POST', 'insertTree.htm', {success:doSuccess,failure:hide}, 'data='+encodeURIComponent(Ext.encode(item)) ); }); var root = new Ext.tree.AsyncTreeNode({ text: '分类', draggable:true, id:'-1' }); tree.setRootNode(root); tree.render(); root.expand(true, false); // function function createChild() { var sm = tree.getSelectionModel(); var n = sm.getSelectedNode(); if (!n) { n = tree.getRootNode(); } else { n.expand(false, false); } // var selectedId = (n) ? n.id : -1; createNode(n); } function createBrother() { var n = tree.getSelectionModel().getSelectedNode(); if (!n) { Ext.Msg.alert('提示', "请选择一个节点"); } else if (n == tree.getRootNode()) { Ext.Msg.alert('提示', "不能为根节点增加兄弟节点"); } else { createNode(n.parentNode); } } function createNode(n) { var node = n.appendChild(new Ext.tree.TreeNode({ id:-1, text:'请输入分类名', cls:'album-node', allowDrag:true, allowDelete:true, allowEdit:true, allowChildren:true })); tree.getSelectionModel().select(node); setTimeout(function(){ ge.editNode = node; ge.startEdit(node.ui.textNode); }, 10); } function updateNode() { var n = tree.getSelectionModel().getSelectedNode(); if (!n) { Ext.Msg.alert('提示', "请选择一个节点"); } else if (n == tree.getRootNode()) { Ext.Msg.alert('提示', "不能为根节点增加兄弟节点"); } else { setTimeout(function(){ ge.editNode = n; ge.startEdit(n.ui.textNode); }, 10); } } function removeNode() { var sm = tree.getSelectionModel(); var n = sm.getSelectedNode(); if(n && n.attributes.allowDelete){ tree.getSelectionModel().selectPrevious(); tree.el.mask('正在与服务器交换数据...', 'x-mask-loading'); var hide = tree.el.unmask.createDelegate(tree.el); Ext.lib.Ajax.request( 'POST', 'removeTree.htm', {success:hide,failure:hide}, 'id='+n.id ); n.parentNode.removeChild(n); } } function appendNode(node, array) { if (!node || node.childNodes.length < 1) { return; } for (var i = 0; i < node.childNodes.length; i++) { var child = node.childNodes[i]; array.push({id:child.id,parentId:child.parentNode.id}); appendNode(child, array); } } // save to the server in a format usable in PHP function save() { tree.el.mask('正在与服务器交换数据...', 'x-mask-loading'); var hide = tree.el.unmask.createDelegate(tree.el); var ch = []; appendNode(root, ch); Ext.lib.Ajax.request( 'POST', 'sortTree.htm', {success:hide,failure:hide}, 'data='+encodeURIComponent(Ext.encode(ch)) ); } function collapseAll(){ ctxMenu.hide(); setTimeout(function(){ root.eachChild(function(n){ n.collapse(false, false); }); }, 10); } function expandAll(){ ctxMenu.hide(); setTimeout(function(){ root.eachChild(function(n){ n.expand(false, false); }); }, 10); } tree.on('contextmenu', prepareCtx); // 右键菜单 var ctxMenu = new Ext.menu.Menu({ id:'copyCtx', items: [{ id:'createChild', handler:createChild, cls:'create-mi', text: '新增子节点' },{ id:'createBrother', handler:createBrother, cls:'create-mi', text: '新增兄弟节点' },{ id:'updateNode', handler:updateNode, cls:'update-mi', text: '修改节点' },{ id:'remove', handler:removeNode, cls:'remove-mi', text: '删除' },'-',{ id:'expand', handler:expandAll, cls:'expand-all', text:'展开' },{ id:'collapse', handler:collapseAll, cls:'collapse-all', text:'关闭' },{ id:'refresh', handler:refresh, cls:'refresh', text:'刷新' }] }); function prepareCtx(node, e){ node.select(); ctxMenu.items.get('remove')[node.attributes.allowDelete ? 'enable' : 'disable'](); ctxMenu.showAt(e.getXY()); } tree.on("nodedragover", function(e){ var n = e.target; if (n.leaf) { n.leaf = false; } return true; }); // handle drag over and drag drop tree.on('nodedrop', function(e){ var n = e.dropNode; //alert(n + "," + e.target + "," + e.point); return true; }); function refresh() { tree.root.reload(); tree.root.expand(true, false); } });
JavaScript
var treecombo = function(){ // return a public interface return { init : function(){ var el = Ext.get('category_field').dom; var config = { title: '新闻分类', rootId: 0, height:200, dataTag: 'newdistrict', treeHeight: 150, beforeSelect: function(){} }; var object = new Ext.form.TreeField({ id: el.id, name : el.id, allowBlank: false, width: 200, treeConfig: config }); //if(不是EditorGrid && 不是Form) object.applyTo(el.id); object.applyTo(el.id); } } }(); Ext.onReady(treecombo.init, treecombo, true);
JavaScript
// Create user extensions namespace (Ext.ux) Ext.namespace('Ext.ux'); /** * Ext.ux.PasswordMeter Extension Class * * @author Eelco Wiersma * @version 0.2 * * Algorithm based on code of Tane * http://digitalspaghetti.me.uk/index.php?q=jquery-pstrength * and Steve Moitozo * http://www.geekwisdom.com/dyn/passwdmeter * * @license MIT License: http://www.opensource.org/licenses/mit-license.php * * @class Ext.ux.PasswordMeter * @extends Ext.form.TextField * @constructor * Creates new Ext.ux.PasswordMeter */ Ext.ux.PasswordMeter = function(config) { // call parent constructor Ext.ux.PasswordMeter.superclass.constructor.call(this, config); }; Ext.extend(Ext.ux.PasswordMeter, Ext.form.TextField, { /** * @cfg {String} inputType The type attribute for input fields -- e.g. text, password (defaults to "password"). */ inputType: 'text', // private onRender: function(ct, position) { Ext.ux.PasswordMeter.superclass.onRender.call(this, ct, position); var elp = this.el.findParent('.x-form-element', 5, true); this.objMeter = ct.createChild({tag: "div", 'class': "strengthMeter"}); if (elp) { this.objMeter.setWidth(elp.getWidth(true) - 17); } else { // 做成跟password输入框一样宽度 this.objMeter.setWidth(this.width); } this.scoreBar = this.objMeter.createChild({tag: "div", 'class': "scoreBar"}); if(Ext.isIE && !Ext.isIE7) { // Fix style for IE6 this.objMeter.setStyle('margin-left', '3px'); } }, // private initEvents: function() { Ext.ux.PasswordMeter.superclass.initEvents.call(this); this.el.on('keyup', this.updateMeter, this); }, /** * Sets the width of the meter, based on the score * @param {Object} e * Private function */ updateMeter: function(e) { var score = 0 var p = e.target.value; var maxWidth = this.objMeter.getWidth() - 2; var nScore = this.calcStrength(p); // Set new width var nRound = Math.round(nScore * 2); if (nRound > 100) { nRound = 100; } var scoreWidth = (maxWidth / 100) * nRound; this.scoreBar.setWidth(scoreWidth, true); }, /** * Calculates the strength of a password * @param {Object} p The password that needs to be calculated * @return {int} intScore The strength score of the password */ calcStrength: function(p) { var intScore = 0; // PASSWORD LENGTH intScore += p.length; if(p.length > 0 && p.length <= 4) { // length 4 or less intScore += p.length; } else if (p.length >= 5 && p.length <= 7) { // length between 5 and 7 intScore += 6; } else if (p.length >= 8 && p.length <= 15) { // length between 8 and 15 intScore += 12; //alert(intScore); } else if (p.length >= 16) { // length 16 or more intScore += 18; //alert(intScore); } // LETTERS (Not exactly implemented as dictacted above because of my limited understanding of Regex) if (p.match(/[a-z]/)) { // [verified] at least one lower case letter intScore += 1; } if (p.match(/[A-Z]/)) { // [verified] at least one upper case letter intScore += 5; } // NUMBERS if (p.match(/\d/)) { // [verified] at least one number intScore += 5; } if (p.match(/.*\d.*\d.*\d/)) { // [verified] at least three numbers intScore += 5; } // SPECIAL CHAR if (p.match(/[!,@,#,$,%,^,&,*,?,_,~]/)) { // [verified] at least one special character intScore += 5; } // [verified] at least two special characters if (p.match(/.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~]/)) { intScore += 5; } // COMBOS if (p.match(/(?=.*[a-z])(?=.*[A-Z])/)) { // [verified] both upper and lower case intScore += 2; } if (p.match(/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/)) { // [verified] both letters and numbers intScore += 2; } // [verified] letters, numbers, and special characters if (p.match(/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!,@,#,$,%,^,&,*,?,_,~])/)) { intScore += 2; } return intScore; }, // private onFocus: function() { Ext.ux.PasswordMeter.superclass.onFocus.call(this); if(!Ext.isOpera) { // don't touch in Opera this.objMeter.addClass('strengthMeter-focus'); } }, // private onBlur: function() { Ext.ux.PasswordMeter.superclass.onBlur.call(this); if(!Ext.isOpera) { // don't touch in Opera this.objMeter.removeClass('strengthMeter-focus'); } } });
JavaScript
Ext.data.DWRProxy = function(dwrCall, pagingAndSort) { Ext.data.DWRProxy.superclass.constructor.call(this); this.dwrCall = dwrCall; //this.args = args; this.pagingAndSort = (pagingAndSort!=undefined ? pagingAndSort : true); }; Ext.extend(Ext.data.DWRProxy, Ext.data.DataProxy, { load : function(params, reader, callback, scope, arg) { if(this.fireEvent("beforeload", this, params) !== false) { //var sort; // if(params.sort && params.dir) sort = params.sort + ' ' + params.dir; //else sort = ''; var delegate = this.loadResponse.createDelegate(this, [reader, callback, scope, arg], 1); var callParams = new Array(); //if(arg.arg) { // callParams = arg.arg.slice(); //} //if(this.pagingAndSort) { //callParams.push(params.start); //callParams.push(params.limit); //callParams.push(sort); //} callParams.push(arg.params); callParams.push(delegate); this.dwrCall.apply(this, callParams); } else { callback.call(scope || this, null, arg, false); } }, loadResponse : function(listRange, reader, callback, scope, arg) { var result; try { result = reader.read(listRange); } catch(e) { this.fireEvent("loadexception", this, null, response, e); callback.call(scope, null, arg, false); return; } callback.call(scope, result, arg, true); }, update : function(dataSet){}, updateResponse : function(dataSet){} }); Ext.data.ListRangeReader = function(meta, recordType){ Ext.data.ListRangeReader.superclass.constructor.call(this, meta, recordType); this.recordType = recordType; }; Ext.extend(Ext.data.ListRangeReader, Ext.data.DataReader, { getJsonAccessor: function(){ var re = /[\[\.]/; return function(expr) { try { return(re.test(expr)) ? new Function("obj", "return obj." + expr) : function(obj){ return obj[expr]; }; } catch(e){} return Ext.emptyFn; }; }(), read : function(o){ var recordType = this.recordType, fields = recordType.prototype.fields; //Generate extraction functions for the totalProperty, the root, the id, and for each field if (!this.ef) { if(this.meta.totalProperty) { this.getTotal = this.getJsonAccessor(this.meta.totalProperty); } if(this.meta.successProperty) { this.getSuccess = this.getJsonAccessor(this.meta.successProperty); } if (this.meta.id) { var g = this.getJsonAccessor(this.meta.id); this.getId = function(rec) { var r = g(rec); return (r === undefined || r === "") ? null : r; }; } else { this.getId = function(){return null;}; } this.ef = []; for(var i = 0; i < fields.length; i++){ f = fields.items[i]; var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name; this.ef[i] = this.getJsonAccessor(map); } } var records = []; var root = o.result, c = root.length, totalRecords = c, success = true; if(this.meta.totalProperty){ var v = parseInt(this.getTotal(o), 10); if(!isNaN(v)){ totalRecords = v; } } if(this.meta.successProperty){ var v = this.getSuccess(o); if(v === false || v === 'false'){ success = false; } } for(var i = 0; i < c; i++){ var n = root[i]; var values = {}; var id = this.getId(n); for(var j = 0; j < fields.length; j++){ f = fields.items[j]; try { var v = this.ef[j](n); values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue); } catch(e) { values[f.name] = ""; } } var record = new recordType(values, id); records[i] = record; } return { success : success, records : records, totalRecords : totalRecords }; } });
JavaScript
Ext.Forms = function() { this.Form = Ext.form; this.isApply = true; }; Ext.extend(Ext.Forms, Ext.util.Observable, { createQuicksearch:function(E, C) { var G = "", D = "", F = Ext.id(); if(E.convert) { G = "char=\"" + E.convert + "\""; } if(!E.vType) { var B = E.vWidth ? E.vWidth : 23; D = "<input id=\"" + F + "\" size=\"" + B + "\" vType=\"chn\" " + G + " allowBlank=true>"; } else if(E.vType == "date") { B = E.vWidth ? E.vWidth : 20; D = "<input id=\"" + F + "\" size=\"" + B + "\" vType=\"date\" " + G + " format=\"" + (E.format ? E.format : "Y年m月d日") + "\" setAllMonth=" + E.setAllMonth + ">"; } else if(E.vType == "comboBox") { B = E.vWidth ? E.vWidth : 150; D = "<input id=\"" + F + "\" vType=\"comboBox\" " + G + " vWidth=\"" + B + "\" vType=\"comboBox\" allowBlank=false vForceSelection=\"true\" data=\"" + E.data + "\" readonly>"; } E.label = E.label ? E.label + ":" : "快速检索:"; if(!E.textRight) { E.textRight = 160; } if(!E.inputRight) { E.inputRight = 8; } E.tb.addDom({ tag:"div", id:"quicksearchText", style:"position:absolute; right:" + E.textRight + "px; top:8px;", html:E.label }); E.tb.addDom({ tag:"div", id:"quicksearchDiv", style:"position:absolute; right:" + E.inputRight + "px; top:3px;", html:D }); var A = Ext.get(F); A.on("mouseover", function() { this.focus(); }); A.dom.eventTab = false; if(E.vType == "date") { A = Forms.date(A.dom); } else if(E.vType == "comboBox") { A = Forms.comboBox(A.dom); } else { A = Forms.input(A.dom); } if(C) { A.el.on("keydown", function(e) { if(e.keyCode == 13) { var A = this.getValue().replace(/^\s+|\s+$/g, ""); C.call(this, A); } }); } return A }, applyEl : function(G, H, B) { this.isApply = false; G = Ext.get(G); var E = G.dom.getElementsByTagName("input"); var K = G.dom.getElementsByTagName("textarea"); var I = new Array(); var A = E.length + K.length; var D; for(var C = 0; C < A; C++) { var F = C < E.length ? E[C] : K[Math.abs(A - C - K.length)]; if(F.vType == "date") { D = Forms.date(F); } else if(F.vType == "comboBox") { D = Forms.comboBox(F); } else if(F.vType == "textArea") { D = Forms.textArea(F); } else if(F.vType == "treeField") { D = Forms.treeField(F); } else if(("text,hidden,password").indexOf(F.type) >= 0) { D = Forms.input(F); } D.unit = F.unit; D.docType = B; D.background = H; I[I.length] = D; } try { G.update(""); } catch(J) { G.dom.innerHTML = ""; } this.isApply = true; this.elements = I; return I; }, getElementById : function(A) { for(i = 0; i < this.elements.length; i++) { var B = this.elements[i]; if(B.id == A) { return B; } } return null; }, convert : function(s) { this.char = this.char ? this.char : s; if(this.char == 'upper') { this.value = this.value.toUpperCase(); } else if(this.char == 'lower') { this.value = this.value.toLowerCase(); } return this.value; }, validateField : function(E, A) { var D = true, B = E.allowBlank, G = E.alt, F = true, C = this.yesBtn ? ((A + "").indexOf("______") == 0 && this.yesBtn.cls == "add") : false; try { F = !E.isValid(); } catch(H){ F = A == "" && !B; } if(F || C) { if(E.maxLength) { D = A.length > E.maxLength; if(D) { Msg.suggest("错误:", G + "最多允许输入<font color=blue>" + E.maxLength + "</font>位!"); return false; } } Msg.suggest("错误:", String.format(E.invalidText, G)); return false; } if(E.vtype == "integer" || E.vtype == "number") { if(E.maxValue) { D = A * 1 > E.maxValue * 1; if(D) { Msg.suggest("错误:", G + "不得大于&nbsp;<font color=red>" + E.maxValue + "</font>"); return false; } } if(E.minValue) { D = A * 1 < E.maxValue * 1; if(D) { Msg.suggest("错误:", G + "不得小于&nbsp;<font color=red>" + E.maxValue + "</font>"); return false; } } } return true; }, input:function(el) { var object = new this.Form.TextField({ allowBlank : el.getAttribute("allowblank") == undefined ? false : eval(el.getAttribute("allowblank")), vtype : el.getAttribute("vtype"), cls : el.type == "password" ? el.getAttribute("cls") : null, //width : el.getAttribute("vwidth") ? null : null, id : el.id, name : el.id, style : (el.getAttribute("vtype") == "integer" || el.getAttribute("vtype") == "number" ? "text-align: right;" : ""), readOnly : el.readOnly, defValue : el.getAttribute("defvalue"), alt : el.alt, maxLength : el.getAttribute("maxlength") ? el.getAttribute("maxlength") : Number.MAX_VALUE, minLength : el.getAttribute("minlength") ? el.getAttribute("minlength") : 0, minValue : el.getAttribute("minvalue") ? el.getAttribute("minvalue") : 0, maxValue : el.getAttribute("maxvalue") ? el.getAttribute("maxvalue") : Number.MAX_VALUE }); if(el.readOnly) { object.style += "color:#656B86;"; } if(el.value != "" && el.format == "date") { el.value = datagrids[0].date(el.value); } if(this.isApply) { object.applyTo(el.id); } if(el.getAttribute("defvalue")) { object.setValue(el.getAttribute("defvalue")); } return object; }, date : function(el) { var object = new this.Form.DateField({ id : el.id, name : el.id, allowBlank : el.getAttribute("allowblank") == undefined ? false : eval(el.getAttribute("allowblank")), format : (el.getAttribute("format") ? el.getAttribute("format") : "Y年m月d日"), readOnly : true, //width : el.getAttribute("vwidth") ? null : null, defValue : el.getAttribute("defvalue"), vType : "date", alt : el.alt, setAllMonth : (el.setAllMonth ? el.setAllMonth : false) }); if(this.isApply) { object.applyTo(el.id); } if(el.getAttribute("defvalue")) { object.setValue(el.getAttribute("defvalue")); } else { object.setValue(nowDate); } return object; } }); var Forms = new Ext.Forms();
JavaScript
Ext.grid.Grid = function (container, config) { // 初始化容器 this.container = Ext.get(container); this.container.update(""); this.container.setStyle("overflow", "hidden"); this.container.addClass("x-grid-container"); this.id = this.container.id; Ext.apply(this, config); // 检测并确认配置的快捷方式 if(this.ds) { this.dataSource = this.ds; delete this.ds; } if(this.cm) { this.colModel = this.cm; delete this.cm; } if(this.sm) { this.selModel = this.sm; delete this.sm; } if(this.width) { this.container.setWidth(this.width); } if(this.height) { this.container.setHeight(this.height); } /** @private */ this.addEvents({ // raw events /** * @event click * The raw click event for the entire grid. * @param {Ext.EventObject} e */ "click":true, /** * @event dblclick * The raw dblclick event for the entire grid. * @param {Ext.EventObject} e */ "dblclick":true, /** * @event contextmenu * The raw contextmenu event for the entire grid. * @param {Ext.EventObject} e */ "contextmenu":true, /** * @event mousedown * The raw mousedown event for the entire grid. * @param {Ext.EventObject} e */ "mousedown":true, /** * @event mouseup * The raw mouseup event for the entire grid. * @param {Ext.EventObject} e */ "mouseup":true, /** * @event mouseover * The raw mouseover event for the entire grid. * @param {Ext.EventObject} e */ "mouseover":true, /** * @event mouseout * The raw mouseout event for the entire grid. * @param {Ext.EventObject} e */ "mouseout":true, /** * @event keypress * The raw keypress event for the entire grid. * @param {Ext.EventObject} e */ "keypress":true, /** * @event keydown * The raw keydown event for the entire grid. * @param {Ext.EventObject} e */ "keydown":true, // custom events /** * @event cellclick * Fires when a cell is clicked * @param {Grid} this * @param {Number} rowIndex * @param {Number} columnIndex * @param {Ext.EventObject} e */ "cellclick":true, /** * @event celldblclick * Fires when a cell is double clicked * @param {Grid} this * @param {Number} rowIndex * @param {Number} columnIndex * @param {Ext.EventObject} e */ "celldblclick":true, /** * @event rowclick * Fires when a row is clicked * @param {Grid} this * @param {Number} rowIndex * @param {Ext.EventObject} e */ "rowclick":true, /** * @event rowdblclick * Fires when a row is double clicked * @param {Grid} this * @param {Number} rowIndex * @param {Ext.EventObject} e */ "rowdblclick":true, /** * @event headerclick * Fires when a header is clicked * @param {Grid} this * @param {Number} columnIndex * @param {Ext.EventObject} e */ "headerclick":true, /** * @event headerdblclick * Fires when a header cell is double clicked * @param {Grid} this * @param {Number} columnIndex * @param {Ext.EventObject} e */ "headerdblclick":true, /** * @event rowcontextmenu * Fires when a row is right clicked * @param {Grid} this * @param {Number} rowIndex * @param {Ext.EventObject} e */ "rowcontextmenu":true, /** * @event cellcontextmenu * Fires when a cell is right clicked * @param {Grid} this * @param {Number} rowIndex * @param {Number} cellIndex * @param {Ext.EventObject} e */ "cellcontextmenu":true, /** * @event headercontextmenu * Fires when a header is right clicked * @param {Grid} this * @param {Number} columnIndex * @param {Ext.EventObject} e */ "headercontextmenu":true, /** * @event bodyscroll * Fires when the body element is scrolled * @param {Number} scrollLeft * @param {Number} scrollTop */ "bodyscroll":true, /** * @event columnresize * Fires when the user resizes a column * @param {Number} columnIndex * @param {Number} newSize */ "columnresize":true, /** * @event columnmove * Fires when the user moves a column * @param {Number} oldIndex * @param {Number} newIndex */ "columnmove":true, /** * @event startdrag * Fires when row(s) start being dragged * @param {Grid} this * @param {Ext.GridDD} dd The drag drop object * @param {event} e The raw browser event */ "startdrag":true, /** * @event enddrag * Fires when a drag operation is complete * @param {Grid} this * @param {Ext.GridDD} dd The drag drop object * @param {event} e The raw browser event */ "enddrag":true, /** * @event dragdrop * Fires when dragged row(s) are dropped on a valid DD target * @param {Grid} this * @param {Ext.GridDD} dd The drag drop object * @param {String} targetId The target drag drop object * @param {event} e The raw browser event */ "dragdrop":true, /** * @event dragover * Fires while row(s) are being dragged. "targetId" is the id of the Yahoo.util.DD object the selected rows are being dragged over. * @param {Grid} this * @param {Ext.GridDD} dd The drag drop object * @param {String} targetId The target drag drop object * @param {event} e The raw browser event */ "dragover":true, /** * @event dragenter * Fires when the dragged row(s) first cross another DD target while being dragged * @param {Grid} this * @param {Ext.GridDD} dd The drag drop object * @param {String} targetId The target drag drop object * @param {event} e The raw browser event */ "dragenter":true, /** * @event dragout * Fires when the dragged row(s) leave another DD target while being dragged * @param {Grid} this * @param {Ext.GridDD} dd The drag drop object * @param {String} targetId The target drag drop object * @param {event} e The raw browser event */ "dragout":true, /** * @event render * Fires when the grid is rendered * @param {Grid} grid */ render : true }); Ext.grid.Grid.superclass.constructor.call(this); }; Ext.extend(Ext.grid.Grid, Ext.util.Observable, { /** * @cfg {Number} minColumnWidth The minimum width a column can be resized to. Default is 25. */ minColumnWidth:25, /** * @cfg {Boolean} autoSizeColumns True to automatically resize the columns to fit their content * <b>on initial render.</b> It is more efficient to explicitly size the columns * through the ColumnModel's {@link Ext.grid.ColumnModel#width} config option. Default is false. */ autoSizeColumns:false, /** * @cfg {Boolean} autoSizeHeaders True to measure headers with column data when auto sizing columns. Default is true. */ autoSizeHeaders:true, /** * @cfg {Boolean} monitorWindowResize True to autoSize the grid when the window resizes. Default is true. */ monitorWindowResize:true, /** * @cfg {Boolean} maxRowsToMeasure If autoSizeColumns is on, maxRowsToMeasure can be used to limit the number of * rows measured to get a columns size. Default is 0 (all rows). */ maxRowsToMeasure:0, /** * @cfg {Boolean} trackMouseOver True to highlight rows when the mouse is over. Default is true. */ trackMouseOver:true, /** * @cfg {Boolean} enableDragDrop True to enable drag and drop of rows. Default is false. */ enableDragDrop:false, /** * @cfg {Boolean} enableColumnMove True to enable drag and drop reorder of columns. Default is true. */ enableColumnMove:true, /** * @cfg {Boolean} enableColumnHide True to enable hiding of columns with the header context menu. Default is true. */ enableColumnHide:true, /** * @cfg {Boolean} enableRowHeightSync True to manually sync row heights across locked and not locked rows. Default is false. */ enableRowHeightSync:false, /** * @cfg {Boolean} stripeRows True to stripe the rows. Default is true. */ stripeRows:true, /** * @cfg {Boolean} autoHeight True to fit the height of the grid container to the height of the data. Default is false. */ autoHeight:false, /** * @cfg {String} autoExpandColumn The id of a column in this grid that should expand to fill unused space. This id can not be 0. Default is false. */ autoExpandColumn:false, /** * @cfg {Number} autoExpandMin The minimum width the autoExpandColumn can have (if enabled). * Default is 50. */ autoExpandMin:50, /** * @cfg {Number} autoExpandMax The maximum width the autoExpandColumn can have (if enabled). Default is 1000. */ autoExpandMax:1000, /** * @cfg {Object} view The {@link Ext.grid.GridView} used by the grid. This can be set before a call to render(). */ view:null, allowTextSelectionPattern:/INPUT|TEXTAREA|SELECT/i, /** * @cfg {Object} loadMask An {@link Ext.LoadMask} config or true to mask the grid while loading. Default is false. */ loadMask:false, // private rendered:false, /** * @cfg {Number} maxHeight Sets the maximum height of the grid - ignored if autoHeight is not on. */ /** * Called once after all setup has been completed and the grid is ready to be rendered. * @return {Ext.grid.Grid} this */ render:function() { var D = this.container; // try to detect autoHeight/width mode if(D.getStyle("height").indexOf("%") < 0) { var C = D.dom.style.height, F = D.dom.style.minusHeight, B = document.documentElement.offsetHeight - 55; C = C.replace("px", ""); if(F != undefined) { F = F.replace("px", ""); C = B - F; } else if(D.getStyle("height") == "auto") { C = B; } else if(C.length == 4) { C = B - (C * 1 / 10) - 55; } var E = Cookies.get("xrinsurtheme"); D.dom.style.height = C + "px"; } var A = this.getView(); A.init(this); D.on("click", this.onClick, this); D.on("dblclick", this.onDblClick, this); D.on("contextmenu", this.onContextMenu, this); D.on("keydown", this.onKeyDown, this); this.relayEvents(D, ["mousedown", "mouseup", "mouseover", "mouseout", "keypress"]); this.getSelectionModel().init(this); A.render(); if(this.loadMask) { this.loadMask = new Ext.LoadMask(this.container, Ext.apply({ store:this.dataSource }, this.loadMask)); } this.rendered = true; return this; }, reconfigure:function(A, B) { if(this.loadMask) { this.loadMask.destroy(); this.loadMask = new Ext.LoadMask(this.container, Ext.apply({ store:A }, this.loadMask)); } this.view.bind(A, B); this.dataSource = A; this.colModel = B; this.view.refresh(true); }, onKeyDown:function(A) { this.fireEvent("keydown", A); }, destroy:function(A, C) { if(this.loadMask) { this.loadMask.destroy(); } var B = this.container; B.removeAllListeners(); this.view.destroy(); this.colModel.purgeListeners(); if(!C) { this.purgeListeners(); } B.update(""); if(A === true) { B.remove(); } }, processEvent:function(E, G) { this.fireEvent(E, G); var D = G.getTarget(), F = this.view, A = F.findHeaderIndex(D); if(A !== false) { this.fireEvent("header" + E, this, A, G); } else { var B = F.findRowIndex(D), C = F.findCellIndex(D); if(B !== false) { this.fireEvent("row" + E, this, B, G); if(C !== false) { this.fireEvent("cell" + E, this , B, C, G); } } } }, onClick:function(A) { this.processEvent("click", A); }, onContextMenu:function(B, A) { this.processEvent("contextmenu", B); }, onDblClick:function(A) { this.processEvent("dblclick", A); }, walkCells:function(E, H, C, J, A) { var G = this.colModel, B = G.getColumnCount(), D = this.dataSource, I = D.getCount(), F = true; if(C < 0) { if(H < 0) { E--; F=false; } while(E >= 0) { if(!F) { H = B - 1; } F = false; while(H >= 0) { if(J.call(A || this, E, H, G) === true) { return[E, H]; } H--; } E--; } } else { if(H >= B) { E++; F = false; } while(E < I) { if(!F) { H = 0; } F = false; while(H < B) { if(J.call(A || this, E, H, G) === true) { return[E, H]; } H++; } E++; } } return null; }, getSelections:function() { return this.selModel.getSelections(); }, autoSize:function() { if(this.rendered) { this.view.layout(); if(this.view.adjustForScroll) { this.view.adjustForScroll(); } } }, stopEditing:function() { }, getSelectionModel:function() { if(!this.selModel) { this.selModel = new Ext.grid.RowSelectionModel(); } return this.selModel; }, getDataSource:function() { return this.dataSource; }, getColumnModel:function() { return this.colModel; }, getView:function() { if(!this.view) { this.view = new Ext.grid.GridView(); } return this.view; }, getDragDropText:function() { var A = this.selModel.getCount(); return String.format(this.ddText, A, A == 1 ? "" : "s"); }, getGridEl : function(){ return this.container; }, })
JavaScript
// vim: ts=2:sw=2:nu:fdc=4:nospell /** * Ext.ux.InfoPanel Extension Class * * @author Ing. Jozef Sakalos * @version $Id: Ext.ux.InfoPanel.GoogleSearch.js 76 2007-06-28 11:35:41Z jozo $ * * @class Ext.ux.InfoPanel * @extends Ext.ux.InfoPanel * @constructor * @cfg {String} searchBtnText text to display on search button (defaults to 'Search') * @cfg {String} searchBtnIcon icon path to display on search button (defaults to null) * @cfg {Integer} searchTextSize search text size (defaults to 25) * @cfg {String/HTMLElement/Element} searchResultIframe iframe to display search results in (defaults to null) */ Ext.ux.InfoPanel.GoogleSearch = function(el, config, content) { // call parent constructor Ext.ux.InfoPanel.GoogleSearch.superclass.constructor.call(this, el, config); // create nicer Ext form var gsForm = this.body.select('form').item(0); // handle firefox cursor bug if(Ext.isGecko) { gsForm.setStyle('overflow', 'auto'); this.on('beforeexpand', function() { gsForm.setStyle('overflow', 'hidden'); }); this.on('beforecollapse', function() { gsForm.setStyle('overflow', 'hidden'); }); this.on('animationcompleted', function() { gsForm.setStyle('overflow', 'auto'); }); } // beautify search text input var gsText = gsForm.select('input[type=text]').item(0); gsText.addClass('x-form-text x-form-field'); gsText.dom.size = this.searchTextSize; // gsText.on('click', function(e) {e.stopEvent();}); // remove original google button this.body.select('input[type=submit]').remove(); // create new nicer button this.searchButton = new Ext.Button(gsForm, { text: this.searchBtnText , icon: this.searchBtnIcon , cls: this.searchBtnIcon ? 'x-btn-text-icon' : null , type: 'submit' , scope: this , handler: function() { if(this.searchResultIframe) { // disable submit gsForm.dom.onsubmit = function() { return false }; // create google search URL var inputs = gsForm.select('input'); var getPars = []; inputs.each(function(el) { if('radio' === el.dom.type && !el.dom.checked) { return; } getPars.push(el.dom.name + '=' + encodeURIComponent(el.dom.value)); }); var gsURL = gsForm.dom.action + '?' + getPars.join('&'); // set iframe src attribute Ext.get(this.searchResultIframe).dom.src = gsURL; } else { gsForm.dom.submit(); } } // end of handler }); }; // extend Ext.extend(Ext.ux.InfoPanel.GoogleSearch, Ext.ux.InfoPanel, { // defaults searchBtnText: 'Search' , searchTextSize: 25 , searchBtnIcon: null , searchResultIframe: null }); // end of file
JavaScript
Ext.DaoFactory = function() { this.addEvents({ "beforesave":true, "aftersave":true }) }; Ext.extend(Ext.DaoFactory, Ext.util.Observable, { save : function(D) { // E是this var E = this, B = function(C) { var B, A = C; // 如果C中包含{,就认识C不是简单文本,而是json对象 if(C.indexOf("{") >= 0){ // 解析json对象,A是消息msg,B是隐藏的对话框 C = objectEval(C); A = C.msg; B = C.hideDlg; // 隐藏弹出对话框的函数 } // 显示信息 Msg.suggest("信息:", A); E.progress(false, "post-wait", B); // TODO:进度条 // 操作完成后,触发aftersave事件 E.fireEvent("aftersave", this); }; // 如果触发beforesave事件失败,就强制中断 if(!this.fireEvent("beforesave", this)) { return false; // TODO:是否需要显示错误信息? } // A是用所有字段拼接成的字符串 var A = this.checkValue(); if(A != null) { // C应该是id值,D应该是操作的类型,edit或add var C = (D == "add") ? "0" : this.getRowId(); // 在进行edit操作,并且id中包含,或者id为空的情况下,执行edit方法 if(D == "edit" && (C.indexOf(",") >= 0 || C == "")) { // TODO:无法理解对id的判断 this.edit(); } else { // 显示等待进度条,同时执行function B this.progress(true, "post-wait"); this.exec.save(C, A, B) } } }, add : function() { return this.setValueofEmpty(true) }, edit : function(C) { var B = this.getRowId(), A = C ? C : { err1:"请选择需要修改的记录!", err2:"一次只能修改一条记录!" }; if(B == "") { "请在单位月明细中选择需要缴费的参保险种!"; Msg.suggest("错误:", A.err1); return false; } else if(B.indexOf(",") >= 0) { Msg.suggest("错误:", A.err2); return false; } else { this.setValue(false, true); return true; } }, del : function() { var B = this.getRowId(), A = function(A) { if(A == "yes") { var C = this.getRowId(), B = function(A) { datagrids._obj.setRowId(""); Msg.suggest("信息:", A); datagrids._obj.refresh(); } ; Msg.suggest("信息:", "正在删除,请稍候... "); if(this.exec.dwrDelete) { this.exec.dwrDelete(C,B); } else { this.exec.del(C, B); } } }; if(B == "") { Msg.suggest("错误:", "请选择需要删除的记录!"); return false; } else { if(!this.editor && this.dlg != true) { this.dlg.hide(); } Msg.confirm("信息", "您选择的&nbsp;<font color=red>" + B.split(",").length + "</font>&nbsp;条记录删除后将无法恢复,确认删除?", A, this); } return false; }, view : function(A) { this.showDlg({ text : "查看", cls : "view", btnText : $(A) }); } })
JavaScript
var datagrids = new Array(), comboboxArray = new Array(), nowDate = new Date(), nowFormateDate = nowDate.dateFormat("Y年m月d日"); Ext.DataGrid = function(config) { var cfg = config; this.dlg; this.dlgTitle = config.dlgTitle == undefined ? "" : config.dlgTitle; this.dlgDiv = cfg.gridDiv + "-dlg"; this.tabs; this.dlgContentDiv = cfg.dlgContentDiv; this.dlgWidth = cfg.dlgWidth; this.dlgHeight = cfg.dlgHeight; this.yesBtn; this.noBtn; this.gridDiv = cfg.gridDiv; this.paging = cfg.paging; this.pageInfo = cfg.pageInfo; this.pageSize = cfg.pageSize; this.grid; this.dataModel; this.colModel; this.defaultSort; this.header; this.column = new Array(); this.fields; this.initPaging = !cfg.initPaging ? true : cfg.initPaging; this.exec = eval(cfg.exec); this.url = setSitePath("./sandbox/listMenu.htm"); this.rowid = cfg.gridDiv + "_rowid"; this.colClick = false; this.row; this.checkList = new Array(); this.params; this.datagrids; this.dialogActivate; if(!this.editor) { Ext.DataGrid.superclass.constructor.call(this); } }; Ext.extend(Ext.DataGrid, Ext.DaoFactory, { hideDlg : function(B) { this.datagrids = datagrids.length; datagrids[this.datagrids] = this; for(var A = 0; A < datagrids.length; A++) { if(datagrids[A].dlgDiv != this.dlgDiv || B) { if(typeof datagrids[A].dlg == "object" && datagrids[A].dlg.isVisible()) { datagrids[A].dlg.hide(); } } } }, showDlg : function(tbBtn) { var b = tbBtn.cls == "view" ? true : eval("this." + tbBtn.cls + "()"); if(b) { if(!this.dlg) { this.createDialog(); } this.hideDlg(); this.tabs.getTab(0).setText(tbBtn.text + this.dlgTitle); this.setDialog({ width : this.dlgWidth, height : this.dlgHeight, tbBtn : tbBtn }); if(tbBtn.cls == "view") { this.dlg.show(tbBtn.btnText); if(!this.dialogActivate) { this.yesBtn.hide(); this.tabs.getTab(0).on("activate", function() { this.yesBtn.hide(); }, this, true); } } else { this.dlg.show(tbBtn.getEl()); if(!this.dialogActivate) { this.yesBtn.show(); this.tabs.getTab(0).on("activate", function() { this.yesBtn.show(); }, this, true); } } this.tabs.activate(0); } datagrids._obj = this; }, createDlgContentDiv : function() { var K = document.getElementById(this.dlgContentDiv), I = document.createElement("div"); I.id = this.gridDiv + "-content"; I.appendChild(K); var A = document.createElement("div"), H = document.createElement("div"), J = document.createElement("div"); A.id = "dlg-msg"; H.id = "post-wait"; H.className = "posting-msg"; J.className = "waitting"; J.innerHTML = "正在保存,请稍候..."; H.appendChild(J); A.appendChild(H); var B = document.createElement("div"), C = document.createElement("div"), F = document.createElement("div"), D = document.createElement("div"), L = document.createElement("div"), E = document.createElement("div"), G = document.createElement("div"); B.id = this.dlgDiv; B.style.visibility = "hidden"; C.className = "x-dlg-hd"; F.className = "x-dlg-bd"; G.className = "x-dlg-ft"; D.className = "x-dlg-tab"; L.className = "x-dlg-tab"; L.title=" 帮助 "; E.innerHTML = "<div id='help-content'><div id='standard-panel'>帮助...</div></div><div id='temp-content'></div>"; L.appendChild(E); F.appendChild(D); F.appendChild(L); G.appendChild(A); B.appendChild(C); B.appendChild(F); B.appendChild(G); document.body.appendChild(B); document.body.appendChild(I); datagrids._obj = this; }, createDialog : function() { if(this.editor) { alert("error!\neditgrid不允许设置link属性!"); } var A = this.dlgWidth, B = this.dlgHeight; this.createDlgContentDiv(); this.dlg = new Ext.BasicDialog(this.dlgDiv, { modal : false, autoTabs : true, width : (A == undefined ? 500 : A), height : (B == undefined ? 300 : B), shadow : false, minWidth : 200, minHeight : 100, closable : true }); this.dlg.addKeyListener(27, this.dlg.hide, this.dlg); this.yesBtn = this.dlg.addButton("确定", function() { }, this.dlg); this.tabs = this.dlg.getTabs(); this.tabs.getTab(1).on("activate", function(){ this.yesBtn.hide(); }, this, true); this.tabs.getTab(0).setContent(); var C = $(this.gridDiv + "-content"); this.tabs.getTab(0).setContent(C.innerHTML); this.applyElements(); document.body.removeChild(C); if(this.dialogActivate) { this.dialogActivate.call(this); } this.noBtn = this.dlg.addButton("取消", this.dlg.hide, this.dlg); }, applyElements : function(B) { //var D = $(this.dlgContentDiv).getElementsByTagName("input"), G = $(this.dlgContentDiv).getElementsByTagName("textarea"), A = D.length + G.length; var div = Ext.get(this.dlgContentDiv); var D = div.query("input"), G = div.query("textarea"), A = D.length + G.length; for(var C = 0; C < A; C++) { var F, E = C < D.length ? D[C] : G[Math.abs(A - C - G.length)]; try { var vType = E.getAttribute("vtype"); if(vType == "date") { F = Forms.date(E); } else if(vType == "textArea") { F = Forms.textArea(E); } else if(vType == "comboBox") { F = Forms.comboBox(E); } else if(vType == "treeField") { F = Forms.treeField(E); } else if(("text,hidden,password").indexOf(E.type) >= 0) { F = Forms.input(E); } }catch(e) { var buff = ""; for (var i in e) { buff += i + "," + e[i] + "\n"; } alert(buff); } this.column[this.column.length] = { id : E.id, type : E.type, vType : E.getAttribute("vtype"), allowBlank : E.getAttribute("allowblank"), alt : E.alt, format : E.getAttribute("format"), obj : F } } //alert(this.column.length); }, checkValue : function() { // 返回的结果,应该是result var C = new Array(); // TODO: var J = true; // 遍历所有字段 var result = {}; for(i = 0; i < this.column.length; i++) { // M是当前字段,currentField var M = this.column[i]; //console.info(M); //console.info(M.id); // B是当前值,currentValue var B = M.obj.getValue(); // K是是否通过验证,isValid var K = Forms.validateField(M.obj, B); // 如果没通过验证,就返回null if(!K) { M.obj.focus(); return null; } // 遇到下拉列表的时候,特殊处理 if(M.vType == "comboBox"){ // 当前字段的dom var H = M.obj.el.dom; // 取value B = H.key; // 如果是多选 if(H.multiple == "true") { var D = B.split(","); var I = M.obj.getText().split(","); var F = ""; var G = ""; for(var A = 0; A < D.length; A++) { var E = D[A].split("|"), L = A < D.length - 1 ? "," : ""; F += E[0] + L; G += E[1] + L; } B = F + "|" + G; } C[i] = B; } else if(M.vType == "date") { C[i] = B == "" ? "" : B.dateFormat("Y-m-d"); result[M.id] = B == "" ? "" : B.dateFormat("Y-m-d"); } else { C[i] = B; result[M.id] = M.obj.getValue(); } //var str = "result." + M.id + "=\'" + M.obj.getValue() + "\';"; //console.debug(str); //eval(str); } //var buff = ""; //for (var i in result) { // buff += i + "," + result[i] + " " //} //console.error(buff); return result; }, setDialog : function(A) { this.yesBtn.cls = A.tbBtn.cls; this.yesBtn.setText(A.tbBtn.btnText); this.yesBtn.setHandler(function() { this.save(A.tbBtn.cls) }, this); }, setValueofEmpty : function(A) { if(A) { for(i = 0; i < this.column.length; i++) { var B = this.column[i]; if(B.vType == "date") { if(B.obj.defValue != undefined) { B.obj.setValue(B.obj.defValue); } else { B.obj.setValue(nowDate); } } else if(B.vType == "comboBox"){ if(B.obj.el.dom.allowBlank == "true") { B.obj.setValue(""); B.obj.el.dom.key = ""; } } else if(B.vType == "textArea") { B.obj.setValue(""); } else if(("text,password").indexOf(B.type) >= 0) { if(B.obj.defValue != undefined) { B.obj.el.dom.value = B.obj.defValue; } } else { B.obj.el.dom.value = ""; } if(B.obj.disabled) { B.obj.enable(); } } return true } }, setValue : function(G, E) { var B; if(G) { B = this.dataModel.getAt(G); } else { var D = this.grid.selModel.getSelected; if(D) { B = this.dataModel.getAt(this.checkList[this.checkList.length - 1]); B = B ? B : this.grid.selModel.getSelected(); } else { B = this.grid.selModel.selection.record; } } for(var A = 0; A < this.column.length; A++) { var H = this.column[A], C = B.data[H.id] + ""; if(H.vType == "date") { H.obj.setValue(this.date(C)); } else if(H.vType == "comboBox") { var F = H.obj.el.dom; if(C.indexOf("|")>=0) { C = C.split("|"); C[1] = String.format(C[1], "|"); H.obj.setValue(C[1]); F.key = C[0]; } else { H.obj.setValue(C); F.key = C; } if(C.length == 0) { H.obj.setValue(H.obj.emptyText); } } else if(H.type == "password") { H.obj.setValue("______"); } else if("text,hidden,textArea".indexOf(H.type) >= 0) { if(C && C != "undefined") { if(H.obj.getEl().dom.format == "date") { C = this.date(C); } H.obj.setValue(C); } } if(this.yesBtn && this.yesBtn.cls == "view" && !E) { if(!H.obj.disabled) { H.obj.disable(); } } else if(H.obj.disabled) { H.obj.enable(); } } }, getRowId : function() { return $(this.rowid).value; }, setRowId : function(A) { $(this.rowid).value = A; }, getSelectedId : function() { var A = this.grid ? this.grid : this, B = A.selModel.getSelected(), C = "0"; if(B) { C = objectEval(B.data["idno"]).id; } return C; }, getSelectedColValueByName : function(C) { var A = this.grid ? this.grid : this, B = A.selModel.getSelected(), D = ""; if(B) { D = B.data[C]; } return D; }, refresh : function() { var A = this.row.pageNo * this.pageSize - this.pageSize, B; this.setRowId(""); if(this.params == null) { B = {params:{start:A, limit:this.pageSize}}; } else { B = {params:{start:A, limit:this.pageSize, params:this.params}}; } this.dataModel._options = B; this.dataModel.load(); if(this.editor) { this.newRecordCount = 0; this.dataModel.commitChanges(); } }, progress : function(B, D, A) { var C = Ext.get(D); if(B) { C.radioClass("active-msg"); this.yesBtn.disable(); this.noBtn.disable(); } else { if(A == undefined || A) { this.dlg.hide(); this.setValueofEmpty(this.getRowId() == ""); this.refresh(); } C.removeClass("active-msg"); this.yesBtn.enable(); this.noBtn.enable(); } }, getChecked : function() { var E = this.dataSource.getCount(), D = new Array(); if(E == 0) { return null; } for(var B = 0; B < E; B++) { var A = this.dataSource.getAt(B), C = $(this.id + "_checkbox_" + B); if(C.checked) { D[D.length] = A; } } return D.length == 1 ? D[0] : D; }, onRowClick : function(A, G) { if(!this.colClick) { return; } var C = $(this.gridDiv + "_checkbox_" + G), F = $(this.gridDiv + "_mycheckbox_" + G), D = $(this.gridDiv + "_label_" + G), E = this.checkList; getId(C, F, D, $(this.rowid)); if(C.checked) { E[E.length] = G; } else { for(var B = 0; B < E.length; B++) { if(E[B] == G) { E[B] = "X"; var H = E.toString().replace(/\,X/g, "").replace(/\X,/g, ""); E = H.split(","); this.checkList = E; E.sort(function(B, A) { return B * 1 > A * 1 ? -1 : 1; }); G = E[0]; if(G == "X") { G = -1; } else { H = A.selModel.selectRow; if(H) { A.selModel.selectRow(G); } else { A.selModel.select(G, 0, false, true); } } break; } } } if(G >- 1) { G = G * 1; if(G > this.pageSize) { G = G / 10; } this.setValue(G); } else { this.setValue(); } this.colClick = false; if(!this.dlg) { this.createDialog(); } }, getToolBarEvent : function() { var A = function(A) { this.obj.showDlg(A); }; return A; }, link : function(D, H, C, G, B, F) { var I = F.obj.gridDiv + "_" + H.cellId; if(D.indexOf(".gif") >= 0) { D = "<image src=\"" + path + "/widgets/extjs/1.1/resources/images/aero/user/tree/" + D + "\">"; } var E = "datagrids[{1}].colClick=true;datagrids[{1}].view(this)"; var A = "<span style='cursor:pointer;color=#5285C5' id='{0}' onclick='" + E + "'>{2}</span>"; A = String.format(A, I, F.obj.datagrids, D, G); return A; }, date : function(C, F, B, E, A, D) { var G = (C == "") ? "" : String.format(C.split(" ")[0].replace("-", "{0}").replace("-", "{1}"), "年","月") + "日"; return G; }, integer : function(C, F, B, E, A, D) { if(C.indexOf(".") >= 0) { C = C.substring(0, C.indexOf(".")); } return C; }, separator : function(C, F, B, E, A, D) { if(C.indexOf("@") >= 0) { return C.split("@")[1]; } if(C.indexOf("|") < 0) { return C; } return C.split("|")[1]; }, setCheckBox : function (D, H, C, G, B, F) { if(!D || D == "") { return""; } /* F.obj.row = objectEval(D); var E = (F.obj.getRowId().indexOf(F.obj.row.id) >= 0); var A = "<div style='display:none'><input type=checkbox id='{0}_checkbox_{1}' {2} value=\"{3}\" ></div>"; A += "<div id='{0}_mycheckbox_{1}' class='{4}' onclick='datagrids[{7}].colClick = true'></div>"; A += "<label id='{0}_label_{1}' onclick='datagrids[{7}].colClick = true' class='{5}'>{6}.</label>"; A = String.format(A, F.obj.gridDiv, G, E ? "checked" : "", F.obj.row.id, E ? "checkboxAreaChecked" : "checkboxArea", E ? "chosen" : "", F.obj.row.no, F.obj.datagrids); */ var E = false; var A = "<div style='display:none'><input type=checkbox id='{0}_checkbox_{1}' {2} value=\"{3}\" ></div>"; A += "<div id='{0}_mycheckbox_{1}' class='{4}' onclick='datagrids[{7}].colClick = true'></div>"; A += "<label id='{0}_label_{1}' onclick='datagrids[{7}].colClick = true' class='{5}'>{6}.</label>"; A = String.format(A, F.obj.gridDiv, G, E ? "checked" : "", D, E ? "checkboxAreaChecked" : "checkboxArea", E ? "chosen" : "", D, F.obj.datagrids); return A; }, setHeader : function(h) { var tagsArray, dataIndex; if(!h[0].dataIndex) { tagsArray = ""; var tags = function(A) { tagsArray = A; }; DWREngine.setAsync(false); this.exec.getTags(tags); DWREngine.setAsync(true); } var header = [{ header : "序号", dataIndex : "id", width : 55, align : "left", hidden : false, sortable : false, renderer : this.setCheckBox }], fields = [{ name:"id", mapping:"id" }]; for(var i = 0; i < h.length; i++) { var renderer = h[i].renderer; //console.error(h[i].type); var align = "left"; var hidden = false; var draw = h[i].draw != undefined ? h[i].draw : true; if(h[i].type != undefined) { renderer = eval("this." + h[i].type); } if(h[i].separator != undefined) { renderer = this.separator; } if(h[i].align != undefined) { align = h[i].align; } if(h[i].hidden != undefined) { hidden = h[i].hidden; } dataIndex = tagsArray ? tagsArray[i + 1] : h[i].dataIndex; h[i] = { header:h[i].header, dataIndex:dataIndex, width:h[i].width, align:align, hidden:hidden, sortable:h[i].sortable, renderer:renderer, draw:draw, id:dataIndex }; if(this.editor) { h[i] = this.getEditor(h[i], dataIndex, i == 0); } fields = fields.concat([{ name:dataIndex, mapping:dataIndex }]); } this.header = header.concat(h); this.fields = fields; var row_input = document.createElement("input"); row_input.id = this.rowid; row_input.type = "hidden"; document.body.appendChild(row_input); datagrids._obj = this; this.datagrids = datagrids.length; datagrids[this.datagrids] = this; }, getParams : function(H) { if(H != undefined) { var E = new Array(), G = new Array(), K = new Array(), I = "<separator>"; for(var F = 0; F < H.length; F++) { var M = H[F], B = " ? ", L = M.pName, C = M.pMore, A = M.pValue, D = M.pType, J = C == "like"; L = L.replace(/\+/g, "||"); A = J ? "%" + A + "%" : A; if(L.indexOf(")") >= 0 && L.indexOf("(") < 0) { L = L.replace(")", ""); B = " ?) "; } if(C == "in") { L = "instr(" + A + "|" + L + ")"; C = ">"; A = 0; D = "Integer"; } E[E.length] = L + " " + C + B + (M.pLogic == undefined ? "" : M.pLogic); if(A.length == 0) { A = "null"; } G[G.length] = A; K[K.length] = D; } H = E.toString().replace(/\,/g, " ").replace("|", ","); H += I + G.toString(); H += I + K.toString(); } else { H = null; } return H; }, addListener : function(B,A) { this.grid.addListener(B, A); }, getView : function() { return this.grid.getView(); }, render : function(A, C) { this.params = this.getParams(A); if(!this.colModel) { this.row = { "pageNo":1 }; this.colModel = new Ext.grid.ColumnModel(this.header); var B = { root:"root", record:"rows", totalRecords:"TotalCount" }; var recordType = Ext.data.Record.create([ {name: "id", mapping: "id", type: "int"}, {name: "image", mapping: "image", type: "string"}, {name: "name", mapping: "name", type: "string"}, {name: "forward", mapping: "forward", type: "string"}, {name: "theSort", mapping: "theSort", type: "int"} ]); this.dataModel = new Ext.data.Store({ proxy: new Ext.data.DWRProxy(MenuHelper.pagedQuery, true), reader: new Ext.data.ListRangeReader({ totalProperty: 'totalCount', id: 'id' }, recordType), // 远端排序开关 remoteSort: true, obj:this /* proxy:new Ext.data.HttpProxy({ url:this.url }), reader:new Ext.data.XmlReader(B, this.fields), remoteSort:true, obj:this */ }); if(this.defaultSort) { this.colModel.defaultSortable = true; this.dataModel.setDefaultSort(this.defaultSort.field, this.defaultSort.dir); } } if(!this.grid) { this.grid = new Ext.grid.Grid(this.gridDiv, { ds:this.dataModel, colModel:this.colModel, enableColLock:false, loadMask:true }); this.grid.addListener("rowclick", function(A) { A.isSelected = false; }); this.grid.addListener("rowclick", this.onRowClick, this, true); //var rz = new Ext.Resizable("resize-grid", { // wrap:true, // minHeight:500, // pinned:true, // handles: 's' //}); //rz.on('resize', this.grid.autoSize, this.grid); this.grid.render(); this.setPagingBar(); this.grid.getSelectedId = this.getSelectedId; this.grid.getChecked = this.getChecked; this.grid.getSelectedColValueByName = this.getSelectedColValueByName; } if(C != false) { this.pagingToolbar.loading.show(); this.refresh(); } }, getHeaderPanel : function() { this.headPanel = this.grid.getView().getHeaderPanel(true); return this.headPanel; }, getGridToolbar : function() { return new Ext.Toolbar(this.getHeaderPanel()); }, setPagingBar : function(){ var A = "显示&nbsp;{0}&nbsp;-&nbsp;{1}&nbsp;,&nbsp;共&nbsp;{2}&nbsp;条", C = "显示&nbsp;0&nbsp;-&nbsp;0&nbsp;,&nbsp;共&nbsp;0&nbsp;条"; if(this.pageInfo == false) { A = "共&nbsp;{2}&nbsp;条"; C = "共&nbsp;0&nbsp;条"; } var B = this.grid.getView().getFooterPanel(this.paging); this.pagingToolbar = new Ext.PagingToolbar(B, this.dataModel, { pageSize:this.pageSize, displayInfo:true, displayMsg:A, emptyMsg:C }); this.pagingToolbar.loading.hide(); if(this.editor) { this.pagingToolbar.loading.on("click", function() { this.newRecordCount = 0; this.dataModel.commitChanges(); } .createDelegate(this)); } }, insertIntoPagingBar : function(A) { this.pagingToolbar.add("-", { pressed:(A.pressed ? A.pressed : false), enableToggle:(A.enableToggle ? A.enableToggle : false), text:A.text, cls:(A.cls ? A.cls : "detail"), toggleHandler:A.handler.createDelegate(this) }); } })
JavaScript
// vim: ts=4:sw=4:nu:fdc=4:nospell // Create user extensions namespace (Ext.ux) Ext.namespace('Ext.ux'); /** * Ext.ux.InfoPanel Extension Class * * @author Ing. Jozef Sakalos * @version $Id: Ext.ux.InfoPanel.js 153 2007-08-24 10:46:19Z jozo $ * * @class Ext.ux.InfoPanel * @extends Ext.ContentPanel * @constructor * Creates new Ext.ux.InfoPanel * @param {String/HTMLElement/Element} el The container element for this panel * @param {String/Object} config A string to set only the title or a config object * @param {String} content (optional) Set the HTML content for this panel * @cfg {Boolean} animate set to true to switch animation of expand/collapse on (defaults to undefined) * @cfg {String} bodyClass css class added to the body in addition to the default class(es) * @cfg {String/HTMLElement/Element} bodyEl This element is used as body of panel. * @cfg {String} buttonPosition set this to 'left' to place expand button to the left of titlebar * @cfg {Boolean} collapsed false to start with the expanded body (defaults to true) * @cfg {String} collapsedIcon Path for icon to display in the title when panel is collapsed * @cfg {Boolean} collapseOnUnpin unpinned panel is collapsed when possible (defaults to true) * @cfg {Boolean} collapsible false to disable collapsibility (defaults to true) * @cfg {Boolean} draggable true to allow panel dragging (defaults to undefined) * @cfg {Float} duration Duration of animation in seconds (defaults to 0.35) * @cfg {String} easingCollapse Easing to use for collapse animation (e.g. 'backIn') * @cfg {String} easingExpand Easing to use for expand animation (e.g. 'backOut') * @cfg {String} expandedIcon Path for icon to display in the title when panel is expanded * @cfg {String} icon Path for icon to display in the title * @cfg {Integer} minWidth minimal width in pixels of the resizable panel (defaults to 0) * @cfg {Integer} maxWidth maximal width in pixels of the resizable panel (defaults to 9999) * @cfg {Integer} minHeight minimal height in pixels of the resizable panel (defaults to 50) * @cfg {Integer} maxHeight maximal height in pixels of the resizable panel (defaults to 9999) * @cfg {String} panelClass Set to override the default 'x-dock-panel' class. * @cfg {Boolean} pinned true to start in pinned state (implies collapsed:false) (defaults to false) * @cfg {Boolean} resizable true to allow use resize width of the panel. (defaults to undefined) * Handles are transparent. (defaults to false) * @cfg {String} shadowMode defaults to 'sides'. * @cfg {Boolean} showPin Show the pin button - makes sense only if panel is part of Accordion * @cfg {String} trigger 'title' or 'button'. Click where expands/collapses the panel (defaults to 'title') * @cfg {Boolean} useShadow Use shadows for undocked panels or panels w/o dock. (defaults to undefined = don't use) */ Ext.ux.InfoPanel = function(el, config, content) { config = config || el; // {{{ // basic setup var oldHtml = content || null; if(config && config.content) { oldHtml = oldHtml || config.content; delete(config.content); } // save autoScroll to this.bodyScroll if(config && config.autoScroll) { this.bodyScroll = config.autoScroll; delete(config.autoScroll); } var url; if(el && el.url) { url = el.url; delete(el.url); } if(config && config.url) { url = config.url; delete(config.url); } // call parent constructor Ext.ux.InfoPanel.superclass.constructor.call(this, el, config); this.desktop = Ext.get(this.desktop) || Ext.get(document.body); // shortcut of DomHelper var dh = Ext.DomHelper, oldTitleEl; this.el.clean(); this.el.addClass(this.panelClass); // handle autoCreate if(this.autoCreate) { oldHtml = this.el.dom.innerHTML; this.el.update(''); this.desktop.appendChild(this.el); this.el.removeClass('x-layout-inactive-content'); } // handle markup else { this.el.clean(); if(this.el.dom.firstChild && !this.bodyEl) { this.title = this.title || this.el.dom.firstChild.innerHTML; if(this.el.dom.firstChild.nextSibling) { this.body = Ext.get(this.el.dom.firstChild.nextSibling); } oldTitleEl = this.el.dom.firstChild; oldTitleEl = oldTitleEl.parentNode.removeChild(oldTitleEl); oldTitleEl = null; } } // get body element if(this.bodyEl) { this.body = Ext.get(this.bodyEl); this.el.appendChild(this.body); } // }}} // {{{ // create title element var create; if('left' === this.buttonPosition ) { create = { tag:'div', unselectable:'on', cls:'x-unselectable x-layout-panel-hd x-dock-panel-title', children: [ {tag:'table', cellspacing:0, children: [ {tag:'tr', children: [ {tag:'td', children:[ {tag:'div', cls:'x-dock-panel x-dock-panel-tools'} ]} , {tag:'td', width:'100%', children: [ {tag:'div', cls:'x-dock-panel x-layout-panel-hd-text x-dock-panel-title-text'} ]} , {tag:'td', cls:'x-dock-panel-title-icon-ct', children: [ {tag:'img', alt:'', cls:'x-dock-panel-title-icon'} ]} ]} ]} ]}; } else { create = { tag:'div', unselectable:'on', cls:'x-unselectable x-layout-panel-hd x-dock-panel-title', children: [ {tag:'table', cellspacing:0, children: [ {tag:'tr', children: [ {tag:'td', cls:'x-dock-panel-title-icon-ct', children: [ {tag:'img', alt:'', cls:'x-dock-panel-title-icon'} ]} , {tag:'td', width:'100%', children: [ {tag:'div', cls:'x-dock-panel x-layout-panel-hd-text x-dock-panel-title-text'} ]} , {tag:'td', children:[ {tag:'div', cls:'x-dock-panel x-dock-panel-tools'} ]} ]} ]} ]}; } this.titleEl = dh.insertFirst(this.el.dom, create, true); this.iconImg = this.titleEl.select('img.x-dock-panel-title-icon').item(0); this.titleEl.addClassOnOver('x-dock-panel-title-over'); this.titleEl.enableDisplayMode(); this.titleTextEl = Ext.get(this.titleEl.select('.x-dock-panel-title-text').elements[0]); this.tools = Ext.get(this.titleEl.select('.x-dock-panel-tools').elements[0]); if('right' === this.titleTextAlign) { this.titleTextEl.addClass('x-dock-panel-title-right'); } this.tm = Ext.util.TextMetrics.createInstance(this.titleTextEl); // }}} // {{{ // set title if(this.title) { this.setTitle(this.title); } // }}} // {{{ // create pin button if(this.showPin) { this.stickBtn = this.createTool(this.tools.dom, 'x-layout-stick'); this.stickBtn.enableDisplayMode(); this.stickBtn.on('click', function(e, target) { e.stopEvent(); this.pinned = ! this.pinned; this.updateVisuals(); this.fireEvent('pinned', this, this.pinned); }, this); this.stickBtn.hide(); } // }}} // {{{ // create collapse button if(this.collapsible) { this.collapseBtn = this.createTool(this.tools.dom , (this.collapsed ? 'x-layout-collapse-east' : 'x-layout-collapse-south') ); this.collapseBtn.enableDisplayMode(); if('title' === this.trigger) { this.titleEl.addClass('x-window-header-text'); this.titleEl.on({ click:{scope: this, fn:this.toggle} , selectstart:{scope: this, fn: function(e) { e.preventDefault(); return false; }} }, this); } else { this.collapseBtn.on("click", this.toggle, this); } } // }}} // {{{ // create body if it doesn't exist yet if(!this.body) { this.body = dh.append(this.el, { tag: 'div' , cls: this.bodyClass || null , html: oldHtml || '' }, true); } this.body.enableDisplayMode(); if(this.collapsed && !this.pinned) { this.body.hide(); } else if(this.pinned) { this.body.show(); this.collapsed = false; } this.body.addClass(this.bodyClass); this.body.addClass('x-dock-panel-body-undocked'); // bodyScroll this.scrollEl = this.body; // autoScroll -> bodyScroll is experimental due to IE bugs this.scrollEl.setStyle('overflow', this.bodyScroll === true && !this.collapsed ? 'auto' : 'hidden'); // }}} if(this.fixedHeight) { this.setHeight(this.fixedHeight); } if(url) { this.setUrl(url, this.params, this.loadOnce); } // install hook for title context menu if(this.titleMenu) { this.setTitleMenu(this.titleMenu); } // install hook for icon menu if(this.iconMenu) { this.setIconMenu(this.iconMenu); } // {{{ // add events this.addEvents({ /** * @event beforecollapse * Fires before collapse is taking place. Return false to cancel collapse * @param {Ext.ux.InfoPanel} this */ beforecollapse: true /** * @event collapse * Fires after collapse * @param {Ext.ux.InfoPanel} this */ , collapse: true /** * @event beforecollapse * Fires before expand is taking place. Return false to cancel expand * @param {Ext.ux.InfoPanel} this */ , beforeexpand: true /** * @event expand * Fires after expand * @param {Ext.ux.InfoPanel} this */ , expand: true /** * @event pinned * Fires when panel is pinned/unpinned * @param {Ext.ux.InfoPanel} this * @param {Boolean} pinned true if the panel is pinned */ , pinned: true /** * @event animationcompleted * Fires when animation is completed * @param {Ext.ux.InfoPanel} this */ , animationcompleted: true /** * @event boxchange * Fires when the panel is resized * @param {Ext.ux.InfoPanel} this * @param {Object} box */ , boxchange: true /** * @event redize * Fires when info panel is resized * @param {Ext.ux.InfoPanel} this * @param {Integer} width New width * @param {Integer} height New height */ , resize: true /** * @event destroy * Fires after the panel is destroyed * @param {Ext.ux.InfoPanel} this */ , destroy: true }); // }}} // {{{ // setup dragging, resizing, and shadow this.setDraggable(this.draggable); this.setResizable(!this.collapsed); this.setShadow(this.useShadow); // }}} this.el.setStyle('z-index', this.zindex); this.updateVisuals(); this.id = this.id || this.el.id; }; // end of constructor // extend Ext.extend(Ext.ux.InfoPanel, Ext.ContentPanel, { // {{{ // defaults adjustments: [0,0] , collapsible: true , collapsed: true , collapseOnUnpin: true , pinned: false , trigger: 'title' , animate: undefined , duration: 0.35 , draggable: undefined , resizable: undefined , docked: false , useShadow: undefined , bodyClass: 'x-dock-panel-body' , panelClass: 'x-dock-panel' , shadowMode: 'sides' , dragPadding: { left:8 , right:16 , top:0 , bottom:8 } , lastWidth: 0 , lastHeight: 0 , minWidth: 0 , maxWidth: 9999 , minHeight: 50 , maxHeight: 9999 , autoScroll: false , fixedHeight: undefined , zindex: 10000 // }}} // {{{ /** * Called internally to create collapse button * Calls utility method of Ext.LayoutRegion createTool * @param {Element/HTMLElement/String} parentEl element to create the tool in * @param {String} className class of the tool */ , createTool : function(parentEl, className){ return Ext.LayoutRegion.prototype.createTool(parentEl, className); } // }}} // {{{ /** * Set title of the InfoPanel * @param {String} title Title to set * @return {Ext.ux.InfoPanel} this */ , setTitle: function(title) { this.title = title; this.titleTextEl.update(title); this.setIcon(); return this; } // }}} // {{{ /** * Set the icon to display in title * @param {String} iconPath path to use for src property of icon img */ , setIcon: function(iconPath) { iconPath = iconPath || (this.collapsed ? this.collapsedIcon : this.expandedIcon) || this.icon; if(iconPath) { this.iconImg.dom.src = iconPath; } else { this.iconImg.dom.src = Ext.BLANK_IMAGE_URL; } } // }}} // {{{ /** * Assigns menu to title icon * @param {Ext.menu.Menu} menu menu to assign */ , setIconMenu: function(menu) { if(this.iconMenu) { this.iconImg.removeAllListeners(); } menu.panel = this; this.iconImg.on({ click: { scope: this , fn: function(e, target) { e.stopEvent(); menu.showAt(e.xy); }} }); this.iconMenu = menu; } // }}} // {{{ /** * private - title menu click handler * @param {Ext.Event} e event * @param {Element} target target */ , onTitleMenu: function(e, target) { e.stopEvent(); e.preventDefault(); this.titleMenu.showAt(e.xy); } // }}} // {{{ /** * Assigns context menu (right click) to the title * @param {Ext.menu.Menu} menu menu to assign */ , setTitleMenu: function(menu) { if(this.titleMenu) { this.titleEl.un('contextmenu', this.onTitleMenu, this); } menu.panel = this; this.titleEl.on('contextmenu', this.onTitleMenu, this); this.titleMenu = menu; } // }}} // {{{ /** * Get current title * @return {String} Current title */ , getTitle: function() { return this.title; } // }}} // {{{ /** * Returns body element * This overrides the ContentPanel getEl for convenient access to the body element * @return {Element} this.body */ , getEl: function() { return this.body; } // }}} // {{{ /** * Returns title height * @return {Integer} title height */ , getTitleHeight: function() { return this.titleEl.getComputedHeight(); } // }}} // {{{ /** * Returns body height * @return {Integer} body height */ , getBodyHeight: function() { return this.body.getComputedHeight(); } // }}} // {{{ /** * Returns panel height * @return {Integer} panel height */ , getHeight: function() { return this.getBodyHeight() + this.getTitleHeight(); } // }}} // {{{ /** * Returns body client height * @return {Integer} body client height */ , getBodyClientHeight: function() { return this.body.getHeight(true); } // }}} // {{{ /** * Update the innerHTML of this element, optionally searching for and processing scripts * @param {String} html The new HTML * @param {Boolean} loadScripts (optional) true to look for and process scripts * @param {Function} callback For async script loading you can be noticed when the update completes * @return {Ext.Element} this */ , update: function(html, loadScripts, callback) { this.body.update(html, loadScripts, callback); return this; } // }}} // {{{ /** * Updates this panel's element * @param {String} content The new content * @param {Boolean} loadScripts (optional) true to look for and process scripts */ , setContent: function(content, loadScripts) { this.body.update(content, loadScripts); } // }}} // {{{ /** * Get the {@link Ext.UpdateManager} for this panel. Enables you to perform Ajax updates. * @return {Ext.UpdateManager} The UpdateManager */ , getUpdateManager: function() { return this.body.getUpdateManager(); } // }}} // {{{ /** * The only required property is url. The optional properties nocache, text and scripts * are shorthand for disableCaching, indicatorText and loadScripts and are used to set their associated property on this panel UpdateManager instance. * @param {String/Object} params (optional) The parameters to pass as either a url encoded string "param1=1&amp;param2=2" or an object {param1: 1, param2: 2} * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess, oResponse) * @param {Boolean} discardUrl (optional) By default when you execute an update the defaultUrl is changed to the last used url. If true, it will not store the url. * @return {Ext.ContentPanel} this */ , load: function() { var um = this.getUpdateManager(); um.update.apply(um, arguments); return this; } // }}} // {{{ /** * Set a URL to be used to load the content for this panel. When this panel is activated, the content will be loaded from that URL. * @param {String/Function} url The url to load the content from or a function to call to get the url * @param {String/Object} params (optional) The string params for the update call or an object of the params. See {@link Ext.UpdateManager#update} for more details. (Defaults to null) * @param {Boolean} loadOnce (optional) Whether to only load the content once. If this is false it makes the Ajax call every time this panel is activated. (Defaults to false) * @return {Ext.UpdateManager} The UpdateManager */ , setUrl: function(url, params, loadOnce) { if(this.refreshDelegate){ this.removeListener("expand", this.refreshDelegate); } this.refreshDelegate = this._handleRefresh.createDelegate(this, [url, params, loadOnce]); this.on("expand", this.refreshDelegate); this.on({ beforeexpand: { scope: this , single: this.loadOnce ? true : false , fn: function() { this.body.update(''); }} }); return this.getUpdateManager(); } // }}} // {{{ , _handleRefresh: function(url, params, loadOnce) { var updater; if(!loadOnce || !this.loaded){ updater = this.getUpdateManager(); updater.on({ update: { scope: this , single: true , fn: function() { if(true === this.useShadow && this.shadow) { this.shadow.show(this.el); } }} }); updater.update(url, params, this._setLoaded.createDelegate(this)); } } // }}} // {{{ , _setLoaded: function() { this.loaded = true; } // }}} // {{{ /** * Force a content refresh from the URL specified in the setUrl() method. * Will fail silently if the setUrl method has not been called. * This does not activate the panel, just updates its content. */ , refresh: function() { if(this.refreshDelegate){ this.loaded = false; this.refreshDelegate(); } } // }}} // {{{ /** * Expands the panel * @param {Boolean} skipAnimation Set to true to skip animation * @return {Ext.ux.InfoPanel} this */ , expand: function(skipAnimation) { // do nothing if already expanded if(!this.collapsed) { return this; } // fire beforeexpand event if(false === this.fireEvent('beforeexpand', this)) { return this; } if(Ext.isGecko) { this.autoScrolls = this.body.select('{overflow=auto}'); this.autoScrolls.setStyle('overflow', 'hidden'); } // reset collapsed flag this.collapsed = false; this.autoSize(); // hide shadow if(!this.docked) { this.setShadow(false); } // enable resizing if(this.resizer && !this.docked) { this.setResizable(true); } if(Ext.isIE) { this.body.setWidth(this.el.getWidth()); } // animate expand if(true === this.animate && true !== skipAnimation) { this.body.slideIn('t', { easing: this.easingExpand || null , scope: this , duration: this.duration , callback: this.updateVisuals }); } // don't animate, just show else { this.body.show(); this.updateVisuals(); this.fireEvent('animationcompleted', this); } // fire expand event this.fireEvent('expand', this); return this; } // }}} // {{{ /** * Toggles the expanded/collapsed states * @param {Boolean} skipAnimation Set to true to skip animation * @return {Ext.ux.InfoPanel} this */ , toggle: function(skipAnimation) { if(this.collapsed) { this.expand(skipAnimation); } else { this.collapse(skipAnimation); } return this; } // }}} // {{{ /** * Collapses the panel * @param {Boolean} skipAnimation Set to true to skip animation * @return {Ext.ux.InfoPanel} this */ , collapse: function(skipAnimation) { // do nothing if already collapsed or pinned if(this.collapsed || this.pinned) { return this; } // fire beforecollapse event if(false === this.fireEvent('beforecollapse', this)) { return this; } if(Ext.isGecko) { this.autoScrolls = this.body.select('{overflow=auto}'); this.autoScrolls.setStyle('overflow', 'hidden'); } if(this.bodyScroll /*&& !Ext.isIE*/) { this.scrollEl.setStyle('overflow','hidden'); } // set collapsed flag this.collapsed = true; // hide shadow this.setShadow(false); // disable resizing of collapsed panel if(this.resizer) { this.setResizable(false); } // animate collapse if(true === this.animate && true !== skipAnimation) { this.body.slideOut('t', { easing: this.easingCollapse || null , scope: this , duration: this.duration , callback: this.updateVisuals }); } // don't animate, just hide else { this.body.hide(); this.updateVisuals(); this.fireEvent('animationcompleted', this); } // fire collapse event this.fireEvent('collapse', this); return this; } // }}} // {{{ /** * Called internally to update class of the collapse button * as part of expand and collapse methods * * @return {Ext.ux.InfoPanel} this */ , updateVisuals: function() { // handle collapsed state if(this.collapsed) { if(this.showPin) { if(this.collapseBtn) { this.collapseBtn.show(); } if(this.stickBtn) { this.stickBtn.hide(); } } if(this.collapseBtn) { Ext.fly(this.collapseBtn.dom.firstChild).replaceClass( 'x-layout-collapse-south', 'x-layout-collapse-east' ); } this.body.replaceClass('x-dock-panel-body-expanded', 'x-dock-panel-body-collapsed'); this.titleEl.replaceClass('x-dock-panel-title-expanded', 'x-dock-panel-title-collapsed'); } // handle expanded state else { if(this.showPin) { if(this.pinned) { if(this.stickBtn) { Ext.fly(this.stickBtn.dom.firstChild).replaceClass('x-layout-stick', 'x-layout-stuck'); } this.titleEl.addClass('x-dock-panel-title-pinned'); } else { if(this.stickBtn) { Ext.fly(this.stickBtn.dom.firstChild).replaceClass('x-layout-stuck', 'x-layout-stick'); } this.titleEl.removeClass('x-dock-panel-title-pinned'); } if(this.collapseBtn) { this.collapseBtn.hide(); } if(this.stickBtn) { this.stickBtn.show(); } } else { if(this.collapseBtn) { Ext.fly(this.collapseBtn.dom.firstChild).replaceClass( 'x-layout-collapse-east', 'x-layout-collapse-south' ); } } this.body.replaceClass('x-dock-panel-body-collapsed', 'x-dock-panel-body-expanded'); this.titleEl.replaceClass('x-dock-panel-title-collapsed', 'x-dock-panel-title-expanded'); } // show shadow if necessary if(!this.docked) { this.setShadow(true); } if(this.autoScrolls) { this.autoScrolls.setStyle('overflow', 'auto'); } this.setIcon(); if(this.bodyScroll && !this.docked && !this.collapsed /*&& !Ext.isIE*/) { this.scrollEl.setStyle('overflow', 'auto'); } this.constrainToDesktop(); // fire animationcompleted event this.fireEvent('animationcompleted', this); // clear visibility style of body's children var kids = this.body.select('div[className!=x-grid-viewport],input{visibility}'); kids.setStyle.defer(1, kids, ['visibility','']); // restore body overflow if(this.bodyScroll && !this.collapsed /*&& !Ext.isIE*/) { this.setHeight(this.getHeight()); this.scrollEl.setStyle('overflow','auto'); } return this; } // }}} // {{{ /** * Creates toolbar * @param {Array} config Configuration for Ext.Toolbar * @param {Boolean} bottom true to create bottom toolbar. (defaults to false = top toolbar) * @return {Ext.Toolbar} Ext.Toolbar object */ , createToolbar: function(config, bottom) { // we need clean body this.body.clean(); // copy body to new container this.scrollEl = Ext.DomHelper.append(document.body, {tag:'div'}, true); var el; while(el = this.body.down('*')) { this.scrollEl.appendChild(el); } if(this.bodyScroll) { this.body.setStyle('overflow', ''); if(!this.collapsed) { this.scrollEl.setStyle('overflow', 'auto'); } } var create = {tag:'div'}, tbEl; config = config || null; if(bottom) { this.body.appendChild(this.scrollEl); tbEl = Ext.DomHelper.append(this.body, create, true); tbEl.addClass('x-dock-panel-toolbar-bottom'); } else { tbEl = Ext.DomHelper.insertFirst(this.body, create, true); tbEl.addClass('x-dock-panel-toolbar'); this.body.appendChild(this.scrollEl); } this.toolbar = new Ext.Toolbar(tbEl, config); this.setHeight(this.getHeight()); return this.toolbar; } // }}} // {{{ /** * Set the panel draggable * Uses lazy creation of dd object * @param {Boolean} enable pass false to disable dragging * @return {Ext.ux.InfoPanel} this */ , setDraggable: function(enable) { if(true !== this.draggable) { return this; } // lazy create proxy var dragTitleEl; if(!this.proxy) { this.proxy = this.el.createProxy('x-dlg-proxy'); // setup title dragTitleEl = Ext.DomHelper.append(this.proxy, {tag:'div'}, true); dragTitleEl.update(this.el.dom.firstChild.innerHTML); dragTitleEl.dom.className = this.el.dom.firstChild.className; if(this.collapsed && Ext.isIE) { dragTitleEl.dom.style.borderBottom = "0"; } this.proxy.hide(); this.proxy.setOpacity(0.5); this.dd = new Ext.dd.DDProxy(this.el.dom, 'PanelDrag', { dragElId: this.proxy.id , scroll: false }); this.dd.scroll = false; this.dd.afterDrag = function() { this.panel.moveToViewport(); if(this.panel && this.panel.shadow && !this.panel.docked) { this.panel.shadow.show(this.panel.el); } }; this.constrainToDesktop(); Ext.EventManager.onWindowResize(this.moveToViewport, this); } this.dd.panel = this; this.dd.setHandleElId(this.titleEl.id); if(false === enable) { this.dd.lock(); } else { this.dd.unlock(); } return this; } // }}} // {{{ /** * Set the panel resizable * Uses lazy creation of the resizer object * @param {Boolean} pass false to disable resizing * @return {Ext.ux.InfoPanel} this */ , setResizable: function(enable) { if(true !== this.resizable) { return this; } // {{{ // lazy create resizer if(!this.resizer) { // {{{ // create resizer this.resizer = new Ext.Resizable(this.el, { handles: 's w e sw se' , minWidth: this.minWidth || this.tm.getWidth(this.getTitle()) + 56 || 48 , maxWidth: this.maxWidth , minHeight: this.minHeight , maxHeight: this.maxHeight , transparent: true , draggable: false }); // }}} // {{{ // install event handlers this.resizer.on({ beforeresize: { scope:this , fn: function(resizer, e) { var viewport = this.getViewport(); var box = this.getBox(); var pos = resizer.activeHandle.position; // left constraint if(pos.match(/west/)) { resizer.minX = viewport.x + (this.dragPadding.left || 8); } // down constraint var maxH; if(pos.match(/south/)) { resizer.oldMaxHeight = resizer.maxHeight; maxH = viewport.y + viewport.height - box.y - (this.dragPadding.bottom || 8); resizer.maxHeight = maxH < resizer.maxHeight ? maxH : resizer.maxHeight; } // right constraint var maxW; if(pos.match(/east/)) { resizer.oldMaxWidth = resizer.maxWidth; maxW = viewport.x + viewport.width - box.x - (this.dragPadding.right || 10); resizer.maxWidth = maxW < resizer.maxWidth ? maxW : resizer.maxWidth; } }} , resize: { scope: this , fn: function(resizer, width, height, e) { resizer.maxHeight = resizer.oldMaxHeight || resizer.maxHeight; resizer.maxWidth = resizer.oldMaxWidth || resizer.maxWidth; this.setSize(width, height); this.constrainToDesktop(); this.fireEvent('boxchange', this, this.el.getBox()); this.fireEvent('resize', this, width, height); this.lastHeight = height; this.lastWidth = width; }} }); // }}} } // }}} this.resizer.enabled = enable; // this is custom override of Ext.Resizer this.resizer.showHandles(enable); return this; } // }}} // {{{ /** * Called internally to clip passed width and height to viewport * @param {Integer} w width * @param {Integer} h height * @return {Object} {width:safeWidth, height:safeHeight} */ , safeSize: function(w, h) { var viewport = this.getViewport(); var box = this.getBox(); var gap = 0; var safeSize = {width:w, height:h}; safeSize.height = box.y + h + this.dragPadding.bottom + gap > viewport.height + viewport.y ? viewport.height - box.y + viewport.y - this.dragPadding.bottom - gap : safeSize.height ; safeSize.width = box.x + w + this.dragPadding.right + gap > viewport.width + viewport.x ? viewport.width - box.x + viewport.x - this.dragPadding.right - gap : safeSize.width ; return safeSize; } // }}} // {{{ /** * Called internally to get current viewport * @param {Element/HTMLElement/String} desktop Element to get size and position of * @return {Object} viewport {x:x, y:y, width:width, height:height} x and y are page coords */ , getViewport: function(desktop) { desktop = desktop || this.desktop || document.body; var viewport = Ext.get(desktop).getViewSize(); var xy; if(document.body === desktop.dom) { viewport.x = 0; viewport.y = 0; } else { xy = desktop.getXY(); viewport.x = isNaN(xy[0]) ? 0 : xy[0]; viewport.y = isNaN(xy[1]) ? 0 : xy[1]; } return viewport; } // }}} // {{{ /** * Sets the size of the panel. Demanded size is clipped to the viewport * * @param {Integer} w width to set * @param {Integer} h height to set * @return {Ext.ux.InfoPanel} this */ , setSize: function(w, h) { var safeSize = this.safeSize(w, h); this.setWidth(safeSize.width); this.setHeight(safeSize.height); if(Ext.isIE) { this.body.setWidth(safeSize.width); } if(!this.docked) { this.setShadow(true); } } // }}} // {{{ /** * Sets the width of the panel. Demanded width is clipped to the viewport * * @param {Integer} w width to set * @return {Ext.ux.InfoPanel} this */ , setWidth: function(w) { this.el.setWidth(w); this.body.setStyle('width',''); if(!this.docked) { this.setShadow(true); } this.lastWidth = w; return this; } // }}} // {{{ /** * Sets the height of the panel. Demanded height is clipped to the viewport * * @param {Integer} h height to set * @return {Ext.ux.InfoPanel} this */ , setHeight: function(h) { var newH = h - this.getTitleHeight(); var scrollH = newH; if(1 < newH) { if(this.scrollEl !== this.body) { scrollH -= this.toolbar ? this.toolbar.getEl().getHeight() : 0; // scrollH -= 27; scrollH -= this.adjustments[1] || 0; this.scrollEl.setHeight(scrollH); } this.body.setHeight(newH); } else { this.body.setStyle('height',''); } if(!this.docked) { this.setShadow(true); } // this.lastHeight = h; this.el.setStyle('height',''); return this; } // }}} // {{{ /** * Called internally to set x, y, width and height of the panel * * @param {Object} box * @return {Ext.ux.InfoPanel} this */ , setBox: function(box) { this.el.setBox(box); this.moveToViewport(); this.setSize(box.width, box.height); return this; } // }}} // {{{ /** * Called internally to get the box of the panel * * @return {Object} box */ , getBox: function() { return this.el.getBox(); } // }}} // {{{ , autoSize: function() { var width = 0; var height = this.fixedHeight || 0; var dock = this.dock; // docked if(this.docked && this.dock) { if(dock.fitHeight) { height = dock.getPanelBodyHeight() + this.getTitleHeight(); } } // undocked else { // height logic height = this.lastHeight || this.fixedHeight || 0; height = height < this.maxHeight ? height : (this.maxHeight < 9999 ? this.maxHeight : 0); height = (height && height < this.minHeight ) ? this.minHeight : height; this.lastHeight = height ? height : this.lastHeight; } this.setHeight(height); } // }}} // {{{ /** * Turns shadow on/off * Uses lazy creation of the shadow object * @param {Boolean} shadow pass false to hide, true to show the shadow * @return {Ext.ux.InfoPanel} this */ , setShadow: function(shadow) { // if I have shadow but shouldn't use it if(this.shadow && true !== this.useShadow) { this.shadow.hide(); return this; } // if I shouldn't use shadow if(true !== this.useShadow) { return this; } // if I don't have shadow if(!this.shadow) { this.shadow = new Ext.Shadow({mode:this.shadowMode}); } // show or hide var zindex; if(shadow) { this.shadow.show(this.el); // fix the Ext shadow z-index bug zindex = parseInt(this.el.getStyle('z-index'), 10); zindex = isNaN(zindex) ? '' : zindex - 1; this.shadow.el.setStyle('z-index', zindex); } else { this.shadow.hide(); } return this; } // }}} // {{{ /** * Show the panel * @param {Boolean} show (optional) if false hides the panel instead of show * @param {Boolean} alsoUndocked show/hide also undocked panel (defaults to false) * @return {Ext.ux.InfoPanel} this */ , show: function(show, alsoUndocked) { // ignore undocked panels if not forced to if(!this.docked && true !== alsoUndocked) { return this; } show = (false === show ? false : true); if(!this.docked) { this.setShadow(show); } this.el.setStyle('display', show ? '' : 'none'); return this; } // }}} // {{{ /** * Hide the panel * @param {Boolean} alsoUndocked show/hide also undocked panel (defaults to false) * @return {Ext.ux.InfoPanel} this */ , hide: function(alsoUndocked) { this.show(false, alsoUndocked); } // }}} // {{{ /** * Constrains dragging of this panel to desktop boundaries * @param {Element} desktop the panel is to be constrained to * @return {Ext.ux.InfoPanel} this */ , constrainToDesktop: function(desktop) { desktop = desktop || this.desktop; if(desktop && this.dd) { this.dd.constrainTo(desktop, this.dragPadding, false); } return this; } // }}} // {{{ /** * Called internally to move the panel to the viewport. * Also constrains the dragging to the desktop * * @param {Object} viewport (optional) object {x:x, y:y, width:width, height:height} * @return {Ext.ux.InfoPanel} this */ , moveToViewport: function(viewport) { viewport = viewport && !isNaN(viewport.x) ? viewport : this.getViewport(); var box = this.getBox(); var moved = false; var gap = 10; // horizontal if(box.x + box.width + this.dragPadding.right > viewport.x + viewport.width) { moved = true; box.x = viewport.width + viewport.x - box.width - this.dragPadding.right - gap; } if(box.x - this.dragPadding.left < viewport.x) { moved = true; box.x = viewport.x + this.dragPadding.left + gap; } // vertical if(box.y + box.height + this.dragPadding.bottom > viewport.y + viewport.height) { moved = true; box.y = viewport.height + viewport.y - box.height - this.dragPadding.bottom - gap; } if(box.y - this.dragPadding.top < viewport.y) { moved = true; box.y = viewport.y + this.dragPadding.top + gap; } var oldOverflow; if(moved) { // sanity clip box.x = box.x < viewport.x ? viewport.x : box.x; box.y = box.y < viewport.y ? viewport.y : box.y; // prevent scrollbars from appearing this.desktop.oldOverflow = this.desktop.oldOverflow || this.desktop.getStyle('overflow'); this.desktop.setStyle('overflow', 'hidden'); // set position this.el.setXY([box.x, box.y]); // restore overflow this.desktop.setStyle.defer(100, this.desktop, ['overflow', this.desktop.oldOverflow]); if(!this.docked) { this.setShadow(true); } } this.constrainToDesktop(); return this; } // }}} // {{{ /** * destroys the panel */ , destroy: function() { if(this.shadow) { this.shadow.hide(); } if(this.collapsible) { this.collapseBtn.removeAllListeners(); this.titleEl.removeAllListeners(); } if(this.resizer) { this.resizer.destroy(); } if(this.dd) { if(this.proxy) { this.proxy.removeAllListeners(); this.proxy.remove(); } this.dd.unreg(); this.dd = null; } if(this.dock) { this.dock.detach(this); } this.body.removeAllListeners(); // call parent destroy Ext.ux.InfoPanel.superclass.destroy.call(this); this.fireEvent('destroy', this); } // }}} }); // end of extend // {{{ // show/hide resizer handles override Ext.override(Ext.Resizable, { /** * Hide resizer handles */ hideHandles: function() { this.showHandles(false); } // end of function hideHandles /** * Show resizer handles * * @param {Boolean} show (true = show, false = hide) */ , showHandles: function(show) { show = (false === show ? false : true); var pos; for(var p in Ext.Resizable.positions) { pos = Ext.Resizable.positions[p]; if(this[pos]) { this[pos].el.setStyle('display', show ? '' : 'none'); } } } // end of function showHandles // }}} }); // end of file
JavaScript
// vim: ts=2:sw=2:nu:fdc=4:nospell // Create user extensions namespace (Ext.ux) Ext.namespace('Ext.ux'); /** * Ext.ux.Accordion Extension Class * * @author Ing. Jozef Sakalos * @version $Id: Ext.ux.Accordion.js 152 2007-08-21 17:46:03Z jozo $ * * @class Ext.ux.Accordion * @extends Ext.ContentPanel * @constructor * @param {String/HTMLElement/Element} el The container element for this panel * @param {String/Object} config A string to set only the title or a config object * @cfg {Boolean} animate global animation flag for all panels. (defaults to true) * @cfg {Boolean} boxWrap set to true to wrap wrapEl the body is child of (defaults to false) * @cfg {Boolean} draggable set to false to disallow panels dragging (defaults to true) * @cfg {Boolean} fitHeight set to true if you use fixed height dock * @cfg {Boolean} forceOrder set to true if to disable reordering of panels (defaults to false) * @cfg {Boolean} independent true to make panels independent (defaults to false) * @cfg {Integer} initialHeight Initial height to set box to (defaults to 0) * @cfg {Boolean} keepState Set to false to exclude this accordion from state management (defaults to true) * @cfg {Boolean} monitorWindowResize if true panels are moved to * viewport if window is small (defaults to true) * @cfg {Boolean} resizable global resizable flag for all panels (defaults to true) * @cfg {Boolean} undockable true to allow undocking of panels (defaults to true) * @cfg {Boolean} useShadow global useShadow flag for all panels. (defaults to true) * @cfg {Element/HTMLElement/String} wrapEl Element to wrap with nice surrounding */ Ext.ux.Accordion = function(el, config) { // call parent constructor Ext.ux.Accordion.superclass.constructor.call(this, el, config); // create collection for panels this.items = new Ext.util.MixedCollection(); // assume no panel is expanded this.expanded = null; // {{{ // install event handlers this.on({ // {{{ // runs before expansion. Triggered by panel's beforeexpand event beforeexpand: { scope: this , fn: function(panel) { // raise panel above others if(!panel.docked) { this.raise(panel); } // set fixed height panel.autoSize(); // var panelBodyHeight; // if(this.fitHeight && panel.docked) { // panelBodyHeight = this.getPanelBodyHeight(); // if(panelBodyHeight) { // panel.body.setHeight(panelBodyHeight); // } // } if(panel.docked) { this.expandCount++; this.expanding = true; // this.setDockScroll(false); } // don't collapse others if independent or not docked if(this.independent || !panel.docked) { return this; } // collapse expanded panel if(this.expanded && this.expanded.docked) { this.expanded.collapse(); } // remember this panel as expanded this.expanded = panel; }} // }}} // {{{ // runs before panel collapses. Triggered by panel's beforecollapse event , beforecollapse: { scope: this , fn: function(panel) { // raise panel if not docked if(!panel.docked) { this.raise(panel); } return this; }} // }}} // {{{ // runs on when panel expands (before animation). Triggered by panel's expand event , expand: { scope: this , fn: function(panel) { if(this.hideOtherOnExpand) { this.hideOther(panel); } this.fireEvent('panelexpand', panel); }} // }}} // {{{ // runs on when panel collapses (before animation). Triggered by panel's collapse event , collapse: { scope: this , fn: function(panel) { this.fireEvent('panelcollapse', panel); }} // }}} // {{{ // runs on when animation is completed. Triggered by panel's animationcompleted event , animationcompleted: { scope: this , fn: function(panel) { var box = panel.el.getBox(); this.expandCount = (this.expandCount && this.expanding) ? --this.expandCount : 0; if((0 === this.expandCount) && this.expanding) { // this.setDockScroll(true); this.expanding = false; } if(this.hideOtherOnExpand) { if(panel.collapsed && panel.docked) { this.showOther(panel); } // else if(panel.docked) { // this.hideOther(panel); // } } // this.fireEvent('panelbox', panel, box); }} // }}} // {{{ // runs when panel is pinned. Triggered by panel's pinned event , pinned: { scope: this , fn: function(panel, pinned) { if(!pinned) { if(panel.collapseOnUnpin) { panel.collapse(); } else if(!this.independent) { this.items.each(function(p) { if(p !== panel && p.docked && !p.pinned) { p.collapse(); } }); this.expanded = panel; } } if(this.hideOtherOnExpand) { if(panel.docked && pinned) { this.showOther(panel); } } this.fireEvent('panelpinned', panel, pinned); }} // }}} , destroy: { scope:this , fn: function(panel) { this.items.removeKey(panel.id); this.updateOrder(); }} }); // }}} // {{{ // add events this.addEvents({ /** * Fires when a panel of the dock is collapsed * @event panelcollapse * @param {Ext.ux.InfoPanel} panel */ panelcollapse: true /** * Fires when a panel of the dock is expanded * @event panelexpand * @param {Ext.ux.InfoPanel} panel */ , panelexpand: true /** * Fires when a panel of the dock is pinned * @event panelpinned * @param {Ext.ux.InfoPanel} panel * @param {Boolean} pinned true if panel was pinned false if unpinned */ , panelpinned: true /** * Fires when the independent state of dock changes * @event independent * @param {Ext.ux.Accordion} this * @param {Boolean} independent New independent state */ , independent: true /** * Fires when the order of panel is changed * @event orderchange * @param {Ext.ux.Accordion} this * @param {Array} order New order array */ , orderchange: true /** * Fires when the undockable state of dock changes * @event undockable * @param {Ext.ux.Accordion} this * @param {Array} undockable New undockable state */ , undockable: true /** * Fires when a panel is undocked * @event panelundock * @param {Ext.ux.InfoPanel} panel * @param {Object} box Position and size object */ , panelundock: true /** * Fires when a panel is undocked * @event paneldock * @param {Ext.ux.InfoPanel} panel */ , paneldock: true /** * Fires when a panel box is changed, e.g. after dragging * @event panelbox * @param {Ext.ux.InfoPanel} panel * @param {Object} box Position and size object */ , panelbox: true /** * Fires when useShadow status changes * @event useshadow * @param {Ext.ux.Accordion} this * @param {Boolean} shadow Use shadow (for undocked panels) flag */ , useshadow: true /** * Fires before the panel is detached from this accordion. Return false to cancel the detach * @event beforedetach * @param {Ext.ux.Accordion} this * @param {Ext.ux.InfoPanel} panel being detached */ , beforedetach: true /** * Fires after the panel has been detached from this accordion * @event detach * @param {Ext.ux.Accordion} this * @param {Ext.ux.InfoPanel} panel detached panel */ , detach: true /** * Fires before the panel is attached from this accordion. Return false to cancel the attach * @event beforeattach * @param {Ext.ux.Accordion} this * @param {Ext.ux.InfoPanel} panel being attached */ , beforeattach: true /** * Fires after the panel is attached to this accordion * @event attach * @param {Ext.ux.Accordion} this * @param {Ext.ux.InfoPanel} panel attached panel */ , attach: true }); // }}} // setup body this.body = Ext.get(this.body) || this.el; this.resizeEl = this.body; this.id = this.id || this.body.id; this.body.addClass('x-dock-body'); // setup desktop this.desktop = Ext.get(this.desktop || document.body); //this.desktop = this.desktop.dom || this.desktop; // setup fixed hight this.wrapEl = Ext.get(this.wrapEl); if(this.fitHeight) { this.body.setStyle('overflow', 'hidden'); // this.bodyHeight = this.initialHeight || this.body.getHeight(); this.body.setHeight(this.initialHeight || this.body.getHeight()); if(this.boxWrap && this.wrapEl) { this.wrapEl.boxWrap(); } } // watch window resize if(this.monitorWindowResize) { Ext.EventManager.onWindowResize(this.adjustViewport, this); } // create drop zone for panels this.dd = new Ext.dd.DropZone(this.body.dom, { ddGroup: this.ddGroup || 'dock-' + this.id }); Ext.ux.AccordionManager.add(this); }; // end of constructor // extend Ext.extend(Ext.ux.Accordion, Ext.ContentPanel, { // {{{ // defaults independent: false , undockable: true , useShadow: true , boxWrap: false , fitHeight: false , initialHeight: 0 , animate: true // global animation flag , expandCount: 0 , expanding: false , monitorWindowResize: true , resizable: true // global resizable flag , draggable: true // global draggable flag , forceOrder: false , keepState: true , hideOtherOnExpand: false // }}} // {{{ /** * Adds the panel to Accordion * @param {Ext.ux.InfoPanel} panel Panel to add * @return {Ext.ux.InfoPanel} added panel */ , add: function(panel) { // append panel to body this.body.appendChild(panel.el); this.attach(panel); // panel dragging if(undefined === panel.draggable && this.draggable) { panel.draggable = true; panel.dd = new Ext.ux.Accordion.DDDock(panel, this.ddGroup || 'dock-' + this.id, this); } // panel resizing if(undefined === panel.resizable && this.resizable) { panel.resizable = true; // panel.setResizable(true); } // panel shadow panel.useShadow = undefined === panel.useShadow ? this.useShadow : panel.useShadow; panel.setShadow(panel.useShadow); if(panel.shadow) { panel.shadow.hide(); } // panel animation panel.animate = undefined === panel.animate ? this.animate : panel.animate; // z-index for panel panel.zindex = Ext.ux.AccordionManager.getNextZindex(); panel.docked = true; panel.desktop = this.desktop; if(false === panel.collapsed) { panel.collapsed = true; panel.expand(true); } return panel; } // }}} // {{{ /** * attach panel to this accordion * @param {Ext.ux.InfoPanel} panel panel to attach * @return {Ext.ux.Accordion} this */ , attach: function(panel) { // fire beforeattach event if(false === this.fireEvent('beforeattach', this, panel)) { return this; } // add panel to items this.items.add(panel.id, panel); // install event handlers this.installRelays(panel); panel.bodyClickDelegate = this.onClickPanelBody.createDelegate(this, [panel]); panel.body.on('click', panel.bodyClickDelegate); // set panel dock panel.dock = this; // add docked class to panel body panel.body.replaceClass('x-dock-panel-body-undocked', 'x-dock-panel-body-docked'); // repair panel height panel.autoSize(); if(this.fitHeight) { this.setPanelHeight(panel); } // fire attach event this.fireEvent('attach', this, panel); return this; } // }}} // {{{ /** * detach panel from this accordion * @param {Ext.ux.InfoPanel} panel to detach * @return {Ext.ux.Accordion} this */ , detach: function(panel) { // fire beforedetach event if(false === this.fireEvent('beforedetach', this, panel)) { return this; } // unhook events from panel this.removeRelays(panel); panel.body.un('click', panel.bodyClickDelegate); // remove panel from items this.items.remove(panel); panel.dock = null; // remove docked class from panel body panel.body.replaceClass('x-dock-panel-body-docked', 'x-dock-panel-body-undocked'); // repair expanded property if(this.expanded === panel) { this.expanded = null; } // repair panel height panel.autoSize(); if(this.fitHeight) { this.setPanelHeight(); } // fire detach event this.fireEvent('detach', this, panel); return this; } // }}} // {{{ /** * Called internally to raise panel above others * @param {Ext.ux.InfoPanel} panel Panel to raise * @return {Ext.ux.InfoPanel} panel Panel that has been raised */ , raise: function(panel) { return Ext.ux.AccordionManager.raise(panel); } // }}} // {{{ /** * Resets the order of panels within the dock * * @return {Ext.ux.Accordion} this */ , resetOrder: function() { this.items.each(function(panel) { if(!panel.docked) { return; } this.body.appendChild(panel.el); }, this); this.updateOrder(); return this; } // }}} // {{{ /** * Called internally to update the order variable after dragging */ , updateOrder: function() { var order = []; var titles = this.body.select('div.x-layout-panel-hd'); titles.each(function(titleEl) { order.push(titleEl.dom.parentNode.id); }); this.order = order; this.fireEvent('orderchange', this, order); } // }}} // {{{ /** * Returns array of panel ids in the current order * @return {Array} order of panels */ , getOrder: function() { return this.order; } // }}} // {{{ /** * Set the order of panels * @param {Array} order Array of ids of panels in required order. * @return {Ext.ux.Accordion} this */ , setOrder: function(order) { if('object' !== typeof order || undefined === order.length) { throw "setOrder: Argument is not array."; } var panelEl, dock, panelId, panel; for(var i = 0; i < order.length; i++) { panelId = order[i]; dock = Ext.ux.AccordionManager.get(panelId); if(dock && dock !== this) { panel = dock.items.get(panelId); dock.detach(panel); this.attach(panel); } panelEl = Ext.get(panelId); if(panelEl) { this.body.appendChild(panelEl); } } this.updateOrder(); return this; } // }}} // {{{ /** * Collapse all docked panels * @param {Boolean} alsoPinned true to first unpin then collapse * @param {Ext.ux.InfoPanel} except This panel will not be collapsed. * @return {Ext.ux.Accordion} this */ , collapseAll: function(alsoPinned, except) { this.items.each(function(panel) { if(panel.docked) { panel.pinned = alsoPinned ? false : panel.pinned; if(!except || panel !== except) { panel.collapse(); } } }, this); return this; } // }}} // {{{ /** * Expand all docked panels in independent mode * @return {Ext.ux.Accordion} this */ , expandAll: function() { if(this.independent) { this.items.each(function(panel) { if(panel.docked && panel.collapsed) { panel.expand(); } }, this); } } // }}} // {{{ /** * Called internally while dragging and by state manager * @param {Ext.ux.InfoPanel/String} panel Panel object or id of the panel * @box {Object} box coordinates with target position and size * @return {Ext.ux.Accordion} this */ , undock: function(panel, box) { // get panel if necessary panel = 'string' === typeof panel ? this.items.get(panel) : panel; // proceed only if we have docked panel and in undockable mode if(panel && panel.docked && this.undockable) { // sanity check if(box.x < 0 || box.y < 0) { return this; } // todo: check this // if(panel.collapsed) { // box.height = panel.lastHeight || panel.maxHeight || box.height; // } // move the panel in the dom (append to desktop) this.desktop.appendChild(panel.el.dom); // adjust panel visuals panel.el.applyStyles({ position:'absolute' , 'z-index': panel.zindex }); panel.body.replaceClass('x-dock-panel-body-docked', 'x-dock-panel-body-undocked'); // position the panel panel.setBox(box); // reset docked flag panel.docked = false; // hide panel shadow (will be shown by raise) if(panel.shadow) { panel.shadow.hide(); } // raise panel above others this.raise(panel); panel.autoSize(); if(panel === this.expanded) { this.expanded = null; } // set the height of a docked expanded panel this.setPanelHeight(this.expanded); // enable resizing and scrolling panel.setResizable(!panel.collapsed); // remember size of the undocked panel panel.lastWidth = box.width; // panel.lastHeight = box.height; // fire panelundock event this.fireEvent('panelundock', panel, {x:box.x, y:box.y, width:box.width, height:box.height}); // this.updateOrder(); } return this; } // }}} // {{{ /** * Called internally while dragging * @param {Ext.ux.InfoPanel/String} panel Panel object or id of the panel * @param {String} targetId id of panel after which this panel will be docked * @return {Ext.ux.Accordion} this */ , dock: function(panel, targetId) { // get panel if necessary panel = 'string' === typeof panel ? this.items.get(panel) : panel; // proceed only if we have a docked panel var dockWidth, newTargetId, panelHeight, idx, i, targetPanel; if(panel && !panel.docked) { // find correct target if order is forced if(this.forceOrder) { idx = this.items.indexOf(panel); for(i = idx + 1; i < this.items.getCount(); i++) { targetPanel = this.items.itemAt(i); if(targetPanel.docked) { newTargetId = targetPanel.id; break; } } targetId = newTargetId || this.id; } // remember width and height if(!panel.collapsed) { // panel.lastWidth = panel.el.getWidth(); // panel.lastHeight = panel.el.getHeight(); if(!this.independent && this.expanded) { this.expanded.collapse(); } this.expanded = panel; } dockWidth = this.body.getWidth(true); // move the panel element in the dom if(targetId && (this.body.id !== targetId)) { panel.el.insertBefore(Ext.fly(targetId)); } else { panel.el.appendTo(this.body); } // set docked flag panel.docked = true; // adjust panel visuals panel.body.replaceClass('x-dock-panel-body-undocked', 'x-dock-panel-body-docked'); panel.el.applyStyles({ top:'' , left:'' , width:'' // , height:'' , 'z-index':'' , position:'relative' , visibility:'' }); panel.body.applyStyles({width: Ext.isIE ? dockWidth + 'px' : '', height:''}); panel.autoSize(); // if(!this.fitHeight) { // panelHeight = panel.fixedHeight || panel.maxHeight; // if(panelHeight) { // panel.setHeight(panelHeight); // } // } // disable resizing and shadow panel.setResizable(false); if(panel.shadow) { panel.shadow.hide(); } // set panel height (only if this.fitHeight = true) this.setPanelHeight(panel.collapsed ? this.expanded : panel); // fire paneldock event this.fireEvent('paneldock', panel); // this.updateOrder(); } return this; } // }}} // {{{ /** * Moves panel from this dock (accordion) to another * @param {Ext.ux.InfoPanel} panel Panel to move * @param {Ext.ux.Accordion} targetDock Dock to move to */ , moveToDock: function(panel, targetDock) { this.detach(panel); targetDock.attach(panel); panel.docked = false; targetDock.dock(panel); this.setPanelHeight(); this.updateOrder(); targetDock.updateOrder(); } // }}} // {{{ /** * Sets the independent mode * @param {Boolean} independent set to false for normal mode * @return {Ext.ux.Accordion} this */ , setIndependent: function(independent) { this.independent = independent ? true : false; this.fireEvent('independent', this, independent); return this; } // }}} // {{{ /** * Sets the undockable mode * If undockable === true all undocked panels are docked and collapsed (except pinned) * @param {Boolean} undockable set to true to not allow undocking * @return {Ext.ux.Accordion} this */ , setUndockable: function(undockable) { this.items.each(function(panel) { // dock and collapse (except pinned) all undocked panels if not undockable if(!undockable && !panel.docked) { this.dock(panel); if(!this.independent && !panel.collapsed && !panel.pinned) { panel.collapse(); } } // refresh dragging constraints if(panel.docked && panel.draggable) { panel.dd.constrainTo(this.body, 0, false); panel.dd.clearConstraints(); if(undockable) { panel.constrainToDesktop(); } else { panel.dd.setXConstraint(0,0); } } }, this); // set the flag and fire event this.undockable = undockable; this.fireEvent('undockable', this, undockable); return this; } // }}} // {{{ /** * Sets the shadows for all panels * @param {Boolean} shadow set to false to disable shadows * @return {Ext.ux.Accordion} this */ , setShadow: function(shadow) { this.items.each(function(panel) { panel.useShadow = shadow; panel.setShadow(false); if(!panel.docked) { panel.setShadow(shadow); } }); this.useShadow = shadow; this.fireEvent('useshadow', this, shadow); return this; } // }}} // {{{ /** * Called when user clicks the panel body * @param {Ext.ux.InfoPanel} panel */ , onClickPanelBody: function(panel) { if(!panel.docked) { this.raise(panel); } } // }}} // {{{ /** * Called internally for fixed height docks to get current height of panel(s) */ , getPanelBodyHeight: function() { var titleHeight = 0; this.items.each(function(panel) { titleHeight += panel.docked ? panel.titleEl.getHeight() : 0; }); this.panelBodyHeight = this.body.getHeight() - titleHeight - this.body.getFrameWidth('tb') + 1; // this.panelBodyHeight = this.body.getHeight() - titleHeight - this.body.getFrameWidth('tb'); return this.panelBodyHeight; } // }}} // {{{ /** * Sets the height of panel body * Used with fixed height (fitHeight:true) docs * @param {Ext.ux.InfoPanel} panel (defaults to this.expanded) * @return {Ext.ux.Accordion} this */ , setPanelHeight: function(panel) { panel = panel || this.expanded; if(this.fitHeight && panel && panel.docked) { panel.body.setHeight(this.getPanelBodyHeight()); panel.setHeight(panel.getHeight()); } return this; } // }}} // {{{ /** * Constrains the dragging of panels do the desktop * @return {Ext.ux.Accordion} this */ , constrainToDesktop: function() { this.items.each(function(panel) { panel.constrainToDesktop(); }, this); return this; } // }}} // {{{ /** * Clears dragging constraints of panels * @return {Ext.ux.Accordion} this */ , clearConstraints: function() { this.items.each(function(panel) { panel.dd.clearConstraints(); }); } // }}} // {{{ /** * Shows all panels * @param {Boolean} show (optional) if false hides the panels instead of showing * @param {Boolean} alsoUndocked show also undocked panels (defaults to false) * @return {Ext.ux.Accordion} this */ , showAll: function(show, alsoUndocked) { show = (false === show ? false : true); this.items.each(function(panel) { panel.show(show, alsoUndocked); }); return this; } // }}} , showOther: function(panel, show, alsoPinned) { show = (false === show ? false : true); this.items.each(function(p) { if(p === panel || (p.pinned && !alsoPinned)) { return; } if(show) { p.show(); } else { p.hide(); } }); } , hideOther: function(panel, alsoPinned) { this.showOther(panel, false, alsoPinned); } // {{{ /** * Hides all panels * @param {Boolean} alsoUndocked hide also undocked panels (defaults to false) * @return {Ext.ux.Accordion} this */ , hideAll: function(alsoUndocked) { return this.showAll(false, alsoUndocked); } // }}} // {{{ /** * Called internally to disable/enable scrolling of the dock while animating * @param {Boolean} enable true to enable, false to disable * @return {void} * @todo not used at present - revise */ , setDockScroll: function(enable) { if(enable && !this.fitHeight) { this.body.setStyle('overflow','auto'); } else { this.body.setStyle('overflow','hidden'); } } // }}} // {{{ /** * Set Accordion size * Overrides ContentPanel.setSize * * @param {Integer} w width * @param {Integer} h height * @return {Ext.ux.Accordion} this */ , setSize: function(w, h) { // call parent's setSize Ext.ux.Accordion.superclass.setSize.call(this, w, h); // this.body.setHeight(h); this.setPanelHeight(); return this; } // }}} // {{{ /** * Called as windowResize event handler * * @todo: review */ , adjustViewport: function() { var viewport = this.desktop.dom === document.body ? {} : Ext.get(this.desktop).getBox(); viewport.height = this.desktop === document.body ? window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight : viewport.height ; viewport.width = this.desktop === document.body ? window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth : viewport.width ; viewport.x = this.desktop === document.body ? 0 : viewport.x; viewport.y = this.desktop === document.body ? 0 : viewport.y; this.items.each(function(panel) { if(!panel.docked) { panel.moveToViewport(viewport); } }); } // }}} // {{{ /** * private - called internally to create relay event function * @param {String} ename event name to relay * @return {Function} relay event function */ , createRelay: function(ename) { return function() { return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0))); }; } // }}} // {{{ /** * Array of event names to relay */ , relayedEvents: [ 'beforecollapse' , 'collapse' , 'beforeexpand' , 'expand' , 'animationcompleted' , 'pinned' , 'boxchange' , 'destroy' ] // }}} // {{{ /** * private - called internaly to install event relays on panel * @param {Ext.ux.InfoPanel} panel panel to install events on */ , installRelays: function(panel) { panel.relays = {}; var ename, fn; for(var i = 0; i < this.relayedEvents.length; i++) { ename = this.relayedEvents[i]; fn = this.createRelay(ename); panel.relays[ename] = fn; panel.on(ename, fn, this); } } // }}} // {{{ /** * private - called internaly to remove installed relays * @param {Ext.ux.InfoPanel} panel panel to remove relays from */ , removeRelays: function(panel) { for(var ename in panel.relays) { panel.un(ename, panel.relays[ename], this); } panel.relays = {}; } // }}} // {{{ /** * Removes and destroys panel * @param {String/InfoPanel} panel Panel object or id */ , remove: function(panel) { panel = this.items.get(panel.id || panel); if(panel) { this.detach(panel); panel.destroy(); } } // }}} // {{{ /** * Removes and destroys all panels */ , removeAll: function() { this.items.each(function(panel) { this.remove(panel); }, this); } // }}} // {{{ /** * Destroys Accrodion */ , destroy: function() { this.removeAll(); Ext.ux.Accordion.superclass.destroy.call(this); } // }}} }); // end of extend // {{{ // {{{ /** * @class Ext.ux.Accordion.DDDock * @constructor * @extends Ext.dd.DDProxy * @param {Ext.ux.InfoPanel} panel Panel the dragging object is created for * @param {String} group Only elements of same group interact * @param {Ext.ux.Accordion} dock Place where panels are docked/undocked */ Ext.ux.Accordion.DDDock = function(panel, group, dock) { // call parent constructor Ext.ux.Accordion.DDDock.superclass.constructor.call(this, panel.el.dom, group); // save panel and dock references for use in methods this.panel = panel; this.dock = dock; // drag by grabbing the title only this.setHandleElId(panel.titleEl.id); // move only in the dock if undockable if(false === dock.undockable) { this.setXConstraint(0, 0); } // init internal variables this.lastY = 0; //this.DDM.mode = Ext.dd.DDM.INTERSECT; this.DDM.mode = Ext.dd.DDM.POINT; }; // end of constructor // }}} // extend Ext.extend(Ext.ux.Accordion.DDDock, Ext.dd.DDProxy, { // {{{ /** * Default DDProxy startDrag override * Saves some variable for use by other methods * and creates nice dragging proxy (ghost) * * Passed x, y arguments are not used */ startDrag: function(x, y) { this.createIframeMasks(); this.lastMoveTarget = null; // create nice dragging ghost this.createGhost(); // get srcEl (the original) and dragEl (the ghost) var srcEl = Ext.get(this.getEl()); var dragEl = Ext.get(this.getDragEl()); // refresh constraints this.panel.constrainToDesktop(); var dragHeight, rightC, bottomC; if(this.panel.dock.undockable) { if(this.panel.collapsed) { dragHeight = this.panel.titleEl.getHeight(); } else { dragHeight = dragEl.getHeight(); dragHeight = dragHeight <= this.panel.titleEl.getHeight() ? srcEl.getHeight() : dragHeight; } rightC = this.rightConstraint + srcEl.getWidth() - dragEl.getWidth(); bottomC = this.bottomConstraint + srcEl.getHeight() - dragHeight; this.setXConstraint(this.leftConstraint, rightC); this.setYConstraint(this.topConstraint, bottomC); } else { if(this.panel.docked) { this.setXConstraint(0, 0); } } // hide dragEl (will be shown by onDrag) dragEl.hide(); // raise panel's "window" above others if(!this.panel.docked) { this.panel.dock.raise(this.panel); } // hide panel's shadow if any this.panel.setShadow(false); // clear visibility of panel's body (was setup by animations) this.panel.body.dom.style.visibility = ''; // hide source panel if undocked if(!this.panel.docked) { // srcEl.hide(); srcEl.setDisplayed(false); dragEl.show(); } } // end of function startDrag // }}} // {{{ /** * Called internally to create nice dragging proxy (ghost) */ , createGhost: function() { // get variables var srcEl = Ext.get(this.getEl()); var dragEl = Ext.get(this.getDragEl()); var panel = this.panel; var dock = panel.dock; // adjust look of ghost var am = Ext.ux.AccordionManager; dragEl.addClass('x-dock-panel-ghost'); dragEl.applyStyles({border:'1px solid #84a0c4','z-index': am.zindex + am.zindexInc}); // set size of ghost same as original dragEl.setBox(srcEl.getBox()); if(panel.docked) { if(panel.lastWidth && dock.undockable) { dragEl.setWidth(panel.lastWidth); } if(!panel.collapsed && dock.undockable && (panel.lastHeight > panel.titleEl.getHeight())) { dragEl.setHeight(panel.lastHeight); } } // remove unnecessary text nodes from srcEl srcEl.clean(); // setup title var dragTitleEl = Ext.DomHelper.append(dragEl, {tag:'div'}, true); dragTitleEl.update(srcEl.dom.firstChild.innerHTML); dragTitleEl.dom.className = srcEl.dom.firstChild.className; if(panel.collapsed && Ext.isIE) { dragTitleEl.dom.style.borderBottom = "0"; } } // end of function createGhost // }}} // {{{ /** * Default DDProxy onDragOver override * It is called when dragging over a panel * or over the dock.body DropZone * * @param {Event} e not used * @param {String} targetId id of the target we're over * * Beware: While dragging over docked panels it's called * twice. Once for panel and once for DropZone */ , onDragOver: function(e, targetId) { // get panel element var srcEl = Ext.get(this.getEl()); // get target panel and dock var targetDock = Ext.ux.AccordionManager.get(targetId); var targetPanel = targetDock ? targetDock.items.get(targetId) : this.panel; // setup current target for endDrag if(targetPanel) { this.currentTarget = targetPanel.id; } if(targetDock && !this.currentTarget) { this.currentTarget = targetDock.id; } // landing indicators if(targetPanel && targetPanel.docked && !this.panel.dock.forceOrder) { targetPanel.titleEl.addClass('x-dock-panel-title-dragover'); } if(targetDock) { targetDock.body.addClass('x-dock-body-dragover'); } if(this.panel.docked) { this.panel.titleEl.addClass('x-dock-panel-title-dragover'); } // reorder panels in dock if we're docked too var targetEl; if(targetDock === this.panel.dock && targetPanel && targetPanel.docked && this.panel.docked && !this.panel.dock.forceOrder) { targetEl = targetPanel.el; if(targetPanel.collapsed || this.lastMoveTarget !== targetPanel) { if(this.movingUp) { srcEl.insertBefore(targetEl); this.lastMoveTarget = targetPanel; } else { srcEl.insertAfter(targetEl); this.lastMoveTarget = targetPanel; } } this.DDM.refreshCache(this.groups); } } // end of function onDragOver // }}} // {{{ /** * called internally to attach this.panel to accordion * @param {Ext.ux.Accordion} targetDock the dock to attach the panel to */ , attachToDock: function(targetDock) { if(targetDock && this.panel.dock !== targetDock) { // detach panel this.panel.dock.detach(this.panel); // attach panel targetDock.attach(this.panel); } } // }}} // {{{ /** * Called internally when cursor leaves a drop target * @param {Ext.Event} e * @param {String} targetId id of target we're leaving */ , onDragOut: function(e, targetId) { var targetDock = Ext.ux.AccordionManager.get(targetId); var targetPanel = targetDock ? targetDock.items.get(targetId) : this.panel; if(targetDock) { targetDock.body.removeClass('x-dock-body-dragover'); } if(targetPanel) { targetPanel.titleEl.removeClass('x-dock-panel-title-dragover'); } this.currentTarget = null; } // }}} // {{{ /** * Default DDProxy onDrag override * * It's called while dragging * @param {Event} e used to get coordinates */ , onDrag: function(e) { // get source (original) and proxy (ghost) elements var srcEl = Ext.get(this.getEl()); var dragEl = Ext.get(this.getDragEl()); if(!dragEl.isVisible()) { dragEl.show(); } var y = e.getPageY(); this.movingUp = this.lastY > y; this.lastY = y; } // end of function onDrag // }}} // {{{ /** * Default DDProxy endDrag override * * Called when dragging is finished */ , endDrag: function() { this.destroyIframeMasks(); // get the source (original) and proxy (ghost) elements var srcEl = Ext.get(this.getEl()); var dragEl = Ext.get(this.getDragEl()); srcEl.setDisplayed(true); // get box and hide the ghost var box = dragEl.getBox(); var sourceDock = this.panel.dock; var targetDock = Ext.ux.AccordionManager.get(this.currentTarget); var targetPanel = targetDock ? targetDock.items.get(this.currentTarget) : this.panel; var orderChanged = false; // remove any dragover classes from panel title and dock this.panel.titleEl.removeClass('x-dock-panel-title-dragover'); this.dock.body.removeClass('x-dock-body-dragover'); if(targetDock) { targetDock.items.each(function(panel) { panel.titleEl.removeClass('x-dock-panel-title-dragover'); }); } // undock (docked panel dropped out of dock) if(!this.panel.dock.catchPanels && (this.panel.docked && !this.currentTarget && !targetDock) || (targetPanel && !targetPanel.docked)) { this.dock.undock(this.panel, box); orderChanged = true; } // dock undocked panel else if(!this.panel.docked) { this.attachToDock(targetDock); this.panel.dock.dock(this.panel, this.currentTarget); orderChanged = true; } // do nothing for panel moved over it's own dock // handling has already been done by onDragOver else if(this.panel.docked && (this.panel.dock === targetDock)) { // do nothing on purpose - do not remove orderChanged = true; } // dock panel to another dock else if(this.currentTarget || targetDock) { this.attachToDock(targetDock); if(targetDock) { targetDock.body.removeClass('x-dock-body-dragover'); this.panel.docked = false; targetDock.dock(this.panel, this.currentTarget); } orderChanged = true; } // just free dragging if(!this.panel.docked) { this.panel.setBox(box); // let the state manager know the new panel position this.dock.fireEvent('panelbox', this.panel, {x:box.x, y:box.y, width:box.width, height:box.height}); } // clear the ghost content, hide id and move it off screen dragEl.hide(); dragEl.update(''); dragEl.applyStyles({ top:'-9999px' , left:'-9999px' , height:'0px' , width:'0px' }); if(orderChanged) { sourceDock.updateOrder(); if(targetDock && targetDock !== sourceDock) { targetDock.updateOrder(); } } this.DDM.refreshCache(this.groups); } // end of function endDrag // }}} // {{{ , createIframeMasks: function() { this.destroyIframeMasks(); var masks = []; var iframes = Ext.get(document.body).select('iframe'); iframes.each(function(iframe) { var mask = Ext.DomHelper.append(document.body, {tag:'div'}, true); mask.setBox(iframe.getBox()); masks.push(mask); }); this.iframeMasks = masks; } // }}} // {{{ , destroyIframeMasks: function() { if(!this.iframeMasks || ! this.iframeMasks.length) { return; } for(var i = 0; i < this.iframeMasks.length; i++) { this.iframeMasks[i].remove(); } this.iframeMasks = []; } // }}} }); // }}} // {{{ /** * Private class for keeping and restoring state of the Accordion */ Ext.ux.AccordionStateManager = function() { this.state = { docks:{}, panels:{} }; }; Ext.ux.AccordionStateManager.prototype = { init: function(provider) { // save state provider this.provider = provider; // var state = provider.get('accjs-state'); // if(state) { // this.state = state; // } state = this.state; var am = Ext.ux.AccordionManager; var dockState; // {{{ // docks loop am.each(function(dock) { if(false === dock.keepState) { return; } state.docks[dock.id] = provider.get('accjsd-' + dock.id); dockState = state.docks[dock.id]; if(dockState) { // {{{ // handle docks (accordions) if(dockState) { // {{{ // restore order of panels if(dockState.order) { dock.setOrder(dockState.order); } // }}} // {{{ // restore independent if(undefined !== dockState.independent) { dock.setIndependent(dockState.independent); } // }}} // {{{ // restore undockable if(undefined !== dockState.undockable) { dock.setUndockable(dockState.undockable); } // }}} // {{{ // restore useShadow if(undefined !== dockState.useShadow) { dock.setShadow(dockState.useShadow); } // }}} } // end of if(dockState) // }}} } // install event handlers on docks dock.on({ orderchange: {scope:this, fn:this.onOrderChange} , independent: {scope:this, fn:this.onIndependent} , undockable: {scope:this, fn:this.onUndockable} , useshadow: {scope: this, fn: this.onUseShadow} , panelexpand: {scope: this, fn: this.onPanelCollapse} , panelcollapse: {scope: this, fn: this.onPanelCollapse} , panelpinned: {scope: this, fn: this.onPanelPinned} , paneldock: {scope: this, fn: this.onPanelUnDock} , panelundock: {scope: this, fn: this.onPanelUnDock} , boxchange: {scope: this, fn: this.onPanelUnDock} , panelbox: {scope: this, fn: this.onPanelUnDock} }); }, this); // }}} // {{{ // panels loop am.each(function(dock) { if(!dock.keepState) { return; } // panels within dock loop var panelState; dock.items.each(function(panel) { state.panels[panel.id] = provider.get('accjsp-' + panel.id); panelState = state.panels[panel.id]; if(panelState) { // {{{ // restore docked/undocked state if(undefined !== panelState.docked) { if(!panelState.docked) { if('object' === typeof panelState.box) { panel.docked = true; panel.dock.undock(panel, panelState.box); } } } // }}} // {{{ // restore pinned state if(undefined !== panelState.pinned) { panel.pinned = panelState.pinned; if(panel.pinned) { panel.expand(true); } else { panel.updateVisuals(); } } // }}} // {{{ // restore collapsed/expanded state if(undefined !== panelState.collapsed) { if(panelState.collapsed) { panel.collapsed = false; panel.collapse(true); } else { panel.collapsed = true; panel.expand(true); } } // }}} } }, this); // end of panels within dock loop }, this); // end of docks loop // }}} } // event handlers // {{{ , onOrderChange: function(dock, order) { if(false !== dock.keepState) { this.state.docks[dock.id] = this.state.docks[dock.id] ? this.state.docks[dock.id] : {}; this.state.docks[dock.id].order = order; this.storeDockState(dock); } } // }}} // {{{ , onIndependent: function(dock, independent) { if(false !== dock.keepState) { this.state.docks[dock.id] = this.state.docks[dock.id] ? this.state.docks[dock.id] : {}; this.state.docks[dock.id].independent = independent; this.storeDockState(dock); } } // }}} // {{{ , onUndockable: function(dock, undockable) { if(false !== dock.keepState) { this.state.docks[dock.id] = this.state.docks[dock.id] ? this.state.docks[dock.id] : {}; this.state.docks[dock.id].undockable = undockable; this.storeDockState(dock); } } // }}} // {{{ , onUseShadow: function(dock, shadow) { if(false !== dock.keepState) { this.state.docks[dock.id] = this.state.docks[dock.id] ? this.state.docks[dock.id] : {}; this.state.docks[dock.id].useShadow = shadow; this.storeDockState(dock); } } // }}} // {{{ , onPanelCollapse: function(panel) { if(panel.dock.keepState) { this.state.panels[panel.id] = this.state.panels[panel.id] || {}; this.state.panels[panel.id].collapsed = panel.collapsed; } else { try {delete(this.state.panels[panel.id].collapsed);} catch(e){} } this.storePanelState(panel); } // }}} // {{{ , onPanelPinned: function(panel, pinned) { if(panel.dock.keepState) { this.state.panels[panel.id] = this.state.panels[panel.id] || {}; this.state.panels[panel.id].pinned = pinned; } else { try {delete(this.state.panels[panel.id].pinned);} catch(e){} } this.storePanelState(panel); } // }}} // {{{ , onPanelUnDock: function(panel, box) { if(panel.dock.keepState) { this.state.panels[panel.id] = this.state.panels[panel.id] || {}; this.state.panels[panel.id].docked = panel.docked ? true : false; this.state.panels[panel.id].box = box || null; } else { try {delete(this.state.panels[panel.id].docked);} catch(e){} try {delete(this.state.panels[panel.id].box);} catch(e){} } // console.log('onPanelUnDock: ', + panel.id); this.storePanelState(panel); } // }}} // {{{ , storeDockState: function(dock) { this.provider.set.defer(700, this, ['accjsd-' + dock.id, this.state.docks[dock.id]]); } // }}} // {{{ , storePanelState: function(panel) { this.provider.set.defer(700, this, ['accjsp-' + panel.id, this.state.panels[panel.id]]); } // }}} }; // end of Ext.ux.AccordionManager.prototype // }}} // {{{ /** * Singleton to manage multiple accordions * @singleton */ Ext.ux.AccordionManager = function() { // collection of accordions var items = new Ext.util.MixedCollection(); // public stuff return { // starting z-index for panels zindex: 9999 // z-index increment (2 as 1 is for shadow) , zindexInc: 2 // {{{ /** * increments (by this.zindexInc) this.zindex and returns new value * @return {Integer} next zindex value */ , getNextZindex: function() { this.zindex += this.zindexInc; return this.zindex; } // }}} // {{{ /** * raises panel above others (in the same desktop) * Maintains z-index stack * @param {Ext.ux.InfoPanel} panel panel to raise * @return {Ext.ux.InfoPanel} panel panel that has been raised */ , raise: function(panel) { items.each(function(dock) { dock.items.each(function(p) { if(p.zindex > panel.zindex) { p.zindex -= this.zindexInc; p.el.applyStyles({'z-index':p.zindex}); if(!p.docked) { p.setShadow(true); } } }, this); }, this); if(panel.zindex !== this.zindex) { panel.zindex = this.zindex; panel.el.applyStyles({'z-index':panel.zindex}); if(panel.desktop.lastChild !== panel.el.dom) { panel.dock.desktop.appendChild(panel.el.dom); } if(!panel.docked) { panel.setShadow(true); } } return panel; } // }}} // {{{ /** * Adds accordion to items * @param {Ext.ux.Accordion} acc accordion to add * @return {Ext.ux.Accordion} added accordion */ , add: function(acc) { items.add(acc.id, acc); return acc; } // }}} // {{{ /** * get accordion by it's id or by id of some ot it's panels * @param {String} key id of accordion or panel * @return {Ext.ux.Accordion} or undefined if not found */ , get: function(key) { var dock = items.get(key); if(!dock) { items.each(function(acc) { if(dock) { return; } var panel = acc.items.get(key); if(panel) { dock = panel.dock; } }); } return dock; } // }}} // {{{ /** * get panel by it's id * @param {String} key id of the panel to get * @return {Ext.ux.InfoPanel} panel found or null */ , getPanel: function(key) { var dock = this.get(key); return dock && dock.items ? this.get(key).items.get(key) : null; } // }}} // {{{ /** * Restores state of dock and panels * @param {Ext.state.Provider} provider (optional) An alternate state provider */ , restoreState: function(provider) { if(!provider) { provider = Ext.state.Manager; } var sm = new Ext.ux.AccordionStateManager(); sm.init(provider); } // }}} , each: function(fn, scope) { items.each(fn, scope); } }; // end of return }(); // }}} // end of file
JavaScript
/*--------------Ext.form.TreeField--------------------*/ function createXmlTree(el, url, callback) { /* */ var Tree = Ext.tree; var tree = new Tree.TreePanel(el, {//id animate:true, loader: new Tree.TreeLoader({dataUrl:'/anews/newscategory/getChildren.htm'}),//c.dataTag enableDD:false, containerScroll: true }); // set the root node var root = new Tree.AsyncTreeNode({ text: '分类',//c.title draggable:false, id:'source'//c.rootId }); tree.setRootNode(root); // render the tree tree.render(); root.expand(); return tree; /* var tree = new Ext.tree.TreePanel(el,{containerScroll: true}); var p = new Ext.data.HttpProxy({url:url}); p.on("loadexception", function(o, response, e) { if (e) throw e; }); p.load(null, { read: function(response) { var doc = response.responseXML; tree.setRootNode(rpTreeNodeFromXml(doc.documentElement || doc)); } }, callback || tree.render, tree); return tree; */ } //rp tree from xml function rpTreeNodeFromXml(XmlEl) { // Text is nodeValue to text node, otherwise it's the tag name var t = ((XmlEl.nodeType == 3) ? XmlEl.nodeValue : XmlEl.tagName); // No text, no node. if (t.replace(/\s/g,'').length == 0) { return null; } // Special case of an element containing no attributes and just one text node var leafTextNode = ((XmlEl.attributes.length == 0) && (XmlEl.childNodes.length == 1) && (XmlEl.firstChild.nodeType == 3)); if (leafTextNode ) { return new Ext.tree.TreeNode({ tagName: XmlEl.tagName, text: XmlEl.firstChild.nodeValue }); } var result = new Ext.tree.TreeNode({ text : t }); result.tagName=XmlEl.tagName; // For Elements, process attributes and children if (XmlEl.nodeType == 1) { Ext.each(XmlEl.attributes, function(a) { result.attributes[a.nodeName]=a.nodeValue; if(a.nodeName=='text') result.setText(a.nodeValue); }); if (!leafTextNode) { Ext.each(XmlEl.childNodes, function(el) { // Only process Elements and TextNodes if ((el.nodeType == 1) || (el.nodeType == 3)) { var c = rpTreeNodeFromXml(el); if (c) { result.appendChild(c); } } }); } } return result; } Ext.form.TreeField = function(config) { config.readOnly = true; Ext.form.TreeField.superclass.constructor.call(this, config); }; Ext.extend(Ext.form.TreeField, Ext.form.TriggerField, { triggerClass : 'x-form-date-trigger', defaultAutoCreate : {tag: "input", type: "text", size: "10", autocomplete: "off"}, getValue : function() { return Ext.form.TreeField.superclass.getValue.call(this)|| ""; }, setValue : function(val) { Ext.form.TreeField.superclass.setValue.call(this, val); }, menuListeners : { select:function (item, picker, node) { var v = node.text; var ed = this.ed; if(this.selfunc) { v = this.selfunc(node); } if(ed) { var r= ed.record; r.set(this.fn, v); } else { this.focus(); this.setValue(v); //Ext.get("category_id").value = node.id; //alert(Ext.get("category_id").value); document.getElementById("category_id").value = node.id; //alert(document.getElementById("category_id")); //alert(document.getElementById("category_id").value); } }, hide : function(){ } }, onTriggerClick : function(){ if(this.disabled){ return; } if(this.menu == null){ this.menu = new Ext.menu.TreeMenu(); } Ext.apply(this.menu.picker, { url:this.url }); this.menu.on(Ext.apply({}, this.menuListeners, { scope:this })); this.menu.picker.setValue(this.getValue()); this.menu.show(this.el, "tl-bl?"); }, invalidText : "{0} is not a valid date - it must be in the format {1}" }); Ext.menu.TreeMenu = function(config){ Ext.menu.TreeMenu.superclass.constructor.call(this, config); this.plain = true; var di = new Ext.menu.TreeItem(config); this.add(di); this.picker = di.picker; this.relayEvents(di, ["select"]); this.relayEvents(di, ["beforesubmit"]); }; Ext.extend(Ext.menu.TreeMenu, Ext.menu.Menu); Ext.menu.TreeItem = function(config){ Ext.menu.TreeItem.superclass.constructor.call(this, new Ext.TreePicker(config), config); this.picker = this.component; this.addEvents({select: true}); this.picker.on("render", function(picker){ picker.getEl().swallowEvent("click"); //picker.container.addClass("x-menu-date-item"); }); this.picker.on("select", this.onSelect, this); }; Ext.extend(Ext.menu.TreeItem, Ext.menu.Adapter, { onSelect : function(picker, node){ this.fireEvent("select", this, picker, node); Ext.menu.TreeItem.superclass.handleClick.call(this); } }); Ext.TreePicker = function(config){ Ext.TreePicker.superclass.constructor.call(this, config); this.addEvents({select: true}); if(this.handler){ this.on("select", this.handler, this.scope || this); } }; Ext.extend(Ext.TreePicker, Ext.Component, { setValue : function(value){ this.value=value; if(this.tree) this.tree.selectPath(value,'text'); }, getValue : function(){ return this.value; }, onRender : function(container){ var me=this; var dh = Ext.DomHelper; var el = document.createElement("div"); el.className = "x-date-picker"; el.innerHTML=''; var eo= Ext.get(el); this.el=eo; container.dom.appendChild(el); var tree=createXmlTree(el,me.url,function(){ var tree=this; tree.render(); tree.selectPath(me.getValue(),'text'); }); tree.on('click',function(node,e){ me.fireEvent("select", me, node); }); this.tree=tree; } } );
JavaScript
Ext.onReady(function(){ // turn on quick tips Ext.QuickTips.init(); // this is the source code tree var tree = new Ext.tree.TreePanel('main', { animate:true, containerScroll: true, enableDD:true, lines: true, //loader: new Ext.tree.TreeLoader({dataUrl:'getChildren.htm'}) loader: new Ext.tree.TreeLoader({dataUrl:'getAllTree.htm'}) }); tree.el.addKeyListener(Ext.EventObject.DELETE, removeNode); //new Ext.tree.TreeSorter(tree, {folderSort:true}); var tb = new Ext.Toolbar(tree.el.createChild({tag:'div'})); tb.add({ text: '新增子分类', cls: 'x-btn-text-icon album-btn', tooltip: '添加选中节点的下级分类', handler: createChild }, { text: '新增兄弟分类', cls: 'x-btn-text-icon album-btn', tooltip: '添加选中节点的同级分类', handler: createBrother }, { text: '修改分类', cls: 'x-btn-text-icon album-btn', tooltip: '修改选中分类', handler: updateNode }, { text: '删除分类', cls: 'x-btn-text-icon album-btn', tooltip:'删除一个分类', handler:removeNode }, { text: '排序', cls: 'x-btn-text-icon album-btn', tooltip:'保存排序结果', handler:save }, { text: '展开', cls: 'x-btn-text-icon album-btn', tooltip:'展开所有分类', handler:expandAll }, { text: '关闭', cls: 'x-btn-text-icon album-btn', tooltip:'关闭所有分类', handler:collapseAll }, { text: '刷新', cls: 'x-btn-text-icon album-btn', tooltip:'刷新所有节点', handler:refresh }); // add an inline editor for the nodes var ge = new Ext.tree.TreeEditor(tree, { allowBlank:false, blankText:'请添写名称', selectOnFocus:true }); ge.on('beforestartedit', function(){ var node = ge.editNode; if(!node.attributes.allowEdit){ return false; } else { node.attributes.oldText = node.text; } }); ge.on('complete', function() { var node = ge.editNode; // 如果节点没有改变,就向服务器发送修改信息 if (node.attributes.oldText == node.text) { node.attributes.oldText = null; return true; } var item = { id: node.id, text: node.text, parentId: node.parentNode.id }; tree.el.mask('正在与服务器交换数据...', 'x-mask-loading'); var hide = tree.el.unmask.createDelegate(tree.el); var doSuccess = function(responseObject) { //alert("success\n" + responseObject.responseText); eval("var o = " + responseObject.responseText + ";"); ge.editNode.id = o.id; hide(); }; var doFailure = function(responseObject) { //alert("faliure\n" + responseObject.responseText); hide(); }; Ext.lib.Ajax.request( 'POST', 'insertTree.htm', {success:doSuccess,failure:doFailure}, 'data='+encodeURIComponent(Ext.encode(item)) ); }); var root = new Ext.tree.AsyncTreeNode({ text: '分类', draggable:true, id:'-1' }); tree.setRootNode(root); tree.render(); root.expand(true, false); // function function createChild() { var sm = tree.getSelectionModel(); var n = sm.getSelectedNode(); if (!n) { n = tree.getRootNode(); } else { n.expand(false, false); } // var selectedId = (n) ? n.id : -1; createNode(n); } function createBrother() { var n = tree.getSelectionModel().getSelectedNode(); if (!n) { Ext.Msg.alert('提示', "请选择一个节点"); } else if (n == tree.getRootNode()) { Ext.Msg.alert('提示', "不能为根节点增加兄弟节点"); } else { createNode(n.parentNode); } } function createNode(n) { var node = n.appendChild(new Ext.tree.TreeNode({ id:-1, text:'请输入分类名', cls:'album-node', allowDrag:true, allowDelete:true, allowEdit:true, allowChildren:true })); tree.getSelectionModel().select(node); setTimeout(function(){ ge.editNode = node; ge.startEdit(node.ui.textNode); }, 10); } function updateNode() { var n = tree.getSelectionModel().getSelectedNode(); if (!n) { Ext.Msg.alert('提示', "请选择一个节点"); } else if (n == tree.getRootNode()) { Ext.Msg.alert('提示', "不能为根节点增加兄弟节点"); } else { setTimeout(function(){ ge.editNode = n; ge.startEdit(n.ui.textNode); }, 10); } } function removeNode() { var sm = tree.getSelectionModel(); var n = sm.getSelectedNode(); if(n && n.attributes.allowDelete){ tree.getSelectionModel().selectPrevious(); tree.el.mask('正在与服务器交换数据...', 'x-mask-loading'); var hide = tree.el.unmask.createDelegate(tree.el); Ext.lib.Ajax.request( 'POST', 'removeTree.htm', {success:hide,failure:hide}, 'id='+n.id ); n.parentNode.removeChild(n); } } function appendNode(node, array) { if (!node || node.childNodes.length < 1) { return; } for (var i = 0; i < node.childNodes.length; i++) { var child = node.childNodes[i]; array.push({id:child.id,parentId:child.parentNode.id}); appendNode(child, array); } } // save to the server in a format usable in PHP function save() { tree.el.mask('正在与服务器交换数据...', 'x-mask-loading'); var hide = tree.el.unmask.createDelegate(tree.el); var ch = []; appendNode(root, ch); Ext.lib.Ajax.request( 'POST', 'sortTree.htm', {success:hide,failure:hide}, 'data='+encodeURIComponent(Ext.encode(ch)) ); } function collapseAll(){ //ctxMenu.hide(); setTimeout(function(){ root.eachChild(function(n){ n.collapse(false, false); }); }, 10); } function expandAll(){ //ctxMenu.hide(); setTimeout(function(){ root.eachChild(function(n){ n.expand(false, false); }); }, 10); } tree.on('contextmenu', prepareCtx); // context menus var ctxMenu = new Ext.menu.Menu({ id:'copyCtx', items: [{ id:'createChild', handler:createChild, cls:'create-mi', text: '新增子节点' },{ id:'createBrother', handler:createBrother, cls:'create-mi', text: '新增兄弟节点' },{ id:'updateNode', handler:updateNode, cls:'update-mi', text: '修改节点' },{ id:'remove', handler:removeNode, cls:'remove-mi', text: '删除' },'-',{ id:'expand', handler:expandAll, cls:'expand-all', text:'展开' },{ id:'collapse', handler:collapseAll, cls:'collapse-all', text:'关闭' },{ id:'refresh', handler:refresh, cls:'refresh', text:'刷新' }] }); function prepareCtx(node, e){ node.select(); ctxMenu.items.get('remove')[node.attributes.allowDelete ? 'enable' : 'disable'](); ctxMenu.showAt(e.getXY()); } // handle drag over and drag drop tree.on('nodedrop', function(e){ var n = e.dropNode; //alert(n + "," + e.target + "," + e.point); return true; }); function refresh() { tree.root.reload(); tree.root.expand(true, false); } });
JavaScript
Ext.tree.DWRTreeLoader = function(config) { Ext.tree.DWRTreeLoader.superclass.constructor.call(this, config); }; Ext.extend(Ext.tree.DWRTreeLoader, Ext.tree.TreeLoader, { requestData : function(node, callback) { if (this.fireEvent("beforeload", this, node, callback) !== false) { //todo //var params = this.getParams(node); var callParams = new Array(); var success = this.handleResponse.createDelegate(this, [node, callback], 1); var error = this.handleFailure.createDelegate(this, [node, callback], 1); callParams.push(node.id); callParams.push({callback:success, errorHandler:error}); //todo: do we need to set this to something else? this.transId=true; this.dataUrl.apply(this, callParams); } else { // if the load is cancelled, make sure we notify // the node that we are done if (typeof callback == "function") { alert(callback); callback(); } } }, processResponse : function(response, node, callback){ try { for(var i = 0; i < response.length; i++){ var n = this.createNode(response[i]); if(n){ node.appendChild(n); } } if(typeof callback == "function"){ callback(this, node); } }catch(e){ this.handleFailure(response); } }, handleResponse : function(response, node, callback){ this.transId = false; this.processResponse(response, node, callback); this.fireEvent("load", this, node, response); }, handleFailure : function(response, node, callback){ this.transId = false; this.fireEvent("loadexception", this, node, response); if(typeof callback == "function"){ callback(this, node); } } });
JavaScript
var treecombo = function(){ // return a public interface return { init : function(){ var el = Ext.get('category_field').dom; var config = { title: '新闻分类', rootId: 0, height:200, dataTag: 'newdistrict', treeHeight: 150, beforeSelect: function(){} }; var object = new Ext.form.TreeField({ id: el.id, name : el.id, allowBlank: false, width: 200, treeConfig: config }); //if(不是EditorGrid && 不是Form) object.applyTo(el.id); object.applyTo(el.id); } } }(); Ext.onReady(treecombo.init, treecombo, true);
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-11-02 * http://code.google.com/p/anewssystem/ */ var index = function() { var layout; return { init : function() { // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // 创建主面板 layout = new Ext.BorderLayout(document.body, { north: { split : false, initialSize : 40, titlebar : false }, west: { split : true, initialSize : 200, minSize : 150, maxSize : 400, titlebar : true, collapsible : true, animate : true, useShim : true, cmargins : {top:2,bottom:2,right:2,left:2}, collapsed : false }, center: { titlebar : false, title : '', autoScroll : false } }); // 让布局在我们安排了所以部分之后,再显示 var innerLayout = new Ext.BorderLayout('west', { center: { autoScroll : false, split : true , titlebar : false, collapsible : true, showPin : true, animate : true }, south: { initialSize : '26px', autoScroll : false, split : false } }); this.createToolbar(); innerLayout.add('center', new Ext.ContentPanel('menu-tree')); innerLayout.add('south', new Ext.ContentPanel('toolbar')); layout.beginUpdate(); layout.add('north', new Ext.ContentPanel('header')); layout.add('west', new Ext.NestedLayoutPanel(innerLayout)); layout.add('center', new Ext.ContentPanel('main', {title: '', fitToFrame: true})); layout.restoreState(); layout.endUpdate(); //------------------------------------------------------------------------------ this.menuLayout = layout.getRegion("west"); this.menuLayout.id = 'menuLayout'; this.iframe = Ext.get('main').dom; this.loadMain('./welcome.htm'); Ext.lib.Ajax.request( 'POST', "../login/isLogin.htm", {success:function(data){ var json = eval("(" + data.responseText + ")"); if (json.success) { this.setLoginName(json.response); } }.createDelegate(this),failure:function(){ }}, '' ); MenuHelper.getMenus(this.render); } // 注销 , logout : function() { Ext.lib.Ajax.request( 'POST', "../j_acegi_logout", {success:function(){ window.open("login.htm", "_self"); },failure:function(){ window.open("login.htm", "_self"); }}, '' ); } // 创建更换主题的菜单 , createToolbar : function() { var theme = Cookies.get('xrinsurtheme') || 'aero' var menu = new Ext.menu.Menu({ id: 'mainMenu', items: [ new Ext.menu.CheckItem({ id: 'aero', text: '默认风格', checked: (theme == 'aero' ? true : false), group: 'theme', handler: Ext.theme.apply }), new Ext.menu.CheckItem({ id: 'vista', text: '夜色朦胧', checked: (theme == 'vista' ? true : false), group: 'theme', handler: Ext.theme.apply }), new Ext.menu.CheckItem({ id: 'gray', text: '秋意盎然', checked: (theme == 'gray' ? true : false), group: 'theme', handler: Ext.theme.apply }), new Ext.menu.CheckItem({ id: 'default', text: '蓝色回忆', checked: (theme == 'default' ? true : false), group: 'theme', handler: Ext.theme.apply }) ] }); var tb = new Ext.Toolbar('toolbar'); tb.add({ cls : 'theme' , text : '系统风格' , menu : menu }, '-', { cls : 'add' , text : '退出' , handler : this.logout.createDelegate(this) }); } // 获得layout , getLayout : function() { return layout; } // 设置登录名 , setLoginName : function(user) { user = user == null ? '' : user; this.menuLayout.updateTitle("登录用户:" + user); } // 点左边,链接,右边的iframe更新 , loadMain : function(url) { this.iframe.src = url; Cookies.set('xrinsurMainSrc', url); } // 渲染accordion菜单 , render : function(data) { var menuList = data; Ext.get('menu-tree').update(''); var hdt = new Ext.Template('<div><div>{head}</div></div>'); // hdt.compile(); var bdt = new Ext.Template('<div></div>'); // bdt.compile(); var itemTpl = new Ext.Template( '<div class="dl-group-child">' + '<div class="dl-selection">' + '<img src=../widgets/extjs/1.1/resources/images/default/user/tree/{image}>&nbsp;' + '<span>{title}</span>' + '</div>' + '</div>' ); itemTpl.compile(); var acc = new Ext.ux.Accordion('menu-tree', { boxWrap : false, body : 'menu-tree', fitContainer : true, fitToFrame : true, draggable : false, fitHeight : true, useShadow : false, initialHeight: layout.getRegion("west").el.getHeight() - 50 }); for(var g in menuList) { var group = menuList[g]; var hd = hdt.append('menu-tree', {head: g}); var bd = bdt.append(hd); acc.add(new Ext.ux.InfoPanel(hd, {autoScroll:true,icon: '../widgets/extjs/1.1/resources/images/default/user/menu/' + (group[0] ? group[0].parentImg : '')})); //, collapsed: true, showPin: false, collapseOnUnpin: true for(var i = 0; i < group.length; i++) { var f = group[i]; var item = itemTpl.append(bd, f, true); var cb = item.dom.firstChild.firstChild; f.cb = cb; //cb.disabled = (g == '<title>'); item.mon('click', function(e) { if(e.getTarget() != this.cb && !this.cb.disabled){ index.loadMain(this.href ? './' + this.href : 'http://localhost:8080/'); } }, f, true); item.addClassOnOver('dl-selection-over'); } } layout.getRegion("west").expand(); }, checkLogin : function() { Ext.lib.Ajax.request( 'POST', "../login/isLogin.htm", {success:function(data){ var json = eval("(" + data.responseText + ")"); if (json.success) { this.setLoginName(json.response); } else { this.logout(); } }.createDelegate(this),failure:function(){ this.logout(); }}, '' ); } } }(); Ext.onReady(index.init, index, true); var Cookies = { }; Cookies.set = function(H, B) { var F = arguments, I = arguments.length, E = (I > 3) ? F[3] : "/", C = (I > 4) ? F[4] : null, A = (I > 5) ? F[5] : false, D = 60, G = new Date(); G.setTime(G.getTime() + D * 24 * 60 * 60 * 1000); document.cookie = H + "=" + escape(B) + ((G == null) ? "" : ("; expires=" + G.toGMTString())) + ((E == null) ? "" : ("; path=" + E)) + ((C == null) ? "" : ("; domain=" + C)) + ((A == true) ? "; secure":""); }; Cookies.get = function(D) { var B = D + "=", F = B.length, E = document.cookie.length, A = 0, C = 0; while(A < E) { C = A + F; if(document.cookie.substring(A, C) == B) { return Cookies.getCookieVal(C); } A = document.cookie.indexOf(" ", A) + 1; if(A == 0) { break; } } return null; }; Cookies.clear = function(A) { if(Cookies.get(A)) { document.cookie = A + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } }; Cookies.getCookieVal = function(B) { var A = document.cookie.indexOf(";", B); if(A == -1) { A = document.cookie.length; } return unescape(document.cookie.substring(B, A)); }; var xtheme = Cookies.get("xrinsurtheme"); if(!xtheme) { xtheme = "aero"; Cookies.set("xrinsurtheme", xtheme); } var xthemePath = document.location.pathname; if(xthemePath.indexOf(".html") >= 0 && xthemePath.indexOf("index.htm") < 0 && xthemePath.indexOf("welcome.htm") < 0) { document.write("<link id=\"theme\" rel=\"stylesheet\" type=\"text/css\" href=\"../widgets/extjs/1.1/resources/css/ytheme-" + xtheme + ".css\" />"); document.write("<link id=\"theme-iframeLayout\" rel=\"stylesheet\" type=\"text/css\" href=\"../widgets/extjs/1.1/resources/css/ylayout.css\" />"); } else { document.write("<link id=\"theme\" rel=\"stylesheet\" type=\"text/css\" href=\"../widgets/extjs/1.1/resources/css/ytheme-" + xtheme + ".css\" />"); }
JavaScript
/* * Ext JS Library 1.1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license * * @author Lingo * @since 2007-10-02 * http://code.google.com/p/anewssystem/ */ Ext.onReady(function(){ // 开启提示功能 Ext.QuickTips.init(); // 使用cookies保持状态 // TODO: 完全照抄,作用不明 Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); // 布局管理器 var layout = new Ext.BorderLayout(document.body, { center: { autoScroll : true, titlebar : false, tabPosition : 'top', closeOnTab : true, alwaysShowTabs : true, resizeTabs : true, fillToFrame : true } }); // 设置布局 layout.beginUpdate(); layout.add('center', new Ext.ContentPanel('tab1', { title : '客户', toolbar : null, closable : false, fitToFrame : true })); layout.add('center', new Ext.ContentPanel('tab2', { title: "帮助", toolbar: null, closable: false, fitToFrame: true })); layout.restoreState(); layout.endUpdate(); layout.getRegion("center").showPanel("tab1"); // 默认需要id, name, theSort, parent, children // 其他随意定制 var metaData = [ {id:'id', qtip:"ID", vType:"integer", allowBlank:true,defValue:-1,w:50}, {id:'name', qtip:"客户名称", vType:"chn", allowBlank:false,w:200}, {id:'code', qtip:"客户编码", vType:"chn", allowBlank:false,w:100,showInGrid:false}, {id:'type', qtip:"客户类型", vType:"comboBox", allowBlank:false,w:100,showInGrid:false}, {id:'zip', qtip:"邮编", vType:"alphanum", allowBlank:false,w:80,showInGrid:false}, {id:'leader', qtip:"负责人", vType:"chn", allowBlank:false,w:80,showInGrid:false}, {id:'fax', qtip:"传真", vType:"chn", allowBlank:false,w:100,showInGrid:false}, {id:'linkMan', qtip:"联系人", vType:"chn", allowBlank:false,w:200}, {id:'email', qtip:"电子邮件", vType:"alphanum", allowBlank:false,w:100,showInGrid:false}, {id:'tel', qtip:"电话", vType:"alphanum", allowBlank:false,w:100}, {id:'homepage', qtip:"主页", vType:"url", allowBlank:false,w:100,showInGrid:false}, {id:'province', qtip:"省", vType:"comboBox", allowBlank:false,w:100,showInGrid:false,skip:true}, {id:'city', qtip:"市", vType:"comboBox", allowBlank:false,w:100,showInGrid:false,skip:true}, {id:'town', qtip:"县", vType:"comboBox", allowBlank:false,w:100,showInGrid:false,skip:true}, {id:'address', qtip:"地址", vType:"chn", allowBlank:false,w:100,showInGrid:false}, {id:'source', qtip:"客户渠道", vType:"comboBox", allowBlank:false,w:100,showInGrid:false}, {id:'rank', qtip:"信用等级", vType:"comboBox", allowBlank:false,w:100}, {id:'status', qtip:"状态", vType:"comboBox", allowBlank:false,w:100}, {id:'inputMan', qtip:"录入人", vType:"chn", allowBlank:false,w:100,showInGrid:false}, {id:'inputTime', qtip:"录入时间", vType:"date", allowBlank:false,w:100,showInGrid:false}, {id:'descn', qtip:"备注", vType:"editor", allowBlank:false,w:100,showInGrid:false} ]; // 创建表格 var lightGrid = new Ext.lingo.JsonGrid("lightgrid", { metaData : metaData, dialogContent : "content" }); // 渲染表格 lightGrid.render(); var provinceId; var cityId; var townId; var regionRecord = Ext.data.Record.create([ {name: 'id'}, {name: 'name'} ]); var provinceStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'../region/getChildren.htm'}), reader: new Ext.data.JsonReader({},regionRecord) }); var cityStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'../region/getChildren.htm'}), reader: new Ext.data.JsonReader({},regionRecord) }); var townStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:'../region/getChildren.htm'}), reader: new Ext.data.JsonReader({},regionRecord) }); lightGrid.createDialog(); lightGrid.columns.province = new Ext.form.ComboBox({ id:'province', name:'province', fieldLabel: '省', hiddenName:'province', store: provinceStore, valueField:'id', displayField:'name', typeAhead: true, mode: 'local', triggerAction: 'all', emptyText:'请选择', selectOnFocus:true, width:200, transform:'province' }); lightGrid.columns.city = new Ext.form.ComboBox({ id:'city', name:'city', fieldLabel: '市', hiddenName:'city', store: cityStore, valueField:'id', displayField:'name', typeAhead: true, mode: 'local', triggerAction: 'all', emptyText:'请选择', selectOnFocus:true, width:200, transform:'city' }); lightGrid.columns.town = new Ext.form.ComboBox({ id:'town', name:'town', fieldLabel: '县', hiddenName:'town', store: townStore, valueField:'id', displayField:'name', typeAhead: true, mode: 'local', triggerAction: 'all', emptyText:'请选择', selectOnFocus:true, width:200, transform:'town' }); provinceStore.load(); //cityStore.load(); //townStore.load(); lightGrid.columns.province.on('select',function() { provinceId = lightGrid.columns.province.getValue(); cityStore.load({ params:{node:provinceId} }); }); lightGrid.columns.city.on('select',function() { cityId = lightGrid.columns.city.getValue(); townStore.load({ params:{node:cityId} }); }); });
JavaScript