mirror of
https://github.com/salesagility/SuiteCRM.git
synced 2024-11-24 08:36:48 +00:00
ddfc7110b3
(cherry picked from commit 0d61e99
)
5280 lines
159 KiB
JavaScript
Executable File
5280 lines
159 KiB
JavaScript
Executable File
/*
|
|
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
|
|
Code licensed under the BSD License:
|
|
http://developer.yahoo.net/yui/license.txt
|
|
version: 2.6.0
|
|
*/
|
|
(function () {
|
|
YAHOO.util.Config = function (D) {
|
|
if (D) {
|
|
this.init(D);
|
|
}
|
|
};
|
|
var B = YAHOO.lang, C = YAHOO.util.CustomEvent, A = YAHOO.util.Config;
|
|
A.CONFIG_CHANGED_EVENT = "configChanged";
|
|
A.BOOLEAN_TYPE = "boolean";
|
|
A.prototype = {
|
|
owner: null,
|
|
queueInProgress: false,
|
|
config: null,
|
|
initialConfig: null,
|
|
eventQueue: null,
|
|
configChangedEvent: null,
|
|
init: function (D) {
|
|
this.owner = D;
|
|
this.configChangedEvent = this.createEvent(A.CONFIG_CHANGED_EVENT);
|
|
this.configChangedEvent.signature = C.LIST;
|
|
this.queueInProgress = false;
|
|
this.config = {};
|
|
this.initialConfig = {};
|
|
this.eventQueue = [];
|
|
},
|
|
checkBoolean: function (D) {
|
|
return (typeof D == A.BOOLEAN_TYPE);
|
|
},
|
|
checkNumber: function (D) {
|
|
return (!isNaN(D));
|
|
},
|
|
fireEvent: function (D, F) {
|
|
var E = this.config[D];
|
|
if (E && E.event) {
|
|
E.event.fire(F);
|
|
}
|
|
},
|
|
addProperty: function (E, D) {
|
|
E = E.toLowerCase();
|
|
this.config[E] = D;
|
|
D.event = this.createEvent(E, {scope: this.owner});
|
|
D.event.signature = C.LIST;
|
|
D.key = E;
|
|
if (D.handler) {
|
|
D.event.subscribe(D.handler, this.owner);
|
|
}
|
|
this.setProperty(E, D.value, true);
|
|
if (!D.suppressEvent) {
|
|
this.queueProperty(E, D.value);
|
|
}
|
|
},
|
|
getConfig: function () {
|
|
var D = {}, F = this.config, G, E;
|
|
for (G in F) {
|
|
if (B.hasOwnProperty(F, G)) {
|
|
E = F[G];
|
|
if (E && E.event) {
|
|
D[G] = E.value;
|
|
}
|
|
}
|
|
}
|
|
return D;
|
|
},
|
|
getProperty: function (D) {
|
|
var E = this.config[D.toLowerCase()];
|
|
if (E && E.event) {
|
|
return E.value;
|
|
} else {
|
|
return undefined;
|
|
}
|
|
},
|
|
resetProperty: function (D) {
|
|
D = D.toLowerCase();
|
|
var E = this.config[D];
|
|
if (E && E.event) {
|
|
if (this.initialConfig[D] && !B.isUndefined(this.initialConfig[D])) {
|
|
this.setProperty(D, this.initialConfig[D]);
|
|
return true;
|
|
}
|
|
} else {
|
|
return false;
|
|
}
|
|
},
|
|
setProperty: function (E, G, D) {
|
|
var F;
|
|
E = E.toLowerCase();
|
|
if (this.queueInProgress && !D) {
|
|
this.queueProperty(E, G);
|
|
return true;
|
|
} else {
|
|
F = this.config[E];
|
|
if (F && F.event) {
|
|
if (F.validator && !F.validator(G)) {
|
|
return false;
|
|
} else {
|
|
F.value = G;
|
|
if (!D) {
|
|
this.fireEvent(E, G);
|
|
this.configChangedEvent.fire([E, G]);
|
|
}
|
|
return true;
|
|
}
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
},
|
|
queueProperty: function (S, P) {
|
|
S = S.toLowerCase();
|
|
var R = this.config[S], K = false, J, G, H, I, O, Q, F, M, N, D, L, T, E;
|
|
if (R && R.event) {
|
|
if (!B.isUndefined(P) && R.validator && !R.validator(P)) {
|
|
return false;
|
|
} else {
|
|
if (!B.isUndefined(P)) {
|
|
R.value = P;
|
|
} else {
|
|
P = R.value;
|
|
}
|
|
K = false;
|
|
J = this.eventQueue.length;
|
|
for (L = 0; L < J; L++) {
|
|
G = this.eventQueue[L];
|
|
if (G) {
|
|
H = G[0];
|
|
I = G[1];
|
|
if (H == S) {
|
|
this.eventQueue[L] = null;
|
|
this.eventQueue.push([S, (!B.isUndefined(P) ? P : I)]);
|
|
K = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (!K && !B.isUndefined(P)) {
|
|
this.eventQueue.push([S, P]);
|
|
}
|
|
}
|
|
if (R.supercedes) {
|
|
O = R.supercedes.length;
|
|
for (T = 0; T < O; T++) {
|
|
Q = R.supercedes[T];
|
|
F = this.eventQueue.length;
|
|
for (E = 0; E < F; E++) {
|
|
M = this.eventQueue[E];
|
|
if (M) {
|
|
N = M[0];
|
|
D = M[1];
|
|
if (N == Q.toLowerCase()) {
|
|
this.eventQueue.push([N, D]);
|
|
this.eventQueue[E] = null;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
},
|
|
refireEvent: function (D) {
|
|
D = D.toLowerCase();
|
|
var E = this.config[D];
|
|
if (E && E.event && !B.isUndefined(E.value)) {
|
|
if (this.queueInProgress) {
|
|
this.queueProperty(D);
|
|
} else {
|
|
this.fireEvent(D, E.value);
|
|
}
|
|
}
|
|
},
|
|
applyConfig: function (D, G) {
|
|
var F, E;
|
|
if (G) {
|
|
E = {};
|
|
for (F in D) {
|
|
if (B.hasOwnProperty(D, F)) {
|
|
E[F.toLowerCase()] = D[F];
|
|
}
|
|
}
|
|
this.initialConfig = E;
|
|
}
|
|
for (F in D) {
|
|
if (B.hasOwnProperty(D, F)) {
|
|
this.queueProperty(F, D[F]);
|
|
}
|
|
}
|
|
},
|
|
refresh: function () {
|
|
var D;
|
|
for (D in this.config) {
|
|
if (B.hasOwnProperty(this.config, D)) {
|
|
this.refireEvent(D);
|
|
}
|
|
}
|
|
},
|
|
fireQueue: function () {
|
|
var E, H, D, G, F;
|
|
this.queueInProgress = true;
|
|
for (E = 0; E < this.eventQueue.length; E++) {
|
|
H = this.eventQueue[E];
|
|
if (H) {
|
|
D = H[0];
|
|
G = H[1];
|
|
F = this.config[D];
|
|
F.value = G;
|
|
this.eventQueue[E] = null;
|
|
this.fireEvent(D, G);
|
|
}
|
|
}
|
|
this.queueInProgress = false;
|
|
this.eventQueue = [];
|
|
},
|
|
subscribeToConfigEvent: function (E, F, H, D) {
|
|
var G = this.config[E.toLowerCase()];
|
|
if (G && G.event) {
|
|
if (!A.alreadySubscribed(G.event, F, H)) {
|
|
G.event.subscribe(F, H, D);
|
|
}
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
},
|
|
unsubscribeFromConfigEvent: function (D, E, G) {
|
|
var F = this.config[D.toLowerCase()];
|
|
if (F && F.event) {
|
|
return F.event.unsubscribe(E, G);
|
|
} else {
|
|
return false;
|
|
}
|
|
},
|
|
toString: function () {
|
|
var D = "Config";
|
|
if (this.owner) {
|
|
D += " [" + this.owner.toString() + "]";
|
|
}
|
|
return D;
|
|
},
|
|
outputEventQueue: function () {
|
|
var D = "", G, E, F = this.eventQueue.length;
|
|
for (E = 0; E < F; E++) {
|
|
G = this.eventQueue[E];
|
|
if (G) {
|
|
D += G[0] + "=" + G[1] + ", ";
|
|
}
|
|
}
|
|
return D;
|
|
},
|
|
destroy: function () {
|
|
var E = this.config, D, F;
|
|
for (D in E) {
|
|
if (B.hasOwnProperty(E, D)) {
|
|
F = E[D];
|
|
F.event.unsubscribeAll();
|
|
F.event = null;
|
|
}
|
|
}
|
|
this.configChangedEvent.unsubscribeAll();
|
|
this.configChangedEvent = null;
|
|
this.owner = null;
|
|
this.config = null;
|
|
this.initialConfig = null;
|
|
this.eventQueue = null;
|
|
}
|
|
};
|
|
A.alreadySubscribed = function (E, H, I) {
|
|
var F = E.subscribers.length, D, G;
|
|
if (F > 0) {
|
|
G = F - 1;
|
|
do {
|
|
D = E.subscribers[G];
|
|
if (D && D.obj == I && D.fn == H) {
|
|
return true;
|
|
}
|
|
} while (G--);
|
|
}
|
|
return false;
|
|
};
|
|
YAHOO.lang.augmentProto(A, YAHOO.util.EventProvider);
|
|
}());
|
|
(function () {
|
|
YAHOO.widget.Module = function (Q, P) {
|
|
if (Q) {
|
|
this.init(Q, P);
|
|
} else {
|
|
}
|
|
};
|
|
var F = YAHOO.util.Dom, D = YAHOO.util.Config, M = YAHOO.util.Event, L = YAHOO.util.CustomEvent, G = YAHOO.widget.Module, H, O, N, E, A = {
|
|
"BEFORE_INIT": "beforeInit",
|
|
"INIT": "init",
|
|
"APPEND": "append",
|
|
"BEFORE_RENDER": "beforeRender",
|
|
"RENDER": "render",
|
|
"CHANGE_HEADER": "changeHeader",
|
|
"CHANGE_BODY": "changeBody",
|
|
"CHANGE_FOOTER": "changeFooter",
|
|
"CHANGE_CONTENT": "changeContent",
|
|
"DESTORY": "destroy",
|
|
"BEFORE_SHOW": "beforeShow",
|
|
"SHOW": "show",
|
|
"BEFORE_HIDE": "beforeHide",
|
|
"HIDE": "hide"
|
|
}, I = {
|
|
"VISIBLE": {key: "visible", value: true, validator: YAHOO.lang.isBoolean},
|
|
"EFFECT": {key: "effect", suppressEvent: true, supercedes: ["visible"]},
|
|
"MONITOR_RESIZE": {key: "monitorresize", value: true},
|
|
"APPEND_TO_DOCUMENT_BODY": {key: "appendtodocumentbody", value: false}
|
|
};
|
|
G.IMG_ROOT = null;
|
|
G.IMG_ROOT_SSL = null;
|
|
G.CSS_MODULE = "yui-module";
|
|
G.CSS_HEADER = "hd";
|
|
G.CSS_BODY = "bd";
|
|
G.CSS_FOOTER = "ft";
|
|
G.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
|
|
G.textResizeEvent = new L("textResize");
|
|
function K() {
|
|
if (!H) {
|
|
H = document.createElement("div");
|
|
H.innerHTML = ('<div class="' + G.CSS_HEADER + '"></div>' + '<div class="' + G.CSS_BODY + '"></div><div class="' + G.CSS_FOOTER + '"></div>');
|
|
O = H.firstChild;
|
|
N = O.nextSibling;
|
|
E = N.nextSibling;
|
|
}
|
|
return H;
|
|
}
|
|
|
|
function J() {
|
|
if (!O) {
|
|
K();
|
|
}
|
|
return (O.cloneNode(false));
|
|
}
|
|
|
|
function B() {
|
|
if (!N) {
|
|
K();
|
|
}
|
|
return (N.cloneNode(false));
|
|
}
|
|
|
|
function C() {
|
|
if (!E) {
|
|
K();
|
|
}
|
|
return (E.cloneNode(false));
|
|
}
|
|
|
|
G.prototype = {
|
|
constructor: G,
|
|
element: null,
|
|
header: null,
|
|
body: null,
|
|
footer: null,
|
|
id: null,
|
|
imageRoot: G.IMG_ROOT,
|
|
initEvents: function () {
|
|
var P = L.LIST;
|
|
this.beforeInitEvent = this.createEvent(A.BEFORE_INIT);
|
|
this.beforeInitEvent.signature = P;
|
|
this.initEvent = this.createEvent(A.INIT);
|
|
this.initEvent.signature = P;
|
|
this.appendEvent = this.createEvent(A.APPEND);
|
|
this.appendEvent.signature = P;
|
|
this.beforeRenderEvent = this.createEvent(A.BEFORE_RENDER);
|
|
this.beforeRenderEvent.signature = P;
|
|
this.renderEvent = this.createEvent(A.RENDER);
|
|
this.renderEvent.signature = P;
|
|
this.changeHeaderEvent = this.createEvent(A.CHANGE_HEADER);
|
|
this.changeHeaderEvent.signature = P;
|
|
this.changeBodyEvent = this.createEvent(A.CHANGE_BODY);
|
|
this.changeBodyEvent.signature = P;
|
|
this.changeFooterEvent = this.createEvent(A.CHANGE_FOOTER);
|
|
this.changeFooterEvent.signature = P;
|
|
this.changeContentEvent = this.createEvent(A.CHANGE_CONTENT);
|
|
this.changeContentEvent.signature = P;
|
|
this.destroyEvent = this.createEvent(A.DESTORY);
|
|
this.destroyEvent.signature = P;
|
|
this.beforeShowEvent = this.createEvent(A.BEFORE_SHOW);
|
|
this.beforeShowEvent.signature = P;
|
|
this.showEvent = this.createEvent(A.SHOW);
|
|
this.showEvent.signature = P;
|
|
this.beforeHideEvent = this.createEvent(A.BEFORE_HIDE);
|
|
this.beforeHideEvent.signature = P;
|
|
this.hideEvent = this.createEvent(A.HIDE);
|
|
this.hideEvent.signature = P;
|
|
},
|
|
platform: function () {
|
|
var P = navigator.userAgent.toLowerCase();
|
|
if (P.indexOf("windows") != -1 || P.indexOf("win32") != -1) {
|
|
return "windows";
|
|
} else {
|
|
if (P.indexOf("macintosh") != -1) {
|
|
return "mac";
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
}(),
|
|
browser: function () {
|
|
var P = navigator.userAgent.toLowerCase();
|
|
if (P.indexOf("opera") != -1) {
|
|
return "opera";
|
|
} else {
|
|
if (P.indexOf("msie 7") != -1) {
|
|
return "ie7";
|
|
} else {
|
|
if (P.indexOf("msie") != -1) {
|
|
return "ie";
|
|
} else {
|
|
if (P.indexOf("safari") != -1) {
|
|
return "safari";
|
|
} else {
|
|
if (P.indexOf("gecko") != -1) {
|
|
return "gecko";
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}(),
|
|
isSecure: function () {
|
|
if (window.location.href.toLowerCase().indexOf("https") === 0) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}(),
|
|
initDefaultConfig: function () {
|
|
this.cfg.addProperty(I.VISIBLE.key, {
|
|
handler: this.configVisible,
|
|
value: I.VISIBLE.value,
|
|
validator: I.VISIBLE.validator
|
|
});
|
|
this.cfg.addProperty(I.EFFECT.key, {suppressEvent: I.EFFECT.suppressEvent, supercedes: I.EFFECT.supercedes});
|
|
this.cfg.addProperty(I.MONITOR_RESIZE.key, {handler: this.configMonitorResize, value: I.MONITOR_RESIZE.value});
|
|
this.cfg.addProperty(I.APPEND_TO_DOCUMENT_BODY.key, {value: I.APPEND_TO_DOCUMENT_BODY.value});
|
|
},
|
|
init: function (U, T) {
|
|
var R, V;
|
|
this.initEvents();
|
|
this.beforeInitEvent.fire(G);
|
|
this.cfg = new D(this);
|
|
if (this.isSecure) {
|
|
this.imageRoot = G.IMG_ROOT_SSL;
|
|
}
|
|
if (typeof U == "string") {
|
|
R = U;
|
|
U = document.getElementById(U);
|
|
if (!U) {
|
|
U = (K()).cloneNode(false);
|
|
U.id = R;
|
|
}
|
|
}
|
|
this.element = U;
|
|
if (U.id) {
|
|
this.id = U.id;
|
|
}
|
|
V = this.element.firstChild;
|
|
if (V) {
|
|
var Q = false, P = false, S = false;
|
|
do {
|
|
if (1 == V.nodeType) {
|
|
if (!Q && F.hasClass(V, G.CSS_HEADER)) {
|
|
this.header = V;
|
|
Q = true;
|
|
} else {
|
|
if (!P && F.hasClass(V, G.CSS_BODY)) {
|
|
this.body = V;
|
|
P = true;
|
|
} else {
|
|
if (!S && F.hasClass(V, G.CSS_FOOTER)) {
|
|
this.footer = V;
|
|
S = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} while ((V = V.nextSibling));
|
|
}
|
|
this.initDefaultConfig();
|
|
F.addClass(this.element, G.CSS_MODULE);
|
|
if (T) {
|
|
this.cfg.applyConfig(T, true);
|
|
}
|
|
if (!D.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) {
|
|
this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true);
|
|
}
|
|
this.initEvent.fire(G);
|
|
},
|
|
initResizeMonitor: function () {
|
|
var Q = (YAHOO.env.ua.gecko && this.platform == "windows");
|
|
if (Q) {
|
|
var P = this;
|
|
setTimeout(function () {
|
|
P._initResizeMonitor();
|
|
}, 0);
|
|
} else {
|
|
this._initResizeMonitor();
|
|
}
|
|
},
|
|
_initResizeMonitor: function () {
|
|
var P, R, T;
|
|
|
|
function V() {
|
|
G.textResizeEvent.fire();
|
|
}
|
|
|
|
if (!YAHOO.env.ua.opera) {
|
|
R = F.get("_yuiResizeMonitor");
|
|
var U = this._supportsCWResize();
|
|
if (!R) {
|
|
R = document.createElement("iframe");
|
|
if (this.isSecure && G.RESIZE_MONITOR_SECURE_URL && YAHOO.env.ua.ie) {
|
|
R.src = G.RESIZE_MONITOR_SECURE_URL;
|
|
}
|
|
if (!U) {
|
|
T = ["<html><head><script ", 'type="text/javascript">', "window.onresize=function(){window.parent.", "YAHOO.widget.Module.textResizeEvent.", "fire();};<", "/script></head>", "<body></body></html>"].join("");
|
|
R.src = "data:text/html;charset=utf-8," + encodeURIComponent(T);
|
|
}
|
|
R.id = "_yuiResizeMonitor";
|
|
R.title = "Text Resize Monitor";
|
|
R.style.position = "absolute";
|
|
R.style.visibility = "hidden";
|
|
var Q = document.body, S = Q.firstChild;
|
|
if (S) {
|
|
Q.insertBefore(R, S);
|
|
} else {
|
|
Q.appendChild(R);
|
|
}
|
|
R.style.width = "10em";
|
|
R.style.height = "10em";
|
|
R.style.top = (-1 * R.offsetHeight) + "px";
|
|
R.style.left = (-1 * R.offsetWidth) + "px";
|
|
R.style.borderWidth = "0";
|
|
R.style.visibility = "visible";
|
|
if (YAHOO.env.ua.webkit) {
|
|
P = R.contentWindow.document;
|
|
P.open();
|
|
P.close();
|
|
}
|
|
}
|
|
if (R && R.contentWindow) {
|
|
G.textResizeEvent.subscribe(this.onDomResize, this, true);
|
|
if (!G.textResizeInitialized) {
|
|
if (U) {
|
|
if (!M.on(R.contentWindow, "resize", V)) {
|
|
M.on(R, "resize", V);
|
|
}
|
|
}
|
|
G.textResizeInitialized = true;
|
|
}
|
|
this.resizeMonitor = R;
|
|
}
|
|
}
|
|
},
|
|
_supportsCWResize: function () {
|
|
var P = true;
|
|
if (YAHOO.env.ua.gecko && YAHOO.env.ua.gecko <= 1.8) {
|
|
P = false;
|
|
}
|
|
return P;
|
|
},
|
|
onDomResize: function (S, R) {
|
|
var Q = -1 * this.resizeMonitor.offsetWidth, P = -1 * this.resizeMonitor.offsetHeight;
|
|
this.resizeMonitor.style.top = P + "px";
|
|
this.resizeMonitor.style.left = Q + "px";
|
|
},
|
|
setHeader: function (Q) {
|
|
var P = this.header || (this.header = J());
|
|
if (Q.nodeName) {
|
|
P.innerHTML = "";
|
|
P.appendChild(Q);
|
|
} else {
|
|
P.innerHTML = Q;
|
|
}
|
|
this.changeHeaderEvent.fire(Q);
|
|
this.changeContentEvent.fire();
|
|
},
|
|
appendToHeader: function (Q) {
|
|
var P = this.header || (this.header = J());
|
|
P.appendChild(Q);
|
|
this.changeHeaderEvent.fire(Q);
|
|
this.changeContentEvent.fire();
|
|
},
|
|
setBody: function (Q) {
|
|
var P = this.body || (this.body = B());
|
|
if (Q.nodeName) {
|
|
P.innerHTML = "";
|
|
P.appendChild(Q);
|
|
} else {
|
|
P.innerHTML = Q;
|
|
}
|
|
this.changeBodyEvent.fire(Q);
|
|
this.changeContentEvent.fire();
|
|
},
|
|
appendToBody: function (Q) {
|
|
var P = this.body || (this.body = B());
|
|
P.appendChild(Q);
|
|
this.changeBodyEvent.fire(Q);
|
|
this.changeContentEvent.fire();
|
|
},
|
|
setFooter: function (Q) {
|
|
var P = this.footer || (this.footer = C());
|
|
if (Q.nodeName) {
|
|
P.innerHTML = "";
|
|
P.appendChild(Q);
|
|
} else {
|
|
P.innerHTML = Q;
|
|
}
|
|
this.changeFooterEvent.fire(Q);
|
|
this.changeContentEvent.fire();
|
|
},
|
|
appendToFooter: function (Q) {
|
|
var P = this.footer || (this.footer = C());
|
|
P.appendChild(Q);
|
|
this.changeFooterEvent.fire(Q);
|
|
this.changeContentEvent.fire();
|
|
},
|
|
render: function (R, P) {
|
|
var S = this, T;
|
|
|
|
function Q(U) {
|
|
if (typeof U == "string") {
|
|
U = document.getElementById(U);
|
|
}
|
|
if (U) {
|
|
S._addToParent(U, S.element);
|
|
S.appendEvent.fire();
|
|
}
|
|
}
|
|
|
|
this.beforeRenderEvent.fire();
|
|
if (!P) {
|
|
P = this.element;
|
|
}
|
|
if (R) {
|
|
Q(R);
|
|
} else {
|
|
if (!F.inDocument(this.element)) {
|
|
return false;
|
|
}
|
|
}
|
|
if (this.header && !F.inDocument(this.header)) {
|
|
T = P.firstChild;
|
|
if (T) {
|
|
P.insertBefore(this.header, T);
|
|
} else {
|
|
P.appendChild(this.header);
|
|
}
|
|
}
|
|
if (this.body && !F.inDocument(this.body)) {
|
|
if (this.footer && F.isAncestor(this.moduleElement, this.footer)) {
|
|
P.insertBefore(this.body, this.footer);
|
|
} else {
|
|
P.appendChild(this.body);
|
|
}
|
|
}
|
|
if (this.footer && !F.inDocument(this.footer)) {
|
|
P.appendChild(this.footer);
|
|
}
|
|
this.renderEvent.fire();
|
|
return true;
|
|
},
|
|
destroy: function () {
|
|
var P, Q;
|
|
if (this.element) {
|
|
M.purgeElement(this.element, true);
|
|
P = this.element.parentNode;
|
|
}
|
|
if (P) {
|
|
P.removeChild(this.element);
|
|
}
|
|
this.element = null;
|
|
this.header = null;
|
|
this.body = null;
|
|
this.footer = null;
|
|
G.textResizeEvent.unsubscribe(this.onDomResize, this);
|
|
this.cfg.destroy();
|
|
this.cfg = null;
|
|
this.destroyEvent.fire();
|
|
},
|
|
show: function () {
|
|
this.cfg.setProperty("visible", true);
|
|
},
|
|
hide: function () {
|
|
this.cfg.setProperty("visible", false);
|
|
},
|
|
configVisible: function (Q, P, R) {
|
|
var S = P[0];
|
|
if (S) {
|
|
this.beforeShowEvent.fire();
|
|
F.setStyle(this.element, "display", "block");
|
|
this.showEvent.fire();
|
|
} else {
|
|
this.beforeHideEvent.fire();
|
|
F.setStyle(this.element, "display", "none");
|
|
this.hideEvent.fire();
|
|
}
|
|
},
|
|
configMonitorResize: function (R, Q, S) {
|
|
var P = Q[0];
|
|
if (P) {
|
|
this.initResizeMonitor();
|
|
} else {
|
|
G.textResizeEvent.unsubscribe(this.onDomResize, this, true);
|
|
this.resizeMonitor = null;
|
|
}
|
|
},
|
|
_addToParent: function (P, Q) {
|
|
if (!this.cfg.getProperty("appendtodocumentbody") && P === document.body && P.firstChild) {
|
|
P.insertBefore(Q, P.firstChild);
|
|
} else {
|
|
P.appendChild(Q);
|
|
}
|
|
},
|
|
toString: function () {
|
|
return "Module " + this.id;
|
|
}
|
|
};
|
|
YAHOO.lang.augmentProto(G, YAHOO.util.EventProvider);
|
|
}());
|
|
(function () {
|
|
YAHOO.widget.Overlay = function (O, N) {
|
|
YAHOO.widget.Overlay.superclass.constructor.call(this, O, N);
|
|
};
|
|
var H = YAHOO.lang, L = YAHOO.util.CustomEvent, F = YAHOO.widget.Module, M = YAHOO.util.Event, E = YAHOO.util.Dom, C = YAHOO.util.Config, J = YAHOO.env.ua, B = YAHOO.widget.Overlay, G = "subscribe", D = "unsubscribe", I, A = {
|
|
"BEFORE_MOVE": "beforeMove",
|
|
"MOVE": "move"
|
|
}, K = {
|
|
"X": {key: "x", validator: H.isNumber, suppressEvent: true, supercedes: ["iframe"]},
|
|
"Y": {key: "y", validator: H.isNumber, suppressEvent: true, supercedes: ["iframe"]},
|
|
"XY": {key: "xy", suppressEvent: true, supercedes: ["iframe"]},
|
|
"CONTEXT": {key: "context", suppressEvent: true, supercedes: ["iframe"]},
|
|
"FIXED_CENTER": {key: "fixedcenter", value: false, validator: H.isBoolean, supercedes: ["iframe", "visible"]},
|
|
"WIDTH": {key: "width", suppressEvent: true, supercedes: ["context", "fixedcenter", "iframe"]},
|
|
"HEIGHT": {key: "height", suppressEvent: true, supercedes: ["context", "fixedcenter", "iframe"]},
|
|
"AUTO_FILL_HEIGHT": {key: "autofillheight", supressEvent: true, supercedes: ["height"], value: "body"},
|
|
"ZINDEX": {key: "zindex", value: null},
|
|
"CONSTRAIN_TO_VIEWPORT": {
|
|
key: "constraintoviewport",
|
|
value: false,
|
|
validator: H.isBoolean,
|
|
supercedes: ["iframe", "x", "y", "xy"]
|
|
},
|
|
"IFRAME": {key: "iframe", value: (J.ie == 6 ? true : false), validator: H.isBoolean, supercedes: ["zindex"]},
|
|
"PREVENT_CONTEXT_OVERLAP": {
|
|
key: "preventcontextoverlap",
|
|
value: false,
|
|
validator: H.isBoolean,
|
|
supercedes: ["constraintoviewport"]
|
|
}
|
|
};
|
|
B.IFRAME_SRC = "javascript:false;";
|
|
B.IFRAME_OFFSET = 3;
|
|
B.VIEWPORT_OFFSET = 10;
|
|
B.TOP_LEFT = "tl";
|
|
B.TOP_RIGHT = "tr";
|
|
B.BOTTOM_LEFT = "bl";
|
|
B.BOTTOM_RIGHT = "br";
|
|
B.CSS_OVERLAY = "yui-overlay";
|
|
B.STD_MOD_RE = /^\s*?(body|footer|header)\s*?$/i;
|
|
B.windowScrollEvent = new L("windowScroll");
|
|
B.windowResizeEvent = new L("windowResize");
|
|
B.windowScrollHandler = function (O) {
|
|
var N = M.getTarget(O);
|
|
if (!N || N === window || N === window.document) {
|
|
if (J.ie) {
|
|
if (!window.scrollEnd) {
|
|
window.scrollEnd = -1;
|
|
}
|
|
clearTimeout(window.scrollEnd);
|
|
window.scrollEnd = setTimeout(function () {
|
|
B.windowScrollEvent.fire();
|
|
}, 1);
|
|
} else {
|
|
B.windowScrollEvent.fire();
|
|
}
|
|
}
|
|
};
|
|
B.windowResizeHandler = function (N) {
|
|
if (J.ie) {
|
|
if (!window.resizeEnd) {
|
|
window.resizeEnd = -1;
|
|
}
|
|
clearTimeout(window.resizeEnd);
|
|
window.resizeEnd = setTimeout(function () {
|
|
B.windowResizeEvent.fire();
|
|
}, 100);
|
|
} else {
|
|
B.windowResizeEvent.fire();
|
|
}
|
|
};
|
|
B._initialized = null;
|
|
if (B._initialized === null) {
|
|
M.on(window, "scroll", B.windowScrollHandler);
|
|
M.on(window, "resize", B.windowResizeHandler);
|
|
B._initialized = true;
|
|
}
|
|
B._TRIGGER_MAP = {
|
|
"windowScroll": B.windowScrollEvent,
|
|
"windowResize": B.windowResizeEvent,
|
|
"textResize": F.textResizeEvent
|
|
};
|
|
YAHOO.extend(B, F, {
|
|
CONTEXT_TRIGGERS: [], init: function (O, N) {
|
|
B.superclass.init.call(this, O);
|
|
this.beforeInitEvent.fire(B);
|
|
E.addClass(this.element, B.CSS_OVERLAY);
|
|
if (N) {
|
|
this.cfg.applyConfig(N, true);
|
|
}
|
|
if (this.platform == "mac" && J.gecko) {
|
|
if (!C.alreadySubscribed(this.showEvent, this.showMacGeckoScrollbars, this)) {
|
|
this.showEvent.subscribe(this.showMacGeckoScrollbars, this, true);
|
|
}
|
|
if (!C.alreadySubscribed(this.hideEvent, this.hideMacGeckoScrollbars, this)) {
|
|
this.hideEvent.subscribe(this.hideMacGeckoScrollbars, this, true);
|
|
}
|
|
}
|
|
this.initEvent.fire(B);
|
|
}, initEvents: function () {
|
|
B.superclass.initEvents.call(this);
|
|
var N = L.LIST;
|
|
this.beforeMoveEvent = this.createEvent(A.BEFORE_MOVE);
|
|
this.beforeMoveEvent.signature = N;
|
|
this.moveEvent = this.createEvent(A.MOVE);
|
|
this.moveEvent.signature = N;
|
|
}, initDefaultConfig: function () {
|
|
B.superclass.initDefaultConfig.call(this);
|
|
var N = this.cfg;
|
|
N.addProperty(K.X.key, {
|
|
handler: this.configX,
|
|
validator: K.X.validator,
|
|
suppressEvent: K.X.suppressEvent,
|
|
supercedes: K.X.supercedes
|
|
});
|
|
N.addProperty(K.Y.key, {
|
|
handler: this.configY,
|
|
validator: K.Y.validator,
|
|
suppressEvent: K.Y.suppressEvent,
|
|
supercedes: K.Y.supercedes
|
|
});
|
|
N.addProperty(K.XY.key, {handler: this.configXY, suppressEvent: K.XY.suppressEvent, supercedes: K.XY.supercedes});
|
|
N.addProperty(K.CONTEXT.key, {
|
|
handler: this.configContext,
|
|
suppressEvent: K.CONTEXT.suppressEvent,
|
|
supercedes: K.CONTEXT.supercedes
|
|
});
|
|
N.addProperty(K.FIXED_CENTER.key, {
|
|
handler: this.configFixedCenter,
|
|
value: K.FIXED_CENTER.value,
|
|
validator: K.FIXED_CENTER.validator,
|
|
supercedes: K.FIXED_CENTER.supercedes
|
|
});
|
|
N.addProperty(K.WIDTH.key, {
|
|
handler: this.configWidth,
|
|
suppressEvent: K.WIDTH.suppressEvent,
|
|
supercedes: K.WIDTH.supercedes
|
|
});
|
|
N.addProperty(K.HEIGHT.key, {
|
|
handler: this.configHeight,
|
|
suppressEvent: K.HEIGHT.suppressEvent,
|
|
supercedes: K.HEIGHT.supercedes
|
|
});
|
|
N.addProperty(K.AUTO_FILL_HEIGHT.key, {
|
|
handler: this.configAutoFillHeight,
|
|
value: K.AUTO_FILL_HEIGHT.value,
|
|
validator: this._validateAutoFill,
|
|
suppressEvent: K.AUTO_FILL_HEIGHT.suppressEvent,
|
|
supercedes: K.AUTO_FILL_HEIGHT.supercedes
|
|
});
|
|
N.addProperty(K.ZINDEX.key, {handler: this.configzIndex, value: K.ZINDEX.value});
|
|
N.addProperty(K.CONSTRAIN_TO_VIEWPORT.key, {
|
|
handler: this.configConstrainToViewport,
|
|
value: K.CONSTRAIN_TO_VIEWPORT.value,
|
|
validator: K.CONSTRAIN_TO_VIEWPORT.validator,
|
|
supercedes: K.CONSTRAIN_TO_VIEWPORT.supercedes
|
|
});
|
|
N.addProperty(K.IFRAME.key, {
|
|
handler: this.configIframe,
|
|
value: K.IFRAME.value,
|
|
validator: K.IFRAME.validator,
|
|
supercedes: K.IFRAME.supercedes
|
|
});
|
|
N.addProperty(K.PREVENT_CONTEXT_OVERLAP.key, {
|
|
value: K.PREVENT_CONTEXT_OVERLAP.value,
|
|
validator: K.PREVENT_CONTEXT_OVERLAP.validator,
|
|
supercedes: K.PREVENT_CONTEXT_OVERLAP.supercedes
|
|
});
|
|
}, moveTo: function (N, O) {
|
|
this.cfg.setProperty("xy", [N, O]);
|
|
}, hideMacGeckoScrollbars: function () {
|
|
E.replaceClass(this.element, "show-scrollbars", "hide-scrollbars");
|
|
}, showMacGeckoScrollbars: function () {
|
|
E.replaceClass(this.element, "hide-scrollbars", "show-scrollbars");
|
|
}, configVisible: function (Q, N, W) {
|
|
var P = N[0], R = E.getStyle(this.element, "visibility"), X = this.cfg.getProperty("effect"), U = [], T = (this.platform == "mac" && J.gecko), f = C.alreadySubscribed, V, O, d, b, a, Z, c, Y, S;
|
|
if (R == "inherit") {
|
|
d = this.element.parentNode;
|
|
while (d.nodeType != 9 && d.nodeType != 11) {
|
|
R = E.getStyle(d, "visibility");
|
|
if (R != "inherit") {
|
|
break;
|
|
}
|
|
d = d.parentNode;
|
|
}
|
|
if (R == "inherit") {
|
|
R = "visible";
|
|
}
|
|
}
|
|
if (X) {
|
|
if (X instanceof Array) {
|
|
Y = X.length;
|
|
for (b = 0; b < Y; b++) {
|
|
V = X[b];
|
|
U[U.length] = V.effect(this, V.duration);
|
|
}
|
|
} else {
|
|
U[U.length] = X.effect(this, X.duration);
|
|
}
|
|
}
|
|
if (P) {
|
|
if (T) {
|
|
this.showMacGeckoScrollbars();
|
|
}
|
|
if (X) {
|
|
if (P) {
|
|
if (R != "visible" || R === "") {
|
|
this.beforeShowEvent.fire();
|
|
S = U.length;
|
|
for (a = 0; a < S; a++) {
|
|
O = U[a];
|
|
if (a === 0 && !f(O.animateInCompleteEvent, this.showEvent.fire, this.showEvent)) {
|
|
O.animateInCompleteEvent.subscribe(this.showEvent.fire, this.showEvent, true);
|
|
}
|
|
O.animateIn();
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (R != "visible" || R === "") {
|
|
this.beforeShowEvent.fire();
|
|
E.setStyle(this.element, "visibility", "visible");
|
|
this.cfg.refireEvent("iframe");
|
|
this.showEvent.fire();
|
|
}
|
|
}
|
|
} else {
|
|
if (T) {
|
|
this.hideMacGeckoScrollbars();
|
|
}
|
|
if (X) {
|
|
if (R == "visible") {
|
|
this.beforeHideEvent.fire();
|
|
S = U.length;
|
|
for (Z = 0; Z < S; Z++) {
|
|
c = U[Z];
|
|
if (Z === 0 && !f(c.animateOutCompleteEvent, this.hideEvent.fire, this.hideEvent)) {
|
|
c.animateOutCompleteEvent.subscribe(this.hideEvent.fire, this.hideEvent, true);
|
|
}
|
|
c.animateOut();
|
|
}
|
|
} else {
|
|
if (R === "") {
|
|
E.setStyle(this.element, "visibility", "hidden");
|
|
}
|
|
}
|
|
} else {
|
|
if (R == "visible" || R === "") {
|
|
this.beforeHideEvent.fire();
|
|
E.setStyle(this.element, "visibility", "hidden");
|
|
this.hideEvent.fire();
|
|
}
|
|
}
|
|
}
|
|
}, doCenterOnDOMEvent: function () {
|
|
if (this.cfg.getProperty("visible")) {
|
|
this.center();
|
|
}
|
|
}, configFixedCenter: function (R, P, S) {
|
|
var T = P[0], O = C.alreadySubscribed, Q = B.windowResizeEvent, N = B.windowScrollEvent;
|
|
if (T) {
|
|
this.center();
|
|
if (!O(this.beforeShowEvent, this.center, this)) {
|
|
this.beforeShowEvent.subscribe(this.center);
|
|
}
|
|
if (!O(Q, this.doCenterOnDOMEvent, this)) {
|
|
Q.subscribe(this.doCenterOnDOMEvent, this, true);
|
|
}
|
|
if (!O(N, this.doCenterOnDOMEvent, this)) {
|
|
N.subscribe(this.doCenterOnDOMEvent, this, true);
|
|
}
|
|
} else {
|
|
this.beforeShowEvent.unsubscribe(this.center);
|
|
Q.unsubscribe(this.doCenterOnDOMEvent, this);
|
|
N.unsubscribe(this.doCenterOnDOMEvent, this);
|
|
}
|
|
}, configHeight: function (Q, O, R) {
|
|
var N = O[0], P = this.element;
|
|
E.setStyle(P, "height", N);
|
|
this.cfg.refireEvent("iframe");
|
|
}, configAutoFillHeight: function (Q, P, R) {
|
|
var O = P[0], N = this.cfg.getProperty("autofillheight");
|
|
this.cfg.unsubscribeFromConfigEvent("height", this._autoFillOnHeightChange);
|
|
F.textResizeEvent.unsubscribe("height", this._autoFillOnHeightChange);
|
|
if (N && O !== N && this[N]) {
|
|
E.setStyle(this[N], "height", "");
|
|
}
|
|
if (O) {
|
|
O = H.trim(O.toLowerCase());
|
|
this.cfg.subscribeToConfigEvent("height", this._autoFillOnHeightChange, this[O], this);
|
|
F.textResizeEvent.subscribe(this._autoFillOnHeightChange, this[O], this);
|
|
this.cfg.setProperty("autofillheight", O, true);
|
|
}
|
|
}, configWidth: function (Q, N, R) {
|
|
var P = N[0], O = this.element;
|
|
E.setStyle(O, "width", P);
|
|
this.cfg.refireEvent("iframe");
|
|
}, configzIndex: function (P, N, Q) {
|
|
var R = N[0], O = this.element;
|
|
if (!R) {
|
|
R = E.getStyle(O, "zIndex");
|
|
if (!R || isNaN(R)) {
|
|
R = 0;
|
|
}
|
|
}
|
|
if (this.iframe || this.cfg.getProperty("iframe") === true) {
|
|
if (R <= 0) {
|
|
R = 1;
|
|
}
|
|
}
|
|
E.setStyle(O, "zIndex", R);
|
|
this.cfg.setProperty("zIndex", R, true);
|
|
if (this.iframe) {
|
|
this.stackIframe();
|
|
}
|
|
}, configXY: function (P, O, Q) {
|
|
var S = O[0], N = S[0], R = S[1];
|
|
this.cfg.setProperty("x", N);
|
|
this.cfg.setProperty("y", R);
|
|
this.beforeMoveEvent.fire([N, R]);
|
|
N = this.cfg.getProperty("x");
|
|
R = this.cfg.getProperty("y");
|
|
this.cfg.refireEvent("iframe");
|
|
this.moveEvent.fire([N, R]);
|
|
}, configX: function (P, O, Q) {
|
|
var N = O[0], R = this.cfg.getProperty("y");
|
|
this.cfg.setProperty("x", N, true);
|
|
this.cfg.setProperty("y", R, true);
|
|
this.beforeMoveEvent.fire([N, R]);
|
|
N = this.cfg.getProperty("x");
|
|
R = this.cfg.getProperty("y");
|
|
E.setX(this.element, N, true);
|
|
this.cfg.setProperty("xy", [N, R], true);
|
|
this.cfg.refireEvent("iframe");
|
|
this.moveEvent.fire([N, R]);
|
|
}, configY: function (P, O, Q) {
|
|
var N = this.cfg.getProperty("x"), R = O[0];
|
|
this.cfg.setProperty("x", N, true);
|
|
this.cfg.setProperty("y", R, true);
|
|
this.beforeMoveEvent.fire([N, R]);
|
|
N = this.cfg.getProperty("x");
|
|
R = this.cfg.getProperty("y");
|
|
E.setY(this.element, R, true);
|
|
this.cfg.setProperty("xy", [N, R], true);
|
|
this.cfg.refireEvent("iframe");
|
|
this.moveEvent.fire([N, R]);
|
|
}, showIframe: function () {
|
|
var O = this.iframe, N;
|
|
if (O) {
|
|
N = this.element.parentNode;
|
|
if (N != O.parentNode) {
|
|
this._addToParent(N, O);
|
|
}
|
|
O.style.display = "block";
|
|
}
|
|
}, hideIframe: function () {
|
|
if (this.iframe) {
|
|
this.iframe.style.display = "none";
|
|
}
|
|
}, syncIframe: function () {
|
|
var N = this.iframe, P = this.element, R = B.IFRAME_OFFSET, O = (R * 2), Q;
|
|
if (N) {
|
|
N.style.width = (P.offsetWidth + O + "px");
|
|
N.style.height = (P.offsetHeight + O + "px");
|
|
Q = this.cfg.getProperty("xy");
|
|
if (!H.isArray(Q) || (isNaN(Q[0]) || isNaN(Q[1]))) {
|
|
this.syncPosition();
|
|
Q = this.cfg.getProperty("xy");
|
|
}
|
|
E.setXY(N, [(Q[0] - R), (Q[1] - R)]);
|
|
}
|
|
}, stackIframe: function () {
|
|
if (this.iframe) {
|
|
var N = E.getStyle(this.element, "zIndex");
|
|
if (!YAHOO.lang.isUndefined(N) && !isNaN(N)) {
|
|
E.setStyle(this.iframe, "zIndex", (N - 1));
|
|
}
|
|
}
|
|
}, configIframe: function (Q, P, R) {
|
|
var N = P[0];
|
|
|
|
function S() {
|
|
var U = this.iframe, V = this.element, W;
|
|
if (!U) {
|
|
if (!I) {
|
|
I = document.createElement("iframe");
|
|
if (this.isSecure) {
|
|
I.src = B.IFRAME_SRC;
|
|
}
|
|
if (J.ie) {
|
|
I.style.filter = "alpha(opacity=0)";
|
|
I.frameBorder = 0;
|
|
} else {
|
|
I.style.opacity = "0";
|
|
}
|
|
I.style.position = "absolute";
|
|
I.style.border = "none";
|
|
I.style.margin = "0";
|
|
I.style.padding = "0";
|
|
I.style.display = "none";
|
|
}
|
|
U = I.cloneNode(false);
|
|
W = V.parentNode;
|
|
var T = W || document.body;
|
|
this._addToParent(T, U);
|
|
this.iframe = U;
|
|
}
|
|
this.showIframe();
|
|
this.syncIframe();
|
|
this.stackIframe();
|
|
if (!this._hasIframeEventListeners) {
|
|
this.showEvent.subscribe(this.showIframe);
|
|
this.hideEvent.subscribe(this.hideIframe);
|
|
this.changeContentEvent.subscribe(this.syncIframe);
|
|
this._hasIframeEventListeners = true;
|
|
}
|
|
}
|
|
|
|
function O() {
|
|
S.call(this);
|
|
this.beforeShowEvent.unsubscribe(O);
|
|
this._iframeDeferred = false;
|
|
}
|
|
|
|
if (N) {
|
|
if (this.cfg.getProperty("visible")) {
|
|
S.call(this);
|
|
} else {
|
|
if (!this._iframeDeferred) {
|
|
this.beforeShowEvent.subscribe(O);
|
|
this._iframeDeferred = true;
|
|
}
|
|
}
|
|
} else {
|
|
this.hideIframe();
|
|
if (this._hasIframeEventListeners) {
|
|
this.showEvent.unsubscribe(this.showIframe);
|
|
this.hideEvent.unsubscribe(this.hideIframe);
|
|
this.changeContentEvent.unsubscribe(this.syncIframe);
|
|
this._hasIframeEventListeners = false;
|
|
}
|
|
}
|
|
}, _primeXYFromDOM: function () {
|
|
if (YAHOO.lang.isUndefined(this.cfg.getProperty("xy"))) {
|
|
this.syncPosition();
|
|
this.cfg.refireEvent("xy");
|
|
this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);
|
|
}
|
|
}, configConstrainToViewport: function (O, N, P) {
|
|
var Q = N[0];
|
|
if (Q) {
|
|
if (!C.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) {
|
|
this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true);
|
|
}
|
|
if (!C.alreadySubscribed(this.beforeShowEvent, this._primeXYFromDOM)) {
|
|
this.beforeShowEvent.subscribe(this._primeXYFromDOM);
|
|
}
|
|
} else {
|
|
this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);
|
|
this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this);
|
|
}
|
|
}, configContext: function (S, R, O) {
|
|
var V = R[0], P, N, T, Q, U = this.CONTEXT_TRIGGERS;
|
|
if (V) {
|
|
P = V[0];
|
|
N = V[1];
|
|
T = V[2];
|
|
Q = V[3];
|
|
if (U && U.length > 0) {
|
|
Q = (Q || []).concat(U);
|
|
}
|
|
if (P) {
|
|
if (typeof P == "string") {
|
|
this.cfg.setProperty("context", [document.getElementById(P), N, T, Q], true);
|
|
}
|
|
if (N && T) {
|
|
this.align(N, T);
|
|
}
|
|
if (this._contextTriggers) {
|
|
this._processTriggers(this._contextTriggers, D, this._alignOnTrigger);
|
|
}
|
|
if (Q) {
|
|
this._processTriggers(Q, G, this._alignOnTrigger);
|
|
this._contextTriggers = Q;
|
|
}
|
|
}
|
|
}
|
|
}, _alignOnTrigger: function (O, N) {
|
|
this.align();
|
|
}, _findTriggerCE: function (N) {
|
|
var O = null;
|
|
if (N instanceof L) {
|
|
O = N;
|
|
} else {
|
|
if (B._TRIGGER_MAP[N]) {
|
|
O = B._TRIGGER_MAP[N];
|
|
}
|
|
}
|
|
return O;
|
|
}, _processTriggers: function (R, T, Q) {
|
|
var P, S;
|
|
for (var O = 0, N = R.length; O < N; ++O) {
|
|
P = R[O];
|
|
S = this._findTriggerCE(P);
|
|
if (S) {
|
|
S[T](Q, this, true);
|
|
} else {
|
|
this[T](P, Q);
|
|
}
|
|
}
|
|
}, align: function (O, N) {
|
|
var T = this.cfg.getProperty("context"), S = this, R, Q, U;
|
|
|
|
function P(V, W) {
|
|
switch (O) {
|
|
case B.TOP_LEFT:
|
|
S.moveTo(W, V);
|
|
break;
|
|
case B.TOP_RIGHT:
|
|
S.moveTo((W - Q.offsetWidth), V);
|
|
break;
|
|
case B.BOTTOM_LEFT:
|
|
S.moveTo(W, (V - Q.offsetHeight));
|
|
break;
|
|
case B.BOTTOM_RIGHT:
|
|
S.moveTo((W - Q.offsetWidth), (V - Q.offsetHeight));
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (T) {
|
|
R = T[0];
|
|
Q = this.element;
|
|
S = this;
|
|
if (!O) {
|
|
O = T[1];
|
|
}
|
|
if (!N) {
|
|
N = T[2];
|
|
}
|
|
if (Q && R) {
|
|
U = E.getRegion(R);
|
|
switch (N) {
|
|
case B.TOP_LEFT:
|
|
P(U.top, U.left);
|
|
break;
|
|
case B.TOP_RIGHT:
|
|
P(U.top, U.right);
|
|
break;
|
|
case B.BOTTOM_LEFT:
|
|
P(U.bottom, U.left);
|
|
break;
|
|
case B.BOTTOM_RIGHT:
|
|
P(U.bottom, U.right);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}, enforceConstraints: function (O, N, P) {
|
|
var R = N[0];
|
|
var Q = this.getConstrainedXY(R[0], R[1]);
|
|
this.cfg.setProperty("x", Q[0], true);
|
|
this.cfg.setProperty("y", Q[1], true);
|
|
this.cfg.setProperty("xy", Q, true);
|
|
}, getConstrainedX: function (U) {
|
|
var R = this, N = R.element, d = N.offsetWidth, b = B.VIEWPORT_OFFSET, g = E.getViewportWidth(), c = E.getDocumentScrollLeft(), X = (d + b < g), a = this.cfg.getProperty("context"), P, W, i, S = false, e, V, f, O, h = U, T = {
|
|
"tltr": true,
|
|
"blbr": true,
|
|
"brbl": true,
|
|
"trtl": true
|
|
};
|
|
var Y = function () {
|
|
var j;
|
|
if ((R.cfg.getProperty("x") - c) > W) {
|
|
j = (W - d);
|
|
} else {
|
|
j = (W + i);
|
|
}
|
|
R.cfg.setProperty("x", (j + c), true);
|
|
return j;
|
|
};
|
|
var Q = function () {
|
|
if ((R.cfg.getProperty("x") - c) > W) {
|
|
return (V - b);
|
|
} else {
|
|
return (e - b);
|
|
}
|
|
};
|
|
var Z = function () {
|
|
var j = Q(), k;
|
|
if (d > j) {
|
|
if (S) {
|
|
Y();
|
|
} else {
|
|
Y();
|
|
S = true;
|
|
k = Z();
|
|
}
|
|
}
|
|
return k;
|
|
};
|
|
if (this.cfg.getProperty("preventcontextoverlap") && a && T[(a[1] + a[2])]) {
|
|
if (X) {
|
|
P = a[0];
|
|
W = E.getX(P) - c;
|
|
i = P.offsetWidth;
|
|
e = W;
|
|
V = (g - (W + i));
|
|
Z();
|
|
}
|
|
h = this.cfg.getProperty("x");
|
|
} else {
|
|
if (X) {
|
|
f = c + b;
|
|
O = c + g - d - b;
|
|
if (U < f) {
|
|
h = f;
|
|
} else {
|
|
if (U > O) {
|
|
h = O;
|
|
}
|
|
}
|
|
} else {
|
|
h = b + c;
|
|
}
|
|
}
|
|
return h;
|
|
}, getConstrainedY: function (Y) {
|
|
var V = this, O = V.element, h = O.offsetHeight, g = B.VIEWPORT_OFFSET, c = E.getViewportHeight(), f = E.getDocumentScrollTop(), d = (h + g < c), e = this.cfg.getProperty("context"), T, Z, a, W = false, U, P, b, R, N = Y, X = {
|
|
"trbr": true,
|
|
"tlbl": true,
|
|
"bltl": true,
|
|
"brtr": true
|
|
};
|
|
var S = function () {
|
|
var j;
|
|
if ((V.cfg.getProperty("y") - f) > Z) {
|
|
j = (Z - h);
|
|
} else {
|
|
j = (Z + a);
|
|
}
|
|
V.cfg.setProperty("y", (j + f), true);
|
|
return j;
|
|
};
|
|
var Q = function () {
|
|
if ((V.cfg.getProperty("y") - f) > Z) {
|
|
return (P - g);
|
|
} else {
|
|
return (U - g);
|
|
}
|
|
};
|
|
var i = function () {
|
|
var k = Q(), j;
|
|
if (h > k) {
|
|
if (W) {
|
|
S();
|
|
} else {
|
|
S();
|
|
W = true;
|
|
j = i();
|
|
}
|
|
}
|
|
return j;
|
|
};
|
|
if (this.cfg.getProperty("preventcontextoverlap") && e && X[(e[1] + e[2])]) {
|
|
if (d) {
|
|
T = e[0];
|
|
a = T.offsetHeight;
|
|
Z = (E.getY(T) - f);
|
|
U = Z;
|
|
P = (c - (Z + a));
|
|
i();
|
|
}
|
|
N = V.cfg.getProperty("y");
|
|
} else {
|
|
if (d) {
|
|
b = f + g;
|
|
R = f + c - h - g;
|
|
if (Y < b) {
|
|
N = b;
|
|
} else {
|
|
if (Y > R) {
|
|
N = R;
|
|
}
|
|
}
|
|
} else {
|
|
N = g + f;
|
|
}
|
|
}
|
|
return N;
|
|
}, getConstrainedXY: function (N, O) {
|
|
return [this.getConstrainedX(N), this.getConstrainedY(O)];
|
|
}, center: function () {
|
|
var Q = B.VIEWPORT_OFFSET, R = this.element.offsetWidth, P = this.element.offsetHeight, O = E.getViewportWidth(), S = E.getViewportHeight(), N, T;
|
|
if (R < O) {
|
|
N = (O / 2) - (R / 2) + E.getDocumentScrollLeft();
|
|
} else {
|
|
N = Q + E.getDocumentScrollLeft();
|
|
}
|
|
if (P < S) {
|
|
T = (S / 2) - (P / 2) + E.getDocumentScrollTop();
|
|
} else {
|
|
T = Q + E.getDocumentScrollTop();
|
|
}
|
|
this.cfg.setProperty("xy", [parseInt(N, 10), parseInt(T, 10)]);
|
|
this.cfg.refireEvent("iframe");
|
|
}, syncPosition: function () {
|
|
var N = E.getXY(this.element);
|
|
this.cfg.setProperty("x", N[0], true);
|
|
this.cfg.setProperty("y", N[1], true);
|
|
this.cfg.setProperty("xy", N, true);
|
|
}, onDomResize: function (P, O) {
|
|
var N = this;
|
|
B.superclass.onDomResize.call(this, P, O);
|
|
setTimeout(function () {
|
|
N.syncPosition();
|
|
N.cfg.refireEvent("iframe");
|
|
N.cfg.refireEvent("context");
|
|
}, 0);
|
|
}, _getComputedHeight: (function () {
|
|
if (document.defaultView && document.defaultView.getComputedStyle) {
|
|
return function (O) {
|
|
var N = null;
|
|
if (O.ownerDocument && O.ownerDocument.defaultView) {
|
|
var P = O.ownerDocument.defaultView.getComputedStyle(O, "");
|
|
if (P) {
|
|
N = parseInt(P.height, 10);
|
|
}
|
|
}
|
|
return (H.isNumber(N)) ? N : null;
|
|
};
|
|
} else {
|
|
return function (O) {
|
|
var N = null;
|
|
if (O.style.pixelHeight) {
|
|
N = O.style.pixelHeight;
|
|
}
|
|
return (H.isNumber(N)) ? N : null;
|
|
};
|
|
}
|
|
})(), _validateAutoFillHeight: function (N) {
|
|
return (!N) || (H.isString(N) && B.STD_MOD_RE.test(N));
|
|
}, _autoFillOnHeightChange: function (P, N, O) {
|
|
this.fillHeight(O);
|
|
}, _getPreciseHeight: function (O) {
|
|
var N = O.offsetHeight;
|
|
if (O.getBoundingClientRect) {
|
|
var P = O.getBoundingClientRect();
|
|
N = P.bottom - P.top;
|
|
}
|
|
return N;
|
|
}, fillHeight: function (Q) {
|
|
if (Q) {
|
|
var O = this.innerElement || this.element, N = [this.header, this.body, this.footer], U, V = 0, W = 0, S = 0, P = false;
|
|
for (var T = 0, R = N.length; T < R; T++) {
|
|
U = N[T];
|
|
if (U) {
|
|
if (Q !== U) {
|
|
W += this._getPreciseHeight(U);
|
|
} else {
|
|
P = true;
|
|
}
|
|
}
|
|
}
|
|
if (P) {
|
|
if (J.ie || J.opera) {
|
|
E.setStyle(Q, "height", 0 + "px");
|
|
}
|
|
V = this._getComputedHeight(O);
|
|
if (V === null) {
|
|
E.addClass(O, "yui-override-padding");
|
|
V = O.clientHeight;
|
|
E.removeClass(O, "yui-override-padding");
|
|
}
|
|
S = V - W;
|
|
E.setStyle(Q, "height", S + "px");
|
|
if (Q.offsetHeight != S) {
|
|
S = S - (Q.offsetHeight - S);
|
|
}
|
|
E.setStyle(Q, "height", S + "px");
|
|
}
|
|
}
|
|
}, bringToTop: function () {
|
|
var R = [], Q = this.element;
|
|
|
|
function U(Y, X) {
|
|
var a = E.getStyle(Y, "zIndex"), Z = E.getStyle(X, "zIndex"), W = (!a || isNaN(a)) ? 0 : parseInt(a, 10), V = (!Z || isNaN(Z)) ? 0 : parseInt(Z, 10);
|
|
if (W > V) {
|
|
return -1;
|
|
} else {
|
|
if (W < V) {
|
|
return 1;
|
|
} else {
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
function P(X) {
|
|
var W = E.hasClass(X, B.CSS_OVERLAY), V = YAHOO.widget.Panel;
|
|
if (W && !E.isAncestor(Q, X)) {
|
|
if (V && E.hasClass(X, V.CSS_PANEL)) {
|
|
R[R.length] = X.parentNode;
|
|
} else {
|
|
R[R.length] = X;
|
|
}
|
|
}
|
|
}
|
|
|
|
E.getElementsBy(P, "DIV", document.body);
|
|
R.sort(U);
|
|
var N = R[0], T;
|
|
if (N) {
|
|
T = E.getStyle(N, "zIndex");
|
|
if (!isNaN(T)) {
|
|
var S = false;
|
|
if (N != Q) {
|
|
S = true;
|
|
} else {
|
|
if (R.length > 1) {
|
|
var O = E.getStyle(R[1], "zIndex");
|
|
if (!isNaN(O) && (T == O)) {
|
|
S = true;
|
|
}
|
|
}
|
|
}
|
|
if (S) {
|
|
this.cfg.setProperty("zindex", (parseInt(T, 10) + 2));
|
|
}
|
|
}
|
|
}
|
|
}, destroy: function () {
|
|
if (this.iframe) {
|
|
this.iframe.parentNode.removeChild(this.iframe);
|
|
}
|
|
this.iframe = null;
|
|
B.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this);
|
|
B.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);
|
|
F.textResizeEvent.unsubscribe(this._autoFillOnHeightChange);
|
|
B.superclass.destroy.call(this);
|
|
}, toString: function () {
|
|
return "Overlay " + this.id;
|
|
}
|
|
});
|
|
}());
|
|
(function () {
|
|
YAHOO.widget.OverlayManager = function (G) {
|
|
this.init(G);
|
|
};
|
|
var D = YAHOO.widget.Overlay, C = YAHOO.util.Event, E = YAHOO.util.Dom, B = YAHOO.util.Config, F = YAHOO.util.CustomEvent, A = YAHOO.widget.OverlayManager;
|
|
A.CSS_FOCUSED = "focused";
|
|
A.prototype = {
|
|
constructor: A, overlays: null, initDefaultConfig: function () {
|
|
this.cfg.addProperty("overlays", {suppressEvent: true});
|
|
this.cfg.addProperty("focusevent", {value: "mousedown"});
|
|
}, init: function (I) {
|
|
this.cfg = new B(this);
|
|
this.initDefaultConfig();
|
|
if (I) {
|
|
this.cfg.applyConfig(I, true);
|
|
}
|
|
this.cfg.fireQueue();
|
|
var H = null;
|
|
this.getActive = function () {
|
|
return H;
|
|
};
|
|
this.focus = function (J) {
|
|
var K = this.find(J);
|
|
if (K) {
|
|
K.focus();
|
|
}
|
|
};
|
|
this.remove = function (K) {
|
|
var M = this.find(K), J;
|
|
if (M) {
|
|
if (H == M) {
|
|
H = null;
|
|
}
|
|
var L = (M.element === null && M.cfg === null) ? true : false;
|
|
if (!L) {
|
|
J = E.getStyle(M.element, "zIndex");
|
|
M.cfg.setProperty("zIndex", -1000, true);
|
|
}
|
|
this.overlays.sort(this.compareZIndexDesc);
|
|
this.overlays = this.overlays.slice(0, (this.overlays.length - 1));
|
|
M.hideEvent.unsubscribe(M.blur);
|
|
M.destroyEvent.unsubscribe(this._onOverlayDestroy, M);
|
|
M.focusEvent.unsubscribe(this._onOverlayFocusHandler, M);
|
|
M.blurEvent.unsubscribe(this._onOverlayBlurHandler, M);
|
|
if (!L) {
|
|
C.removeListener(M.element, this.cfg.getProperty("focusevent"), this._onOverlayElementFocus);
|
|
M.cfg.setProperty("zIndex", J, true);
|
|
M.cfg.setProperty("manager", null);
|
|
}
|
|
if (M.focusEvent._managed) {
|
|
M.focusEvent = null;
|
|
}
|
|
if (M.blurEvent._managed) {
|
|
M.blurEvent = null;
|
|
}
|
|
if (M.focus._managed) {
|
|
M.focus = null;
|
|
}
|
|
if (M.blur._managed) {
|
|
M.blur = null;
|
|
}
|
|
}
|
|
};
|
|
this.blurAll = function () {
|
|
var K = this.overlays.length, J;
|
|
if (K > 0) {
|
|
J = K - 1;
|
|
do {
|
|
this.overlays[J].blur();
|
|
} while (J--);
|
|
}
|
|
};
|
|
this._manageBlur = function (J) {
|
|
var K = false;
|
|
if (H == J) {
|
|
E.removeClass(H.element, A.CSS_FOCUSED);
|
|
H = null;
|
|
K = true;
|
|
}
|
|
return K;
|
|
};
|
|
this._manageFocus = function (J) {
|
|
var K = false;
|
|
if (H != J) {
|
|
if (H) {
|
|
H.blur();
|
|
}
|
|
H = J;
|
|
this.bringToTop(H);
|
|
E.addClass(H.element, A.CSS_FOCUSED);
|
|
K = true;
|
|
}
|
|
return K;
|
|
};
|
|
var G = this.cfg.getProperty("overlays");
|
|
if (!this.overlays) {
|
|
this.overlays = [];
|
|
}
|
|
if (G) {
|
|
this.register(G);
|
|
this.overlays.sort(this.compareZIndexDesc);
|
|
}
|
|
}, _onOverlayElementFocus: function (I) {
|
|
var G = C.getTarget(I), H = this.close;
|
|
if (H && (G == H || E.isAncestor(H, G))) {
|
|
this.blur();
|
|
} else {
|
|
this.focus();
|
|
}
|
|
}, _onOverlayDestroy: function (H, G, I) {
|
|
this.remove(I);
|
|
}, _onOverlayFocusHandler: function (H, G, I) {
|
|
this._manageFocus(I);
|
|
}, _onOverlayBlurHandler: function (H, G, I) {
|
|
this._manageBlur(I);
|
|
}, _bindFocus: function (G) {
|
|
var H = this;
|
|
if (!G.focusEvent) {
|
|
G.focusEvent = G.createEvent("focus");
|
|
G.focusEvent.signature = F.LIST;
|
|
G.focusEvent._managed = true;
|
|
} else {
|
|
G.focusEvent.subscribe(H._onOverlayFocusHandler, G, H);
|
|
}
|
|
if (!G.focus) {
|
|
C.on(G.element, H.cfg.getProperty("focusevent"), H._onOverlayElementFocus, null, G);
|
|
G.focus = function () {
|
|
if (H._manageFocus(this)) {
|
|
if (this.cfg.getProperty("visible") && this.focusFirst) {
|
|
this.focusFirst();
|
|
}
|
|
this.focusEvent.fire();
|
|
}
|
|
};
|
|
G.focus._managed = true;
|
|
}
|
|
}, _bindBlur: function (G) {
|
|
var H = this;
|
|
if (!G.blurEvent) {
|
|
G.blurEvent = G.createEvent("blur");
|
|
G.blurEvent.signature = F.LIST;
|
|
G.focusEvent._managed = true;
|
|
} else {
|
|
G.blurEvent.subscribe(H._onOverlayBlurHandler, G, H);
|
|
}
|
|
if (!G.blur) {
|
|
G.blur = function () {
|
|
if (H._manageBlur(this)) {
|
|
this.blurEvent.fire();
|
|
}
|
|
};
|
|
G.blur._managed = true;
|
|
}
|
|
G.hideEvent.subscribe(G.blur);
|
|
}, _bindDestroy: function (G) {
|
|
var H = this;
|
|
G.destroyEvent.subscribe(H._onOverlayDestroy, G, H);
|
|
}, _syncZIndex: function (G) {
|
|
var H = E.getStyle(G.element, "zIndex");
|
|
if (!isNaN(H)) {
|
|
G.cfg.setProperty("zIndex", parseInt(H, 10));
|
|
} else {
|
|
G.cfg.setProperty("zIndex", 0);
|
|
}
|
|
}, register: function (G) {
|
|
var K, J = false, H, I;
|
|
if (G instanceof D) {
|
|
G.cfg.addProperty("manager", {value: this});
|
|
this._bindFocus(G);
|
|
this._bindBlur(G);
|
|
this._bindDestroy(G);
|
|
this._syncZIndex(G);
|
|
this.overlays.push(G);
|
|
this.bringToTop(G);
|
|
J = true;
|
|
} else {
|
|
if (G instanceof Array) {
|
|
for (H = 0, I = G.length; H < I; H++) {
|
|
J = this.register(G[H]) || J;
|
|
}
|
|
}
|
|
}
|
|
return J;
|
|
}, bringToTop: function (M) {
|
|
var I = this.find(M), L, G, J;
|
|
if (I) {
|
|
J = this.overlays;
|
|
J.sort(this.compareZIndexDesc);
|
|
G = J[0];
|
|
if (G) {
|
|
L = E.getStyle(G.element, "zIndex");
|
|
if (!isNaN(L)) {
|
|
var K = false;
|
|
if (G !== I) {
|
|
K = true;
|
|
} else {
|
|
if (J.length > 1) {
|
|
var H = E.getStyle(J[1].element, "zIndex");
|
|
if (!isNaN(H) && (L == H)) {
|
|
K = true;
|
|
}
|
|
}
|
|
}
|
|
if (K) {
|
|
I.cfg.setProperty("zindex", (parseInt(L, 10) + 2));
|
|
}
|
|
}
|
|
J.sort(this.compareZIndexDesc);
|
|
}
|
|
}
|
|
}, find: function (G) {
|
|
var K = G instanceof D, I = this.overlays, M = I.length, J = null, L, H;
|
|
if (K || typeof G == "string") {
|
|
for (H = M - 1; H >= 0; H--) {
|
|
L = I[H];
|
|
if ((K && (L === G)) || (L.id == G)) {
|
|
J = L;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return J;
|
|
}, compareZIndexDesc: function (J, I) {
|
|
var H = (J.cfg) ? J.cfg.getProperty("zIndex") : null, G = (I.cfg) ? I.cfg.getProperty("zIndex") : null;
|
|
if (H === null && G === null) {
|
|
return 0;
|
|
} else {
|
|
if (H === null) {
|
|
return 1;
|
|
} else {
|
|
if (G === null) {
|
|
return -1;
|
|
} else {
|
|
if (H > G) {
|
|
return -1;
|
|
} else {
|
|
if (H < G) {
|
|
return 1;
|
|
} else {
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, showAll: function () {
|
|
var H = this.overlays, I = H.length, G;
|
|
for (G = I - 1; G >= 0; G--) {
|
|
H[G].show();
|
|
}
|
|
}, hideAll: function () {
|
|
var H = this.overlays, I = H.length, G;
|
|
for (G = I - 1; G >= 0; G--) {
|
|
H[G].hide();
|
|
}
|
|
}, toString: function () {
|
|
return "OverlayManager";
|
|
}
|
|
};
|
|
}());
|
|
(function () {
|
|
YAHOO.widget.Tooltip = function (N, M) {
|
|
YAHOO.widget.Tooltip.superclass.constructor.call(this, N, M);
|
|
};
|
|
var E = YAHOO.lang, L = YAHOO.util.Event, K = YAHOO.util.CustomEvent, C = YAHOO.util.Dom, G = YAHOO.widget.Tooltip, F, H = {
|
|
"PREVENT_OVERLAP": {
|
|
key: "preventoverlap",
|
|
value: true,
|
|
validator: E.isBoolean,
|
|
supercedes: ["x", "y", "xy"]
|
|
},
|
|
"SHOW_DELAY": {key: "showdelay", value: 200, validator: E.isNumber},
|
|
"AUTO_DISMISS_DELAY": {key: "autodismissdelay", value: 5000, validator: E.isNumber},
|
|
"HIDE_DELAY": {key: "hidedelay", value: 250, validator: E.isNumber},
|
|
"TEXT": {key: "text", suppressEvent: true},
|
|
"CONTAINER": {key: "container"},
|
|
"DISABLED": {key: "disabled", value: false, suppressEvent: true}
|
|
}, A = {
|
|
"CONTEXT_MOUSE_OVER": "contextMouseOver",
|
|
"CONTEXT_MOUSE_OUT": "contextMouseOut",
|
|
"CONTEXT_TRIGGER": "contextTrigger"
|
|
};
|
|
G.CSS_TOOLTIP = "yui-tt";
|
|
function I(N, M, O) {
|
|
var R = O[0], P = O[1], Q = this.cfg, S = Q.getProperty("width");
|
|
if (S == P) {
|
|
Q.setProperty("width", R);
|
|
}
|
|
}
|
|
|
|
function D(N, M) {
|
|
var O = document.body, S = this.cfg, R = S.getProperty("width"), P, Q;
|
|
if ((!R || R == "auto") && (S.getProperty("container") != O || S.getProperty("x") >= C.getViewportWidth() || S.getProperty("y") >= C.getViewportHeight())) {
|
|
Q = this.element.cloneNode(true);
|
|
Q.style.visibility = "hidden";
|
|
Q.style.top = "0px";
|
|
Q.style.left = "0px";
|
|
O.appendChild(Q);
|
|
P = (Q.offsetWidth + "px");
|
|
O.removeChild(Q);
|
|
Q = null;
|
|
S.setProperty("width", P);
|
|
S.refireEvent("xy");
|
|
this.subscribe("hide", I, [(R || ""), P]);
|
|
}
|
|
}
|
|
|
|
function B(N, M, O) {
|
|
this.render(O);
|
|
}
|
|
|
|
function J() {
|
|
L.onDOMReady(B, this.cfg.getProperty("container"), this);
|
|
}
|
|
|
|
YAHOO.extend(G, YAHOO.widget.Overlay, {
|
|
init: function (N, M) {
|
|
G.superclass.init.call(this, N);
|
|
this.beforeInitEvent.fire(G);
|
|
C.addClass(this.element, G.CSS_TOOLTIP);
|
|
if (M) {
|
|
this.cfg.applyConfig(M, true);
|
|
}
|
|
this.cfg.queueProperty("visible", false);
|
|
this.cfg.queueProperty("constraintoviewport", true);
|
|
this.setBody("");
|
|
this.subscribe("beforeShow", D);
|
|
this.subscribe("init", J);
|
|
this.subscribe("render", this.onRender);
|
|
this.initEvent.fire(G);
|
|
}, initEvents: function () {
|
|
G.superclass.initEvents.call(this);
|
|
var M = K.LIST;
|
|
this.contextMouseOverEvent = this.createEvent(A.CONTEXT_MOUSE_OVER);
|
|
this.contextMouseOverEvent.signature = M;
|
|
this.contextMouseOutEvent = this.createEvent(A.CONTEXT_MOUSE_OUT);
|
|
this.contextMouseOutEvent.signature = M;
|
|
this.contextTriggerEvent = this.createEvent(A.CONTEXT_TRIGGER);
|
|
this.contextTriggerEvent.signature = M;
|
|
}, initDefaultConfig: function () {
|
|
G.superclass.initDefaultConfig.call(this);
|
|
this.cfg.addProperty(H.PREVENT_OVERLAP.key, {
|
|
value: H.PREVENT_OVERLAP.value,
|
|
validator: H.PREVENT_OVERLAP.validator,
|
|
supercedes: H.PREVENT_OVERLAP.supercedes
|
|
});
|
|
this.cfg.addProperty(H.SHOW_DELAY.key, {
|
|
handler: this.configShowDelay,
|
|
value: 200,
|
|
validator: H.SHOW_DELAY.validator
|
|
});
|
|
this.cfg.addProperty(H.AUTO_DISMISS_DELAY.key, {
|
|
handler: this.configAutoDismissDelay,
|
|
value: H.AUTO_DISMISS_DELAY.value,
|
|
validator: H.AUTO_DISMISS_DELAY.validator
|
|
});
|
|
this.cfg.addProperty(H.HIDE_DELAY.key, {
|
|
handler: this.configHideDelay,
|
|
value: H.HIDE_DELAY.value,
|
|
validator: H.HIDE_DELAY.validator
|
|
});
|
|
this.cfg.addProperty(H.TEXT.key, {handler: this.configText, suppressEvent: H.TEXT.suppressEvent});
|
|
this.cfg.addProperty(H.CONTAINER.key, {handler: this.configContainer, value: document.body});
|
|
this.cfg.addProperty(H.DISABLED.key, {
|
|
handler: this.configContainer,
|
|
value: H.DISABLED.value,
|
|
supressEvent: H.DISABLED.suppressEvent
|
|
});
|
|
}, configText: function (N, M, O) {
|
|
var P = M[0];
|
|
if (P) {
|
|
this.setBody(P);
|
|
}
|
|
}, configContainer: function (O, N, P) {
|
|
var M = N[0];
|
|
if (typeof M == "string") {
|
|
this.cfg.setProperty("container", document.getElementById(M), true);
|
|
}
|
|
}, _removeEventListeners: function () {
|
|
var P = this._context, M, O, N;
|
|
if (P) {
|
|
M = P.length;
|
|
if (M > 0) {
|
|
N = M - 1;
|
|
do {
|
|
O = P[N];
|
|
L.removeListener(O, "mouseover", this.onContextMouseOver);
|
|
L.removeListener(O, "mousemove", this.onContextMouseMove);
|
|
L.removeListener(O, "mouseout", this.onContextMouseOut);
|
|
} while (N--);
|
|
}
|
|
}
|
|
}, configContext: function (R, N, S) {
|
|
var Q = N[0], T, M, P, O;
|
|
if (Q) {
|
|
if (!(Q instanceof Array)) {
|
|
if (typeof Q == "string") {
|
|
this.cfg.setProperty("context", [document.getElementById(Q)], true);
|
|
} else {
|
|
this.cfg.setProperty("context", [Q], true);
|
|
}
|
|
Q = this.cfg.getProperty("context");
|
|
}
|
|
this._removeEventListeners();
|
|
this._context = Q;
|
|
T = this._context;
|
|
if (T) {
|
|
M = T.length;
|
|
if (M > 0) {
|
|
O = M - 1;
|
|
do {
|
|
P = T[O];
|
|
L.on(P, "mouseover", this.onContextMouseOver, this);
|
|
L.on(P, "mousemove", this.onContextMouseMove, this);
|
|
L.on(P, "mouseout", this.onContextMouseOut, this);
|
|
} while (O--);
|
|
}
|
|
}
|
|
}
|
|
}, onContextMouseMove: function (N, M) {
|
|
M.pageX = L.getPageX(N);
|
|
M.pageY = L.getPageY(N);
|
|
}, onContextMouseOver: function (O, N) {
|
|
var M = this;
|
|
if (M.title) {
|
|
N._tempTitle = M.title;
|
|
M.title = "";
|
|
}
|
|
if (N.fireEvent("contextMouseOver", M, O) !== false && !N.cfg.getProperty("disabled")) {
|
|
if (N.hideProcId) {
|
|
clearTimeout(N.hideProcId);
|
|
N.hideProcId = null;
|
|
}
|
|
L.on(M, "mousemove", N.onContextMouseMove, N);
|
|
N.showProcId = N.doShow(O, M);
|
|
}
|
|
}, onContextMouseOut: function (O, N) {
|
|
var M = this;
|
|
if (N._tempTitle) {
|
|
M.title = N._tempTitle;
|
|
N._tempTitle = null;
|
|
}
|
|
if (N.showProcId) {
|
|
clearTimeout(N.showProcId);
|
|
N.showProcId = null;
|
|
}
|
|
if (N.hideProcId) {
|
|
clearTimeout(N.hideProcId);
|
|
N.hideProcId = null;
|
|
}
|
|
N.fireEvent("contextMouseOut", M, O);
|
|
N.hideProcId = setTimeout(function () {
|
|
N.hide();
|
|
}, N.cfg.getProperty("hidedelay"));
|
|
}, doShow: function (O, M) {
|
|
var P = 25, N = this;
|
|
if (YAHOO.env.ua.opera && M.tagName && M.tagName.toUpperCase() == "A") {
|
|
P += 12;
|
|
}
|
|
return setTimeout(function () {
|
|
var Q = N.cfg.getProperty("text");
|
|
if (N._tempTitle && (Q === "" || YAHOO.lang.isUndefined(Q) || YAHOO.lang.isNull(Q))) {
|
|
N.setBody(N._tempTitle);
|
|
} else {
|
|
N.cfg.refireEvent("text");
|
|
}
|
|
N.moveTo(N.pageX, N.pageY + P);
|
|
if (N.cfg.getProperty("preventoverlap")) {
|
|
N.preventOverlap(N.pageX, N.pageY);
|
|
}
|
|
L.removeListener(M, "mousemove", N.onContextMouseMove);
|
|
N.contextTriggerEvent.fire(M);
|
|
N.show();
|
|
N.hideProcId = N.doHide();
|
|
}, this.cfg.getProperty("showdelay"));
|
|
}, doHide: function () {
|
|
var M = this;
|
|
return setTimeout(function () {
|
|
M.hide();
|
|
}, this.cfg.getProperty("autodismissdelay"));
|
|
}, preventOverlap: function (Q, P) {
|
|
var M = this.element.offsetHeight, O = new YAHOO.util.Point(Q, P), N = C.getRegion(this.element);
|
|
N.top -= 5;
|
|
N.left -= 5;
|
|
N.right += 5;
|
|
N.bottom += 5;
|
|
if (N.contains(O)) {
|
|
this.cfg.setProperty("y", (P - M - 5));
|
|
}
|
|
}, onRender: function (Q, P) {
|
|
function R() {
|
|
var U = this.element, T = this._shadow;
|
|
if (T) {
|
|
T.style.width = (U.offsetWidth + 6) + "px";
|
|
T.style.height = (U.offsetHeight + 1) + "px";
|
|
}
|
|
}
|
|
|
|
function N() {
|
|
C.addClass(this._shadow, "yui-tt-shadow-visible");
|
|
}
|
|
|
|
function M() {
|
|
C.removeClass(this._shadow, "yui-tt-shadow-visible");
|
|
}
|
|
|
|
function S() {
|
|
var V = this._shadow, U, T, X, W;
|
|
if (!V) {
|
|
U = this.element;
|
|
T = YAHOO.widget.Module;
|
|
X = YAHOO.env.ua.ie;
|
|
W = this;
|
|
if (!F) {
|
|
F = document.createElement("div");
|
|
F.className = "yui-tt-shadow";
|
|
}
|
|
V = F.cloneNode(false);
|
|
U.appendChild(V);
|
|
this._shadow = V;
|
|
N.call(this);
|
|
this.subscribe("beforeShow", N);
|
|
this.subscribe("beforeHide", M);
|
|
if (X == 6 || (X == 7 && document.compatMode == "BackCompat")) {
|
|
window.setTimeout(function () {
|
|
R.call(W);
|
|
}, 0);
|
|
this.cfg.subscribeToConfigEvent("width", R);
|
|
this.cfg.subscribeToConfigEvent("height", R);
|
|
this.subscribe("changeContent", R);
|
|
T.textResizeEvent.subscribe(R, this, true);
|
|
this.subscribe("destroy", function () {
|
|
T.textResizeEvent.unsubscribe(R, this);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
function O() {
|
|
S.call(this);
|
|
this.unsubscribe("beforeShow", O);
|
|
}
|
|
|
|
if (this.cfg.getProperty("visible")) {
|
|
S.call(this);
|
|
} else {
|
|
this.subscribe("beforeShow", O);
|
|
}
|
|
}, destroy: function () {
|
|
this._removeEventListeners();
|
|
G.superclass.destroy.call(this);
|
|
}, toString: function () {
|
|
return "Tooltip " + this.id;
|
|
}
|
|
});
|
|
}());
|
|
(function () {
|
|
YAHOO.widget.Panel = function (V, U) {
|
|
YAHOO.widget.Panel.superclass.constructor.call(this, V, U);
|
|
};
|
|
var S = null;
|
|
var E = YAHOO.lang, F = YAHOO.util, A = F.Dom, T = F.Event, M = F.CustomEvent, K = YAHOO.util.KeyListener, I = F.Config, H = YAHOO.widget.Overlay, O = YAHOO.widget.Panel, L = YAHOO.env.ua, P = (L.ie == 6 || (L.ie == 7 && document.compatMode == "BackCompat")), G, Q, C, D = {
|
|
"SHOW_MASK": "showMask",
|
|
"HIDE_MASK": "hideMask",
|
|
"DRAG": "drag"
|
|
}, N = {
|
|
"CLOSE": {key: "close", value: true, validator: E.isBoolean, supercedes: ["visible"]},
|
|
"DRAGGABLE": {key: "draggable", value: (F.DD ? true : false), validator: E.isBoolean, supercedes: ["visible"]},
|
|
"DRAG_ONLY": {key: "dragonly", value: false, validator: E.isBoolean, supercedes: ["draggable"]},
|
|
"UNDERLAY": {key: "underlay", value: "shadow", supercedes: ["visible"]},
|
|
"MODAL": {key: "modal", value: false, validator: E.isBoolean, supercedes: ["visible", "zindex"]},
|
|
"KEY_LISTENERS": {key: "keylisteners", suppressEvent: true, supercedes: ["visible"]},
|
|
"STRINGS": {key: "strings", supercedes: ["close"], validator: E.isObject, value: {close: "Close"}}
|
|
};
|
|
O.CSS_PANEL = "yui-panel";
|
|
O.CSS_PANEL_CONTAINER = "yui-panel-container";
|
|
O.FOCUSABLE = ["a", "button", "select", "textarea", "input", "iframe"];
|
|
function J(V, U) {
|
|
if (!this.header && this.cfg.getProperty("draggable")) {
|
|
this.setHeader(" ");
|
|
}
|
|
}
|
|
|
|
function R(V, U, W) {
|
|
var Z = W[0], X = W[1], Y = this.cfg, a = Y.getProperty("width");
|
|
if (a == X) {
|
|
Y.setProperty("width", Z);
|
|
}
|
|
this.unsubscribe("hide", R, W);
|
|
}
|
|
|
|
function B(V, U) {
|
|
var Z = YAHOO.env.ua.ie, Y, X, W;
|
|
if (Z == 6 || (Z == 7 && document.compatMode == "BackCompat")) {
|
|
Y = this.cfg;
|
|
X = Y.getProperty("width");
|
|
if (!X || X == "auto") {
|
|
W = (this.element.offsetWidth + "px");
|
|
Y.setProperty("width", W);
|
|
this.subscribe("hide", R, [(X || ""), W]);
|
|
}
|
|
}
|
|
}
|
|
|
|
YAHOO.extend(O, H, {
|
|
init: function (V, U) {
|
|
O.superclass.init.call(this, V);
|
|
this.beforeInitEvent.fire(O);
|
|
A.addClass(this.element, O.CSS_PANEL);
|
|
this.buildWrapper();
|
|
if (U) {
|
|
this.cfg.applyConfig(U, true);
|
|
}
|
|
this.subscribe("showMask", this._addFocusHandlers);
|
|
this.subscribe("hideMask", this._removeFocusHandlers);
|
|
this.subscribe("beforeRender", J);
|
|
this.subscribe("render", function () {
|
|
this.setFirstLastFocusable();
|
|
this.subscribe("changeContent", this.setFirstLastFocusable);
|
|
});
|
|
this.subscribe("show", this.focusFirst);
|
|
this.initEvent.fire(O);
|
|
}, _onElementFocus: function (X) {
|
|
var W = T.getTarget(X);
|
|
if (W !== this.element && !A.isAncestor(this.element, W) && S == this) {
|
|
try {
|
|
if (this.firstElement) {
|
|
this.firstElement.focus();
|
|
} else {
|
|
if (this._modalFocus) {
|
|
this._modalFocus.focus();
|
|
} else {
|
|
this.innerElement.focus();
|
|
}
|
|
}
|
|
} catch (V) {
|
|
try {
|
|
if (W !== document && W !== document.body && W !== window) {
|
|
W.blur();
|
|
}
|
|
} catch (U) {
|
|
}
|
|
}
|
|
}
|
|
}, _addFocusHandlers: function (V, U) {
|
|
if (!this.firstElement) {
|
|
if (L.webkit || L.opera) {
|
|
if (!this._modalFocus) {
|
|
this._createHiddenFocusElement();
|
|
}
|
|
} else {
|
|
this.innerElement.tabIndex = 0;
|
|
}
|
|
}
|
|
this.setTabLoop(this.firstElement, this.lastElement);
|
|
T.onFocus(document.documentElement, this._onElementFocus, this, true);
|
|
S = this;
|
|
}, _createHiddenFocusElement: function () {
|
|
var U = document.createElement("button");
|
|
U.style.height = "1px";
|
|
U.style.width = "1px";
|
|
U.style.position = "absolute";
|
|
U.style.left = "-10000em";
|
|
U.style.opacity = 0;
|
|
U.tabIndex = "-1";
|
|
this.innerElement.appendChild(U);
|
|
this._modalFocus = U;
|
|
}, _removeFocusHandlers: function (V, U) {
|
|
T.removeFocusListener(document.documentElement, this._onElementFocus, this);
|
|
if (S == this) {
|
|
S = null;
|
|
}
|
|
}, focusFirst: function (W, U, Y) {
|
|
var V = this.firstElement;
|
|
if (U && U[1]) {
|
|
T.stopEvent(U[1]);
|
|
}
|
|
if (V) {
|
|
try {
|
|
V.focus();
|
|
} catch (X) {
|
|
}
|
|
}
|
|
}, focusLast: function (W, U, Y) {
|
|
var V = this.lastElement;
|
|
if (U && U[1]) {
|
|
T.stopEvent(U[1]);
|
|
}
|
|
if (V) {
|
|
try {
|
|
V.focus();
|
|
} catch (X) {
|
|
}
|
|
}
|
|
}, setTabLoop: function (X, Z) {
|
|
var V = this.preventBackTab, W = this.preventTabOut, U = this.showEvent, Y = this.hideEvent;
|
|
if (V) {
|
|
V.disable();
|
|
U.unsubscribe(V.enable, V);
|
|
Y.unsubscribe(V.disable, V);
|
|
V = this.preventBackTab = null;
|
|
}
|
|
if (W) {
|
|
W.disable();
|
|
U.unsubscribe(W.enable, W);
|
|
Y.unsubscribe(W.disable, W);
|
|
W = this.preventTabOut = null;
|
|
}
|
|
if (X) {
|
|
this.preventBackTab = new K(X, {shift: true, keys: 9}, {fn: this.focusLast, scope: this, correctScope: true});
|
|
V = this.preventBackTab;
|
|
U.subscribe(V.enable, V, true);
|
|
Y.subscribe(V.disable, V, true);
|
|
}
|
|
if (Z) {
|
|
this.preventTabOut = new K(Z, {shift: false, keys: 9}, {fn: this.focusFirst, scope: this, correctScope: true});
|
|
W = this.preventTabOut;
|
|
U.subscribe(W.enable, W, true);
|
|
Y.subscribe(W.disable, W, true);
|
|
}
|
|
}, getFocusableElements: function (U) {
|
|
U = U || this.innerElement;
|
|
var X = {};
|
|
for (var W = 0; W < O.FOCUSABLE.length; W++) {
|
|
X[O.FOCUSABLE[W]] = true;
|
|
}
|
|
function V(Y) {
|
|
if (Y.focus && Y.type !== "hidden" && !Y.disabled && X[Y.tagName.toLowerCase()]) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
return A.getElementsBy(V, null, U);
|
|
}, setFirstLastFocusable: function () {
|
|
this.firstElement = null;
|
|
this.lastElement = null;
|
|
var U = this.getFocusableElements();
|
|
this.focusableElements = U;
|
|
if (U.length > 0) {
|
|
this.firstElement = U[0];
|
|
this.lastElement = U[U.length - 1];
|
|
}
|
|
if (this.cfg.getProperty("modal")) {
|
|
this.setTabLoop(this.firstElement, this.lastElement);
|
|
}
|
|
}, initEvents: function () {
|
|
O.superclass.initEvents.call(this);
|
|
var U = M.LIST;
|
|
this.showMaskEvent = this.createEvent(D.SHOW_MASK);
|
|
this.showMaskEvent.signature = U;
|
|
this.hideMaskEvent = this.createEvent(D.HIDE_MASK);
|
|
this.hideMaskEvent.signature = U;
|
|
this.dragEvent = this.createEvent(D.DRAG);
|
|
this.dragEvent.signature = U;
|
|
}, initDefaultConfig: function () {
|
|
O.superclass.initDefaultConfig.call(this);
|
|
this.cfg.addProperty(N.CLOSE.key, {
|
|
handler: this.configClose,
|
|
value: N.CLOSE.value,
|
|
validator: N.CLOSE.validator,
|
|
supercedes: N.CLOSE.supercedes
|
|
});
|
|
this.cfg.addProperty(N.DRAGGABLE.key, {
|
|
handler: this.configDraggable,
|
|
value: (F.DD) ? true : false,
|
|
validator: N.DRAGGABLE.validator,
|
|
supercedes: N.DRAGGABLE.supercedes
|
|
});
|
|
this.cfg.addProperty(N.DRAG_ONLY.key, {
|
|
value: N.DRAG_ONLY.value,
|
|
validator: N.DRAG_ONLY.validator,
|
|
supercedes: N.DRAG_ONLY.supercedes
|
|
});
|
|
this.cfg.addProperty(N.UNDERLAY.key, {
|
|
handler: this.configUnderlay,
|
|
value: N.UNDERLAY.value,
|
|
supercedes: N.UNDERLAY.supercedes
|
|
});
|
|
this.cfg.addProperty(N.MODAL.key, {
|
|
handler: this.configModal,
|
|
value: N.MODAL.value,
|
|
validator: N.MODAL.validator,
|
|
supercedes: N.MODAL.supercedes
|
|
});
|
|
this.cfg.addProperty(N.KEY_LISTENERS.key, {
|
|
handler: this.configKeyListeners,
|
|
suppressEvent: N.KEY_LISTENERS.suppressEvent,
|
|
supercedes: N.KEY_LISTENERS.supercedes
|
|
});
|
|
this.cfg.addProperty(N.STRINGS.key, {
|
|
value: N.STRINGS.value,
|
|
handler: this.configStrings,
|
|
validator: N.STRINGS.validator,
|
|
supercedes: N.STRINGS.supercedes
|
|
});
|
|
}, configClose: function (X, V, Y) {
|
|
var Z = V[0], W = this.close, U = this.cfg.getProperty("strings");
|
|
if (Z) {
|
|
if (!W) {
|
|
if (!C) {
|
|
C = document.createElement("a");
|
|
C.className = "container-close";
|
|
C.href = "#";
|
|
}
|
|
W = C.cloneNode(true);
|
|
this.innerElement.appendChild(W);
|
|
W.innerHTML = (U && U.close) ? U.close : " ";
|
|
T.on(W, "click", this._doClose, this, true);
|
|
this.close = W;
|
|
} else {
|
|
W.style.display = "block";
|
|
}
|
|
} else {
|
|
if (W) {
|
|
W.style.display = "none";
|
|
}
|
|
}
|
|
}, _doClose: function (U) {
|
|
T.preventDefault(U);
|
|
this.hide();
|
|
}, configDraggable: function (V, U, W) {
|
|
var X = U[0];
|
|
if (X) {
|
|
if (!F.DD) {
|
|
this.cfg.setProperty("draggable", false);
|
|
return;
|
|
}
|
|
if (this.header) {
|
|
A.setStyle(this.header, "cursor", "move");
|
|
this.registerDragDrop();
|
|
}
|
|
this.subscribe("beforeShow", B);
|
|
} else {
|
|
if (this.dd) {
|
|
this.dd.unreg();
|
|
}
|
|
if (this.header) {
|
|
A.setStyle(this.header, "cursor", "auto");
|
|
}
|
|
this.unsubscribe("beforeShow", B);
|
|
}
|
|
}, configUnderlay: function (d, c, Z) {
|
|
var b = (this.platform == "mac" && L.gecko), e = c[0].toLowerCase(), V = this.underlay, W = this.element;
|
|
|
|
function f() {
|
|
var g = this.underlay;
|
|
A.addClass(g, "yui-force-redraw");
|
|
window.setTimeout(function () {
|
|
A.removeClass(g, "yui-force-redraw");
|
|
}, 0);
|
|
}
|
|
|
|
function X() {
|
|
var g = false;
|
|
if (!V) {
|
|
if (!Q) {
|
|
Q = document.createElement("div");
|
|
Q.className = "underlay";
|
|
}
|
|
V = Q.cloneNode(false);
|
|
this.element.appendChild(V);
|
|
this.underlay = V;
|
|
if (P) {
|
|
this.sizeUnderlay();
|
|
this.cfg.subscribeToConfigEvent("width", this.sizeUnderlay);
|
|
this.cfg.subscribeToConfigEvent("height", this.sizeUnderlay);
|
|
this.changeContentEvent.subscribe(this.sizeUnderlay);
|
|
YAHOO.widget.Module.textResizeEvent.subscribe(this.sizeUnderlay, this, true);
|
|
}
|
|
if (L.webkit && L.webkit < 420) {
|
|
this.changeContentEvent.subscribe(f);
|
|
}
|
|
g = true;
|
|
}
|
|
}
|
|
|
|
function a() {
|
|
var g = X.call(this);
|
|
if (!g && P) {
|
|
this.sizeUnderlay();
|
|
}
|
|
this._underlayDeferred = false;
|
|
this.beforeShowEvent.unsubscribe(a);
|
|
}
|
|
|
|
function Y() {
|
|
if (this._underlayDeferred) {
|
|
this.beforeShowEvent.unsubscribe(a);
|
|
this._underlayDeferred = false;
|
|
}
|
|
if (V) {
|
|
this.cfg.unsubscribeFromConfigEvent("width", this.sizeUnderlay);
|
|
this.cfg.unsubscribeFromConfigEvent("height", this.sizeUnderlay);
|
|
this.changeContentEvent.unsubscribe(this.sizeUnderlay);
|
|
this.changeContentEvent.unsubscribe(f);
|
|
YAHOO.widget.Module.textResizeEvent.unsubscribe(this.sizeUnderlay, this, true);
|
|
this.element.removeChild(V);
|
|
this.underlay = null;
|
|
}
|
|
}
|
|
|
|
switch (e) {
|
|
case"shadow":
|
|
A.removeClass(W, "matte");
|
|
A.addClass(W, "shadow");
|
|
break;
|
|
case"matte":
|
|
if (!b) {
|
|
Y.call(this);
|
|
}
|
|
A.removeClass(W, "shadow");
|
|
A.addClass(W, "matte");
|
|
break;
|
|
default:
|
|
if (!b) {
|
|
Y.call(this);
|
|
}
|
|
A.removeClass(W, "shadow");
|
|
A.removeClass(W, "matte");
|
|
break;
|
|
}
|
|
if ((e == "shadow") || (b && !V)) {
|
|
if (this.cfg.getProperty("visible")) {
|
|
var U = X.call(this);
|
|
if (!U && P) {
|
|
this.sizeUnderlay();
|
|
}
|
|
} else {
|
|
if (!this._underlayDeferred) {
|
|
this.beforeShowEvent.subscribe(a);
|
|
this._underlayDeferred = true;
|
|
}
|
|
}
|
|
}
|
|
}, configModal: function (V, U, X) {
|
|
var W = U[0];
|
|
if (W) {
|
|
if (!this._hasModalityEventListeners) {
|
|
this.subscribe("beforeShow", this.buildMask);
|
|
this.subscribe("beforeShow", this.bringToTop);
|
|
this.subscribe("beforeShow", this.showMask);
|
|
this.subscribe("hide", this.hideMask);
|
|
H.windowResizeEvent.subscribe(this.sizeMask, this, true);
|
|
this._hasModalityEventListeners = true;
|
|
}
|
|
} else {
|
|
if (this._hasModalityEventListeners) {
|
|
if (this.cfg.getProperty("visible")) {
|
|
this.hideMask();
|
|
this.removeMask();
|
|
}
|
|
this.unsubscribe("beforeShow", this.buildMask);
|
|
this.unsubscribe("beforeShow", this.bringToTop);
|
|
this.unsubscribe("beforeShow", this.showMask);
|
|
this.unsubscribe("hide", this.hideMask);
|
|
H.windowResizeEvent.unsubscribe(this.sizeMask, this);
|
|
this._hasModalityEventListeners = false;
|
|
}
|
|
}
|
|
}, removeMask: function () {
|
|
var V = this.mask, U;
|
|
if (V) {
|
|
this.hideMask();
|
|
U = V.parentNode;
|
|
if (U) {
|
|
U.removeChild(V);
|
|
}
|
|
this.mask = null;
|
|
}
|
|
}, configKeyListeners: function (X, U, a) {
|
|
var W = U[0], Z, Y, V;
|
|
if (W) {
|
|
if (W instanceof Array) {
|
|
Y = W.length;
|
|
for (V = 0; V < Y; V++) {
|
|
Z = W[V];
|
|
if (!I.alreadySubscribed(this.showEvent, Z.enable, Z)) {
|
|
this.showEvent.subscribe(Z.enable, Z, true);
|
|
}
|
|
if (!I.alreadySubscribed(this.hideEvent, Z.disable, Z)) {
|
|
this.hideEvent.subscribe(Z.disable, Z, true);
|
|
this.destroyEvent.subscribe(Z.disable, Z, true);
|
|
}
|
|
}
|
|
} else {
|
|
if (!I.alreadySubscribed(this.showEvent, W.enable, W)) {
|
|
this.showEvent.subscribe(W.enable, W, true);
|
|
}
|
|
if (!I.alreadySubscribed(this.hideEvent, W.disable, W)) {
|
|
this.hideEvent.subscribe(W.disable, W, true);
|
|
this.destroyEvent.subscribe(W.disable, W, true);
|
|
}
|
|
}
|
|
}
|
|
}, configStrings: function (V, U, W) {
|
|
var X = E.merge(N.STRINGS.value, U[0]);
|
|
this.cfg.setProperty(N.STRINGS.key, X, true);
|
|
}, configHeight: function (X, V, Y) {
|
|
var U = V[0], W = this.innerElement;
|
|
A.setStyle(W, "height", U);
|
|
this.cfg.refireEvent("iframe");
|
|
}, _autoFillOnHeightChange: function (W, U, V) {
|
|
O.superclass._autoFillOnHeightChange.apply(this, arguments);
|
|
if (P) {
|
|
this.sizeUnderlay();
|
|
}
|
|
}, configWidth: function (X, U, Y) {
|
|
var W = U[0], V = this.innerElement;
|
|
A.setStyle(V, "width", W);
|
|
this.cfg.refireEvent("iframe");
|
|
}, configzIndex: function (V, U, X) {
|
|
O.superclass.configzIndex.call(this, V, U, X);
|
|
if (this.mask || this.cfg.getProperty("modal") === true) {
|
|
var W = A.getStyle(this.element, "zIndex");
|
|
if (!W || isNaN(W)) {
|
|
W = 0;
|
|
}
|
|
if (W === 0) {
|
|
this.cfg.setProperty("zIndex", 1);
|
|
} else {
|
|
this.stackMask();
|
|
}
|
|
}
|
|
}, buildWrapper: function () {
|
|
var W = this.element.parentNode, U = this.element, V = document.createElement("div");
|
|
V.className = O.CSS_PANEL_CONTAINER;
|
|
V.id = U.id + "_c";
|
|
if (W) {
|
|
W.insertBefore(V, U);
|
|
}
|
|
V.appendChild(U);
|
|
this.element = V;
|
|
this.innerElement = U;
|
|
A.setStyle(this.innerElement, "visibility", "inherit");
|
|
}, sizeUnderlay: function () {
|
|
var V = this.underlay, U;
|
|
if (V) {
|
|
U = this.element;
|
|
V.style.width = U.offsetWidth + "px";
|
|
V.style.height = U.offsetHeight + "px";
|
|
}
|
|
}, registerDragDrop: function () {
|
|
var V = this;
|
|
if (this.header) {
|
|
if (!F.DD) {
|
|
return;
|
|
}
|
|
var U = (this.cfg.getProperty("dragonly") === true);
|
|
this.dd = new F.DD(this.element.id, this.id, {dragOnly: U});
|
|
if (!this.header.id) {
|
|
this.header.id = this.id + "_h";
|
|
}
|
|
this.dd.startDrag = function () {
|
|
var X, Z, W, c, b, a;
|
|
if (YAHOO.env.ua.ie == 6) {
|
|
A.addClass(V.element, "drag");
|
|
}
|
|
if (V.cfg.getProperty("constraintoviewport")) {
|
|
var Y = H.VIEWPORT_OFFSET;
|
|
X = V.element.offsetHeight;
|
|
Z = V.element.offsetWidth;
|
|
W = A.getViewportWidth();
|
|
c = A.getViewportHeight();
|
|
b = A.getDocumentScrollLeft();
|
|
a = A.getDocumentScrollTop();
|
|
if (X + Y < c) {
|
|
this.minY = a + Y;
|
|
this.maxY = a + c - X - Y;
|
|
} else {
|
|
this.minY = a + Y;
|
|
this.maxY = a + Y;
|
|
}
|
|
if (Z + Y < W) {
|
|
this.minX = b + Y;
|
|
this.maxX = b + W - Z - Y;
|
|
} else {
|
|
this.minX = b + Y;
|
|
this.maxX = b + Y;
|
|
}
|
|
this.constrainX = true;
|
|
this.constrainY = true;
|
|
} else {
|
|
this.constrainX = false;
|
|
this.constrainY = false;
|
|
}
|
|
V.dragEvent.fire("startDrag", arguments);
|
|
};
|
|
this.dd.onDrag = function () {
|
|
V.syncPosition();
|
|
V.cfg.refireEvent("iframe");
|
|
if (this.platform == "mac" && YAHOO.env.ua.gecko) {
|
|
this.showMacGeckoScrollbars();
|
|
}
|
|
V.dragEvent.fire("onDrag", arguments);
|
|
};
|
|
this.dd.endDrag = function () {
|
|
if (YAHOO.env.ua.ie == 6) {
|
|
A.removeClass(V.element, "drag");
|
|
}
|
|
V.dragEvent.fire("endDrag", arguments);
|
|
V.moveEvent.fire(V.cfg.getProperty("xy"));
|
|
};
|
|
this.dd.setHandleElId(this.header.id);
|
|
this.dd.addInvalidHandleType("INPUT");
|
|
this.dd.addInvalidHandleType("SELECT");
|
|
this.dd.addInvalidHandleType("TEXTAREA");
|
|
}
|
|
}, buildMask: function () {
|
|
var U = this.mask;
|
|
if (!U) {
|
|
if (!G) {
|
|
G = document.createElement("div");
|
|
G.className = "mask";
|
|
G.innerHTML = " ";
|
|
}
|
|
U = G.cloneNode(true);
|
|
U.id = this.id + "_mask";
|
|
document.body.insertBefore(U, document.body.firstChild);
|
|
this.mask = U;
|
|
if (YAHOO.env.ua.gecko && this.platform == "mac") {
|
|
A.addClass(this.mask, "block-scrollbars");
|
|
}
|
|
this.stackMask();
|
|
}
|
|
}, hideMask: function () {
|
|
if (this.cfg.getProperty("modal") && this.mask) {
|
|
this.mask.style.display = "none";
|
|
A.removeClass(document.body, "masked");
|
|
this.hideMaskEvent.fire();
|
|
}
|
|
}, showMask: function () {
|
|
if (this.cfg.getProperty("modal") && this.mask) {
|
|
A.addClass(document.body, "masked");
|
|
this.sizeMask();
|
|
this.mask.style.display = "block";
|
|
this.showMaskEvent.fire();
|
|
}
|
|
}, sizeMask: function () {
|
|
if (this.mask) {
|
|
var V = this.mask, W = A.getViewportWidth(), U = A.getViewportHeight();
|
|
if (this.mask.offsetHeight > U) {
|
|
this.mask.style.height = U + "px";
|
|
}
|
|
if (this.mask.offsetWidth > W) {
|
|
this.mask.style.width = W + "px";
|
|
}
|
|
this.mask.style.height = A.getDocumentHeight() + "px";
|
|
this.mask.style.width = A.getDocumentWidth() + "px";
|
|
}
|
|
}, stackMask: function () {
|
|
if (this.mask) {
|
|
var U = A.getStyle(this.element, "zIndex");
|
|
if (!YAHOO.lang.isUndefined(U) && !isNaN(U)) {
|
|
A.setStyle(this.mask, "zIndex", U - 1);
|
|
}
|
|
}
|
|
}, render: function (U) {
|
|
return O.superclass.render.call(this, U, this.innerElement);
|
|
}, destroy: function () {
|
|
H.windowResizeEvent.unsubscribe(this.sizeMask, this);
|
|
this.removeMask();
|
|
if (this.close) {
|
|
T.purgeElement(this.close);
|
|
}
|
|
O.superclass.destroy.call(this);
|
|
}, toString: function () {
|
|
return "Panel " + this.id;
|
|
}
|
|
});
|
|
}());
|
|
(function () {
|
|
YAHOO.widget.Dialog = function (J, I) {
|
|
YAHOO.widget.Dialog.superclass.constructor.call(this, J, I);
|
|
};
|
|
var B = YAHOO.util.Event, G = YAHOO.util.CustomEvent, E = YAHOO.util.Dom, A = YAHOO.widget.Dialog, F = YAHOO.lang, H = {
|
|
"BEFORE_SUBMIT": "beforeSubmit",
|
|
"SUBMIT": "submit",
|
|
"MANUAL_SUBMIT": "manualSubmit",
|
|
"ASYNC_SUBMIT": "asyncSubmit",
|
|
"FORM_SUBMIT": "formSubmit",
|
|
"CANCEL": "cancel"
|
|
}, C = {
|
|
"POST_METHOD": {key: "postmethod", value: "async"},
|
|
"BUTTONS": {key: "buttons", value: "none", supercedes: ["visible"]},
|
|
"HIDEAFTERSUBMIT": {key: "hideaftersubmit", value: true}
|
|
};
|
|
A.CSS_DIALOG = "yui-dialog";
|
|
function D() {
|
|
var L = this._aButtons, J, K, I;
|
|
if (F.isArray(L)) {
|
|
J = L.length;
|
|
if (J > 0) {
|
|
I = J - 1;
|
|
do {
|
|
K = L[I];
|
|
if (YAHOO.widget.Button && K instanceof YAHOO.widget.Button) {
|
|
K.destroy();
|
|
} else {
|
|
if (K.tagName.toUpperCase() == "BUTTON") {
|
|
B.purgeElement(K);
|
|
B.purgeElement(K, false);
|
|
}
|
|
}
|
|
} while (I--);
|
|
}
|
|
}
|
|
}
|
|
|
|
YAHOO.extend(A, YAHOO.widget.Panel, {
|
|
form: null, initDefaultConfig: function () {
|
|
A.superclass.initDefaultConfig.call(this);
|
|
this.callback = {success: null, failure: null, argument: null};
|
|
this.cfg.addProperty(C.POST_METHOD.key, {
|
|
handler: this.configPostMethod,
|
|
value: C.POST_METHOD.value,
|
|
validator: function (I) {
|
|
if (I != "form" && I != "async" && I != "none" && I != "manual") {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
});
|
|
this.cfg.addProperty(C.HIDEAFTERSUBMIT.key, {value: C.HIDEAFTERSUBMIT.value});
|
|
this.cfg.addProperty(C.BUTTONS.key, {
|
|
handler: this.configButtons,
|
|
value: C.BUTTONS.value,
|
|
supercedes: C.BUTTONS.supercedes
|
|
});
|
|
}, initEvents: function () {
|
|
A.superclass.initEvents.call(this);
|
|
var I = G.LIST;
|
|
this.beforeSubmitEvent = this.createEvent(H.BEFORE_SUBMIT);
|
|
this.beforeSubmitEvent.signature = I;
|
|
this.submitEvent = this.createEvent(H.SUBMIT);
|
|
this.submitEvent.signature = I;
|
|
this.manualSubmitEvent = this.createEvent(H.MANUAL_SUBMIT);
|
|
this.manualSubmitEvent.signature = I;
|
|
this.asyncSubmitEvent = this.createEvent(H.ASYNC_SUBMIT);
|
|
this.asyncSubmitEvent.signature = I;
|
|
this.formSubmitEvent = this.createEvent(H.FORM_SUBMIT);
|
|
this.formSubmitEvent.signature = I;
|
|
this.cancelEvent = this.createEvent(H.CANCEL);
|
|
this.cancelEvent.signature = I;
|
|
}, init: function (J, I) {
|
|
A.superclass.init.call(this, J);
|
|
this.beforeInitEvent.fire(A);
|
|
E.addClass(this.element, A.CSS_DIALOG);
|
|
this.cfg.setProperty("visible", false);
|
|
if (I) {
|
|
this.cfg.applyConfig(I, true);
|
|
}
|
|
this.showEvent.subscribe(this.focusFirst, this, true);
|
|
this.beforeHideEvent.subscribe(this.blurButtons, this, true);
|
|
this.subscribe("changeBody", this.registerForm);
|
|
this.initEvent.fire(A);
|
|
}, doSubmit: function () {
|
|
var J = YAHOO.util.Connect, P = this.form, N = false, M = false, O, I, L, K;
|
|
switch (this.cfg.getProperty("postmethod")) {
|
|
case"async":
|
|
O = P.elements;
|
|
I = O.length;
|
|
if (I > 0) {
|
|
L = I - 1;
|
|
do {
|
|
if (O[L].type == "file") {
|
|
N = true;
|
|
break;
|
|
}
|
|
} while (L--);
|
|
}
|
|
if (N && YAHOO.env.ua.ie && this.isSecure) {
|
|
M = true;
|
|
}
|
|
K = this._getFormAttributes(P);
|
|
J.setForm(P, N, M);
|
|
J.asyncRequest(K.method, K.action, this.callback);
|
|
this.asyncSubmitEvent.fire();
|
|
break;
|
|
case"form":
|
|
P.submit();
|
|
this.formSubmitEvent.fire();
|
|
break;
|
|
case"none":
|
|
case"manual":
|
|
this.manualSubmitEvent.fire();
|
|
break;
|
|
}
|
|
}, _getFormAttributes: function (K) {
|
|
var I = {method: null, action: null};
|
|
if (K) {
|
|
if (K.getAttributeNode) {
|
|
var J = K.getAttributeNode("action");
|
|
var L = K.getAttributeNode("method");
|
|
if (J) {
|
|
I.action = J.value;
|
|
}
|
|
if (L) {
|
|
I.method = L.value;
|
|
}
|
|
} else {
|
|
I.action = K.getAttribute("action");
|
|
I.method = K.getAttribute("method");
|
|
}
|
|
}
|
|
I.method = (F.isString(I.method) ? I.method : "POST").toUpperCase();
|
|
I.action = F.isString(I.action) ? I.action : "";
|
|
return I;
|
|
}, registerForm: function () {
|
|
var I = this.element.getElementsByTagName("form")[0];
|
|
if (this.form) {
|
|
if (this.form == I && E.isAncestor(this.element, this.form)) {
|
|
return;
|
|
} else {
|
|
B.purgeElement(this.form);
|
|
this.form = null;
|
|
}
|
|
}
|
|
if (!I) {
|
|
I = document.createElement("form");
|
|
I.name = "frm_" + this.id;
|
|
this.body.appendChild(I);
|
|
}
|
|
if (I) {
|
|
this.form = I;
|
|
B.on(I, "submit", this._submitHandler, this, true);
|
|
}
|
|
}, _submitHandler: function (I) {
|
|
B.stopEvent(I);
|
|
this.submit();
|
|
this.form.blur();
|
|
}, setTabLoop: function (I, J) {
|
|
I = I || this.firstButton;
|
|
J = this.lastButton || J;
|
|
A.superclass.setTabLoop.call(this, I, J);
|
|
}, setFirstLastFocusable: function () {
|
|
A.superclass.setFirstLastFocusable.call(this);
|
|
var J, I, K, L = this.focusableElements;
|
|
this.firstFormElement = null;
|
|
this.lastFormElement = null;
|
|
if (this.form && L && L.length > 0) {
|
|
I = L.length;
|
|
for (J = 0; J < I; ++J) {
|
|
K = L[J];
|
|
if (this.form === K.form) {
|
|
this.firstFormElement = K;
|
|
break;
|
|
}
|
|
}
|
|
for (J = I - 1; J >= 0; --J) {
|
|
K = L[J];
|
|
if (this.form === K.form) {
|
|
this.lastFormElement = K;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}, configClose: function (J, I, K) {
|
|
A.superclass.configClose.apply(this, arguments);
|
|
}, _doClose: function (I) {
|
|
B.preventDefault(I);
|
|
this.cancel();
|
|
}, configButtons: function (S, R, M) {
|
|
var N = YAHOO.widget.Button, U = R[0], K = this.innerElement, T, P, J, Q, O, I, L;
|
|
D.call(this);
|
|
this._aButtons = null;
|
|
if (F.isArray(U)) {
|
|
O = document.createElement("span");
|
|
O.className = "button-group";
|
|
Q = U.length;
|
|
this._aButtons = [];
|
|
this.defaultHtmlButton = null;
|
|
for (L = 0; L < Q; L++) {
|
|
T = U[L];
|
|
if (N) {
|
|
J = new N({label: T.text});
|
|
J.appendTo(O);
|
|
P = J.get("element");
|
|
if (T.isDefault) {
|
|
J.addClass("default");
|
|
this.defaultHtmlButton = P;
|
|
}
|
|
if (F.isFunction(T.handler)) {
|
|
J.set("onclick", {fn: T.handler, obj: this, scope: this});
|
|
} else {
|
|
if (F.isObject(T.handler) && F.isFunction(T.handler.fn)) {
|
|
J.set("onclick", {
|
|
fn: T.handler.fn,
|
|
obj: ((!F.isUndefined(T.handler.obj)) ? T.handler.obj : this),
|
|
scope: (T.handler.scope || this)
|
|
});
|
|
}
|
|
}
|
|
this._aButtons[this._aButtons.length] = J;
|
|
} else {
|
|
P = document.createElement("button");
|
|
P.setAttribute("type", "button");
|
|
if (T.isDefault) {
|
|
P.className = "default";
|
|
this.defaultHtmlButton = P;
|
|
}
|
|
P.innerHTML = T.text;
|
|
if (F.isFunction(T.handler)) {
|
|
B.on(P, "click", T.handler, this, true);
|
|
} else {
|
|
if (F.isObject(T.handler) && F.isFunction(T.handler.fn)) {
|
|
B.on(P, "click", T.handler.fn, ((!F.isUndefined(T.handler.obj)) ? T.handler.obj : this), (T.handler.scope || this));
|
|
}
|
|
}
|
|
O.appendChild(P);
|
|
this._aButtons[this._aButtons.length] = P;
|
|
}
|
|
T.htmlButton = P;
|
|
if (L === 0) {
|
|
this.firstButton = P;
|
|
}
|
|
if (L == (Q - 1)) {
|
|
this.lastButton = P;
|
|
}
|
|
}
|
|
this.setFooter(O);
|
|
I = this.footer;
|
|
if (E.inDocument(this.element) && !E.isAncestor(K, I)) {
|
|
K.appendChild(I);
|
|
}
|
|
this.buttonSpan = O;
|
|
} else {
|
|
O = this.buttonSpan;
|
|
I = this.footer;
|
|
if (O && I) {
|
|
I.removeChild(O);
|
|
this.buttonSpan = null;
|
|
this.firstButton = null;
|
|
this.lastButton = null;
|
|
this.defaultHtmlButton = null;
|
|
}
|
|
}
|
|
this.setFirstLastFocusable();
|
|
this.cfg.refireEvent("iframe");
|
|
this.cfg.refireEvent("underlay");
|
|
}, getButtons: function () {
|
|
return this._aButtons || null;
|
|
}, focusFirst: function (K, I, M) {
|
|
var J = this.firstFormElement;
|
|
if (I && I[1]) {
|
|
B.stopEvent(I[1]);
|
|
}
|
|
if (J) {
|
|
try {
|
|
J.focus();
|
|
} catch (L) {
|
|
}
|
|
} else {
|
|
this.focusFirstButton();
|
|
}
|
|
}, focusLast: function (K, I, M) {
|
|
var N = this.cfg.getProperty("buttons"), J = this.lastFormElement;
|
|
if (I && I[1]) {
|
|
B.stopEvent(I[1]);
|
|
}
|
|
if (N && F.isArray(N)) {
|
|
this.focusLastButton();
|
|
} else {
|
|
if (J) {
|
|
try {
|
|
J.focus();
|
|
} catch (L) {
|
|
}
|
|
}
|
|
}
|
|
}, _getButton: function (J) {
|
|
var I = YAHOO.widget.Button;
|
|
if (I && J && J.nodeName && J.id) {
|
|
J = I.getButton(J.id) || J;
|
|
}
|
|
return J;
|
|
}, focusDefaultButton: function () {
|
|
var I = this._getButton(this.defaultHtmlButton);
|
|
if (I) {
|
|
try {
|
|
I.focus();
|
|
} catch (J) {
|
|
}
|
|
}
|
|
}, blurButtons: function () {
|
|
var N = this.cfg.getProperty("buttons"), K, M, J, I;
|
|
if (N && F.isArray(N)) {
|
|
K = N.length;
|
|
if (K > 0) {
|
|
I = (K - 1);
|
|
do {
|
|
M = N[I];
|
|
if (M) {
|
|
J = this._getButton(M.htmlButton);
|
|
if (J) {
|
|
try {
|
|
J.blur();
|
|
} catch (L) {
|
|
}
|
|
}
|
|
}
|
|
} while (I--);
|
|
}
|
|
}
|
|
}, focusFirstButton: function () {
|
|
var L = this.cfg.getProperty("buttons"), K, I;
|
|
if (L && F.isArray(L)) {
|
|
K = L[0];
|
|
if (K) {
|
|
I = this._getButton(K.htmlButton);
|
|
if (I) {
|
|
try {
|
|
I.focus();
|
|
} catch (J) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, focusLastButton: function () {
|
|
var M = this.cfg.getProperty("buttons"), J, L, I;
|
|
if (M && F.isArray(M)) {
|
|
J = M.length;
|
|
if (J > 0) {
|
|
L = M[(J - 1)];
|
|
if (L) {
|
|
I = this._getButton(L.htmlButton);
|
|
if (I) {
|
|
try {
|
|
I.focus();
|
|
} catch (K) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, configPostMethod: function (J, I, K) {
|
|
this.registerForm();
|
|
}, validate: function () {
|
|
return true;
|
|
}, submit: function () {
|
|
if (this.validate()) {
|
|
this.beforeSubmitEvent.fire();
|
|
this.doSubmit();
|
|
this.submitEvent.fire();
|
|
if (this.cfg.getProperty("hideaftersubmit")) {
|
|
this.hide();
|
|
}
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}, cancel: function () {
|
|
this.cancelEvent.fire();
|
|
this.hide();
|
|
}, getData: function () {
|
|
var Y = this.form, K, R, U, M, S, P, O, J, V, L, W, Z, I, N, a, X, T;
|
|
|
|
function Q(c) {
|
|
var b = c.tagName.toUpperCase();
|
|
return ((b == "INPUT" || b == "TEXTAREA" || b == "SELECT") && c.name == M);
|
|
}
|
|
|
|
if (Y) {
|
|
K = Y.elements;
|
|
R = K.length;
|
|
U = {};
|
|
for (X = 0; X < R; X++) {
|
|
M = K[X].name;
|
|
S = E.getElementsBy(Q, "*", Y);
|
|
P = S.length;
|
|
if (P > 0) {
|
|
if (P == 1) {
|
|
S = S[0];
|
|
O = S.type;
|
|
J = S.tagName.toUpperCase();
|
|
switch (J) {
|
|
case"INPUT":
|
|
if (O == "checkbox") {
|
|
U[M] = S.checked;
|
|
} else {
|
|
if (O != "radio") {
|
|
U[M] = S.value;
|
|
}
|
|
}
|
|
break;
|
|
case"TEXTAREA":
|
|
U[M] = S.value;
|
|
break;
|
|
case"SELECT":
|
|
V = S.options;
|
|
L = V.length;
|
|
W = [];
|
|
for (T = 0; T < L; T++) {
|
|
Z = V[T];
|
|
if (Z.selected) {
|
|
I = Z.value;
|
|
if (!I || I === "") {
|
|
I = Z.text;
|
|
}
|
|
W[W.length] = I;
|
|
}
|
|
}
|
|
U[M] = W;
|
|
break;
|
|
}
|
|
} else {
|
|
O = S[0].type;
|
|
switch (O) {
|
|
case"radio":
|
|
for (T = 0; T < P; T++) {
|
|
N = S[T];
|
|
if (N.checked) {
|
|
U[M] = N.value;
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case"checkbox":
|
|
W = [];
|
|
for (T = 0; T < P; T++) {
|
|
a = S[T];
|
|
if (a.checked) {
|
|
W[W.length] = a.value;
|
|
}
|
|
}
|
|
U[M] = W;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return U;
|
|
}, destroy: function () {
|
|
D.call(this);
|
|
this._aButtons = null;
|
|
var I = this.element.getElementsByTagName("form"), J;
|
|
if (I.length > 0) {
|
|
J = I[0];
|
|
if (J) {
|
|
B.purgeElement(J);
|
|
if (J.parentNode) {
|
|
J.parentNode.removeChild(J);
|
|
}
|
|
this.form = null;
|
|
}
|
|
}
|
|
A.superclass.destroy.call(this);
|
|
}, toString: function () {
|
|
return "Dialog " + this.id;
|
|
}
|
|
});
|
|
}());
|
|
(function () {
|
|
YAHOO.widget.SimpleDialog = function (E, D) {
|
|
YAHOO.widget.SimpleDialog.superclass.constructor.call(this, E, D);
|
|
};
|
|
var C = YAHOO.util.Dom, B = YAHOO.widget.SimpleDialog, A = {
|
|
"ICON": {key: "icon", value: "none", suppressEvent: true},
|
|
"TEXT": {key: "text", value: "", suppressEvent: true, supercedes: ["icon"]}
|
|
};
|
|
B.ICON_BLOCK = "blckicon";
|
|
B.ICON_ALARM = "alrticon";
|
|
B.ICON_HELP = "hlpicon";
|
|
B.ICON_INFO = "infoicon";
|
|
B.ICON_WARN = "warnicon";
|
|
B.ICON_TIP = "tipicon";
|
|
B.ICON_CSS_CLASSNAME = "yui-icon";
|
|
B.CSS_SIMPLEDIALOG = "yui-simple-dialog";
|
|
YAHOO.extend(B, YAHOO.widget.Dialog, {
|
|
initDefaultConfig: function () {
|
|
B.superclass.initDefaultConfig.call(this);
|
|
this.cfg.addProperty(A.ICON.key, {
|
|
handler: this.configIcon,
|
|
value: A.ICON.value,
|
|
suppressEvent: A.ICON.suppressEvent
|
|
});
|
|
this.cfg.addProperty(A.TEXT.key, {
|
|
handler: this.configText,
|
|
value: A.TEXT.value,
|
|
suppressEvent: A.TEXT.suppressEvent,
|
|
supercedes: A.TEXT.supercedes
|
|
});
|
|
}, init: function (E, D) {
|
|
B.superclass.init.call(this, E);
|
|
this.beforeInitEvent.fire(B);
|
|
C.addClass(this.element, B.CSS_SIMPLEDIALOG);
|
|
this.cfg.queueProperty("postmethod", "manual");
|
|
if (D) {
|
|
this.cfg.applyConfig(D, true);
|
|
}
|
|
this.beforeRenderEvent.subscribe(function () {
|
|
if (!this.body) {
|
|
this.setBody("");
|
|
}
|
|
}, this, true);
|
|
this.initEvent.fire(B);
|
|
}, registerForm: function () {
|
|
B.superclass.registerForm.call(this);
|
|
this.form.innerHTML += '<input type="hidden" name="' + this.id + '" value=""/>';
|
|
}, configIcon: function (F, E, J) {
|
|
var K = E[0], D = this.body, I = B.ICON_CSS_CLASSNAME, H, G;
|
|
if (K && K != "none") {
|
|
H = C.getElementsByClassName(I, "*", D);
|
|
if (H) {
|
|
G = H.parentNode;
|
|
if (G) {
|
|
G.removeChild(H);
|
|
H = null;
|
|
}
|
|
}
|
|
if (K.indexOf(".") == -1) {
|
|
H = document.createElement("span");
|
|
H.className = (I + " " + K);
|
|
H.innerHTML = " ";
|
|
} else {
|
|
H = document.createElement("img");
|
|
H.src = (this.imageRoot + K);
|
|
H.className = I;
|
|
}
|
|
if (H) {
|
|
D.insertBefore(H, D.firstChild);
|
|
}
|
|
}
|
|
}, configText: function (E, D, F) {
|
|
var G = D[0];
|
|
if (G) {
|
|
this.setBody(G);
|
|
this.cfg.refireEvent("icon");
|
|
}
|
|
}, toString: function () {
|
|
return "SimpleDialog " + this.id;
|
|
}
|
|
});
|
|
}());
|
|
(function () {
|
|
YAHOO.widget.ContainerEffect = function (E, H, G, D, F) {
|
|
if (!F) {
|
|
F = YAHOO.util.Anim;
|
|
}
|
|
this.overlay = E;
|
|
this.attrIn = H;
|
|
this.attrOut = G;
|
|
this.targetElement = D || E.element;
|
|
this.animClass = F;
|
|
};
|
|
var B = YAHOO.util.Dom, C = YAHOO.util.CustomEvent, A = YAHOO.widget.ContainerEffect;
|
|
A.FADE = function (D, F) {
|
|
var G = YAHOO.util.Easing, I = {
|
|
attributes: {opacity: {from: 0, to: 1}},
|
|
duration: F,
|
|
method: G.easeIn
|
|
}, E = {attributes: {opacity: {to: 0}}, duration: F, method: G.easeOut}, H = new A(D, I, E, D.element);
|
|
H.handleUnderlayStart = function () {
|
|
var K = this.overlay.underlay;
|
|
if (K && YAHOO.env.ua.ie) {
|
|
var J = (K.filters && K.filters.length > 0);
|
|
if (J) {
|
|
B.addClass(D.element, "yui-effect-fade");
|
|
}
|
|
}
|
|
};
|
|
H.handleUnderlayComplete = function () {
|
|
var J = this.overlay.underlay;
|
|
if (J && YAHOO.env.ua.ie) {
|
|
B.removeClass(D.element, "yui-effect-fade");
|
|
}
|
|
};
|
|
H.handleStartAnimateIn = function (K, J, L) {
|
|
B.addClass(L.overlay.element, "hide-select");
|
|
if (!L.overlay.underlay) {
|
|
L.overlay.cfg.refireEvent("underlay");
|
|
}
|
|
L.handleUnderlayStart();
|
|
B.setStyle(L.overlay.element, "visibility", "visible");
|
|
B.setStyle(L.overlay.element, "opacity", 0);
|
|
};
|
|
H.handleCompleteAnimateIn = function (K, J, L) {
|
|
B.removeClass(L.overlay.element, "hide-select");
|
|
if (L.overlay.element.style.filter) {
|
|
L.overlay.element.style.filter = null;
|
|
}
|
|
L.handleUnderlayComplete();
|
|
L.overlay.cfg.refireEvent("iframe");
|
|
L.animateInCompleteEvent.fire();
|
|
};
|
|
H.handleStartAnimateOut = function (K, J, L) {
|
|
B.addClass(L.overlay.element, "hide-select");
|
|
L.handleUnderlayStart();
|
|
};
|
|
H.handleCompleteAnimateOut = function (K, J, L) {
|
|
B.removeClass(L.overlay.element, "hide-select");
|
|
if (L.overlay.element.style.filter) {
|
|
L.overlay.element.style.filter = null;
|
|
}
|
|
B.setStyle(L.overlay.element, "visibility", "hidden");
|
|
B.setStyle(L.overlay.element, "opacity", 1);
|
|
L.handleUnderlayComplete();
|
|
L.overlay.cfg.refireEvent("iframe");
|
|
L.animateOutCompleteEvent.fire();
|
|
};
|
|
H.init();
|
|
return H;
|
|
};
|
|
A.SLIDE = function (F, D) {
|
|
var I = YAHOO.util.Easing, L = F.cfg.getProperty("x") || B.getX(F.element), K = F.cfg.getProperty("y") || B.getY(F.element), M = B.getClientWidth(), H = F.element.offsetWidth, J = {
|
|
attributes: {points: {to: [L, K]}},
|
|
duration: D,
|
|
method: I.easeIn
|
|
}, E = {
|
|
attributes: {points: {to: [(M + 25), K]}},
|
|
duration: D,
|
|
method: I.easeOut
|
|
}, G = new A(F, J, E, F.element, YAHOO.util.Motion);
|
|
G.handleStartAnimateIn = function (O, N, P) {
|
|
P.overlay.element.style.left = ((-25) - H) + "px";
|
|
P.overlay.element.style.top = K + "px";
|
|
};
|
|
G.handleTweenAnimateIn = function (Q, P, R) {
|
|
var S = B.getXY(R.overlay.element), O = S[0], N = S[1];
|
|
if (B.getStyle(R.overlay.element, "visibility") == "hidden" && O < L) {
|
|
B.setStyle(R.overlay.element, "visibility", "visible");
|
|
}
|
|
R.overlay.cfg.setProperty("xy", [O, N], true);
|
|
R.overlay.cfg.refireEvent("iframe");
|
|
};
|
|
G.handleCompleteAnimateIn = function (O, N, P) {
|
|
P.overlay.cfg.setProperty("xy", [L, K], true);
|
|
P.startX = L;
|
|
P.startY = K;
|
|
P.overlay.cfg.refireEvent("iframe");
|
|
P.animateInCompleteEvent.fire();
|
|
};
|
|
G.handleStartAnimateOut = function (O, N, R) {
|
|
var P = B.getViewportWidth(), S = B.getXY(R.overlay.element), Q = S[1];
|
|
R.animOut.attributes.points.to = [(P + 25), Q];
|
|
};
|
|
G.handleTweenAnimateOut = function (P, O, Q) {
|
|
var S = B.getXY(Q.overlay.element), N = S[0], R = S[1];
|
|
Q.overlay.cfg.setProperty("xy", [N, R], true);
|
|
Q.overlay.cfg.refireEvent("iframe");
|
|
};
|
|
G.handleCompleteAnimateOut = function (O, N, P) {
|
|
B.setStyle(P.overlay.element, "visibility", "hidden");
|
|
P.overlay.cfg.setProperty("xy", [L, K]);
|
|
P.animateOutCompleteEvent.fire();
|
|
};
|
|
G.init();
|
|
return G;
|
|
};
|
|
A.prototype = {
|
|
init: function () {
|
|
this.beforeAnimateInEvent = this.createEvent("beforeAnimateIn");
|
|
this.beforeAnimateInEvent.signature = C.LIST;
|
|
this.beforeAnimateOutEvent = this.createEvent("beforeAnimateOut");
|
|
this.beforeAnimateOutEvent.signature = C.LIST;
|
|
this.animateInCompleteEvent = this.createEvent("animateInComplete");
|
|
this.animateInCompleteEvent.signature = C.LIST;
|
|
this.animateOutCompleteEvent = this.createEvent("animateOutComplete");
|
|
this.animateOutCompleteEvent.signature = C.LIST;
|
|
this.animIn = new this.animClass(this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method);
|
|
this.animIn.onStart.subscribe(this.handleStartAnimateIn, this);
|
|
this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this);
|
|
this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn, this);
|
|
this.animOut = new this.animClass(this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method);
|
|
this.animOut.onStart.subscribe(this.handleStartAnimateOut, this);
|
|
this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this);
|
|
this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this);
|
|
}, animateIn: function () {
|
|
this.beforeAnimateInEvent.fire();
|
|
this.animIn.animate();
|
|
}, animateOut: function () {
|
|
this.beforeAnimateOutEvent.fire();
|
|
this.animOut.animate();
|
|
}, handleStartAnimateIn: function (E, D, F) {
|
|
}, handleTweenAnimateIn: function (E, D, F) {
|
|
}, handleCompleteAnimateIn: function (E, D, F) {
|
|
}, handleStartAnimateOut: function (E, D, F) {
|
|
}, handleTweenAnimateOut: function (E, D, F) {
|
|
}, handleCompleteAnimateOut: function (E, D, F) {
|
|
}, toString: function () {
|
|
var D = "ContainerEffect";
|
|
if (this.overlay) {
|
|
D += " [" + this.overlay.toString() + "]";
|
|
}
|
|
return D;
|
|
}
|
|
};
|
|
YAHOO.lang.augmentProto(A, YAHOO.util.EventProvider);
|
|
})();
|
|
YAHOO.register("container", YAHOO.widget.Module, {version: "2.6.0", build: "1321"});// End of File include/javascript/yui/build/container/container-min.js
|
|
|
|
/*
|
|
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
|
|
Code licensed under the BSD License:
|
|
http://developer.yahoo.net/yui/license.txt
|
|
version: 2.6.0
|
|
*/
|
|
(function () {
|
|
var D = YAHOO.util.Dom, B = YAHOO.util.Event, F = YAHOO.lang, E = YAHOO.widget;
|
|
YAHOO.widget.TreeView = function (H, G) {
|
|
if (H) {
|
|
this.init(H);
|
|
}
|
|
if (G) {
|
|
if (!F.isArray(G)) {
|
|
G = [G];
|
|
}
|
|
this.buildTreeFromObject(G);
|
|
} else {
|
|
if (F.trim(this._el.innerHTML)) {
|
|
this.buildTreeFromMarkup(H);
|
|
}
|
|
}
|
|
};
|
|
var C = E.TreeView;
|
|
C.prototype = {
|
|
id: null,
|
|
_el: null,
|
|
_nodes: null,
|
|
locked: false,
|
|
_expandAnim: null,
|
|
_collapseAnim: null,
|
|
_animCount: 0,
|
|
maxAnim: 2,
|
|
_hasDblClickSubscriber: false,
|
|
_dblClickTimer: null,
|
|
setExpandAnim: function (G) {
|
|
this._expandAnim = (E.TVAnim.isValid(G)) ? G : null;
|
|
},
|
|
setCollapseAnim: function (G) {
|
|
this._collapseAnim = (E.TVAnim.isValid(G)) ? G : null;
|
|
},
|
|
animateExpand: function (I, J) {
|
|
if (this._expandAnim && this._animCount < this.maxAnim) {
|
|
var G = this;
|
|
var H = E.TVAnim.getAnim(this._expandAnim, I, function () {
|
|
G.expandComplete(J);
|
|
});
|
|
if (H) {
|
|
++this._animCount;
|
|
this.fireEvent("animStart", {"node": J, "type": "expand"});
|
|
H.animate();
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
},
|
|
animateCollapse: function (I, J) {
|
|
if (this._collapseAnim && this._animCount < this.maxAnim) {
|
|
var G = this;
|
|
var H = E.TVAnim.getAnim(this._collapseAnim, I, function () {
|
|
G.collapseComplete(J);
|
|
});
|
|
if (H) {
|
|
++this._animCount;
|
|
this.fireEvent("animStart", {"node": J, "type": "collapse"});
|
|
H.animate();
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
},
|
|
expandComplete: function (G) {
|
|
--this._animCount;
|
|
this.fireEvent("animComplete", {"node": G, "type": "expand"});
|
|
},
|
|
collapseComplete: function (G) {
|
|
--this._animCount;
|
|
this.fireEvent("animComplete", {"node": G, "type": "collapse"});
|
|
},
|
|
init: function (I) {
|
|
this._el = D.get(I);
|
|
this.id = D.generateId(this._el, "yui-tv-auto-id-");
|
|
this.createEvent("animStart", this);
|
|
this.createEvent("animComplete", this);
|
|
this.createEvent("collapse", this);
|
|
this.createEvent("collapseComplete", this);
|
|
this.createEvent("expand", this);
|
|
this.createEvent("expandComplete", this);
|
|
this.createEvent("enterKeyPressed", this);
|
|
this.createEvent("clickEvent", this);
|
|
var G = this;
|
|
this.createEvent("dblClickEvent", {
|
|
scope: this, onSubscribeCallback: function () {
|
|
G._hasDblClickSubscriber = true;
|
|
}
|
|
});
|
|
this.createEvent("labelClick", this);
|
|
this._nodes = [];
|
|
C.trees[this.id] = this;
|
|
this.root = new E.RootNode(this);
|
|
var H = E.LogWriter;
|
|
},
|
|
buildTreeFromObject: function (G) {
|
|
var H = function (P, M) {
|
|
var L, Q, K, J, O, I, N;
|
|
for (L = 0; L < M.length; L++) {
|
|
Q = M[L];
|
|
if (F.isString(Q)) {
|
|
K = new E.TextNode(Q, P);
|
|
} else {
|
|
if (F.isObject(Q)) {
|
|
J = Q.children;
|
|
delete Q.children;
|
|
O = Q.type || "text";
|
|
delete Q.type;
|
|
switch (O.toLowerCase()) {
|
|
case"text":
|
|
K = new E.TextNode(Q, P);
|
|
break;
|
|
case"menu":
|
|
K = new E.MenuNode(Q, P);
|
|
break;
|
|
case"html":
|
|
K = new E.HTMLNode(Q, P);
|
|
break;
|
|
default:
|
|
I = E[O];
|
|
if (F.isObject(I)) {
|
|
for (N = I; N && N !== E.Node; N = N.superclass.constructor) {
|
|
}
|
|
if (N) {
|
|
K = new I(Q, P);
|
|
} else {
|
|
}
|
|
} else {
|
|
}
|
|
}
|
|
if (J) {
|
|
H(K, J);
|
|
}
|
|
} else {
|
|
}
|
|
}
|
|
}
|
|
};
|
|
H(this.root, G);
|
|
},
|
|
buildTreeFromMarkup: function (I) {
|
|
var H = function (L, J) {
|
|
var K, M, O, N;
|
|
for (K = D.getFirstChild(J); K; K = D.getNextSibling(K)) {
|
|
if (K.nodeType == 1) {
|
|
switch (K.tagName.toUpperCase()) {
|
|
case"LI":
|
|
for (O = K.firstChild; O; O = O.nextSibling) {
|
|
if (O.nodeType == 3) {
|
|
N = F.trim(O.nodeValue);
|
|
if (N.length) {
|
|
M = new E.TextNode(N, L, false);
|
|
}
|
|
} else {
|
|
switch (O.tagName.toUpperCase()) {
|
|
case"UL":
|
|
case"OL":
|
|
H(M, O);
|
|
break;
|
|
case"A":
|
|
M = new E.TextNode({
|
|
label: O.innerHTML,
|
|
href: O.href,
|
|
target: O.target,
|
|
title: O.title || O.alt
|
|
}, L, false);
|
|
break;
|
|
default:
|
|
M = new E.HTMLNode(O.parentNode.innerHTML, L, false, true);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case"UL":
|
|
case"OL":
|
|
H(M, K);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
var G = D.getChildrenBy(D.get(I), function (K) {
|
|
var J = K.tagName.toUpperCase();
|
|
return J == "UL" || J == "OL";
|
|
});
|
|
if (G.length) {
|
|
H(this.root, G[0]);
|
|
} else {
|
|
}
|
|
},
|
|
render: function () {
|
|
var G = this.root.getHtml();
|
|
this.getEl().innerHTML = G;
|
|
var H = function (I) {
|
|
var J = B.getTarget(I);
|
|
if (J.tagName.toUpperCase() != "TD") {
|
|
J = D.getAncestorByTagName(J, "td");
|
|
}
|
|
if (F.isNull(J)) {
|
|
return null;
|
|
}
|
|
if (J.className.length === 0) {
|
|
J = J.previousSibling;
|
|
if (F.isNull(J)) {
|
|
return null;
|
|
}
|
|
}
|
|
return J;
|
|
};
|
|
if (!this._hasEvents) {
|
|
B.on(this.getEl(), "click", function (M) {
|
|
var J = this, K = B.getTarget(M), L = this.getNodeByElement(K);
|
|
if (!L) {
|
|
return;
|
|
}
|
|
var I = function () {
|
|
if (L.expanded) {
|
|
L.collapse();
|
|
} else {
|
|
L.expand();
|
|
}
|
|
L.focus();
|
|
};
|
|
if (D.hasClass(K, L.labelStyle) || D.getAncestorByClassName(K, L.labelStyle)) {
|
|
this.fireEvent("labelClick", L);
|
|
}
|
|
while (K && !D.hasClass(K.parentNode, "ygtvrow") && !/ygtv[tl][mp]h?h?/.test(K.className)) {
|
|
K = D.getAncestorByTagName(K, "td");
|
|
}
|
|
if (K) {
|
|
if (/ygtv(blank)?depthcell/.test(K.className)) {
|
|
return;
|
|
}
|
|
if (/ygtv[tl][mp]h?h?/.test(K.className)) {
|
|
I();
|
|
} else {
|
|
if (this._dblClickTimer) {
|
|
window.clearTimeout(this._dblClickTimer);
|
|
this._dblClickTimer = null;
|
|
} else {
|
|
if (this._hasDblClickSubscriber) {
|
|
this._dblClickTimer = window.setTimeout(function () {
|
|
J._dblClickTimer = null;
|
|
if (J.fireEvent("clickEvent", {event: M, node: L}) !== false) {
|
|
I();
|
|
}
|
|
}, 200);
|
|
} else {
|
|
if (J.fireEvent("clickEvent", {event: M, node: L}) !== false) {
|
|
I();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, this, true);
|
|
B.on(this.getEl(), "dblclick", function (J) {
|
|
if (!this._hasDblClickSubscriber) {
|
|
return;
|
|
}
|
|
var I = B.getTarget(J);
|
|
while (!D.hasClass(I.parentNode, "ygtvrow")) {
|
|
I = D.getAncestorByTagName(I, "td");
|
|
}
|
|
if (/ygtv(blank)?depthcell/.test(I.className)) {
|
|
return;
|
|
}
|
|
if (!(/ygtv[tl][mp]h?h?/.test(I.className))) {
|
|
this.fireEvent("dblClickEvent", {event: J, node: this.getNodeByElement(I)});
|
|
if (this._dblClickTimer) {
|
|
window.clearTimeout(this._dblClickTimer);
|
|
this._dblClickTimer = null;
|
|
}
|
|
}
|
|
}, this, true);
|
|
B.on(this.getEl(), "mouseover", function (I) {
|
|
var J = H(I);
|
|
if (J) {
|
|
J.className = J.className.replace(/ygtv([lt])([mp])/gi, "ygtv$1$2h").replace(/h+/, "h");
|
|
}
|
|
});
|
|
B.on(this.getEl(), "mouseout", function (I) {
|
|
var J = H(I);
|
|
if (J) {
|
|
J.className = J.className.replace(/ygtv([lt])([mp])h/gi, "ygtv$1$2");
|
|
}
|
|
});
|
|
B.on(this.getEl(), "keydown", function (L) {
|
|
var M = B.getTarget(L), K = this.getNodeByElement(M), J = K, I = YAHOO.util.KeyListener.KEY;
|
|
switch (L.keyCode) {
|
|
case I.UP:
|
|
do {
|
|
if (J.previousSibling) {
|
|
J = J.previousSibling;
|
|
} else {
|
|
J = J.parent;
|
|
}
|
|
} while (J && !J.focus());
|
|
if (!J) {
|
|
K.focus();
|
|
}
|
|
B.preventDefault(L);
|
|
break;
|
|
case I.DOWN:
|
|
do {
|
|
if (J.nextSibling) {
|
|
J = J.nextSibling;
|
|
} else {
|
|
J.expand();
|
|
J = (J.children.length || null) && J.children[0];
|
|
}
|
|
} while (J && !J.focus());
|
|
if (!J) {
|
|
K.focus();
|
|
}
|
|
B.preventDefault(L);
|
|
break;
|
|
case I.LEFT:
|
|
do {
|
|
if (J.parent) {
|
|
J = J.parent;
|
|
} else {
|
|
J = J.previousSibling;
|
|
}
|
|
} while (J && !J.focus());
|
|
if (!J) {
|
|
K.focus();
|
|
}
|
|
B.preventDefault(L);
|
|
break;
|
|
case I.RIGHT:
|
|
do {
|
|
J.expand();
|
|
if (J.children.length) {
|
|
J = J.children[0];
|
|
} else {
|
|
J = J.nextSibling;
|
|
}
|
|
} while (J && !J.focus());
|
|
if (!J) {
|
|
K.focus();
|
|
}
|
|
B.preventDefault(L);
|
|
break;
|
|
case I.ENTER:
|
|
if (K.href) {
|
|
if (K.target) {
|
|
window.open(K.href, K.target);
|
|
} else {
|
|
window.location(K.href);
|
|
}
|
|
} else {
|
|
K.toggle();
|
|
}
|
|
this.fireEvent("enterKeyPressed", K);
|
|
B.preventDefault(L);
|
|
break;
|
|
case I.HOME:
|
|
J = this.getRoot();
|
|
if (J.children.length) {
|
|
J = J.children[0];
|
|
}
|
|
if (!J.focus()) {
|
|
K.focus();
|
|
}
|
|
B.preventDefault(L);
|
|
break;
|
|
case I.END:
|
|
J = J.parent.children;
|
|
J = J[J.length - 1];
|
|
if (!J.focus()) {
|
|
K.focus();
|
|
}
|
|
B.preventDefault(L);
|
|
break;
|
|
case 107:
|
|
if (L.shiftKey) {
|
|
K.parent.expandAll();
|
|
} else {
|
|
K.expand();
|
|
}
|
|
break;
|
|
case 109:
|
|
if (L.shiftKey) {
|
|
K.parent.collapseAll();
|
|
} else {
|
|
K.collapse();
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}, this, true);
|
|
}
|
|
this._hasEvents = true;
|
|
},
|
|
getEl: function () {
|
|
if (!this._el) {
|
|
this._el = D.get(this.id);
|
|
}
|
|
return this._el;
|
|
},
|
|
regNode: function (G) {
|
|
this._nodes[G.index] = G;
|
|
},
|
|
getRoot: function () {
|
|
return this.root;
|
|
},
|
|
setDynamicLoad: function (G, H) {
|
|
this.root.setDynamicLoad(G, H);
|
|
},
|
|
expandAll: function () {
|
|
if (!this.locked) {
|
|
this.root.expandAll();
|
|
}
|
|
},
|
|
collapseAll: function () {
|
|
if (!this.locked) {
|
|
this.root.collapseAll();
|
|
}
|
|
},
|
|
getNodeByIndex: function (H) {
|
|
var G = this._nodes[H];
|
|
return (G) ? G : null;
|
|
},
|
|
getNodeByProperty: function (I, H) {
|
|
for (var G in this._nodes) {
|
|
if (this._nodes.hasOwnProperty(G)) {
|
|
var J = this._nodes[G];
|
|
if (J.data && H == J.data[I]) {
|
|
return J;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
},
|
|
getNodesByProperty: function (J, I) {
|
|
var G = [];
|
|
for (var H in this._nodes) {
|
|
if (this._nodes.hasOwnProperty(H)) {
|
|
var K = this._nodes[H];
|
|
if (K.data && I == K.data[J]) {
|
|
G.push(K);
|
|
}
|
|
}
|
|
}
|
|
return (G.length) ? G : null;
|
|
},
|
|
getNodeByElement: function (I) {
|
|
var J = I, G, H = /ygtv([^\d]*)(.*)/;
|
|
do {
|
|
if (J && J.id) {
|
|
G = J.id.match(H);
|
|
if (G && G[2]) {
|
|
return this.getNodeByIndex(G[2]);
|
|
}
|
|
}
|
|
J = J.parentNode;
|
|
if (!J || !J.tagName) {
|
|
break;
|
|
}
|
|
} while (J.id !== this.id && J.tagName.toLowerCase() !== "body");
|
|
return null;
|
|
},
|
|
removeNode: function (H, G) {
|
|
if (H.isRoot()) {
|
|
return false;
|
|
}
|
|
var I = H.parent;
|
|
if (I.parent) {
|
|
I = I.parent;
|
|
}
|
|
this._deleteNode(H);
|
|
if (G && I && I.childrenRendered) {
|
|
I.refresh();
|
|
}
|
|
return true;
|
|
},
|
|
_removeChildren_animComplete: function (G) {
|
|
this.unsubscribe(this._removeChildren_animComplete);
|
|
this.removeChildren(G.node);
|
|
},
|
|
removeChildren: function (G) {
|
|
if (G.expanded) {
|
|
if (this._collapseAnim) {
|
|
this.subscribe("animComplete", this._removeChildren_animComplete, this, true);
|
|
E.Node.prototype.collapse.call(G);
|
|
return;
|
|
}
|
|
G.collapse();
|
|
}
|
|
while (G.children.length) {
|
|
this._deleteNode(G.children[0]);
|
|
}
|
|
if (G.isRoot()) {
|
|
E.Node.prototype.expand.call(G);
|
|
}
|
|
G.childrenRendered = false;
|
|
G.dynamicLoadComplete = false;
|
|
G.updateIcon();
|
|
},
|
|
_deleteNode: function (G) {
|
|
this.removeChildren(G);
|
|
this.popNode(G);
|
|
},
|
|
popNode: function (J) {
|
|
var K = J.parent;
|
|
var H = [];
|
|
for (var I = 0, G = K.children.length; I < G; ++I) {
|
|
if (K.children[I] != J) {
|
|
H[H.length] = K.children[I];
|
|
}
|
|
}
|
|
K.children = H;
|
|
K.childrenRendered = false;
|
|
if (J.previousSibling) {
|
|
J.previousSibling.nextSibling = J.nextSibling;
|
|
}
|
|
if (J.nextSibling) {
|
|
J.nextSibling.previousSibling = J.previousSibling;
|
|
}
|
|
J.parent = null;
|
|
J.previousSibling = null;
|
|
J.nextSibling = null;
|
|
J.tree = null;
|
|
delete this._nodes[J.index];
|
|
},
|
|
destroy: function () {
|
|
if (this._destroyEditor) {
|
|
this._destroyEditor();
|
|
}
|
|
var H = this.getEl();
|
|
B.removeListener(H, "click");
|
|
B.removeListener(H, "dblclick");
|
|
B.removeListener(H, "mouseover");
|
|
B.removeListener(H, "mouseout");
|
|
B.removeListener(H, "keydown");
|
|
for (var G = 0; G < this._nodes.length; G++) {
|
|
var I = this._nodes[G];
|
|
if (I && I.destroy) {
|
|
I.destroy();
|
|
}
|
|
}
|
|
H.parentNode.removeChild(H);
|
|
this._hasEvents = false;
|
|
},
|
|
toString: function () {
|
|
return "TreeView " + this.id;
|
|
},
|
|
getNodeCount: function () {
|
|
return this.getRoot().getNodeCount();
|
|
},
|
|
getTreeDefinition: function () {
|
|
return this.getRoot().getNodeDefinition();
|
|
},
|
|
onExpand: function (G) {
|
|
},
|
|
onCollapse: function (G) {
|
|
}
|
|
};
|
|
var A = C.prototype;
|
|
A.draw = A.render;
|
|
YAHOO.augment(C, YAHOO.util.EventProvider);
|
|
C.nodeCount = 0;
|
|
C.trees = [];
|
|
C.getTree = function (H) {
|
|
var G = C.trees[H];
|
|
return (G) ? G : null;
|
|
};
|
|
C.getNode = function (H, I) {
|
|
var G = C.getTree(H);
|
|
return (G) ? G.getNodeByIndex(I) : null;
|
|
};
|
|
C.FOCUS_CLASS_NAME = "ygtvfocus";
|
|
C.preload = function (L, K) {
|
|
K = K || "ygtv";
|
|
var I = ["tn", "tm", "tmh", "tp", "tph", "ln", "lm", "lmh", "lp", "lph", "loading"];
|
|
var M = [];
|
|
for (var G = 1; G < I.length; G = G + 1) {
|
|
M[M.length] = '<span class="' + K + I[G] + '"> </span>';
|
|
}
|
|
var J = document.createElement("div");
|
|
var H = J.style;
|
|
H.className = K + I[0];
|
|
H.position = "absolute";
|
|
H.height = "1px";
|
|
H.width = "1px";
|
|
H.top = "-1000px";
|
|
H.left = "-1000px";
|
|
J.innerHTML = M.join("");
|
|
document.body.appendChild(J);
|
|
B.removeListener(window, "load", C.preload);
|
|
};
|
|
B.addListener(window, "load", C.preload);
|
|
})();
|
|
(function () {
|
|
var B = YAHOO.util.Dom, C = YAHOO.lang, A = YAHOO.util.Event;
|
|
YAHOO.widget.Node = function (F, E, D) {
|
|
if (F) {
|
|
this.init(F, E, D);
|
|
}
|
|
};
|
|
YAHOO.widget.Node.prototype = {
|
|
index: 0,
|
|
children: null,
|
|
tree: null,
|
|
data: null,
|
|
parent: null,
|
|
depth: -1,
|
|
href: null,
|
|
target: "_self",
|
|
expanded: false,
|
|
multiExpand: true,
|
|
renderHidden: false,
|
|
childrenRendered: false,
|
|
dynamicLoadComplete: false,
|
|
previousSibling: null,
|
|
nextSibling: null,
|
|
_dynLoad: false,
|
|
dataLoader: null,
|
|
isLoading: false,
|
|
hasIcon: true,
|
|
iconMode: 0,
|
|
nowrap: false,
|
|
isLeaf: false,
|
|
contentStyle: "",
|
|
contentElId: null,
|
|
_type: "Node",
|
|
init: function (G, F, D) {
|
|
this.data = G;
|
|
this.children = [];
|
|
this.index = YAHOO.widget.TreeView.nodeCount;
|
|
++YAHOO.widget.TreeView.nodeCount;
|
|
this.contentElId = "ygtvcontentel" + this.index;
|
|
if (C.isObject(G)) {
|
|
for (var E in G) {
|
|
if (E.charAt(0) != "_" && G.hasOwnProperty(E) && !C.isUndefined(this[E]) && !C.isFunction(this[E])) {
|
|
this[E] = G[E];
|
|
}
|
|
}
|
|
}
|
|
if (!C.isUndefined(D)) {
|
|
this.expanded = D;
|
|
}
|
|
this.createEvent("parentChange", this);
|
|
if (F) {
|
|
F.appendChild(this);
|
|
}
|
|
},
|
|
applyParent: function (E) {
|
|
if (!E) {
|
|
return false;
|
|
}
|
|
this.tree = E.tree;
|
|
this.parent = E;
|
|
this.depth = E.depth + 1;
|
|
this.tree.regNode(this);
|
|
E.childrenRendered = false;
|
|
for (var F = 0, D = this.children.length; F < D; ++F) {
|
|
this.children[F].applyParent(this);
|
|
}
|
|
this.fireEvent("parentChange");
|
|
return true;
|
|
},
|
|
appendChild: function (E) {
|
|
if (this.hasChildren()) {
|
|
var D = this.children[this.children.length - 1];
|
|
D.nextSibling = E;
|
|
E.previousSibling = D;
|
|
}
|
|
this.children[this.children.length] = E;
|
|
E.applyParent(this);
|
|
if (this.childrenRendered && this.expanded) {
|
|
this.getChildrenEl().style.display = "";
|
|
}
|
|
return E;
|
|
},
|
|
appendTo: function (D) {
|
|
return D.appendChild(this);
|
|
},
|
|
insertBefore: function (D) {
|
|
var F = D.parent;
|
|
if (F) {
|
|
if (this.tree) {
|
|
this.tree.popNode(this);
|
|
}
|
|
var E = D.isChildOf(F);
|
|
F.children.splice(E, 0, this);
|
|
if (D.previousSibling) {
|
|
D.previousSibling.nextSibling = this;
|
|
}
|
|
this.previousSibling = D.previousSibling;
|
|
this.nextSibling = D;
|
|
D.previousSibling = this;
|
|
this.applyParent(F);
|
|
}
|
|
return this;
|
|
},
|
|
insertAfter: function (D) {
|
|
var F = D.parent;
|
|
if (F) {
|
|
if (this.tree) {
|
|
this.tree.popNode(this);
|
|
}
|
|
var E = D.isChildOf(F);
|
|
if (!D.nextSibling) {
|
|
this.nextSibling = null;
|
|
return this.appendTo(F);
|
|
}
|
|
F.children.splice(E + 1, 0, this);
|
|
D.nextSibling.previousSibling = this;
|
|
this.previousSibling = D;
|
|
this.nextSibling = D.nextSibling;
|
|
D.nextSibling = this;
|
|
this.applyParent(F);
|
|
}
|
|
return this;
|
|
},
|
|
isChildOf: function (E) {
|
|
if (E && E.children) {
|
|
for (var F = 0, D = E.children.length; F < D; ++F) {
|
|
if (E.children[F] === this) {
|
|
return F;
|
|
}
|
|
}
|
|
}
|
|
return -1;
|
|
},
|
|
getSiblings: function () {
|
|
var D = this.parent.children.slice(0);
|
|
for (var E = 0; E < D.length && D[E] != this; E++) {
|
|
}
|
|
D.splice(E, 1);
|
|
if (D.length) {
|
|
return D;
|
|
}
|
|
return null;
|
|
},
|
|
showChildren: function () {
|
|
if (!this.tree.animateExpand(this.getChildrenEl(), this)) {
|
|
if (this.hasChildren()) {
|
|
this.getChildrenEl().style.display = "";
|
|
}
|
|
}
|
|
},
|
|
hideChildren: function () {
|
|
if (!this.tree.animateCollapse(this.getChildrenEl(), this)) {
|
|
this.getChildrenEl().style.display = "none";
|
|
}
|
|
},
|
|
getElId: function () {
|
|
return "ygtv" + this.index;
|
|
},
|
|
getChildrenElId: function () {
|
|
return "ygtvc" + this.index;
|
|
},
|
|
getToggleElId: function () {
|
|
return "ygtvt" + this.index;
|
|
},
|
|
getEl: function () {
|
|
return B.get(this.getElId());
|
|
},
|
|
getChildrenEl: function () {
|
|
return B.get(this.getChildrenElId());
|
|
},
|
|
getToggleEl: function () {
|
|
return B.get(this.getToggleElId());
|
|
},
|
|
getContentEl: function () {
|
|
return B.get(this.contentElId);
|
|
},
|
|
collapse: function () {
|
|
if (!this.expanded) {
|
|
return;
|
|
}
|
|
var D = this.tree.onCollapse(this);
|
|
if (false === D) {
|
|
return;
|
|
}
|
|
D = this.tree.fireEvent("collapse", this);
|
|
if (false === D) {
|
|
return;
|
|
}
|
|
if (!this.getEl()) {
|
|
this.expanded = false;
|
|
} else {
|
|
this.hideChildren();
|
|
this.expanded = false;
|
|
this.updateIcon();
|
|
}
|
|
D = this.tree.fireEvent("collapseComplete", this);
|
|
},
|
|
expand: function (F) {
|
|
if (this.expanded && !F) {
|
|
return;
|
|
}
|
|
var D = true;
|
|
if (!F) {
|
|
D = this.tree.onExpand(this);
|
|
if (false === D) {
|
|
return;
|
|
}
|
|
D = this.tree.fireEvent("expand", this);
|
|
}
|
|
if (false === D) {
|
|
return;
|
|
}
|
|
if (!this.getEl()) {
|
|
this.expanded = true;
|
|
return;
|
|
}
|
|
if (!this.childrenRendered) {
|
|
this.getChildrenEl().innerHTML = this.renderChildren();
|
|
} else {
|
|
}
|
|
this.expanded = true;
|
|
this.updateIcon();
|
|
if (this.isLoading) {
|
|
this.expanded = false;
|
|
return;
|
|
}
|
|
if (!this.multiExpand) {
|
|
var G = this.getSiblings();
|
|
for (var E = 0; G && E < G.length; ++E) {
|
|
if (G[E] != this && G[E].expanded) {
|
|
G[E].collapse();
|
|
}
|
|
}
|
|
}
|
|
this.showChildren();
|
|
D = this.tree.fireEvent("expandComplete", this);
|
|
},
|
|
updateIcon: function () {
|
|
if (this.hasIcon) {
|
|
var D = this.getToggleEl();
|
|
if (D) {
|
|
D.className = D.className.replace(/ygtv(([tl][pmn]h?)|(loading))/, this.getStyle());
|
|
}
|
|
}
|
|
},
|
|
getStyle: function () {
|
|
if (this.isLoading) {
|
|
return "ygtvloading";
|
|
} else {
|
|
var E = (this.nextSibling) ? "t" : "l";
|
|
var D = "n";
|
|
if (this.hasChildren(true) || (this.isDynamic() && !this.getIconMode())) {
|
|
D = (this.expanded) ? "m" : "p";
|
|
}
|
|
return "ygtv" + E + D;
|
|
}
|
|
},
|
|
getHoverStyle: function () {
|
|
var D = this.getStyle();
|
|
if (this.hasChildren(true) && !this.isLoading) {
|
|
D += "h";
|
|
}
|
|
return D;
|
|
},
|
|
expandAll: function () {
|
|
for (var D = 0; D < this.children.length; ++D) {
|
|
var E = this.children[D];
|
|
if (E.isDynamic()) {
|
|
break;
|
|
} else {
|
|
if (!E.multiExpand) {
|
|
break;
|
|
} else {
|
|
E.expand();
|
|
E.expandAll();
|
|
}
|
|
}
|
|
}
|
|
},
|
|
collapseAll: function () {
|
|
for (var D = 0; D < this.children.length; ++D) {
|
|
this.children[D].collapse();
|
|
this.children[D].collapseAll();
|
|
}
|
|
},
|
|
setDynamicLoad: function (D, E) {
|
|
if (D) {
|
|
this.dataLoader = D;
|
|
this._dynLoad = true;
|
|
} else {
|
|
this.dataLoader = null;
|
|
this._dynLoad = false;
|
|
}
|
|
if (E) {
|
|
this.iconMode = E;
|
|
}
|
|
},
|
|
isRoot: function () {
|
|
return (this == this.tree.root);
|
|
},
|
|
isDynamic: function () {
|
|
if (this.isLeaf) {
|
|
return false;
|
|
} else {
|
|
return (!this.isRoot() && (this._dynLoad || this.tree.root._dynLoad));
|
|
}
|
|
},
|
|
getIconMode: function () {
|
|
return (this.iconMode || this.tree.root.iconMode);
|
|
},
|
|
hasChildren: function (D) {
|
|
if (this.isLeaf) {
|
|
return false;
|
|
} else {
|
|
return (this.children.length > 0 || (D && this.isDynamic() && !this.dynamicLoadComplete));
|
|
}
|
|
},
|
|
toggle: function () {
|
|
if (!this.tree.locked && (this.hasChildren(true) || this.isDynamic())) {
|
|
if (this.expanded) {
|
|
this.collapse();
|
|
} else {
|
|
this.expand();
|
|
}
|
|
}
|
|
},
|
|
getHtml: function () {
|
|
this.childrenRendered = false;
|
|
var D = [];
|
|
D[D.length] = '<div class="ygtvitem" id="' + this.getElId() + '">';
|
|
D[D.length] = this.getNodeHtml();
|
|
D[D.length] = this.getChildrenHtml();
|
|
D[D.length] = "</div>";
|
|
return D.join("");
|
|
},
|
|
getChildrenHtml: function () {
|
|
var D = [];
|
|
D[D.length] = '<div class="ygtvchildren"';
|
|
D[D.length] = ' id="' + this.getChildrenElId() + '"';
|
|
if (!this.expanded || !this.hasChildren()) {
|
|
D[D.length] = ' style="display:none;"';
|
|
}
|
|
D[D.length] = ">";
|
|
if ((this.hasChildren(true) && this.expanded) || (this.renderHidden && !this.isDynamic())) {
|
|
D[D.length] = this.renderChildren();
|
|
}
|
|
D[D.length] = "</div>";
|
|
return D.join("");
|
|
},
|
|
renderChildren: function () {
|
|
var D = this;
|
|
if (this.isDynamic() && !this.dynamicLoadComplete) {
|
|
this.isLoading = true;
|
|
this.tree.locked = true;
|
|
if (this.dataLoader) {
|
|
setTimeout(function () {
|
|
D.dataLoader(D, function () {
|
|
D.loadComplete();
|
|
});
|
|
}, 10);
|
|
} else {
|
|
if (this.tree.root.dataLoader) {
|
|
setTimeout(function () {
|
|
D.tree.root.dataLoader(D, function () {
|
|
D.loadComplete();
|
|
});
|
|
}, 10);
|
|
} else {
|
|
return "Error: data loader not found or not specified.";
|
|
}
|
|
}
|
|
return "";
|
|
} else {
|
|
return this.completeRender();
|
|
}
|
|
},
|
|
completeRender: function () {
|
|
var E = [];
|
|
for (var D = 0; D < this.children.length; ++D) {
|
|
E[E.length] = this.children[D].getHtml();
|
|
}
|
|
this.childrenRendered = true;
|
|
return E.join("");
|
|
},
|
|
loadComplete: function () {
|
|
this.getChildrenEl().innerHTML = this.completeRender();
|
|
this.dynamicLoadComplete = true;
|
|
this.isLoading = false;
|
|
this.expand(true);
|
|
this.tree.locked = false;
|
|
},
|
|
getAncestor: function (E) {
|
|
if (E >= this.depth || E < 0) {
|
|
return null;
|
|
}
|
|
var D = this.parent;
|
|
while (D.depth > E) {
|
|
D = D.parent;
|
|
}
|
|
return D;
|
|
},
|
|
getDepthStyle: function (D) {
|
|
return (this.getAncestor(D).nextSibling) ? "ygtvdepthcell" : "ygtvblankdepthcell";
|
|
},
|
|
getNodeHtml: function () {
|
|
var E = [];
|
|
E[E.length] = '<table border="0" cellpadding="0" cellspacing="0" class="ygtvdepth' + this.depth + '">';
|
|
E[E.length] = '<tr class="ygtvrow">';
|
|
for (var D = 0; D < this.depth; ++D) {
|
|
E[E.length] = '<td class="' + this.getDepthStyle(D) + '"><div class="ygtvspacer"></div></td>';
|
|
}
|
|
if (this.hasIcon) {
|
|
E[E.length] = "<td";
|
|
E[E.length] = ' id="' + this.getToggleElId() + '"';
|
|
E[E.length] = ' class="' + this.getStyle() + '"';
|
|
E[E.length] = '><a href="#" class="ygtvspacer"> </a></td>';
|
|
}
|
|
E[E.length] = "<td";
|
|
E[E.length] = ' id="' + this.contentElId + '"';
|
|
E[E.length] = ' class="' + this.contentStyle + ' ygtvcontent" ';
|
|
E[E.length] = (this.nowrap) ? ' nowrap="nowrap" ' : "";
|
|
E[E.length] = " >";
|
|
E[E.length] = this.getContentHtml();
|
|
E[E.length] = "</td>";
|
|
E[E.length] = "</tr>";
|
|
E[E.length] = "</table>";
|
|
return E.join("");
|
|
},
|
|
getContentHtml: function () {
|
|
return "";
|
|
},
|
|
refresh: function () {
|
|
this.getChildrenEl().innerHTML = this.completeRender();
|
|
if (this.hasIcon) {
|
|
var D = this.getToggleEl();
|
|
if (D) {
|
|
D.className = this.getStyle();
|
|
}
|
|
}
|
|
},
|
|
toString: function () {
|
|
return this._type + " (" + this.index + ")";
|
|
},
|
|
_focusHighlightedItems: [],
|
|
_focusedItem: null,
|
|
focus: function () {
|
|
var F = false, D = this;
|
|
var E = function () {
|
|
var G;
|
|
if (D._focusedItem) {
|
|
A.removeListener(D._focusedItem, "blur");
|
|
D._focusedItem = null;
|
|
}
|
|
while ((G = D._focusHighlightedItems.shift())) {
|
|
B.removeClass(G, YAHOO.widget.TreeView.FOCUS_CLASS_NAME);
|
|
}
|
|
};
|
|
E();
|
|
B.getElementsBy(function (G) {
|
|
return /ygtv(([tl][pmn]h?)|(content))/.test(G.className);
|
|
}, "td", this.getEl().firstChild, function (H) {
|
|
B.addClass(H, YAHOO.widget.TreeView.FOCUS_CLASS_NAME);
|
|
if (!F) {
|
|
var G = H.getElementsByTagName("a");
|
|
if (G.length) {
|
|
G = G[0];
|
|
G.focus();
|
|
D._focusedItem = G;
|
|
A.on(G, "blur", E);
|
|
F = true;
|
|
}
|
|
}
|
|
D._focusHighlightedItems.push(H);
|
|
});
|
|
if (!F) {
|
|
E();
|
|
}
|
|
return F;
|
|
},
|
|
getNodeCount: function () {
|
|
for (var D = 0, E = 0; D < this.children.length; D++) {
|
|
E += this.children[D].getNodeCount();
|
|
}
|
|
return E + 1;
|
|
},
|
|
getNodeDefinition: function () {
|
|
if (this.isDynamic()) {
|
|
return false;
|
|
}
|
|
var G, D = this.data, F = [];
|
|
if (this.href) {
|
|
D.href = this.href;
|
|
}
|
|
if (this.target != "_self") {
|
|
D.target = this.target;
|
|
}
|
|
if (this.expanded) {
|
|
D.expanded = this.expanded;
|
|
}
|
|
if (!this.multiExpand) {
|
|
D.multiExpand = this.multiExpand;
|
|
}
|
|
if (!this.hasIcon) {
|
|
D.hasIcon = this.hasIcon;
|
|
}
|
|
if (this.nowrap) {
|
|
D.nowrap = this.nowrap;
|
|
}
|
|
D.type = this._type;
|
|
for (var E = 0; E < this.children.length; E++) {
|
|
G = this.children[E].getNodeDefinition();
|
|
if (G === false) {
|
|
return false;
|
|
}
|
|
F.push(G);
|
|
}
|
|
if (F.length) {
|
|
D.children = F;
|
|
}
|
|
return D;
|
|
},
|
|
getToggleLink: function () {
|
|
return "return false;";
|
|
}
|
|
};
|
|
YAHOO.augment(YAHOO.widget.Node, YAHOO.util.EventProvider);
|
|
})();
|
|
(function () {
|
|
var B = YAHOO.util.Dom, C = YAHOO.lang, A = YAHOO.util.Event;
|
|
YAHOO.widget.TextNode = function (F, E, D) {
|
|
if (F) {
|
|
if (C.isString(F)) {
|
|
F = {label: F};
|
|
}
|
|
this.init(F, E, D);
|
|
this.setUpLabel(F);
|
|
}
|
|
};
|
|
YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, {
|
|
labelStyle: "ygtvlabel",
|
|
labelElId: null,
|
|
label: null,
|
|
title: null,
|
|
_type: "TextNode",
|
|
setUpLabel: function (D) {
|
|
if (C.isString(D)) {
|
|
D = {label: D};
|
|
} else {
|
|
if (D.style) {
|
|
this.labelStyle = D.style;
|
|
}
|
|
}
|
|
this.label = D.label;
|
|
this.labelElId = "ygtvlabelel" + this.index;
|
|
},
|
|
getLabelEl: function () {
|
|
return B.get(this.labelElId);
|
|
},
|
|
getContentHtml: function () {
|
|
var D = [];
|
|
D[D.length] = this.href ? "<a" : "<span";
|
|
D[D.length] = ' id="' + this.labelElId + '"';
|
|
if (this.title) {
|
|
D[D.length] = ' title="' + this.title + '"';
|
|
}
|
|
D[D.length] = ' class="' + this.labelStyle + '"';
|
|
if (this.href) {
|
|
D[D.length] = ' href="' + this.href + '"';
|
|
D[D.length] = ' target="' + this.target + '"';
|
|
}
|
|
D[D.length] = " >";
|
|
D[D.length] = this.label;
|
|
D[D.length] = this.href ? "</a>" : "</span>";
|
|
return D.join("");
|
|
},
|
|
getNodeDefinition: function () {
|
|
var D = YAHOO.widget.TextNode.superclass.getNodeDefinition.call(this);
|
|
if (D === false) {
|
|
return false;
|
|
}
|
|
D.label = this.label;
|
|
if (this.labelStyle != "ygtvlabel") {
|
|
D.style = this.labelStyle;
|
|
}
|
|
if (this.title) {
|
|
D.title = this.title;
|
|
}
|
|
return D;
|
|
},
|
|
toString: function () {
|
|
return YAHOO.widget.TextNode.superclass.toString.call(this) + ": " + this.label;
|
|
},
|
|
onLabelClick: function () {
|
|
return false;
|
|
}
|
|
});
|
|
})();
|
|
YAHOO.widget.RootNode = function (A) {
|
|
this.init(null, null, true);
|
|
this.tree = A;
|
|
};
|
|
YAHOO.extend(YAHOO.widget.RootNode, YAHOO.widget.Node, {
|
|
_type: "RootNode", getNodeHtml: function () {
|
|
return "";
|
|
}, toString: function () {
|
|
return this._type;
|
|
}, loadComplete: function () {
|
|
this.tree.draw();
|
|
}, getNodeCount: function () {
|
|
for (var A = 0, B = 0; A < this.children.length; A++) {
|
|
B += this.children[A].getNodeCount();
|
|
}
|
|
return B;
|
|
}, getNodeDefinition: function () {
|
|
for (var C, A = [], B = 0; B < this.children.length; B++) {
|
|
C = this.children[B].getNodeDefinition();
|
|
if (C === false) {
|
|
return false;
|
|
}
|
|
A.push(C);
|
|
}
|
|
return A;
|
|
}, collapse: function () {
|
|
}, expand: function () {
|
|
}, getSiblings: function () {
|
|
return null;
|
|
}, focus: function () {
|
|
}
|
|
});
|
|
(function () {
|
|
var B = YAHOO.util.Dom, C = YAHOO.lang, A = YAHOO.util.Event;
|
|
YAHOO.widget.HTMLNode = function (G, F, E, D) {
|
|
if (G) {
|
|
this.init(G, F, E);
|
|
this.initContent(G, D);
|
|
}
|
|
};
|
|
YAHOO.extend(YAHOO.widget.HTMLNode, YAHOO.widget.Node, {
|
|
contentStyle: "ygtvhtml",
|
|
html: null,
|
|
_type: "HTMLNode",
|
|
initContent: function (E, D) {
|
|
this.setHtml(E);
|
|
this.contentElId = "ygtvcontentel" + this.index;
|
|
if (!C.isUndefined(D)) {
|
|
this.hasIcon = D;
|
|
}
|
|
},
|
|
setHtml: function (E) {
|
|
this.data = E;
|
|
this.html = (typeof E === "string") ? E : E.html;
|
|
var D = this.getContentEl();
|
|
if (D) {
|
|
D.innerHTML = this.html;
|
|
}
|
|
},
|
|
getContentHtml: function () {
|
|
return this.html;
|
|
},
|
|
getNodeDefinition: function () {
|
|
var D = YAHOO.widget.HTMLNode.superclass.getNodeDefinition.call(this);
|
|
if (D === false) {
|
|
return false;
|
|
}
|
|
D.html = this.html;
|
|
return D;
|
|
}
|
|
});
|
|
})();
|
|
YAHOO.widget.MenuNode = function (C, B, A) {
|
|
YAHOO.widget.MenuNode.superclass.constructor.call(this, C, B, A);
|
|
this.multiExpand = false;
|
|
};
|
|
YAHOO.extend(YAHOO.widget.MenuNode, YAHOO.widget.TextNode, {_type: "MenuNode"});
|
|
(function () {
|
|
var B = YAHOO.util.Dom, C = YAHOO.lang, A = YAHOO.util.Event, D = YAHOO.widget.Calendar;
|
|
YAHOO.widget.DateNode = function (G, F, E) {
|
|
YAHOO.widget.DateNode.superclass.constructor.call(this, G, F, E);
|
|
};
|
|
YAHOO.extend(YAHOO.widget.DateNode, YAHOO.widget.TextNode, {
|
|
_type: "DateNode",
|
|
calendarConfig: null,
|
|
fillEditorContainer: function (G) {
|
|
var H, F = G.inputContainer;
|
|
if (C.isUndefined(D)) {
|
|
B.replaceClass(G.editorPanel, "ygtv-edit-DateNode", "ygtv-edit-TextNode");
|
|
YAHOO.widget.DateNode.superclass.fillEditorContainer.call(this, G);
|
|
return;
|
|
}
|
|
if (G.nodeType != this._type) {
|
|
G.nodeType = this._type;
|
|
G.saveOnEnter = false;
|
|
G.node.destroyEditorContents(G);
|
|
G.inputObject = H = new D(F.appendChild(document.createElement("div")));
|
|
if (this.calendarConfig) {
|
|
H.cfg.applyConfig(this.calendarConfig, true);
|
|
H.cfg.fireQueue();
|
|
}
|
|
H.selectEvent.subscribe(function () {
|
|
this.tree._closeEditor(true);
|
|
}, this, true);
|
|
} else {
|
|
H = G.inputObject;
|
|
}
|
|
H.cfg.setProperty("selected", this.label, false);
|
|
var I = H.cfg.getProperty("DATE_FIELD_DELIMITER");
|
|
var E = this.label.split(I);
|
|
H.cfg.setProperty("pagedate", E[H.cfg.getProperty("MDY_MONTH_POSITION") - 1] + I + E[H.cfg.getProperty("MDY_YEAR_POSITION") - 1]);
|
|
H.cfg.fireQueue();
|
|
H.render();
|
|
H.oDomContainer.focus();
|
|
},
|
|
saveEditorValue: function (F) {
|
|
var H = F.node, I;
|
|
if (C.isUndefined(D)) {
|
|
I = F.inputElement.value;
|
|
} else {
|
|
var J = F.inputObject, G = J.getSelectedDates()[0], E = [];
|
|
E[J.cfg.getProperty("MDY_DAY_POSITION") - 1] = G.getDate();
|
|
E[J.cfg.getProperty("MDY_MONTH_POSITION") - 1] = G.getMonth() + 1;
|
|
E[J.cfg.getProperty("MDY_YEAR_POSITION") - 1] = G.getFullYear();
|
|
I = E.join(J.cfg.getProperty("DATE_FIELD_DELIMITER"));
|
|
}
|
|
H.label = I;
|
|
H.data.label = I;
|
|
H.getLabelEl().innerHTML = I;
|
|
}
|
|
});
|
|
})();
|
|
(function () {
|
|
var E = YAHOO.util.Dom, F = YAHOO.lang, B = YAHOO.util.Event, D = YAHOO.widget.TreeView, C = D.prototype;
|
|
D.editorData = {
|
|
active: false,
|
|
whoHasIt: null,
|
|
nodeType: null,
|
|
editorPanel: null,
|
|
inputContainer: null,
|
|
buttonsContainer: null,
|
|
node: null,
|
|
saveOnEnter: true
|
|
};
|
|
C._nodeEditing = function (M) {
|
|
if (M.fillEditorContainer && M.editable) {
|
|
var I, K, L, J, H = D.editorData;
|
|
H.active = true;
|
|
H.whoHasIt = this;
|
|
if (!H.nodeType) {
|
|
H.editorPanel = I = document.body.appendChild(document.createElement("div"));
|
|
E.addClass(I, "ygtv-label-editor");
|
|
L = H.buttonsContainer = I.appendChild(document.createElement("div"));
|
|
E.addClass(L, "ygtv-button-container");
|
|
J = L.appendChild(document.createElement("button"));
|
|
E.addClass(J, "ygtvok");
|
|
J.innerHTML = " ";
|
|
J = L.appendChild(document.createElement("button"));
|
|
E.addClass(J, "ygtvcancel");
|
|
J.innerHTML = " ";
|
|
B.on(L, "click", function (O) {
|
|
var P = B.getTarget(O);
|
|
var N = D.editorData.node;
|
|
if (E.hasClass(P, "ygtvok")) {
|
|
B.stopEvent(O);
|
|
this._closeEditor(true);
|
|
}
|
|
if (E.hasClass(P, "ygtvcancel")) {
|
|
B.stopEvent(O);
|
|
this._closeEditor(false);
|
|
}
|
|
}, this, true);
|
|
H.inputContainer = I.appendChild(document.createElement("div"));
|
|
E.addClass(H.inputContainer, "ygtv-input");
|
|
B.on(I, "keydown", function (P) {
|
|
var O = D.editorData, N = YAHOO.util.KeyListener.KEY;
|
|
switch (P.keyCode) {
|
|
case N.ENTER:
|
|
B.stopEvent(P);
|
|
if (O.saveOnEnter) {
|
|
this._closeEditor(true);
|
|
}
|
|
break;
|
|
case N.ESCAPE:
|
|
B.stopEvent(P);
|
|
this._closeEditor(false);
|
|
break;
|
|
}
|
|
}, this, true);
|
|
} else {
|
|
I = H.editorPanel;
|
|
}
|
|
H.node = M;
|
|
if (H.nodeType) {
|
|
E.removeClass(I, "ygtv-edit-" + H.nodeType);
|
|
}
|
|
E.addClass(I, " ygtv-edit-" + M._type);
|
|
K = E.getXY(M.getContentEl());
|
|
E.setStyle(I, "left", K[0] + "px");
|
|
E.setStyle(I, "top", K[1] + "px");
|
|
E.setStyle(I, "display", "block");
|
|
I.focus();
|
|
M.fillEditorContainer(H);
|
|
return true;
|
|
}
|
|
};
|
|
C.onEventEditNode = function (H) {
|
|
if (H instanceof YAHOO.widget.Node) {
|
|
H.editNode();
|
|
} else {
|
|
if (H.node instanceof YAHOO.widget.Node) {
|
|
H.node.editNode();
|
|
}
|
|
}
|
|
};
|
|
C._closeEditor = function (J) {
|
|
var H = D.editorData, I = H.node;
|
|
if (J) {
|
|
H.node.saveEditorValue(H);
|
|
}
|
|
E.setStyle(H.editorPanel, "display", "none");
|
|
H.active = false;
|
|
I.focus();
|
|
};
|
|
C._destroyEditor = function () {
|
|
var H = D.editorData;
|
|
if (H && H.nodeType && (!H.active || H.whoHasIt === this)) {
|
|
B.removeListener(H.editorPanel, "keydown");
|
|
B.removeListener(H.buttonContainer, "click");
|
|
H.node.destroyEditorContents(H);
|
|
document.body.removeChild(H.editorPanel);
|
|
H.nodeType = H.editorPanel = H.inputContainer = H.buttonsContainer = H.whoHasIt = H.node = null;
|
|
H.active = false;
|
|
}
|
|
};
|
|
var G = YAHOO.widget.Node.prototype;
|
|
G.editable = false;
|
|
G.editNode = function () {
|
|
this.tree._nodeEditing(this);
|
|
};
|
|
G.fillEditorContainer = null;
|
|
G.destroyEditorContents = function (H) {
|
|
B.purgeElement(H.inputContainer, true);
|
|
H.inputContainer.innerHTML = "";
|
|
};
|
|
G.saveEditorValue = function (H) {
|
|
};
|
|
var A = YAHOO.widget.TextNode.prototype;
|
|
A.fillEditorContainer = function (I) {
|
|
var H;
|
|
if (I.nodeType != this._type) {
|
|
I.nodeType = this._type;
|
|
I.saveOnEnter = true;
|
|
I.node.destroyEditorContents(I);
|
|
I.inputElement = H = I.inputContainer.appendChild(document.createElement("input"));
|
|
} else {
|
|
H = I.inputElement;
|
|
}
|
|
H.value = this.label;
|
|
H.focus();
|
|
H.select();
|
|
};
|
|
A.saveEditorValue = function (H) {
|
|
var I = H.node, J = H.inputElement.value;
|
|
I.label = J;
|
|
I.data.label = J;
|
|
I.getLabelEl().innerHTML = J;
|
|
};
|
|
A.destroyEditorContents = function (H) {
|
|
H.inputContainer.innerHTML = "";
|
|
};
|
|
})();
|
|
YAHOO.widget.TVAnim = function () {
|
|
return {
|
|
FADE_IN: "TVFadeIn", FADE_OUT: "TVFadeOut", getAnim: function (B, A, C) {
|
|
if (YAHOO.widget[B]) {
|
|
return new YAHOO.widget[B](A, C);
|
|
} else {
|
|
return null;
|
|
}
|
|
}, isValid: function (A) {
|
|
return (YAHOO.widget[A]);
|
|
}
|
|
};
|
|
}();
|
|
YAHOO.widget.TVFadeIn = function (A, B) {
|
|
this.el = A;
|
|
this.callback = B;
|
|
};
|
|
YAHOO.widget.TVFadeIn.prototype = {
|
|
animate: function () {
|
|
var D = this;
|
|
var C = this.el.style;
|
|
C.opacity = 0.1;
|
|
C.filter = "alpha(opacity=10)";
|
|
C.display = "";
|
|
var B = 0.4;
|
|
var A = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit: ""}}, B);
|
|
A.onComplete.subscribe(function () {
|
|
D.onComplete();
|
|
});
|
|
A.animate();
|
|
}, onComplete: function () {
|
|
this.callback();
|
|
}, toString: function () {
|
|
return "TVFadeIn";
|
|
}
|
|
};
|
|
YAHOO.widget.TVFadeOut = function (A, B) {
|
|
this.el = A;
|
|
this.callback = B;
|
|
};
|
|
YAHOO.widget.TVFadeOut.prototype = {
|
|
animate: function () {
|
|
var C = this;
|
|
var B = 0.4;
|
|
var A = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit: ""}}, B);
|
|
A.onComplete.subscribe(function () {
|
|
C.onComplete();
|
|
});
|
|
A.animate();
|
|
}, onComplete: function () {
|
|
var A = this.el.style;
|
|
A.display = "none";
|
|
A.filter = "alpha(opacity=100)";
|
|
this.callback();
|
|
}, toString: function () {
|
|
return "TVFadeOut";
|
|
}
|
|
};
|
|
YAHOO.register("treeview", YAHOO.widget.TreeView, {version: "2.6.0", build: "1321"});// End of File include/javascript/yui/build/treeview/treeview-min.js
|
|
|
|
YAHOO.namespace("SUGAR");
|
|
|
|
/**
|
|
* Message Box is a singleton widget designed to replace the browsers 'alert'
|
|
* function, as well as provide capabilities for pop-over loading bars and
|
|
* other small non-interactive pop-overs.
|
|
* TODO:Still needs configurable buttons in the footer as well as
|
|
* auto building of a loading bar.
|
|
*/
|
|
YAHOO.SUGAR.MessageBox = {
|
|
show: function (config) {
|
|
var defaultConfig = {
|
|
type: 'alert',
|
|
modal: true,
|
|
width: 240,
|
|
id: 'sugarMsgWindow',
|
|
close: true,
|
|
title: "Alert",
|
|
msg: " "
|
|
};
|
|
for (var i in config) {
|
|
defaultConfig[i] = config[i];
|
|
}
|
|
if (YAHOO.SUGAR.MessageBox.panel) {
|
|
YAHOO.SUGAR.MessageBox.panel.destroy();
|
|
}
|
|
YAHOO.SUGAR.MessageBox.panel = new YAHOO.widget.SimpleDialog(defaultConfig.id, {
|
|
width: defaultConfig.width + 'px',
|
|
close: defaultConfig.close,
|
|
modal: defaultConfig.modal,
|
|
visible: true,
|
|
fixedcenter: true,
|
|
constraintoviewport: true,
|
|
draggable: true
|
|
});
|
|
YAHOO.SUGAR.MessageBox.panel.setHeader(defaultConfig.title);
|
|
YAHOO.SUGAR.MessageBox.panel.setBody(defaultConfig.msg);
|
|
YAHOO.SUGAR.MessageBox.panel.setBody(defaultConfig.msg);
|
|
YAHOO.SUGAR.MessageBox.panel.render(document.body);
|
|
YAHOO.SUGAR.MessageBox.panel.show();
|
|
},
|
|
|
|
hide: function () {
|
|
if (YAHOO.SUGAR.MessageBox.panel)
|
|
YAHOO.SUGAR.MessageBox.panel.hide();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* SelectionGrid is simply a YUI Data Table with row selection already enabled.
|
|
*/
|
|
YAHOO.SUGAR.SelectionGrid = function (containerEl, columns, dataSource, config) {
|
|
YAHOO.SUGAR.SelectionGrid.superclass.constructor.call(this, containerEl, columns, dataSource, config);
|
|
// Subscribe to events for row selection
|
|
this.subscribe("rowMouseoverEvent", this.onEventHighlightRow);
|
|
this.subscribe("rowMouseoutEvent", this.onEventUnhighlightRow);
|
|
this.subscribe("rowClickEvent", this.onEventSelectRow);
|
|
// Programmatically select the first row
|
|
this.selectRow(this.getTrEl(0));
|
|
// Programmatically bring focus to the instance so arrow selection works immediately
|
|
this.focus();
|
|
}
|
|
|
|
YAHOO.extend(YAHOO.SUGAR.SelectionGrid, YAHOO.widget.DataTable, {
|
|
sugarfunc: function () {
|
|
console.log("at sugar func")
|
|
}
|
|
});
|
|
|
|
|
|
/**
|
|
* DragDropTable is a YUI Data Table with support for drag/drop row re-ordering.
|
|
*/
|
|
YAHOO.SUGAR.DragDropTable = function (containerEl, columns, dataSource, config) {
|
|
var DDT = YAHOO.SUGAR.DragDropTable;
|
|
DDT.superclass.constructor.call(this, containerEl, columns, dataSource, config);
|
|
this.DDGroup = config.group ? config.group : "defGroup";
|
|
//Add table to the dragdrop table groups
|
|
if (typeof DDT.groups[this.DDGroup] == "undefined")
|
|
DDT.groups[this.DDGroup] = [];
|
|
|
|
DDT.groups[this.DDGroup][DDT.groups[this.DDGroup].length] = this;
|
|
}
|
|
YAHOO.SUGAR.DragDropTable.groups = {
|
|
defGroup: []
|
|
}
|
|
|
|
YAHOO.extend(YAHOO.SUGAR.DragDropTable, YAHOO.widget.ScrollingDataTable, {
|
|
sugarfunc: function () {
|
|
console.log("at sugar func")
|
|
},
|
|
addRowAt: function (record, index) {
|
|
if (typeof(console) != "undefined" && typeof(console.log) == "function")
|
|
console.log(record);
|
|
},
|
|
_addTrEl: function (oRecord) {
|
|
var elTr = YAHOO.SUGAR.DragDropTable.superclass._addTrEl.call(this, oRecord);
|
|
var _rowDD = new YAHOO.SUGAR.RowDD(this, oRecord, elTr);
|
|
return elTr;
|
|
},
|
|
getGroup: function () {
|
|
return YAHOO.SUGAR.DragDropTable.groups[this.DDGroup];
|
|
}
|
|
});
|
|
|
|
/**
|
|
* subclass of DragDrop to allow rows to be picked up and dropped between other rows.
|
|
*/
|
|
YAHOO.SUGAR.RowDD = function (oDataTable, oRecord, elTr) {
|
|
//console.log(elTr);
|
|
if (oDataTable && oRecord && elTr) {
|
|
//YAHOO.SUGAR.RowDD.superclass.constructor.call(this, elTr);
|
|
this.ddtable = oDataTable;
|
|
this.table = oDataTable.getTableEl();
|
|
this.row = oRecord;
|
|
this.rowEl = elTr;
|
|
this.newIndex = null;
|
|
this.init(elTr);
|
|
this.initFrame(); // Needed for DDProxy
|
|
this.invalidHandleTypes = {};
|
|
}
|
|
};
|
|
|
|
|
|
YAHOO.extend(YAHOO.SUGAR.RowDD, YAHOO.util.DDProxy, {
|
|
/*initConstraints: function() {
|
|
//Get the top, right, bottom and left positions
|
|
var region = YAHOO.util.Dom.getRegion(this.table),
|
|
//Get the element we are working on
|
|
el = this.getEl(),
|
|
//Get the xy position of it
|
|
xy = YAHOO.util.Dom.getXY(el),
|
|
//Get the width and height
|
|
width = parseInt(YAHOO.util.Dom.getStyle(el, 'width'), 10),
|
|
height = parseInt(YAHOO.util.Dom.getStyle(el, 'height'), 10),
|
|
//Set left to x minus left
|
|
left = ((xy[0] - region.left) + 15), //Buffer of 15px
|
|
//Set right to right minus x minus width
|
|
right = ((region.right - xy[0] - width) + 15);
|
|
|
|
//Set the constraints based on the above calculations
|
|
this.setXConstraint(left, right);
|
|
this.setYConstraint(10, 10);
|
|
},*/
|
|
|
|
_resizeProxy: function () {
|
|
this.constructor.superclass._resizeProxy.apply(this, arguments);
|
|
var dragEl = this.getDragEl(),
|
|
el = this.getEl();
|
|
|
|
YAHOO.util.Dom.setStyle(this.pointer, 'height', (this.rowEl.offsetHeight + 5) + 'px');
|
|
YAHOO.util.Dom.setStyle(this.pointer, 'display', 'block');
|
|
var xy = YAHOO.util.Dom.getXY(el);
|
|
YAHOO.util.Dom.setXY(this.pointer, [xy[0], (xy[1] - 5)]);
|
|
|
|
YAHOO.util.Dom.setStyle(dragEl, 'height', this.rowEl.offsetHeight + "px");
|
|
YAHOO.util.Dom.setStyle(dragEl, 'width', (parseInt(YAHOO.util.Dom.getStyle(dragEl, 'width'), 10) + 4) + 'px');
|
|
YAHOO.util.Dom.setXY(this.dragEl, xy);
|
|
},
|
|
|
|
startDrag: function (x, y) {
|
|
var Dom = YAHOO.util.Dom;
|
|
var dragEl = this.getDragEl();
|
|
var clickEl = this.getEl();
|
|
Dom.setStyle(clickEl, "opacity", "0.25");
|
|
|
|
dragEl.innerHTML = clickEl.innerHTML;
|
|
|
|
//Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
|
|
Dom.addClass(dragEl, "yui-dt-liner");
|
|
Dom.setStyle(dragEl, "height", (clickEl.clientHeight - 2) + "px");
|
|
Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
|
|
Dom.setStyle(dragEl, "border", "2px solid gray");
|
|
},
|
|
|
|
onMouseDown: function () {
|
|
//this.initConstraints();
|
|
this.resetConstraints();
|
|
},
|
|
|
|
clickValidator: function (e) {
|
|
if (this.row.getData()[0] == " ")
|
|
return false;
|
|
var target = YAHOO.util.Event.getTarget(e);
|
|
return ( this.isValidHandleChild(target) &&
|
|
(this.id == this.handleElId || this.DDM.handleWasClicked(target, this.id)) );
|
|
},
|
|
/**
|
|
* This function checks that the target of the drag is a table row in this
|
|
* DDGroup and simply moves the sourceEL to that location as a preview.
|
|
*/
|
|
onDragOver: function (ev, id) {
|
|
var groupTables = this.ddtable.getGroup();
|
|
for (i in groupTables) {
|
|
var targetTable = groupTables[i];
|
|
var targetRow = targetTable.getRecord(id);
|
|
if (targetRow != null) { // Found the target row/table
|
|
var destEl = YAHOO.util.Dom.get(id);
|
|
destEl.parentNode.insertBefore(this.getEl(), destEl);
|
|
this.newTable = targetTable;
|
|
this.newIndex = targetTable.getRecordIndex(targetRow);
|
|
}
|
|
}
|
|
},
|
|
onDragDrop: function () {
|
|
|
|
},
|
|
endDrag: function () {
|
|
//Ensure the element is back on the home table to be cleaned up.
|
|
if (this.newTable != null && this.newIndex != null) {
|
|
this.getEl().style.display = "none";
|
|
this.table.appendChild(this.getEl());
|
|
this.newTable.addRow(this.row.getData(), this.newIndex);
|
|
this.ddtable.deleteRow(this.row);
|
|
this.ddtable.render();
|
|
}
|
|
this.newTable = this.newIndex = null
|
|
YAHOO.util.Dom.setStyle(this.pointer, 'display', 'none');
|
|
|
|
var clickEl = this.getEl();
|
|
YAHOO.util.Dom.setStyle(clickEl, "opacity", "");
|
|
}
|
|
});
|
|
|
|
/**
|
|
* The sugar Tree is a YUI tree with node construction based on AJAX data built in.
|
|
*/
|
|
/*
|
|
YAHOO.SUGAR.Tree = function (parentEl, baseRequestParams, rootParams) {
|
|
this.baseRequestParams = baseRequestParams;
|
|
YAHOO.SUGAR.Tree.superclass.constructor.call(this, parentEl);
|
|
if (rootParams) {
|
|
if (typeof rootParams == "string")
|
|
this.sendTreeNodeDataRequest(this.getRoot(), rootParams);
|
|
else
|
|
this.sendTreeNodeDataRequest(this.getRoot(), "");
|
|
}
|
|
}
|
|
|
|
YAHOO.extend(YAHOO.SUGAR.Tree, YAHOO.widget.TreeView, {
|
|
sendTreeNodeDataRequest: function(parentNode, params){
|
|
YAHOO.util.Connect.asyncRequest('POST', 'index.php', {
|
|
success: this.handleTreeNodeDataRequest,
|
|
argument: {
|
|
parentNode: parentNode
|
|
},
|
|
scope: this,
|
|
}, this.baseRequestParams + params);
|
|
},
|
|
|
|
handleTreeNodeDataRequest : function(o) {
|
|
var parentNode = o.argument.parentNode;
|
|
//parent.tree.removeChildren(parentNode);
|
|
var resp = YAHOO.lang.JSON.parse(o.responseText);
|
|
if (resp.tree_data.nodes) {
|
|
for (var i = 0; i < resp.tree_data.nodes.length; i++) {
|
|
var newChild = this.buildTreeNodeRecursive(resp.tree_data.nodes[i], parentNode);
|
|
}
|
|
}
|
|
parentNode.tree.draw();
|
|
},
|
|
|
|
buildTreeNodeRecursive : function(nodeData, parentNode) {
|
|
nodeData.label = nodeData.text;
|
|
var node = new YAHOO.widget.TextNode(nodeData, parentNode, nodeData.expanded);
|
|
if (typeof(nodeData.children) == 'object') {
|
|
for (var i = 0; i < nodeData.children.length; i++) {
|
|
this.buildTreeNodeRecursive(nodeData.children[i], node);
|
|
}
|
|
}
|
|
return node;
|
|
}
|
|
});*/
|
|
|
|
// End of File include/javascript/sugarwidgets/SugarYUIWidgets.js
|
|
|