Normalize line endings VIVO-101

This commit is contained in:
Brian Caruso 2013-07-18 15:19:53 -04:00
parent b097a4d754
commit 54f79f2ea7
587 changed files with 91501 additions and 91501 deletions

File diff suppressed because it is too large Load diff

View file

@ -8,207 +8,207 @@
http://dojotoolkit.org/community/licensing.shtml
*/
/**
An implementation of Flash 8's ExternalInterface that works with Flash 6
and which is source-compatible with Flash 8.
@author Brad Neuberg, bkn3@columbia.edu
*/
class DojoExternalInterface{
public static var available:Boolean;
public static var dojoPath = "";
public static var _fscommandReady = false;
public static var _callbacks = new Array();
public static function initialize(){
//getURL("javascript:dojo.debug('FLASH:DojoExternalInterface initialize')");
// FIXME: Set available variable by testing for capabilities
DojoExternalInterface.available = true;
// extract the dojo base path
DojoExternalInterface.dojoPath = DojoExternalInterface.getDojoPath();
//getURL("javascript:dojo.debug('FLASH:dojoPath="+DojoExternalInterface.dojoPath+"')");
// Sometimes, on IE, the fscommand infrastructure can take a few hundred
// milliseconds the first time a page loads. Set a timer to keep checking
// to make sure we can issue fscommands; otherwise, our calls to fscommand
// for setCallback() and loaded() will just "disappear"
_root.fscommandReady = false;
var fsChecker = function(){
// issue a test fscommand
fscommand("fscommandReady");
// JavaScript should set _root.fscommandReady if it got the call
if(_root.fscommandReady == "true"){
DojoExternalInterface._fscommandReady = true;
clearInterval(_root.fsTimer);
}
};
_root.fsTimer = setInterval(fsChecker, 100);
}
public static function addCallback(methodName:String, instance:Object,
method:Function) : Boolean{
// A variable that indicates whether the call below succeeded
_root._succeeded = null;
// Callbacks are registered with the JavaScript side as follows.
// On the Flash side, we maintain a lookup table that associates
// the methodName with the actual instance and method that are
// associated with this method.
// Using fscommand, we send over the action "addCallback", with the
// argument being the methodName to add, such as "foobar".
// The JavaScript takes these values and registers the existence of
// this callback point.
// precede the method name with a _ character in case it starts
// with a number
_callbacks["_" + methodName] = {_instance: instance, _method: method};
_callbacks[_callbacks.length] = methodName;
// The API for ExternalInterface says we have to make sure the call
// succeeded; check to see if there is a value
// for _succeeded, which is set by the JavaScript side
if(_root._succeeded == null){
return false;
}else{
return true;
}
}
public static function call(methodName:String,
resultsCallback:Function) : Void{
// FIXME: support full JSON serialization
// First, we pack up all of the arguments to this call and set them
// as Flash variables, which the JavaScript side will unpack using
// plugin.GetVariable(). We set the number of arguments as "_numArgs",
// and add each argument as a variable, such as "_1", "_2", etc., starting
// from 0.
// We then execute an fscommand with the action "call" and the
// argument being the method name. JavaScript takes the method name,
// retrieves the arguments using GetVariable, executes the method,
// and then places the return result in a Flash variable
// named "_returnResult".
_root._numArgs = arguments.length - 2;
for(var i = 2; i < arguments.length; i++){
var argIndex = i - 2;
_root["_" + argIndex] = arguments[i];
}
_root._returnResult = undefined;
fscommand("call", methodName);
// immediately return if the caller is not waiting for return results
if(resultsCallback == undefined || resultsCallback == null){
return;
}
// check at regular intervals for return results
var resultsChecker = function(){
if(_root._returnResult != undefined){
clearInterval(_root._callbackID);
resultsCallback.call(null, _root._returnResult);
}
};
_root._callbackID = setInterval(resultsChecker, 100);
}
/**
Called by Flash to indicate to JavaScript that we are ready to have
our Flash functions called. Calling loaded()
will fire the dojo.flash.loaded() event, so that JavaScript can know that
Flash has finished loading and adding its callbacks, and can begin to
interact with the Flash file.
*/
public static function loaded(){
//getURL("javascript:dojo.debug('FLASH:loaded')");
// one more step: see if fscommands are ready to be executed; if not,
// set an interval that will keep running until fscommands are ready;
// make sure the gateway is loaded as well
var execLoaded = function(){
if(DojoExternalInterface._fscommandReady == true){
clearInterval(_root.loadedInterval);
// initialize the small Flash file that helps gateway JS to Flash
// calls
DojoExternalInterface._initializeFlashRunner();
}
};
if(_fscommandReady == true){
execLoaded();
}else{
_root.loadedInterval = setInterval(execLoaded, 50);
}
}
/**
Handles and executes a JavaScript to Flash method call. Used by
initializeFlashRunner.
*/
public static function _handleJSCall(){
// get our parameters
var numArgs = parseInt(_root._numArgs);
var jsArgs = new Array();
for(var i = 0; i < numArgs; i++){
var currentValue = _root["_" + i];
jsArgs.push(currentValue);
}
// get our function name
var functionName = _root._functionName;
// now get the actual instance and method object to execute on,
// using our lookup table that was constructed by calls to
// addCallback on initialization
var instance = _callbacks["_" + functionName]._instance;
var method = _callbacks["_" + functionName]._method;
// execute it
var results = method.apply(instance, jsArgs);
// return the results
_root._returnResult = results;
}
/** Called by the flash6_gateway.swf to indicate that it is loaded. */
public static function _gatewayReady(){
for(var i = 0; i < _callbacks.length; i++){
fscommand("addCallback", _callbacks[i]);
}
call("dojo.flash.loaded");
}
/**
When JavaScript wants to communicate with Flash it simply sets
the Flash variable "_execute" to true; this method creates the
internal Movie Clip, called the Flash Runner, that makes this
magic happen.
*/
public static function _initializeFlashRunner(){
// figure out where our Flash movie is
var swfLoc = DojoExternalInterface.dojoPath + "flash6_gateway.swf";
// load our gateway helper file
_root.createEmptyMovieClip("_flashRunner", 5000);
_root._flashRunner._lockroot = true;
_root._flashRunner.loadMovie(swfLoc);
}
private static function getDojoPath(){
var url = _root._url;
var start = url.indexOf("baseRelativePath=") + "baseRelativePath=".length;
var path = url.substring(start);
var end = path.indexOf("&");
if(end != -1){
path = path.substring(0, end);
}
return path;
}
}
// vim:ts=4:noet:tw=0:
/**
An implementation of Flash 8's ExternalInterface that works with Flash 6
and which is source-compatible with Flash 8.
@author Brad Neuberg, bkn3@columbia.edu
*/
class DojoExternalInterface{
public static var available:Boolean;
public static var dojoPath = "";
public static var _fscommandReady = false;
public static var _callbacks = new Array();
public static function initialize(){
//getURL("javascript:dojo.debug('FLASH:DojoExternalInterface initialize')");
// FIXME: Set available variable by testing for capabilities
DojoExternalInterface.available = true;
// extract the dojo base path
DojoExternalInterface.dojoPath = DojoExternalInterface.getDojoPath();
//getURL("javascript:dojo.debug('FLASH:dojoPath="+DojoExternalInterface.dojoPath+"')");
// Sometimes, on IE, the fscommand infrastructure can take a few hundred
// milliseconds the first time a page loads. Set a timer to keep checking
// to make sure we can issue fscommands; otherwise, our calls to fscommand
// for setCallback() and loaded() will just "disappear"
_root.fscommandReady = false;
var fsChecker = function(){
// issue a test fscommand
fscommand("fscommandReady");
// JavaScript should set _root.fscommandReady if it got the call
if(_root.fscommandReady == "true"){
DojoExternalInterface._fscommandReady = true;
clearInterval(_root.fsTimer);
}
};
_root.fsTimer = setInterval(fsChecker, 100);
}
public static function addCallback(methodName:String, instance:Object,
method:Function) : Boolean{
// A variable that indicates whether the call below succeeded
_root._succeeded = null;
// Callbacks are registered with the JavaScript side as follows.
// On the Flash side, we maintain a lookup table that associates
// the methodName with the actual instance and method that are
// associated with this method.
// Using fscommand, we send over the action "addCallback", with the
// argument being the methodName to add, such as "foobar".
// The JavaScript takes these values and registers the existence of
// this callback point.
// precede the method name with a _ character in case it starts
// with a number
_callbacks["_" + methodName] = {_instance: instance, _method: method};
_callbacks[_callbacks.length] = methodName;
// The API for ExternalInterface says we have to make sure the call
// succeeded; check to see if there is a value
// for _succeeded, which is set by the JavaScript side
if(_root._succeeded == null){
return false;
}else{
return true;
}
}
public static function call(methodName:String,
resultsCallback:Function) : Void{
// FIXME: support full JSON serialization
// First, we pack up all of the arguments to this call and set them
// as Flash variables, which the JavaScript side will unpack using
// plugin.GetVariable(). We set the number of arguments as "_numArgs",
// and add each argument as a variable, such as "_1", "_2", etc., starting
// from 0.
// We then execute an fscommand with the action "call" and the
// argument being the method name. JavaScript takes the method name,
// retrieves the arguments using GetVariable, executes the method,
// and then places the return result in a Flash variable
// named "_returnResult".
_root._numArgs = arguments.length - 2;
for(var i = 2; i < arguments.length; i++){
var argIndex = i - 2;
_root["_" + argIndex] = arguments[i];
}
_root._returnResult = undefined;
fscommand("call", methodName);
// immediately return if the caller is not waiting for return results
if(resultsCallback == undefined || resultsCallback == null){
return;
}
// check at regular intervals for return results
var resultsChecker = function(){
if(_root._returnResult != undefined){
clearInterval(_root._callbackID);
resultsCallback.call(null, _root._returnResult);
}
};
_root._callbackID = setInterval(resultsChecker, 100);
}
/**
Called by Flash to indicate to JavaScript that we are ready to have
our Flash functions called. Calling loaded()
will fire the dojo.flash.loaded() event, so that JavaScript can know that
Flash has finished loading and adding its callbacks, and can begin to
interact with the Flash file.
*/
public static function loaded(){
//getURL("javascript:dojo.debug('FLASH:loaded')");
// one more step: see if fscommands are ready to be executed; if not,
// set an interval that will keep running until fscommands are ready;
// make sure the gateway is loaded as well
var execLoaded = function(){
if(DojoExternalInterface._fscommandReady == true){
clearInterval(_root.loadedInterval);
// initialize the small Flash file that helps gateway JS to Flash
// calls
DojoExternalInterface._initializeFlashRunner();
}
};
if(_fscommandReady == true){
execLoaded();
}else{
_root.loadedInterval = setInterval(execLoaded, 50);
}
}
/**
Handles and executes a JavaScript to Flash method call. Used by
initializeFlashRunner.
*/
public static function _handleJSCall(){
// get our parameters
var numArgs = parseInt(_root._numArgs);
var jsArgs = new Array();
for(var i = 0; i < numArgs; i++){
var currentValue = _root["_" + i];
jsArgs.push(currentValue);
}
// get our function name
var functionName = _root._functionName;
// now get the actual instance and method object to execute on,
// using our lookup table that was constructed by calls to
// addCallback on initialization
var instance = _callbacks["_" + functionName]._instance;
var method = _callbacks["_" + functionName]._method;
// execute it
var results = method.apply(instance, jsArgs);
// return the results
_root._returnResult = results;
}
/** Called by the flash6_gateway.swf to indicate that it is loaded. */
public static function _gatewayReady(){
for(var i = 0; i < _callbacks.length; i++){
fscommand("addCallback", _callbacks[i]);
}
call("dojo.flash.loaded");
}
/**
When JavaScript wants to communicate with Flash it simply sets
the Flash variable "_execute" to true; this method creates the
internal Movie Clip, called the Flash Runner, that makes this
magic happen.
*/
public static function _initializeFlashRunner(){
// figure out where our Flash movie is
var swfLoc = DojoExternalInterface.dojoPath + "flash6_gateway.swf";
// load our gateway helper file
_root.createEmptyMovieClip("_flashRunner", 5000);
_root._flashRunner._lockroot = true;
_root._flashRunner.loadMovie(swfLoc);
}
private static function getDojoPath(){
var url = _root._url;
var start = url.indexOf("baseRelativePath=") + "baseRelativePath=".length;
var path = url.substring(start);
var end = path.indexOf("&");
if(end != -1){
path = path.substring(0, end);
}
return path;
}
}
// vim:ts=4:noet:tw=0:

View file

@ -8,227 +8,227 @@
http://dojotoolkit.org/community/licensing.shtml
*/
/**
A wrapper around Flash 8's ExternalInterface; DojoExternalInterface is needed so that we
can do a Flash 6 implementation of ExternalInterface, and be able
to support having a single codebase that uses DojoExternalInterface
across Flash versions rather than having two seperate source bases,
where one uses ExternalInterface and the other uses DojoExternalInterface.
DojoExternalInterface class does a variety of optimizations to bypass ExternalInterface's
unbelievably bad performance so that we can have good performance
on Safari; see the blog post
http://codinginparadise.org/weblog/2006/02/how-to-speed-up-flash-8s.html
for details.
@author Brad Neuberg, bkn3@columbia.edu
*/
import flash.external.ExternalInterface;
class DojoExternalInterface{
public static var available:Boolean;
public static var dojoPath = "";
private static var flashMethods:Array = new Array();
private static var numArgs:Number;
private static var argData:Array;
private static var resultData = null;
public static function initialize(){
// extract the dojo base path
DojoExternalInterface.dojoPath = DojoExternalInterface.getDojoPath();
// see if we need to do an express install
var install:ExpressInstall = new ExpressInstall();
if(install.needsUpdate){
install.init();
}
// register our callback functions
ExternalInterface.addCallback("startExec", DojoExternalInterface, startExec);
ExternalInterface.addCallback("setNumberArguments", DojoExternalInterface,
setNumberArguments);
ExternalInterface.addCallback("chunkArgumentData", DojoExternalInterface,
chunkArgumentData);
ExternalInterface.addCallback("exec", DojoExternalInterface, exec);
ExternalInterface.addCallback("getReturnLength", DojoExternalInterface,
getReturnLength);
ExternalInterface.addCallback("chunkReturnData", DojoExternalInterface,
chunkReturnData);
ExternalInterface.addCallback("endExec", DojoExternalInterface, endExec);
// set whether communication is available
DojoExternalInterface.available = ExternalInterface.available;
DojoExternalInterface.call("loaded");
}
public static function addCallback(methodName:String, instance:Object,
method:Function) : Boolean{
// register DojoExternalInterface methodName with it's instance
DojoExternalInterface.flashMethods[methodName] = instance;
// tell JavaScript about DojoExternalInterface new method so we can create a proxy
ExternalInterface.call("dojo.flash.comm._addExternalInterfaceCallback",
methodName);
return true;
}
public static function call(methodName:String,
resultsCallback:Function) : Void{
// we might have any number of optional arguments, so we have to
// pass them in dynamically; strip out the results callback
var parameters = new Array();
for(var i = 0; i < arguments.length; i++){
if(i != 1){ // skip the callback
parameters.push(arguments[i]);
}
}
var results = ExternalInterface.call.apply(ExternalInterface, parameters);
// immediately give the results back, since ExternalInterface is
// synchronous
if(resultsCallback != null && typeof resultsCallback != "undefined"){
resultsCallback.call(null, results);
}
}
/**
Called by Flash to indicate to JavaScript that we are ready to have
our Flash functions called. Calling loaded()
will fire the dojo.flash.loaded() event, so that JavaScript can know that
Flash has finished loading and adding its callbacks, and can begin to
interact with the Flash file.
*/
public static function loaded(){
DojoExternalInterface.call("dojo.flash.loaded");
}
public static function startExec():Void{
DojoExternalInterface.numArgs = null;
DojoExternalInterface.argData = null;
DojoExternalInterface.resultData = null;
}
public static function setNumberArguments(numArgs):Void{
DojoExternalInterface.numArgs = numArgs;
DojoExternalInterface.argData = new Array(DojoExternalInterface.numArgs);
}
public static function chunkArgumentData(value, argIndex:Number):Void{
//getURL("javascript:dojo.debug('FLASH: chunkArgumentData, value="+value+", argIndex="+argIndex+"')");
var currentValue = DojoExternalInterface.argData[argIndex];
if(currentValue == null || typeof currentValue == "undefined"){
DojoExternalInterface.argData[argIndex] = value;
}else{
DojoExternalInterface.argData[argIndex] += value;
}
}
public static function exec(methodName):Void{
// decode all of the arguments that were passed in
for(var i = 0; i < DojoExternalInterface.argData.length; i++){
DojoExternalInterface.argData[i] =
DojoExternalInterface.decodeData(DojoExternalInterface.argData[i]);
}
var instance = DojoExternalInterface.flashMethods[methodName];
DojoExternalInterface.resultData = instance[methodName].apply(
instance, DojoExternalInterface.argData);
// encode the result data
DojoExternalInterface.resultData =
DojoExternalInterface.encodeData(DojoExternalInterface.resultData);
//getURL("javascript:dojo.debug('FLASH: encoded result data="+DojoExternalInterface.resultData+"')");
}
public static function getReturnLength():Number{
if(DojoExternalInterface.resultData == null ||
typeof DojoExternalInterface.resultData == "undefined"){
return 0;
}
var segments = Math.ceil(DojoExternalInterface.resultData.length / 1024);
return segments;
}
public static function chunkReturnData(segment:Number):String{
var numSegments = DojoExternalInterface.getReturnLength();
var startCut = segment * 1024;
var endCut = segment * 1024 + 1024;
if(segment == (numSegments - 1)){
endCut = segment * 1024 + DojoExternalInterface.resultData.length;
}
var piece = DojoExternalInterface.resultData.substring(startCut, endCut);
//getURL("javascript:dojo.debug('FLASH: chunking return piece="+piece+"')");
return piece;
}
public static function endExec():Void{
}
private static function decodeData(data):String{
// we have to use custom encodings for certain characters when passing
// them over; for example, passing a backslash over as //// from JavaScript
// to Flash doesn't work
data = DojoExternalInterface.replaceStr(data, "&custom_backslash;", "\\");
data = DojoExternalInterface.replaceStr(data, "\\\'", "\'");
data = DojoExternalInterface.replaceStr(data, "\\\"", "\"");
return data;
}
private static function encodeData(data){
//getURL("javascript:dojo.debug('inside flash, data before="+data+"')");
// double encode all entity values, or they will be mis-decoded
// by Flash when returned
data = DojoExternalInterface.replaceStr(data, "&", "&amp;");
// certain XMLish characters break Flash's wire serialization for
// ExternalInterface; encode these into a custom encoding, rather than
// the standard entity encoding, because otherwise we won't be able to
// differentiate between our own encoding and any entity characters
// that are being used in the string itself
data = DojoExternalInterface.replaceStr(data, '<', '&custom_lt;');
data = DojoExternalInterface.replaceStr(data, '>', '&custom_gt;');
// encode control characters and JavaScript delimiters
data = DojoExternalInterface.replaceStr(data, "\n", "\\n");
data = DojoExternalInterface.replaceStr(data, "\r", "\\r");
data = DojoExternalInterface.replaceStr(data, "\f", "\\f");
data = DojoExternalInterface.replaceStr(data, "'", "\\'");
data = DojoExternalInterface.replaceStr(data, '"', '\"');
//getURL("javascript:dojo.debug('inside flash, data after="+data+"')");
return data;
}
/**
Flash ActionScript has no String.replace method or support for
Regular Expressions! We roll our own very simple one.
*/
private static function replaceStr(inputStr:String, replaceThis:String,
withThis:String):String {
var splitStr = inputStr.split(replaceThis)
inputStr = splitStr.join(withThis)
return inputStr;
}
private static function getDojoPath(){
var url = _root._url;
var start = url.indexOf("baseRelativePath=") + "baseRelativePath=".length;
var path = url.substring(start);
var end = path.indexOf("&");
if(end != -1){
path = path.substring(0, end);
}
return path;
}
}
// vim:ts=4:noet:tw=0:
/**
A wrapper around Flash 8's ExternalInterface; DojoExternalInterface is needed so that we
can do a Flash 6 implementation of ExternalInterface, and be able
to support having a single codebase that uses DojoExternalInterface
across Flash versions rather than having two seperate source bases,
where one uses ExternalInterface and the other uses DojoExternalInterface.
DojoExternalInterface class does a variety of optimizations to bypass ExternalInterface's
unbelievably bad performance so that we can have good performance
on Safari; see the blog post
http://codinginparadise.org/weblog/2006/02/how-to-speed-up-flash-8s.html
for details.
@author Brad Neuberg, bkn3@columbia.edu
*/
import flash.external.ExternalInterface;
class DojoExternalInterface{
public static var available:Boolean;
public static var dojoPath = "";
private static var flashMethods:Array = new Array();
private static var numArgs:Number;
private static var argData:Array;
private static var resultData = null;
public static function initialize(){
// extract the dojo base path
DojoExternalInterface.dojoPath = DojoExternalInterface.getDojoPath();
// see if we need to do an express install
var install:ExpressInstall = new ExpressInstall();
if(install.needsUpdate){
install.init();
}
// register our callback functions
ExternalInterface.addCallback("startExec", DojoExternalInterface, startExec);
ExternalInterface.addCallback("setNumberArguments", DojoExternalInterface,
setNumberArguments);
ExternalInterface.addCallback("chunkArgumentData", DojoExternalInterface,
chunkArgumentData);
ExternalInterface.addCallback("exec", DojoExternalInterface, exec);
ExternalInterface.addCallback("getReturnLength", DojoExternalInterface,
getReturnLength);
ExternalInterface.addCallback("chunkReturnData", DojoExternalInterface,
chunkReturnData);
ExternalInterface.addCallback("endExec", DojoExternalInterface, endExec);
// set whether communication is available
DojoExternalInterface.available = ExternalInterface.available;
DojoExternalInterface.call("loaded");
}
public static function addCallback(methodName:String, instance:Object,
method:Function) : Boolean{
// register DojoExternalInterface methodName with it's instance
DojoExternalInterface.flashMethods[methodName] = instance;
// tell JavaScript about DojoExternalInterface new method so we can create a proxy
ExternalInterface.call("dojo.flash.comm._addExternalInterfaceCallback",
methodName);
return true;
}
public static function call(methodName:String,
resultsCallback:Function) : Void{
// we might have any number of optional arguments, so we have to
// pass them in dynamically; strip out the results callback
var parameters = new Array();
for(var i = 0; i < arguments.length; i++){
if(i != 1){ // skip the callback
parameters.push(arguments[i]);
}
}
var results = ExternalInterface.call.apply(ExternalInterface, parameters);
// immediately give the results back, since ExternalInterface is
// synchronous
if(resultsCallback != null && typeof resultsCallback != "undefined"){
resultsCallback.call(null, results);
}
}
/**
Called by Flash to indicate to JavaScript that we are ready to have
our Flash functions called. Calling loaded()
will fire the dojo.flash.loaded() event, so that JavaScript can know that
Flash has finished loading and adding its callbacks, and can begin to
interact with the Flash file.
*/
public static function loaded(){
DojoExternalInterface.call("dojo.flash.loaded");
}
public static function startExec():Void{
DojoExternalInterface.numArgs = null;
DojoExternalInterface.argData = null;
DojoExternalInterface.resultData = null;
}
public static function setNumberArguments(numArgs):Void{
DojoExternalInterface.numArgs = numArgs;
DojoExternalInterface.argData = new Array(DojoExternalInterface.numArgs);
}
public static function chunkArgumentData(value, argIndex:Number):Void{
//getURL("javascript:dojo.debug('FLASH: chunkArgumentData, value="+value+", argIndex="+argIndex+"')");
var currentValue = DojoExternalInterface.argData[argIndex];
if(currentValue == null || typeof currentValue == "undefined"){
DojoExternalInterface.argData[argIndex] = value;
}else{
DojoExternalInterface.argData[argIndex] += value;
}
}
public static function exec(methodName):Void{
// decode all of the arguments that were passed in
for(var i = 0; i < DojoExternalInterface.argData.length; i++){
DojoExternalInterface.argData[i] =
DojoExternalInterface.decodeData(DojoExternalInterface.argData[i]);
}
var instance = DojoExternalInterface.flashMethods[methodName];
DojoExternalInterface.resultData = instance[methodName].apply(
instance, DojoExternalInterface.argData);
// encode the result data
DojoExternalInterface.resultData =
DojoExternalInterface.encodeData(DojoExternalInterface.resultData);
//getURL("javascript:dojo.debug('FLASH: encoded result data="+DojoExternalInterface.resultData+"')");
}
public static function getReturnLength():Number{
if(DojoExternalInterface.resultData == null ||
typeof DojoExternalInterface.resultData == "undefined"){
return 0;
}
var segments = Math.ceil(DojoExternalInterface.resultData.length / 1024);
return segments;
}
public static function chunkReturnData(segment:Number):String{
var numSegments = DojoExternalInterface.getReturnLength();
var startCut = segment * 1024;
var endCut = segment * 1024 + 1024;
if(segment == (numSegments - 1)){
endCut = segment * 1024 + DojoExternalInterface.resultData.length;
}
var piece = DojoExternalInterface.resultData.substring(startCut, endCut);
//getURL("javascript:dojo.debug('FLASH: chunking return piece="+piece+"')");
return piece;
}
public static function endExec():Void{
}
private static function decodeData(data):String{
// we have to use custom encodings for certain characters when passing
// them over; for example, passing a backslash over as //// from JavaScript
// to Flash doesn't work
data = DojoExternalInterface.replaceStr(data, "&custom_backslash;", "\\");
data = DojoExternalInterface.replaceStr(data, "\\\'", "\'");
data = DojoExternalInterface.replaceStr(data, "\\\"", "\"");
return data;
}
private static function encodeData(data){
//getURL("javascript:dojo.debug('inside flash, data before="+data+"')");
// double encode all entity values, or they will be mis-decoded
// by Flash when returned
data = DojoExternalInterface.replaceStr(data, "&", "&amp;");
// certain XMLish characters break Flash's wire serialization for
// ExternalInterface; encode these into a custom encoding, rather than
// the standard entity encoding, because otherwise we won't be able to
// differentiate between our own encoding and any entity characters
// that are being used in the string itself
data = DojoExternalInterface.replaceStr(data, '<', '&custom_lt;');
data = DojoExternalInterface.replaceStr(data, '>', '&custom_gt;');
// encode control characters and JavaScript delimiters
data = DojoExternalInterface.replaceStr(data, "\n", "\\n");
data = DojoExternalInterface.replaceStr(data, "\r", "\\r");
data = DojoExternalInterface.replaceStr(data, "\f", "\\f");
data = DojoExternalInterface.replaceStr(data, "'", "\\'");
data = DojoExternalInterface.replaceStr(data, '"', '\"');
//getURL("javascript:dojo.debug('inside flash, data after="+data+"')");
return data;
}
/**
Flash ActionScript has no String.replace method or support for
Regular Expressions! We roll our own very simple one.
*/
private static function replaceStr(inputStr:String, replaceThis:String,
withThis:String):String {
var splitStr = inputStr.split(replaceThis)
inputStr = splitStr.join(withThis)
return inputStr;
}
private static function getDojoPath(){
var url = _root._url;
var start = url.indexOf("baseRelativePath=") + "baseRelativePath=".length;
var path = url.substring(start);
var end = path.indexOf("&");
if(end != -1){
path = path.substring(0, end);
}
return path;
}
}
// vim:ts=4:noet:tw=0:

