code stringlengths 1 2.08M | language stringclasses 1 value |
|---|---|
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
Array.prototype.insertFrom = function(from, to){
to = Math.max(0, to);
from = Math.min( Math.max(0, from), this.length-1 );
var el = this[from];
var old = this.without(el);
var newA = old.slice(0, to);
newA.push(el);
if(old.length > to ){
newA = newA.concat(old.slice(to))
};
return newA;
}
if(!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Plugins.ArrangementLight = Clazz.extend({
facade: undefined,
construct: function(facade) {
this.facade = facade;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_ARRANGEMENTLIGHT_TOP, this.setZLevel.bind(this, this.setToTop) );
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_ARRANGEMENTLIGHT_BACK, this.setZLevel.bind(this, this.setToBack) );
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_ARRANGEMENTLIGHT_FORWARD, this.setZLevel.bind(this, this.setForward) );
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_ARRANGEMENTLIGHT_BACKWARD, this.setZLevel.bind(this, this.setBackward) );
},
setZLevel:function(callback, event){
//Command-Pattern for dragging one docker
var zLevelCommand = ORYX.Core.Command.extend({
construct: function(callback, elements, facade){
this.callback = callback;
this.elements = elements;
// For redo, the previous elements get stored
this.elAndIndex = elements.map(function(el){ return {el:el, previous:el.parent.children[el.parent.children.indexOf(el)-1]} })
this.facade = facade;
},
execute: function(){
// Call the defined z-order callback with the elements
this.callback( this.elements )
},
rollback: function(){
// Sort all elements on the index of there containment
var sortedEl = this.elAndIndex.sortBy( function( el ) {
var value = el.el;
var t = $A(value.node.parentNode.childNodes);
return t.indexOf(value.node);
});
// Every element get setted back bevor the old previous element
for(var i=0; i<sortedEl.length; i++){
var el = sortedEl[i].el;
var p = el.parent;
var oldIndex = p.children.indexOf(el);
var newIndex = p.children.indexOf(sortedEl[i].previous);
newIndex = newIndex || 0
p.children = p.children.insertFrom(oldIndex, newIndex)
el.node.parentNode.insertBefore(el.node, el.node.parentNode.childNodes[newIndex+1]);
}
}
});
// Instanziate the dockCommand
var command = new zLevelCommand(callback, [event.shape], this.facade);
command.execute();
},
setToTop: function(elements) {
// Sortieren des Arrays nach dem Index des SVGKnotens im Bezug auf dem Elternknoten.
var tmpElem = elements.sortBy( function(value, index) {
var t = $A(value.node.parentNode.childNodes);
return t.indexOf(value.node);
});
// Sortiertes Array wird nach oben verschoben.
tmpElem.each( function(value) {
var p = value.parent
p.children = p.children.without( value )
p.children.push( value );
value.node.parentNode.appendChild(value.node);
});
},
setToBack: function(elements) {
// Sortieren des Arrays nach dem Index des SVGKnotens im Bezug auf dem Elternknoten.
var tmpElem = elements.sortBy( function(value, index) {
var t = $A(value.node.parentNode.childNodes);
return t.indexOf(value.node);
});
tmpElem = tmpElem.reverse();
// Sortiertes Array wird nach unten verschoben.
tmpElem.each( function(value) {
var p = value.parent
p.children = p.children.without( value )
p.children.unshift( value );
value.node.parentNode.insertBefore(value.node, value.node.parentNode.firstChild);
});
},
setBackward: function(elements) {
// Sortieren des Arrays nach dem Index des SVGKnotens im Bezug auf dem Elternknoten.
var tmpElem = elements.sortBy( function(value, index) {
var t = $A(value.node.parentNode.childNodes);
return t.indexOf(value.node);
});
// Reverse the elements
tmpElem = tmpElem.reverse();
// Delete all Nodes who are the next Node in the nodes-Array
var compactElem = tmpElem.findAll(function(el) {return !tmpElem.some(function(checkedEl){ return checkedEl.node == el.node.previousSibling})});
// Sortiertes Array wird nach eine Ebene nach oben verschoben.
compactElem.each( function(el) {
if(el.node.previousSibling === null) { return; }
var p = el.parent;
var index = p.children.indexOf(el);
p.children = p.children.insertFrom(index, index-1)
el.node.parentNode.insertBefore(el.node, el.node.previousSibling);
});
},
setForward: function(elements) {
// Sortieren des Arrays nach dem Index des SVGKnotens im Bezug auf dem Elternknoten.
var tmpElem = elements.sortBy( function(value, index) {
var t = $A(value.node.parentNode.childNodes);
return t.indexOf(value.node);
});
// Delete all Nodes who are the next Node in the nodes-Array
var compactElem = tmpElem.findAll(function(el) {return !tmpElem.some(function(checkedEl){ return checkedEl.node == el.node.nextSibling})});
// Sortiertes Array wird eine Ebene nach unten verschoben.
compactElem.each( function(el) {
var nextNode = el.node.nextSibling
if(nextNode === null) { return; }
var index = el.parent.children.indexOf(el);
var p = el.parent;
p.children = p.children.insertFrom(index, index+1)
el.node.parentNode.insertBefore(nextNode, el.node);
});
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
*
*
* HOW to USE the OVERLAY PLUGIN:
* You can use it via the event mechanism from the editor
* by using facade.raiseEvent( <option> )
*
* As an example please have a look in the overlayexample.js
*
* The option object should/have to have following attributes:
*
* Key Value-Type Description
* ================================================================
*
* type ORYX.CONFIG.EVENT_OVERLAY_SHOW | ORYX.CONFIG.EVENT_OVERLAY_HIDE This is the type of the event
* id <String> You have to use an unified id for later on hiding this overlay
* shapes <ORYX.Core.Shape[]> The Shapes where the attributes should be changed
* attributes <Object> An object with svg-style attributes as key-value pair
* node <SVGElement> An SVG-Element could be specified for adding this to the Shape
* nodePosition "N"|"NE"|"E"|"SE"|"S"|"SW"|"W"|"NW"|"START"|"END" The position for the SVG-Element relative to the
* specified Shape. "START" and "END" are just using for a Edges, then
* the relation is the start or ending Docker of this edge.
*
*
**/
if (!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Plugins.Overlay = Clazz.extend({
facade: undefined,
styleNode: undefined,
construct: function(facade){
this.facade = facade;
this.changes = [];
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_OVERLAY_SHOW, this.show.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_OVERLAY_HIDE, this.hide.bind(this));
this.styleNode = document.createElement('style')
this.styleNode.setAttributeNS(null, 'type', 'text/css')
document.getElementsByTagName('head')[0].appendChild( this.styleNode )
},
/**
* Show the overlay for specific nodes
* @param {Object} options
*
* String options.id - MUST - Define the id of the overlay (is needed for the hiding of this overlay)
* ORYX.Core.Shape[] options.shapes - MUST - Define the Shapes for the changes
* attr-name:value options.changes - Defines all the changes which should be shown
*
*
*/
show: function( options ){
// Checks if all arguments are available
if(!options ||
!options.shapes || !options.shapes instanceof Array ||
!options.id || !options.id instanceof String || options.id.length == 0) {
return;
}
//if( this.changes[options.id]){
// this.hide( options )
//}
// Checked if attributes are set
if( options.attributes ){
// FOR EACH - Shape
options.shapes.each(function(el){
// Checks if the node is a Shape
if( !el instanceof ORYX.Core.Shape){ return }
this.setAttributes( el.node , options.attributes )
}.bind(this));
}
var isSVG = true
try {
isSVG = options.node && options.node instanceof SVGElement;
} catch(e){}
// Checks if node is set and if this is a SVGElement
if ( options.node && isSVG) {
options["_temps"] = [];
// FOR EACH - Node
options.shapes.each(function(el, index){
// Checks if the node is a Shape
if( !el instanceof ORYX.Core.Shape){ return }
var _temp = {};
_temp.svg = options.dontCloneNode ? options.node : options.node.cloneNode( true );
// Append the svg node to the ORYX-Shape
this.facade.getCanvas().getSvgContainer().appendChild(_temp.svg);
if (el instanceof ORYX.Core.Edge && !options.nodePosition) {
options['nodePosition'] = "START";
}
// If the node position is set, it has to be transformed
if (options.nodePosition && !options.nodePositionAbsolute) {
var b = el.absoluteBounds();
var p = options.nodePosition.toUpperCase();
// Check the values of START and END
if( el instanceof ORYX.Core.Node && p == "START"){
p = "NW";
} else if(el instanceof ORYX.Core.Node && p == "END"){
p = "SE";
} else if(el instanceof ORYX.Core.Edge && p == "START"){
b = el.getDockers().first().bounds;
} else if(el instanceof ORYX.Core.Edge && p == "END"){
b = el.getDockers().last().bounds;
}
// Create a callback for changing the position
// depending on the position string
_temp.callback = function() { this.positionCallback(el, p, b, options.keepInsideVisibleArea, _temp); }.bind(this);
_temp.element = el;
_temp.callback();
b.registerCallback( _temp.callback );
}
// Show the ghostpoint
if(options.ghostPoint){
var point={x:0, y:0};
point=options.ghostPoint;
_temp.callback = function(){
var x = 0; var y = 0;
x = point.x -7;
y = point.y -7;
_temp.svg.setAttributeNS(null, "transform", "translate(" + x + ", " + y + ")")
}.bind(this)
_temp.element = el;
_temp.callback();
b.registerCallback( _temp.callback );
}
options._temps.push( _temp )
}.bind(this))
}
// Store the changes
if( !this.changes[options.id] ){
this.changes[options.id] = [];
}
this.changes[options.id].push( options );
},
/**
* Hide the overlay with the spefic id
* @param {Object} options
*/
hide: function( options ){
// Checks if all arguments are available
if(!options ||
!options.id || !options.id instanceof String || options.id.length == 0 ||
!this.changes[options.id]) {
return;
}
// Delete all added attributes
// FOR EACH - Shape
this.changes[options.id].each(function(option){
option.shapes.each(function(el, index){
// Checks if the node is a Shape
if( !el instanceof ORYX.Core.Shape){ return }
this.deleteAttributes( el.node )
}.bind(this));
if( option._temps ){
option._temps.each(function(tmp){
// Delete the added Node, if there is one
if( tmp.svg && tmp.svg.parentNode ){
tmp.svg.parentNode.removeChild( tmp.svg )
}
// If
if( tmp.callback && tmp.element){
// It has to be unregistered from the edge
tmp.element.bounds.unregisterCallback( tmp.callback )
}
}.bind(this));
}
}.bind(this));
this.changes[options.id] = null;
},
/**
* Set the given css attributes to that node
* @param {HTMLElement} node
* @param {Object} attributes
*/
setAttributes: function( node, attributes ) {
// Get all the childs from ME
var childs = this.getAllChilds( node.firstChild.firstChild )
var ids = []
// Add all Attributes which have relation to another node in this document and concate the pure id out of it
// This is for example important for the markers of a edge
childs.each(function(e){ ids.push( $A(e.attributes).findAll(function(attr){ return attr.nodeValue.startsWith('url(#')}) )})
ids = ids.flatten().compact();
ids = ids.collect(function(s){return s.nodeValue}).uniq();
ids = ids.collect(function(s){return s.slice(5, s.length-1)})
// Add the node ID to the id
ids.unshift( node.id + ' .me')
var attr = $H(attributes);
var attrValue = attr.toJSON().gsub(',', ';').gsub('"', '');
var attrMarkerValue = attributes.stroke ? attrValue.slice(0, attrValue.length-1) + "; fill:" + attributes.stroke + ";}" : attrValue;
var attrTextValue;
if( attributes.fill ){
var copyAttr = Object.clone(attributes);
copyAttr.fill = "black";
attrTextValue = $H(copyAttr).toJSON().gsub(',', ';').gsub('"', '');
}
// Create the CSS-Tags Style out of the ids and the attributes
csstags = ids.collect(function(s, i){return "#" + s + " * " + (!i? attrValue : attrMarkerValue) + "" + (attrTextValue ? " #" + s + " text * " + attrTextValue : "") })
// Join all the tags
var s = csstags.join(" ") + "\n"
// And add to the end of the style tag
this.styleNode.appendChild(document.createTextNode(s));
},
/**
* Deletes all attributes which are
* added in a special style sheet for that node
* @param {HTMLElement} node
*/
deleteAttributes: function( node ) {
// Get all children which contains the node id
var delEl = $A(this.styleNode.childNodes)
.findAll(function(e){ return e.textContent.include( '#' + node.id ) });
// Remove all of them
delEl.each(function(el){
el.parentNode.removeChild(el);
});
},
getAllChilds: function( node ){
var childs = $A(node.childNodes)
$A(node.childNodes).each(function( e ){
childs.push( this.getAllChilds( e ) )
}.bind(this))
return childs.flatten();
},
isInsideVisibleArea: function(x, y, width, height) {
// get the div that is responsible for scrolling
var centerDiv = document.getElementById("oryx_center_region").children[0].children[0];
var viewportLeft = centerDiv.scrollLeft / this.facade.getCanvas().zoomLevel;
var viewportTop = centerDiv.scrollTop / this.facade.getCanvas().zoomLevel;
// yeah I'm fully aware of how much I suck: 20px is the width of the scrollbars
var viewportWidth = (centerDiv.offsetWidth - 20) / this.facade.getCanvas().zoomLevel;
var viewportHeight = (centerDiv.offsetHeight - 20) / this.facade.getCanvas().zoomLevel;
var insideX = (x > viewportLeft && x + width < viewportLeft + viewportWidth);
var insideY = (y > viewportTop && y + height < viewportTop + viewportHeight);
return insideX && insideY;
},
positionCallback: function(element, position, bounds, keepVisible, temp) {
var x, y;
try {
var overlayWidth = temp.svg.getBBox().width;
var overlayHeight = temp.svg.getBBox().height;
} catch(e) {
//workaround for SVG bug in Firefox
var xdadsd = 42;
}
var curPos, curPosIndex;
var positionPreference = ["N", "NW", "W", "NE", "SW", "SE", "INSIDE_NW", "INSIDE_W"];
var startAndEnd = { x: bounds.width() / 2, y: bounds.height() / 2 };
var positions = {
"NW": { x: -overlayWidth, y: -overlayHeight * 1.5 },
"N": { x: bounds.width() / 2 - overlayWidth / 2, y: -overlayHeight * 1.5 },
"NE": { x: bounds.width(), y: -overlayHeight * 1.5 },
"E": { x: bounds.width(), y: bounds.height() / 2 - overlayHeight / 2 },
"SE": { x: bounds.width(), y: bounds.height() },
"S": { x: bounds.width() / 2 - overlayWidth / 2, y: bounds.height() },
"SW": { x: -overlayWidth - 20, y: bounds.height() },
"W": { x: -overlayWidth - 20, y: bounds.height() / 2 - overlayHeight / 2 },
"INSIDE_NW": { x: bounds.width() - overlayWidth - 20, y: 0 },
"INSIDE_W": { x: 20, y: bounds.height() / 2 - overlayHeight / 2 },
"START": startAndEnd,
"END": startAndEnd
}
// get position and (if necessary) make sure the overlay is inside the visible part of the screen
curPos = position;
curPosIndex = 0;
do {
x = positions[curPos].x + bounds.upperLeft().x;
y = positions[curPos].y + bounds.upperLeft().y;
curPos = positionPreference[curPosIndex++];
if (typeof curPos === "undefined") {
break;
}
} while (keepVisible && !this.isInsideVisibleArea(x, y, overlayWidth, overlayHeight));
temp.svg.setAttributeNS(null, "transform", "translate(" + x + ", " + y + ")");
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if (!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Plugins.Paint = ORYX.Plugins.AbstractPlugin.extend({
construct: function construct(facade) {
arguments.callee.$.construct.apply(this, arguments);
this.facade.offer({
name: ORYX.I18N.Paint.paint,
description: ORYX.I18N.Paint.paintDesc,
iconCls: 'pw-toolbar-button pw-toolbar-paint',
keyCodes: [],
functionality: this._togglePaint.bind(this),
group: ORYX.I18N.Paint.group,
isEnabled: function() { return true; },
toggle: true,
index: 0,
visibleInViewMode: true
});
this.facade.offer({
keyCodes: [{
keyCode: 46, // delete key
keyAction: ORYX.CONFIG.KEY_ACTION_DOWN
}, {
metaKeys: [ORYX.CONFIG.META_KEY_META_CTRL],
keyCode: 8, // backspace key
keyAction: ORYX.CONFIG.KEY_ACTION_DOWN
}],
functionality: this._onRemoveKey.bind(this)
});
this.users = [];
this.editMode = false;
this.showCanvas = false;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_PAINT_NEWSHAPE, this._onNewShape.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_PAINT_REMOVESHAPE, this._onRemoveShape.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_CANVAS_RESIZED, this._onCanvasResized.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_CANVAS_RESIZE_SHAPES_MOVED, this._onCanvasResizedShapesMoved.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_CANVAS_ZOOMED, this._onCanvasZoomed.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_FARBRAUSCH_NEW_INFOS, this._updateFarbrauschInfos.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MODE_CHANGED, this._onModeChanged.bind(this));
},
onLoaded: function onLoaded() {
this.paintCanvas = this._createCanvas();
this._loadBrush(this.paintCanvas);
this.toolbar = this._createToolbar();
},
_onModeChanged: function _onModeChanged(event) {
this.editMode = event.mode.isEditMode();
if (event.mode.isPaintMode()) {
this.paintCanvas.show();
this._alignCanvasWithOryxCanvas();
} else {
this.paintCanvas.hide();
}
if (event.mode.isEditMode() && event.mode.isPaintMode()) {
if (typeof this.toolbar !== "undefined") {
this.toolbar.show();
}
this.paintCanvas.activate();
} else {
if (typeof this.toolbar !== "undefined") {
this.toolbar.hide();
}
this.paintCanvas.deactivate();
}
},
_activateTool: function _activateTool(toolClass) {
this.paintCanvas.setTool(toolClass);
},
_updateFarbrauschInfos: function _updateFarbrauschInfos(event) {
this.users = event.users;
this.paintCanvas.updateColor();
this.paintCanvas.redraw();
},
_onCanvasZoomed: function _onCanvasZoomed(event) {
if (typeof this.paintCanvas === 'undefined') {
return;
}
this.paintCanvas.scale(event.zoomLevel);
this._alignCanvasWithOryxCanvas();
},
_createCanvas: function _createCanvas() {
var canvas = this.facade.getCanvas();
var options = {
canvasId: "freehand-paint",
width: canvas.bounds.width(),
height: canvas.bounds.height(),
shapeDrawnCallback: this._onShapeExistenceCommand.bind(this, "Paint.DrawCommand"),
shapeDeletedCallback: this._onShapeExistenceCommand.bind(this, "Paint.RemoveCommand"),
getUsersCallback: function getUsers() { return this.users; }.bind(this),
getUserIdCallback: function getUserId() { return this.facade.getUserId(); }.bind(this),
isInEditModeCallback: function isInEditModeCallback() { return this.editMode; }.bind(this)
};
var paintCanvas = new ORYX.Plugins.Paint.PaintCanvas(options);
var canvasContainer = canvas.rootNode.parentNode;
canvasContainer.appendChild(paintCanvas.getDomElement());
return paintCanvas;
},
_loadBrush : function _loadBrush(paintCanvas) {
var img = new Image();
img.onload = paintCanvas.setBrush.bind(paintCanvas, img, 2);
img.src = this._getBasePath() + "/../oryx/editor/images/paint/brush.png";
},
_createToolbar: function _createToolbar() {
var basePath = this._getBasePath();
var toolbar = new ORYX.Plugins.Paint.Toolbar();
toolbar.addButton(basePath + "/../oryx/editor/images/paint/line.png",
this._activateTool.bind(this, ORYX.Plugins.Paint.PaintCanvas.LineTool));
toolbar.addButton(basePath + "/../oryx/editor/images/paint/arrow.png",
this._activateTool.bind(this, ORYX.Plugins.Paint.PaintCanvas.ArrowTool));
toolbar.addButton(basePath + "/../oryx/editor/images/paint/box.png",
this._activateTool.bind(this, ORYX.Plugins.Paint.PaintCanvas.BoxTool));
toolbar.addButton(basePath + "/../oryx/editor/images/paint/ellipse.png",
this._activateTool.bind(this, ORYX.Plugins.Paint.PaintCanvas.EllipseTool));
toolbar.hide();
return toolbar;
},
_getBasePath: function _getBasePath() {
var lastSlash = window.location.href.lastIndexOf("/");
return window.location.href.substring(0, lastSlash);
},
_togglePaint: function _togglePaint() {
this.showCanvas = !this.showCanvas;
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_PAINT_CANVAS_TOGGLED,
paintActive: this.showCanvas
});
},
_onNewShape: function _onNewShape(event) {
this.paintCanvas.addShapeAndDraw(event.shape);
},
_onRemoveShape: function _onRemoveShape(event) {
if (this.editMode) {
this.paintCanvas.removeShape(event.shapeId);
}
},
_onShapeExistenceCommand: function _onShapeExistenceCommand(cmdName, shape) {
var cmd = new ORYX.Core.Commands[cmdName](shape, this.facade);
this.facade.executeCommands([cmd]);
},
_onCanvasResized: function _onCanvasResized(event) {
this.paintCanvas.resize(event.bounds.width(), event.bounds.height());
this._alignCanvasWithOryxCanvas();
},
_onCanvasResizedShapesMoved: function _onCanvasResizedShapesMoved(event) {
this.paintCanvas.moveShapes(event.offsetX, event.offsetY);
},
_onRemoveKeyPressed: function _onRemoveKeyPressed(event) {
if (this.editMode) {
this.paintCanvas.deleteCurrentShape();
}
},
_alignCanvasWithOryxCanvas: function _alignCanvasWithOryxCanvas() {
var canvas = this.facade.getCanvas().rootNode.parentNode;
var offset = jQuery(canvas).offset();
this.paintCanvas.setOffset(offset);
},
_onRemoveKey: function _onRemoveKey(event) {
this.paintCanvas.removeShapesUnderCursor();
}
});
ORYX.Plugins.Paint.Toolbar = Clazz.extend({
construct: function construct() {
var canvasContainer = $$(".ORYX_Editor")[0].parentNode;
this.toolsList = document.createElement('div');
this.toolsList.id = 'paint-toolbar';
canvasContainer.appendChild(this.toolsList);
this.buttonsAdded = false;
},
show: function show() {
this.toolsList.show();
},
hide: function hide() {
this.toolsList.hide();
},
addButton: function addButton(image, callback) {
var button = this._createButton(image);
this.toolsList.appendChild(button);
var onClick = this._onButtonClicked.bind(this, button, callback);
jQuery(button).click(onClick);
// one button has to be pressed at all times,
// so if this is the first one, press it
if (!this.buttonsAdded) {
onClick();
this.buttonsAdded = true;
}
},
_createButton: function _createButton(image) {
var newElement = document.createElement('div');
newElement.className = 'paint-toolbar-button';
var stencilImage = document.createElement('div');
stencilImage.style.backgroundImage = 'url(' + image + ')';
newElement.appendChild(stencilImage);
return newElement;
},
_onButtonClicked: function _onButtonClicked(element, callback) {
jQuery(this.toolsList).children().removeClass("paint-toolbar-button-pressed");
jQuery(element).addClass("paint-toolbar-button-pressed");
callback();
}
});
ORYX.Plugins.Paint.CanvasWrapper = Clazz.extend({
construct: function construct(canvas) {
this.canvas = canvas;
this.context = canvas.getContext("2d");
this.scalingFactor = 1.0;
this.color = ORYX.CONFIG.FARBRAUSCH_DEFAULT_COLOR;
},
clear: function clear() {
this.canvas.width = this.canvas.width;
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
this.scale(this.scalingFactor);
},
resize: function resize(width, height) {
this.canvas.style.width = width + "px";
this.canvas.style.height = height + "px";
this.canvas.width = width;
this.canvas.height = height;
},
scale: function scale(factor) {
this.context.scale(factor, factor);
this.scalingFactor = factor;
},
setStyle: function setStyle(width, color) {
this.context.lineJoin = 'round';
this.context.lineWidth = width;
this.context.strokeStyle = color;
this._setColor(color);
},
setBrush: function setBrush(brushImage, dist) {
this.origBrush = brushImage;
this.brush = this._colorBrush(brushImage, this.color);
this.brushDist = dist;
},
drawLine: function drawLine(ax, ay, bx, by) {
(this.brush ? this._brushLine : this._simpleLine).apply(this, arguments);
},
drawEllipse: function drawLine(ax, ay, bx, by) {
(this.brush ? this._brushEllipse : this._simpleEllipse).apply(this, arguments);
},
drawArrow: function drawArrow(ax, ay, bx, by) {
this.drawLine.apply(this, arguments);
var angle = -Math.atan2(by - ay, bx - ax) + Math.PI / 2.0;
var tipLength = 20;
var tip1Angle = angle + 3/4 * Math.PI;
var tip1dx = Math.sin(tip1Angle) * tipLength;
var tip1dy = Math.cos(tip1Angle) * tipLength;
this.drawLine(bx, by, bx + tip1dx, by + tip1dy);
var tip2Angle = angle - 3/4 * Math.PI;
var tip2dx = Math.sin(tip2Angle) * tipLength;
var tip2dy = Math.cos(tip2Angle) * tipLength;
this.drawLine(bx, by, bx + tip2dx, by + tip2dy);
},
strokeRect: function strokeRect(x, y, width, height) {
this.drawLine(x, y, x + width, y);
this.drawLine(x, y + height, x + width, y + height);
this.drawLine(x, y, x, y + height);
this.drawLine(x + width, y, x + width, y + height);
},
_setColor: function _setColor(color) {
if (typeof this.origBrush !== "undefined") {
this.brush = this._colorBrush(this.origBrush, color);
}
this.color = color;
},
_simpleLine: function _simpleLine(ax, ay, bx, by) {
this.context.beginPath();
this.context.moveTo(ax, ay);
this.context.lineTo(bx, by);
this.context.stroke();
},
_brushLine: function _brushLine(ax, ay, bx, by) {
var makePoint = function(x, y) { return {x: x, y: y}; };
var totalDist = ORYX.Core.Math.getDistancePointToPoint(makePoint(ax, ay), makePoint(bx, by));
var steps = totalDist / this.brushDist;
var totalVec = makePoint(bx - ax, by - ay);
var divide = function(vec, by) { return {x: vec.x / by, y: vec.y / by}; };
var delta = divide(totalVec, steps);
for (var i = 0; i < steps; i++) {
this.context.drawImage(this.brush,
ax + i * delta.x - this.brush.width / 2,
ay + i * delta.y - this.brush.height / 2);
}
},
_simpleEllipse: function _simpleEllipse(x1, y1, x2, y2) {
// code by http://canvaspaint.org/blog/2006/12/ellipse/
var ell = this._getEllipseInRectParams.apply(this, arguments);
var KAPPA = 4 * ((Math.sqrt(2) -1) / 3);
this.context.beginPath();
this.context.moveTo(ell.cx, ell.cy - ell.ry);
this.context.bezierCurveTo(ell.cx + (KAPPA * ell.rx), ell.cy - ell.ry, ell.cx + ell.rx, ell.cy - (KAPPA * ell.ry), ell.cx + ell.rx, ell.cy);
this.context.bezierCurveTo(ell.cx + ell.rx, ell.cy + (KAPPA * ell.ry), ell.cx + (KAPPA * ell.rx), ell.cy + ell.ry, ell.cx, ell.cy + ell.ry);
this.context.bezierCurveTo(ell.cx - (KAPPA * ell.rx), ell.cy + ell.ry, ell.cx - ell.rx, ell.cy + (KAPPA * ell.ry), ell.cx - ell.rx, ell.cy);
this.context.bezierCurveTo(ell.cx - ell.rx, ell.cy - (KAPPA * ell.ry), ell.cx - (KAPPA * ell.rx), ell.cy - ell.ry, ell.cx, ell.cy - ell.ry);
this.context.stroke();
},
_brushEllipse: function _brushEllipse(x1, y1, x2, y2) {
var ell = this._getEllipseInRectParams.apply(this, arguments);
var delta = 2 * Math.PI / Math.max(ell.rx, ell.ry);
var points = [];
for (var t = 0; t < 2 * Math.PI; t += delta) {
points.push({
x: ell.cx + Math.cos(t) * ell.rx,
y: ell.cy + Math.sin(t) * ell.ry
});
}
var cur, next;
for (var i = 0; i < points.length - 1; i++) {
cur = points[i];
next = points[i + 1];
this._brushLine(cur.x, cur.y, next.x, next.y);
}
this._brushLine(points.last().x, points.last().y, points.first().x, points.first().y);
},
_getEllipseInRectParams: function _getEllipseInRectParams(x1, y1, x2, y2) {
var rx = (x2 - x1) / 2;
var ry = (y2 - y1) / 2;
return {
rx: rx,
ry: ry,
cx: x1 + rx,
cy: y1 + ry
};
},
_colorBrush: function _colorBrush(brush, color) {
var tempCanvas = this._createTempCanvas(brush.width, brush.height);
var context = tempCanvas.getContext("2d");
context.drawImage(brush, 0, 0);
this._recolorCanvas(context, color, brush.width, brush.height);
return tempCanvas;
},
_createTempCanvas: function _createTempCanvas(width, height) {
var tempCanvas = document.createElement("canvas");
tempCanvas.style.width = width + "px";
tempCanvas.style.height = height + "px";
tempCanvas.width = width;
tempCanvas.height = height;
return tempCanvas;
},
_recolorCanvas: function _recolorCanvas(context, color, width, height) {
var imgData = context.getImageData(0, 0, width, height);
var rgb = this._getRGB(color);
var data = imgData.data;
for (var i = 0; i < data.length; i += 4) {
data[i] = data[i] / 255 * rgb.r;
data[i+1] = data[i+1] / 255 * rgb.g;
data[i+2] = data[i+2] / 255 * rgb.b;
}
context.putImageData(imgData, 0, 0);
},
_getRGB: function _getRGB(hexColor) {
var hex = hexColor.substring(1, 7); // cut off leading #
return {
r: parseInt(hex.substring(0, 2), 16),
g: parseInt(hex.substring(2, 4), 16),
b: parseInt(hex.substring(4, 6), 16)
};
}
});
ORYX.Plugins.Paint.PaintCanvas = Clazz.extend({
construct: function construct(options) {
this.container = this._createCanvasContainer(options.canvasId, options.width, options.height);
var viewCanvas = this._createCanvas("view-canvas");
this.viewCanvas = new ORYX.Plugins.Paint.CanvasWrapper(viewCanvas);
this.viewCanvas.resize(options.width, options.height);
this.container.appendChild(viewCanvas);
var paintCanvas = this._createCanvas("paint-canvas");
this.paintCanvas = new ORYX.Plugins.Paint.CanvasWrapper(paintCanvas);
this.paintCanvas.resize(options.width, options.height);
this.container.appendChild(paintCanvas);
this.shapes = [];
this.shapeDrawnCallback = options.shapeDrawnCallback;
this.shapeDeletedCallback = options.shapeDeletedCallback;
this.getUsersCallback = options.getUsersCallback;
this.getUserIdCallback = options.getUserIdCallback;
this.isInEditModeCallback = options.isInEditModeCallback;
this.scalingFactor = 1.0;
this.width = options.width;
this.height = options.height;
this.mouseState = new ORYX.Plugins.Paint.PaintCanvas.MouseState(paintCanvas, {
onMouseDown: this._onMouseDown.bind(this),
onMouseUp: this._onMouseUp.bind(this),
onMouseMove: this._onMouseMove.bind(this)
});
},
activate: function activate() {
jQuery(this.container).addClass("paint-canvas-container-active");
},
deactivate: function deactivate() {
jQuery(this.container).removeClass("paint-canvas-container-active");
this.currentAction.mouseUp(this.mouseState.parameters.pos);
this.paintCanvas.clear();
},
setTool: function setTool(toolClass) {
var color = this._getColor(this.getUserIdCallback());
this.currentAction = new toolClass(this.getUserIdCallback.bind(this), color, this.paintCanvas, this._onShapeDone.bind(this));
},
setBrush: function setBrush(brushImage, dist) {
this.viewCanvas.setBrush(brushImage, dist);
this.paintCanvas.setBrush(brushImage, dist);
this._redrawShapes();
},
scale: function scale(factor) {
this._setDimensions(this.width * factor, this.height * factor, factor);
this._redrawShapes();
this.scalingFactor = factor;
},
setPosition: function setPosition(top, left) {
this.container.style.top = top + 'px';
this.container.style.left = left + 'px';
},
getDomElement: function getDomElement() {
return this.container;
},
setOffset: function setOffset(offset) {
jQuery(this.container).offset(offset);
},
addShapeAndDraw: function addShapeAndDraw(shape) {
this.shapes.push(shape);
this._drawShape(this.viewCanvas, shape);
},
removeShape: function removeShape(shapeId) {
this.shapes = this.shapes.reject(function(s) { return s.id === shapeId; });
this.redraw();
},
removeShapesUnderCursor: function removeShapesUnderCursor() {
this._getShapesUnderCursor().each(function removeShape(s) {
this.shapeDeletedCallback(s);
}.bind(this));
this.paintCanvas.clear();
},
hide: function hide() {
this.container.style.display = "none";
},
show: function show() {
this.container.style.display = "block";
},
isVisible: function isVisible() {
return this.container.style.display !== "none";
},
redraw: function redraw() {
this.viewCanvas.clear();
this._redrawShapes();
},
moveShapes: function moveShapes(x, y) {
this.shapes.each(function moveShape(s) {
s.move(x, y);
});
if (typeof this.currentAction !== "undefined") {
this.currentAction.move(x, y);
}
this.viewCanvas.clear();
this.paintCanvas.clear();
this._redrawShapes();
},
resize: function resize(width, height) {
this.width = width;
this.height = height;
this._setDimensions(width * this.scalingFactor, height * this.scalingFactor, this.scalingFactor);
this._redrawShapes();
},
updateColor: function updateColor() {
var color = this._getColor(this.getUserIdCallback());
this.currentAction.setColor(color);
},
_onMouseDown: function _onMouseDown(params) {
if (params.inside && this.isInEditModeCallback()) {
this.currentAction.mouseDown(this._translateMouse(params.pos));
}
},
_onMouseMove: function _onMouseMove(params) {
if (!params.inside || !this.isInEditModeCallback()) {
return;
}
if (this.isInEditModeCallback()) {
if (params.mouseDown) {
this.currentAction.mouseMove(this._translateMouse(params.pos));
} else {
this.paintCanvas.clear();
this._highlightShapesUnderCursor();
}
}
},
_onMouseUp: function _onMouseUp(params) {
this.currentAction.mouseUp(this._translateMouse(params.pos));
},
_onShapeDone: function _onShapeDone(shape) {
if (typeof this.shapeDrawnCallback === "function") {
this.shapeDrawnCallback(shape);
}
this.paintCanvas.clear();
},
_highlightShapesUnderCursor: function _highlightShapesUnderCursor() {
this._getShapesUnderCursor().each(function drawShape(s) {
this._drawShape(this.paintCanvas, s, 3);
}.bind(this));
},
_getShapesUnderCursor: function _getShapesUnderCursor() {
if (!this.mouseState.parameters.inside) {
return [];
}
return this.shapes.select(function isUnderCursor(s) {
return s.isUnderCursor(this._translateMouse(this.mouseState.parameters.pos));
}.bind(this));
},
_redrawShapes: function _redrawShapes() {
for (var i = 0; i < this.shapes.length; i++) {
this._drawShape(this.viewCanvas, this.shapes[i]);
}
if (typeof this.currentAction !== "undefined") {
this.currentAction.redraw();
}
},
_getColor: function _getColor(userId) {
var user = this._getUser(userId);
if (typeof user === 'undefined' || typeof user.color === 'undefined') {
return ORYX.CONFIG.FARBRAUSCH_DEFAULT_COLOR;
}
return user.color;
},
_getUser: function _getUser(id) {
return this.getUsersCallback()[id];
},
_setDimensions: function _setDimensions(width, height, factor) {
this._resizeDiv(this.container, width, height);
this.paintCanvas.resize(width, height);
this.paintCanvas.scale(factor);
this.viewCanvas.resize(width, height);
this.viewCanvas.scale(factor);
},
_drawShape: function _drawShape(canvas, shape, width) {
var shapeColor = this._getColor(shape.creatorId);
shape.draw(canvas, shapeColor, width);
},
_createCanvasContainer: function _createCanvasContainer(canvasId, width, height) {
var container = document.createElement('div');
container.className = "paint-canvas-container";
container.id = canvasId;
container.style.width = width + "px";
container.style.height = height + "px";
return container;
},
_createCanvas: function _createCanvas(id, width, height) {
var canvas = document.createElement('canvas');
canvas.className = "paint-canvas";
canvas.id = id;
return canvas;
},
_resizeDiv: function _resizeDiv(div, width, height) {
div.style.width = width + "px";
div.style.height = height + "px";
},
_translateMouse: function _translateMouse(pos) {
if (typeof pos === "undefined") {
return undefined;
}
return { left: pos.left / this.scalingFactor,
top: pos.top / this.scalingFactor };
}
});
ORYX.Plugins.Paint.PaintCanvas.MouseState = Clazz.extend({
construct: function construct(element, callbacks) {
this.element = element;
this.callbacks = callbacks;
this.parameters = {
inside: undefined,
mouseDown: false,
pos: undefined
};
document.documentElement.addEventListener("mousedown", this._onMouseDown.bind(this), false);
window.addEventListener("mousemove", this._onMouseMove.bind(this), true);
window.addEventListener("mouseup", this._onMouseUp.bind(this), true);
jQuery(element).mouseleave = this._onMouseLeave.bind(this);
},
_onMouseDown: function _onMouseDown(event) {
if (this._isInside(event)) {
document.onselectstart = function () { return false; };
this.parameters.mouseDown = true;
} else {
this.parameters.mouseDown = false;
}
this._rememberPosition(event);
this._callback("onMouseDown");
},
_onMouseMove: function _onMouseMove(event) {
this._rememberPosition(event);
this._callback("onMouseMove");
},
_onMouseUp: function _onMouseUp(event) {
if (this.parameters.mouseDown) {
document.onselectstart = function () { return true; };
this.parameters.mouseDown = false;
}
this._rememberPosition(event);
this._callback("onMouseUp");
},
_onMouseLeave: function _onMouseLeave(event) {
this.parameters.mouseDown = false;
},
_rememberPosition: function _rememberPosition(event) {
this.parameters.inside = this._isInside(event);
this.parameters.pos = this._isInside(event) ? { left: event.layerX, top: event.layerY } : undefined;
},
_isInside: function _isInside(event) {
return (event.target === this.element);
},
_callback: function _callback(name) {
if (typeof this.callbacks[name] === "function") {
this.callbacks[name](this.parameters);
}
}
});
ORYX.Plugins.Paint.PaintCanvas.Tool = Clazz.extend({
construct: function construct(creatorCallback, color, canvas, doneCallback) {
this.done = doneCallback;
this.getCreator = creatorCallback;
this.canvas = canvas;
this.color = color;
},
getColor: function getColor() {
return this.color;
},
setColor: function setColor(color) {
this.color = color;
}
});
ORYX.Plugins.Paint.PaintCanvas.LineTool = ORYX.Plugins.Paint.PaintCanvas.Tool.extend({
construct: function construct(creatorCallback, color, canvas, doneCallback) {
arguments.callee.$.construct.apply(this, arguments);
this._reset();
},
mouseDown: function mouseDown(pos) {
this._addPoint(pos.left, pos.top);
this.prevX = pos.left;
this.prevY = pos.top;
},
mouseUp: function mouseUp(pos) {
if (typeof this.prevX !== "undefined" &&
typeof this.prevY !== "undefined") {
var shape = new ORYX.Plugins.Paint.PaintCanvas.Line(this.getCreator(), this.points);
this.done(shape);
}
this._reset();
},
mouseMove: function mouseMove(pos) {
this._addPoint(pos.left, pos.top);
if (typeof this.prevX !== "undefined" &&
typeof this.prevY !== "undefined") {
this._drawLineSegment(this.prevX, this.prevY, pos.left, pos.top);
}
this.prevX = pos.left;
this.prevY = pos.top;
},
redraw: function redraw() {
var i;
var cur, next;
for (i = 0; i < this.points.length - 1; i++) {
cur = this.points[i];
next = this.points[i + 1];
this._drawLineSegment(cur.x, cur.y, next.x, next.y);
}
},
move: function move(x, y) {
this.points.each(function movePoint(p) {
p.x += x;
p.y += y;
});
this.prevX += x;
this.prevY += y;
},
_drawLineSegment: function _drawLineSegment(x1, y1, x2, y2) {
this.canvas.setStyle(1, this.getColor());
this.canvas.drawLine(x1, y1, x2, y2);
},
_addPoint: function _addPoint(x, y) {
this.points.push({ x: x, y: y });
},
_reset: function _reset() {
this.points = [];
this.prevX = undefined;
this.prevY = undefined;
}
});
ORYX.Plugins.Paint.PaintCanvas.TwoPointTool = ORYX.Plugins.Paint.PaintCanvas.Tool.extend({
construct: function construct(creatorId, color, canvas, doneCallback, shapeClass) {
arguments.callee.$.construct.call(this, creatorId, color, canvas, doneCallback);
this.shapeClass = shapeClass;
this._reset();
},
mouseDown: function mouseDown(pos) {
this.start = pos;
},
mouseUp: function mouseUp(pos) {
var shape;
var endPos = pos || this.curEnd;
if (typeof this.start !== "undefined" &&
typeof endPos !== "undefined") {
shape = new this.shapeClass(this.getCreator(), this.start, endPos);
this.done(shape);
}
this._reset();
},
mouseMove: function mouseMove(pos) {
if (typeof this.start === "undefined")
return;
this.curEnd = pos;
this.canvas.clear();
this.draw(this.canvas, this.start, pos);
},
redraw: function redraw() {
if (typeof this.curEnd !== "undefined") {
this.draw(this.canvas, this.start, this.curEnd);
}
},
move: function move(x, y) {
var movePoint = function movePoint(p) {
if (typeof p !== "undefined") {
p.left += x;
p.top += y;
}
};
movePoint(this.start);
movePoint(this.curEnd);
},
_reset: function _reset() {
this.start = undefined;
this.curEnd = undefined;
}
});
ORYX.Plugins.Paint.PaintCanvas.ArrowTool = ORYX.Plugins.Paint.PaintCanvas.TwoPointTool.extend({
construct: function construct(creatorId, color, canvas, doneCallback) {
arguments.callee.$.construct.call(this, creatorId, color, canvas, doneCallback, ORYX.Plugins.Paint.PaintCanvas.Arrow);
},
draw: function draw(canvas, start, end) {
canvas.setStyle(1, this.getColor());
canvas.drawArrow(start.left, start.top, end.left, end.top);
}
});
ORYX.Plugins.Paint.PaintCanvas.BoxTool = ORYX.Plugins.Paint.PaintCanvas.TwoPointTool.extend({
construct: function construct(creatorId, color, canvas, doneCallback) {
arguments.callee.$.construct.call(this, creatorId, color, canvas, doneCallback, ORYX.Plugins.Paint.PaintCanvas.Box);
},
draw: function draw(canvas, start, end) {
canvas.setStyle(1, this.getColor());
canvas.strokeRect(start.left, start.top, end.left - start.left, end.top - start.top);
}
});
ORYX.Plugins.Paint.PaintCanvas.EllipseTool = ORYX.Plugins.Paint.PaintCanvas.TwoPointTool.extend({
construct: function construct(creatorId, color, canvas, doneCallback) {
arguments.callee.$.construct.call(this, creatorId, color, canvas, doneCallback, ORYX.Plugins.Paint.PaintCanvas.Ellipse);
},
draw: function draw(canvas, start, end) {
canvas.setStyle(1, this.getColor());
canvas.drawEllipse(start.left, start.top, end.left, end.top);
}
});
ORYX.Plugins.Paint.PaintCanvas.Shape = Clazz.extend({
construct: function construct(creatorId, id) {
this.id = id || ORYX.Editor.provideId();
this.creatorId = creatorId;
}
});
ORYX.Plugins.Paint.PaintCanvas.Line = ORYX.Plugins.Paint.PaintCanvas.Shape.extend({
construct: function construct(creatorId, points, id) {
arguments.callee.$.construct.call(this, creatorId, id);
this.points = points.map(Object.clone);
},
draw: function draw(canvas, color, width) {
var lines = this._getLines(this._smooth(this.points));
canvas.setStyle(width || 1, color);
lines.each(function drawLine(l) {
canvas.drawLine(l.a.x, l.a.y, l.b.x, l.b.y);
});
},
move: function move(x, y) {
this.points.each(function movePoint(p) {
p.x += x;
p.y += y;
});
},
isUnderCursor: function isUnderCursor(pos) {
var lines = this._getLines(this.points);
return lines.any(function isInLine(l) {
return ORYX.Core.Math.isPointInLine(pos.left, pos.top, l.a.x, l.a.y, l.b.x, l.b.y, 10);
});
},
pack: function pack() {
return {
id: this.id,
type: "Line",
creatorId: this.creatorId,
points: this.points
};
},
unpack: function unpack(obj) {
return new ORYX.Plugins.Paint.PaintCanvas.Line(obj.creatorId, obj.points, obj.id);
},
_getLines: function _getLines(points) {
var lines = [];
for (var i = 1; i < points.length; i++) {
lines.push({ a: points[i-1],
b: points[i] });
}
return lines;
},
_smooth: function _smooth(points) {
return this._mcMaster(this._fillPoints(points, 5));
},
_fillPoints: function _fillPoints(points, maxDist) {
var out = [points[0]];
for (var i = 1; i < points.length; i++) {
var pos = points[i];
var prevPos = points[i-1];
var distX = pos.x - prevPos.x;
var distY = pos.y - prevPos.y;
var dist = Math.sqrt(distX*distX + distY*distY);
if (dist > maxDist) {
var pointsToInsert = Math.floor(dist / maxDist);
var deltaX = distX / pointsToInsert;
var deltaY = distY / pointsToInsert;
for (var k = 0; k < pointsToInsert; k++) {
out.push({x: prevPos.x + k * deltaX,
y: prevPos.y + k * deltaY });
}
}
out.push(pos);
}
return out;
},
_mcMaster: function _mcMaster(points) {
var out = [];
var lookAhead = 10;
var halfLookAhead = Math.floor(lookAhead / 2);
if (points.length < lookAhead) {
return points;
}
for (var i = points.length - 1; i >= 0; i--) {
if (i >= points.length - halfLookAhead || i <= halfLookAhead) {
out = [points[i]].concat(out);
} else {
var accX = 0, accY = 0;
for (var k = -halfLookAhead; k < -halfLookAhead + lookAhead; k++) {
accX += points[i + k].x;
accY += points[i + k].y;
}
out = [{x: accX / lookAhead,
y: accY / lookAhead}].concat(out);
}
}
return out;
}
});
ORYX.Plugins.Paint.PaintCanvas.TwoPointShape = ORYX.Plugins.Paint.PaintCanvas.Shape.extend({
construct: function construct(creatorId, start, end, id) {
arguments.callee.$.construct.call(this, creatorId, id);
this.start = start;
this.end = end;
},
move: function move(x, y) {
var movePoint = function movePoint(p) {
p.left += x;
p.top += y;
};
movePoint(this.start);
movePoint(this.end);
},
abstractPack: function abstractPack(typeName) {
return {
id: this.id,
type: typeName,
creatorId: this.creatorId,
start: this.start,
end: this.end
};
},
abstractUnpack: function abstractUnpack(shapeClass, obj) {
return new shapeClass(obj.creatorId, obj.start, obj.end, obj.id);
}
});
ORYX.Plugins.Paint.PaintCanvas.Arrow = ORYX.Plugins.Paint.PaintCanvas.TwoPointShape.extend({
construct: function construct(creatorId, start, end, id) {
arguments.callee.$.construct.apply(this, arguments);
},
draw: function draw(canvas, color, width) {
canvas.setStyle(width || 1, color);
canvas.drawArrow(this.start.left, this.start.top, this.end.left, this.end.top);
},
isUnderCursor: function isUnderCursor(pos) {
return ORYX.Core.Math.isPointInLine(pos.left, pos.top, this.start.left, this.start.top, this.end.left, this.end.top, 10);
},
pack: function pack() {
return this.abstractPack("Arrow");
},
unpack: function unpack(obj) {
return this.abstractUnpack(ORYX.Plugins.Paint.PaintCanvas.Arrow, obj);
}
});
ORYX.Plugins.Paint.PaintCanvas.Box = ORYX.Plugins.Paint.PaintCanvas.TwoPointShape.extend({
construct: function construct(creatorId, start, end, id) {
arguments.callee.$.construct.apply(this, arguments);
},
draw: function draw(canvas, color, width) {
canvas.setStyle(width || 1, color);
canvas.strokeRect(this.start.left, this.start.top, this.end.left - this.start.left, this.end.top - this.start.top);
},
isUnderCursor: function isUnderCursor(pos) {
var hitHorizontal1 = ORYX.Core.Math.isPointInLine(pos.left, pos.top, this.start.left, this.start.top, this.end.left, this.start.top, 10);
var hitHorizontal2 = ORYX.Core.Math.isPointInLine(pos.left, pos.top, this.start.left, this.end.top, this.end.left, this.end.top, 10);
var hitVertical1 = ORYX.Core.Math.isPointInLine(pos.left, pos.top, this.start.left, this.start.top, this.start.left, this.end.top, 10);
var hitVertical2 = ORYX.Core.Math.isPointInLine(pos.left, pos.top, this.end.left, this.start.top, this.end.left, this.end.top, 10);
return hitHorizontal1 || hitHorizontal2 || hitVertical1 || hitVertical2;
},
pack: function pack() {
return this.abstractPack("Box");
},
unpack: function unpack(obj) {
return this.abstractUnpack(ORYX.Plugins.Paint.PaintCanvas.Box, obj);
}
});
ORYX.Plugins.Paint.PaintCanvas.Ellipse = ORYX.Plugins.Paint.PaintCanvas.TwoPointShape.extend({
construct: function construct(creatorId, start, end, id) {
var upperLeft = {
left: Math.min(start.left, end.left),
top: Math.min(start.top, end.top)
};
var lowerRight = {
left: Math.max(start.left, end.left),
top: Math.max(start.top, end.top)
};
arguments.callee.$.construct.call(this, creatorId, upperLeft, lowerRight, id);
var rx = (lowerRight.left - upperLeft.left)/2;
var ry = (lowerRight.top - upperLeft.top)/2;
var cx = upperLeft.left + rx;
var cy = upperLeft.top + ry;
this.isUnderCursor = function isUnderCursor(pos) {
var insideInner = false;
if (rx > 5 && ry > 5) {
insideInner = ORYX.Core.Math.isPointInEllipse(pos.left, pos.top, cx, cy, rx - 5, ry - 5);
}
return !insideInner && ORYX.Core.Math.isPointInEllipse(pos.left, pos.top, cx, cy, rx + 10, ry + 10);
};
},
draw: function draw(canvas, color, width) {
canvas.setStyle(width || 1, color);
canvas.drawEllipse(this.start.left, this.start.top, this.end.left, this.end.top);
},
pack: function pack() {
return this.abstractPack("Ellipse");
},
unpack: function unpack(obj) {
return this.abstractUnpack(ORYX.Plugins.Paint.PaintCanvas.Ellipse, obj);
}
});
ORYX.Plugins.Paint.PaintCanvas.ShapeExistenceCommand = ORYX.Core.AbstractCommand.extend({
construct: function construct(shape, facade) {
arguments.callee.$.construct.call(this, facade);
this.metadata.putOnStack = false;
this.shape = shape;
},
getCommandData: function getCommandData() {
return {
"shape": this.shape.pack()
};
},
abstractCreateFromCommandData: function abstractCreateFromCommandData(commandName, facade, commandObject) {
var shape = ORYX.Plugins.Paint.PaintCanvas[commandObject.shape.type].prototype.unpack(commandObject.shape);
return new ORYX.Core.Commands[commandName](shape, facade);
},
getAffectedShapes: function getAffectedShapes() {
return [];
},
createShape: function createShape() {
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_PAINT_NEWSHAPE,
shape: this.shape
});
},
deleteShape: function deleteShape() {
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_PAINT_REMOVESHAPE,
shapeId: this.shape.id
});
}
});
ORYX.Core.Commands["Paint.DrawCommand"] = ORYX.Plugins.Paint.PaintCanvas.ShapeExistenceCommand.extend({
construct: function construct(shape, facade) {
arguments.callee.$.construct.apply(this, arguments);
},
createFromCommandData: function createFromCommandData(facade, commandObject) {
return this.abstractCreateFromCommandData("Paint.DrawCommand", facade, commandObject);
},
getCommandName: function getCommandName() {
return "Paint.DrawCommand";
},
getDisplayName: function getDisplayName() {
return "Drew on paint layer";
},
execute: function execute() {
this.createShape();
},
rollback: function rollback() {
this.deleteShape();
}
});
ORYX.Core.Commands["Paint.RemoveCommand"] = ORYX.Plugins.Paint.PaintCanvas.ShapeExistenceCommand.extend({
construct: function construct(shape, facade) {
arguments.callee.$.construct.apply(this, arguments);
},
createFromCommandData: function createFromCommandData(facade, commandObject) {
return this.abstractCreateFromCommandData("Paint.RemoveCommand", facade, commandObject);
},
getCommandName: function getCommandName() {
return "Paint.RemoveCommand";
},
getDisplayName: function getDisplayName() {
return "Erased something from paint layer";
},
execute: function execute() {
this.deleteShape();
},
rollback: function rollback() {
this.createShape();
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if (!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Plugins.FarbrauschAfterglow = Clazz.extend({
excludedTags: Array.from(["defs", "text", "g", "a"]),
highlightClass: "highlight",
highlightIdAttribute: "highlight-id",
finalStrokeAttribute: "final-stroke",
finalStrokeWidthAttribute: "final-stroke-width",
finalFillAttribute: "final-fill",
millisecondsForStep: 40,
construct: function construct(facade) {
this.users = {}; // maps user ids to user objects, which contain colors
this.facade = facade;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_FARBRAUSCH_NEW_INFOS, this.updateFarbrauschInfos.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SHAPE_METADATA_CHANGED, this.handleShapeChanged.bind(this));
},
updateFarbrauschInfos: function updateFarbrauschInfos(evt) {
this.users = evt.users;
},
handleShapeChanged: function handleShapeChanged(evt) {
var shape = evt.shape;
if (typeof shape.metadata !== "undefined") {
var color = this.getColorForUserId(shape.getLastChangedBy());
if (!shape.lastChangeWasLocal()) {
this.showAfterglow(color, shape);
}
}
},
getColorForUserId: function getColorForUserId(userId) {
var user = this.users[userId];
if(typeof user === 'undefined' || typeof user.color === 'undefined') {
return ORYX.CONFIG.FARBRAUSCH_DEFAULT_COLOR;
}
return user.color;
},
showAfterglow: function showAfterglow(color, shape) {
var i;
var svgNode = shape.node;
var defsNode = this.facade.getCanvas().getDefsNode();
var highlightId = ORYX.Editor.provideId();
var highlightNodes = this.getHighlightNodes(shape, defsNode);
var highlightMarkers = this.getHighlightMarkersById(defsNode, shape.id);
var startStrokeWidth = 3;
for (i = 0; i < highlightNodes.length; i++) {
var highlightNode = highlightNodes[i];
highlightNode.setAttribute(this.highlightIdAttribute, highlightId);
this.setFinalStrokeAttributes(highlightNode);
this.fadeHighlight(highlightNode, highlightId, color, startStrokeWidth, 3000);
}
for (i = 0; i < highlightMarkers.length; i++) {
var isMarker = true;
var highlightMarker = highlightMarkers[i];
highlightMarker.setAttribute(this.highlightIdAttribute, highlightId);
this.setFinalStrokeAttributes(highlightMarker);
this.setFinalFillAttribute(highlightMarker);
this.fadeHighlight(highlightMarker, highlightId, color, startStrokeWidth, 3000, isMarker);
}
},
getHighlightNodes: function getHighlightNodes(shape, defsNode) {
var svgNode = shape.node;
var highlightNodes = Array.from(svgNode.getElementsByClassName("highlight"));
return highlightNodes;
},
getHighlightMarkersById: function getHighlightMarkersById(defsNode, id) {
var allHighlightMarkers = Array.from(defsNode.getElementsByClassName("highlight"));
var highlightMarkers = [];
for (var i = 0; i < allHighlightMarkers.length; i++) {
var currentHighlightMarker = allHighlightMarkers[i];
if (currentHighlightMarker.id.indexOf(id) !== -1) {
highlightMarkers.push(currentHighlightMarker);
}
}
return highlightMarkers;
},
setFinalStrokeAttributes: function setFinalStrokeAttributes(highlightNode) {
var finalStroke = highlightNode.getAttribute(this.finalStrokeAttribute);
if (finalStroke === null) {
finalStroke = highlightNode.getAttribute("stroke");
highlightNode.setAttribute(this.finalStrokeAttribute, finalStroke);
}
var finalStrokeWidth = highlightNode.getAttribute(this.finalStrokeWidthAttribute);
if (finalStrokeWidth === null) {
finalStrokeWidth = highlightNode.getAttribute("stroke-width") || "1";
highlightNode.setAttribute(this.finalStrokeWidthAttribute, finalStrokeWidth);
}
},
setFinalFillAttribute: function setFinalFillAttribute(highlightMarker) {
var finalFill = highlightMarker.getAttribute(this.finalFillAttribute);
if (finalFill === null) {
finalFill = highlightMarker.getAttribute("fill") || "#000000";
highlightMarker.setAttribute(this.finalFillAttribute, finalFill);
}
},
fadeHighlight: function fadeHighlight(highlightNode, highlightId, startStroke, startStrokeWidth, animationTime, isMarker, passedMilliseconds) {
var currentHighlightId = highlightNode.getAttribute(this.highlightIdAttribute);
// shape not visible or other animation running on shape, cancel this one
if ((highlightNode.getAttribute("visibility") === "hidden") || (currentHighlightId !== highlightId)) {
return;
}
if (typeof passedMilliseconds === "undefined") {
passedMilliseconds = 0;
}
if (isMarker !== true) {
isMarker = false;
}
if (animationTime > passedMilliseconds) {
// Animation in progress
var fraction = passedMilliseconds / animationTime;
this.fadeStroke(highlightNode, startStroke, fraction);
this.fadeStrokeWidth(highlightNode, startStrokeWidth, fraction);
if (isMarker) {
this.fadeFill(highlightNode, startStroke, fraction);
}
var callback = function() {
this.fadeHighlight(highlightNode, highlightId, startStroke, startStrokeWidth, animationTime, isMarker, passedMilliseconds + this.millisecondsForStep);
}.bind(this);
setTimeout(callback, this.millisecondsForStep);
} else {
// Animation expired set to finalValues
highlightNode.setAttribute("stroke", highlightNode.getAttribute(this.finalStrokeAttribute));
highlightNode.setAttribute("stroke-width", highlightNode.getAttribute(this.finalStrokeWidthAttribute));
if (isMarker) {
highlightNode.setAttribute("fill", highlightNode.getAttribute(this.finalFillAttribute));
}
}
},
fadeStroke: function fadeStroke(highlightNode, startStroke, fraction) {
var finalStroke = highlightNode.getAttribute(this.finalStrokeAttribute);
// stroke is not visible, so do not fade
if ((finalStroke === null) || (finalStroke === "none")) {
return;
}
var interpolatedStroke = this.interpolateColor(startStroke, finalStroke, fraction);
highlightNode.setAttribute("stroke", interpolatedStroke);
},
fadeStrokeWidth: function fadeStrokeWidth(highlightNode, startStrokeWidth, fraction) {
var finalStrokeWidth = parseInt(highlightNode.getAttribute(this.finalStrokeWidthAttribute), 10);
// stroke is not visible, so do not fade
if (finalStrokeWidth === 0) {
return;
}
var strokeWidth = finalStrokeWidth + (1 - fraction) * (startStrokeWidth - finalStrokeWidth);
highlightNode.setAttribute("stroke-width", strokeWidth);
},
fadeFill: function fadeStroke(highlightNode, startFill, fraction) {
var finalFill = highlightNode.getAttribute(this.finalFillAttribute);
// fill color is not visible, so do not fade
if ((finalFill === null) || (finalFill === "none")) {
return;
}
var interpolatedFill = this.interpolateColor(startFill, finalFill, fraction);
highlightNode.setAttribute("fill", interpolatedFill);
},
interpolateColor: function interpolateColor(startColor, finalColor, fraction) {
var startColorRgb = this.getRgbColor(startColor);
var finalColorRgb = this.getRgbColor(finalColor);
var interpolatedColorRgb = {};
interpolatedColorRgb["r"] = startColorRgb["r"] + parseInt(fraction * (finalColorRgb["r"] - startColorRgb["r"]), 10);
interpolatedColorRgb["g"] = startColorRgb["g"] + parseInt(fraction * (finalColorRgb["g"] - startColorRgb["g"]), 10);
interpolatedColorRgb["b"] = startColorRgb["b"] + parseInt(fraction * (finalColorRgb["b"] - startColorRgb["b"]), 10);
return this.getHexColor(interpolatedColorRgb);
},
getRgbColor: function getRgbColor(hexColorString) {
var rgbValue = {};
rgbValue["r"] = parseInt(hexColorString.substring(1, 3), 16);
rgbValue["g"] = parseInt(hexColorString.substring(3, 5), 16);
rgbValue["b"] = parseInt(hexColorString.substring(5, 7), 16);
return rgbValue;
},
getHexColor: function getHexColor(rgbColorHash) {
// If statements fill the color strings with leading zeroes
var red = rgbColorHash["r"].toString(16);
if (red.length === 1) {
red = "0" + red;
}
var green = rgbColorHash["g"].toString(16);
if (green.length === 1) {
green = "0" + green;
}
var blue = rgbColorHash["b"].toString(16);
if (blue.length === 1) {
blue = "0" + blue;
}
var hexColor = "#" + red + green + blue;
return hexColor;
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if(!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Core.Commands["DragDocker.DragDockerCommand"] = ORYX.Core.AbstractCommand.extend({
construct: function construct(docker, newPos, oldPos, newDockedShape, oldDockedShape, facade){
// call construct method of parent
arguments.callee.$.construct.call(this, facade);
this.docker = docker;
this.index = docker.parent.dockers.indexOf(docker);
this.newPosition = newPos;
this.oldPosition = oldPos;
this.newDockedShape = newDockedShape;
this.oldDockedShape = oldDockedShape;
this.facade = facade;
this.index = docker.parent.dockers.indexOf(docker);
this.shape = docker.parent;
},
getAffectedShapes: function getAffectedShapes() {
return [this.shape];
},
getCommandName: function getCommandName() {
return "DragDocker.DragDockerCommand";
},
getDisplayName: function getDisplayName() {
return "Docker moved";
},
getCommandData: function getCommandData() {
var getId = function(shape) {
if (typeof shape !== "undefined") {
return shape.resourceId
}
};
var commandData = {
"dockerId": this.docker.id,
"index": this.index,
"newPosition": this.newPosition,
"oldPosition": this.oldPosition,
"newDockedShapeId": getId(this.newDockedShape),
"oldDockedShapeId": getId(this.oldDockedShape),
"shapeId": getId(this.shape)
};
return commandData;
},
createFromCommandData: function createFromCommandData(facade, commandData) {
var canvas = facade.getCanvas();
var getShape = canvas.getChildShapeByResourceId.bind(canvas);
var newDockedShape = getShape(commandData.newDockedShapeId);
if (typeof commandData.newDockedShapeId !== 'undefined' && typeof newDockedShape === 'undefined') {
// Trying to dock to a shape that doesn't exist anymore.
return undefined;
}
var oldDockedShape = getShape(commandData.oldDockedShapeId);
var shape = getShape(commandData.shapeId);
if (typeof shape === 'undefined') {
// Trying to move a docker of a shape that doesn't exist anymore.
return undefined;
}
var docker;
for (var i = 0; i < shape.dockers.length; i++) {
if (shape.dockers[i].id == commandData.dockerId) {
docker = shape.dockers[i];
}
}
return new ORYX.Core.Commands["DragDocker.DragDockerCommand"](docker, commandData.newPosition, commandData.oldPosition, newDockedShape, oldDockedShape, facade);
},
execute: function execute(){
if (typeof this.docker !== "undefined") {
if (!this.docker.parent){
this.docker = this.shape.dockers[this.index];
}
this.dock( this.newDockedShape, this.newPosition );
// TODO locally deleting dockers might create inconsistent states across clients
//this.removedDockers = this.shape.removeUnusedDockers();
this.facade.updateSelection(this.isLocal());
}
},
rollback: function rollback(){
if (typeof this.docker !== "undefined") {
this.dock( this.oldDockedShape, this.oldPosition );
(this.removedDockers||$H({})).each(function(d){
this.shape.add(d.value, Number(d.key));
this.shape._update(true);
}.bind(this))
this.facade.updateSelection(this.isLocal());
}
},
dock: function dock(toDockShape, relativePosition){
var relativePos = relativePosition;
if (typeof toDockShape !== "undefined") {
/* if docker should be attached to a shape, calculate absolute position, otherwise relativePosition is relative to canvas, i.e. absolute
values are expected to be between 0 and 1, if faulty values are found, they are set manually - with x = 0.5 and y = 0.5, shape will be docked at center*/
var absolutePosition = this.facade.getCanvas().node.ownerSVGElement.createSVGPoint();
if ((0 > relativePos.x) || (relativePos.x > 1) || (0 > relativePos.y) || (relativePos.y > 1)) {
relativePos.x = 0.5;
relativePos.y = 0.5;
}
absolutePosition.x = Math.abs(toDockShape.absoluteBounds().lowerRight().x - relativePos.x * toDockShape.bounds.width());
absolutePosition.y = Math.abs(toDockShape.absoluteBounds().lowerRight().y - relativePos.y * toDockShape.bounds.height());
} else {
var absolutePosition = relativePosition;
}
//it seems that for docker to be moved, the dockedShape need to be cleared first
this.docker.setDockedShape(undefined);
//this.docker.setReferencePoint(absolutePosition);
this.docker.bounds.centerMoveTo(absolutePosition);
this.docker.setDockedShape(toDockShape);
this.docker.update();
this.docker.parent._update();
this.facade.getCanvas().update();
}
});
ORYX.Plugins.DragDocker = Clazz.extend({
/**
* Constructor
* @param {Object} Facade: The Facade of the Editor
*/
construct: function(facade) {
this.facade = facade;
// Set the valid and invalid color
this.VALIDCOLOR = ORYX.CONFIG.SELECTION_VALID_COLOR;
this.INVALIDCOLOR = ORYX.CONFIG.SELECTION_INVALID_COLOR;
// Define Variables
this.shapeSelection = undefined;
this.docker = undefined;
this.dockerParent = undefined;
this.dockerSource = undefined;
this.dockerTarget = undefined;
this.lastUIObj = undefined;
this.isStartDocker = undefined;
this.isEndDocker = undefined;
this.undockTreshold = 10;
this.initialDockerPosition = undefined;
this.outerDockerNotMoved = undefined;
this.isValid = false;
// For the Drag and Drop
// Register on MouseDown-Event on a Docker
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MOUSEDOWN, this.handleMouseDown.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_DOCKERDRAG, this.handleDockerDrag.bind(this));
// Register on over/out to show / hide a docker
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MOUSEOVER, this.handleMouseOver.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MOUSEOUT, this.handleMouseOut.bind(this));
},
/**
* DockerDrag Handler
* delegates the uiEvent of the drag event to the mouseDown function
*/
handleDockerDrag: function handleDockerDrag(event, uiObj) {
this.handleMouseDown(event.uiEvent, uiObj);
},
/**
* MouseOut Handler
*
*/
handleMouseOut: function(event, uiObj) {
// If there is a Docker, hide this
if(!this.docker && uiObj instanceof ORYX.Core.Controls.Docker) {
uiObj.hide()
} else if(!this.docker && uiObj instanceof ORYX.Core.Edge) {
uiObj.dockers.each(function(docker){
docker.hide();
})
}
},
/**
* MouseOver Handler
*
*/
handleMouseOver: function(event, uiObj) {
// If there is a Docker, show this
if(!this.docker && uiObj instanceof ORYX.Core.Controls.Docker) {
uiObj.show()
} else if(!this.docker && uiObj instanceof ORYX.Core.Edge) {
uiObj.dockers.each(function(docker){
docker.show();
})
}
},
/**
* MouseDown Handler
*
*/
handleMouseDown: function(event, uiObj) {
// If there is a Docker
if(uiObj instanceof ORYX.Core.Controls.Docker && uiObj.isMovable) {
/* Buffering shape selection and clear selection*/
this.shapeSelection = this.facade.getSelection();
this.facade.setSelection();
this.docker = uiObj;
this.initialDockerPosition = this.docker.bounds.center();
this.outerDockerNotMoved = false;
this.dockerParent = uiObj.parent;
// Define command arguments
this._commandArg = {docker:uiObj, dockedShape:uiObj.getDockedShape(), refPoint:uiObj.referencePoint || uiObj.bounds.center()};
// Show the Docker
this.docker.show();
// If the Dockers Parent is an Edge,
// and the Docker is either the first or last Docker of the Edge
if(uiObj.parent instanceof ORYX.Core.Edge &&
(uiObj.parent.dockers.first() == uiObj || uiObj.parent.dockers.last() == uiObj)) {
// Get the Edge Source or Target
if(uiObj.parent.dockers.first() == uiObj && uiObj.parent.dockers.last().getDockedShape()) {
this.dockerTarget = uiObj.parent.dockers.last().getDockedShape()
} else if(uiObj.parent.dockers.last() == uiObj && uiObj.parent.dockers.first().getDockedShape()) {
this.dockerSource = uiObj.parent.dockers.first().getDockedShape()
}
} else {
// If there parent is not an Edge, undefined the Source and Target
this.dockerSource = undefined;
this.dockerTarget = undefined;
}
this.isStartDocker = this.docker.parent.dockers.first() === this.docker
this.isEndDocker = this.docker.parent.dockers.last() === this.docker
// add to canvas while dragging
this.facade.getCanvas().add(this.docker.parent);
// Hide all Labels from Docker
this.docker.parent.getLabels().each(function(label) {
label.hide();
});
// Undocked the Docker from current Shape
if ((!this.isStartDocker && !this.isEndDocker) || !this.docker.isDocked()) {
this.docker.setDockedShape(undefined)
// Set the Docker to the center of the mouse pointer
var evPos = this.facade.eventCoordinates(event);
this.docker.bounds.centerMoveTo(evPos);
//this.docker.update()
//this.facade.getCanvas().update();
this.dockerParent._update();
} else {
this.outerDockerNotMoved = true;
}
var option = {movedCallback: this.dockerMoved.bind(this), upCallback: this.dockerMovedFinished.bind(this)}
// Enable the Docker for Drag'n'Drop, give the mouseMove and mouseUp-Callback with
ORYX.Core.UIEnableDrag(event, uiObj, option);
}
},
/**
* Docker MouseMove Handler
*
*/
dockerMoved: function(event) {
this.outerDockerNotMoved = false;
var snapToMagnet = undefined;
if (this.docker.parent) {
if (this.isStartDocker || this.isEndDocker) {
// Get the EventPosition and all Shapes on these point
var evPos = this.facade.eventCoordinates(event);
if(this.docker.isDocked()) {
/* Only consider start/end dockers if they are moved over a treshold */
var distanceDockerPointer =
ORYX.Core.Math.getDistancePointToPoint(evPos, this.initialDockerPosition);
if(distanceDockerPointer < this.undockTreshold) {
this.outerDockerNotMoved = true;
return;
}
/* Undock the docker */
this.docker.setDockedShape(undefined)
// Set the Docker to the center of the mouse pointer
//this.docker.bounds.centerMoveTo(evPos);
this.dockerParent._update();
}
var shapes = this.facade.getCanvas().getAbstractShapesAtPosition(evPos);
// Get the top level Shape on these, but not the same as Dockers parent
var uiObj = shapes.pop();
if (this.docker.parent === uiObj) {
uiObj = shapes.pop();
}
// If the top level Shape the same as the last Shape, then return
if (this.lastUIObj == uiObj) {
//return;
// If the top level uiObj instance of Shape and this isn't the parent of the docker
}
else
if (uiObj instanceof ORYX.Core.Shape) {
// Get the StencilSet of the Edge
var sset = this.docker.parent.getStencil().stencilSet();
// Ask by the StencilSet if the source, the edge and the target valid connections.
if (this.docker.parent instanceof ORYX.Core.Edge) {
var highestParent = this.getHighestParentBeforeCanvas(uiObj);
/* Ensure that the shape to dock is not a child shape
* of the same edge.
*/
if(highestParent instanceof ORYX.Core.Edge
&& this.docker.parent === highestParent) {
this.isValid = false;
this.dockerParent._update();
return;
}
this.isValid = false;
var curObj = uiObj, orgObj = uiObj;
while(!this.isValid && curObj && !(curObj instanceof ORYX.Core.Canvas)){
uiObj = curObj;
this.isValid = this.facade.getRules().canConnect({
sourceShape: this.dockerSource ? // Is there a docked source
this.dockerSource : // than set this
(this.isStartDocker ? // if not and if the Docker is the start docker
uiObj : // take the last uiObj
undefined), // if not set it to undefined;
edgeShape: this.docker.parent,
targetShape: this.dockerTarget ? // Is there a docked target
this.dockerTarget : // than set this
(this.isEndDocker ? // if not and if the Docker is not the start docker
uiObj : // take the last uiObj
undefined) // if not set it to undefined;
});
curObj = curObj.parent;
}
// Reset uiObj if no
// valid parent is found
if (!this.isValid){
uiObj = orgObj;
}
}
else {
this.isValid = this.facade.getRules().canConnect({
sourceShape: uiObj,
edgeShape: this.docker.parent,
targetShape: this.docker.parent
});
}
// If there is a lastUIObj, hide the magnets
if (this.lastUIObj) {
this.hideMagnets(this.lastUIObj)
}
// If there is a valid connection, show the magnets
if (this.isValid) {
this.showMagnets(uiObj)
}
// Set the Highlight Rectangle by these value
this.showHighlight(uiObj, this.isValid ? this.VALIDCOLOR : this.INVALIDCOLOR);
// Buffer the current Shape
this.lastUIObj = uiObj;
}
else {
// If there is no top level Shape, then hide the highligting of the last Shape
this.hideHighlight();
this.lastUIObj ? this.hideMagnets(this.lastUIObj) : null;
this.lastUIObj = undefined;
this.isValid = false;
}
// Snap to the nearest Magnet
if (this.lastUIObj && this.isValid && !(event.shiftKey || event.ctrlKey)) {
snapToMagnet = this.lastUIObj.magnets.find(function(magnet){
return magnet.absoluteBounds().isIncluded(evPos)
});
if (snapToMagnet) {
this.docker.bounds.centerMoveTo(snapToMagnet.absoluteCenterXY());
//this.docker.update()
}
}
}
}
// Snap to on the nearest Docker of the same parent
if(!(event.shiftKey || event.ctrlKey) && !snapToMagnet) {
var minOffset = ORYX.CONFIG.DOCKER_SNAP_OFFSET;
var nearestX = minOffset + 1
var nearestY = minOffset + 1
var dockerCenter = this.docker.bounds.center();
if (this.docker.parent) {
this.docker.parent.dockers.each((function(docker){
if (this.docker == docker) {
return
};
var center = docker.referencePoint ? docker.getAbsoluteReferencePoint() : docker.bounds.center();
nearestX = Math.abs(nearestX) > Math.abs(center.x - dockerCenter.x) ? center.x - dockerCenter.x : nearestX;
nearestY = Math.abs(nearestY) > Math.abs(center.y - dockerCenter.y) ? center.y - dockerCenter.y : nearestY;
}).bind(this));
if (Math.abs(nearestX) < minOffset || Math.abs(nearestY) < minOffset) {
nearestX = Math.abs(nearestX) < minOffset ? nearestX : 0;
nearestY = Math.abs(nearestY) < minOffset ? nearestY : 0;
this.docker.bounds.centerMoveTo(dockerCenter.x + nearestX, dockerCenter.y + nearestY);
//this.docker.update()
} else {
var previous = this.docker.parent.dockers[Math.max(this.docker.parent.dockers.indexOf(this.docker)-1, 0)]
var next = this.docker.parent.dockers[Math.min(this.docker.parent.dockers.indexOf(this.docker)+1, this.docker.parent.dockers.length-1)]
if (previous && next && previous !== this.docker && next !== this.docker){
var cp = previous.bounds.center();
var cn = next.bounds.center();
var cd = this.docker.bounds.center();
// Checks if the point is on the line between previous and next
if (ORYX.Core.Math.isPointInLine(cd.x, cd.y, cp.x, cp.y, cn.x, cn.y, 10)) {
// Get the rise
var raise = (Number(cn.y)-Number(cp.y))/(Number(cn.x)-Number(cp.x));
// Calculate the intersection point
var intersecX = ((cp.y-(cp.x*raise))-(cd.y-(cd.x*(-Math.pow(raise,-1)))))/((-Math.pow(raise,-1))-raise);
var intersecY = (cp.y-(cp.x*raise))+(raise*intersecX);
if(isNaN(intersecX) || isNaN(intersecY)) {return;}
this.docker.bounds.centerMoveTo(intersecX, intersecY);
}
}
}
}
}
//this.facade.getCanvas().update();
this.dockerParent._update();
},
/**
* Docker MouseUp Handler
*
*/
dockerMovedFinished: function(event) {
// check if parent edge still exists on canvas, skip if not
var currentShape = this.facade.getCanvas().getChildShapeByResourceId(this.dockerParent.resourceId);
if (typeof currentShape !== "undefined") {
/* Reset to buffered shape selection */
this.facade.setSelection(this.shapeSelection);
// Hide the border
this.hideHighlight();
// Show all Labels from Docker
this.dockerParent.getLabels().each(function(label){
label.show();
//label.update();
});
// If there is a last top level Shape
if(this.lastUIObj && (this.isStartDocker || this.isEndDocker)){
// If there is a valid connection, the set as a docked Shape to them
if(this.isValid) {
this.docker.setDockedShape(this.lastUIObj);
this.facade.raiseEvent({
type :ORYX.CONFIG.EVENT_DRAGDOCKER_DOCKED,
docker : this.docker,
parent : this.docker.parent,
target : this.lastUIObj
});
}
this.hideMagnets(this.lastUIObj)
}
// Hide the Docker
this.docker.hide();
if(this.outerDockerNotMoved) {
// Get the EventPosition and all Shapes on these point
var evPos = this.facade.eventCoordinates(event);
var shapes = this.facade.getCanvas().getAbstractShapesAtPosition(evPos);
/* Remove edges from selection */
var shapeWithoutEdges = shapes.findAll(function(node) {
return node instanceof ORYX.Core.Node;
});
shapes = shapeWithoutEdges.length ? shapeWithoutEdges : shapes;
this.facade.setSelection(shapes);
} else {
if (this.docker.parent){
var oldDockedShape = this._commandArg.dockedShape;
var newPositionAbsolute = this.docker.bounds.center();
var oldPositionAbsolute = this._commandArg.refPoint;
var newDockedShape = this.docker.getDockedShape();
if (typeof newDockedShape !== "undefined") {
var newPositionRelative = this.facade.getCanvas().node.ownerSVGElement.createSVGPoint();
newPositionRelative.x = Math.abs((newDockedShape.bounds.lowerRight().x - newPositionAbsolute.x) / newDockedShape.bounds.width());
newPositionRelative.y = Math.abs((newDockedShape.bounds.lowerRight().y - newPositionAbsolute.y) / newDockedShape.bounds.height());
} else {
// if newDockedShape is not defined, i.e. it is the canvas, use absolutePositions, because positions relative to the canvas are absolute
newPositionRelative = newPositionAbsolute;
}
if (typeof oldDockedShape !== "undefined") {
var oldPositionRelative = this.facade.getCanvas().node.ownerSVGElement.createSVGPoint();
oldPositionRelative.x = Math.abs((oldDockedShape.bounds.lowerRight().x - oldPositionAbsolute.x) / oldDockedShape.bounds.width());
oldPositionRelative.y = Math.abs((oldDockedShape.bounds.lowerRight().y - oldPositionAbsolute.y) / oldDockedShape.bounds.height());
} else {
// if oldDockedShape is not defined, i.e. it is the canvas, use absolutePositions, because positions relative to the canvas are absolute
oldPositionRelative = oldPositionAbsolute;
}
// instanciate the dockCommand
var command = new ORYX.Core.Commands["DragDocker.DragDockerCommand"](this.docker, newPositionRelative, oldPositionRelative, newDockedShape, oldDockedShape, this.facade);
this.facade.executeCommands([command]);
}
}
}
// Update all Shapes
//this.facade.updateSelection();
// Undefined all variables
this.docker = undefined;
this.dockerParent = undefined;
this.dockerSource = undefined;
this.dockerTarget = undefined;
this.lastUIObj = undefined;
},
/**
* Hide the highlighting
*/
hideHighlight: function() {
this.facade.raiseEvent({type:ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE, highlightId:'validDockedShape'});
},
/**
* Show the highlighting
*
*/
showHighlight: function(uiObj, color) {
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_HIGHLIGHT_SHOW,
highlightId:'validDockedShape',
elements: [uiObj],
color: color
});
},
showMagnets: function(uiObj){
uiObj.magnets.each(function(magnet) {
magnet.show();
});
},
hideMagnets: function(uiObj){
uiObj.magnets.each(function(magnet) {
magnet.hide();
});
},
getHighestParentBeforeCanvas: function(shape) {
if(!(shape instanceof ORYX.Core.Shape)) {return undefined;}
var parent = shape.parent;
while(parent && !(parent.parent instanceof ORYX.Core.Canvas)) {
parent = parent.parent;
}
return parent;
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* @namespace Oryx name space for plugins
* @name ORYX.Plugins
*/
if(!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Plugins.SideTabs =
{
construct: function construct(facade) {
this.facade = facade;
this.showCallbacks = {};
this.tabWidth = 233;
this.sidebar = document.createElement('div');
this.sidebar.setAttribute('id', 'pwave-tabbar');
this.sidebar.appendChild(document.createElement('ul'));
jQuery(this.sidebar)
.tabs({collapsible: true})
.removeClass('ui-corner-all');
jQuery(this.sidebar).children()
.removeClass('ui-corner-bottom')
.removeClass('ui-corner-top');
// Execute callback when tab is selected
jQuery(this.sidebar).bind('tabsshow', function(event, ui) {
if (typeof this.showCallbacks[ui.panel.id] === 'function') {
this.showCallbacks[ui.panel.id]();
}
}.bind(this));
jQuery(this.sidebar).bind('tabsadd', this._closeAllTabs.bind(this));
this.sidebarWrapper = document.createElement('div'); // used to position the bar fixed
this.sidebarWrapper.setAttribute('id', 'pwave-tabbar-wrapper');
this.sidebarWrapper.appendChild(this.sidebar);
this.canvasContainer = $$(".ORYX_Editor")[0].parentNode;
this.canvasContainer.appendChild(this.sidebarWrapper);
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SIDEBAR_NEW_TAB, this.registerNewTab.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MODE_CHANGED, this._handleModeChanged.bind(this));
window.addEventListener("resize", this.handleWindowResize.bind(this), false);
this.facade.raiseEvent({
'type' : ORYX.CONFIG.EVENT_SIDEBAR_LOADED
});
},
registerNewTab: function registerNewTab(event) {
var tabObj = {
'tabid': event.tabid,
'title': event.tabTitle, // title text label for the new tab
'div': event.tabDivEl, // the HTML DIV Element to be rendered in the new tab
'order': event.tabOrder, // number determining the position in the tab list
'width': event.tabWidth, // dimensions for the new tab
'height': Math.max(150, event.tabHeight),
'displayHandler': event.displayHandler,
'storeRenameFunction': event.storeRenameFunction
};
jQuery(this.sidebar).tabs("add", "#tabs-" + tabObj.tabid, tabObj.title, tabObj.order);
var header = jQuery("<div>", {'class': 'pwave-tab-header'});
var headerHighlight = jQuery("<div>", {'class': 'pwave-tab-header-highlight'});
var headerLabel = jQuery("<div>", {'class': 'pwave-tab-header-label'}).html(tabObj.title);
var headerMinimize = jQuery("<div>", {'class': 'pwave-tab-header-minimize'});
jQuery(header).append(headerHighlight).append(headerLabel).append(headerMinimize);
jQuery(header).click(this._closeAllTabs.bind(this));
if (typeof tabObj.storeRenameFunction === 'function') {
tabObj.storeRenameFunction(function renameHeader(name) {
headerLabel.html(name);
});
}
var scrollContainer = jQuery("<div>", {
'class': 'scrollcontainer'
}).append(tabObj.div);
jQuery('#tabs-'+tabObj.tabid).append(header);
jQuery('#tabs-'+tabObj.tabid).append(scrollContainer);
this.showCallbacks['tabs-'+tabObj.tabid] = tabObj.displayHandler;
},
_handleModeChanged: function _handleModeChanged(event) {
if (event.mode.isEditMode()) {
this.sidebar.show();
} else {
this.sidebar.hide();
}
if (event.mode.isPaintMode()) {
this._closeAllTabs();
}
},
_closeAllTabs: function _closeAllTabs() {
if (jQuery(this.sidebar).tabs('option', 'selected') !== -1) {
jQuery(this.sidebar).tabs('select', -1);
}
},
handleWindowResize: function handleWindowResize() {
this.sidebarWrapper.style.bottom = 0 + this.getCanvasScrollbarOffsetForHeight() + 'px';
this.sidebarWrapper.style.right = 20 + this.getCanvasScrollbarOffsetForWidth() + 'px';
},
getCanvasScrollbarOffsetForWidth: function getCanvasScrollbarOffsetForWidth() {
return this.canvasContainer.offsetWidth - this.canvasContainer.clientWidth;
},
getCanvasScrollbarOffsetForHeight: function getCanvasScrollbarOffsetForHeight() {
return this.canvasContainer.offsetHeight - this.canvasContainer.clientHeight;
}
};
ORYX.Plugins.SideTabs = ORYX.Plugins.AbstractPlugin.extend(ORYX.Plugins.SideTabs);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if (!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Plugins.Farbrausch = Clazz.extend({
facade: undefined,
_userObjects: {},
_colorMapping: {},
_firstUpdateReceived: false,
_colorPalette: ["#cc0000",
"#33cc00",
"#ff9900",
"#9acd32",
"#0099cc",
"#000099",
"#336633",
"#cc00cc",
"#ffff66",
"#990066",
"#660000",
"#a9a9a9",
"#ffffff",
"#33ccff",
"#ff69b4",
"#ff9999",
"#2e8b57",
"#daa520"],
_defaultColor: "#000000",
construct: function construct(facade) {
this.facade = facade;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_NEW_POST_MESSAGE_RECEIVED, this.handleNewPostMessageReceived.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MODE_CHANGED, this._handleModeChanged.bind(this));
},
_handleModeChanged: function _handleModeChanged(evt) {
if (evt.mode.isEditMode() && !(this.facade.getUserId() in this._colorMapping)) {
this.pickOwnColor();
}
},
pickOwnColor: function pickOwnColor() {
//it is possible that the mode_changed event arrives before the very first stateUpdated
//since we need the information of the stateUpdated-Callback, we have to wait
if (!this._firstUpdateReceived) {
setTimeout(this.pickOwnColor.bind(this), 1000 * Math.random());
return;
}
var selfId = this.facade.getUserId();
if (!(selfId in this._colorMapping)) {
this._saveColor(selfId, this._getNextFreeColor());
}
},
handleNewPostMessageReceived: function handleNewPostMessageReceived(event) {
var data = event.data;
if (data.target !== "farbrausch") {
return;
}
if (data.action === "update") {
this._firstUpdateReceived = true;
this._mergeColorMapping(data.message.mapping);
} else if (data.action === "participants") {
this._mergeParticipants(data.message.participants);
} else {
throw "Unknown farbrausch action: " + data.action;
}
this._raiseFarbrauschNewInfosEvent();
},
_mergeParticipants: function _mergeParticipants(participants) {
for (var i = 0; i < participants.length; i++) {
var participant = participants[i];
if (!this._userObjects.hasOwnProperty(participant.id)) {
this._userObjects[participant.id] = participant;
}
}
},
_mergeColorMapping: function _mergeColorMapping(mapping) {
var keys = this._getKeys(mapping);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
this._colorMapping[key] = mapping[key];
}
this._conflictHandling();
},
_raiseFarbrauschNewInfosEvent: function _raiseFarbrauschNewInfosEvent() {
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_FARBRAUSCH_NEW_INFOS,
users: this._getMergedColorMappingAndUserObjects(),
ownUserId: this.facade.getUserId()
});
},
_getMergedColorMappingAndUserObjects: function _getMergeColorMappingAndUserObjects() {
var eventData = {};
for (var key in this._colorMapping) {
if (this._colorMapping.hasOwnProperty(key) && this._userObjects.hasOwnProperty(key)) {
eventData[key] = {
id: this._userObjects[key].id,
thumbnailUrl: this._userObjects[key].thumbnailUrl,
displayName: this._userObjects[key].displayName,
color: this._colorMapping[key],
isCreator: this._userObjects[key].isCreator
};
}
}
return eventData;
},
_conflictHandling: function _conflictHandling() {
var selfId = this.facade.getUserId();
var ids = this._getKeys(this._colorMapping);
var selfColor = this._colorMapping[selfId];
if (selfColor === this._defaultColor) {
// No conflict resolution when default color.
return;
}
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
if (this._colorMapping[id] === selfColor && selfId < id) {
this._saveColor(selfId, this._getNextFreeColor());
break;
}
}
},
_saveColor: function _saveColor(userId, color) {
this._colorMapping[userId] = color;
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_POST_MESSAGE,
target: "farbrausch",
action: "setColor",
message: {
"id": userId,
"color": color
}
});
},
_getNextFreeColor: function _getNextFreeColor() {
var unusedColors = this._arrayDifference(this._colorPalette, this._getValues(this._colorMapping));
if (unusedColors.length !== 0) {
return unusedColors[0];
}
return this._defaultColor;
},
_getColor: function _getColor(index) {
if (index < this._colorPalette.length) {
return this._colorPalette[index];
}
return this._defaultColor;
},
_getKeys: function _getKeys(hash) {
var keys = [];
for(i in hash) {
if (hash.hasOwnProperty(i)) {
keys.push(i);
}
}
return keys;
},
_getValues: function _getValues(hash) {
var values = [];
for(i in hash) {
if (hash.hasOwnProperty(i)) {
values.push(hash[i]);
}
}
return values;
},
_arrayDifference: function _arrayDifference(a1, a2) {
var difference = [];
for (var i = 0; i < a1.length; i++) {
if (this._notIn(a1[i], a2)) {
difference.push(a1[i]);
}
}
return difference;
},
_notIn: function _notIn(element, array) {
for (var i = 0; i < array.length; i++) {
if (array[i] === element) {
return false;
}
}
return true;
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if(!ORYX.Plugins) {
ORYX.Plugins = new Object();
}
ORYX.Plugins.Toolbar = Clazz.extend({
facade: undefined,
plugs: [],
construct: function(facade, ownPluginData) {
this.facade = facade;
this.groupIndex = new Hash();
ownPluginData.properties.each((function(value){
if(value.group && value.index != undefined) {
this.groupIndex[value.group] = value.index
}
}).bind(this));
Ext.QuickTips.init();
this.buttons = [];
this.mode;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_BUTTON_UPDATE, this.onButtonUpdate.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_AFTER_COMMANDS_EXECUTED, this.onAfterCommandsExecutedOrRollbacked.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_AFTER_COMMANDS_ROLLBACK, this.onAfterCommandsExecutedOrRollbacked.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MODE_CHANGED, this.handleModeChanged.bind(this));
},
/**
* Can be used to manipulate the state of a button.
* @example
* this.facade.raiseEvent({
* type: ORYX.CONFIG.EVENT_BUTTON_UPDATE,
* id: this.buttonId, // have to be generated before and set in the offer method
* pressed: true
* });
* @param {Object} event
*/
onButtonUpdate: function(event){
var button = this.buttons.find(function(button){
return button.id === event.id;
});
if(event.pressed !== undefined){
button.buttonInstance.toggle(event.pressed);
}
},
registryChanged: function(pluginsData) {
// Sort plugins by group and index
var newPlugs = pluginsData.sortBy((function(value) {
return ((this.groupIndex[value.group] != undefined ? this.groupIndex[value.group] : "" ) + value.group + "" + value.index).toLowerCase();
}).bind(this));
var plugs = $A(newPlugs).findAll(function(value){
return !this.plugs.include( value )
}.bind(this));
if(plugs.length<1)
return;
this.buttons = [];
ORYX.Log.trace("Creating a toolbar.")
var canvasContainer = $$(".ORYX_Editor")[0].parentNode;
if(!this.toolbar){
this.toolbar = new Ext.ux.SlicedToolbar();
var region = this.facade.addToRegion("center", this.toolbar, "Toolbar");
//this.canvasContainer = $$(".ORYX_Editor")[0].parentNode;
//this.canvasContainer.appendChild(this.toolbar.getEl());
}
var currentGroupsName = this.plugs.last()?this.plugs.last().group:plugs[0].group;
// Map used to store all drop down buttons of current group
var currentGroupsDropDownButton = {};
plugs.each((function(value) {
if(!value.name) {return}
this.plugs.push(value);
// Add seperator if new group begins
if(currentGroupsName != value.group) {
this.toolbar.add('-');
currentGroupsName = value.group;
currentGroupsDropDownButton = {};
}
//add eventtracking
var tmp = value.functionality;
value.functionality = function(){
if ("undefined" != typeof(pageTracker) && "function" == typeof(pageTracker._trackEvent) )
{
pageTracker._trackEvent("ToolbarButton",value.name)
}
return tmp.apply(this, arguments);
}
// If an drop down group icon is provided, a split button should be used
if(value.dropDownGroupIcon){
var splitButton = currentGroupsDropDownButton[value.dropDownGroupIcon];
// Create a new split button if this is the first plugin using it
if(splitButton === undefined){
splitButton = currentGroupsDropDownButton[value.dropDownGroupIcon] = new Ext.Toolbar.SplitButton({
cls: "x-btn-icon", //show icon only
icon: value.dropDownGroupIcon,
menu: new Ext.menu.Menu({
items: [] // items are added later on
}),
listeners: {
click: function(button, event){
// The "normal" button should behave like the arrow button
if(!button.menu.isVisible() && !button.ignoreNextClick){
button.showMenu();
} else {
button.hideMenu();
}
}
}
});
this.toolbar.add(splitButton);
}
// General config button which will be used either to create a normal button
// or a check button (if toggling is enabled)
var buttonCfg = {
icon: value.icon,
iconCls: value.iconClass,
text: value.name,
itemId: value.id,
handler: value.toggle ? undefined : value.functionality,
checkHandler: value.toggle ? value.functionality : undefined,
listeners: {
render: function(item){
// After rendering, a tool tip should be added to component
if (value.description) {
new Ext.ToolTip({
target: item.getEl(),
title: value.description
})
}
}
}
}
// Create buttons depending on toggle
if(value.toggle) {
var button = new Ext.menu.CheckItem(buttonCfg);
} else {
var button = new Ext.menu.Item(buttonCfg);
}
splitButton.menu.add(button);
} else { // create normal, simple button
var button = new Ext.Toolbar.Button({
icon: value.icon, // icons can also be specified inline
cls: 'x-btn-icon', // Class who shows only the icon
iconCls: value.iconCls,
itemId: value.id,
tooltip: value.description, // Set the tooltip
tooltipType: 'title', // Tooltip will be shown as in the html-title attribute
handler: value.toggle ? null : value.functionality, // Handler for mouse click
enableToggle: value.toggle, // Option for enabling toggling
toggleHandler: value.toggle ? value.functionality : null // Handler for toggle (Parameters: button, active)
});
this.toolbar.add(button);
button.getEl().onclick = function() {this.blur()}
}
value['buttonInstance'] = button;
this.buttons.push(value);
}).bind(this));
this.enableButtons([]);
},
onAfterCommandsExecutedOrRollbacked: function onAfterCommandsExecutedOrRollbacked(event) {
this.enableButtons(this.facade.getSelection());
},
onSelectionChanged: function(event) {
this.enableButtons(event.elements);
},
enableButtons: function(elements) {
// Show the Buttons
this.buttons.each((function(value){
value.buttonInstance.enable();
// If there is less elements than minShapes
if (value.minShape && value.minShape > elements.length)
value.buttonInstance.disable();
// If there is more elements than minShapes
if (value.maxShape && value.maxShape < elements.length)
value.buttonInstance.disable();
// If the plugin is not enabled
if (value.isEnabled && !value.isEnabled())
value.buttonInstance.disable();
// If mode is not defined disable Buttons
if (!this.mode && !value.visibleInViewMode)
value.buttonInstance.disable();
// If in editMode disable Buttons
if ((this.mode && !this.mode.isEditMode() && !value.visibleInViewMode))
value.buttonInstance.disable();
// If in paintMode disableButtons
if ((this.mode && this.mode.isPaintMode() && !value.visibleInViewMode))
value.buttonInstance.disable();
}).bind(this));
},
handleModeChanged: function handleModeChanged(event) {
this.mode = event.mode;
this.enableButtons(this.facade.getSelection())
//Hide Buttons in ViewMode
if (!event.mode.isEditMode()) {
this.buttons.each(function (value) {
if (!value.visibleInViewMode) {
value.buttonInstance.hide();
}
});
var hideDelimiter = true;
this.toolbar.items.each(function (item) {
if (item instanceof Ext.Toolbar.Separator && hideDelimiter) {
item.hide();
} else if (!(item instanceof Ext.Toolbar.Separator)) {
hideDelimiter = item.hidden;
}
});
} else {
this.toolbar.items.each(function (item) {
item.show();
});
}
}
});
Ext.ns("Ext.ux");
Ext.ux.SlicedToolbar = Ext.extend(Ext.Toolbar, {
currentSlice: 0,
iconStandardWidth: 22, //22 px
seperatorStandardWidth: 2, //2px, minwidth for Ext.Toolbar.Fill
toolbarStandardPadding: 2,
initComponent: function(){
Ext.apply(this, {
});
Ext.ux.SlicedToolbar.superclass.initComponent.apply(this, arguments);
},
onRender: function(){
Ext.ux.SlicedToolbar.superclass.onRender.apply(this, arguments);
},
onResize: function(){
Ext.ux.SlicedToolbar.superclass.onResize.apply(this, arguments);
}
/*calcSlices: function(){
var slice = 0;
this.sliceMap = {};
var sliceWidth = 0;
var toolbarWidth = this.getEl().getWidth();
this.items.getRange().each(function(item, index){
//Remove all next and prev buttons
if (item.helperItem) {
item.destroy();
return;
}
var itemWidth = item.getEl().getWidth();
if(sliceWidth + itemWidth + 5 * this.iconStandardWidth > toolbarWidth){
var itemIndex = this.items.indexOf(item);
this.insertSlicingButton("next", slice, itemIndex);
if (slice !== 0) {
this.insertSlicingButton("prev", slice, itemIndex);
}
this.insertSlicingSeperator(slice, itemIndex);
slice += 1;
sliceWidth = 0;
}
this.sliceMap[item.id] = slice;
sliceWidth += itemWidth;
}.bind(this));
// Add prev button at the end
if(slice > 0){
this.insertSlicingSeperator(slice, this.items.getCount()+1);
this.insertSlicingButton("prev", slice, this.items.getCount()+1);
var spacer = new Ext.Toolbar.Spacer();
this.insertSlicedHelperButton(spacer, slice, this.items.getCount()+1);
Ext.get(spacer.id).setWidth(this.iconStandardWidth);
}
this.maxSlice = slice;
// Update view
this.setCurrentSlice(this.currentSlice);
},
insertSlicedButton: function(button, slice, index){
this.insertButton(index, button);
this.sliceMap[button.id] = slice;
},
insertSlicedHelperButton: function(button, slice, index){
button.helperItem = true;
this.insertSlicedButton(button, slice, index);
},
insertSlicingSeperator: function(slice, index){
// Align right
this.insertSlicedHelperButton(new Ext.Toolbar.Fill(), slice, index);
},
// type => next or prev
insertSlicingButton: function(type, slice, index){
var nextHandler = function(){this.setCurrentSlice(this.currentSlice+1)}.bind(this);
var prevHandler = function(){this.setCurrentSlice(this.currentSlice-1)}.bind(this);
var button = new Ext.Toolbar.Button({
cls: "x-btn-icon",
icon: ORYX.CONFIG.ROOT_PATH + "images/toolbar_"+type+".png",
handler: (type === "next") ? nextHandler : prevHandler
});
this.insertSlicedHelperButton(button, slice, index);
},
setCurrentSlice: function(slice){
if(slice > this.maxSlice || slice < 0) return;
this.currentSlice = slice;
this.items.getRange().each(function(item){
item.setVisible(slice === this.sliceMap[item.id]);
}.bind(this));
}*/
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if (!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Plugins.FarbrauschLegend = ORYX.Plugins.AbstractPlugin.extend({
_users: {},
usersDiv: null,
tabEntriesLastActivity: {},
tabEntries: {},
construct: function construct() {
arguments.callee.$.construct.apply(this, arguments);
this.usersDiv = this.createUsersTab();
Element.extend(this.usersDiv);
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_FARBRAUSCH_NEW_INFOS, this.handleFarbrauschEvent.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_AFTER_COMMANDS_EXECUTED, this.handleEventExecuted.bind(this));
},
onLoaded: function onLoaded(event) {
this.addUsersTab();
},
addUsersTab: function addUsersTab() {
this.facade.raiseEvent({
'tabid': 'pwave-users',
'type': ORYX.CONFIG.EVENT_SIDEBAR_NEW_TAB,
'forceExecution': true,
'tabTitle': 'Editors',
'tabOrder': 0,
'tabDivEl': this.usersDiv
});
},
createUsersTab: function createUsersTab() {
return document.createElement('div');
},
addEntryForId: function addEntryForId(userId) {
var entry = Element.extend(document.createElement('div'));
entry.className = "entry";
var colorDiv = Element.extend(document.createElement('div'));
colorDiv.className = "userColor";
entry.appendChild(colorDiv);
var imgDiv = Element.extend(document.createElement('div'));
imgDiv.className = "userAvatar";
var img = Element.extend(document.createElement('img'));
imgDiv.appendChild(img);
entry.appendChild(imgDiv);
var infoDiv = Element.extend(document.createElement('div'));
infoDiv.className = "userInfo";
entry.appendChild(infoDiv);
var lastActivity = Element.extend(document.createElement('div'));
lastActivity.className = "userLastActivity";
this.tabEntriesLastActivity[userId] = lastActivity;
entry.appendChild(lastActivity);
this.tabEntries[userId] = entry;
this.updateEntryForId(userId);
this.usersDiv.appendChild(entry);
},
updateEntryForId: function updateEntryForId(userId) {
var entry = this.tabEntries[userId];
if (typeof entry === "undefined") {
return;
}
entry.getElementsByClassName("userColor")[0].style.backgroundColor = this._getColorById(userId);
entry.getElementsByClassName("userAvatar")[0].firstChild.setAttribute("src", this._getThumbnailUrlById(userId));
entry.getElementsByClassName("userInfo")[0].update(this._getDisplayNameById(userId));
},
handleFarbrauschEvent: function handleFarbrauschEvent(evt) {
for (var userId in evt.users) {
if (!evt.users.hasOwnProperty(userId)) {
return;
}
var evtUser = evt.users[userId];
var user = this._users[userId];
if (typeof user === "undefined") {
this._users[userId] = evtUser;
this.addEntryForId(userId);
} else if (evtUser.color !== user.color || evtUser.displayName !== user.displayName || evtUser.thumbnailUrl !== user.thumbnailUrl){
this._users[userId] = evtUser;
this.updateEntryForId(userId);
}
}
},
handleEventExecuted: function handleEventExecuted(evt) {
var command = evt.commands[0];
var userId = command.getCreatorId()
this.updateLastAction(userId, command.getCreatedAt());
},
updateLastAction: function updateLastAction(userId, timestamp) {
var date = new Date(timestamp);
var day = String(date.getDate());
if (day.length === 1) {
day = "0" + day;
}
var month = String(date.getMonth() + 1);
if (month.length === 1) {
month = "0" + month;
}
var year = String(date.getFullYear());
var hour = String(date.getHours());
if (hour.length === 1) {
hour = "0" + hour;
}
var minute = String(date.getMinutes());
if (minute.length === 1) {
minute = "0" + minute;
}
var userEntry = this.tabEntriesLastActivity[userId];
if (typeof userEntry !== "undefined") {
this.tabEntriesLastActivity[userId].update("Last Action: " + day + "." + month + "." + year + ", " + hour + ":" + minute);
}
},
_getThumbnailUrlById: function _getThumbnailUrlById(id) {
var user = this._users[id];
if (user) {
return user.thumbnailUrl;
}
return "https://wave.google.com/wave/static/images/unknown.jpg";
},
_getColorById: function _getColorById(id) {
var user = this._users[id];
if (user) {
return user.color;
}
return "#000000";
},
_getDisplayNameById: function _getThumbnailUrlById(id) {
var user = this._users[id];
if (user) {
return user.displayName;
}
return "Anonymous";
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if(!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Core.Commands["DockerCreation.NewDockerCommand"] = ORYX.Core.AbstractCommand.extend({
construct: function construct(addEnabled, deleteEnabled, edge, docker, pos, facade, args){
// call construct method of parent
arguments.callee.$.construct.call(this, facade);
this.addEnabled = addEnabled;
this.deleteEnabled = deleteEnabled;
this.edge = edge;
this.docker = docker;
this.pos = pos;
this.facade = facade;
this.id = args.dockerId;
this.index = args.index;
this.options = args.options;
},
execute: function(){
if (this.addEnabled) {
this.docker = this.edge.addDocker(this.pos, this.docker, this.id);
if (typeof this.docker === "undefined") {
this.docker = this.edge.createDocker(this.index, this.pos, this.id);
} else {
this.index = this.edge.dockers.indexOf(this.docker);
}
} else if (this.deleteEnabled) {
if (typeof this.docker !== "undefined") {
this.index = this.edge.dockers.indexOf(this.docker);
this.pos = this.docker.bounds.center();
this.edge.removeDocker(this.docker);
}
}
this.facade.getCanvas().update();
this.facade.updateSelection();
this.options.docker = this.docker;
},
rollback: function(){
if (this.addEnabled) {
if (this.docker instanceof ORYX.Core.Controls.Docker) {
this.edge.removeDocker(this.docker);
}
} else if (this.deleteEnabled) {
if (typeof this.docker !== "undefined") {
this.edge.add(this.docker, this.index);
}
}
this.facade.getCanvas().update();
this.facade.updateSelection();
},
getCommandData: function getCommandData() {
var getId = function(shape) { return shape.resourceId; };
var getDockerId = function(docker) {
var dockerId;
if (typeof docker !== "undefined") {
dockerId = docker.id;
}
return dockerId;
};
var cmd = {
"index": this.index,
"name": "DockerCreation.NewDockerCommand",
"addEnabled": this.addEnabled,
"deleteEnabled": this.deleteEnabled,
"edgeId": getId(this.edge),
"dockerPositionArray": this.pos,
"dockerId": getDockerId(this.docker)
};
return cmd;
} ,
createFromCommandData: function createFromCommandData(facade, cmdData){
var addEnabled = cmdData.addEnabled;
var deleteEnabled = cmdData.deleteEnabled;
var canvas = facade.getCanvas();
var getShape = canvas.getChildShapeByResourceId.bind(canvas);
var edge = getShape(cmdData.edgeId);
var docker;
if (typeof edge === 'undefined') {
// Trying to add a docker to a already deleted edge.
return undefined;
}
if (deleteEnabled) {
for (var i = 0; i < edge.dockers.length; i++) {
if (edge.dockers[i].id == cmdData.dockerId) {
docker = edge.dockers[i];
}
}
}
if (addEnabled) {
var dockerPositionArray = cmdData.dockerPositionArray;
var position = canvas.node.ownerSVGElement.createSVGPoint();
position.x = dockerPositionArray.x;
position.y = dockerPositionArray.y;
}
var args = {
"dockerId": cmdData.dockerId,
"index": cmdData.index,
"options": {}
};
return new ORYX.Core.Commands["DockerCreation.NewDockerCommand"](addEnabled, deleteEnabled, edge, docker, position, facade, args);
},
getCommandName: function getCommandName() {
return "DockerCreation.NewDockerCommand";
},
getDisplayName: function getDisplayName() {
if (this.addEnabled) {
return "Docker added";
}
return "Docker deleted";
},
getAffectedShapes: function getAffectedShapes() {
return [this.edge];
}
});
ORYX.Plugins.DockerCreation = Clazz.extend({
construct: function( facade ){
this.facade = facade;
this.active = false; //true-> a ghostdocker is shown; false->ghostdocker is hidden
this.point = {x:0, y:0}; //Ghostdocker
this.ctrlPressed = false;
this.creationAllowed = true; // should be false if the addDocker button is pressed, otherwise there are always two dockers added when ALT+Clicking in docker-mode!
//visual representation of the Ghostdocker
this.circle = ORYX.Editor.graft("http://www.w3.org/2000/svg", null ,
['g', {"pointer-events":"none"},
['circle', {cx: "8", cy: "8", r: "3", fill:"yellow"}]]);
this.facade.offer({
keyCodes: [{
keyCode: 18,
keyAction: ORYX.CONFIG.KEY_ACTION_UP
}],
functionality: this.keyUp.bind(this)
});
this.facade.offer({
keyCodes: [{
metaKeys: [ORYX.CONFIG.META_KEY_ALT],
keyCode: 18,
keyAction: ORYX.CONFIG.KEY_ACTION_DOWN
}],
functionality: this.keyDown.bind(this)
});
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MOUSEDOWN, this.handleMouseDown.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MOUSEOVER, this.handleMouseOver.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MOUSEOUT, this.handleMouseOut.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MOUSEMOVE, this.handleMouseMove.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_DISABLE_DOCKER_CREATION, this.handleDisableDockerCreation.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_ENABLE_DOCKER_CREATION, this.handleEnableDockerCreation.bind(this));
/*
* Double click is reserved for label access, so abort action
*/
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_DBLCLICK, function() { window.clearTimeout(this.timer); }.bind(this));
/*
* click is reserved for selecting, so abort action when mouse goes up
*/
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MOUSEUP, function() { window.clearTimeout(this.timer); }.bind(this));
},
keyDown: function keyDown(event) {
this.ctrlPressed = true;
},
keyUp: function keyUp(event) {
this.ctrlPressed = false;
this.hideOverlay();
this.active = false;
},
handleDisableDockerCreation: function handleDisableDockerCreation(event) {
this.creationAllowed = false;
},
handleEnableDockerCreation: function handleEnableDockerCreation(event) {
this.creationAllowed = true;
},
/**
* MouseOut Handler
*
*hide the Ghostpoint when Leaving the mouse from an edge
*/
handleMouseOut: function handleMouseOut(event, uiObj) {
if (this.active) {
this.hideOverlay();
this.active = false;
}
},
/**
* MouseOver Handler
*
*show the Ghostpoint if the edge is selected
*/
handleMouseOver: function handleMouseOver(event, uiObj) {
this.point.x = this.facade.eventCoordinates(event).x;
this.point.y = this.facade.eventCoordinates(event).y;
// show the Ghostdocker on the edge
if (uiObj instanceof ORYX.Core.Edge && this.ctrlPressed && this.creationAllowed) {
this.showOverlay(uiObj, this.point);
//ghostdocker is active
this.active = true;
}
},
/**
* MouseDown Handler
*
*create a Docker when clicking on a selected edge
*/
handleMouseDown: function handleMouseDown(event, uiObj) {
if (this.ctrlPressed && this.creationAllowed && event.which==1) {
if (uiObj instanceof ORYX.Core.Edge){
this.addDockerCommand({
edge: uiObj,
event: event,
position: this.facade.eventCoordinates(event)
});
this.hideOverlay();
} else if (uiObj instanceof ORYX.Core.Controls.Docker && uiObj.parent instanceof ORYX.Core.Edge) {
//check if uiObj is not the first or last docker of its parent, if not so instanciate deleteCommand
if ((uiObj.parent.dockers.first() !== uiObj) && (uiObj.parent.dockers.last() !== uiObj)) {
this.deleteDockerCommand({
edge: uiObj.parent,
docker: uiObj
});
}
}
}
},
//
/**
* MouseMove Handler
*
*refresh the ghostpoint when moving the mouse over an edge
*/
handleMouseMove: function handleMouseMove(event, uiObj) {
if (uiObj instanceof ORYX.Core.Edge && this.ctrlPressed && this.creationAllowed) {
this.point.x = this.facade.eventCoordinates(event).x;
this.point.y = this.facade.eventCoordinates(event).y;
if (this.active) {
//refresh Ghostpoint
this.hideOverlay();
this.showOverlay(uiObj, this.point);
} else {
this.showOverlay(uiObj, this.point);
}
}
},
/**
* Command for creating a new Docker
*
* @param {Object} options
*/
addDockerCommand: function addDockerCommand(options){
if(!options.edge)
return;
var args = {
"options": options
};
var command = new ORYX.Core.Commands["DockerCreation.NewDockerCommand"](true, false, options.edge, options.docker, options.position, this.facade, args);
this.facade.executeCommands([command]);
this.facade.raiseEvent({
uiEvent: options.event,
type: ORYX.CONFIG.EVENT_DOCKERDRAG
}, options.docker );
},
deleteDockerCommand: function deleteDockerCommand(options){
if(!options.edge) {
return;
}
var args = { "options": options };
var command = new ORYX.Core.Commands["DockerCreation.NewDockerCommand"](false, true, options.edge, options.docker, options.position, this.facade, args);
this.facade.executeCommands([command]);
},
/**
*show the ghostpoint overlay
*
*@param {Shape} edge
*@param {Point} point
*/
showOverlay: function showOverlay(edge, point) {
if (this.facade.isReadOnlyMode()) {
return;
}
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_OVERLAY_SHOW,
id: "ghostpoint",
shapes: [edge],
node: this.circle,
ghostPoint: point,
dontCloneNode: true
});
},
/**
*hide the ghostpoint overlay
*/
hideOverlay: function hideOverlay() {
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_OVERLAY_HIDE,
id: "ghostpoint"
});
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if(!ORYX.Plugins)
ORYX.Plugins = new Object();
ORYX.Plugins.Changelog =
{
construct: function construct() {
arguments.callee.$.construct.apply(this, arguments);
this.changelogDiv = document.createElement('div');
this.isEmpty = true;
var emptyDiv = Element.extend(document.createElement('div'));
emptyDiv.update("No changes so far.");
emptyDiv.className = "empty";
this.changelogDiv.appendChild(emptyDiv);
this.undologDiv = document.createElement('div');
this.undologDiv.className = "undolog";
this.changelogDiv.appendChild(this.undologDiv);
this.redologDiv = document.createElement('div');
this.redologDiv.className = "redolog";
this.changelogDiv.appendChild(this.redologDiv);
this.undolog = {};
this.redolog = {};
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_COMMAND_ADDED_TO_UNDO_STACK, this.addCommandToUndolog.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_COMMAND_MOVED_FROM_UNDO_STACK, this.moveCommandToRedolog.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_COMMAND_MOVED_FROM_REDO_STACK, this.moveCommandToUndolog.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_AFTER_COMMANDS_ROLLBACK, this.removeCommandFromUndolog.bind(this)); // syncro reverted a command
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_FARBRAUSCH_NEW_INFOS, this.updateFarbrauschInfos.bind(this));
},
onLoaded: function onLoaded(event) {
this.createChangelogTab();
},
createChangelogTab: function createChangelogTab() {
this.facade.raiseEvent({
'tabid': 'pwave-changelog',
'type': ORYX.CONFIG.EVENT_SIDEBAR_NEW_TAB,
'forceExecution': true,
'tabTitle': 'Changelog',
'tabOrder': 1,
'tabDivEl': this.changelogDiv,
'displayHandler': this.refreshChangelog.bind(this)
});
},
addCommandToUndolog: function addCommandToUndolog(event) {
var command = event.commands[0];
var entry = this.createCommandDiv(command);
if (this.isEmpty) {
this.isEmpty = false;
this.changelogDiv.removeChild(this.changelogDiv.firstChild);
}
this.undologDiv.appendChild(entry);
this.undolog[command.getCommandId()] = entry;
this.refreshChangelog();
this.clearRedolog();
},
moveCommandToRedolog: function moveCommandToRedolog(event) {
var command = event.commands[0];
var commandDiv = this.undolog[command.getCommandId()];
if (typeof commandDiv === 'undefined') {
ORYX.Log.warn("Could not find command " + command.getCommandName() + " " + command.getCommandId() + " in undolog.");
return;
}
this.undologDiv.removeChild(commandDiv);
delete this.undolog[command.getCommandId()];
this.redologDiv.insertBefore(commandDiv, this.redologDiv.firstChild);
this.redolog[command.getCommandId()] = commandDiv;
},
moveCommandToUndolog: function moveCommandToUndolog(event) {
var command = event.commands[0];
var commandDiv = this.redolog[command.getCommandId()];
if (typeof commandDiv === 'undefined') {
ORYX.Log.warn("Could not find command " + command.getCommandName() + " " + command.getCommandId() + " in redolog.");
return;
}
this.redologDiv.removeChild(commandDiv);
delete this.redolog[command.getCommandId()];
this.undologDiv.appendChild(commandDiv);
this.undolog[command.getCommandId()] = commandDiv;
},
removeCommandFromUndolog: function removeCommandFromUndolog(event) {
var command = event.commands[0];
var commandDiv = this.undolog[command.getCommandId()];
if (typeof commandDiv === 'undefined') {
ORYX.Log.warn("Could not find command " + command.getCommandName() + " " + command.getCommandId() + " in undolog.");
return;
}
this.undologDiv.removeChild(commandDiv);
delete this.undolog[command.getCommandId()];
},
clearRedolog: function clearRedolog() {
while (this.redologDiv.firstChild) {
this.redologDiv.removeChild(this.redologDiv.firstChild);
}
this.redolog = {};
},
createCommandDiv: function createCommandDiv(command) {
var userId = command.getCreatorId();
var entry = Element.extend(document.createElement('div'));
entry.className = "entry";
var colorDiv = Element.extend(document.createElement('div'));
colorDiv.className = "userColor";
colorDiv.style.backgroundColor = this.getColorForUserId(userId);
entry.appendChild(colorDiv);
var commandNameDiv = Element.extend(document.createElement('div'));
commandNameDiv.className = "commandName";
commandNameDiv.update(command.getDisplayName());
entry.appendChild(commandNameDiv);
var date = this.getDateString(command.getCreatedAt())
var dateDiv = Element.extend(document.createElement('div'));
dateDiv.className = "date";
dateDiv.update(date.date);
entry.appendChild(dateDiv);
var usernameDiv = Element.extend(document.createElement('div'));
usernameDiv.className = "username";
usernameDiv.update("by " + this.getDisplayNameForUserId(userId));
entry.appendChild(usernameDiv);
var timeDiv = Element.extend(document.createElement('div'));
timeDiv.className = "time";
timeDiv.update(date.time);
entry.appendChild(timeDiv);
entry.onclick = this.getOnClickFunction(command.getCommandId()).bind(this);
return entry;
},
getDateString: function getDateString(timestamp) {
var date = new Date(timestamp);
var day = String(date.getDate());
if (day.length === 1) {
day = "0" + day;
}
var month = String(date.getMonth() + 1);
if (month.length === 1) {
month = "0" + month;
}
var year = String(date.getFullYear());
var hour = String(date.getHours());
if (hour.length === 1) {
hour = "0" + hour;
}
var minute = String(date.getMinutes());
if (minute.length === 1) {
minute = "0" + minute;
}
return {'date': day + "." + month + "." + year,
'time': hour + ":" + minute};
},
getOnClickFunction: function getOnClickFunction(commandId){
return function onClick() {
if (typeof this.undolog[commandId] !== "undefined") {
var toUndo = this.getFollowingCommands(ORYX.Stacks.undo, commandId);
toUndo.pop();
var commands = toUndo.map(function (command) {
return new ORYX.Core.Commands["WaveGlobalUndo.undoCommand"](command, this.facade);
}.bind(this));
} else if (typeof this.redolog[commandId] !== "undefined") {
var toRedo = this.getFollowingCommands(ORYX.Stacks.redo, commandId);
var commands = toRedo.map(function (command) {
return new ORYX.Core.Commands["WaveGlobalUndo.redoCommand"](command, this.facade);
}.bind(this));
} else {
throw "Changelog: Command not found on undo or redo stack";
}
if (commands.length > 0) {
this.facade.executeCommands(commands);
}
}
},
getFollowingCommands: function(stack, commandId) {
for (var i = 0; i < stack.length; i++) {
var cmd = stack[i][0];
if (cmd.getCommandId() === commandId && i < stack.length) {
return stack.slice(i).reverse();
}
}
return [];
},
updateFarbrauschInfos: function updateFarbrauschInfos(evt) {
this.users = evt.users;
},
getColorForUserId: function getColorForUserId(userId) {
var user = this.users[userId];
if(typeof user === 'undefined' || typeof user.color === 'undefined') {
return "#000000"; //DefaultColor
}
return user.color;
},
getDisplayNameForUserId: function getDisplayNameForUserId(userId) {
var user = this.users[userId];
if(typeof user === 'undefined' || typeof user.displayName === 'undefined') {
return "Anonymous";
}
return user.displayName;
},
refreshChangelog: function refreshChangelog() {
try {
this.changelogDiv.parentNode.scrollTop = this.changelogDiv.parentNode.scrollHeight;
} catch(e) {
// changelog has not yet been redered
}
}
};
ORYX.Plugins.Changelog = ORYX.Plugins.AbstractPlugin.extend(ORYX.Plugins.Changelog); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* @namespace Oryx name space for plugins
* @name ORYX.Plugins
*/
if(!ORYX.Plugins)
ORYX.Plugins = new Object();
/**
* The view plugin offers all of zooming functionality accessible over the
* tool bar. This are zoom in, zoom out, zoom to standard, zoom fit to model.
*
* @class ORYX.Plugins.View
* @extends Clazz
* @param {Object} facade The editor facade for plugins.
*/
ORYX.Plugins.View = {
/** @lends ORYX.Plugins.View.prototype */
facade: undefined,
construct: function(facade, ownPluginData) {
this.facade = facade;
//Standard Values
this.zoomLevel = 1.0;
this.maxFitToScreenLevel=1.5;
this.minZoomLevel = 0.1;
this.maxZoomLevel = 2.5;
this.diff=5; //difference between canvas and view port, s.th. like toolbar??
//Read properties
ownPluginData.properties.each( function(property) {
if (property.zoomLevel) {this.zoomLevel = Number(1.0);}
if (property.maxFitToScreenLevel) {this.maxFitToScreenLevel=Number(property.maxFitToScreenLevel);}
if (property.minZoomLevel) {this.minZoomLevel = Number(property.minZoomLevel);}
if (property.maxZoomLevel) {this.maxZoomLevel = Number(property.maxZoomLevel);}
}.bind(this));
/* Register zoom in */
this.facade.offer({
'name':ORYX.I18N.View.zoomIn,
'functionality': this.zoom.bind(this, [1.0 + ORYX.CONFIG.ZOOM_OFFSET]),
'group': ORYX.I18N.View.group,
'iconCls': 'pw-toolbar-button pw-toolbar-zoom-in',
'description': ORYX.I18N.View.zoomInDesc,
'index': 1,
'minShape': 0,
'maxShape': 0,
'isEnabled': function(){return this.zoomLevel < this.maxZoomLevel }.bind(this),
'visibleInViewMode': true
});
/* Register zoom out */
this.facade.offer({
'name':ORYX.I18N.View.zoomOut,
'functionality': this.zoom.bind(this, [1.0 - ORYX.CONFIG.ZOOM_OFFSET]),
'group': ORYX.I18N.View.group,
'iconCls': 'pw-toolbar-button pw-toolbar-zoom-out',
'description': ORYX.I18N.View.zoomOutDesc,
'index': 2,
'minShape': 0,
'maxShape': 0,
'isEnabled': function(){ return this._checkSize() }.bind(this),
'visibleInViewMode': true
});
/* Register zoom standard */
this.facade.offer({
'name':ORYX.I18N.View.zoomStandard,
'functionality': this.setAFixZoomLevel.bind(this, 1),
'group': ORYX.I18N.View.group,
'iconCls': 'pw-toolbar-button pw-toolbar-actual-size',
'description': ORYX.I18N.View.zoomStandardDesc,
'index': 3,
'minShape': 0,
'maxShape': 0,
'isEnabled': function(){return this.zoomLevel != 1}.bind(this),
'visibleInViewMode': true
});
/* Register zoom fit to model */
this.facade.offer({
'name':ORYX.I18N.View.zoomFitToModel,
'functionality': this.zoomFitToModel.bind(this, true, true),
'group': ORYX.I18N.View.group,
'iconCls': 'pw-toolbar-button pw-toolbar-fit-screen',
'description': ORYX.I18N.View.zoomFitToModelDesc,
'index': 4,
'minShape': 0,
'maxShape': 0,
'visibleInViewMode': true
});
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_ORYX_SHOWN, this.onOryxShown.bind(this));
},
onOryxShown: function onOryxShown() {
this.zoomFitToModel(false, true)
},
/**
* It calculates the zoom level to fit whole model into the visible area
* of the canvas. Than the model gets zoomed and the position of the
* scroll bars are adjusted.
*
*/
zoomFitToModel: function handleFitToModel(zoomIn, zoomOut) {
var newZoomLevel = this.calculateZoomLevelForFitToModel();
if (zoomIn && newZoomLevel > this.zoomLevel) {
this.setAFixZoomLevel(newZoomLevel);
} else if (zoomOut && newZoomLevel < this.zoomLevel) {
this.setAFixZoomLevel(newZoomLevel);
}
this.centerModel();
},
centerModel: function centerModel() {
var scrollNode = this.facade.getCanvas().getHTMLContainer().parentNode.parentNode;
var visibleHeight = scrollNode.getHeight() - 30;
var visibleWidth = scrollNode.getWidth() - 30;
var nodes = this.facade.getCanvas().getChildShapes();
if(!nodes || nodes.length < 1) {
return;
}
/* Calculate size of canvas to fit the model */
var bounds = nodes[0].absoluteBounds().clone();
nodes.each(function(node) {
bounds.include(node.absoluteBounds().clone());
});
var scrollPosY = ((bounds.center()).y * this.zoomLevel) - (0.5 * visibleHeight);
scrollNode.scrollTop = Math.round(scrollPosY);
var scrollPosX = ((bounds.center()).x * this.zoomLevel)- (0.5 * visibleWidth);
scrollNode.scrollLeft = Math.round(scrollPosX);
},
/**
* It sets the zoom level to a fix value and call the zooming function.
*
* @param {Number} zoomLevel
* the zoom level
*/
setAFixZoomLevel : function(zoomLevel) {
this.zoomLevel = zoomLevel;
this._checkZoomLevelRange();
this.zoom(1);
},
/**
* It does the actual zooming. It changes the viewable size of the canvas
* and all to its child elements.
*
* @param {Number} factor
* the factor to adjust the zoom level
*/
zoom: function(factor) {
// TODO: Zoomen auf allen Objekten im SVG-DOM
this.zoomLevel *= factor;
var scrollNode = this.facade.getCanvas().getHTMLContainer().parentNode.parentNode;
var canvas = this.facade.getCanvas();
var newWidth = canvas.bounds.width() * this.zoomLevel;
var newHeight = canvas.bounds.height() * this.zoomLevel;
/* Set new top offset */
var offsetTop = (canvas.node.parentNode.parentNode.parentNode.offsetHeight - newHeight) / 2.0;
offsetTop = offsetTop > 20 ? offsetTop - 20 : 0;
canvas.node.parentNode.parentNode.style.marginTop = offsetTop + "px";
offsetTop += 5;
canvas.getHTMLContainer().style.top = offsetTop + "px";
/*readjust scrollbar*/
var newScrollTop= scrollNode.scrollTop - Math.round((canvas.getHTMLContainer().parentNode.getHeight()-newHeight) / 2)+this.diff;
var newScrollLeft= scrollNode.scrollLeft - Math.round((canvas.getHTMLContainer().parentNode.getWidth()-newWidth) / 2)+this.diff;
/* Set new Zoom-Level */
canvas.setSize({width: newWidth, height: newHeight}, true);
/* Set Scale-Factor */
canvas.node.setAttributeNS(null, "transform", "scale(" +this.zoomLevel+ ")");
/* Refresh the Selection */
this.facade.updateSelection(true);
// scrollNode.scrollTop=newScrollTop;
// scrollNode.scrollLeft=newScrollLeft;
/* Update the zoom-level*/
canvas.zoomLevel = this.zoomLevel;
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_CANVAS_ZOOMED,
zoomLevel: this.zoomLevel
});
},
calculateZoomLevelForFitToModel: function calculateZoomLevelForFitToModel() {
/* Get the size of the visible area of the canvas */
var scrollNode = this.facade.getCanvas().getHTMLContainer().parentNode.parentNode;
var visibleHeight = scrollNode.getHeight() - 30;
var visibleWidth = scrollNode.getWidth() - 30;
var nodes = this.facade.getCanvas().getChildShapes();
if(!nodes || nodes.length < 1) {
return this.zoomLevel;
}
/* Calculate size of canvas to fit the model */
var bounds = nodes[0].absoluteBounds().clone();
nodes.each(function(node) {
bounds.include(node.absoluteBounds().clone());
});
/* Set new Zoom Level */
var scaleFactorWidth = visibleWidth / bounds.width();
var scaleFactorHeight = visibleHeight / bounds.height();
/* Choose the smaller zoom level to fit the whole model */
var zoomFactor = scaleFactorHeight < scaleFactorWidth ? scaleFactorHeight : scaleFactorWidth;
/*Test if maximum zoom is reached*/
if(zoomFactor>this.maxFitToScreenLevel){zoomFactor=this.maxFitToScreenLevel}
return zoomFactor;
},
/**
* It checks if the zoom level is less or equal to the level, which is required
* to schow the whole canvas.
*
* @private
*/
_checkSize:function(){
var canvasParent=this.facade.getCanvas().getHTMLContainer().parentNode;
var minForCanvas= Math.min((canvasParent.parentNode.getWidth()/canvasParent.getWidth()),(canvasParent.parentNode.getHeight()/canvasParent.getHeight()));
// In some browsers, element.getWidth() will return 0 if the element is not yet displayed.
// In this case, minForCanvas will be NaN because we divide by zero.
// We return true if this happens because it only happens at the start of Oryx when zooming out should be allowed.
return isNaN(minForCanvas) || 1.3 > minForCanvas;
},
/**
* It checks if the zoom level is included in the definined zoom
* level range.
*
* @private
*/
_checkZoomLevelRange: function() {
/*var canvasParent=this.facade.getCanvas().getHTMLContainer().parentNode;
var maxForCanvas= Math.max((canvasParent.parentNode.getWidth()/canvasParent.getWidth()),(canvasParent.parentNode.getHeight()/canvasParent.getHeight()));
if(this.zoomLevel > maxForCanvas) {
this.zoomLevel = maxForCanvas;
}*/
if(this.zoomLevel < this.minZoomLevel) {
this.zoomLevel = this.minZoomLevel;
}
if(this.zoomLevel > this.maxZoomLevel) {
this.zoomLevel = this.maxZoomLevel;
}
}
};
ORYX.Plugins.View = Clazz.extend(ORYX.Plugins.View);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if (!ORYX.Plugins)
ORYX.Plugins = new Object();
/**
* This plugin implements the syncro algorithm for concurrent editing
**/
ORYX.Plugins.Syncro = Clazz.extend({
facade: undefined,
LAMPORT_OFFSET : 3,
lamportClock : 1,
localState : {},
initialized : false, // Lib (locaState, etc.) has not been initialized yet.
construct: function construct(facade) {
this.facade = facade;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_NEW_POST_MESSAGE_RECEIVED, this.handleNewPostMessageReceived.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SYNCRO_NEW_COMMANDS_FOR_REMOTE_STATE, this.handleNewCommandForRemoteState.bind(this));
},
/** Direction: Wave -> Oryx (New remote commands in Wave State) **/
handleNewPostMessageReceived: function handleNewPostMessageReceived(event) {
var data = event.data;
if (data.target !== "syncro") {
return;
}
var commandsArray = data.message;
this.handleRemoteCommands(commandsArray);
},
handleRemoteCommands: function handleRemoteCommands(remoteCommands) {
// new commands appeared in wave state -> run syncro algorithm
var remoteCommand;
var newCommand;
var localCommand;
var localCommands;
var newCommands = [];
var revertCommands;
var applyCommands;
// fetch new commands obtained from other users, merge into local state
for (var i = 0; i < remoteCommands.length; i++) {
remoteCommand = remoteCommands[i];
if (typeof this.localState[remoteCommand.id] === "undefined") {
this.localState[remoteCommand.id] = remoteCommand;
newCommands.push(remoteCommand);
}
}
// bring new and local commands into chronological order
newCommands.sort(this.compareCommands);
localCommands = this.getValuesFromDict(this.localState);
localCommands.sort(this.compareCommands);
// set lamportClock accordingly
this.lamportClock = this.getClockValueFromSortedCommands(localCommands);
if (!this.initialized) {
// When snycro is not initialized, all comands are new, no need to run algorithm
this.initialized = true;
this.sendCommandsToOryx(null, [], newCommands);
this.facade.raiseEvent({'type': ORYX.CONFIG.EVENT_SYNCRO_INITIALIZATION_DONE});
return;
}
// For each new command find all subsequent applied commands and mark them as to be
// reverted. Pass them and the new command to Oryx for execution.
localCommands.reverse();
for (var n = 0; n < newCommands.length; n++) {
newCommand = newCommands[n];
revertCommands = [];
applyCommands = [];
for (var j = 0; j < localCommands.length; j++) {
localCommand = localCommands[j];
if (localCommand === newCommand) {
applyCommands.push(localCommand);
applyCommands.reverse();
// pass everythin to Oryx for execution
this.sendCommandsToOryx(newCommand, revertCommands, applyCommands);
break;
} else if (!this.inArray(localCommand, newCommands)) {
// only commands that have already been applied and therefore are not
// part of the new commands need to be reverted
applyCommands.push(localCommand);
revertCommands.push(localCommand);
}
}
}
},
sendCommandsToOryx: function sendCommandsToOryx(newCommand, revertCommands, applyCommands) {
this.facade.raiseEvent({
'type': ORYX.CONFIG.EVENT_SYNCRO_NEW_REMOTE_COMMANDS,
'newCommand': newCommand,
'revertCommands': revertCommands,
'applyCommands': applyCommands,
'forceExecution': true
});
},
/** Direction: Oryx -> Wave (New local command needs to be pushed into Wave State) **/
handleNewCommandForRemoteState: function handleNewCommandForRemoteState(event) {
this.pushCommands(event.commands);
},
pushCommands: function pushCommands(commands) {
// new commands executed on the local client are pushed into wave state
var commandId = this.getNextCommandId();
var delta = {
'commands': commands,
'userId': this.facade.getUserId(),
'id': commandId,
'clock': this.lamportClock
};
// push into local state
this.localState[commandId] = delta;
// push into wave state
this.facade.raiseEvent({
'type': ORYX.CONFIG.EVENT_POST_MESSAGE,
'target': 'syncroWave',
'action': 'save',
'message': delta
});
// adjust Lamport clock for new command
this.lamportClock += this.LAMPORT_OFFSET;
},
/** helper functions **/
compareCommands: function compareCommands(command1, command2) {
// compare-function to sort commands chronologically
var delta = command1.clock - command2.clock;
if (delta === 0) {
if (command1.userId < command2.userId) {
return -1;
} else {
return 1;
}
}
return delta;
},
getClockValueFromSortedCommands: function getClockValueFromSortedCommands(commands) {
// return max(highest clock in commands, current lamportClock) + lamport offset
var lamportClock = this.lamportClock;
if (commands.length === 0) {
return lamportClock;
}
var lastCommand = commands[commands.length - 1];
var lastClock = lastCommand.clock;
if (lastClock >= lamportClock) {
return lastClock + this.LAMPORT_OFFSET;
}
return lamportClock;
},
getNextCommandId: function getNextCommandId() {
return this.lamportClock + "\\" + this.facade.getUserId();
},
/** util **/
getValuesFromDict: function getValuesFromDict(dict) {
var values = [];
for (var key in dict) {
if (dict.hasOwnProperty(key)) {
values.push(dict[key]);
}
}
return values;
},
inArray: function inArray(value, array) {
for (var i = 0; i < array.length; i++) {
if (array[i] === value) {
return true;
}
}
return false;
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if(!ORYX.Plugins) {
ORYX.Plugins = new Object();
}
// Implements command class for a property change in the Core Commands object
ORYX.Core.Commands["PropertyChange"] = ORYX.Core.AbstractCommand.extend({
construct: function construct(key, selectedElements, oldValues, newValue, facade){
// super constructor call
arguments.callee.$.construct.call(this, facade);
this.key = key;
this.selectedElements = selectedElements;
this.oldValues = oldValues;
this.newValue = newValue;
},
getAffectedShapes: function getAffectedShapes() {
return this.selectedElements;
},
getCommandName: function getCommandName() {
return "PropertyChange";
},
getDisplayName: function getDisplayName() {
return "Properties changed";
},
getCommandData: function getCommandData() {
var selectedElementIds = [];
for (var i = 0; i < this.selectedElements.length; i++) {
selectedElementIds.push(this.selectedElements[i].resourceId);
}
var cmdData = {
key: this.key,
selectedElementIds: selectedElementIds,
oldValues: this.oldValues,
newValue: this.newValue
};
return cmdData;
},
createFromCommandData: function createFromCommandData(facade, cmdData) {
var selectedElementObjs = [];
var shapeExists = false;
for(var i = 0; i < cmdData.selectedElementIds.length; i++) {
var selectedShape = facade.getCanvas().getChildShapeOrCanvasByResourceId(cmdData.selectedElementIds[i]);
if (typeof selectedShape !== 'undefined') {
selectedElementObjs.push(selectedShape);
shapeExists = true;
}
}
// If no shape to be changed exists (i.e. it has been deleted) don't instantiate the command.
if (!shapeExists) {
return undefined;
}
return new ORYX.Core.Commands["PropertyChange"](cmdData.key, selectedElementObjs, cmdData.oldValues, cmdData.newValue, facade);
},
execute: function execute(){
this.selectedElements.each(function(shape){
if(!shape.getStencil().property(this.key).readonly()) {
shape.setProperty(this.key, this.newValue);
}
}.bind(this));
this.facade.getCanvas().update();
// TODO Moved from afterEdit(). Untested and not quite understood. What's with editDirectly()?
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_PROPWINDOW_PROP_CHANGED,
elements: this.selectedElements,
key: this.key,
value: this.newValue
});
},
rollback: function rollback(){
this.selectedElements.each(function(shape){
shape.setProperty(this.key, this.oldValues[shape.getId()]);
}.bind(this));
if (this.isLocal()) {
this.facade.setSelection(this.selectedElements);
}
this.facade.getCanvas().update();
}
});
ORYX.Plugins.PropertyTab = {
facade: undefined,
construct: function(facade) {
// Reference to the Editor-Interface
this.facade = facade;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SHOW_PROPERTYWINDOW, this.init.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_LOADED, this.selectDiagram.bind(this));
this.init();
},
init: function(){
// The parent div-node of the grid
this.node = ORYX.Editor.graft("http://www.w3.org/1999/xhtml",
null,
['div']);
// If the current property in focus is of type 'Date', the date format
// is stored here.
this.currentDateFormat;
// the properties array
this.popularProperties = [];
this.properties = [];
/* The currently selected shapes whos properties will shown */
this.shapeSelection = new Hash();
this.shapeSelection.shapes = new Array();
this.shapeSelection.commonProperties = new Array();
this.shapeSelection.commonPropertiesValues = new Hash();
this.updaterFlag = false;
// creating the column model of the grid.
this.columnModel = new Ext.grid.ColumnModel([
{
//id: 'name',
header: ORYX.I18N.PropertyWindow.name,
dataIndex: 'name',
width: 90,
sortable: true,
renderer: this.tooltipRenderer.bind(this)
}, {
//id: 'value',
header: ORYX.I18N.PropertyWindow.value,
dataIndex: 'value',
id: 'propertywindow_column_value',
width: 110,
editor: new Ext.form.TextField({
allowBlank: false
}),
renderer: this.renderer.bind(this)
},
{
header: "Pop",
dataIndex: 'popular',
hidden: true,
sortable: true
}
]);
// creating the store for the model.
this.dataSource = new Ext.data.GroupingStore({
proxy: new Ext.data.MemoryProxy(this.properties),
reader: new Ext.data.ArrayReader({}, [
{name: 'popular'},
{name: 'name'},
{name: 'value'},
{name: 'icons'},
{name: 'gridProperties'}
]),
sortInfo: {field: 'popular', direction: "ASC"},
sortData : function(f, direction){
direction = direction || 'ASC';
var st = this.fields.get(f).sortType;
var fn = function(r1, r2){
var v1 = st(r1.data[f]), v2 = st(r2.data[f]);
var p1 = r1.data['popular'], p2 = r2.data['popular'];
return p1 && !p2 ? -1 : (!p1 && p2 ? 1 : (v1 > v2 ? 1 : (v1 < v2 ? -1 : 0)));
};
this.data.sort(direction, fn);
if(this.snapshot && this.snapshot != this.data){
this.snapshot.sort(direction, fn);
}
},
groupField: 'popular'
});
this.dataSource.load();
var propertiesDiv = document.createElement('div');
// Register the property tab in the sidebar
this.facade.raiseEvent({
'type': ORYX.CONFIG.EVENT_SIDEBAR_NEW_TAB,
'tabid': 'pwave-properties',
'tabTitle': 'Properties',
'tabOrder': 2,
'tabDivEl': propertiesDiv,
'storeRenameFunction': function(fun) { this.onTabRename = fun; }.bind(this),
'forceExecution': true
});
this.grid = new Ext.grid.EditorGridPanel({
renderTo: propertiesDiv,
clicksToEdit: 1,
stripeRows: true,
//autoExpandColumn: "propertywindow_column_value",
width: 'auto',
maxHeight: 530,
height: 'auto',
border: false,
header: true,
// the column model
colModel: this.columnModel,
enableHdMenu: false,
view: new Ext.grid.GroupingView({
forceFit: true,
groupTextTpl: '{[values.rs.first().data.popular ? ORYX.I18N.PropertyWindow.oftenUsed : ORYX.I18N.PropertyWindow.moreProps]}'
}),
// the data store
store: this.dataSource
});
Ext.EventManager.onWindowResize(this.grid.doLayout, this.grid);
// Register on Events
this.grid.on('beforeedit', this.beforeEdit, this, true);
this.grid.on('afteredit', this.afterEdit, this, true);
this.grid.view.on('refresh', this.hideMoreAttrs, this, true);
//this.grid.on(ORYX.CONFIG.EVENT_KEYDOWN, this.keyDown, this, true);
// Renderer the Grid
this.grid.enableColumnMove = false;
//this.grid.render();
// Sort as Default the first column
//this.dataSource.sort('name');
},
// Select the Canvas when the editor is ready
selectDiagram: function() {
this.shapeSelection.shapes = [this.facade.getCanvas()];
this.setPropertyWindowTitle();
this.identifyCommonProperties();
this.createProperties();
},
specialKeyDown: function(field, event) {
// If there is a TextArea and the Key is an Enter
if(field instanceof Ext.form.TextArea && event.button == ORYX.CONFIG.KEY_Code_enter) {
// Abort the Event
return false
}
},
tooltipRenderer: function(value, p, record) {
/* Prepare tooltip */
p.cellAttr = 'title="' + record.data.gridProperties.tooltip + '"';
return value;
},
renderer: function(value, p, record) {
this.tooltipRenderer(value, p, record);
if(value instanceof Date) {
// TODO: Date-Schema is not generic
value = value.dateFormat(ORYX.I18N.PropertyWindow.dateFormat);
} else if(String(value).search("<a href='") < 0) {
// Shows the Value in the Grid in each Line
value = String(value).gsub("<", "<");
value = String(value).gsub(">", ">");
value = String(value).gsub("%", "%");
value = String(value).gsub("&", "&");
if(record.data.gridProperties.type == ORYX.CONFIG.TYPE_COLOR) {
value = "<div class='prop-background-color' style='background-color:" + value + "' />";
}
record.data.icons.each(function(each) {
if(each.name == value) {
if(each.icon) {
value = "<img src='" + each.icon + "' /> " + value;
}
}
});
}
return value;
},
beforeEdit: function(option) {
var editorGrid = this.dataSource.getAt(option.row).data.gridProperties.editor;
var editorRenderer = this.dataSource.getAt(option.row).data.gridProperties.renderer;
if(editorGrid) {
// Disable KeyDown
this.facade.disableEvent(ORYX.CONFIG.EVENT_KEYDOWN);
option.grid.getColumnModel().setEditor(1, editorGrid);
editorGrid.field.row = option.row;
// Render the editor to the grid, therefore the editor is also available
// for the first and last row
editorGrid.render(this.grid);
//option.grid.getColumnModel().setRenderer(1, editorRenderer);
editorGrid.setSize(option.grid.getColumnModel().getColumnWidth(1), editorGrid.height);
} else {
return false;
}
var key = this.dataSource.getAt(option.row).data.gridProperties.propId;
this.oldValues = new Hash();
this.shapeSelection.shapes.each(function(shape){
this.oldValues[shape.getId()] = shape.properties[key];
}.bind(this));
},
afterEdit: function(option) {
//Ext1.0: option.grid.getDataSource().commitChanges();
option.grid.getStore().commitChanges();
var key = option.record.data.gridProperties.propId;
var selectedElements = this.shapeSelection.shapes;
var oldValues = this.oldValues;
var newValue = option.value;
var command = new ORYX.Core.Commands["PropertyChange"](key, selectedElements, oldValues, newValue, this.facade);
this.facade.executeCommands([command]);
},
// Cahnges made in the property window will be shown directly
editDirectly:function(key, value){
this.shapeSelection.shapes.each(function(shape){
if(!shape.getStencil().property(key).readonly()) {
shape.setProperty(key, value);
//shape.update();
}
}.bind(this));
/* Propagate changed properties */
var selectedElements = this.shapeSelection.shapes;
this.facade.raiseEvent({
type : ORYX.CONFIG.EVENT_PROPWINDOW_PROP_CHANGED,
elements : selectedElements,
key : key,
value : value
});
this.facade.getCanvas().update();
},
// if a field becomes invalid after editing the shape must be restored to the old value
updateAfterInvalid : function(key) {
this.shapeSelection.shapes.each(function(shape) {
if(!shape.getStencil().property(key).readonly()) {
shape.setProperty(key, this.oldValues[shape.getId()]);
shape.update();
}
}.bind(this));
this.facade.getCanvas().update();
},
dialogClosed: function(data) {
var row = this.field ? this.field.row : this.row
this.scope.afterEdit({
grid:this.scope.grid,
record:this.scope.grid.getStore().getAt(row),
value: data
})
// reopen the text field of the complex list field again
this.scope.grid.startEditing(row, this.col);
},
/**
* Changes the title of the property window panel according to the selected shapes.
*/
setPropertyWindowTitle: function() {
var title;
if (typeof this.onTabRename === "function") {
if(this.shapeSelection.shapes.length == 1) {
title = this.shapeSelection.shapes.first().getStencil().title();
} else {
title = this.shapeSelection.shapes.length + ' ' + ORYX.I18N.PropertyWindow.selected;
}
title = ORYX.I18N.PropertyWindow.title + ' (' + title + ')';
this.onTabRename(title);
}
},
/**
* Sets this.shapeSelection.commonPropertiesValues.
* If the value for a common property is not equal for each shape the value
* is left empty in the property window.
*/
setCommonPropertiesValues: function() {
this.shapeSelection.commonPropertiesValues = new Hash();
this.shapeSelection.commonProperties.each(function(property){
var key = property.prefix() + "-" + property.id();
var emptyValue = false;
var firstShape = this.shapeSelection.shapes.first();
this.shapeSelection.shapes.each(function(shape){
if(firstShape.properties[key] != shape.properties[key]) {
emptyValue = true;
}
}.bind(this));
/* Set property value */
if(!emptyValue) {
this.shapeSelection.commonPropertiesValues[key]
= firstShape.properties[key];
}
}.bind(this));
},
/**
* Returns the set of stencils used by the passed shapes.
*/
getStencilSetOfSelection: function() {
var stencils = new Hash();
this.shapeSelection.shapes.each(function(shape) {
stencils[shape.getStencil().id()] = shape.getStencil();
})
return stencils;
},
/**
* Identifies the common Properties of the selected shapes.
*/
identifyCommonProperties: function() {
this.shapeSelection.commonProperties.clear();
/*
* A common property is a property, that is part of
* the stencil definition of the first and all other stencils.
*/
var stencils = this.getStencilSetOfSelection();
var firstStencil = stencils.values().first();
var comparingStencils = stencils.values().without(firstStencil);
if(comparingStencils.length == 0) {
this.shapeSelection.commonProperties = firstStencil.properties();
} else {
var properties = new Hash();
/* put all properties of on stencil in a Hash */
firstStencil.properties().each(function(property){
properties[property.namespace() + '-' + property.id()
+ '-' + property.type()] = property;
});
/* Calculate intersection of properties. */
comparingStencils.each(function(stencil){
var intersection = new Hash();
stencil.properties().each(function(property){
if(properties[property.namespace() + '-' + property.id()
+ '-' + property.type()]){
intersection[property.namespace() + '-' + property.id()
+ '-' + property.type()] = property;
}
});
properties = intersection;
});
this.shapeSelection.commonProperties = properties.values();
}
},
onSelectionChanged: function(event) {
// don't allow remote commands to change focus
if (!event.isLocal)
return;
/* Event to call afterEdit method */
this.grid.stopEditing();
/* Selected shapes */
this.shapeSelection.shapes = event.elements;
/* Case: nothing selected */
if(event.elements.length == 0) {
this.shapeSelection.shapes = [this.facade.getCanvas()];
}
/* subselection available */
if(event.subSelection){
this.shapeSelection.shapes = [event.subSelection];
}
this.setPropertyWindowTitle();
this.identifyCommonProperties();
this.setCommonPropertiesValues();
// Create the Properties
this.createProperties();
},
/**
* Creates the properties for the ExtJS-Grid from the properties of the
* selected shapes.
*/
createProperties: function() {
this.properties = [];
this.popularProperties = [];
if(this.shapeSelection.commonProperties) {
// add new property lines
this.shapeSelection.commonProperties.each((function(pair, index) {
var key = pair.prefix() + "-" + pair.id();
// Get the property pair
var name = pair.title();
var icons = [];
var attribute = this.shapeSelection.commonPropertiesValues[key];
var editorGrid = undefined;
var editorRenderer = null;
var refToViewFlag = false;
if(!pair.readonly()){
switch(pair.type()) {
case ORYX.CONFIG.TYPE_STRING:
// If the Text is MultiLine
if(pair.wrapLines()) {
// Set the Editor as TextArea
var editorTextArea = new Ext.form.TextArea({alignment: "tl-tl", allowBlank: pair.optional(), msgTarget:'title', maxLength:pair.length()});
editorTextArea.on('keyup', function(textArea, event) {
this.editDirectly(key, textArea.getValue());
}.bind(this));
editorGrid = new Ext.Editor(editorTextArea);
} else {
// If not, set the Editor as InputField
var editorInput = new Ext.form.TextField({allowBlank: pair.optional(), msgTarget:'title', maxLength:pair.length()});
editorInput.on('keyup', function(input, event) {
this.editDirectly(key, input.getValue());
}.bind(this));
// reverts the shape if the editor field is invalid
editorInput.on('blur', function(input) {
if(!input.isValid(false))
this.updateAfterInvalid(key);
}.bind(this));
editorInput.on("specialkey", function(input, e) {
if(!input.isValid(false))
this.updateAfterInvalid(key);
}.bind(this));
editorGrid = new Ext.Editor(editorInput);
}
break;
case ORYX.CONFIG.TYPE_BOOLEAN:
// Set the Editor as a CheckBox
var editorCheckbox = new Ext.form.Checkbox();
editorCheckbox.on('check', function(c,checked) {
this.editDirectly(key, checked);
}.bind(this));
editorGrid = new Ext.Editor(editorCheckbox);
break;
case ORYX.CONFIG.TYPE_INTEGER:
// Set as an Editor for Integers
var numberField = new Ext.form.NumberField({allowBlank: pair.optional(), allowDecimals:false, msgTarget:'title', minValue: pair.min(), maxValue: pair.max()});
numberField.on('keyup', function(input, event) {
this.editDirectly(key, input.getValue());
}.bind(this));
editorGrid = new Ext.Editor(numberField);
break;
case ORYX.CONFIG.TYPE_FLOAT:
// Set as an Editor for Float
var numberField = new Ext.form.NumberField({ allowBlank: pair.optional(), allowDecimals:true, msgTarget:'title', minValue: pair.min(), maxValue: pair.max()});
numberField.on('keyup', function(input, event) {
this.editDirectly(key, input.getValue());
}.bind(this));
editorGrid = new Ext.Editor(numberField);
break;
case ORYX.CONFIG.TYPE_COLOR:
// Set as a ColorPicker
// Ext1.0 editorGrid = new gEdit(new form.ColorField({ allowBlank: pair.optional(), msgTarget:'title' }));
var editorPicker = new Ext.ux.ColorField({ allowBlank: pair.optional(), msgTarget:'title', facade: this.facade });
/*this.facade.registerOnEvent(ORYX.CONFIG.EVENT_COLOR_CHANGE, function(option) {
this.editDirectly(key, option.value);
}.bind(this));*/
editorGrid = new Ext.Editor(editorPicker);
break;
case ORYX.CONFIG.TYPE_CHOICE:
var items = pair.items();
var options = [];
items.each(function(value) {
if(value.value() == attribute)
attribute = value.title();
if(value.refToView()[0])
refToViewFlag = true;
options.push([value.icon(), value.title(), value.value()]);
icons.push({
name: value.title(),
icon: value.icon()
});
});
var store = new Ext.data.SimpleStore({
fields: [{name: 'icon'},
{name: 'title'},
{name: 'value'} ],
data : options // from states.js
});
// Set the grid Editor
var editorCombo = new Ext.form.ComboBox({
tpl: '<tpl for="."><div class="x-combo-list-item">{[(values.icon) ? "<img src=\'" + values.icon + "\' />" : ""]} {title}</div></tpl>',
store: store,
displayField:'title',
valueField: 'value',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus:true
});
editorCombo.on('select', function(combo, record, index) {
this.editDirectly(key, combo.getValue());
}.bind(this))
editorGrid = new Ext.Editor(editorCombo);
break;
case ORYX.CONFIG.TYPE_DATE:
var currFormat = ORYX.I18N.PropertyWindow.dateFormat
if(!(attribute instanceof Date))
attribute = Date.parseDate(attribute, currFormat)
editorGrid = new Ext.Editor(new Ext.form.DateField({ allowBlank: pair.optional(), format:currFormat, msgTarget:'title'}));
break;
case ORYX.CONFIG.TYPE_TEXT:
var cf = new Ext.form.ComplexTextField({
allowBlank: pair.optional(),
dataSource:this.dataSource,
grid:this.grid,
row:index,
facade:this.facade
});
cf.on('dialogClosed', this.dialogClosed, {scope:this, row:index, col:1,field:cf});
editorGrid = new Ext.Editor(cf);
break;
// extended by Kerstin (start)
case ORYX.CONFIG.TYPE_COMPLEX:
var cf = new Ext.form.ComplexListField({ allowBlank: pair.optional()}, pair.complexItems(), key, this.facade);
cf.on('dialogClosed', this.dialogClosed, {scope:this, row:index, col:1,field:cf});
editorGrid = new Ext.Editor(cf);
break;
// extended by Kerstin (end)
default:
var editorInput = new Ext.form.TextField({ allowBlank: pair.optional(), msgTarget:'title', maxLength:pair.length(), enableKeyEvents: true});
editorInput.on('keyup', function(input, event) {
this.editDirectly(key, input.getValue());
}.bind(this));
editorGrid = new Ext.Editor(editorInput);
}
// Register Event to enable KeyDown
editorGrid.on('beforehide', this.facade.enableEvent.bind(this, ORYX.CONFIG.EVENT_KEYDOWN));
editorGrid.on('specialkey', this.specialKeyDown.bind(this));
} else if(pair.type() === ORYX.CONFIG.TYPE_URL || pair.type() === ORYX.CONFIG.TYPE_DIAGRAM_LINK){
attribute = String(attribute).search("http") !== 0 ? ("http://" + attribute) : attribute;
attribute = "<a href='" + attribute + "' target='_blank'>" + attribute.split("://")[1] + "</a>"
}
// Push to the properties-array
if(pair.visible()) {
// Popular Properties are those with a refToView set or those which are set to be popular
if (pair.refToView()[0] || refToViewFlag || pair.popular()) {
pair.setPopular();
}
if(pair.popular()) {
this.popularProperties.push([pair.popular(), name, attribute, icons, {
editor: editorGrid,
propId: key,
type: pair.type(),
tooltip: pair.description(),
renderer: editorRenderer
}]);
}
else {
this.properties.push([pair.popular(), name, attribute, icons, {
editor: editorGrid,
propId: key,
type: pair.type(),
tooltip: pair.description(),
renderer: editorRenderer
}]);
}
}
}).bind(this));
}
this.setProperties();
},
hideMoreAttrs: function(panel) {
// TODO: Implement the case that the canvas has no attributes
if (this.properties.length <= 0){ return }
// collapse the "more attr" group
this.grid.view.toggleGroup(this.grid.view.getGroupId(this.properties[0][0]), false);
// prevent the more attributes pane from closing after a attribute has been edited
this.grid.view.un("refresh", this.hideMoreAttrs, this);
},
setProperties: function() {
var props = this.popularProperties.concat(this.properties);
this.dataSource.loadData(props);
}
}
ORYX.Plugins.PropertyTab = Clazz.extend(ORYX.Plugins.PropertyTab);
/**
* Editor for complex type
*
* When starting to edit the editor, it creates a new dialog where new attributes
* can be specified which generates json out of this and put this
* back to the input field.
*
* This is implemented from Kerstin Pfitzner
*
* @param {Object} config
* @param {Object} items
* @param {Object} key
* @param {Object} facade
*/
Ext.form.ComplexListField = function(config, items, key, facade){
Ext.form.ComplexListField.superclass.constructor.call(this, config);
this.items = items;
this.key = key;
this.facade = facade;
};
/**
* This is a special trigger field used for complex properties.
* The trigger field opens a dialog that shows a list of properties.
* The entered values will be stored as trigger field value in the JSON format.
*/
Ext.extend(Ext.form.ComplexListField, Ext.form.TriggerField, {
/**
* @cfg {String} triggerClass
* An additional CSS class used to style the trigger button. The trigger will always get the
* class 'x-form-trigger' and triggerClass will be <b>appended</b> if specified.
*/
triggerClass: 'x-form-complex-trigger',
readOnly: true,
emptyText: ORYX.I18N.PropertyWindow.clickIcon,
/**
* Builds the JSON value from the data source of the grid in the dialog.
*/
buildValue: function() {
var ds = this.grid.getStore();
ds.commitChanges();
if (ds.getCount() == 0) {
return "";
}
var jsonString = "[";
for (var i = 0; i < ds.getCount(); i++) {
var data = ds.getAt(i);
jsonString += "{";
for (var j = 0; j < this.items.length; j++) {
var key = this.items[j].id();
jsonString += key + ':' + ("" + data.get(key)).toJSON();
if (j < (this.items.length - 1)) {
jsonString += ", ";
}
}
jsonString += "}";
if (i < (ds.getCount() - 1)) {
jsonString += ", ";
}
}
jsonString += "]";
jsonString = "{'totalCount':" + ds.getCount().toJSON() +
", 'items':" + jsonString + "}";
return Object.toJSON(jsonString.evalJSON());
},
/**
* Returns the field key.
*/
getFieldKey: function() {
return this.key;
},
/**
* Returns the actual value of the trigger field.
* If the table does not contain any values the empty
* string will be returned.
*/
getValue : function(){
// return actual value if grid is active
if (this.grid) {
return this.buildValue();
} else if (this.data == undefined) {
return "";
} else {
return this.data;
}
},
/**
* Sets the value of the trigger field.
* In this case this sets the data that will be shown in
* the grid of the dialog.
*
* @param {Object} value The value to be set (JSON format or empty string)
*/
setValue: function(value) {
if (value.length > 0) {
// set only if this.data not set yet
// only to initialize the grid
if (this.data == undefined) {
this.data = value;
}
}
},
/**
* Returns false. In this way key events will not be propagated
* to other elements.
*
* @param {Object} event The keydown event.
*/
keydownHandler: function(event) {
return false;
},
/**
* The listeners of the dialog.
*
* If the dialog is hidded, a dialogClosed event will be fired.
* This has to be used by the parent element of the trigger field
* to reenable the trigger field (focus gets lost when entering values
* in the dialog).
*/
dialogListeners : {
show : function(){ // retain focus styling
this.onFocus();
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_KEYDOWN, this.keydownHandler.bind(this));
this.facade.disableEvent(ORYX.CONFIG.EVENT_KEYDOWN);
return;
},
hide : function(){
var dl = this.dialogListeners;
this.dialog.un("show", dl.show, this);
this.dialog.un("hide", dl.hide, this);
this.dialog.destroy(true);
this.grid.destroy(true);
delete this.grid;
delete this.dialog;
this.facade.unregisterOnEvent(ORYX.CONFIG.EVENT_KEYDOWN, this.keydownHandler.bind(this));
this.facade.enableEvent(ORYX.CONFIG.EVENT_KEYDOWN);
// store data and notify parent about the closed dialog
// parent has to handel this event and start editing the text field again
this.fireEvent('dialogClosed', this.data);
Ext.form.ComplexListField.superclass.setValue.call(this, this.data);
}
},
/**
* Builds up the initial values of the grid.
*
* @param {Object} recordType The record type of the grid.
* @param {Object} items The initial items of the grid (columns)
*/
buildInitial: function(recordType, items) {
var initial = new Hash();
for (var i = 0; i < items.length; i++) {
var id = items[i].id();
initial[id] = items[i].value();
}
var RecordTemplate = Ext.data.Record.create(recordType);
return new RecordTemplate(initial);
},
/**
* Builds up the column model of the grid. The parent element of the
* grid.
*
* Sets up the editors for the grid columns depending on the
* type of the items.
*
* @param {Object} parent The
*/
buildColumnModel: function(parent) {
var cols = [];
for (var i = 0; i < this.items.length; i++) {
var id = this.items[i].id();
var header = this.items[i].name();
var width = this.items[i].width();
var type = this.items[i].type();
var editor;
if (type == ORYX.CONFIG.TYPE_STRING) {
editor = new Ext.form.TextField({ allowBlank : this.items[i].optional(), width : width});
} else if (type == ORYX.CONFIG.TYPE_CHOICE) {
var items = this.items[i].items();
var select = ORYX.Editor.graft("http://www.w3.org/1999/xhtml", parent, ['select', {style:'display:none'}]);
var optionTmpl = new Ext.Template('<option value="{value}">{value}</option>');
items.each(function(value){
optionTmpl.append(select, {value:value.value()});
});
editor = new Ext.form.ComboBox(
{ typeAhead: true, triggerAction: 'all', transform:select, lazyRender:true, msgTarget:'title', width : width});
} else if (type == ORYX.CONFIG.TYPE_BOOLEAN) {
editor = new Ext.form.Checkbox( { width : width } );
}
cols.push({
id: id,
header: header,
dataIndex: id,
resizable: true,
editor: editor,
width: width
});
}
return new Ext.grid.ColumnModel(cols);
},
/**
* After a cell was edited the changes will be commited.
*
* @param {Object} option The option that was edited.
*/
afterEdit: function(option) {
option.grid.getStore().commitChanges();
},
/**
* Before a cell is edited it has to be checked if this
* cell is disabled by another cell value. If so, the cell editor will
* be disabled.
*
* @param {Object} option The option to be edited.
*/
beforeEdit: function(option) {
var state = this.grid.getView().getScrollState();
var col = option.column;
var row = option.row;
var editId = this.grid.getColumnModel().config[col].id;
// check if there is an item in the row, that disables this cell
for (var i = 0; i < this.items.length; i++) {
// check each item that defines a "disable" property
var item = this.items[i];
var disables = item.disable();
if (disables != undefined) {
// check if the value of the column of this item in this row is equal to a disabling value
var value = this.grid.getStore().getAt(row).get(item.id());
for (var j = 0; j < disables.length; j++) {
var disable = disables[j];
if (disable.value == value) {
for (var k = 0; k < disable.items.length; k++) {
// check if this value disables the cell to select
// (id is equals to the id of the column to edit)
var disItem = disable.items[k];
if (disItem == editId) {
this.grid.getColumnModel().getCellEditor(col, row).disable();
return;
}
}
}
}
}
}
this.grid.getColumnModel().getCellEditor(col, row).enable();
//this.grid.getView().restoreScroll(state);
},
/**
* If the trigger was clicked a dialog has to be opened
* to enter the values for the complex property.
*/
onTriggerClick : function(){
if(this.disabled){
return;
}
//if(!this.dialog) {
var dialogWidth = 0;
var recordType = [];
for (var i = 0; i < this.items.length; i++) {
var id = this.items[i].id();
var width = this.items[i].width();
var type = this.items[i].type();
if (type == ORYX.CONFIG.TYPE_CHOICE) {
type = ORYX.CONFIG.TYPE_STRING;
}
dialogWidth += width;
recordType[i] = {name:id, type:type};
}
if (dialogWidth > 800) {
dialogWidth = 800;
}
dialogWidth += 22;
var data = this.data;
if (data == "") {
// empty string can not be parsed
data = "{}";
}
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(eval("(" + data + ")")),
reader: new Ext.data.JsonReader({
root: 'items',
totalProperty: 'totalCount'
}, recordType)
});
ds.load();
var cm = this.buildColumnModel();
this.grid = new Ext.grid.EditorGridPanel({
store: ds,
cm: cm,
stripeRows: true,
clicksToEdit : 1,
autoHeight:true,
selModel: new Ext.grid.CellSelectionModel()
});
//var gridHead = this.grid.getView().getHeaderPanel(true);
var toolbar = new Ext.Toolbar(
[{
text: ORYX.I18N.PropertyWindow.add,
handler: function(){
var ds = this.grid.getStore();
var index = ds.getCount();
this.grid.stopEditing();
var p = this.buildInitial(recordType, this.items);
ds.insert(index, p);
ds.commitChanges();
this.grid.startEditing(index, 0);
}.bind(this)
},{
text: ORYX.I18N.PropertyWindow.rem,
handler : function(){
var ds = this.grid.getStore();
var selection = this.grid.getSelectionModel().getSelectedCell();
if (selection == undefined) {
return;
}
this.grid.getSelectionModel().clearSelections();
this.grid.stopEditing();
var record = ds.getAt(selection[0]);
ds.remove(record);
ds.commitChanges();
}.bind(this)
}]);
// Basic Dialog
this.dialog = new Ext.Window({
autoScroll: true,
autoCreate: true,
title: ORYX.I18N.PropertyWindow.complex,
height: 350,
width: dialogWidth,
modal:true,
collapsible:false,
fixedcenter: true,
shadow:true,
proxyDrag: true,
keys:[{
key: 27,
fn: function(){
this.dialog.hide
}.bind(this)
}],
items:[toolbar, this.grid],
bodyStyle:"background-color:#FFFFFF",
buttons: [{
text: ORYX.I18N.PropertyWindow.ok,
handler: function(){
this.grid.stopEditing();
// store dialog input
this.data = this.buildValue();
this.dialog.hide()
}.bind(this)
}, {
text: ORYX.I18N.PropertyWindow.cancel,
handler: function(){
this.dialog.hide()
}.bind(this)
}]
});
this.dialog.on(Ext.apply({}, this.dialogListeners, {
scope:this
}));
this.dialog.show();
this.grid.on('beforeedit', this.beforeEdit, this, true);
this.grid.on('afteredit', this.afterEdit, this, true);
this.grid.render();
/*} else {
this.dialog.show();
}*/
}
});
// Override for maxHeight in GridPanel
Ext.grid.GridView.override({
layout : function(){
if(!this.mainBody){
return; // not rendered
}
var g = this.grid;
var c = g.getGridEl();
var csize = c.getSize(true);
var vw = csize.width;
if(vw < 20 || csize.height < 20){ // display: none?
return;
}
if(g.autoHeight){
if (g.maxHeight) {
var hdHeight = this.mainHd.getHeight();
var vh = Math.min(csize.height, g.maxHeight);
this.el.setSize(csize.width, vh);
this.scroller.setSize(vw, vh - hdHeight);
} else {
this.scroller.dom.style.overflow = 'visible';
}
}else{
this.el.setSize(csize.width, csize.height);
var hdHeight = this.mainHd.getHeight();
var vh = csize.height - (hdHeight);
this.scroller.setSize(vw, vh);
if(this.innerHd){
this.innerHd.style.width = (vw)+'px';
}
}
if(this.forceFit){
if(this.lastViewWidth != vw){
this.fitColumns(false, false);
this.lastViewWidth = vw;
}
}else {
this.autoExpand();
this.syncHeaderScroll();
}
this.onLayout(vw, vh);
}
});
Ext.form.ComplexTextField = Ext.extend(Ext.form.TriggerField, {
defaultAutoCreate : {tag: "textarea", rows:1, style:"height:16px;overflow:hidden;" },
/**
* If the trigger was clicked a dialog has to be opened
* to enter the values for the complex property.
*/
onTriggerClick : function(){
if(this.disabled){
return;
}
var grid = new Ext.form.TextArea({
anchor : '100% 100%',
value : this.value,
listeners : {
focus: function(){
this.facade.disableEvent(ORYX.CONFIG.EVENT_KEYDOWN);
}.bind(this)
}
})
// Basic Dialog
var dialog = new Ext.Window({
layout : 'anchor',
autoCreate : true,
title : ORYX.I18N.PropertyWindow.text,
height : 500,
width : 500,
modal : true,
collapsible : false,
fixedcenter : true,
shadow : true,
proxyDrag : true,
keys:[{
key : 27,
fn : function(){
dialog.hide()
}.bind(this)
}],
items :[grid],
listeners :{
hide: function(){
this.fireEvent('dialogClosed', this.value);
//this.focus.defer(10, this);
dialog.destroy();
}.bind(this)
},
buttons : [{
text: ORYX.I18N.PropertyWindow.ok,
handler: function(){
// store dialog input
var value = grid.getValue();
this.setValue(value);
this.dataSource.getAt(this.row).set('value', value)
this.dataSource.commitChanges()
dialog.hide()
}.bind(this)
}, {
text: ORYX.I18N.PropertyWindow.cancel,
handler: function(){
this.setValue(this.value);
dialog.hide()
}.bind(this)
}]
});
dialog.show();
grid.render();
this.grid.stopEditing();
grid.focus( false, 100 );
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if (!ORYX.Plugins) {
ORYX.Plugins = new Object();
}
ORYX.Core.Commands["ShapeRepository.DropCommand"] = ORYX.Core.AbstractCommand.extend({
construct: function construct(option, currentParent, canAttach, position, facade) {
// call construct method of parent
arguments.callee.$.construct.call(this, facade);
this.option = option;
this.currentParent = currentParent;
this.canAttach = canAttach;
this.position = position;
this.selection = this.facade.getSelection();
this.shape;
this.parent;
},
getAffectedShapes: function getAffectedShapes() {
if (typeof this.shape !== "undefined") {
return [this.shape];
}
return [];
},
getCommandName: function getCommandName() {
return "ShapeRepository.DropCommand";
},
getDisplayName: function getDisplayName() {
return "Shape created";
},
getCommandData: function getCommandData() {
var commandData = {
id : this.shape.id,
resourceId : this.shape.resourceId,
parent : this.parent.resourceId,
currentParent : this.currentParent.resourceId,
position: this.position,
optionsPosition : this.option.position,
namespace : this.option.namespace,
type : this.option.type,
canAttach : this.canAttach
};
return commandData;
},
createFromCommandData: function createFromCommandData(facade, commandData) {
var currentParent = facade.getCanvas().getChildShapeOrCanvasByResourceId(commandData.currentParent);
var parent = facade.getCanvas().getChildShapeOrCanvasByResourceId(commandData.parent);
// Checking if the shape we drop the new shape into still exists.
if (typeof parent === 'undefined' || typeof currentParent === 'undefined' ) {
return undefined;
}
var options = {
'shapeOptions': {
'id': commandData.id,
'resourceId': commandData.resourceId
},
'position': commandData.optionsPosition,
'namespace': commandData.namespace,
'type': commandData.type
};
options.parent = parent;
return new ORYX.Core.Commands["ShapeRepository.DropCommand"](options, currentParent, commandData.canAttach, commandData.position, facade);
},
execute: function execute() {
if (!this.shape) {
this.shape = this.facade.createShape(this.option);
this.parent = this.shape.parent;
} else {
this.parent.add(this.shape);
}
if (this.canAttach && this.currentParent instanceof ORYX.Core.Node && this.shape.dockers.length > 0) {
var docker = this.shape.dockers[0];
if (this.currentParent.parent instanceof ORYX.Core.Node) {
this.currentParent.parent.add( docker.parent );
}
var relativePosition = this.facade.getCanvas().node.ownerSVGElement.createSVGPoint();
relativePosition.x = (this.currentParent.absoluteBounds().lowerRight().x - this.position.x) / this.currentParent.bounds.width();
relativePosition.y = (this.currentParent.absoluteBounds().lowerRight().y - this.position.y) / this.currentParent.bounds.height();
var absolutePosition;
if (typeof this.currentParent !== "undefined") {
absolutePosition = this.facade.getCanvas().node.ownerSVGElement.createSVGPoint();
if ((0 > relativePosition.x) || (relativePosition.x > 1) || (0 > relativePosition.y) || (relativePosition.y > 1)) {
relativePosition.x = 0;
relativePosition.y = 0;
}
absolutePosition.x = Math.abs(this.currentParent.absoluteBounds().lowerRight().x - relativePosition.x * this.currentParent.bounds.width());
absolutePosition.y = Math.abs(this.currentParent.absoluteBounds().lowerRight().y - relativePosition.y * this.currentParent.bounds.height());
} else {
absolutePosition = relativePosition;
}
docker.bounds.centerMoveTo(absolutePosition);
docker.setDockedShape( this.currentParent );
}
this.facade.getCanvas().update();
this.facade.updateSelection(this.isLocal());
},
rollback: function rollback() {
// If syncro tells us to revert a command, we have to pick necessary references ourselves.
if (typeof this.shape === 'undefined') {
this.shape = this.facade.getCanvas().getChildShapeByResourceId(this.option.shapeOptions.resourceId);
if (typeof this.shape === 'undefined') {
throw "Could not revert Shaperepository.DropCommand. this.shape is undefined.";
}
}
this.facade.deleteShape(this.shape);
this.facade.raiseEvent(
{
"type": ORYX.CONFIG.EVENT_SHAPEDELETED,
"shape": this.shape
}
);
var selectedShapes = this.facade.getSelection();
var newSelectedShapes = selectedShapes.without(this.shape);
this.facade.getCanvas().update();
if (this.isLocal()) {
this.facade.setSelection(newSelectedShapes);
} else {
var isDragging = this.facade.isDragging();
if (!isDragging) {
this.facade.setSelection(newSelectedShapes);
} else {
//raise event, which assures, that selection and canvas will be updated after dragging is finished
this.facade.raiseEvent(
{
"type": ORYX.CONFIG.EVENT_SHAPESTODELETE,
"deletedShapes": [this.shape]
}
);
}
}
this.facade.updateSelection(this.isLocal());
}
});
ORYX.Plugins.NewShapeRepository = {
construct: function(facade) {
arguments.callee.$.construct.call(this, facade); // super()
this.facade = facade;
this._currentParent;
this._canContain = undefined;
this._canAttach = undefined;
this.canvasContainer = $$(".ORYX_Editor")[0].parentNode;
this.shapeList = document.createElement('div');
this.shapeList.id = 'pwave-repository';
this.canvasContainer.appendChild(this.shapeList);
this.groupStencils = [];
// Create a Drag-Zone for Drag'n'Drop
var dragZone = new Ext.dd.DragZone(this.shapeList, {shadow: !Ext.isMac, hasOuterHandles: true});
dragZone.onDrag = function() { this.groupStencils.each(this._hideGroupStencil); }.bind(this);
dragZone.afterDragDrop = this.drop.bind(this, dragZone);
dragZone.beforeDragOver = this.beforeDragOver.bind(this, dragZone);
dragZone.beforeDragEnter = function() { this._lastOverElement = false; return true; }.bind(this);
// Load all Stencilssets
this.setStencilSets();
this.hoverTimeout = undefined;
this.timesHidden = 0;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_STENCIL_SET_LOADED, this.setStencilSets.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_MODE_CHANGED, this._handleModeChanged.bind(this));
},
_handleModeChanged: function _handleModeChanged(event) {
this._setVisibility(event.mode.isEditMode() && !event.mode.isPaintMode());
},
getVisibleCanvasHeight: function getVisibleCanvasHeight() {
var canvasContainer = $$(".ORYX_Editor")[0].parentNode;
return canvasContainer.offsetHeight;
},
/**
* Load all stencilsets in the shaperepository
*/
setStencilSets: function() {
// Remove all childs
var child = this.shapeList.firstChild;
while(child) {
this.shapeList.removeChild(child);
child = this.shapeList.firstChild;
}
// Go thru all Stencilsets and stencils
this.facade.getStencilSets().values().each((function(sset) {
var typeTitle = sset.title();
var extensions = sset.extensions();
if (extensions && extensions.size() > 0) {
typeTitle += " / " + ORYX.Core.StencilSet.getTranslation(extensions.values()[0], "title");
}
// For each Stencilset create and add a new Tree-Node
var stencilSetNode = document.createElement('div');
this.shapeList.appendChild(stencilSetNode);
// Get Stencils from Stencilset
var stencils = sset.stencils(this.facade.getCanvas().getStencil(),
this.facade.getRules());
var treeGroups = new Hash();
// Sort the stencils according to their position and add them to the repository
stencils = stencils.sortBy(function(value) { return value.position(); } );
stencils.each((function(stencil) {
var groups = stencil.groups();
groups.each((function(group) {
var firstInGroup = !treeGroups[group];
var groupStencil = undefined;
if(firstInGroup) {
// add large shape icon to shape repository
groupStencil = this.createGroupStencilNode(stencilSetNode, stencil, group);
// Create a new group
var groupElement = this.createGroupElement(groupStencil, group);
treeGroups[group] = groupElement;
this.addGroupStencilHoverListener(groupStencil);
this.groupStencils.push(groupStencil);
}
// Create the Stencil-Tree-Node
var stencilTreeNode = this.createStencilTreeNode(treeGroups[group], stencil);
var handles = [];
for (var i = 0; i < stencilTreeNode.childNodes.length; i++) {
handles.push(stencilTreeNode.childNodes[i]);
}
if (firstInGroup) {
handles.push(groupStencil.firstChild);
}
// Register the Stencil on Drag and Drop
Ext.dd.Registry.register(stencilTreeNode, {
'handles': handles, // Set the Handles
'isHandle': true,
'type': stencil.id(), // Set Type of stencil
namespace: stencil.namespace() // Set Namespace of stencil
});
}).bind(this));
}).bind(this));
}).bind(this));
},
addGroupStencilHoverListener: function addGroupStencilHoverListener(groupStencil) {
var timer = {};
var hideGroupElement = function hideGroupElement(event) {
// Hide the extended groupElement if the mouse is not moving to the groupElement
clearTimeout(timer);
this._hideGroupStencil(groupStencil);
}.bind(this);
var handleMouseOver = function handleMouseOver(event) {
var showGroupElement = function showGroupElement() {
var groupElement = jQuery(groupStencil).children(".new-repository-group");
var groupLeftBar = jQuery(groupElement).children(".new-repository-group-left-bar");
var groupHeader = jQuery(groupElement).children(".new-repository-group-header");
var stencilBoundingRect = groupStencil.getBoundingClientRect();
groupElement.css('top', stencilBoundingRect.top + 'px');
groupElement.css('left', stencilBoundingRect.right - 1 + 'px');
groupElement.addClass('new-repository-group-visible');
// Position the groupElement so its lower bound is not lower than 460px
var groupBoundingRect = groupHeader[0].getBoundingClientRect();
var lowestPosition = 530;
if (groupBoundingRect.bottom > lowestPosition) {
var invisibleOffset = groupBoundingRect.bottom - lowestPosition;
groupElement.css('top', groupBoundingRect.top - invisibleOffset + 'px');
groupLeftBar.css('height', stencilBoundingRect.bottom + 1 - groupElement.position().top + 'px'); // +1 for border
}
};
timer = setTimeout(showGroupElement, 500);
};
jQuery(groupStencil).bind('mouseenter', handleMouseOver);
jQuery(groupStencil).bind('mouseleave', hideGroupElement);
},
createGroupStencilNode: function createGroupStencilNode(parentTreeNode, stencil, groupname) {
// Create and add the Stencil to the Group
var newElement = document.createElement('div');
newElement.className = 'new-repository-group-stencil';
var stencilImage = document.createElement('div');
stencilImage.className = 'new-repository-group-stencil-bg';
stencilImage.style.backgroundImage = 'url(' + stencil.bigIcon() + ')';
newElement.appendChild(stencilImage);
parentTreeNode.appendChild(newElement);
return newElement;
},
createStencilTreeNode: function createStencilTreeNode(parentTreeNode, stencil) {
// Create and add the Stencil to the Group
var newRow = jQuery('<div class="new-repository-group-row"></div>');
newRow.append('<div class="new-repository-group-row-lefthighlight"></div>');
var entry = jQuery('<div class="new-repository-group-row-entry"></div>');
// entry.attr("title", stencil.description()); no tooltips
var icon = jQuery('<img></img>');
icon.attr('src', stencil.icon());
entry.append(icon);
entry.append(stencil.title());
newRow.append(entry);
newRow.append('<div class="new-repository-group-row-righthighlight"></div>');
jQuery(parentTreeNode).find(".new-repository-group-entries:first").append(newRow);
return entry[0];
},
createGroupElement: function createGroupElement(groupStencilNode, group) {
// Create the div that appears on the right side of the shape repository containing additional shapes of the group.
var groupElement = jQuery("<div class='new-repository-group'>" +
// left bar
"<div class='new-repository-group-left-bar'>" +
"<div class='new-repository-group-left-bar-bottom-gradient'></div>" +
"<div class='new-repository-group-left-bar-bottom-highlight'></div>" +
"</div>" +
// header
"<div class='new-repository-group-header'>" +
"<div style='position: relative; width: 100%'>" +
"<div class='new-repository-group-header-left-highlight'></div>" +
"<div class='new-repository-group-header-label'></div>" +
"<div class='new-repository-group-header-right-highlight'></div>" +
"<div class='new-repository-group-content'>" +
"<div class='new-repository-group-entries'></div>" +
"</div>" +
"</div>" +
"</div>" +
"</div>"
);
groupElement.find(".new-repository-group-header-label").text(group);
// Add the Group to the ShapeRepository
jQuery(groupStencilNode).append(groupElement);
return groupElement[0];
},
_hideGroupStencil: function _hideGroupStencil(groupStencil) {
var groupElement = jQuery(groupStencil).children(".new-repository-group:first");
groupElement.removeClass('new-repository-group-visible');
},
drop: function(dragZone, target, event) {
this._lastOverElement = undefined;
// Hide the highlighting
this.facade.raiseEvent({type: ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE, highlightId:'shapeRepo.added'});
this.facade.raiseEvent({type: ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE, highlightId:'shapeRepo.attached'});
// Check if drop is allowed
var proxy = dragZone.getProxy();
if(proxy.dropStatus == proxy.dropNotAllowed) { return; }
// Check if there is a current Parent
if(!this._currentParent) { return; }
var option = Ext.dd.Registry.getHandle(target.DDM.currentTarget);
// Make sure, that the shapeOptions of the last DropCommand are not reused.
option.shapeOptions = undefined;
var xy = event.getXY();
var pos = {x: xy[0], y: xy[1]};
var a = this.facade.getCanvas().node.getScreenCTM();
// Correcting the UpperLeft-Offset
pos.x -= a.e; pos.y -= a.f;
// Correcting the Zoom-Faktor
pos.x /= a.a; pos.y /= a.d;
// Correting the ScrollOffset
pos.x -= document.documentElement.scrollLeft;
pos.y -= document.documentElement.scrollTop;
// Correct position of parent
var parentAbs = this._currentParent.absoluteXY();
pos.x -= parentAbs.x;
pos.y -= parentAbs.y;
// Set position
option['position'] = pos;
// Set parent
if( this._canAttach && this._currentParent instanceof ORYX.Core.Node ){
option['parent'] = undefined;
} else {
option['parent'] = this._currentParent;
}
var position = this.facade.eventCoordinates( event.browserEvent );
var command = new ORYX.Core.Commands["ShapeRepository.DropCommand"](option, this._currentParent, this._canAttach, position, this.facade);
this.facade.executeCommands([command]);
this._currentParent = undefined;
},
beforeDragOver: function(dragZone, target, event){
var pr;
var coord = this.facade.eventCoordinates(event.browserEvent);
var aShapes = this.facade.getCanvas().getAbstractShapesAtPosition( coord );
if(aShapes.length <= 0) {
pr = dragZone.getProxy();
pr.setStatus(pr.dropNotAllowed);
pr.sync();
return false;
}
var el = aShapes.last();
if(aShapes.lenght == 1 && aShapes[0] instanceof ORYX.Core.Canvas) {
return false;
} else {
// check containment rules
var option = Ext.dd.Registry.getHandle(target.DDM.currentTarget);
var stencilSet = this.facade.getStencilSets()[option.namespace];
var stencil = stencilSet.stencil(option.type);
if(stencil.type() === "node") {
var parentCandidate = aShapes.reverse().find(function(candidate) {
return (candidate instanceof ORYX.Core.Canvas
|| candidate instanceof ORYX.Core.Node
|| candidate instanceof ORYX.Core.Edge);
});
if (parentCandidate !== this._lastOverElement) {
this._canAttach = undefined;
this._canContain = undefined;
}
if( parentCandidate ) {
//check containment rule
if (!(parentCandidate instanceof ORYX.Core.Canvas) && parentCandidate.isPointOverOffset(coord.x, coord.y) && this._canAttach == undefined) {
this._canAttach = this.facade.getRules().canConnect({
sourceShape: parentCandidate,
edgeStencil: stencil,
targetStencil: stencil
});
if( this._canAttach ){
// Show Highlight
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_HIGHLIGHT_SHOW,
highlightId: "shapeRepo.attached",
elements: [parentCandidate],
style: ORYX.CONFIG.SELECTION_HIGHLIGHT_STYLE_RECTANGLE,
color: ORYX.CONFIG.SELECTION_VALID_COLOR
});
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE,
highlightId: "shapeRepo.added"
});
this._canContain = undefined;
}
}
if(!(parentCandidate instanceof ORYX.Core.Canvas) && !parentCandidate.isPointOverOffset(coord.x, coord.y)){
this._canAttach = this._canAttach == false ? this._canAttach : undefined;
}
if( this._canContain == undefined && !this._canAttach) {
this._canContain = this.facade.getRules().canContain({
containingShape:parentCandidate,
containedStencil:stencil
});
// Show Highlight
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_HIGHLIGHT_SHOW,
highlightId:'shapeRepo.added',
elements: [parentCandidate],
color: this._canContain ? ORYX.CONFIG.SELECTION_VALID_COLOR : ORYX.CONFIG.SELECTION_INVALID_COLOR
});
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE,
highlightId:"shapeRepo.attached"
});
}
this._currentParent = this._canContain || this._canAttach ? parentCandidate : undefined;
this._lastOverElement = parentCandidate;
pr = dragZone.getProxy();
pr.setStatus(this._currentParent ? pr.dropAllowed : pr.dropNotAllowed );
pr.sync();
}
} else { //Edge
this._currentParent = this.facade.getCanvas();
pr = dragZone.getProxy();
pr.setStatus(pr.dropAllowed);
pr.sync();
}
}
return false;
},
_setVisibility: function _setVisibility(show) {
if (show) {
this.shapeList.show();
} else {
this.shapeList.hide();
}
}
};
ORYX.Plugins.NewShapeRepository = Clazz.extend(ORYX.Plugins.NewShapeRepository);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if (!ORYX.Plugins)
ORYX.Plugins = new Object();
/**
* This implements the interface between the syncro algorithm (syncro.js)
* and the Oryx editor
**/
ORYX.Plugins.SyncroOryx = Clazz.extend({
facade: undefined,
debug: false, //Set to true to see Apply/Revert-Log in console
construct: function construct(facade) {
this.facade = facade;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SYNCRO_NEW_REMOTE_COMMANDS, this.handleNewRemoteCommands.bind(this));
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_AFTER_COMMANDS_EXECUTED, this.handleAfterCommandsExecuted.bind(this));
},
/** Direction: Wave -> Oryx (New remote commands in Wave State) **/
handleNewRemoteCommands: function handleNewRemoteCommands(event) {
this.newCommand(event.newCommand, event.revertCommands, event.applyCommands);
},
newCommand: function newCommand(newCommand, revertCommands, applyCommands) {
if (this.debug) console.log("-----");
// Revert all commands in revertCommands
for (var i = 0; i < revertCommands.length; i++) {
if (this.debug) console.log({'revert':revertCommands[i]});
// Get command object from stack, if it exists, otherwise unpack/deserialize it
var commands = this.getCommandsFromStack(revertCommands[i]);
if (typeof commands === "undefined") {
commands = this.unpackToCommands(revertCommands[i]);
}
this.facade.rollbackCommands(commands);
}
// Apply all commands in applyCommands
for (var i = 0; i < applyCommands.length; i++) {
if (this.debug) console.log({'apply':applyCommands[i]});
// Get command object from stack, if it exists, otherwise unpack/deserialize it
var unpackedCommands = this.unpackToCommands(applyCommands[i]);
if (unpackedCommands.length !== 0) {
this.facade.executeCommands(unpackedCommands);
}
}
},
getCommandsFromStack: function getCommandsFromStack(stackItem) {
//Try to get command object from stack, avoids unnecessary deserialisation
var commandArrayOfStrings = stackItem.commands;
var commandDataArray = [];
for (var i = 0; i < commandArrayOfStrings.length; i++) {
commandDataArray.push(commandArrayOfStrings[i].evalJSON());
}
if (!commandDataArray[0].putOnStack) {
return undefined;
}
var stack = ORYX.Stacks.undo;
var ids = this.getIdsFromCommandArray(commandDataArray);
for (i = 0; stack.length; i++) {
for (var j = 0; j < ids.length; j++) {
if (ids[j] === stack[i][0].getCommandId()) {
return stack[i];
}
}
}
return [];
},
unpackToCommands: function unpackToCommands(stackItem) {
// deserialize a command and create command object
var commandArrayOfStrings = stackItem.commands;
var commandArray = [];
for (var i = 0; i < commandArrayOfStrings.length; i++) {
var cmdObj = commandArrayOfStrings[i].evalJSON();
var commandInstance = ORYX.Core.Commands[cmdObj.name].prototype.jsonDeserialize(this.facade, commandArrayOfStrings[i]);
if (typeof commandInstance === 'undefined') {
return [];
}
commandArray.push(commandInstance);
}
return commandArray;
},
/** Direction: Wave -> Oryx (New remote commands in Wave State) **/
handleAfterCommandsExecuted: function handleAfterCommandsExecuted(evt) {
// All commands executed locally need to be pushed to wave state
if (!evt.commands || !evt.commands[0].isLocal()) {
return;
}
var serializedCommands = [];
for (var i = 0; i < evt.commands.length; i++) {
if (evt.commands[i] instanceof ORYX.Core.AbstractCommand) {
//serialize commands
serializedCommands.push(evt.commands[i].jsonSerialize());
}
}
// pass serialized commands to syncro
this.facade.raiseEvent({
'type': ORYX.CONFIG.EVENT_SYNCRO_NEW_COMMANDS_FOR_REMOTE_STATE,
'commands': serializedCommands,
'forceExecution': true
});
},
/** helper functions **/
getIdsFromCommandArray: function getIdsFromCommandArray(commandArray) {
var commandIds = [];
for (var i = 0; i < commandArray.length; i++) {
commandIds.push(commandArray[i].id);
}
return commandIds;
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* This little script is used to enable debugging without the need to change oryx.js
*
* It is included in the test/examples/*.xhtml files as separate script
* To enable inclusion in the WAR file, build-with-script-files-flag has to be used together with
* build-with-xhtml-test-files-flag target
*/
// hack for Firebug 1.4.0a12, since console does not seem to be loaded automatically
// this is causes no harm for Firebug 1.3.3
loadFirebugConsole();
// TODO only enable debugging, if firebug is really there
// this doesn't work with Firebug 1.4.0a12
//if(typeof loadFirebugConsole == 'function') {
ORYX_LOGLEVEL = ORYX_LOGLEVEL_DEBUG;
//}
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
// enable key-Events on form-fields
Ext.override(Ext.form.Field, {
fireKey : function(e) {
if(((Ext.isIE && e.type == 'keydown') || e.type == 'keypress') && e.isSpecialKey()) {
this.fireEvent('specialkey', this, e);
}
else {
this.fireEvent(e.type, this, e);
}
}
, initEvents : function() {
// this.el.on(Ext.isIE ? "keydown" : "keypress", this.fireKey, this);
this.el.on("focus", this.onFocus, this);
this.el.on("blur", this.onBlur, this);
this.el.on("keydown", this.fireKey, this);
this.el.on("keypress", this.fireKey, this);
this.el.on("keyup", this.fireKey, this);
// reference to original value for reset
this.originalValue = this.getValue();
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if(!ORYX) var ORYX = {};
if(!ORYX.CONFIG) ORYX.CONFIG = {};
//This is usually the name of the war file!
ORYX.CONFIG.ROOT_PATH = document.location.href.substring(0,document.location.href.lastIndexOf("/")) + "/../oryx/";
ORYX.CONFIG.WEB_URL = "http://oryx-project.org";
ORYX.CONFIG.COLLABORATION = true;
ORYX.CONFIG.VERSION_URL = ORYX.CONFIG.ROOT_PATH + "VERSION";
ORYX.CONFIG.LICENSE_URL = ORYX.CONFIG.ROOT_PATH + "LICENSE";
ORYX.CONFIG.SERVER_HANDLER_ROOT = "";
ORYX.CONFIG.STENCILSET_HANDLER = ORYX.CONFIG.SERVER_HANDLER_ROOT + "";
/* Editor-Mode */
ORYX.CONFIG.MODE_READONLY = "readonly";
ORYX.CONFIG.MODE_FULLSCREEN = "fullscreen";
/* Show grid line while dragging */
ORYX.CONFIG.SHOW_GRIDLINE = true;
ORYX.CONFIG.DISABLE_GRADIENT = true;
/* Plugins */
ORYX.CONFIG.PLUGINS_ENABLED = true;
ORYX.CONFIG.PLUGINS_CONFIG = ORYX.CONFIG.ROOT_PATH + "editor/client/scripts/Plugins/plugins.xml";
ORYX.CONFIG.PROFILE_PATH = ORYX.CONFIG.ROOT_PATH + "profiles/";
ORYX.CONFIG.PLUGINS_FOLDER = "Plugins/";
ORYX.CONFIG.PDF_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "pdf";
ORYX.CONFIG.PNML_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "pnml";
ORYX.CONFIG.SIMPLE_PNML_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "simplepnmlexporter";
ORYX.CONFIG.DESYNCHRONIZABILITY_URL = ORYX.CONFIG.ROOT_PATH + "desynchronizability";
ORYX.CONFIG.IBPMN2BPMN_URL = ORYX.CONFIG.ROOT_PATH + "ibpmn2bpmn";
ORYX.CONFIG.QUERYEVAL_URL = ORYX.CONFIG.ROOT_PATH + "query";
ORYX.CONFIG.SYNTAXCHECKER_URL = ORYX.CONFIG.ROOT_PATH + "syntaxchecker";
ORYX.CONFIG.VALIDATOR_URL = ORYX.CONFIG.ROOT_PATH + "validator";
ORYX.CONFIG.AUTO_LAYOUTER_URL = ORYX.CONFIG.ROOT_PATH + "layouter";
ORYX.CONFIG.SS_EXTENSIONS_FOLDER = ORYX.CONFIG.ROOT_PATH + "editor/data/stencilsets/extensions/";
ORYX.CONFIG.SS_EXTENSIONS_CONFIG = ORYX.CONFIG.ROOT_PATH + "editor/data/stencilsets/extensions/extensions.json";
ORYX.CONFIG.ORYX_NEW_URL = "/new";
ORYX.CONFIG.STEP_THROUGH = ORYX.CONFIG.ROOT_PATH + "stepthrough";
ORYX.CONFIG.STEP_THROUGH_CHECKER = ORYX.CONFIG.ROOT_PATH + "stepthroughchecker";
ORYX.CONFIG.XFORMS_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "xformsexport";
ORYX.CONFIG.XFORMS_EXPORT_ORBEON_URL = ORYX.CONFIG.ROOT_PATH + "xformsexport-orbeon";
ORYX.CONFIG.XFORMS_IMPORT_URL = ORYX.CONFIG.ROOT_PATH + "xformsimport";
ORYX.CONFIG.BPEL_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "bpelexporter";
ORYX.CONFIG.BPEL4CHOR_EXPORT_URL = ORYX.CONFIG.ROOT_PATH + "bpel4chorexporter";
ORYX.CONFIG.TREEGRAPH_SUPPORT = ORYX.CONFIG.ROOT_PATH + "treegraphsupport";
ORYX.CONFIG.XPDL4CHOR2BPEL4CHOR_TRANSFORMATION_URL = ORYX.CONFIG.ROOT_PATH + "xpdl4chor2bpel4chor";
ORYX.CONFIG.RESOURCE_LIST = ORYX.CONFIG.ROOT_PATH + "resourceList";
ORYX.CONFIG.BPMN_LAYOUTER = ORYX.CONFIG.ROOT_PATH + "bpmnlayouter";
ORYX.CONFIG.EPC_LAYOUTER = ORYX.CONFIG.ROOT_PATH + "epclayouter";
ORYX.CONFIG.BPMN2MIGRATION = ORYX.CONFIG.ROOT_PATH + "bpmn2migration";
ORYX.CONFIG.BPMN20_SCHEMA_VALIDATION_ON = true;
/* Namespaces */
ORYX.CONFIG.NAMESPACE_ORYX = "http://www.b3mn.org/oryx";
ORYX.CONFIG.NAMESPACE_SVG = "http://www.w3.org/2000/svg";
/* UI */
ORYX.CONFIG.CANVAS_WIDTH = 1920;
ORYX.CONFIG.CANVAS_HEIGHT = 550;
ORYX.CONFIG.CANVAS_RESIZE_INTERVAL = 300;
ORYX.CONFIG.SELECTED_AREA_PADDING = 4;
ORYX.CONFIG.CANVAS_BACKGROUND_COLOR = "none";
ORYX.CONFIG.GRID_DISTANCE = 30;
ORYX.CONFIG.GRID_ENABLED = true;
ORYX.CONFIG.ZOOM_OFFSET = 0.1;
ORYX.CONFIG.DEFAULT_SHAPE_MARGIN = 60;
ORYX.CONFIG.SCALERS_SIZE = 7;
ORYX.CONFIG.MINIMUM_SIZE = 20;
ORYX.CONFIG.MAXIMUM_SIZE = 10000;
ORYX.CONFIG.OFFSET_MAGNET = 15;
ORYX.CONFIG.OFFSET_EDGE_LABEL_TOP = 14;
ORYX.CONFIG.OFFSET_EDGE_LABEL_MIDDLE = 4;
ORYX.CONFIG.OFFSET_EDGE_LABEL_BOTTOM = 12;
ORYX.CONFIG.OFFSET_EDGE_BOUNDS = 5;
ORYX.CONFIG.COPY_MOVE_OFFSET = 30;
ORYX.CONFIG.SHOW_GRIDLINE = true;
ORYX.CONFIG.BORDER_OFFSET = 14;
ORYX.CONFIG.MAX_NUM_SHAPES_NO_GROUP = 10;
ORYX.CONFIG.SHAPEMENU_CREATE_OFFSET_CORNER = 30;
ORYX.CONFIG.SHAPEMENU_CREATE_OFFSET = 45;
/* Shape-Menu Align */
ORYX.CONFIG.SHAPEMENU_RIGHT = "Oryx_Right";
ORYX.CONFIG.SHAPEMENU_BOTTOM = "Oryx_Bottom";
ORYX.CONFIG.SHAPEMENU_LEFT = "Oryx_Left";
ORYX.CONFIG.SHAPEMENU_TOP = "Oryx_Top";
/* Morph-Menu Item */
ORYX.CONFIG.MORPHITEM_DISABLED = "Oryx_MorphItem_disabled";
/* Property type names */
ORYX.CONFIG.TYPE_STRING = "string";
ORYX.CONFIG.TYPE_BOOLEAN = "boolean";
ORYX.CONFIG.TYPE_INTEGER = "integer";
ORYX.CONFIG.TYPE_FLOAT = "float";
ORYX.CONFIG.TYPE_COLOR = "color";
ORYX.CONFIG.TYPE_DATE = "date";
ORYX.CONFIG.TYPE_CHOICE = "choice";
ORYX.CONFIG.TYPE_URL = "url";
ORYX.CONFIG.TYPE_DIAGRAM_LINK = "diagramlink";
ORYX.CONFIG.TYPE_COMPLEX = "complex";
ORYX.CONFIG.TYPE_TEXT = "text";
/* Vertical line distance of multiline labels */
ORYX.CONFIG.LABEL_LINE_DISTANCE = 2;
ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT = 12;
ORYX.CONFIG.ENABLE_MORPHMENU_BY_HOVER = true;
/* Editor constants come here */
ORYX.CONFIG.EDITOR_ALIGN_BOTTOM = 0x01;
ORYX.CONFIG.EDITOR_ALIGN_MIDDLE = 0x02;
ORYX.CONFIG.EDITOR_ALIGN_TOP = 0x04;
ORYX.CONFIG.EDITOR_ALIGN_LEFT = 0x08;
ORYX.CONFIG.EDITOR_ALIGN_CENTER = 0x10;
ORYX.CONFIG.EDITOR_ALIGN_RIGHT = 0x20;
ORYX.CONFIG.EDITOR_ALIGN_SIZE = 0x30;
ORYX.CONFIG.EVENT_MOUSEDOWN = "mousedown";
ORYX.CONFIG.EVENT_MOUSEUP = "mouseup";
ORYX.CONFIG.EVENT_MOUSEOVER = "mouseover";
ORYX.CONFIG.EVENT_MOUSEOUT = "mouseout";
ORYX.CONFIG.EVENT_MOUSEMOVE = "mousemove";
ORYX.CONFIG.EVENT_DBLCLICK = "dblclick";
ORYX.CONFIG.EVENT_KEYDOWN = "keydown";
ORYX.CONFIG.EVENT_KEYUP = "keyup";
ORYX.CONFIG.EVENT_LOADED = "editorloaded";
ORYX.CONFIG.EVENT_SHAPEBOUNDS_CHANGED = "shapeBoundsChanged";
ORYX.CONFIG.EVENT_EXECUTE_COMMANDS = "executeCommands";
ORYX.CONFIG.EVENT_AFTER_COMMANDS_EXECUTED = "afterCommandsExecuted";
ORYX.CONFIG.EVENT_AFTER_COMMANDS_ROLLBACK = "afterCommandsRollback";
ORYX.CONFIG.EVENT_STENCIL_SET_LOADED = "stencilSetLoaded";
ORYX.CONFIG.EVENT_SELECTION_CHANGED = "selectionchanged";
ORYX.CONFIG.EVENT_SHAPEADDED = "shapeadded";
ORYX.CONFIG.EVENT_SHAPEDELETED = "shapedeleted";
ORYX.CONFIG.EVENT_SHAPESTODELETE = "shapesToDelete";
ORYX.CONFIG.EVENT_SHAPESTOUNDODELETE = "shapesToUndoDelete";
ORYX.CONFIG.EVENT_PROPERTY_CHANGED = "propertyChanged";
ORYX.CONFIG.EVENT_DRAGDROP_START = "dragdrop.start";
ORYX.CONFIG.EVENT_SHAPE_MENU_CLOSE = "shape.menu.close";
ORYX.CONFIG.EVENT_DRAGDROP_END = "dragdrop.end";
ORYX.CONFIG.EVENT_RESIZE_START = "resize.start";
ORYX.CONFIG.EVENT_RESIZE_END = "resize.end";
ORYX.CONFIG.EVENT_DRAGDOCKER_DOCKED = "dragDocker.docked";
ORYX.CONFIG.EVENT_HIGHLIGHT_SHOW = "highlight.showHighlight";
ORYX.CONFIG.EVENT_HIGHLIGHT_HIDE = "highlight.hideHighlight";
ORYX.CONFIG.EVENT_LOADING_ENABLE = "loading.enable";
ORYX.CONFIG.EVENT_LOADING_DISABLE = "loading.disable";
ORYX.CONFIG.EVENT_LOADING_STATUS = "loading.status";
ORYX.CONFIG.EVENT_OVERLAY_SHOW = "overlay.show";
ORYX.CONFIG.EVENT_OVERLAY_HIDE = "overlay.hide";
ORYX.CONFIG.EVENT_ARRANGEMENT_TOP = "arrangement.setToTop";
ORYX.CONFIG.EVENT_ARRANGEMENT_BACK = "arrangement.setToBack";
ORYX.CONFIG.EVENT_ARRANGEMENT_FORWARD = "arrangement.setForward";
ORYX.CONFIG.EVENT_ARRANGEMENT_BACKWARD = "arrangement.setBackward";
ORYX.CONFIG.EVENT_ARRANGEMENTLIGHT_TOP = "arrangementLight.setToTop";
ORYX.CONFIG.EVENT_PROPWINDOW_PROP_CHANGED = "propertyWindow.propertyChanged";
ORYX.CONFIG.EVENT_LAYOUT_ROWS = "layout.rows";
ORYX.CONFIG.EVENT_LAYOUT_EDGES = "layout.edges";
ORYX.CONFIG.EVENT_LAYOUT_BPEL = "layout.BPEL";
ORYX.CONFIG.EVENT_LAYOUT_BPEL_VERTICAL = "layout.BPEL.vertical";
ORYX.CONFIG.EVENT_LAYOUT_BPEL_HORIZONTAL = "layout.BPEL.horizontal";
ORYX.CONFIG.EVENT_LAYOUT_BPEL_SINGLECHILD = "layout.BPEL.singlechild";
ORYX.CONFIG.EVENT_LAYOUT_BPEL_AUTORESIZE = "layout.BPEL.autoresize";
ORYX.CONFIG.EVENT_AUTOLAYOUT_LAYOUT = "autolayout.layout";
ORYX.CONFIG.EVENT_UNDO_EXECUTE = "undo.execute";
ORYX.CONFIG.EVENT_UNDO_ROLLBACK = "undo.rollback";
ORYX.CONFIG.EVENT_BUTTON_UPDATE = "toolbar.button.update";
ORYX.CONFIG.EVENT_LAYOUT = "layout.dolayout";
ORYX.CONFIG.EVENT_COLOR_CHANGE = "color.change";
ORYX.CONFIG.EVENT_NEW_POST_MESSAGE_RECEIVED = "newPostCommandReceived";
ORYX.CONFIG.EVENT_FARBRAUSCH_NEW_INFOS = "farbrausch.new.infos";
ORYX.CONFIG.EVENT_USER_ID_CHANGED = "collaboration.userId";
ORYX.CONFIG.EVENT_VIEW_FIT_TO_MODEL = "view.fitToModel";
ORYX.CONFIG.EVENT_SHAPE_METADATA_CHANGED = "shapeMetaDataChanged";
ORYX.CONFIG.EVENT_SIDEBAR_LOADED = "sideTabs.loaded";
ORYX.CONFIG.EVENT_SIDEBAR_NEW_TAB = "sideTabs.newTab";
ORYX.CONFIG.EVENT_POST_MESSAGE = "post.message";
ORYX.CONFIG.EVENT_SHOW_PROPERTYWINDOW = "propertywindow.show";
ORYX.CONFIG.EVENT_CANVAS_RESIZED = "canvasResize.resized";
ORYX.CONFIG.EVENT_CANVAS_RESIZE_SHAPES_MOVED = "canvasResize.shapesMoved";
ORYX.CONFIG.EVENT_CANVAS_RESIZE_UPDATE_HIGHLIGHTS = "canvasResize.updateHighlights";
ORYX.CONFIG.EVENT_LABEL_DBLCLICK = "label.dblclick";
ORYX.CONFIG.EVENT_CANVAS_DRAGDROP_LOCK_TOGGLE = "canvas.dragDropLockChanged";
ORYX.CONFIG.EVENT_SYNCRO_INITIALIZATION_DONE = "syncro.initializationDone";
ORYX.CONFIG.EVENT_COMMAND_ADDED_TO_UNDO_STACK = "changelog.command_added";
ORYX.CONFIG.EVENT_COMMAND_MOVED_FROM_UNDO_STACK = "changelog.command_moved_from_undo";
ORYX.CONFIG.EVENT_COMMAND_MOVED_FROM_REDO_STACK = "changelog.command_moved_from_redo";
ORYX.CONFIG.EVENT_DOCKERDRAG = "dragTheDocker";
ORYX.CONFIG.EVENT_PAINT_NEWSHAPE = "paint.newShape";
ORYX.CONFIG.EVENT_PAINT_REMOVESHAPE = "paint.removeShape";
ORYX.CONFIG.EVENT_PAINT_CANVAS_TOGGLED = "paint.toggled";
ORYX.CONFIG.EVENT_BLIP_TOGGLED = "blip.toggled";
ORYX.CONFIG.EVENT_MODE_CHANGED = "mode.change";
ORYX.CONFIG.EVENT_CANVAS_ZOOMED = "canvas.zoomed";
ORYX.CONFIG.EVENT_DISPLAY_SCHLAUMEIER = "schlaumeier.display";
ORYX.CONFIG.EVENT_HIDE_SCHLAUMEIER = "schlaumeier.hide";
ORYX.CONFIG.EVENT_ORYX_SHOWN = "oryx.shown";
ORYX.CONFIG.EVENT_DISABLE_DOCKER_CREATION = "addDocker.disableCreation";
ORYX.CONFIG.EVENT_ENABLE_DOCKER_CREATION = "addDocker.enableCreation";
ORYX.CONFIG.EVENT_SYNCRO_NEW_COMMANDS_FOR_REMOTE_STATE = "syncro.newCommandsForRemoteState"
ORYX.CONFIG.EVENT_SYNCRO_NEW_REMOTE_COMMANDS = "syncro.newRemoteCommands"
ORYX.CONFIG.FARBRAUSCH_DEFAULT_COLOR = "#000000";
/* Selection Shapes Highlights */
ORYX.CONFIG.SELECTION_HIGHLIGHT_SIZE = 5;
ORYX.CONFIG.SELECTION_HIGHLIGHT_COLOR = "#4444FF";
ORYX.CONFIG.SELECTION_HIGHLIGHT_COLOR2 = "#9999FF";
ORYX.CONFIG.SELECTION_HIGHLIGHT_STYLE_CORNER = "corner";
ORYX.CONFIG.SELECTION_HIGHLIGHT_STYLE_RECTANGLE = "rectangle";
ORYX.CONFIG.SELECTION_VALID_COLOR = "#00FF00";
ORYX.CONFIG.SELECTION_INVALID_COLOR = "#FF0000";
ORYX.CONFIG.DOCKER_DOCKED_COLOR = "#00FF00";
ORYX.CONFIG.DOCKER_UNDOCKED_COLOR = "#FF0000";
ORYX.CONFIG.DOCKER_SNAP_OFFSET = 10;
/* Copy & Paste */
ORYX.CONFIG.EDIT_OFFSET_PASTE = 10;
/* Key-Codes */
ORYX.CONFIG.KEY_CODE_X = 88;
ORYX.CONFIG.KEY_CODE_C = 67;
ORYX.CONFIG.KEY_CODE_V = 86;
ORYX.CONFIG.KEY_CODE_DELETE = 46;
ORYX.CONFIG.KEY_CODE_META = 224;
ORYX.CONFIG.KEY_CODE_BACKSPACE = 8;
ORYX.CONFIG.KEY_CODE_LEFT = 37;
ORYX.CONFIG.KEY_CODE_RIGHT = 39;
ORYX.CONFIG.KEY_CODE_UP = 38;
ORYX.CONFIG.KEY_CODE_DOWN = 40;
// TODO Determine where the lowercase constants are still used and remove them from here.
ORYX.CONFIG.KEY_Code_enter = 12;
ORYX.CONFIG.KEY_Code_left = 37;
ORYX.CONFIG.KEY_Code_right = 39;
ORYX.CONFIG.KEY_Code_top = 38;
ORYX.CONFIG.KEY_Code_bottom = 40;
/* Supported Meta Keys */
ORYX.CONFIG.META_KEY_META_CTRL = "metactrl";
ORYX.CONFIG.META_KEY_ALT = "alt";
ORYX.CONFIG.META_KEY_SHIFT = "shift";
/* Key Actions */
ORYX.CONFIG.KEY_ACTION_DOWN = "down";
ORYX.CONFIG.KEY_ACTION_UP = "up";
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
function printf() {
var result = arguments[0];
for (var i=1; i<arguments.length; i++)
result = result.replace('%' + (i-1), arguments[i]);
return result;
}
// oryx constants.
var ORYX_LOGLEVEL_TRACE = 5;
var ORYX_LOGLEVEL_DEBUG = 4;
var ORYX_LOGLEVEL_INFO = 3;
var ORYX_LOGLEVEL_WARN = 2;
var ORYX_LOGLEVEL_ERROR = 1;
var ORYX_LOGLEVEL_FATAL = 0;
var ORYX_LOGLEVEL = ORYX_LOGLEVEL_WARN;
var ORYX_CONFIGURATION_DELAY = 100;
var ORYX_CONFIGURATION_WAIT_ATTEMPTS = 10;
if(!ORYX) var ORYX = {};
ORYX = Object.extend(ORYX, {
//set the path in the config.js file!!!!
PATH: ORYX.CONFIG.ROOT_PATH,
//CONFIGURATION: "config.js",
URLS: [
/*
* No longer needed, since compiled into one source file that
* contains all of this files concatenated in the exact order
* as defined in build.xml.
*/
/*
"scripts/Core/SVG/editpathhandler.js",
"scripts/Core/SVG/minmaxpathhandler.js",
"scripts/Core/SVG/pointspathhandler.js",
"scripts/Core/SVG/svgmarker.js",
"scripts/Core/SVG/svgshape.js",
"scripts/Core/SVG/label.js",
"scripts/Core/Math/math.js",
"scripts/Core/StencilSet/stencil.js",
"scripts/Core/StencilSet/property.js",
"scripts/Core/StencilSet/propertyitem.js",
"scripts/Core/StencilSet/rules.js",
"scripts/Core/StencilSet/stencilset.js",
"scripts/Core/StencilSet/stencilsets.js",
"scripts/Core/bounds.js",
"scripts/Core/uiobject.js",
"scripts/Core/abstractshape.js",
"scripts/Core/canvas.js",
"scripts/Core/main.js",
"scripts/Core/svgDrag.js",
"scripts/Core/shape.js",
"scripts/Core/Controls/control.js",
"scripts/Core/Controls/docker.js",
"scripts/Core/Controls/magnet.js",
"scripts/Core/node.js",
"scripts/Core/edge.js"
*/ ],
alreadyLoaded: [],
configrationRetries: 0,
Version: '0.1.1',
availablePlugins: [],
/**
* The ORYX.Log logger.
*/
Log: {
__appenders: [
{ append: function(message) {
console.log(message); }}
],
trace: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_TRACE)
ORYX.Log.__log('TRACE', arguments); },
debug: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_DEBUG)
ORYX.Log.__log('DEBUG', arguments); },
info: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_INFO)
ORYX.Log.__log('INFO', arguments); },
warn: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_WARN)
ORYX.Log.__log('WARN', arguments); },
error: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_ERROR)
ORYX.Log.__log('ERROR', arguments); },
fatal: function() { if(ORYX_LOGLEVEL >= ORYX_LOGLEVEL_FATAL)
ORYX.Log.__log('FATAL', arguments); },
__log: function(prefix, messageParts) {
messageParts[0] = (new Date()).getTime() + " "
+ prefix + " " + messageParts[0];
var message = printf.apply(null, messageParts);
ORYX.Log.__appenders.each(function(appender) {
appender.append(message);
});
},
addAppender: function(appender) {
ORYX.Log.__appenders.push(appender);
}
},
/**
* First bootstrapping layer. The Oryx loading procedure begins. In this
* step, all preliminaries that are not in the responsibility of Oryx to be
* met have to be checked here, such as the existance of the prototpe
* library in the current execution environment. After that, the second
* bootstrapping layer is being invoked. Failing to ensure that any
* preliminary condition is not met has to fail with an error.
*/
load: function() {
ORYX.Log.debug("Oryx begins loading procedure.");
// check for prototype
if( (typeof Prototype=='undefined') ||
(typeof Element == 'undefined') ||
(typeof Element.Methods=='undefined') ||
parseFloat(Prototype.Version.split(".")[0] + "." +
Prototype.Version.split(".")[1]) < 1.5)
throw("Application requires the Prototype JavaScript framework >= 1.5.3");
ORYX.Log.debug("Prototype > 1.5 found.");
// continue loading.
ORYX._load();
},
/**
* Second bootstrapping layer. The oryx configuration is checked. When not
* yet loaded, config.js is being requested from the server. A repeated
* error in retrieving the configuration will result in an error to be
* thrown after a certain time of retries. Once the configuration is there,
* all urls that are registered with oryx loading are being requested from
* the server. Once everything is loaded, the third layer is being invoked.
*/
_load: function() {
/*
// if configuration not there already,
if(!(ORYX.CONFIG)) {
// if this is the first attempt...
if(ORYX.configrationRetries == 0) {
// get the path and filename.
var configuration = ORYX.PATH + ORYX.CONFIGURATION;
ORYX.Log.debug("Configuration not found, loading from '%0'.",
configuration);
// require configuration file.
Kickstart.require(configuration);
// else if attempts exceeded ...
} else if(ORYX.configrationRetries >= ORYX_CONFIGURATION_WAIT_ATTEMPTS) {
throw "Tried to get configuration" +
ORYX_CONFIGURATION_WAIT_ATTEMPTS +
" times from '" + configuration + "'. Giving up."
} else if(ORYX.configrationRetries > 0){
// point out how many attempts are left...
ORYX.Log.debug("Waiting once more (%0 attempts left)",
(ORYX_CONFIGURATION_WAIT_ATTEMPTS -
ORYX.configrationRetries));
}
// any case: continue in a moment with increased retry count.
ORYX.configrationRetries++;
window.setTimeout(ORYX._load, ORYX_CONFIGURATION_DELAY);
return;
}
ORYX.Log.info("Configuration loaded.");
// load necessary scripts.
ORYX.URLS.each(function(url) {
ORYX.Log.debug("Requireing '%0'", url);
Kickstart.require(ORYX.PATH + url) });
*/
// configurate logging and load plugins.
ORYX.loadPlugins();
},
/**
* Third bootstrapping layer. This is where first the plugin coniguration
* file is loaded into oryx, analyzed, and where all plugins are being
* requested by the server. Afterwards, all editor instances will be
* initialized.
*/
loadPlugins: function() {
// load plugins if enabled.
if(ORYX.CONFIG.PLUGINS_ENABLED)
ORYX._loadPlugins()
else
ORYX.Log.warn("Ignoring plugins, loading Core only.");
// init the editor instances.
init();
},
_loadPlugins: function() {
// load plugin configuration file.
var source = ORYX.CONFIG.PLUGINS_CONFIG;
ORYX.Log.debug("Loading plugin configuration from '%0'.", source);
new Ajax.Request(source, {
asynchronous: false,
method: 'get',
onSuccess: function(result) {
/*
* This is the method that is being called when the plugin
* configuration was successfully loaded from the server. The
* file has to be processed and the contents need to be
* considered for further plugin requireation.
*/
ORYX.Log.info("Plugin configuration file loaded.");
// get plugins.xml content
var resultXml = result.responseXML;
// TODO: Describe how properties are handled.
// Get the globale Properties
var globalProperties = [];
var preferences = $A(resultXml.getElementsByTagName("properties"));
preferences.each( function(p) {
var props = $A(p.childNodes);
props.each( function(prop) {
var property = new Hash();
// get all attributes from the node and set to global properties
var attributes = $A(prop.attributes)
attributes.each(function(attr){property[attr.nodeName] = attr.nodeValue});
if(attributes.length > 0) { globalProperties.push(property) };
});
});
// TODO Why are we using XML if we don't respect structure anyway?
// for each plugin element in the configuration..
var plugin = resultXml.getElementsByTagName("plugin");
$A(plugin).each( function(node) {
// get all element's attributes.
// TODO: What about: var pluginData = $H(node.attributes) !?
var pluginData = new Hash();
$A(node.attributes).each( function(attr){
pluginData[attr.nodeName] = attr.nodeValue});
// ensure there's a name attribute.
if(!pluginData['name']) {
ORYX.Log.error("A plugin is not providing a name. Ingnoring this plugin.");
return;
}
// ensure there's a source attribute.
if(!pluginData['source']) {
ORYX.Log.error("Plugin with name '%0' doesn't provide a source attribute.", pluginData['name']);
return;
}
// Get all private Properties
var propertyNodes = node.getElementsByTagName("property");
var properties = [];
$A(propertyNodes).each(function(prop) {
var property = new Hash();
// Get all Attributes from the Node
var attributes = $A(prop.attributes)
attributes.each(function(attr){property[attr.nodeName] = attr.nodeValue});
if(attributes.length > 0) { properties.push(property) };
});
// Set all Global-Properties to the Properties
properties = properties.concat(globalProperties);
// Set Properties to Plugin-Data
pluginData['properties'] = properties;
// Get the RequieredNodes
var requireNodes = node.getElementsByTagName("requires");
var requires;
$A(requireNodes).each(function(req) {
var namespace = $A(req.attributes).find(function(attr){ return attr.name == "namespace"})
if( namespace && namespace.nodeValue ){
if( !requires ){
requires = {namespaces:[]}
}
requires.namespaces.push(namespace.nodeValue)
}
});
// Set Requires to the Plugin-Data, if there is one
if( requires ){
pluginData['requires'] = requires;
}
// Get the RequieredNodes
var notUsesInNodes = node.getElementsByTagName("notUsesIn");
var notUsesIn;
$A(notUsesInNodes).each(function(not) {
var namespace = $A(not.attributes).find(function(attr){ return attr.name == "namespace"})
if( namespace && namespace.nodeValue ){
if( !notUsesIn ){
notUsesIn = {namespaces:[]}
}
notUsesIn.namespaces.push(namespace.nodeValue)
}
});
// Set Requires to the Plugin-Data, if there is one
if( notUsesIn ){
pluginData['notUsesIn'] = notUsesIn;
}
var url = ORYX.PATH + ORYX.CONFIG.PLUGINS_FOLDER + pluginData['source'];
ORYX.Log.debug("Requireing '%0'", url);
// Add the Script-Tag to the Site
//Kickstart.require(url);
ORYX.Log.info("Plugin '%0' successfully loaded.", pluginData['name']);
// Add the Plugin-Data to all available Plugins
ORYX.availablePlugins.push(pluginData);
});
},
onFailure:this._loadPluginsOnFails
});
},
_loadPluginsOnFails: function(result) {
ORYX.Log.error("Plugin configuration file not available.");
}
});
ORYX.Log.debug('Registering Oryx with Kickstart');
Kickstart.register(ORYX.load);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
NAMESPACE_SVG = "http://www.w3.org/2000/svg";
NAMESPACE_ORYX = "http://www.b3mn.org/oryx";
/**
* Init namespaces
*/
if (!ORYX) {
var ORYX = {};
}
if (!ORYX.Core) {
ORYX.Core = {};
}
/**
* @classDescription Abstract base class for all connections.
* @extends {ORYX.Core.Shape}
* @param options {Object}
*
* TODO da die verschiebung der Edge nicht ueber eine
* translation gemacht wird, die sich auch auf alle kind UIObjects auswirkt,
* muessen die kinder hier beim verschieben speziell betrachtet werden.
* Das sollte ueberarbeitet werden.
*
*/
ORYX.Core.Edge = {
/**
* Constructor
* @param {Object} options
* @param {Stencil} stencil
*/
construct: function(options, stencil){
arguments.callee.$.construct.apply(this, arguments);
this.isMovable = true;
this.isSelectable = true;
this._dockerUpdated = false;
this._markers = new Hash(); //a hash map of SVGMarker objects where keys are the marker ids
this._paths = [];
this._interactionPaths = [];
this._dockersByPath = new Hash();
this._markersByPath = new Hash();
/* Data structures to store positioning information of attached child nodes */
this.attachedNodePositionData = new Hash();
//TODO was muss hier initial erzeugt werden?
var stencilNode = this.node.childNodes[0].childNodes[0];
stencilNode = ORYX.Editor.graft("http://www.w3.org/2000/svg", stencilNode, ['g', {
"pointer-events": "painted"
}]);
//Add to the EventHandler
this.addEventHandlers(stencilNode);
this._oldBounds = this.bounds.clone();
//load stencil
this._init(this._stencil.view());
if (stencil instanceof Array) {
this.deserialize(stencil);
}
},
_update: function(force){
if(this._dockerUpdated || this.isChanged || force) {
this.dockers.invoke("update");
if (this.bounds.width() === 0 || this.bounds.height() === 0) {
this.bounds.moveBy({
x: this.bounds.width() === 0 ? -1 : 0,
y: this.bounds.height() === 0 ? -1 : 0
});
this.bounds.extend({
x: this.bounds.width() === 0 ? 2 : 0,
y: this.bounds.height() === 0 ? 2 : 0
});
}
// TODO: Bounds muss abhaengig des Eltern-Shapes gesetzt werden
var upL = this.bounds.upperLeft();
var oldUpL = this._oldBounds.upperLeft();
var oldWidth = this._oldBounds.width() === 0 ? this.bounds.width() : this._oldBounds.width();
var oldHeight = this._oldBounds.height() === 0 ? this.bounds.height() : this._oldBounds.height();
var diffX = upL.x - oldUpL.x;
var diffY = upL.y - oldUpL.y;
var diffWidth = this.bounds.width() / oldWidth;
var diffHeight = this.bounds.height() / oldHeight;
this.dockers.each((function(docker){
// Unregister on BoundsChangedCallback
docker.bounds.unregisterCallback(this._dockerChangedCallback);
// If there is any changes at the edge and is there is not an DockersUpdate
// set the new bounds to the docker
if (!this._dockerUpdated) {
docker.bounds.moveBy(diffX, diffY);
if (diffWidth !== 1 || diffHeight !== 1) {
var relX = docker.bounds.upperLeft().x - upL.x;
var relY = docker.bounds.upperLeft().y - upL.y;
docker.bounds.moveTo(upL.x + relX * diffWidth, upL.y + relY * diffHeight);
}
}
// Do Docker update and register on DockersBoundChange
docker.update();
docker.bounds.registerCallback(this._dockerChangedCallback);
}).bind(this));
if (this._dockerUpdated) {
var a = this.dockers.first().bounds.center();
var b = this.dockers.first().bounds.center();
this.dockers.each((function(docker){
var center = docker.bounds.center();
a.x = Math.min(a.x, center.x);
a.y = Math.min(a.y, center.y);
b.x = Math.max(b.x, center.x);
b.y = Math.max(b.y, center.y);
}).bind(this));
//set the bounds of the the association
this.bounds.set(Object.clone(a), Object.clone(b));
}
//reposition labels
this.getLabels().each(function(label) {
switch (label.edgePosition) {
case "starttop":
var angle = this._getAngle(this.dockers[0], this.dockers[1]);
var pos = this.dockers.first().bounds.center();
if (angle <= 90 || angle > 270) {
label.horizontalAlign("left");
label.verticalAlign("bottom");
label.x = pos.x + label.getOffsetTop();
label.y = pos.y - label.getOffsetTop();
label.rotate(360 - angle, pos);
} else {
label.horizontalAlign("right");
label.verticalAlign("bottom");
label.x = pos.x - label.getOffsetTop();
label.y = pos.y - label.getOffsetTop();
label.rotate(180 - angle, pos);
}
break;
case "startmiddle":
var angle = this._getAngle(this.dockers[0], this.dockers[1]);
var pos = this.dockers.first().bounds.center();
if (angle <= 90 || angle > 270) {
label.horizontalAlign("left");
label.verticalAlign("bottom");
label.x = pos.x + 1;
label.y = pos.y + ORYX.CONFIG.OFFSET_EDGE_LABEL_MIDDLE;
label.rotate(360 - angle, pos);
} else {
label.horizontalAlign("right");
label.verticalAlign("bottom");
label.x = pos.x + 1;
label.y = pos.y + ORYX.CONFIG.OFFSET_EDGE_LABEL_MIDDLE;
label.rotate(180 - angle, pos);
}
break;
case "startbottom":
var angle = this._getAngle(this.dockers[0], this.dockers[1]);
var pos = this.dockers.first().bounds.center();
if (angle <= 90 || angle > 270) {
label.horizontalAlign("left");
label.verticalAlign("top");
label.x = pos.x + label.getOffsetBottom();
label.y = pos.y + label.getOffsetBottom();
label.rotate(360 - angle, pos);
} else {
label.horizontalAlign("right");
label.verticalAlign("top");
label.x = pos.x - label.getOffsetBottom();
label.y = pos.y + label.getOffsetBottom();
label.rotate(180 - angle, pos);
}
break;
case "midtop":
var numOfDockers = this.dockers.length;
if(numOfDockers%2 == 0) {
var angle = this._getAngle(this.dockers[numOfDockers/2-1], this.dockers[numOfDockers/2])
var pos1 = this.dockers[numOfDockers/2-1].bounds.center();
var pos2 = this.dockers[numOfDockers/2].bounds.center();
var pos = {x:(pos1.x + pos2.x)/2.0, y:(pos1.y+pos2.y)/2.0};
label.horizontalAlign("center");
label.verticalAlign("bottom");
label.x = pos.x;
label.y = pos.y - label.getOffsetTop();
if (angle <= 90 || angle > 270) {
label.rotate(360 - angle, pos);
} else {
label.rotate(180 - angle, pos);
}
} else {
var index = parseInt(numOfDockers/2);
var angle = this._getAngle(this.dockers[index], this.dockers[index+1])
var pos = this.dockers[index].bounds.center();
if (angle <= 90 || angle > 270) {
label.horizontalAlign("left");
label.verticalAlign("bottom");
label.x = pos.x + label.getOffsetTop();
label.y = pos.y - label.getOffsetTop();
label.rotate(360 - angle, pos);
} else {
label.horizontalAlign("right");
label.verticalAlign("bottom");
label.x = pos.x - label.getOffsetTop();
label.y = pos.y - label.getOffsetTop();
label.rotate(180 - angle, pos);
}
}
break;
case "midbottom":
var numOfDockers = this.dockers.length;
if(numOfDockers%2 == 0) {
var angle = this._getAngle(this.dockers[numOfDockers/2-1], this.dockers[numOfDockers/2])
var pos1 = this.dockers[numOfDockers/2-1].bounds.center();
var pos2 = this.dockers[numOfDockers/2].bounds.center();
var pos = {x:(pos1.x + pos2.x)/2.0, y:(pos1.y+pos2.y)/2.0};
label.horizontalAlign("center");
label.verticalAlign("top");
label.x = pos.x;
label.y = pos.y + label.getOffsetTop();
if (angle <= 90 || angle > 270) {
label.rotate(360 - angle, pos);
} else {
label.rotate(180 - angle, pos);
}
} else {
var index = parseInt(numOfDockers/2);
var angle = this._getAngle(this.dockers[index], this.dockers[index+1])
var pos = this.dockers[index].bounds.center();
if (angle <= 90 || angle > 270) {
label.horizontalAlign("left");
label.verticalAlign("top");
label.x = pos.x + label.getOffsetBottom();
label.y = pos.y + label.getOffsetBottom();
label.rotate(360 - angle, pos);
} else {
label.horizontalAlign("right");
label.verticalAlign("top");
label.x = pos.x - label.getOffsetBottom();
label.y = pos.y + label.getOffsetBottom();
label.rotate(180 - angle, pos);
}
}
break;
case "endtop":
var length = this.dockers.length;
var angle = this._getAngle(this.dockers[length-2], this.dockers[length-1]);
var pos = this.dockers.last().bounds.center();
if (angle <= 90 || angle > 270) {
label.horizontalAlign("right");
label.verticalAlign("bottom");
label.x = pos.x - label.getOffsetTop();
label.y = pos.y - label.getOffsetTop();
label.rotate(360 - angle, pos);
} else {
label.horizontalAlign("left");
label.verticalAlign("bottom");
label.x = pos.x + label.getOffsetTop();
label.y = pos.y - label.getOffsetTop();
label.rotate(180 - angle, pos);
}
break;
case "endbottom":
var length = this.dockers.length;
var angle = this._getAngle(this.dockers[length-2], this.dockers[length-1]);
var pos = this.dockers.last().bounds.center();
if (angle <= 90 || angle > 270) {
label.horizontalAlign("right");
label.verticalAlign("top");
label.x = pos.x - label.getOffsetBottom();
label.y = pos.y + label.getOffsetBottom();
label.rotate(360 - angle, pos);
} else {
label.horizontalAlign("left");
label.verticalAlign("top");
label.x = pos.x + label.getOffsetBottom();
label.y = pos.y + label.getOffsetBottom();
label.rotate(180 - angle, pos);
}
break;
}
}.bind(this));
this.children.each(function(value) {
if(value instanceof ORYX.Core.Node) {
this.calculatePositionOfAttachedChildNode.call(this, value);
}
}.bind(this));
this.refreshAttachedNodes();
this.refresh();
this.isChanged = false;
this._dockerUpdated = false;
this._oldBounds = this.bounds.clone();
}
},
/**
* Moves a point to the upperLeft of a node's bounds.
*
* @param {point} point
* The point to move
* @param {ORYX.Core.Bounds} bounds
* The Bounds of the related noe
*/
movePointToUpperLeftOfNode: function(point, bounds) {
point.x -= bounds.width()/2;
point.y -= bounds.height()/2;
},
/**
* Refreshes the visual representation of edge's attached nodes.
*/
refreshAttachedNodes: function() {
this.attachedNodePositionData.values().each(function(nodeData) {
var startPoint = nodeData.segment.docker1.bounds.center();
var endPoint = nodeData.segment.docker2.bounds.center();
this.relativizePoint(startPoint);
this.relativizePoint(endPoint);
var newNodePosition = new Object();
/* Calculate new x-coordinate */
newNodePosition.x = startPoint.x
+ nodeData.relativDistanceFromDocker1
* (endPoint.x - startPoint.x);
/* Calculate new y-coordinate */
newNodePosition.y = startPoint.y
+ nodeData.relativDistanceFromDocker1
* (endPoint.y - startPoint.y);
/* Convert new position to the upper left of the node */
this.movePointToUpperLeftOfNode(newNodePosition, nodeData.node.bounds);
/* Move node to its new position */
nodeData.node.bounds.moveTo(newNodePosition);
nodeData.node._update();
}.bind(this));
},
/**
* Calculates the position of an edge's child node. The node is placed on
* the path of the edge.
*
* @param {node}
* The node to calculate the new position
* @return {Point}
* The calculated upper left point of the node's shape.
*/
calculatePositionOfAttachedChildNode: function(node) {
/* Initialize position */
var position = new Object();
position.x = 0;
position.y = 0;
/* Case: Node was just added */
if(!this.attachedNodePositionData[node.getId()]) {
this.attachedNodePositionData[node.getId()] = new Object();
this.attachedNodePositionData[node.getId()]
.relativDistanceFromDocker1 = 0;
this.attachedNodePositionData[node.getId()].node = node;
this.attachedNodePositionData[node.getId()].segment = new Object();
this.findEdgeSegmentForNode(node);
}else if(node.isChanged) {
this.findEdgeSegmentForNode(node);
}
},
/**
* Finds the appropriate edge segement for a node.
* The segment is choosen, which has the smallest distance to the node.
*
* @param {ORYX.Core.Node} node
* The concerning node
*/
findEdgeSegmentForNode: function(node) {
var length = this.dockers.length;
var smallestDistance = undefined;
for(i=1;i<length;i++) {
var lineP1 = this.dockers[i-1].bounds.center();
var lineP2 = this.dockers[i].bounds.center();
this.relativizePoint(lineP1);
this.relativizePoint(lineP2);
var nodeCenterPoint = node.bounds.center();
var distance = ORYX.Core.Math.distancePointLinie(
lineP1,
lineP2,
nodeCenterPoint,
true);
if((distance || distance == 0) && ((!smallestDistance && smallestDistance != 0)
|| distance < smallestDistance)) {
smallestDistance = distance;
this.attachedNodePositionData[node.getId()].segment.docker1 =
this.dockers[i-1];
this.attachedNodePositionData[node.getId()].segment.docker2 =
this.dockers[i];
}
/* Either the distance does not match the segment or the distance
* between docker1 and docker2 is 0
*
* In this case choose the nearest docker as attaching point.
*
*/
if(!distance && !smallestDistance && smallestDistance != 0) {
(ORYX.Core.Math.getDistancePointToPoint(nodeCenterPoint, lineP1)
< ORYX.Core.Math.getDistancePointToPoint(nodeCenterPoint, lineP2)) ?
this.attachedNodePositionData[node.getId()].relativDistanceFromDocker1 = 0 :
this.attachedNodePositionData[node.getId()].relativDistanceFromDocker1 = 1;
this.attachedNodePositionData[node.getId()].segment.docker1 =
this.dockers[i-1];
this.attachedNodePositionData[node.getId()].segment.docker2 =
this.dockers[i];
}
}
/* Calculate position on edge segment for the node */
if(smallestDistance || smallestDistance == 0) {
this.attachedNodePositionData[node.getId()].relativDistanceFromDocker1 =
this.getLineParameterForPosition(
this.attachedNodePositionData[node.getId()].segment.docker1,
this.attachedNodePositionData[node.getId()].segment.docker2,
node);
}
},
/**
* Returns the value of the scalar to determine the position of the node on
* line defined by docker1 and docker2.
*
* @param {point} docker1
* The docker that defines the start of the line segment
* @param {point} docker2
* The docker that defines the end of the line segment
* @param {ORYX.Core.Node} node
* The concerning node
*
* @return {float} positionParameter
* The scalar value to determine the position on the line
*/
getLineParameterForPosition: function(docker1, docker2, node) {
var dockerPoint1 = docker1.bounds.center();
var dockerPoint2 = docker2.bounds.center();
this.relativizePoint(dockerPoint1);
this.relativizePoint(dockerPoint2);
var intersectionPoint = ORYX.Core.Math.getPointOfIntersectionPointLine(
dockerPoint1,
dockerPoint2,
node.bounds.center(), true);
if(!intersectionPoint) {
return 0;
}
var relativeDistance =
ORYX.Core.Math.getDistancePointToPoint(intersectionPoint, dockerPoint1) /
ORYX.Core.Math.getDistancePointToPoint(dockerPoint1, dockerPoint2);
return relativeDistance;
},
/**
* Makes point relative to the upper left of the edge's bound.
*
* @param {point} point
* The point to relativize
*/
relativizePoint: function(point) {
point.x -= this.bounds.upperLeft().x;
point.y -= this.bounds.upperLeft().y;
},
refresh: function(){
//call base class refresh method
arguments.callee.$.refresh.apply(this, arguments);
//TODO consider points for marker mids
var lastPoint;
this._paths.each((function(path, index){
var dockers = this._dockersByPath[path.id];
var c = undefined;
var d = undefined;
if (lastPoint) {
d = "M" + lastPoint.x + " " + lastPoint.y;
}
else {
c = dockers[0].bounds.center();
lastPoint = c;
d = "M" + c.x + " " + c.y;
}
for (var i = 1; i < dockers.length; i++) {
// for each docker, draw a line to the center
c = dockers[i].bounds.center();
d = d + "L" + c.x + " " + c.y + " ";
lastPoint = c;
}
path.setAttributeNS(null, "d", d);
this._interactionPaths[index].setAttributeNS(null, "d", d);
}).bind(this));
/* move child shapes of an edge */
if(this.getChildNodes().length > 0) {
var x = this.bounds.upperLeft().x;
var y = this.bounds.upperLeft().y;
this.node.firstChild.childNodes[1].setAttributeNS(null, "transform", "translate(" + x + ", " + y + ")");
}
},
/**
* Calculate the Border Intersection Point between two points
* @param {PointA}
* @param {PointB}
*/
getIntersectionPoint: function(){
var length = Math.floor(this.dockers.length / 2)
return ORYX.Core.Math.midPoint(this.dockers[length - 1].bounds.center(), this.dockers[length].bounds.center())
},
/**
* Calculate if the point is inside the Shape
* @param {PointX}
* @param {PointY}
*/
isPointIncluded: function(pointX, pointY){
var isbetweenAB = this.absoluteBounds().isIncluded(pointX, pointY,
ORYX.CONFIG.OFFSET_EDGE_BOUNDS);
var isPointIncluded = undefined;
if (isbetweenAB && this.dockers.length > 0) {
var i = 0;
var point1, point2;
do {
point1 = this.dockers[i].bounds.center();
point2 = this.dockers[++i].bounds.center();
isPointIncluded = ORYX.Core.Math.isPointInLine(pointX, pointY,
point1.x, point1.y,
point2.x, point2.y,
ORYX.CONFIG.OFFSET_EDGE_BOUNDS);
} while (!isPointIncluded && i < this.dockers.length - 1)
}
return isPointIncluded;
},
/**
* Calculate if the point is over an special offset area
* @param {Point}
*/
isPointOverOffset: function(){
return false
},
/**
* Returns the angle of the line between two dockers
* (0 - 359.99999999)
*/
_getAngle: function(docker1, docker2) {
var p1 = docker1.absoluteCenterXY();
var p2 = docker2.absoluteCenterXY();
if(p1.x == p2.x && p1.y == p2.y)
return 0;
var angle = Math.asin(Math.sqrt(Math.pow(p1.y-p2.y, 2))
/(Math.sqrt(Math.pow(p2.x-p1.x, 2)+Math.pow(p1.y-p2.y, 2))))
*180/Math.PI;
if(p2.x >= p1.x && p2.y <= p1.y)
return angle;
else if(p2.x < p1.x && p2.y <= p1.y)
return 180 - angle;
else if(p2.x < p1.x && p2.y > p1.y)
return 180 + angle;
else
return 360 - angle;
},
alignDockers: function(){
this._update(true);
var firstPoint = this.dockers.first().bounds.center();
var lastPoint = this.dockers.last().bounds.center();
var deltaX = lastPoint.x - firstPoint.x;
var deltaY = lastPoint.y - firstPoint.y;
var numOfDockers = this.dockers.length - 1;
this.dockers.each((function(docker, index){
var part = index / numOfDockers;
docker.bounds.unregisterCallback(this._dockerChangedCallback);
docker.bounds.moveTo(firstPoint.x + part * deltaX, firstPoint.y + part * deltaY);
docker.bounds.registerCallback(this._dockerChangedCallback);
}).bind(this));
this._dockerChanged();
},
add: function(shape){
arguments.callee.$.add.apply(this, arguments);
// If the new shape is a Docker which is not contained
if (shape instanceof ORYX.Core.Controls.Docker && this.dockers.include(shape)){
// Add it to the dockers list ordered by paths
var pathArray = this._dockersByPath.values()[0];
if (pathArray) {
pathArray.splice(this.dockers.indexOf(shape), 0, shape);
}
/* Perform nessary adjustments on the edge's child shapes */
this.handleChildShapesAfterAddDocker(shape);
}
},
/**
* Performs nessary adjustments on the edge's child shapes.
*
* @param {ORYX.Core.Controls.Docker} docker
* The added docker
*/
handleChildShapesAfterAddDocker: function(docker) {
/* Ensure type of Docker */
if(!docker instanceof ORYX.Core.Controls.Docker) {return undefined;}
var index = this.dockers.indexOf(docker);
if(!(0 < index && index < this.dockers.length - 1)) {
/* Exception: Expect added docker between first and last node of the edge */
return undefined;
}
/* Get child nodes concerning the segment of the new docker */
var startDocker = this.dockers[index-1];
var endDocker = this.dockers[index+1];
/* Adjust the position of edge's child nodes */
var segmentElements =
this.getAttachedNodePositionDataForSegment(startDocker, endDocker);
var lengthSegmentPart1 = ORYX.Core.Math.getDistancePointToPoint(
startDocker.bounds.center(),
docker.bounds.center());
var lengthSegmentPart2 = ORYX.Core.Math.getDistancePointToPoint(
endDocker.bounds.center(),
docker.bounds.center());
if(!(lengthSegmentPart1 + lengthSegmentPart2)) {return;}
var relativDockerPosition = lengthSegmentPart1 / (lengthSegmentPart1 + lengthSegmentPart2);
segmentElements.each(function(nodePositionData) {
/* Assign child node to the new segment */
if(nodePositionData.value.relativDistanceFromDocker1 < relativDockerPosition) {
/* Case: before added Docker */
nodePositionData.value.segment.docker2 = docker;
nodePositionData.value.relativDistanceFromDocker1 =
nodePositionData.value.relativDistanceFromDocker1 / relativDockerPosition;
} else {
/* Case: after added Docker */
nodePositionData.value.segment.docker1 = docker;
var newFullDistance = 1 - relativDockerPosition;
var relativPartOfSegment =
nodePositionData.value.relativDistanceFromDocker1
- relativDockerPosition;
nodePositionData.value.relativDistanceFromDocker1 =
relativPartOfSegment / newFullDistance;
}
})
/* Update attached nodes visual representation */
this.refreshAttachedNodes();
},
/**
* Returns elements from {@link attachedNodePositiondata} that match the
* segement defined by startDocker and endDocker.
*
* @param {ORYX.Core.Controls.Docker} startDocker
* The docker defining the begin of the segment.
* @param {ORYX.Core.Controls.Docker} endDocker
* The docker defining the begin of the segment.
*
* @return {Hash} attachedNodePositionData
* Child elements matching the segment
*/
getAttachedNodePositionDataForSegment: function(startDocker, endDocker) {
/* Ensure that the segment is defined correctly */
if(!((startDocker instanceof ORYX.Core.Controls.Docker)
&& (endDocker instanceof ORYX.Core.Controls.Docker))) {
return [];
}
/* Get elements of the segment */
var elementsOfSegment =
this.attachedNodePositionData.findAll(function(nodePositionData) {
return nodePositionData.value.segment.docker1 === startDocker &&
nodePositionData.value.segment.docker2 === endDocker;
});
/* Return a Hash in each case */
if(!elementsOfSegment) {return [];}
return elementsOfSegment;
},
/**
* Removes an edge's child shape
*/
remove: function(shape) {
arguments.callee.$.remove.apply(this, arguments);
if(this.attachedNodePositionData[shape.getId()]) {
delete this.attachedNodePositionData[shape.getId()];
}
/* Adjust child shapes if neccessary */
if(shape instanceof ORYX.Core.Controls.Docker) {
this.handleChildShapesAfterRemoveDocker(shape);
}
},
/**
* Adjusts the child shapes of an edges after a docker was removed.
*
* @param{ORYX.Core.Controls.Docker} docker
* The removed docker.
*/
handleChildShapesAfterRemoveDocker: function(docker) {
/* Ensure docker type */
if(!(docker instanceof ORYX.Core.Controls.Docker)) {return;}
this.attachedNodePositionData.each(function(nodePositionData) {
if(nodePositionData.value.segment.docker1 === docker) {
/* The new start of the segment is the predecessor of docker2. */
var index = this.dockers.indexOf(nodePositionData.value.segment.docker2);
if(index == -1) {return;}
nodePositionData.value.segment.docker1 = this.dockers[index - 1];
}
else if(nodePositionData.value.segment.docker2 === docker) {
/* The new end of the segment is the successor of docker1. */
var index = this.dockers.indexOf(nodePositionData.value.segment.docker1);
if(index == -1) {return;}
nodePositionData.value.segment.docker2 = this.dockers[index + 1];
}
}.bind(this));
/* Update attached nodes visual representation */
this.refreshAttachedNodes();
},
/**
*@deprecated Use the .createDocker() Method and set the point via the bounds
*/
addDocker: function(position, exDocker, id){
var lastDocker;
var result;
this._dockersByPath.any((function(pair){
return pair.value.any((function(docker, index){
if (!lastDocker) {
lastDocker = docker;
return false;
}
else {
var point1 = lastDocker.bounds.center();
var point2 = docker.bounds.center();
if (ORYX.Core.Math.isPointInLine(position.x, position.y, point1.x, point1.y, point2.x, point2.y, 10)) {
var path = this._paths.find(function(path){
return path.id === pair.key;
});
if (path) {
var allowAttr = path.getAttributeNS(NAMESPACE_ORYX, 'allowDockers');
if (allowAttr && allowAttr.toLowerCase() === "no") {
return true;
}
}
var newDocker = (exDocker) ? exDocker : this.createDocker(this.dockers.indexOf(lastDocker) + 1, position, id);
newDocker.bounds.centerMoveTo(position);
if(exDocker)
this.add(newDocker, this.dockers.indexOf(lastDocker) + 1);
// Remove new Docker from 'to add' dockers
//pair.value = pair.value.without(newDocker);
//pair.value.splice(this.dockers.indexOf(lastDocker) + 1, 0, newDocker);
// Remove the Docker from the Docker list and add the Docker to the new position
//this.dockers = this.dockers.without(newDocker);
//this.dockers.splice(this.dockers.indexOf(lastDocker) + 1, 0, newDocker);
//this._update(true);
result = newDocker;
return true;
}
else {
lastDocker = docker;
return false;
}
}
}).bind(this));
}).bind(this));
return result;
},
removeDocker: function(docker){
if (this.dockers.length > 2 && !(this.dockers.first() === docker)) {
this._dockersByPath.any((function(pair){
if (pair.value.member(docker)) {
if (docker === pair.value.last()) {
return true;
}
else {
this.remove(docker);
this._dockersByPath[pair.key] = pair.value.without(docker);
this.isChanged = true;
this._dockerChanged();
return true;
}
}
return false;
}).bind(this));
}
},
/**
* Removes all dockers from the edge which are on
* the line between two dockers
* @return {Object} Removed dockers in an indicied array
* (key is the removed position of the docker, value is docker themselve)
*/
removeUnusedDockers:function(){
var marked = $H({});
this.dockers.each(function(docker, i){
if (i==0||i==this.dockers.length-1){ return }
var previous = this.dockers[i-1];
/* Do not consider already removed dockers */
if(marked.values().indexOf(previous) != -1 && this.dockers[i-2]) {
previous = this.dockers[i-2];
}
var next = this.dockers[i+1];
var cp = previous.getDockedShape() && previous.referencePoint ? previous.getAbsoluteReferencePoint() : previous.bounds.center();
var cn = next.getDockedShape() && next.referencePoint ? next.getAbsoluteReferencePoint() : next.bounds.center();
var cd = docker.bounds.center();
if (ORYX.Core.Math.isPointInLine(cd.x, cd.y, cp.x, cp.y, cn.x, cn.y, 1)){
marked[i] = docker;
}
}.bind(this))
marked.each(function(docker){
this.removeDocker(docker.value);
}.bind(this))
if (marked.values().length > 0){
this._update(true);
}
return marked;
},
/**
* Initializes the Edge after loading the SVG representation of the edge.
* @param {SVGDocument} svgDocument
*/
_init: function(svgDocument){
arguments.callee.$._init.apply(this, arguments);
var minPointX, minPointY, maxPointX, maxPointY;
//init markers
var defs = svgDocument.getElementsByTagNameNS(NAMESPACE_SVG, "defs");
if (defs.length > 0) {
defs = defs[0];
var markerElements = $A(defs.getElementsByTagNameNS(NAMESPACE_SVG, "marker"));
var marker;
var me = this;
markerElements.each(function(markerElement){
try {
marker = new ORYX.Core.SVG.SVGMarker(markerElement.cloneNode(true));
me._markers[marker.id] = marker;
var textElements = $A(marker.element.getElementsByTagNameNS(NAMESPACE_SVG, "text"));
var label;
textElements.each(function(textElement){
label = new ORYX.Core.SVG.Label({
textElement: textElement,
shapeId: this.id,
eventHandler: this._delegateEvent.bind(this),
editable: true
});
me._labels[label.id] = label;
});
}
catch (e) {
}
});
}
var gs = svgDocument.getElementsByTagNameNS(NAMESPACE_SVG, "g");
if (gs.length <= 0) {
throw "Edge: No g element found.";
}
var g = gs[0];
g.setAttributeNS(null, "id", null);
var isFirst = true;
$A(g.childNodes).each((function(path, index){
if (ORYX.Editor.checkClassType(path, SVGPathElement)) {
path = path.cloneNode(false);
var pathId = this.id + "_" + index;
path.setAttributeNS(null, "id", pathId);
this._paths.push(path);
//check, if markers are set and update the id
var markersByThisPath = [];
var markerUrl = path.getAttributeNS(null, "marker-start");
if (markerUrl && markerUrl !== "") {
markerUrl = markerUrl.strip();
markerUrl = markerUrl.replace(/^url\(#/, '');
var markerStartId = this.id.concat(markerUrl.replace(/\)$/, ''));
path.setAttributeNS(null, "marker-start", "url(#" + markerStartId + ")");
markersByThisPath.push(this._markers[markerStartId]);
}
markerUrl = path.getAttributeNS(null, "marker-mid");
if (markerUrl && markerUrl !== "") {
markerUrl = markerUrl.strip();
markerUrl = markerUrl.replace(/^url\(#/, '');
var markerMidId = this.id.concat(markerUrl.replace(/\)$/, ''));
path.setAttributeNS(null, "marker-mid", "url(#" + markerMidId + ")");
markersByThisPath.push(this._markers[markerMidId]);
}
markerUrl = path.getAttributeNS(null, "marker-end");
if (markerUrl && markerUrl !== "") {
markerUrl = markerUrl.strip();
markerUrl = markerUrl.replace(/^url\(#/, '');
var markerEndId = this.id.concat(markerUrl.replace(/\)$/, ''));
path.setAttributeNS(null, "marker-end", "url(#" + markerEndId + ")");
markersByThisPath.push(this._markers[markerEndId]);
}
this._markersByPath[pathId] = markersByThisPath;
//init dockers
var parser = new PathParser();
var handler = new ORYX.Core.SVG.PointsPathHandler();
parser.setHandler(handler);
parser.parsePath(path);
if (handler.points.length < 4) {
throw "Edge: Path has to have two or more points specified.";
}
this._dockersByPath[pathId] = [];
for (var i = 0; i < handler.points.length; i += 2) {
//handler.points.each((function(point, pIndex){
var x = handler.points[i];
var y = handler.points[i+1];
if (isFirst || i > 0) {
var docker = new ORYX.Core.Controls.Docker({
eventHandlerCallback: this.eventHandlerCallback, "id": this.resourceId + "_" + i
});
docker.bounds.centerMoveTo(x,y);
docker.bounds.registerCallback(this._dockerChangedCallback);
this.add(docker, this.dockers.length);
//this._dockersByPath[pathId].push(docker);
//calculate minPoint and maxPoint
if (minPointX) {
minPointX = Math.min(x, minPointX);
minPointY = Math.min(y, minPointY);
}
else {
minPointX = x;
minPointY = y;
}
if (maxPointX) {
maxPointX = Math.max(x, maxPointX);
maxPointY = Math.max(y, maxPointY);
}
else {
maxPointX = x;
maxPointY = y;
}
}
//}).bind(this));
}
isFirst = false;
}
}).bind(this));
this.bounds.set(minPointX, minPointY, maxPointX, maxPointY);
if (this.bounds.width() === 0 || this.bounds.height() === 0) {
this.bounds.extend({
x: this.bounds.width() === 0 ? 2 : 0,
y: this.bounds.height() === 0 ? 2 : 0
});
this.bounds.moveBy({
x: this.bounds.width() === 0 ? -1 : 0,
y: this.bounds.height() === 0 ? -1 : 0
});
}
this._oldBounds = this.bounds.clone();
//add paths to this.node
this._paths.reverse();
var paths = [];
this._paths.each((function(path){
paths.push(this.node.childNodes[0].childNodes[0].childNodes[0].appendChild(path));
}).bind(this));
this._paths = paths;
//init interaction path
this._paths.each((function(path){
var iPath = path.cloneNode(false);
iPath.setAttributeNS(null, "id", undefined);
iPath.setAttributeNS(null, "stroke-width", 10);
iPath.setAttributeNS(null, "visibility", "hidden");
iPath.setAttributeNS(null, "stroke-dasharray", null);
iPath.setAttributeNS(null, "stroke", "black");
iPath.setAttributeNS(null, "fill", "none");
this._interactionPaths.push(this.node.childNodes[0].childNodes[0].childNodes[0].appendChild(iPath));
}).bind(this));
this._paths.reverse();
this._interactionPaths.reverse();
/**initialize labels*/
var textElems = svgDocument.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'text');
$A(textElems).each((function(textElem){
var label = new ORYX.Core.SVG.Label({
textElement: textElem,
shapeId: this.id,
eventHandler: this._delegateEvent.bind(this),
editable: true
});
this.node.childNodes[0].childNodes[0].appendChild(label.node);
this._labels[label.id] = label;
}).bind(this));
//set title
this.node.childNodes[0].childNodes[0].setAttributeNS(null, "title", this.getStencil().title());
this.propertiesChanged.each(function(pair){
pair.value = true;
});
//this._update(true);
},
/**
* Adds all necessary markers of this Edge to the SVG document.
* Has to be called, while this.node is part of DOM.
*/
addMarkers: function(defs){
this._markers.each(function(marker){
if (!defs.ownerDocument.getElementById(marker.value.id)) {
marker.value.element = defs.appendChild(marker.value.element);
}
});
},
/**
* Removes all necessary markers of this Edge from the SVG document.
* Has to be called, while this.node is part of DOM.
*/
removeMarkers: function(){
var svgElement = this.node.ownerSVGElement;
if (svgElement) {
var defs = svgElement.getElementsByTagNameNS(NAMESPACE_SVG, "defs");
if (defs.length > 0) {
defs = defs[0];
this._markers.each(function(marker){
var foundMarker = defs.ownerDocument.getElementById(marker.value.id);
if (foundMarker) {
marker.value.element = defs.removeChild(marker.value.element);
}
});
}
}
},
/**
* Calls when a docker has changed
*/
_dockerChanged: function(){
//this._update(true);
this._dockerUpdated = true;
},
serialize: function(){
var result = arguments.callee.$.serialize.apply(this);
//add dockers triple
var value = "";
this._dockersByPath.each((function(pair){
pair.value.each(function(docker){
var position = docker.getDockedShape() && docker.referencePoint ? docker.referencePoint : docker.bounds.center();
value = value.concat(position.x + " " + position.y + " ");
});
value += " # ";
}).bind(this));
result.push({
name: 'dockers',
prefix: 'oryx',
value: value,
type: 'literal'
});
//add parent triple dependant on the dockedShapes
//TODO change this when canvas becomes a resource
/* var source = this.dockers.first().getDockedShape();
var target = this.dockers.last().getDockedShape();
var sharedParent;
if (source && target) {
//get shared parent
while (source.parent) {
source = source.parent;
if (source instanceof ORYX.Core.Canvas) {
sharedParent = source;
break;
}
else {
var targetParent = target.parent;
var found;
while (targetParent) {
if (source === targetParent) {
sharedParent = source;
found = true;
break;
}
else {
targetParent = targetParent.parent;
}
}
if (found) {
break;
}
}
}
}
else
if (source) {
sharedParent = source.parent;
}
else
if (target) {
sharedParent = target.parent;
}
*/
//if (sharedParent) {
/* result.push({
name: 'parent',
prefix: 'raziel',
//value: '#' + ERDF.__stripHashes(sharedParent.resourceId),
value: '#' + ERDF.__stripHashes(this.getCanvas().resourceId),
type: 'resource'
});*/
//}
//serialize target and source
var lastDocker = this.dockers.last();
var target = lastDocker.getDockedShape();
if(target) {
result.push({
name: 'target',
prefix: 'raziel',
value: '#' + ERDF.__stripHashes(target.resourceId),
type: 'resource'
});
}
try {
//result = this.getStencil().serialize(this, result);
var serializeEvent = this.getStencil().serialize();
/*
* call serialize callback by reference, result should be found
* in serializeEvent.result
*/
if(serializeEvent.type) {
serializeEvent.shape = this;
serializeEvent.data = result;
serializeEvent.result = undefined;
serializeEvent.forceExecution = true;
this._delegateEvent(serializeEvent);
if(serializeEvent.result) {
result = serializeEvent.result;
}
}
}
catch (e) {
}
return result;
},
deserialize: function(data){
try {
//data = this.getStencil().deserialize(this, data);
var deserializeEvent = this.getStencil().deserialize();
/*
* call serialize callback by reference, result should be found
* in serializeEventInfo.result
*/
if(deserializeEvent.type) {
deserializeEvent.shape = this;
deserializeEvent.data = data;
deserializeEvent.result = undefined;
deserializeEvent.forceExecution = true;
this._delegateEvent(deserializeEvent);
if(deserializeEvent.result) {
data = deserializeEvent.result;
}
}
}
catch (e) {
}
// Set the outgoing shapes
var target = data.find(function(ser) {return (ser.prefix+"-"+ser.name) == 'raziel-target'});
var targetShape;
if(target) {
targetShape = this.getCanvas().getChildShapeByResourceId(target.value);
}
var outgoing = data.findAll(function(ser){ return (ser.prefix+"-"+ser.name) == 'raziel-outgoing'});
outgoing.each((function(obj){
// TODO: Look at Canvas
if(!this.parent) {return};
// Set outgoing Shape
var next = this.getCanvas().getChildShapeByResourceId(obj.value);
if(next){
if(next == targetShape) {
// If this is an edge, set the last docker to the next shape
this.dockers.last().setDockedShape(next);
this.dockers.last().setReferencePoint({x: next.bounds.width() / 2.0, y: next.bounds.height() / 2.0});
} else if(next instanceof ORYX.Core.Edge) {
//Set the first docker of the next shape
next.dockers.first().setDockedShape(this);
//next.dockers.first().setReferencePoint({x: this.bounds.width() / 2.0, y: this.bounds.height() / 2.0});
} /*else if(next.dockers.length > 0) { //next is a node and next has a docker
next.dockers.first().setDockedShape(this);
next.dockers.first().setReferencePoint({x: this.bounds.width() / 2.0, y: this.bounds.height() / 2.0});
}*/
}
}).bind(this));
arguments.callee.$.deserialize.apply(this, [data]);
var oryxDockers = data.find(function(obj){
return (obj.prefix === "oryx" &&
obj.name === "dockers");
});
if (oryxDockers) {
var dataByPath = oryxDockers.value.split("#").without("").without(" ");
dataByPath.each((function(data, index){
var values = data.replace(/,/g, " ").split(" ").without("");
//for each docker two values must be defined
if (values.length % 2 === 0) {
var path = this._paths[index];
if (path) {
if (index === 0) {
while (this._dockersByPath[path.id].length > 2) {
this.removeDocker(this._dockersByPath[path.id][1]);
}
}
else {
while (this._dockersByPath[path.id].length > 1) {
this.removeDocker(this._dockersByPath[path.id][0]);
}
}
var dockersByPath = this._dockersByPath[path.id];
if (index === 0) {
//set position of first docker
var x = parseFloat(values.shift());
var y = parseFloat(values.shift());
if (dockersByPath.first().getDockedShape()) {
dockersByPath.first().setReferencePoint({
x: x,
y: y
});
}
else {
dockersByPath.first().bounds.centerMoveTo(x, y);
}
}
//set position of last docker
y = parseFloat(values.pop());
x = parseFloat(values.pop());
if (dockersByPath.last().getDockedShape()) {
dockersByPath.last().setReferencePoint({
x: x,
y: y
});
}
else {
dockersByPath.last().bounds.centerMoveTo(x, y);
}
//add additional dockers
for (var i = 0; i < values.length; i++) {
x = parseFloat(values[i]);
y = parseFloat(values[++i]);
var newDocker = this.createDocker();
newDocker.bounds.centerMoveTo(x, y);
//this.dockers = this.dockers.without(newDocker);
//this.dockers.splice(this.dockers.indexOf(dockersByPath.last()), 0, newDocker);
//dockersByPath.splice(this.dockers.indexOf(dockersByPath.last()), 0, newDocker);
}
}
}
}).bind(this));
}
else {
this.alignDockers();
}
this._changed();
},
toString: function(){
return this.getStencil().title() + " " + this.id;
},
/**
* @return {ORYX.Core.Shape} Returns last docked shape or null.
*/
getTarget: function(){
return this.dockers.last() ? this.dockers.last().getDockedShape() : null;
},
/**
* @return {ORYX.Core.Shape} Returns the first docked shape or null
*/
getSource: function() {
return this.dockers.first() ? this.dockers.first().getDockedShape() : null;
},
/**
* Checks whether the edge is at least docked to one shape.
*
* @return {boolean} True if edge is docked
*/
isDocked: function() {
var isDocked = false;
this.dockers.each(function(docker) {
if(docker.isDocked()) {
isDocked = true;
throw $break;
}
});
return isDocked;
},
/**
* Calls {@link ORYX.Core.AbstractShape#toJSON} and add a some stencil set information.
*/
toJSON: function() {
var json = arguments.callee.$.toJSON.apply(this, arguments);
if(this.getTarget()) {
json.target = {
resourceId: this.getTarget().resourceId
};
}
return json;
}
};
ORYX.Core.Edge = ORYX.Core.Shape.extend(ORYX.Core.Edge);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
/**
* @classDescription Abstract base class for all objects that have a graphical representation
* within the editor.
* @extends Clazz
*/
ORYX.Core.UIObject = {
/**
* Constructor of the UIObject class.
*/
construct: function(options) {
this.isChanged = true; //Flag, if UIObject has been changed since last update.
this.isResized = true;
this.isVisible = true; //Flag, if UIObject's display attribute is set to 'inherit' or 'none'
this.isSelectable = false; //Flag, if UIObject is selectable.
this.isResizable = false; //Flag, if UIObject is resizable.
this.isMovable = false; //Flag, if UIObject is movable.
if (!options || typeof options["id"] === "undefined") {
this.id = ORYX.Editor.provideId(); //get unique id
} else {
this.id = options["id"];
}
this.parent = undefined; //parent is defined, if this object is added to another uiObject.
this.node = undefined; //this is a reference to the SVG representation, either locally or in DOM.
this.children = []; //array for all add uiObjects
this.bounds = new ORYX.Core.Bounds(); //bounds with undefined values
this._changedCallback = this._changed.bind(this); //callback reference for calling _changed
this.bounds.registerCallback(this._changedCallback); //set callback in bounds
if(options && options.eventHandlerCallback) {
this.eventHandlerCallback = options.eventHandlerCallback;
}
},
onOryxShown: function onOryxShown() {
var elements = this.node.getElementsByTagName('text');
elements.each(function (e) {
var e = Element.extend(e);
e.update(e.innerHTML + " ");
});
},
/**
* Sets isChanged flag to true. Callback for the bounds object.
*/
_changed: function(bounds, isResized) {
this.isChanged = true;
if(this.bounds == bounds)
this.isResized = isResized || this.isResized;
},
/**
* If something changed, this method calls the refresh method that must be implemented by subclasses.
*/
update: function() {
if(this.isChanged) {
this.refresh();
this.isChanged = false;
//call update of all children
this.children.each(function(value) {
value.update();
});
}
},
/**
* Is called in update method, if isChanged is set to true. Sub classes should call the super class method.
*/
refresh: function() {
},
/**
* @return {Array} Array of all child UIObjects.
*/
getChildren: function() {
return this.children.clone();
},
/**
* @return {Array} Array of all parent UIObjects.
*/
getParents: function(){
var parents = [];
var parent = this.parent;
while(parent){
parents.push(parent);
parent = parent.parent;
}
return parents;
},
/**
* Returns TRUE if the given parent is one of the UIObjects parents or the UIObject themselves, otherwise FALSE.
* @param {UIObject} parent
* @return {Boolean}
*/
isParent: function(parent){
var cparent = this;
while(cparent){
if (cparent === parent){
return true;
}
cparent = cparent.parent;
}
return false;
},
/**
* @return {String} Id of this UIObject
*/
getId: function() {
return this.id;
},
/**
* Method for accessing child uiObjects by id.
* @param {String} id
* @param {Boolean} deep
*
* @return {UIObject} If found, it returns the UIObject with id.
*/
getChildById: function(id, deep) {
return this.children.find(function(uiObj) {
if(uiObj.getId() === id) {
return uiObj;
} else {
if(deep) {
var obj = uiObj.getChildById(id, deep);
if(obj) {
return obj;
}
}
}
});
},
/**
* Adds an UIObject to this UIObject and sets the parent of the
* added UIObject. It is also added to the SVG representation of this
* UIObject.
* @param {UIObject} uiObject
*/
add: function(uiObject) {
//add uiObject, if it is not already a child of this object
if (!(this.children.member(uiObject))) {
//if uiObject is child of another parent, remove it from that parent.
if(uiObject.parent) {
uiObject.remove(uiObject);
}
//add uiObject to children
this.children.push(uiObject);
//set parent reference
uiObject.parent = this;
//add uiObject.node to this.node
uiObject.node = this.node.appendChild(uiObject.node);
//register callback to get informed, if child is changed
uiObject.bounds.registerCallback(this._changedCallback);
if(this.eventHandlerCallback)
this.eventHandlerCallback({type:ORYX.CONFIG.EVENT_SHAPEADDED,shape:uiObject})
//uiObject.update();
} else {
ORYX.Log.info("add: ORYX.Core.UIObject is already a child of this object.");
}
},
/**
* Removes UIObject from this UIObject. The SVG representation will also
* be removed from this UIObject's SVG representation.
* @param {UIObject} uiObject
*/
remove: function(uiObject) {
//if uiObject is a child of this object, remove it.
if (this.children.member(uiObject)) {
//remove uiObject from children
this.children = this._uiObjects.without(uiObject);
//delete parent reference of uiObject
uiObject.parent = undefined;
//delete uiObject.node from this.node
uiObject.node = this.node.removeChild(uiObject.node);
//unregister callback to get informed, if child is changed
uiObject.bounds.unregisterCallback(this._changedCallback);
} else {
ORYX.Log.info("remove: ORYX.Core.UIObject is not a child of this object.");
}
},
/**
* Calculates absolute bounds of this UIObject.
*/
absoluteBounds: function() {
if(this.parent) {
var absUL = this.absoluteXY();
return new ORYX.Core.Bounds(absUL.x, absUL.y,
absUL.x + this.bounds.width(),
absUL.y + this.bounds.height());
} else {
return this.bounds.clone();
}
},
/**
* @return {Point} The absolute position of this UIObject.
*/
absoluteXY: function() {
if(this.parent) {
var pXY = this.parent.absoluteXY();
return {x: pXY.x + this.bounds.upperLeft().x , y: pXY.y + this.bounds.upperLeft().y};
} else {
return {x: this.bounds.upperLeft().x , y: this.bounds.upperLeft().y};
}
},
/**
* @return {Point} The absolute position from the Center of this UIObject.
*/
absoluteCenterXY: function() {
if(this.parent) {
var pXY = this.parent.absoluteXY();
return {x: pXY.x + this.bounds.center().x , y: pXY.y + this.bounds.center().y};
} else {
return {x: this.bounds.center().x , y: this.bounds.center().y};
}
},
/**
* Hides this UIObject and all its children.
*/
hide: function() {
this.node.setAttributeNS(null, 'display', 'none');
this.isVisible = false;
this.children.each(function(uiObj) {
uiObj.hide();
});
},
/**
* Enables visibility of this UIObject and all its children.
*/
show: function() {
this.node.setAttributeNS(null, 'display', 'inherit');
this.isVisible = true;
this.children.each(function(uiObj) {
uiObj.show();
});
},
addEventHandlers: function(node) {
node.addEventListener(ORYX.CONFIG.EVENT_MOUSEDOWN, this._delegateEvent.bind(this), false);
node.addEventListener(ORYX.CONFIG.EVENT_MOUSEMOVE, this._delegateEvent.bind(this), false);
node.addEventListener(ORYX.CONFIG.EVENT_MOUSEUP, this._delegateEvent.bind(this), false);
node.addEventListener(ORYX.CONFIG.EVENT_MOUSEOVER, this._delegateEvent.bind(this), false);
node.addEventListener(ORYX.CONFIG.EVENT_MOUSEOUT, this._delegateEvent.bind(this), false);
node.addEventListener(ORYX.CONFIG.EVENT_CLICK, this._delegateEvent.bind(this), false);
node.addEventListener(ORYX.CONFIG.EVENT_DBLCLICK, this._delegateEvent.bind(this), false);
},
_delegateEvent: function(event) {
if(this.eventHandlerCallback) {
this.eventHandlerCallback(event, this);
}
},
toString: function() { return "UIObject " + this.id }
};
ORYX.Core.UIObject = Clazz.extend(ORYX.Core.UIObject);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if(!ORYX){ var ORYX = {} }
if(!ORYX.Plugins){ ORYX.Plugins = {} }
/**
This abstract plugin class can be used to build plugins on.
It provides some more basic functionality like registering events (on*-handlers)...
@example
ORYX.Plugins.MyPlugin = ORYX.Plugins.AbstractPlugin.extend({
construct: function() {
// Call super class constructor
arguments.callee.$.construct.apply(this, arguments);
[...]
},
[...]
});
@class ORYX.Plugins.AbstractPlugin
@constructor Creates a new instance
@author Willi Tscheschner
*/
ORYX.Plugins.AbstractPlugin = Clazz.extend({
/**
* The facade which offer editor-specific functionality
* @type Facade
* @memberOf ORYX.Plugins.AbstractPlugin.prototype
*/
facade: null,
construct: function( facade ){
this.facade = facade;
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_LOADED, this.onLoaded.bind(this));
},
/**
Overwrite to handle load event. TODO: Document params!!!
@methodOf ORYX.Plugins.AbstractPlugin.prototype
*/
onLoaded: function(){},
/**
Overwrite to handle selection changed event. TODO: Document params!!!
@methodOf ORYX.Plugins.AbstractPlugin.prototype
*/
onSelectionChanged: function(){},
/**
Show overlay on given shape.
@methodOf ORYX.Plugins.AbstractPlugin.prototype
@example
showOverlay(
myShape,
{ stroke: "green" },
ORYX.Editor.graft("http://www.w3.org/2000/svg", null, ['path', {
"title": "Click the element to execute it!",
"stroke-width": 2.0,
"stroke": "black",
"d": "M0,-5 L5,0 L0,5 Z",
"line-captions": "round"
}])
)
@param {Oryx.XXX.Shape[]} shapes One shape or array of shapes the overlay should be put on
@param {Oryx.XXX.Attributes} attributes some attributes...
@param {Oryx.svg.node} svgNode The svg node which should be used as overlay
@param {String} [svgNode="NW"] The svg node position where the overlay should be placed
@param {Boolean} svgNodePositionAbsolute True if position of the overlay is absolute
@param {Boolean} keepInsideVisibleArea True if the overlay should be re-positioned to be kept inside of the currently visible area of the canvas
*/
showOverlay: function(shapes, attributes, svgNode, svgNodePosition, svgNodePositionAbsolute, keepInsideVisibleArea) {
if( !(shapes instanceof Array) ){
shapes = [shapes]
}
// Define Shapes
shapes = shapes.map(function(shape){
var el = shape;
if( typeof shape == "string" ){
el = this.facade.getCanvas().getChildShapeByResourceId( shape );
el = el || this.facade.getCanvas().getChildById( shape, true );
}
return el;
}.bind(this)).compact();
// Define unified id
if( !this.overlayID ){
this.overlayID = this.type + ORYX.Editor.provideId();
}
this.facade.raiseEvent({
type : ORYX.CONFIG.EVENT_OVERLAY_SHOW,
id : this.overlayID,
shapes : shapes,
attributes : attributes,
node : svgNode,
nodePosition: svgNodePosition || "NW",
nodePositionAbsolute: svgNodePositionAbsolute,
keepInsideVisibleArea: keepInsideVisibleArea
});
},
/**
Hide current overlay.
@methodOf ORYX.Plugins.AbstractPlugin.prototype
*/
hideOverlay: function(){
this.facade.raiseEvent({
type : ORYX.CONFIG.EVENT_OVERLAY_HIDE,
id : this.overlayID
});
},
/**
Does a transformation with the given xslt stylesheet.
@methodOf ORYX.Plugins.AbstractPlugin.prototype
@param {String} data The data (e.g. eRDF) which should be transformed
@param {String} stylesheet URL of a stylesheet which should be used for transforming data.
*/
doTransform: function( data, stylesheet ) {
if( !stylesheet || !data ){
return ""
}
var parser = new DOMParser();
var parsedData = parser.parseFromString(data, "text/xml");
source=stylesheet;
new Ajax.Request(source, {
asynchronous: false,
method: 'get',
onSuccess: function(transport){
xsl = transport.responseText
}.bind(this),
onFailure: (function(transport){
ORYX.Log.error("XSL load failed" + transport);
}).bind(this)
});
var xsltProcessor = new XSLTProcessor();
var domParser = new DOMParser();
var xslObject = domParser.parseFromString(xsl, "text/xml");
xsltProcessor.importStylesheet(xslObject);
try {
var newData = xsltProcessor.transformToFragment(parsedData, document);
var serializedData = (new XMLSerializer()).serializeToString(newData);
/* Firefox 2 to 3 problem?! */
serializedData = !serializedData.startsWith("<?xml") ? "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + serializedData : serializedData;
return serializedData;
}catch (error) {
return -1;
}
},
/**
* Opens a new window that shows the given XML content.
* @methodOf ORYX.Plugins.AbstractPlugin.prototype
* @param {Object} content The XML content to be shown.
* @example
* openDownloadWindow( "my.xml", "<exampleXML />" );
*/
openXMLWindow: function(content) {
var win = window.open(
'data:application/xml,' + encodeURIComponent(
content
),
'_blank', "resizable=yes,width=600,height=600,toolbar=0,scrollbars=yes"
);
},
/**
* Opens a download window for downloading the given content.
* @methodOf ORYX.Plugins.AbstractPlugin.prototype
* @param {String} filename The content's file name
* @param {String} content The content to download
*/
openDownloadWindow: function(filename, content) {
var win = window.open("");
if (win != null) {
win.document.open();
win.document.write("<html><body>");
var submitForm = win.document.createElement("form");
win.document.body.appendChild(submitForm);
var createHiddenElement = function(name, value) {
var newElement = document.createElement("input");
newElement.name=name;
newElement.type="hidden";
newElement.value = value;
return newElement
}
submitForm.appendChild( createHiddenElement("download", content) );
submitForm.appendChild( createHiddenElement("file", filename) );
submitForm.method = "POST";
win.document.write("</body></html>");
win.document.close();
submitForm.action= ORYX.PATH + "/download";
submitForm.submit();
}
},
/**
* Serializes DOM.
* @methodOf ORYX.Plugins.AbstractPlugin.prototype
* @type {String} Serialized DOM
*/
getSerializedDOM: function(){
// Force to set all resource IDs
var serializedDOM = DataManager.serializeDOM( this.facade );
//add namespaces
serializedDOM = '<?xml version="1.0" encoding="utf-8"?>' +
'<html xmlns="http://www.w3.org/1999/xhtml" ' +
'xmlns:b3mn="http://b3mn.org/2007/b3mn" ' +
'xmlns:ext="http://b3mn.org/2007/ext" ' +
'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ' +
'xmlns:atom="http://b3mn.org/2007/atom+xhtml">' +
'<head profile="http://purl.org/NET/erdf/profile">' +
'<link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />' +
'<link rel="schema.dcTerms" href="http://purl.org/dc/terms/ " />' +
'<link rel="schema.b3mn" href="http://b3mn.org" />' +
'<link rel="schema.oryx" href="http://oryx-editor.org/" />' +
'<link rel="schema.raziel" href="http://raziel.org/" />' +
'<base href="' +
location.href.split("?")[0] +
'" />' +
'</head><body>' +
serializedDOM +
'</body></html>';
return serializedDOM;
},
/**
* Sets the editor in read only mode: Edges/ dockers cannot be moved anymore,
* shapes cannot be selected anymore.
* @methodOf ORYX.Plugins.AbstractPlugin.prototype
*/
enableReadOnlyMode: function(){
//Edges cannot be moved anymore
this.facade.disableEvent(ORYX.CONFIG.EVENT_MOUSEDOWN);
this.facade.setSelection([], undefined, undefined, true);
// Stop the user from editing the diagram while the plugin is active
this._stopSelectionChange = function() {
if(this.facade.getSelection().length > 0) {
this.facade.setSelection([], undefined, undefined, true);
}
}.bind(this);
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, this._stopSelectionChange);
this.readOnlyMode = true;
},
/**
* Disables read only mode, see @see
* @methodOf ORYX.Plugins.AbstractPlugin.prototype
* @see ORYX.Plugins.AbstractPlugin.prototype.enableReadOnlyMode
*/
disableReadOnlyMode: function(){
// Edges can be moved now again
this.facade.enableEvent(ORYX.CONFIG.EVENT_MOUSEDOWN);
if (this._stopSelectionChange) {
this.facade.unregisterOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, this._stopSelectionChange);
this._stopSelectionChange = undefined;
}
this.readOnlyMode = false;
},
isReadOnlyMode: function isReadOnlyMode() {
return (typeof this.readOnlyMode == 'undefined') ? false : this.readOnlyMode;
},
/**
* Extracts RDF from DOM.
* @methodOf ORYX.Plugins.AbstractPlugin.prototype
* @type {String} Extracted RFD. Null if there are transformation errors.
*/
getRDFFromDOM: function(){
//convert to RDF
try {
var xsl = "";
source=ORYX.PATH + "lib/extract-rdf.xsl";
new Ajax.Request(source, {
asynchronous: false,
method: 'get',
onSuccess: function(transport){
xsl = transport.responseText
}.bind(this),
onFailure: (function(transport){
ORYX.Log.error("XSL load failed" + transport);
}).bind(this)
});
/*
var parser = new DOMParser();
var parsedDOM = parser.parseFromString(this.getSerializedDOM(), "text/xml");
var xsltPath = ORYX.PATH + "lib/extract-rdf.xsl";
var xsltProcessor = new XSLTProcessor();
var xslRef = document.implementation.createDocument("", "", null);
xslRef.async = false;
xslRef.load(xsltPath);
xsltProcessor.importStylesheet(xslRef);
try {
var rdf = xsltProcessor.transformToDocument(parsedDOM);
return (new XMLSerializer()).serializeToString(rdf);
} catch (error) {
Ext.Msg.alert("Oryx", error);
return null;
}*/
var domParser = new DOMParser();
var xmlObject = domParser.parseFromString(this.getSerializedDOM(), "text/xml");
var xslObject = domParser.parseFromString(xsl, "text/xml");
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xslObject);
var result = xsltProcessor.transformToFragment(xmlObject, document);
var serializer = new XMLSerializer();
return serializer.serializeToString(result);
}catch(e){
Ext.Msg.alert("Oryx", error);
return "";
}
},
/**
* Checks if a certain stencil set is loaded right now.
*
*/
isStencilSetExtensionLoaded: function(stencilSetExtensionNamespace) {
return this.facade.getStencilSets().values().any(
function(ss){
return ss.extensions().keys().any(
function(extensionKey) {
return extensionKey == stencilSetExtensionNamespace;
}.bind(this)
);
}.bind(this)
);
},
/**
* Raises an event so that registered layouters does
* have the posiblility to layout the given shapes
* For further reading, have a look into the AbstractLayouter
* class
* @param {Object} shapes
*/
doLayout: function(shapes){
// Raises a do layout event
this.facade.raiseEvent({
type : ORYX.CONFIG.EVENT_LAYOUT,
shapes : shapes
});
},
/**
* Does a primitive layouting with the incoming/outgoing
* edges (set the dockers to the right position) and if
* necessary, it will be called the real layouting
* @param {ORYX.Core.Node} node
* @param {Array} edges
*/
layoutEdges : function(node, allEdges, offset){
// Find all edges, which are related to the node and
// have more than two dockers
var edges = allEdges
// Find all edges with more than two dockers
.findAll(function(r){ return r.dockers.length > 2 }.bind(this))
if (edges.length > 0) {
// Get the new absolute center
var center = node.absoluteXY();
var ulo = {x: center.x - offset.x, y:center.y - offset.y}
center.x += node.bounds.width()/2;
center.y += node.bounds.height()/2;
// Get the old absolute center
oldCenter = Object.clone(center);
oldCenter.x -= offset ? offset.x : 0;
oldCenter.y -= offset ? offset.y : 0;
var ul = {x: center.x - (node.bounds.width() / 2), y: center.y - (node.bounds.height() / 2)}
var lr = {x: center.x + (node.bounds.width() / 2), y: center.y + (node.bounds.height() / 2)}
/**
* Align the bounds if the center is
* the same than the old center
* @params {Object} bounds
* @params {Object} bounds2
*/
var align = function(bounds, bounds2){
var xdif = bounds.center().x-bounds2.center().x;
var ydif = bounds.center().y-bounds2.center().y;
if (Math.abs(xdif) < 3){
bounds.moveBy({x:(offset.xs?(((offset.xs*(bounds.center().x-ulo.x))+offset.x+ulo.x)-bounds.center().x):offset.x)-xdif, y:0});
} else if (Math.abs(ydif) < 3){
bounds.moveBy({x:0, y:(offset.ys?(((offset.ys*(bounds.center().y-ulo.y))+offset.y+ulo.y)-bounds.center().y):offset.y)-ydif});
}
};
/**
* Returns a TRUE if there are bend point which overlay the shape
*/
var isBendPointIncluded = function(edge){
// Get absolute bounds
var ab = edge.dockers.first().getDockedShape();
var bb = edge.dockers.last().getDockedShape();
if (ab) {
ab = ab.absoluteBounds();
ab.widen(5);
}
if (bb) {
bb = bb.absoluteBounds();
bb.widen(20); // Wide with 20 because of the arrow from the edge
}
return edge.dockers
.any(function(docker, i){
var c = docker.bounds.center();
// Dont count first and last
return i != 0 && i != edge.dockers.length-1 &&
// Check if the point is included to the absolute bounds
((ab && ab.isIncluded(c)) || (bb && bb.isIncluded(c)))
})
}
// For every edge, check second and one before last docker
// if there are horizontal/vertical on the same level
// and if so, align the the bounds
edges.each(function(edge){
if (edge.dockers.first().getDockedShape() === node){
var second = edge.dockers[1];
if (align(second.bounds, edge.dockers.first().bounds)){ second.update(); }
} else if (edge.dockers.last().getDockedShape() === node) {
var beforeLast = edge.dockers[edge.dockers.length-2];
if (align(beforeLast.bounds, edge.dockers.last().bounds)){ beforeLast.update(); }
}
edge._update(true);
// Unused dockers create inconsistent states across remote clients
//edge.removeUnusedDockers();
if (isBendPointIncluded(edge)){
this.doLayout(edge);
return;
}
}.bind(this))
}
// Find all edges, which have only to dockers
// and is located horizontal/vertical.
// Do layout with those edges
allEdges.each(function(edge){
// Find all edges with two dockers
if (edge.dockers.length == 2){
var p1 = edge.dockers.first().bounds.center();
var p2 = edge.dockers.last().bounds.center();
// Find all horizontal/vertical edges
if (Math.abs(p1.x - p2.x) < 2 || Math.abs(p1.y - p2.y) < 2){
edge.dockers.first().update();
edge.dockers.last().update();
this.doLayout(edge);
}
}
}.bind(this));
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
/**
* @classDescription Base class for Shapes.
* @extends ORYX.Core.AbstractShape
*/
ORYX.Core.Shape = {
/**
* Constructor
*/
construct: function(options, stencil) {
// call base class constructor
arguments.callee.$.construct.apply(this, arguments);
this.dockers = [];
this.magnets = [];
this._defaultMagnet;
this.incoming = [];
this.outgoing = [];
this.nodes = [];
this._dockerChangedCallback = this._dockerChanged.bind(this);
//Hash map for all labels. Labels are not treated as children of shapes.
this._labels = new Hash();
// create SVG node
this.node = ORYX.Editor.graft("http://www.w3.org/2000/svg",
null,
['g', {id:this.id},
['g', {"class": "stencils"},
['g', {"class": "me"}],
['g', {"class": "children", style:"overflow:hidden"}],
['g', {"class": "edge"}]
],
['g', {"class": "controls"},
['g', {"class": "dockers"}],
['g', {"class": "magnets"}]
]
]);
this.metadata = {
changedBy: [],
changedAt: [],
commands: [],
isLocal: false
}
},
lastChangeWasLocal: function lastChangeWasLocal() {
return this.metadata.isLocal;
},
getLastCommandDisplayName: function getLastCommandDisplayName() {
if (this.metadata.commands.length === 0) {
return undefined;
}
return this.metadata.commands[this.metadata.commands.length - 1];
},
getLastChangedBy: function getLastChangedBy() {
if (this.metadata.changedBy.length === 0) {
return undefined;
}
return this.metadata.changedBy[this.metadata.changedBy.length - 1];
},
getLastChangedAt: function getLastChangedBy() {
if (this.metadata.changedAt.length === 0) {
return undefined;
}
return this.metadata.changedAt[this.metadata.changedAt.length - 1];
},
/**
* If changed flag is set, refresh method is called.
*/
update: function() {
//if(this.isChanged) {
//this.layout();
//}
},
/**
* !!!Not called from any sub class!!!
*/
_update: function() {
},
/**
* Calls the super class refresh method
* and updates the svg elements that are referenced by a property.
*/
refresh: function() {
//call base class refresh method
arguments.callee.$.refresh.apply(this, arguments);
if(this.node.ownerDocument) {
//adjust SVG to properties' values
var me = this;
this.propertiesChanged.each((function(propChanged) {
if(propChanged.value) {
var prop = this.properties[propChanged.key];
var property = this.getStencil().property(propChanged.key);
this.propertiesChanged[propChanged.key] = false;
//handle choice properties
if(property.type() == ORYX.CONFIG.TYPE_CHOICE) {
//iterate all references to SVG elements
property.refToView().each((function(ref) {
//if property is referencing a label, update the label
if(ref !== "") {
var label = this._labels[this.id + ref];
if (label) {
label.text(property.item(prop).value());
}
}
}).bind(this));
//if the choice's items are referencing SVG elements
// show the selected and hide all other referenced SVG
// elements
var refreshedSvgElements = new Hash();
property.items().each((function(item) {
item.refToView().each((function(itemRef) {
if(itemRef == "") { this.propertiesChanged[propChanged.key] = true; return; }
var svgElem = this.node.ownerDocument.getElementById(this.id + itemRef);
if(!svgElem) { this.propertiesChanged[propChanged.key] = true; return; }
/* Do not refresh the same svg element multiple times */
if(!refreshedSvgElements[svgElem.id] || prop == item.value()) {
svgElem.setAttributeNS(null, 'display', ((prop == item.value()) ? 'inherit' : 'none'));
refreshedSvgElements[svgElem.id] = svgElem;
}
// Reload the href if there is an image-tag
if(ORYX.Editor.checkClassType(svgElem, SVGImageElement)) {
svgElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', svgElem.getAttributeNS('http://www.w3.org/1999/xlink', 'href'));
}
}).bind(this));
}).bind(this));
} else { //handle properties that are not of type choice
//iterate all references to SVG elements
property.refToView().each((function(ref) {
//if the property does not reference an SVG element,
// do nothing
if(ref === "") { this.propertiesChanged[propChanged.key] = true; return; }
var refId = this.id + ref;
//get the SVG element
var svgElem = this.node.ownerDocument.getElementById(refId);
//if the SVG element can not be found
if(!svgElem || !(svgElem.ownerSVGElement)) {
//if the referenced SVG element is a SVGAElement, it cannot
// be found with getElementById (Firefox bug).
// this is a work around
if(property.type() === ORYX.CONFIG.TYPE_URL || property.type() === ORYX.CONFIG.TYPE_DIAGRAM_LINK) {
var svgElems = this.node.ownerDocument.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'a');
svgElem = $A(svgElems).find(function(elem) {
return elem.getAttributeNS(null, 'id') === refId;
});
if(!svgElem) { this.propertiesChanged[propChanged.key] = true; return; }
} else {
this.propertiesChanged[propChanged.key] = true;
return;
}
}
if (property.complexAttributeToView()) {
var label = this._labels[refId];
if (label) {
try {
propJson = prop.evalJSON();
var value = propJson[property.complexAttributeToView()]
label.text(value ? value : prop);
} catch (e) {
label.text(prop);
}
}
} else {
switch (property.type()) {
case ORYX.CONFIG.TYPE_BOOLEAN:
if (typeof prop == "string")
prop = prop === "true"
svgElem.setAttributeNS(null, 'display', (!(prop === property.inverseBoolean())) ? 'inherit' : 'none');
break;
case ORYX.CONFIG.TYPE_COLOR:
if(property.fill()) {
if (svgElem.tagName.toLowerCase() === "stop"){
svgElem.setAttributeNS(null, "stop-color", prop);
// Adjust stop color of the others
if (svgElem.parentNode.tagName.toLowerCase() === "radialgradient"){
ORYX.Utils.adjustGradient(svgElem.parentNode, svgElem);
}
} else {
svgElem.setAttributeNS(null, 'fill', prop);
}
}
if(property.stroke()) {
svgElem.setAttributeNS(null, 'stroke', prop);
}
break;
case ORYX.CONFIG.TYPE_STRING:
var label = this._labels[refId];
if (label) {
label.text(prop);
}
break;
case ORYX.CONFIG.TYPE_INTEGER:
var label = this._labels[refId];
if (label) {
label.text(prop);
}
break;
case ORYX.CONFIG.TYPE_FLOAT:
if(property.fillOpacity()) {
svgElem.setAttributeNS(null, 'fill-opacity', prop);
}
if(property.strokeOpacity()) {
svgElem.setAttributeNS(null, 'stroke-opacity', prop);
}
if(!property.fillOpacity() && !property.strokeOpacity()) {
var label = this._labels[refId];
if (label) {
label.text(prop);
}
}
break;
case ORYX.CONFIG.TYPE_URL:
case ORYX.CONFIG.TYPE_DIAGRAM_LINK:
//TODO what is the dafault path?
var hrefAttr = svgElem.getAttributeNodeNS('http://www.w3.org/1999/xlink', 'xlink:href');
// in collaborative mode links will only work if the property for the link has been set
if (ORYX.CONFIG.COLLABORATION && prop == "") {
break;
}
if(hrefAttr) {
hrefAttr.textContent = prop;
} else {
svgElem.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', prop);
}
break;
}
}
}).bind(this));
}
}
}).bind(this));
//update labels
this._labels.values().each(function(label) {
label.update();
});
}
},
layout: function() {
//this.getStencil().layout(this)
var layoutEvents = this.getStencil().layout()
if(this instanceof ORYX.Core.Node && layoutEvents) {
layoutEvents.each(function(event) {
// setup additional attributes
event.shape = this;
event.forceExecution = true;
// do layouting
this._delegateEvent(event);
}.bind(this))
}
},
/**
* Returns an array of Label objects.
*/
getLabels: function() {
return this._labels.values();
},
/**
* Returns an array of dockers of this object.
*/
getDockers: function() {
return this.dockers;
},
getMagnets: function() {
return this.magnets;
},
getDefaultMagnet: function() {
if(this._defaultMagnet) {
return this._defaultMagnet;
} else if (this.magnets.length > 0) {
return this.magnets[0];
} else {
return undefined;
}
},
getParentShape: function() {
return this.parent;
},
getIncomingShapes: function(iterator) {
if(iterator) {
this.incoming.each(iterator);
}
return this.incoming;
},
getIncomingNodes: function(iterator) {
return this.incoming.select(function(incoming){
var isNode = (incoming instanceof ORYX.Core.Node);
if(isNode && iterator) iterator(incoming);
return isNode;
});
},
getOutgoingShapes: function(iterator) {
if(iterator) {
this.outgoing.each(iterator);
}
return this.outgoing;
},
getOutgoingNodes: function(iterator) {
return this.outgoing.select(function(out){
var isNode = (out instanceof ORYX.Core.Node);
if(isNode && iterator) iterator(out);
return isNode;
});
},
getAllDockedShapes: function(iterator) {
var result = this.incoming.concat(this.outgoing);
if(iterator) {
result.each(iterator);
}
return result
},
getCanvas: function() {
if(this.parent instanceof ORYX.Core.Canvas) {
return this.parent;
} else if(this.parent instanceof ORYX.Core.Shape) {
return this.parent.getCanvas();
} else {
return undefined;
}
},
/**
*
* @param {Object} deep
* @param {Object} iterator
*/
getChildNodes: function(deep, iterator) {
if(!deep && !iterator) {
return this.nodes.clone();
} else {
var result = [];
this.nodes.each(function(uiObject) {
if(!uiObject.isVisible){return}
if(iterator) {
iterator(uiObject);
}
result.push(uiObject);
if(deep && uiObject instanceof ORYX.Core.Shape) {
result = result.concat(uiObject.getChildNodes(deep, iterator));
}
});
return result;
}
},
/**
* Overrides the UIObject.add method. Adds uiObject to the correct sub node.
* @param {UIObject} uiObject
* @param {Number} index
*/
add: function(uiObject, index) {
//parameter has to be an UIObject, but
// must not be an Edge.
if(uiObject instanceof ORYX.Core.UIObject
&& !(uiObject instanceof ORYX.Core.Edge)) {
if (!(this.children.member(uiObject))) {
//if uiObject is child of another parent, remove it from that parent.
if(uiObject.parent) {
uiObject.parent.remove(uiObject);
}
//add uiObject to this Shape
if(index != undefined)
this.children.splice(index, 0, uiObject);
else
this.children.push(uiObject);
//set parent reference
uiObject.parent = this;
//add uiObject.node to this.node depending on the type of uiObject
var parent;
if(uiObject instanceof ORYX.Core.Node) {
parent = this.node.childNodes[0].childNodes[1];
this.nodes.push(uiObject);
} else if(uiObject instanceof ORYX.Core.Controls.Control) {
var ctrls = this.node.childNodes[1];
if(uiObject instanceof ORYX.Core.Controls.Docker) {
parent = ctrls.childNodes[0];
if (this.dockers.length >= 2){
this.dockers.splice(index!==undefined?Math.min(index, this.dockers.length-1):this.dockers.length-1, 0, uiObject);
} else {
this.dockers.push(uiObject);
}
} else if(uiObject instanceof ORYX.Core.Controls.Magnet) {
parent = ctrls.childNodes[1];
this.magnets.push(uiObject);
} else {
parent = ctrls;
}
} else { //UIObject
parent = this.node;
}
if(index != undefined && index < parent.childNodes.length)
uiObject.node = parent.insertBefore(uiObject.node, parent.childNodes[index]);
else
uiObject.node = parent.appendChild(uiObject.node);
this._changed();
//uiObject.bounds.registerCallback(this._changedCallback);
if(this.eventHandlerCallback)
this.eventHandlerCallback({type:ORYX.CONFIG.EVENT_SHAPEADDED,shape:uiObject})
} else {
ORYX.Log.warn("add: ORYX.Core.UIObject is already a child of this object.");
}
} else {
ORYX.Log.warn("add: Parameter is not of type ORYX.Core.UIObject.");
}
},
/**
* Overrides the UIObject.remove method. Removes uiObject.
* @param {UIObject} uiObject
*/
remove: function(uiObject) {
//if uiObject is a child of this object, remove it.
if (this.children.member(uiObject)) {
//remove uiObject from children
this.children = this.children.without(uiObject);
//delete parent reference of uiObject
uiObject.parent = undefined;
//delete uiObject.node from this.node
if(uiObject instanceof ORYX.Core.Shape) {
if(uiObject instanceof ORYX.Core.Edge) {
uiObject.removeMarkers();
uiObject.node = this.node.childNodes[0].childNodes[2].removeChild(uiObject.node);
} else {
uiObject.node = this.node.childNodes[0].childNodes[1].removeChild(uiObject.node);
this.nodes = this.nodes.without(uiObject);
}
} else if(uiObject instanceof ORYX.Core.Controls.Control) {
if (uiObject instanceof ORYX.Core.Controls.Docker) {
uiObject.node = this.node.childNodes[1].childNodes[0].removeChild(uiObject.node);
this.dockers = this.dockers.without(uiObject);
} else if (uiObject instanceof ORYX.Core.Controls.Magnet) {
uiObject.node = this.node.childNodes[1].childNodes[1].removeChild(uiObject.node);
this.magnets = this.magnets.without(uiObject);
} else {
uiObject.node = this.node.childNodes[1].removeChild(uiObject.node);
}
}
this._changed();
//uiObject.bounds.unregisterCallback(this._changedCallback);
} else {
ORYX.Log.warn("remove: ORYX.Core.UIObject is not a child of this object.");
}
},
/**
* Calculate the Border Intersection Point between two points
* @param {PointA}
* @param {PointB}
*/
getIntersectionPoint: function() {
var pointAX, pointAY, pointBX, pointBY;
// Get the the two Points
switch(arguments.length) {
case 2:
pointAX = arguments[0].x;
pointAY = arguments[0].y;
pointBX = arguments[1].x;
pointBY = arguments[1].y;
break;
case 4:
pointAX = arguments[0];
pointAY = arguments[1];
pointBX = arguments[2];
pointBY = arguments[3];
break;
default:
throw "getIntersectionPoints needs two or four arguments";
}
// Defined an include and exclude point
var includePointX, includePointY, excludePointX, excludePointY;
var bounds = this.absoluteBounds();
if(this.isPointIncluded(pointAX, pointAY, bounds)){
includePointX = pointAX;
includePointY = pointAY;
} else {
excludePointX = pointAX;
excludePointY = pointAY;
}
if(this.isPointIncluded(pointBX, pointBY, bounds)){
includePointX = pointBX;
includePointY = pointBY;
} else {
excludePointX = pointBX;
excludePointY = pointBY;
}
// If there is no inclue or exclude Shape, than return
if(!includePointX || !includePointY || !excludePointX || !excludePointY) {
return undefined;
}
var midPointX = 0;
var midPointY = 0;
var refPointX, refPointY;
var minDifferent = 1;
// Get the UpperLeft and LowerRight
//var ul = bounds.upperLeft();
//var lr = bounds.lowerRight();
var i = 0;
while(true) {
// Calculate the midpoint of the current to points
var midPointX = Math.min(includePointX, excludePointX) + ((Math.max(includePointX, excludePointX) - Math.min(includePointX, excludePointX)) / 2.0);
var midPointY = Math.min(includePointY, excludePointY) + ((Math.max(includePointY, excludePointY) - Math.min(includePointY, excludePointY)) / 2.0);
// Set the new midpoint by the means of the include of the bounds
if(this.isPointIncluded(midPointX, midPointY, bounds)){
includePointX = midPointX;
includePointY = midPointY;
} else {
excludePointX = midPointX;
excludePointY = midPointY;
}
// Calc the length of the line
var length = Math.sqrt(Math.pow(includePointX - excludePointX, 2) + Math.pow(includePointY - excludePointY, 2))
// Calc a point one step from the include point
refPointX = includePointX + ((excludePointX - includePointX) / length),
refPointY = includePointY + ((excludePointY - includePointY) / length)
// If the reference point not in the bounds, break
if(!this.isPointIncluded(refPointX, refPointY, bounds)) {
break
}
}
// Return the last includepoint
return {x:refPointX , y:refPointY};
},
/**
* Calculate if the point is inside the Shape
* @param {PointX}
* @param {PointY}
*/
isPointIncluded: function(){
return false
},
/**
* Calculate if the point is over an special offset area
* @param {Point}
*/
isPointOverOffset: function(){
return this.isPointIncluded.apply( this , arguments )
},
_dockerChanged: function() {
},
/**
* Create a Docker for this Edge
*
*/
createDocker: function(index, position, id) {
var docker = new ORYX.Core.Controls.Docker({eventHandlerCallback: this.eventHandlerCallback, "id": id});
docker.bounds.registerCallback(this._dockerChangedCallback);
if(position) {
docker.bounds.centerMoveTo(position);
}
this.add(docker, index);
return docker
},
/**
* Get the serialized object
* return Array with hash-entrees (prefix, name, value)
* Following values will given:
* Bounds
* Outgoing Shapes
* Parent
*/
serialize: function() {
var serializedObject = arguments.callee.$.serialize.apply(this);
// Add the bounds
serializedObject.push({name: 'bounds', prefix:'oryx', value: this.bounds.serializeForERDF(), type: 'literal'});
// Add the outgoing shapes
this.getOutgoingShapes().each((function(followingShape){
serializedObject.push({name: 'outgoing', prefix:'raziel', value: '#'+ERDF.__stripHashes(followingShape.resourceId), type: 'resource'});
}).bind(this));
// Add the parent shape, if the parent not the canvas
//if(this.parent instanceof ORYX.Core.Shape){
serializedObject.push({name: 'parent', prefix:'raziel', value: '#'+ERDF.__stripHashes(this.parent.resourceId), type: 'resource'});
//}
return serializedObject;
},
deserialize: function(serialze){
arguments.callee.$.deserialize.apply(this, arguments);
// Set the Bounds
var bounds = serialze.find(function(ser){ return (ser.prefix+"-"+ser.name) == 'oryx-bounds'});
if(bounds) {
var b = bounds.value.replace(/,/g, " ").split(" ").without("");
if(this instanceof ORYX.Core.Edge){
this.dockers.first().bounds.centerMoveTo(parseFloat(b[0]), parseFloat(b[1]));
this.dockers.last().bounds.centerMoveTo(parseFloat(b[2]), parseFloat(b[3]));
} else {
this.bounds.set(parseFloat(b[0]), parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3]));
}
}
},
/**
* Private methods.
*/
/**
* Child classes have to overwrite this method for initializing a loaded
* SVG representation.
* @param {SVGDocument} svgDocument
*/
_init: function(svgDocument) {
//adjust ids
this._adjustIds(svgDocument, 0);
},
_adjustIds: function(element, idIndex) {
if(element instanceof Element) {
var eid = element.getAttributeNS(null, 'id');
if(eid && eid !== "") {
element.setAttributeNS(null, 'id', this.id + eid);
} else {
element.setAttributeNS(null, 'id', this.id + "_" + this.id + "_" + idIndex);
idIndex++;
}
// Replace URL in fill attribute
var fill = element.getAttributeNS(null, 'fill');
if (fill&&fill.include("url(#")){
fill = fill.replace(/url\(#/g, 'url(#'+this.id);
element.setAttributeNS(null, 'fill', fill);
}
if(element.hasChildNodes()) {
for(var i = 0; i < element.childNodes.length; i++) {
idIndex = this._adjustIds(element.childNodes[i], idIndex);
}
}
}
return idIndex;
},
toString: function() { return "ORYX.Core.Shape " + this.getId() }
};
ORYX.Core.Shape = ORYX.Core.AbstractShape.extend(ORYX.Core.Shape);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.Controls) {ORYX.Core.Controls = {};}
/**
* @classDescription Represents a movable docker that can be bound to a shape. Dockers are used
* for positioning shape objects.
* @extends {Control}
*
* TODO absoluteXY und absoluteCenterXY von einem Docker liefern falsche Werte!!!
*/
ORYX.Core.Controls.Docker = ORYX.Core.Controls.Control.extend({
/**
* Constructor
*/
construct: function() {
arguments.callee.$.construct.apply(this, arguments);
this.isMovable = true; // Enables movability
this.bounds.set(0, 0, 16, 16); // Set the bounds
this.referencePoint = undefined; // Refrenzpoint
this._dockedShapeBounds = undefined;
this._dockedShape = undefined;
this._oldRefPoint1 = undefined;
this._oldRefPoint2 = undefined;
//this.anchors = [];
this.anchorLeft;
this.anchorRight;
this.anchorTop;
this.anchorBottom;
this.node = ORYX.Editor.graft("http://www.w3.org/2000/svg",
null,
['g']);
// The DockerNode reprasentation
this._dockerNode = ORYX.Editor.graft("http://www.w3.org/2000/svg",
this.node,
['g', {"pointer-events":"all"},
['circle', {cx:"8", cy:"8", r:"8", stroke:"none", fill:"none"}],
['circle', {cx:"8", cy:"8", r:"3", stroke:"black", fill:"red", "stroke-width":"1"}]
]);
// The ReferenzNode reprasentation
this._referencePointNode = ORYX.Editor.graft("http://www.w3.org/2000/svg",
this.node,
['g', {"pointer-events":"none"},
['circle', {cx: this.bounds.upperLeft().x, cy: this.bounds.upperLeft().y, r: 3, fill:"red", "fill-opacity":0.4}]]);
// Hide the Docker
this.hide();
//Add to the EventHandler
this.addEventHandlers(this.node);
// Buffer the Update Callback for un-/register on Event-Handler
this._updateCallback = this._changed.bind(this);
},
/**
* @return {Point} The absolute position of this Docker.
* Dockers seem to be positioned relative to their parent's parent (instead of their parent like all other UIObjects are).
* Thus we have to ignore the docker's direct parent when calculating the absolute position.
*/
absoluteXY: function() {
if(this.parent) {
// Skipping the parent's absolute position.
var pXY = this.parent.parent.absoluteXY();
return {x: pXY.x + this.bounds.upperLeft().x , y: pXY.y + this.bounds.upperLeft().y};
} else {
return {x: this.bounds.upperLeft().x , y: this.bounds.upperLeft().y};
}
},
update: function() {
// If there have an DockedShape
if(this._dockedShape) {
if(this._dockedShapeBounds && this._dockedShape instanceof ORYX.Core.Node) {
// Calc the delta of width and height of the lastBounds and the current Bounds
var dswidth = this._dockedShapeBounds.width();
var dsheight = this._dockedShapeBounds.height();
if(!dswidth)
dswidth = 1;
if(!dsheight)
dsheight = 1;
var widthDelta = this._dockedShape.bounds.width() / dswidth;
var heightDelta = this._dockedShape.bounds.height() / dsheight;
// If there is an different
if(widthDelta !== 1.0 || heightDelta !== 1.0) {
// Set the delta
this.referencePoint.x *= widthDelta;
this.referencePoint.y *= heightDelta;
}
// Clone these bounds
this._dockedShapeBounds = this._dockedShape.bounds.clone();
}
// Get the first and the last Docker of the parent Shape
var dockerIndex = this.parent.dockers.indexOf(this)
var dock1 = this;
var dock2 = this.parent.dockers.length > 1 ?
(dockerIndex === 0? // If there is the first element
this.parent.dockers[dockerIndex + 1]: // then take the next docker
this.parent.dockers[dockerIndex - 1]): // if not, then take the docker before
undefined;
// Calculate the first absolute Refenzpoint
var absoluteReferenzPoint1 = dock1.getDockedShape() ?
dock1.getAbsoluteReferencePoint() :
dock1.bounds.center();
// Calculate the last absolute Refenzpoint
var absoluteReferenzPoint2 = dock2 && dock2.getDockedShape() ?
dock2.getAbsoluteReferencePoint() :
dock2 ?
dock2.bounds.center() :
undefined;
// If there is no last absolute Referenzpoint
if(!absoluteReferenzPoint2) {
// Calculate from the middle of the DockedShape
var center = this._dockedShape.absoluteCenterXY();
var minDimension = this._dockedShape.bounds.width() * this._dockedShape.bounds.height();
absoluteReferenzPoint2 = {
x: absoluteReferenzPoint1.x + (center.x - absoluteReferenzPoint1.x) * -minDimension,
y: absoluteReferenzPoint1.y + (center.y - absoluteReferenzPoint1.y) * -minDimension
}
}
var newPoint = undefined;
/*if (!this._oldRefPoint1 || !this._oldRefPoint2 ||
absoluteReferenzPoint1.x !== this._oldRefPoint1.x ||
absoluteReferenzPoint1.y !== this._oldRefPoint1.y ||
absoluteReferenzPoint2.x !== this._oldRefPoint2.x ||
absoluteReferenzPoint2.y !== this._oldRefPoint2.y) {*/
// Get the new point for the Docker, calucalted by the intersection point of the Shape and the two points
newPoint = this._dockedShape.getIntersectionPoint(absoluteReferenzPoint1, absoluteReferenzPoint2);
// If there is new point, take the referencepoint as the new point
if(!newPoint) {
newPoint = this.getAbsoluteReferencePoint();
}
if(this.parent && this.parent.parent) {
var grandParentPos = this.parent.parent.absoluteXY();
newPoint.x -= grandParentPos.x;
newPoint.y -= grandParentPos.y;
}
// Set the bounds to the new point
this.bounds.centerMoveTo(newPoint)
this._oldRefPoint1 = absoluteReferenzPoint1;
this._oldRefPoint2 = absoluteReferenzPoint2;
}
/*else {
newPoint = this.bounds.center();
}*/
// }
// Call the super class
arguments.callee.$.update.apply(this, arguments);
},
/**
* Calls the super class refresh method and updates the view of the docker.
*/
refresh: function() {
arguments.callee.$.refresh.apply(this, arguments);
// Refresh the dockers node
var p = this.bounds.upperLeft();
this._dockerNode.setAttributeNS(null, 'transform','translate(' + p.x + ', ' + p.y + ')');
// Refresh the referencepoints node
p = Object.clone(this.referencePoint);
if(p && this._dockedShape){
var upL
if(this.parent instanceof ORYX.Core.Edge) {
upL = this._dockedShape.absoluteXY();
} else {
upL = this._dockedShape.bounds.upperLeft();
}
p.x += upL.x;
p.y += upL.y;
} else {
p = this.bounds.center();
}
this._referencePointNode.setAttributeNS(null, 'transform','translate(' + p.x + ', ' + p.y + ')');
},
/**
* Set the reference point
* @param {Object} point
*/
setReferencePoint: function(point) {
// Set the referencepoint
if(this.referencePoint !== point &&
(!this.referencePoint ||
!point ||
this.referencePoint.x !== point.x ||
this.referencePoint.y !== point.y)) {
this.referencePoint = point;
this._changed();
}
// Update directly, because the referencepoint has no influence of the bounds
//this.refresh();
},
/**
* Get the absolute referencepoint
*/
getAbsoluteReferencePoint: function() {
if(!this.referencePoint || !this._dockedShape) {
return undefined;
} else {
var absUL = this._dockedShape.absoluteXY();
return {
x: this.referencePoint.x + absUL.x,
y: this.referencePoint.y + absUL.y
}
}
},
/**
* Set the docked Shape from the docker
* @param {Object} shape
*/
setDockedShape: function(shape) {
// If there is an old docked Shape
if(this._dockedShape) {
this._dockedShape.bounds.unregisterCallback(this._updateCallback)
// Delete the Shapes from the incoming and outgoing array
// If this Docker the incoming of the Shape
if(this === this.parent.dockers.first()) {
this.parent.incoming = this.parent.incoming.without(this._dockedShape);
this._dockedShape.outgoing = this._dockedShape.outgoing.without(this.parent);
// If this Docker the outgoing of the Shape
} else if (this === this.parent.dockers.last()){
this.parent.outgoing = this.parent.outgoing.without(this._dockedShape);
this._dockedShape.incoming = this._dockedShape.incoming.without(this.parent);
}
}
// Set the new Shape
this._dockedShape = shape;
this._dockedShapeBounds = undefined;
var referencePoint = undefined;
// If there is an Shape, register the updateCallback if there are changes in the shape bounds
if(this._dockedShape) {
// Add the Shapes to the incoming and outgoing array
// If this Docker the incoming of the Shape
if(this === this.parent.dockers.first()) {
this.parent.incoming.push(shape);
shape.outgoing.push(this.parent);
// If this Docker the outgoing of the Shape
} else if (this === this.parent.dockers.last()){
this.parent.outgoing.push(shape);
shape.incoming.push(this.parent);
}
// Get the bounds and set the new referencepoint
var bounds = this.bounds;
var absUL = shape.absoluteXY();
/*if(shape.parent){
var b = shape.parent.bounds.upperLeft();
absUL.x -= b.x;
absUL.y -= b.y;
}*/
referencePoint = {
x: bounds.center().x - absUL.x,
y: bounds.center().y - absUL.y
}
this._dockedShapeBounds = this._dockedShape.bounds.clone();
this._dockedShape.bounds.registerCallback(this._updateCallback);
// Set the color of the docker as docked
this.setDockerColor(ORYX.CONFIG.DOCKER_DOCKED_COLOR);
} else {
// Set the color of the docker as undocked
this.setDockerColor(ORYX.CONFIG.DOCKER_UNDOCKED_COLOR);
}
// Set the referencepoint
this.setReferencePoint(referencePoint);
this._changed();
//this.update();
},
/**
* Get the docked Shape
*/
getDockedShape: function() {
return this._dockedShape;
},
/**
* Returns TRUE if the docker has a docked shape
*/
isDocked: function() {
return !!this._dockedShape;
},
/**
* Set the Color of the Docker
* @param {Object} color
*/
setDockerColor: function(color) {
this._dockerNode.lastChild.setAttributeNS(null, "fill", color);
},
/**
* Hides this UIObject and all its children.
*/
hide: function() {
this.node.setAttributeNS(null, 'visibility', 'hidden');
this.children.each(function(uiObj) {
uiObj.hide();
});
},
/**
* Enables visibility of this UIObject and all its children.
*/
show: function() {
this.node.setAttributeNS(null, 'visibility', 'visible');
this.children.each(function(uiObj) {
uiObj.show();
});
},
toString: function() { return "Docker " + this.id }
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.Controls) {ORYX.Core.Controls = {};}
/**
* @classDescription Abstract base class for all Controls.
*/
ORYX.Core.Controls.Control = ORYX.Core.UIObject.extend({
toString: function() { return "Control " + this.id; }
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.Controls) {ORYX.Core.Controls = {};}
/**
* @classDescription Represents a magnet that is part of another shape and can
* be attached to dockers. Magnets are used for linking edge objects
* to other Shape objects.
* @extends {Control}
*/
ORYX.Core.Controls.Magnet = ORYX.Core.Controls.Control.extend({
/**
* Constructor
*/
construct: function() {
arguments.callee.$.construct.apply(this, arguments);
//this.anchors = [];
this.anchorLeft;
this.anchorRight;
this.anchorTop;
this.anchorBottom;
this.bounds.set(0, 0, 16, 16);
//graft magnet's root node into owner's control group.
this.node = ORYX.Editor.graft("http://www.w3.org/2000/svg",
null,
['g', {"pointer-events":"all"},
['circle', {cx:"8", cy:"8", r:"4", stroke:"none", fill:"red", "fill-opacity":"0.3"}]
]);
this.hide();
},
update: function() {
arguments.callee.$.update.apply(this, arguments);
//this.isChanged = true;
},
_update: function() {
arguments.callee.$.update.apply(this, arguments);
//this.isChanged = true;
},
refresh: function() {
arguments.callee.$.refresh.apply(this, arguments);
var p = this.bounds.upperLeft();
/*if(this.parent) {
var parentPos = this.parent.bounds.upperLeft();
p.x += parentPos.x;
p.y += parentPos.y;
}*/
this.node.setAttributeNS(null, 'transform','translate(' + p.x + ', ' + p.y + ')');
},
show: function() {
//this.refresh();
arguments.callee.$.show.apply(this, arguments);
},
toString: function() {
return "Magnet " + this.id;
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if (!ORYX) {
var ORYX = {};
}
if (!ORYX.Core) {
ORYX.Core = {};
}
/**
* @classDescription Abstract base class for all Nodes.
* @extends ORYX.Core.Shape
*/
ORYX.Core.Node = {
/**
* Constructor
* @param options {Object} A container for arguments.
* @param stencil {Stencil}
*/
construct: function(options, stencil){
arguments.callee.$.construct.apply(this, arguments);
this.isSelectable = true;
this.isMovable = true;
this._dockerUpdated = false;
this._oldBounds = new ORYX.Core.Bounds(); //init bounds with undefined values
this._svgShapes = []; //array of all SVGShape objects of
// SVG representation
//TODO vielleicht in shape verschieben?
this.minimumSize = undefined; // {width:..., height:...}
this.maximumSize = undefined;
//TODO vielleicht in shape oder uiobject verschieben?
// vielleicht sogar isResizable ersetzen?
this.isHorizontallyResizable = false;
this.isVerticallyResizable = false;
this.dataId = undefined;
this._init(this._stencil.view());
},
/**
* This method checks whether the shape is resized correctly and calls the
* super class update method.
*/
_update: function(){
this.dockers.invoke("update");
if (this.isChanged) {
var bounds = this.bounds;
var oldBounds = this._oldBounds;
if (this.isResized) {
var widthDelta = bounds.width() / oldBounds.width();
var heightDelta = bounds.height() / oldBounds.height();
//iterate over all relevant svg elements and resize them
this._svgShapes.each(function(svgShape){
//adjust width
if (svgShape.isHorizontallyResizable) {
svgShape.width = svgShape.oldWidth * widthDelta;
}
//adjust height
if (svgShape.isVerticallyResizable) {
svgShape.height = svgShape.oldHeight * heightDelta;
}
//check, if anchors are set
var anchorOffset;
var leftIncluded = svgShape.anchorLeft;
var rightIncluded = svgShape.anchorRight;
if (rightIncluded) {
anchorOffset = oldBounds.width() - (svgShape.oldX + svgShape.oldWidth);
if (leftIncluded) {
svgShape.width = bounds.width() - svgShape.x - anchorOffset;
}
else {
svgShape.x = bounds.width() - (anchorOffset + svgShape.width);
}
}
else
if (!leftIncluded) {
svgShape.x = widthDelta * svgShape.oldX;
if (!svgShape.isHorizontallyResizable) {
svgShape.x = svgShape.x + svgShape.width * widthDelta / 2 - svgShape.width / 2;
}
}
var topIncluded = svgShape.anchorTop;
var bottomIncluded = svgShape.anchorBottom;
if (bottomIncluded) {
anchorOffset = oldBounds.height() - (svgShape.oldY + svgShape.oldHeight);
if (topIncluded) {
svgShape.height = bounds.height() - svgShape.y - anchorOffset;
}
else {
// Hack for choreography task layouting
if (!svgShape._isYLocked) {
svgShape.y = bounds.height() - (anchorOffset + svgShape.height);
}
}
}
else
if (!topIncluded) {
svgShape.y = heightDelta * svgShape.oldY;
if (!svgShape.isVerticallyResizable) {
svgShape.y = svgShape.y + svgShape.height * heightDelta / 2 - svgShape.height / 2;
}
}
});
//check, if the current bounds is unallowed horizontally or vertically resized
var p = {
x: 0,
y: 0
};
if (!this.isHorizontallyResizable && bounds.width() !== oldBounds.width()) {
p.x = oldBounds.width() - bounds.width();
}
if (!this.isVerticallyResizable && bounds.height() !== oldBounds.height()) {
p.y = oldBounds.height() - bounds.height();
}
if (p.x !== 0 || p.y !== 0) {
bounds.extend(p);
}
//check, if the current bounds are between maximum and minimum bounds
p = {
x: 0,
y: 0
};
var widthDifference, heightDifference;
if (this.minimumSize) {
ORYX.Log.debug("Shape (%0)'s min size: (%1x%2)", this, this.minimumSize.width, this.minimumSize.height);
widthDifference = this.minimumSize.width - bounds.width();
if (widthDifference > 0) {
p.x += widthDifference;
}
heightDifference = this.minimumSize.height - bounds.height();
if (heightDifference > 0) {
p.y += heightDifference;
}
}
if (this.maximumSize) {
ORYX.Log.debug("Shape (%0)'s max size: (%1x%2)", this, this.maximumSize.width, this.maximumSize.height);
widthDifference = bounds.width() - this.maximumSize.width;
if (widthDifference > 0) {
p.x -= widthDifference;
}
heightDifference = bounds.height() - this.maximumSize.height;
if (heightDifference > 0) {
p.y -= heightDifference;
}
}
if (p.x !== 0 || p.y !== 0) {
bounds.extend(p);
}
//update magnets
var widthDelta = bounds.width() / oldBounds.width();
var heightDelta = bounds.height() / oldBounds.height();
var leftIncluded, rightIncluded, topIncluded, bottomIncluded, center, newX, newY;
this.magnets.each(function(magnet){
leftIncluded = magnet.anchorLeft;
rightIncluded = magnet.anchorRight;
topIncluded = magnet.anchorTop;
bottomIncluded = magnet.anchorBottom;
center = magnet.bounds.center();
if (leftIncluded) {
newX = center.x;
}
else
if (rightIncluded) {
newX = bounds.width() - (oldBounds.width() - center.x)
}
else {
newX = center.x * widthDelta;
}
if (topIncluded) {
newY = center.y;
}
else
if (bottomIncluded) {
newY = bounds.height() - (oldBounds.height() - center.y);
}
else {
newY = center.y * heightDelta;
}
if (center.x !== newX || center.y !== newY) {
magnet.bounds.centerMoveTo(newX, newY);
}
});
//set new position of labels
this.getLabels().each(function(label){
leftIncluded = label.anchorLeft;
rightIncluded = label.anchorRight;
topIncluded = label.anchorTop;
bottomIncluded = label.anchorBottom;
if (leftIncluded) {
}
else
if (rightIncluded) {
label.x = bounds.width() - (oldBounds.width() - label.oldX)
}
else {
label.x *= widthDelta;
}
if (topIncluded) {
}
else
if (bottomIncluded) {
label.y = bounds.height() - (oldBounds.height() - label.oldY);
}
else {
label.y *= heightDelta;
}
});
//update docker
var docker = this.dockers[0];
if (docker) {
docker.bounds.unregisterCallback(this._dockerChangedCallback);
if (!this._dockerUpdated) {
docker.bounds.centerMoveTo(this.bounds.center());
this._dockerUpdated = false;
}
docker.update();
docker.bounds.registerCallback(this._dockerChangedCallback);
}
this.isResized = false;
}
this.refresh();
this.isChanged = false;
this._oldBounds = this.bounds.clone();
}
this.children.each(function(value) {
if(!(value instanceof ORYX.Core.Controls.Docker)) {
value._update();
}
});
if (this.dockers.length > 0&&!this.dockers.first().getDockedShape()) {
this.dockers.each(function(docker){
docker.bounds.centerMoveTo(this.bounds.center())
}.bind(this))
}
/*this.incoming.each((function(edge) {
if(!(this.dockers[0] && this.dockers[0].getDockedShape() instanceof ORYX.Core.Node))
edge._update(true);
}).bind(this));
this.outgoing.each((function(edge) {
if(!(this.dockers[0] && this.dockers[0].getDockedShape() instanceof ORYX.Core.Node))
edge._update(true);
}).bind(this)); */
},
/**
* This method repositions and resizes the SVG representation
* of the shape.
*/
refresh: function(){
arguments.callee.$.refresh.apply(this, arguments);
/** Movement */
var x = this.bounds.upperLeft().x;
var y = this.bounds.upperLeft().y;
//set translation in transform attribute
/*var attributeTransform = document.createAttributeNS(ORYX.CONFIG.NAMESPACE_SVG, "transform");
attributeTransform.nodeValue = "translate(" + x + ", " + y + ")";
this.node.firstChild.setAttributeNode(attributeTransform);*/
// Move owner element
this.node.firstChild.setAttributeNS(null, "transform", "translate(" + x + ", " + y + ")");
// Move magnets
this.node.childNodes[1].childNodes[1].setAttributeNS(null, "transform", "translate(" + x + ", " + y + ")");
/** Resize */
//iterate over all relevant svg elements and update them
this._svgShapes.each(function(svgShape){
svgShape.update();
});
},
_dockerChanged: function(){
var docker = this.dockers[0];
//set the bounds of the the association
this.bounds.centerMoveTo(docker.bounds.center());
this._dockerUpdated = true;
//this._update(true);
},
/**
* This method traverses a tree of SVGElements and returns
* all SVGShape objects. For each basic shape or path element
* a SVGShape object is initialized.
*
* @param svgNode {SVGElement}
* @return {Array} Array of SVGShape objects
*/
_initSVGShapes: function(svgNode){
var svgShapes = [];
try {
var svgShape = new ORYX.Core.SVG.SVGShape(svgNode);
svgShapes.push(svgShape);
}
catch (e) {
//do nothing
}
if (svgNode.hasChildNodes()) {
for (var i = 0; i < svgNode.childNodes.length; i++) {
svgShapes = svgShapes.concat(this._initSVGShapes(svgNode.childNodes[i]));
}
}
return svgShapes;
},
/**
* Calculate if the point is inside the Shape
* @param {PointX}
* @param {PointY}
* @param {absoluteBounds} optional: for performance
*/
isPointIncluded: function(pointX, pointY, absoluteBounds){
// If there is an arguments with the absoluteBounds
var absBounds = absoluteBounds && absoluteBounds instanceof ORYX.Core.Bounds ? absoluteBounds : this.absoluteBounds();
if (!absBounds.isIncluded(pointX, pointY)) {
return false;
} else {
}
//point = Object.clone(point);
var ul = absBounds.upperLeft();
var x = pointX - ul.x;
var y = pointY - ul.y;
var i=0;
do {
var isPointIncluded = this._svgShapes[i++].isPointIncluded( x, y );
} while( !isPointIncluded && i < this._svgShapes.length)
return isPointIncluded;
/*return this._svgShapes.any(function(svgShape){
return svgShape.isPointIncluded(point);
});*/
},
/**
* Calculate if the point is over an special offset area
* @param {Point}
*/
isPointOverOffset: function( pointX, pointY ){
var isOverEl = arguments.callee.$.isPointOverOffset.apply( this , arguments );
if (isOverEl) {
// If there is an arguments with the absoluteBounds
var absBounds = this.absoluteBounds();
absBounds.widen( - ORYX.CONFIG.BORDER_OFFSET );
if ( !absBounds.isIncluded( pointX, pointY )) {
return true;
}
}
return false;
},
serialize: function(){
var result = arguments.callee.$.serialize.apply(this);
// Add the docker's bounds
// nodes only have at most one docker!
this.dockers.each((function(docker){
if (docker.getDockedShape()) {
var center = docker.referencePoint;
center = center ? center : docker.bounds.center();
result.push({
name: 'docker',
prefix: 'oryx',
value: $H(center).values().join(','),
type: 'literal'
});
}
}).bind(this));
// Get the spezific serialized object from the stencil
try {
//result = this.getStencil().serialize(this, result);
var serializeEvent = this.getStencil().serialize();
/*
* call serialize callback by reference, result should be found
* in serializeEvent.result
*/
if(serializeEvent.type) {
serializeEvent.shape = this;
serializeEvent.data = result;
serializeEvent.result = undefined;
serializeEvent.forceExecution = true;
this._delegateEvent(serializeEvent);
if(serializeEvent.result) {
result = serializeEvent.result;
}
}
}
catch (e) {
}
return result;
},
deserialize: function(data){
arguments.callee.$.deserialize.apply(this, [data]);
try {
//data = this.getStencil().deserialize(this, data);
var deserializeEvent = this.getStencil().deserialize();
/*
* call serialize callback by reference, result should be found
* in serializeEventInfo.result
*/
if(deserializeEvent.type) {
deserializeEvent.shape = this;
deserializeEvent.data = data;
deserializeEvent.result = undefined;
deserializeEvent.forceExecution = true;
this._delegateEvent(deserializeEvent);
if(deserializeEvent.result) {
data = deserializeEvent.result;
}
}
}
catch (e) {
}
// Set the outgoing shapes
var outgoing = data.findAll(function(ser){ return (ser.prefix+"-"+ser.name) == 'raziel-outgoing'});
outgoing.each((function(obj){
// TODO: Look at Canvas
if(!this.parent) {return};
// Set outgoing Shape
var next = this.getCanvas().getChildShapeByResourceId(obj.value);
if(next){
if(next instanceof ORYX.Core.Edge) {
//Set the first docker of the next shape
next.dockers.first().setDockedShape(this);
next.dockers.first().setReferencePoint(next.dockers.first().bounds.center());
} else if(next.dockers.length > 0) { //next is a node and next has a docker
next.dockers.first().setDockedShape(this);
//next.dockers.first().setReferencePoint({x: this.bounds.width() / 2.0, y: this.bounds.height() / 2.0});
}
}
}).bind(this));
if (this.dockers.length === 1) {
var dockerPos;
dockerPos = data.find(function(entry){
return (entry.prefix + "-" + entry.name === "oryx-dockers");
});
if (dockerPos) {
var points = dockerPos.value.replace(/,/g, " ").split(" ").without("").without("#");
if (points.length === 2 && this.dockers[0].getDockedShape()) {
this.dockers[0].setReferencePoint({
x: parseFloat(points[0]),
y: parseFloat(points[1])
});
}
else {
this.dockers[0].bounds.centerMoveTo(parseFloat(points[0]), parseFloat(points[1]));
}
}
}
},
/**
* This method excepts the SVGDoucment that is the SVG representation
* of this shape.
* The bounds of the shape are calculated, the SVG representation's upper left point
* is moved to 0,0 and it the method sets if this shape is resizable.
*
* @param {SVGDocument} svgDocument
*/
_init: function(svgDocument){
arguments.callee.$._init.apply(this, arguments);
var svgNode = svgDocument.getElementsByTagName("g")[0]; //outer most g node
// set all required attributes
var attributeTitle = svgDocument.ownerDocument.createAttributeNS(null, "title");
attributeTitle.nodeValue = this.getStencil().title();
svgNode.setAttributeNode(attributeTitle);
var attributeId = svgDocument.ownerDocument.createAttributeNS(null, "id");
attributeId.nodeValue = this.id;
svgNode.setAttributeNode(attributeId);
//
var stencilTargetNode = this.node.childNodes[0].childNodes[0]; //<g class=me>"
svgNode = stencilTargetNode.appendChild(svgNode);
// Add to the EventHandler
this.addEventHandlers(svgNode);
/**set minimum and maximum size*/
var minSizeAttr = svgNode.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "minimumSize");
if (minSizeAttr) {
minSizeAttr = minSizeAttr.replace("/,/g", " ");
var minSizeValues = minSizeAttr.split(" ");
minSizeValues = minSizeValues.without("");
if (minSizeValues.length > 1) {
this.minimumSize = {
width: parseFloat(minSizeValues[0]),
height: parseFloat(minSizeValues[1])
};
}
else {
//set minimumSize to (1,1), so that width and height of the stencil can never be (0,0)
this.minimumSize = {
width: 1,
height: 1
};
}
}
var maxSizeAttr = svgNode.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "maximumSize");
if (maxSizeAttr) {
maxSizeAttr = maxSizeAttr.replace("/,/g", " ");
var maxSizeValues = maxSizeAttr.split(" ");
maxSizeValues = maxSizeValues.without("");
if (maxSizeValues.length > 1) {
this.maximumSize = {
width: parseFloat(maxSizeValues[0]),
height: parseFloat(maxSizeValues[1])
};
}
}
if (this.minimumSize && this.maximumSize &&
(this.minimumSize.width > this.maximumSize.width ||
this.minimumSize.height > this.maximumSize.height)) {
//TODO wird verschluckt!!!
throw this + ": Minimum Size must be greater than maxiumSize.";
}
/**get current bounds and adjust it to upperLeft == (0,0)*/
//initialize all SVGShape objects
this._svgShapes = this._initSVGShapes(svgNode);
//get upperLeft and lowerRight of stencil
var upperLeft = {
x: undefined,
y: undefined
};
var lowerRight = {
x: undefined,
y: undefined
};
var me = this;
this._svgShapes.each(function(svgShape){
upperLeft.x = (upperLeft.x !== undefined) ? Math.min(upperLeft.x, svgShape.x) : svgShape.x;
upperLeft.y = (upperLeft.y !== undefined) ? Math.min(upperLeft.y, svgShape.y) : svgShape.y;
lowerRight.x = (lowerRight.x !== undefined) ? Math.max(lowerRight.x, svgShape.x + svgShape.width) : svgShape.x + svgShape.width;
lowerRight.y = (lowerRight.y !== undefined) ? Math.max(lowerRight.y, svgShape.y + svgShape.height) : svgShape.y + svgShape.height;
/** set if resizing is enabled */
//TODO isResizable durch die beiden anderen booleans ersetzen?
if (svgShape.isHorizontallyResizable) {
me.isHorizontallyResizable = true;
me.isResizable = true;
}
if (svgShape.isVerticallyResizable) {
me.isVerticallyResizable = true;
me.isResizable = true;
}
if (svgShape.anchorTop && svgShape.anchorBottom) {
me.isVerticallyResizable = true;
me.isResizable = true;
}
if (svgShape.anchorLeft && svgShape.anchorRight) {
me.isHorizontallyResizable = true;
me.isResizable = true;
}
});
//move all SVGShapes by -upperLeft
this._svgShapes.each(function(svgShape){
svgShape.x -= upperLeft.x;
svgShape.y -= upperLeft.y;
svgShape.update();
});
//set bounds of shape
//the offsets are also needed for positioning the magnets and the docker
var offsetX = upperLeft.x;
var offsetY = upperLeft.y;
lowerRight.x -= offsetX;
lowerRight.y -= offsetY;
upperLeft.x = 0;
upperLeft.y = 0;
//prevent that width or height of initial bounds is 0
if (lowerRight.x === 0) {
lowerRight.x = 1;
}
if (lowerRight.y === 0) {
lowerRight.y = 1;
}
this._oldBounds.set(upperLeft, lowerRight);
this.bounds.set(upperLeft, lowerRight);
/**initialize magnets */
var magnets = svgDocument.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_ORYX, "magnets");
if (magnets && magnets.length > 0) {
magnets = $A(magnets[0].getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_ORYX, "magnet"));
var me = this;
magnets.each(function(magnetElem){
var magnet = new ORYX.Core.Controls.Magnet({
eventHandlerCallback: me.eventHandlerCallback
});
var cx = parseFloat(magnetElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "cx"));
var cy = parseFloat(magnetElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "cy"));
magnet.bounds.centerMoveTo({
x: cx - offsetX,
y: cy - offsetY
});
//get anchors
var anchors = magnetElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "anchors");
if (anchors) {
anchors = anchors.replace("/,/g", " ");
anchors = anchors.split(" ").without("");
for(var i = 0; i < anchors.length; i++) {
switch(anchors[i].toLowerCase()) {
case "left":
magnet.anchorLeft = true;
break;
case "right":
magnet.anchorRight = true;
break;
case "top":
magnet.anchorTop = true;
break;
case "bottom":
magnet.anchorBottom = true;
break;
}
}
}
me.add(magnet);
//check, if magnet is default magnet
if (!this._defaultMagnet) {
var defaultAttr = magnetElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "default");
if (defaultAttr && defaultAttr.toLowerCase() === "yes") {
me._defaultMagnet = magnet;
}
}
});
}
else {
// Add a Magnet in the Center of Shape
var magnet = new ORYX.Core.Controls.Magnet();
magnet.bounds.centerMoveTo(this.bounds.width() / 2, this.bounds.height() / 2);
this.add(magnet);
}
/**initialize docker */
var dockerElem = svgDocument.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_ORYX, "docker");
if (dockerElem && dockerElem.length > 0) {
dockerElem = dockerElem[0];
var docker = this.createDocker();
var cx = parseFloat(dockerElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "cx"));
var cy = parseFloat(dockerElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "cy"));
docker.bounds.centerMoveTo({
x: cx - offsetX,
y: cy - offsetY
});
//get anchors
var anchors = dockerElem.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "anchors");
if (anchors) {
anchors = anchors.replace("/,/g", " ");
anchors = anchors.split(" ").without("");
for(var i = 0; i < anchors.length; i++) {
switch(anchors[i].toLowerCase()) {
case "left":
docker.anchorLeft = true;
break;
case "right":
docker.anchorRight = true;
break;
case "top":
docker.anchorTop = true;
break;
case "bottom":
docker.anchorBottom = true;
break;
}
}
}
}
/**initialize labels*/
var textElems = svgNode.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'text');
$A(textElems).each((function(textElem){
var label = new ORYX.Core.SVG.Label({
textElement: textElem,
shapeId: this.id,
eventHandler: this._delegateEvent.bind(this),
editable: true
});
label.x -= offsetX;
label.y -= offsetY;
this._labels[label.id] = label;
}).bind(this));
},
/**
* Override the Method, that a docker is not shown
*
*/
createDocker: function() {
var docker = new ORYX.Core.Controls.Docker({eventHandlerCallback: this.eventHandlerCallback});
docker.bounds.registerCallback(this._dockerChangedCallback);
this.dockers.push( docker );
docker.parent = this;
docker.bounds.registerCallback(this._changedCallback);
return docker;
},
toString: function(){
return this._stencil.title() + " " + this.id
}
};
ORYX.Core.Node = ORYX.Core.Shape.extend(ORYX.Core.Node);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
var idCounter = 0;
var ID_PREFIX = "resource";
/**
* Main initialization method. To be called when loading
* of the document, including all scripts, is completed.
*/
function init() {
/* When the blank image url is not set programatically to a local
* representation, a spacer gif on the site of ext is loaded from the
* internet. This causes problems when internet or the ext site are not
* available. */
Ext.BLANK_IMAGE_URL = ORYX.PATH + 'editor/lib/ext-2.0.2/resources/images/default/s.gif';
ORYX.Log.debug("Querying editor instances");
// Hack for WebKit to set the SVGElement-Classes
ORYX.Editor.setMissingClasses();
// If someone wants to create the editor instance himself
if (window.onOryxResourcesLoaded) {
window.onOryxResourcesLoaded();
}
// Else if this is a newly created model
else if(window.location.pathname.include(ORYX.CONFIG.ORYX_NEW_URL)){
new ORYX.Editor({
id: 'oryx-canvas123',
fullscreen: true,
stencilset: {
url: "/oryx" + ORYX.Utils.getParamFromUrl("stencilset")
}
});
}
// Else fetch the model from server and display editor
else {
//HACK for distinguishing between different backends
// Backend of 2008 uses /self URL ending
var modelUrl = window.location.href.replace(/#.*/g, "");
if(modelUrl.endsWith("/self")) {
modelUrl = modelUrl.replace("/self","/json");
} else {
modelUrl += "&data";
}
ORYX.Editor.createByUrl(modelUrl, {
id: modelUrl
});
}
}
/**
@namespace Global Oryx name space
@name ORYX
*/
if(!ORYX) {var ORYX = {};}
/**
* The Editor class.
* @class ORYX.Editor
* @extends Clazz
* @param {Object} config An editor object, passed to {@link ORYX.Editor#loadSerialized}
* @param {String} config.id Any ID that can be used inside the editor. If fullscreen=false, any HTML node with this id must be present to render the editor to this node.
* @param {boolean} [config.fullscreen=true] Render editor in fullscreen mode or not.
* @param {String} config.stencilset.url Stencil set URL.
* @param {String} [config.stencil.id] Stencil type used for creating the canvas.
* @param {Object} config.properties Any properties applied to the canvas.
*/
ORYX.Editor = {
/** @lends ORYX.Editor.prototype */
// Defines the global dom event listener
DOMEventListeners: new Hash(),
// Defines the selection
selection: [],
// Defines the current zoom level
zoomLevel:1.0,
// Id of the local user in collaboration mode
userId: undefined,
dragging: false,
construct: function(config) {
// initialization.
this._eventsQueue = [];
this.loadedPlugins = [];
this.pluginsData = [];
//meta data about the model for the signavio warehouse
//directory, new, name, description, revision, model (the model data)
this.modelMetaData = config;
var model = config;
if(config.model) {
model = config.model;
}
this.id = model.resourceId;
if(!this.id) {
this.id = model.id;
if(!this.id) {
this.id = ORYX.Editor.provideId();
}
}
// Defines if the editor should be fullscreen or not
this.fullscreen = model.fullscreen || true;
// Initialize the eventlistener
this._initEventListener();
// Load particular stencilset
var ssUrl;
if(ORYX.CONFIG.BACKEND_SWITCH) {
ssUrl = (model.stencilset.namespace||model.stencilset.url).replace("#", "%23");
ORYX.Core.StencilSet.loadStencilSet(ORYX.CONFIG.STENCILSET_HANDLER + ssUrl, this.id);
} else {
ssUrl = model.stencilset.url;
ORYX.Core.StencilSet.loadStencilSet(ssUrl, this.id);
}
//TODO load ealier and asynchronous??
this._loadStencilSetExtensionConfig();
//Load predefined StencilSetExtensions
if(!!ORYX.CONFIG.SSEXTS){
ORYX.CONFIG.SSEXTS.each(function(ssext){
this.loadSSExtension(ssext.namespace);
}.bind(this));
}
// CREATES the canvas
this._createCanvas(model.stencil ? model.stencil.id : null, model.properties);
// GENERATES the whole EXT.VIEWPORT
this._generateGUI();
// Initializing of a callback to check loading ends
var loadPluginFinished = false;
var loadContentFinished = false;
var initFinished = function(){
if( !loadPluginFinished || !loadContentFinished ){ return; }
this._finishedLoading();
}.bind(this);
// disable key events when Ext modal window is active
ORYX.Editor.makeExtModalWindowKeysave(this._getPluginFacade());
// LOAD the plugins
window.setTimeout(function(){
this.loadPlugins();
loadPluginFinished = true;
initFinished();
}.bind(this), 100);
// LOAD the content of the current editor instance
window.setTimeout(function(){
this.loadSerialized(model);
this.getCanvas().update();
loadContentFinished = true;
initFinished();
}.bind(this), 200);
this.readOnlyMode = false;
this.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, this._stopSelectionChange.bind(this));
this.registerOnEvent(ORYX.CONFIG.EVENT_USER_ID_CHANGED, this.handleUserIdChangedEvent.bind(this));
this.registerOnEvent(ORYX.CONFIG.EVENT_DRAGDROP_START, this.handleDragStart.bind(this));
this.registerOnEvent(ORYX.CONFIG.EVENT_DRAGDROP_END, this.handleDragEnd.bind(this));
this.registerOnEvent(ORYX.CONFIG.EVENT_CANVAS_DRAGDROP_LOCK_TOGGLE, this.handleDragDropLockToggle.bind(this));
this.registerOnEvent(ORYX.CONFIG.EVENT_MODE_CHANGED, this.changeMode.bind(this));
// Mode management
this.modeManager = new ORYX.Editor.ModeManager(this._getPluginFacade());
},
handleDragStart: function handleDragStart(evt) {
this.dragging = true;
},
handleDragEnd: function handleDragEnd(evt) {
this.dragging = false;
},
handleDragDropLockToggle: function handleDragDropLockToggle(evt) {
if (evt.lock) {
this.dropTarget.lock();
} else {
this.dropTarget.unlock();
}
},
_finishedLoading: function() {
if(Ext.getCmp('oryx-loading-panel')){
Ext.getCmp('oryx-loading-panel').hide();
}
// Do Layout for viewport
this.layout.doLayout();
// Generate a drop target
this.dropTarget = new Ext.dd.DropTarget(this.getCanvas().rootNode.parentNode);
// Fixed the problem that the viewport can not
// start with collapsed panels correctly
if (ORYX.CONFIG.PANEL_RIGHT_COLLAPSED === true){
// east region disabled
//this.layout_regions.east.collapse();
}
if (ORYX.CONFIG.PANEL_LEFT_COLLAPSED === true){
// west region disabled
//this.layout_regions.west.collapse();
}
// Raise Loaded Event
this.handleEvents( {type:ORYX.CONFIG.EVENT_LOADED} );
},
_initEventListener: function(){
// Register on Events
document.documentElement.addEventListener(ORYX.CONFIG.EVENT_KEYDOWN, this.catchKeyDownEvents.bind(this), true);
document.documentElement.addEventListener(ORYX.CONFIG.EVENT_KEYUP, this.catchKeyUpEvents.bind(this), true);
// Enable Key up and down Event
this._keydownEnabled = true;
this._keyupEnabled = true;
this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEDOWN] = new Array();
this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEUP] = new Array();
this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEOVER] = new Array();
this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEOUT] = new Array();
this.DOMEventListeners[ORYX.CONFIG.EVENT_SELECTION_CHANGED] = new Array();
this.DOMEventListeners[ORYX.CONFIG.EVENT_MOUSEMOVE] = new Array();
},
/**
* Generate the whole viewport of the
* Editor and initialized the Ext-Framework
*
*/
_generateGUI: function() {
//TODO make the height be read from eRDF data from the canvas.
// default, a non-fullscreen editor shall define its height by layout.setHeight(int)
// Defines the layout hight if it's NOT fullscreen
var layoutHeight = 400;
var canvasParent = this.getCanvas().rootNode.parentNode;
// DEFINITION OF THE VIEWPORT AREAS
this.layout_regions = {
// DEFINES TOP-AREA
/*north : new Ext.Panel({ //TOOO make a composite of the oryx header and addable elements (for toolbar), second one should contain margins
region : 'north',
cls : 'x-panel-editor-north',
autoEl : 'div',
autoWidth: true,
border : false
}),*/
// DEFINES BOTTOM-AREA
south : new Ext.Panel({
region : 'south',
cls : 'x-panel-editor-south',
autoEl : 'div',
border : false
}),
// DEFINES LEFT-AREA
/*west : new Ext.Panel({
region : 'west',
layout : 'fit',
border : false,
autoEl : 'div',
cls : 'x-panel-editor-west',
collapsible : false,
width : ORYX.CONFIG.PANEL_LEFT_WIDTH || 60,
autoScroll:true,
cmargins: {left:0, right:0},
split : false,
header : false
}),*/
// DEFINES CENTER-AREA (FOR THE EDITOR)
center : new Ext.Panel({
id : 'oryx_center_region',
region : 'center',
cls : 'x-panel-editor-center',
border : false,
autoScroll: true,
items : {
layout : "fit",
autoHeight: true,
el : canvasParent
}
})
};
// Config for the Ext.Viewport
var layout_config = {
layout: 'border',
items: [
// north disabled
//this.layout_regions.north,
// east disabled
//this.layout_regions.east,
this.layout_regions.south,
// west disabled
//this.layout_regions.west,
this.layout_regions.center
]
};
// IF Fullscreen, use a viewport
if (this.fullscreen) {
this.layout = new Ext.Viewport( layout_config );
// IF NOT, use a panel and render it to the given id
} else {
layout_config.renderTo = this.id;
layout_config.height = layoutHeight;
this.layout = new Ext.Panel( layout_config );
}
// Set the editor to the center, and refresh the size
canvasParent.setAttributeNS(null, 'align', 'left');
canvasParent.parentNode.setAttributeNS(null, 'align', 'center');
canvasParent.parentNode.setAttributeNS(null, 'style',
"overflow: scroll;" +
"background-color: lightgrey;" +
"background: -moz-linear-gradient(center top , #7B7778, #7D797A) repeat scroll 0 0 transparent;" +
"background: -webkit-gradient(linear, left top, left bottom, from(#7B7778), to(#7D797A));"
);
this.getCanvas().setSize({
width : ORYX.CONFIG.CANVAS_WIDTH,
height : ORYX.CONFIG.CANVAS_HEIGHT
});
},
/**
* adds a component to the specified region
*
* @param {String} region
* @param {Ext.Component} component
* @param {String} title, optional
* @return {Ext.Component} dom reference to the current region or null if specified region is unknown
*/
addToRegion: function(region, component, title) {
if (region.toLowerCase && this.layout_regions[region.toLowerCase()]) {
var current_region = this.layout_regions[region.toLowerCase()];
current_region.add(component);
/*if( (region.toLowerCase() == 'east' || region.toLowerCase() == 'west') && current_region.items.length == 2){ //!current_region.getLayout() instanceof Ext.layout.Accordion ){
var layout = new Ext.layout.Accordion( current_region.layoutConfig );
current_region.setLayout( layout );
var items = current_region.items.clone();
current_region.items.each(function(item){ current_region.remove( item )})
items.each(function(item){ current_region.add( item )})
} */
ORYX.Log.debug("original dimensions of region %0: %1 x %2", current_region.region, current_region.width, current_region.height);
// update dimensions of region if required.
if (!current_region.width && component.initialConfig && component.initialConfig.width) {
ORYX.Log.debug("resizing width of region %0: %1", current_region.region, component.initialConfig.width);
current_region.setWidth(component.initialConfig.width);
}
if (component.initialConfig && component.initialConfig.height) {
ORYX.Log.debug("resizing height of region %0: %1", current_region.region, component.initialConfig.height);
var current_height = current_region.height || 0;
current_region.height = component.initialConfig.height + current_height;
current_region.setHeight(component.initialConfig.height + current_height);
}
// set title if provided as parameter.
if (typeof title == "string") {
current_region.setTitle(title);
}
// trigger doLayout() and show the pane
current_region.ownerCt.doLayout();
current_region.show();
if(Ext.isMac)
ORYX.Editor.resizeFix();
return current_region;
}
return null;
},
getAvailablePlugins: function(){
var curAvailablePlugins=ORYX.availablePlugins.clone();
curAvailablePlugins.each(function(plugin){
if(this.loadedPlugins.find(function(loadedPlugin){
return loadedPlugin.type==this.name;
}.bind(plugin))){
plugin.engaged=true;
}else{
plugin.engaged=false;
}
}.bind(this));
return curAvailablePlugins;
},
loadScript: function (url, callback){
var script = document.createElement("script");
script.type = "text/javascript";
if (script.readyState){ //IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" || script.readyState == "complete"){
script.onreadystatechange = null;
callback();
}
};
} else { //Others
script.onload = function(){
callback();
};
}
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
},
/**
* activate Plugin
*
* @param {String} name
* @param {Function} callback
* callback(sucess, [errorCode])
* errorCodes: NOTUSEINSTENCILSET, REQUIRESTENCILSET, NOTFOUND, YETACTIVATED
*/
activatePluginByName: function(name, callback, loadTry){
var match=this.getAvailablePlugins().find(function(value){return value.name==name;});
if(match && (!match.engaged || (match.engaged==='false'))){
var loadedStencilSetsNamespaces = this.getStencilSets().keys();
var facade = this._getPluginFacade();
var newPlugin;
var me=this;
ORYX.Log.debug("Initializing plugin '%0'", match.name);
if (!match.requires || !match.requires.namespaces || match.requires.namespaces.any(function(req){ return loadedStencilSetsNamespaces.indexOf(req) >= 0; }) ){
if(!match.notUsesIn || !match.notUsesIn.namespaces || !match.notUsesIn.namespaces.any(function(req){ return loadedStencilSetsNamespaces.indexOf(req) >= 0; })){
try {
var className = eval(match.name);
newPlugin = new className(facade, match);
newPlugin.type = match.name;
// If there is an GUI-Plugin, they get all Plugins-Offer-Meta-Data
if (newPlugin.registryChanged)
newPlugin.registryChanged(me.pluginsData);
// If there have an onSelection-Method it will pushed to the Editor Event-Handler
if (newPlugin.onSelectionChanged)
me.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, newPlugin.onSelectionChanged.bind(newPlugin));
this.loadedPlugins.push(newPlugin);
this.loadedPlugins.each(function(loaded){
if(loaded.registryChanged)
loaded.registryChanged(this.pluginsData);
}.bind(me));
callback(true);
} catch(e) {
ORYX.Log.warn("Plugin %0 is not available", match.name);
if(!!loadTry){
callback(false,"INITFAILED");
return;
}
this.loadScript("plugins/scripts/"+match.source, this.activatePluginByName.bind(this,match.name,callback,true));
}
}else{
callback(false,"NOTUSEINSTENCILSET");
ORYX.Log.info("Plugin need a stencilset which is not loaded'", match.name);
}
} else {
callback(false,"REQUIRESTENCILSET");
ORYX.Log.info("Plugin need a stencilset which is not loaded'", match.name);
}
}else{
callback(false, match?"NOTFOUND":"YETACTIVATED");
//TODO error handling
}
},
/**
* Laden der Plugins
*/
loadPlugins: function() {
// if there should be plugins but still are none, try again.
// TODO this should wait for every plugin respectively.
/*if (!ORYX.Plugins && ORYX.availablePlugins.length > 0) {
window.setTimeout(this.loadPlugins.bind(this), 100);
return;
}*/
var me = this;
var newPlugins = [];
var loadedStencilSetsNamespaces = this.getStencilSets().keys();
// Available Plugins will be initalize
var facade = this._getPluginFacade();
// If there is an Array where all plugins are described, than only take those
// (that comes from the usage of oryx with a mashup api)
if( ORYX.MashupAPI && ORYX.MashupAPI.loadablePlugins && ORYX.MashupAPI.loadablePlugins instanceof Array ){
// Get the plugins from the available plugins (those who are in the plugins.xml)
ORYX.availablePlugins = $A(ORYX.availablePlugins).findAll(function(value){
return ORYX.MashupAPI.loadablePlugins.include( value.name );
});
// Add those plugins to the list, which are only in the loadablePlugins list
ORYX.MashupAPI.loadablePlugins.each(function( className ){
if( !(ORYX.availablePlugins.find(function(val){ return val.name == className; }))){
ORYX.availablePlugins.push( {name: className } );
}
});
}
ORYX.availablePlugins.each(function(value) {
ORYX.Log.debug("Initializing plugin '%0'", value.name);
if( (!value.requires || !value.requires.namespaces || value.requires.namespaces.any(function(req){ return loadedStencilSetsNamespaces.indexOf(req) >= 0; }) ) &&
(!value.notUsesIn || !value.notUsesIn.namespaces || !value.notUsesIn.namespaces.any(function(req){ return loadedStencilSetsNamespaces.indexOf(req) >= 0; }) )&&
/*only load activated plugins or undefined */
(value.engaged || (value.engaged===undefined)) ){
try {
var className = eval(value.name);
if( className ){
var plugin = new className(facade, value);
plugin.type = value.name;
newPlugins.push( plugin );
plugin.engaged=true;
}
} catch(e) {
ORYX.Log.warn("Plugin %0 threw the following exception: %1", value.name, e);
ORYX.Log.warn("Plugin %0 is not available", value.name);
}
} else {
ORYX.Log.info("Plugin need a stencilset which is not loaded'", value.name);
}
});
newPlugins.each(function(value) {
// If there is an GUI-Plugin, they get all Plugins-Offer-Meta-Data
if(value.registryChanged)
value.registryChanged(me.pluginsData);
// If there have an onSelection-Method it will pushed to the Editor Event-Handler
if(value.onSelectionChanged)
me.registerOnEvent(ORYX.CONFIG.EVENT_SELECTION_CHANGED, value.onSelectionChanged.bind(value));
});
this.loadedPlugins = newPlugins;
// Hack for the Scrollbars
if(Ext.isMac) {
ORYX.Editor.resizeFix();
}
this.registerPluginsOnKeyEvents();
this.setSelection();
},
/**
* Loads the stencil set extension file, defined in ORYX.CONFIG.SS_EXTENSIONS_CONFIG
*/
_loadStencilSetExtensionConfig: function(){
// load ss extensions
new Ajax.Request(ORYX.CONFIG.SS_EXTENSIONS_CONFIG, {
method: 'GET',
asynchronous: false,
onSuccess: (function(transport) {
var jsonObject = Ext.decode(transport.responseText);
this.ss_extensions_def = jsonObject;
}).bind(this),
onFailure: (function(transport) {
ORYX.Log.error("Editor._loadStencilSetExtensionConfig: Loading stencil set extension configuration file failed." + transport);
}).bind(this)
});
},
/**
* Creates the Canvas
* @param {String} [stencilType] The stencil type used for creating the canvas. If not given, a stencil with myBeRoot = true from current stencil set is taken.
* @param {Object} [canvasConfig] Any canvas properties (like language).
*/
_createCanvas: function(stencilType, canvasConfig) {
if (stencilType) {
// Add namespace to stencilType
if (stencilType.search(/^http/) === -1) {
stencilType = this.getStencilSets().values()[0].namespace() + stencilType;
}
}
else {
// Get any root stencil type
stencilType = this.getStencilSets().values()[0].findRootStencilName();
}
// get the stencil associated with the type
var canvasStencil = ORYX.Core.StencilSet.stencil(stencilType);
if (!canvasStencil)
ORYX.Log.fatal("Initialisation failed, because the stencil with the type %0 is not part of one of the loaded stencil sets.", stencilType);
// create all dom
// TODO fix border, so the visible canvas has a double border and some spacing to the scrollbars
var div = ORYX.Editor.graft("http://www.w3.org/1999/xhtml", null, ['div']);
// set class for custom styling
div.addClassName("ORYX_Editor");
// create the canvas
this._canvas = new ORYX.Core.Canvas({
width : ORYX.CONFIG.CANVAS_WIDTH,
height : ORYX.CONFIG.CANVAS_HEIGHT,
'eventHandlerCallback' : this.handleEvents.bind(this),
id : this.id,
parentNode : div
}, canvasStencil);
if (canvasConfig) {
// Migrate canvasConfig to an RDF-like structure
//FIXME this isn't nice at all because we don't want rdf any longer
var properties = [];
for(field in canvasConfig){
properties.push({
prefix: 'oryx',
name: field,
value: canvasConfig[field]
});
}
this._canvas.deserialize(properties);
}
},
/**
* Returns a per-editor singleton plugin facade.
* To be used in plugin initialization.
*/
_getPluginFacade: function() {
// if there is no pluginfacade already created:
if(!(this._pluginFacade))
// create it.
this._pluginFacade = {
activatePluginByName: this.activatePluginByName.bind(this),
//deactivatePluginByName: this.deactivatePluginByName.bind(this),
getAvailablePlugins: this.getAvailablePlugins.bind(this),
offer: this.offer.bind(this),
getStencilSets: this.getStencilSets.bind(this),
getRules: this.getRules.bind(this),
loadStencilSet: this.loadStencilSet.bind(this),
createShape: this.createShape.bind(this),
deleteShape: this.deleteShape.bind(this),
getSelection: this.getSelection.bind(this),
setSelection: this.setSelection.bind(this),
updateSelection: this.updateSelection.bind(this),
getCanvas: this.getCanvas.bind(this),
importJSON: this.importJSON.bind(this),
importERDF: this.importERDF.bind(this),
getERDF: this.getERDF.bind(this),
getJSON: this.getJSON.bind(this),
getSerializedJSON: this.getSerializedJSON.bind(this),
executeCommands: this.executeCommands.bind(this),
rollbackCommands: this.rollbackCommands.bind(this),
registerOnEvent: this.registerOnEvent.bind(this),
unregisterOnEvent: this.unregisterOnEvent.bind(this),
raiseEvent: this.handleEvents.bind(this),
enableEvent: this.enableEvent.bind(this),
disableEvent: this.disableEvent.bind(this),
eventCoordinates: this.eventCoordinates.bind(this),
addToRegion: this.addToRegion.bind(this),
getModelMetaData: this.getModelMetaData.bind(this),
getUserId: this.getUserId.bind(this),
isDragging: this.isDragging.bind(this),
loadSerialized: this.loadSerialized.bind(this),
isReadOnlyMode: this.isReadOnlyMode.bind(this)
};
return this._pluginFacade;
},
handleUserIdChangedEvent: function handleUserIdChangedEvent(event) {
this.userId = event.userId;
},
getUserId: function getUserId() {
return this.userId;
},
isDragging: function isDragging() {
return this.dragging;
},
/**
* Sets the editor in read only mode: Edges/ dockers cannot be moved anymore,
* shapes cannot be selected anymore.
* @methodOf ORYX.Plugins.AbstractPlugin.prototype
*/
_stopSelectionChange: function() {
if (this.isReadOnlyMode() && this.getSelection().length > 0) {
this.setSelection([], undefined, undefined, true);
}
},
enableReadOnlyMode: function() {
if (!this.readOnlyMode) {
//Edges cannot be moved anymore
this.disableEvent(ORYX.CONFIG.EVENT_MOUSEDOWN);
this.disableEvent(ORYX.CONFIG.EVENT_MOUSEOVER);
this.disableEvent(ORYX.CONFIG.EVENT_DBLCLICK);
this.disableEvent(ORYX.CONFIG.EVENT_LABEL_DBLCLICK);
this.setSelection([], undefined, undefined, true);
}
this.readOnlyMode = true;
},
/**
* Disables read only mode, see @see
* @methodOf ORYX.Plugins.AbstractPlugin.prototype
* @see ORYX.Plugins.AbstractPlugin.prototype.enableReadOnlyMode
*/
disableReadOnlyMode: function() {
if (this.readOnlyMode) {
// Edges can be moved now again
this.enableEvent(ORYX.CONFIG.EVENT_MOUSEDOWN);
this.enableEvent(ORYX.CONFIG.EVENT_MOUSEOVER);
this.enableEvent(ORYX.CONFIG.EVENT_DBLCLICK);
this.enableEvent(ORYX.CONFIG.EVENT_LABEL_DBLCLICK);
}
this.readOnlyMode = false;
},
isReadOnlyMode: function isReadOnlyMode() {
return this.readOnlyMode;
},
/**
* Implementes the command pattern
* (The real usage of the command pattern
* is implemented and shown in the Plugins/undo.js)
*
* @param <Oryx.Core.Command>[] Array of commands
*/
executeCommands: function executeCommands(commands) {
// Check if the argument is an array and the elements are from command-class
if (commands instanceof Array &&
commands.length > 0 &&
commands.all(function(command) {
return command instanceof ORYX.Core.AbstractCommand;
})) {
// Raise event for executing commands
this.handleEvents({
type: ORYX.CONFIG.EVENT_EXECUTE_COMMANDS,
commands: commands,
forceExecution: true
});
// Execute every command
commands.each(function(command) {
command.execute();
});
this.handleEvents({
type: ORYX.CONFIG.EVENT_AFTER_COMMANDS_EXECUTED,
commands: commands,
forceExecution: true
});
}
},
rollbackCommands: function rollbackCommands(commands) {
// Check if the argument is an array and the elements are from command-class
if (commands instanceof Array &&
commands.length > 0 &&
commands.all(function(command) {
return command instanceof ORYX.Core.AbstractCommand;
})) {
// Rollback every command
commands.each(function(command) {
command.rollback();
});
// Raise event for rollbacking commands
this.handleEvents({
type: ORYX.CONFIG.EVENT_AFTER_COMMANDS_ROLLBACK,
commands: commands,
forceExecution: true
});
}
},
/**
* Returns JSON of underlying canvas (calls ORYX.Canvas#toJSON()).
* @return {Object} Returns JSON representation as JSON object.
*/
getJSON: function(){
var canvas = this.getCanvas().toJSON();
canvas.ssextensions = this.getStencilSets().values()[0].extensions().keys();
return canvas;
},
/**
* Serializes a call to toJSON().
* @return {String} Returns JSON representation as string.
*/
getSerializedJSON: function(){
return Ext.encode(this.getJSON());
},
/**
* @return {String} Returns eRDF representation.
* @deprecated Use ORYX.Editor#getJSON instead, if possible.
*/
getERDF:function(){
// Get the serialized dom
var serializedDOM = DataManager.serializeDOM( this._getPluginFacade() );
// Add xml definition if there is no
serializedDOM = '<?xml version="1.0" encoding="utf-8"?>' +
'<html xmlns="http://www.w3.org/1999/xhtml" ' +
'xmlns:b3mn="http://b3mn.org/2007/b3mn" ' +
'xmlns:ext="http://b3mn.org/2007/ext" ' +
'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ' +
'xmlns:atom="http://b3mn.org/2007/atom+xhtml">' +
'<head profile="http://purl.org/NET/erdf/profile">' +
'<link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />' +
'<link rel="schema.dcTerms" href="http://purl.org/dc/terms/ " />' +
'<link rel="schema.b3mn" href="http://b3mn.org" />' +
'<link rel="schema.oryx" href="http://oryx-editor.org/" />' +
'<link rel="schema.raziel" href="http://raziel.org/" />' +
'<base href="' +
location.href.split("?")[0] +
'" />' +
'</head><body>' +
serializedDOM +
'</body></html>';
return serializedDOM;
},
/**
* Imports shapes in JSON as expected by {@link ORYX.Editor#loadSerialized}
* @param {Object|String} jsonObject The (serialized) json object to be imported
* @param {boolean } [noSelectionAfterImport=false] Set to true if no shapes should be selected after import
* @throws {SyntaxError} If the serialized json object contains syntax errors
*/
importJSON: function(jsonObject, noSelectionAfterImport) {
try {
jsonObject = this.renewResourceIds(jsonObject);
} catch(error){
throw error;
}
//check, if the imported json model can be loaded in this editor
// (stencil set has to fit)
if(jsonObject.stencilset.namespace && jsonObject.stencilset.namespace !== this.getCanvas().getStencil().stencilSet().namespace()) {
Ext.Msg.alert(ORYX.I18N.JSONImport.title, String.format(ORYX.I18N.JSONImport.wrongSS, jsonObject.stencilset.namespace, this.getCanvas().getStencil().stencilSet().namespace()));
return null;
} else {
var command = new ORYX.Core.Commands["Main.JsonImport"](jsonObject,
this.loadSerialized.bind(this),
noSelectionAfterImport,
this._getPluginFacade());
this.executeCommands([command]);
return command.shapes.clone();
}
},
/**
* This method renew all resource Ids and according references.
* Warning: The implementation performs a substitution on the serialized object for
* easier implementation. This results in a low performance which is acceptable if this
* is only used when importing models.
* @param {Object|String} jsonObject
* @throws {SyntaxError} If the serialized json object contains syntax errors.
* @return {Object} The jsonObject with renewed ids.
* @private
*/
renewResourceIds: function(jsonObject){
// For renewing resource ids, a serialized and object version is needed
var serJsonObject;
if(Ext.type(jsonObject) === "string"){
try {
serJsonObject = jsonObject;
jsonObject = Ext.decode(jsonObject);
} catch(error){
throw new SyntaxError(error.message);
}
} else {
serJsonObject = Ext.encode(jsonObject);
}
// collect all resourceIds recursively
var collectResourceIds = function(shapes){
if(!shapes) return [];
return shapes.map(function(shape){
var ids = shape.dockers.map(function(docker) {
return docker.id;
});
ids.push(shape.resourceId);
return collectResourceIds(shape.childShapes).concat(ids);
}).flatten();
};
var resourceIds = collectResourceIds(jsonObject.childShapes);
// Replace each resource id by a new one
resourceIds.each(function(oldResourceId){
var newResourceId = ORYX.Editor.provideId();
serJsonObject = serJsonObject.gsub('"'+oldResourceId+'"', '"'+newResourceId+'"');
});
return Ext.decode(serJsonObject);
},
/**
* Import erdf structure to the editor
*
*/
importERDF: function( erdfDOM ){
var serialized = this.parseToSerializeObjects( erdfDOM );
if(serialized)
return this.importJSON(serialized, true);
},
/**
* Parses one model (eRDF) to the serialized form (JSON)
*
* @param {Object} oneProcessData
* @return {Object} The JSON form of given eRDF model, or null if it couldn't be extracted
*/
parseToSerializeObjects: function( oneProcessData ){
// Firefox splits a long text node into chunks of 4096 characters.
// To prevent truncation of long property values the normalize method must be called
if(oneProcessData.normalize) oneProcessData.normalize();
var serialized_rdf;
try {
var xsl = "";
var source=ORYX.PATH + "lib/extract-rdf.xsl";
new Ajax.Request(source, {
asynchronous: false,
method: 'get',
onSuccess: function(transport){
xsl = transport.responseText;
}.bind(this),
onFailure: (function(transport){
ORYX.Log.error("XSL load failed" + transport);
}).bind(this)
});
var domParser = new DOMParser();
var xmlObject = oneProcessData;
var xslObject = domParser.parseFromString(xsl, "text/xml");
var xsltProcessor = new XSLTProcessor();
var xslRef = document.implementation.createDocument("", "", null);
xsltProcessor.importStylesheet(xslObject);
var new_rdf = xsltProcessor.transformToFragment(xmlObject, document);
serialized_rdf = (new XMLSerializer()).serializeToString(new_rdf);
}catch(e){
Ext.Msg.alert("Oryx", error);
serialized_rdf = "";
}
// Firefox 2 to 3 problem?!
serialized_rdf = !serialized_rdf.startsWith("<?xml") ? "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + serialized_rdf : serialized_rdf;
var req = new Ajax.Request(ORYX.CONFIG.ROOT_PATH+"rdf2json", {
method: 'POST',
asynchronous: false,
onSuccess: function(transport) {
Ext.decode(transport.responseText);
},
parameters: {
rdf: serialized_rdf
}
});
return Ext.decode(req.transport.responseText);
},
/**
* Loads serialized model to the oryx.
* @example
* editor.loadSerialized({
* resourceId: "mymodel1",
* childShapes: [
* {
* stencil:{ id:"Subprocess" },
* outgoing:[{resourceId: 'aShape'}],
* target: {resourceId: 'aShape'},
* bounds:{ lowerRight:{ y:510, x:633 }, upperLeft:{ y:146, x:210 } },
* resourceId: "myshape1",
* childShapes:[],
* properties:{},
* }
* ],
* properties:{
* language: "English"
* },
* stencilset:{
* url:"http://localhost:8080/oryx/stencilsets/bpmn1.1/bpmn1.1.json"
* },
* stencil:{
* id:"BPMNDiagram"
* }
* });
* @param {Object} model Description of the model to load.
* @param {Array} [model.ssextensions] List of stenctil set extensions.
* @param {String} model.stencilset.url
* @param {String} model.stencil.id
* @param {Array} model.childShapes
* @param {Array} [model.properties]
* @param {String} model.resourceId
* @return {ORYX.Core.Shape[]} List of created shapes
* @methodOf ORYX.Editor.prototype
*/
loadSerialized: function( model ){
var canvas = this.getCanvas();
// Bugfix (cf. http://code.google.com/p/oryx-editor/issues/detail?id=240)
// Deserialize the canvas' stencil set extensions properties first!
this.loadSSExtensions(model.ssextensions);
var shapes = this.getCanvas().addShapeObjects(model.childShapes, this.handleEvents.bind(this));
if(model.properties) {
for(key in model.properties) {
var prop = model.properties[key];
if (!(typeof prop === "string")) {
prop = Ext.encode(prop);
}
this.getCanvas().setProperty("oryx-" + key, prop);
}
}
this.getCanvas().updateSize();
return shapes;
},
/**
* Calls ORYX.Editor.prototype.ss_extension_namespace for each element
* @param {Array} ss_extension_namespaces An array of stencil set extension namespaces.
*/
loadSSExtensions: function(ss_extension_namespaces){
if(!ss_extension_namespaces) return;
ss_extension_namespaces.each(function(ss_extension_namespace){
this.loadSSExtension(ss_extension_namespace);
}.bind(this));
},
/**
* Loads a stencil set extension.
* The stencil set extensions definiton file must already
* be loaded when the editor is initialized.
*/
loadSSExtension: function(ss_extension_namespace) {
if (this.ss_extensions_def) {
var extension = this.ss_extensions_def.extensions.find(function(ex){
return (ex.namespace == ss_extension_namespace);
});
if (!extension) {
return;
}
var stencilset = this.getStencilSets()[extension["extends"]];
if (!stencilset) {
return;
}
stencilset.addExtension(ORYX.CONFIG.SS_EXTENSIONS_FOLDER + extension["definition"]);
//stencilset.addExtension("/oryx/build/stencilsets/extensions/" + extension["definition"])
this.getRules().initializeRules(stencilset);
this._getPluginFacade().raiseEvent({
type: ORYX.CONFIG.EVENT_STENCIL_SET_LOADED
});
}
},
disableEvent: function(eventType){
if(eventType == ORYX.CONFIG.EVENT_KEYDOWN) {
this._keydownEnabled = false;
}
if(eventType == ORYX.CONFIG.EVENT_KEYUP) {
this._keyupEnabled = false;
}
if(this.DOMEventListeners.keys().member(eventType)) {
var value = this.DOMEventListeners.remove(eventType);
this.DOMEventListeners['disable_' + eventType] = value;
}
},
enableEvent: function(eventType){
if(eventType == ORYX.CONFIG.EVENT_KEYDOWN) {
this._keydownEnabled = true;
}
if(eventType == ORYX.CONFIG.EVENT_KEYUP) {
this._keyupEnabled = true;
}
if(this.DOMEventListeners.keys().member("disable_" + eventType)) {
var value = this.DOMEventListeners.remove("disable_" + eventType);
this.DOMEventListeners[eventType] = value;
}
},
/**
* Methods for the PluginFacade
*/
registerOnEvent: function(eventType, callback) {
if(!(this.DOMEventListeners.keys().member(eventType))) {
this.DOMEventListeners[eventType] = [];
}
this.DOMEventListeners[eventType].push(callback);
},
unregisterOnEvent: function(eventType, callback) {
if(this.DOMEventListeners.keys().member(eventType)) {
this.DOMEventListeners[eventType] = this.DOMEventListeners[eventType].without(callback);
} else {
// Event is not supported
// TODO: Error Handling
}
},
getSelection: function() {
return this.selection;
},
getStencilSets: function() {
return ORYX.Core.StencilSet.stencilSets(this.id);
},
getRules: function() {
return ORYX.Core.StencilSet.rules(this.id);
},
loadStencilSet: function(source) {
try {
ORYX.Core.StencilSet.loadStencilSet(source, this.id);
this.handleEvents({type:ORYX.CONFIG.EVENT_STENCIL_SET_LOADED});
} catch (e) {
ORYX.Log.warn("Requesting stencil set file failed. (" + e + ")");
}
},
offer: function(pluginData) {
if(!this.pluginsData.member(pluginData)){
this.pluginsData.push(pluginData);
}
},
/**
* It creates an new event or adds the callback, if already existing,
* for the key combination that the plugin passes in keyCodes attribute
* of the offer method.
*
* The new key down event fits the schema:
* key.event[.metactrl][.alt][.shift].'thekeyCode'
*/
registerPluginsOnKeyEvents: function() {
this.pluginsData.each(function(pluginData) {
if(pluginData.keyCodes) {
pluginData.keyCodes.each(function(keyComb) {
var eventName = "key.event";
/* Include key action */
eventName += '.' + keyComb.keyAction;
if(keyComb.metaKeys) {
/* Register on ctrl or apple meta key as meta key */
if(keyComb.metaKeys.
indexOf(ORYX.CONFIG.META_KEY_META_CTRL) > -1) {
eventName += "." + ORYX.CONFIG.META_KEY_META_CTRL;
}
/* Register on alt key as meta key */
if(keyComb.metaKeys.
indexOf(ORYX.CONFIG.META_KEY_ALT) > -1) {
eventName += '.' + ORYX.CONFIG.META_KEY_ALT;
}
/* Register on shift key as meta key */
if(keyComb.metaKeys.
indexOf(ORYX.CONFIG.META_KEY_SHIFT) > -1) {
eventName += '.' + ORYX.CONFIG.META_KEY_SHIFT;
}
}
/* Register on the actual key */
if(keyComb.keyCode) {
eventName += '.' + keyComb.keyCode;
}
/* Register the event */
ORYX.Log.debug("Register Plugin on Key Event: %0", eventName);
this.registerOnEvent(eventName, function(event) {
if (typeof pluginData.isEnabled === "undefined" ||
pluginData.isEnabled()) {
pluginData.functionality(event);
}
});
}.bind(this));
}
}.bind(this));
},
setSelection: function(elements, subSelectionElement, force, isLocal) {
if (!elements) { elements = []; }
elements = elements.compact().findAll(function(n){ return n instanceof ORYX.Core.Shape; });
if (elements.first() instanceof ORYX.Core.Canvas) {
elements = [];
}
// this leads to behaviour where you change a property of the canvas, but cannot accept the change by clicking on the canvas
/*if (!force && elements.length === this.selection.length && this.selection.all(function(r){ return elements.include(r); })){
return;
}*/
this.selection = elements;
this._subSelection = subSelectionElement;
this.handleEvents({type: ORYX.CONFIG.EVENT_SELECTION_CHANGED,
elements: elements,
subSelection: subSelectionElement,
isLocal: isLocal});
},
updateSelection: function updateSelection(isLocal) {
if (!this.dragging || isLocal) {
this.setSelection(this.selection, this._subSelection, true, isLocal);
}
},
getCanvas: function() {
return this._canvas;
},
/**
* option = {
* type: string,
* position: {x:int, y:int},
* connectingType: uiObj-Class
* connectedShape: uiObj
* draggin: bool
* namespace: url
* parent: ORYX.Core.AbstractShape
* template: a template shape that the newly created inherits properties from.
* }
*/
createShape: function(option) {
var shouldUpdateSelection = true;
var newShapeOptions = {'eventHandlerCallback':this.handleEvents.bind(this)};
if(typeof(option.shapeOptions) !== 'undefined'
&& typeof(option.shapeOptions.id) !== 'undefined'
&& typeof(option.shapeOptions.resourceId) !== 'undefined') {
// The wave plugin passes an id and resourceId so these are the same on all wave participants.
newShapeOptions.id = option.shapeOptions.id;
newShapeOptions.resourceId = option.shapeOptions.resourceId;
shouldUpdateSelection = false;
}
var newShapeObject;
if (option && option.serialize && option.serialize instanceof Array) {
var type = option.serialize.find(function(obj){return (obj.prefix+"-"+obj.name) == "oryx-type";});
var stencil = ORYX.Core.StencilSet.stencil(type.value);
newShapeObject = (stencil.type() == 'node')
? new ORYX.Core.Node(newShapeOptions, stencil)
: new ORYX.Core.Edge(newShapeOptions, stencil);
this.getCanvas().add(newShapeObject);
newShapeObject.deserialize(option.serialize);
return newShapeObject;
}
// If there is no argument, throw an exception
if (!option || !option.type || !option.namespace) { throw "To create a new shape you have to give an argument with type and namespace";}
var canvas = this.getCanvas();
// Get the shape type
var shapetype = option.type;
// Get the stencil set
var sset = ORYX.Core.StencilSet.stencilSet(option.namespace);
// Create an New Shape, dependents on an Edge or a Node
if(sset.stencil(shapetype).type() == "node") {
newShapeObject = new ORYX.Core.Node(newShapeOptions, sset.stencil(shapetype));
} else {
newShapeObject = new ORYX.Core.Edge(newShapeOptions, sset.stencil(shapetype));
}
// when there is a template, inherit the properties.
if(option.template) {
newShapeObject._jsonStencil.properties = option.template._jsonStencil.properties;
newShapeObject.postProcessProperties();
}
// Add to the canvas
if(option.parent && newShapeObject instanceof ORYX.Core.Node) {
option.parent.add(newShapeObject);
} else {
canvas.add(newShapeObject);
}
// Set the position
var point = option.position ? option.position : {x:100, y:200};
var con;
// If there is create a shape and in the argument there is given an ConnectingType and is instance of an edge
if(option.connectingType && option.connectedShape && !(newShapeObject instanceof ORYX.Core.Edge)) {
/**
* The resourceId of the connecting edge should be inferable from the resourceId of the node for Wave
* serialization. If the command was received remotely, id and resourceId for newShapeObject were passed in the
* options. If the command has been created locally, id and resourceId for newShapeObject will be serialized
* with the command.
*/
newShapeOptions.id = newShapeObject.id + "_edge";
newShapeOptions.resourceId = newShapeObject.resourceId + "_edge";
con = new ORYX.Core.Edge(newShapeOptions, sset.stencil(option.connectingType));
// And both endings dockers will be referenced to the both shapes
con.dockers.first().setDockedShape(option.connectedShape);
var magnet = option.connectedShape.getDefaultMagnet();
var cPoint = magnet ? magnet.bounds.center() : option.connectedShape.bounds.midPoint();
con.dockers.first().setReferencePoint( cPoint );
con.dockers.last().setDockedShape(newShapeObject);
con.dockers.last().setReferencePoint(newShapeObject.getDefaultMagnet().bounds.center());
// The Edge will be added to the canvas and be updated
canvas.add(con);
//con.update();
}
// Move the new Shape to the position
if(newShapeObject instanceof ORYX.Core.Edge && option.connectedShape) {
newShapeObject.dockers.first().setDockedShape(option.connectedShape);
if( option.connectedShape instanceof ORYX.Core.Node ){
newShapeObject.dockers.first().setReferencePoint(option.connectedShape.getDefaultMagnet().bounds.center());
newShapeObject.dockers.last().bounds.centerMoveTo(point);
} else {
newShapeObject.dockers.first().setReferencePoint(option.connectedShape.bounds.midPoint());
}
} else {
var b = newShapeObject.bounds;
if( newShapeObject instanceof ORYX.Core.Node && newShapeObject.dockers.length == 1){
b = newShapeObject.dockers.first().bounds;
}
b.centerMoveTo(point);
var upL = b.upperLeft();
b.moveBy( -Math.min(upL.x, 0) , -Math.min(upL.y, 0) );
var lwR = b.lowerRight();
b.moveBy( -Math.max(lwR.x-canvas.bounds.width(), 0) , -Math.max(lwR.y-canvas.bounds.height(), 0) );
}
// Update the shape
if (newShapeObject instanceof ORYX.Core.Edge) {
newShapeObject._update(false);
}
// And refresh the selection if the command was not created by a remote Wave client
if(!(newShapeObject instanceof ORYX.Core.Edge) && shouldUpdateSelection) {
this.setSelection([newShapeObject]);
}
if(con && con.alignDockers) {
con.alignDockers();
}
if(newShapeObject.alignDockers) {
newShapeObject.alignDockers();
}
return newShapeObject;
},
deleteShape: function(shape) {
if (!shape || !shape.parent) {
return;
}
//remove shape from parent
// this also removes it from DOM
shape.parent.remove(shape);
//delete references to outgoing edges
shape.getOutgoingShapes().each(function(os) {
var docker = os.getDockers().first();
if(docker && docker.getDockedShape() == shape) {
docker.setDockedShape(undefined);
}
});
//delete references to incoming edges
shape.getIncomingShapes().each(function(is) {
var docker = is.getDockers().last();
if(docker && docker.getDockedShape() == shape) {
docker.setDockedShape(undefined);
}
});
//delete references of the shape's dockers
shape.getDockers().each(function(docker) {
docker.setDockedShape(undefined);
});
},
/**
* Returns an object with meta data about the model.
* Like name, description, ...
*
* Empty object with the current backend.
*
* @return {Object} Meta data about the model
*/
getModelMetaData: function() {
return this.modelMetaData;
},
/* Event-Handler Methods */
/**
* Helper method to execute an event immediately. The event is not
* scheduled in the _eventsQueue. Needed to handle Layout-Callbacks.
*/
_executeEventImmediately: function(eventObj) {
if(this.DOMEventListeners.keys().member(eventObj.event.type)) {
this.DOMEventListeners[eventObj.event.type].each((function(value) {
value(eventObj.event, eventObj.arg);
}).bind(this));
}
},
_executeEvents: function() {
this._queueRunning = true;
while(this._eventsQueue.length > 0) {
var val = this._eventsQueue.shift();
this._executeEventImmediately(val);
}
this._queueRunning = false;
},
/**
* Leitet die Events an die Editor-Spezifischen Event-Methoden weiter
* @param {Object} event Event , welches gefeuert wurde
* @param {Object} uiObj Target-UiObj
*/
handleEvents: function(event, uiObj) {
ORYX.Log.trace("Dispatching event type %0 on %1", event.type, uiObj);
switch(event.type) {
case ORYX.CONFIG.EVENT_MOUSEDOWN:
this._handleMouseDown(event, uiObj);
break;
case ORYX.CONFIG.EVENT_MOUSEMOVE:
this._handleMouseMove(event, uiObj);
break;
case ORYX.CONFIG.EVENT_MOUSEUP:
this._handleMouseUp(event, uiObj);
break;
case ORYX.CONFIG.EVENT_MOUSEOVER:
this._handleMouseHover(event, uiObj);
break;
case ORYX.CONFIG.EVENT_MOUSEOUT:
this._handleMouseOut(event, uiObj);
break;
}
/* Force execution if necessary. Used while handle Layout-Callbacks. */
if(event.forceExecution) {
this._executeEventImmediately({event: event, arg: uiObj});
} else {
this._eventsQueue.push({event: event, arg: uiObj});
}
if(!this._queueRunning) {
this._executeEvents();
}
// TODO: Make this return whether no listener returned false.
// So that, when one considers bubbling undesireable, it won't happen.
return false;
},
catchKeyUpEvents: function(event) {
if(!this._keyupEnabled) {
return;
}
/* assure we have the current event. */
if (!event)
event = window.event;
// Checks if the event comes from some input field
if ( ["INPUT", "TEXTAREA"].include(event.target.tagName.toUpperCase()) ){
return;
}
/* Create key up event type */
var keyUpEvent = this.createKeyCombEvent(event, ORYX.CONFIG.KEY_ACTION_UP);
ORYX.Log.debug("Key Event to handle: %0", keyUpEvent);
/* forward to dispatching. */
this.handleEvents({type: keyUpEvent, event:event});
},
/**
* Catches all key down events and forward the appropriated event to
* dispatching concerning to the pressed keys.
*
* @param {Event}
* The key down event to handle
*/
catchKeyDownEvents: function(event) {
if(!this._keydownEnabled) {
return;
}
/* Assure we have the current event. */
if (!event)
event = window.event;
/* Fixed in FF3 */
// This is a mac-specific fix. The mozilla event object has no knowledge
// of meta key modifier on osx, however, it is needed for certain
// shortcuts. This fix adds the metaKey field to the event object, so
// that all listeners that registered per Oryx plugin facade profit from
// this. The original bug is filed in
// https://bugzilla.mozilla.org/show_bug.cgi?id=418334
//if (this.__currentKey == ORYX.CONFIG.KEY_CODE_META) {
// event.appleMetaKey = true;
//}
//this.__currentKey = pressedKey;
// Checks if the event comes from some input field
if ( ["INPUT", "TEXTAREA"].include(event.target.tagName.toUpperCase()) ){
return;
}
/* Create key up event type */
var keyDownEvent = this.createKeyCombEvent(event, ORYX.CONFIG.KEY_ACTION_DOWN);
ORYX.Log.debug("Key Event to handle: %0", keyDownEvent);
/* Forward to dispatching. */
this.handleEvents({type: keyDownEvent,event: event});
},
/**
* Creates the event type name concerning to the pressed keys.
*
* @param {Event} keyDownEvent
* The source keyDownEvent to build up the event name
*/
createKeyCombEvent: function(keyEvent, keyAction) {
/* Get the currently pressed key code. */
var pressedKey = keyEvent.which || keyEvent.keyCode;
//this.__currentKey = pressedKey;
/* Event name */
var eventName = "key.event";
/* Key action */
if(keyAction) {
eventName += "." + keyAction;
}
/* Ctrl or apple meta key is pressed */
if(keyEvent.ctrlKey || keyEvent.metaKey) {
eventName += "." + ORYX.CONFIG.META_KEY_META_CTRL;
}
/* Alt key is pressed */
if(keyEvent.altKey) {
eventName += "." + ORYX.CONFIG.META_KEY_ALT;
}
/* Alt key is pressed */
if(keyEvent.shiftKey) {
eventName += "." + ORYX.CONFIG.META_KEY_SHIFT;
}
/* Return the composed event name */
return eventName + "." + pressedKey;
},
_handleMouseDown: function(event, uiObj) {
// find the shape that is responsible for this element's id.
var element = event.currentTarget;
var elementController = uiObj;
// the element that currently holds focus should lose it
window.focus();
// gather information on selection.
var currentIsSelectable = (elementController !== null) &&
(elementController !== undefined) && (elementController.isSelectable);
var currentIsMovable = (elementController !== null) &&
(elementController !== undefined) && (elementController.isMovable);
var modifierKeyPressed = event.shiftKey || event.ctrlKey;
var noObjectsSelected = this.selection.length === 0;
var currentIsSelected = this.selection.member(elementController);
// Rule #1: When there is nothing selected, select the clicked object.
var newSelection;
if(currentIsSelectable && noObjectsSelected) {
this.setSelection([elementController], undefined, undefined, true);
ORYX.Log.trace("Rule #1 applied for mouse down on %0", element.id);
// Rule #3: When at least one element is selected, and there is no
// control key pressed, and the clicked object is not selected, select
// the clicked object.
} else if(currentIsSelectable && !noObjectsSelected && !modifierKeyPressed && !currentIsSelected) {
this.setSelection([elementController], undefined, undefined, true);
//var objectType = elementController.readAttributes();
//alert(objectType[0] + ": " + objectType[1]);
ORYX.Log.trace("Rule #3 applied for mouse down on %0", element.id);
// Rule #4: When the control key is pressed, and the current object is
// not selected, add it to the selection.
} else if(currentIsSelectable && modifierKeyPressed && !currentIsSelected) {
newSelection = this.selection.clone();
newSelection.push(elementController);
this.setSelection(newSelection, undefined, undefined, true);
ORYX.Log.trace("Rule #4 applied for mouse down on %0", element.id);
// Rule #6
} else if(currentIsSelectable && currentIsSelected && modifierKeyPressed) {
newSelection = this.selection.clone();
this.setSelection(newSelection.without(elementController), undefined, undefined, true);
ORYX.Log.trace("Rule #6 applied for mouse down on %0", elementController.id);
// Rule #5: When there is at least one object selected and no control
// key pressed, we're dragging.
/*} else if(currentIsSelectable && !noObjectsSelected
&& !modifierKeyPressed) {
if(this.log.isTraceEnabled())
this.log.trace("Rule #5 applied for mouse down on "+element.id);
*/
// Rule #2: When clicked on something that is neither
// selectable nor movable, clear the selection, and return.
} else if (!currentIsSelectable && !currentIsMovable) {
this.setSelection([], undefined, undefined, true);
ORYX.Log.trace("Rule #2 applied for mouse down on %0", element.id);
return;
// Rule #7: When the current object is not selectable but movable,
// it is probably a control. Leave the selection unchanged but set
// the movedObject to the current one and enable Drag. Dockers will
// be processed in the dragDocker plugin.
} else if(!currentIsSelectable && currentIsMovable && !(elementController instanceof ORYX.Core.Controls.Docker)) {
// TODO: If there is any moveable elements, do this in a plugin
//ORYX.Core.UIEnableDrag(event, elementController);
ORYX.Log.trace("Rule #7 applied for mouse down on %0", element.id);
// Rule #8: When the element is selectable and is currently selected and no
// modifier key is pressed
} else if(currentIsSelectable && currentIsSelected && !modifierKeyPressed) {
this._subSelection = this._subSelection != elementController ? elementController : undefined;
this.setSelection(this.selection, this._subSelection, undefined, true);
ORYX.Log.trace("Rule #8 applied for mouse down on %0", element.id);
}
// prevent event from bubbling, return.
//Event.stop(event);
return;
},
_handleMouseMove: function(event, uiObj) {
return;
},
_handleMouseUp: function(event, uiObj) {
// get canvas.
var canvas = this.getCanvas();
// find the shape that is responsible for this elemement's id.
var elementController = uiObj;
//get event position
var evPos = this.eventCoordinates(event);
//Event.stop(event);
},
_handleMouseHover: function(event, uiObj) {
return;
},
_handleMouseOut: function(event, uiObj) {
return;
},
/**
* Calculates the event coordinates to SVG document coordinates.
* @param {Event} event
* @return {SVGPoint} The event coordinates in the SVG document
*/
eventCoordinates: function(event) {
var canvas = this.getCanvas();
var svgPoint = canvas.node.ownerSVGElement.createSVGPoint();
svgPoint.x = event.clientX;
svgPoint.y = event.clientY;
var matrix = canvas.node.getScreenCTM();
return svgPoint.matrixTransform(matrix.inverse());
},
/**
* Toggle read only/edit mode when the Blip changes from/to edit mode.
*/
changeMode: function changeMode(event) {
this.layout.doLayout();
if (event.mode.isEditMode() && !event.mode.isPaintMode()) {
this.disableReadOnlyMode();
} else {
this.enableReadOnlyMode();
}
}
};
ORYX.Editor = Clazz.extend(ORYX.Editor);
/**
* Creates a new ORYX.Editor instance by fetching a model from given url and passing it to the constructur
* @param {String} modelUrl The JSON URL of a model.
* @param {Object} config Editor config passed to the constructur, merged with the response of the request to modelUrl
*/
ORYX.Editor.createByUrl = function(modelUrl, config){
if(!config) config = {};
new Ajax.Request(modelUrl, {
method: 'GET',
onSuccess: function(transport) {
var editorConfig = Ext.decode(transport.responseText);
editorConfig = Ext.applyIf(editorConfig, config);
new ORYX.Editor(editorConfig);
}.bind(this)
});
};
// TODO Implement namespace awareness on attribute level.
/**
* graft() function
* Originally by Sean M. Burke from interglacial.com, altered for usage with
* SVG and namespace (xmlns) support. Be sure you understand xmlns before
* using this funtion, as it creates all grafted elements in the xmlns
* provided by you and all element's attribures in default xmlns. If you
* need to graft elements in a certain xmlns and wish to assign attributes
* in both that and another xmlns, you will need to do stepwise grafting,
* adding non-default attributes yourself or you'll have to enhance this
* function. Latter, I would appreciate: martin�apfelfabrik.de
* @param {Object} namespace The namespace in which
* elements should be grafted.
* @param {Object} parent The element that should contain the grafted
* structure after the function returned.
* @param {Object} t the crafting structure.
* @param {Object} doc the document in which grafting is performed.
*/
ORYX.Editor.graft = function(namespace, parent, t, doc) {
doc = (doc || (parent && parent.ownerDocument) || document);
var e;
if(t === undefined) {
throw "Can't graft an undefined value";
} else if(t.constructor == String) {
e = doc.createTextNode( t );
} else {
for(var i = 0; i < t.length; i++) {
if( i === 0 && t[i].constructor == String ) {
var snared;
snared = t[i].match( /^([a-z][a-z0-9]*)\.([^\s\.]+)$/i );
if( snared ) {
e = doc.createElementNS(namespace, snared[1] );
e.setAttributeNS(null, 'class', snared[2] );
continue;
}
snared = t[i].match( /^([a-z][a-z0-9]*)$/i );
if( snared ) {
e = doc.createElementNS(namespace, snared[1] ); // but no class
continue;
}
// Otherwise:
e = doc.createElementNS(namespace, "span" );
e.setAttribute(null, "class", "namelessFromLOL" );
}
if( t[i] === undefined ) {
throw "Can't graft an undefined value in a list!";
} else if( t[i].constructor == String || t[i].constructor == Array ) {
this.graft(namespace, e, t[i], doc );
} else if( t[i].constructor == Number ) {
this.graft(namespace, e, t[i].toString(), doc );
} else if( t[i].constructor == Object ) {
// hash's properties => element's attributes
for(var k in t[i]) { e.setAttributeNS(null, k, t[i][k] ); }
} else {
}
}
}
if(parent) {
parent.appendChild( e );
} else {
}
return e; // return the topmost created node
};
ORYX.Editor.provideId = function() {
var i;
var res = [], hex = '0123456789ABCDEF';
for (i = 0; i < 36; i++) res[i] = Math.floor(Math.random()*0x10);
res[14] = 4;
res[19] = (res[19] & 0x3) | 0x8;
for (i = 0; i < 36; i++) res[i] = hex[res[i]];
res[8] = res[13] = res[18] = res[23] = '-';
return "oryx_" + res.join('');
};
/**
* When working with Ext, conditionally the window needs to be resized. To do
* so, use this class method. Resize is deferred until 100ms, and all subsequent
* resizeBugFix calls are ignored until the initially requested resize is
* performed.
*/
ORYX.Editor.resizeFix = function() {
if (!ORYX.Editor._resizeFixTimeout) {
ORYX.Editor._resizeFixTimeout = window.setTimeout(function() {
window.resizeBy(1,1);
window.resizeBy(-1,-1);
ORYX.Editor._resizefixTimeout = null;
}, 100);
}
};
ORYX.Editor.Cookie = {
callbacks:[],
onChange: function( callback, interval ) {
this.callbacks.push(callback);
this.start( interval );
},
start: function( interval ){
if( this.pe ){
return;
}
var currentString = document.cookie;
this.pe = new PeriodicalExecuter(function(){
if( currentString != document.cookie ){
currentString = document.cookie;
this.callbacks.each(function(callback){ callback(this.getParams()); }.bind(this));
}
}.bind(this), ( interval || 10000 ) / 1000);
},
stop: function(){
if( this.pe ){
this.pe.stop();
this.pe = null;
}
},
getParams: function(){
var res = {};
var p = document.cookie;
p.split("; ").each(function(param){ res[param.split("=")[0]] = param.split("=")[1];});
return res;
},
toString: function(){
return document.cookie;
}
};
/**
* Workaround for SAFARI/Webkit, because
* when trying to check SVGSVGElement of instanceof there is
* raising an error
*
*/
ORYX.Editor.SVGClassElementsAreAvailable = true;
ORYX.Editor.setMissingClasses = function() {
try {
SVGElement;
} catch(e) {
ORYX.Editor.SVGClassElementsAreAvailable = false;
SVGSVGElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg').toString();
SVGGElement = document.createElementNS('http://www.w3.org/2000/svg', 'g').toString();
SVGPathElement = document.createElementNS('http://www.w3.org/2000/svg', 'path').toString();
SVGTextElement = document.createElementNS('http://www.w3.org/2000/svg', 'text').toString();
//SVGMarkerElement = document.createElementNS('http://www.w3.org/2000/svg', 'marker').toString();
SVGRectElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect').toString();
SVGImageElement = document.createElementNS('http://www.w3.org/2000/svg', 'image').toString();
SVGCircleElement = document.createElementNS('http://www.w3.org/2000/svg', 'circle').toString();
SVGEllipseElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse').toString();
SVGLineElement = document.createElementNS('http://www.w3.org/2000/svg', 'line').toString();
SVGPolylineElement = document.createElementNS('http://www.w3.org/2000/svg', 'polyline').toString();
SVGPolygonElement = document.createElementNS('http://www.w3.org/2000/svg', 'polygon').toString();
}
};
ORYX.Editor.checkClassType = function( classInst, classType ) {
if( ORYX.Editor.SVGClassElementsAreAvailable ){
return classInst instanceof classType;
} else {
return classInst == classType;
}
};
ORYX.Editor.makeExtModalWindowKeysave = function(facade) {
Ext.override(Ext.Window,{
beforeShow : function(){
delete this.el.lastXY;
delete this.el.lastLT;
if(this.x === undefined || this.y === undefined){
var xy = this.el.getAlignToXY(this.container, 'c-c');
var pos = this.el.translatePoints(xy[0], xy[1]);
this.x = this.x === undefined? pos.left : this.x;
this.y = this.y === undefined? pos.top : this.y;
}
this.el.setLeftTop(this.x, this.y);
if(this.expandOnShow){
this.expand(false);
}
if(this.modal){
facade.disableEvent(ORYX.CONFIG.EVENT_KEYDOWN);
Ext.getBody().addClass("x-body-masked");
this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
this.mask.show();
}
},
afterHide : function(){
this.proxy.hide();
if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
Ext.EventManager.removeResizeListener(this.onWindowResize, this);
}
if(this.modal){
this.mask.hide();
facade.enableEvent(ORYX.CONFIG.EVENT_KEYDOWN);
Ext.getBody().removeClass("x-body-masked");
}
if(this.keyMap){
this.keyMap.disable();
}
this.fireEvent("hide", this);
},
beforeDestroy : function(){
if(this.modal)
facade.enableEvent(ORYX.CONFIG.EVENT_KEYDOWN);
Ext.destroy(
this.resizer,
this.dd,
this.proxy,
this.mask
);
Ext.Window.superclass.beforeDestroy.call(this);
}
});
};
ORYX.Editor.ModeManager = Clazz.extend({
construct: function construct(facade) {
this.paintMode = false;
this.editMode = false;
this.facade = facade;
facade.registerOnEvent(ORYX.CONFIG.EVENT_BLIP_TOGGLED, this._onBlipToggled.bind(this));
facade.registerOnEvent(ORYX.CONFIG.EVENT_PAINT_CANVAS_TOGGLED, this._onPaintModeToggled.bind(this));
},
isPaintMode: function isPaintMode() {
return this.paintMode;
},
isEditMode: function isEditMode() {
return this.editMode;
},
_onPaintModeToggled: function _onPaintModeToggled(event) {
this.paintMode = event.paintActive;
this._raiseEvent();
},
_onBlipToggled: function _onBlipToggled(event) {
this.editMode = event.editMode;
this._raiseEvent();
},
_raiseEvent: function _raiseEvent() {
this.facade.raiseEvent({
type: ORYX.CONFIG.EVENT_MODE_CHANGED,
mode: this
});
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
if(!ORYX){ var ORYX = {} }
if(!ORYX.Plugins){ ORYX.Plugins = {} }
/**
This abstract plugin implements the core behaviour of layout
@class ORYX.Plugins.AbstractLayouter
@constructor Creates a new instance
@author Willi Tscheschner
*/
ORYX.Plugins.AbstractLayouter = ORYX.Plugins.AbstractPlugin.extend({
/**
* 'layouted' defined all types of shapes which will be layouted.
* It can be one value or an array of values. The value
* can be a Stencil ID (as String) or an class type of either
* a ORYX.Core.Node or ORYX.Core.Edge
* @type Array|String|Object
* @memberOf ORYX.Plugins.AbstractLayouter.prototype
*/
layouted : [],
/**
* Constructor
* @param {Object} facade
* @memberOf ORYX.Plugins.AbstractLayouter.prototype
*/
construct: function( facade ){
arguments.callee.$.construct.apply(this, arguments);
this.facade.registerOnEvent(ORYX.CONFIG.EVENT_LAYOUT, this._initLayout.bind(this));
},
/**
* Proofs if this shape should be layouted or not
* @param {Object} shape
* @memberOf ORYX.Plugins.AbstractLayouter.prototype
*/
isIncludedInLayout: function(shape){
if (!(this.layouted instanceof Array)){
this.layouted = [this.layouted].compact();
}
// If there are no elements
if (this.layouted.length <= 0) {
// Return TRUE
return true;
}
// Return TRUE if there is any correlation between
// the 'layouted' attribute and the shape themselve.
return this.layouted.any(function(s){
if (typeof s == "string") {
return shape.getStencil().id().include(s);
} else {
return shape instanceof s;
}
})
},
/**
* Callback to start the layouting
* @param {Object} event Layout event
* @param {Object} shapes Given shapes
* @memberOf ORYX.Plugins.AbstractLayouter.prototype
*/
_initLayout: function(event){
// Get the shapes
var shapes = [event.shapes].flatten().compact();
// Find all shapes which should be layouted
var toLayout = shapes.findAll(function(shape){
return this.isIncludedInLayout(shape)
}.bind(this))
// If there are shapes left
if (toLayout.length > 0){
// Do layout
this.layout(toLayout);
}
},
/**
* Implementation of layouting a set on shapes
* @param {Object} shapes Given shapes
* @memberOf ORYX.Plugins.AbstractLayouter.prototype
*/
layout: function(shapes){
throw new Error("Layouter has to implement the layout function.")
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
/**
* Top Level uiobject.
* @class ORYX.Core.AbstractShape
* @extends ORYX.Core.UIObject
*/
ORYX.Core.AbstractShape = ORYX.Core.UIObject.extend(
/** @lends ORYX.Core.AbstractShape.prototype */
{
/**
* Constructor
*/
construct: function(options, stencil) {
arguments.callee.$.construct.apply(this, arguments);
if (!options || typeof options["resourceId"] === "undefined") {
this.resourceId = ORYX.Editor.provideId(); //Id of resource in DOM
} else {
this.resourceId = options["resourceId"];
}
// stencil reference
this._stencil = stencil;
// if the stencil defines a super stencil that should be used for its instances, set it.
if (this._stencil._jsonStencil.superId){
stencilId = this._stencil.id()
superStencilId = stencilId.substring(0, stencilId.indexOf("#") + 1) + stencil._jsonStencil.superId;
stencilSet = this._stencil.stencilSet();
this._stencil = stencilSet.stencil(superStencilId);
}
//Hash map for all properties. Only stores the values of the properties.
this.properties = new Hash();
this.propertiesChanged = new Hash();
// List of properties which are not included in the stencilset,
// but which gets (de)serialized
this.hiddenProperties = new Hash();
this.bounds.registerCallback(this.onBoundsChanged.bind(this));
//Initialization of property map and initial value.
this._stencil.properties().each((function(property) {
var key = property.prefix() + "-" + property.id();
this.properties[key] = property.value();
this.propertiesChanged[key] = true;
}).bind(this));
// if super stencil was defined, also regard stencil's properties:
if (stencil._jsonStencil.superId) {
stencil.properties().each((function(property) {
var key = property.prefix() + "-" + property.id();
var value = property.value();
var oldValue = this.properties[key];
this.properties[key] = value;
this.propertiesChanged[key] = true;
// Raise an event, to show that the property has changed
// required for plugins like processLink.js
//window.setTimeout( function(){
this._delegateEvent({
type : ORYX.CONFIG.EVENT_PROPERTY_CHANGED,
name : key,
value : value,
oldValue: oldValue
});
//}.bind(this), 10)
}).bind(this));
}
},
onBoundsChanged: function onBoundsChanged(bounds) {
this._delegateEvent(
{
type : ORYX.CONFIG.EVENT_SHAPEBOUNDS_CHANGED,
shape : this
}
);
},
layout: function() {
},
/**
* Returns the stencil object specifiing the type of the shape.
*/
getStencil: function() {
return this._stencil;
},
/**
*
* @param {Object} resourceId
*/
getChildShapeByResourceId: function(resourceId) {
resourceId = ERDF.__stripHashes(resourceId);
return this.getChildShapes(true).find(function(shape) {
return shape.resourceId == resourceId
});
},
/**
*
* @param {Object} deep
* @param {Object} iterator
*/
getChildShapes: function(deep, iterator) {
var result = [];
this.children.each(function(uiObject) {
if(uiObject instanceof ORYX.Core.Shape && uiObject.isVisible ) {
if(iterator) {
iterator(uiObject);
}
result.push(uiObject);
if(deep) {
result = result.concat(uiObject.getChildShapes(deep, iterator));
}
}
});
return result;
},
/**
* @param {Object} shape
* @return {boolean} true if any of shape's childs is given shape
*/
hasChildShape: function(shape){
return this.getChildShapes().any(function(child){
return (child === shape) || child.hasChildShape(shape);
});
},
/**
*
* @param {Object} deep
* @param {Object} iterator
*/
getChildNodes: function(deep, iterator) {
var result = [];
this.children.each(function(uiObject) {
if(uiObject instanceof ORYX.Core.Node && uiObject.isVisible) {
if(iterator) {
iterator(uiObject);
}
result.push(uiObject);
}
if(uiObject instanceof ORYX.Core.Shape) {
if(deep) {
result = result.concat(uiObject.getChildNodes(deep, iterator));
}
}
});
return result;
},
/**
*
* @param {Object} deep
* @param {Object} iterator
*/
getChildEdges: function(deep, iterator) {
var result = [];
this.children.each(function(uiObject) {
if(uiObject instanceof ORYX.Core.Edge && uiObject.isVisible) {
if(iterator) {
iterator(uiObject);
}
result.push(uiObject);
}
if(uiObject instanceof ORYX.Core.Shape) {
if(deep) {
result = result.concat(uiObject.getChildEdges(deep, iterator));
}
}
});
return result;
},
/**
* Returns a sorted array of ORYX.Core.Node objects.
* Ordered in z Order, the last object has the highest z Order.
*/
//TODO deep iterator
getAbstractShapesAtPosition: function() {
var x, y;
switch (arguments.length) {
case 1:
x = arguments[0].x;
y = arguments[0].y;
break;
case 2: //two or more arguments
x = arguments[0];
y = arguments[1];
break;
default:
throw "getAbstractShapesAtPosition needs 1 or 2 arguments!"
}
if(this.isPointIncluded(x, y)) {
var result = [];
result.push(this);
//check, if one child is at that position
var childNodes = this.getChildNodes();
var childEdges = this.getChildEdges();
[childNodes, childEdges].each(function(ne){
var nodesAtPosition = new Hash();
ne.each(function(node) {
if(!node.isVisible){ return }
var candidates = node.getAbstractShapesAtPosition( x , y );
if(candidates.length > 0) {
var nodesInZOrder = $A(node.node.parentNode.childNodes);
var zOrderIndex = nodesInZOrder.indexOf(node.node);
nodesAtPosition[zOrderIndex] = candidates;
}
});
nodesAtPosition.keys().sort().each(function(key) {
result = result.concat(nodesAtPosition[key]);
});
});
return result;
} else {
return [];
}
},
/**
*
* @param key {String} Must be 'prefix-id' of property
* @param value {Object} Can be of type String or Number according to property type.
*/
setProperty: function(key, value, force) {
var oldValue = this.properties[key];
if(oldValue !== value || force === true) {
this.properties[key] = value;
this.propertiesChanged[key] = true;
this._changed();
// Raise an event, to show that the property has changed
//window.setTimeout( function(){
if (!this._isInSetProperty) {
this._isInSetProperty = true;
this._delegateEvent({
type : ORYX.CONFIG.EVENT_PROPERTY_CHANGED,
elements : [this],
name : key,
value : value,
oldValue: oldValue
});
delete this._isInSetProperty;
}
//}.bind(this), 10)
}
},
/**
*
* @param {String} Must be 'prefix-id' of property
* @param {Object} Can be of type String or Number according to property type.
*/
setHiddenProperty: function(key, value) {
// IF undefined, Delete
if (value === undefined) {
delete this.hiddenProperties[key];
return;
}
var oldValue = this.hiddenProperties[key];
if(oldValue !== value) {
this.hiddenProperties[key] = value;
}
},
/**
* Calculate if the point is inside the Shape
* @param {Point}
*/
isPointIncluded: function(pointX, pointY, absoluteBounds) {
var absBounds = absoluteBounds ? absoluteBounds : this.absoluteBounds();
return absBounds.isIncluded(pointX, pointY);
},
/**
* Get the serialized object
* return Array with hash-entrees (prefix, name, value)
* Following values will given:
* Type
* Properties
*/
serialize: function() {
var serializedObject = [];
// Add the type
serializedObject.push({name: 'type', prefix:'oryx', value: this.getStencil().id(), type: 'literal'});
// Add hidden properties
this.hiddenProperties.each(function(prop){
serializedObject.push({name: prop.key.replace("oryx-", ""), prefix: "oryx", value: prop.value, type: 'literal'});
}.bind(this));
// Add all properties
this.getStencil().properties().each((function(property){
var prefix = property.prefix(); // Get prefix
var name = property.id(); // Get name
//if(typeof this.properties[prefix+'-'+name] == 'boolean' || this.properties[prefix+'-'+name] != "")
serializedObject.push({name: name, prefix: prefix, value: this.properties[prefix+'-'+name], type: 'literal'});
}).bind(this));
return serializedObject;
},
deserialize: function(serialize){
// Search in Serialize
var initializedDocker = 0;
// Sort properties so that the hidden properties are first in the list
serialize = serialize.sort(function(a,b){ return Number(this.properties.keys().member(a.prefix+"-"+a.name)) > Number(this.properties.keys().member(b.prefix+"-"+b.name)) ? -1 : 0 }.bind(this));
serialize.each((function(obj){
var name = obj.name;
var prefix = obj.prefix;
var value = obj.value;
// Complex properties can be real json objects, encode them to a string
if(Ext.type(value) === "object") value = Ext.encode(value);
switch(prefix + "-" + name){
case 'raziel-parent':
// Set parent
if(!this.parent) {break};
// Set outgoing Shape
var parent = this.getCanvas().getChildShapeByResourceId(value);
if(parent) {
parent.add(this);
}
break;
default:
// Set property
if(this.properties.keys().member(prefix+"-"+name)) {
this.setProperty(prefix+"-"+name, value);
} else if(!(name === "bounds"||name === "parent"||name === "target"||name === "dockers"||name === "docker"||name === "outgoing"||name === "incoming")) {
this.setHiddenProperty(prefix+"-"+name, value);
}
}
}).bind(this));
},
toString: function() { return "ORYX.Core.AbstractShape " + this.id },
/**
* Converts the shape to a JSON representation.
* @return {Object} A JSON object with included ORYX.Core.AbstractShape.JSONHelper and getShape() method.
*/
toJSON: function(){
var json = {
resourceId: this.resourceId,
properties: Ext.apply({}, this.properties, this.hiddenProperties).inject({}, function(props, prop){
var key = prop[0];
var value = prop[1];
//If complex property, value should be a json object
if(this.getStencil().property(key)
&& this.getStencil().property(key).type() === ORYX.CONFIG.TYPE_COMPLEX
&& Ext.type(value) === "string"){
try {value = Ext.decode(value);} catch(error){}
}
//Takes "my_property" instead of "oryx-my_property" as key
key = key.replace(/^[\w_]+-/, "");
props[key] = value;
return props;
}.bind(this)),
stencil: {
id: this.getStencil().idWithoutNs()
},
childShapes: this.getChildShapes().map(function(shape){
return shape.toJSON()
})
};
if(this.getOutgoingShapes){
json.outgoing = this.getOutgoingShapes().map(function(shape){
return {
resourceId: shape.resourceId
};
});
}
if(this.bounds){
json.bounds = {
lowerRight: this.bounds.lowerRight(),
upperLeft: this.bounds.upperLeft()
};
}
if(this.dockers){
json.dockers = this.dockers.map(function(docker){
var d = docker.getDockedShape() && docker.referencePoint ? docker.referencePoint : docker.bounds.center();
d.getDocker = function(){return docker;};
d.id = docker.id;
return d;
})
}
Ext.apply(json, ORYX.Core.AbstractShape.JSONHelper);
// do not pollute the json attributes (for serialization), so put the corresponding
// shape is encapsulated in a method
json.getShape = function(){
return this;
}.bind(this);
return json;
}
});
/**
* @namespace Collection of methods which can be used on a shape json object (ORYX.Core.AbstractShape#toJSON()).
* @example
* Ext.apply(shapeAsJson, ORYX.Core.AbstractShape.JSONHelper);
*/
ORYX.Core.AbstractShape.JSONHelper = {
/**
* Iterates over each child shape.
* @param {Object} iterator Iterator function getting a child shape and his parent as arguments.
* @param {boolean} [deep=false] Iterate recursively (childShapes of childShapes)
* @param {boolean} [modify=false] If true, the result of the iterator function is taken as new shape, return false to delete it. This enables modifying the object while iterating through the child shapes.
* @example
* // Increases the lowerRight x value of each direct child shape by one.
* myShapeAsJson.eachChild(function(shape, parentShape){
* shape.bounds.lowerRight.x = shape.bounds.lowerRight.x + 1;
* return shape;
* }, false, true);
*/
eachChild: function(iterator, deep, modify){
if(!this.childShapes) return;
var newChildShapes = []; //needed if modify = true
this.childShapes.each(function(shape){
var res = iterator(shape, this);
if(res) newChildShapes.push(res); //if false is returned, and modify = true, current shape is deleted.
if(deep) shape.eachChild(iterator, deep, modify);
}.bind(this));
if(modify) this.childShapes = newChildShapes;
},
getChildShapes: function(deep){
var allShapes = this.childShapes;
if(deep){
this.eachChild(function(shape){
allShapes = allShapes.concat(shape.getChildShapes(deep));
}, true);
}
return allShapes;
},
/**
* @return {String} Serialized JSON object
*/
serialize: function(){
return Ext.encode(this);
}
}
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if (!ORYX) {
var ORYX = {};
}
if (!ORYX.Core) {
ORYX.Core = {};
}
// command repository
ORYX.Core.Commands = {};
/**
* Glossary:
* commandObject = Metadata + commandData
*/
ORYX.Core.AbstractCommand = Clazz.extend({
/**
* Call this from the child class with:
* arguments.callee.$.construct.call(this, facade);
* The doNotAddMetadataToShapes is optional. In most cases it should be set to false.
*/
construct: function construct(facade, doNotAddMetadata) {
this.metadata = {};
this.metadata.id = ORYX.Editor.provideId();
this.metadata.name = this.getCommandName();
this.metadata.creatorId = facade.getUserId();
this.metadata.createdAt = new Date().getTime();
this.metadata.local = true;
this.metadata.putOnStack = true;
this.facade = facade;
/*this.execute2 = this.execute;
this.execute = function() {
this.execute2();
var shapes = this.getAffectedShapes();
for (var i = 0; i < shapes.length; i++) {
shapes[i].metadata = {
'changedAt': this.getCreatedAt(),
'changedBy': this.getCreatorId()
};
}
}.bind(this);*/
if (!doNotAddMetadata) {
this.execute = function wrappedExecute(executeFunction) {
executeFunction();
this.getAffectedShapes().each(function injectMetadataIntoShape(shape) {
if (typeof shape.metadata === "undefined") {
return;
};
shape.metadata.changedAt.push(this.getCreatedAt());
shape.metadata.changedBy.push(this.getCreatorId());
shape.metadata.commands.push(this.getDisplayName());
shape.metadata.isLocal = this.isLocal();
this.facade.raiseEvent({
'type': ORYX.CONFIG.EVENT_SHAPE_METADATA_CHANGED,
'shape': shape
});
}.bind(this));
}.bind(this, this.execute.bind(this));
this.rollback = function wrappedExecute(rollbackFunction) {
rollbackFunction();
this.getAffectedShapes().each(function injectMetadataIntoShape(shape) {
if (typeof shape.metadata === "undefined") {
return;
};
shape.metadata.changedAt.pop();
shape.metadata.changedBy.pop();
shape.metadata.commands.pop();
shape.metadata.isLocal = this.isLocal();
this.facade.raiseEvent({
'type': ORYX.CONFIG.EVENT_SHAPE_METADATA_CHANGED,
'shape': shape
});
}.bind(this));
}.bind(this, this.rollback.bind(this));
}
},
getCommandId: function getCommandId() {
return this.metadata.id;
},
getCreatorId: function getCreatorId() {
return this.metadata.creatorId;
},
getCreatedAt: function getCreatedAt() {
return this.metadata.createdAt;
},
/**
* Create a command object from the commandData object.
* commandData is an object provided by the getCommandData() method.
*
* @static
*/
createFromCommandData: function createFromCommandData(facade, commandData) {
throw "AbstractCommand.createFromCommandData() has to be implemented";
},
/**
* @return Array(Oryx.Core.Shape) All shapes modified by this command
*/
getAffectedShapes: function getAffectedShapes() {
throw "AbstractCommand.getAffectedShapes() has to be implemented";
},
/**
* Should return a string/object/... that allows the command to be reconstructed
* Basically:
* createFromCommandData(this.getCommandData) === this
* @return Object has to be serializable
*/
getCommandData: function getCommandData() {
throw "AbstractCommand.getCommandData() has to be implemented";
},
/**
* Name of this command, usually in the from of <plugin name>.<command description>
* e.g.:
* DragDropResize.DropCommand
* ShapeMenu.CreateCommand
* @return string
*/
getCommandName: function getCommandName() {
throw "AbstractCommand.getCommandName() has to be implemented";
},
/**
* Should be overwritten by subclasses and return the command name in a human readable format.
* e.g.:
* Shape deleted
* @return string
*/
getDisplayName: function getDisplayName() {
return this.getCommandName();
},
execute: function execute() {
throw "AbstractCommand.execute() has to be implemented";
},
rollback: function rollback() {
throw "AbstractCommand.rollback() has to be implemented!";
},
/**
* @return Boolean
*/
isLocal: function isLocal() {
return this.metadata.local;
},
jsonSerialize: function jsonSerialize() {
var commandData = this.getCommandData();
var commandObject = {
'id': this.getCommandId(),
'name': this.getCommandName(),
'creatorId': this.getCreatorId(),
'createdAt': this.getCreatedAt(),
'data': commandData,
'putOnStack': this.metadata.putOnStack
};
return Object.toJSON(commandObject);
},
/**
* @static
*/
jsonDeserialize: function jsonDeserialize(facade, commandString) {
var commandObject = commandString.evalJSON();
var commandInstance = ORYX.Core.Commands[commandObject.name].prototype.createFromCommandData(facade, commandObject.data);
if (typeof commandInstance !== 'undefined') {
commandInstance.setMetadata({
'id': commandObject.id,
'name': commandObject.name,
'creatorId': commandObject.creatorId,
'createdAt': commandObject.createdAt,
'putOnStack': commandObject.putOnStack,
'local': false
});
}
return commandInstance;
},
setMetadata: function setMetadata(metadata) {
this.metadata = Object.clone(metadata);
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
/**
* @classDescription With Bounds you can set and get position and size of UIObjects.
*/
ORYX.Core.Command = Clazz.extend({
/**
* Constructor
*/
construct: function() {
},
execute: function(){
throw "Command.execute() has to be implemented!"
},
rollback: function(){
throw "Command.rollback() has to be implemented!"
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespace
*/
if (!ORYX) {
var ORYX = {};
}
if (!ORYX.Core) {
ORYX.Core = {};
}
if (!ORYX.Core.StencilSet) {
ORYX.Core.StencilSet = {};
}
/**
* This class represents a stencil set. It offers methods for accessing
* the attributes of the stencil set description JSON file and the stencil set's
* stencils.
*/
ORYX.Core.StencilSet.StencilSet = Clazz.extend({
/**
* Constructor
* @param source {URL} A reference to the stencil set specification.
*
*/
construct: function(source){
arguments.callee.$.construct.apply(this, arguments);
if (!source) {
throw "ORYX.Core.StencilSet.StencilSet(construct): Parameter 'source' is not defined.";
}
if (source.endsWith("/")) {
source = source.substr(0, source.length - 1);
}
this._extensions = new Hash();
this._source = source;
this._baseUrl = source.substring(0, source.lastIndexOf("/") + 1);
this._jsonObject = {};
this._stencils = new Hash();
this._availableStencils = new Hash();
if(ORYX.CONFIG.BACKEND_SWITCH) {
//get the url of the stencil set json file
new Ajax.Request(source, {
asynchronous: false,
method: 'get',
onSuccess: this._getJSONURL.bind(this),
onFailure: this._cancelInit.bind(this)
});
} else {
new Ajax.Request(source, {
asynchronous: false,
method: 'get',
onSuccess: this._init.bind(this),
onFailure: this._cancelInit.bind(this)
});
}
if (this.errornous)
throw "Loading stencil set " + source + " failed.";
},
/**
* Finds a root stencil in this stencil set. There may be many of these. If
* there are, the first one found will be used. In Firefox, this is the
* topmost definition in the stencil set description file.
*/
findRootStencilName: function(){
// find any stencil that may be root.
var rootStencil = this._stencils.values().find(function(stencil){
return stencil._jsonStencil.mayBeRoot
});
// if there is none, just guess the first.
if (!rootStencil) {
ORYX.Log.warn("Did not find any stencil that may be root. Taking a guess.");
rootStencil = this._stencils.values()[0];
}
// return its id.
return rootStencil.id();
},
/**
* @param {ORYX.Core.StencilSet.StencilSet} stencilSet
* @return {Boolean} True, if stencil set has the same namespace.
*/
equals: function(stencilSet){
return (this.namespace() === stencilSet.namespace());
},
/**
*
* @param {Oryx.Core.StencilSet.Stencil} rootStencil If rootStencil is defined, it only returns stencils
* that could be (in)direct child of that stencil.
*/
stencils: function(rootStencil, rules, sortByGroup){
if(rootStencil && rules) {
var stencils = this._availableStencils.values();
var containers = [rootStencil];
var checkedContainers = [];
var result = [];
while (containers.size() > 0) {
var container = containers.pop();
checkedContainers.push(container);
var children = stencils.findAll(function(stencil){
var args = {
containingStencil: container,
containedStencil: stencil
};
return rules.canContain(args);
});
for(var i = 0; i < children.size(); i++) {
if (!checkedContainers.member(children[i])) {
containers.push(children[i]);
}
}
result = result.concat(children).uniq();
}
// Sort the result to the origin order
result = result.sortBy(function(stencil) {
return stencils.indexOf(stencil);
});
if(sortByGroup) {
result = result.sortBy(function(stencil) {
return stencil.groups().first();
});
}
var edges = stencils.findAll(function(stencil) {
return stencil.type() == "edge";
});
result = result.concat(edges);
return result;
} else {
if(sortByGroup) {
return this._availableStencils.values().sortBy(function(stencil) {
return stencil.groups().first();
});
} else {
return this._availableStencils.values();
}
}
},
nodes: function(){
return this._availableStencils.values().findAll(function(stencil){
return (stencil.type() === 'node')
});
},
edges: function(){
return this._availableStencils.values().findAll(function(stencil){
return (stencil.type() === 'edge')
});
},
stencil: function(id){
return this._stencils[id];
},
title: function(){
return ORYX.Core.StencilSet.getTranslation(this._jsonObject, "title");
},
description: function(){
return ORYX.Core.StencilSet.getTranslation(this._jsonObject, "description");
},
namespace: function(){
return this._jsonObject ? this._jsonObject.namespace : null;
},
jsonRules: function(){
return this._jsonObject ? this._jsonObject.rules : null;
},
source: function(){
return this._source;
},
extensions: function() {
return this._extensions;
},
addExtension: function(url) {
new Ajax.Request(url, {
method: 'GET',
asynchronous: false,
onSuccess: (function(transport) {
this.addExtensionDirectly(transport.responseText);
}).bind(this),
onFailure: (function(transport) {
ORYX.Log.debug("Loading stencil set extension file failed. The request returned an error." + transport);
}).bind(this),
onException: (function(transport) {
ORYX.Log.debug("Loading stencil set extension file failed. The request returned an error." + transport);
}).bind(this)
});
},
addExtensionDirectly: function(str){
try {
eval("var jsonExtension = " + str);
if(!(jsonExtension["extends"].endsWith("#")))
jsonExtension["extends"] += "#";
if(jsonExtension["extends"] == this.namespace()) {
this._extensions[jsonExtension.namespace] = jsonExtension;
var defaultPosition = this._stencils.keys().size();
//load new stencils
if(jsonExtension.stencils) {
$A(jsonExtension.stencils).each(function(stencil) {
defaultPosition++;
var oStencil = new ORYX.Core.StencilSet.Stencil(stencil, this.namespace(), this._baseUrl, this, undefined, defaultPosition);
this._stencils[oStencil.id()] = oStencil;
this._availableStencils[oStencil.id()] = oStencil;
}.bind(this));
}
//load additional properties
if (jsonExtension.properties) {
var stencils = this._stencils.values();
stencils.each(function(stencil){
var roles = stencil.roles();
jsonExtension.properties.each(function(prop){
prop.roles.any(function(role){
role = jsonExtension["extends"] + role;
if (roles.member(role)) {
prop.properties.each(function(property){
stencil.addProperty(property, jsonExtension.namespace);
});
return true;
}
else
return false;
})
})
}.bind(this));
}
//remove stencil properties
if(jsonExtension.removeproperties) {
jsonExtension.removeproperties.each(function(remprop) {
var stencil = this.stencil(jsonExtension["extends"] + remprop.stencil);
if(stencil) {
remprop.properties.each(function(propId) {
stencil.removeProperty(propId);
});
}
}.bind(this));
}
//remove stencils
if(jsonExtension.removestencils) {
$A(jsonExtension.removestencils).each(function(remstencil) {
delete this._availableStencils[jsonExtension["extends"] + remstencil];
}.bind(this));
}
}
} catch (e) {
ORYX.Log.debug("StencilSet.addExtension: Something went wrong when initialising the stencil set extension. " + e);
}
},
removeExtension: function(namespace) {
var jsonExtension = this._extensions[namespace];
if(jsonExtension) {
//unload extension's stencils
if(jsonExtension.stencils) {
$A(jsonExtension.stencils).each(function(stencil) {
var oStencil = new ORYX.Core.StencilSet.Stencil(stencil, this.namespace(), this._baseUrl, this);
delete this._stencils[oStencil.id()]; // maybe not ??
delete this._availableStencils[oStencil.id()];
}.bind(this));
}
//unload extension's properties
if (jsonExtension.properties) {
var stencils = this._stencils.values();
stencils.each(function(stencil){
var roles = stencil.roles();
jsonExtension.properties.each(function(prop){
prop.roles.any(function(role){
role = jsonExtension["extends"] + role;
if (roles.member(role)) {
prop.properties.each(function(property){
stencil.removeProperty(property.id);
});
return true;
}
else
return false;
})
})
}.bind(this));
}
//restore removed stencil properties
if(jsonExtension.removeproperties) {
jsonExtension.removeproperties.each(function(remprop) {
var stencil = this.stencil(jsonExtension["extends"] + remprop.stencil);
if(stencil) {
var stencilJson = $A(this._jsonObject.stencils).find(function(s) { return s.id == stencil.id() });
remprop.properties.each(function(propId) {
var propertyJson = $A(stencilJson.properties).find(function(p) { return p.id == propId });
stencil.addProperty(propertyJson, this.namespace());
}.bind(this));
}
}.bind(this));
}
//restore removed stencils
if(jsonExtension.removestencils) {
$A(jsonExtension.removestencils).each(function(remstencil) {
var sId = jsonExtension["extends"] + remstencil;
this._availableStencils[sId] = this._stencils[sId];
}.bind(this));
}
}
delete this._extensions[namespace];
},
__handleStencilset: function(response){
try {
// using eval instead of prototype's parsing,
// since there are functions in this JSON.
eval("this._jsonObject =" + response.responseText);
}
catch (e) {
throw "Stenciset corrupt: " + e;
}
// assert it was parsed.
if (!this._jsonObject) {
throw "Error evaluating stencilset. It may be corrupt.";
}
with (this._jsonObject) {
// assert there is a namespace.
if (!namespace || namespace === "")
throw "Namespace definition missing in stencilset.";
if (!(stencils instanceof Array))
throw "Stencilset corrupt.";
// assert namespace ends with '#'.
if (!namespace.endsWith("#"))
namespace = namespace + "#";
// assert title and description are strings.
if (!title)
title = "";
if (!description)
description = "";
}
},
_getJSONURL: function(response) {
this._baseUrl = response.responseText.substring(0, response.responseText.lastIndexOf("/") + 1);
this._source = response.responseText;
new Ajax.Request(response.responseText, {
asynchronous: false,
method: 'get',
onSuccess: this._init.bind(this),
onFailure: this._cancelInit.bind(this)
});
},
/**
* This method is called when the HTTP request to get the requested stencil
* set succeeds. The response is supposed to be a JSON representation
* according to the stencil set specification.
* @param {Object} response The JSON representation according to the
* stencil set specification.
*/
_init: function(response){
// init and check consistency.
this.__handleStencilset(response);
var pps = new Hash();
// init property packages
if(this._jsonObject.propertyPackages) {
$A(this._jsonObject.propertyPackages).each((function(pp) {
pps[pp.name] = pp.properties;
}).bind(this));
}
var defaultPosition = 0;
// init each stencil
$A(this._jsonObject.stencils).each((function(stencil){
defaultPosition++;
// instantiate normally.
var oStencil = new ORYX.Core.StencilSet.Stencil(stencil, this.namespace(), this._baseUrl, this, pps, defaultPosition);
this._stencils[oStencil.id()] = oStencil;
this._availableStencils[oStencil.id()] = oStencil;
}).bind(this));
},
_cancelInit: function(response){
this.errornous = true;
},
toString: function(){
return "StencilSet " + this.title() + " (" + this.namespace() + ")";
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};}
/**
* Class Rules uses Prototpye 1.5.0 uses Inheritance
*
* This class implements the API to check the stencil sets' rules.
*/
ORYX.Core.StencilSet.Rules = {
/**
* Constructor
*/
construct: function() {
arguments.callee.$.construct.apply(this, arguments);
this._stencilSets = [];
this._stencils = [];
this._cachedConnectSET = new Hash();
this._cachedConnectSE = new Hash();
this._cachedConnectTE = new Hash();
this._cachedCardSE = new Hash();
this._cachedCardTE = new Hash();
this._cachedContainPC = new Hash();
this._cachedMorphRS = new Hash();
this._connectionRules = new Hash();
this._cardinalityRules = new Hash();
this._containmentRules = new Hash();
this._morphingRules = new Hash();
this._layoutRules = new Hash();
},
/**
* Call this method to initialize the rules for a stencil set and all of its
* active extensions.
*
* @param {Object}
* stencilSet
*/
initializeRules: function(stencilSet) {
var existingSS = this._stencilSets.find(function(ss) {
return (ss.namespace() == stencilSet.namespace());
});
if (existingSS) {
// reinitialize all rules
var stencilsets = this._stencilSets.clone();
stencilsets = stencilsets.without(existingSS);
stencilsets.push(stencilSet);
this._stencilSets = [];
this._stencils = [];
this._cachedConnectSET = new Hash();
this._cachedConnectSE = new Hash();
this._cachedConnectTE = new Hash();
this._cachedCardSE = new Hash();
this._cachedCardTE = new Hash();
this._cachedContainPC = new Hash();
this._cachedMorphRS = new Hash();
this._connectionRules = new Hash();
this._cardinalityRules = new Hash();
this._containmentRules = new Hash();
this._morphingRules = new Hash();
this._layoutRules = new Hash();
stencilsets.each(function(ss){
this.initializeRules(ss);
}.bind(this));
return;
}
else {
this._stencilSets.push(stencilSet);
var jsonRules = new Hash(stencilSet.jsonRules());
var namespace = stencilSet.namespace();
var stencils = stencilSet.stencils();
stencilSet.extensions().values().each(function(extension) {
if(extension.rules) {
if(extension.rules.connectionRules)
jsonRules.connectionRules = jsonRules.connectionRules.concat(extension.rules.connectionRules);
if(extension.rules.cardinalityRules)
jsonRules.cardinalityRules = jsonRules.cardinalityRules.concat(extension.rules.cardinalityRules);
if(extension.rules.containmentRules)
jsonRules.containmentRules = jsonRules.containmentRules.concat(extension.rules.containmentRules);
if(extension.rules.morphingRules)
jsonRules.morphingRules = jsonRules.morphingRules.concat(extension.rules.morphingRules);
}
if(extension.stencils)
stencils = stencils.concat(extension.stencils);
});
this._stencils = this._stencils.concat(stencilSet.stencils());
// init connection rules
var cr = this._connectionRules;
if (jsonRules.connectionRules) {
jsonRules.connectionRules.each((function(rules){
if (this._isRoleOfOtherNamespace(rules.role)) {
if (!cr[rules.role]) {
cr[rules.role] = new Hash();
}
}
else {
if (!cr[namespace + rules.role])
cr[namespace + rules.role] = new Hash();
}
rules.connects.each((function(connect){
var toRoles = [];
if (connect.to) {
if (!(connect.to instanceof Array)) {
connect.to = [connect.to];
}
connect.to.each((function(to){
if (this._isRoleOfOtherNamespace(to)) {
toRoles.push(to);
}
else {
toRoles.push(namespace + to);
}
}).bind(this));
}
var role, from;
if (this._isRoleOfOtherNamespace(rules.role))
role = rules.role;
else
role = namespace + rules.role;
if (this._isRoleOfOtherNamespace(connect.from))
from = connect.from;
else
from = namespace + connect.from;
if (!cr[role][from])
cr[role][from] = toRoles;
else
cr[role][from] = cr[role][from].concat(toRoles);
}).bind(this));
}).bind(this));
}
// init cardinality rules
var cardr = this._cardinalityRules;
if (jsonRules.cardinalityRules) {
jsonRules.cardinalityRules.each((function(rules){
var cardrKey;
if (this._isRoleOfOtherNamespace(rules.role)) {
cardrKey = rules.role;
}
else {
cardrKey = namespace + rules.role;
}
if (!cardr[cardrKey]) {
cardr[cardrKey] = {};
for (i in rules) {
cardr[cardrKey][i] = rules[i];
}
}
var oe = new Hash();
if (rules.outgoingEdges) {
rules.outgoingEdges.each((function(rule){
if (this._isRoleOfOtherNamespace(rule.role)) {
oe[rule.role] = rule;
}
else {
oe[namespace + rule.role] = rule;
}
}).bind(this));
}
cardr[cardrKey].outgoingEdges = oe;
var ie = new Hash();
if (rules.incomingEdges) {
rules.incomingEdges.each((function(rule){
if (this._isRoleOfOtherNamespace(rule.role)) {
ie[rule.role] = rule;
}
else {
ie[namespace + rule.role] = rule;
}
}).bind(this));
}
cardr[cardrKey].incomingEdges = ie;
}).bind(this));
}
// init containment rules
var conr = this._containmentRules;
if (jsonRules.containmentRules) {
jsonRules.containmentRules.each((function(rules){
var conrKey;
if (this._isRoleOfOtherNamespace(rules.role)) {
conrKey = rules.role;
}
else {
conrKey = namespace + rules.role;
}
if (!conr[conrKey]) {
conr[conrKey] = [];
}
rules.contains.each((function(containRole){
if (this._isRoleOfOtherNamespace(containRole)) {
conr[conrKey].push(containRole);
}
else {
conr[conrKey].push(namespace + containRole);
}
}).bind(this));
}).bind(this));
}
// init morphing rules
var morphr = this._morphingRules;
if (jsonRules.morphingRules) {
jsonRules.morphingRules.each((function(rules){
var morphrKey;
if (this._isRoleOfOtherNamespace(rules.role)) {
morphrKey = rules.role;
}
else {
morphrKey = namespace + rules.role;
}
if (!morphr[morphrKey]) {
morphr[morphrKey] = [];
}
if(!rules.preserveBounds) {
rules.preserveBounds = false;
}
rules.baseMorphs.each((function(baseMorphStencilId){
morphr[morphrKey].push(this._getStencilById(namespace + baseMorphStencilId));
}).bind(this));
}).bind(this));
}
// init layouting rules
var layoutRules = this._layoutRules;
if (jsonRules.layoutRules) {
var getDirections = function(o){
return {
"edgeRole":o.edgeRole||undefined,
"t": o["t"]||1,
"r": o["r"]||1,
"b": o["b"]||1,
"l": o["l"]||1
}
}
jsonRules.layoutRules.each(function(rules){
var layoutKey;
if (this._isRoleOfOtherNamespace(rules.role)) {
layoutKey = rules.role;
}
else {
layoutKey = namespace + rules.role;
}
if (!layoutRules[layoutKey]) {
layoutRules[layoutKey] = {};
}
if (rules["in"]){
layoutRules[layoutKey]["in"] = getDirections(rules["in"]);
}
if (rules["ins"]){
layoutRules[layoutKey]["ins"] = (rules["ins"]||[]).map(function(e){ return getDirections(e) })
}
if (rules["out"]) {
layoutRules[layoutKey]["out"] = getDirections(rules["out"]);
}
if (rules["outs"]){
layoutRules[layoutKey]["outs"] = (rules["outs"]||[]).map(function(e){ return getDirections(e) })
}
}.bind(this));
}
}
},
_getStencilById: function(id) {
return this._stencils.find(function(stencil) {
return stencil.id()==id;
});
},
_cacheConnect: function(args) {
result = this._canConnect(args);
if (args.sourceStencil && args.targetStencil) {
var source = this._cachedConnectSET[args.sourceStencil.id()];
if(!source) {
source = new Hash();
this._cachedConnectSET[args.sourceStencil.id()] = source;
}
var edge = source[args.edgeStencil.id()];
if(!edge) {
edge = new Hash();
source[args.edgeStencil.id()] = edge;
}
edge[args.targetStencil.id()] = result;
} else if (args.sourceStencil) {
var source = this._cachedConnectSE[args.sourceStencil.id()];
if(!source) {
source = new Hash();
this._cachedConnectSE[args.sourceStencil.id()] = source;
}
source[args.edgeStencil.id()] = result;
} else {
var target = this._cachedConnectTE[args.targetStencil.id()];
if(!target) {
target = new Hash();
this._cachedConnectTE[args.targetStencil.id()] = target;
}
target[args.edgeStencil.id()] = result;
}
return result;
},
_cacheCard: function(args) {
if(args.sourceStencil) {
var source = this._cachedCardSE[args.sourceStencil.id()]
if(!source) {
source = new Hash();
this._cachedCardSE[args.sourceStencil.id()] = source;
}
var max = this._getMaximumNumberOfOutgoingEdge(args);
if(max == undefined)
max = -1;
source[args.edgeStencil.id()] = max;
}
if(args.targetStencil) {
var target = this._cachedCardTE[args.targetStencil.id()]
if(!target) {
target = new Hash();
this._cachedCardTE[args.targetStencil.id()] = target;
}
var max = this._getMaximumNumberOfIncomingEdge(args);
if(max == undefined)
max = -1;
target[args.edgeStencil.id()] = max;
}
},
_cacheContain: function(args) {
var result = [this._canContain(args),
this._getMaximumOccurrence(args.containingStencil, args.containedStencil)]
if(result[1] == undefined)
result[1] = -1;
var children = this._cachedContainPC[args.containingStencil.id()];
if(!children) {
children = new Hash();
this._cachedContainPC[args.containingStencil.id()] = children;
}
children[args.containedStencil.id()] = result;
return result;
},
/**
* Returns all stencils belonging to a morph group. (calculation result is
* cached)
*/
_cacheMorph: function(role) {
var morphs = this._cachedMorphRS[role];
if(!morphs) {
morphs = [];
if(this._morphingRules.keys().include(role)) {
morphs = this._stencils.select(function(stencil) {
return stencil.roles().include(role);
});
}
this._cachedMorphRS[role] = morphs;
}
return morphs;
},
/** Begin connection rules' methods */
/**
*
* @param {Object}
* args sourceStencil: ORYX.Core.StencilSet.Stencil | undefined
* sourceShape: ORYX.Core.Shape | undefined
*
* At least sourceStencil or sourceShape has to be specified
*
* @return {Array} Array of stencils of edges that can be outgoing edges of
* the source.
*/
outgoingEdgeStencils: function(args) {
// check arguments
if(!args.sourceShape && !args.sourceStencil) {
return [];
}
// init arguments
if(args.sourceShape) {
args.sourceStencil = args.sourceShape.getStencil();
}
var _edges = [];
// test each edge, if it can connect to source
this._stencils.each((function(stencil) {
if(stencil.type() === "edge") {
var newArgs = Object.clone(args);
newArgs.edgeStencil = stencil;
if(this.canConnect(newArgs)) {
_edges.push(stencil);
}
}
}).bind(this));
return _edges;
},
/**
*
* @param {Object}
* args targetStencil: ORYX.Core.StencilSet.Stencil | undefined
* targetShape: ORYX.Core.Shape | undefined
*
* At least targetStencil or targetShape has to be specified
*
* @return {Array} Array of stencils of edges that can be incoming edges of
* the target.
*/
incomingEdgeStencils: function(args) {
// check arguments
if(!args.targetShape && !args.targetStencil) {
return [];
}
// init arguments
if(args.targetShape) {
args.targetStencil = args.targetShape.getStencil();
}
var _edges = [];
// test each edge, if it can connect to source
this._stencils.each((function(stencil) {
if(stencil.type() === "edge") {
var newArgs = Object.clone(args);
newArgs.edgeStencil = stencil;
if(this.canConnect(newArgs)) {
_edges.push(stencil);
}
}
}).bind(this));
return _edges;
},
/**
*
* @param {Object}
* args edgeStencil: ORYX.Core.StencilSet.Stencil | undefined
* edgeShape: ORYX.Core.Edge | undefined targetStencil:
* ORYX.Core.StencilSet.Stencil | undefined targetShape:
* ORYX.Core.Node | undefined
*
* At least edgeStencil or edgeShape has to be specified!!!
*
* @return {Array} Returns an array of stencils that can be source of the
* specified edge.
*/
sourceStencils: function(args) {
// check arguments
if(!args ||
!args.edgeShape && !args.edgeStencil) {
return [];
}
// init arguments
if(args.targetShape) {
args.targetStencil = args.targetShape.getStencil();
}
if(args.edgeShape) {
args.edgeStencil = args.edgeShape.getStencil();
}
var _sources = [];
// check each stencil, if it can be a source
this._stencils.each((function(stencil) {
var newArgs = Object.clone(args);
newArgs.sourceStencil = stencil;
if(this.canConnect(newArgs)) {
_sources.push(stencil);
}
}).bind(this));
return _sources;
},
/**
*
* @param {Object}
* args edgeStencil: ORYX.Core.StencilSet.Stencil | undefined
* edgeShape: ORYX.Core.Edge | undefined sourceStencil:
* ORYX.Core.StencilSet.Stencil | undefined sourceShape:
* ORYX.Core.Node | undefined
*
* At least edgeStencil or edgeShape has to be specified!!!
*
* @return {Array} Returns an array of stencils that can be target of the
* specified edge.
*/
targetStencils: function(args) {
// check arguments
if(!args ||
!args.edgeShape && !args.edgeStencil) {
return [];
}
// init arguments
if(args.sourceShape) {
args.sourceStencil = args.sourceShape.getStencil();
}
if(args.edgeShape) {
args.edgeStencil = args.edgeShape.getStencil();
}
var _targets = [];
// check stencil, if it can be a target
this._stencils.each((function(stencil) {
var newArgs = Object.clone(args);
newArgs.targetStencil = stencil;
if(this.canConnect(newArgs)) {
_targets.push(stencil);
}
}).bind(this));
return _targets;
},
/**
*
* @param {Object}
* args edgeStencil: ORYX.Core.StencilSet.Stencil edgeShape:
* ORYX.Core.Edge |undefined sourceStencil:
* ORYX.Core.StencilSet.Stencil | undefined sourceShape:
* ORYX.Core.Node |undefined targetStencil:
* ORYX.Core.StencilSet.Stencil | undefined targetShape:
* ORYX.Core.Node |undefined
*
* At least source or target has to be specified!!!
*
* @return {Boolean} Returns, if the edge can connect source and target.
*/
canConnect: function(args) {
// check arguments
if(!args ||
(!args.sourceShape && !args.sourceStencil &&
!args.targetShape && !args.targetStencil) ||
!args.edgeShape && !args.edgeStencil) {
return false;
}
// init arguments
if(args.sourceShape) {
args.sourceStencil = args.sourceShape.getStencil();
}
if(args.targetShape) {
args.targetStencil = args.targetShape.getStencil();
}
if(args.edgeShape) {
args.edgeStencil = args.edgeShape.getStencil();
}
var result;
if(args.sourceStencil && args.targetStencil) {
var source = this._cachedConnectSET[args.sourceStencil.id()];
if(!source)
result = this._cacheConnect(args);
else {
var edge = source[args.edgeStencil.id()];
if(!edge)
result = this._cacheConnect(args);
else {
var target = edge[args.targetStencil.id()];
if(target == undefined)
result = this._cacheConnect(args);
else
result = target;
}
}
} else if (args.sourceStencil) {
var source = this._cachedConnectSE[args.sourceStencil.id()];
if(!source)
result = this._cacheConnect(args);
else {
var edge = source[args.edgeStencil.id()];
if(edge == undefined)
result = this._cacheConnect(args);
else
result = edge;
}
} else { // args.targetStencil
var target = this._cachedConnectTE[args.targetStencil.id()];
if(!target)
result = this._cacheConnect(args);
else {
var edge = target[args.edgeStencil.id()];
if(edge == undefined)
result = this._cacheConnect(args);
else
result = edge;
}
}
// check cardinality
if (result) {
if(args.sourceShape) {
var source = this._cachedCardSE[args.sourceStencil.id()];
if(!source) {
this._cacheCard(args);
source = this._cachedCardSE[args.sourceStencil.id()];
}
var max = source[args.edgeStencil.id()];
if(max == undefined) {
this._cacheCard(args);
}
max = source[args.edgeStencil.id()];
if(max != -1) {
result = args.sourceShape.getOutgoingShapes().all(function(cs) {
if((cs.getStencil().id() === args.edgeStencil.id()) &&
((args.edgeShape) ? cs !== args.edgeShape : true)) {
max--;
return (max > 0) ? true : false;
} else {
return true;
}
});
}
}
if (args.targetShape) {
var target = this._cachedCardTE[args.targetStencil.id()];
if(!target) {
this._cacheCard(args);
target = this._cachedCardTE[args.targetStencil.id()];
}
var max = target[args.edgeStencil.id()];
if(max == undefined) {
this._cacheCard(args);
}
max = target[args.edgeStencil.id()];
if(max != -1) {
result = args.targetShape.getIncomingShapes().all(function(cs){
if ((cs.getStencil().id() === args.edgeStencil.id()) &&
((args.edgeShape) ? cs !== args.edgeShape : true)) {
max--;
return (max > 0) ? true : false;
}
else {
return true;
}
});
}
}
}
return result;
},
/**
*
* @param {Object}
* args edgeStencil: ORYX.Core.StencilSet.Stencil edgeShape:
* ORYX.Core.Edge |undefined sourceStencil:
* ORYX.Core.StencilSet.Stencil | undefined sourceShape:
* ORYX.Core.Node |undefined targetStencil:
* ORYX.Core.StencilSet.Stencil | undefined targetShape:
* ORYX.Core.Node |undefined
*
* At least source or target has to be specified!!!
*
* @return {Boolean} Returns, if the edge can connect source and target.
*/
_canConnect: function(args) {
// check arguments
if(!args ||
(!args.sourceShape && !args.sourceStencil &&
!args.targetShape && !args.targetStencil) ||
!args.edgeShape && !args.edgeStencil) {
return false;
}
// init arguments
if(args.sourceShape) {
args.sourceStencil = args.sourceShape.getStencil();
}
if(args.targetShape) {
args.targetStencil = args.targetShape.getStencil();
}
if(args.edgeShape) {
args.edgeStencil = args.edgeShape.getStencil();
}
// 1. check connection rules
var resultCR;
// get all connection rules for this edge
var edgeRules = this._getConnectionRulesOfEdgeStencil(args.edgeStencil);
// check connection rules, if the source can be connected to the target
// with the specified edge.
if(edgeRules.keys().length === 0) {
resultCR = false;
} else {
if(args.sourceStencil) {
resultCR = args.sourceStencil.roles().any(function(sourceRole) {
var targetRoles = edgeRules[sourceRole];
if(!targetRoles) {return false;}
if(args.targetStencil) {
return (targetRoles.any(function(targetRole) {
return args.targetStencil.roles().member(targetRole);
}));
} else {
return true;
}
});
} else { // !args.sourceStencil -> there is args.targetStencil
resultCR = edgeRules.values().any(function(targetRoles) {
return args.targetStencil.roles().any(function(targetRole) {
return targetRoles.member(targetRole);
});
});
}
}
return resultCR;
},
/** End connection rules' methods */
/** Begin containment rules' methods */
/**
*
* @param {Object}
* args containingStencil: ORYX.Core.StencilSet.Stencil
* containingShape: ORYX.Core.AbstractShape containedStencil:
* ORYX.Core.StencilSet.Stencil containedShape: ORYX.Core.Shape
*/
canContain: function(args) {
if(!args ||
!args.containingStencil && !args.containingShape ||
!args.containedStencil && !args.containedShape) {
return false;
}
// init arguments
if(args.containedShape) {
args.containedStencil = args.containedShape.getStencil();
}
if(args.containingShape) {
args.containingStencil = args.containingShape.getStencil();
}
//if(args.containingStencil.type() == 'edge' || args.containedStencil.type() == 'edge')
// return false;
if(args.containedStencil.type() == 'edge')
return false;
var childValues;
var parent = this._cachedContainPC[args.containingStencil.id()];
if(!parent)
childValues = this._cacheContain(args);
else {
childValues = parent[args.containedStencil.id()];
if(!childValues)
childValues = this._cacheContain(args);
}
if(!childValues[0])
return false;
else if (childValues[1] == -1)
return true;
else {
if(args.containingShape) {
var max = childValues[1];
return args.containingShape.getChildShapes(false).all(function(as) {
if(as.getStencil().id() === args.containedStencil.id()) {
max--;
return (max > 0) ? true : false;
} else {
return true;
}
});
} else {
return true;
}
}
},
/**
*
* @param {Object}
* args containingStencil: ORYX.Core.StencilSet.Stencil
* containingShape: ORYX.Core.AbstractShape containedStencil:
* ORYX.Core.StencilSet.Stencil containedShape: ORYX.Core.Shape
*/
_canContain: function(args) {
if(!args ||
!args.containingStencil && !args.containingShape ||
!args.containedStencil && !args.containedShape) {
return false;
}
// init arguments
if(args.containedShape) {
args.containedStencil = args.containedShape.getStencil();
}
if(args.containingShape) {
args.containingStencil = args.containingShape.getStencil();
}
// if(args.containingShape) {
// if(args.containingShape instanceof ORYX.Core.Edge) {
// // edges cannot contain other shapes
// return false;
// }
// }
var result;
// check containment rules
result = args.containingStencil.roles().any((function(role) {
var roles = this._containmentRules[role];
if(roles) {
return roles.any(function(role) {
return args.containedStencil.roles().member(role);
});
} else {
return false;
}
}).bind(this));
return result;
},
/** End containment rules' methods */
/** Begin morphing rules' methods */
/**
*
* @param {Object}
* args
* stencil: ORYX.Core.StencilSet.Stencil | undefined
* shape: ORYX.Core.Shape | undefined
*
* At least stencil or shape has to be specified
*
* @return {Array} Array of stencils that the passed stencil/shape can be
* transformed to (including the current stencil itself)
*/
morphStencils: function(args) {
// check arguments
if(!args.stencil && !args.shape) {
return [];
}
// init arguments
if(args.shape) {
args.stencil = args.shape.getStencil();
}
var _morphStencils = [];
args.stencil.roles().each(function(role) {
this._cacheMorph(role).each(function(stencil) {
_morphStencils.push(stencil);
})
}.bind(this));
return _morphStencils.uniq();
},
/**
* @return {Array} An array of all base morph stencils
*/
baseMorphs: function() {
var _baseMorphs = [];
this._morphingRules.each(function(pair) {
pair.value.each(function(baseMorph) {
_baseMorphs.push(baseMorph);
});
});
return _baseMorphs;
},
/**
* Returns true if there are morphing rules defines
* @return {boolean}
*/
containsMorphingRules: function(){
return this._stencilSets.any(function(ss){ return !!ss.jsonRules().morphingRules});
},
/**
*
* @param {Object}
* args
* sourceStencil:
* ORYX.Core.StencilSet.Stencil | undefined
* sourceShape:
* ORYX.Core.Node |undefined
* targetStencil:
* ORYX.Core.StencilSet.Stencil | undefined
* targetShape:
* ORYX.Core.Node |undefined
*
*
* @return {Stencil} Returns, the stencil for the connecting edge
* or null if connection is not possible
*/
connectMorph: function(args) {
// check arguments
if(!args ||
(!args.sourceShape && !args.sourceStencil &&
!args.targetShape && !args.targetStencil)) {
return false;
}
// init arguments
if(args.sourceShape) {
args.sourceStencil = args.sourceShape.getStencil();
}
if(args.targetShape) {
args.targetStencil = args.targetShape.getStencil();
}
var incoming = this.incomingEdgeStencils(args);
var outgoing = this.outgoingEdgeStencils(args);
var edgeStencils = incoming.select(function(e) { return outgoing.member(e); }); // intersection of sets
var baseEdgeStencils = this.baseMorphs().select(function(e) { return edgeStencils.member(e); }); // again: intersection of sets
if(baseEdgeStencils.size()>0)
return baseEdgeStencils[0]; // return any of the possible base morphs
else if(edgeStencils.size()>0)
return edgeStencils[0]; // return any of the possible stencils
return null; //connection not possible
},
/**
* Return true if the stencil should be located in the shape menu
* @param {ORYX.Core.StencilSet.Stencil} morph
* @return {Boolean} Returns true if the morphs in the morph group of the
* specified morph shall be displayed in the shape menu
*/
showInShapeMenu: function(stencil) {
return this._stencilSets.any(function(ss){
return ss.jsonRules().morphingRules
.any(function(r){
return stencil.roles().include(ss.namespace() + r.role)
&& r.showInShapeMenu !== false;
})
});
},
preserveBounds: function(stencil) {
return this._stencilSets.any(function(ss) {
return ss.jsonRules().morphingRules.any(function(r) {
return stencil.roles().include(ss.namespace() + r.role)
&& r.preserveBounds;
})
})
},
/** End morphing rules' methods */
/** Begin layouting rules' methods */
/**
* Returns a set on "in" and "out" layouting rules for a given shape
* @param {Object} shape
* @param {Object} edgeShape (Optional)
* @return {Object} "in" and "out" with a default value of {"t":1, "r":1, "b":1, "r":1} if not specified in the json
*/
getLayoutingRules : function(shape, edgeShape){
if (!shape||!(shape instanceof ORYX.Core.Shape)){ return }
var layout = {"in":{},"out":{}};
var parseValues = function(o, v){
if (o && o[v]){
["t","r","b","l"].each(function(d){
layout[v][d]=Math.max(o[v][d],layout[v][d]||0);
});
}
if (o && o[v+"s"] instanceof Array){
["t","r","b","l"].each(function(d){
var defaultRule = o[v+"s"].find(function(e){ return !e.edgeRole });
var edgeRule;
if (edgeShape instanceof ORYX.Core.Edge) {
edgeRule = o[v + "s"].find(function(e){return this._hasRole(edgeShape, e.edgeRole) }.bind(this));
}
layout[v][d]=Math.max(edgeRule?edgeRule[d]:defaultRule[d],layout[v][d]||0);
}.bind(this));
}
}.bind(this)
// For each role
shape.getStencil().roles().each(function(role) {
// check if there are layout information
if (this._layoutRules[role]){
// if so, parse those information to the 'layout' variable
parseValues(this._layoutRules[role], "in");
parseValues(this._layoutRules[role], "out");
}
}.bind(this));
// Make sure, that every attribute has an value,
// otherwise set 1
["in","out"].each(function(v){
["t","r","b","l"].each(function(d){
layout[v][d]=layout[v][d]!==undefined?layout[v][d]:1;
});
})
return layout;
},
/** End layouting rules' methods */
/** Helper methods */
/**
* Checks wether a shape contains the given role or the role is equal the stencil id
* @param {ORYX.Core.Shape} shape
* @param {String} role
*/
_hasRole: function(shape, role){
if (!(shape instanceof ORYX.Core.Shape)||!role){ return }
var isRole = shape.getStencil().roles().any(function(r){ return r == role});
return isRole || shape.getStencil().id() == (shape.getStencil().namespace()+role);
},
/**
*
* @param {String}
* role
*
* @return {Array} Returns an array of stencils that can act as role.
*/
_stencilsWithRole: function(role) {
return this._stencils.findAll(function(stencil) {
return (stencil.roles().member(role)) ? true : false;
});
},
/**
*
* @param {String}
* role
*
* @return {Array} Returns an array of stencils that can act as role and
* have the type 'edge'.
*/
_edgesWithRole: function(role) {
return this._stencils.findAll(function(stencil) {
return (stencil.roles().member(role) && stencil.type() === "edge") ? true : false;
});
},
/**
*
* @param {String}
* role
*
* @return {Array} Returns an array of stencils that can act as role and
* have the type 'node'.
*/
_nodesWithRole: function(role) {
return this._stencils.findAll(function(stencil) {
return (stencil.roles().member(role) && stencil.type() === "node") ? true : false;
});
},
/**
*
* @param {ORYX.Core.StencilSet.Stencil}
* parent
* @param {ORYX.Core.StencilSet.Stencil}
* child
*
* @returns {Boolean} Returns the maximum occurrence of shapes of the
* stencil's type inside the parent.
*/
_getMaximumOccurrence: function(parent, child) {
var max;
child.roles().each((function(role) {
var cardRule = this._cardinalityRules[role];
if(cardRule && cardRule.maximumOccurrence) {
if(max) {
max = Math.min(max, cardRule.maximumOccurrence);
} else {
max = cardRule.maximumOccurrence;
}
}
}).bind(this));
return max;
},
/**
*
* @param {Object}
* args sourceStencil: ORYX.Core.Node edgeStencil:
* ORYX.Core.StencilSet.Stencil
*
* @return {Boolean} Returns, the maximum number of outgoing edges of the
* type specified by edgeStencil of the sourceShape.
*/
_getMaximumNumberOfOutgoingEdge: function(args) {
if(!args ||
!args.sourceStencil ||
!args.edgeStencil) {
return false;
}
var max;
args.sourceStencil.roles().each((function(role) {
var cardRule = this._cardinalityRules[role];
if(cardRule && cardRule.outgoingEdges) {
args.edgeStencil.roles().each(function(edgeRole) {
var oe = cardRule.outgoingEdges[edgeRole];
if(oe && oe.maximum) {
if(max) {
max = Math.min(max, oe.maximum);
} else {
max = oe.maximum;
}
}
});
}
}).bind(this));
return max;
},
/**
*
* @param {Object}
* args targetStencil: ORYX.Core.StencilSet.Stencil edgeStencil:
* ORYX.Core.StencilSet.Stencil
*
* @return {Boolean} Returns the maximum number of incoming edges of the
* type specified by edgeStencil of the targetShape.
*/
_getMaximumNumberOfIncomingEdge: function(args) {
if(!args ||
!args.targetStencil ||
!args.edgeStencil) {
return false;
}
var max;
args.targetStencil.roles().each((function(role) {
var cardRule = this._cardinalityRules[role];
if(cardRule && cardRule.incomingEdges) {
args.edgeStencil.roles().each(function(edgeRole) {
var ie = cardRule.incomingEdges[edgeRole];
if(ie && ie.maximum) {
if(max) {
max = Math.min(max, ie.maximum);
} else {
max = ie.maximum;
}
}
});
}
}).bind(this));
return max;
},
/**
*
* @param {ORYX.Core.StencilSet.Stencil}
* edgeStencil
*
* @return {Hash} Returns a hash map of all connection rules for
* edgeStencil.
*/
_getConnectionRulesOfEdgeStencil: function(edgeStencil) {
var edgeRules = new Hash();
edgeStencil.roles().each((function(role) {
if(this._connectionRules[role]) {
this._connectionRules[role].each(function(cr) {
if(edgeRules[cr.key]) {
edgeRules[cr.key] = edgeRules[cr.key].concat(cr.value);
} else {
edgeRules[cr.key] = cr.value;
}
});
}
}).bind(this));
return edgeRules;
},
_isRoleOfOtherNamespace: function(role) {
return (role.indexOf("#") > 0);
},
toString: function() { return "Rules"; }
}
ORYX.Core.StencilSet.Rules = Clazz.extend(ORYX.Core.StencilSet.Rules);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespace
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};}
/**
* Class Stencil
* uses Prototpye 1.5.0
* uses Inheritance
*
* This class represents one stencil of a stencil set.
*/
ORYX.Core.StencilSet.Stencil = {
/**
* Constructor
*/
construct: function(jsonStencil, namespace, source, stencilSet, propertyPackages, defaultPosition) {
arguments.callee.$.construct.apply(this, arguments); // super();
// check arguments and set defaults.
if(!jsonStencil) throw "Stencilset seems corrupt.";
if(!namespace) throw "Stencil does not provide namespace.";
if(!source) throw "Stencil does not provide SVG source.";
if(!stencilSet) throw "Fatal internal error loading stencilset.";
//if(!propertyPackages) throw "Fatal internal error loading stencilset.";
this._source = source;
this._jsonStencil = jsonStencil;
this._stencilSet = stencilSet;
this._namespace = namespace;
this._propertyPackages = propertyPackages;
if(defaultPosition && !this._jsonStencil.position)
this._jsonStencil.position = defaultPosition;
this._view;
this._properties = new Hash();
// check stencil consistency and set defaults.
/*with(this._jsonStencil) {
if(!type) throw "Stencil does not provide type.";
if((type != "edge") && (type != "node"))
throw "Stencil type must be 'edge' or 'node'.";
if(!id || id == "") throw "Stencil does not provide valid id.";
if(!title || title == "")
throw "Stencil does not provide title";
if(!description) { description = ""; };
if(!groups) { groups = []; }
if(!roles) { roles = []; }
// add id of stencil to its roles
roles.push(id);
}*/
//init all JSON values
if(!this._jsonStencil.type || !(this._jsonStencil.type === "edge" || this._jsonStencil.type === "node")) {
throw "ORYX.Core.StencilSet.Stencil(construct): Type is not defined.";
}
if(!this._jsonStencil.id || this._jsonStencil.id === "") {
throw "ORYX.Core.StencilSet.Stencil(construct): Id is not defined.";
}
if(!this._jsonStencil.title || this._jsonStencil.title === "") {
throw "ORYX.Core.StencilSet.Stencil(construct): Title is not defined.";
}
if(!this._jsonStencil.description) { this._jsonStencil.description = ""; };
if(!this._jsonStencil.groups) { this._jsonStencil.groups = []; }
if(!this._jsonStencil.roles) { this._jsonStencil.roles = []; }
//add id of stencil to its roles
this._jsonStencil.roles.push(this._jsonStencil.id);
//prepend namespace to each role
this._jsonStencil.roles.each((function(role, index) {
this._jsonStencil.roles[index] = namespace + role;
}).bind(this));
//delete duplicate roles
this._jsonStencil.roles = this._jsonStencil.roles.uniq();
//make id unique by prepending namespace of stencil set
this._jsonStencil.id = namespace + this._jsonStencil.id;
this.postProcessProperties();
// init serialize callback
if(!this._jsonStencil.serialize) {
this._jsonStencil.serialize = {};
//this._jsonStencil.serialize = function(shape, data) { return data;};
}
// init deserialize callback
if(!this._jsonStencil.deserialize) {
this._jsonStencil.deserialize = {};
//this._jsonStencil.deserialize = function(shape, data) { return data;};
}
// init layout callback
if(!this._jsonStencil.layout) {
this._jsonStencil.layout = []
//this._jsonStencil.layout = function() {return true;}
}
//TODO does not work correctly, if the url does not exist
//How to guarantee that the view is loaded correctly before leaving the constructor???
var url = source + "view/" + jsonStencil.view;
// override content type when this is webkit.
/*
if(Prototype.Browser.WebKit) {
var req = new XMLHttpRequest;
req.open("GET", url, false);
req.overrideMimeType('text/xml');
req.send(null);
req.onload = (function() { _loadSVGOnSuccess(req.responseXML); }).bind(this);
// else just do it.
} else
*/
if(this._jsonStencil.view.trim().match(/</)) {
var parser = new DOMParser();
var xml = parser.parseFromString( this._jsonStencil.view ,"text/xml");
//check if result is a SVG document
if( ORYX.Editor.checkClassType( xml.documentElement, SVGSVGElement )) {
this._view = xml.documentElement;
//updating link to images
var imageElems = this._view.getElementsByTagNameNS("http://www.w3.org/2000/svg", "image");
$A(imageElems).each((function(imageElem) {
var link = imageElem.getAttributeNodeNS("http://www.w3.org/1999/xlink", "href");
if(link && link.value.indexOf("://") == -1) {
link.textContent = this._source + "view/" + link.value;
}
}).bind(this));
} else {
throw "ORYX.Core.StencilSet.Stencil(_loadSVGOnSuccess): The response is not a SVG document."
}
} else {
new Ajax.Request(
url, {
asynchronous:false, method:'get',
onSuccess:this._loadSVGOnSuccess.bind(this),
onFailure:this._loadSVGOnFailure.bind(this)
});
}
},
postProcessProperties: function() {
// add image path to icon
if(this._jsonStencil.icon && this._jsonStencil.icon.indexOf("://") === -1) {
this._jsonStencil.icon = this._source + "icons/" + this._jsonStencil.icon;
} else {
this._jsonStencil.icon = "";
}
// init property packages
if(this._jsonStencil.propertyPackages && this._jsonStencil.propertyPackages instanceof Array) {
this._jsonStencil.propertyPackages.each((function(ppId) {
var pp = this._propertyPackages[ppId];
if(pp) {
pp.each((function(prop){
var oProp = new ORYX.Core.StencilSet.Property(prop, this._namespace, this);
this._properties[oProp.prefix() + "-" + oProp.id()] = oProp;
}).bind(this));
}
}).bind(this));
}
// init properties
if(this._jsonStencil.properties && this._jsonStencil.properties instanceof Array) {
this._jsonStencil.properties.each((function(prop) {
var oProp = new ORYX.Core.StencilSet.Property(prop, this._namespace, this);
this._properties[oProp.prefix() + "-" + oProp.id()] = oProp;
}).bind(this));
}
},
/**
* @param {ORYX.Core.StencilSet.Stencil} stencil
* @return {Boolean} True, if stencil has the same namespace and type.
*/
equals: function(stencil) {
return (this.id() === stencil.id());
},
stencilSet: function() {
return this._stencilSet;
},
type: function() {
return this._jsonStencil.type;
},
namespace: function() {
return this._namespace;
},
id: function() {
return this._jsonStencil.id;
},
idWithoutNs: function(){
return this.id().replace(this.namespace(),"");
},
title: function() {
return ORYX.Core.StencilSet.getTranslation(this._jsonStencil, "title");
},
description: function() {
return ORYX.Core.StencilSet.getTranslation(this._jsonStencil, "description");
},
groups: function() {
return ORYX.Core.StencilSet.getTranslation(this._jsonStencil, "groups");
},
position: function() {
return (isNaN(this._jsonStencil.position) ? 0 : this._jsonStencil.position);
},
view: function() {
return this._view.cloneNode(true) || this._view;
},
icon: function() {
return this._jsonStencil.icon;
},
bigIcon: function bigIcon() {
var bigIconURL = this.icon();
var bigIconURLStart = bigIconURL.slice(0, bigIconURL.length - 4);
var bigIconURLEnd = bigIconURL.slice(bigIconURL.length - 4, bigIconURL.length);
var bigIconURL = bigIconURLStart + "-32" + bigIconURLEnd;
return bigIconURL;
},
fixedAspectRatio: function() {
return this._jsonStencil.fixedAspectRatio === true;
},
hasMultipleRepositoryEntries: function() {
return (this.getRepositoryEntries().length > 0);
},
getRepositoryEntries: function() {
return (this._jsonStencil.repositoryEntries) ?
$A(this._jsonStencil.repositoryEntries) : $A([]);
},
properties: function() {
return this._properties.values();
},
property: function(id) {
return this._properties[id];
},
roles: function() {
return this._jsonStencil.roles;
},
defaultAlign: function() {
if(!this._jsonStencil.defaultAlign)
return "east";
return this._jsonStencil.defaultAlign;
},
serialize: function(shape, data) {
return this._jsonStencil.serialize;
//return this._jsonStencil.serialize(shape, data);
},
deserialize: function(shape, data) {
return this._jsonStencil.deserialize;
//return this._jsonStencil.deserialize(shape, data);
},
// in which case is targetShape used?
// layout: function(shape, targetShape) {
// return this._jsonStencil.layout(shape, targetShape);
// },
// layout property to store events for layouting in plugins
layout: function(shape) {
return this._jsonStencil.layout
},
addProperty: function(property, namespace) {
if(property && namespace) {
var oProp = new ORYX.Core.StencilSet.Property(property, namespace, this);
this._properties[oProp.prefix() + "-" + oProp.id()] = oProp;
}
},
removeProperty: function(propertyId) {
if(propertyId) {
var oProp = this._properties.values().find(function(prop) {
return (propertyId == prop.id());
});
if(oProp)
delete this._properties[oProp.prefix() + "-" + oProp.id()];
}
},
_loadSVGOnSuccess: function(result) {
var xml = null;
/*
* We want to get a dom object for the requested file. Unfortunately,
* safari has some issues here. this is meant as a fallback for all
* browsers that don't recognize the svg mimetype as XML but support
* data: urls on Ajax calls.
*/
// responseXML != undefined.
// if(!(result.responseXML))
// get the dom by data: url.
// xml = _evenMoreEvilHack(result.responseText, 'text/xml');
// else
// get it the usual way.
xml = result.responseXML;
//check if result is a SVG document
if( ORYX.Editor.checkClassType( xml.documentElement, SVGSVGElement )) {
this._view = xml.documentElement;
//updating link to images
var imageElems = this._view.getElementsByTagNameNS("http://www.w3.org/2000/svg", "image");
$A(imageElems).each((function(imageElem) {
var link = imageElem.getAttributeNodeNS("http://www.w3.org/1999/xlink", "href");
if(link && link.value.indexOf("://") == -1) {
link.textContent = this._source + "view/" + link.value;
}
}).bind(this));
} else {
throw "ORYX.Core.StencilSet.Stencil(_loadSVGOnSuccess): The response is not a SVG document."
}
},
_loadSVGOnFailure: function(result) {
throw "ORYX.Core.StencilSet.Stencil(_loadSVGOnFailure): Loading SVG document failed."
},
toString: function() { return "Stencil " + this.title() + " (" + this.id() + ")"; }
};
ORYX.Core.StencilSet.Stencil = Clazz.extend(ORYX.Core.StencilSet.Stencil);
/**
* Transform a string into an xml document, the Safari way, as long as
* the nightlies are broken. Even more evil version.
* @param {Object} str
* @param {Object} contentType
*/
function _evenMoreEvilHack(str, contentType) {
/*
* This even more evil hack was taken from
* http://web-graphics.com/mtarchive/001606.php#chatty004999
*/
if (window.ActiveXObject) {
var d = new ActiveXObject("MSXML.DomDocument");
d.loadXML(str);
return d;
} else if (window.XMLHttpRequest) {
var req = new XMLHttpRequest;
req.open("GET", "data:" + (contentType || "application/xml") +
";charset=utf-8," + encodeURIComponent(str), false);
if (req.overrideMimeType) {
req.overrideMimeType(contentType);
}
req.send(null);
return req.responseXML;
}
}
/**
* Transform a string into an xml document, the Safari way, as long as
* the nightlies are broken.
* @param {Object} result the xml document object.
*/
function _evilSafariHack(serializedXML) {
/*
* The Dave way. Taken from:
* http://web-graphics.com/mtarchive/001606.php
*
* There is another possibility to parse XML in Safari, by implementing
* the DOMParser in javascript. However, in the latest nightlies of
* WebKit, DOMParser is already available, but still buggy. So, this is
* the best compromise for the time being.
*/
var xml = serializedXML;
var url = "data:text/xml;charset=utf-8," + encodeURIComponent(xml);
var dom = null;
// your standard AJAX stuff
var req = new XMLHttpRequest();
req.open("GET", url);
req.onload = function() { dom = req.responseXML; }
req.send(null);
return dom;
}
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};}
/**
* Class Stencil
* uses Prototpye 1.5.0
* uses Inheritance
*/
ORYX.Core.StencilSet.ComplexPropertyItem = Clazz.extend({
/**
* Constructor
*/
construct: function(jsonItem, namespace, property) {
arguments.callee.$.construct.apply(this, arguments);
if(!jsonItem) {
throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Parameter jsonItem is not defined.";
}
if(!namespace) {
throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Parameter namespace is not defined.";
}
if(!property) {
throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Parameter property is not defined.";
}
this._jsonItem = jsonItem;
this._namespace = namespace;
this._property = property;
this._items = new Hash();
//init all values
if(!jsonItem.name) {
throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Name is not defined.";
}
if(!jsonItem.type) {
throw "ORYX.Core.StencilSet.ComplexPropertyItem(construct): Type is not defined.";
} else {
jsonItem.type = jsonItem.type.toLowerCase();
}
if(jsonItem.type === ORYX.CONFIG.TYPE_CHOICE) {
if(jsonItem.items && jsonItem.items instanceof Array) {
jsonItem.items.each((function(item) {
this._items[item.value] = new ORYX.Core.StencilSet.PropertyItem(item, namespace, this);
}).bind(this));
} else {
throw "ORYX.Core.StencilSet.Property(construct): No property items defined."
}
}
},
/**
* @param {ORYX.Core.StencilSet.PropertyItem} item
* @return {Boolean} True, if item has the same namespace and id.
*/
equals: function(item) {
return (this.property().equals(item.property()) &&
this.name() === item.name());
},
namespace: function() {
return this._namespace;
},
property: function() {
return this._property;
},
name: function() {
return ORYX.Core.StencilSet.getTranslation(this._jsonItem, "name");
},
id: function() {
return this._jsonItem.id;
},
type: function() {
return this._jsonItem.type;
},
optional: function() {
return this._jsonItem.optional;
},
width: function() {
return this._jsonItem.width;
},
value: function() {
return this._jsonItem.value;
},
items: function() {
return this._items.values();
},
disable: function() {
return this._jsonItem.disable;
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespace
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};}
/**
* Class StencilSets
* uses Prototpye 1.5.0
* uses Inheritance
*
* Singleton
*/
//storage for loaded stencil sets by namespace
ORYX.Core.StencilSet._stencilSetsByNamespace = new Hash();
//storage for stencil sets by url
ORYX.Core.StencilSet._stencilSetsByUrl = new Hash();
//storage for stencil set namespaces by editor instances
ORYX.Core.StencilSet._StencilSetNSByEditorInstance = new Hash();
//storage for rules by editor instances
ORYX.Core.StencilSet._rulesByEditorInstance = new Hash();
/**
*
* @param {String} editorId
*
* @return {Hash} Returns a hash map with all stencil sets that are loaded by
* the editor with the editorId.
*/
ORYX.Core.StencilSet.stencilSets = function(editorId) {
var stencilSetNSs = ORYX.Core.StencilSet._StencilSetNSByEditorInstance[editorId];
var stencilSets = new Hash();
if(stencilSetNSs) {
stencilSetNSs.each(function(stencilSetNS) {
var stencilSet = ORYX.Core.StencilSet.stencilSet(stencilSetNS)
stencilSets[stencilSet.namespace()] = stencilSet;
});
}
return stencilSets;
};
/**
*
* @param {String} namespace
*
* @return {ORYX.Core.StencilSet.StencilSet} Returns the stencil set with the specified
* namespace.
*
* The method can handle namespace strings like
* http://www.example.org/stencilset
* http://www.example.org/stencilset#
* http://www.example.org/stencilset#ANode
*/
ORYX.Core.StencilSet.stencilSet = function(namespace) {
ORYX.Log.trace("Getting stencil set %0", namespace);
var splitted = namespace.split("#", 1);
if(splitted.length === 1) {
ORYX.Log.trace("Getting stencil set %0", splitted[0]);
return ORYX.Core.StencilSet._stencilSetsByNamespace[splitted[0] + "#"];
} else {
return undefined;
}
};
/**
*
* @param {String} id
*
* @return {ORYX.Core.StencilSet.Stencil} Returns the stencil specified by the id.
*
* The id must be unique and contains the namespace of the stencil's stencil set.
* e.g. http://www.example.org/stencilset#ANode
*/
ORYX.Core.StencilSet.stencil = function(id) {
ORYX.Log.trace("Getting stencil for %0", id);
var ss = ORYX.Core.StencilSet.stencilSet(id);
if(ss) {
return ss.stencil(id);
} else {
ORYX.Log.trace("Cannot fild stencil for %0", id);
return undefined;
}
};
/**
*
* @param {String} editorId
*
* @return {ORYX.Core.StencilSet.Rules} Returns the rules object for the editor
* specified by its editor id.
*/
ORYX.Core.StencilSet.rules = function(editorId) {
if(!ORYX.Core.StencilSet._rulesByEditorInstance[editorId]) {
ORYX.Core.StencilSet._rulesByEditorInstance[editorId] = new ORYX.Core.StencilSet.Rules();;
}
return ORYX.Core.StencilSet._rulesByEditorInstance[editorId];
};
/**
*
* @param {String} url
* @param {String} editorId
*
* Loads a stencil set from url, if it is not already loaded.
* It also stores which editor instance loads the stencil set and
* initializes the Rules object for the editor instance.
*/
ORYX.Core.StencilSet.loadStencilSet = function(url, editorId) {
var stencilSet = ORYX.Core.StencilSet._stencilSetsByUrl[url];
if(!stencilSet) {
//load stencil set
stencilSet = new ORYX.Core.StencilSet.StencilSet(url);
//store stencil set
ORYX.Core.StencilSet._stencilSetsByNamespace[stencilSet.namespace()] = stencilSet;
//store stencil set by url
ORYX.Core.StencilSet._stencilSetsByUrl[url] = stencilSet;
}
var namespace = stencilSet.namespace();
//store which editorInstance loads the stencil set
if(ORYX.Core.StencilSet._StencilSetNSByEditorInstance[editorId]) {
ORYX.Core.StencilSet._StencilSetNSByEditorInstance[editorId].push(namespace);
} else {
ORYX.Core.StencilSet._StencilSetNSByEditorInstance[editorId] = [namespace];
}
//store the rules for the editor instance
if(ORYX.Core.StencilSet._rulesByEditorInstance[editorId]) {
ORYX.Core.StencilSet._rulesByEditorInstance[editorId].initializeRules(stencilSet);
} else {
var rules = new ORYX.Core.StencilSet.Rules();
rules.initializeRules(stencilSet);
ORYX.Core.StencilSet._rulesByEditorInstance[editorId] = rules;
}
};
/**
* Returns the translation of an attribute in jsonObject specified by its name
* according to navigator.language
*/
ORYX.Core.StencilSet.getTranslation = function(jsonObject, name) {
var lang = ORYX.I18N.Language.toLowerCase();
var result = jsonObject[name + "_" + lang];
if(result)
return result;
result = jsonObject[name + "_" + lang.substr(0, 2)];
if(result)
return result;
return jsonObject[name];
};
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespace
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.StencilSet) {ORYX.Core.StencilSet = {};}
/**
* Class Stencil
* uses Prototpye 1.5.0
* uses Inheritance
*/
ORYX.Core.StencilSet.PropertyItem = Clazz.extend({
/**
* Constructor
*/
construct: function(jsonItem, namespace, property) {
arguments.callee.$.construct.apply(this, arguments);
if(!jsonItem) {
throw "ORYX.Core.StencilSet.PropertyItem(construct): Parameter jsonItem is not defined.";
}
if(!namespace) {
throw "ORYX.Core.StencilSet.PropertyItem(construct): Parameter namespace is not defined.";
}
if(!property) {
throw "ORYX.Core.StencilSet.PropertyItem(construct): Parameter property is not defined.";
}
this._jsonItem = jsonItem;
this._namespace = namespace;
this._property = property;
//init all values
if(!jsonItem.value) {
throw "ORYX.Core.StencilSet.PropertyItem(construct): Value is not defined.";
}
if(this._jsonItem.refToView) {
if(!(this._jsonItem.refToView instanceof Array)) {
this._jsonItem.refToView = [this._jsonItem.refToView];
}
} else {
this._jsonItem.refToView = [];
}
},
/**
* @param {ORYX.Core.StencilSet.PropertyItem} item
* @return {Boolean} True, if item has the same namespace and id.
*/
equals: function(item) {
return (this.property().equals(item.property()) &&
this.value() === item.value());
},
namespace: function() {
return this._namespace;
},
property: function() {
return this._property;
},
value: function() {
return this._jsonItem.value;
},
title: function() {
return ORYX.Core.StencilSet.getTranslation(this._jsonItem, "title");
},
refToView: function() {
return this._jsonItem.refToView;
},
icon: function() {
return (this._jsonItem.icon) ? this.property().stencil()._source + "icons/" + this._jsonItem.icon : "";
},
toString: function() { return "PropertyItem " + this.property() + " (" + this.value() + ")"; }
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespace
*/
if (!ORYX) {
var ORYX = {};
}
if (!ORYX.Core) {
ORYX.Core = {};
}
if (!ORYX.Core.StencilSet) {
ORYX.Core.StencilSet = {};
}
/**
* Class Property
* uses Prototpye 1.5.0
* uses Inheritance
*/
ORYX.Core.StencilSet.Property = Clazz.extend({
/**
* Constructor
*/
construct: function(jsonProp, namespace, stencil){
arguments.callee.$.construct.apply(this, arguments);
this._jsonProp = jsonProp || ORYX.Log.error("Parameter jsonProp is not defined.");
this._namespace = namespace || ORYX.Log.error("Parameter namespace is not defined.");
this._stencil = stencil || ORYX.Log.error("Parameter stencil is not defined.");
this._items = new Hash();
this._complexItems = new Hash();
jsonProp.id = jsonProp.id || ORYX.Log.error("ORYX.Core.StencilSet.Property(construct): Id is not defined.");
jsonProp.id = jsonProp.id.toLowerCase();
if (!jsonProp.type) {
ORYX.Log.info("Type is not defined for stencil '%0', id '%1'. Falling back to 'String'.", stencil, jsonProp.id);
jsonProp.type = "string";
}
else {
jsonProp.type = jsonProp.type.toLowerCase();
}
jsonProp.prefix = jsonProp.prefix || "oryx";
jsonProp.title = jsonProp.title || "";
jsonProp.value = jsonProp.value || "";
jsonProp.description = jsonProp.description || "";
jsonProp.readonly = jsonProp.readonly || false;
if(jsonProp.optional != false)
jsonProp.optional = true;
//init refToView
if (this._jsonProp.refToView) {
if (!(this._jsonProp.refToView instanceof Array)) {
this._jsonProp.refToView = [this._jsonProp.refToView];
}
}
else {
this._jsonProp.refToView = [];
}
if (jsonProp.min === undefined || jsonProp.min === null) {
jsonProp.min = Number.MIN_VALUE;
}
if (jsonProp.max === undefined || jsonProp.max === null) {
jsonProp.max = Number.MAX_VALUE;
}
if (!jsonProp.fillOpacity) {
jsonProp.fillOpacity = false;
}
if (!jsonProp.strokeOpacity) {
jsonProp.strokeOpacity = false;
}
if (jsonProp.length === undefined || jsonProp.length === null) {
jsonProp.length = Number.MAX_VALUE;
}
if (!jsonProp.wrapLines) {
jsonProp.wrapLines = false;
}
if (!jsonProp.dateFormat) {
jsonProp.dataFormat = "m/d/y";
}
if (!jsonProp.fill) {
jsonProp.fill = false;
}
if (!jsonProp.stroke) {
jsonProp.stroke = false;
}
if(!jsonProp.inverseBoolean) {
jsonProp.inverseBoolean = false;
}
if(!jsonProp.directlyEditable && jsonProp.directlyEditable != false) {
jsonProp.directlyEditable = true;
}
if(jsonProp.visible !== false) {
jsonProp.visible = true;
}
if(!jsonProp.popular) {
jsonProp.popular = false;
}
if (jsonProp.type === ORYX.CONFIG.TYPE_CHOICE) {
if (jsonProp.items && jsonProp.items instanceof Array) {
jsonProp.items.each((function(jsonItem){
// why is the item's value used as the key???
this._items[jsonItem.value] = new ORYX.Core.StencilSet.PropertyItem(jsonItem, namespace, this);
}).bind(this));
}
else {
throw "ORYX.Core.StencilSet.Property(construct): No property items defined."
}
// extended by Kerstin (start)
}
else
if (jsonProp.type === ORYX.CONFIG.TYPE_COMPLEX) {
if (jsonProp.complexItems && jsonProp.complexItems instanceof Array) {
jsonProp.complexItems.each((function(jsonComplexItem){
this._complexItems[jsonComplexItem.id] = new ORYX.Core.StencilSet.ComplexPropertyItem(jsonComplexItem, namespace, this);
}).bind(this));
}
else {
throw "ORYX.Core.StencilSet.Property(construct): No complex property items defined."
}
}
// extended by Kerstin (end)
},
/**
* @param {ORYX.Core.StencilSet.Property} property
* @return {Boolean} True, if property has the same namespace and id.
*/
equals: function(property){
return (this._namespace === property.namespace() &&
this.id() === property.id()) ? true : false;
},
namespace: function(){
return this._namespace;
},
stencil: function(){
return this._stencil;
},
id: function(){
return this._jsonProp.id;
},
prefix: function(){
return this._jsonProp.prefix;
},
type: function(){
return this._jsonProp.type;
},
inverseBoolean: function() {
return this._jsonProp.inverseBoolean;
},
popular: function() {
return this._jsonProp.popular;
},
setPopular: function() {
this._jsonProp.popular = true;
},
directlyEditable: function() {
return this._jsonProp.directlyEditable;
},
visible: function() {
return this._jsonProp.visible;
},
title: function(){
return ORYX.Core.StencilSet.getTranslation(this._jsonProp, "title");
},
value: function(){
return this._jsonProp.value;
},
readonly: function(){
return this._jsonProp.readonly;
},
optional: function(){
return this._jsonProp.optional;
},
description: function(){
return ORYX.Core.StencilSet.getTranslation(this._jsonProp, "description");
},
/**
* An optional link to a SVG element so that the property affects the
* graphical representation of the stencil.
*/
refToView: function(){
return this._jsonProp.refToView;
},
/**
* If type is integer or float, min is the lower bounds of value.
*/
min: function(){
return this._jsonProp.min;
},
/**
* If type ist integer or float, max is the upper bounds of value.
*/
max: function(){
return this._jsonProp.max;
},
/**
* If type is float, this method returns if the fill-opacity property should
* be set.
* @return {Boolean}
*/
fillOpacity: function(){
return this._jsonProp.fillOpacity;
},
/**
* If type is float, this method returns if the stroke-opacity property should
* be set.
* @return {Boolean}
*/
strokeOpacity: function(){
return this._jsonProp.strokeOpacity;
},
/**
* If type is string or richtext, length is the maximum length of the text.
* TODO how long can a string be.
*/
length: function(){
return this._jsonProp.length ? this._jsonProp.length : Number.MAX_VALUE;
},
wrapLines: function(){
return this._jsonProp.wrapLines;
},
/**
* If type is date, dateFormat specifies the format of the date. The format
* specification of the ext library is used:
*
* Format Output Description
* ------ ---------- --------------------------------------------------------------
* d 10 Day of the month, 2 digits with leading zeros
* D Wed A textual representation of a day, three letters
* j 10 Day of the month without leading zeros
* l Wednesday A full textual representation of the day of the week
* S th English ordinal day of month suffix, 2 chars (use with j)
* w 3 Numeric representation of the day of the week
* z 9 The julian date, or day of the year (0-365)
* W 01 ISO-8601 2-digit week number of year, weeks starting on Monday (00-52)
* F January A full textual representation of the month
* m 01 Numeric representation of a month, with leading zeros
* M Jan Month name abbreviation, three letters
* n 1 Numeric representation of a month, without leading zeros
* t 31 Number of days in the given month
* L 0 Whether its a leap year (1 if it is a leap year, else 0)
* Y 2007 A full numeric representation of a year, 4 digits
* y 07 A two digit representation of a year
* a pm Lowercase Ante meridiem and Post meridiem
* A PM Uppercase Ante meridiem and Post meridiem
* g 3 12-hour format of an hour without leading zeros
* G 15 24-hour format of an hour without leading zeros
* h 03 12-hour format of an hour with leading zeros
* H 15 24-hour format of an hour with leading zeros
* i 05 Minutes with leading zeros
* s 01 Seconds, with leading zeros
* O -0600 Difference to Greenwich time (GMT) in hours
* T CST Timezone setting of the machine running the code
* Z -21600 Timezone offset in seconds (negative if west of UTC, positive if east)
*
* Example:
* F j, Y, g:i a -> January 10, 2007, 3:05 pm
*/
dateFormat: function(){
return this._jsonProp.dateFormat;
},
/**
* If type is color, this method returns if the fill property should
* be set.
* @return {Boolean}
*/
fill: function(){
return this._jsonProp.fill;
},
/**
* If type is color, this method returns if the stroke property should
* be set.
* @return {Boolean}
*/
stroke: function(){
return this._jsonProp.stroke;
},
/**
* If type is choice, items is a hash map with all alternative values
* (PropertyItem objects) with id as keys.
*/
items: function(){
return this._items.values();
},
item: function(value){
return this._items[value];
},
toString: function(){
return "Property " + this.title() + " (" + this.id() + ")";
},
// extended by Kerstin (start)
complexItems: function(){
return this._complexItems.values();
},
complexItem: function(id){
return this._complexItems[id];
},
// extended by Kerstin (end)
complexAttributeToView: function(){
return this._jsonProp.complexAttributeToView || "";
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};}
/**
* MinMaxPathHandler
*
* Determine the minimum and maximum of a SVG path's absolute coordinates.
* For relative coordinates the absolute value is computed for consideration.
* The values are stored in attributes minX, minY, maxX, and maxY.
*
* @constructor
*/
ORYX.Core.SVG.MinMaxPathHandler = Clazz.extend({
construct: function() {
arguments.callee.$.construct.apply(this, arguments);
this.minX = undefined;
this.minY = undefined;
this.maxX = undefined;
this.maxY = undefined;
this._lastAbsX = undefined;
this._lastAbsY = undefined;
},
/**
* Store minimal and maximal coordinates of passed points to attributes minX, maxX, minY, maxY
*
* @param {Array} points Array of absolutePoints
*/
calculateMinMax: function(points) {
if(points instanceof Array) {
var x, y;
for(var i = 0; i < points.length; i++) {
x = parseFloat(points[i]);
i++;
y = parseFloat(points[i]);
this.minX = (this.minX !== undefined) ? Math.min(this.minX, x) : x;
this.maxX = (this.maxX !== undefined) ? Math.max(this.maxX, x) : x;
this.minY = (this.minY !== undefined) ? Math.min(this.minY, y) : y;
this.maxY = (this.maxY !== undefined) ? Math.max(this.maxY, y) : y;
this._lastAbsX = x;
this._lastAbsY = y;
}
} else {
//TODO error
}
},
/**
* arcAbs - A
*
* @param {Number} rx
* @param {Number} ry
* @param {Number} xAxisRotation
* @param {Boolean} largeArcFlag
* @param {Boolean} sweepFlag
* @param {Number} x
* @param {Number} y
*/
arcAbs: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
this.calculateMinMax([x, y]);
},
/**
* arcRel - a
*
* @param {Number} rx
* @param {Number} ry
* @param {Number} xAxisRotation
* @param {Boolean} largeArcFlag
* @param {Boolean} sweepFlag
* @param {Number} x
* @param {Number} y
*/
arcRel: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
this.calculateMinMax([this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* curvetoCubicAbs - C
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicAbs: function(x1, y1, x2, y2, x, y) {
this.calculateMinMax([x1, y1, x2, y2, x, y]);
},
/**
* curvetoCubicRel - c
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicRel: function(x1, y1, x2, y2, x, y) {
this.calculateMinMax([this._lastAbsX + x1, this._lastAbsY + y1,
this._lastAbsX + x2, this._lastAbsY + y2,
this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* linetoHorizontalAbs - H
*
* @param {Number} x
*/
linetoHorizontalAbs: function(x) {
this.calculateMinMax([x, this._lastAbsY]);
},
/**
* linetoHorizontalRel - h
*
* @param {Number} x
*/
linetoHorizontalRel: function(x) {
this.calculateMinMax([this._lastAbsX + x, this._lastAbsY]);
},
/**
* linetoAbs - L
*
* @param {Number} x
* @param {Number} y
*/
linetoAbs: function(x, y) {
this.calculateMinMax([x, y]);
},
/**
* linetoRel - l
*
* @param {Number} x
* @param {Number} y
*/
linetoRel: function(x, y) {
this.calculateMinMax([this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* movetoAbs - M
*
* @param {Number} x
* @param {Number} y
*/
movetoAbs: function(x, y) {
this.calculateMinMax([x, y]);
},
/**
* movetoRel - m
*
* @param {Number} x
* @param {Number} y
*/
movetoRel: function(x, y) {
if(this._lastAbsX && this._lastAbsY) {
this.calculateMinMax([this._lastAbsX + x, this._lastAbsY + y]);
} else {
this.calculateMinMax([x, y]);
}
},
/**
* curvetoQuadraticAbs - Q
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticAbs: function(x1, y1, x, y) {
this.calculateMinMax([x1, y1, x, y]);
},
/**
* curvetoQuadraticRel - q
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticRel: function(x1, y1, x, y) {
this.calculateMinMax([this._lastAbsX + x1, this._lastAbsY + y1, this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* curvetoCubicSmoothAbs - S
*
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicSmoothAbs: function(x2, y2, x, y) {
this.calculateMinMax([x2, y2, x, y]);
},
/**
* curvetoCubicSmoothRel - s
*
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicSmoothRel: function(x2, y2, x, y) {
this.calculateMinMax([this._lastAbsX + x2, this._lastAbsY + y2, this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* curvetoQuadraticSmoothAbs - T
*
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticSmoothAbs: function(x, y) {
this.calculateMinMax([x, y]);
},
/**
* curvetoQuadraticSmoothRel - t
*
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticSmoothRel: function(x, y) {
this.calculateMinMax([this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* linetoVerticalAbs - V
*
* @param {Number} y
*/
linetoVerticalAbs: function(y) {
this.calculateMinMax([this._lastAbsX, y]);
},
/**
* linetoVerticalRel - v
*
* @param {Number} y
*/
linetoVerticalRel: function(y) {
this.calculateMinMax([this._lastAbsX, this._lastAbsY + y]);
},
/**
* closePath - z or Z
*/
closePath: function() {
return;// do nothing
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};}
/**
* PathHandler
*
* Determine absolute points of a SVG path. The coordinates are stored
* sequentially in the attribute points (x-coordinates at even indices,
* y-coordinates at odd indices).
*
* @constructor
*/
ORYX.Core.SVG.PointsPathHandler = Clazz.extend({
construct: function() {
arguments.callee.$.construct.apply(this, arguments);
this.points = [];
this._lastAbsX = undefined;
this._lastAbsY = undefined;
},
/**
* addPoints
*
* @param {Array} points Array of absolutePoints
*/
addPoints: function(points) {
if(points instanceof Array) {
var x, y;
for(var i = 0; i < points.length; i++) {
x = parseFloat(points[i]);
i++;
y = parseFloat(points[i]);
this.points.push(x);
this.points.push(y);
//this.points.push({x:x, y:y});
this._lastAbsX = x;
this._lastAbsY = y;
}
} else {
//TODO error
}
},
/**
* arcAbs - A
*
* @param {Number} rx
* @param {Number} ry
* @param {Number} xAxisRotation
* @param {Boolean} largeArcFlag
* @param {Boolean} sweepFlag
* @param {Number} x
* @param {Number} y
*/
arcAbs: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
this.addPoints([x, y]);
},
/**
* arcRel - a
*
* @param {Number} rx
* @param {Number} ry
* @param {Number} xAxisRotation
* @param {Boolean} largeArcFlag
* @param {Boolean} sweepFlag
* @param {Number} x
* @param {Number} y
*/
arcRel: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
this.addPoints([this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* curvetoCubicAbs - C
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicAbs: function(x1, y1, x2, y2, x, y) {
this.addPoints([x, y]);
},
/**
* curvetoCubicRel - c
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicRel: function(x1, y1, x2, y2, x, y) {
this.addPoints([this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* linetoHorizontalAbs - H
*
* @param {Number} x
*/
linetoHorizontalAbs: function(x) {
this.addPoints([x, this._lastAbsY]);
},
/**
* linetoHorizontalRel - h
*
* @param {Number} x
*/
linetoHorizontalRel: function(x) {
this.addPoints([this._lastAbsX + x, this._lastAbsY]);
},
/**
* linetoAbs - L
*
* @param {Number} x
* @param {Number} y
*/
linetoAbs: function(x, y) {
this.addPoints([x, y]);
},
/**
* linetoRel - l
*
* @param {Number} x
* @param {Number} y
*/
linetoRel: function(x, y) {
this.addPoints([this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* movetoAbs - M
*
* @param {Number} x
* @param {Number} y
*/
movetoAbs: function(x, y) {
this.addPoints([x, y]);
},
/**
* movetoRel - m
*
* @param {Number} x
* @param {Number} y
*/
movetoRel: function(x, y) {
if(this._lastAbsX && this._lastAbsY) {
this.addPoints([this._lastAbsX + x, this._lastAbsY + y]);
} else {
this.addPoints([x, y]);
}
},
/**
* curvetoQuadraticAbs - Q
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticAbs: function(x1, y1, x, y) {
this.addPoints([x, y]);
},
/**
* curvetoQuadraticRel - q
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticRel: function(x1, y1, x, y) {
this.addPoints([this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* curvetoCubicSmoothAbs - S
*
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicSmoothAbs: function(x2, y2, x, y) {
this.addPoints([x, y]);
},
/**
* curvetoCubicSmoothRel - s
*
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicSmoothRel: function(x2, y2, x, y) {
this.addPoints([this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* curvetoQuadraticSmoothAbs - T
*
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticSmoothAbs: function(x, y) {
this.addPoints([x, y]);
},
/**
* curvetoQuadraticSmoothRel - t
*
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticSmoothRel: function(x, y) {
this.addPoints([this._lastAbsX + x, this._lastAbsY + y]);
},
/**
* linetoVerticalAbs - V
*
* @param {Number} y
*/
linetoVerticalAbs: function(y) {
this.addPoints([this._lastAbsX, y]);
},
/**
* linetoVerticalRel - v
*
* @param {Number} y
*/
linetoVerticalRel: function(y) {
this.addPoints([this._lastAbsX, this._lastAbsY + y]);
},
/**
* closePath - z or Z
*/
closePath: function() {
return;// do nothing
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};}
/**
* @classDescription Class for adding text to a shape.
*
*/
ORYX.Core.SVG.Labels = [];
ORYX.Core.SVG.Label = Clazz.extend({
_characterSets:[
"%W",
"@",
"m",
"wDGMOQÖ#+=<>~^",
"ABCHKNRSUVXZÜÄ&",
"bdghnopquxöüETY1234567890ß_§${}*´`µ€",
"aeksvyzäFLP?°²³",
"c-",
"rtJ\"/()[]:;!|\\",
"fjI., ",
"'",
"il"
],
_characterSetValues:[15,14,13,11,10,9,8,7,6,5,4,3],
/**
* Constructor
* @param options {Object} :
* textElement
*
*/
construct: function(options) {
arguments.callee.$.construct.apply(this, arguments);
ORYX.Core.SVG.Labels.push(this);
if(!options.textElement) {
throw "Label: No parameter textElement."
} else if (!ORYX.Editor.checkClassType( options.textElement, SVGTextElement ) ) {
throw "Label: Parameter textElement is not an SVGTextElement."
}
this.invisibleRenderPoint = -5000;
this.node = options.textElement;
// should in place editing be activated?
this.editable = (typeof options.editable === "undefined") ? false : options.editable;
this.eventHandler = options.eventHandler;
this.node.setAttributeNS(null, 'stroke-width', '0pt');
this.node.setAttributeNS(null, 'letter-spacing', '-0.01px');
this.shapeId = options.shapeId;
this.id;
this.fitToElemId;
this.edgePosition;
this.x;
this.y;
this.oldX;
this.oldY;
this.isVisible = true;
this._text;
this._verticalAlign;
this._horizontalAlign;
this._rotate;
this._rotationPoint;
//this.anchors = [];
this.anchorLeft;
this.anchorRight;
this.anchorTop;
this.anchorBottom;
this._isChanged = true;
//if the text element already has an id, don't change it.
var _id = this.node.getAttributeNS(null, 'id');
if(_id) {
this.id = _id;
}
//initialization
//set referenced element the text is fit to
this.fitToElemId = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'fittoelem');
if(this.fitToElemId)
this.fitToElemId = this.shapeId + this.fitToElemId;
//set alignment
var alignValues = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'align');
if(alignValues) {
alignValues = alignValues.replace(/,/g, " ");
alignValues = alignValues.split(" ");
alignValues = alignValues.without("");
alignValues.each((function(alignValue) {
switch (alignValue) {
case 'top':
case 'middle':
case 'bottom':
if(!this._verticalAlign) {this._verticalAlign = alignValue;}
break;
case 'left':
case 'center':
case 'right':
if(!this._horizontalAlign) {this._horizontalAlign = alignValue;}
break;
}
}).bind(this));
}
//set edge position (only in case the label belongs to an edge)
this.edgePosition = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'edgePosition');
if(this.edgePosition) {
this.edgePosition = this.edgePosition.toLowerCase();
}
//get offset top
this.offsetTop = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'offsetTop') || ORYX.CONFIG.OFFSET_EDGE_LABEL_TOP;
if(this.offsetTop) {
this.offsetTop = parseInt(this.offsetTop);
}
//get offset top
this.offsetBottom = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'offsetBottom') || ORYX.CONFIG.OFFSET_EDGE_LABEL_BOTTOM;
if(this.offsetBottom) {
this.offsetBottom = parseInt(this.offsetBottom);
}
//set rotation
var rotateValue = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'rotate');
if(rotateValue) {
try {
this._rotate = parseFloat(rotateValue);
} catch (e) {
this._rotate = 0;
}
} else {
this._rotate = 0;
}
//anchors
var anchorAttr = this.node.getAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, "anchors");
if(anchorAttr) {
anchorAttr = anchorAttr.replace("/,/g", " ");
var anchors = anchorAttr.split(" ").without("");
for(var i = 0; i < anchors.length; i++) {
switch(anchors[i].toLowerCase()) {
case "left":
this.anchorLeft = true;
break;
case "right":
this.anchorRight = true;
break;
case "top":
this.anchorTop = true;
break;
case "bottom":
this.anchorBottom = true;
break;
}
}
}
//if no alignment defined, set default alignment
if(!this._verticalAlign) { this._verticalAlign = 'bottom'; }
if(!this._horizontalAlign) { this._horizontalAlign = 'left'; }
var xValue = this.node.getAttributeNS(null, 'x');
if(xValue) {
this.x = parseFloat(xValue);
this.oldX = this.x;
} else {
//TODO error
}
var yValue = this.node.getAttributeNS(null, 'y');
if(yValue) {
this.y = parseFloat(yValue);
this.oldY = this.y;
} else {
//TODO error
}
//set initial text
/*if (this.node.textContent == "") {
this.node.textContent = "fail";
}*/
this.text(this.node.textContent);
this.node.addEventListener("mouseover", function changeCursor() { document.body.style.cursor = "text"; }, false);
this.node.addEventListener("mouseout", function changeCursor() { document.body.style.cursor = "default"; }, false);
if (typeof this.eventHandler === "function") {
this.node.addEventListener("dblclick", function() {
this.eventHandler({
'type': ORYX.CONFIG.EVENT_LABEL_DBLCLICK,
'label': this
});
}.bind(this), false);
}
},
changed: function() {
this._isChanged = true;
},
/**
* Update the SVG text element.
*/
update: function() {
if(this._isChanged || this.x !== this.oldX || this.y !== this.oldY) {
if (this.isVisible) {
this._isChanged = false;
this.node.setAttributeNS(null, 'x', this.x);
this.node.setAttributeNS(null, 'y', this.y);
//this.node.setAttributeNS(null, 'font-size', this._fontSize);
//this.node.setAttributeNS(ORYX.CONFIG.NAMESPACE_ORYX, 'align', this._horizontalAlign + " " + this._verticalAlign);
//set horizontal alignment
switch (this._horizontalAlign) {
case 'left':
this.node.setAttributeNS(null, 'text-anchor', 'start');
break;
case 'center':
this.node.setAttributeNS(null, 'text-anchor', 'middle');
break;
case 'right':
this.node.setAttributeNS(null, 'text-anchor', 'end');
break;
}
this.oldX = this.x;
this.oldY = this.y;
//set rotation
if (this._rotate !== undefined) {
if (this._rotationPoint)
this.node.setAttributeNS(null, 'transform', 'rotate(' + this._rotate + ' ' + this._rotationPoint.x + ' ' + this._rotationPoint.y + ')');
else
this.node.setAttributeNS(null, 'transform', 'rotate(' + this._rotate + ' ' + this.x + ' ' + this.y + ')');
}
var textLines = this._text.split("\n");
while (textLines.last() == "")
textLines.pop();
this.node.textContent = "";
if (this.node.ownerDocument) {
textLines.each((function(textLine, index){
var tspan = this.node.ownerDocument.createElementNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');
tspan.textContent = textLine;
tspan.setAttributeNS(null, 'x', this.invisibleRenderPoint);
tspan.setAttributeNS(null, 'y', this.invisibleRenderPoint);
/*
* Chrome's getBBox() method fails, if a text node contains an empty tspan element.
* So, we add a whitespace to such a tspan element.
*/
if(tspan.textContent === "") {
tspan.textContent = " ";
}
//append tspan to text node
this.node.appendChild(tspan);
}).bind(this));
//Work around for Mozilla bug 293581
if (this.isVisible) {
this.node.setAttributeNS(null, 'visibility', 'hidden');
}
if (this.fitToElemId)
window.setTimeout(this._checkFittingToReferencedElem.bind(this), 0);
else
window.setTimeout(this._positionText.bind(this), 0);
}
} else {
this.node.textContent = "";
}
}
},
_checkFittingToReferencedElem: function() {
try {
var tspans = $A(this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan'));
//only do this in firefox 3. all other browsers do not support word wrapping!!!!!
//if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent) && new Number(RegExp.$1)>=3) {
var newtspans = [];
var refNode = this.node.ownerDocument.getElementById(this.fitToElemId);
if (refNode) {
var refbb = refNode.getBBox();
var fontSize = this.getFontSize();
for (var j = 0; j < tspans.length; j++) {
var tspan = tspans[j];
var textLength = this._getRenderedTextLength(tspan, undefined, undefined, fontSize);
if (textLength > refbb.width) {
var startIndex = 0;
var lastSeperatorIndex = 0;
var numOfChars = this.getTrimmedTextLength(tspan.textContent);
for (var i = 0; i < numOfChars; i++) {
var sslength = this._getRenderedTextLength(tspan, startIndex, i-startIndex, fontSize);
if (sslength > refbb.width - 2) {
var newtspan = this.node.ownerDocument.createElementNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');
if (lastSeperatorIndex <= startIndex) {
lastSeperatorIndex = (i == 0) ? i : i-1;
newtspan.textContent = tspan.textContent.slice(startIndex, lastSeperatorIndex);
//lastSeperatorIndex = i;
}
else {
newtspan.textContent = tspan.textContent.slice(startIndex, ++lastSeperatorIndex);
}
newtspan.setAttributeNS(null, 'x', this.invisibleRenderPoint);
newtspan.setAttributeNS(null, 'y', this.invisibleRenderPoint);
//insert tspan to text node
//this.node.insertBefore(newtspan, tspan);
newtspans.push(newtspan);
startIndex = lastSeperatorIndex;
}
else {
var curChar = tspan.textContent.charAt(i);
if (curChar == ' ' ||
curChar == '-' ||
curChar == "." ||
curChar == "," ||
curChar == ";" ||
curChar == ":") {
lastSeperatorIndex = i;
}
}
}
tspan.textContent = tspan.textContent.slice(startIndex);
}
newtspans.push(tspan);
}
while (this.node.hasChildNodes())
this.node.removeChild(this.node.childNodes[0]);
while (newtspans.length > 0) {
this.node.appendChild(newtspans.shift());
}
}
//}
} catch (e) {
//console.log(e);
}
window.setTimeout(this._positionText.bind(this), 0);
},
/**
* This is a work around method for Mozilla bug 293581.
* Before the method getComputedTextLength works, the text has to be rendered.
*/
_positionText: function() {
try {
var tspans = this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');
var fontSize = this.getFontSize(this.node);
var invalidTSpans = [];
$A(tspans).each((function(tspan, index){
if(tspan.textContent.trim() === "") {
invalidTSpans.push(tspan);
} else {
//set vertical position
var dy = 0;
switch (this._verticalAlign) {
case 'bottom':
dy = -(tspans.length - index - 1) * (fontSize);
break;
case 'middle':
dy = -(tspans.length / 2.0 - index - 1) * (fontSize);
dy -= ORYX.CONFIG.LABEL_LINE_DISTANCE / 2;
break;
case 'top':
dy = index * (fontSize);
dy += fontSize;
break;
}
tspan.setAttributeNS(null, 'dy', dy);
tspan.setAttributeNS(null, 'x', this.x);
tspan.setAttributeNS(null, 'y', this.y);
}
}).bind(this));
invalidTSpans.each(function(tspan) {
this.node.removeChild(tspan)
}.bind(this));
} catch(e) {
//console.log(e);
this._isChanged = true;
}
if(this.isVisible) {
this.node.setAttributeNS(null, 'visibility', 'inherit');
}
},
/**
* Returns the text length of the text content of an SVG tspan element.
* For all browsers but Firefox 3 the values are estimated.
* @param {TSpanSVGElement} tspan
* @param {int} startIndex Optional, for sub strings
* @param {int} endIndex Optional, for sub strings
*/
_getRenderedTextLength: function(tspan, startIndex, endIndex, fontSize) {
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent) && new Number(RegExp.$1) >= 3) {
if(typeof startIndex === "undefined") {
//test string: abcdefghijklmnopqrstuvwxyzöäü,.-#+ 1234567890ßABCDEFGHIJKLMNOPQRSTUVWXYZ;:_'*ÜÄÖ!"§$%&/()=?[]{}|<>'~´`\^°µ@€²³
// for(var i = 0; i < tspan.textContent.length; i++) {
// console.log(tspan.textContent.charAt(i), tspan.getSubStringLength(i,1), this._estimateCharacterWidth(tspan.textContent.charAt(i))*(fontSize/14.0));
// }
return tspan.getComputedTextLength();
} else {
return tspan.getSubStringLength(startIndex, endIndex);
}
} else {
if(typeof startIndex === "undefined") {
return this._estimateTextWidth(tspan.textContent, fontSize);
} else {
return this._estimateTextWidth(tspan.textContent.substr(startIndex, endIndex).trim(), fontSize);
}
}
},
/**
* Estimates the text width for a string.
* Used for word wrapping in all browser but FF3.
* @param {Object} text
*/
_estimateTextWidth: function(text, fontSize) {
var sum = 0.0;
for(var i = 0; i < text.length; i++) {
sum += this._estimateCharacterWidth(text.charAt(i));
}
return sum*(fontSize/14.0);
},
/**
* Estimates the width of a single character for font size 14.
* Used for word wrapping in all browser but FF3.
* @param {Object} character
*/
_estimateCharacterWidth: function(character) {
for(var i = 0; i < this._characterSets.length; i++) {
if(this._characterSets[i].indexOf(character) >= 0) {
return this._characterSetValues[i];
}
}
return 9;
},
getReferencedElementWidth: function() {
var refNode = this.node.ownerDocument.getElementById(this.fitToElemId);
if (refNode) {
var refbb = refNode.getBBox();
if(refbb) {
return refbb.width;
} else {
return undefined;
}
} else {
return undefined;
}
},
/**
* If no parameter is provided, this method returns the current text.
* @param text {String} Optional. Replaces the old text with this one.
*/
text: function() {
switch (arguments.length) {
case 0:
return this._text
break;
case 1:
var oldText = this._text;
if(arguments[0]) {
this._text = arguments[0].toString();
} else {
this._text = "";
}
if(oldText !== this._text) {
this._isChanged = true;
}
break;
default:
//TODO error
break;
}
},
verticalAlign: function() {
switch(arguments.length) {
case 0:
return this._verticalAlign;
case 1:
if(['top', 'middle', 'bottom'].member(arguments[0])) {
var oldValue = this._verticalAlign;
this._verticalAlign = arguments[0];
if(this._verticalAlign !== oldValue) {
this._isChanged = true;
}
}
break;
default:
//TODO error
break;
}
},
horizontalAlign: function() {
switch(arguments.length) {
case 0:
return this._horizontalAlign;
case 1:
if(['left', 'center', 'right'].member(arguments[0])) {
var oldValue = this._horizontalAlign;
this._horizontalAlign = arguments[0];
if(this._horizontalAlign !== oldValue) {
this._isChanged = true;
}
}
break;
default:
//TODO error
break;
}
},
rotate: function() {
switch(arguments.length) {
case 0:
return this._rotate;
case 1:
if (this._rotate != arguments[0]) {
this._rotate = arguments[0];
this._rotationPoint = undefined;
this._isChanged = true;
}
case 2:
if(this._rotate != arguments[0] ||
!this._rotationPoint ||
this._rotationPoint.x != arguments[1].x ||
this._rotationPoint.y != arguments[1].y) {
this._rotate = arguments[0];
this._rotationPoint = arguments[1];
this._isChanged = true;
}
}
},
hide: function() {
if(this.isVisible) {
this.isVisible = false;
this._isChanged = true;
}
},
show: function() {
if(!this.isVisible) {
this.isVisible = true;
this._isChanged = true;
}
},
/**
* iterates parent nodes till it finds a SVG font-size
* attribute.
* @param {SVGElement} node
*/
getInheritedFontSize: function(node) {
if(!node || !node.getAttributeNS)
return;
var attr = node.getAttributeNS(null, "font-size");
if(attr) {
return parseFloat(attr);
} else if(!ORYX.Editor.checkClassType(node, SVGSVGElement)) {
return this.getInheritedFontSize(node.parentNode);
}
},
getFontSize: function(node) {
var tspans = this.node.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan');
//trying to get an inherited font-size attribute
//NO CSS CONSIDERED!
var fontSize = this.getInheritedFontSize(this.node);
if (!fontSize) {
//because this only works in firefox 3, all other browser use the default line height
if (tspans[0] && /Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent) && new Number(RegExp.$1) >= 3) {
fontSize = tspans[0].getExtentOfChar(0).height;
}
else {
fontSize = ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT;
}
//handling of unsupported method in webkit
if (fontSize <= 0) {
fontSize = ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT;
}
}
if(fontSize)
this.node.setAttribute("oryx:fontSize", fontSize);
return fontSize;
},
/**
* Get trimmed text length for use with
* getExtentOfChar and getSubStringLength.
* @param {String} text
*/
getTrimmedTextLength: function(text) {
text = text.strip().gsub(' ', ' ');
var oldLength;
do {
oldLength = text.length;
text = text.gsub(' ', ' ');
} while (oldLength > text.length);
return text.length;
},
/**
* Returns the offset from
* edge to the label which is
* positioned under the edge
* @return {int}
*/
getOffsetBottom: function(){
return this.offsetBottom;
},
/**
* Returns the offset from
* edge to the label which is
* positioned over the edge
* @return {int}
*/
getOffsetTop: function(){
return this.offsetTop;
},
toString: function() { return "Label " + this.id }
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};}
/**
* EditPathHandler
*
* Edit SVG paths' coordinates according to specified from-to movement and
* horizontal and vertical scaling factors.
* The resulting path's d attribute is stored in instance variable d.
*
* @constructor
*/
ORYX.Core.SVG.EditPathHandler = Clazz.extend({
construct: function() {
arguments.callee.$.construct.apply(this, arguments);
this.x = 0;
this.y = 0;
this.oldX = 0;
this.oldY = 0;
this.deltaWidth = 1;
this.deltaHeight = 1;
this.d = "";
},
/**
* init
*
* @param {float} x Target point's x-coordinate
* @param {float} y Target point's y-coordinate
* @param {float} oldX Reference point's x-coordinate
* @param {float} oldY Reference point's y-coordinate
* @param {float} deltaWidth Horizontal scaling factor
* @param {float} deltaHeight Vertical scaling factor
*/
init: function(x, y, oldX, oldY, deltaWidth, deltaHeight) {
this.x = x;
this.y = y;
this.oldX = oldX;
this.oldY = oldY;
this.deltaWidth = deltaWidth;
this.deltaHeight = deltaHeight;
this.d = "";
},
/**
* editPointsAbs
*
* @param {Array} points Array of absolutePoints
*/
editPointsAbs: function(points) {
if(points instanceof Array) {
var newPoints = [];
var x, y;
for(var i = 0; i < points.length; i++) {
x = (parseFloat(points[i]) - this.oldX)*this.deltaWidth + this.x;
i++;
y = (parseFloat(points[i]) - this.oldY)*this.deltaHeight + this.y;
newPoints.push(x);
newPoints.push(y);
}
return newPoints;
} else {
//TODO error
}
},
/**
* editPointsRel
*
* @param {Array} points Array of absolutePoints
*/
editPointsRel: function(points) {
if(points instanceof Array) {
var newPoints = [];
var x, y;
for(var i = 0; i < points.length; i++) {
x = parseFloat(points[i])*this.deltaWidth;
i++;
y = parseFloat(points[i])*this.deltaHeight;
newPoints.push(x);
newPoints.push(y);
}
return newPoints;
} else {
//TODO error
}
},
/**
* arcAbs - A
*
* @param {Number} rx
* @param {Number} ry
* @param {Number} xAxisRotation
* @param {Boolean} largeArcFlag
* @param {Boolean} sweepFlag
* @param {Number} x
* @param {Number} y
*/
arcAbs: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
var pointsAbs = this.editPointsAbs([x, y]);
var pointsRel = this.editPointsRel([rx, ry]);
this.d = this.d.concat(" A" + pointsRel[0] + " " + pointsRel[1] +
" " + xAxisRotation + " " + largeArcFlag +
" " + sweepFlag + " " + pointsAbs[0] + " " +
pointsAbs[1] + " ");
},
/**
* arcRel - a
*
* @param {Number} rx
* @param {Number} ry
* @param {Number} xAxisRotation
* @param {Boolean} largeArcFlag
* @param {Boolean} sweepFlag
* @param {Number} x
* @param {Number} y
*/
arcRel: function(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) {
var pointsRel = this.editPointsRel([rx, ry, x, y]);
this.d = this.d.concat(" a" + pointsRel[0] + " " + pointsRel[1] +
" " + xAxisRotation + " " + largeArcFlag +
" " + sweepFlag + " " + pointsRel[2] + " " +
pointsRel[3] + " ");
},
/**
* curvetoCubicAbs - C
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicAbs: function(x1, y1, x2, y2, x, y) {
var pointsAbs = this.editPointsAbs([x1, y1, x2, y2, x, y]);
this.d = this.d.concat(" C" + pointsAbs[0] + " " + pointsAbs[1] +
" " + pointsAbs[2] + " " + pointsAbs[3] +
" " + pointsAbs[4] + " " + pointsAbs[5] + " ");
},
/**
* curvetoCubicRel - c
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicRel: function(x1, y1, x2, y2, x, y) {
var pointsRel = this.editPointsRel([x1, y1, x2, y2, x, y]);
this.d = this.d.concat(" c" + pointsRel[0] + " " + pointsRel[1] +
" " + pointsRel[2] + " " + pointsRel[3] +
" " + pointsRel[4] + " " + pointsRel[5] + " ");
},
/**
* linetoHorizontalAbs - H
*
* @param {Number} x
*/
linetoHorizontalAbs: function(x) {
var pointsAbs = this.editPointsAbs([x, 0]);
this.d = this.d.concat(" H" + pointsAbs[0] + " ");
},
/**
* linetoHorizontalRel - h
*
* @param {Number} x
*/
linetoHorizontalRel: function(x) {
var pointsRel = this.editPointsRel([x, 0]);
this.d = this.d.concat(" h" + pointsRel[0] + " ");
},
/**
* linetoAbs - L
*
* @param {Number} x
* @param {Number} y
*/
linetoAbs: function(x, y) {
var pointsAbs = this.editPointsAbs([x, y]);
this.d = this.d.concat(" L" + pointsAbs[0] + " " + pointsAbs[1] + " ");
},
/**
* linetoRel - l
*
* @param {Number} x
* @param {Number} y
*/
linetoRel: function(x, y) {
var pointsRel = this.editPointsRel([x, y]);
this.d = this.d.concat(" l" + pointsRel[0] + " " + pointsRel[1] + " ");
},
/**
* movetoAbs - M
*
* @param {Number} x
* @param {Number} y
*/
movetoAbs: function(x, y) {
var pointsAbs = this.editPointsAbs([x, y]);
this.d = this.d.concat(" M" + pointsAbs[0] + " " + pointsAbs[1] + " ");
},
/**
* movetoRel - m
*
* @param {Number} x
* @param {Number} y
*/
movetoRel: function(x, y) {
var pointsRel;
if(this.d === "") {
pointsRel = this.editPointsAbs([x, y]);
} else {
pointsRel = this.editPointsRel([x, y]);
}
this.d = this.d.concat(" m" + pointsRel[0] + " " + pointsRel[1] + " ");
},
/**
* curvetoQuadraticAbs - Q
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticAbs: function(x1, y1, x, y) {
var pointsAbs = this.editPointsAbs([x1, y1, x, y]);
this.d = this.d.concat(" Q" + pointsAbs[0] + " " + pointsAbs[1] + " " +
pointsAbs[2] + " " + pointsAbs[3] + " ");
},
/**
* curvetoQuadraticRel - q
*
* @param {Number} x1
* @param {Number} y1
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticRel: function(x1, y1, x, y) {
var pointsRel = this.editPointsRel([x1, y1, x, y]);
this.d = this.d.concat(" q" + pointsRel[0] + " " + pointsRel[1] + " " +
pointsRel[2] + " " + pointsRel[3] + " ");
},
/**
* curvetoCubicSmoothAbs - S
*
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicSmoothAbs: function(x2, y2, x, y) {
var pointsAbs = this.editPointsAbs([x2, y2, x, y]);
this.d = this.d.concat(" S" + pointsAbs[0] + " " + pointsAbs[1] + " " +
pointsAbs[2] + " " + pointsAbs[3] + " ");
},
/**
* curvetoCubicSmoothRel - s
*
* @param {Number} x2
* @param {Number} y2
* @param {Number} x
* @param {Number} y
*/
curvetoCubicSmoothRel: function(x2, y2, x, y) {
var pointsRel = this.editPointsRel([x2, y2, x, y]);
this.d = this.d.concat(" s" + pointsRel[0] + " " + pointsRel[1] + " " +
pointsRel[2] + " " + pointsRel[3] + " ");
},
/**
* curvetoQuadraticSmoothAbs - T
*
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticSmoothAbs: function(x, y) {
var pointsAbs = this.editPointsAbs([x, y]);
this.d = this.d.concat(" T" + pointsAbs[0] + " " + pointsAbs[1] + " ");
},
/**
* curvetoQuadraticSmoothRel - t
*
* @param {Number} x
* @param {Number} y
*/
curvetoQuadraticSmoothRel: function(x, y) {
var pointsRel = this.editPointsRel([x, y]);
this.d = this.d.concat(" t" + pointsRel[0] + " " + pointsRel[1] + " ");
},
/**
* linetoVerticalAbs - V
*
* @param {Number} y
*/
linetoVerticalAbs: function(y) {
var pointsAbs = this.editPointsAbs([0, y]);
this.d = this.d.concat(" V" + pointsAbs[1] + " ");
},
/**
* linetoVerticalRel - v
*
* @param {Number} y
*/
linetoVerticalRel: function(y) {
var pointsRel = this.editPointsRel([0, y]);
this.d = this.d.concat(" v" + pointsRel[1] + " ");
},
/**
* closePath - z or Z
*/
closePath: function() {
this.d = this.d.concat(" z");
}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
*
* Config variables
*/
NAMESPACE_ORYX = "http://www.b3mn.org/oryx";
NAMESPACE_SVG = "http://www.w3.org/2000/svg/";
/**
* @classDescription This class wraps the manipulation of a SVG marker.
* @namespace ORYX.Core.SVG
* uses Inheritance (Clazz)
* uses Prototype 1.5.0
*
*/
/**
* Init package
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};}
ORYX.Core.SVG.SVGMarker = Clazz.extend({
/**
* Constructor
* @param markerElement {SVGMarkerElement}
*/
construct: function(markerElement) {
arguments.callee.$.construct.apply(this, arguments);
this.id = undefined;
this.element = markerElement;
this.refX = undefined;
this.refY = undefined;
this.markerWidth = undefined;
this.markerHeight = undefined;
this.oldRefX = undefined;
this.oldRefY = undefined;
this.oldMarkerWidth = undefined;
this.oldMarkerHeight = undefined;
this.optional = false;
this.enabled = true;
this.minimumLength = undefined;
this.resize = false;
this.svgShapes = [];
this._init(); //initialisation of all the properties declared above.
},
/**
* Initializes the values that are defined in the constructor.
*/
_init: function() {
//check if this.element is a SVGMarkerElement
if(!( this.element == "[object SVGMarkerElement]")) {
throw "SVGMarker: Argument is not an instance of SVGMarkerElement.";
}
this.id = this.element.getAttributeNS(null, "id");
//init svg marker attributes
var refXValue = this.element.getAttributeNS(null, "refX");
if(refXValue) {
this.refX = parseFloat(refXValue);
} else {
this.refX = 0;
}
var refYValue = this.element.getAttributeNS(null, "refY");
if(refYValue) {
this.refY = parseFloat(refYValue);
} else {
this.refY = 0;
}
var markerWidthValue = this.element.getAttributeNS(null, "markerWidth");
if(markerWidthValue) {
this.markerWidth = parseFloat(markerWidthValue);
} else {
this.markerWidth = 3;
}
var markerHeightValue = this.element.getAttributeNS(null, "markerHeight");
if(markerHeightValue) {
this.markerHeight = parseFloat(markerHeightValue);
} else {
this.markerHeight = 3;
}
this.oldRefX = this.refX;
this.oldRefY = this.refY;
this.oldMarkerWidth = this.markerWidth;
this.oldMarkerHeight = this.markerHeight;
//init oryx attributes
var optionalAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "optional");
if(optionalAttr) {
optionalAttr = optionalAttr.strip();
this.optional = (optionalAttr.toLowerCase() === "yes");
} else {
this.optional = false;
}
var enabledAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "enabled");
if(enabledAttr) {
enabledAttr = enabledAttr.strip();
this.enabled = !(enabledAttr.toLowerCase() === "no");
} else {
this.enabled = true;
}
var minLengthAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "minimumLength");
if(minLengthAttr) {
this.minimumLength = parseFloat(minLengthAttr);
}
var resizeAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "resize");
if(resizeAttr) {
resizeAttr = resizeAttr.strip();
this.resize = (resizeAttr.toLowerCase() === "yes");
} else {
this.resize = false;
}
//init SVGShape objects
//this.svgShapes = this._getSVGShapes(this.element);
},
/**
*
*/
_getSVGShapes: function(svgElement) {
if(svgElement.hasChildNodes) {
var svgShapes = [];
var me = this;
$A(svgElement.childNodes).each(function(svgChild) {
try {
var svgShape = new ORYX.Core.SVG.SVGShape(svgChild);
svgShapes.push(svgShape);
} catch (e) {
svgShapes = svgShapes.concat(me._getSVGShapes(svgChild));
}
});
return svgShapes;
}
},
/**
* Writes the changed values into the SVG marker.
*/
update: function() {
//TODO mache marker resizebar!!! aber erst wenn der rest der connectingshape funzt!
// //update marker attributes
// if(this.refX != this.oldRefX) {
// this.element.setAttributeNS(null, "refX", this.refX);
// }
// if(this.refY != this.oldRefY) {
// this.element.setAttributeNS(null, "refY", this.refY);
// }
// if(this.markerWidth != this.oldMarkerWidth) {
// this.element.setAttributeNS(null, "markerWidth", this.markerWidth);
// }
// if(this.markerHeight != this.oldMarkerHeight) {
// this.element.setAttributeNS(null, "markerHeight", this.markerHeight);
// }
//
// //update SVGShape objects
// var widthDelta = this.markerWidth / this.oldMarkerWidth;
// var heightDelta = this.markerHeight / this.oldMarkerHeight;
// if(widthDelta != 1 && heightDelta != 1) {
// this.svgShapes.each(function(svgShape) {
//
// });
// }
//update old values to prepare the next update
this.oldRefX = this.refX;
this.oldRefY = this.refY;
this.oldMarkerWidth = this.markerWidth;
this.oldMarkerHeight = this.markerHeight;
},
toString: function() { return (this.element) ? "SVGMarker " + this.element.id : "SVGMarker " + this.element;}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
*
* Config variables
*/
NAMESPACE_ORYX = "http://www.b3mn.org/oryx";
NAMESPACE_SVG = "http://www.w3.org/2000/svg/";
/**
* @classDescription This class wraps the manipulation of a SVG basic shape or a path.
* @namespace ORYX.Core.SVG
* uses Inheritance (Clazz)
* uses Prototype 1.5.0
* uses PathParser by Kevin Lindsey (http://kevlindev.com/)
* uses MinMaxPathHandler
* uses EditPathHandler
*
*/
//init package
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
if(!ORYX.Core.SVG) {ORYX.Core.SVG = {};}
ORYX.Core.SVG.SVGShape = Clazz.extend({
/**
* Constructor
* @param svgElem {SVGElement} An SVGElement that is a basic shape or a path.
*/
construct: function(svgElem) {
arguments.callee.$.construct.apply(this, arguments);
this.type;
this.element = svgElem;
this.x = undefined;
this.y = undefined;
this.width = undefined;
this.height = undefined;
this.oldX = undefined;
this.oldY = undefined;
this.oldWidth = undefined;
this.oldHeight = undefined;
this.radiusX = undefined;
this.radiusY = undefined;
this.isHorizontallyResizable = false;
this.isVerticallyResizable = false;
//this.anchors = [];
this.anchorLeft = false;
this.anchorRight = false;
this.anchorTop = false;
this.anchorBottom = false;
//attributes of path elements of edge objects
this.allowDockers = true;
this.resizeMarkerMid = false;
this.editPathParser;
this.editPathHandler;
this.init(); //initialisation of all the properties declared above.
},
/**
* Initializes the values that are defined in the constructor.
*/
init: function() {
/**initialize position and size*/
if(ORYX.Editor.checkClassType(this.element, SVGRectElement) || ORYX.Editor.checkClassType(this.element, SVGImageElement)) {
this.type = "Rect";
var xAttr = this.element.getAttributeNS(null, "x");
if(xAttr) {
this.oldX = parseFloat(xAttr);
} else {
throw "Missing attribute in element " + this.element;
}
var yAttr = this.element.getAttributeNS(null, "y");
if(yAttr) {
this.oldY = parseFloat(yAttr);
} else {
throw "Missing attribute in element " + this.element;
}
var widthAttr = this.element.getAttributeNS(null, "width");
if(widthAttr) {
this.oldWidth = parseFloat(widthAttr);
} else {
throw "Missing attribute in element " + this.element;
}
var heightAttr = this.element.getAttributeNS(null, "height");
if(heightAttr) {
this.oldHeight = parseFloat(heightAttr);
} else {
throw "Missing attribute in element " + this.element;
}
} else if(ORYX.Editor.checkClassType(this.element, SVGCircleElement)) {
this.type = "Circle";
var cx = undefined;
var cy = undefined;
//var r = undefined;
var cxAttr = this.element.getAttributeNS(null, "cx");
if(cxAttr) {
cx = parseFloat(cxAttr);
} else {
throw "Missing attribute in element " + this.element;
}
var cyAttr = this.element.getAttributeNS(null, "cy");
if(cyAttr) {
cy = parseFloat(cyAttr);
} else {
throw "Missing attribute in element " + this.element;
}
var rAttr = this.element.getAttributeNS(null, "r");
if(rAttr) {
//r = parseFloat(rAttr);
this.radiusX = parseFloat(rAttr);
} else {
throw "Missing attribute in element " + this.element;
}
this.oldX = cx - this.radiusX;
this.oldY = cy - this.radiusX;
this.oldWidth = 2*this.radiusX;
this.oldHeight = 2*this.radiusX;
} else if(ORYX.Editor.checkClassType(this.element, SVGEllipseElement)) {
this.type = "Ellipse";
var cx = undefined;
var cy = undefined;
//var rx = undefined;
//var ry = undefined;
var cxAttr = this.element.getAttributeNS(null, "cx");
if(cxAttr) {
cx = parseFloat(cxAttr);
} else {
throw "Missing attribute in element " + this.element;
}
var cyAttr = this.element.getAttributeNS(null, "cy");
if(cyAttr) {
cy = parseFloat(cyAttr);
} else {
throw "Missing attribute in element " + this.element;
}
var rxAttr = this.element.getAttributeNS(null, "rx");
if(rxAttr) {
this.radiusX = parseFloat(rxAttr);
} else {
throw "Missing attribute in element " + this.element;
}
var ryAttr = this.element.getAttributeNS(null, "ry");
if(ryAttr) {
this.radiusY = parseFloat(ryAttr);
} else {
throw "Missing attribute in element " + this.element;
}
this.oldX = cx - this.radiusX;
this.oldY = cy - this.radiusY;
this.oldWidth = 2*this.radiusX;
this.oldHeight = 2*this.radiusY;
} else if(ORYX.Editor.checkClassType(this.element, SVGLineElement)) {
this.type = "Line";
var x1 = undefined;
var y1 = undefined;
var x2 = undefined;
var y2 = undefined;
var x1Attr = this.element.getAttributeNS(null, "x1");
if(x1Attr) {
x1 = parseFloat(x1Attr);
} else {
throw "Missing attribute in element " + this.element;
}
var y1Attr = this.element.getAttributeNS(null, "y1");
if(y1Attr) {
y1 = parseFloat(y1Attr);
} else {
throw "Missing attribute in element " + this.element;
}
var x2Attr = this.element.getAttributeNS(null, "x2");
if(x2Attr) {
x2 = parseFloat(x2Attr);
} else {
throw "Missing attribute in element " + this.element;
}
var y2Attr = this.element.getAttributeNS(null, "y2");
if(y2Attr) {
y2 = parseFloat(y2Attr);
} else {
throw "Missing attribute in element " + this.element;
}
this.oldX = Math.min(x1,x2);
this.oldY = Math.min(y1,y2);
this.oldWidth = Math.abs(x1-x2);
this.oldHeight = Math.abs(y1-y2);
} else if(ORYX.Editor.checkClassType(this.element, SVGPolylineElement) || ORYX.Editor.checkClassType(this.element, SVGPolygonElement)) {
this.type = "Polyline";
var points = this.element.getAttributeNS(null, "points");
if(points) {
points = points.replace(/,/g , " ");
var pointsArray = points.split(" ");
pointsArray = pointsArray.without("");
if(pointsArray && pointsArray.length && pointsArray.length > 1) {
var minX = parseFloat(pointsArray[0]);
var minY = parseFloat(pointsArray[1]);
var maxX = parseFloat(pointsArray[0]);
var maxY = parseFloat(pointsArray[1]);
for(var i = 0; i < pointsArray.length; i++) {
minX = Math.min(minX, parseFloat(pointsArray[i]));
maxX = Math.max(maxX, parseFloat(pointsArray[i]));
i++;
minY = Math.min(minY, parseFloat(pointsArray[i]));
maxY = Math.max(maxY, parseFloat(pointsArray[i]));
}
this.oldX = minX;
this.oldY = minY;
this.oldWidth = maxX-minX;
this.oldHeight = maxY-minY;
} else {
throw "Missing attribute in element " + this.element;
}
} else {
throw "Missing attribute in element " + this.element;
}
} else if(ORYX.Editor.checkClassType(this.element, SVGPathElement)) {
this.type = "Path";
this.editPathParser = new PathParser();
this.editPathHandler = new ORYX.Core.SVG.EditPathHandler();
this.editPathParser.setHandler(this.editPathHandler);
var parser = new PathParser();
var handler = new ORYX.Core.SVG.MinMaxPathHandler();
parser.setHandler(handler);
parser.parsePath(this.element);
this.oldX = handler.minX;
this.oldY = handler.minY;
this.oldWidth = handler.maxX - handler.minX;
this.oldHeight = handler.maxY - handler.minY;
delete parser;
delete handler;
} else {
throw "Element is not a shape.";
}
/** initialize attributes of oryx namespace */
//resize
var resizeAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "resize");
if(resizeAttr) {
resizeAttr = resizeAttr.toLowerCase();
if(resizeAttr.match(/horizontal/)) {
this.isHorizontallyResizable = true;
} else {
this.isHorizontallyResizable = false;
}
if(resizeAttr.match(/vertical/)) {
this.isVerticallyResizable = true;
} else {
this.isVerticallyResizable = false;
}
} else {
this.isHorizontallyResizable = false;
this.isVerticallyResizable = false;
}
//anchors
var anchorAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "anchors");
if(anchorAttr) {
anchorAttr = anchorAttr.replace("/,/g", " ");
var anchors = anchorAttr.split(" ").without("");
for(var i = 0; i < anchors.length; i++) {
switch(anchors[i].toLowerCase()) {
case "left":
this.anchorLeft = true;
break;
case "right":
this.anchorRight = true;
break;
case "top":
this.anchorTop = true;
break;
case "bottom":
this.anchorBottom = true;
break;
}
}
}
//allowDockers and resizeMarkerMid
if(ORYX.Editor.checkClassType(this.element, SVGPathElement)) {
var allowDockersAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "allowDockers");
if(allowDockersAttr) {
if(allowDockersAttr.toLowerCase() === "no") {
this.allowDockers = false;
} else {
this.allowDockers = true;
}
}
var resizeMarkerMidAttr = this.element.getAttributeNS(NAMESPACE_ORYX, "resizeMarker-mid");
if(resizeMarkerMidAttr) {
if(resizeMarkerMidAttr.toLowerCase() === "yes") {
this.resizeMarkerMid = true;
} else {
this.resizeMarkerMid = false;
}
}
}
this.x = this.oldX;
this.y = this.oldY;
this.width = this.oldWidth;
this.height = this.oldHeight;
},
/**
* Writes the changed values into the SVG element.
*/
update: function() {
if(this.x !== this.oldX || this.y !== this.oldY || this.width !== this.oldWidth || this.height !== this.oldHeight) {
switch(this.type) {
case "Rect":
if(this.x !== this.oldX) this.element.setAttributeNS(null, "x", this.x);
if(this.y !== this.oldY) this.element.setAttributeNS(null, "y", this.y);
if(this.width !== this.oldWidth) this.element.setAttributeNS(null, "width", this.width);
if(this.height !== this.oldHeight) this.element.setAttributeNS(null, "height", this.height);
break;
case "Circle":
//calculate the radius
//var r;
// if(this.width/this.oldWidth <= this.height/this.oldHeight) {
// this.radiusX = ((this.width > this.height) ? this.width : this.height)/2.0;
// } else {
this.radiusX = ((this.width < this.height) ? this.width : this.height)/2.0;
//}
this.element.setAttributeNS(null, "cx", this.x + this.width/2.0);
this.element.setAttributeNS(null, "cy", this.y + this.height/2.0);
this.element.setAttributeNS(null, "r", this.radiusX);
break;
case "Ellipse":
this.radiusX = this.width/2;
this.radiusY = this.height/2;
this.element.setAttributeNS(null, "cx", this.x + this.radiusX);
this.element.setAttributeNS(null, "cy", this.y + this.radiusY);
this.element.setAttributeNS(null, "rx", this.radiusX);
this.element.setAttributeNS(null, "ry", this.radiusY);
break;
case "Line":
if(this.x !== this.oldX)
this.element.setAttributeNS(null, "x1", this.x);
if(this.y !== this.oldY)
this.element.setAttributeNS(null, "y1", this.y);
if(this.x !== this.oldX || this.width !== this.oldWidth)
this.element.setAttributeNS(null, "x2", this.x + this.width);
if(this.y !== this.oldY || this.height !== this.oldHeight)
this.element.setAttributeNS(null, "y2", this.y + this.height);
break;
case "Polyline":
var points = this.element.getAttributeNS(null, "points");
if(points) {
points = points.replace(/,/g, " ").split(" ").without("");
if(points && points.length && points.length > 1) {
//TODO what if oldWidth == 0?
var widthDelta = (this.oldWidth === 0) ? 0 : this.width / this.oldWidth;
var heightDelta = (this.oldHeight === 0) ? 0 : this.height / this.oldHeight;
var updatedPoints = "";
for(var i = 0; i < points.length; i++) {
var x = (parseFloat(points[i])-this.oldX)*widthDelta + this.x;
i++;
var y = (parseFloat(points[i])-this.oldY)*heightDelta + this.y;
updatedPoints += x + " " + y + " ";
}
this.element.setAttributeNS(null, "points", updatedPoints);
} else {
//TODO error
}
} else {
//TODO error
}
break;
case "Path":
//calculate scaling delta
//TODO what if oldWidth == 0?
var widthDelta = (this.oldWidth === 0) ? 0 : this.width / this.oldWidth;
var heightDelta = (this.oldHeight === 0) ? 0 : this.height / this.oldHeight;
//use path parser to edit each point of the path
this.editPathHandler.init(this.x, this.y, this.oldX, this.oldY, widthDelta, heightDelta);
this.editPathParser.parsePath(this.element);
//change d attribute of path
this.element.setAttributeNS(null, "d", this.editPathHandler.d);
break;
}
this.oldX = this.x;
this.oldY = this.y;
this.oldWidth = this.width;
this.oldHeight = this.height;
}
},
isPointIncluded: function(pointX, pointY) {
// Check if there are the right arguments and if the node is visible
if(!pointX || !pointY || !this.isVisible()) {
return false;
}
switch(this.type) {
case "Rect":
return (pointX >= this.x && pointX <= this.x + this.width &&
pointY >= this.y && pointY <= this.y+this.height);
break;
case "Circle":
//calculate the radius
// var r;
// if(this.width/this.oldWidth <= this.height/this.oldHeight) {
// r = ((this.width > this.height) ? this.width : this.height)/2.0;
// } else {
// r = ((this.width < this.height) ? this.width : this.height)/2.0;
// }
return ORYX.Core.Math.isPointInEllipse(pointX, pointY, this.x + this.width/2.0, this.y + this.height/2.0, this.radiusX, this.radiusX);
break;
case "Ellipse":
return ORYX.Core.Math.isPointInEllipse(pointX, pointY, this.x + this.radiusX, this.y + this.radiusY, this.radiusX, this.radiusY);
break;
case "Line":
return ORYX.Core.Math.isPointInLine(pointX, pointY, this.x, this.y, this.x + this.width, this.y + this.height);
break;
case "Polyline":
var points = this.element.getAttributeNS(null, "points");
if(points) {
points = points.replace(/,/g , " ").split(" ").without("");
points = points.collect(function(n) {
return parseFloat(n);
});
return ORYX.Core.Math.isPointInPolygone(pointX, pointY, points);
} else {
return false;
}
break;
case "Path":
var parser = new PathParser();
var handler = new ORYX.Core.SVG.PointsPathHandler();
parser.setHandler(handler);
parser.parsePath(this.element);
return ORYX.Core.Math.isPointInPolygone(pointX, pointY, handler.points);
break;
default:
return false;
}
},
/**
* Returns true if the element is visible
* @param {SVGElement} elem
* @return boolean
*/
isVisible: function(elem) {
if (!elem) {
elem = this.element;
}
var hasOwnerSVG = false;
try {
hasOwnerSVG = !!elem.ownerSVGElement;
} catch(e){}
if ( hasOwnerSVG ) {
if (ORYX.Editor.checkClassType(elem, SVGGElement)) {
if (elem.className && elem.className.baseVal == "me")
return true;
}
var fill = elem.getAttributeNS(null, "fill");
var stroke = elem.getAttributeNS(null, "stroke");
if (fill && fill == "none" && stroke && stroke == "none") {
return false;
}
var attr = elem.getAttributeNS(null, "display");
if(!attr)
return this.isVisible(elem.parentNode);
else if (attr == "none")
return false;
else {
return true;
}
}
return true;
},
toString: function() { return (this.element) ? "SVGShape " + this.element.id : "SVGShape " + this.element;}
}); | JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
/**
@namespace Namespace for the Oryx core elements.
@name ORYX.Core
*/
if(!ORYX.Core) {ORYX.Core = {};}
/**
* @class Oryx canvas.
* @extends ORYX.Core.AbstractShape
*
*/
ORYX.Core.Canvas = ORYX.Core.AbstractShape.extend({
/** @lends ORYX.Core.Canvas.prototype */
/**
* Defines the current zoom level
*/
zoomLevel:1,
/**
* Constructor
*/
construct: function(options) {
arguments.callee.$.construct.apply(this, arguments);
if(!(options && options.width && options.height)) {
ORYX.Log.fatal("Canvas is missing mandatory parameters options.width and options.height.");
return;
}
//TODO: set document resource id
this.resourceId = options.id;
this.nodes = [];
this.edges = [];
//init svg document
this.rootNode = ORYX.Editor.graft("http://www.w3.org/2000/svg", options.parentNode,
['svg', {id: this.id, width: options.width, height: options.height},
['defs', {}]
]);
this.defsNode = this.rootNode.getElementsByTagName("defs")[0];
this.rootNode.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
this.rootNode.setAttribute("xmlns:svg", "http://www.w3.org/2000/svg");
this._htmlContainer = ORYX.Editor.graft("http://www.w3.org/1999/xhtml", options.parentNode,
['div', {id: "oryx_canvas_htmlContainer", style:"position:absolute; top:5px"}]);
this.node = ORYX.Editor.graft("http://www.w3.org/2000/svg", this.rootNode,
['g', {},
['g', {"class": "stencils"},
['g', {"class": "me"}],
['g', {"class": "children"}],
['g', {"class": "edge"}]
],
['g', {"class":"svgcontainer"}]
]
);
/*
var off = 2 * ORYX.CONFIG.GRID_DISTANCE;
var size = 3;
var d = "";
for(var i = 0; i <= options.width; i += off)
for(var j = 0; j <= options.height; j += off)
d = d + "M" + (i - size) + " " + j + " l" + (2*size) + " 0 m" + (-size) + " " + (-size) + " l0 " + (2*size) + " m0" + (-size) + " ";
ORYX.Editor.graft("http://www.w3.org/2000/svg", this.node.firstChild.firstChild,
['path', {d:d , stroke:'#000000', 'stroke-width':'0.15px'},]);
*/
//Global definition of default font for shapes
//Definitions in the SVG definition of a stencil will overwrite these settings for
// that stencil.
/*if(navigator.platform.indexOf("Mac") > -1) {
this.node.setAttributeNS(null, 'stroke', 'black');
this.node.setAttributeNS(null, 'stroke-width', '0.5px');
this.node.setAttributeNS(null, 'font-family', 'Skia');
//this.node.setAttributeNS(null, 'letter-spacing', '2px');
this.node.setAttributeNS(null, 'font-size', ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT);
} else {
this.node.setAttributeNS(null, 'stroke', 'none');
this.node.setAttributeNS(null, 'font-family', 'Verdana');
this.node.setAttributeNS(null, 'font-size', ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT);
}*/
this.node.setAttributeNS(null, 'stroke', 'black');
this.node.setAttributeNS(null, 'font-family', 'Verdana, sans-serif');
this.node.setAttributeNS(null, 'font-size-adjust', 'none');
this.node.setAttributeNS(null, 'font-style', 'normal');
this.node.setAttributeNS(null, 'font-variant', 'normal');
this.node.setAttributeNS(null, 'font-weight', 'normal');
this.node.setAttributeNS(null, 'line-heigth', 'normal');
this.node.setAttributeNS(null, 'font-size', ORYX.CONFIG.LABEL_DEFAULT_LINE_HEIGHT);
this.bounds.set(0,0,options.width, options.height);
this.addEventHandlers(this.rootNode.parentNode);
//disable context menu
this.rootNode.oncontextmenu = function() {return false;};
},
update: function() {
this.nodes.each(function(node) {
this._traverseForUpdate(node);
}.bind(this));
// call stencil's layout callback
// (needed for row layouting of xforms)
//this.getStencil().layout(this);
var layoutEvents = this.getStencil().layout();
if(layoutEvents) {
layoutEvents.each(function(event) {
// setup additional attributes
event.shape = this;
event.forceExecution = true;
event.target = this.rootNode;
// do layouting
this._delegateEvent(event);
}.bind(this))
}
this.nodes.invoke("_update");
this.edges.invoke("_update", true);
/*this.children.each(function(child) {
child._update();
});*/
},
_traverseForUpdate: function(shape) {
var childRet = shape.isChanged;
shape.getChildNodes(false, function(child) {
if(this._traverseForUpdate(child)) {
childRet = true;
}
}.bind(this));
if(childRet) {
shape.layout();
return true;
} else {
return false;
}
},
layout: function() {
},
/**
*
* @param {Object} deep
* @param {Object} iterator
*/
getChildNodes: function(deep, iterator) {
if(!deep && !iterator) {
return this.nodes.clone();
} else {
var result = [];
this.nodes.each(function(uiObject) {
if(iterator) {
iterator(uiObject);
}
result.push(uiObject);
if(deep && uiObject instanceof ORYX.Core.Shape) {
result = result.concat(uiObject.getChildNodes(deep, iterator));
}
});
return result;
}
},
/**
* buggy crap! use base class impl instead!
* @param {Object} iterator
*/
/* getChildEdges: function(iterator) {
if(iterator) {
this.edges.each(function(edge) {
iterator(edge);
});
}
return this.edges.clone();
},
*/
/**
* Overrides the UIObject.add method. Adds uiObject to the correct sub node.
* @param {UIObject} uiObject
*/
add: function(uiObject) {
//if uiObject is child of another UIObject, remove it.
if(uiObject instanceof ORYX.Core.UIObject) {
if (!(this.children.member(uiObject))) {
//if uiObject is child of another parent, remove it from that parent.
if(uiObject.parent) {
uiObject.parent.remove(uiObject);
}
//add uiObject to the Canvas
this.children.push(uiObject);
//set parent reference
uiObject.parent = this;
//add uiObject.node to this.node depending on the type of uiObject
if(uiObject instanceof ORYX.Core.Shape) {
if(uiObject instanceof ORYX.Core.Edge) {
uiObject.addMarkers(this.rootNode.getElementsByTagNameNS(NAMESPACE_SVG, "defs")[0]);
uiObject.node = this.node.childNodes[0].childNodes[2].appendChild(uiObject.node);
this.edges.push(uiObject);
} else {
uiObject.node = this.node.childNodes[0].childNodes[1].appendChild(uiObject.node);
this.nodes.push(uiObject);
}
} else { //UIObject
uiObject.node = this.node.appendChild(uiObject.node);
}
uiObject.bounds.registerCallback(this._changedCallback);
if(this.eventHandlerCallback)
this.eventHandlerCallback({type:ORYX.CONFIG.EVENT_SHAPEADDED,shape:uiObject})
} else {
ORYX.Log.warn("add: ORYX.Core.UIObject is already a child of this object.");
}
} else {
ORYX.Log.fatal("add: Parameter is not of type ORYX.Core.UIObject.");
}
},
/**
* Overrides the UIObject.remove method. Removes uiObject.
* @param {UIObject} uiObject
*/
remove: function(uiObject) {
//if uiObject is a child of this object, remove it.
if (this.children.member(uiObject)) {
//remove uiObject from children
this.children = this.children.without(uiObject);
//delete parent reference of uiObject
uiObject.parent = undefined;
//delete uiObject.node from this.node
if(uiObject instanceof ORYX.Core.Shape) {
if(uiObject instanceof ORYX.Core.Edge) {
uiObject.removeMarkers();
uiObject.node = this.node.childNodes[0].childNodes[2].removeChild(uiObject.node);
this.edges = this.edges.without(uiObject);
} else {
uiObject.node = this.node.childNodes[0].childNodes[1].removeChild(uiObject.node);
this.nodes = this.nodes.without(uiObject);
}
} else { //UIObject
uiObject.node = this.node.removeChild(uiObject.node);
}
uiObject.bounds.unregisterCallback(this._changedCallback);
} else {
ORYX.Log.warn("remove: ORYX.Core.UIObject is not a child of this object.");
}
},
/**
* Creates shapes out of the given collection of shape objects and adds them to the canvas.
* @example
* canvas.addShapeObjects({
bounds:{ lowerRight:{ y:510, x:633 }, upperLeft:{ y:146, x:210 } },
resourceId:"oryx_F0715955-50F2-403D-9851-C08CFE70F8BD",
childShapes:[],
properties:{},
stencil:{
id:"Subprocess"
},
outgoing:[{resourceId: 'aShape'}],
target: {resourceId: 'aShape'}
});
* @param {Object} shapeObjects
* @param {Function} [eventHandler] An event handler passed to each newly created shape (as eventHandlerCallback)
* @return {Array} A collection of ORYX.Core.Shape
* @methodOf ORYX.Core.Canvas.prototype
*/
addShapeObjects: function(shapeObjects, eventHandler){
if(!shapeObjects) return;
/*FIXME This implementation is very evil! At first, all shapes are created on
canvas. In a second step, the attributes are applied. There must be a distinction
between the configuration phase (where the outgoings, for example, are just named),
and the creation phase (where the outgoings are evaluated). This must be reflected
in code to provide a nicer API/ implementation!!! */
var addShape = function(shape, parent){
// Try to create a new Shape
try {
// Create a new Stencil
var stencil = ORYX.Core.StencilSet.stencil(this.getStencil().namespace() + shape.stencil.id );
// Create a new Shape
var ShapeClass = (stencil.type() == "node") ? ORYX.Core.Node : ORYX.Core.Edge;
var newShape = new ShapeClass(
{'eventHandlerCallback': eventHandler},
stencil);
// Set the resource id
newShape.resourceId = shape.resourceId;
// Set parent to json object to be used later
// Due to the nested json structure, normally shape.parent is not set/ must not be set.
// In special cases, it can be easier to set this directly instead of a nested structure.
//shape.parent = "#" + ((shape.parent && shape.parent.resourceId) || parent.resourceId);
if (typeof shape.parent !== "undefined") {
var newParent = this.getChildShapeOrCanvasByResourceId(shape.parent.resourceId);
} else if (typeof parent !== "undefined") {
var newParent = this.getChildShapeOrCanvasByResourceId(parent.resourceId);
} else {
var newParent = this;
}
// Add the shape to the canvas
//this.add( newShape );
newShape.parent = newParent;
newParent.add(newShape);
this.update();
return {
json: shape,
object: newShape
};
} catch(e) {
ORYX.Log.warn("LoadingContent: Stencil could not create.");
}
}.bind(this);
/** Builds up recursively a flatted array of shapes, including a javascript object and json representation
* @param {Object} shape Any object that has Object#childShapes
*/
var addChildShapesRecursively = function(shape){
var addedShapes = [];
shape.childShapes.each(function(childShape){
/*
* workaround for Chrome, for some reason an undefined shape is given
*/
var xy=addShape(childShape, shape);
if(!(typeof xy ==="undefined")){
addedShapes.push(xy);
}
addedShapes = addedShapes.concat(addChildShapesRecursively(childShape));
});
return addedShapes;
}.bind(this);
var shapes = addChildShapesRecursively({
childShapes: shapeObjects,
resourceId: this.resourceId
});
// prepare deserialisation parameter
shapes.each(
function(shape){
var properties = [];
for(field in shape.json.properties){
properties.push({
prefix: 'oryx',
name: field,
value: shape.json.properties[field]
});
}
// Outgoings
shape.json.outgoing.each(function(out){
properties.push({
prefix: 'raziel',
name: 'outgoing',
value: "#"+out.resourceId
});
});
// Target
// (because of a bug, the first outgoing is taken when there is no target,
// can be removed after some time)
if(shape.object instanceof ORYX.Core.Edge) {
var target = shape.json.target || shape.json.outgoing[0];
if(target){
properties.push({
prefix: 'raziel',
name: 'target',
value: "#"+target.resourceId
});
}
}
// Bounds
if (shape.json.bounds) {
properties.push({
prefix: 'oryx',
name: 'bounds',
value: shape.json.bounds.upperLeft.x + "," + shape.json.bounds.upperLeft.y + "," + shape.json.bounds.lowerRight.x + "," + shape.json.bounds.lowerRight.y
});
}
//Dockers [{x:40, y:50}, {x:30, y:60}] => "40 50 30 60 #"
if(shape.json.dockers){
properties.push({
prefix: 'oryx',
name: 'dockers',
value: shape.json.dockers.inject("", function(dockersStr, docker){
return dockersStr + docker.x + " " + docker.y + " ";
}) + " #"
});
}
//Parent
properties.push({
prefix: 'raziel',
name: 'parent',
value: shape.json.parent
});
shape.__properties = properties;
}.bind(this)
);
// Deserialize the properties from the shapes
// This can't be done earlier because Shape#deserialize expects that all referenced nodes are already there
// first, deserialize all nodes
shapes.each(function(shape) {
if(shape.object instanceof ORYX.Core.Node) {
shape.object.deserialize(shape.__properties);
}
});
// second, deserialize all edges
shapes.each(function(shape) {
if(shape.object instanceof ORYX.Core.Edge) {
shape.object.deserialize(shape.__properties);
for (var i = 0; i < shape.object.dockers.length; i++) {
shape.object.dockers[i].id = shape.json.dockers[i].id;
}
}
});
return shapes.pluck("object");
},
/**
* Updates the size of the canvas, regarding to the containg shapes.
*/
updateSize: function(){
// Check the size for the canvas
var maxWidth = 0;
var maxHeight = 0;
var offset = 100;
this.getChildShapes(true, function(shape){
var b = shape.bounds;
maxWidth = Math.max( maxWidth, b.lowerRight().x + offset)
maxHeight = Math.max( maxHeight, b.lowerRight().y + offset)
});
if( this.bounds.width() < maxWidth || this.bounds.height() < maxHeight ){
this.setSize({width: Math.max(this.bounds.width(), maxWidth), height: Math.max(this.bounds.height(), maxHeight)})
}
},
getRootNode: function() {
return this.rootNode;
},
getDefsNode: function() {
return this.defsNode;
},
getSvgContainer: function() {
return this.node.childNodes[1];
},
getHTMLContainer: function() {
return this._htmlContainer;
},
/**
* Return all elements of the same highest level
* @param {Object} elements
*/
getShapesWithSharedParent: function(elements) {
// If there is no elements, return []
if(!elements || elements.length < 1) { return [] }
// If there is one element, return this element
if(elements.length == 1) { return elements}
return elements.findAll(function(value){
var parentShape = value.parent;
while(parentShape){
if(elements.member(parentShape)) return false;
parentShape = parentShape.parent
}
return true;
});
},
setSize: function(size, dontSetBounds) {
if(!size || !size.width || !size.height){return}
if(this.rootNode.parentNode){
this.rootNode.parentNode.style.width = size.width + 'px';
this.rootNode.parentNode.style.height = size.height + 'px';
}
this.rootNode.setAttributeNS(null, 'width', size.width);
this.rootNode.setAttributeNS(null, 'height', size.height);
//this._htmlContainer.style.top = "-" + (size.height + 4) + 'px';
if( !dontSetBounds ){
this.bounds.set({a:{x:0,y:0},b:{x:size.width/this.zoomLevel,y:size.height/this.zoomLevel}})
}
},
/**
* Returns an SVG document of the current process.
* @param {Boolean} escapeText Use true, if you want to parse it with an XmlParser,
* false, if you want to use the SVG document in browser on client side.
*/
getSVGRepresentation: function(escapeText) {
// Get the serialized svg image source
var svgClone = this.getRootNode().cloneNode(true);
this._removeInvisibleElements(svgClone);
var x1, y1, x2, y2;
try {
var bb = this.getRootNode().childNodes[1].getBBox();
x1 = bb.x;
y1 = bb.y;
x2 = bb.x + bb.width;
y2 = bb.y + bb.height;
} catch(e) {
this.getChildShapes(true).each(function(shape) {
var absBounds = shape.absoluteBounds();
var ul = absBounds.upperLeft();
var lr = absBounds.lowerRight();
if(x1 == undefined) {
x1 = ul.x;
y1 = ul.y;
x2 = lr.x;
y2 = lr.y;
} else {
x1 = Math.min(x1, ul.x);
y1 = Math.min(y1, ul.y);
x2 = Math.max(x2, lr.x);
y2 = Math.max(y2, lr.y);
}
});
}
var margin = 50;
var width, height, tx, ty;
if(x1 == undefined) {
width = 0;
height = 0;
tx = 0;
ty = 0;
} else {
width = x2 - x1;
height = y2 - y1;
tx = -x1+margin/2;
ty = -y1+margin/2;
}
// Set the width and height
svgClone.setAttributeNS(null, 'width', width + margin);
svgClone.setAttributeNS(null, 'height', height + margin);
svgClone.childNodes[1].firstChild.setAttributeNS(null, 'transform', 'translate(' + tx + ", " + ty + ')');
//remove scale factor
svgClone.childNodes[1].removeAttributeNS(null, 'transform');
try{
var svgCont = svgClone.childNodes[1].childNodes[1];
svgCont.parentNode.removeChild(svgCont);
} catch(e) {}
if(escapeText) {
$A(svgClone.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'tspan')).each(function(elem) {
elem.textContent = elem.textContent.escapeHTML();
});
$A(svgClone.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'text')).each(function(elem) {
if(elem.childNodes.length == 0)
elem.textContent = elem.textContent.escapeHTML();
});
}
// generating absolute urls for the pdf-exporter
$A(svgClone.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'image')).each(function(elem) {
var href = elem.getAttributeNS("http://www.w3.org/1999/xlink","href");
if(!href.match("^(http|https)://")) {
href = window.location.protocol + "//" + window.location.host + href;
elem.setAttributeNS("http://www.w3.org/1999/xlink", "href", href);
}
});
// escape all links
$A(svgClone.getElementsByTagNameNS(ORYX.CONFIG.NAMESPACE_SVG, 'a')).each(function(elem) {
elem.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", (elem.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").escapeHTML());
});
return svgClone;
},
/**
* Removes all nodes (and its children) that has the
* attribute visibility set to "hidden"
*/
_removeInvisibleElements: function(element) {
var index = 0;
while(index < element.childNodes.length) {
var child = element.childNodes[index];
if(child.getAttributeNS &&
child.getAttributeNS(null, "visibility") === "hidden") {
element.removeChild(child);
} else {
this._removeInvisibleElements(child);
index++;
}
}
},
/**
* This method checks all shapes on the canvas and removes all shapes that
* contain invalid bounds values or dockers values(NaN)
*/
/*cleanUp: function(parent) {
if (!parent) {
parent = this;
}
parent.getChildShapes().each(function(shape){
var a = shape.bounds.a;
var b = shape.bounds.b;
if (isNaN(a.x) || isNaN(a.y) || isNaN(b.x) || isNaN(b.y)) {
parent.remove(shape);
}
else {
shape.getDockers().any(function(docker) {
a = docker.bounds.a;
b = docker.bounds.b;
if (isNaN(a.x) || isNaN(a.y) || isNaN(b.x) || isNaN(b.y)) {
parent.remove(shape);
return true;
}
return false;
});
shape.getMagnets().any(function(magnet) {
a = magnet.bounds.a;
b = magnet.bounds.b;
if (isNaN(a.x) || isNaN(a.y) || isNaN(b.x) || isNaN(b.y)) {
parent.remove(shape);
return true;
}
return false;
});
this.cleanUp(shape);
}
}.bind(this));
},*/
_delegateEvent: function(event) {
if(this.eventHandlerCallback && ( event.target == this.rootNode || event.target == this.rootNode.parentNode )) {
this.eventHandlerCallback(event, this);
}
},
toString: function() { return "Canvas " + this.id },
/**
* Calls {@link ORYX.Core.AbstractShape#toJSON} and adds some stencil set information.
*/
toJSON: function() {
var json = arguments.callee.$.toJSON.apply(this, arguments);
// if(ORYX.CONFIG.STENCILSET_HANDLER.length > 0) {
// json.stencilset = {
// url: this.getStencil().stencilSet().namespace()
// };
// } else {
json.stencilset = {
url: this.getStencil().stencilSet().source(),
namespace: this.getStencil().stencilSet().namespace()
};
// }
return json;
},
getChildShapeOrCanvasByResourceId: function getChildShapeOrCanvasByResourceId(resourceId) {
resourceId = ERDF.__stripHashes(resourceId);
if (this.resourceId == resourceId) {
return this;
} else {
return this.getChildShapeByResourceId(resourceId);
}
}
});
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
ORYX.Core.UIEnableDrag = function(event, uiObj, option) {
this.uiObj = uiObj;
var upL = uiObj.bounds.upperLeft();
var a = uiObj.node.getScreenCTM();
this.faktorXY= {x: a.a, y: a.d};
this.scrollNode = uiObj.node.ownerSVGElement.parentNode.parentNode;
this.offSetPosition = {
x: Event.pointerX(event) - (upL.x * this.faktorXY.x),
y: Event.pointerY(event) - (upL.y * this.faktorXY.y)};
this.offsetScroll = {x:this.scrollNode.scrollLeft,y:this.scrollNode.scrollTop};
this.dragCallback = ORYX.Core.UIDragCallback.bind(this);
this.disableCallback = ORYX.Core.UIDisableDrag.bind(this);
this.movedCallback = option ? option.movedCallback : undefined;
this.upCallback = option ? option.upCallback : undefined;
document.documentElement.addEventListener(ORYX.CONFIG.EVENT_MOUSEUP, this.disableCallback, true);
document.documentElement.addEventListener(ORYX.CONFIG.EVENT_MOUSEMOVE, this.dragCallback , false);
};
ORYX.Core.UIDragCallback = function(event) {
var position = {
x: Event.pointerX(event) - this.offSetPosition.x,
y: Event.pointerY(event) - this.offSetPosition.y}
position.x -= this.offsetScroll.x - this.scrollNode.scrollLeft;
position.y -= this.offsetScroll.y - this.scrollNode.scrollTop;
position.x /= this.faktorXY.x;
position.y /= this.faktorXY.y;
this.uiObj.bounds.moveTo(position);
//this.uiObj.update();
if(this.movedCallback)
this.movedCallback(event);
Event.stop(event);
};
ORYX.Core.UIDisableDrag = function(event) {
document.documentElement.removeEventListener(ORYX.CONFIG.EVENT_MOUSEMOVE, this.dragCallback, false);
document.documentElement.removeEventListener(ORYX.CONFIG.EVENT_MOUSEUP, this.disableCallback, true);
if(this.upCallback)
this.upCallback(event);
this.upCallback = undefined;
this.movedCallback = undefined;
Event.stop(event);
};
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Init namespaces
*/
if(!ORYX) {var ORYX = {};}
if(!ORYX.Core) {ORYX.Core = {};}
/**
* @classDescription With Bounds you can set and get position and size of UIObjects.
*/
ORYX.Core.Bounds = {
/**
* Constructor
*/
construct: function() {
this._changedCallbacks = []; //register a callback with changedCallacks.push(this.method.bind(this));
this.a = {};
this.b = {};
this.set.apply(this, arguments);
this.suspendChange = false;
this.changedWhileSuspend = false;
},
/**
* Calls all registered callbacks.
*/
_changed: function(sizeChanged) {
if(!this.suspendChange) {
this._changedCallbacks.each(function(callback) {
callback(this, sizeChanged);
}.bind(this));
this.changedWhileSuspend = false;
} else
this.changedWhileSuspend = true;
},
/**
* Registers a callback that is called, if the bounds changes.
* @param callback {Function} The callback function.
*/
registerCallback: function(callback) {
if(!this._changedCallbacks.member(callback)) {
this._changedCallbacks.push(callback);
}
},
/**
* Unregisters a callback.
* @param callback {Function} The callback function.
*/
unregisterCallback: function(callback) {
this._changedCallbacks = this._changedCallbacks.without(callback);
},
resize: function resize(orientation, newBounds) {
var changed = false;
if (orientation === "southeast") {
if (this.width() !== newBounds.width) {
changed = true;
var difference = newBounds.width - this.width();
this.a.x = this.a.x - difference;
}
if (this.height() !== newBounds.height) {
changed = true;
var difference = newBounds.height - this.height();
this.a.y = this.a.y - difference;
}
} else if (orientation === "northwest") {
if (this.width() !== newBounds.width) {
changed = true;
var difference = newBounds.width - this.width();
this.b.x = this.b.x + difference;
}
if (this.height !== newBounds.height) {
changed = true;
var difference = newBounds.height - this.height();
this.b.y = this.b.y + difference;
}
}
if(changed) {
this._changed(true);
}
},
/**
* Sets position and size of the shape dependent of four coordinates
* (set(ax, ay, bx, by);), two points (set({x: ax, y: ay}, {x: bx, y: by});)
* or one bound (set({a: {x: ax, y: ay}, b: {x: bx, y: by}});).
*/
set: function() {
var changed = false;
switch (arguments.length) {
case 1:
if(this.a.x !== arguments[0].a.x) {
changed = true;
this.a.x = arguments[0].a.x;
}
if(this.a.y !== arguments[0].a.y) {
changed = true;
this.a.y = arguments[0].a.y;
}
if(this.b.x !== arguments[0].b.x) {
changed = true;
this.b.x = arguments[0].b.x;
}
if(this.b.y !== arguments[0].b.y) {
changed = true;
this.b.y = arguments[0].b.y;
}
break;
case 2:
var ax = Math.min(arguments[0].x, arguments[1].x);
var ay = Math.min(arguments[0].y, arguments[1].y);
var bx = Math.max(arguments[0].x, arguments[1].x);
var by = Math.max(arguments[0].y, arguments[1].y);
if(this.a.x !== ax) {
changed = true;
this.a.x = ax;
}
if(this.a.y !== ay) {
changed = true;
this.a.y = ay;
}
if(this.b.x !== bx) {
changed = true;
this.b.x = bx;
}
if(this.b.y !== by) {
changed = true;
this.b.y = by;
}
break;
case 4:
var ax = Math.min(arguments[0], arguments[2]);
var ay = Math.min(arguments[1], arguments[3]);
var bx = Math.max(arguments[0], arguments[2]);
var by = Math.max(arguments[1], arguments[3]);
if(this.a.x !== ax) {
changed = true;
this.a.x = ax;
}
if(this.a.y !== ay) {
changed = true;
this.a.y = ay;
}
if(this.b.x !== bx) {
changed = true;
this.b.x = bx;
}
if(this.b.y !== by) {
changed = true;
this.b.y = by;
}
break;
}
if(changed) {
this._changed(true);
}
},
/**
* Moves the bounds so that the point p will be the new upper left corner.
* @param {Point} p
* or
* @param {Number} x
* @param {Number} y
*/
moveTo: function() {
var currentPosition = this.upperLeft();
switch (arguments.length) {
case 1:
this.moveBy({
x: arguments[0].x - currentPosition.x,
y: arguments[0].y - currentPosition.y
});
break;
case 2:
this.moveBy({
x: arguments[0] - currentPosition.x,
y: arguments[1] - currentPosition.y
});
break;
default:
//TODO error
}
},
/**
* Moves the bounds relatively by p.
* @param {Point} p
* or
* @param {Number} x
* @param {Number} y
*
*/
moveBy: function() {
var changed = false;
switch (arguments.length) {
case 1:
var p = arguments[0];
if(p.x !== 0 || p.y !== 0) {
changed = true;
this.a.x += p.x;
this.b.x += p.x;
this.a.y += p.y;
this.b.y += p.y;
}
break;
case 2:
var x = arguments[0];
var y = arguments[1];
if(x !== 0 || y !== 0) {
changed = true;
this.a.x += x;
this.b.x += x;
this.a.y += y;
this.b.y += y;
}
break;
default:
//TODO error
}
if(changed) {
this._changed();
}
},
/***
* Includes the bounds b into the current bounds.
* @param {Bounds} b
*/
include: function(b) {
if( (this.a.x === undefined) && (this.a.y === undefined) &&
(this.b.x === undefined) && (this.b.y === undefined)) {
return b;
};
var cx = Math.min(this.a.x,b.a.x);
var cy = Math.min(this.a.y,b.a.y);
var dx = Math.max(this.b.x,b.b.x);
var dy = Math.max(this.b.y,b.b.y);
this.set(cx, cy, dx, dy);
},
/**
* Relatively extends the bounds by p.
* @param {Point} p
*/
extend: function(p) {
if(p.x !== 0 || p.y !== 0) {
// this is over cross for the case that a and b have same coordinates.
//((this.a.x > this.b.x) ? this.a : this.b).x += p.x;
//((this.b.y > this.a.y) ? this.b : this.a).y += p.y;
this.b.x += p.x;
this.b.y += p.y;
this._changed(true);
}
},
/**
* Widens the scope of the bounds by x.
* @param {Number} x
*/
widen: function(x) {
if (x !== 0) {
this.suspendChange = true;
this.moveBy({x: -x, y: -x});
this.extend({x: 2*x, y: 2*x});
this.suspendChange = false;
if(this.changedWhileSuspend) {
this._changed(true);
}
}
},
/**
* Returns the upper left corner's point regardless of the
* bound delimiter points.
*/
upperLeft: function() {
return {x:this.a.x, y:this.a.y};
},
/**
* Returns the lower Right left corner's point regardless of the
* bound delimiter points.
*/
lowerRight: function() {
return {x:this.b.x, y:this.b.y};
},
/**
* @return {Number} Width of bounds.
*/
width: function() {
return this.b.x - this.a.x;
},
/**
* @return {Number} Height of bounds.
*/
height: function() {
return this.b.y - this.a.y;
},
diagonal: function diagonal() {
return Math.sqrt((this.width() * this.width()) - (this.height() * this.height()));
},
/**
* @return {Point} The center point of this bounds.
*/
center: function() {
return {
x: (this.a.x + this.b.x)/2.0,
y: (this.a.y + this.b.y)/2.0
};
},
/**
* @return {Point} The center point of this bounds relative to upperLeft.
*/
midPoint: function() {
return {
x: (this.b.x - this.a.x)/2.0,
y: (this.b.y - this.a.y)/2.0
};
},
/**
* Moves the center point of this bounds to the new position.
* @param p {Point}
* or
* @param x {Number}
* @param y {Number}
*/
centerMoveTo: function() {
var currentPosition = this.center();
switch (arguments.length) {
case 1:
this.moveBy(arguments[0].x - currentPosition.x,
arguments[0].y - currentPosition.y);
break;
case 2:
this.moveBy(arguments[0] - currentPosition.x,
arguments[1] - currentPosition.y);
break;
}
},
isIncluded: function(point, offset) {
var pointX, pointY, offset;
// Get the the two Points
switch(arguments.length) {
case 1:
pointX = arguments[0].x;
pointY = arguments[0].y;
offset = 0;
break;
case 2:
if(arguments[0].x && arguments[0].y) {
pointX = arguments[0].x;
pointY = arguments[0].y;
offset = Math.abs(arguments[1]);
} else {
pointX = arguments[0];
pointY = arguments[1];
offset = 0;
}
break;
case 3:
pointX = arguments[0];
pointY = arguments[1];
offset = Math.abs(arguments[2]);
break;
default:
throw "isIncluded needs one, two or three arguments";
}
var ul = this.upperLeft();
var lr = this.lowerRight();
if(pointX >= ul.x - offset
&& pointX <= lr.x + offset && pointY >= ul.y - offset
&& pointY <= lr.y + offset)
return true;
else
return false;
},
/**
* @return {Bounds} A copy of this bounds.
*/
clone: function() {
//Returns a new bounds object without the callback
// references of the original bounds
return new ORYX.Core.Bounds(this);
},
toString: function() {
return "( "+this.a.x+" | "+this.a.y+" )/( "+this.b.x+" | "+this.b.y+" )";
},
serializeForERDF: function() {
return this.a.x+","+this.a.y+","+this.b.x+","+this.b.y;
}
};
ORYX.Core.Bounds = Clazz.extend(ORYX.Core.Bounds);
| JavaScript |
/**
* Copyright (c) 2009-2010
* processWave.org (Michael Goderbauer, Markus Goetz, Marvin Killing, Martin
* Kreichgauer, Martin Krueger, Christian Ress, Thomas Zimmermann)
*
* based on oryx-project.org (Martin Czuchra, Nicolas Peters, Daniel Polak,
* Willi Tscheschner, Oliver Kopp, Philipp Giese, Sven Wagner-Boysen, Philipp Berger, Jan-Felix Schwarz)
*
* 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.
**/
/**
* Contains all strings for the default language (en-us).
* Version 1 - 08/29/08
*/
if(!ORYX) var ORYX = {};
if(!ORYX.I18N) ORYX.I18N = {};
ORYX.I18N.Language = "en_us"; //Pattern <ISO language code>_<ISO country code> in lower case!
if(!ORYX.I18N.Oryx) ORYX.I18N.Oryx = {};
ORYX.I18N.Oryx.title = "Oryx";
ORYX.I18N.Oryx.noBackendDefined = "Caution! \nNo Backend defined.\n The requested model cannot be loaded. Try to load a configuration with a save plugin.";
ORYX.I18N.Oryx.pleaseWait = "Please wait while loading...";
ORYX.I18N.Oryx.notLoggedOn = "Not logged on";
ORYX.I18N.Oryx.editorOpenTimeout = "The editor does not seem to be started yet. Please check, whether you have a popup blocker enabled and disable it or allow popups for this site. We will never display any commercials on this site.";
if(!ORYX.I18N.AddDocker) ORYX.I18N.AddDocker = {};
ORYX.I18N.AddDocker.group = "Docker";
ORYX.I18N.AddDocker.add = "Add Docker";
ORYX.I18N.AddDocker.addDesc = "Add docker to edge (Alt+Click)";
ORYX.I18N.AddDocker.del = "Delete Docker";
ORYX.I18N.AddDocker.delDesc = "Delete docker (Alt+Click)";
if(!ORYX.I18N.SSExtensionLoader) ORYX.I18N.SSExtensionLoader = {};
ORYX.I18N.SSExtensionLoader.group = "Stencil Set";
ORYX.I18N.SSExtensionLoader.add = "Add Stencil Set Extension";
ORYX.I18N.SSExtensionLoader.addDesc = "Add a stencil set extension";
ORYX.I18N.SSExtensionLoader.loading = "Loading Stencil Set Extension";
ORYX.I18N.SSExtensionLoader.noExt = "There are no extensions available or all available extensions are already loaded.";
ORYX.I18N.SSExtensionLoader.failed1 = "Loading stencil set extensions configuration failed. The response is not a valid configuration file.";
ORYX.I18N.SSExtensionLoader.failed2 = "Loading stencil set extension configuration file failed. The request returned an error.";
ORYX.I18N.SSExtensionLoader.panelTitle = "Stencil Set Extensions";
ORYX.I18N.SSExtensionLoader.panelText = "Select the stencil set extensions you want to load.";
if(!ORYX.I18N.AdHocCC) ORYX.I18N.AdHocCC = {};
ORYX.I18N.AdHocCC.group = "Ad Hoc";
ORYX.I18N.AdHocCC.compl = "Edit Completion Condition";
ORYX.I18N.AdHocCC.complDesc = "Edit an Ad Hoc Activity's Completion Condition";
ORYX.I18N.AdHocCC.notOne = "Not exactly one element selected!";
ORYX.I18N.AdHocCC.nodAdHocCC = "Selected element has no ad hoc completion condition!";
ORYX.I18N.AdHocCC.selectTask = "Select a task...";
ORYX.I18N.AdHocCC.selectState = "Select a state...";
ORYX.I18N.AdHocCC.addExp = "Add Expression";
ORYX.I18N.AdHocCC.selectDataField = "Select a data field...";
ORYX.I18N.AdHocCC.enterEqual = "Enter a value that must equal...";
ORYX.I18N.AdHocCC.and = "and";
ORYX.I18N.AdHocCC.or = "or";
ORYX.I18N.AdHocCC.not = "not";
ORYX.I18N.AdHocCC.clearCC = "Clear Completion Condition";
ORYX.I18N.AdHocCC.editCC = "Edit Ad-Hoc Completion Condtions";
ORYX.I18N.AdHocCC.addExecState = "Add Execution State Expression: ";
ORYX.I18N.AdHocCC.addDataExp = "Add Data Expression: ";
ORYX.I18N.AdHocCC.addLogOp = "Add Logical Operators: ";
ORYX.I18N.AdHocCC.curCond = "Current Completion Condition: ";
if(!ORYX.I18N.AMLSupport) ORYX.I18N.AMLSupport = {};
ORYX.I18N.AMLSupport.group = "EPC";
ORYX.I18N.AMLSupport.imp = "Import AML file";
ORYX.I18N.AMLSupport.impDesc = "Import an Aris 7 AML file";
ORYX.I18N.AMLSupport.failed = "Importing AML file failed. Please check, if the selected file is a valid AML file. Error message: ";
ORYX.I18N.AMLSupport.failed2 = "Importing AML file failed: ";
ORYX.I18N.AMLSupport.noRights = "You have no rights to import multiple EPC-Diagrams (Login required).";
ORYX.I18N.AMLSupport.panelText = "Select an AML (.xml) file to import.";
ORYX.I18N.AMLSupport.file = "File";
ORYX.I18N.AMLSupport.importBtn = "Import AML-File";
ORYX.I18N.AMLSupport.get = "Get diagrams...";
ORYX.I18N.AMLSupport.close = "Close";
ORYX.I18N.AMLSupport.title = "Title";
ORYX.I18N.AMLSupport.selectDiagrams = "Select the diagram(s) you want to import. <br/> If one model is selected, it will be imported in the current editor, if more than one is selected, those models will directly be stored in the repository.";
ORYX.I18N.AMLSupport.impText = "Import";
ORYX.I18N.AMLSupport.impProgress = "Importing...";
ORYX.I18N.AMLSupport.cancel = "Cancel";
ORYX.I18N.AMLSupport.name = "Name";
ORYX.I18N.AMLSupport.allImported = "All imported diagrams.";
ORYX.I18N.AMLSupport.ok = "Ok";
if(!ORYX.I18N.Arrangement) ORYX.I18N.Arrangement = {};
ORYX.I18N.Arrangement.groupZ = "Z-Order";
ORYX.I18N.Arrangement.btf = "Bring To Front";
ORYX.I18N.Arrangement.btfDesc = "Bring to Front";
ORYX.I18N.Arrangement.btb = "Bring To Back";
ORYX.I18N.Arrangement.btbDesc = "Bring To Back";
ORYX.I18N.Arrangement.bf = "Bring Forward";
ORYX.I18N.Arrangement.bfDesc = "Bring Forward";
ORYX.I18N.Arrangement.bb = "Bring Backward";
ORYX.I18N.Arrangement.bbDesc = "Bring Backward";
ORYX.I18N.Arrangement.groupA = "Alignment";
ORYX.I18N.Arrangement.ab = "Alignment Bottom";
ORYX.I18N.Arrangement.abDesc = "Bottom";
ORYX.I18N.Arrangement.am = "Alignment Middle";
ORYX.I18N.Arrangement.amDesc = "Middle";
ORYX.I18N.Arrangement.at = "Alignment Top";
ORYX.I18N.Arrangement.atDesc = "Top";
ORYX.I18N.Arrangement.al = "Alignment Left";
ORYX.I18N.Arrangement.alDesc = "Left";
ORYX.I18N.Arrangement.ac = "Alignment Center";
ORYX.I18N.Arrangement.acDesc = "Center";
ORYX.I18N.Arrangement.ar = "Alignment Right";
ORYX.I18N.Arrangement.arDesc = "Right";
ORYX.I18N.Arrangement.as = "Alignment Same Size";
ORYX.I18N.Arrangement.asDesc = "Same Size";
if(!ORYX.I18N.BPELSupport) ORYX.I18N.BPELSupport = {};
ORYX.I18N.BPELSupport.group = "BPEL";
ORYX.I18N.BPELSupport.exp = "Export BPEL";
ORYX.I18N.BPELSupport.expDesc = "Export diagram to BPEL";
ORYX.I18N.BPELSupport.imp = "Import BPEL";
ORYX.I18N.BPELSupport.impDesc = "Import a BPEL file";
ORYX.I18N.BPELSupport.selectFile = "Select a BPEL file to import";
ORYX.I18N.BPELSupport.file = "file";
ORYX.I18N.BPELSupport.impPanel = "Import BPEL file";
ORYX.I18N.BPELSupport.impBtn = "Import";
ORYX.I18N.BPELSupport.content = "content";
ORYX.I18N.BPELSupport.close = "Close";
ORYX.I18N.BPELSupport.error = "Error";
ORYX.I18N.BPELSupport.progressImp = "Import...";
ORYX.I18N.BPELSupport.progressExp = "Export...";
ORYX.I18N.BPELSupport.impFailed = "An error while importing occurs! <br/>Please check error message: <br/><br/>";
if(!ORYX.I18N.BPELLayout) ORYX.I18N.BPELLayout = {};
ORYX.I18N.BPELLayout.group = "BPELLayout";
ORYX.I18N.BPELLayout.disable = "disable layout";
ORYX.I18N.BPELLayout.disDesc = "disable auto layout plug-in";
ORYX.I18N.BPELLayout.enable = "enable layout";
ORYX.I18N.BPELLayout.enDesc = "enable auto layout plug-in";
if(!ORYX.I18N.BPEL4ChorSupport) ORYX.I18N.BPEL4ChorSupport = {};
ORYX.I18N.BPEL4ChorSupport.group = "BPEL4Chor";
ORYX.I18N.BPEL4ChorSupport.exp = "Export BPEL4Chor";
ORYX.I18N.BPEL4ChorSupport.expDesc = "Export diagram to BPEL4Chor";
ORYX.I18N.BPEL4ChorSupport.imp = "Import BPEL4Chor";
ORYX.I18N.BPEL4ChorSupport.impDesc = "Import a BPEL4Chor file";
ORYX.I18N.BPEL4ChorSupport.gen = "BPEL4Chor generator";
ORYX.I18N.BPEL4ChorSupport.genDesc = "generate values of some BPEL4Chor properties if they are already known(e.g. sender of messageLink)";
ORYX.I18N.BPEL4ChorSupport.selectFile = "Select a BPEL4Chor file to import";
ORYX.I18N.BPEL4ChorSupport.file = "file";
ORYX.I18N.BPEL4ChorSupport.impPanel = "Import BPEL4Chor file";
ORYX.I18N.BPEL4ChorSupport.impBtn = "Import";
ORYX.I18N.BPEL4ChorSupport.content = "content";
ORYX.I18N.BPEL4ChorSupport.close = "Close";
ORYX.I18N.BPEL4ChorSupport.error = "Error";
ORYX.I18N.BPEL4ChorSupport.progressImp = "Import...";
ORYX.I18N.BPEL4ChorSupport.progressExp = "Export...";
ORYX.I18N.BPEL4ChorSupport.impFailed = "An error while importing occurs! <br/>Please check error message: <br/><br/>";
if(!ORYX.I18N.Bpel4ChorTransformation) ORYX.I18N.Bpel4ChorTransformation = {};
ORYX.I18N.Bpel4ChorTransformation.group = "Export";
ORYX.I18N.Bpel4ChorTransformation.exportBPEL = "Export BPEL4Chor";
ORYX.I18N.Bpel4ChorTransformation.exportBPELDesc = "Export diagram to BPEL4Chor";
ORYX.I18N.Bpel4ChorTransformation.exportXPDL = "Export XPDL4Chor";
ORYX.I18N.Bpel4ChorTransformation.exportXPDLDesc = "Export diagram to XPDL4Chor";
ORYX.I18N.Bpel4ChorTransformation.warning = "Warning";
ORYX.I18N.Bpel4ChorTransformation.wrongValue = 'The changed name must have the value "1" to avoid errors during the transformation to BPEL4Chor';
ORYX.I18N.Bpel4ChorTransformation.loopNone = 'The loop type of the receive task must be "None" to be transformable to BPEL4Chor';
ORYX.I18N.Bpel4ChorTransformation.error = "Error";
ORYX.I18N.Bpel4ChorTransformation.noSource = "1 with id 2 has no source object.";
ORYX.I18N.Bpel4ChorTransformation.noTarget = "1 with id 2 has no target object.";
ORYX.I18N.Bpel4ChorTransformation.transCall = "An error occured during the transformation call. 1:2";
ORYX.I18N.Bpel4ChorTransformation.loadingXPDL4ChorExport = "Export to XPDL4Chor";
ORYX.I18N.Bpel4ChorTransformation.loadingBPEL4ChorExport = "Export to BPEL4Chor";
ORYX.I18N.Bpel4ChorTransformation.noGen = "The transformation input could not be generated: 1\n2\n";
ORYX.I18N.BPMN2PNConverter = {
name: "Convert to Petri net",
desc: "Converts BPMN diagrams to Petri nets",
group: "Export",
error: "Error",
errors: {
server: "Couldn't import BPNM diagram.",
noRights: "Don't you have read permissions on given model?",
notSaved: "Model must be saved and reopened for using Petri net exporter!"
},
progress: {
status: "Status",
importingModel: "Importing BPMN Model",
fetchingModel: "Fetching",
convertingModel: "Converting",
renderingModel: "Rendering"
}
}
if(!ORYX.I18N.TransformationDownloadDialog) ORYX.I18N.TransformationDownloadDialog = {};
ORYX.I18N.TransformationDownloadDialog.error = "Error";
ORYX.I18N.TransformationDownloadDialog.noResult = "The transformation service did not return a result.";
ORYX.I18N.TransformationDownloadDialog.errorParsing = "Error During the Parsing of the Diagram.";
ORYX.I18N.TransformationDownloadDialog.transResult = "Transformation Results";
ORYX.I18N.TransformationDownloadDialog.showFile = "Show the result file";
ORYX.I18N.TransformationDownloadDialog.downloadFile = "Download the result file";
ORYX.I18N.TransformationDownloadDialog.downloadAll = "Download all result files";
if(!ORYX.I18N.DesynchronizabilityOverlay) ORYX.I18N.DesynchronizabilityOverlay = {};
//TODO desynchronizability is not a correct term
ORYX.I18N.DesynchronizabilityOverlay.group = "Overlay";
ORYX.I18N.DesynchronizabilityOverlay.name = "Desynchronizability Checker";
ORYX.I18N.DesynchronizabilityOverlay.desc = "Desynchronizability Checker";
ORYX.I18N.DesynchronizabilityOverlay.sync = "The net is desynchronizable.";
ORYX.I18N.DesynchronizabilityOverlay.error = "The net has 1 syntax errors.";
ORYX.I18N.DesynchronizabilityOverlay.invalid = "Invalid answer from server.";
if(!ORYX.I18N.Edit) ORYX.I18N.Edit = {};
ORYX.I18N.Edit.group = "Edit";
ORYX.I18N.Edit.cut = "Cut";
ORYX.I18N.Edit.cutDesc = "Cut selected shapes (Ctrl+X)";
ORYX.I18N.Edit.copy = "Copy";
ORYX.I18N.Edit.copyDesc = "Copy selected shapes(Ctrl+C)";
ORYX.I18N.Edit.paste = "Paste";
ORYX.I18N.Edit.pasteDesc = "Paste selected shapes(Ctrl+V)";
ORYX.I18N.Edit.del = "Delete";
ORYX.I18N.Edit.delDesc = "Deletes selected shapes (Delete)";
if(!ORYX.I18N.EPCSupport) ORYX.I18N.EPCSupport = {};
ORYX.I18N.EPCSupport.group = "EPC";
ORYX.I18N.EPCSupport.exp = "Export EPC";
ORYX.I18N.EPCSupport.expDesc = "Export diagram to EPML";
ORYX.I18N.EPCSupport.imp = "Import EPC";
ORYX.I18N.EPCSupport.impDesc = "Import an EPML file";
ORYX.I18N.EPCSupport.progressExp = "Exporting model";
ORYX.I18N.EPCSupport.selectFile = "Select an EPML (.empl) file to import.";
ORYX.I18N.EPCSupport.file = "File";
ORYX.I18N.EPCSupport.impPanel = "Import EPML File";
ORYX.I18N.EPCSupport.impBtn = "Import";
ORYX.I18N.EPCSupport.close = "Close";
ORYX.I18N.EPCSupport.error = "Error";
ORYX.I18N.EPCSupport.progressImp = "Import...";
if(!ORYX.I18N.ERDFSupport) ORYX.I18N.ERDFSupport = {};
ORYX.I18N.ERDFSupport.exp = "Export to ERDF";
ORYX.I18N.ERDFSupport.expDesc = "Export to ERDF";
ORYX.I18N.ERDFSupport.imp = "Import from ERDF";
ORYX.I18N.ERDFSupport.impDesc = "Import from ERDF";
ORYX.I18N.ERDFSupport.impFailed = "Request for import of ERDF failed.";
ORYX.I18N.ERDFSupport.impFailed2 = "An error while importing occurs! <br/>Please check error message: <br/><br/>";
ORYX.I18N.ERDFSupport.error = "Error";
ORYX.I18N.ERDFSupport.noCanvas = "The xml document has no Oryx canvas node included!";
ORYX.I18N.ERDFSupport.noSS = "The Oryx canvas node has no stencil set definition included!";
ORYX.I18N.ERDFSupport.wrongSS = "The given stencil set does not fit to the current editor!";
ORYX.I18N.ERDFSupport.selectFile = "Select an ERDF (.xml) file or type in the ERDF to import it!";
ORYX.I18N.ERDFSupport.file = "File";
ORYX.I18N.ERDFSupport.impERDF = "Import ERDF";
ORYX.I18N.ERDFSupport.impBtn = "Import";
ORYX.I18N.ERDFSupport.impProgress = "Importing...";
ORYX.I18N.ERDFSupport.close = "Close";
ORYX.I18N.ERDFSupport.deprTitle = "Really export to eRDF?";
ORYX.I18N.ERDFSupport.deprText = "Exporting to eRDF is not recommended anymore because the support will be stopped in future versions of the Oryx editor. If possible, export the model to JSON. Do you want to export anyway?";
if(!ORYX.I18N.jPDLSupport) ORYX.I18N.jPDLSupport = {};
ORYX.I18N.jPDLSupport.group = "ExecBPMN";
ORYX.I18N.jPDLSupport.exp = "Export to jPDL";
ORYX.I18N.jPDLSupport.expDesc = "Export to jPDL";
ORYX.I18N.jPDLSupport.imp = "Import from jPDL";
ORYX.I18N.jPDLSupport.impDesc = "Import jPDL File";
ORYX.I18N.jPDLSupport.impFailedReq = "Request for import of jPDL failed.";
ORYX.I18N.jPDLSupport.impFailedJson = "Transformation of jPDL failed.";
ORYX.I18N.jPDLSupport.impFailedJsonAbort = "Import aborted.";
ORYX.I18N.jPDLSupport.loadSseQuestionTitle = "jBPM stencil set extension needs to be loaded";
ORYX.I18N.jPDLSupport.loadSseQuestionBody = "In order to import jPDL, the stencil set extension has to be loaded. Do you want to proceed?";
ORYX.I18N.jPDLSupport.expFailedReq = "Request for export of model failed.";
ORYX.I18N.jPDLSupport.expFailedXml = "Export to jPDL failed. Exporter reported: ";
ORYX.I18N.jPDLSupport.error = "Error";
ORYX.I18N.jPDLSupport.selectFile = "Select an jPDL (.xml) file or type in the jPDL to import it!";
ORYX.I18N.jPDLSupport.file = "File";
ORYX.I18N.jPDLSupport.impJPDL = "Import jPDL";
ORYX.I18N.jPDLSupport.impBtn = "Import";
ORYX.I18N.jPDLSupport.impProgress = "Importing...";
ORYX.I18N.jPDLSupport.close = "Close";
if(!ORYX.I18N.Bpmn2Bpel) ORYX.I18N.Bpmn2Bpel = {};
ORYX.I18N.Bpmn2Bpel.group = "ExecBPMN";
ORYX.I18N.Bpmn2Bpel.show = "Show transformed BPEL";
ORYX.I18N.Bpmn2Bpel.download = "Download transformed BPEL";
ORYX.I18N.Bpmn2Bpel.deploy = "Deploy transformed BPEL";
ORYX.I18N.Bpmn2Bpel.showDesc = "Transforms BPMN to BPEL and shows the result in a new window.";
ORYX.I18N.Bpmn2Bpel.downloadDesc = "Transforms BPMN to BPEL and offers to download the result.";
ORYX.I18N.Bpmn2Bpel.deployDesc = "Transforms BPMN to BPEL and deploys the business process on the BPEL-Engine Apache ODE";
ORYX.I18N.Bpmn2Bpel.transfFailed = "Request for transformation to BPEL failed.";
ORYX.I18N.Bpmn2Bpel.ApacheOdeUrlInputTitle = "Apache ODE URL";
ORYX.I18N.Bpmn2Bpel.ApacheOdeUrlInputLabelDeploy = "Deploy Process";
ORYX.I18N.Bpmn2Bpel.ApacheOdeUrlInputLabelCancel = "Cancel";
ORYX.I18N.Bpmn2Bpel.ApacheOdeUrlInputPanelText = "Please type-in the URL to the Apache ODE BPEL-Engine. E.g.: http://myserver:8080/ode";
if(!ORYX.I18N.Save) ORYX.I18N.Save = {};
ORYX.I18N.Save.group = "File";
ORYX.I18N.Save.save = "Save";
ORYX.I18N.Save.saveDesc = "Save";
ORYX.I18N.Save.saveAs = "Save As...";
ORYX.I18N.Save.saveAsDesc = "Save As...";
ORYX.I18N.Save.unsavedData = "There are unsaved data, please save before you leave, otherwise your changes get lost!";
ORYX.I18N.Save.newProcess = "New Process";
ORYX.I18N.Save.saveAsTitle = "Save as...";
ORYX.I18N.Save.saveBtn = "Save";
ORYX.I18N.Save.close = "Close";
ORYX.I18N.Save.savedAs = "Saved As";
ORYX.I18N.Save.saved = "Saved!";
ORYX.I18N.Save.failed = "Saving failed.";
ORYX.I18N.Save.noRights = "You have no rights to save changes.";
ORYX.I18N.Save.saving = "Saving";
ORYX.I18N.Save.saveAsHint = "The process diagram is stored under:";
if(!ORYX.I18N.File) ORYX.I18N.File = {};
ORYX.I18N.File.group = "File";
ORYX.I18N.File.print = "Print";
ORYX.I18N.File.printDesc = "Print current model";
ORYX.I18N.File.pdf = "Export as PDF";
ORYX.I18N.File.pdfDesc = "Export as PDF";
ORYX.I18N.File.info = "Info";
ORYX.I18N.File.infoDesc = "Info";
ORYX.I18N.File.genPDF = "Generating PDF";
ORYX.I18N.File.genPDFFailed = "Generating PDF failed.";
ORYX.I18N.File.printTitle = "Print";
ORYX.I18N.File.printMsg = "We are currently experiencing problems with the printing function. We recommend using the PDF Export to print the diagram. Do you really want to continue printing?";
if(!ORYX.I18N.Grouping) ORYX.I18N.Grouping = {};
ORYX.I18N.Grouping.grouping = "Grouping";
ORYX.I18N.Grouping.group = "Group";
ORYX.I18N.Grouping.groupDesc = "Groups all selected shapes";
ORYX.I18N.Grouping.ungroup = "Ungroup";
ORYX.I18N.Grouping.ungroupDesc = "Deletes the group of all selected Shapes";
if(!ORYX.I18N.IBPMN2BPMN) ORYX.I18N.IBPMN2BPMN = {};
ORYX.I18N.IBPMN2BPMN.group ="Export";
ORYX.I18N.IBPMN2BPMN.name ="IBPMN 2 BPMN Mapping";
ORYX.I18N.IBPMN2BPMN.desc ="Convert IBPMN to BPMN";
if(!ORYX.I18N.Loading) ORYX.I18N.Loading = {};
ORYX.I18N.Loading.waiting ="Please wait...";
if(!ORYX.I18N.Pnmlexport) ORYX.I18N.Pnmlexport = {};
ORYX.I18N.Pnmlexport.group ="Export";
ORYX.I18N.Pnmlexport.name ="BPMN to PNML";
ORYX.I18N.Pnmlexport.desc ="Export as executable PNML and deploy";
if(!ORYX.I18N.PropertyWindow) ORYX.I18N.PropertyWindow = {};
ORYX.I18N.PropertyWindow.name = "Name";
ORYX.I18N.PropertyWindow.value = "Value";
ORYX.I18N.PropertyWindow.selected = "selected";
ORYX.I18N.PropertyWindow.clickIcon = "Click Icon";
ORYX.I18N.PropertyWindow.add = "Add";
ORYX.I18N.PropertyWindow.rem = "Remove";
ORYX.I18N.PropertyWindow.complex = "Editor for a Complex Type";
ORYX.I18N.PropertyWindow.text = "Editor for a Text Type";
ORYX.I18N.PropertyWindow.ok = "Ok";
ORYX.I18N.PropertyWindow.cancel = "Cancel";
ORYX.I18N.PropertyWindow.dateFormat = "m/d/y";
if(!ORYX.I18N.ShapeMenuPlugin) ORYX.I18N.ShapeMenuPlugin = {};
ORYX.I18N.ShapeMenuPlugin.drag = "Drag";
ORYX.I18N.ShapeMenuPlugin.clickDrag = "Click or drag";
ORYX.I18N.ShapeMenuPlugin.morphMsg = "Morph shape";
if(!ORYX.I18N.SimplePnmlexport) ORYX.I18N.SimplePnmlexport = {};
ORYX.I18N.SimplePnmlexport.group = "Export";
ORYX.I18N.SimplePnmlexport.name = "Export to PNML";
ORYX.I18N.SimplePnmlexport.desc = "Export to PNML";
if(!ORYX.I18N.StepThroughPlugin) ORYX.I18N.StepThroughPlugin = {};
ORYX.I18N.StepThroughPlugin.group = "Step Through";
ORYX.I18N.StepThroughPlugin.stepThrough = "Step Through";
ORYX.I18N.StepThroughPlugin.stepThroughDesc = "Step through your model";
ORYX.I18N.StepThroughPlugin.undo = "Undo";
ORYX.I18N.StepThroughPlugin.undoDesc = "Undo one Step";
ORYX.I18N.StepThroughPlugin.error = "Can't step through this diagram.";
ORYX.I18N.StepThroughPlugin.executing = "Executing";
if(!ORYX.I18N.SyntaxChecker) ORYX.I18N.SyntaxChecker = {};
ORYX.I18N.SyntaxChecker.group = "Verification";
ORYX.I18N.SyntaxChecker.name = "Syntax Checker";
ORYX.I18N.SyntaxChecker.desc = "Check Syntax";
ORYX.I18N.SyntaxChecker.noErrors = "There are no syntax errors.";
ORYX.I18N.SyntaxChecker.invalid = "Invalid answer from server.";
ORYX.I18N.SyntaxChecker.checkingMessage = "Checking ...";
if(!ORYX.I18N.Undo) ORYX.I18N.Undo = {};
ORYX.I18N.Undo.group = "Undo";
ORYX.I18N.Undo.undo = "Undo";
ORYX.I18N.Undo.undoDesc = "Undo (Ctrl+Z)";
ORYX.I18N.Undo.redo = "Redo";
ORYX.I18N.Undo.redoDesc = "Redo (Ctrl+Y)";
if(!ORYX.I18N.Validator) ORYX.I18N.Validator = {};
ORYX.I18N.Validator.checking = "Checking";
if(!ORYX.I18N.View) ORYX.I18N.View = {};
ORYX.I18N.View.group = "Zoom";
ORYX.I18N.View.zoomIn = "Zoom In";
ORYX.I18N.View.zoomInDesc = "Zoom in";
ORYX.I18N.View.zoomOut = "Zoom Out";
ORYX.I18N.View.zoomOutDesc = "Zoom out";
ORYX.I18N.View.zoomStandard = "Zoom Standard";
ORYX.I18N.View.zoomStandardDesc = "Zoom to 100%";
ORYX.I18N.View.zoomFitToModel = "Zoom fit to model";
ORYX.I18N.View.zoomFitToModelDesc = "Zoom to show entire model";
if(!ORYX.I18N.XFormsSerialization) ORYX.I18N.XFormsSerialization = {};
ORYX.I18N.XFormsSerialization.group = "XForms Serialization";
ORYX.I18N.XFormsSerialization.exportXForms = "XForms Export";
ORYX.I18N.XFormsSerialization.exportXFormsDesc = "Export XForms+XHTML markup";
ORYX.I18N.XFormsSerialization.importXForms = "XForms Import";
ORYX.I18N.XFormsSerialization.importXFormsDesc = "Import XForms+XHTML markup";
ORYX.I18N.XFormsSerialization.noClientXFormsSupport = "No XForms support";
ORYX.I18N.XFormsSerialization.noClientXFormsSupportDesc = "<h2>Your browser does not support XForms. Please install the <a href=\"https://addons.mozilla.org/firefox/addon/824\" target=\"_blank\">Mozilla XForms Add-on</a> for Firefox.</h2>";
ORYX.I18N.XFormsSerialization.ok = "Ok";
ORYX.I18N.XFormsSerialization.selectFile = "Select a XHTML (.xhtml) file or type in the XForms+XHTML markup to import it!";
ORYX.I18N.XFormsSerialization.selectCss = "Please insert url of css file";
ORYX.I18N.XFormsSerialization.file = "File";
ORYX.I18N.XFormsSerialization.impFailed = "Request for import of document failed.";
ORYX.I18N.XFormsSerialization.impTitle = "Import XForms+XHTML document";
ORYX.I18N.XFormsSerialization.expTitle = "Export XForms+XHTML document";
ORYX.I18N.XFormsSerialization.impButton = "Import";
ORYX.I18N.XFormsSerialization.impProgress = "Importing...";
ORYX.I18N.XFormsSerialization.close = "Close";
if(!ORYX.I18N.TreeGraphSupport) ORYX.I18N.TreeGraphSupport = {};
ORYX.I18N.TreeGraphSupport.syntaxCheckName = "Syntax Check";
ORYX.I18N.TreeGraphSupport.group = "Tree Graph Support";
ORYX.I18N.TreeGraphSupport.syntaxCheckDesc = "Check the syntax of an tree graph structure";
if(!ORYX.I18N.QueryEvaluator) ORYX.I18N.QueryEvaluator = {};
ORYX.I18N.QueryEvaluator.name = "Query Evaluator";
ORYX.I18N.QueryEvaluator.group = "Verification";
ORYX.I18N.QueryEvaluator.desc = "Evaluate query";
ORYX.I18N.QueryEvaluator.noResult = "Query resulted in no match.";
ORYX.I18N.QueryEvaluator.invalidResponse = "Invalid answer from server.";
// if(!ORYX.I18N.QueryResultHighlighter) ORYX.I18N.QueryResultHighlighter = {};
//
// ORYX.I18N.QueryResultHighlighter.name = "Query Result Highlighter";
/** New Language Properties: 08.12.2008 */
ORYX.I18N.PropertyWindow.title = "Properties";
if(!ORYX.I18N.ShapeRepository) ORYX.I18N.ShapeRepository = {};
ORYX.I18N.ShapeRepository.title = "Shape Repository";
ORYX.I18N.Save.dialogDesciption = "Please enter a name, a description and a comment.";
ORYX.I18N.Save.dialogLabelTitle = "Title";
ORYX.I18N.Save.dialogLabelDesc = "Description";
ORYX.I18N.Save.dialogLabelType = "Type";
ORYX.I18N.Save.dialogLabelComment = "Revision comment";
ORYX.I18N.Validator.name = "BPMN Validator";
ORYX.I18N.Validator.description = "Validation for BPMN";
ORYX.I18N.SSExtensionLoader.labelImport = "Import";
ORYX.I18N.SSExtensionLoader.labelCancel = "Cancel";
Ext.MessageBox.buttonText.yes = "Yes";
Ext.MessageBox.buttonText.no = "No";
Ext.MessageBox.buttonText.cancel = "Cancel";
Ext.MessageBox.buttonText.ok = "OK";
/** New Language Properties: 28.01.2009 */
if(!ORYX.I18N.BPMN2XPDL) ORYX.I18N.BPMN2XPDL = {};
ORYX.I18N.BPMN2XPDL.group = "Export";
ORYX.I18N.BPMN2XPDL.xpdlExport = "Export to XPDL";
/** Resource Perspective Additions: 24 March 2009 */
if(!ORYX.I18N.ResourcesSoDAdd) ORYX.I18N.ResourcesSoDAdd = {};
ORYX.I18N.ResourcesSoDAdd.name = "Define Separation of Duties Contraint";
ORYX.I18N.ResourcesSoDAdd.group = "Resource Perspective";
ORYX.I18N.ResourcesSoDAdd.desc = "Define a Separation of Duties constraint for the selected tasks";
if(!ORYX.I18N.ResourcesSoDShow) ORYX.I18N.ResourcesSoDShow = {};
ORYX.I18N.ResourcesSoDShow.name = "Show Separation of Duties Constraints";
ORYX.I18N.ResourcesSoDShow.group = "Resource Perspective";
ORYX.I18N.ResourcesSoDShow.desc = "Show Separation of Duties constraints of the selected task";
if(!ORYX.I18N.ResourcesBoDAdd) ORYX.I18N.ResourcesBoDAdd = {};
ORYX.I18N.ResourcesBoDAdd.name = "Define Binding of Duties Constraint";
ORYX.I18N.ResourcesBoDAdd.group = "Resource Perspective";
ORYX.I18N.ResourcesBoDAdd.desc = "Define a Binding of Duties Constraint for the selected tasks";
if(!ORYX.I18N.ResourcesBoDShow) ORYX.I18N.ResourcesBoDShow = {};
ORYX.I18N.ResourcesBoDShow.name = "Show Binding of Duties Constraints";
ORYX.I18N.ResourcesBoDShow.group = "Resource Perspective";
ORYX.I18N.ResourcesBoDShow.desc = "Show Binding of Duties constraints of the selected task";
if(!ORYX.I18N.ResourceAssignment) ORYX.I18N.ResourceAssignment = {};
ORYX.I18N.ResourceAssignment.name = "Resource Assignment";
ORYX.I18N.ResourceAssignment.group = "Resource Perspective";
ORYX.I18N.ResourceAssignment.desc = "Assign resources to the selected task(s)";
if(!ORYX.I18N.ClearSodBodHighlights) ORYX.I18N.ClearSodBodHighlights = {};
ORYX.I18N.ClearSodBodHighlights.name = "Clear Highlights and Overlays";
ORYX.I18N.ClearSodBodHighlights.group = "Resource Perspective";
ORYX.I18N.ClearSodBodHighlights.desc = "Remove all Separation and Binding of Duties Highlights/ Overlays";
if(!ORYX.I18N.Perspective) ORYX.I18N.Perspective = {};
ORYX.I18N.Perspective.no = "No Perspective"
ORYX.I18N.Perspective.noTip = "Unload the current perspective"
/** New Language Properties: 21.04.2009 */
ORYX.I18N.JSONSupport = {
imp: {
name: "Import from JSON",
desc: "Imports a model from JSON",
group: "Export",
selectFile: "Select an JSON (.json) file or type in JSON to import it!",
file: "File",
btnImp: "Import",
btnClose: "Close",
progress: "Importing ...",
syntaxError: "Syntax error"
},
exp: {
name: "Export to JSON",
desc: "Exports current model to JSON",
group: "Export"
}
};
/** New Language Properties: 08.05.2009 */
if(!ORYX.I18N.BPMN2XHTML) ORYX.I18N.BPMN2XHTML = {};
ORYX.I18N.BPMN2XHTML.group = "Export";
ORYX.I18N.BPMN2XHTML.XHTMLExport = "Export XHTML Documentation";
/** New Language Properties: 09.05.2009 */
if(!ORYX.I18N.JSONImport) ORYX.I18N.JSONImport = {};
ORYX.I18N.JSONImport.title = "JSON Import";
ORYX.I18N.JSONImport.wrongSS = "The stencil set of the imported file ({0}) does not match to the loaded stencil set ({1})."
if(!ORYX.I18N.Feedback) ORYX.I18N.Feedback = {};
ORYX.I18N.Feedback.name = "Feedback";
ORYX.I18N.Feedback.desc = "Contact us for any kind of feedback!";
ORYX.I18N.Feedback.pTitle = "Contact us for any kind of feedback!";
ORYX.I18N.Feedback.pName = "Name";
ORYX.I18N.Feedback.pEmail = "E-Mail";
ORYX.I18N.Feedback.pSubject = "Subject";
ORYX.I18N.Feedback.pMsg = "Description/Message";
ORYX.I18N.Feedback.pEmpty = "* Please provide as detailed information as possible so that we can understand your request.\n* For bug reports, please list the steps how to reproduce the problem and describe the output you expected.";
ORYX.I18N.Feedback.pAttach = "Attach current model";
ORYX.I18N.Feedback.pAttachDesc = "This information can be helpful for debugging purposes. If your model contains some sensitive data, remove it before or uncheck this behavior.";
ORYX.I18N.Feedback.pBrowser = "Information about your browser and environment";
ORYX.I18N.Feedback.pBrowserDesc = "This information has been auto-detected from your browser. It can be helpful if you encountered a bug associated with browser-specific behavior.";
ORYX.I18N.Feedback.submit = "Send Message";
ORYX.I18N.Feedback.sending = "Sending message ...";
ORYX.I18N.Feedback.success = "Success";
ORYX.I18N.Feedback.successMsg = "Thank you for your feedback!";
ORYX.I18N.Feedback.failure = "Failure";
ORYX.I18N.Feedback.failureMsg = "Unfortunately, the message could not be sent. This is our fault! Please try again or contact someone at http://code.google.com/p/oryx-editor/";
ORYX.I18N.Feedback.name = "Feedback";
ORYX.I18N.Feedback.failure = "Failure";
ORYX.I18N.Feedback.failureMsg = "Unfortunately, the message could not be sent. This is our fault! Please try again or contact someone at http://code.google.com/p/oryx-editor/";
ORYX.I18N.Feedback.submit = "Send Message";
ORYX.I18N.Feedback.emailDesc = "Your e-mail address?";
ORYX.I18N.Feedback.titleDesc = "Summarize your message with a short title";
ORYX.I18N.Feedback.descriptionDesc = "Describe your idea, question, or problem."
ORYX.I18N.Feedback.info = '<p>Oryx is a research platform intended to support scientists in the field of business process management and beyond with a flexible, extensible tool to validate research theses and conduct experiments.</p><p>We are happy to provide you with the <a href="http://bpt.hpi.uni-potsdam.de/Oryx/ReleaseNotes" target="_blank"> latest technology and advancements</a> of our platform. <a href="http://bpt.hpi.uni-potsdam.de/Oryx/DeveloperNetwork" target="_blank">We</a> work hard to provide you with a reliable system, even though you may experience small hiccups from time to time.</p><p>If you have ideas how to improve Oryx, have a question related to the platform, or want to report a problem: <strong>Please, let us know. Here.</strong></p>'; // general info will be shown, if no subject specific info is given
// list subjects in reverse order of appearance!
ORYX.I18N.Feedback.subjects = [
{
id: "question", // ansi-compatible name
name: "Question", // natural name
description: "Ask your question here! \nPlease give us as much information as possible, so we don't have to bother you with more questions, before we can give an answer.", // default text for the description text input field
info: "" // optional field to give more info
},
{
id: "problem", // ansi-compatible name
name: "Problem", // natural name
description: "We're sorry for the inconvenience. Give us feedback on the problem, and we'll try to solve it for you. Describe it as detailed as possible, please.", // default text for the description text input field
info: "" // optional field to give more info
},
{
id: "idea", // ansi-compatible name
name: "Idea", // natural name
description: "Share your ideas and thoughts here!", // default text for the description text input field
info: "" // optional field to give more info
}
];
/** New Language Properties: 11.05.2009 */
if(!ORYX.I18N.BPMN2DTRPXMI) ORYX.I18N.BPMN2DTRPXMI = {};
ORYX.I18N.BPMN2DTRPXMI.group = "Export";
ORYX.I18N.BPMN2DTRPXMI.DTRPXMIExport = "Export to XMI (Design Thinking)";
ORYX.I18N.BPMN2DTRPXMI.DTRPXMIExportDescription = "Exports current model to XMI (requires stencil set extension 'BPMN Subset for Design Thinking')";
/** New Language Properties: 14.05.2009 */
if(!ORYX.I18N.RDFExport) ORYX.I18N.RDFExport = {};
ORYX.I18N.RDFExport.group = "Export";
ORYX.I18N.RDFExport.rdfExport = "Export to RDF";
ORYX.I18N.RDFExport.rdfExportDescription = "Exports current model to the XML serialization defined for the Resource Description Framework (RDF)";
/** New Language Properties: 15.05.2009*/
if(!ORYX.I18N.SyntaxChecker.BPMN) ORYX.I18N.SyntaxChecker.BPMN={};
ORYX.I18N.SyntaxChecker.BPMN_NO_SOURCE = "An edge must have a source.";
ORYX.I18N.SyntaxChecker.BPMN_NO_TARGET = "An edge must have a target.";
ORYX.I18N.SyntaxChecker.BPMN_DIFFERENT_PROCESS = "Source and target node must be contained in the same process.";
ORYX.I18N.SyntaxChecker.BPMN_SAME_PROCESS = "Source and target node must be contained in different pools.";
ORYX.I18N.SyntaxChecker.BPMN_FLOWOBJECT_NOT_CONTAINED_IN_PROCESS = "A flow object must be contained in a process.";
ORYX.I18N.SyntaxChecker.BPMN_ENDEVENT_WITHOUT_INCOMING_CONTROL_FLOW = "An end event must have an incoming sequence flow.";
ORYX.I18N.SyntaxChecker.BPMN_STARTEVENT_WITHOUT_OUTGOING_CONTROL_FLOW = "A start event must have an outgoing sequence flow.";
ORYX.I18N.SyntaxChecker.BPMN_STARTEVENT_WITH_INCOMING_CONTROL_FLOW = "Start events must not have incoming sequence flows.";
ORYX.I18N.SyntaxChecker.BPMN_ATTACHEDINTERMEDIATEEVENT_WITH_INCOMING_CONTROL_FLOW = "Attached intermediate events must not have incoming sequence flows.";
ORYX.I18N.SyntaxChecker.BPMN_ATTACHEDINTERMEDIATEEVENT_WITHOUT_OUTGOING_CONTROL_FLOW = "Attached intermediate events must have exactly one outgoing sequence flow.";
ORYX.I18N.SyntaxChecker.BPMN_ENDEVENT_WITH_OUTGOING_CONTROL_FLOW = "End events must not have outgoing sequence flows.";
ORYX.I18N.SyntaxChecker.BPMN_EVENTBASEDGATEWAY_BADCONTINUATION = "Event-based gateways must not be followed by gateways or subprocesses.";
ORYX.I18N.SyntaxChecker.BPMN_NODE_NOT_ALLOWED = "Node type is not allowed.";
if(!ORYX.I18N.SyntaxChecker.IBPMN) ORYX.I18N.SyntaxChecker.IBPMN={};
ORYX.I18N.SyntaxChecker.IBPMN_NO_ROLE_SET = "Interactions must have a sender and a receiver role set";
ORYX.I18N.SyntaxChecker.IBPMN_NO_INCOMING_SEQFLOW = "This node must have incoming sequence flow.";
ORYX.I18N.SyntaxChecker.IBPMN_NO_OUTGOING_SEQFLOW = "This node must have outgoing sequence flow.";
if(!ORYX.I18N.SyntaxChecker.InteractionNet) ORYX.I18N.SyntaxChecker.InteractionNet={};
ORYX.I18N.SyntaxChecker.InteractionNet_SENDER_NOT_SET = "Sender not set";
ORYX.I18N.SyntaxChecker.InteractionNet_RECEIVER_NOT_SET = "Receiver not set";
ORYX.I18N.SyntaxChecker.InteractionNet_MESSAGETYPE_NOT_SET = "Message type not set";
ORYX.I18N.SyntaxChecker.InteractionNet_ROLE_NOT_SET = "Role not set";
if(!ORYX.I18N.SyntaxChecker.EPC) ORYX.I18N.SyntaxChecker.EPC={};
ORYX.I18N.SyntaxChecker.EPC_NO_SOURCE = "Each edge must have a source.";
ORYX.I18N.SyntaxChecker.EPC_NO_TARGET = "Each edge must have a target.";
ORYX.I18N.SyntaxChecker.EPC_NOT_CONNECTED = "Node must be connected with edges.";
ORYX.I18N.SyntaxChecker.EPC_NOT_CONNECTED_2 = "Node must be connected with more edges.";
ORYX.I18N.SyntaxChecker.EPC_TOO_MANY_EDGES = "Node has too many connected edges.";
ORYX.I18N.SyntaxChecker.EPC_NO_CORRECT_CONNECTOR = "Node is no correct connector.";
ORYX.I18N.SyntaxChecker.EPC_MANY_STARTS = "There must be only one start event.";
ORYX.I18N.SyntaxChecker.EPC_FUNCTION_AFTER_OR = "There must be no functions after a splitting OR/XOR.";
ORYX.I18N.SyntaxChecker.EPC_PI_AFTER_OR = "There must be no process interface after a splitting OR/XOR.";
ORYX.I18N.SyntaxChecker.EPC_FUNCTION_AFTER_FUNCTION = "There must be no function after a function.";
ORYX.I18N.SyntaxChecker.EPC_EVENT_AFTER_EVENT = "There must be no event after an event.";
ORYX.I18N.SyntaxChecker.EPC_PI_AFTER_FUNCTION = "There must be no process interface after a function.";
ORYX.I18N.SyntaxChecker.EPC_FUNCTION_AFTER_PI = "There must be no function after a process interface.";
if(!ORYX.I18N.SyntaxChecker.PetriNet) ORYX.I18N.SyntaxChecker.PetriNet={};
ORYX.I18N.SyntaxChecker.PetriNet_NOT_BIPARTITE = "The graph is not bipartite";
ORYX.I18N.SyntaxChecker.PetriNet_NO_LABEL = "Label not set for a labeled transition";
ORYX.I18N.SyntaxChecker.PetriNet_NO_ID = "There is a node without id";
ORYX.I18N.SyntaxChecker.PetriNet_SAME_SOURCE_AND_TARGET = "Two flow relationships have the same source and target";
ORYX.I18N.SyntaxChecker.PetriNet_NODE_NOT_SET = "A node is not set for a flowrelationship";
/** New Language Properties: 02.06.2009*/
ORYX.I18N.Edge = "Edge";
ORYX.I18N.Node = "Node";
/** New Language Properties: 03.06.2009*/
ORYX.I18N.SyntaxChecker.notice = "Move the mouse over a red cross icon to see the error message.";
ORYX.I18N.Validator.result = "Validation Result";
ORYX.I18N.Validator.noErrors = "No validation errors found.";
ORYX.I18N.Validator.bpmnDeadlockTitle = "Deadlock";
ORYX.I18N.Validator.bpmnDeadlock = "This node results in a deadlock. There are situations where not all incoming branches are activated.";
ORYX.I18N.Validator.bpmnUnsafeTitle = "Lack of synchronization";
ORYX.I18N.Validator.bpmnUnsafe = "This model suffers from lack of synchronization. The marked element is activated from multiple incoming branches.";
ORYX.I18N.Validator.bpmnLeadsToNoEndTitle = "Validation Result";
ORYX.I18N.Validator.bpmnLeadsToNoEnd = "The process will never reach a final state.";
ORYX.I18N.Validator.syntaxErrorsTitle = "Syntax Error";
ORYX.I18N.Validator.syntaxErrorsMsg = "The process cannot be validated because it contains syntax errors.";
ORYX.I18N.Validator.error = "Validation failed";
ORYX.I18N.Validator.errorDesc = 'We are sorry, but the validation of your process failed. It would help us identifying the problem, if you sent us your process model via the "Send Feedback" function.';
ORYX.I18N.Validator.epcIsSound = "<p><b>The EPC is sound, no problems found!</b></p>";
ORYX.I18N.Validator.epcNotSound = "<p><b>The EPC is <i>NOT</i> sound!</b></p>";
/** New Language Properties: 05.06.2009*/
if(!ORYX.I18N.RESIZE) ORYX.I18N.RESIZE = {};
ORYX.I18N.RESIZE.tipGrow = "Increase canvas size: ";
ORYX.I18N.RESIZE.tipShrink = "Decrease canvas size: ";
ORYX.I18N.RESIZE.N = "Top";
ORYX.I18N.RESIZE.W = "Left";
ORYX.I18N.RESIZE.S ="Down";
ORYX.I18N.RESIZE.E ="Right";
/** New Language Properties: 14.08.2009*/
if(!ORYX.I18N.PluginLoad) ORYX.I18N.PluginLoad = {};
ORYX.I18N.PluginLoad.AddPluginButtonName = "Add Plugins";
ORYX.I18N.PluginLoad.AddPluginButtonDesc = "Add additional Plugins dynamically";
ORYX.I18N.PluginLoad.loadErrorTitle="Loading Error";
ORYX.I18N.PluginLoad.loadErrorDesc = "Unable to load Plugin. \n Error:\n";
ORYX.I18N.PluginLoad.WindowTitle ="Add additional Plugins";
ORYX.I18N.PluginLoad.NOTUSEINSTENCILSET = "Not allowed in this Stencilset!";
ORYX.I18N.PluginLoad.REQUIRESTENCILSET = "Require another Stencilset!";
ORYX.I18N.PluginLoad.NOTFOUND = "Pluginname not found!"
ORYX.I18N.PluginLoad.YETACTIVATED = "Plugin is yet activated!"
/** New Language Properties: 15.07.2009*/
if(!ORYX.I18N.Layouting) ORYX.I18N.Layouting ={};
ORYX.I18N.Layouting.doing = "Layouting...";
/** New Language Properties: 18.08.2009*/
ORYX.I18N.SyntaxChecker.MULT_ERRORS = "Multiple Errors";
/** New Language Properties: 08.09.2009*/
if(!ORYX.I18N.PropertyWindow) ORYX.I18N.PropertyWindow = {};
ORYX.I18N.PropertyWindow.oftenUsed = "Often used";
ORYX.I18N.PropertyWindow.moreProps = "More Properties";
/** New Language Properties: 17.09.2009*/
if(!ORYX.I18N.Bpmn2_0Serialization) ORYX.I18N.Bpmn2_0Serialization = {};
ORYX.I18N.Bpmn2_0Serialization.show = "Show BPMN 2.0 DI XML";
ORYX.I18N.Bpmn2_0Serialization.showDesc = "Show BPMN 2.0 DI XML of the current BPMN 2.0 model";
ORYX.I18N.Bpmn2_0Serialization.download = "Download BPMN 2.0 DI XML";
ORYX.I18N.Bpmn2_0Serialization.downloadDesc = "Download BPMN 2.0 DI XML of the current BPMN 2.0 model";
ORYX.I18N.Bpmn2_0Serialization.serialFailed = "An error occurred while generating the BPMN 2.0 DI XML Serialization.";
ORYX.I18N.Bpmn2_0Serialization.group = "BPMN 2.0";
/** New Language Properties 01.10.2009 */
if(!ORYX.I18N.SyntaxChecker.BPMN2) ORYX.I18N.SyntaxChecker.BPMN2 = {};
ORYX.I18N.SyntaxChecker.BPMN2_DATA_INPUT_WITH_INCOMING_DATA_ASSOCIATION = "A Data Input must not have any incoming Data Associations.";
ORYX.I18N.SyntaxChecker.BPMN2_DATA_OUTPUT_WITH_OUTGOING_DATA_ASSOCIATION = "A Data Output must not have any outgoing Data Associations.";
ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_TARGET_WITH_TOO_MANY_INCOMING_SEQUENCE_FLOWS = "Targets of Event-based Gateways may only have one incoming Sequence Flow.";
/** New Language Properties 02.10.2009 */
ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_WITH_TOO_LESS_OUTGOING_SEQUENCE_FLOWS = "An Event-based Gateway must have two or more outgoing Sequence Flows.";
ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_EVENT_TARGET_CONTRADICTION = "If Message Intermediate Events are used in the configuration, then Receive Tasks must not be used and vice versa.";
ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_WRONG_TRIGGER = "Only the following Intermediate Event triggers are valid: Message, Signal, Timer, Conditional and Multiple.";
ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_WRONG_CONDITION_EXPRESSION = "The outgoing Sequence Flows of the Event Gateway must not have a condition expression.";
ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_NOT_INSTANTIATING = "The Gateway does not meet the conditions to instantiate the process. Please use a start event or an instantiating attribute for the gateway.";
/** New Language Properties 05.10.2009 */
ORYX.I18N.SyntaxChecker.BPMN2_GATEWAYDIRECTION_MIXED_FAILURE = "The Gateway must have both multiple incoming and outgoing Sequence Flows.";
ORYX.I18N.SyntaxChecker.BPMN2_GATEWAYDIRECTION_CONVERGING_FAILURE = "The Gateway must have multiple incoming but most NOT have multiple outgoing Sequence Flows.";
ORYX.I18N.SyntaxChecker.BPMN2_GATEWAYDIRECTION_DIVERGING_FAILURE = "The Gateway must NOT have multiple incoming but must have multiple outgoing Sequence Flows.";
ORYX.I18N.SyntaxChecker.BPMN2_GATEWAY_WITH_NO_OUTGOING_SEQUENCE_FLOW = "A Gateway must have a minimum of one outgoing Sequence Flow.";
ORYX.I18N.SyntaxChecker.BPMN2_RECEIVE_TASK_WITH_ATTACHED_EVENT = "Receive Tasks used in Event Gateway configurations must not have any attached Intermediate Events.";
ORYX.I18N.SyntaxChecker.BPMN2_EVENT_SUBPROCESS_BAD_CONNECTION = "An Event Subprocess must not have any incoming or outgoing Sequence Flow.";
/** New Language Properties 13.10.2009 */
ORYX.I18N.SyntaxChecker.BPMN_MESSAGE_FLOW_NOT_CONNECTED = "At least one side of the Message Flow has to be connected.";
/** New Language Properties 19.10.2009 */
ORYX.I18N.Bpmn2_0Serialization['import'] = "Import from BPMN 2.0 DI XML";
ORYX.I18N.Bpmn2_0Serialization.importDesc = "Import a BPMN 2.0 model from a file or XML String";
ORYX.I18N.Bpmn2_0Serialization.selectFile = "Select a (*.bpmn) file or type in BPMN 2.0 DI XML to import it!";
ORYX.I18N.Bpmn2_0Serialization.file = "File:";
ORYX.I18N.Bpmn2_0Serialization.name = "Import from BPMN 2.0 DI XML";
ORYX.I18N.Bpmn2_0Serialization.btnImp = "Import";
ORYX.I18N.Bpmn2_0Serialization.progress = "Importing BPMN 2.0 DI XML ...";
ORYX.I18N.Bpmn2_0Serialization.btnClose = "Close";
ORYX.I18N.Bpmn2_0Serialization.error = "An error occurred while importing BPMN 2.0 DI XML";
/** New Language Properties 24.11.2009 */
ORYX.I18N.SyntaxChecker.BPMN2_TOO_MANY_INITIATING_MESSAGES = "A Choreography Activity may only have one initiating message.";
ORYX.I18N.SyntaxChecker.BPMN_MESSAGE_FLOW_NOT_ALLOWED = "A Message Flow is not allowed here.";
/** New Language Properties 27.11.2009 */
ORYX.I18N.SyntaxChecker.BPMN2_EVENT_BASED_WITH_TOO_LESS_INCOMING_SEQUENCE_FLOWS = "An Event-based Gateway that is not instantiating must have a minimum of one incoming Sequence Flow.";
ORYX.I18N.SyntaxChecker.BPMN2_TOO_FEW_INITIATING_PARTICIPANTS = "A Choreography Activity must have one initiating Participant (white).";
ORYX.I18N.SyntaxChecker.BPMN2_TOO_MANY_INITIATING_PARTICIPANTS = "A Choreography Acitivity must not have more than one initiating Participant (white)."
ORYX.I18N.SyntaxChecker.COMMUNICATION_AT_LEAST_TWO_PARTICIPANTS = "The communication must be connected to at least two participants.";
ORYX.I18N.SyntaxChecker.MESSAGEFLOW_START_MUST_BE_PARTICIPANT = "The message flow's source must be a participant.";
ORYX.I18N.SyntaxChecker.MESSAGEFLOW_END_MUST_BE_PARTICIPANT = "The message flow's target must be a participant.";
ORYX.I18N.SyntaxChecker.CONV_LINK_CANNOT_CONNECT_CONV_NODES = "The conversation link must connect a communication or sub conversation node with a participant.";
/** New Language Properties 30.12.2009 */
ORYX.I18N.Bpmn2_0Serialization.xpdlShow = "Show XPDL 2.2";
ORYX.I18N.Bpmn2_0Serialization.xpdlShowDesc = "Shows the XPDL 2.2 based on BPMN 2.0 XML (by XSLT)";
ORYX.I18N.Bpmn2_0Serialization.xpdlDownload = "Download as XPDL 2.2";
ORYX.I18N.Bpmn2_0Serialization.xpdlDownloadDesc = "Download the XPDL 2.2 based on BPMN 2.0 XML (by XSLT)";
/** New Language Properties 27.4.2010 */
if(!ORYX.I18N.Paint) ORYX.I18N.Paint = {};
ORYX.I18N.Paint.paint = "Paint";
ORYX.I18N.Paint.paintDesc = "Toggle Paint mode";
/** New Language Properties 26.07.2010 */
if(!ORYX.I18N.JSONExport) ORYX.I18N.JSONExport = {};
ORYX.I18N.JSONExport.name = "JSON Export";
ORYX.I18N.JSONExport.desc = "Export model to the ORYX editor";
ORYX.I18N.JSONExport.group = "Export"; | JavaScript |
/*
* Ext JS Library 2.0.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
Ext.DomHelper = function(){
var tempTableEl = null;
var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;
var tableRe = /^table|tbody|tr|td$/i;
var createHtml = function(o){
if(typeof o == 'string'){
return o;
}
var b = "";
if (Ext.isArray(o)) {
for (var i = 0, l = o.length; i < l; i++) {
b += createHtml(o[i]);
}
return b;
}
if(!o.tag){
o.tag = "div";
}
b += "<" + o.tag;
for(var attr in o){
if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue;
if(attr == "style"){
var s = o["style"];
if(typeof s == "function"){
s = s.call();
}
if(typeof s == "string"){
b += ' style="' + s + '"';
}else if(typeof s == "object"){
b += ' style="';
for(var key in s){
if(typeof s[key] != "function"){
b += key + ":" + s[key] + ";";
}
}
b += '"';
}
}else{
if(attr == "cls"){
b += ' class="' + o["cls"] + '"';
}else if(attr == "htmlFor"){
b += ' for="' + o["htmlFor"] + '"';
}else{
b += " " + attr + '="' + o[attr] + '"';
}
}
}
if(emptyTags.test(o.tag)){
b += "/>";
}else{
b += ">";
var cn = o.children || o.cn;
if(cn){
b += createHtml(cn);
} else if(o.html){
b += o.html;
}
b += "</" + o.tag + ">";
}
return b;
};
var createDom = function(o, parentNode){
var el;
if (Ext.isArray(o)) {
el = document.createDocumentFragment();
for(var i = 0, l = o.length; i < l; i++) {
createDom(o[i], el);
}
} else if (typeof o == "string)") {
el = document.createTextNode(o);
} else {
el = document.createElement(o.tag||'div');
var useSet = !!el.setAttribute;
for(var attr in o){
if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue;
if(attr=="cls"){
el.className = o["cls"];
}else{
if(useSet) el.setAttribute(attr, o[attr]);
else el[attr] = o[attr];
}
}
Ext.DomHelper.applyStyles(el, o.style);
var cn = o.children || o.cn;
if(cn){
createDom(cn, el);
} else if(o.html){
el.innerHTML = o.html;
}
}
if(parentNode){
parentNode.appendChild(el);
}
return el;
};
var ieTable = function(depth, s, h, e){
tempTableEl.innerHTML = [s, h, e].join('');
var i = -1, el = tempTableEl;
while(++i < depth){
el = el.firstChild;
}
return el;
};
var ts = '<table>',
te = '</table>',
tbs = ts+'<tbody>',
tbe = '</tbody>'+te,
trs = tbs + '<tr>',
tre = '</tr>'+tbe;
var insertIntoTable = function(tag, where, el, html){
if(!tempTableEl){
tempTableEl = document.createElement('div');
}
var node;
var before = null;
if(tag == 'td'){
if(where == 'afterbegin' || where == 'beforeend'){
return;
}
if(where == 'beforebegin'){
before = el;
el = el.parentNode;
} else{
before = el.nextSibling;
el = el.parentNode;
}
node = ieTable(4, trs, html, tre);
}
else if(tag == 'tr'){
if(where == 'beforebegin'){
before = el;
el = el.parentNode;
node = ieTable(3, tbs, html, tbe);
} else if(where == 'afterend'){
before = el.nextSibling;
el = el.parentNode;
node = ieTable(3, tbs, html, tbe);
} else{
if(where == 'afterbegin'){
before = el.firstChild;
}
node = ieTable(4, trs, html, tre);
}
} else if(tag == 'tbody'){
if(where == 'beforebegin'){
before = el;
el = el.parentNode;
node = ieTable(2, ts, html, te);
} else if(where == 'afterend'){
before = el.nextSibling;
el = el.parentNode;
node = ieTable(2, ts, html, te);
} else{
if(where == 'afterbegin'){
before = el.firstChild;
}
node = ieTable(3, tbs, html, tbe);
}
} else{
if(where == 'beforebegin' || where == 'afterend'){
return;
}
if(where == 'afterbegin'){
before = el.firstChild;
}
node = ieTable(2, ts, html, te);
}
el.insertBefore(node, before);
return node;
};
return {
useDom : false,
markup : function(o){
return createHtml(o);
},
applyStyles : function(el, styles){
if(styles){
el = Ext.fly(el);
if(typeof styles == "string"){
var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;
var matches;
while ((matches = re.exec(styles)) != null){
el.setStyle(matches[1], matches[2]);
}
}else if (typeof styles == "object"){
for (var style in styles){
el.setStyle(style, styles[style]);
}
}else if (typeof styles == "function"){
Ext.DomHelper.applyStyles(el, styles.call());
}
}
},
insertHtml : function(where, el, html){
where = where.toLowerCase();
if(el.insertAdjacentHTML){
if(tableRe.test(el.tagName)){
var rs;
if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){
return rs;
}
}
switch(where){
case "beforebegin":
el.insertAdjacentHTML('BeforeBegin', html);
return el.previousSibling;
case "afterbegin":
el.insertAdjacentHTML('AfterBegin', html);
return el.firstChild;
case "beforeend":
el.insertAdjacentHTML('BeforeEnd', html);
return el.lastChild;
case "afterend":
el.insertAdjacentHTML('AfterEnd', html);
return el.nextSibling;
}
throw 'Illegal insertion point -> "' + where + '"';
}
var range = el.ownerDocument.createRange();
var frag;
switch(where){
case "beforebegin":
range.setStartBefore(el);
frag = range.createContextualFragment(html);
el.parentNode.insertBefore(frag, el);
return el.previousSibling;
case "afterbegin":
if(el.firstChild){
range.setStartBefore(el.firstChild);
frag = range.createContextualFragment(html);
el.insertBefore(frag, el.firstChild);
return el.firstChild;
}else{
el.innerHTML = html;
return el.firstChild;
}
case "beforeend":
if(el.lastChild){
range.setStartAfter(el.lastChild);
frag = range.createContextualFragment(html);
el.appendChild(frag);
return el.lastChild;
}else{
el.innerHTML = html;
return el.lastChild;
}
case "afterend":
range.setStartAfter(el);
frag = range.createContextualFragment(html);
el.parentNode.insertBefore(frag, el.nextSibling);
return el.nextSibling;
}
throw 'Illegal insertion point -> "' + where + '"';
},
insertBefore : function(el, o, returnElement){
return this.doInsert(el, o, returnElement, "beforeBegin");
},
insertAfter : function(el, o, returnElement){
return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling");
},
insertFirst : function(el, o, returnElement){
return this.doInsert(el, o, returnElement, "afterBegin", "firstChild");
},
doInsert : function(el, o, returnElement, pos, sibling){
el = Ext.getDom(el);
var newNode;
if(this.useDom){
newNode = createDom(o, null);
(sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el);
}else{
var html = createHtml(o);
newNode = this.insertHtml(pos, el, html);
}
return returnElement ? Ext.get(newNode, true) : newNode;
},
append : function(el, o, returnElement){
el = Ext.getDom(el);
var newNode;
if(this.useDom){
newNode = createDom(o, null);
el.appendChild(newNode);
}else{
var html = createHtml(o);
newNode = this.insertHtml("beforeEnd", el, html);
}
return returnElement ? Ext.get(newNode, true) : newNode;
},
overwrite : function(el, o, returnElement){
el = Ext.getDom(el);
el.innerHTML = createHtml(o);
return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
},
createTemplate : function(o){
var html = createHtml(o);
return new Ext.Template(html);
}
};
}();
Ext.Template = function(html){
var a = arguments;
if(Ext.isArray(html)){
html = html.join("");
}else if(a.length > 1){
var buf = [];
for(var i = 0, len = a.length; i < len; i++){
if(typeof a[i] == 'object'){
Ext.apply(this, a[i]);
}else{
buf[buf.length] = a[i];
}
}
html = buf.join('');
}
this.html = html;
if(this.compiled){
this.compile();
}
};
Ext.Template.prototype = {
applyTemplate : function(values){
if(this.compiled){
return this.compiled(values);
}
var useF = this.disableFormats !== true;
var fm = Ext.util.Format, tpl = this;
var fn = function(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){
var re = /^\s*['"](.*)["']\s*$/;
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 this.html.replace(this.re, fn);
},
set : function(html, compile){
this.html = html;
this.compiled = null;
if(compile){
this.compile();
}
return this;
},
disableFormats : false,
re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
compile : function(){
var fm = Ext.util.Format;
var useF = this.disableFormats !== true;
var sep = Ext.isGecko ? "+" : ",";
var fn = function(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+"'";
};
var body;
if(Ext.isGecko){
body = "this.compiled = function(values){ return '" +
this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
"';};";
}else{
body = ["this.compiled = function(values){ return ['"];
body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
body.push("'].join('');};");
body = body.join('');
}
eval(body);
return this;
},
call : function(fnName, value, allValues){
return this[fnName](value, allValues);
},
insertFirst: function(el, values, returnElement){
return this.doInsert('afterBegin', el, values, returnElement);
},
insertBefore: function(el, values, returnElement){
return this.doInsert('beforeBegin', el, values, returnElement);
},
insertAfter : function(el, values, returnElement){
return this.doInsert('afterEnd', el, values, returnElement);
},
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;
},
overwrite : function(el, values, returnElement){
el = Ext.getDom(el);
el.innerHTML = this.applyTemplate(values);
return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
}
};
Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
Ext.DomHelper.Template = Ext.Template;
Ext.Template.from = function(el, config){
el = Ext.getDom(el);
return new Ext.Template(el.value || el.innerHTML, config || '');
};
Ext.DomQuery = function(){
var cache = {}, simpleCache = {}, valueCache = {};
var nonSpace = /\S/;
var trimRe = /^\s+|\s+$/g;
var tplRe = /\{(\d+)\}/g;
var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;
var tagTokenRe = /^(#)?([\w-\*]+)/;
var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;
function child(p, index){
var i = 0;
var n = p.firstChild;
while(n){
if(n.nodeType == 1){
if(++i == index){
return n;
}
}
n = n.nextSibling;
}
return null;
};
function next(n){
while((n = n.nextSibling) && n.nodeType != 1);
return n;
};
function prev(n){
while((n = n.previousSibling) && n.nodeType != 1);
return n;
};
function children(d){
var n = d.firstChild, ni = -1;
while(n){
var nx = n.nextSibling;
if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
d.removeChild(n);
}else{
n.nodeIndex = ++ni;
}
n = nx;
}
return this;
};
function byClassName(c, a, v){
if(!v){
return c;
}
var r = [], ri = -1, cn;
for(var i = 0, ci; ci = c[i]; i++){
if((' '+ci.className+' ').indexOf(v) != -1){
r[++ri] = ci;
}
}
return r;
};
function attrValue(n, attr){
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];
};
function getNodes(ns, mode, tagName){
var result = [], ri = -1, cs;
if(!ns){
return result;
}
tagName = tagName || "*";
if(typeof ns.getElementsByTagName != "undefined"){
ns = [ns];
}
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;
}
}
}else if(mode == "/" || mode == ">"){
var utag = tagName.toUpperCase();
for(var i = 0, ni, cn; ni = ns[i]; i++){
cn = ni.children || ni.childNodes;
for(var j = 0, cj; cj = cn[j]; j++){
if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
result[++ri] = cj;
}
}
}
}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;
}
}
}else if(mode == "~"){
for(var i = 0, n; n = ns[i]; i++){
while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));
if(n){
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 r = [], ri = -1;
tagName = tagName.toLowerCase();
for(var i = 0, ci; ci = cs[i]; i++){
if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
r[++ri] = ci;
}
}
return r;
};
function byId(cs, attr, id){
if(cs.tagName || cs == document){
cs = [cs];
}
if(!id){
return cs;
}
var r = [], ri = -1;
for(var i = 0,ci; ci = cs[i]; i++){
if(ci && ci.id == id){
r[++ri] = ci;
return r;
}
}
return r;
};
function byAttribute(cs, attr, value, op, custom){
var r = [], ri = -1, st = custom=="{";
var f = Ext.DomQuery.operators[op];
for(var i = 0, ci; ci = cs[i]; i++){
var a;
if(st){
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"){
a = ci.getAttribute("href", 2);
}else{
a = ci.getAttribute(attr);
}
if((f && f(a, value)) || (!f && a)){
r[++ri] = ci;
}
}
return r;
};
function byPseudo(cs, name, value){
return Ext.DomQuery.pseudos[name](cs, value);
};
var isIE = window.ActiveXObject ? true : false;
eval("var batch = 30803;");
var key = 30803;
function nodupIEXml(cs){
var d = ++key;
cs[0].setAttribute("_nodup", d);
var 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;
for(var i = 0, len = c1.length; i < len; i++){
c1[i].setAttribute("_qdiff", d);
}
var r = [];
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;
if(!len1){
return c2;
}
if(isIE && c1[0].selectSingleNode){
return quickDiffIEXml(c1, c2);
}
var d = ++key;
for(var i = 0; i < len1; i++){
c1[i]._qdiff = d;
}
var r = [];
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, null, id);
}
return {
getStyle : function(el, name){
return Ext.fly(el).getStyle(name);
},
compile : function(path, type){
type = type || "select";
var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];
var q = path, mode, lq;
var tk = Ext.DomQuery.matchers;
var tklen = tk.length;
var mm;
var lmode = q.match(modeRe);
if(lmode && lmode[1]){
fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
q = q.replace(lmode[1], "");
}
while(path.substr(0, 1)=="/"){
path = path.substr(1);
}
while(q && lq != q){
lq = q;
var tm = q.match(tagTokenRe);
if(type == "select"){
if(tm){
if(tm[1] == "#"){
fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
}else{
fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
}
q = q.replace(tm[0], "");
}else if(q.substr(0, 1) != '@'){
fn[fn.length] = 'n = getNodes(n, mode, "*");';
}
}else{
if(tm){
if(tm[1] == "#"){
fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';
}else{
fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';
}
q = q.replace(tm[0], "");
}
}
while(!(mm = q.match(modeRe))){
var matched = false;
for(var j = 0; j < tklen; j++){
var t = tk[j];
var m = q.match(t.re);
if(m){
fn[fn.length] = t.select.replace(tplRe, function(x, i){
return m[i];
});
q = q.replace(m[0], "");
matched = true;
break;
}
}
if(!matched){
throw 'Error parsing selector, parsing failed at "' + q + '"';
}
}
if(mm[1]){
fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";';
q = q.replace(mm[1], "");
}
}
fn[fn.length] = "return nodup(n);\n}";
eval(fn.join(""));
return f;
},
select : function(path, root, type){
if(!root || root == document){
root = document;
}
if(typeof root == "string"){
root = document.getElementById(root);
}
var paths = path.split(",");
var results = [];
for(var i = 0, len = paths.length; i < len; i++){
var p = paths[i].replace(trimRe, "");
if(!cache[p]){
cache[p] = Ext.DomQuery.compile(p);
if(!cache[p]){
throw p + " is not a valid selector";
}
}
var result = cache[p](root);
if(result && result != document){
results = results.concat(result);
}
}
if(paths.length > 1){
return nodup(results);
}
return results;
},
selectNode : function(path, root){
return Ext.DomQuery.select(path, root)[0];
},
selectValue : function(path, root, defaultValue){
path = path.replace(trimRe, "");
if(!valueCache[path]){
valueCache[path] = Ext.DomQuery.compile(path, "select");
}
var n = valueCache[path](root);
n = n[0] ? n[0] : n;
var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
return ((v === null||v === undefined||v==='') ? defaultValue : v);
},
selectNumber : function(path, root, defaultValue){
var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
return parseFloat(v);
},
is : function(el, ss){
if(typeof el == "string"){
el = document.getElementById(el);
}
var isArray = Ext.isArray(el);
var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
return isArray ? (result.length == el.length) : (result.length > 0);
},
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;
},
matchers : [{
re: /^\.([\w-]+)/,
select: 'n = byClassName(n, null, " {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, null, "{1}");'
},{
re: /^@([\w-]+)/,
select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
}
],
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;
}
},
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;
var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);
var 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('|');
var 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;
var 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;
var 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;
var 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;
}
}
};
}();
Ext.query = Ext.DomQuery.select;
Ext.util.Observable = function(){
if(this.listeners){
this.on(this.listeners);
delete this.listeners;
}
};
Ext.util.Observable.prototype = {
fireEvent : function(){
if(this.eventsSuspended !== true){
var ce = this.events[arguments[0].toLowerCase()];
if(typeof ce == "object"){
return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1));
}
}
return true;
},
filterOptRe : /^(?:scope|delay|buffer|single)$/,
addListener : function(eventName, fn, scope, o){
if(typeof eventName == "object"){
o = eventName;
for(var e in o){
if(this.filterOptRe.test(e)){
continue;
}
if(typeof o[e] == "function"){
this.addListener(e, o[e], o.scope, o);
}else{
this.addListener(e, o[e].fn, o[e].scope, o[e]);
}
}
return;
}
o = (!o || typeof o == "boolean") ? {} : o;
eventName = eventName.toLowerCase();
var ce = this.events[eventName] || true;
if(typeof ce == "boolean"){
ce = new Ext.util.Event(this, eventName);
this.events[eventName] = ce;
}
ce.addListener(fn, scope, o);
},
removeListener : function(eventName, fn, scope){
var ce = this.events[eventName.toLowerCase()];
if(typeof ce == "object"){
ce.removeListener(fn, scope);
}
},
purgeListeners : function(){
for(var evt in this.events){
if(typeof this.events[evt] == "object"){
this.events[evt].clearListeners();
}
}
},
relayEvents : function(o, events){
var createHandler = function(ename){
return function(){
return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));
};
};
for(var i = 0, len = events.length; i < len; i++){
var ename = events[i];
if(!this.events[ename]){ this.events[ename] = true; };
o.on(ename, createHandler(ename), this);
}
},
addEvents : function(o){
if(!this.events){
this.events = {};
}
if(typeof o == 'string'){
for(var i = 0, a = arguments, v; v = a[i]; i++){
if(!this.events[a[i]]){
o[a[i]] = true;
}
}
}else{
Ext.applyIf(this.events, o);
}
},
hasListener : function(eventName){
var e = this.events[eventName];
return typeof e == "object" && e.listeners.length > 0;
},
suspendEvents : function(){
this.eventsSuspended = true;
},
resumeEvents : function(){
this.eventsSuspended = false;
},
getMethodEvent : function(method){
if(!this.methodEvents){
this.methodEvents = {};
}
var e = this.methodEvents[method];
if(!e){
e = {};
this.methodEvents[method] = e;
e.originalFn = this[method];
e.methodName = method;
e.before = [];
e.after = [];
var returnValue, v, cancel;
var obj = this;
var makeCall = function(fn, scope, args){
if((v = fn.apply(scope || obj, args)) !== undefined){
if(typeof v === 'object'){
if(v.returnValue !== undefined){
returnValue = v.returnValue;
}else{
returnValue = v;
}
if(v.cancel === true){
cancel = true;
}
}else if(v === false){
cancel = true;
}else {
returnValue = v;
}
}
}
this[method] = function(){
returnValue = v = undefined; cancel = false;
var args = Array.prototype.slice.call(arguments, 0);
for(var i = 0, len = e.before.length; i < len; i++){
makeCall(e.before[i].fn, e.before[i].scope, args);
if(cancel){
return returnValue;
}
}
if((v = e.originalFn.apply(obj, args)) !== undefined){
returnValue = v;
}
for(var i = 0, len = e.after.length; i < len; i++){
makeCall(e.after[i].fn, e.after[i].scope, args);
if(cancel){
return returnValue;
}
}
return returnValue;
};
}
return e;
},
beforeMethod : function(method, fn, scope){
var e = this.getMethodEvent(method);
e.before.push({fn: fn, scope: scope});
},
afterMethod : function(method, fn, scope){
var e = this.getMethodEvent(method);
e.after.push({fn: fn, scope: scope});
},
removeMethodListener : function(method, fn, scope){
var e = this.getMethodEvent(method);
for(var i = 0, len = e.before.length; i < len; i++){
if(e.before[i].fn == fn && e.before[i].scope == scope){
e.before.splice(i, 1);
return;
}
}
for(var i = 0, len = e.after.length; i < len; i++){
if(e.after[i].fn == fn && e.after[i].scope == scope){
e.after.splice(i, 1);
return;
}
}
}
};
Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;
Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;
Ext.util.Observable.capture = function(o, fn, scope){
o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
};
Ext.util.Observable.releaseCapture = function(o){
o.fireEvent = Ext.util.Observable.prototype.fireEvent;
};
(function(){
var createBuffered = function(h, o, scope){
var task = new Ext.util.DelayedTask();
return function(){
task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
};
};
var createSingle = function(h, e, fn, scope){
return function(){
e.removeListener(fn, scope);
return h.apply(scope, arguments);
};
};
var createDelayed = function(h, o, scope){
return function(){
var args = Array.prototype.slice.call(arguments, 0);
setTimeout(function(){
h.apply(scope, args);
}, o.delay || 10);
};
};
Ext.util.Event = function(obj, name){
this.name = name;
this.obj = obj;
this.listeners = [];
};
Ext.util.Event.prototype = {
addListener : function(fn, scope, options){
scope = scope || this.obj;
if(!this.isListening(fn, scope)){
var l = this.createListener(fn, scope, options);
if(!this.firing){
this.listeners.push(l);
}else{ this.listeners = this.listeners.slice(0);
this.listeners.push(l);
}
}
},
createListener : function(fn, scope, o){
o = o || {};
scope = scope || this.obj;
var l = {fn: fn, scope: scope, options: o};
var h = fn;
if(o.delay){
h = createDelayed(h, o, scope);
}
if(o.single){
h = createSingle(h, this, fn, scope);
}
if(o.buffer){
h = createBuffered(h, o, scope);
}
l.fireFn = h;
return l;
},
findListener : function(fn, scope){
scope = scope || this.obj;
var ls = this.listeners;
for(var i = 0, len = ls.length; i < len; i++){
var l = ls[i];
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;
if((index = this.findListener(fn, scope)) != -1){
if(!this.firing){
this.listeners.splice(index, 1);
}else{
this.listeners = this.listeners.slice(0);
this.listeners.splice(index, 1);
}
return true;
}
return false;
},
clearListeners : function(){
this.listeners = [];
},
fire : function(){
var ls = this.listeners, scope, len = ls.length;
if(len > 0){
this.firing = true;
var args = Array.prototype.slice.call(arguments, 0);
for(var i = 0; i < len; i++){
var l = ls[i];
if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){
this.firing = false;
return false;
}
}
this.firing = false;
}
return true;
}
};
})();
Ext.EventManager = function(){
var docReadyEvent, docReadyProcId, docReadyState = false;
var resizeEvent, resizeTask, textEvent, textSize;
var E = Ext.lib.Event;
var D = Ext.lib.Dom;
var fireDocReady = function(){
if(!docReadyState){
docReadyState = true;
Ext.isReady = true;
if(docReadyProcId){
clearInterval(docReadyProcId);
}
if(Ext.isGecko || Ext.isOpera) {
document.removeEventListener("DOMContentLoaded", fireDocReady, false);
}
if(Ext.isIE){
var defer = document.getElementById("ie-deferred-loader");
if(defer){
defer.onreadystatechange = null;
defer.parentNode.removeChild(defer);
}
}
if(docReadyEvent){
docReadyEvent.fire();
docReadyEvent.clearListeners();
}
}
};
var initDocReady = function(){
docReadyEvent = new Ext.util.Event();
if(Ext.isGecko || Ext.isOpera) {
document.addEventListener("DOMContentLoaded", fireDocReady, false);
}else if(Ext.isIE){
document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");
var defer = document.getElementById("ie-deferred-loader");
defer.onreadystatechange = function(){
if(this.readyState == "complete"){
fireDocReady();
}
};
}else if(Ext.isSafari){
docReadyProcId = setInterval(function(){
var rs = document.readyState;
if(rs == "complete") {
fireDocReady();
}
}, 10);
}
E.on(window, "load", fireDocReady);
};
var createBuffered = function(h, o){
var task = new Ext.util.DelayedTask(h);
return function(e){
e = new Ext.EventObjectImpl(e);
task.delay(o.buffer, h, null, [e]);
};
};
var createSingle = function(h, el, ename, fn){
return function(e){
Ext.EventManager.removeListener(el, ename, fn);
h(e);
};
};
var createDelayed = function(h, o){
return function(e){
e = new Ext.EventObjectImpl(e);
setTimeout(function(){
h(e);
}, o.delay || 10);
};
};
var listen = function(element, ename, opt, fn, scope){
var o = (!opt || typeof opt == "boolean") ? {} : opt;
fn = fn || o.fn; scope = scope || o.scope;
var el = Ext.getDom(element);
if(!el){
throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
}
var h = function(e){
e = Ext.EventObject.setEvent(e);
var t;
if(o.delegate){
t = e.getTarget(o.delegate, el);
if(!t){
return;
}
}else{
t = e.target;
}
if(o.stopEvent === true){
e.stopEvent();
}
if(o.preventDefault === true){
e.preventDefault();
}
if(o.stopPropagation === true){
e.stopPropagation();
}
if(o.normalized === false){
e = e.browserEvent;
}
fn.call(scope || el, e, t, o);
};
if(o.delay){
h = createDelayed(h, o);
}
if(o.single){
h = createSingle(h, el, ename, fn);
}
if(o.buffer){
h = createBuffered(h, o);
}
fn._handlers = fn._handlers || [];
fn._handlers.push([Ext.id(el), ename, h]);
E.on(el, ename, h);
if(ename == "mousewheel" && el.addEventListener){
el.addEventListener("DOMMouseScroll", h, false);
E.on(window, 'unload', function(){
el.removeEventListener("DOMMouseScroll", h, false);
});
}
if(ename == "mousedown" && el == document){
Ext.EventManager.stoppedMouseDownEvent.addListener(h);
}
return h;
};
var stopListening = function(el, ename, fn){
var id = Ext.id(el), hds = fn._handlers, hd = fn;
if(hds){
for(var i = 0, len = hds.length; i < len; i++){
var h = hds[i];
if(h[0] == id && h[1] == ename){
hd = h[2];
hds.splice(i, 1);
break;
}
}
}
E.un(el, ename, hd);
el = Ext.getDom(el);
if(ename == "mousewheel" && el.addEventListener){
el.removeEventListener("DOMMouseScroll", hd, false);
}
if(ename == "mousedown" && el == document){
Ext.EventManager.stoppedMouseDownEvent.removeListener(hd);
}
};
var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
var pub = {
addListener : function(element, eventName, fn, scope, options){
if(typeof eventName == "object"){
var o = eventName;
for(var e in o){
if(propRe.test(e)){
continue;
}
if(typeof o[e] == "function"){
listen(element, e, o, o[e], o.scope);
}else{
listen(element, e, o[e]);
}
}
return;
}
return listen(element, eventName, options, fn, scope);
},
removeListener : function(element, eventName, fn){
return stopListening(element, eventName, fn);
},
onDocumentReady : function(fn, scope, options){
if(docReadyState){
docReadyEvent.addListener(fn, scope, options);
docReadyEvent.fire();
docReadyEvent.clearListeners();
return;
}
if(!docReadyEvent){
initDocReady();
}
docReadyEvent.addListener(fn, scope, options);
},
onWindowResize : function(fn, scope, options){
if(!resizeEvent){
resizeEvent = new Ext.util.Event();
resizeTask = new Ext.util.DelayedTask(function(){
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
});
E.on(window, "resize", this.fireWindowResize, this);
}
resizeEvent.addListener(fn, scope, options);
},
fireWindowResize : function(){
if(resizeEvent){
if((Ext.isIE||Ext.isAir) && resizeTask){
resizeTask.delay(50);
}else{
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
}
}
},
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);
},
removeResizeListener : function(fn, scope){
if(resizeEvent){
resizeEvent.removeListener(fn, scope);
}
},
fireResize : function(){
if(resizeEvent){
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
}
},
ieDeferSrc : false,
textResizeInterval : 50
};
pub.on = pub.addListener;
pub.un = pub.removeListener;
pub.stoppedMouseDownEvent = new Ext.util.Event();
return pub;
}();
Ext.onReady = Ext.EventManager.onDocumentReady;
Ext.onReady(function(){
var bd = Ext.getBody();
if(!bd){ return; }
var cls = [
Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : 'ext-ie7')
: Ext.isGecko ? "ext-gecko"
: Ext.isOpera ? "ext-opera"
: Ext.isSafari ? "ext-safari" : ""];
if(Ext.isMac){
cls.push("ext-mac");
}
if(Ext.isLinux){
cls.push("ext-linux");
}
if(Ext.isBorderBox){
cls.push('ext-border-box');
}
if(Ext.isStrict){
var p = bd.dom.parentNode;
if(p){
p.className += ' ext-strict';
}
}
bd.addClass(cls.join(' '));
});
Ext.EventObject = function(){
var E = Ext.lib.Event;
var safariKeys = {
63234 : 37,
63235 : 39,
63232 : 38,
63233 : 40,
63276 : 33,
63277 : 34,
63272 : 46,
63273 : 36,
63275 : 35
};
var btnMap = Ext.isIE ? {1:0,4:1,2:2} :
(Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
Ext.EventObjectImpl = function(e){
if(e){
this.setEvent(e.browserEvent || e);
}
};
Ext.EventObjectImpl.prototype = {
browserEvent : null,
button : -1,
shiftKey : false,
ctrlKey : false,
altKey : false,
BACKSPACE : 8,
TAB : 9,
RETURN : 13,
ENTER : 13,
SHIFT : 16,
CONTROL : 17,
ESC : 27,
SPACE : 32,
PAGEUP : 33,
PAGEDOWN : 34,
END : 35,
HOME : 36,
LEFT : 37,
UP : 38,
RIGHT : 39,
DOWN : 40,
DELETE : 46,
F5 : 116,
setEvent : function(e){
if(e == this || (e && e.browserEvent)){
return e;
}
this.browserEvent = e;
if(e){
this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);
if(e.type == 'click' && this.button == -1){
this.button = 0;
}
this.type = e.type;
this.shiftKey = e.shiftKey;
this.ctrlKey = e.ctrlKey || e.metaKey;
this.altKey = e.altKey;
this.keyCode = e.keyCode;
this.charCode = e.charCode;
this.target = E.getTarget(e);
this.xy = E.getXY(e);
}else{
this.button = -1;
this.shiftKey = false;
this.ctrlKey = false;
this.altKey = false;
this.keyCode = 0;
this.charCode =0;
this.target = null;
this.xy = [0, 0];
}
return this;
},
stopEvent : function(){
if(this.browserEvent){
if(this.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(this);
}
E.stopEvent(this.browserEvent);
}
},
preventDefault : function(){
if(this.browserEvent){
E.preventDefault(this.browserEvent);
}
},
isNavKeyPress : function(){
var k = this.keyCode;
k = Ext.isSafari ? (safariKeys[k] || k) : k;
return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;
},
isSpecialKey : function(){
var k = this.keyCode;
return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13 || k == 40 || k == 27 ||
(k == 16) || (k == 17) ||
(k >= 18 && k <= 20) ||
(k >= 33 && k <= 35) ||
(k >= 36 && k <= 39) ||
(k >= 44 && k <= 45);
},
stopPropagation : function(){
if(this.browserEvent){
if(this.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(this);
}
E.stopPropagation(this.browserEvent);
}
},
getCharCode : function(){
return this.charCode || this.keyCode;
},
getKey : function(){
var k = this.keyCode || this.charCode;
return Ext.isSafari ? (safariKeys[k] || k) : k;
},
getPageX : function(){
return this.xy[0];
},
getPageY : function(){
return this.xy[1];
},
getTime : function(){
if(this.browserEvent){
return E.getTime(this.browserEvent);
}
return null;
},
getXY : function(){
return this.xy;
},
getTarget : function(selector, maxDepth, returnEl){
var t = Ext.get(this.target);
return selector ? t.findParent(selector, maxDepth, returnEl) : (returnEl ? t : this.target);
},
getRelatedTarget : function(){
if(this.browserEvent){
return E.getRelatedTarget(this.browserEvent);
}
return null;
},
getWheelDelta : function(){
var e = this.browserEvent;
var delta = 0;
if(e.wheelDelta){
delta = e.wheelDelta/120;
}else if(e.detail){
delta = -e.detail/3;
}
return delta;
},
hasModifier : function(){
return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;
},
within : function(el, related){
var t = this[related ? "getRelatedTarget" : "getTarget"]();
return t && Ext.fly(el).contains(t);
},
getPoint : function(){
return new Ext.lib.Point(this.xy[0], this.xy[1]);
}
};
return new Ext.EventObjectImpl();
}();
(function(){
var D = Ext.lib.Dom;
var E = Ext.lib.Event;
var A = Ext.lib.Anim;
var propCache = {};
var camelRe = /(-[a-z])/gi;
var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
var view = document.defaultView;
Ext.Element = function(element, forceNew){
var dom = typeof element == "string" ?
document.getElementById(element) : element;
if(!dom){ return null;
}
var id = dom.id;
if(forceNew !== true && id && Ext.Element.cache[id]){ return Ext.Element.cache[id];
}
this.dom = dom;
this.id = id || Ext.id(dom);
};
var El = Ext.Element;
El.prototype = {
originalDisplay : "",
visibilityMode : 1,
defaultUnit : "px",
setVisibilityMode : function(visMode){
this.visibilityMode = visMode;
return this;
},
enableDisplayMode : function(display){
this.setVisibilityMode(El.DISPLAY);
if(typeof display != "undefined") this.originalDisplay = display;
return this;
},
findParent : function(simpleSelector, maxDepth, returnEl){
var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;
maxDepth = maxDepth || 50;
if(typeof maxDepth != "number"){
stopEl = Ext.getDom(maxDepth);
maxDepth = 10;
}
while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
if(dq.is(p, simpleSelector)){
return returnEl ? Ext.get(p) : p;
}
depth++;
p = p.parentNode;
}
return null;
},
findParentNode : function(simpleSelector, maxDepth, returnEl){
var p = Ext.fly(this.dom.parentNode, '_internal');
return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
},
up : function(simpleSelector, maxDepth){
return this.findParentNode(simpleSelector, maxDepth, true);
},
is : function(simpleSelector){
return Ext.DomQuery.is(this.dom, simpleSelector);
},
animate : function(args, duration, onComplete, easing, animType){
this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
return this;
},
anim : function(args, opt, animType, defaultDur, defaultEase, cb){
animType = animType || 'run';
opt = opt || {};
var anim = Ext.lib.Anim[animType](
this.dom, args,
(opt.duration || defaultDur) || .35,
(opt.easing || defaultEase) || 'easeOut',
function(){
Ext.callback(cb, this);
Ext.callback(opt.callback, opt.scope || this, [this, opt]);
},
this
);
opt.anim = anim;
return anim;
},
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]});
},
clean : function(forceReclean){
if(this.isCleaned && forceReclean !== true){
return this;
}
var ns = /\S/;
var d = this.dom, n = d.firstChild, ni = -1;
while(n){
var nx = n.nextSibling;
if(n.nodeType == 3 && !ns.test(n.nodeValue)){
d.removeChild(n);
}else{
n.nodeIndex = ++ni;
}
n = nx;
}
this.isCleaned = true;
return this;
},
scrollIntoView : function(container, hscroll){
var c = Ext.getDom(container) || Ext.getBody().dom;
var el = this.dom;
var o = this.getOffsetsTo(c),
l = o[0] + c.scrollLeft,
t = o[1] + c.scrollTop,
b = t+el.offsetHeight,
r = l+el.offsetWidth;
var ch = c.clientHeight;
var ct = parseInt(c.scrollTop, 10);
var cl = parseInt(c.scrollLeft, 10);
var cb = ct + ch;
var cr = cl + c.clientWidth;
if(el.offsetHeight > ch || t < ct){
c.scrollTop = t;
}else if(b > cb){
c.scrollTop = b-ch;
}
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;
},
scrollChildIntoView : function(child, hscroll){
Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
},
autoHeight : function(animate, duration, onComplete, easing){
var oldHeight = this.getHeight();
this.clip();
this.setHeight(1); setTimeout(function(){
var height = parseInt(this.dom.scrollHeight, 10); if(!animate){
this.setHeight(height);
this.unclip();
if(typeof onComplete == "function"){
onComplete();
}
}else{
this.setHeight(oldHeight); this.setHeight(height, animate, duration, function(){
this.unclip();
if(typeof onComplete == "function") onComplete();
}.createDelegate(this), easing);
}
}.createDelegate(this), 0);
return this;
},
contains : function(el){
if(!el){return false;}
return D.isAncestor(this.dom, el.dom ? el.dom : el);
},
isVisible : function(deep) {
var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");
if(deep !== true || !vis){
return vis;
}
var p = this.dom.parentNode;
while(p && p.tagName.toLowerCase() != "body"){
if(!Ext.fly(p, '_isVisible').isVisible()){
return false;
}
p = p.parentNode;
}
return true;
},
select : function(selector, unique){
return El.select(selector, unique, this.dom);
},
query : function(selector, unique){
return Ext.DomQuery.select(selector, this.dom);
},
child : function(selector, returnDom){
var n = Ext.DomQuery.selectNode(selector, this.dom);
return returnDom ? n : Ext.get(n);
},
down : function(selector, returnDom){
var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);
return returnDom ? n : Ext.get(n);
},
initDD : function(group, config, overrides){
var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
initDDProxy : function(group, config, overrides){
var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
initDDTarget : function(group, config, overrides){
var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
setVisible : function(visible, animate){
if(!animate || !A){
if(this.visibilityMode == El.DISPLAY){
this.setDisplayed(visible);
}else{
this.fixDisplay();
this.dom.style.visibility = visible ? "visible" : "hidden";
}
}else{
var dom = this.dom;
var visMode = this.visibilityMode;
if(visible){
this.setOpacity(.01);
this.setVisible(true);
}
this.anim({opacity: { to: (visible?1:0) }},
this.preanim(arguments, 1),
null, .35, 'easeIn', function(){
if(!visible){
if(visMode == El.DISPLAY){
dom.style.display = "none";
}else{
dom.style.visibility = "hidden";
}
Ext.get(dom).setOpacity(1);
}
});
}
return this;
},
isDisplayed : function() {
return this.getStyle("display") != "none";
},
toggle : function(animate){
this.setVisible(!this.isVisible(), this.preanim(arguments, 0));
return this;
},
setDisplayed : function(value) {
if(typeof value == "boolean"){
value = value ? this.originalDisplay : "none";
}
this.setStyle("display", value);
return this;
},
focus : function() {
try{
this.dom.focus();
}catch(e){}
return this;
},
blur : function() {
try{
this.dom.blur();
}catch(e){}
return this;
},
addClass : function(className){
if(Ext.isArray(className)){
for(var i = 0, len = className.length; i < len; i++) {
this.addClass(className[i]);
}
}else{
if(className && !this.hasClass(className)){
this.dom.className = this.dom.className + " " + className;
}
}
return this;
},
radioClass : function(className){
var siblings = this.dom.parentNode.childNodes;
for(var i = 0; i < siblings.length; i++) {
var s = siblings[i];
if(s.nodeType == 1){
Ext.get(s).removeClass(className);
}
}
this.addClass(className);
return this;
},
removeClass : function(className){
if(!className || !this.dom.className){
return this;
}
if(Ext.isArray(className)){
for(var i = 0, len = className.length; i < len; i++) {
this.removeClass(className[i]);
}
}else{
if(this.hasClass(className)){
var re = this.classReCache[className];
if (!re) {
re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");
this.classReCache[className] = re;
}
this.dom.className =
this.dom.className.replace(re, " ");
}
}
return this;
},
classReCache: {},
toggleClass : function(className){
if(this.hasClass(className)){
this.removeClass(className);
}else{
this.addClass(className);
}
return this;
},
hasClass : function(className){
return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
},
replaceClass : function(oldClassName, newClassName){
this.removeClass(oldClassName);
this.addClass(newClassName);
return this;
},
getStyles : function(){
var a = arguments, len = a.length, r = {};
for(var i = 0; i < len; i++){
r[a[i]] = this.getStyle(a[i]);
}
return r;
},
getStyle : function(){
return view && view.getComputedStyle ?
function(prop){
var el = this.dom, v, cs, camel;
if(prop == 'float'){
prop = "cssFloat";
}
if(v = el.style[prop]){
return v;
}
if(cs = view.getComputedStyle(el, "")){
if(!(camel = propCache[prop])){
camel = propCache[prop] = prop.replace(camelRe, camelFn);
}
return cs[camel];
}
return null;
} :
function(prop){
var el = this.dom, v, cs, camel;
if(prop == 'opacity'){
if(typeof el.style.filter == 'string'){
var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);
if(m){
var fv = parseFloat(m[1]);
if(!isNaN(fv)){
return fv ? fv / 100 : 0;
}
}
}
return 1;
}else if(prop == 'float'){
prop = "styleFloat";
}
if(!(camel = propCache[prop])){
camel = propCache[prop] = prop.replace(camelRe, camelFn);
}
if(v = el.style[camel]){
return v;
}
if(cs = el.currentStyle){
return cs[camel];
}
return null;
};
}(),
setStyle : function(prop, value){
if(typeof prop == "string"){
var camel;
if(!(camel = propCache[prop])){
camel = propCache[prop] = prop.replace(camelRe, camelFn);
}
if(camel == 'opacity') {
this.setOpacity(value);
}else{
this.dom.style[camel] = value;
}
}else{
for(var style in prop){
if(typeof prop[style] != "function"){
this.setStyle(style, prop[style]);
}
}
}
return this;
},
applyStyles : function(style){
Ext.DomHelper.applyStyles(this.dom, style);
return this;
},
getX : function(){
return D.getX(this.dom);
},
getY : function(){
return D.getY(this.dom);
},
getXY : function(){
return D.getXY(this.dom);
},
getOffsetsTo : function(el){
var o = this.getXY();
var e = Ext.fly(el, '_internal').getXY();
return [o[0]-e[0],o[1]-e[1]];
},
setX : function(x, animate){
if(!animate || !A){
D.setX(this.dom, x);
}else{
this.setXY([x, this.getY()], this.preanim(arguments, 1));
}
return this;
},
setY : function(y, animate){
if(!animate || !A){
D.setY(this.dom, y);
}else{
this.setXY([this.getX(), y], this.preanim(arguments, 1));
}
return this;
},
setLeft : function(left){
this.setStyle("left", this.addUnits(left));
return this;
},
setTop : function(top){
this.setStyle("top", this.addUnits(top));
return this;
},
setRight : function(right){
this.setStyle("right", this.addUnits(right));
return this;
},
setBottom : function(bottom){
this.setStyle("bottom", this.addUnits(bottom));
return this;
},
setXY : function(pos, animate){
if(!animate || !A){
D.setXY(this.dom, pos);
}else{
this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');
}
return this;
},
setLocation : function(x, y, animate){
this.setXY([x, y], this.preanim(arguments, 2));
return this;
},
moveTo : function(x, y, animate){
this.setXY([x, y], this.preanim(arguments, 2));
return this;
},
getRegion : function(){
return D.getRegion(this.dom);
},
getHeight : function(contentHeight){
var h = this.dom.offsetHeight || 0;
h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");
return h < 0 ? 0 : h;
},
getWidth : function(contentWidth){
var w = this.dom.offsetWidth || 0;
w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");
return w < 0 ? 0 : w;
},
getComputedHeight : function(){
var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);
if(!h){
h = parseInt(this.getStyle('height'), 10) || 0;
if(!this.isBorderBox()){
h += this.getFrameWidth('tb');
}
}
return h;
},
getComputedWidth : function(){
var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
if(!w){
w = parseInt(this.getStyle('width'), 10) || 0;
if(!this.isBorderBox()){
w += this.getFrameWidth('lr');
}
}
return w;
},
getSize : function(contentSize){
return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
},
getStyleSize : function(){
var w, h, d = this.dom, s = d.style;
if(s.width && s.width != 'auto'){
w = parseInt(s.width, 10);
if(Ext.isBorderBox){
w -= this.getFrameWidth('lr');
}
}
if(s.height && s.height != 'auto'){
h = parseInt(s.height, 10);
if(Ext.isBorderBox){
h -= this.getFrameWidth('tb');
}
}
return {width: w || this.getWidth(true), height: h || this.getHeight(true)};
},
getViewSize : function(){
var d = this.dom, doc = document, aw = 0, ah = 0;
if(d == doc || d == doc.body){
return {width : D.getViewWidth(), height: D.getViewHeight()};
}else{
return {
width : d.clientWidth,
height: d.clientHeight
};
}
},
getValue : function(asNumber){
return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;
},
adjustWidth : function(width){
if(typeof width == "number"){
if(this.autoBoxAdjust && !this.isBorderBox()){
width -= (this.getBorderWidth("lr") + this.getPadding("lr"));
}
if(width < 0){
width = 0;
}
}
return width;
},
adjustHeight : function(height){
if(typeof height == "number"){
if(this.autoBoxAdjust && !this.isBorderBox()){
height -= (this.getBorderWidth("tb") + this.getPadding("tb"));
}
if(height < 0){
height = 0;
}
}
return height;
},
setWidth : function(width, animate){
width = this.adjustWidth(width);
if(!animate || !A){
this.dom.style.width = this.addUnits(width);
}else{
this.anim({width: {to: width}}, this.preanim(arguments, 1));
}
return this;
},
setHeight : function(height, animate){
height = this.adjustHeight(height);
if(!animate || !A){
this.dom.style.height = this.addUnits(height);
}else{
this.anim({height: {to: height}}, this.preanim(arguments, 1));
}
return this;
},
setSize : function(width, height, animate){
if(typeof width == "object"){ height = width.height; width = width.width;
}
width = this.adjustWidth(width); height = this.adjustHeight(height);
if(!animate || !A){
this.dom.style.width = this.addUnits(width);
this.dom.style.height = this.addUnits(height);
}else{
this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));
}
return this;
},
setBounds : function(x, y, width, height, animate){
if(!animate || !A){
this.setSize(width, height);
this.setLocation(x, y);
}else{
width = this.adjustWidth(width); height = this.adjustHeight(height);
this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},
this.preanim(arguments, 4), 'motion');
}
return this;
},
setRegion : function(region, animate){
this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));
return this;
},
addListener : function(eventName, fn, scope, options){
Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);
},
removeListener : function(eventName, fn){
Ext.EventManager.removeListener(this.dom, eventName, fn);
return this;
},
removeAllListeners : function(){
E.purgeElement(this.dom);
return this;
},
relayEvent : function(eventName, observable){
this.on(eventName, function(e){
observable.fireEvent(eventName, e);
});
},
setOpacity : function(opacity, animate){
if(!animate || !A){
var s = this.dom.style;
if(Ext.isIE){
s.zoom = 1;
s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +
(opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")");
}else{
s.opacity = opacity;
}
}else{
this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');
}
return this;
},
getLeft : function(local){
if(!local){
return this.getX();
}else{
return parseInt(this.getStyle("left"), 10) || 0;
}
},
getRight : function(local){
if(!local){
return this.getX() + this.getWidth();
}else{
return (this.getLeft(true) + this.getWidth()) || 0;
}
},
getTop : function(local) {
if(!local){
return this.getY();
}else{
return parseInt(this.getStyle("top"), 10) || 0;
}
},
getBottom : function(local){
if(!local){
return this.getY() + this.getHeight();
}else{
return (this.getTop(true) + this.getHeight()) || 0;
}
},
position : function(pos, zIndex, x, y){
if(!pos){
if(this.getStyle('position') == 'static'){
this.setStyle('position', 'relative');
}
}else{
this.setStyle("position", pos);
}
if(zIndex){
this.setStyle("z-index", zIndex);
}
if(x !== undefined && y !== undefined){
this.setXY([x, y]);
}else if(x !== undefined){
this.setX(x);
}else if(y !== undefined){
this.setY(y);
}
},
clearPositioning : function(value){
value = value ||'';
this.setStyle({
"left": value,
"right": value,
"top": value,
"bottom": value,
"z-index": "",
"position" : "static"
});
return this;
},
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("z-index")
};
},
getBorderWidth : function(side){
return this.addStyles(side, El.borders);
},
getPadding : function(side){
return this.addStyles(side, El.paddings);
},
setPositioning : function(pc){
this.applyStyles(pc);
if(pc.right == "auto"){
this.dom.style.right = "";
}
if(pc.bottom == "auto"){
this.dom.style.bottom = "";
}
return this;
},
fixDisplay : function(){
if(this.getStyle("display") == "none"){
this.setStyle("visibility", "hidden");
this.setStyle("display", this.originalDisplay); if(this.getStyle("display") == "none"){ this.setStyle("display", "block");
}
}
},
setOverflow : function(v){
if(v=='auto' && Ext.isMac && Ext.isGecko){ this.dom.style.overflow = 'hidden';
(function(){this.dom.style.overflow = 'auto';}).defer(1, this);
}else{
this.dom.style.overflow = v;
}
},
setLeftTop : function(left, top){
this.dom.style.left = this.addUnits(left);
this.dom.style.top = this.addUnits(top);
return this;
},
move : function(direction, distance, animate){
var xy = this.getXY();
direction = direction.toLowerCase();
switch(direction){
case "l":
case "left":
this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));
break;
case "r":
case "right":
this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));
break;
case "t":
case "top":
case "up":
this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));
break;
case "b":
case "bottom":
case "down":
this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));
break;
}
return this;
},
clip : function(){
if(!this.isClipped){
this.isClipped = true;
this.originalClip = {
"o": this.getStyle("overflow"),
"x": this.getStyle("overflow-x"),
"y": this.getStyle("overflow-y")
};
this.setStyle("overflow", "hidden");
this.setStyle("overflow-x", "hidden");
this.setStyle("overflow-y", "hidden");
}
return this;
},
unclip : function(){
if(this.isClipped){
this.isClipped = false;
var o = this.originalClip;
if(o.o){this.setStyle("overflow", o.o);}
if(o.x){this.setStyle("overflow-x", o.x);}
if(o.y){this.setStyle("overflow-y", o.y);}
}
return this;
},
getAnchorXY : function(anchor, local, s){
var w, h, vp = false;
if(!s){
var d = this.dom;
if(d == document.body || d == document){
vp = true;
w = D.getViewWidth(); h = D.getViewHeight();
}else{
w = this.getWidth(); h = this.getHeight();
}
}else{
w = s.width; h = s.height;
}
var x = 0, y = 0, r = Math.round;
switch((anchor || "tl").toLowerCase()){
case "c":
x = r(w*.5);
y = r(h*.5);
break;
case "t":
x = r(w*.5);
y = 0;
break;
case "l":
x = 0;
y = r(h*.5);
break;
case "r":
x = w;
y = r(h*.5);
break;
case "b":
x = r(w*.5);
y = h;
break;
case "tl":
x = 0;
y = 0;
break;
case "bl":
x = 0;
y = h;
break;
case "br":
x = w;
y = h;
break;
case "tr":
x = w;
y = 0;
break;
}
if(local === true){
return [x, y];
}
if(vp){
var sc = this.getScroll();
return [x + sc.left, y + sc.top];
}
var o = this.getXY();
return [x+o[0], y+o[1]];
},
getAlignToXY : function(el, p, o){
el = Ext.get(el);
if(!el || !el.dom){
throw "Element.alignToXY with an element that doesn't exist";
}
var d = this.dom;
var c = false; var p1 = "", p2 = "";
o = o || [0,0];
if(!p){
p = "tl-bl";
}else if(p == "?"){
p = "tl-bl?";
}else if(p.indexOf("-") == -1){
p = "tl-" + p;
}
p = p.toLowerCase();
var 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];
var a1 = this.getAnchorXY(p1, true);
var a2 = el.getAnchorXY(p2, false);
var x = a2[0] - a1[0] + o[0];
var y = a2[1] - a1[1] + o[1];
if(c){
var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();
var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;
var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);
var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);
var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));
var doc = document;
var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;
var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;
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];
},
getConstrainToXY : function(){
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;
var vb = vy+vh;
var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);
var x = xy[0], y = xy[1];
var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
var moved = false;
if((x + w) > vr){
x = vr - w;
moved = true;
}
if((y + h) > vb){
y = vb - h;
moved = true;
}
if(x < vx){
x = vx;
moved = true;
}
if(y < vy){
y = vy;
moved = true;
}
return moved ? [x, y] : false;
};
}(),
adjustForConstraints : function(xy, parent, offsets){
return this.getConstrainToXY(parent || document, false, offsets, xy) || xy;
},
alignTo : function(element, position, offsets, animate){
var xy = this.getAlignToXY(element, position, offsets);
this.setXY(xy, this.preanim(arguments, 3));
return this;
},
anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
var action = function(){
this.alignTo(el, alignment, offsets, animate);
Ext.callback(callback, this);
};
Ext.EventManager.onWindowResize(action, this);
var tm = typeof monitorScroll;
if(tm != 'undefined'){
Ext.EventManager.on(window, 'scroll', action, this,
{buffer: tm == 'number' ? monitorScroll : 50});
}
action.call(this); return this;
},
clearOpacity : function(){
if (window.ActiveXObject) {
if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){
this.dom.style.filter = "";
}
} else {
this.dom.style.opacity = "";
this.dom.style["-moz-opacity"] = "";
this.dom.style["-khtml-opacity"] = "";
}
return this;
},
hide : function(animate){
this.setVisible(false, this.preanim(arguments, 0));
return this;
},
show : function(animate){
this.setVisible(true, this.preanim(arguments, 0));
return this;
},
addUnits : function(size){
return Ext.Element.addUnits(size, this.defaultUnit);
},
update : function(html, loadScripts, callback){
if(typeof html == "undefined"){
html = "";
}
if(loadScripts !== true){
this.dom.innerHTML = html;
if(typeof callback == "function"){
callback();
}
return this;
}
var id = Ext.id();
var dom = this.dom;
html += '<span id="' + id + '"></span>';
E.onAvailable(id, function(){
var hd = document.getElementsByTagName("head")[0];
var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
var typeRe = /\stype=([\'\"])(.*?)\1/i;
var match;
while(match = re.exec(html)){
var attrs = match[1];
var srcMatch = attrs ? attrs.match(srcRe) : false;
if(srcMatch && srcMatch[2]){
var s = document.createElement("script");
s.src = srcMatch[2];
var 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]);
}
}
}
var el = document.getElementById(id);
if(el){Ext.removeNode(el);}
if(typeof callback == "function"){
callback();
}
});
dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
return this;
},
load : function(){
var um = this.getUpdater();
um.update.apply(um, arguments);
return this;
},
getUpdater : function(){
if(!this.updateManager){
this.updateManager = new Ext.Updater(this);
}
return this.updateManager;
},
unselectable : function(){
this.dom.unselectable = "on";
this.swallowEvent("selectstart", true);
this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
this.addClass("x-unselectable");
return this;
},
getCenterXY : function(){
return this.getAlignToXY(document, 'c-c');
},
center : function(centerIn){
this.alignTo(centerIn || document, 'c-c');
return this;
},
isBorderBox : function(){
return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox;
},
getBox : function(contentBox, local){
var xy;
if(!local){
xy = this.getXY();
}else{
var left = parseInt(this.getStyle("left"), 10) || 0;
var top = parseInt(this.getStyle("top"), 10) || 0;
xy = [left, top];
}
var el = this.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{
var l = this.getBorderWidth("l")+this.getPadding("l");
var r = this.getBorderWidth("r")+this.getPadding("r");
var t = this.getBorderWidth("t")+this.getPadding("t");
var b = this.getBorderWidth("b")+this.getPadding("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;
},
getFrameWidth : function(sides, onlyContentBox){
return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
},
setBox : function(box, adjust, animate){
var w = box.width, h = box.height;
if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){
w -= (this.getBorderWidth("lr") + this.getPadding("lr"));
h -= (this.getBorderWidth("tb") + this.getPadding("tb"));
}
this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));
return this;
},
repaint : function(){
var dom = this.dom;
this.addClass("x-repaint");
setTimeout(function(){
Ext.get(dom).removeClass("x-repaint");
}, 1);
return this;
},
getMargins : function(side){
if(!side){
return {
top: parseInt(this.getStyle("margin-top"), 10) || 0,
left: parseInt(this.getStyle("margin-left"), 10) || 0,
bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,
right: parseInt(this.getStyle("margin-right"), 10) || 0
};
}else{
return this.addStyles(side, El.margins);
}
},
addStyles : function(sides, styles){
var val = 0, v, w;
for(var i = 0, len = sides.length; i < len; i++){
v = this.getStyle(styles[sides.charAt(i)]);
if(v){
w = parseInt(v, 10);
if(w){ val += (w >= 0 ? w : -1 * w); }
}
}
return val;
},
createProxy : function(config, renderTo, matchBox){
config = typeof config == "object" ?
config : {tag : "div", cls: config};
var proxy;
if(renderTo){
proxy = Ext.DomHelper.append(renderTo, config, true);
}else {
proxy = Ext.DomHelper.insertBefore(this.dom, config, true);
}
if(matchBox){
proxy.setBox(this.getBox());
}
return proxy;
},
mask : function(msg, msgCls){
if(this.getStyle("position") == "static"){
this.setStyle("position", "relative");
}
if(this._maskMsg){
this._maskMsg.remove();
}
if(this._mask){
this._mask.remove();
}
this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true);
this.addClass("x-masked");
this._mask.setDisplayed(true);
if(typeof msg == 'string'){
this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true);
var mm = this._maskMsg;
mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg";
mm.dom.firstChild.innerHTML = msg;
mm.setDisplayed(true);
mm.center(this);
}
if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){ this._mask.setSize(this.dom.clientWidth, this.getHeight());
}
return this._mask;
},
unmask : function(){
if(this._mask){
if(this._maskMsg){
this._maskMsg.remove();
delete this._maskMsg;
}
this._mask.remove();
delete this._mask;
}
this.removeClass("x-masked");
},
isMasked : function(){
return this._mask && this._mask.isVisible();
},
createShim : function(){
var el = document.createElement('iframe');
el.frameBorder = 'no';
el.className = 'ext-shim';
if(Ext.isIE && Ext.isSecure){
el.src = Ext.SSL_SECURE_URL;
}
var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
shim.autoBoxAdjust = false;
return shim;
},
remove : function(){
Ext.removeNode(this.dom);
delete El.cache[this.dom.id];
},
hover : function(overFn, outFn, scope){
var preOverFn = function(e){
if(!e.within(this, true)){
overFn.apply(scope || this, arguments);
}
};
var preOutFn = function(e){
if(!e.within(this, true)){
outFn.apply(scope || this, arguments);
}
};
this.on("mouseover", preOverFn, this.dom);
this.on("mouseout", preOutFn, this.dom);
return this;
},
addClassOnOver : function(className, preventFlicker){
this.hover(
function(){
Ext.fly(this, '_internal').addClass(className);
},
function(){
Ext.fly(this, '_internal').removeClass(className);
}
);
return 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;
},
addClassOnClick : function(className){
var dom = this.dom;
this.on("mousedown", function(){
Ext.fly(dom, '_internal').addClass(className);
var d = Ext.getDoc();
var fn = function(){
Ext.fly(dom, '_internal').removeClass(className);
d.removeListener("mouseup", fn);
};
d.on("mouseup", fn);
});
return this;
},
swallowEvent : function(eventName, preventDefault){
var fn = function(e){
e.stopPropagation();
if(preventDefault){
e.preventDefault();
}
};
if(Ext.isArray(eventName)){
for(var i = 0, len = eventName.length; i < len; i++){
this.on(eventName[i], fn);
}
return this;
}
this.on(eventName, fn);
return this;
},
parent : function(selector, returnDom){
return this.matchNode('parentNode', 'parentNode', selector, returnDom);
},
next : function(selector, returnDom){
return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
},
prev : function(selector, returnDom){
return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
},
first : function(selector, returnDom){
return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
},
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 || Ext.DomQuery.is(n, selector))){
return !returnDom ? Ext.get(n) : n;
}
n = n[dir];
}
return null;
},
appendChild: function(el){
el = Ext.get(el);
el.appendTo(this);
return this;
},
createChild: function(config, insertBefore, returnDom){
config = config || {tag:'div'};
if(insertBefore){
return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
}
return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true);
},
appendTo: function(el){
el = Ext.getDom(el);
el.appendChild(this.dom);
return this;
},
insertBefore: function(el){
el = Ext.getDom(el);
el.parentNode.insertBefore(this.dom, el);
return this;
},
insertAfter: function(el){
el = Ext.getDom(el);
el.parentNode.insertBefore(this.dom, el.nextSibling);
return this;
},
insertFirst: function(el, returnDom){
el = el || {};
if(typeof el == 'object' && !el.nodeType && !el.dom){ return this.createChild(el, this.dom.firstChild, returnDom);
}else{
el = Ext.getDom(el);
this.dom.insertBefore(el, this.dom.firstChild);
return !returnDom ? Ext.get(el) : el;
}
},
insertSibling: function(el, where, returnDom){
var rt;
if(Ext.isArray(el)){
for(var i = 0, len = el.length; i < len; i++){
rt = this.insertSibling(el[i], where, returnDom);
}
return rt;
}
where = where ? where.toLowerCase() : 'before';
el = el || {};
var refNode = where == 'before' ? this.dom : this.dom.nextSibling;
if(typeof el == 'object' && !el.nodeType && !el.dom){ if(where == 'after' && !this.dom.nextSibling){
rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom);
}else{
rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);
}
}else{
rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode);
if(!returnDom){
rt = Ext.get(rt);
}
}
return rt;
},
wrap: function(config, returnDom){
if(!config){
config = {tag: "div"};
}
var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom);
newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
return newEl;
},
replace: function(el){
el = Ext.get(el);
this.insertBefore(el);
el.remove();
return this;
},
replaceWith: function(el){
if(typeof el == 'object' && !el.nodeType && !el.dom){ el = this.insertSibling(el, 'before');
}else{
el = Ext.getDom(el);
this.dom.parentNode.insertBefore(el, this.dom);
}
El.uncache(this.id);
this.dom.parentNode.removeChild(this.dom);
this.dom = el;
this.id = Ext.id(el);
El.cache[this.id] = this;
return this;
},
insertHtml : function(where, html, returnEl){
var el = Ext.DomHelper.insertHtml(where, this.dom, html);
return returnEl ? Ext.get(el) : el;
},
set : function(o, useSet){
var el = this.dom;
useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;
for(var attr in o){
if(attr == "style" || typeof o[attr] == "function") continue;
if(attr=="cls"){
el.className = o["cls"];
}else if(o.hasOwnProperty(attr)){
if(useSet) el.setAttribute(attr, o[attr]);
else el[attr] = o[attr];
}
}
if(o.style){
Ext.DomHelper.applyStyles(el, o.style);
}
return this;
},
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);
},
addKeyMap : function(config){
return new Ext.KeyMap(this, config);
},
isScrollable : function(){
var dom = this.dom;
return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
},
scrollTo : function(side, value, animate){
var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";
if(!animate || !A){
this.dom[prop] = value;
}else{
var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];
this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');
}
return this;
},
scroll : function(direction, distance, animate){
if(!this.isScrollable()){
return;
}
var el = this.dom;
var l = el.scrollLeft, t = el.scrollTop;
var w = el.scrollWidth, h = el.scrollHeight;
var cw = el.clientWidth, ch = el.clientHeight;
direction = direction.toLowerCase();
var scrolled = false;
var a = this.preanim(arguments, 2);
switch(direction){
case "l":
case "left":
if(w - l > cw){
var v = Math.min(l + distance, w-cw);
this.scrollTo("left", v, a);
scrolled = true;
}
break;
case "r":
case "right":
if(l > 0){
var v = Math.max(l - distance, 0);
this.scrollTo("left", v, a);
scrolled = true;
}
break;
case "t":
case "top":
case "up":
if(t > 0){
var v = Math.max(t - distance, 0);
this.scrollTo("top", v, a);
scrolled = true;
}
break;
case "b":
case "bottom":
case "down":
if(h - t > ch){
var v = Math.min(t + distance, h-ch);
this.scrollTo("top", v, a);
scrolled = true;
}
break;
}
return scrolled;
},
translatePoints : function(x, y){
if(typeof x == 'object' || Ext.isArray(x)){
y = x[1]; x = x[0];
}
var p = this.getStyle('position');
var o = this.getXY();
var l = parseInt(this.getStyle('left'), 10);
var t = parseInt(this.getStyle('top'), 10);
if(isNaN(l)){
l = (p == "relative") ? 0 : this.dom.offsetLeft;
}
if(isNaN(t)){
t = (p == "relative") ? 0 : this.dom.offsetTop;
}
return {left: (x - o[0] + l), top: (y - o[1] + t)};
},
getScroll : function(){
var d = this.dom, doc = document;
if(d == doc || d == doc.body){
var l, t;
if(Ext.isIE && Ext.isStrict){
l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0);
t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0);
}else{
l = window.pageXOffset || (doc.body.scrollLeft || 0);
t = window.pageYOffset || (doc.body.scrollTop || 0);
}
return {left: l, top: t};
}else{
return {left: d.scrollLeft, top: d.scrollTop};
}
},
getColor : function(attr, defaultValue, prefix){
var v = this.getStyle(attr);
if(!v || v == "transparent" || v == "inherit") {
return defaultValue;
}
var color = typeof prefix == "undefined" ? "#" : prefix;
if(v.substr(0, 4) == "rgb("){
var rvs = v.slice(4, v.length -1).split(",");
for(var i = 0; i < 3; i++){
var h = parseInt(rvs[i]);
var s = h.toString(16);
if(h < 16){
s = "0" + s;
}
color += s;
}
} else {
if(v.substr(0, 1) == "#"){
if(v.length == 4) {
for(var i = 1; i < 4; i++){
var c = v.charAt(i);
color += c + c;
}
}else if(v.length == 7){
color += v.substr(1);
}
}
}
return(color.length > 5 ? color.toLowerCase() : defaultValue);
},
boxWrap : function(cls){
cls = cls || 'x-box';
var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));
el.child('.'+cls+'-mc').dom.appendChild(this.dom);
return el;
},
getAttributeNS : Ext.isIE ? function(ns, name){
var d = this.dom;
var type = typeof d[ns+":"+name];
if(type != 'undefined' && type != 'unknown'){
return d[ns+":"+name];
}
return d[name];
} : function(ns, name){
var d = this.dom;
return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
},
getTextWidth : function(text, min, max){
return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000);
}
};
var ep = El.prototype;
ep.on = ep.addListener;
ep.mon = ep.addListener;
ep.getUpdateManager = ep.getUpdater;
ep.un = ep.removeListener;
ep.autoBoxAdjust = true;
El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;
El.addUnits = function(v, defaultUnit){
if(v === "" || v == "auto"){
return v;
}
if(v === undefined){
return '';
}
if(typeof v == "number" || !El.unitPattern.test(v)){
return v + (defaultUnit || 'px');
}
return v;
};
El.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>';
El.VISIBILITY = 1;
El.DISPLAY = 2;
El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};
El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};
El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};
El.cache = {};
var docEl;
El.get = function(el){
var ex, elm, id;
if(!el){ return null; }
if(typeof el == "string"){ if(!(elm = document.getElementById(el))){
return null;
}
if(ex = El.cache[el]){
ex.dom = elm;
}else{
ex = El.cache[el] = new El(elm);
}
return ex;
}else if(el.tagName){ if(!(id = el.id)){
id = Ext.id(el);
}
if(ex = El.cache[id]){
ex.dom = el;
}else{
ex = El.cache[id] = new El(el);
}
return ex;
}else if(el instanceof El){
if(el != docEl){
el.dom = document.getElementById(el.id) || el.dom; El.cache[el.id] = el; }
return el;
}else if(el.isComposite){
return el;
}else if(Ext.isArray(el)){
return El.select(el);
}else if(el == document){
if(!docEl){
var f = function(){};
f.prototype = El.prototype;
docEl = new f();
docEl.dom = document;
}
return docEl;
}
return null;
};
El.uncache = function(el){
for(var i = 0, a = arguments, len = a.length; i < len; i++) {
if(a[i]){
delete El.cache[a[i].id || a[i]];
}
}
};
El.garbageCollect = function(){
if(!Ext.enableGarbageCollector){
clearInterval(El.collectorThread);
return;
}
for(var eid in El.cache){
var el = El.cache[eid], d = el.dom;
if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){
delete El.cache[eid];
if(d && Ext.enableListenerCollection){
E.purgeElement(d);
}
}
}
}
El.collectorThreadId = setInterval(El.garbageCollect, 30000);
var flyFn = function(){};
flyFn.prototype = El.prototype;
var _cls = new flyFn();
El.Flyweight = function(dom){
this.dom = dom;
};
El.Flyweight.prototype = _cls;
El.Flyweight.prototype.isFlyweight = true;
El._flyweights = {};
El.fly = function(el, named){
named = named || '_global';
el = Ext.getDom(el);
if(!el){
return null;
}
if(!El._flyweights[named]){
El._flyweights[named] = new El.Flyweight();
}
El._flyweights[named].dom = el;
return El._flyweights[named];
};
Ext.get = El.get;
Ext.fly = El.fly;
var noBoxAdjust = Ext.isStrict ? {
select:1
} : {
input:1, select:1, textarea:1
};
if(Ext.isIE || Ext.isGecko){
noBoxAdjust['button'] = 1;
}
Ext.EventManager.on(window, 'unload', function(){
delete El.cache;
delete El._flyweights;
});
})();
Ext.enableFx = true;
Ext.Fx = {
slideIn : function(anchor, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
anchor = anchor || "t";
this.fixDisplay();
var r = this.getFxRestore();
var b = this.getBox();
this.setSize(b);
var wrap = this.fxWrap(r.pos, o, "hidden");
var st = this.dom.style;
st.visibility = "visible";
st.position = "absolute";
var after = function(){
el.fxUnwrap(wrap, r.pos, o);
st.width = r.width;
st.height = r.height;
el.afterFx(o);
};
var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};
switch(anchor.toLowerCase()){
case "t":
wrap.setSize(b.width, 0);
st.left = st.bottom = "0";
a = {height: bh};
break;
case "l":
wrap.setSize(0, b.height);
st.right = st.top = "0";
a = {width: bw};
break;
case "r":
wrap.setSize(0, b.height);
wrap.setX(b.right);
st.left = st.top = "0";
a = {width: bw, points: pt};
break;
case "b":
wrap.setSize(b.width, 0);
wrap.setY(b.bottom);
st.left = st.top = "0";
a = {height: bh, points: pt};
break;
case "tl":
wrap.setSize(0, 0);
st.right = st.bottom = "0";
a = {width: bw, height: bh};
break;
case "bl":
wrap.setSize(0, 0);
wrap.setY(b.y+b.height);
st.right = st.top = "0";
a = {width: bw, height: bh, points: pt};
break;
case "br":
wrap.setSize(0, 0);
wrap.setXY([b.right, b.bottom]);
st.left = st.top = "0";
a = {width: bw, height: bh, points: pt};
break;
case "tr":
wrap.setSize(0, 0);
wrap.setX(b.x+b.width);
st.left = st.bottom = "0";
a = {width: bw, height: bh, points: pt};
break;
}
this.dom.style.visibility = "visible";
wrap.show();
arguments.callee.anim = wrap.fxanim(a,
o,
'motion',
.5,
'easeOut', after);
});
return this;
},
slideOut : function(anchor, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
anchor = anchor || "t";
var r = this.getFxRestore();
var b = this.getBox();
this.setSize(b);
var wrap = this.fxWrap(r.pos, o, "visible");
var st = this.dom.style;
st.visibility = "visible";
st.position = "absolute";
wrap.setSize(b);
var after = function(){
if(o.useDisplay){
el.setDisplayed(false);
}else{
el.hide();
}
el.fxUnwrap(wrap, r.pos, o);
st.width = r.width;
st.height = r.height;
el.afterFx(o);
};
var a, zero = {to: 0};
switch(anchor.toLowerCase()){
case "t":
st.left = st.bottom = "0";
a = {height: zero};
break;
case "l":
st.right = st.top = "0";
a = {width: zero};
break;
case "r":
st.left = st.top = "0";
a = {width: zero, points: {to:[b.right, b.y]}};
break;
case "b":
st.left = st.top = "0";
a = {height: zero, points: {to:[b.x, b.bottom]}};
break;
case "tl":
st.right = st.bottom = "0";
a = {width: zero, height: zero};
break;
case "bl":
st.right = st.top = "0";
a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};
break;
case "br":
st.left = st.top = "0";
a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};
break;
case "tr":
st.left = st.bottom = "0";
a = {width: zero, height: zero, points: {to:[b.right, b.y]}};
break;
}
arguments.callee.anim = wrap.fxanim(a,
o,
'motion',
.5,
"easeOut", after);
});
return this;
},
puff : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
this.clearOpacity();
this.show();
var r = this.getFxRestore();
var st = this.dom.style;
var after = function(){
if(o.useDisplay){
el.setDisplayed(false);
}else{
el.hide();
}
el.clearOpacity();
el.setPositioning(r.pos);
st.width = r.width;
st.height = r.height;
st.fontSize = '';
el.afterFx(o);
};
var width = this.getWidth();
var height = this.getHeight();
arguments.callee.anim = this.fxanim({
width : {to: this.adjustWidth(width * 2)},
height : {to: this.adjustHeight(height * 2)},
points : {by: [-(width * .5), -(height * .5)]},
opacity : {to: 0},
fontSize: {to:200, unit: "%"}
},
o,
'motion',
.5,
"easeOut", after);
});
return this;
},
switchOff : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
this.clearOpacity();
this.clip();
var r = this.getFxRestore();
var st = this.dom.style;
var after = function(){
if(o.useDisplay){
el.setDisplayed(false);
}else{
el.hide();
}
el.clearOpacity();
el.setPositioning(r.pos);
st.width = r.width;
st.height = r.height;
el.afterFx(o);
};
this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){
this.clearOpacity();
(function(){
this.fxanim({
height:{to:1},
points:{by:[0, this.getHeight() * .5]}
}, o, 'motion', 0.3, 'easeIn', after);
}).defer(100, this);
});
});
return this;
},
highlight : function(color, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
color = color || "ffff9c";
var attr = o.attr || "backgroundColor";
this.clearOpacity();
this.show();
var origColor = this.getColor(attr);
var restoreColor = this.dom.style[attr];
var endColor = (o.endColor || origColor) || "ffffff";
var after = function(){
el.dom.style[attr] = restoreColor;
el.afterFx(o);
};
var a = {};
a[attr] = {from: color, to: endColor};
arguments.callee.anim = this.fxanim(a,
o,
'color',
1,
'easeIn', after);
});
return this;
},
frame : function(color, count, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
color = color || "#C3DAF9";
if(color.length == 6){
color = "#" + color;
}
count = count || 1;
var duration = o.duration || 1;
this.show();
var b = this.getBox();
var animFn = function(){
var proxy = Ext.getBody().createChild({
style:{
visbility:"hidden",
position:"absolute",
"z-index":"35000", border:"0px solid " + color
}
});
var scale = Ext.isBorderBox ? 2 : 1;
proxy.animate({
top:{from:b.y, to:b.y - 20},
left:{from:b.x, to:b.x - 20},
borderWidth:{from:0, to:10},
opacity:{from:1, to:0},
height:{from:b.height, to:(b.height + (20*scale))},
width:{from:b.width, to:(b.width + (20*scale))}
}, duration, function(){
proxy.remove();
if(--count > 0){
animFn();
}else{
el.afterFx(o);
}
});
};
animFn.call(this);
});
return this;
},
pause : function(seconds){
var el = this.getFxEl();
var o = {};
el.queueFx(o, function(){
setTimeout(function(){
el.afterFx(o);
}, seconds * 1000);
});
return this;
},
fadeIn : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
this.setOpacity(0);
this.fixDisplay();
this.dom.style.visibility = 'visible';
var to = o.endOpacity || 1;
arguments.callee.anim = this.fxanim({opacity:{to:to}},
o, null, .5, "easeOut", function(){
if(to == 1){
this.clearOpacity();
}
el.afterFx(o);
});
});
return this;
},
fadeOut : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
arguments.callee.anim = this.fxanim({opacity:{to:o.endOpacity || 0}},
o, null, .5, "easeOut", function(){
if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){
this.dom.style.display = "none";
}else{
this.dom.style.visibility = "hidden";
}
this.clearOpacity();
el.afterFx(o);
});
});
return this;
},
scale : function(w, h, o){
this.shift(Ext.apply({}, o, {
width: w,
height: h
}));
return this;
},
shift : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
var a = {}, w = o.width, h = o.height, x = o.x, y = o.y, op = o.opacity;
if(w !== undefined){
a.width = {to: this.adjustWidth(w)};
}
if(h !== undefined){
a.height = {to: this.adjustHeight(h)};
}
if(x !== undefined || y !== undefined){
a.points = {to: [
x !== undefined ? x : this.getX(),
y !== undefined ? y : this.getY()
]};
}
if(op !== undefined){
a.opacity = {to: op};
}
if(o.xy !== undefined){
a.points = {to: o.xy};
}
arguments.callee.anim = this.fxanim(a,
o, 'motion', .35, "easeOut", function(){
el.afterFx(o);
});
});
return this;
},
ghost : function(anchor, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
anchor = anchor || "b";
var r = this.getFxRestore();
var w = this.getWidth(),
h = this.getHeight();
var st = this.dom.style;
var after = function(){
if(o.useDisplay){
el.setDisplayed(false);
}else{
el.hide();
}
el.clearOpacity();
el.setPositioning(r.pos);
st.width = r.width;
st.height = r.height;
el.afterFx(o);
};
var a = {opacity: {to: 0}, points: {}}, pt = a.points;
switch(anchor.toLowerCase()){
case "t":
pt.by = [0, -h];
break;
case "l":
pt.by = [-w, 0];
break;
case "r":
pt.by = [w, 0];
break;
case "b":
pt.by = [0, h];
break;
case "tl":
pt.by = [-w, -h];
break;
case "bl":
pt.by = [-w, h];
break;
case "br":
pt.by = [w, h];
break;
case "tr":
pt.by = [w, -h];
break;
}
arguments.callee.anim = this.fxanim(a,
o,
'motion',
.5,
"easeOut", after);
});
return this;
},
syncFx : function(){
this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
block : false,
concurrent : true,
stopFx : false
});
return this;
},
sequenceFx : function(){
this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
block : false,
concurrent : false,
stopFx : false
});
return this;
},
nextFx : function(){
var ef = this.fxQueue[0];
if(ef){
ef.call(this);
}
},
hasActiveFx : function(){
return this.fxQueue && this.fxQueue[0];
},
stopFx : function(){
if(this.hasActiveFx()){
var cur = this.fxQueue[0];
if(cur && cur.anim && cur.anim.isAnimated()){
this.fxQueue = [cur]; cur.anim.stop(true);
}
}
return this;
},
beforeFx : function(o){
if(this.hasActiveFx() && !o.concurrent){
if(o.stopFx){
this.stopFx();
return true;
}
return false;
}
return true;
},
hasFxBlock : function(){
var q = this.fxQueue;
return q && q[0] && q[0].block;
},
queueFx : function(o, fn){
if(!this.fxQueue){
this.fxQueue = [];
}
if(!this.hasFxBlock()){
Ext.applyIf(o, this.fxDefaults);
if(!o.concurrent){
var run = this.beforeFx(o);
fn.block = o.block;
this.fxQueue.push(fn);
if(run){
this.nextFx();
}
}else{
fn.call(this);
}
}
return this;
},
fxWrap : function(pos, o, vis){
var wrap;
if(!o.wrap || !(wrap = Ext.get(o.wrap))){
var wrapXY;
if(o.fixPosition){
wrapXY = this.getXY();
}
var div = document.createElement("div");
div.style.visibility = vis;
wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));
wrap.setPositioning(pos);
if(wrap.getStyle("position") == "static"){
wrap.position("relative");
}
this.clearPositioning('auto');
wrap.clip();
wrap.dom.appendChild(this.dom);
if(wrapXY){
wrap.setXY(wrapXY);
}
}
return wrap;
},
fxUnwrap : function(wrap, pos, o){
this.clearPositioning();
this.setPositioning(pos);
if(!o.wrap){
wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);
wrap.remove();
}
},
getFxRestore : function(){
var st = this.dom.style;
return {pos: this.getPositioning(), width: st.width, height : st.height};
},
afterFx : function(o){
if(o.afterStyle){
this.applyStyles(o.afterStyle);
}
if(o.afterCls){
this.addClass(o.afterCls);
}
if(o.remove === true){
this.remove();
}
Ext.callback(o.callback, o.scope, [this]);
if(!o.concurrent){
this.fxQueue.shift();
this.nextFx();
}
},
getFxEl : function(){ return Ext.get(this.dom);
},
fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){
animType = animType || 'run';
opt = opt || {};
var anim = Ext.lib.Anim[animType](
this.dom, args,
(opt.duration || defaultDur) || .35,
(opt.easing || defaultEase) || 'easeOut',
function(){
Ext.callback(cb, this);
},
this
);
opt.anim = anim;
return anim;
}
};
Ext.Fx.resize = Ext.Fx.scale;
Ext.apply(Ext.Element.prototype, Ext.Fx);
Ext.CompositeElement = function(els){
this.elements = [];
this.addElements(els);
};
Ext.CompositeElement.prototype = {
isComposite: true,
addElements : function(els){
if(!els) return this;
if(typeof els == "string"){
els = Ext.Element.selectorFunction(els);
}
var yels = this.elements;
var index = yels.length-1;
for(var i = 0, len = els.length; i < len; i++) {
yels[++index] = Ext.get(els[i]);
}
return this;
},
fill : function(els){
this.elements = [];
this.add(els);
return this;
},
filter : function(selector){
var els = [];
this.each(function(el){
if(el.is(selector)){
els[els.length] = el.dom;
}
});
this.fill(els);
return this;
},
invoke : function(fn, args){
var els = this.elements;
for(var i = 0, len = els.length; i < len; i++) {
Ext.Element.prototype[fn].apply(els[i], args);
}
return this;
},
add : function(els){
if(typeof els == "string"){
this.addElements(Ext.Element.selectorFunction(els));
}else if(els.length !== undefined){
this.addElements(els);
}else{
this.addElements([els]);
}
return this;
},
each : function(fn, scope){
var els = this.elements;
for(var i = 0, len = els.length; i < len; i++){
if(fn.call(scope || els[i], els[i], this, i) === false) {
break;
}
}
return this;
},
item : function(index){
return this.elements[index] || null;
},
first : function(){
return this.item(0);
},
last : function(){
return this.item(this.elements.length-1);
},
getCount : function(){
return this.elements.length;
},
contains : function(el){
return this.indexOf(el) !== -1;
},
indexOf : function(el){
return this.elements.indexOf(Ext.get(el));
},
removeElement : function(el, removeDom){
if(Ext.isArray(el)){
for(var i = 0, len = el.length; i < len; i++){
this.removeElement(el[i]);
}
return this;
}
var index = typeof el == 'number' ? el : this.indexOf(el);
if(index !== -1 && this.elements[index]){
if(removeDom){
var d = this.elements[index];
if(d.dom){
d.remove();
}else{
Ext.removeNode(d);
}
}
this.elements.splice(index, 1);
}
return this;
},
replaceElement : function(el, replacement, domReplace){
var index = typeof el == 'number' ? el : this.indexOf(el);
if(index !== -1){
if(domReplace){
this.elements[index].replaceWith(replacement);
}else{
this.elements.splice(index, 1, Ext.get(replacement))
}
}
return this;
},
clear : function(){
this.elements = [];
}
};
(function(){
Ext.CompositeElement.createCall = function(proto, fnName){
if(!proto[fnName]){
proto[fnName] = function(){
return this.invoke(fnName, arguments);
};
}
};
for(var fnName in Ext.Element.prototype){
if(typeof Ext.Element.prototype[fnName] == "function"){
Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);
}
};
})();
Ext.CompositeElementLite = function(els){
Ext.CompositeElementLite.superclass.constructor.call(this, els);
this.el = new Ext.Element.Flyweight();
};
Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {
addElements : function(els){
if(els){
if(Ext.isArray(els)){
this.elements = this.elements.concat(els);
}else{
var yels = this.elements;
var index = yels.length-1;
for(var i = 0, len = els.length; i < len; i++) {
yels[++index] = els[i];
}
}
}
return this;
},
invoke : function(fn, args){
var els = this.elements;
var el = this.el;
for(var i = 0, len = els.length; i < len; i++) {
el.dom = els[i];
Ext.Element.prototype[fn].apply(el, args);
}
return this;
},
item : function(index){
if(!this.elements[index]){
return null;
}
this.el.dom = this.elements[index];
return this.el;
},
addListener : function(eventName, handler, scope, opt){
var els = this.elements;
for(var i = 0, len = els.length; i < len; i++) {
Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt);
}
return this;
},
each : function(fn, scope){
var els = this.elements;
var el = this.el;
for(var i = 0, len = els.length; i < len; i++){
el.dom = els[i];
if(fn.call(scope || el, el, this, i) === false){
break;
}
}
return this;
},
indexOf : function(el){
return this.elements.indexOf(Ext.getDom(el));
},
replaceElement : function(el, replacement, domReplace){
var index = typeof el == 'number' ? el : this.indexOf(el);
if(index !== -1){
replacement = Ext.getDom(replacement);
if(domReplace){
var d = this.elements[index];
d.parentNode.insertBefore(replacement, d);
Ext.removeNode(d);
}
this.elements.splice(index, 1, replacement);
}
return this;
}
});
Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
if(Ext.DomQuery){
Ext.Element.selectorFunction = Ext.DomQuery.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";
}
if(unique === true){
return new Ext.CompositeElement(els);
}else{
return new Ext.CompositeElementLite(els);
}
};
Ext.select = Ext.Element.select;
Ext.data.Connection = function(config){
Ext.apply(this, config);
this.addEvents(
"beforerequest",
"requestcomplete",
"requestexception"
);
Ext.data.Connection.superclass.constructor.call(this);
};
Ext.extend(Ext.data.Connection, Ext.util.Observable, {
timeout : 30000,
autoAbort:false,
disableCaching: true,
request : function(o){
if(this.fireEvent("beforerequest", this, o) !== false){
var p = o.params;
if(typeof p == "function"){
p = p.call(o.scope||window, o);
}
if(typeof p == "object"){
p = Ext.urlEncode(p);
}
if(this.extraParams){
var extras = Ext.urlEncode(this.extraParams);
p = p ? (p + '&' + extras) : extras;
}
var url = o.url || this.url;
if(typeof url == 'function'){
url = url.call(o.scope||window, o);
}
if(o.form){
var form = Ext.getDom(o.form);
url = url || form.action;
var enctype = form.getAttribute("enctype");
if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
return this.doFormUpload(o, p, url);
}
var f = Ext.lib.Ajax.serializeForm(form);
p = p ? (p + '&' + f) : f;
}
var hs = o.headers;
if(this.defaultHeaders){
hs = Ext.apply(hs || {}, this.defaultHeaders);
if(!o.headers){
o.headers = hs;
}
}
var cb = {
success: this.handleResponse,
failure: this.handleFailure,
scope: this,
argument: {options: o},
timeout : o.timeout || this.timeout
};
var method = o.method||this.method||(p ? "POST" : "GET");
if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime());
}
if(typeof o.autoAbort == 'boolean'){
if(o.autoAbort){
this.abort();
}
}else if(this.autoAbort !== false){
this.abort();
}
if((method == 'GET' && p) || o.xmlData || o.jsonData){
url += (url.indexOf('?') != -1 ? '&' : '?') + p;
p = '';
}
this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
return this.transId;
}else{
Ext.callback(o.callback, o.scope, [o, null, null]);
return null;
}
},
isLoading : function(transId){
if(transId){
return Ext.lib.Ajax.isCallInProgress(transId);
}else{
return this.transId ? true : false;
}
},
abort : function(transId){
if(transId || this.isLoading()){
Ext.lib.Ajax.abort(transId || this.transId);
}
},
handleResponse : function(response){
this.transId = false;
var options = response.argument.options;
response.argument = options ? options.argument : null;
this.fireEvent("requestcomplete", this, response, options);
Ext.callback(options.success, options.scope, [response, options]);
Ext.callback(options.callback, options.scope, [options, true, response]);
},
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);
Ext.callback(options.failure, options.scope, [response, options]);
Ext.callback(options.callback, options.scope, [options, false, response]);
},
doFormUpload : function(o, ps, url){
var id = Ext.id();
var frame = document.createElement('iframe');
frame.id = id;
frame.name = id;
frame.className = 'x-hidden';
if(Ext.isIE){
frame.src = Ext.SSL_SECURE_URL;
}
document.body.appendChild(frame);
if(Ext.isIE){
document.frames[id].name = id;
}
var form = Ext.getDom(o.form);
form.target = id;
form.method = 'POST';
form.enctype = form.encoding = 'multipart/form-data';
if(url){
form.action = url;
}
var hiddens, hd;
if(ps){
hiddens = [];
ps = Ext.urlDecode(ps, false);
for(var k in ps){
if(ps.hasOwnProperty(k)){
hd = document.createElement('input');
hd.type = 'hidden';
hd.name = k;
hd.value = ps[k];
form.appendChild(hd);
hiddens.push(hd);
}
}
}
function cb(){
var r = {
responseText : '',
responseXML : null
};
r.argument = o ? o.argument : null;
try {
var doc;
if(Ext.isIE){
doc = frame.contentWindow.document;
}else {
doc = (frame.contentDocument || window.frames[id].document);
}
if(doc && doc.body){
r.responseText = doc.body.innerHTML;
}
if(doc && doc.XMLDocument){
r.responseXML = doc.XMLDocument;
}else {
r.responseXML = doc;
}
}
catch(e) {
}
Ext.EventManager.removeListener(frame, 'load', cb, this);
this.fireEvent("requestcomplete", this, r, o);
Ext.callback(o.success, o.scope, [r, o]);
Ext.callback(o.callback, o.scope, [o, true, r]);
setTimeout(function(){Ext.removeNode(frame);}, 100);
}
Ext.EventManager.on(frame, 'load', cb, this);
form.submit();
if(hiddens){
for(var i = 0, len = hiddens.length; i < len; i++){
Ext.removeNode(hiddens[i]);
}
}
}
});
Ext.Ajax = new Ext.data.Connection({
autoAbort : false,
serializeForm : function(form){
return Ext.lib.Ajax.serializeForm(form);
}
});
Ext.Updater = function(el, forceNew){
el = Ext.get(el);
if(!forceNew && el.updateManager){
return el.updateManager;
}
this.el = el;
this.defaultUrl = null;
this.addEvents(
"beforeupdate",
"update",
"failure"
);
var d = Ext.Updater.defaults;
this.sslBlankUrl = d.sslBlankUrl;
this.disableCaching = d.disableCaching;
this.indicatorText = d.indicatorText;
this.showLoadIndicator = d.showLoadIndicator;
this.timeout = d.timeout;
this.loadScripts = d.loadScripts;
this.transaction = null;
this.autoRefreshProcId = null;
this.refreshDelegate = this.refresh.createDelegate(this);
this.updateDelegate = this.update.createDelegate(this);
this.formUpdateDelegate = this.formUpdate.createDelegate(this);
if(!this.renderer){
this.renderer = new Ext.Updater.BasicRenderer();
}
Ext.Updater.superclass.constructor.call(this);
};
Ext.extend(Ext.Updater, Ext.util.Observable, {
getEl : function(){
return this.el;
},
update : function(url, params, callback, discardUrl){
if(this.fireEvent("beforeupdate", this.el, url, params) !== false){
var method = this.method, cfg, callerScope;
if(typeof url == "object"){
cfg = url;
url = cfg.url;
params = params || cfg.params;
callback = callback || cfg.callback;
discardUrl = discardUrl || cfg.discardUrl;
callerScope = cfg.scope;
if(typeof cfg.method != "undefined"){method = cfg.method;};
if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};
if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};
if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};
if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};
}
this.showLoading();
if(!discardUrl){
this.defaultUrl = url;
}
if(typeof url == "function"){
url = url.call(this);
}
method = method || (params ? "POST" : "GET");
if(method == "GET"){
url = this.prepareUrl(url);
}
var o = Ext.apply(cfg ||{}, {
url : url,
params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params,
success: this.processSuccess,
failure: this.processFailure,
scope: this,
callback: undefined,
timeout: (this.timeout*1000),
argument: {
"options": cfg,
"url": url,
"form": null,
"callback": callback,
"scope": callerScope || window,
"params": params
}
});
this.transaction = Ext.Ajax.request(o);
}
},
formUpdate : function(form, url, reset, callback){
if(this.fireEvent("beforeupdate", this.el, form, url) !== false){
if(typeof url == "function"){
url = url.call(this);
}
form = Ext.getDom(form)
this.transaction = Ext.Ajax.request({
form: form,
url:url,
success: this.processSuccess,
failure: this.processFailure,
scope: this,
timeout: (this.timeout*1000),
argument: {
"url": url,
"form": form,
"callback": callback,
"reset": reset
}
});
this.showLoading.defer(1, this);
}
},
refresh : function(callback){
if(this.defaultUrl == null){
return;
}
this.update(this.defaultUrl, null, callback, true);
},
startAutoRefresh : function(interval, url, params, callback, refreshNow){
if(refreshNow){
this.update(url || this.defaultUrl, params, callback, true);
}
if(this.autoRefreshProcId){
clearInterval(this.autoRefreshProcId);
}
this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);
},
stopAutoRefresh : function(){
if(this.autoRefreshProcId){
clearInterval(this.autoRefreshProcId);
delete this.autoRefreshProcId;
}
},
isAutoRefreshing : function(){
return this.autoRefreshProcId ? true : false;
},
showLoading : function(){
if(this.showLoadIndicator){
this.el.update(this.indicatorText);
}
},
prepareUrl : function(url){
if(this.disableCaching){
var append = "_dc=" + (new Date().getTime());
if(url.indexOf("?") !== -1){
url += "&" + append;
}else{
url += "?" + append;
}
}
return url;
},
processSuccess : function(response){
this.transaction = null;
if(response.argument.form && response.argument.reset){
try{
response.argument.form.reset();
}catch(e){}
}
if(this.loadScripts){
this.renderer.render(this.el, response, this,
this.updateComplete.createDelegate(this, [response]));
}else{
this.renderer.render(this.el, response, this);
this.updateComplete(response);
}
},
updateComplete : function(response){
this.fireEvent("update", this.el, response);
if(typeof response.argument.callback == "function"){
response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options);
}
},
processFailure : function(response){
this.transaction = null;
this.fireEvent("failure", this.el, response);
if(typeof response.argument.callback == "function"){
response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options);
}
},
setRenderer : function(renderer){
this.renderer = renderer;
},
getRenderer : function(){
return this.renderer;
},
setDefaultUrl : function(defaultUrl){
this.defaultUrl = defaultUrl;
},
abort : function(){
if(this.transaction){
Ext.Ajax.abort(this.transaction);
}
},
isUpdating : function(){
if(this.transaction){
return Ext.Ajax.isLoading(this.transaction);
}
return false;
}
});
Ext.Updater.defaults = {
timeout : 30,
loadScripts : false,
sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),
disableCaching : false,
showLoadIndicator : true,
indicatorText : '<div class="loading-indicator">Loading...</div>'
};
Ext.Updater.updateElement = function(el, url, params, options){
var um = Ext.get(el).getUpdater();
Ext.apply(um, options);
um.update(url, params, options ? options.callback : null);
};
Ext.Updater.update = Ext.Updater.updateElement;
Ext.Updater.BasicRenderer = function(){};
Ext.Updater.BasicRenderer.prototype = {
render : function(el, response, updateManager, callback){
el.update(response.responseText, updateManager.loadScripts, callback);
}
};
Ext.UpdateManager = Ext.Updater;
Date.parseFunctions = {count:0};
Date.parseRegexes = [];
Date.formatFunctions = {count:0};
Date.prototype.dateFormat = function(format) {
if (Date.formatFunctions[format] == null) {
Date.createNewFormat(format);
}
var func = Date.formatFunctions[format];
return this[func]();
};
Date.prototype.format = Date.prototype.dateFormat;
Date.createNewFormat = function(format) {
var funcName = "format" + Date.formatFunctions.count++;
Date.formatFunctions[format] = funcName;
var code = "Date.prototype." + funcName + " = function(){return ";
var special = false;
var ch = '';
for (var i = 0; i < format.length; ++i) {
ch = format.charAt(i);
if (!special && ch == "\\") {
special = true;
}
else if (special) {
special = false;
code += "'" + String.escape(ch) + "' + ";
}
else {
code += Date.getFormatCode(ch);
}
}
eval(code.substring(0, code.length - 3) + ";}");
};
Date.getFormatCode = function(character) {
switch (character) {
case "d":
return "String.leftPad(this.getDate(), 2, '0') + ";
case "D":
return "Date.getShortDayName(this.getDay()) + "; case "j":
return "this.getDate() + ";
case "l":
return "Date.dayNames[this.getDay()] + ";
case "N":
return "(this.getDay() ? this.getDay() : 7) + ";
case "S":
return "this.getSuffix() + ";
case "w":
return "this.getDay() + ";
case "z":
return "this.getDayOfYear() + ";
case "W":
return "String.leftPad(this.getWeekOfYear(), 2, '0') + ";
case "F":
return "Date.monthNames[this.getMonth()] + ";
case "m":
return "String.leftPad(this.getMonth() + 1, 2, '0') + ";
case "M":
return "Date.getShortMonthName(this.getMonth()) + "; case "n":
return "(this.getMonth() + 1) + ";
case "t":
return "this.getDaysInMonth() + ";
case "L":
return "(this.isLeapYear() ? 1 : 0) + ";
case "o":
return "(this.getFullYear() + (this.getWeekOfYear() == 1 && this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0))) + ";
case "Y":
return "this.getFullYear() + ";
case "y":
return "('' + this.getFullYear()).substring(2, 4) + ";
case "a":
return "(this.getHours() < 12 ? 'am' : 'pm') + ";
case "A":
return "(this.getHours() < 12 ? 'AM' : 'PM') + ";
case "g":
return "((this.getHours() % 12) ? this.getHours() % 12 : 12) + ";
case "G":
return "this.getHours() + ";
case "h":
return "String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0') + ";
case "H":
return "String.leftPad(this.getHours(), 2, '0') + ";
case "i":
return "String.leftPad(this.getMinutes(), 2, '0') + ";
case "s":
return "String.leftPad(this.getSeconds(), 2, '0') + ";
case "u":
return "String.leftPad(this.getMilliseconds(), 3, '0') + ";
case "O":
return "this.getGMTOffset() + ";
case "P":
return "this.getGMTOffset(true) + ";
case "T":
return "this.getTimezone() + ";
case "Z":
return "(this.getTimezoneOffset() * -60) + ";
case "c":
for (var df = Date.getFormatCode, c = "Y-m-dTH:i:sP", code = "", i = 0, l = c.length; i < l; ++i) {
var e = c.charAt(i);
code += e == "T" ? "'T' + " : df(e); }
return code;
case "U":
return "Math.round(this.getTime() / 1000) + ";
default:
return "'" + String.escape(character) + "' + ";
}
};
Date.parseDate = function(input, format) {
if (Date.parseFunctions[format] == null) {
Date.createParser(format);
}
var func = Date.parseFunctions[format];
return Date[func](input);
};
Date.createParser = function(format) {
var funcName = "parse" + Date.parseFunctions.count++;
var regexNum = Date.parseRegexes.length;
var currentGroup = 1;
Date.parseFunctions[format] = funcName;
var code = "Date." + funcName + " = function(input){\n"
+ "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, ms = -1, o, z, u, v;\n"
+ "input = String(input);var d = new Date();\n"
+ "y = d.getFullYear();\n"
+ "m = d.getMonth();\n"
+ "d = d.getDate();\n"
+ "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n"
+ "if (results && results.length > 0) {";
var regex = "";
var special = false;
var ch = '';
for (var i = 0; i < format.length; ++i) {
ch = format.charAt(i);
if (!special && ch == "\\") {
special = true;
}
else if (special) {
special = false;
regex += String.escape(ch);
}
else {
var obj = Date.formatCodeToRegex(ch, currentGroup);
currentGroup += obj.g;
regex += obj.s;
if (obj.g && obj.c) {
code += obj.c;
}
}
}
code += "if (u)\n"
+ "{v = new Date(u * 1000);}" + "else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0)\n"
+ "{v = new Date(y, m, d, h, i, s, ms);}\n"
+ "else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"
+ "{v = new Date(y, m, d, h, i, s);}\n"
+ "else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"
+ "{v = new Date(y, m, d, h, i);}\n"
+ "else if (y >= 0 && m >= 0 && d > 0 && h >= 0)\n"
+ "{v = new Date(y, m, d, h);}\n"
+ "else if (y >= 0 && m >= 0 && d > 0)\n"
+ "{v = new Date(y, m, d);}\n"
+ "else if (y >= 0 && m >= 0)\n"
+ "{v = new Date(y, m);}\n"
+ "else if (y >= 0)\n"
+ "{v = new Date(y);}\n"
+ "}return (v && (z || o))?\n" + " (z ? v.add(Date.SECOND, (v.getTimezoneOffset() * 60) + (z*1)) :\n" + " v.add(Date.HOUR, (v.getGMTOffset() / 100) + (o / -100))) : v\n" + ";}";
Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$", "i");
eval(code);
};
Date.formatCodeToRegex = function(character, currentGroup) {
switch (character) {
case "d":
return {g:1,
c:"d = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{2})"}; case "D":
for (var a = [], i = 0; i < 7; a.push(Date.getShortDayName(i)), ++i); return {g:0,
c:null,
s:"(?:" + a.join("|") +")"};
case "j":
return {g:1,
c:"d = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{1,2})"}; case "l":
return {g:0,
c:null,
s:"(?:" + Date.dayNames.join("|") + ")"};
case "N":
return {g:0,
c:null,
s:"[1-7]"}; case "S":
return {g:0,
c:null,
s:"(?:st|nd|rd|th)"};
case "w":
return {g:0,
c:null,
s:"[0-6]"}; case "z":
return {g:0,
c:null,
s:"(?:\\d{1,3}"}; case "W":
return {g:0,
c:null,
s:"(?:\\d{2})"}; case "F":
return {g:1,
c:"m = parseInt(Date.getMonthNumber(results[" + currentGroup + "]), 10);\n", s:"(" + Date.monthNames.join("|") + ")"};
case "m":
return {g:1,
c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n",
s:"(\\d{2})"}; case "M":
for (var a = [], i = 0; i < 12; a.push(Date.getShortMonthName(i)), ++i); return {g:1,
c:"m = parseInt(Date.getMonthNumber(results[" + currentGroup + "]), 10);\n", s:"(" + a.join("|") + ")"};
case "n":
return {g:1,
c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n",
s:"(\\d{1,2})"}; case "t":
return {g:0,
c:null,
s:"(?:\\d{2})"}; case "L":
return {g:0,
c:null,
s:"(?:1|0)"};
case "o":
case "Y":
return {g:1,
c:"y = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{4})"}; case "y":
return {g:1,
c:"var ty = parseInt(results[" + currentGroup + "], 10);\n"
+ "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",
s:"(\\d{1,2})"}; case "a":
return {g:1,
c:"if (results[" + currentGroup + "] == 'am') {\n"
+ "if (h == 12) { h = 0; }\n"
+ "} else { if (h < 12) { h += 12; }}",
s:"(am|pm)"};
case "A":
return {g:1,
c:"if (results[" + currentGroup + "] == 'AM') {\n"
+ "if (h == 12) { h = 0; }\n"
+ "} else { if (h < 12) { h += 12; }}",
s:"(AM|PM)"};
case "g":
case "G":
return {g:1,
c:"h = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{1,2})"}; case "h":
case "H":
return {g:1,
c:"h = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{2})"}; case "i":
return {g:1,
c:"i = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{2})"}; case "s":
return {g:1,
c:"s = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{2})"}; case "u":
return {g:1,
c:"ms = parseInt(results[" + currentGroup + "], 10);\n",
s:"(\\d{3})"}; case "O":
return {g:1,
c:[
"o = results[", currentGroup, "];\n",
"var sn = o.substring(0,1);\n", "var hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60);\n", "var mn = o.substring(3,5) % 60;\n", "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n", " (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"
].join(""),
s: "([+\-]\\d{4})"}; case "P":
return {g:1,
c:[
"o = results[", currentGroup, "];\n",
"var sn = o.substring(0,1);\n", "var hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60);\n", "var mn = o.substring(4,6) % 60;\n", "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n", " (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"
].join(""),
s: "([+\-]\\d{2}:\\d{2})"}; case "T":
return {g:0,
c:null,
s:"[A-Z]{1,4}"}; case "Z":
return {g:1,
c:"z = results[" + currentGroup + "] * 1;\n" + "z = (-43200 <= z && z <= 50400)? z : null;\n",
s:"([+\-]?\\d{1,5})"}; case "c":
var df = Date.formatCodeToRegex, calc = [];
var arr = [df("Y", 1), df("m", 2), df("d", 3), df("h", 4), df("i", 5), df("s", 6), df("P", 7)];
for (var i = 0, l = arr.length; i < l; ++i) {
calc.push(arr[i].c);
}
return {g:1,
c:calc.join(""),
s:arr[0].s + "-" + arr[1].s + "-" + arr[2].s + "T" + arr[3].s + ":" + arr[4].s + ":" + arr[5].s + arr[6].s};
case "U":
return {g:1,
c:"u = parseInt(results[" + currentGroup + "], 10);\n",
s:"(-?\\d+)"}; default:
return {g:0,
c:null,
s:Ext.escapeRe(character)};
}
};
Date.prototype.getTimezone = function() {
return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
};
Date.prototype.getGMTOffset = function(colon) {
return (this.getTimezoneOffset() > 0 ? "-" : "+")
+ String.leftPad(Math.abs(Math.floor(this.getTimezoneOffset() / 60)), 2, "0")
+ (colon ? ":" : "")
+ String.leftPad(this.getTimezoneOffset() % 60, 2, "0");
};
Date.prototype.getDayOfYear = function() {
var num = 0;
Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
for (var i = 0; i < this.getMonth(); ++i) {
num += Date.daysInMonth[i];
}
return num + this.getDate() - 1;
};
Date.prototype.getWeekOfYear = function() {
var ms1d = 864e5; var ms7d = 7 * ms1d; var DC3 = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate() + 3) / ms1d; var AWN = Math.floor(DC3 / 7); var Wyr = new Date(AWN * ms7d).getUTCFullYear();
return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
};
Date.prototype.isLeapYear = function() {
var year = this.getFullYear();
return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
};
Date.prototype.getFirstDayOfMonth = function() {
var day = (this.getDay() - (this.getDate() - 1)) % 7;
return (day < 0) ? (day + 7) : day;
};
Date.prototype.getLastDayOfMonth = function() {
var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7;
return (day < 0) ? (day + 7) : day;
};
Date.prototype.getFirstDateOfMonth = function() {
return new Date(this.getFullYear(), this.getMonth(), 1);
};
Date.prototype.getLastDateOfMonth = function() {
return new Date(this.getFullYear(), this.getMonth(), this.getDaysInMonth());
};
Date.prototype.getDaysInMonth = function() {
Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;
return Date.daysInMonth[this.getMonth()];
};
Date.prototype.getSuffix = function() {
switch (this.getDate()) {
case 1:
case 21:
case 31:
return "st";
case 2:
case 22:
return "nd";
case 3:
case 23:
return "rd";
default:
return "th";
}
};
Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31];
Date.monthNames =
["January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"];
Date.getShortMonthName = function(month) {
return Date.monthNames[month].substring(0, 3);
}
Date.dayNames =
["Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"];
Date.getShortDayName = function(day) {
return Date.dayNames[day].substring(0, 3);
}
Date.y2kYear = 50;
Date.monthNumbers = {
Jan:0,
Feb:1,
Mar:2,
Apr:3,
May:4,
Jun:5,
Jul:6,
Aug:7,
Sep:8,
Oct:9,
Nov:10,
Dec:11};
Date.getMonthNumber = function(name) {
return Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
}
Date.prototype.clone = function() {
return new Date(this.getTime());
};
Date.prototype.clearTime = function(clone){
if(clone){
return this.clone().clearTime();
}
this.setHours(0);
this.setMinutes(0);
this.setSeconds(0);
this.setMilliseconds(0);
return this;
};
if(Ext.isSafari){
Date.brokenSetMonth = Date.prototype.setMonth;
Date.prototype.setMonth = function(num){
if(num <= -1){
var n = Math.ceil(-num);
var back_year = Math.ceil(n/12);
var month = (n % 12) ? 12 - n % 12 : 0 ;
this.setFullYear(this.getFullYear() - back_year);
return Date.brokenSetMonth.call(this, month);
} else {
return Date.brokenSetMonth.apply(this, arguments);
}
};
}
Date.MILLI = "ms";
Date.SECOND = "s";
Date.MINUTE = "mi";
Date.HOUR = "h";
Date.DAY = "d";
Date.MONTH = "mo";
Date.YEAR = "y";
Date.prototype.add = function(interval, value){
var d = this.clone();
if (!interval || value === 0) return d;
switch(interval.toLowerCase()){
case Date.MILLI:
d.setMilliseconds(this.getMilliseconds() + value);
break;
case Date.SECOND:
d.setSeconds(this.getSeconds() + value);
break;
case Date.MINUTE:
d.setMinutes(this.getMinutes() + value);
break;
case Date.HOUR:
d.setHours(this.getHours() + value);
break;
case Date.DAY:
d.setDate(this.getDate() + value);
break;
case Date.MONTH:
var day = this.getDate();
if(day > 28){
day = Math.min(day, this.getFirstDateOfMonth().add('mo', value).getLastDateOfMonth().getDate());
}
d.setDate(day);
d.setMonth(this.getMonth() + value);
break;
case Date.YEAR:
d.setFullYear(this.getFullYear() + value);
break;
}
return d;
};
Date.prototype.between = function(start, end){
var t = this.getTime();
return start.getTime() <= t && t <= end.getTime();
}
Ext.util.DelayedTask = function(fn, scope, args){
var id = null, d, t;
var call = function(){
var now = new Date().getTime();
if(now - t >= d){
clearInterval(id);
id = null;
fn.apply(scope, args || []);
}
};
this.delay = function(delay, newFn, newScope, newArgs){
if(id && delay != d){
this.cancel();
}
d = delay;
t = new Date().getTime();
fn = newFn || fn;
scope = newScope || scope;
args = newArgs || args;
if(!id){
id = setInterval(call, d);
}
};
this.cancel = function(){
if(id){
clearInterval(id);
id = null;
}
};
};
Ext.util.TaskRunner = function(interval){
interval = interval || 10;
var tasks = [], removeQueue = [];
var id = 0;
var running = false;
var stopThread = function(){
running = false;
clearInterval(id);
id = 0;
};
var startThread = function(){
if(!running){
running = true;
id = setInterval(runTasks, interval);
}
};
var removeTask = function(t){
removeQueue.push(t);
if(t.onStop){
t.onStop.apply(t.scope || t);
}
};
var runTasks = function(){
if(removeQueue.length > 0){
for(var i = 0, len = removeQueue.length; i < len; i++){
tasks.remove(removeQueue[i]);
}
removeQueue = [];
if(tasks.length < 1){
stopThread();
return;
}
}
var now = new Date().getTime();
for(var i = 0, len = tasks.length; i < len; ++i){
var t = tasks[i];
var itime = now - t.taskRunTime;
if(t.interval <= itime){
var rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);
t.taskRunTime = now;
if(rt === false || t.taskRunCount === t.repeat){
removeTask(t);
return;
}
}
if(t.duration && t.duration <= (now - t.taskStartTime)){
removeTask(t);
}
}
};
this.start = function(task){
tasks.push(task);
task.taskStartTime = new Date().getTime();
task.taskRunTime = 0;
task.taskRunCount = 0;
startThread();
return task;
};
this.stop = function(task){
removeTask(task);
return task;
};
this.stopAll = function(){
stopThread();
for(var i = 0, len = tasks.length; i < len; i++){
if(tasks[i].onStop){
tasks[i].onStop();
}
}
tasks = [];
removeQueue = [];
};
};
Ext.TaskMgr = new Ext.util.TaskRunner();
Ext.util.MixedCollection = function(allowFunctions, keyFn){
this.items = [];
this.map = {};
this.keys = [];
this.length = 0;
this.addEvents(
"clear",
"add",
"replace",
"remove",
"sort"
);
this.allowFunctions = allowFunctions === true;
if(keyFn){
this.getKey = keyFn;
}
Ext.util.MixedCollection.superclass.constructor.call(this);
};
Ext.extend(Ext.util.MixedCollection, Ext.util.Observable, {
allowFunctions : false,
add : function(key, o){
if(arguments.length == 1){
o = arguments[0];
key = this.getKey(o);
}
if(typeof key == "undefined" || key === null){
this.length++;
this.items.push(o);
this.keys.push(null);
}else{
var old = this.map[key];
if(old){
return this.replace(key, o);
}
this.length++;
this.items.push(o);
this.map[key] = o;
this.keys.push(key);
}
this.fireEvent("add", this.length-1, o, key);
return o;
},
getKey : function(o){
return o.id;
},
replace : function(key, o){
if(arguments.length == 1){
o = arguments[0];
key = this.getKey(o);
}
var old = this.item(key);
if(typeof key == "undefined" || key === null || typeof old == "undefined"){
return this.add(key, o);
}
var index = this.indexOfKey(key);
this.items[index] = o;
this.map[key] = o;
this.fireEvent("replace", key, old, o);
return o;
},
addAll : function(objs){
if(arguments.length > 1 || Ext.isArray(objs)){
var args = arguments.length > 1 ? arguments : objs;
for(var i = 0, len = args.length; i < len; i++){
this.add(args[i]);
}
}else{
for(var key in objs){
if(this.allowFunctions || typeof objs[key] != "function"){
this.add(key, objs[key]);
}
}
}
},
each : function(fn, scope){
var items = [].concat(this.items);
for(var i = 0, len = items.length; i < len; i++){
if(fn.call(scope || items[i], items[i], i, len) === false){
break;
}
}
},
eachKey : function(fn, scope){
for(var i = 0, len = this.keys.length; i < len; i++){
fn.call(scope || window, this.keys[i], this.items[i], i, len);
}
},
find : function(fn, scope){
for(var i = 0, len = this.items.length; i < len; i++){
if(fn.call(scope || window, this.items[i], this.keys[i])){
return this.items[i];
}
}
return null;
},
insert : function(index, key, o){
if(arguments.length == 2){
o = arguments[1];
key = this.getKey(o);
}
if(index >= this.length){
return this.add(key, o);
}
this.length++;
this.items.splice(index, 0, o);
if(typeof key != "undefined" && key != null){
this.map[key] = o;
}
this.keys.splice(index, 0, key);
this.fireEvent("add", index, o, key);
return o;
},
remove : function(o){
return this.removeAt(this.indexOf(o));
},
removeAt : function(index){
if(index < this.length && index >= 0){
this.length--;
var o = this.items[index];
this.items.splice(index, 1);
var key = this.keys[index];
if(typeof key != "undefined"){
delete this.map[key];
}
this.keys.splice(index, 1);
this.fireEvent("remove", o, key);
return o;
}
return false;
},
removeKey : function(key){
return this.removeAt(this.indexOfKey(key));
},
getCount : function(){
return this.length;
},
indexOf : function(o){
return this.items.indexOf(o);
},
indexOfKey : function(key){
return this.keys.indexOf(key);
},
item : function(key){
var item = typeof this.map[key] != "undefined" ? this.map[key] : this.items[key];
return typeof item != 'function' || this.allowFunctions ? item : null;
},
itemAt : function(index){
return this.items[index];
},
key : function(key){
return this.map[key];
},
contains : function(o){
return this.indexOf(o) != -1;
},
containsKey : function(key){
return typeof this.map[key] != "undefined";
},
clear : function(){
this.length = 0;
this.items = [];
this.keys = [];
this.map = {};
this.fireEvent("clear");
},
first : function(){
return this.items[0];
},
last : function(){
return this.items[this.length-1];
},
_sort : function(property, dir, fn){
var dsc = String(dir).toUpperCase() == "DESC" ? -1 : 1;
fn = fn || function(a, b){
return a-b;
};
var c = [], k = this.keys, items = this.items;
for(var i = 0, len = items.length; i < len; i++){
c[c.length] = {key: k[i], value: items[i], index: i};
}
c.sort(function(a, b){
var v = fn(a[property], b[property]) * dsc;
if(v == 0){
v = (a.index < b.index ? -1 : 1);
}
return v;
});
for(var i = 0, len = c.length; i < len; i++){
items[i] = c[i].value;
k[i] = c[i].key;
}
this.fireEvent("sort", this);
},
sort : function(dir, fn){
this._sort("value", dir, fn);
},
keySort : function(dir, fn){
this._sort("key", dir, fn || function(a, b){
return String(a).toUpperCase()-String(b).toUpperCase();
});
},
getRange : function(start, end){
var items = this.items;
if(items.length < 1){
return [];
}
start = start || 0;
end = Math.min(typeof end == "undefined" ? this.length-1 : end, this.length-1);
var r = [];
if(start <= end){
for(var i = start; i <= end; i++) {
r[r.length] = items[i];
}
}else{
for(var i = start; i >= end; i--) {
r[r.length] = items[i];
}
}
return r;
},
filter : function(property, value, anyMatch, caseSensitive){
if(Ext.isEmpty(value, false)){
return this.clone();
}
value = this.createValueMatcher(value, anyMatch, caseSensitive);
return this.filterBy(function(o){
return o && value.test(o[property]);
});
},
filterBy : function(fn, scope){
var r = new Ext.util.MixedCollection();
r.getKey = this.getKey;
var k = this.keys, it = this.items;
for(var i = 0, len = it.length; i < len; i++){
if(fn.call(scope||this, it[i], k[i])){
r.add(k[i], it[i]);
}
}
return r;
},
findIndex : function(property, value, start, anyMatch, caseSensitive){
if(Ext.isEmpty(value, false)){
return -1;
}
value = this.createValueMatcher(value, anyMatch, caseSensitive);
return this.findIndexBy(function(o){
return o && value.test(o[property]);
}, null, start);
},
findIndexBy : function(fn, scope, start){
var k = this.keys, it = this.items;
for(var i = (start||0), len = it.length; i < len; i++){
if(fn.call(scope||this, it[i], k[i])){
return i;
}
}
if(typeof start == 'number' && start > 0){
for(var i = 0; i < start; i++){
if(fn.call(scope||this, it[i], k[i])){
return i;
}
}
}
return -1;
},
createValueMatcher : function(value, anyMatch, caseSensitive){
if(!value.exec){
value = String(value);
value = new RegExp((anyMatch === true ? '' : '^') + Ext.escapeRe(value), caseSensitive ? '' : 'i');
}
return value;
},
clone : function(){
var r = new Ext.util.MixedCollection();
var k = this.keys, it = this.items;
for(var i = 0, len = it.length; i < len; i++){
r.add(k[i], it[i]);
}
r.getKey = this.getKey;
return r;
}
});
Ext.util.MixedCollection.prototype.get = Ext.util.MixedCollection.prototype.item;
Ext.util.JSON = new (function(){
var useHasOwn = {}.hasOwnProperty ? true : false;
var pad = function(n) {
return n < 10 ? "0" + n : n;
};
var m = {
"\b": '\\b',
"\t": '\\t',
"\n": '\\n',
"\f": '\\f',
"\r": '\\r',
'"' : '\\"',
"\\": '\\\\'
};
var 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 + '"';
};
var 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("");
};
var encodeDate = function(o){
return '"' + o.getFullYear() + "-" +
pad(o.getMonth() + 1) + "-" +
pad(o.getDate()) + "T" +
pad(o.getHours()) + ":" +
pad(o.getMinutes()) + ":" +
pad(o.getSeconds()) + '"';
};
this.encode = function(o){
if(typeof o == "undefined" || o === null){
return "null";
}else if(Ext.isArray(o)){
return encodeArray(o);
}else if(Ext.isDate(o)){
return encodeDate(o);
}else if(typeof o == "string"){
return encodeString(o);
}else if(typeof o == "number"){
return isFinite(o) ? String(o) : "null";
}else if(typeof o == "boolean"){
return String(o);
}else {
var a = ["{"], b, i, v;
for (i in o) {
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(this.encode(i), ":",
v === null ? "null" : this.encode(v));
b = true;
}
}
}
a.push("}");
return a.join("");
}
};
this.decode = function(json){
return eval("(" + json + ')');
};
})();
Ext.encode = Ext.util.JSON.encode;
Ext.decode = Ext.util.JSON.decode;
Ext.util.Format = function(){
var trimRe = /^\s+|\s+$/g;
return {
ellipsis : function(value, len){
if(value && value.length > len){
return value.substr(0, len-3)+"...";
}
return value;
},
undef : function(value){
return value !== undefined ? value : "";
},
defaultValue : function(value, defaultValue){
return value !== undefined && value !== '' ? value : defaultValue;
},
htmlEncode : function(value){
return !value ? value : String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
},
htmlDecode : function(value){
return !value ? value : String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, '"');
},
trim : function(value){
return String(value).replace(trimRe, "");
},
substr : function(value, start, length){
return String(value).substr(start, length);
},
lowercase : function(value){
return String(value).toLowerCase();
},
uppercase : function(value){
return String(value).toUpperCase();
},
capitalize : function(value){
return !value ? value : value.charAt(0).toUpperCase() + value.substr(1).toLowerCase();
},
call : function(value, fn){
if(arguments.length > 2){
var args = Array.prototype.slice.call(arguments, 2);
args.unshift(value);
return eval(fn).apply(window, args);
}else{
return eval(fn).call(window, value);
}
},
usMoney : function(v){
v = (Math.round((v-0)*100))/100;
v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v);
v = String(v);
var ps = v.split('.');
var whole = ps[0];
var sub = ps[1] ? '.'+ ps[1] : '.00';
var r = /(\d+)(\d{3})/;
while (r.test(whole)) {
whole = whole.replace(r, '$1' + ',' + '$2');
}
v = whole + sub;
if(v.charAt(0) == '-'){
return '-$' + v.substr(1);
}
return "$" + v;
},
date : function(v, format){
if(!v){
return "";
}
if(!Ext.isDate(v)){
v = new Date(Date.parse(v));
}
return v.dateFormat(format || "m/d/Y");
},
dateRenderer : function(format){
return function(v){
return Ext.util.Format.date(v, format);
};
},
stripTagsRE : /<\/?[^>]+>/gi,
stripTags : function(v){
return !v ? v : String(v).replace(this.stripTagsRE, "");
},
stripScriptsRe : /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,
stripScripts : function(v){
return !v ? v : String(v).replace(this.stripScriptsRe, "");
},
fileSize : function(size){
if(size < 1024) {
return size + " bytes";
} else if(size < 1048576) {
return (Math.round(((size*10) / 1024))/10) + " KB";
} else {
return (Math.round(((size*10) / 1048576))/10) + " MB";
}
},
math : function(){
var fns = {};
return function(v, a){
if(!fns[a]){
fns[a] = new Function('v', 'return v ' + a + ';');
}
return fns[a](v);
}
}()
};
}();
Ext.XTemplate = function(){
Ext.XTemplate.superclass.constructor.apply(this, arguments);
var s = this.html;
s = ['<tpl>', s, '</tpl>'].join('');
var re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;
var nameRe = /^<tpl\b[^>]*?for="(.*?)"/;
var ifRe = /^<tpl\b[^>]*?if="(.*?)"/;
var execRe = /^<tpl\b[^>]*?exec="(.*?)"/;
var m, id = 0;
var tpls = [];
while(m = s.match(re)){
var m2 = m[0].match(nameRe);
var m3 = m[0].match(ifRe);
var m4 = m[0].match(execRe);
var exp = null, fn = null, exec = null;
var name = m2 && m2[1] ? m2[1] : '';
if(m3){
exp = m3 && m3[1] ? m3[1] : null;
if(exp){
fn = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ return '+(Ext.util.Format.htmlDecode(exp))+'; }');
}
}
if(m4){
exp = m4 && m4[1] ? m4[1] : null;
if(exp){
exec = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ '+(Ext.util.Format.htmlDecode(exp))+'; }');
}
}
if(name){
switch(name){
case '.': name = new Function('values', 'parent', 'with(values){ return values; }'); break;
case '..': name = new Function('values', 'parent', 'with(values){ return parent; }'); break;
default: name = new Function('values', 'parent', 'with(values){ return '+name+'; }');
}
}
tpls.push({
id: id,
target: name,
exec: exec,
test: fn,
body: m[1]||''
});
s = s.replace(m[0], '{xtpl'+ id + '}');
++id;
}
for(var i = tpls.length-1; i >= 0; --i){
this.compileTpl(tpls[i]);
}
this.master = tpls[tpls.length-1];
this.tpls = tpls;
};
Ext.extend(Ext.XTemplate, Ext.Template, {
re : /\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,
codeRe : /\{\[((?:\\\]|.|\n)*?)\]\}/g,
applySubTemplate : function(id, values, parent, xindex, xcount){
var t = this.tpls[id];
if(t.test && !t.test.call(this, values, parent, xindex, xcount)){
return '';
}
if(t.exec && t.exec.call(this, values, parent, xindex, xcount)){
return '';
}
var vs = t.target ? t.target.call(this, values, parent) : values;
parent = t.target ? values : parent;
if(t.target && Ext.isArray(vs)){
var buf = [];
for(var i = 0, len = vs.length; i < len; i++){
buf[buf.length] = t.compiled.call(this, vs[i], parent, i+1, len);
}
return buf.join('');
}
return t.compiled.call(this, vs, parent, xindex, xcount);
},
compileTpl : function(tpl){
var fm = Ext.util.Format;
var useF = this.disableFormats !== true;
var sep = Ext.isGecko ? "+" : ",";
var fn = function(m, name, format, args, math){
if(name.substr(0, 4) == 'xtpl'){
return "'"+ sep +'this.applySubTemplate('+name.substr(4)+', values, parent, xindex, xcount)'+sep+"'";
}
var v;
if(name === '.'){
v = 'values';
}else if(name === '#'){
v = 'xindex';
}else if(name.indexOf('.') != -1){
v = name;
}else{
v = "values['" + name + "']";
}
if(math){
v = '(' + v + math + ')';
}
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 = "("+v+" === undefined ? '' : ";
}
return "'"+ sep + format + v + args + ")"+sep+"'";
};
var codeFn = function(m, code){
return "'"+ sep +'('+code+')'+sep+"'";
};
var body;
if(Ext.isGecko){
body = "tpl.compiled = function(values, parent, xindex, xcount){ return '" +
tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn) +
"';};";
}else{
body = ["tpl.compiled = function(values, parent, xindex, xcount){ return ['"];
body.push(tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn));
body.push("'].join('');};");
body = body.join('');
}
eval(body);
return this;
},
apply : function(values){
return this.master.compiled.call(this, values, {}, 1, 1);
},
applyTemplate : function(values){
return this.master.compiled.call(this, values, {}, 1, 1);
},
compile : function(){return this;}
});
Ext.XTemplate.from = function(el){
el = Ext.getDom(el);
return new Ext.XTemplate(el.value || el.innerHTML);
};
Ext.util.CSS = function(){
var rules = null;
var doc = document;
var camelRe = /(-[a-z])/gi;
var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
return {
createStyleSheet : function(cssText, id){
var ss;
var head = doc.getElementsByTagName("head")[0];
var rules = doc.createElement("style");
rules.setAttribute("type", "text/css");
if(id){
rules.setAttribute("id", id);
}
if(Ext.isIE){
head.appendChild(rules);
ss = rules.styleSheet;
ss.cssText = cssText;
}else{
try{
rules.appendChild(doc.createTextNode(cssText));
}catch(e){
rules.cssText = cssText;
}
head.appendChild(rules);
ss = rules.styleSheet ? rules.styleSheet : (rules.sheet || doc.styleSheets[doc.styleSheets.length-1]);
}
this.cacheStyleSheet(ss);
return ss;
},
removeStyleSheet : function(id){
var existing = doc.getElementById(id);
if(existing){
existing.parentNode.removeChild(existing);
}
},
swapStyleSheet : function(id, url){
this.removeStyleSheet(id);
var ss = doc.createElement("link");
ss.setAttribute("rel", "stylesheet");
ss.setAttribute("type", "text/css");
ss.setAttribute("id", id);
ss.setAttribute("href", url);
doc.getElementsByTagName("head")[0].appendChild(ss);
},
refreshCache : function(){
return this.getRules(true);
},
cacheStyleSheet : function(ss){
if(!rules){
rules = {};
}
try{
var ssRules = ss.cssRules || ss.rules;
for(var j = ssRules.length-1; j >= 0; --j){
rules[ssRules[j].selectorText] = ssRules[j];
}
}catch(e){}
},
getRules : function(refreshCache){
if(rules == null || refreshCache){
rules = {};
var ds = doc.styleSheets;
for(var i =0, len = ds.length; i < len; i++){
try{
this.cacheStyleSheet(ds[i]);
}catch(e){}
}
}
return rules;
},
getRule : function(selector, refreshCache){
var rs = this.getRules(refreshCache);
if(!Ext.isArray(selector)){
return rs[selector];
}
for(var i = 0; i < selector.length; i++){
if(rs[selector[i]]){
return rs[selector[i]];
}
}
return null;
},
updateRule : function(selector, property, value){
if(!Ext.isArray(selector)){
var rule = this.getRule(selector);
if(rule){
rule.style[property.replace(camelRe, camelFn)] = value;
return true;
}
}else{
for(var i = 0; i < selector.length; i++){
if(this.updateRule(selector[i], property, value)){
return true;
}
}
}
return false;
}
};
}();
Ext.util.ClickRepeater = function(el, config)
{
this.el = Ext.get(el);
this.el.unselectable();
Ext.apply(this, config);
this.addEvents(
"mousedown",
"click",
"mouseup"
);
this.el.on("mousedown", this.handleMouseDown, this);
if(this.preventDefault || this.stopDefault){
this.el.on("click", function(e){
if(this.preventDefault){
e.preventDefault();
}
if(this.stopDefault){
e.stopEvent();
}
}, this);
}
if(this.handler){
this.on("click", this.handler, this.scope || this);
}
Ext.util.ClickRepeater.superclass.constructor.call(this);
};
Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, {
interval : 20,
delay: 250,
preventDefault : true,
stopDefault : false,
timer : 0,
handleMouseDown : function(){
clearTimeout(this.timer);
this.el.blur();
if(this.pressClass){
this.el.addClass(this.pressClass);
}
this.mousedownTime = new Date();
Ext.getDoc().on("mouseup", this.handleMouseUp, this);
this.el.on("mouseout", this.handleMouseOut, this);
this.fireEvent("mousedown", this);
this.fireEvent("click", this);
if (this.accelerate) {
this.delay = 400;
}
this.timer = this.click.defer(this.delay || this.interval, this);
},
click : function(){
this.fireEvent("click", this);
this.timer = this.click.defer(this.accelerate ?
this.easeOutExpo(this.mousedownTime.getElapsed(),
400,
-390,
12000) :
this.interval, this);
},
easeOutExpo : function (t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
handleMouseOut : function(){
clearTimeout(this.timer);
if(this.pressClass){
this.el.removeClass(this.pressClass);
}
this.el.on("mouseover", this.handleMouseReturn, this);
},
handleMouseReturn : function(){
this.el.un("mouseover", this.handleMouseReturn);
if(this.pressClass){
this.el.addClass(this.pressClass);
}
this.click();
},
handleMouseUp : function(){
clearTimeout(this.timer);
this.el.un("mouseover", this.handleMouseReturn);
this.el.un("mouseout", this.handleMouseOut);
Ext.getDoc().un("mouseup", this.handleMouseUp);
this.el.removeClass(this.pressClass);
this.fireEvent("mouseup", this);
}
});
Ext.KeyNav = function(el, config){
this.el = Ext.get(el);
Ext.apply(this, config);
if(!this.disabled){
this.disabled = true;
this.enable();
}
};
Ext.KeyNav.prototype = {
disabled : false,
defaultEventAction: "stopEvent",
forceKeyDown : false,
prepareEvent : function(e){
var k = e.getKey();
var h = this.keyToHandler[k];
if(Ext.isSafari && h && k >= 37 && k <= 40){
e.stopEvent();
}
},
relay : function(e){
var k = e.getKey();
var h = this.keyToHandler[k];
if(h && this[h]){
if(this.doRelay(e, this[h], h) !== true){
e[this.defaultEventAction]();
}
}
},
doRelay : function(e, h, hname){
return h.call(this.scope || this, e);
},
enter : false,
left : false,
right : false,
up : false,
down : false,
tab : false,
esc : false,
pageUp : false,
pageDown : false,
del : false,
home : false,
end : false,
keyToHandler : {
37 : "left",
39 : "right",
38 : "up",
40 : "down",
33 : "pageUp",
34 : "pageDown",
46 : "del",
36 : "home",
35 : "end",
13 : "enter",
27 : "esc",
9 : "tab"
},
enable: function(){
if(this.disabled){
if(this.forceKeyDown || Ext.isIE || Ext.isAir){
this.el.on("keydown", this.relay, this);
}else{
this.el.on("keydown", this.prepareEvent, this);
this.el.on("keypress", this.relay, this);
}
this.disabled = false;
}
},
disable: function(){
if(!this.disabled){
if(this.forceKeyDown || Ext.isIE || Ext.isAir){
this.el.un("keydown", this.relay);
}else{
this.el.un("keydown", this.prepareEvent);
this.el.un("keypress", this.relay);
}
this.disabled = true;
}
}
};
Ext.KeyMap = function(el, config, eventName){
this.el = Ext.get(el);
this.eventName = eventName || "keydown";
this.bindings = [];
if(config){
this.addBinding(config);
}
this.enable();
};
Ext.KeyMap.prototype = {
stopEvent : false,
addBinding : function(config){
if(Ext.isArray(config)){
for(var i = 0, len = config.length; i < len; i++){
this.addBinding(config[i]);
}
return;
}
var keyCode = config.key,
shift = config.shift,
ctrl = config.ctrl,
alt = config.alt,
fn = config.fn || config.handler,
scope = config.scope;
if(typeof keyCode == "string"){
var ks = [];
var keyString = keyCode.toUpperCase();
for(var j = 0, len = keyString.length; j < len; j++){
ks.push(keyString.charCodeAt(j));
}
keyCode = ks;
}
var keyArray = Ext.isArray(keyCode);
var handler = function(e){
if((!shift || e.shiftKey) && (!ctrl || e.ctrlKey) && (!alt || e.altKey)){
var k = e.getKey();
if(keyArray){
for(var i = 0, len = keyCode.length; i < len; i++){
if(keyCode[i] == k){
if(this.stopEvent){
e.stopEvent();
}
fn.call(scope || window, k, e);
return;
}
}
}else{
if(k == keyCode){
if(this.stopEvent){
e.stopEvent();
}
fn.call(scope || window, k, e);
}
}
}
};
this.bindings.push(handler);
},
on : function(key, fn, scope){
var keyCode, shift, ctrl, alt;
if(typeof key == "object" && !Ext.isArray(key)){
keyCode = key.key;
shift = key.shift;
ctrl = key.ctrl;
alt = key.alt;
}else{
keyCode = key;
}
this.addBinding({
key: keyCode,
shift: shift,
ctrl: ctrl,
alt: alt,
fn: fn,
scope: scope
})
},
handleKeyDown : function(e){
if(this.enabled){
var b = this.bindings;
for(var i = 0, len = b.length; i < len; i++){
b[i].call(this, e);
}
}
},
isEnabled : function(){
return this.enabled;
},
enable: function(){
if(!this.enabled){
this.el.on(this.eventName, this.handleKeyDown, this);
this.enabled = true;
}
},
disable: function(){
if(this.enabled){
this.el.removeListener(this.eventName, this.handleKeyDown, this);
this.enabled = false;
}
}
};
Ext.util.TextMetrics = function(){
var shared;
return {
measure : function(el, text, fixedWidth){
if(!shared){
shared = Ext.util.TextMetrics.Instance(el, fixedWidth);
}
shared.bind(el);
shared.setFixedWidth(fixedWidth || 'auto');
return shared.getSize(text);
},
createInstance : function(el, fixedWidth){
return Ext.util.TextMetrics.Instance(el, fixedWidth);
}
};
}();
Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){
var ml = new Ext.Element(document.createElement('div'));
document.body.appendChild(ml.dom);
ml.position('absolute');
ml.setLeftTop(-1000, -1000);
ml.hide();
if(fixedWidth){
ml.setWidth(fixedWidth);
}
var instance = {
getSize : function(text){
ml.update(text);
var s = ml.getSize();
ml.update('');
return s;
},
bind : function(el){
ml.setStyle(
Ext.fly(el).getStyles('font-size','font-style', 'font-weight', 'font-family','line-height')
);
},
setFixedWidth : function(width){
ml.setWidth(width);
},
getWidth : function(text){
ml.dom.style.width = 'auto';
return this.getSize(text).width;
},
getHeight : function(text){
return this.getSize(text).height;
}
};
instance.bind(bindTo);
return instance;
};
Ext.Element.measureText = Ext.util.TextMetrics.measure;
(function() {
var Event=Ext.EventManager;
var Dom=Ext.lib.Dom;
Ext.dd.DragDrop = function(id, sGroup, config) {
if(id) {
this.init(id, sGroup, config);
}
};
Ext.dd.DragDrop.prototype = {
id: null,
config: null,
dragElId: null,
handleElId: null,
invalidHandleTypes: null,
invalidHandleIds: null,
invalidHandleClasses: null,
startPageX: 0,
startPageY: 0,
groups: null,
locked: false,
lock: function() { this.locked = true; },
unlock: function() { this.locked = false; },
isTarget: true,
padding: null,
_domRef: null,
__ygDragDrop: true,
constrainX: false,
constrainY: false,
minX: 0,
maxX: 0,
minY: 0,
maxY: 0,
maintainOffset: false,
xTicks: null,
yTicks: null,
primaryButtonOnly: true,
available: false,
hasOuterHandles: false,
b4StartDrag: function(x, y) { },
startDrag: function(x, y) { },
b4Drag: function(e) { },
onDrag: function(e) { },
onDragEnter: function(e, id) { },
b4DragOver: function(e) { },
onDragOver: function(e, id) { },
b4DragOut: function(e) { },
onDragOut: function(e, id) { },
b4DragDrop: function(e) { },
onDragDrop: function(e, id) { },
onInvalidDrop: function(e) { },
b4EndDrag: function(e) { },
endDrag: function(e) { },
b4MouseDown: function(e) { },
onMouseDown: function(e) { },
onMouseUp: function(e) { },
onAvailable: function () {
},
defaultPadding : {left:0, right:0, top:0, bottom:0},
constrainTo : function(constrainTo, pad, inContent){
if(typeof pad == "number"){
pad = {left: pad, right:pad, top:pad, bottom:pad};
}
pad = pad || this.defaultPadding;
var b = Ext.get(this.getEl()).getBox();
var ce = Ext.get(constrainTo);
var s = ce.getScroll();
var c, cd = ce.dom;
if(cd == document.body){
c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
}else{
var xy = ce.getXY();
c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};
}
var topSpace = b.y - c.y;
var leftSpace = b.x - c.x;
this.resetConstraints();
this.setXConstraint(leftSpace - (pad.left||0),
c.width - leftSpace - b.width - (pad.right||0),
this.xTickSize
);
this.setYConstraint(topSpace - (pad.top||0),
c.height - topSpace - b.height - (pad.bottom||0),
this.yTickSize
);
},
getEl: function() {
if (!this._domRef) {
this._domRef = Ext.getDom(this.id);
}
return this._domRef;
},
getDragEl: function() {
return Ext.getDom(this.dragElId);
},
init: function(id, sGroup, config) {
this.initTarget(id, sGroup, config);
Event.on(this.id, "mousedown", this.handleMouseDown, this);
},
initTarget: function(id, sGroup, config) {
this.config = config || {};
this.DDM = Ext.dd.DDM;
this.groups = {};
if (typeof id !== "string") {
id = Ext.id(id);
}
this.id = id;
this.addToGroup((sGroup) ? sGroup : "default");
this.handleElId = id;
this.setDragElId(id);
this.invalidHandleTypes = { A: "A" };
this.invalidHandleIds = {};
this.invalidHandleClasses = [];
this.applyConfig();
this.handleOnAvailable();
},
applyConfig: function() {
this.padding = this.config.padding || [0, 0, 0, 0];
this.isTarget = (this.config.isTarget !== false);
this.maintainOffset = (this.config.maintainOffset);
this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
},
handleOnAvailable: function() {
this.available = true;
this.resetConstraints();
this.onAvailable();
},
setPadding: function(iTop, iRight, iBot, iLeft) {
if (!iRight && 0 !== iRight) {
this.padding = [iTop, iTop, iTop, iTop];
} else if (!iBot && 0 !== iBot) {
this.padding = [iTop, iRight, iTop, iRight];
} else {
this.padding = [iTop, iRight, iBot, iLeft];
}
},
setInitPosition: function(diffX, diffY) {
var el = this.getEl();
if (!this.DDM.verifyEl(el)) {
return;
}
var dx = diffX || 0;
var dy = diffY || 0;
var p = Dom.getXY( el );
this.initPageX = p[0] - dx;
this.initPageY = p[1] - dy;
this.lastPageX = p[0];
this.lastPageY = p[1];
this.setStartPosition(p);
},
setStartPosition: function(pos) {
var p = pos || Dom.getXY( this.getEl() );
this.deltaSetXY = null;
this.startPageX = p[0];
this.startPageY = p[1];
},
addToGroup: function(sGroup) {
this.groups[sGroup] = true;
this.DDM.regDragDrop(this, sGroup);
},
removeFromGroup: function(sGroup) {
if (this.groups[sGroup]) {
delete this.groups[sGroup];
}
this.DDM.removeDDFromGroup(this, sGroup);
},
setDragElId: function(id) {
this.dragElId = id;
},
setHandleElId: function(id) {
if (typeof id !== "string") {
id = Ext.id(id);
}
this.handleElId = id;
this.DDM.regHandle(this.id, id);
},
setOuterHandleElId: function(id) {
if (typeof id !== "string") {
id = Ext.id(id);
}
Event.on(id, "mousedown",
this.handleMouseDown, this);
this.setHandleElId(id);
this.hasOuterHandles = true;
},
unreg: function() {
Event.un(this.id, "mousedown",
this.handleMouseDown);
this._domRef = null;
this.DDM._remove(this);
},
destroy : function(){
this.unreg();
},
isLocked: function() {
return (this.DDM.isLocked() || this.locked);
},
handleMouseDown: function(e, oDD){
if (this.primaryButtonOnly && e.button != 0) {
return;
}
if (this.isLocked()) {
return;
}
this.DDM.refreshCache(this.groups);
var pt = new Ext.lib.Point(Ext.lib.Event.getPageX(e), Ext.lib.Event.getPageY(e));
if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
} else {
if (this.clickValidator(e)) {
this.setStartPosition();
this.b4MouseDown(e);
this.onMouseDown(e);
this.DDM.handleMouseDown(e, this);
this.DDM.stopEvent(e);
} else {
}
}
},
clickValidator: function(e) {
var target = e.getTarget();
return ( this.isValidHandleChild(target) &&
(this.id == this.handleElId ||
this.DDM.handleWasClicked(target, this.id)) );
},
addInvalidHandleType: function(tagName) {
var type = tagName.toUpperCase();
this.invalidHandleTypes[type] = type;
},
addInvalidHandleId: function(id) {
if (typeof id !== "string") {
id = Ext.id(id);
}
this.invalidHandleIds[id] = id;
},
addInvalidHandleClass: function(cssClass) {
this.invalidHandleClasses.push(cssClass);
},
removeInvalidHandleType: function(tagName) {
var type = tagName.toUpperCase();
delete this.invalidHandleTypes[type];
},
removeInvalidHandleId: function(id) {
if (typeof id !== "string") {
id = Ext.id(id);
}
delete this.invalidHandleIds[id];
},
removeInvalidHandleClass: function(cssClass) {
for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
if (this.invalidHandleClasses[i] == cssClass) {
delete this.invalidHandleClasses[i];
}
}
},
isValidHandleChild: function(node) {
var valid = true;
var nodeName;
try {
nodeName = node.nodeName.toUpperCase();
} catch(e) {
nodeName = node.nodeName;
}
valid = valid && !this.invalidHandleTypes[nodeName];
valid = valid && !this.invalidHandleIds[node.id];
for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
valid = !Dom.hasClass(node, this.invalidHandleClasses[i]);
}
return valid;
},
setXTicks: function(iStartX, iTickSize) {
this.xTicks = [];
this.xTickSize = iTickSize;
var tickMap = {};
for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
if (!tickMap[i]) {
this.xTicks[this.xTicks.length] = i;
tickMap[i] = true;
}
}
for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
if (!tickMap[i]) {
this.xTicks[this.xTicks.length] = i;
tickMap[i] = true;
}
}
this.xTicks.sort(this.DDM.numericSort) ;
},
setYTicks: function(iStartY, iTickSize) {
this.yTicks = [];
this.yTickSize = iTickSize;
var tickMap = {};
for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
if (!tickMap[i]) {
this.yTicks[this.yTicks.length] = i;
tickMap[i] = true;
}
}
for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
if (!tickMap[i]) {
this.yTicks[this.yTicks.length] = i;
tickMap[i] = true;
}
}
this.yTicks.sort(this.DDM.numericSort) ;
},
setXConstraint: function(iLeft, iRight, iTickSize) {
this.leftConstraint = iLeft;
this.rightConstraint = iRight;
this.minX = this.initPageX - iLeft;
this.maxX = this.initPageX + iRight;
if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
this.constrainX = true;
},
clearConstraints: function() {
this.constrainX = false;
this.constrainY = false;
this.clearTicks();
},
clearTicks: function() {
this.xTicks = null;
this.yTicks = null;
this.xTickSize = 0;
this.yTickSize = 0;
},
setYConstraint: function(iUp, iDown, iTickSize) {
this.topConstraint = iUp;
this.bottomConstraint = iDown;
this.minY = this.initPageY - iUp;
this.maxY = this.initPageY + iDown;
if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
this.constrainY = true;
},
resetConstraints: function() {
if (this.initPageX || this.initPageX === 0) {
var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
this.setInitPosition(dx, dy);
} else {
this.setInitPosition();
}
if (this.constrainX) {
this.setXConstraint( this.leftConstraint,
this.rightConstraint,
this.xTickSize );
}
if (this.constrainY) {
this.setYConstraint( this.topConstraint,
this.bottomConstraint,
this.yTickSize );
}
},
getTick: function(val, tickArray) {
if (!tickArray) {
return val;
} else if (tickArray[0] >= val) {
return tickArray[0];
} else {
for (var i=0, len=tickArray.length; i<len; ++i) {
var next = i + 1;
if (tickArray[next] && tickArray[next] >= val) {
var diff1 = val - tickArray[i];
var diff2 = tickArray[next] - val;
return (diff2 > diff1) ? tickArray[i] : tickArray[next];
}
}
return tickArray[tickArray.length - 1];
}
},
toString: function() {
return ("DragDrop " + this.id);
}
};
})();
if (!Ext.dd.DragDropMgr) {
Ext.dd.DragDropMgr = function() {
var Event = Ext.EventManager;
return {
ids: {},
handleIds: {},
dragCurrent: null,
dragOvers: {},
deltaX: 0,
deltaY: 0,
preventDefault: true,
stopPropagation: true,
initalized: false,
locked: false,
init: function() {
this.initialized = true;
},
POINT: 0,
INTERSECT: 1,
mode: 0,
_execOnAll: function(sMethod, args) {
for (var i in this.ids) {
for (var j in this.ids[i]) {
var oDD = this.ids[i][j];
if (! this.isTypeOfDD(oDD)) {
continue;
}
oDD[sMethod].apply(oDD, args);
}
}
},
_onLoad: function() {
this.init();
Event.on(document, "mouseup", this.handleMouseUp, this, true);
Event.on(document, "mousemove", this.handleMouseMove, this, true);
Event.on(window, "unload", this._onUnload, this, true);
Event.on(window, "resize", this._onResize, this, true);
},
_onResize: function(e) {
this._execOnAll("resetConstraints", []);
},
lock: function() { this.locked = true; },
unlock: function() { this.locked = false; },
isLocked: function() { return this.locked; },
locationCache: {},
useCache: true,
clickPixelThresh: 3,
clickTimeThresh: 350,
dragThreshMet: false,
clickTimeout: null,
startX: 0,
startY: 0,
regDragDrop: function(oDD, sGroup) {
if (!this.initialized) { this.init(); }
if (!this.ids[sGroup]) {
this.ids[sGroup] = {};
}
this.ids[sGroup][oDD.id] = oDD;
},
removeDDFromGroup: function(oDD, sGroup) {
if (!this.ids[sGroup]) {
this.ids[sGroup] = {};
}
var obj = this.ids[sGroup];
if (obj && obj[oDD.id]) {
delete obj[oDD.id];
}
},
_remove: function(oDD) {
for (var g in oDD.groups) {
if (g && this.ids[g][oDD.id]) {
delete this.ids[g][oDD.id];
}
}
delete this.handleIds[oDD.id];
},
regHandle: function(sDDId, sHandleId) {
if (!this.handleIds[sDDId]) {
this.handleIds[sDDId] = {};
}
this.handleIds[sDDId][sHandleId] = sHandleId;
},
isDragDrop: function(id) {
return ( this.getDDById(id) ) ? true : false;
},
getRelated: function(p_oDD, bTargetsOnly) {
var oDDs = [];
for (var i in p_oDD.groups) {
for (j in this.ids[i]) {
var dd = this.ids[i][j];
if (! this.isTypeOfDD(dd)) {
continue;
}
if (!bTargetsOnly || dd.isTarget) {
oDDs[oDDs.length] = dd;
}
}
}
return oDDs;
},
isLegalTarget: function (oDD, oTargetDD) {
var targets = this.getRelated(oDD, true);
for (var i=0, len=targets.length;i<len;++i) {
if (targets[i].id == oTargetDD.id) {
return true;
}
}
return false;
},
isTypeOfDD: function (oDD) {
return (oDD && oDD.__ygDragDrop);
},
isHandle: function(sDDId, sHandleId) {
return ( this.handleIds[sDDId] &&
this.handleIds[sDDId][sHandleId] );
},
getDDById: function(id) {
for (var i in this.ids) {
if (this.ids[i][id]) {
return this.ids[i][id];
}
}
return null;
},
handleMouseDown: function(e, oDD) {
if(Ext.QuickTips){
Ext.QuickTips.disable();
}
this.currentTarget = e.getTarget();
this.dragCurrent = oDD;
var el = oDD.getEl();
this.startX = e.getPageX();
this.startY = e.getPageY();
this.deltaX = this.startX - el.offsetLeft;
this.deltaY = this.startY - el.offsetTop;
this.dragThreshMet = false;
this.clickTimeout = setTimeout(
function() {
var DDM = Ext.dd.DDM;
DDM.startDrag(DDM.startX, DDM.startY);
},
this.clickTimeThresh );
},
startDrag: function(x, y) {
clearTimeout(this.clickTimeout);
if (this.dragCurrent) {
this.dragCurrent.b4StartDrag(x, y);
this.dragCurrent.startDrag(x, y);
}
this.dragThreshMet = true;
},
handleMouseUp: function(e) {
if(Ext.QuickTips){
Ext.QuickTips.enable();
}
if (! this.dragCurrent) {
return;
}
clearTimeout(this.clickTimeout);
if (this.dragThreshMet) {
this.fireEvents(e, true);
} else {
}
this.stopDrag(e);
this.stopEvent(e);
},
stopEvent: function(e){
if(this.stopPropagation) {
e.stopPropagation();
}
if (this.preventDefault) {
e.preventDefault();
}
},
stopDrag: function(e) {
if (this.dragCurrent) {
if (this.dragThreshMet) {
this.dragCurrent.b4EndDrag(e);
this.dragCurrent.endDrag(e);
}
this.dragCurrent.onMouseUp(e);
}
this.dragCurrent = null;
this.dragOvers = {};
},
handleMouseMove: function(e) {
if (! this.dragCurrent) {
return true;
}
if (Ext.isIE && (e.button !== 0 && e.button !== 1 && e.button !== 2)) {
this.stopEvent(e);
return this.handleMouseUp(e);
}
if (!this.dragThreshMet) {
var diffX = Math.abs(this.startX - e.getPageX());
var diffY = Math.abs(this.startY - e.getPageY());
if (diffX > this.clickPixelThresh ||
diffY > this.clickPixelThresh) {
this.startDrag(this.startX, this.startY);
}
}
if (this.dragThreshMet) {
this.dragCurrent.b4Drag(e);
this.dragCurrent.onDrag(e);
if(!this.dragCurrent.moveOnly){
this.fireEvents(e, false);
}
}
this.stopEvent(e);
return true;
},
fireEvents: function(e, isDrop) {
var dc = this.dragCurrent;
if (!dc || dc.isLocked()) {
return;
}
var pt = e.getPoint();
var oldOvers = [];
var outEvts = [];
var overEvts = [];
var dropEvts = [];
var enterEvts = [];
for (var i in this.dragOvers) {
var ddo = this.dragOvers[i];
if (! this.isTypeOfDD(ddo)) {
continue;
}
if (! this.isOverTarget(pt, ddo, this.mode)) {
outEvts.push( ddo );
}
oldOvers[i] = true;
delete this.dragOvers[i];
}
for (var sGroup in dc.groups) {
if ("string" != typeof sGroup) {
continue;
}
for (i in this.ids[sGroup]) {
var oDD = this.ids[sGroup][i];
if (! this.isTypeOfDD(oDD)) {
continue;
}
if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
if (this.isOverTarget(pt, oDD, this.mode)) {
if (isDrop) {
dropEvts.push( oDD );
} else {
if (!oldOvers[oDD.id]) {
enterEvts.push( oDD );
} else {
overEvts.push( oDD );
}
this.dragOvers[oDD.id] = oDD;
}
}
}
}
}
if (this.mode) {
if (outEvts.length) {
dc.b4DragOut(e, outEvts);
dc.onDragOut(e, outEvts);
}
if (enterEvts.length) {
dc.onDragEnter(e, enterEvts);
}
if (overEvts.length) {
dc.b4DragOver(e, overEvts);
dc.onDragOver(e, overEvts);
}
if (dropEvts.length) {
dc.b4DragDrop(e, dropEvts);
dc.onDragDrop(e, dropEvts);
}
} else {
var len = 0;
for (i=0, len=outEvts.length; i<len; ++i) {
dc.b4DragOut(e, outEvts[i].id);
dc.onDragOut(e, outEvts[i].id);
}
for (i=0,len=enterEvts.length; i<len; ++i) {
dc.onDragEnter(e, enterEvts[i].id);
}
for (i=0,len=overEvts.length; i<len; ++i) {
dc.b4DragOver(e, overEvts[i].id);
dc.onDragOver(e, overEvts[i].id);
}
for (i=0, len=dropEvts.length; i<len; ++i) {
dc.b4DragDrop(e, dropEvts[i].id);
dc.onDragDrop(e, dropEvts[i].id);
}
}
if (isDrop && !dropEvts.length) {
dc.onInvalidDrop(e);
}
},
getBestMatch: function(dds) {
var winner = null;
var len = dds.length;
if (len == 1) {
winner = dds[0];
} else {
for (var i=0; i<len; ++i) {
var dd = dds[i];
if (dd.cursorIsOver) {
winner = dd;
break;
} else {
if (!winner ||
winner.overlap.getArea() < dd.overlap.getArea()) {
winner = dd;
}
}
}
}
return winner;
},
refreshCache: function(groups) {
for (var sGroup in groups) {
if ("string" != typeof sGroup) {
continue;
}
for (var i in this.ids[sGroup]) {
var oDD = this.ids[sGroup][i];
if (this.isTypeOfDD(oDD)) {
var loc = this.getLocation(oDD);
if (loc) {
this.locationCache[oDD.id] = loc;
} else {
delete this.locationCache[oDD.id];
}
}
}
}
},
verifyEl: function(el) {
if (el) {
var parent;
if(Ext.isIE){
try{
parent = el.offsetParent;
}catch(e){}
}else{
parent = el.offsetParent;
}
if (parent) {
return true;
}
}
return false;
},
getLocation: function(oDD) {
if (! this.isTypeOfDD(oDD)) {
return null;
}
var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
try {
pos= Ext.lib.Dom.getXY(el);
} catch (e) { }
if (!pos) {
return null;
}
x1 = pos[0];
x2 = x1 + el.offsetWidth;
y1 = pos[1];
y2 = y1 + el.offsetHeight;
t = y1 - oDD.padding[0];
r = x2 + oDD.padding[1];
b = y2 + oDD.padding[2];
l = x1 - oDD.padding[3];
return new Ext.lib.Region( t, r, b, l );
},
isOverTarget: function(pt, oTarget, intersect) {
var loc = this.locationCache[oTarget.id];
if (!loc || !this.useCache) {
loc = this.getLocation(oTarget);
this.locationCache[oTarget.id] = loc;
}
if (!loc) {
return false;
}
oTarget.cursorIsOver = loc.contains( pt );
var dc = this.dragCurrent;
if (!dc || !dc.getTargetCoord ||
(!intersect && !dc.constrainX && !dc.constrainY)) {
return oTarget.cursorIsOver;
}
oTarget.overlap = null;
var pos = dc.getTargetCoord(pt.x, pt.y);
var el = dc.getDragEl();
var curRegion = new Ext.lib.Region( pos.y,
pos.x + el.offsetWidth,
pos.y + el.offsetHeight,
pos.x );
var overlap = curRegion.intersect(loc);
if (overlap) {
oTarget.overlap = overlap;
return (intersect) ? true : oTarget.cursorIsOver;
} else {
return false;
}
},
_onUnload: function(e, me) {
Ext.dd.DragDropMgr.unregAll();
},
unregAll: function() {
if (this.dragCurrent) {
this.stopDrag();
this.dragCurrent = null;
}
this._execOnAll("unreg", []);
for (var i in this.elementCache) {
delete this.elementCache[i];
}
this.elementCache = {};
this.ids = {};
},
elementCache: {},
getElWrapper: function(id) {
var oWrapper = this.elementCache[id];
if (!oWrapper || !oWrapper.el) {
oWrapper = this.elementCache[id] =
new this.ElementWrapper(Ext.getDom(id));
}
return oWrapper;
},
getElement: function(id) {
return Ext.getDom(id);
},
getCss: function(id) {
var el = Ext.getDom(id);
return (el) ? el.style : null;
},
ElementWrapper: function(el) {
this.el = el || null;
this.id = this.el && el.id;
this.css = this.el && el.style;
},
getPosX: function(el) {
return Ext.lib.Dom.getX(el);
},
getPosY: function(el) {
return Ext.lib.Dom.getY(el);
},
swapNode: function(n1, n2) {
if (n1.swapNode) {
n1.swapNode(n2);
} else {
var p = n2.parentNode;
var s = n2.nextSibling;
if (s == n1) {
p.insertBefore(n1, n2);
} else if (n2 == n1.nextSibling) {
p.insertBefore(n2, n1);
} else {
n1.parentNode.replaceChild(n2, n1);
p.insertBefore(n1, s);
}
}
},
getScroll: function () {
var t, l, dde=document.documentElement, db=document.body;
if (dde && (dde.scrollTop || dde.scrollLeft)) {
t = dde.scrollTop;
l = dde.scrollLeft;
} else if (db) {
t = db.scrollTop;
l = db.scrollLeft;
} else {
}
return { top: t, left: l };
},
getStyle: function(el, styleProp) {
return Ext.fly(el).getStyle(styleProp);
},
getScrollTop: function () { return this.getScroll().top; },
getScrollLeft: function () { return this.getScroll().left; },
moveToEl: function (moveEl, targetEl) {
var aCoord = Ext.lib.Dom.getXY(targetEl);
Ext.lib.Dom.setXY(moveEl, aCoord);
},
numericSort: function(a, b) { return (a - b); },
_timeoutCount: 0,
_addListeners: function() {
var DDM = Ext.dd.DDM;
if ( Ext.lib.Event && document ) {
DDM._onLoad();
} else {
if (DDM._timeoutCount > 2000) {
} else {
setTimeout(DDM._addListeners, 10);
if (document && document.body) {
DDM._timeoutCount += 1;
}
}
}
},
handleWasClicked: function(node, id) {
if (this.isHandle(id, node.id)) {
return true;
} else {
var p = node.parentNode;
while (p) {
if (this.isHandle(id, p.id)) {
return true;
} else {
p = p.parentNode;
}
}
}
return false;
}
};
}();
Ext.dd.DDM = Ext.dd.DragDropMgr;
Ext.dd.DDM._addListeners();
}
Ext.dd.DD = function(id, sGroup, config) {
if (id) {
this.init(id, sGroup, config);
}
};
Ext.extend(Ext.dd.DD, Ext.dd.DragDrop, {
scroll: true,
autoOffset: function(iPageX, iPageY) {
var x = iPageX - this.startPageX;
var y = iPageY - this.startPageY;
this.setDelta(x, y);
},
setDelta: function(iDeltaX, iDeltaY) {
this.deltaX = iDeltaX;
this.deltaY = iDeltaY;
},
setDragElPos: function(iPageX, iPageY) {
var el = this.getDragEl();
this.alignElWithMouse(el, iPageX, iPageY);
},
alignElWithMouse: function(el, iPageX, iPageY) {
var oCoord = this.getTargetCoord(iPageX, iPageY);
var fly = el.dom ? el : Ext.fly(el, '_dd');
if (!this.deltaSetXY) {
var aCoord = [oCoord.x, oCoord.y];
fly.setXY(aCoord);
var newLeft = fly.getLeft(true);
var newTop = fly.getTop(true);
this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
} else {
fly.setLeftTop(oCoord.x + this.deltaSetXY[0], oCoord.y + this.deltaSetXY[1]);
}
this.cachePosition(oCoord.x, oCoord.y);
this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
return oCoord;
},
cachePosition: function(iPageX, iPageY) {
if (iPageX) {
this.lastPageX = iPageX;
this.lastPageY = iPageY;
} else {
var aCoord = Ext.lib.Dom.getXY(this.getEl());
this.lastPageX = aCoord[0];
this.lastPageY = aCoord[1];
}
},
autoScroll: function(x, y, h, w) {
if (this.scroll) {
var clientH = Ext.lib.Dom.getViewHeight();
var clientW = Ext.lib.Dom.getViewWidth();
var st = this.DDM.getScrollTop();
var sl = this.DDM.getScrollLeft();
var bot = h + y;
var right = w + x;
var toBot = (clientH + st - y - this.deltaY);
var toRight = (clientW + sl - x - this.deltaX);
var thresh = 40;
var scrAmt = (document.all) ? 80 : 30;
if ( bot > clientH && toBot < thresh ) {
window.scrollTo(sl, st + scrAmt);
}
if ( y < st && st > 0 && y - st < thresh ) {
window.scrollTo(sl, st - scrAmt);
}
if ( right > clientW && toRight < thresh ) {
window.scrollTo(sl + scrAmt, st);
}
if ( x < sl && sl > 0 && x - sl < thresh ) {
window.scrollTo(sl - scrAmt, st);
}
}
},
getTargetCoord: function(iPageX, iPageY) {
var x = iPageX - this.deltaX;
var y = iPageY - this.deltaY;
if (this.constrainX) {
if (x < this.minX) { x = this.minX; }
if (x > this.maxX) { x = this.maxX; }
}
if (this.constrainY) {
if (y < this.minY) { y = this.minY; }
if (y > this.maxY) { y = this.maxY; }
}
x = this.getTick(x, this.xTicks);
y = this.getTick(y, this.yTicks);
return {x:x, y:y};
},
applyConfig: function() {
Ext.dd.DD.superclass.applyConfig.call(this);
this.scroll = (this.config.scroll !== false);
},
b4MouseDown: function(e) {
this.autoOffset(e.getPageX(),
e.getPageY());
},
b4Drag: function(e) {
this.setDragElPos(e.getPageX(),
e.getPageY());
},
toString: function() {
return ("DD " + this.id);
}
});
Ext.dd.DDProxy = function(id, sGroup, config) {
if (id) {
this.init(id, sGroup, config);
this.initFrame();
}
};
Ext.dd.DDProxy.dragElId = "ygddfdiv";
Ext.extend(Ext.dd.DDProxy, Ext.dd.DD, {
resizeFrame: true,
centerFrame: false,
createFrame: function() {
var self = this;
var body = document.body;
if (!body || !body.firstChild) {
setTimeout( function() { self.createFrame(); }, 50 );
return;
}
var div = this.getDragEl();
if (!div) {
div = document.createElement("div");
div.id = this.dragElId;
var s = div.style;
s.position = "absolute";
s.visibility = "hidden";
s.cursor = "move";
s.border = "2px solid #aaa";
s.zIndex = 999;
body.insertBefore(div, body.firstChild);
}
},
initFrame: function() {
this.createFrame();
},
applyConfig: function() {
Ext.dd.DDProxy.superclass.applyConfig.call(this);
this.resizeFrame = (this.config.resizeFrame !== false);
this.centerFrame = (this.config.centerFrame);
this.setDragElId(this.config.dragElId || Ext.dd.DDProxy.dragElId);
},
showFrame: function(iPageX, iPageY) {
var el = this.getEl();
var dragEl = this.getDragEl();
var s = dragEl.style;
this._resizeProxy();
if (this.centerFrame) {
this.setDelta( Math.round(parseInt(s.width, 10)/2),
Math.round(parseInt(s.height, 10)/2) );
}
this.setDragElPos(iPageX, iPageY);
Ext.fly(dragEl).show();
},
_resizeProxy: function() {
if (this.resizeFrame) {
var el = this.getEl();
Ext.fly(this.getDragEl()).setSize(el.offsetWidth, el.offsetHeight);
}
},
b4MouseDown: function(e) {
var x = e.getPageX();
var y = e.getPageY();
this.autoOffset(x, y);
this.setDragElPos(x, y);
},
b4StartDrag: function(x, y) {
this.showFrame(x, y);
},
b4EndDrag: function(e) {
Ext.fly(this.getDragEl()).hide();
},
endDrag: function(e) {
var lel = this.getEl();
var del = this.getDragEl();
del.style.visibility = "";
this.beforeMove();
lel.style.visibility = "hidden";
Ext.dd.DDM.moveToEl(lel, del);
del.style.visibility = "hidden";
lel.style.visibility = "";
this.afterDrag();
},
beforeMove : function(){
},
afterDrag : function(){
},
toString: function() {
return ("DDProxy " + this.id);
}
});
Ext.dd.DDTarget = function(id, sGroup, config) {
if (id) {
this.initTarget(id, sGroup, config);
}
};
Ext.extend(Ext.dd.DDTarget, Ext.dd.DragDrop, {
toString: function() {
return ("DDTarget " + this.id);
}
});
Ext.dd.DragTracker = function(config){
Ext.apply(this, config);
this.addEvents(
'mousedown',
'mouseup',
'mousemove',
'dragstart',
'dragend',
'drag'
);
this.dragRegion = new Ext.lib.Region(0,0,0,0);
if(this.el){
this.initEl(this.el);
}
}
Ext.extend(Ext.dd.DragTracker, Ext.util.Observable, {
active: false,
tolerance: 5,
autoStart: false,
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);
},
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;
e.preventDefault();
var doc = Ext.getDoc();
doc.on('mouseup', this.onMouseUp, this);
doc.on('mousemove', this.onMouseMove, this);
doc.on('selectstart', this.stopSelect, this);
if(this.autoStart){
this.timer = this.triggerStart.defer(this.autoStart === true ? 1000 : this.autoStart, this);
}
}
},
onMouseMove: function(e, target){
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();
}else{
return;
}
}
this.fireEvent('mousemove', this, e);
this.onDrag(e);
this.fireEvent('drag', this, e);
},
onMouseUp: function(e){
var doc = Ext.getDoc();
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);
this.onEnd(e);
this.fireEvent('dragend', this, e);
},
triggerStart: function(isTimer){
this.clearStart();
this.active = true;
this.onStart(this.startXY);
this.fireEvent('dragstart', this, this.startXY);
},
clearStart : function(){
if(this.timer){
clearTimeout(this.timer);
delete this.timer;
}
},
stopSelect : function(e){
e.stopEvent();
return false;
},
onBeforeStart : function(e){
},
onStart : function(xy){
},
onDrag : function(e){
},
onEnd : function(e){
},
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);
var 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];
}
}
});
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;
proc.id = setInterval(doScroll, Ext.dd.ScrollManager.frequency);
};
var onFire = function(e, isDrop){
if(isDrop || !ddm.dragCurrent){ return; }
var dds = Ext.dd.ScrollManager;
if(!dragEl || dragEl != ddm.dragCurrent){
dragEl = ddm.dragCurrent;
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 {
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;
}
},
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];
}
},
vthresh : 25,
hthresh : 25,
increment : 100,
frequency : 500,
animate: true,
animDuration: .4,
refreshCache : function(){
for(var id in els){
if(typeof els[id] == 'object'){
els[id]._region = els[id].getRegion();
}
}
}
};
}();
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 {
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 : 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)];
}
}
}
},
getHandle : function(id){
if(typeof id != "string"){
id = id.id;
}
return handles[id];
},
getHandleFromEvent : function(e){
var t = Ext.lib.Event.getTarget(e);
return t ? handles[t.id] : null;
},
getTarget : function(id){
if(typeof id != "string"){
id = id.id;
}
return elements[id];
},
getTargetFromEvent : function(e){
var t = Ext.lib.Event.getTarget(e);
return t ? elements[t.id] || handles[t.id] : null;
}
};
}();
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 = {
dropAllowed : "x-dd-drop-ok",
dropNotAllowed : "x-dd-drop-nodrop",
setStatus : function(cssClass){
cssClass = cssClass || this.dropNotAllowed;
if(this.dropStatus != cssClass){
this.el.replaceClass(this.dropStatus, cssClass);
this.dropStatus = cssClass;
}
},
reset : function(clearGhost){
this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed;
this.dropStatus = this.dropNotAllowed;
if(clearGhost){
this.ghost.update("");
}
},
update : function(html){
if(typeof html == "string"){
this.ghost.update(html);
}else{
this.ghost.update("");
html.style.margin = "0";
this.ghost.dom.appendChild(html);
}
},
getEl : function(){
return this.el;
},
getGhost : function(){
return this.ghost;
},
hide : function(clear){
this.el.hide();
if(clear){
this.reset(true);
}
},
stop : function(){
if(this.anim && this.anim.isAnimated && this.anim.isAnimated()){
this.anim.stop();
}
},
show : function(){
this.el.show();
},
sync : function(){
this.el.sync();
},
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();
}
},
afterRepair : function(){
this.hide(true);
if(typeof this.callback == "function"){
this.callback.call(this.scope || this);
}
this.callback = null;
this.scope = null;
}
};
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, {
dropAllowed : "x-dd-drop-ok",
dropNotAllowed : "x-dd-drop-nodrop",
getDragData : function(e){
return this.dragData;
},
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){
this.afterDragEnter(target, e, id);
}
}
},
beforeDragEnter : function(target, e, id){
return true;
},
alignElWithMouse: function() {
Ext.dd.DragSource.superclass.alignElWithMouse.apply(this, arguments);
this.proxy.sync();
},
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){
this.afterDragOver(target, e, id);
}
}
},
beforeDragOver : function(target, e, id){
return true;
},
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){
this.afterDragOut(target, e, id);
}
}
this.cachedTarget = null;
},
beforeDragOut : function(target, e, id){
return true;
},
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)){
this.onValidDrop(target, e, id);
}else{
this.onInvalidDrop(target, e, id);
}
}else{
this.onValidDrop(target, e, id);
}
if(this.afterDragDrop){
this.afterDragDrop(target, e, id);
}
}
delete this.cachedTarget;
},
beforeDragDrop : function(target, e, id){
return true;
},
onValidDrop : function(target, e, id){
this.hideProxy();
if(this.afterValidDrop){
this.afterValidDrop(target, e, id);
}
},
getRepairXY : function(e, data){
return this.el.getXY();
},
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){
this.afterInvalidDrop(e, id);
}
},
afterRepair : function(){
if(Ext.enableFx){
this.el.highlight(this.hlColor || "c3daf9");
}
this.dragging = false;
},
beforeInvalidDrop : function(target, e, id){
return true;
},
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);
}
},
onBeforeDrag : function(data, e){
return true;
},
onStartDrag : Ext.emptyFn,
startDrag : function(x, y){
this.proxy.reset();
this.dragging = true;
this.proxy.update("");
this.onInitDrag(x, y);
this.proxy.show();
},
onInitDrag : function(x, y){
var clone = this.el.dom.cloneNode(true);
clone.id = Ext.id();
this.proxy.update(clone);
this.onStartDrag(x, y);
return true;
},
getProxy : function(){
return this.proxy;
},
hideProxy : function(){
this.proxy.hide();
this.proxy.reset(true);
this.dragging = false;
},
triggerCacheRefresh : function(){
Ext.dd.DDM.refreshCache(this.groups);
},
b4EndDrag: function(e) {
},
endDrag : function(e){
this.onEndDrag(this.dragData, e);
},
onEndDrag : function(data, e){
},
autoOffset : function(x, y) {
this.setDelta(-12, -20);
}
});
Ext.dd.DropTarget = 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});
};
Ext.extend(Ext.dd.DropTarget, Ext.dd.DDTarget, {
dropAllowed : "x-dd-drop-ok",
dropNotAllowed : "x-dd-drop-nodrop",
isTarget : true,
isNotifyTarget : true,
notifyEnter : function(dd, e, data){
if(this.overClass){
this.el.addClass(this.overClass);
}
return this.dropAllowed;
},
notifyOver : function(dd, e, data){
return this.dropAllowed;
},
notifyOut : function(dd, e, data){
if(this.overClass){
this.el.removeClass(this.overClass);
}
},
notifyDrop : function(dd, e, data){
return false;
}
});
Ext.dd.DragZone = function(el, config){
Ext.dd.DragZone.superclass.constructor.call(this, el, config);
if(this.containerScroll){
Ext.dd.ScrollManager.register(this.el);
}
};
Ext.extend(Ext.dd.DragZone, Ext.dd.DragSource, {
getDragData : function(e){
return Ext.dd.Registry.getHandleFromEvent(e);
},
onInitDrag : function(x, y){
this.proxy.update(this.dragData.ddel.cloneNode(true));
this.onStartDrag(x, y);
return true;
},
afterRepair : function(){
if(Ext.enableFx){
Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");
}
this.dragging = false;
},
getRepairXY : function(e){
return Ext.Element.fly(this.dragData.ddel).getXY();
}
});
Ext.dd.DropZone = function(el, config){
Ext.dd.DropZone.superclass.constructor.call(this, el, config);
};
Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, {
getTargetFromEvent : function(e){
return Ext.dd.Registry.getTargetFromEvent(e);
},
onNodeEnter : function(n, dd, e, data){
},
onNodeOver : function(n, dd, e, data){
return this.dropAllowed;
},
onNodeOut : function(n, dd, e, data){
},
onNodeDrop : function(n, dd, e, data){
return false;
},
onContainerOver : function(dd, e, data){
return this.dropNotAllowed;
},
onContainerDrop : function(dd, e, data){
return false;
},
notifyEnter : function(dd, e, data){
return this.dropNotAllowed;
},
notifyOver : function(dd, e, data){
var n = this.getTargetFromEvent(e);
if(!n){
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);
},
notifyOut : function(dd, e, data){
if(this.lastOverNode){
this.onNodeOut(this.lastOverNode, dd, e, data);
this.lastOverNode = null;
}
},
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);
},
triggerCacheRefresh : function(){
Ext.dd.DDM.refreshCache(this.groups);
}
});
Ext.data.SortTypes = {
none : function(s){
return s;
},
stripTagsRE : /<\/?[^>]+>/gi,
asText : function(s){
return String(s).replace(this.stripTagsRE, "");
},
asUCText : function(s){
return String(s).toUpperCase().replace(this.stripTagsRE, "");
},
asUCString : function(s) {
return String(s).toUpperCase();
},
asDate : function(s) {
if(!s){
return 0;
}
if(Ext.isDate(s)){
return s.getTime();
}
return Date.parse(String(s));
},
asFloat : function(s) {
var val = parseFloat(String(s).replace(/,/g, ""));
if(isNaN(val)) val = 0;
return val;
},
asInt : function(s) {
var val = parseInt(String(s).replace(/,/g, ""));
if(isNaN(val)) val = 0;
return val;
}
};
Ext.data.Record = function(data, id){
this.id = (id || id === 0) ? id : ++Ext.data.Record.AUTO_ID;
this.data = data;
};
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.AUTO_ID = 1000;
Ext.data.Record.EDIT = 'edit';
Ext.data.Record.REJECT = 'reject';
Ext.data.Record.COMMIT = 'commit';
Ext.data.Record.prototype = {
dirty : false,
editing : false,
error: null,
modified: null,
join : function(store){
this.store = store;
},
set : function(name, value){
if(String(this.data[name]) == String(value)){
return;
}
this.dirty = true;
if(!this.modified){
this.modified = {};
}
if(typeof this.modified[name] == 'undefined'){
this.modified[name] = this.data[name];
}
this.data[name] = value;
if(!this.editing && this.store){
this.store.afterEdit(this);
}
},
get : function(name){
return this.data[name];
},
beginEdit : function(){
this.editing = true;
this.modified = {};
},
cancelEdit : function(){
this.editing = false;
delete this.modified;
},
endEdit : function(){
this.editing = false;
if(this.dirty && this.store){
this.store.afterEdit(this);
}
},
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(this.store && silent !== true){
this.store.afterReject(this);
}
},
commit : function(silent){
this.dirty = false;
delete this.modified;
this.editing = false;
if(this.store && silent !== true){
this.store.afterCommit(this);
}
},
getChanges : function(){
var m = this.modified, cs = {};
for(var n in m){
if(m.hasOwnProperty(n)){
cs[n] = this.data[n];
}
}
return cs;
},
hasError : function(){
return this.error != null;
},
clearError : function(){
this.error = null;
},
copy : function(newId) {
return new this.constructor(Ext.apply({}, this.data), newId || this.id);
},
isModified : function(fieldName){
return this.modified && this.modified.hasOwnProperty(fieldName);
}
};
Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), {
register : function(){
for(var i = 0, s; s = arguments[i]; i++){
this.add(s);
}
},
unregister : function(){
for(var i = 0, s; s = arguments[i]; i++){
this.remove(this.lookup(s));
}
},
lookup : function(id){
return typeof id == "object" ? id : this.get(id);
},
getKey : function(o){
return o.storeId || o.id;
}
});
Ext.data.Store = function(config){
this.data = new Ext.util.MixedCollection(false);
this.data.getKey = function(o){
return o.id;
};
this.baseParams = {};
this.paramNames = {
"start" : "start",
"limit" : "limit",
"sort" : "sort",
"dir" : "dir"
};
if(config && config.data){
this.inlineData = config.data;
delete config.data;
}
Ext.apply(this, config);
if(this.url && !this.proxy){
this.proxy = new Ext.data.HttpProxy({url: this.url});
}
if(this.reader){
if(!this.recordType){
this.recordType = this.reader.recordType;
}
if(this.reader.onMetaChange){
this.reader.onMetaChange = this.onMetaChange.createDelegate(this);
}
}
if(this.recordType){
this.fields = this.recordType.prototype.fields;
}
this.modified = [];
this.addEvents(
'datachanged',
'metachange',
'add',
'remove',
'update',
'clear',
'beforeload',
'load',
'loadexception'
);
if(this.proxy){
this.relayEvents(this.proxy, ["loadexception"]);
}
this.sortToggle = {};
if(this.sortInfo){
this.setDefaultSort(this.sortInfo.field, this.sortInfo.direction);
}
Ext.data.Store.superclass.constructor.call(this);
if(this.storeId || this.id){
Ext.StoreMgr.register(this);
}
if(this.inlineData){
this.loadData(this.inlineData);
delete this.inlineData;
}else if(this.autoLoad){
this.load.defer(10, this, [
typeof this.autoLoad == 'object' ?
this.autoLoad : undefined]);
}
};
Ext.extend(Ext.data.Store, Ext.util.Observable, {
remoteSort : false,
pruneModifiedRecords : false,
lastOptions : null,
destroy : function(){
if(this.id){
Ext.StoreMgr.unregister(this);
}
this.data = null;
this.purgeListeners();
},
add : function(records){
records = [].concat(records);
if(records.length < 1){
return;
}
for(var i = 0, len = records.length; i < len; i++){
records[i].join(this);
}
var index = this.data.length;
this.data.addAll(records);
if(this.snapshot){
this.snapshot.addAll(records);
}
this.fireEvent("add", this, records, index);
},
addSorted : function(record){
var index = this.findInsertIndex(record);
this.insert(index, record);
},
remove : function(record){
var index = this.data.indexOf(record);
this.data.removeAt(index);
if(this.pruneModifiedRecords){
this.modified.remove(record);
}
if(this.snapshot){
this.snapshot.remove(record);
}
this.fireEvent("remove", this, record, index);
},
removeAll : function(){
this.data.clear();
if(this.snapshot){
this.snapshot.clear();
}
if(this.pruneModifiedRecords){
this.modified = [];
}
this.fireEvent("clear", this);
},
insert : function(index, records){
records = [].concat(records);
for(var i = 0, len = records.length; i < len; i++){
this.data.insert(index, records[i]);
records[i].join(this);
}
this.fireEvent("add", this, records, index);
},
indexOf : function(record){
return this.data.indexOf(record);
},
indexOfId : function(id){
return this.data.indexOfKey(id);
},
getById : function(id){
return this.data.key(id);
},
getAt : function(index){
return this.data.itemAt(index);
},
getRange : function(start, end){
return this.data.getRange(start, end);
},
storeOptions : function(o){
o = Ext.apply({}, o);
delete o.callback;
delete o.scope;
this.lastOptions = o;
},
load : function(options){
options = options || {};
if(this.fireEvent("beforeload", this, options) !== false){
this.storeOptions(options);
var p = Ext.apply(options.params || {}, this.baseParams);
if(this.sortInfo && this.remoteSort){
var pn = this.paramNames;
p[pn["sort"]] = this.sortInfo.field;
p[pn["dir"]] = this.sortInfo.direction;
}
this.proxy.load(p, this.reader, this.loadRecords, this, options);
return true;
} else {
return false;
}
},
reload : function(options){
this.load(Ext.applyIf(options||{}, this.lastOptions));
},
loadRecords : function(o, options, success){
if(!o || success === false){
if(success !== false){
this.fireEvent("load", this, [], options);
}
if(options.callback){
options.callback.call(options.scope || this, [], options, false);
}
return;
}
var r = o.records, t = o.totalRecords || r.length;
if(!options || options.add !== true){
if(this.pruneModifiedRecords){
this.modified = [];
}
for(var i = 0, len = r.length; i < len; i++){
r[i].join(this);
}
if(this.snapshot){
this.data = this.snapshot;
delete this.snapshot;
}
this.data.clear();
this.data.addAll(r);
this.totalLength = t;
this.applySort();
this.fireEvent("datachanged", this);
}else{
this.totalLength = Math.max(t, this.data.length+r.length);
this.add(r);
}
this.fireEvent("load", this, r, options);
if(options.callback){
options.callback.call(options.scope || this, r, options, true);
}
},
loadData : function(o, append){
var r = this.reader.readRecords(o);
this.loadRecords(r, {add: append}, true);
},
getCount : function(){
return this.data.length || 0;
},
getTotalCount : function(){
return this.totalLength || 0;
},
getSortState : function(){
return this.sortInfo;
},
applySort : function(){
if(this.sortInfo && !this.remoteSort){
var s = this.sortInfo, f = s.field;
this.sortData(f, s.direction);
}
},
sortData : function(f, direction){
direction = direction || 'ASC';
var st = this.fields.get(f).sortType;
var fn = function(r1, r2){
var v1 = st(r1.data[f]), v2 = st(r2.data[f]);
return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
};
this.data.sort(direction, fn);
if(this.snapshot && this.snapshot != this.data){
this.snapshot.sort(direction, fn);
}
},
setDefaultSort : function(field, dir){
dir = dir ? dir.toUpperCase() : "ASC";
this.sortInfo = {field: field, direction: dir};
this.sortToggle[field] = dir;
},
sort : function(fieldName, dir){
var f = this.fields.get(fieldName);
if(!f){
return false;
}
if(!dir){
if(this.sortInfo && this.sortInfo.field == f.name){
dir = (this.sortToggle[f.name] || "ASC").toggle("ASC", "DESC");
}else{
dir = f.sortDir;
}
}
var st = (this.sortToggle) ? this.sortToggle[f.name] : null;
var si = (this.sortInfo) ? this.sortInfo : null;
this.sortToggle[f.name] = dir;
this.sortInfo = {field: f.name, direction: dir};
if(!this.remoteSort){
this.applySort();
this.fireEvent("datachanged", this);
}else{
if (!this.load(this.lastOptions)) {
if (st) {
this.sortToggle[f.name] = st;
}
if (si) {
this.sortInfo = si;
}
}
}
},
each : function(fn, scope){
this.data.each(fn, scope);
},
getModifiedRecords : function(){
return this.modified;
},
createFilterFn : function(property, value, anyMatch, caseSensitive){
if(Ext.isEmpty(value, false)){
return false;
}
value = this.data.createValueMatcher(value, anyMatch, caseSensitive);
return function(r){
return value.test(r.data[property]);
};
},
sum : function(property, start, end){
var rs = this.data.items, v = 0;
start = start || 0;
end = (end || end === 0) ? end : rs.length-1;
for(var i = start; i <= end; i++){
v += (rs[i].data[property] || 0);
}
return v;
},
filter : function(property, value, anyMatch, caseSensitive){
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
return fn ? this.filterBy(fn) : this.clearFilter();
},
filterBy : function(fn, scope){
this.snapshot = this.snapshot || this.data;
this.data = this.queryBy(fn, scope||this);
this.fireEvent("datachanged", this);
},
query : function(property, value, anyMatch, caseSensitive){
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
return fn ? this.queryBy(fn) : this.data.clone();
},
queryBy : function(fn, scope){
var data = this.snapshot || this.data;
return data.filterBy(fn, scope||this);
},
find : function(property, value, start, anyMatch, caseSensitive){
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
return fn ? this.data.findIndexBy(fn, null, start) : -1;
},
findBy : function(fn, scope, start){
return this.data.findIndexBy(fn, scope, start);
},
collect : function(dataIndex, allowNull, bypassFilter){
var d = (bypassFilter === true && this.snapshot) ?
this.snapshot.items : this.data.items;
var v, sv, r = [], l = {};
for(var i = 0, len = d.length; i < len; i++){
v = d[i].data[dataIndex];
sv = String(v);
if((allowNull || !Ext.isEmpty(v)) && !l[sv]){
l[sv] = true;
r[r.length] = v;
}
}
return r;
},
clearFilter : function(suppressEvent){
if(this.isFiltered()){
this.data = this.snapshot;
delete this.snapshot;
if(suppressEvent !== true){
this.fireEvent("datachanged", this);
}
}
},
isFiltered : function(){
return this.snapshot && this.snapshot != this.data;
},
afterEdit : function(record){
if(this.modified.indexOf(record) == -1){
this.modified.push(record);
}
this.fireEvent("update", this, record, Ext.data.Record.EDIT);
},
afterReject : function(record){
this.modified.remove(record);
this.fireEvent("update", this, record, Ext.data.Record.REJECT);
},
afterCommit : function(record){
this.modified.remove(record);
this.fireEvent("update", this, record, Ext.data.Record.COMMIT);
},
commitChanges : function(){
var m = this.modified.slice(0);
this.modified = [];
for(var i = 0, len = m.length; i < len; i++){
m[i].commit();
}
},
rejectChanges : function(){
var m = this.modified.slice(0);
this.modified = [];
for(var i = 0, len = m.length; i < len; i++){
m[i].reject();
}
},
onMetaChange : function(meta, rtype, o){
this.recordType = rtype;
this.fields = rtype.prototype.fields;
delete this.snapshot;
this.sortInfo = meta.sortInfo;
this.modified = [];
this.fireEvent('metachange', this, this.reader.meta);
},
findInsertIndex : function(record){
this.suspendEvents();
var data = this.data.clone();
this.data.add(record);
this.applySort();
var index = this.data.indexOf(record);
this.data = data;
this.resumeEvents();
return index;
}
});
Ext.data.SimpleStore = function(config){
Ext.data.SimpleStore.superclass.constructor.call(this, Ext.apply(config, {
reader: new Ext.data.ArrayReader({
id: config.id
},
Ext.data.Record.create(config.fields)
)
}));
};
Ext.extend(Ext.data.SimpleStore, Ext.data.Store, {
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.SimpleStore.superclass.loadData.call(this, data, append);
}
});
Ext.data.JsonStore = function(c){
Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(c, {
proxy: !c.data ? new Ext.data.HttpProxy({url: c.url}) : undefined,
reader: new Ext.data.JsonReader(c, c.fields)
}));
};
Ext.extend(Ext.data.JsonStore, Ext.data.Store);
Ext.data.Field = function(config){
if(typeof config == "string"){
config = {name: config};
}
Ext.apply(this, config);
if(!this.type){
this.type = "auto";
}
var st = Ext.data.SortTypes;
if(typeof this.sortType == "string"){
this.sortType = st[this.sortType];
}
if(!this.sortType){
switch(this.type){
case "string":
this.sortType = st.asUCString;
break;
case "date":
this.sortType = st.asDate;
break;
default:
this.sortType = st.none;
}
}
var stripRe = /[\$,%]/g;
if(!this.convert){
var cv, dateFormat = this.dateFormat;
switch(this.type){
case "":
case "auto":
case undefined:
cv = function(v){ return v; };
break;
case "string":
cv = function(v){ return (v === undefined || v === null) ? '' : String(v); };
break;
case "int":
cv = function(v){
return v !== undefined && v !== null && v !== '' ?
parseInt(String(v).replace(stripRe, ""), 10) : '';
};
break;
case "float":
cv = function(v){
return v !== undefined && v !== null && v !== '' ?
parseFloat(String(v).replace(stripRe, ""), 10) : '';
};
break;
case "bool":
case "boolean":
cv = function(v){ return v === true || v === "true" || v == 1; };
break;
case "date":
cv = function(v){
if(!v){
return '';
}
if(Ext.isDate(v)){
return v;
}
if(dateFormat){
if(dateFormat == "timestamp"){
return new Date(v*1000);
}
if(dateFormat == "time"){
return new Date(parseInt(v, 10));
}
return Date.parseDate(v, dateFormat);
}
var parsed = Date.parse(v);
return parsed ? new Date(parsed) : null;
};
break;
}
this.convert = cv;
}
};
Ext.data.Field.prototype = {
dateFormat: null,
defaultValue: "",
mapping: null,
sortType : null,
sortDir : "ASC"
};
Ext.data.DataReader = function(meta, recordType){
this.meta = meta;
this.recordType = Ext.isArray(recordType) ?
Ext.data.Record.create(recordType) : recordType;
};
Ext.data.DataReader.prototype = {
};
Ext.data.DataProxy = function(){
this.addEvents(
'beforeload',
'load',
'loadexception'
);
Ext.data.DataProxy.superclass.constructor.call(this);
};
Ext.extend(Ext.data.DataProxy, Ext.util.Observable);
Ext.data.MemoryProxy = function(data){
Ext.data.MemoryProxy.superclass.constructor.call(this);
this.data = data;
};
Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {
load : function(params, reader, callback, scope, arg){
params = params || {};
var result;
try {
result = reader.readRecords(this.data);
}catch(e){
this.fireEvent("loadexception", this, arg, null, e);
callback.call(scope, null, arg, false);
return;
}
callback.call(scope, result, arg, true);
},
update : function(params, records){
}
});
Ext.data.HttpProxy = function(conn){
Ext.data.HttpProxy.superclass.constructor.call(this);
this.conn = conn;
this.useAjax = !conn || !conn.events;
};
Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, {
getConnection : function(){
return this.useAjax ? Ext.Ajax : this.conn;
},
load : function(params, reader, callback, scope, arg){
if(this.fireEvent("beforeload", this, params) !== false){
var o = {
params : params || {},
request: {
callback : callback,
scope : scope,
arg : arg
},
reader: reader,
callback : this.loadResponse,
scope: this
};
if(this.useAjax){
Ext.applyIf(o, this.conn);
if(this.activeRequest){
Ext.Ajax.abort(this.activeRequest);
}
this.activeRequest = Ext.Ajax.request(o);
}else{
this.conn.request(o);
}
}else{
callback.call(scope||this, null, arg, false);
}
},
loadResponse : function(o, success, response){
delete this.activeRequest;
if(!success){
this.fireEvent("loadexception", this, o, response);
o.request.callback.call(o.request.scope, null, o.request.arg, false);
return;
}
var result;
try {
result = o.reader.read(response);
}catch(e){
this.fireEvent("loadexception", this, o, response, e);
o.request.callback.call(o.request.scope, null, o.request.arg, false);
return;
}
this.fireEvent("load", this, o, o.request.arg);
o.request.callback.call(o.request.scope, result, o.request.arg, true);
},
update : function(dataSet){
},
updateResponse : function(dataSet){
}
});
Ext.data.ScriptTagProxy = function(config){
Ext.data.ScriptTagProxy.superclass.constructor.call(this);
Ext.apply(this, config);
this.head = document.getElementsByTagName("head")[0];
};
Ext.data.ScriptTagProxy.TRANS_ID = 1000;
Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, {
timeout : 30000,
callbackParam : "callback",
nocache : true,
load : function(params, reader, callback, scope, arg){
if(this.fireEvent("beforeload", this, params) !== false){
var p = Ext.urlEncode(Ext.apply(params, this.extraParams));
var url = this.url;
url += (url.indexOf("?") != -1 ? "&" : "?") + p;
if(this.nocache){
url += "&_dc=" + (new Date().getTime());
}
var transId = ++Ext.data.ScriptTagProxy.TRANS_ID;
var trans = {
id : transId,
cb : "stcCallback"+transId,
scriptId : "stcScript"+transId,
params : params,
arg : arg,
url : url,
callback : callback,
scope : scope,
reader : reader
};
var conn = this;
window[trans.cb] = function(o){
conn.handleResponse(o, 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;
}else{
callback.call(scope||this, null, arg, false);
}
},
isLoading : function(){
return this.trans ? true : false;
},
abort : function(){
if(this.isLoading()){
this.destroyTrans(this.trans);
}
},
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{
window[trans.cb] = function(){
window[trans.cb] = undefined;
try{
delete window[trans.cb];
}catch(e){}
};
}
},
handleResponse : function(o, trans){
this.trans = false;
this.destroyTrans(trans, true);
var result;
try {
result = trans.reader.readRecords(o);
}catch(e){
this.fireEvent("loadexception", this, o, trans.arg, e);
trans.callback.call(trans.scope||window, null, trans.arg, false);
return;
}
this.fireEvent("load", this, o, trans.arg);
trans.callback.call(trans.scope||window, result, trans.arg, true);
},
handleFailure : function(trans){
this.trans = false;
this.destroyTrans(trans, false);
this.fireEvent("loadexception", this, null, trans.arg);
trans.callback.call(trans.scope||window, null, trans.arg, false);
}
});
Ext.data.JsonReader = function(meta, recordType){
meta = meta || {};
Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType || meta.fields);
};
Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, {
read : function(response){
var json = response.responseText;
var o = eval("("+json+")");
if(!o) {
throw {message: "JsonReader.read: Json object not found"};
}
if(o.metaData){
delete this.ef;
this.meta = o.metaData;
this.recordType = Ext.data.Record.create(o.metaData.fields);
this.onMetaChange(this.meta, this.recordType, o);
}
return this.readRecords(o);
},
onMetaChange : function(meta, recordType, o){
},
simpleAccess: function(obj, subsc) {
return obj[subsc];
},
getJsonAccessor: function(){
var re = /[\[\.]/;
return function(expr) {
try {
return(re.test(expr))
? new Function("obj", "return obj." + expr)
: function(obj){
return obj[expr];
};
} catch(e){}
return Ext.emptyFn;
};
}(),
readRecords : function(o){
this.jsonData = o;
var s = this.meta, Record = this.recordType,
f = Record.prototype.fields, fi = f.items, fl = f.length;
if (!this.ef) {
if(s.totalProperty) {
this.getTotal = this.getJsonAccessor(s.totalProperty);
}
if(s.successProperty) {
this.getSuccess = this.getJsonAccessor(s.successProperty);
}
this.getRoot = s.root ? this.getJsonAccessor(s.root) : function(p){return p;};
if (s.id) {
var g = this.getJsonAccessor(s.id);
this.getId = function(rec) {
var r = g(rec);
return (r === undefined || r === "") ? null : r;
};
} else {
this.getId = function(){return null;};
}
this.ef = [];
for(var i = 0; i < fl; i++){
f = fi[i];
var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name;
this.ef[i] = this.getJsonAccessor(map);
}
}
var root = this.getRoot(o), c = root.length, totalRecords = c, success = true;
if(s.totalProperty){
var v = parseInt(this.getTotal(o), 10);
if(!isNaN(v)){
totalRecords = v;
}
}
if(s.successProperty){
var v = this.getSuccess(o);
if(v === false || v === 'false'){
success = false;
}
}
var records = [];
for(var i = 0; i < c; i++){
var n = root[i];
var values = {};
var id = this.getId(n);
for(var j = 0; j < fl; j++){
f = fi[j];
var v = this.ef[j](n);
values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue, n);
}
var record = new Record(values, id);
record.json = n;
records[i] = record;
}
return {
success : success,
records : records,
totalRecords : totalRecords
};
}
});
Ext.data.XmlReader = function(meta, recordType){
meta = meta || {};
Ext.data.XmlReader.superclass.constructor.call(this, meta, recordType || meta.fields);
};
Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, {
read : function(response){
var doc = response.responseXML;
if(!doc) {
throw {message: "XmlReader.read: XML Document not available"};
}
return this.readRecords(doc);
},
readRecords : function(doc){
this.xmlData = doc;
var root = doc.documentElement || doc;
var q = Ext.DomQuery;
var recordType = this.recordType, fields = recordType.prototype.fields;
var sid = this.meta.id;
var totalRecords = 0, success = true;
if(this.meta.totalRecords){
totalRecords = q.selectNumber(this.meta.totalRecords, root, 0);
}
if(this.meta.success){
var sv = q.selectValue(this.meta.success, root, true);
success = sv !== false && sv !== 'false';
}
var records = [];
var ns = q.select(this.meta.record, root);
for(var i = 0, len = ns.length; i < len; i++) {
var n = ns[i];
var values = {};
var id = sid ? q.selectValue(sid, n) : undefined;
for(var j = 0, jlen = fields.length; j < jlen; j++){
var f = fields.items[j];
var v = q.selectValue(f.mapping || f.name, n, f.defaultValue);
v = f.convert(v, n);
values[f.name] = v;
}
var record = new recordType(values, id);
record.node = n;
records[records.length] = record;
}
return {
success : success,
records : records,
totalRecords : totalRecords || records.length
};
}
});
Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, {
readRecords : function(o){
var sid = this.meta ? this.meta.id : null;
var recordType = this.recordType, fields = recordType.prototype.fields;
var records = [];
var root = o;
for(var i = 0; i < root.length; i++){
var n = root[i];
var values = {};
var 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];
var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j;
var 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;
}
return {
records : records,
totalRecords : records.length
};
}
});
Ext.data.Tree = function(root){
this.nodeHash = {};
this.root = null;
if(root){
this.setRootNode(root);
}
this.addEvents(
"append",
"remove",
"move",
"insert",
"beforeappend",
"beforeremove",
"beforemove",
"beforeinsert"
);
Ext.data.Tree.superclass.constructor.call(this);
};
Ext.extend(Ext.data.Tree, Ext.util.Observable, {
pathSeparator: "/",
proxyNodeEvent : function(){
return this.fireEvent.apply(this, arguments);
},
getRootNode : function(){
return this.root;
},
setRootNode : function(node){
this.root = node;
node.ownerTree = this;
node.isRoot = true;
this.registerNode(node);
return node;
},
getNodeById : function(id){
return this.nodeHash[id];
},
registerNode : function(node){
this.nodeHash[node.id] = node;
},
unregisterNode : function(node){
delete this.nodeHash[node.id];
},
toString : function(){
return "[Tree"+(this.id?" "+this.id:"")+"]";
}
});
Ext.data.Node = function(attributes){
this.attributes = attributes || {};
this.leaf = this.attributes.leaf;
this.id = this.attributes.id;
if(!this.id){
this.id = Ext.id(null, "ynode-");
this.attributes.id = this.id;
}
this.childNodes = [];
if(!this.childNodes.indexOf){
this.childNodes.indexOf = function(o){
for(var i = 0, len = this.length; i < len; i++){
if(this[i] == o) return i;
}
return -1;
};
}
this.parentNode = null;
this.firstChild = null;
this.lastChild = null;
this.previousSibling = null;
this.nextSibling = null;
this.addEvents({
"append" : true,
"remove" : true,
"move" : true,
"insert" : true,
"beforeappend" : true,
"beforeremove" : true,
"beforemove" : true,
"beforeinsert" : true
});
this.listeners = this.attributes.listeners;
Ext.data.Node.superclass.constructor.call(this);
};
Ext.extend(Ext.data.Node, Ext.util.Observable, {
fireEvent : function(evtName){
if(Ext.data.Node.superclass.fireEvent.apply(this, arguments) === false){
return false;
}
var ot = this.getOwnerTree();
if(ot){
if(ot.proxyNodeEvent.apply(ot, arguments) === false){
return false;
}
}
return true;
},
isLeaf : function(){
return this.leaf === true;
},
setFirstChild : function(node){
this.firstChild = node;
},
setLastChild : function(node){
this.lastChild = node;
},
isLast : function(){
return (!this.parentNode ? true : this.parentNode.lastChild == this);
},
isFirst : function(){
return (!this.parentNode ? true : this.parentNode.firstChild == this);
},
hasChildNodes : function(){
return !this.isLeaf() && this.childNodes.length > 0;
},
appendChild : function(node){
var multi = false;
if(Ext.isArray(node)){
multi = node;
}else if(arguments.length > 1){
multi = arguments;
}
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;
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;
}
},
removeChild : function(node){
var index = this.childNodes.indexOf(node);
if(index == -1){
return false;
}
if(this.fireEvent("beforeremove", this.ownerTree, this, node) === false){
return false;
}
this.childNodes.splice(index, 1);
if(node.previousSibling){
node.previousSibling.nextSibling = node.nextSibling;
}
if(node.nextSibling){
node.nextSibling.previousSibling = node.previousSibling;
}
if(this.firstChild == node){
this.setFirstChild(node.nextSibling);
}
if(this.lastChild == node){
this.setLastChild(node.previousSibling);
}
node.setOwnerTree(null);
node.parentNode = null;
node.previousSibling = null;
node.nextSibling = null;
this.fireEvent("remove", this.ownerTree, this, node);
return node;
},
insertBefore : function(node, refNode){
if(!refNode){
return this.appendChild(node);
}
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;
if(oldParent == this && this.childNodes.indexOf(node) < index){
refIndex--;
}
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;
},
remove : function(){
this.parentNode.removeChild(this);
return this;
},
item : function(index){
return this.childNodes[index];
},
replaceChild : function(newChild, oldChild){
this.insertBefore(newChild, oldChild);
this.removeChild(oldChild);
return oldChild;
},
indexOf : function(child){
return this.childNodes.indexOf(child);
},
getOwnerTree : function(){
if(!this.ownerTree){
var p = this;
while(p){
if(p.ownerTree){
this.ownerTree = p.ownerTree;
break;
}
p = p.parentNode;
}
}
return this.ownerTree;
},
getDepth : function(){
var depth = 0;
var p = this;
while(p.parentNode){
++depth;
p = p.parentNode;
}
return depth;
},
setOwnerTree : function(tree){
if(tree != this.ownerTree){
if(this.ownerTree){
this.ownerTree.unregisterNode(this);
}
this.ownerTree = tree;
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++) {
cs[i].setOwnerTree(tree);
}
if(tree){
tree.registerNode(this);
}
}
},
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);
},
bubble : function(fn, scope, args){
var p = this;
while(p){
if(fn.apply(scope || p, args || [p]) === false){
break;
}
p = p.parentNode;
}
},
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);
}
}
},
eachChild : function(fn, scope, args){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++) {
if(fn.apply(scope || this, args || [cs[i]]) === false){
break;
}
}
},
findChild : function(attribute, value){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++) {
if(cs[i].attributes[attribute] == value){
return cs[i];
}
}
return null;
},
findChildBy : function(fn, scope){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++) {
if(fn.call(scope||cs[i], cs[i]) === true){
return cs[i];
}
}
return null;
},
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);
}
}
}
},
contains : function(node){
return node.isAncestor(this);
},
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:"")+"]";
}
});
Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {
remoteGroup : false,
groupOnSort:false,
clearGrouping : function(){
this.groupField = false;
if(this.remoteGroup){
if(this.baseParams){
delete this.baseParams.groupBy;
}
this.reload();
}else{
this.applySort();
this.fireEvent('datachanged', this);
}
},
groupBy : function(field, forceRegroup){
if(this.groupField == field && !forceRegroup){
return;
}
this.groupField = field;
if(this.remoteGroup){
if(!this.baseParams){
this.baseParams = {};
}
this.baseParams['groupBy'] = field;
}
if(this.groupOnSort){
this.sort(field);
return;
}
if(this.remoteGroup){
this.reload();
}else{
var si = this.sortInfo || {};
if(si.field != field){
this.applySort();
}else{
this.sortData(field);
}
this.fireEvent('datachanged', this);
}
},
applySort : function(){
Ext.data.GroupingStore.superclass.applySort.call(this);
if(!this.groupOnSort && !this.remoteGroup){
var gs = this.getGroupState();
if(gs && gs != this.sortInfo.field){
this.sortData(this.groupField);
}
}
},
applyGrouping : function(alwaysFireChange){
if(this.groupField !== false){
this.groupBy(this.groupField, true);
return true;
}else{
if(alwaysFireChange === true){
this.fireEvent('datachanged', this);
}
return false;
}
},
getGroupState : function(){
return this.groupOnSort && this.groupField !== false ?
(this.sortInfo ? this.sortInfo.field : undefined) : this.groupField;
}
});
Ext.ComponentMgr = function(){
var all = new Ext.util.MixedCollection();
var types = {};
return {
register : function(c){
all.add(c);
},
unregister : function(c){
all.remove(c);
},
get : function(id){
return all.get(id);
},
onAvailable : function(id, fn, scope){
all.on("add", function(index, o){
if(o.id == id){
fn.call(scope || o, o);
all.un("add", fn, scope);
}
});
},
all : all,
registerType : function(xtype, cls){
types[xtype] = cls;
cls.xtype = xtype;
},
create : function(config, defaultType){
return new types[config.xtype || defaultType](config);
}
};
}();
Ext.reg = Ext.ComponentMgr.registerType;
Ext.Component = function(config){
config = config || {};
if(config.initialConfig){
if(config.isAction){ this.baseAction = config;
}
config = config.initialConfig; }else if(config.tagName || config.dom || typeof config == "string"){ config = {applyTo: config, id: config.id || config};
}
this.initialConfig = config;
Ext.apply(this, config);
this.addEvents(
'disable',
'enable',
'beforeshow',
'show',
'beforehide',
'hide',
'beforerender',
'render',
'beforedestroy',
'destroy',
'beforestaterestore',
'staterestore',
'beforestatesave',
'statesave'
);
this.getId();
Ext.ComponentMgr.register(this);
Ext.Component.superclass.constructor.call(this);
if(this.baseAction){
this.baseAction.addComponent(this);
}
this.initComponent();
if(this.plugins){
if(Ext.isArray(this.plugins)){
for(var i = 0, len = this.plugins.length; i < len; i++){
this.plugins[i].init(this);
}
}else{
this.plugins.init(this);
}
}
if(this.stateful !== false){
this.initState(config);
}
if(this.applyTo){
this.applyToMarkup(this.applyTo);
delete this.applyTo;
}else if(this.renderTo){
this.render(this.renderTo);
delete this.renderTo;
}
};
Ext.Component.AUTO_ID = 1000;
Ext.extend(Ext.Component, Ext.util.Observable, {
disabledClass : "x-item-disabled",
allowDomMove : true,
autoShow : false,
hideMode: 'display',
hideParent: false,
hidden : false,
disabled : false,
rendered : false,
ctype : "Ext.Component",
actionMode : "el",
getActionEl : function(){
return this[this.actionMode];
},
initComponent : Ext.emptyFn,
render : function(container, position){
if(!this.rendered && this.fireEvent("beforerender", this) !== false){
if(!container && this.el){
this.el = Ext.get(this.el);
container = this.el.dom.parentNode;
this.allowDomMove = false;
}
this.container = Ext.get(container);
if(this.ctCls){
this.container.addClass(this.ctCls);
}
this.rendered = true;
if(position !== undefined){
if(typeof position == 'number'){
position = this.container.dom.childNodes[position];
}else{
position = Ext.getDom(position);
}
}
this.onRender(this.container, position || null);
if(this.autoShow){
this.el.removeClass(['x-hidden','x-hide-' + this.hideMode]);
}
if(this.cls){
this.el.addClass(this.cls);
delete this.cls;
}
if(this.style){
this.el.applyStyles(this.style);
delete this.style;
}
this.fireEvent("render", this);
this.afterRender(this.container);
if(this.hidden){
this.hide();
}
if(this.disabled){
this.disable();
}
this.initStateEvents();
}
return this;
},
initState : function(config){
if(Ext.state.Manager){
var state = Ext.state.Manager.get(this.stateId || this.id);
if(state){
if(this.fireEvent('beforestaterestore', this, state) !== false){
this.applyState(state);
this.fireEvent('staterestore', this, state);
}
}
}
},
initStateEvents : function(){
if(this.stateEvents){
for(var i = 0, e; e = this.stateEvents[i]; i++){
this.on(e, this.saveState, this, {delay:100});
}
}
},
applyState : function(state, config){
if(state){
Ext.apply(this, state);
}
},
getState : function(){
return null;
},
saveState : function(){
if(Ext.state.Manager){
var state = this.getState();
if(this.fireEvent('beforestatesave', this, state) !== false){
Ext.state.Manager.set(this.stateId || this.id, state);
this.fireEvent('statesave', this, state);
}
}
},
applyToMarkup : function(el){
this.allowDomMove = false;
this.el = Ext.get(el);
this.render(this.el.dom.parentNode);
},
addClass : function(cls){
if(this.el){
this.el.addClass(cls);
}else{
this.cls = this.cls ? this.cls + ' ' + cls : cls;
}
},
removeClass : function(cls){
if(this.el){
this.el.removeClass(cls);
}else if(this.cls){
this.cls = this.cls.split(' ').remove(cls).join(' ');
}
},
onRender : function(ct, position){
if(this.autoEl){
if(typeof this.autoEl == 'string'){
this.el = document.createElement(this.autoEl);
}else{
var div = document.createElement('div');
Ext.DomHelper.overwrite(div, this.autoEl);
this.el = div.firstChild;
}
if (!this.el.id) {
this.el.id = this.getId();
}
}
if(this.el){
this.el = Ext.get(this.el);
if(this.allowDomMove !== false){
ct.dom.insertBefore(this.el.dom, position);
}
}
},
getAutoCreate : function(){
var cfg = typeof this.autoCreate == "object" ?
this.autoCreate : Ext.apply({}, this.defaultAutoCreate);
if(this.id && !cfg.id){
cfg.id = this.id;
}
return cfg;
},
afterRender : Ext.emptyFn,
destroy : function(){
if(this.fireEvent("beforedestroy", this) !== false){
this.beforeDestroy();
if(this.rendered){
this.el.removeAllListeners();
this.el.remove();
if(this.actionMode == "container"){
this.container.remove();
}
}
this.onDestroy();
Ext.ComponentMgr.unregister(this);
this.fireEvent("destroy", this);
this.purgeListeners();
}
},
beforeDestroy : Ext.emptyFn,
onDestroy : Ext.emptyFn,
getEl : function(){
return this.el;
},
getId : function(){
return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID));
},
getItemId : function(){
return this.itemId || this.getId();
},
focus : function(selectText, delay){
if(delay){
this.focus.defer(typeof delay == 'number' ? delay : 10, this, [selectText, false]);
return;
}
if(this.rendered){
this.el.focus();
if(selectText === true){
this.el.dom.select();
}
}
return this;
},
blur : function(){
if(this.rendered){
this.el.blur();
}
return this;
},
disable : function(){
if(this.rendered){
this.onDisable();
}
this.disabled = true;
this.fireEvent("disable", this);
return this;
},
onDisable : function(){
this.getActionEl().addClass(this.disabledClass);
this.el.dom.disabled = true;
},
enable : function(){
if(this.rendered){
this.onEnable();
}
this.disabled = false;
this.fireEvent("enable", this);
return this;
},
onEnable : function(){
this.getActionEl().removeClass(this.disabledClass);
this.el.dom.disabled = false;
},
setDisabled : function(disabled){
this[disabled ? "disable" : "enable"]();
},
show: function(){
if(this.fireEvent("beforeshow", this) !== false){
this.hidden = false;
if(this.autoRender){
this.render(typeof this.autoRender == 'boolean' ? Ext.getBody() : this.autoRender);
}
if(this.rendered){
this.onShow();
}
this.fireEvent("show", this);
}
return this;
},
onShow : function(){
if(this.hideParent){
this.container.removeClass('x-hide-' + this.hideMode);
}else{
this.getActionEl().removeClass('x-hide-' + this.hideMode);
}
},
hide: function(){
if(this.fireEvent("beforehide", this) !== false){
this.hidden = true;
if(this.rendered){
this.onHide();
}
this.fireEvent("hide", this);
}
return this;
},
onHide : function(){
if(this.hideParent){
this.container.addClass('x-hide-' + this.hideMode);
}else{
this.getActionEl().addClass('x-hide-' + this.hideMode);
}
},
setVisible: function(visible){
if(visible) {
this.show();
}else{
this.hide();
}
return this;
},
isVisible : function(){
return this.rendered && this.getActionEl().isVisible();
},
cloneConfig : function(overrides){
overrides = overrides || {};
var id = overrides.id || Ext.id();
var cfg = Ext.applyIf(overrides, this.initialConfig);
cfg.id = id; return new this.constructor(cfg);
},
getXType : function(){
return this.constructor.xtype;
},
isXType : function(xtype, shallow){
return !shallow ?
('/' + this.getXTypes() + '/').indexOf('/' + xtype + '/') != -1 :
this.constructor.xtype == xtype;
},
getXTypes : function(){
var tc = this.constructor;
if(!tc.xtypes){
var c = [], sc = this;
while(sc && sc.constructor.xtype){
c.unshift(sc.constructor.xtype);
sc = sc.constructor.superclass;
}
tc.xtypeChain = c;
tc.xtypes = c.join('/');
}
return tc.xtypes;
},
findParentBy: function(fn) {
for (var p = this.ownerCt; (p != null) && !fn(p, this); p = p.ownerCt);
return p || null;
},
findParentByType: function(xtype) {
return typeof xtype == 'function' ?
this.findParentBy(function(p){
return p.constructor === xtype;
}) :
this.findParentBy(function(p){
return p.constructor.xtype === xtype;
});
}
});
Ext.reg('component', Ext.Component);
Ext.Action = function(config){
this.initialConfig = config;
this.items = [];
}
Ext.Action.prototype = {
isAction : true,
setText : function(text){
this.initialConfig.text = text;
this.callEach('setText', [text]);
},
getText : function(){
return this.initialConfig.text;
},
setIconClass : function(cls){
this.initialConfig.iconCls = cls;
this.callEach('setIconClass', [cls]);
},
getIconClass : function(){
return this.initialConfig.iconCls;
},
setDisabled : function(v){
this.initialConfig.disabled = v;
this.callEach('setDisabled', [v]);
},
enable : function(){
this.setDisabled(false);
},
disable : function(){
this.setDisabled(true);
},
isDisabled : function(){
return this.initialConfig.disabled;
},
setHidden : function(v){
this.initialConfig.hidden = v;
this.callEach('setVisible', [!v]);
},
show : function(){
this.setHidden(false);
},
hide : function(){
this.setHidden(true);
},
isHidden : function(){
return this.initialConfig.hidden;
},
setHandler : function(fn, scope){
this.initialConfig.handler = fn;
this.initialConfig.scope = scope;
this.callEach('setHandler', [fn, scope]);
},
each : function(fn, scope){
Ext.each(this.items, fn, scope);
},
callEach : function(fnName, args){
var cs = this.items;
for(var i = 0, len = cs.length; i < len; i++){
cs[i][fnName].apply(cs[i], args);
}
},
addComponent : function(comp){
this.items.push(comp);
comp.on('destroy', this.removeComponent, this);
},
removeComponent : function(comp){
this.items.remove(comp);
},
execute : function(){
this.initialConfig.handler.apply(this.initialConfig.scope || window, arguments);
}
};
(function(){
Ext.Layer = function(config, existingEl){
config = config || {};
var dh = Ext.DomHelper;
var cp = config.parentEl, pel = cp ? Ext.getDom(cp) : document.body;
if(existingEl){
this.dom = Ext.getDom(existingEl);
}
if(!this.dom){
var o = config.dh || {tag: "div", cls: "x-layer"};
this.dom = dh.append(pel, o);
}
if(config.cls){
this.addClass(config.cls);
}
this.constrain = config.constrain !== false;
this.visibilityMode = Ext.Element.VISIBILITY;
if(config.id){
this.id = this.dom.id = config.id;
}else{
this.id = Ext.id(this.dom);
}
this.zindex = config.zindex || this.getZIndex();
this.position("absolute", this.zindex);
if(config.shadow){
this.shadowOffset = config.shadowOffset || 4;
this.shadow = new Ext.Shadow({
offset : this.shadowOffset,
mode : config.shadow
});
}else{
this.shadowOffset = 0;
}
this.useShim = config.shim !== false && Ext.useShims;
this.useDisplay = config.useDisplay;
this.hide();
};
var supr = Ext.Element.prototype;
var shims = [];
Ext.extend(Ext.Layer, Ext.Element, {
getZIndex : function(){
return this.zindex || parseInt(this.getStyle("z-index"), 10) || 11000;
},
getShim : function(){
if(!this.useShim){
return null;
}
if(this.shim){
return this.shim;
}
var shim = shims.shift();
if(!shim){
shim = this.createShim();
shim.enableDisplayMode('block');
shim.dom.style.display = 'none';
shim.dom.style.visibility = 'visible';
}
var pn = this.dom.parentNode;
if(shim.dom.parentNode != pn){
pn.insertBefore(shim.dom, this.dom);
}
shim.setStyle('z-index', this.getZIndex()-2);
this.shim = shim;
return shim;
},
hideShim : function(){
if(this.shim){
this.shim.setDisplayed(false);
shims.push(this.shim);
delete this.shim;
}
},
disableShadow : function(){
if(this.shadow){
this.shadowDisabled = true;
this.shadow.hide();
this.lastShadowOffset = this.shadowOffset;
this.shadowOffset = 0;
}
},
enableShadow : function(show){
if(this.shadow){
this.shadowDisabled = false;
this.shadowOffset = this.lastShadowOffset;
delete this.lastShadowOffset;
if(show){
this.sync(true);
}
}
},
sync : function(doShow){
var sw = this.shadow;
if(!this.updating && this.isVisible() && (sw || this.useShim)){
var sh = this.getShim();
var w = this.getWidth(),
h = this.getHeight();
var l = this.getLeft(true),
t = this.getTop(true);
if(sw && !this.shadowDisabled){
if(doShow && !sw.isVisible()){
sw.show(this);
}else{
sw.realign(l, t, w, h);
}
if(sh){
if(doShow){
sh.show();
}
var a = sw.adjusts, s = sh.dom.style;
s.left = (Math.min(l, l+a.l))+"px";
s.top = (Math.min(t, t+a.t))+"px";
s.width = (w+a.w)+"px";
s.height = (h+a.h)+"px";
}
}else if(sh){
if(doShow){
sh.show();
}
sh.setSize(w, h);
sh.setLeftTop(l, t);
}
}
},
destroy : function(){
this.hideShim();
if(this.shadow){
this.shadow.hide();
}
this.removeAllListeners();
Ext.removeNode(this.dom);
Ext.Element.uncache(this.id);
},
remove : function(){
this.destroy();
},
beginUpdate : function(){
this.updating = true;
},
endUpdate : function(){
this.updating = false;
this.sync(true);
},
hideUnders : function(negOffset){
if(this.shadow){
this.shadow.hide();
}
this.hideShim();
},
constrainXY : function(){
if(this.constrain){
var vw = Ext.lib.Dom.getViewWidth(),
vh = Ext.lib.Dom.getViewHeight();
var s = Ext.getDoc().getScroll();
var xy = this.getXY();
var x = xy[0], y = xy[1];
var w = this.dom.offsetWidth+this.shadowOffset, h = this.dom.offsetHeight+this.shadowOffset;
var moved = false;
if((x + w) > vw+s.left){
x = vw - w - this.shadowOffset;
moved = true;
}
if((y + h) > vh+s.top){
y = vh - h - this.shadowOffset;
moved = true;
}
if(x < s.left){
x = s.left;
moved = true;
}
if(y < s.top){
y = s.top;
moved = true;
}
if(moved){
if(this.avoidY){
var ay = this.avoidY;
if(y <= ay && (y+h) >= ay){
y = ay-h-5;
}
}
xy = [x, y];
this.storeXY(xy);
supr.setXY.call(this, xy);
this.sync();
}
}
},
isVisible : function(){
return this.visible;
},
showAction : function(){
this.visible = true;
if(this.useDisplay === true){
this.setDisplayed("");
}else if(this.lastXY){
supr.setXY.call(this, this.lastXY);
}else if(this.lastLT){
supr.setLeftTop.call(this, this.lastLT[0], this.lastLT[1]);
}
},
hideAction : function(){
this.visible = false;
if(this.useDisplay === true){
this.setDisplayed(false);
}else{
this.setLeftTop(-10000,-10000);
}
},
setVisible : function(v, a, d, c, e){
if(v){
this.showAction();
}
if(a && v){
var cb = function(){
this.sync(true);
if(c){
c();
}
}.createDelegate(this);
supr.setVisible.call(this, true, true, d, cb, e);
}else{
if(!v){
this.hideUnders(true);
}
var cb = c;
if(a){
cb = function(){
this.hideAction();
if(c){
c();
}
}.createDelegate(this);
}
supr.setVisible.call(this, v, a, d, cb, e);
if(v){
this.sync(true);
}else if(!a){
this.hideAction();
}
}
},
storeXY : function(xy){
delete this.lastLT;
this.lastXY = xy;
},
storeLeftTop : function(left, top){
delete this.lastXY;
this.lastLT = [left, top];
},
beforeFx : function(){
this.beforeAction();
return Ext.Layer.superclass.beforeFx.apply(this, arguments);
},
afterFx : function(){
Ext.Layer.superclass.afterFx.apply(this, arguments);
this.sync(this.isVisible());
},
beforeAction : function(){
if(!this.updating && this.shadow){
this.shadow.hide();
}
},
setLeft : function(left){
this.storeLeftTop(left, this.getTop(true));
supr.setLeft.apply(this, arguments);
this.sync();
},
setTop : function(top){
this.storeLeftTop(this.getLeft(true), top);
supr.setTop.apply(this, arguments);
this.sync();
},
setLeftTop : function(left, top){
this.storeLeftTop(left, top);
supr.setLeftTop.apply(this, arguments);
this.sync();
},
setXY : function(xy, a, d, c, e){
this.fixDisplay();
this.beforeAction();
this.storeXY(xy);
var cb = this.createCB(c);
supr.setXY.call(this, xy, a, d, cb, e);
if(!a){
cb();
}
},
createCB : function(c){
var el = this;
return function(){
el.constrainXY();
el.sync(true);
if(c){
c();
}
};
},
setX : function(x, a, d, c, e){
this.setXY([x, this.getY()], a, d, c, e);
},
setY : function(y, a, d, c, e){
this.setXY([this.getX(), y], a, d, c, e);
},
setSize : function(w, h, a, d, c, e){
this.beforeAction();
var cb = this.createCB(c);
supr.setSize.call(this, w, h, a, d, cb, e);
if(!a){
cb();
}
},
setWidth : function(w, a, d, c, e){
this.beforeAction();
var cb = this.createCB(c);
supr.setWidth.call(this, w, a, d, cb, e);
if(!a){
cb();
}
},
setHeight : function(h, a, d, c, e){
this.beforeAction();
var cb = this.createCB(c);
supr.setHeight.call(this, h, a, d, cb, e);
if(!a){
cb();
}
},
setBounds : function(x, y, w, h, a, d, c, e){
this.beforeAction();
var cb = this.createCB(c);
if(!a){
this.storeXY([x, y]);
supr.setXY.call(this, [x, y]);
supr.setSize.call(this, w, h, a, d, cb, e);
cb();
}else{
supr.setBounds.call(this, x, y, w, h, a, d, cb, e);
}
return this;
},
setZIndex : function(zindex){
this.zindex = zindex;
this.setStyle("z-index", zindex + 2);
if(this.shadow){
this.shadow.setZIndex(zindex + 1);
}
if(this.shim){
this.shim.setStyle("z-index", zindex);
}
}
});
})();
Ext.Shadow = function(config){
Ext.apply(this, config);
if(typeof this.mode != "string"){
this.mode = this.defaultMode;
}
var o = this.offset, a = {h: 0};
var rad = Math.floor(this.offset/2);
switch(this.mode.toLowerCase()){ case "drop":
a.w = 0;
a.l = a.t = o;
a.t -= 1;
if(Ext.isIE){
a.l -= this.offset + rad;
a.t -= this.offset + rad;
a.w -= rad;
a.h -= rad;
a.t += 1;
}
break;
case "sides":
a.w = (o*2);
a.l = -o;
a.t = o-1;
if(Ext.isIE){
a.l -= (this.offset - rad);
a.t -= this.offset + rad;
a.l += 1;
a.w -= (this.offset - rad)*2;
a.w -= rad + 1;
a.h -= 1;
}
break;
case "frame":
a.w = a.h = (o*2);
a.l = a.t = -o;
a.t += 1;
a.h -= 2;
if(Ext.isIE){
a.l -= (this.offset - rad);
a.t -= (this.offset - rad);
a.l += 1;
a.w -= (this.offset + rad + 1);
a.h -= (this.offset + rad);
a.h += 1;
}
break;
};
this.adjusts = a;
};
Ext.Shadow.prototype = {
offset: 4,
defaultMode: "drop",
show : function(target){
target = Ext.get(target);
if(!this.el){
this.el = Ext.Shadow.Pool.pull();
if(this.el.dom.nextSibling != target.dom){
this.el.insertBefore(target);
}
}
this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10)-1);
if(Ext.isIE){
this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";
}
this.realign(
target.getLeft(true),
target.getTop(true),
target.getWidth(),
target.getHeight()
);
this.el.dom.style.display = "block";
},
isVisible : function(){
return this.el ? true : false;
},
realign : function(l, t, w, h){
if(!this.el){
return;
}
var a = this.adjusts, d = this.el.dom, s = d.style;
var iea = 0;
s.left = (l+a.l)+"px";
s.top = (t+a.t)+"px";
var sw = (w+a.w), sh = (h+a.h), sws = sw +"px", shs = sh + "px";
if(s.width != sws || s.height != shs){
s.width = sws;
s.height = shs;
if(!Ext.isIE){
var cn = d.childNodes;
var sww = Math.max(0, (sw-12))+"px";
cn[0].childNodes[1].style.width = sww;
cn[1].childNodes[1].style.width = sww;
cn[2].childNodes[1].style.width = sww;
cn[1].style.height = Math.max(0, (sh-12))+"px";
}
}
},
hide : function(){
if(this.el){
this.el.dom.style.display = "none";
Ext.Shadow.Pool.push(this.el);
delete this.el;
}
},
setZIndex : function(z){
this.zIndex = z;
if(this.el){
this.el.setStyle("z-index", z);
}
}
};
Ext.Shadow.Pool = function(){
var p = [];
var markup = Ext.isIE ?
'<div class="x-ie-shadow"></div>' :
'<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';
return {
pull : function(){
var sh = p.shift();
if(!sh){
sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup));
sh.autoBoxAdjust = false;
}
return sh;
},
push : function(sh){
p.push(sh);
}
};
}();
Ext.BoxComponent = Ext.extend(Ext.Component, {
initComponent : function(){
Ext.BoxComponent.superclass.initComponent.call(this);
this.addEvents(
'resize',
'move'
);
},
boxReady : false,
deferHeight: false,
setSize : function(w, h){
if(typeof w == 'object'){
h = w.height;
w = w.width;
}
if(!this.boxReady){
this.width = w;
this.height = h;
return this;
}
if(this.lastSize && this.lastSize.width == w && this.lastSize.height == h){
return this;
}
this.lastSize = {width: w, height: h};
var adj = this.adjustSize(w, h);
var aw = adj.width, ah = adj.height;
if(aw !== undefined || ah !== undefined){ var rz = this.getResizeEl();
if(!this.deferHeight && aw !== undefined && ah !== undefined){
rz.setSize(aw, ah);
}else if(!this.deferHeight && ah !== undefined){
rz.setHeight(ah);
}else if(aw !== undefined){
rz.setWidth(aw);
}
this.onResize(aw, ah, w, h);
this.fireEvent('resize', this, aw, ah, w, h);
}
return this;
},
setWidth : function(width){
return this.setSize(width);
},
setHeight : function(height){
return this.setSize(undefined, height);
},
getSize : function(){
return this.el.getSize();
},
getPosition : function(local){
if(local === true){
return [this.el.getLeft(true), this.el.getTop(true)];
}
return this.xy || this.el.getXY();
},
getBox : function(local){
var s = this.el.getSize();
if(local === true){
s.x = this.el.getLeft(true);
s.y = this.el.getTop(true);
}else{
var xy = this.xy || this.el.getXY();
s.x = xy[0];
s.y = xy[1];
}
return s;
},
updateBox : function(box){
this.setSize(box.width, box.height);
this.setPagePosition(box.x, box.y);
return this;
},
getResizeEl : function(){
return this.resizeEl || this.el;
},
getPositionEl : function(){
return this.positionEl || this.el;
},
setPosition : function(x, y){
if(x && typeof x[1] == 'number'){
y = x[1];
x = x[0];
}
this.x = x;
this.y = y;
if(!this.boxReady){
return this;
}
var adj = this.adjustPosition(x, y);
var ax = adj.x, ay = adj.y;
var el = this.getPositionEl();
if(ax !== undefined || ay !== undefined){
if(ax !== undefined && ay !== undefined){
el.setLeftTop(ax, ay);
}else if(ax !== undefined){
el.setLeft(ax);
}else if(ay !== undefined){
el.setTop(ay);
}
this.onPosition(ax, ay);
this.fireEvent('move', this, ax, ay);
}
return this;
},
setPagePosition : function(x, y){
if(x && typeof x[1] == 'number'){
y = x[1];
x = x[0];
}
this.pageX = x;
this.pageY = y;
if(!this.boxReady){
return;
}
if(x === undefined || y === undefined){ return;
}
var p = this.el.translatePoints(x, y);
this.setPosition(p.left, p.top);
return this;
},
onRender : function(ct, position){
Ext.BoxComponent.superclass.onRender.call(this, ct, position);
if(this.resizeEl){
this.resizeEl = Ext.get(this.resizeEl);
}
if(this.positionEl){
this.positionEl = Ext.get(this.positionEl);
}
},
afterRender : function(){
Ext.BoxComponent.superclass.afterRender.call(this);
this.boxReady = true;
this.setSize(this.width, this.height);
if(this.x || this.y){
this.setPosition(this.x, this.y);
}else if(this.pageX || this.pageY){
this.setPagePosition(this.pageX, this.pageY);
}
},
syncSize : function(){
delete this.lastSize;
this.setSize(this.autoWidth ? undefined : this.el.getWidth(), this.autoHeight ? undefined : this.el.getHeight());
return this;
},
onResize : function(adjWidth, adjHeight, rawWidth, rawHeight){
},
onPosition : function(x, y){
},
adjustSize : function(w, h){
if(this.autoWidth){
w = 'auto';
}
if(this.autoHeight){
h = 'auto';
}
return {width : w, height: h};
},
adjustPosition : function(x, y){
return {x : x, y: y};
}
});
Ext.reg('box', Ext.BoxComponent);
Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){
this.el = Ext.get(dragElement, true);
this.el.dom.unselectable = "on";
this.resizingEl = Ext.get(resizingElement, true);
this.orientation = orientation || Ext.SplitBar.HORIZONTAL;
this.minSize = 0;
this.maxSize = 2000;
this.animate = false;
this.useShim = false;
this.shim = null;
if(!existingProxy){
this.proxy = Ext.SplitBar.createProxy(this.orientation);
}else{
this.proxy = Ext.get(existingProxy).dom;
}
this.dd = new Ext.dd.DDProxy(this.el.dom.id, "XSplitBars", {dragElId : this.proxy.id});
this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this);
this.dd.endDrag = this.onEndProxyDrag.createDelegate(this);
this.dragSpecs = {};
this.adapter = new Ext.SplitBar.BasicLayoutAdapter();
this.adapter.init(this);
if(this.orientation == Ext.SplitBar.HORIZONTAL){
this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? Ext.SplitBar.LEFT : Ext.SplitBar.RIGHT);
this.el.addClass("x-splitbar-h");
}else{
this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? Ext.SplitBar.TOP : Ext.SplitBar.BOTTOM);
this.el.addClass("x-splitbar-v");
}
this.addEvents(
"resize",
"moved",
"beforeresize",
"beforeapply"
);
Ext.SplitBar.superclass.constructor.call(this);
};
Ext.extend(Ext.SplitBar, Ext.util.Observable, {
onStartProxyDrag : function(x, y){
this.fireEvent("beforeresize", this);
this.overlay = Ext.DomHelper.append(document.body, {cls: "x-drag-overlay", html: " "}, true);
this.overlay.unselectable();
this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
this.overlay.show();
Ext.get(this.proxy).setDisplayed("block");
var size = this.adapter.getElementSize(this);
this.activeMinSize = this.getMinimumSize();;
this.activeMaxSize = this.getMaximumSize();;
var c1 = size - this.activeMinSize;
var c2 = Math.max(this.activeMaxSize - size, 0);
if(this.orientation == Ext.SplitBar.HORIZONTAL){
this.dd.resetConstraints();
this.dd.setXConstraint(
this.placement == Ext.SplitBar.LEFT ? c1 : c2,
this.placement == Ext.SplitBar.LEFT ? c2 : c1
);
this.dd.setYConstraint(0, 0);
}else{
this.dd.resetConstraints();
this.dd.setXConstraint(0, 0);
this.dd.setYConstraint(
this.placement == Ext.SplitBar.TOP ? c1 : c2,
this.placement == Ext.SplitBar.TOP ? c2 : c1
);
}
this.dragSpecs.startSize = size;
this.dragSpecs.startPoint = [x, y];
Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd, x, y);
},
onEndProxyDrag : function(e){
Ext.get(this.proxy).setDisplayed(false);
var endPoint = Ext.lib.Event.getXY(e);
if(this.overlay){
this.overlay.remove();
delete this.overlay;
}
var newSize;
if(this.orientation == Ext.SplitBar.HORIZONTAL){
newSize = this.dragSpecs.startSize +
(this.placement == Ext.SplitBar.LEFT ?
endPoint[0] - this.dragSpecs.startPoint[0] :
this.dragSpecs.startPoint[0] - endPoint[0]
);
}else{
newSize = this.dragSpecs.startSize +
(this.placement == Ext.SplitBar.TOP ?
endPoint[1] - this.dragSpecs.startPoint[1] :
this.dragSpecs.startPoint[1] - endPoint[1]
);
}
newSize = Math.min(Math.max(newSize, this.activeMinSize), this.activeMaxSize);
if(newSize != this.dragSpecs.startSize){
if(this.fireEvent('beforeapply', this, newSize) !== false){
this.adapter.setElementSize(this, newSize);
this.fireEvent("moved", this, newSize);
this.fireEvent("resize", this, newSize);
}
}
},
getAdapter : function(){
return this.adapter;
},
setAdapter : function(adapter){
this.adapter = adapter;
this.adapter.init(this);
},
getMinimumSize : function(){
return this.minSize;
},
setMinimumSize : function(minSize){
this.minSize = minSize;
},
getMaximumSize : function(){
return this.maxSize;
},
setMaximumSize : function(maxSize){
this.maxSize = maxSize;
},
setCurrentSize : function(size){
var oldAnimate = this.animate;
this.animate = false;
this.adapter.setElementSize(this, size);
this.animate = oldAnimate;
},
destroy : function(removeEl){
if(this.shim){
this.shim.remove();
}
this.dd.unreg();
Ext.removeNode(this.proxy);
if(removeEl){
this.el.remove();
}
}
});
Ext.SplitBar.createProxy = function(dir){
var proxy = new Ext.Element(document.createElement("div"));
proxy.unselectable();
var cls = 'x-splitbar-proxy';
proxy.addClass(cls + ' ' + (dir == Ext.SplitBar.HORIZONTAL ? cls +'-h' : cls + '-v'));
document.body.appendChild(proxy.dom);
return proxy.dom;
};
Ext.SplitBar.BasicLayoutAdapter = function(){
};
Ext.SplitBar.BasicLayoutAdapter.prototype = {
init : function(s){
},
getElementSize : function(s){
if(s.orientation == Ext.SplitBar.HORIZONTAL){
return s.resizingEl.getWidth();
}else{
return s.resizingEl.getHeight();
}
},
setElementSize : function(s, newSize, onComplete){
if(s.orientation == Ext.SplitBar.HORIZONTAL){
if(!s.animate){
s.resizingEl.setWidth(newSize);
if(onComplete){
onComplete(s, newSize);
}
}else{
s.resizingEl.setWidth(newSize, true, .1, onComplete, 'easeOut');
}
}else{
if(!s.animate){
s.resizingEl.setHeight(newSize);
if(onComplete){
onComplete(s, newSize);
}
}else{
s.resizingEl.setHeight(newSize, true, .1, onComplete, 'easeOut');
}
}
}
};
Ext.SplitBar.AbsoluteLayoutAdapter = function(container){
this.basic = new Ext.SplitBar.BasicLayoutAdapter();
this.container = Ext.get(container);
};
Ext.SplitBar.AbsoluteLayoutAdapter.prototype = {
init : function(s){
this.basic.init(s);
},
getElementSize : function(s){
return this.basic.getElementSize(s);
},
setElementSize : function(s, newSize, onComplete){
this.basic.setElementSize(s, newSize, this.moveSplitter.createDelegate(this, [s]));
},
moveSplitter : function(s){
var yes = Ext.SplitBar;
switch(s.placement){
case yes.LEFT:
s.el.setX(s.resizingEl.getRight());
break;
case yes.RIGHT:
s.el.setStyle("right", (this.container.getWidth() - s.resizingEl.getLeft()) + "px");
break;
case yes.TOP:
s.el.setY(s.resizingEl.getBottom());
break;
case yes.BOTTOM:
s.el.setY(s.resizingEl.getTop() - s.el.getHeight());
break;
}
}
};
Ext.SplitBar.VERTICAL = 1;
Ext.SplitBar.HORIZONTAL = 2;
Ext.SplitBar.LEFT = 1;
Ext.SplitBar.RIGHT = 2;
Ext.SplitBar.TOP = 3;
Ext.SplitBar.BOTTOM = 4;
Ext.Container = Ext.extend(Ext.BoxComponent, {
autoDestroy: true,
defaultType: 'panel',
initComponent : function(){
Ext.Container.superclass.initComponent.call(this);
this.addEvents(
'afterlayout',
'beforeadd',
'beforeremove',
'add',
'remove'
);
var items = this.items;
if(items){
delete this.items;
if(Ext.isArray(items)){
this.add.apply(this, items);
}else{
this.add(items);
}
}
},
initItems : function(){
if(!this.items){
this.items = new Ext.util.MixedCollection(false, this.getComponentId);
this.getLayout(); }
},
setLayout : function(layout){
if(this.layout && this.layout != layout){
this.layout.setContainer(null);
}
this.initItems();
this.layout = layout;
layout.setContainer(this);
},
render : function(){
Ext.Container.superclass.render.apply(this, arguments);
if(this.layout){
if(typeof this.layout == 'string'){
this.layout = new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig);
}
this.setLayout(this.layout);
if(this.activeItem !== undefined){
var item = this.activeItem;
delete this.activeItem;
this.layout.setActiveItem(item);
return;
}
}
if(!this.ownerCt){
this.doLayout();
}
if(this.monitorResize === true){
Ext.EventManager.onWindowResize(this.doLayout, this, [false]);
}
},
getLayoutTarget : function(){
return this.el;
},
getComponentId : function(comp){
return comp.itemId || comp.id;
},
add : function(comp){
if(!this.items){
this.initItems();
}
var a = arguments, len = a.length;
if(len > 1){
for(var i = 0; i < len; i++) {
this.add(a[i]);
}
return;
}
var c = this.lookupComponent(this.applyDefaults(comp));
var pos = this.items.length;
if(this.fireEvent('beforeadd', this, c, pos) !== false && this.onBeforeAdd(c) !== false){
this.items.add(c);
c.ownerCt = this;
this.fireEvent('add', this, c, pos);
}
return c;
},
insert : function(index, comp){
if(!this.items){
this.initItems();
}
var a = arguments, len = a.length;
if(len > 2){
for(var i = len-1; i >= 1; --i) {
this.insert(index, a[i]);
}
return;
}
var c = this.lookupComponent(this.applyDefaults(comp));
if(c.ownerCt == this && this.items.indexOf(c) < index){
--index;
}
if(this.fireEvent('beforeadd', this, c, index) !== false && this.onBeforeAdd(c) !== false){
this.items.insert(index, c);
c.ownerCt = this;
this.fireEvent('add', this, c, index);
}
return c;
},
applyDefaults : function(c){
if(this.defaults){
if(typeof c == 'string'){
c = Ext.ComponentMgr.get(c);
Ext.apply(c, this.defaults);
}else if(!c.events){
Ext.applyIf(c, this.defaults);
}else{
Ext.apply(c, this.defaults);
}
}
return c;
},
onBeforeAdd : function(item){
if(item.ownerCt){
item.ownerCt.remove(item, false);
}
if(this.hideBorders === true){
item.border = (item.border === true);
}
},
remove : function(comp, autoDestroy){
var c = this.getComponent(comp);
if(c && this.fireEvent('beforeremove', this, c) !== false){
this.items.remove(c);
delete c.ownerCt;
if(autoDestroy === true || (autoDestroy !== false && this.autoDestroy)){
c.destroy();
}
if(this.layout && this.layout.activeItem == c){
delete this.layout.activeItem;
}
this.fireEvent('remove', this, c);
}
return c;
},
getComponent : function(comp){
if(typeof comp == 'object'){
return comp;
}
return this.items.get(comp);
},
lookupComponent : function(comp){
if(typeof comp == 'string'){
return Ext.ComponentMgr.get(comp);
}else if(!comp.events){
return this.createComponent(comp);
}
return comp;
},
createComponent : function(config){
return Ext.ComponentMgr.create(config, this.defaultType);
},
doLayout : function(shallow){
if(this.rendered && this.layout){
this.layout.layout();
}
if(shallow !== false && this.items){
var cs = this.items.items;
for(var i = 0, len = cs.length; i < len; i++) {
var c = cs[i];
if(c.doLayout){
c.doLayout();
}
}
}
},
getLayout : function(){
if(!this.layout){
var layout = new Ext.layout.ContainerLayout(this.layoutConfig);
this.setLayout(layout);
}
return this.layout;
},
onDestroy : function(){
if(this.items){
var cs = this.items.items;
for(var i = 0, len = cs.length; i < len; i++) {
Ext.destroy(cs[i]);
}
}
if(this.monitorResize){
Ext.EventManager.removeResizeListener(this.doLayout, this);
}
Ext.Container.superclass.onDestroy.call(this);
},
bubble : function(fn, scope, args){
var p = this;
while(p){
if(fn.apply(scope || p, args || [p]) === false){
break;
}
p = p.ownerCt;
}
},
cascade : function(fn, scope, args){
if(fn.apply(scope || this, args || [this]) !== false){
if(this.items){
var cs = this.items.items;
for(var i = 0, len = cs.length; i < len; i++){
if(cs[i].cascade){
cs[i].cascade(fn, scope, args);
}else{
fn.apply(scope || this, args || [cs[i]]);
}
}
}
}
},
findById : function(id){
var m, ct = this;
this.cascade(function(c){
if(ct != c && c.id === id){
m = c;
return false;
}
});
return m || null;
},
findByType : function(xtype){
return typeof xtype == 'function' ?
this.findBy(function(c){
return c.constructor === xtype;
}) :
this.findBy(function(c){
return c.constructor.xtype === xtype;
});
},
find : function(prop, value){
return this.findBy(function(c){
return c[prop] === value;
});
},
findBy : function(fn, scope){
var m = [], ct = this;
this.cascade(function(c){
if(ct != c && fn.call(scope || c, c, ct) === true){
m.push(c);
}
});
return m;
}
});
Ext.Container.LAYOUTS = {};
Ext.reg('container', Ext.Container);
Ext.layout.ContainerLayout = function(config){
Ext.apply(this, config);
};
Ext.layout.ContainerLayout.prototype = {
monitorResize:false,
activeItem : null,
layout : function(){
var target = this.container.getLayoutTarget();
this.onLayout(this.container, target);
this.container.fireEvent('afterlayout', this.container, this);
},
onLayout : function(ct, target){
this.renderAll(ct, target);
},
isValidParent : function(c, target){
var el = c.getPositionEl ? c.getPositionEl() : c.getEl();
return el.dom.parentNode == target.dom;
},
renderAll : function(ct, target){
var items = ct.items.items;
for(var i = 0, len = items.length; i < len; i++) {
var c = items[i];
if(c && (!c.rendered || !this.isValidParent(c, target))){
this.renderItem(c, i, target);
}
}
},
renderItem : function(c, position, target){
if(c && !c.rendered){
c.render(target, position);
if(this.extraCls){
var t = c.getPositionEl ? c.getPositionEl() : c;
t.addClass(this.extraCls);
}
if (this.renderHidden && c != this.activeItem) {
c.hide();
}
}else if(c && !this.isValidParent(c, target)){
if(this.extraCls){
c.addClass(this.extraCls);
}
if(typeof position == 'number'){
position = target.dom.childNodes[position];
}
target.dom.insertBefore(c.getEl().dom, position || null);
if (this.renderHidden && c != this.activeItem) {
c.hide();
}
}
},
onResize: function(){
if(this.container.collapsed){
return;
}
var b = this.container.bufferResize;
if(b){
if(!this.resizeTask){
this.resizeTask = new Ext.util.DelayedTask(this.layout, this);
this.resizeBuffer = typeof b == 'number' ? b : 100;
}
this.resizeTask.delay(this.resizeBuffer);
}else{
this.layout();
}
},
setContainer : function(ct){
if(this.monitorResize && ct != this.container){
if(this.container){
this.container.un('resize', this.onResize, this);
}
if(ct){
ct.on('resize', this.onResize, this);
}
}
this.container = ct;
},
parseMargins : function(v){
var ms = v.split(' ');
var len = ms.length;
if(len == 1){
ms[1] = ms[0];
ms[2] = ms[0];
ms[3] = ms[0];
}
if(len == 2){
ms[2] = ms[0];
ms[3] = ms[1];
}
return {
top:parseInt(ms[0], 10) || 0,
right:parseInt(ms[1], 10) || 0,
bottom:parseInt(ms[2], 10) || 0,
left:parseInt(ms[3], 10) || 0
};
}
};
Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout;
Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {
monitorResize:true,
onLayout : function(ct, target){
Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);
if(!this.container.collapsed){
this.setItemSize(this.activeItem || ct.items.itemAt(0), target.getStyleSize());
}
},
setItemSize : function(item, size){
if(item && size.height > 0){
item.setSize(size);
}
}
});
Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;
Ext.layout.CardLayout = Ext.extend(Ext.layout.FitLayout, {
deferredRender : false,
renderHidden : true,
setActiveItem : function(item){
item = this.container.getComponent(item);
if(this.activeItem != item){
if(this.activeItem){
this.activeItem.hide();
}
this.activeItem = item;
item.show();
this.layout();
}
},
renderAll : function(ct, target){
if(this.deferredRender){
this.renderItem(this.activeItem, undefined, target);
}else{
Ext.layout.CardLayout.superclass.renderAll.call(this, ct, target);
}
}
});
Ext.Container.LAYOUTS['card'] = Ext.layout.CardLayout;
Ext.layout.AnchorLayout = Ext.extend(Ext.layout.ContainerLayout, {
monitorResize:true,
getAnchorViewSize : function(ct, target){
return target.dom == document.body ?
target.getViewSize() : target.getStyleSize();
},
onLayout : function(ct, target){
Ext.layout.AnchorLayout.superclass.onLayout.call(this, ct, target);
var size = this.getAnchorViewSize(ct, target);
var w = size.width, h = size.height;
if(w < 20 || h < 20){
return;
}
var aw, ah;
if(ct.anchorSize){
if(typeof ct.anchorSize == 'number'){
aw = ct.anchorSize;
}else{
aw = ct.anchorSize.width;
ah = ct.anchorSize.height;
}
}else{
aw = ct.initialConfig.width;
ah = ct.initialConfig.height;
}
var cs = ct.items.items, len = cs.length, i, c, a, cw, ch;
for(i = 0; i < len; i++){
c = cs[i];
if(c.anchor){
a = c.anchorSpec;
if(!a){
var vs = c.anchor.split(' ');
c.anchorSpec = a = {
right: this.parseAnchor(vs[0], c.initialConfig.width, aw),
bottom: this.parseAnchor(vs[1], c.initialConfig.height, ah)
};
}
cw = a.right ? this.adjustWidthAnchor(a.right(w), c) : undefined;
ch = a.bottom ? this.adjustHeightAnchor(a.bottom(h), c) : undefined;
if(cw || ch){
c.setSize(cw || undefined, ch || undefined);
}
}
}
},
parseAnchor : function(a, start, cstart){
if(a && a != 'none'){
var last;
if(/^(r|right|b|bottom)$/i.test(a)){
var diff = cstart - start;
return function(v){
if(v !== last){
last = v;
return v - diff;
}
}
}else if(a.indexOf('%') != -1){
var ratio = parseFloat(a.replace('%', ''))*.01;
return function(v){
if(v !== last){
last = v;
return Math.floor(v*ratio);
}
}
}else{
a = parseInt(a, 10);
if(!isNaN(a)){
return function(v){
if(v !== last){
last = v;
return v + a;
}
}
}
}
}
return false;
},
adjustWidthAnchor : function(value, comp){
return value;
},
adjustHeightAnchor : function(value, comp){
return value;
}
});
Ext.Container.LAYOUTS['anchor'] = Ext.layout.AnchorLayout;
Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {
monitorResize:true,
extraCls: 'x-column',
scrollOffset : 0,
isValidParent : function(c, target){
return c.getEl().dom.parentNode == this.innerCt.dom;
},
onLayout : function(ct, target){
var cs = ct.items.items, len = cs.length, c, i;
if(!this.innerCt){
target.addClass('x-column-layout-ct');
this.innerCt = target.createChild({cls:'x-column-inner'});
this.innerCt.createChild({cls:'x-clear'});
}
this.renderAll(ct, this.innerCt);
var size = target.getViewSize();
if(size.width < 1 && size.height < 1){
return;
}
var w = size.width - target.getPadding('lr') - this.scrollOffset,
h = size.height - target.getPadding('tb'),
pw = w;
this.innerCt.setWidth(w);
for(i = 0; i < len; i++){
c = cs[i];
if(!c.columnWidth){
pw -= (c.getSize().width + c.getEl().getMargins('lr'));
}
}
pw = pw < 0 ? 0 : pw;
for(i = 0; i < len; i++){
c = cs[i];
if(c.columnWidth){
c.setSize(Math.floor(c.columnWidth*pw) - c.getEl().getMargins('lr'));
}
}
}
});
Ext.Container.LAYOUTS['column'] = Ext.layout.ColumnLayout;
Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, {
monitorResize:true,
rendered : false,
onLayout : function(ct, target){
var collapsed;
if(!this.rendered){
target.position();
target.addClass('x-border-layout-ct');
var items = ct.items.items;
collapsed = [];
for(var i = 0, len = items.length; i < len; i++) {
var c = items[i];
var pos = c.region;
if(c.collapsed){
collapsed.push(c);
}
c.collapsed = false;
if(!c.rendered){
c.cls = c.cls ? c.cls +' x-border-panel' : 'x-border-panel';
c.render(target, i);
}
this[pos] = pos != 'center' && c.split ?
new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) :
new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos);
this[pos].render(target, c);
}
this.rendered = true;
}
var size = target.getViewSize();
if(size.width < 20 || size.height < 20){ if(collapsed){
this.restoreCollapsed = collapsed;
}
return;
}else if(this.restoreCollapsed){
collapsed = this.restoreCollapsed;
delete this.restoreCollapsed;
}
var w = size.width, h = size.height;
var centerW = w, centerH = h, centerY = 0, centerX = 0;
var n = this.north, s = this.south, west = this.west, e = this.east, c = this.center;
if(!c){
throw 'No center region defined in BorderLayout ' + ct.id;
}
if(n && n.isVisible()){
var b = n.getSize();
var m = n.getMargins();
b.width = w - (m.left+m.right);
b.x = m.left;
b.y = m.top;
centerY = b.height + b.y + m.bottom;
centerH -= centerY;
n.applyLayout(b);
}
if(s && s.isVisible()){
var b = s.getSize();
var m = s.getMargins();
b.width = w - (m.left+m.right);
b.x = m.left;
var totalHeight = (b.height + m.top + m.bottom);
b.y = h - totalHeight + m.top;
centerH -= totalHeight;
s.applyLayout(b);
}
if(west && west.isVisible()){
var b = west.getSize();
var m = west.getMargins();
b.height = centerH - (m.top+m.bottom);
b.x = m.left;
b.y = centerY + m.top;
var totalWidth = (b.width + m.left + m.right);
centerX += totalWidth;
centerW -= totalWidth;
west.applyLayout(b);
}
if(e && e.isVisible()){
var b = e.getSize();
var m = e.getMargins();
b.height = centerH - (m.top+m.bottom);
var totalWidth = (b.width + m.left + m.right);
b.x = w - totalWidth + m.left;
b.y = centerY + m.top;
centerW -= totalWidth;
e.applyLayout(b);
}
var m = c.getMargins();
var centerBox = {
x: centerX + m.left,
y: centerY + m.top,
width: centerW - (m.left+m.right),
height: centerH - (m.top+m.bottom)
};
c.applyLayout(centerBox);
if(collapsed){
for(var i = 0, len = collapsed.length; i < len; i++){
collapsed[i].collapse(false);
}
}
if(Ext.isIE && Ext.isStrict){ target.repaint();
}
}
});
Ext.layout.BorderLayout.Region = function(layout, config, pos){
Ext.apply(this, config);
this.layout = layout;
this.position = pos;
this.state = {};
if(typeof this.margins == 'string'){
this.margins = this.layout.parseMargins(this.margins);
}
this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins);
if(this.collapsible){
if(typeof this.cmargins == 'string'){
this.cmargins = this.layout.parseMargins(this.cmargins);
}
if(this.collapseMode == 'mini' && !this.cmargins){
this.cmargins = {left:0,top:0,right:0,bottom:0};
}else{
this.cmargins = Ext.applyIf(this.cmargins || {},
pos == 'north' || pos == 'south' ? this.defaultNSCMargins : this.defaultEWCMargins);
}
}
};
Ext.layout.BorderLayout.Region.prototype = {
collapsible : false,
split:false,
floatable: true,
minWidth:50,
minHeight:50,
defaultMargins : {left:0,top:0,right:0,bottom:0},
defaultNSCMargins : {left:5,top:5,right:5,bottom:5},
defaultEWCMargins : {left:5,top:0,right:5,bottom:0},
isCollapsed : false,
render : function(ct, p){
this.panel = p;
p.el.enableDisplayMode();
this.targetEl = ct;
this.el = p.el;
var gs = p.getState, ps = this.position;
p.getState = function(){
return Ext.apply(gs.call(p) || {}, this.state);
}.createDelegate(this);
if(ps != 'center'){
p.allowQueuedExpand = false;
p.on({
beforecollapse: this.beforeCollapse,
collapse: this.onCollapse,
beforeexpand: this.beforeExpand,
expand: this.onExpand,
hide: this.onHide,
show: this.onShow,
scope: this
});
if(this.collapsible){
p.collapseEl = 'el';
p.slideAnchor = this.getSlideAnchor();
}
if(p.tools && p.tools.toggle){
p.tools.toggle.addClass('x-tool-collapse-'+ps);
p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over');
}
}
},
getCollapsedEl : function(){
if(!this.collapsedEl){
if(!this.toolTemplate){
var tt = new Ext.Template(
'<div class="x-tool x-tool-{id}"> </div>'
);
tt.disableFormats = true;
tt.compile();
Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt;
}
this.collapsedEl = this.targetEl.createChild({
cls: "x-layout-collapsed x-layout-collapsed-"+this.position,
id: this.panel.id + '-xcollapsed'
});
this.collapsedEl.enableDisplayMode('block');
if(this.collapseMode == 'mini'){
this.collapsedEl.addClass('x-layout-cmini-'+this.position);
this.miniCollapsedEl = this.collapsedEl.createChild({
cls: "x-layout-mini x-layout-mini-"+this.position, html: " "
});
this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');
this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true});
}else {
var t = this.toolTemplate.append(
this.collapsedEl.dom,
{id:'expand-'+this.position}, true);
t.addClassOnOver('x-tool-expand-'+this.position+'-over');
t.on('click', this.onExpandClick, this, {stopEvent:true});
if(this.floatable !== false){
this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
this.collapsedEl.on("click", this.collapseClick, this);
}
}
}
return this.collapsedEl;
},
onExpandClick : function(e){
if(this.isSlid){
this.afterSlideIn();
this.panel.expand(false);
}else{
this.panel.expand();
}
},
onCollapseClick : function(e){
this.panel.collapse();
},
beforeCollapse : function(p, animate){
this.lastAnim = animate;
if(this.splitEl){
this.splitEl.hide();
}
this.getCollapsedEl().show();
this.panel.el.setStyle('z-index', 100);
this.isCollapsed = true;
this.layout.layout();
},
onCollapse : function(animate){
this.panel.el.setStyle('z-index', 1);
if(this.lastAnim === false || this.panel.animCollapse === false){
this.getCollapsedEl().dom.style.visibility = 'visible';
}else{
this.getCollapsedEl().slideIn(this.panel.slideAnchor, {duration:.2});
}
this.state.collapsed = true;
this.panel.saveState();
},
beforeExpand : function(animate){
var c = this.getCollapsedEl();
this.el.show();
if(this.position == 'east' || this.position == 'west'){
this.panel.setSize(undefined, c.getHeight());
}else{
this.panel.setSize(c.getWidth(), undefined);
}
c.hide();
c.dom.style.visibility = 'hidden';
this.panel.el.setStyle('z-index', 100);
},
onExpand : function(){
this.isCollapsed = false;
if(this.splitEl){
this.splitEl.show();
}
this.layout.layout();
this.panel.el.setStyle('z-index', 1);
this.state.collapsed = false;
this.panel.saveState();
},
collapseClick : function(e){
if(this.isSlid){
e.stopPropagation();
this.slideIn();
}else{
e.stopPropagation();
this.slideOut();
}
},
onHide : function(){
if(this.isCollapsed){
this.getCollapsedEl().hide();
}else if(this.splitEl){
this.splitEl.hide();
}
},
onShow : function(){
if(this.isCollapsed){
this.getCollapsedEl().show();
}else if(this.splitEl){
this.splitEl.show();
}
},
isVisible : function(){
return !this.panel.hidden;
},
getMargins : function(){
return this.isCollapsed && this.cmargins ? this.cmargins : this.margins;
},
getSize : function(){
return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel.getSize();
},
setPanel : function(panel){
this.panel = panel;
},
getMinWidth: function(){
return this.minWidth;
},
getMinHeight: function(){
return this.minHeight;
},
applyLayoutCollapsed : function(box){
var ce = this.getCollapsedEl();
ce.setLeftTop(box.x, box.y);
ce.setSize(box.width, box.height);
},
applyLayout : function(box){
if(this.isCollapsed){
this.applyLayoutCollapsed(box);
}else{
this.panel.setPosition(box.x, box.y);
this.panel.setSize(box.width, box.height);
}
},
beforeSlide: function(){
this.panel.beforeEffect();
},
afterSlide : function(){
this.panel.afterEffect();
},
initAutoHide : function(){
if(this.autoHide !== false){
if(!this.autoHideHd){
var st = new Ext.util.DelayedTask(this.slideIn, this);
this.autoHideHd = {
"mouseout": function(e){
if(!e.within(this.el, true)){
st.delay(500);
}
},
"mouseover" : function(e){
st.cancel();
},
scope : this
};
}
this.el.on(this.autoHideHd);
}
},
clearAutoHide : function(){
if(this.autoHide !== false){
this.el.un("mouseout", this.autoHideHd.mouseout);
this.el.un("mouseover", this.autoHideHd.mouseover);
}
},
clearMonitor : function(){
Ext.getDoc().un("click", this.slideInIf, this);
},
slideOut : function(){
if(this.isSlid || this.el.hasActiveFx()){
return;
}
this.isSlid = true;
var ts = this.panel.tools;
if(ts && ts.toggle){
ts.toggle.hide();
}
this.el.show();
if(this.position == 'east' || this.position == 'west'){
this.panel.setSize(undefined, this.collapsedEl.getHeight());
}else{
this.panel.setSize(this.collapsedEl.getWidth(), undefined);
}
this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top];
this.el.alignTo(this.collapsedEl, this.getCollapseAnchor());
this.el.setStyle("z-index", 102);
if(this.animFloat !== false){
this.beforeSlide();
this.el.slideIn(this.getSlideAnchor(), {
callback: function(){
this.afterSlide();
this.initAutoHide();
Ext.getDoc().on("click", this.slideInIf, this);
},
scope: this,
block: true
});
}else{
this.initAutoHide();
Ext.getDoc().on("click", this.slideInIf, this);
}
},
afterSlideIn : function(){
this.clearAutoHide();
this.isSlid = false;
this.clearMonitor();
this.el.setStyle("z-index", "");
this.el.dom.style.left = this.restoreLT[0];
this.el.dom.style.top = this.restoreLT[1];
var ts = this.panel.tools;
if(ts && ts.toggle){
ts.toggle.show();
}
},
slideIn : function(cb){
if(!this.isSlid || this.el.hasActiveFx()){
Ext.callback(cb);
return;
}
this.isSlid = false;
if(this.animFloat !== false){
this.beforeSlide();
this.el.slideOut(this.getSlideAnchor(), {
callback: function(){
this.el.hide();
this.afterSlide();
this.afterSlideIn();
Ext.callback(cb);
},
scope: this,
block: true
});
}else{
this.el.hide();
this.afterSlideIn();
}
},
slideInIf : function(e){
if(!e.within(this.el)){
this.slideIn();
}
},
anchors : {
"west" : "left",
"east" : "right",
"north" : "top",
"south" : "bottom"
},
sanchors : {
"west" : "l",
"east" : "r",
"north" : "t",
"south" : "b"
},
canchors : {
"west" : "tl-tr",
"east" : "tr-tl",
"north" : "tl-bl",
"south" : "bl-tl"
},
getAnchor : function(){
return this.anchors[this.position];
},
getCollapseAnchor : function(){
return this.canchors[this.position];
},
getSlideAnchor : function(){
return this.sanchors[this.position];
},
getAlignAdj : function(){
var cm = this.cmargins;
switch(this.position){
case "west":
return [0, 0];
break;
case "east":
return [0, 0];
break;
case "north":
return [0, 0];
break;
case "south":
return [0, 0];
break;
}
},
getExpandAdj : function(){
var c = this.collapsedEl, cm = this.cmargins;
switch(this.position){
case "west":
return [-(cm.right+c.getWidth()+cm.left), 0];
break;
case "east":
return [cm.right+c.getWidth()+cm.left, 0];
break;
case "north":
return [0, -(cm.top+cm.bottom+c.getHeight())];
break;
case "south":
return [0, cm.top+cm.bottom+c.getHeight()];
break;
}
}
};
Ext.layout.BorderLayout.SplitRegion = function(layout, config, pos){
Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, layout, config, pos);
this.applyLayout = this.applyFns[pos];
};
Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, {
splitTip : "Drag to resize.",
collapsibleSplitTip : "Drag to resize. Double click to hide.",
useSplitTips : false,
splitSettings : {
north : {
orientation: Ext.SplitBar.VERTICAL,
placement: Ext.SplitBar.TOP,
maxFn : 'getVMaxSize',
minProp: 'minHeight',
maxProp: 'maxHeight'
},
south : {
orientation: Ext.SplitBar.VERTICAL,
placement: Ext.SplitBar.BOTTOM,
maxFn : 'getVMaxSize',
minProp: 'minHeight',
maxProp: 'maxHeight'
},
east : {
orientation: Ext.SplitBar.HORIZONTAL,
placement: Ext.SplitBar.RIGHT,
maxFn : 'getHMaxSize',
minProp: 'minWidth',
maxProp: 'maxWidth'
},
west : {
orientation: Ext.SplitBar.HORIZONTAL,
placement: Ext.SplitBar.LEFT,
maxFn : 'getHMaxSize',
minProp: 'minWidth',
maxProp: 'maxWidth'
}
},
applyFns : {
west : function(box){
if(this.isCollapsed){
return this.applyLayoutCollapsed(box);
}
var sd = this.splitEl.dom, s = sd.style;
this.panel.setPosition(box.x, box.y);
var sw = sd.offsetWidth;
s.left = (box.x+box.width-sw)+'px';
s.top = (box.y)+'px';
s.height = Math.max(0, box.height)+'px';
this.panel.setSize(box.width-sw, box.height);
},
east : function(box){
if(this.isCollapsed){
return this.applyLayoutCollapsed(box);
}
var sd = this.splitEl.dom, s = sd.style;
var sw = sd.offsetWidth;
this.panel.setPosition(box.x+sw, box.y);
s.left = (box.x)+'px';
s.top = (box.y)+'px';
s.height = Math.max(0, box.height)+'px';
this.panel.setSize(box.width-sw, box.height);
},
north : function(box){
if(this.isCollapsed){
return this.applyLayoutCollapsed(box);
}
var sd = this.splitEl.dom, s = sd.style;
var sh = sd.offsetHeight;
this.panel.setPosition(box.x, box.y);
s.left = (box.x)+'px';
s.top = (box.y+box.height-sh)+'px';
s.width = Math.max(0, box.width)+'px';
this.panel.setSize(box.width, box.height-sh);
},
south : function(box){
if(this.isCollapsed){
return this.applyLayoutCollapsed(box);
}
var sd = this.splitEl.dom, s = sd.style;
var sh = sd.offsetHeight;
this.panel.setPosition(box.x, box.y+sh);
s.left = (box.x)+'px';
s.top = (box.y)+'px';
s.width = Math.max(0, box.width)+'px';
this.panel.setSize(box.width, box.height-sh);
}
},
render : function(ct, p){
Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);
var ps = this.position;
this.splitEl = ct.createChild({
cls: "x-layout-split x-layout-split-"+ps, html: " ",
id: this.panel.id + '-xsplit'
});
if(this.collapseMode == 'mini'){
this.miniSplitEl = this.splitEl.createChild({
cls: "x-layout-mini x-layout-mini-"+ps, html: " "
});
this.miniSplitEl.addClassOnOver('x-layout-mini-over');
this.miniSplitEl.on('click', this.onCollapseClick, this, {stopEvent:true});
}
var s = this.splitSettings[ps];
this.split = new Ext.SplitBar(this.splitEl.dom, p.el, s.orientation);
this.split.placement = s.placement;
this.split.getMaximumSize = this[s.maxFn].createDelegate(this);
this.split.minSize = this.minSize || this[s.minProp];
this.split.on("beforeapply", this.onSplitMove, this);
this.split.useShim = this.useShim === true;
this.maxSize = this.maxSize || this[s.maxProp];
if(p.hidden){
this.splitEl.hide();
}
if(this.useSplitTips){
this.splitEl.dom.title = this.collapsible ? this.collapsibleSplitTip : this.splitTip;
}
if(this.collapsible){
this.splitEl.on("dblclick", this.onCollapseClick, this);
}
},
getSize : function(){
if(this.isCollapsed){
return this.collapsedEl.getSize();
}
var s = this.panel.getSize();
if(this.position == 'north' || this.position == 'south'){
s.height += this.splitEl.dom.offsetHeight;
}else{
s.width += this.splitEl.dom.offsetWidth;
}
return s;
},
getHMaxSize : function(){
var cmax = this.maxSize || 10000;
var center = this.layout.center;
return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth());
},
getVMaxSize : function(){
var cmax = this.maxSize || 10000;
var center = this.layout.center;
return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight());
},
onSplitMove : function(split, newSize){
var s = this.panel.getSize();
this.lastSplitSize = newSize;
if(this.position == 'north' || this.position == 'south'){
this.panel.setSize(s.width, newSize);
this.state.height = newSize;
}else{
this.panel.setSize(newSize, s.height);
this.state.width = newSize;
}
this.layout.layout();
this.panel.saveState();
return false;
},
getSplitBar : function(){
return this.split;
}
});
Ext.Container.LAYOUTS['border'] = Ext.layout.BorderLayout;
Ext.layout.FormLayout = Ext.extend(Ext.layout.AnchorLayout, {
labelSeparator : ':',
getAnchorViewSize : function(ct, target){
return ct.body.getStyleSize();
},
setContainer : function(ct){
Ext.layout.FormLayout.superclass.setContainer.call(this, ct);
if(ct.labelAlign){
ct.addClass('x-form-label-'+ct.labelAlign);
}
if(ct.hideLabels){
this.labelStyle = "display:none";
this.elementStyle = "padding-left:0;";
this.labelAdjust = 0;
}else{
this.labelSeparator = ct.labelSeparator || this.labelSeparator;
ct.labelWidth = ct.labelWidth || 100;
if(typeof ct.labelWidth == 'number'){
var pad = (typeof ct.labelPad == 'number' ? ct.labelPad : 5);
this.labelAdjust = ct.labelWidth+pad;
this.labelStyle = "width:"+ct.labelWidth+"px;";
this.elementStyle = "padding-left:"+(ct.labelWidth+pad)+'px';
}
if(ct.labelAlign == 'top'){
this.labelStyle = "width:auto;";
this.labelAdjust = 0;
this.elementStyle = "padding-left:0;";
}
}
if(!this.fieldTpl){
var t = new Ext.Template(
'<div class="x-form-item {5}" tabIndex="-1">',
'<label for="{0}" style="{2}" class="x-form-item-label">{1}{4}</label>',
'<div class="x-form-element" id="x-form-el-{0}" style="{3}">',
'</div><div class="{6}"></div>',
'</div>'
);
t.disableFormats = true;
t.compile();
Ext.layout.FormLayout.prototype.fieldTpl = t;
}
},
renderItem : function(c, position, target){
if(c && !c.rendered && c.isFormField && c.inputType != 'hidden'){
var args = [
c.id, c.fieldLabel,
c.labelStyle||this.labelStyle||'',
this.elementStyle||'',
typeof c.labelSeparator == 'undefined' ? this.labelSeparator : c.labelSeparator,
(c.itemCls||this.container.itemCls||'') + (c.hideLabel ? ' x-hide-label' : ''),
c.clearCls || 'x-form-clear-left'
];
if(typeof position == 'number'){
position = target.dom.childNodes[position] || null;
}
if(position){
this.fieldTpl.insertBefore(position, args);
}else{
this.fieldTpl.append(target, args);
}
c.render('x-form-el-'+c.id);
}else {
Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);
}
},
adjustWidthAnchor : function(value, comp){
return value - (comp.isFormField ? (comp.hideLabel ? 0 : this.labelAdjust) : 0);
},
isValidParent : function(c, target){
return true;
}
});
Ext.Container.LAYOUTS['form'] = Ext.layout.FormLayout;
Ext.layout.Accordion = Ext.extend(Ext.layout.FitLayout, {
fill : true,
autoWidth : true,
titleCollapse : true,
hideCollapseTool : false,
collapseFirst : false,
animate : false,
sequence : false,
activeOnTop : false,
renderItem : function(c){
if(this.animate === false){
c.animCollapse = false;
}
c.collapsible = true;
if(this.autoWidth){
c.autoWidth = true;
}
if(this.titleCollapse){
c.titleCollapse = true;
}
if(this.hideCollapseTool){
c.hideCollapseTool = true;
}
if(this.collapseFirst !== undefined){
c.collapseFirst = this.collapseFirst;
}
if(!this.activeItem && !c.collapsed){
this.activeItem = c;
}else if(this.activeItem){
c.collapsed = true;
}
Ext.layout.Accordion.superclass.renderItem.apply(this, arguments);
c.header.addClass('x-accordion-hd');
c.on('beforeexpand', this.beforeExpand, this);
},
beforeExpand : function(p, anim){
var ai = this.activeItem;
if(ai){
if(this.sequence){
delete this.activeItem;
ai.collapse({callback:function(){
p.expand(anim || true);
}, scope: this});
return false;
}else{
ai.collapse(this.animate);
}
}
this.activeItem = p;
if(this.activeOnTop){
p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild);
}
this.layout();
},
setItemSize : function(item, size){
if(this.fill && item){
var items = this.container.items.items;
var hh = 0;
for(var i = 0, len = items.length; i < len; i++){
var p = items[i];
if(p != item){
hh += (p.getSize().height - p.bwrap.getHeight());
}
}
size.height -= hh;
item.setSize(size);
}
}
});
Ext.Container.LAYOUTS['accordion'] = Ext.layout.Accordion;
Ext.layout.TableLayout = Ext.extend(Ext.layout.ContainerLayout, {
monitorResize:false,
setContainer : function(ct){
Ext.layout.TableLayout.superclass.setContainer.call(this, ct);
this.currentRow = 0;
this.currentColumn = 0;
this.cells = [];
},
onLayout : function(ct, target){
var cs = ct.items.items, len = cs.length, c, i;
if(!this.table){
target.addClass('x-table-layout-ct');
this.table = target.createChild(
{tag:'table', cls:'x-table-layout', cellspacing: 0, cn: {tag: 'tbody'}}, null, true);
this.renderAll(ct, target);
}
},
getRow : function(index){
var row = this.table.tBodies[0].childNodes[index];
if(!row){
row = document.createElement('tr');
this.table.tBodies[0].appendChild(row);
}
return row;
},
getNextCell : function(c){
var cell = this.getNextNonSpan(this.currentColumn, this.currentRow);
var curCol = this.currentColumn = cell[0], curRow = this.currentRow = cell[1];
for(var rowIndex = curRow; rowIndex < curRow + (c.rowspan || 1); rowIndex++){
if(!this.cells[rowIndex]){
this.cells[rowIndex] = [];
}
for(var colIndex = curCol; colIndex < curCol + (c.colspan || 1); colIndex++){
this.cells[rowIndex][colIndex] = true;
}
}
var td = document.createElement('td');
if(c.cellId){
td.id = c.cellId;
}
var cls = 'x-table-layout-cell';
if(c.cellCls){
cls += ' ' + c.cellCls;
}
td.className = cls;
if(c.colspan){
td.colSpan = c.colspan;
}
if(c.rowspan){
td.rowSpan = c.rowspan;
}
this.getRow(curRow).appendChild(td);
return td;
},
getNextNonSpan: function(colIndex, rowIndex){
var cols = this.columns;
while((cols && colIndex >= cols) || (this.cells[rowIndex] && this.cells[rowIndex][colIndex])) {
if(cols && colIndex >= cols){
rowIndex++;
colIndex = 0;
}else{
colIndex++;
}
}
return [colIndex, rowIndex];
},
renderItem : function(c, position, target){
if(c && !c.rendered){
c.render(this.getNextCell(c));
}
},
isValidParent : function(c, target){
return true;
}
});
Ext.Container.LAYOUTS['table'] = Ext.layout.TableLayout;
Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, {
extraCls: 'x-abs-layout-item',
isForm: false,
setContainer : function(ct){
Ext.layout.AbsoluteLayout.superclass.setContainer.call(this, ct);
if(ct.isXType('form')){
this.isForm = true;
}
},
onLayout : function(ct, target){
if(this.isForm){ ct.body.position(); } else { target.position(); }
Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target);
},
getAnchorViewSize : function(ct, target){
return this.isForm ? ct.body.getStyleSize() : Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this, ct, target);
},
isValidParent : function(c, target){
return this.isForm ? true : Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this, c, target);
},
adjustWidthAnchor : function(value, comp){
return value ? value - comp.getPosition(true)[0] : value;
},
adjustHeightAnchor : function(value, comp){
return value ? value - comp.getPosition(true)[1] : value;
}
});
Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout;
Ext.Viewport = Ext.extend(Ext.Container, {
initComponent : function() {
Ext.Viewport.superclass.initComponent.call(this);
document.getElementsByTagName('html')[0].className += ' x-viewport';
this.el = Ext.getBody();
this.el.setHeight = Ext.emptyFn;
this.el.setWidth = Ext.emptyFn;
this.el.setSize = Ext.emptyFn;
this.el.dom.scroll = 'no';
this.allowDomMove = false;
this.autoWidth = true;
this.autoHeight = true;
Ext.EventManager.onWindowResize(this.fireResize, this);
this.renderTo = this.el;
},
fireResize : function(w, h){
this.fireEvent('resize', this, w, h, w, h);
}
});
Ext.reg('viewport', Ext.Viewport);
Ext.Panel = Ext.extend(Ext.Container, {
baseCls : 'x-panel',
collapsedCls : 'x-panel-collapsed',
maskDisabled: true,
animCollapse: Ext.enableFx,
headerAsText: true,
buttonAlign: 'right',
collapsed : false,
collapseFirst: true,
minButtonWidth:75,
elements : 'body',
toolTarget : 'header',
collapseEl : 'bwrap',
slideAnchor : 't',
deferHeight: true,
expandDefaults: {
duration:.25
},
collapseDefaults: {
duration:.25
},
initComponent : function(){
Ext.Panel.superclass.initComponent.call(this);
this.addEvents(
'bodyresize',
'titlechange',
'collapse',
'expand',
'beforecollapse',
'beforeexpand',
'beforeclose',
'close',
'activate',
'deactivate'
);
if(this.tbar){
this.elements += ',tbar';
if(typeof this.tbar == 'object'){
this.topToolbar = this.tbar;
}
delete this.tbar;
}
if(this.bbar){
this.elements += ',bbar';
if(typeof this.bbar == 'object'){
this.bottomToolbar = this.bbar;
}
delete this.bbar;
}
if(this.header === true){
this.elements += ',header';
delete this.header;
}else if(this.title && this.header !== false){
this.elements += ',header';
}
if(this.footer === true){
this.elements += ',footer';
delete this.footer;
}
if(this.buttons){
var btns = this.buttons;
this.buttons = [];
for(var i = 0, len = btns.length; i < len; i++) {
if(btns[i].render){ this.buttons.push(btns[i]);
}else{
this.addButton(btns[i]);
}
}
}
if(this.autoLoad){
this.on('render', this.doAutoLoad, this, {delay:10});
}
},
createElement : function(name, pnode){
if(this[name]){
pnode.appendChild(this[name].dom);
return;
}
if(name === 'bwrap' || this.elements.indexOf(name) != -1){
if(this[name+'Cfg']){
this[name] = Ext.fly(pnode).createChild(this[name+'Cfg']);
}else{
var el = document.createElement('div');
el.className = this[name+'Cls'];
this[name] = Ext.get(pnode.appendChild(el));
}
}
},
onRender : function(ct, position){
Ext.Panel.superclass.onRender.call(this, ct, position);
this.createClasses();
if(this.el){ this.el.addClass(this.baseCls);
this.header = this.el.down('.'+this.headerCls);
this.bwrap = this.el.down('.'+this.bwrapCls);
var cp = this.bwrap ? this.bwrap : this.el;
this.tbar = cp.down('.'+this.tbarCls);
this.body = cp.down('.'+this.bodyCls);
this.bbar = cp.down('.'+this.bbarCls);
this.footer = cp.down('.'+this.footerCls);
this.fromMarkup = true;
}else{
this.el = ct.createChild({
id: this.id,
cls: this.baseCls
}, position);
}
var el = this.el, d = el.dom;
if(this.cls){
this.el.addClass(this.cls);
}
if(this.buttons){
this.elements += ',footer';
}
if(this.frame){
el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup, this.baseCls));
this.createElement('header', d.firstChild.firstChild.firstChild);
this.createElement('bwrap', d);
var bw = this.bwrap.dom;
var ml = d.childNodes[1], bl = d.childNodes[2];
bw.appendChild(ml);
bw.appendChild(bl);
var mc = bw.firstChild.firstChild.firstChild;
this.createElement('tbar', mc);
this.createElement('body', mc);
this.createElement('bbar', mc);
this.createElement('footer', bw.lastChild.firstChild.firstChild);
if(!this.footer){
this.bwrap.dom.lastChild.className += ' x-panel-nofooter';
}
}else{
this.createElement('header', d);
this.createElement('bwrap', d);
var bw = this.bwrap.dom;
this.createElement('tbar', bw);
this.createElement('body', bw);
this.createElement('bbar', bw);
this.createElement('footer', bw);
if(!this.header){
this.body.addClass(this.bodyCls + '-noheader');
if(this.tbar){
this.tbar.addClass(this.tbarCls + '-noheader');
}
}
}
if(this.border === false){
this.el.addClass(this.baseCls + '-noborder');
this.body.addClass(this.bodyCls + '-noborder');
if(this.header){
this.header.addClass(this.headerCls + '-noborder');
}
if(this.footer){
this.footer.addClass(this.footerCls + '-noborder');
}
if(this.tbar){
this.tbar.addClass(this.tbarCls + '-noborder');
}
if(this.bbar){
this.bbar.addClass(this.bbarCls + '-noborder');
}
}
if(this.bodyBorder === false){
this.body.addClass(this.bodyCls + '-noborder');
}
if(this.bodyStyle){
this.body.applyStyles(this.bodyStyle);
}
this.bwrap.enableDisplayMode('block');
if(this.header){
this.header.unselectable();
if(this.headerAsText){
this.header.dom.innerHTML =
'<span class="' + this.headerTextCls + '">'+this.header.dom.innerHTML+'</span>';
if(this.iconCls){
this.setIconClass(this.iconCls);
}
}
}
if(this.floating){
this.makeFloating(this.floating);
}
if(this.collapsible){
this.tools = this.tools ? this.tools.slice(0) : [];
if(!this.hideCollapseTool){
this.tools[this.collapseFirst?'unshift':'push']({
id: 'toggle',
handler : this.toggleCollapse,
scope: this
});
}
if(this.titleCollapse && this.header){
this.header.on('click', this.toggleCollapse, this);
this.header.setStyle('cursor', 'pointer');
}
}
if(this.tools){
var ts = this.tools;
this.tools = {};
this.addTool.apply(this, ts);
}else{
this.tools = {};
}
if(this.buttons && this.buttons.length > 0){
var tb = this.footer.createChild({cls:'x-panel-btns-ct', cn: {
cls:"x-panel-btns x-panel-btns-"+this.buttonAlign,
html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'
}}, null, true);
var tr = tb.getElementsByTagName('tr')[0];
for(var i = 0, len = this.buttons.length; i < len; i++) {
var b = this.buttons[i];
var td = document.createElement('td');
td.className = 'x-panel-btn-td';
b.render(tr.appendChild(td));
}
}
if(this.tbar && this.topToolbar){
if(Ext.isArray(this.topToolbar)){
this.topToolbar = new Ext.Toolbar(this.topToolbar);
}
this.topToolbar.render(this.tbar);
}
if(this.bbar && this.bottomToolbar){
if(Ext.isArray(this.bottomToolbar)){
this.bottomToolbar = new Ext.Toolbar(this.bottomToolbar);
}
this.bottomToolbar.render(this.bbar);
}
},
setIconClass : function(cls){
var old = this.iconCls;
this.iconCls = cls;
if(this.rendered && this.header){
if(this.frame){
this.header.addClass('x-panel-icon');
this.header.replaceClass(old, this.iconCls);
}else{
var hd = this.header.dom;
var img = hd.firstChild && String(hd.firstChild.tagName).toLowerCase() == 'img' ? hd.firstChild : null;
if(img){
Ext.fly(img).replaceClass(old, this.iconCls);
}else{
Ext.DomHelper.insertBefore(hd.firstChild, {
tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls
});
}
}
}
},
makeFloating : function(cfg){
this.floating = true;
this.el = new Ext.Layer(
typeof cfg == 'object' ? cfg : {
shadow: this.shadow !== undefined ? this.shadow : 'sides',
shadowOffset: this.shadowOffset,
constrain:false,
shim: this.shim === false ? false : undefined
}, this.el
);
},
getTopToolbar : function(){
return this.topToolbar;
},
getBottomToolbar : function(){
return this.bottomToolbar;
},
addButton : function(config, handler, scope){
var bc = {
handler: handler,
scope: scope,
minWidth: this.minButtonWidth,
hideParent:true
};
if(typeof config == "string"){
bc.text = config;
}else{
Ext.apply(bc, config);
}
var btn = new Ext.Button(bc);
btn.ownerCt = this;
if(!this.buttons){
this.buttons = [];
}
this.buttons.push(btn);
return btn;
},
addTool : function(){
if(!this[this.toolTarget]) { return;
}
if(!this.toolTemplate){
var tt = new Ext.Template(
'<div class="x-tool x-tool-{id}"> </div>'
);
tt.disableFormats = true;
tt.compile();
Ext.Panel.prototype.toolTemplate = tt;
}
for(var i = 0, a = arguments, len = a.length; i < len; i++) {
var tc = a[i], overCls = 'x-tool-'+tc.id+'-over';
var t = this.toolTemplate.insertFirst(this[this.toolTarget], tc, true);
this.tools[tc.id] = t;
t.enableDisplayMode('block');
t.on('click', this.createToolHandler(t, tc, overCls, this));
if(tc.on){
t.on(tc.on);
}
if(tc.hidden){
t.hide();
}
if(tc.qtip){
if(typeof tc.qtip == 'object'){
Ext.QuickTips.register(Ext.apply({
target: t.id
}, tc.qtip));
} else {
t.dom.qtip = tc.qtip;
}
}
t.addClassOnOver(overCls);
}
},
onShow : function(){
if(this.floating){
return this.el.show();
}
Ext.Panel.superclass.onShow.call(this);
},
onHide : function(){
if(this.floating){
return this.el.hide();
}
Ext.Panel.superclass.onHide.call(this);
},
createToolHandler : function(t, tc, overCls, panel){
return function(e){
t.removeClass(overCls);
e.stopEvent();
if(tc.handler){
tc.handler.call(tc.scope || t, e, t, panel);
}
};
},
afterRender : function(){
if(this.fromMarkup && this.height === undefined && !this.autoHeight){
this.height = this.el.getHeight();
}
if(this.floating && !this.hidden && !this.initHidden){
this.el.show();
}
if(this.title){
this.setTitle(this.title);
}
this.setAutoScroll();
if(this.html){
this.body.update(typeof this.html == 'object' ?
Ext.DomHelper.markup(this.html) :
this.html);
delete this.html;
}
if(this.contentEl){
var ce = Ext.getDom(this.contentEl);
Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);
this.body.dom.appendChild(ce);
}
if(this.collapsed){
this.collapsed = false;
this.collapse(false);
}
Ext.Panel.superclass.afterRender.call(this); this.initEvents();
},
setAutoScroll : function(){
if(this.rendered && this.autoScroll){
this.body.setOverflow('auto');
}
},
getKeyMap : function(){
if(!this.keyMap){
this.keyMap = new Ext.KeyMap(this.el, this.keys);
}
return this.keyMap;
},
initEvents : function(){
if(this.keys){
this.getKeyMap();
}
if(this.draggable){
this.initDraggable();
}
},
initDraggable : function(){
this.dd = new Ext.Panel.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);
},
beforeEffect : function(){
if(this.floating){
this.el.beforeAction();
}
this.el.addClass('x-panel-animated');
},
afterEffect : function(){
this.syncShadow();
this.el.removeClass('x-panel-animated');
},
createEffect : function(a, cb, scope){
var o = {
scope:scope,
block:true
};
if(a === true){
o.callback = cb;
return o;
}else if(!a.callback){
o.callback = cb;
}else { o.callback = function(){
cb.call(scope);
Ext.callback(a.callback, a.scope);
};
}
return Ext.applyIf(o, a);
},
collapse : function(animate){
if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){
return;
}
var doAnim = animate === true || (animate !== false && this.animCollapse);
this.beforeEffect();
this.onCollapse(doAnim, animate);
return this;
},
onCollapse : function(doAnim, animArg){
if(doAnim){
this[this.collapseEl].slideOut(this.slideAnchor,
Ext.apply(this.createEffect(animArg||true, this.afterCollapse, this),
this.collapseDefaults));
}else{
this[this.collapseEl].hide();
this.afterCollapse();
}
},
afterCollapse : function(){
this.collapsed = true;
this.el.addClass(this.collapsedCls);
this.afterEffect();
this.fireEvent('collapse', this);
},
expand : function(animate){
if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){
return;
}
var doAnim = animate === true || (animate !== false && this.animCollapse);
this.el.removeClass(this.collapsedCls);
this.beforeEffect();
this.onExpand(doAnim, animate);
return this;
},
onExpand : function(doAnim, animArg){
if(doAnim){
this[this.collapseEl].slideIn(this.slideAnchor,
Ext.apply(this.createEffect(animArg||true, this.afterExpand, this),
this.expandDefaults));
}else{
this[this.collapseEl].show();
this.afterExpand();
}
},
afterExpand : function(){
this.collapsed = false;
this.afterEffect();
this.fireEvent('expand', this);
},
toggleCollapse : function(animate){
this[this.collapsed ? 'expand' : 'collapse'](animate);
return this;
},
onDisable : function(){
if(this.rendered && this.maskDisabled){
this.el.mask();
}
Ext.Panel.superclass.onDisable.call(this);
},
onEnable : function(){
if(this.rendered && this.maskDisabled){
this.el.unmask();
}
Ext.Panel.superclass.onEnable.call(this);
},
onResize : function(w, h){
if(w !== undefined || h !== undefined){
if(!this.collapsed){
if(typeof w == 'number'){
this.body.setWidth(
this.adjustBodyWidth(w - this.getFrameWidth()));
}else if(w == 'auto'){
this.body.setWidth(w);
}
if(typeof h == 'number'){
this.body.setHeight(
this.adjustBodyHeight(h - this.getFrameHeight()));
}else if(h == 'auto'){
this.body.setHeight(h);
}
}else{
this.queuedBodySize = {width: w, height: h};
if(!this.queuedExpand && this.allowQueuedExpand !== false){
this.queuedExpand = true;
this.on('expand', function(){
delete this.queuedExpand;
this.onResize(this.queuedBodySize.width, this.queuedBodySize.height);
this.doLayout();
}, this, {single:true});
}
}
this.fireEvent('bodyresize', this, w, h);
}
this.syncShadow();
},
adjustBodyHeight : function(h){
return h;
},
adjustBodyWidth : function(w){
return w;
},
onPosition : function(){
this.syncShadow();
},
onDestroy : function(){
if(this.tools){
for(var k in this.tools){
Ext.destroy(this.tools[k]);
}
}
if(this.buttons){
for(var b in this.buttons){
Ext.destroy(this.buttons[b]);
}
}
Ext.destroy(
this.topToolbar,
this.bottomToolbar
);
Ext.Panel.superclass.onDestroy.call(this);
},
getFrameWidth : function(){
var w = this.el.getFrameWidth('lr');
if(this.frame){
var l = this.bwrap.dom.firstChild;
w += (Ext.fly(l).getFrameWidth('l') + Ext.fly(l.firstChild).getFrameWidth('r'));
var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
w += Ext.fly(mc).getFrameWidth('lr');
}
return w;
},
getFrameHeight : function(){
var h = this.el.getFrameWidth('tb');
h += (this.tbar ? this.tbar.getHeight() : 0) +
(this.bbar ? this.bbar.getHeight() : 0);
if(this.frame){
var hd = this.el.dom.firstChild;
var ft = this.bwrap.dom.lastChild;
h += (hd.offsetHeight + ft.offsetHeight);
var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
h += Ext.fly(mc).getFrameWidth('tb');
}else{
h += (this.header ? this.header.getHeight() : 0) +
(this.footer ? this.footer.getHeight() : 0);
}
return h;
},
getInnerWidth : function(){
return this.getSize().width - this.getFrameWidth();
},
getInnerHeight : function(){
return this.getSize().height - this.getFrameHeight();
},
syncShadow : function(){
if(this.floating){
this.el.sync(true);
}
},
getLayoutTarget : function(){
return this.body;
},
setTitle : function(title, iconCls){
this.title = title;
if(this.header && this.headerAsText){
this.header.child('span').update(title);
}
if(iconCls){
this.setIconClass(iconCls);
}
this.fireEvent('titlechange', this, title);
return this;
},
getUpdater : function(){
return this.body.getUpdater();
},
load : function(){
var um = this.body.getUpdater();
um.update.apply(um, arguments);
return this;
},
beforeDestroy : function(){
Ext.Element.uncache(
this.header,
this.tbar,
this.bbar,
this.footer,
this.body
);
},
createClasses : function(){
this.headerCls = this.baseCls + '-header';
this.headerTextCls = this.baseCls + '-header-text';
this.bwrapCls = this.baseCls + '-bwrap';
this.tbarCls = this.baseCls + '-tbar';
this.bodyCls = this.baseCls + '-body';
this.bbarCls = this.baseCls + '-bbar';
this.footerCls = this.baseCls + '-footer';
},
createGhost : function(cls, useShim, appendTo){
var el = document.createElement('div');
el.className = 'x-panel-ghost ' + (cls ? cls : '');
if(this.header){
el.appendChild(this.el.dom.firstChild.cloneNode(true));
}
Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight());
el.style.width = this.el.dom.offsetWidth + 'px';;
if(!appendTo){
this.container.dom.appendChild(el);
}else{
Ext.getDom(appendTo).appendChild(el);
}
if(useShim !== false && this.el.useShim !== false){
var layer = new Ext.Layer({shadow:false, useDisplay:true, constrain:false}, el);
layer.show();
return layer;
}else{
return new Ext.Element(el);
}
},
doAutoLoad : function(){
this.body.load(
typeof this.autoLoad == 'object' ?
this.autoLoad : {url: this.autoLoad});
}
});
Ext.reg('panel', Ext.Panel);
Ext.Window = Ext.extend(Ext.Panel, {
baseCls : 'x-window',
resizable:true,
draggable:true,
closable : true,
constrain:false,
constrainHeader:false,
plain:false,
minimizable : false,
maximizable : false,
minHeight: 100,
minWidth: 200,
expandOnShow: true,
closeAction: 'close',
collapsible:false,
initHidden : true,
monitorResize : true,
elements: 'header,body',
frame:true,
floating:true,
initComponent : function(){
Ext.Window.superclass.initComponent.call(this);
this.addEvents(
'resize',
'maximize',
'minimize',
'restore'
);
},
getState : function(){
return Ext.apply(Ext.Window.superclass.getState.call(this) || {}, this.getBox());
},
onRender : function(ct, position){
Ext.Window.superclass.onRender.call(this, ct, position);
if(this.plain){
this.el.addClass('x-window-plain');
}
this.focusEl = this.el.createChild({
tag: "a", href:"#", cls:"x-dlg-focus",
tabIndex:"-1", html: " "});
this.focusEl.swallowEvent('click', true);
this.proxy = this.el.createProxy("x-window-proxy");
this.proxy.enableDisplayMode('block');
if(this.modal){
this.mask = this.container.createChild({cls:"ext-el-mask"}, this.el.dom);
this.mask.enableDisplayMode("block");
this.mask.hide();
}
},
initEvents : function(){
Ext.Window.superclass.initEvents.call(this);
if(this.animateTarget){
this.setAnimateTarget(this.animateTarget);
}
if(this.resizable){
this.resizer = new Ext.Resizable(this.el, {
minWidth: this.minWidth,
minHeight:this.minHeight,
handles: this.resizeHandles || "all",
pinned: true,
resizeElement : this.resizerAction
});
this.resizer.window = this;
this.resizer.on("beforeresize", this.beforeResize, this);
}
if(this.draggable){
this.header.addClass("x-window-draggable");
}
this.initTools();
this.el.on("mousedown", this.toFront, this);
this.manager = this.manager || Ext.WindowMgr;
this.manager.register(this);
this.hidden = true;
if(this.maximized){
this.maximized = false;
this.maximize();
}
if(this.closable){
var km = this.getKeyMap();
km.on(27, this.onEsc, this);
km.disable();
}
},
initDraggable : function(){
this.dd = new Ext.Window.DD(this);
},
onEsc : function(){
this[this.closeAction]();
},
beforeDestroy : function(){
Ext.destroy(
this.resizer,
this.dd,
this.proxy,
this.mask
);
Ext.Window.superclass.beforeDestroy.call(this);
},
onDestroy : function(){
if(this.manager){
this.manager.unregister(this);
}
Ext.Window.superclass.onDestroy.call(this);
},
initTools : function(){
if(this.minimizable){
this.addTool({
id: 'minimize',
handler: this.minimize.createDelegate(this, [])
});
}
if(this.maximizable){
this.addTool({
id: 'maximize',
handler: this.maximize.createDelegate(this, [])
});
this.addTool({
id: 'restore',
handler: this.restore.createDelegate(this, []),
hidden:true
});
this.header.on('dblclick', this.toggleMaximize, this);
}
if(this.closable){
this.addTool({
id: 'close',
handler: this[this.closeAction].createDelegate(this, [])
});
}
},
resizerAction : function(){
var box = this.proxy.getBox();
this.proxy.hide();
this.window.handleResize(box);
return box;
},
beforeResize : function(){
this.resizer.minHeight = Math.max(this.minHeight, this.getFrameHeight() + 40); this.resizer.minWidth = Math.max(this.minWidth, this.getFrameWidth() + 40);
this.resizeBox = this.el.getBox();
},
updateHandles : function(){
if(Ext.isIE && this.resizer){
this.resizer.syncHandleHeight();
this.el.repaint();
}
},
handleResize : function(box){
var rz = this.resizeBox;
if(rz.x != box.x || rz.y != box.y){
this.updateBox(box);
}else{
this.setSize(box);
}
this.focus();
this.updateHandles();
this.saveState();
this.fireEvent("resize", this, box.width, box.height);
},
focus : function(){
var f = this.focusEl, db = this.defaultButton, t = typeof db;
if(t != 'undefined'){
if(t == 'number'){
f = this.buttons[db];
}else if(t == 'string'){
f = Ext.getCmp(db);
}else{
f = db;
}
}
f.focus.defer(10, f);
},
setAnimateTarget : function(el){
el = Ext.get(el);
this.animateTarget = el;
},
beforeShow : function(){
delete this.el.lastXY;
delete this.el.lastLT;
if(this.x === undefined || this.y === undefined){
var xy = this.el.getAlignToXY(this.container, 'c-c');
var pos = this.el.translatePoints(xy[0], xy[1]);
this.x = this.x === undefined? pos.left : this.x;
this.y = this.y === undefined? pos.top : this.y;
}
this.el.setLeftTop(this.x, this.y);
if(this.expandOnShow){
this.expand(false);
}
if(this.modal){
Ext.getBody().addClass("x-body-masked");
this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
this.mask.show();
}
},
show : function(animateTarget, cb, scope){
if(!this.rendered){
this.render(Ext.getBody());
}
if(this.hidden === false){
this.toFront();
return;
}
if(this.fireEvent("beforeshow", this) === false){
return;
}
if(cb){
this.on('show', cb, scope, {single:true});
}
this.hidden = false;
if(animateTarget !== undefined){
this.setAnimateTarget(animateTarget);
}
this.beforeShow();
if(this.animateTarget){
this.animShow();
}else{
this.afterShow();
}
},
afterShow : function(){
this.proxy.hide();
this.el.setStyle('display', 'block');
this.el.show();
if(this.maximized){
this.fitContainer();
}
if(Ext.isMac && Ext.isGecko){ this.cascade(this.setAutoScroll);
}
if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
Ext.EventManager.onWindowResize(this.onWindowResize, this);
}
this.doConstrain();
if(this.layout){
this.doLayout();
}
if(this.keyMap){
this.keyMap.enable();
}
this.toFront();
this.updateHandles();
this.fireEvent("show", this);
},
animShow : function(){
this.proxy.show();
this.proxy.setBox(this.animateTarget.getBox());
this.proxy.setOpacity(0);
var b = this.getBox(false);
b.callback = this.afterShow;
b.scope = this;
b.duration = .25;
b.easing = 'easeNone';
b.opacity = .5;
b.block = true;
this.el.setStyle('display', 'none');
this.proxy.shift(b);
},
hide : function(animateTarget, cb, scope){
if(this.hidden || this.fireEvent("beforehide", this) === false){
return;
}
if(cb){
this.on('hide', cb, scope, {single:true});
}
this.hidden = true;
if(animateTarget !== undefined){
this.setAnimateTarget(animateTarget);
}
if(this.animateTarget){
this.animHide();
}else{
this.el.hide();
this.afterHide();
}
},
afterHide : function(){
this.proxy.hide();
if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
Ext.EventManager.removeResizeListener(this.onWindowResize, this);
}
if(this.modal){
this.mask.hide();
Ext.getBody().removeClass("x-body-masked");
}
if(this.keyMap){
this.keyMap.disable();
}
this.fireEvent("hide", this);
},
animHide : function(){
this.proxy.setOpacity(.5);
this.proxy.show();
var tb = this.getBox(false);
this.proxy.setBox(tb);
this.el.hide();
var b = this.animateTarget.getBox();
b.callback = this.afterHide;
b.scope = this;
b.duration = .25;
b.easing = 'easeNone';
b.block = true;
b.opacity = 0;
this.proxy.shift(b);
},
onWindowResize : function(){
if(this.maximized){
this.fitContainer();
}
if(this.modal){
this.mask.setSize('100%', '100%');
var force = this.mask.dom.offsetHeight;
this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
}
this.doConstrain();
},
doConstrain : function(){
if(this.constrain || this.constrainHeader){
var offsets;
if(this.constrain){
offsets = {
right:this.el.shadowOffset,
left:this.el.shadowOffset,
bottom:this.el.shadowOffset
};
}else {
var s = this.getSize();
offsets = {
right:-(s.width - 100),
bottom:-(s.height - 25)
};
}
var xy = this.el.getConstrainToXY(this.container, true, offsets);
if(xy){
this.setPosition(xy[0], xy[1]);
}
}
},
ghost : function(cls){
var ghost = this.createGhost(cls);
var box = this.getBox(true);
ghost.setLeftTop(box.x, box.y);
ghost.setWidth(box.width);
this.el.hide();
this.activeGhost = ghost;
return ghost;
},
unghost : function(show, matchPosition){
if(show !== false){
this.el.show();
this.focus();
if(Ext.isMac && Ext.isGecko){ this.cascade(this.setAutoScroll);
}
}
if(matchPosition !== false){
this.setPosition(this.activeGhost.getLeft(true), this.activeGhost.getTop(true));
}
this.activeGhost.hide();
this.activeGhost.remove();
delete this.activeGhost;
},
minimize : function(){
this.fireEvent('minimize', this);
},
close : function(){
if(this.fireEvent("beforeclose", this) !== false){
this.hide(null, function(){
this.fireEvent('close', this);
this.destroy();
}, this);
}
},
maximize : function(){
if(!this.maximized){
this.expand(false);
this.restoreSize = this.getSize();
this.restorePos = this.getPosition(true);
this.tools.maximize.hide();
this.tools.restore.show();
this.maximized = true;
this.el.disableShadow();
if(this.dd){
this.dd.lock();
}
if(this.collapsible){
this.tools.toggle.hide();
}
this.el.addClass('x-window-maximized');
this.container.addClass('x-window-maximized-ct');
this.setPosition(0, 0);
this.fitContainer();
this.fireEvent('maximize', this);
}
},
restore : function(){
if(this.maximized){
this.el.removeClass('x-window-maximized');
this.tools.restore.hide();
this.tools.maximize.show();
this.setPosition(this.restorePos[0], this.restorePos[1]);
this.setSize(this.restoreSize.width, this.restoreSize.height);
delete this.restorePos;
delete this.restoreSize;
this.maximized = false;
this.el.enableShadow(true);
if(this.dd){
this.dd.unlock();
}
if(this.collapsible){
this.tools.toggle.show();
}
this.container.removeClass('x-window-maximized-ct');
this.doConstrain();
this.fireEvent('restore', this);
}
},
toggleMaximize : function(){
this[this.maximized ? 'restore' : 'maximize']();
},
fitContainer : function(){
var vs = this.container.getViewSize();
this.setSize(vs.width, vs.height);
},
setZIndex : function(index){
if(this.modal){
this.mask.setStyle("z-index", index);
}
this.el.setZIndex(++index);
index += 5;
if(this.resizer){
this.resizer.proxy.setStyle("z-index", ++index);
}
this.lastZIndex = index;
},
alignTo : function(element, position, offsets){
var xy = this.el.getAlignToXY(element, position, offsets);
this.setPagePosition(xy[0], xy[1]);
return this;
},
anchorTo : function(el, alignment, offsets, monitorScroll, _pname){
var action = function(){
this.alignTo(el, alignment, offsets);
};
Ext.EventManager.onWindowResize(action, this);
var tm = typeof monitorScroll;
if(tm != 'undefined'){
Ext.EventManager.on(window, 'scroll', action, this,
{buffer: tm == 'number' ? monitorScroll : 50});
}
action.call(this);
this[_pname] = action;
return this;
},
toFront : function(){
if(this.manager.bringToFront(this)){
this.focus();
}
return this;
},
setActive : function(active){
if(active){
if(!this.maximized){
this.el.enableShadow(true);
}
this.fireEvent('activate', this);
}else{
this.el.disableShadow();
this.fireEvent('deactivate', this);
}
},
toBack : function(){
this.manager.sendToBack(this);
return this;
},
center : function(){
var xy = this.el.getAlignToXY(this.container, 'c-c');
this.setPagePosition(xy[0], xy[1]);
return this;
}
});
Ext.reg('window', Ext.Window);
Ext.Window.DD = function(win){
this.win = win;
Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id);
this.setHandleElId(win.header.id);
this.scroll = false;
};
Ext.extend(Ext.Window.DD, Ext.dd.DD, {
moveOnly:true,
headerOffsets:[100, 25],
startDrag : function(){
var w = this.win;
this.proxy = w.ghost();
if(w.constrain !== false){
var so = w.el.shadowOffset;
this.constrainTo(w.container, {right: so, left: so, bottom: so});
}else if(w.constrainHeader !== false){
var s = this.proxy.getSize();
this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])});
}
},
b4Drag : Ext.emptyFn,
onDrag : function(e){
this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY());
},
endDrag : function(e){
this.win.unghost();
this.win.saveState();
}
});
Ext.WindowGroup = function(){
var list = {};
var accessList = [];
var front = null;
var sortWindows = function(d1, d2){
return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
};
var orderWindows = function(){
var a = accessList, len = a.length;
if(len > 0){
a.sort(sortWindows);
var seed = a[0].manager.zseed;
for(var i = 0; i < len; i++){
var win = a[i];
if(win && !win.hidden){
win.setZIndex(seed + (i*10));
}
}
}
activateLast();
};
var setActiveWin = function(win){
if(win != front){
if(front){
front.setActive(false);
}
front = win;
if(win){
win.setActive(true);
}
}
};
var activateLast = function(){
for(var i = accessList.length-1; i >=0; --i) {
if(!accessList[i].hidden){
setActiveWin(accessList[i]);
return;
}
}
setActiveWin(null);
};
return {
zseed : 9000,
register : function(win){
list[win.id] = win;
accessList.push(win);
win.on('hide', activateLast);
},
unregister : function(win){
delete list[win.id];
win.un('hide', activateLast);
accessList.remove(win);
},
get : function(id){
return typeof id == "object" ? id : list[id];
},
bringToFront : function(win){
win = this.get(win);
if(win != front){
win._lastAccess = new Date().getTime();
orderWindows();
return true;
}
return false;
},
sendToBack : function(win){
win = this.get(win);
win._lastAccess = -(new Date().getTime());
orderWindows();
return win;
},
hideAll : function(){
for(var id in list){
if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
list[id].hide();
}
}
},
getActive : function(){
return front;
},
getBy : function(fn, scope){
var r = [];
for(var i = accessList.length-1; i >=0; --i) {
var win = accessList[i];
if(fn.call(scope||win, win) !== false){
r.push(win);
}
}
return r;
},
each : function(fn, scope){
for(var id in list){
if(list[id] && typeof list[id] != "function"){
if(fn.call(scope || list[id], list[id]) === false){
return;
}
}
}
}
};
};
Ext.WindowMgr = new Ext.WindowGroup();
Ext.dd.PanelProxy = function(panel, config){
this.panel = panel;
this.id = this.panel.id +'-ddproxy';
Ext.apply(this, config);
};
Ext.dd.PanelProxy.prototype = {
insertProxy : true,
setStatus : Ext.emptyFn,
reset : Ext.emptyFn,
update : Ext.emptyFn,
stop : Ext.emptyFn,
sync: Ext.emptyFn,
getEl : function(){
return this.ghost;
},
getGhost : function(){
return this.ghost;
},
getProxy : function(){
return this.proxy;
},
hide : function(){
if(this.ghost){
if(this.proxy){
this.proxy.remove();
delete this.proxy;
}
this.panel.el.dom.style.display = '';
this.ghost.remove();
delete this.ghost;
}
},
show : function(){
if(!this.ghost){
this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
this.ghost.setXY(this.panel.el.getXY())
if(this.insertProxy){
this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
this.proxy.setSize(this.panel.getSize());
}
this.panel.el.dom.style.display = 'none';
}
},
repair : function(xy, callback, scope){
this.hide();
if(typeof callback == "function"){
callback.call(scope || this);
}
},
moveProxy : function(parentNode, before){
if(this.proxy){
parentNode.insertBefore(this.proxy.dom, before);
}
}
};
Ext.Panel.DD = function(panel, cfg){
this.panel = panel;
this.dragData = {panel: panel};
this.proxy = new Ext.dd.PanelProxy(panel, cfg);
Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);
this.setHandleElId(panel.header.id);
panel.header.setStyle('cursor', 'move');
this.scroll = false;
};
Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {
showFrame: Ext.emptyFn,
startDrag: Ext.emptyFn,
b4StartDrag: function(x, y) {
this.proxy.show();
},
b4MouseDown: function(e) {
var x = e.getPageX();
var y = e.getPageY();
this.autoOffset(x, y);
},
onInitDrag : function(x, y){
this.onStartDrag(x, y);
return true;
},
createFrame : Ext.emptyFn,
getDragEl : function(e){
return this.proxy.ghost.dom;
},
endDrag : function(e){
this.proxy.hide();
this.panel.saveState();
},
autoOffset : function(x, y) {
x -= this.startPageX;
y -= this.startPageY;
this.setDelta(x, y);
}
});
Ext.state.Provider = function(){
this.addEvents("statechange");
this.state = {};
Ext.state.Provider.superclass.constructor.call(this);
};
Ext.extend(Ext.state.Provider, Ext.util.Observable, {
get : function(name, defaultValue){
return typeof this.state[name] == "undefined" ?
defaultValue : this.state[name];
},
clear : function(name){
delete this.state[name];
this.fireEvent("statechange", this, name, null);
},
set : function(name, value){
this.state[name] = value;
this.fireEvent("statechange", this, name, value);
},
decodeValue : function(cookie){
var re = /^(a|n|d|b|s|o)\:(.*)$/;
var matches = re.exec(unescape(cookie));
if(!matches || !matches[1]) return;
var type = matches[1];
var v = matches[2];
switch(type){
case "n":
return parseFloat(v);
case "d":
return new Date(Date.parse(v));
case "b":
return (v == "1");
case "a":
var all = [];
var values = v.split("^");
for(var i = 0, len = values.length; i < len; i++){
all.push(this.decodeValue(values[i]));
}
return all;
case "o":
var all = {};
var values = v.split("^");
for(var i = 0, len = values.length; i < len; i++){
var kv = values[i].split("=");
all[kv[0]] = this.decodeValue(kv[1]);
}
return all;
default:
return v;
}
},
encodeValue : function(v){
var enc;
if(typeof v == "number"){
enc = "n:" + v;
}else if(typeof v == "boolean"){
enc = "b:" + (v ? "1" : "0");
}else if(Ext.isDate(v)){
enc = "d:" + v.toGMTString();
}else if(Ext.isArray(v)){
var flat = "";
for(var i = 0, len = v.length; i < len; i++){
flat += this.encodeValue(v[i]);
if(i != len-1) flat += "^";
}
enc = "a:" + flat;
}else if(typeof v == "object"){
var flat = "";
for(var key in v){
if(typeof v[key] != "function" && v[key] !== undefined){
flat += key + "=" + this.encodeValue(v[key]) + "^";
}
}
enc = "o:" + flat.substring(0, flat.length-1);
}else{
enc = "s:" + v;
}
return escape(enc);
}
});
Ext.state.Manager = function(){
var provider = new Ext.state.Provider();
return {
setProvider : function(stateProvider){
provider = stateProvider;
},
get : function(key, defaultValue){
return provider.get(key, defaultValue);
},
set : function(key, value){
provider.set(key, value);
},
clear : function(key){
provider.clear(key);
},
getProvider : function(){
return provider;
}
};
}();
Ext.state.CookieProvider = function(config){
Ext.state.CookieProvider.superclass.constructor.call(this);
this.path = "/";
this.expires = new Date(new Date().getTime()+(1000*60*60*24*7));
this.domain = null;
this.secure = false;
Ext.apply(this, config);
this.state = this.readCookies();
};
Ext.extend(Ext.state.CookieProvider, Ext.state.Provider, {
set : function(name, value){
if(typeof value == "undefined" || value === null){
this.clear(name);
return;
}
this.setCookie(name, value);
Ext.state.CookieProvider.superclass.set.call(this, name, value);
},
clear : function(name){
this.clearCookie(name);
Ext.state.CookieProvider.superclass.clear.call(this, name);
},
readCookies : function(){
var cookies = {};
var c = document.cookie + ";";
var re = /\s?(.*?)=(.*?);/g;
var matches;
while((matches = re.exec(c)) != null){
var name = matches[1];
var value = matches[2];
if(name && name.substring(0,3) == "ys-"){
cookies[name.substr(3)] = this.decodeValue(value);
}
}
return cookies;
},
setCookie : function(name, value){
document.cookie = "ys-"+ name + "=" + this.encodeValue(value) +
((this.expires == null) ? "" : ("; expires=" + this.expires.toGMTString())) +
((this.path == null) ? "" : ("; path=" + this.path)) +
((this.domain == null) ? "" : ("; domain=" + this.domain)) +
((this.secure == true) ? "; secure" : "");
},
clearCookie : function(name){
document.cookie = "ys-" + name + "=null; expires=Thu, 01-Jan-70 00:00:01 GMT" +
((this.path == null) ? "" : ("; path=" + this.path)) +
((this.domain == null) ? "" : ("; domain=" + this.domain)) +
((this.secure == true) ? "; secure" : "");
}
});
Ext.DataView = Ext.extend(Ext.BoxComponent, {
selectedClass : "x-view-selected",
emptyText : "",
last: false,
initComponent : function(){
Ext.DataView.superclass.initComponent.call(this);
if(typeof this.tpl == "string"){
this.tpl = new Ext.XTemplate(this.tpl);
}
this.addEvents(
"beforeclick",
"click",
"containerclick",
"dblclick",
"contextmenu",
"selectionchange",
"beforeselect"
);
this.all = new Ext.CompositeElementLite();
this.selected = new Ext.CompositeElementLite();
},
onRender : function(){
if(!this.el){
this.el = document.createElement('div');
}
Ext.DataView.superclass.onRender.apply(this, arguments);
},
afterRender : function(){
Ext.DataView.superclass.afterRender.call(this);
this.el.on({
"click": this.onClick,
"dblclick": this.onDblClick,
"contextmenu": this.onContextMenu,
scope:this
});
if(this.overClass){
this.el.on({
"mouseover": this.onMouseOver,
"mouseout": this.onMouseOut,
scope:this
});
}
if(this.store){
this.setStore(this.store, true);
}
},
refresh : function(){
this.clearSelections(false, true);
this.el.update("");
var html = [];
var records = this.store.getRange();
if(records.length < 1){
this.el.update(this.emptyText);
this.all.clear();
return;
}
this.tpl.overwrite(this.el, this.collectData(records, 0));
this.all.fill(Ext.query(this.itemSelector, this.el.dom));
this.updateIndexes(0);
},
prepareData : function(data){
return data;
},
collectData : function(records, startIndex){
var r = [];
for(var i = 0, len = records.length; i < len; i++){
r[r.length] = this.prepareData(records[i].data, startIndex+i, records[i]);
}
return r;
},
bufferRender : function(records){
var div = document.createElement('div');
this.tpl.overwrite(div, this.collectData(records));
return Ext.query(this.itemSelector, div);
},
onUpdate : function(ds, record){
var index = this.store.indexOf(record);
var sel = this.isSelected(index);
var original = this.all.elements[index];
var node = this.bufferRender([record], index)[0];
this.all.replaceElement(index, node, true);
if(sel){
this.selected.replaceElement(original, node);
this.all.item(index).addClass(this.selectedClass);
}
this.updateIndexes(index, index);
},
onAdd : function(ds, records, index){
if(this.all.getCount() == 0){
this.refresh();
return;
}
var nodes = this.bufferRender(records, index), n;
if(index < this.all.getCount()){
n = this.all.item(index).insertSibling(nodes, 'before', true);
this.all.elements.splice(index, 0, n);
}else{
n = this.all.last().insertSibling(nodes, 'after', true);
this.all.elements.push(n);
}
this.updateIndexes(index);
},
onRemove : function(ds, record, index){
this.deselect(index);
this.all.removeElement(index, true);
this.updateIndexes(index);
},
refreshNode : function(index){
this.onUpdate(this.store, this.store.getAt(index));
},
updateIndexes : function(startIndex, endIndex){
var ns = this.all.elements;
startIndex = startIndex || 0;
endIndex = endIndex || ((endIndex === 0) ? 0 : (ns.length - 1));
for(var i = startIndex; i <= endIndex; i++){
ns[i].viewIndex = i;
}
},
setStore : function(store, initial){
if(!initial && this.store){
this.store.un("beforeload", this.onBeforeLoad, this);
this.store.un("datachanged", this.refresh, this);
this.store.un("add", this.onAdd, this);
this.store.un("remove", this.onRemove, this);
this.store.un("update", this.onUpdate, this);
this.store.un("clear", this.refresh, this);
}
if(store){
store = Ext.StoreMgr.lookup(store);
store.on("beforeload", this.onBeforeLoad, this);
store.on("datachanged", this.refresh, this);
store.on("add", this.onAdd, this);
store.on("remove", this.onRemove, this);
store.on("update", this.onUpdate, this);
store.on("clear", this.refresh, this);
}
this.store = store;
if(store){
this.refresh();
}
},
findItemFromChild : function(node){
return Ext.fly(node).findParent(this.itemSelector, this.el);
},
onClick : function(e){
var item = e.getTarget(this.itemSelector, this.el);
if(item){
var index = this.indexOf(item);
if(this.onItemClick(item, index, e) !== false){
this.fireEvent("click", this, index, item, e);
}
}else{
if(this.fireEvent("containerclick", this, e) !== false){
this.clearSelections();
}
}
},
onContextMenu : function(e){
var item = e.getTarget(this.itemSelector, this.el);
if(item){
this.fireEvent("contextmenu", this, this.indexOf(item), item, e);
}
},
onDblClick : function(e){
var item = e.getTarget(this.itemSelector, this.el);
if(item){
this.fireEvent("dblclick", this, this.indexOf(item), item, e);
}
},
onMouseOver : function(e){
var item = e.getTarget(this.itemSelector, this.el);
if(item && item !== this.lastItem){
this.lastItem = item;
Ext.fly(item).addClass(this.overClass);
}
},
onMouseOut : function(e){
if(this.lastItem){
if(!e.within(this.lastItem, true)){
Ext.fly(this.lastItem).removeClass(this.overClass);
delete this.lastItem;
}
}
},
onItemClick : function(item, index, e){
if(this.fireEvent("beforeclick", this, index, item, e) === false){
return false;
}
if(this.multiSelect){
this.doMultiSelection(item, index, e);
e.preventDefault();
}else if(this.singleSelect){
this.doSingleSelection(item, index, e);
e.preventDefault();
}
return true;
},
doSingleSelection : function(item, index, e){
if(e.ctrlKey && this.isSelected(index)){
this.deselect(index);
}else{
this.select(index, false);
}
},
doMultiSelection : function(item, index, e){
if(e.shiftKey && this.last !== false){
var last = this.last;
this.selectRange(last, index, e.ctrlKey);
this.last = last;
}else{
if((e.ctrlKey||this.simpleSelect) && this.isSelected(index)){
this.deselect(index);
}else{
this.select(index, e.ctrlKey || e.shiftKey || this.simpleSelect);
}
}
},
getSelectionCount : function(){
return this.selected.getCount()
},
getSelectedNodes : function(){
return this.selected.elements;
},
getSelectedIndexes : function(){
var indexes = [], s = this.selected.elements;
for(var i = 0, len = s.length; i < len; i++){
indexes.push(s[i].viewIndex);
}
return indexes;
},
getSelectedRecords : function(){
var r = [], s = this.selected.elements;
for(var i = 0, len = s.length; i < len; i++){
r[r.length] = this.store.getAt(s[i].viewIndex);
}
return r;
},
getRecords : function(nodes){
var r = [], s = nodes;
for(var i = 0, len = s.length; i < len; i++){
r[r.length] = this.store.getAt(s[i].viewIndex);
}
return r;
},
getRecord : function(node){
return this.store.getAt(node.viewIndex);
},
clearSelections : function(suppressEvent, skipUpdate){
if(this.multiSelect || this.singleSelect){
if(!skipUpdate){
this.selected.removeClass(this.selectedClass);
}
this.selected.clear();
this.last = false;
if(!suppressEvent){
this.fireEvent("selectionchange", this, this.selected.elements);
}
}
},
isSelected : function(node){
return this.selected.contains(this.getNode(node));
},
deselect : function(node){
if(this.isSelected(node)){
var node = this.getNode(node);
this.selected.removeElement(node);
if(this.last == node.viewIndex){
this.last = false;
}
Ext.fly(node).removeClass(this.selectedClass);
this.fireEvent("selectionchange", this, this.selected.elements);
}
},
select : function(nodeInfo, keepExisting, suppressEvent){
if(Ext.isArray(nodeInfo)){
if(!keepExisting){
this.clearSelections(true);
}
for(var i = 0, len = nodeInfo.length; i < len; i++){
this.select(nodeInfo[i], true, true);
}
} else{
var node = this.getNode(nodeInfo);
if(!keepExisting){
this.clearSelections(true);
}
if(node && !this.isSelected(node)){
if(this.fireEvent("beforeselect", this, node, this.selected.elements) !== false){
Ext.fly(node).addClass(this.selectedClass);
this.selected.add(node);
this.last = node.viewIndex;
if(!suppressEvent){
this.fireEvent("selectionchange", this, this.selected.elements);
}
}
}
}
},
selectRange : function(start, end, keepExisting){
if(!keepExisting){
this.clearSelections(true);
}
this.select(this.getNodes(start, end), true);
},
getNode : function(nodeInfo){
if(typeof nodeInfo == "string"){
return document.getElementById(nodeInfo);
}else if(typeof nodeInfo == "number"){
return this.all.elements[nodeInfo];
}
return nodeInfo;
},
getNodes : function(start, end){
var ns = this.all.elements;
start = start || 0;
end = typeof end == "undefined" ? ns.length - 1 : end;
var nodes = [], i;
if(start <= end){
for(i = start; i <= end; i++){
nodes.push(ns[i]);
}
} else{
for(i = start; i >= end; i--){
nodes.push(ns[i]);
}
}
return nodes;
},
indexOf : function(node){
node = this.getNode(node);
if(typeof node.viewIndex == "number"){
return node.viewIndex;
}
return this.all.indexOf(node);
},
onBeforeLoad : function(){
if(this.loadingText){
this.clearSelections(false, true);
this.el.update('<div class="loading-indicator">'+this.loadingText+'</div>');
this.all.clear();
}
}
});
Ext.reg('dataview', Ext.DataView);
Ext.ColorPalette = function(config){
Ext.ColorPalette.superclass.constructor.call(this, config);
this.addEvents(
'select'
);
if(this.handler){
this.on("select", this.handler, this.scope, true);
}
};
Ext.extend(Ext.ColorPalette, Ext.Component, {
itemCls : "x-color-palette",
value : null,
clickEvent:'click',
ctype: "Ext.ColorPalette",
allowReselect : false,
colors : [
"000000", "993300", "333300", "003300", "003366", "000080", "333399", "333333",
"800000", "FF6600", "808000", "008000", "008080", "0000FF", "666699", "808080",
"FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF", "800080", "969696",
"FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", "993366", "C0C0C0",
"FF99CC", "FFCC99", "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"
],
onRender : function(container, position){
var t = this.tpl || new Ext.XTemplate(
'<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on"> </span></em></a></tpl>'
);
var el = document.createElement("div");
el.className = this.itemCls;
t.overwrite(el, this.colors);
container.dom.insertBefore(el, position);
this.el = Ext.get(el);
this.el.on(this.clickEvent, this.handleClick, this, {delegate: "a"});
if(this.clickEvent != 'click'){
this.el.on('click', Ext.emptyFn, this, {delegate: "a", preventDefault:true});
}
},
afterRender : function(){
Ext.ColorPalette.superclass.afterRender.call(this);
if(this.value){
var s = this.value;
this.value = null;
this.select(s);
}
},
handleClick : function(e, t){
e.preventDefault();
if(!this.disabled){
var c = t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];
this.select(c.toUpperCase());
}
},
select : function(color){
color = color.replace("#", "");
if(color != this.value || this.allowReselect){
var el = this.el;
if(this.value){
el.child("a.color-"+this.value).removeClass("x-color-palette-sel");
}
el.child("a.color-"+color).addClass("x-color-palette-sel");
this.value = color;
this.fireEvent("select", this, color);
}
}
});
Ext.reg('colorpalette', Ext.ColorPalette);
Ext.DatePicker = Ext.extend(Ext.Component, {
todayText : "Today",
okText : " OK ",
cancelText : "Cancel",
todayTip : "{0} (Spacebar)",
minDate : null,
maxDate : null,
minText : "This date is before the minimum date",
maxText : "This date is after the maximum date",
format : "m/d/y",
disabledDays : null,
disabledDaysText : "",
disabledDatesRE : null,
disabledDatesText : "",
constrainToViewport : true,
monthNames : Date.monthNames,
dayNames : Date.dayNames,
nextText: 'Next Month (Control+Right)',
prevText: 'Previous Month (Control+Left)',
monthYearText: 'Choose a month (Control+Up/Down to move years)',
startDay : 0,
initComponent : function(){
Ext.DatePicker.superclass.initComponent.call(this);
this.value = this.value ?
this.value.clearTime() : new Date().clearTime();
this.addEvents(
'select'
);
if(this.handler){
this.on("select", this.handler, this.scope || this);
}
this.initDisabledDays();
},
initDisabledDays : function(){
if(!this.disabledDatesRE && this.disabledDates){
var dd = this.disabledDates;
var re = "(?:";
for(var i = 0; i < dd.length; i++){
re += dd[i];
if(i != dd.length-1) re += "|";
}
this.disabledDatesRE = new RegExp(re + ")");
}
},
setValue : function(value){
var old = this.value;
this.value = value.clearTime(true);
if(this.el){
this.update(this.value);
}
},
getValue : function(){
return this.value;
},
focus : function(){
if(this.el){
this.update(this.activeDate);
}
},
onRender : function(container, position){
var m = [
'<table cellspacing="0">',
'<tr><td class="x-date-left"><a href="#" title="', this.prevText ,'"> </a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="', this.nextText ,'"> </a></td></tr>',
'<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];
var dn = this.dayNames;
for(var i = 0; i < 7; i++){
var d = this.startDay+i;
if(d > 6){
d = d-7;
}
m.push("<th><span>", dn[d].substr(0,1), "</span></th>");
}
m[m.length] = "</tr></thead><tbody><tr>";
for(var i = 0; i < 42; i++) {
if(i % 7 == 0 && i != 0){
m[m.length] = "</tr><tr>";
}
m[m.length] = '<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>';
}
m[m.length] = '</tr></tbody></table></td></tr><tr><td colspan="3" class="x-date-bottom" align="center"></td></tr></table><div class="x-date-mp"></div>';
var el = document.createElement("div");
el.className = "x-date-picker";
el.innerHTML = m.join("");
container.dom.insertBefore(el, position);
this.el = Ext.get(el);
this.eventEl = Ext.get(el.firstChild);
new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"), {
handler: this.showPrevMonth,
scope: this,
preventDefault:true,
stopDefault:true
});
new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"), {
handler: this.showNextMonth,
scope: this,
preventDefault:true,
stopDefault:true
});
this.eventEl.on("mousewheel", this.handleMouseWheel, this);
this.monthPicker = this.el.down('div.x-date-mp');
this.monthPicker.enableDisplayMode('block');
var kn = new Ext.KeyNav(this.eventEl, {
"left" : function(e){
e.ctrlKey ?
this.showPrevMonth() :
this.update(this.activeDate.add("d", -1));
},
"right" : function(e){
e.ctrlKey ?
this.showNextMonth() :
this.update(this.activeDate.add("d", 1));
},
"up" : function(e){
e.ctrlKey ?
this.showNextYear() :
this.update(this.activeDate.add("d", -7));
},
"down" : function(e){
e.ctrlKey ?
this.showPrevYear() :
this.update(this.activeDate.add("d", 7));
},
"pageUp" : function(e){
this.showNextMonth();
},
"pageDown" : function(e){
this.showPrevMonth();
},
"enter" : function(e){
e.stopPropagation();
return true;
},
scope : this
});
this.eventEl.on("click", this.handleDateClick, this, {delegate: "a.x-date-date"});
this.eventEl.addKeyListener(Ext.EventObject.SPACE, this.selectToday, this);
this.el.unselectable();
this.cells = this.el.select("table.x-date-inner tbody td");
this.textNodes = this.el.query("table.x-date-inner tbody span");
this.mbtn = new Ext.Button({
text: " ",
tooltip: this.monthYearText,
renderTo: this.el.child("td.x-date-middle", true)
});
this.mbtn.on('click', this.showMonthPicker, this);
this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");
var today = (new Date()).dateFormat(this.format);
this.todayBtn = new Ext.Button({
renderTo: this.el.child("td.x-date-bottom", true),
text: String.format(this.todayText, today),
tooltip: String.format(this.todayTip, today),
handler: this.selectToday,
scope: this
});
if(Ext.isIE){
this.el.repaint();
}
this.update(this.value);
},
createMonthPicker : function(){
if(!this.monthPicker.dom.firstChild){
var buf = ['<table border="0" cellspacing="0">'];
for(var i = 0; i < 6; i++){
buf.push(
'<tr><td class="x-date-mp-month"><a href="#">', this.monthNames[i].substr(0, 3), '</a></td>',
'<td class="x-date-mp-month x-date-mp-sep"><a href="#">', this.monthNames[i+6].substr(0, 3), '</a></td>',
i == 0 ?
'<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>' :
'<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>'
);
}
buf.push(
'<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',
this.okText,
'</button><button type="button" class="x-date-mp-cancel">',
this.cancelText,
'</button></td></tr>',
'</table>'
);
this.monthPicker.update(buf.join(''));
this.monthPicker.on('click', this.onMonthClick, this);
this.monthPicker.on('dblclick', this.onMonthDblClick, this);
this.mpMonths = this.monthPicker.select('td.x-date-mp-month');
this.mpYears = this.monthPicker.select('td.x-date-mp-year');
this.mpMonths.each(function(m, a, i){
i += 1;
if((i%2) == 0){
m.dom.xmonth = 5 + Math.round(i * .5);
}else{
m.dom.xmonth = Math.round((i-1) * .5);
}
});
}
},
showMonthPicker : function(){
this.createMonthPicker();
var size = this.el.getSize();
this.monthPicker.setSize(size);
this.monthPicker.child('table').setSize(size);
this.mpSelMonth = (this.activeDate || this.value).getMonth();
this.updateMPMonth(this.mpSelMonth);
this.mpSelYear = (this.activeDate || this.value).getFullYear();
this.updateMPYear(this.mpSelYear);
this.monthPicker.slideIn('t', {duration:.2});
},
updateMPYear : function(y){
this.mpyear = y;
var ys = this.mpYears.elements;
for(var i = 1; i <= 10; i++){
var td = ys[i-1], y2;
if((i%2) == 0){
y2 = y + Math.round(i * .5);
td.firstChild.innerHTML = y2;
td.xyear = y2;
}else{
y2 = y - (5-Math.round(i * .5));
td.firstChild.innerHTML = y2;
td.xyear = y2;
}
this.mpYears.item(i-1)[y2 == this.mpSelYear ? 'addClass' : 'removeClass']('x-date-mp-sel');
}
},
updateMPMonth : function(sm){
this.mpMonths.each(function(m, a, i){
m[m.dom.xmonth == sm ? 'addClass' : 'removeClass']('x-date-mp-sel');
});
},
selectMPMonth: function(m){
},
onMonthClick : function(e, t){
e.stopEvent();
var el = new Ext.Element(t), pn;
if(el.is('button.x-date-mp-cancel')){
this.hideMonthPicker();
}
else if(el.is('button.x-date-mp-ok')){
this.update(new Date(this.mpSelYear, this.mpSelMonth, (this.activeDate || this.value).getDate()));
this.hideMonthPicker();
}
else if(pn = el.up('td.x-date-mp-month', 2)){
this.mpMonths.removeClass('x-date-mp-sel');
pn.addClass('x-date-mp-sel');
this.mpSelMonth = pn.dom.xmonth;
}
else if(pn = el.up('td.x-date-mp-year', 2)){
this.mpYears.removeClass('x-date-mp-sel');
pn.addClass('x-date-mp-sel');
this.mpSelYear = pn.dom.xyear;
}
else if(el.is('a.x-date-mp-prev')){
this.updateMPYear(this.mpyear-10);
}
else if(el.is('a.x-date-mp-next')){
this.updateMPYear(this.mpyear+10);
}
},
onMonthDblClick : function(e, t){
e.stopEvent();
var el = new Ext.Element(t), pn;
if(pn = el.up('td.x-date-mp-month', 2)){
this.update(new Date(this.mpSelYear, pn.dom.xmonth, (this.activeDate || this.value).getDate()));
this.hideMonthPicker();
}
else if(pn = el.up('td.x-date-mp-year', 2)){
this.update(new Date(pn.dom.xyear, this.mpSelMonth, (this.activeDate || this.value).getDate()));
this.hideMonthPicker();
}
},
hideMonthPicker : function(disableAnim){
if(this.monthPicker){
if(disableAnim === true){
this.monthPicker.hide();
}else{
this.monthPicker.slideOut('t', {duration:.2});
}
}
},
showPrevMonth : function(e){
this.update(this.activeDate.add("mo", -1));
},
showNextMonth : function(e){
this.update(this.activeDate.add("mo", 1));
},
showPrevYear : function(){
this.update(this.activeDate.add("y", -1));
},
showNextYear : function(){
this.update(this.activeDate.add("y", 1));
},
handleMouseWheel : function(e){
var delta = e.getWheelDelta();
if(delta > 0){
this.showPrevMonth();
e.stopEvent();
} else if(delta < 0){
this.showNextMonth();
e.stopEvent();
}
},
handleDateClick : function(e, t){
e.stopEvent();
if(t.dateValue && !Ext.fly(t.parentNode).hasClass("x-date-disabled")){
this.setValue(new Date(t.dateValue));
this.fireEvent("select", this, this.value);
}
},
selectToday : function(){
this.setValue(new Date().clearTime());
this.fireEvent("select", this, this.value);
},
update : function(date){
var vd = this.activeDate;
this.activeDate = date;
if(vd && this.el){
var t = date.getTime();
if(vd.getMonth() == date.getMonth() && vd.getFullYear() == date.getFullYear()){
this.cells.removeClass("x-date-selected");
this.cells.each(function(c){
if(c.dom.firstChild.dateValue == t){
c.addClass("x-date-selected");
setTimeout(function(){
try{c.dom.firstChild.focus();}catch(e){}
}, 50);
return false;
}
});
return;
}
}
var days = date.getDaysInMonth();
var firstOfMonth = date.getFirstDateOfMonth();
var startingPos = firstOfMonth.getDay()-this.startDay;
if(startingPos <= this.startDay){
startingPos += 7;
}
var pm = date.add("mo", -1);
var prevStart = pm.getDaysInMonth()-startingPos;
var cells = this.cells.elements;
var textEls = this.textNodes;
days += startingPos;
var day = 86400000;
var d = (new Date(pm.getFullYear(), pm.getMonth(), prevStart)).clearTime();
var today = new Date().clearTime().getTime();
var sel = date.clearTime().getTime();
var min = this.minDate ? this.minDate.clearTime() : Number.NEGATIVE_INFINITY;
var max = this.maxDate ? this.maxDate.clearTime() : Number.POSITIVE_INFINITY;
var ddMatch = this.disabledDatesRE;
var ddText = this.disabledDatesText;
var ddays = this.disabledDays ? this.disabledDays.join("") : false;
var ddaysText = this.disabledDaysText;
var format = this.format;
var setCellClass = function(cal, cell){
cell.title = "";
var t = d.getTime();
cell.firstChild.dateValue = t;
if(t == today){
cell.className += " x-date-today";
cell.title = cal.todayText;
}
if(t == sel){
cell.className += " x-date-selected";
setTimeout(function(){
try{cell.firstChild.focus();}catch(e){}
}, 50);
}
if(t < min) {
cell.className = " x-date-disabled";
cell.title = cal.minText;
return;
}
if(t > max) {
cell.className = " x-date-disabled";
cell.title = cal.maxText;
return;
}
if(ddays){
if(ddays.indexOf(d.getDay()) != -1){
cell.title = ddaysText;
cell.className = " x-date-disabled";
}
}
if(ddMatch && format){
var fvalue = d.dateFormat(format);
if(ddMatch.test(fvalue)){
cell.title = ddText.replace("%0", fvalue);
cell.className = " x-date-disabled";
}
}
};
var i = 0;
for(; i < startingPos; i++) {
textEls[i].innerHTML = (++prevStart);
d.setDate(d.getDate()+1);
cells[i].className = "x-date-prevday";
setCellClass(this, cells[i]);
}
for(; i < days; i++){
intDay = i - startingPos + 1;
textEls[i].innerHTML = (intDay);
d.setDate(d.getDate()+1);
cells[i].className = "x-date-active";
setCellClass(this, cells[i]);
}
var extraDays = 0;
for(; i < 42; i++) {
textEls[i].innerHTML = (++extraDays);
d.setDate(d.getDate()+1);
cells[i].className = "x-date-nextday";
setCellClass(this, cells[i]);
}
this.mbtn.setText(this.monthNames[date.getMonth()] + " " + date.getFullYear());
if(!this.internalRender){
var main = this.el.dom.firstChild;
var w = main.offsetWidth;
this.el.setWidth(w + this.el.getBorderWidth("lr"));
Ext.fly(main).setWidth(w);
this.internalRender = true;
if(Ext.isOpera && !this.secondPass){
main.rows[0].cells[1].style.width = (w - (main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth)) + "px";
this.secondPass = true;
this.update.defer(10, this, [date]);
}
}
},
beforeDestroy : function() {
this.mbtn.destroy();
this.todayBtn.destroy();
}
});
Ext.reg('datepicker', Ext.DatePicker);
Ext.TabPanel = Ext.extend(Ext.Panel, {
monitorResize : true,
deferredRender : true,
tabWidth: 120,
minTabWidth: 30,
resizeTabs:false,
enableTabScroll: false,
scrollIncrement : 0,
scrollRepeatInterval : 400,
scrollDuration : .35,
animScroll : true,
tabPosition: 'top',
baseCls: 'x-tab-panel',
autoTabs : false,
autoTabSelector:'div.x-tab',
activeTab : null,
tabMargin : 2,
plain: false,
wheelIncrement : 20,
idDelimiter : '__',
itemCls : 'x-tab-item',
elements: 'body',
headerAsText: false,
frame: false,
hideBorders:true,
initComponent : function(){
this.frame = false;
Ext.TabPanel.superclass.initComponent.call(this);
this.addEvents(
'beforetabchange',
'tabchange',
'contextmenu'
);
this.setLayout(new Ext.layout.CardLayout({
deferredRender: this.deferredRender
}));
if(this.tabPosition == 'top'){
this.elements += ',header';
this.stripTarget = 'header';
}else {
this.elements += ',footer';
this.stripTarget = 'footer';
}
if(!this.stack){
this.stack = Ext.TabPanel.AccessStack();
}
this.initItems();
},
render : function(){
Ext.TabPanel.superclass.render.apply(this, arguments);
if(this.activeTab !== undefined){
var item = this.activeTab;
delete this.activeTab;
this.setActiveTab(item);
}
},
onRender : function(ct, position){
Ext.TabPanel.superclass.onRender.call(this, ct, position);
if(this.plain){
var pos = this.tabPosition == 'top' ? 'header' : 'footer';
this[pos].addClass('x-tab-panel-'+pos+'-plain');
}
var st = this[this.stripTarget];
this.stripWrap = st.createChild({cls:'x-tab-strip-wrap', cn:{
tag:'ul', cls:'x-tab-strip x-tab-strip-'+this.tabPosition}});
this.stripSpacer = st.createChild({cls:'x-tab-strip-spacer'});
this.strip = new Ext.Element(this.stripWrap.dom.firstChild);
this.edge = this.strip.createChild({tag:'li', cls:'x-tab-edge'});
this.strip.createChild({cls:'x-clear'});
this.body.addClass('x-tab-panel-body-'+this.tabPosition);
if(!this.itemTpl){
var tt = new Ext.Template(
'<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>',
'<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">',
'<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>',
'</em></a></li>'
);
tt.disableFormats = true;
tt.compile();
Ext.TabPanel.prototype.itemTpl = tt;
}
this.items.each(this.initTab, this);
},
afterRender : function(){
Ext.TabPanel.superclass.afterRender.call(this);
if(this.autoTabs){
this.readTabs(false);
}
},
initEvents : function(){
Ext.TabPanel.superclass.initEvents.call(this);
this.on('add', this.onAdd, this);
this.on('remove', this.onRemove, this);
this.strip.on('mousedown', this.onStripMouseDown, this);
this.strip.on('click', this.onStripClick, this);
this.strip.on('contextmenu', this.onStripContextMenu, this);
if(this.enableTabScroll){
this.strip.on('mousewheel', this.onWheel, this);
}
},
findTargets : function(e){
var item = null;
var itemEl = e.getTarget('li', this.strip);
if(itemEl){
item = this.getComponent(itemEl.id.split(this.idDelimiter)[1]);
if(item.disabled){
return {
close : null,
item : null,
el : null
};
}
}
return {
close : e.getTarget('.x-tab-strip-close', this.strip),
item : item,
el : itemEl
};
},
onStripMouseDown : function(e){
e.preventDefault();
if(e.button != 0){
return;
}
var t = this.findTargets(e);
if(t.close){
this.remove(t.item);
return;
}
if(t.item && t.item != this.activeTab){
this.setActiveTab(t.item);
}
},
onStripClick : function(e){
var t = this.findTargets(e);
if(!t.close && t.item && t.item != this.activeTab){
this.setActiveTab(t.item);
}
},
onStripContextMenu : function(e){
e.preventDefault();
var t = this.findTargets(e);
if(t.item){
this.fireEvent('contextmenu', this, t.item, e);
}
},
readTabs : function(removeExisting){
if(removeExisting === true){
this.items.each(function(item){
this.remove(item);
}, this);
}
var tabs = this.el.query(this.autoTabSelector);
for(var i = 0, len = tabs.length; i < len; i++){
var tab = tabs[i];
var title = tab.getAttribute('title');
tab.removeAttribute('title');
this.add({
title: title,
el: tab
});
}
},
initTab : function(item, index){
var before = this.strip.dom.childNodes[index];
var cls = item.closable ? 'x-tab-strip-closable' : '';
if(item.disabled){
cls += ' x-item-disabled';
}
if(item.iconCls){
cls += ' x-tab-with-icon';
}
if(item.tabCls){
cls += ' ' + item.tabCls;
}
var p = {
id: this.id + this.idDelimiter + item.getItemId(),
text: item.title,
cls: cls,
iconCls: item.iconCls || ''
};
var el = before ?
this.itemTpl.insertBefore(before, p) :
this.itemTpl.append(this.strip, p);
Ext.fly(el).addClassOnOver('x-tab-strip-over');
if(item.tabTip){
Ext.fly(el).child('span.x-tab-strip-text', true).qtip = item.tabTip;
}
item.on('disable', this.onItemDisabled, this);
item.on('enable', this.onItemEnabled, this);
item.on('titlechange', this.onItemTitleChanged, this);
item.on('beforeshow', this.onBeforeShowItem, this);
},
onAdd : function(tp, item, index){
this.initTab(item, index);
if(this.items.getCount() == 1){
this.syncSize();
}
this.delegateUpdates();
},
onBeforeAdd : function(item){
var existing = item.events ? (this.items.containsKey(item.getItemId()) ? item : null) : this.items.get(item);
if(existing){
this.setActiveTab(item);
return false;
}
Ext.TabPanel.superclass.onBeforeAdd.apply(this, arguments);
var es = item.elements;
item.elements = es ? es.replace(',header', '') : es;
item.border = (item.border === true);
},
onRemove : function(tp, item){
Ext.removeNode(this.getTabEl(item));
this.stack.remove(item);
if(item == this.activeTab){
var next = this.stack.next();
if(next){
this.setActiveTab(next);
}else{
this.setActiveTab(0);
}
}
this.delegateUpdates();
},
onBeforeShowItem : function(item){
if(item != this.activeTab){
this.setActiveTab(item);
return false;
}
},
onItemDisabled : function(item){
var el = this.getTabEl(item);
if(el){
Ext.fly(el).addClass('x-item-disabled');
}
this.stack.remove(item);
},
onItemEnabled : function(item){
var el = this.getTabEl(item);
if(el){
Ext.fly(el).removeClass('x-item-disabled');
}
},
onItemTitleChanged : function(item){
var el = this.getTabEl(item);
if(el){
Ext.fly(el).child('span.x-tab-strip-text', true).innerHTML = item.title;
}
},
getTabEl : function(item){
var itemId = (typeof item === 'number')?this.items.items[item].getItemId() : item.getItemId();
return document.getElementById(this.id+this.idDelimiter+itemId);
},
onResize : function(){
Ext.TabPanel.superclass.onResize.apply(this, arguments);
this.delegateUpdates();
},
beginUpdate : function(){
this.suspendUpdates = true;
},
endUpdate : function(){
this.suspendUpdates = false;
this.delegateUpdates();
},
hideTabStripItem : function(item){
item = this.getComponent(item);
var el = this.getTabEl(item);
if(el){
el.style.display = 'none';
this.delegateUpdates();
}
},
unhideTabStripItem : function(item){
item = this.getComponent(item);
var el = this.getTabEl(item);
if(el){
el.style.display = '';
this.delegateUpdates();
}
},
delegateUpdates : function(){
if(this.suspendUpdates){
return;
}
if(this.resizeTabs && this.rendered){
this.autoSizeTabs();
}
if(this.enableTabScroll && this.rendered){
this.autoScrollTabs();
}
},
autoSizeTabs : function(){
var count = this.items.length;
var ce = this.tabPosition != 'bottom' ? 'header' : 'footer';
var ow = this[ce].dom.offsetWidth;
var aw = this[ce].dom.clientWidth;
if(!this.resizeTabs || count < 1 || !aw){ return;
}
var each = Math.max(Math.min(Math.floor((aw-4) / count) - this.tabMargin, this.tabWidth), this.minTabWidth); this.lastTabWidth = each;
var lis = this.stripWrap.dom.getElementsByTagName('li');
for(var i = 0, len = lis.length-1; i < len; i++) { var li = lis[i];
var inner = li.childNodes[1].firstChild.firstChild;
var tw = li.offsetWidth;
var iw = inner.offsetWidth;
inner.style.width = (each - (tw-iw)) + 'px';
}
},
adjustBodyWidth : function(w){
if(this.header){
this.header.setWidth(w);
}
if(this.footer){
this.footer.setWidth(w);
}
return w;
},
setActiveTab : function(item){
item = this.getComponent(item);
if(!item || this.fireEvent('beforetabchange', this, item, this.activeTab) === false){
return;
}
if(!this.rendered){
this.activeTab = item;
return;
}
if(this.activeTab != item){
if(this.activeTab){
var oldEl = this.getTabEl(this.activeTab);
if(oldEl){
Ext.fly(oldEl).removeClass('x-tab-strip-active');
}
this.activeTab.fireEvent('deactivate', this.activeTab);
}
var el = this.getTabEl(item);
Ext.fly(el).addClass('x-tab-strip-active');
this.activeTab = item;
this.stack.add(item);
this.layout.setActiveItem(item);
if(this.layoutOnTabChange && item.doLayout){
item.doLayout();
}
if(this.scrolling){
this.scrollToTab(item, this.animScroll);
}
item.fireEvent('activate', item);
this.fireEvent('tabchange', this, item);
}
},
getActiveTab : function(){
return this.activeTab || null;
},
getItem : function(item){
return this.getComponent(item);
},
autoScrollTabs : function(){
var count = this.items.length;
var ow = this.header.dom.offsetWidth;
var tw = this.header.dom.clientWidth;
var wrap = this.stripWrap;
var wd = wrap.dom;
var cw = wd.offsetWidth;
var pos = this.getScrollPos();
var l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos;
if(!this.enableTabScroll || count < 1 || cw < 20){ return;
}
if(l <= tw){
wd.scrollLeft = 0;
wrap.setWidth(tw);
if(this.scrolling){
this.scrolling = false;
this.header.removeClass('x-tab-scrolling');
this.scrollLeft.hide();
this.scrollRight.hide();
if(Ext.isAir){
wd.style.marginLeft = '';
wd.style.marginRight = '';
}
}
}else{
if(!this.scrolling){
this.header.addClass('x-tab-scrolling');
if(Ext.isAir){
wd.style.marginLeft = '18px';
wd.style.marginRight = '18px';
}
}
tw -= wrap.getMargins('lr');
wrap.setWidth(tw > 20 ? tw : 20);
if(!this.scrolling){
if(!this.scrollLeft){
this.createScrollers();
}else{
this.scrollLeft.show();
this.scrollRight.show();
}
}
this.scrolling = true;
if(pos > (l-tw)){ wd.scrollLeft = l-tw;
}else{ this.scrollToTab(this.activeTab, false);
}
this.updateScrollButtons();
}
},
createScrollers : function(){
var h = this.stripWrap.dom.offsetHeight;
var sl = this.header.insertFirst({
cls:'x-tab-scroller-left'
});
sl.setHeight(h);
sl.addClassOnOver('x-tab-scroller-left-over');
this.leftRepeater = new Ext.util.ClickRepeater(sl, {
interval : this.scrollRepeatInterval,
handler: this.onScrollLeft,
scope: this
});
this.scrollLeft = sl;
var sr = this.header.insertFirst({
cls:'x-tab-scroller-right'
});
sr.setHeight(h);
sr.addClassOnOver('x-tab-scroller-right-over');
this.rightRepeater = new Ext.util.ClickRepeater(sr, {
interval : this.scrollRepeatInterval,
handler: this.onScrollRight,
scope: this
});
this.scrollRight = sr;
},
getScrollWidth : function(){
return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos();
},
getScrollPos : function(){
return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0;
},
getScrollArea : function(){
return parseInt(this.stripWrap.dom.clientWidth, 10) || 0;
},
getScrollAnim : function(){
return {duration:this.scrollDuration, callback: this.updateScrollButtons, scope: this};
},
getScrollIncrement : function(){
return this.scrollIncrement || (this.resizeTabs ? this.lastTabWidth+2 : 100);
},
scrollToTab : function(item, animate){
if(!item){ return; }
var el = this.getTabEl(item);
var pos = this.getScrollPos(), area = this.getScrollArea();
var left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos;
var right = left + el.offsetWidth;
if(left < pos){
this.scrollTo(left, animate);
}else if(right > (pos + area)){
this.scrollTo(right - area, animate);
}
},
scrollTo : function(pos, animate){
this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false);
if(!animate){
this.updateScrollButtons();
}
},
onWheel : function(e){
var d = e.getWheelDelta()*this.wheelIncrement*-1;
e.stopEvent();
var pos = this.getScrollPos();
var newpos = pos + d;
var sw = this.getScrollWidth()-this.getScrollArea();
var s = Math.max(0, Math.min(sw, newpos));
if(s != pos){
this.scrollTo(s, false);
}
},
onScrollRight : function(){
var sw = this.getScrollWidth()-this.getScrollArea();
var pos = this.getScrollPos();
var s = Math.min(sw, pos + this.getScrollIncrement());
if(s != pos){
this.scrollTo(s, this.animScroll);
}
},
onScrollLeft : function(){
var pos = this.getScrollPos();
var s = Math.max(0, pos - this.getScrollIncrement());
if(s != pos){
this.scrollTo(s, this.animScroll);
}
},
updateScrollButtons : function(){
var pos = this.getScrollPos();
this.scrollLeft[pos == 0 ? 'addClass' : 'removeClass']('x-tab-scroller-left-disabled');
this.scrollRight[pos >= (this.getScrollWidth()-this.getScrollArea()) ? 'addClass' : 'removeClass']('x-tab-scroller-right-disabled');
}
});
Ext.reg('tabpanel', Ext.TabPanel);
Ext.TabPanel.prototype.activate = Ext.TabPanel.prototype.setActiveTab;
Ext.TabPanel.AccessStack = function(){
var items = [];
return {
add : function(item){
items.push(item);
if(items.length > 10){
items.shift();
}
},
remove : function(item){
var s = [];
for(var i = 0, len = items.length; i < len; i++) {
if(items[i] != item){
s.push(items[i]);
}
}
items = s;
},
next : function(){
return items.pop();
}
};
};
Ext.Button = Ext.extend(Ext.Component, {
hidden : false,
disabled : false,
pressed : false,
enableToggle: false,
menuAlign : "tl-bl?",
type : 'button',
menuClassTarget: 'tr',
clickEvent : 'click',
handleMouseEvents : true,
tooltipType : 'qtip',
buttonSelector : "button:first",
initComponent : function(){
Ext.Button.superclass.initComponent.call(this);
this.addEvents(
"click",
"toggle",
'mouseover',
'mouseout',
'menushow',
'menuhide',
'menutriggerover',
'menutriggerout'
);
if(this.menu){
this.menu = Ext.menu.MenuMgr.get(this.menu);
}
if(typeof this.toggleGroup === 'string'){
this.enableToggle = true;
}
},
onRender : function(ct, position){
if(!this.template){
if(!Ext.Button.buttonTemplate){
Ext.Button.buttonTemplate = new Ext.Template(
'<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>',
'<td class="x-btn-left"><i> </i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i> </i></td>',
"</tr></tbody></table>");
}
this.template = Ext.Button.buttonTemplate;
}
var btn, targs = [this.text || ' ', this.type];
if(position){
btn = this.template.insertBefore(position, targs, true);
}else{
btn = this.template.append(ct, targs, true);
}
var btnEl = btn.child(this.buttonSelector);
btnEl.on('focus', this.onFocus, this);
btnEl.on('blur', this.onBlur, this);
this.initButtonEl(btn, btnEl);
if(this.menu){
this.el.child(this.menuClassTarget).addClass("x-btn-with-menu");
}
Ext.ButtonToggleMgr.register(this);
},
initButtonEl : function(btn, btnEl){
this.el = btn;
btn.addClass("x-btn");
if(this.icon){
btnEl.setStyle('background-image', 'url(' +this.icon +')');
}
if(this.iconCls){
btnEl.addClass(this.iconCls);
if(!this.cls){
btn.addClass(this.text ? 'x-btn-text-icon' : 'x-btn-icon');
}
}
if(this.tabIndex !== undefined){
btnEl.dom.tabIndex = this.tabIndex;
}
if(this.tooltip){
if(typeof this.tooltip == 'object'){
Ext.QuickTips.register(Ext.apply({
target: btnEl.id
}, this.tooltip));
} else {
btnEl.dom[this.tooltipType] = this.tooltip;
}
}
if(this.pressed){
this.el.addClass("x-btn-pressed");
}
if(this.handleMouseEvents){
btn.on("mouseover", this.onMouseOver, this);
btn.on("mousedown", this.onMouseDown, this);
}
if(this.menu){
this.menu.on("show", this.onMenuShow, this);
this.menu.on("hide", this.onMenuHide, this);
}
if(this.id){
this.el.dom.id = this.el.id = this.id;
}
if(this.repeat){
var repeater = new Ext.util.ClickRepeater(btn,
typeof this.repeat == "object" ? this.repeat : {}
);
repeater.on("click", this.onClick, this);
}
btn.on(this.clickEvent, this.onClick, this);
},
afterRender : function(){
Ext.Button.superclass.afterRender.call(this);
if(Ext.isIE6){
this.autoWidth.defer(1, this);
}else{
this.autoWidth();
}
},
setIconClass : function(cls){
if(this.el){
this.el.child(this.buttonSelector).replaceClass(this.iconCls, cls);
}
this.iconCls = cls;
},
beforeDestroy: function(){
if(this.rendered){
var btn = this.el.child(this.buttonSelector);
if(btn){
btn.removeAllListeners();
}
}
if(this.menu){
Ext.destroy(this.menu);
}
},
onDestroy : function(){
if(this.rendered){
Ext.ButtonToggleMgr.unregister(this);
}
},
autoWidth : function(){
if(this.el){
this.el.setWidth("auto");
if(Ext.isIE7 && Ext.isStrict){
var ib = this.el.child(this.buttonSelector);
if(ib && ib.getWidth() > 20){
ib.clip();
ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));
}
}
if(this.minWidth){
if(this.el.getWidth() < this.minWidth){
this.el.setWidth(this.minWidth);
}
}
}
},
setHandler : function(handler, scope){
this.handler = handler;
this.scope = scope;
},
setText : function(text){
this.text = text;
if(this.el){
this.el.child("td.x-btn-center " + this.buttonSelector).update(text);
}
this.autoWidth();
},
getText : function(){
return this.text;
},
toggle : function(state){
state = state === undefined ? !this.pressed : state;
if(state != this.pressed){
if(state){
this.el.addClass("x-btn-pressed");
this.pressed = true;
this.fireEvent("toggle", this, true);
}else{
this.el.removeClass("x-btn-pressed");
this.pressed = false;
this.fireEvent("toggle", this, false);
}
if(this.toggleHandler){
this.toggleHandler.call(this.scope || this, this, state);
}
}
},
focus : function(){
this.el.child(this.buttonSelector).focus();
},
onDisable : function(){
if(this.el){
if(!Ext.isIE6 || !this.text){
this.el.addClass(this.disabledClass);
}
this.el.dom.disabled = true;
}
this.disabled = true;
},
onEnable : function(){
if(this.el){
if(!Ext.isIE6 || !this.text){
this.el.removeClass(this.disabledClass);
}
this.el.dom.disabled = false;
}
this.disabled = false;
},
showMenu : function(){
if(this.menu){
this.menu.show(this.el, this.menuAlign);
}
return this;
},
hideMenu : function(){
if(this.menu){
this.menu.hide();
}
return this;
},
hasVisibleMenu : function(){
return this.menu && this.menu.isVisible();
},
onClick : function(e){
if(e){
e.preventDefault();
}
if(e.button != 0){
return;
}
if(!this.disabled){
if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){
this.toggle();
}
if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){
this.showMenu();
}
this.fireEvent("click", this, e);
if(this.handler){
this.handler.call(this.scope || this, this, e);
}
}
},
isMenuTriggerOver : function(e, internal){
return this.menu && !internal;
},
isMenuTriggerOut : function(e, internal){
return this.menu && !internal;
},
onMouseOver : function(e){
if(!this.disabled){
var internal = e.within(this.el, true);
if(!internal){
this.el.addClass("x-btn-over");
Ext.getDoc().on('mouseover', this.monitorMouseOver, this);
this.fireEvent('mouseover', this, e);
}
if(this.isMenuTriggerOver(e, internal)){
this.fireEvent('menutriggerover', this, this.menu, e);
}
}
},
monitorMouseOver : function(e){
if(e.target != this.el.dom && !e.within(this.el)){
Ext.getDoc().un('mouseover', this.monitorMouseOver, this);
this.onMouseOut(e);
}
},
onMouseOut : function(e){
var internal = e.within(this.el) && e.target != this.el.dom;
this.el.removeClass("x-btn-over");
this.fireEvent('mouseout', this, e);
if(this.isMenuTriggerOut(e, internal)){
this.fireEvent('menutriggerout', this, this.menu, e);
}
},
onFocus : function(e){
if(!this.disabled){
this.el.addClass("x-btn-focus");
}
},
onBlur : function(e){
this.el.removeClass("x-btn-focus");
},
getClickEl : function(e, isUp){
return this.el;
},
onMouseDown : function(e){
if(!this.disabled && e.button == 0){
this.getClickEl(e).addClass("x-btn-click");
Ext.getDoc().on('mouseup', this.onMouseUp, this);
}
},
onMouseUp : function(e){
if(e.button == 0){
this.getClickEl(e, true).removeClass("x-btn-click");
Ext.getDoc().un('mouseup', this.onMouseUp, this);
}
},
onMenuShow : function(e){
this.ignoreNextClick = 0;
this.el.addClass("x-btn-menu-active");
this.fireEvent('menushow', this, this.menu);
},
onMenuHide : function(e){
this.el.removeClass("x-btn-menu-active");
this.ignoreNextClick = this.restoreClick.defer(250, this);
this.fireEvent('menuhide', this, this.menu);
},
restoreClick : function(){
this.ignoreNextClick = 0;
}
});
Ext.reg('button', Ext.Button);
Ext.ButtonToggleMgr = function(){
var groups = {};
function toggleGroup(btn, state){
if(state){
var g = groups[btn.toggleGroup];
for(var i = 0, l = g.length; i < l; i++){
if(g[i] != btn){
g[i].toggle(false);
}
}
}
}
return {
register : function(btn){
if(!btn.toggleGroup){
return;
}
var g = groups[btn.toggleGroup];
if(!g){
g = groups[btn.toggleGroup] = [];
}
g.push(btn);
btn.on("toggle", toggleGroup);
},
unregister : function(btn){
if(!btn.toggleGroup){
return;
}
var g = groups[btn.toggleGroup];
if(g){
g.remove(btn);
btn.un("toggle", toggleGroup);
}
}
};
}();
Ext.SplitButton = Ext.extend(Ext.Button, {
arrowSelector : 'button:last',
initComponent : function(){
Ext.SplitButton.superclass.initComponent.call(this);
this.addEvents("arrowclick");
},
onRender : function(ct, position){
var tpl = new Ext.Template(
'<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>',
'<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>',
'<tr><td class="x-btn-left"><i> </i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',
"</tbody></table></td><td>",
'<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>',
'<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button"> </button></td><td class="x-btn-right"><i> </i></td></tr>',
"</tbody></table></td></tr></table>"
);
var btn, targs = [this.text || ' ', this.type];
if(position){
btn = tpl.insertBefore(position, targs, true);
}else{
btn = tpl.append(ct, targs, true);
}
var btnEl = btn.child(this.buttonSelector);
this.initButtonEl(btn, btnEl);
this.arrowBtnTable = btn.child("table:last");
if(this.arrowTooltip){
btn.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip;
}
},
autoWidth : function(){
if(this.el){
var tbl = this.el.child("table:first");
var tbl2 = this.el.child("table:last");
this.el.setWidth("auto");
tbl.setWidth("auto");
if(Ext.isIE7 && Ext.isStrict){
var ib = this.el.child(this.buttonSelector);
if(ib && ib.getWidth() > 20){
ib.clip();
ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));
}
}
if(this.minWidth){
if((tbl.getWidth()+tbl2.getWidth()) < this.minWidth){
tbl.setWidth(this.minWidth-tbl2.getWidth());
}
}
this.el.setWidth(tbl.getWidth()+tbl2.getWidth());
}
},
setArrowHandler : function(handler, scope){
this.arrowHandler = handler;
this.scope = scope;
},
onClick : function(e){
e.preventDefault();
if(!this.disabled){
if(e.getTarget(".x-btn-menu-arrow-wrap")){
if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){
this.showMenu();
}
this.fireEvent("arrowclick", this, e);
if(this.arrowHandler){
this.arrowHandler.call(this.scope || this, this, e);
}
}else{
if(this.enableToggle){
this.toggle();
}
this.fireEvent("click", this, e);
if(this.handler){
this.handler.call(this.scope || this, this, e);
}
}
}
},
getClickEl : function(e, isUp){
if(!isUp){
return (this.lastClickEl = e.getTarget("table", 10, true));
}
return this.lastClickEl;
},
onDisable : function(){
if(this.el){
if(!Ext.isIE6){
this.el.addClass("x-item-disabled");
}
this.el.child(this.buttonSelector).dom.disabled = true;
this.el.child(this.arrowSelector).dom.disabled = true;
}
this.disabled = true;
},
onEnable : function(){
if(this.el){
if(!Ext.isIE6){
this.el.removeClass("x-item-disabled");
}
this.el.child(this.buttonSelector).dom.disabled = false;
this.el.child(this.arrowSelector).dom.disabled = false;
}
this.disabled = false;
},
isMenuTriggerOver : function(e){
return this.menu && e.within(this.arrowBtnTable) && !e.within(this.arrowBtnTable, true);
},
isMenuTriggerOut : function(e, internal){
return this.menu && !e.within(this.arrowBtnTable);
},
onDestroy : function(){
Ext.destroy(this.arrowBtnTable);
Ext.SplitButton.superclass.onDestroy.call(this);
}
});
Ext.MenuButton = Ext.SplitButton;
Ext.reg('splitbutton', Ext.SplitButton);
Ext.CycleButton = Ext.extend(Ext.SplitButton, {
getItemText : function(item){
if(item && this.showText === true){
var text = '';
if(this.prependText){
text += this.prependText;
}
text += item.text;
return text;
}
return undefined;
},
setActiveItem : function(item, suppressEvent){
if(typeof item != 'object'){
item = this.menu.items.get(item);
}
if(item){
if(!this.rendered){
this.text = this.getItemText(item);
this.iconCls = item.iconCls;
}else{
var t = this.getItemText(item);
if(t){
this.setText(t);
}
this.setIconClass(item.iconCls);
}
this.activeItem = item;
if(!item.checked){
item.setChecked(true, true);
}
if(this.forceIcon){
this.setIconClass(this.forceIcon);
}
if(!suppressEvent){
this.fireEvent('change', this, item);
}
}
},
getActiveItem : function(){
return this.activeItem;
},
initComponent : function(){
this.addEvents(
"change"
);
if(this.changeHandler){
this.on('change', this.changeHandler, this.scope||this);
delete this.changeHandler;
}
this.itemCount = this.items.length;
this.menu = {cls:'x-cycle-menu', items:[]};
var checked;
for(var i = 0, len = this.itemCount; i < len; i++){
var item = this.items[i];
item.group = item.group || this.id;
item.itemIndex = i;
item.checkHandler = this.checkHandler;
item.scope = this;
item.checked = item.checked || false;
this.menu.items.push(item);
if(item.checked){
checked = item;
}
}
this.setActiveItem(checked, true);
Ext.CycleButton.superclass.initComponent.call(this);
this.on('click', this.toggleSelected, this);
},
checkHandler : function(item, pressed){
if(pressed){
this.setActiveItem(item);
}
},
toggleSelected : function(){
this.menu.render();
var nextIdx, checkItem;
for (var i = 1; i < this.itemCount; i++) {
nextIdx = (this.activeItem.itemIndex + i) % this.itemCount;
checkItem = this.menu.items.itemAt(nextIdx);
if (!checkItem.disabled) {
checkItem.setChecked(true);
break;
}
}
}
});
Ext.reg('cycle', Ext.CycleButton);
Ext.Toolbar = function(config){
if(Ext.isArray(config)){
config = {buttons:config};
}
Ext.Toolbar.superclass.constructor.call(this, config);
};
(function(){
var T = Ext.Toolbar;
Ext.extend(T, Ext.BoxComponent, {
trackMenus : true,
initComponent : function(){
T.superclass.initComponent.call(this);
if(this.items){
this.buttons = this.items;
}
this.items = new Ext.util.MixedCollection(false, function(o){
return o.itemId || o.id || Ext.id();
});
},
autoCreate: {
cls:'x-toolbar x-small-editor',
html:'<table cellspacing="0"><tr></tr></table>'
},
onRender : function(ct, position){
this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);
this.tr = this.el.child("tr", true);
},
afterRender : function(){
T.superclass.afterRender.call(this);
if(this.buttons){
this.add.apply(this, this.buttons);
delete this.buttons;
}
},
add : function(){
var a = arguments, l = a.length;
for(var i = 0; i < l; i++){
var el = a[i];
if(el.isFormField){
this.addField(el);
}else if(el.render){
this.addItem(el);
}else if(typeof el == "string"){
if(el == "separator" || el == "-"){
this.addSeparator();
}else if(el == " "){
this.addSpacer();
}else if(el == "->"){
this.addFill();
}else{
this.addText(el);
}
}else if(el.tagName){
this.addElement(el);
}else if(typeof el == "object"){
if(el.xtype){
this.addField(Ext.ComponentMgr.create(el, 'button'));
}else{
this.addButton(el);
}
}
}
},
addSeparator : function(){
return this.addItem(new T.Separator());
},
addSpacer : function(){
return this.addItem(new T.Spacer());
},
addFill : function(){
return this.addItem(new T.Fill());
},
addElement : function(el){
return this.addItem(new T.Item(el));
},
addItem : function(item){
var td = this.nextBlock();
this.initMenuTracking(item);
item.render(td);
this.items.add(item);
return item;
},
addButton : function(config){
if(Ext.isArray(config)){
var buttons = [];
for(var i = 0, len = config.length; i < len; i++) {
buttons.push(this.addButton(config[i]));
}
return buttons;
}
var b = config;
if(!(config instanceof T.Button)){
b = config.split ?
new T.SplitButton(config) :
new T.Button(config);
}
var td = this.nextBlock();
this.initMenuTracking(b);
b.render(td);
this.items.add(b);
return b;
},
initMenuTracking : function(item){
if(this.trackMenus && item.menu){
item.on({
'menutriggerover' : this.onButtonTriggerOver,
'menushow' : this.onButtonMenuShow,
'menuhide' : this.onButtonMenuHide,
scope: this
})
}
},
addText : function(text){
return this.addItem(new T.TextItem(text));
},
insertButton : function(index, item){
if(Ext.isArray(item)){
var buttons = [];
for(var i = 0, len = item.length; i < len; i++) {
buttons.push(this.insertButton(index + i, item[i]));
}
return buttons;
}
if (!(item instanceof T.Button)){
item = new T.Button(item);
}
var td = document.createElement("td");
this.tr.insertBefore(td, this.tr.childNodes[index]);
this.initMenuTracking(item);
item.render(td);
this.items.insert(index, item);
return item;
},
addDom : function(config, returnEl){
var td = this.nextBlock();
Ext.DomHelper.overwrite(td, config);
var ti = new T.Item(td.firstChild);
ti.render(td);
this.items.add(ti);
return ti;
},
addField : function(field){
var td = this.nextBlock();
field.render(td);
var ti = new T.Item(td.firstChild);
ti.render(td);
this.items.add(ti);
return ti;
},
nextBlock : function(){
var td = document.createElement("td");
this.tr.appendChild(td);
return td;
},
onDestroy : function(){
Ext.Toolbar.superclass.onDestroy.call(this);
if(this.rendered){
if(this.items){
Ext.destroy.apply(Ext, this.items.items);
}
Ext.Element.uncache(this.tr);
}
},
onDisable : function(){
this.items.each(function(item){
if(item.disable){
item.disable();
}
});
},
onEnable : function(){
this.items.each(function(item){
if(item.enable){
item.enable();
}
});
},
onButtonTriggerOver : function(btn){
if(this.activeMenuBtn && this.activeMenuBtn != btn){
this.activeMenuBtn.hideMenu();
btn.showMenu();
this.activeMenuBtn = btn;
}
},
onButtonMenuShow : function(btn){
this.activeMenuBtn = btn;
},
onButtonMenuHide : function(btn){
delete this.activeMenuBtn;
}
});
Ext.reg('toolbar', Ext.Toolbar);
T.Item = function(el){
this.el = Ext.getDom(el);
this.id = Ext.id(this.el);
this.hidden = false;
};
T.Item.prototype = {
getEl : function(){
return this.el;
},
render : function(td){
this.td = td;
td.appendChild(this.el);
},
destroy : function(){
if(this.td && this.td.parentNode){
this.td.parentNode.removeChild(this.td);
}
},
show: function(){
this.hidden = false;
this.td.style.display = "";
},
hide: function(){
this.hidden = true;
this.td.style.display = "none";
},
setVisible: function(visible){
if(visible) {
this.show();
}else{
this.hide();
}
},
focus : function(){
Ext.fly(this.el).focus();
},
disable : function(){
Ext.fly(this.td).addClass("x-item-disabled");
this.disabled = true;
this.el.disabled = true;
},
enable : function(){
Ext.fly(this.td).removeClass("x-item-disabled");
this.disabled = false;
this.el.disabled = false;
}
};
Ext.reg('tbitem', T.Item);
T.Separator = function(){
var s = document.createElement("span");
s.className = "ytb-sep";
T.Separator.superclass.constructor.call(this, s);
};
Ext.extend(T.Separator, T.Item, {
enable:Ext.emptyFn,
disable:Ext.emptyFn,
focus:Ext.emptyFn
});
Ext.reg('tbseparator', T.Separator);
T.Spacer = function(){
var s = document.createElement("div");
s.className = "ytb-spacer";
T.Spacer.superclass.constructor.call(this, s);
};
Ext.extend(T.Spacer, T.Item, {
enable:Ext.emptyFn,
disable:Ext.emptyFn,
focus:Ext.emptyFn
});
Ext.reg('tbspacer', T.Spacer);
T.Fill = Ext.extend(T.Spacer, {
render : function(td){
td.style.width = '100%';
T.Fill.superclass.render.call(this, td);
}
});
Ext.reg('tbfill', T.Fill);
T.TextItem = function(t){
var s = document.createElement("span");
s.className = "ytb-text";
s.innerHTML = t.text ? t.text : t;
T.TextItem.superclass.constructor.call(this, s);
};
Ext.extend(T.TextItem, T.Item, {
enable:Ext.emptyFn,
disable:Ext.emptyFn,
focus:Ext.emptyFn
});
Ext.reg('tbtext', T.TextItem);
T.Button = Ext.extend(Ext.Button, {
hideParent : true,
onDestroy : function(){
T.Button.superclass.onDestroy.call(this);
if(this.container){
this.container.remove();
}
}
});
Ext.reg('tbbutton', T.Button);
T.SplitButton = Ext.extend(Ext.SplitButton, {
hideParent : true,
onDestroy : function(){
T.SplitButton.superclass.onDestroy.call(this);
if(this.container){
this.container.remove();
}
}
});
Ext.reg('tbsplit', T.SplitButton);
T.MenuButton = T.SplitButton;
})();
Ext.PagingToolbar = Ext.extend(Ext.Toolbar, {
pageSize: 20,
displayMsg : 'Displaying {0} - {1} of {2}',
emptyMsg : 'No data to display',
beforePageText : "Page",
afterPageText : "of {0}",
firstText : "First Page",
prevText : "Previous Page",
nextText : "Next Page",
lastText : "Last Page",
refreshText : "Refresh",
paramNames : {start: 'start', limit: 'limit'},
initComponent : function(){
Ext.PagingToolbar.superclass.initComponent.call(this);
this.cursor = 0;
this.bind(this.store);
},
onRender : function(ct, position){
Ext.PagingToolbar.superclass.onRender.call(this, ct, position);
this.first = this.addButton({
tooltip: this.firstText,
iconCls: "x-tbar-page-first",
disabled: true,
handler: this.onClick.createDelegate(this, ["first"])
});
this.prev = this.addButton({
tooltip: this.prevText,
iconCls: "x-tbar-page-prev",
disabled: true,
handler: this.onClick.createDelegate(this, ["prev"])
});
this.addSeparator();
this.add(this.beforePageText);
this.field = Ext.get(this.addDom({
tag: "input",
type: "text",
size: "3",
value: "1",
cls: "x-tbar-page-number"
}).el);
this.field.on("keydown", this.onPagingKeydown, this);
this.field.on("focus", function(){this.dom.select();});
this.afterTextEl = this.addText(String.format(this.afterPageText, 1));
this.field.setHeight(18);
this.addSeparator();
this.next = this.addButton({
tooltip: this.nextText,
iconCls: "x-tbar-page-next",
disabled: true,
handler: this.onClick.createDelegate(this, ["next"])
});
this.last = this.addButton({
tooltip: this.lastText,
iconCls: "x-tbar-page-last",
disabled: true,
handler: this.onClick.createDelegate(this, ["last"])
});
this.addSeparator();
this.loading = this.addButton({
tooltip: this.refreshText,
iconCls: "x-tbar-loading",
handler: this.onClick.createDelegate(this, ["refresh"])
});
if(this.displayInfo){
this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});
}
if(this.dsLoaded){
this.onLoad.apply(this, this.dsLoaded);
}
},
updateInfo : function(){
if(this.displayEl){
var count = this.store.getCount();
var msg = count == 0 ?
this.emptyMsg :
String.format(
this.displayMsg,
this.cursor+1, this.cursor+count, this.store.getTotalCount()
);
this.displayEl.update(msg);
}
},
onLoad : function(store, r, o){
if(!this.rendered){
this.dsLoaded = [store, r, o];
return;
}
this.cursor = o.params ? o.params[this.paramNames.start] : 0;
var d = this.getPageData(), ap = d.activePage, ps = d.pages;
this.afterTextEl.el.innerHTML = String.format(this.afterPageText, d.pages);
this.field.dom.value = ap;
this.first.setDisabled(ap == 1);
this.prev.setDisabled(ap == 1);
this.next.setDisabled(ap == ps);
this.last.setDisabled(ap == ps);
this.loading.enable();
this.updateInfo();
},
getPageData : function(){
var total = this.store.getTotalCount();
return {
total : total,
activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize),
pages : total < this.pageSize ? 1 : Math.ceil(total/this.pageSize)
};
},
onLoadError : function(){
if(!this.rendered){
return;
}
this.loading.enable();
},
readPage : function(d){
var v = this.field.dom.value, pageNum;
if (!v || isNaN(pageNum = parseInt(v, 10))) {
this.field.dom.value = d.activePage;
return false;
}
return pageNum;
},
onPagingKeydown : function(e){
var k = e.getKey(), d = this.getPageData(), pageNum;
if (k == e.RETURN) {
e.stopEvent();
if(pageNum = this.readPage(d)){
pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;
this.doLoad(pageNum * this.pageSize);
}
}else if (k == e.HOME || k == e.END){
e.stopEvent();
pageNum = k == e.HOME ? 1 : d.pages;
this.field.dom.value = pageNum;
}else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){
e.stopEvent();
if(pageNum = this.readPage(d)){
var increment = e.shiftKey ? 10 : 1;
if(k == e.DOWN || k == e.PAGEDOWN){
increment *= -1;
}
pageNum += increment;
if(pageNum >= 1 & pageNum <= d.pages){
this.field.dom.value = pageNum;
}
}
}
},
beforeLoad : function(){
if(this.rendered && this.loading){
this.loading.disable();
}
},
doLoad : function(start){
var o = {}, pn = this.paramNames;
o[pn.start] = start;
o[pn.limit] = this.pageSize;
this.store.load({params:o});
},
onClick : function(which){
var store = this.store;
switch(which){
case "first":
this.doLoad(0);
break;
case "prev":
this.doLoad(Math.max(0, this.cursor-this.pageSize));
break;
case "next":
this.doLoad(this.cursor+this.pageSize);
break;
case "last":
var total = store.getTotalCount();
var extra = total % this.pageSize;
var lastStart = extra ? (total - extra) : total-this.pageSize;
this.doLoad(lastStart);
break;
case "refresh":
this.doLoad(this.cursor);
break;
}
},
unbind : function(store){
store = Ext.StoreMgr.lookup(store);
store.un("beforeload", this.beforeLoad, this);
store.un("load", this.onLoad, this);
store.un("loadexception", this.onLoadError, this);
this.store = undefined;
},
bind : function(store){
store = Ext.StoreMgr.lookup(store);
store.on("beforeload", this.beforeLoad, this);
store.on("load", this.onLoad, this);
store.on("loadexception", this.onLoadError, this);
this.store = store;
}
});
Ext.reg('paging', Ext.PagingToolbar);
Ext.Resizable = function(el, config){
this.el = Ext.get(el);
if(config && config.wrap){
config.resizeChild = this.el;
this.el = this.el.wrap(typeof config.wrap == "object" ? config.wrap : {cls:"xresizable-wrap"});
this.el.id = this.el.dom.id = config.resizeChild.id + "-rzwrap";
this.el.setStyle("overflow", "hidden");
this.el.setPositioning(config.resizeChild.getPositioning());
config.resizeChild.clearPositioning();
if(!config.width || !config.height){
var csize = config.resizeChild.getSize();
this.el.setSize(csize.width, csize.height);
}
if(config.pinned && !config.adjustments){
config.adjustments = "auto";
}
}
this.proxy = this.el.createProxy({tag: "div", cls: "x-resizable-proxy", id: this.el.id + "-rzproxy"});
this.proxy.unselectable();
this.proxy.enableDisplayMode('block');
Ext.apply(this, config);
if(this.pinned){
this.disableTrackOver = true;
this.el.addClass("x-resizable-pinned");
}
var position = this.el.getStyle("position");
if(position != "absolute" && position != "fixed"){
this.el.setStyle("position", "relative");
}
if(!this.handles){
this.handles = 's,e,se';
if(this.multiDirectional){
this.handles += ',n,w';
}
}
if(this.handles == "all"){
this.handles = "n s e w ne nw se sw";
}
var hs = this.handles.split(/\s*?[,;]\s*?| /);
var ps = Ext.Resizable.positions;
for(var i = 0, len = hs.length; i < len; i++){
if(hs[i] && ps[hs[i]]){
var pos = ps[hs[i]];
this[pos] = new Ext.Resizable.Handle(this, pos, this.disableTrackOver, this.transparent);
}
}
this.corner = this.southeast;
if(this.handles.indexOf("n") != -1 || this.handles.indexOf("w") != -1){
this.updateBox = true;
}
this.activeHandle = null;
if(this.resizeChild){
if(typeof this.resizeChild == "boolean"){
this.resizeChild = Ext.get(this.el.dom.firstChild, true);
}else{
this.resizeChild = Ext.get(this.resizeChild, true);
}
}
if(this.adjustments == "auto"){
var rc = this.resizeChild;
var hw = this.west, he = this.east, hn = this.north, hs = this.south;
if(rc && (hw || hn)){
rc.position("relative");
rc.setLeft(hw ? hw.el.getWidth() : 0);
rc.setTop(hn ? hn.el.getHeight() : 0);
}
this.adjustments = [
(he ? -he.el.getWidth() : 0) + (hw ? -hw.el.getWidth() : 0),
(hn ? -hn.el.getHeight() : 0) + (hs ? -hs.el.getHeight() : 0) -1
];
}
if(this.draggable){
this.dd = this.dynamic ?
this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});
this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);
}
this.addEvents(
"beforeresize",
"resize"
);
if(this.width !== null && this.height !== null){
this.resizeTo(this.width, this.height);
}else{
this.updateChildSize();
}
if(Ext.isIE){
this.el.dom.style.zoom = 1;
}
Ext.Resizable.superclass.constructor.call(this);
};
Ext.extend(Ext.Resizable, Ext.util.Observable, {
resizeChild : false,
adjustments : [0, 0],
minWidth : 5,
minHeight : 5,
maxWidth : 10000,
maxHeight : 10000,
enabled : true,
animate : false,
duration : .35,
dynamic : false,
handles : false,
multiDirectional : false,
disableTrackOver : false,
easing : 'easeOutStrong',
widthIncrement : 0,
heightIncrement : 0,
pinned : false,
width : null,
height : null,
preserveRatio : false,
transparent: false,
minX: 0,
minY: 0,
draggable: false,
resizeTo : function(width, height){
this.el.setSize(width, height);
this.updateChildSize();
this.fireEvent("resize", this, width, height, null);
},
startSizing : function(e, handle){
this.fireEvent("beforeresize", this, e);
if(this.enabled){
if(!this.overlay){
this.overlay = this.el.createProxy({tag: "div", cls: "x-resizable-overlay", html: " "}, Ext.getBody());
this.overlay.unselectable();
this.overlay.enableDisplayMode("block");
this.overlay.on("mousemove", this.onMouseMove, this);
this.overlay.on("mouseup", this.onMouseUp, this);
}
this.overlay.setStyle("cursor", handle.el.getStyle("cursor"));
this.resizing = true;
this.startBox = this.el.getBox();
this.startPoint = e.getXY();
this.offsets = [(this.startBox.x + this.startBox.width) - this.startPoint[0],
(this.startBox.y + this.startBox.height) - this.startPoint[1]];
this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
this.overlay.show();
if(this.constrainTo) {
var ct = Ext.get(this.constrainTo);
this.resizeRegion = ct.getRegion().adjust(
ct.getFrameWidth('t'),
ct.getFrameWidth('l'),
-ct.getFrameWidth('b'),
-ct.getFrameWidth('r')
);
}
this.proxy.setStyle('visibility', 'hidden');
this.proxy.show();
this.proxy.setBox(this.startBox);
if(!this.dynamic){
this.proxy.setStyle('visibility', 'visible');
}
}
},
onMouseDown : function(handle, e){
if(this.enabled){
e.stopEvent();
this.activeHandle = handle;
this.startSizing(e, handle);
}
},
onMouseUp : function(e){
var size = this.resizeElement();
this.resizing = false;
this.handleOut();
this.overlay.hide();
this.proxy.hide();
this.fireEvent("resize", this, size.width, size.height, e);
},
updateChildSize : function(){
if(this.resizeChild){
var el = this.el;
var child = this.resizeChild;
var adj = this.adjustments;
if(el.dom.offsetWidth){
var b = el.getSize(true);
child.setSize(b.width+adj[0], b.height+adj[1]);
}
if(Ext.isIE){
setTimeout(function(){
if(el.dom.offsetWidth){
var b = el.getSize(true);
child.setSize(b.width+adj[0], b.height+adj[1]);
}
}, 10);
}
}
},
snap : function(value, inc, min){
if(!inc || !value) return value;
var newValue = value;
var m = value % inc;
if(m > 0){
if(m > (inc/2)){
newValue = value + (inc-m);
}else{
newValue = value - m;
}
}
return Math.max(min, newValue);
},
resizeElement : function(){
var box = this.proxy.getBox();
if(this.updateBox){
this.el.setBox(box, false, this.animate, this.duration, null, this.easing);
}else{
this.el.setSize(box.width, box.height, this.animate, this.duration, null, this.easing);
}
this.updateChildSize();
if(!this.dynamic){
this.proxy.hide();
}
return box;
},
constrain : function(v, diff, m, mx){
if(v - diff < m){
diff = v - m;
}else if(v - diff > mx){
diff = mx - v;
}
return diff;
},
onMouseMove : function(e){
if(this.enabled){
try{
if(this.resizeRegion && !this.resizeRegion.contains(e.getPoint())) {
return;
}
var curSize = this.curSize || this.startBox;
var x = this.startBox.x, y = this.startBox.y;
var ox = x, oy = y;
var w = curSize.width, h = curSize.height;
var ow = w, oh = h;
var mw = this.minWidth, mh = this.minHeight;
var mxw = this.maxWidth, mxh = this.maxHeight;
var wi = this.widthIncrement;
var hi = this.heightIncrement;
var eventXY = e.getXY();
var diffX = -(this.startPoint[0] - Math.max(this.minX, eventXY[0]));
var diffY = -(this.startPoint[1] - Math.max(this.minY, eventXY[1]));
var pos = this.activeHandle.position;
switch(pos){
case "east":
w += diffX;
w = Math.min(Math.max(mw, w), mxw);
break;
case "south":
h += diffY;
h = Math.min(Math.max(mh, h), mxh);
break;
case "southeast":
w += diffX;
h += diffY;
w = Math.min(Math.max(mw, w), mxw);
h = Math.min(Math.max(mh, h), mxh);
break;
case "north":
diffY = this.constrain(h, diffY, mh, mxh);
y += diffY;
h -= diffY;
break;
case "west":
diffX = this.constrain(w, diffX, mw, mxw);
x += diffX;
w -= diffX;
break;
case "northeast":
w += diffX;
w = Math.min(Math.max(mw, w), mxw);
diffY = this.constrain(h, diffY, mh, mxh);
y += diffY;
h -= diffY;
break;
case "northwest":
diffX = this.constrain(w, diffX, mw, mxw);
diffY = this.constrain(h, diffY, mh, mxh);
y += diffY;
h -= diffY;
x += diffX;
w -= diffX;
break;
case "southwest":
diffX = this.constrain(w, diffX, mw, mxw);
h += diffY;
h = Math.min(Math.max(mh, h), mxh);
x += diffX;
w -= diffX;
break;
}
var sw = this.snap(w, wi, mw);
var sh = this.snap(h, hi, mh);
if(sw != w || sh != h){
switch(pos){
case "northeast":
y -= sh - h;
break;
case "north":
y -= sh - h;
break;
case "southwest":
x -= sw - w;
break;
case "west":
x -= sw - w;
break;
case "northwest":
x -= sw - w;
y -= sh - h;
break;
}
w = sw;
h = sh;
}
if(this.preserveRatio){
switch(pos){
case "southeast":
case "east":
h = oh * (w/ow);
h = Math.min(Math.max(mh, h), mxh);
w = ow * (h/oh);
break;
case "south":
w = ow * (h/oh);
w = Math.min(Math.max(mw, w), mxw);
h = oh * (w/ow);
break;
case "northeast":
w = ow * (h/oh);
w = Math.min(Math.max(mw, w), mxw);
h = oh * (w/ow);
break;
case "north":
var tw = w;
w = ow * (h/oh);
w = Math.min(Math.max(mw, w), mxw);
h = oh * (w/ow);
x += (tw - w) / 2;
break;
case "southwest":
h = oh * (w/ow);
h = Math.min(Math.max(mh, h), mxh);
var tw = w;
w = ow * (h/oh);
x += tw - w;
break;
case "west":
var th = h;
h = oh * (w/ow);
h = Math.min(Math.max(mh, h), mxh);
y += (th - h) / 2;
var tw = w;
w = ow * (h/oh);
x += tw - w;
break;
case "northwest":
var tw = w;
var th = h;
h = oh * (w/ow);
h = Math.min(Math.max(mh, h), mxh);
w = ow * (h/oh);
y += th - h;
x += tw - w;
break;
}
}
this.proxy.setBounds(x, y, w, h);
if(this.dynamic){
this.resizeElement();
}
}catch(e){}
}
},
handleOver : function(){
if(this.enabled){
this.el.addClass("x-resizable-over");
}
},
handleOut : function(){
if(!this.resizing){
this.el.removeClass("x-resizable-over");
}
},
getEl : function(){
return this.el;
},
getResizeChild : function(){
return this.resizeChild;
},
destroy : function(removeEl){
this.proxy.remove();
if(this.overlay){
this.overlay.removeAllListeners();
this.overlay.remove();
}
var ps = Ext.Resizable.positions;
for(var k in ps){
if(typeof ps[k] != "function" && this[ps[k]]){
var h = this[ps[k]];
h.el.removeAllListeners();
h.el.remove();
}
}
if(removeEl){
this.el.update("");
this.el.remove();
}
},
syncHandleHeight : function(){
var h = this.el.getHeight(true);
if(this.west){
this.west.el.setHeight(h);
}
if(this.east){
this.east.el.setHeight(h);
}
}
});
Ext.Resizable.positions = {
n: "north", s: "south", e: "east", w: "west", se: "southeast", sw: "southwest", nw: "northwest", ne: "northeast"
};
Ext.Resizable.Handle = function(rz, pos, disableTrackOver, transparent){
if(!this.tpl){
var tpl = Ext.DomHelper.createTemplate(
{tag: "div", cls: "x-resizable-handle x-resizable-handle-{0}"}
);
tpl.compile();
Ext.Resizable.Handle.prototype.tpl = tpl;
}
this.position = pos;
this.rz = rz;
this.el = this.tpl.append(rz.el.dom, [this.position], true);
this.el.unselectable();
if(transparent){
this.el.setOpacity(0);
}
this.el.on("mousedown", this.onMouseDown, this);
if(!disableTrackOver){
this.el.on("mouseover", this.onMouseOver, this);
this.el.on("mouseout", this.onMouseOut, this);
}
};
Ext.Resizable.Handle.prototype = {
afterResize : function(rz){
},
onMouseDown : function(e){
this.rz.onMouseDown(this, e);
},
onMouseOver : function(e){
this.rz.handleOver(this, e);
},
onMouseOut : function(e){
this.rz.handleOut(this, e);
}
};
Ext.Editor = function(field, config){
this.field = field;
Ext.Editor.superclass.constructor.call(this, config);
};
Ext.extend(Ext.Editor, Ext.Component, {
value : "",
alignment: "c-c?",
shadow : "frame",
constrain : false,
swallowKeys : true,
completeOnEnter : false,
cancelOnEsc : false,
updateEl : false,
initComponent : function(){
Ext.Editor.superclass.initComponent.call(this);
this.addEvents(
"beforestartedit",
"startedit",
"beforecomplete",
"complete",
"specialkey"
);
},
onRender : function(ct, position){
this.el = new Ext.Layer({
shadow: this.shadow,
cls: "x-editor",
parentEl : ct,
shim : this.shim,
shadowOffset:4,
id: this.id,
constrain: this.constrain
});
this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden");
if(this.field.msgTarget != 'title'){
this.field.msgTarget = 'qtip';
}
this.field.inEditor = true;
this.field.render(this.el);
if(Ext.isGecko){
this.field.el.dom.setAttribute('autocomplete', 'off');
}
this.field.on("specialkey", this.onSpecialKey, this);
if(this.swallowKeys){
this.field.el.swallowEvent(['keydown','keypress']);
}
this.field.show();
this.field.on("blur", this.onBlur, this);
if(this.field.grow){
this.field.on("autosize", this.el.sync, this.el, {delay:1});
}
},
onSpecialKey : function(field, e){
if(this.completeOnEnter && e.getKey() == e.ENTER){
e.stopEvent();
this.completeEdit();
}else if(this.cancelOnEsc && e.getKey() == e.ESC){
this.cancelEdit();
}else{
this.fireEvent('specialkey', field, e);
}
},
startEdit : function(el, value){
if(this.editing){
this.completeEdit();
}
this.boundEl = Ext.get(el);
var v = value !== undefined ? value : this.boundEl.dom.innerHTML;
if(!this.rendered){
this.render(this.parentEl || document.body);
}
if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){
return;
}
this.startValue = v;
this.field.setValue(v);
this.doAutoSize();
this.el.alignTo(this.boundEl, this.alignment);
this.editing = true;
this.show();
},
doAutoSize : function(){
if(this.autoSize){
var sz = this.boundEl.getSize();
switch(this.autoSize){
case "width":
this.setSize(sz.width, "");
break;
case "height":
this.setSize("", sz.height);
break;
default:
this.setSize(sz.width, sz.height);
}
}
},
setSize : function(w, h){
delete this.field.lastSize;
this.field.setSize(w, h);
if(this.el){
this.el.sync();
}
},
realign : function(){
this.el.alignTo(this.boundEl, this.alignment);
},
completeEdit : function(remainVisible){
if(!this.editing){
return;
}
var v = this.getValue();
if(this.revertInvalid !== false && !this.field.isValid()){
v = this.startValue;
this.cancelEdit(true);
}
if(String(v) === String(this.startValue) && this.ignoreNoChange){
this.editing = false;
this.hide();
return;
}
if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){
this.editing = false;
if(this.updateEl && this.boundEl){
this.boundEl.update(v);
}
if(remainVisible !== true){
this.hide();
}
this.fireEvent("complete", this, v, this.startValue);
}
},
onShow : function(){
this.el.show();
if(this.hideEl !== false){
this.boundEl.hide();
}
this.field.show();
if(Ext.isIE && !this.fixIEFocus){ this.fixIEFocus = true;
this.deferredFocus.defer(50, this);
}else{
this.field.focus();
}
this.fireEvent("startedit", this.boundEl, this.startValue);
},
deferredFocus : function(){
if(this.editing){
this.field.focus();
}
},
cancelEdit : function(remainVisible){
if(this.editing){
this.setValue(this.startValue);
if(remainVisible !== true){
this.hide();
}
}
},
onBlur : function(){
if(this.allowBlur !== true && this.editing){
this.completeEdit();
}
},
onHide : function(){
if(this.editing){
this.completeEdit();
return;
}
this.field.blur();
if(this.field.collapse){
this.field.collapse();
}
this.el.hide();
if(this.hideEl !== false){
this.boundEl.show();
}
},
setValue : function(v){
this.field.setValue(v);
},
getValue : function(){
return this.field.getValue();
},
beforeDestroy : function(){
this.field.destroy();
this.field = null;
}
});
Ext.reg('editor', Ext.Editor);
Ext.MessageBox = function(){
var dlg, opt, mask, waitTimer;
var bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl;
var buttons, activeTextEl, bwidth, iconCls = '';
var handleButton = function(button){
dlg.hide();
Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value], 1);
};
var handleHide = function(){
if(opt && opt.cls){
dlg.el.removeClass(opt.cls);
}
progressBar.reset();
};
var handleEsc = function(d, k, e){
if(opt && opt.closable !== false){
dlg.hide();
}
if(e){
e.stopEvent();
}
};
var updateButtons = function(b){
var width = 0;
if(!b){
buttons["ok"].hide();
buttons["cancel"].hide();
buttons["yes"].hide();
buttons["no"].hide();
return width;
}
dlg.footer.dom.style.display = '';
for(var k in buttons){
if(typeof buttons[k] != "function"){
if(b[k]){
buttons[k].show();
buttons[k].setText(typeof b[k] == "string" ? b[k] : Ext.MessageBox.buttonText[k]);
width += buttons[k].el.getWidth()+15;
}else{
buttons[k].hide();
}
}
}
return width;
};
return {
getDialog : function(titleText){
if(!dlg){
dlg = new Ext.Window({
autoCreate : true,
title:titleText,
resizable:false,
constrain:true,
constrainHeader:true,
minimizable : false,
maximizable : false,
stateful: false,
modal: true,
shim:true,
buttonAlign:"center",
width:400,
height:100,
minHeight: 80,
plain:true,
footer:true,
closable:true,
close : function(){
if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){
handleButton("no");
}else{
handleButton("cancel");
}
}
});
buttons = {};
var bt = this.buttonText;
buttons["ok"] = dlg.addButton(bt["ok"], handleButton.createCallback("ok"));
buttons["yes"] = dlg.addButton(bt["yes"], handleButton.createCallback("yes"));
buttons["no"] = dlg.addButton(bt["no"], handleButton.createCallback("no"));
buttons["cancel"] = dlg.addButton(bt["cancel"], handleButton.createCallback("cancel"));
buttons["ok"].hideMode = buttons["yes"].hideMode = buttons["no"].hideMode = buttons["cancel"].hideMode = 'offsets';
dlg.render(document.body);
dlg.getEl().addClass('x-window-dlg');
mask = dlg.mask;
bodyEl = dlg.body.createChild({
html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div>'
});
iconEl = Ext.get(bodyEl.dom.firstChild);
var contentEl = bodyEl.dom.childNodes[1];
msgEl = Ext.get(contentEl.firstChild);
textboxEl = Ext.get(contentEl.childNodes[2]);
textboxEl.enableDisplayMode();
textboxEl.addKeyListener([10,13], function(){
if(dlg.isVisible() && opt && opt.buttons){
if(opt.buttons.ok){
handleButton("ok");
}else if(opt.buttons.yes){
handleButton("yes");
}
}
});
textareaEl = Ext.get(contentEl.childNodes[3]);
textareaEl.enableDisplayMode();
progressBar = new Ext.ProgressBar({
renderTo:bodyEl
});
bodyEl.createChild({cls:'x-clear'});
}
return dlg;
},
updateText : function(text){
if(!dlg.isVisible() && !opt.width){
dlg.setSize(this.maxWidth, 100);
}
msgEl.update(text || ' ');
var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0;
var mw = msgEl.getWidth() + msgEl.getMargins('lr');
var fw = dlg.getFrameWidth('lr');
var bw = dlg.body.getFrameWidth('lr');
if (Ext.isIE && iw > 0){
iw += 3;
}
var w = Math.max(Math.min(opt.width || iw+mw+fw+bw, this.maxWidth),
Math.max(opt.minWidth || this.minWidth, bwidth || 0));
if(opt.prompt === true){
activeTextEl.setWidth(w-iw-fw-bw);
}
if(opt.progress === true || opt.wait === true){
progressBar.setSize(w-iw-fw-bw);
}
dlg.setSize(w, 'auto').center();
return this;
},
updateProgress : function(value, progressText, msg){
progressBar.updateProgress(value, progressText);
if(msg){
this.updateText(msg);
}
return this;
},
isVisible : function(){
return dlg && dlg.isVisible();
},
hide : function(){
if(this.isVisible()){
dlg.hide();
handleHide();
}
return this;
},
show : function(options){
if(this.isVisible()){
this.hide();
}
opt = options;
var d = this.getDialog(opt.title || " ");
d.setTitle(opt.title || " ");
var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true);
d.tools.close.setDisplayed(allowClose);
activeTextEl = textboxEl;
opt.prompt = opt.prompt || (opt.multiline ? true : false);
if(opt.prompt){
if(opt.multiline){
textboxEl.hide();
textareaEl.show();
textareaEl.setHeight(typeof opt.multiline == "number" ?
opt.multiline : this.defaultTextHeight);
activeTextEl = textareaEl;
}else{
textboxEl.show();
textareaEl.hide();
}
}else{
textboxEl.hide();
textareaEl.hide();
}
activeTextEl.dom.value = opt.value || "";
if(opt.prompt){
d.focusEl = activeTextEl;
}else{
var bs = opt.buttons;
var db = null;
if(bs && bs.ok){
db = buttons["ok"];
}else if(bs && bs.yes){
db = buttons["yes"];
}
if (db){
d.focusEl = db;
}
}
this.setIcon(opt.icon);
bwidth = updateButtons(opt.buttons);
progressBar.setVisible(opt.progress === true || opt.wait === true);
this.updateProgress(0, opt.progressText);
this.updateText(opt.msg);
if(opt.cls){
d.el.addClass(opt.cls);
}
d.proxyDrag = opt.proxyDrag === true;
d.modal = opt.modal !== false;
d.mask = opt.modal !== false ? mask : false;
if(!d.isVisible()){
document.body.appendChild(dlg.el.dom);
d.setAnimateTarget(opt.animEl);
d.show(opt.animEl);
}
d.on('show', function(){
if(allowClose === true){
d.keyMap.enable();
}else{
d.keyMap.disable();
}
}, this, {single:true});
if(opt.wait === true){
progressBar.wait(opt.waitConfig);
}
return this;
},
setIcon : function(icon){
if(icon && icon != ''){
iconEl.removeClass('x-hidden');
iconEl.replaceClass(iconCls, icon);
iconCls = icon;
}else{
iconEl.replaceClass(iconCls, 'x-hidden');
iconCls = '';
}
return this;
},
progress : function(title, msg, progressText){
this.show({
title : title,
msg : msg,
buttons: false,
progress:true,
closable:false,
minWidth: this.minProgressWidth,
progressText: progressText
});
return this;
},
wait : function(msg, title, config){
this.show({
title : title,
msg : msg,
buttons: false,
closable:false,
wait:true,
modal:true,
minWidth: this.minProgressWidth,
waitConfig: config
});
return this;
},
alert : function(title, msg, fn, scope){
this.show({
title : title,
msg : msg,
buttons: this.OK,
fn: fn,
scope : scope
});
return this;
},
confirm : function(title, msg, fn, scope){
this.show({
title : title,
msg : msg,
buttons: this.YESNO,
fn: fn,
scope : scope,
icon: this.QUESTION
});
return this;
},
prompt : function(title, msg, fn, scope, multiline){
this.show({
title : title,
msg : msg,
buttons: this.OKCANCEL,
fn: fn,
minWidth:250,
scope : scope,
prompt:true,
multiline: multiline
});
return this;
},
OK : {ok:true},
CANCEL : {cancel:true},
OKCANCEL : {ok:true, cancel:true},
YESNO : {yes:true, no:true},
YESNOCANCEL : {yes:true, no:true, cancel:true},
INFO : 'ext-mb-info',
WARNING : 'ext-mb-warning',
QUESTION : 'ext-mb-question',
ERROR : 'ext-mb-error',
defaultTextHeight : 75,
maxWidth : 600,
minWidth : 100,
minProgressWidth : 250,
buttonText : {
ok : "OK",
cancel : "Cancel",
yes : "Yes",
no : "No"
}
};
}();
Ext.Msg = Ext.MessageBox;
Ext.Tip = Ext.extend(Ext.Panel, {
minWidth : 40,
maxWidth : 300,
shadow : "sides",
defaultAlign : "tl-bl?",
autoRender: true,
quickShowInterval : 250,
frame:true,
hidden:true,
baseCls: 'x-tip',
floating:{shadow:true,shim:true,useDisplay:true,constrain:false},
autoHeight:true,
initComponent : function(){
Ext.Tip.superclass.initComponent.call(this);
if(this.closable && !this.title){
this.elements += ',header';
}
},
afterRender : function(){
Ext.Tip.superclass.afterRender.call(this);
if(this.closable){
this.addTool({
id: 'close',
handler: this.hide,
scope: this
});
}
},
showAt : function(xy){
Ext.Tip.superclass.show.call(this);
if(this.measureWidth !== false && (!this.initialConfig || typeof this.initialConfig.width != 'number')){
var bw = this.body.getTextWidth();
if(this.title){
bw = Math.max(bw, this.header.child('span').getTextWidth(this.title));
}
bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");
this.setWidth(bw.constrain(this.minWidth, this.maxWidth));
}
if(this.constrainPosition){
xy = this.el.adjustForConstraints(xy);
}
this.setPagePosition(xy[0], xy[1]);
},
showBy : function(el, pos){
if(!this.rendered){
this.render(Ext.getBody());
}
this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign));
},
initDraggable : function(){
this.dd = new Ext.Tip.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);
this.header.addClass('x-tip-draggable');
}
});
Ext.Tip.DD = function(tip, config){
Ext.apply(this, config);
this.tip = tip;
Ext.Tip.DD.superclass.constructor.call(this, tip.el.id, 'WindowDD-'+tip.id);
this.setHandleElId(tip.header.id);
this.scroll = false;
};
Ext.extend(Ext.Tip.DD, Ext.dd.DD, {
moveOnly:true,
scroll:false,
headerOffsets:[100, 25],
startDrag : function(){
this.tip.el.disableShadow();
},
endDrag : function(e){
this.tip.el.enableShadow(true);
}
});
Ext.ToolTip = Ext.extend(Ext.Tip, {
showDelay: 500,
hideDelay: 200,
dismissDelay: 5000,
mouseOffset: [15,18],
trackMouse : false,
constrainPosition: true,
initComponent: function(){
Ext.ToolTip.superclass.initComponent.call(this);
this.lastActive = new Date();
this.initTarget();
},
initTarget : function(){
if(this.target){
this.target = Ext.get(this.target);
this.target.on('mouseover', this.onTargetOver, this);
this.target.on('mouseout', this.onTargetOut, this);
this.target.on('mousemove', this.onMouseMove, this);
}
},
onMouseMove : function(e){
this.targetXY = e.getXY();
if(!this.hidden && this.trackMouse){
this.setPagePosition(this.getTargetXY());
}
},
getTargetXY : function(){
return [this.targetXY[0]+this.mouseOffset[0], this.targetXY[1]+this.mouseOffset[1]];
},
onTargetOver : function(e){
if(this.disabled || e.within(this.target.dom, true)){
return;
}
this.clearTimer('hide');
this.targetXY = e.getXY();
this.delayShow();
},
delayShow : function(){
if(this.hidden && !this.showTimer){
if(this.lastActive.getElapsed() < this.quickShowInterval){
this.show();
}else{
this.showTimer = this.show.defer(this.showDelay, this);
}
}else if(!this.hidden && this.autoHide !== false){
this.show();
}
},
onTargetOut : function(e){
if(this.disabled || e.within(this.target.dom, true)){
return;
}
this.clearTimer('show');
if(this.autoHide !== false){
this.delayHide();
}
},
delayHide : function(){
if(!this.hidden && !this.hideTimer){
this.hideTimer = this.hide.defer(this.hideDelay, this);
}
},
hide: function(){
this.clearTimer('dismiss');
this.lastActive = new Date();
Ext.ToolTip.superclass.hide.call(this);
},
show : function(){
this.showAt(this.getTargetXY());
},
showAt : function(xy){
this.lastActive = new Date();
this.clearTimers();
Ext.ToolTip.superclass.showAt.call(this, xy);
if(this.dismissDelay && this.autoHide !== false){
this.dismissTimer = this.hide.defer(this.dismissDelay, this);
}
},
clearTimer : function(name){
name = name + 'Timer';
clearTimeout(this[name]);
delete this[name];
},
clearTimers : function(){
this.clearTimer('show');
this.clearTimer('dismiss');
this.clearTimer('hide');
},
onShow : function(){
Ext.ToolTip.superclass.onShow.call(this);
Ext.getDoc().on('mousedown', this.onDocMouseDown, this);
},
onHide : function(){
Ext.ToolTip.superclass.onHide.call(this);
Ext.getDoc().un('mousedown', this.onDocMouseDown, this);
},
onDocMouseDown : function(e){
if(this.autoHide !== false && !e.within(this.el.dom)){
this.disable();
this.enable.defer(100, this);
}
},
onDisable : function(){
this.clearTimers();
this.hide();
},
adjustPosition : function(x, y){
var ay = this.targetXY[1], h = this.getSize().height;
if(this.constrainPosition && y <= ay && (y+h) >= ay){
y = ay-h-5;
}
return {x : x, y: y};
},
onDestroy : function(){
Ext.ToolTip.superclass.onDestroy.call(this);
if(this.target){
this.target.un('mouseover', this.onTargetOver, this);
this.target.un('mouseout', this.onTargetOut, this);
this.target.un('mousemove', this.onMouseMove, this);
}
}
});
Ext.QuickTip = Ext.extend(Ext.ToolTip, {
interceptTitles : false,
tagConfig : {
namespace : "ext",
attribute : "qtip",
width : "qwidth",
target : "target",
title : "qtitle",
hide : "hide",
cls : "qclass",
align : "qalign"
},
initComponent : function(){
this.target = this.target || Ext.getDoc();
this.targets = this.targets || {};
Ext.QuickTip.superclass.initComponent.call(this);
},
register : function(config){
var cs = Ext.isArray(config) ? config : arguments;
for(var i = 0, len = cs.length; i < len; i++){
var c = cs[i];
var target = c.target;
if(target){
if(Ext.isArray(target)){
for(var j = 0, jlen = target.length; j < jlen; j++){
this.targets[Ext.id(target[j])] = c;
}
} else{
this.targets[Ext.id(target)] = c;
}
}
}
},
unregister : function(el){
delete this.targets[Ext.id(el)];
},
onTargetOver : function(e){
if(this.disabled){
return;
}
this.targetXY = e.getXY();
var t = e.getTarget();
if(!t || t.nodeType !== 1 || t == document || t == document.body){
return;
}
if(this.activeTarget && t == this.activeTarget.el){
this.clearTimer('hide');
this.show();
return;
}
if(t && this.targets[t.id]){
this.activeTarget = this.targets[t.id];
this.activeTarget.el = t;
this.delayShow();
return;
}
var ttp, et = Ext.fly(t), cfg = this.tagConfig;
var ns = cfg.namespace;
if(this.interceptTitles && t.title){
ttp = t.title;
t.qtip = ttp;
t.removeAttribute("title");
e.preventDefault();
} else{
ttp = t.qtip || et.getAttributeNS(ns, cfg.attribute);
}
if(ttp){
var autoHide = et.getAttributeNS(ns, cfg.hide);
this.activeTarget = {
el: t,
text: ttp,
width: et.getAttributeNS(ns, cfg.width),
autoHide: autoHide != "user" && autoHide !== 'false',
title: et.getAttributeNS(ns, cfg.title),
cls: et.getAttributeNS(ns, cfg.cls),
align: et.getAttributeNS(ns, cfg.align)
};
this.delayShow();
}
},
onTargetOut : function(e){
this.clearTimer('show');
if(this.autoHide !== false){
this.delayHide();
}
},
showAt : function(xy){
var t = this.activeTarget;
if(t){
if(!this.rendered){
this.render(Ext.getBody());
this.activeTarget = t;
}
if(t.width){
this.setWidth(t.width);
this.body.setWidth(this.adjustBodyWidth(t.width - this.getFrameWidth()));
this.measureWidth = false;
} else{
this.measureWidth = true;
}
this.setTitle(t.title || '');
this.body.update(t.text);
this.autoHide = t.autoHide;
this.dismissDelay = t.dismissDelay || this.dismissDelay;
if(this.lastCls){
this.el.removeClass(this.lastCls);
delete this.lastCls;
}
if(t.cls){
this.el.addClass(t.cls);
this.lastCls = t.cls;
}
if(t.align){
xy = this.el.getAlignToXY(t.el, t.align);
this.constrainPosition = false;
} else{
this.constrainPosition = true;
}
}
Ext.QuickTip.superclass.showAt.call(this, xy);
},
hide: function(){
delete this.activeTarget;
Ext.QuickTip.superclass.hide.call(this);
}
});
Ext.QuickTips = function(){
var tip, locks = [];
return {
init : function(){
if(!tip){
tip = new Ext.QuickTip({elements:'header,body'});
}
},
enable : function(){
if(tip){
locks.pop();
if(locks.length < 1){
tip.enable();
}
}
},
disable : function(){
if(tip){
tip.disable();
}
locks.push(1);
},
isEnabled : function(){
return tip && !tip.disabled;
},
getQuickTip : function(){
return tip;
},
register : function(){
tip.register.apply(tip, arguments);
},
unregister : function(){
tip.unregister.apply(tip, arguments);
},
tips :function(){
tip.register.apply(tip, arguments);
}
}
}();
Ext.tree.TreePanel = Ext.extend(Ext.Panel, {
rootVisible : true,
animate: Ext.enableFx,
lines : true,
enableDD : false,
hlDrop : Ext.enableFx,
pathSeparator: "/",
initComponent : function(){
Ext.tree.TreePanel.superclass.initComponent.call(this);
if(!this.eventModel){
this.eventModel = new Ext.tree.TreeEventModel(this);
}
this.nodeHash = {};
if(this.root){
this.setRootNode(this.root);
}
this.addEvents(
"append",
"remove",
"movenode",
"insert",
"beforeappend",
"beforeremove",
"beforemovenode",
"beforeinsert",
"beforeload",
"load",
"textchange",
"beforeexpandnode",
"beforecollapsenode",
"expandnode",
"disabledchange",
"collapsenode",
"beforeclick",
"click",
"checkchange",
"dblclick",
"contextmenu",
"beforechildrenrendered",
"startdrag",
"enddrag",
"dragdrop",
"beforenodedrop",
"nodedrop",
"nodedragover"
);
if(this.singleExpand){
this.on("beforeexpandnode", this.restrictExpand, this);
}
},
proxyNodeEvent : function(ename, a1, a2, a3, a4, a5, a6){
if(ename == 'collapse' || ename == 'expand' || ename == 'beforecollapse' || ename == 'beforeexpand' || ename == 'move' || ename == 'beforemove'){
ename = ename+'node';
}
return this.fireEvent(ename, a1, a2, a3, a4, a5, a6);
},
getRootNode : function(){
return this.root;
},
setRootNode : function(node){
this.root = node;
node.ownerTree = this;
node.isRoot = true;
this.registerNode(node);
if(!this.rootVisible){
var uiP = node.attributes.uiProvider;
node.ui = uiP ? new uiP(node) : new Ext.tree.RootTreeNodeUI(node);
}
return node;
},
getNodeById : function(id){
return this.nodeHash[id];
},
registerNode : function(node){
this.nodeHash[node.id] = node;
},
unregisterNode : function(node){
delete this.nodeHash[node.id];
},
toString : function(){
return "[Tree"+(this.id?" "+this.id:"")+"]";
},
restrictExpand : function(node){
var p = node.parentNode;
if(p){
if(p.expandedChild && p.expandedChild.parentNode == p){
p.expandedChild.collapse();
}
p.expandedChild = node;
}
},
getChecked : function(a, startNode){
startNode = startNode || this.root;
var r = [];
var f = function(){
if(this.attributes.checked){
r.push(!a ? this : (a == 'id' ? this.id : this.attributes[a]));
}
}
startNode.cascade(f);
return r;
},
getEl : function(){
return this.el;
},
getLoader : function(){
return this.loader;
},
expandAll : function(){
this.root.expand(true);
},
collapseAll : function(){
this.root.collapse(true);
},
getSelectionModel : function(){
if(!this.selModel){
this.selModel = new Ext.tree.DefaultSelectionModel();
}
return this.selModel;
},
expandPath : function(path, attr, callback){
attr = attr || "id";
var keys = path.split(this.pathSeparator);
var curNode = this.root;
if(curNode.attributes[attr] != keys[1]){
if(callback){
callback(false, null);
}
return;
}
var index = 1;
var f = function(){
if(++index == keys.length){
if(callback){
callback(true, curNode);
}
return;
}
var c = curNode.findChild(attr, keys[index]);
if(!c){
if(callback){
callback(false, curNode);
}
return;
}
curNode = c;
c.expand(false, false, f);
};
curNode.expand(false, false, f);
},
selectPath : function(path, attr, callback){
attr = attr || "id";
var keys = path.split(this.pathSeparator);
var v = keys.pop();
if(keys.length > 0){
var f = function(success, node){
if(success && node){
var n = node.findChild(attr, v);
if(n){
n.select();
if(callback){
callback(true, n);
}
}else if(callback){
callback(false, n);
}
}else{
if(callback){
callback(false, n);
}
}
};
this.expandPath(keys.join(this.pathSeparator), attr, f);
}else{
this.root.select();
if(callback){
callback(true, this.root);
}
}
},
getTreeEl : function(){
return this.body;
},
onRender : function(ct, position){
Ext.tree.TreePanel.superclass.onRender.call(this, ct, position);
this.el.addClass('x-tree');
this.innerCt = this.body.createChild({tag:"ul",
cls:"x-tree-root-ct " +
(this.useArrows ? 'x-tree-arrows' : this.lines ? "x-tree-lines" : "x-tree-no-lines")});
},
initEvents : function(){
Ext.tree.TreePanel.superclass.initEvents.call(this);
if(this.containerScroll){
Ext.dd.ScrollManager.register(this.body);
}
if((this.enableDD || this.enableDrop) && !this.dropZone){
this.dropZone = new Ext.tree.TreeDropZone(this, this.dropConfig || {
ddGroup: this.ddGroup || "TreeDD", appendOnly: this.ddAppendOnly === true
});
}
if((this.enableDD || this.enableDrag) && !this.dragZone){
this.dragZone = new Ext.tree.TreeDragZone(this, this.dragConfig || {
ddGroup: this.ddGroup || "TreeDD",
scroll: this.ddScroll
});
}
this.getSelectionModel().init(this);
},
afterRender : function(){
Ext.tree.TreePanel.superclass.afterRender.call(this);
this.root.render();
if(!this.rootVisible){
this.root.renderChildren();
}
},
onDestroy : function(){
if(this.rendered){
this.body.removeAllListeners();
Ext.dd.ScrollManager.unregister(this.body);
if(this.dropZone){
this.dropZone.unreg();
}
if(this.dragZone){
this.dragZone.unreg();
}
}
this.root.destroy();
this.nodeHash = null;
Ext.tree.TreePanel.superclass.onDestroy.call(this);
}
});
Ext.reg('treepanel', Ext.tree.TreePanel);
Ext.tree.TreeEventModel = function(tree){
this.tree = tree;
this.tree.on('render', this.initEvents, this);
}
Ext.tree.TreeEventModel.prototype = {
initEvents : function(){
var el = this.tree.getTreeEl();
el.on('click', this.delegateClick, this);
if(this.tree.trackMouseOver !== false){
el.on('mouseover', this.delegateOver, this);
el.on('mouseout', this.delegateOut, this);
}
el.on('dblclick', this.delegateDblClick, this);
el.on('contextmenu', this.delegateContextMenu, this);
},
getNode : function(e){
var t;
if(t = e.getTarget('.x-tree-node-el', 10)){
var id = Ext.fly(t, '_treeEvents').getAttributeNS('ext', 'tree-node-id');
if(id){
return this.tree.getNodeById(id);
}
}
return null;
},
getNodeTarget : function(e){
var t = e.getTarget('.x-tree-node-icon', 1);
if(!t){
t = e.getTarget('.x-tree-node-el', 6);
}
return t;
},
delegateOut : function(e, t){
if(!this.beforeEvent(e)){
return;
}
if(e.getTarget('.x-tree-ec-icon', 1)){
var n = this.getNode(e);
this.onIconOut(e, n);
if(n == this.lastEcOver){
delete this.lastEcOver;
}
}
if((t = this.getNodeTarget(e)) && !e.within(t, true)){
this.onNodeOut(e, this.getNode(e));
}
},
delegateOver : function(e, t){
if(!this.beforeEvent(e)){
return;
}
if(this.lastEcOver){
this.onIconOut(e, this.lastEcOver);
delete this.lastEcOver;
}
if(e.getTarget('.x-tree-ec-icon', 1)){
this.lastEcOver = this.getNode(e);
this.onIconOver(e, this.lastEcOver);
}
if(t = this.getNodeTarget(e)){
this.onNodeOver(e, this.getNode(e));
}
},
delegateClick : function(e, t){
if(!this.beforeEvent(e)){
return;
}
if(e.getTarget('input[type=checkbox]', 1)){
this.onCheckboxClick(e, this.getNode(e));
}
else if(e.getTarget('.x-tree-ec-icon', 1)){
this.onIconClick(e, this.getNode(e));
}
else if(this.getNodeTarget(e)){
this.onNodeClick(e, this.getNode(e));
}
},
delegateDblClick : function(e, t){
if(this.beforeEvent(e) && this.getNodeTarget(e)){
this.onNodeDblClick(e, this.getNode(e));
}
},
delegateContextMenu : function(e, t){
if(this.beforeEvent(e) && this.getNodeTarget(e)){
this.onNodeContextMenu(e, this.getNode(e));
}
},
onNodeClick : function(e, node){
node.ui.onClick(e);
},
onNodeOver : function(e, node){
node.ui.onOver(e);
},
onNodeOut : function(e, node){
node.ui.onOut(e);
},
onIconOver : function(e, node){
node.ui.addClass('x-tree-ec-over');
},
onIconOut : function(e, node){
node.ui.removeClass('x-tree-ec-over');
},
onIconClick : function(e, node){
node.ui.ecClick(e);
},
onCheckboxClick : function(e, node){
node.ui.onCheckChange(e);
},
onNodeDblClick : function(e, node){
node.ui.onDblClick(e);
},
onNodeContextMenu : function(e, node){
node.ui.onContextMenu(e);
},
beforeEvent : function(e){
if(this.disabled){
e.stopEvent();
return false;
}
return true;
},
disable: function(){
this.disabled = true;
},
enable: function(){
this.disabled = false;
}
};
Ext.tree.DefaultSelectionModel = function(config){
this.selNode = null;
this.addEvents(
"selectionchange",
"beforeselect"
);
Ext.apply(this, config);
Ext.tree.DefaultSelectionModel.superclass.constructor.call(this);
};
Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {
init : function(tree){
this.tree = tree;
tree.getTreeEl().on("keydown", this.onKeyDown, this);
tree.on("click", this.onNodeClick, this);
},
onNodeClick : function(node, e){
this.select(node);
},
select : function(node){
var last = this.selNode;
if(last != node && this.fireEvent('beforeselect', this, node, last) !== false){
if(last){
last.ui.onSelectedChange(false);
}
this.selNode = node;
node.ui.onSelectedChange(true);
this.fireEvent("selectionchange", this, node, last);
}
return node;
},
unselect : function(node){
if(this.selNode == node){
this.clearSelections();
}
},
clearSelections : function(){
var n = this.selNode;
if(n){
n.ui.onSelectedChange(false);
this.selNode = null;
this.fireEvent("selectionchange", this, null);
}
return n;
},
getSelectedNode : function(){
return this.selNode;
},
isSelected : function(node){
return this.selNode == node;
},
selectPrevious : function(){
var s = this.selNode || this.lastSelNode;
if(!s){
return null;
}
var ps = s.previousSibling;
if(ps){
if(!ps.isExpanded() || ps.childNodes.length < 1){
return this.select(ps);
} else{
var lc = ps.lastChild;
while(lc && lc.isExpanded() && lc.childNodes.length > 0){
lc = lc.lastChild;
}
return this.select(lc);
}
} else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){
return this.select(s.parentNode);
}
return null;
},
selectNext : function(){
var s = this.selNode || this.lastSelNode;
if(!s){
return null;
}
if(s.firstChild && s.isExpanded()){
return this.select(s.firstChild);
}else if(s.nextSibling){
return this.select(s.nextSibling);
}else if(s.parentNode){
var newS = null;
s.parentNode.bubble(function(){
if(this.nextSibling){
newS = this.getOwnerTree().selModel.select(this.nextSibling);
return false;
}
});
return newS;
}
return null;
},
onKeyDown : function(e){
var s = this.selNode || this.lastSelNode;
var sm = this;
if(!s){
return;
}
var k = e.getKey();
switch(k){
case e.DOWN:
e.stopEvent();
this.selectNext();
break;
case e.UP:
e.stopEvent();
this.selectPrevious();
break;
case e.RIGHT:
e.preventDefault();
if(s.hasChildNodes()){
if(!s.isExpanded()){
s.expand();
}else if(s.firstChild){
this.select(s.firstChild, e);
}
}
break;
case e.LEFT:
e.preventDefault();
if(s.hasChildNodes() && s.isExpanded()){
s.collapse();
}else if(s.parentNode && (this.tree.rootVisible || s.parentNode != this.tree.getRootNode())){
this.select(s.parentNode, e);
}
break;
};
}
});
Ext.tree.MultiSelectionModel = function(config){
this.selNodes = [];
this.selMap = {};
this.addEvents(
"selectionchange"
);
Ext.apply(this, config);
Ext.tree.MultiSelectionModel.superclass.constructor.call(this);
};
Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {
init : function(tree){
this.tree = tree;
tree.getTreeEl().on("keydown", this.onKeyDown, this);
tree.on("click", this.onNodeClick, this);
},
onNodeClick : function(node, e){
this.select(node, e, e.ctrlKey);
},
select : function(node, e, keepExisting){
if(keepExisting !== true){
this.clearSelections(true);
}
if(this.isSelected(node)){
this.lastSelNode = node;
return node;
}
this.selNodes.push(node);
this.selMap[node.id] = node;
this.lastSelNode = node;
node.ui.onSelectedChange(true);
this.fireEvent("selectionchange", this, this.selNodes);
return node;
},
unselect : function(node){
if(this.selMap[node.id]){
node.ui.onSelectedChange(false);
var sn = this.selNodes;
var index = sn.indexOf(node);
if(index != -1){
this.selNodes.splice(index, 1);
}
delete this.selMap[node.id];
this.fireEvent("selectionchange", this, this.selNodes);
}
},
clearSelections : function(suppressEvent){
var sn = this.selNodes;
if(sn.length > 0){
for(var i = 0, len = sn.length; i < len; i++){
sn[i].ui.onSelectedChange(false);
}
this.selNodes = [];
this.selMap = {};
if(suppressEvent !== true){
this.fireEvent("selectionchange", this, this.selNodes);
}
}
},
isSelected : function(node){
return this.selMap[node.id] ? true : false;
},
getSelectedNodes : function(){
return this.selNodes;
},
onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown,
selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext,
selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious
});
Ext.tree.TreeNode = function(attributes){
attributes = attributes || {};
if(typeof attributes == "string"){
attributes = {text: attributes};
}
this.childrenRendered = false;
this.rendered = false;
Ext.tree.TreeNode.superclass.constructor.call(this, attributes);
this.expanded = attributes.expanded === true;
this.isTarget = attributes.isTarget !== false;
this.draggable = attributes.draggable !== false && attributes.allowDrag !== false;
this.allowChildren = attributes.allowChildren !== false && attributes.allowDrop !== false;
this.text = attributes.text;
this.disabled = attributes.disabled === true;
this.addEvents(
"textchange",
"beforeexpand",
"beforecollapse",
"expand",
"disabledchange",
"collapse",
"beforeclick",
"click",
"checkchange",
"dblclick",
"contextmenu",
"beforechildrenrendered"
);
var uiClass = this.attributes.uiProvider || this.defaultUI || Ext.tree.TreeNodeUI;
this.ui = new uiClass(this);
};
Ext.extend(Ext.tree.TreeNode, Ext.data.Node, {
preventHScroll: true,
isExpanded : function(){
return this.expanded;
},
getUI : function(){
return this.ui;
},
setFirstChild : function(node){
var of = this.firstChild;
Ext.tree.TreeNode.superclass.setFirstChild.call(this, node);
if(this.childrenRendered && of && node != of){
of.renderIndent(true, true);
}
if(this.rendered){
this.renderIndent(true, true);
}
},
setLastChild : function(node){
var ol = this.lastChild;
Ext.tree.TreeNode.superclass.setLastChild.call(this, node);
if(this.childrenRendered && ol && node != ol){
ol.renderIndent(true, true);
}
if(this.rendered){
this.renderIndent(true, true);
}
},
appendChild : function(){
var node = Ext.tree.TreeNode.superclass.appendChild.apply(this, arguments);
if(node && this.childrenRendered){
node.render();
}
this.ui.updateExpandIcon();
return node;
},
removeChild : function(node){
this.ownerTree.getSelectionModel().unselect(node);
Ext.tree.TreeNode.superclass.removeChild.apply(this, arguments);
if(this.childrenRendered){
node.ui.remove();
}
if(this.childNodes.length < 1){
this.collapse(false, false);
}else{
this.ui.updateExpandIcon();
}
if(!this.firstChild && !this.isHiddenRoot()) {
this.childrenRendered = false;
}
return node;
},
insertBefore : function(node, refNode){
var newNode = Ext.tree.TreeNode.superclass.insertBefore.apply(this, arguments);
if(newNode && refNode && this.childrenRendered){
node.render();
}
this.ui.updateExpandIcon();
return newNode;
},
setText : function(text){
var oldText = this.text;
this.text = text;
this.attributes.text = text;
if(this.rendered){
this.ui.onTextChange(this, text, oldText);
}
this.fireEvent("textchange", this, text, oldText);
},
select : function(){
this.getOwnerTree().getSelectionModel().select(this);
},
unselect : function(){
this.getOwnerTree().getSelectionModel().unselect(this);
},
isSelected : function(){
return this.getOwnerTree().getSelectionModel().isSelected(this);
},
expand : function(deep, anim, callback){
if(!this.expanded){
if(this.fireEvent("beforeexpand", this, deep, anim) === false){
return;
}
if(!this.childrenRendered){
this.renderChildren();
}
this.expanded = true;
if(!this.isHiddenRoot() && (this.getOwnerTree().animate && anim !== false) || anim){
this.ui.animExpand(function(){
this.fireEvent("expand", this);
if(typeof callback == "function"){
callback(this);
}
if(deep === true){
this.expandChildNodes(true);
}
}.createDelegate(this));
return;
}else{
this.ui.expand();
this.fireEvent("expand", this);
if(typeof callback == "function"){
callback(this);
}
}
}else{
if(typeof callback == "function"){
callback(this);
}
}
if(deep === true){
this.expandChildNodes(true);
}
},
isHiddenRoot : function(){
return this.isRoot && !this.getOwnerTree().rootVisible;
},
collapse : function(deep, anim){
if(this.expanded && !this.isHiddenRoot()){
if(this.fireEvent("beforecollapse", this, deep, anim) === false){
return;
}
this.expanded = false;
if((this.getOwnerTree().animate && anim !== false) || anim){
this.ui.animCollapse(function(){
this.fireEvent("collapse", this);
if(deep === true){
this.collapseChildNodes(true);
}
}.createDelegate(this));
return;
}else{
this.ui.collapse();
this.fireEvent("collapse", this);
}
}
if(deep === true){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++) {
cs[i].collapse(true, false);
}
}
},
delayedExpand : function(delay){
if(!this.expandProcId){
this.expandProcId = this.expand.defer(delay, this);
}
},
cancelExpand : function(){
if(this.expandProcId){
clearTimeout(this.expandProcId);
}
this.expandProcId = false;
},
toggle : function(){
if(this.expanded){
this.collapse();
}else{
this.expand();
}
},
ensureVisible : function(callback){
var tree = this.getOwnerTree();
tree.expandPath(this.parentNode.getPath(), false, function(){
var node = tree.getNodeById(this.id);
tree.getTreeEl().scrollChildIntoView(node.ui.anchor);
Ext.callback(callback);
}.createDelegate(this));
},
expandChildNodes : function(deep){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++) {
cs[i].expand(deep);
}
},
collapseChildNodes : function(deep){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++) {
cs[i].collapse(deep);
}
},
disable : function(){
this.disabled = true;
this.unselect();
if(this.rendered && this.ui.onDisableChange){
this.ui.onDisableChange(this, true);
}
this.fireEvent("disabledchange", this, true);
},
enable : function(){
this.disabled = false;
if(this.rendered && this.ui.onDisableChange){
this.ui.onDisableChange(this, false);
}
this.fireEvent("disabledchange", this, false);
},
renderChildren : function(suppressEvent){
if(suppressEvent !== false){
this.fireEvent("beforechildrenrendered", this);
}
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++){
cs[i].render(true);
}
this.childrenRendered = true;
},
sort : function(fn, scope){
Ext.tree.TreeNode.superclass.sort.apply(this, arguments);
if(this.childrenRendered){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++){
cs[i].render(true);
}
}
},
render : function(bulkRender){
this.ui.render(bulkRender);
if(!this.rendered){
this.getOwnerTree().registerNode(this);
this.rendered = true;
if(this.expanded){
this.expanded = false;
this.expand(false, false);
}
}
},
renderIndent : function(deep, refresh){
if(refresh){
this.ui.childIndent = null;
}
this.ui.renderIndent();
if(deep === true && this.childrenRendered){
var cs = this.childNodes;
for(var i = 0, len = cs.length; i < len; i++){
cs[i].renderIndent(true, refresh);
}
}
},
beginUpdate : function(){
this.childrenRendered = false;
},
endUpdate : function(){
if(this.expanded){
this.renderChildren();
}
},
destroy : function(){
for(var i = 0,l = this.childNodes.length; i < l; i++){
this.childNodes[i].destroy();
}
this.childNodes = null;
if(this.ui.destroy){
this.ui.destroy();
}
}
});
Ext.tree.AsyncTreeNode = function(config){
this.loaded = false;
this.loading = false;
Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments);
this.addEvents('beforeload', 'load');
};
Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, {
expand : function(deep, anim, callback){
if(this.loading){
var timer;
var f = function(){
if(!this.loading){
clearInterval(timer);
this.expand(deep, anim, callback);
}
}.createDelegate(this);
timer = setInterval(f, 200);
return;
}
if(!this.loaded){
if(this.fireEvent("beforeload", this) === false){
return;
}
this.loading = true;
this.ui.beforeLoad(this);
var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();
if(loader){
loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback]));
return;
}
}
Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback);
},
isLoading : function(){
return this.loading;
},
loadComplete : function(deep, anim, callback){
this.loading = false;
this.loaded = true;
this.ui.afterLoad(this);
this.fireEvent("load", this);
this.expand(deep, anim, callback);
},
isLoaded : function(){
return this.loaded;
},
hasChildNodes : function(){
if(!this.isLeaf() && !this.loaded){
return true;
}else{
return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);
}
},
reload : function(callback){
this.collapse(false, false);
while(this.firstChild){
this.removeChild(this.firstChild);
}
this.childrenRendered = false;
this.loaded = false;
if(this.isHiddenRoot()){
this.expanded = false;
}
this.expand(false, false, callback);
}
});
Ext.tree.TreeNodeUI = function(node){
this.node = node;
this.rendered = false;
this.animating = false;
this.wasLeaf = true;
this.ecc = 'x-tree-ec-icon x-tree-elbow';
this.emptyIcon = Ext.BLANK_IMAGE_URL;
};
Ext.tree.TreeNodeUI.prototype = {
removeChild : function(node){
if(this.rendered){
this.ctNode.removeChild(node.ui.getEl());
}
},
beforeLoad : function(){
this.addClass("x-tree-node-loading");
},
afterLoad : function(){
this.removeClass("x-tree-node-loading");
},
onTextChange : function(node, text, oldText){
if(this.rendered){
this.textNode.innerHTML = text;
}
},
onDisableChange : function(node, state){
this.disabled = state;
if (this.checkbox) {
this.checkbox.disabled = state;
}
if(state){
this.addClass("x-tree-node-disabled");
}else{
this.removeClass("x-tree-node-disabled");
}
},
onSelectedChange : function(state){
if(state){
this.focus();
this.addClass("x-tree-selected");
}else{
this.removeClass("x-tree-selected");
}
},
onMove : function(tree, node, oldParent, newParent, index, refNode){
this.childIndent = null;
if(this.rendered){
var targetNode = newParent.ui.getContainer();
if(!targetNode){
this.holder = document.createElement("div");
this.holder.appendChild(this.wrap);
return;
}
var insertBefore = refNode ? refNode.ui.getEl() : null;
if(insertBefore){
targetNode.insertBefore(this.wrap, insertBefore);
}else{
targetNode.appendChild(this.wrap);
}
this.node.renderIndent(true);
}
},
addClass : function(cls){
if(this.elNode){
Ext.fly(this.elNode).addClass(cls);
}
},
removeClass : function(cls){
if(this.elNode){
Ext.fly(this.elNode).removeClass(cls);
}
},
remove : function(){
if(this.rendered){
this.holder = document.createElement("div");
this.holder.appendChild(this.wrap);
}
},
fireEvent : function(){
return this.node.fireEvent.apply(this.node, arguments);
},
initEvents : function(){
this.node.on("move", this.onMove, this);
if(this.node.disabled){
this.addClass("x-tree-node-disabled");
if (this.checkbox) {
this.checkbox.disabled = true;
}
}
if(this.node.hidden){
this.hide();
}
var ot = this.node.getOwnerTree();
var dd = ot.enableDD || ot.enableDrag || ot.enableDrop;
if(dd && (!this.node.isRoot || ot.rootVisible)){
Ext.dd.Registry.register(this.elNode, {
node: this.node,
handles: this.getDDHandles(),
isHandle: false
});
}
},
getDDHandles : function(){
return [this.iconNode, this.textNode, this.elNode];
},
hide : function(){
this.node.hidden = true;
if(this.wrap){
this.wrap.style.display = "none";
}
},
show : function(){
this.node.hidden = false;
if(this.wrap){
this.wrap.style.display = "";
}
},
onContextMenu : function(e){
if (this.node.hasListener("contextmenu") || this.node.getOwnerTree().hasListener("contextmenu")) {
e.preventDefault();
this.focus();
this.fireEvent("contextmenu", this.node, e);
}
},
onClick : function(e){
if(this.dropping){
e.stopEvent();
return;
}
if(this.fireEvent("beforeclick", this.node, e) !== false){
var a = e.getTarget('a');
if(!this.disabled && this.node.attributes.href && a){
this.fireEvent("click", this.node, e);
return;
}else if(a && e.ctrlKey){
e.stopEvent();
}
e.preventDefault();
if(this.disabled){
return;
}
if(this.node.attributes.singleClickExpand && !this.animating && this.node.hasChildNodes()){
this.node.toggle();
}
this.fireEvent("click", this.node, e);
}else{
e.stopEvent();
}
},
onDblClick : function(e){
e.preventDefault();
if(this.disabled){
return;
}
if(this.checkbox){
this.toggleCheck();
}
if(!this.animating && this.node.hasChildNodes()){
this.node.toggle();
}
this.fireEvent("dblclick", this.node, e);
},
onOver : function(e){
this.addClass('x-tree-node-over');
},
onOut : function(e){
this.removeClass('x-tree-node-over');
},
onCheckChange : function(){
var checked = this.checkbox.checked;
this.node.attributes.checked = checked;
this.fireEvent('checkchange', this.node, checked);
},
ecClick : function(e){
if(!this.animating && (this.node.hasChildNodes() || this.node.attributes.expandable)){
this.node.toggle();
}
},
startDrop : function(){
this.dropping = true;
},
endDrop : function(){
setTimeout(function(){
this.dropping = false;
}.createDelegate(this), 50);
},
expand : function(){
this.updateExpandIcon();
this.ctNode.style.display = "";
},
focus : function(){
if(!this.node.preventHScroll){
try{this.anchor.focus();
}catch(e){}
}else if(!Ext.isIE){
try{
var noscroll = this.node.getOwnerTree().getTreeEl().dom;
var l = noscroll.scrollLeft;
this.anchor.focus();
noscroll.scrollLeft = l;
}catch(e){}
}
},
toggleCheck : function(value){
var cb = this.checkbox;
if(cb){
cb.checked = (value === undefined ? !cb.checked : value);
}
},
blur : function(){
try{
this.anchor.blur();
}catch(e){}
},
animExpand : function(callback){
var ct = Ext.get(this.ctNode);
ct.stopFx();
if(!this.node.hasChildNodes()){
this.updateExpandIcon();
this.ctNode.style.display = "";
Ext.callback(callback);
return;
}
this.animating = true;
this.updateExpandIcon();
ct.slideIn('t', {
callback : function(){
this.animating = false;
Ext.callback(callback);
},
scope: this,
duration: this.node.ownerTree.duration || .25
});
},
highlight : function(){
var tree = this.node.getOwnerTree();
Ext.fly(this.wrap).highlight(
tree.hlColor || "C3DAF9",
{endColor: tree.hlBaseColor}
);
},
collapse : function(){
this.updateExpandIcon();
this.ctNode.style.display = "none";
},
animCollapse : function(callback){
var ct = Ext.get(this.ctNode);
ct.enableDisplayMode('block');
ct.stopFx();
this.animating = true;
this.updateExpandIcon();
ct.slideOut('t', {
callback : function(){
this.animating = false;
Ext.callback(callback);
},
scope: this,
duration: this.node.ownerTree.duration || .25
});
},
getContainer : function(){
return this.ctNode;
},
getEl : function(){
return this.wrap;
},
appendDDGhost : function(ghostNode){
ghostNode.appendChild(this.elNode.cloneNode(true));
},
getDDRepairXY : function(){
return Ext.lib.Dom.getXY(this.iconNode);
},
onRender : function(){
this.render();
},
render : function(bulkRender){
var n = this.node, a = n.attributes;
var targetNode = n.parentNode ?
n.parentNode.ui.getContainer() : n.ownerTree.innerCt.dom;
if(!this.rendered){
this.rendered = true;
this.renderElements(n, a, targetNode, bulkRender);
if(a.qtip){
if(this.textNode.setAttributeNS){
this.textNode.setAttributeNS("ext", "qtip", a.qtip);
if(a.qtipTitle){
this.textNode.setAttributeNS("ext", "qtitle", a.qtipTitle);
}
}else{
this.textNode.setAttribute("ext:qtip", a.qtip);
if(a.qtipTitle){
this.textNode.setAttribute("ext:qtitle", a.qtipTitle);
}
}
}else if(a.qtipCfg){
a.qtipCfg.target = Ext.id(this.textNode);
Ext.QuickTips.register(a.qtipCfg);
}
this.initEvents();
if(!this.node.expanded){
this.updateExpandIcon(true);
}
}else{
if(bulkRender === true) {
targetNode.appendChild(this.wrap);
}
}
},
renderElements : function(n, a, targetNode, bulkRender){
this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
var cb = typeof a.checked == 'boolean';
var href = a.href ? a.href : Ext.isGecko ? "" : "#";
var buf = ['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls,'" unselectable="on">',
'<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" />',
cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',
'<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',
a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on">',n.text,"</span></a></div>",
'<ul class="x-tree-node-ct" style="display:none;"></ul>',
"</li>"].join('');
var nel;
if(bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())){
this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf);
}else{
this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf);
}
this.elNode = this.wrap.childNodes[0];
this.ctNode = this.wrap.childNodes[1];
var cs = this.elNode.childNodes;
this.indentNode = cs[0];
this.ecNode = cs[1];
this.iconNode = cs[2];
var index = 3;
if(cb){
this.checkbox = cs[3];
index++;
}
this.anchor = cs[index];
this.textNode = cs[index].firstChild;
},
getAnchor : function(){
return this.anchor;
},
getTextEl : function(){
return this.textNode;
},
getIconEl : function(){
return this.iconNode;
},
isChecked : function(){
return this.checkbox ? this.checkbox.checked : false;
},
updateExpandIcon : function(){
if(this.rendered){
var n = this.node, c1, c2;
var cls = n.isLast() ? "x-tree-elbow-end" : "x-tree-elbow";
var hasChild = n.hasChildNodes();
if(hasChild || n.attributes.expandable){
if(n.expanded){
cls += "-minus";
c1 = "x-tree-node-collapsed";
c2 = "x-tree-node-expanded";
}else{
cls += "-plus";
c1 = "x-tree-node-expanded";
c2 = "x-tree-node-collapsed";
}
if(this.wasLeaf){
this.removeClass("x-tree-node-leaf");
this.wasLeaf = false;
}
if(this.c1 != c1 || this.c2 != c2){
Ext.fly(this.elNode).replaceClass(c1, c2);
this.c1 = c1; this.c2 = c2;
}
}else{
if(!this.wasLeaf){
Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-leaf");
delete this.c1;
delete this.c2;
this.wasLeaf = true;
}
}
var ecc = "x-tree-ec-icon "+cls;
if(this.ecc != ecc){
this.ecNode.className = ecc;
this.ecc = ecc;
}
}
},
getChildIndent : function(){
if(!this.childIndent){
var buf = [];
var p = this.node;
while(p){
if(!p.isRoot || (p.isRoot && p.ownerTree.rootVisible)){
if(!p.isLast()) {
buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');
} else {
buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');
}
}
p = p.parentNode;
}
this.childIndent = buf.join("");
}
return this.childIndent;
},
renderIndent : function(){
if(this.rendered){
var indent = "";
var p = this.node.parentNode;
if(p){
indent = p.ui.getChildIndent();
}
if(this.indentMarkup != indent){
this.indentNode.innerHTML = indent;
this.indentMarkup = indent;
}
this.updateExpandIcon();
}
},
destroy : function(){
if(this.elNode){
Ext.dd.Registry.unregister(this.elNode.id);
}
delete this.elNode;
delete this.ctNode;
delete this.indentNode;
delete this.ecNode;
delete this.iconNode;
delete this.checkbox;
delete this.anchor;
delete this.textNode;
Ext.removeNode(this.ctNode);
}
};
Ext.tree.RootTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
render : function(){
if(!this.rendered){
var targetNode = this.node.ownerTree.innerCt.dom;
this.node.expanded = true;
targetNode.innerHTML = '<div class="x-tree-root-node"></div>';
this.wrap = this.ctNode = targetNode.firstChild;
}
},
collapse : Ext.emptyFn,
expand : Ext.emptyFn
});
Ext.tree.TreeLoader = function(config){
this.baseParams = {};
this.requestMethod = "POST";
Ext.apply(this, config);
this.addEvents(
"beforeload",
"load",
"loadexception"
);
Ext.tree.TreeLoader.superclass.constructor.call(this);
};
Ext.extend(Ext.tree.TreeLoader, Ext.util.Observable, {
uiProviders : {},
clearOnLoad : true,
load : function(node, callback){
if(this.clearOnLoad){
while(node.firstChild){
node.removeChild(node.firstChild);
}
}
if(this.doPreload(node)){
if(typeof callback == "function"){
callback();
}
}else if(this.dataUrl||this.url){
this.requestData(node, callback);
}
},
doPreload : function(node){
if(node.attributes.children){
if(node.childNodes.length < 1){
var cs = node.attributes.children;
node.beginUpdate();
for(var i = 0, len = cs.length; i < len; i++){
var cn = node.appendChild(this.createNode(cs[i]));
if(this.preloadChildren){
this.doPreload(cn);
}
}
node.endUpdate();
}
return true;
}else {
return false;
}
},
getParams: function(node){
var buf = [], bp = this.baseParams;
for(var key in bp){
if(typeof bp[key] != "function"){
buf.push(encodeURIComponent(key), "=", encodeURIComponent(bp[key]), "&");
}
}
buf.push("node=", encodeURIComponent(node.id));
return buf.join("");
},
requestData : function(node, callback){
if(this.fireEvent("beforeload", this, node, callback) !== false){
this.transId = Ext.Ajax.request({
method:this.requestMethod,
url: this.dataUrl||this.url,
success: this.handleResponse,
failure: this.handleFailure,
scope: this,
argument: {callback: callback, node: node},
params: this.getParams(node)
});
}else{
if(typeof callback == "function"){
callback();
}
}
},
isLoading : function(){
return this.transId ? true : false;
},
abort : function(){
if(this.isLoading()){
Ext.Ajax.abort(this.transId);
}
},
createNode : function(attr){
if(this.baseAttrs){
Ext.applyIf(attr, this.baseAttrs);
}
if(this.applyLoader !== false){
attr.loader = this;
}
if(typeof attr.uiProvider == 'string'){
attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider);
}
return(attr.leaf ?
new Ext.tree.TreeNode(attr) :
new Ext.tree.AsyncTreeNode(attr));
},
processResponse : function(response, node, callback){
var json = response.responseText;
try {
var o = eval("("+json+")");
node.beginUpdate();
for(var i = 0, len = o.length; i < len; i++){
var n = this.createNode(o[i]);
if(n){
node.appendChild(n);
}
}
node.endUpdate();
if(typeof callback == "function"){
callback(this, node);
}
}catch(e){
this.handleFailure(response);
}
},
handleResponse : function(response){
this.transId = false;
var a = response.argument;
this.processResponse(response, a.node, a.callback);
this.fireEvent("load", this, a.node, response);
},
handleFailure : function(response){
this.transId = false;
var a = response.argument;
this.fireEvent("loadexception", this, a.node, response);
if(typeof a.callback == "function"){
a.callback(this, a.node);
}
}
});
Ext.tree.TreeFilter = function(tree, config){
this.tree = tree;
this.filtered = {};
Ext.apply(this, config);
};
Ext.tree.TreeFilter.prototype = {
clearBlank:false,
reverse:false,
autoClear:false,
remove:false,
filter : function(value, attr, startNode){
attr = attr || "text";
var f;
if(typeof value == "string"){
var vlen = value.length;
if(vlen == 0 && this.clearBlank){
this.clear();
return;
}
value = value.toLowerCase();
f = function(n){
return n.attributes[attr].substr(0, vlen).toLowerCase() == value;
};
}else if(value.exec){
f = function(n){
return value.test(n.attributes[attr]);
};
}else{
throw 'Illegal filter type, must be string or regex';
}
this.filterBy(f, null, startNode);
},
filterBy : function(fn, scope, startNode){
startNode = startNode || this.tree.root;
if(this.autoClear){
this.clear();
}
var af = this.filtered, rv = this.reverse;
var f = function(n){
if(n == startNode){
return true;
}
if(af[n.id]){
return false;
}
var m = fn.call(scope || n, n);
if(!m || rv){
af[n.id] = n;
n.ui.hide();
return false;
}
return true;
};
startNode.cascade(f);
if(this.remove){
for(var id in af){
if(typeof id != "function"){
var n = af[id];
if(n && n.parentNode){
n.parentNode.removeChild(n);
}
}
}
}
},
clear : function(){
var t = this.tree;
var af = this.filtered;
for(var id in af){
if(typeof id != "function"){
var n = af[id];
if(n){
n.ui.show();
}
}
}
this.filtered = {};
}
};
Ext.tree.TreeSorter = function(tree, config){
Ext.apply(this, config);
tree.on("beforechildrenrendered", this.doSort, this);
tree.on("append", this.updateSort, this);
tree.on("insert", this.updateSort, this);
tree.on("textchange", this.updateSortParent, this);
var dsc = this.dir && this.dir.toLowerCase() == "desc";
var p = this.property || "text";
var sortType = this.sortType;
var fs = this.folderSort;
var cs = this.caseSensitive === true;
var leafAttr = this.leafAttr || 'leaf';
this.sortFn = function(n1, n2){
if(fs){
if(n1.attributes[leafAttr] && !n2.attributes[leafAttr]){
return 1;
}
if(!n1.attributes[leafAttr] && n2.attributes[leafAttr]){
return -1;
}
}
var v1 = sortType ? sortType(n1) : (cs ? n1.attributes[p] : n1.attributes[p].toUpperCase());
var v2 = sortType ? sortType(n2) : (cs ? n2.attributes[p] : n2.attributes[p].toUpperCase());
if(v1 < v2){
return dsc ? +1 : -1;
}else if(v1 > v2){
return dsc ? -1 : +1;
}else{
return 0;
}
};
};
Ext.tree.TreeSorter.prototype = {
doSort : function(node){
node.sort(this.sortFn);
},
compareNodes : function(n1, n2){
return (n1.text.toUpperCase() > n2.text.toUpperCase() ? 1 : -1);
},
updateSort : function(tree, node){
if(node.childrenRendered){
this.doSort.defer(1, this, [node]);
}
},
updateSortParent : function(node){
var p = node.parentNode;
if(p && p.childrenRendered){
this.doSort.defer(1, this, [p]);
}
}
};
if(Ext.dd.DropZone){
Ext.tree.TreeDropZone = function(tree, config){
this.allowParentInsert = false;
this.allowContainerDrop = false;
this.appendOnly = false;
Ext.tree.TreeDropZone.superclass.constructor.call(this, tree.innerCt, config);
this.tree = tree;
this.dragOverData = {};
this.lastInsertClass = "x-tree-no-status";
};
Ext.extend(Ext.tree.TreeDropZone, Ext.dd.DropZone, {
ddGroup : "TreeDD",
expandDelay : 1000,
expandNode : function(node){
if(node.hasChildNodes() && !node.isExpanded()){
node.expand(false, null, this.triggerCacheRefresh.createDelegate(this));
}
},
queueExpand : function(node){
this.expandProcId = this.expandNode.defer(this.expandDelay, this, [node]);
},
cancelExpand : function(){
if(this.expandProcId){
clearTimeout(this.expandProcId);
this.expandProcId = false;
}
},
isValidDropPoint : function(n, pt, dd, e, data){
if(!n || !data){ return false; }
var targetNode = n.node;
var dropNode = data.node;
if(!(targetNode && targetNode.isTarget && pt)){
return false;
}
if(pt == "append" && targetNode.allowChildren === false){
return false;
}
if((pt == "above" || pt == "below") && (targetNode.parentNode && targetNode.parentNode.allowChildren === false)){
return false;
}
if(dropNode && (targetNode == dropNode || dropNode.contains(targetNode))){
return false;
}
var overEvent = this.dragOverData;
overEvent.tree = this.tree;
overEvent.target = targetNode;
overEvent.data = data;
overEvent.point = pt;
overEvent.source = dd;
overEvent.rawEvent = e;
overEvent.dropNode = dropNode;
overEvent.cancel = false;
var result = this.tree.fireEvent("nodedragover", overEvent);
return overEvent.cancel === false && result !== false;
},
getDropPoint : function(e, n, dd){
var tn = n.node;
if(tn.isRoot){
return tn.allowChildren !== false ? "append" : false;
}
var dragEl = n.ddel;
var t = Ext.lib.Dom.getY(dragEl), b = t + dragEl.offsetHeight;
var y = Ext.lib.Event.getPageY(e);
var noAppend = tn.allowChildren === false || tn.isLeaf();
if(this.appendOnly || tn.parentNode.allowChildren === false){
return noAppend ? false : "append";
}
var noBelow = false;
if(!this.allowParentInsert){
noBelow = tn.hasChildNodes() && tn.isExpanded();
}
var q = (b - t) / (noAppend ? 2 : 3);
if(y >= t && y < (t + q)){
return "above";
}else if(!noBelow && (noAppend || y >= b-q && y <= b)){
return "below";
}else{
return "append";
}
},
onNodeEnter : function(n, dd, e, data){
this.cancelExpand();
},
onNodeOver : function(n, dd, e, data){
var pt = this.getDropPoint(e, n, dd);
var node = n.node;
if(!this.expandProcId && pt == "append" && node.hasChildNodes() && !n.node.isExpanded()){
this.queueExpand(node);
}else if(pt != "append"){
this.cancelExpand();
}
var returnCls = this.dropNotAllowed;
if(this.isValidDropPoint(n, pt, dd, e, data)){
if(pt){
var el = n.ddel;
var cls;
if(pt == "above"){
returnCls = n.node.isFirst() ? "x-tree-drop-ok-above" : "x-tree-drop-ok-between";
cls = "x-tree-drag-insert-above";
}else if(pt == "below"){
returnCls = n.node.isLast() ? "x-tree-drop-ok-below" : "x-tree-drop-ok-between";
cls = "x-tree-drag-insert-below";
}else{
returnCls = "x-tree-drop-ok-append";
cls = "x-tree-drag-append";
}
if(this.lastInsertClass != cls){
Ext.fly(el).replaceClass(this.lastInsertClass, cls);
this.lastInsertClass = cls;
}
}
}
return returnCls;
},
onNodeOut : function(n, dd, e, data){
this.cancelExpand();
this.removeDropIndicators(n);
},
onNodeDrop : function(n, dd, e, data){
var point = this.getDropPoint(e, n, dd);
var targetNode = n.node;
targetNode.ui.startDrop();
if(!this.isValidDropPoint(n, point, dd, e, data)){
targetNode.ui.endDrop();
return false;
}
var dropNode = data.node || (dd.getTreeNode ? dd.getTreeNode(data, targetNode, point, e) : null);
var dropEvent = {
tree : this.tree,
target: targetNode,
data: data,
point: point,
source: dd,
rawEvent: e,
dropNode: dropNode,
cancel: !dropNode,
dropStatus: false
};
var retval = this.tree.fireEvent("beforenodedrop", dropEvent);
if(retval === false || dropEvent.cancel === true || !dropEvent.dropNode){
targetNode.ui.endDrop();
return dropEvent.dropStatus;
}
targetNode = dropEvent.target;
if(point == "append" && !targetNode.isExpanded()){
targetNode.expand(false, null, function(){
this.completeDrop(dropEvent);
}.createDelegate(this));
}else{
this.completeDrop(dropEvent);
}
return true;
},
completeDrop : function(de){
var ns = de.dropNode, p = de.point, t = de.target;
if(!Ext.isArray(ns)){
ns = [ns];
}
var n;
for(var i = 0, len = ns.length; i < len; i++){
n = ns[i];
if(p == "above"){
t.parentNode.insertBefore(n, t);
}else if(p == "below"){
t.parentNode.insertBefore(n, t.nextSibling);
}else{
t.appendChild(n);
}
}
n.ui.focus();
if(this.tree.hlDrop){
n.ui.highlight();
}
t.ui.endDrop();
this.tree.fireEvent("nodedrop", de);
},
afterNodeMoved : function(dd, data, e, targetNode, dropNode){
if(this.tree.hlDrop){
dropNode.ui.focus();
dropNode.ui.highlight();
}
this.tree.fireEvent("nodedrop", this.tree, targetNode, data, dd, e);
},
getTree : function(){
return this.tree;
},
removeDropIndicators : function(n){
if(n && n.ddel){
var el = n.ddel;
Ext.fly(el).removeClass([
"x-tree-drag-insert-above",
"x-tree-drag-insert-below",
"x-tree-drag-append"]);
this.lastInsertClass = "_noclass";
}
},
beforeDragDrop : function(target, e, id){
this.cancelExpand();
return true;
},
afterRepair : function(data){
if(data && Ext.enableFx){
data.node.ui.highlight();
}
this.hideProxy();
}
});
}
if(Ext.dd.DragZone){
Ext.tree.TreeDragZone = function(tree, config){
Ext.tree.TreeDragZone.superclass.constructor.call(this, tree.getTreeEl(), config);
this.tree = tree;
};
Ext.extend(Ext.tree.TreeDragZone, Ext.dd.DragZone, {
ddGroup : "TreeDD",
onBeforeDrag : function(data, e){
var n = data.node;
return n && n.draggable && !n.disabled;
},
onInitDrag : function(e){
var data = this.dragData;
this.tree.getSelectionModel().select(data.node);
this.tree.eventModel.disable();
this.proxy.update("");
data.node.ui.appendDDGhost(this.proxy.ghost.dom);
this.tree.fireEvent("startdrag", this.tree, data.node, e);
},
getRepairXY : function(e, data){
return data.node.ui.getDDRepairXY();
},
onEndDrag : function(data, e){
this.tree.eventModel.enable.defer(100, this.tree.eventModel);
this.tree.fireEvent("enddrag", this.tree, data.node, e);
},
onValidDrop : function(dd, e, id){
this.tree.fireEvent("dragdrop", this.tree, this.dragData.node, dd, e);
this.hideProxy();
},
beforeInvalidDrop : function(e, id){
var sm = this.tree.getSelectionModel();
sm.clearSelections();
sm.select(this.dragData.node);
}
});
}
Ext.tree.TreeEditor = function(tree, config){
config = config || {};
var field = config.events ? config : new Ext.form.TextField(config);
Ext.tree.TreeEditor.superclass.constructor.call(this, field);
this.tree = tree;
if(!tree.rendered){
tree.on('render', this.initEditor, this);
}else{
this.initEditor(tree);
}
};
Ext.extend(Ext.tree.TreeEditor, Ext.Editor, {
alignment: "l-l",
autoSize: false,
hideEl : false,
cls: "x-small-editor x-tree-editor",
shim:false,
shadow:"frame",
maxWidth: 250,
editDelay : 350,
initEditor : function(tree){
tree.on('beforeclick', this.beforeNodeClick, this);
tree.on('dblclick', this.onNodeDblClick, this);
this.on('complete', this.updateNode, this);
this.on('beforestartedit', this.fitToTree, this);
this.on('startedit', this.bindScroll, this, {delay:10});
this.on('specialkey', this.onSpecialKey, this);
},
fitToTree : function(ed, el){
var td = this.tree.getTreeEl().dom, nd = el.dom;
if(td.scrollLeft > nd.offsetLeft){ td.scrollLeft = nd.offsetLeft;
}
var w = Math.min(
this.maxWidth,
(td.clientWidth > 20 ? td.clientWidth : td.offsetWidth) - Math.max(0, nd.offsetLeft-td.scrollLeft) - 5);
this.setSize(w, '');
},
triggerEdit : function(node, defer){
this.completeEdit();
if(node.attributes.editable !== false){
this.editNode = node;
this.autoEditTimer = this.startEdit.defer(this.editDelay, this, [node.ui.textNode, node.text]);
return false;
}
},
bindScroll : function(){
this.tree.getTreeEl().on('scroll', this.cancelEdit, this);
},
beforeNodeClick : function(node, e){
clearTimeout(this.autoEditTimer);
if(this.tree.getSelectionModel().isSelected(node)){
e.stopEvent();
return this.triggerEdit(node);
}
},
onNodeDblClick : function(node, e){
clearTimeout(this.autoEditTimer);
},
updateNode : function(ed, value){
this.tree.getTreeEl().un('scroll', this.cancelEdit, this);
this.editNode.setText(value);
},
onHide : function(){
Ext.tree.TreeEditor.superclass.onHide.call(this);
if(this.editNode){
this.editNode.ui.focus.defer(50, this.editNode.ui);
}
},
onSpecialKey : function(field, e){
var k = e.getKey();
if(k == e.ESC){
e.stopEvent();
this.cancelEdit();
}else if(k == e.ENTER && !e.hasModifier()){
e.stopEvent();
this.completeEdit();
}
}
});
Ext.menu.Menu = function(config){
if(Ext.isArray(config)){
config = {items:config};
}
Ext.apply(this, config);
this.id = this.id || Ext.id();
this.addEvents(
'beforeshow',
'beforehide',
'show',
'hide',
'click',
'mouseover',
'mouseout',
'itemclick'
);
Ext.menu.MenuMgr.register(this);
Ext.menu.Menu.superclass.constructor.call(this);
var mis = this.items;
this.items = new Ext.util.MixedCollection();
if(mis){
this.add.apply(this, mis);
}
};
Ext.extend(Ext.menu.Menu, Ext.util.Observable, {
minWidth : 120,
shadow : "sides",
subMenuAlign : "tl-tr?",
defaultAlign : "tl-bl?",
allowOtherMenus : false,
hidden:true,
createEl : function(){
return new Ext.Layer({
cls: "x-menu",
shadow:this.shadow,
constrain: false,
parentEl: this.parentEl || document.body,
zindex:15000
});
},
render : function(){
if(this.el){
return;
}
var el = this.el = this.createEl();
if(!this.keyNav){
this.keyNav = new Ext.menu.MenuNav(this);
}
if(this.plain){
el.addClass("x-menu-plain");
}
if(this.cls){
el.addClass(this.cls);
}
this.focusEl = el.createChild({
tag: "a", cls: "x-menu-focus", href: "#", onclick: "return false;", tabIndex:"-1"
});
var ul = el.createChild({tag: "ul", cls: "x-menu-list"});
ul.on("click", this.onClick, this);
ul.on("mouseover", this.onMouseOver, this);
ul.on("mouseout", this.onMouseOut, this);
this.items.each(function(item){
var li = document.createElement("li");
li.className = "x-menu-list-item";
ul.dom.appendChild(li);
item.render(li, this);
}, this);
this.ul = ul;
this.autoWidth();
},
autoWidth : function(){
var el = this.el, ul = this.ul;
if(!el){
return;
}
var w = this.width;
if(w){
el.setWidth(w);
}else if(Ext.isIE){
el.setWidth(this.minWidth);
var t = el.dom.offsetWidth; el.setWidth(ul.getWidth()+el.getFrameWidth("lr"));
}
},
delayAutoWidth : function(){
if(this.el){
if(!this.awTask){
this.awTask = new Ext.util.DelayedTask(this.autoWidth, this);
}
this.awTask.delay(20);
}
},
findTargetItem : function(e){
var t = e.getTarget(".x-menu-list-item", this.ul, true);
if(t && t.menuItemId){
return this.items.get(t.menuItemId);
}
},
onClick : function(e){
var t;
if(t = this.findTargetItem(e)){
t.onClick(e);
this.fireEvent("click", this, t, e);
}
},
setActiveItem : function(item, autoExpand){
if(item != this.activeItem){
if(this.activeItem){
this.activeItem.deactivate();
}
this.activeItem = item;
item.activate(autoExpand);
}else if(autoExpand){
item.expandMenu();
}
},
tryActivate : function(start, step){
var items = this.items;
for(var i = start, len = items.length; i >= 0 && i < len; i+= step){
var item = items.get(i);
if(!item.disabled && item.canActivate){
this.setActiveItem(item, false);
return item;
}
}
return false;
},
onMouseOver : function(e){
var t;
if(t = this.findTargetItem(e)){
if(t.canActivate && !t.disabled){
this.setActiveItem(t, true);
}
}
this.fireEvent("mouseover", this, e, t);
},
onMouseOut : function(e){
var t;
if(t = this.findTargetItem(e)){
if(t == this.activeItem && t.shouldDeactivate(e)){
this.activeItem.deactivate();
delete this.activeItem;
}
}
this.fireEvent("mouseout", this, e, t);
},
isVisible : function(){
return this.el && !this.hidden;
},
show : function(el, pos, parentMenu){
this.parentMenu = parentMenu;
if(!this.el){
this.render();
}
this.fireEvent("beforeshow", this);
this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign), parentMenu, false);
},
showAt : function(xy, parentMenu, _e){
this.parentMenu = parentMenu;
if(!this.el){
this.render();
}
if(_e !== false){
this.fireEvent("beforeshow", this);
xy = this.el.adjustForConstraints(xy);
}
this.el.setXY(xy);
this.el.show();
this.hidden = false;
this.focus();
this.fireEvent("show", this);
},
focus : function(){
if(!this.hidden){
this.doFocus.defer(50, this);
}
},
doFocus : function(){
if(!this.hidden){
this.focusEl.focus();
}
},
hide : function(deep){
if(this.el && this.isVisible()){
this.fireEvent("beforehide", this);
if(this.activeItem){
this.activeItem.deactivate();
this.activeItem = null;
}
this.el.hide();
this.hidden = true;
this.fireEvent("hide", this);
}
if(deep === true && this.parentMenu){
this.parentMenu.hide(true);
}
},
add : function(){
var a = arguments, l = a.length, item;
for(var i = 0; i < l; i++){
var el = a[i];
if(el.render){ item = this.addItem(el);
}else if(typeof el == "string"){ if(el == "separator" || el == "-"){
item = this.addSeparator();
}else{
item = this.addText(el);
}
}else if(el.tagName || el.el){ item = this.addElement(el);
}else if(typeof el == "object"){ Ext.applyIf(el, this.defaults);
item = this.addMenuItem(el);
}
}
return item;
},
getEl : function(){
if(!this.el){
this.render();
}
return this.el;
},
addSeparator : function(){
return this.addItem(new Ext.menu.Separator());
},
addElement : function(el){
return this.addItem(new Ext.menu.BaseItem(el));
},
addItem : function(item){
this.items.add(item);
if(this.ul){
var li = document.createElement("li");
li.className = "x-menu-list-item";
this.ul.dom.appendChild(li);
item.render(li, this);
this.delayAutoWidth();
}
return item;
},
addMenuItem : function(config){
if(!(config instanceof Ext.menu.Item)){
if(typeof config.checked == "boolean"){ config = new Ext.menu.CheckItem(config);
}else{
config = new Ext.menu.Item(config);
}
}
return this.addItem(config);
},
addText : function(text){
return this.addItem(new Ext.menu.TextItem(text));
},
insert : function(index, item){
this.items.insert(index, item);
if(this.ul){
var li = document.createElement("li");
li.className = "x-menu-list-item";
this.ul.dom.insertBefore(li, this.ul.dom.childNodes[index]);
item.render(li, this);
this.delayAutoWidth();
}
return item;
},
remove : function(item){
this.items.removeKey(item.id);
item.destroy();
},
removeAll : function(){
var f;
while(f = this.items.first()){
this.remove(f);
}
},
destroy : function(){
this.beforeDestroy();
Ext.menu.MenuMgr.unregister(this);
if (this.keyNav) {
this.keyNav.disable();
}
this.removeAll();
if (this.ul) {
this.ul.removeAllListeners();
}
if (this.el) {
this.el.destroy();
}
},
beforeDestroy : Ext.emptyFn
});
Ext.menu.MenuNav = function(menu){
Ext.menu.MenuNav.superclass.constructor.call(this, menu.el);
this.scope = this.menu = menu;
};
Ext.extend(Ext.menu.MenuNav, Ext.KeyNav, {
doRelay : function(e, h){
var k = e.getKey();
if(!this.menu.activeItem && e.isNavKeyPress() && k != e.SPACE && k != e.RETURN){
this.menu.tryActivate(0, 1);
return false;
}
return h.call(this.scope || this, e, this.menu);
},
up : function(e, m){
if(!m.tryActivate(m.items.indexOf(m.activeItem)-1, -1)){
m.tryActivate(m.items.length-1, -1);
}
},
down : function(e, m){
if(!m.tryActivate(m.items.indexOf(m.activeItem)+1, 1)){
m.tryActivate(0, 1);
}
},
right : function(e, m){
if(m.activeItem){
m.activeItem.expandMenu(true);
}
},
left : function(e, m){
m.hide();
if(m.parentMenu && m.parentMenu.activeItem){
m.parentMenu.activeItem.activate();
}
},
enter : function(e, m){
if(m.activeItem){
e.stopPropagation();
m.activeItem.onClick(e);
m.fireEvent("click", this, m.activeItem);
return true;
}
}
});
Ext.menu.MenuMgr = function(){
var menus, active, groups = {}, attached = false, lastShow = new Date();
function init(){
menus = {};
active = new Ext.util.MixedCollection();
Ext.getDoc().addKeyListener(27, function(){
if(active.length > 0){
hideAll();
}
});
}
function hideAll(){
if(active && active.length > 0){
var c = active.clone();
c.each(function(m){
m.hide();
});
}
}
function onHide(m){
active.remove(m);
if(active.length < 1){
Ext.getDoc().un("mousedown", onMouseDown);
attached = false;
}
}
function onShow(m){
var last = active.last();
lastShow = new Date();
active.add(m);
if(!attached){
Ext.getDoc().on("mousedown", onMouseDown);
attached = true;
}
if(m.parentMenu){
m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"), 10) + 3);
m.parentMenu.activeChild = m;
}else if(last && last.isVisible()){
m.getEl().setZIndex(parseInt(last.getEl().getStyle("z-index"), 10) + 3);
}
}
function onBeforeHide(m){
if(m.activeChild){
m.activeChild.hide();
}
if(m.autoHideTimer){
clearTimeout(m.autoHideTimer);
delete m.autoHideTimer;
}
}
function onBeforeShow(m){
var pm = m.parentMenu;
if(!pm && !m.allowOtherMenus){
hideAll();
}else if(pm && pm.activeChild){
pm.activeChild.hide();
}
}
function onMouseDown(e){
if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".x-menu")){
hideAll();
}
}
function onBeforeCheck(mi, state){
if(state){
var g = groups[mi.group];
for(var i = 0, l = g.length; i < l; i++){
if(g[i] != mi){
g[i].setChecked(false);
}
}
}
}
return {
hideAll : function(){
hideAll();
},
register : function(menu){
if(!menus){
init();
}
menus[menu.id] = menu;
menu.on("beforehide", onBeforeHide);
menu.on("hide", onHide);
menu.on("beforeshow", onBeforeShow);
menu.on("show", onShow);
var g = menu.group;
if(g && menu.events["checkchange"]){
if(!groups[g]){
groups[g] = [];
}
groups[g].push(menu);
menu.on("checkchange", onCheck);
}
},
get : function(menu){
if(typeof menu == "string"){ if(!menus){ return null;
}
return menus[menu];
}else if(menu.events){ return menu;
}else if(typeof menu.length == 'number'){ return new Ext.menu.Menu({items:menu});
}else{ return new Ext.menu.Menu(menu);
}
},
unregister : function(menu){
delete menus[menu.id];
menu.un("beforehide", onBeforeHide);
menu.un("hide", onHide);
menu.un("beforeshow", onBeforeShow);
menu.un("show", onShow);
var g = menu.group;
if(g && menu.events["checkchange"]){
groups[g].remove(menu);
menu.un("checkchange", onCheck);
}
},
registerCheckable : function(menuItem){
var g = menuItem.group;
if(g){
if(!groups[g]){
groups[g] = [];
}
groups[g].push(menuItem);
menuItem.on("beforecheckchange", onBeforeCheck);
}
},
unregisterCheckable : function(menuItem){
var g = menuItem.group;
if(g){
groups[g].remove(menuItem);
menuItem.un("beforecheckchange", onBeforeCheck);
}
},
getCheckedItem : function(groupId){
var g = groups[groupId];
if(g){
for(var i = 0, l = g.length; i < l; i++){
if(g[i].checked){
return g[i];
}
}
}
return null;
},
setCheckedItem : function(groupId, itemId){
var g = groups[groupId];
if(g){
for(var i = 0, l = g.length; i < l; i++){
if(g[i].id == itemId){
g[i].setChecked(true);
}
}
}
return null;
}
};
}();
Ext.menu.BaseItem = function(config){
Ext.menu.BaseItem.superclass.constructor.call(this, config);
this.addEvents(
'click',
'activate',
'deactivate'
);
if(this.handler){
this.on("click", this.handler, this.scope);
}
};
Ext.extend(Ext.menu.BaseItem, Ext.Component, {
canActivate : false,
activeClass : "x-menu-item-active",
hideOnClick : true,
hideDelay : 100,
ctype: "Ext.menu.BaseItem",
actionMode : "container",
render : function(container, parentMenu){
this.parentMenu = parentMenu;
Ext.menu.BaseItem.superclass.render.call(this, container);
this.container.menuItemId = this.id;
},
onRender : function(container, position){
this.el = Ext.get(this.el);
container.dom.appendChild(this.el.dom);
},
setHandler : function(handler, scope){
if(this.handler){
this.un("click", this.handler, this.scope);
}
this.on("click", this.handler = handler, this.scope = scope);
},
onClick : function(e){
if(!this.disabled && this.fireEvent("click", this, e) !== false
&& this.parentMenu.fireEvent("itemclick", this, e) !== false){
this.handleClick(e);
}else{
e.stopEvent();
}
},
activate : function(){
if(this.disabled){
return false;
}
var li = this.container;
li.addClass(this.activeClass);
this.region = li.getRegion().adjust(2, 2, -2, -2);
this.fireEvent("activate", this);
return true;
},
deactivate : function(){
this.container.removeClass(this.activeClass);
this.fireEvent("deactivate", this);
},
shouldDeactivate : function(e){
return !this.region || !this.region.contains(e.getPoint());
},
handleClick : function(e){
if(this.hideOnClick){
this.parentMenu.hide.defer(this.hideDelay, this.parentMenu, [true]);
}
},
expandMenu : function(autoActivate){
},
hideMenu : function(){
}
});
Ext.menu.TextItem = function(text){
this.text = text;
Ext.menu.TextItem.superclass.constructor.call(this);
};
Ext.extend(Ext.menu.TextItem, Ext.menu.BaseItem, {
hideOnClick : false,
itemCls : "x-menu-text",
onRender : function(){
var s = document.createElement("span");
s.className = this.itemCls;
s.innerHTML = this.text;
this.el = s;
Ext.menu.TextItem.superclass.onRender.apply(this, arguments);
}
});
Ext.menu.Separator = function(config){
Ext.menu.Separator.superclass.constructor.call(this, config);
};
Ext.extend(Ext.menu.Separator, Ext.menu.BaseItem, {
itemCls : "x-menu-sep",
hideOnClick : false,
onRender : function(li){
var s = document.createElement("span");
s.className = this.itemCls;
s.innerHTML = " ";
this.el = s;
li.addClass("x-menu-sep-li");
Ext.menu.Separator.superclass.onRender.apply(this, arguments);
}
});
Ext.menu.Item = function(config){
Ext.menu.Item.superclass.constructor.call(this, config);
if(this.menu){
this.menu = Ext.menu.MenuMgr.get(this.menu);
}
};
Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, {
itemCls : "x-menu-item",
canActivate : true,
showDelay: 200,
hideDelay: 200,
ctype: "Ext.menu.Item",
onRender : function(container, position){
var el = document.createElement("a");
el.hideFocus = true;
el.unselectable = "on";
el.href = this.href || "#";
if(this.hrefTarget){
el.target = this.hrefTarget;
}
el.className = this.itemCls + (this.menu ? " x-menu-item-arrow" : "") + (this.cls ? " " + this.cls : "");
el.innerHTML = String.format(
'<img src="{0}" class="x-menu-item-icon {2}" />{1}',
this.icon || Ext.BLANK_IMAGE_URL, this.itemText||this.text, this.iconCls || '');
this.el = el;
Ext.menu.Item.superclass.onRender.call(this, container, position);
},
setText : function(text){
this.text = text;
if(this.rendered){
this.el.update(String.format(
'<img src="{0}" class="x-menu-item-icon {2}">{1}',
this.icon || Ext.BLANK_IMAGE_URL, this.text, this.iconCls || ''));
this.parentMenu.autoWidth();
}
},
setIconClass : function(cls){
var oldCls = this.iconCls;
this.iconCls = cls;
if(this.rendered){
this.el.child('img.x-menu-item-icon').replaceClass(oldCls, this.iconCls);
}
},
handleClick : function(e){
if(!this.href){ e.stopEvent();
}
Ext.menu.Item.superclass.handleClick.apply(this, arguments);
},
activate : function(autoExpand){
if(Ext.menu.Item.superclass.activate.apply(this, arguments)){
this.focus();
if(autoExpand){
this.expandMenu();
}
}
return true;
},
shouldDeactivate : function(e){
if(Ext.menu.Item.superclass.shouldDeactivate.call(this, e)){
if(this.menu && this.menu.isVisible()){
return !this.menu.getEl().getRegion().contains(e.getPoint());
}
return true;
}
return false;
},
deactivate : function(){
Ext.menu.Item.superclass.deactivate.apply(this, arguments);
this.hideMenu();
},
expandMenu : function(autoActivate){
if(!this.disabled && this.menu){
clearTimeout(this.hideTimer);
delete this.hideTimer;
if(!this.menu.isVisible() && !this.showTimer){
this.showTimer = this.deferExpand.defer(this.showDelay, this, [autoActivate]);
}else if (this.menu.isVisible() && autoActivate){
this.menu.tryActivate(0, 1);
}
}
},
deferExpand : function(autoActivate){
delete this.showTimer;
this.menu.show(this.container, this.parentMenu.subMenuAlign || "tl-tr?", this.parentMenu);
if(autoActivate){
this.menu.tryActivate(0, 1);
}
},
hideMenu : function(){
clearTimeout(this.showTimer);
delete this.showTimer;
if(!this.hideTimer && this.menu && this.menu.isVisible()){
this.hideTimer = this.deferHide.defer(this.hideDelay, this);
}
},
deferHide : function(){
delete this.hideTimer;
this.menu.hide();
}
});
Ext.menu.CheckItem = function(config){
Ext.menu.CheckItem.superclass.constructor.call(this, config);
this.addEvents(
"beforecheckchange" ,
"checkchange"
);
if(this.checkHandler){
this.on('checkchange', this.checkHandler, this.scope);
}
Ext.menu.MenuMgr.registerCheckable(this);
};
Ext.extend(Ext.menu.CheckItem, Ext.menu.Item, {
itemCls : "x-menu-item x-menu-check-item",
groupClass : "x-menu-group-item",
checked: false,
ctype: "Ext.menu.CheckItem",
onRender : function(c){
Ext.menu.CheckItem.superclass.onRender.apply(this, arguments);
if(this.group){
this.el.addClass(this.groupClass);
}
if(this.checked){
this.checked = false;
this.setChecked(true, true);
}
},
destroy : function(){
Ext.menu.MenuMgr.unregisterCheckable(this);
Ext.menu.CheckItem.superclass.destroy.apply(this, arguments);
},
setChecked : function(state, suppressEvent){
if(this.checked != state && this.fireEvent("beforecheckchange", this, state) !== false){
if(this.container){
this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked");
}
this.checked = state;
if(suppressEvent !== true){
this.fireEvent("checkchange", this, state);
}
}
},
handleClick : function(e){
if(!this.disabled && !(this.checked && this.group)){ this.setChecked(!this.checked);
}
Ext.menu.CheckItem.superclass.handleClick.apply(this, arguments);
}
});
Ext.menu.Adapter = function(component, config){
Ext.menu.Adapter.superclass.constructor.call(this, config);
this.component = component;
};
Ext.extend(Ext.menu.Adapter, Ext.menu.BaseItem, {
canActivate : true,
onRender : function(container, position){
this.component.render(container);
this.el = this.component.getEl();
},
activate : function(){
if(this.disabled){
return false;
}
this.component.focus();
this.fireEvent("activate", this);
return true;
},
deactivate : function(){
this.fireEvent("deactivate", this);
},
disable : function(){
this.component.disable();
Ext.menu.Adapter.superclass.disable.call(this);
},
enable : function(){
this.component.enable();
Ext.menu.Adapter.superclass.enable.call(this);
}
});
Ext.menu.DateItem = function(config){
Ext.menu.DateItem.superclass.constructor.call(this, new Ext.DatePicker(config), config);
this.picker = this.component;
this.addEvents('select');
this.picker.on("render", function(picker){
picker.getEl().swallowEvent("click");
picker.container.addClass("x-menu-date-item");
});
this.picker.on("select", this.onSelect, this);
};
Ext.extend(Ext.menu.DateItem, Ext.menu.Adapter, {
onSelect : function(picker, date){
this.fireEvent("select", this, date, picker);
Ext.menu.DateItem.superclass.handleClick.call(this);
}
});
Ext.menu.ColorItem = function(config){
Ext.menu.ColorItem.superclass.constructor.call(this, new Ext.ColorPalette(config), config);
this.palette = this.component;
this.relayEvents(this.palette, ["select"]);
if(this.selectHandler){
this.on('select', this.selectHandler, this.scope);
}
};
Ext.extend(Ext.menu.ColorItem, Ext.menu.Adapter);
Ext.menu.DateMenu = function(config){
Ext.menu.DateMenu.superclass.constructor.call(this, config);
this.plain = true;
var di = new Ext.menu.DateItem(config);
this.add(di);
this.picker = di.picker;
this.relayEvents(di, ["select"]);
this.on('beforeshow', function(){
if(this.picker){
this.picker.hideMonthPicker(true);
}
}, this);
};
Ext.extend(Ext.menu.DateMenu, Ext.menu.Menu, {
cls:'x-date-menu',
beforeDestroy : function() {
this.picker.destroy();
}
});
Ext.menu.ColorMenu = function(config){
Ext.menu.ColorMenu.superclass.constructor.call(this, config);
this.plain = true;
var ci = new Ext.menu.ColorItem(config);
this.add(ci);
this.palette = ci.palette;
this.relayEvents(ci, ["select"]);
};
Ext.extend(Ext.menu.ColorMenu, Ext.menu.Menu);
Ext.form.Field = Ext.extend(Ext.BoxComponent, {
invalidClass : "x-form-invalid",
invalidText : "The value in this field is invalid",
focusClass : "x-form-focus",
validationEvent : "keyup",
validateOnBlur : true,
validationDelay : 250,
defaultAutoCreate : {tag: "input", type: "text", size: "20", autocomplete: "off"},
fieldClass : "x-form-field",
msgTarget : 'qtip',
msgFx : 'normal',
readOnly : false,
disabled : false,
isFormField : true,
hasFocus : false,
initComponent : function(){
Ext.form.Field.superclass.initComponent.call(this);
this.addEvents(
'focus',
'blur',
'specialkey',
'change',
'invalid',
'valid'
);
},
getName: function(){
return this.rendered && this.el.dom.name ? this.el.dom.name : (this.hiddenName || '');
},
onRender : function(ct, position){
Ext.form.Field.superclass.onRender.call(this, ct, position);
if(!this.el){
var cfg = this.getAutoCreate();
if(!cfg.name){
cfg.name = this.name || this.id;
}
if(this.inputType){
cfg.type = this.inputType;
}
this.el = ct.createChild(cfg, position);
}
var type = this.el.dom.type;
if(type){
if(type == 'password'){
type = 'text';
}
this.el.addClass('x-form-'+type);
}
if(this.readOnly){
this.el.dom.readOnly = true;
}
if(this.tabIndex !== undefined){
this.el.dom.setAttribute('tabIndex', this.tabIndex);
}
this.el.addClass([this.fieldClass, this.cls]);
this.initValue();
},
initValue : function(){
if(this.value !== undefined){
this.setValue(this.value);
}else if(this.el.dom.value.length > 0){
this.setValue(this.el.dom.value);
}
},
isDirty : function() {
if(this.disabled) {
return false;
}
return String(this.getValue()) !== String(this.originalValue);
},
afterRender : function(){
Ext.form.Field.superclass.afterRender.call(this);
this.initEvents();
},
fireKey : function(e){
if(e.isSpecialKey()){
this.fireEvent("specialkey", this, e);
}
},
reset : function(){
this.setValue(this.originalValue);
this.clearInvalid();
},
initEvents : function(){
this.el.on(Ext.isIE ? "keydown" : "keypress", this.fireKey, this);
this.el.on("focus", this.onFocus, this);
this.el.on("blur", this.onBlur, this);
this.originalValue = this.getValue();
},
onFocus : function(){
if(!Ext.isOpera && this.focusClass){ this.el.addClass(this.focusClass);
}
if(!this.hasFocus){
this.hasFocus = true;
this.startValue = this.getValue();
this.fireEvent("focus", this);
}
},
beforeBlur : Ext.emptyFn,
onBlur : function(){
this.beforeBlur();
if(!Ext.isOpera && this.focusClass){ this.el.removeClass(this.focusClass);
}
this.hasFocus = false;
if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){
this.validate();
}
var v = this.getValue();
if(String(v) !== String(this.startValue)){
this.fireEvent('change', this, v, this.startValue);
}
this.fireEvent("blur", this);
},
isValid : function(preventMark){
if(this.disabled){
return true;
}
var restore = this.preventMark;
this.preventMark = preventMark === true;
var v = this.validateValue(this.processValue(this.getRawValue()));
this.preventMark = restore;
return v;
},
validate : function(){
if(this.disabled || this.validateValue(this.processValue(this.getRawValue()))){
this.clearInvalid();
return true;
}
return false;
},
processValue : function(value){
return value;
},
validateValue : function(value){
return true;
},
markInvalid : function(msg){
if(!this.rendered || this.preventMark){ return;
}
this.el.addClass(this.invalidClass);
msg = msg || this.invalidText;
switch(this.msgTarget){
case 'qtip':
this.el.dom.qtip = msg;
this.el.dom.qclass = 'x-form-invalid-tip';
if(Ext.QuickTips){ Ext.QuickTips.enable();
}
break;
case 'title':
this.el.dom.title = msg;
break;
case 'under':
if(!this.errorEl){
var elp = this.el.findParent('.x-form-element', 5, true);
this.errorEl = elp.createChild({cls:'x-form-invalid-msg'});
this.errorEl.setWidth(elp.getWidth(true)-20);
}
this.errorEl.update(msg);
Ext.form.Field.msgFx[this.msgFx].show(this.errorEl, this);
break;
case 'side':
if(!this.errorIcon){
var elp = this.el.findParent('.x-form-element', 5, true);
this.errorIcon = elp.createChild({cls:'x-form-invalid-icon'});
}
this.alignErrorIcon();
this.errorIcon.dom.qtip = msg;
this.errorIcon.dom.qclass = 'x-form-invalid-tip';
this.errorIcon.show();
this.on('resize', this.alignErrorIcon, this);
break;
default:
var t = Ext.getDom(this.msgTarget);
t.innerHTML = msg;
t.style.display = this.msgDisplay;
break;
}
this.fireEvent('invalid', this, msg);
},
alignErrorIcon : function(){
this.errorIcon.alignTo(this.el, 'tl-tr', [2, 0]);
},
clearInvalid : function(){
if(!this.rendered || this.preventMark){ return;
}
this.el.removeClass(this.invalidClass);
switch(this.msgTarget){
case 'qtip':
this.el.dom.qtip = '';
break;
case 'title':
this.el.dom.title = '';
break;
case 'under':
if(this.errorEl){
Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl, this);
}
break;
case 'side':
if(this.errorIcon){
this.errorIcon.dom.qtip = '';
this.errorIcon.hide();
this.un('resize', this.alignErrorIcon, this);
}
break;
default:
var t = Ext.getDom(this.msgTarget);
t.innerHTML = '';
t.style.display = 'none';
break;
}
this.fireEvent('valid', this);
},
getRawValue : function(){
var v = this.rendered ? this.el.getValue() : Ext.value(this.value, '');
if(v === this.emptyText){
v = '';
}
return v;
},
getValue : function(){
if(!this.rendered) {
return this.value;
}
var v = this.el.getValue();
if(v === this.emptyText || v === undefined){
v = '';
}
return v;
},
setRawValue : function(v){
return this.el.dom.value = (v === null || v === undefined ? '' : v);
},
setValue : function(v){
this.value = v;
if(this.rendered){
this.el.dom.value = (v === null || v === undefined ? '' : v);
this.validate();
}
},
adjustSize : function(w, h){
var s = Ext.form.Field.superclass.adjustSize.call(this, w, h);
s.width = this.adjustWidth(this.el.dom.tagName, s.width);
return s;
},
adjustWidth : function(tag, w){
tag = tag.toLowerCase();
if(typeof w == 'number' && !Ext.isSafari){
if(Ext.isIE && (tag == 'input' || tag == 'textarea')){
if(tag == 'input' && !Ext.isStrict){
return this.inEditor ? w : w - 3;
}
if(tag == 'input' && Ext.isStrict){
return w - (Ext.isIE6 ? 4 : 1);
}
if(tag = 'textarea' && Ext.isStrict){
return w-2;
}
}else if(Ext.isOpera && Ext.isStrict){
if(tag == 'input'){
return w + 2;
}
if(tag = 'textarea'){
return w-2;
}
}
}
return w;
}
});
Ext.form.Field.msgFx = {
normal : {
show: function(msgEl, f){
msgEl.setDisplayed('block');
},
hide : function(msgEl, f){
msgEl.setDisplayed(false).update('');
}
},
slide : {
show: function(msgEl, f){
msgEl.slideIn('t', {stopFx:true});
},
hide : function(msgEl, f){
msgEl.slideOut('t', {stopFx:true,useDisplay:true});
}
},
slideRight : {
show: function(msgEl, f){
msgEl.fixDisplay();
msgEl.alignTo(f.el, 'tl-tr');
msgEl.slideIn('l', {stopFx:true});
},
hide : function(msgEl, f){
msgEl.slideOut('l', {stopFx:true,useDisplay:true});
}
}
};
Ext.reg('field', Ext.form.Field);
Ext.form.TextField = Ext.extend(Ext.form.Field, {
grow : false,
growMin : 30,
growMax : 800,
vtype : null,
maskRe : null,
disableKeyFilter : false,
allowBlank : true,
minLength : 0,
maxLength : Number.MAX_VALUE,
minLengthText : "The minimum length for this field is {0}",
maxLengthText : "The maximum length for this field is {0}",
selectOnFocus : false,
blankText : "This field is required",
validator : null,
regex : null,
regexText : "",
emptyText : null,
emptyClass : 'x-form-empty-field',
initComponent : function(){
Ext.form.TextField.superclass.initComponent.call(this);
this.addEvents(
'autosize'
);
},
initEvents : function(){
Ext.form.TextField.superclass.initEvents.call(this);
if(this.validationEvent == 'keyup'){
this.validationTask = new Ext.util.DelayedTask(this.validate, this);
this.el.on('keyup', this.filterValidation, this);
}
else if(this.validationEvent !== false){
this.el.on(this.validationEvent, this.validate, this, {buffer: this.validationDelay});
}
if(this.selectOnFocus || this.emptyText){
this.on("focus", this.preFocus, this);
if(this.emptyText){
this.on('blur', this.postBlur, this);
this.applyEmptyText();
}
}
if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Ext.form.VTypes[this.vtype+'Mask']))){
this.el.on("keypress", this.filterKeys, this);
}
if(this.grow){
this.el.on("keyup", this.onKeyUp, this, {buffer:50});
this.el.on("click", this.autoSize, this);
}
},
processValue : function(value){
if(this.stripCharsRe){
var newValue = value.replace(this.stripCharsRe, '');
if(newValue !== value){
this.setRawValue(newValue);
return newValue;
}
}
return value;
},
filterValidation : function(e){
if(!e.isNavKeyPress()){
this.validationTask.delay(this.validationDelay);
}
},
onKeyUp : function(e){
if(!e.isNavKeyPress()){
this.autoSize();
}
},
reset : function(){
Ext.form.TextField.superclass.reset.call(this);
this.applyEmptyText();
},
applyEmptyText : function(){
if(this.rendered && this.emptyText && this.getRawValue().length < 1){
this.setRawValue(this.emptyText);
this.el.addClass(this.emptyClass);
}
},
preFocus : function(){
if(this.emptyText){
if(this.el.dom.value == this.emptyText){
this.setRawValue('');
}
this.el.removeClass(this.emptyClass);
}
if(this.selectOnFocus){
this.el.dom.select();
}
},
postBlur : function(){
this.applyEmptyText();
},
filterKeys : function(e){
var k = e.getKey();
if(!Ext.isIE && (e.isNavKeyPress() || k == e.BACKSPACE || (k == e.DELETE && e.button == -1))){
return;
}
var c = e.getCharCode(), cc = String.fromCharCode(c);
if(Ext.isIE && (e.isSpecialKey() || !cc)){
return;
}
if(!this.maskRe.test(cc)){
e.stopEvent();
}
},
setValue : function(v){
if(this.emptyText && this.el && v !== undefined && v !== null && v !== ''){
this.el.removeClass(this.emptyClass);
}
Ext.form.TextField.superclass.setValue.apply(this, arguments);
this.applyEmptyText();
this.autoSize();
},
validateValue : function(value){
if(value.length < 1 || value === this.emptyText){ if(this.allowBlank){
this.clearInvalid();
return true;
}else{
this.markInvalid(this.blankText);
return false;
}
}
if(value.length < this.minLength){
this.markInvalid(String.format(this.minLengthText, this.minLength));
return false;
}
if(value.length > this.maxLength){
this.markInvalid(String.format(this.maxLengthText, this.maxLength));
return false;
}
if(this.vtype){
var vt = Ext.form.VTypes;
if(!vt[this.vtype](value, this)){
this.markInvalid(this.vtypeText || vt[this.vtype +'Text']);
return false;
}
}
if(typeof this.validator == "function"){
var msg = this.validator(value);
if(msg !== true){
this.markInvalid(msg);
return false;
}
}
if(this.regex && !this.regex.test(value)){
this.markInvalid(this.regexText);
return false;
}
return true;
},
selectText : function(start, end){
var v = this.getRawValue();
if(v.length > 0){
start = start === undefined ? 0 : start;
end = end === undefined ? v.length : end;
var d = this.el.dom;
if(d.setSelectionRange){
d.setSelectionRange(start, end);
}else if(d.createTextRange){
var range = d.createTextRange();
range.moveStart("character", start);
range.moveEnd("character", end-v.length);
range.select();
}
}
},
autoSize : function(){
if(!this.grow || !this.rendered){
return;
}
if(!this.metrics){
this.metrics = Ext.util.TextMetrics.createInstance(this.el);
}
var el = this.el;
var v = el.dom.value;
var d = document.createElement('div');
d.appendChild(document.createTextNode(v));
v = d.innerHTML;
d = null;
v += " ";
var w = Math.min(this.growMax, Math.max(this.metrics.getWidth(v) + 10, this.growMin));
this.el.setWidth(w);
this.fireEvent("autosize", this, w);
}
});
Ext.reg('textfield', Ext.form.TextField);
Ext.form.TriggerField = Ext.extend(Ext.form.TextField, {
defaultAutoCreate : {tag: "input", type: "text", size: "16", autocomplete: "off"},
hideTrigger:false,
autoSize: Ext.emptyFn,
monitorTab : true,
deferHeight : true,
mimicing : false,
onResize : function(w, h){
Ext.form.TriggerField.superclass.onResize.call(this, w, h);
if(typeof w == 'number'){
this.el.setWidth(this.adjustWidth('input', w - this.trigger.getWidth()));
}
this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());
},
adjustSize : Ext.BoxComponent.prototype.adjustSize,
getResizeEl : function(){
return this.wrap;
},
getPositionEl : function(){
return this.wrap;
},
alignErrorIcon : function(){
this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
},
onRender : function(ct, position){
Ext.form.TriggerField.superclass.onRender.call(this, ct, position);
this.wrap = this.el.wrap({cls: "x-form-field-wrap"});
this.trigger = this.wrap.createChild(this.triggerConfig ||
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.triggerClass});
if(this.hideTrigger){
this.trigger.setDisplayed(false);
}
this.initTrigger();
if(!this.width){
this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());
}
},
initTrigger : function(){
this.trigger.on("click", this.onTriggerClick, this, {preventDefault:true});
this.trigger.addClassOnOver('x-form-trigger-over');
this.trigger.addClassOnClick('x-form-trigger-click');
},
onDestroy : function(){
if(this.trigger){
this.trigger.removeAllListeners();
this.trigger.remove();
}
if(this.wrap){
this.wrap.remove();
}
Ext.form.TriggerField.superclass.onDestroy.call(this);
},
onFocus : function(){
Ext.form.TriggerField.superclass.onFocus.call(this);
if(!this.mimicing){
this.wrap.addClass('x-trigger-wrap-focus');
this.mimicing = true;
Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, {delay: 10});
if(this.monitorTab){
this.el.on("keydown", this.checkTab, this);
}
}
},
checkTab : function(e){
if(e.getKey() == e.TAB){
this.triggerBlur();
}
},
onBlur : function(){
},
mimicBlur : function(e){
if(!this.wrap.contains(e.target) && this.validateBlur(e)){
this.triggerBlur();
}
},
triggerBlur : function(){
this.mimicing = false;
Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur);
if(this.monitorTab){
this.el.un("keydown", this.checkTab, this);
}
this.beforeBlur();
this.wrap.removeClass('x-trigger-wrap-focus');
Ext.form.TriggerField.superclass.onBlur.call(this);
},
beforeBlur : Ext.emptyFn,
validateBlur : function(e){
return true;
},
onDisable : function(){
Ext.form.TriggerField.superclass.onDisable.call(this);
if(this.wrap){
this.wrap.addClass('x-item-disabled');
}
},
onEnable : function(){
Ext.form.TriggerField.superclass.onEnable.call(this);
if(this.wrap){
this.wrap.removeClass('x-item-disabled');
}
},
onShow : function(){
if(this.wrap){
this.wrap.dom.style.display = '';
this.wrap.dom.style.visibility = 'visible';
}
},
onHide : function(){
this.wrap.dom.style.display = 'none';
},
onTriggerClick : Ext.emptyFn
});
Ext.form.TwinTriggerField = Ext.extend(Ext.form.TriggerField, {
initComponent : function(){
Ext.form.TwinTriggerField.superclass.initComponent.call(this);
this.triggerConfig = {
tag:'span', cls:'x-form-twin-triggers', cn:[
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger1Class},
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger2Class}
]};
},
getTrigger : function(index){
return this.triggers[index];
},
initTrigger : function(){
var ts = this.trigger.select('.x-form-trigger', true);
this.wrap.setStyle('overflow', 'hidden');
var triggerField = this;
ts.each(function(t, all, index){
t.hide = function(){
var w = triggerField.wrap.getWidth();
this.dom.style.display = 'none';
triggerField.el.setWidth(w-triggerField.trigger.getWidth());
};
t.show = function(){
var w = triggerField.wrap.getWidth();
this.dom.style.display = '';
triggerField.el.setWidth(w-triggerField.trigger.getWidth());
};
var triggerIndex = 'Trigger'+(index+1);
if(this['hide'+triggerIndex]){
t.dom.style.display = 'none';
}
t.on("click", this['on'+triggerIndex+'Click'], this, {preventDefault:true});
t.addClassOnOver('x-form-trigger-over');
t.addClassOnClick('x-form-trigger-click');
}, this);
this.triggers = ts.elements;
},
onTrigger1Click : Ext.emptyFn,
onTrigger2Click : Ext.emptyFn
});
Ext.reg('trigger', Ext.form.TriggerField);
Ext.form.TextArea = Ext.extend(Ext.form.TextField, {
growMin : 60,
growMax: 1000,
growAppend : ' \n ',
growPad : 0,
enterIsSpecial : false,
preventScrollbars: false,
onRender : function(ct, position){
if(!this.el){
this.defaultAutoCreate = {
tag: "textarea",
style:"width:100px;height:60px;",
autocomplete: "off"
};
}
Ext.form.TextArea.superclass.onRender.call(this, ct, position);
if(this.grow){
this.textSizeEl = Ext.DomHelper.append(document.body, {
tag: "pre", cls: "x-form-grow-sizer"
});
if(this.preventScrollbars){
this.el.setStyle("overflow", "hidden");
}
this.el.setHeight(this.growMin);
}
},
onDestroy : function(){
if(this.textSizeEl){
Ext.removeNode(this.textSizeEl);
}
Ext.form.TextArea.superclass.onDestroy.call(this);
},
fireKey : function(e){
if(e.isSpecialKey() && (this.enterIsSpecial || (e.getKey() != e.ENTER || e.hasModifier()))){
this.fireEvent("specialkey", this, e);
}
},
onKeyUp : function(e){
if(!e.isNavKeyPress() || e.getKey() == e.ENTER){
this.autoSize();
}
},
autoSize : function(){
if(!this.grow || !this.textSizeEl){
return;
}
var el = this.el;
var v = el.dom.value;
var ts = this.textSizeEl;
ts.innerHTML = '';
ts.appendChild(document.createTextNode(v));
v = ts.innerHTML;
Ext.fly(ts).setWidth(this.el.getWidth());
if(v.length < 1){
v = "  ";
}else{
if(Ext.isIE){
v = v.replace(/\n/g, '<p> </p>');
}
v += this.growAppend;
}
ts.innerHTML = v;
var h = Math.min(this.growMax, Math.max(ts.offsetHeight, this.growMin)+this.growPad);
if(h != this.lastHeight){
this.lastHeight = h;
this.el.setHeight(h);
this.fireEvent("autosize", this, h);
}
}
});
Ext.reg('textarea', Ext.form.TextArea);
Ext.form.NumberField = Ext.extend(Ext.form.TextField, {
fieldClass: "x-form-field x-form-num-field",
allowDecimals : true,
decimalSeparator : ".",
decimalPrecision : 2,
allowNegative : true,
minValue : Number.NEGATIVE_INFINITY,
maxValue : Number.MAX_VALUE,
minText : "The minimum value for this field is {0}",
maxText : "The maximum value for this field is {0}",
nanText : "{0} is not a valid number",
baseChars : "0123456789",
initEvents : function(){
Ext.form.NumberField.superclass.initEvents.call(this);
var allowed = this.baseChars+'';
if(this.allowDecimals){
allowed += this.decimalSeparator;
}
if(this.allowNegative){
allowed += "-";
}
this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');
var keyPress = function(e){
var k = e.getKey();
if(!Ext.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){
return;
}
var c = e.getCharCode();
if(allowed.indexOf(String.fromCharCode(c)) === -1){
e.stopEvent();
}
};
this.el.on("keypress", keyPress, this);
},
validateValue : function(value){
if(!Ext.form.NumberField.superclass.validateValue.call(this, value)){
return false;
}
if(value.length < 1){ return true;
}
value = String(value).replace(this.decimalSeparator, ".");
if(isNaN(value)){
this.markInvalid(String.format(this.nanText, value));
return false;
}
var num = this.parseValue(value);
if(num < this.minValue){
this.markInvalid(String.format(this.minText, this.minValue));
return false;
}
if(num > this.maxValue){
this.markInvalid(String.format(this.maxText, this.maxValue));
return false;
}
return true;
},
getValue : function(){
return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this)));
},
setValue : function(v){
v = parseFloat(v);
v = isNaN(v) ? '' : String(v).replace(".", this.decimalSeparator);
Ext.form.NumberField.superclass.setValue.call(this, v);
},
parseValue : function(value){
value = parseFloat(String(value).replace(this.decimalSeparator, "."));
return isNaN(value) ? '' : value;
},
fixPrecision : function(value){
var nan = isNaN(value);
if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){
return nan ? '' : value;
}
return parseFloat(parseFloat(value).toFixed(this.decimalPrecision));
},
beforeBlur : function(){
var v = this.parseValue(this.getRawValue());
if(v){
this.setValue(this.fixPrecision(v));
}
}
});
Ext.reg('numberfield', Ext.form.NumberField);
Ext.form.DateField = Ext.extend(Ext.form.TriggerField, {
format : "m/d/y",
altFormats : "m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d",
disabledDays : null,
disabledDaysText : "Disabled",
disabledDates : null,
disabledDatesText : "Disabled",
minValue : null,
maxValue : null,
minText : "The date in this field must be equal to or after {0}",
maxText : "The date in this field must be equal to or before {0}",
invalidText : "{0} is not a valid date - it must be in the format {1}",
triggerClass : 'x-form-date-trigger',
defaultAutoCreate : {tag: "input", type: "text", size: "10", autocomplete: "off"},
initComponent : function(){
Ext.form.DateField.superclass.initComponent.call(this);
if(typeof this.minValue == "string"){
this.minValue = this.parseDate(this.minValue);
}
if(typeof this.maxValue == "string"){
this.maxValue = this.parseDate(this.maxValue);
}
this.ddMatch = null;
if(this.disabledDates){
var dd = this.disabledDates;
var re = "(?:";
for(var i = 0; i < dd.length; i++){
re += dd[i];
if(i != dd.length-1) re += "|";
}
this.ddMatch = new RegExp(re + ")");
}
},
validateValue : function(value){
value = this.formatDate(value);
if(!Ext.form.DateField.superclass.validateValue.call(this, value)){
return false;
}
if(value.length < 1){ return true;
}
var svalue = value;
value = this.parseDate(value);
if(!value){
this.markInvalid(String.format(this.invalidText, svalue, this.format));
return false;
}
var time = value.getTime();
if(this.minValue && time < this.minValue.getTime()){
this.markInvalid(String.format(this.minText, this.formatDate(this.minValue)));
return false;
}
if(this.maxValue && time > this.maxValue.getTime()){
this.markInvalid(String.format(this.maxText, this.formatDate(this.maxValue)));
return false;
}
if(this.disabledDays){
var day = value.getDay();
for(var i = 0; i < this.disabledDays.length; i++) {
if(day === this.disabledDays[i]){
this.markInvalid(this.disabledDaysText);
return false;
}
}
}
var fvalue = this.formatDate(value);
if(this.ddMatch && this.ddMatch.test(fvalue)){
this.markInvalid(String.format(this.disabledDatesText, fvalue));
return false;
}
return true;
},
validateBlur : function(){
return !this.menu || !this.menu.isVisible();
},
getValue : function(){
return this.parseDate(Ext.form.DateField.superclass.getValue.call(this)) || "";
},
setValue : function(date){
Ext.form.DateField.superclass.setValue.call(this, this.formatDate(this.parseDate(date)));
},
parseDate : function(value){
if(!value || Ext.isDate(value)){
return value;
}
var v = Date.parseDate(value, this.format);
if(!v && this.altFormats){
if(!this.altFormatsArray){
this.altFormatsArray = this.altFormats.split("|");
}
for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++){
v = Date.parseDate(value, this.altFormatsArray[i]);
}
}
return v;
},
onDestroy : function(){
if(this.menu) {
this.menu.destroy();
}
if(this.wrap){
this.wrap.remove();
}
Ext.form.DateField.superclass.onDestroy.call(this);
},
formatDate : function(date){
return Ext.isDate(date) ? date.dateFormat(this.format) : date;
},
menuListeners : {
select: function(m, d){
this.setValue(d);
},
show : function(){ this.onFocus();
},
hide : function(){
this.focus.defer(10, this);
var ml = this.menuListeners;
this.menu.un("select", ml.select, this);
this.menu.un("show", ml.show, this);
this.menu.un("hide", ml.hide, this);
}
},
onTriggerClick : function(){
if(this.disabled){
return;
}
if(this.menu == null){
this.menu = new Ext.menu.DateMenu();
}
Ext.apply(this.menu.picker, {
minDate : this.minValue,
maxDate : this.maxValue,
disabledDatesRE : this.ddMatch,
disabledDatesText : this.disabledDatesText,
disabledDays : this.disabledDays,
disabledDaysText : this.disabledDaysText,
format : this.format,
minText : String.format(this.minText, this.formatDate(this.minValue)),
maxText : String.format(this.maxText, this.formatDate(this.maxValue))
});
this.menu.on(Ext.apply({}, this.menuListeners, {
scope:this
}));
this.menu.picker.setValue(this.getValue() || new Date());
this.menu.show(this.el, "tl-bl?");
},
beforeBlur : function(){
var v = this.parseDate(this.getRawValue());
if(v){
this.setValue(v);
}
}
});
Ext.reg('datefield', Ext.form.DateField);
Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, {
defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"},
listClass: '',
selectedClass: 'x-combo-selected',
triggerClass : 'x-form-arrow-trigger',
shadow:'sides',
listAlign: 'tl-bl?',
maxHeight: 300,
minHeight: 90,
triggerAction: 'query',
minChars : 4,
typeAhead: false,
queryDelay: 500,
pageSize: 0,
selectOnFocus:false,
queryParam: 'query',
loadingText: 'Loading...',
resizable: false,
handleHeight : 8,
editable: true,
allQuery: '',
mode: 'remote',
minListWidth : 70,
forceSelection:false,
typeAheadDelay : 250,
lazyInit : true,
initComponent : function(){
Ext.form.ComboBox.superclass.initComponent.call(this);
this.addEvents(
'expand',
'collapse',
'beforeselect',
'select',
'beforequery'
);
if(this.transform){
this.allowDomMove = false;
var s = Ext.getDom(this.transform);
if(!this.hiddenName){
this.hiddenName = s.name;
}
if(!this.store){
this.mode = 'local';
var d = [], opts = s.options;
for(var i = 0, len = opts.length;i < len; i++){
var o = opts[i];
var value = (Ext.isIE ? o.getAttributeNode('value').specified : o.hasAttribute('value')) ? o.value : o.text;
if(o.selected) {
this.value = value;
}
d.push([value, o.text]);
}
this.store = new Ext.data.SimpleStore({
'id': 0,
fields: ['value', 'text'],
data : d
});
this.valueField = 'value';
this.displayField = 'text';
}
s.name = Ext.id(); if(!this.lazyRender){
this.target = true;
this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate);
Ext.removeNode(s); this.render(this.el.parentNode);
}else{
Ext.removeNode(s); }
}
this.selectedIndex = -1;
if(this.mode == 'local'){
if(this.initialConfig.queryDelay === undefined){
this.queryDelay = 10;
}
if(this.initialConfig.minChars === undefined){
this.minChars = 0;
}
}
},
onRender : function(ct, position){
Ext.form.ComboBox.superclass.onRender.call(this, ct, position);
if(this.hiddenName){
this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName, id: (this.hiddenId||this.hiddenName)},
'before', true);
this.hiddenField.value =
this.hiddenValue !== undefined ? this.hiddenValue :
this.value !== undefined ? this.value : '';
this.el.dom.removeAttribute('name');
}
if(Ext.isGecko){
this.el.dom.setAttribute('autocomplete', 'off');
}
if(!this.lazyInit){
this.initList();
}else{
this.on('focus', this.initList, this, {single: true});
}
if(!this.editable){
this.editable = true;
this.setEditable(false);
}
},
initList : function(){
if(!this.list){
var cls = 'x-combo-list';
this.list = new Ext.Layer({
shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
});
var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
this.list.setWidth(lw);
this.list.swallowEvent('mousewheel');
this.assetHeight = 0;
if(this.title){
this.header = this.list.createChild({cls:cls+'-hd', html: this.title});
this.assetHeight += this.header.getHeight();
}
this.innerList = this.list.createChild({cls:cls+'-inner'});
this.innerList.on('mouseover', this.onViewOver, this);
this.innerList.on('mousemove', this.onViewMove, this);
this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
if(this.pageSize){
this.footer = this.list.createChild({cls:cls+'-ft'});
this.pageTb = new Ext.PagingToolbar({
store:this.store,
pageSize: this.pageSize,
renderTo:this.footer
});
this.assetHeight += this.footer.getHeight();
}
if(!this.tpl){
this.tpl = '<tpl for="."><div class="'+cls+'-item">{' + this.displayField + '}</div></tpl>';
}
this.view = new Ext.DataView({
applyTo: this.innerList,
tpl: this.tpl,
singleSelect: true,
selectedClass: this.selectedClass,
itemSelector: this.itemSelector || '.' + cls + '-item'
});
this.view.on('click', this.onViewClick, this);
this.bindStore(this.store, true);
if(this.resizable){
this.resizer = new Ext.Resizable(this.list, {
pinned:true, handles:'se'
});
this.resizer.on('resize', function(r, w, h){
this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;
this.listWidth = w;
this.innerList.setWidth(w - this.list.getFrameWidth('lr'));
this.restrictHeight();
}, this);
this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px');
}
}
},
bindStore : function(store, initial){
if(this.store && !initial){
this.store.un('beforeload', this.onBeforeLoad, this);
this.store.un('load', this.onLoad, this);
this.store.un('loadexception', this.collapse, this);
if(!store){
this.store = null;
if(this.view){
this.view.setStore(null);
}
}
}
if(store){
this.store = Ext.StoreMgr.lookup(store);
this.store.on('beforeload', this.onBeforeLoad, this);
this.store.on('load', this.onLoad, this);
this.store.on('loadexception', this.collapse, this);
if(this.view){
this.view.setStore(store);
}
}
},
initEvents : function(){
Ext.form.ComboBox.superclass.initEvents.call(this);
this.keyNav = new Ext.KeyNav(this.el, {
"up" : function(e){
this.inKeyMode = true;
this.selectPrev();
},
"down" : function(e){
if(!this.isExpanded()){
this.onTriggerClick();
}else{
this.inKeyMode = true;
this.selectNext();
}
},
"enter" : function(e){
this.onViewClick();
this.delayedCheck = true;
this.unsetDelayCheck.defer(10, this);
},
"esc" : function(e){
this.collapse();
},
"tab" : function(e){
this.onViewClick(false);
return true;
},
scope : this,
doRelay : function(foo, bar, hname){
if(hname == 'down' || this.scope.isExpanded()){
return Ext.KeyNav.prototype.doRelay.apply(this, arguments);
}
return true;
},
forceKeyDown : true
});
this.queryDelay = Math.max(this.queryDelay || 10,
this.mode == 'local' ? 10 : 250);
this.dqTask = new Ext.util.DelayedTask(this.initQuery, this);
if(this.typeAhead){
this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this);
}
if(this.editable !== false){
this.el.on("keyup", this.onKeyUp, this);
}
if(this.forceSelection){
this.on('blur', this.doForce, this);
}
},
onDestroy : function(){
if(this.view){
this.view.el.removeAllListeners();
this.view.el.remove();
this.view.purgeListeners();
}
if(this.list){
this.list.destroy();
}
this.bindStore(null);
Ext.form.ComboBox.superclass.onDestroy.call(this);
},
unsetDelayCheck : function(){
delete this.delayedCheck;
},
fireKey : function(e){
if(e.isNavKeyPress() && !this.isExpanded() && !this.delayedCheck){
this.fireEvent("specialkey", this, e);
}
},
onResize: function(w, h){
Ext.form.ComboBox.superclass.onResize.apply(this, arguments);
if(this.list && this.listWidth === undefined){
var lw = Math.max(w, this.minListWidth);
this.list.setWidth(lw);
this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
}
},
onEnable: function(){
Ext.form.ComboBox.superclass.onEnable.apply(this, arguments);
if(this.hiddenField){
this.hiddenField.disabled = false;
}
},
onDisable: function(){
Ext.form.ComboBox.superclass.onDisable.apply(this, arguments);
if(this.hiddenField){
this.hiddenField.disabled = true;
}
},
setEditable : function(value){
if(value == this.editable){
return;
}
this.editable = value;
if(!value){
this.el.dom.setAttribute('readOnly', true);
this.el.on('mousedown', this.onTriggerClick, this);
this.el.addClass('x-combo-noedit');
}else{
this.el.dom.setAttribute('readOnly', false);
this.el.un('mousedown', this.onTriggerClick, this);
this.el.removeClass('x-combo-noedit');
}
},
onBeforeLoad : function(){
if(!this.hasFocus){
return;
}
this.innerList.update(this.loadingText ?
'<div class="loading-indicator">'+this.loadingText+'</div>' : '');
this.restrictHeight();
this.selectedIndex = -1;
},
onLoad : function(){
if(!this.hasFocus){
return;
}
if(this.store.getCount() > 0){
this.expand();
this.restrictHeight();
if(this.lastQuery == this.allQuery){
if(this.editable){
this.el.dom.select();
}
if(!this.selectByValue(this.value, true)){
this.select(0, true);
}
}else{
this.selectNext();
if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){
this.taTask.delay(this.typeAheadDelay);
}
}
}else{
this.onEmptyResults();
}
},
onTypeAhead : function(){
if(this.store.getCount() > 0){
var r = this.store.getAt(0);
var newValue = r.data[this.displayField];
var len = newValue.length;
var selStart = this.getRawValue().length;
if(selStart != len){
this.setRawValue(newValue);
this.selectText(selStart, newValue.length);
}
}
},
onSelect : function(record, index){
if(this.fireEvent('beforeselect', this, record, index) !== false){
this.setValue(record.data[this.valueField || this.displayField]);
this.collapse();
this.fireEvent('select', this, record, index);
}
},
getValue : function(){
if(this.valueField){
return typeof this.value != 'undefined' ? this.value : '';
}else{
return Ext.form.ComboBox.superclass.getValue.call(this);
}
},
clearValue : function(){
if(this.hiddenField){
this.hiddenField.value = '';
}
this.setRawValue('');
this.lastSelectionText = '';
this.applyEmptyText();
this.value = '';
},
setValue : function(v){
var text = v;
if(this.valueField){
var r = this.findRecord(this.valueField, v);
if(r){
text = r.data[this.displayField];
}else if(this.valueNotFoundText !== undefined){
text = this.valueNotFoundText;
}
}
this.lastSelectionText = text;
if(this.hiddenField){
this.hiddenField.value = v;
}
Ext.form.ComboBox.superclass.setValue.call(this, text);
this.value = v;
},
findRecord : function(prop, value){
var record;
if(this.store.getCount() > 0){
this.store.each(function(r){
if(r.data[prop] == value){
record = r;
return false;
}
});
}
return record;
},
onViewMove : function(e, t){
this.inKeyMode = false;
},
onViewOver : function(e, t){
if(this.inKeyMode){ return;
}
var item = this.view.findItemFromChild(t);
if(item){
var index = this.view.indexOf(item);
this.select(index, false);
}
},
onViewClick : function(doFocus){
var index = this.view.getSelectedIndexes()[0];
var r = this.store.getAt(index);
if(r){
this.onSelect(r, index);
}
if(doFocus !== false){
this.el.focus();
}
},
restrictHeight : function(){
this.innerList.dom.style.height = '';
var inner = this.innerList.dom;
var pad = this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight;
var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);
var ha = this.getPosition()[1]-Ext.getBody().getScroll().top;
var hb = Ext.lib.Dom.getViewHeight()-ha-this.getSize().height;
var space = Math.max(ha, hb, this.minHeight || 0)-this.list.shadow.offset-pad-2;
h = Math.min(h, space, this.maxHeight);
this.innerList.setHeight(h);
this.list.beginUpdate();
this.list.setHeight(h+pad);
this.list.alignTo(this.el, this.listAlign);
this.list.endUpdate();
},
onEmptyResults : function(){
this.collapse();
},
isExpanded : function(){
return this.list && this.list.isVisible();
},
selectByValue : function(v, scrollIntoView){
if(v !== undefined && v !== null){
var r = this.findRecord(this.valueField || this.displayField, v);
if(r){
this.select(this.store.indexOf(r), scrollIntoView);
return true;
}
}
return false;
},
select : function(index, scrollIntoView){
this.selectedIndex = index;
this.view.select(index);
if(scrollIntoView !== false){
var el = this.view.getNode(index);
if(el){
this.innerList.scrollChildIntoView(el, false);
}
}
},
selectNext : function(){
var ct = this.store.getCount();
if(ct > 0){
if(this.selectedIndex == -1){
this.select(0);
}else if(this.selectedIndex < ct-1){
this.select(this.selectedIndex+1);
}
}
},
selectPrev : function(){
var ct = this.store.getCount();
if(ct > 0){
if(this.selectedIndex == -1){
this.select(0);
}else if(this.selectedIndex != 0){
this.select(this.selectedIndex-1);
}
}
},
onKeyUp : function(e){
if(this.editable !== false && !e.isSpecialKey()){
this.lastKey = e.getKey();
this.dqTask.delay(this.queryDelay);
}
},
validateBlur : function(){
return !this.list || !this.list.isVisible();
},
initQuery : function(){
this.doQuery(this.getRawValue());
},
doForce : function(){
if(this.el.dom.value.length > 0){
this.el.dom.value =
this.lastSelectionText === undefined ? '' : this.lastSelectionText;
this.applyEmptyText();
}
},
doQuery : function(q, forceAll){
if(q === undefined || q === null){
q = '';
}
var qe = {
query: q,
forceAll: forceAll,
combo: this,
cancel:false
};
if(this.fireEvent('beforequery', qe)===false || qe.cancel){
return false;
}
q = qe.query;
forceAll = qe.forceAll;
if(forceAll === true || (q.length >= this.minChars)){
if(this.lastQuery !== q){
this.lastQuery = q;
if(this.mode == 'local'){
this.selectedIndex = -1;
if(forceAll){
this.store.clearFilter();
}else{
this.store.filter(this.displayField, q);
}
this.onLoad();
}else{
this.store.baseParams[this.queryParam] = q;
this.store.load({
params: this.getParams(q)
});
this.expand();
}
}else{
this.selectedIndex = -1;
this.onLoad();
}
}
},
getParams : function(q){
var p = {};
if(this.pageSize){
p.start = 0;
p.limit = this.pageSize;
}
return p;
},
collapse : function(){
if(!this.isExpanded()){
return;
}
this.list.hide();
Ext.getDoc().un('mousewheel', this.collapseIf, this);
Ext.getDoc().un('mousedown', this.collapseIf, this);
this.fireEvent('collapse', this);
},
collapseIf : function(e){
if(!e.within(this.wrap) && !e.within(this.list)){
this.collapse();
}
},
expand : function(){
if(this.isExpanded() || !this.hasFocus){
return;
}
this.list.alignTo(this.wrap, this.listAlign);
this.list.show();
this.innerList.setOverflow('auto'); Ext.getDoc().on('mousewheel', this.collapseIf, this);
Ext.getDoc().on('mousedown', this.collapseIf, this);
this.fireEvent('expand', this);
},
onTriggerClick : function(){
if(this.disabled){
return;
}
if(this.isExpanded()){
this.collapse();
this.el.focus();
}else {
this.onFocus({});
if(this.triggerAction == 'all') {
this.doQuery(this.allQuery, true);
} else {
this.doQuery(this.getRawValue());
}
this.el.focus();
}
}
});
Ext.reg('combo', Ext.form.ComboBox);
Ext.form.Checkbox = Ext.extend(Ext.form.Field, {
focusClass : undefined,
fieldClass: "x-form-field",
checked: false,
defaultAutoCreate : { tag: "input", type: 'checkbox', autocomplete: "off"},
initComponent : function(){
Ext.form.Checkbox.superclass.initComponent.call(this);
this.addEvents(
'check'
);
},
onResize : function(){
Ext.form.Checkbox.superclass.onResize.apply(this, arguments);
if(!this.boxLabel){
this.el.alignTo(this.wrap, 'c-c');
}
},
initEvents : function(){
Ext.form.Checkbox.superclass.initEvents.call(this);
this.el.on("click", this.onClick, this);
this.el.on("change", this.onClick, this);
},
getResizeEl : function(){
return this.wrap;
},
getPositionEl : function(){
return this.wrap;
},
markInvalid : Ext.emptyFn,
clearInvalid : Ext.emptyFn,
onRender : function(ct, position){
Ext.form.Checkbox.superclass.onRender.call(this, ct, position);
if(this.inputValue !== undefined){
this.el.dom.value = this.inputValue;
}
this.wrap = this.el.wrap({cls: "x-form-check-wrap"});
if(this.boxLabel){
this.wrap.createChild({tag: 'label', htmlFor: this.el.id, cls: 'x-form-cb-label', html: this.boxLabel});
}
if(this.checked){
this.setValue(true);
}else{
this.checked = this.el.dom.checked;
}
},
onDestroy : function(){
if(this.wrap){
this.wrap.remove();
}
Ext.form.Checkbox.superclass.onDestroy.call(this);
},
initValue : Ext.emptyFn,
getValue : function(){
if(this.rendered){
return this.el.dom.checked;
}
return false;
},
onClick : function(){
if(this.el.dom.checked != this.checked){
this.setValue(this.el.dom.checked);
}
},
setValue : function(v){
this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
if(this.el && this.el.dom){
this.el.dom.checked = this.checked;
this.el.dom.defaultChecked = this.checked;
}
this.fireEvent("check", this, this.checked);
}
});
Ext.reg('checkbox', Ext.form.Checkbox);
Ext.form.Radio = Ext.extend(Ext.form.Checkbox, {
inputType: 'radio',
markInvalid : Ext.emptyFn,
clearInvalid : Ext.emptyFn,
getGroupValue : function(){
var p = this.el.up('form') || Ext.getBody();
var c = p.child('input[name='+this.el.dom.name+']:checked', true);
return c ? c.value : null;
},
onClick : function(){
if(this.el.dom.checked != this.checked){
var p = this.el.up('form') || Ext.getBody();
var els = p.select('input[name='+this.el.dom.name+']');
els.each(function(el){
if(el.dom.id == this.id){
this.setValue(true);
}else{
Ext.getCmp(el.dom.id).setValue(false);
}
}, this);
}
},
setValue : function(v){
if (typeof v == 'boolean') {
Ext.form.Radio.superclass.setValue.call(this, v);
} else {
var r = this.el.up('form').child('input[name='+this.el.dom.name+'][value='+v+']', true);
if (r){
r.checked = true;
};
}
}
});
Ext.reg('radio', Ext.form.Radio);
Ext.form.Hidden = Ext.extend(Ext.form.Field, {
inputType : 'hidden',
onRender : function(){
Ext.form.Hidden.superclass.onRender.apply(this, arguments);
},
initEvents : function(){
this.originalValue = this.getValue();
},
setSize : Ext.emptyFn,
setWidth : Ext.emptyFn,
setHeight : Ext.emptyFn,
setPosition : Ext.emptyFn,
setPagePosition : Ext.emptyFn,
markInvalid : Ext.emptyFn,
clearInvalid : Ext.emptyFn
});
Ext.reg('hidden', Ext.form.Hidden);
Ext.form.BasicForm = function(el, config){
Ext.apply(this, config);
this.items = new Ext.util.MixedCollection(false, function(o){
return o.id || (o.id = Ext.id());
});
this.addEvents(
'beforeaction',
'actionfailed',
'actioncomplete'
);
if(el){
this.initEl(el);
}
Ext.form.BasicForm.superclass.constructor.call(this);
};
Ext.extend(Ext.form.BasicForm, Ext.util.Observable, {
timeout: 30,
activeAction : null,
trackResetOnLoad : false,
initEl : function(el){
this.el = Ext.get(el);
this.id = this.el.id || Ext.id();
if(!this.standardSubmit){
this.el.on('submit', this.onSubmit, this);
}
this.el.addClass('x-form');
},
getEl: function(){
return this.el;
},
onSubmit : function(e){
e.stopEvent();
},
destroy: function() {
this.items.each(function(f){
Ext.destroy(f);
});
if(this.el){
this.el.removeAllListeners();
this.el.remove();
}
this.purgeListeners();
},
isValid : function(){
var valid = true;
this.items.each(function(f){
if(!f.validate()){
valid = false;
}
});
return valid;
},
isDirty : function(){
var dirty = false;
this.items.each(function(f){
if(f.isDirty()){
dirty = true;
return false;
}
});
return dirty;
},
doAction : function(action, options){
if(typeof action == 'string'){
action = new Ext.form.Action.ACTION_TYPES[action](this, options);
}
if(this.fireEvent('beforeaction', this, action) !== false){
this.beforeAction(action);
action.run.defer(100, action);
}
return this;
},
submit : function(options){
if(this.standardSubmit){
var v = this.isValid();
if(v){
this.el.dom.submit();
}
return v;
}
this.doAction('submit', options);
return this;
},
load : function(options){
this.doAction('load', options);
return this;
},
updateRecord : function(record){
record.beginEdit();
var fs = record.fields;
fs.each(function(f){
var field = this.findField(f.name);
if(field){
record.set(f.name, field.getValue());
}
}, this);
record.endEdit();
return this;
},
loadRecord : function(record){
this.setValues(record.data);
return this;
},
beforeAction : function(action){
var o = action.options;
if(o.waitMsg){
if(this.waitMsgTarget === true){
this.el.mask(o.waitMsg, 'x-mask-loading');
}else if(this.waitMsgTarget){
this.waitMsgTarget = Ext.get(this.waitMsgTarget);
this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading');
}else{
Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle || 'Please Wait...');
}
}
},
afterAction : function(action, success){
this.activeAction = null;
var o = action.options;
if(o.waitMsg){
if(this.waitMsgTarget === true){
this.el.unmask();
}else if(this.waitMsgTarget){
this.waitMsgTarget.unmask();
}else{
Ext.MessageBox.updateProgress(1);
Ext.MessageBox.hide();
}
}
if(success){
if(o.reset){
this.reset();
}
Ext.callback(o.success, o.scope, [this, action]);
this.fireEvent('actioncomplete', this, action);
}else{
Ext.callback(o.failure, o.scope, [this, action]);
this.fireEvent('actionfailed', this, action);
}
},
findField : function(id){
var field = this.items.get(id);
if(!field){
this.items.each(function(f){
if(f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)){
field = f;
return false;
}
});
}
return field || null;
},
markInvalid : function(errors){
if(Ext.isArray(errors)){
for(var i = 0, len = errors.length; i < len; i++){
var fieldError = errors[i];
var f = this.findField(fieldError.id);
if(f){
f.markInvalid(fieldError.msg);
}
}
}else{
var field, id;
for(id in errors){
if(typeof errors[id] != 'function' && (field = this.findField(id))){
field.markInvalid(errors[id]);
}
}
}
return this;
},
setValues : function(values){
if(Ext.isArray(values)){ for(var i = 0, len = values.length; i < len; i++){
var v = values[i];
var f = this.findField(v.id);
if(f){
f.setValue(v.value);
if(this.trackResetOnLoad){
f.originalValue = f.getValue();
}
}
}
}else{ var field, id;
for(id in values){
if(typeof values[id] != 'function' && (field = this.findField(id))){
field.setValue(values[id]);
if(this.trackResetOnLoad){
field.originalValue = field.getValue();
}
}
}
}
return this;
},
getValues : function(asString){
var fs = Ext.lib.Ajax.serializeForm(this.el.dom);
if(asString === true){
return fs;
}
return Ext.urlDecode(fs);
},
clearInvalid : function(){
this.items.each(function(f){
f.clearInvalid();
});
return this;
},
reset : function(){
this.items.each(function(f){
f.reset();
});
return this;
},
add : function(){
this.items.addAll(Array.prototype.slice.call(arguments, 0));
return this;
},
remove : function(field){
this.items.remove(field);
return this;
},
render : function(){
this.items.each(function(f){
if(f.isFormField && !f.rendered && document.getElementById(f.id)){ f.applyToMarkup(f.id);
}
});
return this;
},
applyToFields : function(o){
this.items.each(function(f){
Ext.apply(f, o);
});
return this;
},
applyIfToFields : function(o){
this.items.each(function(f){
Ext.applyIf(f, o);
});
return this;
}
});
Ext.BasicForm = Ext.form.BasicForm;
Ext.FormPanel = Ext.extend(Ext.Panel, {
buttonAlign:'center',
minButtonWidth:75,
labelAlign:'left',
monitorValid : false,
monitorPoll : 200,
layout: 'form',
initComponent :function(){
this.form = this.createForm();
Ext.FormPanel.superclass.initComponent.call(this);
this.addEvents(
'clientvalidation'
);
this.relayEvents(this.form, ['beforeaction', 'actionfailed', 'actioncomplete']);
},
createForm: function(){
delete this.initialConfig.listeners;
return new Ext.form.BasicForm(null, this.initialConfig);
},
initFields : function(){
var f = this.form;
var formPanel = this;
var fn = function(c){
if(c.doLayout && c != formPanel){
Ext.applyIf(c, {
labelAlign: c.ownerCt.labelAlign,
labelWidth: c.ownerCt.labelWidth,
itemCls: c.ownerCt.itemCls
});
if(c.items){
c.items.each(fn);
}
}else if(c.isFormField){
f.add(c);
}
}
this.items.each(fn);
},
getLayoutTarget : function(){
return this.form.el;
},
getForm : function(){
return this.form;
},
onRender : function(ct, position){
this.initFields();
Ext.FormPanel.superclass.onRender.call(this, ct, position);
var o = {
tag: 'form',
method : this.method || 'POST',
id : this.formId || Ext.id()
};
if(this.fileUpload) {
o.enctype = 'multipart/form-data';
}
this.form.initEl(this.body.createChild(o));
},
beforeDestroy: function(){
Ext.FormPanel.superclass.beforeDestroy.call(this);
Ext.destroy(this.form);
},
initEvents : function(){
Ext.FormPanel.superclass.initEvents.call(this);
this.items.on('remove', this.onRemove, this);
this.items.on('add', this.onAdd, this);
if(this.monitorValid){ this.startMonitoring();
}
},
onAdd : function(ct, c) {
if (c.isFormField) {
this.form.add(c);
}
},
onRemove : function(c) {
if (c.isFormField) {
Ext.destroy(c.container.up('.x-form-item'));
this.form.remove(c);
}
},
startMonitoring : function(){
if(!this.bound){
this.bound = true;
Ext.TaskMgr.start({
run : this.bindHandler,
interval : this.monitorPoll || 200,
scope: this
});
}
},
stopMonitoring : function(){
this.bound = false;
},
load : function(){
this.form.load.apply(this.form, arguments);
},
onDisable : function(){
Ext.FormPanel.superclass.onDisable.call(this);
if(this.form){
this.form.items.each(function(){
this.disable();
});
}
},
onEnable : function(){
Ext.FormPanel.superclass.onEnable.call(this);
if(this.form){
this.form.items.each(function(){
this.enable();
});
}
},
bindHandler : function(){
if(!this.bound){
return false; }
var valid = true;
this.form.items.each(function(f){
if(!f.isValid(true)){
valid = false;
return false;
}
});
if(this.buttons){
for(var i = 0, len = this.buttons.length; i < len; i++){
var btn = this.buttons[i];
if(btn.formBind === true && btn.disabled === valid){
btn.setDisabled(!valid);
}
}
}
this.fireEvent('clientvalidation', this, valid);
}
});
Ext.reg('form', Ext.FormPanel);
Ext.form.FormPanel = Ext.FormPanel;
Ext.form.FieldSet = Ext.extend(Ext.Panel, {
baseCls:'x-fieldset',
layout: 'form',
onRender : function(ct, position){
if(!this.el){
this.el = document.createElement('fieldset');
this.el.id = this.id;
if (this.title || this.header || this.checkboxToggle) {
this.el.appendChild(document.createElement('legend')).className = 'x-fieldset-header';
}
}
Ext.form.FieldSet.superclass.onRender.call(this, ct, position);
if(this.checkboxToggle){
var o = typeof this.checkboxToggle == 'object' ?
this.checkboxToggle :
{tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'};
this.checkbox = this.header.insertFirst(o);
this.checkbox.dom.checked = !this.collapsed;
this.checkbox.on('click', this.onCheckClick, this);
}
},
onCollapse : function(doAnim, animArg){
if(this.checkbox){
this.checkbox.dom.checked = false;
}
this.afterCollapse();
},
onExpand : function(doAnim, animArg){
if(this.checkbox){
this.checkbox.dom.checked = true;
}
this.afterExpand();
},
onCheckClick : function(){
this[this.checkbox.dom.checked ? 'expand' : 'collapse']();
}
});
Ext.reg('fieldset', Ext.form.FieldSet);
Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, {
enableFormat : true,
enableFontSize : true,
enableColors : true,
enableAlignments : true,
enableLists : true,
enableSourceEdit : true,
enableLinks : true,
enableFont : true,
createLinkText : 'Please enter the URL for the link:',
defaultLinkValue : 'http:/'+'/',
fontFamilies : [
'Arial',
'Courier New',
'Tahoma',
'Times New Roman',
'Verdana'
],
defaultFont: 'tahoma',
validationEvent : false,
deferHeight: true,
initialized : false,
activated : false,
sourceEditMode : false,
onFocus : Ext.emptyFn,
iframePad:3,
hideMode:'offsets',
defaultAutoCreate : {
tag: "textarea",
style:"width:500px;height:300px;",
autocomplete: "off"
},
initComponent : function(){
this.addEvents(
'initialize',
'activate',
'beforesync',
'beforepush',
'sync',
'push',
'editmodechange'
)
},
createFontOptions : function(){
var buf = [], fs = this.fontFamilies, ff, lc;
for(var i = 0, len = fs.length; i< len; i++){
ff = fs[i];
lc = ff.toLowerCase();
buf.push(
'<option value="',lc,'" style="font-family:',ff,';"',
(this.defaultFont == lc ? ' selected="true">' : '>'),
ff,
'</option>'
);
}
return buf.join('');
},
createToolbar : function(editor){
function btn(id, toggle, handler){
return {
itemId : id,
cls : 'x-btn-icon x-edit-'+id,
enableToggle:toggle !== false,
scope: editor,
handler:handler||editor.relayBtnCmd,
clickEvent:'mousedown',
tooltip: editor.buttonTips[id] || undefined,
tabIndex:-1
};
}
var tb = new Ext.Toolbar({
renderTo:this.wrap.dom.firstChild
});
tb.el.on('click', function(e){
e.preventDefault();
});
if(this.enableFont && !Ext.isSafari){
this.fontSelect = tb.el.createChild({
tag:'select',
cls:'x-font-select',
html: this.createFontOptions()
});
this.fontSelect.on('change', function(){
var font = this.fontSelect.dom.value;
this.relayCmd('fontname', font);
this.deferFocus();
}, this);
tb.add(
this.fontSelect.dom,
'-'
);
};
if(this.enableFormat){
tb.add(
btn('bold'),
btn('italic'),
btn('underline')
);
};
if(this.enableFontSize){
tb.add(
'-',
btn('increasefontsize', false, this.adjustFont),
btn('decreasefontsize', false, this.adjustFont)
);
};
if(this.enableColors){
tb.add(
'-', {
itemId:'forecolor',
cls:'x-btn-icon x-edit-forecolor',
clickEvent:'mousedown',
tooltip: editor.buttonTips['forecolor'] || undefined,
tabIndex:-1,
menu : new Ext.menu.ColorMenu({
allowReselect: true,
focus: Ext.emptyFn,
value:'000000',
plain:true,
selectHandler: function(cp, color){
this.execCmd('forecolor', Ext.isSafari || Ext.isIE ? '#'+color : color);
this.deferFocus();
},
scope: this,
clickEvent:'mousedown'
})
}, {
itemId:'backcolor',
cls:'x-btn-icon x-edit-backcolor',
clickEvent:'mousedown',
tooltip: editor.buttonTips['backcolor'] || undefined,
tabIndex:-1,
menu : new Ext.menu.ColorMenu({
focus: Ext.emptyFn,
value:'FFFFFF',
plain:true,
allowReselect: true,
selectHandler: function(cp, color){
if(Ext.isGecko){
this.execCmd('useCSS', false);
this.execCmd('hilitecolor', color);
this.execCmd('useCSS', true);
this.deferFocus();
}else{
this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isSafari || Ext.isIE ? '#'+color : color);
this.deferFocus();
}
},
scope:this,
clickEvent:'mousedown'
})
}
);
};
if(this.enableAlignments){
tb.add(
'-',
btn('justifyleft'),
btn('justifycenter'),
btn('justifyright')
);
};
if(!Ext.isSafari){
if(this.enableLinks){
tb.add(
'-',
btn('createlink', false, this.createLink)
);
};
if(this.enableLists){
tb.add(
'-',
btn('insertorderedlist'),
btn('insertunorderedlist')
);
}
if(this.enableSourceEdit){
tb.add(
'-',
btn('sourceedit', true, function(btn){
this.toggleSourceEdit(btn.pressed);
})
);
}
}
this.tb = tb;
},
getDocMarkup : function(){
return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';
},
getEditorBody : function(){
return this.doc.body || this.doc.documentElement;
},
onRender : function(ct, position){
Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position);
this.el.dom.style.border = '0 none';
this.el.dom.setAttribute('tabIndex', -1);
this.el.addClass('x-hidden');
if(Ext.isIE){
this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')
}
this.wrap = this.el.wrap({
cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'}
});
this.createToolbar(this);
this.tb.items.each(function(item){
if(item.itemId != 'sourceedit'){
item.disable();
}
});
var iframe = document.createElement('iframe');
iframe.name = Ext.id();
iframe.frameBorder = 'no';
iframe.src=(Ext.SSL_SECURE_URL || "javascript:false");
this.wrap.dom.appendChild(iframe);
this.iframe = iframe;
if(Ext.isIE){
iframe.contentWindow.document.designMode = 'on';
this.doc = iframe.contentWindow.document;
this.win = iframe.contentWindow;
} else {
this.doc = (iframe.contentDocument || window.frames[iframe.name].document);
this.win = window.frames[iframe.name];
this.doc.designMode = 'on';
}
this.doc.open();
this.doc.write(this.getDocMarkup())
this.doc.close();
var task = {
run : function(){
if(this.doc.body || this.doc.readyState == 'complete'){
Ext.TaskMgr.stop(task);
this.doc.designMode="on";
this.initEditor.defer(10, this);
}
},
interval : 10,
duration:10000,
scope: this
};
Ext.TaskMgr.start(task);
if(!this.width){
this.setSize(this.el.getSize());
}
},
onResize : function(w, h){
Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);
if(this.el && this.iframe){
if(typeof w == 'number'){
var aw = w - this.wrap.getFrameWidth('lr');
this.el.setWidth(this.adjustWidth('textarea', aw));
this.iframe.style.width = aw + 'px';
}
if(typeof h == 'number'){
var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();
this.el.setHeight(this.adjustWidth('textarea', ah));
this.iframe.style.height = ah + 'px';
if(this.doc){
this.getEditorBody().style.height = (ah - (this.iframePad*2)) + 'px';
}
}
}
},
toggleSourceEdit : function(sourceEditMode){
if(sourceEditMode === undefined){
sourceEditMode = !this.sourceEditMode;
}
this.sourceEditMode = sourceEditMode === true;
var btn = this.tb.items.get('sourceedit');
if(btn.pressed !== this.sourceEditMode){
btn.toggle(this.sourceEditMode);
return;
}
if(this.sourceEditMode){
this.tb.items.each(function(item){
if(item.itemId != 'sourceedit'){
item.disable();
}
});
this.syncValue();
this.iframe.className = 'x-hidden';
this.el.removeClass('x-hidden');
this.el.dom.removeAttribute('tabIndex');
this.el.focus();
}else{
if(this.initialized){
this.tb.items.each(function(item){
item.enable();
});
}
this.pushValue();
this.iframe.className = '';
this.el.addClass('x-hidden');
this.el.dom.setAttribute('tabIndex', -1);
this.deferFocus();
}
var lastSize = this.lastSize;
if(lastSize){
delete this.lastSize;
this.setSize(lastSize);
}
this.fireEvent('editmodechange', this, this.sourceEditMode);
},
createLink : function(){
var url = prompt(this.createLinkText, this.defaultLinkValue);
if(url && url != 'http:/'+'/'){
this.relayCmd('createlink', url);
}
},
adjustSize : Ext.BoxComponent.prototype.adjustSize,
getResizeEl : function(){
return this.wrap;
},
getPositionEl : function(){
return this.wrap;
},
initEvents : function(){
this.originalValue = this.getValue();
},
markInvalid : Ext.emptyFn,
clearInvalid : Ext.emptyFn,
setValue : function(v){
Ext.form.HtmlEditor.superclass.setValue.call(this, v);
this.pushValue();
},
cleanHtml : function(html){
html = String(html);
if(html.length > 5){
if(Ext.isSafari){
html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');
}
}
if(html == ' '){
html = '';
}
return html;
},
syncValue : function(){
if(this.initialized){
var bd = this.getEditorBody();
var html = bd.innerHTML;
if(Ext.isSafari){
var bs = bd.getAttribute('style');
var m = bs.match(/text-align:(.*?);/i);
if(m && m[1]){
html = '<div style="'+m[0]+'">' + html + '</div>';
}
}
html = this.cleanHtml(html);
if(this.fireEvent('beforesync', this, html) !== false){
this.el.dom.value = html;
this.fireEvent('sync', this, html);
}
}
},
pushValue : function(){
if(this.initialized){
var v = this.el.dom.value;
if(!this.activated && v.length < 1){
v = ' ';
}
if(this.fireEvent('beforepush', this, v) !== false){
this.getEditorBody().innerHTML = v;
this.fireEvent('push', this, v);
}
}
},
deferFocus : function(){
this.focus.defer(10, this);
},
focus : function(){
if(this.win && !this.sourceEditMode){
this.win.focus();
}else{
this.el.focus();
}
},
initEditor : function(){
var dbody = this.getEditorBody();
var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat');
ss['background-attachment'] = 'fixed';
dbody.bgProperties = 'fixed';
Ext.DomHelper.applyStyles(dbody, ss);
Ext.EventManager.on(this.doc, {
'mousedown': this.onEditorEvent,
'dblclick': this.onEditorEvent,
'click': this.onEditorEvent,
'keyup': this.onEditorEvent,
buffer:100,
scope: this
});
if(Ext.isGecko){
Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this);
}
if(Ext.isIE || Ext.isSafari || Ext.isOpera){
Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this);
}
this.initialized = true;
this.fireEvent('initialize', this);
this.pushValue();
},
onDestroy : function(){
if(this.rendered){
this.tb.items.each(function(item){
if(item.menu){
item.menu.removeAll();
if(item.menu.el){
item.menu.el.destroy();
}
}
item.destroy();
});
this.wrap.dom.innerHTML = '';
this.wrap.remove();
}
},
onFirstFocus : function(){
this.activated = true;
this.tb.items.each(function(item){
item.enable();
});
if(Ext.isGecko){
this.win.focus();
var s = this.win.getSelection();
if(!s.focusNode || s.focusNode.nodeType != 3){
var r = s.getRangeAt(0);
r.selectNodeContents(this.getEditorBody());
r.collapse(true);
this.deferFocus();
}
try{
this.execCmd('useCSS', true);
this.execCmd('styleWithCSS', false);
}catch(e){}
}
this.fireEvent('activate', this);
},
adjustFont: function(btn){
var adjust = btn.itemId == 'increasefontsize' ? 1 : -1;
var v = parseInt(this.doc.queryCommandValue('FontSize') || 2, 10);
if(Ext.isSafari3 || Ext.isAir){
if(v <= 10){
v = 1 + adjust;
}else if(v <= 13){
v = 2 + adjust;
}else if(v <= 16){
v = 3 + adjust;
}else if(v <= 18){
v = 4 + adjust;
}else if(v <= 24){
v = 5 + adjust;
}else {
v = 6 + adjust;
}
v = v.constrain(1, 6);
}else{
if(Ext.isSafari){
adjust *= 2;
}
v = Math.max(1, v+adjust) + (Ext.isSafari ? 'px' : 0);
}
this.execCmd('FontSize', v);
},
onEditorEvent : function(e){
this.updateToolbar();
},
updateToolbar: function(){
if(!this.activated){
this.onFirstFocus();
return;
}
var btns = this.tb.items.map, doc = this.doc;
if(this.enableFont && !Ext.isSafari){
var name = (this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase();
if(name != this.fontSelect.dom.value){
this.fontSelect.dom.value = name;
}
}
if(this.enableFormat){
btns.bold.toggle(doc.queryCommandState('bold'));
btns.italic.toggle(doc.queryCommandState('italic'));
btns.underline.toggle(doc.queryCommandState('underline'));
}
if(this.enableAlignments){
btns.justifyleft.toggle(doc.queryCommandState('justifyleft'));
btns.justifycenter.toggle(doc.queryCommandState('justifycenter'));
btns.justifyright.toggle(doc.queryCommandState('justifyright'));
}
if(!Ext.isSafari && this.enableLists){
btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist'));
btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist'));
}
Ext.menu.MenuMgr.hideAll();
this.syncValue();
},
relayBtnCmd : function(btn){
this.relayCmd(btn.itemId);
},
relayCmd : function(cmd, value){
this.win.focus();
this.execCmd(cmd, value);
this.updateToolbar();
this.deferFocus();
},
execCmd : function(cmd, value){
this.doc.execCommand(cmd, false, value === undefined ? null : value);
this.syncValue();
},
applyCommand : function(e){
if(e.ctrlKey){
var c = e.getCharCode(), cmd;
if(c > 0){
c = String.fromCharCode(c);
switch(c){
case 'b':
cmd = 'bold';
break;
case 'i':
cmd = 'italic';
break;
case 'u':
cmd = 'underline';
break;
}
if(cmd){
this.win.focus();
this.execCmd(cmd);
this.deferFocus();
e.preventDefault();
}
}
}
},
insertAtCursor : function(text){
if(!this.activated){
return;
}
if(Ext.isIE){
this.win.focus();
var r = this.doc.selection.createRange();
if(r){
r.collapse(true);
r.pasteHTML(text);
this.syncValue();
this.deferFocus();
}
}else if(Ext.isGecko || Ext.isOpera){
this.win.focus();
this.execCmd('InsertHTML', text);
this.deferFocus();
}else if(Ext.isSafari){
this.execCmd('InsertText', text);
this.deferFocus();
}
},
fixKeys : function(){
if(Ext.isIE){
return function(e){
var k = e.getKey(), r;
if(k == e.TAB){
e.stopEvent();
r = this.doc.selection.createRange();
if(r){
r.collapse(true);
r.pasteHTML(' ');
this.deferFocus();
}
}else if(k == e.ENTER){
r = this.doc.selection.createRange();
if(r){
var target = r.parentElement();
if(!target || target.tagName.toLowerCase() != 'li'){
e.stopEvent();
r.pasteHTML('<br />');
r.collapse(false);
r.select();
}
}
}
};
}else if(Ext.isOpera){
return function(e){
var k = e.getKey();
if(k == e.TAB){
e.stopEvent();
this.win.focus();
this.execCmd('InsertHTML',' ');
this.deferFocus();
}
};
}else if(Ext.isSafari){
return function(e){
var k = e.getKey();
if(k == e.TAB){
e.stopEvent();
this.execCmd('InsertText','\t');
this.deferFocus();
}
};
}
}(),
getToolbar : function(){
return this.tb;
},
buttonTips : {
bold : {
title: 'Bold (Ctrl+B)',
text: 'Make the selected text bold.',
cls: 'x-html-editor-tip'
},
italic : {
title: 'Italic (Ctrl+I)',
text: 'Make the selected text italic.',
cls: 'x-html-editor-tip'
},
underline : {
title: 'Underline (Ctrl+U)',
text: 'Underline the selected text.',
cls: 'x-html-editor-tip'
},
increasefontsize : {
title: 'Grow Text',
text: 'Increase the font size.',
cls: 'x-html-editor-tip'
},
decreasefontsize : {
title: 'Shrink Text',
text: 'Decrease the font size.',
cls: 'x-html-editor-tip'
},
backcolor : {
title: 'Text Highlight Color',
text: 'Change the background color of the selected text.',
cls: 'x-html-editor-tip'
},
forecolor : {
title: 'Font Color',
text: 'Change the color of the selected text.',
cls: 'x-html-editor-tip'
},
justifyleft : {
title: 'Align Text Left',
text: 'Align text to the left.',
cls: 'x-html-editor-tip'
},
justifycenter : {
title: 'Center Text',
text: 'Center text in the editor.',
cls: 'x-html-editor-tip'
},
justifyright : {
title: 'Align Text Right',
text: 'Align text to the right.',
cls: 'x-html-editor-tip'
},
insertunorderedlist : {
title: 'Bullet List',
text: 'Start a bulleted list.',
cls: 'x-html-editor-tip'
},
insertorderedlist : {
title: 'Numbered List',
text: 'Start a numbered list.',
cls: 'x-html-editor-tip'
},
createlink : {
title: 'Hyperlink',
text: 'Make the selected text a hyperlink.',
cls: 'x-html-editor-tip'
},
sourceedit : {
title: 'Source Edit',
text: 'Switch to source editing mode.',
cls: 'x-html-editor-tip'
}
}
});
Ext.reg('htmleditor', Ext.form.HtmlEditor);
Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, {
minValue : null,
maxValue : null,
minText : "The time in this field must be equal to or after {0}",
maxText : "The time in this field must be equal to or before {0}",
invalidText : "{0} is not a valid time",
format : "g:i A",
altFormats : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H",
increment: 15,
mode: 'local',
triggerAction: 'all',
typeAhead: false,
initComponent : function(){
Ext.form.TimeField.superclass.initComponent.call(this);
if(typeof this.minValue == "string"){
this.minValue = this.parseDate(this.minValue);
}
if(typeof this.maxValue == "string"){
this.maxValue = this.parseDate(this.maxValue);
}
if(!this.store){
var min = this.parseDate(this.minValue);
if(!min){
min = new Date().clearTime();
}
var max = this.parseDate(this.maxValue);
if(!max){
max = new Date().clearTime().add('mi', (24 * 60) - 1);
}
var times = [];
while(min <= max){
times.push([min.dateFormat(this.format)]);
min = min.add('mi', this.increment);
}
this.store = new Ext.data.SimpleStore({
fields: ['text'],
data : times
});
this.displayField = 'text';
}
},
getValue : function(){
var v = Ext.form.TimeField.superclass.getValue.call(this);
return this.formatDate(this.parseDate(v)) || '';
},
setValue : function(value){
Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value)));
},
validateValue : Ext.form.DateField.prototype.validateValue,
parseDate : Ext.form.DateField.prototype.parseDate,
formatDate : Ext.form.DateField.prototype.formatDate,
beforeBlur : function(){
var v = this.parseDate(this.getRawValue());
if(v){
this.setValue(v.dateFormat(this.format));
}
}
});
Ext.reg('timefield', Ext.form.TimeField);
Ext.form.Label = Ext.extend(Ext.BoxComponent, {
onRender : function(ct, position){
if(!this.el){
this.el = document.createElement('label');
this.el.innerHTML = this.text ? Ext.util.Format.htmlEncode(this.text) : (this.html || '');
if(this.forId){
this.el.setAttribute('htmlFor', this.forId);
}
}
Ext.form.Label.superclass.onRender.call(this, ct, position);
}
});
Ext.reg('label', Ext.form.Label);
Ext.form.Action = function(form, options){
this.form = form;
this.options = options || {};
};
Ext.form.Action.CLIENT_INVALID = 'client';
Ext.form.Action.SERVER_INVALID = 'server';
Ext.form.Action.CONNECT_FAILURE = 'connect';
Ext.form.Action.LOAD_FAILURE = 'load';
Ext.form.Action.prototype = {
type : 'default',
run : function(options){
},
success : function(response){
},
handleResponse : function(response){
},
failure : function(response){
this.response = response;
this.failureType = Ext.form.Action.CONNECT_FAILURE;
this.form.afterAction(this, false);
},
processResponse : function(response){
this.response = response;
if(!response.responseText){
return true;
}
this.result = this.handleResponse(response);
return this.result;
},
getUrl : function(appendParams){
var url = this.options.url || this.form.url || this.form.el.dom.action;
if(appendParams){
var p = this.getParams();
if(p){
url += (url.indexOf('?') != -1 ? '&' : '?') + p;
}
}
return url;
},
getMethod : function(){
return (this.options.method || this.form.method || this.form.el.dom.method || 'POST').toUpperCase();
},
getParams : function(){
var bp = this.form.baseParams;
var p = this.options.params;
if(p){
if(typeof p == "object"){
p = Ext.urlEncode(Ext.applyIf(p, bp));
}else if(typeof p == 'string' && bp){
p += '&' + Ext.urlEncode(bp);
}
}else if(bp){
p = Ext.urlEncode(bp);
}
return p;
},
createCallback : function(opts){
var opts = opts || {};
return {
success: this.success,
failure: this.failure,
scope: this,
timeout: (opts.timeout*1000) || (this.form.timeout*1000),
upload: this.form.fileUpload ? this.success : undefined
};
}
};
Ext.form.Action.Submit = function(form, options){
Ext.form.Action.Submit.superclass.constructor.call(this, form, options);
};
Ext.extend(Ext.form.Action.Submit, Ext.form.Action, {
type : 'submit',
run : function(){
var o = this.options;
var method = this.getMethod();
var isPost = method == 'POST';
if(o.clientValidation === false || this.form.isValid()){
Ext.Ajax.request(Ext.apply(this.createCallback(o), {
form:this.form.el.dom,
url:this.getUrl(!isPost),
method: method,
params:isPost ? this.getParams() : null,
isUpload: this.form.fileUpload
}));
}else if (o.clientValidation !== false){ this.failureType = Ext.form.Action.CLIENT_INVALID;
this.form.afterAction(this, false);
}
},
success : function(response){
var result = this.processResponse(response);
if(result === true || result.success){
this.form.afterAction(this, true);
return;
}
if(result.errors){
this.form.markInvalid(result.errors);
this.failureType = Ext.form.Action.SERVER_INVALID;
}
this.form.afterAction(this, false);
},
handleResponse : function(response){
if(this.form.errorReader){
var rs = this.form.errorReader.read(response);
var errors = [];
if(rs.records){
for(var i = 0, len = rs.records.length; i < len; i++) {
var r = rs.records[i];
errors[i] = r.data;
}
}
if(errors.length < 1){
errors = null;
}
return {
success : rs.success,
errors : errors
};
}
return Ext.decode(response.responseText);
}
});
Ext.form.Action.Load = function(form, options){
Ext.form.Action.Load.superclass.constructor.call(this, form, options);
this.reader = this.form.reader;
};
Ext.extend(Ext.form.Action.Load, Ext.form.Action, {
type : 'load',
run : function(){
Ext.Ajax.request(Ext.apply(
this.createCallback(this.options), {
method:this.getMethod(),
url:this.getUrl(false),
params:this.getParams()
}));
},
success : function(response){
var result = this.processResponse(response);
if(result === true || !result.success || !result.data){
this.failureType = Ext.form.Action.LOAD_FAILURE;
this.form.afterAction(this, false);
return;
}
this.form.clearInvalid();
this.form.setValues(result.data);
this.form.afterAction(this, true);
},
handleResponse : function(response){
if(this.form.reader){
var rs = this.form.reader.read(response);
var data = rs.records && rs.records[0] ? rs.records[0].data : null;
return {
success : rs.success,
data : data
};
}
return Ext.decode(response.responseText);
}
});
Ext.form.Action.ACTION_TYPES = {
'load' : Ext.form.Action.Load,
'submit' : Ext.form.Action.Submit
};
Ext.form.VTypes = function(){
var alpha = /^[a-zA-Z_]+$/;
var alphanum = /^[a-zA-Z0-9_]+$/;
var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;
var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
return {
'email' : function(v){
return email.test(v);
},
'emailText' : 'This field should be an e-mail address in the format "user@domain.com"',
'emailMask' : /[a-z0-9_\.\-@]/i,
'url' : function(v){
return url.test(v);
},
'urlText' : 'This field should be a URL in the format "http:/'+'/www.domain.com"',
'alpha' : function(v){
return alpha.test(v);
},
'alphaText' : 'This field should only contain letters and _',
'alphaMask' : /[a-z_]/i,
'alphanum' : function(v){
return alphanum.test(v);
},
'alphanumText' : 'This field should only contain letters, numbers and _',
'alphanumMask' : /[a-z0-9_]/i
};
}();
Ext.grid.GridPanel = Ext.extend(Ext.Panel, {
ddText : "{0} selected row{1}",
minColumnWidth : 25,
trackMouseOver : true,
enableDragDrop : false,
enableColumnMove : true,
enableColumnHide : true,
enableHdMenu : true,
stripeRows : false,
autoExpandColumn : false,
autoExpandMin : 50,
autoExpandMax : 1000,
view : null,
loadMask : false,
rendered : false,
viewReady: false,
stateEvents: ["columnmove", "columnresize", "sortchange"],
initComponent : function(){
Ext.grid.GridPanel.superclass.initComponent.call(this);
this.autoScroll = false;
this.autoWidth = false;
if(Ext.isArray(this.columns)){
this.colModel = new Ext.grid.ColumnModel(this.columns);
delete this.columns;
}
if(this.ds){
this.store = this.ds;
delete this.ds;
}
if(this.cm){
this.colModel = this.cm;
delete this.cm;
}
if(this.sm){
this.selModel = this.sm;
delete this.sm;
}
this.store = Ext.StoreMgr.lookup(this.store);
this.addEvents(
"click",
"dblclick",
"contextmenu",
"mousedown",
"mouseup",
"mouseover",
"mouseout",
"keypress",
"keydown",
"cellmousedown",
"rowmousedown",
"headermousedown",
"cellclick",
"celldblclick",
"rowclick",
"rowdblclick",
"headerclick",
"headerdblclick",
"rowcontextmenu",
"cellcontextmenu",
"headercontextmenu",
"bodyscroll",
"columnresize",
"columnmove",
"sortchange"
);
},
onRender : function(ct, position){
Ext.grid.GridPanel.superclass.onRender.apply(this, arguments);
var c = this.body;
this.el.addClass('x-grid-panel');
var view = this.getView();
view.init(this);
c.on("mousedown", this.onMouseDown, this);
c.on("click", this.onClick, this);
c.on("dblclick", this.onDblClick, this);
c.on("contextmenu", this.onContextMenu, this);
c.on("keydown", this.onKeyDown, this);
this.relayEvents(c, ["mousedown","mouseup","mouseover","mouseout","keypress"]);
this.getSelectionModel().init(this);
this.view.render();
},
initEvents : function(){
Ext.grid.GridPanel.superclass.initEvents.call(this);
if(this.loadMask){
this.loadMask = new Ext.LoadMask(this.bwrap,
Ext.apply({store:this.store}, this.loadMask));
}
},
initStateEvents : function(){
Ext.grid.GridPanel.superclass.initStateEvents.call(this);
this.colModel.on('hiddenchange', this.saveState, this, {delay: 100});
},
applyState : function(state){
var cm = this.colModel;
var cs = state.columns;
if(cs){
for(var i = 0, len = cs.length; i < len; i++){
var s = cs[i];
var c = cm.getColumnById(s.id);
if(c){
c.hidden = s.hidden;
c.width = s.width;
var oldIndex = cm.getIndexById(s.id);
if(oldIndex != i){
cm.moveColumn(oldIndex, i);
}
}
}
}
if(state.sort){
this.store[this.store.remoteSort ? 'setDefaultSort' : 'sort'](state.sort.field, state.sort.direction);
}
},
getState : function(){
var o = {columns: []};
for(var i = 0, c; c = this.colModel.config[i]; i++){
o.columns[i] = {
id: c.id,
width: c.width
};
if(c.hidden){
o.columns[i].hidden = true;
}
}
var ss = this.store.getSortState();
if(ss){
o.sort = ss;
}
return o;
},
afterRender : function(){
Ext.grid.GridPanel.superclass.afterRender.call(this);
this.view.layout();
this.viewReady = true;
},
reconfigure : function(store, colModel){
if(this.loadMask){
this.loadMask.destroy();
this.loadMask = new Ext.LoadMask(this.bwrap,
Ext.apply({store:store}, this.initialConfig.loadMask));
}
this.view.bind(store, colModel);
this.store = store;
this.colModel = colModel;
if(this.rendered){
this.view.refresh(true);
}
},
onKeyDown : function(e){
this.fireEvent("keydown", e);
},
onDestroy : function(){
if(this.rendered){
if(this.loadMask){
this.loadMask.destroy();
}
var c = this.body;
c.removeAllListeners();
this.view.destroy();
c.update("");
}
this.colModel.purgeListeners();
Ext.grid.GridPanel.superclass.onDestroy.call(this);
},
processEvent : function(name, e){
this.fireEvent(name, e);
var t = e.getTarget();
var v = this.view;
var header = v.findHeaderIndex(t);
if(header !== false){
this.fireEvent("header" + name, this, header, e);
}else{
var row = v.findRowIndex(t);
var cell = v.findCellIndex(t);
if(row !== false){
this.fireEvent("row" + name, this, row, e);
if(cell !== false){
this.fireEvent("cell" + name, this, row, cell, e);
}
}
}
},
onClick : function(e){
this.processEvent("click", e);
},
onMouseDown : function(e){
this.processEvent("mousedown", e);
},
onContextMenu : function(e, t){
this.processEvent("contextmenu", e);
},
onDblClick : function(e){
this.processEvent("dblclick", e);
},
walkCells : function(row, col, step, fn, scope){
var cm = this.colModel, clen = cm.getColumnCount();
var ds = this.store, rlen = ds.getCount(), first = true;
if(step < 0){
if(col < 0){
row--;
first = false;
}
while(row >= 0){
if(!first){
col = clen-1;
}
first = false;
while(col >= 0){
if(fn.call(scope || this, row, col, cm) === true){
return [row, col];
}
col--;
}
row--;
}
} else {
if(col >= clen){
row++;
first = false;
}
while(row < rlen){
if(!first){
col = 0;
}
first = false;
while(col < clen){
if(fn.call(scope || this, row, col, cm) === true){
return [row, col];
}
col++;
}
row++;
}
}
return null;
},
getSelections : function(){
return this.selModel.getSelections();
},
onResize : function(){
Ext.grid.GridPanel.superclass.onResize.apply(this, arguments);
if(this.viewReady){
this.view.layout();
}
},
getGridEl : function(){
return this.body;
},
stopEditing : function(){},
getSelectionModel : function(){
if(!this.selModel){
this.selModel = new Ext.grid.RowSelectionModel(
this.disableSelection ? {selectRow: Ext.emptyFn} : null);
}
return this.selModel;
},
getStore : function(){
return this.store;
},
getColumnModel : function(){
return this.colModel;
},
getView : function(){
if(!this.view){
this.view = new Ext.grid.GridView(this.viewConfig);
}
return this.view;
},
getDragDropText : function(){
var count = this.selModel.getCount();
return String.format(this.ddText, count, count == 1 ? '' : 's');
}
});
Ext.reg('grid', Ext.grid.GridPanel);
Ext.grid.GridView = function(config){
Ext.apply(this, config);
this.addEvents(
"beforerowremoved",
"beforerowsinserted",
"beforerefresh",
"rowremoved",
"rowsinserted",
"rowupdated",
"refresh"
);
Ext.grid.GridView.superclass.constructor.call(this);
};
Ext.extend(Ext.grid.GridView, Ext.util.Observable, {
scrollOffset: 19,
autoFill: false,
forceFit: false,
sortClasses : ["sort-asc", "sort-desc"],
sortAscText : "Sort Ascending",
sortDescText : "Sort Descending",
columnsText : "Columns",
borderWidth: 2,
initTemplates : function(){
var ts = this.templates || {};
if(!ts.master){
ts.master = new Ext.Template(
'<div class="x-grid3" hidefocus="true">',
'<div class="x-grid3-viewport">',
'<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>',
'<div class="x-grid3-scroller"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',
"</div>",
'<div class="x-grid3-resize-marker"> </div>',
'<div class="x-grid3-resize-proxy"> </div>',
"</div>"
);
}
if(!ts.header){
ts.header = new Ext.Template(
'<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
'<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>',
"</table>"
);
}
if(!ts.hcell){
ts.hcell = new Ext.Template(
'<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',
'{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',
"</div></td>"
);
}
if(!ts.body){
ts.body = new Ext.Template('{rows}');
}
if(!ts.row){
ts.row = new Ext.Template(
'<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
'<tbody><tr>{cells}</tr>',
(this.enableRowBody ? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>' : ''),
'</tbody></table></div>'
);
}
if(!ts.cell){
ts.cell = new Ext.Template(
'<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>',
'<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>',
"</td>"
);
}
for(var k in ts){
var t = ts[k];
if(t && typeof t.compile == 'function' && !t.compiled){
t.disableFormats = true;
t.compile();
}
}
this.templates = ts;
this.tdClass = 'x-grid3-cell';
this.cellSelector = 'td.x-grid3-cell';
this.hdCls = 'x-grid3-hd';
this.rowSelector = 'div.x-grid3-row';
this.colRe = new RegExp("x-grid3-td-([^\\s]+)", "");
},
fly : function(el){
if(!this._flyweight){
this._flyweight = new Ext.Element.Flyweight(document.body);
}
this._flyweight.dom = el;
return this._flyweight;
},
getEditorParent : function(ed){
return this.scroller.dom;
},
initElements : function(){
var E = Ext.Element;
var el = this.grid.getGridEl().dom.firstChild;
var cs = el.childNodes;
this.el = new E(el);
this.mainWrap = new E(cs[0]);
this.mainHd = new E(this.mainWrap.dom.firstChild);
if(this.grid.hideHeaders){
this.mainHd.setDisplayed(false);
}
this.innerHd = this.mainHd.dom.firstChild;
this.scroller = new E(this.mainWrap.dom.childNodes[1]);
if(this.forceFit){
this.scroller.setStyle('overflow-x', 'hidden');
}
this.mainBody = new E(this.scroller.dom.firstChild);
this.focusEl = new E(this.scroller.dom.childNodes[1]);
this.focusEl.swallowEvent("click", true);
this.resizeMarker = new E(cs[1]);
this.resizeProxy = new E(cs[2]);
},
getRows : function(){
return this.hasRows() ? this.mainBody.dom.childNodes : [];
},
findCell : function(el){
if(!el){
return false;
}
return this.fly(el).findParent(this.cellSelector, 3);
},
findCellIndex : function(el, requiredCls){
var cell = this.findCell(el);
if(cell && (!requiredCls || this.fly(cell).hasClass(requiredCls))){
return this.getCellIndex(cell);
}
return false;
},
getCellIndex : function(el){
if(el){
var m = el.className.match(this.colRe);
if(m && m[1]){
return this.cm.getIndexById(m[1]);
}
}
return false;
},
findHeaderCell : function(el){
var cell = this.findCell(el);
return cell && this.fly(cell).hasClass(this.hdCls) ? cell : null;
},
findHeaderIndex : function(el){
return this.findCellIndex(el, this.hdCls);
},
findRow : function(el){
if(!el){
return false;
}
return this.fly(el).findParent(this.rowSelector, 10);
},
findRowIndex : function(el){
var r = this.findRow(el);
return r ? r.rowIndex : false;
},
getRow : function(row){
return this.getRows()[row];
},
getCell : function(row, col){
return this.getRow(row).getElementsByTagName('td')[col];
},
getHeaderCell : function(index){
return this.mainHd.dom.getElementsByTagName('td')[index];
},
addRowClass : function(row, cls){
var r = this.getRow(row);
if(r){
this.fly(r).addClass(cls);
}
},
removeRowClass : function(row, cls){
var r = this.getRow(row);
if(r){
this.fly(r).removeClass(cls);
}
},
removeRow : function(row){
Ext.removeNode(this.getRow(row));
},
removeRows : function(firstRow, lastRow){
var bd = this.mainBody.dom;
for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
Ext.removeNode(bd.childNodes[firstRow]);
}
},
getScrollState : function(){
var sb = this.scroller.dom;
return {left: sb.scrollLeft, top: sb.scrollTop};
},
restoreScroll : function(state){
var sb = this.scroller.dom;
sb.scrollLeft = state.left;
sb.scrollTop = state.top;
},
scrollToTop : function(){
this.scroller.dom.scrollTop = 0;
this.scroller.dom.scrollLeft = 0;
},
syncScroll : function(){
this.syncHeaderScroll();
var mb = this.scroller.dom;
this.grid.fireEvent("bodyscroll", mb.scrollLeft, mb.scrollTop);
},
syncHeaderScroll : function(){
var mb = this.scroller.dom;
this.innerHd.scrollLeft = mb.scrollLeft;
this.innerHd.scrollLeft = mb.scrollLeft; },
updateSortIcon : function(col, dir){
var sc = this.sortClasses;
var hds = this.mainHd.select('td').removeClass(sc);
hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);
},
updateAllColumnWidths : function(){
var tw = this.getTotalWidth();
var clen = this.cm.getColumnCount();
var ws = [];
for(var i = 0; i < clen; i++){
ws[i] = this.getColumnWidth(i);
}
this.innerHd.firstChild.firstChild.style.width = tw;
for(var i = 0; i < clen; i++){
var hd = this.getHeaderCell(i);
hd.style.width = ws[i];
}
var ns = this.getRows();
for(var i = 0, len = ns.length; i < len; i++){
ns[i].style.width = tw;
ns[i].firstChild.style.width = tw;
var row = ns[i].firstChild.rows[0];
for(var j = 0; j < clen; j++){
row.childNodes[j].style.width = ws[j];
}
}
this.onAllColumnWidthsUpdated(ws, tw);
},
updateColumnWidth : function(col, width){
var w = this.getColumnWidth(col);
var tw = this.getTotalWidth();
this.innerHd.firstChild.firstChild.style.width = tw;
var hd = this.getHeaderCell(col);
hd.style.width = w;
var ns = this.getRows();
for(var i = 0, len = ns.length; i < len; i++){
ns[i].style.width = tw;
ns[i].firstChild.style.width = tw;
ns[i].firstChild.rows[0].childNodes[col].style.width = w;
}
this.onColumnWidthUpdated(col, w, tw);
},
updateColumnHidden : function(col, hidden){
var tw = this.getTotalWidth();
this.innerHd.firstChild.firstChild.style.width = tw;
var display = hidden ? 'none' : '';
var hd = this.getHeaderCell(col);
hd.style.display = display;
var ns = this.getRows();
for(var i = 0, len = ns.length; i < len; i++){
ns[i].style.width = tw;
ns[i].firstChild.style.width = tw;
ns[i].firstChild.rows[0].childNodes[col].style.display = display;
}
this.onColumnHiddenUpdated(col, hidden, tw);
delete this.lastViewWidth; this.layout();
},
doRender : function(cs, rs, ds, startRow, colCount, stripe){
var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
var tstyle = 'width:'+this.getTotalWidth()+';';
var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r;
for(var j = 0, len = rs.length; j < len; j++){
r = rs[j]; cb = [];
var rowIndex = (j+startRow);
for(var i = 0; i < colCount; i++){
c = cs[i];
p.id = c.id;
p.css = i == 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
p.attr = p.cellAttr = "";
p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
p.style = c.style;
if(p.value == undefined || p.value === "") p.value = " ";
if(r.dirty && typeof r.modified[c.name] !== 'undefined'){
p.css += ' x-grid3-dirty-cell';
}
cb[cb.length] = ct.apply(p);
}
var alt = [];
if(stripe && ((rowIndex+1) % 2 == 0)){
alt[0] = "x-grid3-row-alt";
}
if(r.dirty){
alt[1] = " x-grid3-dirty-row";
}
rp.cols = colCount;
if(this.getRowClass){
alt[2] = this.getRowClass(r, rowIndex, rp, ds);
}
rp.alt = alt.join(" ");
rp.cells = cb.join("");
buf[buf.length] = rt.apply(rp);
}
return buf.join("");
},
processRows : function(startRow, skipStripe){
if(this.ds.getCount() < 1){
return;
}
skipStripe = skipStripe || !this.grid.stripeRows;
startRow = startRow || 0;
var rows = this.getRows();
var cls = ' x-grid3-row-alt ';
for(var i = startRow, len = rows.length; i < len; i++){
var row = rows[i];
row.rowIndex = i;
if(!skipStripe){
var isAlt = ((i+1) % 2 == 0);
var hasAlt = (' '+row.className + ' ').indexOf(cls) != -1;
if(isAlt == hasAlt){
continue;
}
if(isAlt){
row.className += " x-grid3-row-alt";
}else{
row.className = row.className.replace("x-grid3-row-alt", "");
}
}
}
},
renderUI : function(){
var header = this.renderHeaders();
var body = this.templates.body.apply({rows:''});
var html = this.templates.master.apply({
body: body,
header: header
});
var g = this.grid;
g.getGridEl().dom.innerHTML = html;
this.initElements();
this.mainBody.dom.innerHTML = this.renderRows();
this.processRows(0, true);
Ext.fly(this.innerHd).on("click", this.handleHdDown, this);
this.mainHd.on("mouseover", this.handleHdOver, this);
this.mainHd.on("mouseout", this.handleHdOut, this);
this.mainHd.on("mousemove", this.handleHdMove, this);
this.scroller.on('scroll', this.syncScroll, this);
if(g.enableColumnResize !== false){
this.splitone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);
}
if(g.enableColumnMove){
this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);
this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);
}
if(g.enableHdMenu !== false){
if(g.enableColumnHide !== false){
this.colMenu = new Ext.menu.Menu({id:g.id + "-hcols-menu"});
this.colMenu.on("beforeshow", this.beforeColMenuShow, this);
this.colMenu.on("itemclick", this.handleHdMenuClick, this);
}
this.hmenu = new Ext.menu.Menu({id: g.id + "-hctx"});
this.hmenu.add(
{id:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"},
{id:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"}
);
if(g.enableColumnHide !== false){
this.hmenu.add('-',
{id:"columns", text: this.columnsText, menu: this.colMenu, iconCls: 'x-cols-icon'}
);
}
this.hmenu.on("itemclick", this.handleHdMenuClick, this);
}
if(g.enableDragDrop || g.enableDrag){
var dd = new Ext.grid.GridDragZone(g, {
ddGroup : g.ddGroup || 'GridDD'
});
}
this.updateHeaderSortState();
},
layout : function(){
if(!this.mainBody){
return; }
var g = this.grid;
var c = g.getGridEl(), cm = this.cm,
expandCol = g.autoExpandColumn,
gv = this;
var csize = c.getSize(true);
var vw = csize.width;
if(vw < 20 || csize.height < 20){ return;
}
if(g.autoHeight){
this.scroller.dom.style.overflow = 'visible';
}else{
this.el.setSize(csize.width, csize.height);
var hdHeight = this.mainHd.getHeight();
var vh = csize.height - (hdHeight);
this.scroller.setSize(vw, vh);
if(this.innerHd){
this.innerHd.style.width = (vw)+'px';
}
}
if(this.forceFit){
if(this.lastViewWidth != vw){
this.fitColumns(false, false);
this.lastViewWidth = vw;
}
}else {
this.autoExpand();
this.syncHeaderScroll();
}
this.onLayout(vw, vh);
},
onLayout : function(vw, vh){
},
onColumnWidthUpdated : function(col, w, tw){
},
onAllColumnWidthsUpdated : function(ws, tw){
},
onColumnHiddenUpdated : function(col, hidden, tw){
},
updateColumnText : function(col, text){
},
afterMove : function(colIndex){
},
init: function(grid){
this.grid = grid;
this.initTemplates();
this.initData(grid.store, grid.colModel);
this.initUI(grid);
},
getColumnId : function(index){
return this.cm.getColumnId(index);
},
renderHeaders : function(){
var cm = this.cm, ts = this.templates;
var ct = ts.hcell;
var cb = [], sb = [], p = {};
for(var i = 0, len = cm.getColumnCount(); i < len; i++){
p.id = cm.getColumnId(i);
p.value = cm.getColumnHeader(i) || "";
p.style = this.getColumnStyle(i, true);
p.tooltip = this.getColumnTooltip(i);
if(cm.config[i].align == 'right'){
p.istyle = 'padding-right:16px';
} else {
delete p.istyle;
}
cb[cb.length] = ct.apply(p);
}
return ts.header.apply({cells: cb.join(""), tstyle:'width:'+this.getTotalWidth()+';'});
},
getColumnTooltip : function(i){
var tt = this.cm.getColumnTooltip(i);
if(tt){
if(Ext.QuickTips.isEnabled()){
return 'ext:qtip="'+tt+'"';
}else{
return 'title="'+tt+'"';
}
}
return "";
},
beforeUpdate : function(){
this.grid.stopEditing(true);
},
updateHeaders : function(){
this.innerHd.firstChild.innerHTML = this.renderHeaders();
},
focusRow : function(row){
this.focusCell(row, 0, false);
},
focusCell : function(row, col, hscroll){
var xy = this.ensureVisible(row, col, hscroll);
this.focusEl.setXY(xy);
if(Ext.isGecko){
this.focusEl.focus();
}else{
this.focusEl.focus.defer(1, this.focusEl);
}
},
ensureVisible : function(row, col, hscroll){
if(typeof row != "number"){
row = row.rowIndex;
}
if(!this.ds){
return;
}
if(row < 0 || row >= this.ds.getCount()){
return;
}
col = (col !== undefined ? col : 0);
var rowEl = this.getRow(row), cellEl;
if(!(hscroll === false && col === 0)){
while(this.cm.isHidden(col)){
col++;
}
cellEl = this.getCell(row, col);
}
if(!rowEl){
return;
}
var c = this.scroller.dom;
var ctop = 0;
var p = rowEl, stop = this.el.dom;
while(p && p != stop){
ctop += p.offsetTop;
p = p.offsetParent;
}
ctop -= this.mainHd.dom.offsetHeight;
var cbot = ctop + rowEl.offsetHeight;
var ch = c.clientHeight;
var stop = parseInt(c.scrollTop, 10);
var sbot = stop + ch;
if(ctop < stop){
c.scrollTop = ctop;
}else if(cbot > sbot){
c.scrollTop = cbot-ch;
}
if(hscroll !== false){
var cleft = parseInt(cellEl.offsetLeft, 10);
var cright = cleft + cellEl.offsetWidth;
var sleft = parseInt(c.scrollLeft, 10);
var sright = sleft + c.clientWidth;
if(cleft < sleft){
c.scrollLeft = cleft;
}else if(cright > sright){
c.scrollLeft = cright-c.clientWidth;
}
}
return cellEl ? Ext.fly(cellEl).getXY() : [c.scrollLeft, Ext.fly(rowEl).getY()];
},
insertRows : function(dm, firstRow, lastRow, isUpdate){
if(!isUpdate && firstRow === 0 && lastRow == dm.getCount()-1){
this.refresh();
}else{
if(!isUpdate){
this.fireEvent("beforerowsinserted", this, firstRow, lastRow);
}
var html = this.renderRows(firstRow, lastRow);
var before = this.getRow(firstRow);
if(before){
Ext.DomHelper.insertHtml('beforeBegin', before, html);
}else{
Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html);
}
if(!isUpdate){
this.fireEvent("rowsinserted", this, firstRow, lastRow);
this.processRows(firstRow);
}
}
},
deleteRows : function(dm, firstRow, lastRow){
if(dm.getRowCount()<1){
this.refresh();
}else{
this.fireEvent("beforerowsdeleted", this, firstRow, lastRow);
this.removeRows(firstRow, lastRow);
this.processRows(firstRow);
this.fireEvent("rowsdeleted", this, firstRow, lastRow);
}
},
getColumnStyle : function(col, isHeader){
var style = !isHeader ? (this.cm.config[col].css || '') : '';
style += 'width:'+this.getColumnWidth(col)+';';
if(this.cm.isHidden(col)){
style += 'display:none;';
}
var align = this.cm.config[col].align;
if(align){
style += 'text-align:'+align+';';
}
return style;
},
getColumnWidth : function(col){
var w = this.cm.getColumnWidth(col);
if(typeof w == 'number'){
return (Ext.isBorderBox ? w : (w-this.borderWidth > 0 ? w-this.borderWidth:0)) + 'px';
}
return w;
},
getTotalWidth : function(){
return this.cm.getTotalWidth()+'px';
},
fitColumns : function(preventRefresh, onlyExpand, omitColumn){
var cm = this.cm, leftOver, dist, i;
var tw = cm.getTotalWidth(false);
var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
if(aw < 20){ return;
}
var extra = aw - tw;
if(extra === 0){
return false;
}
var vc = cm.getColumnCount(true);
var ac = vc-(typeof omitColumn == 'number' ? 1 : 0);
if(ac === 0){
ac = 1;
omitColumn = undefined;
}
var colCount = cm.getColumnCount();
var cols = [];
var extraCol = 0;
var width = 0;
var w;
for (i = 0; i < colCount; i++){
if(!cm.isHidden(i) && !cm.isFixed(i) && i !== omitColumn){
w = cm.getColumnWidth(i);
cols.push(i);
extraCol = i;
cols.push(w);
width += w;
}
}
var frac = (aw - cm.getTotalWidth())/width;
while (cols.length){
w = cols.pop();
i = cols.pop();
cm.setColumnWidth(i, Math.max(this.grid.minColumnWidth, Math.floor(w + w*frac)), true);
}
if((tw = cm.getTotalWidth(false)) > aw){
var adjustCol = ac != vc ? omitColumn : extraCol;
cm.setColumnWidth(adjustCol, Math.max(1,
cm.getColumnWidth(adjustCol)- (tw-aw)), true);
}
if(preventRefresh !== true){
this.updateAllColumnWidths();
}
return true;
},
autoExpand : function(preventUpdate){
var g = this.grid, cm = this.cm;
if(!this.userResized && g.autoExpandColumn){
var tw = cm.getTotalWidth(false);
var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
if(tw != aw){
var ci = cm.getIndexById(g.autoExpandColumn);
var currentWidth = cm.getColumnWidth(ci);
var cw = Math.min(Math.max(((aw-tw)+currentWidth), g.autoExpandMin), g.autoExpandMax);
if(cw != currentWidth){
cm.setColumnWidth(ci, cw, true);
if(preventUpdate !== true){
this.updateColumnWidth(ci, cw);
}
}
}
}
},
getColumnData : function(){
var cs = [], cm = this.cm, colCount = cm.getColumnCount();
for(var i = 0; i < colCount; i++){
var name = cm.getDataIndex(i);
cs[i] = {
name : (typeof name == 'undefined' ? this.ds.fields.get(i).name : name),
renderer : cm.getRenderer(i),
id : cm.getColumnId(i),
style : this.getColumnStyle(i)
};
}
return cs;
},
renderRows : function(startRow, endRow){
var g = this.grid, cm = g.colModel, ds = g.store, stripe = g.stripeRows;
var colCount = cm.getColumnCount();
if(ds.getCount() < 1){
return "";
}
var cs = this.getColumnData();
startRow = startRow || 0;
endRow = typeof endRow == "undefined"? ds.getCount()-1 : endRow;
var rs = ds.getRange(startRow, endRow);
return this.doRender(cs, rs, ds, startRow, colCount, stripe);
},
renderBody : function(){
var markup = this.renderRows();
return this.templates.body.apply({rows: markup});
},
refreshRow : function(record){
var ds = this.ds, index;
if(typeof record == 'number'){
index = record;
record = ds.getAt(index);
}else{
index = ds.indexOf(record);
}
var cls = [];
this.insertRows(ds, index, index, true);
this.getRow(index).rowIndex = index;
this.onRemove(ds, record, index+1, true);
this.fireEvent("rowupdated", this, index, record);
},
refresh : function(headersToo){
this.fireEvent("beforerefresh", this);
this.grid.stopEditing(true);
var result = this.renderBody();
this.mainBody.update(result);
if(headersToo === true){
this.updateHeaders();
this.updateHeaderSortState();
}
this.processRows(0, true);
this.layout();
this.applyEmptyText();
this.fireEvent("refresh", this);
},
applyEmptyText : function(){
if(this.emptyText && !this.hasRows()){
this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');
}
},
updateHeaderSortState : function(){
var state = this.ds.getSortState();
if(!state){
return;
}
if(!this.sortState || (this.sortState.field != state.field || this.sortState.direction != state.direction)){
this.grid.fireEvent('sortchange', this.grid, state);
}
this.sortState = state;
var sortColumn = this.cm.findColumnIndex(state.field);
if(sortColumn != -1){
var sortDir = state.direction;
this.updateSortIcon(sortColumn, sortDir);
}
},
destroy : function(){
if(this.colMenu){
this.colMenu.removeAll();
Ext.menu.MenuMgr.unregister(this.colMenu);
this.colMenu.getEl().remove();
delete this.colMenu;
}
if(this.hmenu){
this.hmenu.removeAll();
Ext.menu.MenuMgr.unregister(this.hmenu);
this.hmenu.getEl().remove();
delete this.hmenu;
}
if(this.grid.enableColumnMove){
var dds = Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
if(dds){
for(var dd in dds){
if(!dds[dd].config.isTarget && dds[dd].dragElId){
var elid = dds[dd].dragElId;
dds[dd].unreg();
Ext.get(elid).remove();
} else if(dds[dd].config.isTarget){
dds[dd].proxyTop.remove();
dds[dd].proxyBottom.remove();
dds[dd].unreg();
}
if(Ext.dd.DDM.locationCache[dd]){
delete Ext.dd.DDM.locationCache[dd];
}
}
delete Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
}
}
Ext.destroy(this.resizeMarker, this.resizeProxy);
this.initData(null, null);
Ext.EventManager.removeResizeListener(this.onWindowResize, this);
},
onDenyColumnHide : function(){
},
render : function(){
var cm = this.cm;
var colCount = cm.getColumnCount();
if(this.autoFill){
this.fitColumns(true, true);
}else if(this.forceFit){
this.fitColumns(true, false);
}else if(this.grid.autoExpandColumn){
this.autoExpand(true);
}
this.renderUI();
},
initData : function(ds, cm){
if(this.ds){
this.ds.un("load", this.onLoad, this);
this.ds.un("datachanged", this.onDataChange, this);
this.ds.un("add", this.onAdd, this);
this.ds.un("remove", this.onRemove, this);
this.ds.un("update", this.onUpdate, this);
this.ds.un("clear", this.onClear, this);
}
if(ds){
ds.on("load", this.onLoad, this);
ds.on("datachanged", this.onDataChange, this);
ds.on("add", this.onAdd, this);
ds.on("remove", this.onRemove, this);
ds.on("update", this.onUpdate, this);
ds.on("clear", this.onClear, this);
}
this.ds = ds;
if(this.cm){
this.cm.un("configchange", this.onColConfigChange, this);
this.cm.un("widthchange", this.onColWidthChange, this);
this.cm.un("headerchange", this.onHeaderChange, this);
this.cm.un("hiddenchange", this.onHiddenChange, this);
this.cm.un("columnmoved", this.onColumnMove, this);
this.cm.un("columnlockchange", this.onColumnLock, this);
}
if(cm){
cm.on("configchange", this.onColConfigChange, this);
cm.on("widthchange", this.onColWidthChange, this);
cm.on("headerchange", this.onHeaderChange, this);
cm.on("hiddenchange", this.onHiddenChange, this);
cm.on("columnmoved", this.onColumnMove, this);
cm.on("columnlockchange", this.onColumnLock, this);
}
this.cm = cm;
},
onDataChange : function(){
this.refresh();
this.updateHeaderSortState();
},
onClear : function(){
this.refresh();
},
onUpdate : function(ds, record){
this.refreshRow(record);
},
onAdd : function(ds, records, index){
this.insertRows(ds, index, index + (records.length-1));
},
onRemove : function(ds, record, index, isUpdate){
if(isUpdate !== true){
this.fireEvent("beforerowremoved", this, index, record);
}
this.removeRow(index);
if(isUpdate !== true){
this.processRows(index);
this.applyEmptyText();
this.fireEvent("rowremoved", this, index, record);
}
},
onLoad : function(){
this.scrollToTop();
},
onColWidthChange : function(cm, col, width){
this.updateColumnWidth(col, width);
},
onHeaderChange : function(cm, col, text){
this.updateHeaders();
},
onHiddenChange : function(cm, col, hidden){
this.updateColumnHidden(col, hidden);
},
onColumnMove : function(cm, oldIndex, newIndex){
this.indexMap = null;
var s = this.getScrollState();
this.refresh(true);
this.restoreScroll(s);
this.afterMove(newIndex);
},
onColConfigChange : function(){
delete this.lastViewWidth;
this.indexMap = null;
this.refresh(true);
},
initUI : function(grid){
grid.on("headerclick", this.onHeaderClick, this);
if(grid.trackMouseOver){
grid.on("mouseover", this.onRowOver, this);
grid.on("mouseout", this.onRowOut, this);
}
},
initEvents : function(){
},
onHeaderClick : function(g, index){
if(this.headersDisabled || !this.cm.isSortable(index)){
return;
}
g.stopEditing(true);
g.store.sort(this.cm.getDataIndex(index));
},
onRowOver : function(e, t){
var row;
if((row = this.findRowIndex(t)) !== false){
this.addRowClass(row, "x-grid3-row-over");
}
},
onRowOut : function(e, t){
var row;
if((row = this.findRowIndex(t)) !== false && row !== this.findRowIndex(e.getRelatedTarget())){
this.removeRowClass(row, "x-grid3-row-over");
}
},
handleWheel : function(e){
e.stopPropagation();
},
onRowSelect : function(row){
this.addRowClass(row, "x-grid3-row-selected");
},
onRowDeselect : function(row){
this.removeRowClass(row, "x-grid3-row-selected");
},
onCellSelect : function(row, col){
var cell = this.getCell(row, col);
if(cell){
this.fly(cell).addClass("x-grid3-cell-selected");
}
},
onCellDeselect : function(row, col){
var cell = this.getCell(row, col);
if(cell){
this.fly(cell).removeClass("x-grid3-cell-selected");
}
},
onColumnSplitterMoved : function(i, w){
this.userResized = true;
var cm = this.grid.colModel;
cm.setColumnWidth(i, w, true);
if(this.forceFit){
this.fitColumns(true, false, i);
this.updateAllColumnWidths();
}else{
this.updateColumnWidth(i, w);
}
this.grid.fireEvent("columnresize", i, w);
},
handleHdMenuClick : function(item){
var index = this.hdCtxIndex;
var cm = this.cm, ds = this.ds;
switch(item.id){
case "asc":
ds.sort(cm.getDataIndex(index), "ASC");
break;
case "desc":
ds.sort(cm.getDataIndex(index), "DESC");
break;
default:
index = cm.getIndexById(item.id.substr(4));
if(index != -1){
if(item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1){
this.onDenyColumnHide();
return false;
}
cm.setHidden(index, item.checked);
}
}
return true;
},
isHideableColumn : function(c){
return !c.hidden && !c.fixed;
},
beforeColMenuShow : function(){
var cm = this.cm, colCount = cm.getColumnCount();
this.colMenu.removeAll();
for(var i = 0; i < colCount; i++){
if(cm.config[i].fixed !== true && cm.config[i].hideable !== false){
this.colMenu.add(new Ext.menu.CheckItem({
id: "col-"+cm.getColumnId(i),
text: cm.getColumnHeader(i),
checked: !cm.isHidden(i),
hideOnClick:false,
disabled: cm.config[i].hideable === false
}));
}
}
},
handleHdDown : function(e, t){
if(Ext.fly(t).hasClass('x-grid3-hd-btn')){
e.stopEvent();
var hd = this.findHeaderCell(t);
Ext.fly(hd).addClass('x-grid3-hd-menu-open');
var index = this.getCellIndex(hd);
this.hdCtxIndex = index;
var ms = this.hmenu.items, cm = this.cm;
ms.get("asc").setDisabled(!cm.isSortable(index));
ms.get("desc").setDisabled(!cm.isSortable(index));
this.hmenu.on("hide", function(){
Ext.fly(hd).removeClass('x-grid3-hd-menu-open');
}, this, {single:true});
this.hmenu.show(t, "tl-bl?");
}
},
handleHdOver : function(e, t){
var hd = this.findHeaderCell(t);
if(hd && !this.headersDisabled){
this.activeHd = hd;
this.activeHdIndex = this.getCellIndex(hd);
var fly = this.fly(hd);
this.activeHdRegion = fly.getRegion();
if(!this.cm.isMenuDisabled(this.activeHdIndex)){
fly.addClass("x-grid3-hd-over");
this.activeHdBtn = fly.child('.x-grid3-hd-btn');
if(this.activeHdBtn){
this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px';
}
}
}
},
handleHdMove : function(e, t){
if(this.activeHd && !this.headersDisabled){
var hw = this.splitHandleWidth || 5;
var r = this.activeHdRegion;
var x = e.getPageX();
var ss = this.activeHd.style;
if(x - r.left <= hw && this.cm.isResizable(this.activeHdIndex-1)){
ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'e-resize' : 'col-resize'; }else if(r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)){
ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'w-resize' : 'col-resize';
}else{
ss.cursor = '';
}
}
},
handleHdOut : function(e, t){
var hd = this.findHeaderCell(t);
if(hd && (!Ext.isIE || !e.within(hd, true))){
this.activeHd = null;
this.fly(hd).removeClass("x-grid3-hd-over");
hd.style.cursor = '';
}
},
hasRows : function(){
var fc = this.mainBody.dom.firstChild;
return fc && fc.className != 'x-grid-empty';
},
bind : function(d, c){
this.initData(d, c);
}
});
Ext.grid.GridView.SplitDragZone = function(grid, hd){
this.grid = grid;
this.view = grid.getView();
this.marker = this.view.resizeMarker;
this.proxy = this.view.resizeProxy;
Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, hd,
"gridSplitters" + this.grid.getGridEl().id, {
dragElId : Ext.id(this.proxy.dom), resizeFrame:false
});
this.scroll = false;
this.hw = this.view.splitHandleWidth || 5;
};
Ext.extend(Ext.grid.GridView.SplitDragZone, Ext.dd.DDProxy, {
b4StartDrag : function(x, y){
this.view.headersDisabled = true;
var h = this.view.mainWrap.getHeight();
this.marker.setHeight(h);
this.marker.show();
this.marker.alignTo(this.view.getHeaderCell(this.cellIndex), 'tl-tl', [-2, 0]);
this.proxy.setHeight(h);
var w = this.cm.getColumnWidth(this.cellIndex);
var minw = Math.max(w-this.grid.minColumnWidth, 0);
this.resetConstraints();
this.setXConstraint(minw, 1000);
this.setYConstraint(0, 0);
this.minX = x - minw;
this.maxX = x + 1000;
this.startPos = x;
Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
},
handleMouseDown : function(e){
var t = this.view.findHeaderCell(e.getTarget());
if(t){
var xy = this.view.fly(t).getXY(), x = xy[0], y = xy[1];
var exy = e.getXY(), ex = exy[0], ey = exy[1];
var w = t.offsetWidth, adjust = false;
if((ex - x) <= this.hw){
adjust = -1;
}else if((x+w) - ex <= this.hw){
adjust = 0;
}
if(adjust !== false){
this.cm = this.grid.colModel;
var ci = this.view.getCellIndex(t);
if(adjust == -1){
if (ci + adjust < 0) {
return;
}
while(this.cm.isHidden(ci+adjust)){
--adjust;
if(ci+adjust < 0){
return;
}
}
}
this.cellIndex = ci+adjust;
this.split = t.dom;
if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
}
}else if(this.view.columnDrag){
this.view.columnDrag.callHandleMouseDown(e);
}
}
},
endDrag : function(e){
this.marker.hide();
var v = this.view;
var endX = Math.max(this.minX, e.getPageX());
var diff = endX - this.startPos;
v.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
setTimeout(function(){
v.headersDisabled = false;
}, 50);
},
autoOffset : function(){
this.setDelta(0,0);
}
});
Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, {
hideGroupedColumn:false,
showGroupName:true,
startCollapsed:false,
enableGrouping:true,
enableGroupingMenu:true,
enableNoGroups:true,
emptyGroupText : '(None)',
ignoreAdd: false,
groupTextTpl : '{text}',
gidSeed : 1000,
initTemplates : function(){
Ext.grid.GroupingView.superclass.initTemplates.call(this);
this.state = {};
var sm = this.grid.getSelectionModel();
sm.on(sm.selectRow ? 'beforerowselect' : 'beforecellselect',
this.onBeforeRowSelect, this);
if(!this.startGroup){
this.startGroup = new Ext.XTemplate(
'<div id="{groupId}" class="x-grid-group {cls}">',
'<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div>', this.groupTextTpl ,'</div></div>',
'<div id="{groupId}-bd" class="x-grid-group-body">'
);
}
this.startGroup.compile();
this.endGroup = '</div></div>';
},
findGroup : function(el){
return Ext.fly(el).up('.x-grid-group', this.mainBody.dom);
},
getGroups : function(){
return this.hasRows() ? this.mainBody.dom.childNodes : [];
},
onAdd : function(){
if(this.enableGrouping && !this.ignoreAdd){
var ss = this.getScrollState();
this.refresh();
this.restoreScroll(ss);
}else if(!this.enableGrouping){
Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments);
}
},
onRemove : function(ds, record, index, isUpdate){
Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments);
var g = document.getElementById(record._groupId);
if(g && g.childNodes[1].childNodes.length < 1){
Ext.removeNode(g);
}
this.applyEmptyText();
},
refreshRow : function(record){
if(this.ds.getCount()==1){
this.refresh();
}else{
this.isUpdating = true;
Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments);
this.isUpdating = false;
}
},
beforeMenuShow : function(){
var field = this.getGroupField();
var g = this.hmenu.items.get('groupBy');
if(g){
g.setDisabled(this.cm.config[this.hdCtxIndex].groupable === false);
}
var s = this.hmenu.items.get('showGroups');
if(s){
if (!!field){
s.setDisabled(this.cm.config[this.hdCtxIndex].groupable === false)
}
s.setChecked(!!field);
}
},
renderUI : function(){
Ext.grid.GroupingView.superclass.renderUI.call(this);
this.mainBody.on('mousedown', this.interceptMouse, this);
if(this.enableGroupingMenu && this.hmenu){
this.hmenu.add('-',{
id:'groupBy',
text: this.groupByText,
handler: this.onGroupByClick,
scope: this,
iconCls:'x-group-by-icon'
});
if(this.enableNoGroups){
this.hmenu.add({
id:'showGroups',
text: this.showGroupsText,
checked: true,
checkHandler: this.onShowGroupsClick,
scope: this
});
}
this.hmenu.on('beforeshow', this.beforeMenuShow, this);
}
},
onGroupByClick : function(){
this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));
this.beforeMenuShow();
},
onShowGroupsClick : function(mi, checked){
if(checked){
this.onGroupByClick();
}else{
this.grid.store.clearGrouping();
}
},
toggleGroup : function(group, expanded){
this.grid.stopEditing(true);
group = Ext.getDom(group);
var gel = Ext.fly(group);
expanded = expanded !== undefined ?
expanded : gel.hasClass('x-grid-group-collapsed');
this.state[gel.dom.id] = expanded;
gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed');
},
toggleAllGroups : function(expanded){
var groups = this.getGroups();
for(var i = 0, len = groups.length; i < len; i++){
this.toggleGroup(groups[i], expanded);
}
},
expandAllGroups : function(){
this.toggleAllGroups(true);
},
collapseAllGroups : function(){
this.toggleAllGroups(false);
},
interceptMouse : function(e){
var hd = e.getTarget('.x-grid-group-hd', this.mainBody);
if(hd){
e.stopEvent();
this.toggleGroup(hd.parentNode);
}
},
getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){
var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v);
if(g === ''){
g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText;
}
return g;
},
getGroupField : function(){
return this.grid.store.getGroupState();
},
renderRows : function(){
var groupField = this.getGroupField();
var eg = !!groupField;
if(this.hideGroupedColumn) {
var colIndex = this.cm.findColumnIndex(groupField);
if(!eg && this.lastGroupField !== undefined) {
this.mainBody.update('');
this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false);
delete this.lastGroupField;
}else if (eg && this.lastGroupField === undefined) {
this.lastGroupField = groupField;
this.cm.setHidden(colIndex, true);
}else if (eg && this.lastGroupField !== undefined && groupField !== this.lastGroupField) {
this.mainBody.update('');
var oldIndex = this.cm.findColumnIndex(this.lastGroupField);
this.cm.setHidden(oldIndex, false);
this.lastGroupField = groupField;
this.cm.setHidden(colIndex, true);
}
}
return Ext.grid.GroupingView.superclass.renderRows.apply(
this, arguments);
},
doRender : function(cs, rs, ds, startRow, colCount, stripe){
if(rs.length < 1){
return '';
}
var groupField = this.getGroupField();
var colIndex = this.cm.findColumnIndex(groupField);
this.enableGrouping = !!groupField;
if(!this.enableGrouping || this.isUpdating){
return Ext.grid.GroupingView.superclass.doRender.apply(
this, arguments);
}
var gstyle = 'width:'+this.getTotalWidth()+';';
var gidPrefix = this.grid.getGridEl().id;
var cfg = this.cm.config[colIndex];
var groupRenderer = cfg.groupRenderer || cfg.renderer;
var prefix = this.showGroupName ?
(cfg.groupName || cfg.header)+': ' : '';
var groups = [], curGroup, i, len, gid;
for(i = 0, len = rs.length; i < len; i++){
var rowIndex = startRow + i;
var r = rs[i],
gvalue = r.data[groupField],
g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);
if(!curGroup || curGroup.group != g){
gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(g);
var isCollapsed = typeof this.state[gid] !== 'undefined' ? !this.state[gid] : this.startCollapsed;
var gcls = isCollapsed ? 'x-grid-group-collapsed' : '';
curGroup = {
group: g,
gvalue: gvalue,
text: prefix + g,
groupId: gid,
startRow: rowIndex,
rs: [r],
cls: gcls,
style: gstyle
};
groups.push(curGroup);
}else{
curGroup.rs.push(r);
}
r._groupId = gid;
}
var buf = [];
for(i = 0, len = groups.length; i < len; i++){
var g = groups[i];
this.doGroupStart(buf, g, cs, ds, colCount);
buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call(
this, cs, g.rs, ds, g.startRow, colCount, stripe);
this.doGroupEnd(buf, g, cs, ds, colCount);
}
return buf.join('');
},
getGroupId : function(value){
var gidPrefix = this.grid.getGridEl().id;
var groupField = this.getGroupField();
var colIndex = this.cm.findColumnIndex(groupField);
var cfg = this.cm.config[colIndex];
var groupRenderer = cfg.groupRenderer || cfg.renderer;
var gtext = this.getGroup(value, {data:{}}, groupRenderer, 0, colIndex, this.ds);
return gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(value);
},
doGroupStart : function(buf, g, cs, ds, colCount){
buf[buf.length] = this.startGroup.apply(g);
},
doGroupEnd : function(buf, g, cs, ds, colCount){
buf[buf.length] = this.endGroup;
},
getRows : function(){
if(!this.enableGrouping){
return Ext.grid.GroupingView.superclass.getRows.call(this);
}
var r = [];
var g, gs = this.getGroups();
for(var i = 0, len = gs.length; i < len; i++){
g = gs[i].childNodes[1].childNodes;
for(var j = 0, jlen = g.length; j < jlen; j++){
r[r.length] = g[j];
}
}
return r;
},
updateGroupWidths : function(){
if(!this.enableGrouping || !this.hasRows()){
return;
}
var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.scrollOffset) +'px';
var gs = this.getGroups();
for(var i = 0, len = gs.length; i < len; i++){
gs[i].firstChild.style.width = tw;
}
},
onColumnWidthUpdated : function(col, w, tw){
this.updateGroupWidths();
},
onAllColumnWidthsUpdated : function(ws, tw){
this.updateGroupWidths();
},
onColumnHiddenUpdated : function(col, hidden, tw){
this.updateGroupWidths();
},
onLayout : function(){
this.updateGroupWidths();
},
onBeforeRowSelect : function(sm, rowIndex){
if(!this.enableGrouping){
return;
}
var row = this.getRow(rowIndex);
if(row && !row.offsetParent){
var g = this.findGroup(row);
this.toggleGroup(g, true);
}
},
groupByText: 'Group By This Field',
showGroupsText: 'Show in Groups'
});
Ext.grid.GroupingView.GROUP_ID = 1000;
Ext.grid.HeaderDragZone = function(grid, hd, hd2){
this.grid = grid;
this.view = grid.getView();
this.ddGroup = "gridHeader" + this.grid.getGridEl().id;
Ext.grid.HeaderDragZone.superclass.constructor.call(this, hd);
if(hd2){
this.setHandleElId(Ext.id(hd));
this.setOuterHandleElId(Ext.id(hd2));
}
this.scroll = false;
};
Ext.extend(Ext.grid.HeaderDragZone, Ext.dd.DragZone, {
maxDragWidth: 120,
getDragData : function(e){
var t = Ext.lib.Event.getTarget(e);
var h = this.view.findHeaderCell(t);
if(h){
return {ddel: h.firstChild, header:h};
}
return false;
},
onInitDrag : function(e){
this.view.headersDisabled = true;
var clone = this.dragData.ddel.cloneNode(true);
clone.id = Ext.id();
clone.style.width = Math.min(this.dragData.header.offsetWidth,this.maxDragWidth) + "px";
this.proxy.update(clone);
return true;
},
afterValidDrop : function(){
var v = this.view;
setTimeout(function(){
v.headersDisabled = false;
}, 50);
},
afterInvalidDrop : function(){
var v = this.view;
setTimeout(function(){
v.headersDisabled = false;
}, 50);
}
});
Ext.grid.HeaderDropZone = function(grid, hd, hd2){
this.grid = grid;
this.view = grid.getView();
this.proxyTop = Ext.DomHelper.append(document.body, {
cls:"col-move-top", html:" "
}, true);
this.proxyBottom = Ext.DomHelper.append(document.body, {
cls:"col-move-bottom", html:" "
}, true);
this.proxyTop.hide = this.proxyBottom.hide = function(){
this.setLeftTop(-100,-100);
this.setStyle("visibility", "hidden");
};
this.ddGroup = "gridHeader" + this.grid.getGridEl().id;
Ext.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom);
};
Ext.extend(Ext.grid.HeaderDropZone, Ext.dd.DropZone, {
proxyOffsets : [-4, -9],
fly: Ext.Element.fly,
getTargetFromEvent : function(e){
var t = Ext.lib.Event.getTarget(e);
var cindex = this.view.findCellIndex(t);
if(cindex !== false){
return this.view.getHeaderCell(cindex);
}
},
nextVisible : function(h){
var v = this.view, cm = this.grid.colModel;
h = h.nextSibling;
while(h){
if(!cm.isHidden(v.getCellIndex(h))){
return h;
}
h = h.nextSibling;
}
return null;
},
prevVisible : function(h){
var v = this.view, cm = this.grid.colModel;
h = h.prevSibling;
while(h){
if(!cm.isHidden(v.getCellIndex(h))){
return h;
}
h = h.prevSibling;
}
return null;
},
positionIndicator : function(h, n, e){
var x = Ext.lib.Event.getPageX(e);
var r = Ext.lib.Dom.getRegion(n.firstChild);
var px, pt, py = r.top + this.proxyOffsets[1];
if((r.right - x) <= (r.right-r.left)/2){
px = r.right+this.view.borderWidth;
pt = "after";
}else{
px = r.left;
pt = "before";
}
var oldIndex = this.view.getCellIndex(h);
var newIndex = this.view.getCellIndex(n);
if(this.grid.colModel.isFixed(newIndex)){
return false;
}
var locked = this.grid.colModel.isLocked(newIndex);
if(pt == "after"){
newIndex++;
}
if(oldIndex < newIndex){
newIndex--;
}
if(oldIndex == newIndex && (locked == this.grid.colModel.isLocked(oldIndex))){
return false;
}
px += this.proxyOffsets[0];
this.proxyTop.setLeftTop(px, py);
this.proxyTop.show();
if(!this.bottomOffset){
this.bottomOffset = this.view.mainHd.getHeight();
}
this.proxyBottom.setLeftTop(px, py+this.proxyTop.dom.offsetHeight+this.bottomOffset);
this.proxyBottom.show();
return pt;
},
onNodeEnter : function(n, dd, e, data){
if(data.header != n){
this.positionIndicator(data.header, n, e);
}
},
onNodeOver : function(n, dd, e, data){
var result = false;
if(data.header != n){
result = this.positionIndicator(data.header, n, e);
}
if(!result){
this.proxyTop.hide();
this.proxyBottom.hide();
}
return result ? this.dropAllowed : this.dropNotAllowed;
},
onNodeOut : function(n, dd, e, data){
this.proxyTop.hide();
this.proxyBottom.hide();
},
onNodeDrop : function(n, dd, e, data){
var h = data.header;
if(h != n){
var cm = this.grid.colModel;
var x = Ext.lib.Event.getPageX(e);
var r = Ext.lib.Dom.getRegion(n.firstChild);
var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before";
var oldIndex = this.view.getCellIndex(h);
var newIndex = this.view.getCellIndex(n);
var locked = cm.isLocked(newIndex);
if(pt == "after"){
newIndex++;
}
if(oldIndex < newIndex){
newIndex--;
}
if(oldIndex == newIndex && (locked == cm.isLocked(oldIndex))){
return false;
}
cm.setLocked(oldIndex, locked, true);
cm.moveColumn(oldIndex, newIndex);
this.grid.fireEvent("columnmove", oldIndex, newIndex);
return true;
}
return false;
}
});
Ext.grid.GridView.ColumnDragZone = function(grid, hd){
Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null);
this.proxy.el.addClass('x-grid3-col-dd');
};
Ext.extend(Ext.grid.GridView.ColumnDragZone, Ext.grid.HeaderDragZone, {
handleMouseDown : function(e){
},
callHandleMouseDown : function(e){
Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this, e);
}
});
Ext.grid.SplitDragZone = function(grid, hd, hd2){
this.grid = grid;
this.view = grid.getView();
this.proxy = this.view.resizeProxy;
Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
"gridSplitters" + this.grid.getGridEl().id, {
dragElId : Ext.id(this.proxy.dom), resizeFrame:false
});
this.setHandleElId(Ext.id(hd));
this.setOuterHandleElId(Ext.id(hd2));
this.scroll = false;
};
Ext.extend(Ext.grid.SplitDragZone, Ext.dd.DDProxy, {
fly: Ext.Element.fly,
b4StartDrag : function(x, y){
this.view.headersDisabled = true;
this.proxy.setHeight(this.view.mainWrap.getHeight());
var w = this.cm.getColumnWidth(this.cellIndex);
var minw = Math.max(w-this.grid.minColumnWidth, 0);
this.resetConstraints();
this.setXConstraint(minw, 1000);
this.setYConstraint(0, 0);
this.minX = x - minw;
this.maxX = x + 1000;
this.startPos = x;
Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
},
handleMouseDown : function(e){
ev = Ext.EventObject.setEvent(e);
var t = this.fly(ev.getTarget());
if(t.hasClass("x-grid-split")){
this.cellIndex = this.view.getCellIndex(t.dom);
this.split = t.dom;
this.cm = this.grid.colModel;
if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
}
}
},
endDrag : function(e){
this.view.headersDisabled = false;
var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e));
var diff = endX - this.startPos;
this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
},
autoOffset : function(){
this.setDelta(0,0);
}
});
Ext.grid.GridDragZone = function(grid, config){
this.view = grid.getView();
Ext.grid.GridDragZone.superclass.constructor.call(this, this.view.mainBody.dom, config);
if(this.view.lockedBody){
this.setHandleElId(Ext.id(this.view.mainBody.dom));
this.setOuterHandleElId(Ext.id(this.view.lockedBody.dom));
}
this.scroll = false;
this.grid = grid;
this.ddel = document.createElement('div');
this.ddel.className = 'x-grid-dd-wrap';
};
Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, {
ddGroup : "GridDD",
getDragData : function(e){
var t = Ext.lib.Event.getTarget(e);
var rowIndex = this.view.findRowIndex(t);
if(rowIndex !== false){
var sm = this.grid.selModel;
if(!sm.isSelected(rowIndex) || e.hasModifier()){
sm.handleMouseDown(this.grid, rowIndex, e);
}
return {grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, selections:sm.getSelections()};
}
return false;
},
onInitDrag : function(e){
var data = this.dragData;
this.ddel.innerHTML = this.grid.getDragDropText();
this.proxy.update(this.ddel);
},
afterRepair : function(){
this.dragging = false;
},
getRepairXY : function(e, data){
return false;
},
onEndDrag : function(data, e){
},
onValidDrop : function(dd, e, id){
this.hideProxy();
},
beforeInvalidDrop : function(e, id){
}
});
Ext.grid.ColumnModel = function(config){
this.defaultWidth = 100;
this.defaultSortable = false;
if(config.columns){
Ext.apply(this, config);
this.setConfig(config.columns, true);
}else{
this.setConfig(config, true);
}
this.addEvents(
"widthchange",
"headerchange",
"hiddenchange",
"columnmoved",
"columnlockchange",
"configchange"
);
Ext.grid.ColumnModel.superclass.constructor.call(this);
};
Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, {
getColumnId : function(index){
return this.config[index].id;
},
setConfig : function(config, initial){
if(!initial){
delete this.totalWidth;
for(var i = 0, len = this.config.length; i < len; i++){
var c = this.config[i];
if(c.editor){
c.editor.destroy();
}
}
}
this.config = config;
this.lookup = {};
for(var i = 0, len = config.length; i < len; i++){
var c = config[i];
if(typeof c.renderer == "string"){
c.renderer = Ext.util.Format[c.renderer];
}
if(typeof c.id == "undefined"){
c.id = i;
}
if(c.editor && c.editor.isFormField){
c.editor = new Ext.grid.GridEditor(c.editor);
}
this.lookup[c.id] = c;
}
if(!initial){
this.fireEvent('configchange', this);
}
},
getColumnById : function(id){
return this.lookup[id];
},
getIndexById : function(id){
for(var i = 0, len = this.config.length; i < len; i++){
if(this.config[i].id == id){
return i;
}
}
return -1;
},
moveColumn : function(oldIndex, newIndex){
var c = this.config[oldIndex];
this.config.splice(oldIndex, 1);
this.config.splice(newIndex, 0, c);
this.dataMap = null;
this.fireEvent("columnmoved", this, oldIndex, newIndex);
},
isLocked : function(colIndex){
return this.config[colIndex].locked === true;
},
setLocked : function(colIndex, value, suppressEvent){
if(this.isLocked(colIndex) == value){
return;
}
this.config[colIndex].locked = value;
if(!suppressEvent){
this.fireEvent("columnlockchange", this, colIndex, value);
}
},
getTotalLockedWidth : function(){
var totalWidth = 0;
for(var i = 0; i < this.config.length; i++){
if(this.isLocked(i) && !this.isHidden(i)){
this.totalWidth += this.getColumnWidth(i);
}
}
return totalWidth;
},
getLockedCount : function(){
for(var i = 0, len = this.config.length; i < len; i++){
if(!this.isLocked(i)){
return i;
}
}
},
getColumnCount : function(visibleOnly){
if(visibleOnly === true){
var c = 0;
for(var i = 0, len = this.config.length; i < len; i++){
if(!this.isHidden(i)){
c++;
}
}
return c;
}
return this.config.length;
},
getColumnsBy : function(fn, scope){
var r = [];
for(var i = 0, len = this.config.length; i < len; i++){
var c = this.config[i];
if(fn.call(scope||this, c, i) === true){
r[r.length] = c;
}
}
return r;
},
isSortable : function(col){
if(typeof this.config[col].sortable == "undefined"){
return this.defaultSortable;
}
return this.config[col].sortable;
},
isMenuDisabled : function(col){
return !!this.config[col].menuDisabled;
},
getRenderer : function(col){
if(!this.config[col].renderer){
return Ext.grid.ColumnModel.defaultRenderer;
}
return this.config[col].renderer;
},
setRenderer : function(col, fn){
this.config[col].renderer = fn;
},
getColumnWidth : function(col){
return this.config[col].width || this.defaultWidth;
},
setColumnWidth : function(col, width, suppressEvent){
this.config[col].width = width;
this.totalWidth = null;
if(!suppressEvent){
this.fireEvent("widthchange", this, col, width);
}
},
getTotalWidth : function(includeHidden){
if(!this.totalWidth){
this.totalWidth = 0;
for(var i = 0, len = this.config.length; i < len; i++){
if(includeHidden || !this.isHidden(i)){
this.totalWidth += this.getColumnWidth(i);
}
}
}
return this.totalWidth;
},
getColumnHeader : function(col){
return this.config[col].header;
},
setColumnHeader : function(col, header){
this.config[col].header = header;
this.fireEvent("headerchange", this, col, header);
},
getColumnTooltip : function(col){
return this.config[col].tooltip;
},
setColumnTooltip : function(col, tooltip){
this.config[col].tooltip = tooltip;
},
getDataIndex : function(col){
return this.config[col].dataIndex;
},
setDataIndex : function(col, dataIndex){
this.config[col].dataIndex = dataIndex;
},
findColumnIndex : function(dataIndex){
var c = this.config;
for(var i = 0, len = c.length; i < len; i++){
if(c[i].dataIndex == dataIndex){
return i;
}
}
return -1;
},
isCellEditable : function(colIndex, rowIndex){
return (this.config[colIndex].editable || (typeof this.config[colIndex].editable == "undefined" && this.config[colIndex].editor)) ? true : false;
},
getCellEditor : function(colIndex, rowIndex){
return this.config[colIndex].editor;
},
setEditable : function(col, editable){
this.config[col].editable = editable;
},
isHidden : function(colIndex){
return this.config[colIndex].hidden;
},
isFixed : function(colIndex){
return this.config[colIndex].fixed;
},
isResizable : function(colIndex){
return colIndex >= 0 && this.config[colIndex].resizable !== false && this.config[colIndex].fixed !== true;
},
setHidden : function(colIndex, hidden){
var c = this.config[colIndex];
if(c.hidden !== hidden){
c.hidden = hidden;
this.totalWidth = null;
this.fireEvent("hiddenchange", this, colIndex, hidden);
}
},
setEditor : function(col, editor){
this.config[col].editor = editor;
}
});
Ext.grid.ColumnModel.defaultRenderer = function(value){
if(typeof value == "string" && value.length < 1){
return " ";
}
return value;
};
Ext.grid.DefaultColumnModel = Ext.grid.ColumnModel;
Ext.grid.AbstractSelectionModel = function(){
this.locked = false;
Ext.grid.AbstractSelectionModel.superclass.constructor.call(this);
};
Ext.extend(Ext.grid.AbstractSelectionModel, Ext.util.Observable, {
init : function(grid){
this.grid = grid;
this.initEvents();
},
lock : function(){
this.locked = true;
},
unlock : function(){
this.locked = false;
},
isLocked : function(){
return this.locked;
}
});
Ext.grid.RowSelectionModel = function(config){
Ext.apply(this, config);
this.selections = new Ext.util.MixedCollection(false, function(o){
return o.id;
});
this.last = false;
this.lastActive = false;
this.addEvents(
"selectionchange",
"beforerowselect",
"rowselect",
"rowdeselect"
);
Ext.grid.RowSelectionModel.superclass.constructor.call(this);
};
Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel, {
singleSelect : false,
initEvents : function(){
if(!this.grid.enableDragDrop && !this.grid.enableDrag){
this.grid.on("rowmousedown", this.handleMouseDown, this);
}else{ this.grid.on("rowclick", function(grid, rowIndex, e) {
if(e.button === 0 && !e.shiftKey && !e.ctrlKey) {
this.selectRow(rowIndex, false);
grid.view.focusRow(rowIndex);
}
}, this);
}
this.rowNav = new Ext.KeyNav(this.grid.getGridEl(), {
"up" : function(e){
if(!e.shiftKey){
this.selectPrevious(e.shiftKey);
}else if(this.last !== false && this.lastActive !== false){
var last = this.last;
this.selectRange(this.last, this.lastActive-1);
this.grid.getView().focusRow(this.lastActive);
if(last !== false){
this.last = last;
}
}else{
this.selectFirstRow();
}
},
"down" : function(e){
if(!e.shiftKey){
this.selectNext(e.shiftKey);
}else if(this.last !== false && this.lastActive !== false){
var last = this.last;
this.selectRange(this.last, this.lastActive+1);
this.grid.getView().focusRow(this.lastActive);
if(last !== false){
this.last = last;
}
}else{
this.selectFirstRow();
}
},
scope: this
});
var view = this.grid.view;
view.on("refresh", this.onRefresh, this);
view.on("rowupdated", this.onRowUpdated, this);
view.on("rowremoved", this.onRemove, this);
},
onRefresh : function(){
var ds = this.grid.store, index;
var s = this.getSelections();
this.clearSelections(true);
for(var i = 0, len = s.length; i < len; i++){
var r = s[i];
if((index = ds.indexOfId(r.id)) != -1){
this.selectRow(index, true);
}
}
if(s.length != this.selections.getCount()){
this.fireEvent("selectionchange", this);
}
},
onRemove : function(v, index, r){
if(this.selections.remove(r) !== false){
this.fireEvent('selectionchange', this);
}
},
onRowUpdated : function(v, index, r){
if(this.isSelected(r)){
v.onRowSelect(index);
}
},
selectRecords : function(records, keepExisting){
if(!keepExisting){
this.clearSelections();
}
var ds = this.grid.store;
for(var i = 0, len = records.length; i < len; i++){
this.selectRow(ds.indexOf(records[i]), true);
}
},
getCount : function(){
return this.selections.length;
},
selectFirstRow : function(){
this.selectRow(0);
},
selectLastRow : function(keepExisting){
this.selectRow(this.grid.store.getCount() - 1, keepExisting);
},
selectNext : function(keepExisting){
if(this.hasNext()){
this.selectRow(this.last+1, keepExisting);
this.grid.getView().focusRow(this.last);
return true;
}
return false;
},
selectPrevious : function(keepExisting){
if(this.hasPrevious()){
this.selectRow(this.last-1, keepExisting);
this.grid.getView().focusRow(this.last);
return true;
}
return false;
},
hasNext : function(){
return this.last !== false && (this.last+1) < this.grid.store.getCount();
},
hasPrevious : function(){
return !!this.last;
},
getSelections : function(){
return [].concat(this.selections.items);
},
getSelected : function(){
return this.selections.itemAt(0);
},
each : function(fn, scope){
var s = this.getSelections();
for(var i = 0, len = s.length; i < len; i++){
if(fn.call(scope || this, s[i], i) === false){
return false;
}
}
return true;
},
clearSelections : function(fast){
if(this.locked) return;
if(fast !== true){
var ds = this.grid.store;
var s = this.selections;
s.each(function(r){
this.deselectRow(ds.indexOfId(r.id));
}, this);
s.clear();
}else{
this.selections.clear();
}
this.last = false;
},
selectAll : function(){
if(this.locked) return;
this.selections.clear();
for(var i = 0, len = this.grid.store.getCount(); i < len; i++){
this.selectRow(i, true);
}
},
hasSelection : function(){
return this.selections.length > 0;
},
isSelected : function(index){
var r = typeof index == "number" ? this.grid.store.getAt(index) : index;
return (r && this.selections.key(r.id) ? true : false);
},
isIdSelected : function(id){
return (this.selections.key(id) ? true : false);
},
handleMouseDown : function(g, rowIndex, e){
if(e.button !== 0 || this.isLocked()){
return;
};
var view = this.grid.getView();
if(e.shiftKey && this.last !== false){
var last = this.last;
this.selectRange(last, rowIndex, e.ctrlKey);
this.last = last; view.focusRow(rowIndex);
}else{
var isSelected = this.isSelected(rowIndex);
if(e.ctrlKey && isSelected){
this.deselectRow(rowIndex);
}else if(!isSelected || this.getCount() > 1){
this.selectRow(rowIndex, e.ctrlKey || e.shiftKey);
view.focusRow(rowIndex);
}
}
},
selectRows : function(rows, keepExisting){
if(!keepExisting){
this.clearSelections();
}
for(var i = 0, len = rows.length; i < len; i++){
this.selectRow(rows[i], true);
}
},
selectRange : function(startRow, endRow, keepExisting){
if(this.locked) return;
if(!keepExisting){
this.clearSelections();
}
if(startRow <= endRow){
for(var i = startRow; i <= endRow; i++){
this.selectRow(i, true);
}
}else{
for(var i = startRow; i >= endRow; i--){
this.selectRow(i, true);
}
}
},
deselectRange : function(startRow, endRow, preventViewNotify){
if(this.locked) return;
for(var i = startRow; i <= endRow; i++){
this.deselectRow(i, preventViewNotify);
}
},
selectRow : function(index, keepExisting, preventViewNotify){
if(this.locked || (index < 0 || index >= this.grid.store.getCount())) return;
var r = this.grid.store.getAt(index);
if(r && this.fireEvent("beforerowselect", this, index, keepExisting, r) !== false){
if(!keepExisting || this.singleSelect){
this.clearSelections();
}
this.selections.add(r);
this.last = this.lastActive = index;
if(!preventViewNotify){
this.grid.getView().onRowSelect(index);
}
this.fireEvent("rowselect", this, index, r);
this.fireEvent("selectionchange", this);
}
},
deselectRow : function(index, preventViewNotify){
if(this.locked) return;
if(this.last == index){
this.last = false;
}
if(this.lastActive == index){
this.lastActive = false;
}
var r = this.grid.store.getAt(index);
if(r){
this.selections.remove(r);
if(!preventViewNotify){
this.grid.getView().onRowDeselect(index);
}
this.fireEvent("rowdeselect", this, index, r);
this.fireEvent("selectionchange", this);
}
},
restoreLast : function(){
if(this._last){
this.last = this._last;
}
},
acceptsNav : function(row, col, cm){
return !cm.isHidden(col) && cm.isCellEditable(col, row);
},
onEditorKey : function(field, e){
var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
var shift = e.shiftKey;
if(k == e.TAB){
e.stopEvent();
ed.completeEdit();
if(shift){
newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
}else{
newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
}
}else if(k == e.ENTER){
e.stopEvent();
ed.completeEdit();
if(this.moveEditorOnEnter !== false){
if(shift){
newCell = g.walkCells(ed.row - 1, ed.col, -1, this.acceptsNav, this);
}else{
newCell = g.walkCells(ed.row + 1, ed.col, 1, this.acceptsNav, this);
}
}
}else if(k == e.ESC){
ed.cancelEdit();
}
if(newCell){
g.startEditing(newCell[0], newCell[1]);
}
}
});
Ext.grid.CellSelectionModel = function(config){
Ext.apply(this, config);
this.selection = null;
this.addEvents(
"beforecellselect",
"cellselect",
"selectionchange"
);
Ext.grid.CellSelectionModel.superclass.constructor.call(this);
};
Ext.extend(Ext.grid.CellSelectionModel, Ext.grid.AbstractSelectionModel, {
initEvents : function(){
this.grid.on("cellmousedown", this.handleMouseDown, this);
this.grid.getGridEl().on(Ext.isIE ? "keydown" : "keypress", this.handleKeyDown, this);
var view = this.grid.view;
view.on("refresh", this.onViewChange, this);
view.on("rowupdated", this.onRowUpdated, this);
view.on("beforerowremoved", this.clearSelections, this);
view.on("beforerowsinserted", this.clearSelections, this);
if(this.grid.isEditor){
this.grid.on("beforeedit", this.beforeEdit, this);
}
},
beforeEdit : function(e){
this.select(e.row, e.column, false, true, e.record);
},
onRowUpdated : function(v, index, r){
if(this.selection && this.selection.record == r){
v.onCellSelect(index, this.selection.cell[1]);
}
},
onViewChange : function(){
this.clearSelections(true);
},
getSelectedCell : function(){
return this.selection ? this.selection.cell : null;
},
clearSelections : function(preventNotify){
var s = this.selection;
if(s){
if(preventNotify !== true){
this.grid.view.onCellDeselect(s.cell[0], s.cell[1]);
}
this.selection = null;
this.fireEvent("selectionchange", this, null);
}
},
hasSelection : function(){
return this.selection ? true : false;
},
handleMouseDown : function(g, row, cell, e){
if(e.button !== 0 || this.isLocked()){
return;
};
this.select(row, cell);
},
select : function(rowIndex, colIndex, preventViewNotify, preventFocus, r){
if(this.fireEvent("beforecellselect", this, rowIndex, colIndex) !== false){
this.clearSelections();
r = r || this.grid.store.getAt(rowIndex);
this.selection = {
record : r,
cell : [rowIndex, colIndex]
};
if(!preventViewNotify){
var v = this.grid.getView();
v.onCellSelect(rowIndex, colIndex);
if(preventFocus !== true){
v.focusCell(rowIndex, colIndex);
}
}
this.fireEvent("cellselect", this, rowIndex, colIndex);
this.fireEvent("selectionchange", this, this.selection);
}
},
isSelectable : function(rowIndex, colIndex, cm){
return !cm.isHidden(colIndex);
},
handleKeyDown : function(e){
if(!e.isNavKeyPress()){
return;
}
var g = this.grid, s = this.selection;
if(!s){
e.stopEvent();
var cell = g.walkCells(0, 0, 1, this.isSelectable, this);
if(cell){
this.select(cell[0], cell[1]);
}
return;
}
var sm = this;
var walk = function(row, col, step){
return g.walkCells(row, col, step, sm.isSelectable, sm);
};
var k = e.getKey(), r = s.cell[0], c = s.cell[1];
var newCell;
switch(k){
case e.TAB:
if(e.shiftKey){
newCell = walk(r, c-1, -1);
}else{
newCell = walk(r, c+1, 1);
}
break;
case e.DOWN:
newCell = walk(r+1, c, 1);
break;
case e.UP:
newCell = walk(r-1, c, -1);
break;
case e.RIGHT:
newCell = walk(r, c+1, 1);
break;
case e.LEFT:
newCell = walk(r, c-1, -1);
break;
case e.ENTER:
if(g.isEditor && !g.editing){
g.startEditing(r, c);
e.stopEvent();
return;
}
break;
};
if(newCell){
this.select(newCell[0], newCell[1]);
e.stopEvent();
}
},
acceptsNav : function(row, col, cm){
return !cm.isHidden(col) && cm.isCellEditable(col, row);
},
onEditorKey : function(field, e){
var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
if(k == e.TAB){
if(e.shiftKey){
newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
}else{
newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
}
e.stopEvent();
}else if(k == e.ENTER){
ed.completeEdit();
e.stopEvent();
}else if(k == e.ESC){
e.stopEvent();
ed.cancelEdit();
}
if(newCell){
g.startEditing(newCell[0], newCell[1]);
}
}
});
Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, {
clicksToEdit: 2,
isEditor : true,
detectEdit: false,
autoEncode : false,
trackMouseOver: false,
initComponent : function(){
Ext.grid.EditorGridPanel.superclass.initComponent.call(this);
if(!this.selModel){
this.selModel = new Ext.grid.CellSelectionModel();
}
this.activeEditor = null;
this.addEvents(
"beforeedit",
"afteredit",
"validateedit"
);
},
initEvents : function(){
Ext.grid.EditorGridPanel.superclass.initEvents.call(this);
this.on("bodyscroll", this.stopEditing, this, [true]);
if(this.clicksToEdit == 1){
this.on("cellclick", this.onCellDblClick, this);
}else {
if(this.clicksToEdit == 'auto' && this.view.mainBody){
this.view.mainBody.on("mousedown", this.onAutoEditClick, this);
}
this.on("celldblclick", this.onCellDblClick, this);
}
this.getGridEl().addClass("xedit-grid");
},
onCellDblClick : function(g, row, col){
this.startEditing(row, col);
},
onAutoEditClick : function(e, t){
if(e.button !== 0){
return;
}
var row = this.view.findRowIndex(t);
var col = this.view.findCellIndex(t);
if(row !== false && col !== false){
this.stopEditing();
if(this.selModel.getSelectedCell){
var sc = this.selModel.getSelectedCell();
if(sc && sc.cell[0] === row && sc.cell[1] === col){
this.startEditing(row, col);
}
}else{
if(this.selModel.isSelected(row)){
this.startEditing(row, col);
}
}
}
},
onEditComplete : function(ed, value, startValue){
this.editing = false;
this.activeEditor = null;
ed.un("specialkey", this.selModel.onEditorKey, this.selModel);
var r = ed.record;
var field = this.colModel.getDataIndex(ed.col);
value = this.postEditValue(value, startValue, r, field);
if(String(value) !== String(startValue)){
var e = {
grid: this,
record: r,
field: field,
originalValue: startValue,
value: value,
row: ed.row,
column: ed.col,
cancel:false
};
if(this.fireEvent("validateedit", e) !== false && !e.cancel){
r.set(field, e.value);
delete e.cancel;
this.fireEvent("afteredit", e);
}
}
this.view.focusCell(ed.row, ed.col);
},
startEditing : function(row, col){
this.stopEditing();
if(this.colModel.isCellEditable(col, row)){
this.view.ensureVisible(row, col, true);
var r = this.store.getAt(row);
var field = this.colModel.getDataIndex(col);
var e = {
grid: this,
record: r,
field: field,
value: r.data[field],
row: row,
column: col,
cancel:false
};
if(this.fireEvent("beforeedit", e) !== false && !e.cancel){
this.editing = true;
var ed = this.colModel.getCellEditor(col, row);
if(!ed.rendered){
ed.render(this.view.getEditorParent(ed));
}
(function(){
ed.row = row;
ed.col = col;
ed.record = r;
ed.on("complete", this.onEditComplete, this, {single: true});
ed.on("specialkey", this.selModel.onEditorKey, this.selModel);
this.activeEditor = ed;
var v = this.preEditValue(r, field);
ed.startEdit(this.view.getCell(row, col), v);
}).defer(50, this);
}
}
},
preEditValue : function(r, field){
return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlDecode(r.data[field]) : r.data[field];
},
postEditValue : function(value, originalValue, r, field){
return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlEncode(value) : value;
},
stopEditing : function(cancel){
if(this.activeEditor){
this.activeEditor[cancel === true ? 'cancelEdit' : 'completeEdit']();
}
this.activeEditor = null;
}
});
Ext.reg('editorgrid', Ext.grid.EditorGridPanel);
Ext.grid.GridEditor = function(field, config){
Ext.grid.GridEditor.superclass.constructor.call(this, field, config);
field.monitorTab = false;
};
Ext.extend(Ext.grid.GridEditor, Ext.Editor, {
alignment: "tl-tl",
autoSize: "width",
hideEl : false,
cls: "x-small-editor x-grid-editor",
shim:false,
shadow:false
});
Ext.grid.PropertyRecord = Ext.data.Record.create([
{name:'name',type:'string'}, 'value'
]);
Ext.grid.PropertyStore = function(grid, source){
this.grid = grid;
this.store = new Ext.data.Store({
recordType : Ext.grid.PropertyRecord
});
this.store.on('update', this.onUpdate, this);
if(source){
this.setSource(source);
}
Ext.grid.PropertyStore.superclass.constructor.call(this);
};
Ext.extend(Ext.grid.PropertyStore, Ext.util.Observable, {
setSource : function(o){
this.source = o;
this.store.removeAll();
var data = [];
for(var k in o){
if(this.isEditableValue(o[k])){
data.push(new Ext.grid.PropertyRecord({name: k, value: o[k]}, k));
}
}
this.store.loadRecords({records: data}, {}, true);
},
onUpdate : function(ds, record, type){
if(type == Ext.data.Record.EDIT){
var v = record.data['value'];
var oldValue = record.modified['value'];
if(this.grid.fireEvent('beforepropertychange', this.source, record.id, v, oldValue) !== false){
this.source[record.id] = v;
record.commit();
this.grid.fireEvent('propertychange', this.source, record.id, v, oldValue);
}else{
record.reject();
}
}
},
getProperty : function(row){
return this.store.getAt(row);
},
isEditableValue: function(val){
if(Ext.isDate(val)){
return true;
}else if(typeof val == 'object' || typeof val == 'function'){
return false;
}
return true;
},
setValue : function(prop, value){
this.source[prop] = value;
this.store.getById(prop).set('value', value);
},
getSource : function(){
return this.source;
}
});
Ext.grid.PropertyColumnModel = function(grid, store){
this.grid = grid;
var g = Ext.grid;
g.PropertyColumnModel.superclass.constructor.call(this, [
{header: this.nameText, width:50, sortable: true, dataIndex:'name', id: 'name', menuDisabled:true},
{header: this.valueText, width:50, resizable:false, dataIndex: 'value', id: 'value', menuDisabled:true}
]);
this.store = store;
this.bselect = Ext.DomHelper.append(document.body, {
tag: 'select', cls: 'x-grid-editor x-hide-display', children: [
{tag: 'option', value: 'true', html: 'true'},
{tag: 'option', value: 'false', html: 'false'}
]
});
var f = Ext.form;
var bfield = new f.Field({
el:this.bselect,
bselect : this.bselect,
autoShow: true,
getValue : function(){
return this.bselect.value == 'true';
}
});
this.editors = {
'date' : new g.GridEditor(new f.DateField({selectOnFocus:true})),
'string' : new g.GridEditor(new f.TextField({selectOnFocus:true})),
'number' : new g.GridEditor(new f.NumberField({selectOnFocus:true, style:'text-align:left;'})),
'boolean' : new g.GridEditor(bfield)
};
this.renderCellDelegate = this.renderCell.createDelegate(this);
this.renderPropDelegate = this.renderProp.createDelegate(this);
};
Ext.extend(Ext.grid.PropertyColumnModel, Ext.grid.ColumnModel, {
nameText : 'Name',
valueText : 'Value',
dateFormat : 'm/j/Y',
renderDate : function(dateVal){
return dateVal.dateFormat(this.dateFormat);
},
renderBool : function(bVal){
return bVal ? 'true' : 'false';
},
isCellEditable : function(colIndex, rowIndex){
return colIndex == 1;
},
getRenderer : function(col){
return col == 1 ?
this.renderCellDelegate : this.renderPropDelegate;
},
renderProp : function(v){
return this.getPropertyName(v);
},
renderCell : function(val){
var rv = val;
if(Ext.isDate(val)){
rv = this.renderDate(val);
}else if(typeof val == 'boolean'){
rv = this.renderBool(val);
}
return Ext.util.Format.htmlEncode(rv);
},
getPropertyName : function(name){
var pn = this.grid.propertyNames;
return pn && pn[name] ? pn[name] : name;
},
getCellEditor : function(colIndex, rowIndex){
var p = this.store.getProperty(rowIndex);
var n = p.data['name'], val = p.data['value'];
if(this.grid.customEditors[n]){
return this.grid.customEditors[n];
}
if(Ext.isDate(val)){
return this.editors['date'];
}else if(typeof val == 'number'){
return this.editors['number'];
}else if(typeof val == 'boolean'){
return this.editors['boolean'];
}else{
return this.editors['string'];
}
}
});
Ext.grid.PropertyGrid = Ext.extend(Ext.grid.EditorGridPanel, {
enableColumnMove:false,
stripeRows:false,
trackMouseOver: false,
clicksToEdit:1,
enableHdMenu : false,
viewConfig : {
forceFit:true
},
initComponent : function(){
this.customEditors = this.customEditors || {};
this.lastEditRow = null;
var store = new Ext.grid.PropertyStore(this);
this.propStore = store;
var cm = new Ext.grid.PropertyColumnModel(this, store);
store.store.sort('name', 'ASC');
this.addEvents(
'beforepropertychange',
'propertychange'
);
this.cm = cm;
this.ds = store.store;
Ext.grid.PropertyGrid.superclass.initComponent.call(this);
this.selModel.on('beforecellselect', function(sm, rowIndex, colIndex){
if(colIndex === 0){
this.startEditing.defer(200, this, [rowIndex, 1]);
return false;
}
}, this);
},
onRender : function(){
Ext.grid.PropertyGrid.superclass.onRender.apply(this, arguments);
this.getGridEl().addClass('x-props-grid');
},
afterRender: function(){
Ext.grid.PropertyGrid.superclass.afterRender.apply(this, arguments);
if(this.source){
this.setSource(this.source);
}
},
setSource : function(source){
this.propStore.setSource(source);
},
getSource : function(){
return this.propStore.getSource();
}
});
Ext.grid.RowNumberer = function(config){
Ext.apply(this, config);
if(this.rowspan){
this.renderer = this.renderer.createDelegate(this);
}
};
Ext.grid.RowNumberer.prototype = {
header: "",
width: 23,
sortable: false,
fixed:true,
menuDisabled:true,
dataIndex: '',
id: 'numberer',
rowspan: undefined,
renderer : function(v, p, record, rowIndex){
if(this.rowspan){
p.cellAttr = 'rowspan="'+this.rowspan+'"';
}
return rowIndex+1;
}
};
Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {
header: '<div class="x-grid3-hd-checker"> </div>',
width: 20,
sortable: false,
menuDisabled:true,
fixed:true,
dataIndex: '',
id: 'checker',
initEvents : function(){
Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);
this.grid.on('render', function(){
var view = this.grid.getView();
view.mainBody.on('mousedown', this.onMouseDown, this);
Ext.fly(view.innerHd).on('mousedown', this.onHdMouseDown, this);
}, this);
},
onMouseDown : function(e, t){
if(e.button === 0 && t.className == 'x-grid3-row-checker'){
e.stopEvent();
var row = e.getTarget('.x-grid3-row');
if(row){
var index = row.rowIndex;
if(this.isSelected(index)){
this.deselectRow(index);
}else{
this.selectRow(index, true);
}
}
}
},
onHdMouseDown : function(e, t){
if(t.className == 'x-grid3-hd-checker'){
e.stopEvent();
var hd = Ext.fly(t.parentNode);
var isChecked = hd.hasClass('x-grid3-hd-checker-on');
if(isChecked){
hd.removeClass('x-grid3-hd-checker-on');
this.clearSelections();
}else{
hd.addClass('x-grid3-hd-checker-on');
this.selectAll();
}
}
},
renderer : function(v, p, record){
return '<div class="x-grid3-row-checker"> </div>';
}
});
Ext.LoadMask = function(el, config){
this.el = Ext.get(el);
Ext.apply(this, config);
if(this.store){
this.store.on('beforeload', this.onBeforeLoad, this);
this.store.on('load', this.onLoad, this);
this.store.on('loadexception', this.onLoad, this);
this.removeMask = Ext.value(this.removeMask, false);
}else{
var um = this.el.getUpdater();
um.showLoadIndicator = false; um.on('beforeupdate', this.onBeforeLoad, this);
um.on('update', this.onLoad, this);
um.on('failure', this.onLoad, this);
this.removeMask = Ext.value(this.removeMask, true);
}
};
Ext.LoadMask.prototype = {
msg : 'Loading...',
msgCls : 'x-mask-loading',
disabled: false,
disable : function(){
this.disabled = true;
},
enable : function(){
this.disabled = false;
},
onLoad : function(){
this.el.unmask(this.removeMask);
},
onBeforeLoad : function(){
if(!this.disabled){
this.el.mask(this.msg, this.msgCls);
}
},
show: function(){
this.onBeforeLoad();
},
hide: function(){
this.onLoad();
},
destroy : function(){
if(this.store){
this.store.un('beforeload', this.onBeforeLoad, this);
this.store.un('load', this.onLoad, this);
this.store.un('loadexception', this.onLoad, this);
}else{
var um = this.el.getUpdater();
um.un('beforeupdate', this.onBeforeLoad, this);
um.un('update', this.onLoad, this);
um.un('failure', this.onLoad, this);
}
}
};
Ext.ProgressBar = Ext.extend(Ext.BoxComponent, {
baseCls : 'x-progress',
waitTimer : null,
initComponent : function(){
Ext.ProgressBar.superclass.initComponent.call(this);
this.addEvents(
"update"
);
},
onRender : function(ct, position){
Ext.ProgressBar.superclass.onRender.call(this, ct, position);
var tpl = new Ext.Template(
'<div class="{cls}-wrap">',
'<div class="{cls}-inner">',
'<div class="{cls}-bar">',
'<div class="{cls}-text">',
'<div> </div>',
'</div>',
'</div>',
'<div class="{cls}-text {cls}-text-back">',
'<div> </div>',
'</div>',
'</div>',
'</div>'
);
if(position){
this.el = tpl.insertBefore(position, {cls: this.baseCls}, true);
}else{
this.el = tpl.append(ct, {cls: this.baseCls}, true);
}
if(this.id){
this.el.dom.id = this.id;
}
var inner = this.el.dom.firstChild;
this.progressBar = Ext.get(inner.firstChild);
if(this.textEl){
this.textEl = Ext.get(this.textEl);
delete this.textTopEl;
}else{
this.textTopEl = Ext.get(this.progressBar.dom.firstChild);
var textBackEl = Ext.get(inner.childNodes[1]);
this.textTopEl.setStyle("z-index", 99).addClass('x-hidden');
this.textEl = new Ext.CompositeElement([this.textTopEl.dom.firstChild, textBackEl.dom.firstChild]);
this.textEl.setWidth(inner.offsetWidth);
}
if(this.value){
this.updateProgress(this.value, this.text);
}else{
this.updateText(this.text);
}
this.setSize(this.width || 'auto', 'auto');
this.progressBar.setHeight(inner.offsetHeight);
},
updateProgress : function(value, text){
this.value = value || 0;
if(text){
this.updateText(text);
}
var w = Math.floor(value*this.el.dom.firstChild.offsetWidth);
this.progressBar.setWidth(w);
if(this.textTopEl){
this.textTopEl.removeClass('x-hidden').setWidth(w);
}
this.fireEvent('update', this, value, text);
return this;
},
wait : function(o){
if(!this.waitTimer){
var scope = this;
o = o || {};
this.waitTimer = Ext.TaskMgr.start({
run: function(i){
var inc = o.increment || 10;
this.updateProgress(((((i+inc)%inc)+1)*(100/inc))*.01);
},
interval: o.interval || 1000,
duration: o.duration,
onStop: function(){
if(o.fn){
o.fn.apply(o.scope || this);
}
this.reset();
},
scope: scope
});
}
return this;
},
isWaiting : function(){
return this.waitTimer != null;
},
updateText : function(text){
this.text = text || ' ';
this.textEl.update(this.text);
return this;
},
setSize : function(w, h){
Ext.ProgressBar.superclass.setSize.call(this, w, h);
if(this.textTopEl){
var inner = this.el.dom.firstChild;
this.textEl.setSize(inner.offsetWidth, inner.offsetHeight);
}
return this;
},
reset : function(hide){
this.updateProgress(0);
if(this.textTopEl){
this.textTopEl.addClass('x-hidden');
}
if(this.waitTimer){
this.waitTimer.onStop = null;
Ext.TaskMgr.stop(this.waitTimer);
this.waitTimer = null;
}
if(hide === true){
this.hide();
}
return this;
}
});
Ext.reg('progress', Ext.ProgressBar);
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 tabs = new Ext.TabPanel({
activeTab: 0,
border: false,
tabPosition: 'bottom',
items: [{
title: 'Debug Console',
layout:'border',
items: [logView, scriptPanel]
},{
title: 'DOM Inspector',
layout:'border',
items: [tree]
}]
});
cp = new Ext.Panel({
id: 'x-debug-browser',
title: 'Console',
collapsible: true,
animCollapse: false,
style: 'position:absolute;left:0;bottom:0;',
height:200,
logView: logView,
layout: 'fit',
tools:[{
id: 'close',
handler: function(){
cp.destroy();
cp = null;
Ext.EventManager.removeResizeListener(handleResize);
}
}],
items: tabs
});
cp.render(document.body);
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();
}
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, ' '),
'</div>'].join('');
this.body.insertHtml('beforeend', markup);
this.body.scrollTo('top', 100000);
},
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);
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){ return false;
}
}
cn.select();
var a = cn.ui.anchor;
treeEl.dom.scrollTop = Math.max(0 ,a.offsetTop-10);
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();
};
this.root = this.setRootNode(new Ext.tree.TreeNode('Ext'));
hnode = this.root.appendChild(new Ext.debug.HtmlNode(
document.getElementsByTagName('html')[0]
));
}
});
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 = '<' + 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 + '="<i>' + html(v) +'</i>"';
}
}
var style = n.style ? n.style.cssText : '';
if(style){
s += ' style="<i>' + html(style.toLowerCase()) +'</i>"';
}
if(leaf && n.childNodes.length > 0){
s+='><em>' + ellipsis(html(String(n.innerHTML)), 35) + '</em></'+tag+'>';
}else if(leaf){
s += ' />';
}else{
s += '>';
}
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; 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:'</' + this.tagName + '>',
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(){
},
highlight : function(){
},
frame : function(){
this.htmlNode.style.border = '1px solid #0000ff';
},
unframe : function(){
this.htmlNode.style.border = '';
}
});
return HtmlNode;
}();
| JavaScript |
/**
* @class Ext.ux.ColorField
* @extends Ext.form.TriggerField
* Provides a color input field with a {@link Ext.ColorPalette} dropdown.
* @constructor
* Create a new ColorField
* <br />Example:
* <pre><code>
var color_field = new Ext.ux.ColorField({
fieldLabel: 'Color',
id: 'color',
width: 175,
allowBlank: false
});
</code></pre>
* @param {Object} config
*/
Ext.ux.ColorField = Ext.extend(Ext.form.TriggerField, {
/**
* @cfg {String} invalidText
* The error to display when the color in the field is invalid (defaults to
* '{value} is not a valid color - it must be in the format {format}').
*/
invalidText : "'{0}' is not a valid color - it must be in a the hex format (# followed by 3 or 6 letters/numbers 0-9 A-F)",
/**
* @cfg {String} triggerClass
* An additional CSS class used to style the trigger button. The trigger will always get the
* class 'x-form-trigger' and triggerClass will be <b>appended</b> if specified (defaults to 'x-form-color-trigger'
* which displays a color wheel icon).
*/
triggerClass : 'x-form-color-trigger',
/**
* @cfg {String/Object} autoCreate
* A DomHelper element spec, or true for a default element spec (defaults to
* {tag: "input", type: "text", size: "10", autocomplete: "off"})
*/
// private
defaultAutoCreate : {tag: "input", type: "text", size: "10", maxlength: "7", autocomplete: "off"},
// Limit input to hex values
maskRe: /[#a-f0-9]/i,
facade: undefined,
// private
validateValue : function(value){
if(!Ext.ux.ColorField.superclass.validateValue.call(this, value)){
return false;
}
if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
this.setColor('');
return true;
}
var parseOK = this.parseColor(value);
if(!value || (parseOK == false)){
this.markInvalid(String.format(this.invalidText,value));
return false;
}
this.setColor(value);
return true;
},
/**
* Sets the current color and changes the background.
* Does *not* change the value of the field.
* @param {String} hex The color value.
*/
setColor : function(color) {
if (color=='' || color==undefined)
{
if (this.emptyText!='' && this.parseColor(this.emptyText))
color=this.emptyText;
else
color='transparent';
}
if (this.trigger)
this.trigger.setStyle( {
'background-color': color
});
else
{
this.on('render',function(){this.setColor(color)},this);
}
},
// private
// Provides logic to override the default TriggerField.validateBlur which just returns true
validateBlur : function(){
return !this.menu || !this.menu.isVisible();
},
/**
* Returns the current value of the color field
* @return {String} value The color value
*/
getValue : function(){
return Ext.ux.ColorField.superclass.getValue.call(this) || "";
},
/**
* Sets the value of the color field. You can pass a string that can be parsed into a valid HTML color
* <br />Usage:
* <pre><code>
colorField.setValue('#FFFFFF');
</code></pre>
* @param {String} color The color string
*/
setValue : function(color){
Ext.ux.ColorField.superclass.setValue.call(this, this.formatColor(color));
this.setColor( this.formatColor(color));
},
// private
parseColor : function(value){
return (!value || (value.substring(0,1) != '#')) ?
false : (value.length==4 || value.length==7 );
},
// private
formatColor : function(value){
if (!value || this.parseColor(value))
return value;
if (value.length==3 || value.length==6) {
return '#' + value;
}
return '';
},
// private
menuListeners : {
select: function(e, c){
this.setValue(c);
},
show : function(){ // retain focus styling
this.onFocus();
},
hide : function(){
this.focus.defer(10, this);
var ml = this.menuListeners;
this.menu.un("select", ml.select, this);
this.menu.un("show", ml.show, this);
this.menu.un("hide", ml.hide, this);
}
},
// private
// Implements the default empty TriggerField.onTriggerClick function to display the ColorPalette
onTriggerClick : function(){
if(this.disabled){
return;
}
if(this.menu == null){
this.menu = new Ext.menu.ColorMenu();
}
this.menu.on(Ext.apply({}, this.menuListeners, {
scope:this
}));
this.menu.show(this.el, "tl-bl?");
}
});
Ext.reg('colorfield',Ext.ux.ColorField);
| JavaScript |
<?xml version="1.0" encoding="utf-8"?>
<project path="" name="Ext - Resources" author="Ext JS, LLC" version="2.0.2" copyright="Ext JS Library $version
Copyright(c) 2006-2008, $author.
licensing@extjs.com

http://extjs.com/license" output="C:\apps\www\deploy\ext-2.0.2\resources" source="true" source-dir="$output" minify="False" min-dir="$output\build" doc="False" doc-dir="$output\docs" master="true" master-file="$output\yui-ext.js" zip="true" zip-file="$output\yuo-ext.$version.zip">
<directory name="" />
<target name="All css" file="$output\css\ext-all.css" debug="True" shorthand="False" shorthand-list="YAHOO.util.Dom.setStyle
YAHOO.util.Dom.getStyle
YAHOO.util.Dom.getRegion
YAHOO.util.Dom.getViewportHeight
YAHOO.util.Dom.getViewportWidth
YAHOO.util.Dom.get
YAHOO.util.Dom.getXY
YAHOO.util.Dom.setXY
YAHOO.util.CustomEvent
YAHOO.util.Event.addListener
YAHOO.util.Event.getEvent
YAHOO.util.Event.getTarget
YAHOO.util.Event.preventDefault
YAHOO.util.Event.stopEvent
YAHOO.util.Event.stopPropagation
YAHOO.util.Event.stopEvent
YAHOO.util.Anim
YAHOO.util.Motion
YAHOO.util.Connect.asyncRequest
YAHOO.util.Connect.setForm
YAHOO.util.Dom
YAHOO.util.Event">
<include name="css\reset.css" />
<include name="css\core.css" />
<include name="css\tabs.css" />
<include name="css\form.css" />
<include name="css\button.css" />
<include name="css\toolbar.css" />
<include name="css\resizable.css" />
<include name="css\grid.css" />
<include name="css\dd.css" />
<include name="css\tree.css" />
<include name="css\date-picker.css" />
<include name="css\qtips.css" />
<include name="css\menu.css" />
<include name="css\box.css" />
<include name="css\debug.css" />
<include name="css\combo.css" />
<include name="css\panel.css" />
<include name="css\window.css" />
<include name="css\editor.css" />
<include name="css\borders.css" />
<include name="css\layout.css" />
<include name="css\progress.css" />
<include name="css\dialog.css" />
</target>
<file name="images\basic-dialog\gray\close.gif" path="images\basic-dialog\gray" />
<file name="images\basic-dialog\gray\dlg-bg.gif" path="images\basic-dialog\gray" />
<file name="images\basic-dialog\gray\e-handle.gif" path="images\basic-dialog\gray" />
<file name="images\basic-dialog\gray\hd-sprite.gif" path="images\basic-dialog\gray" />
<file name="images\basic-dialog\gray\s-handle.gif" path="images\basic-dialog\gray" />
<file name="images\basic-dialog\gray\se-handle.gif" path="images\basic-dialog\gray" />
<file name="images\basic-dialog\btn-sprite.gif" path="images\basic-dialog" />
<file name="images\basic-dialog\close.gif" path="images\basic-dialog" />
<file name="images\basic-dialog\e-handle.gif" path="images\basic-dialog" />
<file name="images\basic-dialog\hd-sprite.gif" path="images\basic-dialog" />
<file name="images\basic-dialog\s-handle.gif" path="images\basic-dialog" />
<file name="images\basic-dialog\se-handle.gif" path="images\basic-dialog" />
<file name="images\grid\arrow-left-white.gif" path="images\grid" />
<file name="images\grid\arrow-right-white.gif" path="images\grid" />
<file name="images\grid\done.gif" path="images\grid" />
<file name="images\grid\drop-no.gif" path="images\grid" />
<file name="images\grid\drop-yes.gif" path="images\grid" />
<file name="images\grid\footer-bg.gif" path="images\grid" />
<file name="images\grid\grid-blue-hd.gif" path="images\grid" />
<file name="images\grid\grid-blue-split.gif" path="images\grid" />
<file name="images\grid\grid-loading.gif" path="images\grid" />
<file name="images\grid\grid-split.gif" path="images\grid" />
<file name="images\grid\grid-vista-hd.gif" path="images\grid" />
<file name="images\grid\invalid_line.gif" path="images\grid" />
<file name="images\grid\loading.gif" path="images\grid" />
<file name="images\grid\mso-hd.gif" path="images\grid" />
<file name="images\grid\nowait.gif" path="images\grid" />
<file name="images\grid\page-first-disabled.gif" path="images\grid" />
<file name="images\grid\page-first.gif" path="images\grid" />
<file name="images\grid\page-last-disabled.gif" path="images\grid" />
<file name="images\grid\page-last.gif" path="images\grid" />
<file name="images\grid\page-next-disabled.gif" path="images\grid" />
<file name="images\grid\page-next.gif" path="images\grid" />
<file name="images\grid\page-prev-disabled.gif" path="images\grid" />
<file name="images\grid\page-prev.gif" path="images\grid" />
<file name="images\grid\pick-button.gif" path="images\grid" />
<file name="images\grid\refresh.gif" path="images\grid" />
<file name="images\grid\sort_asc.gif" path="images\grid" />
<file name="images\grid\sort_desc.gif" path="images\grid" />
<file name="images\grid\wait.gif" path="images\grid" />
<file name="images\layout\gray\collapse.gif" path="images\layout\gray" />
<file name="images\layout\gray\expand.gif" path="images\layout\gray" />
<file name="images\layout\gray\gradient-bg.gif" path="images\layout\gray" />
<file name="images\layout\gray\ns-collapse.gif" path="images\layout\gray" />
<file name="images\layout\gray\ns-expand.gif" path="images\layout\gray" />
<file name="images\layout\gray\panel-close.gif" path="images\layout\gray" />
<file name="images\layout\gray\panel-title-bg.gif" path="images\layout\gray" />
<file name="images\layout\gray\panel-title-light-bg.gif" path="images\layout\gray" />
<file name="images\layout\gray\screenshot.gif" path="images\layout\gray" />
<file name="images\layout\gray\tab-close-on.gif" path="images\layout\gray" />
<file name="images\layout\gray\tab-close.gif" path="images\layout\gray" />
<file name="images\layout\collapse.gif" path="images\layout" />
<file name="images\layout\expand.gif" path="images\layout" />
<file name="images\layout\gradient-bg.gif" path="images\layout" />
<file name="images\layout\ns-collapse.gif" path="images\layout" />
<file name="images\layout\ns-expand.gif" path="images\layout" />
<file name="images\layout\panel-close.gif" path="images\layout" />
<file name="images\layout\panel-title-bg.gif" path="images\layout" />
<file name="images\layout\panel-title-light-bg.gif" path="images\layout" />
<file name="images\layout\tab-close-on.gif" path="images\layout" />
<file name="images\layout\tab-close.gif" path="images\layout" />
<file name="images\sizer\gray\e-handle-dark.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\e-handle.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\ne-handle-dark.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\ne-handle.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\nw-handle-dark.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\nw-handle.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\s-handle-dark.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\s-handle.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\se-handle-dark.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\se-handle.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\sw-handle-dark.gif" path="images\sizer\gray" />
<file name="images\sizer\gray\sw-handle.gif" path="images\sizer\gray" />
<file name="images\sizer\e-handle-dark.gif" path="images\sizer" />
<file name="images\sizer\e-handle.gif" path="images\sizer" />
<file name="images\sizer\ne-handle-dark.gif" path="images\sizer" />
<file name="images\sizer\ne-handle.gif" path="images\sizer" />
<file name="images\sizer\nw-handle-dark.gif" path="images\sizer" />
<file name="images\sizer\nw-handle.gif" path="images\sizer" />
<file name="images\sizer\s-handle-dark.gif" path="images\sizer" />
<file name="images\sizer\s-handle.gif" path="images\sizer" />
<file name="images\sizer\se-handle-dark.gif" path="images\sizer" />
<file name="images\sizer\se-handle.gif" path="images\sizer" />
<file name="images\sizer\square.gif" path="images\sizer" />
<file name="images\sizer\sw-handle-dark.gif" path="images\sizer" />
<file name="images\sizer\sw-handle.gif" path="images\sizer" />
<file name="images\tabs\gray\tab-btm-inactive-left-bg.gif" path="images\tabs\gray" />
<file name="images\tabs\gray\tab-btm-inactive-right-bg.gif" path="images\tabs\gray" />
<file name="images\tabs\gray\tab-btm-left-bg.gif" path="images\tabs\gray" />
<file name="images\tabs\gray\tab-btm-right-bg.gif" path="images\tabs\gray" />
<file name="images\tabs\gray\tab-sprite.gif" path="images\tabs\gray" />
<file name="images\tabs\tab-btm-inactive-left-bg.gif" path="images\tabs" />
<file name="images\tabs\tab-btm-inactive-right-bg.gif" path="images\tabs" />
<file name="images\tabs\tab-btm-left-bg.gif" path="images\tabs" />
<file name="images\tabs\tab-btm-right-bg.gif" path="images\tabs" />
<file name="images\tabs\tab-sprite.gif" path="images\tabs" />
<file name="images\toolbar\gray-bg.gif" path="images\toolbar" />
<file name="images\gradient-bg.gif" path="images" />
<file name="images\s.gif" path="images" />
<file name="images\toolbar\btn-over-bg.gif" path="images\toolbar" />
<file name="images\dd\drop-add.gif" path="images\dd" />
<file name="images\dd\drop-no.gif" path="images\dd" />
<file name="images\dd\drop-yes.gif" path="images\dd" />
<file name="images\qtip\bg.gif" path="images\qtip" />
<file name="images\tree\drop-add.gif" path="images\tree" />
<file name="images\tree\drop-between.gif" path="images\tree" />
<file name="images\tree\drop-no.gif" path="images\tree" />
<file name="images\tree\drop-over.gif" path="images\tree" />
<file name="images\tree\drop-under.gif" path="images\tree" />
<file name="images\tree\drop-yes.gif" path="images\tree" />
<file name="images\tree\elbow-end-minus-nl.gif" path="images\tree" />
<file name="images\tree\elbow-end-minus.gif" path="images\tree" />
<file name="images\tree\elbow-end-plus-nl.gif" path="images\tree" />
<file name="images\tree\elbow-end-plus.gif" path="images\tree" />
<file name="images\tree\elbow-end.gif" path="images\tree" />
<file name="images\tree\elbow-line.gif" path="images\tree" />
<file name="images\tree\elbow-minus-nl.gif" path="images\tree" />
<file name="images\tree\elbow-minus.gif" path="images\tree" />
<file name="images\tree\elbow-plus-nl.gif" path="images\tree" />
<file name="images\tree\elbow-plus.gif" path="images\tree" />
<file name="images\tree\elbow.gif" path="images\tree" />
<file name="images\tree\folder-open.gif" path="images\tree" />
<file name="images\tree\folder.gif" path="images\tree" />
<file name="images\tree\leaf.gif" path="images\tree" />
<file name="images\tree\s.gif" path="images\tree" />
<file name="images\qtip\gray\bg.gif" path="images\qtip\gray" />
<file name="css\aero.css" path="css" />
<file name="images\grid\grid-hrow.gif" path="images\grid" />
<file name="images\aero\toolbar\gray-bg.gif" path="images\aero\toolbar" />
<file name="css\basic-dialog.css" path="css" />
<file name="css\button.css" path="css" />
<file name="css\core.css" path="css" />
<file name="css\dd.css" path="css" />
<file name="css\grid.css" path="css" />
<file name="css\inline-editor.css" path="css" />
<file name="css\layout.css" path="css" />
<file name="css\qtips.css" path="css" />
<file name="css\reset-min.css" path="css" />
<file name="css\resizable.css" path="css" />
<file name="css\tabs.css" path="css" />
<file name="css\toolbar.css" path="css" />
<file name="css\tree.css" path="css" />
<file name="css\ytheme-aero.css" path="css" />
<file name="css\ytheme-gray.css" path="css" />
<file name="css\ytheme-vista.css" path="css" />
<file name="images\aero\basic-dialog\aero-close-over.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\aero-close.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\bg-center.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\bg-left.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\bg-right.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\close.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\dlg-bg.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\e-handle.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\hd-sprite.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\s-handle.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\se-handle.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\w-handle.gif" path="images\aero\basic-dialog" />
<file name="images\aero\grid\grid-blue-split.gif" path="images\aero\grid" />
<file name="images\aero\grid\grid-hrow.gif" path="images\aero\grid" />
<file name="images\aero\grid\grid-split.gif" path="images\aero\grid" />
<file name="images\aero\grid\grid-vista-hd.gif" path="images\aero\grid" />
<file name="images\aero\grid\sort-col-bg.gif" path="images\aero\grid" />
<file name="images\aero\grid\sort_asc.gif" path="images\aero\grid" />
<file name="images\aero\grid\sort_desc.gif" path="images\aero\grid" />
<file name="images\aero\layout\collapse.gif" path="images\aero\layout" />
<file name="images\aero\layout\expand.gif" path="images\aero\layout" />
<file name="images\aero\layout\gradient-bg.gif" path="images\aero\layout" />
<file name="images\aero\layout\ns-collapse.gif" path="images\aero\layout" />
<file name="images\aero\layout\ns-expand.gif" path="images\aero\layout" />
<file name="images\aero\layout\panel-close.gif" path="images\aero\layout" />
<file name="images\aero\layout\panel-title-bg.gif" path="images\aero\layout" />
<file name="images\aero\layout\panel-title-light-bg.gif" path="images\aero\layout" />
<file name="images\aero\layout\tab-close-on.gif" path="images\aero\layout" />
<file name="images\aero\layout\tab-close.gif" path="images\aero\layout" />
<file name="images\aero\qtip\bg.gif" path="images\aero\qtip" />
<file name="images\aero\sizer\e-handle-dark.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\e-handle.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\ne-handle-dark.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\ne-handle.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\nw-handle-dark.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\nw-handle.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\s-handle-dark.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\s-handle.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\se-handle-dark.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\se-handle.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\sw-handle-dark.gif" path="images\aero\sizer" />
<file name="images\aero\sizer\sw-handle.gif" path="images\aero\sizer" />
<file name="images\aero\tabs\tab-btm-inactive-left-bg.gif" path="images\aero\tabs" />
<file name="images\aero\tabs\tab-btm-inactive-right-bg.gif" path="images\aero\tabs" />
<file name="images\aero\tabs\tab-btm-left-bg.gif" path="images\aero\tabs" />
<file name="images\aero\tabs\tab-btm-right-bg.gif" path="images\aero\tabs" />
<file name="images\aero\tabs\tab-sprite.gif" path="images\aero\tabs" />
<file name="images\aero\tabs\tab-strip-bg.gif" path="images\aero\tabs" />
<file name="images\aero\tabs\tab-strip-bg.png" path="images\aero\tabs" />
<file name="images\aero\tabs\tab-strip-btm-bg.gif" path="images\aero\tabs" />
<file name="images\aero\toolbar\bg.gif" path="images\aero\toolbar" />
<file name="images\aero\gradient-bg.gif" path="images\aero" />
<file name="images\aero\s.gif" path="images\aero" />
<file name="images\default\basic-dialog\btn-sprite.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\close.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\e-handle.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\hd-sprite.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\progress.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\progress2.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\s-handle.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\se-handle.gif" path="images\default\basic-dialog" />
<file name="images\default\dd\drop-add.gif" path="images\default\dd" />
<file name="images\default\dd\drop-no.gif" path="images\default\dd" />
<file name="images\default\dd\drop-yes.gif" path="images\default\dd" />
<file name="images\default\grid\arrow-left-white.gif" path="images\default\grid" />
<file name="images\default\grid\arrow-right-white.gif" path="images\default\grid" />
<file name="images\default\grid\done.gif" path="images\default\grid" />
<file name="images\default\grid\drop-no.gif" path="images\default\grid" />
<file name="images\default\grid\drop-yes.gif" path="images\default\grid" />
<file name="images\default\grid\footer-bg.gif" path="images\default\grid" />
<file name="images\default\grid\grid-blue-hd.gif" path="images\default\grid" />
<file name="images\default\grid\grid-blue-split.gif" path="images\default\grid" />
<file name="images\default\grid\grid-hrow.gif" path="images\default\grid" />
<file name="images\default\grid\grid-loading.gif" path="images\default\grid" />
<file name="images\default\grid\grid-split.gif" path="images\default\grid" />
<file name="images\default\grid\grid-vista-hd.gif" path="images\default\grid" />
<file name="images\default\grid\invalid_line.gif" path="images\default\grid" />
<file name="images\default\grid\loading.gif" path="images\default\grid" />
<file name="images\default\grid\mso-hd.gif" path="images\default\grid" />
<file name="images\default\grid\nowait.gif" path="images\default\grid" />
<file name="images\default\grid\page-first-disabled.gif" path="images\default\grid" />
<file name="images\default\grid\page-first.gif" path="images\default\grid" />
<file name="images\default\grid\page-last-disabled.gif" path="images\default\grid" />
<file name="images\default\grid\page-last.gif" path="images\default\grid" />
<file name="images\default\grid\page-next-disabled.gif" path="images\default\grid" />
<file name="images\default\grid\page-next.gif" path="images\default\grid" />
<file name="images\default\grid\page-prev-disabled.gif" path="images\default\grid" />
<file name="images\default\grid\page-prev.gif" path="images\default\grid" />
<file name="images\default\grid\pick-button.gif" path="images\default\grid" />
<file name="images\default\grid\refresh.gif" path="images\default\grid" />
<file name="images\default\grid\sort_asc.gif" path="images\default\grid" />
<file name="images\default\grid\sort_desc.gif" path="images\default\grid" />
<file name="images\default\grid\wait.gif" path="images\default\grid" />
<file name="images\default\layout\collapse.gif" path="images\default\layout" />
<file name="images\default\layout\expand.gif" path="images\default\layout" />
<file name="images\default\layout\gradient-bg.gif" path="images\default\layout" />
<file name="images\default\layout\ns-collapse.gif" path="images\default\layout" />
<file name="images\default\layout\ns-expand.gif" path="images\default\layout" />
<file name="images\default\layout\panel-close.gif" path="images\default\layout" />
<file name="images\default\layout\panel-title-bg.gif" path="images\default\layout" />
<file name="images\default\layout\panel-title-light-bg.gif" path="images\default\layout" />
<file name="images\default\layout\tab-close-on.gif" path="images\default\layout" />
<file name="images\default\layout\tab-close.gif" path="images\default\layout" />
<file name="images\default\qtip\bg.gif" path="images\default\qtip" />
<file name="images\default\sizer\e-handle-dark.gif" path="images\default\sizer" />
<file name="images\default\sizer\e-handle.gif" path="images\default\sizer" />
<file name="images\default\sizer\ne-handle-dark.gif" path="images\default\sizer" />
<file name="images\default\sizer\ne-handle.gif" path="images\default\sizer" />
<file name="images\default\sizer\nw-handle-dark.gif" path="images\default\sizer" />
<file name="images\default\sizer\nw-handle.gif" path="images\default\sizer" />
<file name="images\default\sizer\s-handle-dark.gif" path="images\default\sizer" />
<file name="images\default\sizer\s-handle.gif" path="images\default\sizer" />
<file name="images\default\sizer\se-handle-dark.gif" path="images\default\sizer" />
<file name="images\default\sizer\se-handle.gif" path="images\default\sizer" />
<file name="images\default\sizer\square.gif" path="images\default\sizer" />
<file name="images\default\sizer\sw-handle-dark.gif" path="images\default\sizer" />
<file name="images\default\sizer\sw-handle.gif" path="images\default\sizer" />
<file name="images\default\tabs\tab-btm-inactive-left-bg.gif" path="images\default\tabs" />
<file name="images\default\tabs\tab-btm-inactive-right-bg.gif" path="images\default\tabs" />
<file name="images\default\tabs\tab-btm-left-bg.gif" path="images\default\tabs" />
<file name="images\default\tabs\tab-btm-right-bg.gif" path="images\default\tabs" />
<file name="images\default\tabs\tab-sprite.gif" path="images\default\tabs" />
<file name="images\default\toolbar\btn-over-bg.gif" path="images\default\toolbar" />
<file name="images\default\toolbar\gray-bg.gif" path="images\default\toolbar" />
<file name="images\default\tree\drop-add.gif" path="images\default\tree" />
<file name="images\default\tree\drop-between.gif" path="images\default\tree" />
<file name="images\default\tree\drop-no.gif" path="images\default\tree" />
<file name="images\default\tree\drop-over.gif" path="images\default\tree" />
<file name="images\default\tree\drop-under.gif" path="images\default\tree" />
<file name="images\default\tree\drop-yes.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-end-minus-nl.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-end-minus.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-end-plus-nl.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-end-plus.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-end.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-line.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-minus-nl.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-minus.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-plus-nl.gif" path="images\default\tree" />
<file name="images\default\tree\elbow-plus.gif" path="images\default\tree" />
<file name="images\default\tree\elbow.gif" path="images\default\tree" />
<file name="images\default\tree\folder-open.gif" path="images\default\tree" />
<file name="images\default\tree\folder.gif" path="images\default\tree" />
<file name="images\default\tree\leaf.gif" path="images\default\tree" />
<file name="images\default\tree\loading.gif" path="images\default\tree" />
<file name="images\default\tree\s.gif" path="images\default\tree" />
<file name="images\default\gradient-bg.gif" path="images\default" />
<file name="images\default\s.gif" path="images\default" />
<file name="images\gray\basic-dialog\close.gif" path="images\gray\basic-dialog" />
<file name="images\gray\basic-dialog\dlg-bg.gif" path="images\gray\basic-dialog" />
<file name="images\gray\basic-dialog\e-handle.gif" path="images\gray\basic-dialog" />
<file name="images\gray\basic-dialog\hd-sprite.gif" path="images\gray\basic-dialog" />
<file name="images\gray\basic-dialog\s-handle.gif" path="images\gray\basic-dialog" />
<file name="images\gray\basic-dialog\se-handle.gif" path="images\gray\basic-dialog" />
<file name="images\gray\layout\collapse.gif" path="images\gray\layout" />
<file name="images\gray\layout\expand.gif" path="images\gray\layout" />
<file name="images\gray\layout\gradient-bg.gif" path="images\gray\layout" />
<file name="images\gray\layout\ns-collapse.gif" path="images\gray\layout" />
<file name="images\gray\layout\ns-expand.gif" path="images\gray\layout" />
<file name="images\gray\layout\panel-close.gif" path="images\gray\layout" />
<file name="images\gray\layout\panel-title-bg.gif" path="images\gray\layout" />
<file name="images\gray\layout\panel-title-light-bg.gif" path="images\gray\layout" />
<file name="images\gray\layout\tab-close-on.gif" path="images\gray\layout" />
<file name="images\gray\layout\tab-close.gif" path="images\gray\layout" />
<file name="images\gray\qtip\bg.gif" path="images\gray\qtip" />
<file name="images\gray\sizer\e-handle-dark.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\e-handle.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\ne-handle-dark.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\ne-handle.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\nw-handle-dark.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\nw-handle.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\s-handle-dark.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\s-handle.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\se-handle-dark.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\se-handle.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\sw-handle-dark.gif" path="images\gray\sizer" />
<file name="images\gray\sizer\sw-handle.gif" path="images\gray\sizer" />
<file name="images\gray\tabs\tab-btm-inactive-left-bg.gif" path="images\gray\tabs" />
<file name="images\gray\tabs\tab-btm-inactive-right-bg.gif" path="images\gray\tabs" />
<file name="images\gray\tabs\tab-btm-left-bg.gif" path="images\gray\tabs" />
<file name="images\gray\tabs\tab-btm-right-bg.gif" path="images\gray\tabs" />
<file name="images\gray\tabs\tab-sprite.gif" path="images\gray\tabs" />
<file name="images\gray\toolbar\gray-bg.gif" path="images\gray\toolbar" />
<file name="images\gray\gradient-bg.gif" path="images\gray" />
<file name="images\gray\s.gif" path="images\gray" />
<file name="images\vista\basic-dialog\bg-center.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\bg-left.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\bg-right.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\close.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\dlg-bg.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\e-handle.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\hd-sprite.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\s-handle.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\se-handle.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\w-handle.gif" path="images\vista\basic-dialog" />
<file name="images\vista\grid\grid-split.gif" path="images\vista\grid" />
<file name="images\vista\grid\grid-vista-hd.gif" path="images\vista\grid" />
<file name="images\vista\layout\collapse.gif" path="images\vista\layout" />
<file name="images\vista\layout\expand.gif" path="images\vista\layout" />
<file name="images\vista\layout\gradient-bg.gif" path="images\vista\layout" />
<file name="images\vista\layout\ns-collapse.gif" path="images\vista\layout" />
<file name="images\vista\layout\ns-expand.gif" path="images\vista\layout" />
<file name="images\vista\layout\panel-close.gif" path="images\vista\layout" />
<file name="images\vista\layout\panel-title-bg.gif" path="images\vista\layout" />
<file name="images\vista\layout\panel-title-light-bg.gif" path="images\vista\layout" />
<file name="images\vista\layout\tab-close-on.gif" path="images\vista\layout" />
<file name="images\vista\layout\tab-close.gif" path="images\vista\layout" />
<file name="images\vista\qtip\bg.gif" path="images\vista\qtip" />
<file name="images\vista\sizer\e-handle-dark.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\e-handle.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\ne-handle-dark.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\ne-handle.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\nw-handle-dark.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\nw-handle.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\s-handle-dark.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\s-handle.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\se-handle-dark.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\se-handle.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\sw-handle-dark.gif" path="images\vista\sizer" />
<file name="images\vista\sizer\sw-handle.gif" path="images\vista\sizer" />
<file name="images\vista\tabs\tab-btm-inactive-left-bg.gif" path="images\vista\tabs" />
<file name="images\vista\tabs\tab-btm-inactive-right-bg.gif" path="images\vista\tabs" />
<file name="images\vista\tabs\tab-btm-left-bg.gif" path="images\vista\tabs" />
<file name="images\vista\tabs\tab-btm-right-bg.gif" path="images\vista\tabs" />
<file name="images\vista\tabs\tab-sprite.gif" path="images\vista\tabs" />
<file name="images\vista\toolbar\gray-bg.gif" path="images\vista\toolbar" />
<file name="images\vista\gradient-bg.gif" path="images\vista" />
<file name="images\vista\s.gif" path="images\vista" />
<file name="images\default\grid\col-move.gif" path="images\default\grid" />
<file name="images\default\grid\col-move-bottom.gif" path="images\default\grid" />
<file name="images\default\grid\col-move-top.gif" path="images\default\grid" />
<file name="images\default\basic-dialog\btn-arrow.gif" path="images\default\basic-dialog" />
<file name="images\default\toolbar\tb-btn-sprite.gif" path="images\default\toolbar" />
<file name="images\aero\toolbar\tb-btn-sprite.gif" path="images\aero\toolbar" />
<file name="images\vista\toolbar\tb-btn-sprite.gif" path="images\vista\toolbar" />
<file name="images\default\toolbar\btn-arrow.gif" path="images\default\toolbar" />
<file name="images\default\menu\menu.gif" path="images\default\menu" />
<file name="images\default\menu\unchecked.gif" path="images\default\menu" />
<file name="images\default\menu\checked.gif" path="images\default\menu" />
<file name="images\default\menu\menu-parent.gif" path="images\default\menu" />
<file name="images\default\menu\group-checked.gif" path="images\default\menu" />
<file name="css\menu.css" path="css" />
<file name="css\grid2.css" path="css" />
<file name="css\README.txt" path="css" />
<file name="images\default\grid\hmenu-asc.gif" path="images\default\grid" />
<file name="images\default\grid\hmenu-desc.gif" path="images\default\grid" />
<file name="images\default\grid\hmenu-lock.png" path="images\default\grid" />
<file name="images\default\grid\hmenu-unlock.png" path="images\default\grid" />
<file name="images\default\grid\Thumbs.db" path="images\default\grid" />
<file name="images\default\menu\shadow-lite.png" path="images\default\menu" />
<file name="images\default\menu\shadow.png" path="images\default\menu" />
<file name="license.txt" path="" />
<file name="css\date-picker.css" path="css" />
<file name="images\default\basic-dialog\collapse.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\expand.gif" path="images\default\basic-dialog" />
<file name="images\aero\basic-dialog\collapse.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\collapse-over.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\expand.gif" path="images\aero\basic-dialog" />
<file name="images\aero\basic-dialog\expand-over.gif" path="images\aero\basic-dialog" />
<file name="images\gray\basic-dialog\collapse.gif" path="images\gray\basic-dialog" />
<file name="images\gray\basic-dialog\expand.gif" path="images\gray\basic-dialog" />
<file name="images\vista\basic-dialog\collapse.gif" path="images\vista\basic-dialog" />
<file name="images\vista\basic-dialog\expand.gif" path="images\vista\basic-dialog" />
<file name="css\.DS_Store" path="css" />
<file name="images\default\grid\.DS_Store" path="images\default\grid" />
<file name="images\default\toolbar\btn-arrow-light.gif" path="images\default\toolbar" />
<file name="images\default\.DS_Store" path="images\default" />
<file name="images\default\shared\left-btn.gif" path="images\default\shared" />
<file name="images\default\shared\right-btn.gif" path="images\default\shared" />
<file name="images\default\shared\calendar.gif" path="images\default\shared" />
<file name="css\form.css" path="css" />
<file name="images\aero\grid\pspbrwse.jbf" path="images\aero\grid" />
<file name="images\default\bg.png" path="images\default" />
<file name="images\default\shadow.png" path="images\default" />
<file name="images\default\shadow-lr.png" path="images\default" />
<file name="images\.DS_Store" path="images" />
<file name=".DS_Store" path="" />
<file name="yui-ext-resources.jsb" path="" />
<file name="resources.jsb" path="" />
<file name="css\box.css" path="css" />
<file name="images\default\box\.DS_Store" path="images\default\box" />
<file name="images\default\box\corners-blue.gif" path="images\default\box" />
<file name="images\default\box\corners.gif" path="images\default\box" />
<file name="images\default\box\l-blue.gif" path="images\default\box" />
<file name="images\default\box\l.gif" path="images\default\box" />
<file name="images\default\box\r-blue.gif" path="images\default\box" />
<file name="images\default\box\r.gif" path="images\default\box" />
<file name="images\default\box\tb-blue.gif" path="images\default\box" />
<file name="images\default\box\tb.gif" path="images\default\box" />
<file name="images\gray\menu\checked.gif" path="images\gray\menu" />
<file name="images\gray\menu\group-checked.gif" path="images\gray\menu" />
<file name="images\gray\menu\menu-parent.gif" path="images\gray\menu" />
<file name="images\gray\menu\menu.gif" path="images\gray\menu" />
<file name="images\gray\menu\unchecked.gif" path="images\gray\menu" />
<file name="images\default\layout\stick.gif" path="images\default\layout" />
<file name="images\default\layout\stuck.gif" path="images\default\layout" />
<file name="images\gray\layout\stick.gif" path="images\gray\layout" />
<file name="images\vista\layout\stick.gif" path="images\vista\layout" />
<file name="images\gray\grid\grid-hrow.gif" path="images\gray\grid" />
<file name="images\default\toolbar\tb-bg.gif" path="images\default\toolbar" />
<file name="images\gray\toolbar\tb-btn-sprite.gif" path="images\gray\toolbar" />
<file name="css\debug.css" path="css" />
<file name="images\default\form\trigger.gif" path="images\default\form" />
<file name="css\combo.css" path="css" />
<file name="images\default\form\date-trigger.gif" path="images\default\form" />
<file name="images\default\shared\warning.gif" path="images\default\shared" />
<file name="images\default\grid\dirty.gif" path="images\default\grid" />
<file name="images\default\grid\hmenu-lock.gif" path="images\default\grid" />
<file name="images\default\grid\hmenu-unlock.gif" path="images\default\grid" />
<file name="images\default\form\text-bg.gif" path="images\default\form" />
<file name="images\default\form\exclamation.png" path="images\default\form" />
<file name="images\default\form\exclamation.gif" path="images\default\form" />
<file name="images\default\form\error-tip-bg.gif" path="images\default\form" />
<file name="images\default\form\error-tip-corners.gif" path="images\default\form" />
<file name="images\default\qtip\tip-sprite.gif" path="images\default\qtip" />
<file name="images\default\qtip\close.gif" path="images\default\qtip" />
<file name="images\gray\qtip\tip-sprite.gif" path="images\gray\qtip" />
<file name="images\vista\qtip\tip-sprite.gif" path="images\vista\qtip" />
<file name="images\default\grid\hd-pop.gif" path="images\default\grid" />
<file name="css\panel.css" path="css" />
<file name="images\default\panel\panel-sprite.gif" path="images\default\panel" />
<file name="images\default\panel\panel-blue-sprite.gif" path="images\default\panel" />
<file name="images\default\panel\toggle-sprite.gif" path="images\default\panel" />
<file name="images\default\panel\close-sprite.gif" path="images\default\panel" />
<file name="images\default\window\corners-sprite.gif" path="images\default\window" />
<file name="images\default\window\left-right.gif" path="images\default\window" />
<file name="images\default\window\top-bottom.gif" path="images\default\window" />
<file name="css\window.css" path="css" />
<file name="images\default\window\corners-sprite.png" path="images\default\window" />
<file name="images\default\window\corners-sprite.psd" path="images\default\window" />
<file name="images\default\shadow-c.png" path="images\default" />
<file name="css\grid3.css" path="css" />
<file name="css\layout2.css" path="css" />
<file name="css\tabs2.css" path="css" />
<file name="images\default\panel\corners-sprite.gif" path="images\default\panel" />
<file name="images\default\panel\left-right.gif" path="images\default\panel" />
<file name="images\default\panel\tool-sprite-tpl.gif" path="images\default\panel" />
<file name="images\default\panel\tool-sprites.gif" path="images\default\panel" />
<file name="images\default\panel\top-bottom.gif" path="images\default\panel" />
<file name="images\default\panel\top-bottom.png" path="images\default\panel" />
<file name="images\default\panel\white-corners-sprite.gif" path="images\default\panel" />
<file name="images\default\panel\white-left-right.gif" path="images\default\panel" />
<file name="images\default\panel\white-top-bottom.gif" path="images\default\panel" />
<file name="images\default\window\left-corners.png" path="images\default\window" />
<file name="images\default\window\left-corners.psd" path="images\default\window" />
<file name="images\default\window\left-right.png" path="images\default\window" />
<file name="images\default\window\left-right.psd" path="images\default\window" />
<file name="images\default\window\right-corners.png" path="images\default\window" />
<file name="images\default\window\right-corners.psd" path="images\default\window" />
<file name="images\default\window\top-bottom.png" path="images\default\window" />
<file name="images\default\window\top-bottom.psd" path="images\default\window" />
<file name="images\default\._.DS_Store" path="images\default" />
<file name="images\._.DS_Store" path="images" />
<file name="._.DS_Store" path="" />
<file name="css\editor.css" path="css" />
<file name="images\default\editor\tb-sprite.gif" path="images\default\editor" />
<file name="css\borders.css" path="css" />
<file name="images\default\form\clear-trigger.gif" path="images\default\form" />
<file name="images\default\form\search-trigger.gif" path="images\default\form" />
<file name="images\default\form\trigger-tpl.gif" path="images\default\form" />
<file name="images\default\grid\row-over.gif" path="images\default\grid" />
<file name="images\default\grid\row-sel.gif" path="images\default\grid" />
<file name="images\default\grid\grid3-hrow.gif" path="images\default\grid" />
<file name="images\default\grid\grid3-hrow-over.gif" path="images\default\grid" />
<file name="images\default\grid\row-collapse.gif" path="images\default\grid" />
<file name="images\default\grid\row-expand.gif" path="images\default\grid" />
<file name="images\default\grid\grid3-hd-btn.gif" path="images\default\grid" />
<file name="images\aero\menu\menu.gif" path="images\aero\menu" />
<file name="images\aero\menu\item-over.gif" path="images\aero\menu" />
<file name="images\aero\menu\checked.gif" path="images\aero\menu" />
<file name="images\aero\menu\unchecked.gif" path="images\aero\menu" />
<file name="images\default\grid\grid3-expander-b-bg.gif" path="images\default\grid" />
<file name="images\default\grid\grid3-expander-c-bg.gif" path="images\default\grid" />
<file name="images\default\grid\grid3-special-col-bg.gif" path="images\default\grid" />
<file name="images\default\grid\row-expand-sprite.gif" path="images\default\grid" />
<file name="images\default\grid\row-check-sprite.gif" path="images\default\grid" />
<file name="images\default\grid\grid3-special-col-sel-bg.gif" path="images\default\grid" />
<file name="images\default\shared\glass-bg.gif" path="images\default\shared" />
<file name="legacy\grid.css" path="legacy" />
<file name="css\xtheme-aero.css" path="css" />
<file name="css\xtheme-gray.css" path="css" />
<file name="css\xtheme-vista.css" path="css" />
<file name="legacy\basic-dialog.css" path="legacy" />
<file name="images\default\form\clear-trigger.psd" path="images\default\form" />
<file name="images\default\form\date-trigger.psd" path="images\default\form" />
<file name="images\default\form\search-trigger.psd" path="images\default\form" />
<file name="images\default\form\trigger.psd" path="images\default\form" />
<file name="images\aero\tabs\tab-close.gif" path="images\aero\tabs" />
<file name="images\default\panel\light-hd.gif" path="images\default\panel" />
<file name="images\default\panel\tools-sprites-trans.gif" path="images\default\panel" />
<file name="images\aero\tabs\scroller-bg.gif" path="images\aero\tabs" />
<file name="images\default\tabs\scroller-bg.gif" path="images\default\tabs" />
<file name="images\default\grid\group-expand-sprite.gif" path="images\default\grid" />
<file name="images\default\grid\group-by.gif" path="images\default\grid" />
<file name="images\default\grid\columns.gif" path="images\default\grid" />
<file name="css\dialog.css" path="css" />
<file name="images\default\basic-dialog\icon-error.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\icon-info.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\icon-question.gif" path="images\default\basic-dialog" />
<file name="images\default\basic-dialog\icon-warning.gif" path="images\default\basic-dialog" />
<file name="css\progress.css" path="css" />
<file name="images\default\widgets\progress-bg.gif" path="images\default\widgets" />
<file name="images\default\progress\progress-bg.gif" path="images\default\progress" />
<file name="images\default\layout\mini-bottom.gif" path="images\default\layout" />
<file name="images\default\layout\mini-left.gif" path="images\default\layout" />
<file name="images\default\layout\mini-right.gif" path="images\default\layout" />
<file name="images\default\layout\mini-top.gif" path="images\default\layout" />
<file name="images\default\shared\blue-loading.gif" path="images\default\shared" />
<file name="images\default\shared\large-loading.gif" path="images\default\shared" />
<file name="images\default\menu\item-over.gif" path="images\default\menu" />
<file name="images\default\tabs\tab-close.gif" path="images\default\tabs" />
<file name="images\default\tabs\tab-strip-bg.gif" path="images\default\tabs" />
<file name="images\default\tabs\tab-strip-bg.png" path="images\default\tabs" />
<file name="images\default\tabs\tab-strip-btm-bg.gif" path="images\default\tabs" />
<file name="images\default\toolbar\bg.gif" path="images\default\toolbar" />
<file name="images\default\button\btn-arrow.gif" path="images\default\button" />
<file name="images\default\button\btn-sprite.gif" path="images\default\button" />
<file name="images\default\shared\hd-sprite.gif" path="images\default\shared" />
<file name="images\default\window\icon-error.gif" path="images\default\window" />
<file name="images\default\window\icon-info.gif" path="images\default\window" />
<file name="images\default\window\icon-question.gif" path="images\default\window" />
<file name="images\default\window\icon-warning.gif" path="images\default\window" />
<file name="images\gray\panel\corners-sprite.gif" path="images\gray\panel" />
<file name="images\gray\panel\left-right.gif" path="images\gray\panel" />
<file name="images\gray\panel\light-hd.gif" path="images\gray\panel" />
<file name="images\gray\panel\tool-sprite-tpl.gif" path="images\gray\panel" />
<file name="images\gray\panel\tool-sprites.gif" path="images\gray\panel" />
<file name="images\gray\panel\tools-sprites-trans.gif" path="images\gray\panel" />
<file name="images\gray\panel\top-bottom.gif" path="images\gray\panel" />
<file name="images\gray\panel\top-bottom.png" path="images\gray\panel" />
<file name="images\gray\panel\white-corners-sprite.gif" path="images\gray\panel" />
<file name="images\gray\panel\white-left-right.gif" path="images\gray\panel" />
<file name="images\gray\panel\white-top-bottom.gif" path="images\gray\panel" />
<file name="images\gray\qtip\close.gif" path="images\gray\qtip" />
<file name="images\gray\toolbar\bg.gif" path="images\gray\toolbar" />
<file name="images\gray\toolbar\btn-arrow-light.gif" path="images\gray\toolbar" />
<file name="images\gray\toolbar\btn-arrow.gif" path="images\gray\toolbar" />
<file name="images\gray\toolbar\btn-over-bg.gif" path="images\gray\toolbar" />
<file name="images\gray\toolbar\tb-bg.gif" path="images\gray\toolbar" />
<file name="images\gray\tabs\scroller-bg.gif" path="images\gray\tabs" />
<file name="images\gray\tabs\tab-close.gif" path="images\gray\tabs" />
<file name="images\gray\tabs\tab-strip-bg.gif" path="images\gray\tabs" />
<file name="images\gray\tabs\tab-strip-bg.png" path="images\gray\tabs" />
<file name="images\gray\tabs\tab-strip-btm-bg.gif" path="images\gray\tabs" />
<file name="images\gray\window\icon-error.gif" path="images\gray\window" />
<file name="images\gray\window\icon-info.gif" path="images\gray\window" />
<file name="images\gray\window\icon-question.gif" path="images\gray\window" />
<file name="images\gray\window\icon-warning.gif" path="images\gray\window" />
<file name="images\gray\window\left-corners.png" path="images\gray\window" />
<file name="images\gray\window\left-corners.psd" path="images\gray\window" />
<file name="images\gray\window\left-right.png" path="images\gray\window" />
<file name="images\gray\window\left-right.psd" path="images\gray\window" />
<file name="images\gray\window\right-corners.png" path="images\gray\window" />
<file name="images\gray\window\right-corners.psd" path="images\gray\window" />
<file name="images\gray\window\top-bottom.png" path="images\gray\window" />
<file name="images\gray\window\top-bottom.psd" path="images\gray\window" />
<file name="images\gray\button\btn-arrow.gif" path="images\gray\button" />
<file name="images\gray\button\btn-sprite.gif" path="images\gray\button" />
<file name="css\xtheme-gray-blue.css" path="css" />
<file name="images\gray\window\left-corners.pspimage" path="images\gray\window" />
<file name="images\gray\window\right-corners.pspimage" path="images\gray\window" />
<file name="images\default\tabs\tabs-sprite.gif" path="images\default\tabs" />
<file name="images\gray\tabs\tabs-sprite.gif" path="images\gray\tabs" />
<file name="css\xtheme-dark.css" path="css" />
<file name="images\dark\button\btn-arrow.gif" path="images\dark\button" />
<file name="images\dark\button\btn-sprite.gif" path="images\dark\button" />
<file name="images\dark\panel\corners-sprite.gif" path="images\dark\panel" />
<file name="images\dark\panel\left-right.gif" path="images\dark\panel" />
<file name="images\dark\panel\light-hd.gif" path="images\dark\panel" />
<file name="images\dark\panel\tool-sprite-tpl.gif" path="images\dark\panel" />
<file name="images\dark\panel\tool-sprites.gif" path="images\dark\panel" />
<file name="images\dark\panel\tools-sprites-trans.gif" path="images\dark\panel" />
<file name="images\dark\panel\top-bottom.gif" path="images\dark\panel" />
<file name="images\dark\panel\top-bottom.png" path="images\dark\panel" />
<file name="images\dark\panel\white-corners-sprite.gif" path="images\dark\panel" />
<file name="images\dark\panel\white-left-right.gif" path="images\dark\panel" />
<file name="images\dark\panel\white-top-bottom.gif" path="images\dark\panel" />
<file name="images\dark\qtip\bg.gif" path="images\dark\qtip" />
<file name="images\dark\qtip\close.gif" path="images\dark\qtip" />
<file name="images\dark\qtip\tip-sprite.gif" path="images\dark\qtip" />
<file name="images\dark\tabs\scroller-bg.gif" path="images\dark\tabs" />
<file name="images\dark\tabs\tab-btm-inactive-left-bg.gif" path="images\dark\tabs" />
<file name="images\dark\tabs\tab-btm-inactive-right-bg.gif" path="images\dark\tabs" />
<file name="images\dark\tabs\tab-btm-left-bg.gif" path="images\dark\tabs" />
<file name="images\dark\tabs\tab-btm-right-bg.gif" path="images\dark\tabs" />
<file name="images\dark\tabs\tab-close.gif" path="images\dark\tabs" />
<file name="images\dark\tabs\tab-strip-bg.gif" path="images\dark\tabs" />
<file name="images\dark\tabs\tab-strip-bg.png" path="images\dark\tabs" />
<file name="images\dark\tabs\tab-strip-btm-bg.gif" path="images\dark\tabs" />
<file name="images\dark\tabs\tabs-sprite.gif" path="images\dark\tabs" />
<file name="images\dark\toolbar\bg.gif" path="images\dark\toolbar" />
<file name="images\dark\toolbar\btn-arrow-light.gif" path="images\dark\toolbar" />
<file name="images\dark\toolbar\btn-arrow.gif" path="images\dark\toolbar" />
<file name="images\dark\toolbar\btn-over-bg.gif" path="images\dark\toolbar" />
<file name="images\dark\toolbar\gray-bg.gif" path="images\dark\toolbar" />
<file name="images\dark\toolbar\tb-bg.gif" path="images\dark\toolbar" />
<file name="images\dark\toolbar\tb-btn-sprite.gif" path="images\dark\toolbar" />
<file name="images\dark\window\icon-error.gif" path="images\dark\window" />
<file name="images\dark\window\icon-info.gif" path="images\dark\window" />
<file name="images\dark\window\icon-question.gif" path="images\dark\window" />
<file name="images\dark\window\icon-warning.gif" path="images\dark\window" />
<file name="images\dark\window\left-corners.png" path="images\dark\window" />
<file name="images\dark\window\left-corners.pspimage" path="images\dark\window" />
<file name="images\dark\window\left-right.png" path="images\dark\window" />
<file name="images\dark\window\right-corners.png" path="images\dark\window" />
<file name="images\dark\window\top-bottom.png" path="images\dark\window" />
<file name="images\dark\gradient-bg.gif" path="images\dark" />
<file name="images\dark\s.gif" path="images\dark" />
<file name="images\default\tabs\scroll-left.gif" path="images\default\tabs" />
<file name="images\default\tabs\scroll-right.gif" path="images\default\tabs" />
<file name="css\reset.css" path="css" />
<file name="images\gray\tabs\scroll-left.gif" path="images\gray\tabs" />
<file name="images\gray\tabs\scroll-right.gif" path="images\gray\tabs" />
<file name="images\default\shared\loading-balls.gif" path="images\default\shared" />
<file name="raw-images\shadow.psd" path="raw-images" />
<file name="images\default\tree\arrow-closed-over.gif" path="images\default\tree" />
<file name="images\default\tree\arrow-closed.gif" path="images\default\tree" />
<file name="images\default\tree\arrow-open-over.gif" path="images\default\tree" />
<file name="images\default\tree\arrow-open.gif" path="images\default\tree" />
<file name="images\default\tree\arrows.gif" path="images\default\tree" />
</project> | JavaScript |
/*
* Ext JS Library 2.0.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
Ext.DomHelper = function(){
var tempTableEl = null;
var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;
var tableRe = /^table|tbody|tr|td$/i;
var createHtml = function(o){
if(typeof o == 'string'){
return o;
}
var b = "";
if (Ext.isArray(o)) {
for (var i = 0, l = o.length; i < l; i++) {
b += createHtml(o[i]);
}
return b;
}
if(!o.tag){
o.tag = "div";
}
b += "<" + o.tag;
for(var attr in o){
if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue;
if(attr == "style"){
var s = o["style"];
if(typeof s == "function"){
s = s.call();
}
if(typeof s == "string"){
b += ' style="' + s + '"';
}else if(typeof s == "object"){
b += ' style="';
for(var key in s){
if(typeof s[key] != "function"){
b += key + ":" + s[key] + ";";
}
}
b += '"';
}
}else{
if(attr == "cls"){
b += ' class="' + o["cls"] + '"';
}else if(attr == "htmlFor"){
b += ' for="' + o["htmlFor"] + '"';
}else{
b += " " + attr + '="' + o[attr] + '"';
}
}
}
if(emptyTags.test(o.tag)){
b += "/>";
}else{
b += ">";
var cn = o.children || o.cn;
if(cn){
b += createHtml(cn);
} else if(o.html){
b += o.html;
}
b += "</" + o.tag + ">";
}
return b;
};
var createDom = function(o, parentNode){
var el;
if (Ext.isArray(o)) {
el = document.createDocumentFragment();
for(var i = 0, l = o.length; i < l; i++) {
createDom(o[i], el);
}
} else if (typeof o == "string)") {
el = document.createTextNode(o);
} else {
el = document.createElement(o.tag||'div');
var useSet = !!el.setAttribute;
for(var attr in o){
if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue;
if(attr=="cls"){
el.className = o["cls"];
}else{
if(useSet) el.setAttribute(attr, o[attr]);
else el[attr] = o[attr];
}
}
Ext.DomHelper.applyStyles(el, o.style);
var cn = o.children || o.cn;
if(cn){
createDom(cn, el);
} else if(o.html){
el.innerHTML = o.html;
}
}
if(parentNode){
parentNode.appendChild(el);
}
return el;
};
var ieTable = function(depth, s, h, e){
tempTableEl.innerHTML = [s, h, e].join('');
var i = -1, el = tempTableEl;
while(++i < depth){
el = el.firstChild;
}
return el;
};
var ts = '<table>',
te = '</table>',
tbs = ts+'<tbody>',
tbe = '</tbody>'+te,
trs = tbs + '<tr>',
tre = '</tr>'+tbe;
var insertIntoTable = function(tag, where, el, html){
if(!tempTableEl){
tempTableEl = document.createElement('div');
}
var node;
var before = null;
if(tag == 'td'){
if(where == 'afterbegin' || where == 'beforeend'){
return;
}
if(where == 'beforebegin'){
before = el;
el = el.parentNode;
} else{
before = el.nextSibling;
el = el.parentNode;
}
node = ieTable(4, trs, html, tre);
}
else if(tag == 'tr'){
if(where == 'beforebegin'){
before = el;
el = el.parentNode;
node = ieTable(3, tbs, html, tbe);
} else if(where == 'afterend'){
before = el.nextSibling;
el = el.parentNode;
node = ieTable(3, tbs, html, tbe);
} else{
if(where == 'afterbegin'){
before = el.firstChild;
}
node = ieTable(4, trs, html, tre);
}
} else if(tag == 'tbody'){
if(where == 'beforebegin'){
before = el;
el = el.parentNode;
node = ieTable(2, ts, html, te);
} else if(where == 'afterend'){
before = el.nextSibling;
el = el.parentNode;
node = ieTable(2, ts, html, te);
} else{
if(where == 'afterbegin'){
before = el.firstChild;
}
node = ieTable(3, tbs, html, tbe);
}
} else{
if(where == 'beforebegin' || where == 'afterend'){
return;
}
if(where == 'afterbegin'){
before = el.firstChild;
}
node = ieTable(2, ts, html, te);
}
el.insertBefore(node, before);
return node;
};
return {
useDom : false,
markup : function(o){
return createHtml(o);
},
applyStyles : function(el, styles){
if(styles){
el = Ext.fly(el);
if(typeof styles == "string"){
var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;
var matches;
while ((matches = re.exec(styles)) != null){
el.setStyle(matches[1], matches[2]);
}
}else if (typeof styles == "object"){
for (var style in styles){
el.setStyle(style, styles[style]);
}
}else if (typeof styles == "function"){
Ext.DomHelper.applyStyles(el, styles.call());
}
}
},
insertHtml : function(where, el, html){
where = where.toLowerCase();
if(el.insertAdjacentHTML){
if(tableRe.test(el.tagName)){
var rs;
if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){
return rs;
}
}
switch(where){
case "beforebegin":
el.insertAdjacentHTML('BeforeBegin', html);
return el.previousSibling;
case "afterbegin":
el.insertAdjacentHTML('AfterBegin', html);
return el.firstChild;
case "beforeend":
el.insertAdjacentHTML('BeforeEnd', html);
return el.lastChild;
case "afterend":
el.insertAdjacentHTML('AfterEnd', html);
return el.nextSibling;
}
throw 'Illegal insertion point -> "' + where + '"';
}
var range = el.ownerDocument.createRange();
var frag;
switch(where){
case "beforebegin":
range.setStartBefore(el);
frag = range.createContextualFragment(html);
el.parentNode.insertBefore(frag, el);
return el.previousSibling;
case "afterbegin":
if(el.firstChild){
range.setStartBefore(el.firstChild);
frag = range.createContextualFragment(html);
el.insertBefore(frag, el.firstChild);
return el.firstChild;
}else{
el.innerHTML = html;
return el.firstChild;
}
case "beforeend":
if(el.lastChild){
range.setStartAfter(el.lastChild);
frag = range.createContextualFragment(html);
el.appendChild(frag);
return el.lastChild;
}else{
el.innerHTML = html;
return el.lastChild;
}
case "afterend":
range.setStartAfter(el);
frag = range.createContextualFragment(html);
el.parentNode.insertBefore(frag, el.nextSibling);
return el.nextSibling;
}
throw 'Illegal insertion point -> "' + where + '"';
},
insertBefore : function(el, o, returnElement){
return this.doInsert(el, o, returnElement, "beforeBegin");
},
insertAfter : function(el, o, returnElement){
return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling");
},
insertFirst : function(el, o, returnElement){
return this.doInsert(el, o, returnElement, "afterBegin", "firstChild");
},
doInsert : function(el, o, returnElement, pos, sibling){
el = Ext.getDom(el);
var newNode;
if(this.useDom){
newNode = createDom(o, null);
(sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el);
}else{
var html = createHtml(o);
newNode = this.insertHtml(pos, el, html);
}
return returnElement ? Ext.get(newNode, true) : newNode;
},
append : function(el, o, returnElement){
el = Ext.getDom(el);
var newNode;
if(this.useDom){
newNode = createDom(o, null);
el.appendChild(newNode);
}else{
var html = createHtml(o);
newNode = this.insertHtml("beforeEnd", el, html);
}
return returnElement ? Ext.get(newNode, true) : newNode;
},
overwrite : function(el, o, returnElement){
el = Ext.getDom(el);
el.innerHTML = createHtml(o);
return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
},
createTemplate : function(o){
var html = createHtml(o);
return new Ext.Template(html);
}
};
}();
Ext.Template = function(html){
var a = arguments;
if(Ext.isArray(html)){
html = html.join("");
}else if(a.length > 1){
var buf = [];
for(var i = 0, len = a.length; i < len; i++){
if(typeof a[i] == 'object'){
Ext.apply(this, a[i]);
}else{
buf[buf.length] = a[i];
}
}
html = buf.join('');
}
this.html = html;
if(this.compiled){
this.compile();
}
};
Ext.Template.prototype = {
applyTemplate : function(values){
if(this.compiled){
return this.compiled(values);
}
var useF = this.disableFormats !== true;
var fm = Ext.util.Format, tpl = this;
var fn = function(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){
var re = /^\s*['"](.*)["']\s*$/;
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 this.html.replace(this.re, fn);
},
set : function(html, compile){
this.html = html;
this.compiled = null;
if(compile){
this.compile();
}
return this;
},
disableFormats : false,
re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
compile : function(){
var fm = Ext.util.Format;
var useF = this.disableFormats !== true;
var sep = Ext.isGecko ? "+" : ",";
var fn = function(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+"'";
};
var body;
if(Ext.isGecko){
body = "this.compiled = function(values){ return '" +
this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
"';};";
}else{
body = ["this.compiled = function(values){ return ['"];
body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));
body.push("'].join('');};");
body = body.join('');
}
eval(body);
return this;
},
call : function(fnName, value, allValues){
return this[fnName](value, allValues);
},
insertFirst: function(el, values, returnElement){
return this.doInsert('afterBegin', el, values, returnElement);
},
insertBefore: function(el, values, returnElement){
return this.doInsert('beforeBegin', el, values, returnElement);
},
insertAfter : function(el, values, returnElement){
return this.doInsert('afterEnd', el, values, returnElement);
},
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;
},
overwrite : function(el, values, returnElement){
el = Ext.getDom(el);
el.innerHTML = this.applyTemplate(values);
return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
}
};
Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
Ext.DomHelper.Template = Ext.Template;
Ext.Template.from = function(el, config){
el = Ext.getDom(el);
return new Ext.Template(el.value || el.innerHTML, config || '');
};
Ext.DomQuery = function(){
var cache = {}, simpleCache = {}, valueCache = {};
var nonSpace = /\S/;
var trimRe = /^\s+|\s+$/g;
var tplRe = /\{(\d+)\}/g;
var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;
var tagTokenRe = /^(#)?([\w-\*]+)/;
var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;
function child(p, index){
var i = 0;
var n = p.firstChild;
while(n){
if(n.nodeType == 1){
if(++i == index){
return n;
}
}
n = n.nextSibling;
}
return null;
};
function next(n){
while((n = n.nextSibling) && n.nodeType != 1);
return n;
};
function prev(n){
while((n = n.previousSibling) && n.nodeType != 1);
return n;
};
function children(d){
var n = d.firstChild, ni = -1;
while(n){
var nx = n.nextSibling;
if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
d.removeChild(n);
}else{
n.nodeIndex = ++ni;
}
n = nx;
}
return this;
};
function byClassName(c, a, v){
if(!v){
return c;
}
var r = [], ri = -1, cn;
for(var i = 0, ci; ci = c[i]; i++){
if((' '+ci.className+' ').indexOf(v) != -1){
r[++ri] = ci;
}
}
return r;
};
function attrValue(n, attr){
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];
};
function getNodes(ns, mode, tagName){
var result = [], ri = -1, cs;
if(!ns){
return result;
}
tagName = tagName || "*";
if(typeof ns.getElementsByTagName != "undefined"){
ns = [ns];
}
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;
}
}
}else if(mode == "/" || mode == ">"){
var utag = tagName.toUpperCase();
for(var i = 0, ni, cn; ni = ns[i]; i++){
cn = ni.children || ni.childNodes;
for(var j = 0, cj; cj = cn[j]; j++){
if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
result[++ri] = cj;
}
}
}
}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;
}
}
}else if(mode == "~"){
for(var i = 0, n; n = ns[i]; i++){
while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));
if(n){
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 r = [], ri = -1;
tagName = tagName.toLowerCase();
for(var i = 0, ci; ci = cs[i]; i++){
if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
r[++ri] = ci;
}
}
return r;
};
function byId(cs, attr, id){
if(cs.tagName || cs == document){
cs = [cs];
}
if(!id){
return cs;
}
var r = [], ri = -1;
for(var i = 0,ci; ci = cs[i]; i++){
if(ci && ci.id == id){
r[++ri] = ci;
return r;
}
}
return r;
};
function byAttribute(cs, attr, value, op, custom){
var r = [], ri = -1, st = custom=="{";
var f = Ext.DomQuery.operators[op];
for(var i = 0, ci; ci = cs[i]; i++){
var a;
if(st){
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"){
a = ci.getAttribute("href", 2);
}else{
a = ci.getAttribute(attr);
}
if((f && f(a, value)) || (!f && a)){
r[++ri] = ci;
}
}
return r;
};
function byPseudo(cs, name, value){
return Ext.DomQuery.pseudos[name](cs, value);
};
var isIE = window.ActiveXObject ? true : false;
eval("var batch = 30803;");
var key = 30803;
function nodupIEXml(cs){
var d = ++key;
cs[0].setAttribute("_nodup", d);
var 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;
for(var i = 0, len = c1.length; i < len; i++){
c1[i].setAttribute("_qdiff", d);
}
var r = [];
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;
if(!len1){
return c2;
}
if(isIE && c1[0].selectSingleNode){
return quickDiffIEXml(c1, c2);
}
var d = ++key;
for(var i = 0; i < len1; i++){
c1[i]._qdiff = d;
}
var r = [];
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, null, id);
}
return {
getStyle : function(el, name){
return Ext.fly(el).getStyle(name);
},
compile : function(path, type){
type = type || "select";
var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];
var q = path, mode, lq;
var tk = Ext.DomQuery.matchers;
var tklen = tk.length;
var mm;
var lmode = q.match(modeRe);
if(lmode && lmode[1]){
fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
q = q.replace(lmode[1], "");
}
while(path.substr(0, 1)=="/"){
path = path.substr(1);
}
while(q && lq != q){
lq = q;
var tm = q.match(tagTokenRe);
if(type == "select"){
if(tm){
if(tm[1] == "#"){
fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");';
}else{
fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");';
}
q = q.replace(tm[0], "");
}else if(q.substr(0, 1) != '@'){
fn[fn.length] = 'n = getNodes(n, mode, "*");';
}
}else{
if(tm){
if(tm[1] == "#"){
fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");';
}else{
fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");';
}
q = q.replace(tm[0], "");
}
}
while(!(mm = q.match(modeRe))){
var matched = false;
for(var j = 0; j < tklen; j++){
var t = tk[j];
var m = q.match(t.re);
if(m){
fn[fn.length] = t.select.replace(tplRe, function(x, i){
return m[i];
});
q = q.replace(m[0], "");
matched = true;
break;
}
}
if(!matched){
throw 'Error parsing selector, parsing failed at "' + q + '"';
}
}
if(mm[1]){
fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";';
q = q.replace(mm[1], "");
}
}
fn[fn.length] = "return nodup(n);\n}";
eval(fn.join(""));
return f;
},
select : function(path, root, type){
if(!root || root == document){
root = document;
}
if(typeof root == "string"){
root = document.getElementById(root);
}
var paths = path.split(",");
var results = [];
for(var i = 0, len = paths.length; i < len; i++){
var p = paths[i].replace(trimRe, "");
if(!cache[p]){
cache[p] = Ext.DomQuery.compile(p);
if(!cache[p]){
throw p + " is not a valid selector";
}
}
var result = cache[p](root);
if(result && result != document){
results = results.concat(result);
}
}
if(paths.length > 1){
return nodup(results);
}
return results;
},
selectNode : function(path, root){
return Ext.DomQuery.select(path, root)[0];
},
selectValue : function(path, root, defaultValue){
path = path.replace(trimRe, "");
if(!valueCache[path]){
valueCache[path] = Ext.DomQuery.compile(path, "select");
}
var n = valueCache[path](root);
n = n[0] ? n[0] : n;
var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
return ((v === null||v === undefined||v==='') ? defaultValue : v);
},
selectNumber : function(path, root, defaultValue){
var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
return parseFloat(v);
},
is : function(el, ss){
if(typeof el == "string"){
el = document.getElementById(el);
}
var isArray = Ext.isArray(el);
var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
return isArray ? (result.length == el.length) : (result.length > 0);
},
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;
},
matchers : [{
re: /^\.([\w-]+)/,
select: 'n = byClassName(n, null, " {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, null, "{1}");'
},{
re: /^@([\w-]+)/,
select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
}
],
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;
}
},
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;
var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);
var 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('|');
var 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;
var 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;
var 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;
var 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;
}
}
};
}();
Ext.query = Ext.DomQuery.select;
Ext.util.Observable = function(){
if(this.listeners){
this.on(this.listeners);
delete this.listeners;
}
};
Ext.util.Observable.prototype = {
fireEvent : function(){
if(this.eventsSuspended !== true){
var ce = this.events[arguments[0].toLowerCase()];
if(typeof ce == "object"){
return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1));
}
}
return true;
},
filterOptRe : /^(?:scope|delay|buffer|single)$/,
addListener : function(eventName, fn, scope, o){
if(typeof eventName == "object"){
o = eventName;
for(var e in o){
if(this.filterOptRe.test(e)){
continue;
}
if(typeof o[e] == "function"){
this.addListener(e, o[e], o.scope, o);
}else{
this.addListener(e, o[e].fn, o[e].scope, o[e]);
}
}
return;
}
o = (!o || typeof o == "boolean") ? {} : o;
eventName = eventName.toLowerCase();
var ce = this.events[eventName] || true;
if(typeof ce == "boolean"){
ce = new Ext.util.Event(this, eventName);
this.events[eventName] = ce;
}
ce.addListener(fn, scope, o);
},
removeListener : function(eventName, fn, scope){
var ce = this.events[eventName.toLowerCase()];
if(typeof ce == "object"){
ce.removeListener(fn, scope);
}
},
purgeListeners : function(){
for(var evt in this.events){
if(typeof this.events[evt] == "object"){
this.events[evt].clearListeners();
}
}
},
relayEvents : function(o, events){
var createHandler = function(ename){
return function(){
return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));
};
};
for(var i = 0, len = events.length; i < len; i++){
var ename = events[i];
if(!this.events[ename]){ this.events[ename] = true; };
o.on(ename, createHandler(ename), this);
}
},
addEvents : function(o){
if(!this.events){
this.events = {};
}
if(typeof o == 'string'){
for(var i = 0, a = arguments, v; v = a[i]; i++){
if(!this.events[a[i]]){
o[a[i]] = true;
}
}
}else{
Ext.applyIf(this.events, o);
}
},
hasListener : function(eventName){
var e = this.events[eventName];
return typeof e == "object" && e.listeners.length > 0;
},
suspendEvents : function(){
this.eventsSuspended = true;
},
resumeEvents : function(){
this.eventsSuspended = false;
},
getMethodEvent : function(method){
if(!this.methodEvents){
this.methodEvents = {};
}
var e = this.methodEvents[method];
if(!e){
e = {};
this.methodEvents[method] = e;
e.originalFn = this[method];
e.methodName = method;
e.before = [];
e.after = [];
var returnValue, v, cancel;
var obj = this;
var makeCall = function(fn, scope, args){
if((v = fn.apply(scope || obj, args)) !== undefined){
if(typeof v === 'object'){
if(v.returnValue !== undefined){
returnValue = v.returnValue;
}else{
returnValue = v;
}
if(v.cancel === true){
cancel = true;
}
}else if(v === false){
cancel = true;
}else {
returnValue = v;
}
}
}
this[method] = function(){
returnValue = v = undefined; cancel = false;
var args = Array.prototype.slice.call(arguments, 0);
for(var i = 0, len = e.before.length; i < len; i++){
makeCall(e.before[i].fn, e.before[i].scope, args);
if(cancel){
return returnValue;
}
}
if((v = e.originalFn.apply(obj, args)) !== undefined){
returnValue = v;
}
for(var i = 0, len = e.after.length; i < len; i++){
makeCall(e.after[i].fn, e.after[i].scope, args);
if(cancel){
return returnValue;
}
}
return returnValue;
};
}
return e;
},
beforeMethod : function(method, fn, scope){
var e = this.getMethodEvent(method);
e.before.push({fn: fn, scope: scope});
},
afterMethod : function(method, fn, scope){
var e = this.getMethodEvent(method);
e.after.push({fn: fn, scope: scope});
},
removeMethodListener : function(method, fn, scope){
var e = this.getMethodEvent(method);
for(var i = 0, len = e.before.length; i < len; i++){
if(e.before[i].fn == fn && e.before[i].scope == scope){
e.before.splice(i, 1);
return;
}
}
for(var i = 0, len = e.after.length; i < len; i++){
if(e.after[i].fn == fn && e.after[i].scope == scope){
e.after.splice(i, 1);
return;
}
}
}
};
Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;
Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;
Ext.util.Observable.capture = function(o, fn, scope){
o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
};
Ext.util.Observable.releaseCapture = function(o){
o.fireEvent = Ext.util.Observable.prototype.fireEvent;
};
(function(){
var createBuffered = function(h, o, scope){
var task = new Ext.util.DelayedTask();
return function(){
task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
};
};
var createSingle = function(h, e, fn, scope){
return function(){
e.removeListener(fn, scope);
return h.apply(scope, arguments);
};
};
var createDelayed = function(h, o, scope){
return function(){
var args = Array.prototype.slice.call(arguments, 0);
setTimeout(function(){
h.apply(scope, args);
}, o.delay || 10);
};
};
Ext.util.Event = function(obj, name){
this.name = name;
this.obj = obj;
this.listeners = [];
};
Ext.util.Event.prototype = {
addListener : function(fn, scope, options){
scope = scope || this.obj;
if(!this.isListening(fn, scope)){
var l = this.createListener(fn, scope, options);
if(!this.firing){
this.listeners.push(l);
}else{ this.listeners = this.listeners.slice(0);
this.listeners.push(l);
}
}
},
createListener : function(fn, scope, o){
o = o || {};
scope = scope || this.obj;
var l = {fn: fn, scope: scope, options: o};
var h = fn;
if(o.delay){
h = createDelayed(h, o, scope);
}
if(o.single){
h = createSingle(h, this, fn, scope);
}
if(o.buffer){
h = createBuffered(h, o, scope);
}
l.fireFn = h;
return l;
},
findListener : function(fn, scope){
scope = scope || this.obj;
var ls = this.listeners;
for(var i = 0, len = ls.length; i < len; i++){
var l = ls[i];
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;
if((index = this.findListener(fn, scope)) != -1){
if(!this.firing){
this.listeners.splice(index, 1);
}else{
this.listeners = this.listeners.slice(0);
this.listeners.splice(index, 1);
}
return true;
}
return false;
},
clearListeners : function(){
this.listeners = [];
},
fire : function(){
var ls = this.listeners, scope, len = ls.length;
if(len > 0){
this.firing = true;
var args = Array.prototype.slice.call(arguments, 0);
for(var i = 0; i < len; i++){
var l = ls[i];
if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){
this.firing = false;
return false;
}
}
this.firing = false;
}
return true;
}
};
})();
Ext.EventManager = function(){
var docReadyEvent, docReadyProcId, docReadyState = false;
var resizeEvent, resizeTask, textEvent, textSize;
var E = Ext.lib.Event;
var D = Ext.lib.Dom;
var fireDocReady = function(){
if(!docReadyState){
docReadyState = true;
Ext.isReady = true;
if(docReadyProcId){
clearInterval(docReadyProcId);
}
if(Ext.isGecko || Ext.isOpera) {
document.removeEventListener("DOMContentLoaded", fireDocReady, false);
}
if(Ext.isIE){
var defer = document.getElementById("ie-deferred-loader");
if(defer){
defer.onreadystatechange = null;
defer.parentNode.removeChild(defer);
}
}
if(docReadyEvent){
docReadyEvent.fire();
docReadyEvent.clearListeners();
}
}
};
var initDocReady = function(){
docReadyEvent = new Ext.util.Event();
if(Ext.isGecko || Ext.isOpera) {
document.addEventListener("DOMContentLoaded", fireDocReady, false);
}else if(Ext.isIE){
document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");
var defer = document.getElementById("ie-deferred-loader");
defer.onreadystatechange = function(){
if(this.readyState == "complete"){
fireDocReady();
}
};
}else if(Ext.isSafari){
docReadyProcId = setInterval(function(){
var rs = document.readyState;
if(rs == "complete") {
fireDocReady();
}
}, 10);
}
E.on(window, "load", fireDocReady);
};
var createBuffered = function(h, o){
var task = new Ext.util.DelayedTask(h);
return function(e){
e = new Ext.EventObjectImpl(e);
task.delay(o.buffer, h, null, [e]);
};
};
var createSingle = function(h, el, ename, fn){
return function(e){
Ext.EventManager.removeListener(el, ename, fn);
h(e);
};
};
var createDelayed = function(h, o){
return function(e){
e = new Ext.EventObjectImpl(e);
setTimeout(function(){
h(e);
}, o.delay || 10);
};
};
var listen = function(element, ename, opt, fn, scope){
var o = (!opt || typeof opt == "boolean") ? {} : opt;
fn = fn || o.fn; scope = scope || o.scope;
var el = Ext.getDom(element);
if(!el){
throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
}
var h = function(e){
e = Ext.EventObject.setEvent(e);
var t;
if(o.delegate){
t = e.getTarget(o.delegate, el);
if(!t){
return;
}
}else{
t = e.target;
}
if(o.stopEvent === true){
e.stopEvent();
}
if(o.preventDefault === true){
e.preventDefault();
}
if(o.stopPropagation === true){
e.stopPropagation();
}
if(o.normalized === false){
e = e.browserEvent;
}
fn.call(scope || el, e, t, o);
};
if(o.delay){
h = createDelayed(h, o);
}
if(o.single){
h = createSingle(h, el, ename, fn);
}
if(o.buffer){
h = createBuffered(h, o);
}
fn._handlers = fn._handlers || [];
fn._handlers.push([Ext.id(el), ename, h]);
E.on(el, ename, h);
if(ename == "mousewheel" && el.addEventListener){
el.addEventListener("DOMMouseScroll", h, false);
E.on(window, 'unload', function(){
el.removeEventListener("DOMMouseScroll", h, false);
});
}
if(ename == "mousedown" && el == document){
Ext.EventManager.stoppedMouseDownEvent.addListener(h);
}
return h;
};
var stopListening = function(el, ename, fn){
var id = Ext.id(el), hds = fn._handlers, hd = fn;
if(hds){
for(var i = 0, len = hds.length; i < len; i++){
var h = hds[i];
if(h[0] == id && h[1] == ename){
hd = h[2];
hds.splice(i, 1);
break;
}
}
}
E.un(el, ename, hd);
el = Ext.getDom(el);
if(ename == "mousewheel" && el.addEventListener){
el.removeEventListener("DOMMouseScroll", hd, false);
}
if(ename == "mousedown" && el == document){
Ext.EventManager.stoppedMouseDownEvent.removeListener(hd);
}
};
var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
var pub = {
addListener : function(element, eventName, fn, scope, options){
if(typeof eventName == "object"){
var o = eventName;
for(var e in o){
if(propRe.test(e)){
continue;
}
if(typeof o[e] == "function"){
listen(element, e, o, o[e], o.scope);
}else{
listen(element, e, o[e]);
}
}
return;
}
return listen(element, eventName, options, fn, scope);
},
removeListener : function(element, eventName, fn){
return stopListening(element, eventName, fn);
},
onDocumentReady : function(fn, scope, options){
if(docReadyState){
docReadyEvent.addListener(fn, scope, options);
docReadyEvent.fire();
docReadyEvent.clearListeners();
return;
}
if(!docReadyEvent){
initDocReady();
}
docReadyEvent.addListener(fn, scope, options);
},
onWindowResize : function(fn, scope, options){
if(!resizeEvent){
resizeEvent = new Ext.util.Event();
resizeTask = new Ext.util.DelayedTask(function(){
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
});
E.on(window, "resize", this.fireWindowResize, this);
}
resizeEvent.addListener(fn, scope, options);
},
fireWindowResize : function(){
if(resizeEvent){
if((Ext.isIE||Ext.isAir) && resizeTask){
resizeTask.delay(50);
}else{
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
}
}
},
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);
},
removeResizeListener : function(fn, scope){
if(resizeEvent){
resizeEvent.removeListener(fn, scope);
}
},
fireResize : function(){
if(resizeEvent){
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
}
},
ieDeferSrc : false,
textResizeInterval : 50
};
pub.on = pub.addListener;
pub.un = pub.removeListener;
pub.stoppedMouseDownEvent = new Ext.util.Event();
return pub;
}();
Ext.onReady = Ext.EventManager.onDocumentReady;
Ext.onReady(function(){
var bd = Ext.getBody();
if(!bd){ return; }
var cls = [
Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : 'ext-ie7')
: Ext.isGecko ? "ext-gecko"
: Ext.isOpera ? "ext-opera"
: Ext.isSafari ? "ext-safari" : ""];
if(Ext.isMac){
cls.push("ext-mac");
}
if(Ext.isLinux){
cls.push("ext-linux");
}
if(Ext.isBorderBox){
cls.push('ext-border-box');
}
if(Ext.isStrict){
var p = bd.dom.parentNode;
if(p){
p.className += ' ext-strict';
}
}
bd.addClass(cls.join(' '));
});
Ext.EventObject = function(){
var E = Ext.lib.Event;
var safariKeys = {
63234 : 37,
63235 : 39,
63232 : 38,
63233 : 40,
63276 : 33,
63277 : 34,
63272 : 46,
63273 : 36,
63275 : 35
};
var btnMap = Ext.isIE ? {1:0,4:1,2:2} :
(Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
Ext.EventObjectImpl = function(e){
if(e){
this.setEvent(e.browserEvent || e);
}
};
Ext.EventObjectImpl.prototype = {
browserEvent : null,
button : -1,
shiftKey : false,
ctrlKey : false,
altKey : false,
BACKSPACE : 8,
TAB : 9,
RETURN : 13,
ENTER : 13,
SHIFT : 16,
CONTROL : 17,
ESC : 27,
SPACE : 32,
PAGEUP : 33,
PAGEDOWN : 34,
END : 35,
HOME : 36,
LEFT : 37,
UP : 38,
RIGHT : 39,
DOWN : 40,
DELETE : 46,
F5 : 116,
setEvent : function(e){
if(e == this || (e && e.browserEvent)){
return e;
}
this.browserEvent = e;
if(e){
this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);
if(e.type == 'click' && this.button == -1){
this.button = 0;
}
this.type = e.type;
this.shiftKey = e.shiftKey;
this.ctrlKey = e.ctrlKey || e.metaKey;
this.altKey = e.altKey;
this.keyCode = e.keyCode;
this.charCode = e.charCode;
this.target = E.getTarget(e);
this.xy = E.getXY(e);
}else{
this.button = -1;
this.shiftKey = false;
this.ctrlKey = false;
this.altKey = false;
this.keyCode = 0;
this.charCode =0;
this.target = null;
this.xy = [0, 0];
}
return this;
},
stopEvent : function(){
if(this.browserEvent){
if(this.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(this);
}
E.stopEvent(this.browserEvent);
}
},
preventDefault : function(){
if(this.browserEvent){
E.preventDefault(this.browserEvent);
}
},
isNavKeyPress : function(){
var k = this.keyCode;
k = Ext.isSafari ? (safariKeys[k] || k) : k;
return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;
},
isSpecialKey : function(){
var k = this.keyCode;
return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13 || k == 40 || k == 27 ||
(k == 16) || (k == 17) ||
(k >= 18 && k <= 20) ||
(k >= 33 && k <= 35) ||
(k >= 36 && k <= 39) ||
(k >= 44 && k <= 45);
},
stopPropagation : function(){
if(this.browserEvent){
if(this.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(this);
}
E.stopPropagation(this.browserEvent);
}
},
getCharCode : function(){
return this.charCode || this.keyCode;
},
getKey : function(){
var k = this.keyCode || this.charCode;
return Ext.isSafari ? (safariKeys[k] || k) : k;
},
getPageX : function(){
return this.xy[0];
},
getPageY : function(){
return this.xy[1];
},
getTime : function(){
if(this.browserEvent){
return E.getTime(this.browserEvent);
}
return null;
},
getXY : function(){
return this.xy;
},
getTarget : function(selector, maxDepth, returnEl){
var t = Ext.get(this.target);
return selector ? t.findParent(selector, maxDepth, returnEl) : (returnEl ? t : this.target);
},
getRelatedTarget : function(){
if(this.browserEvent){
return E.getRelatedTarget(this.browserEvent);
}
return null;
},
getWheelDelta : function(){
var e = this.browserEvent;
var delta = 0;
if(e.wheelDelta){
delta = e.wheelDelta/120;
}else if(e.detail){
delta = -e.detail/3;
}
return delta;
},
hasModifier : function(){
return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;
},
within : function(el, related){
var t = this[related ? "getRelatedTarget" : "getTarget"]();
return t && Ext.fly(el).contains(t);
},
getPoint : function(){
return new Ext.lib.Point(this.xy[0], this.xy[1]);
}
};
return new Ext.EventObjectImpl();
}();
(function(){
var D = Ext.lib.Dom;
var E = Ext.lib.Event;
var A = Ext.lib.Anim;
var propCache = {};
var camelRe = /(-[a-z])/gi;
var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
var view = document.defaultView;
Ext.Element = function(element, forceNew){
var dom = typeof element == "string" ?
document.getElementById(element) : element;
if(!dom){ return null;
}
var id = dom.id;
if(forceNew !== true && id && Ext.Element.cache[id]){ return Ext.Element.cache[id];
}
this.dom = dom;
this.id = id || Ext.id(dom);
};
var El = Ext.Element;
El.prototype = {
originalDisplay : "",
visibilityMode : 1,
defaultUnit : "px",
setVisibilityMode : function(visMode){
this.visibilityMode = visMode;
return this;
},
enableDisplayMode : function(display){
this.setVisibilityMode(El.DISPLAY);
if(typeof display != "undefined") this.originalDisplay = display;
return this;
},
findParent : function(simpleSelector, maxDepth, returnEl){
var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;
maxDepth = maxDepth || 50;
if(typeof maxDepth != "number"){
stopEl = Ext.getDom(maxDepth);
maxDepth = 10;
}
while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
if(dq.is(p, simpleSelector)){
return returnEl ? Ext.get(p) : p;
}
depth++;
p = p.parentNode;
}
return null;
},
findParentNode : function(simpleSelector, maxDepth, returnEl){
var p = Ext.fly(this.dom.parentNode, '_internal');
return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
},
up : function(simpleSelector, maxDepth){
return this.findParentNode(simpleSelector, maxDepth, true);
},
is : function(simpleSelector){
return Ext.DomQuery.is(this.dom, simpleSelector);
},
animate : function(args, duration, onComplete, easing, animType){
this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
return this;
},
anim : function(args, opt, animType, defaultDur, defaultEase, cb){
animType = animType || 'run';
opt = opt || {};
var anim = Ext.lib.Anim[animType](
this.dom, args,
(opt.duration || defaultDur) || .35,
(opt.easing || defaultEase) || 'easeOut',
function(){
Ext.callback(cb, this);
Ext.callback(opt.callback, opt.scope || this, [this, opt]);
},
this
);
opt.anim = anim;
return anim;
},
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]});
},
clean : function(forceReclean){
if(this.isCleaned && forceReclean !== true){
return this;
}
var ns = /\S/;
var d = this.dom, n = d.firstChild, ni = -1;
while(n){
var nx = n.nextSibling;
if(n.nodeType == 3 && !ns.test(n.nodeValue)){
d.removeChild(n);
}else{
n.nodeIndex = ++ni;
}
n = nx;
}
this.isCleaned = true;
return this;
},
scrollIntoView : function(container, hscroll){
var c = Ext.getDom(container) || Ext.getBody().dom;
var el = this.dom;
var o = this.getOffsetsTo(c),
l = o[0] + c.scrollLeft,
t = o[1] + c.scrollTop,
b = t+el.offsetHeight,
r = l+el.offsetWidth;
var ch = c.clientHeight;
var ct = parseInt(c.scrollTop, 10);
var cl = parseInt(c.scrollLeft, 10);
var cb = ct + ch;
var cr = cl + c.clientWidth;
if(el.offsetHeight > ch || t < ct){
c.scrollTop = t;
}else if(b > cb){
c.scrollTop = b-ch;
}
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;
},
scrollChildIntoView : function(child, hscroll){
Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
},
autoHeight : function(animate, duration, onComplete, easing){
var oldHeight = this.getHeight();
this.clip();
this.setHeight(1); setTimeout(function(){
var height = parseInt(this.dom.scrollHeight, 10); if(!animate){
this.setHeight(height);
this.unclip();
if(typeof onComplete == "function"){
onComplete();
}
}else{
this.setHeight(oldHeight); this.setHeight(height, animate, duration, function(){
this.unclip();
if(typeof onComplete == "function") onComplete();
}.createDelegate(this), easing);
}
}.createDelegate(this), 0);
return this;
},
contains : function(el){
if(!el){return false;}
return D.isAncestor(this.dom, el.dom ? el.dom : el);
},
isVisible : function(deep) {
var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");
if(deep !== true || !vis){
return vis;
}
var p = this.dom.parentNode;
while(p && p.tagName.toLowerCase() != "body"){
if(!Ext.fly(p, '_isVisible').isVisible()){
return false;
}
p = p.parentNode;
}
return true;
},
select : function(selector, unique){
return El.select(selector, unique, this.dom);
},
query : function(selector, unique){
return Ext.DomQuery.select(selector, this.dom);
},
child : function(selector, returnDom){
var n = Ext.DomQuery.selectNode(selector, this.dom);
return returnDom ? n : Ext.get(n);
},
down : function(selector, returnDom){
var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);
return returnDom ? n : Ext.get(n);
},
initDD : function(group, config, overrides){
var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
initDDProxy : function(group, config, overrides){
var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
initDDTarget : function(group, config, overrides){
var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
setVisible : function(visible, animate){
if(!animate || !A){
if(this.visibilityMode == El.DISPLAY){
this.setDisplayed(visible);
}else{
this.fixDisplay();
this.dom.style.visibility = visible ? "visible" : "hidden";
}
}else{
var dom = this.dom;
var visMode = this.visibilityMode;
if(visible){
this.setOpacity(.01);
this.setVisible(true);
}
this.anim({opacity: { to: (visible?1:0) }},
this.preanim(arguments, 1),
null, .35, 'easeIn', function(){
if(!visible){
if(visMode == El.DISPLAY){
dom.style.display = "none";
}else{
dom.style.visibility = "hidden";
}
Ext.get(dom).setOpacity(1);
}
});
}
return this;
},
isDisplayed : function() {
return this.getStyle("display") != "none";
},
toggle : function(animate){
this.setVisible(!this.isVisible(), this.preanim(arguments, 0));
return this;
},
setDisplayed : function(value) {
if(typeof value == "boolean"){
value = value ? this.originalDisplay : "none";
}
this.setStyle("display", value);
return this;
},
focus : function() {
try{
this.dom.focus();
}catch(e){}
return this;
},
blur : function() {
try{
this.dom.blur();
}catch(e){}
return this;
},
addClass : function(className){
if(Ext.isArray(className)){
for(var i = 0, len = className.length; i < len; i++) {
this.addClass(className[i]);
}
}else{
if(className && !this.hasClass(className)){
this.dom.className = this.dom.className + " " + className;
}
}
return this;
},
radioClass : function(className){
var siblings = this.dom.parentNode.childNodes;
for(var i = 0; i < siblings.length; i++) {
var s = siblings[i];
if(s.nodeType == 1){
Ext.get(s).removeClass(className);
}
}
this.addClass(className);
return this;
},
removeClass : function(className){
if(!className || !this.dom.className){
return this;
}
if(Ext.isArray(className)){
for(var i = 0, len = className.length; i < len; i++) {
this.removeClass(className[i]);
}
}else{
if(this.hasClass(className)){
var re = this.classReCache[className];
if (!re) {
re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");
this.classReCache[className] = re;
}
this.dom.className =
this.dom.className.replace(re, " ");
}
}
return this;
},
classReCache: {},
toggleClass : function(className){
if(this.hasClass(className)){
this.removeClass(className);
}else{
this.addClass(className);
}
return this;
},
hasClass : function(className){
return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
},
replaceClass : function(oldClassName, newClassName){
this.removeClass(oldClassName);
this.addClass(newClassName);
return this;
},
getStyles : function(){
var a = arguments, len = a.length, r = {};
for(var i = 0; i < len; i++){
r[a[i]] = this.getStyle(a[i]);
}
return r;
},
getStyle : function(){
return view && view.getComputedStyle ?
function(prop){
var el = this.dom, v, cs, camel;
if(prop == 'float'){
prop = "cssFloat";
}
if(v = el.style[prop]){
return v;
}
if(cs = view.getComputedStyle(el, "")){
if(!(camel = propCache[prop])){
camel = propCache[prop] = prop.replace(camelRe, camelFn);
}
return cs[camel];
}
return null;
} :
function(prop){
var el = this.dom, v, cs, camel;
if(prop == 'opacity'){
if(typeof el.style.filter == 'string'){
var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);
if(m){
var fv = parseFloat(m[1]);
if(!isNaN(fv)){
return fv ? fv / 100 : 0;
}
}
}
return 1;
}else if(prop == 'float'){
prop = "styleFloat";
}
if(!(camel = propCache[prop])){
camel = propCache[prop] = prop.replace(camelRe, camelFn);
}
if(v = el.style[camel]){
return v;
}
if(cs = el.currentStyle){
return cs[camel];
}
return null;
};
}(),
setStyle : function(prop, value){
if(typeof prop == "string"){
var camel;
if(!(camel = propCache[prop])){
camel = propCache[prop] = prop.replace(camelRe, camelFn);
}
if(camel == 'opacity') {
this.setOpacity(value);
}else{
this.dom.style[camel] = value;
}
}else{
for(var style in prop){
if(typeof prop[style] != "function"){
this.setStyle(style, prop[style]);
}
}
}
return this;
},
applyStyles : function(style){
Ext.DomHelper.applyStyles(this.dom, style);
return this;
},
getX : function(){
return D.getX(this.dom);
},
getY : function(){
return D.getY(this.dom);
},
getXY : function(){
return D.getXY(this.dom);
},
getOffsetsTo : function(el){
var o = this.getXY();
var e = Ext.fly(el, '_internal').getXY();
return [o[0]-e[0],o[1]-e[1]];
},
setX : function(x, animate){
if(!animate || !A){
D.setX(this.dom, x);
}else{
this.setXY([x, this.getY()], this.preanim(arguments, 1));
}
return this;
},
setY : function(y, animate){
if(!animate || !A){
D.setY(this.dom, y);
}else{
this.setXY([this.getX(), y], this.preanim(arguments, 1));
}
return this;
},
setLeft : function(left){
this.setStyle("left", this.addUnits(left));
return this;
},
setTop : function(top){
this.setStyle("top", this.addUnits(top));
return this;
},
setRight : function(right){
this.setStyle("right", this.addUnits(right));
return this;
},
setBottom : function(bottom){
this.setStyle("bottom", this.addUnits(bottom));
return this;
},
setXY : function(pos, animate){
if(!animate || !A){
D.setXY(this.dom, pos);
}else{
this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');
}
return this;
},
setLocation : function(x, y, animate){
this.setXY([x, y], this.preanim(arguments, 2));
return this;
},
moveTo : function(x, y, animate){
this.setXY([x, y], this.preanim(arguments, 2));
return this;
},
getRegion : function(){
return D.getRegion(this.dom);
},
getHeight : function(contentHeight){
var h = this.dom.offsetHeight || 0;
h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");
return h < 0 ? 0 : h;
},
getWidth : function(contentWidth){
var w = this.dom.offsetWidth || 0;
w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");
return w < 0 ? 0 : w;
},
getComputedHeight : function(){
var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);
if(!h){
h = parseInt(this.getStyle('height'), 10) || 0;
if(!this.isBorderBox()){
h += this.getFrameWidth('tb');
}
}
return h;
},
getComputedWidth : function(){
var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
if(!w){
w = parseInt(this.getStyle('width'), 10) || 0;
if(!this.isBorderBox()){
w += this.getFrameWidth('lr');
}
}
return w;
},
getSize : function(contentSize){
return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
},
getStyleSize : function(){
var w, h, d = this.dom, s = d.style;
if(s.width && s.width != 'auto'){
w = parseInt(s.width, 10);
if(Ext.isBorderBox){
w -= this.getFrameWidth('lr');
}
}
if(s.height && s.height != 'auto'){
h = parseInt(s.height, 10);
if(Ext.isBorderBox){
h -= this.getFrameWidth('tb');
}
}
return {width: w || this.getWidth(true), height: h || this.getHeight(true)};
},
getViewSize : function(){
var d = this.dom, doc = document, aw = 0, ah = 0;
if(d == doc || d == doc.body){
return {width : D.getViewWidth(), height: D.getViewHeight()};
}else{
return {
width : d.clientWidth,
height: d.clientHeight
};
}
},
getValue : function(asNumber){
return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;
},
adjustWidth : function(width){
if(typeof width == "number"){
if(this.autoBoxAdjust && !this.isBorderBox()){
width -= (this.getBorderWidth("lr") + this.getPadding("lr"));
}
if(width < 0){
width = 0;
}
}
return width;
},
adjustHeight : function(height){
if(typeof height == "number"){
if(this.autoBoxAdjust && !this.isBorderBox()){
height -= (this.getBorderWidth("tb") + this.getPadding("tb"));
}
if(height < 0){
height = 0;
}
}
return height;
},
setWidth : function(width, animate){
width = this.adjustWidth(width);
if(!animate || !A){
this.dom.style.width = this.addUnits(width);
}else{
this.anim({width: {to: width}}, this.preanim(arguments, 1));
}
return this;
},
setHeight : function(height, animate){
height = this.adjustHeight(height);
if(!animate || !A){
this.dom.style.height = this.addUnits(height);
}else{
this.anim({height: {to: height}}, this.preanim(arguments, 1));
}
return this;
},
setSize : function(width, height, animate){
if(typeof width == "object"){ height = width.height; width = width.width;
}
width = this.adjustWidth(width); height = this.adjustHeight(height);
if(!animate || !A){
this.dom.style.width = this.addUnits(width);
this.dom.style.height = this.addUnits(height);
}else{
this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));
}
return this;
},
setBounds : function(x, y, width, height, animate){
if(!animate || !A){
this.setSize(width, height);
this.setLocation(x, y);
}else{
width = this.adjustWidth(width); height = this.adjustHeight(height);
this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},
this.preanim(arguments, 4), 'motion');
}
return this;
},
setRegion : function(region, animate){
this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));
return this;
},
addListener : function(eventName, fn, scope, options){
Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);
},
removeListener : function(eventName, fn){
Ext.EventManager.removeListener(this.dom, eventName, fn);
return this;
},
removeAllListeners : function(){
E.purgeElement(this.dom);
return this;
},
relayEvent : function(eventName, observable){
this.on(eventName, function(e){
observable.fireEvent(eventName, e);
});
},
setOpacity : function(opacity, animate){
if(!animate || !A){
var s = this.dom.style;
if(Ext.isIE){
s.zoom = 1;
s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +
(opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")");
}else{
s.opacity = opacity;
}
}else{
this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');
}
return this;
},
getLeft : function(local){
if(!local){
return this.getX();
}else{
return parseInt(this.getStyle("left"), 10) || 0;
}
},
getRight : function(local){
if(!local){
return this.getX() + this.getWidth();
}else{
return (this.getLeft(true) + this.getWidth()) || 0;
}
},
getTop : function(local) {
if(!local){
return this.getY();
}else{
return parseInt(this.getStyle("top"), 10) || 0;
}
},
getBottom : function(local){
if(!local){
return this.getY() + this.getHeight();
}else{
return (this.getTop(true) + this.getHeight()) || 0;
}
},
position : function(pos, zIndex, x, y){
if(!pos){
if(this.getStyle('position') == 'static'){
this.setStyle('position', 'relative');
}
}else{
this.setStyle("position", pos);
}
if(zIndex){
this.setStyle("z-index", zIndex);
}
if(x !== undefined && y !== undefined){
this.setXY([x, y]);
}else if(x !== undefined){
this.setX(x);
}else if(y !== undefined){
this.setY(y);
}
},
clearPositioning : function(value){
value = value ||'';
this.setStyle({
"left": value,
"right": value,
"top": value,
"bottom": value,
"z-index": "",
"position" : "static"
});
return this;
},
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("z-index")
};
},
getBorderWidth : function(side){
return this.addStyles(side, El.borders);
},
getPadding : function(side){
return this.addStyles(side, El.paddings);
},
setPositioning : function(pc){
this.applyStyles(pc);
if(pc.right == "auto"){
this.dom.style.right = "";
}
if(pc.bottom == "auto"){
this.dom.style.bottom = "";
}
return this;
},
fixDisplay : function(){
if(this.getStyle("display") == "none"){
this.setStyle("visibility", "hidden");
this.setStyle("display", this.originalDisplay); if(this.getStyle("display") == "none"){ this.setStyle("display", "block");
}
}
},
setOverflow : function(v){
if(v=='auto' && Ext.isMac && Ext.isGecko){ this.dom.style.overflow = 'hidden';
(function(){this.dom.style.overflow = 'auto';}).defer(1, this);
}else{
this.dom.style.overflow = v;
}
},
setLeftTop : function(left, top){
this.dom.style.left = this.addUnits(left);
this.dom.style.top = this.addUnits(top);
return this;
},
move : function(direction, distance, animate){
var xy = this.getXY();
direction = direction.toLowerCase();
switch(direction){
case "l":
case "left":
this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));
break;
case "r":
case "right":
this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));
break;
case "t":
case "top":
case "up":
this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));
break;
case "b":
case "bottom":
case "down":
this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));
break;
}
return this;
},
clip : function(){
if(!this.isClipped){
this.isClipped = true;
this.originalClip = {
"o": this.getStyle("overflow"),
"x": this.getStyle("overflow-x"),
"y": this.getStyle("overflow-y")
};
this.setStyle("overflow", "hidden");
this.setStyle("overflow-x", "hidden");
this.setStyle("overflow-y", "hidden");
}
return this;
},
unclip : function(){
if(this.isClipped){
this.isClipped = false;
var o = this.originalClip;
if(o.o){this.setStyle("overflow", o.o);}
if(o.x){this.setStyle("overflow-x", o.x);}
if(o.y){this.setStyle("overflow-y", o.y);}
}
return this;
},
getAnchorXY : function(anchor, local, s){
var w, h, vp = false;
if(!s){
var d = this.dom;
if(d == document.body || d == document){
vp = true;
w = D.getViewWidth(); h = D.getViewHeight();
}else{
w = this.getWidth(); h = this.getHeight();
}
}else{
w = s.width; h = s.height;
}
var x = 0, y = 0, r = Math.round;
switch((anchor || "tl").toLowerCase()){
case "c":
x = r(w*.5);
y = r(h*.5);
break;
case "t":
x = r(w*.5);
y = 0;
break;
case "l":
x = 0;
y = r(h*.5);
break;
case "r":
x = w;
y = r(h*.5);
break;
case "b":
x = r(w*.5);
y = h;
break;
case "tl":
x = 0;
y = 0;
break;
case "bl":
x = 0;
y = h;
break;
case "br":
x = w;
y = h;
break;
case "tr":
x = w;
y = 0;
break;
}
if(local === true){
return [x, y];
}
if(vp){
var sc = this.getScroll();
return [x + sc.left, y + sc.top];
}
var o = this.getXY();
return [x+o[0], y+o[1]];
},
getAlignToXY : function(el, p, o){
el = Ext.get(el);
if(!el || !el.dom){
throw "Element.alignToXY with an element that doesn't exist";
}
var d = this.dom;
var c = false; var p1 = "", p2 = "";
o = o || [0,0];
if(!p){
p = "tl-bl";
}else if(p == "?"){
p = "tl-bl?";
}else if(p.indexOf("-") == -1){
p = "tl-" + p;
}
p = p.toLowerCase();
var 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];
var a1 = this.getAnchorXY(p1, true);
var a2 = el.getAnchorXY(p2, false);
var x = a2[0] - a1[0] + o[0];
var y = a2[1] - a1[1] + o[1];
if(c){
var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();
var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;
var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);
var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);
var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));
var doc = document;
var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;
var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;
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];
},
getConstrainToXY : function(){
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;
var vb = vy+vh;
var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);
var x = xy[0], y = xy[1];
var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
var moved = false;
if((x + w) > vr){
x = vr - w;
moved = true;
}
if((y + h) > vb){
y = vb - h;
moved = true;
}
if(x < vx){
x = vx;
moved = true;
}
if(y < vy){
y = vy;
moved = true;
}
return moved ? [x, y] : false;
};
}(),
adjustForConstraints : function(xy, parent, offsets){
return this.getConstrainToXY(parent || document, false, offsets, xy) || xy;
},
alignTo : function(element, position, offsets, animate){
var xy = this.getAlignToXY(element, position, offsets);
this.setXY(xy, this.preanim(arguments, 3));
return this;
},
anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
var action = function(){
this.alignTo(el, alignment, offsets, animate);
Ext.callback(callback, this);
};
Ext.EventManager.onWindowResize(action, this);
var tm = typeof monitorScroll;
if(tm != 'undefined'){
Ext.EventManager.on(window, 'scroll', action, this,
{buffer: tm == 'number' ? monitorScroll : 50});
}
action.call(this); return this;
},
clearOpacity : function(){
if (window.ActiveXObject) {
if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){
this.dom.style.filter = "";
}
} else {
this.dom.style.opacity = "";
this.dom.style["-moz-opacity"] = "";
this.dom.style["-khtml-opacity"] = "";
}
return this;
},
hide : function(animate){
this.setVisible(false, this.preanim(arguments, 0));
return this;
},
show : function(animate){
this.setVisible(true, this.preanim(arguments, 0));
return this;
},
addUnits : function(size){
return Ext.Element.addUnits(size, this.defaultUnit);
},
update : function(html, loadScripts, callback){
if(typeof html == "undefined"){
html = "";
}
if(loadScripts !== true){
this.dom.innerHTML = html;
if(typeof callback == "function"){
callback();
}
return this;
}
var id = Ext.id();
var dom = this.dom;
html += '<span id="' + id + '"></span>';
E.onAvailable(id, function(){
var hd = document.getElementsByTagName("head")[0];
var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
var typeRe = /\stype=([\'\"])(.*?)\1/i;
var match;
while(match = re.exec(html)){
var attrs = match[1];
var srcMatch = attrs ? attrs.match(srcRe) : false;
if(srcMatch && srcMatch[2]){
var s = document.createElement("script");
s.src = srcMatch[2];
var 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]);
}
}
}
var el = document.getElementById(id);
if(el){Ext.removeNode(el);}
if(typeof callback == "function"){
callback();
}
});
dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
return this;
},
load : function(){
var um = this.getUpdater();
um.update.apply(um, arguments);
return this;
},
getUpdater : function(){
if(!this.updateManager){
this.updateManager = new Ext.Updater(this);
}
return this.updateManager;
},
unselectable : function(){
this.dom.unselectable = "on";
this.swallowEvent("selectstart", true);
this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
this.addClass("x-unselectable");
return this;
},
getCenterXY : function(){
return this.getAlignToXY(document, 'c-c');
},
center : function(centerIn){
this.alignTo(centerIn || document, 'c-c');
return this;
},
isBorderBox : function(){
return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox;
},
getBox : function(contentBox, local){
var xy;
if(!local){
xy = this.getXY();
}else{
var left = parseInt(this.getStyle("left"), 10) || 0;
var top = parseInt(this.getStyle("top"), 10) || 0;
xy = [left, top];
}
var el = this.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{
var l = this.getBorderWidth("l")+this.getPadding("l");
var r = this.getBorderWidth("r")+this.getPadding("r");
var t = this.getBorderWidth("t")+this.getPadding("t");
var b = this.getBorderWidth("b")+this.getPadding("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;
},
getFrameWidth : function(sides, onlyContentBox){
return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
},
setBox : function(box, adjust, animate){
var w = box.width, h = box.height;
if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){
w -= (this.getBorderWidth("lr") + this.getPadding("lr"));
h -= (this.getBorderWidth("tb") + this.getPadding("tb"));
}
this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));
return this;
},
repaint : function(){
var dom = this.dom;
this.addClass("x-repaint");
setTimeout(function(){
Ext.get(dom).removeClass("x-repaint");
}, 1);
return this;
},
getMargins : function(side){
if(!side){
return {
top: parseInt(this.getStyle("margin-top"), 10) || 0,
left: parseInt(this.getStyle("margin-left"), 10) || 0,
bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,
right: parseInt(this.getStyle("margin-right"), 10) || 0
};
}else{
return this.addStyles(side, El.margins);
}
},
addStyles : function(sides, styles){
var val = 0, v, w;
for(var i = 0, len = sides.length; i < len; i++){
v = this.getStyle(styles[sides.charAt(i)]);
if(v){
w = parseInt(v, 10);
if(w){ val += (w >= 0 ? w : -1 * w); }
}
}
return val;
},
createProxy : function(config, renderTo, matchBox){
config = typeof config == "object" ?
config : {tag : "div", cls: config};
var proxy;
if(renderTo){
proxy = Ext.DomHelper.append(renderTo, config, true);
}else {
proxy = Ext.DomHelper.insertBefore(this.dom, config, true);
}
if(matchBox){
proxy.setBox(this.getBox());
}
return proxy;
},
mask : function(msg, msgCls){
if(this.getStyle("position") == "static"){
this.setStyle("position", "relative");
}
if(this._maskMsg){
this._maskMsg.remove();
}
if(this._mask){
this._mask.remove();
}
this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true);
this.addClass("x-masked");
this._mask.setDisplayed(true);
if(typeof msg == 'string'){
this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true);
var mm = this._maskMsg;
mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg";
mm.dom.firstChild.innerHTML = msg;
mm.setDisplayed(true);
mm.center(this);
}
if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){ this._mask.setSize(this.dom.clientWidth, this.getHeight());
}
return this._mask;
},
unmask : function(){
if(this._mask){
if(this._maskMsg){
this._maskMsg.remove();
delete this._maskMsg;
}
this._mask.remove();
delete this._mask;
}
this.removeClass("x-masked");
},
isMasked : function(){
return this._mask && this._mask.isVisible();
},
createShim : function(){
var el = document.createElement('iframe');
el.frameBorder = 'no';
el.className = 'ext-shim';
if(Ext.isIE && Ext.isSecure){
el.src = Ext.SSL_SECURE_URL;
}
var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
shim.autoBoxAdjust = false;
return shim;
},
remove : function(){
Ext.removeNode(this.dom);
delete El.cache[this.dom.id];
},
hover : function(overFn, outFn, scope){
var preOverFn = function(e){
if(!e.within(this, true)){
overFn.apply(scope || this, arguments);
}
};
var preOutFn = function(e){
if(!e.within(this, true)){
outFn.apply(scope || this, arguments);
}
};
this.on("mouseover", preOverFn, this.dom);
this.on("mouseout", preOutFn, this.dom);
return this;
},
addClassOnOver : function(className, preventFlicker){
this.hover(
function(){
Ext.fly(this, '_internal').addClass(className);
},
function(){
Ext.fly(this, '_internal').removeClass(className);
}
);
return 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;
},
addClassOnClick : function(className){
var dom = this.dom;
this.on("mousedown", function(){
Ext.fly(dom, '_internal').addClass(className);
var d = Ext.getDoc();
var fn = function(){
Ext.fly(dom, '_internal').removeClass(className);
d.removeListener("mouseup", fn);
};
d.on("mouseup", fn);
});
return this;
},
swallowEvent : function(eventName, preventDefault){
var fn = function(e){
e.stopPropagation();
if(preventDefault){
e.preventDefault();
}
};
if(Ext.isArray(eventName)){
for(var i = 0, len = eventName.length; i < len; i++){
this.on(eventName[i], fn);
}
return this;
}
this.on(eventName, fn);
return this;
},
parent : function(selector, returnDom){
return this.matchNode('parentNode', 'parentNode', selector, returnDom);
},
next : function(selector, returnDom){
return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);
},
prev : function(selector, returnDom){
return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);
},
first : function(selector, returnDom){
return this.matchNode('nextSibling', 'firstChild', selector, returnDom);
},
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 || Ext.DomQuery.is(n, selector))){
return !returnDom ? Ext.get(n) : n;
}
n = n[dir];
}
return null;
},
appendChild: function(el){
el = Ext.get(el);
el.appendTo(this);
return this;
},
createChild: function(config, insertBefore, returnDom){
config = config || {tag:'div'};
if(insertBefore){
return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
}
return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true);
},
appendTo: function(el){
el = Ext.getDom(el);
el.appendChild(this.dom);
return this;
},
insertBefore: function(el){
el = Ext.getDom(el);
el.parentNode.insertBefore(this.dom, el);
return this;
},
insertAfter: function(el){
el = Ext.getDom(el);
el.parentNode.insertBefore(this.dom, el.nextSibling);
return this;
},
insertFirst: function(el, returnDom){
el = el || {};
if(typeof el == 'object' && !el.nodeType && !el.dom){ return this.createChild(el, this.dom.firstChild, returnDom);
}else{
el = Ext.getDom(el);
this.dom.insertBefore(el, this.dom.firstChild);
return !returnDom ? Ext.get(el) : el;
}
},
insertSibling: function(el, where, returnDom){
var rt;
if(Ext.isArray(el)){
for(var i = 0, len = el.length; i < len; i++){
rt = this.insertSibling(el[i], where, returnDom);
}
return rt;
}
where = where ? where.toLowerCase() : 'before';
el = el || {};
var refNode = where == 'before' ? this.dom : this.dom.nextSibling;
if(typeof el == 'object' && !el.nodeType && !el.dom){ if(where == 'after' && !this.dom.nextSibling){
rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom);
}else{
rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);
}
}else{
rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode);
if(!returnDom){
rt = Ext.get(rt);
}
}
return rt;
},
wrap: function(config, returnDom){
if(!config){
config = {tag: "div"};
}
var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom);
newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
return newEl;
},
replace: function(el){
el = Ext.get(el);
this.insertBefore(el);
el.remove();
return this;
},
replaceWith: function(el){
if(typeof el == 'object' && !el.nodeType && !el.dom){ el = this.insertSibling(el, 'before');
}else{
el = Ext.getDom(el);
this.dom.parentNode.insertBefore(el, this.dom);
}
El.uncache(this.id);
this.dom.parentNode.removeChild(this.dom);
this.dom = el;
this.id = Ext.id(el);
El.cache[this.id] = this;
return this;
},
insertHtml : function(where, html, returnEl){
var el = Ext.DomHelper.insertHtml(where, this.dom, html);
return returnEl ? Ext.get(el) : el;
},
set : function(o, useSet){
var el = this.dom;
useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;
for(var attr in o){
if(attr == "style" || typeof o[attr] == "function") continue;
if(attr=="cls"){
el.className = o["cls"];
}else if(o.hasOwnProperty(attr)){
if(useSet) el.setAttribute(attr, o[attr]);
else el[attr] = o[attr];
}
}
if(o.style){
Ext.DomHelper.applyStyles(el, o.style);
}
return this;
},
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);
},
addKeyMap : function(config){
return new Ext.KeyMap(this, config);
},
isScrollable : function(){
var dom = this.dom;
return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
},
scrollTo : function(side, value, animate){
var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";
if(!animate || !A){
this.dom[prop] = value;
}else{
var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];
this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');
}
return this;
},
scroll : function(direction, distance, animate){
if(!this.isScrollable()){
return;
}
var el = this.dom;
var l = el.scrollLeft, t = el.scrollTop;
var w = el.scrollWidth, h = el.scrollHeight;
var cw = el.clientWidth, ch = el.clientHeight;
direction = direction.toLowerCase();
var scrolled = false;
var a = this.preanim(arguments, 2);
switch(direction){
case "l":
case "left":
if(w - l > cw){
var v = Math.min(l + distance, w-cw);
this.scrollTo("left", v, a);
scrolled = true;
}
break;
case "r":
case "right":
if(l > 0){
var v = Math.max(l - distance, 0);
this.scrollTo("left", v, a);
scrolled = true;
}
break;
case "t":
case "top":
case "up":
if(t > 0){
var v = Math.max(t - distance, 0);
this.scrollTo("top", v, a);
scrolled = true;
}
break;
case "b":
case "bottom":
case "down":
if(h - t > ch){
var v = Math.min(t + distance, h-ch);
this.scrollTo("top", v, a);
scrolled = true;
}
break;
}
return scrolled;
},
translatePoints : function(x, y){
if(typeof x == 'object' || Ext.isArray(x)){
y = x[1]; x = x[0];
}
var p = this.getStyle('position');
var o = this.getXY();
var l = parseInt(this.getStyle('left'), 10);
var t = parseInt(this.getStyle('top'), 10);
if(isNaN(l)){
l = (p == "relative") ? 0 : this.dom.offsetLeft;
}
if(isNaN(t)){
t = (p == "relative") ? 0 : this.dom.offsetTop;
}
return {left: (x - o[0] + l), top: (y - o[1] + t)};
},
getScroll : function(){
var d = this.dom, doc = document;
if(d == doc || d == doc.body){
var l, t;
if(Ext.isIE && Ext.isStrict){
l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0);
t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0);
}else{
l = window.pageXOffset || (doc.body.scrollLeft || 0);
t = window.pageYOffset || (doc.body.scrollTop || 0);
}
return {left: l, top: t};
}else{
return {left: d.scrollLeft, top: d.scrollTop};
}
},
getColor : function(attr, defaultValue, prefix){
var v = this.getStyle(attr);
if(!v || v == "transparent" || v == "inherit") {
return defaultValue;
}
var color = typeof prefix == "undefined" ? "#" : prefix;
if(v.substr(0, 4) == "rgb("){
var rvs = v.slice(4, v.length -1).split(",");
for(var i = 0; i < 3; i++){
var h = parseInt(rvs[i]);
var s = h.toString(16);
if(h < 16){
s = "0" + s;
}
color += s;
}
} else {
if(v.substr(0, 1) == "#"){
if(v.length == 4) {
for(var i = 1; i < 4; i++){
var c = v.charAt(i);
color += c + c;
}
}else if(v.length == 7){
color += v.substr(1);
}
}
}
return(color.length > 5 ? color.toLowerCase() : defaultValue);
},
boxWrap : function(cls){
cls = cls || 'x-box';
var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));
el.child('.'+cls+'-mc').dom.appendChild(this.dom);
return el;
},
getAttributeNS : Ext.isIE ? function(ns, name){
var d = this.dom;
var type = typeof d[ns+":"+name];
if(type != 'undefined' && type != 'unknown'){
return d[ns+":"+name];
}
return d[name];
} : function(ns, name){
var d = this.dom;
return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
},
getTextWidth : function(text, min, max){
return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000);
}
};
var ep = El.prototype;
ep.on = ep.addListener;
ep.mon = ep.addListener;
ep.getUpdateManager = ep.getUpdater;
ep.un = ep.removeListener;
ep.autoBoxAdjust = true;
El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;
El.addUnits = function(v, defaultUnit){
if(v === "" || v == "auto"){
return v;
}
if(v === undefined){
return '';
}
if(typeof v == "number" || !El.unitPattern.test(v)){
return v + (defaultUnit || 'px');
}
return v;
};
El.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>';
El.VISIBILITY = 1;
El.DISPLAY = 2;
El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};
El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};
El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};
El.cache = {};
var docEl;
El.get = function(el){
var ex, elm, id;
if(!el){ return null; }
if(typeof el == "string"){ if(!(elm = document.getElementById(el))){
return null;
}
if(ex = El.cache[el]){
ex.dom = elm;
}else{
ex = El.cache[el] = new El(elm);
}
return ex;
}else if(el.tagName){ if(!(id = el.id)){
id = Ext.id(el);
}
if(ex = El.cache[id]){
ex.dom = el;
}else{
ex = El.cache[id] = new El(el);
}
return ex;
}else if(el instanceof El){
if(el != docEl){
el.dom = document.getElementById(el.id) || el.dom; El.cache[el.id] = el; }
return el;
}else if(el.isComposite){
return el;
}else if(Ext.isArray(el)){
return El.select(el);
}else if(el == document){
if(!docEl){
var f = function(){};
f.prototype = El.prototype;
docEl = new f();
docEl.dom = document;
}
return docEl;
}
return null;
};
El.uncache = function(el){
for(var i = 0, a = arguments, len = a.length; i < len; i++) {
if(a[i]){
delete El.cache[a[i].id || a[i]];
}
}
};
El.garbageCollect = function(){
if(!Ext.enableGarbageCollector){
clearInterval(El.collectorThread);
return;
}
for(var eid in El.cache){
var el = El.cache[eid], d = el.dom;
if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){
delete El.cache[eid];
if(d && Ext.enableListenerCollection){
E.purgeElement(d);
}
}
}
}
El.collectorThreadId = setInterval(El.garbageCollect, 30000);
var flyFn = function(){};
flyFn.prototype = El.prototype;
var _cls = new flyFn();
El.Flyweight = function(dom){
this.dom = dom;
};
El.Flyweight.prototype = _cls;
El.Flyweight.prototype.isFlyweight = true;
El._flyweights = {};
El.fly = function(el, named){
named = named || '_global';
el = Ext.getDom(el);
if(!el){
return null;
}
if(!El._flyweights[named]){
El._flyweights[named] = new El.Flyweight();
}
El._flyweights[named].dom = el;
return El._flyweights[named];
};
Ext.get = El.get;
Ext.fly = El.fly;
var noBoxAdjust = Ext.isStrict ? {
select:1
} : {
input:1, select:1, textarea:1
};
if(Ext.isIE || Ext.isGecko){
noBoxAdjust['button'] = 1;
}
Ext.EventManager.on(window, 'unload', function(){
delete El.cache;
delete El._flyweights;
});
})();
Ext.enableFx = true;
Ext.Fx = {
slideIn : function(anchor, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
anchor = anchor || "t";
this.fixDisplay();
var r = this.getFxRestore();
var b = this.getBox();
this.setSize(b);
var wrap = this.fxWrap(r.pos, o, "hidden");
var st = this.dom.style;
st.visibility = "visible";
st.position = "absolute";
var after = function(){
el.fxUnwrap(wrap, r.pos, o);
st.width = r.width;
st.height = r.height;
el.afterFx(o);
};
var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};
switch(anchor.toLowerCase()){
case "t":
wrap.setSize(b.width, 0);
st.left = st.bottom = "0";
a = {height: bh};
break;
case "l":
wrap.setSize(0, b.height);
st.right = st.top = "0";
a = {width: bw};
break;
case "r":
wrap.setSize(0, b.height);
wrap.setX(b.right);
st.left = st.top = "0";
a = {width: bw, points: pt};
break;
case "b":
wrap.setSize(b.width, 0);
wrap.setY(b.bottom);
st.left = st.top = "0";
a = {height: bh, points: pt};
break;
case "tl":
wrap.setSize(0, 0);
st.right = st.bottom = "0";
a = {width: bw, height: bh};
break;
case "bl":
wrap.setSize(0, 0);
wrap.setY(b.y+b.height);
st.right = st.top = "0";
a = {width: bw, height: bh, points: pt};
break;
case "br":
wrap.setSize(0, 0);
wrap.setXY([b.right, b.bottom]);
st.left = st.top = "0";
a = {width: bw, height: bh, points: pt};
break;
case "tr":
wrap.setSize(0, 0);
wrap.setX(b.x+b.width);
st.left = st.bottom = "0";
a = {width: bw, height: bh, points: pt};
break;
}
this.dom.style.visibility = "visible";
wrap.show();
arguments.callee.anim = wrap.fxanim(a,
o,
'motion',
.5,
'easeOut', after);
});
return this;
},
slideOut : function(anchor, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
anchor = anchor || "t";
var r = this.getFxRestore();
var b = this.getBox();
this.setSize(b);
var wrap = this.fxWrap(r.pos, o, "visible");
var st = this.dom.style;
st.visibility = "visible";
st.position = "absolute";
wrap.setSize(b);
var after = function(){
if(o.useDisplay){
el.setDisplayed(false);
}else{
el.hide();
}
el.fxUnwrap(wrap, r.pos, o);
st.width = r.width;
st.height = r.height;
el.afterFx(o);
};
var a, zero = {to: 0};
switch(anchor.toLowerCase()){
case "t":
st.left = st.bottom = "0";
a = {height: zero};
break;
case "l":
st.right = st.top = "0";
a = {width: zero};
break;
case "r":
st.left = st.top = "0";
a = {width: zero, points: {to:[b.right, b.y]}};
break;
case "b":
st.left = st.top = "0";
a = {height: zero, points: {to:[b.x, b.bottom]}};
break;
case "tl":
st.right = st.bottom = "0";
a = {width: zero, height: zero};
break;
case "bl":
st.right = st.top = "0";
a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};
break;
case "br":
st.left = st.top = "0";
a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};
break;
case "tr":
st.left = st.bottom = "0";
a = {width: zero, height: zero, points: {to:[b.right, b.y]}};
break;
}
arguments.callee.anim = wrap.fxanim(a,
o,
'motion',
.5,
"easeOut", after);
});
return this;
},
puff : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
this.clearOpacity();
this.show();
var r = this.getFxRestore();
var st = this.dom.style;
var after = function(){
if(o.useDisplay){
el.setDisplayed(false);
}else{
el.hide();
}
el.clearOpacity();
el.setPositioning(r.pos);
st.width = r.width;
st.height = r.height;
st.fontSize = '';
el.afterFx(o);
};
var width = this.getWidth();
var height = this.getHeight();
arguments.callee.anim = this.fxanim({
width : {to: this.adjustWidth(width * 2)},
height : {to: this.adjustHeight(height * 2)},
points : {by: [-(width * .5), -(height * .5)]},
opacity : {to: 0},
fontSize: {to:200, unit: "%"}
},
o,
'motion',
.5,
"easeOut", after);
});
return this;
},
switchOff : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
this.clearOpacity();
this.clip();
var r = this.getFxRestore();
var st = this.dom.style;
var after = function(){
if(o.useDisplay){
el.setDisplayed(false);
}else{
el.hide();
}
el.clearOpacity();
el.setPositioning(r.pos);
st.width = r.width;
st.height = r.height;
el.afterFx(o);
};
this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){
this.clearOpacity();
(function(){
this.fxanim({
height:{to:1},
points:{by:[0, this.getHeight() * .5]}
}, o, 'motion', 0.3, 'easeIn', after);
}).defer(100, this);
});
});
return this;
},
highlight : function(color, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
color = color || "ffff9c";
var attr = o.attr || "backgroundColor";
this.clearOpacity();
this.show();
var origColor = this.getColor(attr);
var restoreColor = this.dom.style[attr];
var endColor = (o.endColor || origColor) || "ffffff";
var after = function(){
el.dom.style[attr] = restoreColor;
el.afterFx(o);
};
var a = {};
a[attr] = {from: color, to: endColor};
arguments.callee.anim = this.fxanim(a,
o,
'color',
1,
'easeIn', after);
});
return this;
},
frame : function(color, count, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
color = color || "#C3DAF9";
if(color.length == 6){
color = "#" + color;
}
count = count || 1;
var duration = o.duration || 1;
this.show();
var b = this.getBox();
var animFn = function(){
var proxy = Ext.getBody().createChild({
style:{
visbility:"hidden",
position:"absolute",
"z-index":"35000", border:"0px solid " + color
}
});
var scale = Ext.isBorderBox ? 2 : 1;
proxy.animate({
top:{from:b.y, to:b.y - 20},
left:{from:b.x, to:b.x - 20},
borderWidth:{from:0, to:10},
opacity:{from:1, to:0},
height:{from:b.height, to:(b.height + (20*scale))},
width:{from:b.width, to:(b.width + (20*scale))}
}, duration, function(){
proxy.remove();
if(--count > 0){
animFn();
}else{
el.afterFx(o);
}
});
};
animFn.call(this);
});
return this;
},
pause : function(seconds){
var el = this.getFxEl();
var o = {};
el.queueFx(o, function(){
setTimeout(function(){
el.afterFx(o);
}, seconds * 1000);
});
return this;
},
fadeIn : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
this.setOpacity(0);
this.fixDisplay();
this.dom.style.visibility = 'visible';
var to = o.endOpacity || 1;
arguments.callee.anim = this.fxanim({opacity:{to:to}},
o, null, .5, "easeOut", function(){
if(to == 1){
this.clearOpacity();
}
el.afterFx(o);
});
});
return this;
},
fadeOut : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
arguments.callee.anim = this.fxanim({opacity:{to:o.endOpacity || 0}},
o, null, .5, "easeOut", function(){
if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){
this.dom.style.display = "none";
}else{
this.dom.style.visibility = "hidden";
}
this.clearOpacity();
el.afterFx(o);
});
});
return this;
},
scale : function(w, h, o){
this.shift(Ext.apply({}, o, {
width: w,
height: h
}));
return this;
},
shift : function(o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
var a = {}, w = o.width, h = o.height, x = o.x, y = o.y, op = o.opacity;
if(w !== undefined){
a.width = {to: this.adjustWidth(w)};
}
if(h !== undefined){
a.height = {to: this.adjustHeight(h)};
}
if(x !== undefined || y !== undefined){
a.points = {to: [
x !== undefined ? x : this.getX(),
y !== undefined ? y : this.getY()
]};
}
if(op !== undefined){
a.opacity = {to: op};
}
if(o.xy !== undefined){
a.points = {to: o.xy};
}
arguments.callee.anim = this.fxanim(a,
o, 'motion', .35, "easeOut", function(){
el.afterFx(o);
});
});
return this;
},
ghost : function(anchor, o){
var el = this.getFxEl();
o = o || {};
el.queueFx(o, function(){
anchor = anchor || "b";
var r = this.getFxRestore();
var w = this.getWidth(),
h = this.getHeight();
var st = this.dom.style;
var after = function(){
if(o.useDisplay){
el.setDisplayed(false);
}else{
el.hide();
}
el.clearOpacity();
el.setPositioning(r.pos);
st.width = r.width;
st.height = r.height;
el.afterFx(o);
};
var a = {opacity: {to: 0}, points: {}}, pt = a.points;
switch(anchor.toLowerCase()){
case "t":
pt.by = [0, -h];
break;
case "l":
pt.by = [-w, 0];
break;
case "r":
pt.by = [w, 0];
break;
case "b":
pt.by = [0, h];
break;
case "tl":
pt.by = [-w, -h];
break;
case "bl":
pt.by = [-w, h];
break;
case "br":
pt.by = [w, h];
break;
case "tr":
pt.by = [w, -h];
break;
}
arguments.callee.anim = this.fxanim(a,
o,
'motion',
.5,
"easeOut", after);
});
return this;
},
syncFx : function(){
this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
block : false,
concurrent : true,
stopFx : false
});
return this;
},
sequenceFx : function(){
this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
block : false,
concurrent : false,
stopFx : false
});
return this;
},
nextFx : function(){
var ef = this.fxQueue[0];
if(ef){
ef.call(this);
}
},
hasActiveFx : function(){
return this.fxQueue && this.fxQueue[0];
},
stopFx : function(){
if(this.hasActiveFx()){
var cur = this.fxQueue[0];
if(cur && cur.anim && cur.anim.isAnimated()){
this.fxQueue = [cur]; cur.anim.stop(true);
}
}
return this;
},
beforeFx : function(o){
if(this.hasActiveFx() && !o.concurrent){
if(o.stopFx){
this.stopFx();
return true;
}
return false;
}
return true;
},
hasFxBlock : function(){
var q = this.fxQueue;
return q && q[0] && q[0].block;
},
queueFx : function(o, fn){
if(!this.fxQueue){
this.fxQueue = [];
}
if(!this.hasFxBlock()){
Ext.applyIf(o, this.fxDefaults);
if(!o.concurrent){
var run = this.beforeFx(o);
fn.block = o.block;
this.fxQueue.push(fn);
if(run){
this.nextFx();
}
}else{
fn.call(this);
}
}
return this;
},
fxWrap : function(pos, o, vis){
var wrap;
if(!o.wrap || !(wrap = Ext.get(o.wrap))){
var wrapXY;
if(o.fixPosition){
wrapXY = this.getXY();
}
var div = document.createElement("div");
div.style.visibility = vis;
wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));
wrap.setPositioning(pos);
if(wrap.getStyle("position") == "static"){
wrap.position("relative");
}
this.clearPositioning('auto');
wrap.clip();
wrap.dom.appendChild(this.dom);
if(wrapXY){
wrap.setXY(wrapXY);
}
}
return wrap;
},
fxUnwrap : function(wrap, pos, o){
this.clearPositioning();
this.setPositioning(pos);
if(!o.wrap){
wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);
wrap.remove();
}
},
getFxRestore : function(){
var st = this.dom.style;
return {pos: this.getPositioning(), width: st.width, height : st.height};
},
afterFx : function(o){
if(o.afterStyle){
this.applyStyles(o.afterStyle);
}
if(o.afterCls){
this.addClass(o.afterCls);
}
if(o.remove === true){
this.remove();
}
Ext.callback(o.callback, o.scope, [this]);
if(!o.concurrent){
this.fxQueue.shift();
this.nextFx();
}
},
getFxEl : function(){ return Ext.get(this.dom);
},
fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){
animType = animType || 'run';
opt = opt || {};
var anim = Ext.lib.Anim[animType](
this.dom, args,
(opt.duration || defaultDur) || .35,
(opt.easing || defaultEase) || 'easeOut',
function(){
Ext.callback(cb, this);
},
this
);
opt.anim = anim;
return anim;
}
};
Ext.Fx.resize = Ext.Fx.scale;
Ext.apply(Ext.Element.prototype, Ext.Fx);
Ext.CompositeElement = function(els){
this.elements = [];
this.addElements(els);
};
Ext.CompositeElement.prototype = {
isComposite: true,
addElements : function(els){
if(!els) return this;
if(typeof els == "string"){
els = Ext.Element.selectorFunction(els);
}
var yels = this.elements;
var index = yels.length-1;
for(var i = 0, len = els.length; i < len; i++) {
yels[++index] = Ext.get(els[i]);
}
return this;
},
fill : function(els){
this.elements = [];
this.add(els);
return this;
},
filter : function(selector){
var els = [];
this.each(function(el){
if(el.is(selector)){
els[els.length] = el.dom;
}
});
this.fill(els);
return this;
},
invoke : function(fn, args){
var els = this.elements;
for(var i = 0, len = els.length; i < len; i++) {
Ext.Element.prototype[fn].apply(els[i], args);
}
return this;
},
add : function(els){
if(typeof els == "string"){
this.addElements(Ext.Element.selectorFunction(els));
}else if(els.length !== undefined){
this.addElements(els);
}else{
this.addElements([els]);
}
return this;
},
each : function(fn, scope){
var els = this.elements;
for(var i = 0, len = els.length; i < len; i++){
if(fn.call(scope || els[i], els[i], this, i) === false) {
break;
}
}
return this;
},
item : function(index){
return this.elements[index] || null;
},
first : function(){
return this.item(0);
},
last : function(){
return this.item(this.elements.length-1);
},
getCount : function(){
return this.elements.length;
},
contains : function(el){
return this.indexOf(el) !== -1;
},
indexOf : function(el){
return this.elements.indexOf(Ext.get(el));
},
removeElement : function(el, removeDom){
if(Ext.isArray(el)){
for(var i = 0, len = el.length; i < len; i++){
this.removeElement(el[i]);
}
return this;
}
var index = typeof el == 'number' ? el : this.indexOf(el);
if(index !== -1 && this.elements[index]){
if(removeDom){
var d = this.elements[index];
if(d.dom){
d.remove();
}else{
Ext.removeNode(d);
}
}
this.elements.splice(index, 1);
}
return this;
},
replaceElement : function(el, replacement, domReplace){
var index = typeof el == 'number' ? el : this.indexOf(el);
if(index !== -1){
if(domReplace){
this.elements[index].replaceWith(replacement);
}else{
this.elements.splice(index, 1, Ext.get(replacement))
}
}
return this;
},
clear : function(){
this.elements = [];
}
};
(function(){
Ext.CompositeElement.createCall = function(proto, fnName){
if(!proto[fnName]){
proto[fnName] = function(){
return this.invoke(fnName, arguments);
};
}
};
for(var fnName in Ext.Element.prototype){
if(typeof Ext.Element.prototype[fnName] == "function"){
Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);
}
};
})();
Ext.CompositeElementLite = function(els){
Ext.CompositeElementLite.superclass.constructor.call(this, els);
this.el = new Ext.Element.Flyweight();
};
Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {
addElements : function(els){
if(els){
if(Ext.isArray(els)){
this.elements = this.elements.concat(els);
}else{
var yels = this.elements;
var index = yels.length-1;
for(var i = 0, len = els.length; i < len; i++) {
yels[++index] = els[i];
}
}
}
return this;
},
invoke : function(fn, args){
var els = this.elements;
var el = this.el;
for(var i = 0, len = els.length; i < len; i++) {
el.dom = els[i];
Ext.Element.prototype[fn].apply(el, args);
}
return this;
},
item : function(index){
if(!this.elements[index]){
return null;
}
this.el.dom = this.elements[index];
return this.el;
},
addListener : function(eventName, handler, scope, opt){
var els = this.elements;
for(var i = 0, len = els.length; i < len; i++) {
Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt);
}
return this;
},
each : function(fn, scope){
var els = this.elements;
var el = this.el;
for(var i = 0, len = els.length; i < len; i++){
el.dom = els[i];
if(fn.call(scope || el, el, this, i) === false){
break;
}
}
return this;
},
indexOf : function(el){
return this.elements.indexOf(Ext.getDom(el));
},
replaceElement : function(el, replacement, domReplace){
var index = typeof el == 'number' ? el : this.indexOf(el);
if(index !== -1){
replacement = Ext.getDom(replacement);
if(domReplace){
var d = this.elements[index];
d.parentNode.insertBefore(replacement, d);
Ext.removeNode(d);
}
this.elements.splice(index, 1, replacement);
}
return this;
}
});
Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
if(Ext.DomQuery){
Ext.Element.selectorFunction = Ext.DomQuery.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";
}
if(unique === true){
return new Ext.CompositeElement(els);
}else{
return new Ext.CompositeElementLite(els);
}
};
Ext.select = Ext.Element.select;
Ext.data.Connection = function(config){
Ext.apply(this, config);
this.addEvents(
"beforerequest",
"requestcomplete",
"requestexception"
);
Ext.data.Connection.superclass.constructor.call(this);
};
Ext.extend(Ext.data.Connection, Ext.util.Observable, {
timeout : 30000,
autoAbort:false,
disableCaching: true,
request : function(o){
if(this.fireEvent("beforerequest", this, o) !== false){
var p = o.params;
if(typeof p == "function"){
p = p.call(o.scope||window, o);
}
if(typeof p == "object"){
p = Ext.urlEncode(p);
}
if(this.extraParams){
var extras = Ext.urlEncode(this.extraParams);
p = p ? (p + '&' + extras) : extras;
}
var url = o.url || this.url;
if(typeof url == 'function'){
url = url.call(o.scope||window, o);
}
if(o.form){
var form = Ext.getDom(o.form);
url = url || form.action;
var enctype = form.getAttribute("enctype");
if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
return this.doFormUpload(o, p, url);
}
var f = Ext.lib.Ajax.serializeForm(form);
p = p ? (p + '&' + f) : f;
}
var hs = o.headers;
if(this.defaultHeaders){
hs = Ext.apply(hs || {}, this.defaultHeaders);
if(!o.headers){
o.headers = hs;
}
}
var cb = {
success: this.handleResponse,
failure: this.handleFailure,
scope: this,
argument: {options: o},
timeout : o.timeout || this.timeout
};
var method = o.method||this.method||(p ? "POST" : "GET");
if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime());
}
if(typeof o.autoAbort == 'boolean'){
if(o.autoAbort){
this.abort();
}
}else if(this.autoAbort !== false){
this.abort();
}
if((method == 'GET' && p) || o.xmlData || o.jsonData){
url += (url.indexOf('?') != -1 ? '&' : '?') + p;
p = '';
}
this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
return this.transId;
}else{
Ext.callback(o.callback, o.scope, [o, null, null]);
return null;
}
},
isLoading : function(transId){
if(transId){
return Ext.lib.Ajax.isCallInProgress(transId);
}else{
return this.transId ? true : false;
}
},
abort : function(transId){
if(transId || this.isLoading()){
Ext.lib.Ajax.abort(transId || this.transId);
}
},
handleResponse : function(response){
this.transId = false;
var options = response.argument.options;
response.argument = options ? options.argument : null;
this.fireEvent("requestcomplete", this, response, options);
Ext.callback(options.success, options.scope, [response, options]);
Ext.callback(options.callback, options.scope, [options, true, response]);
},
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);
Ext.callback(options.failure, options.scope, [response, options]);
Ext.callback(options.callback, options.scope, [options, false, response]);
},
doFormUpload : function(o, ps, url){
var id = Ext.id();
var frame = document.createElement('iframe');
frame.id = id;
frame.name = id;
frame.className = 'x-hidden';
if(Ext.isIE){
frame.src = Ext.SSL_SECURE_URL;
}
document.body.appendChild(frame);
if(Ext.isIE){
document.frames[id].name = id;
}
var form = Ext.getDom(o.form);
form.target = id;
form.method = 'POST';
form.enctype = form.encoding = 'multipart/form-data';
if(url){
form.action = url;
}
var hiddens, hd;
if(ps){
hiddens = [];
ps = Ext.urlDecode(ps, false);
for(var k in ps){
if(ps.hasOwnProperty(k)){
hd = document.createElement('input');
hd.type = 'hidden';
hd.name = k;
hd.value = ps[k];
form.appendChild(hd);
hiddens.push(hd);
}
}
}
function cb(){
var r = {
responseText : '',
responseXML : null
};
r.argument = o ? o.argument : null;
try {
var doc;
if(Ext.isIE){
doc = frame.contentWindow.document;
}else {
doc = (frame.contentDocument || window.frames[id].document);
}
if(doc && doc.body){
r.responseText = doc.body.innerHTML;
}
if(doc && doc.XMLDocument){
r.responseXML = doc.XMLDocument;
}else {
r.responseXML = doc;
}
}
catch(e) {
}
Ext.EventManager.removeListener(frame, 'load', cb, this);
this.fireEvent("requestcomplete", this, r, o);
Ext.callback(o.success, o.scope, [r, o]);
Ext.callback(o.callback, o.scope, [o, true, r]);
setTimeout(function(){Ext.removeNode(frame);}, 100);
}
Ext.EventManager.on(frame, 'load', cb, this);
form.submit();
if(hiddens){
for(var i = 0, len = hiddens.length; i < len; i++){
Ext.removeNode(hiddens[i]);
}
}
}
});
Ext.Ajax = new Ext.data.Connection({
autoAbort : false,
serializeForm : function(form){
return Ext.lib.Ajax.serializeForm(form);
}
});
Ext.Updater = function(el, forceNew){
el = Ext.get(el);
if(!forceNew && el.updateManager){
return el.updateManager;
}
this.el = el;
this.defaultUrl = null;
this.addEvents(
"beforeupdate",
"update",
"failure"
);
var d = Ext.Updater.defaults;
this.sslBlankUrl = d.sslBlankUrl;
this.disableCaching = d.disableCaching;
this.indicatorText = d.indicatorText;
this.showLoadIndicator = d.showLoadIndicator;
this.timeout = d.timeout;
this.loadScripts = d.loadScripts;
this.transaction = null;
this.autoRefreshProcId = null;
this.refreshDelegate = this.refresh.createDelegate(this);
this.updateDelegate = this.update.createDelegate(this);
this.formUpdateDelegate = this.formUpdate.createDelegate(this);
if(!this.renderer){
this.renderer = new Ext.Updater.BasicRenderer();
}
Ext.Updater.superclass.constructor.call(this);
};
Ext.extend(Ext.Updater, Ext.util.Observable, {
getEl : function(){
return this.el;
},
update : function(url, params, callback, discardUrl){
if(this.fireEvent("beforeupdate", this.el, url, params) !== false){
var method = this.method, cfg, callerScope;
if(typeof url == "object"){
cfg = url;
url = cfg.url;
params = params || cfg.params;
callback = callback || cfg.callback;
discardUrl = discardUrl || cfg.discardUrl;
callerScope = cfg.scope;
if(typeof cfg.method != "undefined"){method = cfg.method;};
if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};
if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};
if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};
if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};
}
this.showLoading();
if(!discardUrl){
this.defaultUrl = url;
}
if(typeof url == "function"){
url = url.call(this);
}
method = method || (params ? "POST" : "GET");
if(method == "GET"){
url = this.prepareUrl(url);
}
var o = Ext.apply(cfg ||{}, {
url : url,
params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params,
success: this.processSuccess,
failure: this.processFailure,
scope: this,
callback: undefined,
timeout: (this.timeout*1000),
argument: {
"options": cfg,
"url": url,
"form": null,
"callback": callback,
"scope": callerScope || window,
"params": params
}
});
this.transaction = Ext.Ajax.request(o);
}
},
formUpdate : function(form, url, reset, callback){
if(this.fireEvent("beforeupdate", this.el, form, url) !== false){
if(typeof url == "function"){
url = url.call(this);
}
form = Ext.getDom(form)
this.transaction = Ext.Ajax.request({
form: form,
url:url,
success: this.processSuccess,
failure: this.processFailure,
scope: this,
timeout: (this.timeout*1000),
argument: {
"url": url,
"form": form,
"callback": callback,
"reset": reset
}
});
this.showLoading.defer(1, this);
}
},
refresh : function(callback){
if(this.defaultUrl == null){
return;
}
this.update(this.defaultUrl, null, callback, true);
},
startAutoRefresh : function(interval, url, params, callback, refreshNow){
if(refreshNow){
this.update(url || this.defaultUrl, params, callback, true);
}
if(this.autoRefreshProcId){
clearInterval(this.autoRefreshProcId);
}
this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);
},
stopAutoRefresh : function(){
if(this.autoRefreshProcId){
clearInterval(this.autoRefreshProcId);
delete this.autoRefreshProcId;
}
},
isAutoRefreshing : function(){
return this.autoRefreshProcId ? true : false;
},
showLoading : function(){
if(this.showLoadIndicator){
this.el.update(this.indicatorText);
}
},
prepareUrl : function(url){
if(this.disableCaching){
var append = "_dc=" + (new Date().getTime());
if(url.indexOf("?") !== -1){
url += "&" + append;
}else{
url += "?" + append;
}
}
return url;
},
processSuccess : function(response){
this.transaction = null;
if(response.argument.form && response.argument.reset){
try{
response.argument.form.reset();
}catch(e){}
}
if(this.loadScripts){
this.renderer.render(this.el, response, this,
this.updateComplete.createDelegate(this, [response]));
}else{
this.renderer.render(this.el, response, this);
this.updateComplete(response);
}
},
updateComplete : function(response){
this.fireEvent("update", this.el, response);
if(typeof response.argument.callback == "function"){
response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options);
}
},
processFailure : function(response){
this.transaction = null;
this.fireEvent("failure", this.el, response);
if(typeof response.argument.callback == "function"){
response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options);
}
},
setRenderer : function(renderer){
this.renderer = renderer;
},
getRenderer : function(){
return this.renderer;
},
setDefaultUrl : function(defaultUrl){
this.defaultUrl = defaultUrl;
},
abort : function(){
if(this.transaction){
Ext.Ajax.abort(this.transaction);
}
},
isUpdating : function(){
if(this.transaction){
return Ext.Ajax.isLoading(this.transaction);
}
return false;
}
});
Ext.Updater.defaults = {
timeout : 30,
loadScripts : false,
sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),
disableCaching : false,
showLoadIndicator : true,
indicatorText : '<div class="loading-indicator">Loading...</div>'
};
Ext.Updater.updateElement = function(el, url, params, options){
var um = Ext.get(el).getUpdater();
Ext.apply(um, options);
um.update(url, params, options ? options.callback : null);
};
Ext.Updater.update = Ext.Updater.updateElement;
Ext.Updater.BasicRenderer = function(){};
Ext.Updater.BasicRenderer.prototype = {
render : function(el, response, updateManager, callback){
el.update(response.responseText, updateManager.loadScripts, callback);
}
};
Ext.UpdateManager = Ext.Updater;
Ext.util.DelayedTask = function(fn, scope, args){
var id = null, d, t;
var call = function(){
var now = new Date().getTime();
if(now - t >= d){
clearInterval(id);
id = null;
fn.apply(scope, args || []);
}
};
this.delay = function(delay, newFn, newScope, newArgs){
if(id && delay != d){
this.cancel();
}
d = delay;
t = new Date().getTime();
fn = newFn || fn;
scope = newScope || scope;
args = newArgs || args;
if(!id){
id = setInterval(call, d);
}
};
this.cancel = function(){
if(id){
clearInterval(id);
id = null;
}
};
};
| JavaScript |
/**
* SyntaxHighlighterx
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var funcs = 'abs avg case cast coalesce convert count current_timestamp ' +
'current_user day isnull left lower month nullif replace right ' +
'session_user space substring sum system_user upper user year';
var keywords = 'absolute action add after alter as asc at authorization begin bigint ' +
'binary bit by cascade char character check checkpoint close collate ' +
'column commit committed connect connection constraint contains continue ' +
'create cube current current_date current_time cursor database date ' +
'deallocate dec decimal declare default delete desc distinct double drop ' +
'dynamic else end end-exec escape except exec execute false fetch first ' +
'float for force foreign forward free from full function global goto grant ' +
'group grouping having hour ignore index inner insensitive insert instead ' +
'int integer intersect into is isolation key last level load local max min ' +
'minute modify move name national nchar next no numeric of off on only ' +
'open option order out output partial password precision prepare primary ' +
'prior privileges procedure public read real references relative repeatable ' +
'restrict return returns revoke rollback rollup rows rule schema scroll ' +
'second section select sequence serializable set size smallint static ' +
'statistics table temp temporary then time timestamp to top transaction ' +
'translation trigger true truncate uncommitted union unique update values ' +
'varchar varying view when where with work';
var operators = 'all and any between cross in join like not null or outer some';
this.regexList = [
{ regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments
{ regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
{ regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions
{ regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
];
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['sql'];
SyntaxHighlighter.brushes.Sql = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
| JavaScript |
/**
* SyntaxHighlighterx
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' +
'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' +
'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' +
'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' +
'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' +
'Function Get GetType GoSub GoTo Handles If Implements Imports In ' +
'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' +
'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' +
'NotInheritable NotOverridable Object On Option Optional Or OrElse ' +
'Overloads Overridable Overrides ParamArray Preserve Private Property ' +
'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' +
'Return Select Set Shadows Shared Short Single Static Step Stop String ' +
'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' +
'Variant When While With WithEvents WriteOnly Xor';
this.regexList = [
{ regex: /'.*$/gm, css: 'comments' }, // one line comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
{ regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword
];
this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['vb', 'vbnet'];
SyntaxHighlighter.brushes.Vb = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
| JavaScript |
/**
* SyntaxHighlighterx
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var funcs = 'abs acos acosh addcslashes addslashes ' +
'array_change_key_case array_chunk array_combine array_count_values array_diff '+
'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
'array_push array_rand array_reduce array_reverse array_search array_shift '+
'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+
'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
'strtoupper strtr strval substr substr_compare';
var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' +
'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' +
'function include include_once global goto if implements interface instanceof namespace new ' +
'old_function or private protected public return require require_once static switch ' +
'throw try use var while xor ';
var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
{ regex: /\$\w+/g, css: 'variable' }, // variables
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions
{ regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword
];
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['php'];
SyntaxHighlighter.brushes.Php = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
| JavaScript |
/**
* SyntaxHighlighterx
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne ge le';
var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' +
'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' +
'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' +
'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' +
'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' +
'import install join kill less let ln local locate logname logout look lpc lpr lprint ' +
'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' +
'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' +
'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' +
'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' +
'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' +
'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' +
'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' +
'vi watch wc whereis which who whoami Wget xargs yes'
;
this.regexList = [
{ regex: /^#!.*$/gm, css: 'preprocessor bold' },
{ regex: /\/[\w-\/]+/gm, css: 'plain' },
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
{ regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands
];
}
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['bash', 'shell'];
SyntaxHighlighter.brushes.Bash = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
| JavaScript |
/**
* SyntaxHighlighterx
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
function process(match, regexInfo)
{
var constructor = SyntaxHighlighter.Match,
code = match[0],
tag = new XRegExp('(<|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code),
result = []
;
if (match.attributes != null)
{
var attributes,
regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' +
'\\s*=\\s*' +
'(?<value> ".*?"|\'.*?\'|\\w+)',
'xg');
while ((attributes = regex.exec(code)) != null)
{
result.push(new constructor(attributes.name, match.index + attributes.index, 'color1'));
result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string'));
}
}
if (tag != null)
result.push(
new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword')
);
return result;
}
this.regexList = [
{ regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]>
{ regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // <!-- ... -->
{ regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process }
];
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['xml', 'xhtml', 'xslt', 'html'];
SyntaxHighlighter.brushes.Xml = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
| JavaScript |
/**
* SyntaxHighlighterx
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var keywords = 'abstract assert boolean break byte case catch char class const ' +
'continue default do double else enum extends ' +
'false final finally float for goto if implements import ' +
'instanceof int interface long native new null ' +
'package private protected public return ' +
'short static strictfp super switch synchronized this throw throws true ' +
'transient try void volatile while';
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
{ regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments
{ regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
{ regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno
{ regex: /\@interface\b/g, css: 'color2' }, // @interface keyword
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword
];
this.forHtmlScript({
left : /(<|<)%[@!=]?/g,
right : /%(>|>)/g
});
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['java'];
SyntaxHighlighter.brushes.Java = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
| JavaScript |
/**
* SyntaxHighlighterx
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
// Contributed by David Simmons-Duffin and Marty Kube
var funcs =
'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' +
'chroot close closedir connect cos crypt defined delete each endgrent ' +
'endhostent endnetent endprotoent endpwent endservent eof exec exists ' +
'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' +
'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' +
'getnetbyname getnetent getpeername getpgrp getppid getpriority ' +
'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' +
'getservbyname getservbyport getservent getsockname getsockopt glob ' +
'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' +
'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' +
'oct open opendir ord pack pipe pop pos print printf prototype push ' +
'quotemeta rand read readdir readline readlink readpipe recv rename ' +
'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' +
'semget semop send setgrent sethostent setnetent setpgrp setpriority ' +
'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' +
'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' +
'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' +
'system syswrite tell telldir time times tr truncate uc ucfirst umask ' +
'undef unlink unpack unshift utime values vec wait waitpid warn write';
var keywords =
'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' +
'for foreach goto if import last local my next no our package redo ref ' +
'require return sub tie tied unless untie until use wantarray while';
this.regexList = [
{ regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' },
{ regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
{ regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' },
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
];
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
}
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['perl', 'Perl', 'pl'];
SyntaxHighlighter.brushes.Perl = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
| JavaScript |
var $ = jQuery.noConflict();
$(document).ready(function($) {
/* ---------------------------------------------------------------------- */
/* Sliders - [Flexslider]
/* ---------------------------------------------------------------------- */
try {
$('.version1 .flexslider').flexslider({
animation: "fade",
pausePlay: false,
start: function(slider){
$('#slider.version1 .flex-pause-play').on("click", function() {
if($(this).hasClass('pause')){
$(this).removeClass('pause');
slider.resume();
} else {
$(this).addClass('pause');
slider.pause();
}
});
}
});
$('.version3 .flexslider').flexslider({
animation: "fade",
controlNav: "thumbnails",
directionNav: true
});
} catch(err) {
}
/*-------------------------------------------------*/
/* = Dropdown Menu - Superfish
/*-------------------------------------------------*/
$('ul.sf-menu').superfish({
delay: 400,
autoArrows: false,
speed: 'fast',
animation: {opacity:'show', height:'show'}
});
/*-------------------------------------------------*/
/* = Mobile Menu
/*-------------------------------------------------*/
// Create the dropdown base
$("<select />").appendTo(".navigation");
// Create default option "Go to..."
$("<option />", {
"selected": "selected",
"value" : "",
"text" : "Go to..."
}).appendTo(".navigation select");
// Populate dropdown with menu items
$(".sf-menu a").each(function() {
var el = $(this);
if(el.next().is('ul.sub-menu')){
$("<optgroup />", {
"label" : el.text()
}).appendTo(".navigation select");
} else {
$("<option />", {
"value" : el.attr("href"),
"text" : el.text()
}).appendTo(".navigation select");
}
});
// Change style
$('.navigation select').selectbox({
effect: "slide"
});
// To make dropdown actually work
// To make more unobtrusive: http://css-tricks.com/4064-unobtrusive-page-changer/
$(".navigation select").change(function() {
window.location = $(this).find("option:selected").val();
});
/*-------------------------------------------------*/
/* = Gallery in Singlepost
/*-------------------------------------------------*/
try {
$('.page-container .gallery').flexslider({
directionNav: false
});
} catch(err) {
}
/*-------------------------------------------------*/
/* = jCarousel - Gallery and Posts
/*-------------------------------------------------*/
try {
$('.carousel ul.slides').jcarousel({
scroll: 1
});
} catch(err) {
}
/*-------------------------------------------------*/
/* = Fancybox Images
/*-------------------------------------------------*/
try {
$(".carousel.gallery ul.slides a, .page-container .gallery .slides a, .post-image a").fancybox({
nextEffect : 'fade',
prevEffect : 'fade',
openEffect : 'fade',
closeEffect : 'fade',
helpers: {
title : {
type : 'float'
}
}
});
} catch(err) {
}
/*-------------------------------------------------*/
/* = Fancybox Videos
/*-------------------------------------------------*/
try {
$('.video-container li > a').fancybox({
maxWidth : 800,
maxHeight : 600,
fitToView : false,
width : '75%',
height : '75%',
type : 'iframe',
autoSize : false,
closeClick : false,
openEffect : 'fade',
closeEffect : 'fade'
});
} catch(err) {
}
/*-------------------------------------------------*/
/* = Scroll to TOP
/*-------------------------------------------------*/
$('a[href="#top"]').click(function(){
$('html, body').animate({scrollTop: 0}, 'slow');
return false;
});
/*-------------------------------------------------*/
/* = Categories - Toggle
/*-------------------------------------------------*/
/*$('.widget_categories li:has(ul.children)').on('click', function(){
$(this).find('> ul.children').slideToggle();
return false;
});*/
/*-------------------------------------------------*/
/* = Tabs Widget - { Popular, Recent and Comments }
/*-------------------------------------------------*/
$('.tab-links li a').live('click', function(e){
e.preventDefault();
if (!$(this).parent('li').hasClass('active')){
var link = $(this).attr('href');
$(this).parents('ul').children('li').removeClass('active');
$(this).parent().addClass('active');
$('.tabs-widget > div').hide();
$(link).fadeIn();
}
});
/* ---------------------------------------------------------------------- */
/* Comment Tree
/* ---------------------------------------------------------------------- */
try {
$('#content ul.children > li, ol#comments > li').each(function(){
if($(this).find(' > ul.children').length == 0){
$(this).addClass('last-child');
}
});
$("#content ul.children").each(function() {
if($(this).find(' > li').length > 1) {
$(this).addClass('border');
}
});
$('ul.children.border').each(function(){
$(this).append('<span class="border-left"></span>');
var _height = 0;
for(var i = 0; i < $(this).find(' > li').length - 1; i++){
_height = _height + parseInt($(this).find(' > li').eq(i).height()) + parseInt($(this).find(' > li').eq(i).css('margin-bottom'));
}
_height = _height + 29;
$(this).find('span.border-left').css({'height': _height + 'px'});
});
} catch(err) {
}
$(window).bind('resize', function(){
try {
$('ul.children.border').each(function(){
var _height = 0;
for(var i = 0; i < $(this).find(' > li').length - 1; i++){
_height = _height + parseInt($(this).find(' > li').eq(i).height()) + parseInt($(this).find(' > li').eq(i).css('margin-bottom'));
}
_height = _height + 29;
$(this).find('span.border-left').css({'height': _height + 'px'});
});
} catch(err) {
}
});
/*-------------------------------------------------*/
/* = Toggle Shortcodes
/*-------------------------------------------------*/
$('.toggle-style-1 > ul > li > h6, .toggle-style-2 > ul > li > h6').live('click', function(){
if (!$(this).hasClass('expand')){
$(this).parents('ul').find('h6.expand').removeClass('expand');
$(this).addClass('expand');
$(this).parents('ul').find('div.inner').removeClass('active').stop(true,true).slideUp(200);
$(this).parent('li').children('div.inner').addClass('active').stop(true,true).slideDown(200);
} else {
$(this).parents('ul').find('h6.expand').removeClass('expand');
$(this).parents('ul').find('div.inner').removeClass('active').stop(true,true).slideUp(200);
}
});
/*-------------------------------------------------*/
/* = Tabs Shortcodes
/*-------------------------------------------------*/
$('.tabs > ul > li > a').live('click', function(e){
e.preventDefault();
if (!$(this).parent('li').hasClass('active')){
var link = $(this).attr('href');
$(this).parents('ul').children('li').removeClass('active');
$(this).parent().addClass('active');
$('.tabs > div').removeClass('active').hide();
$(link).addClass('active').fadeIn();
}
});
/* ---------------------------------------------------------------------- */
/* Contact Map
/* ---------------------------------------------------------------------- */
var contact = {"lat":"42.672421", "lon":"21.16453899999999"}; //Change a map coordinate here!
try {
$('#map').gmap3({
action: 'addMarker',
latLng: [contact.lat, contact.lon],
map:{
center: [contact.lat, contact.lon],
zoom: 14
},
},
{action: 'setOptions', args:[{scrollwheel:true}]}
);
} catch(err) {
}
$(window).bind('resize', function(){
//Carousel Fix
try {
$('.jcarousel-list-horizontal').css({'left': '0px'});
$('.jcarousel-list-horizontal').each(function(){
var _width = 0;
$(this).children('li.jcarousel-item').each(function(){
_width = _width + parseInt($(this).width()) + parseInt($(this).css('margin-left')) + parseInt($(this).css('margin-right'));
});
$(this).width(_width);
});
} catch(err) {
}
});
});
/*-------------------------------------------------*/
/* = Masonry Effect
/*-------------------------------------------------*/
$(window).load(function(){
$('#sidebar').masonry({
singleMode: true,
itemSelector: '.widget',
columnWidth: 300,
gutterWidth: 20
});
}); | JavaScript |
/*
* jQuery FlexSlider v2.1
* http://www.woothemes.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (@mbmufffin)
*/
;(function ($) {
//FlexSlider: Object Instance
$.flexslider = function(el, options) {
var slider = $(el),
vars = $.extend({}, $.flexslider.defaults, options),
namespace = vars.namespace,
touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch,
eventType = (touch) ? "touchend" : "click",
vertical = vars.direction === "vertical",
reverse = vars.reverse,
carousel = (vars.itemWidth > 0),
fade = vars.animation === "fade",
asNav = vars.asNavFor !== "",
methods = {};
// Store a reference to the slider object
$.data(el, "flexslider", slider);
// Privat slider methods
methods = {
init: function() {
slider.animating = false;
slider.currentSlide = vars.startAt;
slider.animatingTo = slider.currentSlide;
slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
slider.containerSelector = vars.selector.substr(0,vars.selector.search(' '));
slider.slides = $(vars.selector, slider);
slider.container = $(slider.containerSelector, slider);
slider.count = slider.slides.length;
// SYNC:
slider.syncExists = $(vars.sync).length > 0;
// SLIDE:
if (vars.animation === "slide") vars.animation = "swing";
slider.prop = (vertical) ? "top" : "marginLeft";
slider.args = {};
// SLIDESHOW:
slider.manualPause = false;
// TOUCH/USECSS:
slider.transitions = !vars.video && !fade && vars.useCSS && (function() {
var obj = document.createElement('div'),
props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
for (var i in props) {
if ( obj.style[ props[i] ] !== undefined ) {
slider.pfx = props[i].replace('Perspective','').toLowerCase();
slider.prop = "-" + slider.pfx + "-transform";
return true;
}
}
return false;
}());
// CONTROLSCONTAINER:
if (vars.controlsContainer !== "") slider.controlsContainer = $(vars.controlsContainer).length > 0 && $(vars.controlsContainer);
// MANUAL:
if (vars.manualControls !== "") slider.manualControls = $(vars.manualControls).length > 0 && $(vars.manualControls);
// RANDOMIZE:
if (vars.randomize) {
slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
slider.container.empty().append(slider.slides);
}
slider.doMath();
// ASNAV:
if (asNav) methods.asNav.setup();
// INIT
slider.setup("init");
// DIRECTIONNAV:
if (vars.directionNav) methods.directionNav.setup();
// CONTROLNAV:
if (vars.controlNav) methods.controlNav.setup();
// KEYBOARD:
if (vars.keyboard && ($(slider.containerSelector).length === 1 || vars.multipleKeyboard)) {
$(document).bind('keyup', function(event) {
var keycode = event.keyCode;
if (!slider.animating && (keycode === 39 || keycode === 37)) {
var target = (keycode === 39) ? slider.getTarget('next') :
(keycode === 37) ? slider.getTarget('prev') : false;
slider.flexAnimate(target, vars.pauseOnAction);
}
});
}
// MOUSEWHEEL:
if (vars.mousewheel) {
slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
event.preventDefault();
var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
slider.flexAnimate(target, vars.pauseOnAction);
});
}
// PAUSEPLAY
if (vars.pausePlay) methods.pausePlay.setup();
// SLIDSESHOW
if (vars.slideshow) {
if (vars.pauseOnHover) {
slider.hover(function() {
if (!slider.manualPlay && !slider.manualPause) slider.pause();
}, function() {
if (!slider.manualPause && !slider.manualPlay) slider.play();
});
}
// initialize animation
(vars.initDelay > 0) ? setTimeout(slider.play, vars.initDelay) : slider.play();
}
// TOUCH
if (touch && vars.touch) methods.touch();
// FADE&&SMOOTHHEIGHT || SLIDE:
if (!fade || (fade && vars.smoothHeight)) $(window).bind("resize focus", methods.resize);
// API: start() Callback
setTimeout(function(){
vars.start(slider);
}, 200);
},
asNav: {
setup: function() {
slider.asNav = true;
slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
slider.currentItem = slider.currentSlide;
slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
slider.slides.click(function(e){
e.preventDefault();
var $slide = $(this),
target = $slide.index();
if (!$(vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
slider.direction = (slider.currentItem < target) ? "next" : "prev";
slider.flexAnimate(target, vars.pauseOnAction, false, true, true);
}
});
}
},
controlNav: {
setup: function() {
if (!slider.manualControls) {
methods.controlNav.setupPaging();
} else { // MANUALCONTROLS:
methods.controlNav.setupManual();
}
},
setupPaging: function() {
var type = (vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
j = 1,
item;
slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
if (slider.pagingCount > 1) {
for (var i = 0; i < slider.pagingCount; i++) {
item = (vars.controlNav === "thumbnails") ? '<img src="' + slider.slides.eq(i).attr("data-thumb") + '"/>' : '<a>' + j + '</a>';
slider.controlNavScaffold.append('<li>' + item + '</li>');
j++;
}
}
// CONTROLSCONTAINER:
(slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
methods.controlNav.set();
methods.controlNav.active();
slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
event.preventDefault();
var $this = $(this),
target = slider.controlNav.index($this);
if (!$this.hasClass(namespace + 'active')) {
slider.direction = (target > slider.currentSlide) ? "next" : "prev";
slider.flexAnimate(target, vars.pauseOnAction);
}
});
// Prevent iOS click event bug
if (touch) {
slider.controlNavScaffold.delegate('a', "click touchstart", function(event) {
event.preventDefault();
});
}
},
setupManual: function() {
slider.controlNav = slider.manualControls;
methods.controlNav.active();
slider.controlNav.live(eventType, function(event) {
event.preventDefault();
var $this = $(this),
target = slider.controlNav.index($this);
if (!$this.hasClass(namespace + 'active')) {
(target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
slider.flexAnimate(target, vars.pauseOnAction);
}
});
// Prevent iOS click event bug
if (touch) {
slider.controlNav.live("click touchstart", function(event) {
event.preventDefault();
});
}
},
set: function() {
var selector = (vars.controlNav === "thumbnails") ? 'img' : 'a';
slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
},
active: function() {
slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
},
update: function(action, pos) {
if (slider.pagingCount > 1 && action === "add") {
slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
} else if (slider.pagingCount === 1) {
slider.controlNavScaffold.find('li').remove();
} else {
slider.controlNav.eq(pos).closest('li').remove();
}
methods.controlNav.set();
(slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
}
},
directionNav: {
setup: function() {
var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + vars.nextText + '</a></li></ul>');
// CONTROLSCONTAINER:
if (slider.controlsContainer) {
$(slider.controlsContainer).append(directionNavScaffold);
slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
} else {
slider.append(directionNavScaffold);
slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
}
methods.directionNav.update();
slider.directionNav.bind(eventType, function(event) {
event.preventDefault();
var target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
slider.flexAnimate(target, vars.pauseOnAction);
});
// Prevent iOS click event bug
if (touch) {
slider.directionNav.bind("click touchstart", function(event) {
event.preventDefault();
});
}
},
update: function() {
var disabledClass = namespace + 'disabled';
if (slider.pagingCount === 1) {
slider.directionNav.addClass(disabledClass);
} else if (!vars.animationLoop) {
if (slider.animatingTo === 0) {
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass);
} else if (slider.animatingTo === slider.last) {
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass);
} else {
slider.directionNav.removeClass(disabledClass);
}
} else {
slider.directionNav.removeClass(disabledClass);
}
}
},
pausePlay: {
setup: function() {
var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
// CONTROLSCONTAINER:
if (slider.controlsContainer) {
slider.controlsContainer.append(pausePlayScaffold);
slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
} else {
slider.append(pausePlayScaffold);
slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
}
methods.pausePlay.update((vars.slideshow) ? namespace + 'pause' : namespace + 'play');
slider.pausePlay.bind(eventType, function(event) {
event.preventDefault();
if ($(this).hasClass(namespace + 'pause')) {
slider.manualPause = true;
slider.manualPlay = false;
slider.pause();
} else {
slider.manualPause = false;
slider.manualPlay = true;
slider.play();
}
});
// Prevent iOS click event bug
if (touch) {
slider.pausePlay.bind("click touchstart", function(event) {
event.preventDefault();
});
}
},
update: function(state) {
(state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').text(vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').text(vars.pauseText);
}
},
touch: function() {
var startX,
startY,
offset,
cwidth,
dx,
startT,
scrolling = false;
el.addEventListener('touchstart', onTouchStart, false);
function onTouchStart(e) {
if (slider.animating) {
e.preventDefault();
} else if (e.touches.length === 1) {
slider.pause();
// CAROUSEL:
cwidth = (vertical) ? slider.h : slider. w;
startT = Number(new Date());
// CAROUSEL:
offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
(carousel && reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
(carousel && slider.currentSlide === slider.last) ? slider.limit :
(carousel) ? ((slider.itemW + vars.itemMargin) * slider.move) * slider.currentSlide :
(reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
startX = (vertical) ? e.touches[0].pageY : e.touches[0].pageX;
startY = (vertical) ? e.touches[0].pageX : e.touches[0].pageY;
el.addEventListener('touchmove', onTouchMove, false);
el.addEventListener('touchend', onTouchEnd, false);
}
}
function onTouchMove(e) {
dx = (vertical) ? startX - e.touches[0].pageY : startX - e.touches[0].pageX;
scrolling = (vertical) ? (Math.abs(dx) < Math.abs(e.touches[0].pageX - startY)) : (Math.abs(dx) < Math.abs(e.touches[0].pageY - startY));
if (!scrolling || Number(new Date()) - startT > 500) {
e.preventDefault();
if (!fade && slider.transitions) {
if (!vars.animationLoop) {
dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
}
slider.setProps(offset + dx, "setTouch");
}
}
}
function onTouchEnd(e) {
if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
var updateDx = (reverse) ? -dx : dx,
target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
slider.flexAnimate(target, vars.pauseOnAction);
} else {
slider.flexAnimate(slider.currentSlide, vars.pauseOnAction, true);
}
}
// finish the touch by undoing the touch session
el.removeEventListener('touchmove', onTouchMove, false);
el.removeEventListener('touchend', onTouchEnd, false);
startX = null;
startY = null;
dx = null;
offset = null;
}
},
resize: function() {
if (!slider.animating && slider.is(':visible')) {
if (!carousel) slider.doMath();
if (fade) {
// SMOOTH HEIGHT:
methods.smoothHeight();
} else if (carousel) { //CAROUSEL:
slider.slides.width(slider.computedW);
slider.update(slider.pagingCount);
slider.setProps();
}
else if (vertical) { //VERTICAL:
slider.viewport.height(slider.h);
slider.setProps(slider.h, "setTotal");
} else {
// SMOOTH HEIGHT:
if (vars.smoothHeight) methods.smoothHeight();
slider.newSlides.width(slider.computedW);
slider.setProps(slider.computedW, "setTotal");
}
}
},
smoothHeight: function(dur) {
if (!vertical || fade) {
var $obj = (fade) ? slider : slider.viewport;
(dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
}
},
sync: function(action) {
var $obj = $(vars.sync).data("flexslider"),
target = slider.animatingTo;
switch (action) {
case "animate": $obj.flexAnimate(target, vars.pauseOnAction, false, true); break;
case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
case "pause": $obj.pause(); break;
}
}
}
// public methods
slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
if (asNav && withSync) {
var master = $(vars.asNavFor).data('flexslider');
slider.atEnd = target === 0 || target === slider.count - 1;
master.flexAnimate(target, true, false, true, fromNav);
slider.direction = (slider.currentItem < target) ? "next" : "prev";
master.direction = slider.direction;
if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
slider.currentItem = target;
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
target = Math.floor(target/slider.visible);
} else {
slider.currentItem = target;
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
return false;
}
}
slider.animating = true;
slider.animatingTo = target;
// API: before() animation Callback
vars.before(slider);
// SLIDESHOW:
if (pause) slider.pause();
// SYNC:
if (slider.syncExists && !fromNav) methods.sync("animate");
// CONTROLNAV
if (vars.controlNav) methods.controlNav.active();
// !CAROUSEL:
// CANDIDATE: slide active class (for add/remove slide)
if (!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
// INFINITE LOOP:
// CANDIDATE: atEnd
slider.atEnd = target === 0 || target === slider.last;
// DIRECTIONNAV:
if (vars.directionNav) methods.directionNav.update();
if (target === slider.last) {
// API: end() of cycle Callback
vars.end(slider);
// SLIDESHOW && !INFINITE LOOP:
if (!vars.animationLoop) slider.pause();
}
// SLIDE:
if (!fade) {
var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
margin, slideString, calcNext;
// INFINITE LOOP / REVERSE:
if (carousel) {
margin = (vars.itemWidth > slider.w) ? vars.itemMargin * 2 : vars.itemMargin;
calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
} else if (slider.currentSlide === 0 && target === slider.count - 1 && vars.animationLoop && slider.direction !== "next") {
slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
} else if (slider.currentSlide === slider.last && target === 0 && vars.animationLoop && slider.direction !== "prev") {
slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
} else {
slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
}
slider.setProps(slideString, "", vars.animationSpeed);
if (slider.transitions) {
if (!vars.animationLoop || !slider.atEnd) {
slider.animating = false;
slider.currentSlide = slider.animatingTo;
}
slider.container.unbind("webkitTransitionEnd transitionend");
slider.container.bind("webkitTransitionEnd transitionend", function() {
slider.wrapup(dimension);
});
} else {
slider.container.animate(slider.args, vars.animationSpeed, vars.easing, function(){
slider.wrapup(dimension);
});
}
} else { // FADE:
slider.slides.eq(slider.currentSlide).fadeOut(vars.animationSpeed, vars.easing);
slider.slides.eq(target).fadeIn(vars.animationSpeed, vars.easing, slider.wrapup);
}
// SMOOTH HEIGHT:
if (vars.smoothHeight) methods.smoothHeight(vars.animationSpeed);
}
}
slider.wrapup = function(dimension) {
// SLIDE:
if (!fade && !carousel) {
if (slider.currentSlide === 0 && slider.animatingTo === slider.last && vars.animationLoop) {
slider.setProps(dimension, "jumpEnd");
} else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && vars.animationLoop) {
slider.setProps(dimension, "jumpStart");
}
}
slider.animating = false;
slider.currentSlide = slider.animatingTo;
// API: after() animation Callback
vars.after(slider);
}
// SLIDESHOW:
slider.animateSlides = function() {
if (!slider.animating) slider.flexAnimate(slider.getTarget("next"));
}
// SLIDESHOW:
slider.pause = function() {
clearInterval(slider.animatedSlides);
slider.playing = false;
// PAUSEPLAY:
if (vars.pausePlay) methods.pausePlay.update("play");
// SYNC:
if (slider.syncExists) methods.sync("pause");
}
// SLIDESHOW:
slider.play = function() {
slider.animatedSlides = setInterval(slider.animateSlides, vars.slideshowSpeed);
slider.playing = true;
// PAUSEPLAY:
if (vars.pausePlay) methods.pausePlay.update("pause");
// SYNC:
if (slider.syncExists) methods.sync("play");
}
slider.canAdvance = function(target, fromNav) {
// ASNAV:
var last = (asNav) ? slider.pagingCount - 1 : slider.last;
return (fromNav) ? true :
(asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
(asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
(target === slider.currentSlide && !asNav) ? false :
(vars.animationLoop) ? true :
(slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
(slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
true;
}
slider.getTarget = function(dir) {
slider.direction = dir;
if (dir === "next") {
return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
} else {
return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
}
}
// SLIDE:
slider.setProps = function(pos, special, dur) {
var target = (function() {
var posCheck = (pos) ? pos : ((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo,
posCalc = (function() {
if (carousel) {
return (special === "setTouch") ? pos :
(reverse && slider.animatingTo === slider.last) ? 0 :
(reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
(slider.animatingTo === slider.last) ? slider.limit : posCheck;
} else {
switch (special) {
case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
case "setTouch": return (reverse) ? pos : pos;
case "jumpEnd": return (reverse) ? pos : slider.count * pos;
case "jumpStart": return (reverse) ? slider.count * pos : pos;
default: return pos;
}
}
}());
return (posCalc * -1) + "px";
}());
if (slider.transitions) {
target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
slider.container.css("-" + slider.pfx + "-transition-duration", dur);
}
slider.args[slider.prop] = target;
if (slider.transitions || dur === undefined) slider.container.css(slider.args);
}
slider.setup = function(type) {
// SLIDE:
if (!fade) {
var sliderOffset, arr;
if (type === "init") {
slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
// INFINITE LOOP:
slider.cloneCount = 0;
slider.cloneOffset = 0;
// REVERSE:
if (reverse) {
arr = $.makeArray(slider.slides).reverse();
slider.slides = $(arr);
slider.container.empty().append(slider.slides);
}
}
// INFINITE LOOP && !CAROUSEL:
if (vars.animationLoop && !carousel) {
slider.cloneCount = 2;
slider.cloneOffset = 1;
// clear out old clones
if (type !== "init") slider.container.find('.clone').remove();
slider.container.append(slider.slides.first().clone().addClass('clone')).prepend(slider.slides.last().clone().addClass('clone'));
}
slider.newSlides = $(vars.selector, slider);
sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
// VERTICAL:
if (vertical && !carousel) {
slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
setTimeout(function(){
slider.newSlides.css({"display": "block"});
slider.doMath();
slider.viewport.height(slider.h);
slider.setProps(sliderOffset * slider.h, "init");
}, (type === "init") ? 100 : 0);
} else {
slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
slider.setProps(sliderOffset * slider.computedW, "init");
setTimeout(function(){
slider.doMath();
slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
// SMOOTH HEIGHT:
if (vars.smoothHeight) methods.smoothHeight();
}, (type === "init") ? 100 : 0);
}
} else { // FADE:
slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
if (type === "init") slider.slides.eq(slider.currentSlide).fadeIn(vars.animationSpeed, vars.easing);
// SMOOTH HEIGHT:
if (vars.smoothHeight) methods.smoothHeight();
}
// !CAROUSEL:
// CANDIDATE: active slide
if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
}
slider.doMath = function() {
var slide = slider.slides.first(),
slideMargin = vars.itemMargin,
minItems = vars.minItems,
maxItems = vars.maxItems;
slider.w = slider.width();
slider.h = slide.height();
slider.boxPadding = slide.outerWidth() - slide.width();
// CAROUSEL:
if (carousel) {
slider.itemT = vars.itemWidth + slideMargin;
slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
slider.maxW = (maxItems) ? maxItems * slider.itemT : slider.w;
slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * minItems))/minItems :
(slider.maxW < slider.w) ? (slider.w - (slideMargin * maxItems))/maxItems :
(vars.itemWidth > slider.w) ? slider.w : vars.itemWidth;
slider.visible = Math.floor(slider.w/(slider.itemW + slideMargin));
slider.move = (vars.move > 0 && vars.move < slider.visible ) ? vars.move : slider.visible;
slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
slider.last = slider.pagingCount - 1;
slider.limit = (slider.pagingCount === 1) ? 0 :
(vars.itemWidth > slider.w) ? ((slider.itemW + (slideMargin * 2)) * slider.count) - slider.w - slideMargin : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
} else {
slider.itemW = slider.w;
slider.pagingCount = slider.count;
slider.last = slider.count - 1;
}
slider.computedW = slider.itemW - slider.boxPadding;
}
slider.update = function(pos, action) {
slider.doMath();
// update currentSlide and slider.animatingTo if necessary
if (!carousel) {
if (pos < slider.currentSlide) {
slider.currentSlide += 1;
} else if (pos <= slider.currentSlide && pos !== 0) {
slider.currentSlide -= 1;
}
slider.animatingTo = slider.currentSlide;
}
// update controlNav
if (vars.controlNav && !slider.manualControls) {
if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
methods.controlNav.update("add");
} else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
if (carousel && slider.currentSlide > slider.last) {
slider.currentSlide -= 1;
slider.animatingTo -= 1;
}
methods.controlNav.update("remove", slider.last);
}
}
// update directionNav
if (vars.directionNav) methods.directionNav.update();
}
slider.addSlide = function(obj, pos) {
var $obj = $(obj);
slider.count += 1;
slider.last = slider.count - 1;
// append new slide
if (vertical && reverse) {
(pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
} else {
(pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
}
// update currentSlide, animatingTo, controlNav, and directionNav
slider.update(pos, "add");
// update slider.slides
slider.slides = $(vars.selector + ':not(.clone)', slider);
// re-setup the slider to accomdate new slide
slider.setup();
//FlexSlider: added() Callback
vars.added(slider);
}
slider.removeSlide = function(obj) {
var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
// update count
slider.count -= 1;
slider.last = slider.count - 1;
// remove slide
if (isNaN(obj)) {
$(obj, slider.slides).remove();
} else {
(vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
}
// update currentSlide, animatingTo, controlNav, and directionNav
slider.doMath();
slider.update(pos, "remove");
// update slider.slides
slider.slides = $(vars.selector + ':not(.clone)', slider);
// re-setup the slider to accomdate new slide
slider.setup();
// FlexSlider: removed() Callback
vars.removed(slider);
}
//FlexSlider: Initialize
methods.init();
}
//FlexSlider: Default Settings
$.flexslider.defaults = {
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
animation: "fade", //String: Select your animation type, "fade" or "slide"
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
reverse: false, //{NEW} Boolean: Reverse the animation direction
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
slideshow: true, //Boolean: Animate slider automatically
slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
randomize: false, //Boolean: Randomize slide order
// Usability features
pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
// Primary Controls
controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
prevText: "Previous", //String: Set the text for the "previous" directionNav item
nextText: "Next", //String: Set the text for the "next" directionNav item
// Secondary Navigation
keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys
multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
pausePlay: false, //Boolean: Create pause/play dynamic element
pauseText: "Pause", //String: Set the text for the "pause" pausePlay item
playText: "Play", //String: Set the text for the "play" pausePlay item
// Special properties
controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
// Carousel Options
itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
itemMargin: 0, //{NEW} Integer: Margin between carousel items.
minItems: 0, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
// Callback API
start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
removed: function(){} //{NEW} Callback: function(slider) - Fires after a slide is removed
}
//FlexSlider: Plugin Function
$.fn.flexslider = function(options) {
if (options === undefined) options = {};
if (typeof options === "object") {
return this.each(function() {
var $this = $(this),
selector = (options.selector) ? options.selector : ".slides > li",
$slides = $this.find(selector);
if ($slides.length === 1) {
$slides.fadeIn(400);
if (options.start) options.start($this);
} else if ($this.data('flexslider') === undefined) {
new $.flexslider(this, options);
}
});
} else {
// Helper strings to quickly perform functions on the slider
var $slider = $(this).data('flexslider');
switch (options) {
case "play": $slider.play(); break;
case "pause": $slider.pause(); break;
case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
case "prev":
case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
default: if (typeof options === "number") $slider.flexAnimate(options, true);
}
}
}
})(jQuery); | JavaScript |
/*
* Superfish v1.4.8 - jQuery menu widget
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
*/
;(function($){
$.fn.superfish = function(op){
var sf = $.fn.superfish,
c = sf.c,
$arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')),
over = function(){
var $$ = $(this), menu = getMenu($$);
clearTimeout(menu.sfTimer);
$$.showSuperfishUl().siblings().hideSuperfishUl();
},
out = function(){
var $$ = $(this), menu = getMenu($$), o = sf.op;
clearTimeout(menu.sfTimer);
menu.sfTimer=setTimeout(function(){
o.retainPath=($.inArray($$[0],o.$path)>-1);
$$.hideSuperfishUl();
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
},o.delay);
},
getMenu = function($menu){
var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
sf.op = sf.o[menu.serial];
return menu;
},
addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
return this.each(function() {
var s = this.serial = sf.o.length;
var o = $.extend({},sf.defaults,op);
o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
$(this).addClass([o.hoverClass,c.bcClass].join(' '))
.filter('li:has(ul)').removeClass(o.pathClass);
});
sf.o[s] = sf.op = o;
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
if (o.autoArrows) addArrow( $('>a:first-child',this) );
})
.not('.'+c.bcClass)
.hideSuperfishUl();
var $a = $('a',this);
$a.each(function(i){
var $li = $a.eq(i).parents('li');
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
});
o.onInit.call(this);
}).each(function() {
var menuClasses = [c.menuClass];
if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
$(this).addClass(menuClasses.join(' '));
});
};
var sf = $.fn.superfish;
sf.o = [];
sf.op = {};
sf.IE7fix = function(){
var o = sf.op;
if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
this.toggleClass(sf.c.shadowClass+'-off');
};
sf.c = {
bcClass : 'sf-breadcrumb',
menuClass : 'sf-js-enabled',
anchorClass : 'sf-with-ul',
arrowClass : 'sf-sub-indicator',
shadowClass : 'sf-shadow'
};
sf.defaults = {
hoverClass : 'sfHover',
pathClass : 'overideThisToUse',
pathLevels : 1,
delay : 800,
animation : {opacity:'show'},
speed : 'normal',
autoArrows : true,
dropShadows : true,
disableHI : false, // true disables hoverIntent detection
onInit : function(){}, // callback functions
onBeforeShow: function(){},
onShow : function(){},
onHide : function(){}
};
$.fn.extend({
hideSuperfishUl : function(){
var o = sf.op,
not = (o.retainPath===true) ? o.$path : '';
o.retainPath = false;
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
.find('>ul').hide().css('visibility','hidden');
o.onHide.call($ul);
return this;
},
showSuperfishUl : function(){
var o = sf.op,
sh = sf.c.shadowClass+'-off',
$ul = this.addClass(o.hoverClass)
.find('>ul:hidden').css('visibility','visible');
sf.IE7fix.call($ul);
o.onBeforeShow.call($ul);
$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
return this;
}
});
})(jQuery); | JavaScript |
/* http://keith-wood.name/countdown.html
Countdown for jQuery v1.5.4.
Written by Keith Wood (kbwood{at}iinet.com.au) January 2008.
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
Please attribute the author if you use it. */
/* Display a countdown timer.
Attach it with options like:
$('div selector').countdown(
{until: new Date(2009, 1 - 1, 1, 0, 0, 0), onExpiry: happyNewYear}); */
(function($) { // Hide scope, no $ conflict
/* Countdown manager. */
function Countdown() {
this.regional = []; // Available regional settings, indexed by language code
this.regional[''] = { // Default regional settings
// The display texts for the counters
labels: ['Years', 'Months', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds'],
// The display texts for the counters if only one
labels1: ['Year', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second'],
compactLabels: ['y', 'm', 'w', 'd'], // The compact texts for the counters
timeSeparator: ':', // Separator for time periods
isRTL: false // True for right-to-left languages, false for left-to-right
};
this._defaults = {
until: null, // new Date(year, mth - 1, day, hr, min, sec) - date/time to count down to
// or numeric for seconds offset, or string for unit offset(s):
// 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds
since: null, // new Date(year, mth - 1, day, hr, min, sec) - date/time to count up from
// or numeric for seconds offset, or string for unit offset(s):
// 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds
timezone: null, // The timezone (hours or minutes from GMT) for the target times,
// or null for client local
serverSync: null, // A function to retrieve the current server time for synchronisation
format: 'dHMS', // Format for display - upper case for always, lower case only if non-zero,
// 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds
layout: '', // Build your own layout for the countdown
compact: false, // True to display in a compact format, false for an expanded one
description: '', // The description displayed for the countdown
expiryUrl: '', // A URL to load upon expiry, replacing the current page
expiryText: '', // Text to display upon expiry, replacing the countdown
alwaysExpire: false, // True to trigger onExpiry even if never counted down
onExpiry: null, // Callback when the countdown expires -
// receives no parameters and 'this' is the containing division
onTick: null // Callback when the countdown is updated -
// receives int[7] being the breakdown by period (based on format)
// and 'this' is the containing division
};
$.extend(this._defaults, this.regional['']);
}
var PROP_NAME = 'countdown';
var Y = 0; // Years
var O = 1; // Months
var W = 2; // Weeks
var D = 3; // Days
var H = 4; // Hours
var M = 5; // Minutes
var S = 6; // Seconds
$.extend(Countdown.prototype, {
/* Class name added to elements to indicate already configured with countdown. */
markerClassName: 'hasCountdown',
/* Shared timer for all countdowns. */
_timer: setInterval(function() { $.countdown._updateTargets(); }, 980),
/* List of currently active countdown targets. */
_timerTargets: [],
/* Override the default settings for all instances of the countdown widget.
@param options (object) the new settings to use as defaults */
setDefaults: function(options) {
this._resetExtraLabels(this._defaults, options);
extendRemove(this._defaults, options || {});
},
/* Convert a date/time to UTC.
@param tz (number) the hour or minute offset from GMT, e.g. +9, -360
@param year (Date) the date/time in that timezone or
(number) the year in that timezone
@param month (number, optional) the month (0 - 11) (omit if year is a Date)
@param day (number, optional) the day (omit if year is a Date)
@param hours (number, optional) the hour (omit if year is a Date)
@param mins (number, optional) the minute (omit if year is a Date)
@param secs (number, optional) the second (omit if year is a Date)
@param ms (number, optional) the millisecond (omit if year is a Date)
@return (Date) the equivalent UTC date/time */
UTCDate: function(tz, year, month, day, hours, mins, secs, ms) {
if (typeof year == 'object' && year.constructor == Date) {
ms = year.getMilliseconds();
secs = year.getSeconds();
mins = year.getMinutes();
hours = year.getHours();
day = year.getDate();
month = year.getMonth();
year = year.getFullYear();
}
var d = new Date();
d.setUTCFullYear(year);
d.setUTCDate(1);
d.setUTCMonth(month || 0);
d.setUTCDate(day || 1);
d.setUTCHours(hours || 0);
d.setUTCMinutes((mins || 0) - (Math.abs(tz) < 30 ? tz * 60 : tz));
d.setUTCSeconds(secs || 0);
d.setUTCMilliseconds(ms || 0);
return d;
},
/* Attach the countdown widget to a div.
@param target (element) the containing division
@param options (object) the initial settings for the countdown */
_attachCountdown: function(target, options) {
var $target = $(target);
if ($target.hasClass(this.markerClassName)) {
return;
}
$target.addClass(this.markerClassName);
var inst = {options: $.extend({}, options),
_periods: [0, 0, 0, 0, 0, 0, 0]};
$.data(target, PROP_NAME, inst);
this._changeCountdown(target);
},
/* Add a target to the list of active ones.
@param target (element) the countdown target */
_addTarget: function(target) {
if (!this._hasTarget(target)) {
this._timerTargets.push(target);
}
},
/* See if a target is in the list of active ones.
@param target (element) the countdown target
@return (boolean) true if present, false if not */
_hasTarget: function(target) {
return ($.inArray(target, this._timerTargets) > -1);
},
/* Remove a target from the list of active ones.
@param target (element) the countdown target */
_removeTarget: function(target) {
this._timerTargets = $.map(this._timerTargets,
function(value) { return (value == target ? null : value); }); // delete entry
},
/* Update each active timer target. */
_updateTargets: function() {
for (var i = 0; i < this._timerTargets.length; i++) {
this._updateCountdown(this._timerTargets[i]);
}
},
/* Redisplay the countdown with an updated display.
@param target (jQuery) the containing division
@param inst (object) the current settings for this instance */
_updateCountdown: function(target, inst) {
var $target = $(target);
inst = inst || $.data(target, PROP_NAME);
if (!inst) {
return;
}
$target.html(this._generateHTML(inst));
$target[(this._get(inst, 'isRTL') ? 'add' : 'remove') + 'Class']('countdown_rtl');
var onTick = this._get(inst, 'onTick');
if (onTick) {
onTick.apply(target, [inst._hold != 'lap' ? inst._periods :
this._calculatePeriods(inst, inst._show, new Date())]);
}
var expired = inst._hold != 'pause' &&
(inst._since ? inst._now.getTime() <= inst._since.getTime() :
inst._now.getTime() >= inst._until.getTime());
if (expired && !inst._expiring) {
inst._expiring = true;
if (this._hasTarget(target) || this._get(inst, 'alwaysExpire')) {
this._removeTarget(target);
var onExpiry = this._get(inst, 'onExpiry');
if (onExpiry) {
onExpiry.apply(target, []);
}
var expiryText = this._get(inst, 'expiryText');
if (expiryText) {
var layout = this._get(inst, 'layout');
inst.options.layout = expiryText;
this._updateCountdown(target, inst);
inst.options.layout = layout;
}
var expiryUrl = this._get(inst, 'expiryUrl');
if (expiryUrl) {
window.location = expiryUrl;
}
}
inst._expiring = false;
}
else if (inst._hold == 'pause') {
this._removeTarget(target);
}
$.data(target, PROP_NAME, inst);
},
/* Reconfigure the settings for a countdown div.
@param target (element) the containing division
@param options (object) the new settings for the countdown or
(string) an individual property name
@param value (any) the individual property value
(omit if options is an object) */
_changeCountdown: function(target, options, value) {
options = options || {};
if (typeof options == 'string') {
var name = options;
options = {};
options[name] = value;
}
var inst = $.data(target, PROP_NAME);
if (inst) {
this._resetExtraLabels(inst.options, options);
extendRemove(inst.options, options);
this._adjustSettings(target, inst);
$.data(target, PROP_NAME, inst);
var now = new Date();
if ((inst._since && inst._since < now) ||
(inst._until && inst._until > now)) {
this._addTarget(target);
}
this._updateCountdown(target, inst);
}
},
/* Reset any extra labelsn and compactLabelsn entries if changing labels.
@param base (object) the options to be updated
@param options (object) the new option values */
_resetExtraLabels: function(base, options) {
var changingLabels = false;
for (var n in options) {
if (n.match(/[Ll]abels/)) {
changingLabels = true;
break;
}
}
if (changingLabels) {
for (var n in base) { // Remove custom numbered labels
if (n.match(/[Ll]abels[0-9]/)) {
base[n] = null;
}
}
}
},
/* Calculate interal settings for an instance.
@param target (element) the containing division
@param inst (object) the current settings for this instance */
_adjustSettings: function(target, inst) {
var serverSync = this._get(inst, 'serverSync');
serverSync = (serverSync ? serverSync.apply(target, []) : null);
var now = new Date();
var timezone = this._get(inst, 'timezone');
timezone = (timezone == null ? -now.getTimezoneOffset() : timezone);
inst._since = this._get(inst, 'since');
if (inst._since) {
inst._since = this.UTCDate(timezone, this._determineTime(inst._since, null));
if (inst._since && serverSync) {
inst._since.setMilliseconds(inst._since.getMilliseconds() +
now.getTime() - serverSync.getTime());
}
}
inst._until = this.UTCDate(timezone, this._determineTime(this._get(inst, 'until'), now));
if (serverSync) {
inst._until.setMilliseconds(inst._until.getMilliseconds() +
now.getTime() - serverSync.getTime());
}
inst._show = this._determineShow(inst);
},
/* Remove the countdown widget from a div.
@param target (element) the containing division */
_destroyCountdown: function(target) {
var $target = $(target);
if (!$target.hasClass(this.markerClassName)) {
return;
}
this._removeTarget(target);
$target.removeClass(this.markerClassName).empty();
$.removeData(target, PROP_NAME);
},
/* Pause a countdown widget at the current time.
Stop it running but remember and display the current time.
@param target (element) the containing division */
_pauseCountdown: function(target) {
this._hold(target, 'pause');
},
/* Pause a countdown widget at the current time.
Stop the display but keep the countdown running.
@param target (element) the containing division */
_lapCountdown: function(target) {
this._hold(target, 'lap');
},
/* Resume a paused countdown widget.
@param target (element) the containing division */
_resumeCountdown: function(target) {
this._hold(target, null);
},
/* Pause or resume a countdown widget.
@param target (element) the containing division
@param hold (string) the new hold setting */
_hold: function(target, hold) {
var inst = $.data(target, PROP_NAME);
if (inst) {
if (inst._hold == 'pause' && !hold) {
inst._periods = inst._savePeriods;
var sign = (inst._since ? '-' : '+');
inst[inst._since ? '_since' : '_until'] =
this._determineTime(sign + inst._periods[0] + 'y' +
sign + inst._periods[1] + 'o' + sign + inst._periods[2] + 'w' +
sign + inst._periods[3] + 'd' + sign + inst._periods[4] + 'h' +
sign + inst._periods[5] + 'm' + sign + inst._periods[6] + 's');
this._addTarget(target);
}
inst._hold = hold;
inst._savePeriods = (hold == 'pause' ? inst._periods : null);
$.data(target, PROP_NAME, inst);
this._updateCountdown(target, inst);
}
},
/* Return the current time periods.
@param target (element) the containing division
@return (number[7]) the current periods for the countdown */
_getTimesCountdown: function(target) {
var inst = $.data(target, PROP_NAME);
return (!inst ? null : (!inst._hold ? inst._periods :
this._calculatePeriods(inst, inst._show, new Date())));
},
/* Get a setting value, defaulting if necessary.
@param inst (object) the current settings for this instance
@param name (string) the name of the required setting
@return (any) the setting's value or a default if not overridden */
_get: function(inst, name) {
return (inst.options[name] != null ?
inst.options[name] : $.countdown._defaults[name]);
},
/* A time may be specified as an exact value or a relative one.
@param setting (string or number or Date) - the date/time value
as a relative or absolute value
@param defaultTime (Date) the date/time to use if no other is supplied
@return (Date) the corresponding date/time */
_determineTime: function(setting, defaultTime) {
var offsetNumeric = function(offset) { // e.g. +300, -2
var time = new Date();
time.setTime(time.getTime() + offset * 1000);
return time;
};
var offsetString = function(offset) { // e.g. '+2d', '-4w', '+3h +30m'
offset = offset.toLowerCase();
var time = new Date();
var year = time.getFullYear();
var month = time.getMonth();
var day = time.getDate();
var hour = time.getHours();
var minute = time.getMinutes();
var second = time.getSeconds();
var pattern = /([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g;
var matches = pattern.exec(offset);
while (matches) {
switch (matches[2] || 's') {
case 's': second += parseInt(matches[1], 10); break;
case 'm': minute += parseInt(matches[1], 10); break;
case 'h': hour += parseInt(matches[1], 10); break;
case 'd': day += parseInt(matches[1], 10); break;
case 'w': day += parseInt(matches[1], 10) * 7; break;
case 'o':
month += parseInt(matches[1], 10);
day = Math.min(day, $.countdown._getDaysInMonth(year, month));
break;
case 'y':
year += parseInt(matches[1], 10);
day = Math.min(day, $.countdown._getDaysInMonth(year, month));
break;
}
matches = pattern.exec(offset);
}
return new Date(year, month, day, hour, minute, second, 0);
};
var time = (setting == null ? defaultTime :
(typeof setting == 'string' ? offsetString(setting) :
(typeof setting == 'number' ? offsetNumeric(setting) : setting)));
if (time) time.setMilliseconds(0);
return time;
},
/* Determine the number of days in a month.
@param year (number) the year
@param month (number) the month
@return (number) the days in that month */
_getDaysInMonth: function(year, month) {
return 32 - new Date(year, month, 32).getDate();
},
/* Generate the HTML to display the countdown widget.
@param inst (object) the current settings for this instance
@return (string) the new HTML for the countdown display */
_generateHTML: function(inst) {
// Determine what to show
inst._periods = periods = (inst._hold ? inst._periods :
this._calculatePeriods(inst, inst._show, new Date()));
// Show all 'asNeeded' after first non-zero value
var shownNonZero = false;
var showCount = 0;
for (var period = 0; period < inst._show.length; period++) {
shownNonZero |= (inst._show[period] == '?' && periods[period] > 0);
inst._show[period] = (inst._show[period] == '?' && !shownNonZero ? null : inst._show[period]);
showCount += (inst._show[period] ? 1 : 0);
}
var compact = this._get(inst, 'compact');
var layout = this._get(inst, 'layout');
var labels = (compact ? this._get(inst, 'compactLabels') : this._get(inst, 'labels'));
var timeSeparator = this._get(inst, 'timeSeparator');
var description = this._get(inst, 'description') || '';
var showCompact = function(period) {
var labelsNum = $.countdown._get(inst, 'compactLabels' + periods[period]);
return (inst._show[period] ? periods[period] +
(labelsNum ? labelsNum[period] : labels[period]) + ' ' : '');
};
var showFull = function(period) {
var labelsNum = $.countdown._get(inst, 'labels' + periods[period]);
return (inst._show[period] ?
'<span class="countdown_section"><span class="countdown_amount">' +
periods[period] + '</span><br/>' +
(labelsNum ? labelsNum[period] : labels[period]) + '</span>' : '');
};
return (layout ? this._buildLayout(inst, layout, compact) :
((compact ? // Compact version
'<span class="countdown_row countdown_amount' +
(inst._hold ? ' countdown_holding' : '') + '">' +
showCompact(Y) + showCompact(O) + showCompact(W) + showCompact(D) +
(inst._show[H] ? this._minDigits(periods[H], 2) : '') +
(inst._show[M] ? (inst._show[H] ? timeSeparator : '') +
this._minDigits(periods[M], 2) : '') +
(inst._show[S] ? (inst._show[H] || inst._show[M] ? timeSeparator : '') +
this._minDigits(periods[S], 2) : '') :
// Full version
'<span class="countdown_row countdown_show' + showCount +
(inst._hold ? ' countdown_holding' : '') + '">' +
showFull(Y) + showFull(O) + showFull(W) + showFull(D) +
showFull(H) + showFull(M) + showFull(S)) + '</span>' +
(description ? '<span class="countdown_row countdown_descr">' + description + '</span>' : '')));
},
/* Construct a custom layout.
@param inst (object) the current settings for this instance
@param layout (string) the customised layout
@param compact (boolean) true if using compact labels
@return (string) the custom HTML */
_buildLayout: function(inst, layout, compact) {
var labels = this._get(inst, (compact ? 'compactLabels' : 'labels'));
var labelFor = function(index) {
return ($.countdown._get(inst,
(compact ? 'compactLabels' : 'labels') + inst._periods[index]) ||
labels)[index];
};
var digit = function(value, position) {
return Math.floor(value / position) % 10;
};
var subs = {desc: this._get(inst, 'description'), sep: this._get(inst, 'timeSeparator'),
yl: labelFor(Y), yn: inst._periods[Y], ynn: this._minDigits(inst._periods[Y], 2),
ynnn: this._minDigits(inst._periods[Y], 3), y1: digit(inst._periods[Y], 1),
y10: digit(inst._periods[Y], 10), y100: digit(inst._periods[Y], 100),
ol: labelFor(O), on: inst._periods[O], onn: this._minDigits(inst._periods[O], 2),
onnn: this._minDigits(inst._periods[O], 3), o1: digit(inst._periods[O], 1),
o10: digit(inst._periods[O], 10), o100: digit(inst._periods[O], 100),
wl: labelFor(W), wn: inst._periods[W], wnn: this._minDigits(inst._periods[W], 2),
wnnn: this._minDigits(inst._periods[W], 3), w1: digit(inst._periods[W], 1),
w10: digit(inst._periods[W], 10), w100: digit(inst._periods[W], 100),
dl: labelFor(D), dn: inst._periods[D], dnn: this._minDigits(inst._periods[D], 2),
dnnn: this._minDigits(inst._periods[D], 3), d1: digit(inst._periods[D], 1),
d10: digit(inst._periods[D], 10), d100: digit(inst._periods[D], 100),
hl: labelFor(H), hn: inst._periods[H], hnn: this._minDigits(inst._periods[H], 2),
hnnn: this._minDigits(inst._periods[H], 3), h1: digit(inst._periods[H], 1),
h10: digit(inst._periods[H], 10), h100: digit(inst._periods[H], 100),
ml: labelFor(M), mn: inst._periods[M], mnn: this._minDigits(inst._periods[M], 2),
mnnn: this._minDigits(inst._periods[M], 3), m1: digit(inst._periods[M], 1),
m10: digit(inst._periods[M], 10), m100: digit(inst._periods[M], 100),
sl: labelFor(S), sn: inst._periods[S], snn: this._minDigits(inst._periods[S], 2),
snnn: this._minDigits(inst._periods[S], 3), s1: digit(inst._periods[S], 1),
s10: digit(inst._periods[S], 10), s100: digit(inst._periods[S], 100)};
var html = layout;
// Replace period containers: {p<}...{p>}
for (var i = 0; i < 7; i++) {
var period = 'yowdhms'.charAt(i);
var re = new RegExp('\\{' + period + '<\\}(.*)\\{' + period + '>\\}', 'g');
html = html.replace(re, (inst._show[i] ? '$1' : ''));
}
// Replace period values: {pn}
$.each(subs, function(n, v) {
var re = new RegExp('\\{' + n + '\\}', 'g');
html = html.replace(re, v);
});
return html;
},
/* Ensure a numeric value has at least n digits for display.
@param value (number) the value to display
@param len (number) the minimum length
@return (string) the display text */
_minDigits: function(value, len) {
value = '0000000000' + value;
return value.substr(value.length - len);
},
/* Translate the format into flags for each period.
@param inst (object) the current settings for this instance
@return (string[7]) flags indicating which periods are requested (?) or
required (!) by year, month, week, day, hour, minute, second */
_determineShow: function(inst) {
var format = this._get(inst, 'format');
var show = [];
show[Y] = (format.match('y') ? '?' : (format.match('Y') ? '!' : null));
show[O] = (format.match('o') ? '?' : (format.match('O') ? '!' : null));
show[W] = (format.match('w') ? '?' : (format.match('W') ? '!' : null));
show[D] = (format.match('d') ? '?' : (format.match('D') ? '!' : null));
show[H] = (format.match('h') ? '?' : (format.match('H') ? '!' : null));
show[M] = (format.match('m') ? '?' : (format.match('M') ? '!' : null));
show[S] = (format.match('s') ? '?' : (format.match('S') ? '!' : null));
return show;
},
/* Calculate the requested periods between now and the target time.
@param inst (object) the current settings for this instance
@param show (string[7]) flags indicating which periods are requested/required
@param now (Date) the current date and time
@return (number[7]) the current time periods (always positive)
by year, month, week, day, hour, minute, second */
_calculatePeriods: function(inst, show, now) {
// Find endpoints
inst._now = now;
inst._now.setMilliseconds(0);
var until = new Date(inst._now.getTime());
if (inst._since && now.getTime() < inst._since.getTime()) {
inst._now = now = until;
}
else if (inst._since) {
now = inst._since;
}
else {
until.setTime(inst._until.getTime());
if (now.getTime() > inst._until.getTime()) {
inst._now = now = until;
}
}
// Calculate differences by period
var periods = [0, 0, 0, 0, 0, 0, 0];
if (show[Y] || show[O]) {
// Treat end of months as the same
var lastNow = $.countdown._getDaysInMonth(now.getFullYear(), now.getMonth());
var lastUntil = $.countdown._getDaysInMonth(until.getFullYear(), until.getMonth());
var sameDay = (until.getDate() == now.getDate() ||
(until.getDate() >= Math.min(lastNow, lastUntil) &&
now.getDate() >= Math.min(lastNow, lastUntil)));
var getSecs = function(date) {
return (date.getHours() * 60 + date.getMinutes()) * 60 + date.getSeconds();
};
var months = Math.max(0,
(until.getFullYear() - now.getFullYear()) * 12 + until.getMonth() - now.getMonth() +
((until.getDate() < now.getDate() && !sameDay) ||
(sameDay && getSecs(until) < getSecs(now)) ? -1 : 0));
periods[Y] = (show[Y] ? Math.floor(months / 12) : 0);
periods[O] = (show[O] ? months - periods[Y] * 12 : 0);
// Adjust for months difference and end of month if necessary
var adjustDate = function(date, offset, last) {
var wasLastDay = (date.getDate() == last);
var lastDay = $.countdown._getDaysInMonth(date.getFullYear() + offset * periods[Y],
date.getMonth() + offset * periods[O]);
if (date.getDate() > lastDay) {
date.setDate(lastDay);
}
date.setFullYear(date.getFullYear() + offset * periods[Y]);
date.setMonth(date.getMonth() + offset * periods[O]);
if (wasLastDay) {
date.setDate(lastDay);
}
return date;
};
if (inst._since) {
until = adjustDate(until, -1, lastUntil);
}
else {
now = adjustDate(new Date(now.getTime()), +1, lastNow);
}
}
var diff = Math.floor((until.getTime() - now.getTime()) / 1000);
var extractPeriod = function(period, numSecs) {
periods[period] = (show[period] ? Math.floor(diff / numSecs) : 0);
diff -= periods[period] * numSecs;
};
extractPeriod(W, 604800);
extractPeriod(D, 86400);
extractPeriod(H, 3600);
extractPeriod(M, 60);
extractPeriod(S, 1);
return periods;
}
});
/* jQuery extend now ignores nulls!
@param target (object) the object to update
@param props (object) the new settings
@return (object) the updated object */
function extendRemove(target, props) {
$.extend(target, props);
for (var name in props) {
if (props[name] == null) {
target[name] = null;
}
}
return target;
}
/* Process the countdown functionality for a jQuery selection.
@param command (string) the command to run (optional, default 'attach')
@param options (object) the new settings to use for these countdown instances
@return (jQuery) for chaining further calls */
$.fn.countdown = function(options) {
var otherArgs = Array.prototype.slice.call(arguments, 1);
if (options == 'getTimes') {
return $.countdown['_' + options + 'Countdown'].
apply($.countdown, [this[0]].concat(otherArgs));
}
return this.each(function() {
if (typeof options == 'string') {
$.countdown['_' + options + 'Countdown'].apply($.countdown, [this].concat(otherArgs));
}
else {
$.countdown._attachCountdown(this, options);
}
});
};
/* Initialise the countdown functionality. */
$.countdown = new Countdown(); // singleton instance
})(jQuery);
| JavaScript |
(function($) {
$(document).ready( function() {
$('.feature-slider a').click(function(e) {
$('.featured-posts section.featured-post').css({
opacity: 0,
visibility: 'hidden'
});
$(this.hash).css({
opacity: 1,
visibility: 'visible'
});
$('.feature-slider a').removeClass('active');
$(this).addClass('active');
e.preventDefault();
});
});
})(jQuery); | JavaScript |
( function( $ ){
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '#site-title a' ).html( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '#site-description' ).html( to );
} );
} );
} )( jQuery ); | JavaScript |
var farbtastic;
(function($){
var pickColor = function(a) {
farbtastic.setColor(a);
$('#link-color').val(a);
$('#link-color-example').css('background-color', a);
};
$(document).ready( function() {
$('#default-color').wrapInner('<a href="#" />');
farbtastic = $.farbtastic('#colorPickerDiv', pickColor);
pickColor( $('#link-color').val() );
$('.pickcolor').click( function(e) {
$('#colorPickerDiv').show();
e.preventDefault();
});
$('#link-color').keyup( function() {
var a = $('#link-color').val(),
b = a;
a = a.replace(/[^a-fA-F0-9]/, '');
if ( '#' + a !== b )
$('#link-color').val(a);
if ( a.length === 3 || a.length === 6 )
pickColor( '#' + a );
});
$(document).mousedown( function() {
$('#colorPickerDiv').hide();
});
$('#default-color a').click( function(e) {
pickColor( '#' + this.innerHTML.replace(/[^a-fA-F0-9]/, '') );
e.preventDefault();
});
$('.image-radio-option.color-scheme input:radio').change( function() {
var currentDefault = $('#default-color a'),
newDefault = $(this).next().val();
if ( $('#link-color').val() == currentDefault.text() )
pickColor( newDefault );
currentDefault.text( newDefault );
});
});
})(jQuery); | JavaScript |
/**
* navigation.js
*
* Handles toggling the navigation menu for small screens.
*/
( function() {
var nav = document.getElementById( 'site-navigation' ), button, menu;
if ( ! nav )
return;
button = nav.getElementsByTagName( 'h3' )[0];
menu = nav.getElementsByTagName( 'ul' )[0];
if ( ! button )
return;
// Hide button if menu is missing or empty.
if ( ! menu || ! menu.childNodes.length ) {
button.style.display = 'none';
return;
}
button.onclick = function() {
if ( -1 == menu.className.indexOf( 'nav-menu' ) )
menu.className = 'nav-menu';
if ( -1 != button.className.indexOf( 'toggled-on' ) ) {
button.className = button.className.replace( ' toggled-on', '' );
menu.className = menu.className.replace( ' toggled-on', '' );
} else {
button.className += ' toggled-on';
menu.className += ' toggled-on';
}
};
} )(); | JavaScript |
/**
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
* Things like site title, description, and background color changes.
*/
( function( $ ) {
// Site title and description.
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '.site-title a' ).html( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '.site-description' ).html( to );
} );
} );
// Hook into background color change and adjust body class value as needed.
wp.customize( 'background_color', function( value ) {
value.bind( function( to ) {
if ( '#ffffff' == to || '#fff' == to )
$( 'body' ).addClass( 'custom-background-white' );
else if ( '' == to )
$( 'body' ).addClass( 'custom-background-empty' );
else
$( 'body' ).removeClass( 'custom-background-empty custom-background-white' );
} );
} );
} )( jQuery ); | JavaScript |
function FindProxyForURL(url, host) {
PROXY = "PROXY yourhttpproxy:80";
DEFAULT = "DIRECT";
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?appspot\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?blogspot\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(\d{2,}\.)docs\.google\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(\d{2,}\.)drive\.google\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?googleapis\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?googlecode\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?googlegroups\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?googlemashups\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?ig\.ig\.gmodules\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?a\.orkut\.gmodules\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)doc-(.{5})-docs\.googleusercontent\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\-)?a-fc-opensocial\.googleusercontent\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)images(\d{2,})-focus-opensocial\.googleusercontent\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(\d{2,}\.)-wave-opensocial\.googleusercontent\.com/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?au\.doubleclick\.net/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?de\.doubleclick\.net/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?fr\.doubleclick\.net/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?jp\.doubleclick\.net/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?uk\.doubleclick\.net/i.test(url)) return PROXY;
if(/^[\w\-]+:\/+(?!\/)(www|ssl)\.google-analytics\.net/i.test(url)) return DEFAULT;
if(/^[\w\-]+:\/+(?!\/)(?:[^\/]+\.)?google-analytics\.net/i.test(url)) return PROXY;
return DEFAULT;
} | JavaScript |
var Ajax;
if (Ajax && (Ajax != null)) {
Ajax.Responders.register({
onCreate: function() {
if($('spinner') && Ajax.activeRequestCount>0)
Effect.Appear('spinner',{duration:0.5,queue:'end'});
},
onComplete: function() {
if($('spinner') && Ajax.activeRequestCount==0)
Effect.Fade('spinner',{duration:0.5,queue:'end'});
}
});
}
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This plugin register Toolbar items for the combos modifying the style to
* not show the box.
*/
FCKToolbarItems.RegisterItem( 'SourceSimple' , new FCKToolbarButton( 'Source', FCKLang.Source, null, FCK_TOOLBARITEM_ONLYICON, true, true, 1 ) ) ;
FCKToolbarItems.RegisterItem( 'StyleSimple' , new FCKToolbarStyleCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ;
FCKToolbarItems.RegisterItem( 'FontNameSimple' , new FCKToolbarFontsCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ;
FCKToolbarItems.RegisterItem( 'FontSizeSimple' , new FCKToolbarFontSizeCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ;
FCKToolbarItems.RegisterItem( 'FontFormatSimple', new FCKToolbarFontFormatCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Plugin: automatically resizes the editor until a configurable maximun
* height (FCKConfig.AutoGrowMax), based on its contents.
*/
var FCKAutoGrow = {
MIN_HEIGHT : window.frameElement.offsetHeight,
Check : function()
{
var delta = FCKAutoGrow.GetHeightDelta() ;
if ( delta != 0 )
{
var newHeight = window.frameElement.offsetHeight + delta ;
newHeight = FCKAutoGrow.GetEffectiveHeight( newHeight ) ;
if ( newHeight != window.frameElement.height )
{
window.frameElement.style.height = newHeight + "px" ;
// Gecko browsers use an onresize handler to update the innermost
// IFRAME's height. If the document is modified before the onresize
// is triggered, the plugin will miscalculate the new height. Thus,
// forcibly trigger onresize. #1336
if ( typeof window.onresize == 'function' )
{
window.onresize() ;
}
}
}
},
CheckEditorStatus : function( sender, status )
{
if ( status == FCK_STATUS_COMPLETE )
FCKAutoGrow.Check() ;
},
GetEffectiveHeight : function( height )
{
if ( height < FCKAutoGrow.MIN_HEIGHT )
height = FCKAutoGrow.MIN_HEIGHT;
else
{
var max = FCKConfig.AutoGrowMax;
if ( max && max > 0 && height > max )
height = max;
}
return height;
},
GetHeightDelta : function()
{
var oInnerDoc = FCK.EditorDocument ;
var iFrameHeight ;
var iInnerHeight ;
if ( FCKBrowserInfo.IsIE )
{
iFrameHeight = FCK.EditorWindow.frameElement.offsetHeight ;
iInnerHeight = oInnerDoc.body.scrollHeight ;
}
else
{
iFrameHeight = FCK.EditorWindow.innerHeight ;
iInnerHeight = oInnerDoc.body.offsetHeight +
( parseInt( FCKDomTools.GetCurrentElementStyle( oInnerDoc.body, 'margin-top' ), 10 ) || 0 ) +
( parseInt( FCKDomTools.GetCurrentElementStyle( oInnerDoc.body, 'margin-bottom' ), 10 ) || 0 ) ;
}
return iInnerHeight - iFrameHeight ;
},
SetListeners : function()
{
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
return ;
FCK.EditorWindow.attachEvent( 'onscroll', FCKAutoGrow.Check ) ;
FCK.EditorDocument.attachEvent( 'onkeyup', FCKAutoGrow.Check ) ;
}
};
FCK.AttachToOnSelectionChange( FCKAutoGrow.Check ) ;
if ( FCKBrowserInfo.IsIE )
FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKAutoGrow.SetListeners ) ;
FCK.Events.AttachEvent( 'OnStatusChange', FCKAutoGrow.CheckEditorStatus ) ;
| JavaScript |
var FCKDragTableHandler =
{
"_DragState" : 0,
"_LeftCell" : null,
"_RightCell" : null,
"_MouseMoveMode" : 0, // 0 - find candidate cells for resizing, 1 - drag to resize
"_ResizeBar" : null,
"_OriginalX" : null,
"_MinimumX" : null,
"_MaximumX" : null,
"_LastX" : null,
"_TableMap" : null,
"_doc" : document,
"_IsInsideNode" : function( w, domNode, pos )
{
var myCoords = FCKTools.GetWindowPosition( w, domNode ) ;
var xMin = myCoords.x ;
var yMin = myCoords.y ;
var xMax = parseInt( xMin, 10 ) + parseInt( domNode.offsetWidth, 10 ) ;
var yMax = parseInt( yMin, 10 ) + parseInt( domNode.offsetHeight, 10 ) ;
if ( pos.x >= xMin && pos.x <= xMax && pos.y >= yMin && pos.y <= yMax )
return true;
return false;
},
"_GetBorderCells" : function( w, tableNode, tableMap, mouse )
{
// Enumerate all the cells in the table.
var cells = [] ;
for ( var i = 0 ; i < tableNode.rows.length ; i++ )
{
var r = tableNode.rows[i] ;
for ( var j = 0 ; j < r.cells.length ; j++ )
cells.push( r.cells[j] ) ;
}
if ( cells.length < 1 )
return null ;
// Get the cells whose right or left border is nearest to the mouse cursor's x coordinate.
var minRxDist = null ;
var lxDist = null ;
var minYDist = null ;
var rbCell = null ;
var lbCell = null ;
for ( var i = 0 ; i < cells.length ; i++ )
{
var pos = FCKTools.GetWindowPosition( w, cells[i] ) ;
var rightX = pos.x + parseInt( cells[i].clientWidth, 10 ) ;
var rxDist = mouse.x - rightX ;
var yDist = mouse.y - ( pos.y + ( cells[i].clientHeight / 2 ) ) ;
if ( minRxDist == null ||
( Math.abs( rxDist ) <= Math.abs( minRxDist ) &&
( minYDist == null || Math.abs( yDist ) <= Math.abs( minYDist ) ) ) )
{
minRxDist = rxDist ;
minYDist = yDist ;
rbCell = cells[i] ;
}
}
/*
var rowNode = FCKTools.GetElementAscensor( rbCell, "tr" ) ;
var cellIndex = rbCell.cellIndex + 1 ;
if ( cellIndex >= rowNode.cells.length )
return null ;
lbCell = rowNode.cells.item( cellIndex ) ;
*/
var rowIdx = rbCell.parentNode.rowIndex ;
var colIdx = FCKTableHandler._GetCellIndexSpan( tableMap, rowIdx, rbCell ) ;
var colSpan = isNaN( rbCell.colSpan ) ? 1 : rbCell.colSpan ;
lbCell = tableMap[rowIdx][colIdx + colSpan] ;
if ( ! lbCell )
return null ;
// Abort if too far from the border.
lxDist = mouse.x - FCKTools.GetWindowPosition( w, lbCell ).x ;
if ( lxDist < 0 && minRxDist < 0 && minRxDist < -2 )
return null ;
if ( lxDist > 0 && minRxDist > 0 && lxDist > 3 )
return null ;
return { "leftCell" : rbCell, "rightCell" : lbCell } ;
},
"_GetResizeBarPosition" : function()
{
var row = FCKTools.GetElementAscensor( this._RightCell, "tr" ) ;
return FCKTableHandler._GetCellIndexSpan( this._TableMap, row.rowIndex, this._RightCell ) ;
},
"_ResizeBarMouseDownListener" : function( evt )
{
if ( FCKDragTableHandler._LeftCell )
FCKDragTableHandler._MouseMoveMode = 1 ;
if ( FCKBrowserInfo.IsIE )
FCKDragTableHandler._ResizeBar.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 50 ;
else
FCKDragTableHandler._ResizeBar.style.opacity = 0.5 ;
FCKDragTableHandler._OriginalX = evt.clientX ;
// Calculate maximum and minimum x-coordinate delta.
var borderIndex = FCKDragTableHandler._GetResizeBarPosition() ;
var offset = FCKDragTableHandler._GetIframeOffset();
var table = FCKTools.GetElementAscensor( FCKDragTableHandler._LeftCell, "table" );
var minX = null ;
var maxX = null ;
for ( var r = 0 ; r < FCKDragTableHandler._TableMap.length ; r++ )
{
var leftCell = FCKDragTableHandler._TableMap[r][borderIndex - 1] ;
var rightCell = FCKDragTableHandler._TableMap[r][borderIndex] ;
var leftPosition = FCKTools.GetWindowPosition( FCK.EditorWindow, leftCell ) ;
var rightPosition = FCKTools.GetWindowPosition( FCK.EditorWindow, rightCell ) ;
var leftPadding = FCKDragTableHandler._GetCellPadding( table, leftCell ) ;
var rightPadding = FCKDragTableHandler._GetCellPadding( table, rightCell ) ;
if ( minX == null || leftPosition.x + leftPadding > minX )
minX = leftPosition.x + leftPadding ;
if ( maxX == null || rightPosition.x + rightCell.clientWidth - rightPadding < maxX )
maxX = rightPosition.x + rightCell.clientWidth - rightPadding ;
}
FCKDragTableHandler._MinimumX = minX + offset.x ;
FCKDragTableHandler._MaximumX = maxX + offset.x ;
FCKDragTableHandler._LastX = null ;
if (evt.preventDefault)
evt.preventDefault();
else
evt.returnValue = false;
},
"_ResizeBarMouseUpListener" : function( evt )
{
FCKDragTableHandler._MouseMoveMode = 0 ;
FCKDragTableHandler._HideResizeBar() ;
if ( FCKDragTableHandler._LastX == null )
return ;
// Calculate the delta value.
var deltaX = FCKDragTableHandler._LastX - FCKDragTableHandler._OriginalX ;
// Then, build an array of current column width values.
// This algorithm can be very slow if the cells have insane colSpan values. (e.g. colSpan=1000).
var table = FCKTools.GetElementAscensor( FCKDragTableHandler._LeftCell, "table" ) ;
var colArray = [] ;
var tableMap = FCKDragTableHandler._TableMap ;
for ( var i = 0 ; i < tableMap.length ; i++ )
{
for ( var j = 0 ; j < tableMap[i].length ; j++ )
{
var cell = tableMap[i][j] ;
var width = FCKDragTableHandler._GetCellWidth( table, cell ) ;
var colSpan = isNaN( cell.colSpan) ? 1 : cell.colSpan ;
if ( colArray.length <= j )
colArray.push( { width : width / colSpan, colSpan : colSpan } ) ;
else
{
var guessItem = colArray[j] ;
if ( guessItem.colSpan > colSpan )
{
guessItem.width = width / colSpan ;
guessItem.colSpan = colSpan ;
}
}
}
}
// Find out the equivalent column index of the two cells selected for resizing.
colIndex = FCKDragTableHandler._GetResizeBarPosition() ;
// Note that colIndex must be at least 1 here, so it's safe to subtract 1 from it.
colIndex-- ;
// Modify the widths in the colArray according to the mouse coordinate delta value.
colArray[colIndex].width += deltaX ;
colArray[colIndex + 1].width -= deltaX ;
// Clear all cell widths, delete all <col> elements from the table.
for ( var r = 0 ; r < table.rows.length ; r++ )
{
var row = table.rows.item( r ) ;
for ( var c = 0 ; c < row.cells.length ; c++ )
{
var cell = row.cells.item( c ) ;
cell.width = "" ;
cell.style.width = "" ;
}
}
var colElements = table.getElementsByTagName( "col" ) ;
for ( var i = colElements.length - 1 ; i >= 0 ; i-- )
colElements[i].parentNode.removeChild( colElements[i] ) ;
// Set new cell widths.
var processedCells = [] ;
for ( var i = 0 ; i < tableMap.length ; i++ )
{
for ( var j = 0 ; j < tableMap[i].length ; j++ )
{
var cell = tableMap[i][j] ;
if ( cell._Processed )
continue ;
if ( tableMap[i][j-1] != cell )
cell.width = colArray[j].width ;
else
cell.width = parseInt( cell.width, 10 ) + parseInt( colArray[j].width, 10 ) ;
if ( tableMap[i][j+1] != cell )
{
processedCells.push( cell ) ;
cell._Processed = true ;
}
}
}
for ( var i = 0 ; i < processedCells.length ; i++ )
{
if ( FCKBrowserInfo.IsIE )
processedCells[i].removeAttribute( '_Processed' ) ;
else
delete processedCells[i]._Processed ;
}
FCKDragTableHandler._LastX = null ;
},
"_ResizeBarMouseMoveListener" : function( evt )
{
if ( FCKDragTableHandler._MouseMoveMode == 0 )
return FCKDragTableHandler._MouseFindHandler( FCK, evt ) ;
else
return FCKDragTableHandler._MouseDragHandler( FCK, evt ) ;
},
// Calculate the padding of a table cell.
// It returns the value of paddingLeft + paddingRight of a table cell.
// This function is used, in part, to calculate the width parameter that should be used for setting cell widths.
// The equation in question is clientWidth = paddingLeft + paddingRight + width.
// So that width = clientWidth - paddingLeft - paddingRight.
// The return value of this function must be pixel accurate acorss all supported browsers, so be careful if you need to modify it.
"_GetCellPadding" : function( table, cell )
{
var attrGuess = parseInt( table.cellPadding, 10 ) * 2 ;
var cssGuess = null ;
if ( typeof( window.getComputedStyle ) == "function" )
{
var styleObj = window.getComputedStyle( cell, null ) ;
cssGuess = parseInt( styleObj.getPropertyValue( "padding-left" ), 10 ) +
parseInt( styleObj.getPropertyValue( "padding-right" ), 10 ) ;
}
else
cssGuess = parseInt( cell.currentStyle.paddingLeft, 10 ) + parseInt (cell.currentStyle.paddingRight, 10 ) ;
var cssRuntime = cell.style.padding ;
if ( isFinite( cssRuntime ) )
cssGuess = parseInt( cssRuntime, 10 ) * 2 ;
else
{
cssRuntime = cell.style.paddingLeft ;
if ( isFinite( cssRuntime ) )
cssGuess = parseInt( cssRuntime, 10 ) ;
cssRuntime = cell.style.paddingRight ;
if ( isFinite( cssRuntime ) )
cssGuess += parseInt( cssRuntime, 10 ) ;
}
attrGuess = parseInt( attrGuess, 10 ) ;
cssGuess = parseInt( cssGuess, 10 ) ;
if ( isNaN( attrGuess ) )
attrGuess = 0 ;
if ( isNaN( cssGuess ) )
cssGuess = 0 ;
return Math.max( attrGuess, cssGuess ) ;
},
// Calculate the real width of the table cell.
// The real width of the table cell is the pixel width that you can set to the width attribute of the table cell and after
// that, the table cell should be of exactly the same width as before.
// The real width of a table cell can be calculated as:
// width = clientWidth - paddingLeft - paddingRight.
"_GetCellWidth" : function( table, cell )
{
var clientWidth = cell.clientWidth ;
if ( isNaN( clientWidth ) )
clientWidth = 0 ;
return clientWidth - this._GetCellPadding( table, cell ) ;
},
"MouseMoveListener" : function( FCK, evt )
{
if ( FCKDragTableHandler._MouseMoveMode == 0 )
return FCKDragTableHandler._MouseFindHandler( FCK, evt ) ;
else
return FCKDragTableHandler._MouseDragHandler( FCK, evt ) ;
},
"_MouseFindHandler" : function( FCK, evt )
{
if ( FCK.MouseDownFlag )
return ;
var node = evt.srcElement || evt.target ;
try
{
if ( ! node || node.nodeType != 1 )
{
this._HideResizeBar() ;
return ;
}
}
catch ( e )
{
this._HideResizeBar() ;
return ;
}
// Since this function might be called from the editing area iframe or the outer fckeditor iframe,
// the mouse point coordinates from evt.clientX/Y can have different reference points.
// We need to resolve the mouse pointer position relative to the editing area iframe.
var mouseX = evt.clientX ;
var mouseY = evt.clientY ;
if ( FCKTools.GetElementDocument( node ) == document )
{
var offset = this._GetIframeOffset() ;
mouseX -= offset.x ;
mouseY -= offset.y ;
}
if ( this._ResizeBar && this._LeftCell )
{
var leftPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._LeftCell ) ;
var rightPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._RightCell ) ;
var rxDist = mouseX - ( leftPos.x + this._LeftCell.clientWidth ) ;
var lxDist = mouseX - rightPos.x ;
var inRangeFlag = false ;
if ( lxDist >= 0 && rxDist <= 0 )
inRangeFlag = true ;
else if ( rxDist > 0 && lxDist <= 3 )
inRangeFlag = true ;
else if ( lxDist < 0 && rxDist >= -2 )
inRangeFlag = true ;
if ( inRangeFlag )
{
this._ShowResizeBar( FCK.EditorWindow,
FCKTools.GetElementAscensor( this._LeftCell, "table" ),
{ "x" : mouseX, "y" : mouseY } ) ;
return ;
}
}
var tagName = node.tagName.toLowerCase() ;
if ( tagName != "table" && tagName != "td" && tagName != "th" )
{
if ( this._LeftCell )
this._LeftCell = this._RightCell = this._TableMap = null ;
this._HideResizeBar() ;
return ;
}
node = FCKTools.GetElementAscensor( node, "table" ) ;
var tableMap = FCKTableHandler._CreateTableMap( node ) ;
var cellTuple = this._GetBorderCells( FCK.EditorWindow, node, tableMap, { "x" : mouseX, "y" : mouseY } ) ;
if ( cellTuple == null )
{
if ( this._LeftCell )
this._LeftCell = this._RightCell = this._TableMap = null ;
this._HideResizeBar() ;
}
else
{
this._LeftCell = cellTuple["leftCell"] ;
this._RightCell = cellTuple["rightCell"] ;
this._TableMap = tableMap ;
this._ShowResizeBar( FCK.EditorWindow,
FCKTools.GetElementAscensor( this._LeftCell, "table" ),
{ "x" : mouseX, "y" : mouseY } ) ;
}
},
"_MouseDragHandler" : function( FCK, evt )
{
var mouse = { "x" : evt.clientX, "y" : evt.clientY } ;
// Convert mouse coordinates in reference to the outer iframe.
var node = evt.srcElement || evt.target ;
if ( FCKTools.GetElementDocument( node ) == FCK.EditorDocument )
{
var offset = this._GetIframeOffset() ;
mouse.x += offset.x ;
mouse.y += offset.y ;
}
// Calculate the mouse position delta and see if we've gone out of range.
if ( mouse.x >= this._MaximumX - 5 )
mouse.x = this._MaximumX - 5 ;
if ( mouse.x <= this._MinimumX + 5 )
mouse.x = this._MinimumX + 5 ;
var docX = mouse.x + FCKTools.GetScrollPosition( window ).X ;
this._ResizeBar.style.left = ( docX - this._ResizeBar.offsetWidth / 2 ) + "px" ;
this._LastX = mouse.x ;
},
"_ShowResizeBar" : function( w, table, mouse )
{
if ( this._ResizeBar == null )
{
this._ResizeBar = this._doc.createElement( "div" ) ;
var paddingBar = this._ResizeBar ;
var paddingStyles = { 'position' : 'absolute', 'cursor' : 'e-resize' } ;
if ( FCKBrowserInfo.IsIE )
paddingStyles.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=10,enabled=true)" ;
else
paddingStyles.opacity = 0.10 ;
FCKDomTools.SetElementStyles( paddingBar, paddingStyles ) ;
this._avoidStyles( paddingBar );
paddingBar.setAttribute('_fcktemp', true);
this._doc.body.appendChild( paddingBar ) ;
FCKTools.AddEventListener( paddingBar, "mousemove", this._ResizeBarMouseMoveListener ) ;
FCKTools.AddEventListener( paddingBar, "mousedown", this._ResizeBarMouseDownListener ) ;
FCKTools.AddEventListener( document, "mouseup", this._ResizeBarMouseUpListener ) ;
FCKTools.AddEventListener( FCK.EditorDocument, "mouseup", this._ResizeBarMouseUpListener ) ;
// IE doesn't let the tranparent part of the padding block to receive mouse events unless there's something inside.
// So we need to create a spacer image to fill the block up.
var filler = this._doc.createElement( "img" ) ;
filler.setAttribute('_fcktemp', true);
filler.border = 0 ;
filler.src = FCKConfig.BasePath + "images/spacer.gif" ;
filler.style.position = "absolute" ;
paddingBar.appendChild( filler ) ;
// Disable drag and drop, and selection for the filler image.
var disabledListener = function( evt )
{
if ( evt.preventDefault )
evt.preventDefault() ;
else
evt.returnValue = false ;
}
FCKTools.AddEventListener( filler, "dragstart", disabledListener ) ;
FCKTools.AddEventListener( filler, "selectstart", disabledListener ) ;
}
var paddingBar = this._ResizeBar ;
var offset = this._GetIframeOffset() ;
var tablePos = this._GetTablePosition( w, table ) ;
var barHeight = table.offsetHeight ;
var barTop = offset.y + tablePos.y ;
// Do not let the resize bar intrude into the toolbar area.
if ( tablePos.y < 0 )
{
barHeight += tablePos.y ;
barTop -= tablePos.y ;
}
var bw = parseInt( table.border, 10 ) ;
if ( isNaN( bw ) )
bw = 0 ;
var cs = parseInt( table.cellSpacing, 10 ) ;
if ( isNaN( cs ) )
cs = 0 ;
var barWidth = Math.max( bw+100, cs+100 ) ;
var paddingStyles =
{
'top' : barTop + 'px',
'height' : barHeight + 'px',
'width' : barWidth + 'px',
'left' : ( offset.x + mouse.x + FCKTools.GetScrollPosition( w ).X - barWidth / 2 ) + 'px'
} ;
if ( FCKBrowserInfo.IsIE )
paddingBar.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 10 ;
else
paddingStyles.opacity = 0.1 ;
FCKDomTools.SetElementStyles( paddingBar, paddingStyles ) ;
var filler = paddingBar.getElementsByTagName( "img" )[0] ;
FCKDomTools.SetElementStyles( filler,
{
width : paddingBar.offsetWidth + 'px',
height : barHeight + 'px'
} ) ;
barWidth = Math.max( bw, cs, 3 ) ;
var visibleBar = null ;
if ( paddingBar.getElementsByTagName( "div" ).length < 1 )
{
visibleBar = this._doc.createElement( "div" ) ;
this._avoidStyles( visibleBar );
visibleBar.setAttribute('_fcktemp', true);
paddingBar.appendChild( visibleBar ) ;
}
else
visibleBar = paddingBar.getElementsByTagName( "div" )[0] ;
FCKDomTools.SetElementStyles( visibleBar,
{
position : 'absolute',
backgroundColor : 'blue',
width : barWidth + 'px',
height : barHeight + 'px',
left : '50px',
top : '0px'
} ) ;
},
"_HideResizeBar" : function()
{
if ( this._ResizeBar )
// IE bug: display : none does not hide the resize bar for some reason.
// so set the position to somewhere invisible.
FCKDomTools.SetElementStyles( this._ResizeBar,
{
top : '-100000px',
left : '-100000px'
} ) ;
},
"_GetIframeOffset" : function ()
{
return FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ;
},
"_GetTablePosition" : function ( w, table )
{
return FCKTools.GetWindowPosition( w, table ) ;
},
"_avoidStyles" : function( element )
{
FCKDomTools.SetElementStyles( element,
{
padding : '0',
backgroundImage : 'none',
border : '0'
} ) ;
},
"Reset" : function()
{
FCKDragTableHandler._LeftCell = FCKDragTableHandler._RightCell = FCKDragTableHandler._TableMap = null ;
}
};
FCK.Events.AttachEvent( "OnMouseMove", FCKDragTableHandler.MouseMoveListener ) ;
FCK.Events.AttachEvent( "OnAfterSetHTML", FCKDragTableHandler.Reset ) ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Placeholder French language file.
*/
FCKLang.PlaceholderBtn = "Insérer/Modifier l'Espace réservé" ;
FCKLang.PlaceholderDlgTitle = "Propriétés de l'Espace réservé" ;
FCKLang.PlaceholderDlgName = "Nom de l'Espace réservé" ;
FCKLang.PlaceholderErrNoName = "Veuillez saisir le nom de l'Espace réservé" ;
FCKLang.PlaceholderErrNameInUse = "Ce nom est déjà utilisé" ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Placholder German language file.
*/
FCKLang.PlaceholderBtn = 'Einfügen/editieren Platzhalter' ;
FCKLang.PlaceholderDlgTitle = 'Platzhalter Eigenschaften' ;
FCKLang.PlaceholderDlgName = 'Platzhalter Name' ;
FCKLang.PlaceholderErrNoName = 'Bitte den Namen des Platzhalters schreiben' ;
FCKLang.PlaceholderErrNameInUse = 'Der angegebene Namen ist schon in Gebrauch' ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Placholder Italian language file.
*/
FCKLang.PlaceholderBtn = 'Aggiungi/Modifica Placeholder' ;
FCKLang.PlaceholderDlgTitle = 'Proprietà del Placeholder' ;
FCKLang.PlaceholderDlgName = 'Nome del Placeholder' ;
FCKLang.PlaceholderErrNoName = 'Digitare il nome del placeholder' ;
FCKLang.PlaceholderErrNameInUse = 'Il nome inserito è già in uso' ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Placholder Spanish language file.
*/
FCKLang.PlaceholderBtn = 'Insertar/Editar contenedor' ;
FCKLang.PlaceholderDlgTitle = 'Propiedades del contenedor ' ;
FCKLang.PlaceholderDlgName = 'Nombre de contenedor' ;
FCKLang.PlaceholderErrNoName = 'Por favor escriba el nombre de contenedor' ;
FCKLang.PlaceholderErrNameInUse = 'El nombre especificado ya esta en uso' ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Placholder Polish language file.
*/
FCKLang.PlaceholderBtn = 'Wstaw/Edytuj nagłówek' ;
FCKLang.PlaceholderDlgTitle = 'Właśności nagłówka' ;
FCKLang.PlaceholderDlgName = 'Nazwa nagłówka' ;
FCKLang.PlaceholderErrNoName = 'Proszę wprowadzić nazwę nagłówka' ;
FCKLang.PlaceholderErrNameInUse = 'Podana nazwa jest już w użyciu' ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Placholder English language file.
*/
FCKLang.PlaceholderBtn = 'Insert/Edit Placeholder' ;
FCKLang.PlaceholderDlgTitle = 'Placeholder Properties' ;
FCKLang.PlaceholderDlgName = 'Placeholder Name' ;
FCKLang.PlaceholderErrNoName = 'Please type the placeholder name' ;
FCKLang.PlaceholderErrNameInUse = 'The specified name is already in use' ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Plugin to insert "Placeholders" in the editor.
*/
// Register the related command.
FCKCommands.RegisterCommand( 'Placeholder', new FCKDialogCommand( 'Placeholder', FCKLang.PlaceholderDlgTitle, FCKPlugins.Items['placeholder'].Path + 'fck_placeholder.html', 340, 160 ) ) ;
// Create the "Plaholder" toolbar button.
var oPlaceholderItem = new FCKToolbarButton( 'Placeholder', FCKLang.PlaceholderBtn ) ;
oPlaceholderItem.IconPath = FCKPlugins.Items['placeholder'].Path + 'placeholder.gif' ;
FCKToolbarItems.RegisterItem( 'Placeholder', oPlaceholderItem ) ;
// The object used for all Placeholder operations.
var FCKPlaceholders = new Object() ;
// Add a new placeholder at the actual selection.
FCKPlaceholders.Add = function( name )
{
var oSpan = FCK.InsertElement( 'span' ) ;
this.SetupSpan( oSpan, name ) ;
}
FCKPlaceholders.SetupSpan = function( span, name )
{
span.innerHTML = '[[ ' + name + ' ]]' ;
span.style.backgroundColor = '#ffff00' ;
span.style.color = '#000000' ;
if ( FCKBrowserInfo.IsGecko )
span.style.cursor = 'default' ;
span._fckplaceholder = name ;
span.contentEditable = false ;
// To avoid it to be resized.
span.onresizestart = function()
{
FCK.EditorWindow.event.returnValue = false ;
return false ;
}
}
// On Gecko we must do this trick so the user select all the SPAN when clicking on it.
FCKPlaceholders._SetupClickListener = function()
{
FCKPlaceholders._ClickListener = function( e )
{
if ( e.target.tagName == 'SPAN' && e.target._fckplaceholder )
FCKSelection.SelectNode( e.target ) ;
}
FCK.EditorDocument.addEventListener( 'click', FCKPlaceholders._ClickListener, true ) ;
}
// Open the Placeholder dialog on double click.
FCKPlaceholders.OnDoubleClick = function( span )
{
if ( span.tagName == 'SPAN' && span._fckplaceholder )
FCKCommands.GetCommand( 'Placeholder' ).Execute() ;
}
FCK.RegisterDoubleClickHandler( FCKPlaceholders.OnDoubleClick, 'SPAN' ) ;
// Check if a Placholder name is already in use.
FCKPlaceholders.Exist = function( name )
{
var aSpans = FCK.EditorDocument.getElementsByTagName( 'SPAN' ) ;
for ( var i = 0 ; i < aSpans.length ; i++ )
{
if ( aSpans[i]._fckplaceholder == name )
return true ;
}
return false ;
}
if ( FCKBrowserInfo.IsIE )
{
FCKPlaceholders.Redraw = function()
{
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
return ;
var aPlaholders = FCK.EditorDocument.body.innerText.match( /\[\[[^\[\]]+\]\]/g ) ;
if ( !aPlaholders )
return ;
var oRange = FCK.EditorDocument.body.createTextRange() ;
for ( var i = 0 ; i < aPlaholders.length ; i++ )
{
if ( oRange.findText( aPlaholders[i] ) )
{
var sName = aPlaholders[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ;
oRange.pasteHTML( '<span style="color: #000000; background-color: #ffff00" contenteditable="false" _fckplaceholder="' + sName + '">' + aPlaholders[i] + '</span>' ) ;
}
}
}
}
else
{
FCKPlaceholders.Redraw = function()
{
if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )
return ;
var oInteractor = FCK.EditorDocument.createTreeWalker( FCK.EditorDocument.body, NodeFilter.SHOW_TEXT, FCKPlaceholders._AcceptNode, true ) ;
var aNodes = new Array() ;
while ( ( oNode = oInteractor.nextNode() ) )
{
aNodes[ aNodes.length ] = oNode ;
}
for ( var n = 0 ; n < aNodes.length ; n++ )
{
var aPieces = aNodes[n].nodeValue.split( /(\[\[[^\[\]]+\]\])/g ) ;
for ( var i = 0 ; i < aPieces.length ; i++ )
{
if ( aPieces[i].length > 0 )
{
if ( aPieces[i].indexOf( '[[' ) == 0 )
{
var sName = aPieces[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ;
var oSpan = FCK.EditorDocument.createElement( 'span' ) ;
FCKPlaceholders.SetupSpan( oSpan, sName ) ;
aNodes[n].parentNode.insertBefore( oSpan, aNodes[n] ) ;
}
else
aNodes[n].parentNode.insertBefore( FCK.EditorDocument.createTextNode( aPieces[i] ) , aNodes[n] ) ;
}
}
aNodes[n].parentNode.removeChild( aNodes[n] ) ;
}
FCKPlaceholders._SetupClickListener() ;
}
FCKPlaceholders._AcceptNode = function( node )
{
if ( /\[\[[^\[\]]+\]\]/.test( node.nodeValue ) )
return NodeFilter.FILTER_ACCEPT ;
else
return NodeFilter.FILTER_SKIP ;
}
}
FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKPlaceholders.Redraw ) ;
// We must process the SPAN tags to replace then with the real resulting value of the placeholder.
FCKXHtml.TagProcessors['span'] = function( node, htmlNode )
{
if ( htmlNode._fckplaceholder )
node = FCKXHtml.XML.createTextNode( '[[' + htmlNode._fckplaceholder + ']]' ) ;
else
FCKXHtml._AppendChildNodes( node, htmlNode, false ) ;
return node ;
}
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This plugin register the required Toolbar items to be able to insert the
* table commands in the toolbar.
*/
FCKToolbarItems.RegisterItem( 'TableInsertRowAfter' , new FCKToolbarButton( 'TableInsertRowAfter' , FCKLang.InsertRowAfter, null, null, null, true, 62 ) ) ;
FCKToolbarItems.RegisterItem( 'TableDeleteRows' , new FCKToolbarButton( 'TableDeleteRows' , FCKLang.DeleteRows, null, null, null, true, 63 ) ) ;
FCKToolbarItems.RegisterItem( 'TableInsertColumnAfter' , new FCKToolbarButton( 'TableInsertColumnAfter' , FCKLang.InsertColumnAfter, null, null, null, true, 64 ) ) ;
FCKToolbarItems.RegisterItem( 'TableDeleteColumns' , new FCKToolbarButton( 'TableDeleteColumns', FCKLang.DeleteColumns, null, null, null, true, 65 ) ) ;
FCKToolbarItems.RegisterItem( 'TableInsertCellAfter' , new FCKToolbarButton( 'TableInsertCellAfter' , FCKLang.InsertCellAfter, null, null, null, true, 58 ) ) ;
FCKToolbarItems.RegisterItem( 'TableDeleteCells' , new FCKToolbarButton( 'TableDeleteCells' , FCKLang.DeleteCells, null, null, null, true, 59 ) ) ;
FCKToolbarItems.RegisterItem( 'TableMergeCells' , new FCKToolbarButton( 'TableMergeCells' , FCKLang.MergeCells, null, null, null, true, 60 ) ) ;
FCKToolbarItems.RegisterItem( 'TableHorizontalSplitCell' , new FCKToolbarButton( 'TableHorizontalSplitCell' , FCKLang.SplitCell, null, null, null, true, 61 ) ) ;
FCKToolbarItems.RegisterItem( 'TableCellProp' , new FCKToolbarButton( 'TableCellProp' , FCKLang.CellProperties, null, null, null, true, 57 ) ) ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Sample custom configuration settings used by the BBCode plugin. It simply
* loads the plugin. All the rest is done by the plugin itself.
*/
// Add the BBCode plugin.
FCKConfig.Plugins.Add( 'bbcode' ) ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is a sample implementation for a custom Data Processor for basic BBCode.
*/
FCK.DataProcessor =
{
/*
* Returns a string representing the HTML format of "data". The returned
* value will be loaded in the editor.
* The HTML must be from <html> to </html>, eventually including
* the DOCTYPE.
* @param {String} data The data to be converted in the
* DataProcessor specific format.
*/
ConvertToHtml : function( data )
{
// Convert < and > to their HTML entities.
data = data.replace( /</g, '<' ) ;
data = data.replace( />/g, '>' ) ;
// Convert line breaks to <br>.
data = data.replace( /(?:\r\n|\n|\r)/g, '<br>' ) ;
// [url]
data = data.replace( /\[url\](.+?)\[\/url]/gi, '<a href="$1">$1</a>' ) ;
data = data.replace( /\[url\=([^\]]+)](.+?)\[\/url]/gi, '<a href="$1">$2</a>' ) ;
// [b]
data = data.replace( /\[b\](.+?)\[\/b]/gi, '<b>$1</b>' ) ;
// [i]
data = data.replace( /\[i\](.+?)\[\/i]/gi, '<i>$1</i>' ) ;
// [u]
data = data.replace( /\[u\](.+?)\[\/u]/gi, '<u>$1</u>' ) ;
return '<html><head><title></title></head><body>' + data + '</body></html>' ;
},
/*
* Converts a DOM (sub-)tree to a string in the data format.
* @param {Object} rootNode The node that contains the DOM tree to be
* converted to the data format.
* @param {Boolean} excludeRoot Indicates that the root node must not
* be included in the conversion, only its children.
* @param {Boolean} format Indicates that the data must be formatted
* for human reading. Not all Data Processors may provide it.
*/
ConvertToDataFormat : function( rootNode, excludeRoot, ignoreIfEmptyParagraph, format )
{
var data = rootNode.innerHTML ;
// Convert <br> to line breaks.
data = data.replace( /<br(?=[ \/>]).*?>/gi, '\r\n') ;
// [url]
data = data.replace( /<a .*?href=(["'])(.+?)\1.*?>(.+?)<\/a>/gi, '[url=$2]$3[/url]') ;
// [b]
data = data.replace( /<(?:b|strong)>/gi, '[b]') ;
data = data.replace( /<\/(?:b|strong)>/gi, '[/b]') ;
// [i]
data = data.replace( /<(?:i|em)>/gi, '[i]') ;
data = data.replace( /<\/(?:i|em)>/gi, '[/i]') ;
// [u]
data = data.replace( /<u>/gi, '[u]') ;
data = data.replace( /<\/u>/gi, '[/u]') ;
// Remove remaining tags.
data = data.replace( /<[^>]+>/g, '') ;
return data ;
},
/*
* Makes any necessary changes to a piece of HTML for insertion in the
* editor selection position.
* @param {String} html The HTML to be fixed.
*/
FixHtml : function( html )
{
return html ;
}
} ;
// This Data Processor doesn't support <p>, so let's use <br>.
FCKConfig.EnterMode = 'br' ;
// To avoid pasting invalid markup (which is discarded in any case), let's
// force pasting to plain text.
FCKConfig.ForcePasteAsPlainText = true ;
// Rename the "Source" buttom to "BBCode".
FCKToolbarItems.RegisterItem( 'Source', new FCKToolbarButton( 'Source', 'BBCode', null, FCK_TOOLBARITEM_ICONTEXT, true, true, 1 ) ) ;
// Let's enforce the toolbar to the limits of this Data Processor. A custom
// toolbar set may be defined in the configuration file with more or less entries.
FCKConfig.ToolbarSets["Default"] = [
['Source'],
['Bold','Italic','Underline','-','Link'],
['About']
] ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*/
(function()
{
// IE6 doens't handle absolute positioning properly (it is always in quirks
// mode). This function fixes the sizes and positions of many elements that
// compose the skin (this is skin specific).
var fixSizes = window.DoResizeFixes = function()
{
var fckDlg = window.document.body ;
for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ )
{
var child = fckDlg.childNodes[i] ;
switch ( child.className )
{
case 'contents' :
child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 ) ; // -left -right
child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 ) ; // -bottom -top
break ;
case 'blocker' :
case 'cover' :
child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 + 4 ) ; // -left -right + 4
child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 + 4 ) ; // -bottom -top + 4
break ;
case 'tr' :
child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ;
break ;
case 'tc' :
child.style.width = Math.max( 0, fckDlg.clientWidth - 16 - 16 ) ;
break ;
case 'ml' :
child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ;
break ;
case 'mr' :
child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ;
child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ;
break ;
case 'bl' :
child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
break ;
case 'br' :
child.style.left = Math.max( 0, fckDlg.clientWidth - 30 ) ;
child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
break ;
case 'bc' :
child.style.width = Math.max( 0, fckDlg.clientWidth - 30 - 30 ) ;
child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
break ;
}
}
}
var closeButtonOver = function()
{
this.style.backgroundPosition = '-16px -687px' ;
} ;
var closeButtonOut = function()
{
this.style.backgroundPosition = '-16px -651px' ;
} ;
var fixCloseButton = function()
{
var closeButton = document.getElementById ( 'closeButton' ) ;
closeButton.onmouseover = closeButtonOver ;
closeButton.onmouseout = closeButtonOut ;
}
var onLoad = function()
{
fixSizes() ;
fixCloseButton() ;
window.attachEvent( 'onresize', fixSizes ) ;
window.detachEvent( 'onload', onLoad ) ;
}
window.attachEvent( 'onload', onLoad ) ;
})() ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*/
(function()
{
// IE6 doens't handle absolute positioning properly (it is always in quirks
// mode). This function fixes the sizes and positions of many elements that
// compose the skin (this is skin specific).
var fixSizes = window.DoResizeFixes = function()
{
var fckDlg = window.document.body ;
for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ )
{
var child = fckDlg.childNodes[i] ;
switch ( child.className )
{
case 'contents' :
child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 ) ; // -left -right
child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 ) ; // -bottom -top
break ;
case 'blocker' :
case 'cover' :
child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 + 4 ) ; // -left -right + 4
child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 + 4 ) ; // -bottom -top + 4
break ;
case 'tr' :
child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ;
break ;
case 'tc' :
child.style.width = Math.max( 0, fckDlg.clientWidth - 16 - 16 ) ;
break ;
case 'ml' :
child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ;
break ;
case 'mr' :
child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ;
child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ;
break ;
case 'bl' :
child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
break ;
case 'br' :
child.style.left = Math.max( 0, fckDlg.clientWidth - 30 ) ;
child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
break ;
case 'bc' :
child.style.width = Math.max( 0, fckDlg.clientWidth - 30 - 30 ) ;
child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
break ;
}
}
}
var closeButtonOver = function()
{
this.style.backgroundPosition = '-16px -687px' ;
} ;
var closeButtonOut = function()
{
this.style.backgroundPosition = '-16px -651px' ;
} ;
var fixCloseButton = function()
{
var closeButton = document.getElementById ( 'closeButton' ) ;
closeButton.onmouseover = closeButtonOver ;
closeButton.onmouseout = closeButtonOut ;
}
var onLoad = function()
{
fixSizes() ;
fixCloseButton() ;
window.attachEvent( 'onresize', fixSizes ) ;
window.detachEvent( 'onload', onLoad ) ;
}
window.attachEvent( 'onload', onLoad ) ;
})() ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*/
(function()
{
// IE6 doens't handle absolute positioning properly (it is always in quirks
// mode). This function fixes the sizes and positions of many elements that
// compose the skin (this is skin specific).
var fixSizes = window.DoResizeFixes = function()
{
var fckDlg = window.document.body ;
for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ )
{
var child = fckDlg.childNodes[i] ;
switch ( child.className )
{
case 'contents' :
child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 ) ; // -left -right
child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 ) ; // -bottom -top
break ;
case 'blocker' :
case 'cover' :
child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 + 4 ) ; // -left -right + 4
child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 + 4 ) ; // -bottom -top + 4
break ;
case 'tr' :
child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ;
break ;
case 'tc' :
child.style.width = Math.max( 0, fckDlg.clientWidth - 16 - 16 ) ;
break ;
case 'ml' :
child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ;
break ;
case 'mr' :
child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ;
child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ;
break ;
case 'bl' :
child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
break ;
case 'br' :
child.style.left = Math.max( 0, fckDlg.clientWidth - 30 ) ;
child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
break ;
case 'bc' :
child.style.width = Math.max( 0, fckDlg.clientWidth - 30 - 30 ) ;
child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
break ;
}
}
}
var closeButtonOver = function()
{
this.style.backgroundPosition = '-16px -687px' ;
} ;
var closeButtonOut = function()
{
this.style.backgroundPosition = '-16px -651px' ;
} ;
var fixCloseButton = function()
{
var closeButton = document.getElementById ( 'closeButton' ) ;
closeButton.onmouseover = closeButtonOver ;
closeButton.onmouseout = closeButtonOut ;
}
var onLoad = function()
{
fixSizes() ;
fixCloseButton() ;
window.attachEvent( 'onresize', fixSizes ) ;
window.detachEvent( 'onload', onLoad ) ;
}
window.attachEvent( 'onload', onLoad ) ;
})() ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Compatibility code for Adobe AIR.
*/
if ( FCKBrowserInfo.IsAIR )
{
var FCKAdobeAIR = (function()
{
/*
* ### Private functions.
*/
var getDocumentHead = function( doc )
{
var head ;
var heads = doc.getElementsByTagName( 'head' ) ;
if( heads && heads[0] )
head = heads[0] ;
else
{
head = doc.createElement( 'head' ) ;
doc.documentElement.insertBefore( head, doc.documentElement.firstChild ) ;
}
return head ;
} ;
/*
* ### Public interface.
*/
return {
FCKeditorAPI_Evaluate : function( parentWindow, script )
{
// TODO : This one doesn't work always. The parent window will
// point to an anonymous function in this window. If this
// window is destroyied the parent window will be pointing to
// an invalid reference.
// Evaluate the script in this window.
eval( script ) ;
// Point the FCKeditorAPI property of the parent window to the
// local reference.
parentWindow.FCKeditorAPI = window.FCKeditorAPI ;
},
EditingArea_Start : function( doc, html )
{
// Get the HTML for the <head>.
var headInnerHtml = html.match( /<head>([\s\S]*)<\/head>/i )[1] ;
if ( headInnerHtml && headInnerHtml.length > 0 )
{
// Inject the <head> HTML inside a <div>.
// Do that before getDocumentHead because WebKit moves
// <link css> elements to the <head> at this point.
var div = doc.createElement( 'div' ) ;
div.innerHTML = headInnerHtml ;
// Move the <div> nodes to <head>.
FCKDomTools.MoveChildren( div, getDocumentHead( doc ) ) ;
}
doc.body.innerHTML = html.match( /<body>([\s\S]*)<\/body>/i )[1] ;
//prevent clicking on hyperlinks and navigating away
doc.addEventListener('click', function( ev )
{
ev.preventDefault() ;
ev.stopPropagation() ;
}, true ) ;
},
Panel_Contructor : function( doc, baseLocation )
{
var head = getDocumentHead( doc ) ;
// Set the <base> href.
head.appendChild( doc.createElement('base') ).href = baseLocation ;
doc.body.style.margin = '0px' ;
doc.body.style.padding = '0px' ;
},
ToolbarSet_GetOutElement : function( win, outMatch )
{
var toolbarTarget = win.parent ;
var targetWindowParts = outMatch[1].split( '.' ) ;
while ( targetWindowParts.length > 0 )
{
var part = targetWindowParts.shift() ;
if ( part.length > 0 )
toolbarTarget = toolbarTarget[ part ] ;
}
toolbarTarget = toolbarTarget.document.getElementById( outMatch[2] ) ;
},
ToolbarSet_InitOutFrame : function( doc )
{
var head = getDocumentHead( doc ) ;
head.appendChild( doc.createElement('base') ).href = window.document.location ;
var targetWindow = doc.defaultView;
targetWindow.adjust = function()
{
targetWindow.frameElement.height = doc.body.scrollHeight;
} ;
targetWindow.onresize = targetWindow.adjust ;
targetWindow.setTimeout( targetWindow.adjust, 0 ) ;
doc.body.style.overflow = 'hidden';
doc.body.innerHTML = document.getElementById( 'xToolbarSpace' ).innerHTML ;
}
} ;
})();
/*
* ### Overrides
*/
( function()
{
// Save references for override reuse.
var _Original_FCKPanel_Window_OnFocus = FCKPanel_Window_OnFocus ;
var _Original_FCKPanel_Window_OnBlur = FCKPanel_Window_OnBlur ;
var _Original_FCK_StartEditor = FCK.StartEditor ;
FCKPanel_Window_OnFocus = function( e, panel )
{
// Call the original implementation.
_Original_FCKPanel_Window_OnFocus.call( this, e, panel ) ;
if ( panel._focusTimer )
clearTimeout( panel._focusTimer ) ;
}
FCKPanel_Window_OnBlur = function( e, panel )
{
// Delay the execution of the original function.
panel._focusTimer = FCKTools.SetTimeout( _Original_FCKPanel_Window_OnBlur, 100, this, [ e, panel ] ) ;
}
FCK.StartEditor = function()
{
// Force pointing to the CSS files instead of using the inline CSS cached styles.
window.FCK_InternalCSS = FCKConfig.BasePath + 'css/fck_internal.css' ;
window.FCK_ShowTableBordersCSS = FCKConfig.BasePath + 'css/fck_showtableborders_gecko.css' ;
_Original_FCK_StartEditor.apply( this, arguments ) ;
}
})();
}
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Contains the DTD mapping for XHTML 1.0 Transitional.
* This file was automatically generated from the file: xhtml10-transitional.dtd
*/
FCK.DTD = (function()
{
var X = FCKTools.Merge ;
var A,L,J,M,N,O,D,H,P,K,Q,F,G,C,B,E,I ;
A = {isindex:1, fieldset:1} ;
B = {input:1, button:1, select:1, textarea:1, label:1} ;
C = X({a:1}, B) ;
D = X({iframe:1}, C) ;
E = {hr:1, ul:1, menu:1, div:1, blockquote:1, noscript:1, table:1, center:1, address:1, dir:1, pre:1, h5:1, dl:1, h4:1, noframes:1, h6:1, ol:1, h1:1, h3:1, h2:1} ;
F = {ins:1, del:1, script:1} ;
G = X({b:1, acronym:1, bdo:1, 'var':1, '#':1, abbr:1, code:1, br:1, i:1, cite:1, kbd:1, u:1, strike:1, s:1, tt:1, strong:1, q:1, samp:1, em:1, dfn:1, span:1}, F) ;
H = X({sub:1, img:1, object:1, sup:1, basefont:1, map:1, applet:1, font:1, big:1, small:1}, G) ;
I = X({p:1}, H) ;
J = X({iframe:1}, H, B) ;
K = {img:1, noscript:1, br:1, kbd:1, center:1, button:1, basefont:1, h5:1, h4:1, samp:1, h6:1, ol:1, h1:1, h3:1, h2:1, form:1, font:1, '#':1, select:1, menu:1, ins:1, abbr:1, label:1, code:1, table:1, script:1, cite:1, input:1, iframe:1, strong:1, textarea:1, noframes:1, big:1, small:1, span:1, hr:1, sub:1, bdo:1, 'var':1, div:1, object:1, sup:1, strike:1, dir:1, map:1, dl:1, applet:1, del:1, isindex:1, fieldset:1, ul:1, b:1, acronym:1, a:1, blockquote:1, i:1, u:1, s:1, tt:1, address:1, q:1, pre:1, p:1, em:1, dfn:1} ;
L = X({a:1}, J) ;
M = {tr:1} ;
N = {'#':1} ;
O = X({param:1}, K) ;
P = X({form:1}, A, D, E, I) ;
Q = {li:1} ;
return {
col: {},
tr: {td:1, th:1},
img: {},
colgroup: {col:1},
noscript: P,
td: P,
br: {},
th: P,
center: P,
kbd: L,
button: X(I, E),
basefont: {},
h5: L,
h4: L,
samp: L,
h6: L,
ol: Q,
h1: L,
h3: L,
option: N,
h2: L,
form: X(A, D, E, I),
select: {optgroup:1, option:1},
font: J, // Changed from L to J (see (1))
ins: P,
menu: Q,
abbr: L,
label: L,
table: {thead:1, col:1, tbody:1, tr:1, colgroup:1, caption:1, tfoot:1},
code: L,
script: N,
tfoot: M,
cite: L,
li: P,
input: {},
iframe: P,
strong: J, // Changed from L to J (see (1))
textarea: N,
noframes: P,
big: J, // Changed from L to J (see (1))
small: J, // Changed from L to J (see (1))
span: J, // Changed from L to J (see (1))
hr: {},
dt: L,
sub: J, // Changed from L to J (see (1))
optgroup: {option:1},
param: {},
bdo: L,
'var': J, // Changed from L to J (see (1))
div: P,
object: O,
sup: J, // Changed from L to J (see (1))
dd: P,
strike: J, // Changed from L to J (see (1))
area: {},
dir: Q,
map: X({area:1, form:1, p:1}, A, F, E),
applet: O,
dl: {dt:1, dd:1},
del: P,
isindex: {},
fieldset: X({legend:1}, K),
thead: M,
ul: Q,
acronym: L,
b: J, // Changed from L to J (see (1))
a: J,
blockquote: P,
caption: L,
i: J, // Changed from L to J (see (1))
u: J, // Changed from L to J (see (1))
tbody: M,
s: L,
address: X(D, I),
tt: J, // Changed from L to J (see (1))
legend: L,
q: L,
pre: X(G, C),
p: L,
em: J, // Changed from L to J (see (1))
dfn: L
} ;
})() ;
/*
Notes:
(1) According to the DTD, many elements, like <b> accept <a> elements
inside of them. But, to produce better output results, we have manually
changed the map to avoid breaking the links on pieces, having
"<b>this is a </b><a><b>link</b> test</a>", instead of
"<b>this is a <a>link</a></b><a> test</a>".
*/
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Contains the DTD mapping for XHTML 1.0 Strict.
* This file was automatically generated from the file: xhtml10-strict.dtd
*/
FCK.DTD = (function()
{
var X = FCKTools.Merge ;
var H,I,J,K,C,L,M,A,B,D,E,G,N,F ;
A = {ins:1, del:1, script:1} ;
B = {hr:1, ul:1, div:1, blockquote:1, noscript:1, table:1, address:1, pre:1, p:1, h5:1, dl:1, h4:1, ol:1, h6:1, h1:1, h3:1, h2:1} ;
C = X({fieldset:1}, B) ;
D = X({sub:1, bdo:1, 'var':1, sup:1, br:1, kbd:1, map:1, samp:1, b:1, acronym:1, '#':1, abbr:1, code:1, i:1, cite:1, tt:1, strong:1, q:1, em:1, big:1, small:1, span:1, dfn:1}, A) ;
E = X({img:1, object:1}, D) ;
F = {input:1, button:1, textarea:1, select:1, label:1} ;
G = X({a:1}, F) ;
H = {img:1, noscript:1, br:1, kbd:1, button:1, h5:1, h4:1, samp:1, h6:1, ol:1, h1:1, h3:1, h2:1, form:1, select:1, '#':1, ins:1, abbr:1, label:1, code:1, table:1, script:1, cite:1, input:1, strong:1, textarea:1, big:1, small:1, span:1, hr:1, sub:1, bdo:1, 'var':1, div:1, object:1, sup:1, map:1, dl:1, del:1, fieldset:1, ul:1, b:1, acronym:1, a:1, blockquote:1, i:1, address:1, tt:1, q:1, pre:1, p:1, em:1, dfn:1} ;
I = X({form:1, fieldset:1}, B, E, G) ;
J = {tr:1} ;
K = {'#':1} ;
L = X(E, G) ;
M = {li:1} ;
N = X({form:1}, A, C) ;
return {
col: {},
tr: {td:1, th:1},
img: {},
colgroup: {col:1},
noscript: N,
td: I,
br: {},
th: I,
kbd: L,
button: X(B, E),
h5: L,
h4: L,
samp: L,
h6: L,
ol: M,
h1: L,
h3: L,
option: K,
h2: L,
form: X(A, C),
select: {optgroup:1, option:1},
ins: I,
abbr: L,
label: L,
code: L,
table: {thead:1, col:1, tbody:1, tr:1, colgroup:1, caption:1, tfoot:1},
script: K,
tfoot: J,
cite: L,
li: I,
input: {},
strong: L,
textarea: K,
big: L,
small: L,
span: L,
dt: L,
hr: {},
sub: L,
optgroup: {option:1},
bdo: L,
param: {},
'var': L,
div: I,
object: X({param:1}, H),
sup: L,
dd: I,
area: {},
map: X({form:1, area:1}, A, C),
dl: {dt:1, dd:1},
del: I,
fieldset: X({legend:1}, H),
thead: J,
ul: M,
acronym: L,
b: L,
a: X({img:1, object:1}, D, F),
blockquote: N,
caption: L,
i: L,
tbody: J,
address: L,
tt: L,
legend: L,
q: L,
pre: X({a:1}, D, F),
p: L,
em: L,
dfn: L
} ;
})() ;
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Chinese Traditional language file.
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "隱藏面板",
ToolbarExpand : "顯示面板",
// Toolbar Items and Context Menu
Save : "儲存",
NewPage : "開新檔案",
Preview : "預覽",
Cut : "剪下",
Copy : "複製",
Paste : "貼上",
PasteText : "貼為純文字格式",
PasteWord : "自 Word 貼上",
Print : "列印",
SelectAll : "全選",
RemoveFormat : "清除格式",
InsertLinkLbl : "超連結",
InsertLink : "插入/編輯超連結",
RemoveLink : "移除超連結",
VisitLink : "開啟超連結",
Anchor : "插入/編輯錨點",
AnchorDelete : "移除錨點",
InsertImageLbl : "影像",
InsertImage : "插入/編輯影像",
InsertFlashLbl : "Flash",
InsertFlash : "插入/編輯 Flash",
InsertTableLbl : "表格",
InsertTable : "插入/編輯表格",
InsertLineLbl : "水平線",
InsertLine : "插入水平線",
InsertSpecialCharLbl: "特殊符號",
InsertSpecialChar : "插入特殊符號",
InsertSmileyLbl : "表情符號",
InsertSmiley : "插入表情符號",
About : "關於 FCKeditor",
Bold : "粗體",
Italic : "斜體",
Underline : "底線",
StrikeThrough : "刪除線",
Subscript : "下標",
Superscript : "上標",
LeftJustify : "靠左對齊",
CenterJustify : "置中",
RightJustify : "靠右對齊",
BlockJustify : "左右對齊",
DecreaseIndent : "減少縮排",
IncreaseIndent : "增加縮排",
Blockquote : "引用文字",
CreateDiv : "新增 Div 標籤",
EditDiv : "變更 Div 標籤",
DeleteDiv : "移除 Div 標籤",
Undo : "復原",
Redo : "重複",
NumberedListLbl : "編號清單",
NumberedList : "插入/移除編號清單",
BulletedListLbl : "項目清單",
BulletedList : "插入/移除項目清單",
ShowTableBorders : "顯示表格邊框",
ShowDetails : "顯示詳細資料",
Style : "樣式",
FontFormat : "格式",
Font : "字體",
FontSize : "大小",
TextColor : "文字顏色",
BGColor : "背景顏色",
Source : "原始碼",
Find : "尋找",
Replace : "取代",
SpellCheck : "拼字檢查",
UniversalKeyboard : "萬國鍵盤",
PageBreakLbl : "分頁符號",
PageBreak : "插入分頁符號",
Form : "表單",
Checkbox : "核取方塊",
RadioButton : "選項按鈕",
TextField : "文字方塊",
Textarea : "文字區域",
HiddenField : "隱藏欄位",
Button : "按鈕",
SelectionField : "清單/選單",
ImageButton : "影像按鈕",
FitWindow : "編輯器最大化",
ShowBlocks : "顯示區塊",
// Context Menu
EditLink : "編輯超連結",
CellCM : "儲存格",
RowCM : "列",
ColumnCM : "欄",
InsertRowAfter : "向下插入列",
InsertRowBefore : "向上插入列",
DeleteRows : "刪除列",
InsertColumnAfter : "向右插入欄",
InsertColumnBefore : "向左插入欄",
DeleteColumns : "刪除欄",
InsertCellAfter : "向右插入儲存格",
InsertCellBefore : "向左插入儲存格",
DeleteCells : "刪除儲存格",
MergeCells : "合併儲存格",
MergeRight : "向右合併儲存格",
MergeDown : "向下合併儲存格",
HorizontalSplitCell : "橫向分割儲存格",
VerticalSplitCell : "縱向分割儲存格",
TableDelete : "刪除表格",
CellProperties : "儲存格屬性",
TableProperties : "表格屬性",
ImageProperties : "影像屬性",
FlashProperties : "Flash 屬性",
AnchorProp : "錨點屬性",
ButtonProp : "按鈕屬性",
CheckboxProp : "核取方塊屬性",
HiddenFieldProp : "隱藏欄位屬性",
RadioButtonProp : "選項按鈕屬性",
ImageButtonProp : "影像按鈕屬性",
TextFieldProp : "文字方塊屬性",
SelectionFieldProp : "清單/選單屬性",
TextareaProp : "文字區域屬性",
FormProp : "表單屬性",
FontFormats : "一般;已格式化;位址;標題 1;標題 2;標題 3;標題 4;標題 5;標題 6;一般 (DIV)",
// Alerts and Messages
ProcessingXHTML : "處理 XHTML 中,請稍候…",
Done : "完成",
PasteWordConfirm : "您想貼上的文字似乎是自 Word 複製而來,請問您是否要先清除 Word 的格式後再行貼上?",
NotCompatiblePaste : "此指令僅在 Internet Explorer 5.5 或以上的版本有效。請問您是否同意不清除格式即貼上?",
UnknownToolbarItem : "未知工具列項目 \"%1\"",
UnknownCommand : "未知指令名稱 \"%1\"",
NotImplemented : "尚未安裝此指令",
UnknownToolbarSet : "工具列設定 \"%1\" 不存在",
NoActiveX : "瀏覽器的安全性設定限制了本編輯器的某些功能。您必須啟用安全性設定中的「執行ActiveX控制項與外掛程式」項目,否則本編輯器將會出現錯誤並缺少某些功能",
BrowseServerBlocked : "無法開啟資源瀏覽器,請確定所有快顯視窗封鎖程式是否關閉",
DialogBlocked : "無法開啟對話視窗,請確定所有快顯視窗封鎖程式是否關閉",
VisitLinkBlocked : "無法開啟新視窗,請確定所有快顯視窗封鎖程式是否關閉",
// Dialogs
DlgBtnOK : "確定",
DlgBtnCancel : "取消",
DlgBtnClose : "關閉",
DlgBtnBrowseServer : "瀏覽伺服器端",
DlgAdvancedTag : "進階",
DlgOpOther : "<其他>",
DlgInfoTab : "資訊",
DlgAlertUrl : "請插入 URL",
// General Dialogs Labels
DlgGenNotSet : "<尚未設定>",
DlgGenId : "ID",
DlgGenLangDir : "語言方向",
DlgGenLangDirLtr : "由左而右 (LTR)",
DlgGenLangDirRtl : "由右而左 (RTL)",
DlgGenLangCode : "語言代碼",
DlgGenAccessKey : "存取鍵",
DlgGenName : "名稱",
DlgGenTabIndex : "定位順序",
DlgGenLongDescr : "詳細 URL",
DlgGenClass : "樣式表類別",
DlgGenTitle : "標題",
DlgGenContType : "內容類型",
DlgGenLinkCharset : "連結資源之編碼",
DlgGenStyle : "樣式",
// Image Dialog
DlgImgTitle : "影像屬性",
DlgImgInfoTab : "影像資訊",
DlgImgBtnUpload : "上傳至伺服器",
DlgImgURL : "URL",
DlgImgUpload : "上傳",
DlgImgAlt : "替代文字",
DlgImgWidth : "寬度",
DlgImgHeight : "高度",
DlgImgLockRatio : "等比例",
DlgBtnResetSize : "重設為原大小",
DlgImgBorder : "邊框",
DlgImgHSpace : "水平距離",
DlgImgVSpace : "垂直距離",
DlgImgAlign : "對齊",
DlgImgAlignLeft : "靠左對齊",
DlgImgAlignAbsBottom: "絕對下方",
DlgImgAlignAbsMiddle: "絕對中間",
DlgImgAlignBaseline : "基準線",
DlgImgAlignBottom : "靠下對齊",
DlgImgAlignMiddle : "置中對齊",
DlgImgAlignRight : "靠右對齊",
DlgImgAlignTextTop : "文字上方",
DlgImgAlignTop : "靠上對齊",
DlgImgPreview : "預覽",
DlgImgAlertUrl : "請輸入影像 URL",
DlgImgLinkTab : "超連結",
// Flash Dialog
DlgFlashTitle : "Flash 屬性",
DlgFlashChkPlay : "自動播放",
DlgFlashChkLoop : "重複",
DlgFlashChkMenu : "開啟選單",
DlgFlashScale : "縮放",
DlgFlashScaleAll : "全部顯示",
DlgFlashScaleNoBorder : "無邊框",
DlgFlashScaleFit : "精確符合",
// Link Dialog
DlgLnkWindowTitle : "超連結",
DlgLnkInfoTab : "超連結資訊",
DlgLnkTargetTab : "目標",
DlgLnkType : "超連接類型",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "本頁錨點",
DlgLnkTypeEMail : "電子郵件",
DlgLnkProto : "通訊協定",
DlgLnkProtoOther : "<其他>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "請選擇錨點",
DlgLnkAnchorByName : "依錨點名稱",
DlgLnkAnchorById : "依元件 ID",
DlgLnkNoAnchors : "(本文件尚無可用之錨點)",
DlgLnkEMail : "電子郵件",
DlgLnkEMailSubject : "郵件主旨",
DlgLnkEMailBody : "郵件內容",
DlgLnkUpload : "上傳",
DlgLnkBtnUpload : "傳送至伺服器",
DlgLnkTarget : "目標",
DlgLnkTargetFrame : "<框架>",
DlgLnkTargetPopup : "<快顯視窗>",
DlgLnkTargetBlank : "新視窗 (_blank)",
DlgLnkTargetParent : "父視窗 (_parent)",
DlgLnkTargetSelf : "本視窗 (_self)",
DlgLnkTargetTop : "最上層視窗 (_top)",
DlgLnkTargetFrameName : "目標框架名稱",
DlgLnkPopWinName : "快顯視窗名稱",
DlgLnkPopWinFeat : "快顯視窗屬性",
DlgLnkPopResize : "可調整大小",
DlgLnkPopLocation : "網址列",
DlgLnkPopMenu : "選單列",
DlgLnkPopScroll : "捲軸",
DlgLnkPopStatus : "狀態列",
DlgLnkPopToolbar : "工具列",
DlgLnkPopFullScrn : "全螢幕 (IE)",
DlgLnkPopDependent : "從屬 (NS)",
DlgLnkPopWidth : "寬",
DlgLnkPopHeight : "高",
DlgLnkPopLeft : "左",
DlgLnkPopTop : "右",
DlnLnkMsgNoUrl : "請輸入欲連結的 URL",
DlnLnkMsgNoEMail : "請輸入電子郵件位址",
DlnLnkMsgNoAnchor : "請選擇錨點",
DlnLnkMsgInvPopName : "快顯名稱必須以「英文字母」為開頭,且不得含有空白",
// Color Dialog
DlgColorTitle : "請選擇顏色",
DlgColorBtnClear : "清除",
DlgColorHighlight : "預覽",
DlgColorSelected : "選擇",
// Smiley Dialog
DlgSmileyTitle : "插入表情符號",
// Special Character Dialog
DlgSpecialCharTitle : "請選擇特殊符號",
// Table Dialog
DlgTableTitle : "表格屬性",
DlgTableRows : "列數",
DlgTableColumns : "欄數",
DlgTableBorder : "邊框",
DlgTableAlign : "對齊",
DlgTableAlignNotSet : "<未設定>",
DlgTableAlignLeft : "靠左對齊",
DlgTableAlignCenter : "置中",
DlgTableAlignRight : "靠右對齊",
DlgTableWidth : "寬度",
DlgTableWidthPx : "像素",
DlgTableWidthPc : "百分比",
DlgTableHeight : "高度",
DlgTableCellSpace : "間距",
DlgTableCellPad : "內距",
DlgTableCaption : "標題",
DlgTableSummary : "摘要",
DlgTableHeaders : "Headers", //MISSING
DlgTableHeadersNone : "None", //MISSING
DlgTableHeadersColumn : "First column", //MISSING
DlgTableHeadersRow : "First Row", //MISSING
DlgTableHeadersBoth : "Both", //MISSING
// Table Cell Dialog
DlgCellTitle : "儲存格屬性",
DlgCellWidth : "寬度",
DlgCellWidthPx : "像素",
DlgCellWidthPc : "百分比",
DlgCellHeight : "高度",
DlgCellWordWrap : "自動換行",
DlgCellWordWrapNotSet : "<尚未設定>",
DlgCellWordWrapYes : "是",
DlgCellWordWrapNo : "否",
DlgCellHorAlign : "水平對齊",
DlgCellHorAlignNotSet : "<尚未設定>",
DlgCellHorAlignLeft : "靠左對齊",
DlgCellHorAlignCenter : "置中",
DlgCellHorAlignRight: "靠右對齊",
DlgCellVerAlign : "垂直對齊",
DlgCellVerAlignNotSet : "<尚未設定>",
DlgCellVerAlignTop : "靠上對齊",
DlgCellVerAlignMiddle : "置中",
DlgCellVerAlignBottom : "靠下對齊",
DlgCellVerAlignBaseline : "基準線",
DlgCellType : "儲存格類型",
DlgCellTypeData : "資料",
DlgCellTypeHeader : "標題",
DlgCellRowSpan : "合併列數",
DlgCellCollSpan : "合併欄数",
DlgCellBackColor : "背景顏色",
DlgCellBorderColor : "邊框顏色",
DlgCellBtnSelect : "請選擇…",
// Find and Replace Dialog
DlgFindAndReplaceTitle : "尋找與取代",
// Find Dialog
DlgFindTitle : "尋找",
DlgFindFindBtn : "尋找",
DlgFindNotFoundMsg : "未找到指定的文字。",
// Replace Dialog
DlgReplaceTitle : "取代",
DlgReplaceFindLbl : "尋找:",
DlgReplaceReplaceLbl : "取代:",
DlgReplaceCaseChk : "大小寫須相符",
DlgReplaceReplaceBtn : "取代",
DlgReplaceReplAllBtn : "全部取代",
DlgReplaceWordChk : "全字相符",
// Paste Operations / Dialog
PasteErrorCut : "瀏覽器的安全性設定不允許編輯器自動執行剪下動作。請使用快捷鍵 (Ctrl+X) 剪下。",
PasteErrorCopy : "瀏覽器的安全性設定不允許編輯器自動執行複製動作。請使用快捷鍵 (Ctrl+C) 複製。",
PasteAsText : "貼為純文字格式",
PasteFromWord : "自 Word 貼上",
DlgPasteMsg2 : "請使用快捷鍵 (<strong>Ctrl+V</strong>) 貼到下方區域中並按下 <strong>確定</strong>",
DlgPasteSec : "因為瀏覽器的安全性設定,本編輯器無法直接存取您的剪貼簿資料,請您自行在本視窗進行貼上動作。",
DlgPasteIgnoreFont : "移除字型設定",
DlgPasteRemoveStyles : "移除樣式設定",
// Color Picker
ColorAutomatic : "自動",
ColorMoreColors : "更多顏色…",
// Document Properties
DocProps : "文件屬性",
// Anchor Dialog
DlgAnchorTitle : "命名錨點",
DlgAnchorName : "錨點名稱",
DlgAnchorErrorName : "請輸入錨點名稱",
// Speller Pages Dialog
DlgSpellNotInDic : "不在字典中",
DlgSpellChangeTo : "更改為",
DlgSpellBtnIgnore : "忽略",
DlgSpellBtnIgnoreAll : "全部忽略",
DlgSpellBtnReplace : "取代",
DlgSpellBtnReplaceAll : "全部取代",
DlgSpellBtnUndo : "復原",
DlgSpellNoSuggestions : "- 無建議值 -",
DlgSpellProgress : "進行拼字檢查中…",
DlgSpellNoMispell : "拼字檢查完成:未發現拼字錯誤",
DlgSpellNoChanges : "拼字檢查完成:未更改任何單字",
DlgSpellOneChange : "拼字檢查完成:更改了 1 個單字",
DlgSpellManyChanges : "拼字檢查完成:更改了 %1 個單字",
IeSpellDownload : "尚未安裝拼字檢查元件。您是否想要現在下載?",
// Button Dialog
DlgButtonText : "顯示文字 (值)",
DlgButtonType : "類型",
DlgButtonTypeBtn : "按鈕 (Button)",
DlgButtonTypeSbm : "送出 (Submit)",
DlgButtonTypeRst : "重設 (Reset)",
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "名稱",
DlgCheckboxValue : "選取值",
DlgCheckboxSelected : "已選取",
// Form Dialog
DlgFormName : "名稱",
DlgFormAction : "動作",
DlgFormMethod : "方法",
// Select Field Dialog
DlgSelectName : "名稱",
DlgSelectValue : "選取值",
DlgSelectSize : "大小",
DlgSelectLines : "行",
DlgSelectChkMulti : "可多選",
DlgSelectOpAvail : "可用選項",
DlgSelectOpText : "顯示文字",
DlgSelectOpValue : "值",
DlgSelectBtnAdd : "新增",
DlgSelectBtnModify : "修改",
DlgSelectBtnUp : "上移",
DlgSelectBtnDown : "下移",
DlgSelectBtnSetValue : "設為預設值",
DlgSelectBtnDelete : "刪除",
// Textarea Dialog
DlgTextareaName : "名稱",
DlgTextareaCols : "字元寬度",
DlgTextareaRows : "列數",
// Text Field Dialog
DlgTextName : "名稱",
DlgTextValue : "值",
DlgTextCharWidth : "字元寬度",
DlgTextMaxChars : "最多字元數",
DlgTextType : "類型",
DlgTextTypeText : "文字",
DlgTextTypePass : "密碼",
// Hidden Field Dialog
DlgHiddenName : "名稱",
DlgHiddenValue : "值",
// Bulleted List Dialog
BulletedListProp : "項目清單屬性",
NumberedListProp : "編號清單屬性",
DlgLstStart : "起始編號",
DlgLstType : "清單類型",
DlgLstTypeCircle : "圓圈",
DlgLstTypeDisc : "圓點",
DlgLstTypeSquare : "方塊",
DlgLstTypeNumbers : "數字 (1, 2, 3)",
DlgLstTypeLCase : "小寫字母 (a, b, c)",
DlgLstTypeUCase : "大寫字母 (A, B, C)",
DlgLstTypeSRoman : "小寫羅馬數字 (i, ii, iii)",
DlgLstTypeLRoman : "大寫羅馬數字 (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "一般",
DlgDocBackTab : "背景",
DlgDocColorsTab : "顯色與邊界",
DlgDocMetaTab : "Meta 資料",
DlgDocPageTitle : "頁面標題",
DlgDocLangDir : "語言方向",
DlgDocLangDirLTR : "由左而右 (LTR)",
DlgDocLangDirRTL : "由右而左 (RTL)",
DlgDocLangCode : "語言代碼",
DlgDocCharSet : "字元編碼",
DlgDocCharSetCE : "中歐語系",
DlgDocCharSetCT : "正體中文 (Big5)",
DlgDocCharSetCR : "斯拉夫文",
DlgDocCharSetGR : "希臘文",
DlgDocCharSetJP : "日文",
DlgDocCharSetKR : "韓文",
DlgDocCharSetTR : "土耳其文",
DlgDocCharSetUN : "Unicode (UTF-8)",
DlgDocCharSetWE : "西歐語系",
DlgDocCharSetOther : "其他字元編碼",
DlgDocDocType : "文件類型",
DlgDocDocTypeOther : "其他文件類型",
DlgDocIncXHTML : "包含 XHTML 定義",
DlgDocBgColor : "背景顏色",
DlgDocBgImage : "背景影像",
DlgDocBgNoScroll : "浮水印",
DlgDocCText : "文字",
DlgDocCLink : "超連結",
DlgDocCVisited : "已瀏覽過的超連結",
DlgDocCActive : "作用中的超連結",
DlgDocMargins : "頁面邊界",
DlgDocMaTop : "上",
DlgDocMaLeft : "左",
DlgDocMaRight : "右",
DlgDocMaBottom : "下",
DlgDocMeIndex : "文件索引關鍵字 (用半形逗號[,]分隔)",
DlgDocMeDescr : "文件說明",
DlgDocMeAuthor : "作者",
DlgDocMeCopy : "版權所有",
DlgDocPreview : "預覽",
// Templates Dialog
Templates : "樣版",
DlgTemplatesTitle : "內容樣版",
DlgTemplatesSelMsg : "請選擇欲開啟的樣版<br> (原有的內容將會被清除):",
DlgTemplatesLoading : "讀取樣版清單中,請稍候…",
DlgTemplatesNoTpl : "(無樣版)",
DlgTemplatesReplace : "取代原有內容",
// About Dialog
DlgAboutAboutTab : "關於",
DlgAboutBrowserInfoTab : "瀏覽器資訊",
DlgAboutLicenseTab : "許可證",
DlgAboutVersion : "版本",
DlgAboutInfo : "想獲得更多資訊請至 ",
// Div Dialog
DlgDivGeneralTab : "一般",
DlgDivAdvancedTab : "進階",
DlgDivStyle : "樣式",
DlgDivInlineStyle : "CSS 樣式",
ScaytTitle : "SCAYT", //MISSING
ScaytTitleOptions : "Options", //MISSING
ScaytTitleLangs : "Languages", //MISSING
ScaytTitleAbout : "About" //MISSING
};
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Malay language file.
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "Collapse Toolbar",
ToolbarExpand : "Expand Toolbar",
// Toolbar Items and Context Menu
Save : "Simpan",
NewPage : "Helaian Baru",
Preview : "Prebiu",
Cut : "Potong",
Copy : "Salin",
Paste : "Tampal",
PasteText : "Tampal sebagai Text Biasa",
PasteWord : "Tampal dari Word",
Print : "Cetak",
SelectAll : "Pilih Semua",
RemoveFormat : "Buang Format",
InsertLinkLbl : "Sambungan",
InsertLink : "Masukkan/Sunting Sambungan",
RemoveLink : "Buang Sambungan",
VisitLink : "Open Link", //MISSING
Anchor : "Masukkan/Sunting Pautan",
AnchorDelete : "Remove Anchor", //MISSING
InsertImageLbl : "Gambar",
InsertImage : "Masukkan/Sunting Gambar",
InsertFlashLbl : "Flash", //MISSING
InsertFlash : "Insert/Edit Flash", //MISSING
InsertTableLbl : "Jadual",
InsertTable : "Masukkan/Sunting Jadual",
InsertLineLbl : "Garisan",
InsertLine : "Masukkan Garisan Membujur",
InsertSpecialCharLbl: "Huruf Istimewa",
InsertSpecialChar : "Masukkan Huruf Istimewa",
InsertSmileyLbl : "Smiley",
InsertSmiley : "Masukkan Smiley",
About : "Tentang FCKeditor",
Bold : "Bold",
Italic : "Italic",
Underline : "Underline",
StrikeThrough : "Strike Through",
Subscript : "Subscript",
Superscript : "Superscript",
LeftJustify : "Jajaran Kiri",
CenterJustify : "Jajaran Tengah",
RightJustify : "Jajaran Kanan",
BlockJustify : "Jajaran Blok",
DecreaseIndent : "Kurangkan Inden",
IncreaseIndent : "Tambahkan Inden",
Blockquote : "Blockquote", //MISSING
CreateDiv : "Create Div Container", //MISSING
EditDiv : "Edit Div Container", //MISSING
DeleteDiv : "Remove Div Container", //MISSING
Undo : "Batalkan",
Redo : "Ulangkan",
NumberedListLbl : "Senarai bernombor",
NumberedList : "Masukkan/Sunting Senarai bernombor",
BulletedListLbl : "Senarai tidak bernombor",
BulletedList : "Masukkan/Sunting Senarai tidak bernombor",
ShowTableBorders : "Tunjukkan Border Jadual",
ShowDetails : "Tunjukkan Butiran",
Style : "Stail",
FontFormat : "Format",
Font : "Font",
FontSize : "Saiz",
TextColor : "Warna Text",
BGColor : "Warna Latarbelakang",
Source : "Sumber",
Find : "Cari",
Replace : "Ganti",
SpellCheck : "Semak Ejaan",
UniversalKeyboard : "Papan Kekunci Universal",
PageBreakLbl : "Page Break", //MISSING
PageBreak : "Insert Page Break", //MISSING
Form : "Borang",
Checkbox : "Checkbox",
RadioButton : "Butang Radio",
TextField : "Text Field",
Textarea : "Textarea",
HiddenField : "Field Tersembunyi",
Button : "Butang",
SelectionField : "Field Pilihan",
ImageButton : "Butang Bergambar",
FitWindow : "Maximize the editor size", //MISSING
ShowBlocks : "Show Blocks", //MISSING
// Context Menu
EditLink : "Sunting Sambungan",
CellCM : "Cell", //MISSING
RowCM : "Row", //MISSING
ColumnCM : "Column", //MISSING
InsertRowAfter : "Insert Row After", //MISSING
InsertRowBefore : "Insert Row Before", //MISSING
DeleteRows : "Buangkan Baris",
InsertColumnAfter : "Insert Column After", //MISSING
InsertColumnBefore : "Insert Column Before", //MISSING
DeleteColumns : "Buangkan Lajur",
InsertCellAfter : "Insert Cell After", //MISSING
InsertCellBefore : "Insert Cell Before", //MISSING
DeleteCells : "Buangkan Sel-sel",
MergeCells : "Cantumkan Sel-sel",
MergeRight : "Merge Right", //MISSING
MergeDown : "Merge Down", //MISSING
HorizontalSplitCell : "Split Cell Horizontally", //MISSING
VerticalSplitCell : "Split Cell Vertically", //MISSING
TableDelete : "Delete Table", //MISSING
CellProperties : "Ciri-ciri Sel",
TableProperties : "Ciri-ciri Jadual",
ImageProperties : "Ciri-ciri Gambar",
FlashProperties : "Flash Properties", //MISSING
AnchorProp : "Ciri-ciri Pautan",
ButtonProp : "Ciri-ciri Butang",
CheckboxProp : "Ciri-ciri Checkbox",
HiddenFieldProp : "Ciri-ciri Field Tersembunyi",
RadioButtonProp : "Ciri-ciri Butang Radio",
ImageButtonProp : "Ciri-ciri Butang Bergambar",
TextFieldProp : "Ciri-ciri Text Field",
SelectionFieldProp : "Ciri-ciri Selection Field",
TextareaProp : "Ciri-ciri Textarea",
FormProp : "Ciri-ciri Borang",
FontFormats : "Normal;Telah Diformat;Alamat;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Perenggan (DIV)",
// Alerts and Messages
ProcessingXHTML : "Memproses XHTML. Sila tunggu...",
Done : "Siap",
PasteWordConfirm : "Text yang anda hendak tampal adalah berasal dari Word. Adakah anda mahu membuang semua format Word sebelum tampal ke dalam text?",
NotCompatiblePaste : "Arahan ini bole dilakukan jika anda mempuunyai Internet Explorer version 5.5 atau yang lebih tinggi. Adakah anda hendak tampal text tanpa membuang format Word?",
UnknownToolbarItem : "Toolbar item tidak diketahui\"%1\"",
UnknownCommand : "Arahan tidak diketahui \"%1\"",
NotImplemented : "Arahan tidak terdapat didalam sistem",
UnknownToolbarSet : "Set toolbar \"%1\" tidak wujud",
NoActiveX : "Your browser's security settings could limit some features of the editor. You must enable the option \"Run ActiveX controls and plug-ins\". You may experience errors and notice missing features.", //MISSING
BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", //MISSING
DialogBlocked : "It was not possible to open the dialog window. Make sure all popup blockers are disabled.", //MISSING
VisitLinkBlocked : "It was not possible to open a new window. Make sure all popup blockers are disabled.", //MISSING
// Dialogs
DlgBtnOK : "OK",
DlgBtnCancel : "Batal",
DlgBtnClose : "Tutup",
DlgBtnBrowseServer : "Browse Server",
DlgAdvancedTag : "Advanced",
DlgOpOther : "<Lain-lain>",
DlgInfoTab : "Info", //MISSING
DlgAlertUrl : "Please insert the URL", //MISSING
// General Dialogs Labels
DlgGenNotSet : "<tidak di set>",
DlgGenId : "Id",
DlgGenLangDir : "Arah Tulisan",
DlgGenLangDirLtr : "Kiri ke Kanan (LTR)",
DlgGenLangDirRtl : "Kanan ke Kiri (RTL)",
DlgGenLangCode : "Kod Bahasa",
DlgGenAccessKey : "Kunci Akses",
DlgGenName : "Nama",
DlgGenTabIndex : "Indeks Tab ",
DlgGenLongDescr : "Butiran Panjang URL",
DlgGenClass : "Kelas-kelas Stylesheet",
DlgGenTitle : "Tajuk Makluman",
DlgGenContType : "Jenis Kandungan Makluman",
DlgGenLinkCharset : "Linked Resource Charset",
DlgGenStyle : "Stail",
// Image Dialog
DlgImgTitle : "Ciri-ciri Imej",
DlgImgInfoTab : "Info Imej",
DlgImgBtnUpload : "Hantar ke Server",
DlgImgURL : "URL",
DlgImgUpload : "Muat Naik",
DlgImgAlt : "Text Alternatif",
DlgImgWidth : "Lebar",
DlgImgHeight : "Tinggi",
DlgImgLockRatio : "Tetapkan Nisbah",
DlgBtnResetSize : "Saiz Set Semula",
DlgImgBorder : "Border",
DlgImgHSpace : "Ruang Melintang",
DlgImgVSpace : "Ruang Menegak",
DlgImgAlign : "Jajaran",
DlgImgAlignLeft : "Kiri",
DlgImgAlignAbsBottom: "Bawah Mutlak",
DlgImgAlignAbsMiddle: "Pertengahan Mutlak",
DlgImgAlignBaseline : "Garis Dasar",
DlgImgAlignBottom : "Bawah",
DlgImgAlignMiddle : "Pertengahan",
DlgImgAlignRight : "Kanan",
DlgImgAlignTextTop : "Atas Text",
DlgImgAlignTop : "Atas",
DlgImgPreview : "Prebiu",
DlgImgAlertUrl : "Sila taip URL untuk fail gambar",
DlgImgLinkTab : "Sambungan",
// Flash Dialog
DlgFlashTitle : "Flash Properties", //MISSING
DlgFlashChkPlay : "Auto Play", //MISSING
DlgFlashChkLoop : "Loop", //MISSING
DlgFlashChkMenu : "Enable Flash Menu", //MISSING
DlgFlashScale : "Scale", //MISSING
DlgFlashScaleAll : "Show all", //MISSING
DlgFlashScaleNoBorder : "No Border", //MISSING
DlgFlashScaleFit : "Exact Fit", //MISSING
// Link Dialog
DlgLnkWindowTitle : "Sambungan",
DlgLnkInfoTab : "Butiran Sambungan",
DlgLnkTargetTab : "Sasaran",
DlgLnkType : "Jenis Sambungan",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "Pautan dalam muka surat ini",
DlgLnkTypeEMail : "E-Mail",
DlgLnkProto : "Protokol",
DlgLnkProtoOther : "<lain-lain>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "Sila pilih pautan",
DlgLnkAnchorByName : "dengan menggunakan nama pautan",
DlgLnkAnchorById : "dengan menggunakan ID elemen",
DlgLnkNoAnchors : "(Tiada pautan terdapat dalam dokumen ini)",
DlgLnkEMail : "Alamat E-Mail",
DlgLnkEMailSubject : "Subjek Mesej",
DlgLnkEMailBody : "Isi Kandungan Mesej",
DlgLnkUpload : "Muat Naik",
DlgLnkBtnUpload : "Hantar ke Server",
DlgLnkTarget : "Sasaran",
DlgLnkTargetFrame : "<bingkai>",
DlgLnkTargetPopup : "<tetingkap popup>",
DlgLnkTargetBlank : "Tetingkap Baru (_blank)",
DlgLnkTargetParent : "Tetingkap Parent (_parent)",
DlgLnkTargetSelf : "Tetingkap yang Sama (_self)",
DlgLnkTargetTop : "Tetingkap yang paling atas (_top)",
DlgLnkTargetFrameName : "Nama Bingkai Sasaran",
DlgLnkPopWinName : "Nama Tetingkap Popup",
DlgLnkPopWinFeat : "Ciri Tetingkap Popup",
DlgLnkPopResize : "Saiz bolehubah",
DlgLnkPopLocation : "Bar Lokasi",
DlgLnkPopMenu : "Bar Menu",
DlgLnkPopScroll : "Bar-bar skrol",
DlgLnkPopStatus : "Bar Status",
DlgLnkPopToolbar : "Toolbar",
DlgLnkPopFullScrn : "Skrin Penuh (IE)",
DlgLnkPopDependent : "Bergantungan (Netscape)",
DlgLnkPopWidth : "Lebar",
DlgLnkPopHeight : "Tinggi",
DlgLnkPopLeft : "Posisi Kiri",
DlgLnkPopTop : "Posisi Atas",
DlnLnkMsgNoUrl : "Sila taip sambungan URL",
DlnLnkMsgNoEMail : "Sila taip alamat e-mail",
DlnLnkMsgNoAnchor : "Sila pilih pautan berkenaaan",
DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING
// Color Dialog
DlgColorTitle : "Pilihan Warna",
DlgColorBtnClear : "Nyahwarna",
DlgColorHighlight : "Terang",
DlgColorSelected : "Dipilih",
// Smiley Dialog
DlgSmileyTitle : "Masukkan Smiley",
// Special Character Dialog
DlgSpecialCharTitle : "Sila pilih huruf istimewa",
// Table Dialog
DlgTableTitle : "Ciri-ciri Jadual",
DlgTableRows : "Barisan",
DlgTableColumns : "Jaluran",
DlgTableBorder : "Saiz Border",
DlgTableAlign : "Penjajaran",
DlgTableAlignNotSet : "<Tidak diset>",
DlgTableAlignLeft : "Kiri",
DlgTableAlignCenter : "Tengah",
DlgTableAlignRight : "Kanan",
DlgTableWidth : "Lebar",
DlgTableWidthPx : "piksel-piksel",
DlgTableWidthPc : "peratus",
DlgTableHeight : "Tinggi",
DlgTableCellSpace : "Ruangan Antara Sel",
DlgTableCellPad : "Tambahan Ruang Sel",
DlgTableCaption : "Keterangan",
DlgTableSummary : "Summary", //MISSING
DlgTableHeaders : "Headers", //MISSING
DlgTableHeadersNone : "None", //MISSING
DlgTableHeadersColumn : "First column", //MISSING
DlgTableHeadersRow : "First Row", //MISSING
DlgTableHeadersBoth : "Both", //MISSING
// Table Cell Dialog
DlgCellTitle : "Ciri-ciri Sel",
DlgCellWidth : "Lebar",
DlgCellWidthPx : "piksel-piksel",
DlgCellWidthPc : "peratus",
DlgCellHeight : "Tinggi",
DlgCellWordWrap : "Mengulung Perkataan",
DlgCellWordWrapNotSet : "<Tidak diset>",
DlgCellWordWrapYes : "Ya",
DlgCellWordWrapNo : "Tidak",
DlgCellHorAlign : "Jajaran Membujur",
DlgCellHorAlignNotSet : "<Tidak diset>",
DlgCellHorAlignLeft : "Kiri",
DlgCellHorAlignCenter : "Tengah",
DlgCellHorAlignRight: "Kanan",
DlgCellVerAlign : "Jajaran Menegak",
DlgCellVerAlignNotSet : "<Tidak diset>",
DlgCellVerAlignTop : "Atas",
DlgCellVerAlignMiddle : "Tengah",
DlgCellVerAlignBottom : "Bawah",
DlgCellVerAlignBaseline : "Garis Dasar",
DlgCellType : "Cell Type", //MISSING
DlgCellTypeData : "Data", //MISSING
DlgCellTypeHeader : "Header", //MISSING
DlgCellRowSpan : "Penggunaan Baris",
DlgCellCollSpan : "Penggunaan Lajur",
DlgCellBackColor : "Warna Latarbelakang",
DlgCellBorderColor : "Warna Border",
DlgCellBtnSelect : "Pilih...",
// Find and Replace Dialog
DlgFindAndReplaceTitle : "Find and Replace", //MISSING
// Find Dialog
DlgFindTitle : "Carian",
DlgFindFindBtn : "Cari",
DlgFindNotFoundMsg : "Text yang dicari tidak dijumpai.",
// Replace Dialog
DlgReplaceTitle : "Gantian",
DlgReplaceFindLbl : "Perkataan yang dicari:",
DlgReplaceReplaceLbl : "Diganti dengan:",
DlgReplaceCaseChk : "Padanan case huruf",
DlgReplaceReplaceBtn : "Ganti",
DlgReplaceReplAllBtn : "Ganti semua",
DlgReplaceWordChk : "Padana Keseluruhan perkataan",
// Paste Operations / Dialog
PasteErrorCut : "Keselamatan perisian browser anda tidak membenarkan operasi suntingan text/imej. Sila gunakan papan kekunci (Ctrl+X).",
PasteErrorCopy : "Keselamatan perisian browser anda tidak membenarkan operasi salinan text/imej. Sila gunakan papan kekunci (Ctrl+C).",
PasteAsText : "Tampal sebagai text biasa",
PasteFromWord : "Tampal dari perisian \"Word\"",
DlgPasteMsg2 : "Please paste inside the following box using the keyboard (<strong>Ctrl+V</strong>) and hit <strong>OK</strong>.", //MISSING
DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING
DlgPasteIgnoreFont : "Ignore Font Face definitions", //MISSING
DlgPasteRemoveStyles : "Remove Styles definitions", //MISSING
// Color Picker
ColorAutomatic : "Otomatik",
ColorMoreColors : "Warna lain-lain...",
// Document Properties
DocProps : "Ciri-ciri dokumen",
// Anchor Dialog
DlgAnchorTitle : "Ciri-ciri Pautan",
DlgAnchorName : "Nama Pautan",
DlgAnchorErrorName : "Sila taip nama pautan",
// Speller Pages Dialog
DlgSpellNotInDic : "Tidak terdapat didalam kamus",
DlgSpellChangeTo : "Tukarkan kepada",
DlgSpellBtnIgnore : "Biar",
DlgSpellBtnIgnoreAll : "Biarkan semua",
DlgSpellBtnReplace : "Ganti",
DlgSpellBtnReplaceAll : "Gantikan Semua",
DlgSpellBtnUndo : "Batalkan",
DlgSpellNoSuggestions : "- Tiada cadangan -",
DlgSpellProgress : "Pemeriksaan ejaan sedang diproses...",
DlgSpellNoMispell : "Pemeriksaan ejaan siap: Tiada salah ejaan",
DlgSpellNoChanges : "Pemeriksaan ejaan siap: Tiada perkataan diubah",
DlgSpellOneChange : "Pemeriksaan ejaan siap: Satu perkataan telah diubah",
DlgSpellManyChanges : "Pemeriksaan ejaan siap: %1 perkataan diubah",
IeSpellDownload : "Pemeriksa ejaan tidak dipasang. Adakah anda mahu muat turun sekarang?",
// Button Dialog
DlgButtonText : "Teks (Nilai)",
DlgButtonType : "Jenis",
DlgButtonTypeBtn : "Button", //MISSING
DlgButtonTypeSbm : "Submit", //MISSING
DlgButtonTypeRst : "Reset", //MISSING
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "Nama",
DlgCheckboxValue : "Nilai",
DlgCheckboxSelected : "Dipilih",
// Form Dialog
DlgFormName : "Nama",
DlgFormAction : "Tindakan borang",
DlgFormMethod : "Cara borang dihantar",
// Select Field Dialog
DlgSelectName : "Nama",
DlgSelectValue : "Nilai",
DlgSelectSize : "Saiz",
DlgSelectLines : "garisan",
DlgSelectChkMulti : "Benarkan pilihan pelbagai",
DlgSelectOpAvail : "Pilihan sediada",
DlgSelectOpText : "Teks",
DlgSelectOpValue : "Nilai",
DlgSelectBtnAdd : "Tambah Pilihan",
DlgSelectBtnModify : "Ubah Pilihan",
DlgSelectBtnUp : "Naik ke atas",
DlgSelectBtnDown : "Turun ke bawah",
DlgSelectBtnSetValue : "Set sebagai nilai terpilih",
DlgSelectBtnDelete : "Padam",
// Textarea Dialog
DlgTextareaName : "Nama",
DlgTextareaCols : "Lajur",
DlgTextareaRows : "Baris",
// Text Field Dialog
DlgTextName : "Nama",
DlgTextValue : "Nilai",
DlgTextCharWidth : "Lebar isian",
DlgTextMaxChars : "Isian Maksimum",
DlgTextType : "Jenis",
DlgTextTypeText : "Teks",
DlgTextTypePass : "Kata Laluan",
// Hidden Field Dialog
DlgHiddenName : "Nama",
DlgHiddenValue : "Nilai",
// Bulleted List Dialog
BulletedListProp : "Ciri-ciri senarai berpeluru",
NumberedListProp : "Ciri-ciri senarai bernombor",
DlgLstStart : "Start", //MISSING
DlgLstType : "Jenis",
DlgLstTypeCircle : "Circle",
DlgLstTypeDisc : "Disc", //MISSING
DlgLstTypeSquare : "Square",
DlgLstTypeNumbers : "Nombor-nombor (1, 2, 3)",
DlgLstTypeLCase : "Huruf-huruf kecil (a, b, c)",
DlgLstTypeUCase : "Huruf-huruf besar (A, B, C)",
DlgLstTypeSRoman : "Nombor Roman Kecil (i, ii, iii)",
DlgLstTypeLRoman : "Nombor Roman Besar (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "Umum",
DlgDocBackTab : "Latarbelakang",
DlgDocColorsTab : "Warna dan margin",
DlgDocMetaTab : "Data Meta",
DlgDocPageTitle : "Tajuk Muka Surat",
DlgDocLangDir : "Arah Tulisan",
DlgDocLangDirLTR : "Kiri ke Kanan (LTR)",
DlgDocLangDirRTL : "Kanan ke Kiri (RTL)",
DlgDocLangCode : "Kod Bahasa",
DlgDocCharSet : "Enkod Set Huruf",
DlgDocCharSetCE : "Central European", //MISSING
DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING
DlgDocCharSetCR : "Cyrillic", //MISSING
DlgDocCharSetGR : "Greek", //MISSING
DlgDocCharSetJP : "Japanese", //MISSING
DlgDocCharSetKR : "Korean", //MISSING
DlgDocCharSetTR : "Turkish", //MISSING
DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING
DlgDocCharSetWE : "Western European", //MISSING
DlgDocCharSetOther : "Enkod Set Huruf yang Lain",
DlgDocDocType : "Jenis Kepala Dokumen",
DlgDocDocTypeOther : "Jenis Kepala Dokumen yang Lain",
DlgDocIncXHTML : "Masukkan pemula kod XHTML",
DlgDocBgColor : "Warna Latarbelakang",
DlgDocBgImage : "URL Gambar Latarbelakang",
DlgDocBgNoScroll : "Imej Latarbelakang tanpa Skrol",
DlgDocCText : "Teks",
DlgDocCLink : "Sambungan",
DlgDocCVisited : "Sambungan telah Dilawati",
DlgDocCActive : "Sambungan Aktif",
DlgDocMargins : "Margin Muka Surat",
DlgDocMaTop : "Atas",
DlgDocMaLeft : "Kiri",
DlgDocMaRight : "Kanan",
DlgDocMaBottom : "Bawah",
DlgDocMeIndex : "Kata Kunci Indeks Dokumen (dipisahkan oleh koma)",
DlgDocMeDescr : "Keterangan Dokumen",
DlgDocMeAuthor : "Penulis",
DlgDocMeCopy : "Hakcipta",
DlgDocPreview : "Prebiu",
// Templates Dialog
Templates : "Templat",
DlgTemplatesTitle : "Templat Kandungan",
DlgTemplatesSelMsg : "Sila pilih templat untuk dibuka oleh editor<br>(kandungan sebenar akan hilang):",
DlgTemplatesLoading : "Senarai Templat sedang diproses. Sila Tunggu...",
DlgTemplatesNoTpl : "(Tiada Templat Disimpan)",
DlgTemplatesReplace : "Replace actual contents", //MISSING
// About Dialog
DlgAboutAboutTab : "Tentang",
DlgAboutBrowserInfoTab : "Maklumat Perisian Browser",
DlgAboutLicenseTab : "License", //MISSING
DlgAboutVersion : "versi",
DlgAboutInfo : "Untuk maklumat lanjut sila pergi ke",
// Div Dialog
DlgDivGeneralTab : "General", //MISSING
DlgDivAdvancedTab : "Advanced", //MISSING
DlgDivStyle : "Style", //MISSING
DlgDivInlineStyle : "Inline Style", //MISSING
ScaytTitle : "SCAYT", //MISSING
ScaytTitleOptions : "Options", //MISSING
ScaytTitleLangs : "Languages", //MISSING
ScaytTitleAbout : "About" //MISSING
};
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Khmer language file.
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "បង្រួមរបាឧបរកណ៍",
ToolbarExpand : "ពង្រីករបាឧបរណ៍",
// Toolbar Items and Context Menu
Save : "រក្សាទុក",
NewPage : "ទំព័រថ្មី",
Preview : "មើលសាកល្បង",
Cut : "កាត់យក",
Copy : "ចំលងយក",
Paste : "ចំលងដាក់",
PasteText : "ចំលងដាក់ជាអត្ថបទធម្មតា",
PasteWord : "ចំលងដាក់ពី Word",
Print : "បោះពុម្ភ",
SelectAll : "ជ្រើសរើសទាំងអស់",
RemoveFormat : "លប់ចោល ការរចនា",
InsertLinkLbl : "ឈ្នាប់",
InsertLink : "បន្ថែម/កែប្រែ ឈ្នាប់",
RemoveLink : "លប់ឈ្នាប់",
VisitLink : "Open Link", //MISSING
Anchor : "បន្ថែម/កែប្រែ យុថ្កា",
AnchorDelete : "Remove Anchor", //MISSING
InsertImageLbl : "រូបភាព",
InsertImage : "បន្ថែម/កែប្រែ រូបភាព",
InsertFlashLbl : "Flash",
InsertFlash : "បន្ថែម/កែប្រែ Flash",
InsertTableLbl : "តារាង",
InsertTable : "បន្ថែម/កែប្រែ តារាង",
InsertLineLbl : "បន្ទាត់",
InsertLine : "បន្ថែមបន្ទាត់ផ្តេក",
InsertSpecialCharLbl: "អក្សរពិសេស",
InsertSpecialChar : "បន្ថែមអក្សរពិសេស",
InsertSmileyLbl : "រូបភាព",
InsertSmiley : "បន្ថែម រូបភាព",
About : "អំពី FCKeditor",
Bold : "អក្សរដិតធំ",
Italic : "អក្សរផ្តេក",
Underline : "ដិតបន្ទាត់ពីក្រោមអក្សរ",
StrikeThrough : "ដិតបន្ទាត់ពាក់កណ្តាលអក្សរ",
Subscript : "អក្សរតូចក្រោម",
Superscript : "អក្សរតូចលើ",
LeftJustify : "តំរឹមឆ្វេង",
CenterJustify : "តំរឹមកណ្តាល",
RightJustify : "តំរឹមស្តាំ",
BlockJustify : "តំរឹមសងខាង",
DecreaseIndent : "បន្ថយការចូលបន្ទាត់",
IncreaseIndent : "បន្ថែមការចូលបន្ទាត់",
Blockquote : "Blockquote", //MISSING
CreateDiv : "Create Div Container", //MISSING
EditDiv : "Edit Div Container", //MISSING
DeleteDiv : "Remove Div Container", //MISSING
Undo : "សារឡើងវិញ",
Redo : "ធ្វើឡើងវិញ",
NumberedListLbl : "បញ្ជីជាអក្សរ",
NumberedList : "បន្ថែម/លប់ បញ្ជីជាអក្សរ",
BulletedListLbl : "បញ្ជីជារង្វង់មូល",
BulletedList : "បន្ថែម/លប់ បញ្ជីជារង្វង់មូល",
ShowTableBorders : "បង្ហាញស៊ុមតារាង",
ShowDetails : "បង្ហាញពិស្តារ",
Style : "ម៉ូត",
FontFormat : "រចនា",
Font : "ហ្វុង",
FontSize : "ទំហំ",
TextColor : "ពណ៌អក្សរ",
BGColor : "ពណ៌ផ្ទៃខាងក្រោយ",
Source : "កូត",
Find : "ស្វែងរក",
Replace : "ជំនួស",
SpellCheck : "ពិនិត្យអក្ខរាវិរុទ្ធ",
UniversalKeyboard : "ក្តារពុម្ភអក្សរសកល",
PageBreakLbl : "ការផ្តាច់ទំព័រ",
PageBreak : "បន្ថែម ការផ្តាច់ទំព័រ",
Form : "បែបបទ",
Checkbox : "ប្រអប់ជ្រើសរើស",
RadioButton : "ប៉ូតុនរង្វង់មូល",
TextField : "ជួរសរសេរអត្ថបទ",
Textarea : "តំបន់សរសេរអត្ថបទ",
HiddenField : "ជួរលាក់",
Button : "ប៉ូតុន",
SelectionField : "ជួរជ្រើសរើស",
ImageButton : "ប៉ូតុនរូបភាព",
FitWindow : "Maximize the editor size", //MISSING
ShowBlocks : "Show Blocks", //MISSING
// Context Menu
EditLink : "កែប្រែឈ្នាប់",
CellCM : "Cell", //MISSING
RowCM : "Row", //MISSING
ColumnCM : "Column", //MISSING
InsertRowAfter : "Insert Row After", //MISSING
InsertRowBefore : "Insert Row Before", //MISSING
DeleteRows : "លប់ជួរផ្តេក",
InsertColumnAfter : "Insert Column After", //MISSING
InsertColumnBefore : "Insert Column Before", //MISSING
DeleteColumns : "លប់ជួរឈរ",
InsertCellAfter : "Insert Cell After", //MISSING
InsertCellBefore : "Insert Cell Before", //MISSING
DeleteCells : "លប់សែល",
MergeCells : "បញ្ជូលសែល",
MergeRight : "Merge Right", //MISSING
MergeDown : "Merge Down", //MISSING
HorizontalSplitCell : "Split Cell Horizontally", //MISSING
VerticalSplitCell : "Split Cell Vertically", //MISSING
TableDelete : "លប់តារាង",
CellProperties : "ការកំណត់សែល",
TableProperties : "ការកំណត់តារាង",
ImageProperties : "ការកំណត់រូបភាព",
FlashProperties : "ការកំណត់ Flash",
AnchorProp : "ការកំណត់យុថ្កា",
ButtonProp : "ការកំណត់ ប៉ូតុន",
CheckboxProp : "ការកំណត់ប្រអប់ជ្រើសរើស",
HiddenFieldProp : "ការកំណត់ជួរលាក់",
RadioButtonProp : "ការកំណត់ប៉ូតុនរង្វង់",
ImageButtonProp : "ការកំណត់ប៉ូតុនរូបភាព",
TextFieldProp : "ការកំណត់ជួរអត្ថបទ",
SelectionFieldProp : "ការកំណត់ជួរជ្រើសរើស",
TextareaProp : "ការកំណត់កន្លែងសរសេរអត្ថបទ",
FormProp : "ការកំណត់បែបបទ",
FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)",
// Alerts and Messages
ProcessingXHTML : "កំពុងដំណើរការ XHTML ។ សូមរងចាំ...",
Done : "ចប់រួចរាល់",
PasteWordConfirm : "អត្ថបទដែលលោកអ្នកបំរុងចំលងដាក់ ហាក់បីដូចជាត្រូវចំលងមកពីកម្មវិធីWord។ តើលោកអ្នកចង់សំអាតមុនចំលងអត្ថបទដាក់ទេ?",
NotCompatiblePaste : "ពាក្យបញ្ជានេះប្រើបានតែជាមួយ Internet Explorer កំរិត 5.5 រឺ លើសនេះ ។ តើលោកអ្នកចង់ចំលងដាក់ដោយមិនចាំបាច់សំអាតទេ?",
UnknownToolbarItem : "វត្ថុលើរបាឧបរកណ៍ មិនស្គាល់ \"%1\"",
UnknownCommand : "ឈ្មោះពាក្យបញ្ជា មិនស្គាល់ \"%1\"",
NotImplemented : "ពាក្យបញ្ជា មិនបានអនុវត្ត",
UnknownToolbarSet : "របាឧបរកណ៍ \"%1\" ពុំមាន ។",
NoActiveX : "ការកំណត់សុវត្ថភាពរបស់កម្មវិធីរុករករបស់លោកអ្នក នេះអាចធ្វើអោយលោកអ្នកមិនអាចប្រើមុខងារខ្លះរបស់កម្មវិធីតាក់តែងអត្ថបទនេះ ។ លោកអ្នកត្រូវកំណត់អោយ \"ActiveX និងកម្មវិធីជំនួយក្នុង (plug-ins)\" អោយដំណើរការ ។ លោកអ្នកអាចជួបប្រទះនឹង បញ្ហា ព្រមជាមួយនឹងការបាត់បង់មុខងារណាមួយរបស់កម្មវិធីតាក់តែងអត្ថបទនេះ ។",
BrowseServerBlocked : "The resources browser could not be opened. Make sure that all popup blockers are disabled.", //MISSING
DialogBlocked : "វីនដូវមិនអាចបើកបានទេ ។ សូមពិនិត្យចំពោះកម្មវិធីបិទ វីនដូវលោត (popup) ថាតើវាដំណើរការរឺទេ ។",
VisitLinkBlocked : "It was not possible to open a new window. Make sure all popup blockers are disabled.", //MISSING
// Dialogs
DlgBtnOK : "យល់ព្រម",
DlgBtnCancel : "មិនយល់ព្រម",
DlgBtnClose : "បិទ",
DlgBtnBrowseServer : "មើល",
DlgAdvancedTag : "កំរិតខ្ពស់",
DlgOpOther : "<ផ្សេងទៅត>",
DlgInfoTab : "ពត៌មាន",
DlgAlertUrl : "សូមសរសេរ URL",
// General Dialogs Labels
DlgGenNotSet : "<មិនមែន>",
DlgGenId : "Id",
DlgGenLangDir : "ទិសដៅភាសា",
DlgGenLangDirLtr : "ពីឆ្វេងទៅស្តាំ(LTR)",
DlgGenLangDirRtl : "ពីស្តាំទៅឆ្វេង(RTL)",
DlgGenLangCode : "លេខកូតភាសា",
DlgGenAccessKey : "ឃី សំរាប់ចូល",
DlgGenName : "ឈ្មោះ",
DlgGenTabIndex : "លេខ Tab",
DlgGenLongDescr : "អធិប្បាយ URL វែង",
DlgGenClass : "Stylesheet Classes",
DlgGenTitle : "ចំណងជើង ប្រឹក្សា",
DlgGenContType : "ប្រភេទអត្ថបទ ប្រឹក្សា",
DlgGenLinkCharset : "លេខកូតអក្សររបស់ឈ្នាប់",
DlgGenStyle : "ម៉ូត",
// Image Dialog
DlgImgTitle : "ការកំណត់រូបភាព",
DlgImgInfoTab : "ពត៌មានអំពីរូបភាព",
DlgImgBtnUpload : "បញ្ជូនទៅកាន់ម៉ាស៊ីនផ្តល់សេវា",
DlgImgURL : "URL",
DlgImgUpload : "ទាញយក",
DlgImgAlt : "អត្ថបទជំនួស",
DlgImgWidth : "ទទឹង",
DlgImgHeight : "កំពស់",
DlgImgLockRatio : "អត្រាឡុក",
DlgBtnResetSize : "កំណត់ទំហំឡើងវិញ",
DlgImgBorder : "ស៊ុម",
DlgImgHSpace : "គំលាតទទឹង",
DlgImgVSpace : "គំលាតបណ្តោយ",
DlgImgAlign : "កំណត់ទីតាំង",
DlgImgAlignLeft : "ខាងឆ្វង",
DlgImgAlignAbsBottom: "Abs Bottom", //MISSING
DlgImgAlignAbsMiddle: "Abs Middle", //MISSING
DlgImgAlignBaseline : "បន្ទាត់ជាមូលដ្ឋាន",
DlgImgAlignBottom : "ខាងក្រោម",
DlgImgAlignMiddle : "កណ្តាល",
DlgImgAlignRight : "ខាងស្តាំ",
DlgImgAlignTextTop : "លើអត្ថបទ",
DlgImgAlignTop : "ខាងលើ",
DlgImgPreview : "មើលសាកល្បង",
DlgImgAlertUrl : "សូមសរសេរងាស័យដ្ឋានរបស់រូបភាព",
DlgImgLinkTab : "ឈ្នាប់",
// Flash Dialog
DlgFlashTitle : "ការកំណត់ Flash",
DlgFlashChkPlay : "លេងដោយស្វ័យប្រវត្ត",
DlgFlashChkLoop : "ចំនួនដង",
DlgFlashChkMenu : "បង្ហាញ មឺនុយរបស់ Flash",
DlgFlashScale : "ទំហំ",
DlgFlashScaleAll : "បង្ហាញទាំងអស់",
DlgFlashScaleNoBorder : "មិនបង្ហាញស៊ុម",
DlgFlashScaleFit : "ត្រូវល្មម",
// Link Dialog
DlgLnkWindowTitle : "ឈ្នាប់",
DlgLnkInfoTab : "ពត៌មានអំពីឈ្នាប់",
DlgLnkTargetTab : "គោលដៅ",
DlgLnkType : "ប្រភេទឈ្នាប់",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "យុថ្កានៅក្នុងទំព័រនេះ",
DlgLnkTypeEMail : "អ៊ីមែល",
DlgLnkProto : "ប្រូតូកូល",
DlgLnkProtoOther : "<ផ្សេងទៀត>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "ជ្រើសរើសយុថ្កា",
DlgLnkAnchorByName : "តាមឈ្មោះរបស់យុថ្កា",
DlgLnkAnchorById : "តាម Id",
DlgLnkNoAnchors : "(No anchors available in the document)", //MISSING
DlgLnkEMail : "អ៊ីមែល",
DlgLnkEMailSubject : "ចំណងជើងអត្ថបទ",
DlgLnkEMailBody : "អត្ថបទ",
DlgLnkUpload : "ទាញយក",
DlgLnkBtnUpload : "ទាញយក",
DlgLnkTarget : "គោលដៅ",
DlgLnkTargetFrame : "<ហ្វ្រេម>",
DlgLnkTargetPopup : "<វីនដូវ លោត>",
DlgLnkTargetBlank : "វីនដូវថ្មី (_blank)",
DlgLnkTargetParent : "វីនដូវមេ (_parent)",
DlgLnkTargetSelf : "វីនដូវដដែល (_self)",
DlgLnkTargetTop : "វីនដូវនៅលើគេ(_top)",
DlgLnkTargetFrameName : "ឈ្មោះហ្រ្វេមដែលជាគោលដៅ",
DlgLnkPopWinName : "ឈ្មោះវីនដូវលោត",
DlgLnkPopWinFeat : "លក្ខណះរបស់វីនដូលលោត",
DlgLnkPopResize : "ទំហំអាចផ្លាស់ប្តូរ",
DlgLnkPopLocation : "របា ទីតាំង",
DlgLnkPopMenu : "របា មឺនុយ",
DlgLnkPopScroll : "របា ទាញ",
DlgLnkPopStatus : "របា ពត៌មាន",
DlgLnkPopToolbar : "របា ឩបករណ៍",
DlgLnkPopFullScrn : "អេក្រុងពេញ(IE)",
DlgLnkPopDependent : "អាស្រ័យលើ (Netscape)",
DlgLnkPopWidth : "ទទឹង",
DlgLnkPopHeight : "កំពស់",
DlgLnkPopLeft : "ទីតាំងខាងឆ្វេង",
DlgLnkPopTop : "ទីតាំងខាងលើ",
DlnLnkMsgNoUrl : "សូមសរសេរ អាស័យដ្ឋាន URL",
DlnLnkMsgNoEMail : "សូមសរសេរ អាស័យដ្ឋាន អ៊ីមែល",
DlnLnkMsgNoAnchor : "សូមជ្រើសរើស យុថ្កា",
DlnLnkMsgInvPopName : "The popup name must begin with an alphabetic character and must not contain spaces", //MISSING
// Color Dialog
DlgColorTitle : "ជ្រើសរើស ពណ៌",
DlgColorBtnClear : "លប់",
DlgColorHighlight : "ផាត់ពណ៌",
DlgColorSelected : "បានជ្រើសរើស",
// Smiley Dialog
DlgSmileyTitle : "បញ្ជូលរូបភាព",
// Special Character Dialog
DlgSpecialCharTitle : "តូអក្សរពិសេស",
// Table Dialog
DlgTableTitle : "ការកំណត់ តារាង",
DlgTableRows : "ជួរផ្តេក",
DlgTableColumns : "ជួរឈរ",
DlgTableBorder : "ទំហំស៊ុម",
DlgTableAlign : "ការកំណត់ទីតាំង",
DlgTableAlignNotSet : "<មិនកំណត់>",
DlgTableAlignLeft : "ខាងឆ្វេង",
DlgTableAlignCenter : "កណ្តាល",
DlgTableAlignRight : "ខាងស្តាំ",
DlgTableWidth : "ទទឹង",
DlgTableWidthPx : "ភីកសែល",
DlgTableWidthPc : "ភាគរយ",
DlgTableHeight : "កំពស់",
DlgTableCellSpace : "គំលាតសែល",
DlgTableCellPad : "គែមសែល",
DlgTableCaption : "ចំណងជើង",
DlgTableSummary : "សេចក្តីសង្ខេប",
DlgTableHeaders : "Headers", //MISSING
DlgTableHeadersNone : "None", //MISSING
DlgTableHeadersColumn : "First column", //MISSING
DlgTableHeadersRow : "First Row", //MISSING
DlgTableHeadersBoth : "Both", //MISSING
// Table Cell Dialog
DlgCellTitle : "ការកំណត់ សែល",
DlgCellWidth : "ទទឹង",
DlgCellWidthPx : "ភីកសែល",
DlgCellWidthPc : "ភាគរយ",
DlgCellHeight : "កំពស់",
DlgCellWordWrap : "បង្ហាញអត្ថបទទាំងអស់",
DlgCellWordWrapNotSet : "<មិនកំណត់>",
DlgCellWordWrapYes : "បាទ(ចា)",
DlgCellWordWrapNo : "ទេ",
DlgCellHorAlign : "តំរឹមផ្តេក",
DlgCellHorAlignNotSet : "<មិនកំណត់>",
DlgCellHorAlignLeft : "ខាងឆ្វេង",
DlgCellHorAlignCenter : "កណ្តាល",
DlgCellHorAlignRight: "Right", //MISSING
DlgCellVerAlign : "តំរឹមឈរ",
DlgCellVerAlignNotSet : "<មិនកណត់>",
DlgCellVerAlignTop : "ខាងលើ",
DlgCellVerAlignMiddle : "កណ្តាល",
DlgCellVerAlignBottom : "ខាងក្រោម",
DlgCellVerAlignBaseline : "បន្ទាត់ជាមូលដ្ឋាន",
DlgCellType : "Cell Type", //MISSING
DlgCellTypeData : "Data", //MISSING
DlgCellTypeHeader : "Header", //MISSING
DlgCellRowSpan : "បញ្ជូលជួរផ្តេក",
DlgCellCollSpan : "បញ្ជូលជួរឈរ",
DlgCellBackColor : "ពណ៌ផ្នែកខាងក្រោម",
DlgCellBorderColor : "ពណ៌ស៊ុម",
DlgCellBtnSelect : "ជ្រើសរើស...",
// Find and Replace Dialog
DlgFindAndReplaceTitle : "Find and Replace", //MISSING
// Find Dialog
DlgFindTitle : "ស្វែងរក",
DlgFindFindBtn : "ស្វែងរក",
DlgFindNotFoundMsg : "ពាក្យនេះ រកមិនឃើញទេ ។",
// Replace Dialog
DlgReplaceTitle : "ជំនួស",
DlgReplaceFindLbl : "ស្វែងរកអ្វី:",
DlgReplaceReplaceLbl : "ជំនួសជាមួយ:",
DlgReplaceCaseChk : "ករណ៉ត្រូវរក",
DlgReplaceReplaceBtn : "ជំនួស",
DlgReplaceReplAllBtn : "ជំនួសទាំងអស់",
DlgReplaceWordChk : "ត្រូវពាក្យទាំងអស់",
// Paste Operations / Dialog
PasteErrorCut : "ការកំណត់សុវត្ថភាពរបស់កម្មវិធីរុករករបស់លោកអ្នក នេះមិនអាចធ្វើកម្មវិធីតាក់តែងអត្ថបទ កាត់អត្ថបទយកដោយស្វ័យប្រវត្តបានឡើយ ។ សូមប្រើប្រាស់បន្សំ ឃីដូចនេះ (Ctrl+X) ។",
PasteErrorCopy : "ការកំណត់សុវត្ថភាពរបស់កម្មវិធីរុករករបស់លោកអ្នក នេះមិនអាចធ្វើកម្មវិធីតាក់តែងអត្ថបទ ចំលងអត្ថបទយកដោយស្វ័យប្រវត្តបានឡើយ ។ សូមប្រើប្រាស់បន្សំ ឃីដូចនេះ (Ctrl+C)។",
PasteAsText : "ចំលងដាក់អត្ថបទធម្មតា",
PasteFromWord : "ចំលងពាក្យពីកម្មវិធី Word",
DlgPasteMsg2 : "សូមចំលងអត្ថបទទៅដាក់ក្នុងប្រអប់ដូចខាងក្រោមដោយប្រើប្រាស់ ឃី (<STRONG>Ctrl+V</STRONG>) ហើយចុច <STRONG>OK</STRONG> ។",
DlgPasteSec : "Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.", //MISSING
DlgPasteIgnoreFont : "មិនគិតអំពីប្រភេទពុម្ភអក្សរ",
DlgPasteRemoveStyles : "លប់ម៉ូត",
// Color Picker
ColorAutomatic : "ស្វ័យប្រវត្ត",
ColorMoreColors : "ពណ៌ផ្សេងទៀត..",
// Document Properties
DocProps : "ការកំណត់ ឯកសារ",
// Anchor Dialog
DlgAnchorTitle : "ការកំណត់ចំណងជើងយុទ្ធថ្កា",
DlgAnchorName : "ឈ្មោះយុទ្ធថ្កា",
DlgAnchorErrorName : "សូមសរសេរ ឈ្មោះយុទ្ធថ្កា",
// Speller Pages Dialog
DlgSpellNotInDic : "គ្មានក្នុងវចនានុក្រម",
DlgSpellChangeTo : "ផ្លាស់ប្តូរទៅ",
DlgSpellBtnIgnore : "មិនផ្លាស់ប្តូរ",
DlgSpellBtnIgnoreAll : "មិនផ្លាស់ប្តូរ ទាំងអស់",
DlgSpellBtnReplace : "ជំនួស",
DlgSpellBtnReplaceAll : "ជំនួសទាំងអស់",
DlgSpellBtnUndo : "សារឡើងវិញ",
DlgSpellNoSuggestions : "- គ្មានសំណើរ -",
DlgSpellProgress : "កំពុងពិនិត្យអក្ខរាវិរុទ្ធ...",
DlgSpellNoMispell : "ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: គ្មានកំហុស",
DlgSpellNoChanges : "ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: ពុំមានផ្លាស់ប្តូរ",
DlgSpellOneChange : "ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: ពាក្យមួយត្រូចបានផ្លាស់ប្តូរ",
DlgSpellManyChanges : "ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: %1 ពាក្យបានផ្លាស់ប្តូរ",
IeSpellDownload : "ពុំមានកម្មវិធីពិនិត្យអក្ខរាវិរុទ្ធ ។ តើចង់ទាញយកពីណា?",
// Button Dialog
DlgButtonText : "អត្ថបទ(តំលៃ)",
DlgButtonType : "ប្រភេទ",
DlgButtonTypeBtn : "Button", //MISSING
DlgButtonTypeSbm : "Submit", //MISSING
DlgButtonTypeRst : "Reset", //MISSING
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "ឈ្មោះ",
DlgCheckboxValue : "តំលៃ",
DlgCheckboxSelected : "បានជ្រើសរើស",
// Form Dialog
DlgFormName : "ឈ្មោះ",
DlgFormAction : "សកម្មភាព",
DlgFormMethod : "វិធី",
// Select Field Dialog
DlgSelectName : "ឈ្មោះ",
DlgSelectValue : "តំលៃ",
DlgSelectSize : "ទំហំ",
DlgSelectLines : "បន្ទាត់",
DlgSelectChkMulti : "អនុញ្ញាតអោយជ្រើសរើសច្រើន",
DlgSelectOpAvail : "ការកំណត់ជ្រើសរើស ដែលអាចកំណត់បាន",
DlgSelectOpText : "ពាក្យ",
DlgSelectOpValue : "តំលៃ",
DlgSelectBtnAdd : "បន្ថែម",
DlgSelectBtnModify : "ផ្លាស់ប្តូរ",
DlgSelectBtnUp : "លើ",
DlgSelectBtnDown : "ក្រោម",
DlgSelectBtnSetValue : "Set as selected value", //MISSING
DlgSelectBtnDelete : "លប់",
// Textarea Dialog
DlgTextareaName : "ឈ្មោះ",
DlgTextareaCols : "ជូរឈរ",
DlgTextareaRows : "ជូរផ្តេក",
// Text Field Dialog
DlgTextName : "ឈ្មោះ",
DlgTextValue : "តំលៃ",
DlgTextCharWidth : "ទទឹង អក្សរ",
DlgTextMaxChars : "អក្សរអតិបរិមា",
DlgTextType : "ប្រភេទ",
DlgTextTypeText : "ពាក្យ",
DlgTextTypePass : "ពាក្យសំងាត់",
// Hidden Field Dialog
DlgHiddenName : "ឈ្មោះ",
DlgHiddenValue : "តំលៃ",
// Bulleted List Dialog
BulletedListProp : "កំណត់បញ្ជីរង្វង់",
NumberedListProp : "កំណត់បញ្េជីលេខ",
DlgLstStart : "Start", //MISSING
DlgLstType : "ប្រភេទ",
DlgLstTypeCircle : "រង្វង់",
DlgLstTypeDisc : "Disc",
DlgLstTypeSquare : "ការេ",
DlgLstTypeNumbers : "លេខ(1, 2, 3)",
DlgLstTypeLCase : "អក្សរតូច(a, b, c)",
DlgLstTypeUCase : "អក្សរធំ(A, B, C)",
DlgLstTypeSRoman : "អក្សរឡាតាំងតូច(i, ii, iii)",
DlgLstTypeLRoman : "អក្សរឡាតាំងធំ(I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "ទូទៅ",
DlgDocBackTab : "ផ្នែកខាងក្រោយ",
DlgDocColorsTab : "ទំព័រនិង ស៊ុម",
DlgDocMetaTab : "ទិន្នន័យមេ",
DlgDocPageTitle : "ចំណងជើងទំព័រ",
DlgDocLangDir : "ទិសដៅសរសេរភាសា",
DlgDocLangDirLTR : "ពីឆ្វេងទៅស្ដាំ(LTR)",
DlgDocLangDirRTL : "ពីស្ដាំទៅឆ្វេង(RTL)",
DlgDocLangCode : "លេខកូតភាសា",
DlgDocCharSet : "កំណត់លេខកូតភាសា",
DlgDocCharSetCE : "Central European", //MISSING
DlgDocCharSetCT : "Chinese Traditional (Big5)", //MISSING
DlgDocCharSetCR : "Cyrillic", //MISSING
DlgDocCharSetGR : "Greek", //MISSING
DlgDocCharSetJP : "Japanese", //MISSING
DlgDocCharSetKR : "Korean", //MISSING
DlgDocCharSetTR : "Turkish", //MISSING
DlgDocCharSetUN : "Unicode (UTF-8)", //MISSING
DlgDocCharSetWE : "Western European", //MISSING
DlgDocCharSetOther : "កំណត់លេខកូតភាសាផ្សេងទៀត",
DlgDocDocType : "ប្រភេទក្បាលទំព័រ",
DlgDocDocTypeOther : "ប្រភេទក្បាលទំព័រផ្សេងទៀត",
DlgDocIncXHTML : "បញ្ជូល XHTML",
DlgDocBgColor : "ពណ៌ខាងក្រោម",
DlgDocBgImage : "URL របស់រូបភាពខាងក្រោម",
DlgDocBgNoScroll : "ទំព័រក្រោមមិនប្តូរ",
DlgDocCText : "អត្តបទ",
DlgDocCLink : "ឈ្នាប់",
DlgDocCVisited : "ឈ្នាប់មើលហើយ",
DlgDocCActive : "ឈ្នាប់កំពុងមើល",
DlgDocMargins : "ស៊ុមទំព័រ",
DlgDocMaTop : "លើ",
DlgDocMaLeft : "ឆ្វេង",
DlgDocMaRight : "ស្ដាំ",
DlgDocMaBottom : "ក្រោម",
DlgDocMeIndex : "ពាក្យនៅក្នុងឯកសារ (ផ្តាច់ពីគ្នាដោយក្បៀស)",
DlgDocMeDescr : "សេចក្តីអត្ថាធិប្បាយអំពីឯកសារ",
DlgDocMeAuthor : "អ្នកនិពន្ធ",
DlgDocMeCopy : "រក្សាសិទ្ធិ៏",
DlgDocPreview : "មើលសាកល្បង",
// Templates Dialog
Templates : "ឯកសារគំរូ",
DlgTemplatesTitle : "ឯកសារគំរូ របស់អត្ថន័យ",
DlgTemplatesSelMsg : "សូមជ្រើសរើសឯកសារគំរូ ដើម្បីបើកនៅក្នុងកម្មវិធីតាក់តែងអត្ថបទ<br>(អត្ថបទនឹងបាត់បង់):",
DlgTemplatesLoading : "កំពុងអានបញ្ជីឯកសារគំរូ ។ សូមរងចាំ...",
DlgTemplatesNoTpl : "(ពុំមានឯកសារគំរូត្រូវបានកំណត់)",
DlgTemplatesReplace : "Replace actual contents", //MISSING
// About Dialog
DlgAboutAboutTab : "អំពី",
DlgAboutBrowserInfoTab : "ព៌តមានកម្មវិធីរុករក",
DlgAboutLicenseTab : "License", //MISSING
DlgAboutVersion : "ជំនាន់",
DlgAboutInfo : "សំរាប់ព៌តមានផ្សេងទៀត សូមទាក់ទង",
// Div Dialog
DlgDivGeneralTab : "General", //MISSING
DlgDivAdvancedTab : "Advanced", //MISSING
DlgDivStyle : "Style", //MISSING
DlgDivInlineStyle : "Inline Style", //MISSING
ScaytTitle : "SCAYT", //MISSING
ScaytTitleOptions : "Options", //MISSING
ScaytTitleLangs : "Languages", //MISSING
ScaytTitleAbout : "About" //MISSING
};
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Mongolian language file.
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "Багажны хэсэг эвдэх",
ToolbarExpand : "Багажны хэсэг өргөтгөх",
// Toolbar Items and Context Menu
Save : "Хадгалах",
NewPage : "Шинэ хуудас",
Preview : "Уридчлан харах",
Cut : "Хайчлах",
Copy : "Хуулах",
Paste : "Буулгах",
PasteText : "plain text-ээс буулгах",
PasteWord : "Word-оос буулгах",
Print : "Хэвлэх",
SelectAll : "Бүгдийг нь сонгох",
RemoveFormat : "Формат авч хаях",
InsertLinkLbl : "Линк",
InsertLink : "Линк Оруулах/Засварлах",
RemoveLink : "Линк авч хаях",
VisitLink : "Open Link", //MISSING
Anchor : "Холбоос Оруулах/Засварлах",
AnchorDelete : "Холбоос Авах",
InsertImageLbl : "Зураг",
InsertImage : "Зураг Оруулах/Засварлах",
InsertFlashLbl : "Флаш",
InsertFlash : "Флаш Оруулах/Засварлах",
InsertTableLbl : "Хүснэгт",
InsertTable : "Хүснэгт Оруулах/Засварлах",
InsertLineLbl : "Зураас",
InsertLine : "Хөндлөн зураас оруулах",
InsertSpecialCharLbl: "Онцгой тэмдэгт",
InsertSpecialChar : "Онцгой тэмдэгт оруулах",
InsertSmileyLbl : "Тодорхойлолт",
InsertSmiley : "Тодорхойлолт оруулах",
About : "FCKeditor-н тухай",
Bold : "Тод бүдүүн",
Italic : "Налуу",
Underline : "Доогуур нь зураастай болгох",
StrikeThrough : "Дундуур нь зураастай болгох",
Subscript : "Суурь болгох",
Superscript : "Зэрэг болгох",
LeftJustify : "Зүүн талд байрлуулах",
CenterJustify : "Төвд байрлуулах",
RightJustify : "Баруун талд байрлуулах",
BlockJustify : "Блок хэлбэрээр байрлуулах",
DecreaseIndent : "Догол мөр нэмэх",
IncreaseIndent : "Догол мөр хасах",
Blockquote : "Хайрцаглах",
CreateDiv : "Create Div Container", //MISSING
EditDiv : "Edit Div Container", //MISSING
DeleteDiv : "Remove Div Container", //MISSING
Undo : "Хүчингүй болгох",
Redo : "Өмнөх үйлдлээ сэргээх",
NumberedListLbl : "Дугаарлагдсан жагсаалт",
NumberedList : "Дугаарлагдсан жагсаалт Оруулах/Авах",
BulletedListLbl : "Цэгтэй жагсаалт",
BulletedList : "Цэгтэй жагсаалт Оруулах/Авах",
ShowTableBorders : "Хүснэгтийн хүрээг үзүүлэх",
ShowDetails : "Деталчлан үзүүлэх",
Style : "Загвар",
FontFormat : "Формат",
Font : "Фонт",
FontSize : "Хэмжээ",
TextColor : "Фонтны өнгө",
BGColor : "Фонны өнгө",
Source : "Код",
Find : "Хайх",
Replace : "Солих",
SpellCheck : "Үгийн дүрэх шалгах",
UniversalKeyboard : "Униварсал гар",
PageBreakLbl : "Хуудас тусгаарлах",
PageBreak : "Хуудас тусгаарлагч оруулах",
Form : "Форм",
Checkbox : "Чекбокс",
RadioButton : "Радио товч",
TextField : "Техт талбар",
Textarea : "Техт орчин",
HiddenField : "Нууц талбар",
Button : "Товч",
SelectionField : "Сонгогч талбар",
ImageButton : "Зурагтай товч",
FitWindow : "editor-н хэмжээг томруулах",
ShowBlocks : "Block-уудыг үзүүлэх",
// Context Menu
EditLink : "Холбоос засварлах",
CellCM : "Нүх/зай",
RowCM : "Мөр",
ColumnCM : "Багана",
InsertRowAfter : "Мөр дараа нь оруулах",
InsertRowBefore : "Мөр өмнө нь оруулах",
DeleteRows : "Мөр устгах",
InsertColumnAfter : "Багана дараа нь оруулах",
InsertColumnBefore : "Багана өмнө нь оруулах",
DeleteColumns : "Багана устгах",
InsertCellAfter : "Нүх/зай дараа нь оруулах",
InsertCellBefore : "Нүх/зай өмнө нь оруулах",
DeleteCells : "Нүх устгах",
MergeCells : "Нүх нэгтэх",
MergeRight : "Баруун тийш нэгтгэх",
MergeDown : "Доош нэгтгэх",
HorizontalSplitCell : "Нүх/зайг босоогоор нь тусгаарлах",
VerticalSplitCell : "Нүх/зайг хөндлөнгөөр нь тусгаарлах",
TableDelete : "Хүснэгт устгах",
CellProperties : "Нүх/зай зайн шинж чанар",
TableProperties : "Хүснэгт",
ImageProperties : "Зураг",
FlashProperties : "Флаш шинж чанар",
AnchorProp : "Холбоос шинж чанар",
ButtonProp : "Товчны шинж чанар",
CheckboxProp : "Чекбоксны шинж чанар",
HiddenFieldProp : "Нууц талбарын шинж чанар",
RadioButtonProp : "Радио товчны шинж чанар",
ImageButtonProp : "Зурган товчны шинж чанар",
TextFieldProp : "Текст талбарын шинж чанар",
SelectionFieldProp : "Согогч талбарын шинж чанар",
TextareaProp : "Текст орчны шинж чанар",
FormProp : "Форм шинж чанар",
FontFormats : "Хэвийн;Formatted;Хаяг;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Paragraph (DIV)",
// Alerts and Messages
ProcessingXHTML : "XHTML үйл явц явагдаж байна. Хүлээнэ үү...",
Done : "Хийх",
PasteWordConfirm : "Word-оос хуулсан текстээ санаж байгааг нь буулгахыг та хүсч байна уу. Та текст-ээ буулгахын өмнө цэвэрлэх үү?",
NotCompatiblePaste : "Энэ комманд Internet Explorer-ын 5.5 буюу түүнээс дээш хувилбарт идвэхшинэ. Та цэвэрлэхгүйгээр буулгахыг хүсч байна?",
UnknownToolbarItem : "Багажны хэсгийн \"%1\" item мэдэгдэхгүй байна",
UnknownCommand : "\"%1\" комманд нэр мэдагдэхгүй байна",
NotImplemented : "Зөвшөөрөгдөхгүй комманд",
UnknownToolbarSet : "Багажны хэсэгт \"%1\" оноох, үүсээгүй байна",
NoActiveX : "Таны үзүүлэгч/browser-н хамгаалалтын тохиргоо editor-н зарим боломжийг хязгаарлаж байна. Та \"Run ActiveX controls ба plug-ins\" сонголыг идвэхитэй болго.",
BrowseServerBlocked : "Нөөц үзүүгч нээж чадсангүй. Бүх popup blocker-г disabled болгоно уу.",
DialogBlocked : "Харилцах цонхонд энийг нээхэд боломжгүй ээ. Бүх popup blocker-г disabled болгоно уу.",
VisitLinkBlocked : "It was not possible to open a new window. Make sure all popup blockers are disabled.", //MISSING
// Dialogs
DlgBtnOK : "OK",
DlgBtnCancel : "Болих",
DlgBtnClose : "Хаах",
DlgBtnBrowseServer : "Сервер харуулах",
DlgAdvancedTag : "Нэмэлт",
DlgOpOther : "<Бусад>",
DlgInfoTab : "Мэдээлэл",
DlgAlertUrl : "URL оруулна уу",
// General Dialogs Labels
DlgGenNotSet : "<Оноохгүй>",
DlgGenId : "Id",
DlgGenLangDir : "Хэлний чиглэл",
DlgGenLangDirLtr : "Зүүнээс баруун (LTR)",
DlgGenLangDirRtl : "Баруунаас зүүн (RTL)",
DlgGenLangCode : "Хэлний код",
DlgGenAccessKey : "Холбох түлхүүр",
DlgGenName : "Нэр",
DlgGenTabIndex : "Tab индекс",
DlgGenLongDescr : "URL-ын тайлбар",
DlgGenClass : "Stylesheet классууд",
DlgGenTitle : "Зөвлөлдөх гарчиг",
DlgGenContType : "Зөвлөлдөх төрлийн агуулга",
DlgGenLinkCharset : "Тэмдэгт оноох нөөцөд холбогдсон",
DlgGenStyle : "Загвар",
// Image Dialog
DlgImgTitle : "Зураг",
DlgImgInfoTab : "Зурагны мэдээлэл",
DlgImgBtnUpload : "Үүнийг сервэррүү илгээ",
DlgImgURL : "URL",
DlgImgUpload : "Хуулах",
DlgImgAlt : "Тайлбар текст",
DlgImgWidth : "Өргөн",
DlgImgHeight : "Өндөр",
DlgImgLockRatio : "Радио түгжих",
DlgBtnResetSize : "хэмжээ дахин оноох",
DlgImgBorder : "Хүрээ",
DlgImgHSpace : "Хөндлөн зай",
DlgImgVSpace : "Босоо зай",
DlgImgAlign : "Эгнээ",
DlgImgAlignLeft : "Зүүн",
DlgImgAlignAbsBottom: "Abs доод талд",
DlgImgAlignAbsMiddle: "Abs Дунд талд",
DlgImgAlignBaseline : "Baseline",
DlgImgAlignBottom : "Доод талд",
DlgImgAlignMiddle : "Дунд талд",
DlgImgAlignRight : "Баруун",
DlgImgAlignTextTop : "Текст дээр",
DlgImgAlignTop : "Дээд талд",
DlgImgPreview : "Уридчлан харах",
DlgImgAlertUrl : "Зурагны URL-ын төрлийн сонгоно уу",
DlgImgLinkTab : "Линк",
// Flash Dialog
DlgFlashTitle : "Флаш шинж чанар",
DlgFlashChkPlay : "Автоматаар тоглох",
DlgFlashChkLoop : "Давтах",
DlgFlashChkMenu : "Флаш цэс идвэхжүүлэх",
DlgFlashScale : "Өргөгтгөх",
DlgFlashScaleAll : "Бүгдийг харуулах",
DlgFlashScaleNoBorder : "Хүрээгүй",
DlgFlashScaleFit : "Яг тааруулах",
// Link Dialog
DlgLnkWindowTitle : "Линк",
DlgLnkInfoTab : "Линкийн мэдээлэл",
DlgLnkTargetTab : "Байрлал",
DlgLnkType : "Линкийн төрөл",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "Энэ хуудасандах холбоос",
DlgLnkTypeEMail : "E-Mail",
DlgLnkProto : "Протокол",
DlgLnkProtoOther : "<бусад>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "Холбоос сонгох",
DlgLnkAnchorByName : "Холбоосын нэрээр",
DlgLnkAnchorById : "Элемэнт Id-гаар",
DlgLnkNoAnchors : "(Баримт бичиг холбоосгүй байна)",
DlgLnkEMail : "E-Mail Хаяг",
DlgLnkEMailSubject : "Message гарчиг",
DlgLnkEMailBody : "Message-ийн агуулга",
DlgLnkUpload : "Хуулах",
DlgLnkBtnUpload : "Үүнийг серверрүү илгээ",
DlgLnkTarget : "Байрлал",
DlgLnkTargetFrame : "<Агуулах хүрээ>",
DlgLnkTargetPopup : "<popup цонх>",
DlgLnkTargetBlank : "Шинэ цонх (_blank)",
DlgLnkTargetParent : "Эцэг цонх (_parent)",
DlgLnkTargetSelf : "Төстэй цонх (_self)",
DlgLnkTargetTop : "Хамгийн түрүүн байх цонх (_top)",
DlgLnkTargetFrameName : "Очих фремын нэр",
DlgLnkPopWinName : "Popup цонхны нэр",
DlgLnkPopWinFeat : "Popup цонхны онцлог",
DlgLnkPopResize : "Хэмжээ өөрчлөх",
DlgLnkPopLocation : "Location хэсэг",
DlgLnkPopMenu : "Meню хэсэг",
DlgLnkPopScroll : "Скрол хэсэгүүд",
DlgLnkPopStatus : "Статус хэсэг",
DlgLnkPopToolbar : "Багажны хэсэг",
DlgLnkPopFullScrn : "Цонх дүүргэх (IE)",
DlgLnkPopDependent : "Хамаатай (Netscape)",
DlgLnkPopWidth : "Өргөн",
DlgLnkPopHeight : "Өндөр",
DlgLnkPopLeft : "Зүүн байрлал",
DlgLnkPopTop : "Дээд байрлал",
DlnLnkMsgNoUrl : "Линк URL-ээ төрөлжүүлнэ үү",
DlnLnkMsgNoEMail : "Е-mail хаягаа төрөлжүүлнэ үү",
DlnLnkMsgNoAnchor : "Холбоосоо сонгоно уу",
DlnLnkMsgInvPopName : "popup нэр нь үсгэн тэмдэгтээр эхэлсэн байх ба хоосон зай агуулаагүй байх ёстой.",
// Color Dialog
DlgColorTitle : "Өнгө сонгох",
DlgColorBtnClear : "Цэвэрлэх",
DlgColorHighlight : "Өнгө",
DlgColorSelected : "Сонгогдсон",
// Smiley Dialog
DlgSmileyTitle : "Тодорхойлолт оруулах",
// Special Character Dialog
DlgSpecialCharTitle : "Онцгой тэмдэгт сонгох",
// Table Dialog
DlgTableTitle : "Хүснэгт",
DlgTableRows : "Мөр",
DlgTableColumns : "Багана",
DlgTableBorder : "Хүрээний хэмжээ",
DlgTableAlign : "Эгнээ",
DlgTableAlignNotSet : "<Оноохгүй>",
DlgTableAlignLeft : "Зүүн талд",
DlgTableAlignCenter : "Төвд",
DlgTableAlignRight : "Баруун талд",
DlgTableWidth : "Өргөн",
DlgTableWidthPx : "цэг",
DlgTableWidthPc : "хувь",
DlgTableHeight : "Өндөр",
DlgTableCellSpace : "Нүх хоорондын зай (spacing)",
DlgTableCellPad : "Нүх доторлох(padding)",
DlgTableCaption : "Тайлбар",
DlgTableSummary : "Тайлбар",
DlgTableHeaders : "Headers", //MISSING
DlgTableHeadersNone : "None", //MISSING
DlgTableHeadersColumn : "First column", //MISSING
DlgTableHeadersRow : "First Row", //MISSING
DlgTableHeadersBoth : "Both", //MISSING
// Table Cell Dialog
DlgCellTitle : "Хоосон зайн шинж чанар",
DlgCellWidth : "Өргөн",
DlgCellWidthPx : "цэг",
DlgCellWidthPc : "хувь",
DlgCellHeight : "Өндөр",
DlgCellWordWrap : "Үг таслах",
DlgCellWordWrapNotSet : "<Оноохгүй>",
DlgCellWordWrapYes : "Тийм",
DlgCellWordWrapNo : "Үгүй",
DlgCellHorAlign : "Босоо эгнээ",
DlgCellHorAlignNotSet : "<Оноохгүй>",
DlgCellHorAlignLeft : "Зүүн",
DlgCellHorAlignCenter : "Төв",
DlgCellHorAlignRight: "Баруун",
DlgCellVerAlign : "Хөндлөн эгнээ",
DlgCellVerAlignNotSet : "<Оноохгүй>",
DlgCellVerAlignTop : "Дээд тал",
DlgCellVerAlignMiddle : "Дунд",
DlgCellVerAlignBottom : "Доод тал",
DlgCellVerAlignBaseline : "Baseline",
DlgCellType : "Cell Type", //MISSING
DlgCellTypeData : "Data", //MISSING
DlgCellTypeHeader : "Header", //MISSING
DlgCellRowSpan : "Нийт мөр (span)",
DlgCellCollSpan : "Нийт багана (span)",
DlgCellBackColor : "Фонны өнгө",
DlgCellBorderColor : "Хүрээний өнгө",
DlgCellBtnSelect : "Сонго...",
// Find and Replace Dialog
DlgFindAndReplaceTitle : "Хай мөн Дарж бич",
// Find Dialog
DlgFindTitle : "Хайх",
DlgFindFindBtn : "Хайх",
DlgFindNotFoundMsg : "Хайсан текст олсонгүй.",
// Replace Dialog
DlgReplaceTitle : "Солих",
DlgReplaceFindLbl : "Хайх үг/үсэг:",
DlgReplaceReplaceLbl : "Солих үг:",
DlgReplaceCaseChk : "Тэнцэх төлөв",
DlgReplaceReplaceBtn : "Солих",
DlgReplaceReplAllBtn : "Бүгдийг нь Солих",
DlgReplaceWordChk : "Тэнцэх бүтэн үг",
// Paste Operations / Dialog
PasteErrorCut : "Таны browser-ын хамгаалалтын тохиргоо editor-д автоматаар хайчлах үйлдэлийг зөвшөөрөхгүй байна. (Ctrl+X) товчны хослолыг ашиглана уу.",
PasteErrorCopy : "Таны browser-ын хамгаалалтын тохиргоо editor-д автоматаар хуулах үйлдэлийг зөвшөөрөхгүй байна. (Ctrl+C) товчны хослолыг ашиглана уу.",
PasteAsText : "Plain Text-ээс буулгах",
PasteFromWord : "Word-оос буулгах",
DlgPasteMsg2 : "(<strong>Ctrl+V</strong>) товчийг ашиглан paste хийнэ үү. Мөн <strong>OK</strong> дар.",
DlgPasteSec : "Таны үзүүлэгч/browser/-н хамгаалалтын тохиргооноос болоод editor clipboard өгөгдөлрүү шууд хандах боломжгүй. Энэ цонход дахин paste хийхийг оролд.",
DlgPasteIgnoreFont : "Тодорхойлогдсон Font Face зөвшөөрнө",
DlgPasteRemoveStyles : "Тодорхойлогдсон загварыг авах",
// Color Picker
ColorAutomatic : "Автоматаар",
ColorMoreColors : "Нэмэлт өнгөнүүд...",
// Document Properties
DocProps : "Баримт бичиг шинж чанар",
// Anchor Dialog
DlgAnchorTitle : "Холбоос шинж чанар",
DlgAnchorName : "Холбоос нэр",
DlgAnchorErrorName : "Холбоос төрөл оруулна уу",
// Speller Pages Dialog
DlgSpellNotInDic : "Толь бичиггүй",
DlgSpellChangeTo : "Өөрчлөх",
DlgSpellBtnIgnore : "Зөвшөөрөх",
DlgSpellBtnIgnoreAll : "Бүгдийг зөвшөөрөх",
DlgSpellBtnReplace : "Дарж бичих",
DlgSpellBtnReplaceAll : "Бүгдийг Дарж бичих",
DlgSpellBtnUndo : "Буцаах",
DlgSpellNoSuggestions : "- Тайлбаргүй -",
DlgSpellProgress : "Дүрэм шалгаж байгаа үйл явц...",
DlgSpellNoMispell : "Дүрэм шалгаад дууссан: Алдаа олдсонгүй",
DlgSpellNoChanges : "Дүрэм шалгаад дууссан: үг өөрчлөгдөөгүй",
DlgSpellOneChange : "Дүрэм шалгаад дууссан: 1 үг өөрчлөгдсөн",
DlgSpellManyChanges : "Дүрэм шалгаад дууссан: %1 үг өөрчлөгдсөн",
IeSpellDownload : "Дүрэм шалгагч суугаагүй байна. Татаж авахыг хүсч байна уу?",
// Button Dialog
DlgButtonText : "Тэкст (Утга)",
DlgButtonType : "Төрөл",
DlgButtonTypeBtn : "Товч",
DlgButtonTypeSbm : "Submit",
DlgButtonTypeRst : "Болих",
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "Нэр",
DlgCheckboxValue : "Утга",
DlgCheckboxSelected : "Сонгогдсон",
// Form Dialog
DlgFormName : "Нэр",
DlgFormAction : "Үйлдэл",
DlgFormMethod : "Арга",
// Select Field Dialog
DlgSelectName : "Нэр",
DlgSelectValue : "Утга",
DlgSelectSize : "Хэмжээ",
DlgSelectLines : "Мөр",
DlgSelectChkMulti : "Олон сонголт зөвшөөрөх",
DlgSelectOpAvail : "Идвэхтэй сонголт",
DlgSelectOpText : "Тэкст",
DlgSelectOpValue : "Утга",
DlgSelectBtnAdd : "Нэмэх",
DlgSelectBtnModify : "Өөрчлөх",
DlgSelectBtnUp : "Дээш",
DlgSelectBtnDown : "Доош",
DlgSelectBtnSetValue : "Сонгогдсан утга оноох",
DlgSelectBtnDelete : "Устгах",
// Textarea Dialog
DlgTextareaName : "Нэр",
DlgTextareaCols : "Багана",
DlgTextareaRows : "Мөр",
// Text Field Dialog
DlgTextName : "Нэр",
DlgTextValue : "Утга",
DlgTextCharWidth : "Тэмдэгтын өргөн",
DlgTextMaxChars : "Хамгийн их тэмдэгт",
DlgTextType : "Төрөл",
DlgTextTypeText : "Текст",
DlgTextTypePass : "Нууц үг",
// Hidden Field Dialog
DlgHiddenName : "Нэр",
DlgHiddenValue : "Утга",
// Bulleted List Dialog
BulletedListProp : "Bulleted жагсаалын шинж чанар",
NumberedListProp : "Дугаарласан жагсаалын шинж чанар",
DlgLstStart : "Эхлэх",
DlgLstType : "Төрөл",
DlgLstTypeCircle : "Тойрог",
DlgLstTypeDisc : "Тайлбар",
DlgLstTypeSquare : "Square",
DlgLstTypeNumbers : "Тоо (1, 2, 3)",
DlgLstTypeLCase : "Жижиг үсэг (a, b, c)",
DlgLstTypeUCase : "Том үсэг (A, B, C)",
DlgLstTypeSRoman : "Жижиг Ром тоо (i, ii, iii)",
DlgLstTypeLRoman : "Том Ром тоо (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "Ерөнхий",
DlgDocBackTab : "Фоно",
DlgDocColorsTab : "Захын зай ба Өнгө",
DlgDocMetaTab : "Meta өгөгдөл",
DlgDocPageTitle : "Хуудасны гарчиг",
DlgDocLangDir : "Хэлний чиглэл",
DlgDocLangDirLTR : "Зүүнээс баруунруу (LTR)",
DlgDocLangDirRTL : "Баруунаас зүүнрүү (RTL)",
DlgDocLangCode : "Хэлний код",
DlgDocCharSet : "Encoding тэмдэгт",
DlgDocCharSetCE : "Төв европ",
DlgDocCharSetCT : "Хятадын уламжлалт (Big5)",
DlgDocCharSetCR : "Крил",
DlgDocCharSetGR : "Гред",
DlgDocCharSetJP : "Япон",
DlgDocCharSetKR : "Солонгос",
DlgDocCharSetTR : "Tурк",
DlgDocCharSetUN : "Юникод (UTF-8)",
DlgDocCharSetWE : "Баруун европ",
DlgDocCharSetOther : "Encoding-д өөр тэмдэгт оноох",
DlgDocDocType : "Баримт бичгийн төрөл Heading",
DlgDocDocTypeOther : "Бусад баримт бичгийн төрөл Heading",
DlgDocIncXHTML : "XHTML агуулж зарлах",
DlgDocBgColor : "Фоно өнгө",
DlgDocBgImage : "Фоно зурагны URL",
DlgDocBgNoScroll : "Гүйдэггүй фоно",
DlgDocCText : "Текст",
DlgDocCLink : "Линк",
DlgDocCVisited : "Зочилсон линк",
DlgDocCActive : "Идвэхитэй линк",
DlgDocMargins : "Хуудасны захын зай",
DlgDocMaTop : "Дээд тал",
DlgDocMaLeft : "Зүүн тал",
DlgDocMaRight : "Баруун тал",
DlgDocMaBottom : "Доод тал",
DlgDocMeIndex : "Баримт бичгийн индекс түлхүүр үг (таслалаар тусгаарлагдана)",
DlgDocMeDescr : "Баримт бичгийн тайлбар",
DlgDocMeAuthor : "Зохиогч",
DlgDocMeCopy : "Зохиогчийн эрх",
DlgDocPreview : "Харах",
// Templates Dialog
Templates : "Загварууд",
DlgTemplatesTitle : "Загварын агуулга",
DlgTemplatesSelMsg : "Загварыг нээж editor-рүү сонгож оруулна уу<br />(Одоогийн агууллагыг устаж магадгүй):",
DlgTemplatesLoading : "Загваруудыг ачааллаж байна. Түр хүлээнэ үү...",
DlgTemplatesNoTpl : "(Загвар тодорхойлогдоогүй байна)",
DlgTemplatesReplace : "Одоогийн агууллагыг дарж бичих",
// About Dialog
DlgAboutAboutTab : "Тухай",
DlgAboutBrowserInfoTab : "Мэдээлэл үзүүлэгч",
DlgAboutLicenseTab : "Лиценз",
DlgAboutVersion : "Хувилбар",
DlgAboutInfo : "Мэдээллээр туслах",
// Div Dialog
DlgDivGeneralTab : "General", //MISSING
DlgDivAdvancedTab : "Advanced", //MISSING
DlgDivStyle : "Style", //MISSING
DlgDivInlineStyle : "Inline Style", //MISSING
ScaytTitle : "SCAYT", //MISSING
ScaytTitleOptions : "Options", //MISSING
ScaytTitleLangs : "Languages", //MISSING
ScaytTitleAbout : "About" //MISSING
};
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Romanian language file.
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "Ascunde bara cu opţiuni",
ToolbarExpand : "Expandează bara cu opţiuni",
// Toolbar Items and Context Menu
Save : "Salvează",
NewPage : "Pagină nouă",
Preview : "Previzualizare",
Cut : "Taie",
Copy : "Copiază",
Paste : "Adaugă",
PasteText : "Adaugă ca text simplu",
PasteWord : "Adaugă din Word",
Print : "Printează",
SelectAll : "Selectează tot",
RemoveFormat : "Înlătură formatarea",
InsertLinkLbl : "Link (Legătură web)",
InsertLink : "Inserează/Editează link (legătură web)",
RemoveLink : "Înlătură link (legătură web)",
VisitLink : "Open Link", //MISSING
Anchor : "Inserează/Editează ancoră",
AnchorDelete : "Şterge ancoră",
InsertImageLbl : "Imagine",
InsertImage : "Inserează/Editează imagine",
InsertFlashLbl : "Flash",
InsertFlash : "Inserează/Editează flash",
InsertTableLbl : "Tabel",
InsertTable : "Inserează/Editează tabel",
InsertLineLbl : "Linie",
InsertLine : "Inserează linie orizontă",
InsertSpecialCharLbl: "Caracter special",
InsertSpecialChar : "Inserează caracter special",
InsertSmileyLbl : "Figură expresivă (Emoticon)",
InsertSmiley : "Inserează Figură expresivă (Emoticon)",
About : "Despre FCKeditor",
Bold : "Îngroşat (bold)",
Italic : "Înclinat (italic)",
Underline : "Subliniat (underline)",
StrikeThrough : "Tăiat (strike through)",
Subscript : "Indice (subscript)",
Superscript : "Putere (superscript)",
LeftJustify : "Aliniere la stânga",
CenterJustify : "Aliniere centrală",
RightJustify : "Aliniere la dreapta",
BlockJustify : "Aliniere în bloc (Block Justify)",
DecreaseIndent : "Scade indentarea",
IncreaseIndent : "Creşte indentarea",
Blockquote : "Citat",
CreateDiv : "Create Div Container", //MISSING
EditDiv : "Edit Div Container", //MISSING
DeleteDiv : "Remove Div Container", //MISSING
Undo : "Starea anterioară (undo)",
Redo : "Starea ulterioară (redo)",
NumberedListLbl : "Listă numerotată",
NumberedList : "Inserează/Şterge listă numerotată",
BulletedListLbl : "Listă cu puncte",
BulletedList : "Inserează/Şterge listă cu puncte",
ShowTableBorders : "Arată marginile tabelului",
ShowDetails : "Arată detalii",
Style : "Stil",
FontFormat : "Formatare",
Font : "Font",
FontSize : "Mărime",
TextColor : "Culoarea textului",
BGColor : "Coloarea fundalului",
Source : "Sursa",
Find : "Găseşte",
Replace : "Înlocuieşte",
SpellCheck : "Verifică text",
UniversalKeyboard : "Tastatură universală",
PageBreakLbl : "Separator de pagină (Page Break)",
PageBreak : "Inserează separator de pagină (Page Break)",
Form : "Formular (Form)",
Checkbox : "Bifă (Checkbox)",
RadioButton : "Buton radio (RadioButton)",
TextField : "Câmp text (TextField)",
Textarea : "Suprafaţă text (Textarea)",
HiddenField : "Câmp ascuns (HiddenField)",
Button : "Buton",
SelectionField : "Câmp selecţie (SelectionField)",
ImageButton : "Buton imagine (ImageButton)",
FitWindow : "Maximizează mărimea editorului",
ShowBlocks : "Arată blocurile",
// Context Menu
EditLink : "Editează Link",
CellCM : "Celulă",
RowCM : "Linie",
ColumnCM : "Coloană",
InsertRowAfter : "Inserează linie după",
InsertRowBefore : "Inserează linie înainte",
DeleteRows : "Şterge linii",
InsertColumnAfter : "Inserează coloană după",
InsertColumnBefore : "Inserează coloană înainte",
DeleteColumns : "Şterge celule",
InsertCellAfter : "Inserează celulă după",
InsertCellBefore : "Inserează celulă înainte",
DeleteCells : "Şterge celule",
MergeCells : "Uneşte celule",
MergeRight : "Uneşte la dreapta",
MergeDown : "Uneşte jos",
HorizontalSplitCell : "Împarte celula pe orizontală",
VerticalSplitCell : "Împarte celula pe verticală",
TableDelete : "Şterge tabel",
CellProperties : "Proprietăţile celulei",
TableProperties : "Proprietăţile tabelului",
ImageProperties : "Proprietăţile imaginii",
FlashProperties : "Proprietăţile flash-ului",
AnchorProp : "Proprietăţi ancoră",
ButtonProp : "Proprietăţi buton",
CheckboxProp : "Proprietăţi bifă (Checkbox)",
HiddenFieldProp : "Proprietăţi câmp ascuns (Hidden Field)",
RadioButtonProp : "Proprietăţi buton radio (Radio Button)",
ImageButtonProp : "Proprietăţi buton imagine (Image Button)",
TextFieldProp : "Proprietăţi câmp text (Text Field)",
SelectionFieldProp : "Proprietăţi câmp selecţie (Selection Field)",
TextareaProp : "Proprietăţi suprafaţă text (Textarea)",
FormProp : "Proprietăţi formular (Form)",
FontFormats : "Normal;Formatted;Address;Heading 1;Heading 2;Heading 3;Heading 4;Heading 5;Heading 6;Normal (DIV)", //MISSING
// Alerts and Messages
ProcessingXHTML : "Procesăm XHTML. Vă rugăm aşteptaţi...",
Done : "Am terminat",
PasteWordConfirm : "Textul pe care doriţi să-l adăugaţi pare a fi formatat pentru Word. Doriţi să-l curăţaţi de această formatare înainte de a-l adăuga?",
NotCompatiblePaste : "Această facilitate e disponibilă doar pentru Microsoft Internet Explorer, versiunea 5.5 sau ulterioară. Vreţi să-l adăugaţi fără a-i fi înlăturat formatarea?",
UnknownToolbarItem : "Obiectul \"%1\" din bara cu opţiuni necunoscut",
UnknownCommand : "Comanda \"%1\" necunoscută",
NotImplemented : "Comandă neimplementată",
UnknownToolbarSet : "Grupul din bara cu opţiuni \"%1\" nu există",
NoActiveX : "Setările de securitate ale programului dvs. cu care navigaţi pe internet (browser) pot limita anumite funcţionalităţi ale editorului. Pentru a evita asta, trebuie să activaţi opţiunea \"Run ActiveX controls and plug-ins\". Poate veţi întâlni erori sau veţi observa funcţionalităţi lipsă.",
BrowseServerBlocked : "The resources browser could not be opened. Asiguraţi-vă că nu e activ niciun \"popup blocker\" (funcţionalitate a programului de navigat (browser) sau a unui plug-in al acestuia de a bloca deschiderea unui noi ferestre).",
DialogBlocked : "Nu a fost posibilă deschiderea unei ferestre de dialog. Asiguraţi-vă că nu e activ niciun \"popup blocker\" (funcţionalitate a programului de navigat (browser) sau a unui plug-in al acestuia de a bloca deschiderea unui noi ferestre).",
VisitLinkBlocked : "It was not possible to open a new window. Make sure all popup blockers are disabled.", //MISSING
// Dialogs
DlgBtnOK : "Bine",
DlgBtnCancel : "Anulare",
DlgBtnClose : "Închidere",
DlgBtnBrowseServer : "Răsfoieşte server",
DlgAdvancedTag : "Avansat",
DlgOpOther : "<Altul>",
DlgInfoTab : "Informaţii",
DlgAlertUrl : "Vă rugăm să scrieţi URL-ul",
// General Dialogs Labels
DlgGenNotSet : "<nesetat>",
DlgGenId : "Id",
DlgGenLangDir : "Direcţia cuvintelor",
DlgGenLangDirLtr : "stânga-dreapta (LTR)",
DlgGenLangDirRtl : "dreapta-stânga (RTL)",
DlgGenLangCode : "Codul limbii",
DlgGenAccessKey : "Tasta de acces",
DlgGenName : "Nume",
DlgGenTabIndex : "Indexul tabului",
DlgGenLongDescr : "Descrierea lungă URL",
DlgGenClass : "Clasele cu stilul paginii (CSS)",
DlgGenTitle : "Titlul consultativ",
DlgGenContType : "Tipul consultativ al titlului",
DlgGenLinkCharset : "Setul de caractere al resursei legate",
DlgGenStyle : "Stil",
// Image Dialog
DlgImgTitle : "Proprietăţile imaginii",
DlgImgInfoTab : "Informaţii despre imagine",
DlgImgBtnUpload : "Trimite la server",
DlgImgURL : "URL",
DlgImgUpload : "Încarcă",
DlgImgAlt : "Text alternativ",
DlgImgWidth : "Lăţime",
DlgImgHeight : "Înălţime",
DlgImgLockRatio : "Păstrează proporţiile",
DlgBtnResetSize : "Resetează mărimea",
DlgImgBorder : "Margine",
DlgImgHSpace : "HSpace",
DlgImgVSpace : "VSpace",
DlgImgAlign : "Aliniere",
DlgImgAlignLeft : "Stânga",
DlgImgAlignAbsBottom: "Jos absolut (Abs Bottom)",
DlgImgAlignAbsMiddle: "Mijloc absolut (Abs Middle)",
DlgImgAlignBaseline : "Linia de jos (Baseline)",
DlgImgAlignBottom : "Jos",
DlgImgAlignMiddle : "Mijloc",
DlgImgAlignRight : "Dreapta",
DlgImgAlignTextTop : "Text sus",
DlgImgAlignTop : "Sus",
DlgImgPreview : "Previzualizare",
DlgImgAlertUrl : "Vă rugăm să scrieţi URL-ul imaginii",
DlgImgLinkTab : "Link (Legătură web)",
// Flash Dialog
DlgFlashTitle : "Proprietăţile flash-ului",
DlgFlashChkPlay : "Rulează automat",
DlgFlashChkLoop : "Repetă (Loop)",
DlgFlashChkMenu : "Activează meniul flash",
DlgFlashScale : "Scală",
DlgFlashScaleAll : "Arată tot",
DlgFlashScaleNoBorder : "Fără margini (No border)",
DlgFlashScaleFit : "Potriveşte",
// Link Dialog
DlgLnkWindowTitle : "Link (Legătură web)",
DlgLnkInfoTab : "Informaţii despre link (Legătură web)",
DlgLnkTargetTab : "Ţintă (Target)",
DlgLnkType : "Tipul link-ului (al legăturii web)",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "Ancoră în această pagină",
DlgLnkTypeEMail : "E-Mail",
DlgLnkProto : "Protocol",
DlgLnkProtoOther : "<altul>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "Selectaţi o ancoră",
DlgLnkAnchorByName : "după numele ancorei",
DlgLnkAnchorById : "după Id-ul elementului",
DlgLnkNoAnchors : "(Nicio ancoră disponibilă în document)",
DlgLnkEMail : "Adresă de e-mail",
DlgLnkEMailSubject : "Subiectul mesajului",
DlgLnkEMailBody : "Conţinutul mesajului",
DlgLnkUpload : "Încarcă",
DlgLnkBtnUpload : "Trimite la server",
DlgLnkTarget : "Ţintă (Target)",
DlgLnkTargetFrame : "<frame>",
DlgLnkTargetPopup : "<fereastra popup>",
DlgLnkTargetBlank : "Fereastră nouă (_blank)",
DlgLnkTargetParent : "Fereastra părinte (_parent)",
DlgLnkTargetSelf : "Aceeaşi fereastră (_self)",
DlgLnkTargetTop : "Fereastra din topul ierarhiei (_top)",
DlgLnkTargetFrameName : "Numele frame-ului ţintă",
DlgLnkPopWinName : "Numele ferestrei popup",
DlgLnkPopWinFeat : "Proprietăţile ferestrei popup",
DlgLnkPopResize : "Scalabilă",
DlgLnkPopLocation : "Bara de locaţie",
DlgLnkPopMenu : "Bara de meniu",
DlgLnkPopScroll : "Scroll Bars",
DlgLnkPopStatus : "Bara de status",
DlgLnkPopToolbar : "Bara de opţiuni",
DlgLnkPopFullScrn : "Tot ecranul (Full Screen)(IE)",
DlgLnkPopDependent : "Dependent (Netscape)",
DlgLnkPopWidth : "Lăţime",
DlgLnkPopHeight : "Înălţime",
DlgLnkPopLeft : "Poziţia la stânga",
DlgLnkPopTop : "Poziţia la dreapta",
DlnLnkMsgNoUrl : "Vă rugăm să scrieţi URL-ul",
DlnLnkMsgNoEMail : "Vă rugăm să scrieţi adresa de e-mail",
DlnLnkMsgNoAnchor : "Vă rugăm să selectaţi o ancoră",
DlnLnkMsgInvPopName : "Numele 'popup'-ului trebuie să înceapă cu un caracter alfabetic şi trebuie să nu conţină spaţii",
// Color Dialog
DlgColorTitle : "Selectează culoare",
DlgColorBtnClear : "Curăţă",
DlgColorHighlight : "Subliniază (Highlight)",
DlgColorSelected : "Selectat",
// Smiley Dialog
DlgSmileyTitle : "Inserează o figură expresivă (Emoticon)",
// Special Character Dialog
DlgSpecialCharTitle : "Selectează caracter special",
// Table Dialog
DlgTableTitle : "Proprietăţile tabelului",
DlgTableRows : "Linii",
DlgTableColumns : "Coloane",
DlgTableBorder : "Mărimea marginii",
DlgTableAlign : "Aliniament",
DlgTableAlignNotSet : "<Nesetat>",
DlgTableAlignLeft : "Stânga",
DlgTableAlignCenter : "Centru",
DlgTableAlignRight : "Dreapta",
DlgTableWidth : "Lăţime",
DlgTableWidthPx : "pixeli",
DlgTableWidthPc : "procente",
DlgTableHeight : "Înălţime",
DlgTableCellSpace : "Spaţiu între celule",
DlgTableCellPad : "Spaţiu în cadrul celulei",
DlgTableCaption : "Titlu (Caption)",
DlgTableSummary : "Rezumat",
DlgTableHeaders : "Headers", //MISSING
DlgTableHeadersNone : "None", //MISSING
DlgTableHeadersColumn : "First column", //MISSING
DlgTableHeadersRow : "First Row", //MISSING
DlgTableHeadersBoth : "Both", //MISSING
// Table Cell Dialog
DlgCellTitle : "Proprietăţile celulei",
DlgCellWidth : "Lăţime",
DlgCellWidthPx : "pixeli",
DlgCellWidthPc : "procente",
DlgCellHeight : "Înălţime",
DlgCellWordWrap : "Desparte cuvintele (Wrap)",
DlgCellWordWrapNotSet : "<Nesetat>",
DlgCellWordWrapYes : "Da",
DlgCellWordWrapNo : "Nu",
DlgCellHorAlign : "Aliniament orizontal",
DlgCellHorAlignNotSet : "<Nesetat>",
DlgCellHorAlignLeft : "Stânga",
DlgCellHorAlignCenter : "Centru",
DlgCellHorAlignRight: "Dreapta",
DlgCellVerAlign : "Aliniament vertical",
DlgCellVerAlignNotSet : "<Nesetat>",
DlgCellVerAlignTop : "Sus",
DlgCellVerAlignMiddle : "Mijloc",
DlgCellVerAlignBottom : "Jos",
DlgCellVerAlignBaseline : "Linia de jos (Baseline)",
DlgCellType : "Cell Type", //MISSING
DlgCellTypeData : "Data", //MISSING
DlgCellTypeHeader : "Header", //MISSING
DlgCellRowSpan : "Lungimea în linii (Span)",
DlgCellCollSpan : "Lungimea în coloane (Span)",
DlgCellBackColor : "Culoarea fundalului",
DlgCellBorderColor : "Culoarea marginii",
DlgCellBtnSelect : "Selectaţi...",
// Find and Replace Dialog
DlgFindAndReplaceTitle : "Găseşte şi înlocuieşte",
// Find Dialog
DlgFindTitle : "Găseşte",
DlgFindFindBtn : "Găseşte",
DlgFindNotFoundMsg : "Textul specificat nu a fost găsit.",
// Replace Dialog
DlgReplaceTitle : "Replace",
DlgReplaceFindLbl : "Găseşte:",
DlgReplaceReplaceLbl : "Înlocuieşte cu:",
DlgReplaceCaseChk : "Deosebeşte majuscule de minuscule (Match case)",
DlgReplaceReplaceBtn : "Înlocuieşte",
DlgReplaceReplAllBtn : "Înlocuieşte tot",
DlgReplaceWordChk : "Doar cuvintele întregi",
// Paste Operations / Dialog
PasteErrorCut : "Setările de securitate ale navigatorului (browser) pe care îl folosiţi nu permit editorului să execute automat operaţiunea de tăiere. Vă rugăm folosiţi tastatura (Ctrl+X).",
PasteErrorCopy : "Setările de securitate ale navigatorului (browser) pe care îl folosiţi nu permit editorului să execute automat operaţiunea de copiere. Vă rugăm folosiţi tastatura (Ctrl+C).",
PasteAsText : "Adaugă ca text simplu (Plain Text)",
PasteFromWord : "Adaugă din Word",
DlgPasteMsg2 : "Vă rugăm adăugaţi în căsuţa următoare folosind tastatura (<STRONG>Ctrl+V</STRONG>) şi apăsaţi <STRONG>OK</STRONG>.",
DlgPasteSec : "Din cauza setărilor de securitate ale programului dvs. cu care navigaţi pe internet (browser), editorul nu poate accesa direct datele din clipboard. Va trebui să adăugaţi din nou datele în această fereastră.",
DlgPasteIgnoreFont : "Ignoră definiţiile Font Face",
DlgPasteRemoveStyles : "Şterge definiţiile stilurilor",
// Color Picker
ColorAutomatic : "Automatic",
ColorMoreColors : "Mai multe culori...",
// Document Properties
DocProps : "Proprietăţile documentului",
// Anchor Dialog
DlgAnchorTitle : "Proprietăţile ancorei",
DlgAnchorName : "Numele ancorei",
DlgAnchorErrorName : "Vă rugăm scrieţi numele ancorei",
// Speller Pages Dialog
DlgSpellNotInDic : "Nu e în dicţionar",
DlgSpellChangeTo : "Schimbă în",
DlgSpellBtnIgnore : "Ignoră",
DlgSpellBtnIgnoreAll : "Ignoră toate",
DlgSpellBtnReplace : "Înlocuieşte",
DlgSpellBtnReplaceAll : "Înlocuieşte tot",
DlgSpellBtnUndo : "Starea anterioară (undo)",
DlgSpellNoSuggestions : "- Fără sugestii -",
DlgSpellProgress : "Verificarea textului în desfăşurare...",
DlgSpellNoMispell : "Verificarea textului terminată: Nicio greşeală găsită",
DlgSpellNoChanges : "Verificarea textului terminată: Niciun cuvânt modificat",
DlgSpellOneChange : "Verificarea textului terminată: Un cuvânt modificat",
DlgSpellManyChanges : "Verificarea textului terminată: 1% cuvinte modificate",
IeSpellDownload : "Unealta pentru verificat textul (Spell checker) neinstalată. Doriţi să o descărcaţi acum?",
// Button Dialog
DlgButtonText : "Text (Valoare)",
DlgButtonType : "Tip",
DlgButtonTypeBtn : "Button",
DlgButtonTypeSbm : "Submit",
DlgButtonTypeRst : "Reset",
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "Nume",
DlgCheckboxValue : "Valoare",
DlgCheckboxSelected : "Selectat",
// Form Dialog
DlgFormName : "Nume",
DlgFormAction : "Acţiune",
DlgFormMethod : "Metodă",
// Select Field Dialog
DlgSelectName : "Nume",
DlgSelectValue : "Valoare",
DlgSelectSize : "Mărime",
DlgSelectLines : "linii",
DlgSelectChkMulti : "Permite selecţii multiple",
DlgSelectOpAvail : "Opţiuni disponibile",
DlgSelectOpText : "Text",
DlgSelectOpValue : "Valoare",
DlgSelectBtnAdd : "Adaugă",
DlgSelectBtnModify : "Modifică",
DlgSelectBtnUp : "Sus",
DlgSelectBtnDown : "Jos",
DlgSelectBtnSetValue : "Setează ca valoare selectată",
DlgSelectBtnDelete : "Şterge",
// Textarea Dialog
DlgTextareaName : "Nume",
DlgTextareaCols : "Coloane",
DlgTextareaRows : "Linii",
// Text Field Dialog
DlgTextName : "Nume",
DlgTextValue : "Valoare",
DlgTextCharWidth : "Lărgimea caracterului",
DlgTextMaxChars : "Caractere maxime",
DlgTextType : "Tip",
DlgTextTypeText : "Text",
DlgTextTypePass : "Parolă",
// Hidden Field Dialog
DlgHiddenName : "Nume",
DlgHiddenValue : "Valoare",
// Bulleted List Dialog
BulletedListProp : "Proprietăţile listei punctate (Bulleted List)",
NumberedListProp : "Proprietăţile listei numerotate (Numbered List)",
DlgLstStart : "Start",
DlgLstType : "Tip",
DlgLstTypeCircle : "Cerc",
DlgLstTypeDisc : "Disc",
DlgLstTypeSquare : "Pătrat",
DlgLstTypeNumbers : "Numere (1, 2, 3)",
DlgLstTypeLCase : "Minuscule-litere mici (a, b, c)",
DlgLstTypeUCase : "Majuscule (A, B, C)",
DlgLstTypeSRoman : "Cifre romane mici (i, ii, iii)",
DlgLstTypeLRoman : "Cifre romane mari (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "General",
DlgDocBackTab : "Fundal",
DlgDocColorsTab : "Culori si margini",
DlgDocMetaTab : "Meta Data",
DlgDocPageTitle : "Titlul paginii",
DlgDocLangDir : "Descrierea limbii",
DlgDocLangDirLTR : "stânga-dreapta (LTR)",
DlgDocLangDirRTL : "dreapta-stânga (RTL)",
DlgDocLangCode : "Codul limbii",
DlgDocCharSet : "Encoding setului de caractere",
DlgDocCharSetCE : "Central european",
DlgDocCharSetCT : "Chinezesc tradiţional (Big5)",
DlgDocCharSetCR : "Chirilic",
DlgDocCharSetGR : "Grecesc",
DlgDocCharSetJP : "Japonez",
DlgDocCharSetKR : "Corean",
DlgDocCharSetTR : "Turcesc",
DlgDocCharSetUN : "Unicode (UTF-8)",
DlgDocCharSetWE : "Vest european",
DlgDocCharSetOther : "Alt encoding al setului de caractere",
DlgDocDocType : "Document Type Heading",
DlgDocDocTypeOther : "Alt Document Type Heading",
DlgDocIncXHTML : "Include declaraţii XHTML",
DlgDocBgColor : "Culoarea fundalului (Background Color)",
DlgDocBgImage : "URL-ul imaginii din fundal (Background Image URL)",
DlgDocBgNoScroll : "Fundal neflotant, fix (Nonscrolling Background)",
DlgDocCText : "Text",
DlgDocCLink : "Link (Legătură web)",
DlgDocCVisited : "Link (Legătură web) vizitat",
DlgDocCActive : "Link (Legătură web) activ",
DlgDocMargins : "Marginile paginii",
DlgDocMaTop : "Sus",
DlgDocMaLeft : "Stânga",
DlgDocMaRight : "Dreapta",
DlgDocMaBottom : "Jos",
DlgDocMeIndex : "Cuvinte cheie după care se va indexa documentul (separate prin virgulă)",
DlgDocMeDescr : "Descrierea documentului",
DlgDocMeAuthor : "Autor",
DlgDocMeCopy : "Drepturi de autor",
DlgDocPreview : "Previzualizare",
// Templates Dialog
Templates : "Template-uri (şabloane)",
DlgTemplatesTitle : "Template-uri (şabloane) de conţinut",
DlgTemplatesSelMsg : "Vă rugăm selectaţi template-ul (şablonul) ce se va deschide în editor<br>(conţinutul actual va fi pierdut):",
DlgTemplatesLoading : "Se încarcă lista cu template-uri (şabloane). Vă rugăm aşteptaţi...",
DlgTemplatesNoTpl : "(Niciun template (şablon) definit)",
DlgTemplatesReplace : "Înlocuieşte cuprinsul actual",
// About Dialog
DlgAboutAboutTab : "Despre",
DlgAboutBrowserInfoTab : "Informaţii browser",
DlgAboutLicenseTab : "Licenţă",
DlgAboutVersion : "versiune",
DlgAboutInfo : "Pentru informaţii amănunţite, vizitaţi",
// Div Dialog
DlgDivGeneralTab : "General", //MISSING
DlgDivAdvancedTab : "Advanced", //MISSING
DlgDivStyle : "Style", //MISSING
DlgDivInlineStyle : "Inline Style", //MISSING
ScaytTitle : "SCAYT", //MISSING
ScaytTitleOptions : "Options", //MISSING
ScaytTitleLangs : "Languages", //MISSING
ScaytTitleAbout : "About" //MISSING
};
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Basque language file.
* Euskara hizkuntza fitxategia.
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "Estutu Tresna Barra",
ToolbarExpand : "Hedatu Tresna Barra",
// Toolbar Items and Context Menu
Save : "Gorde",
NewPage : "Orrialde Berria",
Preview : "Aurrebista",
Cut : "Ebaki",
Copy : "Kopiatu",
Paste : "Itsatsi",
PasteText : "Itsatsi testu bezala",
PasteWord : "Itsatsi Word-etik",
Print : "Inprimatu",
SelectAll : "Hautatu dena",
RemoveFormat : "Kendu Formatua",
InsertLinkLbl : "Esteka",
InsertLink : "Txertatu/Editatu Esteka",
RemoveLink : "Kendu Esteka",
VisitLink : "Ireki Esteka",
Anchor : "Aingura",
AnchorDelete : "Ezabatu Aingura",
InsertImageLbl : "Irudia",
InsertImage : "Txertatu/Editatu Irudia",
InsertFlashLbl : "Flasha",
InsertFlash : "Txertatu/Editatu Flasha",
InsertTableLbl : "Taula",
InsertTable : "Txertatu/Editatu Taula",
InsertLineLbl : "Lerroa",
InsertLine : "Txertatu Marra Horizontala",
InsertSpecialCharLbl: "Karaktere Berezia",
InsertSpecialChar : "Txertatu Karaktere Berezia",
InsertSmileyLbl : "Aurpegierak",
InsertSmiley : "Txertatu Aurpegierak",
About : "FCKeditor-ri buruz",
Bold : "Lodia",
Italic : "Etzana",
Underline : "Azpimarratu",
StrikeThrough : "Marratua",
Subscript : "Azpi-indize",
Superscript : "Goi-indize",
LeftJustify : "Lerrokatu Ezkerrean",
CenterJustify : "Lerrokatu Erdian",
RightJustify : "Lerrokatu Eskuman",
BlockJustify : "Justifikatu",
DecreaseIndent : "Txikitu Koska",
IncreaseIndent : "Handitu Koska",
Blockquote : "Aipamen blokea",
CreateDiv : "Sortu Div Edukitzailea",
EditDiv : "Editatu Div Edukitzailea",
DeleteDiv : "Ezabatu Div Edukitzailea",
Undo : "Desegin",
Redo : "Berregin",
NumberedListLbl : "Zenbakidun Zerrenda",
NumberedList : "Txertatu/Kendu Zenbakidun zerrenda",
BulletedListLbl : "Buletdun Zerrenda",
BulletedList : "Txertatu/Kendu Buletdun zerrenda",
ShowTableBorders : "Erakutsi Taularen Ertzak",
ShowDetails : "Erakutsi Xehetasunak",
Style : "Estiloa",
FontFormat : "Formatua",
Font : "Letra-tipoa",
FontSize : "Tamaina",
TextColor : "Testu Kolorea",
BGColor : "Atzeko kolorea",
Source : "HTML Iturburua",
Find : "Bilatu",
Replace : "Ordezkatu",
SpellCheck : "Ortografia",
UniversalKeyboard : "Teklatu Unibertsala",
PageBreakLbl : "Orrialde-jauzia",
PageBreak : "Txertatu Orrialde-jauzia",
Form : "Formularioa",
Checkbox : "Kontrol-laukia",
RadioButton : "Aukera-botoia",
TextField : "Testu Eremua",
Textarea : "Testu-area",
HiddenField : "Ezkutuko Eremua",
Button : "Botoia",
SelectionField : "Hautespen Eremua",
ImageButton : "Irudi Botoia",
FitWindow : "Maximizatu editorearen tamaina",
ShowBlocks : "Blokeak erakutsi",
// Context Menu
EditLink : "Aldatu Esteka",
CellCM : "Gelaxka",
RowCM : "Errenkada",
ColumnCM : "Zutabea",
InsertRowAfter : "Txertatu Lerroa Ostean",
InsertRowBefore : "Txertatu Lerroa Aurretik",
DeleteRows : "Ezabatu Errenkadak",
InsertColumnAfter : "Txertatu Zutabea Ostean",
InsertColumnBefore : "Txertatu Zutabea Aurretik",
DeleteColumns : "Ezabatu Zutabeak",
InsertCellAfter : "Txertatu Gelaxka Ostean",
InsertCellBefore : "Txertatu Gelaxka Aurretik",
DeleteCells : "Kendu Gelaxkak",
MergeCells : "Batu Gelaxkak",
MergeRight : "Elkartu Eskumara",
MergeDown : "Elkartu Behera",
HorizontalSplitCell : "Banatu Gelaxkak Horizontalki",
VerticalSplitCell : "Banatu Gelaxkak Bertikalki",
TableDelete : "Ezabatu Taula",
CellProperties : "Gelaxkaren Ezaugarriak",
TableProperties : "Taularen Ezaugarriak",
ImageProperties : "Irudiaren Ezaugarriak",
FlashProperties : "Flasharen Ezaugarriak",
AnchorProp : "Ainguraren Ezaugarriak",
ButtonProp : "Botoiaren Ezaugarriak",
CheckboxProp : "Kontrol-laukiko Ezaugarriak",
HiddenFieldProp : "Ezkutuko Eremuaren Ezaugarriak",
RadioButtonProp : "Aukera-botoiaren Ezaugarriak",
ImageButtonProp : "Irudi Botoiaren Ezaugarriak",
TextFieldProp : "Testu Eremuaren Ezaugarriak",
SelectionFieldProp : "Hautespen Eremuaren Ezaugarriak",
TextareaProp : "Testu-arearen Ezaugarriak",
FormProp : "Formularioaren Ezaugarriak",
FontFormats : "Arrunta;Formateatua;Helbidea;Izenburua 1;Izenburua 2;Izenburua 3;Izenburua 4;Izenburua 5;Izenburua 6;Paragrafoa (DIV)",
// Alerts and Messages
ProcessingXHTML : "XHTML Prozesatzen. Itxaron mesedez...",
Done : "Eginda",
PasteWordConfirm : "Itsatsi nahi duzun testua Wordetik hartua dela dirudi. Itsatsi baino lehen garbitu nahi duzu?",
NotCompatiblePaste : "Komando hau Internet Explorer 5.5 bertsiorako edo ondorengoentzako erabilgarria dago. Garbitu gabe itsatsi nahi duzu?",
UnknownToolbarItem : "Ataza barrako elementu ezezaguna \"%1\"",
UnknownCommand : "Komando izen ezezaguna \"%1\"",
NotImplemented : "Komando ez inplementatua",
UnknownToolbarSet : "Ataza barra \"%1\" taldea ez da existitzen",
NoActiveX : "Zure nabigatzailearen segurtasun hobespenak editore honen zenbait ezaugarri mugatu ditzake. \"ActiveX kontrolak eta pluginak\" aktibatu beharko zenituzke, bestela erroreak eta ezaugarrietan mugak egon daitezke.",
BrowseServerBlocked : "Baliabideen arakatzailea ezin da ireki. Ziurtatu popup blokeatzaileak desgaituta dituzula.",
DialogBlocked : "Ezin da elkarrizketa-leihoa ireki. Ziurtatu popup blokeatzaileak desgaituta dituzula.",
VisitLinkBlocked : "Ezin da leiho berri bat ireki. Ziurtatu popup blokeatzaileak desgaituta dituzula.",
// Dialogs
DlgBtnOK : "Ados",
DlgBtnCancel : "Utzi",
DlgBtnClose : "Itxi",
DlgBtnBrowseServer : "Zerbitzaria arakatu",
DlgAdvancedTag : "Aurreratua",
DlgOpOther : "<Bestelakoak>",
DlgInfoTab : "Informazioa",
DlgAlertUrl : "Mesedez URLa idatzi ezazu",
// General Dialogs Labels
DlgGenNotSet : "<Ezarri gabe>",
DlgGenId : "Id",
DlgGenLangDir : "Hizkuntzaren Norabidea",
DlgGenLangDirLtr : "Ezkerretik Eskumara(LTR)",
DlgGenLangDirRtl : "Eskumatik Ezkerrera (RTL)",
DlgGenLangCode : "Hizkuntza Kodea",
DlgGenAccessKey : "Sarbide-gakoa",
DlgGenName : "Izena",
DlgGenTabIndex : "Tabulazio Indizea",
DlgGenLongDescr : "URL Deskribapen Luzea",
DlgGenClass : "Estilo-orriko Klaseak",
DlgGenTitle : "Izenburua",
DlgGenContType : "Eduki Mota (Content Type)",
DlgGenLinkCharset : "Estekatutako Karaktere Multzoa",
DlgGenStyle : "Estiloa",
// Image Dialog
DlgImgTitle : "Irudi Ezaugarriak",
DlgImgInfoTab : "Irudi informazioa",
DlgImgBtnUpload : "Zerbitzarira bidalia",
DlgImgURL : "URL",
DlgImgUpload : "Gora Kargatu",
DlgImgAlt : "Ordezko Testua",
DlgImgWidth : "Zabalera",
DlgImgHeight : "Altuera",
DlgImgLockRatio : "Erlazioa Blokeatu",
DlgBtnResetSize : "Tamaina Berrezarri",
DlgImgBorder : "Ertza",
DlgImgHSpace : "HSpace",
DlgImgVSpace : "VSpace",
DlgImgAlign : "Lerrokatu",
DlgImgAlignLeft : "Ezkerrera",
DlgImgAlignAbsBottom: "Abs Behean",
DlgImgAlignAbsMiddle: "Abs Erdian",
DlgImgAlignBaseline : "Oinan",
DlgImgAlignBottom : "Behean",
DlgImgAlignMiddle : "Erdian",
DlgImgAlignRight : "Eskuman",
DlgImgAlignTextTop : "Testua Goian",
DlgImgAlignTop : "Goian",
DlgImgPreview : "Aurrebista",
DlgImgAlertUrl : "Mesedez Irudiaren URLa idatzi",
DlgImgLinkTab : "Esteka",
// Flash Dialog
DlgFlashTitle : "Flasharen Ezaugarriak",
DlgFlashChkPlay : "Automatikoki Erreproduzitu",
DlgFlashChkLoop : "Begizta",
DlgFlashChkMenu : "Flasharen Menua Gaitu",
DlgFlashScale : "Eskalatu",
DlgFlashScaleAll : "Dena erakutsi",
DlgFlashScaleNoBorder : "Ertzik gabe",
DlgFlashScaleFit : "Doitu",
// Link Dialog
DlgLnkWindowTitle : "Esteka",
DlgLnkInfoTab : "Estekaren Informazioa",
DlgLnkTargetTab : "Helburua",
DlgLnkType : "Esteka Mota",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "Aingura orrialde honetan",
DlgLnkTypeEMail : "ePosta",
DlgLnkProto : "Protokoloa",
DlgLnkProtoOther : "<Beste batzuk>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "Aingura bat hautatu",
DlgLnkAnchorByName : "Aingura izenagatik",
DlgLnkAnchorById : "Elementuaren ID-gatik",
DlgLnkNoAnchors : "(Ez daude aingurak eskuragarri dokumentuan)",
DlgLnkEMail : "ePosta Helbidea",
DlgLnkEMailSubject : "Mezuaren Gaia",
DlgLnkEMailBody : "Mezuaren Gorputza",
DlgLnkUpload : "Gora kargatu",
DlgLnkBtnUpload : "Zerbitzarira bidali",
DlgLnkTarget : "Target (Helburua)",
DlgLnkTargetFrame : "<marko>",
DlgLnkTargetPopup : "<popup leihoa>",
DlgLnkTargetBlank : "Leiho Berria (_blank)",
DlgLnkTargetParent : "Leiho Gurasoa (_parent)",
DlgLnkTargetSelf : "Leiho Berdina (_self)",
DlgLnkTargetTop : "Goiko Leihoa (_top)",
DlgLnkTargetFrameName : "Marko Helburuaren Izena",
DlgLnkPopWinName : "Popup Leihoaren Izena",
DlgLnkPopWinFeat : "Popup Leihoaren Ezaugarriak",
DlgLnkPopResize : "Tamaina Aldakorra",
DlgLnkPopLocation : "Kokaleku Barra",
DlgLnkPopMenu : "Menu Barra",
DlgLnkPopScroll : "Korritze Barrak",
DlgLnkPopStatus : "Egoera Barra",
DlgLnkPopToolbar : "Tresna Barra",
DlgLnkPopFullScrn : "Pantaila Osoa (IE)",
DlgLnkPopDependent : "Menpekoa (Netscape)",
DlgLnkPopWidth : "Zabalera",
DlgLnkPopHeight : "Altuera",
DlgLnkPopLeft : "Ezkerreko Posizioa",
DlgLnkPopTop : "Goiko Posizioa",
DlnLnkMsgNoUrl : "Mesedez URL esteka idatzi",
DlnLnkMsgNoEMail : "Mesedez ePosta helbidea idatzi",
DlnLnkMsgNoAnchor : "Mesedez aingura bat aukeratu",
DlnLnkMsgInvPopName : "Popup leihoaren izenak karaktere alfabetiko batekin hasi behar du eta eta ezin du zuriunerik izan",
// Color Dialog
DlgColorTitle : "Kolore Aukeraketa",
DlgColorBtnClear : "Garbitu",
DlgColorHighlight : "Nabarmendu",
DlgColorSelected : "Aukeratuta",
// Smiley Dialog
DlgSmileyTitle : "Aurpegiera Sartu",
// Special Character Dialog
DlgSpecialCharTitle : "Karaktere Berezia Aukeratu",
// Table Dialog
DlgTableTitle : "Taularen Ezaugarriak",
DlgTableRows : "Lerroak",
DlgTableColumns : "Zutabeak",
DlgTableBorder : "Ertzaren Zabalera",
DlgTableAlign : "Lerrokatu",
DlgTableAlignNotSet : "<Ezarri gabe>",
DlgTableAlignLeft : "Ezkerrean",
DlgTableAlignCenter : "Erdian",
DlgTableAlignRight : "Eskuman",
DlgTableWidth : "Zabalera",
DlgTableWidthPx : "pixel",
DlgTableWidthPc : "ehuneko",
DlgTableHeight : "Altuera",
DlgTableCellSpace : "Gelaxka arteko tartea",
DlgTableCellPad : "Gelaxken betegarria",
DlgTableCaption : "Epigrafea",
DlgTableSummary : "Laburpena",
DlgTableHeaders : "Headers", //MISSING
DlgTableHeadersNone : "None", //MISSING
DlgTableHeadersColumn : "First column", //MISSING
DlgTableHeadersRow : "First Row", //MISSING
DlgTableHeadersBoth : "Both", //MISSING
// Table Cell Dialog
DlgCellTitle : "Gelaxken Ezaugarriak",
DlgCellWidth : "Zabalera",
DlgCellWidthPx : "pixel",
DlgCellWidthPc : "ehuneko",
DlgCellHeight : "Altuera",
DlgCellWordWrap : "Itzulbira",
DlgCellWordWrapNotSet : "<Ezarri gabe>",
DlgCellWordWrapYes : "Bai",
DlgCellWordWrapNo : "Ez",
DlgCellHorAlign : "Lerrokatu Horizontalki",
DlgCellHorAlignNotSet : "<Ezarri gabe>",
DlgCellHorAlignLeft : "Ezkerrean",
DlgCellHorAlignCenter : "Erdian",
DlgCellHorAlignRight: "Eskuman",
DlgCellVerAlign : "Lerrokatu Bertikalki",
DlgCellVerAlignNotSet : "<Ezarri gabe>",
DlgCellVerAlignTop : "Goian",
DlgCellVerAlignMiddle : "Erdian",
DlgCellVerAlignBottom : "Behean",
DlgCellVerAlignBaseline : "Oinean",
DlgCellType : "Cell Type", //MISSING
DlgCellTypeData : "Data", //MISSING
DlgCellTypeHeader : "Header", //MISSING
DlgCellRowSpan : "Lerroak Hedatu",
DlgCellCollSpan : "Zutabeak Hedatu",
DlgCellBackColor : "Atzeko Kolorea",
DlgCellBorderColor : "Ertzako Kolorea",
DlgCellBtnSelect : "Aukeratu...",
// Find and Replace Dialog
DlgFindAndReplaceTitle : "Bilatu eta Ordeztu",
// Find Dialog
DlgFindTitle : "Bilaketa",
DlgFindFindBtn : "Bilatu",
DlgFindNotFoundMsg : "Idatzitako testua ez da topatu.",
// Replace Dialog
DlgReplaceTitle : "Ordeztu",
DlgReplaceFindLbl : "Zer bilatu:",
DlgReplaceReplaceLbl : "Zerekin ordeztu:",
DlgReplaceCaseChk : "Maiuskula/minuskula",
DlgReplaceReplaceBtn : "Ordeztu",
DlgReplaceReplAllBtn : "Ordeztu Guztiak",
DlgReplaceWordChk : "Esaldi osoa bilatu",
// Paste Operations / Dialog
PasteErrorCut : "Zure web nabigatzailearen segurtasun ezarpenak testuak automatikoki moztea ez dute baimentzen. Mesedez teklatua erabili ezazu (Ctrl+X).",
PasteErrorCopy : "Zure web nabigatzailearen segurtasun ezarpenak testuak automatikoki kopiatzea ez dute baimentzen. Mesedez teklatua erabili ezazu (Ctrl+C).",
PasteAsText : "Testu Arrunta bezala Itsatsi",
PasteFromWord : "Word-etik itsatsi",
DlgPasteMsg2 : "Mesedez teklatua erabilita (<STRONG>Ctrl+V</STRONG>) ondorego eremuan testua itsatsi eta <STRONG>OK</STRONG> sakatu.",
DlgPasteSec : "Nabigatzailearen segurtasun ezarpenak direla eta, editoreak ezin du arbela zuzenean erabili. Leiho honetan berriro itsatsi behar duzu.",
DlgPasteIgnoreFont : "Letra Motaren definizioa ezikusi",
DlgPasteRemoveStyles : "Estilo definizioak kendu",
// Color Picker
ColorAutomatic : "Automatikoa",
ColorMoreColors : "Kolore gehiago...",
// Document Properties
DocProps : "Dokumentuaren Ezarpenak",
// Anchor Dialog
DlgAnchorTitle : "Ainguraren Ezaugarriak",
DlgAnchorName : "Ainguraren Izena",
DlgAnchorErrorName : "Idatzi ainguraren izena",
// Speller Pages Dialog
DlgSpellNotInDic : "Ez dago hiztegian",
DlgSpellChangeTo : "Honekin ordezkatu",
DlgSpellBtnIgnore : "Ezikusi",
DlgSpellBtnIgnoreAll : "Denak Ezikusi",
DlgSpellBtnReplace : "Ordezkatu",
DlgSpellBtnReplaceAll : "Denak Ordezkatu",
DlgSpellBtnUndo : "Desegin",
DlgSpellNoSuggestions : "- Iradokizunik ez -",
DlgSpellProgress : "Zuzenketa ortografikoa martxan...",
DlgSpellNoMispell : "Zuzenketa ortografikoa bukatuta: Akatsik ez",
DlgSpellNoChanges : "Zuzenketa ortografikoa bukatuta: Ez da ezer aldatu",
DlgSpellOneChange : "Zuzenketa ortografikoa bukatuta: Hitz bat aldatu da",
DlgSpellManyChanges : "Zuzenketa ortografikoa bukatuta: %1 hitz aldatu dira",
IeSpellDownload : "Zuzentzaile ortografikoa ez dago instalatuta. Deskargatu nahi duzu?",
// Button Dialog
DlgButtonText : "Testua (Balorea)",
DlgButtonType : "Mota",
DlgButtonTypeBtn : "Botoia",
DlgButtonTypeSbm : "Bidali",
DlgButtonTypeRst : "Garbitu",
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "Izena",
DlgCheckboxValue : "Balorea",
DlgCheckboxSelected : "Hautatuta",
// Form Dialog
DlgFormName : "Izena",
DlgFormAction : "Ekintza",
DlgFormMethod : "Metodoa",
// Select Field Dialog
DlgSelectName : "Izena",
DlgSelectValue : "Balorea",
DlgSelectSize : "Tamaina",
DlgSelectLines : "lerro kopurura",
DlgSelectChkMulti : "Hautaketa anitzak baimendu",
DlgSelectOpAvail : "Aukera Eskuragarriak",
DlgSelectOpText : "Testua",
DlgSelectOpValue : "Balorea",
DlgSelectBtnAdd : "Gehitu",
DlgSelectBtnModify : "Aldatu",
DlgSelectBtnUp : "Gora",
DlgSelectBtnDown : "Behera",
DlgSelectBtnSetValue : "Aukeratutako balorea ezarri",
DlgSelectBtnDelete : "Ezabatu",
// Textarea Dialog
DlgTextareaName : "Izena",
DlgTextareaCols : "Zutabeak",
DlgTextareaRows : "Lerroak",
// Text Field Dialog
DlgTextName : "Izena",
DlgTextValue : "Balorea",
DlgTextCharWidth : "Zabalera",
DlgTextMaxChars : "Zenbat karaktere gehienez",
DlgTextType : "Mota",
DlgTextTypeText : "Testua",
DlgTextTypePass : "Pasahitza",
// Hidden Field Dialog
DlgHiddenName : "Izena",
DlgHiddenValue : "Balorea",
// Bulleted List Dialog
BulletedListProp : "Buletdun Zerrendaren Ezarpenak",
NumberedListProp : "Zenbakidun Zerrendaren Ezarpenak",
DlgLstStart : "Hasiera",
DlgLstType : "Mota",
DlgLstTypeCircle : "Zirkulua",
DlgLstTypeDisc : "Diskoa",
DlgLstTypeSquare : "Karratua",
DlgLstTypeNumbers : "Zenbakiak (1, 2, 3)",
DlgLstTypeLCase : "Letra xeheak (a, b, c)",
DlgLstTypeUCase : "Letra larriak (A, B, C)",
DlgLstTypeSRoman : "Erromatar zenbaki zeheak (i, ii, iii)",
DlgLstTypeLRoman : "Erromatar zenbaki larriak (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "Orokorra",
DlgDocBackTab : "Atzealdea",
DlgDocColorsTab : "Koloreak eta Marjinak",
DlgDocMetaTab : "Meta Informazioa",
DlgDocPageTitle : "Orriaren Izenburua",
DlgDocLangDir : "Hizkuntzaren Norabidea",
DlgDocLangDirLTR : "Ezkerretik eskumara (LTR)",
DlgDocLangDirRTL : "Eskumatik ezkerrera (RTL)",
DlgDocLangCode : "Hizkuntzaren Kodea",
DlgDocCharSet : "Karaktere Multzoaren Kodeketa",
DlgDocCharSetCE : "Erdialdeko Europakoa",
DlgDocCharSetCT : "Txinatar Tradizionala (Big5)",
DlgDocCharSetCR : "Zirilikoa",
DlgDocCharSetGR : "Grekoa",
DlgDocCharSetJP : "Japoniarra",
DlgDocCharSetKR : "Korearra",
DlgDocCharSetTR : "Turkiarra",
DlgDocCharSetUN : "Unicode (UTF-8)",
DlgDocCharSetWE : "Mendebaldeko Europakoa",
DlgDocCharSetOther : "Beste Karaktere Multzoko Kodeketa",
DlgDocDocType : "Document Type Goiburua",
DlgDocDocTypeOther : "Beste Document Type Goiburua",
DlgDocIncXHTML : "XHTML Ezarpenak",
DlgDocBgColor : "Atzeko Kolorea",
DlgDocBgImage : "Atzeko Irudiaren URL-a",
DlgDocBgNoScroll : "Korritze gabeko Atzealdea",
DlgDocCText : "Testua",
DlgDocCLink : "Estekak",
DlgDocCVisited : "Bisitatutako Estekak",
DlgDocCActive : "Esteka Aktiboa",
DlgDocMargins : "Orrialdearen marjinak",
DlgDocMaTop : "Goian",
DlgDocMaLeft : "Ezkerrean",
DlgDocMaRight : "Eskuman",
DlgDocMaBottom : "Behean",
DlgDocMeIndex : "Dokumentuaren Gako-hitzak (komarekin bananduta)",
DlgDocMeDescr : "Dokumentuaren Deskribapena",
DlgDocMeAuthor : "Egilea",
DlgDocMeCopy : "Copyright",
DlgDocPreview : "Aurrebista",
// Templates Dialog
Templates : "Txantiloiak",
DlgTemplatesTitle : "Eduki Txantiloiak",
DlgTemplatesSelMsg : "Mesedez txantiloia aukeratu editorean kargatzeko<br>(orain dauden edukiak galduko dira):",
DlgTemplatesLoading : "Txantiloiak kargatzen. Itxaron mesedez...",
DlgTemplatesNoTpl : "(Ez dago definitutako txantiloirik)",
DlgTemplatesReplace : "Ordeztu oraingo edukiak",
// About Dialog
DlgAboutAboutTab : "Honi buruz",
DlgAboutBrowserInfoTab : "Nabigatzailearen Informazioa",
DlgAboutLicenseTab : "Lizentzia",
DlgAboutVersion : "bertsioa",
DlgAboutInfo : "Informazio gehiago eskuratzeko hona joan",
// Div Dialog
DlgDivGeneralTab : "Orokorra",
DlgDivAdvancedTab : "Aurreratua",
DlgDivStyle : "Estiloa",
DlgDivInlineStyle : "Inline Estiloa",
ScaytTitle : "SCAYT", //MISSING
ScaytTitleOptions : "Options", //MISSING
ScaytTitleLangs : "Languages", //MISSING
ScaytTitleAbout : "About" //MISSING
};
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Turkish language file.
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "Araç Çubuğunu Kapat",
ToolbarExpand : "Araç Çubuğunu Aç",
// Toolbar Items and Context Menu
Save : "Kaydet",
NewPage : "Yeni Sayfa",
Preview : "Ön İzleme",
Cut : "Kes",
Copy : "Kopyala",
Paste : "Yapıştır",
PasteText : "Düzyazı Olarak Yapıştır",
PasteWord : "Word'den Yapıştır",
Print : "Yazdır",
SelectAll : "Tümünü Seç",
RemoveFormat : "Biçimi Kaldır",
InsertLinkLbl : "Köprü",
InsertLink : "Köprü Ekle/Düzenle",
RemoveLink : "Köprü Kaldır",
VisitLink : "Köprü Aç",
Anchor : "Çapa Ekle/Düzenle",
AnchorDelete : "Çapa Sil",
InsertImageLbl : "Resim",
InsertImage : "Resim Ekle/Düzenle",
InsertFlashLbl : "Flash",
InsertFlash : "Flash Ekle/Düzenle",
InsertTableLbl : "Tablo",
InsertTable : "Tablo Ekle/Düzenle",
InsertLineLbl : "Satır",
InsertLine : "Yatay Satır Ekle",
InsertSpecialCharLbl: "Özel Karakter",
InsertSpecialChar : "Özel Karakter Ekle",
InsertSmileyLbl : "İfade",
InsertSmiley : "İfade Ekle",
About : "FCKeditor Hakkında",
Bold : "Kalın",
Italic : "İtalik",
Underline : "Altı Çizgili",
StrikeThrough : "Üstü Çizgili",
Subscript : "Alt Simge",
Superscript : "Üst Simge",
LeftJustify : "Sola Dayalı",
CenterJustify : "Ortalanmış",
RightJustify : "Sağa Dayalı",
BlockJustify : "İki Kenara Yaslanmış",
DecreaseIndent : "Sekme Azalt",
IncreaseIndent : "Sekme Arttır",
Blockquote : "Blok Oluştur",
CreateDiv : "Div Ekle",
EditDiv : "Div Düzenle",
DeleteDiv : "Div Sil",
Undo : "Geri Al",
Redo : "Tekrarla",
NumberedListLbl : "Numaralı Liste",
NumberedList : "Numaralı Liste Ekle/Kaldır",
BulletedListLbl : "Simgeli Liste",
BulletedList : "Simgeli Liste Ekle/Kaldır",
ShowTableBorders : "Tablo Kenarlarını Göster",
ShowDetails : "Detayları Göster",
Style : "Biçem",
FontFormat : "Biçim",
Font : "Yazı Türü",
FontSize : "Boyut",
TextColor : "Yazı Rengi",
BGColor : "Arka Renk",
Source : "Kaynak",
Find : "Bul",
Replace : "Değiştir",
SpellCheck : "Yazım Denetimi",
UniversalKeyboard : "Evrensel Klavye",
PageBreakLbl : "Sayfa sonu",
PageBreak : "Sayfa Sonu Ekle",
Form : "Form",
Checkbox : "Onay Kutusu",
RadioButton : "Seçenek Düğmesi",
TextField : "Metin Girişi",
Textarea : "Çok Satırlı Metin",
HiddenField : "Gizli Veri",
Button : "Düğme",
SelectionField : "Seçim Menüsü",
ImageButton : "Resimli Düğme",
FitWindow : "Düzenleyici boyutunu büyüt",
ShowBlocks : "Blokları Göster",
// Context Menu
EditLink : "Köprü Düzenle",
CellCM : "Hücre",
RowCM : "Satır",
ColumnCM : "Sütun",
InsertRowAfter : "Satır Ekle - Sonra",
InsertRowBefore : "Satır Ekle - Önce",
DeleteRows : "Satır Sil",
InsertColumnAfter : "Kolon Ekle - Sonra",
InsertColumnBefore : "Kolon Ekle - Önce",
DeleteColumns : "Sütun Sil",
InsertCellAfter : "Hücre Ekle - Sonra",
InsertCellBefore : "Hücre Ekle - Önce",
DeleteCells : "Hücre Sil",
MergeCells : "Hücreleri Birleştir",
MergeRight : "Birleştir - Sağdaki İle ",
MergeDown : "Birleştir - Aşağıdaki İle ",
HorizontalSplitCell : "Hücreyi Yatay Böl",
VerticalSplitCell : "Hücreyi Dikey Böl",
TableDelete : "Tabloyu Sil",
CellProperties : "Hücre Özellikleri",
TableProperties : "Tablo Özellikleri",
ImageProperties : "Resim Özellikleri",
FlashProperties : "Flash Özellikleri",
AnchorProp : "Çapa Özellikleri",
ButtonProp : "Düğme Özellikleri",
CheckboxProp : "Onay Kutusu Özellikleri",
HiddenFieldProp : "Gizli Veri Özellikleri",
RadioButtonProp : "Seçenek Düğmesi Özellikleri",
ImageButtonProp : "Resimli Düğme Özellikleri",
TextFieldProp : "Metin Girişi Özellikleri",
SelectionFieldProp : "Seçim Menüsü Özellikleri",
TextareaProp : "Çok Satırlı Metin Özellikleri",
FormProp : "Form Özellikleri",
FontFormats : "Normal;Biçimli;Adres;Başlık 1;Başlık 2;Başlık 3;Başlık 4;Başlık 5;Başlık 6;Paragraf (DIV)",
// Alerts and Messages
ProcessingXHTML : "XHTML işleniyor. Lütfen bekleyin...",
Done : "Bitti",
PasteWordConfirm : "Yapıştırdığınız yazı Word'den gelmişe benziyor. Yapıştırmadan önce gereksiz eklentileri silmek ister misiniz?",
NotCompatiblePaste : "Bu komut Internet Explorer 5.5 ve ileriki sürümleri için mevcuttur. Temizlenmeden yapıştırılmasını ister misiniz ?",
UnknownToolbarItem : "Bilinmeyen araç çubugu öğesi \"%1\"",
UnknownCommand : "Bilinmeyen komut \"%1\"",
NotImplemented : "Komut uyarlanamadı",
UnknownToolbarSet : "\"%1\" araç çubuğu öğesi mevcut değil",
NoActiveX : "Kullandığınız tarayıcının güvenlik ayarları bazı özelliklerin kullanılmasını engelliyor. Bu özelliklerin çalışması için \"Run ActiveX controls and plug-ins (Activex ve eklentileri çalıştır)\" seçeneğinin aktif yapılması gerekiyor. Kullanılamayan eklentiler ve hatalar konusunda daha fazla bilgi sahibi olun.",
BrowseServerBlocked : "Kaynak tarayıcısı açılamadı. Tüm \"popup blocker\" programlarının devre dışı olduğundan emin olun. (Yahoo toolbar, Msn toolbar, Google toolbar gibi)",
DialogBlocked : "Diyalog açmak mümkün olmadı. Tüm \"Popup Blocker\" programlarının devre dışı olduğundan emin olun.",
VisitLinkBlocked : "Yeni pencere açmak mümkün olmadı. Tüm \"Popup Blocker\" programlarının devre dışı olduğundan emin olun",
// Dialogs
DlgBtnOK : "Tamam",
DlgBtnCancel : "İptal",
DlgBtnClose : "Kapat",
DlgBtnBrowseServer : "Sunucuyu Gez",
DlgAdvancedTag : "Gelişmiş",
DlgOpOther : "<Diğer>",
DlgInfoTab : "Bilgi",
DlgAlertUrl : "Lütfen URL girin",
// General Dialogs Labels
DlgGenNotSet : "<tanımlanmamış>",
DlgGenId : "Kimlik",
DlgGenLangDir : "Dil Yönü",
DlgGenLangDirLtr : "Soldan Sağa (LTR)",
DlgGenLangDirRtl : "Sağdan Sola (RTL)",
DlgGenLangCode : "Dil Kodlaması",
DlgGenAccessKey : "Erişim Tuşu",
DlgGenName : "Ad",
DlgGenTabIndex : "Sekme İndeksi",
DlgGenLongDescr : "Uzun Tanımlı URL",
DlgGenClass : "Biçem Sayfası Sınıfları",
DlgGenTitle : "Danışma Başlığı",
DlgGenContType : "Danışma İçerik Türü",
DlgGenLinkCharset : "Bağlı Kaynak Karakter Gurubu",
DlgGenStyle : "Biçem",
// Image Dialog
DlgImgTitle : "Resim Özellikleri",
DlgImgInfoTab : "Resim Bilgisi",
DlgImgBtnUpload : "Sunucuya Yolla",
DlgImgURL : "URL",
DlgImgUpload : "Karşıya Yükle",
DlgImgAlt : "Alternatif Yazı",
DlgImgWidth : "Genişlik",
DlgImgHeight : "Yükseklik",
DlgImgLockRatio : "Oranı Kilitle",
DlgBtnResetSize : "Boyutu Başa Döndür",
DlgImgBorder : "Kenar",
DlgImgHSpace : "Yatay Boşluk",
DlgImgVSpace : "Dikey Boşluk",
DlgImgAlign : "Hizalama",
DlgImgAlignLeft : "Sol",
DlgImgAlignAbsBottom: "Tam Altı",
DlgImgAlignAbsMiddle: "Tam Ortası",
DlgImgAlignBaseline : "Taban Çizgisi",
DlgImgAlignBottom : "Alt",
DlgImgAlignMiddle : "Orta",
DlgImgAlignRight : "Sağ",
DlgImgAlignTextTop : "Yazı Tepeye",
DlgImgAlignTop : "Tepe",
DlgImgPreview : "Ön İzleme",
DlgImgAlertUrl : "Lütfen resmin URL'sini yazınız",
DlgImgLinkTab : "Köprü",
// Flash Dialog
DlgFlashTitle : "Flash Özellikleri",
DlgFlashChkPlay : "Otomatik Oynat",
DlgFlashChkLoop : "Döngü",
DlgFlashChkMenu : "Flash Menüsünü Kullan",
DlgFlashScale : "Boyutlandır",
DlgFlashScaleAll : "Hepsini Göster",
DlgFlashScaleNoBorder : "Kenar Yok",
DlgFlashScaleFit : "Tam Sığdır",
// Link Dialog
DlgLnkWindowTitle : "Köprü",
DlgLnkInfoTab : "Köprü Bilgisi",
DlgLnkTargetTab : "Hedef",
DlgLnkType : "Köprü Türü",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "Bu sayfada çapa",
DlgLnkTypeEMail : "E-Posta",
DlgLnkProto : "Protokol",
DlgLnkProtoOther : "<diğer>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "Çapa Seç",
DlgLnkAnchorByName : "Çapa Adı ile",
DlgLnkAnchorById : "Eleman Kimlik Numarası ile",
DlgLnkNoAnchors : "(Bu belgede hiç çapa yok)",
DlgLnkEMail : "E-Posta Adresi",
DlgLnkEMailSubject : "İleti Konusu",
DlgLnkEMailBody : "İleti Gövdesi",
DlgLnkUpload : "Karşıya Yükle",
DlgLnkBtnUpload : "Sunucuya Gönder",
DlgLnkTarget : "Hedef",
DlgLnkTargetFrame : "<çerçeve>",
DlgLnkTargetPopup : "<yeni açılan pencere>",
DlgLnkTargetBlank : "Yeni Pencere(_blank)",
DlgLnkTargetParent : "Anne Pencere (_parent)",
DlgLnkTargetSelf : "Kendi Penceresi (_self)",
DlgLnkTargetTop : "En Üst Pencere (_top)",
DlgLnkTargetFrameName : "Hedef Çerçeve Adı",
DlgLnkPopWinName : "Yeni Açılan Pencere Adı",
DlgLnkPopWinFeat : "Yeni Açılan Pencere Özellikleri",
DlgLnkPopResize : "Boyutlandırılabilir",
DlgLnkPopLocation : "Yer Çubuğu",
DlgLnkPopMenu : "Menü Çubuğu",
DlgLnkPopScroll : "Kaydırma Çubukları",
DlgLnkPopStatus : "Durum Çubuğu",
DlgLnkPopToolbar : "Araç Çubuğu",
DlgLnkPopFullScrn : "Tam Ekran (IE)",
DlgLnkPopDependent : "Bağımlı (Netscape)",
DlgLnkPopWidth : "Genişlik",
DlgLnkPopHeight : "Yükseklik",
DlgLnkPopLeft : "Sola Göre Konum",
DlgLnkPopTop : "Yukarıya Göre Konum",
DlnLnkMsgNoUrl : "Lütfen köprü URL'sini yazın",
DlnLnkMsgNoEMail : "Lütfen E-posta adresini yazın",
DlnLnkMsgNoAnchor : "Lütfen bir çapa seçin",
DlnLnkMsgInvPopName : "Açılır pencere adı abecesel bir karakterle başlamalı ve boşluk içermemelidir",
// Color Dialog
DlgColorTitle : "Renk Seç",
DlgColorBtnClear : "Temizle",
DlgColorHighlight : "Vurgula",
DlgColorSelected : "Seçilmiş",
// Smiley Dialog
DlgSmileyTitle : "İfade Ekle",
// Special Character Dialog
DlgSpecialCharTitle : "Özel Karakter Seç",
// Table Dialog
DlgTableTitle : "Tablo Özellikleri",
DlgTableRows : "Satırlar",
DlgTableColumns : "Sütunlar",
DlgTableBorder : "Kenar Kalınlığı",
DlgTableAlign : "Hizalama",
DlgTableAlignNotSet : "<Tanımlanmamış>",
DlgTableAlignLeft : "Sol",
DlgTableAlignCenter : "Merkez",
DlgTableAlignRight : "Sağ",
DlgTableWidth : "Genişlik",
DlgTableWidthPx : "piksel",
DlgTableWidthPc : "yüzde",
DlgTableHeight : "Yükseklik",
DlgTableCellSpace : "Izgara kalınlığı",
DlgTableCellPad : "Izgara yazı arası",
DlgTableCaption : "Başlık",
DlgTableSummary : "Özet",
DlgTableHeaders : "Başlıklar",
DlgTableHeadersNone : "Yok",
DlgTableHeadersColumn : "İlk Sütun",
DlgTableHeadersRow : "İlk Satır",
DlgTableHeadersBoth : "Her İkisi",
// Table Cell Dialog
DlgCellTitle : "Hücre Özellikleri",
DlgCellWidth : "Genişlik",
DlgCellWidthPx : "piksel",
DlgCellWidthPc : "yüzde",
DlgCellHeight : "Yükseklik",
DlgCellWordWrap : "Sözcük Kaydır",
DlgCellWordWrapNotSet : "<Tanımlanmamış>",
DlgCellWordWrapYes : "Evet",
DlgCellWordWrapNo : "Hayır",
DlgCellHorAlign : "Yatay Hizalama",
DlgCellHorAlignNotSet : "<Tanımlanmamış>",
DlgCellHorAlignLeft : "Sol",
DlgCellHorAlignCenter : "Merkez",
DlgCellHorAlignRight: "Sağ",
DlgCellVerAlign : "Dikey Hizalama",
DlgCellVerAlignNotSet : "<Tanımlanmamış>",
DlgCellVerAlignTop : "Tepe",
DlgCellVerAlignMiddle : "Orta",
DlgCellVerAlignBottom : "Alt",
DlgCellVerAlignBaseline : "Taban Çizgisi",
DlgCellType : "Hücre Tipi",
DlgCellTypeData : "Veri",
DlgCellTypeHeader : "Başlık",
DlgCellRowSpan : "Satır Kapla",
DlgCellCollSpan : "Sütun Kapla",
DlgCellBackColor : "Arka Plan Rengi",
DlgCellBorderColor : "Kenar Rengi",
DlgCellBtnSelect : "Seç...",
// Find and Replace Dialog
DlgFindAndReplaceTitle : "Bul ve Değiştir",
// Find Dialog
DlgFindTitle : "Bul",
DlgFindFindBtn : "Bul",
DlgFindNotFoundMsg : "Belirtilen yazı bulunamadı.",
// Replace Dialog
DlgReplaceTitle : "Değiştir",
DlgReplaceFindLbl : "Aranan:",
DlgReplaceReplaceLbl : "Bununla değiştir:",
DlgReplaceCaseChk : "Büyük/küçük harf duyarlı",
DlgReplaceReplaceBtn : "Değiştir",
DlgReplaceReplAllBtn : "Tümünü Değiştir",
DlgReplaceWordChk : "Kelimenin tamamı uysun",
// Paste Operations / Dialog
PasteErrorCut : "Gezgin yazılımınızın güvenlik ayarları düzenleyicinin otomatik kesme işlemine izin vermiyor. İşlem için (Ctrl+X) tuşlarını kullanın.",
PasteErrorCopy : "Gezgin yazılımınızın güvenlik ayarları düzenleyicinin otomatik kopyalama işlemine izin vermiyor. İşlem için (Ctrl+C) tuşlarını kullanın.",
PasteAsText : "Düz Metin Olarak Yapıştır",
PasteFromWord : "Word'den yapıştır",
DlgPasteMsg2 : "Lütfen aşağıdaki kutunun içine yapıştırın. (<STRONG>Ctrl+V</STRONG>) ve <STRONG>Tamam</STRONG> butonunu tıklayın.",
DlgPasteSec : "Gezgin yazılımınızın güvenlik ayarları düzenleyicinin direkt olarak panoya erişimine izin vermiyor. Bu pencere içine tekrar yapıştırmalısınız..",
DlgPasteIgnoreFont : "Yazı Tipi tanımlarını yoksay",
DlgPasteRemoveStyles : "Biçem Tanımlarını çıkar",
// Color Picker
ColorAutomatic : "Otomatik",
ColorMoreColors : "Diğer renkler...",
// Document Properties
DocProps : "Belge Özellikleri",
// Anchor Dialog
DlgAnchorTitle : "Çapa Özellikleri",
DlgAnchorName : "Çapa Adı",
DlgAnchorErrorName : "Lütfen çapa için ad giriniz",
// Speller Pages Dialog
DlgSpellNotInDic : "Sözlükte Yok",
DlgSpellChangeTo : "Şuna değiştir:",
DlgSpellBtnIgnore : "Yoksay",
DlgSpellBtnIgnoreAll : "Tümünü Yoksay",
DlgSpellBtnReplace : "Değiştir",
DlgSpellBtnReplaceAll : "Tümünü Değiştir",
DlgSpellBtnUndo : "Geri Al",
DlgSpellNoSuggestions : "- Öneri Yok -",
DlgSpellProgress : "Yazım denetimi işlemde...",
DlgSpellNoMispell : "Yazım denetimi tamamlandı: Yanlış yazıma rastlanmadı",
DlgSpellNoChanges : "Yazım denetimi tamamlandı: Hiçbir kelime değiştirilmedi",
DlgSpellOneChange : "Yazım denetimi tamamlandı: Bir kelime değiştirildi",
DlgSpellManyChanges : "Yazım denetimi tamamlandı: %1 kelime değiştirildi",
IeSpellDownload : "Yazım denetimi yüklenmemiş. Şimdi yüklemek ister misiniz?",
// Button Dialog
DlgButtonText : "Metin (Değer)",
DlgButtonType : "Tip",
DlgButtonTypeBtn : "Düğme",
DlgButtonTypeSbm : "Gönder",
DlgButtonTypeRst : "Sıfırla",
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "Ad",
DlgCheckboxValue : "Değer",
DlgCheckboxSelected : "Seçili",
// Form Dialog
DlgFormName : "Ad",
DlgFormAction : "İşlem",
DlgFormMethod : "Yöntem",
// Select Field Dialog
DlgSelectName : "Ad",
DlgSelectValue : "Değer",
DlgSelectSize : "Boyut",
DlgSelectLines : "satır",
DlgSelectChkMulti : "Çoklu seçime izin ver",
DlgSelectOpAvail : "Mevcut Seçenekler",
DlgSelectOpText : "Metin",
DlgSelectOpValue : "Değer",
DlgSelectBtnAdd : "Ekle",
DlgSelectBtnModify : "Düzenle",
DlgSelectBtnUp : "Yukarı",
DlgSelectBtnDown : "Aşağı",
DlgSelectBtnSetValue : "Seçili değer olarak ata",
DlgSelectBtnDelete : "Sil",
// Textarea Dialog
DlgTextareaName : "Ad",
DlgTextareaCols : "Sütunlar",
DlgTextareaRows : "Satırlar",
// Text Field Dialog
DlgTextName : "Ad",
DlgTextValue : "Değer",
DlgTextCharWidth : "Karakter Genişliği",
DlgTextMaxChars : "En Fazla Karakter",
DlgTextType : "Tür",
DlgTextTypeText : "Metin",
DlgTextTypePass : "Parola",
// Hidden Field Dialog
DlgHiddenName : "Ad",
DlgHiddenValue : "Değer",
// Bulleted List Dialog
BulletedListProp : "Simgeli Liste Özellikleri",
NumberedListProp : "Numaralı Liste Özellikleri",
DlgLstStart : "Başlangıç",
DlgLstType : "Tip",
DlgLstTypeCircle : "Çember",
DlgLstTypeDisc : "Disk",
DlgLstTypeSquare : "Kare",
DlgLstTypeNumbers : "Sayılar (1, 2, 3)",
DlgLstTypeLCase : "Küçük Harfler (a, b, c)",
DlgLstTypeUCase : "Büyük Harfler (A, B, C)",
DlgLstTypeSRoman : "Küçük Romen Rakamları (i, ii, iii)",
DlgLstTypeLRoman : "Büyük Romen Rakamları (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "Genel",
DlgDocBackTab : "Arka Plan",
DlgDocColorsTab : "Renkler ve Kenar Boşlukları",
DlgDocMetaTab : "Tanım Bilgisi (Meta)",
DlgDocPageTitle : "Sayfa Başlığı",
DlgDocLangDir : "Dil Yönü",
DlgDocLangDirLTR : "Soldan Sağa (LTR)",
DlgDocLangDirRTL : "Sağdan Sola (RTL)",
DlgDocLangCode : "Dil Kodu",
DlgDocCharSet : "Karakter Kümesi Kodlaması",
DlgDocCharSetCE : "Orta Avrupa",
DlgDocCharSetCT : "Geleneksel Çince (Big5)",
DlgDocCharSetCR : "Kiril",
DlgDocCharSetGR : "Yunanca",
DlgDocCharSetJP : "Japonca",
DlgDocCharSetKR : "Korece",
DlgDocCharSetTR : "Türkçe",
DlgDocCharSetUN : "Unicode (UTF-8)",
DlgDocCharSetWE : "Batı Avrupa",
DlgDocCharSetOther : "Diğer Karakter Kümesi Kodlaması",
DlgDocDocType : "Belge Türü Başlığı",
DlgDocDocTypeOther : "Diğer Belge Türü Başlığı",
DlgDocIncXHTML : "XHTML Bildirimlerini Dahil Et",
DlgDocBgColor : "Arka Plan Rengi",
DlgDocBgImage : "Arka Plan Resim URLsi",
DlgDocBgNoScroll : "Sabit Arka Plan",
DlgDocCText : "Metin",
DlgDocCLink : "Köprü",
DlgDocCVisited : "Ziyaret Edilmiş Köprü",
DlgDocCActive : "Etkin Köprü",
DlgDocMargins : "Kenar Boşlukları",
DlgDocMaTop : "Tepe",
DlgDocMaLeft : "Sol",
DlgDocMaRight : "Sağ",
DlgDocMaBottom : "Alt",
DlgDocMeIndex : "Belge Dizinleme Anahtar Kelimeleri (virgülle ayrılmış)",
DlgDocMeDescr : "Belge Tanımı",
DlgDocMeAuthor : "Yazar",
DlgDocMeCopy : "Telif",
DlgDocPreview : "Ön İzleme",
// Templates Dialog
Templates : "Şablonlar",
DlgTemplatesTitle : "İçerik Şablonları",
DlgTemplatesSelMsg : "Düzenleyicide açmak için lütfen bir şablon seçin.<br>(hali hazırdaki içerik kaybolacaktır.):",
DlgTemplatesLoading : "Şablon listesi yüklenmekte. Lütfen bekleyiniz...",
DlgTemplatesNoTpl : "(Belirli bir şablon seçilmedi)",
DlgTemplatesReplace : "Mevcut içerik ile değiştir",
// About Dialog
DlgAboutAboutTab : "Hakkında",
DlgAboutBrowserInfoTab : "Gezgin Bilgisi",
DlgAboutLicenseTab : "Lisans",
DlgAboutVersion : "sürüm",
DlgAboutInfo : "Daha fazla bilgi için:",
// Div Dialog
DlgDivGeneralTab : "Genel",
DlgDivAdvancedTab : "Gelişmiş",
DlgDivStyle : "Sitil",
DlgDivInlineStyle : "Satıriçi Sitil",
ScaytTitle : "SCAYT", //MISSING
ScaytTitleOptions : "Options", //MISSING
ScaytTitleLangs : "Languages", //MISSING
ScaytTitleAbout : "About" //MISSING
};
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Norwegian Bokmål language file.
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "Skjul verktøylinje",
ToolbarExpand : "Vis verktøylinje",
// Toolbar Items and Context Menu
Save : "Lagre",
NewPage : "Ny Side",
Preview : "Forhåndsvis",
Cut : "Klipp ut",
Copy : "Kopier",
Paste : "Lim inn",
PasteText : "Lim inn som ren tekst",
PasteWord : "Lim inn fra Word",
Print : "Skriv ut",
SelectAll : "Merk alt",
RemoveFormat : "Fjern format",
InsertLinkLbl : "Lenke",
InsertLink : "Sett inn/Rediger lenke",
RemoveLink : "Fjern lenke",
VisitLink : "Åpne lenke",
Anchor : "Sett inn/Rediger anker",
AnchorDelete : "Fjern anker",
InsertImageLbl : "Bilde",
InsertImage : "Sett inn/Rediger bilde",
InsertFlashLbl : "Flash",
InsertFlash : "Sett inn/Rediger Flash",
InsertTableLbl : "Tabell",
InsertTable : "Sett inn/Rediger tabell",
InsertLineLbl : "Linje",
InsertLine : "Sett inn horisontal linje",
InsertSpecialCharLbl: "Spesielt tegn",
InsertSpecialChar : "Sett inn spesielt tegn",
InsertSmileyLbl : "Smil",
InsertSmiley : "Sett inn smil",
About : "Om FCKeditor",
Bold : "Fet",
Italic : "Kursiv",
Underline : "Understrek",
StrikeThrough : "Gjennomstrek",
Subscript : "Senket skrift",
Superscript : "Hevet skrift",
LeftJustify : "Venstrejuster",
CenterJustify : "Midtjuster",
RightJustify : "Høyrejuster",
BlockJustify : "Blokkjuster",
DecreaseIndent : "Senk nivå",
IncreaseIndent : "Øk nivå",
Blockquote : "Blockquote", //MISSING
CreateDiv : "Create Div Container", //MISSING
EditDiv : "Edit Div Container", //MISSING
DeleteDiv : "Remove Div Container", //MISSING
Undo : "Angre",
Redo : "Gjør om",
NumberedListLbl : "Nummerert liste",
NumberedList : "Sett inn/Fjern nummerert liste",
BulletedListLbl : "Uordnet liste",
BulletedList : "Sett inn/Fjern uordnet liste",
ShowTableBorders : "Vis tabellrammer",
ShowDetails : "Vis detaljer",
Style : "Stil",
FontFormat : "Format",
Font : "Skrift",
FontSize : "Størrelse",
TextColor : "Tekstfarge",
BGColor : "Bakgrunnsfarge",
Source : "Kilde",
Find : "Søk",
Replace : "Erstatt",
SpellCheck : "Stavekontroll",
UniversalKeyboard : "Universelt tastatur",
PageBreakLbl : "Sideskift",
PageBreak : "Sett inn sideskift",
Form : "Skjema",
Checkbox : "Avmerkingsboks",
RadioButton : "Alternativknapp",
TextField : "Tekstboks",
Textarea : "Tekstområde",
HiddenField : "Skjult felt",
Button : "Knapp",
SelectionField : "Rullegardinliste",
ImageButton : "Bildeknapp",
FitWindow : "Maksimer størrelsen på redigeringsverktøyet",
ShowBlocks : "Show Blocks", //MISSING
// Context Menu
EditLink : "Rediger lenke",
CellCM : "Celle",
RowCM : "Rader",
ColumnCM : "Kolonne",
InsertRowAfter : "Sett inn rad etter",
InsertRowBefore : "Sett inn rad før",
DeleteRows : "Slett rader",
InsertColumnAfter : "Sett inn kolonne etter",
InsertColumnBefore : "Sett inn kolonne før",
DeleteColumns : "Slett kolonner",
InsertCellAfter : "Sett inn celle etter",
InsertCellBefore : "Sett inn celle før",
DeleteCells : "Slett celler",
MergeCells : "Slå sammen celler",
MergeRight : "Slå sammen høyre",
MergeDown : "Slå sammen ned",
HorizontalSplitCell : "Del celle horisontalt",
VerticalSplitCell : "Del celle vertikalt",
TableDelete : "Slett tabell",
CellProperties : "Egenskaper for celle",
TableProperties : "Egenskaper for tabell",
ImageProperties : "Egenskaper for bilde",
FlashProperties : "Egenskaper for Flash-objekt",
AnchorProp : "Egenskaper for anker",
ButtonProp : "Egenskaper for knapp",
CheckboxProp : "Egenskaper for avmerkingsboks",
HiddenFieldProp : "Egenskaper for skjult felt",
RadioButtonProp : "Egenskaper for alternativknapp",
ImageButtonProp : "Egenskaper for bildeknapp",
TextFieldProp : "Egenskaper for tekstfelt",
SelectionFieldProp : "Egenskaper for rullegardinliste",
TextareaProp : "Egenskaper for tekstområde",
FormProp : "Egenskaper for skjema",
FontFormats : "Normal;Formatert;Adresse;Tittel 1;Tittel 2;Tittel 3;Tittel 4;Tittel 5;Tittel 6;Normal (DIV)",
// Alerts and Messages
ProcessingXHTML : "Lager XHTML. Vennligst vent...",
Done : "Ferdig",
PasteWordConfirm : "Teksten du prøver å lime inn ser ut som om den kommer fra Word. Vil du rense den for unødvendig kode før du limer inn?",
NotCompatiblePaste : "Denne kommandoen er kun tilgjenglig for Internet Explorer versjon 5.5 eller bedre. Vil du fortsette uten å rense? (Du kan lime inn som ren tekst)",
UnknownToolbarItem : "Ukjent menyvalg \"%1\"",
UnknownCommand : "Ukjent kommando \"%1\"",
NotImplemented : "Kommando ikke implimentert",
UnknownToolbarSet : "Verktøylinjesett \"%1\" finnes ikke",
NoActiveX : "Din nettlesers sikkerhetsinstillinger kan begrense noen av funksjonene i redigeringsverktøyet. Du må aktivere \"Kjør ActiveX-kontroller og plugin-modeller\". Du kan oppleve feil og advarsler om manglende funksjoner",
BrowseServerBlocked : "Kunne ikke åpne dialogboksen for filarkiv. Sjekk at popup-blokkering er deaktivert.",
DialogBlocked : "Kunne ikke åpne dialogboksen. Sjekk at popup-blokkering er deaktivert.",
VisitLinkBlocked : "Kunne ikke åpne et nytt vindu. Sjekk at popup-blokkering er deaktivert.",
// Dialogs
DlgBtnOK : "OK",
DlgBtnCancel : "Avbryt",
DlgBtnClose : "Lukk",
DlgBtnBrowseServer : "Bla igjennom server",
DlgAdvancedTag : "Avansert",
DlgOpOther : "<Annet>",
DlgInfoTab : "Info",
DlgAlertUrl : "Vennligst skriv inn URL-en",
// General Dialogs Labels
DlgGenNotSet : "<ikke satt>",
DlgGenId : "Id",
DlgGenLangDir : "Språkretning",
DlgGenLangDirLtr : "Venstre til høyre (VTH)",
DlgGenLangDirRtl : "Høyre til venstre (HTV)",
DlgGenLangCode : "Språkkode",
DlgGenAccessKey : "Aksessknapp",
DlgGenName : "Navn",
DlgGenTabIndex : "Tab Indeks",
DlgGenLongDescr : "Utvidet beskrivelse",
DlgGenClass : "Stilarkklasser",
DlgGenTitle : "Tittel",
DlgGenContType : "Type",
DlgGenLinkCharset : "Lenket språkkart",
DlgGenStyle : "Stil",
// Image Dialog
DlgImgTitle : "Bildeegenskaper",
DlgImgInfoTab : "Bildeinformasjon",
DlgImgBtnUpload : "Send det til serveren",
DlgImgURL : "URL",
DlgImgUpload : "Last opp",
DlgImgAlt : "Alternativ tekst",
DlgImgWidth : "Bredde",
DlgImgHeight : "Høyde",
DlgImgLockRatio : "Lås forhold",
DlgBtnResetSize : "Tilbakestill størrelse",
DlgImgBorder : "Ramme",
DlgImgHSpace : "HMarg",
DlgImgVSpace : "VMarg",
DlgImgAlign : "Juster",
DlgImgAlignLeft : "Venstre",
DlgImgAlignAbsBottom: "Abs bunn",
DlgImgAlignAbsMiddle: "Abs midten",
DlgImgAlignBaseline : "Bunnlinje",
DlgImgAlignBottom : "Bunn",
DlgImgAlignMiddle : "Midten",
DlgImgAlignRight : "Høyre",
DlgImgAlignTextTop : "Tekst topp",
DlgImgAlignTop : "Topp",
DlgImgPreview : "Forhåndsvis",
DlgImgAlertUrl : "Vennligst skriv bilde-urlen",
DlgImgLinkTab : "Lenke",
// Flash Dialog
DlgFlashTitle : "Flash-egenskaper",
DlgFlashChkPlay : "Autospill",
DlgFlashChkLoop : "Loop",
DlgFlashChkMenu : "Slå på Flash-meny",
DlgFlashScale : "Skaler",
DlgFlashScaleAll : "Vis alt",
DlgFlashScaleNoBorder : "Ingen ramme",
DlgFlashScaleFit : "Skaler til å passe",
// Link Dialog
DlgLnkWindowTitle : "Lenke",
DlgLnkInfoTab : "Lenkeinfo",
DlgLnkTargetTab : "Mål",
DlgLnkType : "Lenketype",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "Lenke til anker i teksten",
DlgLnkTypeEMail : "E-post",
DlgLnkProto : "Protokoll",
DlgLnkProtoOther : "<annet>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "Velg et anker",
DlgLnkAnchorByName : "Anker etter navn",
DlgLnkAnchorById : "Element etter ID",
DlgLnkNoAnchors : "(Ingen anker i dokumentet)",
DlgLnkEMail : "E-postadresse",
DlgLnkEMailSubject : "Meldingsemne",
DlgLnkEMailBody : "Melding",
DlgLnkUpload : "Last opp",
DlgLnkBtnUpload : "Send til server",
DlgLnkTarget : "Mål",
DlgLnkTargetFrame : "<ramme>",
DlgLnkTargetPopup : "<popup vindu>",
DlgLnkTargetBlank : "Nytt vindu (_blank)",
DlgLnkTargetParent : "Foreldrevindu (_parent)",
DlgLnkTargetSelf : "Samme vindu (_self)",
DlgLnkTargetTop : "Hele vindu (_top)",
DlgLnkTargetFrameName : "Målramme",
DlgLnkPopWinName : "Navn på popup-vindus",
DlgLnkPopWinFeat : "Egenskaper for popup-vindu",
DlgLnkPopResize : "Endre størrelse",
DlgLnkPopLocation : "Adresselinje",
DlgLnkPopMenu : "Menylinje",
DlgLnkPopScroll : "Scrollbar",
DlgLnkPopStatus : "Statuslinje",
DlgLnkPopToolbar : "Verktøylinje",
DlgLnkPopFullScrn : "Full skjerm (IE)",
DlgLnkPopDependent : "Avhenging (Netscape)",
DlgLnkPopWidth : "Bredde",
DlgLnkPopHeight : "Høyde",
DlgLnkPopLeft : "Venstre posisjon",
DlgLnkPopTop : "Topp-posisjon",
DlnLnkMsgNoUrl : "Vennligst skriv inn lenkens url",
DlnLnkMsgNoEMail : "Vennligst skriv inn e-postadressen",
DlnLnkMsgNoAnchor : "Vennligst velg et anker",
DlnLnkMsgInvPopName : "Popup-vinduets navn må begynne med en bokstav, og kan ikke inneholde mellomrom",
// Color Dialog
DlgColorTitle : "Velg farge",
DlgColorBtnClear : "Tøm",
DlgColorHighlight : "Marker",
DlgColorSelected : "Valgt",
// Smiley Dialog
DlgSmileyTitle : "Sett inn smil",
// Special Character Dialog
DlgSpecialCharTitle : "Velg spesielt tegn",
// Table Dialog
DlgTableTitle : "Egenskaper for tabell",
DlgTableRows : "Rader",
DlgTableColumns : "Kolonner",
DlgTableBorder : "Rammestørrelse",
DlgTableAlign : "Justering",
DlgTableAlignNotSet : "<Ikke satt>",
DlgTableAlignLeft : "Venstre",
DlgTableAlignCenter : "Midtjuster",
DlgTableAlignRight : "Høyre",
DlgTableWidth : "Bredde",
DlgTableWidthPx : "piksler",
DlgTableWidthPc : "prosent",
DlgTableHeight : "Høyde",
DlgTableCellSpace : "Cellemarg",
DlgTableCellPad : "Cellepolstring",
DlgTableCaption : "Tittel",
DlgTableSummary : "Sammendrag",
DlgTableHeaders : "Headers", //MISSING
DlgTableHeadersNone : "None", //MISSING
DlgTableHeadersColumn : "First column", //MISSING
DlgTableHeadersRow : "First Row", //MISSING
DlgTableHeadersBoth : "Both", //MISSING
// Table Cell Dialog
DlgCellTitle : "Celleegenskaper",
DlgCellWidth : "Bredde",
DlgCellWidthPx : "piksler",
DlgCellWidthPc : "prosent",
DlgCellHeight : "Høyde",
DlgCellWordWrap : "Tekstbrytning",
DlgCellWordWrapNotSet : "<Ikke satt>",
DlgCellWordWrapYes : "Ja",
DlgCellWordWrapNo : "Nei",
DlgCellHorAlign : "Horisontal justering",
DlgCellHorAlignNotSet : "<Ikke satt>",
DlgCellHorAlignLeft : "Venstre",
DlgCellHorAlignCenter : "Midtjuster",
DlgCellHorAlignRight: "Høyre",
DlgCellVerAlign : "Vertikal justering",
DlgCellVerAlignNotSet : "<Ikke satt>",
DlgCellVerAlignTop : "Topp",
DlgCellVerAlignMiddle : "Midten",
DlgCellVerAlignBottom : "Bunn",
DlgCellVerAlignBaseline : "Bunnlinje",
DlgCellType : "Cell Type", //MISSING
DlgCellTypeData : "Data", //MISSING
DlgCellTypeHeader : "Header", //MISSING
DlgCellRowSpan : "Radspenn",
DlgCellCollSpan : "Kolonnespenn",
DlgCellBackColor : "Bakgrunnsfarge",
DlgCellBorderColor : "Rammefarge",
DlgCellBtnSelect : "Velg...",
// Find and Replace Dialog
DlgFindAndReplaceTitle : "Søk og erstatt",
// Find Dialog
DlgFindTitle : "Søk",
DlgFindFindBtn : "Søk",
DlgFindNotFoundMsg : "Fant ikke søketeksten.",
// Replace Dialog
DlgReplaceTitle : "Erstatt",
DlgReplaceFindLbl : "Søk etter:",
DlgReplaceReplaceLbl : "Erstatt med:",
DlgReplaceCaseChk : "Skill mellom store og små bokstaver",
DlgReplaceReplaceBtn : "Erstatt",
DlgReplaceReplAllBtn : "Erstatt alle",
DlgReplaceWordChk : "Bare hele ord",
// Paste Operations / Dialog
PasteErrorCut : "Din nettlesers sikkerhetsinstillinger tillater ikke automatisk klipping av tekst. Vennligst bruk snareveien (Ctrl+X).",
PasteErrorCopy : "Din nettlesers sikkerhetsinstillinger tillater ikke automatisk kopiering av tekst. Vennligst bruk snareveien (Ctrl+C).",
PasteAsText : "Lim inn som ren tekst",
PasteFromWord : "Lim inn fra Word",
DlgPasteMsg2 : "Vennligst lim inn i den følgende boksen med tastaturet (<STRONG>Ctrl+V</STRONG>) og trykk <STRONG>OK</STRONG>.",
DlgPasteSec : "Din nettlesers sikkerhetsinstillinger gir ikke redigeringsverktøyet direkte tilgang til utklippstavlen. Du må lime det igjen i dette vinduet.",
DlgPasteIgnoreFont : "Fjern skrifttyper",
DlgPasteRemoveStyles : "Fjern stildefinisjoner",
// Color Picker
ColorAutomatic : "Automatisk",
ColorMoreColors : "Flere farger...",
// Document Properties
DocProps : "Dokumentegenskaper",
// Anchor Dialog
DlgAnchorTitle : "Ankeregenskaper",
DlgAnchorName : "Ankernavn",
DlgAnchorErrorName : "Vennligst skriv inn ankernavnet",
// Speller Pages Dialog
DlgSpellNotInDic : "Ikke i ordboken",
DlgSpellChangeTo : "Endre til",
DlgSpellBtnIgnore : "Ignorer",
DlgSpellBtnIgnoreAll : "Ignorer alle",
DlgSpellBtnReplace : "Erstatt",
DlgSpellBtnReplaceAll : "Erstatt alle",
DlgSpellBtnUndo : "Angre",
DlgSpellNoSuggestions : "- Ingen forslag -",
DlgSpellProgress : "Stavekontroll pågår...",
DlgSpellNoMispell : "Stavekontroll fullført: ingen feilstavinger funnet",
DlgSpellNoChanges : "Stavekontroll fullført: ingen ord endret",
DlgSpellOneChange : "Stavekontroll fullført: Ett ord endret",
DlgSpellManyChanges : "Stavekontroll fullført: %1 ord endret",
IeSpellDownload : "Stavekontroll er ikke installert. Vil du laste den ned nå?",
// Button Dialog
DlgButtonText : "Tekst (verdi)",
DlgButtonType : "Type",
DlgButtonTypeBtn : "Knapp",
DlgButtonTypeSbm : "Send",
DlgButtonTypeRst : "Nullstill",
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "Navn",
DlgCheckboxValue : "Verdi",
DlgCheckboxSelected : "Valgt",
// Form Dialog
DlgFormName : "Navn",
DlgFormAction : "Handling",
DlgFormMethod : "Metode",
// Select Field Dialog
DlgSelectName : "Navn",
DlgSelectValue : "Verdi",
DlgSelectSize : "Størrelse",
DlgSelectLines : "Linjer",
DlgSelectChkMulti : "Tillat flervalg",
DlgSelectOpAvail : "Tilgjenglige alternativer",
DlgSelectOpText : "Tekst",
DlgSelectOpValue : "Verdi",
DlgSelectBtnAdd : "Legg til",
DlgSelectBtnModify : "Endre",
DlgSelectBtnUp : "Opp",
DlgSelectBtnDown : "Ned",
DlgSelectBtnSetValue : "Sett som valgt",
DlgSelectBtnDelete : "Slett",
// Textarea Dialog
DlgTextareaName : "Navn",
DlgTextareaCols : "Kolonner",
DlgTextareaRows : "Rader",
// Text Field Dialog
DlgTextName : "Navn",
DlgTextValue : "Verdi",
DlgTextCharWidth : "Tegnbredde",
DlgTextMaxChars : "Maks antall tegn",
DlgTextType : "Type",
DlgTextTypeText : "Tekst",
DlgTextTypePass : "Passord",
// Hidden Field Dialog
DlgHiddenName : "Navn",
DlgHiddenValue : "Verdi",
// Bulleted List Dialog
BulletedListProp : "Egenskaper for uordnet liste",
NumberedListProp : "Egenskaper for ordnet liste",
DlgLstStart : "Start",
DlgLstType : "Type",
DlgLstTypeCircle : "Sirkel",
DlgLstTypeDisc : "Hel sirkel",
DlgLstTypeSquare : "Firkant",
DlgLstTypeNumbers : "Numre (1, 2, 3)",
DlgLstTypeLCase : "Små bokstaver (a, b, c)",
DlgLstTypeUCase : "Store bokstaver (A, B, C)",
DlgLstTypeSRoman : "Små romerske tall (i, ii, iii)",
DlgLstTypeLRoman : "Store romerske tall (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "Generelt",
DlgDocBackTab : "Bakgrunn",
DlgDocColorsTab : "Farger og marginer",
DlgDocMetaTab : "Meta-data",
DlgDocPageTitle : "Sidetittel",
DlgDocLangDir : "Språkretning",
DlgDocLangDirLTR : "Venstre til høyre (LTR)",
DlgDocLangDirRTL : "Høyre til venstre (RTL)",
DlgDocLangCode : "Språkkode",
DlgDocCharSet : "Tegnsett",
DlgDocCharSetCE : "Sentraleuropeisk",
DlgDocCharSetCT : "Tradisonell kinesisk(Big5)",
DlgDocCharSetCR : "Cyrillic",
DlgDocCharSetGR : "Gresk",
DlgDocCharSetJP : "Japansk",
DlgDocCharSetKR : "Koreansk",
DlgDocCharSetTR : "Tyrkisk",
DlgDocCharSetUN : "Unicode (UTF-8)",
DlgDocCharSetWE : "Vesteuropeisk",
DlgDocCharSetOther : "Annet tegnsett",
DlgDocDocType : "Dokumenttype header",
DlgDocDocTypeOther : "Annet dokumenttype header",
DlgDocIncXHTML : "Inkluder XHTML-deklarasjon",
DlgDocBgColor : "Bakgrunnsfarge",
DlgDocBgImage : "URL for bakgrunnsbilde",
DlgDocBgNoScroll : "Lås bakgrunnsbilde",
DlgDocCText : "Tekst",
DlgDocCLink : "Link",
DlgDocCVisited : "Besøkt lenke",
DlgDocCActive : "Aktiv lenke",
DlgDocMargins : "Sidemargin",
DlgDocMaTop : "Topp",
DlgDocMaLeft : "Venstre",
DlgDocMaRight : "Høyre",
DlgDocMaBottom : "Bunn",
DlgDocMeIndex : "Dokument nøkkelord (kommaseparert)",
DlgDocMeDescr : "Dokumentbeskrivelse",
DlgDocMeAuthor : "Forfatter",
DlgDocMeCopy : "Kopirett",
DlgDocPreview : "Forhåndsvising",
// Templates Dialog
Templates : "Maler",
DlgTemplatesTitle : "Innholdsmaler",
DlgTemplatesSelMsg : "Velg malen du vil åpne<br>(innholdet du har skrevet blir tapt!):",
DlgTemplatesLoading : "Laster malliste. Vennligst vent...",
DlgTemplatesNoTpl : "(Ingen maler definert)",
DlgTemplatesReplace : "Erstatt faktisk innold",
// About Dialog
DlgAboutAboutTab : "Om",
DlgAboutBrowserInfoTab : "Nettleserinfo",
DlgAboutLicenseTab : "Lisens",
DlgAboutVersion : "versjon",
DlgAboutInfo : "For mer informasjon, se",
// Div Dialog
DlgDivGeneralTab : "Generelt",
DlgDivAdvancedTab : "Avansert",
DlgDivStyle : "Stil",
DlgDivInlineStyle : "Inline Style", //MISSING
ScaytTitle : "SCAYT", //MISSING
ScaytTitleOptions : "Options", //MISSING
ScaytTitleLangs : "Languages", //MISSING
ScaytTitleAbout : "About" //MISSING
};
| JavaScript |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Russian language file.
*/
var FCKLang =
{
// Language direction : "ltr" (left to right) or "rtl" (right to left).
Dir : "ltr",
ToolbarCollapse : "Свернуть панель инструментов",
ToolbarExpand : "Развернуть панель инструментов",
// Toolbar Items and Context Menu
Save : "Сохранить",
NewPage : "Новая страница",
Preview : "Предварительный просмотр",
Cut : "Вырезать",
Copy : "Копировать",
Paste : "Вставить",
PasteText : "Вставить только текст",
PasteWord : "Вставить из Word",
Print : "Печать",
SelectAll : "Выделить все",
RemoveFormat : "Убрать форматирование",
InsertLinkLbl : "Ссылка",
InsertLink : "Вставить/Редактировать ссылку",
RemoveLink : "Убрать ссылку",
VisitLink : "Перейти по ссылке",
Anchor : "Вставить/Редактировать якорь",
AnchorDelete : "Убрать якорь",
InsertImageLbl : "Изображение",
InsertImage : "Вставить/Редактировать изображение",
InsertFlashLbl : "Flash",
InsertFlash : "Вставить/Редактировать Flash",
InsertTableLbl : "Таблица",
InsertTable : "Вставить/Редактировать таблицу",
InsertLineLbl : "Линия",
InsertLine : "Вставить горизонтальную линию",
InsertSpecialCharLbl: "Специальный символ",
InsertSpecialChar : "Вставить специальный символ",
InsertSmileyLbl : "Смайлик",
InsertSmiley : "Вставить смайлик",
About : "О FCKeditor",
Bold : "Жирный",
Italic : "Курсив",
Underline : "Подчеркнутый",
StrikeThrough : "Зачеркнутый",
Subscript : "Подстрочный индекс",
Superscript : "Надстрочный индекс",
LeftJustify : "По левому краю",
CenterJustify : "По центру",
RightJustify : "По правому краю",
BlockJustify : "По ширине",
DecreaseIndent : "Уменьшить отступ",
IncreaseIndent : "Увеличить отступ",
Blockquote : "Цитата",
CreateDiv : "Создать Div контейнер",
EditDiv : "Редактировать Div контейнер",
DeleteDiv : "Удалить Div контейнер",
Undo : "Отменить",
Redo : "Повторить",
NumberedListLbl : "Нумерованный список",
NumberedList : "Вставить/Удалить нумерованный список",
BulletedListLbl : "Маркированный список",
BulletedList : "Вставить/Удалить маркированный список",
ShowTableBorders : "Показать бордюры таблицы",
ShowDetails : "Показать детали",
Style : "Стиль",
FontFormat : "Форматирование",
Font : "Шрифт",
FontSize : "Размер",
TextColor : "Цвет текста",
BGColor : "Цвет фона",
Source : "Источник",
Find : "Найти",
Replace : "Заменить",
SpellCheck : "Проверить орфографию",
UniversalKeyboard : "Универсальная клавиатура",
PageBreakLbl : "Разрыв страницы",
PageBreak : "Вставить разрыв страницы",
Form : "Форма",
Checkbox : "Флаговая кнопка",
RadioButton : "Кнопка выбора",
TextField : "Текстовое поле",
Textarea : "Текстовая область",
HiddenField : "Скрытое поле",
Button : "Кнопка",
SelectionField : "Список",
ImageButton : "Кнопка с изображением",
FitWindow : "Развернуть окно редактора",
ShowBlocks : "Показать блоки",
// Context Menu
EditLink : "Вставить ссылку",
CellCM : "Ячейка",
RowCM : "Строка",
ColumnCM : "Колонка",
InsertRowAfter : "Вставить строку после",
InsertRowBefore : "Вставить строку до",
DeleteRows : "Удалить строки",
InsertColumnAfter : "Вставить колонку после",
InsertColumnBefore : "Вставить колонку до",
DeleteColumns : "Удалить колонки",
InsertCellAfter : "Вставить ячейку после",
InsertCellBefore : "Вставить ячейку до",
DeleteCells : "Удалить ячейки",
MergeCells : "Соединить ячейки",
MergeRight : "Соединить вправо",
MergeDown : "Соединить вниз",
HorizontalSplitCell : "Разбить ячейку горизонтально",
VerticalSplitCell : "Разбить ячейку вертикально",
TableDelete : "Удалить таблицу",
CellProperties : "Свойства ячейки",
TableProperties : "Свойства таблицы",
ImageProperties : "Свойства изображения",
FlashProperties : "Свойства Flash",
AnchorProp : "Свойства якоря",
ButtonProp : "Свойства кнопки",
CheckboxProp : "Свойства флаговой кнопки",
HiddenFieldProp : "Свойства скрытого поля",
RadioButtonProp : "Свойства кнопки выбора",
ImageButtonProp : "Свойства кнопки с изображением",
TextFieldProp : "Свойства текстового поля",
SelectionFieldProp : "Свойства списка",
TextareaProp : "Свойства текстовой области",
FormProp : "Свойства формы",
FontFormats : "Нормальный;Форматированный;Адрес;Заголовок 1;Заголовок 2;Заголовок 3;Заголовок 4;Заголовок 5;Заголовок 6;Нормальный (DIV)",
// Alerts and Messages
ProcessingXHTML : "Обработка XHTML. Пожалуйста, подождите...",
Done : "Сделано",
PasteWordConfirm : "Текст, который вы хотите вставить, похож на копируемый из Word. Вы хотите очистить его перед вставкой?",
NotCompatiblePaste : "Эта команда доступна для Internet Explorer версии 5.5 или выше. Вы хотите вставить без очистки?",
UnknownToolbarItem : "Не известный элемент панели инструментов \"%1\"",
UnknownCommand : "Не известное имя команды \"%1\"",
NotImplemented : "Команда не реализована",
UnknownToolbarSet : "Панель инструментов \"%1\" не существует",
NoActiveX : "Настройки безопасности вашего браузера могут ограничивать некоторые свойства редактора. Вы должны включить опцию \"Запускать элементы управления ActiveX и плугины\". Вы можете видеть ошибки и замечать отсутствие возможностей.",
BrowseServerBlocked : "Ресурсы браузера не могут быть открыты. Проверьте что блокировки всплывающих окон выключены.",
DialogBlocked : "Невозможно открыть окно диалога. Проверьте что блокировки всплывающих окон выключены.",
VisitLinkBlocked : "It was not possible to open a new window. Make sure all popup blockers are disabled.", //MISSING
// Dialogs
DlgBtnOK : "ОК",
DlgBtnCancel : "Отмена",
DlgBtnClose : "Закрыть",
DlgBtnBrowseServer : "Просмотреть на сервере",
DlgAdvancedTag : "Расширенный",
DlgOpOther : "<Другое>",
DlgInfoTab : "Информация",
DlgAlertUrl : "Пожалуйста, вставьте URL",
// General Dialogs Labels
DlgGenNotSet : "<не определено>",
DlgGenId : "Идентификатор",
DlgGenLangDir : "Направление языка",
DlgGenLangDirLtr : "Слева на право (LTR)",
DlgGenLangDirRtl : "Справа на лево (RTL)",
DlgGenLangCode : "Язык",
DlgGenAccessKey : "Горячая клавиша",
DlgGenName : "Имя",
DlgGenTabIndex : "Последовательность перехода",
DlgGenLongDescr : "Длинное описание URL",
DlgGenClass : "Класс CSS",
DlgGenTitle : "Заголовок",
DlgGenContType : "Тип содержимого",
DlgGenLinkCharset : "Кодировка",
DlgGenStyle : "Стиль CSS",
// Image Dialog
DlgImgTitle : "Свойства изображения",
DlgImgInfoTab : "Информация о изображении",
DlgImgBtnUpload : "Послать на сервер",
DlgImgURL : "URL",
DlgImgUpload : "Закачать",
DlgImgAlt : "Альтернативный текст",
DlgImgWidth : "Ширина",
DlgImgHeight : "Высота",
DlgImgLockRatio : "Сохранять пропорции",
DlgBtnResetSize : "Сбросить размер",
DlgImgBorder : "Бордюр",
DlgImgHSpace : "Горизонтальный отступ",
DlgImgVSpace : "Вертикальный отступ",
DlgImgAlign : "Выравнивание",
DlgImgAlignLeft : "По левому краю",
DlgImgAlignAbsBottom: "Абс понизу",
DlgImgAlignAbsMiddle: "Абс посередине",
DlgImgAlignBaseline : "По базовой линии",
DlgImgAlignBottom : "Понизу",
DlgImgAlignMiddle : "Посередине",
DlgImgAlignRight : "По правому краю",
DlgImgAlignTextTop : "Текст наверху",
DlgImgAlignTop : "По верху",
DlgImgPreview : "Предварительный просмотр",
DlgImgAlertUrl : "Пожалуйста, введите URL изображения",
DlgImgLinkTab : "Ссылка",
// Flash Dialog
DlgFlashTitle : "Свойства Flash",
DlgFlashChkPlay : "Авто проигрывание",
DlgFlashChkLoop : "Повтор",
DlgFlashChkMenu : "Включить меню Flash",
DlgFlashScale : "Масштабировать",
DlgFlashScaleAll : "Показывать все",
DlgFlashScaleNoBorder : "Без бордюра",
DlgFlashScaleFit : "Точное совпадение",
// Link Dialog
DlgLnkWindowTitle : "Ссылка",
DlgLnkInfoTab : "Информация ссылки",
DlgLnkTargetTab : "Цель",
DlgLnkType : "Тип ссылки",
DlgLnkTypeURL : "URL",
DlgLnkTypeAnchor : "Якорь на эту страницу",
DlgLnkTypeEMail : "Эл. почта",
DlgLnkProto : "Протокол",
DlgLnkProtoOther : "<другое>",
DlgLnkURL : "URL",
DlgLnkAnchorSel : "Выберите якорь",
DlgLnkAnchorByName : "По имени якоря",
DlgLnkAnchorById : "По идентификатору элемента",
DlgLnkNoAnchors : "(Нет якорей доступных в этом документе)",
DlgLnkEMail : "Адрес эл. почты",
DlgLnkEMailSubject : "Заголовок сообщения",
DlgLnkEMailBody : "Тело сообщения",
DlgLnkUpload : "Закачать",
DlgLnkBtnUpload : "Послать на сервер",
DlgLnkTarget : "Цель",
DlgLnkTargetFrame : "<фрейм>",
DlgLnkTargetPopup : "<всплывающее окно>",
DlgLnkTargetBlank : "Новое окно (_blank)",
DlgLnkTargetParent : "Родительское окно (_parent)",
DlgLnkTargetSelf : "Тоже окно (_self)",
DlgLnkTargetTop : "Самое верхнее окно (_top)",
DlgLnkTargetFrameName : "Имя целевого фрейма",
DlgLnkPopWinName : "Имя всплывающего окна",
DlgLnkPopWinFeat : "Свойства всплывающего окна",
DlgLnkPopResize : "Изменяющееся в размерах",
DlgLnkPopLocation : "Панель локации",
DlgLnkPopMenu : "Панель меню",
DlgLnkPopScroll : "Полосы прокрутки",
DlgLnkPopStatus : "Строка состояния",
DlgLnkPopToolbar : "Панель инструментов",
DlgLnkPopFullScrn : "Полный экран (IE)",
DlgLnkPopDependent : "Зависимый (Netscape)",
DlgLnkPopWidth : "Ширина",
DlgLnkPopHeight : "Высота",
DlgLnkPopLeft : "Позиция слева",
DlgLnkPopTop : "Позиция сверху",
DlnLnkMsgNoUrl : "Пожалуйста, введите URL ссылки",
DlnLnkMsgNoEMail : "Пожалуйста, введите адрес эл. почты",
DlnLnkMsgNoAnchor : "Пожалуйста, выберете якорь",
DlnLnkMsgInvPopName : "Название вспывающего окна должно начинаться буквы и не может содержать пробелов",
// Color Dialog
DlgColorTitle : "Выберите цвет",
DlgColorBtnClear : "Очистить",
DlgColorHighlight : "Подсвеченный",
DlgColorSelected : "Выбранный",
// Smiley Dialog
DlgSmileyTitle : "Вставить смайлик",
// Special Character Dialog
DlgSpecialCharTitle : "Выберите специальный символ",
// Table Dialog
DlgTableTitle : "Свойства таблицы",
DlgTableRows : "Строки",
DlgTableColumns : "Колонки",
DlgTableBorder : "Размер бордюра",
DlgTableAlign : "Выравнивание",
DlgTableAlignNotSet : "<Не уст.>",
DlgTableAlignLeft : "Слева",
DlgTableAlignCenter : "По центру",
DlgTableAlignRight : "Справа",
DlgTableWidth : "Ширина",
DlgTableWidthPx : "пикселей",
DlgTableWidthPc : "процентов",
DlgTableHeight : "Высота",
DlgTableCellSpace : "Промежуток (spacing)",
DlgTableCellPad : "Отступ (padding)",
DlgTableCaption : "Заголовок",
DlgTableSummary : "Резюме",
DlgTableHeaders : "Заголовки",
DlgTableHeadersNone : "Нет",
DlgTableHeadersColumn : "Первый столбец",
DlgTableHeadersRow : "Первая строка",
DlgTableHeadersBoth : "Оба варианта",
// Table Cell Dialog
DlgCellTitle : "Свойства ячейки",
DlgCellWidth : "Ширина",
DlgCellWidthPx : "пикселей",
DlgCellWidthPc : "процентов",
DlgCellHeight : "Высота",
DlgCellWordWrap : "Заворачивание текста",
DlgCellWordWrapNotSet : "<Не уст.>",
DlgCellWordWrapYes : "Да",
DlgCellWordWrapNo : "Нет",
DlgCellHorAlign : "Гор. выравнивание",
DlgCellHorAlignNotSet : "<Не уст.>",
DlgCellHorAlignLeft : "Слева",
DlgCellHorAlignCenter : "По центру",
DlgCellHorAlignRight: "Справа",
DlgCellVerAlign : "Верт. выравнивание",
DlgCellVerAlignNotSet : "<Не уст.>",
DlgCellVerAlignTop : "Сверху",
DlgCellVerAlignMiddle : "Посередине",
DlgCellVerAlignBottom : "Снизу",
DlgCellVerAlignBaseline : "По базовой линии",
DlgCellType : "Тип ячейки",
DlgCellTypeData : "Данные",
DlgCellTypeHeader : "Заголовок",
DlgCellRowSpan : "Диапазон строк (span)",
DlgCellCollSpan : "Диапазон колонок (span)",
DlgCellBackColor : "Цвет фона",
DlgCellBorderColor : "Цвет бордюра",
DlgCellBtnSelect : "Выберите...",
// Find and Replace Dialog
DlgFindAndReplaceTitle : "Найти и заменить",
// Find Dialog
DlgFindTitle : "Найти",
DlgFindFindBtn : "Найти",
DlgFindNotFoundMsg : "Указанный текст не найден.",
// Replace Dialog
DlgReplaceTitle : "Заменить",
DlgReplaceFindLbl : "Найти:",
DlgReplaceReplaceLbl : "Заменить на:",
DlgReplaceCaseChk : "Учитывать регистр",
DlgReplaceReplaceBtn : "Заменить",
DlgReplaceReplAllBtn : "Заменить все",
DlgReplaceWordChk : "Совпадение целых слов",
// Paste Operations / Dialog
PasteErrorCut : "Настройки безопасности вашего браузера не позволяют редактору автоматически выполнять операции вырезания. Пожалуйста, используйте клавиатуру для этого (Ctrl+X).",
PasteErrorCopy : "Настройки безопасности вашего браузера не позволяют редактору автоматически выполнять операции копирования. Пожалуйста, используйте клавиатуру для этого (Ctrl+C).",
PasteAsText : "Вставить только текст",
PasteFromWord : "Вставить из Word",
DlgPasteMsg2 : "Пожалуйста, вставьте текст в прямоугольник, используя сочетание клавиш (<STRONG>Ctrl+V</STRONG>), и нажмите <STRONG>OK</STRONG>.",
DlgPasteSec : "По причине настроек безопасности браузера, редактор не имеет доступа к данным буфера обмена напрямую. Вам необходимо вставить текст снова в это окно.",
DlgPasteIgnoreFont : "Игнорировать определения гарнитуры",
DlgPasteRemoveStyles : "Убрать определения стилей",
// Color Picker
ColorAutomatic : "Автоматический",
ColorMoreColors : "Цвета...",
// Document Properties
DocProps : "Свойства документа",
// Anchor Dialog
DlgAnchorTitle : "Свойства якоря",
DlgAnchorName : "Имя якоря",
DlgAnchorErrorName : "Пожалуйста, введите имя якоря",
// Speller Pages Dialog
DlgSpellNotInDic : "Нет в словаре",
DlgSpellChangeTo : "Заменить на",
DlgSpellBtnIgnore : "Игнорировать",
DlgSpellBtnIgnoreAll : "Игнорировать все",
DlgSpellBtnReplace : "Заменить",
DlgSpellBtnReplaceAll : "Заменить все",
DlgSpellBtnUndo : "Отменить",
DlgSpellNoSuggestions : "- Нет предположений -",
DlgSpellProgress : "Идет проверка орфографии...",
DlgSpellNoMispell : "Проверка орфографии закончена: ошибок не найдено",
DlgSpellNoChanges : "Проверка орфографии закончена: ни одного слова не изменено",
DlgSpellOneChange : "Проверка орфографии закончена: одно слово изменено",
DlgSpellManyChanges : "Проверка орфографии закончена: 1% слов изменен",
IeSpellDownload : "Модуль проверки орфографии не установлен. Хотите скачать его сейчас?",
// Button Dialog
DlgButtonText : "Текст (Значение)",
DlgButtonType : "Тип",
DlgButtonTypeBtn : "Кнопка",
DlgButtonTypeSbm : "Отправить",
DlgButtonTypeRst : "Сбросить",
// Checkbox and Radio Button Dialogs
DlgCheckboxName : "Имя",
DlgCheckboxValue : "Значение",
DlgCheckboxSelected : "Выбранная",
// Form Dialog
DlgFormName : "Имя",
DlgFormAction : "Действие",
DlgFormMethod : "Метод",
// Select Field Dialog
DlgSelectName : "Имя",
DlgSelectValue : "Значение",
DlgSelectSize : "Размер",
DlgSelectLines : "линии",
DlgSelectChkMulti : "Разрешить множественный выбор",
DlgSelectOpAvail : "Доступные варианты",
DlgSelectOpText : "Текст",
DlgSelectOpValue : "Значение",
DlgSelectBtnAdd : "Добавить",
DlgSelectBtnModify : "Модифицировать",
DlgSelectBtnUp : "Вверх",
DlgSelectBtnDown : "Вниз",
DlgSelectBtnSetValue : "Установить как выбранное значение",
DlgSelectBtnDelete : "Удалить",
// Textarea Dialog
DlgTextareaName : "Имя",
DlgTextareaCols : "Колонки",
DlgTextareaRows : "Строки",
// Text Field Dialog
DlgTextName : "Имя",
DlgTextValue : "Значение",
DlgTextCharWidth : "Ширина",
DlgTextMaxChars : "Макс. кол-во символов",
DlgTextType : "Тип",
DlgTextTypeText : "Текст",
DlgTextTypePass : "Пароль",
// Hidden Field Dialog
DlgHiddenName : "Имя",
DlgHiddenValue : "Значение",
// Bulleted List Dialog
BulletedListProp : "Свойства маркированного списка",
NumberedListProp : "Свойства нумерованного списка",
DlgLstStart : "Начало",
DlgLstType : "Тип",
DlgLstTypeCircle : "Круг",
DlgLstTypeDisc : "Диск",
DlgLstTypeSquare : "Квадрат",
DlgLstTypeNumbers : "Номера (1, 2, 3)",
DlgLstTypeLCase : "Буквы нижнего регистра (a, b, c)",
DlgLstTypeUCase : "Буквы верхнего регистра (A, B, C)",
DlgLstTypeSRoman : "Малые римские буквы (i, ii, iii)",
DlgLstTypeLRoman : "Большие римские буквы (I, II, III)",
// Document Properties Dialog
DlgDocGeneralTab : "Общие",
DlgDocBackTab : "Задний фон",
DlgDocColorsTab : "Цвета и отступы",
DlgDocMetaTab : "Мета данные",
DlgDocPageTitle : "Заголовок страницы",
DlgDocLangDir : "Направление текста",
DlgDocLangDirLTR : "Слева направо (LTR)",
DlgDocLangDirRTL : "Справа налево (RTL)",
DlgDocLangCode : "Код языка",
DlgDocCharSet : "Кодировка набора символов",
DlgDocCharSetCE : "Центрально-европейская",
DlgDocCharSetCT : "Китайская традиционная (Big5)",
DlgDocCharSetCR : "Кириллица",
DlgDocCharSetGR : "Греческая",
DlgDocCharSetJP : "Японская",
DlgDocCharSetKR : "Корейская",
DlgDocCharSetTR : "Турецкая",
DlgDocCharSetUN : "Юникод (UTF-8)",
DlgDocCharSetWE : "Западно-европейская",
DlgDocCharSetOther : "Другая кодировка набора символов",
DlgDocDocType : "Заголовок типа документа",
DlgDocDocTypeOther : "Другой заголовок типа документа",
DlgDocIncXHTML : "Включить XHTML объявления",
DlgDocBgColor : "Цвет фона",
DlgDocBgImage : "URL изображения фона",
DlgDocBgNoScroll : "Нескроллируемый фон",
DlgDocCText : "Текст",
DlgDocCLink : "Ссылка",
DlgDocCVisited : "Посещенная ссылка",
DlgDocCActive : "Активная ссылка",
DlgDocMargins : "Отступы страницы",
DlgDocMaTop : "Верхний",
DlgDocMaLeft : "Левый",
DlgDocMaRight : "Правый",
DlgDocMaBottom : "Нижний",
DlgDocMeIndex : "Ключевые слова документа (разделенные запятой)",
DlgDocMeDescr : "Описание документа",
DlgDocMeAuthor : "Автор",
DlgDocMeCopy : "Авторские права",
DlgDocPreview : "Предварительный просмотр",
// Templates Dialog
Templates : "Шаблоны",
DlgTemplatesTitle : "Шаблоны содержимого",
DlgTemplatesSelMsg : "Пожалуйста, выберете шаблон для открытия в редакторе<br>(текущее содержимое будет потеряно):",
DlgTemplatesLoading : "Загрузка списка шаблонов. Пожалуйста, подождите...",
DlgTemplatesNoTpl : "(Ни одного шаблона не определено)",
DlgTemplatesReplace : "Заменить текущее содержание",
// About Dialog
DlgAboutAboutTab : "О программе",
DlgAboutBrowserInfoTab : "Информация браузера",
DlgAboutLicenseTab : "Лицензия",
DlgAboutVersion : "Версия",
DlgAboutInfo : "Для большей информации, посетите",
// Div Dialog
DlgDivGeneralTab : "Информация",
DlgDivAdvancedTab : "Расширенные настройки",
DlgDivStyle : "Стиль",
DlgDivInlineStyle : "Встроенные стили",
ScaytTitle : "SCAYT", //MISSING
ScaytTitleOptions : "Options", //MISSING
ScaytTitleLangs : "Languages", //MISSING
ScaytTitleAbout : "About" //MISSING
};
| JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.