Removed extJS src folder

This commit is contained in:
Eike Foken
2011-04-16 14:11:47 +02:00
parent b570685ae8
commit 24cb2749ed
291 changed files with 0 additions and 99967 deletions

View File

@@ -1,9 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.lib.Dom.getRegion = function(el) {
return Ext.lib.Region.getRegion(el);
};

View File

@@ -1,579 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
if(typeof jQuery == "undefined"){
throw "Unable to load Ext, jQuery not found.";
}
(function(){
var libFlyweight;
Ext.lib.Dom = {
getViewWidth : function(full){
// jQuery doesn't report full window size on document query, so max both
return full ? Math.max(jQuery(document).width(),jQuery(window).width()) : jQuery(window).width();
},
getViewHeight : function(full){
// jQuery doesn't report full window size on document query, so max both
return full ? Math.max(jQuery(document).height(),jQuery(window).height()) : jQuery(window).height();
},
isAncestor : function(p, c){
var ret = false;
p = Ext.getDom(p);
c = Ext.getDom(c);
if (p && c) {
if (p.contains) {
return p.contains(c);
} else if (p.compareDocumentPosition) {
return !!(p.compareDocumentPosition(c) & 16);
} else {
while (c = c.parentNode) {
ret = c == p || ret;
}
}
}
return ret;
},
getRegion : function(el){
return Ext.lib.Region.getRegion(el);
},
//////////////////////////////////////////////////////////////////////////////////////
// Use of jQuery.offset() removed to promote consistent behavior across libs.
// JVS 05/23/07
//////////////////////////////////////////////////////////////////////////////////////
getY : function(el){
return this.getXY(el)[1];
},
getX : function(el){
return this.getXY(el)[0];
},
getXY : function(el) {
var p, pe, b, scroll, bd = (document.body || document.documentElement);
el = Ext.getDom(el);
if(el == bd){
return [0, 0];
}
if (el.getBoundingClientRect) {
b = el.getBoundingClientRect();
scroll = fly(document).getScroll();
return [Math.round(b.left + scroll.left), Math.round(b.top + scroll.top)];
}
var x = 0, y = 0;
p = el;
var hasAbsolute = fly(el).getStyle("position") == "absolute";
while (p) {
x += p.offsetLeft;
y += p.offsetTop;
if (!hasAbsolute && fly(p).getStyle("position") == "absolute") {
hasAbsolute = true;
}
if (Ext.isGecko) {
pe = fly(p);
var bt = parseInt(pe.getStyle("borderTopWidth"), 10) || 0;
var bl = parseInt(pe.getStyle("borderLeftWidth"), 10) || 0;
x += bl;
y += bt;
if (p != el && pe.getStyle('overflow') != 'visible') {
x += bl;
y += bt;
}
}
p = p.offsetParent;
}
if (Ext.isSafari && hasAbsolute) {
x -= bd.offsetLeft;
y -= bd.offsetTop;
}
if (Ext.isGecko && !hasAbsolute) {
var dbd = fly(bd);
x += parseInt(dbd.getStyle("borderLeftWidth"), 10) || 0;
y += parseInt(dbd.getStyle("borderTopWidth"), 10) || 0;
}
p = el.parentNode;
while (p && p != bd) {
if (!Ext.isOpera || (p.tagName != 'TR' && fly(p).getStyle("display") != "inline")) {
x -= p.scrollLeft;
y -= p.scrollTop;
}
p = p.parentNode;
}
return [x, y];
},
setXY : function(el, xy){
el = Ext.fly(el, '_setXY');
el.position();
var pts = el.translatePoints(xy);
if(xy[0] !== false){
el.dom.style.left = pts.left + "px";
}
if(xy[1] !== false){
el.dom.style.top = pts.top + "px";
}
},
setX : function(el, x){
this.setXY(el, [x, false]);
},
setY : function(el, y){
this.setXY(el, [false, y]);
}
};
// all lib flyweight calls use their own flyweight to prevent collisions with developer flyweights
function fly(el){
if(!libFlyweight){
libFlyweight = new Ext.Element.Flyweight();
}
libFlyweight.dom = el;
return libFlyweight;
}
Ext.lib.Event = {
getPageX : function(e){
e = e.browserEvent || e;
return e.pageX;
},
getPageY : function(e){
e = e.browserEvent || e;
return e.pageY;
},
getXY : function(e){
e = e.browserEvent || e;
return [e.pageX, e.pageY];
},
getTarget : function(e){
return e.target;
},
// all Ext events will go through event manager which provides scoping
on : function(el, eventName, fn, scope, override){
jQuery(el).bind(eventName, fn);
},
un : function(el, eventName, fn){
jQuery(el).unbind(eventName, fn);
},
purgeElement : function(el){
jQuery(el).unbind();
},
preventDefault : function(e){
e = e.browserEvent || e;
if(e.preventDefault){
e.preventDefault();
}else{
e.returnValue = false;
}
},
stopPropagation : function(e){
e = e.browserEvent || e;
if(e.stopPropagation){
e.stopPropagation();
}else{
e.cancelBubble = true;
}
},
stopEvent : function(e){
this.preventDefault(e);
this.stopPropagation(e);
},
onAvailable : function(id, fn, scope){
var start = new Date();
var f = function(){
if(start.getElapsed() > 10000){
clearInterval(iid);
}
var el = document.getElementById(id);
if(el){
clearInterval(iid);
fn.call(scope||window, el);
}
};
var iid = setInterval(f, 50);
},
resolveTextNode: Ext.isGecko ? function(node){
if(!node){
return;
}
var s = HTMLElement.prototype.toString.call(node);
if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){
return;
}
return node.nodeType == 3 ? node.parentNode : node;
} : function(node){
return node && node.nodeType == 3 ? node.parentNode : node;
},
getRelatedTarget: function(ev) {
ev = ev.browserEvent || ev;
var t = ev.relatedTarget;
if (!t) {
if (ev.type == "mouseout") {
t = ev.toElement;
} else if (ev.type == "mouseover") {
t = ev.fromElement;
}
}
return this.resolveTextNode(t);
}
};
Ext.lib.Ajax = function(){
var createComplete = function(cb){
return function(xhr, status){
if((status == 'error' || status == 'timeout') && cb.failure){
cb.failure.call(cb.scope||window, createResponse(cb, xhr));
}else if(cb.success){
cb.success.call(cb.scope||window, createResponse(cb, xhr));
}
};
};
var createResponse = function(cb, xhr){
var headerObj = {},
headerStr,
t,
s;
try {
headerStr = xhr.getAllResponseHeaders();
Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){
t = v.indexOf(':');
if(t >= 0){
s = v.substr(0, t).toLowerCase();
if(v.charAt(t + 1) == ' '){
++t;
}
headerObj[s] = v.substr(t + 1);
}
});
} catch(e) {}
return {
responseText: xhr.responseText,
responseXML : xhr.responseXML,
argument: cb.argument,
status: xhr.status,
statusText: xhr.statusText,
getResponseHeader : function(header){
return headerObj[header.toLowerCase()];
},
getAllResponseHeaders : function(){
return headerStr;
}
};
};
return {
request : function(method, uri, cb, data, options){
var o = {
type: method,
url: uri,
data: data,
timeout: cb.timeout,
complete: createComplete(cb)
};
if(options){
var hs = options.headers;
if(options.xmlData){
o.data = options.xmlData;
o.processData = false;
o.type = (method ? method : (options.method ? options.method : 'POST'));
if (!hs || !hs['Content-Type']){
o.contentType = 'text/xml';
}
}else if(options.jsonData){
o.data = typeof options.jsonData == 'object' ? Ext.encode(options.jsonData) : options.jsonData;
o.processData = false;
o.type = (method ? method : (options.method ? options.method : 'POST'));
if (!hs || !hs['Content-Type']){
o.contentType = 'application/json';
}
}
if(hs){
o.beforeSend = function(xhr){
for (var h in hs) {
if (hs.hasOwnProperty(h)) {
xhr.setRequestHeader(h, hs[h]);
}
}
};
}
}
jQuery.ajax(o);
},
formRequest : function(form, uri, cb, data, isUpload, sslUri){
jQuery.ajax({
type: Ext.getDom(form).method ||'POST',
url: uri,
data: jQuery(form).serialize()+(data?'&'+data:''),
timeout: cb.timeout,
complete: createComplete(cb)
});
},
isCallInProgress : function(trans){
return false;
},
abort : function(trans){
return false;
},
serializeForm : function(form){
return jQuery(form.dom||form).serialize();
}
};
}();
Ext.lib.Anim = function(){
var createAnim = function(cb, scope){
var animated = true;
return {
stop : function(skipToLast){
// do nothing
},
isAnimated : function(){
return animated;
},
proxyCallback : function(){
animated = false;
Ext.callback(cb, scope);
}
};
};
return {
scroll : function(el, args, duration, easing, cb, scope){
// scroll anim not supported so just scroll immediately
var anim = createAnim(cb, scope);
el = Ext.getDom(el);
if(typeof args.scroll.to[0] == 'number'){
el.scrollLeft = args.scroll.to[0];
}
if(typeof args.scroll.to[1] == 'number'){
el.scrollTop = args.scroll.to[1];
}
anim.proxyCallback();
return anim;
},
motion : function(el, args, duration, easing, cb, scope){
return this.run(el, args, duration, easing, cb, scope);
},
color : function(el, args, duration, easing, cb, scope){
// color anim not supported, so execute callback immediately
var anim = createAnim(cb, scope);
anim.proxyCallback();
return anim;
},
run : function(el, args, duration, easing, cb, scope, type){
var anim = createAnim(cb, scope), e = Ext.fly(el, '_animrun');
var o = {};
for(var k in args){
switch(k){ // jquery doesn't support, so convert
case 'points':
var by, pts;
e.position();
if(by = args.points.by){
var xy = e.getXY();
pts = e.translatePoints([xy[0]+by[0], xy[1]+by[1]]);
}else{
pts = e.translatePoints(args.points.to);
}
o.left = pts.left;
o.top = pts.top;
if(!parseInt(e.getStyle('left'), 10)){ // auto bug
e.setLeft(0);
}
if(!parseInt(e.getStyle('top'), 10)){
e.setTop(0);
}
if(args.points.from){
e.setXY(args.points.from);
}
break;
case 'width':
o.width = args.width.to;
if (args.width.from)
e.setWidth(args.width.from);
break;
case 'height':
o.height = args.height.to;
if (args.height.from)
e.setHeight(args.height.from);
break;
case 'opacity':
o.opacity = args.opacity.to;
if (args.opacity.from)
e.setOpacity(args.opacity.from);
break;
case 'left':
o.left = args.left.to;
if (args.left.from)
e.setLeft(args.left.from);
break;
case 'top':
o.top = args.top.to;
if (args.top.from)
e.setTop(args.top.from);
break;
// jQuery can't handle callback, scope, and xy arguments, so break here
case 'callback':
case 'scope':
case 'xy':
break;
default:
o[k] = args[k].to;
if (args[k].from)
e.setStyle(k, args[k].from);
break;
}
}
// TODO: find out about easing plug in?
jQuery(el).animate(o, duration*1000, undefined, anim.proxyCallback);
return anim;
}
};
}();
Ext.lib.Region = function(t, r, b, l) {
this.top = t;
this[1] = t;
this.right = r;
this.bottom = b;
this.left = l;
this[0] = l;
};
Ext.lib.Region.prototype = {
contains : function(region) {
return ( region.left >= this.left &&
region.right <= this.right &&
region.top >= this.top &&
region.bottom <= this.bottom );
},
getArea : function() {
return ( (this.bottom - this.top) * (this.right - this.left) );
},
intersect : function(region) {
var t = Math.max( this.top, region.top );
var r = Math.min( this.right, region.right );
var b = Math.min( this.bottom, region.bottom );
var l = Math.max( this.left, region.left );
if (b >= t && r >= l) {
return new Ext.lib.Region(t, r, b, l);
} else {
return null;
}
},
union : function(region) {
var t = Math.min( this.top, region.top );
var r = Math.max( this.right, region.right );
var b = Math.max( this.bottom, region.bottom );
var l = Math.min( this.left, region.left );
return new Ext.lib.Region(t, r, b, l);
},
constrainTo : function(r) {
this.top = this.top.constrain(r.top, r.bottom);
this.bottom = this.bottom.constrain(r.top, r.bottom);
this.left = this.left.constrain(r.left, r.right);
this.right = this.right.constrain(r.left, r.right);
return this;
},
adjust : function(t, l, b, r){
this.top += t;
this.left += l;
this.right += r;
this.bottom += b;
return this;
}
};
Ext.lib.Region.getRegion = function(el) {
var p = Ext.lib.Dom.getXY(el);
var t = p[1];
var r = p[0] + el.offsetWidth;
var b = p[1] + el.offsetHeight;
var l = p[0];
return new Ext.lib.Region(t, r, b, l);
};
Ext.lib.Point = function(x, y) {
if (Ext.isArray(x)) {
y = x[1];
x = x[0];
}
this.x = this.right = this.left = this[0] = x;
this.y = this.top = this.bottom = this[1] = y;
};
Ext.lib.Point.prototype = new Ext.lib.Region();
// prevent IE leaks
if(Ext.isIE) {
function fnCleanUp() {
var p = Function.prototype;
delete p.createSequence;
delete p.defer;
delete p.createDelegate;
delete p.createCallback;
delete p.createInterceptor;
window.detachEvent("onunload", fnCleanUp);
}
window.attachEvent("onunload", fnCleanUp);
}
})();

View File

@@ -1,608 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
(function(){
var libFlyweight,
version = Prototype.Version.split('.'),
mouseEnterSupported = (parseInt(version[0], 10) >= 2) || (parseInt(version[1], 10) >= 7) || (parseInt(version[2], 10) >= 1),
mouseCache = {},
elContains = function(parent, child) {
if(parent && parent.firstChild){
while(child) {
if(child === parent) {
return true;
}
child = child.parentNode;
if(child && (child.nodeType != 1)) {
child = null;
}
}
}
return false;
},
checkRelatedTarget = function(e) {
return !elContains(e.currentTarget, Ext.lib.Event.getRelatedTarget(e));
};
Ext.lib.Dom = {
getViewWidth : function(full){
return full ? this.getDocumentWidth() : this.getViewportWidth();
},
getViewHeight : function(full){
return full ? this.getDocumentHeight() : this.getViewportHeight();
},
getDocumentHeight: function() { // missing from prototype?
var scrollHeight = (document.compatMode != "CSS1Compat") ? document.body.scrollHeight : document.documentElement.scrollHeight;
return Math.max(scrollHeight, this.getViewportHeight());
},
getDocumentWidth: function() { // missing from prototype?
var scrollWidth = (document.compatMode != "CSS1Compat") ? document.body.scrollWidth : document.documentElement.scrollWidth;
return Math.max(scrollWidth, this.getViewportWidth());
},
getViewportHeight: function() { // missing from prototype?
var height = self.innerHeight;
var mode = document.compatMode;
if ( (mode || Ext.isIE) && !Ext.isOpera ) {
height = (mode == "CSS1Compat") ?
document.documentElement.clientHeight : // Standards
document.body.clientHeight; // Quirks
}
return height;
},
getViewportWidth: function() { // missing from prototype?
var width = self.innerWidth; // Safari
var mode = document.compatMode;
if (mode || Ext.isIE) { // IE, Gecko, Opera
width = (mode == "CSS1Compat") ?
document.documentElement.clientWidth : // Standards
document.body.clientWidth; // Quirks
}
return width;
},
isAncestor : function(p, c){ // missing from prototype?
var ret = false;
p = Ext.getDom(p);
c = Ext.getDom(c);
if (p && c) {
if (p.contains) {
return p.contains(c);
} else if (p.compareDocumentPosition) {
return !!(p.compareDocumentPosition(c) & 16);
} else {
while (c = c.parentNode) {
ret = c == p || ret;
}
}
}
return ret;
},
getRegion : function(el){
return Ext.lib.Region.getRegion(el);
},
getY : function(el){
return this.getXY(el)[1];
},
getX : function(el){
return this.getXY(el)[0];
},
getXY : function(el){ // this initially used Position.cumulativeOffset but it is not accurate enough
var p, pe, b, scroll, bd = (document.body || document.documentElement);
el = Ext.getDom(el);
if(el == bd){
return [0, 0];
}
if (el.getBoundingClientRect) {
b = el.getBoundingClientRect();
scroll = fly(document).getScroll();
return [Math.round(b.left + scroll.left), Math.round(b.top + scroll.top)];
}
var x = 0, y = 0;
p = el;
var hasAbsolute = fly(el).getStyle("position") == "absolute";
while (p) {
x += p.offsetLeft;
y += p.offsetTop;
if (!hasAbsolute && fly(p).getStyle("position") == "absolute") {
hasAbsolute = true;
}
if (Ext.isGecko) {
pe = fly(p);
var bt = parseInt(pe.getStyle("borderTopWidth"), 10) || 0;
var bl = parseInt(pe.getStyle("borderLeftWidth"), 10) || 0;
x += bl;
y += bt;
if (p != el && pe.getStyle('overflow') != 'visible') {
x += bl;
y += bt;
}
}
p = p.offsetParent;
}
if (Ext.isSafari && hasAbsolute) {
x -= bd.offsetLeft;
y -= bd.offsetTop;
}
if (Ext.isGecko && !hasAbsolute) {
var dbd = fly(bd);
x += parseInt(dbd.getStyle("borderLeftWidth"), 10) || 0;
y += parseInt(dbd.getStyle("borderTopWidth"), 10) || 0;
}
p = el.parentNode;
while (p && p != bd) {
if (!Ext.isOpera || (p.tagName != 'TR' && fly(p).getStyle("display") != "inline")) {
x -= p.scrollLeft;
y -= p.scrollTop;
}
p = p.parentNode;
}
return [x, y];
},
setXY : function(el, xy){ // this initially used Position.cumulativeOffset but it is not accurate enough
el = Ext.fly(el, '_setXY');
el.position();
var pts = el.translatePoints(xy);
if(xy[0] !== false){
el.dom.style.left = pts.left + "px";
}
if(xy[1] !== false){
el.dom.style.top = pts.top + "px";
}
},
setX : function(el, x){
this.setXY(el, [x, false]);
},
setY : function(el, y){
this.setXY(el, [false, y]);
}
};
Ext.lib.Event = {
getPageX : function(e){
return Event.pointerX(e.browserEvent || e);
},
getPageY : function(e){
return Event.pointerY(e.browserEvent || e);
},
getXY : function(e){
e = e.browserEvent || e;
return [Event.pointerX(e), Event.pointerY(e)];
},
getTarget : function(e){
return Event.element(e.browserEvent || e);
},
resolveTextNode: Ext.isGecko ? function(node){
if(!node){
return;
}
var s = HTMLElement.prototype.toString.call(node);
if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){
return;
}
return node.nodeType == 3 ? node.parentNode : node;
} : function(node){
return node && node.nodeType == 3 ? node.parentNode : node;
},
getRelatedTarget: function(ev) { // missing from prototype?
ev = ev.browserEvent || ev;
var t = ev.relatedTarget;
if (!t) {
if (ev.type == "mouseout") {
t = ev.toElement;
} else if (ev.type == "mouseover") {
t = ev.fromElement;
}
}
return this.resolveTextNode(t);
},
on : function(el, eventName, fn){
if((eventName == 'mouseenter' || eventName == 'mouseleave') && !mouseEnterSupported){
var item = mouseCache[el.id] || (mouseCache[el.id] = {});
item[eventName] = fn;
fn = fn.createInterceptor(checkRelatedTarget);
eventName = (eventName == 'mouseenter') ? 'mouseover' : 'mouseout';
}
Event.observe(el, eventName, fn, false);
},
un : function(el, eventName, fn){
if((eventName == 'mouseenter' || eventName == 'mouseleave') && !mouseEnterSupported){
var item = mouseCache[el.id],
ev = item && item[eventName];
if(ev){
fn = ev.fn;
delete item[eventName];
eventName = (eventName == 'mouseenter') ? 'mouseover' : 'mouseout';
}
}
Event.stopObserving(el, eventName, fn, false);
},
purgeElement : function(el){
// no equiv?
},
preventDefault : function(e){ // missing from prototype?
e = e.browserEvent || e;
if(e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
},
stopPropagation : function(e){ // missing from prototype?
e = e.browserEvent || e;
if(e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
},
stopEvent : function(e){
Event.stop(e.browserEvent || e);
},
onAvailable : function(id, fn, scope){ // no equiv
var start = new Date(), iid;
var f = function(){
if(start.getElapsed() > 10000){
clearInterval(iid);
}
var el = document.getElementById(id);
if(el){
clearInterval(iid);
fn.call(scope||window, el);
}
};
iid = setInterval(f, 50);
}
};
Ext.lib.Ajax = function(){
var createSuccess = function(cb){
return cb.success ? function(xhr){
cb.success.call(cb.scope||window, createResponse(cb, xhr));
} : Ext.emptyFn;
};
var createFailure = function(cb){
return cb.failure ? function(xhr){
cb.failure.call(cb.scope||window, createResponse(cb, xhr));
} : Ext.emptyFn;
};
var createResponse = function(cb, xhr){
var headerObj = {},
headerStr,
t,
s;
try {
headerStr = xhr.getAllResponseHeaders();
Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){
t = v.indexOf(':');
if(t >= 0){
s = v.substr(0, t).toLowerCase();
if(v.charAt(t + 1) == ' '){
++t;
}
headerObj[s] = v.substr(t + 1);
}
});
} catch(e) {}
return {
responseText: xhr.responseText,
responseXML : xhr.responseXML,
argument: cb.argument,
status: xhr.status,
statusText: xhr.statusText,
getResponseHeader : function(header){
return headerObj[header.toLowerCase()];
},
getAllResponseHeaders : function(){
return headerStr;
}
};
};
return {
request : function(method, uri, cb, data, options){
var o = {
method: method,
parameters: data || '',
timeout: cb.timeout,
onSuccess: createSuccess(cb),
onFailure: createFailure(cb)
};
if(options){
var hs = options.headers;
if(hs){
o.requestHeaders = hs;
}
if(options.xmlData){
method = (method ? method : (options.method ? options.method : 'POST'));
if (!hs || !hs['Content-Type']){
o.contentType = 'text/xml';
}
o.postBody = options.xmlData;
delete o.parameters;
}
if(options.jsonData){
method = (method ? method : (options.method ? options.method : 'POST'));
if (!hs || !hs['Content-Type']){
o.contentType = 'application/json';
}
o.postBody = typeof options.jsonData == 'object' ? Ext.encode(options.jsonData) : options.jsonData;
delete o.parameters;
}
}
new Ajax.Request(uri, o);
},
formRequest : function(form, uri, cb, data, isUpload, sslUri){
new Ajax.Request(uri, {
method: Ext.getDom(form).method ||'POST',
parameters: Form.serialize(form)+(data?'&'+data:''),
timeout: cb.timeout,
onSuccess: createSuccess(cb),
onFailure: createFailure(cb)
});
},
isCallInProgress : function(trans){
return false;
},
abort : function(trans){
return false;
},
serializeForm : function(form){
return Form.serialize(form.dom||form);
}
};
}();
Ext.lib.Anim = function(){
var easings = {
easeOut: function(pos) {
return 1-Math.pow(1-pos,2);
},
easeIn: function(pos) {
return 1-Math.pow(1-pos,2);
}
};
var createAnim = function(cb, scope){
return {
stop : function(skipToLast){
this.effect.cancel();
},
isAnimated : function(){
return this.effect.state == 'running';
},
proxyCallback : function(){
Ext.callback(cb, scope);
}
};
};
return {
scroll : function(el, args, duration, easing, cb, scope){
// not supported so scroll immediately?
var anim = createAnim(cb, scope);
el = Ext.getDom(el);
if(typeof args.scroll.to[0] == 'number'){
el.scrollLeft = args.scroll.to[0];
}
if(typeof args.scroll.to[1] == 'number'){
el.scrollTop = args.scroll.to[1];
}
anim.proxyCallback();
return anim;
},
motion : function(el, args, duration, easing, cb, scope){
return this.run(el, args, duration, easing, cb, scope);
},
color : function(el, args, duration, easing, cb, scope){
return this.run(el, args, duration, easing, cb, scope);
},
run : function(el, args, duration, easing, cb, scope, type){
var o = {};
for(var k in args){
switch(k){ // scriptaculous doesn't support, so convert these
case 'points':
var by, pts, e = Ext.fly(el, '_animrun');
e.position();
if(by = args.points.by){
var xy = e.getXY();
pts = e.translatePoints([xy[0]+by[0], xy[1]+by[1]]);
}else{
pts = e.translatePoints(args.points.to);
}
o.left = pts.left+'px';
o.top = pts.top+'px';
break;
case 'width':
o.width = args.width.to+'px';
break;
case 'height':
o.height = args.height.to+'px';
break;
case 'opacity':
o.opacity = String(args.opacity.to);
break;
default:
o[k] = String(args[k].to);
break;
}
}
var anim = createAnim(cb, scope);
anim.effect = new Effect.Morph(Ext.id(el), {
duration: duration,
afterFinish: anim.proxyCallback,
transition: easings[easing] || Effect.Transitions.linear,
style: o
});
return anim;
}
};
}();
// all lib flyweight calls use their own flyweight to prevent collisions with developer flyweights
function fly(el){
if(!libFlyweight){
libFlyweight = new Ext.Element.Flyweight();
}
libFlyweight.dom = el;
return libFlyweight;
}
Ext.lib.Region = function(t, r, b, l) {
this.top = t;
this[1] = t;
this.right = r;
this.bottom = b;
this.left = l;
this[0] = l;
};
Ext.lib.Region.prototype = {
contains : function(region) {
return ( region.left >= this.left &&
region.right <= this.right &&
region.top >= this.top &&
region.bottom <= this.bottom );
},
getArea : function() {
return ( (this.bottom - this.top) * (this.right - this.left) );
},
intersect : function(region) {
var t = Math.max( this.top, region.top );
var r = Math.min( this.right, region.right );
var b = Math.min( this.bottom, region.bottom );
var l = Math.max( this.left, region.left );
if (b >= t && r >= l) {
return new Ext.lib.Region(t, r, b, l);
} else {
return null;
}
},
union : function(region) {
var t = Math.min( this.top, region.top );
var r = Math.max( this.right, region.right );
var b = Math.max( this.bottom, region.bottom );
var l = Math.min( this.left, region.left );
return new Ext.lib.Region(t, r, b, l);
},
constrainTo : function(r) {
this.top = this.top.constrain(r.top, r.bottom);
this.bottom = this.bottom.constrain(r.top, r.bottom);
this.left = this.left.constrain(r.left, r.right);
this.right = this.right.constrain(r.left, r.right);
return this;
},
adjust : function(t, l, b, r){
this.top += t;
this.left += l;
this.right += r;
this.bottom += b;
return this;
}
};
Ext.lib.Region.getRegion = function(el) {
var p = Ext.lib.Dom.getXY(el);
var t = p[1];
var r = p[0] + el.offsetWidth;
var b = p[1] + el.offsetHeight;
var l = p[0];
return new Ext.lib.Region(t, r, b, l);
};
Ext.lib.Point = function(x, y) {
if (Ext.isArray(x)) {
y = x[1];
x = x[0];
}
this.x = this.right = this.left = this[0] = x;
this.y = this.top = this.bottom = this[1] = y;
};
Ext.lib.Point.prototype = new Ext.lib.Region();
// prevent IE leaks
if(Ext.isIE) {
function fnCleanUp() {
var p = Function.prototype;
delete p.createSequence;
delete p.defer;
delete p.createDelegate;
delete p.createCallback;
delete p.createInterceptor;
window.detachEvent("onunload", fnCleanUp);
}
window.attachEvent("onunload", fnCleanUp);
}
})();

View File

@@ -1,374 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
if(typeof YAHOO == "undefined"){
throw "Unable to load Ext, core YUI utilities (yahoo, dom, event) not found.";
}
(function(){
var E = YAHOO.util.Event,
D = YAHOO.util.Dom,
CN = YAHOO.util.Connect,
ES = YAHOO.util.Easing,
A = YAHOO.util.Anim,
libFlyweight,
version = YAHOO.env.getVersion('yahoo').version.split('.'),
mouseEnterSupported = parseInt(version[0], 10) >= 3,
mouseCache = {},
elContains = function(parent, child){
if(parent && parent.firstChild){
while(child){
if(child === parent){
return true;
}
child = child.parentNode;
if(child && (child.nodeType != 1)){
child = null;
}
}
}
return false;
}, checkRelatedTarget = function(e){
return !elContains(e.currentTarget, Ext.lib.Event.getRelatedTarget(e));
};
Ext.lib.Dom = {
getViewWidth : function(full){
return full ? D.getDocumentWidth() : D.getViewportWidth();
},
getViewHeight : function(full){
return full ? D.getDocumentHeight() : D.getViewportHeight();
},
isAncestor : function(haystack, needle){
return D.isAncestor(haystack, needle);
},
getRegion : function(el){
return D.getRegion(el);
},
getY : function(el){
return this.getXY(el)[1];
},
getX : function(el){
return this.getXY(el)[0];
},
// original version based on YahooUI getXY
// this version fixes several issues in Safari and FF
// and boosts performance by removing the batch overhead, repetitive dom lookups and array index calls
getXY : function(el){
var p, pe, b, scroll, bd = (document.body || document.documentElement);
el = Ext.getDom(el);
if(el == bd){
return [0, 0];
}
if (el.getBoundingClientRect) {
b = el.getBoundingClientRect();
scroll = fly(document).getScroll();
return [Math.round(b.left + scroll.left), Math.round(b.top + scroll.top)];
}
var x = 0, y = 0;
p = el;
var hasAbsolute = fly(el).getStyle("position") == "absolute";
while (p) {
x += p.offsetLeft;
y += p.offsetTop;
if (!hasAbsolute && fly(p).getStyle("position") == "absolute") {
hasAbsolute = true;
}
if (Ext.isGecko) {
pe = fly(p);
var bt = parseInt(pe.getStyle("borderTopWidth"), 10) || 0;
var bl = parseInt(pe.getStyle("borderLeftWidth"), 10) || 0;
x += bl;
y += bt;
if (p != el && pe.getStyle('overflow') != 'visible') {
x += bl;
y += bt;
}
}
p = p.offsetParent;
}
if (Ext.isSafari && hasAbsolute) {
x -= bd.offsetLeft;
y -= bd.offsetTop;
}
if (Ext.isGecko && !hasAbsolute) {
var dbd = fly(bd);
x += parseInt(dbd.getStyle("borderLeftWidth"), 10) || 0;
y += parseInt(dbd.getStyle("borderTopWidth"), 10) || 0;
}
p = el.parentNode;
while (p && p != bd) {
if (!Ext.isOpera || (p.tagName != 'TR' && fly(p).getStyle("display") != "inline")) {
x -= p.scrollLeft;
y -= p.scrollTop;
}
p = p.parentNode;
}
return [x, y];
},
setXY : function(el, xy){
el = Ext.fly(el, '_setXY');
el.position();
var pts = el.translatePoints(xy);
if(xy[0] !== false){
el.dom.style.left = pts.left + "px";
}
if(xy[1] !== false){
el.dom.style.top = pts.top + "px";
}
},
setX : function(el, x){
this.setXY(el, [x, false]);
},
setY : function(el, y){
this.setXY(el, [false, y]);
}
};
Ext.lib.Event = {
getPageX : function(e){
return E.getPageX(e.browserEvent || e);
},
getPageY : function(e){
return E.getPageY(e.browserEvent || e);
},
getXY : function(e){
return E.getXY(e.browserEvent || e);
},
getTarget : function(e){
return E.getTarget(e.browserEvent || e);
},
getRelatedTarget : function(e){
return E.getRelatedTarget(e.browserEvent || e);
},
on : function(el, eventName, fn, scope, override){
if((eventName == 'mouseenter' || eventName == 'mouseleave') && !mouseEnterSupported){
var item = mouseCache[el.id] || (mouseCache[el.id] = {});
item[eventName] = fn;
fn = fn.createInterceptor(checkRelatedTarget);
eventName = (eventName == 'mouseenter') ? 'mouseover' : 'mouseout';
}
E.on(el, eventName, fn, scope, override);
},
un : function(el, eventName, fn){
if((eventName == 'mouseenter' || eventName == 'mouseleave') && !mouseEnterSupported){
var item = mouseCache[el.id],
ev = item && item[eventName];
if(ev){
fn = ev.fn;
delete item[eventName];
eventName = (eventName == 'mouseenter') ? 'mouseover' : 'mouseout';
}
}
E.removeListener(el, eventName, fn);;
},
purgeElement : function(el){
E.purgeElement(el);
},
preventDefault : function(e){
E.preventDefault(e.browserEvent || e);
},
stopPropagation : function(e){
E.stopPropagation(e.browserEvent || e);
},
stopEvent : function(e){
E.stopEvent(e.browserEvent || e);
},
onAvailable : function(el, fn, scope, override){
return E.onAvailable(el, fn, scope, override);
}
};
Ext.lib.Ajax = {
request : function(method, uri, cb, data, options){
if(options){
var hs = options.headers;
if(hs){
for(var h in hs){
if(hs.hasOwnProperty(h)){
CN.initHeader(h, hs[h], false);
}
}
}
if(options.xmlData){
if (!hs || !hs['Content-Type']){
CN.initHeader('Content-Type', 'text/xml', false);
}
method = (method ? method : (options.method ? options.method : 'POST'));
data = options.xmlData;
}else if(options.jsonData){
if (!hs || !hs['Content-Type']){
CN.initHeader('Content-Type', 'application/json', false);
}
method = (method ? method : (options.method ? options.method : 'POST'));
data = typeof options.jsonData == 'object' ? Ext.encode(options.jsonData) : options.jsonData;
}
}
return CN.asyncRequest(method, uri, cb, data);
},
formRequest : function(form, uri, cb, data, isUpload, sslUri){
CN.setForm(form, isUpload, sslUri);
return CN.asyncRequest(Ext.getDom(form).method ||'POST', uri, cb, data);
},
isCallInProgress : function(trans){
return CN.isCallInProgress(trans);
},
abort : function(trans){
return CN.abort(trans);
},
serializeForm : function(form){
var d = CN.setForm(form.dom || form);
CN.resetFormState();
return d;
}
};
Ext.lib.Region = YAHOO.util.Region;
Ext.lib.Point = YAHOO.util.Point;
Ext.lib.Anim = {
scroll : function(el, args, duration, easing, cb, scope){
this.run(el, args, duration, easing, cb, scope, YAHOO.util.Scroll);
},
motion : function(el, args, duration, easing, cb, scope){
this.run(el, args, duration, easing, cb, scope, YAHOO.util.Motion);
},
color : function(el, args, duration, easing, cb, scope){
this.run(el, args, duration, easing, cb, scope, YAHOO.util.ColorAnim);
},
run : function(el, args, duration, easing, cb, scope, type){
type = type || YAHOO.util.Anim;
if(typeof easing == "string"){
easing = YAHOO.util.Easing[easing];
}
var anim = new type(el, args, duration, easing);
anim.animateX(function(){
Ext.callback(cb, scope);
});
return anim;
}
};
// all lib flyweight calls use their own flyweight to prevent collisions with developer flyweights
function fly(el){
if(!libFlyweight){
libFlyweight = new Ext.Element.Flyweight();
}
libFlyweight.dom = el;
return libFlyweight;
}
// prevent IE leaks
if(Ext.isIE) {
function fnCleanUp() {
var p = Function.prototype;
delete p.createSequence;
delete p.defer;
delete p.createDelegate;
delete p.createCallback;
delete p.createInterceptor;
window.detachEvent("onunload", fnCleanUp);
}
window.attachEvent("onunload", fnCleanUp);
}
// various overrides
// add ability for callbacks with animations
if(YAHOO.util.Anim){
YAHOO.util.Anim.prototype.animateX = function(callback, scope){
var f = function(){
this.onComplete.unsubscribe(f);
if(typeof callback == "function"){
callback.call(scope || this, this);
}
};
this.onComplete.subscribe(f, this, true);
this.animate();
};
}
if(YAHOO.util.DragDrop && Ext.dd.DragDrop){
YAHOO.util.DragDrop.defaultPadding = Ext.dd.DragDrop.defaultPadding;
YAHOO.util.DragDrop.constrainTo = Ext.dd.DragDrop.constrainTo;
}
YAHOO.util.Dom.getXY = function(el) {
var f = function(el) {
return Ext.lib.Dom.getXY(el);
};
return YAHOO.util.Dom.batch(el, f, YAHOO.util.Dom, true);
};
// workaround for Safari anim duration speed problems
if(YAHOO.util.AnimMgr){
YAHOO.util.AnimMgr.fps = 1000;
}
YAHOO.util.Region.prototype.adjust = function(t, l, b, r){
this.top += t;
this.left += l;
this.right += r;
this.bottom += b;
return this;
};
YAHOO.util.Region.prototype.constrainTo = function(r) {
this.top = this.top.constrain(r.top, r.bottom);
this.bottom = this.bottom.constrain(r.top, r.bottom);
this.left = this.left.constrain(r.left, r.right);
this.right = this.right.constrain(r.left, r.right);
return this;
};
})();

View File

@@ -1,112 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.CompositeElement
* @extends Ext.CompositeElementLite
* <p>This class encapsulates a <i>collection</i> of DOM elements, providing methods to filter
* members, or to perform collective actions upon the whole set.</p>
* <p>Although they are not listed, this class supports all of the methods of {@link Ext.Element} and
* {@link Ext.Fx}. The methods from these classes will be performed on all the elements in this collection.</p>
* <p>All methods return <i>this</i> and can be chained.</p>
* Usage:
<pre><code>
var els = Ext.select("#some-el div.some-class", true);
// or select directly from an existing element
var el = Ext.get('some-el');
el.select('div.some-class', true);
els.setWidth(100); // all elements become 100 width
els.hide(true); // all elements fade out and hide
// or
els.setWidth(100).hide(true);
</code></pre>
*/
Ext.CompositeElement = Ext.extend(Ext.CompositeElementLite, {
constructor : function(els, root){
this.elements = [];
this.add(els, root);
},
// private
getElement : function(el){
// In this case just return it, since we already have a reference to it
return el;
},
// private
transformElement : function(el){
return Ext.get(el);
}
/**
* Adds elements to this composite.
* @param {String/Array} els A string CSS selector, an array of elements or an element
* @return {CompositeElement} this
*/
/**
* Returns the Element object at the specified index
* @param {Number} index
* @return {Ext.Element}
*/
/**
* Iterates each <code>element</code> in this <code>composite</code>
* calling the supplied function using {@link Ext#each}.
* @param {Function} fn The function to be called with each
* <code>element</code>. If the supplied function returns <tt>false</tt>,
* iteration stops. This function is called with the following arguments:
* <div class="mdetail-params"><ul>
* <li><code>element</code> : <i>Ext.Element</i><div class="sub-desc">The element at the current <code>index</code>
* in the <code>composite</code></div></li>
* <li><code>composite</code> : <i>Object</i> <div class="sub-desc">This composite.</div></li>
* <li><code>index</code> : <i>Number</i> <div class="sub-desc">The current index within the <code>composite</code> </div></li>
* </ul></div>
* @param {Object} scope (optional) The scope (<code><this</code> reference) in which the specified function is executed.
* Defaults to the <code>element</code> at the current <code>index</code>
* within the composite.
* @return {CompositeElement} this
*/
});
/**
* Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods
* to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or
* {@link Ext.CompositeElementLite CompositeElementLite} object.
* @param {String/Array} selector The CSS selector or an array of elements
* @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object)
* @param {HTMLElement/String} root (optional) The root element of the query or id of the root
* @return {CompositeElementLite/CompositeElement}
* @member Ext.Element
* @method select
*/
Ext.Element.select = function(selector, unique, root){
var els;
if(typeof selector == "string"){
els = Ext.Element.selectorFunction(selector, root);
}else if(selector.length !== undefined){
els = selector;
}else{
throw "Invalid selector";
}
return (unique === true) ? new Ext.CompositeElement(els) : new Ext.CompositeElementLite(els);
};
/**
* Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods
* to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or
* {@link Ext.CompositeElementLite CompositeElementLite} object.
* @param {String/Array} selector The CSS selector or an array of elements
* @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object)
* @param {HTMLElement/String} root (optional) The root element of the query or id of the root
* @return {CompositeElementLite/CompositeElement}
* @member Ext
* @method select
*/
Ext.select = Ext.Element.select;

View File

@@ -1,75 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.CompositeElementLite
*/
Ext.apply(Ext.CompositeElementLite.prototype, {
addElements : function(els, root){
if(!els){
return this;
}
if(typeof els == "string"){
els = Ext.Element.selectorFunction(els, root);
}
var yels = this.elements;
Ext.each(els, function(e) {
yels.push(Ext.get(e));
});
return this;
},
/**
* Returns the first Element
* @return {Ext.Element}
*/
first : function(){
return this.item(0);
},
/**
* Returns the last Element
* @return {Ext.Element}
*/
last : function(){
return this.item(this.getCount()-1);
},
/**
* Returns true if this composite contains the passed element
* @param el {Mixed} The id of an element, or an Ext.Element, or an HtmlElement to find within the composite collection.
* @return Boolean
*/
contains : function(el){
return this.indexOf(el) != -1;
},
/**
* Removes the specified element(s).
* @param {Mixed} el The id of an element, the Element itself, the index of the element in this composite
* or an array of any of those.
* @param {Boolean} removeDom (optional) True to also remove the element from the document
* @return {CompositeElement} this
*/
removeElement : function(keys, removeDom){
var me = this,
els = this.elements,
el;
Ext.each(keys, function(val){
if ((el = (els[val] || els[val = me.indexOf(val)]))) {
if(removeDom){
if(el.dom){
el.remove();
}else{
Ext.removeNode(el);
}
}
els.splice(val, 1);
}
});
return this;
}
});

View File

@@ -1,154 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.DomHelper
*/
Ext.apply(Ext.DomHelper,
function(){
var pub,
afterbegin = 'afterbegin',
afterend = 'afterend',
beforebegin = 'beforebegin',
beforeend = 'beforeend',
confRe = /tag|children|cn|html$/i;
// private
function doInsert(el, o, returnElement, pos, sibling, append){
el = Ext.getDom(el);
var newNode;
if (pub.useDom) {
newNode = createDom(o, null);
if (append) {
el.appendChild(newNode);
} else {
(sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el);
}
} else {
newNode = Ext.DomHelper.insertHtml(pos, el, Ext.DomHelper.createHtml(o));
}
return returnElement ? Ext.get(newNode, true) : newNode;
}
// build as dom
/** @ignore */
function createDom(o, parentNode){
var el,
doc = document,
useSet,
attr,
val,
cn;
if (Ext.isArray(o)) { // Allow Arrays of siblings to be inserted
el = doc.createDocumentFragment(); // in one shot using a DocumentFragment
for (var i = 0, l = o.length; i < l; i++) {
createDom(o[i], el);
}
} else if (typeof o == 'string') { // Allow a string as a child spec.
el = doc.createTextNode(o);
} else {
el = doc.createElement( o.tag || 'div' );
useSet = !!el.setAttribute; // In IE some elements don't have setAttribute
for (var attr in o) {
if(!confRe.test(attr)){
val = o[attr];
if(attr == 'cls'){
el.className = val;
}else{
if(useSet){
el.setAttribute(attr, val);
}else{
el[attr] = val;
}
}
}
}
Ext.DomHelper.applyStyles(el, o.style);
if ((cn = o.children || o.cn)) {
createDom(cn, el);
} else if (o.html) {
el.innerHTML = o.html;
}
}
if(parentNode){
parentNode.appendChild(el);
}
return el;
}
pub = {
/**
* Creates a new Ext.Template from the DOM object spec.
* @param {Object} o The DOM object spec (and children)
* @return {Ext.Template} The new template
*/
createTemplate : function(o){
var html = Ext.DomHelper.createHtml(o);
return new Ext.Template(html);
},
/** True to force the use of DOM instead of html fragments @type Boolean */
useDom : false,
/**
* Creates new DOM element(s) and inserts them before el.
* @param {Mixed} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} returnElement (optional) true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
* @hide (repeat)
*/
insertBefore : function(el, o, returnElement){
return doInsert(el, o, returnElement, beforebegin);
},
/**
* Creates new DOM element(s) and inserts them after el.
* @param {Mixed} el The context element
* @param {Object} o The DOM object spec (and children)
* @param {Boolean} returnElement (optional) true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
* @hide (repeat)
*/
insertAfter : function(el, o, returnElement){
return doInsert(el, o, returnElement, afterend, 'nextSibling');
},
/**
* Creates new DOM element(s) and inserts them as the first child of el.
* @param {Mixed} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} returnElement (optional) true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
* @hide (repeat)
*/
insertFirst : function(el, o, returnElement){
return doInsert(el, o, returnElement, afterbegin, 'firstChild');
},
/**
* Creates new DOM element(s) and appends them to el.
* @param {Mixed} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} returnElement (optional) true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
* @hide (repeat)
*/
append: function(el, o, returnElement){
return doInsert(el, o, returnElement, beforeend, '', true);
},
/**
* Creates new DOM element(s) without inserting them to the document.
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @return {HTMLElement} The new uninserted node
*/
createDom: createDom
};
return pub;
}());

View File

@@ -1,200 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods({
/**
* Stops the specified event(s) from bubbling and optionally prevents the default action
* @param {String/Array} eventName an event / array of events to stop from bubbling
* @param {Boolean} preventDefault (optional) true to prevent the default action too
* @return {Ext.Element} this
*/
swallowEvent : function(eventName, preventDefault) {
var me = this;
function fn(e) {
e.stopPropagation();
if (preventDefault) {
e.preventDefault();
}
}
if (Ext.isArray(eventName)) {
Ext.each(eventName, function(e) {
me.on(e, fn);
});
return me;
}
me.on(eventName, fn);
return me;
},
/**
* Create an event handler on this element such that when the event fires and is handled by this element,
* it will be relayed to another object (i.e., fired again as if it originated from that object instead).
* @param {String} eventName The type of event to relay
* @param {Object} object Any object that extends {@link Ext.util.Observable} that will provide the context
* for firing the relayed event
*/
relayEvent : function(eventName, observable) {
this.on(eventName, function(e) {
observable.fireEvent(eventName, e);
});
},
/**
* Removes worthless text nodes
* @param {Boolean} forceReclean (optional) By default the element
* keeps track if it has been cleaned already so
* you can call this over and over. However, if you update the element and
* need to force a reclean, you can pass true.
*/
clean : function(forceReclean) {
var me = this,
dom = me.dom,
n = dom.firstChild,
ni = -1;
if (Ext.Element.data(dom, 'isCleaned') && forceReclean !== true) {
return me;
}
while (n) {
var nx = n.nextSibling;
if (n.nodeType == 3 && !(/\S/.test(n.nodeValue))) {
dom.removeChild(n);
} else {
n.nodeIndex = ++ni;
}
n = nx;
}
Ext.Element.data(dom, 'isCleaned', true);
return me;
},
/**
* Direct access to the Updater {@link Ext.Updater#update} method. The method takes the same object
* parameter as {@link Ext.Updater#update}
* @return {Ext.Element} this
*/
load : function() {
var updateManager = this.getUpdater();
updateManager.update.apply(updateManager, arguments);
return this;
},
/**
* Gets this element's {@link Ext.Updater Updater}
* @return {Ext.Updater} The Updater
*/
getUpdater : function() {
return this.updateManager || (this.updateManager = new Ext.Updater(this));
},
/**
* Update the innerHTML of this element, optionally searching for and processing scripts
* @param {String} html The new HTML
* @param {Boolean} loadScripts (optional) True to look for and process scripts (defaults to false)
* @param {Function} callback (optional) For async script loading you can be notified when the update completes
* @return {Ext.Element} this
*/
update : function(html, loadScripts, callback) {
if (!this.dom) {
return this;
}
html = html || "";
if (loadScripts !== true) {
this.dom.innerHTML = html;
if (typeof callback == 'function') {
callback();
}
return this;
}
var id = Ext.id(),
dom = this.dom;
html += '<span id="' + id + '"></span>';
Ext.lib.Event.onAvailable(id, function() {
var DOC = document,
hd = DOC.getElementsByTagName("head")[0],
re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,
srcRe = /\ssrc=([\'\"])(.*?)\1/i,
typeRe = /\stype=([\'\"])(.*?)\1/i,
match,
attrs,
srcMatch,
typeMatch,
el,
s;
while ((match = re.exec(html))) {
attrs = match[1];
srcMatch = attrs ? attrs.match(srcRe) : false;
if (srcMatch && srcMatch[2]) {
s = DOC.createElement("script");
s.src = srcMatch[2];
typeMatch = attrs.match(typeRe);
if (typeMatch && typeMatch[2]) {
s.type = typeMatch[2];
}
hd.appendChild(s);
} else if (match[2] && match[2].length > 0) {
if (window.execScript) {
window.execScript(match[2]);
} else {
window.eval(match[2]);
}
}
}
el = DOC.getElementById(id);
if (el) {
Ext.removeNode(el);
}
if (typeof callback == 'function') {
callback();
}
});
dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
return this;
},
// inherit docs, overridden so we can add removeAnchor
removeAllListeners : function() {
this.removeAnchor();
Ext.EventManager.removeAll(this.dom);
return this;
},
/**
* Creates a proxy element of this element
* @param {String/Object} config The class name of the proxy element or a DomHelper config object
* @param {String/HTMLElement} renderTo (optional) The element or element id to render the proxy to (defaults to document.body)
* @param {Boolean} matchBox (optional) True to align and size the proxy to this element now (defaults to false)
* @return {Ext.Element} The new proxy element
*/
createProxy : function(config, renderTo, matchBox) {
config = (typeof config == 'object') ? config : {tag : "div", cls: config};
var me = this,
proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) :
Ext.DomHelper.insertBefore(me.dom, config, true);
if (matchBox && me.setBox && me.getBox) { // check to make sure Element.position.js is loaded
proxy.setBox(me.getBox());
}
return proxy;
}
});
Ext.Element.prototype.getUpdateManager = Ext.Element.prototype.getUpdater;

View File

@@ -1,417 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods({
/**
* Gets the x,y coordinates specified by the anchor position on the element.
* @param {String} anchor (optional) The specified anchor position (defaults to "c"). See {@link #alignTo}
* for details on supported anchor positions.
* @param {Boolean} local (optional) True to get the local (element top/left-relative) anchor position instead
* of page coordinates
* @param {Object} size (optional) An object containing the size to use for calculating anchor position
* {width: (target width), height: (target height)} (defaults to the element's current size)
* @return {Array} [x, y] An array containing the element's x and y coordinates
*/
getAnchorXY : function(anchor, local, s){
//Passing a different size is useful for pre-calculating anchors,
//especially for anchored animations that change the el size.
anchor = (anchor || "tl").toLowerCase();
s = s || {};
var me = this,
vp = me.dom == document.body || me.dom == document,
w = s.width || vp ? Ext.lib.Dom.getViewWidth() : me.getWidth(),
h = s.height || vp ? Ext.lib.Dom.getViewHeight() : me.getHeight(),
xy,
r = Math.round,
o = me.getXY(),
scroll = me.getScroll(),
extraX = vp ? scroll.left : !local ? o[0] : 0,
extraY = vp ? scroll.top : !local ? o[1] : 0,
hash = {
c : [r(w * 0.5), r(h * 0.5)],
t : [r(w * 0.5), 0],
l : [0, r(h * 0.5)],
r : [w, r(h * 0.5)],
b : [r(w * 0.5), h],
tl : [0, 0],
bl : [0, h],
br : [w, h],
tr : [w, 0]
};
xy = hash[anchor];
return [xy[0] + extraX, xy[1] + extraY];
},
/**
* Anchors an element to another element and realigns it when the window is resized.
* @param {Mixed} element The element to align to.
* @param {String} position The position to align to.
* @param {Array} offsets (optional) Offset the positioning by [x, y]
* @param {Boolean/Object} animate (optional) True for the default animation or a standard Element animation config object
* @param {Boolean/Number} monitorScroll (optional) True to monitor body scroll and reposition. If this parameter
* is a number, it is used as the buffer delay (defaults to 50ms).
* @param {Function} callback The function to call after the animation finishes
* @return {Ext.Element} this
*/
anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
var me = this,
dom = me.dom,
scroll = !Ext.isEmpty(monitorScroll),
action = function(){
Ext.fly(dom).alignTo(el, alignment, offsets, animate);
Ext.callback(callback, Ext.fly(dom));
},
anchor = this.getAnchor();
// previous listener anchor, remove it
this.removeAnchor();
Ext.apply(anchor, {
fn: action,
scroll: scroll
});
Ext.EventManager.onWindowResize(action, null);
if(scroll){
Ext.EventManager.on(window, 'scroll', action, null,
{buffer: !isNaN(monitorScroll) ? monitorScroll : 50});
}
action.call(me); // align immediately
return me;
},
/**
* Remove any anchor to this element. See {@link #anchorTo}.
* @return {Ext.Element} this
*/
removeAnchor : function(){
var me = this,
anchor = this.getAnchor();
if(anchor && anchor.fn){
Ext.EventManager.removeResizeListener(anchor.fn);
if(anchor.scroll){
Ext.EventManager.un(window, 'scroll', anchor.fn);
}
delete anchor.fn;
}
return me;
},
// private
getAnchor : function(){
var data = Ext.Element.data,
dom = this.dom;
if (!dom) {
return;
}
var anchor = data(dom, '_anchor');
if(!anchor){
anchor = data(dom, '_anchor', {});
}
return anchor;
},
/**
* Gets the x,y coordinates to align this element with another element. See {@link #alignTo} for more info on the
* supported position values.
* @param {Mixed} element The element to align to.
* @param {String} position (optional, defaults to "tl-bl?") The position to align to.
* @param {Array} offsets (optional) Offset the positioning by [x, y]
* @return {Array} [x, y]
*/
getAlignToXY : function(el, p, o){
el = Ext.get(el);
if(!el || !el.dom){
throw "Element.alignToXY with an element that doesn't exist";
}
o = o || [0,0];
p = (!p || p == "?" ? "tl-bl?" : (!(/-/).test(p) && p !== "" ? "tl-" + p : p || "tl-bl")).toLowerCase();
var me = this,
d = me.dom,
a1,
a2,
x,
y,
//constrain the aligned el to viewport if necessary
w,
h,
r,
dw = Ext.lib.Dom.getViewWidth() -10, // 10px of margin for ie
dh = Ext.lib.Dom.getViewHeight()-10, // 10px of margin for ie
p1y,
p1x,
p2y,
p2x,
swapY,
swapX,
doc = document,
docElement = doc.documentElement,
docBody = doc.body,
scrollX = (docElement.scrollLeft || docBody.scrollLeft || 0)+5,
scrollY = (docElement.scrollTop || docBody.scrollTop || 0)+5,
c = false, //constrain to viewport
p1 = "",
p2 = "",
m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
if(!m){
throw "Element.alignTo with an invalid alignment " + p;
}
p1 = m[1];
p2 = m[2];
c = !!m[3];
//Subtract the aligned el's internal xy from the target's offset xy
//plus custom offset to get the aligned el's new offset xy
a1 = me.getAnchorXY(p1, true);
a2 = el.getAnchorXY(p2, false);
x = a2[0] - a1[0] + o[0];
y = a2[1] - a1[1] + o[1];
if(c){
w = me.getWidth();
h = me.getHeight();
r = el.getRegion();
//If we are at a viewport boundary and the aligned el is anchored on a target border that is
//perpendicular to the vp border, allow the aligned el to slide on that border,
//otherwise swap the aligned el to the opposite border of the target.
p1y = p1.charAt(0);
p1x = p1.charAt(p1.length-1);
p2y = p2.charAt(0);
p2x = p2.charAt(p2.length-1);
swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));
if (x + w > dw + scrollX) {
x = swapX ? r.left-w : dw+scrollX-w;
}
if (x < scrollX) {
x = swapX ? r.right : scrollX;
}
if (y + h > dh + scrollY) {
y = swapY ? r.top-h : dh+scrollY-h;
}
if (y < scrollY){
y = swapY ? r.bottom : scrollY;
}
}
return [x,y];
},
/**
* Aligns this element with another element relative to the specified anchor points. If the other element is the
* document it aligns it to the viewport.
* The position parameter is optional, and can be specified in any one of the following formats:
* <ul>
* <li><b>Blank</b>: Defaults to aligning the element's top-left corner to the target's bottom-left corner ("tl-bl").</li>
* <li><b>One anchor (deprecated)</b>: The passed anchor position is used as the target element's anchor point.
* The element being aligned will position its top-left corner (tl) to that point. <i>This method has been
* deprecated in favor of the newer two anchor syntax below</i>.</li>
* <li><b>Two anchors</b>: If two values from the table below are passed separated by a dash, the first value is used as the
* element's anchor point, and the second value is used as the target's anchor point.</li>
* </ul>
* In addition to the anchor points, the position parameter also supports the "?" character. If "?" is passed at the end of
* the position string, the element will attempt to align as specified, but the position will be adjusted to constrain to
* the viewport if necessary. Note that the element being aligned might be swapped to align to a different position than
* that specified in order to enforce the viewport constraints.
* Following are all of the supported anchor positions:
<pre>
Value Description
----- -----------------------------
tl The top left corner (default)
t The center of the top edge
tr The top right corner
l The center of the left edge
c In the center of the element
r The center of the right edge
bl The bottom left corner
b The center of the bottom edge
br The bottom right corner
</pre>
Example Usage:
<pre><code>
// align el to other-el using the default positioning ("tl-bl", non-constrained)
el.alignTo("other-el");
// align the top left corner of el with the top right corner of other-el (constrained to viewport)
el.alignTo("other-el", "tr?");
// align the bottom right corner of el with the center left edge of other-el
el.alignTo("other-el", "br-l?");
// align the center of el with the bottom left corner of other-el and
// adjust the x position by -6 pixels (and the y position by 0)
el.alignTo("other-el", "c-bl", [-6, 0]);
</code></pre>
* @param {Mixed} element The element to align to.
* @param {String} position (optional, defaults to "tl-bl?") The position to align to.
* @param {Array} offsets (optional) Offset the positioning by [x, y]
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
alignTo : function(element, position, offsets, animate){
var me = this;
return me.setXY(me.getAlignToXY(element, position, offsets),
me.preanim && !!animate ? me.preanim(arguments, 3) : false);
},
// private ==> used outside of core
adjustForConstraints : function(xy, parent, offsets){
return this.getConstrainToXY(parent || document, false, offsets, xy) || xy;
},
// private ==> used outside of core
getConstrainToXY : function(el, local, offsets, proposedXY){
var os = {top:0, left:0, bottom:0, right: 0};
return function(el, local, offsets, proposedXY){
el = Ext.get(el);
offsets = offsets ? Ext.applyIf(offsets, os) : os;
var vw, vh, vx = 0, vy = 0;
if(el.dom == document.body || el.dom == document){
vw =Ext.lib.Dom.getViewWidth();
vh = Ext.lib.Dom.getViewHeight();
}else{
vw = el.dom.clientWidth;
vh = el.dom.clientHeight;
if(!local){
var vxy = el.getXY();
vx = vxy[0];
vy = vxy[1];
}
}
var s = el.getScroll();
vx += offsets.left + s.left;
vy += offsets.top + s.top;
vw -= offsets.right;
vh -= offsets.bottom;
var vr = vx + vw,
vb = vy + vh,
xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]),
x = xy[0], y = xy[1],
offset = this.getConstrainOffset(),
w = this.dom.offsetWidth + offset,
h = this.dom.offsetHeight + offset;
// only move it if it needs it
var moved = false;
// first validate right/bottom
if((x + w) > vr){
x = vr - w;
moved = true;
}
if((y + h) > vb){
y = vb - h;
moved = true;
}
// then make sure top/left isn't negative
if(x < vx){
x = vx;
moved = true;
}
if(y < vy){
y = vy;
moved = true;
}
return moved ? [x, y] : false;
};
}(),
// el = Ext.get(el);
// offsets = Ext.applyIf(offsets || {}, {top : 0, left : 0, bottom : 0, right : 0});
// var me = this,
// doc = document,
// s = el.getScroll(),
// vxy = el.getXY(),
// vx = offsets.left + s.left,
// vy = offsets.top + s.top,
// vw = -offsets.right,
// vh = -offsets.bottom,
// vr,
// vb,
// xy = proposedXY || (!local ? me.getXY() : [me.getLeft(true), me.getTop(true)]),
// x = xy[0],
// y = xy[1],
// w = me.dom.offsetWidth, h = me.dom.offsetHeight,
// moved = false; // only move it if it needs it
//
//
// if(el.dom == doc.body || el.dom == doc){
// vw += Ext.lib.Dom.getViewWidth();
// vh += Ext.lib.Dom.getViewHeight();
// }else{
// vw += el.dom.clientWidth;
// vh += el.dom.clientHeight;
// if(!local){
// vx += vxy[0];
// vy += vxy[1];
// }
// }
// // first validate right/bottom
// if(x + w > vx + vw){
// x = vx + vw - w;
// moved = true;
// }
// if(y + h > vy + vh){
// y = vy + vh - h;
// moved = true;
// }
// // then make sure top/left isn't negative
// if(x < vx){
// x = vx;
// moved = true;
// }
// if(y < vy){
// y = vy;
// moved = true;
// }
// return moved ? [x, y] : false;
// },
// private, used internally
getConstrainOffset : function(){
return 0;
},
/**
* Calculates the x, y to center this element on the screen
* @return {Array} The x, y values [x, y]
*/
getCenterXY : function(){
return this.getAlignToXY(document, 'c-c');
},
/**
* Centers the Element in either the viewport, or another Element.
* @param {Mixed} centerIn (optional) The element in which to center the element.
*/
center : function(centerIn){
return this.alignTo(centerIn || document, 'c-c');
}
});

View File

@@ -1,46 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods({
/**
* Initializes a {@link Ext.dd.DD} drag drop object for this element.
* @param {String} group The group the DD object is member of
* @param {Object} config The DD config object
* @param {Object} overrides An object containing methods to override/implement on the DD object
* @return {Ext.dd.DD} The DD object
*/
initDD : function(group, config, overrides){
var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
/**
* Initializes a {@link Ext.dd.DDProxy} object for this element.
* @param {String} group The group the DDProxy object is member of
* @param {Object} config The DDProxy config object
* @param {Object} overrides An object containing methods to override/implement on the DDProxy object
* @return {Ext.dd.DDProxy} The DDProxy object
*/
initDDProxy : function(group, config, overrides){
var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
/**
* Initializes a {@link Ext.dd.DDTarget} object for this element.
* @param {String} group The group the DDTarget object is member of
* @param {Object} config The DDTarget config object
* @param {Object} overrides An object containing methods to override/implement on the DDTarget object
* @return {Ext.dd.DDTarget} The DDTarget object
*/
initDDTarget : function(group, config, overrides){
var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
}
});

View File

@@ -1,162 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods(
function() {
var VISIBILITY = "visibility",
DISPLAY = "display",
HIDDEN = "hidden",
NONE = "none",
XMASKED = "x-masked",
XMASKEDRELATIVE = "x-masked-relative",
data = Ext.Element.data;
return {
/**
* Checks whether the element is currently visible using both visibility and display properties.
* @param {Boolean} deep (optional) True to walk the dom and see if parent elements are hidden (defaults to false)
* @return {Boolean} True if the element is currently visible, else false
*/
isVisible : function(deep) {
var vis = !this.isStyle(VISIBILITY, HIDDEN) && !this.isStyle(DISPLAY, NONE),
p = this.dom.parentNode;
if (deep !== true || !vis) {
return vis;
}
while (p && !(/^body/i.test(p.tagName))) {
if (!Ext.fly(p, '_isVisible').isVisible()) {
return false;
}
p = p.parentNode;
}
return true;
},
/**
* Returns true if display is not "none"
* @return {Boolean}
*/
isDisplayed : function() {
return !this.isStyle(DISPLAY, NONE);
},
/**
* Convenience method for setVisibilityMode(Element.DISPLAY)
* @param {String} display (optional) What to set display to when visible
* @return {Ext.Element} this
*/
enableDisplayMode : function(display) {
this.setVisibilityMode(Ext.Element.DISPLAY);
if (!Ext.isEmpty(display)) {
data(this.dom, 'originalDisplay', display);
}
return this;
},
/**
* Puts a mask over this element to disable user interaction. Requires core.css.
* This method can only be applied to elements which accept child nodes.
* @param {String} msg (optional) A message to display in the mask
* @param {String} msgCls (optional) A css class to apply to the msg element
* @return {Element} The mask element
*/
mask : function(msg, msgCls) {
var me = this,
dom = me.dom,
dh = Ext.DomHelper,
EXTELMASKMSG = "ext-el-mask-msg",
el,
mask;
if (!(/^body/i.test(dom.tagName) && me.getStyle('position') == 'static')) {
me.addClass(XMASKEDRELATIVE);
}
if (el = data(dom, 'maskMsg')) {
el.remove();
}
if (el = data(dom, 'mask')) {
el.remove();
}
mask = dh.append(dom, {cls : "ext-el-mask"}, true);
data(dom, 'mask', mask);
me.addClass(XMASKED);
mask.setDisplayed(true);
if (typeof msg == 'string') {
var mm = dh.append(dom, {cls : EXTELMASKMSG, cn:{tag:'div'}}, true);
data(dom, 'maskMsg', mm);
mm.dom.className = msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG;
mm.dom.firstChild.innerHTML = msg;
mm.setDisplayed(true);
mm.center(me);
}
// ie will not expand full height automatically
if (Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && me.getStyle('height') == 'auto') {
mask.setSize(undefined, me.getHeight());
}
return mask;
},
/**
* Removes a previously applied mask.
*/
unmask : function() {
var me = this,
dom = me.dom,
mask = data(dom, 'mask'),
maskMsg = data(dom, 'maskMsg');
if (mask) {
if (maskMsg) {
maskMsg.remove();
data(dom, 'maskMsg', undefined);
}
mask.remove();
data(dom, 'mask', undefined);
me.removeClass([XMASKED, XMASKEDRELATIVE]);
}
},
/**
* Returns true if this element is masked
* @return {Boolean}
*/
isMasked : function() {
var m = data(this.dom, 'mask');
return m && m.isVisible();
},
/**
* Creates an iframe shim for this element to keep selects and other windowed objects from
* showing through.
* @return {Ext.Element} The new shim element
*/
createShim : function() {
var el = document.createElement('iframe'),
shim;
el.frameBorder = '0';
el.className = 'ext-shim';
el.src = Ext.SSL_SECURE_URL;
shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
shim.autoBoxAdjust = false;
return shim;
}
};
}()
);

View File

@@ -1,57 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.apply(Ext.Element.prototype, function() {
var GETDOM = Ext.getDom,
GET = Ext.get,
DH = Ext.DomHelper;
return {
/**
* Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
* @param {Mixed/Object/Array} el The id, element to insert or a DomHelper config to create and insert *or* an array of any of those.
* @param {String} where (optional) 'before' or 'after' defaults to before
* @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element
* @return {Ext.Element} The inserted Element. If an array is passed, the last inserted element is returned.
*/
insertSibling: function(el, where, returnDom){
var me = this,
rt,
isAfter = (where || 'before').toLowerCase() == 'after',
insertEl;
if(Ext.isArray(el)){
insertEl = me;
Ext.each(el, function(e) {
rt = Ext.fly(insertEl, '_internal').insertSibling(e, where, returnDom);
if(isAfter){
insertEl = rt;
}
});
return rt;
}
el = el || {};
if(el.nodeType || el.dom){
rt = me.dom.parentNode.insertBefore(GETDOM(el), isAfter ? me.dom.nextSibling : me.dom);
if (!returnDom) {
rt = GET(rt);
}
}else{
if (isAfter && !me.dom.nextSibling) {
rt = DH.append(me.dom.parentNode, el, !returnDom);
} else {
rt = DH[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
}
}
return rt;
}
};
}());

View File

@@ -1,52 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods({
/**
* Convenience method for constructing a KeyMap
* @param {Number/Array/Object/String} key Either a string with the keys to listen for, the numeric key code, array of key codes or an object with the following options:
* <code>{key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}</code>
* @param {Function} fn The function to call
* @param {Object} scope (optional) The scope (<code>this</code> reference) in which the specified function is executed. Defaults to this Element.
* @return {Ext.KeyMap} The KeyMap created
*/
addKeyListener : function(key, fn, scope){
var config;
if(typeof key != 'object' || Ext.isArray(key)){
config = {
key: key,
fn: fn,
scope: scope
};
}else{
config = {
key : key.key,
shift : key.shift,
ctrl : key.ctrl,
alt : key.alt,
fn: fn,
scope: scope
};
}
return new Ext.KeyMap(this, config);
},
/**
* Creates a KeyMap for this element
* @param {Object} config The KeyMap config. See {@link Ext.KeyMap} for more details
* @return {Ext.KeyMap} The KeyMap created
*/
addKeyMap : function(config){
return new Ext.KeyMap(this, config);
}
});
//Import the newly-added Ext.Element functions into CompositeElementLite. We call this here because
//Element.keys.js is the last extra Ext.Element include in the ext-all.js build
Ext.CompositeElementLite.importElementMethods();

View File

@@ -1,176 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods({
/**
* Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently.
* @param {Object} box The box to fill {x, y, width, height}
* @param {Boolean} adjust (optional) Whether to adjust for box-model issues automatically
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
setBox : function(box, adjust, animate){
var me = this,
w = box.width,
h = box.height;
if((adjust && !me.autoBoxAdjust) && !me.isBorderBox()){
w -= (me.getBorderWidth("lr") + me.getPadding("lr"));
h -= (me.getBorderWidth("tb") + me.getPadding("tb"));
}
me.setBounds(box.x, box.y, w, h, me.animTest.call(me, arguments, animate, 2));
return me;
},
/**
* Return an object defining the area of this Element which can be passed to {@link #setBox} to
* set another Element's size/location to match this element.
* @param {Boolean} contentBox (optional) If true a box for the content of the element is returned.
* @param {Boolean} local (optional) If true the element's left and top are returned instead of page x/y.
* @return {Object} box An object in the format<pre><code>
{
x: &lt;Element's X position>,
y: &lt;Element's Y position>,
width: &lt;Element's width>,
height: &lt;Element's height>,
bottom: &lt;Element's lower bound>,
right: &lt;Element's rightmost bound>
}
</code></pre>
* The returned object may also be addressed as an Array where index 0 contains the X position
* and index 1 contains the Y position. So the result may also be used for {@link #setXY}
*/
getBox : function(contentBox, local) {
var me = this,
xy,
left,
top,
getBorderWidth = me.getBorderWidth,
getPadding = me.getPadding,
l,
r,
t,
b;
if(!local){
xy = me.getXY();
}else{
left = parseInt(me.getStyle("left"), 10) || 0;
top = parseInt(me.getStyle("top"), 10) || 0;
xy = [left, top];
}
var el = me.dom, w = el.offsetWidth, h = el.offsetHeight, bx;
if(!contentBox){
bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};
}else{
l = getBorderWidth.call(me, "l") + getPadding.call(me, "l");
r = getBorderWidth.call(me, "r") + getPadding.call(me, "r");
t = getBorderWidth.call(me, "t") + getPadding.call(me, "t");
b = getBorderWidth.call(me, "b") + getPadding.call(me, "b");
bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)};
}
bx.right = bx.x + bx.width;
bx.bottom = bx.y + bx.height;
return bx;
},
/**
* Move this element relative to its current position.
* @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
* @param {Number} distance How far to move the element in pixels
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
move : function(direction, distance, animate){
var me = this,
xy = me.getXY(),
x = xy[0],
y = xy[1],
left = [x - distance, y],
right = [x + distance, y],
top = [x, y - distance],
bottom = [x, y + distance],
hash = {
l : left,
left : left,
r : right,
right : right,
t : top,
top : top,
up : top,
b : bottom,
bottom : bottom,
down : bottom
};
direction = direction.toLowerCase();
me.moveTo(hash[direction][0], hash[direction][1], me.animTest.call(me, arguments, animate, 2));
},
/**
* Quick set left and top adding default units
* @param {String} left The left CSS property value
* @param {String} top The top CSS property value
* @return {Ext.Element} this
*/
setLeftTop : function(left, top){
var me = this,
style = me.dom.style;
style.left = me.addUnits(left);
style.top = me.addUnits(top);
return me;
},
/**
* Returns the region of the given element.
* The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
* @return {Region} A Ext.lib.Region containing "top, left, bottom, right" member data.
*/
getRegion : function(){
return Ext.lib.Dom.getRegion(this.dom);
},
/**
* Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.
* @param {Number} x X value for new position (coordinates are page-based)
* @param {Number} y Y value for new position (coordinates are page-based)
* @param {Mixed} width The new width. This may be one of:<div class="mdetail-params"><ul>
* <li>A Number specifying the new width in this Element's {@link #defaultUnit}s (by default, pixels)</li>
* <li>A String used to set the CSS width style. Animation may <b>not</b> be used.
* </ul></div>
* @param {Mixed} height The new height. This may be one of:<div class="mdetail-params"><ul>
* <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels)</li>
* <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>
* </ul></div>
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
setBounds : function(x, y, width, height, animate){
var me = this;
if (!animate || !me.anim) {
me.setSize(width, height);
me.setLocation(x, y);
} else {
me.anim({points: {to: [x, y]},
width: {to: me.adjustWidth(width)},
height: {to: me.adjustHeight(height)}},
me.preanim(arguments, 4),
'motion');
}
return me;
},
/**
* Sets the element's position and size the specified region. If animation is true then width, height, x and y will be animated concurrently.
* @param {Ext.lib.Region} region The region to fill
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
setRegion : function(region, animate) {
return this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.animTest.call(this, arguments, animate, 1));
}
});

View File

@@ -1,118 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods({
/**
* Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
* @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.
* @param {Number} value The new scroll value
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Element} this
*/
scrollTo : function(side, value, animate) {
//check if we're scrolling top or left
var top = /top/i.test(side),
me = this,
dom = me.dom,
prop;
if (!animate || !me.anim) {
// just setting the value, so grab the direction
prop = 'scroll' + (top ? 'Top' : 'Left');
dom[prop] = value;
}
else {
// if scrolling top, we need to grab scrollLeft, if left, scrollTop
prop = 'scroll' + (top ? 'Left' : 'Top');
me.anim({scroll: {to: top ? [dom[prop], value] : [value, dom[prop]]}}, me.preanim(arguments, 2), 'scroll');
}
return me;
},
/**
* Scrolls this element into view within the passed container.
* @param {Mixed} container (optional) The container element to scroll (defaults to document.body). Should be a
* string (id), dom node, or Ext.Element.
* @param {Boolean} hscroll (optional) False to disable horizontal scroll (defaults to true)
* @return {Ext.Element} this
*/
scrollIntoView : function(container, hscroll) {
var c = Ext.getDom(container) || Ext.getBody().dom,
el = this.dom,
o = this.getOffsetsTo(c),
l = o[0] + c.scrollLeft,
t = o[1] + c.scrollTop,
b = t + el.offsetHeight,
r = l + el.offsetWidth,
ch = c.clientHeight,
ct = parseInt(c.scrollTop, 10),
cl = parseInt(c.scrollLeft, 10),
cb = ct + ch,
cr = cl + c.clientWidth;
if (el.offsetHeight > ch || t < ct) {
c.scrollTop = t;
}
else if (b > cb) {
c.scrollTop = b-ch;
}
// corrects IE, other browsers will ignore
c.scrollTop = c.scrollTop;
if (hscroll !== false) {
if (el.offsetWidth > c.clientWidth || l < cl) {
c.scrollLeft = l;
}
else if (r > cr) {
c.scrollLeft = r - c.clientWidth;
}
c.scrollLeft = c.scrollLeft;
}
return this;
},
// private
scrollChildIntoView : function(child, hscroll) {
Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
},
/**
* Scrolls this element the specified direction. Does bounds checking to make sure the scroll is
* within this element's scrollable range.
* @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
* @param {Number} distance How far to scroll the element in pixels
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Boolean} Returns true if a scroll was triggered or false if the element
* was scrolled as far as it could go.
*/
scroll : function(direction, distance, animate) {
if (!this.isScrollable()) {
return false;
}
var el = this.dom,
l = el.scrollLeft, t = el.scrollTop,
w = el.scrollWidth, h = el.scrollHeight,
cw = el.clientWidth, ch = el.clientHeight,
scrolled = false, v,
hash = {
l: Math.min(l + distance, w-cw),
r: v = Math.max(l - distance, 0),
t: Math.max(t - distance, 0),
b: Math.min(t + distance, h-ch)
};
hash.d = hash.b;
hash.u = hash.t;
direction = direction.substr(0, 1);
if ((v = hash[direction]) > -1) {
scrolled = true;
this.scrollTo(direction == 'l' || direction == 'r' ? 'left' : 'top', v, this.preanim(arguments, 2));
}
return scrolled;
}
});

View File

@@ -1,360 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
// special markup used throughout Ext when box wrapping elements
Ext.Element.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
Ext.Element.addMethods(function(){
var INTERNAL = "_internal",
pxMatch = /(\d+\.?\d+)px/;
return {
/**
* More flexible version of {@link #setStyle} for setting style properties.
* @param {String/Object/Function} styles A style specification string, e.g. "width:100px", or object in the form {width:"100px"}, or
* a function which returns such a specification.
* @return {Ext.Element} this
*/
applyStyles : function(style){
Ext.DomHelper.applyStyles(this.dom, style);
return this;
},
/**
* Returns an object with properties matching the styles requested.
* For example, el.getStyles('color', 'font-size', 'width') might return
* {'color': '#FFFFFF', 'font-size': '13px', 'width': '100px'}.
* @param {String} style1 A style name
* @param {String} style2 A style name
* @param {String} etc.
* @return {Object} The style object
*/
getStyles : function(){
var ret = {};
Ext.each(arguments, function(v) {
ret[v] = this.getStyle(v);
},
this);
return ret;
},
// private ==> used by ext full
setOverflow : function(v){
var dom = this.dom;
if(v=='auto' && Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
dom.style.overflow = 'hidden';
(function(){dom.style.overflow = 'auto';}).defer(1);
}else{
dom.style.overflow = v;
}
},
/**
* <p>Wraps the specified element with a special 9 element markup/CSS block that renders by default as
* a gray container with a gradient background, rounded corners and a 4-way shadow.</p>
* <p>This special markup is used throughout Ext when box wrapping elements ({@link Ext.Button},
* {@link Ext.Panel} when <tt>{@link Ext.Panel#frame frame=true}</tt>, {@link Ext.Window}). The markup
* is of this form:</p>
* <pre><code>
Ext.Element.boxMarkup =
&#39;&lt;div class="{0}-tl">&lt;div class="{0}-tr">&lt;div class="{0}-tc">&lt;/div>&lt;/div>&lt;/div>
&lt;div class="{0}-ml">&lt;div class="{0}-mr">&lt;div class="{0}-mc">&lt;/div>&lt;/div>&lt;/div>
&lt;div class="{0}-bl">&lt;div class="{0}-br">&lt;div class="{0}-bc">&lt;/div>&lt;/div>&lt;/div>&#39;;
* </code></pre>
* <p>Example usage:</p>
* <pre><code>
// Basic box wrap
Ext.get("foo").boxWrap();
// You can also add a custom class and use CSS inheritance rules to customize the box look.
// 'x-box-blue' is a built-in alternative -- look at the related CSS definitions as an example
// for how to create a custom box wrap style.
Ext.get("foo").boxWrap().addClass("x-box-blue");
* </code></pre>
* @param {String} class (optional) A base CSS class to apply to the containing wrapper element
* (defaults to <tt>'x-box'</tt>). Note that there are a number of CSS rules that are dependent on
* this name to make the overall effect work, so if you supply an alternate base class, make sure you
* also supply all of the necessary rules.
* @return {Ext.Element} The outermost wrapping element of the created box structure.
*/
boxWrap : function(cls){
cls = cls || 'x-box';
var el = Ext.get(this.insertHtml("beforeBegin", "<div class='" + cls + "'>" + String.format(Ext.Element.boxMarkup, cls) + "</div>")); //String.format('<div class="{0}">'+Ext.Element.boxMarkup+'</div>', cls)));
Ext.DomQuery.selectNode('.' + cls + '-mc', el.dom).appendChild(this.dom);
return el;
},
/**
* Set the size of this Element. If animation is true, both width and height will be animated concurrently.
* @param {Mixed} width The new width. This may be one of:<div class="mdetail-params"><ul>
* <li>A Number specifying the new width in this Element's {@link #defaultUnit}s (by default, pixels).</li>
* <li>A String used to set the CSS width style. Animation may <b>not</b> be used.
* <li>A size object in the format <code>{width: widthValue, height: heightValue}</code>.</li>
* </ul></div>
* @param {Mixed} height The new height. This may be one of:<div class="mdetail-params"><ul>
* <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels).</li>
* <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>
* </ul></div>
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
setSize : function(width, height, animate){
var me = this;
if(typeof width == 'object'){ // in case of object from getSize()
height = width.height;
width = width.width;
}
width = me.adjustWidth(width);
height = me.adjustHeight(height);
if(!animate || !me.anim){
me.dom.style.width = me.addUnits(width);
me.dom.style.height = me.addUnits(height);
}else{
me.anim({width: {to: width}, height: {to: height}}, me.preanim(arguments, 2));
}
return me;
},
/**
* Returns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders
* when needed to simulate offsetHeight when offsets aren't available. This may not work on display:none elements
* if a height has not been set using CSS.
* @return {Number}
*/
getComputedHeight : function(){
var me = this,
h = Math.max(me.dom.offsetHeight, me.dom.clientHeight);
if(!h){
h = parseFloat(me.getStyle('height')) || 0;
if(!me.isBorderBox()){
h += me.getFrameWidth('tb');
}
}
return h;
},
/**
* Returns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders
* when needed to simulate offsetWidth when offsets aren't available. This may not work on display:none elements
* if a width has not been set using CSS.
* @return {Number}
*/
getComputedWidth : function(){
var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
if(!w){
w = parseFloat(this.getStyle('width')) || 0;
if(!this.isBorderBox()){
w += this.getFrameWidth('lr');
}
}
return w;
},
/**
* Returns the sum width of the padding and borders for the passed "sides". See getBorderWidth()
for more information about the sides.
* @param {String} sides
* @return {Number}
*/
getFrameWidth : function(sides, onlyContentBox){
return onlyContentBox && this.isBorderBox() ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
},
/**
* Sets up event handlers to add and remove a css class when the mouse is over this element
* @param {String} className
* @return {Ext.Element} this
*/
addClassOnOver : function(className){
this.hover(
function(){
Ext.fly(this, INTERNAL).addClass(className);
},
function(){
Ext.fly(this, INTERNAL).removeClass(className);
}
);
return this;
},
/**
* Sets up event handlers to add and remove a css class when this element has the focus
* @param {String} className
* @return {Ext.Element} this
*/
addClassOnFocus : function(className){
this.on("focus", function(){
Ext.fly(this, INTERNAL).addClass(className);
}, this.dom);
this.on("blur", function(){
Ext.fly(this, INTERNAL).removeClass(className);
}, this.dom);
return this;
},
/**
* Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effect)
* @param {String} className
* @return {Ext.Element} this
*/
addClassOnClick : function(className){
var dom = this.dom;
this.on("mousedown", function(){
Ext.fly(dom, INTERNAL).addClass(className);
var d = Ext.getDoc(),
fn = function(){
Ext.fly(dom, INTERNAL).removeClass(className);
d.removeListener("mouseup", fn);
};
d.on("mouseup", fn);
});
return this;
},
/**
* <p>Returns the dimensions of the element available to lay content out in.<p>
* <p>If the element (or any ancestor element) has CSS style <code>display : none</code>, the dimensions will be zero.</p>
* example:<pre><code>
var vpSize = Ext.getBody().getViewSize();
// all Windows created afterwards will have a default value of 90% height and 95% width
Ext.Window.override({
width: vpSize.width * 0.9,
height: vpSize.height * 0.95
});
// To handle window resizing you would have to hook onto onWindowResize.
* </code></pre>
*
* getViewSize utilizes clientHeight/clientWidth which excludes sizing of scrollbars.
* To obtain the size including scrollbars, use getStyleSize
*
* Sizing of the document body is handled at the adapter level which handles special cases for IE and strict modes, etc.
*/
getViewSize : function(){
var doc = document,
d = this.dom,
isDoc = (d == doc || d == doc.body);
// If the body, use Ext.lib.Dom
if (isDoc) {
var extdom = Ext.lib.Dom;
return {
width : extdom.getViewWidth(),
height : extdom.getViewHeight()
};
// Else use clientHeight/clientWidth
} else {
return {
width : d.clientWidth,
height : d.clientHeight
};
}
},
/**
* <p>Returns the dimensions of the element available to lay content out in.<p>
*
* getStyleSize utilizes prefers style sizing if present, otherwise it chooses the larger of offsetHeight/clientHeight and offsetWidth/clientWidth.
* To obtain the size excluding scrollbars, use getViewSize
*
* Sizing of the document body is handled at the adapter level which handles special cases for IE and strict modes, etc.
*/
getStyleSize : function(){
var me = this,
w, h,
doc = document,
d = this.dom,
isDoc = (d == doc || d == doc.body),
s = d.style;
// If the body, use Ext.lib.Dom
if (isDoc) {
var extdom = Ext.lib.Dom;
return {
width : extdom.getViewWidth(),
height : extdom.getViewHeight()
};
}
// Use Styles if they are set
if(s.width && s.width != 'auto'){
w = parseFloat(s.width);
if(me.isBorderBox()){
w -= me.getFrameWidth('lr');
}
}
// Use Styles if they are set
if(s.height && s.height != 'auto'){
h = parseFloat(s.height);
if(me.isBorderBox()){
h -= me.getFrameWidth('tb');
}
}
// Use getWidth/getHeight if style not set.
return {width: w || me.getWidth(true), height: h || me.getHeight(true)};
},
/**
* Returns the size of the element.
* @param {Boolean} contentSize (optional) true to get the width/size minus borders and padding
* @return {Object} An object containing the element's size {width: (element width), height: (element height)}
*/
getSize : function(contentSize){
return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
},
/**
* Forces the browser to repaint this element
* @return {Ext.Element} this
*/
repaint : function(){
var dom = this.dom;
this.addClass("x-repaint");
setTimeout(function(){
Ext.fly(dom).removeClass("x-repaint");
}, 1);
return this;
},
/**
* Disables text selection for this element (normalized across browsers)
* @return {Ext.Element} this
*/
unselectable : function(){
this.dom.unselectable = "on";
return this.swallowEvent("selectstart", true).
applyStyles("-moz-user-select:none;-khtml-user-select:none;").
addClass("x-unselectable");
},
/**
* Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed,
* then it returns the calculated width of the sides (see getPadding)
* @param {String} sides (optional) Any combination of l, r, t, b to get the sum of those sides
* @return {Object/Number}
*/
getMargins : function(side){
var me = this,
key,
hash = {t:"top", l:"left", r:"right", b: "bottom"},
o = {};
if (!side) {
for (key in me.margins){
o[hash[key]] = parseFloat(me.getStyle(me.margins[key])) || 0;
}
return o;
} else {
return me.addStyles.call(me, side, me.margins);
}
}
};
}());

View File

@@ -1,20 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods({
/**
* Creates a {@link Ext.CompositeElement} for child nodes based on the passed CSS selector (the selector should not contain an id).
* @param {String} selector The CSS selector
* @param {Boolean} unique (optional) True to create a unique Ext.Element for each child (defaults to false, which creates a single shared flyweight object)
* @return {CompositeElement/CompositeElementLite} The composite element
*/
select : function(selector, unique){
return Ext.Element.select(selector, unique, this.dom);
}
});

View File

@@ -1,81 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* Framework-wide error-handler. Developers can override this method to provide
* custom exception-handling. Framework errors will often extend from the base
* Ext.Error class.
* @param {Object/Error} e The thrown exception object.
*/
Ext.handleError = function(e) {
throw e;
};
/**
* @class Ext.Error
* @extends Error
* <p>A base error class. Future implementations are intended to provide more
* robust error handling throughout the framework (<b>in the debug build only</b>)
* to check for common errors and problems. The messages issued by this class
* will aid error checking. Error checks will be automatically removed in the
* production build so that performance is not negatively impacted.</p>
* <p>Some sample messages currently implemented:</p><pre>
"DataProxy attempted to execute an API-action but found an undefined
url / function. Please review your Proxy url/api-configuration."
* </pre><pre>
"Could not locate your "root" property in your server response.
Please review your JsonReader config to ensure the config-property
"root" matches the property your server-response. See the JsonReader
docs for additional assistance."
* </pre>
* <p>An example of the code used for generating error messages:</p><pre><code>
try {
generateError({
foo: 'bar'
});
}
catch (e) {
console.error(e);
}
function generateError(data) {
throw new Ext.Error('foo-error', data);
}
* </code></pre>
* @param {String} message
*/
Ext.Error = function(message) {
// Try to read the message from Ext.Error.lang
this.message = (this.lang[message]) ? this.lang[message] : message;
};
Ext.Error.prototype = new Error();
Ext.apply(Ext.Error.prototype, {
// protected. Extensions place their error-strings here.
lang: {},
name: 'Ext.Error',
/**
* getName
* @return {String}
*/
getName : function() {
return this.name;
},
/**
* getMessage
* @return {String}
*/
getMessage : function() {
return this.message;
},
/**
* toJson
* @return {String}
*/
toJson : function() {
return Ext.encode(this);
}
});

View File

@@ -1,335 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.EventManager
*/
Ext.apply(Ext.EventManager, function(){
var resizeEvent,
resizeTask,
textEvent,
textSize,
D = Ext.lib.Dom,
propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,
curWidth = 0,
curHeight = 0,
// note 1: IE fires ONLY the keydown event on specialkey autorepeat
// note 2: Safari < 3.1, Gecko (Mac/Linux) & Opera fire only the keypress event on specialkey autorepeat
// (research done by @Jan Wolter at http://unixpapa.com/js/key.html)
useKeydown = Ext.isWebKit ?
Ext.num(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1]) >= 525 :
!((Ext.isGecko && !Ext.isWindows) || Ext.isOpera);
return {
// private
doResizeEvent: function(){
var h = D.getViewHeight(),
w = D.getViewWidth();
//whacky problem in IE where the resize event will fire even though the w/h are the same.
if(curHeight != h || curWidth != w){
resizeEvent.fire(curWidth = w, curHeight = h);
}
},
/**
* Adds a listener to be notified when the browser window is resized and provides resize event buffering (100 milliseconds),
* passes new viewport width and height to handlers.
* @param {Function} fn The handler function the window resize event invokes.
* @param {Object} scope The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.
* @param {boolean} options Options object as passed to {@link Ext.Element#addListener}
*/
onWindowResize : function(fn, scope, options){
if(!resizeEvent){
resizeEvent = new Ext.util.Event();
resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);
Ext.EventManager.on(window, "resize", this.fireWindowResize, this);
}
resizeEvent.addListener(fn, scope, options);
},
// exposed only to allow manual firing
fireWindowResize : function(){
if(resizeEvent){
resizeTask.delay(100);
}
},
/**
* Adds a listener to be notified when the user changes the active text size. Handler gets called with 2 params, the old size and the new size.
* @param {Function} fn The function the event invokes.
* @param {Object} scope The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.
* @param {boolean} options Options object as passed to {@link Ext.Element#addListener}
*/
onTextResize : function(fn, scope, options){
if(!textEvent){
textEvent = new Ext.util.Event();
var textEl = new Ext.Element(document.createElement('div'));
textEl.dom.className = 'x-text-resize';
textEl.dom.innerHTML = 'X';
textEl.appendTo(document.body);
textSize = textEl.dom.offsetHeight;
setInterval(function(){
if(textEl.dom.offsetHeight != textSize){
textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
}
}, this.textResizeInterval);
}
textEvent.addListener(fn, scope, options);
},
/**
* Removes the passed window resize listener.
* @param {Function} fn The method the event invokes
* @param {Object} scope The scope of handler
*/
removeResizeListener : function(fn, scope){
if(resizeEvent){
resizeEvent.removeListener(fn, scope);
}
},
// private
fireResize : function(){
if(resizeEvent){
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
}
},
/**
* The frequency, in milliseconds, to check for text resize events (defaults to 50)
*/
textResizeInterval : 50,
/**
* Url used for onDocumentReady with using SSL (defaults to Ext.SSL_SECURE_URL)
*/
ieDeferSrc : false,
// protected, short accessor for useKeydown
getKeyEvent : function(){
return useKeydown ? 'keydown' : 'keypress';
},
// protected for use inside the framework
// detects whether we should use keydown or keypress based on the browser.
useKeydown: useKeydown
};
}());
Ext.EventManager.on = Ext.EventManager.addListener;
Ext.apply(Ext.EventObjectImpl.prototype, {
/** Key constant @type Number */
BACKSPACE: 8,
/** Key constant @type Number */
TAB: 9,
/** Key constant @type Number */
NUM_CENTER: 12,
/** Key constant @type Number */
ENTER: 13,
/** Key constant @type Number */
RETURN: 13,
/** Key constant @type Number */
SHIFT: 16,
/** Key constant @type Number */
CTRL: 17,
CONTROL : 17, // legacy
/** Key constant @type Number */
ALT: 18,
/** Key constant @type Number */
PAUSE: 19,
/** Key constant @type Number */
CAPS_LOCK: 20,
/** Key constant @type Number */
ESC: 27,
/** Key constant @type Number */
SPACE: 32,
/** Key constant @type Number */
PAGE_UP: 33,
PAGEUP : 33, // legacy
/** Key constant @type Number */
PAGE_DOWN: 34,
PAGEDOWN : 34, // legacy
/** Key constant @type Number */
END: 35,
/** Key constant @type Number */
HOME: 36,
/** Key constant @type Number */
LEFT: 37,
/** Key constant @type Number */
UP: 38,
/** Key constant @type Number */
RIGHT: 39,
/** Key constant @type Number */
DOWN: 40,
/** Key constant @type Number */
PRINT_SCREEN: 44,
/** Key constant @type Number */
INSERT: 45,
/** Key constant @type Number */
DELETE: 46,
/** Key constant @type Number */
ZERO: 48,
/** Key constant @type Number */
ONE: 49,
/** Key constant @type Number */
TWO: 50,
/** Key constant @type Number */
THREE: 51,
/** Key constant @type Number */
FOUR: 52,
/** Key constant @type Number */
FIVE: 53,
/** Key constant @type Number */
SIX: 54,
/** Key constant @type Number */
SEVEN: 55,
/** Key constant @type Number */
EIGHT: 56,
/** Key constant @type Number */
NINE: 57,
/** Key constant @type Number */
A: 65,
/** Key constant @type Number */
B: 66,
/** Key constant @type Number */
C: 67,
/** Key constant @type Number */
D: 68,
/** Key constant @type Number */
E: 69,
/** Key constant @type Number */
F: 70,
/** Key constant @type Number */
G: 71,
/** Key constant @type Number */
H: 72,
/** Key constant @type Number */
I: 73,
/** Key constant @type Number */
J: 74,
/** Key constant @type Number */
K: 75,
/** Key constant @type Number */
L: 76,
/** Key constant @type Number */
M: 77,
/** Key constant @type Number */
N: 78,
/** Key constant @type Number */
O: 79,
/** Key constant @type Number */
P: 80,
/** Key constant @type Number */
Q: 81,
/** Key constant @type Number */
R: 82,
/** Key constant @type Number */
S: 83,
/** Key constant @type Number */
T: 84,
/** Key constant @type Number */
U: 85,
/** Key constant @type Number */
V: 86,
/** Key constant @type Number */
W: 87,
/** Key constant @type Number */
X: 88,
/** Key constant @type Number */
Y: 89,
/** Key constant @type Number */
Z: 90,
/** Key constant @type Number */
CONTEXT_MENU: 93,
/** Key constant @type Number */
NUM_ZERO: 96,
/** Key constant @type Number */
NUM_ONE: 97,
/** Key constant @type Number */
NUM_TWO: 98,
/** Key constant @type Number */
NUM_THREE: 99,
/** Key constant @type Number */
NUM_FOUR: 100,
/** Key constant @type Number */
NUM_FIVE: 101,
/** Key constant @type Number */
NUM_SIX: 102,
/** Key constant @type Number */
NUM_SEVEN: 103,
/** Key constant @type Number */
NUM_EIGHT: 104,
/** Key constant @type Number */
NUM_NINE: 105,
/** Key constant @type Number */
NUM_MULTIPLY: 106,
/** Key constant @type Number */
NUM_PLUS: 107,
/** Key constant @type Number */
NUM_MINUS: 109,
/** Key constant @type Number */
NUM_PERIOD: 110,
/** Key constant @type Number */
NUM_DIVISION: 111,
/** Key constant @type Number */
F1: 112,
/** Key constant @type Number */
F2: 113,
/** Key constant @type Number */
F3: 114,
/** Key constant @type Number */
F4: 115,
/** Key constant @type Number */
F5: 116,
/** Key constant @type Number */
F6: 117,
/** Key constant @type Number */
F7: 118,
/** Key constant @type Number */
F8: 119,
/** Key constant @type Number */
F9: 120,
/** Key constant @type Number */
F10: 121,
/** Key constant @type Number */
F11: 122,
/** Key constant @type Number */
F12: 123,
/** @private */
isNavKeyPress : function(){
var me = this,
k = this.normalizeKey(me.keyCode);
return (k >= 33 && k <= 40) || // Page Up/Down, End, Home, Left, Up, Right, Down
k == me.RETURN ||
k == me.TAB ||
k == me.ESC;
},
isSpecialKey : function(){
var k = this.normalizeKey(this.keyCode);
return (this.type == 'keypress' && this.ctrlKey) ||
this.isNavKeyPress() ||
(k == this.BACKSPACE) || // Backspace
(k >= 16 && k <= 20) || // Shift, Ctrl, Alt, Pause, Caps Lock
(k >= 44 && k <= 46); // Print Screen, Insert, Delete
},
getPoint : function(){
return new Ext.lib.Point(this.xy[0], this.xy[1]);
},
/**
* Returns true if the control, meta, shift or alt key was pressed during this event.
* @return {Boolean}
*/
hasModifier : function(){
return ((this.ctrlKey || this.altKey) || this.shiftKey);
}
});

View File

@@ -1,688 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext
*/
Ext.ns("Ext.grid", "Ext.list", "Ext.dd", "Ext.tree", "Ext.form", "Ext.menu",
"Ext.state", "Ext.layout", "Ext.app", "Ext.ux", "Ext.chart", "Ext.direct");
/**
* Namespace alloted for extensions to the framework.
* @property ux
* @type Object
*/
Ext.apply(Ext, function(){
var E = Ext,
idSeed = 0,
scrollWidth = null;
return {
/**
* A reusable empty function
* @property
* @type Function
*/
emptyFn : function(){},
/**
* URL to a 1x1 transparent gif image used by Ext to create inline icons with CSS background images.
* In older versions of IE, this defaults to "http://extjs.com/s.gif" and you should change this to a URL on your server.
* For other browsers it uses an inline data URL.
* @type String
*/
BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 || Ext.isAir ?
'http:/' + '/www.extjs.com/s.gif' :
'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
extendX : function(supr, fn){
return Ext.extend(supr, fn(supr.prototype));
},
/**
* Returns the current HTML document object as an {@link Ext.Element}.
* @return Ext.Element The document
*/
getDoc : function(){
return Ext.get(document);
},
/**
* Utility method for validating that a value is numeric, returning the specified default value if it is not.
* @param {Mixed} value Should be a number, but any type will be handled appropriately
* @param {Number} defaultValue The value to return if the original value is non-numeric
* @return {Number} Value, if numeric, else defaultValue
*/
num : function(v, defaultValue){
v = Number(Ext.isEmpty(v) || Ext.isArray(v) || typeof v == 'boolean' || (typeof v == 'string' && v.trim().length == 0) ? NaN : v);
return isNaN(v) ? defaultValue : v;
},
/**
* <p>Utility method for returning a default value if the passed value is empty.</p>
* <p>The value is deemed to be empty if it is<div class="mdetail-params"><ul>
* <li>null</li>
* <li>undefined</li>
* <li>an empty array</li>
* <li>a zero length string (Unless the <tt>allowBlank</tt> parameter is <tt>true</tt>)</li>
* </ul></div>
* @param {Mixed} value The value to test
* @param {Mixed} defaultValue The value to return if the original value is empty
* @param {Boolean} allowBlank (optional) true to allow zero length strings to qualify as non-empty (defaults to false)
* @return {Mixed} value, if non-empty, else defaultValue
*/
value : function(v, defaultValue, allowBlank){
return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
},
/**
* Escapes the passed string for use in a regular expression
* @param {String} str
* @return {String}
*/
escapeRe : function(s) {
return s.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1");
},
sequence : function(o, name, fn, scope){
o[name] = o[name].createSequence(fn, scope);
},
/**
* Applies event listeners to elements by selectors when the document is ready.
* The event name is specified with an <tt>&#64;</tt> suffix.
* <pre><code>
Ext.addBehaviors({
// add a listener for click on all anchors in element with id foo
'#foo a&#64;click' : function(e, t){
// do something
},
// add the same listener to multiple selectors (separated by comma BEFORE the &#64;)
'#foo a, #bar span.some-class&#64;mouseover' : function(){
// do something
}
});
* </code></pre>
* @param {Object} obj The list of behaviors to apply
*/
addBehaviors : function(o){
if(!Ext.isReady){
Ext.onReady(function(){
Ext.addBehaviors(o);
});
} else {
var cache = {}, // simple cache for applying multiple behaviors to same selector does query multiple times
parts,
b,
s;
for (b in o) {
if ((parts = b.split('@'))[1]) { // for Object prototype breakers
s = parts[0];
if(!cache[s]){
cache[s] = Ext.select(s);
}
cache[s].on(parts[1], o[b]);
}
}
cache = null;
}
},
/**
* Utility method for getting the width of the browser scrollbar. This can differ depending on
* operating system settings, such as the theme or font size.
* @param {Boolean} force (optional) true to force a recalculation of the value.
* @return {Number} The width of the scrollbar.
*/
getScrollBarWidth: function(force){
if(!Ext.isReady){
return 0;
}
if(force === true || scrollWidth === null){
// Append our div, do our calculation and then remove it
var div = Ext.getBody().createChild('<div class="x-hide-offsets" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'),
child = div.child('div', true);
var w1 = child.offsetWidth;
div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll');
var w2 = child.offsetWidth;
div.remove();
// Need to add 2 to ensure we leave enough space
scrollWidth = w1 - w2 + 2;
}
return scrollWidth;
},
// deprecated
combine : function(){
var as = arguments, l = as.length, r = [];
for(var i = 0; i < l; i++){
var a = as[i];
if(Ext.isArray(a)){
r = r.concat(a);
}else if(a.length !== undefined && !a.substr){
r = r.concat(Array.prototype.slice.call(a, 0));
}else{
r.push(a);
}
}
return r;
},
/**
* Copies a set of named properties fom the source object to the destination object.
* <p>example:<pre><code>
ImageComponent = Ext.extend(Ext.BoxComponent, {
initComponent: function() {
this.autoEl = { tag: 'img' };
MyComponent.superclass.initComponent.apply(this, arguments);
this.initialBox = Ext.copyTo({}, this.initialConfig, 'x,y,width,height');
}
});
* </code></pre>
* @param {Object} dest The destination object.
* @param {Object} source The source object.
* @param {Array/String} names Either an Array of property names, or a comma-delimited list
* of property names to copy.
* @return {Object} The modified object.
*/
copyTo : function(dest, source, names){
if(typeof names == 'string'){
names = names.split(/[,;\s]/);
}
Ext.each(names, function(name){
if(source.hasOwnProperty(name)){
dest[name] = source[name];
}
}, this);
return dest;
},
/**
* Attempts to destroy any objects passed to it by removing all event listeners, removing them from the
* DOM (if applicable) and calling their destroy functions (if available). This method is primarily
* intended for arguments of type {@link Ext.Element} and {@link Ext.Component}, but any subclass of
* {@link Ext.util.Observable} can be passed in. Any number of elements and/or components can be
* passed into this function in a single call as separate arguments.
* @param {Mixed} arg1 An {@link Ext.Element}, {@link Ext.Component}, or an Array of either of these to destroy
* @param {Mixed} arg2 (optional)
* @param {Mixed} etc... (optional)
*/
destroy : function(){
Ext.each(arguments, function(arg){
if(arg){
if(Ext.isArray(arg)){
this.destroy.apply(this, arg);
}else if(typeof arg.destroy == 'function'){
arg.destroy();
}else if(arg.dom){
arg.remove();
}
}
}, this);
},
/**
* Attempts to destroy and then remove a set of named properties of the passed object.
* @param {Object} o The object (most likely a Component) who's properties you wish to destroy.
* @param {Mixed} arg1 The name of the property to destroy and remove from the object.
* @param {Mixed} etc... More property names to destroy and remove.
*/
destroyMembers : function(o, arg1, arg2, etc){
for(var i = 1, a = arguments, len = a.length; i < len; i++) {
Ext.destroy(o[a[i]]);
delete o[a[i]];
}
},
/**
* Creates a copy of the passed Array with falsy values removed.
* @param {Array/NodeList} arr The Array from which to remove falsy values.
* @return {Array} The new, compressed Array.
*/
clean : function(arr){
var ret = [];
Ext.each(arr, function(v){
if(!!v){
ret.push(v);
}
});
return ret;
},
/**
* Creates a copy of the passed Array, filtered to contain only unique values.
* @param {Array} arr The Array to filter
* @return {Array} The new Array containing unique values.
*/
unique : function(arr){
var ret = [],
collect = {};
Ext.each(arr, function(v) {
if(!collect[v]){
ret.push(v);
}
collect[v] = true;
});
return ret;
},
/**
* Recursively flattens into 1-d Array. Injects Arrays inline.
* @param {Array} arr The array to flatten
* @return {Array} The new, flattened array.
*/
flatten : function(arr){
var worker = [];
function rFlatten(a) {
Ext.each(a, function(v) {
if(Ext.isArray(v)){
rFlatten(v);
}else{
worker.push(v);
}
});
return worker;
}
return rFlatten(arr);
},
/**
* Returns the minimum value in the Array.
* @param {Array|NodeList} arr The Array from which to select the minimum value.
* @param {Function} comp (optional) a function to perform the comparision which determines minimization.
* If omitted the "<" operator will be used. Note: gt = 1; eq = 0; lt = -1
* @return {Object} The minimum value in the Array.
*/
min : function(arr, comp){
var ret = arr[0];
comp = comp || function(a,b){ return a < b ? -1 : 1; };
Ext.each(arr, function(v) {
ret = comp(ret, v) == -1 ? ret : v;
});
return ret;
},
/**
* Returns the maximum value in the Array
* @param {Array|NodeList} arr The Array from which to select the maximum value.
* @param {Function} comp (optional) a function to perform the comparision which determines maximization.
* If omitted the ">" operator will be used. Note: gt = 1; eq = 0; lt = -1
* @return {Object} The maximum value in the Array.
*/
max : function(arr, comp){
var ret = arr[0];
comp = comp || function(a,b){ return a > b ? 1 : -1; };
Ext.each(arr, function(v) {
ret = comp(ret, v) == 1 ? ret : v;
});
return ret;
},
/**
* Calculates the mean of the Array
* @param {Array} arr The Array to calculate the mean value of.
* @return {Number} The mean.
*/
mean : function(arr){
return arr.length > 0 ? Ext.sum(arr) / arr.length : undefined;
},
/**
* Calculates the sum of the Array
* @param {Array} arr The Array to calculate the sum value of.
* @return {Number} The sum.
*/
sum : function(arr){
var ret = 0;
Ext.each(arr, function(v) {
ret += v;
});
return ret;
},
/**
* Partitions the set into two sets: a true set and a false set.
* Example:
* Example2:
* <pre><code>
// Example 1:
Ext.partition([true, false, true, true, false]); // [[true, true, true], [false, false]]
// Example 2:
Ext.partition(
Ext.query("p"),
function(val){
return val.className == "class1"
}
);
// true are those paragraph elements with a className of "class1",
// false set are those that do not have that className.
* </code></pre>
* @param {Array|NodeList} arr The array to partition
* @param {Function} truth (optional) a function to determine truth. If this is omitted the element
* itself must be able to be evaluated for its truthfulness.
* @return {Array} [true<Array>,false<Array>]
*/
partition : function(arr, truth){
var ret = [[],[]];
Ext.each(arr, function(v, i, a) {
ret[ (truth && truth(v, i, a)) || (!truth && v) ? 0 : 1].push(v);
});
return ret;
},
/**
* Invokes a method on each item in an Array.
* <pre><code>
// Example:
Ext.invoke(Ext.query("p"), "getAttribute", "id");
// [el1.getAttribute("id"), el2.getAttribute("id"), ..., elN.getAttribute("id")]
* </code></pre>
* @param {Array|NodeList} arr The Array of items to invoke the method on.
* @param {String} methodName The method name to invoke.
* @param {...*} args Arguments to send into the method invocation.
* @return {Array} The results of invoking the method on each item in the array.
*/
invoke : function(arr, methodName){
var ret = [],
args = Array.prototype.slice.call(arguments, 2);
Ext.each(arr, function(v,i) {
if (v && typeof v[methodName] == 'function') {
ret.push(v[methodName].apply(v, args));
} else {
ret.push(undefined);
}
});
return ret;
},
/**
* Plucks the value of a property from each item in the Array
* <pre><code>
// Example:
Ext.pluck(Ext.query("p"), "className"); // [el1.className, el2.className, ..., elN.className]
* </code></pre>
* @param {Array|NodeList} arr The Array of items to pluck the value from.
* @param {String} prop The property name to pluck from each element.
* @return {Array} The value from each item in the Array.
*/
pluck : function(arr, prop){
var ret = [];
Ext.each(arr, function(v) {
ret.push( v[prop] );
});
return ret;
},
/**
* <p>Zips N sets together.</p>
* <pre><code>
// Example 1:
Ext.zip([1,2,3],[4,5,6]); // [[1,4],[2,5],[3,6]]
// Example 2:
Ext.zip(
[ "+", "-", "+"],
[ 12, 10, 22],
[ 43, 15, 96],
function(a, b, c){
return "$" + a + "" + b + "." + c
}
); // ["$+12.43", "$-10.15", "$+22.96"]
* </code></pre>
* @param {Arrays|NodeLists} arr This argument may be repeated. Array(s) to contribute values.
* @param {Function} zipper (optional) The last item in the argument list. This will drive how the items are zipped together.
* @return {Array} The zipped set.
*/
zip : function(){
var parts = Ext.partition(arguments, function( val ){ return typeof val != 'function'; }),
arrs = parts[0],
fn = parts[1][0],
len = Ext.max(Ext.pluck(arrs, "length")),
ret = [];
for (var i = 0; i < len; i++) {
ret[i] = [];
if(fn){
ret[i] = fn.apply(fn, Ext.pluck(arrs, i));
}else{
for (var j = 0, aLen = arrs.length; j < aLen; j++){
ret[i].push( arrs[j][i] );
}
}
}
return ret;
},
/**
* This is shorthand reference to {@link Ext.ComponentMgr#get}.
* Looks up an existing {@link Ext.Component Component} by {@link Ext.Component#id id}
* @param {String} id The component {@link Ext.Component#id id}
* @return Ext.Component The Component, <tt>undefined</tt> if not found, or <tt>null</tt> if a
* Class was found.
*/
getCmp : function(id){
return Ext.ComponentMgr.get(id);
},
/**
* By default, Ext intelligently decides whether floating elements should be shimmed. If you are using flash,
* you may want to set this to true.
* @type Boolean
*/
useShims: E.isIE6 || (E.isMac && E.isGecko2),
// inpired by a similar function in mootools library
/**
* Returns the type of object that is passed in. If the object passed in is null or undefined it
* return false otherwise it returns one of the following values:<div class="mdetail-params"><ul>
* <li><b>string</b>: If the object passed is a string</li>
* <li><b>number</b>: If the object passed is a number</li>
* <li><b>boolean</b>: If the object passed is a boolean value</li>
* <li><b>date</b>: If the object passed is a Date object</li>
* <li><b>function</b>: If the object passed is a function reference</li>
* <li><b>object</b>: If the object passed is an object</li>
* <li><b>array</b>: If the object passed is an array</li>
* <li><b>regexp</b>: If the object passed is a regular expression</li>
* <li><b>element</b>: If the object passed is a DOM Element</li>
* <li><b>nodelist</b>: If the object passed is a DOM NodeList</li>
* <li><b>textnode</b>: If the object passed is a DOM text node and contains something other than whitespace</li>
* <li><b>whitespace</b>: If the object passed is a DOM text node and contains only whitespace</li>
* </ul></div>
* @param {Mixed} object
* @return {String}
*/
type : function(o){
if(o === undefined || o === null){
return false;
}
if(o.htmlElement){
return 'element';
}
var t = typeof o;
if(t == 'object' && o.nodeName) {
switch(o.nodeType) {
case 1: return 'element';
case 3: return (/\S/).test(o.nodeValue) ? 'textnode' : 'whitespace';
}
}
if(t == 'object' || t == 'function') {
switch(o.constructor) {
case Array: return 'array';
case RegExp: return 'regexp';
case Date: return 'date';
}
if(typeof o.length == 'number' && typeof o.item == 'function') {
return 'nodelist';
}
}
return t;
},
intercept : function(o, name, fn, scope){
o[name] = o[name].createInterceptor(fn, scope);
},
// internal
callback : function(cb, scope, args, delay){
if(typeof cb == 'function'){
if(delay){
cb.defer(delay, scope, args || []);
}else{
cb.apply(scope, args || []);
}
}
}
};
}());
/**
* @class Function
* These functions are available on every Function object (any JavaScript function).
*/
Ext.apply(Function.prototype, {
/**
* Create a combined function call sequence of the original function + the passed function.
* The resulting function returns the results of the original function.
* The passed fcn is called with the parameters of the original function. Example usage:
* <pre><code>
var sayHi = function(name){
alert('Hi, ' + name);
}
sayHi('Fred'); // alerts "Hi, Fred"
var sayGoodbye = sayHi.createSequence(function(name){
alert('Bye, ' + name);
});
sayGoodbye('Fred'); // both alerts show
</code></pre>
* @param {Function} fcn The function to sequence
* @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the passed function is executed.
* <b>If omitted, defaults to the scope in which the original function is called or the browser window.</b>
* @return {Function} The new function
*/
createSequence : function(fcn, scope){
var method = this;
return (typeof fcn != 'function') ?
this :
function(){
var retval = method.apply(this || window, arguments);
fcn.apply(scope || this || window, arguments);
return retval;
};
}
});
/**
* @class String
* These functions are available as static methods on the JavaScript String object.
*/
Ext.applyIf(String, {
/**
* Escapes the passed string for ' and \
* @param {String} string The string to escape
* @return {String} The escaped string
* @static
*/
escape : function(string) {
return string.replace(/('|\\)/g, "\\$1");
},
/**
* Pads the left side of a string with a specified character. This is especially useful
* for normalizing number and date strings. Example usage:
* <pre><code>
var s = String.leftPad('123', 5, '0');
// s now contains the string: '00123'
* </code></pre>
* @param {String} string The original string
* @param {Number} size The total length of the output string
* @param {String} char (optional) The character with which to pad the original string (defaults to empty string " ")
* @return {String} The padded string
* @static
*/
leftPad : function (val, size, ch) {
var result = String(val);
if(!ch) {
ch = " ";
}
while (result.length < size) {
result = ch + result;
}
return result;
}
});
/**
* Utility function that allows you to easily switch a string between two alternating values. The passed value
* is compared to the current string, and if they are equal, the other value that was passed in is returned. If
* they are already different, the first value passed in is returned. Note that this method returns the new value
* but does not change the current string.
* <pre><code>
// alternate sort directions
sort = sort.toggle('ASC', 'DESC');
// instead of conditional logic:
sort = (sort == 'ASC' ? 'DESC' : 'ASC');
</code></pre>
* @param {String} value The value to compare to the current string
* @param {String} other The new value to use if the string already equals the first value passed in
* @return {String} The new value
*/
String.prototype.toggle = function(value, other){
return this == value ? other : value;
};
/**
* Trims whitespace from either end of a string, leaving spaces within the string intact. Example:
* <pre><code>
var s = ' foo bar ';
alert('-' + s + '-'); //alerts "- foo bar -"
alert('-' + s.trim() + '-'); //alerts "-foo bar-"
</code></pre>
* @return {String} The trimmed string
*/
String.prototype.trim = function(){
var re = /^\s+|\s+$/g;
return function(){ return this.replace(re, ""); };
}();
// here to prevent dependency on Date.js
/**
Returns the number of milliseconds between this date and date
@param {Date} date (optional) Defaults to now
@return {Number} The diff in milliseconds
@member Date getElapsed
*/
Date.prototype.getElapsed = function(date) {
return Math.abs((date || new Date()).getTime()-this.getTime());
};
/**
* @class Number
*/
Ext.applyIf(Number.prototype, {
/**
* Checks whether or not the current number is within a desired range. If the number is already within the
* range it is returned, otherwise the min or max value is returned depending on which side of the range is
* exceeded. Note that this method returns the constrained value but does not change the current number.
* @param {Number} min The minimum number in the range
* @param {Number} max The maximum number in the range
* @return {Number} The constrained value if outside the range, otherwise the current value
*/
constrain : function(min, max){
return Math.min(Math.max(this, min), max);
}
});

View File

@@ -1,137 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Template
*/
Ext.apply(Ext.Template.prototype, {
/**
* @cfg {Boolean} disableFormats Specify <tt>true</tt> to disable format
* functions in the template. If the template does not contain
* {@link Ext.util.Format format functions}, setting <code>disableFormats</code>
* to true will reduce <code>{@link #apply}</code> time. Defaults to <tt>false</tt>.
* <pre><code>
var t = new Ext.Template(
'&lt;div name="{id}"&gt;',
'&lt;span class="{cls}"&gt;{name} {value}&lt;/span&gt;',
'&lt;/div&gt;',
{
compiled: true, // {@link #compile} immediately
disableFormats: true // reduce <code>{@link #apply}</code> time since no formatting
}
);
* </code></pre>
* For a list of available format functions, see {@link Ext.util.Format}.
*/
disableFormats : false,
/**
* See <code>{@link #disableFormats}</code>.
* @type Boolean
* @property disableFormats
*/
/**
* The regular expression used to match template variables
* @type RegExp
* @property
* @hide repeat doc
*/
re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
argsRe : /^\s*['"](.*)["']\s*$/,
compileARe : /\\/g,
compileBRe : /(\r\n|\n)/g,
compileCRe : /'/g,
/**
* Returns an HTML fragment of this template with the specified values applied.
* @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
* @return {String} The HTML fragment
* @hide repeat doc
*/
applyTemplate : function(values){
var me = this,
useF = me.disableFormats !== true,
fm = Ext.util.Format,
tpl = me;
if(me.compiled){
return me.compiled(values);
}
function fn(m, name, format, args){
if (format && useF) {
if (format.substr(0, 5) == "this.") {
return tpl.call(format.substr(5), values[name], values);
} else {
if (args) {
// quoted values are required for strings in compiled templates,
// but for non compiled we need to strip them
// quoted reversed for jsmin
var re = me.argsRe;
args = args.split(',');
for(var i = 0, len = args.length; i < len; i++){
args[i] = args[i].replace(re, "$1");
}
args = [values[name]].concat(args);
} else {
args = [values[name]];
}
return fm[format].apply(fm, args);
}
} else {
return values[name] !== undefined ? values[name] : "";
}
}
return me.html.replace(me.re, fn);
},
/**
* Compiles the template into an internal function, eliminating the RegEx overhead.
* @return {Ext.Template} this
* @hide repeat doc
*/
compile : function(){
var me = this,
fm = Ext.util.Format,
useF = me.disableFormats !== true,
sep = Ext.isGecko ? "+" : ",",
body;
function fn(m, name, format, args){
if(format && useF){
args = args ? ',' + args : "";
if(format.substr(0, 5) != "this."){
format = "fm." + format + '(';
}else{
format = 'this.call("'+ format.substr(5) + '", ';
args = ", values";
}
}else{
args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
}
return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
}
// branched to use + in gecko and [].join() in others
if(Ext.isGecko){
body = "this.compiled = function(values){ return '" +
me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn) +
"';};";
}else{
body = ["this.compiled = function(values){ return ['"];
body.push(me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn));
body.push("'].join('');};");
body = body.join('');
}
eval(body);
return me;
},
// private function used to call members
call : function(fnName, value, allValues){
return this[fnName](value, allValues);
}
});
Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;

View File

@@ -1,285 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.Api
* @extends Object
* Ext.data.Api is a singleton designed to manage the data API including methods
* for validating a developer's DataProxy API. Defines variables for CRUD actions
* create, read, update and destroy in addition to a mapping of RESTful HTTP methods
* GET, POST, PUT and DELETE to CRUD actions.
* @singleton
*/
Ext.data.Api = (function() {
// private validActions. validActions is essentially an inverted hash of Ext.data.Api.actions, where value becomes the key.
// Some methods in this singleton (e.g.: getActions, getVerb) will loop through actions with the code <code>for (var verb in this.actions)</code>
// For efficiency, some methods will first check this hash for a match. Those methods which do acces validActions will cache their result here.
// We cannot pre-define this hash since the developer may over-ride the actions at runtime.
var validActions = {};
return {
/**
* Defined actions corresponding to remote actions:
* <pre><code>
actions: {
create : 'create', // Text representing the remote-action to create records on server.
read : 'read', // Text representing the remote-action to read/load data from server.
update : 'update', // Text representing the remote-action to update records on server.
destroy : 'destroy' // Text representing the remote-action to destroy records on server.
}
* </code></pre>
* @property actions
* @type Object
*/
actions : {
create : 'create',
read : 'read',
update : 'update',
destroy : 'destroy'
},
/**
* Defined {CRUD action}:{HTTP method} pairs to associate HTTP methods with the
* corresponding actions for {@link Ext.data.DataProxy#restful RESTful proxies}.
* Defaults to:
* <pre><code>
restActions : {
create : 'POST',
read : 'GET',
update : 'PUT',
destroy : 'DELETE'
},
* </code></pre>
*/
restActions : {
create : 'POST',
read : 'GET',
update : 'PUT',
destroy : 'DELETE'
},
/**
* Returns true if supplied action-name is a valid API action defined in <code>{@link #actions}</code> constants
* @param {String} action Action to test for availability.
* @return {Boolean}
*/
isAction : function(action) {
return (Ext.data.Api.actions[action]) ? true : false;
},
/**
* Returns the actual CRUD action KEY "create", "read", "update" or "destroy" from the supplied action-name. This method is used internally and shouldn't generally
* need to be used directly. The key/value pair of Ext.data.Api.actions will often be identical but this is not necessarily true. A developer can override this naming
* convention if desired. However, the framework internally calls methods based upon the KEY so a way of retreiving the the words "create", "read", "update" and "destroy" is
* required. This method will cache discovered KEYS into the private validActions hash.
* @param {String} name The runtime name of the action.
* @return {String||null} returns the action-key, or verb of the user-action or null if invalid.
* @nodoc
*/
getVerb : function(name) {
if (validActions[name]) {
return validActions[name]; // <-- found in cache. return immediately.
}
for (var verb in this.actions) {
if (this.actions[verb] === name) {
validActions[name] = verb;
break;
}
}
return (validActions[name] !== undefined) ? validActions[name] : null;
},
/**
* Returns true if the supplied API is valid; that is, check that all keys match defined actions
* otherwise returns an array of mistakes.
* @return {String[]|true}
*/
isValid : function(api){
var invalid = [];
var crud = this.actions; // <-- cache a copy of the actions.
for (var action in api) {
if (!(action in crud)) {
invalid.push(action);
}
}
return (!invalid.length) ? true : invalid;
},
/**
* Returns true if the supplied verb upon the supplied proxy points to a unique url in that none of the other api-actions
* point to the same url. The question is important for deciding whether to insert the "xaction" HTTP parameter within an
* Ajax request. This method is used internally and shouldn't generally need to be called directly.
* @param {Ext.data.DataProxy} proxy
* @param {String} verb
* @return {Boolean}
*/
hasUniqueUrl : function(proxy, verb) {
var url = (proxy.api[verb]) ? proxy.api[verb].url : null;
var unique = true;
for (var action in proxy.api) {
if ((unique = (action === verb) ? true : (proxy.api[action].url != url) ? true : false) === false) {
break;
}
}
return unique;
},
/**
* This method is used internally by <tt>{@link Ext.data.DataProxy DataProxy}</tt> and should not generally need to be used directly.
* Each action of a DataProxy api can be initially defined as either a String or an Object. When specified as an object,
* one can explicitly define the HTTP method (GET|POST) to use for each CRUD action. This method will prepare the supplied API, setting
* each action to the Object form. If your API-actions do not explicitly define the HTTP method, the "method" configuration-parameter will
* be used. If the method configuration parameter is not specified, POST will be used.
<pre><code>
new Ext.data.HttpProxy({
method: "POST", // <-- default HTTP method when not specified.
api: {
create: 'create.php',
load: 'read.php',
save: 'save.php',
destroy: 'destroy.php'
}
});
// Alternatively, one can use the object-form to specify the API
new Ext.data.HttpProxy({
api: {
load: {url: 'read.php', method: 'GET'},
create: 'create.php',
destroy: 'destroy.php',
save: 'update.php'
}
});
</code></pre>
*
* @param {Ext.data.DataProxy} proxy
*/
prepare : function(proxy) {
if (!proxy.api) {
proxy.api = {}; // <-- No api? create a blank one.
}
for (var verb in this.actions) {
var action = this.actions[verb];
proxy.api[action] = proxy.api[action] || proxy.url || proxy.directFn;
if (typeof(proxy.api[action]) == 'string') {
proxy.api[action] = {
url: proxy.api[action],
method: (proxy.restful === true) ? Ext.data.Api.restActions[action] : undefined
};
}
}
},
/**
* Prepares a supplied Proxy to be RESTful. Sets the HTTP method for each api-action to be one of
* GET, POST, PUT, DELETE according to the defined {@link #restActions}.
* @param {Ext.data.DataProxy} proxy
*/
restify : function(proxy) {
proxy.restful = true;
for (var verb in this.restActions) {
proxy.api[this.actions[verb]].method ||
(proxy.api[this.actions[verb]].method = this.restActions[verb]);
}
// TODO: perhaps move this interceptor elsewhere? like into DataProxy, perhaps? Placed here
// to satisfy initial 3.0 final release of REST features.
proxy.onWrite = proxy.onWrite.createInterceptor(function(action, o, response, rs) {
var reader = o.reader;
var res = new Ext.data.Response({
action: action,
raw: response
});
switch (response.status) {
case 200: // standard 200 response, send control back to HttpProxy#onWrite by returning true from this intercepted #onWrite
return true;
break;
case 201: // entity created but no response returned
if (Ext.isEmpty(res.raw.responseText)) {
res.success = true;
} else {
//if the response contains data, treat it like a 200
return true;
}
break;
case 204: // no-content. Create a fake response.
res.success = true;
res.data = null;
break;
default:
return true;
break;
}
if (res.success === true) {
this.fireEvent("write", this, action, res.data, res, rs, o.request.arg);
} else {
this.fireEvent('exception', this, 'remote', action, o, res, rs);
}
o.request.callback.call(o.request.scope, res.data, res, res.success);
return false; // <-- false to prevent intercepted function from running.
}, proxy);
}
};
})();
/**
* Ext.data.Response
* Experimental. Do not use directly.
*/
Ext.data.Response = function(params, response) {
Ext.apply(this, params, {
raw: response
});
};
Ext.data.Response.prototype = {
message : null,
success : false,
status : null,
root : null,
raw : null,
getMessage : function() {
return this.message;
},
getSuccess : function() {
return this.success;
},
getStatus : function() {
return this.status;
},
getRoot : function() {
return this.root;
},
getRawResponse : function() {
return this.raw;
}
};
/**
* @class Ext.data.Api.Error
* @extends Ext.Error
* Error class for Ext.data.Api errors
*/
Ext.data.Api.Error = Ext.extend(Ext.Error, {
constructor : function(message, arg) {
this.arg = arg;
Ext.Error.call(this, message);
},
name: 'Ext.data.Api'
});
Ext.apply(Ext.data.Api.Error.prototype, {
lang: {
'action-url-undefined': 'No fallback url defined for this action. When defining a DataProxy api, please be sure to define an url for each CRUD action in Ext.data.Api.actions or define a default url in addition to your api-configuration.',
'invalid': 'received an invalid API-configuration. Please ensure your proxy API-configuration contains only the actions defined in Ext.data.Api.actions',
'invalid-url': 'Invalid url. Please review your proxy configuration.',
'execute': 'Attempted to execute an unknown action. Valid API actions are defined in Ext.data.Api.actions"'
}
});

View File

@@ -1,103 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.ArrayReader
* @extends Ext.data.JsonReader
* <p>Data reader class to create an Array of {@link Ext.data.Record} objects from an Array.
* Each element of that Array represents a row of data fields. The
* fields are pulled into a Record object using as a subscript, the <code>mapping</code> property
* of the field definition if it exists, or the field's ordinal position in the definition.</p>
* <p>Example code:</p>
* <pre><code>
var Employee = Ext.data.Record.create([
{name: 'name', mapping: 1}, // "mapping" only needed if an "id" field is present which
{name: 'occupation', mapping: 2} // precludes using the ordinal position as the index.
]);
var myReader = new Ext.data.ArrayReader({
{@link #idIndex}: 0
}, Employee);
</code></pre>
* <p>This would consume an Array like this:</p>
* <pre><code>
[ [1, 'Bill', 'Gardener'], [2, 'Ben', 'Horticulturalist'] ]
* </code></pre>
* @constructor
* Create a new ArrayReader
* @param {Object} meta Metadata configuration options.
* @param {Array/Object} recordType
* <p>Either an Array of {@link Ext.data.Field Field} definition objects (which
* will be passed to {@link Ext.data.Record#create}, or a {@link Ext.data.Record Record}
* constructor created from {@link Ext.data.Record#create}.</p>
*/
Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, {
/**
* @cfg {String} successProperty
* @hide
*/
/**
* @cfg {Number} id (optional) The subscript within row Array that provides an ID for the Record.
* Deprecated. Use {@link #idIndex} instead.
*/
/**
* @cfg {Number} idIndex (optional) The subscript within row Array that provides an ID for the Record.
*/
/**
* Create a data block containing Ext.data.Records from an Array.
* @param {Object} o An Array of row objects which represents the dataset.
* @return {Object} data A data block which is used by an Ext.data.Store object as
* a cache of Ext.data.Records.
*/
readRecords : function(o){
this.arrayData = o;
var s = this.meta,
sid = s ? Ext.num(s.idIndex, s.id) : null,
recordType = this.recordType,
fields = recordType.prototype.fields,
records = [],
success = true,
v;
var root = this.getRoot(o);
for(var i = 0, len = root.length; i < len; i++) {
var n = root[i],
values = {},
id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null);
for(var j = 0, jlen = fields.length; j < jlen; j++) {
var f = fields.items[j],
k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j;
v = n[k] !== undefined ? n[k] : f.defaultValue;
v = f.convert(v, n);
values[f.name] = v;
}
var record = new recordType(values, id);
record.json = n;
records[records.length] = record;
}
var totalRecords = records.length;
if(s.totalProperty) {
v = parseInt(this.getTotal(o), 10);
if(!isNaN(v)) {
totalRecords = v;
}
}
if(s.successProperty){
v = this.getSuccess(o);
if(v === false || v === 'false'){
success = false;
}
}
return {
success : success,
records : records,
totalRecords : totalRecords
};
}
});

View File

@@ -1,70 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.ArrayStore
* @extends Ext.data.Store
* <p>Formerly known as "SimpleStore".</p>
* <p>Small helper class to make creating {@link Ext.data.Store}s from Array data easier.
* An ArrayStore will be automatically configured with a {@link Ext.data.ArrayReader}.</p>
* <p>A store configuration would be something like:<pre><code>
var store = new Ext.data.ArrayStore({
// store configs
autoDestroy: true,
storeId: 'myStore',
// reader configs
idIndex: 0,
fields: [
'company',
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
]
});
* </code></pre></p>
* <p>This store is configured to consume a returned object of the form:<pre><code>
var myData = [
['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
];
* </code></pre>
* An object literal of this form could also be used as the {@link #data} config option.</p>
* <p><b>*Note:</b> Although not listed here, this class accepts all of the configuration options of
* <b>{@link Ext.data.ArrayReader ArrayReader}</b>.</p>
* @constructor
* @param {Object} config
* @xtype arraystore
*/
Ext.data.ArrayStore = Ext.extend(Ext.data.Store, {
/**
* @cfg {Ext.data.DataReader} reader @hide
*/
constructor: function(config){
Ext.data.ArrayStore.superclass.constructor.call(this, Ext.apply(config, {
reader: new Ext.data.ArrayReader(config)
}));
},
loadData : function(data, append){
if(this.expandData === true){
var r = [];
for(var i = 0, len = data.length; i < len; i++){
r[r.length] = [data[i]];
}
data = r;
}
Ext.data.ArrayStore.superclass.loadData.call(this, data, append);
}
});
Ext.reg('arraystore', Ext.data.ArrayStore);
// backwards compat
Ext.data.SimpleStore = Ext.data.ArrayStore;
Ext.reg('simplestore', Ext.data.SimpleStore);

View File

@@ -1,203 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.Field
* <p>This class encapsulates the field definition information specified in the field definition objects
* passed to {@link Ext.data.Record#create}.</p>
* <p>Developers do not need to instantiate this class. Instances are created by {@link Ext.data.Record.create}
* and cached in the {@link Ext.data.Record#fields fields} property of the created Record constructor's <b>prototype.</b></p>
*/
Ext.data.Field = Ext.extend(Object, {
constructor : function(config){
if(Ext.isString(config)){
config = {name: config};
}
Ext.apply(this, config);
var types = Ext.data.Types,
st = this.sortType,
t;
if(this.type){
if(Ext.isString(this.type)){
this.type = Ext.data.Types[this.type.toUpperCase()] || types.AUTO;
}
}else{
this.type = types.AUTO;
}
// named sortTypes are supported, here we look them up
if(Ext.isString(st)){
this.sortType = Ext.data.SortTypes[st];
}else if(Ext.isEmpty(st)){
this.sortType = this.type.sortType;
}
if(!this.convert){
this.convert = this.type.convert;
}
},
/**
* @cfg {String} name
* The name by which the field is referenced within the Record. This is referenced by, for example,
* the <code>dataIndex</code> property in column definition objects passed to {@link Ext.grid.ColumnModel}.
* <p>Note: In the simplest case, if no properties other than <code>name</code> are required, a field
* definition may consist of just a String for the field name.</p>
*/
/**
* @cfg {Mixed} type
* (Optional) The data type for automatic conversion from received data to the <i>stored</i> value if <code>{@link Ext.data.Field#convert convert}</code>
* has not been specified. This may be specified as a string value. Possible values are
* <div class="mdetail-params"><ul>
* <li>auto (Default, implies no conversion)</li>
* <li>string</li>
* <li>int</li>
* <li>float</li>
* <li>boolean</li>
* <li>date</li></ul></div>
* <p>This may also be specified by referencing a member of the {@link Ext.data.Types} class.</p>
* <p>Developers may create their own application-specific data types by defining new members of the
* {@link Ext.data.Types} class.</p>
*/
/**
* @cfg {Function} convert
* (Optional) A function which converts the value provided by the Reader into an object that will be stored
* in the Record. It is passed the following parameters:<div class="mdetail-params"><ul>
* <li><b>v</b> : Mixed<div class="sub-desc">The data value as read by the Reader, if undefined will use
* the configured <code>{@link Ext.data.Field#defaultValue defaultValue}</code>.</div></li>
* <li><b>rec</b> : Mixed<div class="sub-desc">The data object containing the row as read by the Reader.
* Depending on the Reader type, this could be an Array ({@link Ext.data.ArrayReader ArrayReader}), an object
* ({@link Ext.data.JsonReader JsonReader}), or an XML element ({@link Ext.data.XMLReader XMLReader}).</div></li>
* </ul></div>
* <pre><code>
// example of convert function
function fullName(v, record){
return record.name.last + ', ' + record.name.first;
}
function location(v, record){
return !record.city ? '' : (record.city + ', ' + record.state);
}
var Dude = Ext.data.Record.create([
{name: 'fullname', convert: fullName},
{name: 'firstname', mapping: 'name.first'},
{name: 'lastname', mapping: 'name.last'},
{name: 'city', defaultValue: 'homeless'},
'state',
{name: 'location', convert: location}
]);
// create the data store
var store = new Ext.data.Store({
reader: new Ext.data.JsonReader(
{
idProperty: 'key',
root: 'daRoot',
totalProperty: 'total'
},
Dude // recordType
)
});
var myData = [
{ key: 1,
name: { first: 'Fat', last: 'Albert' }
// notice no city, state provided in data object
},
{ key: 2,
name: { first: 'Barney', last: 'Rubble' },
city: 'Bedrock', state: 'Stoneridge'
},
{ key: 3,
name: { first: 'Cliff', last: 'Claven' },
city: 'Boston', state: 'MA'
}
];
* </code></pre>
*/
/**
* @cfg {String} dateFormat
* <p>(Optional) Used when converting received data into a Date when the {@link #type} is specified as <code>"date"</code>.</p>
* <p>A format string for the {@link Date#parseDate Date.parseDate} function, or "timestamp" if the
* value provided by the Reader is a UNIX timestamp, or "time" if the value provided by the Reader is a
* javascript millisecond timestamp. See {@link Date}</p>
*/
dateFormat: null,
/**
* @cfg {Boolean} useNull
* <p>(Optional) Use when converting received data into a Number type (either int or float). If the value cannot be parsed,
* null will be used if useNull is true, otherwise the value will be 0. Defaults to <tt>false</tt>
*/
useNull: false,
/**
* @cfg {Mixed} defaultValue
* (Optional) The default value used <b>when a Record is being created by a {@link Ext.data.Reader Reader}</b>
* when the item referenced by the <code>{@link Ext.data.Field#mapping mapping}</code> does not exist in the data
* object (i.e. undefined). (defaults to "")
*/
defaultValue: "",
/**
* @cfg {String/Number} mapping
* <p>(Optional) A path expression for use by the {@link Ext.data.DataReader} implementation
* that is creating the {@link Ext.data.Record Record} to extract the Field value from the data object.
* If the path expression is the same as the field name, the mapping may be omitted.</p>
* <p>The form of the mapping expression depends on the Reader being used.</p>
* <div class="mdetail-params"><ul>
* <li>{@link Ext.data.JsonReader}<div class="sub-desc">The mapping is a string containing the javascript
* expression to reference the data from an element of the data item's {@link Ext.data.JsonReader#root root} Array. Defaults to the field name.</div></li>
* <li>{@link Ext.data.XmlReader}<div class="sub-desc">The mapping is an {@link Ext.DomQuery} path to the data
* item relative to the DOM element that represents the {@link Ext.data.XmlReader#record record}. Defaults to the field name.</div></li>
* <li>{@link Ext.data.ArrayReader}<div class="sub-desc">The mapping is a number indicating the Array index
* of the field's value. Defaults to the field specification's Array position.</div></li>
* </ul></div>
* <p>If a more complex value extraction strategy is required, then configure the Field with a {@link #convert}
* function. This is passed the whole row object, and may interrogate it in whatever way is necessary in order to
* return the desired data.</p>
*/
mapping: null,
/**
* @cfg {Function} sortType
* (Optional) A function which converts a Field's value to a comparable value in order to ensure
* correct sort ordering. Predefined functions are provided in {@link Ext.data.SortTypes}. A custom
* sort example:<pre><code>
// current sort after sort we want
// +-+------+ +-+------+
// |1|First | |1|First |
// |2|Last | |3|Second|
// |3|Second| |2|Last |
// +-+------+ +-+------+
sortType: function(value) {
switch (value.toLowerCase()) // native toLowerCase():
{
case 'first': return 1;
case 'second': return 2;
default: return 3;
}
}
* </code></pre>
*/
sortType : null,
/**
* @cfg {String} sortDir
* (Optional) Initial direction to sort (<code>"ASC"</code> or <code>"DESC"</code>). Defaults to
* <code>"ASC"</code>.
*/
sortDir : "ASC",
/**
* @cfg {Boolean} allowBlank
* (Optional) Used for validating a {@link Ext.data.Record record}, defaults to <code>true</code>.
* An empty value here will cause {@link Ext.data.Record}.{@link Ext.data.Record#isValid isValid}
* to evaluate to <code>false</code>.
*/
allowBlank : true
});

View File

@@ -1,511 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.DataProxy
* @extends Ext.util.Observable
* <p>Abstract base class for implementations which provide retrieval of unformatted data objects.
* This class is intended to be extended and should not be created directly. For existing implementations,
* see {@link Ext.data.DirectProxy}, {@link Ext.data.HttpProxy}, {@link Ext.data.ScriptTagProxy} and
* {@link Ext.data.MemoryProxy}.</p>
* <p>DataProxy implementations are usually used in conjunction with an implementation of {@link Ext.data.DataReader}
* (of the appropriate type which knows how to parse the data object) to provide a block of
* {@link Ext.data.Records} to an {@link Ext.data.Store}.</p>
* <p>The parameter to a DataProxy constructor may be an {@link Ext.data.Connection} or can also be the
* config object to an {@link Ext.data.Connection}.</p>
* <p>Custom implementations must implement either the <code><b>doRequest</b></code> method (preferred) or the
* <code>load</code> method (deprecated). See
* {@link Ext.data.HttpProxy}.{@link Ext.data.HttpProxy#doRequest doRequest} or
* {@link Ext.data.HttpProxy}.{@link Ext.data.HttpProxy#load load} for additional details.</p>
* <p><b><u>Example 1</u></b></p>
* <pre><code>
proxy: new Ext.data.ScriptTagProxy({
{@link Ext.data.Connection#url url}: 'http://extjs.com/forum/topics-remote.php'
}),
* </code></pre>
* <p><b><u>Example 2</u></b></p>
* <pre><code>
proxy : new Ext.data.HttpProxy({
{@link Ext.data.Connection#method method}: 'GET',
{@link Ext.data.HttpProxy#prettyUrls prettyUrls}: false,
{@link Ext.data.Connection#url url}: 'local/default.php', // see options parameter for {@link Ext.Ajax#request}
{@link #api}: {
// all actions except the following will use above url
create : 'local/new.php',
update : 'local/update.php'
}
}),
* </code></pre>
* <p>And <b>new in Ext version 3</b>, attach centralized event-listeners upon the DataProxy class itself! This is a great place
* to implement a <i>messaging system</i> to centralize your application's user-feedback and error-handling.</p>
* <pre><code>
// Listen to all "beforewrite" event fired by all proxies.
Ext.data.DataProxy.on('beforewrite', function(proxy, action) {
console.log('beforewrite: ', action);
});
// Listen to "write" event fired by all proxies
Ext.data.DataProxy.on('write', function(proxy, action, data, res, rs) {
console.info('write: ', action);
});
// Listen to "exception" event fired by all proxies
Ext.data.DataProxy.on('exception', function(proxy, type, action, exception) {
console.error(type + action + ' exception);
});
* </code></pre>
* <b>Note:</b> These three events are all fired with the signature of the corresponding <i>DataProxy instance</i> event {@link #beforewrite beforewrite}, {@link #write write} and {@link #exception exception}.
*/
Ext.data.DataProxy = function(conn){
// make sure we have a config object here to support ux proxies.
// All proxies should now send config into superclass constructor.
conn = conn || {};
// This line caused a bug when people use custom Connection object having its own request method.
// http://extjs.com/forum/showthread.php?t=67194. Have to set DataProxy config
//Ext.applyIf(this, conn);
this.api = conn.api;
this.url = conn.url;
this.restful = conn.restful;
this.listeners = conn.listeners;
// deprecated
this.prettyUrls = conn.prettyUrls;
/**
* @cfg {Object} api
* Specific urls to call on CRUD action methods "read", "create", "update" and "destroy".
* Defaults to:<pre><code>
api: {
read : undefined,
create : undefined,
update : undefined,
destroy : undefined
}
* </code></pre>
* <p>The url is built based upon the action being executed <tt>[load|create|save|destroy]</tt>
* using the commensurate <tt>{@link #api}</tt> property, or if undefined default to the
* configured {@link Ext.data.Store}.{@link Ext.data.Store#url url}.</p><br>
* <p>For example:</p>
* <pre><code>
api: {
load : '/controller/load',
create : '/controller/new', // Server MUST return idProperty of new record
save : '/controller/update',
destroy : '/controller/destroy_action'
}
// Alternatively, one can use the object-form to specify each API-action
api: {
load: {url: 'read.php', method: 'GET'},
create: 'create.php',
destroy: 'destroy.php',
save: 'update.php'
}
* </code></pre>
* <p>If the specific URL for a given CRUD action is undefined, the CRUD action request
* will be directed to the configured <tt>{@link Ext.data.Connection#url url}</tt>.</p>
* <br><p><b>Note</b>: To modify the URL for an action dynamically the appropriate API
* property should be modified before the action is requested using the corresponding before
* action event. For example to modify the URL associated with the load action:
* <pre><code>
// modify the url for the action
myStore.on({
beforeload: {
fn: function (store, options) {
// use <tt>{@link Ext.data.HttpProxy#setUrl setUrl}</tt> to change the URL for *just* this request.
store.proxy.setUrl('changed1.php');
// set optional second parameter to true to make this URL change
// permanent, applying this URL for all subsequent requests.
store.proxy.setUrl('changed1.php', true);
// Altering the proxy API should be done using the public
// method <tt>{@link Ext.data.DataProxy#setApi setApi}</tt>.
store.proxy.setApi('read', 'changed2.php');
// Or set the entire API with a config-object.
// When using the config-object option, you must redefine the <b>entire</b>
// API -- not just a specific action of it.
store.proxy.setApi({
read : 'changed_read.php',
create : 'changed_create.php',
update : 'changed_update.php',
destroy : 'changed_destroy.php'
});
}
}
});
* </code></pre>
* </p>
*/
this.addEvents(
/**
* @event exception
* <p>Fires if an exception occurs in the Proxy during a remote request. This event is relayed
* through a corresponding {@link Ext.data.Store}.{@link Ext.data.Store#exception exception},
* so any Store instance may observe this event.</p>
* <p>In addition to being fired through the DataProxy instance that raised the event, this event is also fired
* through the Ext.data.DataProxy <i>class</i> to allow for centralized processing of exception events from <b>all</b>
* DataProxies by attaching a listener to the Ext.data.DataProxy class itself.</p>
* <p>This event can be fired for one of two reasons:</p>
* <div class="mdetail-params"><ul>
* <li>remote-request <b>failed</b> : <div class="sub-desc">
* The server did not return status === 200.
* </div></li>
* <li>remote-request <b>succeeded</b> : <div class="sub-desc">
* The remote-request succeeded but the reader could not read the response.
* This means the server returned data, but the configured Reader threw an
* error while reading the response. In this case, this event will be
* raised and the caught error will be passed along into this event.
* </div></li>
* </ul></div>
* <br><p>This event fires with two different contexts based upon the 2nd
* parameter <tt>type [remote|response]</tt>. The first four parameters
* are identical between the two contexts -- only the final two parameters
* differ.</p>
* @param {DataProxy} this The proxy that sent the request
* @param {String} type
* <p>The value of this parameter will be either <tt>'response'</tt> or <tt>'remote'</tt>.</p>
* <div class="mdetail-params"><ul>
* <li><b><tt>'response'</tt></b> : <div class="sub-desc">
* <p>An <b>invalid</b> response from the server was returned: either 404,
* 500 or the response meta-data does not match that defined in the DataReader
* (e.g.: root, idProperty, successProperty).</p>
* </div></li>
* <li><b><tt>'remote'</tt></b> : <div class="sub-desc">
* <p>A <b>valid</b> response was returned from the server having
* successProperty === false. This response might contain an error-message
* sent from the server. For example, the user may have failed
* authentication/authorization or a database validation error occurred.</p>
* </div></li>
* </ul></div>
* @param {String} action Name of the action (see {@link Ext.data.Api#actions}.
* @param {Object} options The options for the action that were specified in the {@link #request}.
* @param {Object} response
* <p>The value of this parameter depends on the value of the <code>type</code> parameter:</p>
* <div class="mdetail-params"><ul>
* <li><b><tt>'response'</tt></b> : <div class="sub-desc">
* <p>The raw browser response object (e.g.: XMLHttpRequest)</p>
* </div></li>
* <li><b><tt>'remote'</tt></b> : <div class="sub-desc">
* <p>The decoded response object sent from the server.</p>
* </div></li>
* </ul></div>
* @param {Mixed} arg
* <p>The type and value of this parameter depends on the value of the <code>type</code> parameter:</p>
* <div class="mdetail-params"><ul>
* <li><b><tt>'response'</tt></b> : Error<div class="sub-desc">
* <p>The JavaScript Error object caught if the configured Reader could not read the data.
* If the remote request returns success===false, this parameter will be null.</p>
* </div></li>
* <li><b><tt>'remote'</tt></b> : Record/Record[]<div class="sub-desc">
* <p>This parameter will only exist if the <tt>action</tt> was a <b>write</b> action
* (Ext.data.Api.actions.create|update|destroy).</p>
* </div></li>
* </ul></div>
*/
'exception',
/**
* @event beforeload
* Fires before a request to retrieve a data object.
* @param {DataProxy} this The proxy for the request
* @param {Object} params The params object passed to the {@link #request} function
*/
'beforeload',
/**
* @event load
* Fires before the load method's callback is called.
* @param {DataProxy} this The proxy for the request
* @param {Object} o The request transaction object
* @param {Object} options The callback's <tt>options</tt> property as passed to the {@link #request} function
*/
'load',
/**
* @event loadexception
* <p>This event is <b>deprecated</b>. The signature of the loadexception event
* varies depending on the proxy, use the catch-all {@link #exception} event instead.
* This event will fire in addition to the {@link #exception} event.</p>
* @param {misc} misc See {@link #exception}.
* @deprecated
*/
'loadexception',
/**
* @event beforewrite
* <p>Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy</p>
* <p>In addition to being fired through the DataProxy instance that raised the event, this event is also fired
* through the Ext.data.DataProxy <i>class</i> to allow for centralized processing of beforewrite events from <b>all</b>
* DataProxies by attaching a listener to the Ext.data.DataProxy class itself.</p>
* @param {DataProxy} this The proxy for the request
* @param {String} action [Ext.data.Api.actions.create|update|destroy]
* @param {Record/Record[]} rs The Record(s) to create|update|destroy.
* @param {Object} params The request <code>params</code> object. Edit <code>params</code> to add parameters to the request.
*/
'beforewrite',
/**
* @event write
* <p>Fires before the request-callback is called</p>
* <p>In addition to being fired through the DataProxy instance that raised the event, this event is also fired
* through the Ext.data.DataProxy <i>class</i> to allow for centralized processing of write events from <b>all</b>
* DataProxies by attaching a listener to the Ext.data.DataProxy class itself.</p>
* @param {DataProxy} this The proxy that sent the request
* @param {String} action [Ext.data.Api.actions.create|upate|destroy]
* @param {Object} data The data object extracted from the server-response
* @param {Object} response The decoded response from server
* @param {Record/Record[]} rs The Record(s) from Store
* @param {Object} options The callback's <tt>options</tt> property as passed to the {@link #request} function
*/
'write'
);
Ext.data.DataProxy.superclass.constructor.call(this);
// Prepare the proxy api. Ensures all API-actions are defined with the Object-form.
try {
Ext.data.Api.prepare(this);
} catch (e) {
if (e instanceof Ext.data.Api.Error) {
e.toConsole();
}
}
// relay each proxy's events onto Ext.data.DataProxy class for centralized Proxy-listening
Ext.data.DataProxy.relayEvents(this, ['beforewrite', 'write', 'exception']);
};
Ext.extend(Ext.data.DataProxy, Ext.util.Observable, {
/**
* @cfg {Boolean} restful
* <p>Defaults to <tt>false</tt>. Set to <tt>true</tt> to operate in a RESTful manner.</p>
* <br><p> Note: this parameter will automatically be set to <tt>true</tt> if the
* {@link Ext.data.Store} it is plugged into is set to <code>restful: true</code>. If the
* Store is RESTful, there is no need to set this option on the proxy.</p>
* <br><p>RESTful implementations enable the serverside framework to automatically route
* actions sent to one url based upon the HTTP method, for example:
* <pre><code>
store: new Ext.data.Store({
restful: true,
proxy: new Ext.data.HttpProxy({url:'/users'}); // all requests sent to /users
...
)}
* </code></pre>
* If there is no <code>{@link #api}</code> specified in the configuration of the proxy,
* all requests will be marshalled to a single RESTful url (/users) so the serverside
* framework can inspect the HTTP Method and act accordingly:
* <pre>
<u>Method</u> <u>url</u> <u>action</u>
POST /users create
GET /users read
PUT /users/23 update
DESTROY /users/23 delete
* </pre></p>
* <p>If set to <tt>true</tt>, a {@link Ext.data.Record#phantom non-phantom} record's
* {@link Ext.data.Record#id id} will be appended to the url. Some MVC (e.g., Ruby on Rails,
* Merb and Django) support segment based urls where the segments in the URL follow the
* Model-View-Controller approach:<pre><code>
* someSite.com/controller/action/id
* </code></pre>
* Where the segments in the url are typically:<div class="mdetail-params"><ul>
* <li>The first segment : represents the controller class that should be invoked.</li>
* <li>The second segment : represents the class function, or method, that should be called.</li>
* <li>The third segment : represents the ID (a variable typically passed to the method).</li>
* </ul></div></p>
* <br><p>Refer to <code>{@link Ext.data.DataProxy#api}</code> for additional information.</p>
*/
restful: false,
/**
* <p>Redefines the Proxy's API or a single action of an API. Can be called with two method signatures.</p>
* <p>If called with an object as the only parameter, the object should redefine the <b>entire</b> API, e.g.:</p><pre><code>
proxy.setApi({
read : '/users/read',
create : '/users/create',
update : '/users/update',
destroy : '/users/destroy'
});
</code></pre>
* <p>If called with two parameters, the first parameter should be a string specifying the API action to
* redefine and the second parameter should be the URL (or function if using DirectProxy) to call for that action, e.g.:</p><pre><code>
proxy.setApi(Ext.data.Api.actions.read, '/users/new_load_url');
</code></pre>
* @param {String/Object} api An API specification object, or the name of an action.
* @param {String/Function} url The URL (or function if using DirectProxy) to call for the action.
*/
setApi : function() {
if (arguments.length == 1) {
var valid = Ext.data.Api.isValid(arguments[0]);
if (valid === true) {
this.api = arguments[0];
}
else {
throw new Ext.data.Api.Error('invalid', valid);
}
}
else if (arguments.length == 2) {
if (!Ext.data.Api.isAction(arguments[0])) {
throw new Ext.data.Api.Error('invalid', arguments[0]);
}
this.api[arguments[0]] = arguments[1];
}
Ext.data.Api.prepare(this);
},
/**
* Returns true if the specified action is defined as a unique action in the api-config.
* request. If all API-actions are routed to unique urls, the xaction parameter is unecessary. However, if no api is defined
* and all Proxy actions are routed to DataProxy#url, the server-side will require the xaction parameter to perform a switch to
* the corresponding code for CRUD action.
* @param {String [Ext.data.Api.CREATE|READ|UPDATE|DESTROY]} action
* @return {Boolean}
*/
isApiAction : function(action) {
return (this.api[action]) ? true : false;
},
/**
* All proxy actions are executed through this method. Automatically fires the "before" + action event
* @param {String} action Name of the action
* @param {Ext.data.Record/Ext.data.Record[]/null} rs Will be null when action is 'load'
* @param {Object} params
* @param {Ext.data.DataReader} reader
* @param {Function} callback
* @param {Object} scope The scope (<code>this</code> reference) in which the callback function is executed. Defaults to the Proxy object.
* @param {Object} options Any options specified for the action (e.g. see {@link Ext.data.Store#load}.
*/
request : function(action, rs, params, reader, callback, scope, options) {
if (!this.api[action] && !this.load) {
throw new Ext.data.DataProxy.Error('action-undefined', action);
}
params = params || {};
if ((action === Ext.data.Api.actions.read) ? this.fireEvent("beforeload", this, params) : this.fireEvent("beforewrite", this, action, rs, params) !== false) {
this.doRequest.apply(this, arguments);
}
else {
callback.call(scope || this, null, options, false);
}
},
/**
* <b>Deprecated</b> load method using old method signature. See {@doRequest} for preferred method.
* @deprecated
* @param {Object} params
* @param {Object} reader
* @param {Object} callback
* @param {Object} scope
* @param {Object} arg
*/
load : null,
/**
* @cfg {Function} doRequest Abstract method that should be implemented in all subclasses. <b>Note:</b> Should only be used by custom-proxy developers.
* (e.g.: {@link Ext.data.HttpProxy#doRequest HttpProxy.doRequest},
* {@link Ext.data.DirectProxy#doRequest DirectProxy.doRequest}).
*/
doRequest : function(action, rs, params, reader, callback, scope, options) {
// default implementation of doRequest for backwards compatibility with 2.0 proxies.
// If we're executing here, the action is probably "load".
// Call with the pre-3.0 method signature.
this.load(params, reader, callback, scope, options);
},
/**
* @cfg {Function} onRead Abstract method that should be implemented in all subclasses. <b>Note:</b> Should only be used by custom-proxy developers. Callback for read {@link Ext.data.Api#actions action}.
* @param {String} action Action name as per {@link Ext.data.Api.actions#read}.
* @param {Object} o The request transaction object
* @param {Object} res The server response
* @fires loadexception (deprecated)
* @fires exception
* @fires load
* @protected
*/
onRead : Ext.emptyFn,
/**
* @cfg {Function} onWrite Abstract method that should be implemented in all subclasses. <b>Note:</b> Should only be used by custom-proxy developers. Callback for <i>create, update and destroy</i> {@link Ext.data.Api#actions actions}.
* @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
* @param {Object} trans The request transaction object
* @param {Object} res The server response
* @fires exception
* @fires write
* @protected
*/
onWrite : Ext.emptyFn,
/**
* buildUrl
* Sets the appropriate url based upon the action being executed. If restful is true, and only a single record is being acted upon,
* url will be built Rails-style, as in "/controller/action/32". restful will aply iff the supplied record is an
* instance of Ext.data.Record rather than an Array of them.
* @param {String} action The api action being executed [read|create|update|destroy]
* @param {Ext.data.Record/Ext.data.Record[]} record The record or Array of Records being acted upon.
* @return {String} url
* @private
*/
buildUrl : function(action, record) {
record = record || null;
// conn.url gets nullified after each request. If it's NOT null here, that means the user must have intervened with a call
// to DataProxy#setUrl or DataProxy#setApi and changed it before the request was executed. If that's the case, use conn.url,
// otherwise, build the url from the api or this.url.
var url = (this.conn && this.conn.url) ? this.conn.url : (this.api[action]) ? this.api[action].url : this.url;
if (!url) {
throw new Ext.data.Api.Error('invalid-url', action);
}
// look for urls having "provides" suffix used in some MVC frameworks like Rails/Merb and others. The provides suffice informs
// the server what data-format the client is dealing with and returns data in the same format (eg: application/json, application/xml, etc)
// e.g.: /users.json, /users.xml, etc.
// with restful routes, we need urls like:
// PUT /users/1.json
// DELETE /users/1.json
var provides = null;
var m = url.match(/(.*)(\.json|\.xml|\.html)$/);
if (m) {
provides = m[2]; // eg ".json"
url = m[1]; // eg: "/users"
}
// prettyUrls is deprectated in favor of restful-config
if ((this.restful === true || this.prettyUrls === true) && record instanceof Ext.data.Record && !record.phantom) {
url += '/' + record.id;
}
return (provides === null) ? url : url + provides;
},
/**
* Destroys the proxy by purging any event listeners and cancelling any active requests.
*/
destroy: function(){
this.purgeListeners();
}
});
// Apply the Observable prototype to the DataProxy class so that proxy instances can relay their
// events to the class. Allows for centralized listening of all proxy instances upon the DataProxy class.
Ext.apply(Ext.data.DataProxy, Ext.util.Observable.prototype);
Ext.util.Observable.call(Ext.data.DataProxy);
/**
* @class Ext.data.DataProxy.Error
* @extends Ext.Error
* DataProxy Error extension.
* constructor
* @param {String} message Message describing the error.
* @param {Record/Record[]} arg
*/
Ext.data.DataProxy.Error = Ext.extend(Ext.Error, {
constructor : function(message, arg) {
this.arg = arg;
Ext.Error.call(this, message);
},
name: 'Ext.data.DataProxy'
});
Ext.apply(Ext.data.DataProxy.Error.prototype, {
lang: {
'action-undefined': "DataProxy attempted to execute an API-action but found an undefined url / function. Please review your Proxy url/api-configuration.",
'api-invalid': 'Recieved an invalid API-configuration. Please ensure your proxy API-configuration contains only the actions from Ext.data.Api.actions.'
}
});

View File

@@ -1,228 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.DataReader
* Abstract base class for reading structured data from a data source and converting
* it into an object containing {@link Ext.data.Record} objects and metadata for use
* by an {@link Ext.data.Store}. This class is intended to be extended and should not
* be created directly. For existing implementations, see {@link Ext.data.ArrayReader},
* {@link Ext.data.JsonReader} and {@link Ext.data.XmlReader}.
* @constructor Create a new DataReader
* @param {Object} meta Metadata configuration options (implementation-specific).
* @param {Array/Object} recordType
* <p>Either an Array of {@link Ext.data.Field Field} definition objects (which
* will be passed to {@link Ext.data.Record#create}, or a {@link Ext.data.Record Record}
* constructor created using {@link Ext.data.Record#create}.</p>
*/
Ext.data.DataReader = function(meta, recordType){
/**
* This DataReader's configured metadata as passed to the constructor.
* @type Mixed
* @property meta
*/
this.meta = meta;
/**
* @cfg {Array/Object} fields
* <p>Either an Array of {@link Ext.data.Field Field} definition objects (which
* will be passed to {@link Ext.data.Record#create}, or a {@link Ext.data.Record Record}
* constructor created from {@link Ext.data.Record#create}.</p>
*/
this.recordType = Ext.isArray(recordType) ?
Ext.data.Record.create(recordType) : recordType;
// if recordType defined make sure extraction functions are defined
if (this.recordType){
this.buildExtractors();
}
};
Ext.data.DataReader.prototype = {
/**
* @cfg {String} messageProperty [undefined] Optional name of a property within a server-response that represents a user-feedback message.
*/
/**
* Abstract method created in extension's buildExtractors impl.
*/
getTotal: Ext.emptyFn,
/**
* Abstract method created in extension's buildExtractors impl.
*/
getRoot: Ext.emptyFn,
/**
* Abstract method created in extension's buildExtractors impl.
*/
getMessage: Ext.emptyFn,
/**
* Abstract method created in extension's buildExtractors impl.
*/
getSuccess: Ext.emptyFn,
/**
* Abstract method created in extension's buildExtractors impl.
*/
getId: Ext.emptyFn,
/**
* Abstract method, overridden in DataReader extensions such as {@link Ext.data.JsonReader} and {@link Ext.data.XmlReader}
*/
buildExtractors : Ext.emptyFn,
/**
* Abstract method overridden in DataReader extensions such as {@link Ext.data.JsonReader} and {@link Ext.data.XmlReader}
*/
extractValues : Ext.emptyFn,
/**
* Used for un-phantoming a record after a successful database insert. Sets the records pk along with new data from server.
* You <b>must</b> return at least the database pk using the idProperty defined in your DataReader configuration. The incoming
* data from server will be merged with the data in the local record.
* In addition, you <b>must</b> return record-data from the server in the same order received.
* Will perform a commit as well, un-marking dirty-fields. Store's "update" event will be suppressed.
* @param {Record/Record[]} record The phantom record to be realized.
* @param {Object/Object[]} data The new record data to apply. Must include the primary-key from database defined in idProperty field.
*/
realize: function(rs, data){
if (Ext.isArray(rs)) {
for (var i = rs.length - 1; i >= 0; i--) {
// recurse
if (Ext.isArray(data)) {
this.realize(rs.splice(i,1).shift(), data.splice(i,1).shift());
}
else {
// weird...rs is an array but data isn't?? recurse but just send in the whole invalid data object.
// the else clause below will detect !this.isData and throw exception.
this.realize(rs.splice(i,1).shift(), data);
}
}
}
else {
// If rs is NOT an array but data IS, see if data contains just 1 record. If so extract it and carry on.
if (Ext.isArray(data) && data.length == 1) {
data = data.shift();
}
if (!this.isData(data)) {
// TODO: Let exception-handler choose to commit or not rather than blindly rs.commit() here.
//rs.commit();
throw new Ext.data.DataReader.Error('realize', rs);
}
rs.phantom = false; // <-- That's what it's all about
rs._phid = rs.id; // <-- copy phantom-id -> _phid, so we can remap in Store#onCreateRecords
rs.id = this.getId(data);
rs.data = data;
rs.commit();
}
},
/**
* Used for updating a non-phantom or "real" record's data with fresh data from server after remote-save.
* If returning data from multiple-records after a batch-update, you <b>must</b> return record-data from the server in
* the same order received. Will perform a commit as well, un-marking dirty-fields. Store's "update" event will be
* suppressed as the record receives fresh new data-hash
* @param {Record/Record[]} rs
* @param {Object/Object[]} data
*/
update : function(rs, data) {
if (Ext.isArray(rs)) {
for (var i=rs.length-1; i >= 0; i--) {
if (Ext.isArray(data)) {
this.update(rs.splice(i,1).shift(), data.splice(i,1).shift());
}
else {
// weird...rs is an array but data isn't?? recurse but just send in the whole data object.
// the else clause below will detect !this.isData and throw exception.
this.update(rs.splice(i,1).shift(), data);
}
}
}
else {
// If rs is NOT an array but data IS, see if data contains just 1 record. If so extract it and carry on.
if (Ext.isArray(data) && data.length == 1) {
data = data.shift();
}
if (this.isData(data)) {
rs.data = Ext.apply(rs.data, data);
}
rs.commit();
}
},
/**
* returns extracted, type-cast rows of data. Iterates to call #extractValues for each row
* @param {Object[]/Object} data-root from server response
* @param {Boolean} returnRecords [false] Set true to return instances of Ext.data.Record
* @private
*/
extractData : function(root, returnRecords) {
// A bit ugly this, too bad the Record's raw data couldn't be saved in a common property named "raw" or something.
var rawName = (this instanceof Ext.data.JsonReader) ? 'json' : 'node';
var rs = [];
// Had to add Check for XmlReader, #isData returns true if root is an Xml-object. Want to check in order to re-factor
// #extractData into DataReader base, since the implementations are almost identical for JsonReader, XmlReader
if (this.isData(root) && !(this instanceof Ext.data.XmlReader)) {
root = [root];
}
var f = this.recordType.prototype.fields,
fi = f.items,
fl = f.length,
rs = [];
if (returnRecords === true) {
var Record = this.recordType;
for (var i = 0; i < root.length; i++) {
var n = root[i];
var record = new Record(this.extractValues(n, fi, fl), this.getId(n));
record[rawName] = n; // <-- There's implementation of ugly bit, setting the raw record-data.
rs.push(record);
}
}
else {
for (var i = 0; i < root.length; i++) {
var data = this.extractValues(root[i], fi, fl);
data[this.meta.idProperty] = this.getId(root[i]);
rs.push(data);
}
}
return rs;
},
/**
* Returns true if the supplied data-hash <b>looks</b> and quacks like data. Checks to see if it has a key
* corresponding to idProperty defined in your DataReader config containing non-empty pk.
* @param {Object} data
* @return {Boolean}
*/
isData : function(data) {
return (data && Ext.isObject(data) && !Ext.isEmpty(this.getId(data))) ? true : false;
},
// private function a store will createSequence upon
onMetaChange : function(meta){
delete this.ef;
this.meta = meta;
this.recordType = Ext.data.Record.create(meta.fields);
this.buildExtractors();
}
};
/**
* @class Ext.data.DataReader.Error
* @extends Ext.Error
* General error class for Ext.data.DataReader
*/
Ext.data.DataReader.Error = Ext.extend(Ext.Error, {
constructor : function(message, arg) {
this.arg = arg;
Ext.Error.call(this, message);
},
name: 'Ext.data.DataReader'
});
Ext.apply(Ext.data.DataReader.Error.prototype, {
lang : {
'update': "#update received invalid data from server. Please see docs for DataReader#update and review your DataReader configuration.",
'realize': "#realize was called with invalid remote-data. Please see the docs for DataReader#realize and review your DataReader configuration.",
'invalid-response': "#readResponse received an invalid response from the server."
}
});

View File

@@ -1,210 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.DataWriter
* <p>Ext.data.DataWriter facilitates create, update, and destroy actions between
* an Ext.data.Store and a server-side framework. A Writer enabled Store will
* automatically manage the Ajax requests to perform CRUD actions on a Store.</p>
* <p>Ext.data.DataWriter is an abstract base class which is intended to be extended
* and should not be created directly. For existing implementations, see
* {@link Ext.data.JsonWriter}.</p>
* <p>Creating a writer is simple:</p>
* <pre><code>
var writer = new Ext.data.JsonWriter({
encode: false // &lt;--- false causes data to be printed to jsonData config-property of Ext.Ajax#reqeust
});
* </code></pre>
* * <p>Same old JsonReader as Ext-2.x:</p>
* <pre><code>
var reader = new Ext.data.JsonReader({idProperty: 'id'}, [{name: 'first'}, {name: 'last'}, {name: 'email'}]);
* </code></pre>
*
* <p>The proxy for a writer enabled store can be configured with a simple <code>url</code>:</p>
* <pre><code>
// Create a standard HttpProxy instance.
var proxy = new Ext.data.HttpProxy({
url: 'app.php/users' // &lt;--- Supports "provides"-type urls, such as '/users.json', '/products.xml' (Hello Rails/Merb)
});
* </code></pre>
* <p>For finer grained control, the proxy may also be configured with an <code>API</code>:</p>
* <pre><code>
// Maximum flexibility with the API-configuration
var proxy = new Ext.data.HttpProxy({
api: {
read : 'app.php/users/read',
create : 'app.php/users/create',
update : 'app.php/users/update',
destroy : { // &lt;--- Supports object-syntax as well
url: 'app.php/users/destroy',
method: "DELETE"
}
}
});
* </code></pre>
* <p>Pulling it all together into a Writer-enabled Store:</p>
* <pre><code>
var store = new Ext.data.Store({
proxy: proxy,
reader: reader,
writer: writer,
autoLoad: true,
autoSave: true // -- Cell-level updates.
});
* </code></pre>
* <p>Initiating write-actions <b>automatically</b>, using the existing Ext2.0 Store/Record API:</p>
* <pre><code>
var rec = store.getAt(0);
rec.set('email', 'foo@bar.com'); // &lt;--- Immediately initiates an UPDATE action through configured proxy.
store.remove(rec); // &lt;---- Immediately initiates a DESTROY action through configured proxy.
* </code></pre>
* <p>For <b>record/batch</b> updates, use the Store-configuration {@link Ext.data.Store#autoSave autoSave:false}</p>
* <pre><code>
var store = new Ext.data.Store({
proxy: proxy,
reader: reader,
writer: writer,
autoLoad: true,
autoSave: false // -- disable cell-updates
});
var urec = store.getAt(0);
urec.set('email', 'foo@bar.com');
var drec = store.getAt(1);
store.remove(drec);
// Push the button!
store.save();
* </code></pre>
* @constructor Create a new DataWriter
* @param {Object} meta Metadata configuration options (implementation-specific)
* @param {Object} recordType Either an Array of field definition objects as specified
* in {@link Ext.data.Record#create}, or an {@link Ext.data.Record} object created
* using {@link Ext.data.Record#create}.
*/
Ext.data.DataWriter = function(config){
Ext.apply(this, config);
};
Ext.data.DataWriter.prototype = {
/**
* @cfg {Boolean} writeAllFields
* <tt>false</tt> by default. Set <tt>true</tt> to have DataWriter return ALL fields of a modified
* record -- not just those that changed.
* <tt>false</tt> to have DataWriter only request modified fields from a record.
*/
writeAllFields : false,
/**
* @cfg {Boolean} listful
* <tt>false</tt> by default. Set <tt>true</tt> to have the DataWriter <b>always</b> write HTTP params as a list,
* even when acting upon a single record.
*/
listful : false, // <-- listful is actually not used internally here in DataWriter. @see Ext.data.Store#execute.
/**
* Compiles a Store recordset into a data-format defined by an extension such as {@link Ext.data.JsonWriter} or {@link Ext.data.XmlWriter} in preparation for a {@link Ext.data.Api#actions server-write action}. The first two params are similar similar in nature to {@link Ext#apply},
* Where the first parameter is the <i>receiver</i> of paramaters and the second, baseParams, <i>the source</i>.
* @param {Object} params The request-params receiver.
* @param {Object} baseParams as defined by {@link Ext.data.Store#baseParams}. The baseParms must be encoded by the extending class, eg: {@link Ext.data.JsonWriter}, {@link Ext.data.XmlWriter}.
* @param {String} action [{@link Ext.data.Api#actions create|update|destroy}]
* @param {Record/Record[]} rs The recordset to write, the subject(s) of the write action.
*/
apply : function(params, baseParams, action, rs) {
var data = [],
renderer = action + 'Record';
// TODO implement @cfg listful here
if (Ext.isArray(rs)) {
Ext.each(rs, function(rec){
data.push(this[renderer](rec));
}, this);
}
else if (rs instanceof Ext.data.Record) {
data = this[renderer](rs);
}
this.render(params, baseParams, data);
},
/**
* abstract method meant to be overridden by all DataWriter extensions. It's the extension's job to apply the "data" to the "params".
* The data-object provided to render is populated with data according to the meta-info defined in the user's DataReader config,
* @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
* @param {Record[]} rs Store recordset
* @param {Object} params Http params to be sent to server.
* @param {Object} data object populated according to DataReader meta-data.
*/
render : Ext.emptyFn,
/**
* @cfg {Function} updateRecord Abstract method that should be implemented in all subclasses
* (e.g.: {@link Ext.data.JsonWriter#updateRecord JsonWriter.updateRecord}
*/
updateRecord : Ext.emptyFn,
/**
* @cfg {Function} createRecord Abstract method that should be implemented in all subclasses
* (e.g.: {@link Ext.data.JsonWriter#createRecord JsonWriter.createRecord})
*/
createRecord : Ext.emptyFn,
/**
* @cfg {Function} destroyRecord Abstract method that should be implemented in all subclasses
* (e.g.: {@link Ext.data.JsonWriter#destroyRecord JsonWriter.destroyRecord})
*/
destroyRecord : Ext.emptyFn,
/**
* Converts a Record to a hash, taking into account the state of the Ext.data.Record along with configuration properties
* related to its rendering, such as {@link #writeAllFields}, {@link Ext.data.Record#phantom phantom}, {@link Ext.data.Record#getChanges getChanges} and
* {@link Ext.data.DataReader#idProperty idProperty}
* @param {Ext.data.Record} rec The Record from which to create a hash.
* @param {Object} config <b>NOT YET IMPLEMENTED</b>. Will implement an exlude/only configuration for fine-control over which fields do/don't get rendered.
* @return {Object}
* @protected
* TODO Implement excludes/only configuration with 2nd param?
*/
toHash : function(rec, config) {
var map = rec.fields.map,
data = {},
raw = (this.writeAllFields === false && rec.phantom === false) ? rec.getChanges() : rec.data,
m;
Ext.iterate(raw, function(prop, value){
if((m = map[prop])){
data[m.mapping ? m.mapping : m.name] = value;
}
});
// we don't want to write Ext auto-generated id to hash. Careful not to remove it on Models not having auto-increment pk though.
// We can tell its not auto-increment if the user defined a DataReader field for it *and* that field's value is non-empty.
// we could also do a RegExp here for the Ext.data.Record AUTO_ID prefix.
if (rec.phantom) {
if (rec.fields.containsKey(this.meta.idProperty) && Ext.isEmpty(rec.data[this.meta.idProperty])) {
delete data[this.meta.idProperty];
}
} else {
data[this.meta.idProperty] = rec.id;
}
return data;
},
/**
* Converts a {@link Ext.data.DataWriter#toHash Hashed} {@link Ext.data.Record} to fields-array array suitable
* for encoding to xml via XTemplate, eg:
<code><pre>&lt;tpl for=".">&lt;{name}>{value}&lt;/{name}&lt;/tpl></pre></code>
* eg, <b>non-phantom</b>:
<code><pre>{id: 1, first: 'foo', last: 'bar'} --> [{name: 'id', value: 1}, {name: 'first', value: 'foo'}, {name: 'last', value: 'bar'}]</pre></code>
* {@link Ext.data.Record#phantom Phantom} records will have had their idProperty omitted in {@link #toHash} if determined to be auto-generated.
* Non AUTOINCREMENT pks should have been protected.
* @param {Hash} data Hashed by Ext.data.DataWriter#toHash
* @return {[Object]} Array of attribute-objects.
* @protected
*/
toArray : function(data) {
var fields = [];
Ext.iterate(data, function(k, v) {fields.push({name: k, value: v});},this);
return fields;
}
};

View File

@@ -1,173 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.DirectProxy
* @extends Ext.data.DataProxy
*/
Ext.data.DirectProxy = function(config){
Ext.apply(this, config);
if(typeof this.paramOrder == 'string'){
this.paramOrder = this.paramOrder.split(/[\s,|]/);
}
Ext.data.DirectProxy.superclass.constructor.call(this, config);
};
Ext.extend(Ext.data.DirectProxy, Ext.data.DataProxy, {
/**
* @cfg {Array/String} paramOrder Defaults to <tt>undefined</tt>. A list of params to be executed
* server side. Specify the params in the order in which they must be executed on the server-side
* as either (1) an Array of String values, or (2) a String of params delimited by either whitespace,
* comma, or pipe. For example,
* any of the following would be acceptable:<pre><code>
paramOrder: ['param1','param2','param3']
paramOrder: 'param1 param2 param3'
paramOrder: 'param1,param2,param3'
paramOrder: 'param1|param2|param'
</code></pre>
*/
paramOrder: undefined,
/**
* @cfg {Boolean} paramsAsHash
* Send parameters as a collection of named arguments (defaults to <tt>true</tt>). Providing a
* <tt>{@link #paramOrder}</tt> nullifies this configuration.
*/
paramsAsHash: true,
/**
* @cfg {Function} directFn
* Function to call when executing a request. directFn is a simple alternative to defining the api configuration-parameter
* for Store's which will not implement a full CRUD api.
*/
directFn : undefined,
/**
* DirectProxy implementation of {@link Ext.data.DataProxy#doRequest}
* @param {String} action The crud action type (create, read, update, destroy)
* @param {Ext.data.Record/Ext.data.Record[]} rs If action is load, rs will be null
* @param {Object} params An object containing properties which are to be used as HTTP parameters
* for the request to the remote server.
* @param {Ext.data.DataReader} reader The Reader object which converts the data
* object into a block of Ext.data.Records.
* @param {Function} callback
* <div class="sub-desc"><p>A function to be called after the request.
* The <tt>callback</tt> is passed the following arguments:<ul>
* <li><tt>r</tt> : Ext.data.Record[] The block of Ext.data.Records.</li>
* <li><tt>options</tt>: Options object from the action request</li>
* <li><tt>success</tt>: Boolean success indicator</li></ul></p></div>
* @param {Object} scope The scope (<code>this</code> reference) in which the callback function is executed. Defaults to the browser window.
* @param {Object} arg An optional argument which is passed to the callback as its second parameter.
* @protected
*/
doRequest : function(action, rs, params, reader, callback, scope, options) {
var args = [],
directFn = this.api[action] || this.directFn;
switch (action) {
case Ext.data.Api.actions.create:
args.push(params.jsonData); // <-- create(Hash)
break;
case Ext.data.Api.actions.read:
// If the method has no parameters, ignore the paramOrder/paramsAsHash.
if(directFn.directCfg.method.len > 0){
if(this.paramOrder){
for(var i = 0, len = this.paramOrder.length; i < len; i++){
args.push(params[this.paramOrder[i]]);
}
}else if(this.paramsAsHash){
args.push(params);
}
}
break;
case Ext.data.Api.actions.update:
args.push(params.jsonData); // <-- update(Hash/Hash[])
break;
case Ext.data.Api.actions.destroy:
args.push(params.jsonData); // <-- destroy(Int/Int[])
break;
}
var trans = {
params : params || {},
request: {
callback : callback,
scope : scope,
arg : options
},
reader: reader
};
args.push(this.createCallback(action, rs, trans), this);
directFn.apply(window, args);
},
// private
createCallback : function(action, rs, trans) {
var me = this;
return function(result, res) {
if (!res.status) {
// @deprecated fire loadexception
if (action === Ext.data.Api.actions.read) {
me.fireEvent("loadexception", me, trans, res, null);
}
me.fireEvent('exception', me, 'remote', action, trans, res, null);
trans.request.callback.call(trans.request.scope, null, trans.request.arg, false);
return;
}
if (action === Ext.data.Api.actions.read) {
me.onRead(action, trans, result, res);
} else {
me.onWrite(action, trans, result, res, rs);
}
};
},
/**
* Callback for read actions
* @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
* @param {Object} trans The request transaction object
* @param {Object} result Data object picked out of the server-response.
* @param {Object} res The server response
* @protected
*/
onRead : function(action, trans, result, res) {
var records;
try {
records = trans.reader.readRecords(result);
}
catch (ex) {
// @deprecated: Fire old loadexception for backwards-compat.
this.fireEvent("loadexception", this, trans, res, ex);
this.fireEvent('exception', this, 'response', action, trans, res, ex);
trans.request.callback.call(trans.request.scope, null, trans.request.arg, false);
return;
}
this.fireEvent("load", this, res, trans.request.arg);
trans.request.callback.call(trans.request.scope, records, trans.request.arg, true);
},
/**
* Callback for write actions
* @param {String} action [{@link Ext.data.Api#actions create|read|update|destroy}]
* @param {Object} trans The request transaction object
* @param {Object} result Data object picked out of the server-response.
* @param {Object} res The server response
* @param {Ext.data.Record/[Ext.data.Record]} rs The Store resultset associated with the action.
* @protected
*/
onWrite : function(action, trans, result, res, rs) {
var data = trans.reader.extractData(trans.reader.getRoot(result), false);
var success = trans.reader.getSuccess(result);
success = (success !== false);
if (success){
this.fireEvent("write", this, action, data, res, rs, trans.request.arg);
}else{
this.fireEvent('exception', this, 'remote', action, trans, result, rs);
}
trans.request.callback.call(trans.request.scope, data, res, success);
}
});

View File

@@ -1,54 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.DirectStore
* @extends Ext.data.Store
* <p>Small helper class to create an {@link Ext.data.Store} configured with an
* {@link Ext.data.DirectProxy} and {@link Ext.data.JsonReader} to make interacting
* with an {@link Ext.Direct} Server-side {@link Ext.direct.Provider Provider} easier.
* To create a different proxy/reader combination create a basic {@link Ext.data.Store}
* configured as needed.</p>
*
* <p><b>*Note:</b> Although they are not listed, this class inherits all of the config options of:</p>
* <div><ul class="mdetail-params">
* <li><b>{@link Ext.data.Store Store}</b></li>
* <div class="sub-desc"><ul class="mdetail-params">
*
* </ul></div>
* <li><b>{@link Ext.data.JsonReader JsonReader}</b></li>
* <div class="sub-desc"><ul class="mdetail-params">
* <li><tt><b>{@link Ext.data.JsonReader#root root}</b></tt></li>
* <li><tt><b>{@link Ext.data.JsonReader#idProperty idProperty}</b></tt></li>
* <li><tt><b>{@link Ext.data.JsonReader#totalProperty totalProperty}</b></tt></li>
* </ul></div>
*
* <li><b>{@link Ext.data.DirectProxy DirectProxy}</b></li>
* <div class="sub-desc"><ul class="mdetail-params">
* <li><tt><b>{@link Ext.data.DirectProxy#directFn directFn}</b></tt></li>
* <li><tt><b>{@link Ext.data.DirectProxy#paramOrder paramOrder}</b></tt></li>
* <li><tt><b>{@link Ext.data.DirectProxy#paramsAsHash paramsAsHash}</b></tt></li>
* </ul></div>
* </ul></div>
*
* @xtype directstore
*
* @constructor
* @param {Object} config
*/
Ext.data.DirectStore = Ext.extend(Ext.data.Store, {
constructor : function(config){
// each transaction upon a singe record will generate a distinct Direct transaction since Direct queues them into one Ajax request.
var c = Ext.apply({}, {
batchTransactions: false
}, config);
Ext.data.DirectStore.superclass.constructor.call(this, Ext.apply(c, {
proxy: Ext.isDefined(c.proxy) ? c.proxy : new Ext.data.DirectProxy(Ext.copyTo({}, c, 'paramOrder,paramsAsHash,directFn,api')),
reader: (!Ext.isDefined(c.reader) && c.fields) ? new Ext.data.JsonReader(Ext.copyTo({}, c, 'totalProperty,root,idProperty'), c.fields) : c.reader
}));
}
});
Ext.reg('directstore', Ext.data.DirectStore);

View File

@@ -1,263 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.GroupingStore
* @extends Ext.data.Store
* A specialized store implementation that provides for grouping records by one of the available fields. This
* is usually used in conjunction with an {@link Ext.grid.GroupingView} to provide the data model for
* a grouped GridPanel.
*
* Internally, GroupingStore is simply a normal Store with multi sorting enabled from the start. The grouping field
* and direction are always injected as the first sorter pair. GroupingView picks up on the configured groupField and
* builds grid rows appropriately.
*
* @constructor
* Creates a new GroupingStore.
* @param {Object} config A config object containing the objects needed for the Store to access data,
* and read the data into Records.
* @xtype groupingstore
*/
Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
//inherit docs
constructor: function(config) {
config = config || {};
//We do some preprocessing here to massage the grouping + sorting options into a single
//multi sort array. If grouping and sorting options are both presented to the constructor,
//the sorters array consists of the grouping sorter object followed by the sorting sorter object
//see Ext.data.Store's sorting functions for details about how multi sorting works
this.hasMultiSort = true;
this.multiSortInfo = this.multiSortInfo || {sorters: []};
var sorters = this.multiSortInfo.sorters,
groupField = config.groupField || this.groupField,
sortInfo = config.sortInfo || this.sortInfo,
groupDir = config.groupDir || this.groupDir;
//add the grouping sorter object first
if(groupField){
sorters.push({
field : groupField,
direction: groupDir
});
}
//add the sorting sorter object if it is present
if (sortInfo) {
sorters.push(sortInfo);
}
Ext.data.GroupingStore.superclass.constructor.call(this, config);
this.addEvents(
/**
* @event groupchange
* Fired whenever a call to store.groupBy successfully changes the grouping on the store
* @param {Ext.data.GroupingStore} store The grouping store
* @param {String} groupField The field that the store is now grouped by
*/
'groupchange'
);
this.applyGroupField();
},
/**
* @cfg {String} groupField
* The field name by which to sort the store's data (defaults to '').
*/
/**
* @cfg {Boolean} remoteGroup
* True if the grouping should apply on the server side, false if it is local only (defaults to false). If the
* grouping is local, it can be applied immediately to the data. If it is remote, then it will simply act as a
* helper, automatically sending the grouping field name as the 'groupBy' param with each XHR call.
*/
remoteGroup : false,
/**
* @cfg {Boolean} groupOnSort
* True to sort the data on the grouping field when a grouping operation occurs, false to sort based on the
* existing sort info (defaults to false).
*/
groupOnSort:false,
/**
* @cfg {String} groupDir
* The direction to sort the groups. Defaults to <tt>'ASC'</tt>.
*/
groupDir : 'ASC',
/**
* Clears any existing grouping and refreshes the data using the default sort.
*/
clearGrouping : function(){
this.groupField = false;
if(this.remoteGroup){
if(this.baseParams){
delete this.baseParams.groupBy;
delete this.baseParams.groupDir;
}
var lo = this.lastOptions;
if(lo && lo.params){
delete lo.params.groupBy;
delete lo.params.groupDir;
}
this.reload();
}else{
this.sort();
this.fireEvent('datachanged', this);
}
},
/**
* Groups the data by the specified field.
* @param {String} field The field name by which to sort the store's data
* @param {Boolean} forceRegroup (optional) True to force the group to be refreshed even if the field passed
* in is the same as the current grouping field, false to skip grouping on the same field (defaults to false)
*/
groupBy : function(field, forceRegroup, direction) {
direction = direction ? (String(direction).toUpperCase() == 'DESC' ? 'DESC' : 'ASC') : this.groupDir;
if (this.groupField == field && this.groupDir == direction && !forceRegroup) {
return; // already grouped by this field
}
//check the contents of the first sorter. If the field matches the CURRENT groupField (before it is set to the new one),
//remove the sorter as it is actually the grouper. The new grouper is added back in by this.sort
var sorters = this.multiSortInfo.sorters;
if (sorters.length > 0 && sorters[0].field == this.groupField) {
sorters.shift();
}
this.groupField = field;
this.groupDir = direction;
this.applyGroupField();
var fireGroupEvent = function() {
this.fireEvent('groupchange', this, this.getGroupState());
};
if (this.groupOnSort) {
this.sort(field, direction);
fireGroupEvent.call(this);
return;
}
if (this.remoteGroup) {
this.on('load', fireGroupEvent, this, {single: true});
this.reload();
} else {
this.sort(sorters);
fireGroupEvent.call(this);
}
},
//GroupingStore always uses multisorting so we intercept calls to sort here to make sure that our grouping sorter object
//is always injected first.
sort : function(fieldName, dir) {
if (this.remoteSort) {
return Ext.data.GroupingStore.superclass.sort.call(this, fieldName, dir);
}
var sorters = [];
//cater for any existing valid arguments to this.sort, massage them into an array of sorter objects
if (Ext.isArray(arguments[0])) {
sorters = arguments[0];
} else if (fieldName == undefined) {
//we preserve the existing sortInfo here because this.sort is called after
//clearGrouping and there may be existing sorting
sorters = this.sortInfo ? [this.sortInfo] : [];
} else {
//TODO: this is lifted straight from Ext.data.Store's singleSort function. It should instead be
//refactored into a common method if possible
var field = this.fields.get(fieldName);
if (!field) return false;
var name = field.name,
sortInfo = this.sortInfo || null,
sortToggle = this.sortToggle ? this.sortToggle[name] : null;
if (!dir) {
if (sortInfo && sortInfo.field == name) { // toggle sort dir
dir = (this.sortToggle[name] || 'ASC').toggle('ASC', 'DESC');
} else {
dir = field.sortDir;
}
}
this.sortToggle[name] = dir;
this.sortInfo = {field: name, direction: dir};
sorters = [this.sortInfo];
}
//add the grouping sorter object as the first multisort sorter
if (this.groupField) {
sorters.unshift({direction: this.groupDir, field: this.groupField});
}
return this.multiSort.call(this, sorters, dir);
},
/**
* @private
* Saves the current grouping field and direction to this.baseParams and this.lastOptions.params
* if we're using remote grouping. Does not actually perform any grouping - just stores values
*/
applyGroupField: function(){
if (this.remoteGroup) {
if(!this.baseParams){
this.baseParams = {};
}
Ext.apply(this.baseParams, {
groupBy : this.groupField,
groupDir: this.groupDir
});
var lo = this.lastOptions;
if (lo && lo.params) {
lo.params.groupDir = this.groupDir;
//this is deleted because of a bug reported at http://www.extjs.com/forum/showthread.php?t=82907
delete lo.params.groupBy;
}
}
},
/**
* @private
* TODO: This function is apparently never invoked anywhere in the framework. It has no documentation
* and should be considered for deletion
*/
applyGrouping : function(alwaysFireChange){
if(this.groupField !== false){
this.groupBy(this.groupField, true, this.groupDir);
return true;
}else{
if(alwaysFireChange === true){
this.fireEvent('datachanged', this);
}
return false;
}
},
/**
* @private
* Returns the grouping field that should be used. If groupOnSort is used this will be sortInfo's field,
* otherwise it will be this.groupField
* @return {String} The group field
*/
getGroupState : function(){
return this.groupOnSort && this.groupField !== false ?
(this.sortInfo ? this.sortInfo.field : undefined) : this.groupField;
}
});
Ext.reg('groupingstore', Ext.data.GroupingStore);

View File

@@ -1,261 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.HttpProxy
* @extends Ext.data.DataProxy
* <p>An implementation of {@link Ext.data.DataProxy} that processes data requests within the same
* domain of the originating page.</p>
* <p><b>Note</b>: this class cannot be used to retrieve data from a domain other
* than the domain from which the running page was served. For cross-domain requests, use a
* {@link Ext.data.ScriptTagProxy ScriptTagProxy}.</p>
* <p>Be aware that to enable the browser to parse an XML document, the server must set
* the Content-Type header in the HTTP response to "<tt>text/xml</tt>".</p>
* @constructor
* @param {Object} conn
* An {@link Ext.data.Connection} object, or options parameter to {@link Ext.Ajax#request}.
* <p>Note that if this HttpProxy is being used by a {@link Ext.data.Store Store}, then the
* Store's call to {@link #load} will override any specified <tt>callback</tt> and <tt>params</tt>
* options. In this case, use the Store's {@link Ext.data.Store#events events} to modify parameters,
* or react to loading events. The Store's {@link Ext.data.Store#baseParams baseParams} may also be
* used to pass parameters known at instantiation time.</p>
* <p>If an options parameter is passed, the singleton {@link Ext.Ajax} object will be used to make
* the request.</p>
*/
Ext.data.HttpProxy = function(conn){
Ext.data.HttpProxy.superclass.constructor.call(this, conn);
/**
* The Connection object (Or options parameter to {@link Ext.Ajax#request}) which this HttpProxy
* uses to make requests to the server. Properties of this object may be changed dynamically to
* change the way data is requested.
* @property
*/
this.conn = conn;
// nullify the connection url. The url param has been copied to 'this' above. The connection
// url will be set during each execution of doRequest when buildUrl is called. This makes it easier for users to override the
// connection url during beforeaction events (ie: beforeload, beforewrite, etc).
// Url is always re-defined during doRequest.
this.conn.url = null;
this.useAjax = !conn || !conn.events;
// A hash containing active requests, keyed on action [Ext.data.Api.actions.create|read|update|destroy]
var actions = Ext.data.Api.actions;
this.activeRequest = {};
for (var verb in actions) {
this.activeRequest[actions[verb]] = undefined;
}
};
Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, {
/**
* Return the {@link Ext.data.Connection} object being used by this Proxy.
* @return {Connection} The Connection object. This object may be used to subscribe to events on
* a finer-grained basis than the DataProxy events.
*/
getConnection : function() {
return this.useAjax ? Ext.Ajax : this.conn;
},
/**
* Used for overriding the url used for a single request. Designed to be called during a beforeaction event. Calling setUrl
* will override any urls set via the api configuration parameter. Set the optional parameter makePermanent to set the url for
* all subsequent requests. If not set to makePermanent, the next request will use the same url or api configuration defined
* in the initial proxy configuration.
* @param {String} url
* @param {Boolean} makePermanent (Optional) [false]
*
* (e.g.: beforeload, beforesave, etc).
*/
setUrl : function(url, makePermanent) {
this.conn.url = url;
if (makePermanent === true) {
this.url = url;
this.api = null;
Ext.data.Api.prepare(this);
}
},
/**
* HttpProxy implementation of DataProxy#doRequest
* @param {String} action The crud action type (create, read, update, destroy)
* @param {Ext.data.Record/Ext.data.Record[]} rs If action is load, rs will be null
* @param {Object} params An object containing properties which are to be used as HTTP parameters
* for the request to the remote server.
* @param {Ext.data.DataReader} reader The Reader object which converts the data
* object into a block of Ext.data.Records.
* @param {Function} callback
* <div class="sub-desc"><p>A function to be called after the request.
* The <tt>callback</tt> is passed the following arguments:<ul>
* <li><tt>r</tt> : Ext.data.Record[] The block of Ext.data.Records.</li>
* <li><tt>options</tt>: Options object from the action request</li>
* <li><tt>success</tt>: Boolean success indicator</li></ul></p></div>
* @param {Object} scope The scope (<code>this</code> reference) in which the callback function is executed. Defaults to the browser window.
* @param {Object} arg An optional argument which is passed to the callback as its second parameter.
* @protected
*/
doRequest : function(action, rs, params, reader, cb, scope, arg) {
var o = {
method: (this.api[action]) ? this.api[action]['method'] : undefined,
request: {
callback : cb,
scope : scope,
arg : arg
},
reader: reader,
callback : this.createCallback(action, rs),
scope: this
};
// If possible, transmit data using jsonData || xmlData on Ext.Ajax.request (An installed DataWriter would have written it there.).
// Use std HTTP params otherwise.
if (params.jsonData) {
o.jsonData = params.jsonData;
} else if (params.xmlData) {
o.xmlData = params.xmlData;
} else {
o.params = params || {};
}
// Set the connection url. If this.conn.url is not null here,
// the user must have overridden the url during a beforewrite/beforeload event-handler.
// this.conn.url is nullified after each request.
this.conn.url = this.buildUrl(action, rs);
if(this.useAjax){
Ext.applyIf(o, this.conn);
// If a currently running request is found for this action, abort it.
if (this.activeRequest[action]) {
////
// Disabled aborting activeRequest while implementing REST. activeRequest[action] will have to become an array
// TODO ideas anyone?
//
//Ext.Ajax.abort(this.activeRequest[action]);
}
this.activeRequest[action] = Ext.Ajax.request(o);
}else{
this.conn.request(o);
}
// request is sent, nullify the connection url in preparation for the next request
this.conn.url = null;
},
/**
* Returns a callback function for a request. Note a special case is made for the
* read action vs all the others.
* @param {String} action [create|update|delete|load]
* @param {Ext.data.Record[]} rs The Store-recordset being acted upon
* @private
*/
createCallback : function(action, rs) {
return function(o, success, response) {
this.activeRequest[action] = undefined;
if (!success) {
if (action === Ext.data.Api.actions.read) {
// @deprecated: fire loadexception for backwards compat.
// TODO remove
this.fireEvent('loadexception', this, o, response);
}
this.fireEvent('exception', this, 'response', action, o, response);
o.request.callback.call(o.request.scope, null, o.request.arg, false);
return;
}
if (action === Ext.data.Api.actions.read) {
this.onRead(action, o, response);
} else {
this.onWrite(action, o, response, rs);
}
};
},
/**
* Callback for read action
* @param {String} action Action name as per {@link Ext.data.Api.actions#read}.
* @param {Object} o The request transaction object
* @param {Object} res The server response
* @fires loadexception (deprecated)
* @fires exception
* @fires load
* @protected
*/
onRead : function(action, o, response) {
var result;
try {
result = o.reader.read(response);
}catch(e){
// @deprecated: fire old loadexception for backwards-compat.
// TODO remove
this.fireEvent('loadexception', this, o, response, e);
this.fireEvent('exception', this, 'response', action, o, response, e);
o.request.callback.call(o.request.scope, null, o.request.arg, false);
return;
}
if (result.success === false) {
// @deprecated: fire old loadexception for backwards-compat.
// TODO remove
this.fireEvent('loadexception', this, o, response);
// Get DataReader read-back a response-object to pass along to exception event
var res = o.reader.readResponse(action, response);
this.fireEvent('exception', this, 'remote', action, o, res, null);
}
else {
this.fireEvent('load', this, o, o.request.arg);
}
// TODO refactor onRead, onWrite to be more generalized now that we're dealing with Ext.data.Response instance
// the calls to request.callback(...) in each will have to be made identical.
// NOTE reader.readResponse does not currently return Ext.data.Response
o.request.callback.call(o.request.scope, result, o.request.arg, result.success);
},
/**
* Callback for write actions
* @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
* @param {Object} trans The request transaction object
* @param {Object} res The server response
* @fires exception
* @fires write
* @protected
*/
onWrite : function(action, o, response, rs) {
var reader = o.reader;
var res;
try {
res = reader.readResponse(action, response);
} catch (e) {
this.fireEvent('exception', this, 'response', action, o, response, e);
o.request.callback.call(o.request.scope, null, o.request.arg, false);
return;
}
if (res.success === true) {
this.fireEvent('write', this, action, res.data, res, rs, o.request.arg);
} else {
this.fireEvent('exception', this, 'remote', action, o, res, rs);
}
// TODO refactor onRead, onWrite to be more generalized now that we're dealing with Ext.data.Response instance
// the calls to request.callback(...) in each will have to be made similar.
// NOTE reader.readResponse does not currently return Ext.data.Response
o.request.callback.call(o.request.scope, res.data, res, res.success);
},
// inherit docs
destroy: function(){
if(!this.useAjax){
this.conn.abort();
}else if(this.activeRequest){
var actions = Ext.data.Api.actions;
for (var verb in actions) {
if(this.activeRequest[actions[verb]]){
Ext.Ajax.abort(this.activeRequest[actions[verb]]);
}
}
}
Ext.data.HttpProxy.superclass.destroy.call(this);
}
});

View File

@@ -1,358 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.JsonReader
* @extends Ext.data.DataReader
* <p>Data reader class to create an Array of {@link Ext.data.Record} objects
* from a JSON packet based on mappings in a provided {@link Ext.data.Record}
* constructor.</p>
* <p>Example code:</p>
* <pre><code>
var myReader = new Ext.data.JsonReader({
// metadata configuration options:
{@link #idProperty}: 'id'
{@link #root}: 'rows',
{@link #totalProperty}: 'results',
{@link Ext.data.DataReader#messageProperty}: "msg" // The element within the response that provides a user-feedback message (optional)
// the fields config option will internally create an {@link Ext.data.Record}
// constructor that provides mapping for reading the record data objects
{@link Ext.data.DataReader#fields fields}: [
// map Record&#39;s 'firstname' field to data object&#39;s key of same name
{name: 'name', mapping: 'firstname'},
// map Record&#39;s 'job' field to data object&#39;s 'occupation' key
{name: 'job', mapping: 'occupation'}
]
});
</code></pre>
* <p>This would consume a JSON data object of the form:</p><pre><code>
{
results: 2000, // Reader&#39;s configured {@link #totalProperty}
rows: [ // Reader&#39;s configured {@link #root}
// record data objects:
{ {@link #idProperty id}: 1, firstname: 'Bill', occupation: 'Gardener' },
{ {@link #idProperty id}: 2, firstname: 'Ben' , occupation: 'Horticulturalist' },
...
]
}
</code></pre>
* <p><b><u>Automatic configuration using metaData</u></b></p>
* <p>It is possible to change a JsonReader's metadata at any time by including
* a <b><tt>metaData</tt></b> property in the JSON data object. If the JSON data
* object has a <b><tt>metaData</tt></b> property, a {@link Ext.data.Store Store}
* object using this Reader will reconfigure itself to use the newly provided
* field definition and fire its {@link Ext.data.Store#metachange metachange}
* event. The metachange event handler may interrogate the <b><tt>metaData</tt></b>
* property to perform any configuration required.</p>
* <p>Note that reconfiguring a Store potentially invalidates objects which may
* refer to Fields or Records which no longer exist.</p>
* <p>To use this facility you would create the JsonReader like this:</p><pre><code>
var myReader = new Ext.data.JsonReader();
</code></pre>
* <p>The first data packet from the server would configure the reader by
* containing a <b><tt>metaData</tt></b> property <b>and</b> the data. For
* example, the JSON data object might take the form:</p><pre><code>
{
metaData: {
"{@link #idProperty}": "id",
"{@link #root}": "rows",
"{@link #totalProperty}": "results"
"{@link #successProperty}": "success",
"{@link Ext.data.DataReader#fields fields}": [
{"name": "name"},
{"name": "job", "mapping": "occupation"}
],
// used by store to set its sortInfo
"sortInfo":{
"field": "name",
"direction": "ASC"
},
// {@link Ext.PagingToolbar paging data} (if applicable)
"start": 0,
"limit": 2,
// custom property
"foo": "bar"
},
// Reader&#39;s configured {@link #successProperty}
"success": true,
// Reader&#39;s configured {@link #totalProperty}
"results": 2000,
// Reader&#39;s configured {@link #root}
// (this data simulates 2 results {@link Ext.PagingToolbar per page})
"rows": [ // <b>*Note:</b> this must be an Array
{ "id": 1, "name": "Bill", "occupation": "Gardener" },
{ "id": 2, "name": "Ben", "occupation": "Horticulturalist" }
]
}
* </code></pre>
* <p>The <b><tt>metaData</tt></b> property in the JSON data object should contain:</p>
* <div class="mdetail-params"><ul>
* <li>any of the configuration options for this class</li>
* <li>a <b><tt>{@link Ext.data.Record#fields fields}</tt></b> property which
* the JsonReader will use as an argument to the
* {@link Ext.data.Record#create data Record create method} in order to
* configure the layout of the Records it will produce.</li>
* <li>a <b><tt>{@link Ext.data.Store#sortInfo sortInfo}</tt></b> property
* which the JsonReader will use to set the {@link Ext.data.Store}'s
* {@link Ext.data.Store#sortInfo sortInfo} property</li>
* <li>any custom properties needed</li>
* </ul></div>
*
* @constructor
* Create a new JsonReader
* @param {Object} meta Metadata configuration options.
* @param {Array/Object} recordType
* <p>Either an Array of {@link Ext.data.Field Field} definition objects (which
* will be passed to {@link Ext.data.Record#create}, or a {@link Ext.data.Record Record}
* constructor created from {@link Ext.data.Record#create}.</p>
*/
Ext.data.JsonReader = function(meta, recordType){
meta = meta || {};
/**
* @cfg {String} idProperty [id] Name of the property within a row object
* that contains a record identifier value. Defaults to <tt>id</tt>
*/
/**
* @cfg {String} successProperty [success] Name of the property from which to
* retrieve the success attribute. Defaults to <tt>success</tt>. See
* {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#exception exception}
* for additional information.
*/
/**
* @cfg {String} totalProperty [total] Name of the property from which to
* retrieve the total number of records in the dataset. This is only needed
* if the whole dataset is not passed in one go, but is being paged from
* the remote server. Defaults to <tt>total</tt>.
*/
/**
* @cfg {String} root [undefined] <b>Required</b>. The name of the property
* which contains the Array of row objects. Defaults to <tt>undefined</tt>.
* An exception will be thrown if the root property is undefined. The data
* packet value for this property should be an empty array to clear the data
* or show no data.
*/
Ext.applyIf(meta, {
idProperty: 'id',
successProperty: 'success',
totalProperty: 'total'
});
Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType || meta.fields);
};
Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, {
/**
* This JsonReader's metadata as passed to the constructor, or as passed in
* the last data packet's <b><tt>metaData</tt></b> property.
* @type Mixed
* @property meta
*/
/**
* This method is only used by a DataProxy which has retrieved data from a remote server.
* @param {Object} response The XHR object which contains the JSON data in its responseText.
* @return {Object} data A data block which is used by an Ext.data.Store object as
* a cache of Ext.data.Records.
*/
read : function(response){
var json = response.responseText;
var o = Ext.decode(json);
if(!o) {
throw {message: 'JsonReader.read: Json object not found'};
}
return this.readRecords(o);
},
/*
* TODO: refactor code between JsonReader#readRecords, #readResponse into 1 method.
* there's ugly duplication going on due to maintaining backwards compat. with 2.0. It's time to do this.
*/
/**
* Decode a JSON response from server.
* @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
* @param {Object} response The XHR object returned through an Ajax server request.
* @return {Response} A {@link Ext.data.Response Response} object containing the data response, and also status information.
*/
readResponse : function(action, response) {
var o = (response.responseText !== undefined) ? Ext.decode(response.responseText) : response;
if(!o) {
throw new Ext.data.JsonReader.Error('response');
}
var root = this.getRoot(o);
if (action === Ext.data.Api.actions.create) {
var def = Ext.isDefined(root);
if (def && Ext.isEmpty(root)) {
throw new Ext.data.JsonReader.Error('root-empty', this.meta.root);
}
else if (!def) {
throw new Ext.data.JsonReader.Error('root-undefined-response', this.meta.root);
}
}
// instantiate response object
var res = new Ext.data.Response({
action: action,
success: this.getSuccess(o),
data: (root) ? this.extractData(root, false) : [],
message: this.getMessage(o),
raw: o
});
// blow up if no successProperty
if (Ext.isEmpty(res.success)) {
throw new Ext.data.JsonReader.Error('successProperty-response', this.meta.successProperty);
}
return res;
},
/**
* Create a data block containing Ext.data.Records from a JSON object.
* @param {Object} o An object which contains an Array of row objects in the property specified
* in the config as 'root, and optionally a property, specified in the config as 'totalProperty'
* which contains the total size of the dataset.
* @return {Object} data A data block which is used by an Ext.data.Store object as
* a cache of Ext.data.Records.
*/
readRecords : function(o){
/**
* After any data loads, the raw JSON data is available for further custom processing. If no data is
* loaded or there is a load exception this property will be undefined.
* @type Object
*/
this.jsonData = o;
if(o.metaData){
this.onMetaChange(o.metaData);
}
var s = this.meta, Record = this.recordType,
f = Record.prototype.fields, fi = f.items, fl = f.length, v;
var root = this.getRoot(o), c = root.length, totalRecords = c, success = true;
if(s.totalProperty){
v = parseInt(this.getTotal(o), 10);
if(!isNaN(v)){
totalRecords = v;
}
}
if(s.successProperty){
v = this.getSuccess(o);
if(v === false || v === 'false'){
success = false;
}
}
// TODO return Ext.data.Response instance instead. @see #readResponse
return {
success : success,
records : this.extractData(root, true), // <-- true to return [Ext.data.Record]
totalRecords : totalRecords
};
},
// private
buildExtractors : function() {
if(this.ef){
return;
}
var s = this.meta, Record = this.recordType,
f = Record.prototype.fields, fi = f.items, fl = f.length;
if(s.totalProperty) {
this.getTotal = this.createAccessor(s.totalProperty);
}
if(s.successProperty) {
this.getSuccess = this.createAccessor(s.successProperty);
}
if (s.messageProperty) {
this.getMessage = this.createAccessor(s.messageProperty);
}
this.getRoot = s.root ? this.createAccessor(s.root) : function(p){return p;};
if (s.id || s.idProperty) {
var g = this.createAccessor(s.id || s.idProperty);
this.getId = function(rec) {
var r = g(rec);
return (r === undefined || r === '') ? null : r;
};
} else {
this.getId = function(){return null;};
}
var ef = [];
for(var i = 0; i < fl; i++){
f = fi[i];
var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name;
ef.push(this.createAccessor(map));
}
this.ef = ef;
},
/**
* @ignore
* TODO This isn't used anywhere?? Don't we want to use this where possible instead of complex #createAccessor?
*/
simpleAccess : function(obj, subsc) {
return obj[subsc];
},
/**
* @ignore
*/
createAccessor : function(){
var re = /[\[\.]/;
return function(expr) {
if(Ext.isEmpty(expr)){
return Ext.emptyFn;
}
if(Ext.isFunction(expr)){
return expr;
}
var i = String(expr).search(re);
if(i >= 0){
return new Function('obj', 'return obj' + (i > 0 ? '.' : '') + expr);
}
return function(obj){
return obj[expr];
};
};
}(),
/**
* type-casts a single row of raw-data from server
* @param {Object} data
* @param {Array} items
* @param {Integer} len
* @private
*/
extractValues : function(data, items, len) {
var f, values = {};
for(var j = 0; j < len; j++){
f = items[j];
var v = this.ef[j](data);
values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue, data);
}
return values;
}
});
/**
* @class Ext.data.JsonReader.Error
* Error class for JsonReader
*/
Ext.data.JsonReader.Error = Ext.extend(Ext.Error, {
constructor : function(message, arg) {
this.arg = arg;
Ext.Error.call(this, message);
},
name : 'Ext.data.JsonReader'
});
Ext.apply(Ext.data.JsonReader.Error.prototype, {
lang: {
'response': 'An error occurred while json-decoding your server response',
'successProperty-response': 'Could not locate your "successProperty" in your server response. Please review your JsonReader config to ensure the config-property "successProperty" matches the property in your server-response. See the JsonReader docs.',
'root-undefined-config': 'Your JsonReader was configured without a "root" property. Please review your JsonReader config and make sure to define the root property. See the JsonReader docs.',
'idProperty-undefined' : 'Your JsonReader was configured without an "idProperty" Please review your JsonReader configuration and ensure the "idProperty" is set (e.g.: "id"). See the JsonReader docs.',
'root-empty': 'Data was expected to be returned by the server in the "root" property of the response. Please review your JsonReader configuration to ensure the "root" property matches that returned in the server-response. See JsonReader docs.'
}
});

View File

@@ -1,49 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.JsonStore
* @extends Ext.data.Store
* <p>Small helper class to make creating {@link Ext.data.Store}s from JSON data easier.
* A JsonStore will be automatically configured with a {@link Ext.data.JsonReader}.</p>
* <p>A store configuration would be something like:<pre><code>
var store = new Ext.data.JsonStore({
// store configs
autoDestroy: true,
url: 'get-images.php',
storeId: 'myStore',
// reader configs
root: 'images',
idProperty: 'name',
fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]
});
* </code></pre></p>
* <p>This store is configured to consume a returned object of the form:<pre><code>
{
images: [
{name: 'Image one', url:'/GetImage.php?id=1', size:46.5, lastmod: new Date(2007, 10, 29)},
{name: 'Image Two', url:'/GetImage.php?id=2', size:43.2, lastmod: new Date(2007, 10, 30)}
]
}
* </code></pre>
* An object literal of this form could also be used as the {@link #data} config option.</p>
* <p><b>*Note:</b> Although not listed here, this class accepts all of the configuration options of
* <b>{@link Ext.data.JsonReader JsonReader}</b>.</p>
* @constructor
* @param {Object} config
* @xtype jsonstore
*/
Ext.data.JsonStore = Ext.extend(Ext.data.Store, {
/**
* @cfg {Ext.data.DataReader} reader @hide
*/
constructor: function(config){
Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(config, {
reader: new Ext.data.JsonReader(config)
}));
}
});
Ext.reg('jsonstore', Ext.data.JsonStore);

View File

@@ -1,96 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.JsonWriter
* @extends Ext.data.DataWriter
* DataWriter extension for writing an array or single {@link Ext.data.Record} object(s) in preparation for executing a remote CRUD action.
*/
Ext.data.JsonWriter = Ext.extend(Ext.data.DataWriter, {
/**
* @cfg {Boolean} encode <p><tt>true</tt> to {@link Ext.util.JSON#encode JSON encode} the
* {@link Ext.data.DataWriter#toHash hashed data} into a standard HTTP parameter named after this
* Reader's <code>meta.root</code> property which, by default is imported from the associated Reader. Defaults to <tt>true</tt>.</p>
* <p>If set to <code>false</code>, the hashed data is {@link Ext.util.JSON#encode JSON encoded}, along with
* the associated {@link Ext.data.Store}'s {@link Ext.data.Store#baseParams baseParams}, into the POST body.</p>
* <p>When using {@link Ext.data.DirectProxy}, set this to <tt>false</tt> since Ext.Direct.JsonProvider will perform
* its own json-encoding. In addition, if you're using {@link Ext.data.HttpProxy}, setting to <tt>false</tt>
* will cause HttpProxy to transmit data using the <b>jsonData</b> configuration-params of {@link Ext.Ajax#request}
* instead of <b>params</b>.</p>
* <p>When using a {@link Ext.data.Store#restful} Store, some serverside frameworks are
* tuned to expect data through the jsonData mechanism. In those cases, one will want to set <b>encode: <tt>false</tt></b>, as in
* let the lower-level connection object (eg: Ext.Ajax) do the encoding.</p>
*/
encode : true,
/**
* @cfg {Boolean} encodeDelete False to send only the id to the server on delete, true to encode it in an object
* literal, eg: <pre><code>
{id: 1}
* </code></pre> Defaults to <tt>false</tt>
*/
encodeDelete: false,
constructor : function(config){
Ext.data.JsonWriter.superclass.constructor.call(this, config);
},
/**
* <p>This method should not need to be called by application code, however it may be useful on occasion to
* override it, or augment it with an {@link Function#createInterceptor interceptor} or {@link Function#createSequence sequence}.</p>
* <p>The provided implementation encodes the serialized data representing the Store's modified Records into the Ajax request's
* <code>params</code> according to the <code>{@link #encode}</code> setting.</p>
* @param {Object} Ajax request params object to write into.
* @param {Object} baseParams as defined by {@link Ext.data.Store#baseParams}. The baseParms must be encoded by the extending class, eg: {@link Ext.data.JsonWriter}, {@link Ext.data.XmlWriter}.
* @param {Object/Object[]} data Data object representing the serialized modified records from the Store. May be either a single object,
* or an Array of objects - user implementations must handle both cases.
*/
render : function(params, baseParams, data) {
if (this.encode === true) {
// Encode here now.
Ext.apply(params, baseParams);
params[this.meta.root] = Ext.encode(data);
} else {
// defer encoding for some other layer, probably in {@link Ext.Ajax#request}. Place everything into "jsonData" key.
var jdata = Ext.apply({}, baseParams);
jdata[this.meta.root] = data;
params.jsonData = jdata;
}
},
/**
* Implements abstract Ext.data.DataWriter#createRecord
* @protected
* @param {Ext.data.Record} rec
* @return {Object}
*/
createRecord : function(rec) {
return this.toHash(rec);
},
/**
* Implements abstract Ext.data.DataWriter#updateRecord
* @protected
* @param {Ext.data.Record} rec
* @return {Object}
*/
updateRecord : function(rec) {
return this.toHash(rec);
},
/**
* Implements abstract Ext.data.DataWriter#destroyRecord
* @protected
* @param {Ext.data.Record} rec
* @return {Object}
*/
destroyRecord : function(rec){
if(this.encodeDelete){
var data = {};
data[this.meta.idProperty] = rec.id;
return data;
}else{
return rec.id;
}
}
});

View File

@@ -1,69 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.MemoryProxy
* @extends Ext.data.DataProxy
* An implementation of Ext.data.DataProxy that simply passes the data specified in its constructor
* to the Reader when its load method is called.
* @constructor
* @param {Object} data The data object which the Reader uses to construct a block of Ext.data.Records.
*/
Ext.data.MemoryProxy = function(data){
// Must define a dummy api with "read" action to satisfy DataProxy#doRequest and Ext.data.Api#prepare *before* calling super
var api = {};
api[Ext.data.Api.actions.read] = true;
Ext.data.MemoryProxy.superclass.constructor.call(this, {
api: api
});
this.data = data;
};
Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {
/**
* @event loadexception
* Fires if an exception occurs in the Proxy during data loading. Note that this event is also relayed
* through {@link Ext.data.Store}, so you can listen for it directly on any Store instance.
* @param {Object} this
* @param {Object} arg The callback's arg object passed to the {@link #load} function
* @param {Object} null This parameter does not apply and will always be null for MemoryProxy
* @param {Error} e The JavaScript Error object caught if the configured Reader could not read the data
*/
/**
* MemoryProxy implementation of DataProxy#doRequest
* @param {String} action
* @param {Ext.data.Record/Ext.data.Record[]} rs If action is load, rs will be null
* @param {Object} params An object containing properties which are to be used as HTTP parameters
* for the request to the remote server.
* @param {Ext.data.DataReader} reader The Reader object which converts the data
* object into a block of Ext.data.Records.
* @param {Function} callback The function into which to pass the block of Ext.data.Records.
* The function must be passed <ul>
* <li>The Record block object</li>
* <li>The "arg" argument from the load function</li>
* <li>A boolean success indicator</li>
* </ul>
* @param {Object} scope The scope (<code>this</code> reference) in which the callback function is executed. Defaults to the browser window.
* @param {Object} arg An optional argument which is passed to the callback as its second parameter.
*/
doRequest : function(action, rs, params, reader, callback, scope, arg) {
// No implementation for CRUD in MemoryProxy. Assumes all actions are 'load'
params = params || {};
var result;
try {
result = reader.readRecords(this.data);
}catch(e){
// @deprecated loadexception
this.fireEvent("loadexception", this, null, arg, e);
this.fireEvent('exception', this, 'response', action, arg, null, e);
callback.call(scope, null, arg, false);
return;
}
callback.call(scope, result, arg, true);
}
});

View File

@@ -1,415 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.Record
* <p>Instances of this class encapsulate both Record <em>definition</em> information, and Record
* <em>value</em> information for use in {@link Ext.data.Store} objects, or any code which needs
* to access Records cached in an {@link Ext.data.Store} object.</p>
* <p>Constructors for this class are generated by passing an Array of field definition objects to {@link #create}.
* Instances are usually only created by {@link Ext.data.Reader} implementations when processing unformatted data
* objects.</p>
* <p>Note that an instance of a Record class may only belong to one {@link Ext.data.Store Store} at a time.
* In order to copy data from one Store to another, use the {@link #copy} method to create an exact
* copy of the Record, and insert the new instance into the other Store.</p>
* <p>When serializing a Record for submission to the server, be aware that it contains many private
* properties, and also a reference to its owning Store which in turn holds references to its Records.
* This means that a whole Record may not be encoded using {@link Ext.util.JSON.encode}. Instead, use the
* <code>{@link #data}</code> and <code>{@link #id}</code> properties.</p>
* <p>Record objects generated by this constructor inherit all the methods of Ext.data.Record listed below.</p>
* @constructor
* <p>This constructor should not be used to create Record objects. Instead, use {@link #create} to
* generate a subclass of Ext.data.Record configured with information about its constituent fields.<p>
* <p><b>The generated constructor has the same signature as this constructor.</b></p>
* @param {Object} data (Optional) An object, the properties of which provide values for the new Record's
* fields. If not specified the <code>{@link Ext.data.Field#defaultValue defaultValue}</code>
* for each field will be assigned.
* @param {Object} id (Optional) The id of the Record. The id is used by the
* {@link Ext.data.Store} object which owns the Record to index its collection
* of Records (therefore this id should be unique within each store). If an
* <code>id</code> is not specified a <b><code>{@link #phantom}</code></b>
* Record will be created with an {@link #Record.id automatically generated id}.
*/
Ext.data.Record = function(data, id){
// if no id, call the auto id method
this.id = (id || id === 0) ? id : Ext.data.Record.id(this);
this.data = data || {};
};
/**
* Generate a constructor for a specific Record layout.
* @param {Array} o An Array of <b>{@link Ext.data.Field Field}</b> definition objects.
* The constructor generated by this method may be used to create new Record instances. The data
* object must contain properties named after the {@link Ext.data.Field field}
* <b><tt>{@link Ext.data.Field#name}s</tt></b>. Example usage:<pre><code>
// create a Record constructor from a description of the fields
var TopicRecord = Ext.data.Record.create([ // creates a subclass of Ext.data.Record
{{@link Ext.data.Field#name name}: 'title', {@link Ext.data.Field#mapping mapping}: 'topic_title'},
{name: 'author', mapping: 'username', allowBlank: false},
{name: 'totalPosts', mapping: 'topic_replies', type: 'int'},
{name: 'lastPost', mapping: 'post_time', type: 'date'},
{name: 'lastPoster', mapping: 'user2'},
{name: 'excerpt', mapping: 'post_text', allowBlank: false},
// In the simplest case, if no properties other than <tt>name</tt> are required,
// a field definition may consist of just a String for the field name.
'signature'
]);
// create Record instance
var myNewRecord = new TopicRecord(
{
title: 'Do my job please',
author: 'noobie',
totalPosts: 1,
lastPost: new Date(),
lastPoster: 'Animal',
excerpt: 'No way dude!',
signature: ''
},
id // optionally specify the id of the record otherwise {@link #Record.id one is auto-assigned}
);
myStore.{@link Ext.data.Store#add add}(myNewRecord);
</code></pre>
* @method create
* @return {Function} A constructor which is used to create new Records according
* to the definition. The constructor has the same signature as {@link #Record}.
* @static
*/
Ext.data.Record.create = function(o){
var f = Ext.extend(Ext.data.Record, {});
var p = f.prototype;
p.fields = new Ext.util.MixedCollection(false, function(field){
return field.name;
});
for(var i = 0, len = o.length; i < len; i++){
p.fields.add(new Ext.data.Field(o[i]));
}
f.getField = function(name){
return p.fields.get(name);
};
return f;
};
Ext.data.Record.PREFIX = 'ext-record';
Ext.data.Record.AUTO_ID = 1;
Ext.data.Record.EDIT = 'edit';
Ext.data.Record.REJECT = 'reject';
Ext.data.Record.COMMIT = 'commit';
/**
* Generates a sequential id. This method is typically called when a record is {@link #create}d
* and {@link #Record no id has been specified}. The returned id takes the form:
* <tt>&#123;PREFIX}-&#123;AUTO_ID}</tt>.<div class="mdetail-params"><ul>
* <li><b><tt>PREFIX</tt></b> : String<p class="sub-desc"><tt>Ext.data.Record.PREFIX</tt>
* (defaults to <tt>'ext-record'</tt>)</p></li>
* <li><b><tt>AUTO_ID</tt></b> : String<p class="sub-desc"><tt>Ext.data.Record.AUTO_ID</tt>
* (defaults to <tt>1</tt> initially)</p></li>
* </ul></div>
* @param {Record} rec The record being created. The record does not exist, it's a {@link #phantom}.
* @return {String} auto-generated string id, <tt>"ext-record-i++'</tt>;
*/
Ext.data.Record.id = function(rec) {
rec.phantom = true;
return [Ext.data.Record.PREFIX, '-', Ext.data.Record.AUTO_ID++].join('');
};
Ext.data.Record.prototype = {
/**
* <p><b>This property is stored in the Record definition's <u>prototype</u></b></p>
* A MixedCollection containing the defined {@link Ext.data.Field Field}s for this Record. Read-only.
* @property fields
* @type Ext.util.MixedCollection
*/
/**
* An object hash representing the data for this Record. Every field name in the Record definition
* is represented by a property of that name in this object. Note that unless you specified a field
* with {@link Ext.data.Field#name name} "id" in the Record definition, this will <b>not</b> contain
* an <tt>id</tt> property.
* @property data
* @type {Object}
*/
/**
* The unique ID of the Record {@link #Record as specified at construction time}.
* @property id
* @type {Object}
*/
/**
* <p><b>Only present if this Record was created by an {@link Ext.data.XmlReader XmlReader}</b>.</p>
* <p>The XML element which was the source of the data for this Record.</p>
* @property node
* @type {XMLElement}
*/
/**
* <p><b>Only present if this Record was created by an {@link Ext.data.ArrayReader ArrayReader} or a {@link Ext.data.JsonReader JsonReader}</b>.</p>
* <p>The Array or object which was the source of the data for this Record.</p>
* @property json
* @type {Array|Object}
*/
/**
* Readonly flag - true if this Record has been modified.
* @type Boolean
*/
dirty : false,
editing : false,
error : null,
/**
* This object contains a key and value storing the original values of all modified
* fields or is null if no fields have been modified.
* @property modified
* @type {Object}
*/
modified : null,
/**
* <tt>true</tt> when the record does not yet exist in a server-side database (see
* {@link #markDirty}). Any record which has a real database pk set as its id property
* is NOT a phantom -- it's real.
* @property phantom
* @type {Boolean}
*/
phantom : false,
// private
join : function(store){
/**
* The {@link Ext.data.Store} to which this Record belongs.
* @property store
* @type {Ext.data.Store}
*/
this.store = store;
},
/**
* Set the {@link Ext.data.Field#name named field} to the specified value. For example:
* <pre><code>
// record has a field named 'firstname'
var Employee = Ext.data.Record.{@link #create}([
{name: 'firstname'},
...
]);
// update the 2nd record in the store:
var rec = myStore.{@link Ext.data.Store#getAt getAt}(1);
// set the value (shows dirty flag):
rec.set('firstname', 'Betty');
// commit the change (removes dirty flag):
rec.{@link #commit}();
// update the record in the store, bypass setting dirty flag,
// and do not store the change in the {@link Ext.data.Store#getModifiedRecords modified records}
rec.{@link #data}['firstname'] = 'Wilma'; // updates record, but not the view
rec.{@link #commit}(); // updates the view
* </code></pre>
* <b>Notes</b>:<div class="mdetail-params"><ul>
* <li>If the store has a writer and <code>autoSave=true</code>, each set()
* will execute an XHR to the server.</li>
* <li>Use <code>{@link #beginEdit}</code> to prevent the store's <code>update</code>
* event firing while using set().</li>
* <li>Use <code>{@link #endEdit}</code> to have the store's <code>update</code>
* event fire.</li>
* </ul></div>
* @param {String} name The {@link Ext.data.Field#name name of the field} to set.
* @param {String/Object/Array} value The value to set the field to.
*/
set : function(name, value){
var encode = Ext.isPrimitive(value) ? String : Ext.encode;
if(encode(this.data[name]) == encode(value)) {
return;
}
this.dirty = true;
if(!this.modified){
this.modified = {};
}
if(this.modified[name] === undefined){
this.modified[name] = this.data[name];
}
this.data[name] = value;
if(!this.editing){
this.afterEdit();
}
},
// private
afterEdit : function(){
if (this.store != undefined && typeof this.store.afterEdit == "function") {
this.store.afterEdit(this);
}
},
// private
afterReject : function(){
if(this.store){
this.store.afterReject(this);
}
},
// private
afterCommit : function(){
if(this.store){
this.store.afterCommit(this);
}
},
/**
* Get the value of the {@link Ext.data.Field#name named field}.
* @param {String} name The {@link Ext.data.Field#name name of the field} to get the value of.
* @return {Object} The value of the field.
*/
get : function(name){
return this.data[name];
},
/**
* Begin an edit. While in edit mode, no events (e.g.. the <code>update</code> event)
* are relayed to the containing store.
* See also: <code>{@link #endEdit}</code> and <code>{@link #cancelEdit}</code>.
*/
beginEdit : function(){
this.editing = true;
this.modified = this.modified || {};
},
/**
* Cancels all changes made in the current edit operation.
*/
cancelEdit : function(){
this.editing = false;
delete this.modified;
},
/**
* End an edit. If any data was modified, the containing store is notified
* (ie, the store's <code>update</code> event will fire).
*/
endEdit : function(){
this.editing = false;
if(this.dirty){
this.afterEdit();
}
},
/**
* Usually called by the {@link Ext.data.Store} which owns the Record.
* Rejects all changes made to the Record since either creation, or the last commit operation.
* Modified fields are reverted to their original values.
* <p>Developers should subscribe to the {@link Ext.data.Store#update} event
* to have their code notified of reject operations.</p>
* @param {Boolean} silent (optional) True to skip notification of the owning
* store of the change (defaults to false)
*/
reject : function(silent){
var m = this.modified;
for(var n in m){
if(typeof m[n] != "function"){
this.data[n] = m[n];
}
}
this.dirty = false;
delete this.modified;
this.editing = false;
if(silent !== true){
this.afterReject();
}
},
/**
* Usually called by the {@link Ext.data.Store} which owns the Record.
* Commits all changes made to the Record since either creation, or the last commit operation.
* <p>Developers should subscribe to the {@link Ext.data.Store#update} event
* to have their code notified of commit operations.</p>
* @param {Boolean} silent (optional) True to skip notification of the owning
* store of the change (defaults to false)
*/
commit : function(silent){
this.dirty = false;
delete this.modified;
this.editing = false;
if(silent !== true){
this.afterCommit();
}
},
/**
* Gets a hash of only the fields that have been modified since this Record was created or commited.
* @return Object
*/
getChanges : function(){
var m = this.modified, cs = {};
for(var n in m){
if(m.hasOwnProperty(n)){
cs[n] = this.data[n];
}
}
return cs;
},
// private
hasError : function(){
return this.error !== null;
},
// private
clearError : function(){
this.error = null;
},
/**
* Creates a copy (clone) of this Record.
* @param {String} id (optional) A new Record id, defaults to the id
* of the record being copied. See <code>{@link #id}</code>.
* To generate a phantom record with a new id use:<pre><code>
var rec = record.copy(); // clone the record
Ext.data.Record.id(rec); // automatically generate a unique sequential id
* </code></pre>
* @return {Record}
*/
copy : function(newId) {
return new this.constructor(Ext.apply({}, this.data), newId || this.id);
},
/**
* Returns <tt>true</tt> if the passed field name has been <code>{@link #modified}</code>
* since the load or last commit.
* @param {String} fieldName {@link Ext.data.Field.{@link Ext.data.Field#name}
* @return {Boolean}
*/
isModified : function(fieldName){
return !!(this.modified && this.modified.hasOwnProperty(fieldName));
},
/**
* By default returns <tt>false</tt> if any {@link Ext.data.Field field} within the
* record configured with <tt>{@link Ext.data.Field#allowBlank} = false</tt> returns
* <tt>true</tt> from an {@link Ext}.{@link Ext#isEmpty isempty} test.
* @return {Boolean}
*/
isValid : function() {
return this.fields.find(function(f) {
return (f.allowBlank === false && Ext.isEmpty(this.data[f.name])) ? true : false;
},this) ? false : true;
},
/**
* <p>Marks this <b>Record</b> as <code>{@link #dirty}</code>. This method
* is used interally when adding <code>{@link #phantom}</code> records to a
* {@link Ext.data.Store#writer writer enabled store}.</p>
* <br><p>Marking a record <code>{@link #dirty}</code> causes the phantom to
* be returned by {@link Ext.data.Store#getModifiedRecords} where it will
* have a create action composed for it during {@link Ext.data.Store#save store save}
* operations.</p>
*/
markDirty : function(){
this.dirty = true;
if(!this.modified){
this.modified = {};
}
this.fields.each(function(f) {
this.modified[f.name] = this.data[f.name];
},this);
}
};

View File

@@ -1,41 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.Request
* A simple Request class used internally to the data package to provide more generalized remote-requests
* to a DataProxy.
* TODO Not yet implemented. Implement in Ext.data.Store#execute
*/
Ext.data.Request = function(params) {
Ext.apply(this, params);
};
Ext.data.Request.prototype = {
/**
* @cfg {String} action
*/
action : undefined,
/**
* @cfg {Ext.data.Record[]/Ext.data.Record} rs The Store recordset associated with the request.
*/
rs : undefined,
/**
* @cfg {Object} params HTTP request params
*/
params: undefined,
/**
* @cfg {Function} callback The function to call when request is complete
*/
callback : Ext.emptyFn,
/**
* @cfg {Object} scope The scope of the callback funtion
*/
scope : undefined,
/**
* @cfg {Ext.data.DataReader} reader The DataReader instance which will parse the received response
*/
reader : undefined
};

View File

@@ -1,39 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.Response
* A generic response class to normalize response-handling internally to the framework.
*/
Ext.data.Response = function(params) {
Ext.apply(this, params);
};
Ext.data.Response.prototype = {
/**
* @cfg {String} action {@link Ext.data.Api#actions}
*/
action: undefined,
/**
* @cfg {Boolean} success
*/
success : undefined,
/**
* @cfg {String} message
*/
message : undefined,
/**
* @cfg {Array/Object} data
*/
data: undefined,
/**
* @cfg {Object} raw The raw response returned from server-code
*/
raw: undefined,
/**
* @cfg {Ext.data.Record/Ext.data.Record[]} records related to the Request action
*/
records: undefined
};

View File

@@ -1,305 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.ScriptTagProxy
* @extends Ext.data.DataProxy
* An implementation of Ext.data.DataProxy that reads a data object from a URL which may be in a domain
* other than the originating domain of the running page.<br>
* <p>
* <b>Note that if you are retrieving data from a page that is in a domain that is NOT the same as the originating domain
* of the running page, you must use this class, rather than HttpProxy.</b><br>
* <p>
* The content passed back from a server resource requested by a ScriptTagProxy <b>must</b> be executable JavaScript
* source code because it is used as the source inside a &lt;script> tag.<br>
* <p>
* In order for the browser to process the returned data, the server must wrap the data object
* with a call to a callback function, the name of which is passed as a parameter by the ScriptTagProxy.
* Below is a Java example for a servlet which returns data for either a ScriptTagProxy, or an HttpProxy
* depending on whether the callback name was passed:
* <p>
* <pre><code>
boolean scriptTag = false;
String cb = request.getParameter("callback");
if (cb != null) {
scriptTag = true;
response.setContentType("text/javascript");
} else {
response.setContentType("application/x-json");
}
Writer out = response.getWriter();
if (scriptTag) {
out.write(cb + "(");
}
out.print(dataBlock.toJsonString());
if (scriptTag) {
out.write(");");
}
</code></pre>
* <p>Below is a PHP example to do the same thing:</p><pre><code>
$callback = $_REQUEST['callback'];
// Create the output object.
$output = array('a' => 'Apple', 'b' => 'Banana');
//start output
if ($callback) {
header('Content-Type: text/javascript');
echo $callback . '(' . json_encode($output) . ');';
} else {
header('Content-Type: application/x-json');
echo json_encode($output);
}
</code></pre>
* <p>Below is the ASP.Net code to do the same thing:</p><pre><code>
String jsonString = "{success: true}";
String cb = Request.Params.Get("callback");
String responseString = "";
if (!String.IsNullOrEmpty(cb)) {
responseString = cb + "(" + jsonString + ")";
} else {
responseString = jsonString;
}
Response.Write(responseString);
</code></pre>
*
* @constructor
* @param {Object} config A configuration object.
*/
Ext.data.ScriptTagProxy = function(config){
Ext.apply(this, config);
Ext.data.ScriptTagProxy.superclass.constructor.call(this, config);
this.head = document.getElementsByTagName("head")[0];
/**
* @event loadexception
* <b>Deprecated</b> in favor of 'exception' event.
* Fires if an exception occurs in the Proxy during data loading. This event can be fired for one of two reasons:
* <ul><li><b>The load call timed out.</b> This means the load callback did not execute within the time limit
* specified by {@link #timeout}. In this case, this event will be raised and the
* fourth parameter (read error) will be null.</li>
* <li><b>The load succeeded but the reader could not read the response.</b> This means the server returned
* data, but the configured Reader threw an error while reading the data. In this case, this event will be
* raised and the caught error will be passed along as the fourth parameter of this event.</li></ul>
* Note that this event is also relayed through {@link Ext.data.Store}, so you can listen for it directly
* on any Store instance.
* @param {Object} this
* @param {Object} options The loading options that were specified (see {@link #load} for details). If the load
* call timed out, this parameter will be null.
* @param {Object} arg The callback's arg object passed to the {@link #load} function
* @param {Error} e The JavaScript Error object caught if the configured Reader could not read the data.
* If the remote request returns success: false, this parameter will be null.
*/
};
Ext.data.ScriptTagProxy.TRANS_ID = 1000;
Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, {
/**
* @cfg {String} url The URL from which to request the data object.
*/
/**
* @cfg {Number} timeout (optional) The number of milliseconds to wait for a response. Defaults to 30 seconds.
*/
timeout : 30000,
/**
* @cfg {String} callbackParam (Optional) The name of the parameter to pass to the server which tells
* the server the name of the callback function set up by the load call to process the returned data object.
* Defaults to "callback".<p>The server-side processing must read this parameter value, and generate
* javascript output which calls this named function passing the data object as its only parameter.
*/
callbackParam : "callback",
/**
* @cfg {Boolean} nocache (optional) Defaults to true. Disable caching by adding a unique parameter
* name to the request.
*/
nocache : true,
/**
* HttpProxy implementation of DataProxy#doRequest
* @param {String} action
* @param {Ext.data.Record/Ext.data.Record[]} rs If action is <tt>read</tt>, rs will be null
* @param {Object} params An object containing properties which are to be used as HTTP parameters
* for the request to the remote server.
* @param {Ext.data.DataReader} reader The Reader object which converts the data
* object into a block of Ext.data.Records.
* @param {Function} callback The function into which to pass the block of Ext.data.Records.
* The function must be passed <ul>
* <li>The Record block object</li>
* <li>The "arg" argument from the load function</li>
* <li>A boolean success indicator</li>
* </ul>
* @param {Object} scope The scope (<code>this</code> reference) in which the callback function is executed. Defaults to the browser window.
* @param {Object} arg An optional argument which is passed to the callback as its second parameter.
*/
doRequest : function(action, rs, params, reader, callback, scope, arg) {
var p = Ext.urlEncode(Ext.apply(params, this.extraParams));
var url = this.buildUrl(action, rs);
if (!url) {
throw new Ext.data.Api.Error('invalid-url', url);
}
url = Ext.urlAppend(url, p);
if(this.nocache){
url = Ext.urlAppend(url, '_dc=' + (new Date().getTime()));
}
var transId = ++Ext.data.ScriptTagProxy.TRANS_ID;
var trans = {
id : transId,
action: action,
cb : "stcCallback"+transId,
scriptId : "stcScript"+transId,
params : params,
arg : arg,
url : url,
callback : callback,
scope : scope,
reader : reader
};
window[trans.cb] = this.createCallback(action, rs, trans);
url += String.format("&{0}={1}", this.callbackParam, trans.cb);
if(this.autoAbort !== false){
this.abort();
}
trans.timeoutId = this.handleFailure.defer(this.timeout, this, [trans]);
var script = document.createElement("script");
script.setAttribute("src", url);
script.setAttribute("type", "text/javascript");
script.setAttribute("id", trans.scriptId);
this.head.appendChild(script);
this.trans = trans;
},
// @private createCallback
createCallback : function(action, rs, trans) {
var self = this;
return function(res) {
self.trans = false;
self.destroyTrans(trans, true);
if (action === Ext.data.Api.actions.read) {
self.onRead.call(self, action, trans, res);
} else {
self.onWrite.call(self, action, trans, res, rs);
}
};
},
/**
* Callback for read actions
* @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
* @param {Object} trans The request transaction object
* @param {Object} res The server response
* @protected
*/
onRead : function(action, trans, res) {
var result;
try {
result = trans.reader.readRecords(res);
}catch(e){
// @deprecated: fire loadexception
this.fireEvent("loadexception", this, trans, res, e);
this.fireEvent('exception', this, 'response', action, trans, res, e);
trans.callback.call(trans.scope||window, null, trans.arg, false);
return;
}
if (result.success === false) {
// @deprecated: fire old loadexception for backwards-compat.
this.fireEvent('loadexception', this, trans, res);
this.fireEvent('exception', this, 'remote', action, trans, res, null);
} else {
this.fireEvent("load", this, res, trans.arg);
}
trans.callback.call(trans.scope||window, result, trans.arg, result.success);
},
/**
* Callback for write actions
* @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
* @param {Object} trans The request transaction object
* @param {Object} res The server response
* @protected
*/
onWrite : function(action, trans, response, rs) {
var reader = trans.reader;
try {
// though we already have a response object here in STP, run through readResponse to catch any meta-data exceptions.
var res = reader.readResponse(action, response);
} catch (e) {
this.fireEvent('exception', this, 'response', action, trans, res, e);
trans.callback.call(trans.scope||window, null, res, false);
return;
}
if(!res.success === true){
this.fireEvent('exception', this, 'remote', action, trans, res, rs);
trans.callback.call(trans.scope||window, null, res, false);
return;
}
this.fireEvent("write", this, action, res.data, res, rs, trans.arg );
trans.callback.call(trans.scope||window, res.data, res, true);
},
// private
isLoading : function(){
return this.trans ? true : false;
},
/**
* Abort the current server request.
*/
abort : function(){
if(this.isLoading()){
this.destroyTrans(this.trans);
}
},
// private
destroyTrans : function(trans, isLoaded){
this.head.removeChild(document.getElementById(trans.scriptId));
clearTimeout(trans.timeoutId);
if(isLoaded){
window[trans.cb] = undefined;
try{
delete window[trans.cb];
}catch(e){}
}else{
// if hasn't been loaded, wait for load to remove it to prevent script error
window[trans.cb] = function(){
window[trans.cb] = undefined;
try{
delete window[trans.cb];
}catch(e){}
};
}
},
// private
handleFailure : function(trans){
this.trans = false;
this.destroyTrans(trans, false);
if (trans.action === Ext.data.Api.actions.read) {
// @deprecated firing loadexception
this.fireEvent("loadexception", this, null, trans.arg);
}
this.fireEvent('exception', this, 'response', trans.action, {
response: null,
options: trans.arg
});
trans.callback.call(trans.scope||window, null, trans.arg, false);
},
// inherit docs
destroy: function(){
this.abort();
Ext.data.ScriptTagProxy.superclass.destroy.call(this);
}
});

View File

@@ -1,91 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.SortTypes
* @singleton
* Defines the default sorting (casting?) comparison functions used when sorting data.
*/
Ext.data.SortTypes = {
/**
* Default sort that does nothing
* @param {Mixed} s The value being converted
* @return {Mixed} The comparison value
*/
none : function(s){
return s;
},
/**
* The regular expression used to strip tags
* @type {RegExp}
* @property
*/
stripTagsRE : /<\/?[^>]+>/gi,
/**
* Strips all HTML tags to sort on text only
* @param {Mixed} s The value being converted
* @return {String} The comparison value
*/
asText : function(s){
return String(s).replace(this.stripTagsRE, "");
},
/**
* Strips all HTML tags to sort on text only - Case insensitive
* @param {Mixed} s The value being converted
* @return {String} The comparison value
*/
asUCText : function(s){
return String(s).toUpperCase().replace(this.stripTagsRE, "");
},
/**
* Case insensitive string
* @param {Mixed} s The value being converted
* @return {String} The comparison value
*/
asUCString : function(s) {
return String(s).toUpperCase();
},
/**
* Date sorting
* @param {Mixed} s The value being converted
* @return {Number} The comparison value
*/
asDate : function(s) {
if(!s){
return 0;
}
if(Ext.isDate(s)){
return s.getTime();
}
return Date.parse(String(s));
},
/**
* Float sorting
* @param {Mixed} s The value being converted
* @return {Float} The comparison value
*/
asFloat : function(s) {
var val = parseFloat(String(s).replace(/,/g, ""));
return isNaN(val) ? 0 : val;
},
/**
* Integer sorting
* @param {Mixed} s The value being converted
* @return {Number} The comparison value
*/
asInt : function(s) {
var val = parseInt(String(s).replace(/,/g, ""), 10);
return isNaN(val) ? 0 : val;
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,72 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.StoreMgr
* @extends Ext.util.MixedCollection
* The default global group of stores.
* @singleton
*/
Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), {
/**
* @cfg {Object} listeners @hide
*/
/**
* Registers one or more Stores with the StoreMgr. You do not normally need to register stores
* manually. Any store initialized with a {@link Ext.data.Store#storeId} will be auto-registered.
* @param {Ext.data.Store} store1 A Store instance
* @param {Ext.data.Store} store2 (optional)
* @param {Ext.data.Store} etc... (optional)
*/
register : function(){
for(var i = 0, s; (s = arguments[i]); i++){
this.add(s);
}
},
/**
* Unregisters one or more Stores with the StoreMgr
* @param {String/Object} id1 The id of the Store, or a Store instance
* @param {String/Object} id2 (optional)
* @param {String/Object} etc... (optional)
*/
unregister : function(){
for(var i = 0, s; (s = arguments[i]); i++){
this.remove(this.lookup(s));
}
},
/**
* Gets a registered Store by id
* @param {String/Object} id The id of the Store, or a Store instance
* @return {Ext.data.Store}
*/
lookup : function(id){
if(Ext.isArray(id)){
var fields = ['field1'], expand = !Ext.isArray(id[0]);
if(!expand){
for(var i = 2, len = id[0].length; i <= len; ++i){
fields.push('field' + i);
}
}
return new Ext.data.ArrayStore({
fields: fields,
data: id,
expandData: expand,
autoDestroy: true,
autoCreated: true
});
}
return Ext.isObject(id) ? (id.events ? id : Ext.create(id, 'store')) : this.get(id);
},
// getKey implementation for MixedCollection
getKey : function(o){
return o.storeId;
}
});

View File

@@ -1,833 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.Tree
* @extends Ext.util.Observable
* Represents a tree data structure and bubbles all the events for its nodes. The nodes
* in the tree have most standard DOM functionality.
* @constructor
* @param {Node} root (optional) The root node
*/
Ext.data.Tree = Ext.extend(Ext.util.Observable, {
constructor: function(root){
this.nodeHash = {};
/**
* The root node for this tree
* @type Node
*/
this.root = null;
if(root){
this.setRootNode(root);
}
this.addEvents(
/**
* @event append
* Fires when a new child node is appended to a node in this tree.
* @param {Tree} tree The owner tree
* @param {Node} parent The parent node
* @param {Node} node The newly appended node
* @param {Number} index The index of the newly appended node
*/
"append",
/**
* @event remove
* Fires when a child node is removed from a node in this tree.
* @param {Tree} tree The owner tree
* @param {Node} parent The parent node
* @param {Node} node The child node removed
*/
"remove",
/**
* @event move
* Fires when a node is moved to a new location in the tree
* @param {Tree} tree The owner tree
* @param {Node} node The node moved
* @param {Node} oldParent The old parent of this node
* @param {Node} newParent The new parent of this node
* @param {Number} index The index it was moved to
*/
"move",
/**
* @event insert
* Fires when a new child node is inserted in a node in this tree.
* @param {Tree} tree The owner tree
* @param {Node} parent The parent node
* @param {Node} node The child node inserted
* @param {Node} refNode The child node the node was inserted before
*/
"insert",
/**
* @event beforeappend
* Fires before a new child is appended to a node in this tree, return false to cancel the append.
* @param {Tree} tree The owner tree
* @param {Node} parent The parent node
* @param {Node} node The child node to be appended
*/
"beforeappend",
/**
* @event beforeremove
* Fires before a child is removed from a node in this tree, return false to cancel the remove.
* @param {Tree} tree The owner tree
* @param {Node} parent The parent node
* @param {Node} node The child node to be removed
*/
"beforeremove",
/**
* @event beforemove
* Fires before a node is moved to a new location in the tree. Return false to cancel the move.
* @param {Tree} tree The owner tree
* @param {Node} node The node being moved
* @param {Node} oldParent The parent of the node
* @param {Node} newParent The new parent the node is moving to
* @param {Number} index The index it is being moved to
*/
"beforemove",
/**
* @event beforeinsert
* Fires before a new child is inserted in a node in this tree, return false to cancel the insert.
* @param {Tree} tree The owner tree
* @param {Node} parent The parent node
* @param {Node} node The child node to be inserted
* @param {Node} refNode The child node the node is being inserted before
*/
"beforeinsert"
);
Ext.data.Tree.superclass.constructor.call(this);
},
/**
* @cfg {String} pathSeparator
* The token used to separate paths in node ids (defaults to '/').
*/
pathSeparator: "/",
// private
proxyNodeEvent : function(){
return this.fireEvent.apply(this, arguments);
},
/**
* Returns the root node for this tree.
* @return {Node}
*/
getRootNode : function(){
return this.root;
},
/**
* Sets the root node for this tree.
* @param {Node} node
* @return {Node}
*/
setRootNode : function(node){
this.root = node;
node.ownerTree = this;
node.isRoot = true;
this.registerNode(node);
return node;
},
/**
* Gets a node in this tree by its id.
* @param {String} id
* @return {Node}
*/
getNodeById : function(id){
return this.nodeHash[id];
},
// private
registerNode : function(node){
this.nodeHash[node.id] = node;
},
// private
unregisterNode : function(node){
delete this.nodeHash[node.id];
},
toString : function(){
return "[Tree"+(this.id?" "+this.id:"")+"]";
}
});
/**
* @class Ext.data.Node
* @extends Ext.util.Observable
* @cfg {Boolean} leaf true if this node is a leaf and does not have children
* @cfg {String} id The id for this node. If one is not specified, one is generated.
* @constructor
* @param {Object} attributes The attributes/config for the node
*/
Ext.data.Node = Ext.extend(Ext.util.Observable, {
constructor: function(attributes){
/**
* The attributes supplied for the node. You can use this property to access any custom attributes you supplied.
* @type {Object}
*/
this.attributes = attributes || {};
this.leaf = this.attributes.leaf;
/**
* The node id. @type String
*/
this.id = this.attributes.id;
if(!this.id){
this.id = Ext.id(null, "xnode-");
this.attributes.id = this.id;
}
/**
* All child nodes of this node. @type Array
*/
this.childNodes = [];
/**
* The parent node for this node. @type Node
*/
this.parentNode = null;
/**
* The first direct child node of this node, or null if this node has no child nodes. @type Node
*/
this.firstChild = null;
/**
* The last direct child node of this node, or null if this node has no child nodes. @type Node
*/
this.lastChild = null;
/**
* The node immediately preceding this node in the tree, or null if there is no sibling node. @type Node
*/
this.previousSibling = null;
/**
* The node immediately following this node in the tree, or null if there is no sibling node. @type Node
*/
this.nextSibling = null;
this.addEvents({
/**
* @event append
* Fires when a new child node is appended
* @param {Tree} tree The owner tree
* @param {Node} this This node
* @param {Node} node The newly appended node
* @param {Number} index The index of the newly appended node
*/
"append" : true,
/**
* @event remove
* Fires when a child node is removed
* @param {Tree} tree The owner tree
* @param {Node} this This node
* @param {Node} node The removed node
*/
"remove" : true,
/**
* @event move
* Fires when this node is moved to a new location in the tree
* @param {Tree} tree The owner tree
* @param {Node} this This node
* @param {Node} oldParent The old parent of this node
* @param {Node} newParent The new parent of this node
* @param {Number} index The index it was moved to
*/
"move" : true,
/**
* @event insert
* Fires when a new child node is inserted.
* @param {Tree} tree The owner tree
* @param {Node} this This node
* @param {Node} node The child node inserted
* @param {Node} refNode The child node the node was inserted before
*/
"insert" : true,
/**
* @event beforeappend
* Fires before a new child is appended, return false to cancel the append.
* @param {Tree} tree The owner tree
* @param {Node} this This node
* @param {Node} node The child node to be appended
*/
"beforeappend" : true,
/**
* @event beforeremove
* Fires before a child is removed, return false to cancel the remove.
* @param {Tree} tree The owner tree
* @param {Node} this This node
* @param {Node} node The child node to be removed
*/
"beforeremove" : true,
/**
* @event beforemove
* Fires before this node is moved to a new location in the tree. Return false to cancel the move.
* @param {Tree} tree The owner tree
* @param {Node} this This node
* @param {Node} oldParent The parent of this node
* @param {Node} newParent The new parent this node is moving to
* @param {Number} index The index it is being moved to
*/
"beforemove" : true,
/**
* @event beforeinsert
* Fires before a new child is inserted, return false to cancel the insert.
* @param {Tree} tree The owner tree
* @param {Node} this This node
* @param {Node} node The child node to be inserted
* @param {Node} refNode The child node the node is being inserted before
*/
"beforeinsert" : true
});
this.listeners = this.attributes.listeners;
Ext.data.Node.superclass.constructor.call(this);
},
// private
fireEvent : function(evtName){
// first do standard event for this node
if(Ext.data.Node.superclass.fireEvent.apply(this, arguments) === false){
return false;
}
// then bubble it up to the tree if the event wasn't cancelled
var ot = this.getOwnerTree();
if(ot){
if(ot.proxyNodeEvent.apply(ot, arguments) === false){
return false;
}
}
return true;
},
/**
* Returns true if this node is a leaf
* @return {Boolean}
*/
isLeaf : function(){
return this.leaf === true;
},
// private
setFirstChild : function(node){
this.firstChild = node;
},
//private
setLastChild : function(node){
this.lastChild = node;
},
/**
* Returns true if this node is the last child of its parent
* @return {Boolean}
*/
isLast : function(){
return (!this.parentNode ? true : this.parentNode.lastChild == this);
},
/**
* Returns true if this node is the first child of its parent
* @return {Boolean}
*/
isFirst : function(){
return (!this.parentNode ? true : this.parentNode.firstChild == this);
},
/**
* Returns true if this node has one or more child nodes, else false.
* @return {Boolean}
*/
hasChildNodes : function(){
return !this.isLeaf() && this.childNodes.length > 0;
},
/**
* Returns true if this node has one or more child nodes, or if the <tt>expandable</tt>
* node attribute is explicitly specified as true (see {@link #attributes}), otherwise returns false.
* @return {Boolean}
*/
isExpandable : function(){
return this.attributes.expandable || this.hasChildNodes();
},
/**
* Insert node(s) as the last child node of this node.
* @param {Node/Array} node The node or Array of nodes to append
* @return {Node} The appended node if single append, or null if an array was passed
*/
appendChild : function(node){
var multi = false;
if(Ext.isArray(node)){
multi = node;
}else if(arguments.length > 1){
multi = arguments;
}
// if passed an array or multiple args do them one by one
if(multi){
for(var i = 0, len = multi.length; i < len; i++) {
this.appendChild(multi[i]);
}
}else{
if(this.fireEvent("beforeappend", this.ownerTree, this, node) === false){
return false;
}
var index = this.childNodes.length;
var oldParent = node.parentNode;
// it's a move, make sure we move it cleanly
if(oldParent){
if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index) === false){
return false;
}
oldParent.removeChild(node);
}
index = this.childNodes.length;
if(index === 0){
this.setFirstChild(node);
}
this.childNodes.push(node);
node.parentNode = this;
var ps = this.childNodes[index-1];
if(ps){
node.previousSibling = ps;
ps.nextSibling = node;
}else{
node.previousSibling = null;
}
node.nextSibling = null;
this.setLastChild(node);
node.setOwnerTree(this.getOwnerTree());
this.fireEvent("append", this.ownerTree, this, node, index);
if(oldParent){
node.fireEvent("move", this.ownerTree, node, oldParent, this, index);
}
return node;
}
},
/**
* Removes a child node from this node.
* @param {Node} node The node to remove
* @param {Boolean} destroy <tt>true</tt> to destroy the node upon removal. Defaults to <tt>false</tt>.
* @return {Node} The removed node
*/
removeChild : function(node, destroy){
var index = this.childNodes.indexOf(node);
if(index == -1){
return false;
}
if(this.fireEvent("beforeremove", this.ownerTree, this, node) === false){
return false;
}
// remove it from childNodes collection
this.childNodes.splice(index, 1);
// update siblings
if(node.previousSibling){
node.previousSibling.nextSibling = node.nextSibling;
}
if(node.nextSibling){
node.nextSibling.previousSibling = node.previousSibling;
}
// update child refs
if(this.firstChild == node){
this.setFirstChild(node.nextSibling);
}
if(this.lastChild == node){
this.setLastChild(node.previousSibling);
}
this.fireEvent("remove", this.ownerTree, this, node);
if(destroy){
node.destroy(true);
}else{
node.clear();
}
return node;
},
// private
clear : function(destroy){
// clear any references from the node
this.setOwnerTree(null, destroy);
this.parentNode = this.previousSibling = this.nextSibling = null;
if(destroy){
this.firstChild = this.lastChild = null;
}
},
/**
* Destroys the node.
*/
destroy : function(/* private */ silent){
/*
* Silent is to be used in a number of cases
* 1) When setRootNode is called.
* 2) When destroy on the tree is called
* 3) For destroying child nodes on a node
*/
if(silent === true){
this.purgeListeners();
this.clear(true);
Ext.each(this.childNodes, function(n){
n.destroy(true);
});
this.childNodes = null;
}else{
this.remove(true);
}
},
/**
* Inserts the first node before the second node in this nodes childNodes collection.
* @param {Node} node The node to insert
* @param {Node} refNode The node to insert before (if null the node is appended)
* @return {Node} The inserted node
*/
insertBefore : function(node, refNode){
if(!refNode){ // like standard Dom, refNode can be null for append
return this.appendChild(node);
}
// nothing to do
if(node == refNode){
return false;
}
if(this.fireEvent("beforeinsert", this.ownerTree, this, node, refNode) === false){
return false;
}
var index = this.childNodes.indexOf(refNode);
var oldParent = node.parentNode;
var refIndex = index;
// when moving internally, indexes will change after remove
if(oldParent == this && this.childNodes.indexOf(node) < index){
refIndex--;
}
// it's a move, make sure we move it cleanly
if(oldParent){
if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index, refNode) === false){
return false;
}
oldParent.removeChild(node);
}
if(refIndex === 0){
this.setFirstChild(node);
}
this.childNodes.splice(refIndex, 0, node);
node.parentNode = this;
var ps = this.childNodes[refIndex-1];
if(ps){
node.previousSibling = ps;
ps.nextSibling = node;
}else{
node.previousSibling = null;
}
node.nextSibling = refNode;
refNode.previousSibling = node;
node.setOwnerTree(this.getOwnerTree());
this.fireEvent("insert", this.ownerTree, this, node, refNode);
if(oldParent){
node.fireEvent("move", this.ownerTree, node, oldParent, this, refIndex, refNode);
}
return node;
},
/**
* Removes this node from its parent
* @param {Boolean} destroy <tt>true</tt> to destroy the node upon removal. Defaults to <tt>false</tt>.
* @return {Node} this
*/
remove : function(destroy){
if (this.parentNode) {
this.parentNode.removeChild(this, destroy);
}
return this;
},
/**
* Removes all child nodes from this node.
* @param {Boolean} destroy <tt>true</tt> to destroy the node upon removal. Defaults to <tt>false</tt>.
* @return {Node} this
*/
removeAll : function(destroy){
var cn = this.childNodes,
n;
while((n = cn[0])){
this.removeChild(n, destroy);
}
return this;
},
/**
* Returns the child node at the specified index.
* @param {Number} index
* @return {Node}
*/
item : function(index){
return this.childNodes[index];
},
/**
* Replaces one child node in this node with another.
* @param {Node} newChild The replacement node
* @param {Node} oldChild The node to replace
* @return {Node} The replaced node
*/
replaceChild : function(newChild, oldChild){
var s = oldChild ? oldChild.nextSibling : null;
this.removeChild(oldChild);
this.insertBefore(newChild, s);
return oldChild;
},
/**
* Returns the index of a child node
* @param {Node} node
* @return {Number} The index of the node or -1 if it was not found
*/
indexOf : function(child){
return this.childNodes.indexOf(child);
},
/**
* Returns the tree this node is in.
* @return {Tree}
*/
getOwnerTree : function(){
// if it doesn't have one, look for one
if(!this.ownerTree){
var p = this;
while(p){
if(p.ownerTree){
this.ownerTree = p.ownerTree;
break;
}
p = p.parentNode;
}
}
return this.ownerTree;
},
/**
* Returns depth of this node (the root node has a depth of 0)
* @return {Number}
*/
getDepth : function(){
var depth = 0;
var p = this;
while(p.parentNode){
++depth;
p = p.parentNode;
}
return depth;
},
// private
setOwnerTree : function(tree, destroy){
// if it is a move, we need to update everyone
if(tree != this.ownerTree){
if(this.ownerTree){
this.ownerTree.unregisterNode(this);
}
this.ownerTree = tree;
// If we're destroying, we don't need to recurse since it will be called on each child node
if(destroy !== true){
Ext.each(this.childNodes, function(n){
n.setOwnerTree(tree);
});
}
if(tree){
tree.registerNode(this);
}
}
},
/**
* Changes the id of this node.
* @param {String} id The new id for the node.
*/
setId: function(id){
if(id !== this.id){
var t = this.ownerTree;
if(t){
t.unregisterNode(this);
}
this.id = this.attributes.id = id;
if(t){
t.registerNode(this);
}
this.onIdChange(id);
}
},
// private
onIdChange: Ext.emptyFn,
/**
* Returns the path for this node. The path can be used to expand or select this node programmatically.
* @param {String} attr (optional) The attr to use for the path (defaults to the node's id)
* @return {String} The path
*/
getPath : function(attr){
attr = attr || "id";
var p = this.parentNode;
var b = [this.attributes[attr]];
while(p){
b.unshift(p.attributes[attr]);
p = p.parentNode;
}
var sep = this.getOwnerTree().pathSeparator;
return sep + b.join(sep);
},
/**
* Bubbles up the tree from this node, calling the specified function with each node. The arguments to the function
* will be the args provided or the current node. If the function returns false at any point,
* the bubble is stopped.
* @param {Function} fn The function to call
* @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the current Node.
* @param {Array} args (optional) The args to call the function with (default to passing the current Node)
*/
bubble : function(fn, scope, args){
var p = this;
while(p){
if(fn.apply(scope || p, args || [p]) === false){
break;
}
p = p.parentNode;
}
},
/**
* Cascades down the tree from this node, calling the specified function with each node. The arguments to the function
* will be the args provided or the current node. If the function returns false at any point,
* the cascade is stopped on that branch.
* @param {Function} fn The function to call
* @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the current Node.
* @param {Array} args (optional) The args to call the function with (default to passing the current Node)
*/
cascade : function(fn, scope, args){
if(fn.apply(scope || this, args || [this]) !== false){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++) {
cs[i].cascade(fn, scope, args);
}
}
},
/**
* Interates the child nodes of this node, calling the specified function with each node. The arguments to the function
* will be the args provided or the current node. If the function returns false at any point,
* the iteration stops.
* @param {Function} fn The function to call
* @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the current Node in the iteration.
* @param {Array} args (optional) The args to call the function with (default to passing the current Node)
*/
eachChild : function(fn, scope, args){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++) {
if(fn.apply(scope || cs[i], args || [cs[i]]) === false){
break;
}
}
},
/**
* Finds the first child that has the attribute with the specified value.
* @param {String} attribute The attribute name
* @param {Mixed} value The value to search for
* @param {Boolean} deep (Optional) True to search through nodes deeper than the immediate children
* @return {Node} The found child or null if none was found
*/
findChild : function(attribute, value, deep){
return this.findChildBy(function(){
return this.attributes[attribute] == value;
}, null, deep);
},
/**
* Finds the first child by a custom function. The child matches if the function passed returns <code>true</code>.
* @param {Function} fn A function which must return <code>true</code> if the passed Node is the required Node.
* @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the Node being tested.
* @param {Boolean} deep (Optional) True to search through nodes deeper than the immediate children
* @return {Node} The found child or null if none was found
*/
findChildBy : function(fn, scope, deep){
var cs = this.childNodes,
len = cs.length,
i = 0,
n,
res;
for(; i < len; i++){
n = cs[i];
if(fn.call(scope || n, n) === true){
return n;
}else if (deep){
res = n.findChildBy(fn, scope, deep);
if(res != null){
return res;
}
}
}
return null;
},
/**
* Sorts this nodes children using the supplied sort function.
* @param {Function} fn A function which, when passed two Nodes, returns -1, 0 or 1 depending upon required sort order.
* @param {Object} scope (optional)The scope (<code>this</code> reference) in which the function is executed. Defaults to the browser window.
*/
sort : function(fn, scope){
var cs = this.childNodes;
var len = cs.length;
if(len > 0){
var sortFn = scope ? function(){fn.apply(scope, arguments);} : fn;
cs.sort(sortFn);
for(var i = 0; i < len; i++){
var n = cs[i];
n.previousSibling = cs[i-1];
n.nextSibling = cs[i+1];
if(i === 0){
this.setFirstChild(n);
}
if(i == len-1){
this.setLastChild(n);
}
}
}
},
/**
* Returns true if this node is an ancestor (at any point) of the passed node.
* @param {Node} node
* @return {Boolean}
*/
contains : function(node){
return node.isAncestor(this);
},
/**
* Returns true if the passed node is an ancestor (at any point) of this node.
* @param {Node} node
* @return {Boolean}
*/
isAncestor : function(node){
var p = this.parentNode;
while(p){
if(p == node){
return true;
}
p = p.parentNode;
}
return false;
},
toString : function(){
return "[Node"+(this.id?" "+this.id:"")+"]";
}
});

View File

@@ -1,187 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.Types
* <p>This is s static class containing the system-supplied data types which may be given to a {@link Ext.data.Field Field}.<p/>
* <p>The properties in this class are used as type indicators in the {@link Ext.data.Field Field} class, so to
* test whether a Field is of a certain type, compare the {@link Ext.data.Field#type type} property against properties
* of this class.</p>
* <p>Developers may add their own application-specific data types to this class. Definition names must be UPPERCASE.
* each type definition must contain three properties:</p>
* <div class="mdetail-params"><ul>
* <li><code>convert</code> : <i>Function</i><div class="sub-desc">A function to convert raw data values from a data block into the data
* to be stored in the Field. The function is passed the collowing parameters:
* <div class="mdetail-params"><ul>
* <li><b>v</b> : Mixed<div class="sub-desc">The data value as read by the Reader, if undefined will use
* the configured <tt>{@link Ext.data.Field#defaultValue defaultValue}</tt>.</div></li>
* <li><b>rec</b> : Mixed<div class="sub-desc">The data object containing the row as read by the Reader.
* Depending on the Reader type, this could be an Array ({@link Ext.data.ArrayReader ArrayReader}), an object
* ({@link Ext.data.JsonReader JsonReader}), or an XML element ({@link Ext.data.XMLReader XMLReader}).</div></li>
* </ul></div></div></li>
* <li><code>sortType</code> : <i>Function</i> <div class="sub-desc">A function to convert the stored data into comparable form, as defined by {@link Ext.data.SortTypes}.</div></li>
* <li><code>type</code> : <i>String</i> <div class="sub-desc">A textual data type name.</div></li>
* </ul></div>
* <p>For example, to create a VELatLong field (See the Microsoft Bing Mapping API) containing the latitude/longitude value of a datapoint on a map from a JsonReader data block
* which contained the properties <code>lat</code> and <code>long</code>, you would define a new data type like this:</p>
*<pre><code>
// Add a new Field data type which stores a VELatLong object in the Record.
Ext.data.Types.VELATLONG = {
convert: function(v, data) {
return new VELatLong(data.lat, data.long);
},
sortType: function(v) {
return v.Latitude; // When sorting, order by latitude
},
type: 'VELatLong'
};
</code></pre>
* <p>Then, when declaring a Record, use <pre><code>
var types = Ext.data.Types; // allow shorthand type access
UnitRecord = Ext.data.Record.create([
{ name: 'unitName', mapping: 'UnitName' },
{ name: 'curSpeed', mapping: 'CurSpeed', type: types.INT },
{ name: 'latitude', mapping: 'lat', type: types.FLOAT },
{ name: 'latitude', mapping: 'lat', type: types.FLOAT },
{ name: 'position', type: types.VELATLONG }
]);
</code></pre>
* @singleton
*/
Ext.data.Types = new function(){
var st = Ext.data.SortTypes;
Ext.apply(this, {
/**
* @type Regexp
* @property stripRe
* A regular expression for stripping non-numeric characters from a numeric value. Defaults to <tt>/[\$,%]/g</tt>.
* This should be overridden for localization.
*/
stripRe: /[\$,%]/g,
/**
* @type Object.
* @property AUTO
* This data type means that no conversion is applied to the raw data before it is placed into a Record.
*/
AUTO: {
convert: function(v){ return v; },
sortType: st.none,
type: 'auto'
},
/**
* @type Object.
* @property STRING
* This data type means that the raw data is converted into a String before it is placed into a Record.
*/
STRING: {
convert: function(v){ return (v === undefined || v === null) ? '' : String(v); },
sortType: st.asUCString,
type: 'string'
},
/**
* @type Object.
* @property INT
* This data type means that the raw data is converted into an integer before it is placed into a Record.
* <p>The synonym <code>INTEGER</code> is equivalent.</p>
*/
INT: {
convert: function(v){
return v !== undefined && v !== null && v !== '' ?
parseInt(String(v).replace(Ext.data.Types.stripRe, ''), 10) : (this.useNull ? null : 0);
},
sortType: st.none,
type: 'int'
},
/**
* @type Object.
* @property FLOAT
* This data type means that the raw data is converted into a number before it is placed into a Record.
* <p>The synonym <code>NUMBER</code> is equivalent.</p>
*/
FLOAT: {
convert: function(v){
return v !== undefined && v !== null && v !== '' ?
parseFloat(String(v).replace(Ext.data.Types.stripRe, ''), 10) : (this.useNull ? null : 0);
},
sortType: st.none,
type: 'float'
},
/**
* @type Object.
* @property BOOL
* <p>This data type means that the raw data is converted into a boolean before it is placed into
* a Record. The string "true" and the number 1 are converted to boolean <code>true</code>.</p>
* <p>The synonym <code>BOOLEAN</code> is equivalent.</p>
*/
BOOL: {
convert: function(v){ return v === true || v === 'true' || v == 1; },
sortType: st.none,
type: 'bool'
},
/**
* @type Object.
* @property DATE
* This data type means that the raw data is converted into a Date before it is placed into a Record.
* The date format is specified in the constructor of the {@link Ext.data.Field} to which this type is
* being applied.
*/
DATE: {
convert: function(v){
var df = this.dateFormat;
if(!v){
return null;
}
if(Ext.isDate(v)){
return v;
}
if(df){
if(df == 'timestamp'){
return new Date(v*1000);
}
if(df == 'time'){
return new Date(parseInt(v, 10));
}
return Date.parseDate(v, df);
}
var parsed = Date.parse(v);
return parsed ? new Date(parsed) : null;
},
sortType: st.asDate,
type: 'date'
}
});
Ext.apply(this, {
/**
* @type Object.
* @property BOOLEAN
* <p>This data type means that the raw data is converted into a boolean before it is placed into
* a Record. The string "true" and the number 1 are converted to boolean <code>true</code>.</p>
* <p>The synonym <code>BOOL</code> is equivalent.</p>
*/
BOOLEAN: this.BOOL,
/**
* @type Object.
* @property INTEGER
* This data type means that the raw data is converted into an integer before it is placed into a Record.
* <p>The synonym <code>INT</code> is equivalent.</p>
*/
INTEGER: this.INT,
/**
* @type Object.
* @property NUMBER
* This data type means that the raw data is converted into a number before it is placed into a Record.
* <p>The synonym <code>FLOAT</code> is equivalent.</p>
*/
NUMBER: this.FLOAT
});
};

View File

@@ -1,259 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.XmlReader
* @extends Ext.data.DataReader
* <p>Data reader class to create an Array of {@link Ext.data.Record} objects from an XML document
* based on mappings in a provided {@link Ext.data.Record} constructor.</p>
* <p><b>Note</b>: that in order for the browser to parse a returned XML document, the Content-Type
* header in the HTTP response must be set to "text/xml" or "application/xml".</p>
* <p>Example code:</p>
* <pre><code>
var Employee = Ext.data.Record.create([
{name: 'name', mapping: 'name'}, // "mapping" property not needed if it is the same as "name"
{name: 'occupation'} // This field will use "occupation" as the mapping.
]);
var myReader = new Ext.data.XmlReader({
totalProperty: "results", // The element which contains the total dataset size (optional)
record: "row", // The repeated element which contains row information
idProperty: "id" // The element within the row that provides an ID for the record (optional)
messageProperty: "msg" // The element within the response that provides a user-feedback message (optional)
}, Employee);
</code></pre>
* <p>
* This would consume an XML file like this:
* <pre><code>
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;dataset>
&lt;results>2&lt;/results>
&lt;row>
&lt;id>1&lt;/id>
&lt;name>Bill&lt;/name>
&lt;occupation>Gardener&lt;/occupation>
&lt;/row>
&lt;row>
&lt;id>2&lt;/id>
&lt;name>Ben&lt;/name>
&lt;occupation>Horticulturalist&lt;/occupation>
&lt;/row>
&lt;/dataset>
</code></pre>
* @cfg {String} totalProperty The DomQuery path from which to retrieve the total number of records
* in the dataset. This is only needed if the whole dataset is not passed in one go, but is being
* paged from the remote server.
* @cfg {String} record The DomQuery path to the repeated element which contains record information.
* @cfg {String} record The DomQuery path to the repeated element which contains record information.
* @cfg {String} successProperty The DomQuery path to the success attribute used by forms.
* @cfg {String} idPath The DomQuery path relative from the record element to the element that contains
* a record identifier value.
* @constructor
* Create a new XmlReader.
* @param {Object} meta Metadata configuration options
* @param {Object} recordType Either an Array of field definition objects as passed to
* {@link Ext.data.Record#create}, or a Record constructor object created using {@link Ext.data.Record#create}.
*/
Ext.data.XmlReader = function(meta, recordType){
meta = meta || {};
// backwards compat, convert idPath or id / success
Ext.applyIf(meta, {
idProperty: meta.idProperty || meta.idPath || meta.id,
successProperty: meta.successProperty || meta.success
});
Ext.data.XmlReader.superclass.constructor.call(this, meta, recordType || meta.fields);
};
Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, {
/**
* This method is only used by a DataProxy which has retrieved data from a remote server.
* @param {Object} response The XHR object which contains the parsed XML document. The response is expected
* to contain a property called <tt>responseXML</tt> which refers to an XML document object.
* @return {Object} records A data block which is used by an {@link Ext.data.Store} as
* a cache of Ext.data.Records.
*/
read : function(response){
var doc = response.responseXML;
if(!doc) {
throw {message: "XmlReader.read: XML Document not available"};
}
return this.readRecords(doc);
},
/**
* Create a data block containing Ext.data.Records from an XML document.
* @param {Object} doc A parsed XML document.
* @return {Object} records A data block which is used by an {@link Ext.data.Store} as
* a cache of Ext.data.Records.
*/
readRecords : function(doc){
/**
* After any data loads/reads, the raw XML Document is available for further custom processing.
* @type XMLDocument
*/
this.xmlData = doc;
var root = doc.documentElement || doc,
q = Ext.DomQuery,
totalRecords = 0,
success = true;
if(this.meta.totalProperty){
totalRecords = this.getTotal(root, 0);
}
if(this.meta.successProperty){
success = this.getSuccess(root);
}
var records = this.extractData(q.select(this.meta.record, root), true); // <-- true to return Ext.data.Record[]
// TODO return Ext.data.Response instance. @see #readResponse
return {
success : success,
records : records,
totalRecords : totalRecords || records.length
};
},
/**
* Decode an XML response from server.
* @param {String} action [{@link Ext.data.Api#actions} create|read|update|destroy]
* @param {Object} response HTTP Response object from browser.
* @return {Ext.data.Response} An instance of {@link Ext.data.Response}
*/
readResponse : function(action, response) {
var q = Ext.DomQuery,
doc = response.responseXML,
root = doc.documentElement || doc;
// create general Response instance.
var res = new Ext.data.Response({
action: action,
success : this.getSuccess(root),
message: this.getMessage(root),
data: this.extractData(q.select(this.meta.record, root) || q.select(this.meta.root, root), false),
raw: doc
});
if (Ext.isEmpty(res.success)) {
throw new Ext.data.DataReader.Error('successProperty-response', this.meta.successProperty);
}
// Create actions from a response having status 200 must return pk
if (action === Ext.data.Api.actions.create) {
var def = Ext.isDefined(res.data);
if (def && Ext.isEmpty(res.data)) {
throw new Ext.data.JsonReader.Error('root-empty', this.meta.root);
}
else if (!def) {
throw new Ext.data.JsonReader.Error('root-undefined-response', this.meta.root);
}
}
return res;
},
getSuccess : function() {
return true;
},
/**
* build response-data extractor functions.
* @private
* @ignore
*/
buildExtractors : function() {
if(this.ef){
return;
}
var s = this.meta,
Record = this.recordType,
f = Record.prototype.fields,
fi = f.items,
fl = f.length;
if(s.totalProperty) {
this.getTotal = this.createAccessor(s.totalProperty);
}
if(s.successProperty) {
this.getSuccess = this.createAccessor(s.successProperty);
}
if (s.messageProperty) {
this.getMessage = this.createAccessor(s.messageProperty);
}
this.getRoot = function(res) {
return (!Ext.isEmpty(res[this.meta.record])) ? res[this.meta.record] : res[this.meta.root];
};
if (s.idPath || s.idProperty) {
var g = this.createAccessor(s.idPath || s.idProperty);
this.getId = function(rec) {
var id = g(rec) || rec.id;
return (id === undefined || id === '') ? null : id;
};
} else {
this.getId = function(){return null;};
}
var ef = [];
for(var i = 0; i < fl; i++){
f = fi[i];
var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name;
ef.push(this.createAccessor(map));
}
this.ef = ef;
},
/**
* Creates a function to return some particular key of data from a response.
* @param {String} key
* @return {Function}
* @private
* @ignore
*/
createAccessor : function(){
var q = Ext.DomQuery;
return function(key) {
if (Ext.isFunction(key)) {
return key;
}
switch(key) {
case this.meta.totalProperty:
return function(root, def){
return q.selectNumber(key, root, def);
};
break;
case this.meta.successProperty:
return function(root, def) {
var sv = q.selectValue(key, root, true);
var success = sv !== false && sv !== 'false';
return success;
};
break;
default:
return function(root, def) {
return q.selectValue(key, root, def);
};
break;
}
};
}(),
/**
* extracts values and type-casts a row of data from server, extracted by #extractData
* @param {Hash} data
* @param {Ext.data.Field[]} items
* @param {Number} len
* @private
* @ignore
*/
extractValues : function(data, items, len) {
var f, values = {};
for(var j = 0; j < len; j++){
f = items[j];
var v = this.ef[j](data);
values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue, data);
}
return values;
}
});

View File

@@ -1,75 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.XmlStore
* @extends Ext.data.Store
* <p>Small helper class to make creating {@link Ext.data.Store}s from XML data easier.
* A XmlStore will be automatically configured with a {@link Ext.data.XmlReader}.</p>
* <p>A store configuration would be something like:<pre><code>
var store = new Ext.data.XmlStore({
// store configs
autoDestroy: true,
storeId: 'myStore',
url: 'sheldon.xml', // automatically configures a HttpProxy
// reader configs
record: 'Item', // records will have an "Item" tag
idPath: 'ASIN',
totalRecords: '@TotalResults'
fields: [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
{name: 'Author', mapping: 'ItemAttributes > Author'},
'Title', 'Manufacturer', 'ProductGroup'
]
});
* </code></pre></p>
* <p>This store is configured to consume a returned object of the form:<pre><code>
&#60?xml version="1.0" encoding="UTF-8"?>
&#60ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2009-05-15">
&#60Items>
&#60Request>
&#60IsValid>True&#60/IsValid>
&#60ItemSearchRequest>
&#60Author>Sidney Sheldon&#60/Author>
&#60SearchIndex>Books&#60/SearchIndex>
&#60/ItemSearchRequest>
&#60/Request>
&#60TotalResults>203&#60/TotalResults>
&#60TotalPages>21&#60/TotalPages>
&#60Item>
&#60ASIN>0446355453&#60/ASIN>
&#60DetailPageURL>
http://www.amazon.com/
&#60/DetailPageURL>
&#60ItemAttributes>
&#60Author>Sidney Sheldon&#60/Author>
&#60Manufacturer>Warner Books&#60/Manufacturer>
&#60ProductGroup>Book&#60/ProductGroup>
&#60Title>Master of the Game&#60/Title>
&#60/ItemAttributes>
&#60/Item>
&#60/Items>
&#60/ItemSearchResponse>
* </code></pre>
* An object literal of this form could also be used as the {@link #data} config option.</p>
* <p><b>Note:</b> Although not listed here, this class accepts all of the configuration options of
* <b>{@link Ext.data.XmlReader XmlReader}</b>.</p>
* @constructor
* @param {Object} config
* @xtype xmlstore
*/
Ext.data.XmlStore = Ext.extend(Ext.data.Store, {
/**
* @cfg {Ext.data.DataReader} reader @hide
*/
constructor: function(config){
Ext.data.XmlStore.superclass.constructor.call(this, Ext.apply(config, {
reader: new Ext.data.XmlReader(config)
}));
}
});
Ext.reg('xmlstore', Ext.data.XmlStore);

View File

@@ -1,158 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.data.XmlWriter
* @extends Ext.data.DataWriter
* DataWriter extension for writing an array or single {@link Ext.data.Record} object(s) in preparation for executing a remote CRUD action via XML.
* XmlWriter uses an instance of {@link Ext.XTemplate} for maximum flexibility in defining your own custom XML schema if the default schema is not appropriate for your needs.
* See the {@link #tpl} configuration-property.
*/
Ext.data.XmlWriter = function(params) {
Ext.data.XmlWriter.superclass.constructor.apply(this, arguments);
// compile the XTemplate for rendering XML documents.
this.tpl = (typeof(this.tpl) === 'string') ? new Ext.XTemplate(this.tpl).compile() : this.tpl.compile();
};
Ext.extend(Ext.data.XmlWriter, Ext.data.DataWriter, {
/**
* @cfg {String} documentRoot [xrequest] (Optional) The name of the XML document root-node. <b>Note:</b>
* this parameter is required </b>only when</b> sending extra {@link Ext.data.Store#baseParams baseParams} to the server
* during a write-request -- if no baseParams are set, the {@link Ext.data.XmlReader#record} meta-property can
* suffice as the XML document root-node for write-actions involving just a <b>single record</b>. For requests
* involving <b>multiple</b> records and <b>NO</b> baseParams, the {@link Ext.data.XmlWriter#root} property can
* act as the XML document root.
*/
documentRoot: 'xrequest',
/**
* @cfg {Boolean} forceDocumentRoot [false] Set to <tt>true</tt> to force XML documents having a root-node as defined
* by {@link #documentRoot}, even with no baseParams defined.
*/
forceDocumentRoot: false,
/**
* @cfg {String} root [records] The name of the containing element which will contain the nodes of an write-action involving <b>multiple</b> records. Each
* xml-record written to the server will be wrapped in an element named after {@link Ext.data.XmlReader#record} property.
* eg:
<code><pre>
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;user>&lt;first>Barney&lt;/first>&lt;/user>
</code></pre>
* However, when <b>multiple</b> records are written in a batch-operation, these records must be wrapped in a containing
* Element.
* eg:
<code><pre>
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;records>
&lt;first>Barney&lt;/first>&lt;/user>
&lt;records>&lt;first>Barney&lt;/first>&lt;/user>
&lt;/records>
</code></pre>
* Defaults to <tt>records</tt>. Do not confuse the nature of this property with that of {@link #documentRoot}
*/
root: 'records',
/**
* @cfg {String} xmlVersion [1.0] The <tt>version</tt> written to header of xml documents.
<code><pre>&lt;?xml version="1.0" encoding="ISO-8859-15"?></pre></code>
*/
xmlVersion : '1.0',
/**
* @cfg {String} xmlEncoding [ISO-8859-15] The <tt>encoding</tt> written to header of xml documents.
<code><pre>&lt;?xml version="1.0" encoding="ISO-8859-15"?></pre></code>
*/
xmlEncoding: 'ISO-8859-15',
/**
* @cfg {String/Ext.XTemplate} tpl The XML template used to render {@link Ext.data.Api#actions write-actions} to your server.
* <p>One can easily provide his/her own custom {@link Ext.XTemplate#constructor template-definition} if the default does not suffice.</p>
* <p>Defaults to:</p>
<code><pre>
&lt;?xml version="{version}" encoding="{encoding}"?>
&lt;tpl if="documentRoot">&lt;{documentRoot}>
&lt;tpl for="baseParams">
&lt;tpl for=".">
&lt;{name}>{value}&lt;/{name}>
&lt;/tpl>
&lt;/tpl>
&lt;tpl if="records.length &gt; 1">&lt;{root}>',
&lt;tpl for="records">
&lt;{parent.record}>
&lt;tpl for=".">
&lt;{name}>{value}&lt;/{name}>
&lt;/tpl>
&lt;/{parent.record}>
&lt;/tpl>
&lt;tpl if="records.length &gt; 1">&lt;/{root}>&lt;/tpl>
&lt;tpl if="documentRoot">&lt;/{documentRoot}>&lt;/tpl>
</pre></code>
* <p>Templates will be called with the following API</p>
* <ul>
* <li>{String} version [1.0] The xml version.</li>
* <li>{String} encoding [ISO-8859-15] The xml encoding.</li>
* <li>{String/false} documentRoot The XML document root-node name or <tt>false</tt> if not required. See {@link #documentRoot} and {@link #forceDocumentRoot}.</li>
* <li>{String} record The meta-data parameter defined on your {@link Ext.data.XmlReader#record} configuration represents the name of the xml-tag containing each record.</li>
* <li>{String} root The meta-data parameter defined by {@link Ext.data.XmlWriter#root} configuration-parameter. Represents the name of the xml root-tag when sending <b>multiple</b> records to the server.</li>
* <li>{Array} records The records being sent to the server, ie: the subject of the write-action being performed. The records parameter will be always be an array, even when only a single record is being acted upon.
* Each item within the records array will contain an array of field objects having the following properties:
* <ul>
* <li>{String} name The field-name of the record as defined by your {@link Ext.data.Record#create Ext.data.Record definition}. The "mapping" property will be used, otherwise it will match the "name" property. Use this parameter to define the XML tag-name of the property.</li>
* <li>{Mixed} value The record value of the field enclosed within XML tags specified by name property above.</li>
* </ul></li>
* <li>{Array} baseParams. The baseParams as defined upon {@link Ext.data.Store#baseParams}. Note that the baseParams have been converted into an array of [{name : "foo", value: "bar"}, ...] pairs in the same manner as the <b>records</b> parameter above. See {@link #documentRoot} and {@link #forceDocumentRoot}.</li>
* </ul>
*/
// Encoding the ? here in case it's being included by some kind of page that will parse it (eg. PHP)
tpl: '<tpl for="."><\u003fxml version="{version}" encoding="{encoding}"\u003f><tpl if="documentRoot"><{documentRoot}><tpl for="baseParams"><tpl for="."><{name}>{value}</{name}></tpl></tpl></tpl><tpl if="records.length&gt;1"><{root}></tpl><tpl for="records"><{parent.record}><tpl for="."><{name}>{value}</{name}></tpl></{parent.record}></tpl><tpl if="records.length&gt;1"></{root}></tpl><tpl if="documentRoot"></{documentRoot}></tpl></tpl>',
/**
* XmlWriter implementation of the final stage of a write action.
* @param {Object} params Transport-proxy's (eg: {@link Ext.Ajax#request}) params-object to write-to.
* @param {Object} baseParams as defined by {@link Ext.data.Store#baseParams}. The baseParms must be encoded by the extending class, eg: {@link Ext.data.JsonWriter}, {@link Ext.data.XmlWriter}.
* @param {Object/Object[]} data Data-object representing the compiled Store-recordset.
*/
render : function(params, baseParams, data) {
baseParams = this.toArray(baseParams);
params.xmlData = this.tpl.applyTemplate({
version: this.xmlVersion,
encoding: this.xmlEncoding,
documentRoot: (baseParams.length > 0 || this.forceDocumentRoot === true) ? this.documentRoot : false,
record: this.meta.record,
root: this.root,
baseParams: baseParams,
records: (Ext.isArray(data[0])) ? data : [data]
});
},
/**
* createRecord
* @protected
* @param {Ext.data.Record} rec
* @return {Array} Array of <tt>name:value</tt> pairs for attributes of the {@link Ext.data.Record}. See {@link Ext.data.DataWriter#toHash}.
*/
createRecord : function(rec) {
return this.toArray(this.toHash(rec));
},
/**
* updateRecord
* @protected
* @param {Ext.data.Record} rec
* @return {Array} Array of {name:value} pairs for attributes of the {@link Ext.data.Record}. See {@link Ext.data.DataWriter#toHash}.
*/
updateRecord : function(rec) {
return this.toArray(this.toHash(rec));
},
/**
* destroyRecord
* @protected
* @param {Ext.data.Record} rec
* @return {Array} Array containing a attribute-object (name/value pair) representing the {@link Ext.data.DataReader#idProperty idProperty}.
*/
destroyRecord : function(rec) {
var data = {};
data[this.meta.idProperty] = rec.id;
return this.toArray(data);
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,370 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.DragSource
* @extends Ext.dd.DDProxy
* A simple class that provides the basic implementation needed to make any element draggable.
* @constructor
* @param {Mixed} el The container element
* @param {Object} config
*/
Ext.dd.DragSource = function(el, config){
this.el = Ext.get(el);
if(!this.dragData){
this.dragData = {};
}
Ext.apply(this, config);
if(!this.proxy){
this.proxy = new Ext.dd.StatusProxy();
}
Ext.dd.DragSource.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
{dragElId : this.proxy.id, resizeFrame: false, isTarget: false, scroll: this.scroll === true});
this.dragging = false;
};
Ext.extend(Ext.dd.DragSource, Ext.dd.DDProxy, {
/**
* @cfg {String} ddGroup
* A named drag drop group to which this object belongs. If a group is specified, then this object will only
* interact with other drag drop objects in the same group (defaults to undefined).
*/
/**
* @cfg {String} dropAllowed
* The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").
*/
dropAllowed : "x-dd-drop-ok",
/**
* @cfg {String} dropNotAllowed
* The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").
*/
dropNotAllowed : "x-dd-drop-nodrop",
/**
* Returns the data object associated with this drag source
* @return {Object} data An object containing arbitrary data
*/
getDragData : function(e){
return this.dragData;
},
// private
onDragEnter : function(e, id){
var target = Ext.dd.DragDropMgr.getDDById(id);
this.cachedTarget = target;
if(this.beforeDragEnter(target, e, id) !== false){
if(target.isNotifyTarget){
var status = target.notifyEnter(this, e, this.dragData);
this.proxy.setStatus(status);
}else{
this.proxy.setStatus(this.dropAllowed);
}
if(this.afterDragEnter){
/**
* An empty function by default, but provided so that you can perform a custom action
* when the dragged item enters the drop target by providing an implementation.
* @param {Ext.dd.DragDrop} target The drop target
* @param {Event} e The event object
* @param {String} id The id of the dragged element
* @method afterDragEnter
*/
this.afterDragEnter(target, e, id);
}
}
},
/**
* An empty function by default, but provided so that you can perform a custom action
* before the dragged item enters the drop target and optionally cancel the onDragEnter.
* @param {Ext.dd.DragDrop} target The drop target
* @param {Event} e The event object
* @param {String} id The id of the dragged element
* @return {Boolean} isValid True if the drag event is valid, else false to cancel
*/
beforeDragEnter : function(target, e, id){
return true;
},
// private
alignElWithMouse: function() {
Ext.dd.DragSource.superclass.alignElWithMouse.apply(this, arguments);
this.proxy.sync();
},
// private
onDragOver : function(e, id){
var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
if(this.beforeDragOver(target, e, id) !== false){
if(target.isNotifyTarget){
var status = target.notifyOver(this, e, this.dragData);
this.proxy.setStatus(status);
}
if(this.afterDragOver){
/**
* An empty function by default, but provided so that you can perform a custom action
* while the dragged item is over the drop target by providing an implementation.
* @param {Ext.dd.DragDrop} target The drop target
* @param {Event} e The event object
* @param {String} id The id of the dragged element
* @method afterDragOver
*/
this.afterDragOver(target, e, id);
}
}
},
/**
* An empty function by default, but provided so that you can perform a custom action
* while the dragged item is over the drop target and optionally cancel the onDragOver.
* @param {Ext.dd.DragDrop} target The drop target
* @param {Event} e The event object
* @param {String} id The id of the dragged element
* @return {Boolean} isValid True if the drag event is valid, else false to cancel
*/
beforeDragOver : function(target, e, id){
return true;
},
// private
onDragOut : function(e, id){
var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
if(this.beforeDragOut(target, e, id) !== false){
if(target.isNotifyTarget){
target.notifyOut(this, e, this.dragData);
}
this.proxy.reset();
if(this.afterDragOut){
/**
* An empty function by default, but provided so that you can perform a custom action
* after the dragged item is dragged out of the target without dropping.
* @param {Ext.dd.DragDrop} target The drop target
* @param {Event} e The event object
* @param {String} id The id of the dragged element
* @method afterDragOut
*/
this.afterDragOut(target, e, id);
}
}
this.cachedTarget = null;
},
/**
* An empty function by default, but provided so that you can perform a custom action before the dragged
* item is dragged out of the target without dropping, and optionally cancel the onDragOut.
* @param {Ext.dd.DragDrop} target The drop target
* @param {Event} e The event object
* @param {String} id The id of the dragged element
* @return {Boolean} isValid True if the drag event is valid, else false to cancel
*/
beforeDragOut : function(target, e, id){
return true;
},
// private
onDragDrop : function(e, id){
var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
if(this.beforeDragDrop(target, e, id) !== false){
if(target.isNotifyTarget){
if(target.notifyDrop(this, e, this.dragData)){ // valid drop?
this.onValidDrop(target, e, id);
}else{
this.onInvalidDrop(target, e, id);
}
}else{
this.onValidDrop(target, e, id);
}
if(this.afterDragDrop){
/**
* An empty function by default, but provided so that you can perform a custom action
* after a valid drag drop has occurred by providing an implementation.
* @param {Ext.dd.DragDrop} target The drop target
* @param {Event} e The event object
* @param {String} id The id of the dropped element
* @method afterDragDrop
*/
this.afterDragDrop(target, e, id);
}
}
delete this.cachedTarget;
},
/**
* An empty function by default, but provided so that you can perform a custom action before the dragged
* item is dropped onto the target and optionally cancel the onDragDrop.
* @param {Ext.dd.DragDrop} target The drop target
* @param {Event} e The event object
* @param {String} id The id of the dragged element
* @return {Boolean} isValid True if the drag drop event is valid, else false to cancel
*/
beforeDragDrop : function(target, e, id){
return true;
},
// private
onValidDrop : function(target, e, id){
this.hideProxy();
if(this.afterValidDrop){
/**
* An empty function by default, but provided so that you can perform a custom action
* after a valid drop has occurred by providing an implementation.
* @param {Object} target The target DD
* @param {Event} e The event object
* @param {String} id The id of the dropped element
* @method afterInvalidDrop
*/
this.afterValidDrop(target, e, id);
}
},
// private
getRepairXY : function(e, data){
return this.el.getXY();
},
// private
onInvalidDrop : function(target, e, id){
this.beforeInvalidDrop(target, e, id);
if(this.cachedTarget){
if(this.cachedTarget.isNotifyTarget){
this.cachedTarget.notifyOut(this, e, this.dragData);
}
this.cacheTarget = null;
}
this.proxy.repair(this.getRepairXY(e, this.dragData), this.afterRepair, this);
if(this.afterInvalidDrop){
/**
* An empty function by default, but provided so that you can perform a custom action
* after an invalid drop has occurred by providing an implementation.
* @param {Event} e The event object
* @param {String} id The id of the dropped element
* @method afterInvalidDrop
*/
this.afterInvalidDrop(e, id);
}
},
// private
afterRepair : function(){
if(Ext.enableFx){
this.el.highlight(this.hlColor || "c3daf9");
}
this.dragging = false;
},
/**
* An empty function by default, but provided so that you can perform a custom action after an invalid
* drop has occurred.
* @param {Ext.dd.DragDrop} target The drop target
* @param {Event} e The event object
* @param {String} id The id of the dragged element
* @return {Boolean} isValid True if the invalid drop should proceed, else false to cancel
*/
beforeInvalidDrop : function(target, e, id){
return true;
},
// private
handleMouseDown : function(e){
if(this.dragging) {
return;
}
var data = this.getDragData(e);
if(data && this.onBeforeDrag(data, e) !== false){
this.dragData = data;
this.proxy.stop();
Ext.dd.DragSource.superclass.handleMouseDown.apply(this, arguments);
}
},
/**
* An empty function by default, but provided so that you can perform a custom action before the initial
* drag event begins and optionally cancel it.
* @param {Object} data An object containing arbitrary data to be shared with drop targets
* @param {Event} e The event object
* @return {Boolean} isValid True if the drag event is valid, else false to cancel
*/
onBeforeDrag : function(data, e){
return true;
},
/**
* An empty function by default, but provided so that you can perform a custom action once the initial
* drag event has begun. The drag cannot be canceled from this function.
* @param {Number} x The x position of the click on the dragged object
* @param {Number} y The y position of the click on the dragged object
*/
onStartDrag : Ext.emptyFn,
// private override
startDrag : function(x, y){
this.proxy.reset();
this.dragging = true;
this.proxy.update("");
this.onInitDrag(x, y);
this.proxy.show();
},
// private
onInitDrag : function(x, y){
var clone = this.el.dom.cloneNode(true);
clone.id = Ext.id(); // prevent duplicate ids
this.proxy.update(clone);
this.onStartDrag(x, y);
return true;
},
/**
* Returns the drag source's underlying {@link Ext.dd.StatusProxy}
* @return {Ext.dd.StatusProxy} proxy The StatusProxy
*/
getProxy : function(){
return this.proxy;
},
/**
* Hides the drag source's {@link Ext.dd.StatusProxy}
*/
hideProxy : function(){
this.proxy.hide();
this.proxy.reset(true);
this.dragging = false;
},
// private
triggerCacheRefresh : function(){
Ext.dd.DDM.refreshCache(this.groups);
},
// private - override to prevent hiding
b4EndDrag: function(e) {
},
// private - override to prevent moving
endDrag : function(e){
this.onEndDrag(this.dragData, e);
},
// private
onEndDrag : function(data, e){
},
// private - pin to cursor
autoOffset : function(x, y) {
this.setDelta(-12, -20);
},
destroy: function(){
Ext.dd.DragSource.superclass.destroy.call(this);
Ext.destroy(this.proxy);
}
});

View File

@@ -1,251 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.DragTracker
* @extends Ext.util.Observable
* A DragTracker listens for drag events on an Element and fires events at the start and end of the drag,
* as well as during the drag. This is useful for components such as {@link Ext.slider.MultiSlider}, where there is
* an element that can be dragged around to change the Slider's value.
* DragTracker provides a series of template methods that should be overridden to provide functionality
* in response to detected drag operations. These are onBeforeStart, onStart, onDrag and onEnd.
* See {@link Ext.slider.MultiSlider}'s initEvents function for an example implementation.
*/
Ext.dd.DragTracker = Ext.extend(Ext.util.Observable, {
/**
* @cfg {Boolean} active
* Defaults to <tt>false</tt>.
*/
active: false,
/**
* @cfg {Number} tolerance
* Number of pixels the drag target must be moved before dragging is considered to have started. Defaults to <tt>5</tt>.
*/
tolerance: 5,
/**
* @cfg {Boolean/Number} autoStart
* Defaults to <tt>false</tt>. Specify <tt>true</tt> to defer trigger start by 1000 ms.
* Specify a Number for the number of milliseconds to defer trigger start.
*/
autoStart: false,
constructor : function(config){
Ext.apply(this, config);
this.addEvents(
/**
* @event mousedown
* @param {Object} this
* @param {Object} e event object
*/
'mousedown',
/**
* @event mouseup
* @param {Object} this
* @param {Object} e event object
*/
'mouseup',
/**
* @event mousemove
* @param {Object} this
* @param {Object} e event object
*/
'mousemove',
/**
* @event dragstart
* @param {Object} this
* @param {Object} e event object
*/
'dragstart',
/**
* @event dragend
* @param {Object} this
* @param {Object} e event object
*/
'dragend',
/**
* @event drag
* @param {Object} this
* @param {Object} e event object
*/
'drag'
);
this.dragRegion = new Ext.lib.Region(0,0,0,0);
if(this.el){
this.initEl(this.el);
}
Ext.dd.DragTracker.superclass.constructor.call(this, config);
},
initEl: function(el){
this.el = Ext.get(el);
el.on('mousedown', this.onMouseDown, this,
this.delegate ? {delegate: this.delegate} : undefined);
},
destroy : function(){
this.el.un('mousedown', this.onMouseDown, this);
delete this.el;
},
onMouseDown: function(e, target){
if(this.fireEvent('mousedown', this, e) !== false && this.onBeforeStart(e) !== false){
this.startXY = this.lastXY = e.getXY();
this.dragTarget = this.delegate ? target : this.el.dom;
if(this.preventDefault !== false){
e.preventDefault();
}
Ext.getDoc().on({
scope: this,
mouseup: this.onMouseUp,
mousemove: this.onMouseMove,
selectstart: this.stopSelect
});
if(this.autoStart){
this.timer = this.triggerStart.defer(this.autoStart === true ? 1000 : this.autoStart, this, [e]);
}
}
},
onMouseMove: function(e, target){
// HACK: IE hack to see if button was released outside of window. */
if(this.active && Ext.isIE && !e.browserEvent.button){
e.preventDefault();
this.onMouseUp(e);
return;
}
e.preventDefault();
var xy = e.getXY(), s = this.startXY;
this.lastXY = xy;
if(!this.active){
if(Math.abs(s[0]-xy[0]) > this.tolerance || Math.abs(s[1]-xy[1]) > this.tolerance){
this.triggerStart(e);
}else{
return;
}
}
this.fireEvent('mousemove', this, e);
this.onDrag(e);
this.fireEvent('drag', this, e);
},
onMouseUp: function(e) {
var doc = Ext.getDoc(),
wasActive = this.active;
doc.un('mousemove', this.onMouseMove, this);
doc.un('mouseup', this.onMouseUp, this);
doc.un('selectstart', this.stopSelect, this);
e.preventDefault();
this.clearStart();
this.active = false;
delete this.elRegion;
this.fireEvent('mouseup', this, e);
if(wasActive){
this.onEnd(e);
this.fireEvent('dragend', this, e);
}
},
triggerStart: function(e) {
this.clearStart();
this.active = true;
this.onStart(e);
this.fireEvent('dragstart', this, e);
},
clearStart : function() {
if(this.timer){
clearTimeout(this.timer);
delete this.timer;
}
},
stopSelect : function(e) {
e.stopEvent();
return false;
},
/**
* Template method which should be overridden by each DragTracker instance. Called when the user first clicks and
* holds the mouse button down. Return false to disallow the drag
* @param {Ext.EventObject} e The event object
*/
onBeforeStart : function(e) {
},
/**
* Template method which should be overridden by each DragTracker instance. Called when a drag operation starts
* (e.g. the user has moved the tracked element beyond the specified tolerance)
* @param {Ext.EventObject} e The event object
*/
onStart : function(xy) {
},
/**
* Template method which should be overridden by each DragTracker instance. Called whenever a drag has been detected.
* @param {Ext.EventObject} e The event object
*/
onDrag : function(e) {
},
/**
* Template method which should be overridden by each DragTracker instance. Called when a drag operation has been completed
* (e.g. the user clicked and held the mouse down, dragged the element and then released the mouse button)
* @param {Ext.EventObject} e The event object
*/
onEnd : function(e) {
},
/**
* Returns the drag target
* @return {Ext.Element} The element currently being tracked
*/
getDragTarget : function(){
return this.dragTarget;
},
getDragCt : function(){
return this.el;
},
getXY : function(constrain){
return constrain ?
this.constrainModes[constrain].call(this, this.lastXY) : this.lastXY;
},
getOffset : function(constrain){
var xy = this.getXY(constrain),
s = this.startXY;
return [s[0]-xy[0], s[1]-xy[1]];
},
constrainModes: {
'point' : function(xy){
if(!this.elRegion){
this.elRegion = this.getDragCt().getRegion();
}
var dr = this.dragRegion;
dr.left = xy[0];
dr.top = xy[1];
dr.right = xy[0];
dr.bottom = xy[1];
dr.constrainTo(this.elRegion);
return [dr.left, dr.top];
}
}
});

View File

@@ -1,141 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.DragZone
* @extends Ext.dd.DragSource
* <p>This class provides a container DD instance that allows dragging of multiple child source nodes.</p>
* <p>This class does not move the drag target nodes, but a proxy element which may contain
* any DOM structure you wish. The DOM element to show in the proxy is provided by either a
* provided implementation of {@link #getDragData}, or by registered draggables registered with {@link Ext.dd.Registry}</p>
* <p>If you wish to provide draggability for an arbitrary number of DOM nodes, each of which represent some
* application object (For example nodes in a {@link Ext.DataView DataView}) then use of this class
* is the most efficient way to "activate" those nodes.</p>
* <p>By default, this class requires that draggable child nodes are registered with {@link Ext.dd.Registry}.
* However a simpler way to allow a DragZone to manage any number of draggable elements is to configure
* the DragZone with an implementation of the {@link #getDragData} method which interrogates the passed
* mouse event to see if it has taken place within an element, or class of elements. This is easily done
* by using the event's {@link Ext.EventObject#getTarget getTarget} method to identify a node based on a
* {@link Ext.DomQuery} selector. For example, to make the nodes of a DataView draggable, use the following
* technique. Knowledge of the use of the DataView is required:</p><pre><code>
myDataView.on('render', function(v) {
myDataView.dragZone = new Ext.dd.DragZone(v.getEl(), {
// On receipt of a mousedown event, see if it is within a DataView node.
// Return a drag data object if so.
getDragData: function(e) {
// Use the DataView's own itemSelector (a mandatory property) to
// test if the mousedown is within one of the DataView's nodes.
var sourceEl = e.getTarget(v.itemSelector, 10);
// If the mousedown is within a DataView node, clone the node to produce
// a ddel element for use by the drag proxy. Also add application data
// to the returned data object.
if (sourceEl) {
d = sourceEl.cloneNode(true);
d.id = Ext.id();
return {
ddel: d,
sourceEl: sourceEl,
repairXY: Ext.fly(sourceEl).getXY(),
sourceStore: v.store,
draggedRecord: v.{@link Ext.DataView#getRecord getRecord}(sourceEl)
}
}
},
// Provide coordinates for the proxy to slide back to on failed drag.
// This is the original XY coordinates of the draggable element captured
// in the getDragData method.
getRepairXY: function() {
return this.dragData.repairXY;
}
});
});</code></pre>
* See the {@link Ext.dd.DropZone DropZone} documentation for details about building a DropZone which
* cooperates with this DragZone.
* @constructor
* @param {Mixed} el The container element
* @param {Object} config
*/
Ext.dd.DragZone = Ext.extend(Ext.dd.DragSource, {
constructor : function(el, config){
Ext.dd.DragZone.superclass.constructor.call(this, el, config);
if(this.containerScroll){
Ext.dd.ScrollManager.register(this.el);
}
},
/**
* This property contains the data representing the dragged object. This data is set up by the implementation
* of the {@link #getDragData} method. It must contain a <tt>ddel</tt> property, but can contain
* any other data according to the application's needs.
* @type Object
* @property dragData
*/
/**
* @cfg {Boolean} containerScroll True to register this container with the Scrollmanager
* for auto scrolling during drag operations.
*/
/**
* @cfg {String} hlColor The color to use when visually highlighting the drag source in the afterRepair
* method after a failed drop (defaults to "c3daf9" - light blue)
*/
/**
* Called when a mousedown occurs in this container. Looks in {@link Ext.dd.Registry}
* for a valid target to drag based on the mouse down. Override this method
* to provide your own lookup logic (e.g. finding a child by class name). Make sure your returned
* object has a "ddel" attribute (with an HTML Element) for other functions to work.
* @param {EventObject} e The mouse down event
* @return {Object} The dragData
*/
getDragData : function(e){
return Ext.dd.Registry.getHandleFromEvent(e);
},
/**
* Called once drag threshold has been reached to initialize the proxy element. By default, it clones the
* this.dragData.ddel
* @param {Number} x The x position of the click on the dragged object
* @param {Number} y The y position of the click on the dragged object
* @return {Boolean} true to continue the drag, false to cancel
*/
onInitDrag : function(x, y){
this.proxy.update(this.dragData.ddel.cloneNode(true));
this.onStartDrag(x, y);
return true;
},
/**
* Called after a repair of an invalid drop. By default, highlights this.dragData.ddel
*/
afterRepair : function(){
if(Ext.enableFx){
Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");
}
this.dragging = false;
},
/**
* Called before a repair of an invalid drop to get the XY to animate to. By default returns
* the XY of this.dragData.ddel
* @param {EventObject} e The mouse up event
* @return {Array} The xy location (e.g. [100, 200])
*/
getRepairXY : function(e){
return Ext.Element.fly(this.dragData.ddel).getXY();
},
destroy : function(){
Ext.dd.DragZone.superclass.destroy.call(this);
if(this.containerScroll){
Ext.dd.ScrollManager.unregister(this.el);
}
}
});

View File

@@ -1,122 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.DropTarget
* @extends Ext.dd.DDTarget
* A simple class that provides the basic implementation needed to make any element a drop target that can have
* draggable items dropped onto it. The drop has no effect until an implementation of notifyDrop is provided.
* @constructor
* @param {Mixed} el The container element
* @param {Object} config
*/
Ext.dd.DropTarget = Ext.extend(Ext.dd.DDTarget, {
constructor : function(el, config){
this.el = Ext.get(el);
Ext.apply(this, config);
if(this.containerScroll){
Ext.dd.ScrollManager.register(this.el);
}
Ext.dd.DropTarget.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
{isTarget: true});
},
/**
* @cfg {String} ddGroup
* A named drag drop group to which this object belongs. If a group is specified, then this object will only
* interact with other drag drop objects in the same group (defaults to undefined).
*/
/**
* @cfg {String} overClass
* The CSS class applied to the drop target element while the drag source is over it (defaults to "").
*/
/**
* @cfg {String} dropAllowed
* The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").
*/
dropAllowed : "x-dd-drop-ok",
/**
* @cfg {String} dropNotAllowed
* The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").
*/
dropNotAllowed : "x-dd-drop-nodrop",
// private
isTarget : true,
// private
isNotifyTarget : true,
/**
* The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source is now over the
* target. This default implementation adds the CSS class specified by overClass (if any) to the drop element
* and returns the dropAllowed config value. This method should be overridden if drop validation is required.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {String} status The CSS class that communicates the drop status back to the source so that the
* underlying {@link Ext.dd.StatusProxy} can be updated
*/
notifyEnter : function(dd, e, data){
if(this.overClass){
this.el.addClass(this.overClass);
}
return this.dropAllowed;
},
/**
* The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the target.
* This method will be called on every mouse movement while the drag source is over the drop target.
* This default implementation simply returns the dropAllowed config value.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {String} status The CSS class that communicates the drop status back to the source so that the
* underlying {@link Ext.dd.StatusProxy} can be updated
*/
notifyOver : function(dd, e, data){
return this.dropAllowed;
},
/**
* The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source has been dragged
* out of the target without dropping. This default implementation simply removes the CSS class specified by
* overClass (if any) from the drop element.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
*/
notifyOut : function(dd, e, data){
if(this.overClass){
this.el.removeClass(this.overClass);
}
},
/**
* The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the dragged item has
* been dropped on it. This method has no default implementation and returns false, so you must provide an
* implementation that does something to process the drop event and returns true so that the drag source's
* repair action does not run.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {Boolean} True if the drop was valid, else false
*/
notifyDrop : function(dd, e, data){
return false;
},
destroy : function(){
Ext.dd.DropTarget.superclass.destroy.call(this);
if(this.containerScroll){
Ext.dd.ScrollManager.unregister(this.el);
}
}
});

View File

@@ -1,262 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.DropZone
* @extends Ext.dd.DropTarget
* <p>This class provides a container DD instance that allows dropping on multiple child target nodes.</p>
* <p>By default, this class requires that child nodes accepting drop are registered with {@link Ext.dd.Registry}.
* However a simpler way to allow a DropZone to manage any number of target elements is to configure the
* DropZone with an implementation of {@link #getTargetFromEvent} which interrogates the passed
* mouse event to see if it has taken place within an element, or class of elements. This is easily done
* by using the event's {@link Ext.EventObject#getTarget getTarget} method to identify a node based on a
* {@link Ext.DomQuery} selector.</p>
* <p>Once the DropZone has detected through calling getTargetFromEvent, that the mouse is over
* a drop target, that target is passed as the first parameter to {@link #onNodeEnter}, {@link #onNodeOver},
* {@link #onNodeOut}, {@link #onNodeDrop}. You may configure the instance of DropZone with implementations
* of these methods to provide application-specific behaviour for these events to update both
* application state, and UI state.</p>
* <p>For example to make a GridPanel a cooperating target with the example illustrated in
* {@link Ext.dd.DragZone DragZone}, the following technique might be used:</p><pre><code>
myGridPanel.on('render', function() {
myGridPanel.dropZone = new Ext.dd.DropZone(myGridPanel.getView().scroller, {
// If the mouse is over a grid row, return that node. This is
// provided as the "target" parameter in all "onNodeXXXX" node event handling functions
getTargetFromEvent: function(e) {
return e.getTarget(myGridPanel.getView().rowSelector);
},
// On entry into a target node, highlight that node.
onNodeEnter : function(target, dd, e, data){
Ext.fly(target).addClass('my-row-highlight-class');
},
// On exit from a target node, unhighlight that node.
onNodeOut : function(target, dd, e, data){
Ext.fly(target).removeClass('my-row-highlight-class');
},
// While over a target node, return the default drop allowed class which
// places a "tick" icon into the drag proxy.
onNodeOver : function(target, dd, e, data){
return Ext.dd.DropZone.prototype.dropAllowed;
},
// On node drop we can interrogate the target to find the underlying
// application object that is the real target of the dragged data.
// In this case, it is a Record in the GridPanel's Store.
// We can use the data set up by the DragZone's getDragData method to read
// any data we decided to attach in the DragZone's getDragData method.
onNodeDrop : function(target, dd, e, data){
var rowIndex = myGridPanel.getView().findRowIndex(target);
var r = myGridPanel.getStore().getAt(rowIndex);
Ext.Msg.alert('Drop gesture', 'Dropped Record id ' + data.draggedRecord.id +
' on Record id ' + r.id);
return true;
}
});
}
</code></pre>
* See the {@link Ext.dd.DragZone DragZone} documentation for details about building a DragZone which
* cooperates with this DropZone.
* @constructor
* @param {Mixed} el The container element
* @param {Object} config
*/
Ext.dd.DropZone = function(el, config){
Ext.dd.DropZone.superclass.constructor.call(this, el, config);
};
Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, {
/**
* Returns a custom data object associated with the DOM node that is the target of the event. By default
* this looks up the event target in the {@link Ext.dd.Registry}, although you can override this method to
* provide your own custom lookup.
* @param {Event} e The event
* @return {Object} data The custom data
*/
getTargetFromEvent : function(e){
return Ext.dd.Registry.getTargetFromEvent(e);
},
/**
* Called when the DropZone determines that a {@link Ext.dd.DragSource} has entered a drop node
* that has either been registered or detected by a configured implementation of {@link #getTargetFromEvent}.
* This method has no default implementation and should be overridden to provide
* node-specific processing if necessary.
* @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
* {@link #getTargetFromEvent} for this node)
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
*/
onNodeEnter : function(n, dd, e, data){
},
/**
* Called while the DropZone determines that a {@link Ext.dd.DragSource} is over a drop node
* that has either been registered or detected by a configured implementation of {@link #getTargetFromEvent}.
* The default implementation returns this.dropNotAllowed, so it should be
* overridden to provide the proper feedback.
* @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
* {@link #getTargetFromEvent} for this node)
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {String} status The CSS class that communicates the drop status back to the source so that the
* underlying {@link Ext.dd.StatusProxy} can be updated
*/
onNodeOver : function(n, dd, e, data){
return this.dropAllowed;
},
/**
* Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dragged out of
* the drop node without dropping. This method has no default implementation and should be overridden to provide
* node-specific processing if necessary.
* @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
* {@link #getTargetFromEvent} for this node)
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
*/
onNodeOut : function(n, dd, e, data){
},
/**
* Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dropped onto
* the drop node. The default implementation returns false, so it should be overridden to provide the
* appropriate processing of the drop event and return true so that the drag source's repair action does not run.
* @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
* {@link #getTargetFromEvent} for this node)
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {Boolean} True if the drop was valid, else false
*/
onNodeDrop : function(n, dd, e, data){
return false;
},
/**
* Called while the DropZone determines that a {@link Ext.dd.DragSource} is being dragged over it,
* but not over any of its registered drop nodes. The default implementation returns this.dropNotAllowed, so
* it should be overridden to provide the proper feedback if necessary.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {String} status The CSS class that communicates the drop status back to the source so that the
* underlying {@link Ext.dd.StatusProxy} can be updated
*/
onContainerOver : function(dd, e, data){
return this.dropNotAllowed;
},
/**
* Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dropped on it,
* but not on any of its registered drop nodes. The default implementation returns false, so it should be
* overridden to provide the appropriate processing of the drop event if you need the drop zone itself to
* be able to accept drops. It should return true when valid so that the drag source's repair action does not run.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {Boolean} True if the drop was valid, else false
*/
onContainerDrop : function(dd, e, data){
return false;
},
/**
* The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the source is now over
* the zone. The default implementation returns this.dropNotAllowed and expects that only registered drop
* nodes can process drag drop operations, so if you need the drop zone itself to be able to process drops
* you should override this method and provide a custom implementation.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {String} status The CSS class that communicates the drop status back to the source so that the
* underlying {@link Ext.dd.StatusProxy} can be updated
*/
notifyEnter : function(dd, e, data){
return this.dropNotAllowed;
},
/**
* The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the drop zone.
* This method will be called on every mouse movement while the drag source is over the drop zone.
* It will call {@link #onNodeOver} while the drag source is over a registered node, and will also automatically
* delegate to the appropriate node-specific methods as necessary when the drag source enters and exits
* registered nodes ({@link #onNodeEnter}, {@link #onNodeOut}). If the drag source is not currently over a
* registered node, it will call {@link #onContainerOver}.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {String} status The CSS class that communicates the drop status back to the source so that the
* underlying {@link Ext.dd.StatusProxy} can be updated
*/
notifyOver : function(dd, e, data){
var n = this.getTargetFromEvent(e);
if(!n){ // not over valid drop target
if(this.lastOverNode){
this.onNodeOut(this.lastOverNode, dd, e, data);
this.lastOverNode = null;
}
return this.onContainerOver(dd, e, data);
}
if(this.lastOverNode != n){
if(this.lastOverNode){
this.onNodeOut(this.lastOverNode, dd, e, data);
}
this.onNodeEnter(n, dd, e, data);
this.lastOverNode = n;
}
return this.onNodeOver(n, dd, e, data);
},
/**
* The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the source has been dragged
* out of the zone without dropping. If the drag source is currently over a registered node, the notification
* will be delegated to {@link #onNodeOut} for node-specific handling, otherwise it will be ignored.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag zone
*/
notifyOut : function(dd, e, data){
if(this.lastOverNode){
this.onNodeOut(this.lastOverNode, dd, e, data);
this.lastOverNode = null;
}
},
/**
* The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the dragged item has
* been dropped on it. The drag zone will look up the target node based on the event passed in, and if there
* is a node registered for that event, it will delegate to {@link #onNodeDrop} for node-specific handling,
* otherwise it will call {@link #onContainerDrop}.
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
* @param {Event} e The event
* @param {Object} data An object containing arbitrary data supplied by the drag source
* @return {Boolean} True if the drop was valid, else false
*/
notifyDrop : function(dd, e, data){
if(this.lastOverNode){
this.onNodeOut(this.lastOverNode, dd, e, data);
this.lastOverNode = null;
}
var n = this.getTargetFromEvent(e);
return n ?
this.onNodeDrop(n, dd, e, data) :
this.onContainerDrop(dd, e, data);
},
// private
triggerCacheRefresh : function(){
Ext.dd.DDM.refreshCache(this.groups);
}
});

View File

@@ -1,127 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.Registry
* Provides easy access to all drag drop components that are registered on a page. Items can be retrieved either
* directly by DOM node id, or by passing in the drag drop event that occurred and looking up the event target.
* @singleton
*/
Ext.dd.Registry = function(){
var elements = {};
var handles = {};
var autoIdSeed = 0;
var getId = function(el, autogen){
if(typeof el == "string"){
return el;
}
var id = el.id;
if(!id && autogen !== false){
id = "extdd-" + (++autoIdSeed);
el.id = id;
}
return id;
};
return {
/**
* Resgister a drag drop element
* @param {String/HTMLElement} element The id or DOM node to register
* @param {Object} data (optional) An custom data object that will be passed between the elements that are involved
* in drag drop operations. You can populate this object with any arbitrary properties that your own code
* knows how to interpret, plus there are some specific properties known to the Registry that should be
* populated in the data object (if applicable):
* <pre>
Value Description<br />
--------- ------------------------------------------<br />
handles Array of DOM nodes that trigger dragging<br />
for the element being registered<br />
isHandle True if the element passed in triggers<br />
dragging itself, else false
</pre>
*/
register : function(el, data){
data = data || {};
if(typeof el == "string"){
el = document.getElementById(el);
}
data.ddel = el;
elements[getId(el)] = data;
if(data.isHandle !== false){
handles[data.ddel.id] = data;
}
if(data.handles){
var hs = data.handles;
for(var i = 0, len = hs.length; i < len; i++){
handles[getId(hs[i])] = data;
}
}
},
/**
* Unregister a drag drop element
* @param {String/HTMLElement} element The id or DOM node to unregister
*/
unregister : function(el){
var id = getId(el, false);
var data = elements[id];
if(data){
delete elements[id];
if(data.handles){
var hs = data.handles;
for(var i = 0, len = hs.length; i < len; i++){
delete handles[getId(hs[i], false)];
}
}
}
},
/**
* Returns the handle registered for a DOM Node by id
* @param {String/HTMLElement} id The DOM node or id to look up
* @return {Object} handle The custom handle data
*/
getHandle : function(id){
if(typeof id != "string"){ // must be element?
id = id.id;
}
return handles[id];
},
/**
* Returns the handle that is registered for the DOM node that is the target of the event
* @param {Event} e The event
* @return {Object} handle The custom handle data
*/
getHandleFromEvent : function(e){
var t = Ext.lib.Event.getTarget(e);
return t ? handles[t.id] : null;
},
/**
* Returns a custom data object that is registered for a DOM node by id
* @param {String/HTMLElement} id The DOM node or id to look up
* @return {Object} data The custom data
*/
getTarget : function(id){
if(typeof id != "string"){ // must be element?
id = id.id;
}
return elements[id];
},
/**
* Returns a custom data object that is registered for the DOM node that is the target of the event
* @param {Event} e The event
* @return {Object} data The custom data
*/
getTargetFromEvent : function(e){
var t = Ext.lib.Event.getTarget(e);
return t ? elements[t.id] || handles[t.id] : null;
}
};
}();

View File

@@ -1,213 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.ScrollManager
* <p>Provides automatic scrolling of overflow regions in the page during drag operations.</p>
* <p>The ScrollManager configs will be used as the defaults for any scroll container registered with it,
* but you can also override most of the configs per scroll container by adding a
* <tt>ddScrollConfig</tt> object to the target element that contains these properties: {@link #hthresh},
* {@link #vthresh}, {@link #increment} and {@link #frequency}. Example usage:
* <pre><code>
var el = Ext.get('scroll-ct');
el.ddScrollConfig = {
vthresh: 50,
hthresh: -1,
frequency: 100,
increment: 200
};
Ext.dd.ScrollManager.register(el);
</code></pre>
* <b>Note: This class uses "Point Mode" and is untested in "Intersect Mode".</b>
* @singleton
*/
Ext.dd.ScrollManager = function(){
var ddm = Ext.dd.DragDropMgr;
var els = {};
var dragEl = null;
var proc = {};
var onStop = function(e){
dragEl = null;
clearProc();
};
var triggerRefresh = function(){
if(ddm.dragCurrent){
ddm.refreshCache(ddm.dragCurrent.groups);
}
};
var doScroll = function(){
if(ddm.dragCurrent){
var dds = Ext.dd.ScrollManager;
var inc = proc.el.ddScrollConfig ?
proc.el.ddScrollConfig.increment : dds.increment;
if(!dds.animate){
if(proc.el.scroll(proc.dir, inc)){
triggerRefresh();
}
}else{
proc.el.scroll(proc.dir, inc, true, dds.animDuration, triggerRefresh);
}
}
};
var clearProc = function(){
if(proc.id){
clearInterval(proc.id);
}
proc.id = 0;
proc.el = null;
proc.dir = "";
};
var startProc = function(el, dir){
clearProc();
proc.el = el;
proc.dir = dir;
var group = el.ddScrollConfig ? el.ddScrollConfig.ddGroup : undefined,
freq = (el.ddScrollConfig && el.ddScrollConfig.frequency)
? el.ddScrollConfig.frequency
: Ext.dd.ScrollManager.frequency;
if (group === undefined || ddm.dragCurrent.ddGroup == group) {
proc.id = setInterval(doScroll, freq);
}
};
var onFire = function(e, isDrop){
if(isDrop || !ddm.dragCurrent){ return; }
var dds = Ext.dd.ScrollManager;
if(!dragEl || dragEl != ddm.dragCurrent){
dragEl = ddm.dragCurrent;
// refresh regions on drag start
dds.refreshCache();
}
var xy = Ext.lib.Event.getXY(e);
var pt = new Ext.lib.Point(xy[0], xy[1]);
for(var id in els){
var el = els[id], r = el._region;
var c = el.ddScrollConfig ? el.ddScrollConfig : dds;
if(r && r.contains(pt) && el.isScrollable()){
if(r.bottom - pt.y <= c.vthresh){
if(proc.el != el){
startProc(el, "down");
}
return;
}else if(r.right - pt.x <= c.hthresh){
if(proc.el != el){
startProc(el, "left");
}
return;
}else if(pt.y - r.top <= c.vthresh){
if(proc.el != el){
startProc(el, "up");
}
return;
}else if(pt.x - r.left <= c.hthresh){
if(proc.el != el){
startProc(el, "right");
}
return;
}
}
}
clearProc();
};
ddm.fireEvents = ddm.fireEvents.createSequence(onFire, ddm);
ddm.stopDrag = ddm.stopDrag.createSequence(onStop, ddm);
return {
/**
* Registers new overflow element(s) to auto scroll
* @param {Mixed/Array} el The id of or the element to be scrolled or an array of either
*/
register : function(el){
if(Ext.isArray(el)){
for(var i = 0, len = el.length; i < len; i++) {
this.register(el[i]);
}
}else{
el = Ext.get(el);
els[el.id] = el;
}
},
/**
* Unregisters overflow element(s) so they are no longer scrolled
* @param {Mixed/Array} el The id of or the element to be removed or an array of either
*/
unregister : function(el){
if(Ext.isArray(el)){
for(var i = 0, len = el.length; i < len; i++) {
this.unregister(el[i]);
}
}else{
el = Ext.get(el);
delete els[el.id];
}
},
/**
* The number of pixels from the top or bottom edge of a container the pointer needs to be to
* trigger scrolling (defaults to 25)
* @type Number
*/
vthresh : 25,
/**
* The number of pixels from the right or left edge of a container the pointer needs to be to
* trigger scrolling (defaults to 25)
* @type Number
*/
hthresh : 25,
/**
* The number of pixels to scroll in each scroll increment (defaults to 100)
* @type Number
*/
increment : 100,
/**
* The frequency of scrolls in milliseconds (defaults to 500)
* @type Number
*/
frequency : 500,
/**
* True to animate the scroll (defaults to true)
* @type Boolean
*/
animate: true,
/**
* The animation duration in seconds -
* MUST BE less than Ext.dd.ScrollManager.frequency! (defaults to .4)
* @type Number
*/
animDuration: .4,
/**
* The named drag drop {@link Ext.dd.DragSource#ddGroup group} to which this container belongs (defaults to undefined).
* If a ddGroup is specified, then container scrolling will only occur when a dragged object is in the same ddGroup.
* @type String
*/
ddGroup: undefined,
/**
* Manually trigger a cache refresh.
*/
refreshCache : function(){
for(var id in els){
if(typeof els[id] == 'object'){ // for people extending the object prototype
els[id]._region = els[id].getRegion();
}
}
}
};
}();

View File

@@ -1,175 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.StatusProxy
* A specialized drag proxy that supports a drop status icon, {@link Ext.Layer} styles and auto-repair. This is the
* default drag proxy used by all Ext.dd components.
* @constructor
* @param {Object} config
*/
Ext.dd.StatusProxy = function(config){
Ext.apply(this, config);
this.id = this.id || Ext.id();
this.el = new Ext.Layer({
dh: {
id: this.id, tag: "div", cls: "x-dd-drag-proxy "+this.dropNotAllowed, children: [
{tag: "div", cls: "x-dd-drop-icon"},
{tag: "div", cls: "x-dd-drag-ghost"}
]
},
shadow: !config || config.shadow !== false
});
this.ghost = Ext.get(this.el.dom.childNodes[1]);
this.dropStatus = this.dropNotAllowed;
};
Ext.dd.StatusProxy.prototype = {
/**
* @cfg {String} dropAllowed
* The CSS class to apply to the status element when drop is allowed (defaults to "x-dd-drop-ok").
*/
dropAllowed : "x-dd-drop-ok",
/**
* @cfg {String} dropNotAllowed
* The CSS class to apply to the status element when drop is not allowed (defaults to "x-dd-drop-nodrop").
*/
dropNotAllowed : "x-dd-drop-nodrop",
/**
* Updates the proxy's visual element to indicate the status of whether or not drop is allowed
* over the current target element.
* @param {String} cssClass The css class for the new drop status indicator image
*/
setStatus : function(cssClass){
cssClass = cssClass || this.dropNotAllowed;
if(this.dropStatus != cssClass){
this.el.replaceClass(this.dropStatus, cssClass);
this.dropStatus = cssClass;
}
},
/**
* Resets the status indicator to the default dropNotAllowed value
* @param {Boolean} clearGhost True to also remove all content from the ghost, false to preserve it
*/
reset : function(clearGhost){
this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed;
this.dropStatus = this.dropNotAllowed;
if(clearGhost){
this.ghost.update("");
}
},
/**
* Updates the contents of the ghost element
* @param {String/HTMLElement} html The html that will replace the current innerHTML of the ghost element, or a
* DOM node to append as the child of the ghost element (in which case the innerHTML will be cleared first).
*/
update : function(html){
if(typeof html == "string"){
this.ghost.update(html);
}else{
this.ghost.update("");
html.style.margin = "0";
this.ghost.dom.appendChild(html);
}
var el = this.ghost.dom.firstChild;
if(el){
Ext.fly(el).setStyle('float', 'none');
}
},
/**
* Returns the underlying proxy {@link Ext.Layer}
* @return {Ext.Layer} el
*/
getEl : function(){
return this.el;
},
/**
* Returns the ghost element
* @return {Ext.Element} el
*/
getGhost : function(){
return this.ghost;
},
/**
* Hides the proxy
* @param {Boolean} clear True to reset the status and clear the ghost contents, false to preserve them
*/
hide : function(clear){
this.el.hide();
if(clear){
this.reset(true);
}
},
/**
* Stops the repair animation if it's currently running
*/
stop : function(){
if(this.anim && this.anim.isAnimated && this.anim.isAnimated()){
this.anim.stop();
}
},
/**
* Displays this proxy
*/
show : function(){
this.el.show();
},
/**
* Force the Layer to sync its shadow and shim positions to the element
*/
sync : function(){
this.el.sync();
},
/**
* Causes the proxy to return to its position of origin via an animation. Should be called after an
* invalid drop operation by the item being dragged.
* @param {Array} xy The XY position of the element ([x, y])
* @param {Function} callback The function to call after the repair is complete.
* @param {Object} scope The scope (<code>this</code> reference) in which the callback function is executed. Defaults to the browser window.
*/
repair : function(xy, callback, scope){
this.callback = callback;
this.scope = scope;
if(xy && this.animRepair !== false){
this.el.addClass("x-dd-drag-repair");
this.el.hideUnders(true);
this.anim = this.el.shift({
duration: this.repairDuration || .5,
easing: 'easeOut',
xy: xy,
stopFx: true,
callback: this.afterRepair,
scope: this
});
}else{
this.afterRepair();
}
},
// private
afterRepair : function(){
this.hide(true);
if(typeof this.callback == "function"){
this.callback.call(this.scope || this);
}
this.callback = null;
this.scope = null;
},
destroy: function(){
Ext.destroy(this.ghost, this.el);
}
};

View File

@@ -1,907 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.debug = {};
(function(){
var cp;
function createConsole(){
var scriptPanel = new Ext.debug.ScriptsPanel();
var logView = new Ext.debug.LogPanel();
var tree = new Ext.debug.DomTree();
var compInspector = new Ext.debug.ComponentInspector();
var compInfoPanel = new Ext.debug.ComponentInfoPanel();
var storeInspector = new Ext.debug.StoreInspector();
var objInspector = new Ext.debug.ObjectInspector();
var tabs = new Ext.TabPanel({
activeTab: 0,
border: false,
tabPosition: 'bottom',
items: [{
title: 'Debug Console',
layout:'border',
items: [logView, scriptPanel]
},{
title: 'HTML Inspector',
layout:'border',
items: [tree]
},{
title: 'Component Inspector',
layout: 'border',
items: [compInspector,compInfoPanel]
},{
title: 'Object Inspector',
layout: 'border',
items: [objInspector]
},{
title: 'Data Stores',
layout: 'border',
items: [storeInspector]
}]
});
cp = new Ext.Panel({
id: 'x-debug-browser',
title: 'Console',
collapsible: true,
animCollapse: false,
style: 'position:absolute;left:0;bottom:0;z-index:101',
height:200,
logView: logView,
layout: 'fit',
tools:[{
id: 'close',
handler: function(){
cp.destroy();
cp = null;
Ext.EventManager.removeResizeListener(handleResize);
}
}],
items: tabs
});
cp.render(Ext.getBody());
cp.resizer = new Ext.Resizable(cp.el, {
minHeight:50,
handles: "n",
pinned: true,
transparent:true,
resizeElement : function(){
var box = this.proxy.getBox();
this.proxy.hide();
cp.setHeight(box.height);
return box;
}
});
// function handleResize(){
// cp.setWidth(Ext.getBody().getViewSize().width);
// }
// Ext.EventManager.onWindowResize(handleResize);
//
// handleResize();
function handleResize(){
var b = Ext.getBody();
var size = b.getViewSize();
if(size.height < b.dom.scrollHeight) {
size.width -= 18;
}
cp.setWidth(size.width);
}
Ext.EventManager.onWindowResize(handleResize);
handleResize();
}
Ext.apply(Ext, {
log : function(){
if(!cp){
createConsole();
}
cp.logView.log.apply(cp.logView, arguments);
},
logf : function(format, arg1, arg2, etc){
Ext.log(String.format.apply(String, arguments));
},
dump : function(o){
if(typeof o == 'string' || typeof o == 'number' || typeof o == 'undefined' || Ext.isDate(o)){
Ext.log(o);
}else if(!o){
Ext.log("null");
}else if(typeof o != "object"){
Ext.log('Unknown return type');
}else if(Ext.isArray(o)){
Ext.log('['+o.join(',')+']');
}else{
var b = ["{\n"];
for(var key in o){
var to = typeof o[key];
if(to != "function" && to != "object"){
b.push(String.format(" {0}: {1},\n", key, o[key]));
}
}
var s = b.join("");
if(s.length > 3){
s = s.substr(0, s.length-2);
}
Ext.log(s + "\n}");
}
},
_timers : {},
time : function(name){
name = name || "def";
Ext._timers[name] = new Date().getTime();
},
timeEnd : function(name, printResults){
var t = new Date().getTime();
name = name || "def";
var v = String.format("{0} ms", t-Ext._timers[name]);
Ext._timers[name] = new Date().getTime();
if(printResults !== false){
Ext.log('Timer ' + (name == "def" ? v : name + ": " + v));
}
return v;
}
});
})();
Ext.debug.ScriptsPanel = Ext.extend(Ext.Panel, {
id:'x-debug-scripts',
region: 'east',
minWidth: 200,
split: true,
width: 350,
border: false,
layout:'anchor',
style:'border-width:0 0 0 1px;',
initComponent : function(){
this.scriptField = new Ext.form.TextArea({
anchor: '100% -26',
style:'border-width:0;'
});
this.trapBox = new Ext.form.Checkbox({
id: 'console-trap',
boxLabel: 'Trap Errors',
checked: true
});
this.toolbar = new Ext.Toolbar([{
text: 'Run',
scope: this,
handler: this.evalScript
},{
text: 'Clear',
scope: this,
handler: this.clear
},
'->',
this.trapBox,
' ', ' '
]);
this.items = [this.toolbar, this.scriptField];
Ext.debug.ScriptsPanel.superclass.initComponent.call(this);
},
evalScript : function(){
var s = this.scriptField.getValue();
if(this.trapBox.getValue()){
try{
var rt = eval(s);
Ext.dump(rt === undefined? '(no return)' : rt);
}catch(e){
Ext.log(e.message || e.descript);
}
}else{
var rt = eval(s);
Ext.dump(rt === undefined? '(no return)' : rt);
}
},
clear : function(){
this.scriptField.setValue('');
this.scriptField.focus();
}
});
Ext.debug.LogPanel = Ext.extend(Ext.Panel, {
autoScroll: true,
region: 'center',
border: false,
style:'border-width:0 1px 0 0',
log : function(){
var markup = [ '<div style="padding:5px !important;border-bottom:1px solid #ccc;">',
Ext.util.Format.htmlEncode(Array.prototype.join.call(arguments, ', ')).replace(/\n/g, '<br/>').replace(/\s/g, '&#160;'),
'</div>'].join(''),
bd = this.body.dom;
this.body.insertHtml('beforeend', markup);
bd.scrollTop = bd.scrollHeight;
},
clear : function(){
this.body.update('');
this.body.dom.scrollTop = 0;
}
});
Ext.debug.DomTree = Ext.extend(Ext.tree.TreePanel, {
enableDD:false ,
lines:false,
rootVisible:false,
animate:false,
hlColor:'ffff9c',
autoScroll: true,
region:'center',
border:false,
initComponent : function(){
Ext.debug.DomTree.superclass.initComponent.call(this);
// tree related stuff
var styles = false, hnode;
var nonSpace = /^\s*$/;
var html = Ext.util.Format.htmlEncode;
var ellipsis = Ext.util.Format.ellipsis;
var styleRe = /\s?([a-z\-]*)\:([^;]*)(?:[;\s\n\r]*)/gi;
function findNode(n){
if(!n || n.nodeType != 1 || n == document.body || n == document){
return false;
}
var pn = [n], p = n;
while((p = p.parentNode) && p.nodeType == 1 && p.tagName.toUpperCase() != 'HTML'){
pn.unshift(p);
}
var cn = hnode;
for(var i = 0, len = pn.length; i < len; i++){
cn.expand();
cn = cn.findChild('htmlNode', pn[i]);
if(!cn){ // in this dialog?
return false;
}
}
cn.select();
var a = cn.ui.anchor;
this.getTreeEl().dom.scrollTop = Math.max(0 ,a.offsetTop-10);
//treeEl.dom.scrollLeft = Math.max(0 ,a.offsetLeft-10); no likey
cn.highlight();
return true;
}
function nodeTitle(n){
var s = n.tagName;
if(n.id){
s += '#'+n.id;
}else if(n.className){
s += '.'+n.className;
}
return s;
}
/*
function onNodeSelect(t, n, last){
return;
if(last && last.unframe){
last.unframe();
}
var props = {};
if(n && n.htmlNode){
if(frameEl.pressed){
n.frame();
}
if(inspecting){
return;
}
addStyle.enable();
reload.setDisabled(n.leaf);
var dom = n.htmlNode;
stylePanel.setTitle(nodeTitle(dom));
if(styles && !showAll.pressed){
var s = dom.style ? dom.style.cssText : '';
if(s){
var m;
while ((m = styleRe.exec(s)) != null){
props[m[1].toLowerCase()] = m[2];
}
}
}else if(styles){
var cl = Ext.debug.cssList;
var s = dom.style, fly = Ext.fly(dom);
if(s){
for(var i = 0, len = cl.length; i<len; i++){
var st = cl[i];
var v = s[st] || fly.getStyle(st);
if(v != undefined && v !== null && v !== ''){
props[st] = v;
}
}
}
}else{
for(var a in dom){
var v = dom[a];
if((isNaN(a+10)) && v != undefined && v !== null && v !== '' && !(Ext.isGecko && a[0] == a[0].toUpperCase())){
props[a] = v;
}
}
}
}else{
if(inspecting){
return;
}
addStyle.disable();
reload.disabled();
}
stylesGrid.setSource(props);
stylesGrid.treeNode = n;
stylesGrid.view.fitColumns();
}
*/
this.loader = new Ext.tree.TreeLoader();
this.loader.load = function(n, cb){
var isBody = n.htmlNode == document.body;
var cn = n.htmlNode.childNodes;
for(var i = 0, c; c = cn[i]; i++){
if(isBody && c.id == 'x-debug-browser'){
continue;
}
if(c.nodeType == 1){
n.appendChild(new Ext.debug.HtmlNode(c));
}else if(c.nodeType == 3 && !nonSpace.test(c.nodeValue)){
n.appendChild(new Ext.tree.TreeNode({
text:'<em>' + ellipsis(html(String(c.nodeValue)), 35) + '</em>',
cls: 'x-tree-noicon'
}));
}
}
cb();
};
//tree.getSelectionModel().on('selectionchange', onNodeSelect, null, {buffer:250});
this.root = this.setRootNode(new Ext.tree.TreeNode('Ext'));
hnode = this.root.appendChild(new Ext.debug.HtmlNode(
document.getElementsByTagName('html')[0]
));
}
});
Ext.debug.ComponentNodeUI = Ext.extend(Ext.tree.TreeNodeUI,{
onOver : function(e){
Ext.debug.ComponentNodeUI.superclass.onOver.call(this);
var cmp = this.node.attributes.component;
if (cmp.el && cmp.el.mask && cmp.id !='x-debug-browser') {
try { // Oddly bombs on some elements in IE, gets any we care about though
cmp.el.mask();
} catch(e) {}
}
},
onOut : function(e){
Ext.debug.ComponentNodeUI.superclass.onOut.call(this);
var cmp = this.node.attributes.component;
if (cmp.el && cmp.el.unmask && cmp.id !='x-debug-browser') {
try {
cmp.el.unmask();
} catch(e) {}
}
}
});
Ext.debug.ComponentInspector = Ext.extend(Ext.tree.TreePanel, {
enableDD:false ,
lines:false,
rootVisible:false,
animate:false,
hlColor:'ffff9c',
autoScroll: true,
region:'center',
border:false,
initComponent : function(){
this.loader = new Ext.tree.TreeLoader();
this.bbar = new Ext.Toolbar([{
text: 'Refresh',
handler: this.refresh,
scope: this
}]);
Ext.debug.ComponentInspector.superclass.initComponent.call(this);
this.root = this.setRootNode(new Ext.tree.TreeNode({
text: 'Ext Components',
component: Ext.ComponentMgr.all,
leaf: false
}));
this.parseRootNode();
this.on('click', this.onClick, this);
},
createNode: function(n,c) {
var leaf = (c.items && c.items.length > 0);
return n.appendChild(new Ext.tree.TreeNode({
text: c.id + (c.getXType() ? ' [ ' + c.getXType() + ' ]': '' ),
component: c,
uiProvider:Ext.debug.ComponentNodeUI,
leaf: !leaf
}));
},
parseChildItems: function(n) {
var cn = n.attributes.component.items;
if (cn) {
for (var i = 0;i < cn.length; i++) {
var c = cn.get(i);
if (c.id != this.id && c.id != this.bottomToolbar.id) {
var newNode = this.createNode(n,c);
if (!newNode.leaf) {
this.parseChildItems(newNode);
}
}
}
}
},
parseRootNode: function() {
var n = this.root;
var cn = n.attributes.component.items;
for (var i = 0,c;c = cn[i];i++) {
if (c.id != this.id && c.id != this.bottomToolbar.id) {
if (!c.ownerCt) {
var newNode = this.createNode(n,c);
if (!newNode.leaf) {
this.parseChildItems(newNode);
}
}
}
}
},
onClick: function(node, e) {
var oi = Ext.getCmp('x-debug-objinspector');
oi.refreshNodes(node.attributes.component);
oi.ownerCt.show();
},
refresh: function() {
while (this.root.firstChild) {
this.root.removeChild(this.root.firstChild);
}
this.parseRootNode();
var ci = Ext.getCmp('x-debug-compinfo');
if (ci) {
ci.message('refreshed component tree - '+Ext.ComponentMgr.all.length);
}
}
});
Ext.debug.ComponentInfoPanel = Ext.extend(Ext.Panel,{
id:'x-debug-compinfo',
region: 'east',
minWidth: 200,
split: true,
width: 350,
border: false,
autoScroll: true,
layout:'anchor',
style:'border-width:0 0 0 1px;',
initComponent: function() {
this.watchBox = new Ext.form.Checkbox({
id: 'x-debug-watchcomp',
boxLabel: 'Watch ComponentMgr',
listeners: {
check: function(cb, val) {
if (val) {
Ext.ComponentMgr.all.on('add', this.onAdd, this);
Ext.ComponentMgr.all.on('remove', this.onRemove, this);
} else {
Ext.ComponentMgr.all.un('add', this.onAdd, this);
Ext.ComponentMgr.all.un('remove', this.onRemove, this);
}
},
scope: this
}
});
this.tbar = new Ext.Toolbar([{
text: 'Clear',
handler: this.clear,
scope: this
},'->',this.watchBox
]);
Ext.debug.ComponentInfoPanel.superclass.initComponent.call(this);
},
onAdd: function(i, o, key) {
var markup = ['<div style="padding:5px !important;border-bottom:1px solid #ccc;">',
'Added: '+o.id,
'</div>'].join('');
this.insertMarkup(markup);
},
onRemove: function(o, key) {
var markup = ['<div style="padding:5px !important;border-bottom:1px solid #ccc;">',
'Removed: '+o.id,
'</div>'].join('');
this.insertMarkup(markup);
},
message: function(msg) {
var markup = ['<div style="padding:5px !important;border-bottom:1px solid #ccc;">',
msg,
'</div>'].join('');
this.insertMarkup(markup);
},
insertMarkup: function(markup) {
this.body.insertHtml('beforeend', markup);
this.body.scrollTo('top', 100000);
},
clear : function(){
this.body.update('');
this.body.dom.scrollTop = 0;
}
});
Ext.debug.ColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
focus: Ext.emptyFn, // prevent odd scrolling behavior
renderElements : function(n, a, targetNode, bulkRender){
this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
var t = n.getOwnerTree();
var cols = t.columns;
var bw = t.borderWidth;
var c = cols[0];
var buf = [
'<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf ', a.cls,'">',
'<div class="x-tree-col" style="width:',c.width-bw,'px;">',
'<span class="x-tree-node-indent">',this.indentMarkup,"</span>",
'<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow"/>',
'<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on"/>',
'<a hidefocus="on" class="x-tree-node-anchor" href="',a.href ? a.href : "#",'" tabIndex="1" ',
a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '>',
'<span unselectable="on">', n.text || (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]),"</span></a>",
"</div>"];
for(var i = 1, len = cols.length; i < len; i++){
c = cols[i];
buf.push('<div class="x-tree-col ',(c.cls?c.cls:''),'" style="width:',c.width-bw,'px;">',
'<div class="x-tree-col-text">',(c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]),"</div>",
"</div>");
}
buf.push(
'<div class="x-clear"></div></div>',
'<ul class="x-tree-node-ct" style="display:none;"></ul>',
"</li>");
if(bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()){
this.wrap = Ext.DomHelper.insertHtml("beforeBegin",
n.nextSibling.ui.getEl(), buf.join(""));
}else{
this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(""));
}
this.elNode = this.wrap.childNodes[0];
this.ctNode = this.wrap.childNodes[1];
var cs = this.elNode.firstChild.childNodes;
this.indentNode = cs[0];
this.ecNode = cs[1];
this.iconNode = cs[2];
this.anchor = cs[3];
this.textNode = cs[3].firstChild;
}
});
Ext.debug.ObjectInspector = Ext.extend(Ext.tree.TreePanel, {
id: 'x-debug-objinspector',
enableDD:false ,
lines:false,
rootVisible:false,
animate:false,
hlColor:'ffff9c',
autoScroll: true,
region:'center',
border:false,
lines:false,
borderWidth: Ext.isBorderBox ? 0 : 2, // the combined left/right border for each cell
cls:'x-column-tree',
initComponent : function(){
this.showFunc = false;
this.toggleFunc = function() {
this.showFunc = !this.showFunc;
this.refreshNodes(this.currentObject);
};
this.bbar = new Ext.Toolbar([{
text: 'Show Functions',
enableToggle: true,
pressed: false,
handler: this.toggleFunc,
scope: this
}]);
Ext.apply(this,{
title: ' ',
loader: new Ext.tree.TreeLoader(),
columns:[{
header:'Property',
width: 300,
dataIndex:'name'
},{
header:'Value',
width: 900,
dataIndex:'value'
}]
});
Ext.debug.ObjectInspector.superclass.initComponent.call(this);
this.root = this.setRootNode(new Ext.tree.TreeNode({
text: 'Dummy Node',
leaf: false
}));
if (this.currentObject) {
this.parseNodes();
}
},
refreshNodes: function(newObj) {
this.currentObject = newObj;
var node = this.root;
while(node.firstChild){
node.removeChild(node.firstChild);
}
this.parseNodes();
},
parseNodes: function() {
for (var o in this.currentObject) {
if (!this.showFunc) {
if (Ext.isFunction(this.currentObject[o])) {
continue;
}
}
this.createNode(o);
}
},
createNode: function(o) {
return this.root.appendChild(new Ext.tree.TreeNode({
name: o,
value: this.currentObject[o],
uiProvider:Ext.debug.ColumnNodeUI,
iconCls: 'x-debug-node',
leaf: true
}));
},
onRender : function(){
Ext.debug.ObjectInspector.superclass.onRender.apply(this, arguments);
this.headers = this.header.createChild({cls:'x-tree-headers'});
var cols = this.columns, c;
var totalWidth = 0;
for(var i = 0, len = cols.length; i < len; i++){
c = cols[i];
totalWidth += c.width;
this.headers.createChild({
cls:'x-tree-hd ' + (c.cls?c.cls+'-hd':''),
cn: {
cls:'x-tree-hd-text',
html: c.header
},
style:'width:'+(c.width-this.borderWidth)+'px;'
});
}
this.headers.createChild({cls:'x-clear'});
// prevent floats from wrapping when clipped
this.headers.setWidth(totalWidth);
this.innerCt.setWidth(totalWidth);
}
});
Ext.debug.StoreInspector = Ext.extend(Ext.tree.TreePanel, {
enableDD:false ,
lines:false,
rootVisible:false,
animate:false,
hlColor:'ffff9c',
autoScroll: true,
region:'center',
border:false,
initComponent: function() {
this.bbar = new Ext.Toolbar([{
text: 'Refresh',
handler: this.refresh,
scope: this
}]);
Ext.debug.StoreInspector.superclass.initComponent.call(this);
this.root = this.setRootNode(new Ext.tree.TreeNode({
text: 'Data Stores',
leaf: false
}));
this.on('click', this.onClick, this);
this.parseStores();
},
parseStores: function() {
var cn = Ext.StoreMgr.items;
for (var i = 0,c;c = cn[i];i++) {
this.root.appendChild({
text: c.storeId + ' - ' + c.totalLength + ' records',
component: c,
leaf: true
});
}
},
onClick: function(node, e) {
var oi = Ext.getCmp('x-debug-objinspector');
oi.refreshNodes(node.attributes.component);
oi.ownerCt.show();
},
refresh: function() {
while (this.root.firstChild) {
this.root.removeChild(this.root.firstChild);
}
this.parseStores();
}
});
// highly unusual class declaration
Ext.debug.HtmlNode = function(){
var html = Ext.util.Format.htmlEncode;
var ellipsis = Ext.util.Format.ellipsis;
var nonSpace = /^\s*$/;
var attrs = [
{n: 'id', v: 'id'},
{n: 'className', v: 'class'},
{n: 'name', v: 'name'},
{n: 'type', v: 'type'},
{n: 'src', v: 'src'},
{n: 'href', v: 'href'}
];
function hasChild(n){
for(var i = 0, c; c = n.childNodes[i]; i++){
if(c.nodeType == 1){
return true;
}
}
return false;
}
function renderNode(n, leaf){
var tag = n.tagName.toLowerCase();
var s = '&lt;' + tag;
for(var i = 0, len = attrs.length; i < len; i++){
var a = attrs[i];
var v = n[a.n];
if(v && !nonSpace.test(v)){
s += ' ' + a.v + '=&quot;<i>' + html(v) +'</i>&quot;';
}
}
var style = n.style ? n.style.cssText : '';
if(style){
s += ' style=&quot;<i>' + html(style.toLowerCase()) +'</i>&quot;';
}
if(leaf && n.childNodes.length > 0){
s+='&gt;<em>' + ellipsis(html(String(n.innerHTML)), 35) + '</em>&lt;/'+tag+'&gt;';
}else if(leaf){
s += ' /&gt;';
}else{
s += '&gt;';
}
return s;
}
var HtmlNode = function(n){
var leaf = !hasChild(n);
this.htmlNode = n;
this.tagName = n.tagName.toLowerCase();
var attr = {
text : renderNode(n, leaf),
leaf : leaf,
cls: 'x-tree-noicon'
};
HtmlNode.superclass.constructor.call(this, attr);
this.attributes.htmlNode = n; // for searching
if(!leaf){
this.on('expand', this.onExpand, this);
this.on('collapse', this.onCollapse, this);
}
};
Ext.extend(HtmlNode, Ext.tree.AsyncTreeNode, {
cls: 'x-tree-noicon',
preventHScroll: true,
refresh : function(highlight){
var leaf = !hasChild(this.htmlNode);
this.setText(renderNode(this.htmlNode, leaf));
if(highlight){
Ext.fly(this.ui.textNode).highlight();
}
},
onExpand : function(){
if(!this.closeNode && this.parentNode){
this.closeNode = this.parentNode.insertBefore(new Ext.tree.TreeNode({
text:'&lt;/' + this.tagName + '&gt;',
cls: 'x-tree-noicon'
}), this.nextSibling);
}else if(this.closeNode){
this.closeNode.ui.show();
}
},
onCollapse : function(){
if(this.closeNode){
this.closeNode.ui.hide();
}
},
render : function(bulkRender){
HtmlNode.superclass.render.call(this, bulkRender);
},
highlightNode : function(){
//Ext.fly(this.htmlNode).highlight();
},
highlight : function(){
//Ext.fly(this.ui.textNode).highlight();
},
frame : function(){
this.htmlNode.style.border = '1px solid #0000ff';
//this.highlightNode();
},
unframe : function(){
//Ext.fly(this.htmlNode).removeClass('x-debug-frame');
this.htmlNode.style.border = '';
}
});
return HtmlNode;
}();

View File

@@ -1,235 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Direct
* @extends Ext.util.Observable
* <p><b><u>Overview</u></b></p>
*
* <p>Ext.Direct aims to streamline communication between the client and server
* by providing a single interface that reduces the amount of common code
* typically required to validate data and handle returned data packets
* (reading data, error conditions, etc).</p>
*
* <p>The Ext.direct namespace includes several classes for a closer integration
* with the server-side. The Ext.data namespace also includes classes for working
* with Ext.data.Stores which are backed by data from an Ext.Direct method.</p>
*
* <p><b><u>Specification</u></b></p>
*
* <p>For additional information consult the
* <a href="http://extjs.com/products/extjs/direct.php">Ext.Direct Specification</a>.</p>
*
* <p><b><u>Providers</u></b></p>
*
* <p>Ext.Direct uses a provider architecture, where one or more providers are
* used to transport data to and from the server. There are several providers
* that exist in the core at the moment:</p><div class="mdetail-params"><ul>
*
* <li>{@link Ext.direct.JsonProvider JsonProvider} for simple JSON operations</li>
* <li>{@link Ext.direct.PollingProvider PollingProvider} for repeated requests</li>
* <li>{@link Ext.direct.RemotingProvider RemotingProvider} exposes server side
* on the client.</li>
* </ul></div>
*
* <p>A provider does not need to be invoked directly, providers are added via
* {@link Ext.Direct}.{@link Ext.Direct#add add}.</p>
*
* <p><b><u>Router</u></b></p>
*
* <p>Ext.Direct utilizes a "router" on the server to direct requests from the client
* to the appropriate server-side method. Because the Ext.Direct API is completely
* platform-agnostic, you could completely swap out a Java based server solution
* and replace it with one that uses C# without changing the client side JavaScript
* at all.</p>
*
* <p><b><u>Server side events</u></b></p>
*
* <p>Custom events from the server may be handled by the client by adding
* listeners, for example:</p>
* <pre><code>
{"type":"event","name":"message","data":"Successfully polled at: 11:19:30 am"}
// add a handler for a 'message' event sent by the server
Ext.Direct.on('message', function(e){
out.append(String.format('&lt;p>&lt;i>{0}&lt;/i>&lt;/p>', e.data));
out.el.scrollTo('t', 100000, true);
});
* </code></pre>
* @singleton
*/
Ext.Direct = Ext.extend(Ext.util.Observable, {
/**
* Each event type implements a getData() method. The default event types are:
* <div class="mdetail-params"><ul>
* <li><b><tt>event</tt></b> : Ext.Direct.Event</li>
* <li><b><tt>exception</tt></b> : Ext.Direct.ExceptionEvent</li>
* <li><b><tt>rpc</tt></b> : Ext.Direct.RemotingEvent</li>
* </ul></div>
* @property eventTypes
* @type Object
*/
/**
* Four types of possible exceptions which can occur:
* <div class="mdetail-params"><ul>
* <li><b><tt>Ext.Direct.exceptions.TRANSPORT</tt></b> : 'xhr'</li>
* <li><b><tt>Ext.Direct.exceptions.PARSE</tt></b> : 'parse'</li>
* <li><b><tt>Ext.Direct.exceptions.LOGIN</tt></b> : 'login'</li>
* <li><b><tt>Ext.Direct.exceptions.SERVER</tt></b> : 'exception'</li>
* </ul></div>
* @property exceptions
* @type Object
*/
exceptions: {
TRANSPORT: 'xhr',
PARSE: 'parse',
LOGIN: 'login',
SERVER: 'exception'
},
// private
constructor: function(){
this.addEvents(
/**
* @event event
* Fires after an event.
* @param {event} e The {@link Ext.Direct#eventTypes Ext.Direct.Event type} that occurred.
* @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
*/
'event',
/**
* @event exception
* Fires after an event exception.
* @param {event} e The {@link Ext.Direct#eventTypes Ext.Direct.Event type} that occurred.
*/
'exception'
);
this.transactions = {};
this.providers = {};
},
/**
* Adds an Ext.Direct Provider and creates the proxy or stub methods to execute server-side methods.
* If the provider is not already connected, it will auto-connect.
* <pre><code>
var pollProv = new Ext.direct.PollingProvider({
url: 'php/poll2.php'
});
Ext.Direct.addProvider(
{
"type":"remoting", // create a {@link Ext.direct.RemotingProvider}
"url":"php\/router.php", // url to connect to the Ext.Direct server-side router.
"actions":{ // each property within the actions object represents a Class
"TestAction":[ // array of methods within each server side Class
{
"name":"doEcho", // name of method
"len":1
},{
"name":"multiply",
"len":1
},{
"name":"doForm",
"formHandler":true, // handle form on server with Ext.Direct.Transaction
"len":1
}]
},
"namespace":"myApplication",// namespace to create the Remoting Provider in
},{
type: 'polling', // create a {@link Ext.direct.PollingProvider}
url: 'php/poll.php'
},
pollProv // reference to previously created instance
);
* </code></pre>
* @param {Object/Array} provider Accepts either an Array of Provider descriptions (an instance
* or config object for a Provider) or any number of Provider descriptions as arguments. Each
* Provider description instructs Ext.Direct how to create client-side stub methods.
*/
addProvider : function(provider){
var a = arguments;
if(a.length > 1){
for(var i = 0, len = a.length; i < len; i++){
this.addProvider(a[i]);
}
return;
}
// if provider has not already been instantiated
if(!provider.events){
provider = new Ext.Direct.PROVIDERS[provider.type](provider);
}
provider.id = provider.id || Ext.id();
this.providers[provider.id] = provider;
provider.on('data', this.onProviderData, this);
provider.on('exception', this.onProviderException, this);
if(!provider.isConnected()){
provider.connect();
}
return provider;
},
/**
* Retrieve a {@link Ext.direct.Provider provider} by the
* <b><tt>{@link Ext.direct.Provider#id id}</tt></b> specified when the provider is
* {@link #addProvider added}.
* @param {String} id Unique identifier assigned to the provider when calling {@link #addProvider}
*/
getProvider : function(id){
return this.providers[id];
},
removeProvider : function(id){
var provider = id.id ? id : this.providers[id];
provider.un('data', this.onProviderData, this);
provider.un('exception', this.onProviderException, this);
delete this.providers[provider.id];
return provider;
},
addTransaction: function(t){
this.transactions[t.tid] = t;
return t;
},
removeTransaction: function(t){
delete this.transactions[t.tid || t];
return t;
},
getTransaction: function(tid){
return this.transactions[tid.tid || tid];
},
onProviderData : function(provider, e){
if(Ext.isArray(e)){
for(var i = 0, len = e.length; i < len; i++){
this.onProviderData(provider, e[i]);
}
return;
}
if(e.name && e.name != 'event' && e.name != 'exception'){
this.fireEvent(e.name, e);
}else if(e.type == 'exception'){
this.fireEvent('exception', e);
}
this.fireEvent('event', e, provider);
},
createEvent : function(response, extraProps){
return new Ext.Direct.eventTypes[response.type](Ext.apply(response, extraProps));
}
});
// overwrite impl. with static instance
Ext.Direct = new Ext.Direct();
Ext.Direct.TID = 1;
Ext.Direct.PROVIDERS = {};

View File

@@ -1,34 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.Direct.Event = function(config){
Ext.apply(this, config);
};
Ext.Direct.Event.prototype = {
status: true,
getData: function(){
return this.data;
}
};
Ext.Direct.RemotingEvent = Ext.extend(Ext.Direct.Event, {
type: 'rpc',
getTransaction: function(){
return this.transaction || Ext.Direct.getTransaction(this.tid);
}
});
Ext.Direct.ExceptionEvent = Ext.extend(Ext.Direct.RemotingEvent, {
status: false,
type: 'exception'
});
Ext.Direct.eventTypes = {
'rpc': Ext.Direct.RemotingEvent,
'event': Ext.Direct.Event,
'exception': Ext.Direct.ExceptionEvent
};

View File

@@ -1,45 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.direct.JsonProvider
* @extends Ext.direct.Provider
*/
Ext.direct.JsonProvider = Ext.extend(Ext.direct.Provider, {
parseResponse: function(xhr){
if(!Ext.isEmpty(xhr.responseText)){
if(typeof xhr.responseText == 'object'){
return xhr.responseText;
}
return Ext.decode(xhr.responseText);
}
return null;
},
getEvents: function(xhr){
var data = null;
try{
data = this.parseResponse(xhr);
}catch(e){
var event = new Ext.Direct.ExceptionEvent({
data: e,
xhr: xhr,
code: Ext.Direct.exceptions.PARSE,
message: 'Error parsing json response: \n\n ' + data
});
return [event];
}
var events = [];
if(Ext.isArray(data)){
for(var i = 0, len = data.length; i < len; i++){
events.push(Ext.Direct.createEvent(data[i]));
}
}else{
events.push(Ext.Direct.createEvent(data));
}
return events;
}
});

View File

@@ -1,151 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.direct.PollingProvider
* @extends Ext.direct.JsonProvider
*
* <p>Provides for repetitive polling of the server at distinct {@link #interval intervals}.
* The initial request for data originates from the client, and then is responded to by the
* server.</p>
*
* <p>All configurations for the PollingProvider should be generated by the server-side
* API portion of the Ext.Direct stack.</p>
*
* <p>An instance of PollingProvider may be created directly via the new keyword or by simply
* specifying <tt>type = 'polling'</tt>. For example:</p>
* <pre><code>
var pollA = new Ext.direct.PollingProvider({
type:'polling',
url: 'php/pollA.php',
});
Ext.Direct.addProvider(pollA);
pollA.disconnect();
Ext.Direct.addProvider(
{
type:'polling',
url: 'php/pollB.php',
id: 'pollB-provider'
}
);
var pollB = Ext.Direct.getProvider('pollB-provider');
* </code></pre>
*/
Ext.direct.PollingProvider = Ext.extend(Ext.direct.JsonProvider, {
/**
* @cfg {Number} priority
* Priority of the request (defaults to <tt>3</tt>). See {@link Ext.direct.Provider#priority}.
*/
// override default priority
priority: 3,
/**
* @cfg {Number} interval
* How often to poll the server-side in milliseconds (defaults to <tt>3000</tt> - every
* 3 seconds).
*/
interval: 3000,
/**
* @cfg {Object} baseParams An object containing properties which are to be sent as parameters
* on every polling request
*/
/**
* @cfg {String/Function} url
* The url which the PollingProvider should contact with each request. This can also be
* an imported Ext.Direct method which will accept the baseParams as its only argument.
*/
// private
constructor : function(config){
Ext.direct.PollingProvider.superclass.constructor.call(this, config);
this.addEvents(
/**
* @event beforepoll
* Fired immediately before a poll takes place, an event handler can return false
* in order to cancel the poll.
* @param {Ext.direct.PollingProvider}
*/
'beforepoll',
/**
* @event poll
* This event has not yet been implemented.
* @param {Ext.direct.PollingProvider}
*/
'poll'
);
},
// inherited
isConnected: function(){
return !!this.pollTask;
},
/**
* Connect to the server-side and begin the polling process. To handle each
* response subscribe to the data event.
*/
connect: function(){
if(this.url && !this.pollTask){
this.pollTask = Ext.TaskMgr.start({
run: function(){
if(this.fireEvent('beforepoll', this) !== false){
if(typeof this.url == 'function'){
this.url(this.baseParams);
}else{
Ext.Ajax.request({
url: this.url,
callback: this.onData,
scope: this,
params: this.baseParams
});
}
}
},
interval: this.interval,
scope: this
});
this.fireEvent('connect', this);
}else if(!this.url){
throw 'Error initializing PollingProvider, no url configured.';
}
},
/**
* Disconnect from the server-side and stop the polling process. The disconnect
* event will be fired on a successful disconnect.
*/
disconnect: function(){
if(this.pollTask){
Ext.TaskMgr.stop(this.pollTask);
delete this.pollTask;
this.fireEvent('disconnect', this);
}
},
// private
onData: function(opt, success, xhr){
if(success){
var events = this.getEvents(xhr);
for(var i = 0, len = events.length; i < len; i++){
var e = events[i];
this.fireEvent('data', this, e);
}
}else{
var e = new Ext.Direct.ExceptionEvent({
data: e,
code: Ext.Direct.exceptions.TRANSPORT,
message: 'Unable to connect to the server.',
xhr: xhr
});
this.fireEvent('data', this, e);
}
}
});
Ext.Direct.PROVIDERS['polling'] = Ext.direct.PollingProvider;

View File

@@ -1,110 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.direct.Provider
* @extends Ext.util.Observable
* <p>Ext.direct.Provider is an abstract class meant to be extended.</p>
*
* <p>For example ExtJs implements the following subclasses:</p>
* <pre><code>
Provider
|
+---{@link Ext.direct.JsonProvider JsonProvider}
|
+---{@link Ext.direct.PollingProvider PollingProvider}
|
+---{@link Ext.direct.RemotingProvider RemotingProvider}
* </code></pre>
* @abstract
*/
Ext.direct.Provider = Ext.extend(Ext.util.Observable, {
/**
* @cfg {String} id
* The unique id of the provider (defaults to an {@link Ext#id auto-assigned id}).
* You should assign an id if you need to be able to access the provider later and you do
* not have an object reference available, for example:
* <pre><code>
Ext.Direct.addProvider(
{
type: 'polling',
url: 'php/poll.php',
id: 'poll-provider'
}
);
var p = {@link Ext.Direct Ext.Direct}.{@link Ext.Direct#getProvider getProvider}('poll-provider');
p.disconnect();
* </code></pre>
*/
/**
* @cfg {Number} priority
* Priority of the request. Lower is higher priority, <tt>0</tt> means "duplex" (always on).
* All Providers default to <tt>1</tt> except for PollingProvider which defaults to <tt>3</tt>.
*/
priority: 1,
/**
* @cfg {String} type
* <b>Required</b>, <tt>undefined</tt> by default. The <tt>type</tt> of provider specified
* to {@link Ext.Direct Ext.Direct}.{@link Ext.Direct#addProvider addProvider} to create a
* new Provider. Acceptable values by default are:<div class="mdetail-params"><ul>
* <li><b><tt>polling</tt></b> : {@link Ext.direct.PollingProvider PollingProvider}</li>
* <li><b><tt>remoting</tt></b> : {@link Ext.direct.RemotingProvider RemotingProvider}</li>
* </ul></div>
*/
// private
constructor : function(config){
Ext.apply(this, config);
this.addEvents(
/**
* @event connect
* Fires when the Provider connects to the server-side
* @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
*/
'connect',
/**
* @event disconnect
* Fires when the Provider disconnects from the server-side
* @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
*/
'disconnect',
/**
* @event data
* Fires when the Provider receives data from the server-side
* @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
* @param {event} e The {@link Ext.Direct#eventTypes Ext.Direct.Event type} that occurred.
*/
'data',
/**
* @event exception
* Fires when the Provider receives an exception from the server-side
*/
'exception'
);
Ext.direct.Provider.superclass.constructor.call(this, config);
},
/**
* Returns whether or not the server-side is currently connected.
* Abstract method for subclasses to implement.
*/
isConnected: function(){
return false;
},
/**
* Abstract methods for subclasses to implement.
*/
connect: Ext.emptyFn,
/**
* Abstract methods for subclasses to implement.
*/
disconnect: Ext.emptyFn
});

View File

@@ -1,380 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.direct.RemotingProvider
* @extends Ext.direct.JsonProvider
*
* <p>The {@link Ext.direct.RemotingProvider RemotingProvider} exposes access to
* server side methods on the client (a remote procedure call (RPC) type of
* connection where the client can initiate a procedure on the server).</p>
*
* <p>This allows for code to be organized in a fashion that is maintainable,
* while providing a clear path between client and server, something that is
* not always apparent when using URLs.</p>
*
* <p>To accomplish this the server-side needs to describe what classes and methods
* are available on the client-side. This configuration will typically be
* outputted by the server-side Ext.Direct stack when the API description is built.</p>
*/
Ext.direct.RemotingProvider = Ext.extend(Ext.direct.JsonProvider, {
/**
* @cfg {Object} actions
* Object literal defining the server side actions and methods. For example, if
* the Provider is configured with:
* <pre><code>
"actions":{ // each property within the 'actions' object represents a server side Class
"TestAction":[ // array of methods within each server side Class to be
{ // stubbed out on client
"name":"doEcho",
"len":1
},{
"name":"multiply",// name of method
"len":2 // The number of parameters that will be used to create an
// array of data to send to the server side function.
// Ensure the server sends back a Number, not a String.
},{
"name":"doForm",
"formHandler":true, // direct the client to use specialized form handling method
"len":1
}]
}
* </code></pre>
* <p>Note that a Store is not required, a server method can be called at any time.
* In the following example a <b>client side</b> handler is used to call the
* server side method "multiply" in the server-side "TestAction" Class:</p>
* <pre><code>
TestAction.multiply(
2, 4, // pass two arguments to server, so specify len=2
// callback function after the server is called
// result: the result returned by the server
// e: Ext.Direct.RemotingEvent object
function(result, e){
var t = e.getTransaction();
var action = t.action; // server side Class called
var method = t.method; // server side method called
if(e.status){
var answer = Ext.encode(result); // 8
}else{
var msg = e.message; // failure message
}
}
);
* </code></pre>
* In the example above, the server side "multiply" function will be passed two
* arguments (2 and 4). The "multiply" method should return the value 8 which will be
* available as the <tt>result</tt> in the example above.
*/
/**
* @cfg {String/Object} namespace
* Namespace for the Remoting Provider (defaults to the browser global scope of <i>window</i>).
* Explicitly specify the namespace Object, or specify a String to have a
* {@link Ext#namespace namespace created} implicitly.
*/
/**
* @cfg {String} url
* <b>Required<b>. The url to connect to the {@link Ext.Direct} server-side router.
*/
/**
* @cfg {String} enableUrlEncode
* Specify which param will hold the arguments for the method.
* Defaults to <tt>'data'</tt>.
*/
/**
* @cfg {Number/Boolean} enableBuffer
* <p><tt>true</tt> or <tt>false</tt> to enable or disable combining of method
* calls. If a number is specified this is the amount of time in milliseconds
* to wait before sending a batched request (defaults to <tt>10</tt>).</p>
* <br><p>Calls which are received within the specified timeframe will be
* concatenated together and sent in a single request, optimizing the
* application by reducing the amount of round trips that have to be made
* to the server.</p>
*/
enableBuffer: 10,
/**
* @cfg {Number} maxRetries
* Number of times to re-attempt delivery on failure of a call. Defaults to <tt>1</tt>.
*/
maxRetries: 1,
/**
* @cfg {Number} timeout
* The timeout to use for each request. Defaults to <tt>undefined</tt>.
*/
timeout: undefined,
constructor : function(config){
Ext.direct.RemotingProvider.superclass.constructor.call(this, config);
this.addEvents(
/**
* @event beforecall
* Fires immediately before the client-side sends off the RPC call.
* By returning false from an event handler you can prevent the call from
* executing.
* @param {Ext.direct.RemotingProvider} provider
* @param {Ext.Direct.Transaction} transaction
* @param {Object} meta The meta data
*/
'beforecall',
/**
* @event call
* Fires immediately after the request to the server-side is sent. This does
* NOT fire after the response has come back from the call.
* @param {Ext.direct.RemotingProvider} provider
* @param {Ext.Direct.Transaction} transaction
* @param {Object} meta The meta data
*/
'call'
);
this.namespace = (Ext.isString(this.namespace)) ? Ext.ns(this.namespace) : this.namespace || window;
this.transactions = {};
this.callBuffer = [];
},
// private
initAPI : function(){
var o = this.actions;
for(var c in o){
var cls = this.namespace[c] || (this.namespace[c] = {}),
ms = o[c];
for(var i = 0, len = ms.length; i < len; i++){
var m = ms[i];
cls[m.name] = this.createMethod(c, m);
}
}
},
// inherited
isConnected: function(){
return !!this.connected;
},
connect: function(){
if(this.url){
this.initAPI();
this.connected = true;
this.fireEvent('connect', this);
}else if(!this.url){
throw 'Error initializing RemotingProvider, no url configured.';
}
},
disconnect: function(){
if(this.connected){
this.connected = false;
this.fireEvent('disconnect', this);
}
},
onData: function(opt, success, xhr){
if(success){
var events = this.getEvents(xhr);
for(var i = 0, len = events.length; i < len; i++){
var e = events[i],
t = this.getTransaction(e);
this.fireEvent('data', this, e);
if(t){
this.doCallback(t, e, true);
Ext.Direct.removeTransaction(t);
}
}
}else{
var ts = [].concat(opt.ts);
for(var i = 0, len = ts.length; i < len; i++){
var t = this.getTransaction(ts[i]);
if(t && t.retryCount < this.maxRetries){
t.retry();
}else{
var e = new Ext.Direct.ExceptionEvent({
data: e,
transaction: t,
code: Ext.Direct.exceptions.TRANSPORT,
message: 'Unable to connect to the server.',
xhr: xhr
});
this.fireEvent('data', this, e);
if(t){
this.doCallback(t, e, false);
Ext.Direct.removeTransaction(t);
}
}
}
}
},
getCallData: function(t){
return {
action: t.action,
method: t.method,
data: t.data,
type: 'rpc',
tid: t.tid
};
},
doSend : function(data){
var o = {
url: this.url,
callback: this.onData,
scope: this,
ts: data,
timeout: this.timeout
}, callData;
if(Ext.isArray(data)){
callData = [];
for(var i = 0, len = data.length; i < len; i++){
callData.push(this.getCallData(data[i]));
}
}else{
callData = this.getCallData(data);
}
if(this.enableUrlEncode){
var params = {};
params[Ext.isString(this.enableUrlEncode) ? this.enableUrlEncode : 'data'] = Ext.encode(callData);
o.params = params;
}else{
o.jsonData = callData;
}
Ext.Ajax.request(o);
},
combineAndSend : function(){
var len = this.callBuffer.length;
if(len > 0){
this.doSend(len == 1 ? this.callBuffer[0] : this.callBuffer);
this.callBuffer = [];
}
},
queueTransaction: function(t){
if(t.form){
this.processForm(t);
return;
}
this.callBuffer.push(t);
if(this.enableBuffer){
if(!this.callTask){
this.callTask = new Ext.util.DelayedTask(this.combineAndSend, this);
}
this.callTask.delay(Ext.isNumber(this.enableBuffer) ? this.enableBuffer : 10);
}else{
this.combineAndSend();
}
},
doCall : function(c, m, args){
var data = null, hs = args[m.len], scope = args[m.len+1];
if(m.len !== 0){
data = args.slice(0, m.len);
}
var t = new Ext.Direct.Transaction({
provider: this,
args: args,
action: c,
method: m.name,
data: data,
cb: scope && Ext.isFunction(hs) ? hs.createDelegate(scope) : hs
});
if(this.fireEvent('beforecall', this, t, m) !== false){
Ext.Direct.addTransaction(t);
this.queueTransaction(t);
this.fireEvent('call', this, t, m);
}
},
doForm : function(c, m, form, callback, scope){
var t = new Ext.Direct.Transaction({
provider: this,
action: c,
method: m.name,
args:[form, callback, scope],
cb: scope && Ext.isFunction(callback) ? callback.createDelegate(scope) : callback,
isForm: true
});
if(this.fireEvent('beforecall', this, t, m) !== false){
Ext.Direct.addTransaction(t);
var isUpload = String(form.getAttribute("enctype")).toLowerCase() == 'multipart/form-data',
params = {
extTID: t.tid,
extAction: c,
extMethod: m.name,
extType: 'rpc',
extUpload: String(isUpload)
};
// change made from typeof callback check to callback.params
// to support addl param passing in DirectSubmit EAC 6/2
Ext.apply(t, {
form: Ext.getDom(form),
isUpload: isUpload,
params: callback && Ext.isObject(callback.params) ? Ext.apply(params, callback.params) : params
});
this.fireEvent('call', this, t, m);
this.processForm(t);
}
},
processForm: function(t){
Ext.Ajax.request({
url: this.url,
params: t.params,
callback: this.onData,
scope: this,
form: t.form,
isUpload: t.isUpload,
ts: t
});
},
createMethod : function(c, m){
var f;
if(!m.formHandler){
f = function(){
this.doCall(c, m, Array.prototype.slice.call(arguments, 0));
}.createDelegate(this);
}else{
f = function(form, callback, scope){
this.doForm(c, m, form, callback, scope);
}.createDelegate(this);
}
f.directCfg = {
action: c,
method: m
};
return f;
},
getTransaction: function(opt){
return opt && opt.tid ? Ext.Direct.getTransaction(opt.tid) : null;
},
doCallback: function(t, e){
var fn = e.status ? 'success' : 'failure';
if(t && t.cb){
var hs = t.cb,
result = Ext.isDefined(e.result) ? e.result : e.data;
if(Ext.isFunction(hs)){
hs(result, e);
} else{
Ext.callback(hs[fn], hs.scope, [result, e]);
Ext.callback(hs.callback, hs.scope, [result, e]);
}
}
}
});
Ext.Direct.PROVIDERS['remoting'] = Ext.direct.RemotingProvider;

View File

@@ -1,32 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Direct.Transaction
* @extends Object
* <p>Supporting Class for Ext.Direct (not intended to be used directly).</p>
* @constructor
* @param {Object} config
*/
Ext.Direct.Transaction = function(config){
Ext.apply(this, config);
this.tid = ++Ext.Direct.TID;
this.retryCount = 0;
};
Ext.Direct.Transaction.prototype = {
send: function(){
this.provider.queueTransaction(this);
},
retry: function(){
this.retryCount++;
this.send();
},
getProvider: function(){
return this.provider;
}
};

View File

@@ -1,364 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.ns('Ext.debug');
Ext.debug.Assistant = function(){
var enabled = true;
return {
enable: function(){
enabled = true;
},
disable: function(){
enabled = false;
},
init : function(classes){
var klass,
intercept = false,
fn,
method;
Ext.each(classes, function(cls){
if(this.namespaceExists(cls.name)){
klass = this.getClass(cls.name);
method = cls.instance ? this.addInstanceCheck : this.addPrototypeCheck;
Ext.each(cls.checks, function(check){
intercept = check.intercept == true;
fn = method.call(this, klass, check.name, check.fn, check.intercept == true);
if(check.after){
check.after(fn);
}
}, this);
}
}, this);
},
namespaceExists: function(name){
var parent = window,
exists = true;
Ext.each(name.split('.'), function(n){
if(!Ext.isDefined(parent[n])){
exists = false;
return false;
}
parent = parent[n];
});
return exists;
},
getClass : function(name){
var parent = window;
Ext.each(name.split('.'), function(n){
parent = parent[n];
});
return parent;
},
warn: function(){
if(enabled && window.console){
console.warn.apply(console, arguments);
}
},
error: function(){
if(enabled && window.console){
console.error.apply(console, arguments);
}
},
addPrototypeCheck : function(cls, method, fn, intercept){
return (cls.prototype[method] = cls.prototype[method][intercept ? 'createInterceptor' : 'createSequence'](fn));
},
addInstanceCheck : function(cls, method, fn, intercept){
return (cls[method] = cls[method][intercept ? 'createInterceptor' : 'createSequence'](fn));
}
};
}();
(function(){
var A = Ext.debug.Assistant,
cls = [];
cls.push({
name: 'Ext.util.Observable',
checks: [{
name: 'addListener',
intercept: true,
fn: function(eventName, fn){
if(typeof eventName == 'object'){
var ev, o;
for(ev in eventName){
if(!this.filterOptRe.test(ev)){
o = eventName[ev];
o = o && o.fn ? o.fn : o;
if(!Ext.isFunction(o)){
A.error('Non function passed to event listener', this, ev);
return false;
}
}
}
}else{
if(!Ext.isFunction(fn)){
A.error('Non function passed to event listener', this, eventName);
}
}
},
after: function(method){
Ext.util.Observable.prototype.on = method;
}
}]
});
cls.push({
name: 'Ext.Component',
checks: [{
name: 'render',
intercept: true,
fn: function(container, position){
if(!container && !this.el){
A.error('Unable to render to container', this, container);
}
if(this.contentEl){
var el = Ext.getDom(this.contentEl);
if(!el){
A.error('Specified contentEl does not exist', this, this.contentEl);
return false;
}
}
}
}]
});
cls.push({
name: 'Ext.Container',
checks: [{
name: 'onBeforeAdd',
intercept: true,
fn: function(c){
if(c.isDestroyed){
A.warn('Adding destroyed component to container', c, this);
}
if(c.renderTo){
A.warn('Using renderTo while adding an item to a Container. You should use the add() method or put the item in the items configuration', c, this);
}
if(c.applyTo){
A.warn('Using applyTo while adding an item to a Container. You should use the add() method or put the item in the items configuration', c, this);
}
var type = this.layout.type;
if(type == 'container' || type == 'auto'){
A.warn('A non sizing layout is being used in a container that has child components. This means the child components will not be sized.', this);
}
}
},{
name: 'lookupComponent',
intercept: true,
fn: function(c){
var valid = true;
if(Ext.isEmpty(c)){
valid = false;
}
if(Ext.isString(c)){
c = Ext.ComponentMgr.get(comp);
valid = !Ext.isEmpty(c);
}
if(!valid){
A.error('Adding invalid component to container', this, c);
return false;
}
}
}]
});
cls.push({
name: 'Ext.DataView',
checks: [{
name: 'initComponent',
fn: function(){
if(!this.itemSelector){
A.error('No itemSelector specified', this);
}
}
},{
name: 'afterRender',
fn: function(){
if(!this.store){
A.error('No store attached to DataView', this);
}
}
}]
});
cls.push({
name: 'Ext.Window',
checks: [{
name: 'show',
intercept: true,
fn: function(){
if(this.isDestroyed){
A.error('Trying to show a destroyed window. If you want to reuse the window, look at the closeAction configuration.', this);
return false;
}
}
}]
});
cls.push({
name: 'Ext.grid.GridPanel',
checks: [{
name: 'initComponent',
fn: function(){
if(!this.colModel){
A.error('No column model specified for grid', this);
}
if(!this.store){
A.error('No store specified for grid', this);
}
}
}]
});
cls.push({
name: 'Ext.grid.GridView',
checks: [{
name: 'autoExpand',
intercept: true,
fn: function(){
var g = this.grid,
cm = this.cm;
if(!this.userResized && g.autoExpandColumn){
var tw = cm.getTotalWidth(false),
aw = this.grid.getGridEl().getWidth(true) - this.getScrollOffset();
if(tw != aw){
var ci = cm.getIndexById(g.autoExpandColumn);
if(ci == -1){
A.error('The autoExpandColumn does not exist in the column model', g, g.autoExpandColumn);
return false;
}
}
}
}
}]
});
cls.push({
name: 'Ext.chart.Chart',
checks: [{
name: 'initComponent',
fn: function(){
if(!this.store){
A.error('No store specified for chart', this);
}
}
}]
});
cls.push({
name: 'Ext.tree.TreePanel',
checks: [{
name: 'afterRender',
intercept: true,
fn: function(){
if(!this.root){
A.error('No root node specified for tree', this);
return false;
}
}
}]
});
cls.push({
name: 'Ext',
instance: true,
checks: [{
name: 'extend',
intercept: true,
fn: function(){
if(arguments.length == 2 && !arguments[0]){
A.error('Invalid base class passed to extend', arguments[0]);
return false;
}
if(arguments.length == 3){
if(!arguments[0]){
A.error('Invalid class to extend', arguments[0]);
return false;
}else if(!arguments[1]){
A.error('Invalid base class passed to extend', arguments[1]);
return false;
}
}
}
},{
name: 'override',
intercept: true,
fn: function(c){
if(!c){
A.error('Invalid class passed to override', c);
return false;
}
}
}]
});
cls.push({
name: 'Ext.ComponentMgr',
instance: true,
checks: [{
name: 'register',
intercept: true,
fn: function(c){
if(this.all.indexOfKey(c.id) > -1){
A.warn('A component with this id already exists', c, c.id);
}
}
},{
name: 'create',
intercept: true,
fn: function(config, defaultType){
var types = Ext.ComponentMgr.types;
if(!config.render){
if(config.xtype){
if(!types[config.xtype]){
A.error('Unknown xtype specified', config, config.xtype);
return false;
}
}else{
if(!types[defaultType]){
A.error('Unknown defaultType specified', config, defaultType);
return false;
}
}
}
}
}]
});
cls.push({
name: 'Ext.layout.FitLayout',
checks: [{
name: 'onLayout',
intercept: true,
fn: function(){
var ct = this.container;
if(ct.items.getCount() > 1){
A.warn('More than 1 item in the container. A fit layout will only display a single item.', ct);
}
}
}]
});
if(Ext.BLANK_IMAGE_URL == 'http:/' + '/www.extjs.com/s.gif'){
A.warn('You should set the Ext.BLANK_IMAGE_URL to reference a local copy.');
}
A.init(cls);
})();

View File

@@ -1,333 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.ns('Ext.ux');
Ext.ux.Carousel = Ext.extend(Ext.util.Observable, {
interval: 3,
transitionDuration: 1,
transitionType: 'carousel',
transitionEasing: 'easeOut',
itemSelector: 'img',
activeSlide: 0,
autoPlay: false,
showPlayButton: false,
pauseOnNavigate: false,
wrap: false,
freezeOnHover: false,
navigationOnHover: false,
hideNavigation: false,
width: null,
height: null,
constructor: function(elId, config) {
config = config || {};
Ext.apply(this, config);
Ext.ux.Carousel.superclass.constructor.call(this, config);
this.addEvents(
'beforeprev',
'prev',
'beforenext',
'next',
'change',
'play',
'pause',
'freeze',
'unfreeze'
);
this.el = Ext.get(elId);
this.slides = this.els = [];
if(this.autoPlay || this.showPlayButton) {
this.wrap = true;
};
if(this.autoPlay && typeof config.showPlayButton === 'undefined') {
this.showPlayButton = true;
}
this.initMarkup();
this.initEvents();
if(this.carouselSize > 0) {
this.refresh();
}
},
initMarkup: function() {
var dh = Ext.DomHelper;
this.carouselSize = 0;
var items = this.el.select(this.itemSelector);
this.els.container = dh.append(this.el, {cls: 'ux-carousel-container'}, true);
this.els.slidesWrap = dh.append(this.els.container, {cls: 'ux-carousel-slides-wrap'}, true);
this.els.navigation = dh.append(this.els.container, {cls: 'ux-carousel-nav'}, true).hide();
this.els.caption = dh.append(this.els.navigation, {tag: 'h2', cls: 'ux-carousel-caption'}, true);
this.els.navNext = dh.append(this.els.navigation, {tag: 'a', href: '#', cls: 'ux-carousel-nav-next'}, true);
if(this.showPlayButton) {
this.els.navPlay = dh.append(this.els.navigation, {tag: 'a', href: '#', cls: 'ux-carousel-nav-play'}, true)
}
this.els.navPrev = dh.append(this.els.navigation, {tag: 'a', href: '#', cls: 'ux-carousel-nav-prev'}, true);
// set the dimensions of the container
this.slideWidth = this.width || this.el.getWidth(true);
this.slideHeight = this.height || this.el.getHeight(true);
this.els.container.setStyle({
width: this.slideWidth + 'px',
height: this.slideHeight + 'px'
});
this.els.caption.setWidth((this.slideWidth - (this.els.navNext.getWidth()*2) - (this.showPlayButton ? this.els.navPlay.getWidth() : 0) - 20) + 'px')
items.appendTo(this.els.slidesWrap).each(function(item) {
item = item.wrap({cls: 'ux-carousel-slide'});
this.slides.push(item);
item.setWidth(this.slideWidth + 'px').setHeight(this.slideHeight + 'px');
}, this);
this.carouselSize = this.slides.length;
if(this.navigationOnHover) {
this.els.navigation.setStyle('top', (-1*this.els.navigation.getHeight()) + 'px');
}
this.el.clip();
},
initEvents: function() {
this.els.navPrev.on('click', function(ev) {
ev.preventDefault();
var target = ev.getTarget();
target.blur();
if(Ext.fly(target).hasClass('ux-carousel-nav-disabled')) return;
this.prev();
}, this);
this.els.navNext.on('click', function(ev) {
ev.preventDefault();
var target = ev.getTarget();
target.blur();
if(Ext.fly(target).hasClass('ux-carousel-nav-disabled')) return;
this.next();
}, this);
if(this.showPlayButton) {
this.els.navPlay.on('click', function(ev){
ev.preventDefault();
ev.getTarget().blur();
if(this.playing) {
this.pause();
}
else {
this.play();
}
}, this);
};
if(this.freezeOnHover) {
this.els.container.on('mouseenter', function(){
if(this.playing) {
this.fireEvent('freeze', this.slides[this.activeSlide]);
Ext.TaskMgr.stop(this.playTask);
}
}, this);
this.els.container.on('mouseleave', function(){
if(this.playing) {
this.fireEvent('unfreeze', this.slides[this.activeSlide]);
Ext.TaskMgr.start(this.playTask);
}
}, this, {buffer: (this.interval/2)*1000});
};
if(this.navigationOnHover) {
this.els.container.on('mouseenter', function(){
if(!this.navigationShown) {
this.navigationShown = true;
this.els.navigation.stopFx(false).shift({
y: this.els.container.getY(),
duration: this.transitionDuration
})
}
}, this);
this.els.container.on('mouseleave', function(){
if(this.navigationShown) {
this.navigationShown = false;
this.els.navigation.stopFx(false).shift({
y: this.els.navigation.getHeight() - this.els.container.getY(),
duration: this.transitionDuration
})
}
}, this);
}
if(this.interval && this.autoPlay) {
this.play();
};
},
prev: function() {
if (this.fireEvent('beforeprev') === false) {
return;
}
if(this.pauseOnNavigate) {
this.pause();
}
this.setSlide(this.activeSlide - 1);
this.fireEvent('prev', this.activeSlide);
return this;
},
next: function() {
if(this.fireEvent('beforenext') === false) {
return;
}
if(this.pauseOnNavigate) {
this.pause();
}
this.setSlide(this.activeSlide + 1);
this.fireEvent('next', this.activeSlide);
return this;
},
play: function() {
if(!this.playing) {
this.playTask = this.playTask || {
run: function() {
this.playing = true;
this.setSlide(this.activeSlide+1);
},
interval: this.interval*1000,
scope: this
};
this.playTaskBuffer = this.playTaskBuffer || new Ext.util.DelayedTask(function() {
Ext.TaskMgr.start(this.playTask);
}, this);
this.playTaskBuffer.delay(this.interval*1000);
this.playing = true;
if(this.showPlayButton) {
this.els.navPlay.addClass('ux-carousel-playing');
}
this.fireEvent('play');
}
return this;
},
pause: function() {
if(this.playing) {
Ext.TaskMgr.stop(this.playTask);
this.playTaskBuffer.cancel();
this.playing = false;
if(this.showPlayButton) {
this.els.navPlay.removeClass('ux-carousel-playing');
}
this.fireEvent('pause');
}
return this;
},
clear: function() {
this.els.slidesWrap.update('');
this.slides = [];
this.carouselSize = 0;
this.pause();
return this;
},
add: function(el, refresh) {
var item = Ext.fly(el).appendTo(this.els.slidesWrap).wrap({cls: 'ux-carousel-slide'});
item.setWidth(this.slideWidth + 'px').setHeight(this.slideHeight + 'px');
this.slides.push(item);
if(refresh) {
this.refresh();
}
return this;
},
refresh: function() {
this.carouselSize = this.slides.length;
this.els.slidesWrap.setWidth((this.slideWidth * this.carouselSize) + 'px');
if(this.carouselSize > 0) {
if(!this.hideNavigation) this.els.navigation.show();
this.activeSlide = 0;
this.setSlide(0, true);
}
return this;
},
setSlide: function(index, initial) {
if(!this.wrap && !this.slides[index]) {
return;
}
else if(this.wrap) {
if(index < 0) {
index = this.carouselSize-1;
}
else if(index > this.carouselSize-1) {
index = 0;
}
}
if(!this.slides[index]) {
return;
}
this.els.caption.update(this.slides[index].child(':first-child', true).title || '');
var offset = index * this.slideWidth;
if (!initial) {
switch (this.transitionType) {
case 'fade':
this.slides[index].setOpacity(0);
this.slides[this.activeSlide].stopFx(false).fadeOut({
duration: this.transitionDuration / 2,
callback: function(){
this.els.slidesWrap.setStyle('left', (-1 * offset) + 'px');
this.slides[this.activeSlide].setOpacity(1);
this.slides[index].fadeIn({
duration: this.transitionDuration / 2
});
},
scope: this
})
break;
default:
var xNew = (-1 * offset) + this.els.container.getX();
this.els.slidesWrap.stopFx(false);
this.els.slidesWrap.shift({
duration: this.transitionDuration,
x: xNew,
easing: this.transitionEasing
});
break;
}
}
else {
this.els.slidesWrap.setStyle('left', '0');
}
this.activeSlide = index;
this.updateNav();
this.fireEvent('change', this.slides[index], index);
},
updateNav: function() {
this.els.navPrev.removeClass('ux-carousel-nav-disabled');
this.els.navNext.removeClass('ux-carousel-nav-disabled');
if(!this.wrap) {
if(this.activeSlide === 0) {
this.els.navPrev.addClass('ux-carousel-nav-disabled');
}
if(this.activeSlide === this.carouselSize-1) {
this.els.navNext.addClass('ux-carousel-nav-disabled');
}
}
}
});

View File

@@ -1,78 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.ns('Ext.ux');
Ext.ux.JSONP = (function(){
var _queue = [],
_current = null,
_nextRequest = function() {
_current = null;
if(_queue.length) {
_current = _queue.shift();
_current.script.src = _current.url + '?' + _current.params;
document.getElementsByTagName('head')[0].appendChild(_current.script);
}
};
return {
request: function(url, o) {
if(!url) {
return;
}
var me = this;
o.params = o.params || {};
if(o.callbackKey) {
o.params[o.callbackKey] = 'Ext.ux.JSONP.callback';
}
var params = Ext.urlEncode(o.params);
var script = document.createElement('script');
script.type = 'text/javascript';
if(o.isRawJSON) {
if(Ext.isIE) {
Ext.fly(script).on('readystatechange', function() {
if(script.readyState == 'complete') {
var data = script.innerHTML;
if(data.length) {
me.callback(Ext.decode(data));
}
}
});
}
else {
Ext.fly(script).on('load', function() {
var data = script.innerHTML;
if(data.length) {
me.callback(Ext.decode(data));
}
});
}
}
_queue.push({
url: url,
script: script,
callback: o.callback || function(){},
scope: o.scope || window,
params: params || null
});
if(!_current) {
_nextRequest();
}
},
callback: function(json) {
_current.callback.apply(_current.scope, [json]);
Ext.fly(_current.script).removeAllListeners();
document.getElementsByTagName('head')[0].removeChild(_current.script);
_nextRequest();
}
}
})();

View File

@@ -1,366 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.ns('Ext.ux');
Ext.ux.Lightbox = (function(){
var els = {},
images = [],
activeImage,
initialized = false,
selectors = [];
return {
overlayOpacity: 0.85,
animate: true,
resizeSpeed: 8,
borderSize: 10,
labelImage: "Image",
labelOf: "of",
init: function() {
this.resizeDuration = this.animate ? ((11 - this.resizeSpeed) * 0.15) : 0;
this.overlayDuration = this.animate ? 0.2 : 0;
if(!initialized) {
Ext.apply(this, Ext.util.Observable.prototype);
Ext.util.Observable.constructor.call(this);
this.addEvents('open', 'close');
this.initMarkup();
this.initEvents();
initialized = true;
}
},
initMarkup: function() {
els.shim = Ext.DomHelper.append(document.body, {
tag: 'iframe',
id: 'ux-lightbox-shim'
}, true);
els.overlay = Ext.DomHelper.append(document.body, {
id: 'ux-lightbox-overlay'
}, true);
var lightboxTpl = new Ext.Template(this.getTemplate());
els.lightbox = lightboxTpl.append(document.body, {}, true);
var ids =
['outerImageContainer', 'imageContainer', 'image', 'hoverNav', 'navPrev', 'navNext', 'loading', 'loadingLink',
'outerDataContainer', 'dataContainer', 'data', 'details', 'caption', 'imageNumber', 'bottomNav', 'navClose'];
Ext.each(ids, function(id){
els[id] = Ext.get('ux-lightbox-' + id);
});
Ext.each([els.overlay, els.lightbox, els.shim], function(el){
el.setVisibilityMode(Ext.Element.DISPLAY)
el.hide();
});
var size = (this.animate ? 250 : 1) + 'px';
els.outerImageContainer.setStyle({
width: size,
height: size
});
},
getTemplate : function() {
return [
'<div id="ux-lightbox">',
'<div id="ux-lightbox-outerImageContainer">',
'<div id="ux-lightbox-imageContainer">',
'<img id="ux-lightbox-image">',
'<div id="ux-lightbox-hoverNav">',
'<a href="#" id="ux-lightbox-navPrev"></a>',
'<a href="#" id="ux-lightbox-navNext"></a>',
'</div>',
'<div id="ux-lightbox-loading">',
'<a id="ux-lightbox-loadingLink"></a>',
'</div>',
'</div>',
'</div>',
'<div id="ux-lightbox-outerDataContainer">',
'<div id="ux-lightbox-dataContainer">',
'<div id="ux-lightbox-data">',
'<div id="ux-lightbox-details">',
'<span id="ux-lightbox-caption"></span>',
'<span id="ux-lightbox-imageNumber"></span>',
'</div>',
'<div id="ux-lightbox-bottomNav">',
'<a href="#" id="ux-lightbox-navClose"></a>',
'</div>',
'</div>',
'</div>',
'</div>',
'</div>'
];
},
initEvents: function() {
var close = function(ev) {
ev.preventDefault();
this.close();
};
els.overlay.on('click', close, this);
els.loadingLink.on('click', close, this);
els.navClose.on('click', close, this);
els.lightbox.on('click', function(ev) {
if(ev.getTarget().id == 'ux-lightbox') {
this.close();
}
}, this);
els.navPrev.on('click', function(ev) {
ev.preventDefault();
this.setImage(activeImage - 1);
}, this);
els.navNext.on('click', function(ev) {
ev.preventDefault();
this.setImage(activeImage + 1);
}, this);
},
register: function(sel, group) {
if(selectors.indexOf(sel) === -1) {
selectors.push(sel);
Ext.fly(document).on('click', function(ev){
var target = ev.getTarget(sel);
if (target) {
ev.preventDefault();
this.open(target, sel, group);
}
}, this);
}
},
open: function(image, sel, group) {
group = group || false;
this.setViewSize();
els.overlay.fadeIn({
duration: this.overlayDuration,
endOpacity: this.overlayOpacity,
callback: function() {
images = [];
var index = 0;
if(!group) {
images.push([image.href, image.title]);
}
else {
var setItems = Ext.query(sel);
Ext.each(setItems, function(item) {
if(item.href) {
images.push([item.href, item.title]);
}
});
while (images[index][0] != image.href) {
index++;
}
}
// calculate top and left offset for the lightbox
var pageScroll = Ext.fly(document).getScroll();
var lightboxTop = pageScroll.top + (Ext.lib.Dom.getViewportHeight() / 10);
var lightboxLeft = pageScroll.left;
els.lightbox.setStyle({
top: lightboxTop + 'px',
left: lightboxLeft + 'px'
}).show();
this.setImage(index);
this.fireEvent('open', images[index]);
},
scope: this
});
},
setViewSize: function(){
var viewSize = this.getViewSize();
els.overlay.setStyle({
width: viewSize[0] + 'px',
height: viewSize[1] + 'px'
});
els.shim.setStyle({
width: viewSize[0] + 'px',
height: viewSize[1] + 'px'
}).show();
},
setImage: function(index){
activeImage = index;
this.disableKeyNav();
if (this.animate) {
els.loading.show();
}
els.image.hide();
els.hoverNav.hide();
els.navPrev.hide();
els.navNext.hide();
els.dataContainer.setOpacity(0.0001);
els.imageNumber.hide();
var preload = new Image();
preload.onload = (function(){
els.image.dom.src = images[activeImage][0];
this.resizeImage(preload.width, preload.height);
}).createDelegate(this);
preload.src = images[activeImage][0];
},
resizeImage: function(w, h){
var wCur = els.outerImageContainer.getWidth();
var hCur = els.outerImageContainer.getHeight();
var wNew = (w + this.borderSize * 2);
var hNew = (h + this.borderSize * 2);
var wDiff = wCur - wNew;
var hDiff = hCur - hNew;
var afterResize = function(){
els.hoverNav.setWidth(els.imageContainer.getWidth() + 'px');
els.navPrev.setHeight(h + 'px');
els.navNext.setHeight(h + 'px');
els.outerDataContainer.setWidth(wNew + 'px');
this.showImage();
};
if (hDiff != 0 || wDiff != 0) {
els.outerImageContainer.shift({
height: hNew,
width: wNew,
duration: this.resizeDuration,
scope: this,
callback: afterResize,
delay: 50
});
}
else {
afterResize.call(this);
}
},
showImage: function(){
els.loading.hide();
els.image.fadeIn({
duration: this.resizeDuration,
scope: this,
callback: function(){
this.updateDetails();
}
});
this.preloadImages();
},
updateDetails: function(){
var detailsWidth = els.data.getWidth(true) - els.navClose.getWidth() - 10;
els.details.setWidth((detailsWidth > 0 ? detailsWidth : 0) + 'px');
els.caption.update(images[activeImage][1]);
els.caption.show();
if (images.length > 1) {
els.imageNumber.update(this.labelImage + ' ' + (activeImage + 1) + ' ' + this.labelOf + ' ' + images.length);
els.imageNumber.show();
}
els.dataContainer.fadeIn({
duration: this.resizeDuration/2,
scope: this,
callback: function() {
var viewSize = this.getViewSize();
els.overlay.setHeight(viewSize[1] + 'px');
this.updateNav();
}
});
},
updateNav: function(){
this.enableKeyNav();
els.hoverNav.show();
// if not first image in set, display prev image button
if (activeImage > 0)
els.navPrev.show();
// if not last image in set, display next image button
if (activeImage < (images.length - 1))
els.navNext.show();
},
enableKeyNav: function() {
Ext.fly(document).on('keydown', this.keyNavAction, this);
},
disableKeyNav: function() {
Ext.fly(document).un('keydown', this.keyNavAction, this);
},
keyNavAction: function(ev) {
var keyCode = ev.getKey();
if (
keyCode == 88 || // x
keyCode == 67 || // c
keyCode == 27
) {
this.close();
}
else if (keyCode == 80 || keyCode == 37){ // display previous image
if (activeImage != 0){
this.setImage(activeImage - 1);
}
}
else if (keyCode == 78 || keyCode == 39){ // display next image
if (activeImage != (images.length - 1)){
this.setImage(activeImage + 1);
}
}
},
preloadImages: function(){
var next, prev;
if (images.length > activeImage + 1) {
next = new Image();
next.src = images[activeImage + 1][0];
}
if (activeImage > 0) {
prev = new Image();
prev.src = images[activeImage - 1][0];
}
},
close: function(){
this.disableKeyNav();
els.lightbox.hide();
els.overlay.fadeOut({
duration: this.overlayDuration
});
els.shim.hide();
this.fireEvent('close', activeImage);
},
getViewSize: function() {
return [Ext.lib.Dom.getViewWidth(), Ext.lib.Dom.getViewHeight()];
}
}
})();
Ext.onReady(Ext.ux.Lightbox.init, Ext.ux.Lightbox);

View File

@@ -1,258 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/*
* Ext Core Library Examples 3.0 Beta
* http://extjs.com/
* Copyright(c) 2006-2009, Ext JS, LLC.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
Ext.ns('Ext.ux');
Ext.ux.Menu = Ext.extend(Ext.util.Observable, {
direction: 'horizontal',
delay: 0.2,
autoWidth: true,
transitionType: 'fade',
transitionDuration: 0.3,
animate: true,
currentClass: 'current',
constructor: function(elId, config) {
config = config || {};
Ext.apply(this, config);
Ext.ux.Menu.superclass.constructor.call(this, config);
this.addEvents(
'show',
'hide',
'click'
);
this.el = Ext.get(elId);
this.initMarkup();
this.initEvents();
this.setCurrent();
},
initMarkup: function(){
this.container = this.el.wrap({cls: 'ux-menu-container', style: 'z-index: ' + --Ext.ux.Menu.zSeed});
this.items = this.el.select('li');
this.el.addClass('ux-menu ux-menu-' + this.direction);
this.el.select('>li').addClass('ux-menu-item-main');
this.el.select('li:has(>ul)').addClass('ux-menu-item-parent').each(function(item) {
item.down('a')
.addClass('ux-menu-link-parent')
.createChild({tag: 'span', cls: 'ux-menu-arrow'});
});
this.el.select('li:first-child>a').addClass('ux-menu-link-first');
this.el.select('li:last-child>a').addClass('ux-menu-link-last');
// create clear fixes for the floating stuff
this.container.addClass('ux-menu-clearfix');
// if autoWidth make every submenu as wide as its biggest child;
if(this.autoWidth) {
this.doAutoWidth();
}
var subs = this.el.select('ul');
subs.addClass('ux-menu-sub');
//ie6 and ie7/ie8 quirksmode need iframes behind the submenus
if(Ext.isBorderBox || Ext.isIE7) {
subs.each(function(item) {
item.parent().createChild({tag: 'iframe', cls: 'ux-menu-ie-iframe'})
.setWidth(item.getWidth())
.setHeight(item.getHeight());
});
}
subs.addClass('ux-menu-hidden');
},
initEvents: function() {
this.showTask = new Ext.util.DelayedTask(this.showMenu, this);
this.hideTask = new Ext.util.DelayedTask(function() {
this.showTask.cancel();
this.hideAll();
this.fireEvent('hide');
}, this);
this.el.hover(function() {
this.hideTask.cancel();
}, function() {
this.hideTask.delay(this.delay*1000);
}, this);
// for each item that has a submenu, create a mouseenter function that shows its submenu
// delay 5 to make sure enter is fired after mouseover
this.el.select('li.ux-menu-item-parent').on('mouseenter', this.onParentEnter, false, {me: this, delay: 5});
// listen for mouseover events on items to hide other items submenus and remove hovers
this.el.on('mouseover', function(ev, t) {
this.manageSiblings(t);
// if this item does not have a submenu, the showMenu task for a sibling could potentially still be fired, so cancel it
if(!Ext.fly(t).hasClass('ux-menu-item-parent')) {
this.showTask.cancel();
}
}, this, {delegate: 'li'});
this.el.on('click', function(ev, t) {
return this.fireEvent('click', ev, t, this);
}, this, {delegate: 'a'})
},
onParentEnter: function(ev, link, o) {
var item = Ext.get(this),
me = o.me;
// if this item is in a submenu and contains a submenu, check if the submenu is not still animating
if(!item.hasClass('ux-menu-item-main') && item.parent('ul').hasActiveFx()) {
item.parent('ul').stopFx(true);
}
// if submenu is already shown dont do anything
if(!item.child('ul').hasClass('ux-menu-hidden')) {
return;
}
me.showTask.delay(me.delay*1000, false, false, [item]);
},
showMenu : function(item) {
var menu = item.child('ul'),
x = y = 0;
item.select('>a').addClass('ux-menu-link-hover');
// some different configurations require different positioning
if(this.direction == 'horizontal' && item.hasClass('ux-menu-item-main')) {
y = item.getHeight()+1;
}
else {
x = item.getWidth()+1;
}
// if its ie, force a repaint of the submenu
if(Ext.isIE) {
menu.select('ul').addClass('ux-menu-hidden');
// ie bugs...
if(Ext.isBorderBox || Ext.isIE7) {
item.down('iframe').setStyle({left: x + 'px', top: y + 'px', display: 'block'});
}
}
menu.setStyle({left: x + 'px', top: y + 'px'}).removeClass('ux-menu-hidden');
if(this.animate) {
switch(this.transitionType) {
case 'slide':
if(this.direction == 'horizontal' && item.hasClass('ux-menu-item-main')) {
menu.slideIn('t', {
duration: this.transitionDuration
});
}
else {
menu.slideIn('l', {
duration: this.transitionDuration
});
}
break;
default:
menu.setOpacity(0.001).fadeIn({
duration: this.transitionDuration
});
break
}
}
this.fireEvent('show', item, menu, this);
},
manageSiblings: function(item) {
var item = Ext.get(item);
item.parent().select('li.ux-menu-item-parent').each(function(child) {
if(child.dom.id !== item.dom.id) {
child.select('>a').removeClass('ux-menu-link-hover');
child.select('ul').stopFx(false).addClass('ux-menu-hidden');
if (Ext.isBorderBox || Ext.isIE7) {
child.select('iframe').setStyle('display', 'none');
}
}
});
},
hideAll: function() {
this.manageSiblings(this.el);
},
setCurrent: function() {
var els = this.el.query('.' + this.currentClass);
if(!els.length) {
return;
}
var item = Ext.get(els[els.length-1]).removeClass(this.currentClass).findParent('li', null, true);
while(item && item.parent('.ux-menu')) {
item.down('a').addClass(this.currentClass);
item = item.parent('li');
}
},
doAutoWidth: function() {
var fixWidth = function(sub) {
var widest = 0;
var items = sub.select('>li');
sub.setStyle({width: 3000 + 'px'});
items.each(function(item) {
widest = Math.max(widest, item.getWidth());
});
widest = Ext.isIE ? widest + 1 : widest;
items.setWidth(widest + 'px');
sub.setWidth(widest + 'px');
}
if(this.direction == 'vertical') {
this.container.select('ul').each(fixWidth);
}
else {
this.el.select('ul').each(fixWidth);
}
}
});
Ext.ux.Menu.zSeed = 10000;

View File

@@ -1,267 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.ns('Ext.ux');
Ext.ux.Rating = Ext.extend(Ext.util.Observable, {
// Configuration options
starWidth: 16,
split: 1,
resetValue: '',
defaultSelected: -1,
selected: -1,
showTitles: true,
// Our class constructor
constructor : function(element, config) {
Ext.apply(this, config);
Ext.ux.Rating.superclass.constructor.call(this);
this.addEvents(
'change',
'reset'
);
this.el = Ext.get(element);
this.init();
},
init : function() {
var me = this;
// Some arrays we are going to store data in
this.values = [];
this.titles = [];
this.stars = [];
// We create a container to put all our stars into
this.container = this.el.createChild({
cls: 'ux-rating-container ux-rating-clearfix'
});
if(this.canReset) {
this.resetEl = this.container.createChild({
cls: 'ux-rating-reset',
cn: [{
tag: 'a',
title: this.showTitles ? (this.resetTitle || 'Reset your vote') : '',
html: 'Reset'
}]
});
this.resetEl.visibilityMode = Ext.Element.DISPLAY;
this.resetEl.hover(function() {
Ext.fly(this).addClass('ux-rating-reset-hover');
}, function() {
Ext.fly(this).removeClass('ux-rating-reset-hover');
});
this.resetEl.on('click', this.reset, this);
}
// We use DomQuery to select the radio buttons
this.radioBoxes = this.el.select('input[type=radio]');
// Then we can loop over the CompositeElement using each
this.radioBoxes.each(this.initStar, this);
// We use DomHelper to create our hidden input
this.input = this.container.createChild({
tag: 'input',
type: 'hidden',
name: this.name,
value: this.values[this.defaultSelected] || this.resetValue
});
// Lets remove all the radio buttons from the DOM
this.radioBoxes.remove();
this.select(this.defaultSelected === undefined ? false : this.defaultSelected)
if(this.disabled) {
this.disable();
} else {
// Enable will set up our event listeners
this.enable();
}
},
initStar : function(item, all, i) {
var sw = Math.floor(this.starWidth / this.split);
// We use the name and disabled attributes of the first radio button
if(i == 0) {
this.name = item.dom.name;
this.disabled = item.dom.disabled;
}
// Saving the value and title for this star
this.values[i] = item.dom.value;
this.titles[i] = item.dom.title;
if(item.dom.checked) {
this.defaultSelected = i;
}
// Now actually create the star!
var star = this.container.createChild({
cls: 'ux-rating-star'
});
var starLink = star.createChild({
tag: 'a',
html: this.values[i],
title: this.showTitles ? this.titles[i] : ''
});
// Prepare division settings
if(this.split) {
var odd = (i % this.split);
star.setWidth(sw);
starLink.setStyle('margin-left', '-' + (odd * sw) + 'px');
}
// Save the reference to this star so we can easily access it later
this.stars.push(star.dom);
},
onStarClick : function(ev, t) {
if(!this.disabled) {
this.select(this.stars.indexOf(t));
}
},
onStarOver : function(ev, t) {
if(!this.disabled) {
this.fillTo(this.stars.indexOf(t), true);
}
},
onStarOut : function(ev, t) {
if(!this.disabled) {
this.fillTo(this.selected, false);
}
},
reset : function(ev, t) {
this.select(-1);
},
select : function(index) {
if(index === false || index === -1) {
// remove current selection in el
this.value = this.resetValue;
this.title = "";
this.input.dom.value = '';
if(this.canReset) {
this.resetEl.setOpacity(0.5);
}
this.fillNone();
if(this.selected !== -1) {
this.fireEvent('change', this, this.values[index], this.stars[index]);
}
this.selected = -1;
}
else if(index !== this.selected) {
// Update some properties
this.selected = index;
this.value = this.values[index];
this.title = this.titles[index];
// Set the value of our hidden input so the rating can be submitted
this.input.dom.value = this.value;
if(this.canReset) {
this.resetEl.setOpacity(0.99);
}
// the fillTo() method will fill the stars up until the selected one
this.fillTo(index, false);
// Lets also not forget to fire our custom event!
this.fireEvent('change', this, this.values[index], this.stars[index]);
}
},
fillTo : function(index, hover) {
if (index != -1) {
var addClass = hover ? 'ux-rating-star-hover' : 'ux-rating-star-on';
var removeClass = hover ? 'ux-rating-star-on' : 'ux-rating-star-hover';
// We add a css class to each star up until the selected one
Ext.each(this.stars.slice(0, index+1), function() {
Ext.fly(this).removeClass(removeClass).addClass(addClass);
});
// And then remove the same class from all the stars after this one
Ext.each(this.stars.slice(index+1), function() {
Ext.fly(this).removeClass([removeClass, addClass]);
});
}
else {
this.fillNone();
}
},
fillNone : function() {
this.container.select('.ux-rating-star').removeClass(['ux-rating-star-hover', 'ux-rating-star-on']);
},
enable : function() {
if(this.canReset) {
this.resetEl.show();
}
this.input.dom.disabled = null;
this.disabled = false;
this.container.removeClass('ux-rating-disabled');
// We will be using the technique of event delegation by listening
// for bubbled up events on the container
this.container.on({
click: this.onStarClick,
mouseover: this.onStarOver,
mouseout: this.onStarOut,
scope: this,
delegate: 'div.ux-rating-star'
});
},
disable : function() {
if(this.canReset) {
this.resetEl.hide();
}
this.input.dom.disabled = true;
this.disabled = true;
this.container.addClass('ux-rating-disabled');
this.container.un({
click: this.onStarClick,
mouseover: this.onStarOver,
mouseout: this.onStarOut,
scope: this,
delegate: 'div.ux-rating-star'
});
},
getValue : function() {
return this.values[this.selected] || this.resetValue;
},
destroy : function() {
this.disable();
this.container.remove();
this.radioBoxes.appendTo(this.el);
if(this.selected !== -1) {
this.radioBoxes.elements[this.selected].checked = true;
}
}
});

View File

@@ -1,79 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.ns('Ext.ux');
Ext.ux.Tabs = Ext.extend(Ext.util.Observable, {
// Configuration options
activeTab: 0,
// Our class constructor
constructor : function(element, config) {
Ext.apply(this, config);
Ext.ux.Tabs.superclass.constructor.call(this);
this.addEvents(
'beforetabchange',
'tabchange'
);
this.el = Ext.get(element);
this.init();
},
init : function() {
var me = this;
this.el.addClass('ux-tabs-container');
this.tabStrip = this.el.child('ul');
this.tabStrip.addClass('ux-tabs-strip');
this.tabStrip.on('click', this.onStripClick, this, {delegate: 'a'});
this.tabs = this.tabStrip.select('> li');
this.cards = this.el.select('> div');
this.cardsContainer = this.el.createChild({
cls: 'ux-tabs-cards'
});
this.cardsContainer.setWidth(this.el.getWidth());
this.cards.addClass('ux-tabs-card');
this.cards.appendTo(this.cardsContainer);
this.el.createChild({
cls: 'ux-tabs-clearfix'
});
this.setActiveTab(this.activeTab || 0);
},
onStripClick : function(ev, t) {
if(t && t.href && t.href.indexOf('#')) {
ev.preventDefault();
this.setActiveTab(t.href.split('#')[1]);
}
},
setActiveTab : function(tab) {
var card;
if(Ext.isString(tab)) {
card = Ext.get(tab);
tab = this.tabStrip.child('a[href=#' + tab + ']').parent();
}
else if (Ext.isNumber(tab)) {
tab = this.tabs.item(tab);
card = Ext.get(tab.first().dom.href.split('#')[1]);
}
if(tab && card && this.fireEvent('beforetabchange', tab, card) !== false) {
card.radioClass('ux-tabs-card-active');
tab.radioClass('ux-tabs-tab-active');
this.fireEvent('tabchange', tab, card);
}
}
});

View File

@@ -1,371 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/*
* Portions of this file are based on pieces of Yahoo User Interface Library
* Copyright (c) 2007, Yahoo! Inc. All rights reserved.
* YUI licensed under the BSD License:
* http://developer.yahoo.net/yui/license.txt
*/
Ext.lib.Ajax = function() {
var activeX = ['Msxml2.XMLHTTP.6.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP'],
CONTENTTYPE = 'Content-Type';
// private
function setHeader(o) {
var conn = o.conn,
prop,
headers = {};
function setTheHeaders(conn, headers){
for (prop in headers) {
if (headers.hasOwnProperty(prop)) {
conn.setRequestHeader(prop, headers[prop]);
}
}
}
Ext.apply(headers, pub.headers, pub.defaultHeaders);
setTheHeaders(conn, headers);
delete pub.headers;
}
// private
function createExceptionObject(tId, callbackArg, isAbort, isTimeout) {
return {
tId : tId,
status : isAbort ? -1 : 0,
statusText : isAbort ? 'transaction aborted' : 'communication failure',
isAbort: isAbort,
isTimeout: isTimeout,
argument : callbackArg
};
}
// private
function initHeader(label, value) {
(pub.headers = pub.headers || {})[label] = value;
}
// private
function createResponseObject(o, callbackArg) {
var headerObj = {},
headerStr,
conn = o.conn,
t,
s,
// see: https://prototype.lighthouseapp.com/projects/8886/tickets/129-ie-mangles-http-response-status-code-204-to-1223
isBrokenStatus = conn.status == 1223;
try {
headerStr = o.conn.getAllResponseHeaders();
Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){
t = v.indexOf(':');
if(t >= 0){
s = v.substr(0, t).toLowerCase();
if(v.charAt(t + 1) == ' '){
++t;
}
headerObj[s] = v.substr(t + 1);
}
});
} catch(e) {}
return {
tId : o.tId,
// Normalize the status and statusText when IE returns 1223, see the above link.
status : isBrokenStatus ? 204 : conn.status,
statusText : isBrokenStatus ? 'No Content' : conn.statusText,
getResponseHeader : function(header){return headerObj[header.toLowerCase()];},
getAllResponseHeaders : function(){return headerStr;},
responseText : conn.responseText,
responseXML : conn.responseXML,
argument : callbackArg
};
}
// private
function releaseObject(o) {
if (o.tId) {
pub.conn[o.tId] = null;
}
o.conn = null;
o = null;
}
// private
function handleTransactionResponse(o, callback, isAbort, isTimeout) {
if (!callback) {
releaseObject(o);
return;
}
var httpStatus, responseObject;
try {
if (o.conn.status !== undefined && o.conn.status != 0) {
httpStatus = o.conn.status;
}
else {
httpStatus = 13030;
}
}
catch(e) {
httpStatus = 13030;
}
if ((httpStatus >= 200 && httpStatus < 300) || (Ext.isIE && httpStatus == 1223)) {
responseObject = createResponseObject(o, callback.argument);
if (callback.success) {
if (!callback.scope) {
callback.success(responseObject);
}
else {
callback.success.apply(callback.scope, [responseObject]);
}
}
}
else {
switch (httpStatus) {
case 12002:
case 12029:
case 12030:
case 12031:
case 12152:
case 13030:
responseObject = createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false), isTimeout);
if (callback.failure) {
if (!callback.scope) {
callback.failure(responseObject);
}
else {
callback.failure.apply(callback.scope, [responseObject]);
}
}
break;
default:
responseObject = createResponseObject(o, callback.argument);
if (callback.failure) {
if (!callback.scope) {
callback.failure(responseObject);
}
else {
callback.failure.apply(callback.scope, [responseObject]);
}
}
}
}
releaseObject(o);
responseObject = null;
}
function checkResponse(o, callback, conn, tId, poll, cbTimeout){
if (conn && conn.readyState == 4) {
clearInterval(poll[tId]);
poll[tId] = null;
if (cbTimeout) {
clearTimeout(pub.timeout[tId]);
pub.timeout[tId] = null;
}
handleTransactionResponse(o, callback);
}
}
function checkTimeout(o, callback){
pub.abort(o, callback, true);
}
// private
function handleReadyState(o, callback){
callback = callback || {};
var conn = o.conn,
tId = o.tId,
poll = pub.poll,
cbTimeout = callback.timeout || null;
if (cbTimeout) {
pub.conn[tId] = conn;
pub.timeout[tId] = setTimeout(checkTimeout.createCallback(o, callback), cbTimeout);
}
poll[tId] = setInterval(checkResponse.createCallback(o, callback, conn, tId, poll, cbTimeout), pub.pollInterval);
}
// private
function asyncRequest(method, uri, callback, postData) {
var o = getConnectionObject() || null;
if (o) {
o.conn.open(method, uri, true);
if (pub.useDefaultXhrHeader) {
initHeader('X-Requested-With', pub.defaultXhrHeader);
}
if(postData && pub.useDefaultHeader && (!pub.headers || !pub.headers[CONTENTTYPE])){
initHeader(CONTENTTYPE, pub.defaultPostHeader);
}
if (pub.defaultHeaders || pub.headers) {
setHeader(o);
}
handleReadyState(o, callback);
o.conn.send(postData || null);
}
return o;
}
// private
function getConnectionObject() {
var o;
try {
if (o = createXhrObject(pub.transactionId)) {
pub.transactionId++;
}
} catch(e) {
} finally {
return o;
}
}
// private
function createXhrObject(transactionId) {
var http;
try {
http = new XMLHttpRequest();
} catch(e) {
for (var i = 0; i < activeX.length; ++i) {
try {
http = new ActiveXObject(activeX[i]);
break;
} catch(e) {}
}
} finally {
return {conn : http, tId : transactionId};
}
}
var pub = {
request : function(method, uri, cb, data, options) {
if(options){
var me = this,
xmlData = options.xmlData,
jsonData = options.jsonData,
hs;
Ext.applyIf(me, options);
if(xmlData || jsonData){
hs = me.headers;
if(!hs || !hs[CONTENTTYPE]){
initHeader(CONTENTTYPE, xmlData ? 'text/xml' : 'application/json');
}
data = xmlData || (!Ext.isPrimitive(jsonData) ? Ext.encode(jsonData) : jsonData);
}
}
return asyncRequest(method || options.method || "POST", uri, cb, data);
},
serializeForm : function(form) {
var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
hasSubmit = false,
encoder = encodeURIComponent,
name,
data = '',
type,
hasValue;
Ext.each(fElements, function(element){
name = element.name;
type = element.type;
if (!element.disabled && name) {
if (/select-(one|multiple)/i.test(type)) {
Ext.each(element.options, function(opt){
if (opt.selected) {
hasValue = opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified;
data += String.format("{0}={1}&", encoder(name), encoder(hasValue ? opt.value : opt.text));
}
});
} else if (!(/file|undefined|reset|button/i.test(type))) {
if (!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)) {
data += encoder(name) + '=' + encoder(element.value) + '&';
hasSubmit = /submit/i.test(type);
}
}
}
});
return data.substr(0, data.length - 1);
},
useDefaultHeader : true,
defaultPostHeader : 'application/x-www-form-urlencoded; charset=UTF-8',
useDefaultXhrHeader : true,
defaultXhrHeader : 'XMLHttpRequest',
poll : {},
timeout : {},
conn: {},
pollInterval : 50,
transactionId : 0,
// This is never called - Is it worth exposing this?
// setProgId : function(id) {
// activeX.unshift(id);
// },
// This is never called - Is it worth exposing this?
// setDefaultPostHeader : function(b) {
// this.useDefaultHeader = b;
// },
// This is never called - Is it worth exposing this?
// setDefaultXhrHeader : function(b) {
// this.useDefaultXhrHeader = b;
// },
// This is never called - Is it worth exposing this?
// setPollingInterval : function(i) {
// if (typeof i == 'number' && isFinite(i)) {
// this.pollInterval = i;
// }
// },
// This is never called - Is it worth exposing this?
// resetDefaultHeaders : function() {
// this.defaultHeaders = null;
// },
abort : function(o, callback, isTimeout) {
var me = this,
tId = o.tId,
isAbort = false;
if (me.isCallInProgress(o)) {
o.conn.abort();
clearInterval(me.poll[tId]);
me.poll[tId] = null;
clearTimeout(pub.timeout[tId]);
me.timeout[tId] = null;
handleTransactionResponse(o, callback, (isAbort = true), isTimeout);
}
return isAbort;
},
isCallInProgress : function(o) {
// if there is a connection and readyState is not 0 or 4
return o.conn && !{0:true,4:true}[o.conn.readyState];
}
};
return pub;
}();

View File

@@ -1,305 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
// Easing functions
(function(){
// shortcuts to aid compression
var abs = Math.abs,
pi = Math.PI,
asin = Math.asin,
pow = Math.pow,
sin = Math.sin,
EXTLIB = Ext.lib;
Ext.apply(EXTLIB.Easing, {
easeBoth: function (t, b, c, d) {
return ((t /= d / 2) < 1) ? c / 2 * t * t + b : -c / 2 * ((--t) * (t - 2) - 1) + b;
},
easeInStrong: function (t, b, c, d) {
return c * (t /= d) * t * t * t + b;
},
easeOutStrong: function (t, b, c, d) {
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
},
easeBothStrong: function (t, b, c, d) {
return ((t /= d / 2) < 1) ? c / 2 * t * t * t * t + b : -c / 2 * ((t -= 2) * t * t * t - 2) + b;
},
elasticIn: function (t, b, c, d, a, p) {
if (t == 0 || (t /= d) == 1) {
return t == 0 ? b : b + c;
}
p = p || (d * .3);
var s;
if (a >= abs(c)) {
s = p / (2 * pi) * asin(c / a);
} else {
a = c;
s = p / 4;
}
return -(a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b;
},
elasticOut: function (t, b, c, d, a, p) {
if (t == 0 || (t /= d) == 1) {
return t == 0 ? b : b + c;
}
p = p || (d * .3);
var s;
if (a >= abs(c)) {
s = p / (2 * pi) * asin(c / a);
} else {
a = c;
s = p / 4;
}
return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b;
},
elasticBoth: function (t, b, c, d, a, p) {
if (t == 0 || (t /= d / 2) == 2) {
return t == 0 ? b : b + c;
}
p = p || (d * (.3 * 1.5));
var s;
if (a >= abs(c)) {
s = p / (2 * pi) * asin(c / a);
} else {
a = c;
s = p / 4;
}
return t < 1 ?
-.5 * (a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b :
a * pow(2, -10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p) * .5 + c + b;
},
backIn: function (t, b, c, d, s) {
s = s || 1.70158;
return c * (t /= d) * t * ((s + 1) * t - s) + b;
},
backOut: function (t, b, c, d, s) {
if (!s) {
s = 1.70158;
}
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
},
backBoth: function (t, b, c, d, s) {
s = s || 1.70158;
return ((t /= d / 2 ) < 1) ?
c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b :
c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
},
bounceIn: function (t, b, c, d) {
return c - EXTLIB.Easing.bounceOut(d - t, 0, c, d) + b;
},
bounceOut: function (t, b, c, d) {
if ((t /= d) < (1 / 2.75)) {
return c * (7.5625 * t * t) + b;
} else if (t < (2 / 2.75)) {
return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
} else if (t < (2.5 / 2.75)) {
return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
}
return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
},
bounceBoth: function (t, b, c, d) {
return (t < d / 2) ?
EXTLIB.Easing.bounceIn(t * 2, 0, c, d) * .5 + b :
EXTLIB.Easing.bounceOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;
}
});
})();
(function() {
var EXTLIB = Ext.lib;
// Color Animation
EXTLIB.Anim.color = function(el, args, duration, easing, cb, scope) {
return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.ColorAnim);
};
EXTLIB.ColorAnim = function(el, attributes, duration, method) {
EXTLIB.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);
};
Ext.extend(EXTLIB.ColorAnim, EXTLIB.AnimBase);
var superclass = EXTLIB.ColorAnim.superclass,
colorRE = /color$/i,
transparentRE = /^transparent|rgba\(0, 0, 0, 0\)$/,
rgbRE = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,
hexRE= /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,
hex3RE = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i,
isset = function(v){
return typeof v !== 'undefined';
};
// private
function parseColor(s) {
var pi = parseInt,
base,
out = null,
c;
if (s.length == 3) {
return s;
}
Ext.each([hexRE, rgbRE, hex3RE], function(re, idx){
base = (idx % 2 == 0) ? 16 : 10;
c = re.exec(s);
if(c && c.length == 4){
out = [pi(c[1], base), pi(c[2], base), pi(c[3], base)];
return false;
}
});
return out;
}
Ext.apply(EXTLIB.ColorAnim.prototype, {
getAttr : function(attr) {
var me = this,
el = me.el,
val;
if(colorRE.test(attr)){
while(el && transparentRE.test(val = Ext.fly(el).getStyle(attr))){
el = el.parentNode;
val = "fff";
}
}else{
val = superclass.getAttr.call(me, attr);
}
return val;
},
doMethod : function(attr, start, end) {
var me = this,
val,
floor = Math.floor,
i,
len,
v;
if(colorRE.test(attr)){
val = [];
end = end || [];
for(i = 0, len = start.length; i < len; i++) {
v = start[i];
val[i] = superclass.doMethod.call(me, attr, v, end[i]);
}
val = 'rgb(' + floor(val[0]) + ',' + floor(val[1]) + ',' + floor(val[2]) + ')';
}else{
val = superclass.doMethod.call(me, attr, start, end);
}
return val;
},
setRunAttr : function(attr) {
var me = this,
a = me.attributes[attr],
to = a.to,
by = a.by,
ra;
superclass.setRunAttr.call(me, attr);
ra = me.runAttrs[attr];
if(colorRE.test(attr)){
var start = parseColor(ra.start),
end = parseColor(ra.end);
if(!isset(to) && isset(by)){
end = parseColor(by);
for(var i=0,len=start.length; i<len; i++) {
end[i] = start[i] + end[i];
}
}
ra.start = start;
ra.end = end;
}
}
});
})();
(function() {
// Scroll Animation
var EXTLIB = Ext.lib;
EXTLIB.Anim.scroll = function(el, args, duration, easing, cb, scope) {
return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.Scroll);
};
EXTLIB.Scroll = function(el, attributes, duration, method) {
if(el){
EXTLIB.Scroll.superclass.constructor.call(this, el, attributes, duration, method);
}
};
Ext.extend(EXTLIB.Scroll, EXTLIB.ColorAnim);
var superclass = EXTLIB.Scroll.superclass,
SCROLL = 'scroll';
Ext.apply(EXTLIB.Scroll.prototype, {
doMethod : function(attr, start, end) {
var val,
me = this,
curFrame = me.curFrame,
totalFrames = me.totalFrames;
if(attr == SCROLL){
val = [me.method(curFrame, start[0], end[0] - start[0], totalFrames),
me.method(curFrame, start[1], end[1] - start[1], totalFrames)];
}else{
val = superclass.doMethod.call(me, attr, start, end);
}
return val;
},
getAttr : function(attr) {
var me = this;
if (attr == SCROLL) {
return [me.el.scrollLeft, me.el.scrollTop];
}else{
return superclass.getAttr.call(me, attr);
}
},
setAttr : function(attr, val, unit) {
var me = this;
if(attr == SCROLL){
me.el.scrollLeft = val[0];
me.el.scrollTop = val[1];
}else{
superclass.setAttr.call(me, attr, val, unit);
}
}
});
})();

View File

@@ -1,475 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
(function(){
var EXTLIB = Ext.lib,
noNegatives = /width|height|opacity|padding/i,
offsetAttribute = /^((width|height)|(top|left))$/,
defaultUnit = /width|height|top$|bottom$|left$|right$/i,
offsetUnit = /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i,
isset = function(v){
return typeof v !== 'undefined';
},
now = function(){
return new Date();
};
EXTLIB.Anim = {
motion : function(el, args, duration, easing, cb, scope) {
return this.run(el, args, duration, easing, cb, scope, Ext.lib.Motion);
},
run : function(el, args, duration, easing, cb, scope, type) {
type = type || Ext.lib.AnimBase;
if (typeof easing == "string") {
easing = Ext.lib.Easing[easing];
}
var anim = new type(el, args, duration, easing);
anim.animateX(function() {
if(Ext.isFunction(cb)){
cb.call(scope);
}
});
return anim;
}
};
EXTLIB.AnimBase = function(el, attributes, duration, method) {
if (el) {
this.init(el, attributes, duration, method);
}
};
EXTLIB.AnimBase.prototype = {
doMethod: function(attr, start, end) {
var me = this;
return me.method(me.curFrame, start, end - start, me.totalFrames);
},
setAttr: function(attr, val, unit) {
if (noNegatives.test(attr) && val < 0) {
val = 0;
}
Ext.fly(this.el, '_anim').setStyle(attr, val + unit);
},
getAttr: function(attr) {
var el = Ext.fly(this.el),
val = el.getStyle(attr),
a = offsetAttribute.exec(attr) || [];
if (val !== 'auto' && !offsetUnit.test(val)) {
return parseFloat(val);
}
return (!!(a[2]) || (el.getStyle('position') == 'absolute' && !!(a[3]))) ? el.dom['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)] : 0;
},
getDefaultUnit: function(attr) {
return defaultUnit.test(attr) ? 'px' : '';
},
animateX : function(callback, scope) {
var me = this,
f = function() {
me.onComplete.removeListener(f);
if (Ext.isFunction(callback)) {
callback.call(scope || me, me);
}
};
me.onComplete.addListener(f, me);
me.animate();
},
setRunAttr: function(attr) {
var me = this,
a = this.attributes[attr],
to = a.to,
by = a.by,
from = a.from,
unit = a.unit,
ra = (this.runAttrs[attr] = {}),
end;
if (!isset(to) && !isset(by)){
return false;
}
var start = isset(from) ? from : me.getAttr(attr);
if (isset(to)) {
end = to;
}else if(isset(by)) {
if (Ext.isArray(start)){
end = [];
for(var i=0,len=start.length; i<len; i++) {
end[i] = start[i] + by[i];
}
}else{
end = start + by;
}
}
Ext.apply(ra, {
start: start,
end: end,
unit: isset(unit) ? unit : me.getDefaultUnit(attr)
});
},
init: function(el, attributes, duration, method) {
var me = this,
actualFrames = 0,
mgr = EXTLIB.AnimMgr;
Ext.apply(me, {
isAnimated: false,
startTime: null,
el: Ext.getDom(el),
attributes: attributes || {},
duration: duration || 1,
method: method || EXTLIB.Easing.easeNone,
useSec: true,
curFrame: 0,
totalFrames: mgr.fps,
runAttrs: {},
animate: function(){
var me = this,
d = me.duration;
if(me.isAnimated){
return false;
}
me.curFrame = 0;
me.totalFrames = me.useSec ? Math.ceil(mgr.fps * d) : d;
mgr.registerElement(me);
},
stop: function(finish){
var me = this;
if(finish){
me.curFrame = me.totalFrames;
me._onTween.fire();
}
mgr.stop(me);
}
});
var onStart = function(){
var me = this,
attr;
me.onStart.fire();
me.runAttrs = {};
for(attr in this.attributes){
this.setRunAttr(attr);
}
me.isAnimated = true;
me.startTime = now();
actualFrames = 0;
};
var onTween = function(){
var me = this;
me.onTween.fire({
duration: now() - me.startTime,
curFrame: me.curFrame
});
var ra = me.runAttrs;
for (var attr in ra) {
this.setAttr(attr, me.doMethod(attr, ra[attr].start, ra[attr].end), ra[attr].unit);
}
++actualFrames;
};
var onComplete = function() {
var me = this,
actual = (now() - me.startTime) / 1000,
data = {
duration: actual,
frames: actualFrames,
fps: actualFrames / actual
};
me.isAnimated = false;
actualFrames = 0;
me.onComplete.fire(data);
};
me.onStart = new Ext.util.Event(me);
me.onTween = new Ext.util.Event(me);
me.onComplete = new Ext.util.Event(me);
(me._onStart = new Ext.util.Event(me)).addListener(onStart);
(me._onTween = new Ext.util.Event(me)).addListener(onTween);
(me._onComplete = new Ext.util.Event(me)).addListener(onComplete);
}
};
Ext.lib.AnimMgr = new function() {
var me = this,
thread = null,
queue = [],
tweenCount = 0;
Ext.apply(me, {
fps: 1000,
delay: 1,
registerElement: function(tween){
queue.push(tween);
++tweenCount;
tween._onStart.fire();
me.start();
},
unRegister: function(tween, index){
tween._onComplete.fire();
index = index || getIndex(tween);
if (index != -1) {
queue.splice(index, 1);
}
if (--tweenCount <= 0) {
me.stop();
}
},
start: function(){
if(thread === null){
thread = setInterval(me.run, me.delay);
}
},
stop: function(tween){
if(!tween){
clearInterval(thread);
for(var i = 0, len = queue.length; i < len; ++i){
if(queue[0].isAnimated){
me.unRegister(queue[0], 0);
}
}
queue = [];
thread = null;
tweenCount = 0;
}else{
me.unRegister(tween);
}
},
run: function(){
var tf, i, len, tween;
for(i = 0, len = queue.length; i<len; i++) {
tween = queue[i];
if(tween && tween.isAnimated){
tf = tween.totalFrames;
if(tween.curFrame < tf || tf === null){
++tween.curFrame;
if(tween.useSec){
correctFrame(tween);
}
tween._onTween.fire();
}else{
me.stop(tween);
}
}
}
}
});
var getIndex = function(anim) {
var i, len;
for(i = 0, len = queue.length; i<len; i++) {
if(queue[i] === anim) {
return i;
}
}
return -1;
};
var correctFrame = function(tween) {
var frames = tween.totalFrames,
frame = tween.curFrame,
duration = tween.duration,
expected = (frame * duration * 1000 / frames),
elapsed = (now() - tween.startTime),
tweak = 0;
if(elapsed < duration * 1000){
tweak = Math.round((elapsed / expected - 1) * frame);
}else{
tweak = frames - (frame + 1);
}
if(tweak > 0 && isFinite(tweak)){
if(tween.curFrame + tweak >= frames){
tweak = frames - (frame + 1);
}
tween.curFrame += tweak;
}
};
};
EXTLIB.Bezier = new function() {
this.getPosition = function(points, t) {
var n = points.length,
tmp = [],
c = 1 - t,
i,
j;
for (i = 0; i < n; ++i) {
tmp[i] = [points[i][0], points[i][1]];
}
for (j = 1; j < n; ++j) {
for (i = 0; i < n - j; ++i) {
tmp[i][0] = c * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];
tmp[i][1] = c * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];
}
}
return [ tmp[0][0], tmp[0][1] ];
};
};
EXTLIB.Easing = {
easeNone: function (t, b, c, d) {
return c * t / d + b;
},
easeIn: function (t, b, c, d) {
return c * (t /= d) * t + b;
},
easeOut: function (t, b, c, d) {
return -c * (t /= d) * (t - 2) + b;
}
};
(function() {
EXTLIB.Motion = function(el, attributes, duration, method) {
if (el) {
EXTLIB.Motion.superclass.constructor.call(this, el, attributes, duration, method);
}
};
Ext.extend(EXTLIB.Motion, Ext.lib.AnimBase);
var superclass = EXTLIB.Motion.superclass,
pointsRe = /^points$/i;
Ext.apply(EXTLIB.Motion.prototype, {
setAttr: function(attr, val, unit){
var me = this,
setAttr = superclass.setAttr;
if (pointsRe.test(attr)) {
unit = unit || 'px';
setAttr.call(me, 'left', val[0], unit);
setAttr.call(me, 'top', val[1], unit);
} else {
setAttr.call(me, attr, val, unit);
}
},
getAttr: function(attr){
var me = this,
getAttr = superclass.getAttr;
return pointsRe.test(attr) ? [getAttr.call(me, 'left'), getAttr.call(me, 'top')] : getAttr.call(me, attr);
},
doMethod: function(attr, start, end){
var me = this;
return pointsRe.test(attr)
? EXTLIB.Bezier.getPosition(me.runAttrs[attr], me.method(me.curFrame, 0, 100, me.totalFrames) / 100)
: superclass.doMethod.call(me, attr, start, end);
},
setRunAttr: function(attr){
if(pointsRe.test(attr)){
var me = this,
el = this.el,
points = this.attributes.points,
control = points.control || [],
from = points.from,
to = points.to,
by = points.by,
DOM = EXTLIB.Dom,
start,
i,
end,
len,
ra;
if(control.length > 0 && !Ext.isArray(control[0])){
control = [control];
}else{
/*
var tmp = [];
for (i = 0,len = control.length; i < len; ++i) {
tmp[i] = control[i];
}
control = tmp;
*/
}
Ext.fly(el, '_anim').position();
DOM.setXY(el, isset(from) ? from : DOM.getXY(el));
start = me.getAttr('points');
if(isset(to)){
end = translateValues.call(me, to, start);
for (i = 0,len = control.length; i < len; ++i) {
control[i] = translateValues.call(me, control[i], start);
}
} else if (isset(by)) {
end = [start[0] + by[0], start[1] + by[1]];
for (i = 0,len = control.length; i < len; ++i) {
control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];
}
}
ra = this.runAttrs[attr] = [start];
if (control.length > 0) {
ra = ra.concat(control);
}
ra[ra.length] = end;
}else{
superclass.setRunAttr.call(this, attr);
}
}
});
var translateValues = function(val, start) {
var pageXY = EXTLIB.Dom.getXY(this.el);
return [val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1]];
};
})();
})();

View File

@@ -1,18 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
(function(){
var libFlyweight;
function fly(el) {
if (!libFlyweight) {
libFlyweight = new Ext.Element.Flyweight();
}
libFlyweight.dom = el;
return libFlyweight;
}

View File

@@ -1,160 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
(function(){
var doc = document,
isCSS1 = doc.compatMode == "CSS1Compat",
MAX = Math.max,
ROUND = Math.round,
PARSEINT = parseInt;
Ext.lib.Dom = {
isAncestor : function(p, c) {
var ret = false;
p = Ext.getDom(p);
c = Ext.getDom(c);
if (p && c) {
if (p.contains) {
return p.contains(c);
} else if (p.compareDocumentPosition) {
return !!(p.compareDocumentPosition(c) & 16);
} else {
while (c = c.parentNode) {
ret = c == p || ret;
}
}
}
return ret;
},
getViewWidth : function(full) {
return full ? this.getDocumentWidth() : this.getViewportWidth();
},
getViewHeight : function(full) {
return full ? this.getDocumentHeight() : this.getViewportHeight();
},
getDocumentHeight: function() {
return MAX(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, this.getViewportHeight());
},
getDocumentWidth: function() {
return MAX(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, this.getViewportWidth());
},
getViewportHeight: function(){
return Ext.isIE ?
(Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :
self.innerHeight;
},
getViewportWidth : function() {
return !Ext.isStrict && !Ext.isOpera ? doc.body.clientWidth :
Ext.isIE ? doc.documentElement.clientWidth : self.innerWidth;
},
getY : function(el) {
return this.getXY(el)[1];
},
getX : function(el) {
return this.getXY(el)[0];
},
getXY : function(el) {
var p,
pe,
b,
bt,
bl,
dbd,
x = 0,
y = 0,
scroll,
hasAbsolute,
bd = (doc.body || doc.documentElement),
ret = [0,0];
el = Ext.getDom(el);
if(el != bd){
if (el.getBoundingClientRect) {
b = el.getBoundingClientRect();
scroll = fly(document).getScroll();
ret = [ROUND(b.left + scroll.left), ROUND(b.top + scroll.top)];
} else {
p = el;
hasAbsolute = fly(el).isStyle("position", "absolute");
while (p) {
pe = fly(p);
x += p.offsetLeft;
y += p.offsetTop;
hasAbsolute = hasAbsolute || pe.isStyle("position", "absolute");
if (Ext.isGecko) {
y += bt = PARSEINT(pe.getStyle("borderTopWidth"), 10) || 0;
x += bl = PARSEINT(pe.getStyle("borderLeftWidth"), 10) || 0;
if (p != el && !pe.isStyle('overflow','visible')) {
x += bl;
y += bt;
}
}
p = p.offsetParent;
}
if (Ext.isSafari && hasAbsolute) {
x -= bd.offsetLeft;
y -= bd.offsetTop;
}
if (Ext.isGecko && !hasAbsolute) {
dbd = fly(bd);
x += PARSEINT(dbd.getStyle("borderLeftWidth"), 10) || 0;
y += PARSEINT(dbd.getStyle("borderTopWidth"), 10) || 0;
}
p = el.parentNode;
while (p && p != bd) {
if (!Ext.isOpera || (p.tagName != 'TR' && !fly(p).isStyle("display", "inline"))) {
x -= p.scrollLeft;
y -= p.scrollTop;
}
p = p.parentNode;
}
ret = [x,y];
}
}
return ret;
},
setXY : function(el, xy) {
(el = Ext.fly(el, '_setXY')).position();
var pts = el.translatePoints(xy),
style = el.dom.style,
pos;
for (pos in pts) {
if (!isNaN(pts[pos])) {
style[pos] = pts[pos] + "px";
}
}
},
setX : function(el, x) {
this.setXY(el, [x, false]);
},
setY : function(el, y) {
this.setXY(el, [false, y]);
}
};
})();

View File

@@ -1,21 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
if (Ext.isIE) {
function fnCleanUp() {
var p = Function.prototype;
delete p.createSequence;
delete p.defer;
delete p.createDelegate;
delete p.createCallback;
delete p.createInterceptor;
window.detachEvent("onunload", fnCleanUp);
}
window.attachEvent("onunload", fnCleanUp);
}
})();

View File

@@ -1,359 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.lib.Event = function() {
var loadComplete = false,
unloadListeners = {},
retryCount = 0,
onAvailStack = [],
_interval,
locked = false,
win = window,
doc = document,
// constants
POLL_RETRYS = 200,
POLL_INTERVAL = 20,
TYPE = 0,
FN = 1,
OBJ = 2,
ADJ_SCOPE = 3,
SCROLLLEFT = 'scrollLeft',
SCROLLTOP = 'scrollTop',
UNLOAD = 'unload',
MOUSEOVER = 'mouseover',
MOUSEOUT = 'mouseout',
// private
doAdd = function() {
var ret;
if (win.addEventListener) {
ret = function(el, eventName, fn, capture) {
if (eventName == 'mouseenter') {
fn = fn.createInterceptor(checkRelatedTarget);
el.addEventListener(MOUSEOVER, fn, (capture));
} else if (eventName == 'mouseleave') {
fn = fn.createInterceptor(checkRelatedTarget);
el.addEventListener(MOUSEOUT, fn, (capture));
} else {
el.addEventListener(eventName, fn, (capture));
}
return fn;
};
} else if (win.attachEvent) {
ret = function(el, eventName, fn, capture) {
el.attachEvent("on" + eventName, fn);
return fn;
};
} else {
ret = function(){};
}
return ret;
}(),
// private
doRemove = function(){
var ret;
if (win.removeEventListener) {
ret = function (el, eventName, fn, capture) {
if (eventName == 'mouseenter') {
eventName = MOUSEOVER;
} else if (eventName == 'mouseleave') {
eventName = MOUSEOUT;
}
el.removeEventListener(eventName, fn, (capture));
};
} else if (win.detachEvent) {
ret = function (el, eventName, fn) {
el.detachEvent("on" + eventName, fn);
};
} else {
ret = function(){};
}
return ret;
}();
function checkRelatedTarget(e) {
return !elContains(e.currentTarget, pub.getRelatedTarget(e));
}
function elContains(parent, child) {
if(parent && parent.firstChild){
while(child) {
if(child === parent) {
return true;
}
child = child.parentNode;
if(child && (child.nodeType != 1)) {
child = null;
}
}
}
return false;
}
// private
function _tryPreloadAttach() {
var ret = false,
notAvail = [],
element, i, v, override,
tryAgain = !loadComplete || (retryCount > 0);
if(!locked){
locked = true;
for(i = 0; i < onAvailStack.length; ++i){
v = onAvailStack[i];
if(v && (element = doc.getElementById(v.id))){
if(!v.checkReady || loadComplete || element.nextSibling || (doc && doc.body)) {
override = v.override;
element = override ? (override === true ? v.obj : override) : element;
v.fn.call(element, v.obj);
onAvailStack.remove(v);
--i;
}else{
notAvail.push(v);
}
}
}
retryCount = (notAvail.length === 0) ? 0 : retryCount - 1;
if (tryAgain) {
startInterval();
} else {
clearInterval(_interval);
_interval = null;
}
ret = !(locked = false);
}
return ret;
}
// private
function startInterval() {
if(!_interval){
var callback = function() {
_tryPreloadAttach();
};
_interval = setInterval(callback, POLL_INTERVAL);
}
}
// private
function getScroll() {
var dd = doc.documentElement,
db = doc.body;
if(dd && (dd[SCROLLTOP] || dd[SCROLLLEFT])){
return [dd[SCROLLLEFT], dd[SCROLLTOP]];
}else if(db){
return [db[SCROLLLEFT], db[SCROLLTOP]];
}else{
return [0, 0];
}
}
// private
function getPageCoord (ev, xy) {
ev = ev.browserEvent || ev;
var coord = ev['page' + xy];
if (!coord && coord !== 0) {
coord = ev['client' + xy] || 0;
if (Ext.isIE) {
coord += getScroll()[xy == "X" ? 0 : 1];
}
}
return coord;
}
var pub = {
extAdapter: true,
onAvailable : function(p_id, p_fn, p_obj, p_override) {
onAvailStack.push({
id: p_id,
fn: p_fn,
obj: p_obj,
override: p_override,
checkReady: false });
retryCount = POLL_RETRYS;
startInterval();
},
// This function should ALWAYS be called from Ext.EventManager
addListener: function(el, eventName, fn) {
el = Ext.getDom(el);
if (el && fn) {
if (eventName == UNLOAD) {
if (unloadListeners[el.id] === undefined) {
unloadListeners[el.id] = [];
}
unloadListeners[el.id].push([eventName, fn]);
return fn;
}
return doAdd(el, eventName, fn, false);
}
return false;
},
// This function should ALWAYS be called from Ext.EventManager
removeListener: function(el, eventName, fn) {
el = Ext.getDom(el);
var i, len, li, lis;
if (el && fn) {
if(eventName == UNLOAD){
if((lis = unloadListeners[el.id]) !== undefined){
for(i = 0, len = lis.length; i < len; i++){
if((li = lis[i]) && li[TYPE] == eventName && li[FN] == fn){
unloadListeners[el.id].splice(i, 1);
}
}
}
return;
}
doRemove(el, eventName, fn, false);
}
},
getTarget : function(ev) {
ev = ev.browserEvent || ev;
return this.resolveTextNode(ev.target || ev.srcElement);
},
resolveTextNode : Ext.isGecko ? function(node){
if(!node){
return;
}
// work around firefox bug, https://bugzilla.mozilla.org/show_bug.cgi?id=101197
var s = HTMLElement.prototype.toString.call(node);
if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){
return;
}
return node.nodeType == 3 ? node.parentNode : node;
} : function(node){
return node && node.nodeType == 3 ? node.parentNode : node;
},
getRelatedTarget : function(ev) {
ev = ev.browserEvent || ev;
return this.resolveTextNode(ev.relatedTarget ||
(/(mouseout|mouseleave)/.test(ev.type) ? ev.toElement :
/(mouseover|mouseenter)/.test(ev.type) ? ev.fromElement : null));
},
getPageX : function(ev) {
return getPageCoord(ev, "X");
},
getPageY : function(ev) {
return getPageCoord(ev, "Y");
},
getXY : function(ev) {
return [this.getPageX(ev), this.getPageY(ev)];
},
stopEvent : function(ev) {
this.stopPropagation(ev);
this.preventDefault(ev);
},
stopPropagation : function(ev) {
ev = ev.browserEvent || ev;
if (ev.stopPropagation) {
ev.stopPropagation();
} else {
ev.cancelBubble = true;
}
},
preventDefault : function(ev) {
ev = ev.browserEvent || ev;
if (ev.preventDefault) {
ev.preventDefault();
} else {
ev.returnValue = false;
}
},
getEvent : function(e) {
e = e || win.event;
if (!e) {
var c = this.getEvent.caller;
while (c) {
e = c.arguments[0];
if (e && Event == e.constructor) {
break;
}
c = c.caller;
}
}
return e;
},
getCharCode : function(ev) {
ev = ev.browserEvent || ev;
return ev.charCode || ev.keyCode || 0;
},
//clearCache: function() {},
// deprecated, call from EventManager
getListeners : function(el, eventName) {
Ext.EventManager.getListeners(el, eventName);
},
// deprecated, call from EventManager
purgeElement : function(el, recurse, eventName) {
Ext.EventManager.purgeElement(el, recurse, eventName);
},
_load : function(e) {
loadComplete = true;
if (Ext.isIE && e !== true) {
// IE8 complains that _load is null or not an object
// so lets remove self via arguments.callee
doRemove(win, "load", arguments.callee);
}
},
_unload : function(e) {
var EU = Ext.lib.Event,
i, v, ul, id, len, scope;
for (id in unloadListeners) {
ul = unloadListeners[id];
for (i = 0, len = ul.length; i < len; i++) {
v = ul[i];
if (v) {
try{
scope = v[ADJ_SCOPE] ? (v[ADJ_SCOPE] === true ? v[OBJ] : v[ADJ_SCOPE]) : win;
v[FN].call(scope, EU.getEvent(e), v[OBJ]);
}catch(ex){}
}
}
};
Ext.EventManager._unload();
doRemove(win, UNLOAD, EU._unload);
}
};
// Initialize stuff.
pub.on = pub.addListener;
pub.un = pub.removeListener;
if (doc && doc.body) {
pub._load(true);
} else {
doAdd(win, "load", pub._load);
}
doAdd(win, UNLOAD, pub._unload);
_tryPreloadAttach();
return pub;
}();

View File

@@ -1,17 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.lib.Point = function(x, y) {
if (Ext.isArray(x)) {
y = x[1];
x = x[0];
}
var me = this;
me.x = me.right = me.left = me[0] = x;
me.y = me.top = me.bottom = me[1] = y;
};
Ext.lib.Point.prototype = new Ext.lib.Region();

View File

@@ -1,81 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.lib.Region = function(t, r, b, l) {
var me = this;
me.top = t;
me[1] = t;
me.right = r;
me.bottom = b;
me.left = l;
me[0] = l;
};
Ext.lib.Region.prototype = {
contains : function(region) {
var me = this;
return ( region.left >= me.left &&
region.right <= me.right &&
region.top >= me.top &&
region.bottom <= me.bottom );
},
getArea : function() {
var me = this;
return ( (me.bottom - me.top) * (me.right - me.left) );
},
intersect : function(region) {
var me = this,
t = Math.max(me.top, region.top),
r = Math.min(me.right, region.right),
b = Math.min(me.bottom, region.bottom),
l = Math.max(me.left, region.left);
if (b >= t && r >= l) {
return new Ext.lib.Region(t, r, b, l);
}
},
union : function(region) {
var me = this,
t = Math.min(me.top, region.top),
r = Math.max(me.right, region.right),
b = Math.max(me.bottom, region.bottom),
l = Math.min(me.left, region.left);
return new Ext.lib.Region(t, r, b, l);
},
constrainTo : function(r) {
var me = this;
me.top = me.top.constrain(r.top, r.bottom);
me.bottom = me.bottom.constrain(r.top, r.bottom);
me.left = me.left.constrain(r.left, r.right);
me.right = me.right.constrain(r.left, r.right);
return me;
},
adjust : function(t, l, b, r) {
var me = this;
me.top += t;
me.left += l;
me.right += r;
me.bottom += b;
return me;
}
};
Ext.lib.Region.getRegion = function(el) {
var p = Ext.lib.Dom.getXY(el),
t = p[1],
r = p[0] + el.offsetWidth,
b = p[1] + el.offsetHeight,
l = p[0];
return new Ext.lib.Region(t, r, b, l);
};

View File

@@ -1,322 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.CompositeElementLite
* <p>This class encapsulates a <i>collection</i> of DOM elements, providing methods to filter
* members, or to perform collective actions upon the whole set.</p>
* <p>Although they are not listed, this class supports all of the methods of {@link Ext.Element} and
* {@link Ext.Fx}. The methods from these classes will be performed on all the elements in this collection.</p>
* Example:<pre><code>
var els = Ext.select("#some-el div.some-class");
// or select directly from an existing element
var el = Ext.get('some-el');
el.select('div.some-class');
els.setWidth(100); // all elements become 100 width
els.hide(true); // all elements fade out and hide
// or
els.setWidth(100).hide(true);
</code>
*/
Ext.CompositeElementLite = function(els, root){
/**
* <p>The Array of DOM elements which this CompositeElement encapsulates. Read-only.</p>
* <p>This will not <i>usually</i> be accessed in developers' code, but developers wishing
* to augment the capabilities of the CompositeElementLite class may use it when adding
* methods to the class.</p>
* <p>For example to add the <code>nextAll</code> method to the class to <b>add</b> all
* following siblings of selected elements, the code would be</p><code><pre>
Ext.override(Ext.CompositeElementLite, {
nextAll: function() {
var els = this.elements, i, l = els.length, n, r = [], ri = -1;
// Loop through all elements in this Composite, accumulating
// an Array of all siblings.
for (i = 0; i < l; i++) {
for (n = els[i].nextSibling; n; n = n.nextSibling) {
r[++ri] = n;
}
}
// Add all found siblings to this Composite
return this.add(r);
}
});</pre></code>
* @type Array
* @property elements
*/
this.elements = [];
this.add(els, root);
this.el = new Ext.Element.Flyweight();
};
Ext.CompositeElementLite.prototype = {
isComposite: true,
// private
getElement : function(el){
// Set the shared flyweight dom property to the current element
var e = this.el;
e.dom = el;
e.id = el.id;
return e;
},
// private
transformElement : function(el){
return Ext.getDom(el);
},
/**
* Returns the number of elements in this Composite.
* @return Number
*/
getCount : function(){
return this.elements.length;
},
/**
* Adds elements to this Composite object.
* @param {Mixed} els Either an Array of DOM elements to add, or another Composite object who's elements should be added.
* @return {CompositeElement} This Composite object.
*/
add : function(els, root){
var me = this,
elements = me.elements;
if(!els){
return this;
}
if(typeof els == "string"){
els = Ext.Element.selectorFunction(els, root);
}else if(els.isComposite){
els = els.elements;
}else if(!Ext.isIterable(els)){
els = [els];
}
for(var i = 0, len = els.length; i < len; ++i){
elements.push(me.transformElement(els[i]));
}
return me;
},
invoke : function(fn, args){
var me = this,
els = me.elements,
len = els.length,
e,
i;
for(i = 0; i < len; i++) {
e = els[i];
if(e){
Ext.Element.prototype[fn].apply(me.getElement(e), args);
}
}
return me;
},
/**
* Returns a flyweight Element of the dom element object at the specified index
* @param {Number} index
* @return {Ext.Element}
*/
item : function(index){
var me = this,
el = me.elements[index],
out = null;
if(el){
out = me.getElement(el);
}
return out;
},
// fixes scope with flyweight
addListener : function(eventName, handler, scope, opt){
var els = this.elements,
len = els.length,
i, e;
for(i = 0; i<len; i++) {
e = els[i];
if(e) {
Ext.EventManager.on(e, eventName, handler, scope || e, opt);
}
}
return this;
},
/**
* <p>Calls the passed function for each element in this composite.</p>
* @param {Function} fn The function to call. The function is passed the following parameters:<ul>
* <li><b>el</b> : Element<div class="sub-desc">The current Element in the iteration.
* <b>This is the flyweight (shared) Ext.Element instance, so if you require a
* a reference to the dom node, use el.dom.</b></div></li>
* <li><b>c</b> : Composite<div class="sub-desc">This Composite object.</div></li>
* <li><b>idx</b> : Number<div class="sub-desc">The zero-based index in the iteration.</div></li>
* </ul>
* @param {Object} scope (optional) The scope (<i>this</i> reference) in which the function is executed. (defaults to the Element)
* @return {CompositeElement} this
*/
each : function(fn, scope){
var me = this,
els = me.elements,
len = els.length,
i, e;
for(i = 0; i<len; i++) {
e = els[i];
if(e){
e = this.getElement(e);
if(fn.call(scope || e, e, me, i) === false){
break;
}
}
}
return me;
},
/**
* Clears this Composite and adds the elements passed.
* @param {Mixed} els Either an array of DOM elements, or another Composite from which to fill this Composite.
* @return {CompositeElement} this
*/
fill : function(els){
var me = this;
me.elements = [];
me.add(els);
return me;
},
/**
* Filters this composite to only elements that match the passed selector.
* @param {String/Function} selector A string CSS selector or a comparison function.
* The comparison function will be called with the following arguments:<ul>
* <li><code>el</code> : Ext.Element<div class="sub-desc">The current DOM element.</div></li>
* <li><code>index</code> : Number<div class="sub-desc">The current index within the collection.</div></li>
* </ul>
* @return {CompositeElement} this
*/
filter : function(selector){
var els = [],
me = this,
fn = Ext.isFunction(selector) ? selector
: function(el){
return el.is(selector);
};
me.each(function(el, self, i) {
if (fn(el, i) !== false) {
els[els.length] = me.transformElement(el);
}
});
me.elements = els;
return me;
},
/**
* Find the index of the passed element within the composite collection.
* @param el {Mixed} The id of an element, or an Ext.Element, or an HtmlElement to find within the composite collection.
* @return Number The index of the passed Ext.Element in the composite collection, or -1 if not found.
*/
indexOf : function(el){
return this.elements.indexOf(this.transformElement(el));
},
/**
* Replaces the specified element with the passed element.
* @param {Mixed} el The id of an element, the Element itself, the index of the element in this composite
* to replace.
* @param {Mixed} replacement The id of an element or the Element itself.
* @param {Boolean} domReplace (Optional) True to remove and replace the element in the document too.
* @return {CompositeElement} this
*/
replaceElement : function(el, replacement, domReplace){
var index = !isNaN(el) ? el : this.indexOf(el),
d;
if(index > -1){
replacement = Ext.getDom(replacement);
if(domReplace){
d = this.elements[index];
d.parentNode.insertBefore(replacement, d);
Ext.removeNode(d);
}
this.elements.splice(index, 1, replacement);
}
return this;
},
/**
* Removes all elements.
*/
clear : function(){
this.elements = [];
}
};
Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
/**
* @private
* Copies all of the functions from Ext.Element's prototype onto CompositeElementLite's prototype.
* This is called twice - once immediately below, and once again after additional Ext.Element
* are added in Ext JS
*/
Ext.CompositeElementLite.importElementMethods = function() {
var fnName,
ElProto = Ext.Element.prototype,
CelProto = Ext.CompositeElementLite.prototype;
for (fnName in ElProto) {
if (typeof ElProto[fnName] == 'function'){
(function(fnName) {
CelProto[fnName] = CelProto[fnName] || function() {
return this.invoke(fnName, arguments);
};
}).call(CelProto, fnName);
}
}
};
Ext.CompositeElementLite.importElementMethods();
if(Ext.DomQuery){
Ext.Element.selectorFunction = Ext.DomQuery.select;
}
/**
* Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods
* to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or
* {@link Ext.CompositeElementLite CompositeElementLite} object.
* @param {String/Array} selector The CSS selector or an array of elements
* @param {HTMLElement/String} root (optional) The root element of the query or id of the root
* @return {CompositeElementLite/CompositeElement}
* @member Ext.Element
* @method select
*/
Ext.Element.select = function(selector, root){
var els;
if(typeof selector == "string"){
els = Ext.Element.selectorFunction(selector, root);
}else if(selector.length !== undefined){
els = selector;
}else{
throw "Invalid selector";
}
return new Ext.CompositeElementLite(els);
};
/**
* Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods
* to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or
* {@link Ext.CompositeElementLite CompositeElementLite} object.
* @param {String/Array} selector The CSS selector or an array of elements
* @param {HTMLElement/String} root (optional) The root element of the query or id of the root
* @return {CompositeElementLite/CompositeElement}
* @member Ext
* @method select
*/
Ext.select = Ext.Element.select;

View File

@@ -1,426 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.DomHelper
* <p>The DomHelper class provides a layer of abstraction from DOM and transparently supports creating
* elements via DOM or using HTML fragments. It also has the ability to create HTML fragment templates
* from your DOM building code.</p>
*
* <p><b><u>DomHelper element specification object</u></b></p>
* <p>A specification object is used when creating elements. Attributes of this object
* are assumed to be element attributes, except for 4 special attributes:
* <div class="mdetail-params"><ul>
* <li><b><tt>tag</tt></b> : <div class="sub-desc">The tag name of the element</div></li>
* <li><b><tt>children</tt></b> : or <tt>cn</tt><div class="sub-desc">An array of the
* same kind of element definition objects to be created and appended. These can be nested
* as deep as you want.</div></li>
* <li><b><tt>cls</tt></b> : <div class="sub-desc">The class attribute of the element.
* This will end up being either the "class" attribute on a HTML fragment or className
* for a DOM node, depending on whether DomHelper is using fragments or DOM.</div></li>
* <li><b><tt>html</tt></b> : <div class="sub-desc">The innerHTML for the element</div></li>
* </ul></div></p>
*
* <p><b><u>Insertion methods</u></b></p>
* <p>Commonly used insertion methods:
* <div class="mdetail-params"><ul>
* <li><b><tt>{@link #append}</tt></b> : <div class="sub-desc"></div></li>
* <li><b><tt>{@link #insertBefore}</tt></b> : <div class="sub-desc"></div></li>
* <li><b><tt>{@link #insertAfter}</tt></b> : <div class="sub-desc"></div></li>
* <li><b><tt>{@link #overwrite}</tt></b> : <div class="sub-desc"></div></li>
* <li><b><tt>{@link #createTemplate}</tt></b> : <div class="sub-desc"></div></li>
* <li><b><tt>{@link #insertHtml}</tt></b> : <div class="sub-desc"></div></li>
* </ul></div></p>
*
* <p><b><u>Example</u></b></p>
* <p>This is an example, where an unordered list with 3 children items is appended to an existing
* element with id <tt>'my-div'</tt>:<br>
<pre><code>
var dh = Ext.DomHelper; // create shorthand alias
// specification object
var spec = {
id: 'my-ul',
tag: 'ul',
cls: 'my-list',
// append children after creating
children: [ // may also specify 'cn' instead of 'children'
{tag: 'li', id: 'item0', html: 'List Item 0'},
{tag: 'li', id: 'item1', html: 'List Item 1'},
{tag: 'li', id: 'item2', html: 'List Item 2'}
]
};
var list = dh.append(
'my-div', // the context element 'my-div' can either be the id or the actual node
spec // the specification object
);
</code></pre></p>
* <p>Element creation specification parameters in this class may also be passed as an Array of
* specification objects. This can be used to insert multiple sibling nodes into an existing
* container very efficiently. For example, to add more list items to the example above:<pre><code>
dh.append('my-ul', [
{tag: 'li', id: 'item3', html: 'List Item 3'},
{tag: 'li', id: 'item4', html: 'List Item 4'}
]);
* </code></pre></p>
*
* <p><b><u>Templating</u></b></p>
* <p>The real power is in the built-in templating. Instead of creating or appending any elements,
* <tt>{@link #createTemplate}</tt> returns a Template object which can be used over and over to
* insert new elements. Revisiting the example above, we could utilize templating this time:
* <pre><code>
// create the node
var list = dh.append('my-div', {tag: 'ul', cls: 'my-list'});
// get template
var tpl = dh.createTemplate({tag: 'li', id: 'item{0}', html: 'List Item {0}'});
for(var i = 0; i < 5, i++){
tpl.append(list, [i]); // use template to append to the actual node
}
* </code></pre></p>
* <p>An example using a template:<pre><code>
var html = '<a id="{0}" href="{1}" class="nav">{2}</a>';
var tpl = new Ext.DomHelper.createTemplate(html);
tpl.append('blog-roll', ['link1', 'http://www.jackslocum.com/', "Jack&#39;s Site"]);
tpl.append('blog-roll', ['link2', 'http://www.dustindiaz.com/', "Dustin&#39;s Site"]);
* </code></pre></p>
*
* <p>The same example using named parameters:<pre><code>
var html = '<a id="{id}" href="{url}" class="nav">{text}</a>';
var tpl = new Ext.DomHelper.createTemplate(html);
tpl.append('blog-roll', {
id: 'link1',
url: 'http://www.jackslocum.com/',
text: "Jack&#39;s Site"
});
tpl.append('blog-roll', {
id: 'link2',
url: 'http://www.dustindiaz.com/',
text: "Dustin&#39;s Site"
});
* </code></pre></p>
*
* <p><b><u>Compiling Templates</u></b></p>
* <p>Templates are applied using regular expressions. The performance is great, but if
* you are adding a bunch of DOM elements using the same template, you can increase
* performance even further by {@link Ext.Template#compile "compiling"} the template.
* The way "{@link Ext.Template#compile compile()}" works is the template is parsed and
* broken up at the different variable points and a dynamic function is created and eval'ed.
* The generated function performs string concatenation of these parts and the passed
* variables instead of using regular expressions.
* <pre><code>
var html = '<a id="{id}" href="{url}" class="nav">{text}</a>';
var tpl = new Ext.DomHelper.createTemplate(html);
tpl.compile();
//... use template like normal
* </code></pre></p>
*
* <p><b><u>Performance Boost</u></b></p>
* <p>DomHelper will transparently create HTML fragments when it can. Using HTML fragments instead
* of DOM can significantly boost performance.</p>
* <p>Element creation specification parameters may also be strings. If {@link #useDom} is <tt>false</tt>,
* then the string is used as innerHTML. If {@link #useDom} is <tt>true</tt>, a string specification
* results in the creation of a text node. Usage:</p>
* <pre><code>
Ext.DomHelper.useDom = true; // force it to use DOM; reduces performance
* </code></pre>
* @singleton
*/
Ext.DomHelper = function(){
var tempTableEl = null,
emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
tableRe = /^table|tbody|tr|td$/i,
confRe = /tag|children|cn|html$/i,
tableElRe = /td|tr|tbody/i,
cssRe = /([a-z0-9-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi,
endRe = /end/i,
pub,
// kill repeat to save bytes
afterbegin = 'afterbegin',
afterend = 'afterend',
beforebegin = 'beforebegin',
beforeend = 'beforeend',
ts = '<table>',
te = '</table>',
tbs = ts+'<tbody>',
tbe = '</tbody>'+te,
trs = tbs + '<tr>',
tre = '</tr>'+tbe;
// private
function doInsert(el, o, returnElement, pos, sibling, append){
var newNode = pub.insertHtml(pos, Ext.getDom(el), createHtml(o));
return returnElement ? Ext.get(newNode, true) : newNode;
}
// build as innerHTML where available
function createHtml(o){
var b = '',
attr,
val,
key,
cn;
if(typeof o == "string"){
b = o;
} else if (Ext.isArray(o)) {
for (var i=0; i < o.length; i++) {
if(o[i]) {
b += createHtml(o[i]);
}
};
} else {
b += '<' + (o.tag = o.tag || 'div');
for (attr in o) {
val = o[attr];
if(!confRe.test(attr)){
if (typeof val == "object") {
b += ' ' + attr + '="';
for (key in val) {
b += key + ':' + val[key] + ';';
};
b += '"';
}else{
b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '="' + val + '"';
}
}
};
// Now either just close the tag or try to add children and close the tag.
if (emptyTags.test(o.tag)) {
b += '/>';
} else {
b += '>';
if ((cn = o.children || o.cn)) {
b += createHtml(cn);
} else if(o.html){
b += o.html;
}
b += '</' + o.tag + '>';
}
}
return b;
}
function ieTable(depth, s, h, e){
tempTableEl.innerHTML = [s, h, e].join('');
var i = -1,
el = tempTableEl,
ns;
while(++i < depth){
el = el.firstChild;
}
// If the result is multiple siblings, then encapsulate them into one fragment.
if(ns = el.nextSibling){
var df = document.createDocumentFragment();
while(el){
ns = el.nextSibling;
df.appendChild(el);
el = ns;
}
el = df;
}
return el;
}
/**
* @ignore
* Nasty code for IE's broken table implementation
*/
function insertIntoTable(tag, where, el, html) {
var node,
before;
tempTableEl = tempTableEl || document.createElement('div');
if(tag == 'td' && (where == afterbegin || where == beforeend) ||
!tableElRe.test(tag) && (where == beforebegin || where == afterend)) {
return;
}
before = where == beforebegin ? el :
where == afterend ? el.nextSibling :
where == afterbegin ? el.firstChild : null;
if (where == beforebegin || where == afterend) {
el = el.parentNode;
}
if (tag == 'td' || (tag == 'tr' && (where == beforeend || where == afterbegin))) {
node = ieTable(4, trs, html, tre);
} else if ((tag == 'tbody' && (where == beforeend || where == afterbegin)) ||
(tag == 'tr' && (where == beforebegin || where == afterend))) {
node = ieTable(3, tbs, html, tbe);
} else {
node = ieTable(2, ts, html, te);
}
el.insertBefore(node, before);
return node;
}
pub = {
/**
* Returns the markup for the passed Element(s) config.
* @param {Object} o The DOM object spec (and children)
* @return {String}
*/
markup : function(o){
return createHtml(o);
},
/**
* Applies a style specification to an element.
* @param {String/HTMLElement} el The element to apply styles to
* @param {String/Object/Function} styles A style specification string e.g. 'width:100px', or object in the form {width:'100px'}, or
* a function which returns such a specification.
*/
applyStyles : function(el, styles){
if (styles) {
var matches;
el = Ext.fly(el);
if (typeof styles == "function") {
styles = styles.call();
}
if (typeof styles == "string") {
/**
* Since we're using the g flag on the regex, we need to set the lastIndex.
* This automatically happens on some implementations, but not others, see:
* http://stackoverflow.com/questions/2645273/javascript-regular-expression-literal-persists-between-function-calls
* http://blog.stevenlevithan.com/archives/fixing-javascript-regexp
*/
cssRe.lastIndex = 0;
while ((matches = cssRe.exec(styles))) {
el.setStyle(matches[1], matches[2]);
}
} else if (typeof styles == "object") {
el.setStyle(styles);
}
}
},
/**
* Inserts an HTML fragment into the DOM.
* @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd.
* @param {HTMLElement} el The context element
* @param {String} html The HTML fragment
* @return {HTMLElement} The new node
*/
insertHtml : function(where, el, html){
var hash = {},
hashVal,
setStart,
range,
frag,
rangeEl,
rs;
where = where.toLowerCase();
// add these here because they are used in both branches of the condition.
hash[beforebegin] = ['BeforeBegin', 'previousSibling'];
hash[afterend] = ['AfterEnd', 'nextSibling'];
if (el.insertAdjacentHTML) {
if(tableRe.test(el.tagName) && (rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html))){
return rs;
}
// add these two to the hash.
hash[afterbegin] = ['AfterBegin', 'firstChild'];
hash[beforeend] = ['BeforeEnd', 'lastChild'];
if ((hashVal = hash[where])) {
el.insertAdjacentHTML(hashVal[0], html);
return el[hashVal[1]];
}
} else {
range = el.ownerDocument.createRange();
setStart = 'setStart' + (endRe.test(where) ? 'After' : 'Before');
if (hash[where]) {
range[setStart](el);
frag = range.createContextualFragment(html);
el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling);
return el[(where == beforebegin ? 'previous' : 'next') + 'Sibling'];
} else {
rangeEl = (where == afterbegin ? 'first' : 'last') + 'Child';
if (el.firstChild) {
range[setStart](el[rangeEl]);
frag = range.createContextualFragment(html);
if(where == afterbegin){
el.insertBefore(frag, el.firstChild);
}else{
el.appendChild(frag);
}
} else {
el.innerHTML = html;
}
return el[rangeEl];
}
}
throw 'Illegal insertion point -> "' + where + '"';
},
/**
* Creates new DOM element(s) and inserts them before el.
* @param {Mixed} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} returnElement (optional) true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
insertBefore : function(el, o, returnElement){
return doInsert(el, o, returnElement, beforebegin);
},
/**
* Creates new DOM element(s) and inserts them after el.
* @param {Mixed} el The context element
* @param {Object} o The DOM object spec (and children)
* @param {Boolean} returnElement (optional) true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
insertAfter : function(el, o, returnElement){
return doInsert(el, o, returnElement, afterend, 'nextSibling');
},
/**
* Creates new DOM element(s) and inserts them as the first child of el.
* @param {Mixed} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} returnElement (optional) true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
insertFirst : function(el, o, returnElement){
return doInsert(el, o, returnElement, afterbegin, 'firstChild');
},
/**
* Creates new DOM element(s) and appends them to el.
* @param {Mixed} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} returnElement (optional) true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
append : function(el, o, returnElement){
return doInsert(el, o, returnElement, beforeend, '', true);
},
/**
* Creates new DOM element(s) and overwrites the contents of el with them.
* @param {Mixed} el The context element
* @param {Object/String} o The DOM object spec (and children) or raw HTML blob
* @param {Boolean} returnElement (optional) true to return a Ext.Element
* @return {HTMLElement/Ext.Element} The new node
*/
overwrite : function(el, o, returnElement){
el = Ext.getDom(el);
el.innerHTML = createHtml(o);
return returnElement ? Ext.get(el.firstChild) : el.firstChild;
},
createHtml : createHtml
};
return pub;
}();

View File

@@ -1,932 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/*
* This is code is also distributed under MIT license for use
* with jQuery and prototype JavaScript libraries.
*/
/**
* @class Ext.DomQuery
Provides high performance selector/xpath processing by compiling queries into reusable functions. New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).
<p>
DomQuery supports most of the <a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#selectors">CSS3 selectors spec</a>, along with some custom selectors and basic XPath.</p>
<p>
All selectors, attribute filters and pseudos below can be combined infinitely in any order. For example "div.foo:nth-child(odd)[@foo=bar].bar:first" would be a perfectly valid selector. Node filters are processed in the order in which they appear, which allows you to optimize your queries for your document structure.
</p>
<h4>Element Selectors:</h4>
<ul class="list">
<li> <b>*</b> any element</li>
<li> <b>E</b> an element with the tag E</li>
<li> <b>E F</b> All descendent elements of E that have the tag F</li>
<li> <b>E > F</b> or <b>E/F</b> all direct children elements of E that have the tag F</li>
<li> <b>E + F</b> all elements with the tag F that are immediately preceded by an element with the tag E</li>
<li> <b>E ~ F</b> all elements with the tag F that are preceded by a sibling element with the tag E</li>
</ul>
<h4>Attribute Selectors:</h4>
<p>The use of &#64; and quotes are optional. For example, div[&#64;foo='bar'] is also a valid attribute selector.</p>
<ul class="list">
<li> <b>E[foo]</b> has an attribute "foo"</li>
<li> <b>E[foo=bar]</b> has an attribute "foo" that equals "bar"</li>
<li> <b>E[foo^=bar]</b> has an attribute "foo" that starts with "bar"</li>
<li> <b>E[foo$=bar]</b> has an attribute "foo" that ends with "bar"</li>
<li> <b>E[foo*=bar]</b> has an attribute "foo" that contains the substring "bar"</li>
<li> <b>E[foo%=2]</b> has an attribute "foo" that is evenly divisible by 2</li>
<li> <b>E[foo!=bar]</b> attribute "foo" does not equal "bar"</li>
</ul>
<h4>Pseudo Classes:</h4>
<ul class="list">
<li> <b>E:first-child</b> E is the first child of its parent</li>
<li> <b>E:last-child</b> E is the last child of its parent</li>
<li> <b>E:nth-child(<i>n</i>)</b> E is the <i>n</i>th child of its parent (1 based as per the spec)</li>
<li> <b>E:nth-child(odd)</b> E is an odd child of its parent</li>
<li> <b>E:nth-child(even)</b> E is an even child of its parent</li>
<li> <b>E:only-child</b> E is the only child of its parent</li>
<li> <b>E:checked</b> E is an element that is has a checked attribute that is true (e.g. a radio or checkbox) </li>
<li> <b>E:first</b> the first E in the resultset</li>
<li> <b>E:last</b> the last E in the resultset</li>
<li> <b>E:nth(<i>n</i>)</b> the <i>n</i>th E in the resultset (1 based)</li>
<li> <b>E:odd</b> shortcut for :nth-child(odd)</li>
<li> <b>E:even</b> shortcut for :nth-child(even)</li>
<li> <b>E:contains(foo)</b> E's innerHTML contains the substring "foo"</li>
<li> <b>E:nodeValue(foo)</b> E contains a textNode with a nodeValue that equals "foo"</li>
<li> <b>E:not(S)</b> an E element that does not match simple selector S</li>
<li> <b>E:has(S)</b> an E element that has a descendent that matches simple selector S</li>
<li> <b>E:next(S)</b> an E element whose next sibling matches simple selector S</li>
<li> <b>E:prev(S)</b> an E element whose previous sibling matches simple selector S</li>
<li> <b>E:any(S1|S2|S2)</b> an E element which matches any of the simple selectors S1, S2 or S3//\\</li>
</ul>
<h4>CSS Value Selectors:</h4>
<ul class="list">
<li> <b>E{display=none}</b> css value "display" that equals "none"</li>
<li> <b>E{display^=none}</b> css value "display" that starts with "none"</li>
<li> <b>E{display$=none}</b> css value "display" that ends with "none"</li>
<li> <b>E{display*=none}</b> css value "display" that contains the substring "none"</li>
<li> <b>E{display%=2}</b> css value "display" that is evenly divisible by 2</li>
<li> <b>E{display!=none}</b> css value "display" that does not equal "none"</li>
</ul>
* @singleton
*/
Ext.DomQuery = function(){
var cache = {},
simpleCache = {},
valueCache = {},
nonSpace = /\S/,
trimRe = /^\s+|\s+$/g,
tplRe = /\{(\d+)\}/g,
modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
tagTokenRe = /^(#)?([\w-\*]+)/,
nthRe = /(\d*)n\+?(\d*)/,
nthRe2 = /\D/,
// This is for IE MSXML which does not support expandos.
// IE runs the same speed using setAttribute, however FF slows way down
// and Safari completely fails so they need to continue to use expandos.
isIE = window.ActiveXObject ? true : false,
key = 30803;
// this eval is stop the compressor from
// renaming the variable to something shorter
eval("var batch = 30803;");
// Retrieve the child node from a particular
// parent at the specified index.
function child(parent, index){
var i = 0,
n = parent.firstChild;
while(n){
if(n.nodeType == 1){
if(++i == index){
return n;
}
}
n = n.nextSibling;
}
return null;
}
// retrieve the next element node
function next(n){
while((n = n.nextSibling) && n.nodeType != 1);
return n;
}
// retrieve the previous element node
function prev(n){
while((n = n.previousSibling) && n.nodeType != 1);
return n;
}
// Mark each child node with a nodeIndex skipping and
// removing empty text nodes.
function children(parent){
var n = parent.firstChild,
nodeIndex = -1,
nextNode;
while(n){
nextNode = n.nextSibling;
// clean worthless empty nodes.
if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
parent.removeChild(n);
}else{
// add an expando nodeIndex
n.nodeIndex = ++nodeIndex;
}
n = nextNode;
}
return this;
}
// nodeSet - array of nodes
// cls - CSS Class
function byClassName(nodeSet, cls){
if(!cls){
return nodeSet;
}
var result = [], ri = -1;
for(var i = 0, ci; ci = nodeSet[i]; i++){
if((' '+ci.className+' ').indexOf(cls) != -1){
result[++ri] = ci;
}
}
return result;
};
function attrValue(n, attr){
// if its an array, use the first node.
if(!n.tagName && typeof n.length != "undefined"){
n = n[0];
}
if(!n){
return null;
}
if(attr == "for"){
return n.htmlFor;
}
if(attr == "class" || attr == "className"){
return n.className;
}
return n.getAttribute(attr) || n[attr];
};
// ns - nodes
// mode - false, /, >, +, ~
// tagName - defaults to "*"
function getNodes(ns, mode, tagName){
var result = [], ri = -1, cs;
if(!ns){
return result;
}
tagName = tagName || "*";
// convert to array
if(typeof ns.getElementsByTagName != "undefined"){
ns = [ns];
}
// no mode specified, grab all elements by tagName
// at any depth
if(!mode){
for(var i = 0, ni; ni = ns[i]; i++){
cs = ni.getElementsByTagName(tagName);
for(var j = 0, ci; ci = cs[j]; j++){
result[++ri] = ci;
}
}
// Direct Child mode (/ or >)
// E > F or E/F all direct children elements of E that have the tag
} else if(mode == "/" || mode == ">"){
var utag = tagName.toUpperCase();
for(var i = 0, ni, cn; ni = ns[i]; i++){
cn = ni.childNodes;
for(var j = 0, cj; cj = cn[j]; j++){
if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
result[++ri] = cj;
}
}
}
// Immediately Preceding mode (+)
// E + F all elements with the tag F that are immediately preceded by an element with the tag E
}else if(mode == "+"){
var utag = tagName.toUpperCase();
for(var i = 0, n; n = ns[i]; i++){
while((n = n.nextSibling) && n.nodeType != 1);
if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
result[++ri] = n;
}
}
// Sibling mode (~)
// E ~ F all elements with the tag F that are preceded by a sibling element with the tag E
}else if(mode == "~"){
var utag = tagName.toUpperCase();
for(var i = 0, n; n = ns[i]; i++){
while((n = n.nextSibling)){
if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
result[++ri] = n;
}
}
}
}
return result;
}
function concat(a, b){
if(b.slice){
return a.concat(b);
}
for(var i = 0, l = b.length; i < l; i++){
a[a.length] = b[i];
}
return a;
}
function byTag(cs, tagName){
if(cs.tagName || cs == document){
cs = [cs];
}
if(!tagName){
return cs;
}
var result = [], ri = -1;
tagName = tagName.toLowerCase();
for(var i = 0, ci; ci = cs[i]; i++){
if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){
result[++ri] = ci;
}
}
return result;
}
function byId(cs, id){
if(cs.tagName || cs == document){
cs = [cs];
}
if(!id){
return cs;
}
var result = [], ri = -1;
for(var i = 0, ci; ci = cs[i]; i++){
if(ci && ci.id == id){
result[++ri] = ci;
return result;
}
}
return result;
}
// operators are =, !=, ^=, $=, *=, %=, |= and ~=
// custom can be "{"
function byAttribute(cs, attr, value, op, custom){
var result = [],
ri = -1,
useGetStyle = custom == "{",
fn = Ext.DomQuery.operators[op],
a,
xml,
hasXml;
for(var i = 0, ci; ci = cs[i]; i++){
// skip non-element nodes.
if(ci.nodeType != 1){
continue;
}
// only need to do this for the first node
if(!hasXml){
xml = Ext.DomQuery.isXml(ci);
hasXml = true;
}
// we only need to change the property names if we're dealing with html nodes, not XML
if(!xml){
if(useGetStyle){
a = Ext.DomQuery.getStyle(ci, attr);
} else if (attr == "class" || attr == "className"){
a = ci.className;
} else if (attr == "for"){
a = ci.htmlFor;
} else if (attr == "href"){
// getAttribute href bug
// http://www.glennjones.net/Post/809/getAttributehrefbug.htm
a = ci.getAttribute("href", 2);
} else{
a = ci.getAttribute(attr);
}
}else{
a = ci.getAttribute(attr);
}
if((fn && fn(a, value)) || (!fn && a)){
result[++ri] = ci;
}
}
return result;
}
function byPseudo(cs, name, value){
return Ext.DomQuery.pseudos[name](cs, value);
}
function nodupIEXml(cs){
var d = ++key,
r;
cs[0].setAttribute("_nodup", d);
r = [cs[0]];
for(var i = 1, len = cs.length; i < len; i++){
var c = cs[i];
if(!c.getAttribute("_nodup") != d){
c.setAttribute("_nodup", d);
r[r.length] = c;
}
}
for(var i = 0, len = cs.length; i < len; i++){
cs[i].removeAttribute("_nodup");
}
return r;
}
function nodup(cs){
if(!cs){
return [];
}
var len = cs.length, c, i, r = cs, cj, ri = -1;
if(!len || typeof cs.nodeType != "undefined" || len == 1){
return cs;
}
if(isIE && typeof cs[0].selectSingleNode != "undefined"){
return nodupIEXml(cs);
}
var d = ++key;
cs[0]._nodup = d;
for(i = 1; c = cs[i]; i++){
if(c._nodup != d){
c._nodup = d;
}else{
r = [];
for(var j = 0; j < i; j++){
r[++ri] = cs[j];
}
for(j = i+1; cj = cs[j]; j++){
if(cj._nodup != d){
cj._nodup = d;
r[++ri] = cj;
}
}
return r;
}
}
return r;
}
function quickDiffIEXml(c1, c2){
var d = ++key,
r = [];
for(var i = 0, len = c1.length; i < len; i++){
c1[i].setAttribute("_qdiff", d);
}
for(var i = 0, len = c2.length; i < len; i++){
if(c2[i].getAttribute("_qdiff") != d){
r[r.length] = c2[i];
}
}
for(var i = 0, len = c1.length; i < len; i++){
c1[i].removeAttribute("_qdiff");
}
return r;
}
function quickDiff(c1, c2){
var len1 = c1.length,
d = ++key,
r = [];
if(!len1){
return c2;
}
if(isIE && typeof c1[0].selectSingleNode != "undefined"){
return quickDiffIEXml(c1, c2);
}
for(var i = 0; i < len1; i++){
c1[i]._qdiff = d;
}
for(var i = 0, len = c2.length; i < len; i++){
if(c2[i]._qdiff != d){
r[r.length] = c2[i];
}
}
return r;
}
function quickId(ns, mode, root, id){
if(ns == root){
var d = root.ownerDocument || root;
return d.getElementById(id);
}
ns = getNodes(ns, mode, "*");
return byId(ns, id);
}
return {
getStyle : function(el, name){
return Ext.fly(el).getStyle(name);
},
/**
* Compiles a selector/xpath query into a reusable function. The returned function
* takes one parameter "root" (optional), which is the context node from where the query should start.
* @param {String} selector The selector/xpath query
* @param {String} type (optional) Either "select" (the default) or "simple" for a simple selector match
* @return {Function}
*/
compile : function(path, type){
type = type || "select";
// setup fn preamble
var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
mode,
lastPath,
matchers = Ext.DomQuery.matchers,
matchersLn = matchers.length,
modeMatch,
// accept leading mode switch
lmode = path.match(modeRe);
if(lmode && lmode[1]){
fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
path = path.replace(lmode[1], "");
}
// strip leading slashes
while(path.substr(0, 1)=="/"){
path = path.substr(1);
}
while(path && lastPath != path){
lastPath = path;
var tokenMatch = path.match(tagTokenRe);
if(type == "select"){
if(tokenMatch){
// ID Selector
if(tokenMatch[1] == "#"){
fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';
}else{
fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';
}
path = path.replace(tokenMatch[0], "");
}else if(path.substr(0, 1) != '@'){
fn[fn.length] = 'n = getNodes(n, mode, "*");';
}
// type of "simple"
}else{
if(tokenMatch){
if(tokenMatch[1] == "#"){
fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';
}else{
fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';
}
path = path.replace(tokenMatch[0], "");
}
}
while(!(modeMatch = path.match(modeRe))){
var matched = false;
for(var j = 0; j < matchersLn; j++){
var t = matchers[j];
var m = path.match(t.re);
if(m){
fn[fn.length] = t.select.replace(tplRe, function(x, i){
return m[i];
});
path = path.replace(m[0], "");
matched = true;
break;
}
}
// prevent infinite loop on bad selector
if(!matched){
throw 'Error parsing selector, parsing failed at "' + path + '"';
}
}
if(modeMatch[1]){
fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';
path = path.replace(modeMatch[1], "");
}
}
// close fn out
fn[fn.length] = "return nodup(n);\n}";
// eval fn and return it
eval(fn.join(""));
return f;
},
/**
* Selects a group of elements.
* @param {String} selector The selector/xpath query (can be a comma separated list of selectors)
* @param {Node/String} root (optional) The start of the query (defaults to document).
* @return {Array} An Array of DOM elements which match the selector. If there are
* no matches, and empty Array is returned.
*/
jsSelect: function(path, root, type){
// set root to doc if not specified.
root = root || document;
if(typeof root == "string"){
root = document.getElementById(root);
}
var paths = path.split(","),
results = [];
// loop over each selector
for(var i = 0, len = paths.length; i < len; i++){
var subPath = paths[i].replace(trimRe, "");
// compile and place in cache
if(!cache[subPath]){
cache[subPath] = Ext.DomQuery.compile(subPath);
if(!cache[subPath]){
throw subPath + " is not a valid selector";
}
}
var result = cache[subPath](root);
if(result && result != document){
results = results.concat(result);
}
}
// if there were multiple selectors, make sure dups
// are eliminated
if(paths.length > 1){
return nodup(results);
}
return results;
},
isXml: function(el) {
var docEl = (el ? el.ownerDocument || el : 0).documentElement;
return docEl ? docEl.nodeName !== "HTML" : false;
},
select : document.querySelectorAll ? function(path, root, type) {
root = root || document;
if (!Ext.DomQuery.isXml(root)) {
try {
var cs = root.querySelectorAll(path);
return Ext.toArray(cs);
}
catch (ex) {}
}
return Ext.DomQuery.jsSelect.call(this, path, root, type);
} : function(path, root, type) {
return Ext.DomQuery.jsSelect.call(this, path, root, type);
},
/**
* Selects a single element.
* @param {String} selector The selector/xpath query
* @param {Node} root (optional) The start of the query (defaults to document).
* @return {Element} The DOM element which matched the selector.
*/
selectNode : function(path, root){
return Ext.DomQuery.select(path, root)[0];
},
/**
* Selects the value of a node, optionally replacing null with the defaultValue.
* @param {String} selector The selector/xpath query
* @param {Node} root (optional) The start of the query (defaults to document).
* @param {String} defaultValue
* @return {String}
*/
selectValue : function(path, root, defaultValue){
path = path.replace(trimRe, "");
if(!valueCache[path]){
valueCache[path] = Ext.DomQuery.compile(path, "select");
}
var n = valueCache[path](root), v;
n = n[0] ? n[0] : n;
// overcome a limitation of maximum textnode size
// Rumored to potentially crash IE6 but has not been confirmed.
// http://reference.sitepoint.com/javascript/Node/normalize
// https://developer.mozilla.org/En/DOM/Node.normalize
if (typeof n.normalize == 'function') n.normalize();
v = (n && n.firstChild ? n.firstChild.nodeValue : null);
return ((v === null||v === undefined||v==='') ? defaultValue : v);
},
/**
* Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.
* @param {String} selector The selector/xpath query
* @param {Node} root (optional) The start of the query (defaults to document).
* @param {Number} defaultValue
* @return {Number}
*/
selectNumber : function(path, root, defaultValue){
var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
return parseFloat(v);
},
/**
* Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
* @param {String/HTMLElement/Array} el An element id, element or array of elements
* @param {String} selector The simple selector to test
* @return {Boolean}
*/
is : function(el, ss){
if(typeof el == "string"){
el = document.getElementById(el);
}
var isArray = Ext.isArray(el),
result = Ext.DomQuery.filter(isArray ? el : [el], ss);
return isArray ? (result.length == el.length) : (result.length > 0);
},
/**
* Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
* @param {Array} el An array of elements to filter
* @param {String} selector The simple selector to test
* @param {Boolean} nonMatches If true, it returns the elements that DON'T match
* the selector instead of the ones that match
* @return {Array} An Array of DOM elements which match the selector. If there are
* no matches, and empty Array is returned.
*/
filter : function(els, ss, nonMatches){
ss = ss.replace(trimRe, "");
if(!simpleCache[ss]){
simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
}
var result = simpleCache[ss](els);
return nonMatches ? quickDiff(result, els) : result;
},
/**
* Collection of matching regular expressions and code snippets.
* Each capture group within () will be replace the {} in the select
* statement as specified by their index.
*/
matchers : [{
re: /^\.([\w-]+)/,
select: 'n = byClassName(n, " {1} ");'
}, {
re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
select: 'n = byPseudo(n, "{1}", "{2}");'
},{
re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
}, {
re: /^#([\w-]+)/,
select: 'n = byId(n, "{1}");'
},{
re: /^@([\w-]+)/,
select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
}
],
/**
* Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
* New operators can be added as long as the match the format <i>c</i>= where <i>c</i> is any character other than space, &gt; &lt;.
*/
operators : {
"=" : function(a, v){
return a == v;
},
"!=" : function(a, v){
return a != v;
},
"^=" : function(a, v){
return a && a.substr(0, v.length) == v;
},
"$=" : function(a, v){
return a && a.substr(a.length-v.length) == v;
},
"*=" : function(a, v){
return a && a.indexOf(v) !== -1;
},
"%=" : function(a, v){
return (a % v) == 0;
},
"|=" : function(a, v){
return a && (a == v || a.substr(0, v.length+1) == v+'-');
},
"~=" : function(a, v){
return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
}
},
/**
* <p>Object hash of "pseudo class" filter functions which are used when filtering selections. Each function is passed
* two parameters:</p><div class="mdetail-params"><ul>
* <li><b>c</b> : Array<div class="sub-desc">An Array of DOM elements to filter.</div></li>
* <li><b>v</b> : String<div class="sub-desc">The argument (if any) supplied in the selector.</div></li>
* </ul></div>
* <p>A filter function returns an Array of DOM elements which conform to the pseudo class.</p>
* <p>In addition to the provided pseudo classes listed above such as <code>first-child</code> and <code>nth-child</code>,
* developers may add additional, custom psuedo class filters to select elements according to application-specific requirements.</p>
* <p>For example, to filter <code>&lt;a></code> elements to only return links to <i>external</i> resources:</p>
* <code><pre>
Ext.DomQuery.pseudos.external = function(c, v){
var r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
// Include in result set only if it's a link to an external resource
if(ci.hostname != location.hostname){
r[++ri] = ci;
}
}
return r;
};</pre></code>
* Then external links could be gathered with the following statement:<code><pre>
var externalLinks = Ext.select("a:external");
</code></pre>
*/
pseudos : {
"first-child" : function(c){
var r = [], ri = -1, n;
for(var i = 0, ci; ci = n = c[i]; i++){
while((n = n.previousSibling) && n.nodeType != 1);
if(!n){
r[++ri] = ci;
}
}
return r;
},
"last-child" : function(c){
var r = [], ri = -1, n;
for(var i = 0, ci; ci = n = c[i]; i++){
while((n = n.nextSibling) && n.nodeType != 1);
if(!n){
r[++ri] = ci;
}
}
return r;
},
"nth-child" : function(c, a) {
var r = [], ri = -1,
m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
f = (m[1] || 1) - 0, l = m[2] - 0;
for(var i = 0, n; n = c[i]; i++){
var pn = n.parentNode;
if (batch != pn._batch) {
var j = 0;
for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
if(cn.nodeType == 1){
cn.nodeIndex = ++j;
}
}
pn._batch = batch;
}
if (f == 1) {
if (l == 0 || n.nodeIndex == l){
r[++ri] = n;
}
} else if ((n.nodeIndex + l) % f == 0){
r[++ri] = n;
}
}
return r;
},
"only-child" : function(c){
var r = [], ri = -1;;
for(var i = 0, ci; ci = c[i]; i++){
if(!prev(ci) && !next(ci)){
r[++ri] = ci;
}
}
return r;
},
"empty" : function(c){
var r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
var cns = ci.childNodes, j = 0, cn, empty = true;
while(cn = cns[j]){
++j;
if(cn.nodeType == 1 || cn.nodeType == 3){
empty = false;
break;
}
}
if(empty){
r[++ri] = ci;
}
}
return r;
},
"contains" : function(c, v){
var r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
r[++ri] = ci;
}
}
return r;
},
"nodeValue" : function(c, v){
var r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
if(ci.firstChild && ci.firstChild.nodeValue == v){
r[++ri] = ci;
}
}
return r;
},
"checked" : function(c){
var r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
if(ci.checked == true){
r[++ri] = ci;
}
}
return r;
},
"not" : function(c, ss){
return Ext.DomQuery.filter(c, ss, true);
},
"any" : function(c, selectors){
var ss = selectors.split('|'),
r = [], ri = -1, s;
for(var i = 0, ci; ci = c[i]; i++){
for(var j = 0; s = ss[j]; j++){
if(Ext.DomQuery.is(ci, s)){
r[++ri] = ci;
break;
}
}
}
return r;
},
"odd" : function(c){
return this["nth-child"](c, "odd");
},
"even" : function(c){
return this["nth-child"](c, "even");
},
"nth" : function(c, a){
return c[a-1] || [];
},
"first" : function(c){
return c[0] || [];
},
"last" : function(c){
return c[c.length-1] || [];
},
"has" : function(c, ss){
var s = Ext.DomQuery.select,
r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
if(s(ss, ci).length > 0){
r[++ri] = ci;
}
}
return r;
},
"next" : function(c, ss){
var is = Ext.DomQuery.is,
r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
var n = next(ci);
if(n && is(n, ss)){
r[++ri] = ci;
}
}
return r;
},
"prev" : function(c, ss){
var is = Ext.DomQuery.is,
r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
var n = prev(ci);
if(n && is(n, ss)){
r[++ri] = ci;
}
}
return r;
}
}
};
}();
/**
* Selects an array of DOM nodes by CSS/XPath selector. Shorthand of {@link Ext.DomQuery#select}
* @param {String} path The selector/xpath query
* @param {Node} root (optional) The start of the query (defaults to document).
* @return {Array}
* @member Ext
* @method query
*/
Ext.query = Ext.DomQuery.select;

View File

@@ -1,421 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
/**
* Visibility mode constant for use with {@link #setVisibilityMode}. Use visibility to hide element
* @static
* @type Number
*/
Ext.Element.VISIBILITY = 1;
/**
* Visibility mode constant for use with {@link #setVisibilityMode}. Use display to hide element
* @static
* @type Number
*/
Ext.Element.DISPLAY = 2;
/**
* Visibility mode constant for use with {@link #setVisibilityMode}. Use offsets (x and y positioning offscreen)
* to hide element.
* @static
* @type Number
*/
Ext.Element.OFFSETS = 3;
Ext.Element.ASCLASS = 4;
/**
* Defaults to 'x-hide-nosize'
* @static
* @type String
*/
Ext.Element.visibilityCls = 'x-hide-nosize';
Ext.Element.addMethods(function(){
var El = Ext.Element,
OPACITY = "opacity",
VISIBILITY = "visibility",
DISPLAY = "display",
HIDDEN = "hidden",
OFFSETS = "offsets",
ASCLASS = "asclass",
NONE = "none",
NOSIZE = 'nosize',
ORIGINALDISPLAY = 'originalDisplay',
VISMODE = 'visibilityMode',
ISVISIBLE = 'isVisible',
data = El.data,
getDisplay = function(dom){
var d = data(dom, ORIGINALDISPLAY);
if(d === undefined){
data(dom, ORIGINALDISPLAY, d = '');
}
return d;
},
getVisMode = function(dom){
var m = data(dom, VISMODE);
if(m === undefined){
data(dom, VISMODE, m = 1);
}
return m;
};
return {
/**
* The element's default display mode (defaults to "")
* @type String
*/
originalDisplay : "",
visibilityMode : 1,
/**
* Sets the element's visibility mode. When setVisible() is called it
* will use this to determine whether to set the visibility or the display property.
* @param {Number} visMode Ext.Element.VISIBILITY or Ext.Element.DISPLAY
* @return {Ext.Element} this
*/
setVisibilityMode : function(visMode){
data(this.dom, VISMODE, visMode);
return this;
},
/**
* Perform custom animation on this element.
* <div><ul class="mdetail-params">
* <li><u>Animation Properties</u></li>
*
* <p>The Animation Control Object enables gradual transitions for any member of an
* element's style object that takes a numeric value including but not limited to
* these properties:</p><div><ul class="mdetail-params">
* <li><tt>bottom, top, left, right</tt></li>
* <li><tt>height, width</tt></li>
* <li><tt>margin, padding</tt></li>
* <li><tt>borderWidth</tt></li>
* <li><tt>opacity</tt></li>
* <li><tt>fontSize</tt></li>
* <li><tt>lineHeight</tt></li>
* </ul></div>
*
*
* <li><u>Animation Property Attributes</u></li>
*
* <p>Each Animation Property is a config object with optional properties:</p>
* <div><ul class="mdetail-params">
* <li><tt>by</tt>* : relative change - start at current value, change by this value</li>
* <li><tt>from</tt> : ignore current value, start from this value</li>
* <li><tt>to</tt>* : start at current value, go to this value</li>
* <li><tt>unit</tt> : any allowable unit specification</li>
* <p>* do not specify both <tt>to</tt> and <tt>by</tt> for an animation property</p>
* </ul></div>
*
* <li><u>Animation Types</u></li>
*
* <p>The supported animation types:</p><div><ul class="mdetail-params">
* <li><tt>'run'</tt> : Default
* <pre><code>
var el = Ext.get('complexEl');
el.animate(
// animation control object
{
borderWidth: {to: 3, from: 0},
opacity: {to: .3, from: 1},
height: {to: 50, from: el.getHeight()},
width: {to: 300, from: el.getWidth()},
top : {by: - 100, unit: 'px'},
},
0.35, // animation duration
null, // callback
'easeOut', // easing method
'run' // animation type ('run','color','motion','scroll')
);
* </code></pre>
* </li>
* <li><tt>'color'</tt>
* <p>Animates transition of background, text, or border colors.</p>
* <pre><code>
el.animate(
// animation control object
{
color: { to: '#06e' },
backgroundColor: { to: '#e06' }
},
0.35, // animation duration
null, // callback
'easeOut', // easing method
'color' // animation type ('run','color','motion','scroll')
);
* </code></pre>
* </li>
*
* <li><tt>'motion'</tt>
* <p>Animates the motion of an element to/from specific points using optional bezier
* way points during transit.</p>
* <pre><code>
el.animate(
// animation control object
{
borderWidth: {to: 3, from: 0},
opacity: {to: .3, from: 1},
height: {to: 50, from: el.getHeight()},
width: {to: 300, from: el.getWidth()},
top : {by: - 100, unit: 'px'},
points: {
to: [50, 100], // go to this point
control: [ // optional bezier way points
[ 600, 800],
[-100, 200]
]
}
},
3000, // animation duration (milliseconds!)
null, // callback
'easeOut', // easing method
'motion' // animation type ('run','color','motion','scroll')
);
* </code></pre>
* </li>
* <li><tt>'scroll'</tt>
* <p>Animate horizontal or vertical scrolling of an overflowing page element.</p>
* <pre><code>
el.animate(
// animation control object
{
scroll: {to: [400, 300]}
},
0.35, // animation duration
null, // callback
'easeOut', // easing method
'scroll' // animation type ('run','color','motion','scroll')
);
* </code></pre>
* </li>
* </ul></div>
*
* </ul></div>
*
* @param {Object} args The animation control args
* @param {Float} duration (optional) How long the animation lasts in seconds (defaults to <tt>.35</tt>)
* @param {Function} onComplete (optional) Function to call when animation completes
* @param {String} easing (optional) {@link Ext.Fx#easing} method to use (defaults to <tt>'easeOut'</tt>)
* @param {String} animType (optional) <tt>'run'</tt> is the default. Can also be <tt>'color'</tt>,
* <tt>'motion'</tt>, or <tt>'scroll'</tt>
* @return {Ext.Element} this
*/
animate : function(args, duration, onComplete, easing, animType){
this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
return this;
},
/*
* @private Internal animation call
*/
anim : function(args, opt, animType, defaultDur, defaultEase, cb){
animType = animType || 'run';
opt = opt || {};
var me = this,
anim = Ext.lib.Anim[animType](
me.dom,
args,
(opt.duration || defaultDur) || .35,
(opt.easing || defaultEase) || 'easeOut',
function(){
if(cb) cb.call(me);
if(opt.callback) opt.callback.call(opt.scope || me, me, opt);
},
me
);
opt.anim = anim;
return anim;
},
// private legacy anim prep
preanim : function(a, i){
return !a[i] ? false : (typeof a[i] == 'object' ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});
},
/**
* Checks whether the element is currently visible using both visibility and display properties.
* @return {Boolean} True if the element is currently visible, else false
*/
isVisible : function() {
var me = this,
dom = me.dom,
visible = data(dom, ISVISIBLE);
if(typeof visible == 'boolean'){ //return the cached value if registered
return visible;
}
//Determine the current state based on display states
visible = !me.isStyle(VISIBILITY, HIDDEN) &&
!me.isStyle(DISPLAY, NONE) &&
!((getVisMode(dom) == El.ASCLASS) && me.hasClass(me.visibilityCls || El.visibilityCls));
data(dom, ISVISIBLE, visible);
return visible;
},
/**
* Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use
* the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property.
* @param {Boolean} visible Whether the element is visible
* @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
* @return {Ext.Element} this
*/
setVisible : function(visible, animate){
var me = this, isDisplay, isVisibility, isOffsets, isNosize,
dom = me.dom,
visMode = getVisMode(dom);
// hideMode string override
if (typeof animate == 'string'){
switch (animate) {
case DISPLAY:
visMode = El.DISPLAY;
break;
case VISIBILITY:
visMode = El.VISIBILITY;
break;
case OFFSETS:
visMode = El.OFFSETS;
break;
case NOSIZE:
case ASCLASS:
visMode = El.ASCLASS;
break;
}
me.setVisibilityMode(visMode);
animate = false;
}
if (!animate || !me.anim) {
if(visMode == El.ASCLASS ){
me[visible?'removeClass':'addClass'](me.visibilityCls || El.visibilityCls);
} else if (visMode == El.DISPLAY){
return me.setDisplayed(visible);
} else if (visMode == El.OFFSETS){
if (!visible){
me.hideModeStyles = {
position: me.getStyle('position'),
top: me.getStyle('top'),
left: me.getStyle('left')
};
me.applyStyles({position: 'absolute', top: '-10000px', left: '-10000px'});
} else {
me.applyStyles(me.hideModeStyles || {position: '', top: '', left: ''});
delete me.hideModeStyles;
}
}else{
me.fixDisplay();
dom.style.visibility = visible ? "visible" : HIDDEN;
}
}else{
// closure for composites
if(visible){
me.setOpacity(.01);
me.setVisible(true);
}
me.anim({opacity: { to: (visible?1:0) }},
me.preanim(arguments, 1),
null,
.35,
'easeIn',
function(){
visible || me.setVisible(false).setOpacity(1);
});
}
data(dom, ISVISIBLE, visible); //set logical visibility state
return me;
},
/**
* @private
* Determine if the Element has a relevant height and width available based
* upon current logical visibility state
*/
hasMetrics : function(){
var dom = this.dom;
return this.isVisible() || (getVisMode(dom) == El.VISIBILITY);
},
/**
* Toggles the element's visibility or display, depending on visibility mode.
* @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
* @return {Ext.Element} this
*/
toggle : function(animate){
var me = this;
me.setVisible(!me.isVisible(), me.preanim(arguments, 0));
return me;
},
/**
* Sets the CSS display property. Uses originalDisplay if the specified value is a boolean true.
* @param {Mixed} value Boolean value to display the element using its default display, or a string to set the display directly.
* @return {Ext.Element} this
*/
setDisplayed : function(value) {
if(typeof value == "boolean"){
value = value ? getDisplay(this.dom) : NONE;
}
this.setStyle(DISPLAY, value);
return this;
},
// private
fixDisplay : function(){
var me = this;
if(me.isStyle(DISPLAY, NONE)){
me.setStyle(VISIBILITY, HIDDEN);
me.setStyle(DISPLAY, getDisplay(this.dom)); // first try reverting to default
if(me.isStyle(DISPLAY, NONE)){ // if that fails, default to block
me.setStyle(DISPLAY, "block");
}
}
},
/**
* Hide this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
hide : function(animate){
// hideMode override
if (typeof animate == 'string'){
this.setVisible(false, animate);
return this;
}
this.setVisible(false, this.preanim(arguments, 0));
return this;
},
/**
* Show this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
show : function(animate){
// hideMode override
if (typeof animate == 'string'){
this.setVisible(true, animate);
return this;
}
this.setVisible(true, this.preanim(arguments, 0));
return this;
}
};
}());

View File

@@ -1,145 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods(
function() {
var GETDOM = Ext.getDom,
GET = Ext.get,
DH = Ext.DomHelper;
return {
/**
* Appends the passed element(s) to this element
* @param {String/HTMLElement/Array/Element/CompositeElement} el
* @return {Ext.Element} this
*/
appendChild: function(el){
return GET(el).appendTo(this);
},
/**
* Appends this element to the passed element
* @param {Mixed} el The new parent element
* @return {Ext.Element} this
*/
appendTo: function(el){
GETDOM(el).appendChild(this.dom);
return this;
},
/**
* Inserts this element before the passed element in the DOM
* @param {Mixed} el The element before which this element will be inserted
* @return {Ext.Element} this
*/
insertBefore: function(el){
(el = GETDOM(el)).parentNode.insertBefore(this.dom, el);
return this;
},
/**
* Inserts this element after the passed element in the DOM
* @param {Mixed} el The element to insert after
* @return {Ext.Element} this
*/
insertAfter: function(el){
(el = GETDOM(el)).parentNode.insertBefore(this.dom, el.nextSibling);
return this;
},
/**
* Inserts (or creates) an element (or DomHelper config) as the first child of this element
* @param {Mixed/Object} el The id or element to insert or a DomHelper config to create and insert
* @return {Ext.Element} The new child
*/
insertFirst: function(el, returnDom){
el = el || {};
if(el.nodeType || el.dom || typeof el == 'string'){ // element
el = GETDOM(el);
this.dom.insertBefore(el, this.dom.firstChild);
return !returnDom ? GET(el) : el;
}else{ // dh config
return this.createChild(el, this.dom.firstChild, returnDom);
}
},
/**
* Replaces the passed element with this element
* @param {Mixed} el The element to replace
* @return {Ext.Element} this
*/
replace: function(el){
el = GET(el);
this.insertBefore(el);
el.remove();
return this;
},
/**
* Replaces this element with the passed element
* @param {Mixed/Object} el The new element or a DomHelper config of an element to create
* @return {Ext.Element} this
*/
replaceWith: function(el){
var me = this;
if(el.nodeType || el.dom || typeof el == 'string'){
el = GETDOM(el);
me.dom.parentNode.insertBefore(el, me.dom);
}else{
el = DH.insertBefore(me.dom, el);
}
delete Ext.elCache[me.id];
Ext.removeNode(me.dom);
me.id = Ext.id(me.dom = el);
Ext.Element.addToCache(me.isFlyweight ? new Ext.Element(me.dom) : me);
return me;
},
/**
* Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child element.
* @param {Object} config DomHelper element config object. If no tag is specified (e.g., {tag:'input'}) then a div will be
* automatically generated with the specified attributes.
* @param {HTMLElement} insertBefore (optional) a child element of this element
* @param {Boolean} returnDom (optional) true to return the dom node instead of creating an Element
* @return {Ext.Element} The new child element
*/
createChild: function(config, insertBefore, returnDom){
config = config || {tag:'div'};
return insertBefore ?
DH.insertBefore(insertBefore, config, returnDom !== true) :
DH[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true);
},
/**
* Creates and wraps this element with another element
* @param {Object} config (optional) DomHelper element config object for the wrapper element or null for an empty div
* @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element
* @return {HTMLElement/Element} The newly created wrapper element
*/
wrap: function(config, returnDom){
var newEl = DH.insertBefore(this.dom, config || {tag: "div"}, !returnDom);
newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
return newEl;
},
/**
* Inserts an html fragment into this element
* @param {String} where Where to insert the html in relation to this element - beforeBegin, afterBegin, beforeEnd, afterEnd.
* @param {String} html The HTML fragment
* @param {Boolean} returnEl (optional) True to return an Ext.Element (defaults to false)
* @return {HTMLElement/Ext.Element} The inserted node (or nearest related if more than 1 inserted)
*/
insertHtml : function(where, html, returnEl){
var el = DH.insertHtml(where, this.dom, html);
return returnEl ? Ext.get(el) : el;
}
};
}());

View File

@@ -1,985 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
* <p>Encapsulates a DOM element, adding simple DOM manipulation facilities, normalizing for browser differences.</p>
* <p>All instances of this class inherit the methods of {@link Ext.Fx} making visual effects easily available to all DOM elements.</p>
* <p>Note that the events documented in this class are not Ext events, they encapsulate browser events. To
* access the underlying browser event, see {@link Ext.EventObject#browserEvent}. Some older
* browsers may not support the full range of events. Which events are supported is beyond the control of ExtJs.</p>
* Usage:<br>
<pre><code>
// by id
var el = Ext.get("my-div");
// by DOM element reference
var el = Ext.get(myDivElement);
</code></pre>
* <b>Animations</b><br />
* <p>When an element is manipulated, by default there is no animation.</p>
* <pre><code>
var el = Ext.get("my-div");
// no animation
el.setWidth(100);
* </code></pre>
* <p>Many of the functions for manipulating an element have an optional "animate" parameter. This
* parameter can be specified as boolean (<tt>true</tt>) for default animation effects.</p>
* <pre><code>
// default animation
el.setWidth(100, true);
* </code></pre>
*
* <p>To configure the effects, an object literal with animation options to use as the Element animation
* configuration object can also be specified. Note that the supported Element animation configuration
* options are a subset of the {@link Ext.Fx} animation options specific to Fx effects. The supported
* Element animation configuration options are:</p>
<pre>
Option Default Description
--------- -------- ---------------------------------------------
{@link Ext.Fx#duration duration} .35 The duration of the animation in seconds
{@link Ext.Fx#easing easing} easeOut The easing method
{@link Ext.Fx#callback callback} none A function to execute when the anim completes
{@link Ext.Fx#scope scope} this The scope (this) of the callback function
</pre>
*
* <pre><code>
// Element animation options object
var opt = {
{@link Ext.Fx#duration duration}: 1,
{@link Ext.Fx#easing easing}: 'elasticIn',
{@link Ext.Fx#callback callback}: this.foo,
{@link Ext.Fx#scope scope}: this
};
// animation with some options set
el.setWidth(100, opt);
* </code></pre>
* <p>The Element animation object being used for the animation will be set on the options
* object as "anim", which allows you to stop or manipulate the animation. Here is an example:</p>
* <pre><code>
// using the "anim" property to get the Anim object
if(opt.anim.isAnimated()){
opt.anim.stop();
}
* </code></pre>
* <p>Also see the <tt>{@link #animate}</tt> method for another animation technique.</p>
* <p><b> Composite (Collections of) Elements</b></p>
* <p>For working with collections of Elements, see {@link Ext.CompositeElement}</p>
* @constructor Create a new Element directly.
* @param {String/HTMLElement} element
* @param {Boolean} forceNew (optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).
*/
(function(){
var DOC = document;
Ext.Element = function(element, forceNew){
var dom = typeof element == "string" ?
DOC.getElementById(element) : element,
id;
if(!dom) return null;
id = dom.id;
if(!forceNew && id && Ext.elCache[id]){ // element object already exists
return Ext.elCache[id].el;
}
/**
* The DOM element
* @type HTMLElement
*/
this.dom = dom;
/**
* The DOM element ID
* @type String
*/
this.id = id || Ext.id(dom);
};
var DH = Ext.DomHelper,
El = Ext.Element,
EC = Ext.elCache;
El.prototype = {
/**
* Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
* @param {Object} o The object with the attributes
* @param {Boolean} useSet (optional) false to override the default setAttribute to use expandos.
* @return {Ext.Element} this
*/
set : function(o, useSet){
var el = this.dom,
attr,
val,
useSet = (useSet !== false) && !!el.setAttribute;
for (attr in o) {
if (o.hasOwnProperty(attr)) {
val = o[attr];
if (attr == 'style') {
DH.applyStyles(el, val);
} else if (attr == 'cls') {
el.className = val;
} else if (useSet) {
el.setAttribute(attr, val);
} else {
el[attr] = val;
}
}
}
return this;
},
// Mouse events
/**
* @event click
* Fires when a mouse click is detected within the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event contextmenu
* Fires when a right click is detected within the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event dblclick
* Fires when a mouse double click is detected within the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event mousedown
* Fires when a mousedown is detected within the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event mouseup
* Fires when a mouseup is detected within the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event mouseover
* Fires when a mouseover is detected within the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event mousemove
* Fires when a mousemove is detected with the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event mouseout
* Fires when a mouseout is detected with the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event mouseenter
* Fires when the mouse enters the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event mouseleave
* Fires when the mouse leaves the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
// Keyboard events
/**
* @event keypress
* Fires when a keypress is detected within the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event keydown
* Fires when a keydown is detected within the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event keyup
* Fires when a keyup is detected within the element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
// HTML frame/object events
/**
* @event load
* Fires when the user agent finishes loading all content within the element. Only supported by window, frames, objects and images.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event unload
* Fires when the user agent removes all content from a window or frame. For elements, it fires when the target element or any of its content has been removed.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event abort
* Fires when an object/image is stopped from loading before completely loaded.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event error
* Fires when an object/image/frame cannot be loaded properly.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event resize
* Fires when a document view is resized.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event scroll
* Fires when a document view is scrolled.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
// Form events
/**
* @event select
* Fires when a user selects some text in a text field, including input and textarea.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event change
* Fires when a control loses the input focus and its value has been modified since gaining focus.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event submit
* Fires when a form is submitted.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event reset
* Fires when a form is reset.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event focus
* Fires when an element receives focus either via the pointing device or by tab navigation.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event blur
* Fires when an element loses focus either via the pointing device or by tabbing navigation.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
// User Interface events
/**
* @event DOMFocusIn
* Where supported. Similar to HTML focus event, but can be applied to any focusable element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event DOMFocusOut
* Where supported. Similar to HTML blur event, but can be applied to any focusable element.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event DOMActivate
* Where supported. Fires when an element is activated, for instance, through a mouse click or a keypress.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
// DOM Mutation events
/**
* @event DOMSubtreeModified
* Where supported. Fires when the subtree is modified.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event DOMNodeInserted
* Where supported. Fires when a node has been added as a child of another node.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event DOMNodeRemoved
* Where supported. Fires when a descendant node of the element is removed.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event DOMNodeRemovedFromDocument
* Where supported. Fires when a node is being removed from a document.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event DOMNodeInsertedIntoDocument
* Where supported. Fires when a node is being inserted into a document.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event DOMAttrModified
* Where supported. Fires when an attribute has been modified.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* @event DOMCharacterDataModified
* Where supported. Fires when the character data has been modified.
* @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
* @param {HtmlElement} t The target of the event.
* @param {Object} o The options configuration passed to the {@link #addListener} call.
*/
/**
* The default unit to append to CSS values where a unit isn't provided (defaults to px).
* @type String
*/
defaultUnit : "px",
/**
* Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child)
* @param {String} selector The simple selector to test
* @return {Boolean} True if this element matches the selector, else false
*/
is : function(simpleSelector){
return Ext.DomQuery.is(this.dom, simpleSelector);
},
/**
* Tries to focus the element. Any exceptions are caught and ignored.
* @param {Number} defer (optional) Milliseconds to defer the focus
* @return {Ext.Element} this
*/
focus : function(defer, /* private */ dom) {
var me = this,
dom = dom || me.dom;
try{
if(Number(defer)){
me.focus.defer(defer, null, [null, dom]);
}else{
dom.focus();
}
}catch(e){}
return me;
},
/**
* Tries to blur the element. Any exceptions are caught and ignored.
* @return {Ext.Element} this
*/
blur : function() {
try{
this.dom.blur();
}catch(e){}
return this;
},
/**
* Returns the value of the "value" attribute
* @param {Boolean} asNumber true to parse the value as a number
* @return {String/Number}
*/
getValue : function(asNumber){
var val = this.dom.value;
return asNumber ? parseInt(val, 10) : val;
},
/**
* Appends an event handler to this element. The shorthand version {@link #on} is equivalent.
* @param {String} eventName The name of event to handle.
* @param {Function} fn The handler function the event invokes. This function is passed
* the following parameters:<ul>
* <li><b>evt</b> : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>
* <li><b>el</b> : HtmlElement<div class="sub-desc">The DOM element which was the target of the event.
* Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>
* <li><b>o</b> : Object<div class="sub-desc">The options object from the addListener call.</div></li>
* </ul>
* @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
* <b>If omitted, defaults to this Element.</b>.
* @param {Object} options (optional) An object containing handler configuration properties.
* This may contain any of the following properties:<ul>
* <li><b>scope</b> Object : <div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
* <b>If omitted, defaults to this Element.</b></div></li>
* <li><b>delegate</b> String: <div class="sub-desc">A simple selector to filter the target or look for a descendant of the target. See below for additional details.</div></li>
* <li><b>stopEvent</b> Boolean: <div class="sub-desc">True to stop the event. That is stop propagation, and prevent the default action.</div></li>
* <li><b>preventDefault</b> Boolean: <div class="sub-desc">True to prevent the default action</div></li>
* <li><b>stopPropagation</b> Boolean: <div class="sub-desc">True to prevent event propagation</div></li>
* <li><b>normalized</b> Boolean: <div class="sub-desc">False to pass a browser event to the handler function instead of an Ext.EventObject</div></li>
* <li><b>target</b> Ext.Element: <div class="sub-desc">Only call the handler if the event was fired on the target Element, <i>not</i> if the event was bubbled up from a child node.</div></li>
* <li><b>delay</b> Number: <div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
* <li><b>single</b> Boolean: <div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
* <li><b>buffer</b> Number: <div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
* by the specified number of milliseconds. If the event fires again within that time, the original
* handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
* </ul><br>
* <p>
* <b>Combining Options</b><br>
* In the following examples, the shorthand form {@link #on} is used rather than the more verbose
* addListener. The two are equivalent. Using the options argument, it is possible to combine different
* types of listeners:<br>
* <br>
* A delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the
* options object. The options object is available as the third parameter in the handler function.<div style="margin: 5px 20px 20px;">
* Code:<pre><code>
el.on('click', this.onClick, this, {
single: true,
delay: 100,
stopEvent : true,
forumId: 4
});</code></pre></p>
* <p>
* <b>Attaching multiple handlers in 1 call</b><br>
* The method also allows for a single argument to be passed which is a config object containing properties
* which specify multiple handlers.</p>
* <p>
* Code:<pre><code>
el.on({
'click' : {
fn: this.onClick,
scope: this,
delay: 100
},
'mouseover' : {
fn: this.onMouseOver,
scope: this
},
'mouseout' : {
fn: this.onMouseOut,
scope: this
}
});</code></pre>
* <p>
* Or a shorthand syntax:<br>
* Code:<pre><code></p>
el.on({
'click' : this.onClick,
'mouseover' : this.onMouseOver,
'mouseout' : this.onMouseOut,
scope: this
});
* </code></pre></p>
* <p><b>delegate</b></p>
* <p>This is a configuration option that you can pass along when registering a handler for
* an event to assist with event delegation. Event delegation is a technique that is used to
* reduce memory consumption and prevent exposure to memory-leaks. By registering an event
* for a container element as opposed to each element within a container. By setting this
* configuration option to a simple selector, the target element will be filtered to look for
* a descendant of the target.
* For example:<pre><code>
// using this markup:
&lt;div id='elId'>
&lt;p id='p1'>paragraph one&lt;/p>
&lt;p id='p2' class='clickable'>paragraph two&lt;/p>
&lt;p id='p3'>paragraph three&lt;/p>
&lt;/div>
// utilize event delegation to registering just one handler on the container element:
el = Ext.get('elId');
el.on(
'click',
function(e,t) {
// handle click
console.info(t.id); // 'p2'
},
this,
{
// filter the target element to be a descendant with the class 'clickable'
delegate: '.clickable'
}
);
* </code></pre></p>
* @return {Ext.Element} this
*/
addListener : function(eventName, fn, scope, options){
Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);
return this;
},
/**
* Removes an event handler from this element. The shorthand version {@link #un} is equivalent.
* <b>Note</b>: if a <i>scope</i> was explicitly specified when {@link #addListener adding} the
* listener, the same scope must be specified here.
* Example:
* <pre><code>
el.removeListener('click', this.handlerFn);
// or
el.un('click', this.handlerFn);
</code></pre>
* @param {String} eventName The name of the event from which to remove the handler.
* @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
* @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,
* then this must refer to the same object.
* @return {Ext.Element} this
*/
removeListener : function(eventName, fn, scope){
Ext.EventManager.removeListener(this.dom, eventName, fn, scope || this);
return this;
},
/**
* Removes all previous added listeners from this element
* @return {Ext.Element} this
*/
removeAllListeners : function(){
Ext.EventManager.removeAll(this.dom);
return this;
},
/**
* Recursively removes all previous added listeners from this element and its children
* @return {Ext.Element} this
*/
purgeAllListeners : function() {
Ext.EventManager.purgeElement(this, true);
return this;
},
/**
* @private Test if size has a unit, otherwise appends the default
*/
addUnits : function(size){
if(size === "" || size == "auto" || size === undefined){
size = size || '';
} else if(!isNaN(size) || !unitPattern.test(size)){
size = size + (this.defaultUnit || 'px');
}
return size;
},
/**
* <p>Updates the <a href="http://developer.mozilla.org/en/DOM/element.innerHTML">innerHTML</a> of this Element
* from a specified URL. Note that this is subject to the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">Same Origin Policy</a></p>
* <p>Updating innerHTML of an element will <b>not</b> execute embedded <tt>&lt;script></tt> elements. This is a browser restriction.</p>
* @param {Mixed} options. Either a sring containing the URL from which to load the HTML, or an {@link Ext.Ajax#request} options object specifying
* exactly how to request the HTML.
* @return {Ext.Element} this
*/
load : function(url, params, cb){
Ext.Ajax.request(Ext.apply({
params: params,
url: url.url || url,
callback: cb,
el: this.dom,
indicatorText: url.indicatorText || ''
}, Ext.isObject(url) ? url : {}));
return this;
},
/**
* Tests various css rules/browsers to determine if this element uses a border box
* @return {Boolean}
*/
isBorderBox : function(){
return Ext.isBorderBox || Ext.isForcedBorderBox || noBoxAdjust[(this.dom.tagName || "").toLowerCase()];
},
/**
* <p>Removes this element's dom reference. Note that event and cache removal is handled at {@link Ext#removeNode}</p>
*/
remove : function(){
var me = this,
dom = me.dom;
if (dom) {
delete me.dom;
Ext.removeNode(dom);
}
},
/**
* Sets up event handlers to call the passed functions when the mouse is moved into and out of the Element.
* @param {Function} overFn The function to call when the mouse enters the Element.
* @param {Function} outFn The function to call when the mouse leaves the Element.
* @param {Object} scope (optional) The scope (<code>this</code> reference) in which the functions are executed. Defaults to the Element's DOM element.
* @param {Object} options (optional) Options for the listener. See {@link Ext.util.Observable#addListener the <tt>options</tt> parameter}.
* @return {Ext.Element} this
*/
hover : function(overFn, outFn, scope, options){
var me = this;
me.on('mouseenter', overFn, scope || me.dom, options);
me.on('mouseleave', outFn, scope || me.dom, options);
return me;
},
/**
* Returns true if this element is an ancestor of the passed element
* @param {HTMLElement/String} el The element to check
* @return {Boolean} True if this element is an ancestor of el, else false
*/
contains : function(el){
return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el);
},
/**
* Returns the value of a namespaced attribute from the element's underlying DOM node.
* @param {String} namespace The namespace in which to look for the attribute
* @param {String} name The attribute name
* @return {String} The attribute value
* @deprecated
*/
getAttributeNS : function(ns, name){
return this.getAttribute(name, ns);
},
/**
* Returns the value of an attribute from the element's underlying DOM node.
* @param {String} name The attribute name
* @param {String} namespace (optional) The namespace in which to look for the attribute
* @return {String} The attribute value
*/
getAttribute : Ext.isIE ? function(name, ns){
var d = this.dom,
type = typeof d[ns + ":" + name];
if(['undefined', 'unknown'].indexOf(type) == -1){
return d[ns + ":" + name];
}
return d[name];
} : function(name, ns){
var d = this.dom;
return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name];
},
/**
* Update the innerHTML of this element
* @param {String} html The new HTML
* @return {Ext.Element} this
*/
update : function(html) {
if (this.dom) {
this.dom.innerHTML = html;
}
return this;
}
};
var ep = El.prototype;
El.addMethods = function(o){
Ext.apply(ep, o);
};
/**
* Appends an event handler (shorthand for {@link #addListener}).
* @param {String} eventName The name of event to handle.
* @param {Function} fn The handler function the event invokes.
* @param {Object} scope (optional) The scope (<code>this</code> reference) in which the handler function is executed.
* @param {Object} options (optional) An object containing standard {@link #addListener} options
* @member Ext.Element
* @method on
*/
ep.on = ep.addListener;
/**
* Removes an event handler from this element (see {@link #removeListener} for additional notes).
* @param {String} eventName The name of the event from which to remove the handler.
* @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
* @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,
* then this must refer to the same object.
* @return {Ext.Element} this
* @member Ext.Element
* @method un
*/
ep.un = ep.removeListener;
/**
* true to automatically adjust width and height settings for box-model issues (default to true)
*/
ep.autoBoxAdjust = true;
// private
var unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
docEl;
/**
* @private
*/
/**
* Retrieves Ext.Element objects.
* <p><b>This method does not retrieve {@link Ext.Component Component}s.</b> This method
* retrieves Ext.Element objects which encapsulate DOM elements. To retrieve a Component by
* its ID, use {@link Ext.ComponentMgr#get}.</p>
* <p>Uses simple caching to consistently return the same object. Automatically fixes if an
* object was recreated with the same id via AJAX or DOM.</p>
* @param {Mixed} el The id of the node, a DOM Node or an existing Element.
* @return {Element} The Element object (or null if no matching element was found)
* @static
* @member Ext.Element
* @method get
*/
El.get = function(el){
var ex,
elm,
id;
if(!el){ return null; }
if (typeof el == "string") { // element id
if (!(elm = DOC.getElementById(el))) {
return null;
}
if (EC[el] && EC[el].el) {
ex = EC[el].el;
ex.dom = elm;
} else {
ex = El.addToCache(new El(elm));
}
return ex;
} else if (el.tagName) { // dom element
if(!(id = el.id)){
id = Ext.id(el);
}
if (EC[id] && EC[id].el) {
ex = EC[id].el;
ex.dom = el;
} else {
ex = El.addToCache(new El(el));
}
return ex;
} else if (el instanceof El) {
if(el != docEl){
// refresh dom element in case no longer valid,
// catch case where it hasn't been appended
// If an el instance is passed, don't pass to getElementById without some kind of id
if (Ext.isIE && (el.id == undefined || el.id == '')) {
el.dom = el.dom;
} else {
el.dom = DOC.getElementById(el.id) || el.dom;
}
}
return el;
} else if(el.isComposite) {
return el;
} else if(Ext.isArray(el)) {
return El.select(el);
} else if(el == DOC) {
// create a bogus element object representing the document object
if(!docEl){
var f = function(){};
f.prototype = El.prototype;
docEl = new f();
docEl.dom = DOC;
}
return docEl;
}
return null;
};
El.addToCache = function(el, id){
id = id || el.id;
EC[id] = {
el: el,
data: {},
events: {}
};
return el;
};
// private method for getting and setting element data
El.data = function(el, key, value){
el = El.get(el);
if (!el) {
return null;
}
var c = EC[el.id].data;
if(arguments.length == 2){
return c[key];
}else{
return (c[key] = value);
}
};
// private
// Garbage collection - uncache elements/purge listeners on orphaned elements
// so we don't hold a reference and cause the browser to retain them
function garbageCollect(){
if(!Ext.enableGarbageCollector){
clearInterval(El.collectorThreadId);
} else {
var eid,
el,
d,
o;
for(eid in EC){
o = EC[eid];
if(o.skipGC){
continue;
}
el = o.el;
d = el.dom;
// -------------------------------------------------------
// Determining what is garbage:
// -------------------------------------------------------
// !d
// dom node is null, definitely garbage
// -------------------------------------------------------
// !d.parentNode
// no parentNode == direct orphan, definitely garbage
// -------------------------------------------------------
// !d.offsetParent && !document.getElementById(eid)
// display none elements have no offsetParent so we will
// also try to look it up by it's id. However, check
// offsetParent first so we don't do unneeded lookups.
// This enables collection of elements that are not orphans
// directly, but somewhere up the line they have an orphan
// parent.
// -------------------------------------------------------
if(!d || !d.parentNode || (!d.offsetParent && !DOC.getElementById(eid))){
if(Ext.enableListenerCollection){
Ext.EventManager.removeAll(d);
}
delete EC[eid];
}
}
// Cleanup IE Object leaks
if (Ext.isIE) {
var t = {};
for (eid in EC) {
t[eid] = EC[eid];
}
EC = Ext.elCache = t;
}
}
}
El.collectorThreadId = setInterval(garbageCollect, 30000);
var flyFn = function(){};
flyFn.prototype = El.prototype;
// dom is optional
El.Flyweight = function(dom){
this.dom = dom;
};
El.Flyweight.prototype = new flyFn();
El.Flyweight.prototype.isFlyweight = true;
El._flyweights = {};
/**
* <p>Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
* the dom node can be overwritten by other code. Shorthand of {@link Ext.Element#fly}</p>
* <p>Use this to make one-time references to DOM elements which are not going to be accessed again either by
* application code, or by Ext's classes. If accessing an element which will be processed regularly, then {@link Ext#get}
* will be more appropriate to take advantage of the caching provided by the Ext.Element class.</p>
* @param {String/HTMLElement} el The dom node or id
* @param {String} named (optional) Allows for creation of named reusable flyweights to prevent conflicts
* (e.g. internally Ext uses "_global")
* @return {Element} The shared Element object (or null if no matching element was found)
* @member Ext.Element
* @method fly
*/
El.fly = function(el, named){
var ret = null;
named = named || '_global';
if (el = Ext.getDom(el)) {
(El._flyweights[named] = El._flyweights[named] || new El.Flyweight()).dom = el;
ret = El._flyweights[named];
}
return ret;
};
/**
* Retrieves Ext.Element objects.
* <p><b>This method does not retrieve {@link Ext.Component Component}s.</b> This method
* retrieves Ext.Element objects which encapsulate DOM elements. To retrieve a Component by
* its ID, use {@link Ext.ComponentMgr#get}.</p>
* <p>Uses simple caching to consistently return the same object. Automatically fixes if an
* object was recreated with the same id via AJAX or DOM.</p>
* Shorthand of {@link Ext.Element#get}
* @param {Mixed} el The id of the node, a DOM Node or an existing Element.
* @return {Element} The Element object (or null if no matching element was found)
* @member Ext
* @method get
*/
Ext.get = El.get;
/**
* <p>Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
* the dom node can be overwritten by other code. Shorthand of {@link Ext.Element#fly}</p>
* <p>Use this to make one-time references to DOM elements which are not going to be accessed again either by
* application code, or by Ext's classes. If accessing an element which will be processed regularly, then {@link Ext#get}
* will be more appropriate to take advantage of the caching provided by the Ext.Element class.</p>
* @param {String/HTMLElement} el The dom node or id
* @param {String} named (optional) Allows for creation of named reusable flyweights to prevent conflicts
* (e.g. internally Ext uses "_global")
* @return {Element} The shared Element object (or null if no matching element was found)
* @member Ext
* @method fly
*/
Ext.fly = El.fly;
// speedy lookup for elements never to box adjust
var noBoxAdjust = Ext.isStrict ? {
select:1
} : {
input:1, select:1, textarea:1
};
if(Ext.isIE || Ext.isGecko){
noBoxAdjust['button'] = 1;
}
})();

View File

@@ -1,301 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
(function(){
var D = Ext.lib.Dom,
LEFT = "left",
RIGHT = "right",
TOP = "top",
BOTTOM = "bottom",
POSITION = "position",
STATIC = "static",
RELATIVE = "relative",
AUTO = "auto",
ZINDEX = "z-index";
Ext.Element.addMethods({
/**
* Gets the current X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @return {Number} The X position of the element
*/
getX : function(){
return D.getX(this.dom);
},
/**
* Gets the current Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @return {Number} The Y position of the element
*/
getY : function(){
return D.getY(this.dom);
},
/**
* Gets the current position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @return {Array} The XY position of the element
*/
getXY : function(){
return D.getXY(this.dom);
},
/**
* Returns the offsets of this element from the passed element. Both element must be part of the DOM tree and not have display:none to have page coordinates.
* @param {Mixed} element The element to get the offsets from.
* @return {Array} The XY page offsets (e.g. [100, -200])
*/
getOffsetsTo : function(el){
var o = this.getXY(),
e = Ext.fly(el, '_internal').getXY();
return [o[0]-e[0],o[1]-e[1]];
},
/**
* Sets the X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @param {Number} The X position of the element
* @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
* @return {Ext.Element} this
*/
setX : function(x, animate){
return this.setXY([x, this.getY()], this.animTest(arguments, animate, 1));
},
/**
* Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @param {Number} The Y position of the element
* @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
* @return {Ext.Element} this
*/
setY : function(y, animate){
return this.setXY([this.getX(), y], this.animTest(arguments, animate, 1));
},
/**
* Sets the element's left position directly using CSS style (instead of {@link #setX}).
* @param {String} left The left CSS property value
* @return {Ext.Element} this
*/
setLeft : function(left){
this.setStyle(LEFT, this.addUnits(left));
return this;
},
/**
* Sets the element's top position directly using CSS style (instead of {@link #setY}).
* @param {String} top The top CSS property value
* @return {Ext.Element} this
*/
setTop : function(top){
this.setStyle(TOP, this.addUnits(top));
return this;
},
/**
* Sets the element's CSS right style.
* @param {String} right The right CSS property value
* @return {Ext.Element} this
*/
setRight : function(right){
this.setStyle(RIGHT, this.addUnits(right));
return this;
},
/**
* Sets the element's CSS bottom style.
* @param {String} bottom The bottom CSS property value
* @return {Ext.Element} this
*/
setBottom : function(bottom){
this.setStyle(BOTTOM, this.addUnits(bottom));
return this;
},
/**
* Sets the position of the element in page coordinates, regardless of how the element is positioned.
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @param {Array} pos Contains X & Y [x, y] values for new position (coordinates are page-based)
* @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
* @return {Ext.Element} this
*/
setXY : function(pos, animate){
var me = this;
if(!animate || !me.anim){
D.setXY(me.dom, pos);
}else{
me.anim({points: {to: pos}}, me.preanim(arguments, 1), 'motion');
}
return me;
},
/**
* Sets the position of the element in page coordinates, regardless of how the element is positioned.
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @param {Number} x X value for new position (coordinates are page-based)
* @param {Number} y Y value for new position (coordinates are page-based)
* @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
* @return {Ext.Element} this
*/
setLocation : function(x, y, animate){
return this.setXY([x, y], this.animTest(arguments, animate, 2));
},
/**
* Sets the position of the element in page coordinates, regardless of how the element is positioned.
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @param {Number} x X value for new position (coordinates are page-based)
* @param {Number} y Y value for new position (coordinates are page-based)
* @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
* @return {Ext.Element} this
*/
moveTo : function(x, y, animate){
return this.setXY([x, y], this.animTest(arguments, animate, 2));
},
/**
* Gets the left X coordinate
* @param {Boolean} local True to get the local css position instead of page coordinate
* @return {Number}
*/
getLeft : function(local){
return !local ? this.getX() : parseInt(this.getStyle(LEFT), 10) || 0;
},
/**
* Gets the right X coordinate of the element (element X position + element width)
* @param {Boolean} local True to get the local css position instead of page coordinate
* @return {Number}
*/
getRight : function(local){
var me = this;
return !local ? me.getX() + me.getWidth() : (me.getLeft(true) + me.getWidth()) || 0;
},
/**
* Gets the top Y coordinate
* @param {Boolean} local True to get the local css position instead of page coordinate
* @return {Number}
*/
getTop : function(local) {
return !local ? this.getY() : parseInt(this.getStyle(TOP), 10) || 0;
},
/**
* Gets the bottom Y coordinate of the element (element Y position + element height)
* @param {Boolean} local True to get the local css position instead of page coordinate
* @return {Number}
*/
getBottom : function(local){
var me = this;
return !local ? me.getY() + me.getHeight() : (me.getTop(true) + me.getHeight()) || 0;
},
/**
* Initializes positioning on this element. If a desired position is not passed, it will make the
* the element positioned relative IF it is not already positioned.
* @param {String} pos (optional) Positioning to use "relative", "absolute" or "fixed"
* @param {Number} zIndex (optional) The zIndex to apply
* @param {Number} x (optional) Set the page X position
* @param {Number} y (optional) Set the page Y position
*/
position : function(pos, zIndex, x, y){
var me = this;
if(!pos && me.isStyle(POSITION, STATIC)){
me.setStyle(POSITION, RELATIVE);
} else if(pos) {
me.setStyle(POSITION, pos);
}
if(zIndex){
me.setStyle(ZINDEX, zIndex);
}
if(x || y) me.setXY([x || false, y || false]);
},
/**
* Clear positioning back to the default when the document was loaded
* @param {String} value (optional) The value to use for the left,right,top,bottom, defaults to '' (empty string). You could use 'auto'.
* @return {Ext.Element} this
*/
clearPositioning : function(value){
value = value || '';
this.setStyle({
left : value,
right : value,
top : value,
bottom : value,
"z-index" : "",
position : STATIC
});
return this;
},
/**
* Gets an object with all CSS positioning properties. Useful along with setPostioning to get
* snapshot before performing an update and then restoring the element.
* @return {Object}
*/
getPositioning : function(){
var l = this.getStyle(LEFT);
var t = this.getStyle(TOP);
return {
"position" : this.getStyle(POSITION),
"left" : l,
"right" : l ? "" : this.getStyle(RIGHT),
"top" : t,
"bottom" : t ? "" : this.getStyle(BOTTOM),
"z-index" : this.getStyle(ZINDEX)
};
},
/**
* Set positioning with an object returned by getPositioning().
* @param {Object} posCfg
* @return {Ext.Element} this
*/
setPositioning : function(pc){
var me = this,
style = me.dom.style;
me.setStyle(pc);
if(pc.right == AUTO){
style.right = "";
}
if(pc.bottom == AUTO){
style.bottom = "";
}
return me;
},
/**
* Translates the passed page coordinates into left/top css values for this element
* @param {Number/Array} x The page x or an array containing [x, y]
* @param {Number} y (optional) The page y, required if x is not an array
* @return {Object} An object with left and top properties. e.g. {left: (value), top: (value)}
*/
translatePoints : function(x, y){
y = isNaN(x[1]) ? y : x[1];
x = isNaN(x[0]) ? x : x[0];
var me = this,
relative = me.isStyle(POSITION, RELATIVE),
o = me.getXY(),
l = parseInt(me.getStyle(LEFT), 10),
t = parseInt(me.getStyle(TOP), 10);
l = !isNaN(l) ? l : (relative ? 0 : me.dom.offsetLeft);
t = !isNaN(t) ? t : (relative ? 0 : me.dom.offsetTop);
return {left: (x - o[0] + l), top: (y - o[1] + t)};
},
animTest : function(args, animate, i) {
return !!animate && this.preanim ? this.preanim(args, i) : false;
}
});
})();

View File

@@ -1,58 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods({
/**
* Returns true if this element is scrollable.
* @return {Boolean}
*/
isScrollable : function(){
var dom = this.dom;
return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
},
/**
* Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
* @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.
* @param {Number} value The new scroll value.
* @return {Element} this
*/
scrollTo : function(side, value){
this.dom["scroll" + (/top/i.test(side) ? "Top" : "Left")] = value;
return this;
},
/**
* Returns the current scroll position of the element.
* @return {Object} An object containing the scroll position in the format {left: (scrollLeft), top: (scrollTop)}
*/
getScroll : function(){
var d = this.dom,
doc = document,
body = doc.body,
docElement = doc.documentElement,
l,
t,
ret;
if(d == doc || d == body){
if(Ext.isIE && Ext.isStrict){
l = docElement.scrollLeft;
t = docElement.scrollTop;
}else{
l = window.pageXOffset;
t = window.pageYOffset;
}
ret = {left: l || (body ? body.scrollLeft : 0), top: t || (body ? body.scrollTop : 0)};
}else{
ret = {left: d.scrollLeft, top: d.scrollTop};
}
return ret;
}
});

View File

@@ -1,503 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods(function(){
// local style camelizing for speed
var supports = Ext.supports,
propCache = {},
camelRe = /(-[a-z])/gi,
view = document.defaultView,
opacityRe = /alpha\(opacity=(.*)\)/i,
trimRe = /^\s+|\s+$/g,
EL = Ext.Element,
spacesRe = /\s+/,
wordsRe = /\w/g,
PADDING = "padding",
MARGIN = "margin",
BORDER = "border",
LEFT = "-left",
RIGHT = "-right",
TOP = "-top",
BOTTOM = "-bottom",
WIDTH = "-width",
MATH = Math,
HIDDEN = 'hidden',
ISCLIPPED = 'isClipped',
OVERFLOW = 'overflow',
OVERFLOWX = 'overflow-x',
OVERFLOWY = 'overflow-y',
ORIGINALCLIP = 'originalClip',
// special markup used throughout Ext when box wrapping elements
borders = {l: BORDER + LEFT + WIDTH, r: BORDER + RIGHT + WIDTH, t: BORDER + TOP + WIDTH, b: BORDER + BOTTOM + WIDTH},
paddings = {l: PADDING + LEFT, r: PADDING + RIGHT, t: PADDING + TOP, b: PADDING + BOTTOM},
margins = {l: MARGIN + LEFT, r: MARGIN + RIGHT, t: MARGIN + TOP, b: MARGIN + BOTTOM},
data = Ext.Element.data;
// private
function camelFn(m, a) {
return a.charAt(1).toUpperCase();
}
function chkCache(prop) {
return propCache[prop] || (propCache[prop] = prop == 'float' ? (supports.cssFloat ? 'cssFloat' : 'styleFloat') : prop.replace(camelRe, camelFn));
}
return {
// private ==> used by Fx
adjustWidth : function(width) {
var me = this;
var isNum = (typeof width == "number");
if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
width -= (me.getBorderWidth("lr") + me.getPadding("lr"));
}
return (isNum && width < 0) ? 0 : width;
},
// private ==> used by Fx
adjustHeight : function(height) {
var me = this;
var isNum = (typeof height == "number");
if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
height -= (me.getBorderWidth("tb") + me.getPadding("tb"));
}
return (isNum && height < 0) ? 0 : height;
},
/**
* Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.
* @param {String/Array} className The CSS class to add, or an array of classes
* @return {Ext.Element} this
*/
addClass : function(className){
var me = this,
i,
len,
v,
cls = [];
// Separate case is for speed
if (!Ext.isArray(className)) {
if (typeof className == 'string' && !this.hasClass(className)) {
me.dom.className += " " + className;
}
}
else {
for (i = 0, len = className.length; i < len; i++) {
v = className[i];
if (typeof v == 'string' && (' ' + me.dom.className + ' ').indexOf(' ' + v + ' ') == -1) {
cls.push(v);
}
}
if (cls.length) {
me.dom.className += " " + cls.join(" ");
}
}
return me;
},
/**
* Removes one or more CSS classes from the element.
* @param {String/Array} className The CSS class to remove, or an array of classes
* @return {Ext.Element} this
*/
removeClass : function(className){
var me = this,
i,
idx,
len,
cls,
elClasses;
if (!Ext.isArray(className)){
className = [className];
}
if (me.dom && me.dom.className) {
elClasses = me.dom.className.replace(trimRe, '').split(spacesRe);
for (i = 0, len = className.length; i < len; i++) {
cls = className[i];
if (typeof cls == 'string') {
cls = cls.replace(trimRe, '');
idx = elClasses.indexOf(cls);
if (idx != -1) {
elClasses.splice(idx, 1);
}
}
}
me.dom.className = elClasses.join(" ");
}
return me;
},
/**
* Adds one or more CSS classes to this element and removes the same class(es) from all siblings.
* @param {String/Array} className The CSS class to add, or an array of classes
* @return {Ext.Element} this
*/
radioClass : function(className){
var cn = this.dom.parentNode.childNodes,
v,
i,
len;
className = Ext.isArray(className) ? className : [className];
for (i = 0, len = cn.length; i < len; i++) {
v = cn[i];
if (v && v.nodeType == 1) {
Ext.fly(v, '_internal').removeClass(className);
}
};
return this.addClass(className);
},
/**
* Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it).
* @param {String} className The CSS class to toggle
* @return {Ext.Element} this
*/
toggleClass : function(className){
return this.hasClass(className) ? this.removeClass(className) : this.addClass(className);
},
/**
* Checks if the specified CSS class exists on this element's DOM node.
* @param {String} className The CSS class to check for
* @return {Boolean} True if the class exists, else false
*/
hasClass : function(className){
return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
},
/**
* Replaces a CSS class on the element with another. If the old name does not exist, the new name will simply be added.
* @param {String} oldClassName The CSS class to replace
* @param {String} newClassName The replacement CSS class
* @return {Ext.Element} this
*/
replaceClass : function(oldClassName, newClassName){
return this.removeClass(oldClassName).addClass(newClassName);
},
isStyle : function(style, val) {
return this.getStyle(style) == val;
},
/**
* Normalizes currentStyle and computedStyle.
* @param {String} property The style property whose value is returned.
* @return {String} The current value of the style property for this element.
*/
getStyle : function(){
return view && view.getComputedStyle ?
function(prop){
var el = this.dom,
v,
cs,
out,
display;
if(el == document){
return null;
}
prop = chkCache(prop);
out = (v = el.style[prop]) ? v :
(cs = view.getComputedStyle(el, "")) ? cs[prop] : null;
// Ignore cases when the margin is correctly reported as 0, the bug only shows
// numbers larger.
if(prop == 'marginRight' && out != '0px' && !supports.correctRightMargin){
display = el.style.display;
el.style.display = 'inline-block';
out = view.getComputedStyle(el, '').marginRight;
el.style.display = display;
}
if(prop == 'backgroundColor' && out == 'rgba(0, 0, 0, 0)' && !supports.correctTransparentColor){
out = 'transparent';
}
return out;
} :
function(prop){
var el = this.dom,
m,
cs;
if(el == document) return null;
if (prop == 'opacity') {
if (el.style.filter.match) {
if(m = el.style.filter.match(opacityRe)){
var fv = parseFloat(m[1]);
if(!isNaN(fv)){
return fv ? fv / 100 : 0;
}
}
}
return 1;
}
prop = chkCache(prop);
return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);
};
}(),
/**
* Return the CSS color for the specified CSS attribute. rgb, 3 digit (like #fff) and valid values
* are convert to standard 6 digit hex color.
* @param {String} attr The css attribute
* @param {String} defaultValue The default value to use when a valid color isn't found
* @param {String} prefix (optional) defaults to #. Use an empty string when working with
* color anims.
*/
getColor : function(attr, defaultValue, prefix){
var v = this.getStyle(attr),
color = (typeof prefix != 'undefined') ? prefix : '#',
h;
if(!v || (/transparent|inherit/.test(v))) {
return defaultValue;
}
if(/^r/.test(v)){
Ext.each(v.slice(4, v.length -1).split(','), function(s){
h = parseInt(s, 10);
color += (h < 16 ? '0' : '') + h.toString(16);
});
}else{
v = v.replace('#', '');
color += v.length == 3 ? v.replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3') : v;
}
return(color.length > 5 ? color.toLowerCase() : defaultValue);
},
/**
* Wrapper for setting style properties, also takes single object parameter of multiple styles.
* @param {String/Object} property The style property to be set, or an object of multiple styles.
* @param {String} value (optional) The value to apply to the given property, or null if an object was passed.
* @return {Ext.Element} this
*/
setStyle : function(prop, value){
var tmp, style;
if (typeof prop != 'object') {
tmp = {};
tmp[prop] = value;
prop = tmp;
}
for (style in prop) {
value = prop[style];
style == 'opacity' ?
this.setOpacity(value) :
this.dom.style[chkCache(style)] = value;
}
return this;
},
/**
* Set the opacity of the element
* @param {Float} opacity The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
* @param {Boolean/Object} animate (optional) a standard Element animation config object or <tt>true</tt> for
* the default animation (<tt>{duration: .35, easing: 'easeIn'}</tt>)
* @return {Ext.Element} this
*/
setOpacity : function(opacity, animate){
var me = this,
s = me.dom.style;
if(!animate || !me.anim){
if(Ext.isIE){
var opac = opacity < 1 ? 'alpha(opacity=' + opacity * 100 + ')' : '',
val = s.filter.replace(opacityRe, '').replace(trimRe, '');
s.zoom = 1;
s.filter = val + (val.length > 0 ? ' ' : '') + opac;
}else{
s.opacity = opacity;
}
}else{
me.anim({opacity: {to: opacity}}, me.preanim(arguments, 1), null, .35, 'easeIn');
}
return me;
},
/**
* Clears any opacity settings from this element. Required in some cases for IE.
* @return {Ext.Element} this
*/
clearOpacity : function(){
var style = this.dom.style;
if(Ext.isIE){
if(!Ext.isEmpty(style.filter)){
style.filter = style.filter.replace(opacityRe, '').replace(trimRe, '');
}
}else{
style.opacity = style['-moz-opacity'] = style['-khtml-opacity'] = '';
}
return this;
},
/**
* Returns the offset height of the element
* @param {Boolean} contentHeight (optional) true to get the height minus borders and padding
* @return {Number} The element's height
*/
getHeight : function(contentHeight){
var me = this,
dom = me.dom,
hidden = Ext.isIE && me.isStyle('display', 'none'),
h = MATH.max(dom.offsetHeight, hidden ? 0 : dom.clientHeight) || 0;
h = !contentHeight ? h : h - me.getBorderWidth("tb") - me.getPadding("tb");
return h < 0 ? 0 : h;
},
/**
* Returns the offset width of the element
* @param {Boolean} contentWidth (optional) true to get the width minus borders and padding
* @return {Number} The element's width
*/
getWidth : function(contentWidth){
var me = this,
dom = me.dom,
hidden = Ext.isIE && me.isStyle('display', 'none'),
w = MATH.max(dom.offsetWidth, hidden ? 0 : dom.clientWidth) || 0;
w = !contentWidth ? w : w - me.getBorderWidth("lr") - me.getPadding("lr");
return w < 0 ? 0 : w;
},
/**
* Set the width of this Element.
* @param {Mixed} width The new width. This may be one of:<div class="mdetail-params"><ul>
* <li>A Number specifying the new width in this Element's {@link #defaultUnit}s (by default, pixels).</li>
* <li>A String used to set the CSS width style. Animation may <b>not</b> be used.
* </ul></div>
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
setWidth : function(width, animate){
var me = this;
width = me.adjustWidth(width);
!animate || !me.anim ?
me.dom.style.width = me.addUnits(width) :
me.anim({width : {to : width}}, me.preanim(arguments, 1));
return me;
},
/**
* Set the height of this Element.
* <pre><code>
// change the height to 200px and animate with default configuration
Ext.fly('elementId').setHeight(200, true);
// change the height to 150px and animate with a custom configuration
Ext.fly('elId').setHeight(150, {
duration : .5, // animation will have a duration of .5 seconds
// will change the content to "finished"
callback: function(){ this.{@link #update}("finished"); }
});
* </code></pre>
* @param {Mixed} height The new height. This may be one of:<div class="mdetail-params"><ul>
* <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels.)</li>
* <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>
* </ul></div>
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
setHeight : function(height, animate){
var me = this;
height = me.adjustHeight(height);
!animate || !me.anim ?
me.dom.style.height = me.addUnits(height) :
me.anim({height : {to : height}}, me.preanim(arguments, 1));
return me;
},
/**
* Gets the width of the border(s) for the specified side(s)
* @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example,
* passing <tt>'lr'</tt> would get the border <b><u>l</u></b>eft width + the border <b><u>r</u></b>ight width.
* @return {Number} The width of the sides passed added together
*/
getBorderWidth : function(side){
return this.addStyles(side, borders);
},
/**
* Gets the width of the padding(s) for the specified side(s)
* @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example,
* passing <tt>'lr'</tt> would get the padding <b><u>l</u></b>eft + the padding <b><u>r</u></b>ight.
* @return {Number} The padding of the sides passed added together
*/
getPadding : function(side){
return this.addStyles(side, paddings);
},
/**
* Store the current overflow setting and clip overflow on the element - use <tt>{@link #unclip}</tt> to remove
* @return {Ext.Element} this
*/
clip : function(){
var me = this,
dom = me.dom;
if(!data(dom, ISCLIPPED)){
data(dom, ISCLIPPED, true);
data(dom, ORIGINALCLIP, {
o: me.getStyle(OVERFLOW),
x: me.getStyle(OVERFLOWX),
y: me.getStyle(OVERFLOWY)
});
me.setStyle(OVERFLOW, HIDDEN);
me.setStyle(OVERFLOWX, HIDDEN);
me.setStyle(OVERFLOWY, HIDDEN);
}
return me;
},
/**
* Return clipping (overflow) to original clipping before <tt>{@link #clip}</tt> was called
* @return {Ext.Element} this
*/
unclip : function(){
var me = this,
dom = me.dom;
if(data(dom, ISCLIPPED)){
data(dom, ISCLIPPED, false);
var o = data(dom, ORIGINALCLIP);
if(o.o){
me.setStyle(OVERFLOW, o.o);
}
if(o.x){
me.setStyle(OVERFLOWX, o.x);
}
if(o.y){
me.setStyle(OVERFLOWY, o.y);
}
}
return me;
},
// private
addStyles : function(sides, styles){
var ttlSize = 0,
sidesArr = sides.match(wordsRe),
side,
size,
i,
len = sidesArr.length;
for (i = 0; i < len; i++) {
side = sidesArr[i];
size = side && parseInt(this.getStyle(styles[side]), 10);
if (size) {
ttlSize += MATH.abs(size);
}
}
return ttlSize;
},
margins : margins
};
}()
);

View File

@@ -1,175 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Element
*/
Ext.Element.addMethods(function(){
var PARENTNODE = 'parentNode',
NEXTSIBLING = 'nextSibling',
PREVIOUSSIBLING = 'previousSibling',
DQ = Ext.DomQuery,
GET = Ext.get;
return {
/**
* Looks at this node and then at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
* @param {String} selector The simple selector to test
* @param {Number/Mixed} maxDepth (optional) The max depth to search as a number or element (defaults to 50 || document.body)
* @param {Boolean} returnEl (optional) True to return a Ext.Element object instead of DOM node
* @return {HTMLElement} The matching DOM node (or null if no match was found)
*/
findParent : function(simpleSelector, maxDepth, returnEl){
var p = this.dom,
b = document.body,
depth = 0,
stopEl;
if(Ext.isGecko && Object.prototype.toString.call(p) == '[object XULElement]') {
return null;
}
maxDepth = maxDepth || 50;
if (isNaN(maxDepth)) {
stopEl = Ext.getDom(maxDepth);
maxDepth = Number.MAX_VALUE;
}
while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
if(DQ.is(p, simpleSelector)){
return returnEl ? GET(p) : p;
}
depth++;
p = p.parentNode;
}
return null;
},
/**
* Looks at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
* @param {String} selector The simple selector to test
* @param {Number/Mixed} maxDepth (optional) The max depth to
search as a number or element (defaults to 10 || document.body)
* @param {Boolean} returnEl (optional) True to return a Ext.Element object instead of DOM node
* @return {HTMLElement} The matching DOM node (or null if no match was found)
*/
findParentNode : function(simpleSelector, maxDepth, returnEl){
var p = Ext.fly(this.dom.parentNode, '_internal');
return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
},
/**
* Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first-child).
* This is a shortcut for findParentNode() that always returns an Ext.Element.
* @param {String} selector The simple selector to test
* @param {Number/Mixed} maxDepth (optional) The max depth to
search as a number or element (defaults to 10 || document.body)
* @return {Ext.Element} The matching DOM node (or null if no match was found)
*/
up : function(simpleSelector, maxDepth){
return this.findParentNode(simpleSelector, maxDepth, true);
},
/**
* Creates a {@link Ext.CompositeElement} for child nodes based on the passed CSS selector (the selector should not contain an id).
* @param {String} selector The CSS selector
* @return {CompositeElement/CompositeElementLite} The composite element
*/
select : function(selector){
return Ext.Element.select(selector, this.dom);
},
/**
* Selects child nodes based on the passed CSS selector (the selector should not contain an id).
* @param {String} selector The CSS selector
* @return {Array} An array of the matched nodes
*/
query : function(selector){
return DQ.select(selector, this.dom);
},
/**
* Selects a single child at any depth below this element based on the passed CSS selector (the selector should not contain an id).
* @param {String} selector The CSS selector
* @param {Boolean} returnDom (optional) True to return the DOM node instead of Ext.Element (defaults to false)
* @return {HTMLElement/Ext.Element} The child Ext.Element (or DOM node if returnDom = true)
*/
child : function(selector, returnDom){
var n = DQ.selectNode(selector, this.dom);
return returnDom ? n : GET(n);
},
/**
* Selects a single *direct* child based on the passed CSS selector (the selector should not contain an id).
* @param {String} selector The CSS selector
* @param {Boolean} returnDom (optional) True to return the DOM node instead of Ext.Element (defaults to false)
* @return {HTMLElement/Ext.Element} The child Ext.Element (or DOM node if returnDom = true)
*/
down : function(selector, returnDom){
var n = DQ.selectNode(" > " + selector, this.dom);
return returnDom ? n : GET(n);
},
/**
* Gets the parent node for this element, optionally chaining up trying to match a selector
* @param {String} selector (optional) Find a parent node that matches the passed simple selector
* @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element
* @return {Ext.Element/HTMLElement} The parent node or null
*/
parent : function(selector, returnDom){
return this.matchNode(PARENTNODE, PARENTNODE, selector, returnDom);
},
/**
* Gets the next sibling, skipping text nodes
* @param {String} selector (optional) Find the next sibling that matches the passed simple selector
* @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element
* @return {Ext.Element/HTMLElement} The next sibling or null
*/
next : function(selector, returnDom){
return this.matchNode(NEXTSIBLING, NEXTSIBLING, selector, returnDom);
},
/**
* Gets the previous sibling, skipping text nodes
* @param {String} selector (optional) Find the previous sibling that matches the passed simple selector
* @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element
* @return {Ext.Element/HTMLElement} The previous sibling or null
*/
prev : function(selector, returnDom){
return this.matchNode(PREVIOUSSIBLING, PREVIOUSSIBLING, selector, returnDom);
},
/**
* Gets the first child, skipping text nodes
* @param {String} selector (optional) Find the next sibling that matches the passed simple selector
* @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element
* @return {Ext.Element/HTMLElement} The first child or null
*/
first : function(selector, returnDom){
return this.matchNode(NEXTSIBLING, 'firstChild', selector, returnDom);
},
/**
* Gets the last child, skipping text nodes
* @param {String} selector (optional) Find the previous sibling that matches the passed simple selector
* @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element
* @return {Ext.Element/HTMLElement} The last child or null
*/
last : function(selector, returnDom){
return this.matchNode(PREVIOUSSIBLING, 'lastChild', selector, returnDom);
},
matchNode : function(dir, start, selector, returnDom){
var n = this.dom[start];
while(n){
if(n.nodeType == 1 && (!selector || DQ.is(n, selector))){
return !returnDom ? GET(n) : n;
}
n = n[dir];
}
return null;
}
};
}());

View File

@@ -1,933 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.EventManager
* Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides
* several useful events directly.
* See {@link Ext.EventObject} for more details on normalized event objects.
* @singleton
*/
Ext.EventManager = function(){
var docReadyEvent,
docReadyProcId,
docReadyState = false,
DETECT_NATIVE = Ext.isGecko || Ext.isWebKit || Ext.isSafari,
E = Ext.lib.Event,
D = Ext.lib.Dom,
DOC = document,
WINDOW = window,
DOMCONTENTLOADED = "DOMContentLoaded",
COMPLETE = 'complete',
propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,
/*
* This cache is used to hold special js objects, the document and window, that don't have an id. We need to keep
* a reference to them so we can look them up at a later point.
*/
specialElCache = [];
function getId(el){
var id = false,
i = 0,
len = specialElCache.length,
skip = false,
o;
if (el) {
if (el.getElementById || el.navigator) {
// look up the id
for(; i < len; ++i){
o = specialElCache[i];
if(o.el === el){
id = o.id;
break;
}
}
if(!id){
// for browsers that support it, ensure that give the el the same id
id = Ext.id(el);
specialElCache.push({
id: id,
el: el
});
skip = true;
}
}else{
id = Ext.id(el);
}
if(!Ext.elCache[id]){
Ext.Element.addToCache(new Ext.Element(el), id);
if(skip){
Ext.elCache[id].skipGC = true;
}
}
}
return id;
}
/// There is some jquery work around stuff here that isn't needed in Ext Core.
function addListener(el, ename, fn, task, wrap, scope){
el = Ext.getDom(el);
var id = getId(el),
es = Ext.elCache[id].events,
wfn;
wfn = E.on(el, ename, wrap);
es[ename] = es[ename] || [];
/* 0 = Original Function,
1 = Event Manager Wrapped Function,
2 = Scope,
3 = Adapter Wrapped Function,
4 = Buffered Task
*/
es[ename].push([fn, wrap, scope, wfn, task]);
// this is a workaround for jQuery and should somehow be removed from Ext Core in the future
// without breaking ExtJS.
// workaround for jQuery
if(el.addEventListener && ename == "mousewheel"){
var args = ["DOMMouseScroll", wrap, false];
el.addEventListener.apply(el, args);
Ext.EventManager.addListener(WINDOW, 'unload', function(){
el.removeEventListener.apply(el, args);
});
}
// fix stopped mousedowns on the document
if(el == DOC && ename == "mousedown"){
Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);
}
}
function doScrollChk(){
/* Notes:
'doScroll' will NOT work in a IFRAME/FRAMESET.
The method succeeds but, a DOM query done immediately after -- FAILS.
*/
if(window != top){
return false;
}
try{
DOC.documentElement.doScroll('left');
}catch(e){
return false;
}
fireDocReady();
return true;
}
/**
* @return {Boolean} True if the document is in a 'complete' state (or was determined to
* be true by other means). If false, the state is evaluated again until canceled.
*/
function checkReadyState(e){
if(Ext.isIE && doScrollChk()){
return true;
}
if(DOC.readyState == COMPLETE){
fireDocReady();
return true;
}
docReadyState || (docReadyProcId = setTimeout(arguments.callee, 2));
return false;
}
var styles;
function checkStyleSheets(e){
styles || (styles = Ext.query('style, link[rel=stylesheet]'));
if(styles.length == DOC.styleSheets.length){
fireDocReady();
return true;
}
docReadyState || (docReadyProcId = setTimeout(arguments.callee, 2));
return false;
}
function OperaDOMContentLoaded(e){
DOC.removeEventListener(DOMCONTENTLOADED, arguments.callee, false);
checkStyleSheets();
}
function fireDocReady(e){
if(!docReadyState){
docReadyState = true; //only attempt listener removal once
if(docReadyProcId){
clearTimeout(docReadyProcId);
}
if(DETECT_NATIVE) {
DOC.removeEventListener(DOMCONTENTLOADED, fireDocReady, false);
}
if(Ext.isIE && checkReadyState.bindIE){ //was this was actually set ??
DOC.detachEvent('onreadystatechange', checkReadyState);
}
E.un(WINDOW, "load", arguments.callee);
}
if(docReadyEvent && !Ext.isReady){
Ext.isReady = true;
docReadyEvent.fire();
docReadyEvent.listeners = [];
}
}
function initDocReady(){
docReadyEvent || (docReadyEvent = new Ext.util.Event());
if (DETECT_NATIVE) {
DOC.addEventListener(DOMCONTENTLOADED, fireDocReady, false);
}
/*
* Handle additional (exceptional) detection strategies here
*/
if (Ext.isIE){
//Use readystatechange as a backup AND primary detection mechanism for a FRAME/IFRAME
//See if page is already loaded
if(!checkReadyState()){
checkReadyState.bindIE = true;
DOC.attachEvent('onreadystatechange', checkReadyState);
}
}else if(Ext.isOpera ){
/* Notes:
Opera needs special treatment needed here because CSS rules are NOT QUITE
available after DOMContentLoaded is raised.
*/
//See if page is already loaded and all styleSheets are in place
(DOC.readyState == COMPLETE && checkStyleSheets()) ||
DOC.addEventListener(DOMCONTENTLOADED, OperaDOMContentLoaded, false);
}else if (Ext.isWebKit){
//Fallback for older Webkits without DOMCONTENTLOADED support
checkReadyState();
}
// no matter what, make sure it fires on load
E.on(WINDOW, "load", fireDocReady);
}
function createTargeted(h, o){
return function(){
var args = Ext.toArray(arguments);
if(o.target == Ext.EventObject.setEvent(args[0]).target){
h.apply(this, args);
}
};
}
function createBuffered(h, o, task){
return function(e){
// create new event object impl so new events don't wipe out properties
task.delay(o.buffer, h, null, [new Ext.EventObjectImpl(e)]);
};
}
function createSingle(h, el, ename, fn, scope){
return function(e){
Ext.EventManager.removeListener(el, ename, fn, scope);
h(e);
};
}
function createDelayed(h, o, fn){
return function(e){
var task = new Ext.util.DelayedTask(h);
if(!fn.tasks) {
fn.tasks = [];
}
fn.tasks.push(task);
task.delay(o.delay || 10, h, null, [new Ext.EventObjectImpl(e)]);
};
}
function listen(element, ename, opt, fn, scope){
var o = (!opt || typeof opt == "boolean") ? {} : opt,
el = Ext.getDom(element), task;
fn = fn || o.fn;
scope = scope || o.scope;
if(!el){
throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
}
function h(e){
// prevent errors while unload occurring
if(!Ext){// !window[xname]){ ==> can't we do this?
return;
}
e = Ext.EventObject.setEvent(e);
var t;
if (o.delegate) {
if(!(t = e.getTarget(o.delegate, el))){
return;
}
} else {
t = e.target;
}
if (o.stopEvent) {
e.stopEvent();
}
if (o.preventDefault) {
e.preventDefault();
}
if (o.stopPropagation) {
e.stopPropagation();
}
if (o.normalized === false) {
e = e.browserEvent;
}
fn.call(scope || el, e, t, o);
}
if(o.target){
h = createTargeted(h, o);
}
if(o.delay){
h = createDelayed(h, o, fn);
}
if(o.single){
h = createSingle(h, el, ename, fn, scope);
}
if(o.buffer){
task = new Ext.util.DelayedTask(h);
h = createBuffered(h, o, task);
}
addListener(el, ename, fn, task, h, scope);
return h;
}
var pub = {
/**
* Appends an event handler to an element. The shorthand version {@link #on} is equivalent. Typically you will
* use {@link Ext.Element#addListener} directly on an Element in favor of calling this version.
* @param {String/HTMLElement} el The html element or id to assign the event handler to.
* @param {String} eventName The name of the event to listen for.
* @param {Function} handler The handler function the event invokes. This function is passed
* the following parameters:<ul>
* <li>evt : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>
* <li>t : Element<div class="sub-desc">The {@link Ext.Element Element} which was the target of the event.
* Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>
* <li>o : Object<div class="sub-desc">The options object from the addListener call.</div></li>
* </ul>
* @param {Object} scope (optional) The scope (<b><code>this</code></b> reference) in which the handler function is executed. <b>Defaults to the Element</b>.
* @param {Object} options (optional) An object containing handler configuration properties.
* This may contain any of the following properties:<ul>
* <li>scope : Object<div class="sub-desc">The scope (<b><code>this</code></b> reference) in which the handler function is executed. <b>Defaults to the Element</b>.</div></li>
* <li>delegate : String<div class="sub-desc">A simple selector to filter the target or look for a descendant of the target</div></li>
* <li>stopEvent : Boolean<div class="sub-desc">True to stop the event. That is stop propagation, and prevent the default action.</div></li>
* <li>preventDefault : Boolean<div class="sub-desc">True to prevent the default action</div></li>
* <li>stopPropagation : Boolean<div class="sub-desc">True to prevent event propagation</div></li>
* <li>normalized : Boolean<div class="sub-desc">False to pass a browser event to the handler function instead of an Ext.EventObject</div></li>
* <li>delay : Number<div class="sub-desc">The number of milliseconds to delay the invocation of the handler after te event fires.</div></li>
* <li>single : Boolean<div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
* <li>buffer : Number<div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
* by the specified number of milliseconds. If the event fires again within that time, the original
* handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
* <li>target : Element<div class="sub-desc">Only call the handler if the event was fired on the target Element, <i>not</i> if the event was bubbled up from a child node.</div></li>
* </ul><br>
* <p>See {@link Ext.Element#addListener} for examples of how to use these options.</p>
*/
addListener : function(element, eventName, fn, scope, options){
if(typeof eventName == 'object'){
var o = eventName, e, val;
for(e in o){
val = o[e];
if(!propRe.test(e)){
if(Ext.isFunction(val)){
// shared options
listen(element, e, o, val, o.scope);
}else{
// individual options
listen(element, e, val);
}
}
}
} else {
listen(element, eventName, options, fn, scope);
}
},
/**
* Removes an event handler from an element. The shorthand version {@link #un} is equivalent. Typically
* you will use {@link Ext.Element#removeListener} directly on an Element in favor of calling this version.
* @param {String/HTMLElement} el The id or html element from which to remove the listener.
* @param {String} eventName The name of the event.
* @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
* @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,
* then this must refer to the same object.
*/
removeListener : function(el, eventName, fn, scope){
el = Ext.getDom(el);
var id = getId(el),
f = el && (Ext.elCache[id].events)[eventName] || [],
wrap, i, l, k, len, fnc;
for (i = 0, len = f.length; i < len; i++) {
/* 0 = Original Function,
1 = Event Manager Wrapped Function,
2 = Scope,
3 = Adapter Wrapped Function,
4 = Buffered Task
*/
if (Ext.isArray(fnc = f[i]) && fnc[0] == fn && (!scope || fnc[2] == scope)) {
if(fnc[4]) {
fnc[4].cancel();
}
k = fn.tasks && fn.tasks.length;
if(k) {
while(k--) {
fn.tasks[k].cancel();
}
delete fn.tasks;
}
wrap = fnc[1];
E.un(el, eventName, E.extAdapter ? fnc[3] : wrap);
// jQuery workaround that should be removed from Ext Core
if(wrap && el.addEventListener && eventName == "mousewheel"){
el.removeEventListener("DOMMouseScroll", wrap, false);
}
// fix stopped mousedowns on the document
if(wrap && el == DOC && eventName == "mousedown"){
Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
}
f.splice(i, 1);
if (f.length === 0) {
delete Ext.elCache[id].events[eventName];
}
for (k in Ext.elCache[id].events) {
return false;
}
Ext.elCache[id].events = {};
return false;
}
}
},
/**
* Removes all event handers from an element. Typically you will use {@link Ext.Element#removeAllListeners}
* directly on an Element in favor of calling this version.
* @param {String/HTMLElement} el The id or html element from which to remove all event handlers.
*/
removeAll : function(el){
el = Ext.getDom(el);
var id = getId(el),
ec = Ext.elCache[id] || {},
es = ec.events || {},
f, i, len, ename, fn, k, wrap;
for(ename in es){
if(es.hasOwnProperty(ename)){
f = es[ename];
/* 0 = Original Function,
1 = Event Manager Wrapped Function,
2 = Scope,
3 = Adapter Wrapped Function,
4 = Buffered Task
*/
for (i = 0, len = f.length; i < len; i++) {
fn = f[i];
if(fn[4]) {
fn[4].cancel();
}
if(fn[0].tasks && (k = fn[0].tasks.length)) {
while(k--) {
fn[0].tasks[k].cancel();
}
delete fn.tasks;
}
wrap = fn[1];
E.un(el, ename, E.extAdapter ? fn[3] : wrap);
// jQuery workaround that should be removed from Ext Core
if(el.addEventListener && wrap && ename == "mousewheel"){
el.removeEventListener("DOMMouseScroll", wrap, false);
}
// fix stopped mousedowns on the document
if(wrap && el == DOC && ename == "mousedown"){
Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
}
}
}
}
if (Ext.elCache[id]) {
Ext.elCache[id].events = {};
}
},
getListeners : function(el, eventName) {
el = Ext.getDom(el);
var id = getId(el),
ec = Ext.elCache[id] || {},
es = ec.events || {},
results = [];
if (es && es[eventName]) {
return es[eventName];
} else {
return null;
}
},
purgeElement : function(el, recurse, eventName) {
el = Ext.getDom(el);
var id = getId(el),
ec = Ext.elCache[id] || {},
es = ec.events || {},
i, f, len;
if (eventName) {
if (es && es.hasOwnProperty(eventName)) {
f = es[eventName];
for (i = 0, len = f.length; i < len; i++) {
Ext.EventManager.removeListener(el, eventName, f[i][0]);
}
}
} else {
Ext.EventManager.removeAll(el);
}
if (recurse && el && el.childNodes) {
for (i = 0, len = el.childNodes.length; i < len; i++) {
Ext.EventManager.purgeElement(el.childNodes[i], recurse, eventName);
}
}
},
_unload : function() {
var el;
for (el in Ext.elCache) {
Ext.EventManager.removeAll(el);
}
delete Ext.elCache;
delete Ext.Element._flyweights;
// Abort any outstanding Ajax requests
var c,
conn,
tid,
ajax = Ext.lib.Ajax;
(typeof ajax.conn == 'object') ? conn = ajax.conn : conn = {};
for (tid in conn) {
c = conn[tid];
if (c) {
ajax.abort({conn: c, tId: tid});
}
}
},
/**
* Adds a listener to be notified when the document is ready (before onload and before images are loaded). Can be
* accessed shorthanded as Ext.onReady().
* @param {Function} fn The method the event invokes.
* @param {Object} scope (optional) The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.
* @param {boolean} options (optional) Options object as passed to {@link Ext.Element#addListener}. It is recommended that the options
* <code>{single: true}</code> be used so that the handler is removed on first invocation.
*/
onDocumentReady : function(fn, scope, options){
if (Ext.isReady) { // if it already fired or document.body is present
docReadyEvent || (docReadyEvent = new Ext.util.Event());
docReadyEvent.addListener(fn, scope, options);
docReadyEvent.fire();
docReadyEvent.listeners = [];
} else {
if (!docReadyEvent) {
initDocReady();
}
options = options || {};
options.delay = options.delay || 1;
docReadyEvent.addListener(fn, scope, options);
}
},
/**
* Forces a document ready state transition for the framework. Used when Ext is loaded
* into a DOM structure AFTER initial page load (Google API or other dynamic load scenario.
* Any pending 'onDocumentReady' handlers will be fired (if not already handled).
*/
fireDocReady : fireDocReady
};
/**
* Appends an event handler to an element. Shorthand for {@link #addListener}.
* @param {String/HTMLElement} el The html element or id to assign the event handler to
* @param {String} eventName The name of the event to listen for.
* @param {Function} handler The handler function the event invokes.
* @param {Object} scope (optional) (<code>this</code> reference) in which the handler function executes. <b>Defaults to the Element</b>.
* @param {Object} options (optional) An object containing standard {@link #addListener} options
* @member Ext.EventManager
* @method on
*/
pub.on = pub.addListener;
/**
* Removes an event handler from an element. Shorthand for {@link #removeListener}.
* @param {String/HTMLElement} el The id or html element from which to remove the listener.
* @param {String} eventName The name of the event.
* @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #on} call.</b>
* @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,
* then this must refer to the same object.
* @member Ext.EventManager
* @method un
*/
pub.un = pub.removeListener;
pub.stoppedMouseDownEvent = new Ext.util.Event();
return pub;
}();
/**
* Adds a listener to be notified when the document is ready (before onload and before images are loaded). Shorthand of {@link Ext.EventManager#onDocumentReady}.
* @param {Function} fn The method the event invokes.
* @param {Object} scope (optional) The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.
* @param {boolean} options (optional) Options object as passed to {@link Ext.Element#addListener}. It is recommended that the options
* <code>{single: true}</code> be used so that the handler is removed on first invocation.
* @member Ext
* @method onReady
*/
Ext.onReady = Ext.EventManager.onDocumentReady;
//Initialize doc classes
(function(){
var initExtCss = function() {
// find the body element
var bd = document.body || document.getElementsByTagName('body')[0];
if (!bd) {
return false;
}
var cls = [' ',
Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : (Ext.isIE7 ? 'ext-ie7' : 'ext-ie8'))
: Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')
: Ext.isOpera ? "ext-opera"
: Ext.isWebKit ? "ext-webkit" : ""];
if (Ext.isSafari) {
cls.push("ext-safari " + (Ext.isSafari2 ? 'ext-safari2' : (Ext.isSafari3 ? 'ext-safari3' : 'ext-safari4')));
} else if(Ext.isChrome) {
cls.push("ext-chrome");
}
if (Ext.isMac) {
cls.push("ext-mac");
}
if (Ext.isLinux) {
cls.push("ext-linux");
}
// add to the parent to allow for selectors like ".ext-strict .ext-ie"
if (Ext.isStrict || Ext.isBorderBox) {
var p = bd.parentNode;
if (p) {
Ext.fly(p, '_internal').addClass(((Ext.isStrict && Ext.isIE ) || (!Ext.enableForcedBoxModel && !Ext.isIE)) ? ' ext-strict' : ' ext-border-box');
}
}
// Forced border box model class applied to all elements. Bypassing javascript based box model adjustments
// in favor of css. This is for non-IE browsers.
if (Ext.enableForcedBoxModel && !Ext.isIE) {
Ext.isForcedBorderBox = true;
cls.push("ext-forced-border-box");
}
Ext.fly(bd, '_internal').addClass(cls);
return true;
};
if (!initExtCss()) {
Ext.onReady(initExtCss);
}
})();
/**
* Code used to detect certain browser feature/quirks/bugs at startup.
*/
(function(){
var supports = Ext.apply(Ext.supports, {
/**
* In Webkit, there is an issue with getting the margin right property, see
* https://bugs.webkit.org/show_bug.cgi?id=13343
*/
correctRightMargin: true,
/**
* Webkit browsers return rgba(0, 0, 0) when a transparent color is used
*/
correctTransparentColor: true,
/**
* IE uses styleFloat, not cssFloat for the float property.
*/
cssFloat: true
});
var supportTests = function(){
var div = document.createElement('div'),
doc = document,
view,
last;
div.innerHTML = '<div style="height:30px;width:50px;"><div style="height:20px;width:20px;"></div></div><div style="float:left;background-color:transparent;">';
doc.body.appendChild(div);
last = div.lastChild;
if((view = doc.defaultView)){
if(view.getComputedStyle(div.firstChild.firstChild, null).marginRight != '0px'){
supports.correctRightMargin = false;
}
if(view.getComputedStyle(last, null).backgroundColor != 'transparent'){
supports.correctTransparentColor = false;
}
}
supports.cssFloat = !!last.style.cssFloat;
doc.body.removeChild(div);
};
if (Ext.isReady) {
supportTests();
} else {
Ext.onReady(supportTests);
}
})();
/**
* @class Ext.EventObject
* Just as {@link Ext.Element} wraps around a native DOM node, Ext.EventObject
* wraps the browser's native event-object normalizing cross-browser differences,
* such as which mouse button is clicked, keys pressed, mechanisms to stop
* event-propagation along with a method to prevent default actions from taking place.
* <p>For example:</p>
* <pre><code>
function handleClick(e, t){ // e is not a standard event object, it is a Ext.EventObject
e.preventDefault();
var target = e.getTarget(); // same as t (the target HTMLElement)
...
}
var myDiv = {@link Ext#get Ext.get}("myDiv"); // get reference to an {@link Ext.Element}
myDiv.on( // 'on' is shorthand for addListener
"click", // perform an action on click of myDiv
handleClick // reference to the action handler
);
// other methods to do the same:
Ext.EventManager.on("myDiv", 'click', handleClick);
Ext.EventManager.addListener("myDiv", 'click', handleClick);
</code></pre>
* @singleton
*/
Ext.EventObject = function(){
var E = Ext.lib.Event,
clickRe = /(dbl)?click/,
// safari keypress events for special keys return bad keycodes
safariKeys = {
3 : 13, // enter
63234 : 37, // left
63235 : 39, // right
63232 : 38, // up
63233 : 40, // down
63276 : 33, // page up
63277 : 34, // page down
63272 : 46, // delete
63273 : 36, // home
63275 : 35 // end
},
// normalize button clicks
btnMap = Ext.isIE ? {1:0,4:1,2:2} : {0:0,1:1,2:2};
Ext.EventObjectImpl = function(e){
if(e){
this.setEvent(e.browserEvent || e);
}
};
Ext.EventObjectImpl.prototype = {
/** @private */
setEvent : function(e){
var me = this;
if(e == me || (e && e.browserEvent)){ // already wrapped
return e;
}
me.browserEvent = e;
if(e){
// normalize buttons
me.button = e.button ? btnMap[e.button] : (e.which ? e.which - 1 : -1);
if(clickRe.test(e.type) && me.button == -1){
me.button = 0;
}
me.type = e.type;
me.shiftKey = e.shiftKey;
// mac metaKey behaves like ctrlKey
me.ctrlKey = e.ctrlKey || e.metaKey || false;
me.altKey = e.altKey;
// in getKey these will be normalized for the mac
me.keyCode = e.keyCode;
me.charCode = e.charCode;
// cache the target for the delayed and or buffered events
me.target = E.getTarget(e);
// same for XY
me.xy = E.getXY(e);
}else{
me.button = -1;
me.shiftKey = false;
me.ctrlKey = false;
me.altKey = false;
me.keyCode = 0;
me.charCode = 0;
me.target = null;
me.xy = [0, 0];
}
return me;
},
/**
* Stop the event (preventDefault and stopPropagation)
*/
stopEvent : function(){
var me = this;
if(me.browserEvent){
if(me.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(me);
}
E.stopEvent(me.browserEvent);
}
},
/**
* Prevents the browsers default handling of the event.
*/
preventDefault : function(){
if(this.browserEvent){
E.preventDefault(this.browserEvent);
}
},
/**
* Cancels bubbling of the event.
*/
stopPropagation : function(){
var me = this;
if(me.browserEvent){
if(me.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(me);
}
E.stopPropagation(me.browserEvent);
}
},
/**
* Gets the character code for the event.
* @return {Number}
*/
getCharCode : function(){
return this.charCode || this.keyCode;
},
/**
* Returns a normalized keyCode for the event.
* @return {Number} The key code
*/
getKey : function(){
return this.normalizeKey(this.keyCode || this.charCode);
},
// private
normalizeKey: function(k){
return Ext.isSafari ? (safariKeys[k] || k) : k;
},
/**
* Gets the x coordinate of the event.
* @return {Number}
*/
getPageX : function(){
return this.xy[0];
},
/**
* Gets the y coordinate of the event.
* @return {Number}
*/
getPageY : function(){
return this.xy[1];
},
/**
* Gets the page coordinates of the event.
* @return {Array} The xy values like [x, y]
*/
getXY : function(){
return this.xy;
},
/**
* Gets the target for the event.
* @param {String} selector (optional) A simple selector to filter the target or look for an ancestor of the target
* @param {Number/Mixed} maxDepth (optional) The max depth to
search as a number or element (defaults to 10 || document.body)
* @param {Boolean} returnEl (optional) True to return a Ext.Element object instead of DOM node
* @return {HTMLelement}
*/
getTarget : function(selector, maxDepth, returnEl){
return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);
},
/**
* Gets the related target.
* @return {HTMLElement}
*/
getRelatedTarget : function(){
return this.browserEvent ? E.getRelatedTarget(this.browserEvent) : null;
},
/**
* Normalizes mouse wheel delta across browsers
* @return {Number} The delta
*/
getWheelDelta : function(){
var e = this.browserEvent;
var delta = 0;
if(e.wheelDelta){ /* IE/Opera. */
delta = e.wheelDelta/120;
}else if(e.detail){ /* Mozilla case. */
delta = -e.detail/3;
}
return delta;
},
/**
* Returns true if the target of this event is a child of el. Unless the allowEl parameter is set, it will return false if if the target is el.
* Example usage:<pre><code>
// Handle click on any child of an element
Ext.getBody().on('click', function(e){
if(e.within('some-el')){
alert('Clicked on a child of some-el!');
}
});
// Handle click directly on an element, ignoring clicks on child nodes
Ext.getBody().on('click', function(e,t){
if((t.id == 'some-el') && !e.within(t, true)){
alert('Clicked directly on some-el!');
}
});
</code></pre>
* @param {Mixed} el The id, DOM element or Ext.Element to check
* @param {Boolean} related (optional) true to test if the related target is within el instead of the target
* @param {Boolean} allowEl {optional} true to also check if the passed element is the target or related target
* @return {Boolean}
*/
within : function(el, related, allowEl){
if(el){
var t = this[related ? "getRelatedTarget" : "getTarget"]();
return t && ((allowEl ? (t == Ext.getDom(el)) : false) || Ext.fly(el).contains(t));
}
return false;
}
};
return new Ext.EventObjectImpl();
}();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,96 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Loader
* @singleton
* Simple class to help load JavaScript files on demand
*/
Ext.Loader = Ext.apply({}, {
/**
* Loads a given set of .js files. Calls the callback function when all files have been loaded
* Set preserveOrder to true to ensure non-parallel loading of files if load order is important
* @param {Array} fileList Array of all files to load
* @param {Function} callback Callback to call after all files have been loaded
* @param {Object} scope The scope to call the callback in
* @param {Boolean} preserveOrder True to make files load in serial, one after the other (defaults to false)
*/
load: function(fileList, callback, scope, preserveOrder) {
var scope = scope || this,
head = document.getElementsByTagName("head")[0],
fragment = document.createDocumentFragment(),
numFiles = fileList.length,
loadedFiles = 0,
me = this;
/**
* Loads a particular file from the fileList by index. This is used when preserving order
*/
var loadFileIndex = function(index) {
head.appendChild(
me.buildScriptTag(fileList[index], onFileLoaded)
);
};
/**
* Callback function which is called after each file has been loaded. This calls the callback
* passed to load once the final file in the fileList has been loaded
*/
var onFileLoaded = function() {
loadedFiles ++;
//if this was the last file, call the callback, otherwise load the next file
if (numFiles == loadedFiles && typeof callback == 'function') {
callback.call(scope);
} else {
if (preserveOrder === true) {
loadFileIndex(loadedFiles);
}
}
};
if (preserveOrder === true) {
loadFileIndex.call(this, 0);
} else {
//load each file (most browsers will do this in parallel)
Ext.each(fileList, function(file, index) {
fragment.appendChild(
this.buildScriptTag(file, onFileLoaded)
);
}, this);
head.appendChild(fragment);
}
},
/**
* @private
* Creates and returns a script tag, but does not place it into the document. If a callback function
* is passed, this is called when the script has been loaded
* @param {String} filename The name of the file to create a script tag for
* @param {Function} callback Optional callback, which is called when the script has been loaded
* @return {Element} The new script ta
*/
buildScriptTag: function(filename, callback) {
var script = document.createElement('script');
script.type = "text/javascript";
script.src = filename;
//IE has a different way of handling &lt;script&gt; loads, so we need to check for it here
if (script.readyState) {
script.onreadystatechange = function() {
if (script.readyState == "loaded" || script.readyState == "complete") {
script.onreadystatechange = null;
callback();
}
};
} else {
script.onload = callback;
}
return script;
}
});

View File

@@ -1,246 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.Template
* <p>Represents an HTML fragment template. Templates may be {@link #compile precompiled}
* for greater performance.</p>
* <p>For example usage {@link #Template see the constructor}.</p>
*
* @constructor
* An instance of this class may be created by passing to the constructor either
* a single argument, or multiple arguments:
* <div class="mdetail-params"><ul>
* <li><b>single argument</b> : String/Array
* <div class="sub-desc">
* The single argument may be either a String or an Array:<ul>
* <li><tt>String</tt> : </li><pre><code>
var t = new Ext.Template("&lt;div>Hello {0}.&lt;/div>");
t.{@link #append}('some-element', ['foo']);
* </code></pre>
* <li><tt>Array</tt> : </li>
* An Array will be combined with <code>join('')</code>.
<pre><code>
var t = new Ext.Template([
'&lt;div name="{id}"&gt;',
'&lt;span class="{cls}"&gt;{name:trim} {value:ellipsis(10)}&lt;/span&gt;',
'&lt;/div&gt;',
]);
t.{@link #compile}();
t.{@link #append}('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'});
</code></pre>
* </ul></div></li>
* <li><b>multiple arguments</b> : String, Object, Array, ...
* <div class="sub-desc">
* Multiple arguments will be combined with <code>join('')</code>.
* <pre><code>
var t = new Ext.Template(
'&lt;div name="{id}"&gt;',
'&lt;span class="{cls}"&gt;{name} {value}&lt;/span&gt;',
'&lt;/div&gt;',
// a configuration object:
{
compiled: true, // {@link #compile} immediately
disableFormats: true // See Notes below.
}
);
* </code></pre>
* <p><b>Notes</b>:</p>
* <div class="mdetail-params"><ul>
* <li>Formatting and <code>disableFormats</code> are not applicable for Ext Core.</li>
* <li>For a list of available format functions, see {@link Ext.util.Format}.</li>
* <li><code>disableFormats</code> reduces <code>{@link #apply}</code> time
* when no formatting is required.</li>
* </ul></div>
* </div></li>
* </ul></div>
* @param {Mixed} config
*/
Ext.Template = function(html){
var me = this,
a = arguments,
buf = [],
v;
if (Ext.isArray(html)) {
html = html.join("");
} else if (a.length > 1) {
for(var i = 0, len = a.length; i < len; i++){
v = a[i];
if(typeof v == 'object'){
Ext.apply(me, v);
} else {
buf.push(v);
}
};
html = buf.join('');
}
/**@private*/
me.html = html;
/**
* @cfg {Boolean} compiled Specify <tt>true</tt> to compile the template
* immediately (see <code>{@link #compile}</code>).
* Defaults to <tt>false</tt>.
*/
if (me.compiled) {
me.compile();
}
};
Ext.Template.prototype = {
/**
* @cfg {RegExp} re The regular expression used to match template variables.
* Defaults to:<pre><code>
* re : /\{([\w-]+)\}/g // for Ext Core
* re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g // for Ext JS
* </code></pre>
*/
re : /\{([\w-]+)\}/g,
/**
* See <code>{@link #re}</code>.
* @type RegExp
* @property re
*/
/**
* Returns an HTML fragment of this template with the specified <code>values</code> applied.
* @param {Object/Array} values
* The template values. Can be an array if the params are numeric (i.e. <code>{0}</code>)
* or an object (i.e. <code>{foo: 'bar'}</code>).
* @return {String} The HTML fragment
*/
applyTemplate : function(values){
var me = this;
return me.compiled ?
me.compiled(values) :
me.html.replace(me.re, function(m, name){
return values[name] !== undefined ? values[name] : "";
});
},
/**
* Sets the HTML used as the template and optionally compiles it.
* @param {String} html
* @param {Boolean} compile (optional) True to compile the template (defaults to undefined)
* @return {Ext.Template} this
*/
set : function(html, compile){
var me = this;
me.html = html;
me.compiled = null;
return compile ? me.compile() : me;
},
/**
* Compiles the template into an internal function, eliminating the RegEx overhead.
* @return {Ext.Template} this
*/
compile : function(){
var me = this,
sep = Ext.isGecko ? "+" : ",";
function fn(m, name){
name = "values['" + name + "']";
return "'"+ sep + '(' + name + " == undefined ? '' : " + name + ')' + sep + "'";
}
eval("this.compiled = function(values){ return " + (Ext.isGecko ? "'" : "['") +
me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
(Ext.isGecko ? "';};" : "'].join('');};"));
return me;
},
/**
* Applies the supplied values to the template and inserts the new node(s) as the first child of el.
* @param {Mixed} el The context element
* @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
* @param {Boolean} returnElement (optional) true to return a Ext.Element (defaults to undefined)
* @return {HTMLElement/Ext.Element} The new node or Element
*/
insertFirst: function(el, values, returnElement){
return this.doInsert('afterBegin', el, values, returnElement);
},
/**
* Applies the supplied values to the template and inserts the new node(s) before el.
* @param {Mixed} el The context element
* @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
* @param {Boolean} returnElement (optional) true to return a Ext.Element (defaults to undefined)
* @return {HTMLElement/Ext.Element} The new node or Element
*/
insertBefore: function(el, values, returnElement){
return this.doInsert('beforeBegin', el, values, returnElement);
},
/**
* Applies the supplied values to the template and inserts the new node(s) after el.
* @param {Mixed} el The context element
* @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
* @param {Boolean} returnElement (optional) true to return a Ext.Element (defaults to undefined)
* @return {HTMLElement/Ext.Element} The new node or Element
*/
insertAfter : function(el, values, returnElement){
return this.doInsert('afterEnd', el, values, returnElement);
},
/**
* Applies the supplied <code>values</code> to the template and appends
* the new node(s) to the specified <code>el</code>.
* <p>For example usage {@link #Template see the constructor}.</p>
* @param {Mixed} el The context element
* @param {Object/Array} values
* The template values. Can be an array if the params are numeric (i.e. <code>{0}</code>)
* or an object (i.e. <code>{foo: 'bar'}</code>).
* @param {Boolean} returnElement (optional) true to return an Ext.Element (defaults to undefined)
* @return {HTMLElement/Ext.Element} The new node or Element
*/
append : function(el, values, returnElement){
return this.doInsert('beforeEnd', el, values, returnElement);
},
doInsert : function(where, el, values, returnEl){
el = Ext.getDom(el);
var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
return returnEl ? Ext.get(newNode, true) : newNode;
},
/**
* Applies the supplied values to the template and overwrites the content of el with the new node(s).
* @param {Mixed} el The context element
* @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
* @param {Boolean} returnElement (optional) true to return a Ext.Element (defaults to undefined)
* @return {HTMLElement/Ext.Element} The new node or Element
*/
overwrite : function(el, values, returnElement){
el = Ext.getDom(el);
el.innerHTML = this.applyTemplate(values);
return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
}
};
/**
* Alias for {@link #applyTemplate}
* Returns an HTML fragment of this template with the specified <code>values</code> applied.
* @param {Object/Array} values
* The template values. Can be an array if the params are numeric (i.e. <code>{0}</code>)
* or an object (i.e. <code>{foo: 'bar'}</code>).
* @return {String} The HTML fragment
* @member Ext.Template
* @method apply
*/
Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
/**
* Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.
* @param {String/HTMLElement} el A DOM element or its id
* @param {Object} config A configuration object
* @return {Ext.Template} The created template
* @static
*/
Ext.Template.from = function(el, config){
el = Ext.getDom(el);
return new Ext.Template(el.value || el.innerHTML, config || '');
};

View File

@@ -1,583 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
(function(){
var BEFOREREQUEST = "beforerequest",
REQUESTCOMPLETE = "requestcomplete",
REQUESTEXCEPTION = "requestexception",
UNDEFINED = undefined,
LOAD = 'load',
POST = 'POST',
GET = 'GET',
WINDOW = window;
/**
* @class Ext.data.Connection
* @extends Ext.util.Observable
* <p>The class encapsulates a connection to the page's originating domain, allowing requests to be made
* either to a configured URL, or to a URL specified at request time.</p>
* <p>Requests made by this class are asynchronous, and will return immediately. No data from
* the server will be available to the statement immediately following the {@link #request} call.
* To process returned data, use a
* <a href="#request-option-success" ext:member="request-option-success" ext:cls="Ext.data.Connection">success callback</a>
* in the request options object,
* or an {@link #requestcomplete event listener}.</p>
* <p><h3>File Uploads</h3><a href="#request-option-isUpload" ext:member="request-option-isUpload" ext:cls="Ext.data.Connection">File uploads</a> are not performed using normal "Ajax" techniques, that
* is they are <b>not</b> performed using XMLHttpRequests. Instead the form is submitted in the standard
* manner with the DOM <tt>&lt;form></tt> element temporarily modified to have its
* <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
* to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
* but removed after the return data has been gathered.</p>
* <p>The server response is parsed by the browser to create the document for the IFRAME. If the
* server is using JSON to send the return object, then the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
* must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
* <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
* "&lt;" as "&amp;lt;", "&amp;" as "&amp;amp;" etc.</p>
* <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
* is created containing a <tt>responseText</tt> property in order to conform to the
* requirements of event handlers and callbacks.</p>
* <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
* and some server technologies (notably JEE) may require some custom processing in order to
* retrieve parameter names and parameter values from the packet content.</p>
* <p>Also note that it's not possible to check the response code of the hidden iframe, so the success handler will ALWAYS fire.</p>
* @constructor
* @param {Object} config a configuration object.
*/
Ext.data.Connection = function(config){
Ext.apply(this, config);
this.addEvents(
/**
* @event beforerequest
* Fires before a network request is made to retrieve a data object.
* @param {Connection} conn This Connection object.
* @param {Object} options The options config object passed to the {@link #request} method.
*/
BEFOREREQUEST,
/**
* @event requestcomplete
* Fires if the request was successfully completed.
* @param {Connection} conn This Connection object.
* @param {Object} response The XHR object containing the response data.
* See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
* for details.
* @param {Object} options The options config object passed to the {@link #request} method.
*/
REQUESTCOMPLETE,
/**
* @event requestexception
* Fires if an error HTTP status was returned from the server.
* See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP Status Code Definitions</a>
* for details of HTTP status codes.
* @param {Connection} conn This Connection object.
* @param {Object} response The XHR object containing the response data.
* See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
* for details.
* @param {Object} options The options config object passed to the {@link #request} method.
*/
REQUESTEXCEPTION
);
Ext.data.Connection.superclass.constructor.call(this);
};
Ext.extend(Ext.data.Connection, Ext.util.Observable, {
/**
* @cfg {String} url (Optional) <p>The default URL to be used for requests to the server. Defaults to undefined.</p>
* <p>The <code>url</code> config may be a function which <i>returns</i> the URL to use for the Ajax request. The scope
* (<code><b>this</b></code> reference) of the function is the <code>scope</code> option passed to the {@link #request} method.</p>
*/
/**
* @cfg {Object} extraParams (Optional) An object containing properties which are used as
* extra parameters to each request made by this object. (defaults to undefined)
*/
/**
* @cfg {Object} defaultHeaders (Optional) An object containing request headers which are added
* to each request made by this object. (defaults to undefined)
*/
/**
* @cfg {String} method (Optional) The default HTTP method to be used for requests.
* (defaults to undefined; if not set, but {@link #request} params are present, POST will be used;
* otherwise, GET will be used.)
*/
/**
* @cfg {Number} timeout (Optional) The timeout in milliseconds to be used for requests. (defaults to 30000)
*/
timeout : 30000,
/**
* @cfg {Boolean} autoAbort (Optional) Whether this request should abort any pending requests. (defaults to false)
* @type Boolean
*/
autoAbort:false,
/**
* @cfg {Boolean} disableCaching (Optional) True to add a unique cache-buster param to GET requests. (defaults to true)
* @type Boolean
*/
disableCaching: true,
/**
* @cfg {String} disableCachingParam (Optional) Change the parameter which is sent went disabling caching
* through a cache buster. Defaults to '_dc'
* @type String
*/
disableCachingParam: '_dc',
/**
* <p>Sends an HTTP request to a remote server.</p>
* <p><b>Important:</b> Ajax server requests are asynchronous, and this call will
* return before the response has been received. Process any returned data
* in a callback function.</p>
* <pre><code>
Ext.Ajax.request({
url: 'ajax_demo/sample.json',
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
console.dir(obj);
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});
* </code></pre>
* <p>To execute a callback function in the correct scope, use the <tt>scope</tt> option.</p>
* @param {Object} options An object which may contain the following properties:<ul>
* <li><b>url</b> : String/Function (Optional)<div class="sub-desc">The URL to
* which to send the request, or a function to call which returns a URL string. The scope of the
* function is specified by the <tt>scope</tt> option. Defaults to the configured
* <tt>{@link #url}</tt>.</div></li>
* <li><b>params</b> : Object/String/Function (Optional)<div class="sub-desc">
* An object containing properties which are used as parameters to the
* request, a url encoded string or a function to call to get either. The scope of the function
* is specified by the <tt>scope</tt> option.</div></li>
* <li><b>method</b> : String (Optional)<div class="sub-desc">The HTTP method to use
* for the request. Defaults to the configured method, or if no method was configured,
* "GET" if no parameters are being sent, and "POST" if parameters are being sent. Note that
* the method name is case-sensitive and should be all caps.</div></li>
* <li><b>callback</b> : Function (Optional)<div class="sub-desc">The
* function to be called upon receipt of the HTTP response. The callback is
* called regardless of success or failure and is passed the following
* parameters:<ul>
* <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
* <li><b>success</b> : Boolean<div class="sub-desc">True if the request succeeded.</div></li>
* <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.
* See <a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a> for details about
* accessing elements of the response.</div></li>
* </ul></div></li>
* <li><a id="request-option-success"></a><b>success</b> : Function (Optional)<div class="sub-desc">The function
* to be called upon success of the request. The callback is passed the following
* parameters:<ul>
* <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
* <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
* </ul></div></li>
* <li><b>failure</b> : Function (Optional)<div class="sub-desc">The function
* to be called upon failure of the request. The callback is passed the
* following parameters:<ul>
* <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
* <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
* </ul></div></li>
* <li><b>scope</b> : Object (Optional)<div class="sub-desc">The scope in
* which to execute the callbacks: The "this" object for the callback function. If the <tt>url</tt>, or <tt>params</tt> options were
* specified as functions from which to draw values, then this also serves as the scope for those function calls.
* Defaults to the browser window.</div></li>
* <li><b>timeout</b> : Number (Optional)<div class="sub-desc">The timeout in milliseconds to be used for this request. Defaults to 30 seconds.</div></li>
* <li><b>form</b> : Element/HTMLElement/String (Optional)<div class="sub-desc">The <tt>&lt;form&gt;</tt>
* Element or the id of the <tt>&lt;form&gt;</tt> to pull parameters from.</div></li>
* <li><a id="request-option-isUpload"></a><b>isUpload</b> : Boolean (Optional)<div class="sub-desc"><b>Only meaningful when used
* with the <tt>form</tt> option</b>.
* <p>True if the form object is a file upload (will be set automatically if the form was
* configured with <b><tt>enctype</tt></b> "multipart/form-data").</p>
* <p>File uploads are not performed using normal "Ajax" techniques, that is they are <b>not</b>
* performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
* DOM <tt>&lt;form></tt> element temporarily modified to have its
* <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
* to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
* but removed after the return data has been gathered.</p>
* <p>The server response is parsed by the browser to create the document for the IFRAME. If the
* server is using JSON to send the return object, then the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
* must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
* <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
* is created containing a <tt>responseText</tt> property in order to conform to the
* requirements of event handlers and callbacks.</p>
* <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
* and some server technologies (notably JEE) may require some custom processing in order to
* retrieve parameter names and parameter values from the packet content.</p>
* </div></li>
* <li><b>headers</b> : Object (Optional)<div class="sub-desc">Request
* headers to set for the request.</div></li>
* <li><b>xmlData</b> : Object (Optional)<div class="sub-desc">XML document
* to use for the post. Note: This will be used instead of params for the post
* data. Any params will be appended to the URL.</div></li>
* <li><b>jsonData</b> : Object/String (Optional)<div class="sub-desc">JSON
* data to use as the post. Note: This will be used instead of params for the post
* data. Any params will be appended to the URL.</div></li>
* <li><b>disableCaching</b> : Boolean (Optional)<div class="sub-desc">True
* to add a unique cache-buster param to GET requests.</div></li>
* </ul></p>
* <p>The options object may also contain any other property which might be needed to perform
* postprocessing in a callback because it is passed to callback functions.</p>
* @return {Number} transactionId The id of the server transaction. This may be used
* to cancel the request.
*/
request : function(o){
var me = this;
if(me.fireEvent(BEFOREREQUEST, me, o)){
if (o.el) {
if(!Ext.isEmpty(o.indicatorText)){
me.indicatorText = '<div class="loading-indicator">'+o.indicatorText+"</div>";
}
if(me.indicatorText) {
Ext.getDom(o.el).innerHTML = me.indicatorText;
}
o.success = (Ext.isFunction(o.success) ? o.success : function(){}).createInterceptor(function(response) {
Ext.getDom(o.el).innerHTML = response.responseText;
});
}
var p = o.params,
url = o.url || me.url,
method,
cb = {success: me.handleResponse,
failure: me.handleFailure,
scope: me,
argument: {options: o},
timeout : Ext.num(o.timeout, me.timeout)
},
form,
serForm;
if (Ext.isFunction(p)) {
p = p.call(o.scope||WINDOW, o);
}
p = Ext.urlEncode(me.extraParams, Ext.isObject(p) ? Ext.urlEncode(p) : p);
if (Ext.isFunction(url)) {
url = url.call(o.scope || WINDOW, o);
}
if((form = Ext.getDom(o.form))){
url = url || form.action;
if(o.isUpload || (/multipart\/form-data/i.test(form.getAttribute("enctype")))) {
return me.doFormUpload.call(me, o, p, url);
}
serForm = Ext.lib.Ajax.serializeForm(form);
p = p ? (p + '&' + serForm) : serForm;
}
method = o.method || me.method || ((p || o.xmlData || o.jsonData) ? POST : GET);
if(method === GET && (me.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
var dcp = o.disableCachingParam || me.disableCachingParam;
url = Ext.urlAppend(url, dcp + '=' + (new Date().getTime()));
}
o.headers = Ext.apply(o.headers || {}, me.defaultHeaders || {});
if(o.autoAbort === true || me.autoAbort) {
me.abort();
}
if((method == GET || o.xmlData || o.jsonData) && p){
url = Ext.urlAppend(url, p);
p = '';
}
return (me.transId = Ext.lib.Ajax.request(method, url, cb, p, o));
}else{
return o.callback ? o.callback.apply(o.scope, [o,UNDEFINED,UNDEFINED]) : null;
}
},
/**
* Determine whether this object has a request outstanding.
* @param {Number} transactionId (Optional) defaults to the last transaction
* @return {Boolean} True if there is an outstanding request.
*/
isLoading : function(transId){
return transId ? Ext.lib.Ajax.isCallInProgress(transId) : !! this.transId;
},
/**
* Aborts any outstanding request.
* @param {Number} transactionId (Optional) defaults to the last transaction
*/
abort : function(transId){
if(transId || this.isLoading()){
Ext.lib.Ajax.abort(transId || this.transId);
}
},
// private
handleResponse : function(response){
this.transId = false;
var options = response.argument.options;
response.argument = options ? options.argument : null;
this.fireEvent(REQUESTCOMPLETE, this, response, options);
if(options.success){
options.success.call(options.scope, response, options);
}
if(options.callback){
options.callback.call(options.scope, options, true, response);
}
},
// private
handleFailure : function(response, e){
this.transId = false;
var options = response.argument.options;
response.argument = options ? options.argument : null;
this.fireEvent(REQUESTEXCEPTION, this, response, options, e);
if(options.failure){
options.failure.call(options.scope, response, options);
}
if(options.callback){
options.callback.call(options.scope, options, false, response);
}
},
// private
doFormUpload : function(o, ps, url){
var id = Ext.id(),
doc = document,
frame = doc.createElement('iframe'),
form = Ext.getDom(o.form),
hiddens = [],
hd,
encoding = 'multipart/form-data',
buf = {
target: form.target,
method: form.method,
encoding: form.encoding,
enctype: form.enctype,
action: form.action
};
/*
* Originally this behaviour was modified for Opera 10 to apply the secure URL after
* the frame had been added to the document. It seems this has since been corrected in
* Opera so the behaviour has been reverted, the URL will be set before being added.
*/
Ext.fly(frame).set({
id: id,
name: id,
cls: 'x-hidden',
src: Ext.SSL_SECURE_URL
});
doc.body.appendChild(frame);
// This is required so that IE doesn't pop the response up in a new window.
if(Ext.isIE){
document.frames[id].name = id;
}
Ext.fly(form).set({
target: id,
method: POST,
enctype: encoding,
encoding: encoding,
action: url || buf.action
});
// add dynamic params
Ext.iterate(Ext.urlDecode(ps, false), function(k, v){
hd = doc.createElement('input');
Ext.fly(hd).set({
type: 'hidden',
value: v,
name: k
});
form.appendChild(hd);
hiddens.push(hd);
});
function cb(){
var me = this,
// bogus response object
r = {responseText : '',
responseXML : null,
argument : o.argument},
doc,
firstChild;
try{
doc = frame.contentWindow.document || frame.contentDocument || WINDOW.frames[id].document;
if(doc){
if(doc.body){
if(/textarea/i.test((firstChild = doc.body.firstChild || {}).tagName)){ // json response wrapped in textarea
r.responseText = firstChild.value;
}else{
r.responseText = doc.body.innerHTML;
}
}
//in IE the document may still have a body even if returns XML.
r.responseXML = doc.XMLDocument || doc;
}
}
catch(e) {}
Ext.EventManager.removeListener(frame, LOAD, cb, me);
me.fireEvent(REQUESTCOMPLETE, me, r, o);
function runCallback(fn, scope, args){
if(Ext.isFunction(fn)){
fn.apply(scope, args);
}
}
runCallback(o.success, o.scope, [r, o]);
runCallback(o.callback, o.scope, [o, true, r]);
if(!me.debugUploads){
setTimeout(function(){Ext.removeNode(frame);}, 100);
}
}
Ext.EventManager.on(frame, LOAD, cb, this);
form.submit();
Ext.fly(form).set(buf);
Ext.each(hiddens, function(h) {
Ext.removeNode(h);
});
}
});
})();
/**
* @class Ext.Ajax
* @extends Ext.data.Connection
* <p>The global Ajax request class that provides a simple way to make Ajax requests
* with maximum flexibility.</p>
* <p>Since Ext.Ajax is a singleton, you can set common properties/events for it once
* and override them at the request function level only if necessary.</p>
* <p>Common <b>Properties</b> you may want to set are:<div class="mdetail-params"><ul>
* <li><b><tt>{@link #method}</tt></b><p class="sub-desc"></p></li>
* <li><b><tt>{@link #extraParams}</tt></b><p class="sub-desc"></p></li>
* <li><b><tt>{@link #url}</tt></b><p class="sub-desc"></p></li>
* </ul></div>
* <pre><code>
// Default headers to pass in every request
Ext.Ajax.defaultHeaders = {
'Powered-By': 'Ext'
};
* </code></pre>
* </p>
* <p>Common <b>Events</b> you may want to set are:<div class="mdetail-params"><ul>
* <li><b><tt>{@link Ext.data.Connection#beforerequest beforerequest}</tt></b><p class="sub-desc"></p></li>
* <li><b><tt>{@link Ext.data.Connection#requestcomplete requestcomplete}</tt></b><p class="sub-desc"></p></li>
* <li><b><tt>{@link Ext.data.Connection#requestexception requestexception}</tt></b><p class="sub-desc"></p></li>
* </ul></div>
* <pre><code>
// Example: show a spinner during all Ajax requests
Ext.Ajax.on('beforerequest', this.showSpinner, this);
Ext.Ajax.on('requestcomplete', this.hideSpinner, this);
Ext.Ajax.on('requestexception', this.hideSpinner, this);
* </code></pre>
* </p>
* <p>An example request:</p>
* <pre><code>
// Basic request
Ext.Ajax.{@link Ext.data.Connection#request request}({
url: 'foo.php',
success: someFn,
failure: otherFn,
headers: {
'my-header': 'foo'
},
params: { foo: 'bar' }
});
// Simple ajax form submission
Ext.Ajax.{@link Ext.data.Connection#request request}({
form: 'some-form',
params: 'foo=bar'
});
* </code></pre>
* </p>
* @singleton
*/
Ext.Ajax = new Ext.data.Connection({
/**
* @cfg {String} url @hide
*/
/**
* @cfg {Object} extraParams @hide
*/
/**
* @cfg {Object} defaultHeaders @hide
*/
/**
* @cfg {String} method (Optional) @hide
*/
/**
* @cfg {Number} timeout (Optional) @hide
*/
/**
* @cfg {Boolean} autoAbort (Optional) @hide
*/
/**
* @cfg {Boolean} disableCaching (Optional) @hide
*/
/**
* @property disableCaching
* True to add a unique cache-buster param to GET requests. (defaults to true)
* @type Boolean
*/
/**
* @property url
* The default URL to be used for requests to the server. (defaults to undefined)
* If the server receives all requests through one URL, setting this once is easier than
* entering it on every request.
* @type String
*/
/**
* @property extraParams
* An object containing properties which are used as extra parameters to each request made
* by this object (defaults to undefined). Session information and other data that you need
* to pass with each request are commonly put here.
* @type Object
*/
/**
* @property defaultHeaders
* An object containing request headers which are added to each request made by this object
* (defaults to undefined).
* @type Object
*/
/**
* @property method
* The default HTTP method to be used for requests. Note that this is case-sensitive and
* should be all caps (defaults to undefined; if not set but params are present will use
* <tt>"POST"</tt>, otherwise will use <tt>"GET"</tt>.)
* @type String
*/
/**
* @property timeout
* The timeout in milliseconds to be used for requests. (defaults to 30000)
* @type Number
*/
/**
* @property autoAbort
* Whether a new request should abort any pending requests. (defaults to false)
* @type Boolean
*/
autoAbort : false,
/**
* Serialize the passed form into a url encoded string
* @param {String/HTMLElement} form
* @return {String}
*/
serializeForm : function(form){
return Ext.lib.Ajax.serializeForm(form);
}
});

View File

@@ -1,70 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.util.DelayedTask
* <p> The DelayedTask class provides a convenient way to "buffer" the execution of a method,
* performing setTimeout where a new timeout cancels the old timeout. When called, the
* task will wait the specified time period before executing. If durng that time period,
* the task is called again, the original call will be cancelled. This continues so that
* the function is only called a single time for each iteration.</p>
* <p>This method is especially useful for things like detecting whether a user has finished
* typing in a text field. An example would be performing validation on a keypress. You can
* use this class to buffer the keypress events for a certain number of milliseconds, and
* perform only if they stop for that amount of time. Usage:</p><pre><code>
var task = new Ext.util.DelayedTask(function(){
alert(Ext.getDom('myInputField').value.length);
});
// Wait 500ms before calling our function. If the user presses another key
// during that 500ms, it will be cancelled and we'll wait another 500ms.
Ext.get('myInputField').on('keypress', function(){
task.{@link #delay}(500);
});
* </code></pre>
* <p>Note that we are using a DelayedTask here to illustrate a point. The configuration
* option <tt>buffer</tt> for {@link Ext.util.Observable#addListener addListener/on} will
* also setup a delayed task for you to buffer events.</p>
* @constructor The parameters to this constructor serve as defaults and are not required.
* @param {Function} fn (optional) The default function to call.
* @param {Object} scope The default scope (The <code><b>this</b></code> reference) in which the
* function is called. If not specified, <code>this</code> will refer to the browser window.
* @param {Array} args (optional) The default Array of arguments.
*/
Ext.util.DelayedTask = function(fn, scope, args){
var me = this,
id,
call = function(){
clearInterval(id);
id = null;
fn.apply(scope, args || []);
};
/**
* Cancels any pending timeout and queues a new one
* @param {Number} delay The milliseconds to delay
* @param {Function} newFn (optional) Overrides function passed to constructor
* @param {Object} newScope (optional) Overrides scope passed to constructor. Remember that if no scope
* is specified, <code>this</code> will refer to the browser window.
* @param {Array} newArgs (optional) Overrides args passed to constructor
*/
me.delay = function(delay, newFn, newScope, newArgs){
me.cancel();
fn = newFn || fn;
scope = newScope || scope;
args = newArgs || args;
id = setInterval(call, delay);
};
/**
* Cancel the last queued timeout
*/
me.cancel = function(){
if(id){
clearInterval(id);
id = null;
}
};
};

View File

@@ -1,190 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.util.JSON
* Modified version of Douglas Crockford"s json.js that doesn"t
* mess with the Object prototype
* http://www.json.org/js.html
* @singleton
*/
Ext.util.JSON = new (function(){
var useHasOwn = !!{}.hasOwnProperty,
isNative = function() {
var useNative = null;
return function() {
if (useNative === null) {
useNative = Ext.USE_NATIVE_JSON && window.JSON && JSON.toString() == '[object JSON]';
}
return useNative;
};
}(),
pad = function(n) {
return n < 10 ? "0" + n : n;
},
doDecode = function(json){
return eval("(" + json + ")");
},
doEncode = function(o){
if(!Ext.isDefined(o) || o === null){
return "null";
}else if(Ext.isArray(o)){
return encodeArray(o);
}else if(Ext.isDate(o)){
return Ext.util.JSON.encodeDate(o);
}else if(Ext.isString(o)){
return encodeString(o);
}else if(typeof o == "number"){
//don't use isNumber here, since finite checks happen inside isNumber
return isFinite(o) ? String(o) : "null";
}else if(Ext.isBoolean(o)){
return String(o);
}else {
var a = ["{"], b, i, v;
for (i in o) {
// don't encode DOM objects
if(!o.getElementsByTagName){
if(!useHasOwn || o.hasOwnProperty(i)) {
v = o[i];
switch (typeof v) {
case "undefined":
case "function":
case "unknown":
break;
default:
if(b){
a.push(',');
}
a.push(doEncode(i), ":",
v === null ? "null" : doEncode(v));
b = true;
}
}
}
}
a.push("}");
return a.join("");
}
},
m = {
"\b": '\\b',
"\t": '\\t',
"\n": '\\n',
"\f": '\\f',
"\r": '\\r',
'"' : '\\"',
"\\": '\\\\'
},
encodeString = function(s){
if (/["\\\x00-\x1f]/.test(s)) {
return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if(c){
return c;
}
c = b.charCodeAt();
return "\\u00" +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
}) + '"';
}
return '"' + s + '"';
},
encodeArray = function(o){
var a = ["["], b, i, l = o.length, v;
for (i = 0; i < l; i += 1) {
v = o[i];
switch (typeof v) {
case "undefined":
case "function":
case "unknown":
break;
default:
if (b) {
a.push(',');
}
a.push(v === null ? "null" : Ext.util.JSON.encode(v));
b = true;
}
}
a.push("]");
return a.join("");
};
/**
* <p>Encodes a Date. This returns the actual string which is inserted into the JSON string as the literal expression.
* <b>The returned value includes enclosing double quotation marks.</b></p>
* <p>The default return format is "yyyy-mm-ddThh:mm:ss".</p>
* <p>To override this:</p><pre><code>
Ext.util.JSON.encodeDate = function(d) {
return d.format('"Y-m-d"');
};
</code></pre>
* @param {Date} d The Date to encode
* @return {String} The string literal to use in a JSON string.
*/
this.encodeDate = function(o){
return '"' + o.getFullYear() + "-" +
pad(o.getMonth() + 1) + "-" +
pad(o.getDate()) + "T" +
pad(o.getHours()) + ":" +
pad(o.getMinutes()) + ":" +
pad(o.getSeconds()) + '"';
};
/**
* Encodes an Object, Array or other value
* @param {Mixed} o The variable to encode
* @return {String} The JSON string
*/
this.encode = function() {
var ec;
return function(o) {
if (!ec) {
// setup encoding function on first access
ec = isNative() ? JSON.stringify : doEncode;
}
return ec(o);
};
}();
/**
* Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError unless the safe option is set.
* @param {String} json The JSON string
* @return {Object} The resulting object
*/
this.decode = function() {
var dc;
return function(json) {
if (!dc) {
// setup decoding function on first access
dc = isNative() ? JSON.parse : doDecode;
}
return dc(json);
};
}();
})();
/**
* Shorthand for {@link Ext.util.JSON#encode}
* @param {Mixed} o The variable to encode
* @return {String} The JSON string
* @member Ext
* @method encode
*/
Ext.encode = Ext.util.JSON.encode;
/**
* Shorthand for {@link Ext.util.JSON#decode}
* @param {String} json The JSON string
* @param {Boolean} safe (optional) Whether to return null or throw an exception if the JSON is invalid.
* @return {Object} The resulting object
* @member Ext
* @method decode
*/
Ext.decode = Ext.util.JSON.decode;

View File

@@ -1,528 +0,0 @@
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
(function(){
var EXTUTIL = Ext.util,
EACH = Ext.each,
TRUE = true,
FALSE = false;
/**
* @class Ext.util.Observable
* Base class that provides a common interface for publishing events. Subclasses are expected to
* to have a property "events" with all the events defined, and, optionally, a property "listeners"
* with configured listeners defined.<br>
* For example:
* <pre><code>
Employee = Ext.extend(Ext.util.Observable, {
constructor: function(config){
this.name = config.name;
this.addEvents({
"fired" : true,
"quit" : true
});
// Copy configured listeners into *this* object so that the base class&#39;s
// constructor will add them.
this.listeners = config.listeners;
// Call our superclass constructor to complete construction process.
Employee.superclass.constructor.call(this, config)
}
});
</code></pre>
* This could then be used like this:<pre><code>
var newEmployee = new Employee({
name: employeeName,
listeners: {
quit: function() {
// By default, "this" will be the object that fired the event.
alert(this.name + " has quit!");
}
}
});
</code></pre>
*/
EXTUTIL.Observable = function(){
/**
* @cfg {Object} listeners (optional) <p>A config object containing one or more event handlers to be added to this
* object during initialization. This should be a valid listeners config object as specified in the
* {@link #addListener} example for attaching multiple handlers at once.</p>
* <br><p><b><u>DOM events from ExtJs {@link Ext.Component Components}</u></b></p>
* <br><p>While <i>some</i> ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
* is usually only done when extra value can be added. For example the {@link Ext.DataView DataView}'s
* <b><code>{@link Ext.DataView#click click}</code></b> event passing the node clicked on. To access DOM
* events directly from a Component's HTMLElement, listeners must be added to the <i>{@link Ext.Component#getEl Element}</i> after the Component
* has been rendered. A plugin can simplify this step:<pre><code>
// Plugin is configured with a listeners config object.
// The Component is appended to the argument list of all handler functions.
Ext.DomObserver = Ext.extend(Object, {
constructor: function(config) {
this.listeners = config.listeners ? config.listeners : config;
},
// Component passes itself into plugin&#39;s init method
init: function(c) {
var p, l = this.listeners;
for (p in l) {
if (Ext.isFunction(l[p])) {
l[p] = this.createHandler(l[p], c);
} else {
l[p].fn = this.createHandler(l[p].fn, c);
}
}
// Add the listeners to the Element immediately following the render call
c.render = c.render.{@link Function#createSequence createSequence}(function() {
var e = c.getEl();
if (e) {
e.on(l);
}
});
},
createHandler: function(fn, c) {
return function(e) {
fn.call(this, e, c);
};
}
});
var combo = new Ext.form.ComboBox({
// Collapse combo when its element is clicked on
plugins: [ new Ext.DomObserver({
click: function(evt, comp) {
comp.collapse();
}
})],
store: myStore,
typeAhead: true,
mode: 'local',
triggerAction: 'all'
});
* </code></pre></p>
*/
var me = this, e = me.events;
if(me.listeners){
me.on(me.listeners);
delete me.listeners;
}
me.events = e || {};
};
EXTUTIL.Observable.prototype = {
// private
filterOptRe : /^(?:scope|delay|buffer|single)$/,
/**
* <p>Fires the specified event with the passed parameters (minus the event name).</p>
* <p>An event may be set to bubble up an Observable parent hierarchy (See {@link Ext.Component#getBubbleTarget})
* by calling {@link #enableBubble}.</p>
* @param {String} eventName The name of the event to fire.
* @param {Object...} args Variable number of parameters are passed to handlers.
* @return {Boolean} returns false if any of the handlers return false otherwise it returns true.
*/
fireEvent : function(){
var a = Array.prototype.slice.call(arguments, 0),
ename = a[0].toLowerCase(),
me = this,
ret = TRUE,
ce = me.events[ename],
cc,
q,
c;
if (me.eventsSuspended === TRUE) {
if (q = me.eventQueue) {
q.push(a);
}
}
else if(typeof ce == 'object') {
if (ce.bubble){
if(ce.fire.apply(ce, a.slice(1)) === FALSE) {
return FALSE;
}
c = me.getBubbleTarget && me.getBubbleTarget();
if(c && c.enableBubble) {
cc = c.events[ename];
if(!cc || typeof cc != 'object' || !cc.bubble) {
c.enableBubble(ename);
}
return c.fireEvent.apply(c, a);
}
}
else {
a.shift();
ret = ce.fire.apply(ce, a);
}
}
return ret;
},
/**
* Appends an event handler to this object.
* @param {String} eventName The name of the event to listen for.
* @param {Function} handler The method the event invokes.
* @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
* <b>If omitted, defaults to the object which fired the event.</b>
* @param {Object} options (optional) An object containing handler configuration.
* properties. This may contain any of the following properties:<ul>
* <li><b>scope</b> : Object<div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
* <b>If omitted, defaults to the object which fired the event.</b></div></li>
* <li><b>delay</b> : Number<div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
* <li><b>single</b> : Boolean<div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
* <li><b>buffer</b> : Number<div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
* by the specified number of milliseconds. If the event fires again within that time, the original
* handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
* <li><b>target</b> : Observable<div class="sub-desc">Only call the handler if the event was fired on the target Observable, <i>not</i>
* if the event was bubbled up from a child Observable.</div></li>
* </ul><br>
* <p>
* <b>Combining Options</b><br>
* Using the options argument, it is possible to combine different types of listeners:<br>
* <br>
* A delayed, one-time listener.
* <pre><code>
myDataView.on('click', this.onClick, this, {
single: true,
delay: 100
});</code></pre>
* <p>
* <b>Attaching multiple handlers in 1 call</b><br>
* The method also allows for a single argument to be passed which is a config object containing properties
* which specify multiple handlers.
* <p>
* <pre><code>
myGridPanel.on({
'click' : {
fn: this.onClick,
scope: this,
delay: 100
},
'mouseover' : {
fn: this.onMouseOver,
scope: this
},
'mouseout' : {
fn: this.onMouseOut,
scope: this
}
});</code></pre>
* <p>
* Or a shorthand syntax:<br>
* <pre><code>
myGridPanel.on({
'click' : this.onClick,
'mouseover' : this.onMouseOver,
'mouseout' : this.onMouseOut,
scope: this
});</code></pre>
*/
addListener : function(eventName, fn, scope, o){
var me = this,
e,
oe,
ce;
if (typeof eventName == 'object') {
o = eventName;
for (e in o) {
oe = o[e];
if (!me.filterOptRe.test(e)) {
me.addListener(e, oe.fn || oe, oe.scope || o.scope, oe.fn ? oe : o);
}
}
} else {
eventName = eventName.toLowerCase();
ce = me.events[eventName] || TRUE;
if (typeof ce == 'boolean') {
me.events[eventName] = ce = new EXTUTIL.Event(me, eventName);
}
ce.addListener(fn, scope, typeof o == 'object' ? o : {});
}
},
/**
* Removes an event handler.
* @param {String} eventName The type of event the handler was associated with.
* @param {Function} handler The handler to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
* @param {Object} scope (optional) The scope originally specified for the handler.
*/
removeListener : function(eventName, fn, scope){
var ce = this.events[eventName.toLowerCase()];
if (typeof ce == 'object') {
ce.removeListener(fn, scope);
}
},
/**
* Removes all listeners for this object
*/
purgeListeners : function(){
var events = this.events,
evt,
key;
for(key in events){
evt = events[key];
if(typeof evt == 'object'){
evt.clearListeners();
}
}
},
/**
* Adds the specified events to the list of events which this Observable may fire.
* @param {Object|String} o Either an object with event names as properties with a value of <code>true</code>
* or the first event name string if multiple event names are being passed as separate parameters.
* @param {string} Optional. Event name if multiple event names are being passed as separate parameters.
* Usage:<pre><code>
this.addEvents('storeloaded', 'storecleared');
</code></pre>
*/
addEvents : function(o){
var me = this;
me.events = me.events || {};
if (typeof o == 'string') {
var a = arguments,
i = a.length;
while(i--) {
me.events[a[i]] = me.events[a[i]] || TRUE;
}
} else {
Ext.applyIf(me.events, o);
}
},
/**
* Checks to see if this object has any listeners for a specified event
* @param {String} eventName The name of the event to check for
* @return {Boolean} True if the event is being listened for, else false
*/
hasListener : function(eventName){
var e = this.events[eventName.toLowerCase()];
return typeof e == 'object' && e.listeners.length > 0;
},
/**
* Suspend the firing of all events. (see {@link #resumeEvents})
* @param {Boolean} queueSuspended Pass as true to queue up suspended events to be fired
* after the {@link #resumeEvents} call instead of discarding all suspended events;
*/
suspendEvents : function(queueSuspended){
this.eventsSuspended = TRUE;
if(queueSuspended && !this.eventQueue){
this.eventQueue = [];
}
},
/**
* Resume firing events. (see {@link #suspendEvents})
* If events were suspended using the <tt><b>queueSuspended</b></tt> parameter, then all
* events fired during event suspension will be sent to any listeners now.
*/
resumeEvents : function(){
var me = this,
queued = me.eventQueue || [];
me.eventsSuspended = FALSE;
delete me.eventQueue;
EACH(queued, function(e) {
me.fireEvent.apply(me, e);
});
}
};
var OBSERVABLE = EXTUTIL.Observable.prototype;
/**
* Appends an event handler to this object (shorthand for {@link #addListener}.)
* @param {String} eventName The type of event to listen for
* @param {Function} handler The method the event invokes
* @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
* <b>If omitted, defaults to the object which fired the event.</b>
* @param {Object} options (optional) An object containing handler configuration.
* @method
*/
OBSERVABLE.on = OBSERVABLE.addListener;
/**
* Removes an event handler (shorthand for {@link #removeListener}.)
* @param {String} eventName The type of event the handler was associated with.
* @param {Function} handler The handler to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
* @param {Object} scope (optional) The scope originally specified for the handler.
* @method
*/
OBSERVABLE.un = OBSERVABLE.removeListener;
/**
* Removes <b>all</b> added captures from the Observable.
* @param {Observable} o The Observable to release
* @static
*/
EXTUTIL.Observable.releaseCapture = function(o){
o.fireEvent = OBSERVABLE.fireEvent;
};
function createTargeted(h, o, scope){
return function(){
if(o.target == arguments[0]){
h.apply(scope, Array.prototype.slice.call(arguments, 0));
}
};
};
function createBuffered(h, o, l, scope){
l.task = new EXTUTIL.DelayedTask();
return function(){
l.task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
};
};
function createSingle(h, e, fn, scope){
return function(){
e.removeListener(fn, scope);
return h.apply(scope, arguments);
};
};
function createDelayed(h, o, l, scope){
return function(){
var task = new EXTUTIL.DelayedTask(),
args = Array.prototype.slice.call(arguments, 0);
if(!l.tasks) {
l.tasks = [];
}
l.tasks.push(task);
task.delay(o.delay || 10, function(){
l.tasks.remove(task);
h.apply(scope, args);
}, scope);
};
};
EXTUTIL.Event = function(obj, name){
this.name = name;
this.obj = obj;
this.listeners = [];
};
EXTUTIL.Event.prototype = {
addListener : function(fn, scope, options){
var me = this,
l;
scope = scope || me.obj;
if(!me.isListening(fn, scope)){
l = me.createListener(fn, scope, options);
if(me.firing){ // if we are currently firing this event, don't disturb the listener loop
me.listeners = me.listeners.slice(0);
}
me.listeners.push(l);
}
},
createListener: function(fn, scope, o){
o = o || {};
scope = scope || this.obj;
var l = {
fn: fn,
scope: scope,
options: o
}, h = fn;
if(o.target){
h = createTargeted(h, o, scope);
}
if(o.delay){
h = createDelayed(h, o, l, scope);
}
if(o.single){
h = createSingle(h, this, fn, scope);
}
if(o.buffer){
h = createBuffered(h, o, l, scope);
}
l.fireFn = h;
return l;
},
findListener : function(fn, scope){
var list = this.listeners,
i = list.length,
l;
scope = scope || this.obj;
while(i--){
l = list[i];
if(l){
if(l.fn == fn && l.scope == scope){
return i;
}
}
}
return -1;
},
isListening : function(fn, scope){
return this.findListener(fn, scope) != -1;
},
removeListener : function(fn, scope){
var index,
l,
k,
me = this,
ret = FALSE;
if((index = me.findListener(fn, scope)) != -1){
if (me.firing) {
me.listeners = me.listeners.slice(0);
}
l = me.listeners[index];
if(l.task) {
l.task.cancel();
delete l.task;
}
k = l.tasks && l.tasks.length;
if(k) {
while(k--) {
l.tasks[k].cancel();
}
delete l.tasks;
}
me.listeners.splice(index, 1);
ret = TRUE;
}
return ret;
},
// Iterate to stop any buffered/delayed events
clearListeners : function(){
var me = this,
l = me.listeners,
i = l.length;
while(i--) {
me.removeListener(l[i].fn, l[i].scope);
}
},
fire : function(){
var me = this,
listeners = me.listeners,
len = listeners.length,
i = 0,
l;
if(len > 0){
me.firing = TRUE;
var args = Array.prototype.slice.call(arguments, 0);
for (; i < len; i++) {
l = listeners[i];
if(l && l.fireFn.apply(l.scope || me.obj || window, args) === FALSE) {
return (me.firing = FALSE);
}
}
}
me.firing = FALSE;
return TRUE;
}
};
})();

Some files were not shown because too many files have changed in this diff Show More