View file

@ -8,74 +8,74 @@
http://dojotoolkit.org/community/licensing.shtml
*/
/**
* Based on the expressinstall.as class created by Geoff Stearns as part
* of the FlashObject library.
*
* Use this file to invoke the Macromedia Flash Player Express Install functionality
* This file is intended for use with the FlashObject embed script. You can download FlashObject
* and this file at the following URL: http://blog.deconcept.com/flashobject/
*
* Usage:
* var ExpressInstall = new ExpressInstall();
*
* // test to see if install is needed:
* if (ExpressInstall.needsUpdate) { // returns true if update is needed
* ExpressInstall.init(); // starts the update
* }
*
* NOTE: Your Flash movie must be at least 214px by 137px in order to use ExpressInstall.
*
*/
class ExpressInstall {
public var needsUpdate:Boolean;
private var updater:MovieClip;
private var hold:MovieClip;
public function ExpressInstall(){
// does the user need to update?
this.needsUpdate = (_root.MMplayerType == undefined) ? false : true;
}
public function init():Void{
this.loadUpdater();
}
public function loadUpdater():Void {
System.security.allowDomain("fpdownload.macromedia.com");
// hope that nothing is at a depth of 10000000, you can change this depth if needed, but you want
// it to be on top of your content if you have any stuff on the first frame
this.updater = _root.createEmptyMovieClip("expressInstallHolder", 10000000);
// register the callback so we know if they cancel or there is an error
var _self = this;
this.updater.installStatus = _self.onInstallStatus;
this.hold = this.updater.createEmptyMovieClip("hold", 1);
// can't use movieClipLoader because it has to work in 6.0.65
this.updater.onEnterFrame = function():Void {
if(typeof this.hold.startUpdate == 'function'){
_self.initUpdater();
this.onEnterFrame = null;
}
}
var cacheBuster:Number = Math.random();
this.hold.loadMovie("http://fpdownload.macromedia.com/pub/flashplayer/"
+"update/current/swf/autoUpdater.swf?"+ cacheBuster);
}
private function initUpdater():Void{
this.hold.redirectURL = _root.MMredirectURL;
this.hold.MMplayerType = _root.MMplayerType;
this.hold.MMdoctitle = _root.MMdoctitle;
this.hold.startUpdate();
}
public function onInstallStatus(msg):Void{
getURL("javascript:dojo.flash.install._onInstallStatus('"+msg+"')");
}
}
/**
* Based on the expressinstall.as class created by Geoff Stearns as part
* of the FlashObject library.
*
* Use this file to invoke the Macromedia Flash Player Express Install functionality
* This file is intended for use with the FlashObject embed script. You can download FlashObject
* and this file at the following URL: http://blog.deconcept.com/flashobject/
*
* Usage:
* var ExpressInstall = new ExpressInstall();
*
* // test to see if install is needed:
* if (ExpressInstall.needsUpdate) { // returns true if update is needed
* ExpressInstall.init(); // starts the update
* }
*
* NOTE: Your Flash movie must be at least 214px by 137px in order to use ExpressInstall.
*
*/
class ExpressInstall {
public var needsUpdate:Boolean;
private var updater:MovieClip;
private var hold:MovieClip;
public function ExpressInstall(){
// does the user need to update?
this.needsUpdate = (_root.MMplayerType == undefined) ? false : true;
}
public function init():Void{
this.loadUpdater();
}
public function loadUpdater():Void {
System.security.allowDomain("fpdownload.macromedia.com");
// hope that nothing is at a depth of 10000000, you can change this depth if needed, but you want
// it to be on top of your content if you have any stuff on the first frame
this.updater = _root.createEmptyMovieClip("expressInstallHolder", 10000000);
// register the callback so we know if they cancel or there is an error
var _self = this;
this.updater.installStatus = _self.onInstallStatus;
this.hold = this.updater.createEmptyMovieClip("hold", 1);
// can't use movieClipLoader because it has to work in 6.0.65
this.updater.onEnterFrame = function():Void {
if(typeof this.hold.startUpdate == 'function'){
_self.initUpdater();
this.onEnterFrame = null;
}
}
var cacheBuster:Number = Math.random();
this.hold.loadMovie("http://fpdownload.macromedia.com/pub/flashplayer/"
+"update/current/swf/autoUpdater.swf?"+ cacheBuster);
}
private function initUpdater():Void{
this.hold.redirectURL = _root.MMredirectURL;
this.hold.MMplayerType = _root.MMplayerType;
this.hold.MMdoctitle = _root.MMdoctitle;
this.hold.startUpdate();
}
public function onInstallStatus(msg):Void{
getURL("javascript:dojo.flash.install._onInstallStatus('"+msg+"')");
}
}

View file

@ -8,114 +8,114 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.html.layout");
dojo.require("dojo.lang");
dojo.require("dojo.string");
dojo.require("dojo.style");
dojo.require("dojo.html");
/**
* Layout a bunch of child dom nodes within a parent dom node
* Input is an array of objects like:
* @ container - parent node
* @ layoutPriority - "top-bottom" or "left-right"
* @ children an array like [ {domNode: foo, layoutAlign: "bottom" }, {domNode: bar, layoutAlign: "client"} ]
*/
dojo.html.layout = function(container, children, layoutPriority) {
dojo.html.addClass(container, "dojoLayoutContainer");
// Copy children array and remove elements w/out layout.
// Also record each child's position in the input array, for sorting purposes.
children = dojo.lang.filter(children, function(child, idx){
child.idx = idx;
return dojo.lang.inArray(["top","bottom","left","right","client","flood"], child.layoutAlign)
});
// Order the children according to layoutPriority.
// Multiple children w/the same layoutPriority will be sorted by their position in the input array.
if(layoutPriority && layoutPriority!="none"){
var rank = function(child){
switch(child.layoutAlign){
case "flood":
return 1;
case "left":
case "right":
return (layoutPriority=="left-right") ? 2 : 3;
case "top":
case "bottom":
return (layoutPriority=="left-right") ? 3 : 2;
default:
return 4;
}
};
children.sort(function(a,b){
return (rank(a)-rank(b)) || (a.idx - b.idx);
});
}
// remaining space (blank area where nothing has been written)
var f={
top: dojo.style.getPixelValue(container, "padding-top", true),
left: dojo.style.getPixelValue(container, "padding-left", true),
height: dojo.style.getContentHeight(container),
width: dojo.style.getContentWidth(container)
};
// set positions/sizes
dojo.lang.forEach(children, function(child){
var elm=child.domNode;
var pos=child.layoutAlign;
// set elem to upper left corner of unused space; may move it later
with(elm.style){
left = f.left+"px";
top = f.top+"px";
bottom = "auto";
right = "auto";
}
dojo.html.addClass(elm, "dojoAlign" + dojo.string.capitalize(pos));
// set size && adjust record of remaining space.
// note that setting the width of a <div> may affect it's height.
// TODO: same is true for widgets but need to implement API to support that
if ( (pos=="top")||(pos=="bottom") ) {
dojo.style.setOuterWidth(elm, f.width);
var h = dojo.style.getOuterHeight(elm);
f.height -= h;
if(pos=="top"){
f.top += h;
}else{
elm.style.top = f.top + f.height + "px";
}
}else if(pos=="left" || pos=="right"){
dojo.style.setOuterHeight(elm, f.height);
var w = dojo.style.getOuterWidth(elm);
f.width -= w;
if(pos=="left"){
f.left += w;
}else{
elm.style.left = f.left + f.width + "px";
}
} else if(pos=="flood" || pos=="client"){
dojo.style.setOuterWidth(elm, f.width);
dojo.style.setOuterHeight(elm, f.height);
}
// TODO: for widgets I want to call resizeTo(), but for top/bottom
// alignment I only want to set the width, and have the size determined
// dynamically. (The thinner you make a div, the more height it consumes.)
if(child.onResized){
child.onResized();
}
});
};
// This is essential CSS to make layout work (it isn't "styling" CSS)
// make sure that the position:absolute in dojoAlign* overrides other classes
dojo.style.insertCssText(
".dojoLayoutContainer{ position: relative; display: block; }\n" +
"body .dojoAlignTop, body .dojoAlignBottom, body .dojoAlignLeft, body .dojoAlignRight { position: absolute; overflow: hidden; }\n" +
"body .dojoAlignClient { position: absolute }\n" +
".dojoAlignClient { overflow: auto; }\n"
);
dojo.provide("dojo.html.layout");
dojo.require("dojo.lang");
dojo.require("dojo.string");
dojo.require("dojo.style");
dojo.require("dojo.html");
/**
* Layout a bunch of child dom nodes within a parent dom node
* Input is an array of objects like:
* @ container - parent node
* @ layoutPriority - "top-bottom" or "left-right"
* @ children an array like [ {domNode: foo, layoutAlign: "bottom" }, {domNode: bar, layoutAlign: "client"} ]
*/
dojo.html.layout = function(container, children, layoutPriority) {
dojo.html.addClass(container, "dojoLayoutContainer");
// Copy children array and remove elements w/out layout.
// Also record each child's position in the input array, for sorting purposes.
children = dojo.lang.filter(children, function(child, idx){
child.idx = idx;
return dojo.lang.inArray(["top","bottom","left","right","client","flood"], child.layoutAlign)
});
// Order the children according to layoutPriority.
// Multiple children w/the same layoutPriority will be sorted by their position in the input array.
if(layoutPriority && layoutPriority!="none"){
var rank = function(child){
switch(child.layoutAlign){
case "flood":
return 1;
case "left":
case "right":
return (layoutPriority=="left-right") ? 2 : 3;
case "top":
case "bottom":
return (layoutPriority=="left-right") ? 3 : 2;
default:
return 4;
}
};
children.sort(function(a,b){
return (rank(a)-rank(b)) || (a.idx - b.idx);
});
}
// remaining space (blank area where nothing has been written)
var f={
top: dojo.style.getPixelValue(container, "padding-top", true),
left: dojo.style.getPixelValue(container, "padding-left", true),
height: dojo.style.getContentHeight(container),
width: dojo.style.getContentWidth(container)
};
// set positions/sizes
dojo.lang.forEach(children, function(child){
var elm=child.domNode;
var pos=child.layoutAlign;
// set elem to upper left corner of unused space; may move it later
with(elm.style){
left = f.left+"px";
top = f.top+"px";
bottom = "auto";
right = "auto";
}
dojo.html.addClass(elm, "dojoAlign" + dojo.string.capitalize(pos));
// set size && adjust record of remaining space.
// note that setting the width of a <div> may affect it's height.
// TODO: same is true for widgets but need to implement API to support that
if ( (pos=="top")||(pos=="bottom") ) {
dojo.style.setOuterWidth(elm, f.width);
var h = dojo.style.getOuterHeight(elm);
f.height -= h;
if(pos=="top"){
f.top += h;
}else{
elm.style.top = f.top + f.height + "px";
}
}else if(pos=="left" || pos=="right"){
dojo.style.setOuterHeight(elm, f.height);
var w = dojo.style.getOuterWidth(elm);
f.width -= w;
if(pos=="left"){
f.left += w;
}else{
elm.style.left = f.left + f.width + "px";
}
} else if(pos=="flood" || pos=="client"){
dojo.style.setOuterWidth(elm, f.width);
dojo.style.setOuterHeight(elm, f.height);
}
// TODO: for widgets I want to call resizeTo(), but for top/bottom
// alignment I only want to set the width, and have the size determined
// dynamically. (The thinner you make a div, the more height it consumes.)
if(child.onResized){
child.onResized();
}
});
};
// This is essential CSS to make layout work (it isn't "styling" CSS)
// make sure that the position:absolute in dojoAlign* overrides other classes
dojo.style.insertCssText(
".dojoLayoutContainer{ position: relative; display: block; }\n" +
"body .dojoAlignTop, body .dojoAlignBottom, body .dojoAlignLeft, body .dojoAlignRight { position: absolute; overflow: hidden; }\n" +
"body .dojoAlignClient { position: absolute }\n" +
".dojoAlignClient { overflow: auto; }\n"
);

View file

@ -8,72 +8,72 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.html.shadow");
dojo.require("dojo.lang");
dojo.require("dojo.uri");
dojo.html.shadow = function(node) {
this.init(node);
}
dojo.lang.extend(dojo.html.shadow, {
shadowPng: dojo.uri.dojoUri("src/html/images/shadow"),
shadowThickness: 8,
shadowOffset: 15,
init: function(node){
this.node=node;
// make all the pieces of the shadow, and position/size them as much
// as possible (but a lot of the coordinates are set in sizeShadow
this.pieces={};
var x1 = -1 * this.shadowThickness;
var y0 = this.shadowOffset;
var y1 = this.shadowOffset + this.shadowThickness;
this._makePiece("tl", "top", y0, "left", x1);
this._makePiece("l", "top", y1, "left", x1, "scale");
this._makePiece("tr", "top", y0, "left", 0);
this._makePiece("r", "top", y1, "left", 0, "scale");
this._makePiece("bl", "top", 0, "left", x1);
this._makePiece("b", "top", 0, "left", 0, "crop");
this._makePiece("br", "top", 0, "left", 0);
},
_makePiece: function(name, vertAttach, vertCoord, horzAttach, horzCoord, sizing){
var img;
var url = this.shadowPng + name.toUpperCase() + ".png";
if(dojo.render.html.ie){
img=document.createElement("div");
img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"'"+
(sizing?", sizingMethod='"+sizing+"'":"") + ")";
}else{
img=document.createElement("img");
img.src=url;
}
img.style.position="absolute";
img.style[vertAttach]=vertCoord+"px";
img.style[horzAttach]=horzCoord+"px";
img.style.width=this.shadowThickness+"px";
img.style.height=this.shadowThickness+"px";
this.pieces[name]=img;
this.node.appendChild(img);
},
size: function(width, height){
var sideHeight = height - (this.shadowOffset+this.shadowThickness+1);
with(this.pieces){
l.style.height = sideHeight+"px";
r.style.height = sideHeight+"px";
b.style.width = (width-1)+"px";
bl.style.top = (height-1)+"px";
b.style.top = (height-1)+"px";
br.style.top = (height-1)+"px";
tr.style.left = (width-1)+"px";
r.style.left = (width-1)+"px";
br.style.left = (width-1)+"px";
}
}
});
dojo.provide("dojo.html.shadow");
dojo.require("dojo.lang");
dojo.require("dojo.uri");
dojo.html.shadow = function(node) {
this.init(node);
}
dojo.lang.extend(dojo.html.shadow, {
shadowPng: dojo.uri.dojoUri("src/html/images/shadow"),
shadowThickness: 8,
shadowOffset: 15,
init: function(node){
this.node=node;
// make all the pieces of the shadow, and position/size them as much
// as possible (but a lot of the coordinates are set in sizeShadow
this.pieces={};
var x1 = -1 * this.shadowThickness;
var y0 = this.shadowOffset;
var y1 = this.shadowOffset + this.shadowThickness;
this._makePiece("tl", "top", y0, "left", x1);
this._makePiece("l", "top", y1, "left", x1, "scale");
this._makePiece("tr", "top", y0, "left", 0);
this._makePiece("r", "top", y1, "left", 0, "scale");
this._makePiece("bl", "top", 0, "left", x1);
this._makePiece("b", "top", 0, "left", 0, "crop");
this._makePiece("br", "top", 0, "left", 0);
},
_makePiece: function(name, vertAttach, vertCoord, horzAttach, horzCoord, sizing){
var img;
var url = this.shadowPng + name.toUpperCase() + ".png";
if(dojo.render.html.ie){
img=document.createElement("div");
img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"'"+
(sizing?", sizingMethod='"+sizing+"'":"") + ")";
}else{
img=document.createElement("img");
img.src=url;
}
img.style.position="absolute";
img.style[vertAttach]=vertCoord+"px";
img.style[horzAttach]=horzCoord+"px";
img.style.width=this.shadowThickness+"px";
img.style.height=this.shadowThickness+"px";
this.pieces[name]=img;
this.node.appendChild(img);
},
size: function(width, height){
var sideHeight = height - (this.shadowOffset+this.shadowThickness+1);
with(this.pieces){
l.style.height = sideHeight+"px";
r.style.height = sideHeight+"px";
b.style.width = (width-1)+"px";
bl.style.top = (height-1)+"px";
b.style.top = (height-1)+"px";
br.style.top = (height-1)+"px";
tr.style.left = (width-1)+"px";
r.style.left = (width-1)+"px";
br.style.left = (width-1)+"px";
}
}
});

View file

@ -8,64 +8,64 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.AccordionContainer");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.AccordionPane");
dojo.widget.defineWidget(
"dojo.widget.AccordionContainer",
dojo.widget.HtmlWidget,
{
widgetType: "AccordionContainer",
isContainer: true,
labelNodeClass: "",
containerNodeClass: "",
allowCollapse: false,
addChild: function(widget, overrideContainerNode, pos, ref, insertIndex){
if (widget.widgetType != "AccordionPane") {
var wrapper=dojo.widget.createWidget("AccordionPane",{label: widget.label, open: widget.open, labelNodeClass: this.labelNodeClass, containerNodeClass: this.containerNodeClass, allowCollapse: this.allowCollapse });
wrapper.addChild(widget);
this.addWidgetAsDirectChild(wrapper);
this.registerChild(wrapper);
wrapper.setSizes();
return wrapper;
} else {
dojo.html.addClass(widget.containerNode, this.containerNodeClass);
dojo.html.addClass(widget.labelNode, this.labelNodeClass);
this.addWidgetAsDirectChild(widget);
this.registerChild(widget);
widget.setSizes();
return widget;
}
},
postCreate: function() {
var tmpChildren = this.children;
this.children=[];
dojo.html.removeChildren(this.domNode);
dojo.lang.forEach(tmpChildren, dojo.lang.hitch(this,"addChild"));
},
removeChild: function(widget) {
dojo.widget.AccordionContainer.superclass.removeChild.call(this, widget);
if(this.children[0]){
this.children[0].setSizes();
}
},
onResized: function(){
this.children[0].setSizes();
}
}
);
// These arguments can be specified for the children of a Accordion
// Since any widget can be specified as a child, mix them
// into the base widget class. (This is a hack, but it's effective.)
dojo.lang.extend(dojo.widget.Widget, {
label: "",
open: false
});
dojo.provide("dojo.widget.AccordionContainer");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.AccordionPane");
dojo.widget.defineWidget(
"dojo.widget.AccordionContainer",
dojo.widget.HtmlWidget,
{
widgetType: "AccordionContainer",
isContainer: true,
labelNodeClass: "",
containerNodeClass: "",
allowCollapse: false,
addChild: function(widget, overrideContainerNode, pos, ref, insertIndex){
if (widget.widgetType != "AccordionPane") {
var wrapper=dojo.widget.createWidget("AccordionPane",{label: widget.label, open: widget.open, labelNodeClass: this.labelNodeClass, containerNodeClass: this.containerNodeClass, allowCollapse: this.allowCollapse });
wrapper.addChild(widget);
this.addWidgetAsDirectChild(wrapper);
this.registerChild(wrapper);
wrapper.setSizes();
return wrapper;
} else {
dojo.html.addClass(widget.containerNode, this.containerNodeClass);
dojo.html.addClass(widget.labelNode, this.labelNodeClass);
this.addWidgetAsDirectChild(widget);
this.registerChild(widget);
widget.setSizes();
return widget;
}
},
postCreate: function() {
var tmpChildren = this.children;
this.children=[];
dojo.html.removeChildren(this.domNode);
dojo.lang.forEach(tmpChildren, dojo.lang.hitch(this,"addChild"));
},
removeChild: function(widget) {
dojo.widget.AccordionContainer.superclass.removeChild.call(this, widget);
if(this.children[0]){
this.children[0].setSizes();
}
},
onResized: function(){
this.children[0].setSizes();
}
}
);
// These arguments can be specified for the children of a Accordion
// Since any widget can be specified as a child, mix them
// into the base widget class. (This is a hack, but it's effective.)
dojo.lang.extend(dojo.widget.Widget, {
label: "",
open: false
});

View file

@ -8,26 +8,26 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.Button2");
dojo.require("dojo.widget.Button");
dojo.require("dojo.widget.*");
dojo.widget.tags.addParseTreeHandler("dojo:button2");
dojo.widget.tags.addParseTreeHandler("dojo:dropdownbutton2");
dojo.widget.tags.addParseTreeHandler("dojo:combobutton2");
dojo.deprecated("dojo.widget.Button2", "Use dojo.widget.Button instead", "0.4");
dojo.requireAfterIf("html", "dojo.widget.html.Button2");
dojo.widget.Button2 = function(){}
dojo.inherits(dojo.widget.Button2, dojo.widget.Button);
dojo.lang.extend(dojo.widget.Button2, { widgetType: "Button2" });
dojo.widget.DropDownButton2 = function(){}
dojo.inherits(dojo.widget.DropDownButton2, dojo.widget.DropDownButton);
dojo.lang.extend(dojo.widget.DropDownButton2, { widgetType: "DropDownButton2" });
dojo.widget.ComboButton2 = function(){}
dojo.inherits(dojo.widget.ComboButton2, dojo.widget.ComboButton);
dojo.lang.extend(dojo.widget.ComboButton2, { widgetType: "ComboButton2" });
dojo.provide("dojo.widget.Button2");
dojo.require("dojo.widget.Button");
dojo.require("dojo.widget.*");
dojo.widget.tags.addParseTreeHandler("dojo:button2");
dojo.widget.tags.addParseTreeHandler("dojo:dropdownbutton2");
dojo.widget.tags.addParseTreeHandler("dojo:combobutton2");
dojo.deprecated("dojo.widget.Button2", "Use dojo.widget.Button instead", "0.4");
dojo.requireAfterIf("html", "dojo.widget.html.Button2");
dojo.widget.Button2 = function(){}
dojo.inherits(dojo.widget.Button2, dojo.widget.Button);
dojo.lang.extend(dojo.widget.Button2, { widgetType: "Button2" });
dojo.widget.DropDownButton2 = function(){}
dojo.inherits(dojo.widget.DropDownButton2, dojo.widget.DropDownButton);
dojo.lang.extend(dojo.widget.DropDownButton2, { widgetType: "DropDownButton2" });
dojo.widget.ComboButton2 = function(){}
dojo.inherits(dojo.widget.ComboButton2, dojo.widget.ComboButton);
dojo.lang.extend(dojo.widget.ComboButton2, { widgetType: "ComboButton2" });

View file

@ -8,15 +8,15 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.DebugConsole");
dojo.require("dojo.widget.Widget");
dojo.widget.DebugConsole= function(){
dojo.widget.Widget.call(this);
this.widgetType = "DebugConsole";
this.isContainer = true;
}
dojo.inherits(dojo.widget.DebugConsole, dojo.widget.Widget);
dojo.widget.tags.addParseTreeHandler("dojo:debugconsole");
dojo.requireAfterIf("html", "dojo.widget.html.DebugConsole");
dojo.provide("dojo.widget.DebugConsole");
dojo.require("dojo.widget.Widget");
dojo.widget.DebugConsole= function(){
dojo.widget.Widget.call(this);
this.widgetType = "DebugConsole";
this.isContainer = true;
}
dojo.inherits(dojo.widget.DebugConsole, dojo.widget.Widget);
dojo.widget.tags.addParseTreeHandler("dojo:debugconsole");
dojo.requireAfterIf("html", "dojo.widget.html.DebugConsole");

View file

