Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 17401 invoked from network); 16 Jul 2009 19:15:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Jul 2009 19:15:57 -0000 Received: (qmail 45242 invoked by uid 500); 16 Jul 2009 19:17:02 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 45173 invoked by uid 500); 16 Jul 2009 19:17:02 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 45093 invoked by uid 99); 16 Jul 2009 19:16:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2009 19:16:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2009 19:16:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5528E23889F1; Thu, 16 Jul 2009 19:15:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r794787 [20/34] - in /geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src: ./ animation/ cal/ charting/ charting/svg/ charting/vml/ collections/ crypto/ data/ data/core/ data/old/ data/old/format/ data/old/provider/ date/ debug/... Date: Thu, 16 Jul 2009 19:14:56 -0000 To: scm@geronimo.apache.org From: djencks@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090716191517.5528E23889F1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DatePicker.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DatePicker.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DatePicker.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DatePicker.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,349 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + + + +dojo.provide("dojo.widget.DatePicker"); +dojo.require("dojo.date.common"); +dojo.require("dojo.date.format"); +dojo.require("dojo.date.serialize"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.HtmlWidget"); +dojo.require("dojo.event.*"); +dojo.require("dojo.dom"); +dojo.require("dojo.html.style"); +dojo.widget.defineWidget("dojo.widget.DatePicker", dojo.widget.HtmlWidget, {value:"", name:"", displayWeeks:6, adjustWeeks:false, startDate:"1492-10-12", endDate:"2941-10-12", weekStartsOn:"", staticDisplay:false, dayWidth:"narrow", classNames:{previous:"previousMonth", disabledPrevious:"previousMonthDisabled", current:"currentMonth", disabledCurrent:"currentMonthDisabled", next:"nextMonth", disabledNext:"nextMonthDisabled", currentDate:"currentDate", selectedDate:"selectedDate"}, templateString:"
\n\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t \t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\"↑\"\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t

\n\t\t\t\t\t\t\t
\n\t\t\t\t
\n
\n", templateCssString:".datePickerContainer {\n\twidth:164px; /* needed for proper user styling */\n}\n\n.calendarContainer {\n/*\tborder:1px solid #566f8f;*/\n}\n\n.calendarBodyContainer {\n\twidth:100%; /* needed for the explode effect (explain?) */\n\tbackground: #7591bc url(\"images/dpBg.gif\") top left repeat- x;\n}\n\n.calendarBodyContainer thead tr td {\n\tcolor:#293a4b;\n\tfont:bold 0.75em Helvetica, Arial, Verdana, sans-serif;\n\ttext-align:center;\n\tpadding:0.25em;\n\tbackground: url(\"images/dpHorizLine.gif\") bottom left repeat-x;\n}\n\n.calendarBodyContainer tbody tr td {\n\tcolor:#fff;\n\tfont:bold 0.7em Helvetica, Arial, Verdana, sans-serif;\n\ttext-align:center;\n\tpadding:0.4em;\n\tbackground: url(\"images/dpVertLine.gif\") top right repeat-y;\n\tcursor:pointer;\n\tcursor:hand;\n}\n\n\n.monthWrapper {\n\tpadding-bottom:2px;\n\tbackground: url(\"images/dpHorizLine.gif\") bottom left repeat-x;\n}\n\n.monthContainer {\n\twidth:100%;\n}\n\n.monthLabelContainer {\n\ttext-align:center;\n\tfont:bold 0.75em Helvetica, Arial, Verdana, sans-serif;\n\tbackground: url(\"images/dpMonthBg.png\") repeat-x top left !important;\n\tcolor:#293a4b;\n\tpadding:0.25em;\n}\n\n.monthCurve {\n\twidth:12px;\n}\n\n.monthCurveTL {\n\tbackground: url(\"images/dpCurveTL.png\") no-repeat top left ! important;\n}\n\n.monthCurveTR {\n\t\tbackground: url(\"images/dpCurveTR.png\") no-repeat top right !important;\n}\n\n\n.yearWrapper {\n\tbackground: url(\"images/dpHorizLineFoot.gif\") top left repeat-x;\n\tpadding-top:2px;\n}\n\n.yearContainer {\n\twidth:100%;\n}\n\n.yearContainer td {\n\tbackground:url(\"images/dpYearBg.png\") top left repeat-x;\n}\n\n.yearContainer .yearLabel {\n\tmargin:0;\n\tpadding:0.45em 0 0.45em 0;\n\tcolor:#fff;\n\tfont:bold 0.75em Helvetica, Arial, Verdana, sans-serif;\n\ttext-align:center;\n}\n\n.curveBL {\n\tbackground: url(\"images/dpCurveBL.png\") bottom left no-repeat !important;\n\twidth:9px !important;\n\tpadding:0;\n\tmargin:0;\n}\n\n.curveBR {\n\tbackground: url(\"images/dpCurveBR.png\") bottom right no-repeat !important;\n\twidth:9px !important;\n\tpadding:0;\n\tmargin:0;\n}\n\n\n.previousMonth {\n\tbackground-color:#6782a8 !important;\n}\n\n.previousMonthDisabled {\n\tbackground-color:#a4a5a6 !important;\n\tcursor:default !important\n}\ n.currentMonth {\n}\n\n.currentMonthDisabled {\n\tbackground-color:#bbbbbc !important;\n\tcursor:default !important\n}\n.nextMonth {\n\tbackground-color:#6782a8 !important;\n}\n.nextMonthDisabled {\n\tbackground-color:#a4a5a6 !important;\n\tcursor:default !important;\n}\n\n.currentDate {\n\ttext-decoration:underline;\n\tfont-style:italic;\n}\n\n.selectedDate {\n\tbackground-color:#fff !important;\n\tcolor:#6782a8 !important;\n}\n\n.yearLabel .selectedYear {\n\tpadding:0.2em;\n\tbackground-color:#9ec3fb !important;\n}\n\n.nextYear, .previousYear {\n\tcursor:pointer;cursor:hand;\n\tpadding:0;\n}\n\n.nextYear {\n\tmargin:0 0 0 0.55em;\n}\n\n.previousYear {\n\tmargin:0 0.55em 0 0;\n}\n\n.incrementControl {\n\tcursor:pointer;cursor:hand;\n\twidth:1em;\n}\n\n.increase {\n\tfloat:right;\n}\n\n.decrease {\n\tfloat:left;\n}\n\n.lastColumn {\n\tbackground-image:none !important;\n}\n\n\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/DatePicker.css"), postMixInPropertie s:function () { + dojo.widget.DatePicker.superclass.postMixInProperties.apply(this, arguments); + if (!this.weekStartsOn) { + this.weekStartsOn = dojo.date.getFirstDayOfWeek(this.lang); + } + this.today = new Date(); + this.today.setHours(0, 0, 0, 0); + if (typeof (this.value) == "string" && this.value.toLowerCase() == "today") { + this.value = new Date(); + } else { + if (this.value && (typeof this.value == "string") && (this.value.split("-").length > 2)) { + this.value = dojo.date.fromRfc3339(this.value); + this.value.setHours(0, 0, 0, 0); + } + } +}, fillInTemplate:function (args, frag) { + dojo.widget.DatePicker.superclass.fillInTemplate.apply(this, arguments); + var source = this.getFragNodeRef(frag); + dojo.html.copyStyle(this.domNode, source); + this.weekTemplate = dojo.dom.removeNode(this.calendarWeekTemplate); + this._preInitUI(this.value ? this.value : this.today, false, true); + var dayLabels = dojo.lang.unnest(dojo.date.getNames("days", this.dayWidth, "standAlone", this.lang)); + if (this.weekStartsOn > 0) { + for (var i = 0; i < this.weekStartsOn; i++) { + dayLabels.push(dayLabels.shift()); + } + } + var dayLabelNodes = this.dayLabelsRow.getElementsByTagName("td"); + for (i = 0; i < 7; i++) { + dayLabelNodes.item(i).innerHTML = dayLabels[i]; + } + if (this.value) { + this.setValue(this.value); + } +}, getValue:function () { + return dojo.date.toRfc3339(new Date(this.value), "dateOnly"); +}, getDate:function () { + return this.value; +}, setValue:function (rfcDate) { + this.setDate(rfcDate); +}, setDate:function (dateObj) { + if (dateObj == "") { + this.value = ""; + this._preInitUI(this.curMonth, false, true); + } else { + if (typeof dateObj == "string") { + this.value = dojo.date.fromRfc3339(dateObj); + this.value.setHours(0, 0, 0, 0); + } else { + this.value = new Date(dateObj); + this.value.setHours(0, 0, 0, 0); + } + } + if (this.selectedNode != null) { + dojo.html.removeClass(this.selectedNode, this.classNames.selectedDate); + } + if (this.clickedNode != null) { + dojo.debug("adding selectedDate"); + dojo.html.addClass(this.clickedNode, this.classNames.selectedDate); + this.selectedNode = this.clickedNode; + } else { + this._preInitUI(this.value, false, true); + } + this.clickedNode = null; + this.onValueChanged(this.value); +}, _preInitUI:function (dateObj, initFirst, initUI) { + if (typeof (this.startDate) == "string") { + this.startDate = dojo.date.fromRfc3339(this.startDate); + } + if (typeof (this.endDate) == "string") { + this.endDate = dojo.date.fromRfc3339(this.endDate); + } + this.startDate.setHours(0, 0, 0, 0); + this.endDate.setHours(24, 0, 0, -1); + if (dateObj < this.startDate || dateObj > this.endDate) { + dateObj = new Date((dateObj < this.startDate) ? this.startDate : this.endDate); + } + this.firstDay = this._initFirstDay(dateObj, initFirst); + this.selectedIsUsed = false; + this.currentIsUsed = false; + var nextDate = new Date(this.firstDay); + var tmpMonth = nextDate.getMonth(); + this.curMonth = new Date(nextDate); + this.curMonth.setDate(nextDate.getDate() + 6); + this.curMonth.setDate(1); + if (this.displayWeeks == "" || this.adjustWeeks) { + this.adjustWeeks = true; + this.displayWeeks = Math.ceil((dojo.date.getDaysInMonth(this.curMonth) + this._getAdjustedDay(this.curMonth)) / 7); + } + var days = this.displayWeeks * 7; + if (dojo.date.diff(this.startDate, this.endDate, dojo.date.dateParts.DAY) < days) { + this.staticDisplay = true; + if (dojo.date.diff(nextDate, this.endDate, dojo.date.dateParts.DAY) > days) { + this._preInitUI(this.startDate, true, false); + nextDate = new Date(this.firstDay); + } + this.curMonth = new Date(nextDate); + this.curMonth.setDate(nextDate.getDate() + 6); + this.curMonth.setDate(1); + var curClass = (nextDate.getMonth() == this.curMonth.getMonth()) ? "current" : "previous"; + } + if (initUI) { + this._initUI(days); + } +}, _initUI:function (days) { + dojo.dom.removeChildren(this.calendarDatesContainerNode); + for (var i = 0; i < this.displayWeeks; i++) { + this.calendarDatesContainerNode.appendChild(this.weekTemplate.cloneNode(true)); + } + var nextDate = new Date(this.firstDay); + this._setMonthLabel(this.curMonth.getMonth()); + this._setYearLabels(this.curMonth.getFullYear()); + var calendarNodes = this.calendarDatesContainerNode.getElementsByTagName("td"); + var calendarRows = this.calendarDatesContainerNode.getElementsByTagName("tr"); + var currentCalendarNode; + for (i = 0; i < days; i++) { + currentCalendarNode = calendarNodes.item(i); + currentCalendarNode.innerHTML = nextDate.getDate(); + currentCalendarNode.setAttribute("djDateValue", nextDate.valueOf()); + var curClass = (nextDate.getMonth() != this.curMonth.getMonth() && Number(nextDate) < Number(this.curMonth)) ? "previous" : (nextDate.getMonth() == this.curMonth.getMonth()) ? "current" : "next"; + var mappedClass = curClass; + if (this._isDisabledDate(nextDate)) { + var classMap = {previous:"disabledPrevious", current:"disabledCurrent", next:"disabledNext"}; + mappedClass = classMap[curClass]; + } + dojo.html.setClass(currentCalendarNode, this._getDateClassName(nextDate, mappedClass)); + if (dojo.html.hasClass(currentCalendarNode, this.classNames.selectedDate)) { + this.selectedNode = currentCalendarNode; + } + nextDate = dojo.date.add(nextDate, dojo.date.dateParts.DAY, 1); + } + this.lastDay = dojo.date.add(nextDate, dojo.date.dateParts.DAY, -1); + this._initControls(); +}, _initControls:function () { + var d = this.firstDay; + var d2 = this.lastDay; + var decWeek, incWeek, decMonth, incMonth, decYear, incYear; + decWeek = incWeek = decMonth = incMonth = decYear = incYear = !this.staticDisplay; + with (dojo.date.dateParts) { + var add = dojo.date.add; + if (decWeek && add(d, DAY, (-1 * (this._getAdjustedDay(d) + 1))) < this.startDate) { + decWeek = decMonth = decYear = false; + } + if (incWeek && d2 > this.endDate) { + incWeek = incMonth = incYear = false; + } + if (decMonth && add(d, DAY, -1) < this.startDate) { + decMonth = decYear = false; + } + if (incMonth && add(d2, DAY, 1) > this.endDate) { + incMonth = incYear = false; + } + if (decYear && add(d2, YEAR, -1) < this.startDate) { + decYear = false; + } + if (incYear && add(d, YEAR, 1) > this.endDate) { + incYear = false; + } + } + function enableControl(node, enabled) { + dojo.html.setVisibility(node, enabled ? "" : "hidden"); + } + enableControl(this.decreaseWeekNode, decWeek); + enableControl(this.increaseWeekNode, incWeek); + enableControl(this.decreaseMonthNode, decMonth); + enableControl(this.increaseMonthNode, incMonth); + enableControl(this.previousYearLabelNode, decYear); + enableControl(this.nextYearLabelNode, incYear); +}, _incrementWeek:function (evt) { + var d = new Date(this.firstDay); + switch (evt.target) { + case this.increaseWeekNode.getElementsByTagName("img").item(0): + case this.increaseWeekNode: + var tmpDate = dojo.date.add(d, dojo.date.dateParts.WEEK, 1); + if (tmpDate < this.endDate) { + d = dojo.date.add(d, dojo.date.dateParts.WEEK, 1); + } + break; + case this.decreaseWeekNode.getElementsByTagName("img").item(0): + case this.decreaseWeekNode: + if (d >= this.startDate) { + d = dojo.date.add(d, dojo.date.dateParts.WEEK, -1); + } + break; + } + this._preInitUI(d, true, true); +}, _incrementMonth:function (evt) { + var d = new Date(this.curMonth); + var tmpDate = new Date(this.firstDay); + switch (evt.currentTarget) { + case this.increaseMonthNode.getElementsByTagName("img").item(0): + case this.increaseMonthNode: + tmpDate = dojo.date.add(tmpDate, dojo.date.dateParts.DAY, this.displayWeeks * 7); + if (tmpDate < this.endDate) { + d = dojo.date.add(d, dojo.date.dateParts.MONTH, 1); + } else { + var revertToEndDate = true; + } + break; + case this.decreaseMonthNode.getElementsByTagName("img").item(0): + case this.decreaseMonthNode: + if (tmpDate > this.startDate) { + d = dojo.date.add(d, dojo.date.dateParts.MONTH, -1); + } else { + var revertToStartDate = true; + } + break; + } + if (revertToStartDate) { + d = new Date(this.startDate); + } else { + if (revertToEndDate) { + d = new Date(this.endDate); + } + } + this._preInitUI(d, false, true); +}, _incrementYear:function (evt) { + var year = this.curMonth.getFullYear(); + var tmpDate = new Date(this.firstDay); + switch (evt.target) { + case this.nextYearLabelNode: + tmpDate = dojo.date.add(tmpDate, dojo.date.dateParts.YEAR, 1); + if (tmpDate < this.endDate) { + year++; + } else { + var revertToEndDate = true; + } + break; + case this.previousYearLabelNode: + tmpDate = dojo.date.add(tmpDate, dojo.date.dateParts.YEAR, -1); + if (tmpDate > this.startDate) { + year--; + } else { + var revertToStartDate = true; + } + break; + } + var d; + if (revertToStartDate) { + d = new Date(this.startDate); + } else { + if (revertToEndDate) { + d = new Date(this.endDate); + } else { + d = new Date(year, this.curMonth.getMonth(), 1); + } + } + this._preInitUI(d, false, true); +}, onIncrementWeek:function (evt) { + evt.stopPropagation(); + if (!this.staticDisplay) { + this._incrementWeek(evt); + } +}, onIncrementMonth:function (evt) { + evt.stopPropagation(); + if (!this.staticDisplay) { + this._incrementMonth(evt); + } +}, onIncrementYear:function (evt) { + evt.stopPropagation(); + if (!this.staticDisplay) { + this._incrementYear(evt); + } +}, _setMonthLabel:function (monthIndex) { + this.monthLabelNode.innerHTML = dojo.date.getNames("months", "wide", "standAlone", this.lang)[monthIndex]; +}, _setYearLabels:function (year) { + var y = year - 1; + var that = this; + function f(n) { + that[n + "YearLabelNode"].innerHTML = dojo.date.format(new Date(y++, 0), {formatLength:"yearOnly", locale:that.lang}); + } + f("previous"); + f("current"); + f("next"); +}, _getDateClassName:function (date, monthState) { + var currentClassName = this.classNames[monthState]; + if ((!this.selectedIsUsed && this.value) && (Number(date) == Number(this.value))) { + currentClassName = this.classNames.selectedDate + " " + currentClassName; + this.selectedIsUsed = true; + } + if ((!this.currentIsUsed) && (Number(date) == Number(this.today))) { + currentClassName = currentClassName + " " + this.classNames.currentDate; + this.currentIsUsed = true; + } + return currentClassName; +}, onClick:function (evt) { + dojo.event.browser.stopEvent(evt); +}, _handleUiClick:function (evt) { + var eventTarget = evt.target; + if (eventTarget.nodeType != dojo.dom.ELEMENT_NODE) { + eventTarget = eventTarget.parentNode; + } + dojo.event.browser.stopEvent(evt); + this.selectedIsUsed = this.todayIsUsed = false; + if (dojo.html.hasClass(eventTarget, this.classNames["disabledPrevious"]) || dojo.html.hasClass(eventTarget, this.classNames["disabledCurrent"]) || dojo.html.hasClass(eventTarget, this.classNames["disabledNext"])) { + return; + } + this.clickedNode = eventTarget; + this.setDate(new Date(Number(dojo.html.getAttribute(eventTarget, "djDateValue")))); +}, onValueChanged:function (date) { +}, _isDisabledDate:function (dateObj) { + if (dateObj < this.startDate || dateObj > this.endDate) { + return true; + } + return this.isDisabledDate(dateObj, this.lang); +}, isDisabledDate:function (dateObj, locale) { + return false; +}, _initFirstDay:function (dateObj, adj) { + var d = new Date(dateObj); + if (!adj) { + d.setDate(1); + } + d.setDate(d.getDate() - this._getAdjustedDay(d, this.weekStartsOn)); + d.setHours(0, 0, 0, 0); + return d; +}, _getAdjustedDay:function (dateObj) { + var days = [0, 1, 2, 3, 4, 5, 6]; + if (this.weekStartsOn > 0) { + for (var i = 0; i < this.weekStartsOn; i++) { + days.unshift(days.pop()); + } + } + return days[dateObj.getDay()]; +}, destroy:function () { + dojo.widget.DatePicker.superclass.destroy.apply(this, arguments); + dojo.html.destroyNode(this.weekTemplate); +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DatePicker.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DatePicker.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DatePicker.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DateTextbox.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DateTextbox.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DateTextbox.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DateTextbox.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,47 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + + + +dojo.provide("dojo.widget.DateTextbox"); +dojo.require("dojo.widget.ValidationTextbox"); +dojo.require("dojo.date.format"); +dojo.require("dojo.validate.datetime"); +dojo.widget.defineWidget("dojo.widget.DateTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) { + dojo.widget.DateTextbox.superclass.mixInProperties.apply(this, arguments); + if (localProperties.format) { + this.flags.format = localProperties.format; + } +}, isValid:function () { + if (this.flags.format) { + dojo.deprecated("dojo.widget.DateTextbox", "format attribute is deprecated; use displayFormat or formatLength instead", "0.5"); + return dojo.validate.isValidDate(this.textbox.value, this.flags.format); + } + return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"dateOnly", locale:this.lang, datePattern:this.displayFormat}); +}}); +dojo.widget.defineWidget("dojo.widget.TimeTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) { + dojo.widget.TimeTextbox.superclass.mixInProperties.apply(this, arguments); + if (localProperties.format) { + this.flags.format = localProperties.format; + } + if (localProperties.amsymbol) { + this.flags.amSymbol = localProperties.amsymbol; + } + if (localProperties.pmsymbol) { + this.flags.pmSymbol = localProperties.pmsymbol; + } +}, isValid:function () { + if (this.flags.format) { + dojo.deprecated("dojo.widget.TimeTextbox", "format attribute is deprecated; use displayFormat or formatLength instead", "0.5"); + return dojo.validate.isValidTime(this.textbox.value, this.flags); + } + return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"timeOnly", locale:this.lang, timePattern:this.displayFormat}); +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DateTextbox.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DateTextbox.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DateTextbox.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DebugConsole.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DebugConsole.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DebugConsole.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DebugConsole.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,23 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + + + +dojo.provide("dojo.widget.DebugConsole"); +dojo.require("dojo.widget.Widget"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.FloatingPane"); +dojo.widget.defineWidget("dojo.widget.DebugConsole", dojo.widget.FloatingPane, {fillInTemplate:function () { + dojo.widget.DebugConsole.superclass.fillInTemplate.apply(this, arguments); + this.containerNode.id = "debugConsoleClientPane"; + djConfig.isDebug = true; + djConfig.debugContainerId = this.containerNode.id; +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DebugConsole.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DebugConsole.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DebugConsole.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Dialog.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Dialog.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Dialog.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Dialog.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,300 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + + + +dojo.provide("dojo.widget.Dialog"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.ContentPane"); +dojo.require("dojo.event.*"); +dojo.require("dojo.gfx.color"); +dojo.require("dojo.html.layout"); +dojo.require("dojo.html.display"); +dojo.require("dojo.html.iframe"); +dojo.declare("dojo.widget.ModalDialogBase", null, {isContainer:true, focusElement:"", bgColor:"black", bgOpacity:0.4, followScroll:true, closeOnBackgroundClick:false, trapTabs:function (e) { + if (e.target == this.tabStartOuter) { + if (this._fromTrap) { + this.tabStart.focus(); + this._fromTrap = false; + } else { + this._fromTrap = true; + this.tabEnd.focus(); + } + } else { + if (e.target == this.tabStart) { + if (this._fromTrap) { + this._fromTrap = false; + } else { + this._fromTrap = true; + this.tabEnd.focus(); + } + } else { + if (e.target == this.tabEndOuter) { + if (this._fromTrap) { + this.tabEnd.focus(); + this._fromTrap = false; + } else { + this._fromTrap = true; + this.tabStart.focus(); + } + } else { + if (e.target == this.tabEnd) { + if (this._fromTrap) { + this._fromTrap = false; + } else { + this._fromTrap = true; + this.tabStart.focus(); + } + } + } + } + } +}, clearTrap:function (e) { + var _this = this; + setTimeout(function () { + _this._fromTrap = false; + }, 100); +}, postCreate:function () { + with (this.domNode.style) { + position = "absolute"; + zIndex = 999; + display = "none"; + overflow = "visible"; + } + var b = dojo.body(); + b.appendChild(this.domNode); + this.bg = document.createElement("div"); + this.bg.className = "dialogUnderlay"; + with (this.bg.style) { + position = "absolute"; + left = top = "0px"; + zIndex = 998; + display = "none"; + } + b.appendChild(this.bg); + this.setBackgroundColor(this.bgColor); + this.bgIframe = new dojo.html.BackgroundIframe(); + if (this.bgIframe.iframe) { + with (this.bgIframe.iframe.style) { + position = "absolute"; + left = top = "0px"; + zIndex = 90; + display = "none"; + } + } + if (this.closeOnBackgroundClick) { + dojo.event.kwConnect({srcObj:this.bg, srcFunc:"onclick", adviceObj:this, adviceFunc:"onBackgroundClick", once:true}); + } +}, uninitialize:function () { + this.bgIframe.remove(); + dojo.html.removeNode(this.bg, true); +}, setBackgroundColor:function (color) { + if (arguments.length >= 3) { + color = new dojo.gfx.color.Color(arguments[0], arguments[1], arguments[2]); + } else { + color = new dojo.gfx.color.Color(color); + } + this.bg.style.backgroundColor = color.toString(); + return this.bgColor = color; +}, setBackgroundOpacity:function (op) { + if (arguments.length == 0) { + op = this.bgOpacity; + } + dojo.html.setOpacity(this.bg, op); + try { + this.bgOpacity = dojo.html.getOpacity(this.bg); + } + catch (e) { + this.bgOpacity = op; + } + return this.bgOpacity; +}, _sizeBackground:function () { + if (this.bgOpacity > 0) { + var viewport = dojo.html.getViewport(); + var h = viewport.height; + var w = viewport.width; + with (this.bg.style) { + width = w + "px"; + height = h + "px"; + } + var scroll_offset = dojo.html.getScroll().offset; + this.bg.style.top = scroll_offset.y + "px"; + this.bg.style.left = scroll_offset.x + "px"; + var viewport = dojo.html.getViewport(); + if (viewport.width != w) { + this.bg.style.width = viewport.width + "px"; + } + if (viewport.height != h) { + this.bg.style.height = viewport.height + "px"; + } + } + this.bgIframe.size(this.bg); +}, _showBackground:function () { + if (this.bgOpacity > 0) { + this.bg.style.display = "block"; + } + if (this.bgIframe.iframe) { + this.bgIframe.iframe.style.display = "block"; + } +}, placeModalDialog:function () { + var scroll_offset = dojo.html.getScroll().offset; + var viewport_size = dojo.html.getViewport(); + var mb; + if (this.isShowing()) { + mb = dojo.html.getMarginBox(this.domNode); + } else { + dojo.html.setVisibility(this.domNode, false); + dojo.html.show(this.domNode); + mb = dojo.html.getMarginBox(this.domNode); + dojo.html.hide(this.domNode); + dojo.html.setVisibility(this.domNode, true); + } + var x = scroll_offset.x + (viewport_size.width - mb.width) / 2; + var y = scroll_offset.y + (viewport_size.height - mb.height) / 2; + with (this.domNode.style) { + left = x + "px"; + top = y + "px"; + } +}, _onKey:function (evt) { + if (evt.key) { + var node = evt.target; + while (node != null) { + if (node == this.domNode) { + return; + } + node = node.parentNode; + } + if (evt.key != evt.KEY_TAB) { + dojo.event.browser.stopEvent(evt); + } else { + if (!dojo.render.html.opera) { + try { + this.tabStart.focus(); + } + catch (e) { + } + } + } + } +}, showModalDialog:function () { + if (this.followScroll && !this._scrollConnected) { + this._scrollConnected = true; + dojo.event.connect(window, "onscroll", this, "_onScroll"); + } + dojo.event.connect(document.documentElement, "onkey", this, "_onKey"); + this.placeModalDialog(); + this.setBackgroundOpacity(); + this._sizeBackground(); + this._showBackground(); + this._fromTrap = true; + setTimeout(dojo.lang.hitch(this, function () { + try { + this.tabStart.focus(); + } + catch (e) { + } + }), 50); +}, hideModalDialog:function () { + if (this.focusElement) { + dojo.byId(this.focusElement).focus(); + dojo.byId(this.focusElement).blur(); + } + this.bg.style.display = "none"; + this.bg.style.width = this.bg.style.height = "1px"; + if (this.bgIframe.iframe) { + this.bgIframe.iframe.style.display = "none"; + } + dojo.event.disconnect(document.documentElement, "onkey", this, "_onKey"); + if (this._scrollConnected) { + this._scrollConnected = false; + dojo.event.disconnect(window, "onscroll", this, "_onScroll"); + } +}, _onScroll:function () { + var scroll_offset = dojo.html.getScroll().offset; + this.bg.style.top = scroll_offset.y + "px"; + this.bg.style.left = scroll_offset.x + "px"; + this.placeModalDialog(); +}, checkSize:function () { + if (this.isShowing()) { + this._sizeBackground(); + this.placeModalDialog(); + this.onResized(); + } +}, onBackgroundClick:function () { + if (this.lifetime - this.timeRemaining >= this.blockDuration) { + return; + } + this.hide(); +}}); +dojo.widget.defineWidget("dojo.widget.Dialog", [dojo.widget.ContentPane, dojo.widget.ModalDialogBase], {templateString:"
\n\t\n\t\n\t
\n\t\n\t\n
\n", blockDuration:0, lifetime:0, closeNode:"", postMixInProperties:function () { + dojo.widget.Dialog.superclass.postMixInProperties.apply(this, arguments); + if (this.closeNode) { + this.setCloseControl(this.closeNode); + } +}, postCreate:function () { + dojo.widget.Dialog.superclass.postCreate.apply(this, arguments); + dojo.widget.ModalDialogBase.prototype.postCreate.apply(this, arguments); +}, show:function () { + if (this.lifetime) { + this.timeRemaining = this.lifetime; + if (this.timerNode) { + this.timerNode.innerHTML = Math.ceil(this.timeRemaining / 1000); + } + if (this.blockDuration && this.closeNode) { + if (this.lifetime > this.blockDuration) { + this.closeNode.style.visibility = "hidden"; + } else { + this.closeNode.style.display = "none"; + } + } + if (this.timer) { + clearInterval(this.timer); + } + this.timer = setInterval(dojo.lang.hitch(this, "_onTick"), 100); + } + this.showModalDialog(); + dojo.widget.Dialog.superclass.show.call(this); +}, onLoad:function () { + this.placeModalDialog(); + dojo.widget.Dialog.superclass.onLoad.call(this); +}, fillInTemplate:function () { +}, hide:function () { + this.hideModalDialog(); + dojo.widget.Dialog.superclass.hide.call(this); + if (this.timer) { + clearInterval(this.timer); + } +}, setTimerNode:function (node) { + this.timerNode = node; +}, setCloseControl:function (node) { + this.closeNode = dojo.byId(node); + dojo.event.connect(this.closeNode, "onclick", this, "hide"); +}, setShowControl:function (node) { + node = dojo.byId(node); + dojo.event.connect(node, "onclick", this, "show"); +}, _onTick:function () { + if (this.timer) { + this.timeRemaining -= 100; + if (this.lifetime - this.timeRemaining >= this.blockDuration) { + if (this.closeNode) { + this.closeNode.style.visibility = "visible"; + } + } + if (!this.timeRemaining) { + clearInterval(this.timer); + this.hide(); + } else { + if (this.timerNode) { + this.timerNode.innerHTML = Math.ceil(this.timeRemaining / 1000); + } + } + } +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Dialog.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Dialog.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Dialog.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DocPane.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DocPane.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DocPane.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DocPane.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,262 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + + + +dojo.provide("dojo.widget.DocPane"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.io.*"); +dojo.require("dojo.event.*"); +dojo.require("dojo.widget.HtmlWidget"); +dojo.require("dojo.widget.Editor2"); +dojo.require("dojo.widget.Dialog"); +dojo.require("dojo.html.common"); +dojo.require("dojo.html.display"); +dojo.widget.DocPane = function () { + dojo.event.topic.subscribe("/docs/function/results", this, "onDocResults"); + dojo.event.topic.subscribe("/docs/package/results", this, "onPkgResults"); + dojo.event.topic.subscribe("/docs/function/detail", this, "onDocSelectFunction"); +}; +dojo.widget.defineWidget("dojo.widget.DocPane", dojo.widget.HtmlWidget, {dialog:null, dialogBg:null, dialogFg:null, logIn:null, edit:null, save:null, cancel:null, detail:null, result:null, packag:null, fn:null, fnLink:null, count:null, row:null, summary:null, description:null, variables:null, vRow:null, vLink:null, vDesc:null, methods:null, mRow:null, mLink:null, mDesc:null, requires:null, rRow:null, rRow2:null, rH3:null, rLink:null, parameters:null, pRow:null, pLink:null, pDesc:null, pOpt:null, pType:null, sType:null, sName:null, sParams:null, sPType:null, sPTypeSave:null, sPName:null, sPNameSave:null, pkgDescription:null, _appends:[], templateString:"
\n\t
\n\n\t
\n\t\t
\n\t\t\t
\n\t\t\t\t

Log In

\n\t\t\t\t

\n\t\t\t\t

\n\t\t\t\t

\n\t\t\t\t

\n\t\t\t
\n\t\t
\n\t
\n\n\t
Detail | Source | Examples | Walkthrough
\n\n\t
\n\t\t

Detail: dojo.select

\n\t\t
Description
\n\t\t
\n\t\t\t

Parameters

\n\t\t\t
\n\t\t\t\toptional \n\t\t\t\ttype \n\t\t\t\tvariable\n\t\t\t\t - \n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t

Variables

\n\t\t\t
\n\t\t\t\tvariable - \n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t

Signature

\n\t\t\t
\n\t\t\t\treturnType \n\t\t\t\tfoo\n\t\t\t\t(\n\t\t\t\t\ttype \n\t\t\t\t\tparamName\n\t\t\t\t)\n \t\t\t
\n\t\t
\n\t
\n\t\n\t
\n\t\t

Search Results: 0 matches

\n\t\t
\n\t\t\tdojo.fnLink\n\t\t\t - summary\n\t\t
\n\t
\n\n\t
\n\t\t

Package: \n\t\t\tdojo.package \n\t\t\t[edit] \n\t\t\t[save]\n\t\t

\n\t\t
Description
\n\t\t
\n\t\t\t

Methods

\n\t\t\t
\n\t\t\t\tmethod\n\t\t\t\t - \n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t

Requires

\n\t\t\t
\n\t\t\t\t

Environment

\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t
\n
\n", templateCssString:".dojoDocPane { padding:1em; font: 1em Georgia,Times,\"Times New Roman\",serif; }\n\n.dojoDocPane .container{ }\n\n.dojoDocPane .dialog{ }\n.dojoDocPane .dialog .container{ padding: 0.5em; background: #fff; border: 2px solid #333; }\n.dojoDocPane .dialog .docDialog{ background: transparent; width: 20em; }\n.dojoDocPane .dialog .docDialog h2{ margin-top: 0; padding-top: 0; }\n.dojoDocPane .dialog .docDialog input { float: right; margin-right: 1em; }\n.dojoDocPane .dialog .docDialog p{ clear: both; }\n#dojoDocUserName, #do joDocPassword { width: 10em; }\n\n.dojoDocPane .nav{ }\n.dojoDocPane .nav span{ }\n\n.dojoDocPane .detail{ }\n.dojoDocPane .detail h1{ }\n.dojoDocPane .detail h1 span.fn{ }\n.dojoDocPane .detail .description{ }\n.dojoDocPane .detail .params{ }\n.dojoDocPane .detail .params .row{ }\n.dojoDocPane .detail .params .row span{ }\n.dojoDocPane .detail .variables{ }\n.dojoDocPane .detail .variables .row{ }\n.dojoDocPane .detail .signature{ }\n.dojoDocPane .detail .signature .source{ white-space: pre; font: 0.8em Monaco, Courier, \"Courier New\", monospace; }\n.dojoDocPane .detail .signature .source .return{ color:#369; }\n.dojoDocPane .detail .signature .source .function{ color: #98543F; font-weight: bold; }\n.dojoDocPane .detail .signature .source .params{ }\n.dojoDocPane .detail .signature .source .params .type{ font-style: italic; color: #d17575; }\n.dojoDocPane .detail .signature .source .params .name{ color: #d14040; }\n\n.dojoDocPane .result{ }\n.dojoDocPane .result h1{ }\n.do joDocPane .result .row{ }\n.dojoDocPane .result .row .summary{ }\n\n.dojoDocPane .package{ }\n.dojoDocPane .package h1{ }\n.dojoDocPane .package .row{ }\n.dojoDocPane .package .row .summary{ }\n.dojoDocPane .package .description{ }\n.dojoDocPane .package .methods{ }\n.dojoDocPane .package .methods h2{ }\n.dojoDocPane .package .methods .row{ }\n.dojoDocPane .package .methods .row .description{ }\n.dojoDocPane .package .requires{ }\n.dojoDocPane .package .requires h2{ }\n.dojoDocPane .package .requires .row{ }\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/DocPane.css"), isContainer:true, fillInTemplate:function () { + this.requires = dojo.html.removeNode(this.requires); + this.rRow.style.display = "none"; + this.rRow2.style.display = "none"; + this.methods = dojo.html.removeNode(this.methods); + this.mRow.style.display = "none"; + this.dialog = dojo.widget.createWidget("dialog", {}, this.dialog); + this.dialog.setCloseControl(this.cancel); + dojo.html.setOpacity(this.dialogBg, 0.8); + dojo.html.setOpacity(this.dialogFg, 1); + dojo.event.connect(this.edit, "onclick", dojo.lang.hitch(this, function () { + if (!this._isLoggedIn) { + this.dialog.show(); + } + })); + dojo.event.connect(this.logIn, "onclick", this, "_logIn"); + dojo.event.connect(this.save, "onclick", this, "_save"); + dojo.event.connect(dojo.docs, "logInSuccess", this, "_loggedIn"); + this.homeSave = this.containerNode.cloneNode(true); + this.detailSave = dojo.html.removeNode(this.detail); + this.resultSave = dojo.html.removeNode(this.result); + this.packageSave = dojo.html.removeNode(this.packag); + this.results = dojo.html.removeNode(this.results); + this.rowParent = this.row.parentNode; + this.rowSave = dojo.html.removeNode(this.row); + this.vParent = this.vRow.parentNode; + this.vSave = dojo.html.removeNode(this.vRow); + this.pParent = this.pRow.parentNode; + this.pSave = dojo.html.removeNode(this.pRow); + this.sPTypeSave = dojo.html.removeNode(this.sPType); + this.sPNameSave = dojo.html.removeNode(this.sPName); + this.navSave = dojo.html.removeNode(this.nav); +}, _logIn:function () { + dojo.docs.setUserName(this.userName.value); + dojo.docs.setPassword(this.password.value); +}, _loggedIn:function () { + this._isLoggedIn = true; + this.dialog.hide(); + this.pkgEditor = dojo.widget.createWidget("editor2", {toolbarAlwaysVisible:true}, this.pkgDescription); +}, _save:function () { + if (this.pkgEditor) { + dojo.docs.savePackage(this._pkgPath, {description:this.pkgEditor.getEditorContent()}); + } +}, onDocSelectFunction:function (message) { + dojo.debug("onDocSelectFunction()"); + for (var key in message) { + dojo.debug(key + ": " + dojo.json.serialize(message[key])); + } + var meta = message.meta; + if (meta) { + var variables = meta.variables; + var this_variables = meta.this_variables; + var child_variables = meta.child_variables; + var parameters = meta.parameters; + } + var doc = message.doc; + dojo.debug(dojo.json.serialize(doc)); + var appends = this._appends; + dojo.html.removeChildren(this.domNode); + this.fn.innerHTML = message.name; + this.variables.style.display = "block"; + var all = []; + if (variables) { + all = variables; + } + if (this_variables) { + all = all.concat(this_variables); + } + if (child_variables) { + all = all.concat(child_variables); + } + if (!all.length) { + this.variables.style.display = "none"; + } else { + for (var i = 0, one; one = all[i]; i++) { + this.vLink.innerHTML = one; + this.vDesc.parentNode.style.display = "none"; + appends.push(this.vParent.appendChild(this.vSave.cloneNode(true))); + } + } + this.sParams.innerHTML = ""; + var first = true; + for (var param in parameters) { + var paramType = parameters[param].type; + var paramSummary = parameters[param].summary; + var paramName = param; + this.parameters.style.display = "block"; + this.pLink.innerHTML = paramName; + this.pOpt.style.display = "none"; + if (parameters[param].opt) { + this.pOpt.style.display = "inline"; + } + this.pType.parentNode.style.display = "none"; + if (parameters[param][0]) { + this.pType.parentNode.style.display = "inline"; + this.pType.innerHTML = paramType; + } + this.pDesc.parentNode.style.display = "none"; + if (paramSummary) { + this.pDesc.parentNode.style.display = "inline"; + this.pDesc.innerHTML = paramSummary; + } + appends.push(this.pParent.appendChild(this.pSave.cloneNode(true))); + if (!first) { + this.sParams.appendChild(document.createTextNode(", ")); + } + first = false; + if (paramType) { + dojo.debug(this.sPTypeSave); + this.sPTypeSave.innerHTML = paramType; + this.sParams.appendChild(this.sPTypeSave.cloneNode(true)); + this.sParams.appendChild(document.createTextNode(" ")); + } + dojo.debug(this.sPNameSave); + this.sPNameSave.innerHTML = paramName; + this.sParams.appendChild(this.sPNameSave.cloneNode(true)); + } + if (message.returns) { + this.sType.innerHTML = message.returns; + } else { + this.sType.innerHTML = "void"; + } + this.sName.innerHTML = message.name; + this.domNode.appendChild(this.navSave); + this.domNode.appendChild(this.detailSave.cloneNode(true)); + for (var i = 0, append; append = appends[i]; i++) { + dojo.html.removeNode(append); + } +}, onPkgResult:function (results) { + if (this.pkgEditor) { + this.pkgEditor.close(true); + dojo.debug(this.pkgDescription); + } + var methods = results.methods; + var requires = results.requires; + var description = results.description; + this._pkgPath = results.path; + var requireLinks = []; + var appends = this._appends; + while (appends.length) { + dojo.html.removeNode(appends.shift()); + } + dojo.html.removeChildren(this.domNode); + this.pkg.innerHTML = results.pkg; + var hasRequires = false; + for (var env in requires) { + hasRequires = true; + this.rH3.style.display = "none"; + if (env != "common") { + this.rH3.style.display = ""; + this.rH3.innerHTML = env; + } + for (var i = 0, require; require = requires[env][i]; i++) { + requireLinks.push({name:require}); + this.rLink.innerHTML = require; + this.rLink.href = "#" + require; + var rRow2 = this.rRow2.parentNode.insertBefore(this.rRow2.cloneNode(true), this.rRow2); + rRow2.style.display = ""; + appends.push(rRow2); + } + var rRow = this.rRow.parentNode.insertBefore(this.rRow.cloneNode(true), this.rRow); + rRow.style.display = ""; + appends.push(rRow); + } + if (hasRequires) { + appends.push(this.packageSave.appendChild(this.requires.cloneNode(true))); + } + if (results.size) { + for (var i = 0, method; method = methods[i]; i++) { + this.mLink.innerHTML = method.name; + this.mLink.href = "#" + method.name; + this.mDesc.parentNode.style.display = "none"; + if (method.summary) { + this.mDesc.parentNode.style.display = "inline"; + this.mDesc.innerHTML = method.summary; + } + var mRow = this.mRow.parentNode.insertBefore(this.mRow.cloneNode(true), this.mRow); + mRow.style.display = ""; + appends.push(mRow); + } + appends.push(this.packageSave.appendChild(this.methods.cloneNode(true))); + } + this.domNode.appendChild(this.packageSave); + this.pkgDescription.innerHTML = description; + function makeSelect(fOrP, x) { + return function (e) { + dojo.event.topic.publish("/docs/" + fOrP + "/select", x); + }; + } + var as = this.domNode.getElementsByTagName("a"); + for (var i = 0, a; a = as[i]; i++) { + if (a.className == "docMLink") { + dojo.event.connect(a, "onclick", makeSelect("function", methods[i])); + } else { + if (a.className == "docRLink") { + dojo.event.connect(a, "onclick", makeSelect("package", requireLinks[i])); + } + } + } +}, onDocResults:function (fns) { + dojo.debug("onDocResults(): called"); + if (fns.length == 1) { + dojo.event.topic.publish("/docs/function/select", fns[0]); + return; + } + dojo.html.removeChildren(this.domNode); + this.count.innerHTML = fns.length; + var appends = []; + for (var i = 0, fn; fn = fns[i]; i++) { + this.fnLink.innerHTML = fn.name; + this.fnLink.href = "#" + fn.name; + if (fn.id) { + this.fnLink.href = this.fnLink.href + "," + fn.id; + } + this.summary.parentNode.style.display = "none"; + if (fn.summary) { + this.summary.parentNode.style.display = "inline"; + this.summary.innerHTML = fn.summary; + } + appends.push(this.rowParent.appendChild(this.rowSave.cloneNode(true))); + } + function makeSelect(x) { + return function (e) { + dojo.event.topic.publish("/docs/function/select", x); + }; + } + this.domNode.appendChild(this.resultSave.cloneNode(true)); + var as = this.domNode.getElementsByTagName("a"); + for (var i = 0, a; a = as[i]; i++) { + dojo.event.connect(a, "onclick", makeSelect(fns[i])); + } + for (var i = 0, append; append = appends[i]; i++) { + this.rowParent.removeChild(append); + } +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DocPane.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DocPane.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DocPane.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DomWidget.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DomWidget.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DomWidget.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DomWidget.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,507 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + + + +dojo.provide("dojo.widget.DomWidget"); +dojo.require("dojo.event.*"); +dojo.require("dojo.widget.Widget"); +dojo.require("dojo.dom"); +dojo.require("dojo.html.style"); +dojo.require("dojo.xml.Parse"); +dojo.require("dojo.uri.*"); +dojo.require("dojo.lang.func"); +dojo.require("dojo.lang.extras"); +dojo.widget._cssFiles = {}; +dojo.widget._cssStrings = {}; +dojo.widget._templateCache = {}; +dojo.widget.defaultStrings = {dojoRoot:dojo.hostenv.getBaseScriptUri(), dojoWidgetModuleUri:dojo.uri.moduleUri("dojo.widget"), baseScriptUri:dojo.hostenv.getBaseScriptUri()}; +dojo.widget.fillFromTemplateCache = function (obj, templatePath, templateString, avoidCache) { + var tpath = templatePath || obj.templatePath; + var tmplts = dojo.widget._templateCache; + if (!tpath && !obj["widgetType"]) { + do { + var dummyName = "__dummyTemplate__" + dojo.widget._templateCache.dummyCount++; + } while (tmplts[dummyName]); + obj.widgetType = dummyName; + } + var wt = tpath ? tpath.toString() : obj.widgetType; + var ts = tmplts[wt]; + if (!ts) { + tmplts[wt] = {"string":null, "node":null}; + if (avoidCache) { + ts = {}; + } else { + ts = tmplts[wt]; + } + } + if ((!obj.templateString) && (!avoidCache)) { + obj.templateString = templateString || ts["string"]; + } + if (obj.templateString) { + obj.templateString = this._sanitizeTemplateString(obj.templateString); + } + if ((!obj.templateNode) && (!avoidCache)) { + obj.templateNode = ts["node"]; + } + if ((!obj.templateNode) && (!obj.templateString) && (tpath)) { + var tstring = this._sanitizeTemplateString(dojo.hostenv.getText(tpath)); + obj.templateString = tstring; + if (!avoidCache) { + tmplts[wt]["string"] = tstring; + } + } + if ((!ts["string"]) && (!avoidCache)) { + ts.string = obj.templateString; + } +}; +dojo.widget._sanitizeTemplateString = function (tString) { + if (tString) { + tString = tString.replace(/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, ""); + var matches = tString.match(/]*>\s*([\s\S]+)\s*<\/body>/im); + if (matches) { + tString = matches[1]; + } + } else { + tString = ""; + } + return tString; +}; +dojo.widget._templateCache.dummyCount = 0; +dojo.widget.attachProperties = ["dojoAttachPoint", "id"]; +dojo.widget.eventAttachProperty = "dojoAttachEvent"; +dojo.widget.onBuildProperty = "dojoOnBuild"; +dojo.widget.waiNames = ["waiRole", "waiState"]; +dojo.widget.wai = {waiRole:{name:"waiRole", "namespace":"http://www.w3.org/TR/xhtml2", alias:"x2", prefix:"wairole:"}, waiState:{name:"waiState", "namespace":"http://www.w3.org/2005/07/aaa", alias:"aaa", prefix:""}, setAttr:function (node, ns, attr, value) { + if (dojo.render.html.ie) { + node.setAttribute(this[ns].alias + ":" + attr, this[ns].prefix + value); + } else { + node.setAttributeNS(this[ns]["namespace"], attr, this[ns].prefix + value); + } +}, getAttr:function (node, ns, attr) { + if (dojo.render.html.ie) { + return node.getAttribute(this[ns].alias + ":" + attr); + } else { + return node.getAttributeNS(this[ns]["namespace"], attr); + } +}, removeAttr:function (node, ns, attr) { + var success = true; + if (dojo.render.html.ie) { + success = node.removeAttribute(this[ns].alias + ":" + attr); + } else { + node.removeAttributeNS(this[ns]["namespace"], attr); + } + return success; +}}; +dojo.widget.attachTemplateNodes = function (rootNode, targetObj, events) { + var elementNodeType = dojo.dom.ELEMENT_NODE; + function trim(str) { + return str.replace(/^\s+|\s+$/g, ""); + } + if (!rootNode) { + rootNode = targetObj.domNode; + } + if (rootNode.nodeType != elementNodeType) { + return; + } + var nodes = rootNode.all || rootNode.getElementsByTagName("*"); + var _this = targetObj; + for (var x = -1; x < nodes.length; x++) { + var baseNode = (x == -1) ? rootNode : nodes[x]; + var attachPoint = []; + if (!targetObj.widgetsInTemplate || !baseNode.getAttribute("dojoType")) { + for (var y = 0; y < this.attachProperties.length; y++) { + var tmpAttachPoint = baseNode.getAttribute(this.attachProperties[y]); + if (tmpAttachPoint) { + attachPoint = tmpAttachPoint.split(";"); + for (var z = 0; z < attachPoint.length; z++) { + if (dojo.lang.isArray(targetObj[attachPoint[z]])) { + targetObj[attachPoint[z]].push(baseNode); + } else { + targetObj[attachPoint[z]] = baseNode; + } + } + break; + } + } + var attachEvent = baseNode.getAttribute(this.eventAttachProperty); + if (attachEvent) { + var evts = attachEvent.split(";"); + for (var y = 0; y < evts.length; y++) { + if ((!evts[y]) || (!evts[y].length)) { + continue; + } + var thisFunc = null; + var tevt = trim(evts[y]); + if (evts[y].indexOf(":") >= 0) { + var funcNameArr = tevt.split(":"); + tevt = trim(funcNameArr[0]); + thisFunc = trim(funcNameArr[1]); + } + if (!thisFunc) { + thisFunc = tevt; + } + var tf = function () { + var ntf = new String(thisFunc); + return function (evt) { + if (_this[ntf]) { + _this[ntf](dojo.event.browser.fixEvent(evt, this)); + } + }; + }(); + dojo.event.browser.addListener(baseNode, tevt, tf, false, true); + } + } + for (var y = 0; y < events.length; y++) { + var evtVal = baseNode.getAttribute(events[y]); + if ((evtVal) && (evtVal.length)) { + var thisFunc = null; + var domEvt = events[y].substr(4); + thisFunc = trim(evtVal); + var funcs = [thisFunc]; + if (thisFunc.indexOf(";") >= 0) { + funcs = dojo.lang.map(thisFunc.split(";"), trim); + } + for (var z = 0; z < funcs.length; z++) { + if (!funcs[z].length) { + continue; + } + var tf = function () { + var ntf = new String(funcs[z]); + return function (evt) { + if (_this[ntf]) { + _this[ntf](dojo.event.browser.fixEvent(evt, this)); + } + }; + }(); + dojo.event.browser.addListener(baseNode, domEvt, tf, false, true); + } + } + } + } + var tmpltPoint = baseNode.getAttribute(this.templateProperty); + if (tmpltPoint) { + targetObj[tmpltPoint] = baseNode; + } + dojo.lang.forEach(dojo.widget.waiNames, function (name) { + var wai = dojo.widget.wai[name]; + var val = baseNode.getAttribute(wai.name); + if (val) { + if (val.indexOf("-") == -1) { + dojo.widget.wai.setAttr(baseNode, wai.name, "role", val); + } else { + var statePair = val.split("-"); + dojo.widget.wai.setAttr(baseNode, wai.name, statePair[0], statePair[1]); + } + } + }, this); + var onBuild = baseNode.getAttribute(this.onBuildProperty); + if (onBuild) { + eval("var node = baseNode; var widget = targetObj; " + onBuild); + } + } +}; +dojo.widget.getDojoEventsFromStr = function (str) { + var re = /(dojoOn([a-z]+)(\s?))=/gi; + var evts = str ? str.match(re) || [] : []; + var ret = []; + var lem = {}; + for (var x = 0; x < evts.length; x++) { + if (evts[x].length < 1) { + continue; + } + var cm = evts[x].replace(/\s/, ""); + cm = (cm.slice(0, cm.length - 1)); + if (!lem[cm]) { + lem[cm] = true; + ret.push(cm); + } + } + return ret; +}; +dojo.declare("dojo.widget.DomWidget", dojo.widget.Widget, function () { + if ((arguments.length > 0) && (typeof arguments[0] == "object")) { + this.create(arguments[0]); + } +}, {templateNode:null, templateString:null, templateCssString:null, preventClobber:false, domNode:null, containerNode:null, widgetsInTemplate:false, addChild:function (widget, overrideContainerNode, pos, ref, insertIndex) { + if (!this.isContainer) { + dojo.debug("dojo.widget.DomWidget.addChild() attempted on non-container widget"); + return null; + } else { + if (insertIndex == undefined) { + insertIndex = this.children.length; + } + this.addWidgetAsDirectChild(widget, overrideContainerNode, pos, ref, insertIndex); + this.registerChild(widget, insertIndex); + } + return widget; +}, addWidgetAsDirectChild:function (widget, overrideContainerNode, pos, ref, insertIndex) { + if ((!this.containerNode) && (!overrideContainerNode)) { + this.containerNode = this.domNode; + } + var cn = (overrideContainerNode) ? overrideContainerNode : this.containerNode; + if (!pos) { + pos = "after"; + } + if (!ref) { + if (!cn) { + cn = dojo.body(); + } + ref = cn.lastChild; + } + if (!insertIndex) { + insertIndex = 0; + } + widget.domNode.setAttribute("dojoinsertionindex", insertIndex); + if (!ref) { + cn.appendChild(widget.domNode); + } else { + if (pos == "insertAtIndex") { + dojo.dom.insertAtIndex(widget.domNode, ref.parentNode, insertIndex); + } else { + if ((pos == "after") && (ref === cn.lastChild)) { + cn.appendChild(widget.domNode); + } else { + dojo.dom.insertAtPosition(widget.domNode, cn, pos); + } + } + } +}, registerChild:function (widget, insertionIndex) { + widget.dojoInsertionIndex = insertionIndex; + var idx = -1; + for (var i = 0; i < this.children.length; i++) { + if (this.children[i].dojoInsertionIndex <= insertionIndex) { + idx = i; + } + } + this.children.splice(idx + 1, 0, widget); + widget.parent = this; + widget.addedTo(this, idx + 1); + delete dojo.widget.manager.topWidgets[widget.widgetId]; +}, removeChild:function (widget) { + dojo.dom.removeNode(widget.domNode); + return dojo.widget.DomWidget.superclass.removeChild.call(this, widget); +}, getFragNodeRef:function (frag) { + if (!frag) { + return null; + } + if (!frag[this.getNamespacedType()]) { + dojo.raise("Error: no frag for widget type " + this.getNamespacedType() + ", id " + this.widgetId + " (maybe a widget has set it's type incorrectly)"); + } + return frag[this.getNamespacedType()]["nodeRef"]; +}, postInitialize:function (args, frag, parentComp) { + var sourceNodeRef = this.getFragNodeRef(frag); + if (parentComp && (parentComp.snarfChildDomOutput || !sourceNodeRef)) { + parentComp.addWidgetAsDirectChild(this, "", "insertAtIndex", "", args["dojoinsertionindex"], sourceNodeRef); + } else { + if (sourceNodeRef) { + if (this.domNode && (this.domNode !== sourceNodeRef)) { + this._sourceNodeRef = dojo.dom.replaceNode(sourceNodeRef, this.domNode); + } + } + } + if (parentComp) { + parentComp.registerChild(this, args.dojoinsertionindex); + } else { + dojo.widget.manager.topWidgets[this.widgetId] = this; + } + if (this.widgetsInTemplate) { + var parser = new dojo.xml.Parse(); + var subContainerNode; + var subnodes = this.domNode.getElementsByTagName("*"); + for (var i = 0; i < subnodes.length; i++) { + if (subnodes[i].getAttribute("dojoAttachPoint") == "subContainerWidget") { + subContainerNode = subnodes[i]; + } + if (subnodes[i].getAttribute("dojoType")) { + subnodes[i].setAttribute("isSubWidget", true); + } + } + if (this.isContainer && !this.containerNode) { + if (subContainerNode) { + var src = this.getFragNodeRef(frag); + if (src) { + dojo.dom.moveChildren(src, subContainerNode); + frag["dojoDontFollow"] = true; + } + } else { + dojo.debug("No subContainerWidget node can be found in template file for widget " + this); + } + } + var templatefrag = parser.parseElement(this.domNode, null, true); + dojo.widget.getParser().createSubComponents(templatefrag, this); + var subwidgets = []; + var stack = [this]; + var w; + while ((w = stack.pop())) { + for (var i = 0; i < w.children.length; i++) { + var cwidget = w.children[i]; + if (cwidget._processedSubWidgets || !cwidget.extraArgs["issubwidget"]) { + continue; + } + subwidgets.push(cwidget); + if (cwidget.isContainer) { + stack.push(cwidget); + } + } + } + for (var i = 0; i < subwidgets.length; i++) { + var widget = subwidgets[i]; + if (widget._processedSubWidgets) { + dojo.debug("This should not happen: widget._processedSubWidgets is already true!"); + return; + } + widget._processedSubWidgets = true; + if (widget.extraArgs["dojoattachevent"]) { + var evts = widget.extraArgs["dojoattachevent"].split(";"); + for (var j = 0; j < evts.length; j++) { + var thisFunc = null; + var tevt = dojo.string.trim(evts[j]); + if (tevt.indexOf(":") >= 0) { + var funcNameArr = tevt.split(":"); + tevt = dojo.string.trim(funcNameArr[0]); + thisFunc = dojo.string.trim(funcNameArr[1]); + } + if (!thisFunc) { + thisFunc = tevt; + } + if (dojo.lang.isFunction(widget[tevt])) { + dojo.event.kwConnect({srcObj:widget, srcFunc:tevt, targetObj:this, targetFunc:thisFunc}); + } else { + alert(tevt + " is not a function in widget " + widget); + } + } + } + if (widget.extraArgs["dojoattachpoint"]) { + this[widget.extraArgs["dojoattachpoint"]] = widget; + } + } + } + if (this.isContainer && !frag["dojoDontFollow"]) { + dojo.widget.getParser().createSubComponents(frag, this); + } +}, buildRendering:function (args, frag) { + var ts = dojo.widget._templateCache[this.widgetType]; + if (args["templatecsspath"]) { + args["templateCssPath"] = args["templatecsspath"]; + } + var cpath = args["templateCssPath"] || this.templateCssPath; + if (cpath && !dojo.widget._cssFiles[cpath.toString()]) { + if ((!this.templateCssString) && (cpath)) { + this.templateCssString = dojo.hostenv.getText(cpath); + this.templateCssPath = null; + } + dojo.widget._cssFiles[cpath.toString()] = true; + } + if ((this["templateCssString"]) && (!dojo.widget._cssStrings[this.templateCssString])) { + dojo.html.insertCssText(this.templateCssString, null, cpath); + dojo.widget._cssStrings[this.templateCssString] = true; + } + if ((!this.preventClobber) && ((this.templatePath) || (this.templateNode) || ((this["templateString"]) && (this.templateString.length)) || ((typeof ts != "undefined") && ((ts["string"]) || (ts["node"]))))) { + this.buildFromTemplate(args, frag); + } else { + this.domNode = this.getFragNodeRef(frag); + } + this.fillInTemplate(args, frag); +}, buildFromTemplate:function (args, frag) { + var avoidCache = false; + if (args["templatepath"]) { + args["templatePath"] = args["templatepath"]; + } + dojo.widget.fillFromTemplateCache(this, args["templatePath"], null, avoidCache); + var ts = dojo.widget._templateCache[this.templatePath ? this.templatePath.toString() : this.widgetType]; + if ((ts) && (!avoidCache)) { + if (!this.templateString.length) { + this.templateString = ts["string"]; + } + if (!this.templateNode) { + this.templateNode = ts["node"]; + } + } + var matches = false; + var node = null; + var tstr = this.templateString; + if ((!this.templateNode) && (this.templateString)) { + matches = this.templateString.match(/\$\{([^\}]+)\}/g); + if (matches) { + var hash = this.strings || {}; + for (var key in dojo.widget.defaultStrings) { + if (dojo.lang.isUndefined(hash[key])) { + hash[key] = dojo.widget.defaultStrings[key]; + } + } + for (var i = 0; i < matches.length; i++) { + var key = matches[i]; + key = key.substring(2, key.length - 1); + var kval = (key.substring(0, 5) == "this.") ? dojo.lang.getObjPathValue(key.substring(5), this) : hash[key]; + var value; + if ((kval) || (dojo.lang.isString(kval))) { + value = new String((dojo.lang.isFunction(kval)) ? kval.call(this, key, this.templateString) : kval); + while (value.indexOf("\"") > -1) { + value = value.replace("\"", """); + } + tstr = tstr.replace(matches[i], value); + } + } + } else { + this.templateNode = this.createNodesFromText(this.templateString, true)[0]; + if (!avoidCache) { + ts.node = this.templateNode; + } + } + } + if ((!this.templateNode) && (!matches)) { + dojo.debug("DomWidget.buildFromTemplate: could not create template"); + return false; + } else { + if (!matches) { + node = this.templateNode.cloneNode(true); + if (!node) { + return false; + } + } else { + node = this.createNodesFromText(tstr, true)[0]; + } + } + this.domNode = node; + this.attachTemplateNodes(); + if (this.isContainer && this.containerNode) { + var src = this.getFragNodeRef(frag); + if (src) { + dojo.dom.moveChildren(src, this.containerNode); + } + } +}, attachTemplateNodes:function (baseNode, targetObj) { + if (!baseNode) { + baseNode = this.domNode; + } + if (!targetObj) { + targetObj = this; + } + return dojo.widget.attachTemplateNodes(baseNode, targetObj, dojo.widget.getDojoEventsFromStr(this.templateString)); +}, fillInTemplate:function () { +}, destroyRendering:function () { + try { + dojo.dom.destroyNode(this.domNode); + delete this.domNode; + } + catch (e) { + } + if (this._sourceNodeRef) { + try { + dojo.dom.destroyNode(this._sourceNodeRef); + } + catch (e) { + } + } +}, createNodesFromText:function () { + dojo.unimplemented("dojo.widget.DomWidget.createNodesFromText"); +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DomWidget.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DomWidget.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DomWidget.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownContainer.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownContainer.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownContainer.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownContainer.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,65 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + + + +dojo.provide("dojo.widget.DropdownContainer"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.HtmlWidget"); +dojo.require("dojo.widget.PopupContainer"); +dojo.require("dojo.event.*"); +dojo.require("dojo.html.layout"); +dojo.require("dojo.html.display"); +dojo.require("dojo.html.iframe"); +dojo.require("dojo.html.util"); +dojo.widget.defineWidget("dojo.widget.DropdownContainer", dojo.widget.HtmlWidget, {inputWidth:"7em", id:"", inputId:"", inputName:"", iconURL:dojo.uri.moduleUri("dojo.widget", "templates/images/combo_box_arrow.png"), copyClasses:false, iconAlt:"", containerToggle:"plain", containerToggleDuration:150, templateString:" \"${this.iconAlt}\"", templateCssPath:"", isContainer:true, attachTemplateNodes:function () { + dojo.widget.DropdownContainer.superclass.attachTemplateNodes.apply(this, arguments); + this.popup = dojo.widget.createWidget("PopupContainer", {toggle:this.containerToggle, toggleDuration:this.containerToggleDuration}); + this.containerNode = this.popup.domNode; +}, fillInTemplate:function (args, frag) { + this.domNode.appendChild(this.popup.domNode); + if (this.id) { + this.domNode.id = this.id; + } + if (this.inputId) { + this.inputNode.id = this.inputId; + } + if (this.inputName) { + this.inputNode.name = this.inputName; + } + this.inputNode.style.width = this.inputWidth; + this.inputNode.disabled = this.disabled; + if (this.copyClasses) { + this.inputNode.style = ""; + this.inputNode.className = this.getFragNodeRef(frag).className; + } + dojo.event.connect(this.inputNode, "onchange", this, "onInputChange"); +}, onIconClick:function (evt) { + if (this.disabled) { + return; + } + if (!this.popup.isShowingNow) { + this.popup.open(this.inputNode, this, this.buttonNode); + } else { + this.popup.close(); + } +}, hideContainer:function () { + if (this.popup.isShowingNow) { + this.popup.close(); + } +}, onInputChange:function () { +}, enable:function () { + this.inputNode.disabled = false; + dojo.widget.DropdownContainer.superclass.enable.apply(this, arguments); +}, disable:function () { + this.inputNode.disabled = true; + dojo.widget.DropdownContainer.superclass.disable.apply(this, arguments); +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownContainer.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownContainer.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownContainer.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownDatePicker.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownDatePicker.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownDatePicker.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownDatePicker.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,110 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + + + +dojo.provide("dojo.widget.DropdownDatePicker"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.DropdownContainer"); +dojo.require("dojo.widget.DatePicker"); +dojo.require("dojo.event.*"); +dojo.require("dojo.html.*"); +dojo.require("dojo.date.format"); +dojo.require("dojo.date.serialize"); +dojo.require("dojo.string.common"); +dojo.require("dojo.i18n.common"); +dojo.requireLocalization("dojo.widget", "DropdownDatePicker", null, "ROOT"); +dojo.widget.defineWidget("dojo.widget.DropdownDatePicker", dojo.widget.DropdownContainer, {iconURL:dojo.uri.moduleUri("dojo.widget", "templates/images/dateIcon.gif"), formatLength:"short", displayFormat:"", saveFormat:"", value:"", name:"", displayWeeks:6, adjustWeeks:false, startDate:"1492-10-12", endDate:"2941-10-12", weekStartsOn:"", staticDisplay:false, postMixInProperties:function (localProperties, frag) { + dojo.widget.DropdownDatePicker.superclass.postMixInProperties.apply(this, arguments); + var messages = dojo.i18n.getLocalization("dojo.widget", "DropdownDatePicker", this.lang); + this.iconAlt = messages.selectDate; + if (typeof (this.value) == "string" && this.value.toLowerCase() == "today") { + this.value = new Date(); + } + if (this.value && isNaN(this.value)) { + var orig = this.value; + this.value = dojo.date.fromRfc3339(this.value); + if (!this.value) { + this.value = new Date(orig); + dojo.deprecated("dojo.widget.DropdownDatePicker", "date attributes must be passed in Rfc3339 format", "0.5"); + } + } + if (this.value && !isNaN(this.value)) { + this.value = new Date(this.value); + } +}, fillInTemplate:function (args, frag) { + dojo.widget.DropdownDatePicker.superclass.fillInTemplate.call(this, args, frag); + var dpArgs = {widgetContainerId:this.widgetId, lang:this.lang, value:this.value, startDate:this.startDate, endDate:this.endDate, displayWeeks:this.displayWeeks, weekStartsOn:this.weekStartsOn, adjustWeeks:this.adjustWeeks, staticDisplay:this.staticDisplay}; + this.datePicker = dojo.widget.createWidget("DatePicker", dpArgs, this.containerNode, "child"); + dojo.event.connect(this.datePicker, "onValueChanged", this, "_updateText"); + dojo.event.connect(this.inputNode, "onChange", this, "_updateText"); + if (this.value) { + this._updateText(); + } + this.containerNode.explodeClassName = "calendarBodyContainer"; + this.valueNode.name = this.name; +}, getValue:function () { + return this.valueNode.value; +}, getDate:function () { + return this.datePicker.value; +}, setValue:function (rfcDate) { + this.setDate(rfcDate); +}, setDate:function (dateObj) { + this.datePicker.setDate(dateObj); + this._syncValueNode(); +}, _updateText:function () { + this.inputNode.value = this.datePicker.value ? dojo.date.format(this.datePicker.value, {formatLength:this.formatLength, datePattern:this.displayFormat, selector:"dateOnly", locale:this.lang}) : ""; + if (this.value < this.datePicker.startDate || this.value > this.datePicker.endDate) { + this.inputNode.value = ""; + } + this._syncValueNode(); + this.onValueChanged(this.getDate()); + this.hideContainer(); +}, onValueChanged:function (dateObj) { +}, onInputChange:function () { + var input = dojo.string.trim(this.inputNode.value); + if (input) { + var inputDate = dojo.date.parse(input, {formatLength:this.formatLength, datePattern:this.displayFormat, selector:"dateOnly", locale:this.lang}); + if (!this.datePicker._isDisabledDate(inputDate)) { + this.setDate(inputDate); + } + } else { + if (input == "") { + this.datePicker.setDate(""); + } + this.valueNode.value = input; + } + if (input) { + this._updateText(); + } +}, _syncValueNode:function () { + var date = this.datePicker.value; + var value = ""; + switch (this.saveFormat.toLowerCase()) { + case "rfc": + case "iso": + case "": + value = dojo.date.toRfc3339(date, "dateOnly"); + break; + case "posix": + case "unix": + value = Number(date); + break; + default: + if (date) { + value = dojo.date.format(date, {datePattern:this.saveFormat, selector:"dateOnly", locale:this.lang}); + } + } + this.valueNode.value = value; +}, destroy:function (finalize) { + this.datePicker.destroy(finalize); + dojo.widget.DropdownDatePicker.superclass.destroy.apply(this, arguments); +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownDatePicker.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownDatePicker.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownDatePicker.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownTimePicker.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownTimePicker.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownTimePicker.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownTimePicker.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,156 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + + + +dojo.provide("dojo.widget.DropdownTimePicker"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.DropdownContainer"); +dojo.require("dojo.widget.TimePicker"); +dojo.require("dojo.event.*"); +dojo.require("dojo.html.*"); +dojo.require("dojo.date.format"); +dojo.require("dojo.date.serialize"); +dojo.require("dojo.i18n.common"); +dojo.requireLocalization("dojo.widget", "DropdownTimePicker", null, "ROOT"); +dojo.widget.defineWidget("dojo.widget.DropdownTimePicker", dojo.widget.DropdownContainer, {iconURL:dojo.uri.moduleUri("dojo.widget", "templates/images/timeIcon.gif"), formatLength:"short", displayFormat:"", timeFormat:"", saveFormat:"", value:"", name:"", postMixInProperties:function () { + dojo.widget.DropdownTimePicker.superclass.postMixInProperties.apply(this, arguments); + var messages = dojo.i18n.getLocalization("dojo.widget", "DropdownTimePicker", this.lang); + this.iconAlt = messages.selectTime; + if (typeof (this.value) == "string" && this.value.toLowerCase() == "today") { + this.value = new Date(); + } + if (this.value && isNaN(this.value)) { + var orig = this.value; + this.value = dojo.date.fromRfc3339(this.value); + if (!this.value) { + var d = dojo.date.format(new Date(), {selector:"dateOnly", datePattern:"yyyy-MM-dd"}); + var c = orig.split(":"); + for (var i = 0; i < c.length; ++i) { + if (c[i].length == 1) { + c[i] = "0" + c[i]; + } + } + orig = c.join(":"); + this.value = dojo.date.fromRfc3339(d + "T" + orig); + dojo.deprecated("dojo.widget.DropdownTimePicker", "time attributes must be passed in Rfc3339 format", "0.5"); + } + } + if (this.value && !isNaN(this.value)) { + this.value = new Date(this.value); + } +}, fillInTemplate:function () { + dojo.widget.DropdownTimePicker.superclass.fillInTemplate.apply(this, arguments); + var value = ""; + if (this.value instanceof Date) { + value = this.value; + } else { + if (this.value) { + var orig = this.value; + var d = dojo.date.format(new Date(), {selector:"dateOnly", datePattern:"yyyy-MM-dd"}); + var c = orig.split(":"); + for (var i = 0; i < c.length; ++i) { + if (c[i].length == 1) { + c[i] = "0" + c[i]; + } + } + orig = c.join(":"); + value = dojo.date.fromRfc3339(d + "T" + orig); + } + } + var tpArgs = {widgetContainerId:this.widgetId, lang:this.lang, value:value}; + this.timePicker = dojo.widget.createWidget("TimePicker", tpArgs, this.containerNode, "child"); + dojo.event.connect(this.timePicker, "onValueChanged", this, "_updateText"); + if (this.value) { + this._updateText(); + } + this.containerNode.style.zIndex = this.zIndex; + this.containerNode.explodeClassName = "timeContainer"; + this.valueNode.name = this.name; +}, getValue:function () { + return this.valueNode.value; +}, getTime:function () { + return this.timePicker.storedTime; +}, setValue:function (rfcDate) { + this.setTime(rfcDate); +}, setTime:function (dateObj) { + var value = ""; + if (dateObj instanceof Date) { + value = dateObj; + } else { + if (this.value) { + var orig = this.value; + var d = dojo.date.format(new Date(), {selector:"dateOnly", datePattern:"yyyy-MM-dd"}); + var c = orig.split(":"); + for (var i = 0; i < c.length; ++i) { + if (c[i].length == 1) { + c[i] = "0" + c[i]; + } + } + orig = c.join(":"); + value = dojo.date.fromRfc3339(d + "T" + orig); + } + } + this.timePicker.setTime(value); + this._syncValueNode(); +}, _updateText:function () { + if (this.timePicker.selectedTime.anyTime) { + this.inputNode.value = ""; + } else { + if (this.timeFormat) { + dojo.deprecated("dojo.widget.DropdownTimePicker", "Must use displayFormat attribute instead of timeFormat. See dojo.date.format for specification.", "0.5"); + this.inputNode.value = dojo.date.strftime(this.timePicker.time, this.timeFormat, this.lang); + } else { + this.inputNode.value = dojo.date.format(this.timePicker.time, {formatLength:this.formatLength, timePattern:this.displayFormat, selector:"timeOnly", locale:this.lang}); + } + } + this._syncValueNode(); + this.onValueChanged(this.getTime()); + this.hideContainer(); +}, onValueChanged:function (dateObj) { +}, onInputChange:function () { + if (this.dateFormat) { + dojo.deprecated("dojo.widget.DropdownTimePicker", "Cannot parse user input. Must use displayFormat attribute instead of dateFormat. See dojo.date.format for specification.", "0.5"); + } else { + var input = dojo.string.trim(this.inputNode.value); + if (input) { + var inputTime = dojo.date.parse(input, {formatLength:this.formatLength, timePattern:this.displayFormat, selector:"timeOnly", locale:this.lang}); + if (inputTime) { + this.setTime(inputTime); + } + } else { + this.valueNode.value = input; + } + } + if (input) { + this._updateText(); + } +}, _syncValueNode:function () { + var time = this.timePicker.time; + var value; + switch (this.saveFormat.toLowerCase()) { + case "rfc": + case "iso": + case "": + value = dojo.date.toRfc3339(time, "timeOnly"); + break; + case "posix": + case "unix": + value = Number(time); + break; + default: + value = dojo.date.format(time, {datePattern:this.saveFormat, selector:"timeOnly", locale:this.lang}); + } + this.valueNode.value = value; +}, destroy:function (finalize) { + this.timePicker.destroy(finalize); + dojo.widget.DropdownTimePicker.superclass.destroy.apply(this, arguments); +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownTimePicker.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownTimePicker.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/DropdownTimePicker.js ------------------------------------------------------------------------------ svn:mime-type = text/plain