Compare commits

..

1 Commits

Author SHA1 Message Date
(no author)
258dc9fead This commit was manufactured by cvs2svn to create branch 'src'.
git-svn-id: svn://10.0.0.236/branches/src@33658 18797224-902f-48f8-a5cc-f745e15eee43
1999-06-03 23:10:01 +00:00
189 changed files with 18627 additions and 14381 deletions

View File

@@ -1,58 +0,0 @@
#!/usr/bin/env python
import cgitb; cgitb.enable()
import sys
import cgi
import time
import re
from pysqlite2 import dbapi2 as sqlite
print "Content-type: text/plain\n\n"
form = cgi.FieldStorage()
# incoming query string has the following parameters:
# user=name
# (REQUIRED) user that made this annotation
# tbox=foopy
# (REQUIRED) name of the tinderbox to annotate
# data=string
# annotation to record
# time=seconds
# time since the epoch in GMT of this test result; if ommitted, current time at time of script run is used
tbox = form.getfirst("tbox")
user = form.getfirst("user")
data = form.getfirst("data")
timeval = form.getfirst("time")
if timeval is None:
timeval = int(time.time())
if (user is None) or (tbox is None) or (data is None):
print "Bad args"
sys.exit()
if re.match(r"[^A-Za-z0-9]", tbox):
print "Bad tbox name"
sys.exit()
db = sqlite.connect("db/" + tbox + ".sqlite")
try:
db.execute("CREATE TABLE test_results (test_name STRING, test_time INTEGER, test_value FLOAT, test_data BLOB);")
db.execute("CREATE TABLE annotations (anno_user STRING, anno_time INTEGER, anno_string STRING);")
db.execute("CREATE INDEX test_name_idx ON test_results.test_name")
db.execute("CREATE INDEX test_time_idx ON test_results.test_time")
db.execute("CREATE INDEX anno_time_idx ON annotations.anno_time")
except:
pass
db.execute("INSERT INTO annotations VALUES (?,?,?)", (user, timeval, data))
db.commit()
print "Inserted."
sys.exit()

View File

@@ -1,59 +0,0 @@
#!/usr/bin/env python
#
# bonsaibouncer
#
# Bounce a request to bonsai.mozilla.org, getting around silly
# cross-domain XMLHTTPRequest deficiencies.
#
import cgitb; cgitb.enable()
import os
import sys
import cgi
import gzip
import urllib
from urllib import quote
import cStringIO
bonsai = "http://bonsai.mozilla.org/cvsquery.cgi";
def main():
#doGzip = 0
#try:
# if string.find(os.environ["HTTP_ACCEPT_ENCODING"], "gzip") != -1:
# doGzip = 1
#except:
# pass
form = cgi.FieldStorage()
treeid = form.getfirst("treeid")
module = form.getfirst("module")
branch = form.getfirst("branch")
mindate = form.getfirst("mindate")
maxdate = form.getfirst("maxdate")
xml_nofiles = form.getfirst("xml_nofiles")
if not treeid or not module or not branch or not mindate or not maxdate:
print "Content-type: text/plain\n\n"
print "ERROR"
return
url = bonsai + "?" + "branchtype=match&sortby=Date&date=explicit&cvsroot=%2Fcvsroot&xml=1"
url += "&treeid=%s&module=%s&branch=%s&mindate=%s&maxdate=%s" % (quote(treeid), quote(module), quote(branch), quote(mindate), quote(maxdate))
if (xml_nofiles):
url += "&xml_nofiles=1"
urlstream = urllib.urlopen(url)
sys.stdout.write("Content-type: text/xml\n\n")
for s in urlstream:
sys.stdout.write(s)
urlstream.close()
main()

View File

@@ -1,216 +0,0 @@
#!/usr/bin/env python
import cgitb; cgitb.enable()
import sys
import cgi
import time
import re
from graphsdb import db
#if var is a valid number returns a value other than None
def checkNumber(var):
if var is None:
return 1
reNumber = re.compile('^[0-9.]*$')
return reNumber.match(var)
#if var is a valid string returns a value other than None
def checkString(var):
if var is None:
return 1
reString = re.compile('^[0-9A-Za-z._()\- ]*$')
return reString.match(var)
print "Content-type: text/plain\n\n"
link_format = "RETURN:%s:%.2f:%sspst=range&spstart=%d&spend=%d&bpst=cursor&bpstart=%d&bpend=%d&m1tid=%d&m1bl=0&m1avg=0\n"
link_str = ""
form = cgi.FieldStorage()
# incoming query string has the following parameters:
# type=discrete|continuous
# indicates discrete vs. continuous dataset, defaults to continuous
# value=n
# (REQUIRED) value to be recorded as the actual test value
# tbox=foopy
# (REQUIRED) name of the tinderbox reporting the value (or rather, the name that is to be given this set of data)
# testname=test
# (REQUIRED) the name of this test
# data=rawdata
# raw data for this test
# time=seconds
# time since the epoch in GMT of this test result; if ommitted, current time at time of script run is used
# date
# date that the test was run - this is for discrete graphs
# branch=1.8.1,1.8.0 or 1.9.0
# name of the branch that the build was generated for
# branchid=id
# date of the build
# http://wiki.mozilla.org/MozillaQualityAssurance:Build_Ids
#takes as input a file for parsing in csv with the format:
# value,testname,tbox,time,data,branch,branchid,type,data
# Create the DB schema if it doesn't already exist
# XXX can pull out dataset_info.machine and dataset_info.{test,test_type} into two separate tables,
# if we need to.
# value,testname,tbox,time,data,branch,branchid,type,data
fields = ["value", "testname", "tbox", "timeval", "date", "branch", "branchid", "type", "data"]
strFields = ["type", "data", "tbox", "testname", "branch", "branchid"]
numFields = ["date", "timeval", "value"]
d_ids = []
all_ids = []
all_types = []
if form.has_key("filename"):
val = form["filename"]
if val.file:
print "found a file"
for line in val.file:
line = line.rstrip("\n\r")
contents = line.split(',')
#clear any previous content in the fields variables - stops reuse of data over lines
for field in fields:
globals()[field] = ''
if len(contents) < 7:
print "Incompatable file format"
sys.exit(500)
for field, content in zip(fields, contents):
globals()[field] = content
for strField in strFields:
if not globals().has_key(strField):
continue
if not checkString(globals()[strField]):
print "Invalid string arg: ", strField, " '" + globals()[strField] + "'"
sys.exit(500)
for numField in numFields:
if not globals().has_key(numField):
continue
if not checkNumber(globals()[numField]):
print "Invalid string arg: ", numField, " '" + globals()[numField] + "'"
sys.exit(500)
#do some checks to ensure that we are enforcing the requirement rules of the script
if (not type):
type = "continuous"
if (not timeval):
timeval = int(time.time())
if (type == "discrete") and (not date):
print "Bad args, need a valid date"
sys.exit(500)
if (not value) or (not tbox) or (not testname):
print "Bad args"
sys.exit(500)
# figure out our dataset id
setid = -1
# Not a big fan of this while loop. If something goes wrong with the select it will insert until the script times out.
while setid == -1:
cur = db.cursor()
cur.execute("SELECT id FROM dataset_info WHERE type <=> ? AND machine <=> ? AND test <=> ? AND test_type <=> ? AND extra_data <=> ? AND branch <=> ? AND date <=> ? limit 1",
(type, tbox, testname, "perf", "branch="+branch, branch, date))
res = cur.fetchall()
cur.close()
if len(res) == 0:
db.execute("INSERT INTO dataset_info (type, machine, test, test_type, extra_data, branch, date) VALUES (?,?,?,?,?,?,?)",
(type, tbox, testname, "perf", "branch="+branch, branch, date))
else:
setid = res[0][0]
db.execute("INSERT INTO dataset_values (dataset_id, time, value) VALUES (?,?,?)", (setid, timeval, value))
db.execute("INSERT INTO dataset_branchinfo (dataset_id, time, branchid) VALUES (?,?,?)", (setid, timeval, branchid))
if data and data != "":
db.execute("INSERT INTO dataset_extra_data (dataset_id, time, data) VALUES (?,?,?)", (setid, timeval, data))
if (type == "discrete"):
if not setid in d_ids:
d_ids.append(setid)
if not setid in all_ids:
all_ids.append(setid)
all_types.append(type)
for setid, type in zip(all_ids, all_types):
cur = db.cursor()
cur.execute("SELECT MIN(time), MAX(time), test FROM dataset_values, dataset_info WHERE dataset_id = ? and id = dataset_id GROUP BY test", (setid,))
res = cur.fetchall()
cur.close()
tstart = res[0][0]
tend = res[0][1]
testname = res[0][2]
if type == "discrete":
link_str += (link_format % (testname, float(-1), "dgraph.html#name=" + testname + "&", tstart, tend, tstart, tend, setid,))
else:
tstart = 0
link_str += (link_format % (testname, float(-1), "graph.html#",tstart, tend, tstart, tend, setid,))
#this code auto-adds a set of continuous data for each series of discrete data sets - creating an overview of the data
# generated by a given test (matched by machine, test, test_type, extra_data and branch)
for setid in d_ids:
cur = db.cursor()
#throw out the largest value and take the average of the rest
cur.execute("SELECT AVG(value) FROM dataset_values WHERE dataset_id = ? and value != (SELECT MAX(value) from dataset_values where dataset_id = ?)", (setid, setid,))
res = cur.fetchall()
cur.close()
avg = res[0][0]
if avg is not None:
cur = db.cursor()
cur.execute("SELECT machine, test, test_type, extra_data, branch, date FROM dataset_info WHERE id = ?", (setid,))
res = cur.fetchall()
cur.close()
tbox = res[0][0]
testname = res[0][1]
test_type = res[0][2]
extra_data = res[0][3]
branch = str(res[0][4])
timeval = res[0][5]
date = ''
cur = db.cursor()
cur.execute("SELECT branchid FROM dataset_branchinfo WHERE dataset_id = ?", (setid,))
res = cur.fetchall()
cur.close()
branchid = res[0][0]
dsetid = -1
while dsetid == -1 :
cur = db.cursor()
cur.execute("SELECT id from dataset_info where type = ? AND machine <=> ? AND test = ? AND test_type = ? AND extra_data = ? AND branch <=> ? AND date <=> ? limit 1",
("continuous", tbox, testname+"_avg", "perf", "branch="+branch, branch, date))
res = cur.fetchall()
cur.close()
if len(res) == 0:
db.execute("INSERT INTO dataset_info (type, machine, test, test_type, extra_data, branch, date) VALUES (?,?,?,?,?,?,?)",
("continuous", tbox, testname+"_avg", "perf", "branch="+branch, branch, date))
else:
dsetid = res[0][0]
cur = db.cursor()
cur.execute("SELECT * FROM dataset_values WHERE dataset_id=? AND time <=> ? limit 1", (dsetid, timeval))
res = cur.fetchall()
cur.close()
if len(res) == 0:
db.execute("INSERT INTO dataset_values (dataset_id, time, value) VALUES (?,?,?)", (dsetid, timeval, avg))
db.execute("INSERT INTO dataset_branchinfo (dataset_id, time, branchid) VALUES (?,?,?)", (dsetid, timeval, branchid))
else:
db.execute("UPDATE dataset_values SET value=? WHERE dataset_id=? AND time <=> ?", (avg, dsetid, timeval))
db.execute("UPDATE dataset_branchinfo SET branchid=? WHERE dataset_id=? AND time <=> ?", (branchid, dsetid, timeval))
cur = db.cursor()
cur.execute("SELECT MIN(time), MAX(time) FROM dataset_values WHERE dataset_id = ?", (dsetid,))
res = cur.fetchall()
cur.close()
tstart = 0
tend = res[0][1]
link_str += (link_format % (testname, float(avg), "graph.html#", tstart, tend, tstart, tend, dsetid,))
db.commit()
print "Inserted."
print link_str
sys.exit()

View File

@@ -1,175 +0,0 @@
#!/usr/bin/env python
import cgitb; cgitb.enable()
import sys
import cgi
import time
import re
from graphsdb import db
#if var is a valid number returns a value other than None
def checkNumber(var):
if var is None:
return 1
reNumber = re.compile('^[0-9.]*$')
return reNumber.match(var)
#if var is a valid string returns a value other than None
def checkString(var):
if var is None:
return 1
reString = re.compile('^[0-9A-Za-z._()\- ]*$')
return reString.match(var)
print "Content-type: text/plain\n\n"
link_format = "RETURN:%.2f:%sspst=range&spstart=%d&spend=%d&bpst=cursor&bpstart=%d&bpend=%d&m1tid=%d&m1bl=0&m1avg=0\n"
link_str = ""
form = cgi.FieldStorage()
# incoming query string has the following parameters:
# type=discrete|continuous
# indicates discrete vs. continuous dataset, defaults to continuous
# value=n
# (REQUIRED) value to be recorded as the actual test value
# tbox=foopy
# (REQUIRED) name of the tinderbox reporting the value (or rather, the name that is to be given this set of data)
# testname=test
# (REQUIRED) the name of this test
# data=rawdata
# raw data for this test
# time=seconds
# time since the epoch in GMT of this test result; if ommitted, current time at time of script run is used
# date
# date that the test was run - this is for discrete graphs
# branch=1.8.1,1.8.0 or 1.9.0
# name of the branch that the build was generated for
# branchid=id
# date of the build
# http://wiki.mozilla.org/MozillaQualityAssurance:Build_Ids
#make sure that we are getting clean data from the user
for strField in ["type", "data", "tbox", "testname", "branch", "branchid"]:
val = form.getfirst(strField)
if not checkString(val):
print "Invalid string arg: ", strField, " '" + val + "'"
sys.exit(500)
globals()[strField] = val
for numField in ["date", "time", "value"]:
val = form.getfirst(numField)
if numField == "time":
numField = "timeval"
if not checkNumber(val):
print "Invalid num arg: ", numField, " '" + val + "'"
sys.exit(500)
globals()[numField] = val
#do some checks to ensure that we are enforcing the requirement rules of the script
if (not type):
type = "continuous"
if (not timeval):
timeval = int(time.time())
if (type == "discrete") and (not date):
print "Bad args, need a valid date"
sys.exit(500)
if (not value) or (not tbox) or (not testname):
print "Bad args"
sys.exit(500)
# Create the DB schema if it doesn't already exist
# XXX can pull out dataset_info.machine and dataset_info.{test,test_type} into two separate tables,
# if we need to.
# figure out our dataset id
setid = -1
while setid == -1:
cur = db.cursor()
cur.execute("SELECT id FROM dataset_info WHERE type <=> ? AND machine <=> ? AND test <=> ? AND test_type <=> ? AND extra_data=? AND branch <=> ? AND date <=> ?",
(type, tbox, testname, "perf", "branch="+branch, branch, date))
res = cur.fetchall()
cur.close()
if len(res) == 0:
db.execute("INSERT INTO dataset_info (type, machine, test, test_type, extra_data, branch, date) VALUES (?,?,?,?,?,?,?)",
(type, tbox, testname, "perf", "branch="+branch, branch, date))
else:
setid = res[0][0]
db.execute("INSERT INTO dataset_values (dataset_id, time, value) VALUES (?,?,?)", (setid, timeval, value))
db.execute("INSERT INTO dataset_branchinfo (dataset_id, time, branchid) VALUES (?,?,?)", (setid, timeval, branchid))
if data and data != "":
db.execute("INSERT INTO dataset_extra_data (dataset_id, time, data) VALUES (?,?,?)", (setid, timeval, data))
cur = db.cursor()
cur.execute("SELECT MIN(time), MAX(time) FROM dataset_values WHERE dataset_id = ?", (setid,))
res = cur.fetchall()
cur.close()
tstart = res[0][0]
tend = res[0][1]
if type == "discrete":
link_str += (link_format % (float(-1), "dgraph.html#name=" + testname + "&", tstart, tend, tstart, tend, setid,))
else:
tstart = 0
link_str += (link_format % (float(-1), "graph.html#",tstart, tend, tstart, tend, setid,))
#this code auto-adds a set of continuous data for each series of discrete data sets - creating an overview of the data
# generated by a given test (matched by machine, test, test_type, extra_data and branch)
# it is not terribly efficient as it updates the tracking number on the continuous set each time a point is added
# to the discrete set. If the efficiency becomes a concern we can re-examine the code - for now it is a good
# solution for generating the secondary, tracking data.
if type == "discrete" :
timeval = date
date = ''
cur = db.cursor()
#throw out the largest value and take the average of the rest
cur.execute("SELECT AVG(value) FROM dataset_values WHERE dataset_id = ? and value != (SELECT MAX(value) from dataset_values where dataset_id = ?)", (setid, setid,))
res = cur.fetchall()
cur.close()
avg = res[0][0]
if avg is not None:
setid = -1
while setid == -1 :
cur = db.cursor()
cur.execute("SELECT id from dataset_info where type <=> ? AND machine <=> ? AND test <=> ? AND test_type <=> ? AND extra_data <=> ? AND branch <=> ? AND date <=> ?",
("continuous", tbox, testname+"_avg", "perf", "branch="+branch, branch, date))
res = cur.fetchall()
cur.close()
if len(res) == 0:
db.execute("INSERT INTO dataset_info (type, machine, test, test_type, extra_data, branch, date) VALUES (?,?,?,?,?,?,?)",
("continuous", tbox, testname+"_avg", "perf", "branch="+branch, branch, date))
else:
setid = res[0][0]
cur = db.cursor()
cur.execute("SELECT * FROM dataset_values WHERE dataset_id=? AND time <=> ?", (setid, timeval))
res = cur.fetchall()
cur.close()
if len(res) == 0:
db.execute("INSERT INTO dataset_values (dataset_id, time, value) VALUES (?,?,?)", (setid, timeval, avg))
db.execute("INSERT INTO dataset_branchinfo (dataset_id, time, branchid) VALUES (?,?,?)", (setid, timeval, branchid))
else:
db.execute("UPDATE dataset_values SET value=? WHERE dataset_id=? AND time <=> ?", (avg, setid, timeval))
db.execute("UPDATE dataset_branchinfo SET branchid=? WHERE dataset_id=? AND time <=> ?", (branchid, setid, timeval))
cur = db.cursor()
cur.execute("SELECT MIN(time), MAX(time) FROM dataset_values WHERE dataset_id = ?", (setid,))
res = cur.fetchall()
cur.close()
tstart = 0
tend = res[0][1]
link_str += (link_format % (float(avg), "graph.html#", tstart, tend, tstart, tend, setid,))
db.commit()
print "Inserted."
print link_str
sys.exit()

View File

@@ -1,20 +0,0 @@
import MySQLdb
from MySQLdb import *
class GraphConnection(MySQLdb.connections.Connection):
def execute(self,query, args):
cur = self.cursor()
result = cur.execute(query,args)
cur.close()
return result
class GraphsCursor(MySQLdb.cursors.Cursor):
def execute(self, query, args=None):
query = query.replace('?','%s')
return MySQLdb.cursors.Cursor.execute(self, query, args)
def connect(*args,**kwargs):
kwargs['cursorclass'] = GraphsCursor
return GraphConnection(*args,**kwargs)

View File

@@ -1,105 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Perf-o-matic-too</title>
<link rel="stylesheet" type="text/css" href="js/graph.css"></link>
<!-- MochiKit -->
<script type="text/javascript" src="js/mochikit/MochiKit.js"></script>
<!-- YUI -->
<script type="text/javascript" src="js/yui/yahoo.js"></script>
<script type="text/javascript" src="js/yui/dom.js"></script>
<script type="text/javascript" src="js/yui/event.js"></script>
<script type="text/javascript" src="js/yui/animation.js"></script>
<script type="text/javascript" src="js/yui/container.js"></script>
<!-- Core -->
<script type="text/javascript" src="js/TinderboxData.js"></script>
<script type="text/javascript" src="js/DataSet.js"></script>
<script type="text/javascript" src="js/GraphCanvas.js"></script>
<script type="text/javascript" src="js/dGraphFormModule.js"></script>
<script type="text/javascript" src="js/graph.js"></script>
<script type="text/javascript" src="js/ResizeGraph.js"></script>
<!-- BonsaiService needs e4x -->
<script type="text/javascript; e4x=1" src="js/BonsaiService.js"></script>
</head>
<body onload="loadingDone(DISCRETE_GRAPH)">
<!--<h1>Graph</h1>-->
<!-- Take your damn divs and floats and clears and shove 'em! -->
<div style="width: 710px; height:20px; margin-left:10px ">
<span id="loading" class="loading"></span>
</div>
<form action="javascript:;">
<table class="graphconfig-no" width="100%">
<tr style="vertical-align: top">
<td class="graphconfig-list">
<div id="graphforms"></div>
</td>
<td class="graphconfig-test-list">
<div id="graphforms-test-list"></div>
</td>
<td class="dgraphconfig">
<!--
<div id="baseline">
<span>Use </span><select id="baselineDropdown"><option value="0">nothing</option></select><span> as a baseline</span><br>
</div>
-->
<br>
<div id="formend">
<input id="graphbutton" type="submit" onclick="onGraph()" value="Graph It!">
<!-- <label for="baseline">No baseline</label><input type="radio" name="baseline" checked onclick="onNoBaseLineClick()"> -->
</br> </br>
<div><a id="linktothis" href="dgraph.html">Link to this graph</a> </div>
</br>
<div><a id="dumptocsv" href="dumpdata.cgi">Dump to csv</a> </div>
</div>
</tr>
</table>
</form>
<!-- small graph -->
<div style="width: 900px; height:20px">
<center><span id="status" class="status"></span></center>
</div>
<div id="container" style="width: 100%">
<!-- these are absolute size, so we wrap them in a div that can overflow -->
<div id="graph-container" style="width: 900px; margin:auto">
<div id="smallgraph-labels-x" style="position: relative; left: 51px; margin-left: 1px; margin-right: 1px; height: 30px; width: 700px"></div>
<div id="smallgraph-labels-y" style="position: relative; left: 0px; top: 0px; float: left; height: 76px; width: 50px;"></div>
<canvas style="clear: left; border: 1px solid #888; padding-top: 1px;" id="smallgraph" height="75" width="650"></canvas>
<br/>
<br/>
<div id="graph-labels-y" style="position: relative; left: 0px; top: 0px; float: left; margin-top: 1px; margin-bottom: 1px; height: 300px; width: 50px;"></div>
<canvas style="clear: left; border: 1px solid #888;" id="graph" height="300" width="650"></canvas>
<div id="graph-labels-x" style="position: relative; left: 50px; margin-left: 1px; margin-right: 1px; height: 50px; width: 700px"></div>
</div>
<div id="graph-label-container" style="float:left;margin-top:30px;">
<span id="graph-label-list" class="graph-label-list-member" align="left"></span>
</div>
</div>
<script>
ResizableBigGraph = new ResizeGraph();
ResizableBigGraph.init('graph');
</script>
</body>
</html>

View File

@@ -1,127 +0,0 @@
#!/usr/bin/env python
import cgitb; cgitb.enable()
import os
import sys
import cgi
import time
import re
import gzip
import minjson as json
import cStringIO
from graphsdb import db
#
# returns a plain text file containing the information for a given dataset in two csv tables
# the first table containing the dataset info (branch, date, etc)
# the second table containing the databaset values
#
# incoming query string:
#
# setid=number
# Where number is a valid setid
#
# starttime=tval
# Start time to return results from, in seconds since GMT epoch
# endtime=tval
# End time, in seconds since GMT epoch
def doError(errCode):
errString = "unknown error"
if errCode == -1:
errString = "bad tinderbox"
elif errCode == -2:
errString = "bad test name"
print "{ resultcode: " + str(errCode) + ", error: '" + errString + "' }"
def esc(val):
delim = '"'
val = delim + str(val).replace(delim, delim + delim) + delim
return val
def dumpData(fo, setid, starttime, endtime):
s1 = ""
s2 = ""
if starttime:
s1 = " AND time >= B." + starttime
if endtime:
s2 = " AND time <= B." + endtime
cur = db.cursor()
setid = ",".join(setid)
fo.write("dataset,machine,branch,test,date\n")
cur.execute("SELECT B.id, B.machine, B.branch, B.test, B.date FROM dataset_info as B WHERE id IN (%s) %s %s ORDER BY id" % (setid, s1, s2,))
for row in cur:
fo.write ('%s,%s,%s,%s,%s\n' % (esc(row[0]), esc(row[1]), esc(row[2]), esc(row[3]), esc(row[4])))
fo.write("dataset,time,value,buildid,data\n")
cur.close()
cur = db.cursor()
#cur.execute("SELECT dataset_id, time, value, branchid, data from ((dataset_values NATURAL JOIN dataset_branchinfo) NATURAL JOIN dataset_extra_data) WHERE dataset_id IN (%s) %s %s ORDER BY dataset_id, time" % (setid, s1, s2,))
cur.execute("SELECT dataset_values.dataset_id, dataset_values.time, dataset_values.value, dataset_branchinfo.branchid, dataset_extra_data.data FROM dataset_values LEFT JOIN dataset_branchinfo ON dataset_values.dataset_id = dataset_branchinfo.dataset_id AND dataset_values.time = dataset_branchinfo.time LEFT JOIN dataset_extra_data ON dataset_values.dataset_id = dataset_extra_data.dataset_id AND dataset_values.time = dataset_extra_data.time WHERE dataset_values.dataset_id IN (%s) %s %s ORDER BY dataset_values.dataset_id, dataset_values.time" % (setid, s1, s2))
for row in cur:
fo.write ('%s,%s,%s,%s,%s\n' % (esc(row[0]), esc(row[1]), esc(row[2]), esc(row[3]), esc(row[4])))
cur.close()
#if var is a number returns a value other than None
def checkNumber(var):
if var is None:
return 1
reNumber = re.compile('^[0-9.]*$')
return reNumber.match(var)
#if var is a string returns a value other than None
def checkString(var):
if var is None:
return 1
reString = re.compile('^[0-9A-Za-z._()\- ]*$')
return reString.match(var)
doGzip = 0
try:
if "gzip" in os.environ["HTTP_ACCEPT_ENCODING"]:
doGzip = 1
except:
pass
form = cgi.FieldStorage()
for numField in ["setid"]:
val = form.getlist(numField)
for v in val:
if not checkNumber(v):
print "Invalid string arg: ", numField, " '" + v + "'"
sys.exit(500)
globals()[numField] = val
for numField in ["starttime", "endtime"]:
val = form.getfirst(numField)
if not checkNumber(val):
print "Invalid string arg: ", numField, " '" + val + "'"
sys.exit(500)
globals()[numField] = val
if not setid:
print "Content-Type: text/plain\n"
print "No data set selected\n"
sys.exit(500)
zbuf = cStringIO.StringIO()
zfile = zbuf
if doGzip == 1:
zfile = gzip.GzipFile(mode = 'wb', fileobj = zbuf, compresslevel = 9)
dumpData(zfile, setid, starttime, endtime)
sys.stdout.write("Content-Type: text/plain\n")
if doGzip == 1:
zfile.close()
sys.stdout.write("Content-Encoding: gzip\n")
sys.stdout.write("\n")
sys.stdout.write(zbuf.getvalue())

View File

@@ -1,105 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Perf-o-matic-too</title>
<link rel="stylesheet" type="text/css" href="js/graph.css"></link>
<!-- MochiKit -->
<script type="text/javascript" src="js/mochikit/MochiKit.js"></script>
<!-- YUI -->
<script type="text/javascript" src="js/yui/yahoo.js"></script>
<script type="text/javascript" src="js/yui/dom.js"></script>
<script type="text/javascript" src="js/yui/event.js"></script>
<script type="text/javascript" src="js/yui/animation.js"></script>
<script type="text/javascript" src="js/yui/container.js"></script>
<!-- Core -->
<script type="text/javascript" src="js/TinderboxData.js"></script>
<script type="text/javascript" src="js/DataSet.js"></script>
<script type="text/javascript" src="js/GraphCanvas.js"></script>
<script type="text/javascript" src="js/edGraphFormModule.js"></script>
<script type="text/javascript" src="js/graph.js"></script>
<script type="text/javascript" src="js/ResizeGraph.js"></script>
<!-- BonsaiService needs e4x -->
<script type="text/javascript; e4x=1" src="js/BonsaiService.js"></script>
</head>
<body onload="loadingDone(DATA_GRAPH)">
<!--<h1>Graph</h1>-->
<!-- Take your damn divs and floats and clears and shove 'em! -->
<div style="width: 710px; height:20px; margin-left:10px ">
<span id="loading" class="loading"></span>
</div>
<form action="javascript:;">
<table class="graphconfig-no" width="100%">
<tr style="vertical-align: top">
<td class="graphconfig-list">
<div id="graphforms"></div>
</td>
<td class="graphconfig-test-list">
<div id="graphforms-test-list"></div>
</td>
<td class="dgraphconfig">
<!--
<div id="baseline">
<span>Use </span><select id="baselineDropdown"><option value="0">nothing</option></select><span> as a baseline</span><br>
</div>
-->
<br>
<div id="formend">
<input id="graphbutton" type="submit" onclick="onGraph()" value="Graph It!">
<!-- <label for="baseline">No baseline</label><input type="radio" name="baseline" checked onclick="onNoBaseLineClick()"> -->
</br> </br>
<div><a id="linktothis" href="edgraph.html">Link to this graph</a> </div>
</br>
<div><a id="dumptocsv" href="dumpdata.cgi">Dump to csv</a> </div>
</div>
</tr>
</table>
</form>
<!-- small graph -->
<div style="width: 900px; height:20px">
<center><span id="status" class="status"></span></center>
</div>
<div id="container" style="width: 100%">
<!-- these are absolute size, so we wrap them in a div that can overflow -->
<div id="graph-container" style="width: 900px; margin:auto">
<div id="smallgraph-labels-x" style="position: relative; left: 51px; margin-left: 1px; margin-right: 1px; height: 30px; width: 700px"></div>
<div id="smallgraph-labels-y" style="position: relative; left: 0px; top: 0px; float: left; height: 76px; width: 50px;"></div>
<canvas style="clear: left; border: 1px solid #888; padding-top: 1px;" id="smallgraph" height="75" width="650"></canvas>
<br/>
<br/>
<div id="graph-labels-y" style="position: relative; left: 0px; top: 0px; float: left; margin-top: 1px; margin-bottom: 1px; height: 300px; width: 50px;"></div>
<canvas style="clear: left; border: 1px solid #888;" id="graph" height="300" width="650"></canvas>
<div id="graph-labels-x" style="position: relative; left: 50px; margin-left: 1px; margin-right: 1px; height: 50px; width: 700px"></div>
</div>
<div id="graph-label-container" style="float:left;margin-top:30px;">
<span id="graph-label-list" class="graph-label-list-member" align="left"></span>
</div>
</div>
<script>
ResizableBigGraph = new ResizeGraph();
ResizableBigGraph.init('graph');
</script>
</body>
</html>

View File

@@ -1,47 +0,0 @@
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
#foreach my $k (keys(%ENV)) {
# print "$k => " . $ENV{$k} . "\n";
#}
my $QS = $ENV{"QUERY_STRING"};
my %query = ();
{
my @qp = split /\&/,$QS;
foreach my $q (@qp) {
my @qp1 = split /=/,$q;
$query{$qp1[0]} = $qp1[1];
}
}
if (defined($query{"setid"})) {
my $testid = $query{"setid"};
print "{ resultcode: 0, results: [";
srand();
my $lv = 200 + rand (100);
foreach my $k (1 .. 500) {
#my $kv = $k;
#my $v = $k;
my $kv = 1148589000 + ($k*60*20);
my $v = $lv;
$lv = $lv + (rand(10) - 5);
print "$kv, $v, ";
}
print "] }";
} else {
print "{ resultcode: 0, results: [
{ id: 1, machine: 'tbox1', test: 'test1', test_type: 'perf', extra_data: null },
{ id: 4, machine: 'tbox2', test: 'test1', test_type: 'perf', extra_data: null },
{ id: 3, machine: 'tbox1', test: 'test3', test_type: 'perf', extra_data: null },
{ id: 6, machine: 'tbox3', test: 'test3', test_type: 'perf', extra_data: null },
{ id: 2, machine: 'tbox1', test: 'test2', test_type: 'perf', extra_data: null },
{ id: 5, machine: 'tbox2', test: 'test2', test_type: 'perf', extra_data: null },
] }";
}

View File

@@ -1,276 +0,0 @@
#!/usr/bin/env python
import cgitb; cgitb.enable()
import os
import sys
import cgi
import time
import re
import gzip
import minjson as json
import cStringIO
from graphsdb import db
#
# All objects are returned in the form:
# {
# resultcode: n,
# ...
# }
#
# The ... is dependant on the result type.
#
# Result codes:
# 0 success
# -1 bad tinderbox
# -2 bad test name
#
# incoming query string:
# tbox=name
# tinderbox name
#
# If only tbox specified, returns array of test names for that tinderbox in data
# If invalid tbox specified, returns error -1
#
# test=testname
# test name
#
# Returns results for that test in .results, in array of [time0, value0, time1, value1, ...]
# Also returns .annotations for that dataset, in array of [time0, string0, time1, string1, ...]
#
# raw=1
# Same as full results, but includes raw data for test in .rawdata, in form [time0, rawdata0, ...]
#
# starttime=tval
# Start time to return results from, in seconds since GMT epoch
# endtime=tval
# End time, in seconds since GMT epoch
#
# getlist=1
# To be combined with branch, machine and testname
# Returns a list of distinct branches, machines or testnames in the database
#
# if neither getlist nor setid are found in the query string the returned results will be a list
# of tests, limited by a given datelimit, branch, machine and testname
# ie) dgetdata?datelimit=1&branch=1.8 will return all tests in the database that are not older than a day and that
# were run on the 1.8 branch
def doError(errCode):
errString = "unknown error"
if errCode == -1:
errString = "bad tinderbox"
elif errCode == -2:
errString = "bad test name"
print "{ resultcode: " + str(errCode) + ", error: '" + errString + "' }"
def doGetList(fo, type, branch, machine, testname):
results = []
s1 = ""
if branch:
s1 = "SELECT DISTINCT branch FROM dataset_info"
if machine:
s1 = "SELECT DISTINCT machine FROM dataset_info"
if testname:
s1 = "SELECT DISTINCT test FROM dataset_info"
cur = db.cursor()
cur.execute(s1 + " WHERE type = ?", (type,))
for row in cur:
results.append({ "value": row[0] })
cur.close()
fo.write(json.write( {"resultcode": 0, "results": results} ))
def doListTests(fo, type, datelimit, branch, machine, testname, graphby):
results = []
s1 = ""
# FIXME: This could be vulnerable to SQL injection! Although it looks like checkstring should catch bad strings.
if branch:
s1 += " AND branch = '" + branch + "' "
if machine:
s1 += " AND machine = '" + machine + "' "
if testname:
s1 += " AND test = '" + testname + "' "
cur = db.cursor()
if graphby and graphby == 'bydata':
cur.execute("SELECT id, machine, test, test_type, dataset_extra_data.data, extra_data, branch FROM dataset_extra_data JOIN dataset_info ON dataset_extra_data.dataset_id = dataset_info.id WHERE type = ? AND test_type != ? and (date >= ?) " + s1 +" GROUP BY machine,test,test_type,dataset_extra_data.data, extra_data, branch", (type, "baseline", datelimit))
else:
cur.execute("SELECT id, machine, test, test_type, date, extra_data, branch FROM dataset_info WHERE type = ? AND test_type != ? and (date >= ?)" + s1, (type, "baseline", datelimit))
for row in cur:
if graphby and graphby == 'bydata':
results.append( {"id": row[0],
"machine": row[1],
"test": row[2],
"test_type": row[3],
"data": row[4],
"extra_data": row[5],
"branch": row[6]})
else:
results.append( {"id": row[0],
"machine": row[1],
"test": row[2],
"test_type": row[3],
"date": row[4],
"extra_data": row[5],
"branch": row[6]})
cur.close()
fo.write (json.write( {"resultcode": 0, "results": results} ))
def getByDataResults(cur,setid,extradata,starttime,endtime):
s1 = ""
s2 = ""
cur.execute("""
SELECT dataset_info.date,avg(dataset_values.value)
FROM dataset_info
JOIN dataset_extra_data
ON dataset_extra_data.dataset_id = dataset_info.id
JOIN dataset_values
ON dataset_extra_data.time = dataset_values.time
AND dataset_info.id = dataset_values.dataset_id
WHERE
(dataset_info.machine,dataset_info.test,dataset_info.test_type,dataset_info.extra_data,dataset_info.branch) = (SELECT machine,test,test_type,extra_data,branch from dataset_info where id = ? limit 1)
AND dataset_extra_data.data = ?
GROUP BY dataset_info.date ORDER BY dataset_info.date
""", (setid,extradata))
def doSendResults(fo, setid, starttime, endtime, raw, graphby, extradata=None):
s1 = ""
s2 = ""
if starttime:
s1 = " AND time >= " + starttime
if endtime:
s2 = " AND time <= " + endtime
fo.write ("{ resultcode: 0,")
cur = db.cursor()
if not graphby or graphby == "time":
cur.execute("SELECT time, value FROM dataset_values WHERE dataset_id = ? " + s1 + s2 + " ORDER BY time", (setid,))
else:
getByDataResults(cur,setid, extradata,starttime,endtime)
fo.write ("results: [")
for row in cur:
if row[1] == 'nan':
continue
fo.write ("%s,%s," % (row[0], row[1]))
cur.close()
fo.write ("],")
cur = db.cursor()
cur.execute("SELECT time, value FROM annotations WHERE dataset_id = ? " + s1 + s2 + " ORDER BY time", (setid,))
fo.write ("annotations: [")
for row in cur:
fo.write("%s,'%s'," % (row[0], row[1]))
cur.close()
fo.write ("],")
cur = db.cursor()
cur.execute("SELECT test FROM dataset_info WHERE id = ?", (setid,))
row = cur.fetchone()
test_name = row[0]
cur.execute("SELECT id, extra_data FROM dataset_info WHERE test = ? and test_type = ?", (test_name, "baseline"))
baselines = cur.fetchall()
fo.write ("baselines: {")
for baseline in baselines:
cur.execute("SELECT value FROM dataset_values WHERE dataset_id = ? LIMIT 1", (baseline[0],))
row = cur.fetchone()
fo.write("'%s': '%s'," % (baseline[1], row[0]))
fo.write("},")
cur.close()
if raw:
cur = db.cursor()
cur.execute("SELECT time, data FROM dataset_extra_data WHERE dataset_id = ? " + s1 + s2 + " ORDER BY time", (setid,))
fo.write ("rawdata: [")
for row in cur:
blob = row[1]
if "\\" in blob:
blob = blob.replace("\\", "\\\\")
if "'" in blob:
blob = blob.replace("'", "\\'")
fo.write("%s,'%s'," % (row[0], blob))
cur.close()
fo.write ("],")
cur = db.cursor()
cur.execute("SELECT avg(value), max(value), min(value) from dataset_values where dataset_id = ? " + s1 + s2 + " GROUP BY dataset_id", (setid,))
fo.write("stats: [")
for row in cur:
fo.write("%s, %s, %s," %(row[0], row[1], row[2]))
cur.close()
fo.write("],")
fo.write ("}")
#if var is a number returns a value other than None
def checkNumber(var):
if var is None:
return 1
reNumber = re.compile('^[0-9.]*$')
return reNumber.match(var)
#if var is a string returns a value other than None
def checkString(var):
if var is None:
return 1
reString = re.compile('^[0-9A-Za-z._()\- ]*$')
return reString.match(var)
doGzip = 0
try:
if "gzip" in os.environ["HTTP_ACCEPT_ENCODING"]:
doGzip = 1
except:
pass
form = cgi.FieldStorage()
#make sure that we are getting clean data from the user
for strField in ["type", "machine", "branch", "test", "graphby","extradata"]:
val = form.getfirst(strField)
if strField == "test":
strField = "testname"
if not checkString(val):
print "Invalid string arg: ", strField, " '" + val + "'"
sys.exit(500)
globals()[strField] = val
for numField in ["setid", "raw", "starttime", "endtime", "datelimit", "getlist"]:
val = form.getfirst(numField)
if not checkNumber(val):
print "Invalid string arg: ", numField, " '" + val + "'"
sys.exit(500)
globals()[numField] = val
if not datelimit:
datelimit = 0
zbuf = cStringIO.StringIO()
zfile = zbuf
if doGzip == 1:
zfile = gzip.GzipFile(mode = 'wb', fileobj = zbuf, compresslevel = 5)
if not setid and not getlist:
doListTests(zfile, type, datelimit, branch, machine, testname, graphby)
elif not getlist:
doSendResults(zfile, setid, starttime, endtime, raw, graphby,extradata)
else:
doGetList(zfile, type, branch, machine, testname)
sys.stdout.write("Content-Type: text/plain\n")
if doGzip == 1:
zfile.close()
sys.stdout.write("Content-Encoding: gzip\n")
sys.stdout.write("\n")
sys.stdout.write(zbuf.getvalue())

View File

@@ -1,115 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Perf-o-matic</title>
<link rel="stylesheet" type="text/css" href="js/graph.css">
<!-- MochiKit -->
<script type="text/javascript" src="js/mochikit/MochiKit.js"></script>
<!-- YUI -->
<script type="text/javascript" src="js/yui/yahoo.js"></script>
<script type="text/javascript" src="js/yui/dom.js"></script>
<script type="text/javascript" src="js/yui/event.js"></script>
<script type="text/javascript" src="js/yui/animation.js"></script>
<script type="text/javascript" src="js/yui/container.js"></script>
<!-- Core -->
<script type="text/javascript" src="js/TinderboxData.js"></script>
<script type="text/javascript" src="js/DataSet.js"></script>
<script type="text/javascript" src="js/GraphCanvas.js"></script>
<script type="text/javascript" src="js/GraphFormModule.js"></script>
<script type="text/javascript" src="js/graph.js"></script>
<script type="text/javascript" src="js/ResizeGraph.js"></script>
<!-- BonsaiService needs e4x -->
<script type="text/javascript; e4x=1" src="js/BonsaiService.js"></script>
</head>
<body onload="loadingDone(CONTINUOUS_GRAPH)">
<!--<h1>Graph</h1>-->
<!-- Take your damn divs and floats and clears and shove 'em! -->
<div style="width: 710px; height:20px; margin-left:10px ">
<span id="loading" class="loading"></span>
</div>
<form action="javascript:;">
<table class="graphconfig-no" width="100%">
<tr style="vertical-align: top">
<td class="graphconfig">
<table>
<tr style="vertical-align: top;">
<td>Show</td>
<td>
<input id="load-all-radio" type="radio" name="dataload" onclick="onDataLoadChanged()" checked>
<label>all data</label><br>
<input id="load-days-radio" type="radio" name="dataload" onclick="onDataLoadChanged()">
<label>previous</label> <input type="text" value="30" id="load-days-entry" size="3" onchange="onDataLoadChanged()"> <label>days</label>
</td>
</tr>
</table>
<div id="baseline">
<span>Use </span><select id="baselineDropdown"><option value="0">nothing</option></select><span> as a baseline</span><br>
</div>
<br>
<div id="formend">
<input type="submit" onclick="onGraph()" value="Graph It!">
</br> </br>
<!-- <label for="baseline">No baseline</label><input type="radio" name="baseline" checked onclick="onNoBaseLineClick()"> -->
<a id="linktothis" href="graph.html">Link to this graph</a>
</br>
<div><a id="dumptocsv" href="dumpdata.cgi">Dump to csv</a> </div>
</div>
<br>
<input style="display:none" id="bonsaibutton" type="button" onclick="onUpdateBonsai()" value="Refresh Bonsai Data">
</td>
<td class="graphconfig-list">
<div id="graphforms"></div>
<div id="addone">
<img src="js/img/plus.png" class="plusminus" onclick="addGraphForm()" alt="Plus">
</div>
</td>
</tr>
</table>
</form>
<!-- small graph -->
<div style="width: 900px; height:20px">
<center><span id="status" class="status"></span></center>
</div>
<!-- these are absolute size, so we wrap them in a div that can overflow -->
<div id="graph-container" style="margin:auto; width:900px;">
<div id="smallgraph-labels-x" style="position: relative; left: 51px; margin-left: 1px; margin-right: 1px; height: 30px; width: 700px"></div>
<div id="smallgraph-labels-y" style="position: relative; left: 0px; top: 0px; float: left; height: 76px; width: 50px;"></div>
<canvas style="clear: left; border: 1px solid #888; padding-top: 1px;" id="smallgraph" height="75" width="700"></canvas>
<br/>
<br/>
<div id="graph-labels-y" style="position: relative; left: 0px; top: 0px; float: left; margin-top: 1px; margin-bottom: 1px; height: 300px; width: 50px;"></div>
<canvas style="clear: left; border: 1px solid #888;" id="graph" height="300" width="700"></canvas>
<div id="graph-labels-x" style="position: relative; left: 50px; margin-left: 1px; margin-right: 1px; height: 50px; width: 700px"></div>
</div>
<script>
ResizableBigGraph = new ResizeGraph();
ResizableBigGraph.init('graph');
</script>
</body>
</html>

View File

@@ -1,6 +0,0 @@
from pysqlite2 import dbapi2 as sqlite
from databases import mysql as MySQLdb
db = MySQLdb.connect("localhost","o","o","o_graphs")

View File

@@ -1,111 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is new-graph code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function BonsaiService() {
}
BonsaiService.prototype = {
// this could cache stuff, so that we only have to request the bookend data
// if we want a wider range, but it's probably not worth it for now.
//
// The callback is called with an object argument which contains:
// {
// times: [ t1, t2, t3, .. ],
// who: [ w1, w2, w3, .. ],
// log: [ l1, l2, l3, .. ],
// files: [ [ r11, f11, r12, f12, r13, f13, .. ], [ r21, f21, r22, f22, r23, f23, .. ], .. ]
// }
//
// r = revision number, as a string, e.g. "1.15"
// f = file, e.g. "mozilla/widget/foo.cpp"
//
// arg1 = callback, arg2 = null
// arg1 = includeFiles, arg2 = callback
requestCheckinsBetween: function (startDate, endDate, arg1, arg2) {
var includeFiles = arg1;
var callback = arg2;
if (arg2 == null) {
callback = arg1;
includeFiles = null;
}
var queryargs = {
treeid: "default",
module: "SeaMonkeyAll",
branch: "HEAD",
mindate: startDate,
maxdate: endDate
};
if (!includeFiles)
queryargs.xml_nofiles = "1";
log ("bonsai request: ", queryString(queryargs));
doSimpleXMLHttpRequest (bonsaicgi, queryargs)
.addCallbacks(
function (obj) {
var result = { times: [], who: [], comment: [], files: null };
if (includeFiles)
result.files = [];
// strip out the xml declaration
var s = obj.responseText.replace(/<\?xml version="1.0"\?>/, "");
var bq = new XML(s);
for (var i = 0; i < bq.ci.length(); i++) {
var ci = bq.ci[i];
result.times.push(ci.@date);
result.who.push(ci.@who);
result.comment.push(ci.log.text().toString());
if (includeFiles) {
var files = [];
for (var j = 0; j < ci.files.f.length(); j++) {
var f = ci.files.f[j];
files.push(f.@rev);
files.push(f.text().toString());
}
result.files.push(files);
}
}
callback.call (window, result);
},
function () { alert ("Error talking to bonsai"); });
},
};

View File

@@ -1,273 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is new-graph code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function TimeDataSet(data) {
this.data = data;
}
TimeDataSet.prototype = {
data: null,
indicesForTimeRange: function (startTime, endTime) {
var startIndex = -1;
var endIndex = -1;
if (this.data[0] > endTime ||
this.data[this.data.length-2] < startTime)
return null;
for (var i = 0; i < this.data.length/2; i++) {
if (startIndex == -1 && this.data[i*2] >= startTime) {
startIndex = i;
} else if (startIndex != -1 && this.data[i*2] > endTime) {
endIndex = i;
return [startIndex, endIndex];
}
}
endIndex = (this.data.length/2) - 1;
return [startIndex, endIndex];
},
};
function TimeValueDataSet(data, color) {
this.data = data;
this.firstTime = data[0];
if (data.length > 2)
this.lastTime = data[data.length-2];
else
this.lastTime = data[0];
if (color) {
this.color = color;
} else {
this.color = "#000000";
}
log ("new tds:", this.firstTime, this.lastTime);
this.relativeToSets = new Array();
}
TimeValueDataSet.prototype = {
__proto__: new TimeDataSet(),
firstTime: 0,
lastTime: 0,
data: null, // array: [time0, value0, time1, value1, ...]
relativeTo: null,
color: "black",
title: '',
minMaxValueForTimeRange: function (startTime, endTime) {
var minValue = Number.POSITIVE_INFINITY;
var maxValue = Number.NEGATIVE_INFINITY;
for (var i = 0; i < this.data.length/2; i++) {
var t = this.data[i*2];
if (t >= startTime && t <= endTime) {
var v = this.data[i*2+1];
if (v < minValue)
minValue = v;
if (v > maxValue)
maxValue = v;
}
}
return [minValue, maxValue];
},
// create a new ds that's the average of this ds's values,
// with the average sampled over the given interval,
// at every avginterval/2
createAverage: function (avginterval) {
if (avginterval <= 0)
throw "avginterval <= 0";
if (this.averageDataSet != null &&
this.averageInterval == avginterval)
{
return this.averageDataSet;
}
var newdata = [];
var time0 = this.data[0];
var val0 = 0;
var count0 = 0;
var time1 = time0 + avginterval/2;
var val1 = 0;
var count1 = 0;
var ns = this.data.length/2;
for (var i = 0; i < ns; i++) {
var t = this.data[i*2];
var v = this.data[i*2+1];
if (t > time0+avginterval) {
newdata.push(time0 + avginterval/2);
newdata.push(count0 ? (val0 / count0) : 0);
// catch up
while (time1 < t) {
time0 += avginterval/2;
time1 = time0;
}
time0 = time1;
val0 = val1;
count0 = count1;
time1 = time0 + avginterval/2;
val1 = 0;
count1 = 0;
}
val0 += v;
count0++;
if (t > time1) {
val1 += v;
count1++;
}
}
if (count0 > 0) {
newdata.push(time0 + avginterval/2);
newdata.push(val0 / count0);
}
var newds = new TimeValueDataSet(newdata, lighterColor(this.color));
newds.averageOf = this;
this.averageDataSet = newds;
this.averageInterval = avginterval;
return newds;
},
// create a new dataset with this ds's data,
// relative to otherds
createRelativeTo: function (otherds, absval) {
if (otherds == this) {
log("error, same ds");
return null;
}
for each (var s in this.relativeToSets) {
if (s.relativeTo == otherds)
return s;
}
var firstTime = this.firstTime;
var lastTime = this.lastTime;
if (otherds.firstTime > firstTime)
firstTime = otherds.firstTime;
if (otherds.lastTime < lastTime)
lastTime = otherds.lastTime;
var newdata = [];
var thisidx = this.indicesForTimeRange (firstTime, lastTime);
var otheridx = this.indicesForTimeRange (firstTime, lastTime);
var o = otheridx[0];
var ov, ov1, ov2, ot1, ot2;
for (var i = thisidx[0]; i < thisidx[1]; i++) {
var t = this.data[i*2];
var tv = this.data[i*2+1];
while (otherds.data[o*2] < t)
o++;
ot1 = otherds.data[o*2];
ov1 = otherds.data[o*2+1];
if (o < otheridx[1]) {
ot2 = otherds.data[o*2+2];
ov2 = otherds.data[o*2+3];
} else {
ot2 = ot1;
ov2 = ov1;
}
var d = (t-ot1)/(ot2-ot1);
ov = (1-d) * ov1 + d * ov2;
newdata.push(t);
//log ("i", i, "tv", tv, "ov", ov, "t", t, "ot1", ot1, "ot2", ot2, "ov1", ov1, "ov2", ov2);
//log ("i", i, "tv", tv, "ov", ov, "tv/ov", tv/ov, "ov/tv", ov/tv);
if (absval) {
newdata.push(tv-ov);
} else {
if (tv > ov)
newdata.push((tv/ov) - 1);
else
newdata.push(-((ov/tv) - 1));
}
}
var newds = new TimeValueDataSet(newdata, this.color);
newds.relativeTo = otherds;
this.relativeToSets.push(newds);
return newds;
},
};
function TimeStringDataSet(data) {
this.data = data;
}
TimeStringDataSet.prototype = {
__proto__: new TimeDataSet(),
data: null,
onDataSetChanged: null,
init: function () {
},
addString: function (time, string) {
},
removeStringAt: function (index) {
},
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,192 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is new-graph code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var GraphFormModules = [];
var GraphFormModuleCount = 0;
function GraphFormModule(userConfig) {
GraphFormModuleCount++;
this.__proto__.__proto__.constructor.call(this, "graphForm" + GraphFormModuleCount, userConfig);
}
GraphFormModule.prototype = {
__proto__: new YAHOO.widget.Module(),
imageRoot: "",
testId: null,
baseline: false,
average: false,
color: "#000000",
onLoadingDone : new YAHOO.util.CustomEvent("onloadingdone"),
onLoading : new YAHOO.util.CustomEvent("onloading"),
init: function (el, userConfig) {
var self = this;
this.__proto__.__proto__.init.call(this, el/*, userConfig*/);
this.cfg = new YAHOO.util.Config(this);
this.cfg.addProperty("testid", { suppressEvent: true });
this.cfg.addProperty("average", { suppressEvent: true });
this.cfg.addProperty("baseline", { suppressEvent: true });
if (userConfig)
this.cfg.applyConfig(userConfig, true);
var form, td, el;
form = new DIV({ class: "graphform-line" });
td = new SPAN();
/*
el = new IMG({ src: "js/img/plus.png", class: "plusminus",
onclick: function(event) { addGraphForm(); } });
td.appendChild(el);
*/
el = new IMG({ src: "js/img/minus.png", class: "plusminus",
onclick: function(event) { self.remove(); } });
td.appendChild(el);
form.appendChild(td);
td = new SPAN();
el = new DIV({ id: "whee", style: "display: inline; border: 1px solid black; height: 15; " +
"padding-right: 15; vertical-align: middle; margin: 3px;" });
this.colorDiv = el;
td.appendChild(el);
form.appendChild(td);
td = new SPAN();
el = new SELECT({ name: "testname",
class: "testname",
onchange: function(event) { self.onChangeTest(); } });
this.testSelect = el;
td.appendChild(el);
form.appendChild(td);
td = new SPAN({ style: "padding-left: 10px;"});
appendChildNodes(td, "Average:");
el = new INPUT({ name: "average",
type: "checkbox",
onchange: function(event) { self.average = event.target.checked; } });
this.averageCheckbox = el;
td.appendChild(el);
form.appendChild(td);
this.setBody (form);
var forceTestId = null;
this.average = false;
if (userConfig) {
forceTestId = this.cfg.getProperty("testid");
avg = this.cfg.getProperty("average");
baseline = this.cfg.getProperty("baseline");
if (avg == 1) {
this.averageCheckbox.checked = true;
this.average = true;
}
if (baseline == 1)
this.onBaseLineRadioClick();
}
Tinderbox.requestTestList(function (tests) {
var opts = [];
// let's sort by machine name
var sortedTests = Array.sort(tests, function (a, b) {
if (a.machine < b.machine) return -1;
if (a.machine > b.machine) return 1;
if (a.test < b.test) return -1;
if (a.test > b.test) return 1;
if (a.test_type < b.test_type) return -1;
if (a.test_type > b.test_type) return 1;
return 0;
});
for each (var test in sortedTests) {
var tstr = test.machine + " - " + test.test + " - " + test.branch;
opts.push(new OPTION({ value: test.id }, tstr));
}
replaceChildNodes(self.testSelect, opts);
if (forceTestId != null) {
self.testSelect.value = forceTestId;
} else {
self.testSelect.value = sortedTests[0].id;
}
setTimeout(function () { self.onChangeTest(forceTestId); }, 0);
self.onLoadingDone.fire();
});
GraphFormModules.push(this);
},
getQueryString: function (prefix) {
return prefix + "tid=" + this.testId + "&" + prefix + "bl=" + (this.baseline ? "1" : "0")
+ "&" + prefix + "avg=" + (this.average? "1" : "0");
},
getDumpString: function () {
return "setid=" + this.testId;
},
onChangeTest: function (forceTestId) {
this.testId = this.testSelect.value;
},
onBaseLineRadioClick: function () {
GraphFormModules.forEach(function (g) { g.baseline = false; });
this.baseline = true;
},
setColor: function (newcolor) {
this.color = newcolor;
this.colorDiv.style.backgroundColor = colorToRgbString(newcolor);
},
remove: function () {
if (GraphFormModules.length == 1)
return;
var nf = [];
for each (var f in GraphFormModules) {
if (f != this)
nf.push(f);
}
GraphFormModules = nf;
this.destroy();
},
};

View File

@@ -1,161 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is new-graph code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeremiah Orem <oremj@oremj.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function ResizeGraph() {
}
ResizeGraph.prototype = {
margin_right: 25,
margin_bottom: 25,
resizing: false,
active: false,
element: null,
handle: null,
startX: null,
startY: null,
startHeight: null,
startWidth: null,
startTop: null,
startLeft: null,
currentDirection: '',
init: function(elem) {
this.handle = elem;
this.element = getElement(elem);
connect(this.handle,'onmousedown',this, 'mouseDownFunc');
connect(document,'onmouseup',this, 'mouseUpFunc');
connect(this.handle,'onmousemove',this, 'mouseMoveFunc');
connect(document,'onmousemove',this, 'updateElement');
},
directions: function(e) {
var pointer = e.mouse();
var graphPosition = elementPosition(this.handle);
var dimensions = elementDimensions(this.handle);
var dir = '';
if ( pointer.page.x > (graphPosition.x + dimensions.w) - this.margin_right ) {
dir= "e";
}
else if ( pointer.page.y > (graphPosition.y + dimensions.h) - this.margin_bottom ) {
dir = "s";
}
return dir;
},
draw: function(e) {
var pointer = [e.mouse().page.x, e.mouse().page.y];
var style = this.element.style;
if (this.currentDirection.indexOf('s') != -1) {
var newHeight = this.startHeight + pointer[1] - this.startY;
if (newHeight > this.margin_bottom) {
style.height = newHeight + "px";
this.element.height = newHeight;
}
}
if (this.currentDirection.indexOf('e') != -1) {
var newWidth = this.startWidth + pointer[0] - this.startX;
if (newWidth > this.margin_right) {
if (newWidth > 900) {
getElement('graph-container').style.width = (newWidth + 200) + "px";
}
style.width = newWidth + "px";
this.element.width = newWidth;
}
}
},
mouseDownFunc: function(e)
{
var dir = this.directions(e);
pointer = e.mouse();
if (dir.length > 0 ) {
this.active = true;
var dimensions = elementDimensions(this.handle);
var graphPosition = elementPosition(this.handle);
this.startTop = graphPosition.y;
this.startLeft = graphPosition.x;
this.startHeight = dimensions.h;
this.startWidth = dimensions.w;
this.startX = pointer.page.x + document.body.scrollLeft + document.documentElement.scrollLeft;
this.startY = pointer.page.y + document.body.scrollLeft + document.documentElement.scrollLeft;
this.currentDirection = dir;
e.stop();
}
},
mouseMoveFunc: function(e)
{
pointer = e.mouse();
graphPosition = elementPosition(this.handle);
dimensions = elementDimensions(this.handle);
dir = this.directions(e);
if(dir.length > 0) {
getElement(this.handle).style.cursor = dir + "-resize";
}
else {
getElement(this.handle).style.cursor = '';
}
},
updateElement: function(e)
{
if( this.active ) {
if ( ! this.resizing ) {
var style = getElement(this.handle).style;
this.resizing = true;
style.position = "relative";
}
this.draw(e);
e.stop()
return false;
}
},
finishResize: function(e,success) {
this.active = false;
this.resizing = false;
},
mouseUpFunc: function(e)
{
if(this.active && this.resizing) {
this.finishResize(e,true);
BigPerfGraph.resize();
e.stop();
}
this.active = false;
this.resizing = false;
},
};

View File

@@ -1,417 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is new-graph code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com> (Original Author)
* Alice Nodelman <anodelman@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//const getdatacgi = "getdata-fake.cgi?";
//const getdatacgi = "http://localhost:9050/getdata.cgi?";
const getdatacgi = "getdata.cgi?"
function checkErrorReturn(obj) {
if (!obj || obj.resultcode != 0) {
alert ("Error: " + (obj ? (obj.error + "(" + obj.resultcode + ")") : "(nil)"));
return false;
}
return true;
}
function TinderboxData() {
this.onTestListAvailable = new YAHOO.util.CustomEvent("testlistavailable");
this.onDataSetAvailable = new YAHOO.util.CustomEvent("datasetavailable");
this.testList = null;
this.testData = {};
}
TinderboxData.prototype = {
testList: null,
testData: null,
onTestListAvailable: null,
onDataSetAvailable: null,
defaultLoadRange: null,
raw: 0,
init: function () {
var self = this;
//netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
loadJSONDoc(getdatacgi + "type=continuous")
.addCallbacks(
function (obj) {
if (!checkErrorReturn(obj)) return;
self.testList = obj.results;
//log("default test list" + self.testList);
self.onTestListAvailable.fire(self.testList);
},
function () {alert ("Error talking to " + getdatacgi + ""); });
},
requestTestList: function (callback) {
//log("requestTestList default");
var self = this;
if (this.testList != null) {
callback.call (window, this.testList);
} else {
var cb =
function (type, args, obj) {
self.onTestListAvailable.unsubscribe(cb, obj);
obj.call (window, args[0]);
};
this.onTestListAvailable.subscribe (cb, callback);
}
},
// arg1 = startTime, arg2 = endTime, arg3 = callback
// arg1 = callback, arg2/arg3 == null
requestDataSetFor: function (testId, arg1, arg2, arg3) {
var self = this;
var startTime = arg1;
var endTime = arg2;
var callback = arg3;
if (arg1 && arg2 == null && arg3 == null) {
callback = arg1;
if (this.defaultLoadRange) {
startTime = this.defaultLoadRange[0];
endTime = this.defaultLoadRange[1];
//log ("load range using default", startTime, endTime);
} else {
startTime = null;
endTime = null;
}
}
if (testId in this.testData) {
var ds = this.testData[testId];
//log ("Can maybe use cached?");
if ((ds.requestedFirstTime == null && ds.requestedLastTime == null) ||
(ds.requestedFirstTime <= startTime &&
ds.requestedLastTime >= endTime))
{
//log ("Using cached ds");
callback.call (window, testId, ds);
return;
}
// this can be optimized, if we request just the bookend bits,
// but that's overkill
if (ds.firstTime < startTime)
startTime = ds.firstTime;
if (ds.lastTime > endTime)
endTime = ds.lastTime;
}
var cb =
function (type, args, obj) {
if (args[0] != testId ||
args[2] > startTime ||
args[3] < endTime)
{
// not useful for us; there's another
// outstanding request for our time range, so wait for that
return;
}
self.onDataSetAvailable.unsubscribe(cb, obj);
obj.call (window, args[0], args[1]);
};
this.onDataSetAvailable.subscribe (cb, callback);
//netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
var reqstr = getdatacgi + "setid=" + testId;
if (startTime)
reqstr += "&starttime=" + startTime;
if (endTime)
reqstr += "&endtime=" + endTime;
//raw data is the extra_data column
if (this.raw)
reqstr += "&raw=1";
//log (reqstr);
loadJSONDoc(reqstr)
.addCallbacks(
function (obj) {
if (!checkErrorReturn(obj)) return;
var ds = new TimeValueDataSet(obj.results);
//this is the the case of a discrete graph - where the entire test run is always requested
//so the start and end points are the first and last entries in the returned data set
if (!startTime && !endTime) {
startTime = ds.data[0];
endTime = ds.data[ds.data.length -2];
}
ds.requestedFirstTime = startTime;
ds.requestedLastTime = endTime;
self.testData[testId] = ds;
if (obj.annotations)
ds.annotations = new TimeStringDataSet(obj.annotations);
if (obj.baselines)
ds.baselines = obj.baselines;
if (obj.rawdata)
ds.rawdata = obj.rawdata;
if (obj.stats)
ds.stats = obj.stats;
self.onDataSetAvailable.fire(testId, ds, startTime, endTime);
},
function (obj) {alert ("Error talking to " + getdatacgi + " (" + obj + ")"); log (obj.stack); });
},
clearValueDataSets: function () {
//log ("clearvalueDatasets");
this.tinderboxTestData = {};
},
};
function DiscreteTinderboxData() {
};
DiscreteTinderboxData.prototype = {
__proto__: new TinderboxData(),
init: function () {
},
requestTestList: function (limitDate, branch, machine, testname, callback) {
var self = this;
//netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
var limiters = "";
var tDate = 0;
if (limitDate != null) {
tDate = new Date().getTime();
tDate -= limitDate * 86400 * 1000;
//log ("returning test lists greater than this date" + (new Date(tDate)).toGMTString());
//TODO hack hack hack
tDate = Math.floor(tDate/1000)
}
if (branch != null) limiters += "&branch=" + branch;
if (machine != null) limiters += "&machine=" + machine;
if (testname != null) limiters += "&test=" + testname;
//log("drequestTestList: " + getdatacgi + "type=discrete&datelimit=" + tDate + limiters);
loadJSONDoc(getdatacgi + "type=discrete&datelimit=" + tDate + limiters)
.addCallbacks(
function (obj) {
if (!checkErrorReturn(obj)) return;
self.testList = obj.results;
//log ("testlist: " + self.testList);
callback.call(window, self.testList);
},
function () {alert ("requestTestList: Error talking to " + getdatacgi + ""); });
},
requestSearchList: function (branch, machine, testname, callback) {
var self = this;
limiters = "";
if (branch != null) limiters += "&branch=" + branch;
if (machine != null) limiters += "&machine=" + machine;
if (testname != null) limiters += "&test=" + testname;
//log(getdatacgi + "getlist=1&type=discrete" + limiters);
loadJSONDoc(getdatacgi + "getlist=1&type=discrete" + limiters)
.addCallbacks(
function (obj) {
if (!checkErrorReturn(obj)) return;
callback.call(window, obj.results);
},
function () {alert ("requestSearchList: Error talking to " + getdatacgi); });
},
};
function ExtraDataTinderboxData() {
};
ExtraDataTinderboxData.prototype = {
__proto__: new TinderboxData(),
init: function () {
},
requestTestList: function (limitDate, branch, machine, testname, callback) {
var self = this;
//netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
var limiters = "";
var tDate = 0;
if (limitDate != null) {
tDate = new Date().getTime();
tDate -= limitDate * 86400 * 1000;
//log ("returning test lists greater than this date" + (new Date(tDate)).toGMTString());
//TODO hack hack hack
tDate = Math.floor(tDate/1000)
}
if (branch != null) limiters += "&branch=" + branch;
if (machine != null) limiters += "&machine=" + machine;
if (testname != null) limiters += "&test=" + testname;
//log("drequestTestList: " + getdatacgi + "type=discrete&datelimit=" + tDate + limiters);
loadJSONDoc(getdatacgi + "type=discrete&graphby=bydata&datelimit=" + tDate + limiters)
.addCallbacks(
function (obj) {
if (!checkErrorReturn(obj)) return;
self.testList = obj.results;
//log ("testlist: " + self.testList);
callback.call(window, self.testList);
},
function () {alert ("requestTestList: Error talking to " + getdatacgi + ""); });
},
requestSearchList: function (branch, machine, testname, callback) {
var self = this;
limiters = "";
if (branch != null) limiters += "&branch=" + branch;
if (machine != null) limiters += "&machine=" + machine;
if (testname != null) limiters += "&test=" + testname;
//log(getdatacgi + "getlist=1&type=discrete" + limiters);
loadJSONDoc(getdatacgi + "getlist=1&type=discrete" + limiters)
.addCallbacks(
function (obj) {
if (!checkErrorReturn(obj)) return;
callback.call(window, obj.results);
},
function () {alert ("requestSearchList: Error talking to " + getdatacgi); });
},
// arg1 = startTime, arg2 = endTime, arg3 = callback
// arg1 = callback, arg2/arg3 == null
requestDataSetFor: function (testId, arg1, arg2, arg3) {
var self = this;
var startTime = arg1;
var endTime = arg2;
var callback = arg3;
var tempArray = new Array();
tempArray = testId.split("_",2);
testId = tempArray[0];
var extradata = tempArray[1];
if (arg1 && arg2 == null && arg3 == null) {
callback = arg1;
if (this.defaultLoadRange) {
startTime = this.defaultLoadRange[0];
endTime = this.defaultLoadRange[1];
//log ("load range using default", startTime, endTime);
} else {
startTime = null;
endTime = null;
}
}
if (testId in this.testData) {
var ds = this.testData[testId];
//log ("Can maybe use cached?");
if ((ds.requestedFirstTime == null && ds.requestedLastTime == null) ||
(ds.requestedFirstTime <= startTime &&
ds.requestedLastTime >= endTime))
{
//log ("Using cached ds");
callback.call (window, testId, ds);
return;
}
// this can be optimized, if we request just the bookend bits,
// but that's overkill
if (ds.firstTime < startTime)
startTime = ds.firstTime;
if (ds.lastTime > endTime)
endTime = ds.lastTime;
}
var cb =
function (type, args, obj) {
if (args[0] != testId ||
args[2] > startTime ||
args[3] < endTime)
{
// not useful for us; there's another
// outstanding request for our time range, so wait for that
return;
}
self.onDataSetAvailable.unsubscribe(cb, obj);
obj.call (window, args[0], args[1]);
};
this.onDataSetAvailable.subscribe (cb, callback);
//netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
var reqstr = getdatacgi + "setid=" + testId;
if (startTime)
reqstr += "&starttime=" + startTime;
if (endTime)
reqstr += "&endtime=" + endTime;
//raw data is the extra_data column
if (this.raw)
reqstr += "&raw=1";
reqstr += "&graphby=bydata";
reqstr += "&extradata=" + extradata;
//log (reqstr);
loadJSONDoc(reqstr)
.addCallbacks(
function (obj) {
if (!checkErrorReturn(obj)) return;
var ds = new TimeValueDataSet(obj.results);
//this is the the case of a discrete graph - where the entire test run is always requested
//so the start and end points are the first and last entries in the returned data set
if (!startTime && !endTime) {
startTime = ds.data[0];
endTime = ds.data[ds.data.length -2];
}
ds.requestedFirstTime = startTime;
ds.requestedLastTime = endTime;
self.testData[testId] = ds;
if (obj.annotations)
ds.annotations = new TimeStringDataSet(obj.annotations);
if (obj.baselines)
ds.baselines = obj.baselines;
if (obj.rawdata)
ds.rawdata = obj.rawdata;
if (obj.stats)
ds.stats = obj.stats;
self.onDataSetAvailable.fire(testId, ds, startTime, endTime);
},
function (obj) {alert ("Error talking to " + getdatacgi + " (" + obj + ")"); log (obj.stack); });
},
};

View File

@@ -1,381 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is new-graph code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com> (Original Author)
* Alice Nodelman <anodelman@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var GraphFormModules = [];
var GraphFormModuleCount = 0;
function DiscreteGraphFormModule(userConfig, userName) {
GraphFormModuleCount++;
//log("userName: " + userName);
//this.__proto__.__proto__.constructor.call(this, "graphForm" + GraphFormModuleCount, userConfig, userName);
this.init("graphForm" + GraphFormModuleCount, userConfig, userName);
}
DiscreteGraphFormModule.prototype = {
__proto__: new YAHOO.widget.Module(),
imageRoot: "",
testId: null,
testIds: null,
testText: "",
baseline: false,
average: false,
name: "",
limitDays: null,
isLimit: null,
onLoadingDone : new YAHOO.util.CustomEvent("onloadingdone"),
onLoading : new YAHOO.util.CustomEvent("onloading"),
addedInitialInfo : new YAHOO.util.CustomEvent("addedinitialinfo"),
init: function (el, userConfig, userName) {
var self = this;
//log("el " + el + " userConfig " + userConfig + " userName " + userName);
this.__proto__.__proto__.init.call(this, el/*, userConfig*/);
this.cfg = new YAHOO.util.Config(this);
this.cfg.addProperty("testid", { suppressEvent: true });
this.cfg.addProperty("average", { suppressEvent: true });
this.cfg.addProperty("baseline", { suppressEvent: true });
if (userConfig)
this.cfg.applyConfig(userConfig, true);
var form, td, el;
var tbl;
var tbl_row;
var tbl_col;
tbl = new TABLE({});
tbl_row = new TR({});
tbl_col = new TD({colspan: 2});
appendChildNodes(tbl_col,"Limit selection list by:");
appendChildNodes(tbl_row, tbl_col);
tbl_col = new TD({});
appendChildNodes(tbl_col,"Choose test(s) to graph:");
appendChildNodes(tbl_row, tbl_col);
tbl.appendChild(tbl_row);
tbl_row = new TR({});
form = new DIV({ class: "graphform-line" });
tbl_col = new TD({});
el = new INPUT({ name: "dataload" + GraphFormModules.length,
id: "all-days-radio",
type: "radio",
checked: 1,
onchange: function(event) { self.update(null, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value); } });
tbl_col.appendChild(el);
appendChildNodes(tbl_col, "all tests");
tbl_col.appendChild(new DIV({}));
el = new INPUT({ name: "dataload" + GraphFormModules.length,
type: "radio",
onchange: function(event) { self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);} });
this.isLimit = el;
tbl_col.appendChild(el);
appendChildNodes(tbl_col, "previous ");
el = new INPUT({ name: "load-days-entry",
id: "load-days-entry",
type: "text",
size: "3",
value: "5",
onchange: function(event) { if (self.isLimit.checked) {
self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);} } });
this.limitDays = el;
tbl_col.appendChild(el);
appendChildNodes(tbl_col, " days");
tbl_row.appendChild(tbl_col);
tbl_col = new TD({});
appendChildNodes(tbl_col, "Branch: ");
appendChildNodes(tbl_col, new BR({}));
el = new SELECT({ name: "branchname",
class: "other",
size: 5,
onchange: function(event) { if (self.isLimit.checked) {
self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);}
else self.update(null, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value); } });
this.branchSelect = el;
Tinderbox.requestSearchList(1, null, null, function (list) {
var opts = [];
opts.push(new OPTION({value: null, selected: true}, "all"));
for each (var listvalue in list) {
opts.push(new OPTION({ value: listvalue.value}, listvalue.value));
}
replaceChildNodes(self.branchSelect, opts);
});
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
tbl_col = new TD({rowspan: 2, colspan: 2});
span = new SPAN({id: "listname"});
appendChildNodes(tbl_col, span);
appendChildNodes(tbl_col, new BR({}));
el = new SELECT({ name: "testname",
class: "testname",
multiple: true,
center: true,
size: 20,
onchange: function(event) { self.onChangeTest(); } });
this.testSelect = el;
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
tbl.appendChild(tbl_row);
tbl_row = new TR({});
tbl_col = new TD({});
appendChildNodes(tbl_col, "Machine: ");
appendChildNodes(tbl_col, new BR({}));
el = new SELECT({ name: "machinename",
class: "other",
size: 5,
onchange: function(event) { if (self.isLimit.checked) {
self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);}
else self.update(null, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value); } });
this.machineSelect = el;
Tinderbox.requestSearchList(null, 1, null, function (list) {
var opts = [];
opts.push(new OPTION({value: null, selected: true}, "all"));
for each (var listvalue in list) {
opts.push(new OPTION({ value: listvalue.value}, listvalue.value));
}
replaceChildNodes(self.machineSelect, opts);
});
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
tbl_col = new TD({});
appendChildNodes(tbl_col, "Test name: ");
appendChildNodes(tbl_col, new BR({}));
el = new SELECT({ name: "testtypename",
class: "other",
size: 5,
onchange: function(event) { if (self.isLimit.checked) {
self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);}
else self.update(null, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value); } });
this.testtypeSelect = el;
var forceTestIds = null;
this.average = false;
if (userConfig) {
forceTestIds = userConfig;
}
//log ("userName: " + userName);
Tinderbox.requestSearchList(null, null, 1, function (list) {
var opts = [];
//opts.push(new OPTION({value: null, selected: true}, "all"));
for each (var listvalue in list) {
if ((userName) && (userName == listvalue.value)) {
opts.push(new OPTION({ value: listvalue.value, selected : true}, listvalue.value));
}
else {
opts.push(new OPTION({ value: listvalue.value}, listvalue.value));
}
}
replaceChildNodes(self.testtypeSelect, opts);
if (forceTestIds == null) {
self.testtypeSelect.options[0].selected = true;
self.update(null, null, null, self.testtypeSelect.value, forceTestIds);
}
else {
self.update(null, null, null, userName, forceTestIds);
}
});
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
/*
tbl_col = new TD({rowspan: 2, colspan: 2});
el = new SELECT({ name: "testname",
class: "testname",
multiple: true,
size: 20,
onchange: function(event) { self.onChangeTest(); } });
this.testSelect = el;
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
*/
tbl.appendChild(tbl_row);
form.appendChild(tbl);
this.setBody (form);
/*
var forceTestIds = null;
this.average = false;
if (userConfig) {
forceTestIds = userConfig;
}
*/
//self.update(null, null, null, null, forceTestIds);
GraphFormModules.push(this);
},
getQueryString: function (prefix) {
var qstring = '';
ctr = 1;
for each (var opt in this.testSelect.options) {
if (opt.selected) {
prefixed = prefix + ctr;
qstring += "&" + prefixed + "tid=" + opt.value + "&" + prefixed + "bl=" + (this.baseline ? "1" : "0")
+ "&" + prefixed + "avg=" + (this.average? "1" : "0");
ctr++
}
}
return qstring;
},
getDumpString: function () {
var prefix = '';
var dstring = '';
for each (var opt in this.testSelect.options) {
if (opt.selected) {
dstring += prefix + "setid=" + opt.value;
prefix = "&";
}
}
return dstring;
},
onChangeTest: function (forceTestIds) {
this.testId = this.testSelect.value;
//log("setting testId: " + this.testId);
this.testIds = [];
for each (var opt in this.testSelect.options) {
if (opt.selected) {
//log("opt: " + opt.value);
this.testIds.push([opt.value, opt.text]);
}
}
//log("testIDs: " + this.testIds);
//log(this.testSelect.options[this.testSelect.selectedIndex].text);
this.testText = this.testSelect.options[this.testSelect.selectedIndex];
this.addedInitialInfo.fire();
this.name = this.testtypeSelect.value;
},
onBaseLineRadioClick: function () {
GraphFormModules.forEach(function (g) { g.baseline = false; });
this.baseline = true;
},
remove: function () {
var nf = [];
for each (var f in GraphFormModules) {
if (f != this)
nf.push(f);
}
GraphFormModules = nf;
this.destroy();
},
update: function (limitD, branch, machine, testname, forceTestIds) {
var self = this;
this.onLoading.fire("updating test list");
//log ("attempting to update graphformmodule, forceTestIds " + forceTestIds);
Tinderbox.requestTestList(limitD, branch, machine, testname, function (tests) {
var opts = [];
var branch_opts = [];
if (tests == '') {
log("empty test list");
self.onLoadingDone.fire();
replaceChildNodes(self.testSelect, null);
btn = getElement("graphbutton");
btn.disabled = true;
return;
}
// let's sort by machine name
var sortedTests = Array.sort(tests, function (a, b) {
if (a.machine < b.machine) return -1;
if (a.machine > b.machine) return 1;
if (a.test < b.test) return -1;
if (a.test > b.test) return 1;
if (a.test_type < b.test_type) return -1;
if (a.test_type > b.test_type) return 1;
if (a.date < b.date) return -1;
if (a.date > b.date) return 1;
return 0;
});
for each (var test in sortedTests) {
var d = new Date(test.date*1000);
var s1 = (d.getHours() < 10 ? "0" : "") + d.getHours() + (d.getMinutes() < 10 ? ":0" : ":") + d.getMinutes() +
//(d.getSeconds() < 10 ? ":0" : ":") + d.getSeconds() +
" " + (d.getDate() < 10 ? "0" : "") + d.getDate();
s1 += "/" + MONTH_ABBREV[d.getMonth()] + "/" + (d.getFullYear() -2000 < 10 ? "0" : "") + (d.getFullYear() - 2000);
//(d.getYear() + 1900);
var padstr = "--------------------";
var tstr = "" + //test.test + padstr.substr(0, 20-test.test.length) +
test.branch.toString() + padstr.substr(0, 6-test.branch.toString().length) +
"-" + test.machine + padstr.substr(0, 10-test.machine.length) +
"-" + s1;
startSelected = false;
if (forceTestIds != null) {
if ((forceTestIds == test.id) || (forceTestIds.indexOf(Number(test.id)) > -1)) {
startSelected = true;
}
}
if (startSelected) {
//log("starting with an initial selection");
opts.push(new OPTION({ value: test.id, selected: true}, tstr));
}
else {
opts.push(new OPTION({ value: test.id}, tstr));
}
}
replaceChildNodes(self.testSelect, opts);
if (forceTestIds == null) {
self.testSelect.options[0].selected = true;
//self.testSelect.value = sortedTests[0].id;
}
replaceChildNodes("listname", null);
appendChildNodes("listname","Select from " + testname + ":");
btn = getElement("graphbutton");
btn.disabled = false;
setTimeout(function () { self.onChangeTest(forceTestIds); }, 0);
self.onLoadingDone.fire();
});
},
};

View File

@@ -1,376 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is new-graph code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com> (Original Author)
* Alice Nodelman <anodelman@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var GraphFormModules = [];
var GraphFormModuleCount = 0;
function ExtraDataGraphFormModule(userConfig, userName) {
GraphFormModuleCount++;
//log("userName: " + userName);
//this.__proto__.__proto__.constructor.call(this, "graphForm" + GraphFormModuleCount, userConfig, userName);
this.init("graphForm" + GraphFormModuleCount, userConfig, userName);
}
ExtraDataGraphFormModule.prototype = {
__proto__: new YAHOO.widget.Module(),
imageRoot: "",
testId: null,
testIds: null,
testText: "",
baseline: false,
average: false,
name: "",
limitDays: null,
isLimit: null,
onLoadingDone : new YAHOO.util.CustomEvent("onloadingdone"),
onLoading : new YAHOO.util.CustomEvent("onloading"),
addedInitialInfo : new YAHOO.util.CustomEvent("addedinitialinfo"),
init: function (el, userConfig, userName) {
var self = this;
//log("el " + el + " userConfig " + userConfig + " userName " + userName);
this.__proto__.__proto__.init.call(this, el/*, userConfig*/);
this.cfg = new YAHOO.util.Config(this);
this.cfg.addProperty("testid", { suppressEvent: true });
this.cfg.addProperty("average", { suppressEvent: true });
this.cfg.addProperty("baseline", { suppressEvent: true });
if (userConfig)
this.cfg.applyConfig(userConfig, true);
var form, td, el;
var tbl;
var tbl_row;
var tbl_col;
tbl = new TABLE({});
tbl_row = new TR({});
tbl_col = new TD({colspan: 2});
appendChildNodes(tbl_col,"Limit selection list by:");
appendChildNodes(tbl_row, tbl_col);
tbl_col = new TD({});
appendChildNodes(tbl_col,"Choose test(s) to graph:");
appendChildNodes(tbl_row, tbl_col);
tbl.appendChild(tbl_row);
tbl_row = new TR({});
form = new DIV({ class: "graphform-line" });
tbl_col = new TD({});
el = new INPUT({ name: "dataload" + GraphFormModules.length,
id: "all-days-radio",
type: "radio",
checked: 1,
onchange: function(event) { self.update(null, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value); } });
tbl_col.appendChild(el);
appendChildNodes(tbl_col, "all tests");
tbl_col.appendChild(new DIV({}));
el = new INPUT({ name: "dataload" + GraphFormModules.length,
type: "radio",
onchange: function(event) { self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);} });
this.isLimit = el;
tbl_col.appendChild(el);
appendChildNodes(tbl_col, "previous ");
el = new INPUT({ name: "load-days-entry",
id: "load-days-entry",
type: "text",
size: "3",
value: "5",
onchange: function(event) { if (self.isLimit.checked) {
self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);} } });
this.limitDays = el;
tbl_col.appendChild(el);
appendChildNodes(tbl_col, " days");
tbl_row.appendChild(tbl_col);
tbl_col = new TD({});
appendChildNodes(tbl_col, "Branch: ");
appendChildNodes(tbl_col, new BR({}));
el = new SELECT({ name: "branchname",
class: "other",
size: 5,
onchange: function(event) { if (self.isLimit.checked) {
self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);}
else self.update(null, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value); } });
this.branchSelect = el;
Tinderbox.requestSearchList(1, null, null, function (list) {
var opts = [];
opts.push(new OPTION({value: null, selected: true}, "all"));
for each (var listvalue in list) {
opts.push(new OPTION({ value: listvalue.value}, listvalue.value));
}
replaceChildNodes(self.branchSelect, opts);
});
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
tbl_col = new TD({rowspan: 2, colspan: 2});
span = new SPAN({id: "listname"});
appendChildNodes(tbl_col, span);
appendChildNodes(tbl_col, new BR({}));
el = new SELECT({ name: "testname",
class: "testname",
multiple: true,
center: true,
size: 20,
onchange: function(event) { self.onChangeTest(); } });
this.testSelect = el;
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
tbl.appendChild(tbl_row);
tbl_row = new TR({});
tbl_col = new TD({});
appendChildNodes(tbl_col, "Machine: ");
appendChildNodes(tbl_col, new BR({}));
el = new SELECT({ name: "machinename",
class: "other",
size: 5,
onchange: function(event) { if (self.isLimit.checked) {
self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);}
else self.update(null, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value); } });
this.machineSelect = el;
Tinderbox.requestSearchList(null, 1, null, function (list) {
var opts = [];
opts.push(new OPTION({value: null, selected: true}, "all"));
for each (var listvalue in list) {
opts.push(new OPTION({ value: listvalue.value}, listvalue.value));
}
replaceChildNodes(self.machineSelect, opts);
});
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
tbl_col = new TD({});
appendChildNodes(tbl_col, "Test name: ");
appendChildNodes(tbl_col, new BR({}));
el = new SELECT({ name: "testtypename",
class: "other",
size: 5,
onchange: function(event) { if (self.isLimit.checked) {
self.update(self.limitDays.value, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value);}
else self.update(null, self.branchSelect.value, self.machineSelect.value, self.testtypeSelect.value); } });
this.testtypeSelect = el;
var forceTestIds = null;
this.average = false;
if (userConfig) {
forceTestIds = userConfig;
}
//log ("userName: " + userName);
Tinderbox.requestSearchList(null, null, 1, function (list) {
var opts = [];
//opts.push(new OPTION({value: null, selected: true}, "all"));
for each (var listvalue in list) {
if ((userName) && (userName == listvalue.value)) {
opts.push(new OPTION({ value: listvalue.value, selected : true}, listvalue.value));
}
else {
opts.push(new OPTION({ value: listvalue.value}, listvalue.value));
}
}
replaceChildNodes(self.testtypeSelect, opts);
if (forceTestIds == null) {
self.testtypeSelect.options[0].selected = true;
self.update(null, null, null, self.testtypeSelect.value, forceTestIds);
}
else {
self.update(null, null, null, userName, forceTestIds);
}
});
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
/*
tbl_col = new TD({rowspan: 2, colspan: 2});
el = new SELECT({ name: "testname",
class: "testname",
multiple: true,
size: 20,
onchange: function(event) { self.onChangeTest(); } });
this.testSelect = el;
tbl_col.appendChild(el);
tbl_row.appendChild(tbl_col);
*/
tbl.appendChild(tbl_row);
form.appendChild(tbl);
this.setBody (form);
/*
var forceTestIds = null;
this.average = false;
if (userConfig) {
forceTestIds = userConfig;
}
*/
//self.update(null, null, null, null, forceTestIds);
GraphFormModules.push(this);
},
getQueryString: function (prefix) {
var qstring = '';
ctr = 1;
for each (var opt in this.testSelect.options) {
if (opt.selected) {
prefixed = prefix + ctr;
qstring += "&" + prefixed + "tid=" + opt.value + "&" + prefixed + "bl=" + (this.baseline ? "1" : "0")
+ "&" + prefixed + "avg=" + (this.average? "1" : "0");
ctr++
}
}
return qstring;
},
getDumpString: function () {
var prefix = '';
var dstring = '';
for each (var opt in this.testSelect.options) {
if (opt.selected) {
dstring += prefix + "setid=" + opt.value;
prefix = "&";
}
}
return dstring;
},
onChangeTest: function (forceTestIds) {
this.testId = this.testSelect.value;
//log("setting testId: " + this.testId);
this.testIds = [];
for each (var opt in this.testSelect.options) {
if (opt.selected) {
//log("opt: " + opt.value);
this.testIds.push([opt.value, opt.text]);
}
}
//log("testIDs: " + this.testIds);
//log(this.testSelect.options[this.testSelect.selectedIndex].text);
this.testText = this.testSelect.options[this.testSelect.selectedIndex];
this.addedInitialInfo.fire();
this.name = this.testtypeSelect.value;
},
onBaseLineRadioClick: function () {
GraphFormModules.forEach(function (g) { g.baseline = false; });
this.baseline = true;
},
remove: function () {
var nf = [];
for each (var f in GraphFormModules) {
if (f != this)
nf.push(f);
}
GraphFormModules = nf;
this.destroy();
},
update: function (limitD, branch, machine, testname, forceTestIds) {
var self = this;
this.onLoading.fire("updating test list");
//log ("attempting to update graphformmodule, forceTestIds " + forceTestIds);
Tinderbox.requestTestList(limitD, branch, machine, testname, function (tests) {
var opts = [];
var branch_opts = [];
if (tests == '') {
log("empty test list");
self.onLoadingDone.fire();
replaceChildNodes(self.testSelect, null);
btn = getElement("graphbutton");
btn.disabled = true;
return;
}
// let's sort by machine name
var sortedTests = Array.sort(tests, function (a, b) {
if (a.machine < b.machine) return -1;
if (a.machine > b.machine) return 1;
if (a.test < b.test) return -1;
if (a.test > b.test) return 1;
if (a.test_type < b.test_type) return -1;
if (a.test_type > b.test_type) return 1;
if (a.data < b.data) return -1;
if (a.data > b.data) return 1;
return 0;
});
for each (var test in sortedTests) {
var s1 = test.data;
var padstr = "--------------------";
var tstr = "" + //test.test + padstr.substr(0, 20-test.test.length) +
test.branch.toString() + padstr.substr(0, 6-test.branch.toString().length) +
"-" + test.machine + padstr.substr(0, 10-test.machine.length) +
"-" + s1;
startSelected = false;
if (forceTestIds != null) {
if ((forceTestIds == test.id) || (forceTestIds.indexOf(Number(test.id)) > -1)) {
startSelected = true;
}
}
if (startSelected) {
//log("starting with an initial selection");
opts.push(new OPTION({ value: test.id + "_" + test.data, selected: true}, tstr));
}
else {
opts.push(new OPTION({ value: test.id + "_" + test.data}, tstr));
}
}
replaceChildNodes(self.testSelect, opts);
if (forceTestIds == null) {
self.testSelect.options[0].selected = true;
//self.testSelect.value = sortedTests[0].id;
}
replaceChildNodes("listname", null);
appendChildNodes("listname","Select from " + testname + ":");
btn = getElement("graphbutton");
btn.disabled = false;
setTimeout(function () { self.onChangeTest(forceTestIds); }, 0);
self.onLoadingDone.fire();
});
},
};

View File

@@ -1,87 +0,0 @@
.graphconfig {
background-color: #cccccc;
-moz-border-radius: 10px 0 0 10px;
padding: 10px;
width: 15em;
}
.dgraphconfig {
background-color: #cccccc;
-moz-border-radius: 10px 0 0 10px;
padding: 10px;
width: 7em;
}
.graphconfig-list {
background-color: #cccccc;
-moz-border-radius: 0 10px 10px 0;
padding: 10px;
}
/* Yuck */
.graphform-line, .baseline {
margin-bottom: 5px;
}
.graphform-first-span {
/* font-weight: bold; */
}
/*
#graphforms div .bd .graphform-line .graphform-first-span:after {
content: "For ";
}
.module + .module .bd .graphform-line .graphform-first-span:after {
content: "and " ! important;
}
*/
select.tinderbox, select.testname {
font-family: monospace;
width: 350px;
}
select.other {
font-family: monospace;
width: 225px;
}
.plusminus {
padding: 3px;
vertical-align: middle;
}
.plusminus:hover {
background: #999;
}
.plusminushidden {
width: 20px;
height: 20px;
visibility: hidden;
}
.y-axis-label {
font-family: Tahoma, Verdana, Vera Sans, "Bitstream Vera Sans", Arial, Helvetica, sans-serif;
font-size: 75%;
vertical-align: middle;
text-align: right;
}
.x-axis-label {
font-family: Tahoma, Verdana, Vera Sans, "Bitstream Vera Sans", Arial, Helvetica, sans-serif;
font-size: 75%;
padding: 0px;
vertical-align: top;
text-align: center;
}
.status {
color: blue;
}
/* debug */
/*div { border: 1px solid blue; }*/

View File

@@ -1,661 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is new-graph code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com> (Original Author)
* Alice Nodelman <anodelman@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// all times are in seconds
const ONE_HOUR_SECONDS = 60*60;
const ONE_DAY_SECONDS = 24*ONE_HOUR_SECONDS;
const ONE_WEEK_SECONDS = 7*ONE_DAY_SECONDS;
const ONE_YEAR_SECONDS = 365*ONE_DAY_SECONDS; // leap years whatever.
const MONTH_ABBREV = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
const CONTINUOUS_GRAPH = 0;
const DISCRETE_GRAPH = 1;
const DATA_GRAPH = 2;
const bonsaicgi = "bonsaibouncer.cgi";
// more days than this and we'll force user confirmation for the bonsai query
const bonsaiNoForceDays = 90;
// the default average interval
var gAverageInterval = 3*ONE_HOUR_SECONDS;
var gCurrentLoadRange = null;
var gForceBonsai = false;
var Tinderbox;
var BigPerfGraph;
var SmallPerfGraph;
var Bonsai;
var graphType;
function loadingDone(graphTypePref) {
//createLoggingPane(true);
graphType = graphTypePref;
if (graphType == CONTINUOUS_GRAPH) {
Tinderbox = new TinderboxData();
SmallPerfGraph = new CalendarTimeGraph("smallgraph");
BigPerfGraph = new CalendarTimeGraph("graph");
onDataLoadChanged();
} else if (graphType == DATA_GRAPH) {
Tinderbox = new ExtraDataTinderboxData();
SmallPerfGraph = new CalendarTimeGraph("smallgraph");
BigPerfGraph = new CalendarTimeGraph("graph");
}
else {
Tinderbox = new DiscreteTinderboxData();
Tinderbox.raw = 1;
SmallPerfGraph = new DiscreteGraph("smallgraph");
BigPerfGraph = new DiscreteGraph("graph");
onDiscreteDataLoadChanged();
}
Tinderbox.init();
if (BonsaiService)
Bonsai = new BonsaiService();
SmallPerfGraph.yLabelHeight = 20;
SmallPerfGraph.setSelectionType("range");
BigPerfGraph.setSelectionType("cursor");
BigPerfGraph.setCursorType("free");
SmallPerfGraph.onSelectionChanged.
subscribe (function (type, args, obj) {
log ("selchanged");
if (args[0] == "range") {
if (args[1] && args[2]) {
var t1 = args[1];
var t2 = args[2];
var foundIndexes = [];
// make sure that there are at least two points
// on at least one graph for this
var foundPoints = false;
var dss = BigPerfGraph.dataSets;
for (var i = 0; i < dss.length; i++) {
var idcs = dss[i].indicesForTimeRange(t1, t2);
if (idcs[1] - idcs[0] > 1) {
foundPoints = true;
break;
}
foundIndexes.push(idcs);
}
if (!foundPoints) {
// we didn't find at least two points in at least
// one graph; so munge the time numbers until we do.
log("Orig t1 " + t1 + " t2 " + t2);
for (var i = 0; i < dss.length; i++) {
if (foundIndexes[i][0] > 0) {
t1 = Math.min(dss[i].data[(foundIndexes[i][0] - 1) * 2], t1);
} else if (foundIndexes[i][1]+1 < (ds.data.length/2)) {
t2 = Math.max(dss[i].data[(foundIndexes[i][1] + 1) * 2], t2);
}
}
log("Fixed t1 " + t1 + " t2 " + t2);
}
BigPerfGraph.setTimeRange (t1, t2);
} else {
BigPerfGraph.setTimeRange (SmallPerfGraph.startTime, SmallPerfGraph.endTime);
}
BigPerfGraph.autoScale();
BigPerfGraph.redraw();
}
updateLinkToThis();
updateDumpToCsv();
});
if (graphType == CONTINUOUS_GRAPH) {
BigPerfGraph.onCursorMoved.
subscribe (function (type, args, obj) {
var time = args[0];
var val = args[1];
if (time != null && val != null) {
// cheat
showStatus("Date: " + formatTime(time) + " Value: " + val.toFixed(2));
} else {
showStatus(null);
}
});
BigPerfGraph.onNewGraph.
subscribe (function(type, args, obj) {
if (args[0].length >= GraphFormModules.length) {
clearLoadingAnimation();
}
});
}
else if (graphType == DATA_GRAPH) {
BigPerfGraph.onCursorMoved.
subscribe (function (type, args, obj) {
var time = args[0];
var val = args[1];
if (time != null && val != null) {
// cheat
showStatus("Date: " + formatTime(time) + " Value: " + val.toFixed(2));
} else {
showStatus(null);
}
});
BigPerfGraph.onNewGraph.
subscribe (function(type, args, obj) {
showGraphList(args[0]);
});
}
else {
BigPerfGraph.onCursorMoved.
subscribe (function (type, args, obj) {
var time = args[0];
var val = args[1];
var extra_data = args[2]
if (time != null && val != null) {
// cheat
showStatus("Interval: " + Math.floor(time) + " Value: " + val.toFixed(2) + " " + extra_data);
} else {
showStatus(null);
}
});
BigPerfGraph.onNewGraph.
subscribe (function(type, args, obj) {
showGraphList(args[0]);
});
}
if (document.location.hash) {
handleHash(document.location.hash);
} else {
if (graphType == CONTINUOUS_GRAPH) {
addGraphForm();
}
else if ( graphType == DATA_GRAPH ) {
addExtraDataGraphForm();
}
else {
addDiscreteGraphForm();
}
}
}
function addExtraDataGraphForm(config, name) {
showLoadingAnimation("populating lists");
var ed = new ExtraDataGraphFormModule(config, name);
ed.onLoading.subscribe (function(type,args,obj) { showLoadingAnimation(args[0]);});
ed.onLoadingDone.subscribe (function(type,args,obj) { clearLoadingAnimation();});
if (config) {
ed.addedInitialInfo.subscribe(function(type,args,obj) { graphInitial();});
}
ed.render (getElement("graphforms"));
return ed;
}
function addDiscreteGraphForm(config, name) {
showLoadingAnimation("populating lists");
//log("name: " + name);
var m = new DiscreteGraphFormModule(config, name);
m.onLoading.subscribe (function(type,args,obj) { showLoadingAnimation(args[0]);});
m.onLoadingDone.subscribe (function(type,args,obj) { clearLoadingAnimation();});
if (config) {
m.addedInitialInfo.subscribe(function(type,args,obj) { graphInitial();});
}
m.render (getElement("graphforms"));
//m.setColor(randomColor());
return m;
}
function addGraphForm(config) {
showLoadingAnimation("populating list");
var m = new GraphFormModule(config);
m.render (getElement("graphforms"));
m.setColor(randomColor());
m.onLoading.subscribe (function(type,args,obj) { showLoadingAnimation(args[0]);});
m.onLoadingDone.subscribe (function(type,args,obj) { clearLoadingAnimation();});
return m;
}
function onNoBaseLineClick() {
GraphFormModules.forEach (function (g) { g.baseline = false; });
}
// whether the bonsai data query should redraw the graph or not
var gReadyForRedraw = true;
function onUpdateBonsai() {
BigPerfGraph.deleteAllMarkers();
getElement("bonsaibutton").disabled = true;
if (gCurrentLoadRange) {
if ((gCurrentLoadRange[1] - gCurrentLoadRange[0]) < (bonsaiNoForceDays * ONE_DAY_SECONDS) || gForceBonsai) {
Bonsai.requestCheckinsBetween (gCurrentLoadRange[0], gCurrentLoadRange[1],
function (bdata) {
for (var i = 0; i < bdata.times.length; i++) {
BigPerfGraph.addMarker (bdata.times[i], bdata.who[i] + ": " + bdata.comment[i]);
}
if (gReadyForRedraw)
BigPerfGraph.redraw();
getElement("bonsaibutton").disabled = false;
});
}
}
}
function onGraph() {
showLoadingAnimation("building graph");
showStatus(null);
for each (var g in [BigPerfGraph, SmallPerfGraph]) {
g.clearDataSets();
g.setTimeRange(null, null);
}
gReadyForRedraw = false;
// do the actual graph data request
var baselineModule = null;
GraphFormModules.forEach (function (g) { if (g.baseline) baselineModule = g; });
if (baselineModule) {
Tinderbox.requestDataSetFor (baselineModule.testId,
function (testid, ds) {
try {
//log ("Got results for baseline: '" + testid + "' ds: " + ds);
ds.color = baselineModule.color;
onGraphLoadRemainder(ds);
} catch(e) { log(e); }
});
} else {
onGraphLoadRemainder();
}
}
function onGraphLoadRemainder(baselineDataSet) {
for each (var graphModule in GraphFormModules) {
//log ("onGraphLoadRemainder: ", graphModule.id, graphModule.testId, "color:", graphModule.color, "average:", graphModule.average);
// this would have been loaded earlier
if (graphModule.baseline)
continue;
var autoExpand = true;
if (SmallPerfGraph.selectionType == "range" &&
SmallPerfGraph.selectionStartTime &&
SmallPerfGraph.selectionEndTime)
{
if (gCurrentLoadRange && (SmallPerfGraph.selectionStartTime < gCurrentLoadRange[0] ||
SmallPerfGraph.selectionEndTime > gCurrentLoadRange[1]))
{
SmallPerfGraph.selectionStartTime = Math.max (SmallPerfGraph.selectionStartTime, gCurrentLoadRange[0]);
SmallPerfGraph.selectionEndTime = Math.min (SmallPerfGraph.selectionEndTime, gCurrentLoadRange[1]);
}
BigPerfGraph.setTimeRange (SmallPerfGraph.selectionStartTime, SmallPerfGraph.selectionEndTime);
autoExpand = false;
}
// we need a new closure here so that we can get the right value
// of graphModule in our closure
var makeCallback = function (module, color, title) {
return function (testid, ds) {
try {
log("ds.firstTime " + ds.firstTime + " ds.lastTime " + ds.lastTime);
if (undefined == ds.firstTime || !ds.lastTime) {
// got a data set with no data in this time range, or damaged data
// better to not graph
for each (g in [BigPerfGraph, SmallPerfGraph]) {
g.clearGraph();
}
showStatus("No data in the given time range");
clearLoadingAnimation();
}
else {
ds.color = color;
if (title) {
ds.title = title;
}
if (baselineDataSet)
ds = ds.createRelativeTo(baselineDataSet);
//log ("got ds: (", module.id, ")", ds.firstTime, ds.lastTime, ds.data.length);
var avgds = null;
if (baselineDataSet == null &&
module.average)
{
avgds = ds.createAverage(gAverageInterval);
}
if (avgds)
log ("got avgds: (", module.id, ")", avgds.firstTime, avgds.lastTime, avgds.data.length);
for each (g in [BigPerfGraph, SmallPerfGraph]) {
g.addDataSet(ds);
if (avgds)
g.addDataSet(avgds);
if (g == SmallPerfGraph || autoExpand) {
g.expandTimeRange(Math.max(ds.firstTime, gCurrentLoadRange ? gCurrentLoadRange[0] : ds.firstTime),
Math.min(ds.lastTime, gCurrentLoadRange ? gCurrentLoadRange[1] : ds.lastTime));
}
g.autoScale();
g.redraw();
gReadyForRedraw = true;
}
//if (graphType == CONTINUOUS_GRAPH) {
updateLinkToThis();
updateDumpToCsv();
//}
}
} catch(e) { log(e); }
};
};
if (graphModule.testIds) {
for each (var testId in graphModule.testIds) {
// log ("working with testId: " + testId);
Tinderbox.requestDataSetFor (testId[0], makeCallback(graphModule, randomColor(), testId[1]));
}
}
else {
// log ("working with standard, single testId");
Tinderbox.requestDataSetFor (graphModule.testId, makeCallback(graphModule, graphModule.color));
}
}
}
function onDataLoadChanged() {
log ("loadchanged");
if (getElement("load-days-radio").checked) {
var dval = new Number(getElement("load-days-entry").value);
log ("dval", dval);
if (dval <= 0) {
//getElement("load-days-entry").style.background-color = "red";
return;
} else {
//getElement("load-days-entry").style.background-color = "inherit";
}
var d2 = Math.ceil(Date.now() / 1000);
d2 = (d2 - (d2 % ONE_DAY_SECONDS)) + ONE_DAY_SECONDS;
var d1 = Math.floor(d2 - (dval * ONE_DAY_SECONDS));
log ("drange", d1, d2);
Tinderbox.defaultLoadRange = [d1, d2];
gCurrentLoadRange = [d1, d2];
} else {
Tinderbox.defaultLoadRange = null;
gCurrentLoadRange = null;
}
Tinderbox.clearValueDataSets();
// hack, reset colors
randomColorBias = 0;
}
function onExtraDataLoadChanged() {
log ("loadchanged");
Tinderbox.defaultLoadRange = null;
gCurrentLoadRange = null;
// hack, reset colors
randomColorBias = 0;
}
function onDiscreteDataLoadChanged() {
log ("loadchanged");
Tinderbox.defaultLoadRange = null;
gCurrentLoadRange = null;
// hack, reset colors
randomColorBias = 0;
}
function findGraphModule(testId) {
for each (var gm in GraphFormModules) {
if (gm.testId == testId)
return gm;
}
return null;
}
function updateDumpToCsv() {
var ds = "?"
prefix = ""
for each (var gm in GraphFormModules) {
ds += prefix + gm.getDumpString();
prefix = "&"
}
log ("ds");
getElement("dumptocsv").href = "http://" + document.location.host + "/dumpdata.cgi" + ds;
}
function updateLinkToThis() {
var qs = "";
qs += SmallPerfGraph.getQueryString("sp");
qs += "&";
qs += BigPerfGraph.getQueryString("bp");
if (graphType == CONTINUOUS_GRAPH) {
var ctr = 1;
for each (var gm in GraphFormModules) {
qs += "&" + gm.getQueryString("m" + ctr);
ctr++;
}
}
else {
qs += "&";
qs += "name=" + GraphFormModules[0].name;
for each (var gm in GraphFormModules) {
qs += gm.getQueryString("m");
}
}
getElement("linktothis").href = document.location.pathname + "#" + qs;
}
function handleHash(hash) {
var qsdata = {};
for each (var s in hash.substring(1).split("&")) {
var q = s.split("=");
qsdata[q[0]] = q[1];
}
if (graphType == CONTINUOUS_GRAPH) {
var ctr = 1;
while (("m" + ctr + "tid") in qsdata) {
var prefix = "m" + ctr;
addGraphForm({testid: qsdata[prefix + "tid"],
average: qsdata[prefix + "avg"]});
ctr++;
}
}
else {
var ctr=1;
testids = [];
while (("m" + ctr + "tid") in qsdata) {
var prefix = "m" + ctr;
testids.push(Number(qsdata[prefix + "tid"]));
ctr++;
}
// log("qsdata[name] " + qsdata["name"]);
addDiscreteGraphForm(testids, qsdata["name"]);
}
SmallPerfGraph.handleQueryStringData("sp", qsdata);
BigPerfGraph.handleQueryStringData("bp", qsdata);
var tstart = new Number(qsdata["spstart"]);
var tend = new Number(qsdata["spend"]);
//Tinderbox.defaultLoadRange = [tstart, tend];
if (graphType == CONTINUOUS_GRAPH) {
Tinderbox.requestTestList(function (tests) {
setTimeout (onGraph, 0); // let the other handlers do their thing
});
}
}
function graphInitial() {
GraphFormModules[0].addedInitialInfo.unsubscribeAll();
Tinderbox.requestTestList(null, null, null, null, function (tests) {
setTimeout(onGraph, 0);
});
}
function showStatus(s) {
replaceChildNodes("status", s);
}
function showLoadingAnimation(message) {
//log("starting loading animation: " + message);
td = new SPAN();
el = new IMG({ src: "js/img/Throbber-small.gif"});
appendChildNodes(td, el);
appendChildNodes(td, " loading: " + message + " ");
replaceChildNodes("loading", td);
}
function clearLoadingAnimation() {
//log("ending loading animation");
replaceChildNodes("loading", null);
}
function showGraphList(s) {
replaceChildNodes("graph-label-list",null);
// log("s: " +s);
var tbl = new TABLE({});
var tbl_tr = new TR();
appendChildNodes(tbl_tr, new TD(""));
appendChildNodes(tbl_tr, new TD("avg"));
appendChildNodes(tbl_tr, new TD("max"));
appendChildNodes(tbl_tr, new TD("min"));
appendChildNodes(tbl_tr, new TD("test name"));
appendChildNodes(tbl, tbl_tr);
for each (var ds in s) {
var tbl_tr = new TR();
var rstring = ds.stats + " ";
var colorDiv = new DIV({ id: "whee", style: "display: inline; border: 1px solid black; height: 15; " +
"padding-right: 15; vertical-align: middle; margin: 3px;" });
colorDiv.style.backgroundColor = colorToRgbString(ds.color);
// log("ds.stats" + ds.stats);
appendChildNodes(tbl_tr, colorDiv);
for each (var val in ds.stats) {
appendChildNodes(tbl_tr, new TD(val.toFixed(2)));
}
appendChildNodes(tbl, tbl_tr);
appendChildNodes(tbl_tr, new TD(ds.title));
}
appendChildNodes("graph-label-list", tbl);
if (s.length == GraphFormModules[0].testIds.length) {
clearLoadingAnimation();
}
//replaceChildNodes("graph-label-list",rstring);
}
/* Get some pre-set colors in for the first 5 graphs, thens start randomly generating stuff */
var presetColorIndex = 0;
var presetColors = [
[0.0, 0.0, 0.7, 1.0],
[0.0, 0.5, 0.0, 1.0],
[0.7, 0.0, 0.0, 1.0],
[0.7, 0.0, 0.7, 1.0],
[0.0, 0.7, 0.7, 1.0]
];
var randomColorBias = 0;
function randomColor() {
if (presetColorIndex < presetColors.length) {
return presetColors[presetColorIndex++];
}
var col = [
(Math.random()*0.5) + ((randomColorBias==0) ? 0.5 : 0.2),
(Math.random()*0.5) + ((randomColorBias==1) ? 0.5 : 0.2),
(Math.random()*0.5) + ((randomColorBias==2) ? 0.5 : 0.2),
1.0
];
randomColorBias++;
if (randomColorBias == 3)
randomColorBias = 0;
return col;
}
function lighterColor(col) {
return [
Math.min(0.85, col[0] * 1.2),
Math.min(0.85, col[1] * 1.2),
Math.min(0.85, col[2] * 1.2),
col[3]
];
}
function colorToRgbString(col) {
// log ("in colorToRgbString");
if (col[3] < 1) {
return "rgba("
+ Math.floor(col[0]*255) + ","
+ Math.floor(col[1]*255) + ","
+ Math.floor(col[2]*255) + ","
+ col[3]
+ ")";
}
return "rgb("
+ Math.floor(col[0]*255) + ","
+ Math.floor(col[1]*255) + ","
+ Math.floor(col[2]*255) + ")";
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

View File

@@ -1,637 +0,0 @@
/***
MochiKit.Async 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide("MochiKit.Async");
dojo.require("MochiKit.Base");
}
if (typeof(JSAN) != 'undefined') {
JSAN.use("MochiKit.Base", []);
}
try {
if (typeof(MochiKit.Base) == 'undefined') {
throw "";
}
} catch (e) {
throw "MochiKit.Async depends on MochiKit.Base!";
}
if (typeof(MochiKit.Async) == 'undefined') {
MochiKit.Async = {};
}
MochiKit.Async.NAME = "MochiKit.Async";
MochiKit.Async.VERSION = "1.3.1";
MochiKit.Async.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.Async.toString = function () {
return this.__repr__();
};
MochiKit.Async.Deferred = function (/* optional */ canceller) {
this.chain = [];
this.id = this._nextId();
this.fired = -1;
this.paused = 0;
this.results = [null, null];
this.canceller = canceller;
this.silentlyCancelled = false;
this.chained = false;
};
MochiKit.Async.Deferred.prototype = {
repr: function () {
var state;
if (this.fired == -1) {
state = 'unfired';
} else if (this.fired === 0) {
state = 'success';
} else {
state = 'error';
}
return 'Deferred(' + this.id + ', ' + state + ')';
},
toString: MochiKit.Base.forwardCall("repr"),
_nextId: MochiKit.Base.counter(),
cancel: function () {
var self = MochiKit.Async;
if (this.fired == -1) {
if (this.canceller) {
this.canceller(this);
} else {
this.silentlyCancelled = true;
}
if (this.fired == -1) {
this.errback(new self.CancelledError(this));
}
} else if ((this.fired === 0) && (this.results[0] instanceof self.Deferred)) {
this.results[0].cancel();
}
},
_pause: function () {
/***
Used internally to signal that it's waiting on another Deferred
***/
this.paused++;
},
_unpause: function () {
/***
Used internally to signal that it's no longer waiting on another
Deferred.
***/
this.paused--;
if ((this.paused === 0) && (this.fired >= 0)) {
this._fire();
}
},
_continue: function (res) {
/***
Used internally when a dependent deferred fires.
***/
this._resback(res);
this._unpause();
},
_resback: function (res) {
/***
The primitive that means either callback or errback
***/
this.fired = ((res instanceof Error) ? 1 : 0);
this.results[this.fired] = res;
this._fire();
},
_check: function () {
if (this.fired != -1) {
if (!this.silentlyCancelled) {
throw new MochiKit.Async.AlreadyCalledError(this);
}
this.silentlyCancelled = false;
return;
}
},
callback: function (res) {
this._check();
if (res instanceof MochiKit.Async.Deferred) {
throw new Error("Deferred instances can only be chained if they are the result of a callback");
}
this._resback(res);
},
errback: function (res) {
this._check();
var self = MochiKit.Async;
if (res instanceof self.Deferred) {
throw new Error("Deferred instances can only be chained if they are the result of a callback");
}
if (!(res instanceof Error)) {
res = new self.GenericError(res);
}
this._resback(res);
},
addBoth: function (fn) {
if (arguments.length > 1) {
fn = MochiKit.Base.partial.apply(null, arguments);
}
return this.addCallbacks(fn, fn);
},
addCallback: function (fn) {
if (arguments.length > 1) {
fn = MochiKit.Base.partial.apply(null, arguments);
}
return this.addCallbacks(fn, null);
},
addErrback: function (fn) {
if (arguments.length > 1) {
fn = MochiKit.Base.partial.apply(null, arguments);
}
return this.addCallbacks(null, fn);
},
addCallbacks: function (cb, eb) {
if (this.chained) {
throw new Error("Chained Deferreds can not be re-used");
}
this.chain.push([cb, eb]);
if (this.fired >= 0) {
this._fire();
}
return this;
},
_fire: function () {
/***
Used internally to exhaust the callback sequence when a result
is available.
***/
var chain = this.chain;
var fired = this.fired;
var res = this.results[fired];
var self = this;
var cb = null;
while (chain.length > 0 && this.paused === 0) {
// Array
var pair = chain.shift();
var f = pair[fired];
if (f === null) {
continue;
}
try {
res = f(res);
fired = ((res instanceof Error) ? 1 : 0);
if (res instanceof MochiKit.Async.Deferred) {
cb = function (res) {
self._continue(res);
};
this._pause();
}
} catch (err) {
fired = 1;
if (!(err instanceof Error)) {
err = new MochiKit.Async.GenericError(err);
}
res = err;
}
}
this.fired = fired;
this.results[fired] = res;
if (cb && this.paused) {
// this is for "tail recursion" in case the dependent deferred
// is already fired
res.addBoth(cb);
res.chained = true;
}
}
};
MochiKit.Base.update(MochiKit.Async, {
evalJSONRequest: function (/* req */) {
return eval('(' + arguments[0].responseText + ')');
},
succeed: function (/* optional */result) {
var d = new MochiKit.Async.Deferred();
d.callback.apply(d, arguments);
return d;
},
fail: function (/* optional */result) {
var d = new MochiKit.Async.Deferred();
d.errback.apply(d, arguments);
return d;
},
getXMLHttpRequest: function () {
var self = arguments.callee;
if (!self.XMLHttpRequest) {
var tryThese = [
function () { return new XMLHttpRequest(); },
function () { return new ActiveXObject('Msxml2.XMLHTTP'); },
function () { return new ActiveXObject('Microsoft.XMLHTTP'); },
function () { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); },
function () {
throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest");
}
];
for (var i = 0; i < tryThese.length; i++) {
var func = tryThese[i];
try {
self.XMLHttpRequest = func;
return func();
} catch (e) {
// pass
}
}
}
return self.XMLHttpRequest();
},
_nothing: function () {},
_xhr_onreadystatechange: function (d) {
// MochiKit.Logging.logDebug('this.readyState', this.readyState);
if (this.readyState == 4) {
// IE SUCKS
try {
this.onreadystatechange = null;
} catch (e) {
try {
this.onreadystatechange = MochiKit.Async._nothing;
} catch (e) {
}
}
var status = null;
try {
status = this.status;
if (!status && MochiKit.Base.isNotEmpty(this.responseText)) {
// 0 or undefined seems to mean cached or local
status = 304;
}
} catch (e) {
// pass
// MochiKit.Logging.logDebug('error getting status?', repr(items(e)));
}
// 200 is OK, 304 is NOT_MODIFIED
if (status == 200 || status == 304) { // OK
d.callback(this);
} else {
var err = new MochiKit.Async.XMLHttpRequestError(this, "Request failed");
if (err.number) {
// XXX: This seems to happen on page change
d.errback(err);
} else {
// XXX: this seems to happen when the server is unreachable
d.errback(err);
}
}
}
},
_xhr_canceller: function (req) {
// IE SUCKS
try {
req.onreadystatechange = null;
} catch (e) {
try {
req.onreadystatechange = MochiKit.Async._nothing;
} catch (e) {
}
}
req.abort();
},
sendXMLHttpRequest: function (req, /* optional */ sendContent) {
if (typeof(sendContent) == "undefined" || sendContent === null) {
sendContent = "";
}
var m = MochiKit.Base;
var self = MochiKit.Async;
var d = new self.Deferred(m.partial(self._xhr_canceller, req));
try {
req.onreadystatechange = m.bind(self._xhr_onreadystatechange,
req, d);
req.send(sendContent);
} catch (e) {
try {
req.onreadystatechange = null;
} catch (ignore) {
// pass
}
d.errback(e);
}
return d;
},
doSimpleXMLHttpRequest: function (url/*, ...*/) {
var self = MochiKit.Async;
var req = self.getXMLHttpRequest();
if (arguments.length > 1) {
var m = MochiKit.Base;
var qs = m.queryString.apply(null, m.extend(null, arguments, 1));
if (qs) {
url += "?" + qs;
}
}
req.open("GET", url, true);
return self.sendXMLHttpRequest(req);
},
loadJSONDoc: function (url) {
var self = MochiKit.Async;
var d = self.doSimpleXMLHttpRequest.apply(self, arguments);
d = d.addCallback(self.evalJSONRequest);
return d;
},
wait: function (seconds, /* optional */value) {
var d = new MochiKit.Async.Deferred();
var m = MochiKit.Base;
if (typeof(value) != 'undefined') {
d.addCallback(function () { return value; });
}
var timeout = setTimeout(
m.bind("callback", d),
Math.floor(seconds * 1000));
d.canceller = function () {
try {
clearTimeout(timeout);
} catch (e) {
// pass
}
};
return d;
},
callLater: function (seconds, func) {
var m = MochiKit.Base;
var pfunc = m.partial.apply(m, m.extend(null, arguments, 1));
return MochiKit.Async.wait(seconds).addCallback(
function (res) { return pfunc(); }
);
}
});
MochiKit.Async.DeferredLock = function () {
this.waiting = [];
this.locked = false;
this.id = this._nextId();
};
MochiKit.Async.DeferredLock.prototype = {
__class__: MochiKit.Async.DeferredLock,
acquire: function () {
d = new MochiKit.Async.Deferred();
if (this.locked) {
this.waiting.push(d);
} else {
this.locked = true;
d.callback(this);
}
return d;
},
release: function () {
if (!this.locked) {
throw TypeError("Tried to release an unlocked DeferredLock");
}
this.locked = false;
if (this.waiting.length > 0) {
this.locked = true;
this.waiting.shift().callback(this);
}
},
_nextId: MochiKit.Base.counter(),
repr: function () {
var state;
if (this.locked) {
state = 'locked, ' + this.waiting.length + ' waiting';
} else {
state = 'unlocked';
}
return 'DeferredLock(' + this.id + ', ' + state + ')';
},
toString: MochiKit.Base.forwardCall("repr")
};
MochiKit.Async.DeferredList = function (list, /* optional */fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller) {
this.list = list;
this.resultList = new Array(this.list.length);
// Deferred init
this.chain = [];
this.id = this._nextId();
this.fired = -1;
this.paused = 0;
this.results = [null, null];
this.canceller = canceller;
this.silentlyCancelled = false;
if (this.list.length === 0 && !fireOnOneCallback) {
this.callback(this.resultList);
}
this.finishedCount = 0;
this.fireOnOneCallback = fireOnOneCallback;
this.fireOnOneErrback = fireOnOneErrback;
this.consumeErrors = consumeErrors;
var index = 0;
MochiKit.Base.map(MochiKit.Base.bind(function (d) {
d.addCallback(MochiKit.Base.bind(this._cbDeferred, this), index, true);
d.addErrback(MochiKit.Base.bind(this._cbDeferred, this), index, false);
index += 1;
}, this), this.list);
};
MochiKit.Base.update(MochiKit.Async.DeferredList.prototype,
MochiKit.Async.Deferred.prototype);
MochiKit.Base.update(MochiKit.Async.DeferredList.prototype, {
_cbDeferred: function (index, succeeded, result) {
this.resultList[index] = [succeeded, result];
this.finishedCount += 1;
if (this.fired !== 0) {
if (succeeded && this.fireOnOneCallback) {
this.callback([index, result]);
} else if (!succeeded && this.fireOnOneErrback) {
this.errback(result);
} else if (this.finishedCount == this.list.length) {
this.callback(this.resultList);
}
}
if (!succeeded && this.consumeErrors) {
result = null;
}
return result;
}
});
MochiKit.Async.gatherResults = function (deferredList) {
var d = new MochiKit.Async.DeferredList(deferredList, false, true, false);
d.addCallback(function (results) {
var ret = [];
for (var i = 0; i < results.length; i++) {
ret.push(results[i][1]);
}
return ret;
});
return d;
};
MochiKit.Async.maybeDeferred = function (func) {
var self = MochiKit.Async;
var result;
try {
var r = func.apply(null, MochiKit.Base.extend([], arguments, 1));
if (r instanceof self.Deferred) {
result = r;
} else if (r instanceof Error) {
result = self.fail(r);
} else {
result = self.succeed(r);
}
} catch (e) {
result = self.fail(e);
}
return result;
};
MochiKit.Async.EXPORT = [
"AlreadyCalledError",
"CancelledError",
"BrowserComplianceError",
"GenericError",
"XMLHttpRequestError",
"Deferred",
"succeed",
"fail",
"getXMLHttpRequest",
"doSimpleXMLHttpRequest",
"loadJSONDoc",
"wait",
"callLater",
"sendXMLHttpRequest",
"DeferredLock",
"DeferredList",
"gatherResults",
"maybeDeferred"
];
MochiKit.Async.EXPORT_OK = [
"evalJSONRequest"
];
MochiKit.Async.__new__ = function () {
var m = MochiKit.Base;
var ne = m.partial(m._newNamedError, this);
ne("AlreadyCalledError",
function (deferred) {
/***
Raised by the Deferred if callback or errback happens
after it was already fired.
***/
this.deferred = deferred;
}
);
ne("CancelledError",
function (deferred) {
/***
Raised by the Deferred cancellation mechanism.
***/
this.deferred = deferred;
}
);
ne("BrowserComplianceError",
function (msg) {
/***
Raised when the JavaScript runtime is not capable of performing
the given function. Technically, this should really never be
raised because a non-conforming JavaScript runtime probably
isn't going to support exceptions in the first place.
***/
this.message = msg;
}
);
ne("GenericError",
function (msg) {
this.message = msg;
}
);
ne("XMLHttpRequestError",
function (req, msg) {
/***
Raised when an XMLHttpRequest does not complete for any reason.
***/
this.req = req;
this.message = msg;
try {
// Strange but true that this can raise in some cases.
this.number = req.status;
} catch (e) {
// pass
}
}
);
this.EXPORT_TAGS = {
":common": this.EXPORT,
":all": m.concat(this.EXPORT, this.EXPORT_OK)
};
m.nameFunctions(this);
};
MochiKit.Async.__new__();
MochiKit.Base._exportSymbols(this, MochiKit.Async);

File diff suppressed because it is too large Load Diff

View File

@@ -1,825 +0,0 @@
/***
MochiKit.Color 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito and others. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.Color');
dojo.require('MochiKit.Base');
}
if (typeof(JSAN) != 'undefined') {
JSAN.use("MochiKit.Base", []);
}
try {
if (typeof(MochiKit.Base) == 'undefined') {
throw "";
}
} catch (e) {
throw "MochiKit.Color depends on MochiKit.Base";
}
if (typeof(MochiKit.Color) == "undefined") {
MochiKit.Color = {};
}
MochiKit.Color.NAME = "MochiKit.Color";
MochiKit.Color.VERSION = "1.3.1";
MochiKit.Color.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.Color.toString = function () {
return this.__repr__();
};
MochiKit.Color.Color = function (red, green, blue, alpha) {
if (typeof(alpha) == 'undefined' || alpha === null) {
alpha = 1.0;
}
this.rgb = {
r: red,
g: green,
b: blue,
a: alpha
};
};
// Prototype methods
MochiKit.Color.Color.prototype = {
__class__: MochiKit.Color.Color,
colorWithAlpha: function (alpha) {
var rgb = this.rgb;
var m = MochiKit.Color;
return m.Color.fromRGB(rgb.r, rgb.g, rgb.b, alpha);
},
colorWithHue: function (hue) {
// get an HSL model, and set the new hue...
var hsl = this.asHSL();
hsl.h = hue;
var m = MochiKit.Color;
// convert back to RGB...
return m.Color.fromHSL(hsl);
},
colorWithSaturation: function (saturation) {
// get an HSL model, and set the new hue...
var hsl = this.asHSL();
hsl.s = saturation;
var m = MochiKit.Color;
// convert back to RGB...
return m.Color.fromHSL(hsl);
},
colorWithLightness: function (lightness) {
// get an HSL model, and set the new hue...
var hsl = this.asHSL();
hsl.l = lightness;
var m = MochiKit.Color;
// convert back to RGB...
return m.Color.fromHSL(hsl);
},
darkerColorWithLevel: function (level) {
var hsl = this.asHSL();
hsl.l = Math.max(hsl.l - level, 0);
var m = MochiKit.Color;
return m.Color.fromHSL(hsl);
},
lighterColorWithLevel: function (level) {
var hsl = this.asHSL();
hsl.l = Math.min(hsl.l + level, 1);
var m = MochiKit.Color;
return m.Color.fromHSL(hsl);
},
blendedColor: function (other, /* optional */ fraction) {
if (typeof(fraction) == 'undefined' || fraction === null) {
fraction = 0.5;
}
var sf = 1.0 - fraction;
var s = this.rgb;
var d = other.rgb;
var df = fraction;
return MochiKit.Color.Color.fromRGB(
(s.r * sf) + (d.r * df),
(s.g * sf) + (d.g * df),
(s.b * sf) + (d.b * df),
(s.a * sf) + (d.a * df)
);
},
compareRGB: function (other) {
var a = this.asRGB();
var b = other.asRGB();
return MochiKit.Base.compare(
[a.r, a.g, a.b, a.a],
[b.r, b.g, b.b, b.a]
);
},
isLight: function () {
return this.asHSL().b > 0.5;
},
isDark: function () {
return (!this.isLight());
},
toHSLString: function () {
var c = this.asHSL();
var ccc = MochiKit.Color.clampColorComponent;
var rval = this._hslString;
if (!rval) {
var mid = (
ccc(c.h, 360).toFixed(0)
+ "," + ccc(c.s, 100).toPrecision(4) + "%"
+ "," + ccc(c.l, 100).toPrecision(4) + "%"
);
var a = c.a;
if (a >= 1) {
a = 1;
rval = "hsl(" + mid + ")";
} else {
if (a <= 0) {
a = 0;
}
rval = "hsla(" + mid + "," + a + ")";
}
this._hslString = rval;
}
return rval;
},
toRGBString: function () {
var c = this.rgb;
var ccc = MochiKit.Color.clampColorComponent;
var rval = this._rgbString;
if (!rval) {
var mid = (
ccc(c.r, 255).toFixed(0)
+ "," + ccc(c.g, 255).toFixed(0)
+ "," + ccc(c.b, 255).toFixed(0)
);
if (c.a != 1) {
rval = "rgba(" + mid + "," + c.a + ")";
} else {
rval = "rgb(" + mid + ")";
}
this._rgbString = rval;
}
return rval;
},
asRGB: function () {
return MochiKit.Base.clone(this.rgb);
},
toHexString: function () {
var m = MochiKit.Color;
var c = this.rgb;
var ccc = MochiKit.Color.clampColorComponent;
var rval = this._hexString;
if (!rval) {
rval = ("#" +
m.toColorPart(ccc(c.r, 255)) +
m.toColorPart(ccc(c.g, 255)) +
m.toColorPart(ccc(c.b, 255))
);
this._hexString = rval;
}
return rval;
},
asHSV: function () {
var hsv = this.hsv;
var c = this.rgb;
if (typeof(hsv) == 'undefined' || hsv === null) {
hsv = MochiKit.Color.rgbToHSV(this.rgb);
this.hsv = hsv;
}
return MochiKit.Base.clone(hsv);
},
asHSL: function () {
var hsl = this.hsl;
var c = this.rgb;
if (typeof(hsl) == 'undefined' || hsl === null) {
hsl = MochiKit.Color.rgbToHSL(this.rgb);
this.hsl = hsl;
}
return MochiKit.Base.clone(hsl);
},
toString: function () {
return this.toRGBString();
},
repr: function () {
var c = this.rgb;
var col = [c.r, c.g, c.b, c.a];
return this.__class__.NAME + "(" + col.join(", ") + ")";
}
};
// Constructor methods
MochiKit.Base.update(MochiKit.Color.Color, {
fromRGB: function (red, green, blue, alpha) {
// designated initializer
var Color = MochiKit.Color.Color;
if (arguments.length == 1) {
var rgb = red;
red = rgb.r;
green = rgb.g;
blue = rgb.b;
if (typeof(rgb.a) == 'undefined') {
alpha = undefined;
} else {
alpha = rgb.a;
}
}
return new Color(red, green, blue, alpha);
},
fromHSL: function (hue, saturation, lightness, alpha) {
var m = MochiKit.Color;
return m.Color.fromRGB(m.hslToRGB.apply(m, arguments));
},
fromHSV: function (hue, saturation, value, alpha) {
var m = MochiKit.Color;
return m.Color.fromRGB(m.hsvToRGB.apply(m, arguments));
},
fromName: function (name) {
var Color = MochiKit.Color.Color;
// Opera 9 seems to "quote" named colors(?!)
if (name.charAt(0) == '"') {
name = name.substr(1, name.length - 2);
}
var htmlColor = Color._namedColors[name.toLowerCase()];
if (typeof(htmlColor) == 'string') {
return Color.fromHexString(htmlColor);
} else if (name == "transparent") {
return Color.transparentColor();
}
return null;
},
fromString: function (colorString) {
var self = MochiKit.Color.Color;
var three = colorString.substr(0, 3);
if (three == "rgb") {
return self.fromRGBString(colorString);
} else if (three == "hsl") {
return self.fromHSLString(colorString);
} else if (colorString.charAt(0) == "#") {
return self.fromHexString(colorString);
}
return self.fromName(colorString);
},
fromHexString: function (hexCode) {
if (hexCode.charAt(0) == '#') {
hexCode = hexCode.substring(1);
}
var components = [];
var i, hex;
if (hexCode.length == 3) {
for (i = 0; i < 3; i++) {
hex = hexCode.substr(i, 1);
components.push(parseInt(hex + hex, 16) / 255.0);
}
} else {
for (i = 0; i < 6; i += 2) {
hex = hexCode.substr(i, 2);
components.push(parseInt(hex, 16) / 255.0);
}
}
var Color = MochiKit.Color.Color;
return Color.fromRGB.apply(Color, components);
},
_fromColorString: function (pre, method, scales, colorCode) {
// parses either HSL or RGB
if (colorCode.indexOf(pre) === 0) {
colorCode = colorCode.substring(colorCode.indexOf("(", 3) + 1, colorCode.length - 1);
}
var colorChunks = colorCode.split(/\s*,\s*/);
var colorFloats = [];
for (var i = 0; i < colorChunks.length; i++) {
var c = colorChunks[i];
var val;
var three = c.substring(c.length - 3);
if (c.charAt(c.length - 1) == '%') {
val = 0.01 * parseFloat(c.substring(0, c.length - 1));
} else if (three == "deg") {
val = parseFloat(c) / 360.0;
} else if (three == "rad") {
val = parseFloat(c) / (Math.PI * 2);
} else {
val = scales[i] * parseFloat(c);
}
colorFloats.push(val);
}
return this[method].apply(this, colorFloats);
},
fromComputedStyle: function (elem, style, mozillaEquivalentCSS) {
var d = MochiKit.DOM;
var cls = MochiKit.Color.Color;
for (elem = d.getElement(elem); elem; elem = elem.parentNode) {
var actualColor = d.computedStyle.apply(d, arguments);
if (!actualColor) {
continue;
}
var color = cls.fromString(actualColor);
if (!color) {
break;
}
if (color.asRGB().a > 0) {
return color;
}
}
return null;
},
fromBackground: function (elem) {
var cls = MochiKit.Color.Color;
return cls.fromComputedStyle(
elem, "backgroundColor", "background-color") || cls.whiteColor();
},
fromText: function (elem) {
var cls = MochiKit.Color.Color;
return cls.fromComputedStyle(
elem, "color", "color") || cls.blackColor();
},
namedColors: function () {
return MochiKit.Base.clone(MochiKit.Color.Color._namedColors);
}
});
// Module level functions
MochiKit.Base.update(MochiKit.Color, {
clampColorComponent: function (v, scale) {
v *= scale;
if (v < 0) {
return 0;
} else if (v > scale) {
return scale;
} else {
return v;
}
},
_hslValue: function (n1, n2, hue) {
if (hue > 6.0) {
hue -= 6.0;
} else if (hue < 0.0) {
hue += 6.0;
}
var val;
if (hue < 1.0) {
val = n1 + (n2 - n1) * hue;
} else if (hue < 3.0) {
val = n2;
} else if (hue < 4.0) {
val = n1 + (n2 - n1) * (4.0 - hue);
} else {
val = n1;
}
return val;
},
hsvToRGB: function (hue, saturation, value, alpha) {
if (arguments.length == 1) {
var hsv = hue;
hue = hsv.h;
saturation = hsv.s;
value = hsv.v;
alpha = hsv.a;
}
var red;
var green;
var blue;
if (saturation === 0) {
red = 0;
green = 0;
blue = 0;
} else {
var i = Math.floor(hue * 6);
var f = (hue * 6) - i;
var p = value * (1 - saturation);
var q = value * (1 - (saturation * f));
var t = value * (1 - (saturation * (1 - f)));
switch (i) {
case 1: red = q; green = value; blue = p; break;
case 2: red = p; green = value; blue = t; break;
case 3: red = p; green = q; blue = value; break;
case 4: red = t; green = p; blue = value; break;
case 5: red = value; green = p; blue = q; break;
case 6: // fall through
case 0: red = value; green = t; blue = p; break;
}
}
return {
r: red,
g: green,
b: blue,
a: alpha
};
},
hslToRGB: function (hue, saturation, lightness, alpha) {
if (arguments.length == 1) {
var hsl = hue;
hue = hsl.h;
saturation = hsl.s;
lightness = hsl.l;
alpha = hsl.a;
}
var red;
var green;
var blue;
if (saturation === 0) {
red = lightness;
green = lightness;
blue = lightness;
} else {
var m2;
if (lightness <= 0.5) {
m2 = lightness * (1.0 + saturation);
} else {
m2 = lightness + saturation - (lightness * saturation);
}
var m1 = (2.0 * lightness) - m2;
var f = MochiKit.Color._hslValue;
var h6 = hue * 6.0;
red = f(m1, m2, h6 + 2);
green = f(m1, m2, h6);
blue = f(m1, m2, h6 - 2);
}
return {
r: red,
g: green,
b: blue,
a: alpha
};
},
rgbToHSV: function (red, green, blue, alpha) {
if (arguments.length == 1) {
var rgb = red;
red = rgb.r;
green = rgb.g;
blue = rgb.b;
alpha = rgb.a;
}
var max = Math.max(Math.max(red, green), blue);
var min = Math.min(Math.min(red, green), blue);
var hue;
var saturation;
var value = max;
if (min == max) {
hue = 0;
saturation = 0;
} else {
var delta = (max - min);
saturation = delta / max;
if (red == max) {
hue = (green - blue) / delta;
} else if (green == max) {
hue = 2 + ((blue - red) / delta);
} else {
hue = 4 + ((red - green) / delta);
}
hue /= 6;
if (hue < 0) {
hue += 1;
}
if (hue > 1) {
hue -= 1;
}
}
return {
h: hue,
s: saturation,
v: value,
a: alpha
};
},
rgbToHSL: function (red, green, blue, alpha) {
if (arguments.length == 1) {
var rgb = red;
red = rgb.r;
green = rgb.g;
blue = rgb.b;
alpha = rgb.a;
}
var max = Math.max(red, Math.max(green, blue));
var min = Math.min(red, Math.min(green, blue));
var hue;
var saturation;
var lightness = (max + min) / 2.0;
var delta = max - min;
if (delta === 0) {
hue = 0;
saturation = 0;
} else {
if (lightness <= 0.5) {
saturation = delta / (max + min);
} else {
saturation = delta / (2 - max - min);
}
if (red == max) {
hue = (green - blue) / delta;
} else if (green == max) {
hue = 2 + ((blue - red) / delta);
} else {
hue = 4 + ((red - green) / delta);
}
hue /= 6;
if (hue < 0) {
hue += 1;
}
if (hue > 1) {
hue -= 1;
}
}
return {
h: hue,
s: saturation,
l: lightness,
a: alpha
};
},
toColorPart: function (num) {
num = Math.round(num);
var digits = num.toString(16);
if (num < 16) {
return '0' + digits;
}
return digits;
},
__new__: function () {
var m = MochiKit.Base;
this.Color.fromRGBString = m.bind(
this.Color._fromColorString, this.Color, "rgb", "fromRGB",
[1.0/255.0, 1.0/255.0, 1.0/255.0, 1]
);
this.Color.fromHSLString = m.bind(
this.Color._fromColorString, this.Color, "hsl", "fromHSL",
[1.0/360.0, 0.01, 0.01, 1]
);
var third = 1.0 / 3.0;
var colors = {
// NSColor colors plus transparent
black: [0, 0, 0],
blue: [0, 0, 1],
brown: [0.6, 0.4, 0.2],
cyan: [0, 1, 1],
darkGray: [third, third, third],
gray: [0.5, 0.5, 0.5],
green: [0, 1, 0],
lightGray: [2 * third, 2 * third, 2 * third],
magenta: [1, 0, 1],
orange: [1, 0.5, 0],
purple: [0.5, 0, 0.5],
red: [1, 0, 0],
transparent: [0, 0, 0, 0],
white: [1, 1, 1],
yellow: [1, 1, 0]
};
var makeColor = function (name, r, g, b, a) {
var rval = this.fromRGB(r, g, b, a);
this[name] = function () { return rval; };
return rval;
};
for (var k in colors) {
var name = k + "Color";
var bindArgs = m.concat(
[makeColor, this.Color, name],
colors[k]
);
this.Color[name] = m.bind.apply(null, bindArgs);
}
var isColor = function () {
for (var i = 0; i < arguments.length; i++) {
if (!(arguments[i] instanceof Color)) {
return false;
}
}
return true;
};
var compareColor = function (a, b) {
return a.compareRGB(b);
};
m.nameFunctions(this);
m.registerComparator(this.Color.NAME, isColor, compareColor);
this.EXPORT_TAGS = {
":common": this.EXPORT,
":all": m.concat(this.EXPORT, this.EXPORT_OK)
};
}
});
MochiKit.Color.EXPORT = [
"Color"
];
MochiKit.Color.EXPORT_OK = [
"clampColorComponent",
"rgbToHSL",
"hslToRGB",
"rgbToHSV",
"hsvToRGB",
"toColorPart"
];
MochiKit.Color.__new__();
MochiKit.Base._exportSymbols(this, MochiKit.Color);
// Full table of css3 X11 colors <http://www.w3.org/TR/css3-color/#X11COLORS>
MochiKit.Color.Color._namedColors = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
gold: "#ffd700",
goldenrod: "#daa520",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavender: "#e6e6fa",
lavenderblush: "#fff0f5",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,208 +0,0 @@
/***
MochiKit.DateTime 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.DateTime');
}
if (typeof(MochiKit) == 'undefined') {
MochiKit = {};
}
if (typeof(MochiKit.DateTime) == 'undefined') {
MochiKit.DateTime = {};
}
MochiKit.DateTime.NAME = "MochiKit.DateTime";
MochiKit.DateTime.VERSION = "1.3.1";
MochiKit.DateTime.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.DateTime.toString = function () {
return this.__repr__();
};
MochiKit.DateTime.isoDate = function (str) {
str = str + "";
if (typeof(str) != "string" || str.length === 0) {
return null;
}
var iso = str.split('-');
if (iso.length === 0) {
return null;
}
return new Date(iso[0], iso[1] - 1, iso[2]);
};
MochiKit.DateTime._isoRegexp = /(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/;
MochiKit.DateTime.isoTimestamp = function (str) {
str = str + "";
if (typeof(str) != "string" || str.length === 0) {
return null;
}
var res = str.match(MochiKit.DateTime._isoRegexp);
if (typeof(res) == "undefined" || res === null) {
return null;
}
var year, month, day, hour, min, sec, msec;
year = parseInt(res[1], 10);
if (typeof(res[2]) == "undefined" || res[2] === '') {
return new Date(year);
}
month = parseInt(res[2], 10) - 1;
day = parseInt(res[3], 10);
if (typeof(res[4]) == "undefined" || res[4] === '') {
return new Date(year, month, day);
}
hour = parseInt(res[4], 10);
min = parseInt(res[5], 10);
sec = (typeof(res[6]) != "undefined" && res[6] !== '') ? parseInt(res[6], 10) : 0;
if (typeof(res[7]) != "undefined" && res[7] !== '') {
msec = Math.round(1000.0 * parseFloat("0." + res[7]));
} else {
msec = 0;
}
if ((typeof(res[8]) == "undefined" || res[8] === '') && (typeof(res[9]) == "undefined" || res[9] === '')) {
return new Date(year, month, day, hour, min, sec, msec);
}
var ofs;
if (typeof(res[9]) != "undefined" && res[9] !== '') {
ofs = parseInt(res[10], 10) * 3600000;
if (typeof(res[11]) != "undefined" && res[11] !== '') {
ofs += parseInt(res[11], 10) * 60000;
}
if (res[9] == "-") {
ofs = -ofs;
}
} else {
ofs = 0;
}
return new Date(Date.UTC(year, month, day, hour, min, sec, msec) - ofs);
};
MochiKit.DateTime.toISOTime = function (date, realISO/* = false */) {
if (typeof(date) == "undefined" || date === null) {
return null;
}
var hh = date.getHours();
var mm = date.getMinutes();
var ss = date.getSeconds();
var lst = [
((realISO && (hh < 10)) ? "0" + hh : hh),
((mm < 10) ? "0" + mm : mm),
((ss < 10) ? "0" + ss : ss)
];
return lst.join(":");
};
MochiKit.DateTime.toISOTimestamp = function (date, realISO/* = false*/) {
if (typeof(date) == "undefined" || date === null) {
return null;
}
var sep = realISO ? "T" : " ";
var foot = realISO ? "Z" : "";
if (realISO) {
date = new Date(date.getTime() + (date.getTimezoneOffset() * 60000));
}
return MochiKit.DateTime.toISODate(date) + sep + MochiKit.DateTime.toISOTime(date, realISO) + foot;
};
MochiKit.DateTime.toISODate = function (date) {
if (typeof(date) == "undefined" || date === null) {
return null;
}
var _padTwo = MochiKit.DateTime._padTwo;
return [
date.getFullYear(),
_padTwo(date.getMonth() + 1),
_padTwo(date.getDate())
].join("-");
};
MochiKit.DateTime.americanDate = function (d) {
d = d + "";
if (typeof(d) != "string" || d.length === 0) {
return null;
}
var a = d.split('/');
return new Date(a[2], a[0] - 1, a[1]);
};
MochiKit.DateTime._padTwo = function (n) {
return (n > 9) ? n : "0" + n;
};
MochiKit.DateTime.toPaddedAmericanDate = function (d) {
if (typeof(d) == "undefined" || d === null) {
return null;
}
var _padTwo = MochiKit.DateTime._padTwo;
return [
_padTwo(d.getMonth() + 1),
_padTwo(d.getDate()),
d.getFullYear()
].join('/');
};
MochiKit.DateTime.toAmericanDate = function (d) {
if (typeof(d) == "undefined" || d === null) {
return null;
}
return [d.getMonth() + 1, d.getDate(), d.getFullYear()].join('/');
};
MochiKit.DateTime.EXPORT = [
"isoDate",
"isoTimestamp",
"toISOTime",
"toISOTimestamp",
"toISODate",
"americanDate",
"toPaddedAmericanDate",
"toAmericanDate"
];
MochiKit.DateTime.EXPORT_OK = [];
MochiKit.DateTime.EXPORT_TAGS = {
":common": MochiKit.DateTime.EXPORT,
":all": MochiKit.DateTime.EXPORT
};
MochiKit.DateTime.__new__ = function () {
// MochiKit.Base.nameFunctions(this);
var base = this.NAME + ".";
for (var k in this) {
var o = this[k];
if (typeof(o) == 'function' && typeof(o.NAME) == 'undefined') {
try {
o.NAME = base + k;
} catch (e) {
// pass
}
}
}
};
MochiKit.DateTime.__new__();
if (typeof(MochiKit.Base) != "undefined") {
MochiKit.Base._exportSymbols(this, MochiKit.DateTime);
} else {
(function (globals, module) {
if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined')
|| (typeof(MochiKit.__compat__) == 'boolean' && MochiKit.__compat__)) {
var all = module.EXPORT_TAGS[":all"];
for (var i = 0; i < all.length; i++) {
globals[all[i]] = module[all[i]];
}
}
})(this, MochiKit.DateTime);
}

View File

@@ -1,294 +0,0 @@
/***
MochiKit.Format 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.Format');
}
if (typeof(MochiKit) == 'undefined') {
MochiKit = {};
}
if (typeof(MochiKit.Format) == 'undefined') {
MochiKit.Format = {};
}
MochiKit.Format.NAME = "MochiKit.Format";
MochiKit.Format.VERSION = "1.3.1";
MochiKit.Format.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.Format.toString = function () {
return this.__repr__();
};
MochiKit.Format._numberFormatter = function (placeholder, header, footer, locale, isPercent, precision, leadingZeros, separatorAt, trailingZeros) {
return function (num) {
num = parseFloat(num);
if (typeof(num) == "undefined" || num === null || isNaN(num)) {
return placeholder;
}
var curheader = header;
var curfooter = footer;
if (num < 0) {
num = -num;
} else {
curheader = curheader.replace(/-/, "");
}
var me = arguments.callee;
var fmt = MochiKit.Format.formatLocale(locale);
if (isPercent) {
num = num * 100.0;
curfooter = fmt.percent + curfooter;
}
num = MochiKit.Format.roundToFixed(num, precision);
var parts = num.split(/\./);
var whole = parts[0];
var frac = (parts.length == 1) ? "" : parts[1];
var res = "";
while (whole.length < leadingZeros) {
whole = "0" + whole;
}
if (separatorAt) {
while (whole.length > separatorAt) {
var i = whole.length - separatorAt;
//res = res + fmt.separator + whole.substring(i, whole.length);
res = fmt.separator + whole.substring(i, whole.length) + res;
whole = whole.substring(0, i);
}
}
res = whole + res;
if (precision > 0) {
while (frac.length < trailingZeros) {
frac = frac + "0";
}
res = res + fmt.decimal + frac;
}
return curheader + res + curfooter;
};
};
MochiKit.Format.numberFormatter = function (pattern, placeholder/* = "" */, locale/* = "default" */) {
// http://java.sun.com/docs/books/tutorial/i18n/format/numberpattern.html
// | 0 | leading or trailing zeros
// | # | just the number
// | , | separator
// | . | decimal separator
// | % | Multiply by 100 and format as percent
if (typeof(placeholder) == "undefined") {
placeholder = "";
}
var match = pattern.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/);
if (!match) {
throw TypeError("Invalid pattern");
}
var header = pattern.substr(0, match.index);
var footer = pattern.substr(match.index + match[0].length);
if (header.search(/-/) == -1) {
header = header + "-";
}
var whole = match[1];
var frac = (typeof(match[2]) == "string" && match[2] != "") ? match[2] : "";
var isPercent = (typeof(match[3]) == "string" && match[3] != "");
var tmp = whole.split(/,/);
var separatorAt;
if (typeof(locale) == "undefined") {
locale = "default";
}
if (tmp.length == 1) {
separatorAt = null;
} else {
separatorAt = tmp[1].length;
}
var leadingZeros = whole.length - whole.replace(/0/g, "").length;
var trailingZeros = frac.length - frac.replace(/0/g, "").length;
var precision = frac.length;
var rval = MochiKit.Format._numberFormatter(
placeholder, header, footer, locale, isPercent, precision,
leadingZeros, separatorAt, trailingZeros
);
var m = MochiKit.Base;
if (m) {
var fn = arguments.callee;
var args = m.concat(arguments);
rval.repr = function () {
return [
self.NAME,
"(",
map(m.repr, args).join(", "),
")"
].join("");
};
}
return rval;
};
MochiKit.Format.formatLocale = function (locale) {
if (typeof(locale) == "undefined" || locale === null) {
locale = "default";
}
if (typeof(locale) == "string") {
var rval = MochiKit.Format.LOCALE[locale];
if (typeof(rval) == "string") {
rval = arguments.callee(rval);
MochiKit.Format.LOCALE[locale] = rval;
}
return rval;
} else {
return locale;
}
};
MochiKit.Format.twoDigitAverage = function (numerator, denominator) {
if (denominator) {
var res = numerator / denominator;
if (!isNaN(res)) {
return MochiKit.Format.twoDigitFloat(numerator / denominator);
}
}
return "0";
};
MochiKit.Format.twoDigitFloat = function (someFloat) {
var sign = (someFloat < 0 ? '-' : '');
var s = Math.floor(Math.abs(someFloat) * 100).toString();
if (s == '0') {
return s;
}
if (s.length < 3) {
while (s.charAt(s.length - 1) == '0') {
s = s.substring(0, s.length - 1);
}
return sign + '0.' + s;
}
var head = sign + s.substring(0, s.length - 2);
var tail = s.substring(s.length - 2, s.length);
if (tail == '00') {
return head;
} else if (tail.charAt(1) == '0') {
return head + '.' + tail.charAt(0);
} else {
return head + '.' + tail;
}
};
MochiKit.Format.lstrip = function (str, /* optional */chars) {
str = str + "";
if (typeof(str) != "string") {
return null;
}
if (!chars) {
return str.replace(/^\s+/, "");
} else {
return str.replace(new RegExp("^[" + chars + "]+"), "");
}
};
MochiKit.Format.rstrip = function (str, /* optional */chars) {
str = str + "";
if (typeof(str) != "string") {
return null;
}
if (!chars) {
return str.replace(/\s+$/, "");
} else {
return str.replace(new RegExp("[" + chars + "]+$"), "");
}
};
MochiKit.Format.strip = function (str, /* optional */chars) {
var self = MochiKit.Format;
return self.rstrip(self.lstrip(str, chars), chars);
};
MochiKit.Format.truncToFixed = function (aNumber, precision) {
aNumber = Math.floor(aNumber * Math.pow(10, precision));
var res = (aNumber * Math.pow(10, -precision)).toFixed(precision);
if (res.charAt(0) == ".") {
res = "0" + res;
}
return res;
};
MochiKit.Format.roundToFixed = function (aNumber, precision) {
return MochiKit.Format.truncToFixed(
aNumber + 0.5 * Math.pow(10, -precision),
precision
);
};
MochiKit.Format.percentFormat = function (someFloat) {
return MochiKit.Format.twoDigitFloat(100 * someFloat) + '%';
};
MochiKit.Format.EXPORT = [
"truncToFixed",
"roundToFixed",
"numberFormatter",
"formatLocale",
"twoDigitAverage",
"twoDigitFloat",
"percentFormat",
"lstrip",
"rstrip",
"strip"
];
MochiKit.Format.LOCALE = {
en_US: {separator: ",", decimal: ".", percent: "%"},
de_DE: {separator: ".", decimal: ",", percent: "%"},
fr_FR: {separator: " ", decimal: ",", percent: "%"},
"default": "en_US"
};
MochiKit.Format.EXPORT_OK = [];
MochiKit.Format.EXPORT_TAGS = {
':all': MochiKit.Format.EXPORT,
':common': MochiKit.Format.EXPORT
};
MochiKit.Format.__new__ = function () {
// MochiKit.Base.nameFunctions(this);
var base = this.NAME + ".";
var k, v, o;
for (k in this.LOCALE) {
o = this.LOCALE[k];
if (typeof(o) == "object") {
o.repr = function () { return this.NAME; };
o.NAME = base + "LOCALE." + k;
}
}
for (k in this) {
o = this[k];
if (typeof(o) == 'function' && typeof(o.NAME) == 'undefined') {
try {
o.NAME = base + k;
} catch (e) {
// pass
}
}
}
};
MochiKit.Format.__new__();
if (typeof(MochiKit.Base) != "undefined") {
MochiKit.Base._exportSymbols(this, MochiKit.Format);
} else {
(function (globals, module) {
if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined')
|| (typeof(MochiKit.__compat__) == 'boolean' && MochiKit.__compat__)) {
var all = module.EXPORT_TAGS[":all"];
for (var i = 0; i < all.length; i++) {
globals[all[i]] = module[all[i]];
}
}
})(this, MochiKit.Format);
}

View File

@@ -1,789 +0,0 @@
/***
MochiKit.Iter 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.Iter');
dojo.require('MochiKit.Base');
}
if (typeof(JSAN) != 'undefined') {
JSAN.use("MochiKit.Base", []);
}
try {
if (typeof(MochiKit.Base) == 'undefined') {
throw "";
}
} catch (e) {
throw "MochiKit.Iter depends on MochiKit.Base!";
}
if (typeof(MochiKit.Iter) == 'undefined') {
MochiKit.Iter = {};
}
MochiKit.Iter.NAME = "MochiKit.Iter";
MochiKit.Iter.VERSION = "1.3.1";
MochiKit.Base.update(MochiKit.Iter, {
__repr__: function () {
return "[" + this.NAME + " " + this.VERSION + "]";
},
toString: function () {
return this.__repr__();
},
registerIteratorFactory: function (name, check, iterfactory, /* optional */ override) {
MochiKit.Iter.iteratorRegistry.register(name, check, iterfactory, override);
},
iter: function (iterable, /* optional */ sentinel) {
var self = MochiKit.Iter;
if (arguments.length == 2) {
return self.takewhile(
function (a) { return a != sentinel; },
iterable
);
}
if (typeof(iterable.next) == 'function') {
return iterable;
} else if (typeof(iterable.iter) == 'function') {
return iterable.iter();
}
try {
return self.iteratorRegistry.match(iterable);
} catch (e) {
var m = MochiKit.Base;
if (e == m.NotFound) {
e = new TypeError(typeof(iterable) + ": " + m.repr(iterable) + " is not iterable");
}
throw e;
}
},
count: function (n) {
if (!n) {
n = 0;
}
var m = MochiKit.Base;
return {
repr: function () { return "count(" + n + ")"; },
toString: m.forwardCall("repr"),
next: m.counter(n)
};
},
cycle: function (p) {
var self = MochiKit.Iter;
var m = MochiKit.Base;
var lst = [];
var iterator = self.iter(p);
return {
repr: function () { return "cycle(...)"; },
toString: m.forwardCall("repr"),
next: function () {
try {
var rval = iterator.next();
lst.push(rval);
return rval;
} catch (e) {
if (e != self.StopIteration) {
throw e;
}
if (lst.length === 0) {
this.next = function () {
throw self.StopIteration;
};
} else {
var i = -1;
this.next = function () {
i = (i + 1) % lst.length;
return lst[i];
};
}
return this.next();
}
}
};
},
repeat: function (elem, /* optional */n) {
var m = MochiKit.Base;
if (typeof(n) == 'undefined') {
return {
repr: function () {
return "repeat(" + m.repr(elem) + ")";
},
toString: m.forwardCall("repr"),
next: function () {
return elem;
}
};
}
return {
repr: function () {
return "repeat(" + m.repr(elem) + ", " + n + ")";
},
toString: m.forwardCall("repr"),
next: function () {
if (n <= 0) {
throw MochiKit.Iter.StopIteration;
}
n -= 1;
return elem;
}
};
},
next: function (iterator) {
return iterator.next();
},
izip: function (p, q/*, ...*/) {
var m = MochiKit.Base;
var next = MochiKit.Iter.next;
var iterables = m.map(iter, arguments);
return {
repr: function () { return "izip(...)"; },
toString: m.forwardCall("repr"),
next: function () { return m.map(next, iterables); }
};
},
ifilter: function (pred, seq) {
var m = MochiKit.Base;
seq = MochiKit.Iter.iter(seq);
if (pred === null) {
pred = m.operator.truth;
}
return {
repr: function () { return "ifilter(...)"; },
toString: m.forwardCall("repr"),
next: function () {
while (true) {
var rval = seq.next();
if (pred(rval)) {
return rval;
}
}
// mozilla warnings aren't too bright
return undefined;
}
};
},
ifilterfalse: function (pred, seq) {
var m = MochiKit.Base;
seq = MochiKit.Iter.iter(seq);
if (pred === null) {
pred = m.operator.truth;
}
return {
repr: function () { return "ifilterfalse(...)"; },
toString: m.forwardCall("repr"),
next: function () {
while (true) {
var rval = seq.next();
if (!pred(rval)) {
return rval;
}
}
// mozilla warnings aren't too bright
return undefined;
}
};
},
islice: function (seq/*, [start,] stop[, step] */) {
var self = MochiKit.Iter;
var m = MochiKit.Base;
seq = self.iter(seq);
var start = 0;
var stop = 0;
var step = 1;
var i = -1;
if (arguments.length == 2) {
stop = arguments[1];
} else if (arguments.length == 3) {
start = arguments[1];
stop = arguments[2];
} else {
start = arguments[1];
stop = arguments[2];
step = arguments[3];
}
return {
repr: function () {
return "islice(" + ["...", start, stop, step].join(", ") + ")";
},
toString: m.forwardCall("repr"),
next: function () {
var rval;
while (i < start) {
rval = seq.next();
i++;
}
if (start >= stop) {
throw self.StopIteration;
}
start += step;
return rval;
}
};
},
imap: function (fun, p, q/*, ...*/) {
var m = MochiKit.Base;
var self = MochiKit.Iter;
var iterables = m.map(self.iter, m.extend(null, arguments, 1));
var map = m.map;
var next = self.next;
return {
repr: function () { return "imap(...)"; },
toString: m.forwardCall("repr"),
next: function () {
return fun.apply(this, map(next, iterables));
}
};
},
applymap: function (fun, seq, self) {
seq = MochiKit.Iter.iter(seq);
var m = MochiKit.Base;
return {
repr: function () { return "applymap(...)"; },
toString: m.forwardCall("repr"),
next: function () {
return fun.apply(self, seq.next());
}
};
},
chain: function (p, q/*, ...*/) {
// dumb fast path
var self = MochiKit.Iter;
var m = MochiKit.Base;
if (arguments.length == 1) {
return self.iter(arguments[0]);
}
var argiter = m.map(self.iter, arguments);
return {
repr: function () { return "chain(...)"; },
toString: m.forwardCall("repr"),
next: function () {
while (argiter.length > 1) {
try {
return argiter[0].next();
} catch (e) {
if (e != self.StopIteration) {
throw e;
}
argiter.shift();
}
}
if (argiter.length == 1) {
// optimize last element
var arg = argiter.shift();
this.next = m.bind("next", arg);
return this.next();
}
throw self.StopIteration;
}
};
},
takewhile: function (pred, seq) {
var self = MochiKit.Iter;
seq = self.iter(seq);
return {
repr: function () { return "takewhile(...)"; },
toString: MochiKit.Base.forwardCall("repr"),
next: function () {
var rval = seq.next();
if (!pred(rval)) {
this.next = function () {
throw self.StopIteration;
};
this.next();
}
return rval;
}
};
},
dropwhile: function (pred, seq) {
seq = MochiKit.Iter.iter(seq);
var m = MochiKit.Base;
var bind = m.bind;
return {
"repr": function () { return "dropwhile(...)"; },
"toString": m.forwardCall("repr"),
"next": function () {
while (true) {
var rval = seq.next();
if (!pred(rval)) {
break;
}
}
this.next = bind("next", seq);
return rval;
}
};
},
_tee: function (ident, sync, iterable) {
sync.pos[ident] = -1;
var m = MochiKit.Base;
var listMin = m.listMin;
return {
repr: function () { return "tee(" + ident + ", ...)"; },
toString: m.forwardCall("repr"),
next: function () {
var rval;
var i = sync.pos[ident];
if (i == sync.max) {
rval = iterable.next();
sync.deque.push(rval);
sync.max += 1;
sync.pos[ident] += 1;
} else {
rval = sync.deque[i - sync.min];
sync.pos[ident] += 1;
if (i == sync.min && listMin(sync.pos) != sync.min) {
sync.min += 1;
sync.deque.shift();
}
}
return rval;
}
};
},
tee: function (iterable, n/* = 2 */) {
var rval = [];
var sync = {
"pos": [],
"deque": [],
"max": -1,
"min": -1
};
if (arguments.length == 1) {
n = 2;
}
var self = MochiKit.Iter;
iterable = self.iter(iterable);
var _tee = self._tee;
for (var i = 0; i < n; i++) {
rval.push(_tee(i, sync, iterable));
}
return rval;
},
list: function (iterable) {
// Fast-path for Array and Array-like
var m = MochiKit.Base;
if (typeof(iterable.slice) == 'function') {
return iterable.slice();
} else if (m.isArrayLike(iterable)) {
return m.concat(iterable);
}
var self = MochiKit.Iter;
iterable = self.iter(iterable);
var rval = [];
try {
while (true) {
rval.push(iterable.next());
}
} catch (e) {
if (e != self.StopIteration) {
throw e;
}
return rval;
}
// mozilla warnings aren't too bright
return undefined;
},
reduce: function (fn, iterable, /* optional */initial) {
var i = 0;
var x = initial;
var self = MochiKit.Iter;
iterable = self.iter(iterable);
if (arguments.length < 3) {
try {
x = iterable.next();
} catch (e) {
if (e == self.StopIteration) {
e = new TypeError("reduce() of empty sequence with no initial value");
}
throw e;
}
i++;
}
try {
while (true) {
x = fn(x, iterable.next());
}
} catch (e) {
if (e != self.StopIteration) {
throw e;
}
}
return x;
},
range: function (/* [start,] stop[, step] */) {
var start = 0;
var stop = 0;
var step = 1;
if (arguments.length == 1) {
stop = arguments[0];
} else if (arguments.length == 2) {
start = arguments[0];
stop = arguments[1];
} else if (arguments.length == 3) {
start = arguments[0];
stop = arguments[1];
step = arguments[2];
} else {
throw new TypeError("range() takes 1, 2, or 3 arguments!");
}
if (step === 0) {
throw new TypeError("range() step must not be 0");
}
return {
next: function () {
if ((step > 0 && start >= stop) || (step < 0 && start <= stop)) {
throw MochiKit.Iter.StopIteration;
}
var rval = start;
start += step;
return rval;
},
repr: function () {
return "range(" + [start, stop, step].join(", ") + ")";
},
toString: MochiKit.Base.forwardCall("repr")
};
},
sum: function (iterable, start/* = 0 */) {
var x = start || 0;
var self = MochiKit.Iter;
iterable = self.iter(iterable);
try {
while (true) {
x += iterable.next();
}
} catch (e) {
if (e != self.StopIteration) {
throw e;
}
}
return x;
},
exhaust: function (iterable) {
var self = MochiKit.Iter;
iterable = self.iter(iterable);
try {
while (true) {
iterable.next();
}
} catch (e) {
if (e != self.StopIteration) {
throw e;
}
}
},
forEach: function (iterable, func, /* optional */self) {
var m = MochiKit.Base;
if (arguments.length > 2) {
func = m.bind(func, self);
}
// fast path for array
if (m.isArrayLike(iterable)) {
try {
for (var i = 0; i < iterable.length; i++) {
func(iterable[i]);
}
} catch (e) {
if (e != MochiKit.Iter.StopIteration) {
throw e;
}
}
} else {
self = MochiKit.Iter;
self.exhaust(self.imap(func, iterable));
}
},
every: function (iterable, func) {
var self = MochiKit.Iter;
try {
self.ifilterfalse(func, iterable).next();
return false;
} catch (e) {
if (e != self.StopIteration) {
throw e;
}
return true;
}
},
sorted: function (iterable, /* optional */cmp) {
var rval = MochiKit.Iter.list(iterable);
if (arguments.length == 1) {
cmp = MochiKit.Base.compare;
}
rval.sort(cmp);
return rval;
},
reversed: function (iterable) {
var rval = MochiKit.Iter.list(iterable);
rval.reverse();
return rval;
},
some: function (iterable, func) {
var self = MochiKit.Iter;
try {
self.ifilter(func, iterable).next();
return true;
} catch (e) {
if (e != self.StopIteration) {
throw e;
}
return false;
}
},
iextend: function (lst, iterable) {
if (MochiKit.Base.isArrayLike(iterable)) {
// fast-path for array-like
for (var i = 0; i < iterable.length; i++) {
lst.push(iterable[i]);
}
} else {
var self = MochiKit.Iter;
iterable = self.iter(iterable);
try {
while (true) {
lst.push(iterable.next());
}
} catch (e) {
if (e != self.StopIteration) {
throw e;
}
}
}
return lst;
},
groupby: function(iterable, /* optional */ keyfunc) {
var m = MochiKit.Base;
var self = MochiKit.Iter;
if (arguments.length < 2) {
keyfunc = m.operator.identity;
}
iterable = self.iter(iterable);
// shared
var pk = undefined;
var k = undefined;
var v;
function fetch() {
v = iterable.next();
k = keyfunc(v);
};
function eat() {
var ret = v;
v = undefined;
return ret;
};
var first = true;
return {
repr: function () { return "groupby(...)"; },
next: function() {
// iterator-next
// iterate until meet next group
while (k == pk) {
fetch();
if (first) {
first = false;
break;
}
}
pk = k;
return [k, {
next: function() {
// subiterator-next
if (v == undefined) { // Is there something to eat?
fetch();
}
if (k != pk) {
throw self.StopIteration;
}
return eat();
}
}];
}
};
},
groupby_as_array: function (iterable, /* optional */ keyfunc) {
var m = MochiKit.Base;
var self = MochiKit.Iter;
if (arguments.length < 2) {
keyfunc = m.operator.identity;
}
iterable = self.iter(iterable);
var result = [];
var first = true;
var prev_key;
while (true) {
try {
var value = iterable.next();
var key = keyfunc(value);
} catch (e) {
if (e == self.StopIteration) {
break;
}
throw e;
}
if (first || key != prev_key) {
var values = [];
result.push([key, values]);
}
values.push(value);
first = false;
prev_key = key;
}
return result;
},
arrayLikeIter: function (iterable) {
var i = 0;
return {
repr: function () { return "arrayLikeIter(...)"; },
toString: MochiKit.Base.forwardCall("repr"),
next: function () {
if (i >= iterable.length) {
throw MochiKit.Iter.StopIteration;
}
return iterable[i++];
}
};
},
hasIterateNext: function (iterable) {
return (iterable && typeof(iterable.iterateNext) == "function");
},
iterateNextIter: function (iterable) {
return {
repr: function () { return "iterateNextIter(...)"; },
toString: MochiKit.Base.forwardCall("repr"),
next: function () {
var rval = iterable.iterateNext();
if (rval === null || rval === undefined) {
throw MochiKit.Iter.StopIteration;
}
return rval;
}
};
}
});
MochiKit.Iter.EXPORT_OK = [
"iteratorRegistry",
"arrayLikeIter",
"hasIterateNext",
"iterateNextIter",
];
MochiKit.Iter.EXPORT = [
"StopIteration",
"registerIteratorFactory",
"iter",
"count",
"cycle",
"repeat",
"next",
"izip",
"ifilter",
"ifilterfalse",
"islice",
"imap",
"applymap",
"chain",
"takewhile",
"dropwhile",
"tee",
"list",
"reduce",
"range",
"sum",
"exhaust",
"forEach",
"every",
"sorted",
"reversed",
"some",
"iextend",
"groupby",
"groupby_as_array"
];
MochiKit.Iter.__new__ = function () {
var m = MochiKit.Base;
this.StopIteration = new m.NamedError("StopIteration");
this.iteratorRegistry = new m.AdapterRegistry();
// Register the iterator factory for arrays
this.registerIteratorFactory(
"arrayLike",
m.isArrayLike,
this.arrayLikeIter
);
this.registerIteratorFactory(
"iterateNext",
this.hasIterateNext,
this.iterateNextIter
);
this.EXPORT_TAGS = {
":common": this.EXPORT,
":all": m.concat(this.EXPORT, this.EXPORT_OK)
};
m.nameFunctions(this);
};
MochiKit.Iter.__new__();
//
// XXX: Internet Explorer blows
//
if (!MochiKit.__compat__) {
reduce = MochiKit.Iter.reduce;
}
MochiKit.Base._exportSymbols(this, MochiKit.Iter);

View File

@@ -1,290 +0,0 @@
/***
MochiKit.Logging 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.Logging');
dojo.require('MochiKit.Base');
}
if (typeof(JSAN) != 'undefined') {
JSAN.use("MochiKit.Base", []);
}
try {
if (typeof(MochiKit.Base) == 'undefined') {
throw "";
}
} catch (e) {
throw "MochiKit.Logging depends on MochiKit.Base!";
}
if (typeof(MochiKit.Logging) == 'undefined') {
MochiKit.Logging = {};
}
MochiKit.Logging.NAME = "MochiKit.Logging";
MochiKit.Logging.VERSION = "1.3.1";
MochiKit.Logging.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.Logging.toString = function () {
return this.__repr__();
};
MochiKit.Logging.EXPORT = [
"LogLevel",
"LogMessage",
"Logger",
"alertListener",
"logger",
"log",
"logError",
"logDebug",
"logFatal",
"logWarning"
];
MochiKit.Logging.EXPORT_OK = [
"logLevelAtLeast",
"isLogMessage",
"compareLogMessage"
];
MochiKit.Logging.LogMessage = function (num, level, info) {
this.num = num;
this.level = level;
this.info = info;
this.timestamp = new Date();
};
MochiKit.Logging.LogMessage.prototype = {
repr: function () {
var m = MochiKit.Base;
return 'LogMessage(' +
m.map(
m.repr,
[this.num, this.level, this.info]
).join(', ') + ')';
},
toString: MochiKit.Base.forwardCall("repr")
};
MochiKit.Base.update(MochiKit.Logging, {
logLevelAtLeast: function (minLevel) {
var self = MochiKit.Logging;
if (typeof(minLevel) == 'string') {
minLevel = self.LogLevel[minLevel];
}
return function (msg) {
var msgLevel = msg.level;
if (typeof(msgLevel) == 'string') {
msgLevel = self.LogLevel[msgLevel];
}
return msgLevel >= minLevel;
};
},
isLogMessage: function (/* ... */) {
var LogMessage = MochiKit.Logging.LogMessage;
for (var i = 0; i < arguments.length; i++) {
if (!(arguments[i] instanceof LogMessage)) {
return false;
}
}
return true;
},
compareLogMessage: function (a, b) {
return MochiKit.Base.compare([a.level, a.info], [b.level, b.info]);
},
alertListener: function (msg) {
alert(
"num: " + msg.num +
"\nlevel: " + msg.level +
"\ninfo: " + msg.info.join(" ")
);
}
});
MochiKit.Logging.Logger = function (/* optional */maxSize) {
this.counter = 0;
if (typeof(maxSize) == 'undefined' || maxSize === null) {
maxSize = -1;
}
this.maxSize = maxSize;
this._messages = [];
this.listeners = {};
this.useNativeConsole = false;
};
MochiKit.Logging.Logger.prototype = {
clear: function () {
this._messages.splice(0, this._messages.length);
},
logToConsole: function (msg) {
if (typeof(window) != "undefined" && window.console
&& window.console.log) {
// Safari
window.console.log(msg);
} else if (typeof(opera) != "undefined" && opera.postError) {
// Opera
opera.postError(msg);
} else if (typeof(printfire) == "function") {
// FireBug
printfire(msg);
}
},
dispatchListeners: function (msg) {
for (var k in this.listeners) {
var pair = this.listeners[k];
if (pair.ident != k || (pair[0] && !pair[0](msg))) {
continue;
}
pair[1](msg);
}
},
addListener: function (ident, filter, listener) {
if (typeof(filter) == 'string') {
filter = MochiKit.Logging.logLevelAtLeast(filter);
}
var entry = [filter, listener];
entry.ident = ident;
this.listeners[ident] = entry;
},
removeListener: function (ident) {
delete this.listeners[ident];
},
baseLog: function (level, message/*, ...*/) {
var msg = new MochiKit.Logging.LogMessage(
this.counter,
level,
MochiKit.Base.extend(null, arguments, 1)
);
this._messages.push(msg);
this.dispatchListeners(msg);
if (this.useNativeConsole) {
this.logToConsole(msg.level + ": " + msg.info.join(" "));
}
this.counter += 1;
while (this.maxSize >= 0 && this._messages.length > this.maxSize) {
this._messages.shift();
}
},
getMessages: function (howMany) {
var firstMsg = 0;
if (!(typeof(howMany) == 'undefined' || howMany === null)) {
firstMsg = Math.max(0, this._messages.length - howMany);
}
return this._messages.slice(firstMsg);
},
getMessageText: function (howMany) {
if (typeof(howMany) == 'undefined' || howMany === null) {
howMany = 30;
}
var messages = this.getMessages(howMany);
if (messages.length) {
var lst = map(function (m) {
return '\n [' + m.num + '] ' + m.level + ': ' + m.info.join(' ');
}, messages);
lst.unshift('LAST ' + messages.length + ' MESSAGES:');
return lst.join('');
}
return '';
},
debuggingBookmarklet: function (inline) {
if (typeof(MochiKit.LoggingPane) == "undefined") {
alert(this.getMessageText());
} else {
MochiKit.LoggingPane.createLoggingPane(inline || false);
}
}
};
MochiKit.Logging.__new__ = function () {
this.LogLevel = {
ERROR: 40,
FATAL: 50,
WARNING: 30,
INFO: 20,
DEBUG: 10
};
var m = MochiKit.Base;
m.registerComparator("LogMessage",
this.isLogMessage,
this.compareLogMessage
);
var partial = m.partial;
var Logger = this.Logger;
var baseLog = Logger.prototype.baseLog;
m.update(this.Logger.prototype, {
debug: partial(baseLog, 'DEBUG'),
log: partial(baseLog, 'INFO'),
error: partial(baseLog, 'ERROR'),
fatal: partial(baseLog, 'FATAL'),
warning: partial(baseLog, 'WARNING')
});
// indirectly find logger so it can be replaced
var self = this;
var connectLog = function (name) {
return function () {
self.logger[name].apply(self.logger, arguments);
};
};
this.log = connectLog('log');
this.logError = connectLog('error');
this.logDebug = connectLog('debug');
this.logFatal = connectLog('fatal');
this.logWarning = connectLog('warning');
this.logger = new Logger();
this.logger.useNativeConsole = true;
this.EXPORT_TAGS = {
":common": this.EXPORT,
":all": m.concat(this.EXPORT, this.EXPORT_OK)
};
m.nameFunctions(this);
};
if (typeof(printfire) == "undefined" &&
typeof(document) != "undefined" && document.createEvent &&
typeof(dispatchEvent) != "undefined") {
// FireBug really should be less lame about this global function
printfire = function () {
printfire.args = arguments;
var ev = document.createEvent("Events");
ev.initEvent("printfire", false, true);
dispatchEvent(ev);
};
}
MochiKit.Logging.__new__();
MochiKit.Base._exportSymbols(this, MochiKit.Logging);

View File

@@ -1,356 +0,0 @@
/***
MochiKit.LoggingPane 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.LoggingPane');
dojo.require('MochiKit.Logging');
dojo.require('MochiKit.Base');
}
if (typeof(JSAN) != 'undefined') {
JSAN.use("MochiKit.Logging", []);
JSAN.use("MochiKit.Base", []);
}
try {
if (typeof(MochiKit.Base) == 'undefined' || typeof(MochiKit.Logging) == 'undefined') {
throw "";
}
} catch (e) {
throw "MochiKit.LoggingPane depends on MochiKit.Base and MochiKit.Logging!";
}
if (typeof(MochiKit.LoggingPane) == 'undefined') {
MochiKit.LoggingPane = {};
}
MochiKit.LoggingPane.NAME = "MochiKit.LoggingPane";
MochiKit.LoggingPane.VERSION = "1.3.1";
MochiKit.LoggingPane.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.LoggingPane.toString = function () {
return this.__repr__();
};
MochiKit.LoggingPane.createLoggingPane = function (inline/* = false */) {
var m = MochiKit.LoggingPane;
inline = !(!inline);
if (m._loggingPane && m._loggingPane.inline != inline) {
m._loggingPane.closePane();
m._loggingPane = null;
}
if (!m._loggingPane || m._loggingPane.closed) {
m._loggingPane = new m.LoggingPane(inline, MochiKit.Logging.logger);
}
return m._loggingPane;
};
MochiKit.LoggingPane.LoggingPane = function (inline/* = false */, logger/* = MochiKit.Logging.logger */) {
/* Use a div if inline, pop up a window if not */
/* Create the elements */
if (typeof(logger) == "undefined" || logger === null) {
logger = MochiKit.Logging.logger;
}
this.logger = logger;
var update = MochiKit.Base.update;
var updatetree = MochiKit.Base.updatetree;
var bind = MochiKit.Base.bind;
var clone = MochiKit.Base.clone;
var win = window;
var uid = "_MochiKit_LoggingPane";
if (typeof(MochiKit.DOM) != "undefined") {
win = MochiKit.DOM.currentWindow();
}
if (!inline) {
// name the popup with the base URL for uniqueness
var url = win.location.href.split("?")[0].replace(/[:\/.><&]/g, "_");
var name = uid + "_" + url;
var nwin = win.open("", name, "dependent,resizable,height=200");
if (!nwin) {
alert("Not able to open debugging window due to pop-up blocking.");
return undefined;
}
nwin.document.write(
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" '
+ '"http://www.w3.org/TR/html4/loose.dtd">'
+ '<html><head><title>[MochiKit.LoggingPane]</title></head>'
+ '<body></body></html>'
);
nwin.document.close();
nwin.document.title += ' ' + win.document.title;
win = nwin;
}
var doc = win.document;
this.doc = doc;
// Connect to the debug pane if it already exists (i.e. in a window orphaned by the page being refreshed)
var debugPane = doc.getElementById(uid);
var existing_pane = !!debugPane;
if (debugPane && typeof(debugPane.loggingPane) != "undefined") {
debugPane.loggingPane.logger = this.logger;
debugPane.loggingPane.buildAndApplyFilter();
return debugPane.loggingPane;
}
if (existing_pane) {
// clear any existing contents
var child;
while ((child = debugPane.firstChild)) {
debugPane.removeChild(child);
}
} else {
debugPane = doc.createElement("div");
debugPane.id = uid;
}
debugPane.loggingPane = this;
var levelFilterField = doc.createElement("input");
var infoFilterField = doc.createElement("input");
var filterButton = doc.createElement("button");
var loadButton = doc.createElement("button");
var clearButton = doc.createElement("button");
var closeButton = doc.createElement("button");
var logPaneArea = doc.createElement("div");
var logPane = doc.createElement("div");
/* Set up the functions */
var listenerId = uid + "_Listener";
this.colorTable = clone(this.colorTable);
var messages = [];
var messageFilter = null;
var messageLevel = function (msg) {
var level = msg.level;
if (typeof(level) == "number") {
level = MochiKit.Logging.LogLevel[level];
}
return level;
};
var messageText = function (msg) {
return msg.info.join(" ");
};
var addMessageText = bind(function (msg) {
var level = messageLevel(msg);
var text = messageText(msg);
var c = this.colorTable[level];
var p = doc.createElement("span");
p.className = "MochiKit-LogMessage MochiKit-LogLevel-" + level;
p.style.cssText = "margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: " + c;
p.appendChild(doc.createTextNode(level + ": " + text));
logPane.appendChild(p);
logPane.appendChild(doc.createElement("br"));
if (logPaneArea.offsetHeight > logPaneArea.scrollHeight) {
logPaneArea.scrollTop = 0;
} else {
logPaneArea.scrollTop = logPaneArea.scrollHeight;
}
}, this);
var addMessage = function (msg) {
messages[messages.length] = msg;
addMessageText(msg);
};
var buildMessageFilter = function () {
var levelre, infore;
try {
/* Catch any exceptions that might arise due to invalid regexes */
levelre = new RegExp(levelFilterField.value);
infore = new RegExp(infoFilterField.value);
} catch(e) {
/* If there was an error with the regexes, do no filtering */
logDebug("Error in filter regex: " + e.message);
return null;
}
return function (msg) {
return (
levelre.test(messageLevel(msg)) &&
infore.test(messageText(msg))
);
};
};
var clearMessagePane = function () {
while (logPane.firstChild) {
logPane.removeChild(logPane.firstChild);
}
};
var clearMessages = function () {
messages = [];
clearMessagePane();
};
var closePane = bind(function () {
if (this.closed) {
return;
}
this.closed = true;
if (MochiKit.LoggingPane._loggingPane == this) {
MochiKit.LoggingPane._loggingPane = null;
}
this.logger.removeListener(listenerId);
debugPane.loggingPane = null;
if (inline) {
debugPane.parentNode.removeChild(debugPane);
} else {
this.win.close();
}
}, this);
var filterMessages = function () {
clearMessagePane();
for (var i = 0; i < messages.length; i++) {
var msg = messages[i];
if (messageFilter === null || messageFilter(msg)) {
addMessageText(msg);
}
}
};
this.buildAndApplyFilter = function () {
messageFilter = buildMessageFilter();
filterMessages();
this.logger.removeListener(listenerId);
this.logger.addListener(listenerId, messageFilter, addMessage);
};
var loadMessages = bind(function () {
messages = this.logger.getMessages();
filterMessages();
}, this);
var filterOnEnter = bind(function (event) {
event = event || window.event;
key = event.which || event.keyCode;
if (key == 13) {
this.buildAndApplyFilter();
}
}, this);
/* Create the debug pane */
var style = "display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: " + this.logFont;
if (inline) {
style += "; height: 10em; border-top: 2px solid black";
} else {
style += "; height: 100%;";
}
debugPane.style.cssText = style;
if (!existing_pane) {
doc.body.appendChild(debugPane);
}
/* Create the filter fields */
style = {"cssText": "width: 33%; display: inline; font: " + this.logFont};
updatetree(levelFilterField, {
"value": "FATAL|ERROR|WARNING|INFO|DEBUG",
"onkeypress": filterOnEnter,
"style": style
});
debugPane.appendChild(levelFilterField);
updatetree(infoFilterField, {
"value": ".*",
"onkeypress": filterOnEnter,
"style": style
});
debugPane.appendChild(infoFilterField);
/* Create the buttons */
style = "width: 8%; display:inline; font: " + this.logFont;
filterButton.appendChild(doc.createTextNode("Filter"));
filterButton.onclick = bind("buildAndApplyFilter", this);
filterButton.style.cssText = style;
debugPane.appendChild(filterButton);
loadButton.appendChild(doc.createTextNode("Load"));
loadButton.onclick = loadMessages;
loadButton.style.cssText = style;
debugPane.appendChild(loadButton);
clearButton.appendChild(doc.createTextNode("Clear"));
clearButton.onclick = clearMessages;
clearButton.style.cssText = style;
debugPane.appendChild(clearButton);
closeButton.appendChild(doc.createTextNode("Close"));
closeButton.onclick = closePane;
closeButton.style.cssText = style;
debugPane.appendChild(closeButton);
/* Create the logging pane */
logPaneArea.style.cssText = "overflow: auto; width: 100%";
logPane.style.cssText = "width: 100%; height: " + (inline ? "8em" : "100%");
logPaneArea.appendChild(logPane);
debugPane.appendChild(logPaneArea);
this.buildAndApplyFilter();
loadMessages();
if (inline) {
this.win = undefined;
} else {
this.win = win;
}
this.inline = inline;
this.closePane = closePane;
this.closed = false;
return this;
};
MochiKit.LoggingPane.LoggingPane.prototype = {
"logFont": "8pt Verdana,sans-serif",
"colorTable": {
"ERROR": "red",
"FATAL": "darkred",
"WARNING": "blue",
"INFO": "black",
"DEBUG": "green"
}
};
MochiKit.LoggingPane.EXPORT_OK = [
"LoggingPane"
];
MochiKit.LoggingPane.EXPORT = [
"createLoggingPane"
];
MochiKit.LoggingPane.__new__ = function () {
this.EXPORT_TAGS = {
":common": this.EXPORT,
":all": MochiKit.Base.concat(this.EXPORT, this.EXPORT_OK)
};
MochiKit.Base.nameFunctions(this);
MochiKit.LoggingPane._loggingPane = null;
};
MochiKit.LoggingPane.__new__();
MochiKit.Base._exportSymbols(this, MochiKit.LoggingPane);

View File

@@ -1,152 +0,0 @@
/***
MochiKit.MochiKit 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(MochiKit) == 'undefined') {
MochiKit = {};
}
if (typeof(MochiKit.MochiKit) == 'undefined') {
MochiKit.MochiKit = {};
}
MochiKit.MochiKit.NAME = "MochiKit.MochiKit";
MochiKit.MochiKit.VERSION = "1.3.1";
MochiKit.MochiKit.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.MochiKit.toString = function () {
return this.__repr__();
};
MochiKit.MochiKit.SUBMODULES = [
"Base",
"Iter",
"Logging",
"DateTime",
"Format",
"Async",
"DOM",
"LoggingPane",
"Color",
"Signal",
"Visual"
];
if (typeof(JSAN) != 'undefined' || typeof(dojo) != 'undefined') {
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.MochiKit');
dojo.require("MochiKit.*");
}
if (typeof(JSAN) != 'undefined') {
// hopefully this makes it easier for static analysis?
JSAN.use("MochiKit.Base", []);
JSAN.use("MochiKit.Iter", []);
JSAN.use("MochiKit.Logging", []);
JSAN.use("MochiKit.DateTime", []);
JSAN.use("MochiKit.Format", []);
JSAN.use("MochiKit.Async", []);
JSAN.use("MochiKit.DOM", []);
JSAN.use("MochiKit.LoggingPane", []);
JSAN.use("MochiKit.Color", []);
JSAN.use("MochiKit.Signal", []);
JSAN.use("MochiKit.Visual", []);
}
(function () {
var extend = MochiKit.Base.extend;
var self = MochiKit.MochiKit;
var modules = self.SUBMODULES;
var EXPORT = [];
var EXPORT_OK = [];
var EXPORT_TAGS = {};
var i, k, m, all;
for (i = 0; i < modules.length; i++) {
m = MochiKit[modules[i]];
extend(EXPORT, m.EXPORT);
extend(EXPORT_OK, m.EXPORT_OK);
for (k in m.EXPORT_TAGS) {
EXPORT_TAGS[k] = extend(EXPORT_TAGS[k], m.EXPORT_TAGS[k]);
}
all = m.EXPORT_TAGS[":all"];
if (!all) {
all = extend(null, m.EXPORT, m.EXPORT_OK);
}
var j;
for (j = 0; j < all.length; j++) {
k = all[j];
self[k] = m[k];
}
}
self.EXPORT = EXPORT;
self.EXPORT_OK = EXPORT_OK;
self.EXPORT_TAGS = EXPORT_TAGS;
}());
} else {
if (typeof(MochiKit.__compat__) == 'undefined') {
MochiKit.__compat__ = true;
}
(function () {
var scripts = document.getElementsByTagName("script");
var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var base = null;
var baseElem = null;
var allScripts = {};
var i;
for (i = 0; i < scripts.length; i++) {
var src = scripts[i].getAttribute("src");
if (!src) {
continue;
}
allScripts[src] = true;
if (src.match(/MochiKit.js$/)) {
base = src.substring(0, src.lastIndexOf('MochiKit.js'));
baseElem = scripts[i];
}
}
if (base === null) {
return;
}
var modules = MochiKit.MochiKit.SUBMODULES;
for (var i = 0; i < modules.length; i++) {
if (MochiKit[modules[i]]) {
continue;
}
var uri = base + modules[i] + '.js';
if (uri in allScripts) {
continue;
}
if (document.documentElement &&
document.documentElement.namespaceURI == kXULNSURI) {
// XUL
var s = document.createElementNS(kXULNSURI, 'script');
s.setAttribute("id", "MochiKit_" + base + modules[i]);
s.setAttribute("src", uri);
s.setAttribute("type", "application/x-javascript");
baseElem.parentNode.appendChild(s);
} else {
// HTML
/*
DOM can not be used here because Safari does
deferred loading of scripts unless they are
in the document or inserted with document.write
This is not XHTML compliant. If you want XHTML
compliance then you must use the packed version of MochiKit
or include each script individually (basically unroll
these document.write calls into your XHTML source)
*/
document.write('<script src="' + uri +
'" type="text/javascript"></script>');
}
};
})();
}

View File

@@ -1,73 +0,0 @@
/***
MochiKit.MockDOM 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(MochiKit) == "undefined") {
var MochiKit = {};
}
if (typeof(MochiKit.MockDOM) == "undefined") {
MochiKit.MockDOM = {};
}
MochiKit.MockDOM.NAME = "MochiKit.MockDOM";
MochiKit.MockDOM.VERSION = "1.3.1";
MochiKit.MockDOM.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.MockDOM.toString = function () {
return this.__repr__();
};
MochiKit.MockDOM.createDocument = function () {
var doc = new MochiKit.MockDOM.MockElement("DOCUMENT");
doc.body = doc.createElement("BODY");
doc.appendChild(doc.body);
return doc;
};
MochiKit.MockDOM.MockElement = function (name, data) {
this.nodeName = name.toUpperCase();
if (typeof(data) == "string") {
this.nodeValue = data;
this.nodeType = 3;
} else {
this.nodeType = 1;
this.childNodes = [];
}
if (name.substring(0, 1) == "<") {
var nameattr = name.substring(
name.indexOf('"') + 1, name.lastIndexOf('"'));
name = name.substring(1, name.indexOf(" "));
this.nodeName = name.toUpperCase();
this.setAttribute("name", nameattr);
}
};
MochiKit.MockDOM.MockElement.prototype = {
createElement: function (nodeName) {
return new MochiKit.MockDOM.MockElement(nodeName);
},
createTextNode: function (text) {
return new MochiKit.MockDOM.MockElement("text", text);
},
setAttribute: function (name, value) {
this[name] = value;
},
getAttribute: function (name) {
return this[name];
},
appendChild: function (child) {
this.childNodes.push(child);
},
toString: function () {
return "MockElement(" + this.nodeName + ")";
}
};

View File

@@ -1,680 +0,0 @@
/***
MochiKit.Signal 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2006 Jonathan Gardner, Beau Hartshorne, Bob Ippolito. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.Signal');
dojo.require('MochiKit.Base');
dojo.require('MochiKit.DOM');
}
if (typeof(JSAN) != 'undefined') {
JSAN.use('MochiKit.Base', []);
JSAN.use('MochiKit.DOM', []);
}
try {
if (typeof(MochiKit.Base) == 'undefined') {
throw '';
}
} catch (e) {
throw 'MochiKit.Signal depends on MochiKit.Base!';
}
try {
if (typeof(MochiKit.DOM) == 'undefined') {
throw '';
}
} catch (e) {
throw 'MochiKit.Signal depends on MochiKit.DOM!';
}
if (typeof(MochiKit.Signal) == 'undefined') {
MochiKit.Signal = {};
}
MochiKit.Signal.NAME = 'MochiKit.Signal';
MochiKit.Signal.VERSION = '1.3.1';
MochiKit.Signal._observers = [];
MochiKit.Signal.Event = function (src, e) {
this._event = e || window.event;
this._src = src;
};
MochiKit.Base.update(MochiKit.Signal.Event.prototype, {
__repr__: function() {
var repr = MochiKit.Base.repr;
var str = '{event(): ' + repr(this.event()) +
', src(): ' + repr(this.src()) +
', type(): ' + repr(this.type()) +
', target(): ' + repr(this.target()) +
', modifier(): ' + '{alt: ' + repr(this.modifier().alt) +
', ctrl: ' + repr(this.modifier().ctrl) +
', meta: ' + repr(this.modifier().meta) +
', shift: ' + repr(this.modifier().shift) +
', any: ' + repr(this.modifier().any) + '}';
if (this.type() && this.type().indexOf('key') === 0) {
str += ', key(): {code: ' + repr(this.key().code) +
', string: ' + repr(this.key().string) + '}';
}
if (this.type() && (
this.type().indexOf('mouse') === 0 ||
this.type().indexOf('click') != -1 ||
this.type() == 'contextmenu')) {
str += ', mouse(): {page: ' + repr(this.mouse().page) +
', client: ' + repr(this.mouse().client);
if (this.type() != 'mousemove') {
str += ', button: {left: ' + repr(this.mouse().button.left) +
', middle: ' + repr(this.mouse().button.middle) +
', right: ' + repr(this.mouse().button.right) + '}}';
} else {
str += '}';
}
}
if (this.type() == 'mouseover' || this.type() == 'mouseout') {
str += ', relatedTarget(): ' + repr(this.relatedTarget());
}
str += '}';
return str;
},
toString: function () {
return this.__repr__();
},
src: function () {
return this._src;
},
event: function () {
return this._event;
},
type: function () {
return this._event.type || undefined;
},
target: function () {
return this._event.target || this._event.srcElement;
},
relatedTarget: function () {
if (this.type() == 'mouseover') {
return (this._event.relatedTarget ||
this._event.fromElement);
} else if (this.type() == 'mouseout') {
return (this._event.relatedTarget ||
this._event.toElement);
}
// throw new Error("relatedTarget only available for 'mouseover' and 'mouseout'");
return undefined;
},
modifier: function () {
var m = {};
m.alt = this._event.altKey;
m.ctrl = this._event.ctrlKey;
m.meta = this._event.metaKey || false; // IE and Opera punt here
m.shift = this._event.shiftKey;
m.any = m.alt || m.ctrl || m.shift || m.meta;
return m;
},
key: function () {
var k = {};
if (this.type() && this.type().indexOf('key') === 0) {
/*
If you're looking for a special key, look for it in keydown or
keyup, but never keypress. If you're looking for a Unicode
chracter, look for it with keypress, but never keyup or
keydown.
Notes:
FF key event behavior:
key event charCode keyCode
DOWN ku,kd 0 40
DOWN kp 0 40
ESC ku,kd 0 27
ESC kp 0 27
a ku,kd 0 65
a kp 97 0
shift+a ku,kd 0 65
shift+a kp 65 0
1 ku,kd 0 49
1 kp 49 0
shift+1 ku,kd 0 0
shift+1 kp 33 0
IE key event behavior:
(IE doesn't fire keypress events for special keys.)
key event keyCode
DOWN ku,kd 40
DOWN kp undefined
ESC ku,kd 27
ESC kp 27
a ku,kd 65
a kp 97
shift+a ku,kd 65
shift+a kp 65
1 ku,kd 49
1 kp 49
shift+1 ku,kd 49
shift+1 kp 33
Safari key event behavior:
(Safari sets charCode and keyCode to something crazy for
special keys.)
key event charCode keyCode
DOWN ku,kd 63233 40
DOWN kp 63233 63233
ESC ku,kd 27 27
ESC kp 27 27
a ku,kd 97 65
a kp 97 97
shift+a ku,kd 65 65
shift+a kp 65 65
1 ku,kd 49 49
1 kp 49 49
shift+1 ku,kd 33 49
shift+1 kp 33 33
*/
/* look for special keys here */
if (this.type() == 'keydown' || this.type() == 'keyup') {
k.code = this._event.keyCode;
k.string = (MochiKit.Signal._specialKeys[k.code] ||
'KEY_UNKNOWN');
return k;
/* look for characters here */
} else if (this.type() == 'keypress') {
/*
Special key behavior:
IE: does not fire keypress events for special keys
FF: sets charCode to 0, and sets the correct keyCode
Safari: sets keyCode and charCode to something stupid
*/
k.code = 0;
k.string = '';
if (typeof(this._event.charCode) != 'undefined' &&
this._event.charCode !== 0 &&
!MochiKit.Signal._specialMacKeys[this._event.charCode]) {
k.code = this._event.charCode;
k.string = String.fromCharCode(k.code);
} else if (this._event.keyCode &&
typeof(this._event.charCode) == 'undefined') { // IE
k.code = this._event.keyCode;
k.string = String.fromCharCode(k.code);
}
return k;
}
}
// throw new Error('This is not a key event');
return undefined;
},
mouse: function () {
var m = {};
var e = this._event;
if (this.type() && (
this.type().indexOf('mouse') === 0 ||
this.type().indexOf('click') != -1 ||
this.type() == 'contextmenu')) {
m.client = new MochiKit.DOM.Coordinates(0, 0);
if (e.clientX || e.clientY) {
m.client.x = (!e.clientX || e.clientX < 0) ? 0 : e.clientX;
m.client.y = (!e.clientY || e.clientY < 0) ? 0 : e.clientY;
}
m.page = new MochiKit.DOM.Coordinates(0, 0);
if (e.pageX || e.pageY) {
m.page.x = (!e.pageX || e.pageX < 0) ? 0 : e.pageX;
m.page.y = (!e.pageY || e.pageY < 0) ? 0 : e.pageY;
} else {
/*
IE keeps the document offset in:
document.documentElement.clientTop ||
document.body.clientTop
and:
document.documentElement.clientLeft ||
document.body.clientLeft
see:
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getboundingclientrect.asp
The offset is (2,2) in standards mode and (0,0) in quirks
mode.
*/
var de = MochiKit.DOM._document.documentElement;
var b = MochiKit.DOM._document.body;
m.page.x = e.clientX +
(de.scrollLeft || b.scrollLeft) -
(de.clientLeft || b.clientLeft);
m.page.y = e.clientY +
(de.scrollTop || b.scrollTop) -
(de.clientTop || b.clientTop);
}
if (this.type() != 'mousemove') {
m.button = {};
m.button.left = false;
m.button.right = false;
m.button.middle = false;
/* we could check e.button, but which is more consistent */
if (e.which) {
m.button.left = (e.which == 1);
m.button.middle = (e.which == 2);
m.button.right = (e.which == 3);
/*
Mac browsers and right click:
- Safari doesn't fire any click events on a right
click:
http://bugzilla.opendarwin.org/show_bug.cgi?id=6595
- Firefox fires the event, and sets ctrlKey = true
- Opera fires the event, and sets metaKey = true
oncontextmenu is fired on right clicks between
browsers and across platforms.
*/
} else {
m.button.left = !!(e.button & 1);
m.button.right = !!(e.button & 2);
m.button.middle = !!(e.button & 4);
}
}
return m;
}
// throw new Error('This is not a mouse event');
return undefined;
},
stop: function () {
this.stopPropagation();
this.preventDefault();
},
stopPropagation: function () {
if (this._event.stopPropagation) {
this._event.stopPropagation();
} else {
this._event.cancelBubble = true;
}
},
preventDefault: function () {
if (this._event.preventDefault) {
this._event.preventDefault();
} else {
this._event.returnValue = false;
}
}
});
/* Safari sets keyCode to these special values onkeypress. */
MochiKit.Signal._specialMacKeys = {
3: 'KEY_ENTER',
63289: 'KEY_NUM_PAD_CLEAR',
63276: 'KEY_PAGE_UP',
63277: 'KEY_PAGE_DOWN',
63275: 'KEY_END',
63273: 'KEY_HOME',
63234: 'KEY_ARROW_LEFT',
63232: 'KEY_ARROW_UP',
63235: 'KEY_ARROW_RIGHT',
63233: 'KEY_ARROW_DOWN',
63302: 'KEY_INSERT',
63272: 'KEY_DELETE'
};
/* for KEY_F1 - KEY_F12 */
for (i = 63236; i <= 63242; i++) {
MochiKit.Signal._specialMacKeys[i] = 'KEY_F' + (i - 63236 + 1); // no F0
}
/* Standard keyboard key codes. */
MochiKit.Signal._specialKeys = {
8: 'KEY_BACKSPACE',
9: 'KEY_TAB',
12: 'KEY_NUM_PAD_CLEAR', // weird, for Safari and Mac FF only
13: 'KEY_ENTER',
16: 'KEY_SHIFT',
17: 'KEY_CTRL',
18: 'KEY_ALT',
19: 'KEY_PAUSE',
20: 'KEY_CAPS_LOCK',
27: 'KEY_ESCAPE',
32: 'KEY_SPACEBAR',
33: 'KEY_PAGE_UP',
34: 'KEY_PAGE_DOWN',
35: 'KEY_END',
36: 'KEY_HOME',
37: 'KEY_ARROW_LEFT',
38: 'KEY_ARROW_UP',
39: 'KEY_ARROW_RIGHT',
40: 'KEY_ARROW_DOWN',
44: 'KEY_PRINT_SCREEN',
45: 'KEY_INSERT',
46: 'KEY_DELETE',
59: 'KEY_SEMICOLON', // weird, for Safari and IE only
91: 'KEY_WINDOWS_LEFT',
92: 'KEY_WINDOWS_RIGHT',
93: 'KEY_SELECT',
106: 'KEY_NUM_PAD_ASTERISK',
107: 'KEY_NUM_PAD_PLUS_SIGN',
109: 'KEY_NUM_PAD_HYPHEN-MINUS',
110: 'KEY_NUM_PAD_FULL_STOP',
111: 'KEY_NUM_PAD_SOLIDUS',
144: 'KEY_NUM_LOCK',
145: 'KEY_SCROLL_LOCK',
186: 'KEY_SEMICOLON',
187: 'KEY_EQUALS_SIGN',
188: 'KEY_COMMA',
189: 'KEY_HYPHEN-MINUS',
190: 'KEY_FULL_STOP',
191: 'KEY_SOLIDUS',
192: 'KEY_GRAVE_ACCENT',
219: 'KEY_LEFT_SQUARE_BRACKET',
220: 'KEY_REVERSE_SOLIDUS',
221: 'KEY_RIGHT_SQUARE_BRACKET',
222: 'KEY_APOSTROPHE'
// undefined: 'KEY_UNKNOWN'
};
/* for KEY_0 - KEY_9 */
for (var i = 48; i <= 57; i++) {
MochiKit.Signal._specialKeys[i] = 'KEY_' + (i - 48);
}
/* for KEY_A - KEY_Z */
for (i = 65; i <= 90; i++) {
MochiKit.Signal._specialKeys[i] = 'KEY_' + String.fromCharCode(i);
}
/* for KEY_NUM_PAD_0 - KEY_NUM_PAD_9 */
for (i = 96; i <= 105; i++) {
MochiKit.Signal._specialKeys[i] = 'KEY_NUM_PAD_' + (i - 96);
}
/* for KEY_F1 - KEY_F12 */
for (i = 112; i <= 123; i++) {
MochiKit.Signal._specialKeys[i] = 'KEY_F' + (i - 112 + 1); // no F0
}
MochiKit.Base.update(MochiKit.Signal, {
__repr__: function () {
return '[' + this.NAME + ' ' + this.VERSION + ']';
},
toString: function () {
return this.__repr__();
},
_unloadCache: function () {
var self = MochiKit.Signal;
var observers = self._observers;
for (var i = 0; i < observers.length; i++) {
self._disconnect(observers[i]);
}
delete self._observers;
try {
window.onload = undefined;
} catch(e) {
// pass
}
try {
window.onunload = undefined;
} catch(e) {
// pass
}
},
_listener: function (src, func, obj, isDOM) {
var E = MochiKit.Signal.Event;
if (!isDOM) {
return MochiKit.Base.bind(func, obj);
}
obj = obj || src;
if (typeof(func) == "string") {
return function (nativeEvent) {
obj[func].apply(obj, [new E(src, nativeEvent)]);
};
} else {
return function (nativeEvent) {
func.apply(obj, [new E(src, nativeEvent)]);
};
}
},
connect: function (src, sig, objOrFunc/* optional */, funcOrStr) {
src = MochiKit.DOM.getElement(src);
var self = MochiKit.Signal;
if (typeof(sig) != 'string') {
throw new Error("'sig' must be a string");
}
var obj = null;
var func = null;
if (typeof(funcOrStr) != 'undefined') {
obj = objOrFunc;
func = funcOrStr;
if (typeof(funcOrStr) == 'string') {
if (typeof(objOrFunc[funcOrStr]) != "function") {
throw new Error("'funcOrStr' must be a function on 'objOrFunc'");
}
} else if (typeof(funcOrStr) != 'function') {
throw new Error("'funcOrStr' must be a function or string");
}
} else if (typeof(objOrFunc) != "function") {
throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given");
} else {
func = objOrFunc;
}
if (typeof(obj) == 'undefined' || obj === null) {
obj = src;
}
var isDOM = !!(src.addEventListener || src.attachEvent);
var listener = self._listener(src, func, obj, isDOM);
if (src.addEventListener) {
src.addEventListener(sig.substr(2), listener, false);
} else if (src.attachEvent) {
src.attachEvent(sig, listener); // useCapture unsupported
}
var ident = [src, sig, listener, isDOM, objOrFunc, funcOrStr];
self._observers.push(ident);
return ident;
},
_disconnect: function (ident) {
// check isDOM
if (!ident[3]) { return; }
var src = ident[0];
var sig = ident[1];
var listener = ident[2];
if (src.removeEventListener) {
src.removeEventListener(sig.substr(2), listener, false);
} else if (src.detachEvent) {
src.detachEvent(sig, listener); // useCapture unsupported
} else {
throw new Error("'src' must be a DOM element");
}
},
disconnect: function (ident) {
var self = MochiKit.Signal;
var observers = self._observers;
var m = MochiKit.Base;
if (arguments.length > 1) {
// compatibility API
var src = MochiKit.DOM.getElement(arguments[0]);
var sig = arguments[1];
var obj = arguments[2];
var func = arguments[3];
for (var i = observers.length - 1; i >= 0; i--) {
var o = observers[i];
if (o[0] === src && o[1] === sig && o[4] === obj && o[5] === func) {
self._disconnect(o);
observers.splice(i, 1);
return true;
}
}
} else {
var idx = m.findIdentical(observers, ident);
if (idx >= 0) {
self._disconnect(ident);
observers.splice(idx, 1);
return true;
}
}
return false;
},
disconnectAll: function(src/* optional */, sig) {
src = MochiKit.DOM.getElement(src);
var m = MochiKit.Base;
var signals = m.flattenArguments(m.extend(null, arguments, 1));
var self = MochiKit.Signal;
var disconnect = self._disconnect;
var observers = self._observers;
if (signals.length === 0) {
// disconnect all
for (var i = observers.length - 1; i >= 0; i--) {
var ident = observers[i];
if (ident[0] === src) {
disconnect(ident);
observers.splice(i, 1);
}
}
} else {
var sigs = {};
for (var i = 0; i < signals.length; i++) {
sigs[signals[i]] = true;
}
for (var i = observers.length - 1; i >= 0; i--) {
var ident = observers[i];
if (ident[0] === src && ident[1] in sigs) {
disconnect(ident);
observers.splice(i, 1);
}
}
}
},
signal: function (src, sig) {
var observers = MochiKit.Signal._observers;
src = MochiKit.DOM.getElement(src);
var args = MochiKit.Base.extend(null, arguments, 2);
var errors = [];
for (var i = 0; i < observers.length; i++) {
var ident = observers[i];
if (ident[0] === src && ident[1] === sig) {
try {
ident[2].apply(src, args);
} catch (e) {
errors.push(e);
}
}
}
if (errors.length == 1) {
throw errors[0];
} else if (errors.length > 1) {
var e = new Error("Multiple errors thrown in handling 'sig', see errors property");
e.errors = errors;
throw e;
}
}
});
MochiKit.Signal.EXPORT_OK = [];
MochiKit.Signal.EXPORT = [
'connect',
'disconnect',
'signal',
'disconnectAll'
];
MochiKit.Signal.__new__ = function (win) {
var m = MochiKit.Base;
this._document = document;
this._window = win;
try {
this.connect(window, 'onunload', this._unloadCache);
} catch (e) {
// pass: might not be a browser
}
this.EXPORT_TAGS = {
':common': this.EXPORT,
':all': m.concat(this.EXPORT, this.EXPORT_OK)
};
m.nameFunctions(this);
};
MochiKit.Signal.__new__(this);
//
// XXX: Internet Explorer blows
//
if (!MochiKit.__compat__) {
connect = MochiKit.Signal.connect;
disconnect = MochiKit.Signal.disconnect;
disconnectAll = MochiKit.Signal.disconnectAll;
signal = MochiKit.Signal.signal;
}
MochiKit.Base._exportSymbols(this, MochiKit.Signal);

View File

@@ -1,181 +0,0 @@
/***
MochiKit.Test 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.Test');
dojo.require('MochiKit.Base');
}
if (typeof(JSAN) != 'undefined') {
JSAN.use("MochiKit.Base", []);
}
try {
if (typeof(MochiKit.Base) == 'undefined') {
throw "";
}
} catch (e) {
throw "MochiKit.Test depends on MochiKit.Base!";
}
if (typeof(MochiKit.Test) == 'undefined') {
MochiKit.Test = {};
}
MochiKit.Test.NAME = "MochiKit.Test";
MochiKit.Test.VERSION = "1.3.1";
MochiKit.Test.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.Test.toString = function () {
return this.__repr__();
};
MochiKit.Test.EXPORT = ["runTests"];
MochiKit.Test.EXPORT_OK = [];
MochiKit.Test.runTests = function (obj) {
if (typeof(obj) == "string") {
obj = JSAN.use(obj);
}
var suite = new MochiKit.Test.Suite();
suite.run(obj);
};
MochiKit.Test.Suite = function () {
this.testIndex = 0;
MochiKit.Base.bindMethods(this);
};
MochiKit.Test.Suite.prototype = {
run: function (obj) {
try {
obj(this);
} catch (e) {
this.traceback(e);
}
},
traceback: function (e) {
var items = MochiKit.Iter.sorted(MochiKit.Base.items(e));
print("not ok " + this.testIndex + " - Error thrown");
for (var i = 0; i < items.length; i++) {
var kv = items[i];
if (kv[0] == "stack") {
kv[1] = kv[1].split(/\n/)[0];
}
this.print("# " + kv.join(": "));
}
},
print: function (s) {
print(s);
},
is: function (got, expected, /* optional */message) {
var res = 1;
var msg = null;
try {
res = MochiKit.Base.compare(got, expected);
} catch (e) {
msg = "Can not compare " + typeof(got) + ":" + typeof(expected);
}
if (res) {
msg = "Expected value did not compare equal";
}
if (!res) {
return this.testResult(true, message);
}
return this.testResult(false, message,
[[msg], ["got:", got], ["expected:", expected]]);
},
testResult: function (pass, msg, failures) {
this.testIndex += 1;
if (pass) {
this.print("ok " + this.testIndex + " - " + msg);
return;
}
this.print("not ok " + this.testIndex + " - " + msg);
if (failures) {
for (var i = 0; i < failures.length; i++) {
this.print("# " + failures[i].join(" "));
}
}
},
isDeeply: function (got, expected, /* optional */message) {
var m = MochiKit.Base;
var res = 1;
try {
res = m.compare(got, expected);
} catch (e) {
// pass
}
if (res === 0) {
return this.ok(true, message);
}
var gk = m.keys(got);
var ek = m.keys(expected);
gk.sort();
ek.sort();
if (m.compare(gk, ek)) {
// differing keys
var cmp = {};
var i;
for (i = 0; i < gk.length; i++) {
cmp[gk[i]] = "got";
}
for (i = 0; i < ek.length; i++) {
if (ek[i] in cmp) {
delete cmp[ek[i]];
} else {
cmp[ek[i]] = "expected";
}
}
var diffkeys = m.keys(cmp);
diffkeys.sort();
var gotkeys = [];
var expkeys = [];
while (diffkeys.length) {
var k = diffkeys.shift();
if (k in Object.prototype) {
continue;
}
(cmp[k] == "got" ? gotkeys : expkeys).push(k);
}
}
return this.testResult((!res), msg,
(msg ? [["got:", got], ["expected:", expected]] : undefined)
);
},
ok: function (res, message) {
return this.testResult(res, message);
}
};
MochiKit.Test.__new__ = function () {
var m = MochiKit.Base;
this.EXPORT_TAGS = {
":common": this.EXPORT,
":all": m.concat(this.EXPORT, this.EXPORT_OK)
};
m.nameFunctions(this);
};
MochiKit.Test.__new__();
MochiKit.Base._exportSymbols(this, MochiKit.Test);

View File

@@ -1,402 +0,0 @@
/***
MochiKit.Visual 1.3.1
See <http://mochikit.com/> for documentation, downloads, license, etc.
(c) 2005 Bob Ippolito and others. All rights Reserved.
***/
if (typeof(dojo) != 'undefined') {
dojo.provide('MochiKit.Visual');
dojo.require('MochiKit.Base');
dojo.require('MochiKit.DOM');
dojo.require('MochiKit.Color');
}
if (typeof(JSAN) != 'undefined') {
JSAN.use("MochiKit.Base", []);
JSAN.use("MochiKit.DOM", []);
JSAN.use("MochiKit.Color", []);
}
try {
if (typeof(MochiKit.Base) == 'undefined' ||
typeof(MochiKit.DOM) == 'undefined' ||
typeof(MochiKit.Color) == 'undefined') {
throw "";
}
} catch (e) {
throw "MochiKit.Visual depends on MochiKit.Base, MochiKit.DOM and MochiKit.Color!";
}
if (typeof(MochiKit.Visual) == "undefined") {
MochiKit.Visual = {};
}
MochiKit.Visual.NAME = "MochiKit.Visual";
MochiKit.Visual.VERSION = "1.3.1";
MochiKit.Visual.__repr__ = function () {
return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.Visual.toString = function () {
return this.__repr__();
};
MochiKit.Visual._RoundCorners = function (e, options) {
e = MochiKit.DOM.getElement(e);
this._setOptions(options);
if (this.options.__unstable__wrapElement) {
e = this._doWrap(e);
}
var color = this.options.color;
var C = MochiKit.Color.Color;
if (this.options.color == "fromElement") {
color = C.fromBackground(e);
} else if (!(color instanceof C)) {
color = C.fromString(color);
}
this.isTransparent = (color.asRGB().a <= 0);
var bgColor = this.options.bgColor;
if (this.options.bgColor == "fromParent") {
bgColor = C.fromBackground(e.offsetParent);
} else if (!(bgColor instanceof C)) {
bgColor = C.fromString(bgColor);
}
this._roundCornersImpl(e, color, bgColor);
};
MochiKit.Visual._RoundCorners.prototype = {
_doWrap: function (e) {
var parent = e.parentNode;
var doc = MochiKit.DOM.currentDocument();
if (typeof(doc.defaultView) == "undefined"
|| doc.defaultView === null) {
return e;
}
var style = doc.defaultView.getComputedStyle(e, null);
if (typeof(style) == "undefined" || style === null) {
return e;
}
var wrapper = MochiKit.DOM.DIV({"style": {
display: "block",
// convert padding to margin
marginTop: style.getPropertyValue("padding-top"),
marginRight: style.getPropertyValue("padding-right"),
marginBottom: style.getPropertyValue("padding-bottom"),
marginLeft: style.getPropertyValue("padding-left"),
// remove padding so the rounding looks right
padding: "0px"
/*
paddingRight: "0px",
paddingLeft: "0px"
*/
}});
wrapper.innerHTML = e.innerHTML;
e.innerHTML = "";
e.appendChild(wrapper);
return e;
},
_roundCornersImpl: function (e, color, bgColor) {
if (this.options.border) {
this._renderBorder(e, bgColor);
}
if (this._isTopRounded()) {
this._roundTopCorners(e, color, bgColor);
}
if (this._isBottomRounded()) {
this._roundBottomCorners(e, color, bgColor);
}
},
_renderBorder: function (el, bgColor) {
var borderValue = "1px solid " + this._borderColor(bgColor);
var borderL = "border-left: " + borderValue;
var borderR = "border-right: " + borderValue;
var style = "style='" + borderL + ";" + borderR + "'";
el.innerHTML = "<div " + style + ">" + el.innerHTML + "</div>";
},
_roundTopCorners: function (el, color, bgColor) {
var corner = this._createCorner(bgColor);
for (var i = 0; i < this.options.numSlices; i++) {
corner.appendChild(
this._createCornerSlice(color, bgColor, i, "top")
);
}
el.style.paddingTop = 0;
el.insertBefore(corner, el.firstChild);
},
_roundBottomCorners: function (el, color, bgColor) {
var corner = this._createCorner(bgColor);
for (var i = (this.options.numSlices - 1); i >= 0; i--) {
corner.appendChild(
this._createCornerSlice(color, bgColor, i, "bottom")
);
}
el.style.paddingBottom = 0;
el.appendChild(corner);
},
_createCorner: function (bgColor) {
var dom = MochiKit.DOM;
return dom.DIV({style: {backgroundColor: bgColor.toString()}});
},
_createCornerSlice: function (color, bgColor, n, position) {
var slice = MochiKit.DOM.SPAN();
var inStyle = slice.style;
inStyle.backgroundColor = color.toString();
inStyle.display = "block";
inStyle.height = "1px";
inStyle.overflow = "hidden";
inStyle.fontSize = "1px";
var borderColor = this._borderColor(color, bgColor);
if (this.options.border && n === 0) {
inStyle.borderTopStyle = "solid";
inStyle.borderTopWidth = "1px";
inStyle.borderLeftWidth = "0px";
inStyle.borderRightWidth = "0px";
inStyle.borderBottomWidth = "0px";
// assumes css compliant box model
inStyle.height = "0px";
inStyle.borderColor = borderColor.toString();
} else if (borderColor) {
inStyle.borderColor = borderColor.toString();
inStyle.borderStyle = "solid";
inStyle.borderWidth = "0px 1px";
}
if (!this.options.compact && (n == (this.options.numSlices - 1))) {
inStyle.height = "2px";
}
this._setMargin(slice, n, position);
this._setBorder(slice, n, position);
return slice;
},
_setOptions: function (options) {
this.options = {
corners: "all",
color: "fromElement",
bgColor: "fromParent",
blend: true,
border: false,
compact: false,
__unstable__wrapElement: false
};
MochiKit.Base.update(this.options, options);
this.options.numSlices = (this.options.compact ? 2 : 4);
},
_whichSideTop: function () {
var corners = this.options.corners;
if (this._hasString(corners, "all", "top")) {
return "";
}
var has_tl = (corners.indexOf("tl") != -1);
var has_tr = (corners.indexOf("tr") != -1);
if (has_tl && has_tr) {
return "";
}
if (has_tl) {
return "left";
}
if (has_tr) {
return "right";
}
return "";
},
_whichSideBottom: function () {
var corners = this.options.corners;
if (this._hasString(corners, "all", "bottom")) {
return "";
}
var has_bl = (corners.indexOf('bl') != -1);
var has_br = (corners.indexOf('br') != -1);
if (has_bl && has_br) {
return "";
}
if (has_bl) {
return "left";
}
if (has_br) {
return "right";
}
return "";
},
_borderColor: function (color, bgColor) {
if (color == "transparent") {
return bgColor;
} else if (this.options.border) {
return this.options.border;
} else if (this.options.blend) {
return bgColor.blendedColor(color);
}
return "";
},
_setMargin: function (el, n, corners) {
var marginSize = this._marginSize(n) + "px";
var whichSide = (
corners == "top" ? this._whichSideTop() : this._whichSideBottom()
);
var style = el.style;
if (whichSide == "left") {
style.marginLeft = marginSize;
style.marginRight = "0px";
} else if (whichSide == "right") {
style.marginRight = marginSize;
style.marginLeft = "0px";
} else {
style.marginLeft = marginSize;
style.marginRight = marginSize;
}
},
_setBorder: function (el, n, corners) {
var borderSize = this._borderSize(n) + "px";
var whichSide = (
corners == "top" ? this._whichSideTop() : this._whichSideBottom()
);
var style = el.style;
if (whichSide == "left") {
style.borderLeftWidth = borderSize;
style.borderRightWidth = "0px";
} else if (whichSide == "right") {
style.borderRightWidth = borderSize;
style.borderLeftWidth = "0px";
} else {
style.borderLeftWidth = borderSize;
style.borderRightWidth = borderSize;
}
},
_marginSize: function (n) {
if (this.isTransparent) {
return 0;
}
var o = this.options;
if (o.compact && o.blend) {
var smBlendedMarginSizes = [1, 0];
return smBlendedMarginSizes[n];
} else if (o.compact) {
var compactMarginSizes = [2, 1];
return compactMarginSizes[n];
} else if (o.blend) {
var blendedMarginSizes = [3, 2, 1, 0];
return blendedMarginSizes[n];
} else {
var marginSizes = [5, 3, 2, 1];
return marginSizes[n];
}
},
_borderSize: function (n) {
var o = this.options;
var borderSizes;
if (o.compact && (o.blend || this.isTransparent)) {
return 1;
} else if (o.compact) {
borderSizes = [1, 0];
} else if (o.blend) {
borderSizes = [2, 1, 1, 1];
} else if (o.border) {
borderSizes = [0, 2, 0, 0];
} else if (this.isTransparent) {
borderSizes = [5, 3, 2, 1];
} else {
return 0;
}
return borderSizes[n];
},
_hasString: function (str) {
for (var i = 1; i< arguments.length; i++) {
if (str.indexOf(arguments[i]) != -1) {
return true;
}
}
return false;
},
_isTopRounded: function () {
return this._hasString(this.options.corners,
"all", "top", "tl", "tr"
);
},
_isBottomRounded: function () {
return this._hasString(this.options.corners,
"all", "bottom", "bl", "br"
);
},
_hasSingleTextChild: function (el) {
return (el.childNodes.length == 1 && el.childNodes[0].nodeType == 3);
}
};
MochiKit.Visual.roundElement = function (e, options) {
new MochiKit.Visual._RoundCorners(e, options);
};
MochiKit.Visual.roundClass = function (tagName, className, options) {
var elements = MochiKit.DOM.getElementsByTagAndClassName(
tagName, className
);
for (var i = 0; i < elements.length; i++) {
MochiKit.Visual.roundElement(elements[i], options);
}
};
// Compatibility with MochiKit 1.0
MochiKit.Visual.Color = MochiKit.Color.Color;
MochiKit.Visual.getElementsComputedStyle = MochiKit.DOM.computedStyle;
/* end of Rico adaptation */
MochiKit.Visual.__new__ = function () {
var m = MochiKit.Base;
m.nameFunctions(this);
this.EXPORT_TAGS = {
":common": this.EXPORT,
":all": m.concat(this.EXPORT, this.EXPORT_OK)
};
};
MochiKit.Visual.EXPORT = [
"roundElement",
"roundClass"
];
MochiKit.Visual.EXPORT_OK = [];
MochiKit.Visual.__new__();
MochiKit.Base._exportSymbols(this, MochiKit.Visual);

View File

@@ -1,17 +0,0 @@
dojo.hostenv.conditionalLoadModule({
"common": [
"MochiKit.Base",
"MochiKit.Iter",
"MochiKit.Logging",
"MochiKit.DateTime",
"MochiKit.Format",
"MochiKit.Async",
"MochiKit.Color"
],
"browser": [
"MochiKit.DOM",
"MochiKit.LoggingPane",
"MochiKit.Visual"
]
});
dojo.hostenv.moduleLoaded("MochiKit.*");

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

View File

@@ -1,163 +0,0 @@
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
/* Container Styles */
.calcontainer {*height:1%;} /* IE */
.calcontainer:after {content:'.';clear:both;display:block;visibility:hidden;height:0;} /* others */
.calbordered {
float:left;
padding:5px;
background-color:#F7F9FB;
border:1px solid #7B9EBD;
}
.calbordered .title {
font:73% Arial,Helvetica,sans-serif;
color:#000;
font-weight:bold;
margin-bottom:5px;
height:auto;
width:304px;
position:relative;
}
.title .close-icon {
position:absolute;
right:0;
top:0;
border:none;
}
.cal2up {
float:left;
}
.calnavleft {
position:absolute;
top:0;
bottom:0;
height:12px;
left:2px;
}
.calnavright {
position:absolute;
top:0;
bottom:0;
height:12px;
right:2px;
}
/* Calendar element styles */
.calendar {
font:73% Arial,Helvetica,sans-serif;
text-align:center;
border-spacing:0;
}
td.calcell {
width:1.5em;
height:1em;
border:1px solid #E0E0E0;
background-color:#FFF;
}
.calendar.wait td.calcell {
color:#999;
background-color:#CCC;
}
.calendar.wait td.calcell a {
color:#999;
font-style:italic;
}
td.calcell a {
color:#003DB8;
text-decoration:none;
}
td.calcell.today {
border:1px solid #000;
}
td.calcell.oom {
cursor:default;
color:#999;
background-color:#EEE;
border:1px solid #E0E0E0;
}
td.calcell.selected {
color:#003DB8;
background-color:#FFF19F;
border:1px solid #FF9900;
}
td.calcell.calcellhover {
cursor:pointer;
color:#FFF;
background-color:#FF9900;
border:1px solid #FF9900;
}
/* Added to perform some correction for Opera 8.5
hover redraw bug */
table:hover {
background-color:#FFF;
}
td.calcell.calcellhover a {
color:#FFF;
}
td.calcell.restricted {
text-decoration:line-through;
}
td.calcell.previous {
color:#CCC;
}
td.calcell.highlight1 { background-color:#CCFF99; }
td.calcell.highlight2 { background-color:#99CCFF; }
td.calcell.highlight3 { background-color:#FFCCCC; }
td.calcell.highlight4 { background-color:#CCFF99; }
.calhead {
border:1px solid #E0E0E0;
vertical-align:middle;
background-color:#FFF;
}
.calheader {
position:relative;
width:100%;
}
.calheader img {
border:none;
}
.calweekdaycell {
color:#666;
font-weight:normal;
}
.calfoot {
background-color:#EEE;
}
.calrowhead, .calrowfoot {
color:#666;
font-size:9px;
font-style:italic;
font-weight:normal;
width:15px;
}
.calrowhead {
border-right-width:2px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

View File

@@ -1,206 +0,0 @@
.overlay {
position:absolute;
display:block;
}
.tt {
visibility:hidden;
position:absolute;
color:#333;
background-color:#FDFFB4;
font-family:arial,helvetica,verdana,sans-serif;
padding:2px;
border:1px solid #FCC90D;
font:100% sans-serif;
width:auto;
}
* html body.masked select {
visibility:hidden;
}
* html div.panel-container select {
visibility:inherit;
}
* html div.drag select {
visibility:hidden;
}
* html div.hide-select select {
visibility:hidden;
}
.mask {
z-index:0;
display:none;
position:absolute;
top:0;
left:0;
background-color:#CCC;
-moz-opacity: 0.5;
opacity:.50;
filter: alpha(opacity=50);
}
.mask[id]{ /* IE6 and below Can't See This */
position:fixed;
}
.hide-scrollbars * {
overflow:hidden;
}
.hide-scrollbars textarea, .hide-scrollbars select {
overflow:hidden;
display:none;
}
.show-scrollbars textarea, .show-scrollbars select {
overflow:visible;
}
.panel-container {
position:absolute;
background-color:transparent;
z-index:6;
visibility:hidden;
overflow:visible;
width:auto;
}
.panel-container.matte {
padding:3px;
background-color:#FFF;
}
.panel-container.matte .underlay {
display:none;
}
.panel-container.shadow {
padding:0px;
background-color:transparent;
}
.panel-container.shadow .underlay {
visibility:inherit;
position:absolute;
background-color:#CCC;
top:3px;left:3px;
z-index:0;
width:100%;
height:100%;
-moz-opacity: 0.7;
opacity:.70;
filter:alpha(opacity=70);
}
.panel {
visibility:hidden;
border-collapse:separate;
position:relative;
left:0px;top:0px;
font:1em Arial;
background-color:#FFF;
border:1px solid #000;
z-index:1;
overflow:auto;
}
.panel .hd {
background-color:#3d77cb;
color:#FFF;
font-size:1em;
height:1em;
border:1px solid #FFF;
border-bottom:1px solid #000;
font-weight:bold;
overflow:hidden;
padding:4px;
}
.panel .bd {
overflow:hidden;
padding:4px;
}
.panel .bd p {
margin:0 0 1em;
}
.panel .close {
position:absolute;
top:5px;
right:4px;
z-index:6;
height:12px;
width:12px;
margin:0px;
padding:0px;
background-repeat:no-repeat;
cursor:pointer;
visibility:inherit;
}
.panel .close.nonsecure {
background-image:url(http://us.i1.yimg.com/us.yimg.com/i/nt/ic/ut/alt3/close12_1.gif);
}
.panel .close.secure {
background-image:url(https://a248.e.akamai.net/sec.yimg.com/i/nt/ic/ut/alt3/close12_1.gif);
}
.panel .ft {
padding:4px;
overflow:hidden;
}
.simple-dialog .bd .icon {
background-repeat:no-repeat;
width:16px;
height:16px;
margin-right:10px;
float:left;
}
.dialog .ft, .simple-dialog .ft {
padding-bottom:5px;
padding-right:5px;
text-align:right;
}
.dialog form, .simple-dialog form {
margin:0;
}
.button-group button {
font:100 76% verdana;
text-decoration:none;
background-color: #E4E4E4;
color: #333;
cursor: hand;
vertical-align: middle;
border: 2px solid #797979;
border-top-color:#FFF;
border-left-color:#FFF;
margin:2px;
padding:2px;
}
.button-group button.default {
font-weight:bold;
}
.button-group button:hover, .button-group button.hover {
border:2px solid #90A029;
background-color:#EBF09E;
border-top-color:#FFF;
border-left-color:#FFF;
}
.button-group button:active {
border:2px solid #E4E4E4;
background-color:#BBB;
border-top-color:#333;
border-left-color:#333;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

View File

@@ -1,264 +0,0 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
*/
/* Menu styles */
div.yuimenu {
z-index:1;
visibility:hidden;
background-color:#f6f7ee;
border:solid 1px #c4c4be;
padding:1px;
}
/* MenuBar Styles */
div.yuimenubar {
background-color:#f6f7ee;
}
/*
Application of "zoom:1" triggers "haslayout" in IE so that the module's
body clears its floated elements
*/
div.yuimenubar div.bd {
zoom:1;
}
/*
Clear the module body for other browsers
*/
div.yuimenubar div.bd:after {
content:'.';
display:block;
clear:both;
visibility:hidden;
height:0;
}
/* Matches the group title (H6) inside a Menu or MenuBar instance */
div.yuimenu h6,
div.yuimenubar h6 {
font-size:100%;
font-weight:normal;
margin:0;
border:solid 1px #c4c4be;
color:#b9b9b9;
}
div.yuimenubar h6 {
float:left;
display:inline; /* Prevent margin doubling in IE */
padding:4px 12px;
border-width:0 1px 0 0;
}
div.yuimenu h6 {
float:none;
display:block;
border-width:1px 0 0 0;
padding:5px 10px 0 10px;
}
/* Matches the UL inside a Menu or MenuBar instance */
div.yuimenubar ul {
list-style-type:none;
margin:0;
padding:0;
overflow:hidden;
}
div.yuimenu ul {
list-style-type:none;
border:solid 1px #c4c4be;
border-width:1px 0 0 0;
margin:0;
padding:10px 0;
}
div.yuimenu ul.first,
div.yuimenu ul.hastitle,
div.yuimenu h6.first {
border-width:0;
}
/* MenuItem and MenuBarItem styles */
div.yuimenu li,
div.yuimenubar li {
font-size:85%;
cursor:pointer;
cursor:hand;
white-space:nowrap;
text-align:left;
}
div.yuimenu li.yuimenuitem {
padding:2px 24px;
}
div.yuimenu li li,
div.yuimenubar li li {
font-size:100%;
}
/* Matches the help text for a MenuItem instance */
div.yuimenu li em {
font-style:normal;
margin:0 0 0 40px;
}
div.yuimenu li a em {
margin:0;
}
div.yuimenu li a,
div.yuimenubar li a {
/*
"zoom:1" triggers "haslayout" in IE to ensure that the mouseover and
mouseout events bubble to the parent LI in IE.
*/
zoom:1;
color:#000;
text-decoration:none;
}
/* Matches the sub menu indicator for a MenuItem instance */
div.yuimenu li img {
margin:0 -16px 0 10px;
border:0;
}
div.yuimenu li.hassubmenu,
div.yuimenu li.hashelptext {
text-align:right;
}
div.yuimenu li.hassubmenu a.hassubmenu,
div.yuimenu li.hashelptext a.hashelptext {
float:left;
display:inline; /* Prevent margin doubling in IE */
text-align:left;
}
/* Matches focused and selected MenuItem instances */
div.yuimenu li.selected,
div.yuimenubar li.selected {
background-color:#8c8ad0;
}
div.yuimenu li.selected a.selected,
div.yuimenubar li.selected a.selected {
text-decoration:underline;
}
div.yuimenu li.selected a.selected,
div.yuimenu li.selected em.selected,
div.yuimenubar li.selected a.selected {
color:#fff;
}
/* Matches disabled MenuItem instances */
div.yuimenu li.disabled,
div.yuimenubar li.disabled {
cursor:default;
}
div.yuimenu li.disabled a.disabled,
div.yuimenu li.disabled em.disabled,
div.yuimenubar li.disabled a.disabled {
color:#b9b9b9;
cursor:default;
}
div.yuimenubar li.yuimenubaritem {
float:left;
display:inline; /* Prevent margin doubling in IE */
border-width:0 0 0 1px;
border-style:solid;
border-color:#c4c4be;
padding:4px 24px;
margin:0;
}
div.yuimenubar li.yuimenubaritem.first {
border-width:0;
}
div.yuimenubar li.yuimenubaritem img {
margin:0 0 0 10px;
vertical-align:middle;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 B

View File

@@ -1,98 +0,0 @@
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
/* first or middle sibling, no children */
.ygtvtn {
width:16px; height:22px;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/tn.gif) 0 0 no-repeat;
}
/* first or middle sibling, collapsable */
.ygtvtm {
width:16px; height:22px;
cursor:pointer ;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/tm.gif) 0 0 no-repeat;
}
/* first or middle sibling, collapsable, hover */
.ygtvtmh {
width:16px; height:22px;
cursor:pointer ;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/tmh.gif) 0 0 no-repeat;
}
/* first or middle sibling, expandable */
.ygtvtp {
width:16px; height:22px;
cursor:pointer ;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/tp.gif) 0 0 no-repeat;
}
/* first or middle sibling, expandable, hover */
.ygtvtph {
width:16px; height:22px;
cursor:pointer ;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/tph.gif) 0 0 no-repeat;
}
/* last sibling, no children */
.ygtvln {
width:16px; height:22px;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/ln.gif) 0 0 no-repeat;
}
/* Last sibling, collapsable */
.ygtvlm {
width:16px; height:22px;
cursor:pointer ;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/lm.gif) 0 0 no-repeat;
}
/* Last sibling, collapsable, hover */
.ygtvlmh {
width:16px; height:22px;
cursor:pointer ;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/lmh.gif) 0 0 no-repeat;
}
/* Last sibling, expandable */
.ygtvlp {
width:16px; height:22px;
cursor:pointer ;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/lp.gif) 0 0 no-repeat;
}
/* Last sibling, expandable, hover */
.ygtvlph {
width:16px; height:22px; cursor:pointer ;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/lph.gif) 0 0 no-repeat;
}
/* Loading icon */
.ygtvloading {
width:16px; height:22px;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/loading.gif) 0 0 no-repeat;
}
/* the style for the empty cells that are used for rendering the depth
* of the node */
.ygtvdepthcell {
width:16px; height:22px;
background: url(../../../../../../../i/us/nt/widg/tree/dflt/vline.gif) 0 0 no-repeat;
}
.ygtvblankdepthcell { width:16px; height:22px; }
/* the style of the div around each node */
.ygtvitem { }
/* the style of the div around each node's collection of children */
.ygtvchildren { }
* html .ygtvchildren { height:2%; }
/* the style of the text label in ygTextNode */
.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover {
margin-left:2px;
text-decoration: none;
}
.ygtvspacer { height: 10px; width: 10px; margin: 2px; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

View File

@@ -1,135 +0,0 @@
YAHOO.widget.AutoComplete=function(inputEl,containerEl,oDataSource,oConfigs){if(inputEl&&containerEl&&oDataSource){if(oDataSource.getResults){this.dataSource=oDataSource;}
else{return;}
if(YAHOO.util.Dom.inDocument(inputEl)){if(typeof inputEl=="string"){this._sName=inputEl+YAHOO.widget.AutoComplete._nIndex;this._oTextbox=document.getElementById(inputEl);}
else{this._sName=(inputEl.id)?inputEl.id+YAHOO.widget.AutoComplete._nIndex:"yac_inputEl"+YAHOO.widget.AutoComplete._nIndex;this._oTextbox=inputEl;}}
else{return;}
if(YAHOO.util.Dom.inDocument(containerEl)){if(typeof containerEl=="string"){this._oContainer=document.getElementById(containerEl);}
else{this._oContainer=containerEl;}}
else{return;}
if(typeof oConfigs=="object"){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig];}}}
var oSelf=this;var oTextbox=this._oTextbox;var oContainer=this._oContainer;YAHOO.util.Event.addListener(oTextbox,'keyup',oSelf._onTextboxKeyUp,oSelf);YAHOO.util.Event.addListener(oTextbox,'keydown',oSelf._onTextboxKeyDown,oSelf);YAHOO.util.Event.addListener(oTextbox,'keypress',oSelf._onTextboxKeyPress,oSelf);YAHOO.util.Event.addListener(oTextbox,'focus',oSelf._onTextboxFocus,oSelf);YAHOO.util.Event.addListener(oTextbox,'blur',oSelf._onTextboxBlur,oSelf);YAHOO.util.Event.addListener(oContainer,'mouseover',oSelf._onContainerMouseover,oSelf);YAHOO.util.Event.addListener(oContainer,'mouseout',oSelf._onContainerMouseout,oSelf);YAHOO.util.Event.addListener(oContainer,'scroll',oSelf._onContainerScroll,oSelf);if(oTextbox.form&&this.allowBrowserAutocomplete){YAHOO.util.Event.addListener(oTextbox.form,'submit',oSelf._onFormSubmit,oSelf);}
this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);oTextbox.setAttribute("autocomplete","off");this._initProps();}
else{}};YAHOO.widget.AutoComplete.prototype.dataSource=null;YAHOO.widget.AutoComplete.prototype.minQueryLength=1;YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;YAHOO.widget.AutoComplete.prototype.queryDelay=0.5;YAHOO.widget.AutoComplete.prototype.highlightClassName="highlight";YAHOO.widget.AutoComplete.prototype.delimChar=null;YAHOO.widget.AutoComplete.prototype.typeAhead=false;YAHOO.widget.AutoComplete.prototype.animHoriz=false;YAHOO.widget.AutoComplete.prototype.animVert=true;YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;YAHOO.widget.AutoComplete.prototype.forceSelection=false;YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;YAHOO.widget.AutoComplete.prototype.getName=function(){return this._sName;};YAHOO.widget.AutoComplete.prototype.getListIds=function(){return this._aListIds;};YAHOO.widget.AutoComplete.prototype.setHeader=function(sHeader){if(sHeader){this._oHeader.innerHTML=sHeader;this._oHeader.style.display="block";}};YAHOO.widget.AutoComplete.prototype.setFooter=function(sFooter){if(sFooter){this._oFooter.innerHTML=sFooter;this._oFooter.style.display="block";}};YAHOO.widget.AutoComplete.prototype.useIFrame=false;YAHOO.widget.AutoComplete.prototype.formatResult=function(oResultItem,sQuery){var sResult=oResultItem[0];if(sResult){return sResult;}
else{return"";}};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;YAHOO.widget.AutoComplete._nIndex=0;YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._oTextbox=null;YAHOO.widget.AutoComplete.prototype._bFocused=true;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._oContainer=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._oIFrame=null;YAHOO.widget.AutoComplete.prototype._oContent=null;YAHOO.widget.AutoComplete.prototype._oHeader=null;YAHOO.widget.AutoComplete.prototype._oFooter=null;YAHOO.widget.AutoComplete.prototype._aListIds=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sSavedQuery=null;YAHOO.widget.AutoComplete.prototype._oCurItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._initProps=function(){var minQueryLength=this.minQueryLength;if(isNaN(minQueryLength)||(minQueryLength<1)){minQueryLength=1;}
var maxResultsDisplayed=this.maxResultsDisplayed;if(isNaN(this.maxResultsDisplayed)||(this.maxResultsDisplayed<1)){this.maxResultsDisplayed=10;}
var queryDelay=this.queryDelay;if(isNaN(this.queryDelay)||(this.queryDelay<0)){this.queryDelay=0.5;}
var aDelimChar=(this.delimChar)?this.delimChar:null;if(aDelimChar){if(typeof aDelimChar=="string"){this.delimChar=[aDelimChar];}
else if(aDelimChar.constructor!=Array){this.delimChar=null;}}
var animSpeed=this.animSpeed;if(this.animHoriz||this.animVert){if(isNaN(animSpeed)||(animSpeed<0)){animSpeed=0.3;}
if(!this._oAnim&&YAHOO.util.Anim){this._oAnim=new YAHOO.util.Anim(this._oContainer,{},animSpeed);}
else if(this._oAnim){this._oAnim.duration=animSpeed;}}
if(this.forceSelection&&this.delimChar){}
if(!this._aListIds){this._aListIds=[];}
if(!this._aListIds||(this.maxResultsDisplayed!=this._aListIds.length)){this._initContainer();}};YAHOO.widget.AutoComplete.prototype._initContainer=function(){this._aListIds=[];var aItemsMarkup=[];var sName=this._sName;var sPrefix=sName+"item";var sHeaderID=sName+"header";var sFooterID=sName+"footer";for(var i=this.maxResultsDisplayed-1;i>=0;i--){var sItemID=sPrefix+i;this._aListIds[i]=sItemID;aItemsMarkup.unshift("<li id='"+sItemID+"'></li>\n");}
var sList="<ul id='"+sName+"list'>"+
aItemsMarkup.join("")+"</ul>";var sContent=(this.useIFrame)?["<div id='",sName,"content'>","<div id='",sHeaderID,"' class='ac_hd'></div><div class='ac_bd'>",sList,"</div><div id='",sFooterID,"' class='ac_ft'></div>","</div><iframe id='",sName,"iframe' src='about:blank' frameborder='0' scrolling='no'>","</iframe>"]:["<div id='",sHeaderID,"' class='ac_hd'></div><div class='ac_bd'>",sList,"</div><div id='",sFooterID,"' class='ac_ft'></div>"];sContent=sContent.join("");this._oContainer.innerHTML=sContent;this._oHeader=document.getElementById(sHeaderID);this._oFooter=document.getElementById(sFooterID);if(this.useIFrame){this._oContent=document.getElementById(sName+"content");this._oIFrame=document.getElementById(sName+"iframe");this._oContent.style.position="relative";this._oIFrame.style.position="relative";this._oContent.style.zIndex=9050;}
this._oContainer.style.display="none";this._oHeader.style.display="none";this._oFooter.style.display="none";this._initItems();};YAHOO.widget.AutoComplete.prototype._initItems=function(){for(var i=this.maxResultsDisplayed-1;i>=0;i--){var oItem=document.getElementById(this._aListIds[i]);this._initItem(oItem,i);}};YAHOO.widget.AutoComplete.prototype._initItem=function(oItem,nItemIndex){var oSelf=this;oItem.style.display="none";oItem._nItemIndex=nItemIndex;oItem.mouseover=oItem.mouseout=oItem.onclick=null;YAHOO.util.Event.addListener(oItem,'mouseover',oSelf._onItemMouseover,oSelf);YAHOO.util.Event.addListener(oItem,'mouseout',oSelf._onItemMouseout,oSelf);YAHOO.util.Event.addListener(oItem,'click',oSelf._onItemMouseclick,oSelf);};YAHOO.widget.AutoComplete.prototype._onItemMouseover=function(v,oSelf){oSelf._toggleHighlight(this,'mouseover');oSelf.itemMouseOverEvent.fire(oSelf,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseout=function(v,oSelf){oSelf._toggleHighlight(this,'mouseout');oSelf.itemMouseOutEvent.fire(oSelf,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseclick=function(v,oSelf){oSelf._toggleHighlight(this,'mouseover');oSelf._selectItem(this);};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(v,oSelf){oSelf._bOverContainer=true;};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(v,oSelf){oSelf._bOverContainer=false;if(oSelf._oCurItem){oSelf._toggleHighlight(oSelf._oCurItem,'mouseover');}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(v,oSelf){oSelf._oTextbox.focus();};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(v,oSelf){var nKeyCode=v.keyCode;switch(nKeyCode){case 9:if(oSelf.delimChar&&(oSelf._nKeyCode!=nKeyCode)){if(oSelf._bContainerOpen){YAHOO.util.Event.stopEvent(v);}}
if(oSelf._oCurItem){oSelf._selectItem(oSelf._oCurItem);}
else{oSelf._clearList();}
break;case 13:if(oSelf._nKeyCode!=nKeyCode){if(oSelf._bContainerOpen){YAHOO.util.Event.stopEvent(v);}}
if(oSelf._oCurItem){oSelf._selectItem(oSelf._oCurItem);}
else{oSelf._clearList();}
break;case 27:oSelf._clearList();return;case 39:oSelf._jumpSelection();break;case 38:YAHOO.util.Event.stopEvent(v);oSelf._moveSelection(nKeyCode);break;case 40:YAHOO.util.Event.stopEvent(v);oSelf._moveSelection(nKeyCode);break;default:break;}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(v,oSelf){var nKeyCode=v.keyCode;switch(nKeyCode){case 9:case 13:if(oSelf.delimChar&&(oSelf._nKeyCode!=nKeyCode)){if(oSelf._bContainerOpen){YAHOO.util.Event.stopEvent(v);}}
break;case 38:case 40:YAHOO.util.Event.stopEvent(v);break;default:break;}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(v,oSelf){oSelf._initProps();var nKeyCode=v.keyCode;oSelf._nKeyCode=nKeyCode;var sChar=String.fromCharCode(nKeyCode);var sText=this.value;if(oSelf._isIgnoreKey(nKeyCode)||(sText.toLowerCase()==this._sCurQuery)){return;}
else{oSelf.textboxKeyEvent.fire(oSelf,nKeyCode);}
if(oSelf.queryDelay>0){var nDelayID=setTimeout(function(){oSelf._sendQuery(sText);},(oSelf.queryDelay*1000));if(oSelf._nDelayID!=-1){clearTimeout(oSelf._nDelayID);}
oSelf._nDelayID=nDelayID;}
else{oSelf._sendQuery(sText);}};YAHOO.widget.AutoComplete.prototype._isIgnoreKey=function(nKeyCode){if(this.typeAhead){if((nKeyCode==8)||(nKeyCode==39)||(nKeyCode==46)){return true;}}
if((nKeyCode==9)||(nKeyCode==13)||(nKeyCode==16)||(nKeyCode==17)||(nKeyCode>=18&&nKeyCode<=20)||(nKeyCode==27)||(nKeyCode>=33&&nKeyCode<=35)||(nKeyCode>=36&&nKeyCode<=38)||(nKeyCode==40)||(nKeyCode>=44&&nKeyCode<=45)){return true;}
return false;};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(v,oSelf){oSelf._oTextbox.setAttribute("autocomplete","off");oSelf._bFocused=true;oSelf.textboxFocusEvent.fire(oSelf);};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(v,oSelf){if(!oSelf._bOverContainer||(oSelf._nKeyCode==9)){if(oSelf.forceSelection&&!oSelf._bItemSelected){if(!oSelf._bContainerOpen||(oSelf._bContainerOpen&&!oSelf._textMatchesOption())){oSelf._clearSelection();}}
if(oSelf._bContainerOpen){oSelf._clearList();}
oSelf._bFocused=false;oSelf.textboxBlurEvent.fire(oSelf);}};YAHOO.widget.AutoComplete.prototype._onFormSubmit=function(v,oSelf){oSelf._oTextbox.setAttribute("autocomplete","on");};YAHOO.widget.AutoComplete.prototype._sendQuery=function(sQuery){var aDelimChar=(this.delimChar)?this.delimChar:null;if(aDelimChar){var nDelimIndex=-1;for(var i=aDelimChar.length-1;i>=0;i--){var nNewIndex=sQuery.lastIndexOf(aDelimChar[i]);if(nNewIndex>nDelimIndex){nDelimIndex=nNewIndex;}}
if(aDelimChar[i]==" "){for(var j=aDelimChar.length-1;j>=0;j--){if(sQuery[nDelimIndex-1]==aDelimChar[j]){nDelimIndex--;break;}}}
if(nDelimIndex>-1){var nQueryStart=nDelimIndex+1;while(sQuery.charAt(nQueryStart)==" "){nQueryStart+=1;}
this._sSavedQuery=sQuery.substring(0,nQueryStart);sQuery=sQuery.substr(nQueryStart);}
else if(sQuery.indexOf(this._sSavedQuery)<0){this._sSavedQuery=null;}}
if(sQuery.length<this.minQueryLength){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}
this._clearList();return;}
sQuery=encodeURI(sQuery);this._nDelayID=-1;this.dataRequestEvent.fire(this,sQuery);this.dataSource.getResults(this._populateList,sQuery,this);};YAHOO.widget.AutoComplete.prototype._clearList=function(){this._oContainer.scrollTop=0;var aItems=this._aListIds;for(var i=aItems.length-1;i>=0;i--){document.getElementById(aItems[i]).style.display="none";}
if(this._oCurItem){this._toggleHighlight(this._oCurItem,'mouseout');}
this._oCurItem=null;this._nDisplayedItems=0;this._sCurQuery=null;this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._populateList=function(sQuery,aResults,oSelf){if(aResults===null){oSelf.dataErrorEvent.fire(oSelf,sQuery);}
else{oSelf.dataReturnEvent.fire(oSelf,sQuery,aResults);}
if(!oSelf._bFocused||!aResults){return;}
var isOpera=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);oSelf._oContainer.style.width=(!isOpera)?null:"";oSelf._oContainer.style.height=(!isOpera)?null:"";var sCurQuery=decodeURI(sQuery);oSelf._sCurQuery=sCurQuery;var aItems=oSelf._aListIds;oSelf._bItemSelected=false;var nItems=Math.min(aResults.length,oSelf.maxResultsDisplayed);oSelf._nDisplayedItems=nItems;if(nItems>0){for(var i=nItems-1;i>=0;i--){var oItemi=document.getElementById(aItems[i]);var oResultItemi=aResults[i];oItemi.innerHTML=oSelf.formatResult(oResultItemi,sCurQuery);oItemi.style.display="list-item";oItemi._sResultKey=oResultItemi[0];oItemi._oResultData=oResultItemi;}
for(var j=aItems.length-1;j>=nItems;j--){var oItemj=document.getElementById(aItems[j]);oItemj.innerHTML=null;oItemj.style.display="none";oItemj._sResultKey=null;oItemj._oResultData=null;}
var oFirstItem=document.getElementById(aItems[0]);oSelf._toggleHighlight(oFirstItem,'mouseover');oSelf._toggleContainer(true);oSelf.itemArrowToEvent.fire(oSelf,oFirstItem);oSelf._typeAhead(oFirstItem,sQuery);oSelf._oCurItem=oFirstItem;}
else{oSelf._clearList();}};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var sValue=this._oTextbox.value;var sChar=(this.delimChar)?this.delimChar[0]:null;var nIndex=(sChar)?sValue.lastIndexOf(sChar,sValue.length-2):-1;if(nIndex>-1){this._oTextbox.value=sValue.substring(0,nIndex);}
else{this._oTextbox.value="";}
this._sSavedQuery=this._oTextbox.value;this.selectionEnforceEvent.fire(this);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var foundMatch=false;for(var i=this._nDisplayedItems-1;i>=0;i--){var oItem=document.getElementById(this._aListIds[i]);var sMatch=oItem._sResultKey.toLowerCase();if(sMatch==this._sCurQuery.toLowerCase()){foundMatch=true;break;}}
return(foundMatch);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(oItem,sQuery){var oTextbox=this._oTextbox;var sValue=this._oTextbox.value;if(!this.typeAhead){return;}
if(!oTextbox.setSelectionRange&&!oTextbox.createTextRange){return;}
var nStart=sValue.length;this._updateValue(oItem);var nEnd=oTextbox.value.length;this._selectText(oTextbox,nStart,nEnd);var sPrefill=oTextbox.value.substr(nStart,nEnd);this.typeAheadEvent.fire(this,sQuery,sPrefill);};YAHOO.widget.AutoComplete.prototype._selectText=function(oTextbox,nStart,nEnd){if(oTextbox.setSelectionRange){oTextbox.setSelectionRange(nStart,nEnd);}
else if(oTextbox.createTextRange){var oTextRange=oTextbox.createTextRange();oTextRange.moveStart("character",nStart);oTextRange.moveEnd("character",nEnd-oTextbox.value.length);oTextRange.select();}
else{oTextbox.select();}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(bShow){var oContainer=this._oContainer;if(!bShow&&!this._bContainerOpen){oContainer.style.display="none";return;}
var oContent=this._oContent;var oIFrame=this._oIFrame;if(bShow&&oContent&&oIFrame){var sDisplay=oContainer.style.display;oContainer.style.display="block";oIFrame.style.width=oContent.offsetWidth+"px";oIFrame.style.height=oContent.offsetHeight+"px";oIFrame.style.marginTop="-"+oContent.offsetHeight+"px";oContainer.style.display=sDisplay;}
var oAnim=this._oAnim;if(oAnim&&oAnim.getEl()&&(this.animHoriz||this.animVert)){if(oAnim.isAnimated()){oAnim.stop();}
var oClone=oContainer.cloneNode(true);oContainer.parentNode.appendChild(oClone);oClone.style.top="-9000px";oClone.style.display="block";var wExp=oClone.offsetWidth;var hExp=oClone.offsetHeight;var wColl=(this.animHoriz)?0:wExp;var hColl=(this.animVert)?0:hExp;oAnim.attributes=(bShow)?{width:{to:wExp},height:{to:hExp}}:{width:{to:wColl},height:{to:hColl}};if(bShow&&!this._bContainerOpen){oContainer.style.width=wColl+"px";oContainer.style.height=hColl+"px";}
else{oContainer.style.width=wExp+"px";oContainer.style.height=hExp+"px";}

View File

@@ -1,211 +0,0 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.10.0
*/
YAHOO.widget.DateMath=new function(){this.DAY="D";this.WEEK="W";this.YEAR="Y";this.MONTH="M";this.ONE_DAY_MS=1000*60*60*24;this.add=function(date,field,amount){var d=new Date(date.getTime());switch(field)
{case this.MONTH:var newMonth=date.getMonth()+amount;var years=0;if(newMonth<0){while(newMonth<0)
{newMonth+=12;years-=1;}}else if(newMonth>11){while(newMonth>11)
{newMonth-=12;years+=1;}}
d.setMonth(newMonth);d.setFullYear(date.getFullYear()+years);break;case this.DAY:d.setDate(date.getDate()+amount);break;case this.YEAR:d.setFullYear(date.getFullYear()+amount);break;case this.WEEK:d.setDate(date.getDate()+7);break;}
return d;};this.subtract=function(date,field,amount){return this.add(date,field,(amount*-1));};this.before=function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()<ms){return true;}else{return false;}};this.after=function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()>ms){return true;}else{return false;}};this.getJan1=function(calendarYear){return new Date(calendarYear,0,1);};this.getDayOffset=function(date,calendarYear){var beginYear=this.getJan1(calendarYear);var dayOffset=Math.ceil((date.getTime()-beginYear.getTime())/this.ONE_DAY_MS);return dayOffset;};this.getWeekNumber=function(date,calendarYear,weekStartsOn){if(!weekStartsOn){weekStartsOn=0;}
if(!calendarYear){calendarYear=date.getFullYear();}
var weekNum=-1;var jan1=this.getJan1(calendarYear);var jan1DayOfWeek=jan1.getDay();var month=date.getMonth();var day=date.getDate();var year=date.getFullYear();var dayOffset=this.getDayOffset(date,calendarYear);if(dayOffset<0&&dayOffset>=(-1*jan1DayOfWeek)){weekNum=1;}else{weekNum=1;var testDate=this.getJan1(calendarYear);while(testDate.getTime()<date.getTime()&&testDate.getFullYear()==calendarYear){weekNum+=1;testDate=this.add(testDate,this.WEEK,1);}}
return weekNum;};this.isYearOverlapWeek=function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getFullYear()!=weekBeginDate.getFullYear()){overlaps=true;}
return overlaps;};this.isMonthOverlapWeek=function(weekBeginDate){var overlaps=false;var nextWeek=this.add(weekBeginDate,this.DAY,6);if(nextWeek.getMonth()!=weekBeginDate.getMonth()){overlaps=true;}
return overlaps;};this.findMonthStart=function(date){var start=new Date(date.getFullYear(),date.getMonth(),1);return start;};this.findMonthEnd=function(date){var start=this.findMonthStart(date);var nextMonth=this.add(start,this.MONTH,1);var end=this.subtract(nextMonth,this.DAY,1);return end;};this.clearTime=function(date){date.setHours(0,0,0,0);return date;};}
YAHOO.widget.Calendar_Core=function(id,containerId,monthyear,selected){if(arguments.length>0)
{this.init(id,containerId,monthyear,selected);}}
YAHOO.widget.Calendar_Core.IMG_ROOT=(window.location.href.toLowerCase().indexOf("https")==0?"https://a248.e.akamai.net/sec.yimg.com/i/":"http://us.i1.yimg.com/us.yimg.com/i/");YAHOO.widget.Calendar_Core.DATE="D";YAHOO.widget.Calendar_Core.MONTH_DAY="MD";YAHOO.widget.Calendar_Core.WEEKDAY="WD";YAHOO.widget.Calendar_Core.RANGE="R";YAHOO.widget.Calendar_Core.MONTH="M";YAHOO.widget.Calendar_Core.DISPLAY_DAYS=42;YAHOO.widget.Calendar_Core.STOP_RENDER="S";YAHOO.widget.Calendar_Core.prototype={Config:null,parent:null,index:-1,cells:null,weekHeaderCells:null,weekFooterCells:null,cellDates:null,id:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,pageDate:null,_pageDate:null,minDate:null,maxDate:null,selectedDates:null,_selectedDates:null,shellRendered:false,table:null,headerCell:null};YAHOO.widget.Calendar_Core.prototype.init=function(id,containerId,monthyear,selected){this.setupConfig();this.id=id;this.cellDates=new Array();this.cells=new Array();this.renderStack=new Array();this._renderStack=new Array();this.oDomContainer=document.getElementById(containerId);this.today=new Date();YAHOO.widget.DateMath.clearTime(this.today);var month;var year;if(monthyear)
{var aMonthYear=monthyear.split(this.Locale.DATE_FIELD_DELIMITER);month=parseInt(aMonthYear[this.Locale.MY_MONTH_POSITION-1]);year=parseInt(aMonthYear[this.Locale.MY_YEAR_POSITION-1]);}else{month=this.today.getMonth()+1;year=this.today.getFullYear();}
this.pageDate=new Date(year,month-1,1);this._pageDate=new Date(this.pageDate.getTime());if(selected)
{this.selectedDates=this._parseDates(selected);this._selectedDates=this.selectedDates.concat();}else{this.selectedDates=new Array();this._selectedDates=new Array();}
this.wireDefaultEvents();this.wireCustomEvents();};YAHOO.widget.Calendar_Core.prototype.wireDefaultEvents=function(){this.doSelectCell=function(e,cal){var cell=this;var index=cell.index;var d=cal.cellDates[index];var date=new Date(d[0],d[1]-1,d[2]);if(!cal.isDateOOM(date)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_RESTRICTED)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_OOB)){if(cal.Options.MULTI_SELECT){var link=cell.getElementsByTagName("A")[0];link.blur();var cellDate=cal.cellDates[index];var cellDateIndex=cal._indexOfSelectedFieldArray(cellDate);if(cellDateIndex>-1)
{cal.deselectCell(index);}else{cal.selectCell(index);}}else{var link=cell.getElementsByTagName("A")[0];link.blur()
cal.selectCell(index);}}}
this.doCellMouseOver=function(e,cal){var cell=this;var index=cell.index;var d=cal.cellDates[index];var date=new Date(d[0],d[1]-1,d[2]);if(!cal.isDateOOM(date)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_RESTRICTED)&&!YAHOO.util.Dom.hasClass(cell,cal.Style.CSS_CELL_OOB)){YAHOO.widget.Calendar_Core.prependCssClass(cell,cal.Style.CSS_CELL_HOVER);}}
this.doCellMouseOut=function(e,cal){YAHOO.widget.Calendar_Core.removeCssClass(this,cal.Style.CSS_CELL_HOVER);}
this.doNextMonth=function(e,cal){cal.nextMonth();}
this.doPreviousMonth=function(e,cal){cal.previousMonth();}}
YAHOO.widget.Calendar_Core.prototype.wireCustomEvents=function(){}
YAHOO.widget.Calendar_Core.prototype.setupConfig=function(){this.Config=new Object();this.Config.Style={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTED:"selected",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_CELL_OOB:"previous",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"calendar",CSS_BORDER:"calbordered",CSS_CONTAINER:"calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};this.Style=this.Config.Style;this.Config.Locale={MONTHS_SHORT:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],MONTHS_LONG:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKDAYS_1CHAR:["S","M","T","W","T","F","S"],WEEKDAYS_SHORT:["Su","Mo","Tu","We","Th","Fr","Sa"],WEEKDAYS_MEDIUM:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],WEEKDAYS_LONG:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],DATE_DELIMITER:",",DATE_FIELD_DELIMITER:"/",DATE_RANGE_DELIMITER:"-",MY_MONTH_POSITION:1,MY_YEAR_POSITION:2,MD_MONTH_POSITION:1,MD_DAY_POSITION:2,MDY_MONTH_POSITION:1,MDY_DAY_POSITION:2,MDY_YEAR_POSITION:3};this.Locale=this.Config.Locale;this.Config.Options={MULTI_SELECT:false,SHOW_WEEKDAYS:true,START_WEEKDAY:0,SHOW_WEEK_HEADER:false,SHOW_WEEK_FOOTER:false,HIDE_BLANK_WEEKS:false,NAV_ARROW_LEFT:YAHOO.widget.Calendar_Core.IMG_ROOT+"us/tr/callt.gif",NAV_ARROW_RIGHT:YAHOO.widget.Calendar_Core.IMG_ROOT+"us/tr/calrt.gif"};this.Options=this.Config.Options;this.customConfig();if(!this.Options.LOCALE_MONTHS){this.Options.LOCALE_MONTHS=this.Locale.MONTHS_LONG;}
if(!this.Options.LOCALE_WEEKDAYS){this.Options.LOCALE_WEEKDAYS=this.Locale.WEEKDAYS_SHORT;}
if(this.Options.START_WEEKDAY>0)
{for(var w=0;w<this.Options.START_WEEKDAY;++w){this.Locale.WEEKDAYS_SHORT.push(this.Locale.WEEKDAYS_SHORT.shift());this.Locale.WEEKDAYS_MEDIUM.push(this.Locale.WEEKDAYS_MEDIUM.shift());this.Locale.WEEKDAYS_LONG.push(this.Locale.WEEKDAYS_LONG.shift());}}};YAHOO.widget.Calendar_Core.prototype.customConfig=function(){};YAHOO.widget.Calendar_Core.prototype.buildMonthLabel=function(){var text=this.Options.LOCALE_MONTHS[this.pageDate.getMonth()]+" "+this.pageDate.getFullYear();return text;};YAHOO.widget.Calendar_Core.prototype.buildDayLabel=function(workingDate){var day=workingDate.getDate();return day;};YAHOO.widget.Calendar_Core.prototype.buildShell=function(){this.table=document.createElement("TABLE");this.table.cellSpacing=0;YAHOO.widget.Calendar_Core.setCssClasses(this.table,[this.Style.CSS_CALENDAR]);this.table.id=this.id;this.buildShellHeader();this.buildShellBody();this.buildShellFooter();YAHOO.util.Event.addListener(window,"unload",this._unload,this);};YAHOO.widget.Calendar_Core.prototype.buildShellHeader=function(){var head=document.createElement("THEAD");var headRow=document.createElement("TR");var headerCell=document.createElement("TH");var colSpan=7;if(this.Config.Options.SHOW_WEEK_HEADER){this.weekHeaderCells=new Array();colSpan+=1;}
if(this.Config.Options.SHOW_WEEK_FOOTER){this.weekFooterCells=new Array();colSpan+=1;}
headerCell.colSpan=colSpan;YAHOO.widget.Calendar_Core.setCssClasses(headerCell,[this.Style.CSS_HEADER_TEXT]);this.headerCell=headerCell;headRow.appendChild(headerCell);head.appendChild(headRow);if(this.Options.SHOW_WEEKDAYS)
{var row=document.createElement("TR");var fillerCell;YAHOO.widget.Calendar_Core.setCssClasses(row,[this.Style.CSS_WEEKDAY_ROW]);if(this.Config.Options.SHOW_WEEK_HEADER){fillerCell=document.createElement("TH");YAHOO.widget.Calendar_Core.setCssClasses(fillerCell,[this.Style.CSS_WEEKDAY_CELL]);row.appendChild(fillerCell);}
for(var i=0;i<this.Options.LOCALE_WEEKDAYS.length;++i)
{var cell=document.createElement("TH");YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_WEEKDAY_CELL]);cell.innerHTML=this.Options.LOCALE_WEEKDAYS[i];row.appendChild(cell);}
if(this.Config.Options.SHOW_WEEK_FOOTER){fillerCell=document.createElement("TH");YAHOO.widget.Calendar_Core.setCssClasses(fillerCell,[this.Style.CSS_WEEKDAY_CELL]);row.appendChild(fillerCell);}
head.appendChild(row);}
this.table.appendChild(head);};YAHOO.widget.Calendar_Core.prototype.buildShellBody=function(){this.tbody=document.createElement("TBODY");for(var r=0;r<6;++r)
{var row=document.createElement("TR");for(var c=0;c<this.headerCell.colSpan;++c)
{var cell;if(this.Config.Options.SHOW_WEEK_HEADER&&c===0){cell=document.createElement("TH");this.weekHeaderCells[this.weekHeaderCells.length]=cell;}else if(this.Config.Options.SHOW_WEEK_FOOTER&&c==(this.headerCell.colSpan-1)){cell=document.createElement("TH");this.weekFooterCells[this.weekFooterCells.length]=cell;}else{cell=document.createElement("TD");this.cells[this.cells.length]=cell;YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_CELL]);YAHOO.util.Event.addListener(cell,"click",this.doSelectCell,this);YAHOO.util.Event.addListener(cell,"mouseover",this.doCellMouseOver,this);YAHOO.util.Event.addListener(cell,"mouseout",this.doCellMouseOut,this);}
row.appendChild(cell);}
this.tbody.appendChild(row);}
this.table.appendChild(this.tbody);};YAHOO.widget.Calendar_Core.prototype.buildShellFooter=function(){};YAHOO.widget.Calendar_Core.prototype.renderShell=function(){this.oDomContainer.appendChild(this.table);this.shellRendered=true;};YAHOO.widget.Calendar_Core.prototype.render=function(){if(!this.shellRendered)
{this.buildShell();this.renderShell();}
this.resetRenderers();this.cellDates.length=0;var workingDate=YAHOO.widget.DateMath.findMonthStart(this.pageDate);this.renderHeader();this.renderBody(workingDate);this.renderFooter();this.onRender();};YAHOO.widget.Calendar_Core.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));this.headerCell.appendChild(headerContainer);};YAHOO.widget.Calendar_Core.prototype.renderBody=function(workingDate){this.preMonthDays=workingDate.getDay();if(this.Options.START_WEEKDAY>0){this.preMonthDays-=this.Options.START_WEEKDAY;}
if(this.preMonthDays<0){this.preMonthDays+=7;}
this.monthDays=YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();this.postMonthDays=YAHOO.widget.Calendar_Core.DISPLAY_DAYS-this.preMonthDays-this.monthDays;workingDate=YAHOO.widget.DateMath.subtract(workingDate,YAHOO.widget.DateMath.DAY,this.preMonthDays);var weekRowIndex=0;for(var c=0;c<this.cells.length;++c)
{var cellRenderers=new Array();var cell=this.cells[c];this.clearElement(cell);cell.index=c;cell.id=this.id+"_cell"+c;this.cellDates[this.cellDates.length]=[workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];if(workingDate.getDay()==this.Options.START_WEEKDAY){var rowHeaderCell=null;var rowFooterCell=null;if(this.Options.SHOW_WEEK_HEADER){rowHeaderCell=this.weekHeaderCells[weekRowIndex];this.clearElement(rowHeaderCell);}
if(this.Options.SHOW_WEEK_FOOTER){rowFooterCell=this.weekFooterCells[weekRowIndex];this.clearElement(rowFooterCell);}
if(this.Options.HIDE_BLANK_WEEKS&&this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){continue;}else{if(rowHeaderCell){this.renderRowHeader(workingDate,rowHeaderCell);}
if(rowFooterCell){this.renderRowFooter(workingDate,rowFooterCell);}}}
var renderer=null;if(workingDate.getFullYear()==this.today.getFullYear()&&workingDate.getMonth()==this.today.getMonth()&&workingDate.getDate()==this.today.getDate())
{cellRenderers[cellRenderers.length]=this.renderCellStyleToday;}
if(this.isDateOOM(workingDate))
{cellRenderers[cellRenderers.length]=this.renderCellNotThisMonth;}else{for(var r=0;r<this.renderStack.length;++r)
{var rArray=this.renderStack[r];var type=rArray[0];var month;var day;var year;switch(type){case YAHOO.widget.Calendar_Core.DATE:month=rArray[1][1];day=rArray[1][2];year=rArray[1][0];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day&&workingDate.getFullYear()==year)
{renderer=rArray[2];this.renderStack.splice(r,1);}
break;case YAHOO.widget.Calendar_Core.MONTH_DAY:month=rArray[1][0];day=rArray[1][1];if(workingDate.getMonth()+1==month&&workingDate.getDate()==day)
{renderer=rArray[2];this.renderStack.splice(r,1);}
break;case YAHOO.widget.Calendar_Core.RANGE:var date1=rArray[1][0];var date2=rArray[1][1];var d1month=date1[1];var d1day=date1[2];var d1year=date1[0];var d1=new Date(d1year,d1month-1,d1day);var d2month=date2[1];var d2day=date2[2];var d2year=date2[0];var d2=new Date(d2year,d2month-1,d2day);if(workingDate.getTime()>=d1.getTime()&&workingDate.getTime()<=d2.getTime())
{renderer=rArray[2];if(workingDate.getTime()==d2.getTime()){this.renderStack.splice(r,1);}}
break;case YAHOO.widget.Calendar_Core.WEEKDAY:var weekday=rArray[1][0];if(workingDate.getDay()+1==weekday)
{renderer=rArray[2];}
break;case YAHOO.widget.Calendar_Core.MONTH:month=rArray[1][0];if(workingDate.getMonth()+1==month)
{renderer=rArray[2];}
break;}
if(renderer){cellRenderers[cellRenderers.length]=renderer;}}}
if(this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()])>-1)
{cellRenderers[cellRenderers.length]=this.renderCellStyleSelected;}
if(this.minDate)
{this.minDate=YAHOO.widget.DateMath.clearTime(this.minDate);}
if(this.maxDate)
{this.maxDate=YAHOO.widget.DateMath.clearTime(this.maxDate);}
if((this.minDate&&(workingDate.getTime()<this.minDate.getTime()))||(this.maxDate&&(workingDate.getTime()>this.maxDate.getTime()))){cellRenderers[cellRenderers.length]=this.renderOutOfBoundsDate;}else{cellRenderers[cellRenderers.length]=this.renderCellDefault;}
for(var x=0;x<cellRenderers.length;++x)
{var ren=cellRenderers[x];if(ren.call(this,workingDate,cell)==YAHOO.widget.Calendar_Core.STOP_RENDER){break;}}
workingDate=YAHOO.widget.DateMath.add(workingDate,YAHOO.widget.DateMath.DAY,1);if(workingDate.getDay()==this.Options.START_WEEKDAY){weekRowIndex+=1;}
YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL);if(c>=0&&c<=6){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_TOP);}
if((c%7)==0){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_LEFT);}
if(((c+1)%7)==0){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_RIGHT);}
var postDays=this.postMonthDays;if(postDays>=7&&this.Options.HIDE_BLANK_WEEKS){var blankWeeks=Math.floor(postDays/7);for(var p=0;p<blankWeeks;++p){postDays-=7;}}
if(c>=((this.preMonthDays+postDays+this.monthDays)-7)){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_BOTTOM);}}};YAHOO.widget.Calendar_Core.prototype.renderFooter=function(){};YAHOO.widget.Calendar_Core.prototype._unload=function(e,cal){for(var c in cal.cells){c=null;}
cal.cells=null;cal.tbody=null;cal.oDomContainer=null;cal.table=null;cal.headerCell=null;cal=null;};YAHOO.widget.Calendar_Core.prototype.renderOutOfBoundsDate=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOB);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;}
YAHOO.widget.Calendar_Core.prototype.renderRowHeader=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_ROW_HEADER);var useYear=this.pageDate.getFullYear();if(!YAHOO.widget.DateMath.isYearOverlapWeek(workingDate)){useYear=workingDate.getFullYear();}
var weekNum=YAHOO.widget.DateMath.getWeekNumber(workingDate,useYear,this.Options.START_WEEKDAY);cell.innerHTML=weekNum;if(this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOM);}};YAHOO.widget.Calendar_Core.prototype.renderRowFooter=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_ROW_FOOTER);if(this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOM);}};YAHOO.widget.Calendar_Core.prototype.renderCellDefault=function(workingDate,cell){cell.innerHTML="";var link=document.createElement("a");link.href="javascript:void(null);";link.name=this.id+"__"+workingDate.getFullYear()+"_"+(workingDate.getMonth()+1)+"_"+workingDate.getDate();link.appendChild(document.createTextNode(this.buildDayLabel(workingDate)));cell.appendChild(link);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight1=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT1);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight2=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT2);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight3=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT3);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight4=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT4);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleToday=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_TODAY);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleSelected=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_SELECTED);};YAHOO.widget.Calendar_Core.prototype.renderCellNotThisMonth=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOM);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;};YAHOO.widget.Calendar_Core.prototype.renderBodyCellRestricted=function(workingDate,cell){YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_CELL,this.Style.CSS_CELL_RESTRICTED]);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;};YAHOO.widget.Calendar_Core.prototype.addMonths=function(count){this.pageDate=YAHOO.widget.DateMath.add(this.pageDate,YAHOO.widget.DateMath.MONTH,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.subtractMonths=function(count){this.pageDate=YAHOO.widget.DateMath.subtract(this.pageDate,YAHOO.widget.DateMath.MONTH,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.addYears=function(count){this.pageDate=YAHOO.widget.DateMath.add(this.pageDate,YAHOO.widget.DateMath.YEAR,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.subtractYears=function(count){this.pageDate=YAHOO.widget.DateMath.subtract(this.pageDate,YAHOO.widget.DateMath.YEAR,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.nextMonth=function(){this.addMonths(1);};YAHOO.widget.Calendar_Core.prototype.previousMonth=function(){this.subtractMonths(1);};YAHOO.widget.Calendar_Core.prototype.nextYear=function(){this.addYears(1);};YAHOO.widget.Calendar_Core.prototype.previousYear=function(){this.subtractYears(1);};YAHOO.widget.Calendar_Core.prototype.reset=function(){this.selectedDates.length=0;this.selectedDates=this._selectedDates.concat();this.pageDate=new Date(this._pageDate.getTime());this.onReset();};YAHOO.widget.Calendar_Core.prototype.clear=function(){this.selectedDates.length=0;this.pageDate=new Date(this.today.getTime());this.onClear();};YAHOO.widget.Calendar_Core.prototype.select=function(date){this.onBeforeSelect();var aToBeSelected=this._toFieldArray(date);for(var a=0;a<aToBeSelected.length;++a)
{var toSelect=aToBeSelected[a];if(this._indexOfSelectedFieldArray(toSelect)==-1)
{this.selectedDates[this.selectedDates.length]=toSelect;}}
if(this.parent){this.parent.sync(this);}
this.onSelect();return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.selectCell=function(cellIndex){this.onBeforeSelect();this.cells=this.tbody.getElementsByTagName("TD");var cell=this.cells[cellIndex];var cellDate=this.cellDates[cellIndex];var dCellDate=this._toDate(cellDate);var selectDate=cellDate.concat();this.selectedDates.push(selectDate);if(this.parent){this.parent.sync(this);}
this.renderCellStyleSelected(dCellDate,cell);this.onSelect();this.doCellMouseOut.call(cell,null,this);return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.deselect=function(date){this.onBeforeDeselect();var aToBeSelected=this._toFieldArray(date);for(var a=0;a<aToBeSelected.length;++a)
{var toSelect=aToBeSelected[a];var index=this._indexOfSelectedFieldArray(toSelect);if(index!=-1)
{this.selectedDates.splice(index,1);}}
if(this.parent){this.parent.sync(this);}
this.onDeselect();return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.deselectCell=function(i){this.onBeforeDeselect();this.cells=this.tbody.getElementsByTagName("TD");var cell=this.cells[i];var cellDate=this.cellDates[i];var cellDateIndex=this._indexOfSelectedFieldArray(cellDate);var dCellDate=this._toDate(cellDate);var selectDate=cellDate.concat();if(cellDateIndex>-1)
{if(this.pageDate.getMonth()==dCellDate.getMonth()&&this.pageDate.getFullYear()==dCellDate.getFullYear())
{YAHOO.widget.Calendar_Core.removeCssClass(cell,this.Style.CSS_CELL_SELECTED);}
this.selectedDates.splice(cellDateIndex,1);}
if(this.parent){this.parent.sync(this);}
this.onDeselect();return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.deselectAll=function(){this.onBeforeDeselect();var count=this.selectedDates.length;this.selectedDates.length=0;if(this.parent){this.parent.sync(this);}
if(count>0){this.onDeselect();}
return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype._toFieldArray=function(date){var returnDate=new Array();if(date instanceof Date)
{returnDate=[[date.getFullYear(),date.getMonth()+1,date.getDate()]];}
else if(typeof date=='string')
{returnDate=this._parseDates(date);}
else if(date instanceof Array)
{for(var i=0;i<date.length;++i)
{var d=date[i];returnDate[returnDate.length]=[d.getFullYear(),d.getMonth()+1,d.getDate()];}}
return returnDate;};YAHOO.widget.Calendar_Core.prototype._toDate=function(dateFieldArray){if(dateFieldArray instanceof Date)
{return dateFieldArray;}else
{return new Date(dateFieldArray[0],dateFieldArray[1]-1,dateFieldArray[2]);}};YAHOO.widget.Calendar_Core.prototype._fieldArraysAreEqual=function(array1,array2){var match=false;if(array1[0]==array2[0]&&array1[1]==array2[1]&&array1[2]==array2[2])
{match=true;}
return match;};YAHOO.widget.Calendar_Core.prototype._indexOfSelectedFieldArray=function(find){var selected=-1;for(var s=0;s<this.selectedDates.length;++s)
{var sArray=this.selectedDates[s];if(find[0]==sArray[0]&&find[1]==sArray[1]&&find[2]==sArray[2])
{selected=s;break;}}
return selected;};YAHOO.widget.Calendar_Core.prototype.isDateOOM=function(date){var isOOM=false;if(date.getMonth()!=this.pageDate.getMonth()){isOOM=true;}
return isOOM;};YAHOO.widget.Calendar_Core.prototype.onBeforeSelect=function(){if(!this.Options.MULTI_SELECT){this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);this.deselectAll();}};YAHOO.widget.Calendar_Core.prototype.onSelect=function(){};YAHOO.widget.Calendar_Core.prototype.onBeforeDeselect=function(){};YAHOO.widget.Calendar_Core.prototype.onDeselect=function(){};YAHOO.widget.Calendar_Core.prototype.onChangePage=function(){var me=this;this.renderHeader();if(this.renderProcId){clearTimeout(this.renderProcId);}
this.renderProcId=setTimeout(function(){me.render();me.renderProcId=null;},1);};YAHOO.widget.Calendar_Core.prototype.onRender=function(){};YAHOO.widget.Calendar_Core.prototype.onReset=function(){this.render();};YAHOO.widget.Calendar_Core.prototype.onClear=function(){this.render();};YAHOO.widget.Calendar_Core.prototype.validate=function(){return true;};YAHOO.widget.Calendar_Core.prototype._parseDate=function(sDate){var aDate=sDate.split(this.Locale.DATE_FIELD_DELIMITER);var rArray;if(aDate.length==2)
{rArray=[aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];rArray.type=YAHOO.widget.Calendar_Core.MONTH_DAY;}else{rArray=[aDate[this.Locale.MDY_YEAR_POSITION-1],aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];rArray.type=YAHOO.widget.Calendar_Core.DATE;}
return rArray;};YAHOO.widget.Calendar_Core.prototype._parseDates=function(sDates){var aReturn=new Array();var aDates=sDates.split(this.Locale.DATE_DELIMITER);for(var d=0;d<aDates.length;++d)
{var sDate=aDates[d];if(sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var aRange=sDate.split(this.Locale.DATE_RANGE_DELIMITER);var dateStart=this._parseDate(aRange[0]);var dateEnd=this._parseDate(aRange[1]);var fullRange=this._parseRange(dateStart,dateEnd);aReturn=aReturn.concat(fullRange);}else{var aDate=this._parseDate(sDate);aReturn.push(aDate);}}
return aReturn;};YAHOO.widget.Calendar_Core.prototype._parseRange=function(startDate,endDate){var dStart=new Date(startDate[0],startDate[1]-1,startDate[2]);var dCurrent=YAHOO.widget.DateMath.add(new Date(startDate[0],startDate[1]-1,startDate[2]),YAHOO.widget.DateMath.DAY,1);var dEnd=new Date(endDate[0],endDate[1]-1,endDate[2]);var results=new Array();results.push(startDate);while(dCurrent.getTime()<=dEnd.getTime())
{results.push([dCurrent.getFullYear(),dCurrent.getMonth()+1,dCurrent.getDate()]);dCurrent=YAHOO.widget.DateMath.add(dCurrent,YAHOO.widget.DateMath.DAY,1);}
return results;};YAHOO.widget.Calendar_Core.prototype.resetRenderers=function(){this.renderStack=this._renderStack.concat();};YAHOO.widget.Calendar_Core.prototype.clearElement=function(cell){cell.innerHTML="&nbsp;";cell.className="";};YAHOO.widget.Calendar_Core.prototype.addRenderer=function(sDates,fnRender){var aDates=this._parseDates(sDates);for(var i=0;i<aDates.length;++i)
{var aDate=aDates[i];if(aDate.length==2)
{if(aDate[0]instanceof Array)
{this._addRenderer(YAHOO.widget.Calendar_Core.RANGE,aDate,fnRender);}else{this._addRenderer(YAHOO.widget.Calendar_Core.MONTH_DAY,aDate,fnRender);}}else if(aDate.length==3)
{this._addRenderer(YAHOO.widget.Calendar_Core.DATE,aDate,fnRender);}}};YAHOO.widget.Calendar_Core.prototype._addRenderer=function(type,aDates,fnRender){var add=[type,aDates,fnRender];this.renderStack.unshift(add);this._renderStack=this.renderStack.concat();};YAHOO.widget.Calendar_Core.prototype.addMonthRenderer=function(month,fnRender){this._addRenderer(YAHOO.widget.Calendar_Core.MONTH,[month],fnRender);};YAHOO.widget.Calendar_Core.prototype.addWeekdayRenderer=function(weekday,fnRender){this._addRenderer(YAHOO.widget.Calendar_Core.WEEKDAY,[weekday],fnRender);};YAHOO.widget.Calendar_Core.addCssClass=function(element,style){if(element.className.length===0)
{element.className+=style;}else{element.className+=" "+style;}};YAHOO.widget.Calendar_Core.prependCssClass=function(element,style){element.className=style+" "+element.className;}
YAHOO.widget.Calendar_Core.removeCssClass=function(element,style){var aStyles=element.className.split(" ");for(var s=0;s<aStyles.length;++s)
{if(aStyles[s]==style)
{aStyles.splice(s,1);break;}}
YAHOO.widget.Calendar_Core.setCssClasses(element,aStyles);};YAHOO.widget.Calendar_Core.setCssClasses=function(element,aStyles){element.className="";var className=aStyles.join(" ");element.className=className;};YAHOO.widget.Calendar_Core.prototype.clearAllBodyCellStyles=function(style){for(var c=0;c<this.cells.length;++c)
{YAHOO.widget.Calendar_Core.removeCssClass(this.cells[c],style);}};YAHOO.widget.Calendar_Core.prototype.setMonth=function(month){this.pageDate.setMonth(month);};YAHOO.widget.Calendar_Core.prototype.setYear=function(year){this.pageDate.setFullYear(year);};YAHOO.widget.Calendar_Core.prototype.getSelectedDates=function(){var returnDates=new Array();for(var d=0;d<this.selectedDates.length;++d)
{var dateArray=this.selectedDates[d];var date=new Date(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}
returnDates.sort();return returnDates;};YAHOO.widget.Calendar_Core._getBrowser=function()
{var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1)
return'opera';else if(ua.indexOf('msie')!=-1)
return'ie';else if(ua.indexOf('safari')!=-1)
return'safari';else if(ua.indexOf('gecko')!=-1)
return'gecko';else
return false;}
YAHOO.widget.Cal_Core=YAHOO.widget.Calendar_Core;YAHOO.widget.Calendar=function(id,containerId,monthyear,selected){if(arguments.length>0)
{this.init(id,containerId,monthyear,selected);}}
YAHOO.widget.Calendar.prototype=new YAHOO.widget.Calendar_Core();YAHOO.widget.Calendar.prototype.buildShell=function(){this.border=document.createElement("DIV");this.border.className=this.Style.CSS_BORDER;this.table=document.createElement("TABLE");this.table.cellSpacing=0;YAHOO.widget.Calendar_Core.setCssClasses(this.table,[this.Style.CSS_CALENDAR]);this.border.id=this.id;this.buildShellHeader();this.buildShellBody();this.buildShellFooter();};YAHOO.widget.Calendar.prototype.renderShell=function(){this.border.appendChild(this.table);this.oDomContainer.appendChild(this.border);this.shellRendered=true;};YAHOO.widget.Calendar.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;var linkLeft=document.createElement("A");linkLeft.href="javascript:"+this.id+".previousMonth()";var imgLeft=document.createElement("IMG");imgLeft.src=this.Options.NAV_ARROW_LEFT;imgLeft.className=this.Style.CSS_NAV_LEFT;linkLeft.appendChild(imgLeft);var linkRight=document.createElement("A");linkRight.href="javascript:"+this.id+".nextMonth()";var imgRight=document.createElement("IMG");imgRight.src=this.Options.NAV_ARROW_RIGHT;imgRight.className=this.Style.CSS_NAV_RIGHT;linkRight.appendChild(imgRight);headerContainer.appendChild(linkLeft);headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));headerContainer.appendChild(linkRight);this.headerCell.appendChild(headerContainer);};YAHOO.widget.Cal=YAHOO.widget.Calendar;YAHOO.widget.CalendarGroup=function(pageCount,id,containerId,monthyear,selected){if(arguments.length>0)
{this.init(pageCount,id,containerId,monthyear,selected);}}
YAHOO.widget.CalendarGroup.prototype.init=function(pageCount,id,containerId,monthyear,selected){this.id=id;this.selectedDates=new Array();this.containerId=containerId;this.pageCount=pageCount;this.pages=new Array();for(var p=0;p<pageCount;++p)
{var cal=this.constructChild(id+"_"+p,this.containerId+"_"+p,monthyear,selected);cal.parent=this;cal.index=p;cal.pageDate.setMonth(cal.pageDate.getMonth()+p);cal._pageDate=new Date(cal.pageDate.getFullYear(),cal.pageDate.getMonth(),cal.pageDate.getDate());this.pages.push(cal);}
this.doNextMonth=function(e,calGroup){calGroup.nextMonth();}
this.doPreviousMonth=function(e,calGroup){calGroup.previousMonth();}};YAHOO.widget.CalendarGroup.prototype.setChildFunction=function(fnName,fn){for(var p=0;p<this.pageCount;++p){this.pages[p][fnName]=fn;}}
YAHOO.widget.CalendarGroup.prototype.callChildFunction=function(fnName,args){for(var p=0;p<this.pageCount;++p){var page=this.pages[p];if(page[fnName]){var fn=page[fnName];fn.call(page,args);}}}
YAHOO.widget.CalendarGroup.prototype.constructChild=function(id,containerId,monthyear,selected){return new YAHOO.widget.Calendar_Core(id,containerId,monthyear,selected);};YAHOO.widget.CalendarGroup.prototype.setMonth=function(month){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.setMonth(month+p);}};YAHOO.widget.CalendarGroup.prototype.setYear=function(year){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];if((cal.pageDate.getMonth()+1)==1&&p>0)
{year+=1;}
cal.setYear(year);}};YAHOO.widget.CalendarGroup.prototype.render=function(){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.render();}};YAHOO.widget.CalendarGroup.prototype.select=function(date){var ret;for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];ret=cal.select(date);}
return ret;};YAHOO.widget.CalendarGroup.prototype.selectCell=function(cellIndex){var ret;for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];ret=cal.selectCell(cellIndex);}
return ret;};YAHOO.widget.CalendarGroup.prototype.deselect=function(date){var ret;for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];ret=cal.deselect(date);}
return ret;};YAHOO.widget.CalendarGroup.prototype.deselectAll=function(){var ret;for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];ret=cal.deselectAll();}
return ret;};YAHOO.widget.CalendarGroup.prototype.deselectCell=function(cellIndex){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.deselectCell(cellIndex);}
return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.reset=function(){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.reset();}};YAHOO.widget.CalendarGroup.prototype.clear=function(){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.clear();}};YAHOO.widget.CalendarGroup.prototype.nextMonth=function(){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.nextMonth();}};YAHOO.widget.CalendarGroup.prototype.previousMonth=function(){for(var p=this.pages.length-1;p>=0;--p)
{var cal=this.pages[p];cal.previousMonth();}};YAHOO.widget.CalendarGroup.prototype.nextYear=function(){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.nextYear();}};YAHOO.widget.CalendarGroup.prototype.previousYear=function(){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.previousYear();}};YAHOO.widget.CalendarGroup.prototype.sync=function(caller){var calendar;if(caller)
{this.selectedDates=caller.selectedDates.concat();}else{var hash=new Object();var combinedDates=new Array();for(var p=0;p<this.pages.length;++p)
{calendar=this.pages[p];var values=calendar.selectedDates;for(var v=0;v<values.length;++v)
{var valueArray=values[v];hash[valueArray.toString()]=valueArray;}}
for(var val in hash)
{combinedDates[combinedDates.length]=hash[val];}
this.selectedDates=combinedDates.concat();}
for(p=0;p<this.pages.length;++p)
{calendar=this.pages[p];if(!calendar.Options.MULTI_SELECT){calendar.clearAllBodyCellStyles(calendar.Config.Style.CSS_CELL_SELECTED);}
calendar.selectedDates=this.selectedDates.concat();}
return this.getSelectedDates();};YAHOO.widget.CalendarGroup.prototype.getSelectedDates=function(){var returnDates=new Array();for(var d=0;d<this.selectedDates.length;++d)
{var dateArray=this.selectedDates[d];var date=new Date(dateArray[0],dateArray[1]-1,dateArray[2]);returnDates.push(date);}
returnDates.sort();return returnDates;};YAHOO.widget.CalendarGroup.prototype.addRenderer=function(sDates,fnRender){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.addRenderer(sDates,fnRender);}};YAHOO.widget.CalendarGroup.prototype.addMonthRenderer=function(month,fnRender){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.addMonthRenderer(month,fnRender);}};YAHOO.widget.CalendarGroup.prototype.addWeekdayRenderer=function(weekday,fnRender){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal.addWeekdayRenderer(weekday,fnRender);}};YAHOO.widget.CalendarGroup.prototype.wireEvent=function(eventName,fn){for(var p=0;p<this.pages.length;++p)
{var cal=this.pages[p];cal[eventName]=fn;}};YAHOO.widget.CalGrp=YAHOO.widget.CalendarGroup;YAHOO.widget.Calendar2up_Cal=function(id,containerId,monthyear,selected){if(arguments.length>0)
{this.init(id,containerId,monthyear,selected);}}
YAHOO.widget.Calendar2up_Cal.prototype=new YAHOO.widget.Calendar_Core();YAHOO.widget.Calendar2up_Cal.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;if(this.index==0){var linkLeft=document.createElement("A");linkLeft.href="javascript:void(null)";YAHOO.util.Event.addListener(linkLeft,"click",this.parent.doPreviousMonth,this.parent);var imgLeft=document.createElement("IMG");imgLeft.src=this.Options.NAV_ARROW_LEFT;imgLeft.className=this.Style.CSS_NAV_LEFT;linkLeft.appendChild(imgLeft);headerContainer.appendChild(linkLeft);}
headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));if(this.index==1){var linkRight=document.createElement("A");linkRight.href="javascript:void(null)";YAHOO.util.Event.addListener(linkRight,"click",this.parent.doNextMonth,this.parent);var imgRight=document.createElement("IMG");imgRight.src=this.Options.NAV_ARROW_RIGHT;imgRight.className=this.Style.CSS_NAV_RIGHT;linkRight.appendChild(imgRight);headerContainer.appendChild(linkRight);}
this.headerCell.appendChild(headerContainer);};YAHOO.widget.Calendar2up=function(id,containerId,monthyear,selected){if(arguments.length>0)
{this.buildWrapper(containerId);this.init(2,id,containerId,monthyear,selected);}}
YAHOO.widget.Calendar2up.prototype=new YAHOO.widget.CalendarGroup();YAHOO.widget.Calendar2up.prototype.constructChild=function(id,containerId,monthyear,selected){var cal=new YAHOO.widget.Calendar2up_Cal(id,containerId,monthyear,selected);return cal;};YAHOO.widget.Calendar2up.prototype.buildWrapper=function(containerId){var outerContainer=document.getElementById(containerId);outerContainer.className="calcontainer";var innerContainer=document.createElement("DIV");innerContainer.className="calbordered";innerContainer.id=containerId+"_inner";var cal1Container=document.createElement("DIV");cal1Container.id=containerId+"_0";cal1Container.className="cal2up";cal1Container.style.marginRight="10px";var cal2Container=document.createElement("DIV");cal2Container.id=containerId+"_1";cal2Container.className="cal2up";outerContainer.appendChild(innerContainer);innerContainer.appendChild(cal1Container);innerContainer.appendChild(cal2Container);this.innerContainer=innerContainer;this.outerContainer=outerContainer;}
YAHOO.widget.Calendar2up.prototype.render=function(){this.renderHeader();YAHOO.widget.CalendarGroup.prototype.render.call(this);this.renderFooter();};YAHOO.widget.Calendar2up.prototype.renderHeader=function(){if(!this.title){this.title="";}
if(!this.titleDiv)
{this.titleDiv=document.createElement("DIV");if(this.title=="")
{this.titleDiv.style.display="none";}}
this.titleDiv.className="title";this.titleDiv.innerHTML=this.title;if(this.outerContainer.style.position=="absolute")
{var linkClose=document.createElement("A");linkClose.href="javascript:void(null)";YAHOO.util.Event.addListener(linkClose,"click",this.hide,this);var imgClose=document.createElement("IMG");imgClose.src=YAHOO.widget.Calendar_Core.IMG_ROOT+"us/my/bn/x_d.gif";imgClose.className="close-icon";linkClose.appendChild(imgClose);this.linkClose=linkClose;this.titleDiv.appendChild(linkClose);}
this.innerContainer.insertBefore(this.titleDiv,this.innerContainer.firstChild);}
YAHOO.widget.Calendar2up.prototype.hide=function(e,cal){if(!cal)
{cal=this;}
cal.outerContainer.style.display="none";}
YAHOO.widget.Calendar2up.prototype.renderFooter=function(){}
YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up;

View File

@@ -1,72 +0,0 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
*/
YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_isFormSubmit:false,_sFormData:null,_poll:[],_polling_interval:50,_transaction_id:0,setProgId:function(id)
{this.msxml_progid.unshift(id);},setPollingInterval:function(i)
{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
{var obj,http;try
{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
catch(e)
{for(var i=0;i<this._msxml_progid.length;++i){try
{http=new ActiveXObject(this._msxml_progid[i]);if(http){obj={conn:http,tId:transactionId};break;}}
catch(e){}}}
finally
{return obj;}},getConnectionObject:function()
{var o;var tId=this._transaction_id;try
{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}
catch(e){}
finally
{return o;}},asyncRequest:function(method,uri,callback,postData)
{var o=this.getConnectionObject();if(!o){return null;}
else{if(this._isFormSubmit){if(method=='GET'){uri+="?"+this._sFormData;}
else if(method=='POST'){postData=this._sFormData;}
this._sFormData='';this._isFormSubmit=false;}
o.conn.open(method,uri,true);if(postData){this.initHeader('Content-Type','application/x-www-form-urlencoded');}
if(this._has_http_headers){this.setHeader(o);}
this.handleReadyState(o,callback);postData?o.conn.send(postData):o.conn.send(null);return o;}},handleReadyState:function(o,callback)
{var oConn=this;try
{this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(oConn._poll[o.tId]);oConn._poll.splice(o.tId);oConn.handleTransactionResponse(o,callback);}},this._polling_interval);}
catch(e)
{window.clearInterval(oConn._poll[o.tId]);oConn._poll.splice(o.tId);oConn.handleTransactionResponse(o,callback);}},handleTransactionResponse:function(o,callback)
{if(!callback){this.releaseObject(o);return;}
var httpStatus;var responseObject;try
{httpStatus=o.conn.status;}
catch(e){httpStatus=13030;}
if(httpStatus>=200&&httpStatus<300){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
else{callback.success.apply(callback.scope,[responseObject]);}}}
else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}
break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}}}
this.releaseObject(o);},createResponseObject:function(o,callbackArg)
{var obj={};var headerObj={};try
{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split("\n");for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+1);}}
obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}}
catch(e){}
finally
{return obj;}},createExceptionObject:function(tId,callbackArg)
{var COMM_CODE=0;var COMM_ERROR='communication failure';var obj={};obj.tId=tId;obj.status=COMM_CODE;obj.statusText=COMM_ERROR;if(callbackArg){obj.argument=callbackArg;}
return obj;},initHeader:function(label,value)
{if(this._http_header[label]===undefined){this._http_header[label]=value;}
else{this._http_header[label]=value+","+this._http_header[label];}
this._has_http_headers=true;},setHeader:function(o)
{for(var prop in this._http_header){o.conn.setRequestHeader(prop,this._http_header[prop]);}
delete this._http_header;this._http_header={};this._has_http_headers=false;},setForm:function(formId)
{this._sFormData='';if(typeof formId=='string'){var oForm=(document.getElementById(formId)||document.forms[formId]);}
else if(typeof formId=='object'){var oForm=formId;}
else{return;}
var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oDisabled=oForm.elements[i].disabled;if(oForm.elements[i].name!=""){oElement=oForm.elements[i];oName=oForm.elements[i].name;oValue=oForm.elements[i].value;}
if(!oDisabled)
{switch(oElement.type)
{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].value||oElement.options[j].text)+'&';}}
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit==false){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';hasSubmit=true;}
break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}
this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);},abort:function(o)
{if(this.isCallInProgress(o)){window.clearInterval(this._poll[o.tId]);this._poll.splice(o.tId);o.conn.abort();this.releaseObject(o);return true;}
else{return false;}},isCallInProgress:function(o)
{if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}
else{return false;}},releaseObject:function(o)
{o.conn=null;o=null;}};

View File

@@ -1,265 +0,0 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.10.0
*/
YAHOO.util.Config=function(owner){if(owner){this.init(owner);}}
YAHOO.util.Config.prototype={owner:null,configChangedEvent:null,queueInProgress:false,addProperty:function(key,propertyObject){},getConfig:function(){},getProperty:function(key){},resetProperty:function(key){},setProperty:function(key,value,silent){},queueProperty:function(key,value){},refireEvent:function(key){},applyConfig:function(userConfig,init){},refresh:function(){},fireQueue:function(){},subscribeToConfigEvent:function(key,handler,obj,override){},unsubscribeFromConfigEvent:function(key,handler,obj){},checkBoolean:function(val){if(typeof val=='boolean'){return true;}else{return false;}},checkNumber:function(val){if(isNaN(val)){return false;}else{return true;}}}
YAHOO.util.Config.prototype.init=function(owner){this.owner=owner;this.configChangedEvent=new YAHOO.util.CustomEvent("configChanged");this.queueInProgress=false;var config={};var initialConfig={};var eventQueue=[];var fireEvent=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){property.event.fire(value);}}
this.addProperty=function(key,propertyObject){key=key.toLowerCase();config[key]=propertyObject;propertyObject.event=new YAHOO.util.CustomEvent(key);propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner,true);}
this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}}
this.getConfig=function(){var cfg={};for(var prop in config){var property=config[prop]
if(typeof property!='undefined'&&property.event){cfg[prop]=property.value;}}
return cfg;}
this.getProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.value;}else{return undefined;}}
this.resetProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){this.setProperty(key,initialConfig[key].value);}else{return undefined;}}
this.setProperty=function(key,value,silent){key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{var property=config[key];if(typeof property!='undefined'&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
return true;}}else{return false;}}}
this.queueProperty=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(typeof value!='undefined'&&property.validator&&!property.validator(value)){return false;}else{if(typeof value!='undefined'){property.value=value;}else{value=property.value;}
var foundDuplicate=false;for(var i=0;i<eventQueue.length;i++){var queueItem=eventQueue[i];if(queueItem){var queueItemKey=queueItem[0];var queueItemValue=queueItem[1];if(queueItemKey.toLowerCase()==key){eventQueue[i]=null;eventQueue.push([key,(typeof value!='undefined'?value:queueItemValue)]);foundDuplicate=true;break;}}}
if(!foundDuplicate&&typeof value!='undefined'){eventQueue.push([key,value]);}}
if(property.supercedes){for(var s=0;s<property.supercedes.length;s++){var supercedesCheck=property.supercedes[s];for(var q=0;q<eventQueue.length;q++){var queueItemCheck=eventQueue[q];if(queueItemCheck){var queueItemCheckKey=queueItemCheck[0];var queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey.toLowerCase()==supercedesCheck.toLowerCase()){eventQueue.push([queueItemCheckKey,queueItemCheckValue]);eventQueue[q]=null;break;}}}}}
return true;}else{return false;}}
this.refireEvent=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event&&typeof property.value!='undefined'){if(this.queueInProgress){this.queueProperty(key);}else{fireEvent(key,property.value);}}}
this.applyConfig=function(userConfig,init){if(init){initialConfig=userConfig;}
for(var prop in userConfig){this.queueProperty(prop,userConfig[prop]);}}
this.refresh=function(){for(var prop in config){this.refireEvent(prop);}}
this.fireQueue=function(){this.queueInProgress=true;for(var i=0;i<eventQueue.length;i++){var queueItem=eventQueue[i];if(queueItem){var key=queueItem[0];var value=queueItem[1];var property=config[key];property.value=value;fireEvent(key,value);}}
this.queueInProgress=false;eventQueue=new Array();}
this.subscribeToConfigEvent=function(key,handler,obj,override){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(!YAHOO.util.Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}
return true;}else{return false;}}
this.unsubscribeFromConfigEvent=function(key,handler,obj){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}}
this.outputEventQueue=function(){var output="";for(var q=0;q<eventQueue.length;q++){var queueItem=eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}
return output;}}
YAHOO.util.Config.alreadySubscribed=function(evt,fn,obj){for(var e=0;e<evt.subscribers.length;e++){var subsc=evt.subscribers[e];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;break;}}
return false;}
YAHOO.widget.Module=function(el,userConfig){if(el){this.init(el,userConfig);}}
YAHOO.widget.Module.IMG_ROOT="http://us.i1.yimg.com/us.yimg.com/i/";YAHOO.widget.Module.IMG_ROOT_SSL="https://a248.e.akamai.net/sec.yimg.com/i/";YAHOO.widget.Module.CSS_MODULE="module";YAHOO.widget.Module.CSS_HEADER="hd";YAHOO.widget.Module.CSS_BODY="bd";YAHOO.widget.Module.CSS_FOOTER="ft";YAHOO.widget.Module.prototype={constructor:YAHOO.widget.Module,element:null,header:null,body:null,footer:null,id:null,childNodesInDOM:null,imageRoot:YAHOO.widget.Module.IMG_ROOT,beforeInitEvent:null,initEvent:null,appendEvent:null,beforeRenderEvent:null,renderEvent:null,changeHeaderEvent:null,changeBodyEvent:null,changeFooterEvent:null,changeContentEvent:null,destroyEvent:null,beforeShowEvent:null,showEvent:null,beforeHideEvent:null,hideEvent:null,initEvents:function(){this.beforeInitEvent=new YAHOO.util.CustomEvent("beforeInit");this.initEvent=new YAHOO.util.CustomEvent("init");this.appendEvent=new YAHOO.util.CustomEvent("append");this.beforeRenderEvent=new YAHOO.util.CustomEvent("beforeRender");this.renderEvent=new YAHOO.util.CustomEvent("render");this.changeHeaderEvent=new YAHOO.util.CustomEvent("changeHeader");this.changeBodyEvent=new YAHOO.util.CustomEvent("changeBody");this.changeFooterEvent=new YAHOO.util.CustomEvent("changeFooter");this.changeContentEvent=new YAHOO.util.CustomEvent("changeContent");this.destroyEvent=new YAHOO.util.CustomEvent("destroy");this.beforeShowEvent=new YAHOO.util.CustomEvent("beforeShow");this.showEvent=new YAHOO.util.CustomEvent("show");this.beforeHideEvent=new YAHOO.util.CustomEvent("beforeHide");this.hideEvent=new YAHOO.util.CustomEvent("hide");},platform:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){return"windows";}else if(ua.indexOf("macintosh")!=-1){return"mac";}else{return false;}}(),browser:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")==0){this.imageRoot=YAHOO.widget.Module.IMG_ROOT_SSL;return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty("visible",{value:true,handler:this.configVisible,validator:this.cfg.checkBoolean});this.cfg.addProperty("effect",{suppressEvent:true,supercedes:["visible"]});this.cfg.addProperty("monitorresize",{value:true,handler:this.configMonitorResize});},init:function(el,userConfig){this.initEvents();this.beforeInitEvent.fire(YAHOO.widget.Module);this.cfg=new YAHOO.util.Config(this);if(typeof el=="string"){var elId=el;el=document.getElementById(el);if(!el){el=document.createElement("DIV");el.id=elId;}}
this.element=el;if(el.id){this.id=el.id;}
var childNodes=this.element.childNodes;if(childNodes){for(var i=0;i<childNodes.length;i++){var child=childNodes[i];switch(child.className){case YAHOO.widget.Module.CSS_HEADER:this.header=child;break;case YAHOO.widget.Module.CSS_BODY:this.body=child;break;case YAHOO.widget.Module.CSS_FOOTER:this.footer=child;break;}}}
this.initDefaultConfig();YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Module.CSS_MODULE);if(userConfig){this.cfg.applyConfig(userConfig,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}
this.initEvent.fire(YAHOO.widget.Module);},initResizeMonitor:function(){var resizeMonitor=document.getElementById("_yuiResizeMonitor");if(!resizeMonitor){resizeMonitor=document.createElement("DIV");resizeMonitor.style.position="absolute";resizeMonitor.id="_yuiResizeMonitor";resizeMonitor.style.width="1em";resizeMonitor.style.height="1em";resizeMonitor.style.top="-1000px";resizeMonitor.style.left="-1000px";resizeMonitor.innerHTML="&nbsp;";document.body.appendChild(resizeMonitor);}
this.resizeMonitor=resizeMonitor;YAHOO.util.Event.addListener(this.resizeMonitor,"resize",this.onDomResize,this,true);},onDomResize:function(e,obj){},setHeader:function(headerContent){if(!this.header){this.header=document.createElement("DIV");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
if(typeof headerContent=="string"){this.header.innerHTML=headerContent;}else{this.header.innerHTML="";this.header.appendChild(headerContent);}
this.changeHeaderEvent.fire(headerContent);this.changeContentEvent.fire();},appendToHeader:function(element){if(!this.header){this.header=document.createElement("DIV");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
this.header.appendChild(element);this.changeHeaderEvent.fire(element);this.changeContentEvent.fire();},setBody:function(bodyContent){if(!this.body){this.body=document.createElement("DIV");this.body.className=YAHOO.widget.Module.CSS_BODY;}
if(typeof bodyContent=="string")
{this.body.innerHTML=bodyContent;}else{this.body.innerHTML="";this.body.appendChild(bodyContent);}
this.changeBodyEvent.fire(bodyContent);this.changeContentEvent.fire();},appendToBody:function(element){if(!this.body){this.body=document.createElement("DIV");this.body.className=YAHOO.widget.Module.CSS_BODY;}
this.body.appendChild(element);this.changeBodyEvent.fire(element);this.changeContentEvent.fire();},setFooter:function(footerContent){if(!this.footer){this.footer=document.createElement("DIV");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
if(typeof footerContent=="string"){this.footer.innerHTML=footerContent;}else{this.footer.innerHTML="";this.footer.appendChild(footerContent);}
this.changeFooterEvent.fire(footerContent);this.changeContentEvent.fire();},appendToFooter:function(element){if(!this.footer){this.footer=document.createElement("DIV");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
this.footer.appendChild(element);this.changeFooterEvent.fire(element);this.changeContentEvent.fire();},render:function(appendToNode,moduleElement){this.beforeRenderEvent.fire();if(!moduleElement){moduleElement=this.element;}
var me=this;var appendTo=function(element){if(typeof element=="string"){element=document.getElementById(element);}
if(element){element.appendChild(me.element);me.appendEvent.fire();}}
if(appendToNode){appendTo(appendToNode);}else{if(!YAHOO.util.Dom.inDocument(this.element)){return false;}}
if(this.header&&!YAHOO.util.Dom.inDocument(this.header)){var firstChild=moduleElement.firstChild;if(firstChild){moduleElement.insertBefore(this.header,firstChild);}else{moduleElement.appendChild(this.header);}}
if(this.body&&!YAHOO.util.Dom.inDocument(this.body)){if(this.footer&&YAHOO.util.Dom.isAncestor(this.moduleElement,this.footer)){moduleElement.insertBefore(this.body,this.footer);}else{moduleElement.appendChild(this.body);}}
if(this.footer&&!YAHOO.util.Dom.inDocument(this.footer)){moduleElement.appendChild(this.footer);}
this.renderEvent.fire();return true;},destroy:function(){if(this.element){var parent=this.element.parentNode;}
if(parent){parent.removeChild(this.element);}
this.element=null;this.header=null;this.body=null;this.footer=null;this.destroyEvent.fire();},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(type,args,obj){var visible=args[0];if(visible){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(type,args,obj){var monitor=args[0];if(monitor){this.initResizeMonitor();}else{YAHOO.util.Event.removeListener(this.resizeMonitor,"resize",this.onDomResize);this.resizeMonitor=null;}}}
YAHOO.widget.Overlay=function(el,userConfig){if(arguments.length>0){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);}}
YAHOO.widget.Overlay.prototype=new YAHOO.widget.Module();YAHOO.widget.Overlay.prototype.constructor=YAHOO.widget.Overlay;YAHOO.widget.Overlay.superclass=YAHOO.widget.Module.prototype;YAHOO.widget.Overlay.IFRAME_SRC="promo/m/irs/blank.gif";YAHOO.widget.Overlay.TOP_LEFT="tl";YAHOO.widget.Overlay.TOP_RIGHT="tr";YAHOO.widget.Overlay.BOTTOM_LEFT="bl";YAHOO.widget.Overlay.BOTTOM_RIGHT="br";YAHOO.widget.Overlay.CSS_OVERLAY="overlay";YAHOO.widget.Overlay.prototype.beforeMoveEvent=null;YAHOO.widget.Overlay.prototype.moveEvent=null;YAHOO.widget.Overlay.prototype.init=function(el,userConfig){YAHOO.widget.Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Overlay);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);}
if(this.platform=="mac"&&this.browser=="gecko"){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}
this.initEvent.fire(YAHOO.widget.Overlay);}
YAHOO.widget.Overlay.prototype.initEvents=function(){YAHOO.widget.Overlay.superclass.initEvents.call(this);this.beforeMoveEvent=new YAHOO.util.CustomEvent("beforeMove",this);this.moveEvent=new YAHOO.util.CustomEvent("move",this);}
YAHOO.widget.Overlay.prototype.initDefaultConfig=function(){YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);this.cfg.addProperty("x",{handler:this.configX,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("y",{handler:this.configY,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("xy",{handler:this.configXY,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("context",{handler:this.configContext,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("fixedcenter",{value:false,handler:this.configFixedCenter,validator:this.cfg.checkBoolean,supercedes:["iframe","visible"]});this.cfg.addProperty("width",{handler:this.configWidth,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("height",{handler:this.configHeight,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("zIndex",{value:null,handler:this.configzIndex});this.cfg.addProperty("constraintoviewport",{value:false,handler:this.configConstrainToViewport,validator:this.cfg.checkBoolean,supercedes:["iframe","x","y","xy"]});this.cfg.addProperty("iframe",{value:(this.browser=="ie"?true:false),handler:this.configIframe,validator:this.cfg.checkBoolean,supercedes:["zIndex"]});}
YAHOO.widget.Overlay.prototype.moveTo=function(x,y){this.cfg.setProperty("xy",[x,y]);}
YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"show-scrollbars");YAHOO.util.Dom.addClass(this.element,"hide-scrollbars");}
YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"hide-scrollbars");YAHOO.util.Dom.addClass(this.element,"show-scrollbars");}
YAHOO.widget.Overlay.prototype.configVisible=function(type,args,obj){var visible=args[0];var currentVis=YAHOO.util.Dom.getStyle(this.element,"visibility");var effect=this.cfg.getProperty("effect");var effectInstances=new Array();if(effect){if(effect instanceof Array){for(var i=0;i<effect.length;i++){var eff=effect[i];effectInstances[effectInstances.length]=eff.effect(this,eff.duration);}}else{effectInstances[effectInstances.length]=effect.effect(this,effect.duration);}}
var isMacGecko=(this.platform=="mac"&&this.browser=="gecko");if(visible){if(isMacGecko){this.showMacGeckoScrollbars();}
if(effect){if(visible){if(currentVis!="visible"){this.beforeShowEvent.fire();for(var i=0;i<effectInstances.length;i++){var e=effectInstances[i];if(i==0&&!YAHOO.util.Config.alreadySubscribed(e.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){e.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}
e.animateIn();}}}}else{if(currentVis!="visible"){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(isMacGecko){this.hideMacGeckoScrollbars();}
if(effect){if(currentVis!="hidden"){this.beforeHideEvent.fire();for(var i=0;i<effectInstances.length;i++){var e=effectInstances[i];if(i==0&&!YAHOO.util.Config.alreadySubscribed(e.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){e.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}
e.animateOut();}}}else{if(currentVis!="hidden"){this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");this.cfg.refireEvent("iframe");this.hideEvent.fire();}}}}
YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent=function(){if(this.cfg.getProperty("visible")){this.center();}}
YAHOO.widget.Overlay.prototype.configFixedCenter=function(type,args,obj){var val=args[0];if(val){this.center();if(!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}}
YAHOO.widget.Overlay.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");}
YAHOO.widget.Overlay.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");}
YAHOO.widget.Overlay.prototype.configzIndex=function(type,args,obj){var zIndex=args[0];var el=this.element;if(!zIndex){zIndex=YAHOO.util.Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}
if(this.iframe){if(zIndex<=0){zIndex=1;}
YAHOO.util.Dom.setStyle(this.iframe,"zIndex",(zIndex-1));}
YAHOO.util.Dom.setStyle(el,"zIndex",zIndex);this.cfg.setProperty("zIndex",zIndex,true);}
YAHOO.widget.Overlay.prototype.configXY=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];this.cfg.setProperty("x",x);this.cfg.setProperty("y",y);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}
YAHOO.widget.Overlay.prototype.configX=function(type,args,obj){var x=args[0];var y=this.cfg.getProperty("y");this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setX(this.element,x,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}
YAHOO.widget.Overlay.prototype.configY=function(type,args,obj){var x=this.cfg.getProperty("x");var y=args[0];this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setY(this.element,y,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}
YAHOO.widget.Overlay.prototype.configIframe=function(type,args,obj){var val=args[0];var el=this.element;if(val){var x=this.cfg.getProperty("x");var y=this.cfg.getProperty("y");if(!x||!y){this.syncPosition();x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");}
if(!isNaN(x)&&!isNaN(y)){if(!this.iframe){this.iframe=document.createElement("iframe");var parent=el.parentNode;if(parent){parent.appendChild(this.iframe);}else{document.body.appendChild(this.iframe);}
this.iframe.src=this.imageRoot+YAHOO.widget.Overlay.IFRAME_SRC;YAHOO.util.Dom.setStyle(this.iframe,"position","absolute");YAHOO.util.Dom.setStyle(this.iframe,"border","none");YAHOO.util.Dom.setStyle(this.iframe,"margin","0");YAHOO.util.Dom.setStyle(this.iframe,"padding","0");YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");}
YAHOO.util.Dom.setStyle(this.iframe,"left",x-2+"px");YAHOO.util.Dom.setStyle(this.iframe,"top",y-2+"px");var width=el.clientWidth;var height=el.clientHeight;YAHOO.util.Dom.setStyle(this.iframe,"width",(width+2)+"px");YAHOO.util.Dom.setStyle(this.iframe,"height",(height+2)+"px");if(!this.cfg.getProperty("visible")){this.iframe.style.display="none";}else{this.iframe.style.display="block";}}}else{if(this.iframe){this.iframe.style.display="none";}}}
YAHOO.widget.Overlay.prototype.configConstrainToViewport=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}}else{this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}}
YAHOO.widget.Overlay.prototype.configContext=function(type,args,obj){var contextArgs=args[0];if(contextArgs){var contextEl=contextArgs[0];var elementMagnetCorner=contextArgs[1];var contextMagnetCorner=contextArgs[2];if(contextEl){if(typeof contextEl=="string"){this.cfg.setProperty("context",[document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner],true);}
if(elementMagnetCorner&&contextMagnetCorner){this.align(elementMagnetCorner,contextMagnetCorner);}}}}
YAHOO.widget.Overlay.prototype.align=function(elementAlign,contextAlign){var contextArgs=this.cfg.getProperty("context");if(contextArgs){var context=contextArgs[0];var element=this.element;var me=this;if(!elementAlign){elementAlign=contextArgs[1];}
if(!contextAlign){contextAlign=contextArgs[2];}
if(element&&context){var elementRegion=YAHOO.util.Dom.getRegion(element);var contextRegion=YAHOO.util.Dom.getRegion(context);var doAlign=function(v,h){switch(elementAlign){case YAHOO.widget.Overlay.TOP_LEFT:me.moveTo(h,v);break;case YAHOO.widget.Overlay.TOP_RIGHT:me.moveTo(h-element.offsetWidth,v);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:me.moveTo(h,v-element.offsetHeight);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:me.moveTo(h-element.offsetWidth,v-element.offsetHeight);break;}}
switch(contextAlign){case YAHOO.widget.Overlay.TOP_LEFT:doAlign(contextRegion.top,contextRegion.left);break;case YAHOO.widget.Overlay.TOP_RIGHT:doAlign(contextRegion.top,contextRegion.right);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:doAlign(contextRegion.bottom,contextRegion.left);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:doAlign(contextRegion.bottom,contextRegion.right);break;}}}}
YAHOO.widget.Overlay.prototype.enforceConstraints=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];var width=parseInt(this.cfg.getProperty("width"));if(isNaN(width)){width=0;}
var offsetHeight=this.element.offsetHeight;var offsetWidth=(width>0?width:this.element.offsetWidth);var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(x<leftConstraint){x=leftConstraint;}else if(x>rightConstraint){x=rightConstraint;}
if(y<topConstraint){y=topConstraint;}else if(y>bottomConstraint){y=bottomConstraint;}
this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);}
YAHOO.widget.Overlay.prototype.center=function(){var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.element.style.left=parseInt(x)+"px";this.element.style.top=parseInt(y)+"px";this.syncPosition();this.cfg.refireEvent("iframe");}
YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);}
YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);this.cfg.refireEvent("iframe");}
YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){YAHOO.widget.Overlay.windowScrollEvent.fire();}
YAHOO.widget.Overlay.windowResizeHandler=function(e){YAHOO.widget.Overlay.windowResizeEvent.fire();}
if(YAHOO.widget.Overlay._initialized==undefined){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}
YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);}
YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:new Array(),initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},getActive:function(){},focus:function(overlay){},remove:function(overlay){},blurAll:function(){},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;}
this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex)+1));}
this.overlays.sort(this.compareZIndexDesc);}}
this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null
o.blurEvent=null;o.focus=null;o.blur=null;}}
this.blurAll=function(){activeOverlay=null;for(var o=0;o<this.overlays.length;o++){YAHOO.util.Dom.removeClass(this.overlays[o].element,YAHOO.widget.OverlayManager.CSS_FOCUSED);}}
var overlays=this.cfg.getProperty("overlays");if(overlays){this.register(overlays);this.overlays.sort(this.compareZIndexDesc);}},register:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){overlay.cfg.addProperty("manager",{value:this});overlay.focusEvent=new YAHOO.util.CustomEvent("focus");overlay.blurEvent=new YAHOO.util.CustomEvent("blur");var mgr=this;overlay.focus=function(){mgr.focus(this);this.focusEvent.fire();}
overlay.blur=function(){mgr.blurAll();this.blurEvent.fire();}
var focusOnDomEvent=function(e,obj){mgr.focus(overlay);}
var focusevent=this.cfg.getProperty("focusevent");YAHOO.util.Event.addListener(overlay.element,focusevent,focusOnDomEvent,this,true);var zIndex=YAHOO.util.Dom.getStyle(overlay.element,"zIndex");if(!isNaN(zIndex)){overlay.cfg.setProperty("zIndex",parseInt(zIndex));}else{overlay.cfg.setProperty("zIndex",0);}
this.overlays.push(overlay);return true;}else if(overlay instanceof Array){var regcount=0;for(var i=0;i<overlay.length;i++){if(this.register(overlay[i])){regcount++;}}
if(regcount>0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o]==overlay){return this.overlays[o];}}}else if(typeof overlay=="string"){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o].id==overlay){return this.overlays[o];}}}
return null;},compareZIndexDesc:function(o1,o2){var zIndex1=o1.cfg.getProperty("zIndex");var zIndex2=o2.cfg.getProperty("zIndex");if(zIndex1>zIndex2){return-1;}else if(zIndex1<zIndex2){return 1;}else{return 0;}},showAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].show();}},hideAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].hide();}}}
YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}
var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}
if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}
var handleKeyPress=function(e,obj){var keyPressed=e.charCode||e.keyCode;if(!keyData.shift)keyData.shift=false;if(!keyData.alt)keyData.alt=false;if(!keyData.ctrl)keyData.ctrl=false;if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){if(keyPressed==keyData.keys[i]){keyEvent.fire(keyPressed,e);break;}}}else{if(keyPressed==keyData.keys){keyEvent.fire(keyPressed,e);}}}}
this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}
this.enabled=true;}
this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}
this.enabled=false;}}
YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.prototype.enable=function(){};YAHOO.util.KeyListener.prototype.disable=function(){};YAHOO.util.KeyListener.prototype.enabledEvent=null;YAHOO.util.KeyListener.prototype.disabledEvent=null;YAHOO.widget.Tooltip=function(el,userConfig){if(arguments.length>0){YAHOO.widget.Tooltip.superclass.constructor.call(this,el,userConfig);}}
YAHOO.widget.Tooltip.prototype=new YAHOO.widget.Overlay();YAHOO.widget.Tooltip.prototype.constructor=YAHOO.widget.Tooltip;YAHOO.widget.Tooltip.superclass=YAHOO.widget.Overlay.prototype;YAHOO.widget.Tooltip.CSS_TOOLTIP="tt";YAHOO.widget.Tooltip.prototype.init=function(el,userConfig){if(document.readyState&&document.readyState!="complete"){var deferredInit=function(){this.init(el,userConfig);}
YAHOO.util.Event.addListener(window,"load",deferredInit,this,true);}else{YAHOO.widget.Tooltip.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Tooltip);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Tooltip.CSS_TOOLTIP);if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.cfg.queueProperty("visible",false);this.cfg.queueProperty("constraintoviewport",true);this.setBody("");this.render(this.cfg.getProperty("container"));this.initEvent.fire(YAHOO.widget.Tooltip);}}
YAHOO.widget.Tooltip.prototype.initDefaultConfig=function(){YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);this.cfg.addProperty("preventoverlap",{value:true,handler:this.configPreventOverlap,validator:this.cfg.checkBoolean,supercedes:["x","y","xy"]});this.cfg.addProperty("showdelay",{value:200,handler:this.configShowDelay,validator:this.cfg.checkNumber});this.cfg.addProperty("autodismissdelay",{value:5000,handler:this.configAutoDismissDelay,validator:this.cfg.checkNumber});this.cfg.addProperty("hidedelay",{value:250,handler:this.configHideDelay,validator:this.cfg.checkNumber});this.cfg.addProperty("text",{handler:this.configText,suppressEvent:true});this.cfg.addProperty("container",{value:document.body,handler:this.configContainer});}
YAHOO.widget.Tooltip.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);}}
YAHOO.widget.Tooltip.prototype.configContainer=function(type,args,obj){var container=args[0];if(typeof container=='string'){this.cfg.setProperty("container",document.getElementById(container),true);}}
YAHOO.widget.Tooltip.prototype.configPreventOverlap=function(type,args,obj){var preventoverlap=args[0];if(preventoverlap){if(!YAHOO.util.Config.alreadySubscribed(this.moveEvent,this.preventOverlap,this)){this.moveEvent.subscribe(this.preventOverlap,this,true);}}else{this.moveEvent.unsubscribe(this.preventOverlap,this);}}
YAHOO.widget.Tooltip.prototype.configContext=function(type,args,obj){var context=args[0];if(context){if(typeof context=="string"){this.cfg.setProperty("context",document.getElementById(context),true);}
var contextElement=this.cfg.getProperty("context");if(contextElement&&contextElement.title&&!this.cfg.getProperty("text")){this.cfg.setProperty("text",contextElement.title);}
YAHOO.util.Event.addListener(contextElement,"mouseover",this.onContextMouseOver,this);YAHOO.util.Event.addListener(contextElement,"mouseout",this.onContextMouseOut,this);}}
YAHOO.widget.Tooltip.prototype.onContextMouseOver=function(e,obj){if(!obj){obj=this;}
var context=obj.cfg.getProperty("context");if(context.title){obj.tempTitle=context.title;context.title="";}
this.procId=obj.doShow(e);}
YAHOO.widget.Tooltip.prototype.onContextMouseOut=function(e,obj){if(!obj){obj=this;}
var context=obj.cfg.getProperty("context");if(obj.tempTitle){context.title=obj.tempTitle;}
if(this.procId){clearTimeout(this.procId);}
setTimeout(function(){obj.hide();},obj.cfg.getProperty("hidedelay"));}
YAHOO.widget.Tooltip.prototype.doShow=function(e){var pageX=YAHOO.util.Event.getPageX(e);var pageY=YAHOO.util.Event.getPageY(e);var context=this.cfg.getProperty("context");var yOffset=25;if(this.browser=="opera"&&context.tagName=="A"){yOffset+=12;}
var me=this;return setTimeout(function(){me.moveTo(pageX,pageY+yOffset);me.show();me.doHide();},this.cfg.getProperty("showdelay"));}
YAHOO.widget.Tooltip.prototype.doHide=function(){var me=this;setTimeout(function(){me.hide();},this.cfg.getProperty("autodismissdelay"));}
YAHOO.widget.Tooltip.prototype.preventOverlap=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];var elementRegion=YAHOO.util.Dom.getRegion(this.element);var contextRegion=YAHOO.util.Dom.getRegion(this.cfg.getProperty("context"));var intersection=contextRegion.intersect(elementRegion);if(intersection){var overlapHeight=intersection.bottom-intersection.top;y=(y-overlapHeight-10);this.cfg.setProperty("y",y);}}
YAHOO.widget.Panel=function(el,userConfig){if(arguments.length>0){YAHOO.widget.Panel.superclass.constructor.call(this,el,userConfig);}}
YAHOO.widget.Panel.prototype=new YAHOO.widget.Overlay();YAHOO.widget.Panel.prototype.constructor=YAHOO.widget.Panel;YAHOO.widget.Panel.superclass=YAHOO.widget.Overlay.prototype;YAHOO.widget.Panel.CSS_PANEL="panel";YAHOO.widget.Panel.CSS_PANEL_CONTAINER="panel-container";YAHOO.widget.Panel.prototype.showMaskEvent=null;YAHOO.widget.Panel.prototype.hideMaskEvent=null;YAHOO.widget.Panel.prototype.init=function(el,userConfig){YAHOO.widget.Panel.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Panel);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Panel.CSS_PANEL);this.buildWrapper();if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.beforeRenderEvent.subscribe(function(){var draggable=this.cfg.getProperty("draggable");if(draggable){if(!this.header){this.setHeader("&nbsp;");}}},this,true);this.initEvent.fire(YAHOO.widget.Panel);}
YAHOO.widget.Panel.prototype.initEvents=function(){YAHOO.widget.Panel.superclass.initEvents.call(this);this.showMaskEvent=new YAHOO.util.CustomEvent("showMask");this.hideMaskEvent=new YAHOO.util.CustomEvent("hideMask");}
YAHOO.widget.Panel.prototype.initDefaultConfig=function(){YAHOO.widget.Panel.superclass.initDefaultConfig.call(this);this.cfg.addProperty("close",{value:true,handler:this.configClose,validator:this.cfg.checkBoolean,supercedes:["visible"]});this.cfg.addProperty("draggable",{value:true,handler:this.configDraggable,validator:this.cfg.checkBoolean,supercedes:["visible"]});this.cfg.addProperty("underlay",{value:"shadow",handler:this.configUnderlay,supercedes:["visible"]});this.cfg.addProperty("modal",{value:false,handler:this.configModal,validator:this.cfg.checkBoolean,supercedes:["visible"]});this.cfg.addProperty("keylisteners",{handler:this.configKeyListeners,suppressEvent:true,supercedes:["visible"]});}
YAHOO.widget.Panel.prototype.configClose=function(type,args,obj){var val=args[0];var doHide=function(e,obj){obj.hide();}
if(val){if(!this.close){this.close=document.createElement("DIV");YAHOO.util.Dom.addClass(this.close,"close");if(this.isSecure){YAHOO.util.Dom.addClass(this.close,"secure");}else{YAHOO.util.Dom.addClass(this.close,"nonsecure");}
this.close.innerHTML="&nbsp;";this.innerElement.appendChild(this.close);YAHOO.util.Event.addListener(this.close,"click",doHide,this);}else{this.close.style.display="block";}}else{if(this.close){this.close.style.display="none";}}}
YAHOO.widget.Panel.prototype.configDraggable=function(type,args,obj){var val=args[0];if(val){if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","move");this.registerDragDrop();}}else{if(this.dd){this.dd.unreg();}
if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","auto");}}}
YAHOO.widget.Panel.prototype.configUnderlay=function(type,args,obj){var val=args[0];switch(val.toLowerCase()){case"shadow":YAHOO.util.Dom.removeClass(this.element,"matte");YAHOO.util.Dom.addClass(this.element,"shadow");if(!this.underlay){this.underlay=document.createElement("DIV");this.underlay.className="underlay";this.underlay.innerHTML="&nbsp;";this.element.appendChild(this.underlay);}
this.sizeUnderlay();break;case"matte":YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.addClass(this.element,"matte");break;case"none":default:YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.removeClass(this.element,"matte");break;}}
YAHOO.widget.Panel.prototype.configModal=function(type,args,obj){var modal=args[0];if(modal){this.buildMask();if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMask,this)){this.showEvent.subscribe(this.showMask,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMask,this)){this.hideEvent.subscribe(this.hideMask,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.sizeMask,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.sizeMask,this,true);}}else{this.beforeShowEvent.unsubscribe(this.showMask,this);this.hideEvent.unsubscribe(this.hideMask,this);YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask);}}
YAHOO.widget.Panel.prototype.configKeyListeners=function(type,args,obj){var listeners=args[0];if(listeners){if(listeners instanceof Array){for(var i=0;i<listeners.length;i++){var listener=listeners[i];if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,listener.enable,listener)){this.showEvent.subscribe(listener.enable,listener,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,listener.disable,listener)){this.hideEvent.subscribe(listener.disable,listener,true);}}}else{if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,listeners.enable,listeners)){this.showEvent.subscribe(listeners.enable,listeners,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,listeners.disable,listeners)){this.hideEvent.subscribe(listeners.disable,listeners,true);}}}}
YAHOO.widget.Panel.prototype.buildWrapper=function(){var elementParent=this.element.parentNode;var elementClone=this.element.cloneNode(true);this.innerElement=elementClone;this.innerElement.style.visibility="inherit";YAHOO.util.Dom.addClass(this.innerElement,"panel");var wrapper=document.createElement("DIV");wrapper.className=YAHOO.widget.Panel.CSS_PANEL_CONTAINER;wrapper.id=elementClone.id+"_c";wrapper.appendChild(elementClone);if(elementParent){elementParent.replaceChild(wrapper,this.element);}
this.element=wrapper;var childNodes=this.innerElement.childNodes;if(childNodes){for(var i=0;i<childNodes.length;i++){var child=childNodes[i];switch(child.className){case YAHOO.widget.Module.CSS_HEADER:this.header=child;break;case YAHOO.widget.Module.CSS_BODY:this.body=child;break;case YAHOO.widget.Module.CSS_FOOTER:this.footer=child;break;}}}
this.initDefaultConfig();}
YAHOO.widget.Panel.prototype.sizeUnderlay=function(){if(this.underlay&&this.browser!="gecko"&&this.browser!="safari"){this.underlay.style.width=this.innerElement.offsetWidth+"px";this.underlay.style.height=this.innerElement.offsetHeight+"px";}}
YAHOO.widget.Panel.prototype.onDomResize=function(e,obj){YAHOO.widget.Panel.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.sizeUnderlay();},0);};YAHOO.widget.Panel.prototype.registerDragDrop=function(){if(this.header){this.dd=new YAHOO.util.DD(this.element.id,"panel");if(!this.header.id){this.header.id=this.id+"_h";}
var me=this;this.dd.startDrag=function(){if(me.browser=="ie"){YAHOO.util.Dom.addClass(me.element,"drag");}
if(me.cfg.getProperty("constraintoviewport")){var offsetHeight=me.element.offsetHeight;var offsetWidth=me.element.offsetWidth;var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;this.minX=leftConstraint
this.maxX=rightConstraint;this.constrainX=true;this.minY=topConstraint;this.maxY=bottomConstraint;this.constrainY=true;}else{this.constrainX=false;this.constrainY=false;}}
this.dd.onDrag=function(){me.syncPosition();me.cfg.refireEvent("iframe");if(this.platform=="mac"&&this.browser=="gecko"){this.showMacGeckoScrollbars();}}
this.dd.endDrag=function(){if(me.browser=="ie"){YAHOO.util.Dom.removeClass(me.element,"drag");}}
this.dd.setHandleElId(this.header.id);this.dd.addInvalidHandleType("INPUT");this.dd.addInvalidHandleType("SELECT");this.dd.addInvalidHandleType("TEXTAREA");}}
YAHOO.widget.Panel.prototype.buildMask=function(){if(!this.mask){this.mask=document.createElement("DIV");this.mask.id=this.id+"_mask";this.mask.className="mask";this.mask.innerHTML="&nbsp;";var maskClick=function(e,obj){YAHOO.util.Event.stopEvent(e);}
YAHOO.util.Event.addListener(this.mask,maskClick,this);if(this.browser=="opera"){this.mask.style.backgroundColor="transparent";}
document.body.appendChild(this.mask);}}
YAHOO.widget.Panel.prototype.hideMask=function(){if(this.cfg.getProperty("modal")&&this.mask){this.mask.tabIndex=-1;this.mask.style.display="none";this.hideMaskEvent.fire();YAHOO.util.Dom.removeClass(document.body,"masked");}}
YAHOO.widget.Panel.prototype.showMask=function(){if(this.cfg.getProperty("modal")&&this.mask){YAHOO.util.Dom.addClass(document.body,"masked");this.sizeMask();this.mask.style.display="block";this.mask.tabIndex=0;this.showMaskEvent.fire();}}
YAHOO.widget.Panel.prototype.sizeMask=function(){if(this.mask){this.mask.style.height=YAHOO.util.Dom.getDocumentHeight()+"px";this.mask.style.width=YAHOO.util.Dom.getDocumentWidth()+"px";}}
YAHOO.widget.Panel.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.innerElement;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("underlay");this.cfg.refireEvent("iframe");}
YAHOO.widget.Panel.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.innerElement;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("underlay");this.cfg.refireEvent("iframe");}
YAHOO.widget.Panel.prototype.render=function(appendToNode){return YAHOO.widget.Panel.superclass.render.call(this,appendToNode,this.innerElement);}
YAHOO.widget.Dialog=function(el,userConfig){if(arguments.length>0){YAHOO.widget.Dialog.superclass.constructor.call(this,el,userConfig);}}
YAHOO.widget.Dialog.prototype=new YAHOO.widget.Panel();YAHOO.widget.Dialog.prototype.constructor=YAHOO.widget.Dialog;YAHOO.widget.Dialog.superclass=YAHOO.widget.Panel.prototype;YAHOO.widget.Dialog.CSS_DIALOG="dialog";YAHOO.widget.Dialog.prototype.beforeSubmitEvent=null;YAHOO.widget.Dialog.prototype.submitEvent=null;YAHOO.widget.Dialog.prototype.manualSubmitEvent=null;YAHOO.widget.Dialog.prototype.asyncSubmitEvent=null;YAHOO.widget.Dialog.prototype.formSubmitEvent=null;YAHOO.widget.Dialog.prototype.cancelEvent=null;YAHOO.widget.Dialog.prototype.initDefaultConfig=function(){YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);var callback={success:null,failure:null,argument:null,scope:this}
this.configOnSuccess=function(type,args,obj){var fn=args[0];callback.success=fn;}
this.configOnFailure=function(type,args,obj){var fn=args[0];callback.failure=fn;}
this.doSubmit=function(){var method=this.cfg.getProperty("postmethod");switch(method){case"async":YAHOO.util.Connect.setForm(this.form.name);var cObj=YAHOO.util.Connect.asyncRequest('POST',this.form.action,callback);this.asyncSubmitEvent.fire();break;case"form":this.form.submit();this.formSubmitEvent.fire();break;case"none":case"manual":this.manualSubmitEvent.fire();break;}}
this.cfg.addProperty("postmethod",{value:"async",validator:function(val){if(val!="form"&&val!="async"&&val!="none"&&val!="manual"){return false;}else{return true;}}});this.cfg.addProperty("onsuccess",{handler:this.configOnSuccess,suppressEvent:true});this.cfg.addProperty("onfailure",{handler:this.configOnFailure,suppressEvent:true});this.cfg.addProperty("buttons",{value:"none",handler:this.configButtons});}
YAHOO.widget.Dialog.prototype.initEvents=function(){YAHOO.widget.Dialog.superclass.initEvents.call(this);this.beforeSubmitEvent=new YAHOO.util.CustomEvent("beforeSubmit");this.submitEvent=new YAHOO.util.CustomEvent("submit");this.manualSubmitEvent=new YAHOO.util.CustomEvent("manualSubmit");this.asyncSubmitEvent=new YAHOO.util.CustomEvent("asyncSubmit");this.formSubmitEvent=new YAHOO.util.CustomEvent("formSubmit");this.cancelEvent=new YAHOO.util.CustomEvent("cancel");}
YAHOO.widget.Dialog.prototype.init=function(el,userConfig){YAHOO.widget.Dialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Dialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Dialog.CSS_DIALOG);if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.renderEvent.subscribe(this.registerForm,this,true);this.showEvent.subscribe(this.focusFirst,this,true);this.beforeHideEvent.subscribe(this.blurButtons,this,true);this.beforeRenderEvent.subscribe(function(){var buttonCfg=this.cfg.getProperty("buttons");if(buttonCfg&&buttonCfg!="none"){if(!this.footer){this.setFooter("");}}},this,true);this.initEvent.fire(YAHOO.widget.Dialog);}
YAHOO.widget.Dialog.prototype.registerForm=function(){var form=this.element.getElementsByTagName("FORM")[0];if(!form){var formHTML="<form name=\"frm_"+this.id+"\" action=\"\"></form>";this.body.innerHTML+=formHTML;form=this.element.getElementsByTagName("FORM")[0];}
this.firstFormElement=function(){for(var f=0;f<form.elements.length;f++){var el=form.elements[f];if(el.focus){if(el.type&&el.type!="hidden"){return el;break;}}}
return null;}();this.lastFormElement=function(){for(var f=form.elements.length-1;f>=0;f--){var el=form.elements[f];if(el.focus){if(el.type&&el.type!="hidden"){return el;break;}}}
return null;}();this.form=form;if(this.cfg.getProperty("modal")&&this.form){var me=this;var firstElement=this.firstFormElement||this.firstButton;if(firstElement){this.preventBackTab=new YAHOO.util.KeyListener(firstElement,{shift:true,keys:9},{fn:me.focusLast,scope:me,correctScope:true});this.showEvent.subscribe(this.preventBackTab.enable,this.preventBackTab,true);this.hideEvent.subscribe(this.preventBackTab.disable,this.preventBackTab,true);}
var lastElement=this.lastButton||this.lastFormElement;if(lastElement){this.preventTabOut=new YAHOO.util.KeyListener(lastElement,{shift:false,keys:9},{fn:me.focusFirst,scope:me,correctScope:true});this.showEvent.subscribe(this.preventTabOut.enable,this.preventTabOut,true);this.hideEvent.subscribe(this.preventTabOut.disable,this.preventTabOut,true);}}}
YAHOO.widget.Dialog.prototype.configButtons=function(type,args,obj){var buttons=args[0];if(buttons!="none"){this.buttonSpan=null;this.buttonSpan=document.createElement("SPAN");this.buttonSpan.className="button-group";for(var b=0;b<buttons.length;b++){var button=buttons[b];var htmlButton=document.createElement("BUTTON");if(button.isDefault){htmlButton.className="default";this.defaultHtmlButton=htmlButton;}
htmlButton.appendChild(document.createTextNode(button.text));YAHOO.util.Event.addListener(htmlButton,"click",button.handler,this,true);this.buttonSpan.appendChild(htmlButton);button.htmlButton=htmlButton;if(b==0){this.firstButton=button.htmlButton;}
if(b==(buttons.length-1)){this.lastButton=button.htmlButton;}}
this.setFooter(this.buttonSpan);this.cfg.refireEvent("iframe");this.cfg.refireEvent("underlay");}}
YAHOO.widget.Dialog.prototype.configOnSuccess=function(type,args,obj){};YAHOO.widget.Dialog.prototype.configOnFailure=function(type,args,obj){};YAHOO.widget.Dialog.prototype.doSubmit=function(){};YAHOO.widget.Dialog.prototype.focusFirst=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}}
if(this.firstFormElement){this.firstFormElement.focus();}else{this.focusDefaultButton();}}
YAHOO.widget.Dialog.prototype.focusLast=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}}
var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){this.focusLastButton();}else{if(this.lastFormElement){this.lastFormElement.focus();}}}
YAHOO.widget.Dialog.prototype.focusDefaultButton=function(){if(this.defaultHtmlButton){this.defaultHtmlButton.focus();}}
YAHOO.widget.Dialog.prototype.blurButtons=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.blur();}}}
YAHOO.widget.Dialog.prototype.focusFirstButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.focus();}}}
YAHOO.widget.Dialog.prototype.focusLastButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[buttons.length-1].htmlButton;if(html){html.focus();}}}
YAHOO.widget.Dialog.prototype.validate=function(){return true;}
YAHOO.widget.Dialog.prototype.submit=function(){if(this.validate()){this.beforeSubmitEvent.fire();this.doSubmit();this.submitEvent.fire();this.hide();return true;}else{return false;}}
YAHOO.widget.Dialog.prototype.cancel=function(){this.cancelEvent.fire();this.hide();}
YAHOO.widget.Dialog.prototype.getData=function(){var form=this.form;var data={};if(form){for(var i in this.form){var formItem=form[i];if(formItem){if(formItem.tagName){switch(formItem.tagName){case"INPUT":switch(formItem.type){case"checkbox":data[i]=formItem.checked;break;case"textbox":case"text":case"hidden":data[i]=formItem.value;break;}
break;case"TEXTAREA":data[i]=formItem.value;break;case"SELECT":var val=new Array();for(var x=0;x<formItem.options.length;x++){var option=formItem.options[x];if(option.selected){var selval=option.value;if(!selval||selval==""){selval=option.text;}
val[val.length]=selval;}}
data[i]=val;break;}}else if(formItem[0]&&formItem[0].tagName){switch(formItem[0].tagName){case"INPUT":switch(formItem[0].type){case"radio":for(var r=0;r<formItem.length;r++){var radio=formItem[r];if(radio.checked){data[radio.name]=radio.value;break;}}
break;case"checkbox":var cbArray=new Array();for(var c=0;c<formItem.length;c++){var check=formItem[c];if(check.checked){cbArray[cbArray.length]=check.value;}}
data[formItem[0].name]=cbArray;break;}}}}}}
return data;}
YAHOO.widget.SimpleDialog=function(el,userConfig){if(arguments.length>0){YAHOO.widget.SimpleDialog.superclass.constructor.call(this,el,userConfig);}}
YAHOO.widget.SimpleDialog.prototype=new YAHOO.widget.Dialog();YAHOO.widget.SimpleDialog.prototype.constructor=YAHOO.widget.SimpleDialog;YAHOO.widget.SimpleDialog.superclass=YAHOO.widget.Dialog.prototype;YAHOO.widget.SimpleDialog.ICON_BLOCK="nt/ic/ut/bsc/blck16_1.gif";YAHOO.widget.SimpleDialog.ICON_ALARM="nt/ic/ut/bsc/alrt16_1.gif";YAHOO.widget.SimpleDialog.ICON_HELP="nt/ic/ut/bsc/hlp16_1.gif";YAHOO.widget.SimpleDialog.ICON_INFO="nt/ic/ut/bsc/info16_1.gif";YAHOO.widget.SimpleDialog.ICON_WARN="nt/ic/ut/bsc/warn16_1.gif";YAHOO.widget.SimpleDialog.ICON_TIP="nt/ic/ut/bsc/tip16_1.gif";YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG="simple-dialog";YAHOO.widget.SimpleDialog.prototype.initDefaultConfig=function(){YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);this.cfg.addProperty("icon",{value:"none",handler:this.configIcon,suppressEvent:true});this.cfg.addProperty("text",{value:"",handler:this.configText,suppressEvent:true,supercedes:["icon"]});}
YAHOO.widget.SimpleDialog.prototype.init=function(el,userConfig){YAHOO.widget.SimpleDialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);this.cfg.queueProperty("postmethod","manual");if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.beforeRenderEvent.subscribe(function(){if(!this.body){this.setBody("");}},this,true);this.initEvent.fire(YAHOO.widget.SimpleDialog);}
YAHOO.widget.SimpleDialog.prototype.registerForm=function(){YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);this.form.innerHTML+="<input type=\"hidden\" name=\""+this.id+"\" value=\"\"/>";}
YAHOO.widget.SimpleDialog.prototype.configIcon=function(type,args,obj){var icon=args[0];if(icon&&icon!="none"){var iconHTML="<img src=\""+this.imageRoot+icon+"\" class=\"icon\" />";this.body.innerHTML=iconHTML+this.body.innerHTML;}}
YAHOO.widget.SimpleDialog.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);}}
YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement){this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.beforeAnimateInEvent=new YAHOO.util.CustomEvent("beforeAnimateIn");this.beforeAnimateOutEvent=new YAHOO.util.CustomEvent("beforeAnimateOut");this.animateInCompleteEvent=new YAHOO.util.CustomEvent("animateInComplete");this.animateOutCompleteEvent=new YAHOO.util.CustomEvent("animateOutComplete");}
YAHOO.widget.ContainerEffect.prototype.init=function(animClass){if(!animClass){animClass=YAHOO.util.Anim;}
this.animIn=new animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);}
YAHOO.widget.ContainerEffect.prototype.animateIn=function(){this.beforeAnimateInEvent.fire();this.animIn.animate();}
YAHOO.widget.ContainerEffect.prototype.animateOut=function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();}
YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn=function(type,args,obj){}
YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn=function(type,args,obj){}
YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn=function(type,args,obj){}
YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut=function(type,args,obj){}
YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut=function(type,args,obj){}
YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut=function(type,args,obj){}
YAHOO.widget.ContainerEffect.FADE=function(overlay,dur){var fade=new YAHOO.widget.ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:YAHOO.util.Easing.easeOut});fade.handleStartAnimateIn=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");}
if(obj.overlay.underlay){obj.initialUnderlayOpacity=YAHOO.util.Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;}
YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",0);}
fade.handleCompleteAnimateIn=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
if(obj.overlay.underlay){YAHOO.util.Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);}
obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();}
fade.handleStartAnimateOut=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}}
fade.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};YAHOO.widget.ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||YAHOO.util.Dom.getX(overlay.element);var y=overlay.cfg.getProperty("y")||YAHOO.util.Dom.getY(overlay.element);var clientWidth=YAHOO.util.Dom.getClientWidth();var offsetWidth=overlay.element.offsetWidth;var slide=new YAHOO.widget.ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:YAHOO.util.Easing.easeOut});slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=(-25-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";}
slide.handleTweenAnimateIn=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var currentX=pos[0];var currentY=pos[1];if(YAHOO.util.Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&&currentX<x){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");}
obj.overlay.cfg.setProperty("xy",[currentX,currentY],true);obj.overlay.cfg.refireEvent("iframe");}
slide.handleCompleteAnimateIn=function(type,args,obj){obj.overlay.cfg.setProperty("xy",[x,y],true);obj.startX=x;obj.startY=y;obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();}
slide.handleStartAnimateOut=function(type,args,obj){var clientWidth=YAHOO.util.Dom.getViewportWidth();var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var x=pos[0];var y=pos[1];var currentTo=obj.animOut.attributes.points.to;obj.animOut.attributes.points.to=[(clientWidth+25),y];}
slide.handleTweenAnimateOut=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var x=pos[0];var y=pos[1];obj.overlay.cfg.setProperty("xy",[x,y],true);obj.overlay.cfg.refireEvent("iframe");}
slide.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");var offsetWidth=obj.overlay.element.offsetWidth;obj.overlay.cfg.setProperty("xy",[x,y]);obj.animateOutCompleteEvent.fire();};slide.init(YAHOO.util.Motion);return slide;}

View File

@@ -1,137 +0,0 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.10.0
*/
YAHOO.util.Config=function(owner){if(owner){this.init(owner);}}
YAHOO.util.Config.prototype={owner:null,configChangedEvent:null,queueInProgress:false,addProperty:function(key,propertyObject){},getConfig:function(){},getProperty:function(key){},resetProperty:function(key){},setProperty:function(key,value,silent){},queueProperty:function(key,value){},refireEvent:function(key){},applyConfig:function(userConfig,init){},refresh:function(){},fireQueue:function(){},subscribeToConfigEvent:function(key,handler,obj,override){},unsubscribeFromConfigEvent:function(key,handler,obj){},checkBoolean:function(val){if(typeof val=='boolean'){return true;}else{return false;}},checkNumber:function(val){if(isNaN(val)){return false;}else{return true;}}}
YAHOO.util.Config.prototype.init=function(owner){this.owner=owner;this.configChangedEvent=new YAHOO.util.CustomEvent("configChanged");this.queueInProgress=false;var config={};var initialConfig={};var eventQueue=[];var fireEvent=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){property.event.fire(value);}}
this.addProperty=function(key,propertyObject){key=key.toLowerCase();config[key]=propertyObject;propertyObject.event=new YAHOO.util.CustomEvent(key);propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner,true);}
this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}}
this.getConfig=function(){var cfg={};for(var prop in config){var property=config[prop]
if(typeof property!='undefined'&&property.event){cfg[prop]=property.value;}}
return cfg;}
this.getProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.value;}else{return undefined;}}
this.resetProperty=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){this.setProperty(key,initialConfig[key].value);}else{return undefined;}}
this.setProperty=function(key,value,silent){key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{var property=config[key];if(typeof property!='undefined'&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
return true;}}else{return false;}}}
this.queueProperty=function(key,value){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(typeof value!='undefined'&&property.validator&&!property.validator(value)){return false;}else{if(typeof value!='undefined'){property.value=value;}else{value=property.value;}
var foundDuplicate=false;for(var i=0;i<eventQueue.length;i++){var queueItem=eventQueue[i];if(queueItem){var queueItemKey=queueItem[0];var queueItemValue=queueItem[1];if(queueItemKey.toLowerCase()==key){eventQueue[i]=null;eventQueue.push([key,(typeof value!='undefined'?value:queueItemValue)]);foundDuplicate=true;break;}}}
if(!foundDuplicate&&typeof value!='undefined'){eventQueue.push([key,value]);}}
if(property.supercedes){for(var s=0;s<property.supercedes.length;s++){var supercedesCheck=property.supercedes[s];for(var q=0;q<eventQueue.length;q++){var queueItemCheck=eventQueue[q];if(queueItemCheck){var queueItemCheckKey=queueItemCheck[0];var queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey.toLowerCase()==supercedesCheck.toLowerCase()){eventQueue.push([queueItemCheckKey,queueItemCheckValue]);eventQueue[q]=null;break;}}}}}
return true;}else{return false;}}
this.refireEvent=function(key){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event&&typeof property.value!='undefined'){if(this.queueInProgress){this.queueProperty(key);}else{fireEvent(key,property.value);}}}
this.applyConfig=function(userConfig,init){if(init){initialConfig=userConfig;}
for(var prop in userConfig){this.queueProperty(prop,userConfig[prop]);}}
this.refresh=function(){for(var prop in config){this.refireEvent(prop);}}
this.fireQueue=function(){this.queueInProgress=true;for(var i=0;i<eventQueue.length;i++){var queueItem=eventQueue[i];if(queueItem){var key=queueItem[0];var value=queueItem[1];var property=config[key];property.value=value;fireEvent(key,value);}}
this.queueInProgress=false;eventQueue=new Array();}
this.subscribeToConfigEvent=function(key,handler,obj,override){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){if(!YAHOO.util.Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}
return true;}else{return false;}}
this.unsubscribeFromConfigEvent=function(key,handler,obj){key=key.toLowerCase();var property=config[key];if(typeof property!='undefined'&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}}
this.outputEventQueue=function(){var output="";for(var q=0;q<eventQueue.length;q++){var queueItem=eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}
return output;}}
YAHOO.util.Config.alreadySubscribed=function(evt,fn,obj){for(var e=0;e<evt.subscribers.length;e++){var subsc=evt.subscribers[e];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;break;}}
return false;}
YAHOO.widget.Module=function(el,userConfig){if(el){this.init(el,userConfig);}}
YAHOO.widget.Module.IMG_ROOT="http://us.i1.yimg.com/us.yimg.com/i/";YAHOO.widget.Module.IMG_ROOT_SSL="https://a248.e.akamai.net/sec.yimg.com/i/";YAHOO.widget.Module.CSS_MODULE="module";YAHOO.widget.Module.CSS_HEADER="hd";YAHOO.widget.Module.CSS_BODY="bd";YAHOO.widget.Module.CSS_FOOTER="ft";YAHOO.widget.Module.prototype={constructor:YAHOO.widget.Module,element:null,header:null,body:null,footer:null,id:null,childNodesInDOM:null,imageRoot:YAHOO.widget.Module.IMG_ROOT,beforeInitEvent:null,initEvent:null,appendEvent:null,beforeRenderEvent:null,renderEvent:null,changeHeaderEvent:null,changeBodyEvent:null,changeFooterEvent:null,changeContentEvent:null,destroyEvent:null,beforeShowEvent:null,showEvent:null,beforeHideEvent:null,hideEvent:null,initEvents:function(){this.beforeInitEvent=new YAHOO.util.CustomEvent("beforeInit");this.initEvent=new YAHOO.util.CustomEvent("init");this.appendEvent=new YAHOO.util.CustomEvent("append");this.beforeRenderEvent=new YAHOO.util.CustomEvent("beforeRender");this.renderEvent=new YAHOO.util.CustomEvent("render");this.changeHeaderEvent=new YAHOO.util.CustomEvent("changeHeader");this.changeBodyEvent=new YAHOO.util.CustomEvent("changeBody");this.changeFooterEvent=new YAHOO.util.CustomEvent("changeFooter");this.changeContentEvent=new YAHOO.util.CustomEvent("changeContent");this.destroyEvent=new YAHOO.util.CustomEvent("destroy");this.beforeShowEvent=new YAHOO.util.CustomEvent("beforeShow");this.showEvent=new YAHOO.util.CustomEvent("show");this.beforeHideEvent=new YAHOO.util.CustomEvent("beforeHide");this.hideEvent=new YAHOO.util.CustomEvent("hide");},platform:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){return"windows";}else if(ua.indexOf("macintosh")!=-1){return"mac";}else{return false;}}(),browser:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")==0){this.imageRoot=YAHOO.widget.Module.IMG_ROOT_SSL;return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty("visible",{value:true,handler:this.configVisible,validator:this.cfg.checkBoolean});this.cfg.addProperty("effect",{suppressEvent:true,supercedes:["visible"]});this.cfg.addProperty("monitorresize",{value:true,handler:this.configMonitorResize});},init:function(el,userConfig){this.initEvents();this.beforeInitEvent.fire(YAHOO.widget.Module);this.cfg=new YAHOO.util.Config(this);if(typeof el=="string"){var elId=el;el=document.getElementById(el);if(!el){el=document.createElement("DIV");el.id=elId;}}
this.element=el;if(el.id){this.id=el.id;}
var childNodes=this.element.childNodes;if(childNodes){for(var i=0;i<childNodes.length;i++){var child=childNodes[i];switch(child.className){case YAHOO.widget.Module.CSS_HEADER:this.header=child;break;case YAHOO.widget.Module.CSS_BODY:this.body=child;break;case YAHOO.widget.Module.CSS_FOOTER:this.footer=child;break;}}}
this.initDefaultConfig();YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Module.CSS_MODULE);if(userConfig){this.cfg.applyConfig(userConfig,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}
this.initEvent.fire(YAHOO.widget.Module);},initResizeMonitor:function(){var resizeMonitor=document.getElementById("_yuiResizeMonitor");if(!resizeMonitor){resizeMonitor=document.createElement("DIV");resizeMonitor.style.position="absolute";resizeMonitor.id="_yuiResizeMonitor";resizeMonitor.style.width="1em";resizeMonitor.style.height="1em";resizeMonitor.style.top="-1000px";resizeMonitor.style.left="-1000px";resizeMonitor.innerHTML="&nbsp;";document.body.appendChild(resizeMonitor);}
this.resizeMonitor=resizeMonitor;YAHOO.util.Event.addListener(this.resizeMonitor,"resize",this.onDomResize,this,true);},onDomResize:function(e,obj){},setHeader:function(headerContent){if(!this.header){this.header=document.createElement("DIV");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
if(typeof headerContent=="string"){this.header.innerHTML=headerContent;}else{this.header.innerHTML="";this.header.appendChild(headerContent);}
this.changeHeaderEvent.fire(headerContent);this.changeContentEvent.fire();},appendToHeader:function(element){if(!this.header){this.header=document.createElement("DIV");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
this.header.appendChild(element);this.changeHeaderEvent.fire(element);this.changeContentEvent.fire();},setBody:function(bodyContent){if(!this.body){this.body=document.createElement("DIV");this.body.className=YAHOO.widget.Module.CSS_BODY;}
if(typeof bodyContent=="string")
{this.body.innerHTML=bodyContent;}else{this.body.innerHTML="";this.body.appendChild(bodyContent);}
this.changeBodyEvent.fire(bodyContent);this.changeContentEvent.fire();},appendToBody:function(element){if(!this.body){this.body=document.createElement("DIV");this.body.className=YAHOO.widget.Module.CSS_BODY;}
this.body.appendChild(element);this.changeBodyEvent.fire(element);this.changeContentEvent.fire();},setFooter:function(footerContent){if(!this.footer){this.footer=document.createElement("DIV");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
if(typeof footerContent=="string"){this.footer.innerHTML=footerContent;}else{this.footer.innerHTML="";this.footer.appendChild(footerContent);}
this.changeFooterEvent.fire(footerContent);this.changeContentEvent.fire();},appendToFooter:function(element){if(!this.footer){this.footer=document.createElement("DIV");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
this.footer.appendChild(element);this.changeFooterEvent.fire(element);this.changeContentEvent.fire();},render:function(appendToNode,moduleElement){this.beforeRenderEvent.fire();if(!moduleElement){moduleElement=this.element;}
var me=this;var appendTo=function(element){if(typeof element=="string"){element=document.getElementById(element);}
if(element){element.appendChild(me.element);me.appendEvent.fire();}}
if(appendToNode){appendTo(appendToNode);}else{if(!YAHOO.util.Dom.inDocument(this.element)){return false;}}
if(this.header&&!YAHOO.util.Dom.inDocument(this.header)){var firstChild=moduleElement.firstChild;if(firstChild){moduleElement.insertBefore(this.header,firstChild);}else{moduleElement.appendChild(this.header);}}
if(this.body&&!YAHOO.util.Dom.inDocument(this.body)){if(this.footer&&YAHOO.util.Dom.isAncestor(this.moduleElement,this.footer)){moduleElement.insertBefore(this.body,this.footer);}else{moduleElement.appendChild(this.body);}}
if(this.footer&&!YAHOO.util.Dom.inDocument(this.footer)){moduleElement.appendChild(this.footer);}
this.renderEvent.fire();return true;},destroy:function(){if(this.element){var parent=this.element.parentNode;}
if(parent){parent.removeChild(this.element);}
this.element=null;this.header=null;this.body=null;this.footer=null;this.destroyEvent.fire();},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(type,args,obj){var visible=args[0];if(visible){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(type,args,obj){var monitor=args[0];if(monitor){this.initResizeMonitor();}else{YAHOO.util.Event.removeListener(this.resizeMonitor,"resize",this.onDomResize);this.resizeMonitor=null;}}}
YAHOO.widget.Overlay=function(el,userConfig){if(arguments.length>0){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);}}
YAHOO.widget.Overlay.prototype=new YAHOO.widget.Module();YAHOO.widget.Overlay.prototype.constructor=YAHOO.widget.Overlay;YAHOO.widget.Overlay.superclass=YAHOO.widget.Module.prototype;YAHOO.widget.Overlay.IFRAME_SRC="promo/m/irs/blank.gif";YAHOO.widget.Overlay.TOP_LEFT="tl";YAHOO.widget.Overlay.TOP_RIGHT="tr";YAHOO.widget.Overlay.BOTTOM_LEFT="bl";YAHOO.widget.Overlay.BOTTOM_RIGHT="br";YAHOO.widget.Overlay.CSS_OVERLAY="overlay";YAHOO.widget.Overlay.prototype.beforeMoveEvent=null;YAHOO.widget.Overlay.prototype.moveEvent=null;YAHOO.widget.Overlay.prototype.init=function(el,userConfig){YAHOO.widget.Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Overlay);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);}
if(this.platform=="mac"&&this.browser=="gecko"){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}
this.initEvent.fire(YAHOO.widget.Overlay);}
YAHOO.widget.Overlay.prototype.initEvents=function(){YAHOO.widget.Overlay.superclass.initEvents.call(this);this.beforeMoveEvent=new YAHOO.util.CustomEvent("beforeMove",this);this.moveEvent=new YAHOO.util.CustomEvent("move",this);}
YAHOO.widget.Overlay.prototype.initDefaultConfig=function(){YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);this.cfg.addProperty("x",{handler:this.configX,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("y",{handler:this.configY,validator:this.cfg.checkNumber,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("xy",{handler:this.configXY,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("context",{handler:this.configContext,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("fixedcenter",{value:false,handler:this.configFixedCenter,validator:this.cfg.checkBoolean,supercedes:["iframe","visible"]});this.cfg.addProperty("width",{handler:this.configWidth,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("height",{handler:this.configHeight,suppressEvent:true,supercedes:["iframe"]});this.cfg.addProperty("zIndex",{value:null,handler:this.configzIndex});this.cfg.addProperty("constraintoviewport",{value:false,handler:this.configConstrainToViewport,validator:this.cfg.checkBoolean,supercedes:["iframe","x","y","xy"]});this.cfg.addProperty("iframe",{value:(this.browser=="ie"?true:false),handler:this.configIframe,validator:this.cfg.checkBoolean,supercedes:["zIndex"]});}
YAHOO.widget.Overlay.prototype.moveTo=function(x,y){this.cfg.setProperty("xy",[x,y]);}
YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"show-scrollbars");YAHOO.util.Dom.addClass(this.element,"hide-scrollbars");}
YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"hide-scrollbars");YAHOO.util.Dom.addClass(this.element,"show-scrollbars");}
YAHOO.widget.Overlay.prototype.configVisible=function(type,args,obj){var visible=args[0];var currentVis=YAHOO.util.Dom.getStyle(this.element,"visibility");var effect=this.cfg.getProperty("effect");var effectInstances=new Array();if(effect){if(effect instanceof Array){for(var i=0;i<effect.length;i++){var eff=effect[i];effectInstances[effectInstances.length]=eff.effect(this,eff.duration);}}else{effectInstances[effectInstances.length]=effect.effect(this,effect.duration);}}
var isMacGecko=(this.platform=="mac"&&this.browser=="gecko");if(visible){if(isMacGecko){this.showMacGeckoScrollbars();}
if(effect){if(visible){if(currentVis!="visible"){this.beforeShowEvent.fire();for(var i=0;i<effectInstances.length;i++){var e=effectInstances[i];if(i==0&&!YAHOO.util.Config.alreadySubscribed(e.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){e.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}
e.animateIn();}}}}else{if(currentVis!="visible"){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(isMacGecko){this.hideMacGeckoScrollbars();}
if(effect){if(currentVis!="hidden"){this.beforeHideEvent.fire();for(var i=0;i<effectInstances.length;i++){var e=effectInstances[i];if(i==0&&!YAHOO.util.Config.alreadySubscribed(e.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){e.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}
e.animateOut();}}}else{if(currentVis!="hidden"){this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");this.cfg.refireEvent("iframe");this.hideEvent.fire();}}}}
YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent=function(){if(this.cfg.getProperty("visible")){this.center();}}
YAHOO.widget.Overlay.prototype.configFixedCenter=function(type,args,obj){var val=args[0];if(val){this.center();if(!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}}
YAHOO.widget.Overlay.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");}
YAHOO.widget.Overlay.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");}
YAHOO.widget.Overlay.prototype.configzIndex=function(type,args,obj){var zIndex=args[0];var el=this.element;if(!zIndex){zIndex=YAHOO.util.Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}
if(this.iframe){if(zIndex<=0){zIndex=1;}
YAHOO.util.Dom.setStyle(this.iframe,"zIndex",(zIndex-1));}
YAHOO.util.Dom.setStyle(el,"zIndex",zIndex);this.cfg.setProperty("zIndex",zIndex,true);}
YAHOO.widget.Overlay.prototype.configXY=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];this.cfg.setProperty("x",x);this.cfg.setProperty("y",y);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}
YAHOO.widget.Overlay.prototype.configX=function(type,args,obj){var x=args[0];var y=this.cfg.getProperty("y");this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setX(this.element,x,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}
YAHOO.widget.Overlay.prototype.configY=function(type,args,obj){var x=this.cfg.getProperty("x");var y=args[0];this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setY(this.element,y,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);}
YAHOO.widget.Overlay.prototype.configIframe=function(type,args,obj){var val=args[0];var el=this.element;if(val){var x=this.cfg.getProperty("x");var y=this.cfg.getProperty("y");if(!x||!y){this.syncPosition();x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");}
if(!isNaN(x)&&!isNaN(y)){if(!this.iframe){this.iframe=document.createElement("iframe");var parent=el.parentNode;if(parent){parent.appendChild(this.iframe);}else{document.body.appendChild(this.iframe);}
this.iframe.src=this.imageRoot+YAHOO.widget.Overlay.IFRAME_SRC;YAHOO.util.Dom.setStyle(this.iframe,"position","absolute");YAHOO.util.Dom.setStyle(this.iframe,"border","none");YAHOO.util.Dom.setStyle(this.iframe,"margin","0");YAHOO.util.Dom.setStyle(this.iframe,"padding","0");YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");}
YAHOO.util.Dom.setStyle(this.iframe,"left",x-2+"px");YAHOO.util.Dom.setStyle(this.iframe,"top",y-2+"px");var width=el.clientWidth;var height=el.clientHeight;YAHOO.util.Dom.setStyle(this.iframe,"width",(width+2)+"px");YAHOO.util.Dom.setStyle(this.iframe,"height",(height+2)+"px");if(!this.cfg.getProperty("visible")){this.iframe.style.display="none";}else{this.iframe.style.display="block";}}}else{if(this.iframe){this.iframe.style.display="none";}}}
YAHOO.widget.Overlay.prototype.configConstrainToViewport=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}}else{this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}}
YAHOO.widget.Overlay.prototype.configContext=function(type,args,obj){var contextArgs=args[0];if(contextArgs){var contextEl=contextArgs[0];var elementMagnetCorner=contextArgs[1];var contextMagnetCorner=contextArgs[2];if(contextEl){if(typeof contextEl=="string"){this.cfg.setProperty("context",[document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner],true);}
if(elementMagnetCorner&&contextMagnetCorner){this.align(elementMagnetCorner,contextMagnetCorner);}}}}
YAHOO.widget.Overlay.prototype.align=function(elementAlign,contextAlign){var contextArgs=this.cfg.getProperty("context");if(contextArgs){var context=contextArgs[0];var element=this.element;var me=this;if(!elementAlign){elementAlign=contextArgs[1];}
if(!contextAlign){contextAlign=contextArgs[2];}
if(element&&context){var elementRegion=YAHOO.util.Dom.getRegion(element);var contextRegion=YAHOO.util.Dom.getRegion(context);var doAlign=function(v,h){switch(elementAlign){case YAHOO.widget.Overlay.TOP_LEFT:me.moveTo(h,v);break;case YAHOO.widget.Overlay.TOP_RIGHT:me.moveTo(h-element.offsetWidth,v);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:me.moveTo(h,v-element.offsetHeight);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:me.moveTo(h-element.offsetWidth,v-element.offsetHeight);break;}}
switch(contextAlign){case YAHOO.widget.Overlay.TOP_LEFT:doAlign(contextRegion.top,contextRegion.left);break;case YAHOO.widget.Overlay.TOP_RIGHT:doAlign(contextRegion.top,contextRegion.right);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:doAlign(contextRegion.bottom,contextRegion.left);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:doAlign(contextRegion.bottom,contextRegion.right);break;}}}}
YAHOO.widget.Overlay.prototype.enforceConstraints=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];var width=parseInt(this.cfg.getProperty("width"));if(isNaN(width)){width=0;}
var offsetHeight=this.element.offsetHeight;var offsetWidth=(width>0?width:this.element.offsetWidth);var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(x<leftConstraint){x=leftConstraint;}else if(x>rightConstraint){x=rightConstraint;}
if(y<topConstraint){y=topConstraint;}else if(y>bottomConstraint){y=bottomConstraint;}
this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);}
YAHOO.widget.Overlay.prototype.center=function(){var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.element.style.left=parseInt(x)+"px";this.element.style.top=parseInt(y)+"px";this.syncPosition();this.cfg.refireEvent("iframe");}
YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);}
YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);this.cfg.refireEvent("iframe");}
YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){YAHOO.widget.Overlay.windowScrollEvent.fire();}
YAHOO.widget.Overlay.windowResizeHandler=function(e){YAHOO.widget.Overlay.windowResizeEvent.fire();}
if(YAHOO.widget.Overlay._initialized==undefined){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}
YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);}
YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:new Array(),initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},getActive:function(){},focus:function(overlay){},remove:function(overlay){},blurAll:function(){},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;}
this.focus=function(overlay){var o=this.find(overlay);if(o){this.blurAll();activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex)+1));}
this.overlays.sort(this.compareZIndexDesc);}}
this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent=null
o.blurEvent=null;o.focus=null;o.blur=null;}}
this.blurAll=function(){activeOverlay=null;for(var o=0;o<this.overlays.length;o++){YAHOO.util.Dom.removeClass(this.overlays[o].element,YAHOO.widget.OverlayManager.CSS_FOCUSED);}}
var overlays=this.cfg.getProperty("overlays");if(overlays){this.register(overlays);this.overlays.sort(this.compareZIndexDesc);}},register:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){overlay.cfg.addProperty("manager",{value:this});overlay.focusEvent=new YAHOO.util.CustomEvent("focus");overlay.blurEvent=new YAHOO.util.CustomEvent("blur");var mgr=this;overlay.focus=function(){mgr.focus(this);this.focusEvent.fire();}
overlay.blur=function(){mgr.blurAll();this.blurEvent.fire();}
var focusOnDomEvent=function(e,obj){mgr.focus(overlay);}
var focusevent=this.cfg.getProperty("focusevent");YAHOO.util.Event.addListener(overlay.element,focusevent,focusOnDomEvent,this,true);var zIndex=YAHOO.util.Dom.getStyle(overlay.element,"zIndex");if(!isNaN(zIndex)){overlay.cfg.setProperty("zIndex",parseInt(zIndex));}else{overlay.cfg.setProperty("zIndex",0);}
this.overlays.push(overlay);return true;}else if(overlay instanceof Array){var regcount=0;for(var i=0;i<overlay.length;i++){if(this.register(overlay[i])){regcount++;}}
if(regcount>0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o]==overlay){return this.overlays[o];}}}else if(typeof overlay=="string"){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o].id==overlay){return this.overlays[o];}}}
return null;},compareZIndexDesc:function(o1,o2){var zIndex1=o1.cfg.getProperty("zIndex");var zIndex2=o2.cfg.getProperty("zIndex");if(zIndex1>zIndex2){return-1;}else if(zIndex1<zIndex2){return 1;}else{return 0;}},showAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].show();}},hideAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].hide();}}}
YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}
var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}
if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}
var handleKeyPress=function(e,obj){var keyPressed=e.charCode||e.keyCode;if(!keyData.shift)keyData.shift=false;if(!keyData.alt)keyData.alt=false;if(!keyData.ctrl)keyData.ctrl=false;if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){if(keyPressed==keyData.keys[i]){keyEvent.fire(keyPressed,e);break;}}}else{if(keyPressed==keyData.keys){keyEvent.fire(keyPressed,e);}}}}
this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}
this.enabled=true;}
this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}
this.enabled=false;}}
YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.prototype.enable=function(){};YAHOO.util.KeyListener.prototype.disable=function(){};YAHOO.util.KeyListener.prototype.enabledEvent=null;YAHOO.util.KeyListener.prototype.disabledEvent=null;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +0,0 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.10.0
*/
body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}

View File

@@ -1,7 +0,0 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.10.0
*/
body{text-align:center;}#doc{width:57.69em;*width:56.3em;min-width:750px;margin:auto;text-align:left;}#hd,#bd{margin-bottom:1em;text-align:left;}#ft{font-size:77%;font-family:verdana;clear:both;}.yui-t1 #yui-main .yui-b, .yui-t2 #yui-main .yui-b, .yui-t3 #yui-main .yui-b, .yui-t4 .yui-b, .yui-t5 .yui-b, .yui-t6 .yui-b{float:right;}.yui-t1 .yui-b, .yui-t2 .yui-b, .yui-t3 .yui-b, .yui-t4 #yui-main .yui-b, .yui-t5 #yui-main .yui-b, .yui-t6 #yui-main .yui-b{float:left;}.yui-t1 #yui-main .yui-b{width:76%;min-width:570px;}.yui-t1 .yui-b{width:21.33%;min-width:160px;}.yui-t2 #yui-main .yui-b, .yui-t4 #yui-main .yui-b{width:73.4%;min-width:550px;}.yui-t2 .yui-b, .yui-t4 .yui-b{width:24%;min-width:180px;}.yui-t3 #yui-main .yui-b, .yui-t6 #yui-main .yui-b{width:57.6%;min-width:430px;}.yui-t3 .yui-b, .yui-t6 .yui-b{width:40%;min-width:300px;}.yui-t5 #yui-main .yui-b{width:65.4%;min-width:490px;}.yui-t5 .yui-b{width:32%;min-width:240px;}.yui-t7 #main .yui-b{min-width:750px;}.yui-g .yui-u, .yui-g .yui-g, .yui-ge .yui-u, .yui-gf .yui-u{float:right;display:inline;}.yui-g .first, .yui-gd .first, .yui-ge .first, .yui-gf .first{float:left;}.yui-g .yui-u, .yui-g .yui-g{width:49.1%;}.yui-g .yui-g .yui-u{width:48.1%;}.yui-gb .yui-u, .yui-gc .yui-u, .yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;}.yui-gb .first, .yui-gc .first, .yui-gd .first{margin-left:0;}.yui-gc .first, .yui-gd .yui-u{width:66%;}.yui-gd .first{width:32%;}.yui-ge .yui-u{width:24%;}.yui-ge .first, .yui-gf .yui-u{width:74.2%;}.yui-gf .first{width:24%;}.yui-ge .first{width:74.2%;}#bd:after, .yui-g:after, .yui-gb:after, .yui-gc:after, .yui-gd:after, .yui-ge:after, .yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd, .yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf{zoom:1;}

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +0,0 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.10.0
*/
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;}q:before,q:after{content:'';}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.10.0 */ var YAHOO=window.YAHOO||{};YAHOO.namespace=function(_1){if(!_1||!_1.length){return null;}var _2=_1.split(".");var _3=YAHOO;for(var i=(_2[0]=="YAHOO")?1:0;i<_2.length;++i){_3[_2[i]]=_3[_2[i]]||{};_3=_3[_2[i]];}return _3;};YAHOO.log=function(_5,_6){if(YAHOO.widget.Logger){YAHOO.widget.Logger.log(null,_5,_6);}else{return false;}};YAHOO.namespace("util");YAHOO.namespace("widget");YAHOO.namespace("example");

View File

@@ -1,280 +0,0 @@
##############################################################################
##
## minjson.py implements JSON reading and writing in python.
## Copyright (c) 2005 Jim Washington and Contributors.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.=
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
##############################################################################
# minjson.py
# use python's parser to read minimal javascript objects.
# str's objects and fixes the text to write javascript.
# Thanks to Patrick Logan for starting the json-py project and making so many
# good test cases.
# Jim Washington 7 Aug 2005.
from re import compile, sub, search, DOTALL
# set to true if transmission size is much more important than speed
# only affects writing, and makes a minimal difference in output size.
alwaysStripWhiteSpace = False
# add to this string if you wish to exclude additional math operators
# from reading.
badOperators = '*'
#################################
# read JSON object #
#################################
slashstarcomment = compile(r'/\*.*?\*/',DOTALL)
doubleslashcomment = compile(r'//.*\n')
def _Read(aString):
"""Use eval in a 'safe' way to turn javascript expression into
a python expression. Allow only True, False, and None in global
__builtins__, and since those map as true, false, null in
javascript, pass those as locals
"""
try:
result = eval(aString,
{"__builtins__":{'True':True,'False':False,'None':None}},
{'null':None,'true':True,'false':False})
except NameError:
raise ReadException, \
"Strings must be quoted. Could not read '%s'." % aString
except SyntaxError:
raise ReadException, \
"Syntax error. Could not read '%s'." % aString
return result
# badOperators is defined at the top of the module
# generate the regexes for math detection
regexes = {}
for operator in badOperators:
if operator in '+*':
# '+' and '*' need to be escaped with \ in re
regexes[operator,'numeric operation'] \
= compile(r"\d*\s*\%s|\%s\s*\d*" % (operator, operator))
else:
regexes[operator,'numeric operation'] \
= compile(r"\d*\s*%s|%s\s*\d*" % (operator, operator))
def _getStringState(aSequence):
"""return the list of required quote closures if the end of aString needs them
to close quotes.
"""
state = []
for k in aSequence:
if k in ['"',"'"]:
if state and k == state[-1]:
state.pop()
else:
state.append(k)
return state
def _sanityCheckMath(aString):
"""just need to check that, if there is a math operator in the
client's JSON, it is inside a quoted string. This is mainly to
keep client from successfully sending 'D0S'*9**9**9**9...
Return True if OK, False otherwise
"""
for operator in badOperators:
#first check, is it a possible math operation?
if regexes[(operator,'numeric operation')].search(aString) is not None:
# OK. possible math operation. get the operator's locations
getlocs = regexes[(operator,'numeric operation')].finditer(aString)
locs = [item.span() for item in getlocs]
halfStrLen = len(aString) / 2
#fortunately, this should be rare
for loc in locs:
exprStart = loc[0]
exprEnd = loc[1]
# We only need to know the char is within open quote
# status.
if exprStart <= halfStrLen:
teststr = aString[:exprStart]
else:
teststr = list(aString[exprEnd+1:])
teststr.reverse()
if not _getStringState(teststr):
return False
return True
def safeRead(aString):
"""turn the js into happier python and check for bad operations
before sending it to the interpreter
"""
# get rid of trailing null. Konqueror appends this, and the python
# interpreter balks when it is there.
CHR0 = chr(0)
while aString.endswith(CHR0):
aString = aString[:-1]
# strip leading and trailing whitespace
aString = aString.strip()
# zap /* ... */ comments
aString = slashstarcomment.sub('',aString)
# zap // comments
aString = doubleslashcomment.sub('',aString)
# here, we only check for the * operator as a DOS problem by default;
# additional operators may be excluded by editing badOperators
# at the top of the module
if _sanityCheckMath(aString):
return _Read(aString)
else:
raise ReadException, 'Unacceptable JSON expression: %s' % aString
read = safeRead
#################################
# write object as JSON #
#################################
#alwaysStripWhiteSpace is defined at the top of the module
tfnTuple = (('True','true'),('False','false'),('None','null'),)
def _replaceTrueFalseNone(aString):
"""replace True, False, and None with javascript counterparts"""
for k in tfnTuple:
if k[0] in aString:
aString = aString.replace(k[0],k[1])
return aString
def _handleCode(subStr,stripWhiteSpace):
"""replace True, False, and None with javascript counterparts if
appropriate, remove unicode u's, fix long L's, make tuples
lists, and strip white space if requested
"""
if 'e' in subStr:
#True, False, and None have 'e' in them. :)
subStr = (_replaceTrueFalseNone(subStr))
if stripWhiteSpace:
# re.sub might do a better job, but takes longer.
# Spaces are the majority of the whitespace, anyway...
subStr = subStr.replace(' ','')
if subStr[-1] in "uU":
#remove unicode u's
subStr = subStr[:-1]
if "L" in subStr:
#remove Ls from long ints
subStr = subStr.replace("L",'')
#do tuples as lists
if "(" in subStr:
subStr = subStr.replace("(",'[')
if ")" in subStr:
subStr = subStr.replace(")",']')
return subStr
# re for a double-quoted string that has a single-quote in it
# but no double-quotes and python punctuation after:
redoublequotedstring = compile(r'"[^"]*\'[^"]*"[,\]\}:\)]')
escapedSingleQuote = r"\'"
escapedDoubleQuote = r'\"'
def doQuotesSwapping(aString):
"""rewrite doublequoted strings with single quotes as singlequoted strings with
escaped single quotes"""
s = []
foundlocs = redoublequotedstring.finditer(aString)
prevend = 0
for loc in foundlocs:
start,end = loc.span()
s.append(aString[prevend:start])
tempstr = aString[start:end]
endchar = tempstr[-1]
ts1 = tempstr[1:-2]
ts1 = ts1.replace("'",escapedSingleQuote)
ts1 = "'%s'%s" % (ts1,endchar)
s.append(ts1)
prevend = end
s.append(aString[prevend:])
return ''.join(s)
def _pyexpr2jsexpr(aString, stripWhiteSpace):
"""Take advantage of python's formatting of string representations of
objects. Python always uses "'" to delimit strings. Except it doesn't when
there is ' in the string. Fix that, then, if we split
on that delimiter, we have a list that alternates non-string text with
string text. Since string text is already properly escaped, we
only need to replace True, False, and None in non-string text and
remove any unicode 'u's preceding string values.
if stripWhiteSpace is True, remove spaces, etc from the non-string
text.
"""
inSingleQuote = False
inDoubleQuote = False
#python will quote with " when there is a ' in the string,
#so fix that first
if redoublequotedstring.search(aString):
aString = doQuotesSwapping(aString)
marker = None
if escapedSingleQuote in aString:
#replace escaped single quotes with a marker
marker = markerBase = '|'
markerCount = 1
while marker in aString:
#if the marker is already there, make it different
markerCount += 1
marker = markerBase * markerCount
aString = aString.replace(escapedSingleQuote,marker)
#escape double-quotes
aString = aString.replace('"',escapedDoubleQuote)
#split the string on the real single-quotes
splitStr = aString.split("'")
outList = []
alt = True
for subStr in splitStr:
#if alt is True, non-string; do replacements
if alt:
subStr = _handleCode(subStr,stripWhiteSpace)
outList.append(subStr)
alt = not alt
result = '"'.join(outList)
if marker:
#put the escaped single-quotes back as "'"
result = result.replace(marker,"'")
return result
def write(obj, encoding="utf-8",stripWhiteSpace=alwaysStripWhiteSpace):
"""Represent the object as a string. Do any necessary fix-ups
with pyexpr2jsexpr"""
try:
#not really sure encode does anything here
aString = str(obj).encode(encoding)
except UnicodeEncodeError:
aString = obj.encode(encoding)
if isinstance(obj,basestring):
if '"' in aString:
aString = aString.replace(escapedDoubleQuote,'"')
result = '"%s"' % aString.replace('"',escapedDoubleQuote)
else:
result = '"%s"' % aString
else:
result = _pyexpr2jsexpr(aString,stripWhiteSpace).encode(encoding)
return result
class ReadException(Exception):
pass
class WriteException(Exception):
pass

View File

@@ -1,27 +0,0 @@
from pysqlite2 import dbapi2 as sqlite
import MySQLdb, sys, os
DIRNAME= os.path.dirname(sys.argv[0])
if not DIRNAME:
DBPATH="../db/data.sqlite"
else:
DBPATH=DIRNAME + "/../db/data.sqlite"
sqlite_db = sqlite.connect(DBPATH)
mysql_db = MySQLdb.connect("localhost","o","o","o_graphs")
mysql_cur = mysql_db.cursor()
def migrate_table(table, select, insert):
print "Migrating: " + table
sqlite_cur = sqlite_db.cursor()
res = sqlite_cur.execute(select)
for row in res:
mysql_cur.execute(insert % row)
migrate_table('annotations',"SELECT dataset_id,time,value FROM annotations", "INSERT INTO annotations (`dataset_id`, `time`, `value` ) VALUES ('%s','%s','%s')")
migrate_table('dataset_branchinfo',"SELECT `dataset_id`, `time`, `branchid` FROM dataset_branchinfo", "INSERT INTO dataset_branchinfo (`dataset_id`, `time`, `branchid` ) VALUES ('%s','%s','%s')")
migrate_table('dataset_extra_data',"SELECT `dataset_id`, `time`, `data` FROM dataset_extra_data", "INSERT INTO dataset_extra_data (`dataset_id`, `time`, `data` ) VALUES ('%s','%s','%s')")
migrate_table('dataset_info',"SELECT `id`, `type`, `machine`,`test`, `test_type`, `extra_data`, `branch`, `date` FROM dataset_info", "INSERT INTO dataset_info (`id`, `type`, `machine`,`test`, `test_type`, `extra_data`, `branch`, `date` ) VALUES ('%s', '%s', '%s','%s', '%s', '%s', '%s', '%s')")
migrate_table('dataset_values',"SELECT `dataset_id`, `time`, `value` FROM dataset_values", "INSERT INTO dataset_values (`dataset_id`, `time`, `value` ) VALUES ('%s','%s','%s')")

View File

@@ -1,90 +0,0 @@
-- MySQL dump 10.9
--
-- Host: localhost Database: o_graphs
-- ------------------------------------------------------
-- Server version 4.1.20
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `annotations`
--
DROP TABLE IF EXISTS `annotations`;
CREATE TABLE `annotations` (
`dataset_id` int(11) default NULL,
`time` int(11) default NULL,
`value` varchar(255) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `dataset_branchinfo`
--
DROP TABLE IF EXISTS `dataset_branchinfo`;
CREATE TABLE `dataset_branchinfo` (
`dataset_id` int(11) default NULL,
`time` int(11) default NULL,
`branchid` varchar(255) default NULL,
KEY `datasets_branchinfo_id_idx` (`dataset_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `dataset_extra_data`
--
DROP TABLE IF EXISTS `dataset_extra_data`;
CREATE TABLE `dataset_extra_data` (
`dataset_id` int(11) default NULL,
`time` int(11) default NULL,
`data` text,
KEY `datasets_extradata_id_idx` (`dataset_id`),
KEY `datasets_extra_data_supplemental_idx` (`dataset_id`,`time`,`data`(255))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `dataset_info`
--
DROP TABLE IF EXISTS `dataset_info`;
CREATE TABLE `dataset_info` (
`id` int(11) NOT NULL auto_increment,
`type` varchar(255) default NULL,
`machine` varchar(255) default NULL,
`test` varchar(255) default NULL,
`test_type` varchar(255) default NULL,
`extra_data` varchar(255) default NULL,
`branch` varchar(255) default NULL,
`date` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `dataset_values`
--
DROP TABLE IF EXISTS `dataset_values`;
CREATE TABLE `dataset_values` (
`dataset_id` int(11) default NULL,
`time` int(11) default NULL,
`value` float default NULL,
KEY `datasets_id_idx` (`dataset_id`),
KEY `datasets_time_idx` (`time`),
KEY `datasets_time_id_idx` (`dataset_id`,`time`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

View File

@@ -1,109 +0,0 @@
#!/usr/bin/env python
import string
import sys, os
import time
import re
from optparse import OptionParser
from optparse import OptionValueError
DIRNAME= os.path.dirname(sys.argv[0])
if DIRNAME:
sys.path.append(DIRNAME + "/../")
else:
sys.path.append("../")
from graphsdb import db
parser = OptionParser(usage="Usage: %prog [options] test_name tinderbox_name tinderbox_machine_type tinderbox_branch < data.txt")
parser.add_option("-b", "--baseline", dest="baseline", metavar="NAME",
action="store", default=None,
help="use as baseline data for a test of the same name")
parser.add_option("-r", "--replace", dest="replace",
action="store_true", default=False,
help="remove current data for this test and re-add all data")
(options, args) = parser.parse_args()
if options.baseline == None:
test_type = "perf"
else:
test_type = "baseline"
if len(args) != 4:
parser.print_help()
sys.exit()
(testname, tbox, mtype, branch) = args[0:4]
branchid = "xxxxxxxx"
date = ""
graph_type = "continuous"
setid = -1
while setid == -1:
cur = db.cursor()
if options.baseline:
cur.execute("SELECT id FROM dataset_info WHERE type = ? AND machine <=> ? AND test <=> ? AND test_type=? AND extra_data <=> ? AND branch <=> ?",
(graph_type, tbox, testname, test_type, options.baseline, branch))
else:
cur.execute("SELECT id FROM dataset_info WHERE type = ? AND machine <=> ? AND test <=> ? AND test_type=? AND branch<=>? AND extra_data IS NULL",
(graph_type, tbox, testname, test_type, branch))
res = cur.fetchall()
cur.close()
if len(res) == 0:
db.execute("INSERT INTO dataset_info (type, machine, test, test_type, extra_data, branch, date) VALUES (?,?,?,?,?,?,?)",
(graph_type, tbox, testname, test_type, options.baseline, branch, date))
else:
setid = res[0][0]
if options.replace:
db.execute("DELETE FROM dataset_values WHERE dataset_id = ?", (setid,))
db.execute("DELETE FROM dataset_extra_data WHERE dataset_id = ?", (setid,))
cur = db.cursor()
cur.execute("SELECT time FROM dataset_values WHERE dataset_id = ? ORDER BY time DESC LIMIT 1", (setid,))
latest = cur.fetchone()
if latest == None:
latest = 0
else:
latest = latest[0]
db.commit() # release any locks
count = 0
linenum = 0
for line in sys.stdin:
linenum = linenum + 1
chunks = string.split(line, "\t")
if len(chunks) == 1 and chunks[0] == '':
break # don't warn about empty lines
if len(chunks) != 6 and len(chunks) != 7:
print "chunks not 6 or 7:", len(chunks), "line#", linenum, "value:", chunks
break
if len(chunks) == 6:
(datestr, val, data, ip, tinderbox, ua) = chunks[0:6]
else:
(datestr, val, codate, data, ip, tinderbox, ua) = chunks[0:7]
foo = string.split(codate, '=')
if foo[0] == "MOZ_CO_DATE":
datestr = foo[1]
timeval = time.mktime(map(int, string.split(datestr, ":")) + [0, 0, 0])
#don't record this value if it is not defined
if float(val) != float(val):
continue;
#ensure that newlines are stripped from the extra_data
data = data.rstrip('\r\n')
if timeval > latest:
db.execute("INSERT INTO dataset_values (dataset_id,time,value) VALUES (?,?,?)", (setid, timeval, val))
db.execute("INSERT INTO dataset_extra_data (dataset_id,time,data) VALUES (?,?,?)", (setid, timeval, data))
count = count + 1
db.commit()
print "(", count, ")",

View File

@@ -1,68 +0,0 @@
#!/bin/bash
ROOTURL="http://build-graphs.mozilla.org/db"
OLDDIR=/path/to/utils/old
IMPORTPY=/path/to/utils/import.py
TESTS="dhtml pageload pageload2 render rendergfx startup xulwinopen refcnt_leaks trace_malloc_leaks"
MACHINEINFO="bl-bldlnx01_fx-linux-tbox-head linux 1.9
linux_fx-linux-tbox_depend-fx-linux-trunk linux 1.9
fxdbug-linux-tbox.build.mozilla.org linux 1.9
xserve08.build.mozilla.org_fx-trunk macOSX 1.9
bl-bldxp01 winnt 1.9
balsa-1_8 linux 1.8
bl-bldlnx01.office.mozilla.org_mozilla_1_8_branch linux 1.8
bm-xserve02.mozilla.org_mozilla_1_8_branch macOSX 1.8
bl-bldxp01_mozilla_1_8_branch winnt 1.8
"
echo Downloading...
for test in $TESTS; do
echo -n $test
mkdir -p $OLDDIR/$test
cd $OLDDIR/$test
IFS=$'\n'
for line in $MACHINEINFO; do
IFS=" "
set -- $line
m=$1
echo -n .
wget -q -c $ROOTURL/$test/$m
done
done
echo done.
echo Importing...
IFS=" "
for test in $TESTS; do
echo $test
#for m in $MACHINES; do
IFS=$'\n'
for line in $MACHINEINFO; do
IFS=" "
set -- $line
m=$1
mtype=$2
branch=$3
echo "working with $m $mtype $branch"
if [ -f $OLDDIR/$test/$m ]; then
echo -n .
mm=`echo $m | sed 's,\(\.build\|\.office\|\)\.mozilla\.org,,'`
mm=`echo $mm | sed 's,\(_head\|-trunk\),,'`
mm=`echo $mm | sed 's,_mozilla_1_8_branch,-18,'`
mm=$mm\_$mtype
# individual machine renames go here
case $mm in
*) ;;
esac
echo $m -- $mm
python $IMPORTPY $test $mm $mtype $branch < $OLDDIR/$test/$m
fi
done
done
echo done.

View File

@@ -0,0 +1,39 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla Communicator client code,
# released March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# Contributors:
# Daniel Veditz <dveditz@netscape.com>
# Douglas Turner <dougt@netscape.com>
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = public
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/config/rules.mk

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,30 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla Communicator client code,
# released March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# Contributors:
# Daniel Veditz <dveditz@netscape.com>
# Douglas Turner <dougt@netscape.com>
DEPTH=..
DIRS= public res src
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,33 @@
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:NC="http://home.netscape.com/NC-rdf#">
<RDF:Bag ID="NC:SoftwareUpdateRoot">
<RDF:li>
<RDF:Bag ID="NC:NewSoftwareToday" NC:title="New Software">
<RDF:li>
<RDF:Description ID="AimUpdate344">
<NC:type resource="http://home.netscape.com/NC-rdf#SoftwarePackage" />
<NC:title>AOL AIM</NC:title>
<NC:description>An Instant Message Client</NC:description>
<NC:version>3.4.1.12</NC:version>
<NC:registryKey>/AOL/AIM/</NC:registryKey>
<NC:url>http://home.netscape.com/index.html</NC:url>
</RDF:Description>
</RDF:li>
<RDF:li>
<RDF:Description ID="PGPPlugin345">
<NC:type resource="http://home.netscape.com/NC-rdf#SoftwarePackage" />
<NC:title>PGP Plugin For Mozilla</NC:title>
<NC:description>A high grade encryption plugin</NC:description>
<NC:version>1.1.2.0</NC:version>
<NC:registryKey>/PGP/ROCKS/</NC:registryKey>
<NC:url>http://home.netscape.com/index.html</NC:url>
</RDF:Description>
</RDF:li>
</RDF:Bag>
</RDF:li>
</RDF:Bag>
</RDF:RDF>

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