@ -8,298 +8,298 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.FloatingPane");
dojo.provide("dojo.widget.html.FloatingPane");
//
// this widget provides a window-like floating pane
//
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Manager");
dojo.require("dojo.html");
dojo.require("dojo.html.shadow");
dojo.require("dojo.style");
dojo.require("dojo.dom");
dojo.require("dojo.html.layout");
dojo.require("dojo.widget.ContentPane");
dojo.require("dojo.dnd.HtmlDragMove");
dojo.require("dojo.dnd.HtmlDragMoveSource");
dojo.require("dojo.dnd.HtmlDragMoveObject");
dojo.require("dojo.widget.ResizeHandle");
dojo.widget.html.FloatingPane = function(){
dojo.widget.html.ContentPane.call(this);
}
dojo.inherits(dojo.widget.html.FloatingPane, dojo.widget.html.ContentPane);
dojo.lang.extend(dojo.widget.html.FloatingPane, {
widgetType: "FloatingPane",
// Constructor arguments
title: '',
iconSrc: '',
hasShadow: false,
constrainToContainer: false,
taskBarId: "",
resizable: true,
titleBarDisplay: "fancy",
windowState: "normal",
displayCloseAction: false,
displayMinimizeAction: false,
displayMaximizeAction: false,
maxTaskBarConnectAttempts: 5,
taskBarConnectAttempts: 0,
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlFloatingPane.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlFloatingPane.css"),
drag: null,
fillInTemplate: function(args, frag){
// Copy style info from input node to output node
var source = this.getFragNodeRef(frag);
dojo.html.copyStyle(this.domNode, source);
// necessary for safari, khtml (for computing width/height)
document.body.appendChild(this.domNode);
// if display:none then state=minimized, otherwise state=normal
if(!this.isShowing()){
this.windowState="minimized";
}
// <img src=""> can hang IE! better get rid of it
if(this.iconSrc==""){
dojo.dom.removeNode(this.titleBarIcon);
}else{
this.titleBarIcon.src = this.iconSrc.toString();// dojo.uri.Uri obj req. toString()
}
if(this.titleBarDisplay!="none"){
this.titleBar.style.display="";
dojo.html.disableSelection(this.titleBar);
this.titleBarIcon.style.display = (this.iconSrc=="" ? "none" : "");
this.minimizeAction.style.display = (this.displayMinimizeAction ? "" : "none");
this.maximizeAction.style.display=
(this.displayMaximizeAction && this.windowState!="maximized" ? "" : "none");
this.restoreAction.style.display=
(this.displayMaximizeAction && this.windowState=="maximized" ? "" : "none");
this.closeAction.style.display= (this.displayCloseAction ? "" : "none");
this.drag = new dojo.dnd.HtmlDragMoveSource(this.domNode);
if (this.constrainToContainer) {
this.drag.constrainTo();
}
this.drag.setDragHandle(this.titleBar);
var self = this;
dojo.event.topic.subscribe("dragMove",
function (info){
if (info.source.domNode == self.domNode){
dojo.event.topic.publish('floatingPaneMove', { source: self } );
}
}
);
}
if(this.resizable){
this.resizeBar.style.display="";
var rh = dojo.widget.createWidget("ResizeHandle", {targetElmId: this.widgetId, id:this.widgetId+"_resize"});
this.resizeBar.appendChild(rh.domNode);
}
// add a drop shadow
if(this.hasShadow){
this.shadow=new dojo.html.shadow(this.domNode);
}
// Prevent IE bleed-through problem
this.bgIframe = new dojo.html.BackgroundIframe(this.domNode);
if( this.taskBarId ){
this.taskBarSetup();
}
if (dojo.hostenv.post_load_) {
this.setInitialWindowState();
} else {
dojo.addOnLoad(this, "setInitialWindowState");
}
// counteract body.appendChild above
document.body.removeChild(this.domNode);
dojo.widget.html.FloatingPane.superclass.fillInTemplate.call(this, args, frag);
},
postCreate: function(){
if(this.isShowing()){
this.width=-1; // force resize
this.resizeTo(dojo.style.getOuterWidth(this.domNode), dojo.style.getOuterHeight(this.domNode));
}
},
maximizeWindow: function(evt) {
this.previous={
width: dojo.style.getOuterWidth(this.domNode) || this.width,
height: dojo.style.getOuterHeight(this.domNode) || this.height,
left: this.domNode.style.left,
top: this.domNode.style.top,
bottom: this.domNode.style.bottom,
right: this.domNode.style.right
};
this.domNode.style.left =
dojo.style.getPixelValue(this.domNode.parentNode, "padding-left", true) + "px";
this.domNode.style.top =
dojo.style.getPixelValue(this.domNode.parentNode, "padding-top", true) + "px";
if ((this.domNode.parentNode.nodeName.toLowerCase() == 'body')) {
this.resizeTo(
dojo.html.getViewportWidth()-dojo.style.getPaddingWidth(document.body),
dojo.html.getViewportHeight()-dojo.style.getPaddingHeight(document.body)
);
} else {
this.resizeTo(
dojo.style.getContentWidth(this.domNode.parentNode),
dojo.style.getContentHeight(this.domNode.parentNode)
);
}
this.maximizeAction.style.display="none";
this.restoreAction.style.display="";
this.windowState="maximized";
},
minimizeWindow: function(evt) {
this.hide();
this.windowState = "minimized";
},
restoreWindow: function(evt) {
if (this.windowState=="minimized") {
this.show()
} else {
for(var attr in this.previous){
this.domNode.style[attr] = this.previous[attr];
}
this.resizeTo(this.previous.width, this.previous.height);
this.previous=null;
this.restoreAction.style.display="none";
this.maximizeAction.style.display=this.displayMaximizeAction ? "" : "none";
}
this.windowState="normal";
},
closeWindow: function(evt) {
dojo.dom.removeNode(this.domNode);
this.destroy();
},
onMouseDown: function(evt) {
this.bringToTop();
},
bringToTop: function() {
var floatingPanes= dojo.widget.manager.getWidgetsByType(this.widgetType);
var windows = [];
for (var x=0; x<floatingPanes.length; x++) {
if (this.widgetId != floatingPanes[x].widgetId) {
windows.push(floatingPanes[x]);
}
}
windows.sort(function(a,b) {
return a.domNode.style.zIndex - b.domNode.style.zIndex;
});
windows.push(this);
var floatingPaneStartingZ = 100;
for (x=0; x<windows.length;x++) {
windows[x].domNode.style.zIndex = floatingPaneStartingZ + x;
}
},
setInitialWindowState: function() {
if (this.windowState == "maximized") {
this.maximizeWindow();
this.show();
return;
}
if (this.windowState=="normal") {
this.show();
return;
}
if (this.windowState=="minimized") {
this.hide();
return;
}
this.windowState="minimized";
},
// add icon to task bar, connected to me
taskBarSetup: function() {
var taskbar = dojo.widget.getWidgetById(this.taskBarId);
if (!taskbar){
if (this.taskBarConnectAttempts < this.maxTaskBarConnectAttempts) {
dojo.lang.setTimeout(this, this.taskBarSetup, 50);
this.taskBarConnectAttempts++;
} else {
dojo.debug("Unable to connect to the taskBar");
}
return;
}
taskbar.addChild(this);
},
show: function(){
dojo.widget.html.FloatingPane.superclass.show.apply(this, arguments);
this.bringToTop();
},
onShow: function(){
dojo.widget.html.FloatingPane.superclass.onShow.call(this);
this.resizeTo(dojo.style.getOuterWidth(this.domNode), dojo.style.getOuterHeight(this.domNode));
},
// This is called when the user adjusts the size of the floating pane
resizeTo: function(w, h){
dojo.style.setOuterWidth(this.domNode, w);
dojo.style.setOuterHeight(this.domNode, h);
dojo.html.layout(this.domNode,
[
{domNode: this.titleBar, layoutAlign: "top"},
{domNode: this.resizeBar, layoutAlign: "bottom"},
{domNode: this.containerNode, layoutAlign: "client"}
] );
// If any of the children have layoutAlign specified, obey it
dojo.html.layout(this.containerNode, this.children, "top-bottom");
this.bgIframe.onResized();
if(this.shadow){ this.shadow.size(w, h); }
this.onResized();
},
checkSize: function() {
// checkSize() is called when the user has resized the browser window,
// but that doesn't affect this widget (or this widget's children)
// so it can be safely ignored...
// TODO: unless we are maximized. then we should resize ourself.
}
});
dojo.widget.tags.addParseTreeHandler("dojo:FloatingPane");
dojo.provide("dojo.widget.FloatingPane");
dojo.provide("dojo.widget.html.FloatingPane");
//
// this widget provides a window-like floating pane
//
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Manager");
dojo.require("dojo.html");
dojo.require("dojo.html.shadow");
dojo.require("dojo.style");
dojo.require("dojo.dom");
dojo.require("dojo.html.layout");
dojo.require("dojo.widget.ContentPane");
dojo.require("dojo.dnd.HtmlDragMove");
dojo.require("dojo.dnd.HtmlDragMoveSource");
dojo.require("dojo.dnd.HtmlDragMoveObject");
dojo.require("dojo.widget.ResizeHandle");
dojo.widget.html.FloatingPane = function(){
dojo.widget.html.ContentPane.call(this);
}
dojo.inherits(dojo.widget.html.FloatingPane, dojo.widget.html.ContentPane);
dojo.lang.extend(dojo.widget.html.FloatingPane, {
widgetType: "FloatingPane",
// Constructor arguments
title: '',
iconSrc: '',
hasShadow: false,
constrainToContainer: false,
taskBarId: "",
resizable: true,
titleBarDisplay: "fancy",
windowState: "normal",
displayCloseAction: false,
displayMinimizeAction: false,
displayMaximizeAction: false,
maxTaskBarConnectAttempts: 5,
taskBarConnectAttempts: 0,
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlFloatingPane.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlFloatingPane.css"),
drag: null,
fillInTemplate: function(args, frag){
// Copy style info from input node to output node
var source = this.getFragNodeRef(frag);
dojo.html.copyStyle(this.domNode, source);
// necessary for safari, khtml (for computing width/height)
document.body.appendChild(this.domNode);
// if display:none then state=minimized, otherwise state=normal
if(!this.isShowing()){
this.windowState="minimized";
}
// <img src=""> can hang IE! better get rid of it
if(this.iconSrc==""){
dojo.dom.removeNode(this.titleBarIcon);
}else{
this.titleBarIcon.src = this.iconSrc.toString();// dojo.uri.Uri obj req. toString()
}
if(this.titleBarDisplay!="none"){
this.titleBar.style.display="";
dojo.html.disableSelection(this.titleBar);
this.titleBarIcon.style.display = (this.iconSrc=="" ? "none" : "");
this.minimizeAction.style.display = (this.displayMinimizeAction ? "" : "none");
this.maximizeAction.style.display=
(this.displayMaximizeAction && this.windowState!="maximized" ? "" : "none");
this.restoreAction.style.display=
(this.displayMaximizeAction && this.windowState=="maximized" ? "" : "none");
this.closeAction.style.display= (this.displayCloseAction ? "" : "none");
this.drag = new dojo.dnd.HtmlDragMoveSource(this.domNode);
if (this.constrainToContainer) {
this.drag.constrainTo();
}
this.drag.setDragHandle(this.titleBar);
var self = this;
dojo.event.topic.subscribe("dragMove",
function (info){
if (info.source.domNode == self.domNode){
dojo.event.topic.publish('floatingPaneMove', { source: self } );
}
}
);
}
if(this.resizable){
this.resizeBar.style.display="";
var rh = dojo.widget.createWidget("ResizeHandle", {targetElmId: this.widgetId, id:this.widgetId+"_resize"});
this.resizeBar.appendChild(rh.domNode);
}
// add a drop shadow
if(this.hasShadow){
this.shadow=new dojo.html.shadow(this.domNode);
}
// Prevent IE bleed-through problem
this.bgIframe = new dojo.html.BackgroundIframe(this.domNode);
if( this.taskBarId ){
this.taskBarSetup();
}
if (dojo.hostenv.post_load_) {
this.setInitialWindowState();
} else {
dojo.addOnLoad(this, "setInitialWindowState");
}
// counteract body.appendChild above
document.body.removeChild(this.domNode);
dojo.widget.html.FloatingPane.superclass.fillInTemplate.call(this, args, frag);
},
postCreate: function(){
if(this.isShowing()){
this.width=-1; // force resize
this.resizeTo(dojo.style.getOuterWidth(this.domNode), dojo.style.getOuterHeight(this.domNode));
}
},
maximizeWindow: function(evt) {
this.previous={
width: dojo.style.getOuterWidth(this.domNode) || this.width,
height: dojo.style.getOuterHeight(this.domNode) || this.height,
left: this.domNode.style.left,
top: this.domNode.style.top,
bottom: this.domNode.style.bottom,
right: this.domNode.style.right
};
this.domNode.style.left =
dojo.style.getPixelValue(this.domNode.parentNode, "padding-left", true) + "px";
this.domNode.style.top =
dojo.style.getPixelValue(this.domNode.parentNode, "padding-top", true) + "px";
if ((this.domNode.parentNode.nodeName.toLowerCase() == 'body')) {
this.resizeTo(
dojo.html.getViewportWidth()-dojo.style.getPaddingWidth(document.body),
dojo.html.getViewportHeight()-dojo.style.getPaddingHeight(document.body)
);
} else {
this.resizeTo(
dojo.style.getContentWidth(this.domNode.parentNode),
dojo.style.getContentHeight(this.domNode.parentNode)
);
}
this.maximizeAction.style.display="none";
this.restoreAction.style.display="";
this.windowState="maximized";
},
minimizeWindow: function(evt) {
this.hide();
this.windowState = "minimized";
},
restoreWindow: function(evt) {
if (this.windowState=="minimized") {
this.show()
} else {
for(var attr in this.previous){
this.domNode.style[attr] = this.previous[attr];
}
this.resizeTo(this.previous.width, this.previous.height);
this.previous=null;
this.restoreAction.style.display="none";
this.maximizeAction.style.display=this.displayMaximizeAction ? "" : "none";
}
this.windowState="normal";
},
closeWindow: function(evt) {
dojo.dom.removeNode(this.domNode);
this.destroy();
},
onMouseDown: function(evt) {
this.bringToTop();
},
bringToTop: function() {
var floatingPanes= dojo.widget.manager.getWidgetsByType(this.widgetType);
var windows = [];
for (var x=0; x<floatingPanes.length; x++) {
if (this.widgetId != floatingPanes[x].widgetId) {
windows.push(floatingPanes[x]);
}
}
windows.sort(function(a,b) {
return a.domNode.style.zIndex - b.domNode.style.zIndex;
});
windows.push(this);
var floatingPaneStartingZ = 100;
for (x=0; x<windows.length;x++) {
windows[x].domNode.style.zIndex = floatingPaneStartingZ + x;
}
},
setInitialWindowState: function() {
if (this.windowState == "maximized") {
this.maximizeWindow();
this.show();
return;
}
if (this.windowState=="normal") {
this.show();
return;
}
if (this.windowState=="minimized") {
this.hide();
return;
}
this.windowState="minimized";
},
// add icon to task bar, connected to me
taskBarSetup: function() {
var taskbar = dojo.widget.getWidgetById(this.taskBarId);
if (!taskbar){
if (this.taskBarConnectAttempts < this.maxTaskBarConnectAttempts) {
dojo.lang.setTimeout(this, this.taskBarSetup, 50);
this.taskBarConnectAttempts++;
} else {
dojo.debug("Unable to connect to the taskBar");
}
return;
}
taskbar.addChild(this);
},
show: function(){
dojo.widget.html.FloatingPane.superclass.show.apply(this, arguments);
this.bringToTop();
},
onShow: function(){
dojo.widget.html.FloatingPane.superclass.onShow.call(this);
this.resizeTo(dojo.style.getOuterWidth(this.domNode), dojo.style.getOuterHeight(this.domNode));
},
// This is called when the user adjusts the size of the floating pane
resizeTo: function(w, h){
dojo.style.setOuterWidth(this.domNode, w);
dojo.style.setOuterHeight(this.domNode, h);
dojo.html.layout(this.domNode,
[
{domNode: this.titleBar, layoutAlign: "top"},
{domNode: this.resizeBar, layoutAlign: "bottom"},
{domNode: this.containerNode, layoutAlign: "client"}
] );
// If any of the children have layoutAlign specified, obey it
dojo.html.layout(this.containerNode, this.children, "top-bottom");
this.bgIframe.onResized();
if(this.shadow){ this.shadow.size(w, h); }
this.onResized();
},
checkSize: function() {
// checkSize() is called when the user has resized the browser window,
// but that doesn't affect this widget (or this widget's children)
// so it can be safely ignored...
// TODO: unless we are maximized. then we should resize ourself.
}
});
dojo.widget.tags.addParseTreeHandler("dojo:FloatingPane");

View file

@ -8,37 +8,37 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.GoogleMap");
dojo.provide("dojo.widget.GoogleMap.Controls");
dojo.require("dojo.widget.*");
dojo.widget.tags.addParseTreeHandler("dojo:googlemap");
dojo.widget.GoogleMap=function(){
// summary
// base class for the Google Map widget
dojo.widget.Widget.call(this);
this.widgetType="GoogleMap";
this.isContainer=false;
}
dojo.inherits(dojo.widget.GoogleMap, dojo.widget.Widget);
dojo.widget.GoogleMap.Controls={
LargeMap:"largemap",
SmallMap:"smallmap",
SmallZoom:"smallzoom",
Scale:"scale",
MapType:"maptype",
Overview:"overview",
get:function(s){
for(var p in this){
if(typeof(this[p])=="string"
&& this[p]==s
){
return p;
}
}
return null;
}
};
dojo.requireAfterIf("html", "dojo.widget.html.GoogleMap");
dojo.provide("dojo.widget.GoogleMap");
dojo.provide("dojo.widget.GoogleMap.Controls");
dojo.require("dojo.widget.*");
dojo.widget.tags.addParseTreeHandler("dojo:googlemap");
dojo.widget.GoogleMap=function(){
// summary
// base class for the Google Map widget
dojo.widget.Widget.call(this);
this.widgetType="GoogleMap";
this.isContainer=false;
}
dojo.inherits(dojo.widget.GoogleMap, dojo.widget.Widget);
dojo.widget.GoogleMap.Controls={
LargeMap:"largemap",
SmallMap:"smallmap",
SmallZoom:"smallzoom",
Scale:"scale",
MapType:"maptype",
Overview:"overview",
get:function(s){
for(var p in this){
if(typeof(this[p])=="string"
&& this[p]==s
){
return p;
}
}
return null;
}
};
dojo.requireAfterIf("html", "dojo.widget.html.GoogleMap");

View file

@ -8,69 +8,69 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.Select");
dojo.provide("dojo.widget.html.Select");
dojo.require("dojo.widget.html.ComboBox");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.html.stabile");
/*
* The Select widget is an enhanced version of HTML's <select> tag.
*
* Similar features:
* - There is a drop down list of possible values.
* - You can only enter a value from the drop down list. (You can't enter an arbitrary value.)
* - The value submitted with the form is the hidden value (ex: CA),
not the displayed value a.k.a. label (ex: California)
*
* Enhancements over plain HTML version:
* - If you type in some text then it will filter down the list of possible values in the drop down list.
* - List can be specified either as a static list or via a javascript function (that can get the list from a server)
*/
dojo.widget.defineWidget(
"dojo.widget.html.Select",
dojo.widget.html.ComboBox,
{
widgetType: "Select",
forceValidOption: true,
setValue: function(value) {
this.comboBoxValue.value = value;
dojo.widget.html.stabile.setState(this.widgetId, this.getState(), true);
},
setLabel: function(value){
// FIXME, not sure what to do here!
this.comboBoxSelectionValue.value = value;
if (this.textInputNode.value != value) { // prevent mucking up of selection
this.textInputNode.value = value;
}
},
getLabel: function(){
return this.comboBoxSelectionValue.value;
},
getState: function() {
return {
value: this.getValue(),
label: this.getLabel()
};
},
onKeyUp: function(evt){
this.setLabel(this.textInputNode.value);
},
setState: function(state) {
this.setValue(state.value);
this.setLabel(state.label);
},
setAllValues: function(value1, value2){
this.setValue(value2);
this.setLabel(value1);
}
});
dojo.provide("dojo.widget.Select");
dojo.provide("dojo.widget.html.Select");
dojo.require("dojo.widget.html.ComboBox");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.html.stabile");
/*
* The Select widget is an enhanced version of HTML's <select> tag.
*
* Similar features:
* - There is a drop down list of possible values.
* - You can only enter a value from the drop down list. (You can't enter an arbitrary value.)
* - The value submitted with the form is the hidden value (ex: CA),
not the displayed value a.k.a. label (ex: California)
*
* Enhancements over plain HTML version:
* - If you type in some text then it will filter down the list of possible values in the drop down list.
* - List can be specified either as a static list or via a javascript function (that can get the list from a server)
*/
dojo.widget.defineWidget(
"dojo.widget.html.Select",
dojo.widget.html.ComboBox,
{
widgetType: "Select",
forceValidOption: true,
setValue: function(value) {
this.comboBoxValue.value = value;
dojo.widget.html.stabile.setState(this.widgetId, this.getState(), true);
},
setLabel: function(value){
// FIXME, not sure what to do here!
this.comboBoxSelectionValue.value = value;
if (this.textInputNode.value != value) { // prevent mucking up of selection
this.textInputNode.value = value;
}
},
getLabel: function(){
return this.comboBoxSelectionValue.value;
},
getState: function() {
return {
value: this.getValue(),
label: this.getLabel()
};
},
onKeyUp: function(evt){
this.setLabel(this.textInputNode.value);
},
setState: function(state) {
this.setValue(state.value);
this.setLabel(state.label);
},
setAllValues: function(value1, value2){
this.setValue(value2);
this.setLabel(value1);
}
});

View file

@ -8,254 +8,254 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.TabContainer");
dojo.provide("dojo.widget.html.TabContainer");
dojo.provide("dojo.widget.Tab");
dojo.require("dojo.lang.func");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.event.*");
dojo.require("dojo.html");
dojo.require("dojo.style");
dojo.require("dojo.html.layout");
//////////////////////////////////////////
// TabContainer -- a set of Tabs
//////////////////////////////////////////
dojo.widget.html.TabContainer = function() {
dojo.widget.HtmlWidget.call(this);
}
dojo.inherits(dojo.widget.html.TabContainer, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.TabContainer, {
widgetType: "TabContainer",
isContainer: true,
// Constructor arguments
labelPosition: "top",
closeButton: "none",
useVisibility: false, // true-->use visibility:hidden instead of display:none
// if false, TabContainers size changes according to size of currently selected tab
doLayout: true,
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlTabContainer.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlTabContainer.css"),
selectedTab: "", // initially selected tab (widgetId)
fillInTemplate: function(args, frag) {
// Copy style info from input node to output node
var source = this.getFragNodeRef(frag);
dojo.html.copyStyle(this.domNode, source);
dojo.widget.html.TabContainer.superclass.fillInTemplate.call(this, args, frag);
},
postCreate: function(args, frag) {
// Load all the tabs, creating a label for each one
for(var i=0; i<this.children.length; i++){
this._setupTab(this.children[i]);
}
if (this.closeButton=="pane") {
var div = document.createElement("div");
dojo.html.addClass(div, "dojoTabPanePaneClose");
var self = this;
dojo.event.connect(div, "onclick", function(){ self._runOnCloseTab(self.selectedTabWidget); });
dojo.event.connect(div, "onmouseover", function(){ dojo.html.addClass(div, "dojoTabPanePaneCloseHover"); });
dojo.event.connect(div, "onmouseout", function(){ dojo.html.removeClass(div, "dojoTabPanePaneCloseHover"); });
this.dojoTabLabels.appendChild(div);
}
if(this.doLayout){
dojo.html.addClass(this.dojoTabLabels, "dojoTabLabels-"+this.labelPosition);
} else {
dojo.html.addClass(this.dojoTabLabels, "dojoTabLabels-"+this.labelPosition+"-noLayout");
}
this._doSizing();
// Display the selected tab
if(this.selectedTabWidget){
this.selectTab(this.selectedTabWidget, true);
}
},
addChild: function(child, overrideContainerNode, pos, ref, insertIndex){
this._setupTab(child);
dojo.widget.html.TabContainer.superclass.addChild.call(this,child, overrideContainerNode, pos, ref, insertIndex);
// in case the tab labels have overflowed from one line to two lines
this._doSizing();
},
_setupTab: function(tab){
tab.domNode.style.display="none";
// Create label
tab.div = document.createElement("div");
dojo.widget.wai.setAttr(tab.div, "waiRole", "tab");
dojo.html.addClass(tab.div, "dojoTabPaneTab");
var span = document.createElement("span");
span.innerHTML = tab.label;
dojo.html.disableSelection(span);
if (this.closeButton=="tab") {
var img = document.createElement("div");
dojo.html.addClass(img, "dojoTabPaneTabClose");
var self = this;
dojo.event.connect(img, "onclick", function(evt){ self._runOnCloseTab(tab); dojo.event.browser.stopEvent(evt); });
dojo.event.connect(img, "onmouseover", function(){ dojo.html.addClass(img,"dojoTabPaneTabCloseHover"); });
dojo.event.connect(img, "onmouseout", function(){ dojo.html.removeClass(img,"dojoTabPaneTabCloseHover"); });
span.appendChild(img);
}
tab.div.appendChild(span);
this.dojoTabLabels.appendChild(tab.div);
var self = this;
dojo.event.connect(tab.div, "onclick", function(){ self.selectTab(tab); });
if(!this.selectedTabWidget || this.selectedTab==tab.widgetId || tab.selected){
this.selectedTabWidget = tab;
} else {
this._hideTab(tab);
}
dojo.html.addClass(tab.domNode, "dojoTabPane");
with(tab.domNode.style){
top = dojo.style.getPixelValue(this.containerNode, "padding-top", true);
left = dojo.style.getPixelValue(this.containerNode, "padding-left", true);
}
},
// Configure the content pane to take up all the space except for where the tab labels are
_doSizing: function(){
// position the labels and the container node
var labelAlign=this.labelPosition.replace(/-h/,"");
var children = [
{domNode: this.dojoTabLabels, layoutAlign: labelAlign},
{domNode: this.containerNode, layoutAlign: "client"}
];
if (this.doLayout) {
dojo.html.layout(this.domNode, children);
}
// size the current tab
// TODO: should have ptr to current tab rather than searching
var cw=dojo.style.getContentWidth(this.containerNode);
var ch=dojo.style.getContentHeight(this.containerNode);
dojo.lang.forEach(this.children, function(child){
//if (this.doLayout) {
if(child.selected){
child.resizeTo(cw, ch);
}
//} else {
// child.onResized();
//}
});
},
removeChild: function(tab) {
// remove tab event handlers
dojo.event.disconnect(tab.div, "onclick", function () { });
if (this.closeButton=="tab") {
var img = tab.div.lastChild.lastChild;
if (img) {
dojo.html.removeClass(img, "dojoTabPaneTabClose", function () { });
dojo.event.disconnect(img, "onclick", function () { });
dojo.event.disconnect(img, "onmouseover", function () { });
dojo.event.disconnect(img, "onmouseout", function () { });
}
}
dojo.widget.html.TabContainer.superclass.removeChild.call(this, tab);
dojo.html.removeClass(tab.domNode, "dojoTabPane");
this.dojoTabLabels.removeChild(tab.div);
delete(tab.div);
if (this.selectedTabWidget === tab) {
this.selectedTabWidget = undefined;
if (this.children.length > 0) {
this.selectTab(this.children[0], true);
}
}
// in case the tab labels have overflowed from one line to two lines
this._doSizing();
},
selectTab: function(tab, _noRefresh) {
// Deselect old tab and select new one
if (this.selectedTabWidget) {
this._hideTab(this.selectedTabWidget);
}
this.selectedTabWidget = tab;
this._showTab(tab, _noRefresh);
},
_showTab: function(tab, _noRefresh) {
dojo.html.addClass(tab.div, "current");
tab.selected=true;
if ( this.useVisibility && !dojo.render.html.ie ) {
tab.domNode.style.visibility="visible";
} else {
// make sure we dont refresh onClose and on postCreate
// speeds up things a bit when using refreshOnShow and fixes #646
if(_noRefresh && tab.refreshOnShow){
var tmp = tab.refreshOnShow;
tab.refreshOnShow = false;
tab.show();
tab.refreshOnShow = tmp;
}else{
tab.show();
}
tab.resizeTo(
dojo.style.getContentWidth(this.containerNode),
dojo.style.getContentHeight(this.containerNode)
);
}
},
_hideTab: function(tab) {
dojo.html.removeClass(tab.div, "current");
tab.selected=false;
if( this.useVisibility ){
tab.domNode.style.visibility="hidden";
}else{
tab.hide();
}
},
_runOnCloseTab: function(tab) {
var onc = tab.extraArgs.onClose || tab.extraArgs.onclose;
var fcn = dojo.lang.isFunction(onc) ? onc : window[onc];
var remove = dojo.lang.isFunction(fcn) ? fcn(this,tab) : true;
if(remove) {
this.removeChild(tab);
// makes sure we can clean up executeScripts in ContentPane onUnLoad
tab.destroy();
}
},
onResized: function() {
this._doSizing();
}
});
dojo.widget.tags.addParseTreeHandler("dojo:TabContainer");
// These arguments can be specified for the children of a TabContainer.
// Since any widget can be specified as a TabContainer child, mix them
// into the base widget class. (This is a hack, but it's effective.)
dojo.lang.extend(dojo.widget.Widget, {
label: "",
selected: false // is this tab currently selected?
});
dojo.provide("dojo.widget.TabContainer");
dojo.provide("dojo.widget.html.TabContainer");
dojo.provide("dojo.widget.Tab");
dojo.require("dojo.lang.func");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.event.*");
dojo.require("dojo.html");
dojo.require("dojo.style");
dojo.require("dojo.html.layout");
//////////////////////////////////////////
// TabContainer -- a set of Tabs
//////////////////////////////////////////
dojo.widget.html.TabContainer = function() {
dojo.widget.HtmlWidget.call(this);
}
dojo.inherits(dojo.widget.html.TabContainer, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.TabContainer, {
widgetType: "TabContainer",
isContainer: true,
// Constructor arguments
labelPosition: "top",
closeButton: "none",
useVisibility: false, // true-->use visibility:hidden instead of display:none
// if false, TabContainers size changes according to size of currently selected tab
doLayout: true,
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlTabContainer.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlTabContainer.css"),
selectedTab: "", // initially selected tab (widgetId)
fillInTemplate: function(args, frag) {
// Copy style info from input node to output node
var source = this.getFragNodeRef(frag);
dojo.html.copyStyle(this.domNode, source);
dojo.widget.html.TabContainer.superclass.fillInTemplate.call(this, args, frag);
},
postCreate: function(args, frag) {
// Load all the tabs, creating a label for each one
for(var i=0; i<this.children.length; i++){
this._setupTab(this.children[i]);
}
if (this.closeButton=="pane") {
var div = document.createElement("div");
dojo.html.addClass(div, "dojoTabPanePaneClose");
var self = this;
dojo.event.connect(div, "onclick", function(){ self._runOnCloseTab(self.selectedTabWidget); });
dojo.event.connect(div, "onmouseover", function(){ dojo.html.addClass(div, "dojoTabPanePaneCloseHover"); });
dojo.event.connect(div, "onmouseout", function(){ dojo.html.removeClass(div, "dojoTabPanePaneCloseHover"); });
this.dojoTabLabels.appendChild(div);
}
if(this.doLayout){
dojo.html.addClass(this.dojoTabLabels, "dojoTabLabels-"+this.labelPosition);
} else {
dojo.html.addClass(this.dojoTabLabels, "dojoTabLabels-"+this.labelPosition+"-noLayout");
}
this._doSizing();
// Display the selected tab
if(this.selectedTabWidget){
this.selectTab(this.selectedTabWidget, true);
}
},
addChild: function(child, overrideContainerNode, pos, ref, insertIndex){
this._setupTab(child);
dojo.widget.html.TabContainer.superclass.addChild.call(this,child, overrideContainerNode, pos, ref, insertIndex);
// in case the tab labels have overflowed from one line to two lines
this._doSizing();
},
_setupTab: function(tab){
tab.domNode.style.display="none";
// Create label
tab.div = document.createElement("div");
dojo.widget.wai.setAttr(tab.div, "waiRole", "tab");
dojo.html.addClass(tab.div, "dojoTabPaneTab");
var span = document.createElement("span");
span.innerHTML = tab.label;
dojo.html.disableSelection(span);
if (this.closeButton=="tab") {
var img = document.createElement("div");
dojo.html.addClass(img, "dojoTabPaneTabClose");
var self = this;
dojo.event.connect(img, "onclick", function(evt){ self._runOnCloseTab(tab); dojo.event.browser.stopEvent(evt); });
dojo.event.connect(img, "onmouseover", function(){ dojo.html.addClass(img,"dojoTabPaneTabCloseHover"); });
dojo.event.connect(img, "onmouseout", function(){ dojo.html.removeClass(img,"dojoTabPaneTabCloseHover"); });
span.appendChild(img);
}
tab.div.appendChild(span);
this.dojoTabLabels.appendChild(tab.div);
var self = this;
dojo.event.connect(tab.div, "onclick", function(){ self.selectTab(tab); });
if(!this.selectedTabWidget || this.selectedTab==tab.widgetId || tab.selected){
this.selectedTabWidget = tab;
} else {
this._hideTab(tab);
}
dojo.html.addClass(tab.domNode, "dojoTabPane");
with(tab.domNode.style){
top = dojo.style.getPixelValue(this.containerNode, "padding-top", true);
left = dojo.style.getPixelValue(this.containerNode, "padding-left", true);
}
},
// Configure the content pane to take up all the space except for where the tab labels are
_doSizing: function(){
// position the labels and the container node
var labelAlign=this.labelPosition.replace(/-h/,"");
var children = [
{domNode: this.dojoTabLabels, layoutAlign: labelAlign},
{domNode: this.containerNode, layoutAlign: "client"}
];
if (this.doLayout) {
dojo.html.layout(this.domNode, children);
}
// size the current tab
// TODO: should have ptr to current tab rather than searching
var cw=dojo.style.getContentWidth(this.containerNode);
var ch=dojo.style.getContentHeight(this.containerNode);
dojo.lang.forEach(this.children, function(child){
//if (this.doLayout) {
if(child.selected){
child.resizeTo(cw, ch);
}
//} else {
// child.onResized();
//}
});
},
removeChild: function(tab) {
// remove tab event handlers
dojo.event.disconnect(tab.div, "onclick", function () { });
if (this.closeButton=="tab") {
var img = tab.div.lastChild.lastChild;
if (img) {
dojo.html.removeClass(img, "dojoTabPaneTabClose", function () { });
dojo.event.disconnect(img, "onclick", function () { });
dojo.event.disconnect(img, "onmouseover", function () { });
dojo.event.disconnect(img, "onmouseout", function () { });
}
}
dojo.widget.html.TabContainer.superclass.removeChild.call(this, tab);
dojo.html.removeClass(tab.domNode, "dojoTabPane");
this.dojoTabLabels.removeChild(tab.div);
delete(tab.div);
if (this.selectedTabWidget === tab) {
this.selectedTabWidget = undefined;
if (this.children.length > 0) {
this.selectTab(this.children[0], true);
}
}
// in case the tab labels have overflowed from one line to two lines
this._doSizing();
},
selectTab: function(tab, _noRefresh) {
// Deselect old tab and select new one
if (this.selectedTabWidget) {
this._hideTab(this.selectedTabWidget);
}
this.selectedTabWidget = tab;
this._showTab(tab, _noRefresh);
},
_showTab: function(tab, _noRefresh) {
dojo.html.addClass(tab.div, "current");
tab.selected=true;
if ( this.useVisibility && !dojo.render.html.ie ) {
tab.domNode.style.visibility="visible";
} else {
// make sure we dont refresh onClose and on postCreate
// speeds up things a bit when using refreshOnShow and fixes #646
if(_noRefresh && tab.refreshOnShow){
var tmp = tab.refreshOnShow;
tab.refreshOnShow = false;
tab.show();
tab.refreshOnShow = tmp;
}else{
tab.show();
}
tab.resizeTo(
dojo.style.getContentWidth(this.containerNode),
dojo.style.getContentHeight(this.containerNode)
);
}
},
_hideTab: function(tab) {
dojo.html.removeClass(tab.div, "current");
tab.selected=false;
if( this.useVisibility ){
tab.domNode.style.visibility="hidden";
}else{
tab.hide();
}
},
_runOnCloseTab: function(tab) {
var onc = tab.extraArgs.onClose || tab.extraArgs.onclose;
var fcn = dojo.lang.isFunction(onc) ? onc : window[onc];
var remove = dojo.lang.isFunction(fcn) ? fcn(this,tab) : true;
if(remove) {
this.removeChild(tab);
// makes sure we can clean up executeScripts in ContentPane onUnLoad
tab.destroy();
}
},
onResized: function() {
this._doSizing();
}
});
dojo.widget.tags.addParseTreeHandler("dojo:TabContainer");
// These arguments can be specified for the children of a TabContainer.
// Since any widget can be specified as a TabContainer child, mix them
// into the base widget class. (This is a hack, but it's effective.)
dojo.lang.extend(dojo.widget.Widget, {
label: "",
selected: false // is this tab currently selected?
});

View file

@ -8,25 +8,25 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.TaskBar");
dojo.provide("dojo.widget.TaskBarItem");
dojo.require("dojo.widget.Widget");
dojo.widget.TaskBar = function(){
dojo.widget.Widget.call(this);
this.widgetType = "TaskBar";
this.isContainer = true;
}
dojo.inherits(dojo.widget.TaskBar, dojo.widget.Widget);
dojo.widget.tags.addParseTreeHandler("dojo:taskbar");
dojo.widget.TaskBarItem = function(){
dojo.widget.Widget.call(this);
this.widgetType = "TaskBarItem";
}
dojo.inherits(dojo.widget.TaskBarItem, dojo.widget.Widget);
dojo.widget.tags.addParseTreeHandler("dojo:taskbaritem");
dojo.requireAfterIf("html", "dojo.widget.html.TaskBar");
dojo.provide("dojo.widget.TaskBar");
dojo.provide("dojo.widget.TaskBarItem");
dojo.require("dojo.widget.Widget");
dojo.widget.TaskBar = function(){
dojo.widget.Widget.call(this);
this.widgetType = "TaskBar";
this.isContainer = true;
}
dojo.inherits(dojo.widget.TaskBar, dojo.widget.Widget);
dojo.widget.tags.addParseTreeHandler("dojo:taskbar");
dojo.widget.TaskBarItem = function(){
dojo.widget.Widget.call(this);
this.widgetType = "TaskBarItem";
}
dojo.inherits(dojo.widget.TaskBarItem, dojo.widget.Widget);
dojo.widget.tags.addParseTreeHandler("dojo:taskbaritem");
dojo.requireAfterIf("html", "dojo.widget.html.TaskBar");

View file

@ -8,33 +8,33 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.Toggler");
dojo.require("dojo.widget.*");
dojo.require("dojo.event.*");
// clicking on this node shows/hides another widget
dojo.widget.Toggler = function(){
dojo.widget.DomWidget.call(this);
}
dojo.inherits(dojo.widget.Toggler, dojo.widget.DomWidget);
dojo.lang.extend(dojo.widget.Toggler, {
widgetType: "Toggler",
// Associated widget
targetId: '',
fillInTemplate: function() {
dojo.event.connect(this.domNode, "onclick", this, "onClick");
},
onClick: function() {
var pane = dojo.widget.byId(this.targetId);
if(!pane){ return; }
pane.explodeSrc = this.domNode;
pane.toggleShowing();
}
});
dojo.widget.tags.addParseTreeHandler("dojo:toggler");
dojo.provide("dojo.widget.Toggler");
dojo.require("dojo.widget.*");
dojo.require("dojo.event.*");
// clicking on this node shows/hides another widget
dojo.widget.Toggler = function(){
dojo.widget.DomWidget.call(this);
}
dojo.inherits(dojo.widget.Toggler, dojo.widget.DomWidget);
dojo.lang.extend(dojo.widget.Toggler, {
widgetType: "Toggler",
// Associated widget
targetId: '',
fillInTemplate: function() {
dojo.event.connect(this.domNode, "onclick", this, "onClick");
},
onClick: function() {
var pane = dojo.widget.byId(this.targetId);
if(!pane){ return; }
pane.explodeSrc = this.domNode;
pane.toggleShowing();
}
});
dojo.widget.tags.addParseTreeHandler("dojo:toggler");

View file

@ -8,7 +8,7 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.Tooltip");
dojo.require("dojo.widget.Widget");
dojo.requireAfterIf("html", "dojo.widget.html.Tooltip");
dojo.provide("dojo.widget.Tooltip");
dojo.require("dojo.widget.Widget");
dojo.requireAfterIf("html", "dojo.widget.html.Tooltip");

File diff suppressed because it is too large Load diff

View file

@ -8,20 +8,20 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.YahooMap");
dojo.provide("dojo.widget.YahooMap.Controls");
dojo.require("dojo.widget.*");
dojo.widget.defineWidget(
"dojo.widget.YahooMap",
dojo.widget.Widget,
{ isContainer: false }
);
dojo.widget.YahooMap.Controls={
MapType:"maptype",
Pan:"pan",
ZoomLong:"zoomlong",
ZoomShort:"zoomshort"
};
dojo.requireAfterIf("html", "dojo.widget.html.YahooMap");
dojo.provide("dojo.widget.YahooMap");
dojo.provide("dojo.widget.YahooMap.Controls");
dojo.require("dojo.widget.*");
dojo.widget.defineWidget(
"dojo.widget.YahooMap",
dojo.widget.Widget,
{ isContainer: false }
);
dojo.widget.YahooMap.Controls={
MapType:"maptype",
Pan:"pan",
ZoomLong:"zoomlong",
ZoomShort:"zoomshort"
};
dojo.requireAfterIf("html", "dojo.widget.html.YahooMap");

View file

@ -8,91 +8,91 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.html.AccordionPane");
dojo.require("dojo.widget.TitlePane");
dojo.widget.html.AccordionPane = function(){
dojo.widget.html.TitlePane.call(this);
this.widgetType = "AccordionPane";
this.open=false;
this.allowCollapse=true;
this.label="";
this.open=false;
this.labelNodeClass="";
this.containerNodeClass="";
}
dojo.inherits(dojo.widget.html.AccordionPane, dojo.widget.html.TitlePane);
dojo.lang.extend(dojo.widget.html.AccordionPane, {
postCreate: function() {
dojo.widget.html.AccordionPane.superclass.postCreate.call(this);
this.domNode.widgetType=this.widgetType;
this.setSizes();
dojo.html.addClass(this.labelNode, this.labelNodeClass);
dojo.html.disableSelection(this.labelNode);
dojo.html.addClass(this.containerNode, this.containerNodeClass);
},
collapse: function() {
//dojo.fx.html.wipeOut(this.containerNode,250);
//var anim = dojo.fx.html.wipe(this.containerNode, 1000, this.containerNode.offsetHeight, 0, null, true);
this.containerNode.style.display="none";
this.open=false;
},
expand: function() {
//dojo.fx.html.wipeIn(this.containerNode,250);
this.containerNode.style.display="block";
//var anim = dojo.fx.html.wipe(this.containerNode, 1000, 0, this.containerNode.scrollHeight, null, true);
this.open=true;
},
getCollapsedHeight: function() {
return dojo.style.getOuterHeight(this.labelNode)+1;
},
setSizes: function() {
var siblings = this.domNode.parentNode.childNodes;
var height=dojo.style.getInnerHeight(this.domNode.parentNode)-this.getCollapsedHeight();
this.siblingWidgets = [];
for (var x=0; x<siblings.length; x++) {
if (siblings[x].widgetType==this.widgetType) {
if (this.domNode != siblings[x]) {
var ap = dojo.widget.byNode(siblings[x]);
this.siblingWidgets.push(ap);
height -= ap.getCollapsedHeight();
}
}
}
for (var x=0; x<this.siblingWidgets.length; x++) {
dojo.style.setOuterHeight(this.siblingWidgets[x].containerNode,height);
}
dojo.style.setOuterHeight(this.containerNode,height);
},
onLabelClick: function() {
this.setSizes();
if (!this.open) {
for (var x=0; x<this.siblingWidgets.length;x++) {
if (this.siblingWidgets[x].open) {
this.siblingWidgets[x].collapse();
}
}
this.expand();
} else {
if (this.allowCollapse) {
this.collapse();
}
}
}
});
dojo.widget.tags.addParseTreeHandler("dojo:AccordionPane");
dojo.provide("dojo.widget.html.AccordionPane");
dojo.require("dojo.widget.TitlePane");
dojo.widget.html.AccordionPane = function(){
dojo.widget.html.TitlePane.call(this);
this.widgetType = "AccordionPane";
this.open=false;
this.allowCollapse=true;
this.label="";
this.open=false;
this.labelNodeClass="";
this.containerNodeClass="";
}
dojo.inherits(dojo.widget.html.AccordionPane, dojo.widget.html.TitlePane);
dojo.lang.extend(dojo.widget.html.AccordionPane, {
postCreate: function() {
dojo.widget.html.AccordionPane.superclass.postCreate.call(this);
this.domNode.widgetType=this.widgetType;
this.setSizes();
dojo.html.addClass(this.labelNode, this.labelNodeClass);
dojo.html.disableSelection(this.labelNode);
dojo.html.addClass(this.containerNode, this.containerNodeClass);
},
collapse: function() {
//dojo.fx.html.wipeOut(this.containerNode,250);
//var anim = dojo.fx.html.wipe(this.containerNode, 1000, this.containerNode.offsetHeight, 0, null, true);
this.containerNode.style.display="none";
this.open=false;
},
expand: function() {
//dojo.fx.html.wipeIn(this.containerNode,250);
this.containerNode.style.display="block";
//var anim = dojo.fx.html.wipe(this.containerNode, 1000, 0, this.containerNode.scrollHeight, null, true);
this.open=true;
},
getCollapsedHeight: function() {
return dojo.style.getOuterHeight(this.labelNode)+1;
},
setSizes: function() {
var siblings = this.domNode.parentNode.childNodes;
var height=dojo.style.getInnerHeight(this.domNode.parentNode)-this.getCollapsedHeight();
this.siblingWidgets = [];
for (var x=0; x<siblings.length; x++) {
if (siblings[x].widgetType==this.widgetType) {
if (this.domNode != siblings[x]) {
var ap = dojo.widget.byNode(siblings[x]);
this.siblingWidgets.push(ap);
height -= ap.getCollapsedHeight();
}
}
}
for (var x=0; x<this.siblingWidgets.length; x++) {
dojo.style.setOuterHeight(this.siblingWidgets[x].containerNode,height);
}
dojo.style.setOuterHeight(this.containerNode,height);
},
onLabelClick: function() {
this.setSizes();
if (!this.open) {
for (var x=0; x<this.siblingWidgets.length;x++) {
if (this.siblingWidgets[x].open) {
this.siblingWidgets[x].collapse();
}
}
this.expand();
} else {
if (this.allowCollapse) {
this.collapse();
}
}
}
});
dojo.widget.tags.addParseTreeHandler("dojo:AccordionPane");

View file

@ -8,18 +8,18 @@
http://dojotoolkit.org/community/licensing.shtml
*/
// this is a stub that will be removed in 0.4, see ../Button2.html for details
dojo.provide("dojo.widget.html.Button2");
dojo.widget.html.Button2 = function(){}
dojo.inherits(dojo.widget.html.Button2, dojo.widget.html.Button);
dojo.lang.extend(dojo.widget.html.Button2, { widgetType: "Button2" });
dojo.widget.html.DropDownButton2 = function(){}
dojo.inherits(dojo.widget.html.DropDownButton2, dojo.widget.html.DropDownButton);
dojo.lang.extend(dojo.widget.html.DropDownButton2, { widgetType: "DropDownButton2" });
dojo.widget.html.ComboButton2 = function(){}
dojo.inherits(dojo.widget.html.ComboButton2, dojo.widget.html.ComboButton);
// this is a stub that will be removed in 0.4, see ../Button2.html for details
dojo.provide("dojo.widget.html.Button2");
dojo.widget.html.Button2 = function(){}
dojo.inherits(dojo.widget.html.Button2, dojo.widget.html.Button);
dojo.lang.extend(dojo.widget.html.Button2, { widgetType: "Button2" });
dojo.widget.html.DropDownButton2 = function(){}
dojo.inherits(dojo.widget.html.DropDownButton2, dojo.widget.html.DropDownButton);
dojo.lang.extend(dojo.widget.html.DropDownButton2, { widgetType: "DropDownButton2" });
dojo.widget.html.ComboButton2 = function(){}
dojo.inherits(dojo.widget.html.ComboButton2, dojo.widget.html.ComboButton);
dojo.lang.extend(dojo.widget.html.ComboButton2, { widgetType: "ComboButton2" });

View file

@ -8,24 +8,24 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.html.DebugConsole");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.FloatingPane");
dojo.widget.html.DebugConsole= function(){
dojo.widget.html.FloatingPane.call(this);
dojo.widget.DebugConsole.call(this);
}
dojo.inherits(dojo.widget.html.DebugConsole, dojo.widget.html.FloatingPane);
dojo.lang.extend(dojo.widget.html.DebugConsole, {
fillInTemplate: function() {
dojo.widget.html.DebugConsole.superclass.fillInTemplate.apply(this, arguments);
this.containerNode.id = "debugConsoleClientPane";
djConfig.isDebug = true;
djConfig.debugContainerId = this.containerNode.id;
}
});
dojo.provide("dojo.widget.html.DebugConsole");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.FloatingPane");
dojo.widget.html.DebugConsole= function(){
dojo.widget.html.FloatingPane.call(this);
dojo.widget.DebugConsole.call(this);
}
dojo.inherits(dojo.widget.html.DebugConsole, dojo.widget.html.FloatingPane);
dojo.lang.extend(dojo.widget.html.DebugConsole, {
fillInTemplate: function() {
dojo.widget.html.DebugConsole.superclass.fillInTemplate.apply(this, arguments);
this.containerNode.id = "debugConsoleClientPane";
djConfig.isDebug = true;
djConfig.debugContainerId = this.containerNode.id;
}
});

View file

@ -8,181 +8,181 @@
http://dojotoolkit.org/community/licensing.shtml
*/
/* TODO:
* - make the dropdown "smart" so it can't get cutoff on bottom of page, sides of page, etc.
*/
dojo.provide("dojo.widget.html.DropdownButton");
dojo.require("dojo.event.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.uri.Uri");
dojo.require("dojo.dom");
dojo.require("dojo.style");
dojo.require("dojo.html");
dojo.widget.html.DropdownButton = function() {
// mix in the button properties
dojo.widget.DropdownButton.call(this);
dojo.widget.HtmlWidget.call(this);
}
dojo.inherits(dojo.widget.html.DropdownButton, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.DropdownButton, {
// In IE, event handlers on objects inside buttons don't work correctly, so
// we just set onClick on the button itself.
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlDropDownButtonTemplate.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlButtonTemplate.css"),
// attach points
button: null,
table: null,
labelCell: null,
borderCell: null,
arrowCell: null,
arrow: null,
fillInTemplate: function(args, frag) {
// input data (containing the anchor for the button itself, plus the
// thing to display when you push the down arrow)
var input = frag["dojo:"+this.widgetType.toLowerCase()]["nodeRef"];
// Recursively expand widgets inside of the <dojo:dropdownButton>
var parser = new dojo.xml.Parse();
var frag = parser.parseElement(input, null, true);
var ary = dojo.widget.getParser().createComponents(frag);
this.a = dojo.dom.getFirstChildElement(input); // the button contents
this.menu = dojo.dom.getNextSiblingElement(this.a); // the menu under the button
this.disabled = dojo.html.hasClass(this.a, "disabled");
if( this.disabled ) {
dojo.html.addClass(this.button, "dojoDisabled");
this.domNode.setAttribute("disabled", "true");
}
dojo.html.disableSelection(this.a);
this.a.style["text-decoration"]="none";
this.labelCell.appendChild(this.a);
this.arrow.src =
dojo.uri.dojoUri("src/widget/templates/images/dropdownButtonsArrow" +
(this.disabled ? "-disabled" : "") + ".gif");
// Attach menu to body so that it appears above other buttons
this.menu.style.position="absolute";
this.menu.style.display="none";
this.menu.style["z-index"] = 99;
document.body.appendChild(this.menu);
},
postCreate: function() {
if ( dojo.render.html.ie ) {
// Compensate for IE's weird padding of button content, which seems to be relative
// to the length of the content
var contentWidth = dojo.style.getOuterWidth(this.table);
this.labelCell.style["left"] = "-" + (contentWidth / 10) + "px";
this.arrowCell.style["left"] = (contentWidth / 10) + "px";
}
// Make menu at least as wide as the button
var buttonWidth = dojo.style.getOuterWidth(this.button);
var menuWidth = dojo.style.getOuterWidth(this.menu);
if ( buttonWidth > menuWidth ) {
dojo.style.setOuterWidth(this.menu, buttonWidth);
}
},
// If someone clicks anywhere else on the screen (including another menu),
// then close this menu.
onCanvasMouseDown: function(e) {
if( !dojo.dom.isDescendantOf(e.target, this.button) &&
!dojo.dom.isDescendantOf(e.target, this.menu) ) {
this.hideMenu();
}
},
eventWasOverArrow: function(e) {
// want to use dojo.html.overElement() but also need to detect clicks
// on the area between the arrow and the edge of the button
var eventX = e.clientX;
var borderX = dojo.style.totalOffsetLeft(this.borderCell);
return (eventX > borderX );
},
onMouseOver: function(e) {
dojo.html.addClass(this.button, "dojoButtonHover");
dojo.html.removeClass(this.button, "dojoButtonNoHover");
},
onMouseOut: function(e) {
dojo.html.removeClass(this.button, "dojoButtonHover");
dojo.html.addClass(this.button, "dojoButtonNoHover");
},
onClick: function(e) {
if ( this.eventWasOverArrow(e) ) {
this._onClickArrow();
} else {
this._onClickButton();
}
},
// Action when the user presses the button
_onClickButton: function(e) {
if ( this.a ) {
if ( this.a.click ) {
this.a.click();
} else if ( this.a.href ) {
location.href = this.a.href;
}
}
},
// Action when user presses the arrow
_onClickArrow: function() {
if ( this.menu.style.display == "none" ) {
this.showMenu();
} else {
this.hideMenu();
}
},
showMenu: function() {
if ( this.disabled )
return;
// Position it accordingly, relative to screen root (since
// it's attached to document.body)
this.menu.style.left = dojo.style.totalOffsetLeft(this.button) + "px";
this.menu.style.top = dojo.style.totalOffsetTop(this.button) + dojo.style.getOuterHeight(this.button) + "px";
// Display the menu; do this funky code below to stop the menu from extending
// all the way to the right edge of the screen.
// TODO: retest simple display="" to confirm that it doesn't work.
try {
this.menu.style.display="table"; // mozilla
} catch(e) {
this.menu.style.display="block"; // IE
}
// If someone clicks somewhere else on the screen then close the menu
dojo.event.connect(document.documentElement, "onmousedown", this, "onCanvasMouseDown");
// When someone clicks the menu, after the menu handles the event,
// close the menu (be careful not to close the menu too early or else
// the menu will never receive the event.)
dojo.event.connect(this.menu, "onclick", this, "hideMenu");
},
hideMenu: function() {
this.menu.style.display = "none";
dojo.event.disconnect(document.documentElement, "onmousedown", this, "onCanvasMouseDown");
dojo.event.disconnect(this.menu, "onclick", this, "hideMenu");
}
});
/* TODO:
* - make the dropdown "smart" so it can't get cutoff on bottom of page, sides of page, etc.
*/
dojo.provide("dojo.widget.html.DropdownButton");
dojo.require("dojo.event.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.uri.Uri");
dojo.require("dojo.dom");
dojo.require("dojo.style");
dojo.require("dojo.html");
dojo.widget.html.DropdownButton = function() {
// mix in the button properties
dojo.widget.DropdownButton.call(this);
dojo.widget.HtmlWidget.call(this);
}
dojo.inherits(dojo.widget.html.DropdownButton, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.DropdownButton, {
// In IE, event handlers on objects inside buttons don't work correctly, so
// we just set onClick on the button itself.
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlDropDownButtonTemplate.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlButtonTemplate.css"),
// attach points
button: null,
table: null,
labelCell: null,
borderCell: null,
arrowCell: null,
arrow: null,
fillInTemplate: function(args, frag) {
// input data (containing the anchor for the button itself, plus the
// thing to display when you push the down arrow)
var input = frag["dojo:"+this.widgetType.toLowerCase()]["nodeRef"];
// Recursively expand widgets inside of the <dojo:dropdownButton>
var parser = new dojo.xml.Parse();
var frag = parser.parseElement(input, null, true);
var ary = dojo.widget.getParser().createComponents(frag);
this.a = dojo.dom.getFirstChildElement(input); // the button contents
this.menu = dojo.dom.getNextSiblingElement(this.a); // the menu under the button
this.disabled = dojo.html.hasClass(this.a, "disabled");
if( this.disabled ) {
dojo.html.addClass(this.button, "dojoDisabled");
this.domNode.setAttribute("disabled", "true");
}
dojo.html.disableSelection(this.a);
this.a.style["text-decoration"]="none";
this.labelCell.appendChild(this.a);
this.arrow.src =
dojo.uri.dojoUri("src/widget/templates/images/dropdownButtonsArrow" +
(this.disabled ? "-disabled" : "") + ".gif");
// Attach menu to body so that it appears above other buttons
this.menu.style.position="absolute";
this.menu.style.display="none";
this.menu.style["z-index"] = 99;
document.body.appendChild(this.menu);
},
postCreate: function() {
if ( dojo.render.html.ie ) {
// Compensate for IE's weird padding of button content, which seems to be relative
// to the length of the content
var contentWidth = dojo.style.getOuterWidth(this.table);
this.labelCell.style["left"] = "-" + (contentWidth / 10) + "px";
this.arrowCell.style["left"] = (contentWidth / 10) + "px";
}
// Make menu at least as wide as the button
var buttonWidth = dojo.style.getOuterWidth(this.button);
var menuWidth = dojo.style.getOuterWidth(this.menu);
if ( buttonWidth > menuWidth ) {
dojo.style.setOuterWidth(this.menu, buttonWidth);
}
},
// If someone clicks anywhere else on the screen (including another menu),
// then close this menu.
onCanvasMouseDown: function(e) {
if( !dojo.dom.isDescendantOf(e.target, this.button) &&
!dojo.dom.isDescendantOf(e.target, this.menu) ) {
this.hideMenu();
}
},
eventWasOverArrow: function(e) {
// want to use dojo.html.overElement() but also need to detect clicks
// on the area between the arrow and the edge of the button
var eventX = e.clientX;
var borderX = dojo.style.totalOffsetLeft(this.borderCell);
return (eventX > borderX );
},
onMouseOver: function(e) {
dojo.html.addClass(this.button, "dojoButtonHover");
dojo.html.removeClass(this.button, "dojoButtonNoHover");
},
onMouseOut: function(e) {
dojo.html.removeClass(this.button, "dojoButtonHover");
dojo.html.addClass(this.button, "dojoButtonNoHover");
},
onClick: function(e) {
if ( this.eventWasOverArrow(e) ) {
this._onClickArrow();
} else {
this._onClickButton();
}
},
// Action when the user presses the button
_onClickButton: function(e) {
if ( this.a ) {
if ( this.a.click ) {
this.a.click();
} else if ( this.a.href ) {
location.href = this.a.href;
}
}
},
// Action when user presses the arrow
_onClickArrow: function() {
if ( this.menu.style.display == "none" ) {
this.showMenu();
} else {
this.hideMenu();
}
},
showMenu: function() {
if ( this.disabled )
return;
// Position it accordingly, relative to screen root (since
// it's attached to document.body)
this.menu.style.left = dojo.style.totalOffsetLeft(this.button) + "px";
this.menu.style.top = dojo.style.totalOffsetTop(this.button) + dojo.style.getOuterHeight(this.button) + "px";
// Display the menu; do this funky code below to stop the menu from extending
// all the way to the right edge of the screen.
// TODO: retest simple display="" to confirm that it doesn't work.
try {
this.menu.style.display="table"; // mozilla
} catch(e) {
this.menu.style.display="block"; // IE
}
// If someone clicks somewhere else on the screen then close the menu
dojo.event.connect(document.documentElement, "onmousedown", this, "onCanvasMouseDown");
// When someone clicks the menu, after the menu handles the event,
// close the menu (be careful not to close the menu too early or else
// the menu will never receive the event.)
dojo.event.connect(this.menu, "onclick", this, "hideMenu");
},
hideMenu: function() {
this.menu.style.display = "none";
dojo.event.disconnect(document.documentElement, "onmousedown", this, "onCanvasMouseDown");
dojo.event.disconnect(this.menu, "onclick", this, "hideMenu");
}
});

View file

@ -8,191 +8,191 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.html.GoogleMap");
dojo.require("dojo.event.*");
dojo.require("dojo.html");
dojo.require("dojo.math");
dojo.require("dojo.uri.Uri");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.widget.GoogleMap");
(function(){
var gkey = djConfig["gMapKey"]||djConfig["googleMapKey"];
// the Google API key mechanism sucks. We're hardcoding here for love and affection but I don't like it.
var uri=new dojo.uri.Uri(window.location.href);
if(uri.host=="www.dojotoolkit.org"){
gkey="ABQIAAAACUNdgv_7FGOmUslbm9l6_hRqjp7ri2mNiOEYqetD3xnFHpt5rBSjszDd1sdufPyQKUTyCf_YxoIxvw";
}
else if(uri.host=="blog.dojotoolkit.org"){
gkey="ABQIAAAACUNdgv_7FGOmUslbm9l6_hSkep6Av1xaMhVn3yCLkorJeXeLARQ6fammI_P3qSGleTJhoI5_1JmP_Q";
}
else if(uri.host=="archive.dojotoolkit.org"){
gkey="ABQIAAAACUNdgv_7FGOmUslbm9l6_hTaQpDt0dyGLIHbXMPTzg1kWeAfwRTwZNyrUfbfxYE9yIvRivEjcXoDTg";
}
else if(uri.host=="dojotoolkit.org"){
gkey="ABQIAAAACUNdgv_7FGOmUslbm9l6_hSaOaO_TgJ5c3mtQFnk5JO2zD5dZBRZk-ieqVs7BORREYNzAERmcJoEjQ";
}
if(!dojo.hostenv.post_load_){
var tag = "<scr"+"ipt src='http://maps.google.com/maps?file=api&amp;v=2&amp;key="+gkey+"'></scri"+"pt>";
if(!dj_global["GMap2"]){ // prevent multi-inclusion
document.write(tag);
}
}else{
dojo.debug("cannot initialize map system after the page has been loaded! Please either manually include the script block provided by Google in your page or require() the GoogleMap widget before onload has fired");
}
})();
dojo.widget.html.GoogleMap=function(){
dojo.widget.HtmlWidget.call(this);
dojo.widget.GoogleMap.call(this);
var gm=dojo.widget.GoogleMap;
this.map=null;
this.data=[];
this.datasrc="";
// FIXME: this is pehraps the stupidest way to specify this enum I can think of
this.controls=[gm.Controls.LargeMap,gm.Controls.Scale,gm.Controls.MapType];
};
dojo.inherits(dojo.widget.html.GoogleMap, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.GoogleMap, {
templatePath:null,
templateCssPath:null,
setControls:function(){
var c=dojo.widget.GoogleMap.Controls;
for(var i=0; i<this.controls.length; i++){
var type=this.controls[i];
switch(type){
case c.LargeMap:{
this.map.addControl(new GLargeMapControl());
break;
}
case c.SmallMap:{
this.map.addControl(new GSmallMapControl());
break;
}
case c.SmallZoom:{
this.map.addControl(new GSmallZoomControl());
break;
}
case c.Scale:{
this.map.addControl(new GScaleControl());
break;
}
case c.MapType:{
this.map.addControl(new GMapTypeControl());
break;
}
case c.Overview:{
this.map.addControl(new GOverviewMapControl());
break;
}
default:{
break;
}
}
}
},
findCenter:function(bounds){
var clat=(bounds.getNorthEast().lat()+bounds.getSouthWest().lat())/2;
var clng=(bounds.getNorthEast().lng()+bounds.getSouthWest().lng())/2;
return (new GLatLng(clat,clng));
},
createPinpoint:function(pt,overlay){
var m=new GMarker(pt);
if(overlay){
GEvent.addListener(m,"click",function(){
m.openInfoWindowHtml("<div>"+overlay+"</div>");
});
}
return m;
},
parse:function(table){
this.data=[];
// get the column indices
var h=table.getElementsByTagName("thead")[0];
if(!h){
return;
}
var a=[];
var cols=h.getElementsByTagName("td");
if(cols.length==0){
cols=h.getElementsByTagName("th");
}
for(var i=0; i<cols.length; i++){
var c=cols[i].innerHTML.toLowerCase();
if(c=="long") c="lng";
a.push(c);
}
// parse the data
var b=table.getElementsByTagName("tbody")[0];
if(!b){
return;
}
for(var i=0; i<b.childNodes.length; i++){
if(!(b.childNodes[i].nodeName&&b.childNodes[i].nodeName.toLowerCase()=="tr")){
continue;
}
var cells=b.childNodes[i].getElementsByTagName("td");
var o={};
for(var j=0; j<a.length; j++){
var col=a[j];
if(col=="lat"||col=="lng"){
o[col]=parseFloat(cells[j].innerHTML);
}else{
o[col]=cells[j].innerHTML;
}
}
this.data.push(o);
}
},
render:function(){
var bounds=new GLatLngBounds();
var d=this.data;
var pts=[];
for(var i=0; i<d.length; i++){
bounds.extend(new GLatLng(d[i].lat,d[i].lng));
}
this.map.setCenter(this.findCenter(bounds), this.map.getBoundsZoomLevel(bounds));
for(var i=0; i<this.data.length; i++){
var p=new GLatLng(this.data[i].lat,this.data[i].lng);
var d=this.data[i].description||null;
var m=this.createPinpoint(p,d);
this.map.addOverlay(m);
}
},
initialize:function(args, frag){
if(!GMap2){
dojo.raise("dojo.widget.GoogleMap: The Google Map script must be included (with a proper API key) in order to use this widget.");
}
if(this.datasrc){
this.parse(dojo.byId(this.datasrc));
}
else if(this.domNode.getElementsByTagName("table")[0]){
this.parse(this.domNode.getElementsByTagName("table")[0]);
}
},
postCreate:function(){
// clean the domNode before creating the map.
while(this.domNode.childNodes.length>0){
this.domNode.removeChild(this.domNode.childNodes[0]);
}
this.map=new GMap2(this.domNode);
this.render();
this.setControls();
}
});
dojo.provide("dojo.widget.html.GoogleMap");
dojo.require("dojo.event.*");
dojo.require("dojo.html");
dojo.require("dojo.math");
dojo.require("dojo.uri.Uri");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.widget.GoogleMap");
(function(){
var gkey = djConfig["gMapKey"]||djConfig["googleMapKey"];
// the Google API key mechanism sucks. We're hardcoding here for love and affection but I don't like it.
var uri=new dojo.uri.Uri(window.location.href);
if(uri.host=="www.dojotoolkit.org"){
gkey="ABQIAAAACUNdgv_7FGOmUslbm9l6_hRqjp7ri2mNiOEYqetD3xnFHpt5rBSjszDd1sdufPyQKUTyCf_YxoIxvw";
}
else if(uri.host=="blog.dojotoolkit.org"){
gkey="ABQIAAAACUNdgv_7FGOmUslbm9l6_hSkep6Av1xaMhVn3yCLkorJeXeLARQ6fammI_P3qSGleTJhoI5_1JmP_Q";
}
else if(uri.host=="archive.dojotoolkit.org"){
gkey="ABQIAAAACUNdgv_7FGOmUslbm9l6_hTaQpDt0dyGLIHbXMPTzg1kWeAfwRTwZNyrUfbfxYE9yIvRivEjcXoDTg";
}
else if(uri.host=="dojotoolkit.org"){
gkey="ABQIAAAACUNdgv_7FGOmUslbm9l6_hSaOaO_TgJ5c3mtQFnk5JO2zD5dZBRZk-ieqVs7BORREYNzAERmcJoEjQ";
}
if(!dojo.hostenv.post_load_){
var tag = "<scr"+"ipt src='http://maps.google.com/maps?file=api&amp;v=2&amp;key="+gkey+"'></scri"+"pt>";
if(!dj_global["GMap2"]){ // prevent multi-inclusion
document.write(tag);
}
}else{
dojo.debug("cannot initialize map system after the page has been loaded! Please either manually include the script block provided by Google in your page or require() the GoogleMap widget before onload has fired");
}
})();
dojo.widget.html.GoogleMap=function(){
dojo.widget.HtmlWidget.call(this);
dojo.widget.GoogleMap.call(this);
var gm=dojo.widget.GoogleMap;
this.map=null;
this.data=[];
this.datasrc="";
// FIXME: this is pehraps the stupidest way to specify this enum I can think of
this.controls=[gm.Controls.LargeMap,gm.Controls.Scale,gm.Controls.MapType];
};
dojo.inherits(dojo.widget.html.GoogleMap, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.GoogleMap, {
templatePath:null,
templateCssPath:null,
setControls:function(){
var c=dojo.widget.GoogleMap.Controls;
for(var i=0; i<this.controls.length; i++){
var type=this.controls[i];
switch(type){
case c.LargeMap:{
this.map.addControl(new GLargeMapControl());
break;
}
case c.SmallMap:{
this.map.addControl(new GSmallMapControl());
break;
}
case c.SmallZoom:{
this.map.addControl(new GSmallZoomControl());
break;
}
case c.Scale:{
this.map.addControl(new GScaleControl());
break;
}
case c.MapType:{
this.map.addControl(new GMapTypeControl());
break;
}
case c.Overview:{
this.map.addControl(new GOverviewMapControl());
break;
}
default:{
break;
}
}
}
},
findCenter:function(bounds){
var clat=(bounds.getNorthEast().lat()+bounds.getSouthWest().lat())/2;
var clng=(bounds.getNorthEast().lng()+bounds.getSouthWest().lng())/2;
return (new GLatLng(clat,clng));
},
createPinpoint:function(pt,overlay){
var m=new GMarker(pt);
if(overlay){
GEvent.addListener(m,"click",function(){
m.openInfoWindowHtml("<div>"+overlay+"</div>");
});
}
return m;
},
parse:function(table){
this.data=[];
// get the column indices
var h=table.getElementsByTagName("thead")[0];
if(!h){
return;
}
var a=[];
var cols=h.getElementsByTagName("td");
if(cols.length==0){
cols=h.getElementsByTagName("th");
}
for(var i=0; i<cols.length; i++){
var c=cols[i].innerHTML.toLowerCase();
if(c=="long") c="lng";
a.push(c);
}
// parse the data
var b=table.getElementsByTagName("tbody")[0];
if(!b){
return;
}
for(var i=0; i<b.childNodes.length; i++){
if(!(b.childNodes[i].nodeName&&b.childNodes[i].nodeName.toLowerCase()=="tr")){
continue;
}
var cells=b.childNodes[i].getElementsByTagName("td");
var o={};
for(var j=0; j<a.length; j++){
var col=a[j];
if(col=="lat"||col=="lng"){
o[col]=parseFloat(cells[j].innerHTML);
}else{
o[col]=cells[j].innerHTML;
}
}
this.data.push(o);
}
},
render:function(){
var bounds=new GLatLngBounds();
var d=this.data;
var pts=[];
for(var i=0; i<d.length; i++){
bounds.extend(new GLatLng(d[i].lat,d[i].lng));
}
this.map.setCenter(this.findCenter(bounds), this.map.getBoundsZoomLevel(bounds));
for(var i=0; i<this.data.length; i++){
var p=new GLatLng(this.data[i].lat,this.data[i].lng);
var d=this.data[i].description||null;
var m=this.createPinpoint(p,d);
this.map.addOverlay(m);
}
},
initialize:function(args, frag){
if(!GMap2){
dojo.raise("dojo.widget.GoogleMap: The Google Map script must be included (with a proper API key) in order to use this widget.");
}
if(this.datasrc){
this.parse(dojo.byId(this.datasrc));
}
else if(this.domNode.getElementsByTagName("table")[0]){
this.parse(this.domNode.getElementsByTagName("table")[0]);
}
},
postCreate:function(){
// clean the domNode before creating the map.
while(this.domNode.childNodes.length>0){
this.domNode.removeChild(this.domNode.childNodes[0]);
}
this.map=new GMap2(this.domNode);
this.render();
this.setControls();
}
});

View file

@ -8,47 +8,47 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.LinkPane");
dojo.provide("dojo.widget.html.LinkPane");
//
// a div that loads from a URL. (Similar to an iframe, but
// it's in the same environment as the main window)
//
dojo.require("dojo.widget.LinkPane");
dojo.require("dojo.widget.*");
dojo.require("dojo.event.*");
dojo.require("dojo.io.*");
dojo.require("dojo.widget.ContentPane");
dojo.require("dojo.html");
dojo.require("dojo.style");
dojo.require("dojo.dom");
dojo.require("dojo.string");
dojo.widget.html.LinkPane = function(){
dojo.widget.html.ContentPane.call(this);
}
dojo.inherits(dojo.widget.html.LinkPane, dojo.widget.html.ContentPane);
dojo.lang.extend(dojo.widget.html.LinkPane, {
widgetType: "LinkPane",
// I'm using a template because the user may specify the input as
// <a href="foo.html">label</a>, in which case we need to get rid of the
// <a> because we don't want a link.
templateString: '<div class="dojoLinkPane"></div>',
fillInTemplate: function(args, frag){
var source = this.getFragNodeRef(frag);
// If user has specified node contents, they become the label
// (the link must be plain text)
this.label += source.innerHTML;
var source = this.getFragNodeRef(frag);
dojo.html.copyStyle(this.domNode, source);
}
});
dojo.provide("dojo.widget.LinkPane");
dojo.provide("dojo.widget.html.LinkPane");
//
// a div that loads from a URL. (Similar to an iframe, but
// it's in the same environment as the main window)
//
dojo.require("dojo.widget.LinkPane");
dojo.require("dojo.widget.*");
dojo.require("dojo.event.*");
dojo.require("dojo.io.*");
dojo.require("dojo.widget.ContentPane");
dojo.require("dojo.html");
dojo.require("dojo.style");
dojo.require("dojo.dom");
dojo.require("dojo.string");
dojo.widget.html.LinkPane = function(){
dojo.widget.html.ContentPane.call(this);
}
dojo.inherits(dojo.widget.html.LinkPane, dojo.widget.html.ContentPane);
dojo.lang.extend(dojo.widget.html.LinkPane, {
widgetType: "LinkPane",
// I'm using a template because the user may specify the input as
// <a href="foo.html">label</a>, in which case we need to get rid of the
// <a> because we don't want a link.
templateString: '<div class="dojoLinkPane"></div>',
fillInTemplate: function(args, frag){
var source = this.getFragNodeRef(frag);
// If user has specified node contents, they become the label
// (the link must be plain text)
this.label += source.innerHTML;
var source = this.getFragNodeRef(frag);
dojo.html.copyStyle(this.domNode, source);
}
});

View file

@ -8,78 +8,78 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.html.TaskBar");
dojo.provide("dojo.widget.html.TaskBarItem");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.FloatingPane");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.event");
// Icon associated w/a floating pane
dojo.widget.html.TaskBarItem = function(){
dojo.widget.TaskBarItem.call(this);
dojo.widget.HtmlWidget.call(this);
}
dojo.inherits(dojo.widget.html.TaskBarItem, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.TaskBarItem, {
// constructor arguments
iconSrc: '',
caption: 'Untitled',
window: null,
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlTaskBarItemTemplate.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlTaskBar.css"),
fillInTemplate: function() {
if ( this.iconSrc != '' ) {
var img = document.createElement("img");
img.src = this.iconSrc;
this.domNode.appendChild(img);
}
this.domNode.appendChild(document.createTextNode(this.caption));
dojo.html.disableSelection(this.domNode);
},
postCreate: function() {
this.window=dojo.widget.getWidgetById(this.windowId);
this.window.explodeSrc = this.domNode;
dojo.event.connect(this.window, "destroy", this, "destroy")
},
onClick: function() {
this.window.show();
}
});
// Collection of widgets in a bar, like Windows task bar
dojo.widget.html.TaskBar = function(){
dojo.widget.html.FloatingPane.call(this);
dojo.widget.TaskBar.call(this);
this._addChildStack = [];
}
dojo.inherits(dojo.widget.html.TaskBar, dojo.widget.html.FloatingPane);
dojo.lang.extend(dojo.widget.html.TaskBar, {
resizable: false,
titleBarDisplay: "none",
addChild: function(child) {
if(!this.containerNode){
this._addChildStack.push(child);
}else if(this._addChildStack.length > 0){
var oarr = this._addChildStack;
this._addChildStack = [];
dojo.lang.forEach(oarr, this.addChild, this);
}
var tbi = dojo.widget.createWidget("TaskBarItem",
{ windowId: child.widgetId,
caption: child.title,
iconSrc: child.iconSrc
});
dojo.widget.html.TaskBar.superclass.addChild.call(this,tbi);
}
});
dojo.provide("dojo.widget.html.TaskBar");
dojo.provide("dojo.widget.html.TaskBarItem");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.FloatingPane");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.event");
// Icon associated w/a floating pane
dojo.widget.html.TaskBarItem = function(){
dojo.widget.TaskBarItem.call(this);
dojo.widget.HtmlWidget.call(this);
}
dojo.inherits(dojo.widget.html.TaskBarItem, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.TaskBarItem, {
// constructor arguments
iconSrc: '',
caption: 'Untitled',
window: null,
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlTaskBarItemTemplate.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlTaskBar.css"),
fillInTemplate: function() {
if ( this.iconSrc != '' ) {
var img = document.createElement("img");
img.src = this.iconSrc;
this.domNode.appendChild(img);
}
this.domNode.appendChild(document.createTextNode(this.caption));
dojo.html.disableSelection(this.domNode);
},
postCreate: function() {
this.window=dojo.widget.getWidgetById(this.windowId);
this.window.explodeSrc = this.domNode;
dojo.event.connect(this.window, "destroy", this, "destroy")
},
onClick: function() {
this.window.show();
}
});
// Collection of widgets in a bar, like Windows task bar
dojo.widget.html.TaskBar = function(){
dojo.widget.html.FloatingPane.call(this);
dojo.widget.TaskBar.call(this);
this._addChildStack = [];
}
dojo.inherits(dojo.widget.html.TaskBar, dojo.widget.html.FloatingPane);
dojo.lang.extend(dojo.widget.html.TaskBar, {
resizable: false,
titleBarDisplay: "none",
addChild: function(child) {
if(!this.containerNode){
this._addChildStack.push(child);
}else if(this._addChildStack.length > 0){
var oarr = this._addChildStack;
this._addChildStack = [];
dojo.lang.forEach(oarr, this.addChild, this);
}
var tbi = dojo.widget.createWidget("TaskBarItem",
{ windowId: child.widgetId,
caption: child.title,
iconSrc: child.iconSrc
});
dojo.widget.html.TaskBar.superclass.addChild.call(this,tbi);
}
});

View file

@ -8,63 +8,63 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.html.TitlePane");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.lfx.*");
dojo.widget.html.TitlePane = function(){
dojo.widget.HtmlWidget.call(this);
this.widgetType = "TitlePane";
this.labelNode="";
this.labelNodeClass="";
this.containerNodeClass="";
this.label="";
this.open=true;
this.templatePath = dojo.uri.dojoUri("src/widget/templates/TitlePane.html");
}
dojo.inherits(dojo.widget.html.TitlePane, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.TitlePane, {
isContainer: true,
postCreate: function() {
if (this.label) {
this.labelNode.appendChild(document.createTextNode(this.label));
}
if (this.labelNodeClass) {
dojo.html.addClass(this.labelNode, this.labelNodeClass);
}
if (this.containerNodeClass) {
dojo.html.addClass(this.containerNode, this.containerNodeClass);
}
if (!this.open) {
dojo.lfx.wipeOut(this.containerNode,0).play();
}
},
onLabelClick: function() {
if (this.open) {
dojo.lfx.wipeOut(this.containerNode,250).play();
this.open=false;
}else {
dojo.lfx.wipeIn(this.containerNode,250).play();
this.open=true;
}
},
setContent: function(content) {
this.containerNode.innerHTML=content;
},
setLabel: function(label) {
this.labelNode.innerHTML=label;
}
});
dojo.widget.tags.addParseTreeHandler("dojo:TitlePane");
dojo.provide("dojo.widget.html.TitlePane");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.lfx.*");
dojo.widget.html.TitlePane = function(){
dojo.widget.HtmlWidget.call(this);
this.widgetType = "TitlePane";
this.labelNode="";
this.labelNodeClass="";
this.containerNodeClass="";
this.label="";
this.open=true;
this.templatePath = dojo.uri.dojoUri("src/widget/templates/TitlePane.html");
}
dojo.inherits(dojo.widget.html.TitlePane, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.TitlePane, {
isContainer: true,
postCreate: function() {
if (this.label) {
this.labelNode.appendChild(document.createTextNode(this.label));
}
if (this.labelNodeClass) {
dojo.html.addClass(this.labelNode, this.labelNodeClass);
}
if (this.containerNodeClass) {
dojo.html.addClass(this.containerNode, this.containerNodeClass);
}
if (!this.open) {
dojo.lfx.wipeOut(this.containerNode,0).play();
}
},
onLabelClick: function() {
if (this.open) {
dojo.lfx.wipeOut(this.containerNode,250).play();
this.open=false;
}else {
dojo.lfx.wipeIn(this.containerNode,250).play();
this.open=true;
}
},
setContent: function(content) {
this.containerNode.innerHTML=content;
},
setLabel: function(label) {
this.labelNode.innerHTML=label;
}
});
dojo.widget.tags.addParseTreeHandler("dojo:TitlePane");

View file

@ -8,176 +8,176 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.html.Tooltip");
dojo.require("dojo.widget.html.ContentPane");
dojo.require("dojo.widget.Tooltip");
dojo.require("dojo.uri");
dojo.require("dojo.widget.*");
dojo.require("dojo.event");
dojo.require("dojo.style");
dojo.require("dojo.html");
dojo.widget.defineWidget(
"dojo.widget.html.Tooltip",
dojo.widget.html.ContentPane,
{
widgetType: "Tooltip",
isContainer: true,
// Constructor arguments
caption: "",
showDelay: 500,
hideDelay: 100,
connectId: "",
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlTooltipTemplate.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlTooltipTemplate.css"),
connectNode: null,
// Tooltip has the following possible states:
// erased - nothing on screen
// displaying - currently being faded in (partially displayed)
// displayed - fully displayed
// erasing - currently being faded out (partially erased)
state: "erased",
fillInTemplate: function(args, frag){
if(this.caption != ""){
this.domNode.appendChild(document.createTextNode(this.caption));
}
this.connectNode = dojo.byId(this.connectId);
dojo.widget.html.Tooltip.superclass.fillInTemplate.call(this, args, frag);
},
postCreate: function(args, frag){
// The domnode was appended to my parent widget's domnode, but the positioning
// only works if the domnode is a child of document.body
document.body.appendChild(this.domNode);
dojo.event.connect(this.connectNode, "onmouseover", this, "onMouseOver");
dojo.widget.html.Tooltip.superclass.postCreate.call(this, args, frag);
},
onMouseOver: function(e) {
this.mouse = {x: e.pageX, y: e.pageY};
if(!this.showTimer){
this.showTimer = setTimeout(dojo.lang.hitch(this, "show"), this.showDelay);
dojo.event.connect(document.documentElement, "onmousemove", this, "onMouseMove");
}
},
onMouseMove: function(e) {
this.mouse = {x: e.pageX, y: e.pageY};
if(dojo.html.overElement(this.connectNode, e) || dojo.html.overElement(this.domNode, e)) {
// If the tooltip has been scheduled to be erased, cancel that timer
// since we are hovering over element/tooltip again
if(this.hideTimer) {
clearTimeout(this.hideTimer);
delete this.hideTimer;
}
} else {
// mouse has been moved off the element/tooltip
// note: can't use onMouseOut to detect this because the "explode" effect causes
// spurious onMouseOut/onMouseOver events (due to interference from outline)
if(this.showTimer){
clearTimeout(this.showTimer);
delete this.showTimer;
}
if((this.state=="displaying"||this.state=="displayed") && !this.hideTimer){
this.hideTimer = setTimeout(dojo.lang.hitch(this, "hide"), this.hideDelay);
}
}
},
show: function() {
if(this.state=="erasing"){
// we are in the process of erasing; when that is finished, display it.
this.displayScheduled=true;
return;
}
if ( this.state=="displaying" || this.state=="displayed" ) { return; }
// prevent IE bleed through (iframe creation is deferred until first show()
// call because apparently it takes a long time)
if(!this.bgIframe){
this.bgIframe = new dojo.html.BackgroundIframe(this.domNode);
}
this.position();
// if rendering using explosion effect, need to set explosion source
this.explodeSrc = [this.mouse.x, this.mouse.y];
this.state="displaying";
dojo.widget.html.Tooltip.superclass.show.call(this);
},
onShow: function() {
dojo.widget.html.Tooltip.superclass.onShow.call(this);
this.state="displayed";
// in the corner case where the user has moved his mouse away
// while the tip was fading in
if(this.eraseScheduled){
this.hide();
this.eraseScheduled=false;
}
},
hide: function() {
if(this.state=="displaying"){
// in the process of fading in. wait until that is finished and then fade out
this.eraseScheduled=true;
return;
}
if ( this.state=="displayed" ) {
this.state="erasing";
if ( this.showTimer ) {
clearTimeout(this.showTimer);
delete this.showTimer;
}
if ( this.hideTimer ) {
clearTimeout(this.hideTimer);
delete this.hideTimer;
}
dojo.event.disconnect(document.documentElement, "onmousemove", this, "onMouseMove");
dojo.widget.html.Tooltip.superclass.hide.call(this);
}
},
onHide: function(){
this.state="erased";
// in the corner case where the user has moved his mouse back
// while the tip was fading out
if(this.displayScheduled){
this.display();
this.displayScheduled=false;
}
},
position: function(){
dojo.html.placeOnScreenPoint(this.domNode, this.mouse.x, this.mouse.y, [10,15], true);
this.bgIframe.onResized();
},
onLoad: function(){
if(this.isShowing()){
// the tooltip has changed size due to downloaded contents, so reposition it
dojo.lang.setTimeout(this, this.position, 50);
dojo.widget.html.Tooltip.superclass.onLoad.apply(this, arguments);
}
},
checkSize: function() {
// checkSize() is called when the user has resized the browser window,
// but that doesn't affect this widget (or this widget's children)
// so it can be safely ignored
}
}
);
dojo.provide("dojo.widget.html.Tooltip");
dojo.require("dojo.widget.html.ContentPane");
dojo.require("dojo.widget.Tooltip");
dojo.require("dojo.uri");
dojo.require("dojo.widget.*");
dojo.require("dojo.event");
dojo.require("dojo.style");
dojo.require("dojo.html");
dojo.widget.defineWidget(
"dojo.widget.html.Tooltip",
dojo.widget.html.ContentPane,
{
widgetType: "Tooltip",
isContainer: true,
// Constructor arguments
caption: "",
showDelay: 500,
hideDelay: 100,
connectId: "",
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlTooltipTemplate.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlTooltipTemplate.css"),
connectNode: null,
// Tooltip has the following possible states:
// erased - nothing on screen
// displaying - currently being faded in (partially displayed)
// displayed - fully displayed
// erasing - currently being faded out (partially erased)
state: "erased",
fillInTemplate: function(args, frag){
if(this.caption != ""){
this.domNode.appendChild(document.createTextNode(this.caption));
}
this.connectNode = dojo.byId(this.connectId);
dojo.widget.html.Tooltip.superclass.fillInTemplate.call(this, args, frag);
},
postCreate: function(args, frag){
// The domnode was appended to my parent widget's domnode, but the positioning
// only works if the domnode is a child of document.body
document.body.appendChild(this.domNode);
dojo.event.connect(this.connectNode, "onmouseover", this, "onMouseOver");
dojo.widget.html.Tooltip.superclass.postCreate.call(this, args, frag);
},
onMouseOver: function(e) {
this.mouse = {x: e.pageX, y: e.pageY};
if(!this.showTimer){
this.showTimer = setTimeout(dojo.lang.hitch(this, "show"), this.showDelay);
dojo.event.connect(document.documentElement, "onmousemove", this, "onMouseMove");
}
},
onMouseMove: function(e) {
this.mouse = {x: e.pageX, y: e.pageY};
if(dojo.html.overElement(this.connectNode, e) || dojo.html.overElement(this.domNode, e)) {
// If the tooltip has been scheduled to be erased, cancel that timer
// since we are hovering over element/tooltip again
if(this.hideTimer) {
clearTimeout(this.hideTimer);
delete this.hideTimer;
}
} else {
// mouse has been moved off the element/tooltip
// note: can't use onMouseOut to detect this because the "explode" effect causes
// spurious onMouseOut/onMouseOver events (due to interference from outline)
if(this.showTimer){
clearTimeout(this.showTimer);
delete this.showTimer;
}
if((this.state=="displaying"||this.state=="displayed") && !this.hideTimer){
this.hideTimer = setTimeout(dojo.lang.hitch(this, "hide"), this.hideDelay);
}
}
},
show: function() {
if(this.state=="erasing"){
// we are in the process of erasing; when that is finished, display it.
this.displayScheduled=true;
return;
}
if ( this.state=="displaying" || this.state=="displayed" ) { return; }
// prevent IE bleed through (iframe creation is deferred until first show()
// call because apparently it takes a long time)
if(!this.bgIframe){
this.bgIframe = new dojo.html.BackgroundIframe(this.domNode);
}
this.position();
// if rendering using explosion effect, need to set explosion source
this.explodeSrc = [this.mouse.x, this.mouse.y];
this.state="displaying";
dojo.widget.html.Tooltip.superclass.show.call(this);
},
onShow: function() {
dojo.widget.html.Tooltip.superclass.onShow.call(this);
this.state="displayed";
// in the corner case where the user has moved his mouse away
// while the tip was fading in
if(this.eraseScheduled){
this.hide();
this.eraseScheduled=false;
}
},
hide: function() {
if(this.state=="displaying"){
// in the process of fading in. wait until that is finished and then fade out
this.eraseScheduled=true;
return;
}
if ( this.state=="displayed" ) {
this.state="erasing";
if ( this.showTimer ) {
clearTimeout(this.showTimer);
delete this.showTimer;
}
if ( this.hideTimer ) {
clearTimeout(this.hideTimer);
delete this.hideTimer;
}
dojo.event.disconnect(document.documentElement, "onmousemove", this, "onMouseMove");
dojo.widget.html.Tooltip.superclass.hide.call(this);
}
},
onHide: function(){
this.state="erased";
// in the corner case where the user has moved his mouse back
// while the tip was fading out
if(this.displayScheduled){
this.display();
this.displayScheduled=false;
}
},
position: function(){
dojo.html.placeOnScreenPoint(this.domNode, this.mouse.x, this.mouse.y, [10,15], true);
this.bgIframe.onResized();
},
onLoad: function(){
if(this.isShowing()){
// the tooltip has changed size due to downloaded contents, so reposition it
dojo.lang.setTimeout(this, this.position, 50);
dojo.widget.html.Tooltip.superclass.onLoad.apply(this, arguments);
}
},
checkSize: function() {
// checkSize() is called when the user has resized the browser window,
// but that doesn't affect this widget (or this widget's children)
// so it can be safely ignored
}
}
);

View file

@ -8,173 +8,173 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.html.YahooMap");
dojo.require("dojo.event.*");
dojo.require("dojo.html");
dojo.require("dojo.math");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.widget.YahooMap");
(function(){
var yappid = djConfig["yAppId"]||djConfig["yahooAppId"]||"dojotoolkit";
if(!dojo.hostenv.post_load_){
if(yappid == "dojotoolkit"){
dojo.debug("please provide a unique Yahoo App ID in djConfig.yahooAppId when using the map widget");
}
var tag = "<scr"+"ipt src='http://api.maps.yahoo.com/ajaxymap?v=3.0&appid="+yappid+"'></scri"+"pt>";
if(!dj_global["YMap"]){
document.write(tag);
}
}else{
dojo.debug("cannot initialize map system after the page has been loaded! Please either manually include the script block provided by Yahoo in your page or require() the YahooMap widget before onload has fired");
}
})();
dojo.widget.html.YahooMap=function(){
dojo.widget.HtmlWidget.call(this);
dojo.widget.YahooMap.call(this);
this.map=null;
this.datasrc="";
this.data=[];
this.width=0;
this.height=0;
this.controls=["zoomlong","maptype","pan"];
};
dojo.inherits(dojo.widget.html.YahooMap, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.YahooMap, {
widgetType: "YahooMap",
templatePath:null,
templateCssPath:null,
findCenter:function(aPts){
var start=new YGeoPoint(37,-90);
if(aPts.length==0) return start;
var minLat,maxLat, minLon, maxLon, cLat, cLon;
minLat=maxLat=aPts[0].Lat;
minLon=maxLon=aPts[0].Lon;
for(var i=0; i<aPts.length; i++){
minLat=Math.min(minLat,aPts[i].Lat);
maxLat=Math.max(maxLat,aPts[i].Lat);
minLon=Math.min(minLon,aPts[i].Lon);
maxLon=Math.max(maxLon,aPts[i].Lon);
}
cLat=dojo.math.round((minLat+maxLat)/2,6);
cLon=dojo.math.round((minLon+maxLon)/2,6);
return new YGeoPoint(cLat,cLon);
},
setControls:function(){
var c=this.controls;
var t=dojo.widget.YahooMap.Controls;
for(var i=0; i<c.length; i++){
switch(c[i]){
case t.MapType:{
this.map.addTypeControl();
break;
}
case t.Pan:{
this.map.addPanControl();
break;
}
case t.ZoomLong:{
this.map.addZoomLong();
break;
}
case t.ZoomShort:{
this.map.addZoomShort();
break;
}
}
}
},
parse:function(table){
this.data=[];
// get the column indices
var h=table.getElementsByTagName("thead")[0];
if(!h){
return;
}
var a=[];
var cols=h.getElementsByTagName("td");
if(cols.length==0){
cols=h.getElementsByTagName("th");
}
for(var i=0; i<cols.length; i++){
var c=cols[i].innerHTML.toLowerCase();
if(c=="long") c="lng";
a.push(c);
}
// parse the data
var b=table.getElementsByTagName("tbody")[0];
if(!b){
return;
}
for(var i=0; i<b.childNodes.length; i++){
if(!(b.childNodes[i].nodeName&&b.childNodes[i].nodeName.toLowerCase()=="tr")){
continue;
}
var cells=b.childNodes[i].getElementsByTagName("td");
var o={};
for(var j=0; j<a.length; j++){
var col=a[j];
if(col=="lat"||col=="lng"){
o[col]=parseFloat(cells[j].innerHTML);
}else{
o[col]=cells[j].innerHTML;
}
}
this.data.push(o);
}
},
render:function(){
var pts=[];
var d=this.data;
for(var i=0; i<d.length; i++){
var pt=new YGeoPoint(d[i].lat, d[i].lng);
pts.push(pt);
var icon=d[i].icon||null;
if(icon){
icon=new YImage(icon);
}
var m=new YMarker(pt,icon);
if(d[i].description){
m.addAutoExpand("<div>"+d[i].description+"</div>");
}
this.map.addOverlay(m);
}
var c=this.findCenter(pts);
var z=this.map.getZoomLevel(pts);
this.map.drawZoomAndCenter(c,z);
},
initialize:function(args, frag){
if(!YMap || !YGeoPoint){
dojo.raise("dojo.widget.YahooMap: The Yahoo Map script must be included in order to use this widget.");
}
if(this.datasrc){
this.parse(dojo.byId(this.datasrc));
}
else if(this.domNode.getElementsByTagName("table")[0]){
this.parse(this.domNode.getElementsByTagName("table")[0]);
}
},
postCreate:function(){
// clean the domNode before creating the map.
while(this.domNode.childNodes.length>0){
this.domNode.removeChild(this.domNode.childNodes[0]);
}
if(this.width>0&&this.height>0){
this.map=new YMap(this.domNode, YAHOO_MAP_REG, new YSize(this.width, this.height));
}else{
this.map=new YMap(this.domNode);
}
this.setControls();
this.render();
}
});
dojo.provide("dojo.widget.html.YahooMap");
dojo.require("dojo.event.*");
dojo.require("dojo.html");
dojo.require("dojo.math");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.widget.YahooMap");
(function(){
var yappid = djConfig["yAppId"]||djConfig["yahooAppId"]||"dojotoolkit";
if(!dojo.hostenv.post_load_){
if(yappid == "dojotoolkit"){
dojo.debug("please provide a unique Yahoo App ID in djConfig.yahooAppId when using the map widget");
}
var tag = "<scr"+"ipt src='http://api.maps.yahoo.com/ajaxymap?v=3.0&appid="+yappid+"'></scri"+"pt>";
if(!dj_global["YMap"]){
document.write(tag);
}
}else{
dojo.debug("cannot initialize map system after the page has been loaded! Please either manually include the script block provided by Yahoo in your page or require() the YahooMap widget before onload has fired");
}
})();
dojo.widget.html.YahooMap=function(){
dojo.widget.HtmlWidget.call(this);
dojo.widget.YahooMap.call(this);
this.map=null;
this.datasrc="";
this.data=[];
this.width=0;
this.height=0;
this.controls=["zoomlong","maptype","pan"];
};
dojo.inherits(dojo.widget.html.YahooMap, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.html.YahooMap, {
widgetType: "YahooMap",
templatePath:null,
templateCssPath:null,
findCenter:function(aPts){
var start=new YGeoPoint(37,-90);
if(aPts.length==0) return start;
var minLat,maxLat, minLon, maxLon, cLat, cLon;
minLat=maxLat=aPts[0].Lat;
minLon=maxLon=aPts[0].Lon;
for(var i=0; i<aPts.length; i++){
minLat=Math.min(minLat,aPts[i].Lat);
maxLat=Math.max(maxLat,aPts[i].Lat);
minLon=Math.min(minLon,aPts[i].Lon);
maxLon=Math.max(maxLon,aPts[i].Lon);
}
cLat=dojo.math.round((minLat+maxLat)/2,6);
cLon=dojo.math.round((minLon+maxLon)/2,6);
return new YGeoPoint(cLat,cLon);
},
setControls:function(){
var c=this.controls;
var t=dojo.widget.YahooMap.Controls;
for(var i=0; i<c.length; i++){
switch(c[i]){
case t.MapType:{
this.map.addTypeControl();
break;
}
case t.Pan:{
this.map.addPanControl();
break;
}
case t.ZoomLong:{
this.map.addZoomLong();
break;
}
case t.ZoomShort:{
this.map.addZoomShort();
break;
}
}
}
},
parse:function(table){
this.data=[];
// get the column indices
var h=table.getElementsByTagName("thead")[0];
if(!h){
return;
}
var a=[];
var cols=h.getElementsByTagName("td");
if(cols.length==0){
cols=h.getElementsByTagName("th");
}
for(var i=0; i<cols.length; i++){
var c=cols[i].innerHTML.toLowerCase();
if(c=="long") c="lng";
a.push(c);
}
// parse the data
var b=table.getElementsByTagName("tbody")[0];
if(!b){
return;
}
for(var i=0; i<b.childNodes.length; i++){
if(!(b.childNodes[i].nodeName&&b.childNodes[i].nodeName.toLowerCase()=="tr")){
continue;
}
var cells=b.childNodes[i].getElementsByTagName("td");
var o={};
for(var j=0; j<a.length; j++){
var col=a[j];
if(col=="lat"||col=="lng"){
o[col]=parseFloat(cells[j].innerHTML);
}else{
o[col]=cells[j].innerHTML;
}
}
this.data.push(o);
}
},
render:function(){
var pts=[];
var d=this.data;
for(var i=0; i<d.length; i++){
var pt=new YGeoPoint(d[i].lat, d[i].lng);
pts.push(pt);
var icon=d[i].icon||null;
if(icon){
icon=new YImage(icon);
}
var m=new YMarker(pt,icon);
if(d[i].description){
m.addAutoExpand("<div>"+d[i].description+"</div>");
}
this.map.addOverlay(m);
}
var c=this.findCenter(pts);
var z=this.map.getZoomLevel(pts);
this.map.drawZoomAndCenter(c,z);
},
initialize:function(args, frag){
if(!YMap || !YGeoPoint){
dojo.raise("dojo.widget.YahooMap: The Yahoo Map script must be included in order to use this widget.");
}
if(this.datasrc){
this.parse(dojo.byId(this.datasrc));
}
else if(this.domNode.getElementsByTagName("table")[0]){
this.parse(this.domNode.getElementsByTagName("table")[0]);
}
},
postCreate:function(){
// clean the domNode before creating the map.
while(this.domNode.childNodes.length>0){
this.domNode.removeChild(this.domNode.childNodes[0]);
}
if(this.width>0&&this.height>0){
this.map=new YMap(this.domNode, YAHOO_MAP_REG, new YSize(this.width, this.height));
}else{
this.map=new YMap(this.domNode);
}
this.setControls();
this.render();
}
});

View file

@ -8,206 +8,206 @@
http://dojotoolkit.org/community/licensing.shtml
*/
// Maintain state of widgets when user hits back/forward button
dojo.provide("dojo.widget.html.stabile");
dojo.widget.html.stabile = {
// Characters to quote in single-quoted regexprs
_sqQuotables: new RegExp("([\\\\'])", "g"),
// Current depth.
_depth: 0,
// Set to true when calling v.toString, to sniff for infinite
// recursion.
_recur: false,
// Levels of nesting of Array and object displays.
// If when >= depth, no display or array or object internals.
depthLimit: 2
};
//// PUBLIC METHODS
// Get the state stored for the widget with the given ID, or undefined
// if none.
//
dojo.widget.html.stabile.getState = function(id){
dojo.widget.html.stabile.setup();
return dojo.widget.html.stabile.widgetState[id];
}
// Set the state stored for the widget with the given ID. If isCommit
// is true, commits all widget state to more stable storage.
//
dojo.widget.html.stabile.setState = function(id, state, isCommit){
dojo.widget.html.stabile.setup();
dojo.widget.html.stabile.widgetState[id] = state;
if(isCommit){
dojo.widget.html.stabile.commit(dojo.widget.html.stabile.widgetState);
}
}
// Sets up widgetState: a hash keyed by widgetId, maps to an object
// or array writable with "describe". If there is data in the widget
// storage area, use it, otherwise initialize an empty object.
//
dojo.widget.html.stabile.setup = function(){
if(!dojo.widget.html.stabile.widgetState){
var text = dojo.widget.html.stabile.getStorage().value;
dojo.widget.html.stabile.widgetState = text ? dj_eval("("+text+")") : {};
}
}
// Commits all widget state to more stable storage, so if the user
// navigates away and returns, it can be restored.
//
dojo.widget.html.stabile.commit = function(state){
dojo.widget.html.stabile.getStorage().value = dojo.widget.html.stabile.description(state);
}
// Return a JSON "description string" for the given value.
// Supports only core JavaScript types with literals, plus Date,
// and cyclic structures are unsupported.
// showAll defaults to false -- if true, this becomes a simple symbolic
// object dumper, but you cannot "eval" the output.
//
dojo.widget.html.stabile.description = function(v, showAll){
// Save and later restore dojo.widget.html.stabile._depth;
var depth = dojo.widget.html.stabile._depth;
var describeThis = function() {
return this.description(this, true);
}
try {
if(v===void(0)){
return "undefined";
}
if(v===null){
return "null";
}
if(typeof(v)=="boolean" || typeof(v)=="number"
|| v instanceof Boolean || v instanceof Number){
return v.toString();
}
if(typeof(v)=="string" || v instanceof String){
// Quote strings and their contents as required.
// Replacing by $& fails in IE 5.0
var v1 = v.replace(dojo.widget.html.stabile._sqQuotables, "\\$1");
v1 = v1.replace(/\n/g, "\\n");
v1 = v1.replace(/\r/g, "\\r");
// Any other important special cases?
return "'"+v1+"'";
}
if(v instanceof Date){
// Create a data constructor.
return "new Date("+d.getFullYear+","+d.getMonth()+","+d.getDate()+")";
}
var d;
if(v instanceof Array || v.push){
// "push" test needed for KHTML/Safari, don't know why -cp
if(depth>=dojo.widget.html.stabile.depthLimit)
return "[ ... ]";
d = "[";
var first = true;
dojo.widget.html.stabile._depth++;
for(var i=0; i<v.length; i++){
// Skip functions and undefined values
// if(v[i]==undef || typeof(v[i])=="function")
// continue;
if(first){
first = false;
}else{
d += ",";
}
d+=arguments.callee(v[i], showAll);
}
return d+"]";
}
if(v.constructor==Object
|| v.toString==describeThis){
if(depth>=dojo.widget.html.stabile.depthLimit)
return "{ ... }";
// Instanceof Hash is good, or if we just use Objects,
// we can say v.constructor==Object.
// IE (5?) lacks hasOwnProperty, but perhaps objects do not always
// have prototypes??
if(typeof(v.hasOwnProperty)!="function" && v.prototype){
throw new Error("description: "+v+" not supported by script engine");
}
var first = true;
d = "{";
dojo.widget.html.stabile._depth++;
for(var key in v){
// Skip values that are functions or undefined.
if(v[key]==void(0) || typeof(v[key])=="function")
continue;
if(first){
first = false;
}else{
d += ", ";
}
var kd = key;
// If the key is not a legal identifier, use its description.
// For strings this will quote the stirng.
if(!kd.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/)){
kd = arguments.callee(key, showAll);
}
d += kd+": "+arguments.callee(v[key], showAll);
}
return d+"}";
}
if(showAll){
if(dojo.widget.html.stabile._recur){
// Save the original definitions of toString;
var objectToString = Object.prototype.toString;
return objectToString.apply(v, []);
}else{
dojo.widget.html.stabile._recur = true;
return v.toString();
}
}else{
// log("Description? "+v.toString()+", "+typeof(v));
throw new Error("Unknown type: "+v);
return "'unknown'";
}
} finally {
// Always restore the global current depth.
dojo.widget.html.stabile._depth = depth;
}
}
//// PRIVATE TO MODULE
// Gets an object (form field) with a read/write "value" property.
//
dojo.widget.html.stabile.getStorage = function(){
if (dojo.widget.html.stabile.dataField) {
return dojo.widget.html.stabile.dataField;
}
var form = document.forms._dojo_form;
return dojo.widget.html.stabile.dataField = form ? form.stabile : {value: ""};
}
// Maintain state of widgets when user hits back/forward button
dojo.provide("dojo.widget.html.stabile");
dojo.widget.html.stabile = {
// Characters to quote in single-quoted regexprs
_sqQuotables: new RegExp("([\\\\'])", "g"),
// Current depth.
_depth: 0,
// Set to true when calling v.toString, to sniff for infinite
// recursion.
_recur: false,
// Levels of nesting of Array and object displays.
// If when >= depth, no display or array or object internals.
depthLimit: 2
};
//// PUBLIC METHODS
// Get the state stored for the widget with the given ID, or undefined
// if none.
//
dojo.widget.html.stabile.getState = function(id){
dojo.widget.html.stabile.setup();
return dojo.widget.html.stabile.widgetState[id];
}
// Set the state stored for the widget with the given ID. If isCommit
// is true, commits all widget state to more stable storage.
//
dojo.widget.html.stabile.setState = function(id, state, isCommit){
dojo.widget.html.stabile.setup();
dojo.widget.html.stabile.widgetState[id] = state;
if(isCommit){
dojo.widget.html.stabile.commit(dojo.widget.html.stabile.widgetState);
}
}
// Sets up widgetState: a hash keyed by widgetId, maps to an object
// or array writable with "describe". If there is data in the widget
// storage area, use it, otherwise initialize an empty object.
//
dojo.widget.html.stabile.setup = function(){
if(!dojo.widget.html.stabile.widgetState){
var text = dojo.widget.html.stabile.getStorage().value;
dojo.widget.html.stabile.widgetState = text ? dj_eval("("+text+")") : {};
}
}
// Commits all widget state to more stable storage, so if the user
// navigates away and returns, it can be restored.
//
dojo.widget.html.stabile.commit = function(state){
dojo.widget.html.stabile.getStorage().value = dojo.widget.html.stabile.description(state);
}
// Return a JSON "description string" for the given value.
// Supports only core JavaScript types with literals, plus Date,
// and cyclic structures are unsupported.
// showAll defaults to false -- if true, this becomes a simple symbolic
// object dumper, but you cannot "eval" the output.
//
dojo.widget.html.stabile.description = function(v, showAll){
// Save and later restore dojo.widget.html.stabile._depth;
var depth = dojo.widget.html.stabile._depth;
var describeThis = function() {
return this.description(this, true);
}
try {
if(v===void(0)){
return "undefined";
}
if(v===null){
return "null";
}
if(typeof(v)=="boolean" || typeof(v)=="number"
|| v instanceof Boolean || v instanceof Number){
return v.toString();
}
if(typeof(v)=="string" || v instanceof String){
// Quote strings and their contents as required.
// Replacing by $& fails in IE 5.0
var v1 = v.replace(dojo.widget.html.stabile._sqQuotables, "\\$1");
v1 = v1.replace(/\n/g, "\\n");
v1 = v1.replace(/\r/g, "\\r");
// Any other important special cases?
return "'"+v1+"'";
}
if(v instanceof Date){
// Create a data constructor.
return "new Date("+d.getFullYear+","+d.getMonth()+","+d.getDate()+")";
}
var d;
if(v instanceof Array || v.push){
// "push" test needed for KHTML/Safari, don't know why -cp
if(depth>=dojo.widget.html.stabile.depthLimit)
return "[ ... ]";
d = "[";
var first = true;
dojo.widget.html.stabile._depth++;
for(var i=0; i<v.length; i++){
// Skip functions and undefined values
// if(v[i]==undef || typeof(v[i])=="function")
// continue;
if(first){
first = false;
}else{
d += ",";
}
d+=arguments.callee(v[i], showAll);
}
return d+"]";
}
if(v.constructor==Object
|| v.toString==describeThis){
if(depth>=dojo.widget.html.stabile.depthLimit)
return "{ ... }";
// Instanceof Hash is good, or if we just use Objects,
// we can say v.constructor==Object.
// IE (5?) lacks hasOwnProperty, but perhaps objects do not always
// have prototypes??
if(typeof(v.hasOwnProperty)!="function" && v.prototype){
throw new Error("description: "+v+" not supported by script engine");
}
var first = true;
d = "{";
dojo.widget.html.stabile._depth++;
for(var key in v){
// Skip values that are functions or undefined.
if(v[key]==void(0) || typeof(v[key])=="function")
continue;
if(first){
first = false;
}else{
d += ", ";
}
var kd = key;
// If the key is not a legal identifier, use its description.
// For strings this will quote the stirng.
if(!kd.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/)){
kd = arguments.callee(key, showAll);
}
d += kd+": "+arguments.callee(v[key], showAll);
}
return d+"}";
}
if(showAll){
if(dojo.widget.html.stabile._recur){
// Save the original definitions of toString;
var objectToString = Object.prototype.toString;
return objectToString.apply(v, []);
}else{
dojo.widget.html.stabile._recur = true;
return v.toString();
}
}else{
// log("Description? "+v.toString()+", "+typeof(v));
throw new Error("Unknown type: "+v);
return "'unknown'";
}
} finally {
// Always restore the global current depth.
dojo.widget.html.stabile._depth = depth;
}
}
//// PRIVATE TO MODULE
// Gets an object (form field) with a read/write "value" property.
//
dojo.widget.html.stabile.getStorage = function(){
if (dojo.widget.html.stabile.dataField) {
return dojo.widget.html.stabile.dataField;
}
var form = document.forms._dojo_form;
return dojo.widget.html.stabile.dataField = form ? form.stabile : {value: ""};
}

View file

@ -1,6 +1,6 @@
<span>
<input type="checkbox" name="${this.name}" checked="${this.checked}" tabIndex="${this.tabIndex}" style="display: none"
dojoAttachPoint="inputNode">
<img src='${this.imgSrc}' class='dojoHtmlCheckbox'
dojoAttachPoint="imgNode" dojoAttachEvent="onMouseUp;onMouseOver;onMouseOut">
<span>
<input type="checkbox" name="${this.name}" checked="${this.checked}" tabIndex="${this.tabIndex}" style="display: none"
dojoAttachPoint="inputNode">
<img src='${this.imgSrc}' class='dojoHtmlCheckbox'
dojoAttachPoint="imgNode" dojoAttachEvent="onMouseUp;onMouseOver;onMouseOut">
</span>

View file

@ -1,18 +1,18 @@
<div class="dojoButton" style="position:relative;top:0px;left:0px; text-align:none;">
<div dojoAttachPoint="leftPart" class="dojoButtonLeftPart" style="position:absolute;left:0px;top:0px;"
dojoAttachEvent="onMouseOver:leftOver; onMouseOut:leftOut; onMouseUp:leftUp; onClick:leftClick;">
<div class="dojoButtonContents" dojoAttachPoint="containerNode" style="position:absolute;top:0px;right:0px;z-index:2;"></div>
<img dojoAttachPoint="leftImage" style="position:absolute;left:0px;top:0px;">
<img dojoAttachPoint="centerImage" style="position:absolute;right:0px;top:0px;z-index:1;">
</div>
<div dojoAttachPoint="rightPart" class="dojoButtonRightPart" style="position:absolute;top:0px;right:0px;"
dojoAttachEvent="onMouseOver:rightOver; onMouseOut:rightOut; onMouseUp:rightUp; onClick:rightClick;">
<img dojoAttachPoint="arrowBackgroundImage" style="position:absolute;top:0px;left:0px;z-index:1;">
<img src="${dojoRoot}src/widget/templates/images/whiteDownArrow.gif"
style="z-index:2;position:absolute;left:3px;top:50%;">
<img dojoAttachPoint="rightImage" style="position:absolute;top:0px;right:0px;">
</div>
</div>
<div class="dojoButton" style="position:relative;top:0px;left:0px; text-align:none;">
<div dojoAttachPoint="leftPart" class="dojoButtonLeftPart" style="position:absolute;left:0px;top:0px;"
dojoAttachEvent="onMouseOver:leftOver; onMouseOut:leftOut; onMouseUp:leftUp; onClick:leftClick;">
<div class="dojoButtonContents" dojoAttachPoint="containerNode" style="position:absolute;top:0px;right:0px;z-index:2;"></div>
<img dojoAttachPoint="leftImage" style="position:absolute;left:0px;top:0px;">
<img dojoAttachPoint="centerImage" style="position:absolute;right:0px;top:0px;z-index:1;">
</div>
<div dojoAttachPoint="rightPart" class="dojoButtonRightPart" style="position:absolute;top:0px;right:0px;"
dojoAttachEvent="onMouseOver:rightOver; onMouseOut:rightOut; onMouseUp:rightUp; onClick:rightClick;">
<img dojoAttachPoint="arrowBackgroundImage" style="position:absolute;top:0px;left:0px;z-index:1;">
<img src="${dojoRoot}src/widget/templates/images/whiteDownArrow.gif"
style="z-index:2;position:absolute;left:3px;top:50%;">
<img dojoAttachPoint="rightImage" style="position:absolute;top:0px;right:0px;">
</div>
</div>

View file

@ -1,9 +1,9 @@
<button dojoAttachPoint="button" class="dojoButton dojoButtonNoHover" dojoAttachEvent="onMouseOver: ; onMouseOut: ; onClick: ;">
<table dojoAttachPoint="table" style="margin:0 0 0 0;"><tr>
<td class="label" dojoAttachPoint="labelCell"></td>
<td class="border" dojoAttachPoint="borderCell"></td>
<td class="downArrow" dojoAttachPoint="arrowCell">
<img dojoAttachPoint="arrow">
</td>
</tr></table>
<button dojoAttachPoint="button" class="dojoButton dojoButtonNoHover" dojoAttachEvent="onMouseOver: ; onMouseOut: ; onClick: ;">
<table dojoAttachPoint="table" style="margin:0 0 0 0;"><tr>
<td class="label" dojoAttachPoint="labelCell"></td>
<td class="border" dojoAttachPoint="borderCell"></td>
<td class="downArrow" dojoAttachPoint="arrowCell">
<img dojoAttachPoint="arrow">
</td>
</tr></table>
</button>

View file

@ -1,27 +1,27 @@
.dojoHtmlFisheyeListItemLabel {
font-family: Arial, Helvetica, sans-serif;
background-color: #eee;
border: 2px solid #666;
padding: 2px;
text-align: center;
position: absolute;
display: none;
}
.dojoHtmlFisheyeListItemLabel.selected {
display: block;
}
.dojoHtmlFisheyeListItemImage {
border: 0px;
position: absolute;
}
.dojoHtmlFisheyeListItem {
position: absolute;
z-index: 2;
}
.dojoHtmlFisheyeListBar {
position: relative;
}
.dojoHtmlFisheyeListItemLabel {
font-family: Arial, Helvetica, sans-serif;
background-color: #eee;
border: 2px solid #666;
padding: 2px;
text-align: center;
position: absolute;
display: none;
}
.dojoHtmlFisheyeListItemLabel.selected {
display: block;
}
.dojoHtmlFisheyeListItemImage {
border: 0px;
position: absolute;
}
.dojoHtmlFisheyeListItem {
position: absolute;
z-index: 2;
}
.dojoHtmlFisheyeListBar {
position: relative;
}

View file

@ -1,18 +1,18 @@
<div id="${this.widgetId}" class="dojoFloatingPane">
<div dojoAttachPoint="titleBar" class="dojoFloatingPaneTitleBar" dojoAttachEvent="onMouseDown" style="display:none">
<img dojoAttachPoint="titleBarIcon" class="dojoFloatingPaneTitleBarIcon">
<div dojoAttachPoint="closeAction" dojoAttachEvent="onClick:closeWindow"
class="dojoFloatingPaneCloseIcon"></div>
<div dojoAttachPoint="restoreAction" dojoAttachEvent="onClick:restoreWindow"
class="dojoFloatingPaneRestoreIcon"></div>
<div dojoAttachPoint="maximizeAction" dojoAttachEvent="onClick:maximizeWindow"
class="dojoFloatingPaneMaximizeIcon"></div>
<div dojoAttachPoint="minimizeAction" dojoAttachEvent="onClick:minimizeWindow"
class="dojoFloatingPaneMinimizeIcon"></div>
<div dojoAttachPoint="titleBarText" class="dojoFloatingPaneTitleText">${this.title}</div>
</div>
<div id="${this.widgetId}_container" dojoAttachPoint="containerNode" class="dojoFloatingPaneClient"></div>
<div dojoAttachPoint="resizeBar" class="dojoFloatingPaneResizebar" style="display:none"></div>
<div id="${this.widgetId}" class="dojoFloatingPane">
<div dojoAttachPoint="titleBar" class="dojoFloatingPaneTitleBar" dojoAttachEvent="onMouseDown" style="display:none">
<img dojoAttachPoint="titleBarIcon" class="dojoFloatingPaneTitleBarIcon">
<div dojoAttachPoint="closeAction" dojoAttachEvent="onClick:closeWindow"
class="dojoFloatingPaneCloseIcon"></div>
<div dojoAttachPoint="restoreAction" dojoAttachEvent="onClick:restoreWindow"
class="dojoFloatingPaneRestoreIcon"></div>
<div dojoAttachPoint="maximizeAction" dojoAttachEvent="onClick:maximizeWindow"
class="dojoFloatingPaneMaximizeIcon"></div>
<div dojoAttachPoint="minimizeAction" dojoAttachEvent="onClick:minimizeWindow"
class="dojoFloatingPaneMinimizeIcon"></div>
<div dojoAttachPoint="titleBarText" class="dojoFloatingPaneTitleText">${this.title}</div>
</div>
<div id="${this.widgetId}_container" dojoAttachPoint="containerNode" class="dojoFloatingPaneClient"></div>
<div dojoAttachPoint="resizeBar" class="dojoFloatingPaneResizebar" style="display:none"></div>
</div>

View file

@ -1,173 +1,173 @@
.dojoTabContainer {
position : relative;
}
.dojoTabPaneWrapper {
position : relative;
border : 1px solid #6290d2;
clear: both;
}
.dojoTabLabels-top {
position : absolute;
top : 0px;
left : 0px;
overflow : visible;
margin-bottom : -1px;
width : 100%;
z-index: 2; /* so the bottom of the tab label will cover up the border of dojoTabPaneWrapper */
}
.dojoTabLabels-top-noLayout {
overflow : visible;
margin-bottom : -1px;
width : 100%;
z-index: 2;
}
.dojoTabPaneTab {
position : relative;
float : left;
padding-left : 9px;
border-bottom : 1px solid #6290d2;
background : url(images/tab_left.gif) no-repeat left top;
cursor: pointer;
}
.dojoTabPaneTab span {
display : block;
padding : 4px 15px 4px 6px;
background : url(images/tab_top_right.gif) no-repeat right top;
color : #333;
font-size : 90%;
}
.dojoTabPanePaneClose {
position : absolute;
bottom : 0px;
right : 6px;
height : 12px;
width : 12px;
background : url(images/tab_close.gif) no-repeat right top;
}
.dojoTabPanePaneCloseHover {
background-image : url(images/tab_close_h.gif);
}
.dojoTabPaneTabClose {
display : inline;
height : 12px;
width : 12px;
padding : 0 12px 0 0;
margin : 0 -10px 0 10px;
background : url(images/tab_close.gif) no-repeat right top;
cursor : default;
}
.dojoTabPaneTabCloseHover {
background-image : url(images/tab_close_h.gif);
}
.dojoTabPaneTab.current {
padding-bottom : 1px;
border-bottom : 0;
background-position : 0 -150px;
}
.dojoTabPaneTab.current span {
padding-bottom : 5px;
margin-bottom : -1px;
background-position : 100% -150px;
}
/* bottom tabs */
.dojoTabLabels-bottom {
position : absolute;
bottom : 0px;
left : 0px;
overflow : visible;
margin-top : -1px;
width : 100%;
z-index: 2;
}
.dojoTabLabels-bottom .dojoTabPaneTab {
border-top : 1px solid #6290d2;
border-bottom : 0;
background : url(images/tab_bot_left.gif) no-repeat left bottom;
}
.dojoTabLabels-bottom .dojoTabPaneTab span {
background : url(images/tab_bot_right.gif) no-repeat right bottom;
}
.dojoTabLabels-bottom .dojoTabPaneTab.current {
padding-top : 1px;
border-top : 0;
background : url(images/tab_bot_left_curr.gif) no-repeat left bottom;
}
.dojoTabLabels-bottom .dojoTabPaneTab.current span {
padding-top : 5px;
margin-top : -1px;
background : url(images/tab_bot_right_curr.gif) no-repeat right bottom;
}
/* right-h tabs */
.dojoTabLabels-right-h {
position : absolute;
top : 0px;
right : 0px;
overflow : visible;
margin-left : -1px;
z-index: 2;
}
.dojoTabLabels-right-h .dojoTabPaneTab {
padding-left : 0;
border-left : 1px solid #6290d2;
border-bottom : 0;
background : url(images/tab_bot_right.gif) no-repeat right bottom;
float : none;
}
.dojoTabLabels-right-h .dojoTabPaneTab span {
padding : 4px 15px 4px 15px;
}
.dojoTabLabels-right-h .dojoTabPaneTab.current {
border-left : 0;
border-bottom : 1px solid #6290d2;
}
/* left-h tabs */
.dojoTabLabels-left-h {
position : absolute;
top : 0px;
left : 0px;
overflow : visible;
margin-right : -1px;
z-index: 2;
}
.dojoTabLabels-left-h .dojoTabPaneTab {
border-right : 1px solid #6290d2;
border-bottom : 0;
float : none;
background : url(images/tab_top_left.gif) no-repeat left top;
}
.dojoTabLabels-left-h .dojoTabPaneTab.current {
border-right : 0;
border-bottom : 1px solid #6290d2;
padding-bottom : 0;
background : url(images/tab_top_left.gif) no-repeat 0 -150px;
}
.dojoTabLabels-left-h .dojoTabPaneTab span {
background : 0;
border-bottom : 1px solid #6290d2;
}
.dojoTabContainer {
position : relative;
}
.dojoTabPaneWrapper {
position : relative;
border : 1px solid #6290d2;
clear: both;
}
.dojoTabLabels-top {
position : absolute;
top : 0px;
left : 0px;
overflow : visible;
margin-bottom : -1px;
width : 100%;
z-index: 2; /* so the bottom of the tab label will cover up the border of dojoTabPaneWrapper */
}
.dojoTabLabels-top-noLayout {
overflow : visible;
margin-bottom : -1px;
width : 100%;
z-index: 2;
}
.dojoTabPaneTab {
position : relative;
float : left;
padding-left : 9px;
border-bottom : 1px solid #6290d2;
background : url(images/tab_left.gif) no-repeat left top;
cursor: pointer;
}
.dojoTabPaneTab span {
display : block;
padding : 4px 15px 4px 6px;
background : url(images/tab_top_right.gif) no-repeat right top;
color : #333;
font-size : 90%;
}
.dojoTabPanePaneClose {
position : absolute;
bottom : 0px;
right : 6px;
height : 12px;
width : 12px;
background : url(images/tab_close.gif) no-repeat right top;
}
.dojoTabPanePaneCloseHover {
background-image : url(images/tab_close_h.gif);
}
.dojoTabPaneTabClose {
display : inline;
height : 12px;
width : 12px;
padding : 0 12px 0 0;
margin : 0 -10px 0 10px;
background : url(images/tab_close.gif) no-repeat right top;
cursor : default;
}
.dojoTabPaneTabCloseHover {
background-image : url(images/tab_close_h.gif);
}
.dojoTabPaneTab.current {
padding-bottom : 1px;
border-bottom : 0;
background-position : 0 -150px;
}
.dojoTabPaneTab.current span {
padding-bottom : 5px;
margin-bottom : -1px;
background-position : 100% -150px;
}
/* bottom tabs */
.dojoTabLabels-bottom {
position : absolute;
bottom : 0px;
left : 0px;
overflow : visible;
margin-top : -1px;
width : 100%;
z-index: 2;
}
.dojoTabLabels-bottom .dojoTabPaneTab {
border-top : 1px solid #6290d2;
border-bottom : 0;
background : url(images/tab_bot_left.gif) no-repeat left bottom;
}
.dojoTabLabels-bottom .dojoTabPaneTab span {
background : url(images/tab_bot_right.gif) no-repeat right bottom;
}
.dojoTabLabels-bottom .dojoTabPaneTab.current {
padding-top : 1px;
border-top : 0;
background : url(images/tab_bot_left_curr.gif) no-repeat left bottom;
}
.dojoTabLabels-bottom .dojoTabPaneTab.current span {
padding-top : 5px;
margin-top : -1px;
background : url(images/tab_bot_right_curr.gif) no-repeat right bottom;
}
/* right-h tabs */
.dojoTabLabels-right-h {
position : absolute;
top : 0px;
right : 0px;
overflow : visible;
margin-left : -1px;
z-index: 2;
}
.dojoTabLabels-right-h .dojoTabPaneTab {
padding-left : 0;
border-left : 1px solid #6290d2;
border-bottom : 0;
background : url(images/tab_bot_right.gif) no-repeat right bottom;
float : none;
}
.dojoTabLabels-right-h .dojoTabPaneTab span {
padding : 4px 15px 4px 15px;
}
.dojoTabLabels-right-h .dojoTabPaneTab.current {
border-left : 0;
border-bottom : 1px solid #6290d2;
}
/* left-h tabs */
.dojoTabLabels-left-h {
position : absolute;
top : 0px;
left : 0px;
overflow : visible;
margin-right : -1px;
z-index: 2;
}
.dojoTabLabels-left-h .dojoTabPaneTab {
border-right : 1px solid #6290d2;
border-bottom : 0;
float : none;
background : url(images/tab_top_left.gif) no-repeat left top;
}
.dojoTabLabels-left-h .dojoTabPaneTab.current {
border-right : 0;
border-bottom : 1px solid #6290d2;
padding-bottom : 0;
background : url(images/tab_top_left.gif) no-repeat 0 -150px;
}
.dojoTabLabels-left-h .dojoTabPaneTab span {
background : 0;
border-bottom : 1px solid #6290d2;
}

View file

@ -1,4 +1,4 @@
<div id="${this.widgetId}" class="dojoTabContainer" waiRole="tabpanel">
<div dojoAttachPoint="dojoTabLabels"></div>
<div class="dojoTabPaneWrapper" dojoAttachPoint="containerNode" ></div>
</div>
<div id="${this.widgetId}" class="dojoTabContainer" waiRole="tabpanel">
<div dojoAttachPoint="dojoTabLabels"></div>
<div class="dojoTabPaneWrapper" dojoAttachPoint="containerNode" ></div>
</div>

View file

@ -1,29 +1,29 @@
.dojoTaskBarItem {
display: inline-block;
background-color: ThreeDFace;
border: outset 2px;
margin-right: 5px;
cursor: pointer;
height: 35px;
width: 100px;
font-size: 10pt;
white-space: nowrap;
text-align: center;
float: left;
overflow: hidden;
}
.dojoTaskBarItem img {
vertical-align: middle;
margin-right: 5px;
margin-left: 5px;
height: 32px;
width: 32px;
}
.dojoTaskBarItem a {
color: black;
text-decoration: none;
}
.dojoTaskBarItem {
display: inline-block;
background-color: ThreeDFace;
border: outset 2px;
margin-right: 5px;
cursor: pointer;
height: 35px;
width: 100px;
font-size: 10pt;
white-space: nowrap;
text-align: center;
float: left;
overflow: hidden;
}
.dojoTaskBarItem img {
vertical-align: middle;
margin-right: 5px;
margin-left: 5px;
height: 32px;
width: 32px;
}
.dojoTaskBarItem a {
color: black;
text-decoration: none;
}

View file

@ -1,2 +1,2 @@
<div class="dojoTaskBarItem" dojoAttachEvent="onClick">
<div class="dojoTaskBarItem" dojoAttachEvent="onClick">
</div>

View file

@ -1,9 +1,9 @@
.dojoTooltip {
border: solid black 1px;
background: beige;
color: black;
position: absolute;
font-size: small;
padding: 2px 2px 2px 2px;
z-index: 10;
}
.dojoTooltip {
border: solid black 1px;
background: beige;
color: black;
position: absolute;
font-size: small;
padding: 2px 2px 2px 2px;
z-index: 10;
}

View file

@ -1,2 +1,2 @@
<div class='dojoTooltip' style="display:none" dojoAttachPoint="containerNode">
<div class='dojoTooltip' style="display:none" dojoAttachPoint="containerNode">
</div>

View file

@ -1,36 +1,36 @@
.dojoTree {
font: caption;
font-size: 11px;
font-weight: normal;
overflow: auto;
}
.dojoTreeNodeLabelTitle {
padding-left: 2px;
color: WindowText;
}
.dojoTreeNodeLabel {
cursor:hand;
cursor:pointer;
}
.dojoTreeNodeLabelTitle:hover {
text-decoration: underline;
}
.dojoTreeNodeLabelSelected {
background-color: Highlight;
color: HighlightText;
}
.dojoTree div {
white-space: nowrap;
}
.dojoTree img, .dojoTreeNodeLabel img {
vertical-align: middle;
}
.dojoTree {
font: caption;
font-size: 11px;
font-weight: normal;
overflow: auto;
}
.dojoTreeNodeLabelTitle {
padding-left: 2px;
color: WindowText;
}
.dojoTreeNodeLabel {
cursor:hand;
cursor:pointer;
}
.dojoTreeNodeLabelTitle:hover {
text-decoration: underline;
}
.dojoTreeNodeLabelSelected {
background-color: Highlight;
color: HighlightText;
}
.dojoTree div {
white-space: nowrap;
}
.dojoTree img, .dojoTreeNodeLabel img {
vertical-align: middle;
}

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="15.433" height="15.433"
viewBox="0 0 15.433 15.433" overflow="visible" enable-background="new 0 0 15.433 15.433" xml:space="preserve">
<circle fill="none" stroke="#D02026" stroke-width="2" cx="7.716" cy="7.716" r="6.716"/>
<line fill="none" stroke="#D02026" stroke-width="2" x1="3.02" y1="12.352" x2="12.639" y2="2.732"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="15.433" height="15.433"
viewBox="0 0 15.433 15.433" overflow="visible" enable-background="new 0 0 15.433 15.433" xml:space="preserve">
<circle fill="none" stroke="#D02026" stroke-width="2" cx="7.716" cy="7.716" r="6.716"/>
<line fill="none" stroke="#D02026" stroke-width="2" x1="3.02" y1="12.352" x2="12.639" y2="2.732"/>
</svg>

Before

Width:  |  Height:  |  Size: 763 B

After

Width:  |  Height:  |  Size: 752 B

Before After
Before After

View file

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<script type="text/javascript">
function init(){
document.designMode = 'On';
parentPageDomain = document.location.href.split('#')[1];
if (parentPageDomain) {
document.domain = parentPageDomain;
}
}
window.onload = init;
</script>
</head>
<body>
<br />
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<script type="text/javascript">
function init(){
document.designMode = 'On';
parentPageDomain = document.location.href.split('#')[1];
if (parentPageDomain) {
document.domain = parentPageDomain;
}
}
window.onload = init;
</script>
</head>
<body>
<br />
</body>
</html>

View file

@ -8,419 +8,419 @@
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.vml.Chart");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.widget.Chart");
dojo.require("dojo.math");
dojo.require("dojo.html");
//dojo.require("dojo.vml");
dojo.require("dojo.graphics.color");
dojo.widget.vml.Chart=function(){
dojo.widget.Chart.call(this);
dojo.widget.HtmlWidget.call(this);
};
dojo.inherits(dojo.widget.vml.Chart, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.vml.Chart, {
// widget props
templatePath:null,
templateCssPath:null,
// state
_isInitialized:false,
hasData:false,
// chart props
vectorNode:null,
plotArea:null,
dataGroup:null,
axisGroup:null,
properties:{
height:400, // defaults, will resize to the domNode.
width:600,
plotType:null,
padding:{
top:10,
bottom:2,
left:60,
right:30
},
axes:{
x:{
plotAt:0,
label:"",
unitLabel:"",
unitType:Number,
nUnitsToShow:10,
range:{
min:0,
max:200
}
},
y:{
plotAt:0,
label:"",
unitLabel:"",
unitType:Number,
nUnitsToShow:10,
range:{
min:0,
max:200
}
}
}
},
fillInTemplate:function(args,frag){
this.initialize();
this.render();
},
parseData:function(){
},
initialize:function(){
// parse the data first.
this.parseData();
// render the body of the chart, not the chart data.
if(this.vectorNode){ this.destroy(); }
this.vectorNode=document.createElement("div");
this.vectorNode.style.width=this.properties.width+"px";
this.vectorNode.style.height=this.properties.height+"px";
this.vectorNode.style.position="relative";
this.domNode.appendChild(this.vectorNode);
var plotWidth=this.properties.width-this.properties.padding.left-this.properties.padding.right;
var plotHeight=this.properties.height-this.properties.padding.top-this.properties.padding.bottom;
this.plotArea=document.createElement("div");
this.plotArea.style.position="absolute";
this.plotArea.style.backgroundColor="#fff";
this.plotArea.style.top=(this.properties.padding.top)-2+"px";
this.plotArea.style.left=(this.properties.padding.left-1)+"px";
this.plotArea.style.width=plotWidth+"px";
this.plotArea.style.height=plotHeight+"px";
this.vectorNode.appendChild(this.plotArea);
this.dataGroup=document.createElement("div");
this.dataGroup.style.position="relative";
this.plotArea.appendChild(this.dataGroup);
// clipping rects, what a fucking pain.
var bg=this.domNode.style.backgroundColor;
var r=document.createElement("v:rect");
r.setAttribute("fillcolor", bg);
r.setAttribute("stroked", "false");
r.style.position="absolute";
r.style.top=(-1*this.properties.padding.top)-1+"px";
r.style.left=(-1*this.properties.padding.left)+"px";
r.style.width=(this.properties.width-3)+"px";
r.style.height=(this.properties.padding.top)-2+"px";
this.vectorNode.appendChild(r);
r=document.createElement("v:rect");
r.setAttribute("fillcolor", bg);
r.setAttribute("stroked", "false");
r.style.position="absolute";
r.style.top=plotHeight-2+"px";
r.style.left=(-1*this.properties.padding.left)+"px";
r.style.width=(this.properties.width-3)+"px";
r.style.height=(this.properties.padding.bottom)-2+"px"; // fixme: check this.
this.vectorNode.appendChild(r);
r=document.createElement("v:rect");
r.setAttribute("fillcolor", bg);
r.setAttribute("stroked", "false");
r.style.position="absolute";
r.style.top="-2px";
r.style.left=(-1*this.properties.padding.left)+"px";
r.style.width=(this.properties.padding.left-1)+"px";
r.style.height=plotHeight+"px";
this.vectorNode.appendChild(r);
r=document.createElement("v:rect");
r.setAttribute("fillcolor", bg);
r.setAttribute("stroked", "false");
r.style.position="absolute";
r.style.top="-2px";
r.style.right=(-1*this.properties.padding.right)+1+"px";
r.style.width=(this.properties.padding.right-1)+"px";
r.style.height=plotHeight+"px";
this.vectorNode.appendChild(r);
// end clipping rects. god that sucks, i wish VML had clipping outside of that crap vmlframe...
this.axisGroup=document.createElement("div");
this.axisGroup.style.position="relative";
this.plotArea.appendChild(this.axisGroup);
var stroke=1;
// x axis
var line=document.createElement("v:line");
var y=dojo.widget.vml.Chart.Plotter.getY(this.properties.axes.x.plotAt, this);
line.setAttribute("from", this.properties.padding.left-stroke + "," + y);
line.setAttribute("to", plotWidth + "," + y);
line.style.position="absolute";
line.style.antialias="false";
line.setAttribute("strokecolor", "#666");
line.setAttribute("strokeweight", stroke*2+"px");
this.axisGroup.appendChild(line);
// y axis
var line=document.createElement("v:line");
var y=dojo.widget.vml.Chart.Plotter.getX(this.properties.axes.y.plotAt, this);
line.setAttribute("from", y+","+this.properties.padding.top);
line.setAttribute("to", y+","+this.properties.height-this.properties.padding.bottom);
line.style.position="absolute";
line.style.antialias="false";
line.setAttribute("strokecolor", "#666");
line.setAttribute("strokeweight", stroke*2+"px");
this.axisGroup.appendChild(line);
// labels
var size=10;
// x axis labels.
var t=document.createElement("div");
t.style.position="absolute";
t.style.top=(this.properties.height-this.properties.padding.bottom+size+2)+"px";
t.style.left=this.properties.padding.left+"px";
t.style.fontFamily="sans-serif";
t.style.fontSize=size+"px";
t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.x.range.min),2);
this.axisGroup.appendChild(t);
t=document.createElement("div");
t.style.position="absolute";
t.style.top=(this.properties.height-this.properties.padding.bottom+size+2)+"px";
t.style.left=(this.properties.width-this.properties.padding.right-(size/2))+"px";
t.style.fontFamily="sans-serif";
t.style.fontSize=size+"px";
t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.x.range.max),2);
this.axisGroup.appendChild(t);
// y axis labels.
t=document.createElement("div");
t.style.position="absolute";
t.style.top=-1*(size/2)+"px";
t.style.right=(plotWidth+4)+"px";
t.style.fontFamily="sans-serif";
t.style.fontSize=size+"px";
t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.y.range.max),2);
this.axisGroup.appendChild(t);
t=document.createElement("div");
t.style.position="absolute";
t.style.top=(this.properties.height-this.properties.padding.bottom)+"px";
t.style.right=(plotWidth+4)+"px";
t.style.fontFamily="sans-serif";
t.style.fontSize=size+"px";
t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.y.range.min),2);
this.axisGroup.appendChild(t);
// this is last.
this.assignColors();
this._isInitialized=true;
},
destroy:function(){
while(this.domNode.childNodes.length>0){
this.domNode.removeChild(this.domNode.childNodes[0]);
}
this.vectorNode=this.plotArea=this.dataGroup=this.axisGroup=null;
},
render:function(){
if (this.dataGroup){
while(this.dataGroup.childNodes.length>0){
this.dataGroup.removeChild(this.dataGroup.childNodes[0]);
}
} else {
this.initialize();
}
for(var i=0; i<this.series.length; i++){
dojo.widget.vml.Chart.Plotter.plot(this.series[i], this);
}
}
});
dojo.widget.vml.Chart.Plotter=new function(){
var _this=this;
var plotters = {};
var types=dojo.widget.Chart.PlotTypes;
this.getX=function(value, chart){
var v=parseFloat(value);
var min=chart.properties.axes.x.range.min;
var max=chart.properties.axes.x.range.max;
var ofst=0-min;
min+=ofst; max+=ofst; v+=ofst;
var xmin=chart.properties.padding.left;
var xmax=chart.properties.width-chart.properties.padding.right;
var x=(v*((xmax-xmin)/max))+xmin;
return x;
};
this.getY=function(value, chart){
var v=parseFloat(value);
var max=chart.properties.axes.y.range.max;
var min=chart.properties.axes.y.range.min;
var ofst=0;
if(min<0)ofst+=Math.abs(min);
min+=ofst; max+=ofst; v+=ofst;
var ymin=chart.properties.height-chart.properties.padding.bottom;
var ymax=chart.properties.padding.top;
var y=(((ymin-ymax)/(max-min))*(max-v))+ymax;
return y;
};
this.addPlotter=function(name, func){
plotters[name]=func;
};
this.plot=function(series, chart){
if (series.values.length==0) return;
if (series.plotType && plotters[series.plotType]){
return plotters[series.plotType](series, chart);
}
else if (chart.plotType && plotters[chart.plotType]){
return plotters[chart.plotType](series, chart);
}
};
// plotting
plotters[types.Bar]=function(series, chart){
var space=1;
var lastW = 0;
for (var i=0; i<series.values.length; i++){
var x=_this.getX(series.values[i].x, chart);
var w;
if (i==series.values.length-1){
w=lastW;
} else{
w=_this.getX(series.values[i+1].x, chart)-x-space;
lastW=w;
}
x-=(w/2);
var yA=_this.getY(chart.properties.axes.x.plotAt, chart);
var y=_this.getY(series.values[i].value, chart);
var h=Math.abs(yA-y);
if (parseFloat(series.values[i].value)<chart.properties.axes.x.plotAt){
var oy=yA;
yA=y;
y=oy;
}
var bar=document.createElement("v:rect");
bar.style.position="absolute";
bar.style.top=x+"px";
bar.style.left=y+"px";
bar.style.width=w+"px";
bar.style.height=h+"px";
bar.setAttribute("fillColor", series.color);
bar.setAttribute("title", series.label + ": " + series.values[i].value);
bar.setAttribute("coordsize", chart.properties.width + "," + chart.properties.height);
var fill=document.createElement("v:fill");
fill.setAttribute("opacity", "0.9");
bar.appendChild(fill);
chart.dataGroup.appendChild(bar);
}
};
plotters[types.Line]=function(series, chart){
var tension=3;
var line=document.createElement("v:shape");
line.setAttribute("strokeweight", "2px");
line.setAttribute("strokecolor", series.color);
line.setAttribute("fillcolor", "none");
line.setAttribute("filled", "false");
line.setAttribute("title", series.label);
line.setAttribute("coordsize", chart.properties.width + "," + chart.properties.height);
line.style.position="absolute";
line.style.top="0px";
line.style.left="0px";
line.style.width= chart.properties.width+"px";
line.style.height=chart.properties.height+"px";
var stroke=document.createElement("v:stroke");
stroke.setAttribute("opacity", "0.85");
line.appendChild(stroke);
var path = [];
for (var i=0; i<series.values.length; i++){
var x = _this.getX(series.values[i].x, chart)
var y = _this.getY(series.values[i].value, chart);
if (i==0){
path.push("m");
path.push(x+","+y);
}else{
var lastx=_this.getX(series.values[i-1].x, chart);
var lasty=_this.getY(series.values[i-1].value, chart);
var dx=x-lastx;
path.push("v");
var cx=x-(tension-1)*(dx/tension);
path.push(cx+",0");
cx=x-(dx/tension);
path.push(cx+","+y-lasty);
path.push(dx, y-lasty);
}
}
line.setAttribute("path", path.join(" ")+" e");
chart.dataGroup.appendChild(line);
};
plotters[types.Scatter]=function(series, chart){
var r=8;
for (var i=0; i<series.values.length; i++){
var x=_this.getX(series.values[i].x, chart);
var y=_this.getY(series.values[i].value, chart);
var mod=r/2;
var point=document.createElement("v:rect");
point.setAttribute("fillcolor", series.color);
point.setAttribute("strokecolor", series.color);
point.setAttribute("title", series.label + ": " + series.values[i].value);
point.style.position="absolute";
point.style.rotation="45";
point.style.top=(y-mod)+"px";
point.style.left=(x-mod)+"px";
point.style.width=r+"px";
point.style.height=r+"px";
var fill=document.createElement("v:fill");
fill.setAttribute("opacity", "0.5");
point.appendChild(fill);
chart.dataGroup.appendChild(point);
}
};
plotters[types.Bubble]=function(series, chart){
// added param for series[n].value: size
var minR=1;
// do this off the x axis?
var min=chart.properties.axes.x.range.min;
var max=chart.properties.axes.x.range.max;
var ofst=0-min;
min+=ofst; max+=ofst;
var xmin=chart.properties.padding.left;
var xmax=chart.properties.width-chart.properties.padding.right;
var factor=(max-min)/(xmax-xmin)*25;
for (var i=0; i<series.values.length; i++){
var size = series.values[i].size;
if (isNaN(parseFloat(size))) size=minR;
var mod=(parseFloat(size)*factor)/2;
var point=document.createElement("v:oval");
point.setAttribute("strokecolor", series.color);
point.setAttribute("fillcolor", series.color);
point.setAttribute("title", series.label + ": " + series.values[i].value + " (" + size + ")");
point.style.position="absolute";
point.style.top=(_this.getY(series.values[i].value, chart)-mod) + "px";
point.style.left=(_this.getX(series.values[i].x, chart)-mod) + "px";
point.style.width=mod+"px";
point.style.height=mod+"px";
chart.dataGroup.appendChild(point);
}
};
}();
dojo.provide("dojo.widget.vml.Chart");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.widget.Chart");
dojo.require("dojo.math");
dojo.require("dojo.html");
//dojo.require("dojo.vml");
dojo.require("dojo.graphics.color");
dojo.widget.vml.Chart=function(){
dojo.widget.Chart.call(this);
dojo.widget.HtmlWidget.call(this);
};
dojo.inherits(dojo.widget.vml.Chart, dojo.widget.HtmlWidget);
dojo.lang.extend(dojo.widget.vml.Chart, {
// widget props
templatePath:null,
templateCssPath:null,
// state
_isInitialized:false,
hasData:false,
// chart props
vectorNode:null,
plotArea:null,
dataGroup:null,
axisGroup:null,
properties:{
height:400, // defaults, will resize to the domNode.
width:600,
plotType:null,
padding:{
top:10,
bottom:2,
left:60,
right:30
},
axes:{
x:{
plotAt:0,
label:"",
unitLabel:"",
unitType:Number,
nUnitsToShow:10,
range:{
min:0,
max:200
}
},
y:{
plotAt:0,
label:"",
unitLabel:"",
unitType:Number,
nUnitsToShow:10,
range:{
min:0,
max:200
}
}
}
},
fillInTemplate:function(args,frag){
this.initialize();
this.render();
},
parseData:function(){
},
initialize:function(){
// parse the data first.
this.parseData();
// render the body of the chart, not the chart data.
if(this.vectorNode){ this.destroy(); }
this.vectorNode=document.createElement("div");
this.vectorNode.style.width=this.properties.width+"px";
this.vectorNode.style.height=this.properties.height+"px";
this.vectorNode.style.position="relative";
this.domNode.appendChild(this.vectorNode);
var plotWidth=this.properties.width-this.properties.padding.left-this.properties.padding.right;
var plotHeight=this.properties.height-this.properties.padding.top-this.properties.padding.bottom;
this.plotArea=document.createElement("div");
this.plotArea.style.position="absolute";
this.plotArea.style.backgroundColor="#fff";
this.plotArea.style.top=(this.properties.padding.top)-2+"px";
this.plotArea.style.left=(this.properties.padding.left-1)+"px";
this.plotArea.style.width=plotWidth+"px";
this.plotArea.style.height=plotHeight+"px";
this.vectorNode.appendChild(this.plotArea);
this.dataGroup=document.createElement("div");
this.dataGroup.style.position="relative";
this.plotArea.appendChild(this.dataGroup);
// clipping rects, what a fucking pain.
var bg=this.domNode.style.backgroundColor;
var r=document.createElement("v:rect");
r.setAttribute("fillcolor", bg);
r.setAttribute("stroked", "false");
r.style.position="absolute";
r.style.top=(-1*this.properties.padding.top)-1+"px";
r.style.left=(-1*this.properties.padding.left)+"px";
r.style.width=(this.properties.width-3)+"px";
r.style.height=(this.properties.padding.top)-2+"px";
this.vectorNode.appendChild(r);
r=document.createElement("v:rect");
r.setAttribute("fillcolor", bg);
r.setAttribute("stroked", "false");
r.style.position="absolute";
r.style.top=plotHeight-2+"px";
r.style.left=(-1*this.properties.padding.left)+"px";
r.style.width=(this.properties.width-3)+"px";
r.style.height=(this.properties.padding.bottom)-2+"px"; // fixme: check this.
this.vectorNode.appendChild(r);
r=document.createElement("v:rect");
r.setAttribute("fillcolor", bg);
r.setAttribute("stroked", "false");
r.style.position="absolute";
r.style.top="-2px";
r.style.left=(-1*this.properties.padding.left)+"px";
r.style.width=(this.properties.padding.left-1)+"px";
r.style.height=plotHeight+"px";
this.vectorNode.appendChild(r);
r=document.createElement("v:rect");
r.setAttribute("fillcolor", bg);
r.setAttribute("stroked", "false");
r.style.position="absolute";
r.style.top="-2px";
r.style.right=(-1*this.properties.padding.right)+1+"px";
r.style.width=(this.properties.padding.right-1)+"px";
r.style.height=plotHeight+"px";
this.vectorNode.appendChild(r);
// end clipping rects. god that sucks, i wish VML had clipping outside of that crap vmlframe...
this.axisGroup=document.createElement("div");
this.axisGroup.style.position="relative";
this.plotArea.appendChild(this.axisGroup);
var stroke=1;
// x axis
var line=document.createElement("v:line");
var y=dojo.widget.vml.Chart.Plotter.getY(this.properties.axes.x.plotAt, this);
line.setAttribute("from", this.properties.padding.left-stroke + "," + y);
line.setAttribute("to", plotWidth + "," + y);
line.style.position="absolute";
line.style.antialias="false";
line.setAttribute("strokecolor", "#666");
line.setAttribute("strokeweight", stroke*2+"px");
this.axisGroup.appendChild(line);
// y axis
var line=document.createElement("v:line");
var y=dojo.widget.vml.Chart.Plotter.getX(this.properties.axes.y.plotAt, this);
line.setAttribute("from", y+","+this.properties.padding.top);
line.setAttribute("to", y+","+this.properties.height-this.properties.padding.bottom);
line.style.position="absolute";
line.style.antialias="false";
line.setAttribute("strokecolor", "#666");
line.setAttribute("strokeweight", stroke*2+"px");
this.axisGroup.appendChild(line);
// labels
var size=10;
// x axis labels.
var t=document.createElement("div");
t.style.position="absolute";
t.style.top=(this.properties.height-this.properties.padding.bottom+size+2)+"px";
t.style.left=this.properties.padding.left+"px";
t.style.fontFamily="sans-serif";
t.style.fontSize=size+"px";
t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.x.range.min),2);
this.axisGroup.appendChild(t);
t=document.createElement("div");
t.style.position="absolute";
t.style.top=(this.properties.height-this.properties.padding.bottom+size+2)+"px";
t.style.left=(this.properties.width-this.properties.padding.right-(size/2))+"px";
t.style.fontFamily="sans-serif";
t.style.fontSize=size+"px";
t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.x.range.max),2);
this.axisGroup.appendChild(t);
// y axis labels.
t=document.createElement("div");
t.style.position="absolute";
t.style.top=-1*(size/2)+"px";
t.style.right=(plotWidth+4)+"px";
t.style.fontFamily="sans-serif";
t.style.fontSize=size+"px";
t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.y.range.max),2);
this.axisGroup.appendChild(t);
t=document.createElement("div");
t.style.position="absolute";
t.style.top=(this.properties.height-this.properties.padding.bottom)+"px";
t.style.right=(plotWidth+4)+"px";
t.style.fontFamily="sans-serif";
t.style.fontSize=size+"px";
t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.y.range.min),2);
this.axisGroup.appendChild(t);
// this is last.
this.assignColors();
this._isInitialized=true;
},
destroy:function(){
while(this.domNode.childNodes.length>0){
this.domNode.removeChild(this.domNode.childNodes[0]);
}
this.vectorNode=this.plotArea=this.dataGroup=this.axisGroup=null;
},
render:function(){
if (this.dataGroup){
while(this.dataGroup.childNodes.length>0){
this.dataGroup.removeChild(this.dataGroup.childNodes[0]);
}
} else {
this.initialize();
}
for(var i=0; i<this.series.length; i++){
dojo.widget.vml.Chart.Plotter.plot(this.series[i], this);
}
}
});
dojo.widget.vml.Chart.Plotter=new function(){
var _this=this;
var plotters = {};
var types=dojo.widget.Chart.PlotTypes;
this.getX=function(value, chart){
var v=parseFloat(value);
var min=chart.properties.axes.x.range.min;
var max=chart.properties.axes.x.range.max;
var ofst=0-min;
min+=ofst; max+=ofst; v+=ofst;
var xmin=chart.properties.padding.left;
var xmax=chart.properties.width-chart.properties.padding.right;
var x=(v*((xmax-xmin)/max))+xmin;
return x;
};
this.getY=function(value, chart){
var v=parseFloat(value);
var max=chart.properties.axes.y.range.max;
var min=chart.properties.axes.y.range.min;
var ofst=0;
if(min<0)ofst+=Math.abs(min);
min+=ofst; max+=ofst; v+=ofst;
var ymin=chart.properties.height-chart.properties.padding.bottom;
var ymax=chart.properties.padding.top;
var y=(((ymin-ymax)/(max-min))*(max-v))+ymax;
return y;
};
this.addPlotter=function(name, func){
plotters[name]=func;
};
this.plot=function(series, chart){
if (series.values.length==0) return;
if (series.plotType && plotters[series.plotType]){
return plotters[series.plotType](series, chart);
}
else if (chart.plotType && plotters[chart.plotType]){
return plotters[chart.plotType](series, chart);
}
};
// plotting
plotters[types.Bar]=function(series, chart){
var space=1;
var lastW = 0;
for (var i=0; i<series.values.length; i++){
var x=_this.getX(series.values[i].x, chart);
var w;
if (i==series.values.length-1){
w=lastW;
} else{
w=_this.getX(series.values[i+1].x, chart)-x-space;
lastW=w;
}
x-=(w/2);
var yA=_this.getY(chart.properties.axes.x.plotAt, chart);
var y=_this.getY(series.values[i].value, chart);
var h=Math.abs(yA-y);
if (parseFloat(series.values[i].value)<chart.properties.axes.x.plotAt){
var oy=yA;
yA=y;
y=oy;
}
var bar=document.createElement("v:rect");
bar.style.position="absolute";
bar.style.top=x+"px";
bar.style.left=y+"px";
bar.style.width=w+"px";
bar.style.height=h+"px";
bar.setAttribute("fillColor", series.color);
bar.setAttribute("title", series.label + ": " + series.values[i].value);
bar.setAttribute("coordsize", chart.properties.width + "," + chart.properties.height);
var fill=document.createElement("v:fill");
fill.setAttribute("opacity", "0.9");
bar.appendChild(fill);
chart.dataGroup.appendChild(bar);
}
};
plotters[types.Line]=function(series, chart){
var tension=3;
var line=document.createElement("v:shape");
line.setAttribute("strokeweight", "2px");
line.setAttribute("strokecolor", series.color);
line.setAttribute("fillcolor", "none");
line.setAttribute("filled", "false");
line.setAttribute("title", series.label);
line.setAttribute("coordsize", chart.properties.width + "," + chart.properties.height);
line.style.position="absolute";
line.style.top="0px";
line.style.left="0px";
line.style.width= chart.properties.width+"px";
line.style.height=chart.properties.height+"px";
var stroke=document.createElement("v:stroke");
stroke.setAttribute("opacity", "0.85");
line.appendChild(stroke);
var path = [];
for (var i=0; i<series.values.length; i++){
var x = _this.getX(series.values[i].x, chart)
var y = _this.getY(series.values[i].value, chart);
if (i==0){
path.push("m");
path.push(x+","+y);
}else{
var lastx=_this.getX(series.values[i-1].x, chart);
var lasty=_this.getY(series.values[i-1].value, chart);
var dx=x-lastx;
path.push("v");
var cx=x-(tension-1)*(dx/tension);
path.push(cx+",0");
cx=x-(dx/tension);
path.push(cx+","+y-lasty);
path.push(dx, y-lasty);
}
}
line.setAttribute("path", path.join(" ")+" e");
chart.dataGroup.appendChild(line);
};
plotters[types.Scatter]=function(series, chart){
var r=8;
for (var i=0; i<series.values.length; i++){
var x=_this.getX(series.values[i].x, chart);
var y=_this.getY(series.values[i].value, chart);
var mod=r/2;
var point=document.createElement("v:rect");
point.setAttribute("fillcolor", series.color);
point.setAttribute("strokecolor", series.color);
point.setAttribute("title", series.label + ": " + series.values[i].value);
point.style.position="absolute";
point.style.rotation="45";
point.style.top=(y-mod)+"px";
point.style.left=(x-mod)+"px";
point.style.width=r+"px";
point.style.height=r+"px";
var fill=document.createElement("v:fill");
fill.setAttribute("opacity", "0.5");
point.appendChild(fill);
chart.dataGroup.appendChild(point);
}
};
plotters[types.Bubble]=function(series, chart){
// added param for series[n].value: size
var minR=1;
// do this off the x axis?
var min=chart.properties.axes.x.range.min;
var max=chart.properties.axes.x.range.max;
var ofst=0-min;
min+=ofst; max+=ofst;
var xmin=chart.properties.padding.left;
var xmax=chart.properties.width-chart.properties.padding.right;
var factor=(max-min)/(xmax-xmin)*25;
for (var i=0; i<series.values.length; i++){
var size = series.values[i].size;
if (isNaN(parseFloat(size))) size=minR;
var mod=(parseFloat(size)*factor)/2;
var point=document.createElement("v:oval");
point.setAttribute("strokecolor", series.color);
point.setAttribute("fillcolor", series.color);
point.setAttribute("title", series.label + ": " + series.values[i].value + " (" + size + ")");
point.style.position="absolute";
point.style.top=(_this.getY(series.values[i].value, chart)-mod) + "px";
point.style.left=(_this.getX(series.values[i].x, chart)-mod) + "px";
point.style.width=mod+"px";
point.style.height=mod+"px";
chart.dataGroup.appendChild(point);
}
};
}();