From e977b5a63e557c983b54d04616cec867c9b2d720 Mon Sep 17 00:00:00 2001 From: Musachy Barroso Date: Fri, 24 Aug 2007 23:47:20 +0000 Subject: [PATCH] WW-2134 Upgrade Dojo from 0.4.2 to 0.4.3 to address possible XSS Issues git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@569576 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/struts2/static/dojo/build.txt | 32 +- .../org/apache/struts2/static/dojo/dojo.js | 6331 +- .../static/dojo/dojo.js.uncompressed.js | 7617 +- .../static/dojo/src/AdapterRegistry.js | 2 + .../struts2/static/dojo/src/Deferred.js | 2 + .../struts2/static/dojo/src/DeferredList.js | 2 + .../apache/struts2/static/dojo/src/a11y.js | 2 + .../struts2/static/dojo/src/animation.js | 2 + .../static/dojo/src/animation/Animation.js | 2 + .../dojo/src/animation/AnimationEvent.js | 2 + .../dojo/src/animation/AnimationSequence.js | 2 + .../static/dojo/src/animation/Timer.js | 2 + .../static/dojo/src/animation/__package__.js | 2 + .../struts2/static/dojo/src/behavior.js | 2 + .../struts2/static/dojo/src/bootstrap1.js | 4 +- .../struts2/static/dojo/src/browser_debug.js | 2 + .../static/dojo/src/browser_debug_xd.js | 2 + .../struts2/static/dojo/src/cal/iCalendar.js | 2 + .../static/dojo/src/cal/textDirectory.js | 2 + .../struts2/static/dojo/src/charting/Axis.js | 2 + .../struts2/static/dojo/src/charting/Chart.js | 2 + .../struts2/static/dojo/src/charting/Plot.js | 2 + .../static/dojo/src/charting/PlotArea.js | 2 + .../static/dojo/src/charting/Plotters.js | 2 + .../static/dojo/src/charting/Series.js | 2 + .../static/dojo/src/charting/__package__.js | 2 + .../static/dojo/src/charting/svg/Axis.js | 2 + .../static/dojo/src/charting/svg/PlotArea.js | 2 + .../static/dojo/src/charting/svg/Plotters.js | 2 + .../static/dojo/src/charting/vml/Axis.js | 2 + .../static/dojo/src/charting/vml/PlotArea.js | 2 + .../static/dojo/src/charting/vml/Plotters.js | 2 + .../static/dojo/src/collections/ArrayList.js | 2 + .../static/dojo/src/collections/BinaryTree.js | 2 + .../dojo/src/collections/Collections.js | 2 + .../static/dojo/src/collections/Dictionary.js | 2 + .../static/dojo/src/collections/Graph.js | 2 + .../static/dojo/src/collections/Queue.js | 2 + .../static/dojo/src/collections/Set.js | 2 + .../static/dojo/src/collections/SkipList.js | 2 + .../static/dojo/src/collections/SortedList.js | 2 + .../static/dojo/src/collections/Stack.js | 2 + .../static/dojo/src/collections/Store.js | 2 + .../dojo/src/collections/__package__.js | 2 + .../apache/struts2/static/dojo/src/crypto.js | 2 + .../static/dojo/src/crypto/Blowfish.js | 2 + .../struts2/static/dojo/src/crypto/MD5.js | 24 +- .../static/dojo/src/crypto/Rijndael.js | 2 + .../struts2/static/dojo/src/crypto/SHA1.js | 20 +- .../struts2/static/dojo/src/crypto/SHA256.js | 2 + .../static/dojo/src/crypto/__package__.js | 2 + .../apache/struts2/static/dojo/src/data.js | 2 + .../struts2/static/dojo/src/data/CsvStore.js | 2 + .../struts2/static/dojo/src/data/OpmlStore.js | 2 + .../struts2/static/dojo/src/data/RdfStore.js | 2 + .../static/dojo/src/data/YahooStore.js | 2 + .../struts2/static/dojo/src/data/core/Read.js | 2 + .../static/dojo/src/data/core/RemoteStore.js | 2 + .../static/dojo/src/data/core/Result.js | 2 + .../static/dojo/src/data/core/Write.js | 2 + .../static/dojo/src/data/old/Attribute.js | 2 + .../struts2/static/dojo/src/data/old/Item.js | 2 + .../struts2/static/dojo/src/data/old/Kind.js | 2 + .../static/dojo/src/data/old/Observable.js | 2 + .../static/dojo/src/data/old/ResultSet.js | 2 + .../struts2/static/dojo/src/data/old/Type.js | 2 + .../struts2/static/dojo/src/data/old/Value.js | 2 + .../static/dojo/src/data/old/__package__.js | 2 + .../static/dojo/src/data/old/format/Csv.js | 2 + .../static/dojo/src/data/old/format/Json.js | 2 + .../static/dojo/src/data/old/provider/Base.js | 2 + .../dojo/src/data/old/provider/Delicious.js | 2 + .../dojo/src/data/old/provider/FlatFile.js | 2 + .../dojo/src/data/old/provider/JotSpot.js | 2 + .../dojo/src/data/old/provider/MySql.js | 2 + .../apache/struts2/static/dojo/src/date.js | 2 + .../struts2/static/dojo/src/date/common.js | 2 + .../struts2/static/dojo/src/date/format.js | 6 +- .../struts2/static/dojo/src/date/serialize.js | 2 + .../static/dojo/src/date/supplemental.js | 2 + .../apache/struts2/static/dojo/src/debug.js | 2 + .../struts2/static/dojo/src/debug/Firebug.js | 2 + .../struts2/static/dojo/src/debug/console.js | 2 + .../static/dojo/src/dnd/DragAndDrop.js | 2 + .../static/dojo/src/dnd/HtmlDragAndDrop.js | 2 + .../static/dojo/src/dnd/HtmlDragCopy.js | 2 + .../static/dojo/src/dnd/HtmlDragManager.js | 2 + .../static/dojo/src/dnd/HtmlDragMove.js | 2 + .../struts2/static/dojo/src/dnd/Sortable.js | 2 + .../static/dojo/src/dnd/TreeDragAndDrop.js | 2 + .../static/dojo/src/dnd/TreeDragAndDropV3.js | 2 + .../static/dojo/src/dnd/__package__.js | 2 + .../org/apache/struts2/static/dojo/src/dom.js | 2 + .../apache/struts2/static/dojo/src/event.js | 2 + .../static/dojo/src/event/__package__.js | 2 + .../struts2/static/dojo/src/event/browser.js | 2 + .../struts2/static/dojo/src/event/common.js | 9 + .../struts2/static/dojo/src/event/topic.js | 2 + .../struts2/static/dojo/src/experimental.js | 2 + .../apache/struts2/static/dojo/src/flash.js | 2 + .../struts2/static/dojo/src/gfx/Colorspace.js | 2 + .../static/dojo/src/gfx/__package__.js | 2 + .../struts2/static/dojo/src/gfx/color.js | 2 + .../struts2/static/dojo/src/gfx/color/hsl.js | 2 + .../struts2/static/dojo/src/gfx/color/hsv.js | 2 + .../struts2/static/dojo/src/gfx/common.js | 2 + .../struts2/static/dojo/src/gfx/matrix.js | 2 + .../struts2/static/dojo/src/gfx/path.js | 2 + .../struts2/static/dojo/src/gfx/shape.js | 2 + .../apache/struts2/static/dojo/src/gfx/svg.js | 2 + .../apache/struts2/static/dojo/src/gfx/vml.js | 2 + .../static/dojo/src/graphics/Colorspace.js | 2 + .../static/dojo/src/graphics/__package__.js | 2 + .../struts2/static/dojo/src/graphics/color.js | 2 + .../static/dojo/src/graphics/color/hsl.js | 2 + .../static/dojo/src/graphics/color/hsv.js | 2 + .../static/dojo/src/hostenv_adobesvg.js | 2 + .../static/dojo/src/hostenv_browser.js | 4 + .../static/dojo/src/hostenv_dashboard.js | 2 + .../struts2/static/dojo/src/hostenv_rhino.js | 2 + .../static/dojo/src/hostenv_spidermonkey.js | 2 + .../struts2/static/dojo/src/hostenv_svg.js | 2 + .../struts2/static/dojo/src/hostenv_wsh.js | 2 + .../apache/struts2/static/dojo/src/html.js | 2 + .../static/dojo/src/html/__package__.js | 2 + .../struts2/static/dojo/src/html/color.js | 2 + .../struts2/static/dojo/src/html/common.js | 2 + .../struts2/static/dojo/src/html/display.js | 2 + .../struts2/static/dojo/src/html/iframe.js | 2 + .../struts2/static/dojo/src/html/layout.js | 2 + .../struts2/static/dojo/src/html/metrics.js | 2 + .../struts2/static/dojo/src/html/selection.js | 2 + .../struts2/static/dojo/src/html/shadow.js | 2 + .../struts2/static/dojo/src/html/style.js | 4 +- .../struts2/static/dojo/src/html/util.js | 2 + .../src/i18n/calendar/nls/de/gregorian.js | 2 + .../src/i18n/calendar/nls/en/gregorian.js | 2 + .../src/i18n/calendar/nls/es/gregorian.js | 2 + .../src/i18n/calendar/nls/fi/gregorian.js | 2 + .../src/i18n/calendar/nls/fr/gregorian.js | 2 + .../dojo/src/i18n/calendar/nls/gregorian.js | 2 + .../src/i18n/calendar/nls/gregorianExtras.js | 2 + .../src/i18n/calendar/nls/hu/gregorian.js | 2 + .../src/i18n/calendar/nls/it/gregorian.js | 2 + .../src/i18n/calendar/nls/ja/gregorian.js | 2 + .../i18n/calendar/nls/ja/gregorianExtras.js | 2 + .../src/i18n/calendar/nls/ko/gregorian.js | 2 + .../src/i18n/calendar/nls/nl/gregorian.js | 2 + .../src/i18n/calendar/nls/pt-br/gregorian.js | 2 + .../src/i18n/calendar/nls/pt/gregorian.js | 2 + .../src/i18n/calendar/nls/sv/gregorian.js | 2 + .../src/i18n/calendar/nls/zh-cn/gregorian.js | 2 + .../src/i18n/calendar/nls/zh-hk/gregorian.js | 2 + .../src/i18n/calendar/nls/zh-tw/gregorian.js | 2 + .../src/i18n/calendar/nls/zh/gregorian.js | 2 + .../i18n/calendar/nls/zh/gregorianExtras.js | 2 + .../struts2/static/dojo/src/i18n/common.js | 2 + .../struts2/static/dojo/src/i18n/currency.js | 2 + .../static/dojo/src/i18n/currency/common.js | 2 + .../static/dojo/src/i18n/currency/nls/EUR.js | 2 + .../static/dojo/src/i18n/currency/nls/GBP.js | 2 + .../static/dojo/src/i18n/currency/nls/INR.js | 2 + .../static/dojo/src/i18n/currency/nls/ITL.js | 2 + .../static/dojo/src/i18n/currency/nls/JPY.js | 2 + .../static/dojo/src/i18n/currency/nls/USD.js | 2 + .../dojo/src/i18n/currency/nls/en-us/USD.js | 2 + .../dojo/src/i18n/currency/nls/en/EUR.js | 2 + .../dojo/src/i18n/currency/nls/en/GBP.js | 2 + .../dojo/src/i18n/currency/nls/en/INR.js | 2 + .../dojo/src/i18n/currency/nls/en/ITL.js | 2 + .../dojo/src/i18n/currency/nls/en/JPY.js | 2 + .../dojo/src/i18n/currency/nls/en/USD.js | 2 + .../dojo/src/i18n/currency/nls/hi/EUR.js | 2 + .../dojo/src/i18n/currency/nls/hi/GBP.js | 2 + .../dojo/src/i18n/currency/nls/hi/INR.js | 2 + .../dojo/src/i18n/currency/nls/hi/ITL.js | 2 + .../dojo/src/i18n/currency/nls/hi/JPY.js | 2 + .../dojo/src/i18n/currency/nls/hi/USD.js | 2 + .../dojo/src/i18n/currency/nls/ja/EUR.js | 2 + .../dojo/src/i18n/currency/nls/ja/GBP.js | 2 + .../dojo/src/i18n/currency/nls/ja/INR.js | 2 + .../dojo/src/i18n/currency/nls/ja/ITL.js | 2 + .../dojo/src/i18n/currency/nls/ja/JPY.js | 2 + .../dojo/src/i18n/currency/nls/ja/USD.js | 2 + .../struts2/static/dojo/src/i18n/number.js | 2 + .../struts2/static/dojo/src/iCalendar.js | 2 + .../org/apache/struts2/static/dojo/src/io.js | 2 + .../struts2/static/dojo/src/io/BrowserIO.js | 11 +- .../struts2/static/dojo/src/io/IframeIO.js | 2 + .../struts2/static/dojo/src/io/RhinoIO.js | 2 + .../struts2/static/dojo/src/io/ScriptSrcIO.js | 2 + .../static/dojo/src/io/XhrIframeProxy.js | 2 + .../struts2/static/dojo/src/io/__package__.js | 2 + .../struts2/static/dojo/src/io/cometd.js | 4 +- .../struts2/static/dojo/src/io/common.js | 16 +- .../struts2/static/dojo/src/io/cookie.js | 2 + .../static/dojo/src/io/xip_client.html | 20 +- .../static/dojo/src/io/xip_server.html | 34 +- .../apache/struts2/static/dojo/src/json.js | 2 + .../apache/struts2/static/dojo/src/lang.js | 2 + .../static/dojo/src/lang/__package__.js | 2 + .../struts2/static/dojo/src/lang/array.js | 2 + .../struts2/static/dojo/src/lang/assert.js | 2 + .../struts2/static/dojo/src/lang/common.js | 2 + .../struts2/static/dojo/src/lang/declare.js | 2 + .../struts2/static/dojo/src/lang/extras.js | 2 + .../struts2/static/dojo/src/lang/func.js | 12 +- .../struts2/static/dojo/src/lang/repr.js | 2 + .../static/dojo/src/lang/timing/Streamer.js | 2 + .../static/dojo/src/lang/timing/Timer.js | 2 + .../dojo/src/lang/timing/__package__.js | 2 + .../struts2/static/dojo/src/lang/type.js | 2 + .../struts2/static/dojo/src/lfx/Animation.js | 2 + .../static/dojo/src/lfx/__package__.js | 2 + .../struts2/static/dojo/src/lfx/extras.js | 2 + .../struts2/static/dojo/src/lfx/html.js | 2 + .../struts2/static/dojo/src/lfx/rounded.js | 2 + .../struts2/static/dojo/src/lfx/shadow.js | 2 + .../struts2/static/dojo/src/lfx/toggle.js | 2 + .../apache/struts2/static/dojo/src/loader.js | 2 + .../struts2/static/dojo/src/loader_xd.js | 21 +- .../static/dojo/src/logging/ConsoleLogger.js | 2 + .../struts2/static/dojo/src/logging/Logger.js | 2 + .../static/dojo/src/logging/__package__.js | 2 + .../apache/struts2/static/dojo/src/math.js | 2 + .../static/dojo/src/math/__package__.js | 2 + .../struts2/static/dojo/src/math/curves.js | 2 + .../struts2/static/dojo/src/math/matrix.js | 2 + .../struts2/static/dojo/src/math/points.js | 2 + .../org/apache/struts2/static/dojo/src/ns.js | 2 + .../apache/struts2/static/dojo/src/profile.js | 2 + .../apache/struts2/static/dojo/src/regexp.js | 2 + .../struts2/static/dojo/src/rpc/Deferred.js | 2 + .../struts2/static/dojo/src/rpc/JotService.js | 2 + .../static/dojo/src/rpc/JsonService.js | 2 + .../struts2/static/dojo/src/rpc/RpcService.js | 2 + .../static/dojo/src/rpc/YahooService.js | 2 + .../static/dojo/src/rpc/__package__.js | 2 + .../static/dojo/src/selection/Selection.js | 2 + .../apache/struts2/static/dojo/src/storage.js | 2 + .../static/dojo/src/storage/__package__.js | 2 + .../static/dojo/src/storage/browser.js | 2 + .../apache/struts2/static/dojo/src/string.js | 2 + .../struts2/static/dojo/src/string/Builder.js | 2 + .../static/dojo/src/string/__package__.js | 2 + .../struts2/static/dojo/src/string/common.js | 2 + .../struts2/static/dojo/src/string/extras.js | 2 + .../apache/struts2/static/dojo/src/style.js | 2 + .../org/apache/struts2/static/dojo/src/svg.js | 2 + .../static/dojo/src/text/__package__.js | 2 + .../static/dojo/src/text/textDirectory.js | 2 + .../struts2/static/dojo/src/undo/Manager.js | 2 + .../static/dojo/src/undo/__package__.js | 2 + .../struts2/static/dojo/src/undo/browser.js | 2 + .../apache/struts2/static/dojo/src/uri/Uri.js | 2 + .../static/dojo/src/uri/__package__.js | 2 + .../struts2/static/dojo/src/uri/cache.js | 2 + .../dojo/src/uuid/LightweightGenerator.js | 2 + .../dojo/src/uuid/NameBasedGenerator.js | 2 + .../static/dojo/src/uuid/NilGenerator.js | 2 + .../static/dojo/src/uuid/RandomGenerator.js | 2 + .../dojo/src/uuid/TimeBasedGenerator.js | 2 + .../struts2/static/dojo/src/uuid/Uuid.js | 2 + .../static/dojo/src/uuid/__package__.js | 2 + .../struts2/static/dojo/src/validate.js | 2 + .../static/dojo/src/validate/__package__.js | 2 + .../struts2/static/dojo/src/validate/check.js | 2 + .../static/dojo/src/validate/common.js | 2 + .../static/dojo/src/validate/creditCard.js | 2 + .../static/dojo/src/validate/datetime.js | 2 + .../struts2/static/dojo/src/validate/de.js | 2 + .../struts2/static/dojo/src/validate/jp.js | 2 + .../struts2/static/dojo/src/validate/us.js | 2 + .../struts2/static/dojo/src/validate/web.js | 2 + .../dojo/src/widget/AccordionContainer.js | 2 + .../static/dojo/src/widget/AnimatedPng.js | 2 + .../struts2/static/dojo/src/widget/Button.js | 2 + .../struts2/static/dojo/src/widget/Chart.js | 2 + .../static/dojo/src/widget/Checkbox.js | 2 + .../struts2/static/dojo/src/widget/Clock.js | 2 + .../static/dojo/src/widget/ColorPalette.js | 2 + .../static/dojo/src/widget/ComboBox.js | 2 + .../static/dojo/src/widget/ContentPane.js | 2 + .../static/dojo/src/widget/CurrencyTextbox.js | 2 + .../static/dojo/src/widget/DatePicker.js | 2 + .../static/dojo/src/widget/DateTextbox.js | 2 + .../static/dojo/src/widget/DebugConsole.js | 2 + .../struts2/static/dojo/src/widget/Dialog.js | 2 + .../struts2/static/dojo/src/widget/DocPane.js | 2 + .../static/dojo/src/widget/DomWidget.js | 2 + .../dojo/src/widget/DropdownContainer.js | 2 + .../dojo/src/widget/DropdownDatePicker.js | 2 + .../dojo/src/widget/DropdownTimePicker.js | 2 + .../struts2/static/dojo/src/widget/Editor.js | 2 + .../struts2/static/dojo/src/widget/Editor2.js | 2 + .../widget/Editor2Plugin/AlwaysShowToolbar.js | 2 + .../src/widget/Editor2Plugin/ContextMenu.js | 2 + .../widget/Editor2Plugin/CreateLinkDialog.js | 2 + .../src/widget/Editor2Plugin/FindReplace.js | 2 + .../widget/Editor2Plugin/FindReplaceDialog.js | 2 + .../widget/Editor2Plugin/InsertImageDialog.js | 2 + .../widget/Editor2Plugin/InsertTableDialog.js | 2 + .../Editor2Plugin/SimpleSignalCommands.js | 2 + .../widget/Editor2Plugin/TableOperation.js | 2 + .../widget/Editor2Plugin/ToolbarDndSupport.js | 2 + .../src/widget/Editor2Plugin/__package__.js | 2 + .../static/dojo/src/widget/Editor2Toolbar.js | 2 + .../static/dojo/src/widget/FilteringTable.js | 2 + .../static/dojo/src/widget/FisheyeList.js | 2 + .../static/dojo/src/widget/FloatingPane.js | 2 + .../struts2/static/dojo/src/widget/Form.js | 2 + .../static/dojo/src/widget/GoogleMap.js | 2 + .../static/dojo/src/widget/HtmlWidget.js | 2 + .../static/dojo/src/widget/InlineEditBox.js | 2 + .../static/dojo/src/widget/IntegerTextbox.js | 2 + .../static/dojo/src/widget/InternetTextbox.js | 2 + .../static/dojo/src/widget/LayoutContainer.js | 2 + .../static/dojo/src/widget/LinkPane.js | 2 + .../struts2/static/dojo/src/widget/Manager.js | 2 + .../struts2/static/dojo/src/widget/Menu2.js | 2 + .../static/dojo/src/widget/MonthlyCalendar.js | 2 + .../static/dojo/src/widget/PageContainer.js | 2 + .../struts2/static/dojo/src/widget/Parse.js | 2 + .../static/dojo/src/widget/PopupContainer.js | 2 + .../static/dojo/src/widget/ProgressBar.js | 2 + .../static/dojo/src/widget/RadioGroup.js | 2 + .../dojo/src/widget/RealNumberTextbox.js | 2 + .../static/dojo/src/widget/RegexpTextbox.js | 2 + .../dojo/src/widget/RemoteTabController.js | 2 + .../static/dojo/src/widget/Repeater.js | 2 + .../dojo/src/widget/ResizableTextarea.js | 2 + .../static/dojo/src/widget/ResizeHandle.js | 2 + .../static/dojo/src/widget/RichText.js | 2 + .../struts2/static/dojo/src/widget/Rounded.js | 2 + .../struts2/static/dojo/src/widget/Select.js | 2 + .../struts2/static/dojo/src/widget/Show.js | 2 + .../static/dojo/src/widget/ShowAction.js | 2 + .../static/dojo/src/widget/ShowSlide.js | 2 + .../static/dojo/src/widget/SlideShow.js | 2 + .../struts2/static/dojo/src/widget/Slider.js | 2 + .../static/dojo/src/widget/SortableTable.js | 2 + .../struts2/static/dojo/src/widget/Spinner.js | 2 + .../static/dojo/src/widget/SplitContainer.js | 2 + .../static/dojo/src/widget/SvgButton.js | 2 + .../static/dojo/src/widget/SvgWidget.js | 2 + .../static/dojo/src/widget/SwtWidget.js | 2 + .../static/dojo/src/widget/TabContainer.js | 2 + .../struts2/static/dojo/src/widget/TaskBar.js | 2 + .../struts2/static/dojo/src/widget/Textbox.js | 4 +- .../static/dojo/src/widget/TimePicker.js | 4 +- .../static/dojo/src/widget/TitlePane.js | 2 + .../struts2/static/dojo/src/widget/Toaster.js | 2 + .../struts2/static/dojo/src/widget/Toggler.js | 2 + .../struts2/static/dojo/src/widget/Toolbar.js | 2 + .../struts2/static/dojo/src/widget/Tooltip.js | 2 + .../struts2/static/dojo/src/widget/Tree.js | 2 + .../dojo/src/widget/TreeBasicController.js | 2 + .../dojo/src/widget/TreeBasicControllerV3.js | 2 + .../static/dojo/src/widget/TreeCommon.js | 2 + .../static/dojo/src/widget/TreeContextMenu.js | 2 + .../dojo/src/widget/TreeContextMenuV3.js | 2 + .../src/widget/TreeControllerExtension.js | 2 + .../static/dojo/src/widget/TreeDemo.js | 2 + .../src/widget/TreeDeselectOnDblselect.js | 2 + .../src/widget/TreeDisableWrapExtension.js | 2 + .../dojo/src/widget/TreeDndControllerV3.js | 2 + .../dojo/src/widget/TreeDocIconExtension.js | 2 + .../static/dojo/src/widget/TreeEditor.js | 2 + .../dojo/src/widget/TreeEmphasizeOnSelect.js | 2 + .../src/widget/TreeExpandToNodeOnSelect.js | 2 + .../static/dojo/src/widget/TreeExtension.js | 2 + .../dojo/src/widget/TreeLinkExtension.js | 2 + .../dojo/src/widget/TreeLoadingController.js | 2 + .../src/widget/TreeLoadingControllerV3.js | 2 + .../static/dojo/src/widget/TreeNode.js | 2 + .../static/dojo/src/widget/TreeNodeV3.js | 2 + .../dojo/src/widget/TreeRPCController.js | 2 + .../dojo/src/widget/TreeRpcControllerV3.js | 2 + .../static/dojo/src/widget/TreeSelector.js | 4 +- .../static/dojo/src/widget/TreeSelectorV3.js | 4 +- .../dojo/src/widget/TreeTimeoutIterator.js | 2 + .../dojo/src/widget/TreeToggleOnSelect.js | 2 + .../struts2/static/dojo/src/widget/TreeV3.js | 2 + .../static/dojo/src/widget/TreeWithNode.js | 2 + .../static/dojo/src/widget/UsTextbox.js | 2 + .../dojo/src/widget/ValidationTextbox.js | 2 + .../struts2/static/dojo/src/widget/Widget.js | 2 + .../struts2/static/dojo/src/widget/Wizard.js | 2 + .../static/dojo/src/widget/YahooMap.js | 2 + .../static/dojo/src/widget/__package__.js | 2 + .../src/widget/demoEngine/DemoContainer.js | 2 + .../dojo/src/widget/demoEngine/DemoItem.js | 2 + .../src/widget/demoEngine/DemoNavigator.js | 2 + .../dojo/src/widget/demoEngine/DemoPane.js | 2 + .../dojo/src/widget/demoEngine/SourcePane.js | 2 + .../dojo/src/widget/demoEngine/__package__.js | 2 + .../static/dojo/src/widget/html/layout.js | 2 + .../static/dojo/src/widget/html/loader.js | 2 + .../static/dojo/src/widget/html/stabile.js | 2 + .../dojo/src/widget/nls/DropdownDatePicker.js | 2 + .../dojo/src/widget/nls/DropdownTimePicker.js | 2 + .../static/dojo/src/widget/nls/TimePicker.js | 2 + .../static/dojo/src/widget/nls/fr/validate.js | 2 + .../static/dojo/src/widget/nls/ja/validate.js | 2 + .../static/dojo/src/widget/nls/validate.js | 2 + .../dojo/src/widget/nls/zh-cn/validate.js | 2 + .../static/dojo/src/widget/svg/Chart.js | 2 + .../static/dojo/src/widget/validate.js | 2 + .../static/dojo/src/widget/vml/Chart.js | 2 + .../struts2/static/dojo/src/xml/Parse.js | 2 + .../static/dojo/src/xml/XslTransform.js | 2 + .../static/dojo/src/xml/__package__.js | 2 + .../dojo/struts/widget/StrutsTabContainer.js | 21 +- .../apache/struts2/static/dojo/struts_dojo.js | 37508 +++++----- .../dojo/struts_dojo.js.uncompressed.js | 62330 ++++++++-------- 415 files changed, 58533 insertions(+), 56293 deletions(-) diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/build.txt b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/build.txt index 8bb8093ff..e5fcdd4c1 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/build.txt +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/build.txt @@ -1,35 +1,35 @@ Files baked into this build: + +dojo.js: dojoGuardStart.js ../src/bootstrap1.js ../src/loader.js dojoGuardEnd.js ../src/hostenv_browser.js -../src/lang/common.js -../src/lang/array.js -../src/lang/extras.js -../src/lang/declare.js -../src/lang/func.js -../src/event/common.js -../src/event/topic.js -../src/event/browser.js -../src/event/__package__.js -../src/event.js ../src/string/common.js -../src/string/extras.js ../src/string.js +../src/lang/common.js +../src/lang/extras.js ../src/io/common.js +../src/lang/array.js +../src/lang/func.js +../src/string/extras.js ../src/dom.js ../src/undo/browser.js ../src/io/BrowserIO.js ../src/io/cookie.js ../src/io/__package__.js -../src/io.js -../src/AdapterRegistry.js -../src/json.js +../src/event/common.js +../src/event/topic.js +../src/event/browser.js +../src/event/__package__.js +../src/gfx/color.js +../src/lfx/Animation.js ../src/html/common.js ../src/uri/Uri.js ../src/html/style.js -../src/html/__package__.js ../src/html/display.js +../src/html/color.js ../src/html/layout.js -../src/html/util.js \ No newline at end of file +../src/lfx/html.js +../src/lfx/__package__.js diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js index 880b39430..c8e5df3e1 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js @@ -33,7 +33,7 @@ dojo.global=function(){ return dj_currentContext; }; dojo.locale=djConfig.locale; -dojo.version={major:0,minor:4,patch:2,flag:"",revision:Number("$Rev: 7616 $".match(/[0-9]+/)[0]),toString:function(){ +dojo.version={major:0,minor:4,patch:3,flag:"",revision:Number("$Rev: 8617 $".match(/[0-9]+/)[0]),toString:function(){ with(dojo.version){ return major+"."+minor+"."+patch+flag+" ("+revision+")"; } @@ -829,7 +829,9 @@ _ce.apply(_cb,arguments); }; return true; } +dojo.hostenv._djInitFired=false; function dj_load_init(e){ +dojo.hostenv._djInitFired=true; var _d0=(e&&e.type)?e.type.toLowerCase():"load"; if(arguments.callee.initialized||(_d0!="domcontentloaded"&&_d0!="load")){ return; @@ -1003,73 +1005,124 @@ return _ec; dojo.requireIf((djConfig["isDebug"]||djConfig["debugAtAllCosts"]),"dojo.debug"); dojo.requireIf(djConfig["debugAtAllCosts"]&&!window.widget&&!djConfig["useXDomain"],"dojo.browser_debug"); dojo.requireIf(djConfig["debugAtAllCosts"]&&!window.widget&&djConfig["useXDomain"],"dojo.browser_debug_xd"); -dojo.provide("dojo.lang.common"); -dojo.lang.inherits=function(_ee,_ef){ -if(!dojo.lang.isFunction(_ef)){ -dojo.raise("dojo.inherits: superclass argument ["+_ef+"] must be a function (subclass: ["+_ee+"']"); +dojo.provide("dojo.string.common"); +dojo.string.trim=function(str,wh){ +if(!str.replace){ +return str; } -_ee.prototype=new _ef(); -_ee.prototype.constructor=_ee; -_ee.superclass=_ef.prototype; -_ee["super"]=_ef.prototype; +if(!str.length){ +return str; +} +var re=(wh>0)?(/^\s+/):(wh<0)?(/\s+$/):(/^\s+|\s+$/g); +return str.replace(re,""); }; -dojo.lang._mixin=function(obj,_f1){ -var _f2={}; -for(var x in _f1){ -if((typeof _f2[x]=="undefined")||(_f2[x]!=_f1[x])){ -obj[x]=_f1[x]; +dojo.string.trimStart=function(str){ +return dojo.string.trim(str,1); +}; +dojo.string.trimEnd=function(str){ +return dojo.string.trim(str,-1); +}; +dojo.string.repeat=function(str,_f4,_f5){ +var out=""; +for(var i=0;i<_f4;i++){ +out+=str; +if(_f5&&i<_f4-1){ +out+=_f5; } } -if(dojo.render.html.ie&&(typeof (_f1["toString"])=="function")&&(_f1["toString"]!=obj["toString"])&&(_f1["toString"]!=_f2["toString"])){ -obj.toString=_f1.toString; +return out; +}; +dojo.string.pad=function(str,len,c,dir){ +var out=String(str); +if(!c){ +c="0"; +} +if(!dir){ +dir=1; +} +while(out.length0){ +out=c+out; +}else{ +out+=c; +} +} +return out; +}; +dojo.string.padLeft=function(str,len,c){ +return dojo.string.pad(str,len,c,1); +}; +dojo.string.padRight=function(str,len,c){ +return dojo.string.pad(str,len,c,-1); +}; +dojo.provide("dojo.string"); +dojo.provide("dojo.lang.common"); +dojo.lang.inherits=function(_103,_104){ +if(!dojo.lang.isFunction(_104)){ +dojo.raise("dojo.inherits: superclass argument ["+_104+"] must be a function (subclass: ["+_103+"']"); +} +_103.prototype=new _104(); +_103.prototype.constructor=_103; +_103.superclass=_104.prototype; +_103["super"]=_104.prototype; +}; +dojo.lang._mixin=function(obj,_106){ +var tobj={}; +for(var x in _106){ +if((typeof tobj[x]=="undefined")||(tobj[x]!=_106[x])){ +obj[x]=_106[x]; +} +} +if(dojo.render.html.ie&&(typeof (_106["toString"])=="function")&&(_106["toString"]!=obj["toString"])&&(_106["toString"]!=tobj["toString"])){ +obj.toString=_106.toString; } return obj; }; -dojo.lang.mixin=function(obj,_f5){ +dojo.lang.mixin=function(obj,_10a){ for(var i=1,l=arguments.length;i-1; +dojo.lang.inArray=function(_11d,_11e){ +return dojo.lang.find(_11d,_11e)>-1; }; dojo.lang.isObject=function(it){ if(typeof it=="undefined"){ @@ -1146,190 +1199,28 @@ return (it instanceof Number||typeof it=="number"); dojo.lang.isUndefined=function(it){ return ((typeof (it)=="undefined")&&(it==undefined)); }; -dojo.provide("dojo.lang.array"); -dojo.lang.mixin(dojo.lang,{has:function(obj,name){ -try{ -return typeof obj[name]!="undefined"; -} -catch(e){ -return false; -} -},isEmpty:function(obj){ -if(dojo.lang.isObject(obj)){ -var tmp={}; -var _118=0; -for(var x in obj){ -if(obj[x]&&(!tmp[x])){ -_118++; -break; -} -} -return _118==0; -}else{ -if(dojo.lang.isArrayLike(obj)||dojo.lang.isString(obj)){ -return obj.length==0; -} -} -},map:function(arr,obj,_11c){ -var _11d=dojo.lang.isString(arr); -if(_11d){ -arr=arr.split(""); -} -if(dojo.lang.isFunction(obj)&&(!_11c)){ -_11c=obj; -obj=dj_global; -}else{ -if(dojo.lang.isFunction(obj)&&_11c){ -var _11e=obj; -obj=_11c; -_11c=_11e; -} -} -if(Array.map){ -var _11f=Array.map(arr,_11c,obj); -}else{ -var _11f=[]; -for(var i=0;i=3){ -dojo.raise("thisObject doesn't exist!"); -} -_13d=dj_global; -} -_13f=[]; -for(var i=0;i0){ +dojo.io.bind(dojo.io._bindQueue.shift()); +}else{ +dojo.io._queueBindInFlight=false; +} +} +}; +dojo.io._bindQueue=[]; +dojo.io._queueBindInFlight=false; +dojo.io.argsFromMap=function(map,_16b,last){ +var enc=/utf/i.test(_16b||"")?encodeURIComponent:dojo.string.encodeAscii; +var _16e=[]; +var _16f=new Object(); +for(var name in map){ +var _171=function(elt){ +var val=enc(name)+"="+enc(elt); +_16e[(last==name)?"push":"unshift"](val); +}; +if(!_16f[name]){ +var _174=map[name]; +if(dojo.lang.isArray(_174)){ +dojo.lang.forEach(_174,_171); +}else{ +_171(_174); +} +} +} +return _16e.join("&"); +}; +dojo.io.setIFrameSrc=function(_175,src,_177){ +try{ +var r=dojo.render.html; +if(!_177){ +if(r.safari){ +_175.location=src; +}else{ +frames[_175.name].location=src; +} +}else{ +var idoc; +if(r.ie){ +idoc=_175.contentWindow.document; +}else{ +if(r.safari){ +idoc=_175.document; +}else{ +idoc=_175.contentWindow; +} +} +if(!idoc){ +_175.location=src; return; +}else{ +idoc.location.replace(src); } -p=p.constructor.superclass; -}while(!(prop in p)); -return (dojo.lang.isFunction(p[prop])?this._contextMethod(p,prop,args):p[prop]); -},inherited:function(prop,args){ -dojo.deprecated("'inherited' method is dangerous, do not up-call! 'inherited' is slated for removal in 0.5; name your super class (or use superclass property) instead.","0.5"); -this._inherited(prop,args); -}}; -dojo.declare=dojo.lang.declare; +} +} +catch(e){ +dojo.debug(e); +dojo.debug("setIFrameSrc: "+e); +} +}; +dojo.provide("dojo.lang.array"); +dojo.lang.mixin(dojo.lang,{has:function(obj,name){ +try{ +return typeof obj[name]!="undefined"; +} +catch(e){ +return false; +} +},isEmpty:function(obj){ +if(dojo.lang.isObject(obj)){ +var tmp={}; +var _17e=0; +for(var x in obj){ +if(obj[x]&&(!tmp[x])){ +_17e++; +break; +} +} +return _17e==0; +}else{ +if(dojo.lang.isArrayLike(obj)||dojo.lang.isString(obj)){ +return obj.length==0; +} +} +},map:function(arr,obj,_182){ +var _183=dojo.lang.isString(arr); +if(_183){ +arr=arr.split(""); +} +if(dojo.lang.isFunction(obj)&&(!_182)){ +_182=obj; +obj=dj_global; +}else{ +if(dojo.lang.isFunction(obj)&&_182){ +var _184=obj; +obj=_182; +_182=_184; +} +} +if(Array.map){ +var _185=Array.map(arr,_182,obj); +}else{ +var _185=[]; +for(var i=0;i=3){ +dojo.raise("thisObject doesn't exist!"); +} +_1a3=dj_global; +} +_1a5=[]; +for(var i=0;i/gm,">").replace(/"/gm,"""); +if(!_1e8){ +str=str.replace(/'/gm,"'"); +} +return str; +}; +dojo.string.escapeSql=function(str){ +return str.replace(/'/gm,"''"); +}; +dojo.string.escapeRegExp=function(str){ +return str.replace(/\\/gm,"\\\\").replace(/([\f\b\n\t\r[\^$|?*+(){}])/gm,"\\$1"); +}; +dojo.string.escapeJavaScript=function(str){ +return str.replace(/(["'\f\b\n\t\r])/gm,"\\$1"); +}; +dojo.string.escapeString=function(str){ +return ("\""+str.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r"); +}; +dojo.string.summary=function(str,len){ +if(!len||str.length<=len){ +return str; +} +return str.substring(0,len).replace(/\.+$/,"")+"..."; +}; +dojo.string.endsWith=function(str,end,_1f1){ +if(_1f1){ +str=str.toLowerCase(); +end=end.toLowerCase(); +} +if((str.length-end.length)<0){ +return false; +} +return str.lastIndexOf(end)==str.length-end.length; +}; +dojo.string.endsWithAny=function(str){ +for(var i=1;i-1){ +return true; +} +} +return false; +}; +dojo.string.normalizeNewlines=function(text,_1fc){ +if(_1fc=="\n"){ +text=text.replace(/\r\n/g,"\n"); +text=text.replace(/\r/g,"\n"); +}else{ +if(_1fc=="\r"){ +text=text.replace(/\r\n/g,"\r"); +text=text.replace(/\n/g,"\r"); +}else{ +text=text.replace(/([^\r])\n/g,"$1\r\n").replace(/\r([^\n])/g,"\r\n$1"); +} +} +return text; +}; +dojo.string.splitEscaped=function(str,_1fe){ +var _1ff=[]; +for(var i=0,_201=0;i0){ +return _224[0]; +} +node=node.parentNode; +} +if(_223){ +return null; +} +return _224; +}; +dojo.dom.getAncestorsByTag=function(node,tag,_228){ +tag=tag.toLowerCase(); +return dojo.dom.getAncestors(node,function(el){ +return ((el.tagName)&&(el.tagName.toLowerCase()==tag)); +},_228); +}; +dojo.dom.getFirstAncestorByTag=function(node,tag){ +return dojo.dom.getAncestorsByTag(node,tag,true); +}; +dojo.dom.isDescendantOf=function(node,_22d,_22e){ +if(_22e&&node){ +node=node.parentNode; +} +while(node){ +if(node==_22d){ +return true; +} +node=node.parentNode; +} +return false; +}; +dojo.dom.innerXML=function(node){ +if(node.innerXML){ +return node.innerXML; +}else{ +if(node.xml){ +return node.xml; +}else{ +if(typeof XMLSerializer!="undefined"){ +return (new XMLSerializer()).serializeToString(node); +} +} +} +}; +dojo.dom.createDocument=function(){ +var doc=null; +var _231=dojo.doc(); +if(!dj_undef("ActiveXObject")){ +var _232=["MSXML2","Microsoft","MSXML","MSXML3"]; +for(var i=0;i<_232.length;i++){ +try{ +doc=new ActiveXObject(_232[i]+".XMLDOM"); +} +catch(e){ +} +if(doc){ +break; +} +} +}else{ +if((_231.implementation)&&(_231.implementation.createDocument)){ +doc=_231.implementation.createDocument("","",null); +} +} +return doc; +}; +dojo.dom.createDocumentFromText=function(str,_235){ +if(!_235){ +_235="text/xml"; +} +if(!dj_undef("DOMParser")){ +var _236=new DOMParser(); +return _236.parseFromString(str,_235); +}else{ +if(!dj_undef("ActiveXObject")){ +var _237=dojo.dom.createDocument(); +if(_237){ +_237.async=false; +_237.loadXML(str); +return _237; +}else{ +dojo.debug("toXml didn't work?"); +} +}else{ +var _238=dojo.doc(); +if(_238.createElement){ +var tmp=_238.createElement("xml"); +tmp.innerHTML=str; +if(_238.implementation&&_238.implementation.createDocument){ +var _23a=_238.implementation.createDocument("foo","",null); +for(var i=0;i1){ +var _24f=dojo.doc(); +dojo.dom.replaceChildren(node,_24f.createTextNode(text)); +return text; +}else{ +if(node.textContent!=undefined){ +return node.textContent; +} +var _250=""; +if(node==null){ +return _250; +} +for(var i=0;i"); +} +} +catch(e){ +} +if(dojo.render.html.opera){ +dojo.debug("Opera is not supported with dojo.undo.browser, so back/forward detection will not work."); +} +dojo.undo.browser={initialHref:(!dj_undef("window"))?window.location.href:"",initialHash:(!dj_undef("window"))?window.location.hash:"",moveForward:false,historyStack:[],forwardStack:[],historyIframe:null,bookmarkAnchor:null,locationTimer:null,setInitialState:function(args){ +this.initialState=this._createState(this.initialHref,args,this.initialHash); +},addToHistory:function(args){ +this.forwardStack=[]; +var hash=null; +var url=null; +if(!this.historyIframe){ +if(djConfig["useXDomain"]&&!djConfig["dojoIframeHistoryUrl"]){ +dojo.debug("dojo.undo.browser: When using cross-domain Dojo builds,"+" please save iframe_history.html to your domain and set djConfig.dojoIframeHistoryUrl"+" to the path on your domain to iframe_history.html"); +} +this.historyIframe=window.frames["djhistory"]; +} +if(!this.bookmarkAnchor){ +this.bookmarkAnchor=document.createElement("a"); +dojo.body().appendChild(this.bookmarkAnchor); +this.bookmarkAnchor.style.display="none"; +} +if(args["changeUrl"]){ +hash="#"+((args["changeUrl"]!==true)?args["changeUrl"]:(new Date()).getTime()); +if(this.historyStack.length==0&&this.initialState.urlHash==hash){ +this.initialState=this._createState(url,args,hash); +return; +}else{ +if(this.historyStack.length>0&&this.historyStack[this.historyStack.length-1].urlHash==hash){ +this.historyStack[this.historyStack.length-1]=this._createState(url,args,hash); +return; +} +} +this.changingUrl=true; +setTimeout("window.location.href = '"+hash+"'; dojo.undo.browser.changingUrl = false;",1); +this.bookmarkAnchor.href=hash; +if(dojo.render.html.ie){ +url=this._loadIframeHistory(); +var _25f=args["back"]||args["backButton"]||args["handle"]; +var tcb=function(_261){ +if(window.location.hash!=""){ +setTimeout("window.location.href = '"+hash+"';",1); +} +_25f.apply(this,[_261]); +}; +if(args["back"]){ +args.back=tcb; +}else{ +if(args["backButton"]){ +args.backButton=tcb; +}else{ +if(args["handle"]){ +args.handle=tcb; +} +} +} +var _262=args["forward"]||args["forwardButton"]||args["handle"]; +var tfw=function(_264){ +if(window.location.hash!=""){ +window.location.href=hash; +} +if(_262){ +_262.apply(this,[_264]); +} +}; +if(args["forward"]){ +args.forward=tfw; +}else{ +if(args["forwardButton"]){ +args.forwardButton=tfw; +}else{ +if(args["handle"]){ +args.handle=tfw; +} +} +} +}else{ +if(dojo.render.html.moz){ +if(!this.locationTimer){ +this.locationTimer=setInterval("dojo.undo.browser.checkLocation();",200); +} +} +} +}else{ +url=this._loadIframeHistory(); +} +this.historyStack.push(this._createState(url,args,hash)); +},checkLocation:function(){ +if(!this.changingUrl){ +var hsl=this.historyStack.length; +if((window.location.hash==this.initialHash||window.location.href==this.initialHref)&&(hsl==1)){ +this.handleBackButton(); +return; +} +if(this.forwardStack.length>0){ +if(this.forwardStack[this.forwardStack.length-1].urlHash==window.location.hash){ +this.handleForwardButton(); +return; +} +} +if((hsl>=2)&&(this.historyStack[hsl-2])){ +if(this.historyStack[hsl-2].urlHash==window.location.hash){ +this.handleBackButton(); +return; +} +} +} +},iframeLoaded:function(evt,_267){ +if(!dojo.render.html.opera){ +var _268=this._getUrlQuery(_267.href); +if(_268==null){ +if(this.historyStack.length==1){ +this.handleBackButton(); +} +return; +} +if(this.moveForward){ +this.moveForward=false; +return; +} +if(this.historyStack.length>=2&&_268==this._getUrlQuery(this.historyStack[this.historyStack.length-2].url)){ +this.handleBackButton(); +}else{ +if(this.forwardStack.length>0&&_268==this._getUrlQuery(this.forwardStack[this.forwardStack.length-1].url)){ +this.handleForwardButton(); +} +} +} +},handleBackButton:function(){ +var _269=this.historyStack.pop(); +if(!_269){ +return; +} +var last=this.historyStack[this.historyStack.length-1]; +if(!last&&this.historyStack.length==0){ +last=this.initialState; +} +if(last){ +if(last.kwArgs["back"]){ +last.kwArgs["back"](); +}else{ +if(last.kwArgs["backButton"]){ +last.kwArgs["backButton"](); +}else{ +if(last.kwArgs["handle"]){ +last.kwArgs.handle("back"); +} +} +} +} +this.forwardStack.push(_269); +},handleForwardButton:function(){ +var last=this.forwardStack.pop(); +if(!last){ +return; +} +if(last.kwArgs["forward"]){ +last.kwArgs.forward(); +}else{ +if(last.kwArgs["forwardButton"]){ +last.kwArgs.forwardButton(); +}else{ +if(last.kwArgs["handle"]){ +last.kwArgs.handle("forward"); +} +} +} +this.historyStack.push(last); +},_createState:function(url,args,hash){ +return {"url":url,"kwArgs":args,"urlHash":hash}; +},_getUrlQuery:function(url){ +var _270=url.split("?"); +if(_270.length<2){ +return null; +}else{ +return _270[1]; +} +},_loadIframeHistory:function(){ +var url=(djConfig["dojoIframeHistoryUrl"]||dojo.hostenv.getBaseScriptUri()+"iframe_history.html")+"?"+(new Date()).getTime(); +this.moveForward=true; +dojo.io.setIFrameSrc(this.historyIframe,url,false); +return url; +}}; +dojo.provide("dojo.io.BrowserIO"); +if(!dj_undef("window")){ +dojo.io.checkChildrenForFile=function(node){ +var _273=false; +var _274=node.getElementsByTagName("input"); +dojo.lang.forEach(_274,function(_275){ +if(_273){ +return; +} +if(_275.getAttribute("type")=="file"){ +_273=true; +} +}); +return _273; +}; +dojo.io.formHasFile=function(_276){ +return dojo.io.checkChildrenForFile(_276); +}; +dojo.io.updateNode=function(node,_278){ +node=dojo.byId(node); +var args=_278; +if(dojo.lang.isString(_278)){ +args={url:_278}; +} +args.mimetype="text/html"; +args.load=function(t,d,e){ +while(node.firstChild){ +dojo.dom.destroyNode(node.firstChild); +} +node.innerHTML=d; +}; +dojo.io.bind(args); +}; +dojo.io.formFilter=function(node){ +var type=(node.type||"").toLowerCase(); +return !node.disabled&&node.name&&!dojo.lang.inArray(["file","submit","image","reset","button"],type); +}; +dojo.io.encodeForm=function(_27f,_280,_281){ +if((!_27f)||(!_27f.tagName)||(!_27f.tagName.toLowerCase()=="form")){ +dojo.raise("Attempted to encode a non-form element."); +} +if(!_281){ +_281=dojo.io.formFilter; +} +var enc=/utf/i.test(_280||"")?encodeURIComponent:dojo.string.encodeAscii; +var _283=[]; +for(var i=0;i<_27f.elements.length;i++){ +var elm=_27f.elements[i]; +if(!elm||elm.tagName.toLowerCase()=="fieldset"||!_281(elm)){ +continue; +} +var name=enc(elm.name); +var type=elm.type.toLowerCase(); +if(type=="select-multiple"){ +for(var j=0;j=200)&&(http.status<300))||(http.status==304)||(http.status==1223)||(location.protocol=="file:"&&(http.status==0||http.status==undefined))||(location.protocol=="chrome:"&&(http.status==0||http.status==undefined))){ +var ret; +if(_2aa.method.toLowerCase()=="head"){ +var _2b0=http.getAllResponseHeaders(); +ret={}; +ret.toString=function(){ +return _2b0; +}; +var _2b1=_2b0.split(/[\r\n]+/g); +for(var i=0;i<_2b1.length;i++){ +var pair=_2b1[i].match(/^([^:]+)\s*:\s*(.+)$/i); +if(pair){ +ret[pair[1]]=pair[2]; +} +} +}else{ +if(_2aa.mimetype=="text/javascript"){ +try{ +ret=dj_eval(http.responseText); +} +catch(e){ +dojo.debug(e); +dojo.debug(http.responseText); +ret=null; +} +}else{ +if(_2aa.mimetype.substr(0,9)=="text/json"||_2aa.mimetype.substr(0,16)=="application/json"){ +try{ +ret=dj_eval("("+_2aa.jsonFilter(http.responseText)+")"); +} +catch(e){ +dojo.debug(e); +dojo.debug(http.responseText); +ret=false; +} +}else{ +if((_2aa.mimetype=="application/xml")||(_2aa.mimetype=="text/xml")){ +ret=http.responseXML; +if(!ret||typeof ret=="string"||!http.getResponseHeader("Content-Type")){ +ret=dojo.dom.createDocumentFromText(http.responseText); +} +}else{ +ret=http.responseText; +} +} +} +} +if(_2ae){ +addToCache(url,_2ad,_2aa.method,http); +} +_2aa[(typeof _2aa.load=="function")?"load":"handle"]("load",ret,http,_2aa); +}else{ +var _2b4=new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText); +_2aa[(typeof _2aa.error=="function")?"error":"handle"]("error",_2b4,http,_2aa); +} +} +function setHeaders(http,_2b6){ +if(_2b6["headers"]){ +for(var _2b7 in _2b6["headers"]){ +if(_2b7.toLowerCase()=="content-type"&&!_2b6["contentType"]){ +_2b6["contentType"]=_2b6["headers"][_2b7]; +}else{ +http.setRequestHeader(_2b7,_2b6["headers"][_2b7]); +} +} +} +} +this.inFlight=[]; +this.inFlightTimer=null; +this.startWatchingInFlight=function(){ +if(!this.inFlightTimer){ +this.inFlightTimer=setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();",10); +} +}; +this.watchInFlight=function(){ +var now=null; +if(!dojo.hostenv._blockAsync&&!_29e._blockAsync){ +for(var x=this.inFlight.length-1;x>=0;x--){ +try{ +var tif=this.inFlight[x]; +if(!tif||tif.http._aborted||!tif.http.readyState){ +this.inFlight.splice(x,1); +continue; +} +if(4==tif.http.readyState){ +this.inFlight.splice(x,1); +doLoad(tif.req,tif.http,tif.url,tif.query,tif.useCache); +}else{ +if(tif.startTime){ +if(!now){ +now=(new Date()).getTime(); +} +if(tif.startTime+(tif.req.timeoutSeconds*1000)-1){ +dojo.debug("Warning: dojo.io.bind: stripping hash values from url:",url); +url=url.split("#")[0]; +} +if(_2bf["file"]){ +_2bf.method="post"; +} +if(!_2bf["method"]){ +_2bf.method="get"; +} +if(_2bf.method.toLowerCase()=="get"){ +_2bf.multipart=false; +}else{ +if(_2bf["file"]){ +_2bf.multipart=true; +}else{ +if(!_2bf["multipart"]){ +_2bf.multipart=false; +} +} +} +if(_2bf["backButton"]||_2bf["back"]||_2bf["changeUrl"]){ +dojo.undo.browser.addToHistory(_2bf); +} +var _2c4=_2bf["content"]||{}; +if(_2bf.sendTransport){ +_2c4["dojo.transport"]="xmlhttp"; +} +do{ +if(_2bf.postContent){ +_2c1=_2bf.postContent; +break; +} +if(_2c4){ +_2c1+=dojo.io.argsFromMap(_2c4,_2bf.encoding); +} +if(_2bf.method.toLowerCase()=="get"||!_2bf.multipart){ +break; +} +var t=[]; +if(_2c1.length){ +var q=_2c1.split("&"); +for(var i=0;i-1?"&":"?")+_2c1; +} +if(_2cb){ +_2d1+=(dojo.string.endsWithAny(_2d1,"?","&")?"":(_2d1.indexOf("?")>-1?"&":"?"))+"dojo.preventCache="+new Date().valueOf(); +} +if(!_2bf.user){ +http.open(_2bf.method.toUpperCase(),_2d1,_2ca); +}else{ +http.open(_2bf.method.toUpperCase(),_2d1,_2ca,_2bf.user,_2bf.password); +} +setHeaders(http,_2bf); +try{ +http.send(null); +} +catch(e){ +if(typeof http.abort=="function"){ +http.abort(); +} +doLoad(_2bf,{status:404},url,_2c1,_2cc); +} +} +if(!_2ca){ +doLoad(_2bf,http,url,_2c1,_2cc); +_29e._blockAsync=false; +} +_2bf.abort=function(){ +try{ +http._aborted=true; +} +catch(e){ +} +return http.abort(); +}; +return; +}; +dojo.io.transports.addTransport("XMLHTTPTransport"); +}; +} +dojo.provide("dojo.io.cookie"); +dojo.io.cookie.setCookie=function(name,_2d3,days,path,_2d6,_2d7){ +var _2d8=-1; +if((typeof days=="number")&&(days>=0)){ +var d=new Date(); +d.setTime(d.getTime()+(days*24*60*60*1000)); +_2d8=d.toGMTString(); +} +_2d3=escape(_2d3); +document.cookie=name+"="+_2d3+";"+(_2d8!=-1?" expires="+_2d8+";":"")+(path?"path="+path:"")+(_2d6?"; domain="+_2d6:"")+(_2d7?"; secure":""); +}; +dojo.io.cookie.set=dojo.io.cookie.setCookie; +dojo.io.cookie.getCookie=function(name){ +var idx=document.cookie.lastIndexOf(name+"="); +if(idx==-1){ +return null; +} +var _2dc=document.cookie.substring(idx+name.length+1); +var end=_2dc.indexOf(";"); +if(end==-1){ +end=_2dc.length; +} +_2dc=_2dc.substring(0,end); +_2dc=unescape(_2dc); +return _2dc; +}; +dojo.io.cookie.get=dojo.io.cookie.getCookie; +dojo.io.cookie.deleteCookie=function(name){ +dojo.io.cookie.setCookie(name,"-",0); +}; +dojo.io.cookie.setObjectCookie=function(name,obj,days,path,_2e3,_2e4,_2e5){ +if(arguments.length==5){ +_2e5=_2e3; +_2e3=null; +_2e4=null; +} +var _2e6=[],_2e7,_2e8=""; +if(!_2e5){ +_2e7=dojo.io.cookie.getObjectCookie(name); +} +if(days>=0){ +if(!_2e7){ +_2e7={}; +} +for(var prop in obj){ +if(obj[prop]==null){ +delete _2e7[prop]; +}else{ +if((typeof obj[prop]=="string")||(typeof obj[prop]=="number")){ +_2e7[prop]=obj[prop]; +} +} +} +prop=null; +for(var prop in _2e7){ +_2e6.push(escape(prop)+"="+escape(_2e7[prop])); +} +_2e8=_2e6.join("&"); +} +dojo.io.cookie.setCookie(name,_2e8,days,path,_2e3,_2e4); +}; +dojo.io.cookie.getObjectCookie=function(name){ +var _2eb=null,_2ec=dojo.io.cookie.getCookie(name); +if(_2ec){ +_2eb={}; +var _2ed=_2ec.split("&"); +for(var i=0;i<_2ed.length;i++){ +var pair=_2ed[i].split("="); +var _2f0=pair[1]; +if(isNaN(_2f0)){ +_2f0=unescape(pair[1]); +} +_2eb[unescape(pair[0])]=_2f0; +} +} +return _2eb; +}; +dojo.io.cookie.isSupported=function(){ +if(typeof navigator.cookieEnabled!="boolean"){ +dojo.io.cookie.setCookie("__TestingYourBrowserForCookieSupport__","CookiesAllowed",90,null); +var _2f1=dojo.io.cookie.getCookie("__TestingYourBrowserForCookieSupport__"); +navigator.cookieEnabled=(_2f1=="CookiesAllowed"); +if(navigator.cookieEnabled){ +this.deleteCookie("__TestingYourBrowserForCookieSupport__"); +} +} +return navigator.cookieEnabled; +}; +if(!dojo.io.cookies){ +dojo.io.cookies=dojo.io.cookie; +} +dojo.kwCompoundRequire({common:["dojo.io.common"],rhino:["dojo.io.RhinoIO"],browser:["dojo.io.BrowserIO","dojo.io.cookie"],dashboard:["dojo.io.BrowserIO","dojo.io.cookie"]}); +dojo.provide("dojo.io.*"); dojo.provide("dojo.event.common"); dojo.event=new function(){ this._canTimeout=dojo.lang.isFunction(dj_global["setTimeout"])||dojo.lang.isAlien(dj_global["setTimeout"]); -function interpolateArgs(args,_19b){ +function interpolateArgs(args,_2f3){ var dl=dojo.lang; var ao={srcObj:dj_global,srcFunc:null,adviceObj:dj_global,adviceFunc:null,aroundObj:null,aroundFunc:null,adviceType:(args.length>2)?args[0]:"after",precedence:"last",once:false,delay:null,rate:0,adviceMsg:false,maxCalls:-1}; switch(args.length){ @@ -1627,14 +3099,14 @@ if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isFunction(args[2]))){ ao.adviceType="after"; ao.srcObj=args[0]; ao.srcFunc=args[1]; -var _19e=dl.nameAnonFunc(args[2],ao.adviceObj,_19b); -ao.adviceFunc=_19e; +var _2f6=dl.nameAnonFunc(args[2],ao.adviceObj,_2f3); +ao.adviceFunc=_2f6; }else{ if((dl.isFunction(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))){ ao.adviceType="after"; ao.srcObj=dj_global; -var _19e=dl.nameAnonFunc(args[0],ao.srcObj,_19b); -ao.srcFunc=_19e; +var _2f6=dl.nameAnonFunc(args[0],ao.srcObj,_2f3); +ao.srcFunc=_2f6; ao.adviceObj=args[1]; ao.adviceFunc=args[2]; } @@ -1660,17 +3132,17 @@ ao.adviceFunc=args[3]; if((dl.isString(args[0]))&&(dl.isFunction(args[1]))&&(dl.isObject(args[2]))){ ao.adviceType=args[0]; ao.srcObj=dj_global; -var _19e=dl.nameAnonFunc(args[1],dj_global,_19b); -ao.srcFunc=_19e; +var _2f6=dl.nameAnonFunc(args[1],dj_global,_2f3); +ao.srcFunc=_2f6; ao.adviceObj=args[2]; ao.adviceFunc=args[3]; }else{ if((dl.isString(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))&&(dl.isFunction(args[3]))){ ao.srcObj=args[1]; ao.srcFunc=args[2]; -var _19e=dl.nameAnonFunc(args[3],dj_global,_19b); +var _2f6=dl.nameAnonFunc(args[3],dj_global,_2f3); ao.adviceObj=dj_global; -ao.adviceFunc=_19e; +ao.adviceFunc=_2f6; }else{ if(dl.isObject(args[1])){ ao.srcObj=args[1]; @@ -1718,8 +3190,8 @@ ao.maxCalls=(!isNaN(parseInt(args[11])))?args[11]:-1; break; } if(dl.isFunction(ao.aroundFunc)){ -var _19e=dl.nameAnonFunc(ao.aroundFunc,ao.aroundObj,_19b); -ao.aroundFunc=_19e; +var _2f6=dl.nameAnonFunc(ao.aroundFunc,ao.aroundObj,_2f3); +ao.aroundFunc=_2f6; } if(dl.isFunction(ao.srcFunc)){ ao.srcFunc=dl.getNameInObj(ao.srcObj,ao.srcFunc); @@ -1748,18 +3220,25 @@ var ao=arguments[0]; }else{ var ao=interpolateArgs(arguments,true); } +if(dojo.lang.isString(ao.srcFunc)&&(ao.srcFunc.toLowerCase()=="onkey")){ +if(dojo.render.html.ie){ +ao.srcFunc="onkeydown"; +this.connect(ao); +} +ao.srcFunc="onkeypress"; +} if(dojo.lang.isArray(ao.srcObj)&&ao.srcObj!=""){ -var _1a0={}; +var _2f8={}; for(var x in ao){ -_1a0[x]=ao[x]; +_2f8[x]=ao[x]; } var mjps=[]; dojo.lang.forEach(ao.srcObj,function(src){ if((dojo.render.html.capable)&&(dojo.lang.isString(src))){ src=dojo.byId(src); } -_1a0.srcObj=src; -mjps.push(dojo.event.connect.call(dojo.event,_1a0)); +_2f8.srcObj=src; +mjps.push(dojo.event.connect.call(dojo.event,_2f8)); }); return mjps; } @@ -1771,20 +3250,20 @@ mjp.kwAddAdvice(ao); return mjp; }; this.log=function(a1,a2){ -var _1a8; +var _300; if((arguments.length==1)&&(typeof a1=="object")){ -_1a8=a1; +_300=a1; }else{ -_1a8={srcObj:a1,srcFunc:a2}; +_300={srcObj:a1,srcFunc:a2}; } -_1a8.adviceFunc=function(){ -var _1a9=[]; +_300.adviceFunc=function(){ +var _301=[]; for(var x=0;x-1){ -if(_1d8==0){ +var _330=marr[7]; +if(_330>-1){ +if(_330==0){ return; } marr[7]--; } -var _1d9; +var _331; var to={args:[],jp_:this,object:obj,proceed:function(){ -return _1d3[_1d4].apply(_1d3,to.args); +return _32b[_32c].apply(_32b,to.args); }}; -to.args=_1cf; -var _1db=parseInt(marr[4]); -var _1dc=((!isNaN(_1db))&&(marr[4]!==null)&&(typeof marr[4]!="undefined")); +to.args=_327; +var _333=parseInt(marr[4]); +var _334=((!isNaN(_333))&&(marr[4]!==null)&&(typeof marr[4]!="undefined")); if(marr[5]){ var rate=parseInt(marr[5]); var cur=new Date(); -var _1df=false; +var _337=false; if((marr["last"])&&((cur-marr.last)<=rate)){ if(dojo.event._canTimeout){ if(marr["delayTimer"]){ @@ -2011,7 +3490,7 @@ var tod=parseInt(rate*2); var mcpy=dojo.lang.shallowCopy(marr); marr.delayTimer=setTimeout(function(){ mcpy[5]=0; -_1d1(mcpy); +_329(mcpy); },tod); } return; @@ -2019,49 +3498,49 @@ return; marr.last=cur; } } -if(_1d6){ -_1d5[_1d6].call(_1d5,to); +if(_32e){ +_32d[_32e].call(_32d,to); }else{ -if((_1dc)&&((dojo.render.html)||(dojo.render.svg))){ +if((_334)&&((dojo.render.html)||(dojo.render.svg))){ dj_global["setTimeout"](function(){ if(msg){ -_1d3[_1d4].call(_1d3,to); +_32b[_32c].call(_32b,to); }else{ -_1d3[_1d4].apply(_1d3,args); +_32b[_32c].apply(_32b,args); } -},_1db); +},_333); }else{ if(msg){ -_1d3[_1d4].call(_1d3,to); +_32b[_32c].call(_32b,to); }else{ -_1d3[_1d4].apply(_1d3,args); +_32b[_32c].apply(_32b,args); } } } }; -var _1e2=function(){ +var _33a=function(){ if(this.squelch){ try{ -return _1d1.apply(this,arguments); +return _329.apply(this,arguments); } catch(e){ dojo.debug(e); } }else{ -return _1d1.apply(this,arguments); +return _329.apply(this,arguments); } }; if((this["before"])&&(this.before.length>0)){ -dojo.lang.forEach(this.before.concat(new Array()),_1e2); +dojo.lang.forEach(this.before.concat(new Array()),_33a); } -var _1e3; +var _33b; try{ if((this["around"])&&(this.around.length>0)){ var mi=new dojo.event.MethodInvocation(this,obj,args); -_1e3=mi.proceed(); +_33b=mi.proceed(); }else{ if(this.methodfunc){ -_1e3=this.object[this.methodname].apply(this.object,args); +_33b=this.object[this.methodname].apply(this.object,args); } } } @@ -2072,9 +3551,9 @@ dojo.raise(e); } } if((this["after"])&&(this.after.length>0)){ -dojo.lang.forEach(this.after.concat(new Array()),_1e2); +dojo.lang.forEach(this.after.concat(new Array()),_33a); } -return (this.methodfunc)?_1e3:null; +return (this.methodfunc)?_33b:null; },getArr:function(kind){ var type="after"; if((typeof kind=="string")&&(kind.indexOf("before")!=-1)){ @@ -2090,38 +3569,38 @@ this[type]=[]; return this[type]; },kwAddAdvice:function(args){ this.addAdvice(args["adviceObj"],args["adviceFunc"],args["aroundObj"],args["aroundFunc"],args["adviceType"],args["precedence"],args["once"],args["delay"],args["rate"],args["adviceMsg"],args["maxCalls"]); -},addAdvice:function(_1e8,_1e9,_1ea,_1eb,_1ec,_1ed,once,_1ef,rate,_1f1,_1f2){ -var arr=this.getArr(_1ec); +},addAdvice:function(_340,_341,_342,_343,_344,_345,once,_347,rate,_349,_34a){ +var arr=this.getArr(_344); if(!arr){ dojo.raise("bad this: "+this); } -var ao=[_1e8,_1e9,_1ea,_1eb,_1ef,rate,_1f1,_1f2]; +var ao=[_340,_341,_342,_343,_347,rate,_349,_34a]; if(once){ -if(this.hasAdvice(_1e8,_1e9,_1ec,arr)>=0){ +if(this.hasAdvice(_340,_341,_344,arr)>=0){ return; } } -if(_1ed=="first"){ +if(_345=="first"){ arr.unshift(ao); }else{ arr.push(ao); } -},hasAdvice:function(_1f5,_1f6,_1f7,arr){ +},hasAdvice:function(_34d,_34e,_34f,arr){ if(!arr){ -arr=this.getArr(_1f7); +arr=this.getArr(_34f); } var ind=-1; for(var x=0;x=0;i=i-1){ var el=na[i]; try{ @@ -2290,9 +3769,9 @@ dojo._ie_clobber.clobberNodes=[]; }); } dojo.event.browser=new function(){ -var _22c=0; -this.normalizedEventName=function(_22d){ -switch(_22d){ +var _384=0; +this.normalizedEventName=function(_385){ +switch(_385){ case "CheckboxStateChange": case "DOMAttrModified": case "DOMMenuItemActive": @@ -2301,10 +3780,10 @@ case "DOMMouseScroll": case "DOMNodeInserted": case "DOMNodeRemoved": case "RadioStateChange": -return _22d; +return _385; break; default: -var lcn=_22d.toLowerCase(); +var lcn=_385.toLowerCase(); return (lcn.indexOf("on")==0)?lcn.substr(2):lcn; break; } @@ -2324,88 +3803,88 @@ dojo._ie_clobber.clobberNodes.push(node); node.__clobberAttrs__=[]; } }; -this.addClobberNodeAttrs=function(node,_232){ +this.addClobberNodeAttrs=function(node,_38a){ if(!dojo.render.html.ie){ return; } this.addClobberNode(node); -for(var x=0;x<_232.length;x++){ -node.__clobberAttrs__.push(_232[x]); +for(var x=0;x<_38a.length;x++){ +node.__clobberAttrs__.push(_38a[x]); } }; -this.removeListener=function(node,_235,fp,_237){ -if(!_237){ -var _237=false; +this.removeListener=function(node,_38d,fp,_38f){ +if(!_38f){ +var _38f=false; } -_235=dojo.event.browser.normalizedEventName(_235); -if(_235=="key"){ +_38d=dojo.event.browser.normalizedEventName(_38d); +if(_38d=="key"){ if(dojo.render.html.ie){ -this.removeListener(node,"onkeydown",fp,_237); +this.removeListener(node,"onkeydown",fp,_38f); } -_235="keypress"; +_38d="keypress"; } if(node.removeEventListener){ -node.removeEventListener(_235,fp,_237); +node.removeEventListener(_38d,fp,_38f); } }; -this.addListener=function(node,_239,fp,_23b,_23c){ +this.addListener=function(node,_391,fp,_393,_394){ if(!node){ return; } -if(!_23b){ -var _23b=false; +if(!_393){ +var _393=false; } -_239=dojo.event.browser.normalizedEventName(_239); -if(_239=="key"){ +_391=dojo.event.browser.normalizedEventName(_391); +if(_391=="key"){ if(dojo.render.html.ie){ -this.addListener(node,"onkeydown",fp,_23b,_23c); +this.addListener(node,"onkeydown",fp,_393,_394); } -_239="keypress"; +_391="keypress"; } -if(!_23c){ -var _23d=function(evt){ +if(!_394){ +var _395=function(evt){ if(!evt){ evt=window.event; } var ret=fp(dojo.event.browser.fixEvent(evt,this)); -if(_23b){ +if(_393){ dojo.event.browser.stopEvent(evt); } return ret; }; }else{ -_23d=fp; +_395=fp; } if(node.addEventListener){ -node.addEventListener(_239,_23d,_23b); -return _23d; +node.addEventListener(_391,_395,_393); +return _395; }else{ -_239="on"+_239; -if(typeof node[_239]=="function"){ -var _240=node[_239]; -node[_239]=function(e){ -_240(e); -return _23d(e); +_391="on"+_391; +if(typeof node[_391]=="function"){ +var _398=node[_391]; +node[_391]=function(e){ +_398(e); +return _395(e); }; }else{ -node[_239]=_23d; +node[_391]=_395; } if(dojo.render.html.ie){ -this.addClobberNodeAttrs(node,[_239]); +this.addClobberNodeAttrs(node,[_391]); } -return _23d; +return _395; } }; this.isEvent=function(obj){ return (typeof obj!="undefined")&&(obj)&&(typeof Event!="undefined")&&(obj.eventPhase); }; this.currentEvent=null; -this.callListener=function(_243,_244){ -if(typeof _243!="function"){ -dojo.raise("listener not a function: "+_243); +this.callListener=function(_39b,_39c){ +if(typeof _39b!="function"){ +dojo.raise("listener not a function: "+_39b); } -dojo.event.browser.currentEvent.currentTarget=_244; -return _243.call(_244,dojo.event.browser.currentEvent); +dojo.event.browser.currentEvent.currentTarget=_39c; +return _39b.call(_39c,dojo.event.browser.currentEvent); }; this._stopPropagation=function(){ dojo.event.browser.currentEvent.cancelBubble=true; @@ -2418,7 +3897,7 @@ this.revKeys=[]; for(var key in this.keys){ this.revKeys[this.keys[key]]=key; } -this.fixEvent=function(evt,_247){ +this.fixEvent=function(evt,_39f){ if(!evt){ if(window["event"]){ evt=window.event; @@ -2495,14 +3974,14 @@ evt.key=evt.keyCode; break; default: if(evt.ctrlKey||evt.altKey){ -var _249=evt.keyCode; -if(_249>=65&&_249<=90&&evt.shiftKey==false){ -_249+=32; +var _3a1=evt.keyCode; +if(_3a1>=65&&_3a1<=90&&evt.shiftKey==false){ +_3a1+=32; } -if(_249>=1&&_249<=26&&evt.ctrlKey){ -_249+=96; +if(_3a1>=1&&_3a1<=26&&evt.ctrlKey){ +_3a1+=96; } -evt.key=String.fromCharCode(_249); +evt.key=String.fromCharCode(_3a1); } } }else{ @@ -2528,11 +4007,11 @@ case evt.KEY_ESCAPE: evt.key=evt.which; break; default: -var _249=evt.which; +var _3a1=evt.which; if((evt.ctrlKey||evt.altKey||evt.metaKey)&&(evt.which>=65&&evt.which<=90&&evt.shiftKey==false)){ -_249+=32; +_3a1+=32; } -evt.key=String.fromCharCode(_249); +evt.key=String.fromCharCode(_3a1); } } } @@ -2637,7 +4116,7 @@ if(!evt.target){ evt.target=evt.srcElement; } if(!evt.currentTarget){ -evt.currentTarget=(_247?_247:evt.srcElement); +evt.currentTarget=(_39f?_39f:evt.srcElement); } if(!evt.layerX){ evt.layerX=evt.offsetX; @@ -2646,12 +4125,12 @@ if(!evt.layerY){ evt.layerY=evt.offsetY; } var doc=(evt.srcElement&&evt.srcElement.ownerDocument)?evt.srcElement.ownerDocument:document; -var _24b=((dojo.render.html.ie55)||(doc["compatMode"]=="BackCompat"))?doc.body:doc.documentElement; +var _3a3=((dojo.render.html.ie55)||(doc["compatMode"]=="BackCompat"))?doc.body:doc.documentElement; if(!evt.pageX){ -evt.pageX=evt.clientX+(_24b.scrollLeft||0); +evt.pageX=evt.clientX+(_3a3.scrollLeft||0); } if(!evt.pageY){ -evt.pageY=evt.clientY+(_24b.scrollTop||0); +evt.pageY=evt.clientY+(_3a3.scrollTop||0); } if(evt.type=="mouseover"){ evt.relatedTarget=evt.fromElement; @@ -2678,1665 +4157,531 @@ evt.stopPropagation(); }; dojo.kwCompoundRequire({common:["dojo.event.common","dojo.event.topic"],browser:["dojo.event.browser"],dashboard:["dojo.event.browser"]}); dojo.provide("dojo.event.*"); -dojo.provide("dojo.event"); -dojo.deprecated("dojo.event","replaced by dojo.event.*","0.5"); -dojo.provide("dojo.string.common"); -dojo.string.trim=function(str,wh){ -if(!str.replace){ -return str; -} -if(!str.length){ -return str; -} -var re=(wh>0)?(/^\s+/):(wh<0)?(/\s+$/):(/^\s+|\s+$/g); -return str.replace(re,""); -}; -dojo.string.trimStart=function(str){ -return dojo.string.trim(str,1); -}; -dojo.string.trimEnd=function(str){ -return dojo.string.trim(str,-1); -}; -dojo.string.repeat=function(str,_253,_254){ -var out=""; -for(var i=0;i<_253;i++){ -out+=str; -if(_254&&i<_253-1){ -out+=_254; -} -} -return out; -}; -dojo.string.pad=function(str,len,c,dir){ -var out=String(str); -if(!c){ -c="0"; -} -if(!dir){ -dir=1; -} -while(out.length0){ -out=c+out; +dojo.provide("dojo.gfx.color"); +dojo.gfx.color.Color=function(r,g,b,a){ +if(dojo.lang.isArray(r)){ +this.r=r[0]; +this.g=r[1]; +this.b=r[2]; +this.a=r[3]||1; }else{ -out+=c; +if(dojo.lang.isString(r)){ +var rgb=dojo.gfx.color.extractRGB(r); +this.r=rgb[0]; +this.g=rgb[1]; +this.b=rgb[2]; +this.a=g||1; +}else{ +if(r instanceof dojo.gfx.color.Color){ +this.r=r.r; +this.b=r.b; +this.g=r.g; +this.a=r.a; +}else{ +this.r=r; +this.g=g; +this.b=b; +this.a=a; } } -return out; -}; -dojo.string.padLeft=function(str,len,c){ -return dojo.string.pad(str,len,c,1); -}; -dojo.string.padRight=function(str,len,c){ -return dojo.string.pad(str,len,c,-1); -}; -dojo.provide("dojo.string.extras"); -dojo.string.substituteParams=function(_262,hash){ -var map=(typeof hash=="object")?hash:dojo.lang.toArray(arguments,1); -return _262.replace(/\%\{(\w+)\}/g,function(_265,key){ -if(typeof (map[key])!="undefined"&&map[key]!=null){ -return map[key]; } -dojo.raise("Substitution not found: "+key); +}; +dojo.gfx.color.Color.fromArray=function(arr){ +return new dojo.gfx.color.Color(arr[0],arr[1],arr[2],arr[3]); +}; +dojo.extend(dojo.gfx.color.Color,{toRgb:function(_3ab){ +if(_3ab){ +return this.toRgba(); +}else{ +return [this.r,this.g,this.b]; +} +},toRgba:function(){ +return [this.r,this.g,this.b,this.a]; +},toHex:function(){ +return dojo.gfx.color.rgb2hex(this.toRgb()); +},toCss:function(){ +return "rgb("+this.toRgb().join()+")"; +},toString:function(){ +return this.toHex(); +},blend:function(_3ac,_3ad){ +var rgb=null; +if(dojo.lang.isArray(_3ac)){ +rgb=_3ac; +}else{ +if(_3ac instanceof dojo.gfx.color.Color){ +rgb=_3ac.toRgb(); +}else{ +rgb=new dojo.gfx.color.Color(_3ac).toRgb(); +} +} +return dojo.gfx.color.blend(this.toRgb(),rgb,_3ad); +}}); +dojo.gfx.color.named={white:[255,255,255],black:[0,0,0],red:[255,0,0],green:[0,255,0],lime:[0,255,0],blue:[0,0,255],navy:[0,0,128],gray:[128,128,128],silver:[192,192,192]}; +dojo.gfx.color.blend=function(a,b,_3b1){ +if(typeof a=="string"){ +return dojo.gfx.color.blendHex(a,b,_3b1); +} +if(!_3b1){ +_3b1=0; +} +_3b1=Math.min(Math.max(-1,_3b1),1); +_3b1=((_3b1+1)/2); +var c=[]; +for(var x=0;x<3;x++){ +c[x]=parseInt(b[x]+((a[x]-b[x])*_3b1)); +} +return c; +}; +dojo.gfx.color.blendHex=function(a,b,_3b6){ +return dojo.gfx.color.rgb2hex(dojo.gfx.color.blend(dojo.gfx.color.hex2rgb(a),dojo.gfx.color.hex2rgb(b),_3b6)); +}; +dojo.gfx.color.extractRGB=function(_3b7){ +var hex="0123456789abcdef"; +_3b7=_3b7.toLowerCase(); +if(_3b7.indexOf("rgb")==0){ +var _3b9=_3b7.match(/rgba*\((\d+), *(\d+), *(\d+)/i); +var ret=_3b9.splice(1,3); +return ret; +}else{ +var _3bb=dojo.gfx.color.hex2rgb(_3b7); +if(_3bb){ +return _3bb; +}else{ +return dojo.gfx.color.named[_3b7]||[255,255,255]; +} +} +}; +dojo.gfx.color.hex2rgb=function(hex){ +var _3bd="0123456789ABCDEF"; +var rgb=new Array(3); +if(hex.indexOf("#")==0){ +hex=hex.substring(1); +} +hex=hex.toUpperCase(); +if(hex.replace(new RegExp("["+_3bd+"]","g"),"")!=""){ +return null; +} +if(hex.length==3){ +rgb[0]=hex.charAt(0)+hex.charAt(0); +rgb[1]=hex.charAt(1)+hex.charAt(1); +rgb[2]=hex.charAt(2)+hex.charAt(2); +}else{ +rgb[0]=hex.substring(0,2); +rgb[1]=hex.substring(2,4); +rgb[2]=hex.substring(4); +} +for(var i=0;i/gm,">").replace(/"/gm,"""); -if(!_276){ -str=str.replace(/'/gm,"'"); -} -return str; -}; -dojo.string.escapeSql=function(str){ -return str.replace(/'/gm,"''"); -}; -dojo.string.escapeRegExp=function(str){ -return str.replace(/\\/gm,"\\\\").replace(/([\f\b\n\t\r[\^$|?*+(){}])/gm,"\\$1"); -}; -dojo.string.escapeJavaScript=function(str){ -return str.replace(/(["'\f\b\n\t\r])/gm,"\\$1"); -}; -dojo.string.escapeString=function(str){ -return ("\""+str.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r"); -}; -dojo.string.summary=function(str,len){ -if(!len||str.length<=len){ -return str; -} -return str.substring(0,len).replace(/\.+$/,"")+"..."; -}; -dojo.string.endsWith=function(str,end,_27f){ -if(_27f){ -str=str.toLowerCase(); -end=end.toLowerCase(); -} -if((str.length-end.length)<0){ -return false; -} -return str.lastIndexOf(end)==str.length-end.length; -}; -dojo.string.endsWithAny=function(str){ -for(var i=1;i-1){ -return true; -} -} -return false; -}; -dojo.string.normalizeNewlines=function(text,_28a){ -if(_28a=="\n"){ -text=text.replace(/\r\n/g,"\n"); -text=text.replace(/\r/g,"\n"); -}else{ -if(_28a=="\r"){ -text=text.replace(/\r\n/g,"\r"); -text=text.replace(/\n/g,"\r"); -}else{ -text=text.replace(/([^\r])\n/g,"$1\r\n").replace(/\r([^\n])/g,"\r\n$1"); -} -} -return text; -}; -dojo.string.splitEscaped=function(str,_28c){ -var _28d=[]; -for(var i=0,_28f=0;i=4){ -this.changeUrl=_293; -} -} -}; -dojo.lang.extend(dojo.io.Request,{url:"",mimetype:"text/plain",method:"GET",content:undefined,transport:undefined,changeUrl:undefined,formNode:undefined,sync:false,bindSuccess:false,useCache:false,preventCache:false,load:function(type,data,_296,_297){ -},error:function(type,_299,_29a,_29b){ -},timeout:function(type,_29d,_29e,_29f){ -},handle:function(type,data,_2a2,_2a3){ -},timeoutSeconds:0,abort:function(){ -},fromKwArgs:function(_2a4){ -if(_2a4["url"]){ -_2a4.url=_2a4.url.toString(); -} -if(_2a4["formNode"]){ -_2a4.formNode=dojo.byId(_2a4.formNode); -} -if(!_2a4["method"]&&_2a4["formNode"]&&_2a4["formNode"].method){ -_2a4.method=_2a4["formNode"].method; -} -if(!_2a4["handle"]&&_2a4["handler"]){ -_2a4.handle=_2a4.handler; -} -if(!_2a4["load"]&&_2a4["loaded"]){ -_2a4.load=_2a4.loaded; -} -if(!_2a4["changeUrl"]&&_2a4["changeURL"]){ -_2a4.changeUrl=_2a4.changeURL; -} -_2a4.encoding=dojo.lang.firstValued(_2a4["encoding"],djConfig["bindEncoding"],""); -_2a4.sendTransport=dojo.lang.firstValued(_2a4["sendTransport"],djConfig["ioSendTransport"],false); -var _2a5=dojo.lang.isFunction; -for(var x=0;x0){ -dojo.io.bind(dojo.io._bindQueue.shift()); -}else{ -dojo.io._queueBindInFlight=false; -} -} -}; -dojo.io._bindQueue=[]; -dojo.io._queueBindInFlight=false; -dojo.io.argsFromMap=function(map,_2b9,last){ -var enc=/utf/i.test(_2b9||"")?encodeURIComponent:dojo.string.encodeAscii; -var _2bc=[]; -var _2bd=new Object(); -for(var name in map){ -var _2bf=function(elt){ -var val=enc(name)+"="+enc(elt); -_2bc[(last==name)?"push":"unshift"](val); -}; -if(!_2bd[name]){ -var _2c2=map[name]; -if(dojo.lang.isArray(_2c2)){ -dojo.lang.forEach(_2c2,_2bf); -}else{ -_2bf(_2c2); -} -} -} -return _2bc.join("&"); -}; -dojo.io.setIFrameSrc=function(_2c3,src,_2c5){ -try{ -var r=dojo.render.html; -if(!_2c5){ -if(r.safari){ -_2c3.location=src; -}else{ -frames[_2c3.name].location=src; -} -}else{ -var idoc; -if(r.ie){ -idoc=_2c3.contentWindow.document; -}else{ -if(r.safari){ -idoc=_2c3.document; -}else{ -idoc=_2c3.contentWindow; -} -} -if(!idoc){ -_2c3.location=src; -return; -}else{ -idoc.location.replace(src); -} -} -} -catch(e){ -dojo.debug(e); -dojo.debug("setIFrameSrc: "+e); -} -}; -dojo.provide("dojo.dom"); -dojo.dom.ELEMENT_NODE=1; -dojo.dom.ATTRIBUTE_NODE=2; -dojo.dom.TEXT_NODE=3; -dojo.dom.CDATA_SECTION_NODE=4; -dojo.dom.ENTITY_REFERENCE_NODE=5; -dojo.dom.ENTITY_NODE=6; -dojo.dom.PROCESSING_INSTRUCTION_NODE=7; -dojo.dom.COMMENT_NODE=8; -dojo.dom.DOCUMENT_NODE=9; -dojo.dom.DOCUMENT_TYPE_NODE=10; -dojo.dom.DOCUMENT_FRAGMENT_NODE=11; -dojo.dom.NOTATION_NODE=12; -dojo.dom.dojoml="http://www.dojotoolkit.org/2004/dojoml"; -dojo.dom.xmlns={svg:"http://www.w3.org/2000/svg",smil:"http://www.w3.org/2001/SMIL20/",mml:"http://www.w3.org/1998/Math/MathML",cml:"http://www.xml-cml.org",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml",xul:"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",xbl:"http://www.mozilla.org/xbl",fo:"http://www.w3.org/1999/XSL/Format",xsl:"http://www.w3.org/1999/XSL/Transform",xslt:"http://www.w3.org/1999/XSL/Transform",xi:"http://www.w3.org/2001/XInclude",xforms:"http://www.w3.org/2002/01/xforms",saxon:"http://icl.com/saxon",xalan:"http://xml.apache.org/xslt",xsd:"http://www.w3.org/2001/XMLSchema",dt:"http://www.w3.org/2001/XMLSchema-datatypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",dc:"http://purl.org/dc/elements/1.1/",dcq:"http://purl.org/dc/qualifiers/1.0","soap-env":"http://schemas.xmlsoap.org/soap/envelope/",wsdl:"http://schemas.xmlsoap.org/wsdl/",AdobeExtensions:"http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"}; -dojo.dom.isNode=function(wh){ -if(typeof Element=="function"){ -try{ -return wh instanceof Element; -} -catch(e){ -} -}else{ -return wh&&!isNaN(wh.nodeType); -} -}; -dojo.dom.getUniqueId=function(){ -var _2c9=dojo.doc(); -do{ -var id="dj_unique_"+(++arguments.callee._idIncrement); -}while(_2c9.getElementById(id)); -return id; -}; -dojo.dom.getUniqueId._idIncrement=0; -dojo.dom.firstElement=dojo.dom.getFirstChildElement=function(_2cb,_2cc){ -var node=_2cb.firstChild; -while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE){ -node=node.nextSibling; -} -if(_2cc&&node&&node.tagName&&node.tagName.toLowerCase()!=_2cc.toLowerCase()){ -node=dojo.dom.nextElement(node,_2cc); -} -return node; -}; -dojo.dom.lastElement=dojo.dom.getLastChildElement=function(_2ce,_2cf){ -var node=_2ce.lastChild; -while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE){ -node=node.previousSibling; -} -if(_2cf&&node&&node.tagName&&node.tagName.toLowerCase()!=_2cf.toLowerCase()){ -node=dojo.dom.prevElement(node,_2cf); -} -return node; -}; -dojo.dom.nextElement=dojo.dom.getNextSiblingElement=function(node,_2d2){ -if(!node){ -return null; -} -do{ -node=node.nextSibling; -}while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE); -if(node&&_2d2&&_2d2.toLowerCase()!=node.tagName.toLowerCase()){ -return dojo.dom.nextElement(node,_2d2); -} -return node; -}; -dojo.dom.prevElement=dojo.dom.getPreviousSiblingElement=function(node,_2d4){ -if(!node){ -return null; -} -if(_2d4){ -_2d4=_2d4.toLowerCase(); -} -do{ -node=node.previousSibling; -}while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE); -if(node&&_2d4&&_2d4.toLowerCase()!=node.tagName.toLowerCase()){ -return dojo.dom.prevElement(node,_2d4); -} -return node; -}; -dojo.dom.moveChildren=function(_2d5,_2d6,trim){ -var _2d8=0; -if(trim){ -while(_2d5.hasChildNodes()&&_2d5.firstChild.nodeType==dojo.dom.TEXT_NODE){ -_2d5.removeChild(_2d5.firstChild); -} -while(_2d5.hasChildNodes()&&_2d5.lastChild.nodeType==dojo.dom.TEXT_NODE){ -_2d5.removeChild(_2d5.lastChild); -} -} -while(_2d5.hasChildNodes()){ -_2d6.appendChild(_2d5.firstChild); -_2d8++; -} -return _2d8; -}; -dojo.dom.copyChildren=function(_2d9,_2da,trim){ -var _2dc=_2d9.cloneNode(true); -return this.moveChildren(_2dc,_2da,trim); -}; -dojo.dom.replaceChildren=function(node,_2de){ -var _2df=[]; -if(dojo.render.html.ie){ -for(var i=0;i0){ -return _2ea[0]; -} -node=node.parentNode; -} -if(_2e9){ -return null; -} -return _2ea; -}; -dojo.dom.getAncestorsByTag=function(node,tag,_2ee){ -tag=tag.toLowerCase(); -return dojo.dom.getAncestors(node,function(el){ -return ((el.tagName)&&(el.tagName.toLowerCase()==tag)); -},_2ee); -}; -dojo.dom.getFirstAncestorByTag=function(node,tag){ -return dojo.dom.getAncestorsByTag(node,tag,true); -}; -dojo.dom.isDescendantOf=function(node,_2f3,_2f4){ -if(_2f4&&node){ -node=node.parentNode; -} -while(node){ -if(node==_2f3){ -return true; -} -node=node.parentNode; -} -return false; -}; -dojo.dom.innerXML=function(node){ -if(node.innerXML){ -return node.innerXML; -}else{ -if(node.xml){ -return node.xml; -}else{ -if(typeof XMLSerializer!="undefined"){ -return (new XMLSerializer()).serializeToString(node); -} -} -} -}; -dojo.dom.createDocument=function(){ -var doc=null; -var _2f7=dojo.doc(); -if(!dj_undef("ActiveXObject")){ -var _2f8=["MSXML2","Microsoft","MSXML","MSXML3"]; -for(var i=0;i<_2f8.length;i++){ -try{ -doc=new ActiveXObject(_2f8[i]+".XMLDOM"); -} -catch(e){ -} -if(doc){ -break; -} -} -}else{ -if((_2f7.implementation)&&(_2f7.implementation.createDocument)){ -doc=_2f7.implementation.createDocument("","",null); -} -} -return doc; -}; -dojo.dom.createDocumentFromText=function(str,_2fb){ -if(!_2fb){ -_2fb="text/xml"; -} -if(!dj_undef("DOMParser")){ -var _2fc=new DOMParser(); -return _2fc.parseFromString(str,_2fb); -}else{ -if(!dj_undef("ActiveXObject")){ -var _2fd=dojo.dom.createDocument(); -if(_2fd){ -_2fd.async=false; -_2fd.loadXML(str); -return _2fd; -}else{ -dojo.debug("toXml didn't work?"); -} -}else{ -var _2fe=dojo.doc(); -if(_2fe.createElement){ -var tmp=_2fe.createElement("xml"); -tmp.innerHTML=str; -if(_2fe.implementation&&_2fe.implementation.createDocument){ -var _300=_2fe.implementation.createDocument("foo","",null); -for(var i=0;i1){ -var _315=dojo.doc(); -dojo.dom.replaceChildren(node,_315.createTextNode(text)); -return text; -}else{ -if(node.textContent!=undefined){ -return node.textContent; -} -var _316=""; -if(node==null){ -return _316; -} -for(var i=0;i"); -} -} -catch(e){ -} -if(dojo.render.html.opera){ -dojo.debug("Opera is not supported with dojo.undo.browser, so back/forward detection will not work."); -} -dojo.undo.browser={initialHref:(!dj_undef("window"))?window.location.href:"",initialHash:(!dj_undef("window"))?window.location.hash:"",moveForward:false,historyStack:[],forwardStack:[],historyIframe:null,bookmarkAnchor:null,locationTimer:null,setInitialState:function(args){ -this.initialState=this._createState(this.initialHref,args,this.initialHash); -},addToHistory:function(args){ -this.forwardStack=[]; -var hash=null; -var url=null; -if(!this.historyIframe){ -if(djConfig["useXDomain"]&&!djConfig["dojoIframeHistoryUrl"]){ -dojo.debug("dojo.undo.browser: When using cross-domain Dojo builds,"+" please save iframe_history.html to your domain and set djConfig.dojoIframeHistoryUrl"+" to the path on your domain to iframe_history.html"); -} -this.historyIframe=window.frames["djhistory"]; -} -if(!this.bookmarkAnchor){ -this.bookmarkAnchor=document.createElement("a"); -dojo.body().appendChild(this.bookmarkAnchor); -this.bookmarkAnchor.style.display="none"; -} -if(args["changeUrl"]){ -hash="#"+((args["changeUrl"]!==true)?args["changeUrl"]:(new Date()).getTime()); -if(this.historyStack.length==0&&this.initialState.urlHash==hash){ -this.initialState=this._createState(url,args,hash); -return; -}else{ -if(this.historyStack.length>0&&this.historyStack[this.historyStack.length-1].urlHash==hash){ -this.historyStack[this.historyStack.length-1]=this._createState(url,args,hash); -return; -} -} -this.changingUrl=true; -setTimeout("window.location.href = '"+hash+"'; dojo.undo.browser.changingUrl = false;",1); -this.bookmarkAnchor.href=hash; -if(dojo.render.html.ie){ -url=this._loadIframeHistory(); -var _325=args["back"]||args["backButton"]||args["handle"]; -var tcb=function(_327){ -if(window.location.hash!=""){ -setTimeout("window.location.href = '"+hash+"';",1); -} -_325.apply(this,[_327]); -}; -if(args["back"]){ -args.back=tcb; -}else{ -if(args["backButton"]){ -args.backButton=tcb; -}else{ -if(args["handle"]){ -args.handle=tcb; -} -} -} -var _328=args["forward"]||args["forwardButton"]||args["handle"]; -var tfw=function(_32a){ -if(window.location.hash!=""){ -window.location.href=hash; -} -if(_328){ -_328.apply(this,[_32a]); -} -}; -if(args["forward"]){ -args.forward=tfw; -}else{ -if(args["forwardButton"]){ -args.forwardButton=tfw; -}else{ -if(args["handle"]){ -args.handle=tfw; -} -} -} -}else{ -if(dojo.render.html.moz){ -if(!this.locationTimer){ -this.locationTimer=setInterval("dojo.undo.browser.checkLocation();",200); -} -} -} -}else{ -url=this._loadIframeHistory(); -} -this.historyStack.push(this._createState(url,args,hash)); -},checkLocation:function(){ -if(!this.changingUrl){ -var hsl=this.historyStack.length; -if((window.location.hash==this.initialHash||window.location.href==this.initialHref)&&(hsl==1)){ -this.handleBackButton(); -return; -} -if(this.forwardStack.length>0){ -if(this.forwardStack[this.forwardStack.length-1].urlHash==window.location.hash){ -this.handleForwardButton(); -return; -} -} -if((hsl>=2)&&(this.historyStack[hsl-2])){ -if(this.historyStack[hsl-2].urlHash==window.location.hash){ -this.handleBackButton(); -return; -} -} -} -},iframeLoaded:function(evt,_32d){ -if(!dojo.render.html.opera){ -var _32e=this._getUrlQuery(_32d.href); -if(_32e==null){ -if(this.historyStack.length==1){ -this.handleBackButton(); -} -return; -} -if(this.moveForward){ -this.moveForward=false; -return; -} -if(this.historyStack.length>=2&&_32e==this._getUrlQuery(this.historyStack[this.historyStack.length-2].url)){ -this.handleBackButton(); -}else{ -if(this.forwardStack.length>0&&_32e==this._getUrlQuery(this.forwardStack[this.forwardStack.length-1].url)){ -this.handleForwardButton(); -} -} -} -},handleBackButton:function(){ -var _32f=this.historyStack.pop(); -if(!_32f){ -return; -} -var last=this.historyStack[this.historyStack.length-1]; -if(!last&&this.historyStack.length==0){ -last=this.initialState; -} -if(last){ -if(last.kwArgs["back"]){ -last.kwArgs["back"](); -}else{ -if(last.kwArgs["backButton"]){ -last.kwArgs["backButton"](); -}else{ -if(last.kwArgs["handle"]){ -last.kwArgs.handle("back"); -} -} -} -} -this.forwardStack.push(_32f); -},handleForwardButton:function(){ -var last=this.forwardStack.pop(); -if(!last){ -return; -} -if(last.kwArgs["forward"]){ -last.kwArgs.forward(); -}else{ -if(last.kwArgs["forwardButton"]){ -last.kwArgs.forwardButton(); -}else{ -if(last.kwArgs["handle"]){ -last.kwArgs.handle("forward"); -} -} -} -this.historyStack.push(last); -},_createState:function(url,args,hash){ -return {"url":url,"kwArgs":args,"urlHash":hash}; -},_getUrlQuery:function(url){ -var _336=url.split("?"); -if(_336.length<2){ -return null; -}else{ -return _336[1]; -} -},_loadIframeHistory:function(){ -var url=(djConfig["dojoIframeHistoryUrl"]||dojo.hostenv.getBaseScriptUri()+"iframe_history.html")+"?"+(new Date()).getTime(); -this.moveForward=true; -dojo.io.setIFrameSrc(this.historyIframe,url,false); -return url; -}}; -dojo.provide("dojo.io.BrowserIO"); -if(!dj_undef("window")){ -dojo.io.checkChildrenForFile=function(node){ -var _339=false; -var _33a=node.getElementsByTagName("input"); -dojo.lang.forEach(_33a,function(_33b){ -if(_339){ -return; -} -if(_33b.getAttribute("type")=="file"){ -_339=true; -} -}); -return _339; -}; -dojo.io.formHasFile=function(_33c){ -return dojo.io.checkChildrenForFile(_33c); -}; -dojo.io.updateNode=function(node,_33e){ -node=dojo.byId(node); -var args=_33e; -if(dojo.lang.isString(_33e)){ -args={url:_33e}; -} -args.mimetype="text/html"; -args.load=function(t,d,e){ -while(node.firstChild){ -dojo.dom.destroyNode(node.firstChild); -} -node.innerHTML=d; -}; -dojo.io.bind(args); -}; -dojo.io.formFilter=function(node){ -var type=(node.type||"").toLowerCase(); -return !node.disabled&&node.name&&!dojo.lang.inArray(["file","submit","image","reset","button"],type); -}; -dojo.io.encodeForm=function(_345,_346,_347){ -if((!_345)||(!_345.tagName)||(!_345.tagName.toLowerCase()=="form")){ -dojo.raise("Attempted to encode a non-form element."); -} -if(!_347){ -_347=dojo.io.formFilter; -} -var enc=/utf/i.test(_346||"")?encodeURIComponent:dojo.string.encodeAscii; -var _349=[]; -for(var i=0;i<_345.elements.length;i++){ -var elm=_345.elements[i]; -if(!elm||elm.tagName.toLowerCase()=="fieldset"||!_347(elm)){ -continue; -} -var name=enc(elm.name); -var type=elm.type.toLowerCase(); -if(type=="select-multiple"){ -for(var j=0;j=200)&&(http.status<300))||(http.status==304)||(location.protocol=="file:"&&(http.status==0||http.status==undefined))||(location.protocol=="chrome:"&&(http.status==0||http.status==undefined))){ -var ret; -if(_370.method.toLowerCase()=="head"){ -var _376=http.getAllResponseHeaders(); -ret={}; -ret.toString=function(){ -return _376; -}; -var _377=_376.split(/[\r\n]+/g); -for(var i=0;i<_377.length;i++){ -var pair=_377[i].match(/^([^:]+)\s*:\s*(.+)$/i); -if(pair){ -ret[pair[1]]=pair[2]; -} -} -}else{ -if(_370.mimetype=="text/javascript"){ -try{ -ret=dj_eval(http.responseText); -} -catch(e){ -dojo.debug(e); -dojo.debug(http.responseText); -ret=null; -} -}else{ -if(_370.mimetype=="text/json"||_370.mimetype=="application/json"){ -try{ -ret=dj_eval("("+http.responseText+")"); -} -catch(e){ -dojo.debug(e); -dojo.debug(http.responseText); -ret=false; -} -}else{ -if((_370.mimetype=="application/xml")||(_370.mimetype=="text/xml")){ -ret=http.responseXML; -if(!ret||typeof ret=="string"||!http.getResponseHeader("Content-Type")){ -ret=dojo.dom.createDocumentFromText(http.responseText); -} -}else{ -ret=http.responseText; -} -} -} -} -if(_374){ -addToCache(url,_373,_370.method,http); -} -_370[(typeof _370.load=="function")?"load":"handle"]("load",ret,http,_370); -}else{ -var _37a=new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText); -_370[(typeof _370.error=="function")?"error":"handle"]("error",_37a,http,_370); -} -} -function setHeaders(http,_37c){ -if(_37c["headers"]){ -for(var _37d in _37c["headers"]){ -if(_37d.toLowerCase()=="content-type"&&!_37c["contentType"]){ -_37c["contentType"]=_37c["headers"][_37d]; -}else{ -http.setRequestHeader(_37d,_37c["headers"][_37d]); -} -} -} -} -this.inFlight=[]; -this.inFlightTimer=null; -this.startWatchingInFlight=function(){ -if(!this.inFlightTimer){ -this.inFlightTimer=setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();",10); -} -}; -this.watchInFlight=function(){ -var now=null; -if(!dojo.hostenv._blockAsync&&!_364._blockAsync){ -for(var x=this.inFlight.length-1;x>=0;x--){ -try{ -var tif=this.inFlight[x]; -if(!tif||tif.http._aborted||!tif.http.readyState){ -this.inFlight.splice(x,1); -continue; -} -if(4==tif.http.readyState){ -this.inFlight.splice(x,1); -doLoad(tif.req,tif.http,tif.url,tif.query,tif.useCache); -}else{ -if(tif.startTime){ -if(!now){ -now=(new Date()).getTime(); -} -if(tif.startTime+(tif.req.timeoutSeconds*1000)-1){ -dojo.debug("Warning: dojo.io.bind: stripping hash values from url:",url); -url=url.split("#")[0]; -} -if(_384["file"]){ -_384.method="post"; -} -if(!_384["method"]){ -_384.method="get"; -} -if(_384.method.toLowerCase()=="get"){ -_384.multipart=false; -}else{ -if(_384["file"]){ -_384.multipart=true; -}else{ -if(!_384["multipart"]){ -_384.multipart=false; -} -} -} -if(_384["backButton"]||_384["back"]||_384["changeUrl"]){ -dojo.undo.browser.addToHistory(_384); -} -var _389=_384["content"]||{}; -if(_384.sendTransport){ -_389["dojo.transport"]="xmlhttp"; -} -do{ -if(_384.postContent){ -_386=_384.postContent; -break; -} -if(_389){ -_386+=dojo.io.argsFromMap(_389,_384.encoding); -} -if(_384.method.toLowerCase()=="get"||!_384.multipart){ -break; -} -var t=[]; -if(_386.length){ -var q=_386.split("&"); -for(var i=0;i-1?"&":"?")+_386; -} -if(_390){ -_396+=(dojo.string.endsWithAny(_396,"?","&")?"":(_396.indexOf("?")>-1?"&":"?"))+"dojo.preventCache="+new Date().valueOf(); -} -if(!_384.user){ -http.open(_384.method.toUpperCase(),_396,_38f); -}else{ -http.open(_384.method.toUpperCase(),_396,_38f,_384.user,_384.password); -} -setHeaders(http,_384); -try{ -http.send(null); -} -catch(e){ -if(typeof http.abort=="function"){ -http.abort(); -} -doLoad(_384,{status:404},url,_386,_391); -} -} -if(!_38f){ -doLoad(_384,http,url,_386,_391); -_364._blockAsync=false; -} -_384.abort=function(){ -try{ -http._aborted=true; -} -catch(e){ -} -return http.abort(); -}; -return; -}; -dojo.io.transports.addTransport("XMLHTTPTransport"); -}; -} -dojo.provide("dojo.io.cookie"); -dojo.io.cookie.setCookie=function(name,_398,days,path,_39b,_39c){ -var _39d=-1; -if((typeof days=="number")&&(days>=0)){ -var d=new Date(); -d.setTime(d.getTime()+(days*24*60*60*1000)); -_39d=d.toGMTString(); -} -_398=escape(_398); -document.cookie=name+"="+_398+";"+(_39d!=-1?" expires="+_39d+";":"")+(path?"path="+path:"")+(_39b?"; domain="+_39b:"")+(_39c?"; secure":""); -}; -dojo.io.cookie.set=dojo.io.cookie.setCookie; -dojo.io.cookie.getCookie=function(name){ -var idx=document.cookie.lastIndexOf(name+"="); -if(idx==-1){ -return null; -} -var _3a1=document.cookie.substring(idx+name.length+1); -var end=_3a1.indexOf(";"); -if(end==-1){ -end=_3a1.length; -} -_3a1=_3a1.substring(0,end); -_3a1=unescape(_3a1); -return _3a1; -}; -dojo.io.cookie.get=dojo.io.cookie.getCookie; -dojo.io.cookie.deleteCookie=function(name){ -dojo.io.cookie.setCookie(name,"-",0); -}; -dojo.io.cookie.setObjectCookie=function(name,obj,days,path,_3a8,_3a9,_3aa){ -if(arguments.length==5){ -_3aa=_3a8; -_3a8=null; -_3a9=null; -} -var _3ab=[],_3ac,_3ad=""; -if(!_3aa){ -_3ac=dojo.io.cookie.getObjectCookie(name); -} -if(days>=0){ -if(!_3ac){ -_3ac={}; -} -for(var prop in obj){ -if(obj[prop]==null){ -delete _3ac[prop]; -}else{ -if((typeof obj[prop]=="string")||(typeof obj[prop]=="number")){ -_3ac[prop]=obj[prop]; -} -} -} -prop=null; -for(var prop in _3ac){ -_3ab.push(escape(prop)+"="+escape(_3ac[prop])); -} -_3ad=_3ab.join("&"); -} -dojo.io.cookie.setCookie(name,_3ad,days,path,_3a8,_3a9); -}; -dojo.io.cookie.getObjectCookie=function(name){ -var _3b0=null,_3b1=dojo.io.cookie.getCookie(name); -if(_3b1){ -_3b0={}; -var _3b2=_3b1.split("&"); -for(var i=0;i<_3b2.length;i++){ -var pair=_3b2[i].split("="); -var _3b5=pair[1]; -if(isNaN(_3b5)){ -_3b5=unescape(pair[1]); -} -_3b0[unescape(pair[0])]=_3b5; -} -} -return _3b0; -}; -dojo.io.cookie.isSupported=function(){ -if(typeof navigator.cookieEnabled!="boolean"){ -dojo.io.cookie.setCookie("__TestingYourBrowserForCookieSupport__","CookiesAllowed",90,null); -var _3b6=dojo.io.cookie.getCookie("__TestingYourBrowserForCookieSupport__"); -navigator.cookieEnabled=(_3b6=="CookiesAllowed"); -if(navigator.cookieEnabled){ -this.deleteCookie("__TestingYourBrowserForCookieSupport__"); -} -} -return navigator.cookieEnabled; -}; -if(!dojo.io.cookies){ -dojo.io.cookies=dojo.io.cookie; -} -dojo.kwCompoundRequire({common:["dojo.io.common"],rhino:["dojo.io.RhinoIO"],browser:["dojo.io.BrowserIO","dojo.io.cookie"],dashboard:["dojo.io.BrowserIO","dojo.io.cookie"]}); -dojo.provide("dojo.io.*"); -dojo.provide("dojo.io"); -dojo.deprecated("dojo.io","replaced by dojo.io.*","0.5"); -dojo.provide("dojo.AdapterRegistry"); -dojo.AdapterRegistry=function(_3b7){ -this.pairs=[]; -this.returnWrappers=_3b7||false; -}; -dojo.lang.extend(dojo.AdapterRegistry,{register:function(name,_3b9,wrap,_3bb,_3bc){ -var type=(_3bc)?"unshift":"push"; -this.pairs[type]([name,_3b9,wrap,_3bb]); -},match:function(){ -for(var i=0;i0){ +this.duration=_3de; } -return "{"+res.join(",")+"}"; -}}; +if(_3e1){ +this.repeatCount=_3e1; +} +if(rate){ +this.rate=rate; +} +if(_3dd){ +dojo.lang.forEach(["handler","beforeBegin","onBegin","onEnd","onPlay","onStop","onAnimate"],function(item){ +if(_3dd[item]){ +this.connect(item,_3dd[item]); +} +},this); +} +if(_3e0&&dojo.lang.isFunction(_3e0)){ +this.easing=_3e0; +} +}; +dojo.inherits(dojo.lfx.Animation,dojo.lfx.IAnimation); +dojo.lang.extend(dojo.lfx.Animation,{_startTime:null,_endTime:null,_timer:null,_percent:0,_startRepeatCount:0,play:function(_3e4,_3e5){ +if(_3e5){ +clearTimeout(this._timer); +this._active=false; +this._paused=false; +this._percent=0; +}else{ +if(this._active&&!this._paused){ +return this; +} +} +this.fire("handler",["beforeBegin"]); +this.fire("beforeBegin"); +if(_3e4>0){ +setTimeout(dojo.lang.hitch(this,function(){ +this.play(null,_3e5); +}),_3e4); +return this; +} +this._startTime=new Date().valueOf(); +if(this._paused){ +this._startTime-=(this.duration*this._percent/100); +} +this._endTime=this._startTime+this.duration; +this._active=true; +this._paused=false; +var step=this._percent/100; +var _3e7=this.curve.getValue(step); +if(this._percent==0){ +if(!this._startRepeatCount){ +this._startRepeatCount=this.repeatCount; +} +this.fire("handler",["begin",_3e7]); +this.fire("onBegin",[_3e7]); +} +this.fire("handler",["play",_3e7]); +this.fire("onPlay",[_3e7]); +this._cycle(); +return this; +},pause:function(){ +clearTimeout(this._timer); +if(!this._active){ +return this; +} +this._paused=true; +var _3e8=this.curve.getValue(this._percent/100); +this.fire("handler",["pause",_3e8]); +this.fire("onPause",[_3e8]); +return this; +},gotoPercent:function(pct,_3ea){ +clearTimeout(this._timer); +this._active=true; +this._paused=true; +this._percent=pct; +if(_3ea){ +this.play(); +} +return this; +},stop:function(_3eb){ +clearTimeout(this._timer); +var step=this._percent/100; +if(_3eb){ +step=1; +} +var _3ed=this.curve.getValue(step); +this.fire("handler",["stop",_3ed]); +this.fire("onStop",[_3ed]); +this._active=false; +this._paused=false; +return this; +},status:function(){ +if(this._active){ +return this._paused?"paused":"playing"; +}else{ +return "stopped"; +} +return this; +},_cycle:function(){ +clearTimeout(this._timer); +if(this._active){ +var curr=new Date().valueOf(); +var step=(curr-this._startTime)/(this._endTime-this._startTime); +if(step>=1){ +step=1; +this._percent=100; +}else{ +this._percent=step*100; +} +if((this.easing)&&(dojo.lang.isFunction(this.easing))){ +step=this.easing(step); +} +var _3f0=this.curve.getValue(step); +this.fire("handler",["animate",_3f0]); +this.fire("onAnimate",[_3f0]); +if(step<1){ +this._timer=setTimeout(dojo.lang.hitch(this,"_cycle"),this.rate); +}else{ +this._active=false; +this.fire("handler",["end"]); +this.fire("onEnd"); +if(this.repeatCount>0){ +this.repeatCount--; +this.play(null,true); +}else{ +if(this.repeatCount==-1){ +this.play(null,true); +}else{ +if(this._startRepeatCount){ +this.repeatCount=this._startRepeatCount; +this._startRepeatCount=0; +} +} +} +} +} +return this; +}}); +dojo.lfx.Combine=function(_3f1){ +dojo.lfx.IAnimation.call(this); +this._anims=[]; +this._animsEnded=0; +var _3f2=arguments; +if(_3f2.length==1&&(dojo.lang.isArray(_3f2[0])||dojo.lang.isArrayLike(_3f2[0]))){ +_3f2=_3f2[0]; +} +dojo.lang.forEach(_3f2,function(anim){ +this._anims.push(anim); +anim.connect("onEnd",dojo.lang.hitch(this,"_onAnimsEnded")); +},this); +}; +dojo.inherits(dojo.lfx.Combine,dojo.lfx.IAnimation); +dojo.lang.extend(dojo.lfx.Combine,{_animsEnded:0,play:function(_3f4,_3f5){ +if(!this._anims.length){ +return this; +} +this.fire("beforeBegin"); +if(_3f4>0){ +setTimeout(dojo.lang.hitch(this,function(){ +this.play(null,_3f5); +}),_3f4); +return this; +} +if(_3f5||this._anims[0].percent==0){ +this.fire("onBegin"); +} +this.fire("onPlay"); +this._animsCall("play",null,_3f5); +return this; +},pause:function(){ +this.fire("onPause"); +this._animsCall("pause"); +return this; +},stop:function(_3f6){ +this.fire("onStop"); +this._animsCall("stop",_3f6); +return this; +},_onAnimsEnded:function(){ +this._animsEnded++; +if(this._animsEnded>=this._anims.length){ +this.fire("onEnd"); +} +return this; +},_animsCall:function(_3f7){ +var args=[]; +if(arguments.length>1){ +for(var i=1;i0){ +setTimeout(dojo.lang.hitch(this,function(){ +this.play(null,_403); +}),_402); +return this; +} +if(_404){ +if(this._currAnim==0){ +this.fire("handler",["begin",this._currAnim]); +this.fire("onBegin",[this._currAnim]); +} +this.fire("onPlay",[this._currAnim]); +_404.play(null,_403); +} +return this; +},pause:function(){ +if(this._anims[this._currAnim]){ +this._anims[this._currAnim].pause(); +this.fire("onPause",[this._currAnim]); +} +return this; +},playPause:function(){ +if(this._anims.length==0){ +return this; +} +if(this._currAnim==-1){ +this._currAnim=0; +} +var _405=this._anims[this._currAnim]; +if(_405){ +if(!_405._active||_405._paused){ +this.play(); +}else{ +this.pause(); +} +} +return this; +},stop:function(){ +var _406=this._anims[this._currAnim]; +if(_406){ +_406.stop(); +this.fire("onStop",[this._currAnim]); +} +return _406; +},_playNext:function(){ +if(this._currAnim==-1||this._anims.length==0){ +return this; +} +this._currAnim++; +if(this._anims[this._currAnim]){ +this._anims[this._currAnim].play(null,true); +} +return this; +}}); +dojo.lfx.combine=function(_407){ +var _408=arguments; +if(dojo.lang.isArray(arguments[0])){ +_408=arguments[0]; +} +if(_408.length==1){ +return _408[0]; +} +return new dojo.lfx.Combine(_408); +}; +dojo.lfx.chain=function(_409){ +var _40a=arguments; +if(dojo.lang.isArray(arguments[0])){ +_40a=arguments[0]; +} +if(_40a.length==1){ +return _40a[0]; +} +return new dojo.lfx.Chain(_40a); +}; dojo.provide("dojo.html.common"); dojo.lang.mixin(dojo.html,dojo.dom); dojo.html.body=function(){ @@ -4354,24 +4699,24 @@ t=t.parentNode; return t; }; dojo.html.getViewport=function(){ -var _3d3=dojo.global(); -var _3d4=dojo.doc(); +var _40d=dojo.global(); +var _40e=dojo.doc(); var w=0; var h=0; if(dojo.render.html.mozilla){ -w=_3d4.documentElement.clientWidth; -h=_3d3.innerHeight; +w=_40e.documentElement.clientWidth; +h=_40d.innerHeight; }else{ -if(!dojo.render.html.opera&&_3d3.innerWidth){ -w=_3d3.innerWidth; -h=_3d3.innerHeight; +if(!dojo.render.html.opera&&_40d.innerWidth){ +w=_40d.innerWidth; +h=_40d.innerHeight; }else{ -if(!dojo.render.html.opera&&dojo.exists(_3d4,"documentElement.clientWidth")){ -var w2=_3d4.documentElement.clientWidth; +if(!dojo.render.html.opera&&dojo.exists(_40e,"documentElement.clientWidth")){ +var w2=_40e.documentElement.clientWidth; if(!w||w2&&w2_3fc)){ +var _435=loc.indexOf(":"); +var _436=loc.indexOf("/"); +if(loc.charAt(0)!="/"&&(_435==-1||_435>_436)){ loc=dojo.hostenv.getBaseScriptUri()+loc; } return new dojo.uri.Uri(loc,uri); @@ -4530,20 +4875,20 @@ for(var i=1;i=1){ +if(!_4d8){ +if(_4d7>=1){ if(h.ie){ dojo.html.clearOpacity(node); return; }else{ -_49d=0.999999; +_4d7=0.999999; } }else{ -if(_49d<0){ -_49d=0; +if(_4d7<0){ +_4d7=0; } } } @@ -5155,20 +5498,20 @@ if(h.ie){ if(node.nodeName.toLowerCase()=="tr"){ var tds=node.getElementsByTagName("td"); for(var x=0;x=0.999999?1:Number(opac); }; +dojo.provide("dojo.html.color"); +dojo.html.getBackgroundColor=function(node){ +node=dojo.byId(node); +var _4e3; +do{ +_4e3=dojo.html.getStyle(node,"background-color"); +if(_4e3.toLowerCase()=="rgba(0, 0, 0, 0)"){ +_4e3="transparent"; +} +if(node==document.getElementsByTagName("body")[0]){ +node=null; +break; +} +node=node.parentNode; +}while(node&&dojo.lang.inArray(["transparent",""],_4e3)); +if(_4e3=="transparent"){ +_4e3=[255,255,255,0]; +}else{ +_4e3=dojo.gfx.color.extractRGB(_4e3); +} +return _4e3; +}; dojo.provide("dojo.html.layout"); dojo.html.sumAncestorProperties=function(node,prop){ node=dojo.byId(node); if(!node){ return 0; } -var _4aa=0; +var _4e6=0; while(node){ if(dojo.html.getComputedStyle(node,"position")=="fixed"){ return 0; } var val=node[prop]; if(val){ -_4aa+=val-0; +_4e6+=val-0; if(node==dojo.body()){ break; } } node=node.parentNode; } -return _4aa; +return _4e6; }; -dojo.html.setStyleAttributes=function(node,_4ad){ +dojo.html.setStyleAttributes=function(node,_4e9){ node=dojo.byId(node); -var _4ae=_4ad.replace(/(;)?\s*$/,"").split(";"); -for(var i=0;i<_4ae.length;i++){ -var _4b0=_4ae[i].split(":"); -var name=_4b0[0].replace(/\s*$/,"").replace(/^\s*/,"").toLowerCase(); -var _4b2=_4b0[1].replace(/\s*$/,"").replace(/^\s*/,""); +var _4ea=_4e9.replace(/(;)?\s*$/,"").split(";"); +for(var i=0;i<_4ea.length;i++){ +var _4ec=_4ea[i].split(":"); +var name=_4ec[0].replace(/\s*$/,"").replace(/^\s*/,"").toLowerCase(); +var _4ee=_4ec[1].replace(/\s*$/,"").replace(/^\s*/,""); switch(name){ case "opacity": -dojo.html.setOpacity(node,_4b2); +dojo.html.setOpacity(node,_4ee); break; case "content-height": -dojo.html.setContentBox(node,{height:_4b2}); +dojo.html.setContentBox(node,{height:_4ee}); break; case "content-width": -dojo.html.setContentBox(node,{width:_4b2}); +dojo.html.setContentBox(node,{width:_4ee}); break; case "outer-height": -dojo.html.setMarginBox(node,{height:_4b2}); +dojo.html.setMarginBox(node,{height:_4ee}); break; case "outer-width": -dojo.html.setMarginBox(node,{width:_4b2}); +dojo.html.setMarginBox(node,{width:_4ee}); break; default: -node.style[dojo.html.toCamelCase(name)]=_4b2; +node.style[dojo.html.toCamelCase(name)]=_4ee; } } }; dojo.html.boxSizing={MARGIN_BOX:"margin-box",BORDER_BOX:"border-box",PADDING_BOX:"padding-box",CONTENT_BOX:"content-box"}; -dojo.html.getAbsolutePosition=dojo.html.abs=function(node,_4b4,_4b5){ +dojo.html.getAbsolutePosition=dojo.html.abs=function(node,_4f0,_4f1){ node=dojo.byId(node,node.ownerDocument); var ret={x:0,y:0}; var bs=dojo.html.boxSizing; -if(!_4b5){ -_4b5=bs.CONTENT_BOX; +if(!_4f1){ +_4f1=bs.CONTENT_BOX; } -var _4b8=2; -var _4b9; -switch(_4b5){ +var _4f4=2; +var _4f5; +switch(_4f1){ case bs.MARGIN_BOX: -_4b9=3; +_4f5=3; break; case bs.BORDER_BOX: -_4b9=2; +_4f5=2; break; case bs.PADDING_BOX: default: -_4b9=1; +_4f5=1; break; case bs.CONTENT_BOX: -_4b9=0; +_4f5=0; break; } var h=dojo.render.html; @@ -5293,7 +5658,7 @@ ret.y=top-2; } }else{ if(document.getBoxObjectFor){ -_4b8=1; +_4f4=1; try{ var bo=document.getBoxObjectFor(node); ret.x=bo.x-dojo.html.sumAncestorProperties(node,"scrollLeft"); @@ -5303,11 +5668,11 @@ catch(e){ } }else{ if(node["offsetParent"]){ -var _4bd; +var _4f9; if((h.safari)&&(node.style.getPropertyValue("position")=="absolute")&&(node.parentNode==db)){ -_4bd=db; +_4f9=db; }else{ -_4bd=db.parentNode; +_4f9=db.parentNode; } if(node.parentNode!=db){ var nd=node; @@ -5317,16 +5682,16 @@ nd=db; ret.x-=dojo.html.sumAncestorProperties(nd,"scrollLeft"); ret.y-=dojo.html.sumAncestorProperties(nd,"scrollTop"); } -var _4bf=node; +var _4fb=node; do{ -var n=_4bf["offsetLeft"]; +var n=_4fb["offsetLeft"]; if(!h.opera||n>0){ ret.x+=isNaN(n)?0:n; } -var m=_4bf["offsetTop"]; +var m=_4fb["offsetTop"]; ret.y+=isNaN(m)?0:m; -_4bf=_4bf.offsetParent; -}while((_4bf!=_4bd)&&(_4bf!=null)); +_4fb=_4fb.offsetParent; +}while((_4fb!=_4f9)&&(_4fb!=null)); }else{ if(node["x"]&&node["y"]){ ret.x+=isNaN(node.x)?0:node.x; @@ -5335,22 +5700,22 @@ ret.y+=isNaN(node.y)?0:node.y; } } } -if(_4b4){ -var _4c2=dojo.html.getScroll(); -ret.y+=_4c2.top; -ret.x+=_4c2.left; +if(_4f0){ +var _4fe=dojo.html.getScroll(); +ret.y+=_4fe.top; +ret.x+=_4fe.left; } -var _4c3=[dojo.html.getPaddingExtent,dojo.html.getBorderExtent,dojo.html.getMarginExtent]; -if(_4b8>_4b9){ -for(var i=_4b9;i<_4b8;++i){ -ret.y+=_4c3[i](node,"top"); -ret.x+=_4c3[i](node,"left"); +var _4ff=[dojo.html.getPaddingExtent,dojo.html.getBorderExtent,dojo.html.getMarginExtent]; +if(_4f4>_4f5){ +for(var i=_4f5;i<_4f4;++i){ +ret.y+=_4ff[i](node,"top"); +ret.x+=_4ff[i](node,"left"); } }else{ -if(_4b8<_4b9){ -for(var i=_4b9;i>_4b8;--i){ -ret.y-=_4c3[i-1](node,"top"); -ret.x-=_4c3[i-1](node,"left"); +if(_4f4<_4f5){ +for(var i=_4f5;i>_4f4;--i){ +ret.y-=_4ff[i-1](node,"top"); +ret.x-=_4ff[i-1](node,"left"); } } } @@ -5361,12 +5726,12 @@ return ret; dojo.html.isPositionAbsolute=function(node){ return (dojo.html.getComputedStyle(node,"position")=="absolute"); }; -dojo.html._sumPixelValues=function(node,_4c7,_4c8){ -var _4c9=0; -for(var x=0;x<_4c7.length;x++){ -_4c9+=dojo.html.getPixelValue(node,_4c7[x],_4c8); +dojo.html._sumPixelValues=function(node,_503,_504){ +var _505=0; +for(var x=0;x<_503.length;x++){ +_505+=dojo.html.getPixelValue(node,_503[x],_504); } -return _4c9; +return _505; }; dojo.html.getMargin=function(node){ return {width:dojo.html._sumPixelValues(node,["margin-left","margin-right"],(dojo.html.getComputedStyle(node,"position")=="absolute")),height:dojo.html._sumPixelValues(node,["margin-top","margin-bottom"],(dojo.html.getComputedStyle(node,"position")=="absolute"))}; @@ -5388,8 +5753,8 @@ return {width:dojo.html._sumPixelValues(node,["padding-left","padding-right"],tr }; dojo.html.getPadBorder=function(node){ var pad=dojo.html.getPadding(node); -var _4d6=dojo.html.getBorder(node); -return {width:pad.width+_4d6.width,height:pad.height+_4d6.height}; +var _512=dojo.html.getBorder(node); +return {width:pad.width+_512.width,height:pad.height+_512.height}; }; dojo.html.getBoxSizing=function(node){ var h=dojo.render.html; @@ -5405,14 +5770,14 @@ return bs.CONTENT_BOX; if(arguments.length==0){ node=document.documentElement; } -var _4db; +var _517; if(!h.ie){ -_4db=dojo.html.getStyle(node,"-moz-box-sizing"); -if(!_4db){ -_4db=dojo.html.getStyle(node,"box-sizing"); +_517=dojo.html.getStyle(node,"-moz-box-sizing"); +if(!_517){ +_517=dojo.html.getStyle(node,"box-sizing"); } } -return (_4db?_4db:bs.CONTENT_BOX); +return (_517?_517:bs.CONTENT_BOX); } }; dojo.html.isBorderBox=function(node){ @@ -5424,53 +5789,53 @@ return {width:node.offsetWidth,height:node.offsetHeight}; }; dojo.html.getPaddingBox=function(node){ var box=dojo.html.getBorderBox(node); -var _4e0=dojo.html.getBorder(node); -return {width:box.width-_4e0.width,height:box.height-_4e0.height}; +var _51c=dojo.html.getBorder(node); +return {width:box.width-_51c.width,height:box.height-_51c.height}; }; dojo.html.getContentBox=function(node){ node=dojo.byId(node); -var _4e2=dojo.html.getPadBorder(node); -return {width:node.offsetWidth-_4e2.width,height:node.offsetHeight-_4e2.height}; +var _51e=dojo.html.getPadBorder(node); +return {width:node.offsetWidth-_51e.width,height:node.offsetHeight-_51e.height}; }; dojo.html.setContentBox=function(node,args){ node=dojo.byId(node); -var _4e5=0; -var _4e6=0; +var _521=0; +var _522=0; var isbb=dojo.html.isBorderBox(node); -var _4e8=(isbb?dojo.html.getPadBorder(node):{width:0,height:0}); +var _524=(isbb?dojo.html.getPadBorder(node):{width:0,height:0}); var ret={}; if(typeof args.width!="undefined"){ -_4e5=args.width+_4e8.width; -ret.width=dojo.html.setPositivePixelValue(node,"width",_4e5); +_521=args.width+_524.width; +ret.width=dojo.html.setPositivePixelValue(node,"width",_521); } if(typeof args.height!="undefined"){ -_4e6=args.height+_4e8.height; -ret.height=dojo.html.setPositivePixelValue(node,"height",_4e6); +_522=args.height+_524.height; +ret.height=dojo.html.setPositivePixelValue(node,"height",_522); } return ret; }; dojo.html.getMarginBox=function(node){ -var _4eb=dojo.html.getBorderBox(node); -var _4ec=dojo.html.getMargin(node); -return {width:_4eb.width+_4ec.width,height:_4eb.height+_4ec.height}; +var _527=dojo.html.getBorderBox(node); +var _528=dojo.html.getMargin(node); +return {width:_527.width+_528.width,height:_527.height+_528.height}; }; dojo.html.setMarginBox=function(node,args){ node=dojo.byId(node); -var _4ef=0; -var _4f0=0; +var _52b=0; +var _52c=0; var isbb=dojo.html.isBorderBox(node); -var _4f2=(!isbb?dojo.html.getPadBorder(node):{width:0,height:0}); -var _4f3=dojo.html.getMargin(node); +var _52e=(!isbb?dojo.html.getPadBorder(node):{width:0,height:0}); +var _52f=dojo.html.getMargin(node); var ret={}; if(typeof args.width!="undefined"){ -_4ef=args.width-_4f2.width; -_4ef-=_4f3.width; -ret.width=dojo.html.setPositivePixelValue(node,"width",_4ef); +_52b=args.width-_52e.width; +_52b-=_52f.width; +ret.width=dojo.html.setPositivePixelValue(node,"width",_52b); } if(typeof args.height!="undefined"){ -_4f0=args.height-_4f2.height; -_4f0-=_4f3.height; -ret.height=dojo.html.setPositivePixelValue(node,"height",_4f0); +_52c=args.height-_52e.height; +_52c-=_52f.height; +ret.height=dojo.html.setPositivePixelValue(node,"height",_52c); } return ret; }; @@ -5488,31 +5853,31 @@ default: return dojo.html.getContentBox(node); } }; -dojo.html.toCoordinateObject=dojo.html.toCoordinateArray=function(_4f8,_4f9,_4fa){ -if(_4f8 instanceof Array||typeof _4f8=="array"){ +dojo.html.toCoordinateObject=dojo.html.toCoordinateArray=function(_534,_535,_536){ +if(_534 instanceof Array||typeof _534=="array"){ dojo.deprecated("dojo.html.toCoordinateArray","use dojo.html.toCoordinateObject({left: , top: , width: , height: }) instead","0.5"); -while(_4f8.length<4){ -_4f8.push(0); +while(_534.length<4){ +_534.push(0); } -while(_4f8.length>4){ -_4f8.pop(); +while(_534.length>4){ +_534.pop(); } -var ret={left:_4f8[0],top:_4f8[1],width:_4f8[2],height:_4f8[3]}; +var ret={left:_534[0],top:_534[1],width:_534[2],height:_534[3]}; }else{ -if(!_4f8.nodeType&&!(_4f8 instanceof String||typeof _4f8=="string")&&("width" in _4f8||"height" in _4f8||"left" in _4f8||"x" in _4f8||"top" in _4f8||"y" in _4f8)){ -var ret={left:_4f8.left||_4f8.x||0,top:_4f8.top||_4f8.y||0,width:_4f8.width||0,height:_4f8.height||0}; +if(!_534.nodeType&&!(_534 instanceof String||typeof _534=="string")&&("width" in _534||"height" in _534||"left" in _534||"x" in _534||"top" in _534||"y" in _534)){ +var ret={left:_534.left||_534.x||0,top:_534.top||_534.y||0,width:_534.width||0,height:_534.height||0}; }else{ -var node=dojo.byId(_4f8); -var pos=dojo.html.abs(node,_4f9,_4fa); -var _4fe=dojo.html.getMarginBox(node); -var ret={left:pos.left,top:pos.top,width:_4fe.width,height:_4fe.height}; +var node=dojo.byId(_534); +var pos=dojo.html.abs(node,_535,_536); +var _53a=dojo.html.getMarginBox(node); +var ret={left:pos.left,top:pos.top,width:_53a.width,height:_53a.height}; } } ret.x=ret.left; ret.y=ret.top; return ret; }; -dojo.html.setMarginBoxWidth=dojo.html.setOuterWidth=function(node,_500){ +dojo.html.setMarginBoxWidth=dojo.html.setOuterWidth=function(node,_53c){ return dojo.html._callDeprecated("setMarginBoxWidth","setMarginBox",arguments,"width"); }; dojo.html.setMarginBoxHeight=dojo.html.setOuterHeight=function(){ @@ -5524,19 +5889,19 @@ return dojo.html._callDeprecated("getMarginBoxWidth","getMarginBox",arguments,nu dojo.html.getMarginBoxHeight=dojo.html.getOuterHeight=function(){ return dojo.html._callDeprecated("getMarginBoxHeight","getMarginBox",arguments,null,"height"); }; -dojo.html.getTotalOffset=function(node,type,_503){ +dojo.html.getTotalOffset=function(node,type,_53f){ return dojo.html._callDeprecated("getTotalOffset","getAbsolutePosition",arguments,null,type); }; -dojo.html.getAbsoluteX=function(node,_505){ +dojo.html.getAbsoluteX=function(node,_541){ return dojo.html._callDeprecated("getAbsoluteX","getAbsolutePosition",arguments,null,"x"); }; -dojo.html.getAbsoluteY=function(node,_507){ +dojo.html.getAbsoluteY=function(node,_543){ return dojo.html._callDeprecated("getAbsoluteY","getAbsolutePosition",arguments,null,"y"); }; -dojo.html.totalOffsetLeft=function(node,_509){ +dojo.html.totalOffsetLeft=function(node,_545){ return dojo.html._callDeprecated("totalOffsetLeft","getAbsolutePosition",arguments,null,"left"); }; -dojo.html.totalOffsetTop=function(node,_50b){ +dojo.html.totalOffsetTop=function(node,_547){ return dojo.html._callDeprecated("totalOffsetTop","getAbsolutePosition",arguments,null,"top"); }; dojo.html.getMarginWidth=function(node){ @@ -5575,352 +5940,502 @@ return dojo.html._callDeprecated("getContentBoxWidth","getContentBox",arguments, dojo.html.getContentBoxHeight=dojo.html.getContentHeight=function(){ return dojo.html._callDeprecated("getContentBoxHeight","getContentBox",arguments,null,"height"); }; -dojo.html.setContentBoxWidth=dojo.html.setContentWidth=function(node,_515){ +dojo.html.setContentBoxWidth=dojo.html.setContentWidth=function(node,_551){ return dojo.html._callDeprecated("setContentBoxWidth","setContentBox",arguments,"width"); }; -dojo.html.setContentBoxHeight=dojo.html.setContentHeight=function(node,_517){ +dojo.html.setContentBoxHeight=dojo.html.setContentHeight=function(node,_553){ return dojo.html._callDeprecated("setContentBoxHeight","setContentBox",arguments,"height"); }; -dojo.provide("dojo.html.util"); -dojo.html.getElementWindow=function(_518){ -return dojo.html.getDocumentWindow(_518.ownerDocument); -}; -dojo.html.getDocumentWindow=function(doc){ -if(dojo.render.html.safari&&!doc._parentWindow){ -var fix=function(win){ -win.document._parentWindow=win; -for(var i=0;i=left&&_527.x<=_52d&&_527.y>=top&&_527.y<=_52b); -}; -dojo.html.renderedTextContent=function(node){ -node=dojo.byId(node); -var _52f=""; -if(node==null){ -return _52f; -} -for(var i=0;i]/i).test(txt.replace(/^\s+/))){ -txt=""+txt+"
"; -_538="cell"; +pm=args.propertyMap=parr; +} +dojo.lang.forEach(pm,function(prop){ +if(dj_undef("start",prop)){ +if(prop.property!="opacity"){ +prop.start=parseInt(dojo.html.getComputedStyle(args.nodes[0],prop.property)); }else{ -if((/^]/i).test(txt.replace(/^\s+/))){ -txt=""+txt+"
"; -_538="row"; -}else{ -if((/^<(thead|tbody|tfoot)[\s\r\n>]/i).test(txt.replace(/^\s+/))){ -txt=""+txt+"
"; -_538="section"; +prop.start=dojo.html.getOpacity(args.nodes[0]); } } +}); } -tn.innerHTML=txt; -if(tn["normalize"]){ -tn.normalize(); -} -var _539=null; -switch(_538){ -case "cell": -_539=tn.getElementsByTagName("tr")[0]; -break; -case "row": -_539=tn.getElementsByTagName("tbody")[0]; -break; -case "section": -_539=tn.getElementsByTagName("table")[0]; -break; -default: -_539=tn; -break; -} -var _53a=[]; -for(var x=0;x<_539.childNodes.length;x++){ -_53a.push(_539.childNodes[x].cloneNode(true)); -} -tn.style.display="none"; -dojo.html.destroyNode(tn); -return _53a; }; -dojo.html.placeOnScreen=function(node,_53d,_53e,_53f,_540,_541,_542){ -if(_53d instanceof Array||typeof _53d=="array"){ -_542=_541; -_541=_540; -_540=_53f; -_53f=_53e; -_53e=_53d[1]; -_53d=_53d[0]; -} -if(_541 instanceof String||typeof _541=="string"){ -_541=_541.split(","); -} -if(!isNaN(_53f)){ -_53f=[Number(_53f),Number(_53f)]; -}else{ -if(!(_53f instanceof Array||typeof _53f=="array")){ -_53f=[0,0]; -} -} -var _543=dojo.html.getScroll().offset; -var view=dojo.html.getViewport(); -node=dojo.byId(node); -var _545=node.style.display; -node.style.display=""; -var bb=dojo.html.getBorderBox(node); -var w=bb.width; -var h=bb.height; -node.style.display=_545; -if(!(_541 instanceof Array||typeof _541=="array")){ -_541=["TL"]; -} -var _549,_54a,_54b=Infinity,_54c; -for(var _54d=0;_54d<_541.length;++_54d){ -var _54e=_541[_54d]; -var _54f=true; -var tryX=_53d-(_54e.charAt(1)=="L"?0:w)+_53f[0]*(_54e.charAt(1)=="L"?1:-1); -var tryY=_53e-(_54e.charAt(0)=="T"?0:h)+_53f[1]*(_54e.charAt(0)=="T"?1:-1); -if(_540){ -tryX-=_543.x; -tryY-=_543.y; -} -if(tryX<0){ -tryX=0; -_54f=false; -} -if(tryY<0){ -tryY=0; -_54f=false; -} -var x=tryX+w; -if(x>view.width){ -x=view.width-w; -_54f=false; -}else{ -x=tryX; -} -x=Math.max(_53f[0],x)+_543.x; -var y=tryY+h; -if(y>view.height){ -y=view.height-h; -_54f=false; -}else{ -y=tryY; -} -y=Math.max(_53f[1],y)+_543.y; -if(_54f){ -_549=x; -_54a=y; -_54b=0; -_54c=_54e; -break; -}else{ -var dist=Math.pow(x-tryX-_543.x,2)+Math.pow(y-tryY-_543.y,2); -if(_54b>dist){ -_54b=dist; -_549=x; -_54a=y; -_54c=_54e; -} -} -} -if(!_542){ -node.style.left=_549+"px"; -node.style.top=_54a+"px"; -} -return {left:_549,top:_54a,x:_549,y:_54a,dist:_54b,corner:_54c}; +var _563=function(_564){ +var _565=[]; +dojo.lang.forEach(_564,function(c){ +_565.push(Math.round(c)); +}); +return _565; }; -dojo.html.placeOnScreenPoint=function(node,_556,_557,_558,_559){ -dojo.deprecated("dojo.html.placeOnScreenPoint","use dojo.html.placeOnScreen() instead","0.5"); -return dojo.html.placeOnScreen(node,_556,_557,_558,_559,["TL","TR","BL","BR"]); -}; -dojo.html.placeOnScreenAroundElement=function(node,_55b,_55c,_55d,_55e,_55f){ -var best,_561=Infinity; -_55b=dojo.byId(_55b); -var _562=_55b.style.display; -_55b.style.display=""; -var mb=dojo.html.getElementBox(_55b,_55d); -var _564=mb.width; -var _565=mb.height; -var _566=dojo.html.getAbsolutePosition(_55b,true,_55d); -_55b.style.display=_562; -for(var _567 in _55e){ -var pos,_569,_56a; -var _56b=_55e[_567]; -_569=_566.x+(_567.charAt(1)=="L"?0:_564); -_56a=_566.y+(_567.charAt(0)=="T"?0:_565); -pos=dojo.html.placeOnScreen(node,_569,_56a,_55c,true,_56b,true); -if(pos.dist==0){ -best=pos; -break; -}else{ -if(_561>pos.dist){ -_561=pos.dist; -best=pos; -} -} -} -if(!_55f){ -node.style.left=best.left+"px"; -node.style.top=best.top+"px"; -} -return best; -}; -dojo.html.scrollIntoView=function(node){ -if(!node){ +var _567=function(n,_569){ +n=dojo.byId(n); +if(!n||!n.style){ return; } -if(dojo.render.html.ie){ -if(dojo.html.getBorderBox(node.parentNode).height<=node.parentNode.scrollHeight){ -node.scrollIntoView(false); -} +for(var s in _569){ +try{ +if(s=="opacity"){ +dojo.html.setOpacity(n,_569[s]); }else{ -if(dojo.render.html.mozilla){ -node.scrollIntoView(false); -}else{ -var _56d=node.parentNode; -var _56e=_56d.scrollTop+dojo.html.getBorderBox(_56d).height; -var _56f=node.offsetTop+dojo.html.getMarginBox(node).height; -if(_56e<_56f){ -_56d.scrollTop+=(_56f-_56e); -}else{ -if(_56d.scrollTop>node.offsetTop){ -_56d.scrollTop-=(_56d.scrollTop-node.offsetTop); +n.style[s]=_569[s]; } } +catch(e){ +dojo.debug(e); } } }; +var _56b=function(_56c){ +this._properties=_56c; +this.diffs=new Array(_56c.length); +dojo.lang.forEach(_56c,function(prop,i){ +if(dojo.lang.isFunction(prop.start)){ +prop.start=prop.start(prop,i); +} +if(dojo.lang.isFunction(prop.end)){ +prop.end=prop.end(prop,i); +} +if(dojo.lang.isArray(prop.start)){ +this.diffs[i]=null; +}else{ +if(prop.start instanceof dojo.gfx.color.Color){ +prop.startRgb=prop.start.toRgb(); +prop.endRgb=prop.end.toRgb(); +}else{ +this.diffs[i]=prop.end-prop.start; +} +} +},this); +this.getValue=function(n){ +var ret={}; +dojo.lang.forEach(this._properties,function(prop,i){ +var _573=null; +if(dojo.lang.isArray(prop.start)){ +}else{ +if(prop.start instanceof dojo.gfx.color.Color){ +_573=(prop.units||"rgb")+"("; +for(var j=0;j3){ +_5e8.pop(); +} +var rgb=new dojo.gfx.color.Color(_5e2); +var _5ed=new dojo.gfx.color.Color(_5e8); +var anim=dojo.lfx.propertyAnimation(node,{"background-color":{start:rgb,end:_5ed}},_5e3,_5e4,{"beforeBegin":function(){ +if(_5ea){ +node.style.backgroundImage="none"; +} +node.style.backgroundColor="rgb("+rgb.toRgb().join(",")+")"; +},"onEnd":function(){ +if(_5ea){ +node.style.backgroundImage=_5ea; +} +if(_5eb){ +node.style.backgroundColor="transparent"; +} +if(_5e5){ +_5e5(node,anim); +} +}}); +_5e6.push(anim); +}); +return dojo.lfx.combine(_5e6); +}; +dojo.lfx.html.unhighlight=function(_5ef,_5f0,_5f1,_5f2,_5f3){ +_5ef=dojo.lfx.html._byId(_5ef); +var _5f4=[]; +dojo.lang.forEach(_5ef,function(node){ +var _5f6=new dojo.gfx.color.Color(dojo.html.getBackgroundColor(node)); +var rgb=new dojo.gfx.color.Color(_5f0); +var _5f8=dojo.html.getStyle(node,"background-image"); +var anim=dojo.lfx.propertyAnimation(node,{"background-color":{start:_5f6,end:rgb}},_5f1,_5f2,{"beforeBegin":function(){ +if(_5f8){ +node.style.backgroundImage="none"; +} +node.style.backgroundColor="rgb("+_5f6.toRgb().join(",")+")"; +},"onEnd":function(){ +if(_5f3){ +_5f3(node,anim); +} +}}); +_5f4.push(anim); +}); +return dojo.lfx.combine(_5f4); +}; +dojo.lang.mixin(dojo.lfx,dojo.lfx.html); +dojo.kwCompoundRequire({browser:["dojo.lfx.html"],dashboard:["dojo.lfx.html"]}); +dojo.provide("dojo.lfx.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js.uncompressed.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js.uncompressed.js index 5d3c15ff6..d1d65e863 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js.uncompressed.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js.uncompressed.js @@ -99,8 +99,8 @@ dojo.locale = djConfig.locale; //TODOC: HOW TO DOC THIS? dojo.version = { // summary: version number of this instance of dojo. - major: 0, minor: 4, patch: 2, flag: "", - revision: Number("$Rev: 7616 $".match(/[0-9]+/)[0]), + major: 0, minor: 4, patch: 3, flag: "", + revision: Number("$Rev: 8617 $".match(/[0-9]+/)[0]), toString: function(){ with(dojo.version){ return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String @@ -1390,8 +1390,10 @@ if(typeof window != 'undefined'){ return true; } + dojo.hostenv._djInitFired = false; // BEGIN DOMContentLoaded, from Dean Edwards (http://dean.edwards.name/weblog/2006/06/again/) function dj_load_init(e){ + dojo.hostenv._djInitFired = true; // allow multiple calls, only first one will take effect // A bug in khtml calls events callbacks for document for event which isnt supported // for example a created contextmenu event calls DOMContentLoaded, workaround @@ -1658,6 +1660,78 @@ dojo.requireIf((djConfig["isDebug"] || djConfig["debugAtAllCosts"]), "dojo.debug dojo.requireIf(djConfig["debugAtAllCosts"] && !window.widget && !djConfig["useXDomain"], "dojo.browser_debug"); dojo.requireIf(djConfig["debugAtAllCosts"] && !window.widget && djConfig["useXDomain"], "dojo.browser_debug_xd"); +dojo.provide("dojo.string.common"); + +dojo.string.trim = function(/* string */str, /* integer? */wh){ + // summary + // Trim whitespace from str. If wh > 0, trim from start, if wh < 0, trim from end, else both + if(!str.replace){ return str; } + if(!str.length){ return str; } + var re = (wh > 0) ? (/^\s+/) : (wh < 0) ? (/\s+$/) : (/^\s+|\s+$/g); + return str.replace(re, ""); // string +} + +dojo.string.trimStart = function(/* string */str) { + // summary + // Trim whitespace at the beginning of 'str' + return dojo.string.trim(str, 1); // string +} + +dojo.string.trimEnd = function(/* string */str) { + // summary + // Trim whitespace at the end of 'str' + return dojo.string.trim(str, -1); +} + +dojo.string.repeat = function(/* string */str, /* integer */count, /* string? */separator) { + // summary + // Return 'str' repeated 'count' times, optionally placing 'separator' between each rep + var out = ""; + for(var i = 0; i < count; i++) { + out += str; + if(separator && i < count - 1) { + out += separator; + } + } + return out; // string +} + +dojo.string.pad = function(/* string */str, /* integer */len/*=2*/, /* string */ c/*='0'*/, /* integer */dir/*=1*/) { + // summary + // Pad 'str' to guarantee that it is at least 'len' length with the character 'c' at either the + // start (dir=1) or end (dir=-1) of the string + var out = String(str); + if(!c) { + c = '0'; + } + if(!dir) { + dir = 1; + } + while(out.length < len) { + if(dir > 0) { + out = c + out; + } else { + out += c; + } + } + return out; // string +} + +dojo.string.padLeft = function(/* string */str, /* integer */len, /* string */c) { + // summary + // same as dojo.string.pad(str, len, c, 1) + return dojo.string.pad(str, len, c, 1); // string +} + +dojo.string.padRight = function(/* string */str, /* integer */len, /* string */c) { + // summary + // same as dojo.string.pad(str, len, c, -1) + return dojo.string.pad(str, len, c, -1); // string +} + +dojo.provide("dojo.string"); + + dojo.provide("dojo.lang.common"); dojo.lang.inherits = function(/*Function*/subclass, /*Function*/superclass){ @@ -1902,6 +1976,664 @@ dojo.lang.isUndefined = function(/*anything*/ it){ // end Crockford functions +dojo.provide("dojo.lang.extras"); + + + +dojo.lang.setTimeout = function(/*Function*/func, /*int*/delay /*, ...*/){ + // summary: + // Sets a timeout in milliseconds to execute a function in a given + // context with optional arguments. + // usage: + // dojo.lang.setTimeout(Object context, function func, number delay[, arg1[, ...]]); + // dojo.lang.setTimeout(function func, number delay[, arg1[, ...]]); + + var context = window, argsStart = 2; + if(!dojo.lang.isFunction(func)){ + context = func; + func = delay; + delay = arguments[2]; + argsStart++; + } + + if(dojo.lang.isString(func)){ + func = context[func]; + } + + var args = []; + for (var i = argsStart; i < arguments.length; i++){ + args.push(arguments[i]); + } + return dojo.global().setTimeout(function(){ func.apply(context, args); }, delay); // int +} + +dojo.lang.clearTimeout = function(/*int*/timer){ + // summary: clears timer by number from the execution queue + + // FIXME: + // why do we have this function? It's not portable outside of browser + // environments and it's a stupid wrapper on something that browsers + // provide anyway. + dojo.global().clearTimeout(timer); +} + +dojo.lang.getNameInObj = function(/*Object*/ns, /*unknown*/item){ + // summary: + // looks for a value in the object ns with a value matching item and + // returns the property name + // ns: if null, dj_global is used + // item: value to return a name for + if(!ns){ ns = dj_global; } + + for(var x in ns){ + if(ns[x] === item){ + return new String(x); // String + } + } + return null; // null +} + +dojo.lang.shallowCopy = function(/*Object*/obj, /*Boolean?*/deep){ + // summary: + // copies object obj one level deep, or full depth if deep is true + var i, ret; + + if(obj === null){ /*obj: null*/ return null; } // null + + if(dojo.lang.isObject(obj)){ + // obj: Object + ret = new obj.constructor(); + for(i in obj){ + if(dojo.lang.isUndefined(ret[i])){ + ret[i] = deep ? dojo.lang.shallowCopy(obj[i], deep) : obj[i]; + } + } + }else if(dojo.lang.isArray(obj)){ + // obj: Array + ret = []; + for(i=0; i hacks: + * iframe document hacks allow browsers to communicate asynchronously + * with a server via HTTP POST and GET operations. With significant + * effort and server cooperation, low-latency data transit between + * client and server can be acheived via iframe mechanisms (repubsub). + * + * SVG: + * Adobe's SVG viewer implements helpful primitives for XML-based + * requests, but receipt of arbitrary text data seems unlikely w/o + * sections. + * + * + * A discussion between Dylan, Mark, Tom, and Alex helped to lay down a lot + * the IO API interface. A transcript of it can be found at: + * http://dojotoolkit.org/viewcvs/viewcvs.py/documents/irc/irc_io_api_log.txt?rev=307&view=auto + * + * Also referenced in the design of the API was the DOM 3 L&S spec: + * http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html + ******************************************************************************/ + +// a map of the available transport options. Transports should add themselves +// by calling add(name) +dojo.io.transports = []; +dojo.io.hdlrFuncNames = [ "load", "error", "timeout" ]; // we're omitting a progress() event for now + +dojo.io.Request = function(/*String*/ url, /*String*/ mimetype, /*String*/ transport, /*String or Boolean*/ changeUrl){ +// summary: +// Constructs a Request object that is used by dojo.io.bind(). +// description: +// dojo.io.bind() will create one of these for you if +// you call dojo.io.bind() with an plain object containing the bind parameters. +// This method can either take the arguments specified, or an Object containing all of the parameters that you +// want to use to create the dojo.io.Request (similar to how dojo.io.bind() is called. +// The named parameters to this constructor represent the minimum set of parameters need + if((arguments.length == 1)&&(arguments[0].constructor == Object)){ + this.fromKwArgs(arguments[0]); + }else{ + this.url = url; + if(mimetype){ this.mimetype = mimetype; } + if(transport){ this.transport = transport; } + if(arguments.length >= 4){ this.changeUrl = changeUrl; } + } +} + +dojo.lang.extend(dojo.io.Request, { + + /** The URL to hit */ + url: "", + + /** The mime type used to interrpret the response body */ + mimetype: "text/plain", + + /** The HTTP method to use */ + method: "GET", + + /** An Object containing key-value pairs to be included with the request */ + content: undefined, // Object + + /** The transport medium to use */ + transport: undefined, // String + + /** If defined the URL of the page is physically changed */ + changeUrl: undefined, // String + + /** A form node to use in the request */ + formNode: undefined, // HTMLFormElement + + /** Whether the request should be made synchronously */ + sync: false, + + bindSuccess: false, + + /** Cache/look for the request in the cache before attempting to request? + * NOTE: this isn't a browser cache, this is internal and would only cache in-page + */ + useCache: false, + + /** Prevent the browser from caching this by adding a query string argument to the URL */ + preventCache: false, + + jsonFilter: function(value){ + if( (this.mimetype == "text/json-comment-filtered")|| + (this.mimetype == "application/json-comment-filtered") + ){ + var cStartIdx = value.indexOf("\/*"); + var cEndIdx = value.lastIndexOf("*\/"); + if((cStartIdx == -1)||(cEndIdx == -1)){ + dojo.debug("your JSON wasn't comment filtered!"); // FIXME: throw exception instead? + return ""; + } + return value.substring(cStartIdx+2, cEndIdx); + } + dojo.debug("please consider using a mimetype of text/json-comment-filtered to avoid potential security issues with JSON endpoints"); + return value; + }, + + // events stuff + load: function(/*String*/type, /*Object*/data, /*Object*/transportImplementation, /*Object*/kwArgs){ + // summary: + // Called on successful completion of a bind. + // type: String + // A string with value "load" + // data: Object + // The object representing the result of the bind. The actual structure + // of the data object will depend on the mimetype that was given to bind + // in the bind arguments. + // transportImplementation: Object + // The object that implements a particular transport. Structure is depedent + // on the transport. For XMLHTTPTransport (dojo.io.BrowserIO), it will be the + // XMLHttpRequest object from the browser. + // kwArgs: Object + // Object that contains the request parameters that were given to the + // bind call. Useful for storing and retrieving state from when bind + // was called. + }, + error: function(/*String*/type, /*Object*/error, /*Object*/transportImplementation, /*Object*/kwArgs){ + // summary: + // Called when there is an error with a bind. + // type: String + // A string with value "error" + // error: Object + // The error object. Should be a dojo.io.Error object, but not guaranteed. + // transportImplementation: Object + // The object that implements a particular transport. Structure is depedent + // on the transport. For XMLHTTPTransport (dojo.io.BrowserIO), it will be the + // XMLHttpRequest object from the browser. + // kwArgs: Object + // Object that contains the request parameters that were given to the + // bind call. Useful for storing and retrieving state from when bind + // was called. + }, + timeout: function(/*String*/type, /*Object*/empty, /*Object*/transportImplementation, /*Object*/kwArgs){ + // summary: + // Called when there is an error with a bind. Only implemented in certain transports at this time. + // type: String + // A string with value "timeout" + // empty: Object + // Should be null. Just a spacer argument so that load, error, timeout and handle have the + // same signatures. + // transportImplementation: Object + // The object that implements a particular transport. Structure is depedent + // on the transport. For XMLHTTPTransport (dojo.io.BrowserIO), it will be the + // XMLHttpRequest object from the browser. May be null for the timeout case for + // some transports. + // kwArgs: Object + // Object that contains the request parameters that were given to the + // bind call. Useful for storing and retrieving state from when bind + // was called. + }, + handle: function(/*String*/type, /*Object*/data, /*Object*/transportImplementation, /*Object*/kwArgs){ + // summary: + // The handle method can be defined instead of defining separate load, error and timeout + // callbacks. + // type: String + // A string with the type of callback: "load", "error", or "timeout". + // data: Object + // See the above callbacks for what this parameter could be. + // transportImplementation: Object + // The object that implements a particular transport. Structure is depedent + // on the transport. For XMLHTTPTransport (dojo.io.BrowserIO), it will be the + // XMLHttpRequest object from the browser. + // kwArgs: Object + // Object that contains the request parameters that were given to the + // bind call. Useful for storing and retrieving state from when bind + // was called. + }, + + //FIXME: change IframeIO.js to use timeouts? + // The number of seconds to wait until firing a timeout callback. + // If it is zero, that means, don't do a timeout check. + timeoutSeconds: 0, + + // the abort method needs to be filled in by the transport that accepts the + // bind() request + abort: function(){ }, + + // backButton: function(){ }, + // forwardButton: function(){ }, + + fromKwArgs: function(/*Object*/ kwArgs){ + // summary: + // Creates a dojo.io.Request from a simple object (kwArgs object). + + // normalize args + if(kwArgs["url"]){ kwArgs.url = kwArgs.url.toString(); } + if(kwArgs["formNode"]) { kwArgs.formNode = dojo.byId(kwArgs.formNode); } + if(!kwArgs["method"] && kwArgs["formNode"] && kwArgs["formNode"].method) { + kwArgs.method = kwArgs["formNode"].method; + } + + // backwards compatibility + if(!kwArgs["handle"] && kwArgs["handler"]){ kwArgs.handle = kwArgs.handler; } + if(!kwArgs["load"] && kwArgs["loaded"]){ kwArgs.load = kwArgs.loaded; } + if(!kwArgs["changeUrl"] && kwArgs["changeURL"]) { kwArgs.changeUrl = kwArgs.changeURL; } + + // encoding fun! + kwArgs.encoding = dojo.lang.firstValued(kwArgs["encoding"], djConfig["bindEncoding"], ""); + + kwArgs.sendTransport = dojo.lang.firstValued(kwArgs["sendTransport"], djConfig["ioSendTransport"], false); + + var isFunction = dojo.lang.isFunction; + for(var x=0; x 0){ + dojo.io.bind(dojo.io._bindQueue.shift()); + }else{ + dojo.io._queueBindInFlight = false; + } + } +} +dojo.io._bindQueue = []; +dojo.io._queueBindInFlight = false; + +dojo.io.argsFromMap = function(/*Object*/map, /*String?*/encoding, /*String?*/last){ + // summary: + // Converts name/values pairs in the map object to an URL-encoded string + // with format of name1=value1&name2=value2... + // map: Object + // Object that has the contains the names and values. + // encoding: String? + // String to specify how to encode the name and value. If the encoding string + // contains "utf" (case-insensitive), then encodeURIComponent is used. Otherwise + // dojo.string.encodeAscii is used. + // last: String? + // The last parameter in the list. Helps with final string formatting? + var enc = /utf/i.test(encoding||"") ? encodeURIComponent : dojo.string.encodeAscii; + var mapped = []; + var control = new Object(); + for(var name in map){ + var domap = function(elt){ + var val = enc(name)+"="+enc(elt); + mapped[(last == name) ? "push" : "unshift"](val); + } + if(!control[name]){ + var value = map[name]; + // FIXME: should be isArrayLike? + if (dojo.lang.isArray(value)){ + dojo.lang.forEach(value, domap); + }else{ + domap(value); + } + } + } + return mapped.join("&"); //String +} + +dojo.io.setIFrameSrc = function(/*DOMNode*/ iframe, /*String*/ src, /*Boolean*/ replace){ + //summary: + // Sets the URL that is loaded in an IFrame. The replace parameter indicates whether + // location.replace() should be used when changing the location of the iframe. + try{ + var r = dojo.render.html; + // dojo.debug(iframe); + if(!replace){ + if(r.safari){ + iframe.location = src; + }else{ + frames[iframe.name].location = src; + } + }else{ + // Fun with DOM 0 incompatibilities! + var idoc; + if(r.ie){ + idoc = iframe.contentWindow.document; + }else if(r.safari){ + idoc = iframe.document; + }else{ // if(r.moz){ + idoc = iframe.contentWindow; + } + + //For Safari (at least 2.0.3) and Opera, if the iframe + //has just been created but it doesn't have content + //yet, then iframe.document may be null. In that case, + //use iframe.location and return. + if(!idoc){ + iframe.location = src; + return; + }else{ + idoc.location.replace(src); + } + } + }catch(e){ + dojo.debug(e); + dojo.debug("setIFrameSrc: "+e); + } +} + +/* +dojo.io.sampleTranport = new function(){ + this.canHandle = function(kwArgs){ + // canHandle just tells dojo.io.bind() if this is a good transport to + // use for the particular type of request. + if( + ( + (kwArgs["mimetype"] == "text/plain") || + (kwArgs["mimetype"] == "text/html") || + (kwArgs["mimetype"] == "text/javascript") + )&&( + (kwArgs["method"] == "get") || + ( (kwArgs["method"] == "post") && (!kwArgs["formNode"]) ) + ) + ){ + return true; + } + + return false; + } + + this.bind = function(kwArgs){ + var hdlrObj = {}; + + // set up a handler object + for(var x=0; x"' +// Optionally skips escapes for single quotes + + str = str.replace(/&/gm, "&").replace(//gm, ">").replace(/"/gm, """); + if(!noSingleQuotes){ str = str.replace(/'/gm, "'"); } + return str; // string +} + +dojo.string.escapeSql = function(/*string*/str){ +//summary: +// Adds escape sequences for single quotes in SQL expressions + + return str.replace(/'/gm, "''"); //string +} + +dojo.string.escapeRegExp = function(/*string*/str){ +//summary: +// Adds escape sequences for special characters in regular expressions + + return str.replace(/\\/gm, "\\\\").replace(/([\f\b\n\t\r[\^$|?*+(){}])/gm, "\\$1"); // string +} + +//FIXME: should this one also escape backslash? +dojo.string.escapeJavaScript = function(/*string*/str){ +//summary: +// Adds escape sequences for single and double quotes as well +// as non-visible characters in JavaScript string literal expressions + + return str.replace(/(["'\f\b\n\t\r])/gm, "\\$1"); // string +} + +//FIXME: looks a lot like escapeJavaScript, just adds quotes? deprecate one? +dojo.string.escapeString = function(/*string*/str){ +//summary: +// Adds escape sequences for non-visual characters, double quote and backslash +// and surrounds with double quotes to form a valid string literal. + return ('"' + str.replace(/(["\\])/g, '\\$1') + '"' + ).replace(/[\f]/g, "\\f" + ).replace(/[\b]/g, "\\b" + ).replace(/[\n]/g, "\\n" + ).replace(/[\t]/g, "\\t" + ).replace(/[\r]/g, "\\r"); // string +} + +// TODO: make an HTML version +dojo.string.summary = function(/*string*/str, /*number*/len){ +// summary: +// Truncates 'str' after 'len' characters and appends periods as necessary so that it ends with "..." + + if(!len || str.length <= len){ + return str; // string + } + + return str.substring(0, len).replace(/\.+$/, "") + "..."; // string +} + +dojo.string.endsWith = function(/*string*/str, /*string*/end, /*boolean*/ignoreCase){ +// summary: +// Returns true if 'str' ends with 'end' + + if(ignoreCase){ + str = str.toLowerCase(); + end = end.toLowerCase(); + } + if((str.length - end.length) < 0){ + return false; // boolean + } + return str.lastIndexOf(end) == str.length - end.length; // boolean +} + +dojo.string.endsWithAny = function(/*string*/str /* , ... */){ +// summary: +// Returns true if 'str' ends with any of the arguments[2 -> n] + + for(var i = 1; i < arguments.length; i++) { + if(dojo.string.endsWith(str, arguments[i])) { + return true; // boolean + } + } + return false; // boolean +} + +dojo.string.startsWith = function(/*string*/str, /*string*/start, /*boolean*/ignoreCase){ +// summary: +// Returns true if 'str' starts with 'start' + + if(ignoreCase) { + str = str.toLowerCase(); + start = start.toLowerCase(); + } + return str.indexOf(start) == 0; // boolean +} + +dojo.string.startsWithAny = function(/*string*/str /* , ... */){ +// summary: +// Returns true if 'str' starts with any of the arguments[2 -> n] + + for(var i = 1; i < arguments.length; i++) { + if(dojo.string.startsWith(str, arguments[i])) { + return true; // boolean + } + } + return false; // boolean +} + +dojo.string.has = function(/*string*/str /* , ... */) { +// summary: +// Returns true if 'str' contains any of the arguments 2 -> n + + for(var i = 1; i < arguments.length; i++) { + if(str.indexOf(arguments[i]) > -1){ + return true; // boolean + } + } + return false; // boolean +} + +dojo.string.normalizeNewlines = function(/*string*/text, /*string? (\n or \r)*/newlineChar){ +// summary: +// Changes occurences of CR and LF in text to CRLF, or if newlineChar is provided as '\n' or '\r', +// substitutes newlineChar for occurrences of CR/LF and CRLF + + if (newlineChar == "\n"){ + text = text.replace(/\r\n/g, "\n"); + text = text.replace(/\r/g, "\n"); + } else if (newlineChar == "\r"){ + text = text.replace(/\r\n/g, "\r"); + text = text.replace(/\n/g, "\r"); + }else{ + text = text.replace(/([^\r])\n/g, "$1\r\n").replace(/\r([^\n])/g, "\r\n$1"); + } + return text; // string +} + +dojo.string.splitEscaped = function(/*string*/str, /*string of length=1*/charac){ +// summary: +// Splits 'str' into an array separated by 'charac', but skips characters escaped with a backslash + + var components = []; + for (var i = 0, prevcomma = 0; i < str.length; i++){ + if (str.charAt(i) == '\\'){ i++; continue; } + if (str.charAt(i) == charac){ + components.push(str.substring(prevcomma, i)); + prevcomma = i + 1; + } + } + components.push(str.substr(prevcomma)); + return components; // array +} + +dojo.provide("dojo.dom"); + +dojo.dom.ELEMENT_NODE = 1; +dojo.dom.ATTRIBUTE_NODE = 2; +dojo.dom.TEXT_NODE = 3; +dojo.dom.CDATA_SECTION_NODE = 4; +dojo.dom.ENTITY_REFERENCE_NODE = 5; +dojo.dom.ENTITY_NODE = 6; +dojo.dom.PROCESSING_INSTRUCTION_NODE = 7; +dojo.dom.COMMENT_NODE = 8; +dojo.dom.DOCUMENT_NODE = 9; +dojo.dom.DOCUMENT_TYPE_NODE = 10; +dojo.dom.DOCUMENT_FRAGMENT_NODE = 11; +dojo.dom.NOTATION_NODE = 12; + +dojo.dom.dojoml = "http://www.dojotoolkit.org/2004/dojoml"; + +/** + * comprehensive list of XML namespaces +**/ +dojo.dom.xmlns = { + // summary + // aliases for various common XML namespaces + svg : "http://www.w3.org/2000/svg", + smil : "http://www.w3.org/2001/SMIL20/", + mml : "http://www.w3.org/1998/Math/MathML", + cml : "http://www.xml-cml.org", + xlink : "http://www.w3.org/1999/xlink", + xhtml : "http://www.w3.org/1999/xhtml", + xul : "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", + xbl : "http://www.mozilla.org/xbl", + fo : "http://www.w3.org/1999/XSL/Format", + xsl : "http://www.w3.org/1999/XSL/Transform", + xslt : "http://www.w3.org/1999/XSL/Transform", + xi : "http://www.w3.org/2001/XInclude", + xforms : "http://www.w3.org/2002/01/xforms", + saxon : "http://icl.com/saxon", + xalan : "http://xml.apache.org/xslt", + xsd : "http://www.w3.org/2001/XMLSchema", + dt: "http://www.w3.org/2001/XMLSchema-datatypes", + xsi : "http://www.w3.org/2001/XMLSchema-instance", + rdf : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + rdfs : "http://www.w3.org/2000/01/rdf-schema#", + dc : "http://purl.org/dc/elements/1.1/", + dcq: "http://purl.org/dc/qualifiers/1.0", + "soap-env" : "http://schemas.xmlsoap.org/soap/envelope/", + wsdl : "http://schemas.xmlsoap.org/wsdl/", + AdobeExtensions : "http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" +}; + +dojo.dom.isNode = function(/* object */wh){ + // summary: + // checks to see if wh is actually a node. + if(typeof Element == "function") { + try { + return wh instanceof Element; // boolean + } catch(e) {} + } else { + // best-guess + return wh && !isNaN(wh.nodeType); // boolean + } +} + +dojo.dom.getUniqueId = function(){ + // summary: + // returns a unique string for use with any DOM element + var _document = dojo.doc(); + do { + var id = "dj_unique_" + (++arguments.callee._idIncrement); + }while(_document.getElementById(id)); + return id; // string +} +dojo.dom.getUniqueId._idIncrement = 0; + +dojo.dom.firstElement = dojo.dom.getFirstChildElement = function(/* Element */parentNode, /* string? */tagName){ + // summary: + // returns the first child element matching tagName + var node = parentNode.firstChild; + while(node && node.nodeType != dojo.dom.ELEMENT_NODE){ + node = node.nextSibling; + } + if(tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) { + node = dojo.dom.nextElement(node, tagName); + } + return node; // Element +} + +dojo.dom.lastElement = dojo.dom.getLastChildElement = function(/* Element */parentNode, /* string? */tagName){ + // summary: + // returns the last child element matching tagName + var node = parentNode.lastChild; + while(node && node.nodeType != dojo.dom.ELEMENT_NODE) { + node = node.previousSibling; + } + if(tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) { + node = dojo.dom.prevElement(node, tagName); + } + return node; // Element +} + +dojo.dom.nextElement = dojo.dom.getNextSiblingElement = function(/* Node */node, /* string? */tagName){ + // summary: + // returns the next sibling element matching tagName + if(!node) { return null; } + do { + node = node.nextSibling; + } while(node && node.nodeType != dojo.dom.ELEMENT_NODE); + + if(node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) { + return dojo.dom.nextElement(node, tagName); + } + return node; // Element +} + +dojo.dom.prevElement = dojo.dom.getPreviousSiblingElement = function(/* Node */node, /* string? */tagName){ + // summary: + // returns the previous sibling element matching tagName + if(!node) { return null; } + if(tagName) { tagName = tagName.toLowerCase(); } + do { + node = node.previousSibling; + } while(node && node.nodeType != dojo.dom.ELEMENT_NODE); + + if(node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) { + return dojo.dom.prevElement(node, tagName); + } + return node; // Element +} + +// TODO: hmph +/*this.forEachChildTag = function(node, unaryFunc) { + var child = this.getFirstChildTag(node); + while(child) { + if(unaryFunc(child) == "break") { break; } + child = this.getNextSiblingTag(child); + } +}*/ + +dojo.dom.moveChildren = function(/*Element*/srcNode, /*Element*/destNode, /*boolean?*/trim){ + // summary: + // Moves children from srcNode to destNode and returns the count of + // children moved; will trim off text nodes if trim == true + var count = 0; + if(trim) { + while(srcNode.hasChildNodes() && + srcNode.firstChild.nodeType == dojo.dom.TEXT_NODE) { + srcNode.removeChild(srcNode.firstChild); + } + while(srcNode.hasChildNodes() && + srcNode.lastChild.nodeType == dojo.dom.TEXT_NODE) { + srcNode.removeChild(srcNode.lastChild); + } + } + while(srcNode.hasChildNodes()){ + destNode.appendChild(srcNode.firstChild); + count++; + } + return count; // number +} + +dojo.dom.copyChildren = function(/*Element*/srcNode, /*Element*/destNode, /*boolean?*/trim){ + // summary: + // Copies children from srcNde to destNode and returns the count of + // children copied; will trim off text nodes if trim == true + var clonedNode = srcNode.cloneNode(true); + return this.moveChildren(clonedNode, destNode, trim); // number +} + +dojo.dom.replaceChildren = function(/*Element*/node, /*Node*/newChild){ + // summary: + // Removes all children of node and appends newChild. All the existing + // children will be destroyed. + // FIXME: what if newChild is an array-like object? + var nodes = []; + if(dojo.render.html.ie){ + for(var i=0;i 0){ + return ancestors[0]; // Node + } + + node = node.parentNode; + } + if(returnFirstHit){ return null; } + return ancestors; // array +} + +dojo.dom.getAncestorsByTag = function(/*Node*/node, /*String*/tag, /*boolean?*/returnFirstHit){ + // summary: + // returns all ancestors matching tag (as tagName), will only return + // first one if returnFirstHit + tag = tag.toLowerCase(); + return dojo.dom.getAncestors(node, function(el){ + return ((el.tagName)&&(el.tagName.toLowerCase() == tag)); + }, returnFirstHit); // Node || array +} + +dojo.dom.getFirstAncestorByTag = function(/*Node*/node, /*string*/tag){ + // summary: + // Returns first ancestor of node with tag tagName + return dojo.dom.getAncestorsByTag(node, tag, true); // Node +} + +dojo.dom.isDescendantOf = function(/* Node */node, /* Node */ancestor, /* boolean? */guaranteeDescendant){ + // summary + // Returns boolean if node is a descendant of ancestor + // guaranteeDescendant allows us to be a "true" isDescendantOf function + if(guaranteeDescendant && node) { node = node.parentNode; } + while(node) { + if(node == ancestor){ + return true; // boolean + } + node = node.parentNode; + } + return false; // boolean +} + +dojo.dom.innerXML = function(/*Node*/node){ + // summary: + // Implementation of MS's innerXML function. + if(node.innerXML){ + return node.innerXML; // string + }else if (node.xml){ + return node.xml; // string + }else if(typeof XMLSerializer != "undefined"){ + return (new XMLSerializer()).serializeToString(node); // string + } +} + +dojo.dom.createDocument = function(){ + // summary: + // cross-browser implementation of creating an XML document object. + var doc = null; + var _document = dojo.doc(); + + if(!dj_undef("ActiveXObject")){ + var prefixes = [ "MSXML2", "Microsoft", "MSXML", "MSXML3" ]; + for(var i = 0; i1) { + var _document = dojo.doc(); + dojo.dom.replaceChildren(node, _document.createTextNode(text)); + return text; // string + } else { + if(node.textContent != undefined){ //FF 1.5 + return node.textContent; // string + } + var _result = ""; + if (node == null) { return _result; } + for (var i = 0; i < node.childNodes.length; i++) { + switch (node.childNodes[i].nodeType) { + case 1: // ELEMENT_NODE + case 5: // ENTITY_REFERENCE_NODE + _result += dojo.dom.textContent(node.childNodes[i]); + break; + case 3: // TEXT_NODE + case 2: // ATTRIBUTE_NODE + case 4: // CDATA_SECTION_NODE + _result += node.childNodes[i].nodeValue; + break; + default: + break; + } + } + return _result; // string + } +} + +dojo.dom.hasParent = function(/*Node*/node){ + // summary: + // returns whether or not node is a child of another node. + return Boolean(node && node.parentNode && dojo.dom.isNode(node.parentNode)); // boolean +} + +/** + * Examples: + * + * myFooNode = + * isTag(myFooNode, "foo"); // returns "foo" + * isTag(myFooNode, "bar"); // returns "" + * isTag(myFooNode, "FOO"); // returns "" + * isTag(myFooNode, "hey", "foo", "bar"); // returns "foo" +**/ +dojo.dom.isTag = function(/* Node */node /* ... */){ + // summary: + // determines if node has any of the provided tag names and returns + // the tag name that matches, empty string otherwise. + if(node && node.tagName) { + for(var i=1; i"); + } +}catch(e){/* squelch */} + +if(dojo.render.html.opera){ + dojo.debug("Opera is not supported with dojo.undo.browser, so back/forward detection will not work."); +} + +dojo.undo.browser = { + initialHref: (!dj_undef("window")) ? window.location.href : "", + initialHash: (!dj_undef("window")) ? window.location.hash : "", + + moveForward: false, + historyStack: [], + forwardStack: [], + historyIframe: null, + bookmarkAnchor: null, + locationTimer: null, + + /** + * + */ + setInitialState: function(/*Object*/args){ + //summary: Sets the state object and back callback for the very first page that is loaded. + //description: It is recommended that you call this method as part of an event listener that is registered via + //dojo.addOnLoad(). + //args: Object + // See the addToHistory() function for the list of valid args properties. + this.initialState = this._createState(this.initialHref, args, this.initialHash); + }, + + //FIXME: Would like to support arbitrary back/forward jumps. Have to rework iframeLoaded among other things. + //FIXME: is there a slight race condition in moz using change URL with the timer check and when + // the hash gets set? I think I have seen a back/forward call in quick succession, but not consistent. + addToHistory: function(args){ + //summary: adds a state object (args) to the history list. You must set + //djConfig.preventBackButtonFix = false to use dojo.undo.browser. + + //args: Object + // args can have the following properties: + // To support getting back button notifications, the object argument should implement a + // function called either "back", "backButton", or "handle". The string "back" will be + // passed as the first and only argument to this callback. + // - To support getting forward button notifications, the object argument should implement a + // function called either "forward", "forwardButton", or "handle". The string "forward" will be + // passed as the first and only argument to this callback. + // - If you want the browser location string to change, define "changeUrl" on the object. If the + // value of "changeUrl" is true, then a unique number will be appended to the URL as a fragment + // identifier (http://some.domain.com/path#uniquenumber). If it is any other value that does + // not evaluate to false, that value will be used as the fragment identifier. For example, + // if changeUrl: 'page1', then the URL will look like: http://some.domain.com/path#page1 + // Full example: + // dojo.undo.browser.addToHistory({ + // back: function() { alert('back pressed'); }, + // forward: function() { alert('forward pressed'); }, + // changeUrl: true + // }); + // + // BROWSER NOTES: + // Safari 1.2: + // back button "works" fine, however it's not possible to actually + // DETECT that you've moved backwards by inspecting window.location. + // Unless there is some other means of locating. + // FIXME: perhaps we can poll on history.length? + // Safari 2.0.3+ (and probably 1.3.2+): + // works fine, except when changeUrl is used. When changeUrl is used, + // Safari jumps all the way back to whatever page was shown before + // the page that uses dojo.undo.browser support. + // IE 5.5 SP2: + // back button behavior is macro. It does not move back to the + // previous hash value, but to the last full page load. This suggests + // that the iframe is the correct way to capture the back button in + // these cases. + // Don't test this page using local disk for MSIE. MSIE will not create + // a history list for iframe_history.html if served from a file: URL. + // The XML served back from the XHR tests will also not be properly + // created if served from local disk. Serve the test pages from a web + // server to test in that browser. + // IE 6.0: + // same behavior as IE 5.5 SP2 + // Firefox 1.0+: + // the back button will return us to the previous hash on the same + // page, thereby not requiring an iframe hack, although we do then + // need to run a timer to detect inter-page movement. + + //If addToHistory is called, then that means we prune the + //forward stack -- the user went back, then wanted to + //start a new forward path. + this.forwardStack = []; + + var hash = null; + var url = null; + if(!this.historyIframe){ + if(djConfig["useXDomain"] && !djConfig["dojoIframeHistoryUrl"]){ + dojo.debug("dojo.undo.browser: When using cross-domain Dojo builds," + + " please save iframe_history.html to your domain and set djConfig.dojoIframeHistoryUrl" + + " to the path on your domain to iframe_history.html"); + } + this.historyIframe = window.frames["djhistory"]; + } + if(!this.bookmarkAnchor){ + this.bookmarkAnchor = document.createElement("a"); + dojo.body().appendChild(this.bookmarkAnchor); + this.bookmarkAnchor.style.display = "none"; + } + if(args["changeUrl"]){ + hash = "#"+ ((args["changeUrl"]!==true) ? args["changeUrl"] : (new Date()).getTime()); + + //If the current hash matches the new one, just replace the history object with + //this new one. It doesn't make sense to track different state objects for the same + //logical URL. This matches the browser behavior of only putting in one history + //item no matter how many times you click on the same #hash link, at least in Firefox + //and Safari, and there is no reliable way in those browsers to know if a #hash link + //has been clicked on multiple times. So making this the standard behavior in all browsers + //so that dojo.undo.browser's behavior is the same in all browsers. + if(this.historyStack.length == 0 && this.initialState.urlHash == hash){ + this.initialState = this._createState(url, args, hash); + return; + }else if(this.historyStack.length > 0 && this.historyStack[this.historyStack.length - 1].urlHash == hash){ + this.historyStack[this.historyStack.length - 1] = this._createState(url, args, hash); + return; + } + + this.changingUrl = true; + setTimeout("window.location.href = '"+hash+"'; dojo.undo.browser.changingUrl = false;", 1); + this.bookmarkAnchor.href = hash; + + if(dojo.render.html.ie){ + url = this._loadIframeHistory(); + + var oldCB = args["back"]||args["backButton"]||args["handle"]; + + //The function takes handleName as a parameter, in case the + //callback we are overriding was "handle". In that case, + //we will need to pass the handle name to handle. + var tcb = function(handleName){ + if(window.location.hash != ""){ + setTimeout("window.location.href = '"+hash+"';", 1); + } + //Use apply to set "this" to args, and to try to avoid memory leaks. + oldCB.apply(this, [handleName]); + } + + //Set interceptor function in the right place. + if(args["back"]){ + args.back = tcb; + }else if(args["backButton"]){ + args.backButton = tcb; + }else if(args["handle"]){ + args.handle = tcb; + } + + var oldFW = args["forward"]||args["forwardButton"]||args["handle"]; + + //The function takes handleName as a parameter, in case the + //callback we are overriding was "handle". In that case, + //we will need to pass the handle name to handle. + var tfw = function(handleName){ + if(window.location.hash != ""){ + window.location.href = hash; + } + if(oldFW){ // we might not actually have one + //Use apply to set "this" to args, and to try to avoid memory leaks. + oldFW.apply(this, [handleName]); + } + } + + //Set interceptor function in the right place. + if(args["forward"]){ + args.forward = tfw; + }else if(args["forwardButton"]){ + args.forwardButton = tfw; + }else if(args["handle"]){ + args.handle = tfw; + } + + }else if(dojo.render.html.moz){ + // start the timer + if(!this.locationTimer){ + this.locationTimer = setInterval("dojo.undo.browser.checkLocation();", 200); + } + } + }else{ + url = this._loadIframeHistory(); + } + + this.historyStack.push(this._createState(url, args, hash)); + }, + + checkLocation: function(){ + //summary: private method. Do not call this directly. + if (!this.changingUrl){ + var hsl = this.historyStack.length; + + if((window.location.hash == this.initialHash||window.location.href == this.initialHref)&&(hsl == 1)){ + // FIXME: could this ever be a forward button? + // we can't clear it because we still need to check for forwards. Ugg. + // clearInterval(this.locationTimer); + this.handleBackButton(); + return; + } + + // first check to see if we could have gone forward. We always halt on + // a no-hash item. + if(this.forwardStack.length > 0){ + if(this.forwardStack[this.forwardStack.length-1].urlHash == window.location.hash){ + this.handleForwardButton(); + return; + } + } + + // ok, that didn't work, try someplace back in the history stack + if((hsl >= 2)&&(this.historyStack[hsl-2])){ + if(this.historyStack[hsl-2].urlHash==window.location.hash){ + this.handleBackButton(); + return; + } + } + } + }, + + iframeLoaded: function(evt, ifrLoc){ + //summary: private method. Do not call this directly. + if(!dojo.render.html.opera){ + var query = this._getUrlQuery(ifrLoc.href); + if(query == null){ + // alert("iframeLoaded"); + // we hit the end of the history, so we should go back + if(this.historyStack.length == 1){ + this.handleBackButton(); + } + return; + } + if(this.moveForward){ + // we were expecting it, so it's not either a forward or backward movement + this.moveForward = false; + return; + } + + //Check the back stack first, since it is more likely. + //Note that only one step back or forward is supported. + if(this.historyStack.length >= 2 && query == this._getUrlQuery(this.historyStack[this.historyStack.length-2].url)){ + this.handleBackButton(); + } + else if(this.forwardStack.length > 0 && query == this._getUrlQuery(this.forwardStack[this.forwardStack.length-1].url)){ + this.handleForwardButton(); + } + } + }, + + handleBackButton: function(){ + //summary: private method. Do not call this directly. + + //The "current" page is always at the top of the history stack. + var current = this.historyStack.pop(); + if(!current){ return; } + var last = this.historyStack[this.historyStack.length-1]; + if(!last && this.historyStack.length == 0){ + last = this.initialState; + } + if (last){ + if(last.kwArgs["back"]){ + last.kwArgs["back"](); + }else if(last.kwArgs["backButton"]){ + last.kwArgs["backButton"](); + }else if(last.kwArgs["handle"]){ + last.kwArgs.handle("back"); + } + } + this.forwardStack.push(current); + }, + + handleForwardButton: function(){ + //summary: private method. Do not call this directly. + + var last = this.forwardStack.pop(); + if(!last){ return; } + if(last.kwArgs["forward"]){ + last.kwArgs.forward(); + }else if(last.kwArgs["forwardButton"]){ + last.kwArgs.forwardButton(); + }else if(last.kwArgs["handle"]){ + last.kwArgs.handle("forward"); + } + this.historyStack.push(last); + }, + + _createState: function(url, args, hash){ + //summary: private method. Do not call this directly. + + return {"url": url, "kwArgs": args, "urlHash": hash}; //Object + }, + + _getUrlQuery: function(url){ + //summary: private method. Do not call this directly. + var segments = url.split("?"); + if (segments.length < 2){ + return null; //null + } + else{ + return segments[1]; //String + } + }, + + _loadIframeHistory: function(){ + //summary: private method. Do not call this directly. + var url = (djConfig["dojoIframeHistoryUrl"] || dojo.hostenv.getBaseScriptUri()+'iframe_history.html') + + "?" + (new Date()).getTime(); + this.moveForward = true; + dojo.io.setIFrameSrc(this.historyIframe, url, false); + return url; //String + } +} + +dojo.provide("dojo.io.BrowserIO"); + + + + + + + + +if(!dj_undef("window")) { + +dojo.io.checkChildrenForFile = function(/*DOMNode*/node){ + //summary: Checks any child nodes of node for an input type="file" element. + var hasFile = false; + var inputs = node.getElementsByTagName("input"); + dojo.lang.forEach(inputs, function(input){ + if(hasFile){ return; } + if(input.getAttribute("type")=="file"){ + hasFile = true; + } + }); + return hasFile; //boolean +} + +dojo.io.formHasFile = function(/*DOMNode*/formNode){ + //summary: Just calls dojo.io.checkChildrenForFile(). + return dojo.io.checkChildrenForFile(formNode); //boolean +} + +dojo.io.updateNode = function(/*DOMNode*/node, /*String or Object*/urlOrArgs){ + //summary: Updates a DOMnode with the result of a dojo.io.bind() call. + //node: DOMNode + //urlOrArgs: String or Object + // Either a String that has an URL, or an object containing dojo.io.bind() + // arguments. + node = dojo.byId(node); + var args = urlOrArgs; + if(dojo.lang.isString(urlOrArgs)){ + args = { url: urlOrArgs }; + } + args.mimetype = "text/html"; + args.load = function(t, d, e){ + while(node.firstChild){ + dojo.dom.destroyNode(node.firstChild); + } + node.innerHTML = d; + }; + dojo.io.bind(args); +} + +dojo.io.formFilter = function(/*DOMNode*/node) { + //summary: Returns true if the node is an input element that is enabled, has + //a name, and whose type is one of the following values: ["file", "submit", "image", "reset", "button"] + var type = (node.type||"").toLowerCase(); + return !node.disabled && node.name + && !dojo.lang.inArray(["file", "submit", "image", "reset", "button"], type); //boolean +} + +// TODO: Move to htmlUtils +dojo.io.encodeForm = function(/*DOMNode*/formNode, /*String?*/encoding, /*Function?*/formFilter){ + //summary: Converts the names and values of form elements into an URL-encoded + //string (name=value&name=value...). + //formNode: DOMNode + //encoding: String? + // The encoding to use for the values. Specify a string that starts with + // "utf" (for instance, "utf8"), to use encodeURIComponent() as the encoding + // function. Otherwise, dojo.string.encodeAscii will be used. + //formFilter: Function? + // A function used to filter out form elements. The element node will be passed + // to the formFilter function, and a boolean result is expected (true indicating + // indicating that the element should have its name/value included in the output). + // If no formFilter is specified, then dojo.io.formFilter() will be used. + if((!formNode)||(!formNode.tagName)||(!formNode.tagName.toLowerCase() == "form")){ + dojo.raise("Attempted to encode a non-form element."); + } + if(!formFilter) { formFilter = dojo.io.formFilter; } + var enc = /utf/i.test(encoding||"") ? encodeURIComponent : dojo.string.encodeAscii; + var values = []; + + for(var i = 0; i < formNode.elements.length; i++){ + var elm = formNode.elements[i]; + if(!elm || elm.tagName.toLowerCase() == "fieldset" || !formFilter(elm)) { continue; } + var name = enc(elm.name); + var type = elm.type.toLowerCase(); + + if(type == "select-multiple"){ + for(var j = 0; j < elm.options.length; j++){ + if(elm.options[j].selected) { + values.push(name + "=" + enc(elm.options[j].value)); + } + } + }else if(dojo.lang.inArray(["radio", "checkbox"], type)){ + if(elm.checked){ + values.push(name + "=" + enc(elm.value)); + } + }else{ + values.push(name + "=" + enc(elm.value)); + } + } + + // now collect input type="image", which doesn't show up in the elements array + var inputs = formNode.getElementsByTagName("input"); + for(var i = 0; i < inputs.length; i++) { + var input = inputs[i]; + if(input.type.toLowerCase() == "image" && input.form == formNode + && formFilter(input)) { + var name = enc(input.name); + values.push(name + "=" + enc(input.value)); + values.push(name + ".x=0"); + values.push(name + ".y=0"); + } + } + return values.join("&") + "&"; //String +} + +dojo.io.FormBind = function(/*DOMNode or Object*/args) { + //summary: constructor for a dojo.io.FormBind object. See the Dojo Book for + //some information on usage: http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book23 + //args: DOMNode or Object + // args can either be the DOMNode for a form element, or an object containing + // dojo.io.bind() arguments, one of which should be formNode with the value of + // a form element DOMNode. + this.bindArgs = {}; + + if(args && args.formNode) { + this.init(args); + } else if(args) { + this.init({formNode: args}); + } +} +dojo.lang.extend(dojo.io.FormBind, { + form: null, + + bindArgs: null, + + clickedButton: null, + + init: function(/*DOMNode or Object*/args) { + //summary: Internal function called by the dojo.io.FormBind() constructor + //do not call this method directly. + var form = dojo.byId(args.formNode); + + if(!form || !form.tagName || form.tagName.toLowerCase() != "form") { + throw new Error("FormBind: Couldn't apply, invalid form"); + } else if(this.form == form) { + return; + } else if(this.form) { + throw new Error("FormBind: Already applied to a form"); + } + + dojo.lang.mixin(this.bindArgs, args); + this.form = form; + + this.connect(form, "onsubmit", "submit"); + + for(var i = 0; i < form.elements.length; i++) { + var node = form.elements[i]; + if(node && node.type && dojo.lang.inArray(["submit", "button"], node.type.toLowerCase())) { + this.connect(node, "onclick", "click"); + } + } + + var inputs = form.getElementsByTagName("input"); + for(var i = 0; i < inputs.length; i++) { + var input = inputs[i]; + if(input.type.toLowerCase() == "image" && input.form == form) { + this.connect(input, "onclick", "click"); + } + } + }, + + onSubmit: function(/*DOMNode*/form) { + //summary: Function used to verify that the form is OK to submit. + //Override this function if you want specific form validation done. + return true; //boolean + }, + + submit: function(/*Event*/e) { + //summary: internal function that is connected as a listener to the + //form's onsubmit event. + e.preventDefault(); + if(this.onSubmit(this.form)) { + dojo.io.bind(dojo.lang.mixin(this.bindArgs, { + formFilter: dojo.lang.hitch(this, "formFilter") + })); + } + }, + + click: function(/*Event*/e) { + //summary: internal method that is connected as a listener to the + //form's elements whose click event can submit a form. + var node = e.currentTarget; + if(node.disabled) { return; } + this.clickedButton = node; + }, + + formFilter: function(/*DOMNode*/node) { + //summary: internal function used to know which form element values to include + // in the dojo.io.bind() request. + var type = (node.type||"").toLowerCase(); + var accept = false; + if(node.disabled || !node.name) { + accept = false; + } else if(dojo.lang.inArray(["submit", "button", "image"], type)) { + if(!this.clickedButton) { this.clickedButton = node; } + accept = node == this.clickedButton; + } else { + accept = !dojo.lang.inArray(["file", "submit", "reset", "button"], type); + } + return accept; //boolean + }, + + // in case you don't have dojo.event.* pulled in + connect: function(/*Object*/srcObj, /*Function*/srcFcn, /*Function*/targetFcn) { + //summary: internal function used to connect event listeners to form elements + //that trigger events. Used in case dojo.event is not loaded. + if(dojo.evalObjPath("dojo.event.connect")) { + dojo.event.connect(srcObj, srcFcn, this, targetFcn); + } else { + var fcn = dojo.lang.hitch(this, targetFcn); + srcObj[srcFcn] = function(e) { + if(!e) { e = window.event; } + if(!e.currentTarget) { e.currentTarget = e.srcElement; } + if(!e.preventDefault) { e.preventDefault = function() { window.event.returnValue = false; } } + fcn(e); + } + } + } +}); + +dojo.io.XMLHTTPTransport = new function(){ + //summary: The object that implements the dojo.io.bind transport for XMLHttpRequest. + var _this = this; + + var _cache = {}; // FIXME: make this public? do we even need to? + this.useCache = false; // if this is true, we'll cache unless kwArgs.useCache = false + this.preventCache = false; // if this is true, we'll always force GET requests to cache + + // FIXME: Should this even be a function? or do we just hard code it in the next 2 functions? + function getCacheKey(url, query, method) { + return url + "|" + query + "|" + method.toLowerCase(); + } + + function addToCache(url, query, method, http) { + _cache[getCacheKey(url, query, method)] = http; + } + + function getFromCache(url, query, method) { + return _cache[getCacheKey(url, query, method)]; + } + + this.clearCache = function() { + _cache = {}; + } + + // moved successful load stuff here + function doLoad(kwArgs, http, url, query, useCache) { + if( ((http.status>=200)&&(http.status<300))|| // allow any 2XX response code + (http.status==304)|| // get it out of the cache + (http.status==1223)|| // Internet Explorer mangled the status code + (location.protocol=="file:" && (http.status==0 || http.status==undefined))|| + (location.protocol=="chrome:" && (http.status==0 || http.status==undefined)) + ){ + var ret; + if(kwArgs.method.toLowerCase() == "head"){ + var headers = http.getAllResponseHeaders(); + ret = {}; + ret.toString = function(){ return headers; } + var values = headers.split(/[\r\n]+/g); + for(var i = 0; i < values.length; i++) { + var pair = values[i].match(/^([^:]+)\s*:\s*(.+)$/i); + if(pair) { + ret[pair[1]] = pair[2]; + } + } + }else if(kwArgs.mimetype == "text/javascript"){ + try{ + ret = dj_eval(http.responseText); + }catch(e){ + dojo.debug(e); + dojo.debug(http.responseText); + ret = null; + } + }else if(kwArgs.mimetype.substr(0, 9) == "text/json" || kwArgs.mimetype.substr(0, 16) == "application/json"){ + try{ + ret = dj_eval("("+kwArgs.jsonFilter(http.responseText)+")"); + }catch(e){ + dojo.debug(e); + dojo.debug(http.responseText); + ret = false; + } + }else if((kwArgs.mimetype == "application/xml")|| + (kwArgs.mimetype == "text/xml")){ + ret = http.responseXML; + if(!ret || typeof ret == "string" || !http.getResponseHeader("Content-Type")) { + ret = dojo.dom.createDocumentFromText(http.responseText); + } + }else{ + ret = http.responseText; + } + + if(useCache){ // only cache successful responses + addToCache(url, query, kwArgs.method, http); + } + kwArgs[(typeof kwArgs.load == "function") ? "load" : "handle"]("load", ret, http, kwArgs); + }else{ + var errObj = new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText); + kwArgs[(typeof kwArgs.error == "function") ? "error" : "handle"]("error", errObj, http, kwArgs); + } + } + + // set headers (note: Content-Type will get overriden if kwArgs.contentType is set) + function setHeaders(http, kwArgs){ + if(kwArgs["headers"]) { + for(var header in kwArgs["headers"]) { + if(header.toLowerCase() == "content-type" && !kwArgs["contentType"]) { + kwArgs["contentType"] = kwArgs["headers"][header]; + } else { + http.setRequestHeader(header, kwArgs["headers"][header]); + } + } + } + } + + this.inFlight = []; + this.inFlightTimer = null; + + this.startWatchingInFlight = function(){ + //summary: internal method used to trigger a timer to watch all inflight + //XMLHttpRequests. + if(!this.inFlightTimer){ + // setInterval broken in mozilla x86_64 in some circumstances, see + // https://bugzilla.mozilla.org/show_bug.cgi?id=344439 + // using setTimeout instead + this.inFlightTimer = setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();", 10); + } + } + + this.watchInFlight = function(){ + //summary: internal method that checks each inflight XMLHttpRequest to see + //if it has completed or if the timeout situation applies. + var now = null; + // make sure sync calls stay thread safe, if this callback is called during a sync call + // and this results in another sync call before the first sync call ends the browser hangs + if(!dojo.hostenv._blockAsync && !_this._blockAsync){ + for(var x=this.inFlight.length-1; x>=0; x--){ + try{ + var tif = this.inFlight[x]; + if(!tif || tif.http._aborted || !tif.http.readyState){ + this.inFlight.splice(x, 1); continue; + } + if(4==tif.http.readyState){ + // remove it so we can clean refs + this.inFlight.splice(x, 1); + doLoad(tif.req, tif.http, tif.url, tif.query, tif.useCache); + }else if (tif.startTime){ + //See if this is a timeout case. + if(!now){ + now = (new Date()).getTime(); + } + if(tif.startTime + (tif.req.timeoutSeconds * 1000) < now){ + //Stop the request. + if(typeof tif.http.abort == "function"){ + tif.http.abort(); + } + + // remove it so we can clean refs + this.inFlight.splice(x, 1); + tif.req[(typeof tif.req.timeout == "function") ? "timeout" : "handle"]("timeout", null, tif.http, tif.req); + } + } + }catch(e){ + try{ + var errObj = new dojo.io.Error("XMLHttpTransport.watchInFlight Error: " + e); + tif.req[(typeof tif.req.error == "function") ? "error" : "handle"]("error", errObj, tif.http, tif.req); + }catch(e2){ + dojo.debug("XMLHttpTransport error callback failed: " + e2); + } + } + } + } + + clearTimeout(this.inFlightTimer); + if(this.inFlight.length == 0){ + this.inFlightTimer = null; + return; + } + this.inFlightTimer = setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();", 10); + } + + var hasXmlHttp = dojo.hostenv.getXmlhttpObject() ? true : false; + this.canHandle = function(/*dojo.io.Request*/kwArgs){ + //summary: Tells dojo.io.bind() if this is a good transport to + //use for the particular type of request. This type of transport cannot + //handle forms that have an input type="file" element. + + // FIXME: we need to determine when form values need to be + // multi-part mime encoded and avoid using this transport for those + // requests. + var mlc = kwArgs["mimetype"].toLowerCase()||""; + return hasXmlHttp + && ( + ( + dojo.lang.inArray([ + "text/plain", "text/html", "application/xml", + "text/xml", "text/javascript" + ], mlc + ) + ) || ( + mlc.substr(0, 9) == "text/json" || mlc.substr(0, 16) == "application/json" + ) + ) + && !( kwArgs["formNode"] && dojo.io.formHasFile(kwArgs["formNode"]) ); //boolean + } + + this.multipartBoundary = "45309FFF-BD65-4d50-99C9-36986896A96F"; // unique guid as a boundary value for multipart posts + + this.bind = function(/*dojo.io.Request*/kwArgs){ + //summary: function that sends the request to the server. + + //This function will attach an abort() function to the kwArgs dojo.io.Request object, + //so if you need to abort the request, you can call that method on the request object. + //The following are acceptable properties in kwArgs (in addition to the + //normal dojo.io.Request object properties). + //url: String: URL the server URL to use for the request. + //method: String: the HTTP method to use (GET, POST, etc...). + //mimetype: Specifies what format the result data should be given to the load/handle callback. Valid values are: + // text/javascript, text/json, application/json, application/xml, text/xml. Any other mimetype will give back a text + // string. + //transport: String: specify "XMLHTTPTransport" to force the use of this XMLHttpRequest transport. + //headers: Object: The object property names and values will be sent as HTTP request header + // names and values. + //sendTransport: boolean: If true, then dojo.transport=xmlhttp will be added to the request. + //encoding: String: The type of encoding to use when dealing with the content kwArgs property. + //content: Object: The content object is converted into a name=value&name=value string, by + // using dojo.io.argsFromMap(). The encoding kwArgs property is passed to dojo.io.argsFromMap() + // for use in encoding the names and values. The resulting string is added to the request. + //formNode: DOMNode: a form element node. This should not normally be used. Use new dojo.io.FormBind() instead. + // If formNode is used, then the names and values of the form elements will be converted + // to a name=value&name=value string and added to the request. The encoding kwArgs property is used + // to encode the names and values. + //postContent: String: Raw name=value&name=value string to be included as part of the request. + //back or backButton: Function: A function to be called if the back button is pressed. If this kwArgs property + // is used, then back button support via dojo.undo.browser will be used. See notes for dojo.undo.browser on usage. + // You need to set djConfig.preventBackButtonFix = false to enable back button support. + //changeUrl: boolean or String: Used as part of back button support. See notes for dojo.undo.browser on usage. + //user: String: The user name. Used in conjuction with password. Passed to XMLHttpRequest.open(). + //password: String: The user's password. Used in conjuction with user. Passed to XMLHttpRequest.open(). + //file: Object or Array of Objects: an object simulating a file to be uploaded. file objects should have the following properties: + // name or fileName: the name of the file + // contentType: the MIME content type for the file. + // content: the actual content of the file. + //multipart: boolean: indicates whether this should be a multipart mime request. If kwArgs.file exists, then this + // property is set to true automatically. + //sync: boolean: if true, then a synchronous XMLHttpRequest call is done, + // if false (the default), then an asynchronous call is used. + //preventCache: boolean: If true, then a cache busting parameter is added to the request URL. + // default value is false. + //useCache: boolean: If true, then XMLHttpTransport will keep an internal cache of the server + // response and use that response if a similar request is done again. + // A similar request is one that has the same URL, query string and HTTP method value. + // default is false. + if(!kwArgs["url"]){ + // are we performing a history action? + if( !kwArgs["formNode"] + && (kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"] || kwArgs["watchForURL"]) + && (!djConfig.preventBackButtonFix)) { + dojo.deprecated("Using dojo.io.XMLHTTPTransport.bind() to add to browser history without doing an IO request", + "Use dojo.undo.browser.addToHistory() instead.", "0.4"); + dojo.undo.browser.addToHistory(kwArgs); + return true; + } + } + + // build this first for cache purposes + var url = kwArgs.url; + var query = ""; + if(kwArgs["formNode"]){ + var ta = kwArgs.formNode.getAttribute("action"); + if((ta)&&(!kwArgs["url"])){ url = ta; } + var tp = kwArgs.formNode.getAttribute("method"); + if((tp)&&(!kwArgs["method"])){ kwArgs.method = tp; } + query += dojo.io.encodeForm(kwArgs.formNode, kwArgs.encoding, kwArgs["formFilter"]); + } + + if(url.indexOf("#") > -1) { + dojo.debug("Warning: dojo.io.bind: stripping hash values from url:", url); + url = url.split("#")[0]; + } + + if(kwArgs["file"]){ + // force post for file transfer + kwArgs.method = "post"; + } + + if(!kwArgs["method"]){ + kwArgs.method = "get"; + } + + // guess the multipart value + if(kwArgs.method.toLowerCase() == "get"){ + // GET cannot use multipart + kwArgs.multipart = false; + }else{ + if(kwArgs["file"]){ + // enforce multipart when sending files + kwArgs.multipart = true; + }else if(!kwArgs["multipart"]){ + // default + kwArgs.multipart = false; + } + } + + if(kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"]){ + dojo.undo.browser.addToHistory(kwArgs); + } + + var content = kwArgs["content"] || {}; + + if(kwArgs.sendTransport) { + content["dojo.transport"] = "xmlhttp"; + } + + do { // break-block + if(kwArgs.postContent){ + query = kwArgs.postContent; + break; + } + + if(content) { + query += dojo.io.argsFromMap(content, kwArgs.encoding); + } + + if(kwArgs.method.toLowerCase() == "get" || !kwArgs.multipart){ + break; + } + + var t = []; + if(query.length){ + var q = query.split("&"); + for(var i = 0; i < q.length; ++i){ + if(q[i].length){ + var p = q[i].split("="); + t.push( "--" + this.multipartBoundary, + "Content-Disposition: form-data; name=\"" + p[0] + "\"", + "", + p[1]); + } + } + } + + if(kwArgs.file){ + if(dojo.lang.isArray(kwArgs.file)){ + for(var i = 0; i < kwArgs.file.length; ++i){ + var o = kwArgs.file[i]; + t.push( "--" + this.multipartBoundary, + "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"", + "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"), + "", + o.content); + } + }else{ + var o = kwArgs.file; + t.push( "--" + this.multipartBoundary, + "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"", + "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"), + "", + o.content); + } + } + + if(t.length){ + t.push("--"+this.multipartBoundary+"--", ""); + query = t.join("\r\n"); + } + }while(false); + + // kwArgs.Connection = "close"; + + var async = kwArgs["sync"] ? false : true; + + var preventCache = kwArgs["preventCache"] || + (this.preventCache == true && kwArgs["preventCache"] != false); + var useCache = kwArgs["useCache"] == true || + (this.useCache == true && kwArgs["useCache"] != false ); + + // preventCache is browser-level (add query string junk), useCache + // is for the local cache. If we say preventCache, then don't attempt + // to look in the cache, but if useCache is true, we still want to cache + // the response + if(!preventCache && useCache){ + var cachedHttp = getFromCache(url, query, kwArgs.method); + if(cachedHttp){ + doLoad(kwArgs, cachedHttp, url, query, false); + return; + } + } + + // much of this is from getText, but reproduced here because we need + // more flexibility + var http = dojo.hostenv.getXmlhttpObject(kwArgs); + var received = false; + + // build a handler function that calls back to the handler obj + if(async){ + var startTime = + // FIXME: setting up this callback handler leaks on IE!!! + this.inFlight.push({ + "req": kwArgs, + "http": http, + "url": url, + "query": query, + "useCache": useCache, + "startTime": kwArgs.timeoutSeconds ? (new Date()).getTime() : 0 + }); + this.startWatchingInFlight(); + }else{ + // block async callbacks until sync is in, needed in khtml, others? + _this._blockAsync = true; + } + + if(kwArgs.method.toLowerCase() == "post"){ + // FIXME: need to hack in more flexible Content-Type setting here! + if (!kwArgs.user) { + http.open("POST", url, async); + }else{ + http.open("POST", url, async, kwArgs.user, kwArgs.password); + } + setHeaders(http, kwArgs); + http.setRequestHeader("Content-Type", kwArgs.multipart ? ("multipart/form-data; boundary=" + this.multipartBoundary) : + (kwArgs.contentType || "application/x-www-form-urlencoded")); + try{ + http.send(query); + }catch(e){ + if(typeof http.abort == "function"){ + http.abort(); + } + doLoad(kwArgs, {status: 404}, url, query, useCache); + } + }else{ + var tmpUrl = url; + if(query != "") { + tmpUrl += (tmpUrl.indexOf("?") > -1 ? "&" : "?") + query; + } + if(preventCache) { + tmpUrl += (dojo.string.endsWithAny(tmpUrl, "?", "&") + ? "" : (tmpUrl.indexOf("?") > -1 ? "&" : "?")) + "dojo.preventCache=" + new Date().valueOf(); + } + if (!kwArgs.user) { + http.open(kwArgs.method.toUpperCase(), tmpUrl, async); + }else{ + http.open(kwArgs.method.toUpperCase(), tmpUrl, async, kwArgs.user, kwArgs.password); + } + setHeaders(http, kwArgs); + try { + http.send(null); + }catch(e) { + if(typeof http.abort == "function"){ + http.abort(); + } + doLoad(kwArgs, {status: 404}, url, query, useCache); + } + } + + if( !async ) { + doLoad(kwArgs, http, url, query, useCache); + _this._blockAsync = false; + } + + kwArgs.abort = function(){ + try{// khtml doesent reset readyState on abort, need this workaround + http._aborted = true; + }catch(e){/*squelsh*/} + return http.abort(); + } + + return; + } + dojo.io.transports.addTransport("XMLHTTPTransport"); +} + +} + +dojo.provide("dojo.io.cookie"); + +dojo.io.cookie.setCookie = function(/*String*/name, /*String*/value, + /*Number?*/days, /*String?*/path, + /*String?*/domain, /*boolean?*/secure){ + //summary: sets a cookie. + var expires = -1; + if((typeof days == "number")&&(days >= 0)){ + var d = new Date(); + d.setTime(d.getTime()+(days*24*60*60*1000)); + expires = d.toGMTString(); + } + value = escape(value); + document.cookie = name + "=" + value + ";" + + (expires != -1 ? " expires=" + expires + ";" : "") + + (path ? "path=" + path : "") + + (domain ? "; domain=" + domain : "") + + (secure ? "; secure" : ""); +} + +dojo.io.cookie.set = dojo.io.cookie.setCookie; + +dojo.io.cookie.getCookie = function(/*String*/name){ + //summary: Gets a cookie with the given name. + + // FIXME: Which cookie should we return? + // If there are cookies set for different sub domains in the current + // scope there could be more than one cookie with the same name. + // I think taking the last one in the list takes the one from the + // deepest subdomain, which is what we're doing here. + var idx = document.cookie.lastIndexOf(name+'='); + if(idx == -1) { return null; } + var value = document.cookie.substring(idx+name.length+1); + var end = value.indexOf(';'); + if(end == -1) { end = value.length; } + value = value.substring(0, end); + value = unescape(value); + return value; //String +} + +dojo.io.cookie.get = dojo.io.cookie.getCookie; + +dojo.io.cookie.deleteCookie = function(/*String*/name){ + //summary: Deletes a cookie with the given name. + dojo.io.cookie.setCookie(name, "-", 0); +} + +dojo.io.cookie.setObjectCookie = function( /*String*/name, /*Object*/obj, + /*Number?*/days, /*String?*/path, + /*String?*/domain, /*boolean?*/secure, + /*boolean?*/clearCurrent){ + //summary: Takes an object, serializes it to a cookie value, and either + //sets a cookie with the serialized value. + //description: If clearCurrent is true, then any current cookie value + //for this object will be replaced with the the new serialized object value. + //If clearCurrent is false, then the existing cookie value will be modified + //with any changes from the new object value. + //Objects must be simple name/value pairs where the value is either a string + //or a number. Any other value will be ignored. + if(arguments.length == 5){ // for backwards compat + clearCurrent = domain; + domain = null; + secure = null; + } + var pairs = [], cookie, value = ""; + if(!clearCurrent){ + cookie = dojo.io.cookie.getObjectCookie(name); + } + if(days >= 0){ + if(!cookie){ cookie = {}; } + for(var prop in obj){ + if(obj[prop] == null){ + delete cookie[prop]; + }else if((typeof obj[prop] == "string")||(typeof obj[prop] == "number")){ + cookie[prop] = obj[prop]; + } + } + prop = null; + for(var prop in cookie){ + pairs.push(escape(prop) + "=" + escape(cookie[prop])); + } + value = pairs.join("&"); + } + dojo.io.cookie.setCookie(name, value, days, path, domain, secure); +} + +dojo.io.cookie.getObjectCookie = function(/*String*/name){ + //summary: Gets an object value for the given cookie name. The complement of + //dojo.io.cookie.setObjectCookie(). + var values = null, cookie = dojo.io.cookie.getCookie(name); + if(cookie){ + values = {}; + var pairs = cookie.split("&"); + for(var i = 0; i < pairs.length; i++){ + var pair = pairs[i].split("="); + var value = pair[1]; + if( isNaN(value) ){ value = unescape(pair[1]); } + values[ unescape(pair[0]) ] = value; + } + } + return values; +} + +dojo.io.cookie.isSupported = function(){ + //summary: Tests the browser to see if cookies are enabled. + if(typeof navigator.cookieEnabled != "boolean"){ + dojo.io.cookie.setCookie("__TestingYourBrowserForCookieSupport__", + "CookiesAllowed", 90, null); + var cookieVal = dojo.io.cookie.getCookie("__TestingYourBrowserForCookieSupport__"); + navigator.cookieEnabled = (cookieVal == "CookiesAllowed"); + if(navigator.cookieEnabled){ + // FIXME: should we leave this around? + this.deleteCookie("__TestingYourBrowserForCookieSupport__"); + } + } + return navigator.cookieEnabled; //boolean +} + +// need to leave this in for backwards-compat from 0.1 for when it gets pulled in by dojo.io.* +if(!dojo.io.cookies){ dojo.io.cookies = dojo.io.cookie; } + +dojo.kwCompoundRequire({ + common: ["dojo.io.common"], + rhino: ["dojo.io.RhinoIO"], + browser: ["dojo.io.BrowserIO", "dojo.io.cookie"], + dashboard: ["dojo.io.BrowserIO", "dojo.io.cookie"] +}); +dojo.provide("dojo.io.*"); + dojo.provide("dojo.event.common"); @@ -2969,7 +5351,6 @@ dojo.event = new function(){ }else{ var ao = interpolateArgs(arguments, true); } - /* if(dojo.lang.isString(ao.srcFunc) && (ao.srcFunc.toLowerCase() == "onkey") ){ if(dojo.render.html.ie){ ao.srcFunc = "onkeydown"; @@ -2977,7 +5358,6 @@ dojo.event = new function(){ } ao.srcFunc = "onkeypress"; } - */ if(dojo.lang.isArray(ao.srcObj) && ao.srcObj!=""){ var tmpAO = {}; @@ -4347,2743 +6727,747 @@ dojo.kwCompoundRequire({ }); dojo.provide("dojo.event.*"); -dojo.provide("dojo.event"); +dojo.provide("dojo.gfx.color"); -dojo.deprecated("dojo.event", "replaced by dojo.event.*", "0.5"); -dojo.provide("dojo.string.common"); +// TODO: rewrite the "x2y" methods to take advantage of the parsing +// abilities of the Color object. Also, beef up the Color +// object (as possible) to parse most common formats -dojo.string.trim = function(/* string */str, /* integer? */wh){ - // summary - // Trim whitespace from str. If wh > 0, trim from start, if wh < 0, trim from end, else both - if(!str.replace){ return str; } - if(!str.length){ return str; } - var re = (wh > 0) ? (/^\s+/) : (wh < 0) ? (/\s+$/) : (/^\s+|\s+$/g); - return str.replace(re, ""); // string -} - -dojo.string.trimStart = function(/* string */str) { - // summary - // Trim whitespace at the beginning of 'str' - return dojo.string.trim(str, 1); // string -} - -dojo.string.trimEnd = function(/* string */str) { - // summary - // Trim whitespace at the end of 'str' - return dojo.string.trim(str, -1); -} - -dojo.string.repeat = function(/* string */str, /* integer */count, /* string? */separator) { - // summary - // Return 'str' repeated 'count' times, optionally placing 'separator' between each rep - var out = ""; - for(var i = 0; i < count; i++) { - out += str; - if(separator && i < count - 1) { - out += separator; - } +// takes an r, g, b, a(lpha) value, [r, g, b, a] array, "rgb(...)" string, hex string (#aaa, #aaaaaa, aaaaaaa) +dojo.gfx.color.Color = function(r, g, b, a) { + // dojo.debug("r:", r[0], "g:", r[1], "b:", r[2]); + if(dojo.lang.isArray(r)){ + this.r = r[0]; + this.g = r[1]; + this.b = r[2]; + this.a = r[3]||1.0; + }else if(dojo.lang.isString(r)){ + var rgb = dojo.gfx.color.extractRGB(r); + this.r = rgb[0]; + this.g = rgb[1]; + this.b = rgb[2]; + this.a = g||1.0; + }else if(r instanceof dojo.gfx.color.Color){ + // why does this create a new instance if we were passed one? + this.r = r.r; + this.b = r.b; + this.g = r.g; + this.a = r.a; + }else{ + this.r = r; + this.g = g; + this.b = b; + this.a = a; } - return out; // string } -dojo.string.pad = function(/* string */str, /* integer */len/*=2*/, /* string */ c/*='0'*/, /* integer */dir/*=1*/) { - // summary - // Pad 'str' to guarantee that it is at least 'len' length with the character 'c' at either the - // start (dir=1) or end (dir=-1) of the string - var out = String(str); - if(!c) { - c = '0'; - } - if(!dir) { - dir = 1; - } - while(out.length < len) { - if(dir > 0) { - out = c + out; +dojo.gfx.color.Color.fromArray = function(arr) { + return new dojo.gfx.color.Color(arr[0], arr[1], arr[2], arr[3]); +} + +dojo.extend(dojo.gfx.color.Color, { + toRgb: function(includeAlpha) { + if(includeAlpha) { + return this.toRgba(); } else { - out += c; + return [this.r, this.g, this.b]; } - } - return out; // string -} - -dojo.string.padLeft = function(/* string */str, /* integer */len, /* string */c) { - // summary - // same as dojo.string.pad(str, len, c, 1) - return dojo.string.pad(str, len, c, 1); // string -} - -dojo.string.padRight = function(/* string */str, /* integer */len, /* string */c) { - // summary - // same as dojo.string.pad(str, len, c, -1) - return dojo.string.pad(str, len, c, -1); // string -} - -dojo.provide("dojo.string.extras"); - - - - - -//TODO: should we use ${} substitution syntax instead, like widgets do? -dojo.string.substituteParams = function(/*string*/template, /* object - optional or ... */hash){ -// summary: -// Performs parameterized substitutions on a string. Throws an exception if any parameter is unmatched. -// -// description: -// For example, -// dojo.string.substituteParams("File '%{0}' is not found in directory '%{1}'.","foo.html","/temp"); -// returns -// "File 'foo.html' is not found in directory '/temp'." -// -// template: the original string template with %{values} to be replaced -// hash: name/value pairs (type object) to provide substitutions. Alternatively, substitutions may be -// included as arguments 1..n to this function, corresponding to template parameters 0..n-1 - - var map = (typeof hash == 'object') ? hash : dojo.lang.toArray(arguments, 1); - - return template.replace(/\%\{(\w+)\}/g, function(match, key){ - if(typeof(map[key]) != "undefined" && map[key] != null){ - return map[key]; - } - dojo.raise("Substitution not found: " + key); - }); // string -}; - -dojo.string.capitalize = function(/*string*/str){ -// summary: -// Uppercases the first letter of each word - - if(!dojo.lang.isString(str)){ return ""; } - if(arguments.length == 0){ str = this; } - - var words = str.split(' '); - for(var i=0; i"' -// Optionally skips escapes for single quotes - - str = str.replace(/&/gm, "&").replace(//gm, ">").replace(/"/gm, """); - if(!noSingleQuotes){ str = str.replace(/'/gm, "'"); } - return str; // string -} - -dojo.string.escapeSql = function(/*string*/str){ -//summary: -// Adds escape sequences for single quotes in SQL expressions - - return str.replace(/'/gm, "''"); //string -} - -dojo.string.escapeRegExp = function(/*string*/str){ -//summary: -// Adds escape sequences for special characters in regular expressions - - return str.replace(/\\/gm, "\\\\").replace(/([\f\b\n\t\r[\^$|?*+(){}])/gm, "\\$1"); // string -} - -//FIXME: should this one also escape backslash? -dojo.string.escapeJavaScript = function(/*string*/str){ -//summary: -// Adds escape sequences for single and double quotes as well -// as non-visible characters in JavaScript string literal expressions - - return str.replace(/(["'\f\b\n\t\r])/gm, "\\$1"); // string -} - -//FIXME: looks a lot like escapeJavaScript, just adds quotes? deprecate one? -dojo.string.escapeString = function(/*string*/str){ -//summary: -// Adds escape sequences for non-visual characters, double quote and backslash -// and surrounds with double quotes to form a valid string literal. - return ('"' + str.replace(/(["\\])/g, '\\$1') + '"' - ).replace(/[\f]/g, "\\f" - ).replace(/[\b]/g, "\\b" - ).replace(/[\n]/g, "\\n" - ).replace(/[\t]/g, "\\t" - ).replace(/[\r]/g, "\\r"); // string -} - -// TODO: make an HTML version -dojo.string.summary = function(/*string*/str, /*number*/len){ -// summary: -// Truncates 'str' after 'len' characters and appends periods as necessary so that it ends with "..." - - if(!len || str.length <= len){ - return str; // string - } - - return str.substring(0, len).replace(/\.+$/, "") + "..."; // string -} - -dojo.string.endsWith = function(/*string*/str, /*string*/end, /*boolean*/ignoreCase){ -// summary: -// Returns true if 'str' ends with 'end' - - if(ignoreCase){ - str = str.toLowerCase(); - end = end.toLowerCase(); - } - if((str.length - end.length) < 0){ - return false; // boolean - } - return str.lastIndexOf(end) == str.length - end.length; // boolean -} - -dojo.string.endsWithAny = function(/*string*/str /* , ... */){ -// summary: -// Returns true if 'str' ends with any of the arguments[2 -> n] - - for(var i = 1; i < arguments.length; i++) { - if(dojo.string.endsWith(str, arguments[i])) { - return true; // boolean - } - } - return false; // boolean -} - -dojo.string.startsWith = function(/*string*/str, /*string*/start, /*boolean*/ignoreCase){ -// summary: -// Returns true if 'str' starts with 'start' - - if(ignoreCase) { - str = str.toLowerCase(); - start = start.toLowerCase(); - } - return str.indexOf(start) == 0; // boolean -} - -dojo.string.startsWithAny = function(/*string*/str /* , ... */){ -// summary: -// Returns true if 'str' starts with any of the arguments[2 -> n] - - for(var i = 1; i < arguments.length; i++) { - if(dojo.string.startsWith(str, arguments[i])) { - return true; // boolean - } - } - return false; // boolean -} - -dojo.string.has = function(/*string*/str /* , ... */) { -// summary: -// Returns true if 'str' contains any of the arguments 2 -> n - - for(var i = 1; i < arguments.length; i++) { - if(str.indexOf(arguments[i]) > -1){ - return true; // boolean - } - } - return false; // boolean -} - -dojo.string.normalizeNewlines = function(/*string*/text, /*string? (\n or \r)*/newlineChar){ -// summary: -// Changes occurences of CR and LF in text to CRLF, or if newlineChar is provided as '\n' or '\r', -// substitutes newlineChar for occurrences of CR/LF and CRLF - - if (newlineChar == "\n"){ - text = text.replace(/\r\n/g, "\n"); - text = text.replace(/\r/g, "\n"); - } else if (newlineChar == "\r"){ - text = text.replace(/\r\n/g, "\r"); - text = text.replace(/\n/g, "\r"); - }else{ - text = text.replace(/([^\r])\n/g, "$1\r\n").replace(/\r([^\n])/g, "\r\n$1"); - } - return text; // string -} - -dojo.string.splitEscaped = function(/*string*/str, /*string of length=1*/charac){ -// summary: -// Splits 'str' into an array separated by 'charac', but skips characters escaped with a backslash - - var components = []; - for (var i = 0, prevcomma = 0; i < str.length; i++){ - if (str.charAt(i) == '\\'){ i++; continue; } - if (str.charAt(i) == charac){ - components.push(str.substring(prevcomma, i)); - prevcomma = i + 1; - } - } - components.push(str.substr(prevcomma)); - return components; // array -} - -dojo.provide("dojo.string"); - - -dojo.provide("dojo.io.common"); - - - -/****************************************************************************** - * Notes about dojo.io design: - * - * The dojo.io.* package has the unenviable task of making a lot of different - * types of I/O feel natural, despite a universal lack of good (or even - * reasonable!) I/O capability in the host environment. So lets pin this down - * a little bit further. - * - * Rhino: - * perhaps the best situation anywhere. Access to Java classes allows you - * to do anything one might want in terms of I/O, both synchronously and - * async. Can open TCP sockets and perform low-latency client/server - * interactions. HTTP transport is available through Java HTTP client and - * server classes. Wish it were always this easy. - * - * xpcshell: - * XPCOM for I/O. - * - * spidermonkey: - * S.O.L. - * - * Browsers: - * Browsers generally do not provide any useable filesystem access. We are - * therefore limited to HTTP for moving information to and from Dojo - * instances living in a browser. - * - * XMLHTTP: - * Sync or async, allows reading of arbitrary text files (including - * JS, which can then be eval()'d), writing requires server - * cooperation and is limited to HTTP mechanisms (POST and GET). - * - * "); - } -}catch(e){/* squelch */} - -if(dojo.render.html.opera){ - dojo.debug("Opera is not supported with dojo.undo.browser, so back/forward detection will not work."); -} - -dojo.undo.browser = { - initialHref: (!dj_undef("window")) ? window.location.href : "", - initialHash: (!dj_undef("window")) ? window.location.hash : "", - - moveForward: false, - historyStack: [], - forwardStack: [], - historyIframe: null, - bookmarkAnchor: null, - locationTimer: null, - - /** - * - */ - setInitialState: function(/*Object*/args){ - //summary: Sets the state object and back callback for the very first page that is loaded. - //description: It is recommended that you call this method as part of an event listener that is registered via - //dojo.addOnLoad(). - //args: Object - // See the addToHistory() function for the list of valid args properties. - this.initialState = this._createState(this.initialHref, args, this.initialHash); - }, - - //FIXME: Would like to support arbitrary back/forward jumps. Have to rework iframeLoaded among other things. - //FIXME: is there a slight race condition in moz using change URL with the timer check and when - // the hash gets set? I think I have seen a back/forward call in quick succession, but not consistent. - addToHistory: function(args){ - //summary: adds a state object (args) to the history list. You must set - //djConfig.preventBackButtonFix = false to use dojo.undo.browser. - - //args: Object - // args can have the following properties: - // To support getting back button notifications, the object argument should implement a - // function called either "back", "backButton", or "handle". The string "back" will be - // passed as the first and only argument to this callback. - // - To support getting forward button notifications, the object argument should implement a - // function called either "forward", "forwardButton", or "handle". The string "forward" will be - // passed as the first and only argument to this callback. - // - If you want the browser location string to change, define "changeUrl" on the object. If the - // value of "changeUrl" is true, then a unique number will be appended to the URL as a fragment - // identifier (http://some.domain.com/path#uniquenumber). If it is any other value that does - // not evaluate to false, that value will be used as the fragment identifier. For example, - // if changeUrl: 'page1', then the URL will look like: http://some.domain.com/path#page1 - // Full example: - // dojo.undo.browser.addToHistory({ - // back: function() { alert('back pressed'); }, - // forward: function() { alert('forward pressed'); }, - // changeUrl: true - // }); - // - // BROWSER NOTES: - // Safari 1.2: - // back button "works" fine, however it's not possible to actually - // DETECT that you've moved backwards by inspecting window.location. - // Unless there is some other means of locating. - // FIXME: perhaps we can poll on history.length? - // Safari 2.0.3+ (and probably 1.3.2+): - // works fine, except when changeUrl is used. When changeUrl is used, - // Safari jumps all the way back to whatever page was shown before - // the page that uses dojo.undo.browser support. - // IE 5.5 SP2: - // back button behavior is macro. It does not move back to the - // previous hash value, but to the last full page load. This suggests - // that the iframe is the correct way to capture the back button in - // these cases. - // Don't test this page using local disk for MSIE. MSIE will not create - // a history list for iframe_history.html if served from a file: URL. - // The XML served back from the XHR tests will also not be properly - // created if served from local disk. Serve the test pages from a web - // server to test in that browser. - // IE 6.0: - // same behavior as IE 5.5 SP2 - // Firefox 1.0+: - // the back button will return us to the previous hash on the same - // page, thereby not requiring an iframe hack, although we do then - // need to run a timer to detect inter-page movement. - - //If addToHistory is called, then that means we prune the - //forward stack -- the user went back, then wanted to - //start a new forward path. - this.forwardStack = []; - - var hash = null; - var url = null; - if(!this.historyIframe){ - if(djConfig["useXDomain"] && !djConfig["dojoIframeHistoryUrl"]){ - dojo.debug("dojo.undo.browser: When using cross-domain Dojo builds," - + " please save iframe_history.html to your domain and set djConfig.dojoIframeHistoryUrl" - + " to the path on your domain to iframe_history.html"); - } - this.historyIframe = window.frames["djhistory"]; - } - if(!this.bookmarkAnchor){ - this.bookmarkAnchor = document.createElement("a"); - dojo.body().appendChild(this.bookmarkAnchor); - this.bookmarkAnchor.style.display = "none"; - } - if(args["changeUrl"]){ - hash = "#"+ ((args["changeUrl"]!==true) ? args["changeUrl"] : (new Date()).getTime()); - - //If the current hash matches the new one, just replace the history object with - //this new one. It doesn't make sense to track different state objects for the same - //logical URL. This matches the browser behavior of only putting in one history - //item no matter how many times you click on the same #hash link, at least in Firefox - //and Safari, and there is no reliable way in those browsers to know if a #hash link - //has been clicked on multiple times. So making this the standard behavior in all browsers - //so that dojo.undo.browser's behavior is the same in all browsers. - if(this.historyStack.length == 0 && this.initialState.urlHash == hash){ - this.initialState = this._createState(url, args, hash); - return; - }else if(this.historyStack.length > 0 && this.historyStack[this.historyStack.length - 1].urlHash == hash){ - this.historyStack[this.historyStack.length - 1] = this._createState(url, args, hash); - return; - } - - this.changingUrl = true; - setTimeout("window.location.href = '"+hash+"'; dojo.undo.browser.changingUrl = false;", 1); - this.bookmarkAnchor.href = hash; - - if(dojo.render.html.ie){ - url = this._loadIframeHistory(); - - var oldCB = args["back"]||args["backButton"]||args["handle"]; - - //The function takes handleName as a parameter, in case the - //callback we are overriding was "handle". In that case, - //we will need to pass the handle name to handle. - var tcb = function(handleName){ - if(window.location.hash != ""){ - setTimeout("window.location.href = '"+hash+"';", 1); - } - //Use apply to set "this" to args, and to try to avoid memory leaks. - oldCB.apply(this, [handleName]); - } - - //Set interceptor function in the right place. - if(args["back"]){ - args.back = tcb; - }else if(args["backButton"]){ - args.backButton = tcb; - }else if(args["handle"]){ - args.handle = tcb; - } - - var oldFW = args["forward"]||args["forwardButton"]||args["handle"]; - - //The function takes handleName as a parameter, in case the - //callback we are overriding was "handle". In that case, - //we will need to pass the handle name to handle. - var tfw = function(handleName){ - if(window.location.hash != ""){ - window.location.href = hash; - } - if(oldFW){ // we might not actually have one - //Use apply to set "this" to args, and to try to avoid memory leaks. - oldFW.apply(this, [handleName]); - } - } - - //Set interceptor function in the right place. - if(args["forward"]){ - args.forward = tfw; - }else if(args["forwardButton"]){ - args.forwardButton = tfw; - }else if(args["handle"]){ - args.handle = tfw; - } - - }else if(dojo.render.html.moz){ - // start the timer - if(!this.locationTimer){ - this.locationTimer = setInterval("dojo.undo.browser.checkLocation();", 200); - } - } - }else{ - url = this._loadIframeHistory(); - } - - this.historyStack.push(this._createState(url, args, hash)); - }, - - checkLocation: function(){ - //summary: private method. Do not call this directly. - if (!this.changingUrl){ - var hsl = this.historyStack.length; - - if((window.location.hash == this.initialHash||window.location.href == this.initialHref)&&(hsl == 1)){ - // FIXME: could this ever be a forward button? - // we can't clear it because we still need to check for forwards. Ugg. - // clearInterval(this.locationTimer); - this.handleBackButton(); - return; - } - - // first check to see if we could have gone forward. We always halt on - // a no-hash item. - if(this.forwardStack.length > 0){ - if(this.forwardStack[this.forwardStack.length-1].urlHash == window.location.hash){ - this.handleForwardButton(); - return; - } - } - - // ok, that didn't work, try someplace back in the history stack - if((hsl >= 2)&&(this.historyStack[hsl-2])){ - if(this.historyStack[hsl-2].urlHash==window.location.hash){ - this.handleBackButton(); - return; - } - } - } - }, - - iframeLoaded: function(evt, ifrLoc){ - //summary: private method. Do not call this directly. - if(!dojo.render.html.opera){ - var query = this._getUrlQuery(ifrLoc.href); - if(query == null){ - // alert("iframeLoaded"); - // we hit the end of the history, so we should go back - if(this.historyStack.length == 1){ - this.handleBackButton(); - } - return; - } - if(this.moveForward){ - // we were expecting it, so it's not either a forward or backward movement - this.moveForward = false; - return; - } - - //Check the back stack first, since it is more likely. - //Note that only one step back or forward is supported. - if(this.historyStack.length >= 2 && query == this._getUrlQuery(this.historyStack[this.historyStack.length-2].url)){ - this.handleBackButton(); - } - else if(this.forwardStack.length > 0 && query == this._getUrlQuery(this.forwardStack[this.forwardStack.length-1].url)){ - this.handleForwardButton(); - } - } - }, - - handleBackButton: function(){ - //summary: private method. Do not call this directly. - - //The "current" page is always at the top of the history stack. - var current = this.historyStack.pop(); - if(!current){ return; } - var last = this.historyStack[this.historyStack.length-1]; - if(!last && this.historyStack.length == 0){ - last = this.initialState; - } - if (last){ - if(last.kwArgs["back"]){ - last.kwArgs["back"](); - }else if(last.kwArgs["backButton"]){ - last.kwArgs["backButton"](); - }else if(last.kwArgs["handle"]){ - last.kwArgs.handle("back"); - } - } - this.forwardStack.push(current); - }, - - handleForwardButton: function(){ - //summary: private method. Do not call this directly. - - var last = this.forwardStack.pop(); - if(!last){ return; } - if(last.kwArgs["forward"]){ - last.kwArgs.forward(); - }else if(last.kwArgs["forwardButton"]){ - last.kwArgs.forwardButton(); - }else if(last.kwArgs["handle"]){ - last.kwArgs.handle("forward"); - } - this.historyStack.push(last); - }, - - _createState: function(url, args, hash){ - //summary: private method. Do not call this directly. - - return {"url": url, "kwArgs": args, "urlHash": hash}; //Object - }, - - _getUrlQuery: function(url){ - //summary: private method. Do not call this directly. - var segments = url.split("?"); - if (segments.length < 2){ - return null; //null - } - else{ - return segments[1]; //String - } - }, - - _loadIframeHistory: function(){ - //summary: private method. Do not call this directly. - var url = (djConfig["dojoIframeHistoryUrl"] || dojo.hostenv.getBaseScriptUri()+'iframe_history.html') - + "?" + (new Date()).getTime(); - this.moveForward = true; - dojo.io.setIFrameSrc(this.historyIframe, url, false); - return url; //String - } -} - -dojo.provide("dojo.io.BrowserIO"); - - - - - - - - -if(!dj_undef("window")) { - -dojo.io.checkChildrenForFile = function(/*DOMNode*/node){ - //summary: Checks any child nodes of node for an input type="file" element. - var hasFile = false; - var inputs = node.getElementsByTagName("input"); - dojo.lang.forEach(inputs, function(input){ - if(hasFile){ return; } - if(input.getAttribute("type")=="file"){ - hasFile = true; - } - }); - return hasFile; //boolean -} - -dojo.io.formHasFile = function(/*DOMNode*/formNode){ - //summary: Just calls dojo.io.checkChildrenForFile(). - return dojo.io.checkChildrenForFile(formNode); //boolean -} - -dojo.io.updateNode = function(/*DOMNode*/node, /*String or Object*/urlOrArgs){ - //summary: Updates a DOMnode with the result of a dojo.io.bind() call. - //node: DOMNode - //urlOrArgs: String or Object - // Either a String that has an URL, or an object containing dojo.io.bind() - // arguments. - node = dojo.byId(node); - var args = urlOrArgs; - if(dojo.lang.isString(urlOrArgs)){ - args = { url: urlOrArgs }; - } - args.mimetype = "text/html"; - args.load = function(t, d, e){ - while(node.firstChild){ - dojo.dom.destroyNode(node.firstChild); - } - node.innerHTML = d; - }; - dojo.io.bind(args); -} - -dojo.io.formFilter = function(/*DOMNode*/node) { - //summary: Returns true if the node is an input element that is enabled, has - //a name, and whose type is one of the following values: ["file", "submit", "image", "reset", "button"] - var type = (node.type||"").toLowerCase(); - return !node.disabled && node.name - && !dojo.lang.inArray(["file", "submit", "image", "reset", "button"], type); //boolean -} - -// TODO: Move to htmlUtils -dojo.io.encodeForm = function(/*DOMNode*/formNode, /*String?*/encoding, /*Function?*/formFilter){ - //summary: Converts the names and values of form elements into an URL-encoded - //string (name=value&name=value...). - //formNode: DOMNode - //encoding: String? - // The encoding to use for the values. Specify a string that starts with - // "utf" (for instance, "utf8"), to use encodeURIComponent() as the encoding - // function. Otherwise, dojo.string.encodeAscii will be used. - //formFilter: Function? - // A function used to filter out form elements. The element node will be passed - // to the formFilter function, and a boolean result is expected (true indicating - // indicating that the element should have its name/value included in the output). - // If no formFilter is specified, then dojo.io.formFilter() will be used. - if((!formNode)||(!formNode.tagName)||(!formNode.tagName.toLowerCase() == "form")){ - dojo.raise("Attempted to encode a non-form element."); - } - if(!formFilter) { formFilter = dojo.io.formFilter; } - var enc = /utf/i.test(encoding||"") ? encodeURIComponent : dojo.string.encodeAscii; - var values = []; - - for(var i = 0; i < formNode.elements.length; i++){ - var elm = formNode.elements[i]; - if(!elm || elm.tagName.toLowerCase() == "fieldset" || !formFilter(elm)) { continue; } - var name = enc(elm.name); - var type = elm.type.toLowerCase(); - - if(type == "select-multiple"){ - for(var j = 0; j < elm.options.length; j++){ - if(elm.options[j].selected) { - values.push(name + "=" + enc(elm.options[j].value)); - } - } - }else if(dojo.lang.inArray(["radio", "checkbox"], type)){ - if(elm.checked){ - values.push(name + "=" + enc(elm.value)); - } - }else{ - values.push(name + "=" + enc(elm.value)); - } - } - - // now collect input type="image", which doesn't show up in the elements array - var inputs = formNode.getElementsByTagName("input"); - for(var i = 0; i < inputs.length; i++) { - var input = inputs[i]; - if(input.type.toLowerCase() == "image" && input.form == formNode - && formFilter(input)) { - var name = enc(input.name); - values.push(name + "=" + enc(input.value)); - values.push(name + ".x=0"); - values.push(name + ".y=0"); - } - } - return values.join("&") + "&"; //String -} - -dojo.io.FormBind = function(/*DOMNode or Object*/args) { - //summary: constructor for a dojo.io.FormBind object. See the Dojo Book for - //some information on usage: http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book23 - //args: DOMNode or Object - // args can either be the DOMNode for a form element, or an object containing - // dojo.io.bind() arguments, one of which should be formNode with the value of - // a form element DOMNode. - this.bindArgs = {}; - - if(args && args.formNode) { - this.init(args); - } else if(args) { - this.init({formNode: args}); - } -} -dojo.lang.extend(dojo.io.FormBind, { - form: null, - - bindArgs: null, - - clickedButton: null, - - init: function(/*DOMNode or Object*/args) { - //summary: Internal function called by the dojo.io.FormBind() constructor - //do not call this method directly. - var form = dojo.byId(args.formNode); - - if(!form || !form.tagName || form.tagName.toLowerCase() != "form") { - throw new Error("FormBind: Couldn't apply, invalid form"); - } else if(this.form == form) { - return; - } else if(this.form) { - throw new Error("FormBind: Already applied to a form"); - } - - dojo.lang.mixin(this.bindArgs, args); - this.form = form; - - this.connect(form, "onsubmit", "submit"); - - for(var i = 0; i < form.elements.length; i++) { - var node = form.elements[i]; - if(node && node.type && dojo.lang.inArray(["submit", "button"], node.type.toLowerCase())) { - this.connect(node, "onclick", "click"); - } - } - - var inputs = form.getElementsByTagName("input"); - for(var i = 0; i < inputs.length; i++) { - var input = inputs[i]; - if(input.type.toLowerCase() == "image" && input.form == form) { - this.connect(input, "onclick", "click"); - } - } - }, - - onSubmit: function(/*DOMNode*/form) { - //summary: Function used to verify that the form is OK to submit. - //Override this function if you want specific form validation done. - return true; //boolean - }, - - submit: function(/*Event*/e) { - //summary: internal function that is connected as a listener to the - //form's onsubmit event. - e.preventDefault(); - if(this.onSubmit(this.form)) { - dojo.io.bind(dojo.lang.mixin(this.bindArgs, { - formFilter: dojo.lang.hitch(this, "formFilter") - })); - } - }, - - click: function(/*Event*/e) { - //summary: internal method that is connected as a listener to the - //form's elements whose click event can submit a form. - var node = e.currentTarget; - if(node.disabled) { return; } - this.clickedButton = node; - }, - - formFilter: function(/*DOMNode*/node) { - //summary: internal function used to know which form element values to include - // in the dojo.io.bind() request. - var type = (node.type||"").toLowerCase(); - var accept = false; - if(node.disabled || !node.name) { - accept = false; - } else if(dojo.lang.inArray(["submit", "button", "image"], type)) { - if(!this.clickedButton) { this.clickedButton = node; } - accept = node == this.clickedButton; - } else { - accept = !dojo.lang.inArray(["file", "submit", "reset", "button"], type); - } - return accept; //boolean - }, - - // in case you don't have dojo.event.* pulled in - connect: function(/*Object*/srcObj, /*Function*/srcFcn, /*Function*/targetFcn) { - //summary: internal function used to connect event listeners to form elements - //that trigger events. Used in case dojo.event is not loaded. - if(dojo.evalObjPath("dojo.event.connect")) { - dojo.event.connect(srcObj, srcFcn, this, targetFcn); - } else { - var fcn = dojo.lang.hitch(this, targetFcn); - srcObj[srcFcn] = function(e) { - if(!e) { e = window.event; } - if(!e.currentTarget) { e.currentTarget = e.srcElement; } - if(!e.preventDefault) { e.preventDefault = function() { window.event.returnValue = false; } } - fcn(e); - } - } - } -}); - -dojo.io.XMLHTTPTransport = new function(){ - //summary: The object that implements the dojo.io.bind transport for XMLHttpRequest. - var _this = this; - - var _cache = {}; // FIXME: make this public? do we even need to? - this.useCache = false; // if this is true, we'll cache unless kwArgs.useCache = false - this.preventCache = false; // if this is true, we'll always force GET requests to cache - - // FIXME: Should this even be a function? or do we just hard code it in the next 2 functions? - function getCacheKey(url, query, method) { - return url + "|" + query + "|" + method.toLowerCase(); - } - - function addToCache(url, query, method, http) { - _cache[getCacheKey(url, query, method)] = http; - } - - function getFromCache(url, query, method) { - return _cache[getCacheKey(url, query, method)]; - } - - this.clearCache = function() { - _cache = {}; - } - - // moved successful load stuff here - function doLoad(kwArgs, http, url, query, useCache) { - if( ((http.status>=200)&&(http.status<300))|| // allow any 2XX response code - (http.status==304)|| // get it out of the cache - (location.protocol=="file:" && (http.status==0 || http.status==undefined))|| - (location.protocol=="chrome:" && (http.status==0 || http.status==undefined)) - ){ - var ret; - if(kwArgs.method.toLowerCase() == "head"){ - var headers = http.getAllResponseHeaders(); - ret = {}; - ret.toString = function(){ return headers; } - var values = headers.split(/[\r\n]+/g); - for(var i = 0; i < values.length; i++) { - var pair = values[i].match(/^([^:]+)\s*:\s*(.+)$/i); - if(pair) { - ret[pair[1]] = pair[2]; - } - } - }else if(kwArgs.mimetype == "text/javascript"){ - try{ - ret = dj_eval(http.responseText); - }catch(e){ - dojo.debug(e); - dojo.debug(http.responseText); - ret = null; - } - }else if(kwArgs.mimetype == "text/json" || kwArgs.mimetype == "application/json"){ - try{ - ret = dj_eval("("+http.responseText+")"); - }catch(e){ - dojo.debug(e); - dojo.debug(http.responseText); - ret = false; - } - }else if((kwArgs.mimetype == "application/xml")|| - (kwArgs.mimetype == "text/xml")){ - ret = http.responseXML; - if(!ret || typeof ret == "string" || !http.getResponseHeader("Content-Type")) { - ret = dojo.dom.createDocumentFromText(http.responseText); - } - }else{ - ret = http.responseText; - } - - if(useCache){ // only cache successful responses - addToCache(url, query, kwArgs.method, http); - } - kwArgs[(typeof kwArgs.load == "function") ? "load" : "handle"]("load", ret, http, kwArgs); - }else{ - var errObj = new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText); - kwArgs[(typeof kwArgs.error == "function") ? "error" : "handle"]("error", errObj, http, kwArgs); - } - } - - // set headers (note: Content-Type will get overriden if kwArgs.contentType is set) - function setHeaders(http, kwArgs){ - if(kwArgs["headers"]) { - for(var header in kwArgs["headers"]) { - if(header.toLowerCase() == "content-type" && !kwArgs["contentType"]) { - kwArgs["contentType"] = kwArgs["headers"][header]; - } else { - http.setRequestHeader(header, kwArgs["headers"][header]); - } - } - } - } - - this.inFlight = []; - this.inFlightTimer = null; - - this.startWatchingInFlight = function(){ - //summary: internal method used to trigger a timer to watch all inflight - //XMLHttpRequests. - if(!this.inFlightTimer){ - // setInterval broken in mozilla x86_64 in some circumstances, see - // https://bugzilla.mozilla.org/show_bug.cgi?id=344439 - // using setTimeout instead - this.inFlightTimer = setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();", 10); - } - } - - this.watchInFlight = function(){ - //summary: internal method that checks each inflight XMLHttpRequest to see - //if it has completed or if the timeout situation applies. - var now = null; - // make sure sync calls stay thread safe, if this callback is called during a sync call - // and this results in another sync call before the first sync call ends the browser hangs - if(!dojo.hostenv._blockAsync && !_this._blockAsync){ - for(var x=this.inFlight.length-1; x>=0; x--){ - try{ - var tif = this.inFlight[x]; - if(!tif || tif.http._aborted || !tif.http.readyState){ - this.inFlight.splice(x, 1); continue; - } - if(4==tif.http.readyState){ - // remove it so we can clean refs - this.inFlight.splice(x, 1); - doLoad(tif.req, tif.http, tif.url, tif.query, tif.useCache); - }else if (tif.startTime){ - //See if this is a timeout case. - if(!now){ - now = (new Date()).getTime(); - } - if(tif.startTime + (tif.req.timeoutSeconds * 1000) < now){ - //Stop the request. - if(typeof tif.http.abort == "function"){ - tif.http.abort(); - } - - // remove it so we can clean refs - this.inFlight.splice(x, 1); - tif.req[(typeof tif.req.timeout == "function") ? "timeout" : "handle"]("timeout", null, tif.http, tif.req); - } - } - }catch(e){ - try{ - var errObj = new dojo.io.Error("XMLHttpTransport.watchInFlight Error: " + e); - tif.req[(typeof tif.req.error == "function") ? "error" : "handle"]("error", errObj, tif.http, tif.req); - }catch(e2){ - dojo.debug("XMLHttpTransport error callback failed: " + e2); - } - } - } - } - - clearTimeout(this.inFlightTimer); - if(this.inFlight.length == 0){ - this.inFlightTimer = null; - return; - } - this.inFlightTimer = setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();", 10); - } - - var hasXmlHttp = dojo.hostenv.getXmlhttpObject() ? true : false; - this.canHandle = function(/*dojo.io.Request*/kwArgs){ - //summary: Tells dojo.io.bind() if this is a good transport to - //use for the particular type of request. This type of transport cannot - //handle forms that have an input type="file" element. - - // FIXME: we need to determine when form values need to be - // multi-part mime encoded and avoid using this transport for those - // requests. - return hasXmlHttp - && dojo.lang.inArray(["text/plain", "text/html", "application/xml", "text/xml", "text/javascript", "text/json", "application/json"], (kwArgs["mimetype"].toLowerCase()||"")) - && !( kwArgs["formNode"] && dojo.io.formHasFile(kwArgs["formNode"]) ); //boolean - } - - this.multipartBoundary = "45309FFF-BD65-4d50-99C9-36986896A96F"; // unique guid as a boundary value for multipart posts - - this.bind = function(/*dojo.io.Request*/kwArgs){ - //summary: function that sends the request to the server. - - //This function will attach an abort() function to the kwArgs dojo.io.Request object, - //so if you need to abort the request, you can call that method on the request object. - //The following are acceptable properties in kwArgs (in addition to the - //normal dojo.io.Request object properties). - //url: String: URL the server URL to use for the request. - //method: String: the HTTP method to use (GET, POST, etc...). - //mimetype: Specifies what format the result data should be given to the load/handle callback. Valid values are: - // text/javascript, text/json, application/json, application/xml, text/xml. Any other mimetype will give back a text - // string. - //transport: String: specify "XMLHTTPTransport" to force the use of this XMLHttpRequest transport. - //headers: Object: The object property names and values will be sent as HTTP request header - // names and values. - //sendTransport: boolean: If true, then dojo.transport=xmlhttp will be added to the request. - //encoding: String: The type of encoding to use when dealing with the content kwArgs property. - //content: Object: The content object is converted into a name=value&name=value string, by - // using dojo.io.argsFromMap(). The encoding kwArgs property is passed to dojo.io.argsFromMap() - // for use in encoding the names and values. The resulting string is added to the request. - //formNode: DOMNode: a form element node. This should not normally be used. Use new dojo.io.FormBind() instead. - // If formNode is used, then the names and values of the form elements will be converted - // to a name=value&name=value string and added to the request. The encoding kwArgs property is used - // to encode the names and values. - //postContent: String: Raw name=value&name=value string to be included as part of the request. - //back or backButton: Function: A function to be called if the back button is pressed. If this kwArgs property - // is used, then back button support via dojo.undo.browser will be used. See notes for dojo.undo.browser on usage. - // You need to set djConfig.preventBackButtonFix = false to enable back button support. - //changeUrl: boolean or String: Used as part of back button support. See notes for dojo.undo.browser on usage. - //user: String: The user name. Used in conjuction with password. Passed to XMLHttpRequest.open(). - //password: String: The user's password. Used in conjuction with user. Passed to XMLHttpRequest.open(). - //file: Object or Array of Objects: an object simulating a file to be uploaded. file objects should have the following properties: - // name or fileName: the name of the file - // contentType: the MIME content type for the file. - // content: the actual content of the file. - //multipart: boolean: indicates whether this should be a multipart mime request. If kwArgs.file exists, then this - // property is set to true automatically. - //sync: boolean: if true, then a synchronous XMLHttpRequest call is done, - // if false (the default), then an asynchronous call is used. - //preventCache: boolean: If true, then a cache busting parameter is added to the request URL. - // default value is false. - //useCache: boolean: If true, then XMLHttpTransport will keep an internal cache of the server - // response and use that response if a similar request is done again. - // A similar request is one that has the same URL, query string and HTTP method value. - // default is false. - if(!kwArgs["url"]){ - // are we performing a history action? - if( !kwArgs["formNode"] - && (kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"] || kwArgs["watchForURL"]) - && (!djConfig.preventBackButtonFix)) { - dojo.deprecated("Using dojo.io.XMLHTTPTransport.bind() to add to browser history without doing an IO request", - "Use dojo.undo.browser.addToHistory() instead.", "0.4"); - dojo.undo.browser.addToHistory(kwArgs); - return true; - } - } - - // build this first for cache purposes - var url = kwArgs.url; - var query = ""; - if(kwArgs["formNode"]){ - var ta = kwArgs.formNode.getAttribute("action"); - if((ta)&&(!kwArgs["url"])){ url = ta; } - var tp = kwArgs.formNode.getAttribute("method"); - if((tp)&&(!kwArgs["method"])){ kwArgs.method = tp; } - query += dojo.io.encodeForm(kwArgs.formNode, kwArgs.encoding, kwArgs["formFilter"]); - } - - if(url.indexOf("#") > -1) { - dojo.debug("Warning: dojo.io.bind: stripping hash values from url:", url); - url = url.split("#")[0]; - } - - if(kwArgs["file"]){ - // force post for file transfer - kwArgs.method = "post"; - } - - if(!kwArgs["method"]){ - kwArgs.method = "get"; - } - - // guess the multipart value - if(kwArgs.method.toLowerCase() == "get"){ - // GET cannot use multipart - kwArgs.multipart = false; - }else{ - if(kwArgs["file"]){ - // enforce multipart when sending files - kwArgs.multipart = true; - }else if(!kwArgs["multipart"]){ - // default - kwArgs.multipart = false; - } - } - - if(kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"]){ - dojo.undo.browser.addToHistory(kwArgs); - } - - var content = kwArgs["content"] || {}; - - if(kwArgs.sendTransport) { - content["dojo.transport"] = "xmlhttp"; - } - - do { // break-block - if(kwArgs.postContent){ - query = kwArgs.postContent; - break; - } - - if(content) { - query += dojo.io.argsFromMap(content, kwArgs.encoding); - } - - if(kwArgs.method.toLowerCase() == "get" || !kwArgs.multipart){ - break; - } - - var t = []; - if(query.length){ - var q = query.split("&"); - for(var i = 0; i < q.length; ++i){ - if(q[i].length){ - var p = q[i].split("="); - t.push( "--" + this.multipartBoundary, - "Content-Disposition: form-data; name=\"" + p[0] + "\"", - "", - p[1]); - } - } - } - - if(kwArgs.file){ - if(dojo.lang.isArray(kwArgs.file)){ - for(var i = 0; i < kwArgs.file.length; ++i){ - var o = kwArgs.file[i]; - t.push( "--" + this.multipartBoundary, - "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"", - "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"), - "", - o.content); - } - }else{ - var o = kwArgs.file; - t.push( "--" + this.multipartBoundary, - "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"", - "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"), - "", - o.content); - } - } - - if(t.length){ - t.push("--"+this.multipartBoundary+"--", ""); - query = t.join("\r\n"); - } - }while(false); - - // kwArgs.Connection = "close"; - - var async = kwArgs["sync"] ? false : true; - - var preventCache = kwArgs["preventCache"] || - (this.preventCache == true && kwArgs["preventCache"] != false); - var useCache = kwArgs["useCache"] == true || - (this.useCache == true && kwArgs["useCache"] != false ); - - // preventCache is browser-level (add query string junk), useCache - // is for the local cache. If we say preventCache, then don't attempt - // to look in the cache, but if useCache is true, we still want to cache - // the response - if(!preventCache && useCache){ - var cachedHttp = getFromCache(url, query, kwArgs.method); - if(cachedHttp){ - doLoad(kwArgs, cachedHttp, url, query, false); - return; - } - } - - // much of this is from getText, but reproduced here because we need - // more flexibility - var http = dojo.hostenv.getXmlhttpObject(kwArgs); - var received = false; - - // build a handler function that calls back to the handler obj - if(async){ - var startTime = - // FIXME: setting up this callback handler leaks on IE!!! - this.inFlight.push({ - "req": kwArgs, - "http": http, - "url": url, - "query": query, - "useCache": useCache, - "startTime": kwArgs.timeoutSeconds ? (new Date()).getTime() : 0 - }); - this.startWatchingInFlight(); - }else{ - // block async callbacks until sync is in, needed in khtml, others? - _this._blockAsync = true; - } - - if(kwArgs.method.toLowerCase() == "post"){ - // FIXME: need to hack in more flexible Content-Type setting here! - if (!kwArgs.user) { - http.open("POST", url, async); - }else{ - http.open("POST", url, async, kwArgs.user, kwArgs.password); - } - setHeaders(http, kwArgs); - http.setRequestHeader("Content-Type", kwArgs.multipart ? ("multipart/form-data; boundary=" + this.multipartBoundary) : - (kwArgs.contentType || "application/x-www-form-urlencoded")); - try{ - http.send(query); - }catch(e){ - if(typeof http.abort == "function"){ - http.abort(); - } - doLoad(kwArgs, {status: 404}, url, query, useCache); - } - }else{ - var tmpUrl = url; - if(query != "") { - tmpUrl += (tmpUrl.indexOf("?") > -1 ? "&" : "?") + query; - } - if(preventCache) { - tmpUrl += (dojo.string.endsWithAny(tmpUrl, "?", "&") - ? "" : (tmpUrl.indexOf("?") > -1 ? "&" : "?")) + "dojo.preventCache=" + new Date().valueOf(); - } - if (!kwArgs.user) { - http.open(kwArgs.method.toUpperCase(), tmpUrl, async); - }else{ - http.open(kwArgs.method.toUpperCase(), tmpUrl, async, kwArgs.user, kwArgs.password); - } - setHeaders(http, kwArgs); - try { - http.send(null); - }catch(e) { - if(typeof http.abort == "function"){ - http.abort(); - } - doLoad(kwArgs, {status: 404}, url, query, useCache); - } - } - - if( !async ) { - doLoad(kwArgs, http, url, query, useCache); - _this._blockAsync = false; - } - - kwArgs.abort = function(){ - try{// khtml doesent reset readyState on abort, need this workaround - http._aborted = true; - }catch(e){/*squelsh*/} - return http.abort(); - } - - return; - } - dojo.io.transports.addTransport("XMLHTTPTransport"); -} - -} - -dojo.provide("dojo.io.cookie"); - -dojo.io.cookie.setCookie = function(/*String*/name, /*String*/value, - /*Number?*/days, /*String?*/path, - /*String?*/domain, /*boolean?*/secure){ - //summary: sets a cookie. - var expires = -1; - if((typeof days == "number")&&(days >= 0)){ - var d = new Date(); - d.setTime(d.getTime()+(days*24*60*60*1000)); - expires = d.toGMTString(); - } - value = escape(value); - document.cookie = name + "=" + value + ";" - + (expires != -1 ? " expires=" + expires + ";" : "") - + (path ? "path=" + path : "") - + (domain ? "; domain=" + domain : "") - + (secure ? "; secure" : ""); -} - -dojo.io.cookie.set = dojo.io.cookie.setCookie; - -dojo.io.cookie.getCookie = function(/*String*/name){ - //summary: Gets a cookie with the given name. - - // FIXME: Which cookie should we return? - // If there are cookies set for different sub domains in the current - // scope there could be more than one cookie with the same name. - // I think taking the last one in the list takes the one from the - // deepest subdomain, which is what we're doing here. - var idx = document.cookie.lastIndexOf(name+'='); - if(idx == -1) { return null; } - var value = document.cookie.substring(idx+name.length+1); - var end = value.indexOf(';'); - if(end == -1) { end = value.length; } - value = value.substring(0, end); - value = unescape(value); - return value; //String -} - -dojo.io.cookie.get = dojo.io.cookie.getCookie; - -dojo.io.cookie.deleteCookie = function(/*String*/name){ - //summary: Deletes a cookie with the given name. - dojo.io.cookie.setCookie(name, "-", 0); -} - -dojo.io.cookie.setObjectCookie = function( /*String*/name, /*Object*/obj, - /*Number?*/days, /*String?*/path, - /*String?*/domain, /*boolean?*/secure, - /*boolean?*/clearCurrent){ - //summary: Takes an object, serializes it to a cookie value, and either - //sets a cookie with the serialized value. - //description: If clearCurrent is true, then any current cookie value - //for this object will be replaced with the the new serialized object value. - //If clearCurrent is false, then the existing cookie value will be modified - //with any changes from the new object value. - //Objects must be simple name/value pairs where the value is either a string - //or a number. Any other value will be ignored. - if(arguments.length == 5){ // for backwards compat - clearCurrent = domain; - domain = null; - secure = null; - } - var pairs = [], cookie, value = ""; - if(!clearCurrent){ - cookie = dojo.io.cookie.getObjectCookie(name); - } - if(days >= 0){ - if(!cookie){ cookie = {}; } - for(var prop in obj){ - if(obj[prop] == null){ - delete cookie[prop]; - }else if((typeof obj[prop] == "string")||(typeof obj[prop] == "number")){ - cookie[prop] = obj[prop]; - } - } - prop = null; - for(var prop in cookie){ - pairs.push(escape(prop) + "=" + escape(cookie[prop])); - } - value = pairs.join("&"); - } - dojo.io.cookie.setCookie(name, value, days, path, domain, secure); -} - -dojo.io.cookie.getObjectCookie = function(/*String*/name){ - //summary: Gets an object value for the given cookie name. The complement of - //dojo.io.cookie.setObjectCookie(). - var values = null, cookie = dojo.io.cookie.getCookie(name); - if(cookie){ - values = {}; - var pairs = cookie.split("&"); - for(var i = 0; i < pairs.length; i++){ - var pair = pairs[i].split("="); - var value = pair[1]; - if( isNaN(value) ){ value = unescape(pair[1]); } - values[ unescape(pair[0]) ] = value; - } - } - return values; -} - -dojo.io.cookie.isSupported = function(){ - //summary: Tests the browser to see if cookies are enabled. - if(typeof navigator.cookieEnabled != "boolean"){ - dojo.io.cookie.setCookie("__TestingYourBrowserForCookieSupport__", - "CookiesAllowed", 90, null); - var cookieVal = dojo.io.cookie.getCookie("__TestingYourBrowserForCookieSupport__"); - navigator.cookieEnabled = (cookieVal == "CookiesAllowed"); - if(navigator.cookieEnabled){ - // FIXME: should we leave this around? - this.deleteCookie("__TestingYourBrowserForCookieSupport__"); - } - } - return navigator.cookieEnabled; //boolean -} - -// need to leave this in for backwards-compat from 0.1 for when it gets pulled in by dojo.io.* -if(!dojo.io.cookies){ dojo.io.cookies = dojo.io.cookie; } - -dojo.kwCompoundRequire({ - common: ["dojo.io.common"], - rhino: ["dojo.io.RhinoIO"], - browser: ["dojo.io.BrowserIO", "dojo.io.cookie"], - dashboard: ["dojo.io.BrowserIO", "dojo.io.cookie"] -}); -dojo.provide("dojo.io.*"); - -dojo.provide("dojo.io"); - - -dojo.deprecated("dojo.io", "replaced by dojo.io.*", "0.5"); - -dojo.provide("dojo.AdapterRegistry"); - - -dojo.AdapterRegistry = function(/*Boolean?*/ returnWrappers){ - // summary: - // A registry to make contextual calling/searching easier. - // description: - // Objects of this class keep list of arrays in the form [name, check, - // wrap, directReturn] that are used to determine what the contextual - // result of a set of checked arguments is. All check/wrap functions - // in this registry should be of the same arity. - this.pairs = []; - this.returnWrappers = returnWrappers || false; -} - -dojo.lang.extend(dojo.AdapterRegistry, { - register: function(name, check, /*Function*/ wrap, directReturn, override){ - // summary: - // register a check function to determine if the wrap function or - // object gets selected - // name: String - // a way to identify this matcher. - // check: Function - // a function that arguments are passed to from the adapter's - // match() function. The check function should return true if the - // given arguments are appropriate for the wrap function. - // directReturn: Boolean? - // If directReturn is true, the value passed in for wrap will be - // returned instead of being called. Alternately, the - // AdapterRegistry can be set globally to "return not call" using - // the returnWrappers property. Either way, this behavior allows - // the registry to act as a "search" function instead of a - // function interception library. - // override: Boolean? - // If override is given and true, the check function will be given - // highest priority. Otherwise, it will be the lowest priority - // adapter. - - var type = (override) ? "unshift" : "push"; - this.pairs[type]([name, check, wrap, directReturn]); - }, - - match: function(/* ... */){ - // summary: - // Find an adapter for the given arguments. If no suitable adapter - // is found, throws an exception. match() accepts any number of - // arguments, all of which are passed to all matching functions - // from the registered pairs. - for(var i = 0; i < this.pairs.length; i++){ - var pair = this.pairs[i]; - if(pair[1].apply(this, arguments)){ - if((pair[3])||(this.returnWrappers)){ - return pair[2]; - }else{ - return pair[2].apply(this, arguments); - } - } - } - throw new Error("No match found"); - // dojo.raise("No match found"); - }, - - unregister: function(name){ - // summary: Remove a named adapter from the registry - - // FIXME: this is kind of a dumb way to handle this. On a large - // registry this will be slow-ish and we can use the name as a lookup - // should we choose to trade memory for speed. - for(var i = 0; i < this.pairs.length; i++){ - var pair = this.pairs[i]; - if(pair[0] == name){ - this.pairs.splice(i, 1); - return true; - } - } - return false; - } -}); - -dojo.provide("dojo.json"); - - - - -dojo.json = { - // jsonRegistry: AdapterRegistry a registry of type-based serializers - jsonRegistry: new dojo.AdapterRegistry(), - - register: function( /*String*/ name, - /*function*/ check, - /*function*/ wrap, - /*optional, boolean*/ override){ - // summary: - // Register a JSON serialization function. JSON serialization - // functions should take one argument and return an object - // suitable for JSON serialization: - // - string - // - number - // - boolean - // - undefined - // - object - // - null - // - Array-like (length property that is a number) - // - Objects with a "json" method will have this method called - // - Any other object will be used as {key:value, ...} pairs - // - // If override is given, it is used as the highest priority JSON - // serialization, otherwise it will be used as the lowest. - // name: - // a descriptive type for this serializer - // check: - // a unary function that will be passed an object to determine - // whether or not wrap will be used to serialize the object - // wrap: - // the serialization function - // override: - // optional, determines if the this serialization function will be - // given priority in the test order - - dojo.json.jsonRegistry.register(name, check, wrap, override); - }, - - evalJson: function(/*String*/ json){ - // summary: - // evaluates the passed string-form of a JSON object - // json: - // a string literal of a JSON item, for instance: - // '{ "foo": [ "bar", 1, { "baz": "thud" } ] }' - // return: - // the result of the evaluation - - // FIXME: should this accept mozilla's optional second arg? - try { - return eval("(" + json + ")"); - }catch(e){ - dojo.debug(e); - return json; - } - }, - - serialize: function(/*Object*/ o){ - // summary: - // Create a JSON serialization of an object, note that this - // doesn't check for infinite recursion, so don't do that! - // o: - // an object to be serialized. Objects may define their own - // serialization via a special "__json__" or "json" function - // property. If a specialized serializer has been defined, it will - // be used as a fallback. - // return: - // a String representing the serialized version of the passed - // object - - var objtype = typeof(o); - if(objtype == "undefined"){ - return "undefined"; - }else if((objtype == "number")||(objtype == "boolean")){ - return o + ""; - }else if(o === null){ - return "null"; - } - if (objtype == "string") { return dojo.string.escapeString(o); } - // recurse - var me = arguments.callee; - // short-circuit for objects that support "json" serialization - // if they return "self" then just pass-through... - var newObj; - if(typeof(o.__json__) == "function"){ - newObj = o.__json__(); - if(o !== newObj){ - return me(newObj); - } - } - if(typeof(o.json) == "function"){ - newObj = o.json(); - if (o !== newObj) { - return me(newObj); - } - } - // array - if(objtype != "function" && typeof(o.length) == "number"){ + this.getValue = function(/*float*/ n){ var res = []; - for(var i = 0; i < o.length; i++){ - var val = me(o[i]); - if(typeof(val) != "string"){ - val = "undefined"; - } - res.push(val); - } - return "[" + res.join(",") + "]"; + dojo.lang.forEach(this.start, function(s, i){ + res[i] = (diff[i] * n) + s; + }, this); + return res; // Array } - // look in the registry - try { - window.o = o; - newObj = dojo.json.jsonRegistry.match(o); - return me(newObj); - }catch(e){ - // dojo.debug(e); + }else{ + var diff = end - start; + + this.getValue = function(/*float*/ n){ + // summary: returns the point on the line + // n: a floating point number greater than 0 and less than 1 + return (diff * n) + this.start; // Decimal } - // it's a function with no adapter, bad - if(objtype == "function"){ - return null; - } - // generic object code path - res = []; - for (var k in o){ - var useKey; - if (typeof(k) == "number"){ - useKey = '"' + k + '"'; - }else if (typeof(k) == "string"){ - useKey = dojo.string.escapeString(k); - }else{ - // skip non-string or number keys - continue; - } - val = me(o[k]); - if(typeof(val) != "string"){ - // skip non-serializable values - continue; - } - res.push(useKey + ":" + val); - } - return "{" + res.join(",") + "}"; } -}; +} + +if((dojo.render.html.khtml)&&(!dojo.render.html.safari)){ + // the cool kids are obviously not using konqueror... + // found a very wierd bug in floats constants, 1.5 evals as 1 + // seems somebody mixed up ints and floats in 3.5.4 ?? + // FIXME: investigate more and post a KDE bug (Fredrik) + dojo.lfx.easeDefault = function(/*Decimal?*/ n){ + // summary: Returns the point for point n on a sin wave. + return (parseFloat("0.5")+((Math.sin( (n+parseFloat("1.5")) * Math.PI))/2)); + } +}else{ + dojo.lfx.easeDefault = function(/*Decimal?*/ n){ + return (0.5+((Math.sin( (n+1.5) * Math.PI))/2)); + } +} + +dojo.lfx.easeIn = function(/*Decimal?*/ n){ + // summary: returns the point on an easing curve + // n: a floating point number greater than 0 and less than 1 + return Math.pow(n, 3); +} + +dojo.lfx.easeOut = function(/*Decimal?*/ n){ + // summary: returns the point on the line + // n: a floating point number greater than 0 and less than 1 + return ( 1 - Math.pow(1 - n, 3) ); +} + +dojo.lfx.easeInOut = function(/*Decimal?*/ n){ + // summary: returns the point on the line + // n: a floating point number greater than 0 and less than 1 + return ( (3 * Math.pow(n, 2)) - (2 * Math.pow(n, 3)) ); +} + +dojo.lfx.IAnimation = function(){ + // summary: dojo.lfx.IAnimation is an interface that implements + // commonly used functions of animation objects +} +dojo.lang.extend(dojo.lfx.IAnimation, { + // public properties + curve: null, + duration: 1000, + easing: null, + repeatCount: 0, + rate: 10, + + // events + handler: null, + beforeBegin: null, + onBegin: null, + onAnimate: null, + onEnd: null, + onPlay: null, + onPause: null, + onStop: null, + + // public methods + play: null, + pause: null, + stop: null, + + connect: function(/*Event*/ evt, /*Object*/ scope, /*Function*/ newFunc){ + // summary: Convenience function. Quickly connect to an event + // of this object and save the old functions connected to it. + // evt: The name of the event to connect to. + // scope: the scope in which to run newFunc. + // newFunc: the function to run when evt is fired. + if(!newFunc){ + /* scope: Function + newFunc: null + pId: f */ + newFunc = scope; + scope = this; + } + newFunc = dojo.lang.hitch(scope, newFunc); + var oldFunc = this[evt]||function(){}; + this[evt] = function(){ + var ret = oldFunc.apply(this, arguments); + newFunc.apply(this, arguments); + return ret; + } + return this; // dojo.lfx.IAnimation + }, + + fire: function(/*Event*/ evt, /*Array*/ args){ + // summary: Convenience function. Fire event "evt" and pass it + // the arguments specified in "args". + // evt: The event to fire. + // args: The arguments to pass to the event. + if(this[evt]){ + this[evt].apply(this, (args||[])); + } + return this; // dojo.lfx.IAnimation + }, + + repeat: function(/*int*/ count){ + // summary: Set the repeat count of this object. + // count: How many times to repeat the animation. + this.repeatCount = count; + return this; // dojo.lfx.IAnimation + }, + + // private properties + _active: false, + _paused: false +}); + +dojo.lfx.Animation = function( /*Object*/ handlers, + /*int*/ duration, + /*dojo.lfx.Line*/ curve, + /*function*/ easing, + /*int*/ repeatCount, + /*int*/ rate){ + // summary + // a generic animation object that fires callbacks into it's handlers + // object at various states + // handlers: { handler: Function?, onstart: Function?, onstop: Function?, onanimate: Function? } + dojo.lfx.IAnimation.call(this); + if(dojo.lang.isNumber(handlers)||(!handlers && duration.getValue)){ + // no handlers argument: + rate = repeatCount; + repeatCount = easing; + easing = curve; + curve = duration; + duration = handlers; + handlers = null; + }else if(handlers.getValue||dojo.lang.isArray(handlers)){ + // no handlers or duration: + rate = easing; + repeatCount = curve; + easing = duration; + curve = handlers; + duration = null; + handlers = null; + } + if(dojo.lang.isArray(curve)){ + /* curve: Array + pId: a */ + this.curve = new dojo.lfx.Line(curve[0], curve[1]); + }else{ + this.curve = curve; + } + if(duration != null && duration > 0){ this.duration = duration; } + if(repeatCount){ this.repeatCount = repeatCount; } + if(rate){ this.rate = rate; } + if(handlers){ + dojo.lang.forEach([ + "handler", "beforeBegin", "onBegin", + "onEnd", "onPlay", "onStop", "onAnimate" + ], function(item){ + if(handlers[item]){ + this.connect(item, handlers[item]); + } + }, this); + } + if(easing && dojo.lang.isFunction(easing)){ + this.easing=easing; + } +} +dojo.inherits(dojo.lfx.Animation, dojo.lfx.IAnimation); +dojo.lang.extend(dojo.lfx.Animation, { + // "private" properties + _startTime: null, + _endTime: null, + _timer: null, + _percent: 0, + _startRepeatCount: 0, + + // public methods + play: function(/*int?*/ delay, /*bool?*/ gotoStart){ + // summary: Start the animation. + // delay: How many milliseconds to delay before starting. + // gotoStart: If true, starts the animation from the beginning; otherwise, + // starts it from its current position. + if(gotoStart){ + clearTimeout(this._timer); + this._active = false; + this._paused = false; + this._percent = 0; + }else if(this._active && !this._paused){ + return this; // dojo.lfx.Animation + } + + this.fire("handler", ["beforeBegin"]); + this.fire("beforeBegin"); + + if(delay > 0){ + setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay); + return this; // dojo.lfx.Animation + } + + this._startTime = new Date().valueOf(); + if(this._paused){ + this._startTime -= (this.duration * this._percent / 100); + } + this._endTime = this._startTime + this.duration; + + this._active = true; + this._paused = false; + + var step = this._percent / 100; + var value = this.curve.getValue(step); + if(this._percent == 0 ){ + if(!this._startRepeatCount){ + this._startRepeatCount = this.repeatCount; + } + this.fire("handler", ["begin", value]); + this.fire("onBegin", [value]); + } + + this.fire("handler", ["play", value]); + this.fire("onPlay", [value]); + + this._cycle(); + return this; // dojo.lfx.Animation + }, + + pause: function(){ + // summary: Pauses a running animation. + clearTimeout(this._timer); + if(!this._active){ return this; /*dojo.lfx.Animation*/} + this._paused = true; + var value = this.curve.getValue(this._percent / 100); + this.fire("handler", ["pause", value]); + this.fire("onPause", [value]); + return this; // dojo.lfx.Animation + }, + + gotoPercent: function(/*Decimal*/ pct, /*bool?*/ andPlay){ + // summary: Sets the progress of the animation. + // pct: A percentage in decimal notation (between and including 0.0 and 1.0). + // andPlay: If true, play the animation after setting the progress. + clearTimeout(this._timer); + this._active = true; + this._paused = true; + this._percent = pct; + if(andPlay){ this.play(); } + return this; // dojo.lfx.Animation + }, + + stop: function(/*bool?*/ gotoEnd){ + // summary: Stops a running animation. + // gotoEnd: If true, the animation will end. + clearTimeout(this._timer); + var step = this._percent / 100; + if(gotoEnd){ + step = 1; + } + var value = this.curve.getValue(step); + this.fire("handler", ["stop", value]); + this.fire("onStop", [value]); + this._active = false; + this._paused = false; + return this; // dojo.lfx.Animation + }, + + status: function(){ + // summary: Returns a string representation of the status of + // the animation. + if(this._active){ + return this._paused ? "paused" : "playing"; // String + }else{ + return "stopped"; // String + } + return this; + }, + + // "private" methods + _cycle: function(){ + clearTimeout(this._timer); + if(this._active){ + var curr = new Date().valueOf(); + var step = (curr - this._startTime) / (this._endTime - this._startTime); + + if(step >= 1){ + step = 1; + this._percent = 100; + }else{ + this._percent = step * 100; + } + + // Perform easing + if((this.easing)&&(dojo.lang.isFunction(this.easing))){ + step = this.easing(step); + } + + var value = this.curve.getValue(step); + this.fire("handler", ["animate", value]); + this.fire("onAnimate", [value]); + + if( step < 1 ){ + this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate); + }else{ + this._active = false; + this.fire("handler", ["end"]); + this.fire("onEnd"); + + if(this.repeatCount > 0){ + this.repeatCount--; + this.play(null, true); + }else if(this.repeatCount == -1){ + this.play(null, true); + }else{ + if(this._startRepeatCount){ + this.repeatCount = this._startRepeatCount; + this._startRepeatCount = 0; + } + } + } + } + return this; // dojo.lfx.Animation + } +}); + +dojo.lfx.Combine = function(/*dojo.lfx.IAnimation...*/ animations){ + // summary: An animation object to play animations passed to it at the same time. + dojo.lfx.IAnimation.call(this); + this._anims = []; + this._animsEnded = 0; + + var anims = arguments; + if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){ + /* animations: dojo.lfx.IAnimation[] + pId: a */ + anims = anims[0]; + } + + dojo.lang.forEach(anims, function(anim){ + this._anims.push(anim); + anim.connect("onEnd", dojo.lang.hitch(this, "_onAnimsEnded")); + }, this); +} +dojo.inherits(dojo.lfx.Combine, dojo.lfx.IAnimation); +dojo.lang.extend(dojo.lfx.Combine, { + // private members + _animsEnded: 0, + + // public methods + play: function(/*int?*/ delay, /*bool?*/ gotoStart){ + // summary: Start the animations. + // delay: How many milliseconds to delay before starting. + // gotoStart: If true, starts the animations from the beginning; otherwise, + // starts them from their current position. + if( !this._anims.length ){ return this; /*dojo.lfx.Combine*/} + + this.fire("beforeBegin"); + + if(delay > 0){ + setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay); + return this; // dojo.lfx.Combine + } + + if(gotoStart || this._anims[0].percent == 0){ + this.fire("onBegin"); + } + this.fire("onPlay"); + this._animsCall("play", null, gotoStart); + return this; // dojo.lfx.Combine + }, + + pause: function(){ + // summary: Pauses the running animations. + this.fire("onPause"); + this._animsCall("pause"); + return this; // dojo.lfx.Combine + }, + + stop: function(/*bool?*/ gotoEnd){ + // summary: Stops the running animations. + // gotoEnd: If true, the animations will end. + this.fire("onStop"); + this._animsCall("stop", gotoEnd); + return this; // dojo.lfx.Combine + }, + + // private methods + _onAnimsEnded: function(){ + this._animsEnded++; + if(this._animsEnded >= this._anims.length){ + this.fire("onEnd"); + } + return this; // dojo.lfx.Combine + }, + + _animsCall: function(/*String*/ funcName){ + var args = []; + if(arguments.length > 1){ + for(var i = 1 ; i < arguments.length ; i++){ + args.push(arguments[i]); + } + } + var _this = this; + dojo.lang.forEach(this._anims, function(anim){ + anim[funcName](args); + }, _this); + return this; // dojo.lfx.Combine + } +}); + +dojo.lfx.Chain = function(/*dojo.lfx.IAnimation...*/ animations) { + // summary: An animation object to play animations passed to it + // one after another. + dojo.lfx.IAnimation.call(this); + this._anims = []; + this._currAnim = -1; + + var anims = arguments; + if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){ + /* animations: dojo.lfx.IAnimation[] + pId: a */ + anims = anims[0]; + } + + var _this = this; + dojo.lang.forEach(anims, function(anim, i, anims_arr){ + this._anims.push(anim); + if(i < anims_arr.length - 1){ + anim.connect("onEnd", dojo.lang.hitch(this, "_playNext") ); + }else{ + anim.connect("onEnd", dojo.lang.hitch(this, function(){ this.fire("onEnd"); }) ); + } + }, this); +} +dojo.inherits(dojo.lfx.Chain, dojo.lfx.IAnimation); +dojo.lang.extend(dojo.lfx.Chain, { + // private members + _currAnim: -1, + + // public methods + play: function(/*int?*/ delay, /*bool?*/ gotoStart){ + // summary: Start the animation sequence. + // delay: How many milliseconds to delay before starting. + // gotoStart: If true, starts the sequence from the beginning; otherwise, + // starts it from its current position. + if( !this._anims.length ) { return this; /*dojo.lfx.Chain*/} + if( gotoStart || !this._anims[this._currAnim] ) { + this._currAnim = 0; + } + + var currentAnimation = this._anims[this._currAnim]; + + this.fire("beforeBegin"); + if(delay > 0){ + setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay); + return this; // dojo.lfx.Chain + } + + if(currentAnimation){ + if(this._currAnim == 0){ + this.fire("handler", ["begin", this._currAnim]); + this.fire("onBegin", [this._currAnim]); + } + this.fire("onPlay", [this._currAnim]); + currentAnimation.play(null, gotoStart); + } + return this; // dojo.lfx.Chain + }, + + pause: function(){ + // summary: Pauses the running animation sequence. + if( this._anims[this._currAnim] ) { + this._anims[this._currAnim].pause(); + this.fire("onPause", [this._currAnim]); + } + return this; // dojo.lfx.Chain + }, + + playPause: function(){ + // summary: If the animation sequence is playing, pause it; otherwise, + // play it. + if(this._anims.length == 0){ return this; } + if(this._currAnim == -1){ this._currAnim = 0; } + var currAnim = this._anims[this._currAnim]; + if( currAnim ) { + if( !currAnim._active || currAnim._paused ) { + this.play(); + } else { + this.pause(); + } + } + return this; // dojo.lfx.Chain + }, + + stop: function(){ + // summary: Stops the running animations. + var currAnim = this._anims[this._currAnim]; + if(currAnim){ + currAnim.stop(); + this.fire("onStop", [this._currAnim]); + } + return currAnim; // dojo.lfx.IAnimation + }, + + // private methods + _playNext: function(){ + if( this._currAnim == -1 || this._anims.length == 0 ) { return this; } + this._currAnim++; + if( this._anims[this._currAnim] ){ + this._anims[this._currAnim].play(null, true); + } + return this; // dojo.lfx.Chain + } +}); + +dojo.lfx.combine = function(/*dojo.lfx.IAnimation...*/ animations){ + // summary: Convenience function. Returns a dojo.lfx.Combine created + // using the animations passed in. + var anims = arguments; + if(dojo.lang.isArray(arguments[0])){ + /* animations: dojo.lfx.IAnimation[] + pId: a */ + anims = arguments[0]; + } + if(anims.length == 1){ return anims[0]; } + return new dojo.lfx.Combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.chain = function(/*dojo.lfx.IAnimation...*/ animations){ + // summary: Convenience function. Returns a dojo.lfx.Chain created + // using the animations passed in. + var anims = arguments; + if(dojo.lang.isArray(arguments[0])){ + /* animations: dojo.lfx.IAnimation[] + pId: a */ + anims = arguments[0]; + } + if(anims.length == 1){ return anims[0]; } + return new dojo.lfx.Chain(anims); // dojo.lfx.Combine +} dojo.provide("dojo.html.common"); @@ -7639,8 +8023,8 @@ if (dojo.render.html.ie) { dojo.html.getComputedStyle = function(/*HTMLElement|String*/node, /*String*/property, /*String*/value) { // summary // Get the computed style value for style "property" on "node" (IE). - node = dojo.byId(node); // FIXME: remove ability to access nodes by id for this time-critical function - if(!node || !node.style){return value;} + node = dojo.byId(node); // FIXME: remove ability to access nodes by id for this time-critical function + if(!node || !node.currentStyle){return value;} // FIXME: standardize on camel-case input to improve speed return node.currentStyle[dojo.html.toCamelCase(property)]; // String } @@ -8038,12 +8422,6 @@ dojo.html.applyBrowserClass = function(/* HTMLElement */node){ } }; -dojo.kwCompoundRequire({ - common: [ "dojo.html.common", - "dojo.html.style" ] -}); -dojo.provide("dojo.html.*"); - dojo.provide("dojo.html.display"); @@ -8231,6 +8609,32 @@ dojo.html.getOpacity = function(/* HTMLElement */node){ return opac >= 0.999999 ? 1.0 : Number(opac); // float } + +dojo.provide("dojo.html.color"); + + + + +dojo.html.getBackgroundColor = function(/* HTMLElement */node){ + // summary + // returns the background color of the passed node as a 32-bit color (RGBA) + node = dojo.byId(node); + var color; + do{ + color = dojo.html.getStyle(node, "background-color"); + // Safari doesn't say "transparent" + if(color.toLowerCase() == "rgba(0, 0, 0, 0)") { color = "transparent"; } + if(node == document.getElementsByTagName("body")[0]) { node = null; break; } + node = node.parentNode; + }while(node && dojo.lang.inArray(["transparent", ""], color)); + if(color == "transparent"){ + color = [255, 255, 255, 0]; + }else{ + color = dojo.gfx.color.extractRGB(color); + } + return color; // array +} + dojo.provide("dojo.html.layout"); @@ -8714,479 +9118,748 @@ dojo.html.setContentBoxHeight = dojo.html.setContentHeight = function(node, heig return dojo.html._callDeprecated("setContentBoxHeight", "setContentBox", arguments, "height"); } -dojo.provide("dojo.html.util"); +dojo.provide("dojo.lfx.html"); -dojo.html.getElementWindow = function(/* HTMLElement */element){ - // summary - // Get the window object where the element is placed in. - return dojo.html.getDocumentWindow( element.ownerDocument ); // Window -} -dojo.html.getDocumentWindow = function(doc){ - // summary - // Get window object associated with document doc - // With Safari, there is not wa to retrieve the window from the document, so we must fix it. - if(dojo.render.html.safari && !doc._parentWindow){ - /* - This is a Safari specific function that fix the reference to the parent - window from the document object. - */ - var fix=function(win){ - win.document._parentWindow=win; - for(var i=0; i - // If you wanted to insert a node into a DOM tree based on the mouse - // position you might use the following code: - //
-	//	if (gravity(node, e) & gravity.NORTH) { [insert before]; }
-	//	else { [insert after]; }
-	//	
- // - // @param node The node - // @param e The event containing the mouse coordinates - // @return The directions, NORTH or SOUTH and EAST or WEST. These - // are properties of the function. - node = dojo.byId(node); - var mouse = dojo.html.getCursorPosition(e); - - with (dojo.html) { - var absolute = getAbsolutePosition(node, true); - var bb = getBorderBox(node); - var nodecenterx = absolute.x + (bb.width / 2); - var nodecentery = absolute.y + (bb.height / 2); - } - - with (dojo.html.gravity) { - return ((mouse.x < nodecenterx ? WEST : EAST) | (mouse.y < nodecentery ? NORTH : SOUTH)); // integer - } -} - -dojo.html.gravity.NORTH = 1; -dojo.html.gravity.SOUTH = 1 << 1; -dojo.html.gravity.EAST = 1 << 2; -dojo.html.gravity.WEST = 1 << 3; - -dojo.html.overElement = function(/* HTMLElement */element, /* DOMEvent */e){ - // summary - // Returns whether the mouse is over the passed element. - // Element must be display:block (ie, not a ) - element = dojo.byId(element); - var mouse = dojo.html.getCursorPosition(e); - var bb = dojo.html.getBorderBox(element); - var absolute = dojo.html.getAbsolutePosition(element, true, dojo.html.boxSizing.BORDER_BOX); - var top = absolute.y; - var bottom = top + bb.height; - var left = absolute.x; - var right = left + bb.width; - - return (mouse.x >= left - && mouse.x <= right - && mouse.y >= top - && mouse.y <= bottom - ); // boolean -} - -dojo.html.renderedTextContent = function(/* HTMLElement */node){ - // summary - // Attempts to return the text as it would be rendered, with the line breaks - // sorted out nicely. Unfinished. - node = dojo.byId(node); - var result = ""; - if (node == null) { return result; } - for (var i = 0; i < node.childNodes.length; i++) { - switch (node.childNodes[i].nodeType) { - case 1: // ELEMENT_NODE - case 5: // ENTITY_REFERENCE_NODE - var display = "unknown"; - try { - display = dojo.html.getStyle(node.childNodes[i], "display"); - } catch(E) {} - switch (display) { - case "block": case "list-item": case "run-in": - case "table": case "table-row-group": case "table-header-group": - case "table-footer-group": case "table-row": case "table-column-group": - case "table-column": case "table-cell": case "table-caption": - // TODO: this shouldn't insert double spaces on aligning blocks - result += "\n"; - result += dojo.html.renderedTextContent(node.childNodes[i]); - result += "\n"; - break; - - case "none": break; - - default: - if(node.childNodes[i].tagName && node.childNodes[i].tagName.toLowerCase() == "br") { - result += "\n"; - } else { - result += dojo.html.renderedTextContent(node.childNodes[i]); - } - break; - } - break; - case 3: // TEXT_NODE - case 2: // ATTRIBUTE_NODE - case 4: // CDATA_SECTION_NODE - var text = node.childNodes[i].nodeValue; - var textTransform = "unknown"; - try { - textTransform = dojo.html.getStyle(node, "text-transform"); - } catch(E) {} - switch (textTransform){ - case "capitalize": - var words = text.split(' '); - for(var i=0; i]/i).test(txt.replace(/^\s+/))) { - txt = "" + txt + "
"; - tableType = "cell"; - } else if((/^]/i).test(txt.replace(/^\s+/))) { - txt = "" + txt + "
"; - tableType = "row"; - } else if((/^<(thead|tbody|tfoot)[\s\r\n>]/i).test(txt.replace(/^\s+/))) { - txt = "" + txt + "
"; - tableType = "section"; - } - tn.innerHTML = txt; - if(tn["normalize"]){ - tn.normalize(); - } - - var parent = null; - switch(tableType) { - case "cell": - parent = tn.getElementsByTagName("tr")[0]; - break; - case "row": - parent = tn.getElementsByTagName("tbody")[0]; - break; - case "section": - parent = tn.getElementsByTagName("table")[0]; - break; - default: - parent = tn; - break; - } - - /* this doesn't make much sense, I'm assuming it just meant trim() so wrap was replaced with trim - if(wrap){ - var ret = []; - // start hack - var fc = tn.firstChild; - ret[0] = ((fc.nodeValue == " ")||(fc.nodeValue == "\t")) ? fc.nextSibling : fc; - // end hack - // tn.style.display = "none"; - dojo.body().removeChild(tn); - return ret; - } - */ - var nodes = []; - for(var x=0; x view.width) { - x = view.width - w; - match = false; - } else { - x = tryX; - } - x = Math.max(padding[0], x) + scroll.x; - - var y = tryY + h; - if(y > view.height) { - y = view.height - h; - match = false; - } else { - y = tryY; - } - y = Math.max(padding[1], y) + scroll.y; - - if(match){ //perfect match, return now - bestx = x; - besty = y; - bestDistance = 0; - bestCorner = corner; - break; +dojo.lfx.html._byId = function(nodes){ + if(!nodes){ return []; } + if(dojo.lang.isArrayLike(nodes)){ + if(!nodes.alreadyChecked){ + var n = []; + dojo.lang.forEach(nodes, function(node){ + n.push(dojo.byId(node)); + }); + n.alreadyChecked = true; + return n; }else{ - //not perfect, find out whether it is better than the saved one - var dist = Math.pow(x-tryX-scroll.x,2)+Math.pow(y-tryY-scroll.y,2); - if(bestDistance > dist){ - bestDistance = dist; - bestx = x; - besty = y; - bestCorner = corner; - } + return nodes; } - } - - if(!tryOnly){ - node.style.left = bestx + "px"; - node.style.top = besty + "px"; - } - - return { left: bestx, top: besty, x: bestx, y: besty, dist: bestDistance, corner: bestCorner}; // object -} - -dojo.html.placeOnScreenPoint = function(node, desiredX, desiredY, padding, hasScroll) { - dojo.deprecated("dojo.html.placeOnScreenPoint", "use dojo.html.placeOnScreen() instead", "0.5"); - return dojo.html.placeOnScreen(node, desiredX, desiredY, padding, hasScroll, ['TL', 'TR', 'BL', 'BR']); -} - -dojo.html.placeOnScreenAroundElement = function( - /* HTMLElement */node, - /* HTMLElement */aroundNode, - /* integer */padding, - /* string? */aroundType, - /* string? */aroundCorners, - /* boolean? */tryOnly -){ - // summary - // Like placeOnScreen, except it accepts aroundNode instead of x,y - // and attempts to place node around it. aroundType (see - // dojo.html.boxSizing in html/layout.js) determines which box of the - // aroundNode should be used to calculate the outer box. - // aroundCorners specify Which corner of aroundNode should be - // used to place the node => which corner(s) of node to use (see the - // corners parameter in dojo.html.placeOnScreen) - // aroundCorners: {'TL': 'BL', 'BL': 'TL'} - - var best, bestDistance=Infinity; - aroundNode = dojo.byId(aroundNode); - var oldDisplay = aroundNode.style.display; - aroundNode.style.display=""; - var mb = dojo.html.getElementBox(aroundNode, aroundType); - var aroundNodeW = mb.width; - var aroundNodeH = mb.height; - var aroundNodePos = dojo.html.getAbsolutePosition(aroundNode, true, aroundType); - aroundNode.style.display=oldDisplay; - - for(var nodeCorner in aroundCorners){ - var pos, desiredX, desiredY; - var corners = aroundCorners[nodeCorner]; - - desiredX = aroundNodePos.x + (nodeCorner.charAt(1)=='L' ? 0 : aroundNodeW); - desiredY = aroundNodePos.y + (nodeCorner.charAt(0)=='T' ? 0 : aroundNodeH); - - pos = dojo.html.placeOnScreen(node, desiredX, desiredY, padding, true, corners, true); - if(pos.dist == 0){ - best = pos; - break; - }else{ - //not perfect, find out whether it is better than the saved one - if(bestDistance > pos.dist){ - bestDistance = pos.dist; - best = pos; - } - } - } - - if(!tryOnly){ - node.style.left = best.left + "px"; - node.style.top = best.top + "px"; - } - return best; // object -} - -dojo.html.scrollIntoView = function(/* HTMLElement */node){ - // summary - // Scroll the passed node into view, if it is not. - if(!node){ return; } - - // don't rely on that node.scrollIntoView works just because the function is there - // it doesnt work in Konqueror or Opera even though the function is there and probably - // not safari either - // dont like browser sniffs implementations but sometimes you have to use it - if(dojo.render.html.ie){ - //only call scrollIntoView if there is a scrollbar for this menu, - //otherwise, scrollIntoView will scroll the window scrollbar - if(dojo.html.getBorderBox(node.parentNode).height <= node.parentNode.scrollHeight){ - node.scrollIntoView(false); - } - }else if(dojo.render.html.mozilla){ - // IE, mozilla - node.scrollIntoView(false); }else{ - var parent = node.parentNode; - var parentBottom = parent.scrollTop + dojo.html.getBorderBox(parent).height; - var nodeBottom = node.offsetTop + dojo.html.getMarginBox(node).height; - if(parentBottom < nodeBottom){ - parent.scrollTop += (nodeBottom - parentBottom); - }else if(parent.scrollTop > node.offsetTop){ - parent.scrollTop -= (parent.scrollTop - node.offsetTop); - } + var n = []; + n.push(dojo.byId(nodes)); + n.alreadyChecked = true; + return n; } } +dojo.lfx.html.propertyAnimation = function( /*DOMNode[]*/ nodes, + /*Object[]*/ propertyMap, + /*int*/ duration, + /*function*/ easing, + /*Object*/ handlers){ + // summary: Returns an animation that will transition the properties of "nodes" + // depending how they are defined in "propertyMap". + // nodes: An array of DOMNodes or one DOMNode. + // propertyMap: { property: String, start: Decimal?, end: Decimal?, units: String? } + // An array of objects defining properties to change. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // handlers: { handler: Function?, onstart: Function?, onstop: Function?, onanimate: Function? } + nodes = dojo.lfx.html._byId(nodes); + + var targs = { + "propertyMap": propertyMap, + "nodes": nodes, + "duration": duration, + "easing": easing||dojo.lfx.easeDefault + }; + + var setEmUp = function(args){ + if(args.nodes.length==1){ + // FIXME: we're only supporting start-value filling when one node is + // passed + + var pm = args.propertyMap; + if(!dojo.lang.isArray(args.propertyMap)){ + // it's stupid to have to pack an array with a set of objects + // when you can just pass in an object list + var parr = []; + for(var pname in pm){ + pm[pname].property = pname; + parr.push(pm[pname]); + } + pm = args.propertyMap = parr; + } + dojo.lang.forEach(pm, function(prop){ + if(dj_undef("start", prop)){ + if(prop.property != "opacity"){ + prop.start = parseInt(dojo.html.getComputedStyle(args.nodes[0], prop.property)); + }else{ + prop.start = dojo.html.getOpacity(args.nodes[0]); + } + } + }); + } + } + + var coordsAsInts = function(coords){ + var cints = []; + dojo.lang.forEach(coords, function(c){ + cints.push(Math.round(c)); + }); + return cints; + } + + var setStyle = function(n, style){ + n = dojo.byId(n); + if(!n || !n.style){ return; } + for(var s in style){ + try{ + if(s == "opacity"){ + dojo.html.setOpacity(n, style[s]); + }else{ + n.style[s] = style[s]; + } + }catch(e){ dojo.debug(e); } + } + } + + var propLine = function(properties){ + this._properties = properties; + this.diffs = new Array(properties.length); + dojo.lang.forEach(properties, function(prop, i){ + // calculate the end - start to optimize a bit + if(dojo.lang.isFunction(prop.start)){ + prop.start = prop.start(prop, i); + } + if(dojo.lang.isFunction(prop.end)){ + prop.end = prop.end(prop, i); + } + if(dojo.lang.isArray(prop.start)){ + // don't loop through the arrays + this.diffs[i] = null; + }else if(prop.start instanceof dojo.gfx.color.Color){ + // save these so we don't have to call toRgb() every getValue() call + prop.startRgb = prop.start.toRgb(); + prop.endRgb = prop.end.toRgb(); + }else{ + this.diffs[i] = prop.end - prop.start; + } + }, this); + + this.getValue = function(n){ + var ret = {}; + dojo.lang.forEach(this._properties, function(prop, i){ + var value = null; + if(dojo.lang.isArray(prop.start)){ + // FIXME: what to do here? + }else if(prop.start instanceof dojo.gfx.color.Color){ + value = (prop.units||"rgb") + "("; + for(var j = 0 ; j < prop.startRgb.length ; j++){ + value += Math.round(((prop.endRgb[j] - prop.startRgb[j]) * n) + prop.startRgb[j]) + (j < prop.startRgb.length - 1 ? "," : ""); + } + value += ")"; + }else{ + value = ((this.diffs[i]) * n) + prop.start + (prop.property != "opacity" ? prop.units||"px" : ""); + } + ret[dojo.html.toCamelCase(prop.property)] = value; + }, this); + return ret; + } + } + + var anim = new dojo.lfx.Animation({ + beforeBegin: function(){ + setEmUp(targs); + anim.curve = new propLine(targs.propertyMap); + }, + onAnimate: function(propValues){ + dojo.lang.forEach(targs.nodes, function(node){ + setStyle(node, propValues); + }); + } + }, + targs.duration, + null, + targs.easing + ); + if(handlers){ + for(var x in handlers){ + if(dojo.lang.isFunction(handlers[x])){ + anim.connect(x, anim, handlers[x]); + } + } + } + + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html._makeFadeable = function(nodes){ + var makeFade = function(node){ + if(dojo.render.html.ie){ + // only set the zoom if the "tickle" value would be the same as the + // default + if( (node.style.zoom.length == 0) && + (dojo.html.getStyle(node, "zoom") == "normal") ){ + // make sure the node "hasLayout" + // NOTE: this has been tested with larger and smaller user-set text + // sizes and works fine + node.style.zoom = "1"; + // node.style.zoom = "normal"; + } + // don't set the width to auto if it didn't already cascade that way. + // We don't want to f anyones designs + if( (node.style.width.length == 0) && + (dojo.html.getStyle(node, "width") == "auto") ){ + node.style.width = "auto"; + } + } + } + if(dojo.lang.isArrayLike(nodes)){ + dojo.lang.forEach(nodes, makeFade); + }else{ + makeFade(nodes); + } +} + +dojo.lfx.html.fade = function(/*DOMNode[]*/ nodes, + /*Object*/values, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary:Returns an animation that will fade the "nodes" from the start to end values passed. + // nodes: An array of DOMNodes or one DOMNode. + // values: { start: Decimal?, end: Decimal? } + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var props = { property: "opacity" }; + if(!dj_undef("start", values)){ + props.start = values.start; + }else{ + props.start = function(){ return dojo.html.getOpacity(nodes[0]); }; + } + + if(!dj_undef("end", values)){ + props.end = values.end; + }else{ + dojo.raise("dojo.lfx.html.fade needs an end value"); + } + + var anim = dojo.lfx.propertyAnimation(nodes, [ props ], duration, easing); + anim.connect("beforeBegin", function(){ + dojo.lfx.html._makeFadeable(nodes); + }); + if(callback){ + anim.connect("onEnd", function(){ callback(nodes, anim); }); + } + + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.fadeIn = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will fade "nodes" from its current opacity to fully opaque. + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + return dojo.lfx.html.fade(nodes, { end: 1 }, duration, easing, callback); // dojo.lfx.Animation +} + +dojo.lfx.html.fadeOut = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will fade "nodes" from its current opacity to fully transparent. + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + return dojo.lfx.html.fade(nodes, { end: 0 }, duration, easing, callback); // dojo.lfx.Animation +} + +dojo.lfx.html.fadeShow = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will fade "nodes" from transparent to opaque and shows + // "nodes" at the end if it is hidden. + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes=dojo.lfx.html._byId(nodes); + dojo.lang.forEach(nodes, function(node){ + dojo.html.setOpacity(node, 0.0); + }); + + var anim = dojo.lfx.html.fadeIn(nodes, duration, easing, callback); + anim.connect("beforeBegin", function(){ + if(dojo.lang.isArrayLike(nodes)){ + dojo.lang.forEach(nodes, dojo.html.show); + }else{ + dojo.html.show(nodes); + } + }); + + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.fadeHide = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will fade "nodes" from its current opacity to opaque and hides + // "nodes" at the end. + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + var anim = dojo.lfx.html.fadeOut(nodes, duration, easing, function(){ + if(dojo.lang.isArrayLike(nodes)){ + dojo.lang.forEach(nodes, dojo.html.hide); + }else{ + dojo.html.hide(nodes); + } + if(callback){ callback(nodes, anim); } + }); + + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.wipeIn = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will show and wipe in "nodes". + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + + dojo.lang.forEach(nodes, function(node){ + var oprop = { }; // old properties of node (before we mucked w/them) + + // get node height, either it's natural height or it's height specified via style or class attributes + // (for FF, the node has to be (temporarily) rendered to measure height) + // TODO: should this offscreen code be part of dojo.html, so that getBorderBox() works on hidden nodes? + var origTop, origLeft, origPosition; + with(node.style){ + origTop=top; origLeft=left; origPosition=position; + top="-9999px"; left="-9999px"; position="absolute"; + display=""; + } + var nodeHeight = dojo.html.getBorderBox(node).height; + with(node.style){ + top=origTop; left=origLeft; position=origPosition; + display="none"; + } + + var anim = dojo.lfx.propertyAnimation(node, + { "height": { + start: 1, // 0 causes IE to display the whole panel + end: function(){ return nodeHeight; } + } + }, + duration, + easing); + + anim.connect("beforeBegin", function(){ + oprop.overflow = node.style.overflow; + oprop.height = node.style.height; + with(node.style){ + overflow = "hidden"; + height = "1px"; // 0 causes IE to display the whole panel + } + dojo.html.show(node); + }); + + anim.connect("onEnd", function(){ + with(node.style){ + overflow = oprop.overflow; + height = oprop.height; + } + if(callback){ callback(node, anim); } + }); + anims.push(anim); + }); + + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.wipeOut = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will wipe out and hide "nodes". + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + + dojo.lang.forEach(nodes, function(node){ + var oprop = { }; // old properties of node (before we mucked w/them) + var anim = dojo.lfx.propertyAnimation(node, + { "height": { + start: function(){ return dojo.html.getContentBox(node).height; }, + end: 1 // 0 causes IE to display the whole panel + } + }, + duration, + easing, + { + "beforeBegin": function(){ + oprop.overflow = node.style.overflow; + oprop.height = node.style.height; + with(node.style){ + overflow = "hidden"; + } + dojo.html.show(node); + }, + + "onEnd": function(){ + dojo.html.hide(node); + with(node.style){ + overflow = oprop.overflow; + height = oprop.height; + } + if(callback){ callback(node, anim); } + } + } + ); + anims.push(anim); + }); + + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.slideTo = function(/*DOMNode*/ nodes, + /*Object*/ coords, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will slide "nodes" from its current position to + // the position defined in "coords". + // nodes: An array of DOMNodes or one DOMNode. + // coords: { top: Decimal?, left: Decimal? } + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + var compute = dojo.html.getComputedStyle; + + if(dojo.lang.isArray(coords)){ + /* coords: Array + pId: a */ + dojo.deprecated('dojo.lfx.html.slideTo(node, array)', 'use dojo.lfx.html.slideTo(node, {top: value, left: value});', '0.5'); + coords = { top: coords[0], left: coords[1] }; + } + dojo.lang.forEach(nodes, function(node){ + var top = null; + var left = null; + + var init = (function(){ + var innerNode = node; + return function(){ + var pos = compute(innerNode, 'position'); + top = (pos == 'absolute' ? node.offsetTop : parseInt(compute(node, 'top')) || 0); + left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node, 'left')) || 0); + + if (!dojo.lang.inArray(['absolute', 'relative'], pos)) { + var ret = dojo.html.abs(innerNode, true); + dojo.html.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;"); + top = ret.y; + left = ret.x; + } + } + })(); + init(); + + var anim = dojo.lfx.propertyAnimation(node, + { "top": { start: top, end: (coords.top||0) }, + "left": { start: left, end: (coords.left||0) } + }, + duration, + easing, + { "beforeBegin": init } + ); + + if(callback){ + anim.connect("onEnd", function(){ callback(nodes, anim); }); + } + + anims.push(anim); + }); + + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.slideBy = function(/*DOMNode*/ nodes, /*Object*/ coords, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will slide "nodes" from its current position + // to its current position plus the numbers defined in "coords". + // nodes: An array of DOMNodes or one DOMNode. + // coords: { top: Decimal?, left: Decimal? } + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + var compute = dojo.html.getComputedStyle; + + if(dojo.lang.isArray(coords)){ + /* coords: Array + pId: a */ + dojo.deprecated('dojo.lfx.html.slideBy(node, array)', 'use dojo.lfx.html.slideBy(node, {top: value, left: value});', '0.5'); + coords = { top: coords[0], left: coords[1] }; + } + + dojo.lang.forEach(nodes, function(node){ + var top = null; + var left = null; + + var init = (function(){ + var innerNode = node; + return function(){ + var pos = compute(innerNode, 'position'); + top = (pos == 'absolute' ? node.offsetTop : parseInt(compute(node, 'top')) || 0); + left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node, 'left')) || 0); + + if (!dojo.lang.inArray(['absolute', 'relative'], pos)) { + var ret = dojo.html.abs(innerNode, true); + dojo.html.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;"); + top = ret.y; + left = ret.x; + } + } + })(); + init(); + + var anim = dojo.lfx.propertyAnimation(node, + { + "top": { start: top, end: top+(coords.top||0) }, + "left": { start: left, end: left+(coords.left||0) } + }, + duration, + easing).connect("beforeBegin", init); + + if(callback){ + anim.connect("onEnd", function(){ callback(nodes, anim); }); + } + + anims.push(anim); + }); + + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.explode = function(/*DOMNode*/ start, + /*DOMNode*/ endNode, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will + // start: + // endNode: + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + var h = dojo.html; + start = dojo.byId(start); + endNode = dojo.byId(endNode); + var startCoords = h.toCoordinateObject(start, true); + var outline = document.createElement("div"); + h.copyStyle(outline, endNode); + if(endNode.explodeClassName){ outline.className = endNode.explodeClassName; } + with(outline.style){ + position = "absolute"; + display = "none"; + // border = "1px solid black"; + var backgroundStyle = h.getStyle(start, "background-color"); + backgroundColor = backgroundStyle ? backgroundStyle.toLowerCase() : "transparent"; + backgroundColor = (backgroundColor == "transparent") ? "rgb(221, 221, 221)" : backgroundColor; + } + dojo.body().appendChild(outline); + + with(endNode.style){ + visibility = "hidden"; + display = "block"; + } + var endCoords = h.toCoordinateObject(endNode, true); + with(endNode.style){ + display = "none"; + visibility = "visible"; + } + + var props = { opacity: { start: 0.5, end: 1.0 } }; + dojo.lang.forEach(["height", "width", "top", "left"], function(type){ + props[type] = { start: startCoords[type], end: endCoords[type] } + }); + + var anim = new dojo.lfx.propertyAnimation(outline, + props, + duration, + easing, + { + "beforeBegin": function(){ + h.setDisplay(outline, "block"); + }, + "onEnd": function(){ + h.setDisplay(endNode, "block"); + outline.parentNode.removeChild(outline); + } + } + ); + + if(callback){ + anim.connect("onEnd", function(){ callback(endNode, anim); }); + } + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.implode = function(/*DOMNode*/ startNode, + /*DOMNode*/ end, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will + // startNode: + // end: + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + var h = dojo.html; + startNode = dojo.byId(startNode); + end = dojo.byId(end); + var startCoords = dojo.html.toCoordinateObject(startNode, true); + var endCoords = dojo.html.toCoordinateObject(end, true); + + var outline = document.createElement("div"); + dojo.html.copyStyle(outline, startNode); + if (startNode.explodeClassName) { outline.className = startNode.explodeClassName; } + dojo.html.setOpacity(outline, 0.3); + with(outline.style){ + position = "absolute"; + display = "none"; + backgroundColor = h.getStyle(startNode, "background-color").toLowerCase(); + } + dojo.body().appendChild(outline); + + var props = { opacity: { start: 1.0, end: 0.5 } }; + dojo.lang.forEach(["height", "width", "top", "left"], function(type){ + props[type] = { start: startCoords[type], end: endCoords[type] } + }); + + var anim = new dojo.lfx.propertyAnimation(outline, + props, + duration, + easing, + { + "beforeBegin": function(){ + dojo.html.hide(startNode); + dojo.html.show(outline); + }, + "onEnd": function(){ + outline.parentNode.removeChild(outline); + } + } + ); + + if(callback){ + anim.connect("onEnd", function(){ callback(startNode, anim); }); + } + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.highlight = function(/*DOMNode[]*/ nodes, + /*dojo.gfx.color.Color*/ startColor, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will set the background color + // of "nodes" to startColor and transition it to "nodes" + // original color. + // startColor: Color to transition from. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + + dojo.lang.forEach(nodes, function(node){ + var color = dojo.html.getBackgroundColor(node); + var bg = dojo.html.getStyle(node, "background-color").toLowerCase(); + var bgImage = dojo.html.getStyle(node, "background-image"); + var wasTransparent = (bg == "transparent" || bg == "rgba(0, 0, 0, 0)"); + while(color.length > 3) { color.pop(); } + + var rgb = new dojo.gfx.color.Color(startColor); + var endRgb = new dojo.gfx.color.Color(color); + + var anim = dojo.lfx.propertyAnimation(node, + { "background-color": { start: rgb, end: endRgb } }, + duration, + easing, + { + "beforeBegin": function(){ + if(bgImage){ + node.style.backgroundImage = "none"; + } + node.style.backgroundColor = "rgb(" + rgb.toRgb().join(",") + ")"; + }, + "onEnd": function(){ + if(bgImage){ + node.style.backgroundImage = bgImage; + } + if(wasTransparent){ + node.style.backgroundColor = "transparent"; + } + if(callback){ + callback(node, anim); + } + } + } + ); + + anims.push(anim); + }); + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.unhighlight = function(/*DOMNode[]*/ nodes, + /*dojo.gfx.color.Color*/ endColor, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will transition "nodes" background color + // from its current color to "endColor". + // endColor: Color to transition to. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + + dojo.lang.forEach(nodes, function(node){ + var color = new dojo.gfx.color.Color(dojo.html.getBackgroundColor(node)); + var rgb = new dojo.gfx.color.Color(endColor); + + var bgImage = dojo.html.getStyle(node, "background-image"); + + var anim = dojo.lfx.propertyAnimation(node, + { "background-color": { start: color, end: rgb } }, + duration, + easing, + { + "beforeBegin": function(){ + if(bgImage){ + node.style.backgroundImage = "none"; + } + node.style.backgroundColor = "rgb(" + color.toRgb().join(",") + ")"; + }, + "onEnd": function(){ + if(callback){ + callback(node, anim); + } + } + } + ); + anims.push(anim); + }); + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lang.mixin(dojo.lfx, dojo.lfx.html); + +dojo.kwCompoundRequire({ + browser: ["dojo.lfx.html"], + dashboard: ["dojo.lfx.html"] +}); +dojo.provide("dojo.lfx.*"); + diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/AdapterRegistry.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/AdapterRegistry.js index 5d635cccc..4d8b58fbf 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/AdapterRegistry.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/AdapterRegistry.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.AdapterRegistry"); dojo.require("dojo.lang.func"); dojo.AdapterRegistry = function (returnWrappers) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/Deferred.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/Deferred.js index b4608c892..193f2cc5a 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/Deferred.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/Deferred.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.Deferred"); dojo.require("dojo.lang.func"); dojo.Deferred = function (canceller) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/DeferredList.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/DeferredList.js index 3b4e10165..34b33199f 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/DeferredList.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/DeferredList.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.require("dojo.Deferred"); dojo.provide("dojo.DeferredList"); dojo.DeferredList = function (list, fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/a11y.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/a11y.js index a0b4ade59..fc11bbc13 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/a11y.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/a11y.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.a11y"); dojo.require("dojo.uri.*"); dojo.require("dojo.html.common"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation.js index 47013f0c3..71ed75b67 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.animation"); dojo.require("dojo.animation.Animation"); dojo.deprecated("dojo.animation is slated for removal in 0.5; use dojo.lfx instead.", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js index 666bc1c3a..597e01fa5 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.animation.Animation"); dojo.require("dojo.animation.AnimationEvent"); dojo.require("dojo.lang.func"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationEvent.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationEvent.js index 342e6441c..0d3132685 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationEvent.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationEvent.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.animation.AnimationEvent"); dojo.require("dojo.lang.common"); dojo.deprecated("dojo.animation.AnimationEvent is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationSequence.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationSequence.js index 2bd29c5eb..6d23c6195 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationSequence.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationSequence.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.animation.AnimationSequence"); dojo.require("dojo.animation.AnimationEvent"); dojo.require("dojo.animation.Animation"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js index 66864dc6e..d96e7c351 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.animation.Timer"); dojo.require("dojo.lang.timing.Timer"); dojo.deprecated("dojo.animation.Timer is now dojo.lang.timing.Timer", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js index 99d9ae965..91cd16dec 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.kwCompoundRequire({common:["dojo.animation.AnimationEvent", "dojo.animation.Animation", "dojo.animation.AnimationSequence"]}); dojo.provide("dojo.animation.*"); dojo.deprecated("dojo.Animation.* is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/behavior.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/behavior.js index b9535a0a5..035cc9ac7 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/behavior.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/behavior.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.behavior"); dojo.require("dojo.event.*"); dojo.require("dojo.experimental"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js index 69af30dcb..81f9b3712 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + var dj_global = this; var dj_currentContext = this; function dj_undef(name, object) { @@ -23,7 +25,7 @@ dojo.global = function () { return dj_currentContext; }; dojo.locale = djConfig.locale; -dojo.version = {major:0, minor:4, patch:2, flag:"", revision:Number("$Rev: 7616 $".match(/[0-9]+/)[0]), toString:function () { +dojo.version = {major:0, minor:4, patch:3, flag:"", revision:Number("$Rev: 8617 $".match(/[0-9]+/)[0]), toString:function () { with (dojo.version) { return major + "." + minor + "." + patch + flag + " (" + revision + ")"; } diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/browser_debug.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/browser_debug.js index 1e794922c..fcfb0e474 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/browser_debug.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/browser_debug.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.browser_debug"); dojo.hostenv.loadedUris.push("../src/bootstrap1.js"); dojo.hostenv.loadedUris.push("../src/loader.js"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/browser_debug_xd.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/browser_debug_xd.js index 0cd301c91..3c3b00778 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/browser_debug_xd.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/browser_debug_xd.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.browser_debug_xd"); dojo.nonDebugProvide = dojo.provide; dojo.provide = function (resourceName) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/cal/iCalendar.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/cal/iCalendar.js index 1931ac26e..372d4dec0 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/cal/iCalendar.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/cal/iCalendar.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.cal.iCalendar"); dojo.require("dojo.lang.common"); dojo.require("dojo.cal.textDirectory"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/cal/textDirectory.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/cal/textDirectory.js index 5f1f5b540..56513746d 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/cal/textDirectory.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/cal/textDirectory.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.cal.textDirectory"); dojo.require("dojo.string"); dojo.cal.textDirectory.Property = function (line) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Axis.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Axis.js index 283aba11b..5947476bf 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Axis.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Axis.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.Axis"); dojo.require("dojo.lang.common"); dojo.charting.Axis = function (label, scale, labels) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Chart.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Chart.js index 746e485e7..60d241f96 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Chart.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Chart.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.Chart"); dojo.require("dojo.lang.common"); dojo.require("dojo.charting.PlotArea"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Plot.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Plot.js index c7c168bc3..618fc85ba 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Plot.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Plot.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.Plot"); dojo.require("dojo.lang.common"); dojo.require("dojo.charting.Axis"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/PlotArea.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/PlotArea.js index 728befe82..41a978322 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/PlotArea.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/PlotArea.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.PlotArea"); dojo.require("dojo.lang.common"); dojo.require("dojo.gfx.color"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Plotters.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Plotters.js index 5e6b839bc..188108428 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Plotters.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Plotters.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.Plotters"); dojo.requireIf(dojo.render.svg.capable, "dojo.charting.svg.Plotters"); dojo.requireIf(dojo.render.vml.capable, "dojo.charting.vml.Plotters"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Series.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Series.js index d0ee5a65c..f7aeddf94 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Series.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/Series.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.Series"); dojo.require("dojo.lang.common"); dojo.require("dojo.charting.Plotters"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/__package__.js index 3e7e2d686..ddb793f2a 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/__package__.js @@ -8,5 +8,7 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/Axis.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/Axis.js index 07c1c1860..fe9fcec89 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/Axis.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/Axis.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.svg.Axis"); dojo.require("dojo.lang.common"); if (dojo.render.svg.capable) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/PlotArea.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/PlotArea.js index e5e2cd412..143fbaa78 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/PlotArea.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/PlotArea.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.svg.PlotArea"); dojo.require("dojo.lang.common"); if (dojo.render.svg.capable) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/Plotters.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/Plotters.js index ba4d21d50..5b5d3ea0e 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/Plotters.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/svg/Plotters.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.svg.Plotters"); dojo.require("dojo.lang.common"); if (dojo.render.svg.capable) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/Axis.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/Axis.js index d46495204..84d0bf004 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/Axis.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/Axis.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.vml.Axis"); dojo.require("dojo.lang.common"); if (dojo.render.vml.capable) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/PlotArea.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/PlotArea.js index 8b3a42243..bd7de360e 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/PlotArea.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/PlotArea.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.vml.PlotArea"); dojo.require("dojo.lang.common"); if (dojo.render.vml.capable) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/Plotters.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/Plotters.js index 3f2c9cda3..cdef3b336 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/Plotters.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/charting/vml/Plotters.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.charting.vml.Plotters"); dojo.require("dojo.lang.common"); if (dojo.render.vml.capable) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/ArrayList.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/ArrayList.js index d7a9fb868..ce10b2c26 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/ArrayList.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/ArrayList.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.ArrayList"); dojo.require("dojo.collections.Collections"); dojo.collections.ArrayList = function (arr) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/BinaryTree.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/BinaryTree.js index dc3a9116b..a8b7525b3 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/BinaryTree.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/BinaryTree.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.BinaryTree"); dojo.require("dojo.collections.Collections"); dojo.require("dojo.experimental"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Collections.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Collections.js index a59d53d89..41b3996f8 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Collections.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Collections.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.Collections"); dojo.collections.DictionaryEntry = function (k, v) { this.key = k; diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Dictionary.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Dictionary.js index d4a3cd77b..a6fec8838 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Dictionary.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Dictionary.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.Dictionary"); dojo.require("dojo.collections.Collections"); dojo.collections.Dictionary = function (dictionary) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Graph.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Graph.js index 9648eac19..c0399a551 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Graph.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Graph.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.Graph"); dojo.require("dojo.collections.Collections"); dojo.experimental("dojo.collections.Graph"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Queue.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Queue.js index 2254ea2ac..354a7a401 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Queue.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Queue.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.Queue"); dojo.require("dojo.collections.Collections"); dojo.collections.Queue = function (arr) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Set.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Set.js index ca271e356..058245af8 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Set.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Set.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.Set"); dojo.require("dojo.collections.Collections"); dojo.require("dojo.collections.ArrayList"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/SkipList.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/SkipList.js index a7079a36f..bbb0a0bcc 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/SkipList.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/SkipList.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.SkipList"); dojo.require("dojo.collections.Collections"); dojo.require("dojo.experimental"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/SortedList.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/SortedList.js index 372c794d9..c748b73cc 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/SortedList.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/SortedList.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.SortedList"); dojo.require("dojo.collections.Collections"); dojo.collections.SortedList = function (dictionary) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Stack.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Stack.js index 93389b84d..9f93ff93d 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Stack.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Stack.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.Stack"); dojo.require("dojo.collections.Collections"); dojo.collections.Stack = function (arr) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Store.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Store.js index 1b0c92e81..b4e12fa58 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Store.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/Store.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.collections.Store"); dojo.require("dojo.lang.common"); dojo.collections.Store = function (jsonArray) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/__package__.js index 19f6df175..73613d8c1 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/collections/__package__.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.kwCompoundRequire({common:["dojo.collections.Collections", "dojo.collections.SortedList", "dojo.collections.Dictionary", "dojo.collections.Queue", "dojo.collections.ArrayList", "dojo.collections.Stack", "dojo.collections.Set"]}); dojo.provide("dojo.collections.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto.js index 158aedfe9..89a2e4255 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.crypto"); dojo.crypto.cipherModes = {ECB:0, CBC:1, PCBC:2, CFB:3, OFB:4, CTR:5}; dojo.crypto.outputTypes = {Base64:0, Hex:1, String:2, Raw:3}; diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Blowfish.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Blowfish.js index f47567334..246745a89 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Blowfish.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Blowfish.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.require("dojo.crypto"); dojo.provide("dojo.crypto.Blowfish"); dojo.crypto.Blowfish = new function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/MD5.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/MD5.js index b9b2597a3..790a9ce28 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/MD5.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/MD5.js @@ -1,16 +1,14 @@ -/* Return to a port of Paul Johnstone's MD5 implementation - * http://pajhome.org.uk/crypt/md5/index.html - * - * Copyright (C) Paul Johnston 1999 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * - * Dojo port by Tom Trenka - * - * 2005-12-7 - * All conversions are internalized (no dependencies) - * implemented getHMAC for message digest auth. - */ +/* + 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.require("dojo.crypto"); dojo.provide("dojo.crypto.MD5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Rijndael.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Rijndael.js index fb8cd7277..bce1aca9f 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Rijndael.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/Rijndael.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.crypto.Rijndael"); dojo.require("dojo.crypto"); dojo.require("dojo.experimental"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA1.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA1.js index 77974a5d2..a4b02e76b 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA1.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA1.js @@ -1,14 +1,14 @@ /* - * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined - * in FIPS PUB 180-1 - * - * Version 2.1a Copyright Paul Johnston 2000 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for details. - * - * Dojo port by Tom Trenka - */ + 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.require("dojo.crypto"); dojo.provide("dojo.crypto.SHA1"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA256.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA256.js index 50d10a264..4f6642408 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA256.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/SHA256.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.crypto.SHA256"); dojo.require("dojo.crypto"); dojo.require("dojo.experimental"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/__package__.js index d87f2563c..c09f735c9 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/crypto/__package__.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.kwCompoundRequire({common:["dojo.crypto", "dojo.crypto.MD5"]}); dojo.provide("dojo.crypto.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data.js index 4ea183b5b..1866bdaf7 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data"); dojo.data = {}; diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/CsvStore.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/CsvStore.js index 0a86ba514..108cb591e 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/CsvStore.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/CsvStore.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.CsvStore"); dojo.require("dojo.data.core.RemoteStore"); dojo.require("dojo.lang.assert"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/OpmlStore.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/OpmlStore.js index e6d63b287..0041672fa 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/OpmlStore.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/OpmlStore.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.OpmlStore"); dojo.require("dojo.data.core.Read"); dojo.require("dojo.data.core.Result"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/RdfStore.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/RdfStore.js index ee2d3a2ad..00b79efe2 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/RdfStore.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/RdfStore.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.RdfStore"); dojo.provide("dojo.data.RhizomeStore"); dojo.require("dojo.lang.declare"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/YahooStore.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/YahooStore.js index c1506260b..cdf13f6b7 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/YahooStore.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/YahooStore.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.YahooStore"); dojo.require("dojo.data.core.RemoteStore"); dojo.require("dojo.lang.declare"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Read.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Read.js index 4f808c567..26cef9ec6 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Read.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Read.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.core.Read"); dojo.require("dojo.data.core.Result"); dojo.require("dojo.lang.declare"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/RemoteStore.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/RemoteStore.js index b05c764f2..e2ea5abb9 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/RemoteStore.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/RemoteStore.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.core.RemoteStore"); dojo.require("dojo.data.core.Read"); dojo.require("dojo.data.core.Write"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Result.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Result.js index 5300fa99f..13facd17c 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Result.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Result.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.core.Result"); dojo.require("dojo.lang.declare"); dojo.require("dojo.experimental"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Write.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Write.js index 5d2b9796a..377965284 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Write.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/core/Write.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.core.Write"); dojo.require("dojo.data.core.Read"); dojo.require("dojo.lang.declare"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Attribute.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Attribute.js index ae260d89c..39981752b 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Attribute.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Attribute.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.Attribute"); dojo.require("dojo.data.old.Item"); dojo.require("dojo.lang.assert"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Item.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Item.js index efa8e3acc..9c397d5bf 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Item.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Item.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.Item"); dojo.require("dojo.data.old.Observable"); dojo.require("dojo.data.old.Value"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Kind.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Kind.js index 5226129ab..4ea61a3f2 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Kind.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Kind.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.Kind"); dojo.require("dojo.data.old.Item"); dojo.data.old.Kind = function (dataProvider) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Observable.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Observable.js index 70c30f1b7..06291b8c7 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Observable.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Observable.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.Observable"); dojo.require("dojo.lang.common"); dojo.require("dojo.lang.assert"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/ResultSet.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/ResultSet.js index 9510c8d4a..e2cb9b2bc 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/ResultSet.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/ResultSet.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.ResultSet"); dojo.require("dojo.lang.assert"); dojo.require("dojo.collections.Collections"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Type.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Type.js index ca86cc3c4..884dc0015 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Type.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Type.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.Type"); dojo.require("dojo.data.old.Item"); dojo.data.old.Type = function (dataProvider) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Value.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Value.js index 23d870656..bc9ea891d 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Value.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/Value.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.Value"); dojo.require("dojo.lang.assert"); dojo.data.old.Value = function (value) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/__package__.js index c9375eee2..8612d33f7 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/__package__.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.require("dojo.experimental"); dojo.experimental("dojo.data.old.*"); dojo.kwCompoundRequire({common:["dojo.data.old.Item", "dojo.data.old.ResultSet", "dojo.data.old.provider.FlatFile"]}); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/format/Csv.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/format/Csv.js index c2a2dcf85..17e79c5a0 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/format/Csv.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/format/Csv.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.format.Csv"); dojo.require("dojo.lang.assert"); dojo.data.old.format.Csv = new function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/format/Json.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/format/Json.js index 9b1de2eb8..42c2e6a56 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/format/Json.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/format/Json.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.format.Json"); dojo.require("dojo.lang.assert"); dojo.data.old.format.Json = new function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/Base.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/Base.js index 2b64a9ad5..abff2d4cf 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/Base.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/Base.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.provider.Base"); dojo.require("dojo.lang.assert"); dojo.data.old.provider.Base = function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/Delicious.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/Delicious.js index 2d9858f20..3109ab15a 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/Delicious.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/Delicious.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.provider.Delicious"); dojo.require("dojo.data.old.provider.FlatFile"); dojo.require("dojo.data.old.format.Json"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/FlatFile.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/FlatFile.js index f7b2f48b7..7ff325779 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/FlatFile.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/FlatFile.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.provider.FlatFile"); dojo.require("dojo.data.old.provider.Base"); dojo.require("dojo.data.old.Item"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/JotSpot.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/JotSpot.js index 3ec60e90c..2ce8fd039 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/JotSpot.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/JotSpot.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.provider.JotSpot"); dojo.require("dojo.data.old.provider.Base"); dojo.data.old.provider.JotSpot = function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/MySql.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/MySql.js index c52e1ba25..6f4ba354b 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/MySql.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/data/old/provider/MySql.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.data.old.provider.MySql"); dojo.require("dojo.data.old.provider.Base"); dojo.data.old.provider.MySql = function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date.js index 8fd67d68c..74cc51036 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.date"); dojo.deprecated("dojo.date", "use one of the modules in dojo.date.* instead", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/common.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/common.js index 04ad24d0c..3f2490a6d 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/common.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/common.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.date.common"); dojo.date.setDayOfYear = function (dateObject, dayOfYear) { dateObject.setMonth(0); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/format.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/format.js index 1f4439d59..cd722340d 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/format.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/format.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.date.format"); dojo.require("dojo.date.common"); dojo.require("dojo.date.supplemental"); @@ -16,8 +18,8 @@ dojo.require("dojo.lang.common"); dojo.require("dojo.lang.func"); dojo.require("dojo.string.common"); dojo.require("dojo.i18n.common"); -dojo.requireLocalization("dojo.i18n.calendar", "gregorian", null, "de,en,es,fi,fr,hu,ja,it,ko,nl,pt,sv,zh,pt-br,zh-cn,zh-hk,zh-tw,ROOT"); -dojo.requireLocalization("dojo.i18n.calendar", "gregorianExtras", null, "ja,zh,ROOT"); +dojo.requireLocalization("dojo.i18n.calendar", "gregorian", null, "ko,zh-cn,zh,sv,ja,en,zh-tw,it,hu,nl,fi,zh-hk,fr,pt,ROOT,es,de,pt-br"); +dojo.requireLocalization("dojo.i18n.calendar", "gregorianExtras", null, "zh,ROOT,ja"); (function () { dojo.date.format = function (dateObject, options) { if (typeof options == "string") { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/serialize.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/serialize.js index be62df5cc..e82e312ca 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/serialize.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/serialize.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.date.serialize"); dojo.require("dojo.string.common"); dojo.date.setIso8601 = function (dateObject, formattedString) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/supplemental.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/supplemental.js index e0bcd0771..6ffae2f5c 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/supplemental.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/date/supplemental.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.date.supplemental"); dojo.date.getFirstDayOfWeek = function (locale) { var firstDay = {mv:5, ae:6, af:6, bh:6, dj:6, dz:6, eg:6, er:6, et:6, iq:6, ir:6, jo:6, ke:6, kw:6, lb:6, ly:6, ma:6, om:6, qa:6, sa:6, sd:6, so:6, tn:6, ye:6, as:0, au:0, az:0, bw:0, ca:0, cn:0, fo:0, ge:0, gl:0, gu:0, hk:0, ie:0, il:0, is:0, jm:0, jp:0, kg:0, kr:0, la:0, mh:0, mo:0, mp:0, mt:0, nz:0, ph:0, pk:0, sg:0, th:0, tt:0, tw:0, um:0, us:0, uz:0, vi:0, za:0, zw:0, et:0, mw:0, ng:0, tj:0, gb:0, sy:4}; diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug.js index 3c9c9a59a..787dc9aed 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.debug"); dojo.debug = function () { if (!djConfig.isDebug) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug/Firebug.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug/Firebug.js index b7efc63a1..0ba8c932a 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug/Firebug.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug/Firebug.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.debug.Firebug"); dojo.deprecated("dojo.debug.Firebug is slated for removal in 0.5; use dojo.debug.console instead.", "0.5"); if (dojo.render.html.moz) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug/console.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug/console.js index 729dde565..9285d28e2 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug/console.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/debug/console.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.debug.console"); dojo.require("dojo.logging.ConsoleLogger"); if (window.console) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/DragAndDrop.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/DragAndDrop.js index 911d43339..4a3bd2507 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/DragAndDrop.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/DragAndDrop.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.require("dojo.lang.common"); dojo.require("dojo.lang.func"); dojo.require("dojo.lang.declare"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragAndDrop.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragAndDrop.js index 636b30997..525026e1f 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragAndDrop.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragAndDrop.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.dnd.HtmlDragAndDrop"); dojo.require("dojo.dnd.HtmlDragManager"); dojo.require("dojo.dnd.DragAndDrop"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragCopy.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragCopy.js index 192fd2e76..bbded6e55 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragCopy.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragCopy.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.dnd.HtmlDragCopy"); dojo.require("dojo.dnd.*"); dojo.declare("dojo.dnd.HtmlDragCopySource", dojo.dnd.HtmlDragSource, function (node, type, copyOnce) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragManager.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragManager.js index 2deab9425..c3241cf09 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragManager.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragManager.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.dnd.HtmlDragManager"); dojo.require("dojo.dnd.DragAndDrop"); dojo.require("dojo.event.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragMove.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragMove.js index 40356f573..8237a7144 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragMove.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/HtmlDragMove.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.dnd.HtmlDragMove"); dojo.require("dojo.dnd.*"); dojo.declare("dojo.dnd.HtmlDragMoveSource", dojo.dnd.HtmlDragSource, {onDragStart:function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/Sortable.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/Sortable.js index a537a4ae4..b5212156e 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/Sortable.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/Sortable.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.dnd.Sortable"); dojo.require("dojo.dnd.*"); dojo.dnd.Sortable = function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDrop.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDrop.js index 3f94eb84a..2bce5d35c 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDrop.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDrop.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.dnd.TreeDragAndDrop"); dojo.require("dojo.dnd.HtmlDragAndDrop"); dojo.require("dojo.lang.func"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDropV3.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDropV3.js index cbeceef96..fdc57e9af 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDropV3.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/TreeDragAndDropV3.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.dnd.TreeDragAndDropV3"); dojo.require("dojo.dnd.HtmlDragAndDrop"); dojo.require("dojo.lang.func"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/__package__.js index 8af2fbec8..2ad58bb67 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dnd/__package__.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.kwCompoundRequire({common:["dojo.dnd.DragAndDrop"], browser:["dojo.dnd.HtmlDragAndDrop"], dashboard:["dojo.dnd.HtmlDragAndDrop"]}); dojo.provide("dojo.dnd.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dom.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dom.js index 2fa11d1e4..52179e205 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dom.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/dom.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.dom"); dojo.dom.ELEMENT_NODE = 1; dojo.dom.ATTRIBUTE_NODE = 2; diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event.js index d9ffca5b5..43fe34502 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.event"); dojo.require("dojo.event.*"); dojo.deprecated("dojo.event", "replaced by dojo.event.*", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/__package__.js index eb965ccdb..90addbc77 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/__package__.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.kwCompoundRequire({common:["dojo.event.common", "dojo.event.topic"], browser:["dojo.event.browser"], dashboard:["dojo.event.browser"]}); dojo.provide("dojo.event.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/browser.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/browser.js index b6edd3f05..44ab779df 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/browser.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/browser.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.event.browser"); dojo.require("dojo.event.common"); dojo._ie_clobber = new function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/common.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/common.js index db9df5a73..99b5b2257 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/common.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/common.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.event.common"); dojo.require("dojo.lang.array"); dojo.require("dojo.lang.extras"); @@ -162,6 +164,13 @@ dojo.event = new function () { } else { var ao = interpolateArgs(arguments, true); } + if (dojo.lang.isString(ao.srcFunc) && (ao.srcFunc.toLowerCase() == "onkey")) { + if (dojo.render.html.ie) { + ao.srcFunc = "onkeydown"; + this.connect(ao); + } + ao.srcFunc = "onkeypress"; + } if (dojo.lang.isArray(ao.srcObj) && ao.srcObj != "") { var tmpAO = {}; for (var x in ao) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/topic.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/topic.js index 562f08231..e96128d63 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/topic.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/event/topic.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.require("dojo.event.common"); dojo.provide("dojo.event.topic"); dojo.event.topic = new function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/experimental.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/experimental.js index 9860784ba..19e3d4dcf 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/experimental.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/experimental.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.experimental"); dojo.experimental = function (moduleName, extra) { var message = "EXPERIMENTAL: " + moduleName; diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/flash.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/flash.js index 97671d9a4..f001268bb 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/flash.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/flash.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.flash"); dojo.require("dojo.string.*"); dojo.require("dojo.uri.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/Colorspace.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/Colorspace.js index d306f9d22..543040cfe 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/Colorspace.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/Colorspace.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.Colorspace"); dojo.require("dojo.lang.common"); dojo.require("dojo.math.matrix"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/__package__.js index 48bcd8522..fd53fd472 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/__package__.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.kwCompoundRequire({common:["dojo.gfx.color", "dojo.gfx.matrix", "dojo.gfx.common"]}); dojo.requireIf(dojo.render.svg.capable, "dojo.gfx.svg"); dojo.requireIf(dojo.render.vml.capable, "dojo.gfx.vml"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color.js index b244fa967..f9bd72a04 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.color"); dojo.require("dojo.lang.common"); dojo.require("dojo.lang.array"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color/hsl.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color/hsl.js index 9ad656213..69037457e 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color/hsl.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color/hsl.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.color.hsl"); dojo.require("dojo.lang.array"); dojo.lang.extend(dojo.gfx.color.Color, {toHsl:function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color/hsv.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color/hsv.js index 5e68b6626..f684f7312 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color/hsv.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/color/hsv.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.color.hsv"); dojo.require("dojo.lang.array"); dojo.require("dojo.math"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/common.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/common.js index 3b9fba2f6..abaa35259 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/common.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/common.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.common"); dojo.require("dojo.gfx.color"); dojo.require("dojo.lang.declare"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/matrix.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/matrix.js index 36c89db18..12ecc6af0 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/matrix.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/matrix.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.matrix"); dojo.require("dojo.lang.common"); dojo.require("dojo.math.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/path.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/path.js index 4cebee171..61a58bb96 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/path.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/path.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.path"); dojo.require("dojo.math"); dojo.require("dojo.gfx.shape"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/shape.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/shape.js index 3303cdbef..9efb43d01 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/shape.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/shape.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.shape"); dojo.require("dojo.lang.declare"); dojo.require("dojo.gfx.common"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/svg.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/svg.js index 1207e4dca..7c468027c 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/svg.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/svg.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.svg"); dojo.require("dojo.lang.declare"); dojo.require("dojo.svg"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/vml.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/vml.js index 26a08b1eb..22f23f276 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/vml.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/gfx/vml.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.gfx.vml"); dojo.require("dojo.dom"); dojo.require("dojo.math"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/Colorspace.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/Colorspace.js index 233ad71ac..ce9a47aa1 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/Colorspace.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/Colorspace.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.graphics.Colorspace"); dojo.require("dojo.gfx.Colorspace"); dojo.deprecated("dojo.graphics.Colorspace: use dojo.gfx.Colorspace instead.", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/__package__.js index eaa60b4be..7cb60c145 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/__package__.js @@ -8,5 +8,7 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.graphics.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color.js index cc7ab139a..1cbdc50ae 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.graphics.color"); dojo.require("dojo.gfx.color"); dojo.deprecated("dojo.graphics.color.Color is now dojo.gfx.color.Color.", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color/hsl.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color/hsl.js index ebd49acb4..afa2b509a 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color/hsl.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color/hsl.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.graphics.color.hsl"); dojo.require("dojo.gfx.color.hsl"); dojo.deprecated("dojo.graphics.color.hsl has been replaced with dojo.gfx.color.hsl", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color/hsv.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color/hsv.js index d3b1380c8..c28e57af3 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color/hsv.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/graphics/color/hsv.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.graphics.color.hsv"); dojo.require("dojo.gfx.color.hsv"); dojo.deprecated("dojo.graphics.color.hsv has been replaced by dojo.gfx.color.hsv", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_adobesvg.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_adobesvg.js index c3439c26c..08c2d5351 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_adobesvg.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_adobesvg.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + if (typeof window == "undefined") { dojo.raise("attempt to use adobe svg hostenv when no window object"); } diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_browser.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_browser.js index bc694bde2..4b24d2676 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_browser.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_browser.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + if (typeof window != "undefined") { (function () { if (djConfig.allowQueryConfig) { @@ -236,7 +238,9 @@ if (typeof window != "undefined") { }; return true; } + dojo.hostenv._djInitFired = false; function dj_load_init(e) { + dojo.hostenv._djInitFired = true; var type = (e && e.type) ? e.type.toLowerCase() : "load"; if (arguments.callee.initialized || (type != "domcontentloaded" && type != "load")) { return; diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_dashboard.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_dashboard.js index 455a45bc4..68f4dd27e 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_dashboard.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_dashboard.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.render.name = dojo.hostenv.name_ = "dashboard"; dojo.hostenv.println = function (message) { return alert(message); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_rhino.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_rhino.js index 686166e51..4bc284629 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_rhino.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_rhino.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.hostenv.println = function (line) { if (arguments.length > 0) { print(arguments[0]); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_spidermonkey.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_spidermonkey.js index 998f6c949..711e59dca 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_spidermonkey.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_spidermonkey.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.hostenv.name_ = "spidermonkey"; dojo.hostenv.println = print; dojo.hostenv.exit = function (exitcode) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_svg.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_svg.js index 37f49fd5a..3e292e2ee 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_svg.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_svg.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + if (typeof window == "undefined") { dojo.raise("attempt to use adobe svg hostenv when no window object"); } diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_wsh.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_wsh.js index 435da922a..cd856d67f 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_wsh.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/hostenv_wsh.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.hostenv.name_ = "wsh"; if (typeof WScript == "undefined") { dojo.raise("attempt to use WSH host environment when no WScript global"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html.js index 5bddc13e7..37cad5c3a 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.html"); dojo.require("dojo.html.*"); dojo.deprecated("dojo.html", "replaced by dojo.html.*", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/__package__.js index a31aadb1c..c6a7df75a 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/__package__.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.kwCompoundRequire({common:["dojo.html.common", "dojo.html.style"]}); dojo.provide("dojo.html.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/color.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/color.js index 0fd5ee830..b5e939acc 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/color.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/color.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.require("dojo.html.style"); dojo.provide("dojo.html.color"); dojo.require("dojo.gfx.color"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/common.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/common.js index 98ababb67..0e4255bec 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/common.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/common.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.html.common"); dojo.require("dojo.lang.common"); dojo.require("dojo.dom"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/display.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/display.js index 88b6b8ea4..248e82ee7 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/display.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/display.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.html.display"); dojo.require("dojo.html.style"); dojo.html._toggle = function (node, tester, setter) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/iframe.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/iframe.js index 5b9bfe912..72832a7b2 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/iframe.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/iframe.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.html.iframe"); dojo.require("dojo.html.util"); dojo.html.iframeContentWindow = function (iframe_el) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/layout.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/layout.js index 9e380c406..4c2f8c42c 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/layout.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/layout.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.html.layout"); dojo.require("dojo.html.common"); dojo.require("dojo.html.style"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/metrics.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/metrics.js index 5c5a018d0..6e2fd7f74 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/metrics.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/metrics.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.html.metrics"); dojo.require("dojo.html.layout"); dojo.html.getScrollbar = function () { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/selection.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/selection.js index 8eb1b3b7f..3a6b063f9 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/selection.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/selection.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.require("dojo.html.common"); dojo.provide("dojo.html.selection"); dojo.require("dojo.dom"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/shadow.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/shadow.js index cffd988f7..ac73cceb2 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/shadow.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/shadow.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.html.shadow"); dojo.require("dojo.lfx.shadow"); dojo.deprecated("dojo.html.shadow has been moved to dojo.lfx.", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/style.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/style.js index 470a1ae7c..0f67645ae 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/style.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/style.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.html.style"); dojo.require("dojo.html.common"); dojo.require("dojo.uri.Uri"); @@ -173,7 +175,7 @@ dojo.html.toSelectorCase = function (selector) { if (dojo.render.html.ie) { dojo.html.getComputedStyle = function (node, property, value) { node = dojo.byId(node); - if (!node || !node.style) { + if (!node || !node.currentStyle) { return value; } return node.currentStyle[dojo.html.toCamelCase(property)]; diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/util.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/util.js index dd6276934..c57259ce8 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/util.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/html/util.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.html.util"); dojo.require("dojo.html.layout"); dojo.html.getElementWindow = function (element) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/de/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/de/gregorian.js index 679ed90b4..b674c4bb2 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/de/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/de/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"field-weekday":"Wochentag", "dateFormat-medium":"dd.MM.yyyy", "field-second":"Sekunde", "field-week":"Woche", "pm":"nachm.", "timeFormat-full":"H:mm' Uhr 'z", "months-standAlone-narrow":["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], "am":"vorm.", "days-standAlone-narrow":["S", "M", "D", "M", "D", "F", "S"], "field-year":"Jahr", "eras":["v. Chr.", "n. Chr."], "field-hour":"Stunde", "dateFormat-long":"d. MMMM yyyy", "field-day":"Tag", "field-dayperiod":"Tagesh\xe4lfte", "field-month":"Monat", "dateFormat-short":"dd.MM.yy", "months-format-wide":["Januar", "Februar", "M\xe4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], "field-era":"Epoche", "months-format-abbr":["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], "days-format-wide":["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], "dateFormat-full":"EEEE, d. MMMM yyyy", "field-zone":"Zone", "days-format-abbr":["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], "field-minute":"Minute", "timeFormat-medium":"HH:mm:ss", "timeFormat-short":"HH:mm", "timeFormat-long":"HH:mm:ss z"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/en/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/en/gregorian.js index 4d1cc3b87..d0b21848e 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/en/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/en/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"months-standAlone-narrow":["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], "dateFormat-long":"MMMM d, yyyy", "timeFormat-full":"h:mm:ss a v", "eras":["BC", "AD"], "timeFormat-medium":"h:mm:ss a", "dateFormat-medium":"MMM d, yyyy", "months-format-abbr":["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], "dateFormat-full":"EEEE, MMMM d, yyyy", "days-format-abbr":["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], "timeFormat-long":"h:mm:ss a z", "timeFormat-short":"h:mm a", "dateFormat-short":"M/d/yy", "months-format-wide":["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], "days-standAlone-narrow":["S", "M", "T", "W", "T", "F", "S"], "days-format-wide":["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], "field-weekday":"Day of the Week", "field-second":"Second", "field-week":"Week", "pm":"PM", "am":"AM", "field-year":"Year", "field-minute":"Minute", "field-hour":"Hour", "field-day":"Day", "field-dayperiod":"Dayperiod", "field-month":"Month", "field-era":"Era", "field-zone":"Zone"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/es/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/es/gregorian.js index 94010d5bb..8cc1a7b87 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/es/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/es/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"field-weekday":"d\xeda de la semana", "dateFormat-medium":"dd-MMM-yy", "field-second":"segundo", "field-week":"semana", "pm":"p.m.", "timeFormat-full":"HH'H'mm''ss\" z", "months-standAlone-narrow":["E", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], "am":"a.m.", "days-standAlone-narrow":["D", "L", "M", "M", "J", "V", "S"], "field-year":"a\xf1o", "eras":["a.C.", "d.C."], "field-minute":"minuto", "field-hour":"hora", "dateFormat-long":"d' de 'MMMM' de 'yyyy", "field-day":"d\xeda", "field-dayperiod":"periodo del d\xeda", "field-month":"mes", "dateFormat-short":"d/MM/yy", "months-format-wide":["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], "field-era":"era", "months-format-abbr":["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"], "days-format-wide":["domingo", "lunes", "martes", "mi\xe9rcoles", "jueves", "viernes", "s\xe1bado"], "dateFormat-full":"EEEE d' de 'MMMM' de 'yyyy", "field-zone":"zona", "days-format-abbr":["dom", "lun", "mar", "mi\xe9", "jue", "vie", "s\xe1b"], "timeFormat-medium":"HH:mm:ss", "timeFormat-short":"HH:mm", "timeFormat-long":"HH:mm:ss z"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/fi/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/fi/gregorian.js index 63b4e04ab..4014ac327 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/fi/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/fi/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"field-weekday":"viikonp\xe4iv\xe4", "dateFormat-medium":"d.M.yyyy", "field-second":"sekunti", "field-week":"viikko", "pm":"ip.", "timeFormat-full":"H.mm.ss v", "months-standAlone-narrow":["T", "H", "M", "H", "T", "K", "H", "E", "S", "L", "M", "J"], "am":"ap.", "days-standAlone-narrow":["S", "M", "T", "K", "T", "P", "L"], "field-year":"vuosi", "eras":["eKr.", "jKr."], "field-minute":"minuutti", "timeFormat-medium":"H.mm.ss", "field-hour":"tunti", "dateFormat-long":"d. MMMM'ta 'yyyy", "field-day":"p\xe4iv\xe4", "field-dayperiod":"ap/ip-valinta", "field-month":"kuukausi", "dateFormat-short":"d.M.yyyy", "months-format-wide":["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kes\xe4kuu", "hein\xe4kuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"], "field-era":"aikakausi", "timeFormat-short":"H.mm", "months-format-abbr":["tammi", "helmi", "maalis", "huhti", "touko", "kes\xe4", "hein\xe4", "elo", "syys", "loka", "marras", "joulu"], "timeFormat-long":"'klo 'H.mm.ss", "days-format-wide":["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"], "dateFormat-full":"EEEE'na 'd. MMMM'ta 'yyyy", "field-zone":"aikavy\xf6hyke", "days-format-abbr":["su", "ma", "ti", "ke", "to", "pe", "la"]}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/fr/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/fr/gregorian.js index 220e72cfc..68cf494a9 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/fr/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/fr/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"field-weekday":"jour de la semaine", "dateFormat-medium":"d MMM yy", "field-second":"seconde", "field-week":"semaine", "pm":"ap. m.", "timeFormat-full":"HH' h 'mm z", "months-standAlone-narrow":["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], "am":"matin", "days-standAlone-narrow":["D", "L", "M", "M", "J", "V", "S"], "field-year":"ann\xe9e", "eras":["av. J.-C.", "apr. J.-C."], "field-minute":"minute", "field-hour":"heure", "dateFormat-long":"d MMMM yyyy", "field-day":"jour", "field-dayperiod":"p\xe9riode de la journ\xe9e", "field-month":"mois", "dateFormat-short":"dd/MM/yy", "months-format-wide":["janvier", "f\xe9vrier", "mars", "avril", "mai", "juin", "juillet", "ao\xfbt", "septembre", "octobre", "novembre", "d\xe9cembre"], "field-era":"\xe9poque", "months-format-abbr":["janv.", "f\xe9vr.", "mars", "avr.", "mai", "juin", "juil.", "ao\xfbt", "sept.", "oct.", "nov.", "d\xe9c."], "days-format-wide":["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], "dateFormat-full":"EEEE d MMMM yyyy", "field-zone":"zone", "days-format-abbr":["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."], "timeFormat-medium":"HH:mm:ss", "timeFormat-short":"HH:mm", "timeFormat-long":"HH:mm:ss z"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/gregorian.js index 95df07477..b352f38f4 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"field-weekday":"Day of the Week", "dateFormat-medium":"yyyy MMM d", "field-second":"Second", "field-week":"Week", "pm":"PM", "timeFormat-full":"HH:mm:ss z", "months-standAlone-narrow":["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], "am":"AM", "days-standAlone-narrow":["1", "2", "3", "4", "5", "6", "7"], "field-year":"Year", "eras":["BCE", "CE"], "field-minute":"Minute", "timeFormat-medium":"HH:mm:ss", "field-hour":"Hour", "dateFormat-long":"yyyy MMMM d", "field-day":"Day", "field-dayperiod":"Dayperiod", "field-month":"Month", "dateFormat-short":"yy/MM/dd", "months-format-wide":["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], "field-era":"Era", "timeFormat-short":"HH:mm", "months-format-abbr":["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], "timeFormat-long":"HH:mm:ss z", "days-format-wide":["1", "2", "3", "4", "5", "6", "7"], "dateFormat-full":"EEEE, yyyy MMMM dd", "field-zone":"Zone", "days-format-abbr":["1", "2", "3", "4", "5", "6", "7"]}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/gregorianExtras.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/gregorianExtras.js index 37098a7f5..1c814c927 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/gregorianExtras.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/gregorianExtras.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"dateFormat-yearOnly":"yyyy"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/hu/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/hu/gregorian.js index d4d9e8f6f..5360dc4c2 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/hu/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/hu/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"field-weekday":"h\xe9t napja", "dateFormat-medium":"yyyy MMM d", "field-second":"m\xe1sodperc", "field-week":"h\xe9t", "pm":"d.u.", "timeFormat-full":"h:mm:ss a v", "months-standAlone-narrow":["J", "F", "M", "\xc1", "M", "J", "J", "A", "S", "O", "N", "D"], "am":"d.e.", "days-standAlone-narrow":["V", "H", "K", "Sz", "Cs", "P", "Sz"], "field-year":"\xe9v", "eras":["k.e.", "k.u."], "field-minute":"perc", "timeFormat-medium":"h:mm:ss a", "field-hour":"\xf3ra", "dateFormat-long":"yyyy MMMM d", "field-day":"nap", "field-dayperiod":"napszak", "field-month":"h\xf3nap", "dateFormat-short":"yyyy-M-d", "months-format-wide":["janu\xe1r", "febru\xe1r", "m\xe1rcius", "\xe1prilis", "m\xe1jus", "j\xfanius", "j\xfalius", "augusztus", "szeptember", "okt\xf3ber", "november", "december"], "field-era":"\xe9ra", "timeFormat-short":"h:mm a", "months-format-abbr":["jan", "feb", "m\xe1r", "apr", "m\xe1j", "j\xfan", "j\xfal", "aug", "sze", "okt", "nov", "dec"], "timeFormat-long":"h:mm:ss a z", "days-format-wide":["vas\xe1rnap", "h\xe9tf\u0151", "kedd", "szerda", "cs\xfct\xf6rt\xf6k", "p\xe9ntek", "szombat"], "dateFormat-full":"yyyy MMMM d, EEEE", "field-zone":"z\xf3na", "days-format-abbr":["Va", "H\xe9", "Ke", "Sze", "Cs\xfc", "P\xe9", "Szo"]}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/it/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/it/gregorian.js index 556ba290f..d924aa261 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/it/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/it/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"field-weekday":"giorno della settimana", "dateFormat-medium":"dd/MMM/yy", "field-second":"secondo", "field-week":"settimana", "pm":"p.", "months-standAlone-narrow":["G", "F", "M", "A", "M", "G", "L", "A", "S", "O", "N", "D"], "am":"m.", "days-standAlone-narrow":["D", "L", "M", "M", "G", "V", "S"], "field-year":"anno", "eras":["aC", "dC"], "field-minute":"minuto", "field-hour":"ora", "dateFormat-long":"dd MMMM yyyy", "field-day":"giorno", "field-dayperiod":"periodo del giorno", "field-month":"mese", "dateFormat-short":"dd/MM/yy", "months-format-wide":["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"], "field-era":"era", "months-format-abbr":["gen", "feb", "mar", "apr", "mag", "giu", "lug", "ago", "set", "ott", "nov", "dic"], "days-format-wide":["domenica", "luned\xec", "marted\xec", "mercoled\xec", "gioved\xec", "venerd\xec", "sabato"], "dateFormat-full":"EEEE d MMMM yyyy", "field-zone":"zona", "days-format-abbr":["dom", "lun", "mar", "mer", "gio", "ven", "sab"], "timeFormat-full":"HH:mm:ss z", "timeFormat-medium":"HH:mm:ss", "timeFormat-short":"HH:mm", "timeFormat-long":"HH:mm:ss z"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ja/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ja/gregorian.js index 3c3daff3d..5e6d192be 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ja/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ja/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"days-standAlone-narrow":["\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f"], "timeFormat-full":"H'\u6642'mm'\u5206'ss'\u79d2'z", "eras":["\u7d00\u5143\u524d", "\u897f\u66a6"], "timeFormat-medium":"H:mm:ss", "dateFormat-medium":"yyyy/MM/dd", "am":"\u5348\u524d", "months-format-abbr":["1 \u6708", "2 \u6708", "3 \u6708", "4 \u6708", "5 \u6708", "6 \u6708", "7 \u6708", "8 \u6708", "9 \u6708", "10 \u6708", "11 \u6708", "12 \u6708"], "dateFormat-full":"yyyy'\u5e74'M'\u6708'd'\u65e5'EEEE", "days-format-abbr":["\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f"], "timeFormat-long":"H:mm:ss:z", "timeFormat-short":"H:mm", "pm":"\u5348\u5f8c", "months-format-wide":["1 \u6708", "2 \u6708", "3 \u6708", "4 \u6708", "5 \u6708", "6 \u6708", "7 \u6708", "8 \u6708", "9 \u6708", "10 \u6708", "11 \u6708", "12 \u6708"], "dateFormat-long":"yyyy'\u5e74'M'\u6708'd'\u65e5'", "days-format-wide":["\u65e5\u66dc\u65e5", "\u6708\u66dc\u65e5", "\u706b\u66dc\u65e5", "\u6c34\u66dc\u65e5", "\u6728\u66dc\u65e5", "\u91d1\u66dc\u65e5", "\u571f\u66dc\u65e5"], "field-weekday":"Day of the Week", "field-second":"Second", "field-week":"Week", "months-standAlone-narrow":["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], "field-year":"Year", "field-minute":"Minute", "field-hour":"Hour", "field-day":"Day", "field-dayperiod":"Dayperiod", "field-month":"Month", "dateFormat-short":"yy/MM/dd", "field-era":"Era", "field-zone":"Zone"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ja/gregorianExtras.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ja/gregorianExtras.js index 81c6fb585..45747bcb4 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ja/gregorianExtras.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ja/gregorianExtras.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"dateFormat-yearOnly":"yyyy\u5e74"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ko/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ko/gregorian.js index 1fb6b1ecf..9db25bf42 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ko/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/ko/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"months-standAlone-narrow":["1\uc6d4", "2\uc6d4", "3\uc6d4", "4\uc6d4", "5\uc6d4", "6\uc6d4", "7\uc6d4", "8\uc6d4", "9\uc6d4", "10\uc6d4", "11\uc6d4", "12\uc6d4"], "dateFormat-long":"yyyy'\ub144' M'\uc6d4' d'\uc77c'", "timeFormat-full":"a hh'\uc2dc' mm'\ubd84' ss'\ucd08' z", "eras":["\uae30\uc6d0\uc804", "\uc11c\uae30"], "timeFormat-medium":"a hh'\uc2dc' mm'\ubd84'", "dateFormat-medium":"yyyy. MM. dd", "am":"\uc624\uc804", "months-format-abbr":["1\uc6d4", "2\uc6d4", "3\uc6d4", "4\uc6d4", "5\uc6d4", "6\uc6d4", "7\uc6d4", "8\uc6d4", "9\uc6d4", "10\uc6d4", "11\uc6d4", "12\uc6d4"], "dateFormat-full":"yyyy'\ub144' M'\uc6d4' d'\uc77c' EEEE", "days-format-abbr":["\uc77c", "\uc6d4", "\ud654", "\uc218", "\ubaa9", "\uae08", "\ud1a0"], "timeFormat-long":"a hh'\uc2dc' mm'\ubd84' ss'\ucd08'", "timeFormat-short":"a hh'\uc2dc' mm'\ubd84'", "dateFormat-short":"yy. MM. dd", "pm":"\uc624\ud6c4", "months-format-wide":["1\uc6d4", "2\uc6d4", "3\uc6d4", "4\uc6d4", "5\uc6d4", "6\uc6d4", "7\uc6d4", "8\uc6d4", "9\uc6d4", "10\uc6d4", "11\uc6d4", "12\uc6d4"], "days-standAlone-narrow":["\uc77c", "\uc6d4", "\ud654", "\uc218", "\ubaa9", "\uae08", "\ud1a0"], "days-format-wide":["\uc77c\uc694\uc77c", "\uc6d4\uc694\uc77c", "\ud654\uc694\uc77c", "\uc218\uc694\uc77c", "\ubaa9\uc694\uc77c", "\uae08\uc694\uc77c", "\ud1a0\uc694\uc77c"], "field-weekday":"Day of the Week", "field-second":"Second", "field-week":"Week", "field-year":"Year", "field-minute":"Minute", "field-hour":"Hour", "field-day":"Day", "field-dayperiod":"Dayperiod", "field-month":"Month", "field-era":"Era", "field-zone":"Zone"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/nl/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/nl/gregorian.js index acd9a0899..926db4275 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/nl/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/nl/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"dateFormat-medium":"d MMM yyyy", "field-second":"Seconde", "timeFormat-full":"HH:mm:ss v", "months-standAlone-narrow":["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], "days-standAlone-narrow":["Z", "M", "D", "W", "D", "V", "Z"], "field-year":"Jaar", "eras":["v. Chr.", "n. Chr."], "field-minute":"Minuut", "field-hour":"Uur", "dateFormat-long":"d MMMM yyyy", "field-day":"Dag", "field-dayperiod":"Dagdeel", "field-month":"Maand", "dateFormat-short":"dd-MM-yy", "months-format-wide":["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"], "field-era":"Tijdperk", "months-format-abbr":["jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"], "days-format-wide":["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"], "dateFormat-full":"EEEE d MMMM yyyy", "days-format-abbr":["zo", "ma", "di", "wo", "do", "vr", "za"], "field-weekday":"Dag van de week", "field-week":"Week", "pm":"PM", "am":"AM", "timeFormat-medium":"HH:mm:ss", "timeFormat-short":"HH:mm", "timeFormat-long":"HH:mm:ss z", "field-zone":"Zone"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/pt-br/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/pt-br/gregorian.js index 44e71c975..e3fd55ae6 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/pt-br/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/pt-br/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"field-hour":"Hora", "field-dayperiod":"Per\xedodo do dia", "field-minute":"Minuto", "timeFormat-full":"HH'h'mm'min'ss's' z", "field-weekday":"Dia da semana", "field-week":"Semana", "field-second":"Segundo", "dateFormat-medium":"dd/MM/yyyy", "field-day":"Dia", "timeFormat-long":"H'h'm'min's's' z", "field-month":"M\xeas", "field-year":"Ano", "dateFormat-short":"dd/MM/yy", "field-zone":"Fuso", "months-standAlone-narrow":["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], "dateFormat-long":"d' de 'MMMM' de 'yyyy", "eras":["a.C.", "d.C."], "months-format-abbr":["jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez"], "dateFormat-full":"EEEE, d' de 'MMMM' de 'yyyy", "days-format-abbr":["dom", "seg", "ter", "qua", "qui", "sex", "s\xe1b"], "months-format-wide":["janeiro", "fevereiro", "mar\xe7o", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"], "days-standAlone-narrow":["D", "S", "T", "Q", "Q", "S", "S"], "days-format-wide":["domingo", "segunda-feira", "ter\xe7a-feira", "quarta-feira", "quinta-feira", "sexta-feira", "s\xe1bado"], "pm":"PM", "am":"AM", "timeFormat-medium":"HH:mm:ss", "field-era":"Era", "timeFormat-short":"HH:mm"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/pt/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/pt/gregorian.js index a3a111744..ea9b004fe 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/pt/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/pt/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"months-standAlone-narrow":["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], "dateFormat-long":"d' de 'MMMM' de 'yyyy", "timeFormat-full":"HH'H'mm'm'ss's' z", "eras":["a.C.", "d.C."], "dateFormat-medium":"d/MMM/yyyy", "months-format-abbr":["jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez"], "dateFormat-full":"EEEE, d' de 'MMMM' de 'yyyy", "days-format-abbr":["dom", "seg", "ter", "qua", "qui", "sex", "s\xe1b"], "dateFormat-short":"dd-MM-yyyy", "months-format-wide":["janeiro", "fevereiro", "mar\xe7o", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"], "days-standAlone-narrow":["D", "S", "T", "Q", "Q", "S", "S"], "days-format-wide":["domingo", "segunda-feira", "ter\xe7a-feira", "quarta-feira", "quinta-feira", "sexta-feira", "s\xe1bado"], "field-weekday":"Day of the Week", "field-second":"Second", "field-week":"Week", "pm":"PM", "am":"AM", "field-year":"Year", "field-minute":"Minute", "timeFormat-medium":"HH:mm:ss", "field-hour":"Hour", "field-day":"Day", "field-dayperiod":"Dayperiod", "field-month":"Month", "field-era":"Era", "timeFormat-short":"HH:mm", "timeFormat-long":"HH:mm:ss z", "field-zone":"Zone"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/sv/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/sv/gregorian.js index 08bc61178..a0b074626 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/sv/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/sv/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"field-weekday":"veckodag", "dateFormat-medium":"d MMM yyyy", "field-second":"sekund", "field-week":"vecka", "pm":"em", "timeFormat-full":"'kl. 'HH.mm.ss z", "months-standAlone-narrow":["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], "am":"fm", "days-standAlone-narrow":["S", "M", "T", "O", "T", "F", "L"], "field-year":"\xe5r", "eras":["f.Kr.", "e.Kr."], "field-minute":"minut", "timeFormat-medium":"HH.mm.ss", "field-hour":"timme", "dateFormat-long":"EEEE d MMM yyyy", "field-day":"dag", "field-dayperiod":"dagsperiod", "field-month":"m\xe5nad", "dateFormat-short":"yyyy-MM-dd", "months-format-wide":["januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"], "field-era":"era", "timeFormat-short":"HH.mm", "months-format-abbr":["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"], "timeFormat-long":"HH.mm.ss z", "days-format-wide":["s\xf6ndag", "m\xe5ndag", "tisdag", "onsdag", "torsdag", "fredag", "l\xf6rdag"], "dateFormat-full":"EEEE'en den' d MMMM yyyy", "field-zone":"tidszon", "days-format-abbr":["s\xf6", "m\xe5", "ti", "on", "to", "fr", "l\xf6"]}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-cn/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-cn/gregorian.js index 7eff195b1..014d1d9dd 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-cn/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-cn/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"dateFormat-medium":"yyyy-M-d", "field-second":"\u79d2\u949f", "field-week":"\u5468", "timeFormat-full":"ahh'\u65f6'mm'\u5206'ss'\u79d2' z", "field-year":"\u5e74", "field-minute":"\u5206\u949f", "timeFormat-medium":"ahh:mm:ss", "field-hour":"\u5c0f\u65f6", "dateFormat-long":"yyyy'\u5e74'M'\u6708'd'\u65e5'", "field-day":"\u65e5", "field-dayperiod":"\u4e0a\u5348/\u4e0b\u5348", "field-month":"\u6708", "dateFormat-short":"yy-M-d", "field-era":"\u65f6\u671f", "timeFormat-short":"ah:mm", "timeFormat-long":"ahh'\u65f6'mm'\u5206'ss'\u79d2'", "dateFormat-full":"yyyy'\u5e74'M'\u6708'd'\u65e5'EEEE", "field-weekday":"\u5468\u5929", "field-zone":"\u533a\u57df", "days-standAlone-narrow":["\u65e5", "\u4e00", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d"], "eras":["\u516c\u5143\u524d", "\u516c\u5143"], "am":"\u4e0a\u5348", "months-format-abbr":["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"], "days-format-abbr":["\u5468\u65e5", "\u5468\u4e00", "\u5468\u4e8c", "\u5468\u4e09", "\u5468\u56db", "\u5468\u4e94", "\u5468\u516d"], "pm":"\u4e0b\u5348", "months-format-wide":["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"], "months-standAlone-narrow":["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"], "days-format-wide":["\u661f\u671f\u65e5", "\u661f\u671f\u4e00", "\u661f\u671f\u4e8c", "\u661f\u671f\u4e09", "\u661f\u671f\u56db", "\u661f\u671f\u4e94", "\u661f\u671f\u516d"]}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-hk/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-hk/gregorian.js index c61f382b9..a796a4881 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-hk/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-hk/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"timeFormat-full":"ahh'\u6642'mm'\u5206'ss'\u79d2' z", "eras":["\u897f\u5143\u524d", "\u897f\u5143"], "timeFormat-medium":"a h:mm:ss", "dateFormat-medium":"yyyy/M/d", "dateFormat-full":"yyyy'\u5e74'M'\u6708'd'\u65e5'EEEE", "days-format-abbr":["\u9031\u65e5", "\u9031\u4e00", "\u9031\u4e8c", "\u9031\u4e09", "\u9031\u56db", "\u9031\u4e94", "\u9031\u516d"], "timeFormat-long":"ahh'\u6642'mm'\u5206'ss'\u79d2'", "timeFormat-short":"a h:mm", "dateFormat-short":"yyyy/M/d", "dateFormat-long":"yyyy'\u5e74'M'\u6708'd'\u65e5'", "days-standAlone-narrow":["\u65e5", "\u4e00", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d"], "am":"\u4e0a\u5348", "months-format-abbr":["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"], "pm":"\u4e0b\u5348", "months-format-wide":["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"], "months-standAlone-narrow":["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"], "days-format-wide":["\u661f\u671f\u65e5", "\u661f\u671f\u4e00", "\u661f\u671f\u4e8c", "\u661f\u671f\u4e09", "\u661f\u671f\u56db", "\u661f\u671f\u4e94", "\u661f\u671f\u516d"], "field-weekday":"Day of the Week", "field-second":"Second", "field-week":"Week", "field-year":"Year", "field-minute":"Minute", "field-hour":"Hour", "field-day":"Day", "field-dayperiod":"Dayperiod", "field-month":"Month", "field-era":"Era", "field-zone":"Zone"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-tw/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-tw/gregorian.js index cc2e46199..f48011f07 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-tw/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh-tw/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"dateFormat-medium":"yyyy'\u5e74'M'\u6708'd'\u65e5'", "field-second":"\u79d2", "field-week":"\u9031", "timeFormat-full":"ahh'\u6642'mm'\u5206'ss'\u79d2' z", "eras":["\u897f\u5143\u524d", "\u897f\u5143"], "field-year":"\u5e74", "field-minute":"\u5206\u9418", "timeFormat-medium":"ahh:mm:ss", "field-hour":"\u5c0f\u6642", "dateFormat-long":"yyyy'\u5e74'M'\u6708'd'\u65e5'", "field-day":"\u6574\u65e5", "field-dayperiod":"\u65e5\u9593", "field-month":"\u6708", "dateFormat-short":"yy'\u5e74'M'\u6708'd'\u65e5'", "field-era":"\u5e74\u4ee3", "timeFormat-short":"ah:mm", "months-format-abbr":["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"], "timeFormat-long":"ahh'\u6642'mm'\u5206'ss'\u79d2'", "field-weekday":"\u9031\u5929", "dateFormat-full":"yyyy'\u5e74'M'\u6708'd'\u65e5'EEEE", "field-zone":"\u5340\u57df", "days-standAlone-narrow":["\u65e5", "\u4e00", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d"], "am":"\u4e0a\u5348", "days-format-abbr":["\u5468\u65e5", "\u5468\u4e00", "\u5468\u4e8c", "\u5468\u4e09", "\u5468\u56db", "\u5468\u4e94", "\u5468\u516d"], "pm":"\u4e0b\u5348", "months-format-wide":["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"], "months-standAlone-narrow":["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"], "days-format-wide":["\u661f\u671f\u65e5", "\u661f\u671f\u4e00", "\u661f\u671f\u4e8c", "\u661f\u671f\u4e09", "\u661f\u671f\u56db", "\u661f\u671f\u4e94", "\u661f\u671f\u516d"]}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh/gregorian.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh/gregorian.js index 18b7b8f68..97a66167f 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh/gregorian.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh/gregorian.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"days-standAlone-narrow":["\u65e5", "\u4e00", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d"], "eras":["\u516c\u5143\u524d", "\u516c\u5143"], "am":"\u4e0a\u5348", "months-format-abbr":["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"], "days-format-abbr":["\u5468\u65e5", "\u5468\u4e00", "\u5468\u4e8c", "\u5468\u4e09", "\u5468\u56db", "\u5468\u4e94", "\u5468\u516d"], "pm":"\u4e0b\u5348", "months-format-wide":["\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708", "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708", "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708", "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708"], "months-standAlone-narrow":["1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708"], "days-format-wide":["\u661f\u671f\u65e5", "\u661f\u671f\u4e00", "\u661f\u671f\u4e8c", "\u661f\u671f\u4e09", "\u661f\u671f\u56db", "\u661f\u671f\u4e94", "\u661f\u671f\u516d"], "field-weekday":"Day of the Week", "dateFormat-medium":"yyyy MMM d", "field-second":"Second", "field-week":"Week", "timeFormat-full":"HH:mm:ss z", "field-year":"Year", "field-minute":"Minute", "timeFormat-medium":"HH:mm:ss", "field-hour":"Hour", "dateFormat-long":"yyyy MMMM d", "field-day":"Day", "field-dayperiod":"Dayperiod", "field-month":"Month", "dateFormat-short":"yy/MM/dd", "field-era":"Era", "timeFormat-short":"HH:mm", "timeFormat-long":"HH:mm:ss z", "dateFormat-full":"EEEE, yyyy MMMM dd", "field-zone":"Zone"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh/gregorianExtras.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh/gregorianExtras.js index 122568610..568ff1595 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh/gregorianExtras.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/calendar/nls/zh/gregorianExtras.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"dateFormat-yearOnly":"yyyy'\u5e74'"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/common.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/common.js index 19567cd20..d620a658b 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/common.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/common.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.i18n.common"); dojo.i18n.getLocalization = function (packageName, bundleName, locale) { dojo.hostenv.preloadLocalizations(); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency.js index fbb9789ab..9486ce533 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.i18n.currency"); dojo.require("dojo.experimental"); dojo.experimental("dojo.i18n.currency"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/common.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/common.js index 35f51ecaf..9af9eea4c 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/common.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/common.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.i18n.currency.common"); dojo.require("dojo.experimental"); dojo.experimental("dojo.i18n.currency"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/EUR.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/EUR.js index ec072b2db..a938f6d79 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/EUR.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/EUR.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"EUR", "symbol":"\u20ac"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/GBP.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/GBP.js index 17e4c77da..a3c8b1c10 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/GBP.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/GBP.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"GBP", "symbol":"\xa3"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/INR.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/INR.js index e0e6d4b66..3264098db 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/INR.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/INR.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"INR"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ITL.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ITL.js index b4654ff36..4079653cc 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ITL.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ITL.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"ITL", "symbol":"\u20a4"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/JPY.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/JPY.js index 46fb88bd1..fafcaeda4 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/JPY.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/JPY.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"JPY", "symbol":"\xa5"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/USD.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/USD.js index 59d1ac1de..86cdf9018 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/USD.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/USD.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"USD", "symbol":"$"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en-us/USD.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en-us/USD.js index b809a70a0..69ff761e6 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en-us/USD.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en-us/USD.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"symbol":"$", "displayName":"US Dollar"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/EUR.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/EUR.js index 121792779..01d9c08ac 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/EUR.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/EUR.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"Euro", "symbol":"\u20ac"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/GBP.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/GBP.js index 8432068a1..15cf2831c 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/GBP.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/GBP.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"British Pound Sterling", "symbol":"\xa3"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/INR.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/INR.js index a4999ec1c..01f06e30f 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/INR.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/INR.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"Indian Rupee"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/ITL.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/ITL.js index b436bb888..4721096ff 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/ITL.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/ITL.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"Italian Lira", "symbol":"\u20a4"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/JPY.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/JPY.js index 859ba103a..0a55a27bc 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/JPY.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/JPY.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"Japanese Yen", "symbol":"\xa5"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/USD.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/USD.js index ef59ebb48..aba973b7c 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/USD.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/en/USD.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"US Dollar", "symbol":"US$"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/EUR.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/EUR.js index 073643166..220368154 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/EUR.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/EUR.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u092f\u0941\u0930\u094b", "symbol":"\u20ac"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/GBP.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/GBP.js index ef243a96e..e4f1f4bde 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/GBP.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/GBP.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u092c\u094d\u0930\u093f\u0924\u0928 \u0915\u093e \u092a\u094c\u0928\u094d\u0921 \u0938\u094d\u091f\u0930\u094d\u0932\u093f\u0917", "symbol":"\xa3"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/INR.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/INR.js index c9360470e..c60fc94e1 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/INR.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/INR.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u092d\u093e\u0930\u0924\u0940\u092f \u0930\u0942\u092a\u092f\u093e", "symbol":"\u0930\u0941."}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/ITL.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/ITL.js index 1a0009511..3bbeff082 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/ITL.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/ITL.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u0907\u0924\u0932\u0940 \u0915\u093e \u0932\u0940\u0930\u093e", "symbol":"\u20a4"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/JPY.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/JPY.js index ab319c469..0cdf7f8aa 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/JPY.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/JPY.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u091c\u093e\u092a\u093e\u0928\u0940 \u092f\u0947\u0928", "symbol":"\xa5"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/USD.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/USD.js index 6e057274e..2ce9da5ea 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/USD.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/hi/USD.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u0905\u092e\u0930\u0940\u0915\u0940 \u0921\u093e\u0932\u0930", "symbol":"$"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/EUR.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/EUR.js index e75de70bb..2e4b34204 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/EUR.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/EUR.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u30e6\u30fc\u30ed", "symbol":"\u20ac"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/GBP.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/GBP.js index 3100041c5..f056f5c64 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/GBP.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/GBP.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u82f1\u56fd\u30dd\u30f3\u30c9", "symbol":"\xa3"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/INR.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/INR.js index 939101454..d4d36edc4 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/INR.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/INR.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u30a4\u30f3\u30c9 \u30eb\u30d4\u30fc", "symbol":"INR"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/ITL.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/ITL.js index 1b68928fa..2a377d484 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/ITL.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/ITL.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u30a4\u30bf\u30ea\u30a2 \u30ea\u30e9", "symbol":"\u20a4"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/JPY.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/JPY.js index 9f53621f1..a6bd072e3 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/JPY.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/JPY.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u65e5\u672c\u5186", "symbol":"\uffe5"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/USD.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/USD.js index 44e4f789d..83532ec47 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/USD.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/currency/nls/ja/USD.js @@ -8,4 +8,6 @@ http://dojotoolkit.org/community/licensing.shtml */ + + ({"displayName":"\u7c73\u30c9\u30eb", "symbol":"$"}) \ No newline at end of file diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/number.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/number.js index b8326feee..32803c0cd 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/number.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/i18n/number.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.i18n.number"); dojo.require("dojo.experimental"); dojo.experimental("dojo.i18n.number"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/iCalendar.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/iCalendar.js index dedbbf074..73134fca2 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/iCalendar.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/iCalendar.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.require("dojo.cal.iCalendar"); dojo.deprecated("dojo.icalendar", "use dojo.cal.iCalendar isntead", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io.js index 33099a2fd..4b226a2c0 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.io"); dojo.require("dojo.io.*"); dojo.deprecated("dojo.io", "replaced by dojo.io.*", "0.5"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/BrowserIO.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/BrowserIO.js index a38a20eb6..985996e7c 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/BrowserIO.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/BrowserIO.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.io.BrowserIO"); dojo.require("dojo.io.common"); dojo.require("dojo.lang.array"); @@ -202,7 +204,7 @@ if (!dj_undef("window")) { _cache = {}; }; function doLoad(kwArgs, http, url, query, useCache) { - if (((http.status >= 200) && (http.status < 300)) || (http.status == 304) || (location.protocol == "file:" && (http.status == 0 || http.status == undefined)) || (location.protocol == "chrome:" && (http.status == 0 || http.status == undefined))) { + if (((http.status >= 200) && (http.status < 300)) || (http.status == 304) || (http.status == 1223) || (location.protocol == "file:" && (http.status == 0 || http.status == undefined)) || (location.protocol == "chrome:" && (http.status == 0 || http.status == undefined))) { var ret; if (kwArgs.method.toLowerCase() == "head") { var headers = http.getAllResponseHeaders(); @@ -228,9 +230,9 @@ if (!dj_undef("window")) { ret = null; } } else { - if (kwArgs.mimetype == "text/json" || kwArgs.mimetype == "application/json") { + if (kwArgs.mimetype.substr(0, 9) == "text/json" || kwArgs.mimetype.substr(0, 16) == "application/json") { try { - ret = dj_eval("(" + http.responseText + ")"); + ret = dj_eval("(" + kwArgs.jsonFilter(http.responseText) + ")"); } catch (e) { dojo.debug(e); @@ -324,7 +326,8 @@ if (!dj_undef("window")) { }; var hasXmlHttp = dojo.hostenv.getXmlhttpObject() ? true : false; this.canHandle = function (kwArgs) { - return hasXmlHttp && dojo.lang.inArray(["text/plain", "text/html", "application/xml", "text/xml", "text/javascript", "text/json", "application/json"], (kwArgs["mimetype"].toLowerCase() || "")) && !(kwArgs["formNode"] && dojo.io.formHasFile(kwArgs["formNode"])); + var mlc = kwArgs["mimetype"].toLowerCase() || ""; + return hasXmlHttp && ((dojo.lang.inArray(["text/plain", "text/html", "application/xml", "text/xml", "text/javascript"], mlc)) || (mlc.substr(0, 9) == "text/json" || mlc.substr(0, 16) == "application/json")) && !(kwArgs["formNode"] && dojo.io.formHasFile(kwArgs["formNode"])); }; this.multipartBoundary = "45309FFF-BD65-4d50-99C9-36986896A96F"; this.bind = function (kwArgs) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/IframeIO.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/IframeIO.js index 13912fc67..b1b6e5288 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/IframeIO.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/IframeIO.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.io.IframeIO"); dojo.require("dojo.io.BrowserIO"); dojo.require("dojo.uri.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/RhinoIO.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/RhinoIO.js index d7bee88f7..9529e9670 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/RhinoIO.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/RhinoIO.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.io.RhinoIO"); dojo.require("dojo.io.common"); dojo.require("dojo.lang.func"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/ScriptSrcIO.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/ScriptSrcIO.js index 39097306d..55091c64b 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/ScriptSrcIO.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/ScriptSrcIO.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.io.ScriptSrcIO"); dojo.require("dojo.io.BrowserIO"); dojo.require("dojo.undo.browser"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/XhrIframeProxy.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/XhrIframeProxy.js index f867c42db..811cc4dcf 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/XhrIframeProxy.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/XhrIframeProxy.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.io.XhrIframeProxy"); dojo.require("dojo.experimental"); dojo.experimental("dojo.io.XhrIframeProxy"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/__package__.js index ac8d016fb..731980d7b 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/__package__.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/__package__.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.kwCompoundRequire({common:["dojo.io.common"], rhino:["dojo.io.RhinoIO"], browser:["dojo.io.BrowserIO", "dojo.io.cookie"], dashboard:["dojo.io.BrowserIO", "dojo.io.cookie"]}); dojo.provide("dojo.io.*"); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/cometd.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/cometd.js index 377a4988c..d40d7ada1 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/cometd.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/cometd.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.require("dojo.io.common"); dojo.provide("dojo.io.cometd"); dojo.require("dojo.AdapterRegistry"); @@ -507,7 +509,7 @@ cometd.callbackPollTransport = new function () { message.clientId = cometd.clientId; var bindArgs = {url:cometd.url || djConfig["cometdRoot"], mimetype:"text/json", transport:"ScriptSrcTransport", jsonParamName:"jsonp", content:{message:dojo.json.serialize([message])}, load:dojo.lang.hitch(this, function (type, data, evt, args) { cometd.deliver(data); - }), }; + })}; return dojo.io.bind(bindArgs); } else { this.backlog.push(message); diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/common.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/common.js index 5b370a86e..3923793e3 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/common.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/common.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.io.common"); dojo.require("dojo.string"); dojo.require("dojo.lang.extras"); @@ -29,7 +31,19 @@ dojo.io.Request = function (url, mimetype, transport, changeUrl) { } } }; -dojo.lang.extend(dojo.io.Request, {url:"", mimetype:"text/plain", method:"GET", content:undefined, transport:undefined, changeUrl:undefined, formNode:undefined, sync:false, bindSuccess:false, useCache:false, preventCache:false, load:function (type, data, transportImplementation, kwArgs) { +dojo.lang.extend(dojo.io.Request, {url:"", mimetype:"text/plain", method:"GET", content:undefined, transport:undefined, changeUrl:undefined, formNode:undefined, sync:false, bindSuccess:false, useCache:false, preventCache:false, jsonFilter:function (value) { + if ((this.mimetype == "text/json-comment-filtered") || (this.mimetype == "application/json-comment-filtered")) { + var cStartIdx = value.indexOf("/*"); + var cEndIdx = value.lastIndexOf("*/"); + if ((cStartIdx == -1) || (cEndIdx == -1)) { + dojo.debug("your JSON wasn't comment filtered!"); + return ""; + } + return value.substring(cStartIdx + 2, cEndIdx); + } + dojo.debug("please consider using a mimetype of text/json-comment-filtered to avoid potential security issues with JSON endpoints"); + return value; +}, load:function (type, data, transportImplementation, kwArgs) { }, error:function (type, error, transportImplementation, kwArgs) { }, timeout:function (type, empty, transportImplementation, kwArgs) { }, handle:function (type, data, transportImplementation, kwArgs) { diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/cookie.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/cookie.js index 350e15f42..91205f6ac 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/cookie.js +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/cookie.js @@ -8,6 +8,8 @@ http://dojotoolkit.org/community/licensing.shtml */ + + dojo.provide("dojo.io.cookie"); dojo.io.cookie.setCookie = function (name, value, days, path, domain, secure) { var expires = -1; diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/xip_client.html b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/xip_client.html index 5a1d77b02..1ed6ea4d5 100644 --- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/xip_client.html +++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/io/xip_client.html @@ -5,7 +5,8 @@ - - , - //which will be treated as an external javascript file in IE - var xscript = dojo.doc().createElement('script'); - xscript.src = "javascript:'dojo.html.createExternalElement=function(doc, tag){ return doc.createElement(tag); }'"; - dojo.doc().getElementsByTagName("head")[0].appendChild(xscript); - })(); - } -}else{ - //for other browsers, simply use document.createElement - //is enough - dojo.html.createExternalElement = function(/* HTMLDocument */doc, /* string */tag){ - // summary - // Creates an element in the HTML document, here for ActiveX activation workaround. - return doc.createElement(tag); // HTMLElement - } -} - -dojo.html._callDeprecated = function(inFunc, replFunc, args, argName, retValue){ - dojo.deprecated("dojo.html." + inFunc, - "replaced by dojo.html." + replFunc + "(" + (argName ? "node, {"+ argName + ": " + argName + "}" : "" ) + ")" + (retValue ? "." + retValue : ""), "0.5"); - var newArgs = []; - if(argName){ var argsIn = {}; argsIn[argName] = args[1]; newArgs.push(args[0]); newArgs.push(argsIn); } - else { newArgs = args } - var ret = dojo.html[replFunc].apply(dojo.html, args); - if(retValue){ return ret[retValue]; } - else { return ret; } -} - -dojo.html.getViewportWidth = function(){ - return dojo.html._callDeprecated("getViewportWidth", "getViewport", arguments, null, "width"); -} -dojo.html.getViewportHeight = function(){ - return dojo.html._callDeprecated("getViewportHeight", "getViewport", arguments, null, "height"); -} -dojo.html.getViewportSize = function(){ - return dojo.html._callDeprecated("getViewportSize", "getViewport", arguments); -} -dojo.html.getScrollTop = function(){ - return dojo.html._callDeprecated("getScrollTop", "getScroll", arguments, null, "top"); -} -dojo.html.getScrollLeft = function(){ - return dojo.html._callDeprecated("getScrollLeft", "getScroll", arguments, null, "left"); -} -dojo.html.getScrollOffset = function(){ - return dojo.html._callDeprecated("getScrollOffset", "getScroll", arguments, null, "offset"); -} - -dojo.provide("dojo.uri.Uri"); - -dojo.uri = new function() { - this.dojoUri = function (/*dojo.uri.Uri||String*/uri) { - // summary: returns a Uri object resolved relative to the dojo root - return new dojo.uri.Uri(dojo.hostenv.getBaseScriptUri(), uri); - } - - this.moduleUri = function(/*String*/module, /*dojo.uri.Uri||String*/uri){ - // summary: returns a Uri object relative to a module - // description: Examples: dojo.uri.moduleUri("dojo.widget","templates/template.html"), or dojo.uri.moduleUri("acme","images/small.png") - var loc = dojo.hostenv.getModuleSymbols(module).join('/'); - if(!loc){ - return null; - } - if(loc.lastIndexOf("/") != loc.length-1){ - loc += "/"; - } - - //If the path is an absolute path (starts with a / or is on another domain/xdomain) - //then don't add the baseScriptUri. - var colonIndex = loc.indexOf(":"); - var slashIndex = loc.indexOf("/"); - if(loc.charAt(0) != "/" && (colonIndex == -1 || colonIndex > slashIndex)){ - loc = dojo.hostenv.getBaseScriptUri() + loc; - } - - return new dojo.uri.Uri(loc,uri); - } - - this.Uri = function (/*dojo.uri.Uri||String...*/) { - // summary: Constructor to create an object representing a URI. - // description: - // Each argument is evaluated in order relative to the next until - // a canonical uri is produced. To get an absolute Uri relative - // to the current document use - // new dojo.uri.Uri(document.baseURI, uri) - - // TODO: support for IPv6, see RFC 2732 - - // resolve uri components relative to each other - var uri = arguments[0]; - for (var i = 1; i < arguments.length; i++) { - if(!arguments[i]) { continue; } - - // Safari doesn't support this.constructor so we have to be explicit - var relobj = new dojo.uri.Uri(arguments[i].toString()); - var uriobj = new dojo.uri.Uri(uri.toString()); - - if ((relobj.path=="")&&(relobj.scheme==null)&&(relobj.authority==null)&&(relobj.query==null)) { - if (relobj.fragment != null) { uriobj.fragment = relobj.fragment; } - relobj = uriobj; - } else if (relobj.scheme == null) { - relobj.scheme = uriobj.scheme; - - if (relobj.authority == null) { - relobj.authority = uriobj.authority; - - if (relobj.path.charAt(0) != "/") { - var path = uriobj.path.substring(0, - uriobj.path.lastIndexOf("/") + 1) + relobj.path; - - var segs = path.split("/"); - for (var j = 0; j < segs.length; j++) { - if (segs[j] == ".") { - if (j == segs.length - 1) { segs[j] = ""; } - else { segs.splice(j, 1); j--; } - } else if (j > 0 && !(j == 1 && segs[0] == "") && - segs[j] == ".." && segs[j-1] != "..") { - - if (j == segs.length - 1) { segs.splice(j, 1); segs[j - 1] = ""; } - else { segs.splice(j - 1, 2); j -= 2; } - } - } - relobj.path = segs.join("/"); - } - } - } - - uri = ""; - if (relobj.scheme != null) { uri += relobj.scheme + ":"; } - if (relobj.authority != null) { uri += "//" + relobj.authority; } - uri += relobj.path; - if (relobj.query != null) { uri += "?" + relobj.query; } - if (relobj.fragment != null) { uri += "#" + relobj.fragment; } - } - - this.uri = uri.toString(); - - // break the uri into its main components - var regexp = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"; - var r = this.uri.match(new RegExp(regexp)); - - this.scheme = r[2] || (r[1] ? "" : null); - this.authority = r[4] || (r[3] ? "" : null); - this.path = r[5]; // can never be undefined - this.query = r[7] || (r[6] ? "" : null); - this.fragment = r[9] || (r[8] ? "" : null); - - if (this.authority != null) { - // server based naming authority - regexp = "^((([^:]+:)?([^@]+))@)?([^:]*)(:([0-9]+))?$"; - r = this.authority.match(new RegExp(regexp)); - - this.user = r[3] || null; - this.password = r[4] || null; - this.host = r[5]; - this.port = r[7] || null; - } - - this.toString = function(){ return this.uri; } - } -}; - -dojo.provide("dojo.html.style"); - - - -dojo.html.getClass = function(/* HTMLElement */node){ - // summary - // Returns the string value of the list of CSS classes currently assigned directly - // to the node in question. Returns an empty string if no class attribute is found; - node = dojo.byId(node); - if(!node){ return ""; } - var cs = ""; - if(node.className){ - cs = node.className; - }else if(dojo.html.hasAttribute(node, "class")){ - cs = dojo.html.getAttribute(node, "class"); - } - return cs.replace(/^\s+|\s+$/g, ""); // string -} - -dojo.html.getClasses = function(/* HTMLElement */node) { - // summary - // Returns an array of CSS classes currently assigned directly to the node in question. - // Returns an empty array if no classes are found; - var c = dojo.html.getClass(node); - return (c == "") ? [] : c.split(/\s+/g); // array -} - -dojo.html.hasClass = function(/* HTMLElement */node, /* string */classname){ - // summary - // Returns whether or not the specified classname is a portion of the - // class list currently applied to the node. Does not cover cascaded - // styles, only classes directly applied to the node. - return (new RegExp('(^|\\s+)'+classname+'(\\s+|$)')).test(dojo.html.getClass(node)) // boolean -} - -dojo.html.prependClass = function(/* HTMLElement */node, /* string */classStr){ - // summary - // Adds the specified class to the beginning of the class list on the - // passed node. This gives the specified class the highest precidence - // when style cascading is calculated for the node. Returns true or - // false; indicating success or failure of the operation, respectively. - classStr += " " + dojo.html.getClass(node); - return dojo.html.setClass(node, classStr); // boolean -} - -dojo.html.addClass = function(/* HTMLElement */node, /* string */classStr){ - // summary - // Adds the specified class to the end of the class list on the - // passed &node;. Returns &true; or &false; indicating success or failure. - if (dojo.html.hasClass(node, classStr)) { - return false; - } - classStr = (dojo.html.getClass(node) + " " + classStr).replace(/^\s+|\s+$/g,""); - return dojo.html.setClass(node, classStr); // boolean -} - -dojo.html.setClass = function(/* HTMLElement */node, /* string */classStr){ - // summary - // Clobbers the existing list of classes for the node, replacing it with - // the list given in the 2nd argument. Returns true or false - // indicating success or failure. - node = dojo.byId(node); - var cs = new String(classStr); - try{ - if(typeof node.className == "string"){ - node.className = cs; - }else if(node.setAttribute){ - node.setAttribute("class", classStr); - node.className = cs; - }else{ - return false; - } - }catch(e){ - dojo.debug("dojo.html.setClass() failed", e); - } - return true; -} - -dojo.html.removeClass = function(/* HTMLElement */node, /* string */classStr, /* boolean? */allowPartialMatches){ - // summary - // Removes the className from the node;. Returns true or false indicating success or failure. - try{ - if (!allowPartialMatches) { - var newcs = dojo.html.getClass(node).replace(new RegExp('(^|\\s+)'+classStr+'(\\s+|$)'), "$1$2"); - } else { - var newcs = dojo.html.getClass(node).replace(classStr,''); - } - dojo.html.setClass(node, newcs); - }catch(e){ - dojo.debug("dojo.html.removeClass() failed", e); - } - return true; // boolean -} - -dojo.html.replaceClass = function(/* HTMLElement */node, /* string */newClass, /* string */oldClass) { - // summary - // Replaces 'oldClass' and adds 'newClass' to node - dojo.html.removeClass(node, oldClass); - dojo.html.addClass(node, newClass); -} - -// Enum type for getElementsByClass classMatchType arg: -dojo.html.classMatchType = { - ContainsAll : 0, // all of the classes are part of the node's class (default) - ContainsAny : 1, // any of the classes are part of the node's class - IsOnly : 2 // only all of the classes are part of the node's class -} - - -dojo.html.getElementsByClass = function( - /* string */classStr, - /* HTMLElement? */parent, - /* string? */nodeType, - /* integer? */classMatchType, - /* boolean? */useNonXpath -){ - // summary - // Returns an array of nodes for the given classStr, children of a - // parent, and optionally of a certain nodeType - // FIXME: temporarily set to false because of several dojo tickets related - // to the xpath version not working consistently in firefox. - useNonXpath = false; - var _document = dojo.doc(); - parent = dojo.byId(parent) || _document; - var classes = classStr.split(/\s+/g); - var nodes = []; - if( classMatchType != 1 && classMatchType != 2 ) classMatchType = 0; // make it enum - var reClass = new RegExp("(\\s|^)((" + classes.join(")|(") + "))(\\s|$)"); - var srtLength = classes.join(" ").length; - var candidateNodes = []; - - if(!useNonXpath && _document.evaluate) { // supports dom 3 xpath - var xpath = ".//" + (nodeType || "*") + "[contains("; - if(classMatchType != dojo.html.classMatchType.ContainsAny){ - xpath += "concat(' ',@class,' '), ' " + - classes.join(" ') and contains(concat(' ',@class,' '), ' ") + - " ')"; - if (classMatchType == 2) { - xpath += " and string-length(@class)="+srtLength+"]"; - }else{ - xpath += "]"; - } - }else{ - xpath += "concat(' ',@class,' '), ' " + - classes.join(" ') or contains(concat(' ',@class,' '), ' ") + - " ')]"; - } - var xpathResult = _document.evaluate(xpath, parent, null, XPathResult.ANY_TYPE, null); - var result = xpathResult.iterateNext(); - while(result){ - try{ - candidateNodes.push(result); - result = xpathResult.iterateNext(); - }catch(e){ break; } - } - return candidateNodes; // NodeList - }else{ - if(!nodeType){ - nodeType = "*"; - } - candidateNodes = parent.getElementsByTagName(nodeType); - - var node, i = 0; - outer: - while(node = candidateNodes[i++]){ - var nodeClasses = dojo.html.getClasses(node); - if(nodeClasses.length == 0){ continue outer; } - var matches = 0; - - for(var j = 0; j < nodeClasses.length; j++){ - if(reClass.test(nodeClasses[j])){ - if(classMatchType == dojo.html.classMatchType.ContainsAny){ - nodes.push(node); - continue outer; - }else{ - matches++; - } - }else{ - if(classMatchType == dojo.html.classMatchType.IsOnly){ - continue outer; - } - } - } - - if(matches == classes.length){ - if( (classMatchType == dojo.html.classMatchType.IsOnly)&& - (matches == nodeClasses.length)){ - nodes.push(node); - }else if(classMatchType == dojo.html.classMatchType.ContainsAll){ - nodes.push(node); - } - } - } - return nodes; // NodeList - } -} -dojo.html.getElementsByClassName = dojo.html.getElementsByClass; - -dojo.html.toCamelCase = function(/* string */selector){ - // summary - // Translates a CSS selector string to a camel-cased one. - var arr = selector.split('-'), cc = arr[0]; - for(var i = 1; i < arr.length; i++) { - cc += arr[i].charAt(0).toUpperCase() + arr[i].substring(1); - } - return cc; // string -} - -dojo.html.toSelectorCase = function(/* string */selector){ - // summary - // Translates a camel cased string to a selector cased one. - return selector.replace(/([A-Z])/g, "-$1" ).toLowerCase(); // string -} - -if (dojo.render.html.ie) { - // IE branch - dojo.html.getComputedStyle = function(/*HTMLElement|String*/node, /*String*/property, /*String*/value) { - // summary - // Get the computed style value for style "property" on "node" (IE). - node = dojo.byId(node); // FIXME: remove ability to access nodes by id for this time-critical function - if(!node || !node.style){return value;} - // FIXME: standardize on camel-case input to improve speed - return node.currentStyle[dojo.html.toCamelCase(property)]; // String - } - // SJM: getComputedStyle should be abandoned and replaced with the below function. - // All our supported browsers can return CSS2 compliant CssStyleDeclaration objects - // which can be queried directly for multiple styles. - dojo.html.getComputedStyles = function(/*HTMLElement*/node) { - // summary - // Get a style object containing computed styles for HTML Element node (IE). - return node.currentStyle; // CSSStyleDeclaration - } -} else { - // non-IE branch - dojo.html.getComputedStyle = function(/*HTMLElement|String*/node, /*String*/property, /*Any*/value) { - // summary - // Get the computed style value for style "property" on "node" (non-IE). - node = dojo.byId(node); - if(!node || !node.style){return value;} - var s = document.defaultView.getComputedStyle(node, null); - // s may be null on Safari - return (s&&s[dojo.html.toCamelCase(property)])||''; // String - } - // SJM: getComputedStyle should be abandoned and replaced with the below function. - // All our supported browsers can return CSS2 compliant CssStyleDeclaration objects - // which can be queried directly for multiple styles. - dojo.html.getComputedStyles = function(node) { - // summary - // Get a style object containing computed styles for HTML Element node (non-IE). - return document.defaultView.getComputedStyle(node, null); // CSSStyleDeclaration - } -} - -dojo.html.getStyleProperty = function(/* HTMLElement */node, /* string */cssSelector){ - // summary - // Returns the value of the passed style - node = dojo.byId(node); - return (node && node.style ? node.style[dojo.html.toCamelCase(cssSelector)] : undefined); // string -} - -dojo.html.getStyle = function(/* HTMLElement */node, /* string */cssSelector){ - // summary - // Returns the computed value of the passed style - var value = dojo.html.getStyleProperty(node, cssSelector); - return (value ? value : dojo.html.getComputedStyle(node, cssSelector)); // string || integer -} - -dojo.html.setStyle = function(/* HTMLElement */node, /* string */cssSelector, /* string */value){ - // summary - // Set the value of passed style on node - node = dojo.byId(node); - if(node && node.style){ - var camelCased = dojo.html.toCamelCase(cssSelector); - node.style[camelCased] = value; - } -} - -dojo.html.setStyleText = function (/* HTMLElement */target, /* string */text) { - // summary - // Try to set the entire cssText property of the passed target; equiv of setting style attribute. - try { - target.style.cssText = text; - } catch (e) { - target.setAttribute("style", text); - } -} - -dojo.html.copyStyle = function(/* HTMLElement */target, /* HTMLElement */source){ - // summary - // work around for opera which doesn't have cssText, and for IE which fails on setAttribute - if(!source.style.cssText){ - target.setAttribute("style", source.getAttribute("style")); - }else{ - target.style.cssText = source.style.cssText; - } - dojo.html.addClass(target, dojo.html.getClass(source)); -} - -dojo.html.getUnitValue = function(/* HTMLElement */node, /* string */cssSelector, /* boolean? */autoIsZero){ - // summary - // Get the value of passed selector, with the specific units used - var s = dojo.html.getComputedStyle(node, cssSelector); - if((!s)||((s == 'auto')&&(autoIsZero))){ - return { value: 0, units: 'px' }; // object - } - // FIXME: is regex inefficient vs. parseInt or some manual test? - var match = s.match(/(\-?[\d.]+)([a-z%]*)/i); - if (!match){return dojo.html.getUnitValue.bad;} - return { value: Number(match[1]), units: match[2].toLowerCase() }; // object -} -dojo.html.getUnitValue.bad = { value: NaN, units: '' }; - -if (dojo.render.html.ie) { - // IE branch - dojo.html.toPixelValue = function(/* HTMLElement */element, /* String */styleValue){ - // summary - // Extract value in pixels from styleValue (IE version). - // If a value cannot be extracted, zero is returned. - if(!styleValue){return 0;} - if(styleValue.slice(-2) == 'px'){return parseFloat(styleValue);} - var pixelValue = 0; - with(element){ - var sLeft = style.left; - var rsLeft = runtimeStyle.left; - runtimeStyle.left = currentStyle.left; - try { - style.left = styleValue || 0; - pixelValue = style.pixelLeft; - style.left = sLeft; - runtimeStyle.left = rsLeft; - }catch(e){ - // FIXME: it's possible for styleValue to be incompatible with - // style.left. In particular, border width values of - // "thick", "medium", or "thin" will provoke an exception. - } - } - return pixelValue; // Number - } -} else { - // non-IE branch - dojo.html.toPixelValue = function(/* HTMLElement */element, /* String */styleValue){ - // summary - // Extract value in pixels from styleValue (non-IE version). - // If a value cannot be extracted, zero is returned. - return (styleValue && (styleValue.slice(-2)=='px') ? parseFloat(styleValue) : 0); // Number - } -} - -dojo.html.getPixelValue = function(/* HTMLElement */node, /* string */styleProperty, /* boolean? */autoIsZero){ - // summary - // Get a computed style value, in pixels. - // node: HTMLElement - // Node to interrogate - // styleProperty: String - // Style property to query, in either css-selector or camelCase (property) format. - // autoIsZero: Boolean - // Deprecated. Any value that cannot be converted to pixels is returned as zero. - // - // summary - // Get the value of passed selector in pixels. - // - return dojo.html.toPixelValue(node, dojo.html.getComputedStyle(node, styleProperty)); -} - -dojo.html.setPositivePixelValue = function(/* HTMLElement */node, /* string */selector, /* integer */value){ - // summary - // Attempt to set the value of selector on node as a positive pixel value. - if(isNaN(value)){return false;} - node.style[selector] = Math.max(0, value) + 'px'; - return true; // boolean -} - -dojo.html.styleSheet = null; - -// FIXME: this is a really basic stub for adding and removing cssRules, but -// it assumes that you know the index of the cssRule that you want to add -// or remove, making it less than useful. So we need something that can -// search for the selector that you you want to remove. -dojo.html.insertCssRule = function(/* string */selector, /* string */declaration, /* integer? */index) { - // summary - // Attempt to insert declaration as selector on the internal stylesheet; if index try to set it there. - if (!dojo.html.styleSheet) { - if (document.createStyleSheet) { // IE - dojo.html.styleSheet = document.createStyleSheet(); - } else if (document.styleSheets[0]) { // rest - // FIXME: should create a new style sheet here - // fall back on an exsiting style sheet - dojo.html.styleSheet = document.styleSheets[0]; - } else { - return null; // integer - } // fail - } - - if (arguments.length < 3) { // index may == 0 - if (dojo.html.styleSheet.cssRules) { // W3 - index = dojo.html.styleSheet.cssRules.length; - } else if (dojo.html.styleSheet.rules) { // IE - index = dojo.html.styleSheet.rules.length; - } else { - return null; // integer - } // fail - } - - if (dojo.html.styleSheet.insertRule) { // W3 - var rule = selector + " { " + declaration + " }"; - return dojo.html.styleSheet.insertRule(rule, index); // integer - } else if (dojo.html.styleSheet.addRule) { // IE - return dojo.html.styleSheet.addRule(selector, declaration, index); // integer - } else { - return null; // integer - } // fail -} - -dojo.html.removeCssRule = function(/* integer? */index){ - // summary - // Attempt to remove the rule at index. - if(!dojo.html.styleSheet){ - dojo.debug("no stylesheet defined for removing rules"); - return false; - } - if(dojo.render.html.ie){ - if(!index){ - index = dojo.html.styleSheet.rules.length; - dojo.html.styleSheet.removeRule(index); - } - }else if(document.styleSheets[0]){ - if(!index){ - index = dojo.html.styleSheet.cssRules.length; - } - dojo.html.styleSheet.deleteRule(index); - } - return true; // boolean -} - -dojo.html._insertedCssFiles = []; // cache container needed because IE reformats cssText when added to DOM -dojo.html.insertCssFile = function(/* string */URI, /* HTMLDocument? */doc, /* boolean? */checkDuplicates, /* boolean */fail_ok){ - // summary - // calls css by XmlHTTP and inserts it into DOM as - if(!URI){ return; } - if(!doc){ doc = document; } - var cssStr = dojo.hostenv.getText(URI, false, fail_ok); - if(cssStr===null){ return; } - cssStr = dojo.html.fixPathsInCssText(cssStr, URI); - - if(checkDuplicates){ - var idx = -1, node, ent = dojo.html._insertedCssFiles; - for(var i = 0; i < ent.length; i++){ - if((ent[i].doc == doc) && (ent[i].cssText == cssStr)){ - idx = i; node = ent[i].nodeRef; - break; - } - } - // make sure we havent deleted our node - if(node){ - var styles = doc.getElementsByTagName("style"); - for(var i = 0; i < styles.length; i++){ - if(styles[i] == node){ - return; - } - } - // delete this entry - dojo.html._insertedCssFiles.shift(idx, 1); - } - } - - var style = dojo.html.insertCssText(cssStr, doc); - dojo.html._insertedCssFiles.push({'doc': doc, 'cssText': cssStr, 'nodeRef': style}); - - // insert custom attribute ex dbgHref="../foo.css" usefull when debugging in DOM inspectors, no? - if(style && djConfig.isDebug){ - style.setAttribute("dbgHref", URI); - } - return style; // HTMLStyleElement -} - -dojo.html.insertCssText = function(/* string */cssStr, /* HTMLDocument? */doc, /* string? */URI){ - // summary - // Attempt to insert CSS rules into the document through inserting a style element - // DomNode Style = insertCssText(String ".dojoMenu {color: green;}"[, DomDoc document, dojo.uri.Uri Url ]) - if(!cssStr){ - return; // HTMLStyleElement - } - if(!doc){ doc = document; } - if(URI){// fix paths in cssStr - cssStr = dojo.html.fixPathsInCssText(cssStr, URI); - } - var style = doc.createElement("style"); - style.setAttribute("type", "text/css"); - // IE is b0rken enough to require that we add the element to the doc - // before changing it's properties - var head = doc.getElementsByTagName("head")[0]; - if(!head){ // must have a head tag - dojo.debug("No head tag in document, aborting styles"); - return; // HTMLStyleElement - }else{ - head.appendChild(style); - } - if(style.styleSheet){// IE - var setFunc = function(){ - try{ - style.styleSheet.cssText = cssStr; - }catch(e){ dojo.debug(e); } - }; - if(style.styleSheet.disabled){ - setTimeout(setFunc, 10); - }else{ - setFunc(); - } - }else{ // w3c - var cssText = doc.createTextNode(cssStr); - style.appendChild(cssText); - } - return style; // HTMLStyleElement -} - -dojo.html.fixPathsInCssText = function(/* string */cssStr, /* string */URI){ - // summary - // usage: cssText comes from dojoroot/src/widget/templates/Foobar.css - // it has .dojoFoo { background-image: url(images/bar.png);} then uri should point to dojoroot/src/widget/templates/ - if(!cssStr || !URI){ return; } - var match, str = "", url = "", urlChrs = "[\\t\\s\\w\\(\\)\\/\\.\\\\'\"-:#=&?~]+"; - var regex = new RegExp('url\\(\\s*('+urlChrs+')\\s*\\)'); - var regexProtocol = /(file|https?|ftps?):\/\//; - regexTrim = new RegExp("^[\\s]*(['\"]?)("+urlChrs+")\\1[\\s]*?$"); - if(dojo.render.html.ie55 || dojo.render.html.ie60){ - var regexIe = new RegExp("AlphaImageLoader\\((.*)src\=['\"]("+urlChrs+")['\"]"); - // TODO: need to decide how to handle relative paths and AlphaImageLoader see #1441 - // current implementation breaks on build with intern_strings - while(match = regexIe.exec(cssStr)){ - url = match[2].replace(regexTrim, "$2"); - if(!regexProtocol.exec(url)){ - url = (new dojo.uri.Uri(URI, url).toString()); - } - str += cssStr.substring(0, match.index) + "AlphaImageLoader(" + match[1] + "src='" + url + "'"; - cssStr = cssStr.substr(match.index + match[0].length); - } - cssStr = str + cssStr; - str = ""; - } - - while(match = regex.exec(cssStr)){ - url = match[1].replace(regexTrim, "$2"); - if(!regexProtocol.exec(url)){ - url = (new dojo.uri.Uri(URI, url).toString()); - } - str += cssStr.substring(0, match.index) + "url(" + url + ")"; - cssStr = cssStr.substr(match.index + match[0].length); - } - return str + cssStr; // string -} - -dojo.html.setActiveStyleSheet = function(/* string */title){ - // summary - // Activate style sheet with specified title. - var i = 0, a, els = dojo.doc().getElementsByTagName("link"); - while (a = els[i++]) { - if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")){ - a.disabled = true; - if (a.getAttribute("title") == title) { a.disabled = false; } - } - } -} - -dojo.html.getActiveStyleSheet = function(){ - // summary - // return the title of the currently active stylesheet - var i = 0, a, els = dojo.doc().getElementsByTagName("link"); - while (a = els[i++]) { - if (a.getAttribute("rel").indexOf("style") != -1 - && a.getAttribute("title") - && !a.disabled - ){ - return a.getAttribute("title"); // string - } - } - return null; // string -} - -dojo.html.getPreferredStyleSheet = function(){ - // summary - // Return the preferred stylesheet title (i.e. link without alt attribute) - var i = 0, a, els = dojo.doc().getElementsByTagName("link"); - while (a = els[i++]) { - if(a.getAttribute("rel").indexOf("style") != -1 - && a.getAttribute("rel").indexOf("alt") == -1 - && a.getAttribute("title") - ){ - return a.getAttribute("title"); // string - } - } - return null; // string -} - -dojo.html.applyBrowserClass = function(/* HTMLElement */node){ - // summary - // Applies pre-set class names based on browser & version to the passed node. - // Modified version of Morris' CSS hack. - var drh=dojo.render.html; - var classes = { - dj_ie: drh.ie, - dj_ie55: drh.ie55, - dj_ie6: drh.ie60, - dj_ie7: drh.ie70, - dj_iequirks: drh.ie && drh.quirks, - dj_opera: drh.opera, - dj_opera8: drh.opera && (Math.floor(dojo.render.version)==8), - dj_opera9: drh.opera && (Math.floor(dojo.render.version)==9), - dj_khtml: drh.khtml, - dj_safari: drh.safari, - dj_gecko: drh.mozilla - }; // no dojo unsupported browsers - for(var p in classes){ - if(classes[p]){ - dojo.html.addClass(node, p); - } - } -}; - -dojo.provide("dojo.html.display"); - - -dojo.html._toggle = function(node, tester, setter){ - node = dojo.byId(node); - setter(node, !tester(node)); - return tester(node); -} - -dojo.html.show = function(/* HTMLElement */node){ - // summary - // Show the passed element by reverting display property set by dojo.html.hide - node = dojo.byId(node); - if(dojo.html.getStyleProperty(node, 'display')=='none'){ - dojo.html.setStyle(node, 'display', (node.dojoDisplayCache||'')); - node.dojoDisplayCache = undefined; // cannot use delete on a node in IE6 - } -} - -dojo.html.hide = function(/* HTMLElement */node){ - // summary - // Hide the passed element by setting display:none - node = dojo.byId(node); - if(typeof node["dojoDisplayCache"] == "undefined"){ // it could == '', so we cannot say !node.dojoDisplayCount - var d = dojo.html.getStyleProperty(node, 'display') - if(d!='none'){ - node.dojoDisplayCache = d; - } - } - dojo.html.setStyle(node, 'display', 'none'); -} - -dojo.html.setShowing = function(/* HTMLElement */node, /* boolean? */showing){ - // summary - // Calls show() if showing is true, hide() otherwise - dojo.html[(showing ? 'show' : 'hide')](node); -} - -dojo.html.isShowing = function(/* HTMLElement */node){ - // summary - // Returns whether the element is displayed or not. - // FIXME: returns true if node is bad, isHidden would be easier to make correct - return (dojo.html.getStyleProperty(node, 'display') != 'none'); // boolean -} - -dojo.html.toggleShowing = function(/* HTMLElement */node){ - // summary - // Call setShowing() on node with the complement of isShowing(), then return the new value of isShowing() - return dojo.html._toggle(node, dojo.html.isShowing, dojo.html.setShowing); // boolean -} - -// Simple mapping of tag names to display values -// FIXME: simplistic -dojo.html.displayMap = { tr: '', td: '', th: '', img: 'inline', span: 'inline', input: 'inline', button: 'inline' }; - -dojo.html.suggestDisplayByTagName = function(/* HTMLElement */node){ - // summary - // Suggest a value for the display property that will show 'node' based on it's tag - node = dojo.byId(node); - if(node && node.tagName){ - var tag = node.tagName.toLowerCase(); - return (tag in dojo.html.displayMap ? dojo.html.displayMap[tag] : 'block'); // string - } -} - -dojo.html.setDisplay = function(/* HTMLElement */node, /* string */display){ - // summary - // Sets the value of style.display to value of 'display' parameter if it is a string. - // Otherwise, if 'display' is false, set style.display to 'none'. - // Finally, set 'display' to a suggested display value based on the node's tag - dojo.html.setStyle(node, 'display', ((display instanceof String || typeof display == "string") ? display : (display ? dojo.html.suggestDisplayByTagName(node) : 'none'))); -} - -dojo.html.isDisplayed = function(/* HTMLElement */node){ - // summary - // Is true if the the computed display style for node is not 'none' - // FIXME: returns true if node is bad, isNotDisplayed would be easier to make correct - return (dojo.html.getComputedStyle(node, 'display') != 'none'); // boolean -} - -dojo.html.toggleDisplay = function(/* HTMLElement */node){ - // summary - // Call setDisplay() on node with the complement of isDisplayed(), then - // return the new value of isDisplayed() - return dojo.html._toggle(node, dojo.html.isDisplayed, dojo.html.setDisplay); // boolean -} - -dojo.html.setVisibility = function(/* HTMLElement */node, /* string */visibility){ - // summary - // Sets the value of style.visibility to value of 'visibility' parameter if it is a string. - // Otherwise, if 'visibility' is false, set style.visibility to 'hidden'. Finally, set style.visibility to 'visible'. - dojo.html.setStyle(node, 'visibility', ((visibility instanceof String || typeof visibility == "string") ? visibility : (visibility ? 'visible' : 'hidden'))); -} - -dojo.html.isVisible = function(/* HTMLElement */node){ - // summary - // Returns true if the the computed visibility style for node is not 'hidden' - // FIXME: returns true if node is bad, isInvisible would be easier to make correct - return (dojo.html.getComputedStyle(node, 'visibility') != 'hidden'); // boolean -} - -dojo.html.toggleVisibility = function(node){ - // summary - // Call setVisibility() on node with the complement of isVisible(), then return the new value of isVisible() - return dojo.html._toggle(node, dojo.html.isVisible, dojo.html.setVisibility); // boolean -} - -dojo.html.setOpacity = function(/* HTMLElement */node, /* float */opacity, /* boolean? */dontFixOpacity){ - // summary - // Sets the opacity of node in a cross-browser way. - // float between 0.0 (transparent) and 1.0 (opaque) - node = dojo.byId(node); - var h = dojo.render.html; - if(!dontFixOpacity){ - if( opacity >= 1.0){ - if(h.ie){ - dojo.html.clearOpacity(node); - return; - }else{ - opacity = 0.999999; - } - }else if( opacity < 0.0){ opacity = 0; } - } - if(h.ie){ - if(node.nodeName.toLowerCase() == "tr"){ - // FIXME: is this too naive? will we get more than we want? - var tds = node.getElementsByTagName("td"); - for(var x=0; x= 0.999999 ? 1.0 : Number(opac); // float -} - - -dojo.provide("dojo.html.color"); - - - - -dojo.html.getBackgroundColor = function(/* HTMLElement */node){ - // summary - // returns the background color of the passed node as a 32-bit color (RGBA) - node = dojo.byId(node); - var color; - do{ - color = dojo.html.getStyle(node, "background-color"); - // Safari doesn't say "transparent" - if(color.toLowerCase() == "rgba(0, 0, 0, 0)") { color = "transparent"; } - if(node == document.getElementsByTagName("body")[0]) { node = null; break; } - node = node.parentNode; - }while(node && dojo.lang.inArray(["transparent", ""], color)); - if(color == "transparent"){ - color = [255, 255, 255, 0]; - }else{ - color = dojo.gfx.color.extractRGB(color); - } - return color; // array -} - -dojo.provide("dojo.html.layout"); - - - - - -dojo.html.sumAncestorProperties = function(/* HTMLElement */node, /* string */prop){ - // summary - // Returns the sum of the passed property on all ancestors of node. - node = dojo.byId(node); - if(!node){ return 0; } // FIXME: throw an error? - - var retVal = 0; - while(node){ - if(dojo.html.getComputedStyle(node, 'position') == 'fixed'){ - return 0; - } - var val = node[prop]; - if(val){ - retVal += val - 0; - if(node==dojo.body()){ break; }// opera and khtml #body & #html has the same values, we only need one value - } - node = node.parentNode; - } - return retVal; // integer -} - -dojo.html.setStyleAttributes = function(/* HTMLElement */node, /* string */attributes) { - // summary - // allows a dev to pass a string similar to what you'd pass in style="", and apply it to a node. - node = dojo.byId(node); - var splittedAttribs=attributes.replace(/(;)?\s*$/, "").split(";"); - for(var i=0; i0){ - ret.x += isNaN(n) ? 0 : n; - } - var m = curnode["offsetTop"]; - ret.y += isNaN(m) ? 0 : m; - curnode = curnode.offsetParent; - }while((curnode != endNode)&&(curnode != null)); - }else if(node["x"]&&node["y"]){ - ret.x += isNaN(node.x) ? 0 : node.x; - ret.y += isNaN(node.y) ? 0 : node.y; - } - } - - // account for document scrolling! - if(includeScroll){ - var scroll = dojo.html.getScroll(); - ret.y += scroll.top; - ret.x += scroll.left; - } - - var extentFuncArray=[dojo.html.getPaddingExtent, dojo.html.getBorderExtent, dojo.html.getMarginExtent]; - if(nativeBoxType > targetBoxType){ - for(var i=targetBoxType;inativeBoxType;--i){ - ret.y -= extentFuncArray[i-1](node, 'top'); - ret.x -= extentFuncArray[i-1](node, 'left'); - } - } - ret.top = ret.y; - ret.left = ret.x; - return ret; // object -} - -dojo.html.isPositionAbsolute = function(/* HTMLElement */node){ - // summary - // Returns true if the element is absolutely positioned. - return (dojo.html.getComputedStyle(node, 'position') == 'absolute'); // boolean -} - -dojo.html._sumPixelValues = function(/* HTMLElement */node, selectors, autoIsZero){ - var total = 0; - for(var x=0; x 4 ) { coords.pop(); } - var ret = { - left: coords[0], - top: coords[1], - width: coords[2], - height: coords[3] - }; - }else if(!coords.nodeType && !(coords instanceof String || typeof coords == "string") && - ('width' in coords || 'height' in coords || 'left' in coords || - 'x' in coords || 'top' in coords || 'y' in coords)){ - // coords is a coordinate object or at least part of one - var ret = { - left: coords.left||coords.x||0, - top: coords.top||coords.y||0, - width: coords.width||0, - height: coords.height||0 - }; - }else{ - // coords is an dom object (or dom object id); return it's coordinates - var node = dojo.byId(coords); - var pos = dojo.html.abs(node, includeScroll, boxtype); - var marginbox = dojo.html.getMarginBox(node); - var ret = { - left: pos.left, - top: pos.top, - width: marginbox.width, - height: marginbox.height - }; - } - ret.x = ret.left; - ret.y = ret.top; - return ret; // object -} - -dojo.html.setMarginBoxWidth = dojo.html.setOuterWidth = function(node, width){ - return dojo.html._callDeprecated("setMarginBoxWidth", "setMarginBox", arguments, "width"); -} -dojo.html.setMarginBoxHeight = dojo.html.setOuterHeight = function(){ - return dojo.html._callDeprecated("setMarginBoxHeight", "setMarginBox", arguments, "height"); -} -dojo.html.getMarginBoxWidth = dojo.html.getOuterWidth = function(){ - return dojo.html._callDeprecated("getMarginBoxWidth", "getMarginBox", arguments, null, "width"); -} -dojo.html.getMarginBoxHeight = dojo.html.getOuterHeight = function(){ - return dojo.html._callDeprecated("getMarginBoxHeight", "getMarginBox", arguments, null, "height"); -} -dojo.html.getTotalOffset = function(node, type, includeScroll){ - return dojo.html._callDeprecated("getTotalOffset", "getAbsolutePosition", arguments, null, type); -} -dojo.html.getAbsoluteX = function(node, includeScroll){ - return dojo.html._callDeprecated("getAbsoluteX", "getAbsolutePosition", arguments, null, "x"); -} -dojo.html.getAbsoluteY = function(node, includeScroll){ - return dojo.html._callDeprecated("getAbsoluteY", "getAbsolutePosition", arguments, null, "y"); -} -dojo.html.totalOffsetLeft = function(node, includeScroll){ - return dojo.html._callDeprecated("totalOffsetLeft", "getAbsolutePosition", arguments, null, "left"); -} -dojo.html.totalOffsetTop = function(node, includeScroll){ - return dojo.html._callDeprecated("totalOffsetTop", "getAbsolutePosition", arguments, null, "top"); -} -dojo.html.getMarginWidth = function(node){ - return dojo.html._callDeprecated("getMarginWidth", "getMargin", arguments, null, "width"); -} -dojo.html.getMarginHeight = function(node){ - return dojo.html._callDeprecated("getMarginHeight", "getMargin", arguments, null, "height"); -} -dojo.html.getBorderWidth = function(node){ - return dojo.html._callDeprecated("getBorderWidth", "getBorder", arguments, null, "width"); -} -dojo.html.getBorderHeight = function(node){ - return dojo.html._callDeprecated("getBorderHeight", "getBorder", arguments, null, "height"); -} -dojo.html.getPaddingWidth = function(node){ - return dojo.html._callDeprecated("getPaddingWidth", "getPadding", arguments, null, "width"); -} -dojo.html.getPaddingHeight = function(node){ - return dojo.html._callDeprecated("getPaddingHeight", "getPadding", arguments, null, "height"); -} -dojo.html.getPadBorderWidth = function(node){ - return dojo.html._callDeprecated("getPadBorderWidth", "getPadBorder", arguments, null, "width"); -} -dojo.html.getPadBorderHeight = function(node){ - return dojo.html._callDeprecated("getPadBorderHeight", "getPadBorder", arguments, null, "height"); -} -dojo.html.getBorderBoxWidth = dojo.html.getInnerWidth = function(){ - return dojo.html._callDeprecated("getBorderBoxWidth", "getBorderBox", arguments, null, "width"); -} -dojo.html.getBorderBoxHeight = dojo.html.getInnerHeight = function(){ - return dojo.html._callDeprecated("getBorderBoxHeight", "getBorderBox", arguments, null, "height"); -} -dojo.html.getContentBoxWidth = dojo.html.getContentWidth = function(){ - return dojo.html._callDeprecated("getContentBoxWidth", "getContentBox", arguments, null, "width"); -} -dojo.html.getContentBoxHeight = dojo.html.getContentHeight = function(){ - return dojo.html._callDeprecated("getContentBoxHeight", "getContentBox", arguments, null, "height"); -} -dojo.html.setContentBoxWidth = dojo.html.setContentWidth = function(node, width){ - return dojo.html._callDeprecated("setContentBoxWidth", "setContentBox", arguments, "width"); -} -dojo.html.setContentBoxHeight = dojo.html.setContentHeight = function(node, height){ - return dojo.html._callDeprecated("setContentBoxHeight", "setContentBox", arguments, "height"); -} - -dojo.provide("dojo.lfx.html"); - - - - - - - - -dojo.lfx.html._byId = function(nodes){ - if(!nodes){ return []; } - if(dojo.lang.isArrayLike(nodes)){ - if(!nodes.alreadyChecked){ - var n = []; - dojo.lang.forEach(nodes, function(node){ - n.push(dojo.byId(node)); - }); - n.alreadyChecked = true; - return n; - }else{ - return nodes; - } - }else{ - var n = []; - n.push(dojo.byId(nodes)); - n.alreadyChecked = true; - return n; - } -} - -dojo.lfx.html.propertyAnimation = function( /*DOMNode[]*/ nodes, - /*Object[]*/ propertyMap, - /*int*/ duration, - /*function*/ easing, - /*Object*/ handlers){ - // summary: Returns an animation that will transition the properties of "nodes" - // depending how they are defined in "propertyMap". - // nodes: An array of DOMNodes or one DOMNode. - // propertyMap: { property: String, start: Decimal?, end: Decimal?, units: String? } - // An array of objects defining properties to change. - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // handlers: { handler: Function?, onstart: Function?, onstop: Function?, onanimate: Function? } - nodes = dojo.lfx.html._byId(nodes); - - var targs = { - "propertyMap": propertyMap, - "nodes": nodes, - "duration": duration, - "easing": easing||dojo.lfx.easeDefault - }; - - var setEmUp = function(args){ - if(args.nodes.length==1){ - // FIXME: we're only supporting start-value filling when one node is - // passed - - var pm = args.propertyMap; - if(!dojo.lang.isArray(args.propertyMap)){ - // it's stupid to have to pack an array with a set of objects - // when you can just pass in an object list - var parr = []; - for(var pname in pm){ - pm[pname].property = pname; - parr.push(pm[pname]); - } - pm = args.propertyMap = parr; - } - dojo.lang.forEach(pm, function(prop){ - if(dj_undef("start", prop)){ - if(prop.property != "opacity"){ - prop.start = parseInt(dojo.html.getComputedStyle(args.nodes[0], prop.property)); - }else{ - prop.start = dojo.html.getOpacity(args.nodes[0]); - } - } - }); - } - } - - var coordsAsInts = function(coords){ - var cints = []; - dojo.lang.forEach(coords, function(c){ - cints.push(Math.round(c)); - }); - return cints; - } - - var setStyle = function(n, style){ - n = dojo.byId(n); - if(!n || !n.style){ return; } - for(var s in style){ - try{ - if(s == "opacity"){ - dojo.html.setOpacity(n, style[s]); - }else{ - n.style[s] = style[s]; - } - }catch(e){ dojo.debug(e); } - } - } - - var propLine = function(properties){ - this._properties = properties; - this.diffs = new Array(properties.length); - dojo.lang.forEach(properties, function(prop, i){ - // calculate the end - start to optimize a bit - if(dojo.lang.isFunction(prop.start)){ - prop.start = prop.start(prop, i); - } - if(dojo.lang.isFunction(prop.end)){ - prop.end = prop.end(prop, i); - } - if(dojo.lang.isArray(prop.start)){ - // don't loop through the arrays - this.diffs[i] = null; - }else if(prop.start instanceof dojo.gfx.color.Color){ - // save these so we don't have to call toRgb() every getValue() call - prop.startRgb = prop.start.toRgb(); - prop.endRgb = prop.end.toRgb(); - }else{ - this.diffs[i] = prop.end - prop.start; - } - }, this); - - this.getValue = function(n){ - var ret = {}; - dojo.lang.forEach(this._properties, function(prop, i){ - var value = null; - if(dojo.lang.isArray(prop.start)){ - // FIXME: what to do here? - }else if(prop.start instanceof dojo.gfx.color.Color){ - value = (prop.units||"rgb") + "("; - for(var j = 0 ; j < prop.startRgb.length ; j++){ - value += Math.round(((prop.endRgb[j] - prop.startRgb[j]) * n) + prop.startRgb[j]) + (j < prop.startRgb.length - 1 ? "," : ""); - } - value += ")"; - }else{ - value = ((this.diffs[i]) * n) + prop.start + (prop.property != "opacity" ? prop.units||"px" : ""); - } - ret[dojo.html.toCamelCase(prop.property)] = value; - }, this); - return ret; - } - } - - var anim = new dojo.lfx.Animation({ - beforeBegin: function(){ - setEmUp(targs); - anim.curve = new propLine(targs.propertyMap); - }, - onAnimate: function(propValues){ - dojo.lang.forEach(targs.nodes, function(node){ - setStyle(node, propValues); - }); - } - }, - targs.duration, - null, - targs.easing - ); - if(handlers){ - for(var x in handlers){ - if(dojo.lang.isFunction(handlers[x])){ - anim.connect(x, anim, handlers[x]); - } - } - } - - return anim; // dojo.lfx.Animation -} - -dojo.lfx.html._makeFadeable = function(nodes){ - var makeFade = function(node){ - if(dojo.render.html.ie){ - // only set the zoom if the "tickle" value would be the same as the - // default - if( (node.style.zoom.length == 0) && - (dojo.html.getStyle(node, "zoom") == "normal") ){ - // make sure the node "hasLayout" - // NOTE: this has been tested with larger and smaller user-set text - // sizes and works fine - node.style.zoom = "1"; - // node.style.zoom = "normal"; - } - // don't set the width to auto if it didn't already cascade that way. - // We don't want to f anyones designs - if( (node.style.width.length == 0) && - (dojo.html.getStyle(node, "width") == "auto") ){ - node.style.width = "auto"; - } - } - } - if(dojo.lang.isArrayLike(nodes)){ - dojo.lang.forEach(nodes, makeFade); - }else{ - makeFade(nodes); - } -} - -dojo.lfx.html.fade = function(/*DOMNode[]*/ nodes, - /*Object*/values, - /*int?*/ duration, - /*Function?*/ easing, - /*Function?*/ callback){ - // summary:Returns an animation that will fade the "nodes" from the start to end values passed. - // nodes: An array of DOMNodes or one DOMNode. - // values: { start: Decimal?, end: Decimal? } - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - nodes = dojo.lfx.html._byId(nodes); - var props = { property: "opacity" }; - if(!dj_undef("start", values)){ - props.start = values.start; - }else{ - props.start = function(){ return dojo.html.getOpacity(nodes[0]); }; - } - - if(!dj_undef("end", values)){ - props.end = values.end; - }else{ - dojo.raise("dojo.lfx.html.fade needs an end value"); - } - - var anim = dojo.lfx.propertyAnimation(nodes, [ props ], duration, easing); - anim.connect("beforeBegin", function(){ - dojo.lfx.html._makeFadeable(nodes); - }); - if(callback){ - anim.connect("onEnd", function(){ callback(nodes, anim); }); - } - - return anim; // dojo.lfx.Animation -} - -dojo.lfx.html.fadeIn = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ - // summary: Returns an animation that will fade "nodes" from its current opacity to fully opaque. - // nodes: An array of DOMNodes or one DOMNode. - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - return dojo.lfx.html.fade(nodes, { end: 1 }, duration, easing, callback); // dojo.lfx.Animation -} - -dojo.lfx.html.fadeOut = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ - // summary: Returns an animation that will fade "nodes" from its current opacity to fully transparent. - // nodes: An array of DOMNodes or one DOMNode. - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - return dojo.lfx.html.fade(nodes, { end: 0 }, duration, easing, callback); // dojo.lfx.Animation -} - -dojo.lfx.html.fadeShow = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ - // summary: Returns an animation that will fade "nodes" from transparent to opaque and shows - // "nodes" at the end if it is hidden. - // nodes: An array of DOMNodes or one DOMNode. - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - nodes=dojo.lfx.html._byId(nodes); - dojo.lang.forEach(nodes, function(node){ - dojo.html.setOpacity(node, 0.0); - }); - - var anim = dojo.lfx.html.fadeIn(nodes, duration, easing, callback); - anim.connect("beforeBegin", function(){ - if(dojo.lang.isArrayLike(nodes)){ - dojo.lang.forEach(nodes, dojo.html.show); - }else{ - dojo.html.show(nodes); - } - }); - - return anim; // dojo.lfx.Animation -} - -dojo.lfx.html.fadeHide = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ - // summary: Returns an animation that will fade "nodes" from its current opacity to opaque and hides - // "nodes" at the end. - // nodes: An array of DOMNodes or one DOMNode. - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - var anim = dojo.lfx.html.fadeOut(nodes, duration, easing, function(){ - if(dojo.lang.isArrayLike(nodes)){ - dojo.lang.forEach(nodes, dojo.html.hide); - }else{ - dojo.html.hide(nodes); - } - if(callback){ callback(nodes, anim); } - }); - - return anim; // dojo.lfx.Animation -} - -dojo.lfx.html.wipeIn = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ - // summary: Returns an animation that will show and wipe in "nodes". - // nodes: An array of DOMNodes or one DOMNode. - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - nodes = dojo.lfx.html._byId(nodes); - var anims = []; - - dojo.lang.forEach(nodes, function(node){ - var oprop = { }; // old properties of node (before we mucked w/them) - - // get node height, either it's natural height or it's height specified via style or class attributes - // (for FF, the node has to be (temporarily) rendered to measure height) - // TODO: should this offscreen code be part of dojo.html, so that getBorderBox() works on hidden nodes? - var origTop, origLeft, origPosition; - with(node.style){ - origTop=top; origLeft=left; origPosition=position; - top="-9999px"; left="-9999px"; position="absolute"; - display=""; - } - var nodeHeight = dojo.html.getBorderBox(node).height; - with(node.style){ - top=origTop; left=origLeft; position=origPosition; - display="none"; - } - - var anim = dojo.lfx.propertyAnimation(node, - { "height": { - start: 1, // 0 causes IE to display the whole panel - end: function(){ return nodeHeight; } - } - }, - duration, - easing); - - anim.connect("beforeBegin", function(){ - oprop.overflow = node.style.overflow; - oprop.height = node.style.height; - with(node.style){ - overflow = "hidden"; - height = "1px"; // 0 causes IE to display the whole panel - } - dojo.html.show(node); - }); - - anim.connect("onEnd", function(){ - with(node.style){ - overflow = oprop.overflow; - height = oprop.height; - } - if(callback){ callback(node, anim); } - }); - anims.push(anim); - }); - - return dojo.lfx.combine(anims); // dojo.lfx.Combine -} - -dojo.lfx.html.wipeOut = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ - // summary: Returns an animation that will wipe out and hide "nodes". - // nodes: An array of DOMNodes or one DOMNode. - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - nodes = dojo.lfx.html._byId(nodes); - var anims = []; - - dojo.lang.forEach(nodes, function(node){ - var oprop = { }; // old properties of node (before we mucked w/them) - var anim = dojo.lfx.propertyAnimation(node, - { "height": { - start: function(){ return dojo.html.getContentBox(node).height; }, - end: 1 // 0 causes IE to display the whole panel - } - }, - duration, - easing, - { - "beforeBegin": function(){ - oprop.overflow = node.style.overflow; - oprop.height = node.style.height; - with(node.style){ - overflow = "hidden"; - } - dojo.html.show(node); - }, - - "onEnd": function(){ - dojo.html.hide(node); - with(node.style){ - overflow = oprop.overflow; - height = oprop.height; - } - if(callback){ callback(node, anim); } - } - } - ); - anims.push(anim); - }); - - return dojo.lfx.combine(anims); // dojo.lfx.Combine -} - -dojo.lfx.html.slideTo = function(/*DOMNode*/ nodes, - /*Object*/ coords, - /*int?*/ duration, - /*Function?*/ easing, - /*Function?*/ callback){ - // summary: Returns an animation that will slide "nodes" from its current position to - // the position defined in "coords". - // nodes: An array of DOMNodes or one DOMNode. - // coords: { top: Decimal?, left: Decimal? } - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - nodes = dojo.lfx.html._byId(nodes); - var anims = []; - var compute = dojo.html.getComputedStyle; - - if(dojo.lang.isArray(coords)){ - /* coords: Array - pId: a */ - dojo.deprecated('dojo.lfx.html.slideTo(node, array)', 'use dojo.lfx.html.slideTo(node, {top: value, left: value});', '0.5'); - coords = { top: coords[0], left: coords[1] }; - } - dojo.lang.forEach(nodes, function(node){ - var top = null; - var left = null; - - var init = (function(){ - var innerNode = node; - return function(){ - var pos = compute(innerNode, 'position'); - top = (pos == 'absolute' ? node.offsetTop : parseInt(compute(node, 'top')) || 0); - left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node, 'left')) || 0); - - if (!dojo.lang.inArray(['absolute', 'relative'], pos)) { - var ret = dojo.html.abs(innerNode, true); - dojo.html.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;"); - top = ret.y; - left = ret.x; - } - } - })(); - init(); - - var anim = dojo.lfx.propertyAnimation(node, - { "top": { start: top, end: (coords.top||0) }, - "left": { start: left, end: (coords.left||0) } - }, - duration, - easing, - { "beforeBegin": init } - ); - - if(callback){ - anim.connect("onEnd", function(){ callback(nodes, anim); }); - } - - anims.push(anim); - }); - - return dojo.lfx.combine(anims); // dojo.lfx.Combine -} - -dojo.lfx.html.slideBy = function(/*DOMNode*/ nodes, /*Object*/ coords, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ - // summary: Returns an animation that will slide "nodes" from its current position - // to its current position plus the numbers defined in "coords". - // nodes: An array of DOMNodes or one DOMNode. - // coords: { top: Decimal?, left: Decimal? } - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - nodes = dojo.lfx.html._byId(nodes); - var anims = []; - var compute = dojo.html.getComputedStyle; - - if(dojo.lang.isArray(coords)){ - /* coords: Array - pId: a */ - dojo.deprecated('dojo.lfx.html.slideBy(node, array)', 'use dojo.lfx.html.slideBy(node, {top: value, left: value});', '0.5'); - coords = { top: coords[0], left: coords[1] }; - } - - dojo.lang.forEach(nodes, function(node){ - var top = null; - var left = null; - - var init = (function(){ - var innerNode = node; - return function(){ - var pos = compute(innerNode, 'position'); - top = (pos == 'absolute' ? node.offsetTop : parseInt(compute(node, 'top')) || 0); - left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node, 'left')) || 0); - - if (!dojo.lang.inArray(['absolute', 'relative'], pos)) { - var ret = dojo.html.abs(innerNode, true); - dojo.html.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;"); - top = ret.y; - left = ret.x; - } - } - })(); - init(); - - var anim = dojo.lfx.propertyAnimation(node, - { - "top": { start: top, end: top+(coords.top||0) }, - "left": { start: left, end: left+(coords.left||0) } - }, - duration, - easing).connect("beforeBegin", init); - - if(callback){ - anim.connect("onEnd", function(){ callback(nodes, anim); }); - } - - anims.push(anim); - }); - - return dojo.lfx.combine(anims); // dojo.lfx.Combine -} - -dojo.lfx.html.explode = function(/*DOMNode*/ start, - /*DOMNode*/ endNode, - /*int?*/ duration, - /*Function?*/ easing, - /*Function?*/ callback){ - // summary: Returns an animation that will - // start: - // endNode: - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - var h = dojo.html; - start = dojo.byId(start); - endNode = dojo.byId(endNode); - var startCoords = h.toCoordinateObject(start, true); - var outline = document.createElement("div"); - h.copyStyle(outline, endNode); - if(endNode.explodeClassName){ outline.className = endNode.explodeClassName; } - with(outline.style){ - position = "absolute"; - display = "none"; - // border = "1px solid black"; - var backgroundStyle = h.getStyle(start, "background-color"); - backgroundColor = backgroundStyle ? backgroundStyle.toLowerCase() : "transparent"; - backgroundColor = (backgroundColor == "transparent") ? "rgb(221, 221, 221)" : backgroundColor; - } - dojo.body().appendChild(outline); - - with(endNode.style){ - visibility = "hidden"; - display = "block"; - } - var endCoords = h.toCoordinateObject(endNode, true); - with(endNode.style){ - display = "none"; - visibility = "visible"; - } - - var props = { opacity: { start: 0.5, end: 1.0 } }; - dojo.lang.forEach(["height", "width", "top", "left"], function(type){ - props[type] = { start: startCoords[type], end: endCoords[type] } - }); - - var anim = new dojo.lfx.propertyAnimation(outline, - props, - duration, - easing, - { - "beforeBegin": function(){ - h.setDisplay(outline, "block"); - }, - "onEnd": function(){ - h.setDisplay(endNode, "block"); - outline.parentNode.removeChild(outline); - } - } - ); - - if(callback){ - anim.connect("onEnd", function(){ callback(endNode, anim); }); - } - return anim; // dojo.lfx.Animation -} - -dojo.lfx.html.implode = function(/*DOMNode*/ startNode, - /*DOMNode*/ end, - /*int?*/ duration, - /*Function?*/ easing, - /*Function?*/ callback){ - // summary: Returns an animation that will - // startNode: - // end: - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - var h = dojo.html; - startNode = dojo.byId(startNode); - end = dojo.byId(end); - var startCoords = dojo.html.toCoordinateObject(startNode, true); - var endCoords = dojo.html.toCoordinateObject(end, true); - - var outline = document.createElement("div"); - dojo.html.copyStyle(outline, startNode); - if (startNode.explodeClassName) { outline.className = startNode.explodeClassName; } - dojo.html.setOpacity(outline, 0.3); - with(outline.style){ - position = "absolute"; - display = "none"; - backgroundColor = h.getStyle(startNode, "background-color").toLowerCase(); - } - dojo.body().appendChild(outline); - - var props = { opacity: { start: 1.0, end: 0.5 } }; - dojo.lang.forEach(["height", "width", "top", "left"], function(type){ - props[type] = { start: startCoords[type], end: endCoords[type] } - }); - - var anim = new dojo.lfx.propertyAnimation(outline, - props, - duration, - easing, - { - "beforeBegin": function(){ - dojo.html.hide(startNode); - dojo.html.show(outline); - }, - "onEnd": function(){ - outline.parentNode.removeChild(outline); - } - } - ); - - if(callback){ - anim.connect("onEnd", function(){ callback(startNode, anim); }); - } - return anim; // dojo.lfx.Animation -} - -dojo.lfx.html.highlight = function(/*DOMNode[]*/ nodes, - /*dojo.gfx.color.Color*/ startColor, - /*int?*/ duration, - /*Function?*/ easing, - /*Function?*/ callback){ - // summary: Returns an animation that will set the background color - // of "nodes" to startColor and transition it to "nodes" - // original color. - // startColor: Color to transition from. - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - nodes = dojo.lfx.html._byId(nodes); - var anims = []; - - dojo.lang.forEach(nodes, function(node){ - var color = dojo.html.getBackgroundColor(node); - var bg = dojo.html.getStyle(node, "background-color").toLowerCase(); - var bgImage = dojo.html.getStyle(node, "background-image"); - var wasTransparent = (bg == "transparent" || bg == "rgba(0, 0, 0, 0)"); - while(color.length > 3) { color.pop(); } - - var rgb = new dojo.gfx.color.Color(startColor); - var endRgb = new dojo.gfx.color.Color(color); - - var anim = dojo.lfx.propertyAnimation(node, - { "background-color": { start: rgb, end: endRgb } }, - duration, - easing, - { - "beforeBegin": function(){ - if(bgImage){ - node.style.backgroundImage = "none"; - } - node.style.backgroundColor = "rgb(" + rgb.toRgb().join(",") + ")"; - }, - "onEnd": function(){ - if(bgImage){ - node.style.backgroundImage = bgImage; - } - if(wasTransparent){ - node.style.backgroundColor = "transparent"; - } - if(callback){ - callback(node, anim); - } - } - } - ); - - anims.push(anim); - }); - return dojo.lfx.combine(anims); // dojo.lfx.Combine -} - -dojo.lfx.html.unhighlight = function(/*DOMNode[]*/ nodes, - /*dojo.gfx.color.Color*/ endColor, - /*int?*/ duration, - /*Function?*/ easing, - /*Function?*/ callback){ - // summary: Returns an animation that will transition "nodes" background color - // from its current color to "endColor". - // endColor: Color to transition to. - // duration: Duration of the animation in milliseconds. - // easing: An easing function. - // callback: Function to run at the end of the animation. - nodes = dojo.lfx.html._byId(nodes); - var anims = []; - - dojo.lang.forEach(nodes, function(node){ - var color = new dojo.gfx.color.Color(dojo.html.getBackgroundColor(node)); - var rgb = new dojo.gfx.color.Color(endColor); - - var bgImage = dojo.html.getStyle(node, "background-image"); - - var anim = dojo.lfx.propertyAnimation(node, - { "background-color": { start: color, end: rgb } }, - duration, - easing, - { - "beforeBegin": function(){ - if(bgImage){ - node.style.backgroundImage = "none"; - } - node.style.backgroundColor = "rgb(" + color.toRgb().join(",") + ")"; - }, - "onEnd": function(){ - if(callback){ - callback(node, anim); - } - } - } - ); - anims.push(anim); - }); - return dojo.lfx.combine(anims); // dojo.lfx.Combine -} - -dojo.lang.mixin(dojo.lfx, dojo.lfx.html); - -dojo.kwCompoundRequire({ - browser: ["dojo.lfx.html"], - dashboard: ["dojo.lfx.html"] -}); -dojo.provide("dojo.lfx.*"); - -if(!this["dojo"]){ - alert("\"dojo/__package__.js\" is now located at \"dojo/dojo.js\". Please update your includes accordingly"); -} - -dojo.provide("dojo.xml.Parse"); - - -//TODO: determine dependencies -// currently has dependency on dojo.xml.DomUtil nodeTypes constants... - -// using documentFragment nomenclature to generalize in case we don't want to require passing a collection of nodes with a single parent - -dojo.xml.Parse = function(){ - // summary: - // generic class for taking a DOM node and parsing it into an object - // based on the "dojo tag name" of that node. - // - // supported dojoTagName's: - // => prefix:tag - // => dojo:tag - // => dojo:tag - // => dojo:type - // => prefix:type - // => dojo:type - // => dojo:type - - var isIE = ((dojo.render.html.capable)&&(dojo.render.html.ie)); - - // get normalized (lowercase) tagName - // some browsers report tagNames in lowercase no matter what - function getTagName(node){ - /* - return ((node)&&(node["tagName"]) ? node.tagName.toLowerCase() : ''); - */ - try{ - return node.tagName.toLowerCase(); - }catch(e){ - return ""; - } - } - - // locate dojo qualified tag name - function getDojoTagName(node){ - var tagName = getTagName(node); - if (!tagName){ - return ''; - } - // any registered tag - if((dojo.widget)&&(dojo.widget.tags[tagName])){ - return tagName; - } - // => prefix:tag - var p = tagName.indexOf(":"); - if(p>=0){ - return tagName; - } - // => dojo:tag - if(tagName.substr(0,5) == "dojo:"){ - return tagName; - } - if(dojo.render.html.capable && dojo.render.html.ie && node.scopeName != 'HTML'){ - return node.scopeName.toLowerCase() + ':' + tagName; - } - // => dojo:tag - if(tagName.substr(0,4) == "dojo"){ - // FIXME: this assumes tag names are always lower case - return "dojo:" + tagName.substring(4); - } - // => prefix:type - // => dojo:type - var djt = node.getAttribute("dojoType") || node.getAttribute("dojotype"); - if(djt){ - if (djt.indexOf(":")<0){ - djt = "dojo:"+djt; - } - return djt.toLowerCase(); - } - // => dojo:type - djt = node.getAttributeNS && node.getAttributeNS(dojo.dom.dojoml,"type"); - if(djt){ - return "dojo:" + djt.toLowerCase(); - } - // => dojo:type - try{ - // FIXME: IE really really doesn't like this, so we squelch errors for it - djt = node.getAttribute("dojo:type"); - }catch(e){ - // FIXME: log? - } - if(djt){ return "dojo:"+djt.toLowerCase(); } - // => dojo:type - if((dj_global["djConfig"])&&(!djConfig["ignoreClassNames"])){ - // FIXME: should we make this optionally enabled via djConfig? - var classes = node.className||node.getAttribute("class"); - // FIXME: following line, without check for existence of classes.indexOf - // breaks firefox 1.5's svg widgets - if((classes )&&(classes.indexOf)&&(classes.indexOf("dojo-")!=-1)){ - var aclasses = classes.split(" "); - for(var x=0, c=aclasses.length; x as nodes that should be parsed. Ignore these - if(isIE && tagName.indexOf("/")==0){ return null; } - - try{ - var attr = node.getAttribute("parseWidgets"); - if(attr && attr.toLowerCase() == "false"){ - return {}; - } - }catch(e){/*continue*/} - - - // look for a dojoml qualified name - // process dojoml only when optimizeForDojoML is true - var process = true; - if(optimizeForDojoML){ - var dojoTagName = getDojoTagName(node); - tagName = dojoTagName || tagName; - process = Boolean(dojoTagName); - } - - var parsedNodeSet = {}; - parsedNodeSet[tagName] = []; - var pos = tagName.indexOf(":"); - if(pos>0){ - var ns = tagName.substring(0,pos); - parsedNodeSet["ns"] = ns; - // honor user namespace filters - if((dojo.ns)&&(!dojo.ns.allow(ns))){process=false;} - } - - if(process){ - var attributeSet = this.parseAttributes(node); - for(var attr in attributeSet){ - if((!parsedNodeSet[tagName][attr])||(typeof parsedNodeSet[tagName][attr] != "array")){ - parsedNodeSet[tagName][attr] = []; - } - parsedNodeSet[tagName][attr].push(attributeSet[attr]); - } - // FIXME: we might want to make this optional or provide cloning instead of - // referencing, but for now, we include a node reference to allow - // instantiated components to figure out their "roots" - parsedNodeSet[tagName].nodeRef = node; - parsedNodeSet.tagName = tagName; - parsedNodeSet.index = thisIdx||0; - } - - var count = 0; - for(var i = 0; i < node.childNodes.length; i++){ - var tcn = node.childNodes.item(i); - switch(tcn.nodeType){ - case dojo.dom.ELEMENT_NODE: // element nodes, call this function recursively - var ctn = getDojoTagName(tcn) || getTagName(tcn); - if(!parsedNodeSet[ctn]){ - parsedNodeSet[ctn] = []; - } - parsedNodeSet[ctn].push(this.parseElement(tcn, true, optimizeForDojoML, count)); - if( (tcn.childNodes.length == 1)&& - (tcn.childNodes.item(0).nodeType == dojo.dom.TEXT_NODE)){ - parsedNodeSet[ctn][parsedNodeSet[ctn].length-1].value = tcn.childNodes.item(0).nodeValue; - } - count++; - break; - case dojo.dom.TEXT_NODE: // if a single text node is the child, treat it as an attribute - if(node.childNodes.length == 1){ - parsedNodeSet[tagName].push({ value: node.childNodes.item(0).nodeValue }); - } - break; - default: break; - /* - case dojo.dom.ATTRIBUTE_NODE: // attribute node... not meaningful here - break; - case dojo.dom.CDATA_SECTION_NODE: // cdata section... not sure if this would ever be meaningful... might be... - break; - case dojo.dom.ENTITY_REFERENCE_NODE: // entity reference node... not meaningful here - break; - case dojo.dom.ENTITY_NODE: // entity node... not sure if this would ever be meaningful - break; - case dojo.dom.PROCESSING_INSTRUCTION_NODE: // processing instruction node... not meaningful here - break; - case dojo.dom.COMMENT_NODE: // comment node... not not sure if this would ever be meaningful - break; - case dojo.dom.DOCUMENT_NODE: // document node... not sure if this would ever be meaningful - break; - case dojo.dom.DOCUMENT_TYPE_NODE: // document type node... not meaningful here - break; - case dojo.dom.DOCUMENT_FRAGMENT_NODE: // document fragment node... not meaningful here - break; - case dojo.dom.NOTATION_NODE:// notation node... not meaningful here - break; - */ - } - } - //return (hasParentNodeSet) ? parsedNodeSet[node.tagName] : parsedNodeSet; - //if(parsedNodeSet.tagName)dojo.debug("parseElement: RETURNING NODE WITH TAGNAME "+parsedNodeSet.tagName); - return parsedNodeSet; - }; - - - /* parses a set of attributes on a node into an object tree */ - this.parseAttributes = function(/*DomNode*/node){ - // summary: - // creates an attribute object that maps attribute values for the - // passed node. Note that this is similar to creating a JSON - // representation of a DOM node. - // usage: - // a node with the following serialization: - //
...
- // would yeild the following return structure when passed into this - // function: - // { - // "foo": { - // "value": "bar" - // }, - // "baz": { - // "value": "thud" - // } - // } - // - var parsedAttributeSet = {}; - var atts = node.attributes; - // TODO: should we allow for duplicate attributes at this point... - // would any of the relevant dom implementations even allow this? - var attnode, i=0; - while((attnode=atts[i++])){ - if(isIE){ - if(!attnode){ continue; } - if((typeof attnode == "object")&& - (typeof attnode.nodeValue == 'undefined')|| - (attnode.nodeValue == null)|| - (attnode.nodeValue == '')){ - continue; - } - } - - var nn = attnode.nodeName.split(":"); - nn = (nn.length == 2) ? nn[1] : attnode.nodeName; - - parsedAttributeSet[nn] = { - value: attnode.nodeValue - }; - } - return parsedAttributeSet; - }; -}; - -dojo.provide("dojo.lang.declare"); - - - - -dojo.lang.declare = function( /*String*/ className, - /*Function|Array*/ superclass, - /*Function?*/ init, - /*Object|Array*/ props){ - /* - * summary: Create a feature-rich constructor with a compact notation - * className: the name of the constructor (loosely, a "class") - * superclass: - * may be a Function, or an Array of Functions. If "superclass" is an - * array, the first element is used as the prototypical ancestor and - * any following Functions become mixin ancestors. - * init: an initializer function - * props: - * an object (or array of objects) whose properties are copied to the - * created prototype - * description: - * Create a constructor using a compact notation for inheritance and - * prototype extension. "superclass" argument may be a Function, or an - * array of Functions. - * - * If "superclass" is an array, the first element is used as the - * prototypical ancestor and any following Functions become mixin - * ancestors. - * - * All "superclass(es)" must be Functions (not mere Objects). - * - * Using mixin ancestors provides a type of multiple inheritance. - * Mixin ancestors prototypical properties are copied to the subclass, - * and any inializater/constructor is invoked. - * - * Properties of object "props" are copied to the constructor - * prototype. If "props" is an array, properties of each object in the - * array are copied to the constructor prototype. - * - * name of the class ("className" argument) is stored in - * "declaredClass" property - * - * Initializer functions are called when an object is instantiated - * from this constructor. - * - * Aliased as "dojo.declare" - * - * Usage: - * - * dojo.declare("my.classes.bar", my.classes.foo, - * function(){ - * // initialization function - * this.myComplicatedObject = new ReallyComplicatedObject(); - * }, - * { // properties to be added to the class prototype - * someValue: 2, - * someMethod: function(){ - * doStuff(); - * } - * } - * ); - * - */ - if((dojo.lang.isFunction(props))||((!props)&&(!dojo.lang.isFunction(init)))){ - // parameter juggling to support omitting init param (also allows - // reordering init and props arguments) - var temp = props; - props = init; - init = temp; - } - var mixins = [ ]; - if(dojo.lang.isArray(superclass)){ - mixins = superclass; - superclass = mixins.shift(); - } - if(!init){ - init = dojo.evalObjPath(className, false); - if((init)&&(!dojo.lang.isFunction(init))){ init = null }; - } - var ctor = dojo.lang.declare._makeConstructor(); - var scp = (superclass ? superclass.prototype : null); - if(scp){ - scp.prototyping = true; - ctor.prototype = new superclass(); - scp.prototyping = false; - } - ctor.superclass = scp; - ctor.mixins = mixins; - for(var i=0,l=mixins.length; i by convention - if(!dojo.hostenv.moduleHasPrefix(name)){ - dojo.registerModulePath(name, "../" + name); - } - req([name, 'manifest'].join('.'), false, true); - } - if(!this.namespaces[name]){ - this.failed[name] = true; //only look for a namespace once - } - }finally{ - this.loading[name]=false; - } - return this.namespaces[name]; // Ns - } -} - -dojo.ns.Ns = function(/*String*/name, /*String*/module, /*Function?*/resolver){ - // summary: this object simply encapsulates namespace data - this.name = name; - this.module = module; - this.resolver = resolver; - this._loaded = [ ]; - this._failed = [ ]; -} - -dojo.ns.Ns.prototype.resolve = function(/*String*/name, /*String*/domain, /*Boolean?*/omitModuleCheck){ - //summary: map component with 'name' and 'domain' to a module via namespace resolver, if specified - if(!this.resolver || djConfig["skipAutoRequire"]){return false;} // Boolean - var fullName = this.resolver(name, domain); - //only load a widget once. This is a quicker check than dojo.require does - if((fullName)&&(!this._loaded[fullName])&&(!this._failed[fullName])){ - //workaround so we don't break the build system - var req = dojo.require; - req(fullName, false, true); //omit the module check, we'll do it ourselves. - if(dojo.hostenv.findModule(fullName, false)){ - this._loaded[fullName] = true; - }else{ - if(!omitModuleCheck){dojo.raise("dojo.ns.Ns.resolve: module '" + fullName + "' not found after loading via namespace '" + this.name + "'");} - this._failed[fullName] = true; - } - } - return Boolean(this._loaded[fullName]); // Boolean -} - -dojo.registerNamespace = function(/*String*/name, /*String*/module, /*Function?*/resolver){ - // summary: maps a module name to a namespace for widgets, and optionally maps widget names to modules for auto-loading - // description: An unregistered namespace is mapped to an eponymous module. - // For example, namespace acme is mapped to module acme, and widgets are - // assumed to belong to acme.widget. If you want to use a different widget - // module, use dojo.registerNamespace. - dojo.ns.register.apply(dojo.ns, arguments); -} - -dojo.registerNamespaceResolver = function(/*String*/name, /*Function*/resolver){ - // summary: a resolver function maps widget names to modules, so the - // widget manager can auto-load needed widget implementations - // - // description: The resolver provides information to allow Dojo - // to load widget modules on demand. When a widget is created, - // a namespace resolver can tell Dojo what module to require - // to ensure that the widget implementation code is loaded. - // - // name: will always be lower-case. - // - // example: - // dojo.registerNamespaceResolver("acme", - // function(name){ - // return "acme.widget."+dojo.string.capitalize(name); - // } - // ); - var n = dojo.ns.namespaces[name]; - if(n){ - n.resolver = resolver; - } -} - -dojo.registerNamespaceManifest = function(/*String*/module, /*String*/path, /*String*/name, /*String*/widgetModule, /*Function?*/resolver){ - // summary: convenience function to register a module path, a namespace, and optionally a resolver all at once. - dojo.registerModulePath(name, path); - dojo.registerNamespace(name, widgetModule, resolver); -} - -// NOTE: rather put this in dojo.widget.Widget, but that fubars debugAtAllCosts -dojo.registerNamespace("dojo", "dojo.widget"); - -dojo.provide("dojo.widget.Manager"); - - - - -// summary -// Manager class for the widgets. -// This is an internal class used by dojo; users shouldn't call this class directly. -dojo.widget.manager = new function(){ - this.widgets = []; - this.widgetIds = []; - - // map of widgetId-->widget for widgets without parents (top level widgets) - this.topWidgets = {}; - - var widgetTypeCtr = {}; - var renderPrefixCache = []; - - this.getUniqueId = function (widgetType) { - var widgetId; - do{ - widgetId = widgetType + "_" + (widgetTypeCtr[widgetType] != undefined ? - ++widgetTypeCtr[widgetType] : widgetTypeCtr[widgetType] = 0); - }while(this.getWidgetById(widgetId)); - return widgetId; - } - - this.add = function(widget){ - //dojo.profile.start("dojo.widget.manager.add"); - this.widgets.push(widget); - // Opera9 uses ID (caps) - if(!widget.extraArgs["id"]){ - widget.extraArgs["id"] = widget.extraArgs["ID"]; - } - // FIXME: the rest of this method is very slow! - if(widget.widgetId == ""){ - if(widget["id"]){ - widget.widgetId = widget["id"]; - }else if(widget.extraArgs["id"]){ - widget.widgetId = widget.extraArgs["id"]; - }else{ - widget.widgetId = this.getUniqueId(widget.ns+'_'+widget.widgetType); - } - } - if(this.widgetIds[widget.widgetId]){ - dojo.debug("widget ID collision on ID: "+widget.widgetId); - } - this.widgetIds[widget.widgetId] = widget; - // Widget.destroy already calls removeById(), so we don't need to - // connect() it here - //dojo.profile.end("dojo.widget.manager.add"); - } - - this.destroyAll = function(){ - for(var x=this.widgets.length-1; x>=0; x--){ - try{ - // this.widgets[x].destroyChildren(); - this.widgets[x].destroy(true); - delete this.widgets[x]; - }catch(e){ } - } - } - - // FIXME: we should never allow removal of the root widget until all others - // are removed! - this.remove = function(widgetIndex){ - if(dojo.lang.isNumber(widgetIndex)){ - var tw = this.widgets[widgetIndex].widgetId; - delete this.topWidgets[tw]; - delete this.widgetIds[tw]; - this.widgets.splice(widgetIndex, 1); - }else{ - this.removeById(widgetIndex); - } - } - - // FIXME: suboptimal performance - this.removeById = function(id) { - if(!dojo.lang.isString(id)){ - id = id["widgetId"]; - if(!id){ dojo.debug("invalid widget or id passed to removeById"); return; } - } - for (var i=0; i.widget by convention - dojo.ns.register(ns, ns + '.widget'); - nsObj = dojo.ns.get(ns); - } - - // allow the namespace to resolve the widget module - if(nsObj){nsObj.resolve(widgetName);} - - // locate a widget implementation in the registered module for our current rendering environment - impl = findImplementation(lowerCaseWidgetName, nsObj.module); - if(impl){return(imps[lowerCaseWidgetName] = impl)}; - - // try to load a manifest to resolve this implemenation - nsObj = dojo.ns.require(ns); - if((nsObj)&&(nsObj.resolver)){ - nsObj.resolve(widgetName); - impl = findImplementation(lowerCaseWidgetName, nsObj.module); - if(impl){return(imps[lowerCaseWidgetName] = impl)}; - } - - // this is an error condition under new rules - dojo.deprecated('dojo.widget.Manager.getImplementationName', - 'Could not locate widget implementation for "' + widgetName + '" in "' + nsObj.module + '" registered to namespace "' + nsObj.name + '". ' - + "Developers must specify correct namespaces for all non-Dojo widgets", "0.5"); - - // backward compat: if the user has not specified any namespace and their widget is not in dojo.widget.* - // search registered widget packages [sic] - // note: registerWidgetPackage itself is now deprecated - for(var i=0; i 0) { - return widgets[n]; - } - return widgets; - } - g("registerWidgetPackage"); - g("getImplementation", "getWidgetImplementation"); - g("getImplementationName", "getWidgetImplementationName"); - - dw.widgets = dwm.widgets; - dw.widgetIds = dwm.widgetIds; - dw.root = dwm.root; -})(); - -dojo.kwCompoundRequire({ - common: [["dojo.uri.Uri", false, false]] -}); -dojo.provide("dojo.uri.*"); - -dojo.provide("dojo.a11y"); - - - - -dojo.a11y = { - // imgPath: String path to the test image for determining if images are displayed or not - // doAccessibleCheck: Boolean if true will perform check for need to create accessible widgets - // accessible: Boolean uninitialized when null (accessible check has not been performed) - // if true generate accessible widgets - imgPath:dojo.uri.moduleUri("dojo.widget", "templates/images"), - doAccessibleCheck: true, - accessible: null, - - checkAccessible: function(){ - // summary: - // perform check for accessibility if accessibility checking is turned - // on and the accessibility test has not been performed yet - if(this.accessible === null){ - this.accessible = false; //default - if(this.doAccessibleCheck == true){ - this.accessible = this.testAccessible(); - } - } - return this.accessible; /* Boolean */ - }, - - testAccessible: function(){ - // summary: - // Always perform the accessibility check to determine if high - // contrast mode is on or display of images are turned off. Currently only checks - // in IE and Mozilla. - this.accessible = false; //default - if (dojo.render.html.ie || dojo.render.html.mozilla){ - var div = document.createElement("div"); - //div.style.color="rgb(153,204,204)"; - div.style.backgroundImage = "url(\"" + this.imgPath + "/tab_close.gif\")"; - // must add to hierarchy before can view currentStyle below - dojo.body().appendChild(div); - // in FF and IE the value for the current background style of the added div - // will be "none" in high contrast mode - // in FF the return value will be url(invalid-url:) when running over http - var bkImg = null; - if (window.getComputedStyle ) { - var cStyle = getComputedStyle(div, ""); - bkImg = cStyle.getPropertyValue("background-image"); - }else{ - bkImg = div.currentStyle.backgroundImage; - } - var bUseImgElem = false; - if (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)" )) { - this.accessible = true; - } - /* - if(this.accessible == false && document.images){ - // test if images are off in IE - var testImg = new Image(); - if(testImg.fileSize) { - testImg.src = this.imgPath + "/tab_close.gif"; - if(testImg.fileSize < 0){ - this.accessible = true; - } - } - }*/ - dojo.body().removeChild(div); - } - return this.accessible; /* Boolean */ - }, - - setCheckAccessible: function(/* Boolean */ bTest){ - // summary: - // Set whether or not to check for accessibility mode. Default value - // of module is true - perform check for accessibility modes. - // bTest: Boolean - true to check; false to turn off checking - this.doAccessibleCheck = bTest; - }, - - setAccessibleMode: function(){ - // summary: - // perform the accessibility check and sets the correct mode to load - // a11y widgets. Only runs if test for accessiiblity has not been performed yet. - // Call testAccessible() to force the test. - if (this.accessible === null){ - if (this.checkAccessible()){ - dojo.render.html.prefixes.unshift("a11y"); - } - } - return this.accessible; /* Boolean */ - } -}; - -//dojo.hostenv.modulesLoadedListeners.unshift(function() { dojo.a11y.setAccessibleMode(); }); -//dojo.event.connect("before", dojo.hostenv, "makeWidgets", dojo.a11y, "setAccessibleMode"); - -dojo.provide("dojo.widget.Widget"); - - - - - - - - - - -dojo.declare("dojo.widget.Widget", null, - function(){ - // these properties aren't primitives and need to be created on a per-item - // basis. - - // children: Array - // a list of all of the widgets that have been added as children of - // this component. Should only have values if isContainer is true. - this.children = []; - - // extraArgs: Object - // a map of properties which the widget system tried to assign from - // user input but did not correspond to any of the properties set on - // the class prototype. These names will also be available in all - // lower-case form in this map - this.extraArgs = {}; - }, -{ - // parent: Widget - // the parent of this widget - parent: null, - - // isTopLevel: Boolean - // should this widget eat all events that bubble up to it? - // obviously, top-level and modal widgets should set these appropriately - isTopLevel: false, - - // disabled: Boolean - // should this widget respond to user input? - // in markup, this is specified as "disabled='disabled'", or just "disabled" - disabled: false, - - // isContainer: Boolean - // can this widget contain other widgets? - isContainer: false, - - // widgetId: String - // a unique, opaque ID string that can be assigned by users or by the - // system. If the developer passes an ID which is known not to be - // unique, the specified ID is ignored and the system-generated ID is - // used instead. - widgetId: "", - - // widgetType: String - // used for building generic widgets - widgetType: "Widget", - - // ns: String - // defaults to 'dojo'. "namespace" is a reserved word in JavaScript, so we abbreviate - ns: "dojo", - - getNamespacedType: function(){ - // summary: - // get the "full" name of the widget. If the widget comes from the - // "dojo" namespace and is a Button, calling this method will - // return "dojo:button", all lower-case - return (this.ns ? this.ns + ":" + this.widgetType : this.widgetType).toLowerCase(); // String - }, - - toString: function(){ - // summary: - // returns a string that represents the widget. When a widget is - // cast to a string, this method will be used to generate the - // output. Currently, it does not implement any sort of reversable - // serialization. - return '[Widget ' + this.getNamespacedType() + ', ' + (this.widgetId || 'NO ID') + ']'; // String - }, - - repr: function(){ - // summary: returns the string representation of the widget. - return this.toString(); // String - }, - - enable: function(){ - // summary: - // enables the widget, usually involving unmasking inputs and - // turning on event handlers. Not implemented here. - this.disabled = false; - }, - - disable: function(){ - // summary: - // disables the widget, usually involves masking inputs and - // unsetting event handlers. Not implemented here. - this.disabled = true; - }, - - // TODO: - // 1) this would be better in HtmlWidget rather than here? - // 2) since many widgets don't care if they've been resized, maybe this should be a mixin? - onResized: function(){ - // summary: - // A signal that widgets will call when they have been resized. - // Can be connected to for determining if a layout needs to be - // reflowed. Clients should override this function to do special - // processing, then call this.notifyChildrenOfResize() to notify - // children of resize. - this.notifyChildrenOfResize(); - }, - - notifyChildrenOfResize: function(){ - // summary: dispatches resized events to all children of this widget - for(var i=0; i mixInProperties"); - //dojo.profile.start(this.widgetType + " mixInProperties"); - this.mixInProperties(args, fragment, parent); - //dojo.profile.end(this.widgetType + " mixInProperties"); - // dojo.debug(this.widgetType, "-> postMixInProperties"); - //dojo.profile.start(this.widgetType + " postMixInProperties"); - this.postMixInProperties(args, fragment, parent); - //dojo.profile.end(this.widgetType + " postMixInProperties"); - // dojo.debug(this.widgetType, "-> dojo.widget.manager.add"); - dojo.widget.manager.add(this); - // dojo.debug(this.widgetType, "-> buildRendering"); - //dojo.profile.start(this.widgetType + " buildRendering"); - this.buildRendering(args, fragment, parent); - //dojo.profile.end(this.widgetType + " buildRendering"); - // dojo.debug(this.widgetType, "-> initialize"); - //dojo.profile.start(this.widgetType + " initialize"); - this.initialize(args, fragment, parent); - //dojo.profile.end(this.widgetType + " initialize"); - // dojo.debug(this.widgetType, "-> postInitialize"); - // postinitialize includes subcomponent creation - // profile is put directly to function - this.postInitialize(args, fragment, parent); - // dojo.debug(this.widgetType, "-> postCreate"); - //dojo.profile.start(this.widgetType + " postCreate"); - this.postCreate(args, fragment, parent); - //dojo.profile.end(this.widgetType + " postCreate"); - // dojo.debug(this.widgetType, "done!"); - - //dojo.profile.end(this.widgetType + " create"); - - return this; - }, - - destroy: function(finalize){ - // summary: - // Destroy this widget and it's descendants. This is the generic - // "destructor" function that all widget users should call to - // clealy discard with a widget. Once a widget is destroyed, it's - // removed from the manager object. - // finalize: Boolean - // is this function being called part of global environment - // tear-down? - - // FIXME: this is woefully incomplete - if(this.parent){ - this.parent.removeChild(this); - } - this.destroyChildren(); - this.uninitialize(); - this.destroyRendering(finalize); - dojo.widget.manager.removeById(this.widgetId); - }, - - destroyChildren: function(){ - // summary: - // Recursively destroy the children of this widget and their - // descendents. - var widget; - var i=0; - while(this.children.length > i){ - widget = this.children[i]; - if (widget instanceof dojo.widget.Widget) { // find first widget - this.removeChild(widget); - widget.destroy(); - continue; - } - - i++; // skip data object - } - - }, - - getChildrenOfType: function(/*String*/type, recurse){ - // summary: - // return an array of descendant widgets who match the passed type - // recurse: Boolean - // should we try to get all descendants that match? Defaults to - // false. - var ret = []; - var isFunc = dojo.lang.isFunction(type); - if(!isFunc){ - type = type.toLowerCase(); - } - for(var x=0; xsi)){ - this[x][pairs[y].substr(0, si).replace(/^\s+|\s+$/g, "")] = pairs[y].substr(si+1); - } - } - } - }else{ - // the default is straight-up string assignment. When would - // we ever hit this? - this[x] = args[x]; - } - } - }else{ - // collect any extra 'non mixed in' args - this.extraArgs[x.toLowerCase()] = args[x]; - } - } - // dojo.profile.end("mixInProperties"); - }, - - postMixInProperties: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ - // summary - // Called after the parameters to the widget have been read-in, - // but before the widget template is instantiated. - // Especially useful to set properties that are referenced in the widget template. - }, - - initialize: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ - // summary: stub function. - return false; - // dojo.unimplemented("dojo.widget.Widget.initialize"); - }, - - postInitialize: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ - // summary: stub function. - return false; - }, - - postCreate: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ - // summary: stub function. - return false; - }, - - uninitialize: function(){ - // summary: - // stub function. Over-ride to implement custom widget tear-down - // behavior. - return false; - }, - - buildRendering: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ - // summary: stub function. SUBCLASSES MUST IMPLEMENT - dojo.unimplemented("dojo.widget.Widget.buildRendering, on "+this.toString()+", "); - return false; - }, - - destroyRendering: function(){ - // summary: stub function. SUBCLASSES MUST IMPLEMENT - dojo.unimplemented("dojo.widget.Widget.destroyRendering"); - return false; - }, - - addedTo: function(parent){ - // summary: - // stub function this is just a signal that can be caught - // parent: Widget - // instance of dojo.widget.Widget that we were added to - }, - - addChild: function(child){ - // summary: stub function. SUBCLASSES MUST IMPLEMENT - dojo.unimplemented("dojo.widget.Widget.addChild"); - return false; - }, - - // Detach the given child widget from me, but don't destroy it - removeChild: function(/*Widget*/widget){ - // summary: - // removes the passed widget instance from this widget but does - // not destroy it - for(var x=0; x -dojo.widget.tags["dojo:connect"] = function(fragment, widgetParser, parentComp){ - var properties = widgetParser.parseProperties(fragment["dojo:connect"]); -} - -// FIXME: if we know the insertion point (to a reasonable location), why then do we: -// - create a template node -// - clone the template node -// - render the clone and set properties -// - remove the clone from the render tree -// - place the clone -// this is quite dumb -dojo.widget.buildWidgetFromParseTree = function(/*String*/ type, - /*Object*/ frag, - /*dojo.widget.Parse*/ parser, - /*Widget, optional*/ parentComp, - /*int, optional*/ insertionIndex, - /*Object*/ localProps){ - - // summary: creates a tree of widgets from the data structure produced by the first-pass parser (frag) - - // test for accessibility mode - dojo.a11y.setAccessibleMode(); - //dojo.profile.start("buildWidgetFromParseTree"); - // FIXME: for codepath from createComponentFromScript, we are now splitting a path - // that we already split and then joined - var stype = type.split(":"); - stype = (stype.length == 2) ? stype[1] : type; - - // FIXME: we don't seem to be doing anything with this! - // var propertySets = parser.getPropertySets(frag); - var localProperties = localProps || parser.parseProperties(frag[frag["ns"]+":"+stype]); - var twidget = dojo.widget.manager.getImplementation(stype,null,null,frag["ns"]); - if(!twidget){ - throw new Error('cannot find "' + type + '" widget'); - }else if (!twidget.create){ - throw new Error('"' + type + '" widget object has no "create" method and does not appear to implement *Widget'); - } - localProperties["dojoinsertionindex"] = insertionIndex; - // FIXME: we lose no less than 5ms in construction! - var ret = twidget.create(localProperties, frag, parentComp, frag["ns"]); - // dojo.profile.end("buildWidgetFromParseTree"); - return ret; -} - -dojo.widget.defineWidget = function(widgetClass, renderer, superclasses, init, props){ - // summary: Create a widget constructor function (aka widgetClass) - // widgetClass: String - // the location in the object hierarchy to place the new widget class constructor - // renderer: String - // usually "html", determines when this delcaration will be used - // superclasses: Function||Function[] - // can be either a single function or an array of functions to be - // mixed in as superclasses. If an array, only the first will be used - // to set prototype inheritance. - // init: Function - // an optional constructor function. Will be called after superclasses are mixed in. - // props: Object - // a map of properties and functions to extend the class prototype with - - // This meta-function does parameter juggling for backward compat and overloading - // if 4th argument is a string, we are using the old syntax - // old sig: widgetClass, superclasses, props (object), renderer (string), init (function) - if(dojo.lang.isString(arguments[3])){ - dojo.widget._defineWidget(arguments[0], arguments[3], arguments[1], arguments[4], arguments[2]); - }else{ - // widgetClass - var args = [ arguments[0] ], p = 3; - if(dojo.lang.isString(arguments[1])){ - // renderer, superclass - args.push(arguments[1], arguments[2]); - }else{ - // superclass - args.push('', arguments[1]); - p = 2; - } - if(dojo.lang.isFunction(arguments[p])){ - // init (function), props (object) - args.push(arguments[p], arguments[p+1]); - }else{ - // props (object) - args.push(null, arguments[p]); - } - dojo.widget._defineWidget.apply(this, args); - } -} - -dojo.widget.defineWidget.renderers = "html|svg|vml"; - -dojo.widget._defineWidget = function(widgetClass /*string*/, renderer /*string*/, superclasses /*function||array*/, init /*function*/, props /*object*/){ - // FIXME: uncomment next line to test parameter juggling ... remove when confidence improves - // dojo.debug('(c:)' + widgetClass + '\n\n(r:)' + renderer + '\n\n(i:)' + init + '\n\n(p:)' + props); - // widgetClass takes the form foo.bar.baz<.renderer>.WidgetName (e.g. foo.bar.baz.WidgetName or foo.bar.baz.html.WidgetName) - var module = widgetClass.split("."); - var type = module.pop(); // type <= WidgetName, module <= foo.bar.baz<.renderer> - var regx = "\\.(" + (renderer ? renderer + '|' : '') + dojo.widget.defineWidget.renderers + ")\\."; - var r = widgetClass.search(new RegExp(regx)); - module = (r < 0 ? module.join(".") : widgetClass.substr(0, r)); - - // deprecated in favor of namespace system, remove for 0.5 - dojo.widget.manager.registerWidgetPackage(module); - - var pos = module.indexOf("."); - var nsName = (pos > -1) ? module.substring(0,pos) : module; - - // FIXME: hrm, this might make things simpler - //dojo.widget.tags.addParseTreeHandler(nsName+":"+type.toLowerCase()); - - props=(props)||{}; - props.widgetType = type; - if((!init)&&(props["classConstructor"])){ - init = props.classConstructor; - delete props.classConstructor; - } - dojo.declare(widgetClass, superclasses, init, props); -} - -dojo.provide("dojo.widget.Parse"); - - - -// -// dojoML parser should be moved out of 'widget', codifying the difference between a 'component' -// and a 'widget'. A 'component' being anything that can be generated from a tag. -// -// a particular dojoML tag would be handled by a registered tagHandler with a hook for a default handler -// if the widget system is loaded, a widget builder would be attach itself as the default handler -// -// widget tags are no longer registered themselves: -// they are now arbitrarily namespaced, so we cannot register them all, and the non-prefixed portions -// are no longer guaranteed unique -// -// therefore dojo.widget.tags should go with this parser code out of the widget module -// - -dojo.widget.Parse = function(/*Object*/fragment){ - this.propertySetsList = []; - this.fragment = fragment; - - this.createComponents = function(/*Object*/frag, /*Object*/parentComp){ - var comps = []; - var built = false; - // if we have items to parse/create at this level, do it! - try{ - if(frag && frag.tagName && (frag != frag.nodeRef)){ - - // these are in fact, not ever for widgets per-se anymore, - // but for other markup elements (aka components) - var djTags = dojo.widget.tags; - - // we split so that you can declare multiple - // non-destructive components from the same ctor node - var tna = String(frag.tagName).split(";"); - for(var x=0; x -1) ? name.substring(0,pos) : "dojo"; - if(pos > -1){ name = name.substring(pos+1); } - var lowerCaseName = name.toLowerCase(); - var namespacedName = ns + ":" + lowerCaseName; - isNode = (dojo.byId(name) && !dojo.widget.tags[namespacedName]); - } - - if((arguments.length == 1) && (isNode || !isNameStr)){ - // we got a DOM node - var xp = new dojo.xml.Parse(); - // FIXME: we should try to find the parent! - var tn = isNode ? dojo.byId(name) : name; - return dojo.widget.getParser().createComponents(xp.parseElement(tn, null, true))[0]; - } - - function fromScript(placeKeeperNode, name, props, ns){ - props[namespacedName] = { - dojotype: [{value: lowerCaseName}], - nodeRef: placeKeeperNode, - fastMixIn: true - }; - props.ns = ns; - return dojo.widget.getParser().createComponentFromScript(placeKeeperNode, name, props, ns); - } - - props = props||{}; - var notRef = false; - var tn = null; - var h = dojo.render.html.capable; - if(h){ - tn = document.createElement("span"); - } - if(!refNode){ - notRef = true; - refNode = tn; - if(h){ - dojo.body().appendChild(refNode); - } - }else if(position){ - dojo.dom.insertAtPosition(tn, refNode, position); - }else{ // otherwise don't replace, but build in-place - tn = refNode; - } - var widgetArray = fromScript(tn, name.toLowerCase(), props, ns); - if( (!widgetArray)||(!widgetArray[0])|| - (typeof widgetArray[0].widgetType == "undefined") ){ - throw new Error("createWidget: Creation of \"" + name + "\" widget failed."); - } - try{ - if(notRef && widgetArray[0].domNode.parentNode){ - widgetArray[0].domNode.parentNode.removeChild(widgetArray[0].domNode); - } - }catch(e){ - /* squelch for Safari */ - dojo.debug(e); - } - return widgetArray[0]; // Widget -} - -dojo.provide("dojo.widget.DomWidget"); - - - - - - - - - - -dojo.widget._cssFiles = {}; -dojo.widget._cssStrings = {}; -dojo.widget._templateCache = {}; - -dojo.widget.defaultStrings = { - // summary: a mapping of strings that are used in template variable replacement - dojoRoot: dojo.hostenv.getBaseScriptUri(), - dojoWidgetModuleUri: dojo.uri.moduleUri("dojo.widget"), - baseScriptUri: dojo.hostenv.getBaseScriptUri() -}; - -dojo.widget.fillFromTemplateCache = function(obj, templatePath, templateString, avoidCache){ - // summary: - // static method to build from a template w/ or w/o a real widget in - // place - // obj: DomWidget - // an instance of dojo.widget.DomWidget to initialize the template for - // templatePath: String - // the URL to get the template from. dojo.uri.Uri is often passed as well. - // templateString: String? - // a string to use in lieu of fetching the template from a URL - // avoidCache: Boolean? - // should the template system not use whatever is in the cache and - // always use the passed templatePath or templateString? - - // dojo.debug("avoidCache:", avoidCache); - var tpath = templatePath || obj.templatePath; - - var tmplts = dojo.widget._templateCache; - if(!tpath && !obj["widgetType"]) { // don't have a real template here - 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)){ - // fetch a text fragment and assign it to templateString - // NOTE: we rely on blocking IO here! - 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(/*String*/tString){ - //summary: Strips declarations so that external SVG and XML - //documents can be added to a document without worry. Also, if the string - //is an HTML document, only the part inside the body tag is returned. - 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; //String -} - -dojo.widget._templateCache.dummyCount = 0; - -// Array: list of properties to search for node-to-property mappings -dojo.widget.attachProperties = ["dojoAttachPoint", "id"]; - -// String: name of the property to use for mapping DOM events to widget functions -dojo.widget.eventAttachProperty = "dojoAttachEvent"; - -// String: property name of code to evaluate when the widget is constructed -dojo.widget.onBuildProperty = "dojoOnBuild"; - -// Array: possible accessibility values to set on widget elements - role or state -dojo.widget.waiNames = ["waiRole", "waiState"]; - -dojo.widget.wai = { - // summary: Contains functions to set accessibility roles and states - // onto widget elements - waiRole: { - // name: String: - // information for mapping accessibility role - name: "waiRole", - // namespace: String: - // URI of the namespace for the set of roles - "namespace": "http://www.w3.org/TR/xhtml2", - // alias: String: - // The alias to assign the namespace - alias: "x2", - // prefix: String: - // The prefix to assign to the role value - prefix: "wairole:" - }, - waiState: { - // name: String: - // information for mapping accessibility state - name: "waiState", - // namespace: String: - // URI of the namespace for the set of states - "namespace": "http://www.w3.org/2005/07/aaa", - // alias: String: - // The alias to assign the namespace - alias: "aaa", - // prefix: String: - // empty string - state value does not require prefix - prefix: "" - }, - setAttr: function(/*DomNode*/node, /*String*/ ns, /*String*/ attr, /*String|Boolean*/value){ - // summary: Use appropriate API to set the role or state attribute onto the element. - // description: In IE use the generic setAttribute() api. Append a namespace - // alias to the attribute name and appropriate prefix to the value. - // Otherwise, use the setAttribueNS api to set the namespaced attribute. Also - // add the appropriate prefix to the attribute 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(/*DomNode*/ node, /*String*/ ns, /*String|Boolena*/ attr){ - // Summary: Use the appropriate API to retrieve the role or state value - // Description: In IE use the generic getAttribute() api. An alias value - // was added to the attribute name to simulate a namespace when the attribute - // was set. Otherwise use the getAttributeNS() api to retrieve the state value - if(dojo.render.html.ie){ - return node.getAttribute(this[ns].alias+":"+attr); - }else{ - return node.getAttributeNS(this[ns]["namespace"], attr); - } - }, - removeAttr: function(/*DomNode*/ node, /*String*/ ns, /*String|Boolena*/ attr){ - // summary: Use the appropriate API to remove the role or state value - // description: In IE use the generic removeAttribute() api. An alias value - // was added to the attribute name to simulate a namespace when the attribute - // was set. Otherwise use the removeAttributeNS() api to remove the state value - var success = true; //only IE returns a value - 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, /*Widget*/ targetObj, events ){ - // summary: - // map widget properties and functions to the handlers specified in - // the dom node and it's descendants. This function iterates over all - // nodes and looks for these properties: - // * dojoAttachPoint - // * dojoAttachEvent - // * waiRole - // * waiState - // * any "dojoOn*" proprties passed in the events array - // rootNode: DomNode - // the node to search for properties. All children will be searched. - // events: Array - // a list of properties generated from getDojoEventsFromStr. - - // FIXME: this method is still taking WAAAY too long. We need ways of optimizing: - // a.) what we are looking for on each node - // b.) the nodes that are subject to interrogation (use xpath instead?) - // c.) how expensive event assignment is (less eval(), more connect()) - // var start = new Date(); - 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; - } - // alert(events.length); - - var nodes = rootNode.all || rootNode.getElementsByTagName("*"); - var _this = targetObj; - for(var x=-1; x= 0){ - // oh, if only JS had tuple assignment - 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); - // dojo.event.browser.addListener(baseNode, tevt, dojo.lang.hitch(_this, thisFunc)); - } - } - - for(var y=0; y=0){ - funcs = dojo.lang.map(thisFunc.split(";"), trim); - } - for(var z=0; z0)&&(typeof arguments[0] == "object")){ - this.create(arguments[0]); - } - }, - { - // templateNode: DomNode - // a node that represents the widget template. Pre-empts both templateString and templatePath. - templateNode: null, - - // templateString String: - // a string that represents the widget template. Pre-empts the - // templatePath. In builds that have their strings "interned", the - // templatePath is converted to an inline templateString, thereby - // preventing a synchronous network call. - templateString: null, - - // templateCssString String: - // a string that represents the CSS for the widgettemplate. - // Pre-empts the templateCssPath. In builds that have their - // strings "interned", the templateCssPath is converted to an - // inline templateCssString, thereby preventing a synchronous - // network call. - templateCssString: null, - - // preventClobber Boolean: - // should the widget not replace the node from which it was - // constructed? Widgets that apply behaviors to pre-existing parts - // of a page can be implemented easily by setting this to "true". - // In these cases, the domNode property will point to the node - // which the widget was created from. - preventClobber: false, - - // domNode DomNode: - // this is our visible representation of the widget! Other DOM - // Nodes may by assigned to other properties, usually through the - // template system's dojoAttachPonit syntax, but the domNode - // property is the canonical "top level" node in widget UI. - domNode: null, - - // containerNode DomNode: - // holds child elements. "containerNode" is generally set via a - // dojoAttachPoint assignment and it designates where widgets that - // are defined as "children" of the parent will be placed - // visually. - containerNode: null, - - // widgetsInTemplate Boolean: - // should we parse the template to find widgets that might be - // declared in markup inside it? false by default. - widgetsInTemplate: false, - - addChild: function(/*Widget*/ widget, overrideContainerNode, pos, ref, insertIndex){ - // summary: - // Process the given child widget, inserting it's dom node as - // a child of our dom node - // overrideContainerNode: DomNode? - // a non-default container node for the widget - // pos: String? - // can be one of "before", "after", "first", or "last". This - // has the same meaning as in dojo.dom.insertAtPosition() - // ref: DomNode? - // a node to place the widget relative to - // insertIndex: int? - // DOM index, same meaning as in dojo.dom.insertAtIndex() - // returns: the widget that was inserted - - // FIXME: should we support addition at an index in the children arr and - // order the display accordingly? Right now we always append. - if(!this.isContainer){ // we aren't allowed to contain other widgets, it seems - 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; // Widget - }, - - addWidgetAsDirectChild: function(/*Widget*/ widget, overrideContainerNode, pos, ref, insertIndex){ - // summary: - // Process the given child widget, inserting it's dom node as - // a child of our dom node - // overrideContainerNode: DomNode - // a non-default container node for the widget - // pos: String? - // can be one of "before", "after", "first", or "last". This - // has the same meaning as in dojo.dom.insertAtPosition() - // ref: DomNode? - // a node to place the widget relative to - // insertIndex: int? - // DOM index, same meaning as in dojo.dom.insertAtIndex() - 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); - - // insert the child widget domNode directly underneath my domNode, in the - // specified position (by default, append to end) - if(!ref){ - cn.appendChild(widget.domNode); - }else{ - // FIXME: was this meant to be the (ugly hack) way to support insert @ index? - //dojo.dom[pos](widget.domNode, ref, insertIndex); - - // CAL: this appears to be the intended way to insert a node at a given position... - if (pos == 'insertAtIndex'){ - // dojo.debug("idx:", insertIndex, "isLast:", ref === cn.lastChild); - dojo.dom.insertAtIndex(widget.domNode, ref.parentNode, insertIndex); - }else{ - // dojo.debug("pos:", pos, "isLast:", ref === cn.lastChild); - if((pos == "after")&&(ref === cn.lastChild)){ - cn.appendChild(widget.domNode); - }else{ - dojo.dom.insertAtPosition(widget.domNode, cn, pos); - } - } - } - }, - - registerChild: function(widget, insertionIndex){ - // summary: record that given widget descends from me - // widget: Widget - // the widget that is now a child - // insertionIndex: int - // where in the children[] array to place it - - // we need to insert the child at the right point in the parent's - // 'children' array, based on the insertionIndex - - widget.dojoInsertionIndex = insertionIndex; - - var idx = -1; - for(var i=0; i node that can't be inserted back into the original DOM tree - parentComp.addWidgetAsDirectChild(this, "", "insertAtIndex", "", args["dojoinsertionindex"], sourceNodeRef); - } else if (sourceNodeRef){ - // Do in-place replacement of the my source node with my generated dom - if(this.domNode && (this.domNode !== sourceNodeRef)){ - this._sourceNodeRef = dojo.dom.replaceNode(sourceNodeRef, this.domNode); - } - } - - // Register myself with my parent, or with the widget manager if - // I have no parent - // TODO: the code below erroneously adds all programatically generated widgets - // to topWidgets (since we don't know who the parent is until after creation finishes) - 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; - //TODO: use xpath here? - var subnodes = this.domNode.getElementsByTagName("*"); - for(var i=0;i= 0){ - // oh, if only JS had tuple assignment - 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']){ - //don't attach widget.domNode here, as we do not know which - //dom node we should connect to (in checkbox widget case, - //it is inputNode). So we make the widget itself available - this[widget.extraArgs['dojoattachpoint']] = widget; - } - } - } - - //dojo.profile.end(this.widgetType + " postInitialize"); - - // Expand my children widgets - /* dojoDontFollow is important for a very special case - * basically if you have a widget that you instantiate from script - * and that widget is a container, and it contains a reference to a parent - * instance, the parser will start recursively parsing until the browser - * complains. So the solution is to set an initialization property of - * dojoDontFollow: true and then it won't recurse where it shouldn't - */ - if(this.isContainer && !frag["dojoDontFollow"]){ - //alert("recurse from " + this.widgetId); - // build any sub-components with us as the parent - dojo.widget.getParser().createSubComponents(frag, this); - } - }, - - // method over-ride - buildRendering: function(/*Object*/ args, /*Object*/ frag){ - // summary: - // Construct the UI for this widget, generally from a - // template. This can be over-ridden for custom UI creation to - // to side-step the template system. This is an - // implementation of the stub function defined in - // dojo.widget.Widget. - - // DOM widgets construct themselves from a template - var ts = dojo.widget._templateCache[this.widgetType]; - - // Handle style for this widget here, as even if templatePath - // is not set, style specified by templateCssString or templateCssPath - // should be applied. templateCssString has higher priority - // than templateCssPath - 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"]) ) - ) - ) - ){ - // if it looks like we can build the thing from a template, do it! - this.buildFromTemplate(args, frag); - }else{ - // otherwise, assign the DOM node that was the source of the widget - // parsing to be the root node - this.domNode = this.getFragNodeRef(frag); - } - this.fillInTemplate(args, frag); // this is where individual widgets - // will handle population of data - // from properties, remote data - // sets, etc. - }, - - buildFromTemplate: function(/*Object*/ args, /*Object*/ frag){ - // summary: - // Called by buildRendering, creates the actual UI in a DomWidget. - - // var start = new Date(); - // copy template properties if they're already set in the templates object - // dojo.debug("buildFromTemplate:", this); - var avoidCache = false; - if(args["templatepath"]){ -// avoidCache = true; - 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 = new String(this.templateString); - var tstr = this.templateString; - // attempt to clone a template node, if there is one - if((!this.templateNode)&&(this.templateString)){ - matches = this.templateString.match(/\$\{([^\}]+)\}/g); - if(matches) { - // if we do property replacement, don't create a templateNode - // to clone from. - var hash = this.strings || {}; - // FIXME: should this hash of default replacements be cached in - // templateString? - for(var key in dojo.widget.defaultStrings) { - if(dojo.lang.isUndefined(hash[key])) { - hash[key] = dojo.widget.defaultStrings[key]; - } - } - // FIXME: this is a lot of string munging. Can we make it faster? - 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); - // Safer substitution, see heading "Attribute values" in - // http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2 - while (value.indexOf("\"") > -1) { - value=value.replace("\"","""); - } - tstr = tstr.replace(matches[i], value); - } - } - }else{ - // otherwise, we are required to instantiate a copy of the template - // string if one is provided. - - // FIXME: need to be able to distinguish here what should be done - // or provide a generic interface across all DOM implementations - // FIMXE: this breaks if the template has whitespace as its first - // characters - // node = this.createNodesFromText(this.templateString, true); - // this.templateNode = node[0].cloneNode(true); // we're optimistic here - 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]; - } - - // recurse through the node, looking for, and attaching to, our - // attachment points which should be defined on the template node. - - this.domNode = node; - // dojo.profile.start("attachTemplateNodes"); - this.attachTemplateNodes(); - // dojo.profile.end("attachTemplateNodes"); - - // relocate source contents to templated container node - // this.containerNode must be able to receive children, or exceptions will be thrown - if (this.isContainer && this.containerNode){ - var src = this.getFragNodeRef(frag); - if (src){ - dojo.dom.moveChildren(src, this.containerNode); - } - } - }, - - attachTemplateNodes: function(baseNode, targetObj){ - // summary: - // hooks up event handlers and property/node linkages. Calls - // dojo.widget.attachTemplateNodes to do all the hard work. - // baseNode: DomNode - // defaults to "this.domNode" - // targetObj: Widget - // defaults to "this" - if(!baseNode){ baseNode = this.domNode; } - if(!targetObj){ targetObj = this; } - return dojo.widget.attachTemplateNodes(baseNode, targetObj, - dojo.widget.getDojoEventsFromStr(this.templateString)); - }, - - fillInTemplate: function(){ - // summary: - // stub function! sub-classes may use as a default UI - // initializer function. The UI rendering will be available by - // the time this is called from buildRendering. If - // buildRendering is over-ridden, this function may not be - // fired! - - // dojo.unimplemented("dojo.widget.DomWidget.fillInTemplate"); - }, - - // method over-ride - destroyRendering: function(){ - // summary: UI destructor. Destroy the dom nodes associated w/this widget. - try{ - dojo.dom.destroyNode(this.domNode); - delete this.domNode; - }catch(e){ /* squelch! */ } - if(this._sourceNodeRef){ - try{ - dojo.dom.destroyNode(this._sourceNodeRef); - }catch(e){ /* squelch! */ } - } - }, - - createNodesFromText: function(){ - // summary - // Attempts to create a set of nodes based on the structure of the passed text. - // Implemented in HtmlWidget and SvgWidget. - dojo.unimplemented("dojo.widget.DomWidget.createNodesFromText"); - } - } -); - -dojo.provide("dojo.html.util"); - - -dojo.html.getElementWindow = function(/* HTMLElement */element){ - // summary - // Get the window object where the element is placed in. - return dojo.html.getDocumentWindow( element.ownerDocument ); // Window -} - -dojo.html.getDocumentWindow = function(doc){ - // summary - // Get window object associated with document doc - - // With Safari, there is not wa to retrieve the window from the document, so we must fix it. - if(dojo.render.html.safari && !doc._parentWindow){ - /* - This is a Safari specific function that fix the reference to the parent - window from the document object. - */ - - var fix=function(win){ - win.document._parentWindow=win; - for(var i=0; i - // If you wanted to insert a node into a DOM tree based on the mouse - // position you might use the following code: - //
-	//	if (gravity(node, e) & gravity.NORTH) { [insert before]; }
-	//	else { [insert after]; }
-	//	
- // - // @param node The node - // @param e The event containing the mouse coordinates - // @return The directions, NORTH or SOUTH and EAST or WEST. These - // are properties of the function. - node = dojo.byId(node); - var mouse = dojo.html.getCursorPosition(e); - - with (dojo.html) { - var absolute = getAbsolutePosition(node, true); - var bb = getBorderBox(node); - var nodecenterx = absolute.x + (bb.width / 2); - var nodecentery = absolute.y + (bb.height / 2); - } - - with (dojo.html.gravity) { - return ((mouse.x < nodecenterx ? WEST : EAST) | (mouse.y < nodecentery ? NORTH : SOUTH)); // integer - } -} - -dojo.html.gravity.NORTH = 1; -dojo.html.gravity.SOUTH = 1 << 1; -dojo.html.gravity.EAST = 1 << 2; -dojo.html.gravity.WEST = 1 << 3; - -dojo.html.overElement = function(/* HTMLElement */element, /* DOMEvent */e){ - // summary - // Returns whether the mouse is over the passed element. - // Element must be display:block (ie, not a ) - element = dojo.byId(element); - var mouse = dojo.html.getCursorPosition(e); - var bb = dojo.html.getBorderBox(element); - var absolute = dojo.html.getAbsolutePosition(element, true, dojo.html.boxSizing.BORDER_BOX); - var top = absolute.y; - var bottom = top + bb.height; - var left = absolute.x; - var right = left + bb.width; - - return (mouse.x >= left - && mouse.x <= right - && mouse.y >= top - && mouse.y <= bottom - ); // boolean -} - -dojo.html.renderedTextContent = function(/* HTMLElement */node){ - // summary - // Attempts to return the text as it would be rendered, with the line breaks - // sorted out nicely. Unfinished. - node = dojo.byId(node); - var result = ""; - if (node == null) { return result; } - for (var i = 0; i < node.childNodes.length; i++) { - switch (node.childNodes[i].nodeType) { - case 1: // ELEMENT_NODE - case 5: // ENTITY_REFERENCE_NODE - var display = "unknown"; - try { - display = dojo.html.getStyle(node.childNodes[i], "display"); - } catch(E) {} - switch (display) { - case "block": case "list-item": case "run-in": - case "table": case "table-row-group": case "table-header-group": - case "table-footer-group": case "table-row": case "table-column-group": - case "table-column": case "table-cell": case "table-caption": - // TODO: this shouldn't insert double spaces on aligning blocks - result += "\n"; - result += dojo.html.renderedTextContent(node.childNodes[i]); - result += "\n"; - break; - - case "none": break; - - default: - if(node.childNodes[i].tagName && node.childNodes[i].tagName.toLowerCase() == "br") { - result += "\n"; - } else { - result += dojo.html.renderedTextContent(node.childNodes[i]); - } - break; - } - break; - case 3: // TEXT_NODE - case 2: // ATTRIBUTE_NODE - case 4: // CDATA_SECTION_NODE - var text = node.childNodes[i].nodeValue; - var textTransform = "unknown"; - try { - textTransform = dojo.html.getStyle(node, "text-transform"); - } catch(E) {} - switch (textTransform){ - case "capitalize": - var words = text.split(' '); - for(var i=0; i]/i).test(txt.replace(/^\s+/))) { - txt = "" + txt + "
"; - tableType = "cell"; - } else if((/^]/i).test(txt.replace(/^\s+/))) { - txt = "" + txt + "
"; - tableType = "row"; - } else if((/^<(thead|tbody|tfoot)[\s\r\n>]/i).test(txt.replace(/^\s+/))) { - txt = "" + txt + "
"; - tableType = "section"; - } - tn.innerHTML = txt; - if(tn["normalize"]){ - tn.normalize(); - } - - var parent = null; - switch(tableType) { - case "cell": - parent = tn.getElementsByTagName("tr")[0]; - break; - case "row": - parent = tn.getElementsByTagName("tbody")[0]; - break; - case "section": - parent = tn.getElementsByTagName("table")[0]; - break; - default: - parent = tn; - break; - } - - /* this doesn't make much sense, I'm assuming it just meant trim() so wrap was replaced with trim - if(wrap){ - var ret = []; - // start hack - var fc = tn.firstChild; - ret[0] = ((fc.nodeValue == " ")||(fc.nodeValue == "\t")) ? fc.nextSibling : fc; - // end hack - // tn.style.display = "none"; - dojo.body().removeChild(tn); - return ret; - } - */ - var nodes = []; - for(var x=0; x view.width) { - x = view.width - w; - match = false; - } else { - x = tryX; - } - x = Math.max(padding[0], x) + scroll.x; - - var y = tryY + h; - if(y > view.height) { - y = view.height - h; - match = false; - } else { - y = tryY; - } - y = Math.max(padding[1], y) + scroll.y; - - if(match){ //perfect match, return now - bestx = x; - besty = y; - bestDistance = 0; - bestCorner = corner; - break; - }else{ - //not perfect, find out whether it is better than the saved one - var dist = Math.pow(x-tryX-scroll.x,2)+Math.pow(y-tryY-scroll.y,2); - if(bestDistance > dist){ - bestDistance = dist; - bestx = x; - besty = y; - bestCorner = corner; - } - } - } - - if(!tryOnly){ - node.style.left = bestx + "px"; - node.style.top = besty + "px"; - } - - return { left: bestx, top: besty, x: bestx, y: besty, dist: bestDistance, corner: bestCorner}; // object -} - -dojo.html.placeOnScreenPoint = function(node, desiredX, desiredY, padding, hasScroll) { - dojo.deprecated("dojo.html.placeOnScreenPoint", "use dojo.html.placeOnScreen() instead", "0.5"); - return dojo.html.placeOnScreen(node, desiredX, desiredY, padding, hasScroll, ['TL', 'TR', 'BL', 'BR']); -} - -dojo.html.placeOnScreenAroundElement = function( - /* HTMLElement */node, - /* HTMLElement */aroundNode, - /* integer */padding, - /* string? */aroundType, - /* string? */aroundCorners, - /* boolean? */tryOnly -){ - // summary - // Like placeOnScreen, except it accepts aroundNode instead of x,y - // and attempts to place node around it. aroundType (see - // dojo.html.boxSizing in html/layout.js) determines which box of the - // aroundNode should be used to calculate the outer box. - // aroundCorners specify Which corner of aroundNode should be - // used to place the node => which corner(s) of node to use (see the - // corners parameter in dojo.html.placeOnScreen) - // aroundCorners: {'TL': 'BL', 'BL': 'TL'} - - var best, bestDistance=Infinity; - aroundNode = dojo.byId(aroundNode); - var oldDisplay = aroundNode.style.display; - aroundNode.style.display=""; - var mb = dojo.html.getElementBox(aroundNode, aroundType); - var aroundNodeW = mb.width; - var aroundNodeH = mb.height; - var aroundNodePos = dojo.html.getAbsolutePosition(aroundNode, true, aroundType); - aroundNode.style.display=oldDisplay; - - for(var nodeCorner in aroundCorners){ - var pos, desiredX, desiredY; - var corners = aroundCorners[nodeCorner]; - - desiredX = aroundNodePos.x + (nodeCorner.charAt(1)=='L' ? 0 : aroundNodeW); - desiredY = aroundNodePos.y + (nodeCorner.charAt(0)=='T' ? 0 : aroundNodeH); - - pos = dojo.html.placeOnScreen(node, desiredX, desiredY, padding, true, corners, true); - if(pos.dist == 0){ - best = pos; - break; - }else{ - //not perfect, find out whether it is better than the saved one - if(bestDistance > pos.dist){ - bestDistance = pos.dist; - best = pos; - } - } - } - - if(!tryOnly){ - node.style.left = best.left + "px"; - node.style.top = best.top + "px"; - } - return best; // object -} - -dojo.html.scrollIntoView = function(/* HTMLElement */node){ - // summary - // Scroll the passed node into view, if it is not. - if(!node){ return; } - - // don't rely on that node.scrollIntoView works just because the function is there - // it doesnt work in Konqueror or Opera even though the function is there and probably - // not safari either - // dont like browser sniffs implementations but sometimes you have to use it - if(dojo.render.html.ie){ - //only call scrollIntoView if there is a scrollbar for this menu, - //otherwise, scrollIntoView will scroll the window scrollbar - if(dojo.html.getBorderBox(node.parentNode).height <= node.parentNode.scrollHeight){ - node.scrollIntoView(false); - } - }else if(dojo.render.html.mozilla){ - // IE, mozilla - node.scrollIntoView(false); - }else{ - var parent = node.parentNode; - var parentBottom = parent.scrollTop + dojo.html.getBorderBox(parent).height; - var nodeBottom = node.offsetTop + dojo.html.getMarginBox(node).height; - if(parentBottom < nodeBottom){ - parent.scrollTop += (nodeBottom - parentBottom); - }else if(parent.scrollTop > node.offsetTop){ - parent.scrollTop -= (parent.scrollTop - node.offsetTop); - } - } -} - -dojo.provide("dojo.lfx.toggle"); - - -dojo.lfx.toggle.plain = { - show: function(node, duration, easing, callback){ - dojo.html.show(node); - if(dojo.lang.isFunction(callback)){ callback(); } - }, - - hide: function(node, duration, easing, callback){ - dojo.html.hide(node); - if(dojo.lang.isFunction(callback)){ callback(); } - } -} - -dojo.lfx.toggle.fade = { - show: function(node, duration, easing, callback){ - dojo.lfx.fadeShow(node, duration, easing, callback).play(); - }, - - hide: function(node, duration, easing, callback){ - dojo.lfx.fadeHide(node, duration, easing, callback).play(); - } -} - -dojo.lfx.toggle.wipe = { - show: function(node, duration, easing, callback){ - dojo.lfx.wipeIn(node, duration, easing, callback).play(); - }, - - hide: function(node, duration, easing, callback){ - dojo.lfx.wipeOut(node, duration, easing, callback).play(); - } -} - -dojo.lfx.toggle.explode = { - show: function(node, duration, easing, callback, explodeSrc){ - dojo.lfx.explode(explodeSrc||{x:0,y:0,width:0,height:0}, node, duration, easing, callback).play(); - }, - - hide: function(node, duration, easing, callback, explodeSrc){ - dojo.lfx.implode(node, explodeSrc||{x:0,y:0,width:0,height:0}, duration, easing, callback).play(); - } -} - -dojo.provide("dojo.widget.HtmlWidget"); - - - - - - - - -dojo.declare("dojo.widget.HtmlWidget", dojo.widget.DomWidget, { - // summary - // Base class for all browser based widgets, or at least "html" widgets. - // The meaning of "html" has become unclear; in practice, all widgets derive from this class. - - // templateCssPath: String - // Path to CSS file for this widget - templateCssPath: null, - - // templatePath: String - // Path to template (HTML file) for this widget - templatePath: null, - - // lang: String - // Language to display this widget in (like en-us). - // Defaults to brower's specified preferred language (typically the language of the OS) - lang: "", - - // toggle: String - // Controls animation effect for when show() and hide() (or toggle()) are called. - // Possible values: "plain", "wipe", "fade", "explode" - toggle: "plain", - - // toggleDuration: Integer - // Number of milliseconds for toggle animation effect to complete - toggleDuration: 150, - - initialize: function(args, frag){ - // summary: called after the widget is rendered; most subclasses won't override or call this function - }, - - postMixInProperties: function(args, frag){ - if(this.lang === ""){this.lang = null;} - // now that we know the setting for toggle, get toggle object - // (default to plain toggler if user specified toggler not present) - this.toggleObj = - dojo.lfx.toggle[this.toggle.toLowerCase()] || dojo.lfx.toggle.plain; - }, - - createNodesFromText: function(txt, wrap){ - return dojo.html.createNodesFromText(txt, wrap); - }, - - destroyRendering: function(finalize){ - try{ - if(this.bgIframe){ - this.bgIframe.remove(); - delete this.bgIframe; - } - if(!finalize && this.domNode){ - dojo.event.browser.clean(this.domNode); - } - dojo.widget.HtmlWidget.superclass.destroyRendering.call(this); - }catch(e){ /* squelch! */ } - }, - - ///////////////////////////////////////////////////////// - // Displaying/hiding the widget - ///////////////////////////////////////////////////////// - isShowing: function(){ - // summary - // Tests whether widget is set to show-mode or hide-mode (see show() and - // hide() methods) - // - // This function is poorly named. Even if widget is in show-mode, - // if it's inside a container that's hidden - // (either a container widget, or just a domnode with display:none), - // then it won't be displayed - return dojo.html.isShowing(this.domNode); // Boolean - }, - - toggleShowing: function(){ - // summary: show or hide the widget, to switch it's state - if(this.isShowing()){ - this.hide(); - }else{ - this.show(); - } - }, - - show: function(){ - // summary: show the widget - if(this.isShowing()){ return; } - this.animationInProgress=true; - this.toggleObj.show(this.domNode, this.toggleDuration, null, - dojo.lang.hitch(this, this.onShow), this.explodeSrc); - }, - - onShow: function(){ - // summary: called after the show() animation has completed - this.animationInProgress=false; - this.checkSize(); - }, - - hide: function(){ - // summary: hide the widget (ending up with display:none) - if(!this.isShowing()){ return; } - this.animationInProgress = true; - this.toggleObj.hide(this.domNode, this.toggleDuration, null, - dojo.lang.hitch(this, this.onHide), this.explodeSrc); - }, - - onHide: function(){ - // summary: called after the hide() animation has completed - this.animationInProgress=false; - }, - - ////////////////////////////////////////////////////////////////////////////// - // Sizing related methods - // If the parent changes size then for each child it should call either - // - resizeTo(): size the child explicitly - // - or checkSize(): notify the child the the parent has changed size - ////////////////////////////////////////////////////////////////////////////// - - _isResized: function(w, h){ - // summary - // Test if my size has changed. - // If width & height are specified then that's my new size; otherwise, - // query outerWidth/outerHeight of my domNode - - // If I'm not being displayed then disregard (show() must - // check if the size has changed) - if(!this.isShowing()){ return false; } - - // If my parent has been resized and I have style="height: 100%" - // or something similar then my size has changed too. - var wh = dojo.html.getMarginBox(this.domNode); - var width=w||wh.width; - var height=h||wh.height; - if(this.width == width && this.height == height){ return false; } - - this.width=width; - this.height=height; - return true; - }, - - checkSize: function(){ - // summary - // Called when my parent has changed size, but my parent won't call resizeTo(). - // This is useful if my size is height:100% or something similar. - // Also called whenever I am shown, because the first time I am shown I may need - // to do size calculations. - if(!this._isResized()){ return; } - this.onResized(); - }, - - resizeTo: function(w, h){ - // summary: explicitly set this widget's size (in pixels). - dojo.html.setMarginBox(this.domNode, { width: w, height: h }); - - // can't do sizing if widget is hidden because referencing node.offsetWidth/node.offsetHeight returns 0. - // do sizing on show() instead. - if(this.isShowing()){ - this.onResized(); - } - }, - - resizeSoon: function(){ - // summary - // schedule onResized() to be called soon, after browser has had - // a little more time to calculate the sizes - if(this.isShowing()){ - dojo.lang.setTimeout(this, this.onResized, 0); - } - }, - - onResized: function(){ - // summary - // Called when my size has changed. - // Must notify children if their size has (possibly) changed. - dojo.lang.forEach(this.children, function(child){ if(child.checkSize){child.checkSize();} }); - } -}); - -dojo.kwCompoundRequire({ - common: ["dojo.xml.Parse", - "dojo.widget.Widget", - "dojo.widget.Parse", - "dojo.widget.Manager"], - browser: ["dojo.widget.DomWidget", - "dojo.widget.HtmlWidget"], - dashboard: ["dojo.widget.DomWidget", - "dojo.widget.HtmlWidget"], - svg: ["dojo.widget.SvgWidget"], - rhino: ["dojo.widget.SwtWidget"] -}); -dojo.provide("dojo.widget.*"); - -dojo.kwCompoundRequire({ - common: [ "dojo.html.common", - "dojo.html.style" ] -}); -dojo.provide("dojo.html.*"); - - -dojo.provide("dojo.html.selection"); - - - - -/** - * type of selection -**/ -dojo.html.selectionType = { - NONE : 0, //selection is empty - TEXT : 1, //selection contains text (may also contains CONTROL objects) - CONTROL : 2 //only one element is selected (such as img, table etc) -}; - -dojo.html.clearSelection = function(){ - // summary: deselect the current selection to make it empty - var _window = dojo.global(); - var _document = dojo.doc(); - try{ - if(_window["getSelection"]){ - if(dojo.render.html.safari){ - // pulled from WebCore/ecma/kjs_window.cpp, line 2536 - _window.getSelection().collapse(); - }else{ - _window.getSelection().removeAllRanges(); - } - }else if(_document.selection){ - if(_document.selection.empty){ - _document.selection.empty(); - }else if(_document.selection.clear){ - _document.selection.clear(); - } - } - return true; - }catch(e){ - dojo.debug(e); - return false; - } -} - -dojo.html.disableSelection = function(/*DomNode*/element){ - // summary: disable selection on a node - element = dojo.byId(element)||dojo.body(); - var h = dojo.render.html; - - if(h.mozilla){ - element.style.MozUserSelect = "none"; - }else if(h.safari){ - element.style.KhtmlUserSelect = "none"; - }else if(h.ie){ - element.unselectable = "on"; - }else{ - return false; - } - return true; -} - -dojo.html.enableSelection = function(/*DomNode*/element){ - // summary: enable selection on a node - element = dojo.byId(element)||dojo.body(); - - var h = dojo.render.html; - if(h.mozilla){ - element.style.MozUserSelect = ""; - }else if(h.safari){ - element.style.KhtmlUserSelect = ""; - }else if(h.ie){ - element.unselectable = "off"; - }else{ - return false; - } - return true; -} - -dojo.html.selectElement = function(/*DomNode*/element){ - dojo.deprecated("dojo.html.selectElement", "replaced by dojo.html.selection.selectElementChildren", 0.5); -} - -dojo.html.selectInputText = function(/*DomNode*/element){ - // summary: select all the text in an input element - var _window = dojo.global(); - var _document = dojo.doc(); - element = dojo.byId(element); - if(_document["selection"] && dojo.body()["createTextRange"]){ // IE - var range = element.createTextRange(); - range.moveStart("character", 0); - range.moveEnd("character", element.value.length); - range.select(); - }else if(_window["getSelection"]){ - var selection = _window.getSelection(); - // FIXME: does this work on Safari? - element.setSelectionRange(0, element.value.length); - } - element.focus(); -} - - -dojo.html.isSelectionCollapsed = function(){ - dojo.deprecated("dojo.html.isSelectionCollapsed", "replaced by dojo.html.selection.isCollapsed", 0.5); - return dojo.html.selection.isCollapsed(); -} - -dojo.lang.mixin(dojo.html.selection, { - getType: function() { - // summary: Get the selection type (like document.select.type in IE). - if(dojo.doc()["selection"]){ //IE - return dojo.html.selectionType[dojo.doc().selection.type.toUpperCase()]; - }else{ - var stype = dojo.html.selectionType.TEXT; - - // Check if the actual selection is a CONTROL (IMG, TABLE, HR, etc...). - var oSel; - try {oSel = dojo.global().getSelection();} - catch (e) {} - - if(oSel && oSel.rangeCount==1){ - var oRange = oSel.getRangeAt(0); - if (oRange.startContainer == oRange.endContainer && (oRange.endOffset - oRange.startOffset) == 1 - && oRange.startContainer.nodeType != dojo.dom.TEXT_NODE) { - stype = dojo.html.selectionType.CONTROL; - } - } - return stype; - } - }, - isCollapsed: function() { - // summary: return whether the current selection is empty - var _window = dojo.global(); - var _document = dojo.doc(); - if(_document["selection"]){ // IE - return _document.selection.createRange().text == ""; - }else if(_window["getSelection"]){ - var selection = _window.getSelection(); - if(dojo.lang.isString(selection)){ // Safari - return selection == ""; - }else{ // Mozilla/W3 - return selection.isCollapsed || selection.toString() == ""; - } - } - }, - getSelectedElement: function() { - // summary: - // Retrieves the selected element (if any), just in the case that a single - // element (object like and image or a table) is selected. - if ( dojo.html.selection.getType() == dojo.html.selectionType.CONTROL ){ - if(dojo.doc()["selection"]){ //IE - var range = dojo.doc().selection.createRange(); - - if ( range && range.item ){ - return dojo.doc().selection.createRange().item(0); - } - }else{ - var selection = dojo.global().getSelection(); - return selection.anchorNode.childNodes[ selection.anchorOffset ]; - } - } - }, - getParentElement: function() { - // summary: - // Get the parent element of the current selection - if(dojo.html.selection.getType() == dojo.html.selectionType.CONTROL){ - var p = dojo.html.selection.getSelectedElement(); - if(p){ return p.parentNode; } - }else{ - if(dojo.doc()["selection"]){ //IE - return dojo.doc().selection.createRange().parentElement(); - }else{ - var selection = dojo.global().getSelection(); - if(selection){ - var node = selection.anchorNode; - - while ( node && node.nodeType != dojo.dom.ELEMENT_NODE ){ - node = node.parentNode; - } - - return node; - } - } - } - }, - getSelectedText: function(){ - // summary: - // Return the text (no html tags) included in the current selection or null if no text is selected - if(dojo.doc()["selection"]){ //IE - if(dojo.html.selection.getType() == dojo.html.selectionType.CONTROL){ - return null; - } - return dojo.doc().selection.createRange().text; - }else{ - var selection = dojo.global().getSelection(); - if(selection){ - return selection.toString(); - } - } - }, - getSelectedHtml: function(){ - // summary: - // Return the html of the current selection or null if unavailable - if(dojo.doc()["selection"]){ //IE - if(dojo.html.selection.getType() == dojo.html.selectionType.CONTROL){ - return null; - } - return dojo.doc().selection.createRange().htmlText; - }else{ - var selection = dojo.global().getSelection(); - if(selection && selection.rangeCount){ - var frag = selection.getRangeAt(0).cloneContents(); - var div = document.createElement("div"); - div.appendChild(frag); - return div.innerHTML; - } - return null; - } - }, - hasAncestorElement: function(/*String*/tagName /* ... */){ - // summary: - // Check whether current selection has a parent element which is of type tagName (or one of the other specified tagName) - return (dojo.html.selection.getAncestorElement.apply(this, arguments) != null); - }, - getAncestorElement: function(/*String*/tagName /* ... */){ - // summary: - // Return the parent element of the current selection which is of type tagName (or one of the other specified tagName) - var node = dojo.html.selection.getSelectedElement() || dojo.html.selection.getParentElement(); - while(node /*&& node.tagName.toLowerCase() != 'body'*/){ - if(dojo.html.selection.isTag(node, arguments).length>0){ - return node; - } - node = node.parentNode; - } - return null; - }, - //modified from dojo.html.isTag to take an array as second parameter - isTag: function(/*DomNode*/node, /*Array*/tags) { - if(node && node.tagName) { - for (var i=0; i. - - Why do we want this? JavaScript has no threads, and even if it did, - threads are hard. Deferreds are a way of abstracting non-blocking - events, such as the final response to an XMLHttpRequest. - - The sequence of callbacks is internally represented as a list - of 2-tuples containing the callback/errback pair. For example, - the following call sequence:: - - var d = new Deferred(); - d.addCallback(myCallback); - d.addErrback(myErrback); - d.addBoth(myBoth); - d.addCallbacks(myCallback, myErrback); - - is translated into a Deferred with the following internal - representation:: - - [ - [myCallback, null], - [null, myErrback], - [myBoth, myBoth], - [myCallback, myErrback] - ] - - The Deferred also keeps track of its current status (fired). - Its status may be one of three things: - - -1: no value yet (initial condition) - 0: success - 1: error - - A Deferred will be in the error state if one of the following - three conditions are met: - - 1. The result given to callback or errback is "instanceof" Error - 2. The previous callback or errback raised an exception while - executing - 3. The previous callback or errback returned a value "instanceof" - Error - - Otherwise, the Deferred will be in the success state. The state of - the Deferred determines the next element in the callback sequence to - run. - - When a callback or errback occurs with the example deferred chain, - something equivalent to the following will happen (imagine that - exceptions are caught and returned):: - - // d.callback(result) or d.errback(result) - if(!(result instanceof Error)){ - result = myCallback(result); - } - if(result instanceof Error){ - result = myErrback(result); - } - result = myBoth(result); - if(result instanceof Error){ - result = myErrback(result); - }else{ - result = myCallback(result); - } - - The result is then stored away in case another step is added to the - callback sequence. Since the Deferred already has a value available, - any new callbacks added will be called immediately. - - There are two other "advanced" details about this implementation that - are useful: - - Callbacks are allowed to return Deferred instances themselves, so you - can build complicated sequences of events with ease. - - The creator of the Deferred may specify a canceller. The canceller - is a function that will be called if Deferred.cancel is called before - the Deferred fires. You can use this to implement clean aborting of - an XMLHttpRequest, etc. Note that cancel will fire the deferred with - a CancelledError (unless your canceller returns another kind of - error), so the errbacks should be prepared to handle that error for - cancellable Deferreds. - - */ - - this.chain = []; - this.id = this._nextId(); - this.fired = -1; - this.paused = 0; - this.results = [null, null]; - this.canceller = canceller; - this.silentlyCancelled = false; -}; - -dojo.lang.extend(dojo.Deferred, { - getFunctionFromArgs: function(){ - var a = arguments; - if((a[0])&&(!a[1])){ - if(dojo.lang.isFunction(a[0])){ - return a[0]; - }else if(dojo.lang.isString(a[0])){ - return dj_global[a[0]]; - } - }else if((a[0])&&(a[1])){ - return dojo.lang.hitch(a[0], a[1]); - } - return null; - }, - - makeCalled: function() { - var deferred = new dojo.Deferred(); - deferred.callback(); - return deferred; - }, - - 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: dojo.lang.forward("repr"), - - _nextId: (function(){ - var n = 1; - return function(){ return n++; }; - })(), - - cancel: function(){ - // summary: Cancels a Deferred that has not yet received a value, or is - // waiting on another Deferred as its value. - // description: - // If a canceller is defined, the canceller is called. If the - // canceller did not return an error, or there was no canceller, - // then the errback chain is started with CancelledError. - if(this.fired == -1){ - if (this.canceller){ - this.canceller(this); - }else{ - this.silentlyCancelled = true; - } - if(this.fired == -1){ - this.errback(new Error(this.repr())); - } - }else if( (this.fired == 0)&& - (this.results[0] instanceof dojo.Deferred)){ - this.results[0].cancel(); - } - }, - - - _pause: function(){ - // summary: Used internally to signal that it's waiting on another Deferred - this.paused++; - }, - - _unpause: function(){ - // summary: 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){ - // summary: 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){ - dojo.raise("already called!"); - } - this.silentlyCancelled = false; - return; - } - }, - - callback: function(res){ - // summary: Begin the callback sequence with a non-error value. - - /* - callback or errback should only be called once on a given - Deferred. - */ - this._check(); - this._resback(res); - }, - - errback: function(res){ - // summary: Begin the callback sequence with an error result. - this._check(); - if(!(res instanceof Error)){ - res = new Error(res); - } - this._resback(res); - }, - - addBoth: function(cb, cbfn){ - /* summary - Add the same function as both a callback and an errback as the - next element on the callback sequence. This is useful for code - that you want to guarantee to run, e.g. a finalizer. - */ - var enclosed = this.getFunctionFromArgs(cb, cbfn); - if(arguments.length > 2){ - enclosed = dojo.lang.curryArguments(null, enclosed, arguments, 2); - } - return this.addCallbacks(enclosed, enclosed); - }, - - addCallback: function(cb, cbfn){ - // summary: Add a single callback to the end of the callback sequence. - var enclosed = this.getFunctionFromArgs(cb, cbfn); - if(arguments.length > 2){ - enclosed = dojo.lang.curryArguments(null, enclosed, arguments, 2); - } - return this.addCallbacks(enclosed, null); - }, - - addErrback: function(cb, cbfn){ - // summary: Add a single callback to the end of the callback sequence. - var enclosed = this.getFunctionFromArgs(cb, cbfn); - if(arguments.length > 2){ - enclosed = dojo.lang.curryArguments(null, enclosed, arguments, 2); - } - return this.addCallbacks(null, enclosed); - return this.addCallbacks(null, cbfn); - }, - - addCallbacks: function (cb, eb) { - // summary: Add separate callback and errback to the end of the callback - // sequence. - this.chain.push([cb, eb]) - if (this.fired >= 0) { - this._fire(); - } - return this; - }, - - _fire: function(){ - // summary: 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 dojo.Deferred) { - cb = function(res){ - self._continue(res); - } - this._pause(); - } - }catch(err){ - fired = 1; - 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); - } - } -}); - - /* -*- tab-width: 4 -*- */ -dojo.provide("dojo.widget.RichText"); - - - - - - - - - - -// used to save content -// but do not try doing document.write if we are using xd loading. -// document.write will only work if RichText.js is included in the dojo.js -// file. If it is included in dojo.js and you want to allow rich text saving -// for back/forward actions, then set djConfig.allowXdRichTextSave = true. -if(!djConfig["useXDomain"] || djConfig["allowXdRichTextSave"]){ - if(dojo.hostenv.post_load_){ - (function(){ - var savetextarea = dojo.doc().createElement('textarea'); - savetextarea.id = "dojo.widget.RichText.savedContent"; - savetextarea.style = "display:none;position:absolute;top:-100px;left:-100px;height:3px;width:3px;overflow:hidden;"; - dojo.body().appendChild(savetextarea); - })(); - }else{ - //dojo.body() is not available before onLoad is fired - try { - dojo.doc().write(''); - }catch(e){ } - } -} - -dojo.widget.defineWidget( - "dojo.widget.RichText", - dojo.widget.HtmlWidget, - function(){ - // summary: - // dojo.widget.RichText is the core of the WYSIWYG editor in dojo, which - // provides the basic editing features. It also encapsulates the differences - // of different js engines for various browsers - - // contentPreFilters: Array - // pre content filter function register array - this.contentPreFilters = []; - - // contentPostFilters: Array - // post content filter function register array - this.contentPostFilters = []; - - // contentDomPreFilters: Array - // pre content dom filter function register array - this.contentDomPreFilters = []; - - // contentDomPostFilters: Array - // post content dom filter function register array - this.contentDomPostFilters = []; - - // editingAreaStyleSheets: Array - // array to store all the stylesheets applied to the editing area - this.editingAreaStyleSheets=[]; - - if(dojo.render.html.moz){ - this.contentPreFilters.push(this._fixContentForMoz); - } - - this._keyHandlers = {}; - - if(dojo.Deferred){ - this.onLoadDeferred = new dojo.Deferred(); - } - }, - { - // inheritWidth: Boolean - // whether to inherit the parent's width or simply use 100% - inheritWidth: false, - - // focusOnLoad: Boolean - // whether focusing into this instance of richtext when page onload - focusOnLoad: false, - - // saveName: String - // If a save name is specified the content is saved and restored when the user - // leave this page can come back, or if the editor is not properly closed after - // editing has started. - saveName: "", - - // styleSheets: String - // semicolon (";") separated list of css files for the editing area - styleSheets: "", - - // _content: String - // temporary content storage - _content: "", - - // height: String - // set height to fix the editor at a specific height, with scrolling - height: "", - - // minHeight: String - // The minimum height that the editor should have - minHeight: "1em", - - // isClosed: Boolean - isClosed: true, - - // isLoaded: Boolean - isLoaded: false, - - // useActiveX: Boolean - // whether to use the active-x object in IE - useActiveX: false, - - // relativeImageUrls: Boolean - // whether to use relative URLs for images - if this is enabled - // images will be given absolute URLs when inside the editor but - // will be changed to use relative URLs (to the current page) on save - relativeImageUrls: false, - - // _SEPARATOR: String - // used to concat contents from multiple textareas into a single string - _SEPARATOR: "@@**%%__RICHTEXTBOUNDRY__%%**@@", - - // onLoadDeferred: dojo.Deferred - // deferred that can be used to connect to the onLoad function. This - // will only be set if dojo.Deferred is required - onLoadDeferred: null, - - /* Init - *******/ - - fillInTemplate: function(){ - // summary: see dojo.widget.DomWidget - dojo.event.topic.publish("dojo.widget.RichText::init", this); - this.open(); - - - // backwards compatibility, needs to be removed - dojo.event.connect(this, "onKeyPressed", this, "afterKeyPress"); - dojo.event.connect(this, "onKeyPress", this, "keyPress"); - dojo.event.connect(this, "onKeyDown", this, "keyDown"); - dojo.event.connect(this, "onKeyUp", this, "keyUp"); - - this.setupDefaultShortcuts(); - }, - - setupDefaultShortcuts: function(){ - // summary: add some default key handlers - // description: - // Overwrite this to setup your own handlers. The default - // implementation does not use Editor2 commands, but directly - // executes the builtin commands within the underlying browser - // support. - var ctrl = this.KEY_CTRL; - var exec = function (cmd, arg) { - return arguments.length == 1 ? function () { this.execCommand(cmd); } : - function () { this.execCommand(cmd, arg); } - } - this.addKeyHandler("b", ctrl, exec("bold")); - this.addKeyHandler("i", ctrl, exec("italic")); - this.addKeyHandler("u", ctrl, exec("underline")); - this.addKeyHandler("a", ctrl, exec("selectall")); - this.addKeyHandler("s", ctrl, function () { this.save(true); }); - - this.addKeyHandler("1", ctrl, exec("formatblock", "h1")); - this.addKeyHandler("2", ctrl, exec("formatblock", "h2")); - this.addKeyHandler("3", ctrl, exec("formatblock", "h3")); - this.addKeyHandler("4", ctrl, exec("formatblock", "h4")); - - this.addKeyHandler("\\", ctrl, exec("insertunorderedlist")); - if(!dojo.render.html.ie){ - this.addKeyHandler("Z", ctrl, exec("redo")); - } - }, - - // events: Array - // events which should be connected to the underlying editing area - events: ["onBlur", "onFocus", "onKeyPress", "onKeyDown", "onKeyUp", "onClick"], - - /** - * Transforms the node referenced in this.domNode into a rich text editing - * node. This can result in the creation and replacement with an "); + } +}catch(e){/* squelch */} + +if(dojo.render.html.opera){ + dojo.debug("Opera is not supported with dojo.undo.browser, so back/forward detection will not work."); +} + +dojo.undo.browser = { + initialHref: (!dj_undef("window")) ? window.location.href : "", + initialHash: (!dj_undef("window")) ? window.location.hash : "", + + moveForward: false, + historyStack: [], + forwardStack: [], + historyIframe: null, + bookmarkAnchor: null, + locationTimer: null, + + /** + * + */ + setInitialState: function(/*Object*/args){ + //summary: Sets the state object and back callback for the very first page that is loaded. + //description: It is recommended that you call this method as part of an event listener that is registered via + //dojo.addOnLoad(). + //args: Object + // See the addToHistory() function for the list of valid args properties. + this.initialState = this._createState(this.initialHref, args, this.initialHash); + }, + + //FIXME: Would like to support arbitrary back/forward jumps. Have to rework iframeLoaded among other things. + //FIXME: is there a slight race condition in moz using change URL with the timer check and when + // the hash gets set? I think I have seen a back/forward call in quick succession, but not consistent. + addToHistory: function(args){ + //summary: adds a state object (args) to the history list. You must set + //djConfig.preventBackButtonFix = false to use dojo.undo.browser. + + //args: Object + // args can have the following properties: + // To support getting back button notifications, the object argument should implement a + // function called either "back", "backButton", or "handle". The string "back" will be + // passed as the first and only argument to this callback. + // - To support getting forward button notifications, the object argument should implement a + // function called either "forward", "forwardButton", or "handle". The string "forward" will be + // passed as the first and only argument to this callback. + // - If you want the browser location string to change, define "changeUrl" on the object. If the + // value of "changeUrl" is true, then a unique number will be appended to the URL as a fragment + // identifier (http://some.domain.com/path#uniquenumber). If it is any other value that does + // not evaluate to false, that value will be used as the fragment identifier. For example, + // if changeUrl: 'page1', then the URL will look like: http://some.domain.com/path#page1 + // Full example: + // dojo.undo.browser.addToHistory({ + // back: function() { alert('back pressed'); }, + // forward: function() { alert('forward pressed'); }, + // changeUrl: true + // }); + // + // BROWSER NOTES: + // Safari 1.2: + // back button "works" fine, however it's not possible to actually + // DETECT that you've moved backwards by inspecting window.location. + // Unless there is some other means of locating. + // FIXME: perhaps we can poll on history.length? + // Safari 2.0.3+ (and probably 1.3.2+): + // works fine, except when changeUrl is used. When changeUrl is used, + // Safari jumps all the way back to whatever page was shown before + // the page that uses dojo.undo.browser support. + // IE 5.5 SP2: + // back button behavior is macro. It does not move back to the + // previous hash value, but to the last full page load. This suggests + // that the iframe is the correct way to capture the back button in + // these cases. + // Don't test this page using local disk for MSIE. MSIE will not create + // a history list for iframe_history.html if served from a file: URL. + // The XML served back from the XHR tests will also not be properly + // created if served from local disk. Serve the test pages from a web + // server to test in that browser. + // IE 6.0: + // same behavior as IE 5.5 SP2 + // Firefox 1.0+: + // the back button will return us to the previous hash on the same + // page, thereby not requiring an iframe hack, although we do then + // need to run a timer to detect inter-page movement. + + //If addToHistory is called, then that means we prune the + //forward stack -- the user went back, then wanted to + //start a new forward path. + this.forwardStack = []; + + var hash = null; + var url = null; + if(!this.historyIframe){ + if(djConfig["useXDomain"] && !djConfig["dojoIframeHistoryUrl"]){ + dojo.debug("dojo.undo.browser: When using cross-domain Dojo builds," + + " please save iframe_history.html to your domain and set djConfig.dojoIframeHistoryUrl" + + " to the path on your domain to iframe_history.html"); + } + this.historyIframe = window.frames["djhistory"]; + } + if(!this.bookmarkAnchor){ + this.bookmarkAnchor = document.createElement("a"); + dojo.body().appendChild(this.bookmarkAnchor); + this.bookmarkAnchor.style.display = "none"; + } + if(args["changeUrl"]){ + hash = "#"+ ((args["changeUrl"]!==true) ? args["changeUrl"] : (new Date()).getTime()); + + //If the current hash matches the new one, just replace the history object with + //this new one. It doesn't make sense to track different state objects for the same + //logical URL. This matches the browser behavior of only putting in one history + //item no matter how many times you click on the same #hash link, at least in Firefox + //and Safari, and there is no reliable way in those browsers to know if a #hash link + //has been clicked on multiple times. So making this the standard behavior in all browsers + //so that dojo.undo.browser's behavior is the same in all browsers. + if(this.historyStack.length == 0 && this.initialState.urlHash == hash){ + this.initialState = this._createState(url, args, hash); + return; + }else if(this.historyStack.length > 0 && this.historyStack[this.historyStack.length - 1].urlHash == hash){ + this.historyStack[this.historyStack.length - 1] = this._createState(url, args, hash); + return; + } + + this.changingUrl = true; + setTimeout("window.location.href = '"+hash+"'; dojo.undo.browser.changingUrl = false;", 1); + this.bookmarkAnchor.href = hash; + + if(dojo.render.html.ie){ + url = this._loadIframeHistory(); + + var oldCB = args["back"]||args["backButton"]||args["handle"]; + + //The function takes handleName as a parameter, in case the + //callback we are overriding was "handle". In that case, + //we will need to pass the handle name to handle. + var tcb = function(handleName){ + if(window.location.hash != ""){ + setTimeout("window.location.href = '"+hash+"';", 1); + } + //Use apply to set "this" to args, and to try to avoid memory leaks. + oldCB.apply(this, [handleName]); + } + + //Set interceptor function in the right place. + if(args["back"]){ + args.back = tcb; + }else if(args["backButton"]){ + args.backButton = tcb; + }else if(args["handle"]){ + args.handle = tcb; + } + + var oldFW = args["forward"]||args["forwardButton"]||args["handle"]; + + //The function takes handleName as a parameter, in case the + //callback we are overriding was "handle". In that case, + //we will need to pass the handle name to handle. + var tfw = function(handleName){ + if(window.location.hash != ""){ + window.location.href = hash; + } + if(oldFW){ // we might not actually have one + //Use apply to set "this" to args, and to try to avoid memory leaks. + oldFW.apply(this, [handleName]); + } + } + + //Set interceptor function in the right place. + if(args["forward"]){ + args.forward = tfw; + }else if(args["forwardButton"]){ + args.forwardButton = tfw; + }else if(args["handle"]){ + args.handle = tfw; + } + + }else if(dojo.render.html.moz){ + // start the timer + if(!this.locationTimer){ + this.locationTimer = setInterval("dojo.undo.browser.checkLocation();", 200); + } + } + }else{ + url = this._loadIframeHistory(); + } + + this.historyStack.push(this._createState(url, args, hash)); + }, + + checkLocation: function(){ + //summary: private method. Do not call this directly. + if (!this.changingUrl){ + var hsl = this.historyStack.length; + + if((window.location.hash == this.initialHash||window.location.href == this.initialHref)&&(hsl == 1)){ + // FIXME: could this ever be a forward button? + // we can't clear it because we still need to check for forwards. Ugg. + // clearInterval(this.locationTimer); + this.handleBackButton(); + return; + } + + // first check to see if we could have gone forward. We always halt on + // a no-hash item. + if(this.forwardStack.length > 0){ + if(this.forwardStack[this.forwardStack.length-1].urlHash == window.location.hash){ + this.handleForwardButton(); + return; + } + } + + // ok, that didn't work, try someplace back in the history stack + if((hsl >= 2)&&(this.historyStack[hsl-2])){ + if(this.historyStack[hsl-2].urlHash==window.location.hash){ + this.handleBackButton(); + return; + } + } + } + }, + + iframeLoaded: function(evt, ifrLoc){ + //summary: private method. Do not call this directly. + if(!dojo.render.html.opera){ + var query = this._getUrlQuery(ifrLoc.href); + if(query == null){ + // alert("iframeLoaded"); + // we hit the end of the history, so we should go back + if(this.historyStack.length == 1){ + this.handleBackButton(); + } + return; + } + if(this.moveForward){ + // we were expecting it, so it's not either a forward or backward movement + this.moveForward = false; + return; + } + + //Check the back stack first, since it is more likely. + //Note that only one step back or forward is supported. + if(this.historyStack.length >= 2 && query == this._getUrlQuery(this.historyStack[this.historyStack.length-2].url)){ + this.handleBackButton(); + } + else if(this.forwardStack.length > 0 && query == this._getUrlQuery(this.forwardStack[this.forwardStack.length-1].url)){ + this.handleForwardButton(); + } + } + }, + + handleBackButton: function(){ + //summary: private method. Do not call this directly. + + //The "current" page is always at the top of the history stack. + var current = this.historyStack.pop(); + if(!current){ return; } + var last = this.historyStack[this.historyStack.length-1]; + if(!last && this.historyStack.length == 0){ + last = this.initialState; + } + if (last){ + if(last.kwArgs["back"]){ + last.kwArgs["back"](); + }else if(last.kwArgs["backButton"]){ + last.kwArgs["backButton"](); + }else if(last.kwArgs["handle"]){ + last.kwArgs.handle("back"); + } + } + this.forwardStack.push(current); + }, + + handleForwardButton: function(){ + //summary: private method. Do not call this directly. + + var last = this.forwardStack.pop(); + if(!last){ return; } + if(last.kwArgs["forward"]){ + last.kwArgs.forward(); + }else if(last.kwArgs["forwardButton"]){ + last.kwArgs.forwardButton(); + }else if(last.kwArgs["handle"]){ + last.kwArgs.handle("forward"); + } + this.historyStack.push(last); + }, + + _createState: function(url, args, hash){ + //summary: private method. Do not call this directly. + + return {"url": url, "kwArgs": args, "urlHash": hash}; //Object + }, + + _getUrlQuery: function(url){ + //summary: private method. Do not call this directly. + var segments = url.split("?"); + if (segments.length < 2){ + return null; //null + } + else{ + return segments[1]; //String + } + }, + + _loadIframeHistory: function(){ + //summary: private method. Do not call this directly. + var url = (djConfig["dojoIframeHistoryUrl"] || dojo.hostenv.getBaseScriptUri()+'iframe_history.html') + + "?" + (new Date()).getTime(); + this.moveForward = true; + dojo.io.setIFrameSrc(this.historyIframe, url, false); + return url; //String + } +} + +dojo.provide("dojo.io.BrowserIO"); + + + + + + + + +if(!dj_undef("window")) { + +dojo.io.checkChildrenForFile = function(/*DOMNode*/node){ + //summary: Checks any child nodes of node for an input type="file" element. + var hasFile = false; + var inputs = node.getElementsByTagName("input"); + dojo.lang.forEach(inputs, function(input){ + if(hasFile){ return; } + if(input.getAttribute("type")=="file"){ + hasFile = true; + } + }); + return hasFile; //boolean +} + +dojo.io.formHasFile = function(/*DOMNode*/formNode){ + //summary: Just calls dojo.io.checkChildrenForFile(). + return dojo.io.checkChildrenForFile(formNode); //boolean +} + +dojo.io.updateNode = function(/*DOMNode*/node, /*String or Object*/urlOrArgs){ + //summary: Updates a DOMnode with the result of a dojo.io.bind() call. + //node: DOMNode + //urlOrArgs: String or Object + // Either a String that has an URL, or an object containing dojo.io.bind() + // arguments. + node = dojo.byId(node); + var args = urlOrArgs; + if(dojo.lang.isString(urlOrArgs)){ + args = { url: urlOrArgs }; + } + args.mimetype = "text/html"; + args.load = function(t, d, e){ + while(node.firstChild){ + dojo.dom.destroyNode(node.firstChild); + } + node.innerHTML = d; + }; + dojo.io.bind(args); +} + +dojo.io.formFilter = function(/*DOMNode*/node) { + //summary: Returns true if the node is an input element that is enabled, has + //a name, and whose type is one of the following values: ["file", "submit", "image", "reset", "button"] + var type = (node.type||"").toLowerCase(); + return !node.disabled && node.name + && !dojo.lang.inArray(["file", "submit", "image", "reset", "button"], type); //boolean +} + +// TODO: Move to htmlUtils +dojo.io.encodeForm = function(/*DOMNode*/formNode, /*String?*/encoding, /*Function?*/formFilter){ + //summary: Converts the names and values of form elements into an URL-encoded + //string (name=value&name=value...). + //formNode: DOMNode + //encoding: String? + // The encoding to use for the values. Specify a string that starts with + // "utf" (for instance, "utf8"), to use encodeURIComponent() as the encoding + // function. Otherwise, dojo.string.encodeAscii will be used. + //formFilter: Function? + // A function used to filter out form elements. The element node will be passed + // to the formFilter function, and a boolean result is expected (true indicating + // indicating that the element should have its name/value included in the output). + // If no formFilter is specified, then dojo.io.formFilter() will be used. + if((!formNode)||(!formNode.tagName)||(!formNode.tagName.toLowerCase() == "form")){ + dojo.raise("Attempted to encode a non-form element."); + } + if(!formFilter) { formFilter = dojo.io.formFilter; } + var enc = /utf/i.test(encoding||"") ? encodeURIComponent : dojo.string.encodeAscii; + var values = []; + + for(var i = 0; i < formNode.elements.length; i++){ + var elm = formNode.elements[i]; + if(!elm || elm.tagName.toLowerCase() == "fieldset" || !formFilter(elm)) { continue; } + var name = enc(elm.name); + var type = elm.type.toLowerCase(); + + if(type == "select-multiple"){ + for(var j = 0; j < elm.options.length; j++){ + if(elm.options[j].selected) { + values.push(name + "=" + enc(elm.options[j].value)); + } + } + }else if(dojo.lang.inArray(["radio", "checkbox"], type)){ + if(elm.checked){ + values.push(name + "=" + enc(elm.value)); + } + }else{ + values.push(name + "=" + enc(elm.value)); + } + } + + // now collect input type="image", which doesn't show up in the elements array + var inputs = formNode.getElementsByTagName("input"); + for(var i = 0; i < inputs.length; i++) { + var input = inputs[i]; + if(input.type.toLowerCase() == "image" && input.form == formNode + && formFilter(input)) { + var name = enc(input.name); + values.push(name + "=" + enc(input.value)); + values.push(name + ".x=0"); + values.push(name + ".y=0"); + } + } + return values.join("&") + "&"; //String +} + +dojo.io.FormBind = function(/*DOMNode or Object*/args) { + //summary: constructor for a dojo.io.FormBind object. See the Dojo Book for + //some information on usage: http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book23 + //args: DOMNode or Object + // args can either be the DOMNode for a form element, or an object containing + // dojo.io.bind() arguments, one of which should be formNode with the value of + // a form element DOMNode. + this.bindArgs = {}; + + if(args && args.formNode) { + this.init(args); + } else if(args) { + this.init({formNode: args}); + } +} +dojo.lang.extend(dojo.io.FormBind, { + form: null, + + bindArgs: null, + + clickedButton: null, + + init: function(/*DOMNode or Object*/args) { + //summary: Internal function called by the dojo.io.FormBind() constructor + //do not call this method directly. + var form = dojo.byId(args.formNode); + + if(!form || !form.tagName || form.tagName.toLowerCase() != "form") { + throw new Error("FormBind: Couldn't apply, invalid form"); + } else if(this.form == form) { + return; + } else if(this.form) { + throw new Error("FormBind: Already applied to a form"); + } + + dojo.lang.mixin(this.bindArgs, args); + this.form = form; + + this.connect(form, "onsubmit", "submit"); + + for(var i = 0; i < form.elements.length; i++) { + var node = form.elements[i]; + if(node && node.type && dojo.lang.inArray(["submit", "button"], node.type.toLowerCase())) { + this.connect(node, "onclick", "click"); + } + } + + var inputs = form.getElementsByTagName("input"); + for(var i = 0; i < inputs.length; i++) { + var input = inputs[i]; + if(input.type.toLowerCase() == "image" && input.form == form) { + this.connect(input, "onclick", "click"); + } + } + }, + + onSubmit: function(/*DOMNode*/form) { + //summary: Function used to verify that the form is OK to submit. + //Override this function if you want specific form validation done. + return true; //boolean + }, + + submit: function(/*Event*/e) { + //summary: internal function that is connected as a listener to the + //form's onsubmit event. + e.preventDefault(); + if(this.onSubmit(this.form)) { + dojo.io.bind(dojo.lang.mixin(this.bindArgs, { + formFilter: dojo.lang.hitch(this, "formFilter") + })); + } + }, + + click: function(/*Event*/e) { + //summary: internal method that is connected as a listener to the + //form's elements whose click event can submit a form. + var node = e.currentTarget; + if(node.disabled) { return; } + this.clickedButton = node; + }, + + formFilter: function(/*DOMNode*/node) { + //summary: internal function used to know which form element values to include + // in the dojo.io.bind() request. + var type = (node.type||"").toLowerCase(); + var accept = false; + if(node.disabled || !node.name) { + accept = false; + } else if(dojo.lang.inArray(["submit", "button", "image"], type)) { + if(!this.clickedButton) { this.clickedButton = node; } + accept = node == this.clickedButton; + } else { + accept = !dojo.lang.inArray(["file", "submit", "reset", "button"], type); + } + return accept; //boolean + }, + + // in case you don't have dojo.event.* pulled in + connect: function(/*Object*/srcObj, /*Function*/srcFcn, /*Function*/targetFcn) { + //summary: internal function used to connect event listeners to form elements + //that trigger events. Used in case dojo.event is not loaded. + if(dojo.evalObjPath("dojo.event.connect")) { + dojo.event.connect(srcObj, srcFcn, this, targetFcn); + } else { + var fcn = dojo.lang.hitch(this, targetFcn); + srcObj[srcFcn] = function(e) { + if(!e) { e = window.event; } + if(!e.currentTarget) { e.currentTarget = e.srcElement; } + if(!e.preventDefault) { e.preventDefault = function() { window.event.returnValue = false; } } + fcn(e); + } + } + } +}); + +dojo.io.XMLHTTPTransport = new function(){ + //summary: The object that implements the dojo.io.bind transport for XMLHttpRequest. + var _this = this; + + var _cache = {}; // FIXME: make this public? do we even need to? + this.useCache = false; // if this is true, we'll cache unless kwArgs.useCache = false + this.preventCache = false; // if this is true, we'll always force GET requests to cache + + // FIXME: Should this even be a function? or do we just hard code it in the next 2 functions? + function getCacheKey(url, query, method) { + return url + "|" + query + "|" + method.toLowerCase(); + } + + function addToCache(url, query, method, http) { + _cache[getCacheKey(url, query, method)] = http; + } + + function getFromCache(url, query, method) { + return _cache[getCacheKey(url, query, method)]; + } + + this.clearCache = function() { + _cache = {}; + } + + // moved successful load stuff here + function doLoad(kwArgs, http, url, query, useCache) { + if( ((http.status>=200)&&(http.status<300))|| // allow any 2XX response code + (http.status==304)|| // get it out of the cache + (location.protocol=="file:" && (http.status==0 || http.status==undefined))|| + (location.protocol=="chrome:" && (http.status==0 || http.status==undefined)) + ){ + var ret; + if(kwArgs.method.toLowerCase() == "head"){ + var headers = http.getAllResponseHeaders(); + ret = {}; + ret.toString = function(){ return headers; } + var values = headers.split(/[\r\n]+/g); + for(var i = 0; i < values.length; i++) { + var pair = values[i].match(/^([^:]+)\s*:\s*(.+)$/i); + if(pair) { + ret[pair[1]] = pair[2]; + } + } + }else if(kwArgs.mimetype == "text/javascript"){ + try{ + ret = dj_eval(http.responseText); + }catch(e){ + dojo.debug(e); + dojo.debug(http.responseText); + ret = null; + } + }else if(kwArgs.mimetype == "text/json" || kwArgs.mimetype == "application/json"){ + try{ + ret = dj_eval("("+http.responseText+")"); + }catch(e){ + dojo.debug(e); + dojo.debug(http.responseText); + ret = false; + } + }else if((kwArgs.mimetype == "application/xml")|| + (kwArgs.mimetype == "text/xml")){ + ret = http.responseXML; + if(!ret || typeof ret == "string" || !http.getResponseHeader("Content-Type")) { + ret = dojo.dom.createDocumentFromText(http.responseText); + } + }else{ + ret = http.responseText; + } + + if(useCache){ // only cache successful responses + addToCache(url, query, kwArgs.method, http); + } + kwArgs[(typeof kwArgs.load == "function") ? "load" : "handle"]("load", ret, http, kwArgs); + }else{ + var errObj = new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText); + kwArgs[(typeof kwArgs.error == "function") ? "error" : "handle"]("error", errObj, http, kwArgs); + } + } + + // set headers (note: Content-Type will get overriden if kwArgs.contentType is set) + function setHeaders(http, kwArgs){ + if(kwArgs["headers"]) { + for(var header in kwArgs["headers"]) { + if(header.toLowerCase() == "content-type" && !kwArgs["contentType"]) { + kwArgs["contentType"] = kwArgs["headers"][header]; + } else { + http.setRequestHeader(header, kwArgs["headers"][header]); + } + } + } + } + + this.inFlight = []; + this.inFlightTimer = null; + + this.startWatchingInFlight = function(){ + //summary: internal method used to trigger a timer to watch all inflight + //XMLHttpRequests. + if(!this.inFlightTimer){ + // setInterval broken in mozilla x86_64 in some circumstances, see + // https://bugzilla.mozilla.org/show_bug.cgi?id=344439 + // using setTimeout instead + this.inFlightTimer = setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();", 10); + } + } + + this.watchInFlight = function(){ + //summary: internal method that checks each inflight XMLHttpRequest to see + //if it has completed or if the timeout situation applies. + var now = null; + // make sure sync calls stay thread safe, if this callback is called during a sync call + // and this results in another sync call before the first sync call ends the browser hangs + if(!dojo.hostenv._blockAsync && !_this._blockAsync){ + for(var x=this.inFlight.length-1; x>=0; x--){ + try{ + var tif = this.inFlight[x]; + if(!tif || tif.http._aborted || !tif.http.readyState){ + this.inFlight.splice(x, 1); continue; + } + if(4==tif.http.readyState){ + // remove it so we can clean refs + this.inFlight.splice(x, 1); + doLoad(tif.req, tif.http, tif.url, tif.query, tif.useCache); + }else if (tif.startTime){ + //See if this is a timeout case. + if(!now){ + now = (new Date()).getTime(); + } + if(tif.startTime + (tif.req.timeoutSeconds * 1000) < now){ + //Stop the request. + if(typeof tif.http.abort == "function"){ + tif.http.abort(); + } + + // remove it so we can clean refs + this.inFlight.splice(x, 1); + tif.req[(typeof tif.req.timeout == "function") ? "timeout" : "handle"]("timeout", null, tif.http, tif.req); + } + } + }catch(e){ + try{ + var errObj = new dojo.io.Error("XMLHttpTransport.watchInFlight Error: " + e); + tif.req[(typeof tif.req.error == "function") ? "error" : "handle"]("error", errObj, tif.http, tif.req); + }catch(e2){ + dojo.debug("XMLHttpTransport error callback failed: " + e2); + } + } + } + } + + clearTimeout(this.inFlightTimer); + if(this.inFlight.length == 0){ + this.inFlightTimer = null; + return; + } + this.inFlightTimer = setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();", 10); + } + + var hasXmlHttp = dojo.hostenv.getXmlhttpObject() ? true : false; + this.canHandle = function(/*dojo.io.Request*/kwArgs){ + //summary: Tells dojo.io.bind() if this is a good transport to + //use for the particular type of request. This type of transport cannot + //handle forms that have an input type="file" element. + + // FIXME: we need to determine when form values need to be + // multi-part mime encoded and avoid using this transport for those + // requests. + return hasXmlHttp + && dojo.lang.inArray(["text/plain", "text/html", "application/xml", "text/xml", "text/javascript", "text/json", "application/json"], (kwArgs["mimetype"].toLowerCase()||"")) + && !( kwArgs["formNode"] && dojo.io.formHasFile(kwArgs["formNode"]) ); //boolean + } + + this.multipartBoundary = "45309FFF-BD65-4d50-99C9-36986896A96F"; // unique guid as a boundary value for multipart posts + + this.bind = function(/*dojo.io.Request*/kwArgs){ + //summary: function that sends the request to the server. + + //This function will attach an abort() function to the kwArgs dojo.io.Request object, + //so if you need to abort the request, you can call that method on the request object. + //The following are acceptable properties in kwArgs (in addition to the + //normal dojo.io.Request object properties). + //url: String: URL the server URL to use for the request. + //method: String: the HTTP method to use (GET, POST, etc...). + //mimetype: Specifies what format the result data should be given to the load/handle callback. Valid values are: + // text/javascript, text/json, application/json, application/xml, text/xml. Any other mimetype will give back a text + // string. + //transport: String: specify "XMLHTTPTransport" to force the use of this XMLHttpRequest transport. + //headers: Object: The object property names and values will be sent as HTTP request header + // names and values. + //sendTransport: boolean: If true, then dojo.transport=xmlhttp will be added to the request. + //encoding: String: The type of encoding to use when dealing with the content kwArgs property. + //content: Object: The content object is converted into a name=value&name=value string, by + // using dojo.io.argsFromMap(). The encoding kwArgs property is passed to dojo.io.argsFromMap() + // for use in encoding the names and values. The resulting string is added to the request. + //formNode: DOMNode: a form element node. This should not normally be used. Use new dojo.io.FormBind() instead. + // If formNode is used, then the names and values of the form elements will be converted + // to a name=value&name=value string and added to the request. The encoding kwArgs property is used + // to encode the names and values. + //postContent: String: Raw name=value&name=value string to be included as part of the request. + //back or backButton: Function: A function to be called if the back button is pressed. If this kwArgs property + // is used, then back button support via dojo.undo.browser will be used. See notes for dojo.undo.browser on usage. + // You need to set djConfig.preventBackButtonFix = false to enable back button support. + //changeUrl: boolean or String: Used as part of back button support. See notes for dojo.undo.browser on usage. + //user: String: The user name. Used in conjuction with password. Passed to XMLHttpRequest.open(). + //password: String: The user's password. Used in conjuction with user. Passed to XMLHttpRequest.open(). + //file: Object or Array of Objects: an object simulating a file to be uploaded. file objects should have the following properties: + // name or fileName: the name of the file + // contentType: the MIME content type for the file. + // content: the actual content of the file. + //multipart: boolean: indicates whether this should be a multipart mime request. If kwArgs.file exists, then this + // property is set to true automatically. + //sync: boolean: if true, then a synchronous XMLHttpRequest call is done, + // if false (the default), then an asynchronous call is used. + //preventCache: boolean: If true, then a cache busting parameter is added to the request URL. + // default value is false. + //useCache: boolean: If true, then XMLHttpTransport will keep an internal cache of the server + // response and use that response if a similar request is done again. + // A similar request is one that has the same URL, query string and HTTP method value. + // default is false. + if(!kwArgs["url"]){ + // are we performing a history action? + if( !kwArgs["formNode"] + && (kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"] || kwArgs["watchForURL"]) + && (!djConfig.preventBackButtonFix)) { + dojo.deprecated("Using dojo.io.XMLHTTPTransport.bind() to add to browser history without doing an IO request", + "Use dojo.undo.browser.addToHistory() instead.", "0.4"); + dojo.undo.browser.addToHistory(kwArgs); + return true; + } + } + + // build this first for cache purposes + var url = kwArgs.url; + var query = ""; + if(kwArgs["formNode"]){ + var ta = kwArgs.formNode.getAttribute("action"); + if((ta)&&(!kwArgs["url"])){ url = ta; } + var tp = kwArgs.formNode.getAttribute("method"); + if((tp)&&(!kwArgs["method"])){ kwArgs.method = tp; } + query += dojo.io.encodeForm(kwArgs.formNode, kwArgs.encoding, kwArgs["formFilter"]); + } + + if(url.indexOf("#") > -1) { + dojo.debug("Warning: dojo.io.bind: stripping hash values from url:", url); + url = url.split("#")[0]; + } + + if(kwArgs["file"]){ + // force post for file transfer + kwArgs.method = "post"; + } + + if(!kwArgs["method"]){ + kwArgs.method = "get"; + } + + // guess the multipart value + if(kwArgs.method.toLowerCase() == "get"){ + // GET cannot use multipart + kwArgs.multipart = false; + }else{ + if(kwArgs["file"]){ + // enforce multipart when sending files + kwArgs.multipart = true; + }else if(!kwArgs["multipart"]){ + // default + kwArgs.multipart = false; + } + } + + if(kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"]){ + dojo.undo.browser.addToHistory(kwArgs); + } + + var content = kwArgs["content"] || {}; + + if(kwArgs.sendTransport) { + content["dojo.transport"] = "xmlhttp"; + } + + do { // break-block + if(kwArgs.postContent){ + query = kwArgs.postContent; + break; + } + + if(content) { + query += dojo.io.argsFromMap(content, kwArgs.encoding); + } + + if(kwArgs.method.toLowerCase() == "get" || !kwArgs.multipart){ + break; + } + + var t = []; + if(query.length){ + var q = query.split("&"); + for(var i = 0; i < q.length; ++i){ + if(q[i].length){ + var p = q[i].split("="); + t.push( "--" + this.multipartBoundary, + "Content-Disposition: form-data; name=\"" + p[0] + "\"", + "", + p[1]); + } + } + } + + if(kwArgs.file){ + if(dojo.lang.isArray(kwArgs.file)){ + for(var i = 0; i < kwArgs.file.length; ++i){ + var o = kwArgs.file[i]; + t.push( "--" + this.multipartBoundary, + "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"", + "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"), + "", + o.content); + } + }else{ + var o = kwArgs.file; + t.push( "--" + this.multipartBoundary, + "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"", + "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"), + "", + o.content); + } + } + + if(t.length){ + t.push("--"+this.multipartBoundary+"--", ""); + query = t.join("\r\n"); + } + }while(false); + + // kwArgs.Connection = "close"; + + var async = kwArgs["sync"] ? false : true; + + var preventCache = kwArgs["preventCache"] || + (this.preventCache == true && kwArgs["preventCache"] != false); + var useCache = kwArgs["useCache"] == true || + (this.useCache == true && kwArgs["useCache"] != false ); + + // preventCache is browser-level (add query string junk), useCache + // is for the local cache. If we say preventCache, then don't attempt + // to look in the cache, but if useCache is true, we still want to cache + // the response + if(!preventCache && useCache){ + var cachedHttp = getFromCache(url, query, kwArgs.method); + if(cachedHttp){ + doLoad(kwArgs, cachedHttp, url, query, false); + return; + } + } + + // much of this is from getText, but reproduced here because we need + // more flexibility + var http = dojo.hostenv.getXmlhttpObject(kwArgs); + var received = false; + + // build a handler function that calls back to the handler obj + if(async){ + var startTime = + // FIXME: setting up this callback handler leaks on IE!!! + this.inFlight.push({ + "req": kwArgs, + "http": http, + "url": url, + "query": query, + "useCache": useCache, + "startTime": kwArgs.timeoutSeconds ? (new Date()).getTime() : 0 + }); + this.startWatchingInFlight(); + }else{ + // block async callbacks until sync is in, needed in khtml, others? + _this._blockAsync = true; + } + + if(kwArgs.method.toLowerCase() == "post"){ + // FIXME: need to hack in more flexible Content-Type setting here! + if (!kwArgs.user) { + http.open("POST", url, async); + }else{ + http.open("POST", url, async, kwArgs.user, kwArgs.password); + } + setHeaders(http, kwArgs); + http.setRequestHeader("Content-Type", kwArgs.multipart ? ("multipart/form-data; boundary=" + this.multipartBoundary) : + (kwArgs.contentType || "application/x-www-form-urlencoded")); + try{ + http.send(query); + }catch(e){ + if(typeof http.abort == "function"){ + http.abort(); + } + doLoad(kwArgs, {status: 404}, url, query, useCache); + } + }else{ + var tmpUrl = url; + if(query != "") { + tmpUrl += (tmpUrl.indexOf("?") > -1 ? "&" : "?") + query; + } + if(preventCache) { + tmpUrl += (dojo.string.endsWithAny(tmpUrl, "?", "&") + ? "" : (tmpUrl.indexOf("?") > -1 ? "&" : "?")) + "dojo.preventCache=" + new Date().valueOf(); + } + if (!kwArgs.user) { + http.open(kwArgs.method.toUpperCase(), tmpUrl, async); + }else{ + http.open(kwArgs.method.toUpperCase(), tmpUrl, async, kwArgs.user, kwArgs.password); + } + setHeaders(http, kwArgs); + try { + http.send(null); + }catch(e) { + if(typeof http.abort == "function"){ + http.abort(); + } + doLoad(kwArgs, {status: 404}, url, query, useCache); + } + } + + if( !async ) { + doLoad(kwArgs, http, url, query, useCache); + _this._blockAsync = false; + } + + kwArgs.abort = function(){ + try{// khtml doesent reset readyState on abort, need this workaround + http._aborted = true; + }catch(e){/*squelsh*/} + return http.abort(); + } + + return; + } + dojo.io.transports.addTransport("XMLHTTPTransport"); +} + +} + +dojo.provide("dojo.io.cookie"); + +dojo.io.cookie.setCookie = function(/*String*/name, /*String*/value, + /*Number?*/days, /*String?*/path, + /*String?*/domain, /*boolean?*/secure){ + //summary: sets a cookie. + var expires = -1; + if((typeof days == "number")&&(days >= 0)){ + var d = new Date(); + d.setTime(d.getTime()+(days*24*60*60*1000)); + expires = d.toGMTString(); + } + value = escape(value); + document.cookie = name + "=" + value + ";" + + (expires != -1 ? " expires=" + expires + ";" : "") + + (path ? "path=" + path : "") + + (domain ? "; domain=" + domain : "") + + (secure ? "; secure" : ""); +} + +dojo.io.cookie.set = dojo.io.cookie.setCookie; + +dojo.io.cookie.getCookie = function(/*String*/name){ + //summary: Gets a cookie with the given name. + + // FIXME: Which cookie should we return? + // If there are cookies set for different sub domains in the current + // scope there could be more than one cookie with the same name. + // I think taking the last one in the list takes the one from the + // deepest subdomain, which is what we're doing here. + var idx = document.cookie.lastIndexOf(name+'='); + if(idx == -1) { return null; } + var value = document.cookie.substring(idx+name.length+1); + var end = value.indexOf(';'); + if(end == -1) { end = value.length; } + value = value.substring(0, end); + value = unescape(value); + return value; //String +} + +dojo.io.cookie.get = dojo.io.cookie.getCookie; + +dojo.io.cookie.deleteCookie = function(/*String*/name){ + //summary: Deletes a cookie with the given name. + dojo.io.cookie.setCookie(name, "-", 0); +} + +dojo.io.cookie.setObjectCookie = function( /*String*/name, /*Object*/obj, + /*Number?*/days, /*String?*/path, + /*String?*/domain, /*boolean?*/secure, + /*boolean?*/clearCurrent){ + //summary: Takes an object, serializes it to a cookie value, and either + //sets a cookie with the serialized value. + //description: If clearCurrent is true, then any current cookie value + //for this object will be replaced with the the new serialized object value. + //If clearCurrent is false, then the existing cookie value will be modified + //with any changes from the new object value. + //Objects must be simple name/value pairs where the value is either a string + //or a number. Any other value will be ignored. + if(arguments.length == 5){ // for backwards compat + clearCurrent = domain; + domain = null; + secure = null; + } + var pairs = [], cookie, value = ""; + if(!clearCurrent){ + cookie = dojo.io.cookie.getObjectCookie(name); + } + if(days >= 0){ + if(!cookie){ cookie = {}; } + for(var prop in obj){ + if(obj[prop] == null){ + delete cookie[prop]; + }else if((typeof obj[prop] == "string")||(typeof obj[prop] == "number")){ + cookie[prop] = obj[prop]; + } + } + prop = null; + for(var prop in cookie){ + pairs.push(escape(prop) + "=" + escape(cookie[prop])); + } + value = pairs.join("&"); + } + dojo.io.cookie.setCookie(name, value, days, path, domain, secure); +} + +dojo.io.cookie.getObjectCookie = function(/*String*/name){ + //summary: Gets an object value for the given cookie name. The complement of + //dojo.io.cookie.setObjectCookie(). + var values = null, cookie = dojo.io.cookie.getCookie(name); + if(cookie){ + values = {}; + var pairs = cookie.split("&"); + for(var i = 0; i < pairs.length; i++){ + var pair = pairs[i].split("="); + var value = pair[1]; + if( isNaN(value) ){ value = unescape(pair[1]); } + values[ unescape(pair[0]) ] = value; + } + } + return values; +} + +dojo.io.cookie.isSupported = function(){ + //summary: Tests the browser to see if cookies are enabled. + if(typeof navigator.cookieEnabled != "boolean"){ + dojo.io.cookie.setCookie("__TestingYourBrowserForCookieSupport__", + "CookiesAllowed", 90, null); + var cookieVal = dojo.io.cookie.getCookie("__TestingYourBrowserForCookieSupport__"); + navigator.cookieEnabled = (cookieVal == "CookiesAllowed"); + if(navigator.cookieEnabled){ + // FIXME: should we leave this around? + this.deleteCookie("__TestingYourBrowserForCookieSupport__"); + } + } + return navigator.cookieEnabled; //boolean +} + +// need to leave this in for backwards-compat from 0.1 for when it gets pulled in by dojo.io.* +if(!dojo.io.cookies){ dojo.io.cookies = dojo.io.cookie; } + +dojo.kwCompoundRequire({ + common: ["dojo.io.common"], + rhino: ["dojo.io.RhinoIO"], + browser: ["dojo.io.BrowserIO", "dojo.io.cookie"], + dashboard: ["dojo.io.BrowserIO", "dojo.io.cookie"] +}); +dojo.provide("dojo.io.*"); + +dojo.provide("dojo.event.common"); + + + + + +// TODO: connection filter functions +// these are functions that accept a method invocation (like around +// advice) and return a boolean based on it. That value determines +// whether or not the connection proceeds. It could "feel" like around +// advice for those who know what it is (calling proceed() or not), +// but I think presenting it as a "filter" and/or calling it with the +// function args and not the MethodInvocation might make it more +// palletable to "normal" users than around-advice currently is +// TODO: execution scope mangling +// YUI's event facility by default executes listeners in the context +// of the source object. This is very odd, but should probably be +// supported as an option (both for the source and for the dest). It +// can be thought of as a connection-specific hitch(). +// TODO: more resiliency for 4+ arguments to connect() + +dojo.event = new function(){ + this._canTimeout = dojo.lang.isFunction(dj_global["setTimeout"])||dojo.lang.isAlien(dj_global["setTimeout"]); + + // FIXME: where should we put this method (not here!)? + function interpolateArgs(args, searchForNames){ + var dl = dojo.lang; + var ao = { + srcObj: dj_global, + srcFunc: null, + adviceObj: dj_global, + adviceFunc: null, + aroundObj: null, + aroundFunc: null, + adviceType: (args.length>2) ? args[0] : "after", + precedence: "last", + once: false, + delay: null, + rate: 0, + adviceMsg: false, + maxCalls: -1 + }; + + switch(args.length){ + case 0: return; + case 1: return; + case 2: + ao.srcFunc = args[0]; + ao.adviceFunc = args[1]; + break; + case 3: + if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isString(args[2]))){ + ao.adviceType = "after"; + ao.srcObj = args[0]; + ao.srcFunc = args[1]; + ao.adviceFunc = args[2]; + }else if((dl.isString(args[1]))&&(dl.isString(args[2]))){ + ao.srcFunc = args[1]; + ao.adviceFunc = args[2]; + }else if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isFunction(args[2]))){ + ao.adviceType = "after"; + ao.srcObj = args[0]; + ao.srcFunc = args[1]; + var tmpName = dl.nameAnonFunc(args[2], ao.adviceObj, searchForNames); + ao.adviceFunc = tmpName; + }else if((dl.isFunction(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))){ + ao.adviceType = "after"; + ao.srcObj = dj_global; + var tmpName = dl.nameAnonFunc(args[0], ao.srcObj, searchForNames); + ao.srcFunc = tmpName; + ao.adviceObj = args[1]; + ao.adviceFunc = args[2]; + } + break; + case 4: + if((dl.isObject(args[0]))&&(dl.isObject(args[2]))){ + // we can assume that we've got an old-style "connect" from + // the sigslot school of event attachment. We therefore + // assume after-advice. + ao.adviceType = "after"; + ao.srcObj = args[0]; + ao.srcFunc = args[1]; + ao.adviceObj = args[2]; + ao.adviceFunc = args[3]; + }else if((dl.isString(args[0]))&&(dl.isString(args[1]))&&(dl.isObject(args[2]))){ + ao.adviceType = args[0]; + ao.srcObj = dj_global; + ao.srcFunc = args[1]; + ao.adviceObj = args[2]; + ao.adviceFunc = args[3]; + }else if((dl.isString(args[0]))&&(dl.isFunction(args[1]))&&(dl.isObject(args[2]))){ + ao.adviceType = args[0]; + ao.srcObj = dj_global; + var tmpName = dl.nameAnonFunc(args[1], dj_global, searchForNames); + ao.srcFunc = tmpName; + ao.adviceObj = args[2]; + ao.adviceFunc = args[3]; + }else if((dl.isString(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))&&(dl.isFunction(args[3]))){ + ao.srcObj = args[1]; + ao.srcFunc = args[2]; + var tmpName = dl.nameAnonFunc(args[3], dj_global, searchForNames); + ao.adviceObj = dj_global; + ao.adviceFunc = tmpName; + }else if(dl.isObject(args[1])){ + ao.srcObj = args[1]; + ao.srcFunc = args[2]; + ao.adviceObj = dj_global; + ao.adviceFunc = args[3]; + }else if(dl.isObject(args[2])){ + ao.srcObj = dj_global; + ao.srcFunc = args[1]; + ao.adviceObj = args[2]; + ao.adviceFunc = args[3]; + }else{ + ao.srcObj = ao.adviceObj = ao.aroundObj = dj_global; + ao.srcFunc = args[1]; + ao.adviceFunc = args[2]; + ao.aroundFunc = args[3]; + } + break; + case 6: + ao.srcObj = args[1]; + ao.srcFunc = args[2]; + ao.adviceObj = args[3] + ao.adviceFunc = args[4]; + ao.aroundFunc = args[5]; + ao.aroundObj = dj_global; + break; + default: + ao.srcObj = args[1]; + ao.srcFunc = args[2]; + ao.adviceObj = args[3] + ao.adviceFunc = args[4]; + ao.aroundObj = args[5]; + ao.aroundFunc = args[6]; + ao.once = args[7]; + ao.delay = args[8]; + ao.rate = args[9]; + ao.adviceMsg = args[10]; + ao.maxCalls = (!isNaN(parseInt(args[11]))) ? args[11] : -1; + break; + } + + if(dl.isFunction(ao.aroundFunc)){ + var tmpName = dl.nameAnonFunc(ao.aroundFunc, ao.aroundObj, searchForNames); + ao.aroundFunc = tmpName; + } + + if(dl.isFunction(ao.srcFunc)){ + ao.srcFunc = dl.getNameInObj(ao.srcObj, ao.srcFunc); + } + + if(dl.isFunction(ao.adviceFunc)){ + ao.adviceFunc = dl.getNameInObj(ao.adviceObj, ao.adviceFunc); + } + + if((ao.aroundObj)&&(dl.isFunction(ao.aroundFunc))){ + ao.aroundFunc = dl.getNameInObj(ao.aroundObj, ao.aroundFunc); + } + + if(!ao.srcObj){ + dojo.raise("bad srcObj for srcFunc: "+ao.srcFunc); + } + if(!ao.adviceObj){ + dojo.raise("bad adviceObj for adviceFunc: "+ao.adviceFunc); + } + + if(!ao.adviceFunc){ + dojo.debug("bad adviceFunc for srcFunc: "+ao.srcFunc); + dojo.debugShallow(ao); + } + + return ao; + } + + this.connect = function(/*...*/){ + // summary: + // dojo.event.connect is the glue that holds most Dojo-based + // applications together. Most combinations of arguments are + // supported, with the connect() method attempting to disambiguate + // the implied types of positional parameters. The following will + // all work: + // dojo.event.connect("globalFunctionName1", "globalFunctionName2"); + // dojo.event.connect(functionReference1, functionReference2); + // dojo.event.connect("globalFunctionName1", functionReference2); + // dojo.event.connect(functionReference1, "globalFunctionName2"); + // dojo.event.connect(scope1, "functionName1", "globalFunctionName2"); + // dojo.event.connect("globalFunctionName1", scope2, "functionName2"); + // dojo.event.connect(scope1, "functionName1", scope2, "functionName2"); + // dojo.event.connect("after", scope1, "functionName1", scope2, "functionName2"); + // dojo.event.connect("before", scope1, "functionName1", scope2, "functionName2"); + // dojo.event.connect("around", scope1, "functionName1", + // scope2, "functionName2", + // aroundFunctionReference); + // dojo.event.connect("around", scope1, "functionName1", + // scope2, "functionName2", + // scope3, "aroundFunctionName"); + // dojo.event.connect("before-around", scope1, "functionName1", + // scope2, "functionName2", + // aroundFunctionReference); + // dojo.event.connect("after-around", scope1, "functionName1", + // scope2, "functionName2", + // aroundFunctionReference); + // dojo.event.connect("after-around", scope1, "functionName1", + // scope2, "functionName2", + // scope3, "aroundFunctionName"); + // dojo.event.connect("around", scope1, "functionName1", + // scope2, "functionName2", + // scope3, "aroundFunctionName", true, 30); + // dojo.event.connect("around", scope1, "functionName1", + // scope2, "functionName2", + // scope3, "aroundFunctionName", null, null, 10); + // adviceType: + // Optional. String. One of "before", "after", "around", + // "before-around", or "after-around". FIXME + // srcObj: + // the scope in which to locate/execute the named srcFunc. Along + // with srcFunc, this creates a way to dereference the function to + // call. So if the function in question is "foo.bar", the + // srcObj/srcFunc pair would be foo and "bar", where "bar" is a + // string and foo is an object reference. + // srcFunc: + // the name of the function to connect to. When it is executed, + // the listener being registered with this call will be called. + // The adviceType defines the call order between the source and + // the target functions. + // adviceObj: + // the scope in which to locate/execute the named adviceFunc. + // adviceFunc: + // the name of the function being conected to srcObj.srcFunc + // aroundObj: + // the scope in which to locate/execute the named aroundFunc. + // aroundFunc: + // the name of, or a reference to, the function that will be used + // to mediate the advice call. Around advice requires a special + // unary function that will be passed a "MethodInvocation" object. + // These objects have several important properties, namely: + // - args + // a mutable array of arguments to be passed into the + // wrapped function + // - proceed + // a function that "continues" the invocation. The result + // of this function is the return of the wrapped function. + // You can then manipulate this return before passing it + // back out (or take further action based on it). + // once: + // boolean that determines whether or not this connect() will + // create a new connection if an identical connect() has already + // been made. Defaults to "false". + // delay: + // an optional delay (in ms), as an integer, for dispatch of a + // listener after the source has been fired. + // rate: + // an optional rate throttling parameter (integer, in ms). When + // specified, this particular connection will not fire more than + // once in the interval specified by the rate + // adviceMsg: + // boolean. Should the listener have all the parameters passed in + // as a single argument? + + /* + ao.adviceType = args[0]; + ao.srcObj = args[1]; + ao.srcFunc = args[2]; + ao.adviceObj = args[3] + ao.adviceFunc = args[4]; + ao.aroundObj = args[5]; + ao.aroundFunc = args[6]; + ao.once = args[7]; + ao.delay = args[8]; + ao.rate = args[9]; + ao.adviceMsg = args[10]; + ao.maxCalls = args[11]; + */ + if(arguments.length == 1){ + var ao = arguments[0]; + }else{ + var ao = interpolateArgs(arguments, true); + } + /* + if(dojo.lang.isString(ao.srcFunc) && (ao.srcFunc.toLowerCase() == "onkey") ){ + if(dojo.render.html.ie){ + ao.srcFunc = "onkeydown"; + this.connect(ao); + } + ao.srcFunc = "onkeypress"; + } + */ + + if(dojo.lang.isArray(ao.srcObj) && ao.srcObj!=""){ + var tmpAO = {}; + for(var x in ao){ + tmpAO[x] = ao[x]; + } + var mjps = []; + dojo.lang.forEach(ao.srcObj, function(src){ + if((dojo.render.html.capable)&&(dojo.lang.isString(src))){ + src = dojo.byId(src); + // dojo.debug(src); + } + tmpAO.srcObj = src; + // dojo.debug(tmpAO.srcObj, tmpAO.srcFunc); + // dojo.debug(tmpAO.adviceObj, tmpAO.adviceFunc); + mjps.push(dojo.event.connect.call(dojo.event, tmpAO)); + }); + return mjps; + } + + // FIXME: just doing a "getForMethod()" seems to be enough to put this into infinite recursion!! + var mjp = dojo.event.MethodJoinPoint.getForMethod(ao.srcObj, ao.srcFunc); + if(ao.adviceFunc){ + var mjp2 = dojo.event.MethodJoinPoint.getForMethod(ao.adviceObj, ao.adviceFunc); + } + + mjp.kwAddAdvice(ao); + + // advanced users might want to fsck w/ the join point manually + return mjp; // a MethodJoinPoint object + } + + this.log = function(/*object or funcName*/ a1, /*funcName*/ a2){ + // summary: + // a function that will wrap and log all calls to the specified + // a1.a2() function. If only a1 is passed, it'll be used as a + // function or function name on the global context. Logging will + // be sent to dojo.debug + // a1: + // if a2 is passed, this should be an object. If not, it can be a + // function or function name. + // a2: + // a function name + var kwArgs; + if((arguments.length == 1)&&(typeof a1 == "object")){ + kwArgs = a1; + }else{ + kwArgs = { + srcObj: a1, + srcFunc: a2 + }; + } + kwArgs.adviceFunc = function(){ + var argsStr = []; + for(var x=0; x= this.jp_.around.length){ + return this.jp_.object[this.jp_.methodname].apply(this.jp_.object, this.args); + // return this.jp_.run_before_after(this.object, this.args); + }else{ + var ti = this.jp_.around[this.around_index]; + var mobj = ti[0]||dj_global; + var meth = ti[1]; + return mobj[meth].call(mobj, this); + } +} + + +dojo.event.MethodJoinPoint = function(/*Object*/obj, /*String*/funcName){ + this.object = obj||dj_global; + this.methodname = funcName; + this.methodfunc = this.object[funcName]; + this.squelch = false; + // this.before = []; + // this.after = []; + // this.around = []; +} + +dojo.event.MethodJoinPoint.getForMethod = function(/*Object*/obj, /*String*/funcName){ + // summary: + // "static" class function for returning a MethodJoinPoint from a + // scoped function. If one doesn't exist, one is created. + // obj: + // the scope to search for the function in + // funcName: + // the name of the function to return a MethodJoinPoint for + if(!obj){ obj = dj_global; } + var ofn = obj[funcName]; + if(!ofn){ + // supply a do-nothing method implementation + ofn = obj[funcName] = function(){}; + if(!obj[funcName]){ + // e.g. cannot add to inbuilt objects in IE6 + dojo.raise("Cannot set do-nothing method on that object "+funcName); + } + }else if((typeof ofn != "function")&&(!dojo.lang.isFunction(ofn))&&(!dojo.lang.isAlien(ofn))){ + // FIXME: should we throw an exception here instead? + return null; + } + // we hide our joinpoint instance in obj[funcName + '$joinpoint'] + var jpname = funcName + "$joinpoint"; + var jpfuncname = funcName + "$joinpoint$method"; + var joinpoint = obj[jpname]; + if(!joinpoint){ + var isNode = false; + if(dojo.event["browser"]){ + if( (obj["attachEvent"])|| + (obj["nodeType"])|| + (obj["addEventListener"]) ){ + isNode = true; + dojo.event.browser.addClobberNodeAttrs(obj, [jpname, jpfuncname, funcName]); + } + } + var origArity = ofn.length; + obj[jpfuncname] = ofn; + // joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, funcName); + joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, jpfuncname); + + if(!isNode){ + obj[funcName] = function(){ + // var args = []; + // for(var x=0; x -1){ + if(maxCount == 0){ + return; + } + marr[7]--; + } + var undef; + + var to = { + args: [], + jp_: this, + object: obj, + proceed: function(){ + return callObj[callFunc].apply(callObj, to.args); + } + }; + to.args = aargs; + + var delay = parseInt(marr[4]); + var hasDelay = ((!isNaN(delay))&&(marr[4]!==null)&&(typeof marr[4] != "undefined")); + if(marr[5]){ + var rate = parseInt(marr[5]); + var cur = new Date(); + var timerSet = false; + if((marr["last"])&&((cur-marr.last)<=rate)){ + if(dojo.event._canTimeout){ + if(marr["delayTimer"]){ + clearTimeout(marr.delayTimer); + } + var tod = parseInt(rate*2); // is rate*2 naive? + var mcpy = dojo.lang.shallowCopy(marr); + marr.delayTimer = setTimeout(function(){ + // FIXME: on IE at least, event objects from the + // browser can go out of scope. How (or should?) we + // deal with it? + mcpy[5] = 0; + unrollAdvice(mcpy); + }, tod); + } + return; + }else{ + marr.last = cur; + } + } + + // FIXME: need to enforce rates for a connection here! + + if(aroundFunc){ + // NOTE: around advice can't delay since we might otherwise depend + // on execution order! + aroundObj[aroundFunc].call(aroundObj, to); + }else{ + // var tmjp = dojo.event.MethodJoinPoint.getForMethod(obj, methname); + if((hasDelay)&&((dojo.render.html)||(dojo.render.svg))){ // FIXME: the render checks are grotty! + dj_global["setTimeout"](function(){ + if(msg){ + callObj[callFunc].call(callObj, to); + }else{ + callObj[callFunc].apply(callObj, args); + } + }, delay); + }else{ // many environments can't support delay! + if(msg){ + callObj[callFunc].call(callObj, to); + }else{ + callObj[callFunc].apply(callObj, args); + } + } + } + }; + + var unRollSquelch = function(){ + if(this.squelch){ + try{ + return unrollAdvice.apply(this, arguments); + }catch(e){ + dojo.debug(e); + } + }else{ + return unrollAdvice.apply(this, arguments); + } + }; + + if((this["before"])&&(this.before.length>0)){ + // pass a cloned array, if this event disconnects this event forEach on this.before wont work + dojo.lang.forEach(this.before.concat(new Array()), unRollSquelch); + } + + var result; + try{ + if((this["around"])&&(this.around.length>0)){ + var mi = new dojo.event.MethodInvocation(this, obj, args); + result = mi.proceed(); + }else if(this.methodfunc){ + result = this.object[this.methodname].apply(this.object, args); + } + }catch(e){ + if(!this.squelch){ + dojo.debug(e,"when calling",this.methodname,"on",this.object,"with arguments",args); + dojo.raise(e); + } + } + + if((this["after"])&&(this.after.length>0)){ + // see comment on this.before above + dojo.lang.forEach(this.after.concat(new Array()), unRollSquelch); + } + + return (this.methodfunc) ? result : null; + }, + + getArr: function(/*String*/kind){ + // summary: return a list of listeners of the past "kind" + // kind: + // can be one of: "before", "after", "around", "before-around", or + // "after-around" + var type = "after"; + // FIXME: we should be able to do this through props or Array.in() + if((typeof kind == "string")&&(kind.indexOf("before")!=-1)){ + type = "before"; + }else if(kind=="around"){ + type = "around"; + } + if(!this[type]){ this[type] = []; } + return this[type]; // Array + }, + + kwAddAdvice: function(/*Object*/args){ + // summary: + // adds advice to the joinpoint with arguments in a map + // args: + // An object that can have the following properties: + // - adviceType + // - adviceObj + // - adviceFunc + // - aroundObj + // - aroundFunc + // - once + // - delay + // - rate + // - adviceMsg + // - maxCalls + this.addAdvice( args["adviceObj"], args["adviceFunc"], + args["aroundObj"], args["aroundFunc"], + args["adviceType"], args["precedence"], + args["once"], args["delay"], args["rate"], + args["adviceMsg"], args["maxCalls"]); + }, + + addAdvice: function( thisAdviceObj, thisAdvice, + thisAroundObj, thisAround, + adviceType, precedence, + once, delay, rate, asMessage, + maxCalls){ + // summary: + // add advice to this joinpoint using positional parameters + // thisAdviceObj: + // the scope in which to locate/execute the named adviceFunc. + // thisAdviceFunc: + // the name of the function being conected + // thisAroundObj: + // the scope in which to locate/execute the named aroundFunc. + // thisAroundFunc: + // the name of the function that will be used to mediate the + // advice call. + // adviceType: + // Optional. String. One of "before", "after", "around", + // "before-around", or "after-around". FIXME + // once: + // boolean that determines whether or not this advice will create + // a new connection if an identical advice set has already been + // provided. Defaults to "false". + // delay: + // an optional delay (in ms), as an integer, for dispatch of a + // listener after the source has been fired. + // rate: + // an optional rate throttling parameter (integer, in ms). When + // specified, this particular connection will not fire more than + // once in the interval specified by the rate + // adviceMsg: + // boolean. Should the listener have all the parameters passed in + // as a single argument? + // maxCalls: + // Integer. The maximum number of times this connection can be + // used before being auto-disconnected. -1 signals that the + // connection should never be disconnected. + var arr = this.getArr(adviceType); + if(!arr){ + dojo.raise("bad this: " + this); + } + + var ao = [thisAdviceObj, thisAdvice, thisAroundObj, thisAround, delay, rate, asMessage, maxCalls]; + + if(once){ + if(this.hasAdvice(thisAdviceObj, thisAdvice, adviceType, arr) >= 0){ + return; + } + } + + if(precedence == "first"){ + arr.unshift(ao); + }else{ + arr.push(ao); + } + }, + + hasAdvice: function(thisAdviceObj, thisAdvice, adviceType, arr){ + // summary: + // returns the array index of the first existing connection + // betweened the passed advice and this joinpoint. Will be -1 if + // none exists. + // thisAdviceObj: + // the scope in which to locate/execute the named adviceFunc. + // thisAdviceFunc: + // the name of the function being conected + // adviceType: + // Optional. String. One of "before", "after", "around", + // "before-around", or "after-around". FIXME + // arr: + // Optional. The list of advices to search. Will be found via + // adviceType if not passed + if(!arr){ arr = this.getArr(adviceType); } + var ind = -1; + for(var x=0; x=0; i=i-1){ + var el = na[i]; + try{ + if(el && el["__clobberAttrs__"]){ + for(var j=0; j= 65 && unifiedCharCode <= 90 && evt.shiftKey == false){ + unifiedCharCode += 32; + } + if(unifiedCharCode >= 1 && unifiedCharCode <= 26 && evt.ctrlKey){ + unifiedCharCode += 96; // 001-032 = ctrl+[a-z] + } + evt.key = String.fromCharCode(unifiedCharCode); + } + } + } else if(evt["type"] == "keypress"){ + if(dojo.render.html.opera){ + if(evt.which == 0){ + evt.key = evt.keyCode; + }else if(evt.which > 0){ + switch(evt.which){ + case evt.KEY_SHIFT: + case evt.KEY_CTRL: + case evt.KEY_ALT: + case evt.KEY_CAPS_LOCK: + case evt.KEY_NUM_LOCK: + case evt.KEY_SCROLL_LOCK: + break; + case evt.KEY_PAUSE: + case evt.KEY_TAB: + case evt.KEY_BACKSPACE: + case evt.KEY_ENTER: + case evt.KEY_ESCAPE: + evt.key = evt.which; + break; + default: + var unifiedCharCode = evt.which; + if((evt.ctrlKey || evt.altKey || evt.metaKey) && (evt.which >= 65 && evt.which <= 90 && evt.shiftKey == false)){ + unifiedCharCode += 32; + } + evt.key = String.fromCharCode(unifiedCharCode); + } + } + }else if(dojo.render.html.ie){ // catch some IE keys that are hard to get in keyDown + // key combinations were handled in onKeyDown + if(!evt.ctrlKey && !evt.altKey && evt.keyCode >= evt.KEY_SPACE){ + evt.key = String.fromCharCode(evt.keyCode); + } + }else if(dojo.render.html.safari){ + switch(evt.keyCode){ + case 25: evt.key = evt.KEY_TAB; evt.shift = true;break; + case 63232: evt.key = evt.KEY_UP_ARROW; break; + case 63233: evt.key = evt.KEY_DOWN_ARROW; break; + case 63234: evt.key = evt.KEY_LEFT_ARROW; break; + case 63235: evt.key = evt.KEY_RIGHT_ARROW; break; + case 63236: evt.key = evt.KEY_F1; break; + case 63237: evt.key = evt.KEY_F2; break; + case 63238: evt.key = evt.KEY_F3; break; + case 63239: evt.key = evt.KEY_F4; break; + case 63240: evt.key = evt.KEY_F5; break; + case 63241: evt.key = evt.KEY_F6; break; + case 63242: evt.key = evt.KEY_F7; break; + case 63243: evt.key = evt.KEY_F8; break; + case 63244: evt.key = evt.KEY_F9; break; + case 63245: evt.key = evt.KEY_F10; break; + case 63246: evt.key = evt.KEY_F11; break; + case 63247: evt.key = evt.KEY_F12; break; + case 63250: evt.key = evt.KEY_PAUSE; break; + case 63272: evt.key = evt.KEY_DELETE; break; + case 63273: evt.key = evt.KEY_HOME; break; + case 63275: evt.key = evt.KEY_END; break; + case 63276: evt.key = evt.KEY_PAGE_UP; break; + case 63277: evt.key = evt.KEY_PAGE_DOWN; break; + case 63302: evt.key = evt.KEY_INSERT; break; + case 63248://prtscr + case 63249://scrolllock + case 63289://numlock + break; + default: + evt.key = evt.charCode >= evt.KEY_SPACE ? String.fromCharCode(evt.charCode) : evt.keyCode; + } + }else{ + evt.key = evt.charCode > 0 ? String.fromCharCode(evt.charCode) : evt.keyCode; + } + } + } + if(dojo.render.html.ie){ + if(!evt.target){ evt.target = evt.srcElement; } + if(!evt.currentTarget){ evt.currentTarget = (sender ? sender : evt.srcElement); } + if(!evt.layerX){ evt.layerX = evt.offsetX; } + if(!evt.layerY){ evt.layerY = evt.offsetY; } + // FIXME: scroll position query is duped from dojo.html to avoid dependency on that entire module + // DONOT replace the following to use dojo.body(), in IE, document.documentElement should be used + // here rather than document.body + var doc = (evt.srcElement && evt.srcElement.ownerDocument) ? evt.srcElement.ownerDocument : document; + var docBody = ((dojo.render.html.ie55)||(doc["compatMode"] == "BackCompat")) ? doc.body : doc.documentElement; + if(!evt.pageX){ evt.pageX = evt.clientX + (docBody.scrollLeft || 0) } + if(!evt.pageY){ evt.pageY = evt.clientY + (docBody.scrollTop || 0) } + // mouseover + if(evt.type == "mouseover"){ evt.relatedTarget = evt.fromElement; } + // mouseout + if(evt.type == "mouseout"){ evt.relatedTarget = evt.toElement; } + this.currentEvent = evt; + evt.callListener = this.callListener; + evt.stopPropagation = this._stopPropagation; + evt.preventDefault = this._preventDefault; + } + return evt; // Event + } + + this.stopEvent = function(/*Event*/evt){ + // summary: + // prevents propigation and clobbers the default action of the + // passed event + // evt: Optional for IE. The native event object. + if(window.event){ + evt.cancelBubble = true; + evt.returnValue = false; + }else{ + evt.preventDefault(); + evt.stopPropagation(); + } + } +} + +dojo.kwCompoundRequire({ + common: ["dojo.event.common", "dojo.event.topic"], + browser: ["dojo.event.browser"], + dashboard: ["dojo.event.browser"] +}); +dojo.provide("dojo.event.*"); + +dojo.provide("dojo.gfx.color"); + + + +// TODO: rewrite the "x2y" methods to take advantage of the parsing +// abilities of the Color object. Also, beef up the Color +// object (as possible) to parse most common formats + +// takes an r, g, b, a(lpha) value, [r, g, b, a] array, "rgb(...)" string, hex string (#aaa, #aaaaaa, aaaaaaa) +dojo.gfx.color.Color = function(r, g, b, a) { + // dojo.debug("r:", r[0], "g:", r[1], "b:", r[2]); + if(dojo.lang.isArray(r)){ + this.r = r[0]; + this.g = r[1]; + this.b = r[2]; + this.a = r[3]||1.0; + }else if(dojo.lang.isString(r)){ + var rgb = dojo.gfx.color.extractRGB(r); + this.r = rgb[0]; + this.g = rgb[1]; + this.b = rgb[2]; + this.a = g||1.0; + }else if(r instanceof dojo.gfx.color.Color){ + // why does this create a new instance if we were passed one? + this.r = r.r; + this.b = r.b; + this.g = r.g; + this.a = r.a; + }else{ + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } +} + +dojo.gfx.color.Color.fromArray = function(arr) { + return new dojo.gfx.color.Color(arr[0], arr[1], arr[2], arr[3]); +} + +dojo.extend(dojo.gfx.color.Color, { + toRgb: function(includeAlpha) { + if(includeAlpha) { + return this.toRgba(); + } else { + return [this.r, this.g, this.b]; + } + }, + toRgba: function() { + return [this.r, this.g, this.b, this.a]; + }, + toHex: function() { + return dojo.gfx.color.rgb2hex(this.toRgb()); + }, + toCss: function() { + return "rgb(" + this.toRgb().join() + ")"; + }, + toString: function() { + return this.toHex(); // decent default? + }, + blend: function(color, weight){ + var rgb = null; + if(dojo.lang.isArray(color)){ + rgb = color; + }else if(color instanceof dojo.gfx.color.Color){ + rgb = color.toRgb(); + }else{ + rgb = new dojo.gfx.color.Color(color).toRgb(); + } + return dojo.gfx.color.blend(this.toRgb(), rgb, weight); + } +}); + +dojo.gfx.color.named = { + white: [255,255,255], + black: [0,0,0], + red: [255,0,0], + green: [0,255,0], + lime: [0,255,0], + blue: [0,0,255], + navy: [0,0,128], + gray: [128,128,128], + silver: [192,192,192] +}; + +dojo.gfx.color.blend = function(a, b, weight){ + // summary: + // blend colors a and b (both as RGB array or hex strings) with weight + // from -1 to +1, 0 being a 50/50 blend + if(typeof a == "string"){ + return dojo.gfx.color.blendHex(a, b, weight); + } + if(!weight){ + weight = 0; + } + weight = Math.min(Math.max(-1, weight), 1); + + // alex: this interface blows. + // map -1 to 1 to the range 0 to 1 + weight = ((weight + 1)/2); + + var c = []; + + // var stop = (1000*weight); + for(var x = 0; x < 3; x++){ + c[x] = parseInt( b[x] + ( (a[x] - b[x]) * weight) ); + } + return c; +} + +// very convenient blend that takes and returns hex values +// (will get called automatically by blend when blend gets strings) +dojo.gfx.color.blendHex = function(a, b, weight) { + return dojo.gfx.color.rgb2hex(dojo.gfx.color.blend(dojo.gfx.color.hex2rgb(a), dojo.gfx.color.hex2rgb(b), weight)); +} + +// get RGB array from css-style color declarations +dojo.gfx.color.extractRGB = function(color) { + var hex = "0123456789abcdef"; + color = color.toLowerCase(); + if( color.indexOf("rgb") == 0 ) { + var matches = color.match(/rgba*\((\d+), *(\d+), *(\d+)/i); + var ret = matches.splice(1, 3); + return ret; + } else { + var colors = dojo.gfx.color.hex2rgb(color); + if(colors) { + return colors; + } else { + // named color (how many do we support?) + return dojo.gfx.color.named[color] || [255, 255, 255]; + } + } +} + +dojo.gfx.color.hex2rgb = function(hex) { + var hexNum = "0123456789ABCDEF"; + var rgb = new Array(3); + if( hex.indexOf("#") == 0 ) { hex = hex.substring(1); } + hex = hex.toUpperCase(); + if(hex.replace(new RegExp("["+hexNum+"]", "g"), "") != "") { + return null; + } + if( hex.length == 3 ) { + rgb[0] = hex.charAt(0) + hex.charAt(0) + rgb[1] = hex.charAt(1) + hex.charAt(1) + rgb[2] = hex.charAt(2) + hex.charAt(2); + } else { + rgb[0] = hex.substring(0, 2); + rgb[1] = hex.substring(2, 4); + rgb[2] = hex.substring(4); + } + for(var i = 0; i < rgb.length; i++) { + rgb[i] = hexNum.indexOf(rgb[i].charAt(0)) * 16 + hexNum.indexOf(rgb[i].charAt(1)); + } + return rgb; +} + +dojo.gfx.color.rgb2hex = function(r, g, b) { + if(dojo.lang.isArray(r)) { + g = r[1] || 0; + b = r[2] || 0; + r = r[0] || 0; + } + var ret = dojo.lang.map([r, g, b], function(x) { + x = new Number(x); + var s = x.toString(16); + while(s.length < 2) { s = "0" + s; } + return s; + }); + ret.unshift("#"); + return ret.join(""); +} + +dojo.provide("dojo.lfx.Animation"); + + + +/* + Animation package based on Dan Pupius' work: http://pupius.co.uk/js/Toolkit.Drawing.js +*/ +dojo.lfx.Line = function(/*int*/ start, /*int*/ end){ + // summary: dojo.lfx.Line is the object used to generate values + // from a start value to an end value + this.start = start; + this.end = end; + if(dojo.lang.isArray(start)){ + /* start: Array + end: Array + pId: a */ + var diff = []; + dojo.lang.forEach(this.start, function(s,i){ + diff[i] = this.end[i] - s; + }, this); + + this.getValue = function(/*float*/ n){ + var res = []; + dojo.lang.forEach(this.start, function(s, i){ + res[i] = (diff[i] * n) + s; + }, this); + return res; // Array + } + }else{ + var diff = end - start; + + this.getValue = function(/*float*/ n){ + // summary: returns the point on the line + // n: a floating point number greater than 0 and less than 1 + return (diff * n) + this.start; // Decimal + } + } +} + +if((dojo.render.html.khtml)&&(!dojo.render.html.safari)){ + // the cool kids are obviously not using konqueror... + // found a very wierd bug in floats constants, 1.5 evals as 1 + // seems somebody mixed up ints and floats in 3.5.4 ?? + // FIXME: investigate more and post a KDE bug (Fredrik) + dojo.lfx.easeDefault = function(/*Decimal?*/ n){ + // summary: Returns the point for point n on a sin wave. + return (parseFloat("0.5")+((Math.sin( (n+parseFloat("1.5")) * Math.PI))/2)); + } +}else{ + dojo.lfx.easeDefault = function(/*Decimal?*/ n){ + return (0.5+((Math.sin( (n+1.5) * Math.PI))/2)); + } +} + +dojo.lfx.easeIn = function(/*Decimal?*/ n){ + // summary: returns the point on an easing curve + // n: a floating point number greater than 0 and less than 1 + return Math.pow(n, 3); +} + +dojo.lfx.easeOut = function(/*Decimal?*/ n){ + // summary: returns the point on the line + // n: a floating point number greater than 0 and less than 1 + return ( 1 - Math.pow(1 - n, 3) ); +} + +dojo.lfx.easeInOut = function(/*Decimal?*/ n){ + // summary: returns the point on the line + // n: a floating point number greater than 0 and less than 1 + return ( (3 * Math.pow(n, 2)) - (2 * Math.pow(n, 3)) ); +} + +dojo.lfx.IAnimation = function(){ + // summary: dojo.lfx.IAnimation is an interface that implements + // commonly used functions of animation objects +} +dojo.lang.extend(dojo.lfx.IAnimation, { + // public properties + curve: null, + duration: 1000, + easing: null, + repeatCount: 0, + rate: 10, + + // events + handler: null, + beforeBegin: null, + onBegin: null, + onAnimate: null, + onEnd: null, + onPlay: null, + onPause: null, + onStop: null, + + // public methods + play: null, + pause: null, + stop: null, + + connect: function(/*Event*/ evt, /*Object*/ scope, /*Function*/ newFunc){ + // summary: Convenience function. Quickly connect to an event + // of this object and save the old functions connected to it. + // evt: The name of the event to connect to. + // scope: the scope in which to run newFunc. + // newFunc: the function to run when evt is fired. + if(!newFunc){ + /* scope: Function + newFunc: null + pId: f */ + newFunc = scope; + scope = this; + } + newFunc = dojo.lang.hitch(scope, newFunc); + var oldFunc = this[evt]||function(){}; + this[evt] = function(){ + var ret = oldFunc.apply(this, arguments); + newFunc.apply(this, arguments); + return ret; + } + return this; // dojo.lfx.IAnimation + }, + + fire: function(/*Event*/ evt, /*Array*/ args){ + // summary: Convenience function. Fire event "evt" and pass it + // the arguments specified in "args". + // evt: The event to fire. + // args: The arguments to pass to the event. + if(this[evt]){ + this[evt].apply(this, (args||[])); + } + return this; // dojo.lfx.IAnimation + }, + + repeat: function(/*int*/ count){ + // summary: Set the repeat count of this object. + // count: How many times to repeat the animation. + this.repeatCount = count; + return this; // dojo.lfx.IAnimation + }, + + // private properties + _active: false, + _paused: false +}); + +dojo.lfx.Animation = function( /*Object*/ handlers, + /*int*/ duration, + /*dojo.lfx.Line*/ curve, + /*function*/ easing, + /*int*/ repeatCount, + /*int*/ rate){ + // summary + // a generic animation object that fires callbacks into it's handlers + // object at various states + // handlers: { handler: Function?, onstart: Function?, onstop: Function?, onanimate: Function? } + dojo.lfx.IAnimation.call(this); + if(dojo.lang.isNumber(handlers)||(!handlers && duration.getValue)){ + // no handlers argument: + rate = repeatCount; + repeatCount = easing; + easing = curve; + curve = duration; + duration = handlers; + handlers = null; + }else if(handlers.getValue||dojo.lang.isArray(handlers)){ + // no handlers or duration: + rate = easing; + repeatCount = curve; + easing = duration; + curve = handlers; + duration = null; + handlers = null; + } + if(dojo.lang.isArray(curve)){ + /* curve: Array + pId: a */ + this.curve = new dojo.lfx.Line(curve[0], curve[1]); + }else{ + this.curve = curve; + } + if(duration != null && duration > 0){ this.duration = duration; } + if(repeatCount){ this.repeatCount = repeatCount; } + if(rate){ this.rate = rate; } + if(handlers){ + dojo.lang.forEach([ + "handler", "beforeBegin", "onBegin", + "onEnd", "onPlay", "onStop", "onAnimate" + ], function(item){ + if(handlers[item]){ + this.connect(item, handlers[item]); + } + }, this); + } + if(easing && dojo.lang.isFunction(easing)){ + this.easing=easing; + } +} +dojo.inherits(dojo.lfx.Animation, dojo.lfx.IAnimation); +dojo.lang.extend(dojo.lfx.Animation, { + // "private" properties + _startTime: null, + _endTime: null, + _timer: null, + _percent: 0, + _startRepeatCount: 0, + + // public methods + play: function(/*int?*/ delay, /*bool?*/ gotoStart){ + // summary: Start the animation. + // delay: How many milliseconds to delay before starting. + // gotoStart: If true, starts the animation from the beginning; otherwise, + // starts it from its current position. + if(gotoStart){ + clearTimeout(this._timer); + this._active = false; + this._paused = false; + this._percent = 0; + }else if(this._active && !this._paused){ + return this; // dojo.lfx.Animation + } + + this.fire("handler", ["beforeBegin"]); + this.fire("beforeBegin"); + + if(delay > 0){ + setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay); + return this; // dojo.lfx.Animation + } + + this._startTime = new Date().valueOf(); + if(this._paused){ + this._startTime -= (this.duration * this._percent / 100); + } + this._endTime = this._startTime + this.duration; + + this._active = true; + this._paused = false; + + var step = this._percent / 100; + var value = this.curve.getValue(step); + if(this._percent == 0 ){ + if(!this._startRepeatCount){ + this._startRepeatCount = this.repeatCount; + } + this.fire("handler", ["begin", value]); + this.fire("onBegin", [value]); + } + + this.fire("handler", ["play", value]); + this.fire("onPlay", [value]); + + this._cycle(); + return this; // dojo.lfx.Animation + }, + + pause: function(){ + // summary: Pauses a running animation. + clearTimeout(this._timer); + if(!this._active){ return this; /*dojo.lfx.Animation*/} + this._paused = true; + var value = this.curve.getValue(this._percent / 100); + this.fire("handler", ["pause", value]); + this.fire("onPause", [value]); + return this; // dojo.lfx.Animation + }, + + gotoPercent: function(/*Decimal*/ pct, /*bool?*/ andPlay){ + // summary: Sets the progress of the animation. + // pct: A percentage in decimal notation (between and including 0.0 and 1.0). + // andPlay: If true, play the animation after setting the progress. + clearTimeout(this._timer); + this._active = true; + this._paused = true; + this._percent = pct; + if(andPlay){ this.play(); } + return this; // dojo.lfx.Animation + }, + + stop: function(/*bool?*/ gotoEnd){ + // summary: Stops a running animation. + // gotoEnd: If true, the animation will end. + clearTimeout(this._timer); + var step = this._percent / 100; + if(gotoEnd){ + step = 1; + } + var value = this.curve.getValue(step); + this.fire("handler", ["stop", value]); + this.fire("onStop", [value]); + this._active = false; + this._paused = false; + return this; // dojo.lfx.Animation + }, + + status: function(){ + // summary: Returns a string representation of the status of + // the animation. + if(this._active){ + return this._paused ? "paused" : "playing"; // String + }else{ + return "stopped"; // String + } + return this; + }, + + // "private" methods + _cycle: function(){ + clearTimeout(this._timer); + if(this._active){ + var curr = new Date().valueOf(); + var step = (curr - this._startTime) / (this._endTime - this._startTime); + + if(step >= 1){ + step = 1; + this._percent = 100; + }else{ + this._percent = step * 100; + } + + // Perform easing + if((this.easing)&&(dojo.lang.isFunction(this.easing))){ + step = this.easing(step); + } + + var value = this.curve.getValue(step); + this.fire("handler", ["animate", value]); + this.fire("onAnimate", [value]); + + if( step < 1 ){ + this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate); + }else{ + this._active = false; + this.fire("handler", ["end"]); + this.fire("onEnd"); + + if(this.repeatCount > 0){ + this.repeatCount--; + this.play(null, true); + }else if(this.repeatCount == -1){ + this.play(null, true); + }else{ + if(this._startRepeatCount){ + this.repeatCount = this._startRepeatCount; + this._startRepeatCount = 0; + } + } + } + } + return this; // dojo.lfx.Animation + } +}); + +dojo.lfx.Combine = function(/*dojo.lfx.IAnimation...*/ animations){ + // summary: An animation object to play animations passed to it at the same time. + dojo.lfx.IAnimation.call(this); + this._anims = []; + this._animsEnded = 0; + + var anims = arguments; + if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){ + /* animations: dojo.lfx.IAnimation[] + pId: a */ + anims = anims[0]; + } + + dojo.lang.forEach(anims, function(anim){ + this._anims.push(anim); + anim.connect("onEnd", dojo.lang.hitch(this, "_onAnimsEnded")); + }, this); +} +dojo.inherits(dojo.lfx.Combine, dojo.lfx.IAnimation); +dojo.lang.extend(dojo.lfx.Combine, { + // private members + _animsEnded: 0, + + // public methods + play: function(/*int?*/ delay, /*bool?*/ gotoStart){ + // summary: Start the animations. + // delay: How many milliseconds to delay before starting. + // gotoStart: If true, starts the animations from the beginning; otherwise, + // starts them from their current position. + if( !this._anims.length ){ return this; /*dojo.lfx.Combine*/} + + this.fire("beforeBegin"); + + if(delay > 0){ + setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay); + return this; // dojo.lfx.Combine + } + + if(gotoStart || this._anims[0].percent == 0){ + this.fire("onBegin"); + } + this.fire("onPlay"); + this._animsCall("play", null, gotoStart); + return this; // dojo.lfx.Combine + }, + + pause: function(){ + // summary: Pauses the running animations. + this.fire("onPause"); + this._animsCall("pause"); + return this; // dojo.lfx.Combine + }, + + stop: function(/*bool?*/ gotoEnd){ + // summary: Stops the running animations. + // gotoEnd: If true, the animations will end. + this.fire("onStop"); + this._animsCall("stop", gotoEnd); + return this; // dojo.lfx.Combine + }, + + // private methods + _onAnimsEnded: function(){ + this._animsEnded++; + if(this._animsEnded >= this._anims.length){ + this.fire("onEnd"); + } + return this; // dojo.lfx.Combine + }, + + _animsCall: function(/*String*/ funcName){ + var args = []; + if(arguments.length > 1){ + for(var i = 1 ; i < arguments.length ; i++){ + args.push(arguments[i]); + } + } + var _this = this; + dojo.lang.forEach(this._anims, function(anim){ + anim[funcName](args); + }, _this); + return this; // dojo.lfx.Combine + } +}); + +dojo.lfx.Chain = function(/*dojo.lfx.IAnimation...*/ animations) { + // summary: An animation object to play animations passed to it + // one after another. + dojo.lfx.IAnimation.call(this); + this._anims = []; + this._currAnim = -1; + + var anims = arguments; + if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){ + /* animations: dojo.lfx.IAnimation[] + pId: a */ + anims = anims[0]; + } + + var _this = this; + dojo.lang.forEach(anims, function(anim, i, anims_arr){ + this._anims.push(anim); + if(i < anims_arr.length - 1){ + anim.connect("onEnd", dojo.lang.hitch(this, "_playNext") ); + }else{ + anim.connect("onEnd", dojo.lang.hitch(this, function(){ this.fire("onEnd"); }) ); + } + }, this); +} +dojo.inherits(dojo.lfx.Chain, dojo.lfx.IAnimation); +dojo.lang.extend(dojo.lfx.Chain, { + // private members + _currAnim: -1, + + // public methods + play: function(/*int?*/ delay, /*bool?*/ gotoStart){ + // summary: Start the animation sequence. + // delay: How many milliseconds to delay before starting. + // gotoStart: If true, starts the sequence from the beginning; otherwise, + // starts it from its current position. + if( !this._anims.length ) { return this; /*dojo.lfx.Chain*/} + if( gotoStart || !this._anims[this._currAnim] ) { + this._currAnim = 0; + } + + var currentAnimation = this._anims[this._currAnim]; + + this.fire("beforeBegin"); + if(delay > 0){ + setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay); + return this; // dojo.lfx.Chain + } + + if(currentAnimation){ + if(this._currAnim == 0){ + this.fire("handler", ["begin", this._currAnim]); + this.fire("onBegin", [this._currAnim]); + } + this.fire("onPlay", [this._currAnim]); + currentAnimation.play(null, gotoStart); + } + return this; // dojo.lfx.Chain + }, + + pause: function(){ + // summary: Pauses the running animation sequence. + if( this._anims[this._currAnim] ) { + this._anims[this._currAnim].pause(); + this.fire("onPause", [this._currAnim]); + } + return this; // dojo.lfx.Chain + }, + + playPause: function(){ + // summary: If the animation sequence is playing, pause it; otherwise, + // play it. + if(this._anims.length == 0){ return this; } + if(this._currAnim == -1){ this._currAnim = 0; } + var currAnim = this._anims[this._currAnim]; + if( currAnim ) { + if( !currAnim._active || currAnim._paused ) { + this.play(); + } else { + this.pause(); + } + } + return this; // dojo.lfx.Chain + }, + + stop: function(){ + // summary: Stops the running animations. + var currAnim = this._anims[this._currAnim]; + if(currAnim){ + currAnim.stop(); + this.fire("onStop", [this._currAnim]); + } + return currAnim; // dojo.lfx.IAnimation + }, + + // private methods + _playNext: function(){ + if( this._currAnim == -1 || this._anims.length == 0 ) { return this; } + this._currAnim++; + if( this._anims[this._currAnim] ){ + this._anims[this._currAnim].play(null, true); + } + return this; // dojo.lfx.Chain + } +}); + +dojo.lfx.combine = function(/*dojo.lfx.IAnimation...*/ animations){ + // summary: Convenience function. Returns a dojo.lfx.Combine created + // using the animations passed in. + var anims = arguments; + if(dojo.lang.isArray(arguments[0])){ + /* animations: dojo.lfx.IAnimation[] + pId: a */ + anims = arguments[0]; + } + if(anims.length == 1){ return anims[0]; } + return new dojo.lfx.Combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.chain = function(/*dojo.lfx.IAnimation...*/ animations){ + // summary: Convenience function. Returns a dojo.lfx.Chain created + // using the animations passed in. + var anims = arguments; + if(dojo.lang.isArray(arguments[0])){ + /* animations: dojo.lfx.IAnimation[] + pId: a */ + anims = arguments[0]; + } + if(anims.length == 1){ return anims[0]; } + return new dojo.lfx.Chain(anims); // dojo.lfx.Combine +} + +dojo.provide("dojo.html.common"); + + + +dojo.lang.mixin(dojo.html, dojo.dom); + +dojo.html.body = function(){ + dojo.deprecated("dojo.html.body() moved to dojo.body()", "0.5"); + return dojo.body(); +} + +// FIXME: we are going to assume that we can throw any and every rendering +// engine into the IE 5.x box model. In Mozilla, we do this w/ CSS. +// Need to investigate for KHTML and Opera + +dojo.html.getEventTarget = function(/* DOMEvent */evt){ + // summary + // Returns the target of an event + if(!evt) { evt = dojo.global().event || {} }; + var t = (evt.srcElement ? evt.srcElement : (evt.target ? evt.target : null)); + while((t)&&(t.nodeType!=1)){ t = t.parentNode; } + return t; // HTMLElement +} + +dojo.html.getViewport = function(){ + // summary + // Returns the dimensions of the viewable area of a browser window + var _window = dojo.global(); + var _document = dojo.doc(); + var w = 0; + var h = 0; + + if(dojo.render.html.mozilla){ + // mozilla + w = _document.documentElement.clientWidth; + h = _window.innerHeight; + }else if(!dojo.render.html.opera && _window.innerWidth){ + //in opera9, dojo.body().clientWidth should be used, instead + //of window.innerWidth/document.documentElement.clientWidth + //so we have to check whether it is opera + w = _window.innerWidth; + h = _window.innerHeight; + } else if (!dojo.render.html.opera && dojo.exists(_document, "documentElement.clientWidth")){ + // IE6 Strict + var w2 = _document.documentElement.clientWidth; + // this lets us account for scrollbars + if(!w || w2 && w2 < w) { + w = w2; + } + h = _document.documentElement.clientHeight; + } else if (dojo.body().clientWidth){ + // IE, Opera + w = dojo.body().clientWidth; + h = dojo.body().clientHeight; + } + return { width: w, height: h }; // object +} + +dojo.html.getScroll = function(){ + // summary + // Returns the scroll position of the document + var _window = dojo.global(); + var _document = dojo.doc(); + var top = _window.pageYOffset || _document.documentElement.scrollTop || dojo.body().scrollTop || 0; + var left = _window.pageXOffset || _document.documentElement.scrollLeft || dojo.body().scrollLeft || 0; + return { + top: top, + left: left, + offset:{ x: left, y: top } // note the change, NOT an Array with added properties. + }; // object +} + +dojo.html.getParentByType = function(/* HTMLElement */node, /* string */type) { + // summary + // Returns the first ancestor of node with tagName type. + var _document = dojo.doc(); + var parent = dojo.byId(node); + type = type.toLowerCase(); + while((parent)&&(parent.nodeName.toLowerCase()!=type)){ + if(parent==(_document["body"]||_document["documentElement"])){ + return null; + } + parent = parent.parentNode; + } + return parent; // HTMLElement +} + +dojo.html.getAttribute = function(/* HTMLElement */node, /* string */attr){ + // summary + // Returns the value of attribute attr from node. + node = dojo.byId(node); + // FIXME: need to add support for attr-specific accessors + if((!node)||(!node.getAttribute)){ + // if(attr !== 'nwType'){ + // alert("getAttr of '" + attr + "' with bad node"); + // } + return null; + } + var ta = typeof attr == 'string' ? attr : new String(attr); + + // first try the approach most likely to succeed + var v = node.getAttribute(ta.toUpperCase()); + if((v)&&(typeof v == 'string')&&(v!="")){ + return v; // string + } + + // try returning the attributes value, if we couldn't get it as a string + if(v && v.value){ + return v.value; // string + } + + // this should work on Opera 7, but it's a little on the crashy side + if((node.getAttributeNode)&&(node.getAttributeNode(ta))){ + return (node.getAttributeNode(ta)).value; // string + }else if(node.getAttribute(ta)){ + return node.getAttribute(ta); // string + }else if(node.getAttribute(ta.toLowerCase())){ + return node.getAttribute(ta.toLowerCase()); // string + } + return null; // string +} + +dojo.html.hasAttribute = function(/* HTMLElement */node, /* string */attr){ + // summary + // Determines whether or not the specified node carries a value for the attribute in question. + return dojo.html.getAttribute(dojo.byId(node), attr) ? true : false; // boolean +} + +dojo.html.getCursorPosition = function(/* DOMEvent */e){ + // summary + // Returns the mouse position relative to the document (not the viewport). + // For example, if you have a document that is 10000px tall, + // but your browser window is only 100px tall, + // if you scroll to the bottom of the document and call this function it + // will return {x: 0, y: 10000} + // NOTE: for events delivered via dojo.event.connect() and/or dojoAttachEvent (for widgets), + // you can just access evt.pageX and evt.pageY, rather than calling this function. + e = e || dojo.global().event; + var cursor = {x:0, y:0}; + if(e.pageX || e.pageY){ + cursor.x = e.pageX; + cursor.y = e.pageY; + }else{ + var de = dojo.doc().documentElement; + var db = dojo.body(); + cursor.x = e.clientX + ((de||db)["scrollLeft"]) - ((de||db)["clientLeft"]); + cursor.y = e.clientY + ((de||db)["scrollTop"]) - ((de||db)["clientTop"]); + } + return cursor; // object +} + +dojo.html.isTag = function(/* HTMLElement */node) { + // summary + // Like dojo.dom.isTag, except case-insensitive + node = dojo.byId(node); + if(node && node.tagName) { + for (var i=1; i, + //which will be treated as an external javascript file in IE + var xscript = dojo.doc().createElement('script'); + xscript.src = "javascript:'dojo.html.createExternalElement=function(doc, tag){ return doc.createElement(tag); }'"; + dojo.doc().getElementsByTagName("head")[0].appendChild(xscript); + })(); + } +}else{ + //for other browsers, simply use document.createElement + //is enough + dojo.html.createExternalElement = function(/* HTMLDocument */doc, /* string */tag){ + // summary + // Creates an element in the HTML document, here for ActiveX activation workaround. + return doc.createElement(tag); // HTMLElement + } +} + +dojo.html._callDeprecated = function(inFunc, replFunc, args, argName, retValue){ + dojo.deprecated("dojo.html." + inFunc, + "replaced by dojo.html." + replFunc + "(" + (argName ? "node, {"+ argName + ": " + argName + "}" : "" ) + ")" + (retValue ? "." + retValue : ""), "0.5"); + var newArgs = []; + if(argName){ var argsIn = {}; argsIn[argName] = args[1]; newArgs.push(args[0]); newArgs.push(argsIn); } + else { newArgs = args } + var ret = dojo.html[replFunc].apply(dojo.html, args); + if(retValue){ return ret[retValue]; } + else { return ret; } +} + +dojo.html.getViewportWidth = function(){ + return dojo.html._callDeprecated("getViewportWidth", "getViewport", arguments, null, "width"); +} +dojo.html.getViewportHeight = function(){ + return dojo.html._callDeprecated("getViewportHeight", "getViewport", arguments, null, "height"); +} +dojo.html.getViewportSize = function(){ + return dojo.html._callDeprecated("getViewportSize", "getViewport", arguments); +} +dojo.html.getScrollTop = function(){ + return dojo.html._callDeprecated("getScrollTop", "getScroll", arguments, null, "top"); +} +dojo.html.getScrollLeft = function(){ + return dojo.html._callDeprecated("getScrollLeft", "getScroll", arguments, null, "left"); +} +dojo.html.getScrollOffset = function(){ + return dojo.html._callDeprecated("getScrollOffset", "getScroll", arguments, null, "offset"); +} + +dojo.provide("dojo.uri.Uri"); + +dojo.uri = new function() { + this.dojoUri = function (/*dojo.uri.Uri||String*/uri) { + // summary: returns a Uri object resolved relative to the dojo root + return new dojo.uri.Uri(dojo.hostenv.getBaseScriptUri(), uri); + } + + this.moduleUri = function(/*String*/module, /*dojo.uri.Uri||String*/uri){ + // summary: returns a Uri object relative to a module + // description: Examples: dojo.uri.moduleUri("dojo.widget","templates/template.html"), or dojo.uri.moduleUri("acme","images/small.png") + var loc = dojo.hostenv.getModuleSymbols(module).join('/'); + if(!loc){ + return null; + } + if(loc.lastIndexOf("/") != loc.length-1){ + loc += "/"; + } + + //If the path is an absolute path (starts with a / or is on another domain/xdomain) + //then don't add the baseScriptUri. + var colonIndex = loc.indexOf(":"); + var slashIndex = loc.indexOf("/"); + if(loc.charAt(0) != "/" && (colonIndex == -1 || colonIndex > slashIndex)){ + loc = dojo.hostenv.getBaseScriptUri() + loc; + } + + return new dojo.uri.Uri(loc,uri); + } + + this.Uri = function (/*dojo.uri.Uri||String...*/) { + // summary: Constructor to create an object representing a URI. + // description: + // Each argument is evaluated in order relative to the next until + // a canonical uri is produced. To get an absolute Uri relative + // to the current document use + // new dojo.uri.Uri(document.baseURI, uri) + + // TODO: support for IPv6, see RFC 2732 + + // resolve uri components relative to each other + var uri = arguments[0]; + for (var i = 1; i < arguments.length; i++) { + if(!arguments[i]) { continue; } + + // Safari doesn't support this.constructor so we have to be explicit + var relobj = new dojo.uri.Uri(arguments[i].toString()); + var uriobj = new dojo.uri.Uri(uri.toString()); + + if ((relobj.path=="")&&(relobj.scheme==null)&&(relobj.authority==null)&&(relobj.query==null)) { + if (relobj.fragment != null) { uriobj.fragment = relobj.fragment; } + relobj = uriobj; + } else if (relobj.scheme == null) { + relobj.scheme = uriobj.scheme; + + if (relobj.authority == null) { + relobj.authority = uriobj.authority; + + if (relobj.path.charAt(0) != "/") { + var path = uriobj.path.substring(0, + uriobj.path.lastIndexOf("/") + 1) + relobj.path; + + var segs = path.split("/"); + for (var j = 0; j < segs.length; j++) { + if (segs[j] == ".") { + if (j == segs.length - 1) { segs[j] = ""; } + else { segs.splice(j, 1); j--; } + } else if (j > 0 && !(j == 1 && segs[0] == "") && + segs[j] == ".." && segs[j-1] != "..") { + + if (j == segs.length - 1) { segs.splice(j, 1); segs[j - 1] = ""; } + else { segs.splice(j - 1, 2); j -= 2; } + } + } + relobj.path = segs.join("/"); + } + } + } + + uri = ""; + if (relobj.scheme != null) { uri += relobj.scheme + ":"; } + if (relobj.authority != null) { uri += "//" + relobj.authority; } + uri += relobj.path; + if (relobj.query != null) { uri += "?" + relobj.query; } + if (relobj.fragment != null) { uri += "#" + relobj.fragment; } + } + + this.uri = uri.toString(); + + // break the uri into its main components + var regexp = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"; + var r = this.uri.match(new RegExp(regexp)); + + this.scheme = r[2] || (r[1] ? "" : null); + this.authority = r[4] || (r[3] ? "" : null); + this.path = r[5]; // can never be undefined + this.query = r[7] || (r[6] ? "" : null); + this.fragment = r[9] || (r[8] ? "" : null); + + if (this.authority != null) { + // server based naming authority + regexp = "^((([^:]+:)?([^@]+))@)?([^:]*)(:([0-9]+))?$"; + r = this.authority.match(new RegExp(regexp)); + + this.user = r[3] || null; + this.password = r[4] || null; + this.host = r[5]; + this.port = r[7] || null; + } + + this.toString = function(){ return this.uri; } + } +}; + +dojo.provide("dojo.html.style"); + + + +dojo.html.getClass = function(/* HTMLElement */node){ + // summary + // Returns the string value of the list of CSS classes currently assigned directly + // to the node in question. Returns an empty string if no class attribute is found; + node = dojo.byId(node); + if(!node){ return ""; } + var cs = ""; + if(node.className){ + cs = node.className; + }else if(dojo.html.hasAttribute(node, "class")){ + cs = dojo.html.getAttribute(node, "class"); + } + return cs.replace(/^\s+|\s+$/g, ""); // string +} + +dojo.html.getClasses = function(/* HTMLElement */node) { + // summary + // Returns an array of CSS classes currently assigned directly to the node in question. + // Returns an empty array if no classes are found; + var c = dojo.html.getClass(node); + return (c == "") ? [] : c.split(/\s+/g); // array +} + +dojo.html.hasClass = function(/* HTMLElement */node, /* string */classname){ + // summary + // Returns whether or not the specified classname is a portion of the + // class list currently applied to the node. Does not cover cascaded + // styles, only classes directly applied to the node. + return (new RegExp('(^|\\s+)'+classname+'(\\s+|$)')).test(dojo.html.getClass(node)) // boolean +} + +dojo.html.prependClass = function(/* HTMLElement */node, /* string */classStr){ + // summary + // Adds the specified class to the beginning of the class list on the + // passed node. This gives the specified class the highest precidence + // when style cascading is calculated for the node. Returns true or + // false; indicating success or failure of the operation, respectively. + classStr += " " + dojo.html.getClass(node); + return dojo.html.setClass(node, classStr); // boolean +} + +dojo.html.addClass = function(/* HTMLElement */node, /* string */classStr){ + // summary + // Adds the specified class to the end of the class list on the + // passed &node;. Returns &true; or &false; indicating success or failure. + if (dojo.html.hasClass(node, classStr)) { + return false; + } + classStr = (dojo.html.getClass(node) + " " + classStr).replace(/^\s+|\s+$/g,""); + return dojo.html.setClass(node, classStr); // boolean +} + +dojo.html.setClass = function(/* HTMLElement */node, /* string */classStr){ + // summary + // Clobbers the existing list of classes for the node, replacing it with + // the list given in the 2nd argument. Returns true or false + // indicating success or failure. + node = dojo.byId(node); + var cs = new String(classStr); + try{ + if(typeof node.className == "string"){ + node.className = cs; + }else if(node.setAttribute){ + node.setAttribute("class", classStr); + node.className = cs; + }else{ + return false; + } + }catch(e){ + dojo.debug("dojo.html.setClass() failed", e); + } + return true; +} + +dojo.html.removeClass = function(/* HTMLElement */node, /* string */classStr, /* boolean? */allowPartialMatches){ + // summary + // Removes the className from the node;. Returns true or false indicating success or failure. + try{ + if (!allowPartialMatches) { + var newcs = dojo.html.getClass(node).replace(new RegExp('(^|\\s+)'+classStr+'(\\s+|$)'), "$1$2"); + } else { + var newcs = dojo.html.getClass(node).replace(classStr,''); + } + dojo.html.setClass(node, newcs); + }catch(e){ + dojo.debug("dojo.html.removeClass() failed", e); + } + return true; // boolean +} + +dojo.html.replaceClass = function(/* HTMLElement */node, /* string */newClass, /* string */oldClass) { + // summary + // Replaces 'oldClass' and adds 'newClass' to node + dojo.html.removeClass(node, oldClass); + dojo.html.addClass(node, newClass); +} + +// Enum type for getElementsByClass classMatchType arg: +dojo.html.classMatchType = { + ContainsAll : 0, // all of the classes are part of the node's class (default) + ContainsAny : 1, // any of the classes are part of the node's class + IsOnly : 2 // only all of the classes are part of the node's class +} + + +dojo.html.getElementsByClass = function( + /* string */classStr, + /* HTMLElement? */parent, + /* string? */nodeType, + /* integer? */classMatchType, + /* boolean? */useNonXpath +){ + // summary + // Returns an array of nodes for the given classStr, children of a + // parent, and optionally of a certain nodeType + // FIXME: temporarily set to false because of several dojo tickets related + // to the xpath version not working consistently in firefox. + useNonXpath = false; + var _document = dojo.doc(); + parent = dojo.byId(parent) || _document; + var classes = classStr.split(/\s+/g); + var nodes = []; + if( classMatchType != 1 && classMatchType != 2 ) classMatchType = 0; // make it enum + var reClass = new RegExp("(\\s|^)((" + classes.join(")|(") + "))(\\s|$)"); + var srtLength = classes.join(" ").length; + var candidateNodes = []; + + if(!useNonXpath && _document.evaluate) { // supports dom 3 xpath + var xpath = ".//" + (nodeType || "*") + "[contains("; + if(classMatchType != dojo.html.classMatchType.ContainsAny){ + xpath += "concat(' ',@class,' '), ' " + + classes.join(" ') and contains(concat(' ',@class,' '), ' ") + + " ')"; + if (classMatchType == 2) { + xpath += " and string-length(@class)="+srtLength+"]"; + }else{ + xpath += "]"; + } + }else{ + xpath += "concat(' ',@class,' '), ' " + + classes.join(" ') or contains(concat(' ',@class,' '), ' ") + + " ')]"; + } + var xpathResult = _document.evaluate(xpath, parent, null, XPathResult.ANY_TYPE, null); + var result = xpathResult.iterateNext(); + while(result){ + try{ + candidateNodes.push(result); + result = xpathResult.iterateNext(); + }catch(e){ break; } + } + return candidateNodes; // NodeList + }else{ + if(!nodeType){ + nodeType = "*"; + } + candidateNodes = parent.getElementsByTagName(nodeType); + + var node, i = 0; + outer: + while(node = candidateNodes[i++]){ + var nodeClasses = dojo.html.getClasses(node); + if(nodeClasses.length == 0){ continue outer; } + var matches = 0; + + for(var j = 0; j < nodeClasses.length; j++){ + if(reClass.test(nodeClasses[j])){ + if(classMatchType == dojo.html.classMatchType.ContainsAny){ + nodes.push(node); + continue outer; + }else{ + matches++; + } + }else{ + if(classMatchType == dojo.html.classMatchType.IsOnly){ + continue outer; + } + } + } + + if(matches == classes.length){ + if( (classMatchType == dojo.html.classMatchType.IsOnly)&& + (matches == nodeClasses.length)){ + nodes.push(node); + }else if(classMatchType == dojo.html.classMatchType.ContainsAll){ + nodes.push(node); + } + } + } + return nodes; // NodeList + } +} +dojo.html.getElementsByClassName = dojo.html.getElementsByClass; + +dojo.html.toCamelCase = function(/* string */selector){ + // summary + // Translates a CSS selector string to a camel-cased one. + var arr = selector.split('-'), cc = arr[0]; + for(var i = 1; i < arr.length; i++) { + cc += arr[i].charAt(0).toUpperCase() + arr[i].substring(1); + } + return cc; // string +} + +dojo.html.toSelectorCase = function(/* string */selector){ + // summary + // Translates a camel cased string to a selector cased one. + return selector.replace(/([A-Z])/g, "-$1" ).toLowerCase(); // string +} + +if (dojo.render.html.ie) { + // IE branch + dojo.html.getComputedStyle = function(/*HTMLElement|String*/node, /*String*/property, /*String*/value) { + // summary + // Get the computed style value for style "property" on "node" (IE). + node = dojo.byId(node); // FIXME: remove ability to access nodes by id for this time-critical function + if(!node || !node.style){return value;} + // FIXME: standardize on camel-case input to improve speed + return node.currentStyle[dojo.html.toCamelCase(property)]; // String + } + // SJM: getComputedStyle should be abandoned and replaced with the below function. + // All our supported browsers can return CSS2 compliant CssStyleDeclaration objects + // which can be queried directly for multiple styles. + dojo.html.getComputedStyles = function(/*HTMLElement*/node) { + // summary + // Get a style object containing computed styles for HTML Element node (IE). + return node.currentStyle; // CSSStyleDeclaration + } +} else { + // non-IE branch + dojo.html.getComputedStyle = function(/*HTMLElement|String*/node, /*String*/property, /*Any*/value) { + // summary + // Get the computed style value for style "property" on "node" (non-IE). + node = dojo.byId(node); + if(!node || !node.style){return value;} + var s = document.defaultView.getComputedStyle(node, null); + // s may be null on Safari + return (s&&s[dojo.html.toCamelCase(property)])||''; // String + } + // SJM: getComputedStyle should be abandoned and replaced with the below function. + // All our supported browsers can return CSS2 compliant CssStyleDeclaration objects + // which can be queried directly for multiple styles. + dojo.html.getComputedStyles = function(node) { + // summary + // Get a style object containing computed styles for HTML Element node (non-IE). + return document.defaultView.getComputedStyle(node, null); // CSSStyleDeclaration + } +} + +dojo.html.getStyleProperty = function(/* HTMLElement */node, /* string */cssSelector){ + // summary + // Returns the value of the passed style + node = dojo.byId(node); + return (node && node.style ? node.style[dojo.html.toCamelCase(cssSelector)] : undefined); // string +} + +dojo.html.getStyle = function(/* HTMLElement */node, /* string */cssSelector){ + // summary + // Returns the computed value of the passed style + var value = dojo.html.getStyleProperty(node, cssSelector); + return (value ? value : dojo.html.getComputedStyle(node, cssSelector)); // string || integer +} + +dojo.html.setStyle = function(/* HTMLElement */node, /* string */cssSelector, /* string */value){ + // summary + // Set the value of passed style on node + node = dojo.byId(node); + if(node && node.style){ + var camelCased = dojo.html.toCamelCase(cssSelector); + node.style[camelCased] = value; + } +} + +dojo.html.setStyleText = function (/* HTMLElement */target, /* string */text) { + // summary + // Try to set the entire cssText property of the passed target; equiv of setting style attribute. + try { + target.style.cssText = text; + } catch (e) { + target.setAttribute("style", text); + } +} + +dojo.html.copyStyle = function(/* HTMLElement */target, /* HTMLElement */source){ + // summary + // work around for opera which doesn't have cssText, and for IE which fails on setAttribute + if(!source.style.cssText){ + target.setAttribute("style", source.getAttribute("style")); + }else{ + target.style.cssText = source.style.cssText; + } + dojo.html.addClass(target, dojo.html.getClass(source)); +} + +dojo.html.getUnitValue = function(/* HTMLElement */node, /* string */cssSelector, /* boolean? */autoIsZero){ + // summary + // Get the value of passed selector, with the specific units used + var s = dojo.html.getComputedStyle(node, cssSelector); + if((!s)||((s == 'auto')&&(autoIsZero))){ + return { value: 0, units: 'px' }; // object + } + // FIXME: is regex inefficient vs. parseInt or some manual test? + var match = s.match(/(\-?[\d.]+)([a-z%]*)/i); + if (!match){return dojo.html.getUnitValue.bad;} + return { value: Number(match[1]), units: match[2].toLowerCase() }; // object +} +dojo.html.getUnitValue.bad = { value: NaN, units: '' }; + +if (dojo.render.html.ie) { + // IE branch + dojo.html.toPixelValue = function(/* HTMLElement */element, /* String */styleValue){ + // summary + // Extract value in pixels from styleValue (IE version). + // If a value cannot be extracted, zero is returned. + if(!styleValue){return 0;} + if(styleValue.slice(-2) == 'px'){return parseFloat(styleValue);} + var pixelValue = 0; + with(element){ + var sLeft = style.left; + var rsLeft = runtimeStyle.left; + runtimeStyle.left = currentStyle.left; + try { + style.left = styleValue || 0; + pixelValue = style.pixelLeft; + style.left = sLeft; + runtimeStyle.left = rsLeft; + }catch(e){ + // FIXME: it's possible for styleValue to be incompatible with + // style.left. In particular, border width values of + // "thick", "medium", or "thin" will provoke an exception. + } + } + return pixelValue; // Number + } +} else { + // non-IE branch + dojo.html.toPixelValue = function(/* HTMLElement */element, /* String */styleValue){ + // summary + // Extract value in pixels from styleValue (non-IE version). + // If a value cannot be extracted, zero is returned. + return (styleValue && (styleValue.slice(-2)=='px') ? parseFloat(styleValue) : 0); // Number + } +} + +dojo.html.getPixelValue = function(/* HTMLElement */node, /* string */styleProperty, /* boolean? */autoIsZero){ + // summary + // Get a computed style value, in pixels. + // node: HTMLElement + // Node to interrogate + // styleProperty: String + // Style property to query, in either css-selector or camelCase (property) format. + // autoIsZero: Boolean + // Deprecated. Any value that cannot be converted to pixels is returned as zero. + // + // summary + // Get the value of passed selector in pixels. + // + return dojo.html.toPixelValue(node, dojo.html.getComputedStyle(node, styleProperty)); +} + +dojo.html.setPositivePixelValue = function(/* HTMLElement */node, /* string */selector, /* integer */value){ + // summary + // Attempt to set the value of selector on node as a positive pixel value. + if(isNaN(value)){return false;} + node.style[selector] = Math.max(0, value) + 'px'; + return true; // boolean +} + +dojo.html.styleSheet = null; + +// FIXME: this is a really basic stub for adding and removing cssRules, but +// it assumes that you know the index of the cssRule that you want to add +// or remove, making it less than useful. So we need something that can +// search for the selector that you you want to remove. +dojo.html.insertCssRule = function(/* string */selector, /* string */declaration, /* integer? */index) { + // summary + // Attempt to insert declaration as selector on the internal stylesheet; if index try to set it there. + if (!dojo.html.styleSheet) { + if (document.createStyleSheet) { // IE + dojo.html.styleSheet = document.createStyleSheet(); + } else if (document.styleSheets[0]) { // rest + // FIXME: should create a new style sheet here + // fall back on an exsiting style sheet + dojo.html.styleSheet = document.styleSheets[0]; + } else { + return null; // integer + } // fail + } + + if (arguments.length < 3) { // index may == 0 + if (dojo.html.styleSheet.cssRules) { // W3 + index = dojo.html.styleSheet.cssRules.length; + } else if (dojo.html.styleSheet.rules) { // IE + index = dojo.html.styleSheet.rules.length; + } else { + return null; // integer + } // fail + } + + if (dojo.html.styleSheet.insertRule) { // W3 + var rule = selector + " { " + declaration + " }"; + return dojo.html.styleSheet.insertRule(rule, index); // integer + } else if (dojo.html.styleSheet.addRule) { // IE + return dojo.html.styleSheet.addRule(selector, declaration, index); // integer + } else { + return null; // integer + } // fail +} + +dojo.html.removeCssRule = function(/* integer? */index){ + // summary + // Attempt to remove the rule at index. + if(!dojo.html.styleSheet){ + dojo.debug("no stylesheet defined for removing rules"); + return false; + } + if(dojo.render.html.ie){ + if(!index){ + index = dojo.html.styleSheet.rules.length; + dojo.html.styleSheet.removeRule(index); + } + }else if(document.styleSheets[0]){ + if(!index){ + index = dojo.html.styleSheet.cssRules.length; + } + dojo.html.styleSheet.deleteRule(index); + } + return true; // boolean +} + +dojo.html._insertedCssFiles = []; // cache container needed because IE reformats cssText when added to DOM +dojo.html.insertCssFile = function(/* string */URI, /* HTMLDocument? */doc, /* boolean? */checkDuplicates, /* boolean */fail_ok){ + // summary + // calls css by XmlHTTP and inserts it into DOM as + if(!URI){ return; } + if(!doc){ doc = document; } + var cssStr = dojo.hostenv.getText(URI, false, fail_ok); + if(cssStr===null){ return; } + cssStr = dojo.html.fixPathsInCssText(cssStr, URI); + + if(checkDuplicates){ + var idx = -1, node, ent = dojo.html._insertedCssFiles; + for(var i = 0; i < ent.length; i++){ + if((ent[i].doc == doc) && (ent[i].cssText == cssStr)){ + idx = i; node = ent[i].nodeRef; + break; + } + } + // make sure we havent deleted our node + if(node){ + var styles = doc.getElementsByTagName("style"); + for(var i = 0; i < styles.length; i++){ + if(styles[i] == node){ + return; + } + } + // delete this entry + dojo.html._insertedCssFiles.shift(idx, 1); + } + } + + var style = dojo.html.insertCssText(cssStr, doc); + dojo.html._insertedCssFiles.push({'doc': doc, 'cssText': cssStr, 'nodeRef': style}); + + // insert custom attribute ex dbgHref="../foo.css" usefull when debugging in DOM inspectors, no? + if(style && djConfig.isDebug){ + style.setAttribute("dbgHref", URI); + } + return style; // HTMLStyleElement +} + +dojo.html.insertCssText = function(/* string */cssStr, /* HTMLDocument? */doc, /* string? */URI){ + // summary + // Attempt to insert CSS rules into the document through inserting a style element + // DomNode Style = insertCssText(String ".dojoMenu {color: green;}"[, DomDoc document, dojo.uri.Uri Url ]) + if(!cssStr){ + return; // HTMLStyleElement + } + if(!doc){ doc = document; } + if(URI){// fix paths in cssStr + cssStr = dojo.html.fixPathsInCssText(cssStr, URI); + } + var style = doc.createElement("style"); + style.setAttribute("type", "text/css"); + // IE is b0rken enough to require that we add the element to the doc + // before changing it's properties + var head = doc.getElementsByTagName("head")[0]; + if(!head){ // must have a head tag + dojo.debug("No head tag in document, aborting styles"); + return; // HTMLStyleElement + }else{ + head.appendChild(style); + } + if(style.styleSheet){// IE + var setFunc = function(){ + try{ + style.styleSheet.cssText = cssStr; + }catch(e){ dojo.debug(e); } + }; + if(style.styleSheet.disabled){ + setTimeout(setFunc, 10); + }else{ + setFunc(); + } + }else{ // w3c + var cssText = doc.createTextNode(cssStr); + style.appendChild(cssText); + } + return style; // HTMLStyleElement +} + +dojo.html.fixPathsInCssText = function(/* string */cssStr, /* string */URI){ + // summary + // usage: cssText comes from dojoroot/src/widget/templates/Foobar.css + // it has .dojoFoo { background-image: url(images/bar.png);} then uri should point to dojoroot/src/widget/templates/ + if(!cssStr || !URI){ return; } + var match, str = "", url = "", urlChrs = "[\\t\\s\\w\\(\\)\\/\\.\\\\'\"-:#=&?~]+"; + var regex = new RegExp('url\\(\\s*('+urlChrs+')\\s*\\)'); + var regexProtocol = /(file|https?|ftps?):\/\//; + regexTrim = new RegExp("^[\\s]*(['\"]?)("+urlChrs+")\\1[\\s]*?$"); + if(dojo.render.html.ie55 || dojo.render.html.ie60){ + var regexIe = new RegExp("AlphaImageLoader\\((.*)src\=['\"]("+urlChrs+")['\"]"); + // TODO: need to decide how to handle relative paths and AlphaImageLoader see #1441 + // current implementation breaks on build with intern_strings + while(match = regexIe.exec(cssStr)){ + url = match[2].replace(regexTrim, "$2"); + if(!regexProtocol.exec(url)){ + url = (new dojo.uri.Uri(URI, url).toString()); + } + str += cssStr.substring(0, match.index) + "AlphaImageLoader(" + match[1] + "src='" + url + "'"; + cssStr = cssStr.substr(match.index + match[0].length); + } + cssStr = str + cssStr; + str = ""; + } + + while(match = regex.exec(cssStr)){ + url = match[1].replace(regexTrim, "$2"); + if(!regexProtocol.exec(url)){ + url = (new dojo.uri.Uri(URI, url).toString()); + } + str += cssStr.substring(0, match.index) + "url(" + url + ")"; + cssStr = cssStr.substr(match.index + match[0].length); + } + return str + cssStr; // string +} + +dojo.html.setActiveStyleSheet = function(/* string */title){ + // summary + // Activate style sheet with specified title. + var i = 0, a, els = dojo.doc().getElementsByTagName("link"); + while (a = els[i++]) { + if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")){ + a.disabled = true; + if (a.getAttribute("title") == title) { a.disabled = false; } + } + } +} + +dojo.html.getActiveStyleSheet = function(){ + // summary + // return the title of the currently active stylesheet + var i = 0, a, els = dojo.doc().getElementsByTagName("link"); + while (a = els[i++]) { + if (a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("title") + && !a.disabled + ){ + return a.getAttribute("title"); // string + } + } + return null; // string +} + +dojo.html.getPreferredStyleSheet = function(){ + // summary + // Return the preferred stylesheet title (i.e. link without alt attribute) + var i = 0, a, els = dojo.doc().getElementsByTagName("link"); + while (a = els[i++]) { + if(a.getAttribute("rel").indexOf("style") != -1 + && a.getAttribute("rel").indexOf("alt") == -1 + && a.getAttribute("title") + ){ + return a.getAttribute("title"); // string + } + } + return null; // string +} + +dojo.html.applyBrowserClass = function(/* HTMLElement */node){ + // summary + // Applies pre-set class names based on browser & version to the passed node. + // Modified version of Morris' CSS hack. + var drh=dojo.render.html; + var classes = { + dj_ie: drh.ie, + dj_ie55: drh.ie55, + dj_ie6: drh.ie60, + dj_ie7: drh.ie70, + dj_iequirks: drh.ie && drh.quirks, + dj_opera: drh.opera, + dj_opera8: drh.opera && (Math.floor(dojo.render.version)==8), + dj_opera9: drh.opera && (Math.floor(dojo.render.version)==9), + dj_khtml: drh.khtml, + dj_safari: drh.safari, + dj_gecko: drh.mozilla + }; // no dojo unsupported browsers + for(var p in classes){ + if(classes[p]){ + dojo.html.addClass(node, p); + } + } +}; + +dojo.provide("dojo.html.display"); + + +dojo.html._toggle = function(node, tester, setter){ + node = dojo.byId(node); + setter(node, !tester(node)); + return tester(node); +} + +dojo.html.show = function(/* HTMLElement */node){ + // summary + // Show the passed element by reverting display property set by dojo.html.hide + node = dojo.byId(node); + if(dojo.html.getStyleProperty(node, 'display')=='none'){ + dojo.html.setStyle(node, 'display', (node.dojoDisplayCache||'')); + node.dojoDisplayCache = undefined; // cannot use delete on a node in IE6 + } +} + +dojo.html.hide = function(/* HTMLElement */node){ + // summary + // Hide the passed element by setting display:none + node = dojo.byId(node); + if(typeof node["dojoDisplayCache"] == "undefined"){ // it could == '', so we cannot say !node.dojoDisplayCount + var d = dojo.html.getStyleProperty(node, 'display') + if(d!='none'){ + node.dojoDisplayCache = d; + } + } + dojo.html.setStyle(node, 'display', 'none'); +} + +dojo.html.setShowing = function(/* HTMLElement */node, /* boolean? */showing){ + // summary + // Calls show() if showing is true, hide() otherwise + dojo.html[(showing ? 'show' : 'hide')](node); +} + +dojo.html.isShowing = function(/* HTMLElement */node){ + // summary + // Returns whether the element is displayed or not. + // FIXME: returns true if node is bad, isHidden would be easier to make correct + return (dojo.html.getStyleProperty(node, 'display') != 'none'); // boolean +} + +dojo.html.toggleShowing = function(/* HTMLElement */node){ + // summary + // Call setShowing() on node with the complement of isShowing(), then return the new value of isShowing() + return dojo.html._toggle(node, dojo.html.isShowing, dojo.html.setShowing); // boolean +} + +// Simple mapping of tag names to display values +// FIXME: simplistic +dojo.html.displayMap = { tr: '', td: '', th: '', img: 'inline', span: 'inline', input: 'inline', button: 'inline' }; + +dojo.html.suggestDisplayByTagName = function(/* HTMLElement */node){ + // summary + // Suggest a value for the display property that will show 'node' based on it's tag + node = dojo.byId(node); + if(node && node.tagName){ + var tag = node.tagName.toLowerCase(); + return (tag in dojo.html.displayMap ? dojo.html.displayMap[tag] : 'block'); // string + } +} + +dojo.html.setDisplay = function(/* HTMLElement */node, /* string */display){ + // summary + // Sets the value of style.display to value of 'display' parameter if it is a string. + // Otherwise, if 'display' is false, set style.display to 'none'. + // Finally, set 'display' to a suggested display value based on the node's tag + dojo.html.setStyle(node, 'display', ((display instanceof String || typeof display == "string") ? display : (display ? dojo.html.suggestDisplayByTagName(node) : 'none'))); +} + +dojo.html.isDisplayed = function(/* HTMLElement */node){ + // summary + // Is true if the the computed display style for node is not 'none' + // FIXME: returns true if node is bad, isNotDisplayed would be easier to make correct + return (dojo.html.getComputedStyle(node, 'display') != 'none'); // boolean +} + +dojo.html.toggleDisplay = function(/* HTMLElement */node){ + // summary + // Call setDisplay() on node with the complement of isDisplayed(), then + // return the new value of isDisplayed() + return dojo.html._toggle(node, dojo.html.isDisplayed, dojo.html.setDisplay); // boolean +} + +dojo.html.setVisibility = function(/* HTMLElement */node, /* string */visibility){ + // summary + // Sets the value of style.visibility to value of 'visibility' parameter if it is a string. + // Otherwise, if 'visibility' is false, set style.visibility to 'hidden'. Finally, set style.visibility to 'visible'. + dojo.html.setStyle(node, 'visibility', ((visibility instanceof String || typeof visibility == "string") ? visibility : (visibility ? 'visible' : 'hidden'))); +} + +dojo.html.isVisible = function(/* HTMLElement */node){ + // summary + // Returns true if the the computed visibility style for node is not 'hidden' + // FIXME: returns true if node is bad, isInvisible would be easier to make correct + return (dojo.html.getComputedStyle(node, 'visibility') != 'hidden'); // boolean +} + +dojo.html.toggleVisibility = function(node){ + // summary + // Call setVisibility() on node with the complement of isVisible(), then return the new value of isVisible() + return dojo.html._toggle(node, dojo.html.isVisible, dojo.html.setVisibility); // boolean +} + +dojo.html.setOpacity = function(/* HTMLElement */node, /* float */opacity, /* boolean? */dontFixOpacity){ + // summary + // Sets the opacity of node in a cross-browser way. + // float between 0.0 (transparent) and 1.0 (opaque) + node = dojo.byId(node); + var h = dojo.render.html; + if(!dontFixOpacity){ + if( opacity >= 1.0){ + if(h.ie){ + dojo.html.clearOpacity(node); + return; + }else{ + opacity = 0.999999; + } + }else if( opacity < 0.0){ opacity = 0; } + } + if(h.ie){ + if(node.nodeName.toLowerCase() == "tr"){ + // FIXME: is this too naive? will we get more than we want? + var tds = node.getElementsByTagName("td"); + for(var x=0; x= 0.999999 ? 1.0 : Number(opac); // float +} + + +dojo.provide("dojo.html.color"); + + + + +dojo.html.getBackgroundColor = function(/* HTMLElement */node){ + // summary + // returns the background color of the passed node as a 32-bit color (RGBA) + node = dojo.byId(node); + var color; + do{ + color = dojo.html.getStyle(node, "background-color"); + // Safari doesn't say "transparent" + if(color.toLowerCase() == "rgba(0, 0, 0, 0)") { color = "transparent"; } + if(node == document.getElementsByTagName("body")[0]) { node = null; break; } + node = node.parentNode; + }while(node && dojo.lang.inArray(["transparent", ""], color)); + if(color == "transparent"){ + color = [255, 255, 255, 0]; + }else{ + color = dojo.gfx.color.extractRGB(color); + } + return color; // array +} + +dojo.provide("dojo.html.layout"); + + + + + +dojo.html.sumAncestorProperties = function(/* HTMLElement */node, /* string */prop){ + // summary + // Returns the sum of the passed property on all ancestors of node. + node = dojo.byId(node); + if(!node){ return 0; } // FIXME: throw an error? + + var retVal = 0; + while(node){ + if(dojo.html.getComputedStyle(node, 'position') == 'fixed'){ + return 0; + } + var val = node[prop]; + if(val){ + retVal += val - 0; + if(node==dojo.body()){ break; }// opera and khtml #body & #html has the same values, we only need one value + } + node = node.parentNode; + } + return retVal; // integer +} + +dojo.html.setStyleAttributes = function(/* HTMLElement */node, /* string */attributes) { + // summary + // allows a dev to pass a string similar to what you'd pass in style="", and apply it to a node. + node = dojo.byId(node); + var splittedAttribs=attributes.replace(/(;)?\s*$/, "").split(";"); + for(var i=0; i0){ + ret.x += isNaN(n) ? 0 : n; + } + var m = curnode["offsetTop"]; + ret.y += isNaN(m) ? 0 : m; + curnode = curnode.offsetParent; + }while((curnode != endNode)&&(curnode != null)); + }else if(node["x"]&&node["y"]){ + ret.x += isNaN(node.x) ? 0 : node.x; + ret.y += isNaN(node.y) ? 0 : node.y; + } + } + + // account for document scrolling! + if(includeScroll){ + var scroll = dojo.html.getScroll(); + ret.y += scroll.top; + ret.x += scroll.left; + } + + var extentFuncArray=[dojo.html.getPaddingExtent, dojo.html.getBorderExtent, dojo.html.getMarginExtent]; + if(nativeBoxType > targetBoxType){ + for(var i=targetBoxType;inativeBoxType;--i){ + ret.y -= extentFuncArray[i-1](node, 'top'); + ret.x -= extentFuncArray[i-1](node, 'left'); + } + } + ret.top = ret.y; + ret.left = ret.x; + return ret; // object +} + +dojo.html.isPositionAbsolute = function(/* HTMLElement */node){ + // summary + // Returns true if the element is absolutely positioned. + return (dojo.html.getComputedStyle(node, 'position') == 'absolute'); // boolean +} + +dojo.html._sumPixelValues = function(/* HTMLElement */node, selectors, autoIsZero){ + var total = 0; + for(var x=0; x 4 ) { coords.pop(); } + var ret = { + left: coords[0], + top: coords[1], + width: coords[2], + height: coords[3] + }; + }else if(!coords.nodeType && !(coords instanceof String || typeof coords == "string") && + ('width' in coords || 'height' in coords || 'left' in coords || + 'x' in coords || 'top' in coords || 'y' in coords)){ + // coords is a coordinate object or at least part of one + var ret = { + left: coords.left||coords.x||0, + top: coords.top||coords.y||0, + width: coords.width||0, + height: coords.height||0 + }; + }else{ + // coords is an dom object (or dom object id); return it's coordinates + var node = dojo.byId(coords); + var pos = dojo.html.abs(node, includeScroll, boxtype); + var marginbox = dojo.html.getMarginBox(node); + var ret = { + left: pos.left, + top: pos.top, + width: marginbox.width, + height: marginbox.height + }; + } + ret.x = ret.left; + ret.y = ret.top; + return ret; // object +} + +dojo.html.setMarginBoxWidth = dojo.html.setOuterWidth = function(node, width){ + return dojo.html._callDeprecated("setMarginBoxWidth", "setMarginBox", arguments, "width"); +} +dojo.html.setMarginBoxHeight = dojo.html.setOuterHeight = function(){ + return dojo.html._callDeprecated("setMarginBoxHeight", "setMarginBox", arguments, "height"); +} +dojo.html.getMarginBoxWidth = dojo.html.getOuterWidth = function(){ + return dojo.html._callDeprecated("getMarginBoxWidth", "getMarginBox", arguments, null, "width"); +} +dojo.html.getMarginBoxHeight = dojo.html.getOuterHeight = function(){ + return dojo.html._callDeprecated("getMarginBoxHeight", "getMarginBox", arguments, null, "height"); +} +dojo.html.getTotalOffset = function(node, type, includeScroll){ + return dojo.html._callDeprecated("getTotalOffset", "getAbsolutePosition", arguments, null, type); +} +dojo.html.getAbsoluteX = function(node, includeScroll){ + return dojo.html._callDeprecated("getAbsoluteX", "getAbsolutePosition", arguments, null, "x"); +} +dojo.html.getAbsoluteY = function(node, includeScroll){ + return dojo.html._callDeprecated("getAbsoluteY", "getAbsolutePosition", arguments, null, "y"); +} +dojo.html.totalOffsetLeft = function(node, includeScroll){ + return dojo.html._callDeprecated("totalOffsetLeft", "getAbsolutePosition", arguments, null, "left"); +} +dojo.html.totalOffsetTop = function(node, includeScroll){ + return dojo.html._callDeprecated("totalOffsetTop", "getAbsolutePosition", arguments, null, "top"); +} +dojo.html.getMarginWidth = function(node){ + return dojo.html._callDeprecated("getMarginWidth", "getMargin", arguments, null, "width"); +} +dojo.html.getMarginHeight = function(node){ + return dojo.html._callDeprecated("getMarginHeight", "getMargin", arguments, null, "height"); +} +dojo.html.getBorderWidth = function(node){ + return dojo.html._callDeprecated("getBorderWidth", "getBorder", arguments, null, "width"); +} +dojo.html.getBorderHeight = function(node){ + return dojo.html._callDeprecated("getBorderHeight", "getBorder", arguments, null, "height"); +} +dojo.html.getPaddingWidth = function(node){ + return dojo.html._callDeprecated("getPaddingWidth", "getPadding", arguments, null, "width"); +} +dojo.html.getPaddingHeight = function(node){ + return dojo.html._callDeprecated("getPaddingHeight", "getPadding", arguments, null, "height"); +} +dojo.html.getPadBorderWidth = function(node){ + return dojo.html._callDeprecated("getPadBorderWidth", "getPadBorder", arguments, null, "width"); +} +dojo.html.getPadBorderHeight = function(node){ + return dojo.html._callDeprecated("getPadBorderHeight", "getPadBorder", arguments, null, "height"); +} +dojo.html.getBorderBoxWidth = dojo.html.getInnerWidth = function(){ + return dojo.html._callDeprecated("getBorderBoxWidth", "getBorderBox", arguments, null, "width"); +} +dojo.html.getBorderBoxHeight = dojo.html.getInnerHeight = function(){ + return dojo.html._callDeprecated("getBorderBoxHeight", "getBorderBox", arguments, null, "height"); +} +dojo.html.getContentBoxWidth = dojo.html.getContentWidth = function(){ + return dojo.html._callDeprecated("getContentBoxWidth", "getContentBox", arguments, null, "width"); +} +dojo.html.getContentBoxHeight = dojo.html.getContentHeight = function(){ + return dojo.html._callDeprecated("getContentBoxHeight", "getContentBox", arguments, null, "height"); +} +dojo.html.setContentBoxWidth = dojo.html.setContentWidth = function(node, width){ + return dojo.html._callDeprecated("setContentBoxWidth", "setContentBox", arguments, "width"); +} +dojo.html.setContentBoxHeight = dojo.html.setContentHeight = function(node, height){ + return dojo.html._callDeprecated("setContentBoxHeight", "setContentBox", arguments, "height"); +} + +dojo.provide("dojo.lfx.html"); + + + + + + + + +dojo.lfx.html._byId = function(nodes){ + if(!nodes){ return []; } + if(dojo.lang.isArrayLike(nodes)){ + if(!nodes.alreadyChecked){ + var n = []; + dojo.lang.forEach(nodes, function(node){ + n.push(dojo.byId(node)); + }); + n.alreadyChecked = true; + return n; + }else{ + return nodes; + } + }else{ + var n = []; + n.push(dojo.byId(nodes)); + n.alreadyChecked = true; + return n; + } +} + +dojo.lfx.html.propertyAnimation = function( /*DOMNode[]*/ nodes, + /*Object[]*/ propertyMap, + /*int*/ duration, + /*function*/ easing, + /*Object*/ handlers){ + // summary: Returns an animation that will transition the properties of "nodes" + // depending how they are defined in "propertyMap". + // nodes: An array of DOMNodes or one DOMNode. + // propertyMap: { property: String, start: Decimal?, end: Decimal?, units: String? } + // An array of objects defining properties to change. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // handlers: { handler: Function?, onstart: Function?, onstop: Function?, onanimate: Function? } + nodes = dojo.lfx.html._byId(nodes); + + var targs = { + "propertyMap": propertyMap, + "nodes": nodes, + "duration": duration, + "easing": easing||dojo.lfx.easeDefault + }; + + var setEmUp = function(args){ + if(args.nodes.length==1){ + // FIXME: we're only supporting start-value filling when one node is + // passed + + var pm = args.propertyMap; + if(!dojo.lang.isArray(args.propertyMap)){ + // it's stupid to have to pack an array with a set of objects + // when you can just pass in an object list + var parr = []; + for(var pname in pm){ + pm[pname].property = pname; + parr.push(pm[pname]); + } + pm = args.propertyMap = parr; + } + dojo.lang.forEach(pm, function(prop){ + if(dj_undef("start", prop)){ + if(prop.property != "opacity"){ + prop.start = parseInt(dojo.html.getComputedStyle(args.nodes[0], prop.property)); + }else{ + prop.start = dojo.html.getOpacity(args.nodes[0]); + } + } + }); + } + } + + var coordsAsInts = function(coords){ + var cints = []; + dojo.lang.forEach(coords, function(c){ + cints.push(Math.round(c)); + }); + return cints; + } + + var setStyle = function(n, style){ + n = dojo.byId(n); + if(!n || !n.style){ return; } + for(var s in style){ + try{ + if(s == "opacity"){ + dojo.html.setOpacity(n, style[s]); + }else{ + n.style[s] = style[s]; + } + }catch(e){ dojo.debug(e); } + } + } + + var propLine = function(properties){ + this._properties = properties; + this.diffs = new Array(properties.length); + dojo.lang.forEach(properties, function(prop, i){ + // calculate the end - start to optimize a bit + if(dojo.lang.isFunction(prop.start)){ + prop.start = prop.start(prop, i); + } + if(dojo.lang.isFunction(prop.end)){ + prop.end = prop.end(prop, i); + } + if(dojo.lang.isArray(prop.start)){ + // don't loop through the arrays + this.diffs[i] = null; + }else if(prop.start instanceof dojo.gfx.color.Color){ + // save these so we don't have to call toRgb() every getValue() call + prop.startRgb = prop.start.toRgb(); + prop.endRgb = prop.end.toRgb(); + }else{ + this.diffs[i] = prop.end - prop.start; + } + }, this); + + this.getValue = function(n){ + var ret = {}; + dojo.lang.forEach(this._properties, function(prop, i){ + var value = null; + if(dojo.lang.isArray(prop.start)){ + // FIXME: what to do here? + }else if(prop.start instanceof dojo.gfx.color.Color){ + value = (prop.units||"rgb") + "("; + for(var j = 0 ; j < prop.startRgb.length ; j++){ + value += Math.round(((prop.endRgb[j] - prop.startRgb[j]) * n) + prop.startRgb[j]) + (j < prop.startRgb.length - 1 ? "," : ""); + } + value += ")"; + }else{ + value = ((this.diffs[i]) * n) + prop.start + (prop.property != "opacity" ? prop.units||"px" : ""); + } + ret[dojo.html.toCamelCase(prop.property)] = value; + }, this); + return ret; + } + } + + var anim = new dojo.lfx.Animation({ + beforeBegin: function(){ + setEmUp(targs); + anim.curve = new propLine(targs.propertyMap); + }, + onAnimate: function(propValues){ + dojo.lang.forEach(targs.nodes, function(node){ + setStyle(node, propValues); + }); + } + }, + targs.duration, + null, + targs.easing + ); + if(handlers){ + for(var x in handlers){ + if(dojo.lang.isFunction(handlers[x])){ + anim.connect(x, anim, handlers[x]); + } + } + } + + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html._makeFadeable = function(nodes){ + var makeFade = function(node){ + if(dojo.render.html.ie){ + // only set the zoom if the "tickle" value would be the same as the + // default + if( (node.style.zoom.length == 0) && + (dojo.html.getStyle(node, "zoom") == "normal") ){ + // make sure the node "hasLayout" + // NOTE: this has been tested with larger and smaller user-set text + // sizes and works fine + node.style.zoom = "1"; + // node.style.zoom = "normal"; + } + // don't set the width to auto if it didn't already cascade that way. + // We don't want to f anyones designs + if( (node.style.width.length == 0) && + (dojo.html.getStyle(node, "width") == "auto") ){ + node.style.width = "auto"; + } + } + } + if(dojo.lang.isArrayLike(nodes)){ + dojo.lang.forEach(nodes, makeFade); + }else{ + makeFade(nodes); + } +} + +dojo.lfx.html.fade = function(/*DOMNode[]*/ nodes, + /*Object*/values, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary:Returns an animation that will fade the "nodes" from the start to end values passed. + // nodes: An array of DOMNodes or one DOMNode. + // values: { start: Decimal?, end: Decimal? } + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var props = { property: "opacity" }; + if(!dj_undef("start", values)){ + props.start = values.start; + }else{ + props.start = function(){ return dojo.html.getOpacity(nodes[0]); }; + } + + if(!dj_undef("end", values)){ + props.end = values.end; + }else{ + dojo.raise("dojo.lfx.html.fade needs an end value"); + } + + var anim = dojo.lfx.propertyAnimation(nodes, [ props ], duration, easing); + anim.connect("beforeBegin", function(){ + dojo.lfx.html._makeFadeable(nodes); + }); + if(callback){ + anim.connect("onEnd", function(){ callback(nodes, anim); }); + } + + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.fadeIn = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will fade "nodes" from its current opacity to fully opaque. + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + return dojo.lfx.html.fade(nodes, { end: 1 }, duration, easing, callback); // dojo.lfx.Animation +} + +dojo.lfx.html.fadeOut = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will fade "nodes" from its current opacity to fully transparent. + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + return dojo.lfx.html.fade(nodes, { end: 0 }, duration, easing, callback); // dojo.lfx.Animation +} + +dojo.lfx.html.fadeShow = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will fade "nodes" from transparent to opaque and shows + // "nodes" at the end if it is hidden. + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes=dojo.lfx.html._byId(nodes); + dojo.lang.forEach(nodes, function(node){ + dojo.html.setOpacity(node, 0.0); + }); + + var anim = dojo.lfx.html.fadeIn(nodes, duration, easing, callback); + anim.connect("beforeBegin", function(){ + if(dojo.lang.isArrayLike(nodes)){ + dojo.lang.forEach(nodes, dojo.html.show); + }else{ + dojo.html.show(nodes); + } + }); + + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.fadeHide = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will fade "nodes" from its current opacity to opaque and hides + // "nodes" at the end. + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + var anim = dojo.lfx.html.fadeOut(nodes, duration, easing, function(){ + if(dojo.lang.isArrayLike(nodes)){ + dojo.lang.forEach(nodes, dojo.html.hide); + }else{ + dojo.html.hide(nodes); + } + if(callback){ callback(nodes, anim); } + }); + + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.wipeIn = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will show and wipe in "nodes". + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + + dojo.lang.forEach(nodes, function(node){ + var oprop = { }; // old properties of node (before we mucked w/them) + + // get node height, either it's natural height or it's height specified via style or class attributes + // (for FF, the node has to be (temporarily) rendered to measure height) + // TODO: should this offscreen code be part of dojo.html, so that getBorderBox() works on hidden nodes? + var origTop, origLeft, origPosition; + with(node.style){ + origTop=top; origLeft=left; origPosition=position; + top="-9999px"; left="-9999px"; position="absolute"; + display=""; + } + var nodeHeight = dojo.html.getBorderBox(node).height; + with(node.style){ + top=origTop; left=origLeft; position=origPosition; + display="none"; + } + + var anim = dojo.lfx.propertyAnimation(node, + { "height": { + start: 1, // 0 causes IE to display the whole panel + end: function(){ return nodeHeight; } + } + }, + duration, + easing); + + anim.connect("beforeBegin", function(){ + oprop.overflow = node.style.overflow; + oprop.height = node.style.height; + with(node.style){ + overflow = "hidden"; + height = "1px"; // 0 causes IE to display the whole panel + } + dojo.html.show(node); + }); + + anim.connect("onEnd", function(){ + with(node.style){ + overflow = oprop.overflow; + height = oprop.height; + } + if(callback){ callback(node, anim); } + }); + anims.push(anim); + }); + + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.wipeOut = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will wipe out and hide "nodes". + // nodes: An array of DOMNodes or one DOMNode. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + + dojo.lang.forEach(nodes, function(node){ + var oprop = { }; // old properties of node (before we mucked w/them) + var anim = dojo.lfx.propertyAnimation(node, + { "height": { + start: function(){ return dojo.html.getContentBox(node).height; }, + end: 1 // 0 causes IE to display the whole panel + } + }, + duration, + easing, + { + "beforeBegin": function(){ + oprop.overflow = node.style.overflow; + oprop.height = node.style.height; + with(node.style){ + overflow = "hidden"; + } + dojo.html.show(node); + }, + + "onEnd": function(){ + dojo.html.hide(node); + with(node.style){ + overflow = oprop.overflow; + height = oprop.height; + } + if(callback){ callback(node, anim); } + } + } + ); + anims.push(anim); + }); + + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.slideTo = function(/*DOMNode*/ nodes, + /*Object*/ coords, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will slide "nodes" from its current position to + // the position defined in "coords". + // nodes: An array of DOMNodes or one DOMNode. + // coords: { top: Decimal?, left: Decimal? } + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + var compute = dojo.html.getComputedStyle; + + if(dojo.lang.isArray(coords)){ + /* coords: Array + pId: a */ + dojo.deprecated('dojo.lfx.html.slideTo(node, array)', 'use dojo.lfx.html.slideTo(node, {top: value, left: value});', '0.5'); + coords = { top: coords[0], left: coords[1] }; + } + dojo.lang.forEach(nodes, function(node){ + var top = null; + var left = null; + + var init = (function(){ + var innerNode = node; + return function(){ + var pos = compute(innerNode, 'position'); + top = (pos == 'absolute' ? node.offsetTop : parseInt(compute(node, 'top')) || 0); + left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node, 'left')) || 0); + + if (!dojo.lang.inArray(['absolute', 'relative'], pos)) { + var ret = dojo.html.abs(innerNode, true); + dojo.html.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;"); + top = ret.y; + left = ret.x; + } + } + })(); + init(); + + var anim = dojo.lfx.propertyAnimation(node, + { "top": { start: top, end: (coords.top||0) }, + "left": { start: left, end: (coords.left||0) } + }, + duration, + easing, + { "beforeBegin": init } + ); + + if(callback){ + anim.connect("onEnd", function(){ callback(nodes, anim); }); + } + + anims.push(anim); + }); + + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.slideBy = function(/*DOMNode*/ nodes, /*Object*/ coords, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){ + // summary: Returns an animation that will slide "nodes" from its current position + // to its current position plus the numbers defined in "coords". + // nodes: An array of DOMNodes or one DOMNode. + // coords: { top: Decimal?, left: Decimal? } + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + var compute = dojo.html.getComputedStyle; + + if(dojo.lang.isArray(coords)){ + /* coords: Array + pId: a */ + dojo.deprecated('dojo.lfx.html.slideBy(node, array)', 'use dojo.lfx.html.slideBy(node, {top: value, left: value});', '0.5'); + coords = { top: coords[0], left: coords[1] }; + } + + dojo.lang.forEach(nodes, function(node){ + var top = null; + var left = null; + + var init = (function(){ + var innerNode = node; + return function(){ + var pos = compute(innerNode, 'position'); + top = (pos == 'absolute' ? node.offsetTop : parseInt(compute(node, 'top')) || 0); + left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node, 'left')) || 0); + + if (!dojo.lang.inArray(['absolute', 'relative'], pos)) { + var ret = dojo.html.abs(innerNode, true); + dojo.html.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;"); + top = ret.y; + left = ret.x; + } + } + })(); + init(); + + var anim = dojo.lfx.propertyAnimation(node, + { + "top": { start: top, end: top+(coords.top||0) }, + "left": { start: left, end: left+(coords.left||0) } + }, + duration, + easing).connect("beforeBegin", init); + + if(callback){ + anim.connect("onEnd", function(){ callback(nodes, anim); }); + } + + anims.push(anim); + }); + + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.explode = function(/*DOMNode*/ start, + /*DOMNode*/ endNode, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will + // start: + // endNode: + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + var h = dojo.html; + start = dojo.byId(start); + endNode = dojo.byId(endNode); + var startCoords = h.toCoordinateObject(start, true); + var outline = document.createElement("div"); + h.copyStyle(outline, endNode); + if(endNode.explodeClassName){ outline.className = endNode.explodeClassName; } + with(outline.style){ + position = "absolute"; + display = "none"; + // border = "1px solid black"; + var backgroundStyle = h.getStyle(start, "background-color"); + backgroundColor = backgroundStyle ? backgroundStyle.toLowerCase() : "transparent"; + backgroundColor = (backgroundColor == "transparent") ? "rgb(221, 221, 221)" : backgroundColor; + } + dojo.body().appendChild(outline); + + with(endNode.style){ + visibility = "hidden"; + display = "block"; + } + var endCoords = h.toCoordinateObject(endNode, true); + with(endNode.style){ + display = "none"; + visibility = "visible"; + } + + var props = { opacity: { start: 0.5, end: 1.0 } }; + dojo.lang.forEach(["height", "width", "top", "left"], function(type){ + props[type] = { start: startCoords[type], end: endCoords[type] } + }); + + var anim = new dojo.lfx.propertyAnimation(outline, + props, + duration, + easing, + { + "beforeBegin": function(){ + h.setDisplay(outline, "block"); + }, + "onEnd": function(){ + h.setDisplay(endNode, "block"); + outline.parentNode.removeChild(outline); + } + } + ); + + if(callback){ + anim.connect("onEnd", function(){ callback(endNode, anim); }); + } + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.implode = function(/*DOMNode*/ startNode, + /*DOMNode*/ end, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will + // startNode: + // end: + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + var h = dojo.html; + startNode = dojo.byId(startNode); + end = dojo.byId(end); + var startCoords = dojo.html.toCoordinateObject(startNode, true); + var endCoords = dojo.html.toCoordinateObject(end, true); + + var outline = document.createElement("div"); + dojo.html.copyStyle(outline, startNode); + if (startNode.explodeClassName) { outline.className = startNode.explodeClassName; } + dojo.html.setOpacity(outline, 0.3); + with(outline.style){ + position = "absolute"; + display = "none"; + backgroundColor = h.getStyle(startNode, "background-color").toLowerCase(); + } + dojo.body().appendChild(outline); + + var props = { opacity: { start: 1.0, end: 0.5 } }; + dojo.lang.forEach(["height", "width", "top", "left"], function(type){ + props[type] = { start: startCoords[type], end: endCoords[type] } + }); + + var anim = new dojo.lfx.propertyAnimation(outline, + props, + duration, + easing, + { + "beforeBegin": function(){ + dojo.html.hide(startNode); + dojo.html.show(outline); + }, + "onEnd": function(){ + outline.parentNode.removeChild(outline); + } + } + ); + + if(callback){ + anim.connect("onEnd", function(){ callback(startNode, anim); }); + } + return anim; // dojo.lfx.Animation +} + +dojo.lfx.html.highlight = function(/*DOMNode[]*/ nodes, + /*dojo.gfx.color.Color*/ startColor, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will set the background color + // of "nodes" to startColor and transition it to "nodes" + // original color. + // startColor: Color to transition from. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + + dojo.lang.forEach(nodes, function(node){ + var color = dojo.html.getBackgroundColor(node); + var bg = dojo.html.getStyle(node, "background-color").toLowerCase(); + var bgImage = dojo.html.getStyle(node, "background-image"); + var wasTransparent = (bg == "transparent" || bg == "rgba(0, 0, 0, 0)"); + while(color.length > 3) { color.pop(); } + + var rgb = new dojo.gfx.color.Color(startColor); + var endRgb = new dojo.gfx.color.Color(color); + + var anim = dojo.lfx.propertyAnimation(node, + { "background-color": { start: rgb, end: endRgb } }, + duration, + easing, + { + "beforeBegin": function(){ + if(bgImage){ + node.style.backgroundImage = "none"; + } + node.style.backgroundColor = "rgb(" + rgb.toRgb().join(",") + ")"; + }, + "onEnd": function(){ + if(bgImage){ + node.style.backgroundImage = bgImage; + } + if(wasTransparent){ + node.style.backgroundColor = "transparent"; + } + if(callback){ + callback(node, anim); + } + } + } + ); + + anims.push(anim); + }); + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lfx.html.unhighlight = function(/*DOMNode[]*/ nodes, + /*dojo.gfx.color.Color*/ endColor, + /*int?*/ duration, + /*Function?*/ easing, + /*Function?*/ callback){ + // summary: Returns an animation that will transition "nodes" background color + // from its current color to "endColor". + // endColor: Color to transition to. + // duration: Duration of the animation in milliseconds. + // easing: An easing function. + // callback: Function to run at the end of the animation. + nodes = dojo.lfx.html._byId(nodes); + var anims = []; + + dojo.lang.forEach(nodes, function(node){ + var color = new dojo.gfx.color.Color(dojo.html.getBackgroundColor(node)); + var rgb = new dojo.gfx.color.Color(endColor); + + var bgImage = dojo.html.getStyle(node, "background-image"); + + var anim = dojo.lfx.propertyAnimation(node, + { "background-color": { start: color, end: rgb } }, + duration, + easing, + { + "beforeBegin": function(){ + if(bgImage){ + node.style.backgroundImage = "none"; + } + node.style.backgroundColor = "rgb(" + color.toRgb().join(",") + ")"; + }, + "onEnd": function(){ + if(callback){ + callback(node, anim); + } + } + } + ); + anims.push(anim); + }); + return dojo.lfx.combine(anims); // dojo.lfx.Combine +} + +dojo.lang.mixin(dojo.lfx, dojo.lfx.html); + +dojo.kwCompoundRequire({ + browser: ["dojo.lfx.html"], + dashboard: ["dojo.lfx.html"] +}); +dojo.provide("dojo.lfx.*"); + +if(!this["dojo"]){ + alert("\"dojo/__package__.js\" is now located at \"dojo/dojo.js\". Please update your includes accordingly"); +} + +dojo.provide("dojo.xml.Parse"); + + +//TODO: determine dependencies +// currently has dependency on dojo.xml.DomUtil nodeTypes constants... + +// using documentFragment nomenclature to generalize in case we don't want to require passing a collection of nodes with a single parent + +dojo.xml.Parse = function(){ + // summary: + // generic class for taking a DOM node and parsing it into an object + // based on the "dojo tag name" of that node. + // + // supported dojoTagName's: + // => prefix:tag + // => dojo:tag + // => dojo:tag + // => dojo:type + // => prefix:type + // => dojo:type + // => dojo:type + + var isIE = ((dojo.render.html.capable)&&(dojo.render.html.ie)); + + // get normalized (lowercase) tagName + // some browsers report tagNames in lowercase no matter what + function getTagName(node){ + /* + return ((node)&&(node["tagName"]) ? node.tagName.toLowerCase() : ''); + */ + try{ + return node.tagName.toLowerCase(); + }catch(e){ + return ""; + } + } + + // locate dojo qualified tag name + function getDojoTagName(node){ + var tagName = getTagName(node); + if (!tagName){ + return ''; + } + // any registered tag + if((dojo.widget)&&(dojo.widget.tags[tagName])){ + return tagName; + } + // => prefix:tag + var p = tagName.indexOf(":"); + if(p>=0){ + return tagName; + } + // => dojo:tag + if(tagName.substr(0,5) == "dojo:"){ + return tagName; + } + if(dojo.render.html.capable && dojo.render.html.ie && node.scopeName != 'HTML'){ + return node.scopeName.toLowerCase() + ':' + tagName; + } + // => dojo:tag + if(tagName.substr(0,4) == "dojo"){ + // FIXME: this assumes tag names are always lower case + return "dojo:" + tagName.substring(4); + } + // => prefix:type + // => dojo:type + var djt = node.getAttribute("dojoType") || node.getAttribute("dojotype"); + if(djt){ + if (djt.indexOf(":")<0){ + djt = "dojo:"+djt; + } + return djt.toLowerCase(); + } + // => dojo:type + djt = node.getAttributeNS && node.getAttributeNS(dojo.dom.dojoml,"type"); + if(djt){ + return "dojo:" + djt.toLowerCase(); + } + // => dojo:type + try{ + // FIXME: IE really really doesn't like this, so we squelch errors for it + djt = node.getAttribute("dojo:type"); + }catch(e){ + // FIXME: log? + } + if(djt){ return "dojo:"+djt.toLowerCase(); } + // => dojo:type + if((dj_global["djConfig"])&&(!djConfig["ignoreClassNames"])){ + // FIXME: should we make this optionally enabled via djConfig? + var classes = node.className||node.getAttribute("class"); + // FIXME: following line, without check for existence of classes.indexOf + // breaks firefox 1.5's svg widgets + if((classes )&&(classes.indexOf)&&(classes.indexOf("dojo-")!=-1)){ + var aclasses = classes.split(" "); + for(var x=0, c=aclasses.length; x as nodes that should be parsed. Ignore these + if(isIE && tagName.indexOf("/")==0){ return null; } + + try{ + var attr = node.getAttribute("parseWidgets"); + if(attr && attr.toLowerCase() == "false"){ + return {}; + } + }catch(e){/*continue*/} + + + // look for a dojoml qualified name + // process dojoml only when optimizeForDojoML is true + var process = true; + if(optimizeForDojoML){ + var dojoTagName = getDojoTagName(node); + tagName = dojoTagName || tagName; + process = Boolean(dojoTagName); + } + + var parsedNodeSet = {}; + parsedNodeSet[tagName] = []; + var pos = tagName.indexOf(":"); + if(pos>0){ + var ns = tagName.substring(0,pos); + parsedNodeSet["ns"] = ns; + // honor user namespace filters + if((dojo.ns)&&(!dojo.ns.allow(ns))){process=false;} + } + + if(process){ + var attributeSet = this.parseAttributes(node); + for(var attr in attributeSet){ + if((!parsedNodeSet[tagName][attr])||(typeof parsedNodeSet[tagName][attr] != "array")){ + parsedNodeSet[tagName][attr] = []; + } + parsedNodeSet[tagName][attr].push(attributeSet[attr]); + } + // FIXME: we might want to make this optional or provide cloning instead of + // referencing, but for now, we include a node reference to allow + // instantiated components to figure out their "roots" + parsedNodeSet[tagName].nodeRef = node; + parsedNodeSet.tagName = tagName; + parsedNodeSet.index = thisIdx||0; + } + + var count = 0; + for(var i = 0; i < node.childNodes.length; i++){ + var tcn = node.childNodes.item(i); + switch(tcn.nodeType){ + case dojo.dom.ELEMENT_NODE: // element nodes, call this function recursively + var ctn = getDojoTagName(tcn) || getTagName(tcn); + if(!parsedNodeSet[ctn]){ + parsedNodeSet[ctn] = []; + } + parsedNodeSet[ctn].push(this.parseElement(tcn, true, optimizeForDojoML, count)); + if( (tcn.childNodes.length == 1)&& + (tcn.childNodes.item(0).nodeType == dojo.dom.TEXT_NODE)){ + parsedNodeSet[ctn][parsedNodeSet[ctn].length-1].value = tcn.childNodes.item(0).nodeValue; + } + count++; + break; + case dojo.dom.TEXT_NODE: // if a single text node is the child, treat it as an attribute + if(node.childNodes.length == 1){ + parsedNodeSet[tagName].push({ value: node.childNodes.item(0).nodeValue }); + } + break; + default: break; + /* + case dojo.dom.ATTRIBUTE_NODE: // attribute node... not meaningful here + break; + case dojo.dom.CDATA_SECTION_NODE: // cdata section... not sure if this would ever be meaningful... might be... + break; + case dojo.dom.ENTITY_REFERENCE_NODE: // entity reference node... not meaningful here + break; + case dojo.dom.ENTITY_NODE: // entity node... not sure if this would ever be meaningful + break; + case dojo.dom.PROCESSING_INSTRUCTION_NODE: // processing instruction node... not meaningful here + break; + case dojo.dom.COMMENT_NODE: // comment node... not not sure if this would ever be meaningful + break; + case dojo.dom.DOCUMENT_NODE: // document node... not sure if this would ever be meaningful + break; + case dojo.dom.DOCUMENT_TYPE_NODE: // document type node... not meaningful here + break; + case dojo.dom.DOCUMENT_FRAGMENT_NODE: // document fragment node... not meaningful here + break; + case dojo.dom.NOTATION_NODE:// notation node... not meaningful here + break; + */ + } + } + //return (hasParentNodeSet) ? parsedNodeSet[node.tagName] : parsedNodeSet; + //if(parsedNodeSet.tagName)dojo.debug("parseElement: RETURNING NODE WITH TAGNAME "+parsedNodeSet.tagName); + return parsedNodeSet; + }; + + + /* parses a set of attributes on a node into an object tree */ + this.parseAttributes = function(/*DomNode*/node){ + // summary: + // creates an attribute object that maps attribute values for the + // passed node. Note that this is similar to creating a JSON + // representation of a DOM node. + // usage: + // a node with the following serialization: + //
...
+ // would yeild the following return structure when passed into this + // function: + // { + // "foo": { + // "value": "bar" + // }, + // "baz": { + // "value": "thud" + // } + // } + // + var parsedAttributeSet = {}; + var atts = node.attributes; + // TODO: should we allow for duplicate attributes at this point... + // would any of the relevant dom implementations even allow this? + var attnode, i=0; + while((attnode=atts[i++])){ + if(isIE){ + if(!attnode){ continue; } + if((typeof attnode == "object")&& + (typeof attnode.nodeValue == 'undefined')|| + (attnode.nodeValue == null)|| + (attnode.nodeValue == '')){ + continue; + } + } + + var nn = attnode.nodeName.split(":"); + nn = (nn.length == 2) ? nn[1] : attnode.nodeName; + + parsedAttributeSet[nn] = { + value: attnode.nodeValue + }; + } + return parsedAttributeSet; + }; +}; + +dojo.provide("dojo.lang.declare"); + + + + +dojo.lang.declare = function( /*String*/ className, + /*Function|Array*/ superclass, + /*Function?*/ init, + /*Object|Array*/ props){ + /* + * summary: Create a feature-rich constructor with a compact notation + * className: the name of the constructor (loosely, a "class") + * superclass: + * may be a Function, or an Array of Functions. If "superclass" is an + * array, the first element is used as the prototypical ancestor and + * any following Functions become mixin ancestors. + * init: an initializer function + * props: + * an object (or array of objects) whose properties are copied to the + * created prototype + * description: + * Create a constructor using a compact notation for inheritance and + * prototype extension. "superclass" argument may be a Function, or an + * array of Functions. + * + * If "superclass" is an array, the first element is used as the + * prototypical ancestor and any following Functions become mixin + * ancestors. + * + * All "superclass(es)" must be Functions (not mere Objects). + * + * Using mixin ancestors provides a type of multiple inheritance. + * Mixin ancestors prototypical properties are copied to the subclass, + * and any inializater/constructor is invoked. + * + * Properties of object "props" are copied to the constructor + * prototype. If "props" is an array, properties of each object in the + * array are copied to the constructor prototype. + * + * name of the class ("className" argument) is stored in + * "declaredClass" property + * + * Initializer functions are called when an object is instantiated + * from this constructor. + * + * Aliased as "dojo.declare" + * + * Usage: + * + * dojo.declare("my.classes.bar", my.classes.foo, + * function(){ + * // initialization function + * this.myComplicatedObject = new ReallyComplicatedObject(); + * }, + * { // properties to be added to the class prototype + * someValue: 2, + * someMethod: function(){ + * doStuff(); + * } + * } + * ); + * + */ + if((dojo.lang.isFunction(props))||((!props)&&(!dojo.lang.isFunction(init)))){ + // parameter juggling to support omitting init param (also allows + // reordering init and props arguments) + var temp = props; + props = init; + init = temp; + } + var mixins = [ ]; + if(dojo.lang.isArray(superclass)){ + mixins = superclass; + superclass = mixins.shift(); + } + if(!init){ + init = dojo.evalObjPath(className, false); + if((init)&&(!dojo.lang.isFunction(init))){ init = null }; + } + var ctor = dojo.lang.declare._makeConstructor(); + var scp = (superclass ? superclass.prototype : null); + if(scp){ + scp.prototyping = true; + ctor.prototype = new superclass(); + scp.prototyping = false; + } + ctor.superclass = scp; + ctor.mixins = mixins; + for(var i=0,l=mixins.length; i by convention + if(!dojo.hostenv.moduleHasPrefix(name)){ + dojo.registerModulePath(name, "../" + name); + } + req([name, 'manifest'].join('.'), false, true); + } + if(!this.namespaces[name]){ + this.failed[name] = true; //only look for a namespace once + } + }finally{ + this.loading[name]=false; + } + return this.namespaces[name]; // Ns + } +} + +dojo.ns.Ns = function(/*String*/name, /*String*/module, /*Function?*/resolver){ + // summary: this object simply encapsulates namespace data + this.name = name; + this.module = module; + this.resolver = resolver; + this._loaded = [ ]; + this._failed = [ ]; +} + +dojo.ns.Ns.prototype.resolve = function(/*String*/name, /*String*/domain, /*Boolean?*/omitModuleCheck){ + //summary: map component with 'name' and 'domain' to a module via namespace resolver, if specified + if(!this.resolver || djConfig["skipAutoRequire"]){return false;} // Boolean + var fullName = this.resolver(name, domain); + //only load a widget once. This is a quicker check than dojo.require does + if((fullName)&&(!this._loaded[fullName])&&(!this._failed[fullName])){ + //workaround so we don't break the build system + var req = dojo.require; + req(fullName, false, true); //omit the module check, we'll do it ourselves. + if(dojo.hostenv.findModule(fullName, false)){ + this._loaded[fullName] = true; + }else{ + if(!omitModuleCheck){dojo.raise("dojo.ns.Ns.resolve: module '" + fullName + "' not found after loading via namespace '" + this.name + "'");} + this._failed[fullName] = true; + } + } + return Boolean(this._loaded[fullName]); // Boolean +} + +dojo.registerNamespace = function(/*String*/name, /*String*/module, /*Function?*/resolver){ + // summary: maps a module name to a namespace for widgets, and optionally maps widget names to modules for auto-loading + // description: An unregistered namespace is mapped to an eponymous module. + // For example, namespace acme is mapped to module acme, and widgets are + // assumed to belong to acme.widget. If you want to use a different widget + // module, use dojo.registerNamespace. + dojo.ns.register.apply(dojo.ns, arguments); +} + +dojo.registerNamespaceResolver = function(/*String*/name, /*Function*/resolver){ + // summary: a resolver function maps widget names to modules, so the + // widget manager can auto-load needed widget implementations + // + // description: The resolver provides information to allow Dojo + // to load widget modules on demand. When a widget is created, + // a namespace resolver can tell Dojo what module to require + // to ensure that the widget implementation code is loaded. + // + // name: will always be lower-case. + // + // example: + // dojo.registerNamespaceResolver("acme", + // function(name){ + // return "acme.widget."+dojo.string.capitalize(name); + // } + // ); + var n = dojo.ns.namespaces[name]; + if(n){ + n.resolver = resolver; + } +} + +dojo.registerNamespaceManifest = function(/*String*/module, /*String*/path, /*String*/name, /*String*/widgetModule, /*Function?*/resolver){ + // summary: convenience function to register a module path, a namespace, and optionally a resolver all at once. + dojo.registerModulePath(name, path); + dojo.registerNamespace(name, widgetModule, resolver); +} + +// NOTE: rather put this in dojo.widget.Widget, but that fubars debugAtAllCosts +dojo.registerNamespace("dojo", "dojo.widget"); + +dojo.provide("dojo.widget.Manager"); + + + + +// summary +// Manager class for the widgets. +// This is an internal class used by dojo; users shouldn't call this class directly. +dojo.widget.manager = new function(){ + this.widgets = []; + this.widgetIds = []; + + // map of widgetId-->widget for widgets without parents (top level widgets) + this.topWidgets = {}; + + var widgetTypeCtr = {}; + var renderPrefixCache = []; + + this.getUniqueId = function (widgetType) { + var widgetId; + do{ + widgetId = widgetType + "_" + (widgetTypeCtr[widgetType] != undefined ? + ++widgetTypeCtr[widgetType] : widgetTypeCtr[widgetType] = 0); + }while(this.getWidgetById(widgetId)); + return widgetId; + } + + this.add = function(widget){ + //dojo.profile.start("dojo.widget.manager.add"); + this.widgets.push(widget); + // Opera9 uses ID (caps) + if(!widget.extraArgs["id"]){ + widget.extraArgs["id"] = widget.extraArgs["ID"]; + } + // FIXME: the rest of this method is very slow! + if(widget.widgetId == ""){ + if(widget["id"]){ + widget.widgetId = widget["id"]; + }else if(widget.extraArgs["id"]){ + widget.widgetId = widget.extraArgs["id"]; + }else{ + widget.widgetId = this.getUniqueId(widget.ns+'_'+widget.widgetType); + } + } + if(this.widgetIds[widget.widgetId]){ + dojo.debug("widget ID collision on ID: "+widget.widgetId); + } + this.widgetIds[widget.widgetId] = widget; + // Widget.destroy already calls removeById(), so we don't need to + // connect() it here + //dojo.profile.end("dojo.widget.manager.add"); + } + + this.destroyAll = function(){ + for(var x=this.widgets.length-1; x>=0; x--){ + try{ + // this.widgets[x].destroyChildren(); + this.widgets[x].destroy(true); + delete this.widgets[x]; + }catch(e){ } + } + } + + // FIXME: we should never allow removal of the root widget until all others + // are removed! + this.remove = function(widgetIndex){ + if(dojo.lang.isNumber(widgetIndex)){ + var tw = this.widgets[widgetIndex].widgetId; + delete this.topWidgets[tw]; + delete this.widgetIds[tw]; + this.widgets.splice(widgetIndex, 1); + }else{ + this.removeById(widgetIndex); + } + } + + // FIXME: suboptimal performance + this.removeById = function(id) { + if(!dojo.lang.isString(id)){ + id = id["widgetId"]; + if(!id){ dojo.debug("invalid widget or id passed to removeById"); return; } + } + for (var i=0; i.widget by convention + dojo.ns.register(ns, ns + '.widget'); + nsObj = dojo.ns.get(ns); + } + + // allow the namespace to resolve the widget module + if(nsObj){nsObj.resolve(widgetName);} + + // locate a widget implementation in the registered module for our current rendering environment + impl = findImplementation(lowerCaseWidgetName, nsObj.module); + if(impl){return(imps[lowerCaseWidgetName] = impl)}; + + // try to load a manifest to resolve this implemenation + nsObj = dojo.ns.require(ns); + if((nsObj)&&(nsObj.resolver)){ + nsObj.resolve(widgetName); + impl = findImplementation(lowerCaseWidgetName, nsObj.module); + if(impl){return(imps[lowerCaseWidgetName] = impl)}; + } + + // this is an error condition under new rules + dojo.deprecated('dojo.widget.Manager.getImplementationName', + 'Could not locate widget implementation for "' + widgetName + '" in "' + nsObj.module + '" registered to namespace "' + nsObj.name + '". ' + + "Developers must specify correct namespaces for all non-Dojo widgets", "0.5"); + + // backward compat: if the user has not specified any namespace and their widget is not in dojo.widget.* + // search registered widget packages [sic] + // note: registerWidgetPackage itself is now deprecated + for(var i=0; i 0) { + return widgets[n]; + } + return widgets; + } + g("registerWidgetPackage"); + g("getImplementation", "getWidgetImplementation"); + g("getImplementationName", "getWidgetImplementationName"); + + dw.widgets = dwm.widgets; + dw.widgetIds = dwm.widgetIds; + dw.root = dwm.root; +})(); + +dojo.kwCompoundRequire({ + common: [["dojo.uri.Uri", false, false]] +}); +dojo.provide("dojo.uri.*"); + +dojo.provide("dojo.a11y"); + + + + +dojo.a11y = { + // imgPath: String path to the test image for determining if images are displayed or not + // doAccessibleCheck: Boolean if true will perform check for need to create accessible widgets + // accessible: Boolean uninitialized when null (accessible check has not been performed) + // if true generate accessible widgets + imgPath:dojo.uri.moduleUri("dojo.widget", "templates/images"), + doAccessibleCheck: true, + accessible: null, + + checkAccessible: function(){ + // summary: + // perform check for accessibility if accessibility checking is turned + // on and the accessibility test has not been performed yet + if(this.accessible === null){ + this.accessible = false; //default + if(this.doAccessibleCheck == true){ + this.accessible = this.testAccessible(); + } + } + return this.accessible; /* Boolean */ + }, + + testAccessible: function(){ + // summary: + // Always perform the accessibility check to determine if high + // contrast mode is on or display of images are turned off. Currently only checks + // in IE and Mozilla. + this.accessible = false; //default + if (dojo.render.html.ie || dojo.render.html.mozilla){ + var div = document.createElement("div"); + //div.style.color="rgb(153,204,204)"; + div.style.backgroundImage = "url(\"" + this.imgPath + "/tab_close.gif\")"; + // must add to hierarchy before can view currentStyle below + dojo.body().appendChild(div); + // in FF and IE the value for the current background style of the added div + // will be "none" in high contrast mode + // in FF the return value will be url(invalid-url:) when running over http + var bkImg = null; + if (window.getComputedStyle ) { + var cStyle = getComputedStyle(div, ""); + bkImg = cStyle.getPropertyValue("background-image"); + }else{ + bkImg = div.currentStyle.backgroundImage; + } + var bUseImgElem = false; + if (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)" )) { + this.accessible = true; + } + /* + if(this.accessible == false && document.images){ + // test if images are off in IE + var testImg = new Image(); + if(testImg.fileSize) { + testImg.src = this.imgPath + "/tab_close.gif"; + if(testImg.fileSize < 0){ + this.accessible = true; + } + } + }*/ + dojo.body().removeChild(div); + } + return this.accessible; /* Boolean */ + }, + + setCheckAccessible: function(/* Boolean */ bTest){ + // summary: + // Set whether or not to check for accessibility mode. Default value + // of module is true - perform check for accessibility modes. + // bTest: Boolean - true to check; false to turn off checking + this.doAccessibleCheck = bTest; + }, + + setAccessibleMode: function(){ + // summary: + // perform the accessibility check and sets the correct mode to load + // a11y widgets. Only runs if test for accessiiblity has not been performed yet. + // Call testAccessible() to force the test. + if (this.accessible === null){ + if (this.checkAccessible()){ + dojo.render.html.prefixes.unshift("a11y"); + } + } + return this.accessible; /* Boolean */ + } +}; + +//dojo.hostenv.modulesLoadedListeners.unshift(function() { dojo.a11y.setAccessibleMode(); }); +//dojo.event.connect("before", dojo.hostenv, "makeWidgets", dojo.a11y, "setAccessibleMode"); + +dojo.provide("dojo.widget.Widget"); + + + + + + + + + + +dojo.declare("dojo.widget.Widget", null, + function(){ + // these properties aren't primitives and need to be created on a per-item + // basis. + + // children: Array + // a list of all of the widgets that have been added as children of + // this component. Should only have values if isContainer is true. + this.children = []; + + // extraArgs: Object + // a map of properties which the widget system tried to assign from + // user input but did not correspond to any of the properties set on + // the class prototype. These names will also be available in all + // lower-case form in this map + this.extraArgs = {}; + }, +{ + // parent: Widget + // the parent of this widget + parent: null, + + // isTopLevel: Boolean + // should this widget eat all events that bubble up to it? + // obviously, top-level and modal widgets should set these appropriately + isTopLevel: false, + + // disabled: Boolean + // should this widget respond to user input? + // in markup, this is specified as "disabled='disabled'", or just "disabled" + disabled: false, + + // isContainer: Boolean + // can this widget contain other widgets? + isContainer: false, + + // widgetId: String + // a unique, opaque ID string that can be assigned by users or by the + // system. If the developer passes an ID which is known not to be + // unique, the specified ID is ignored and the system-generated ID is + // used instead. + widgetId: "", + + // widgetType: String + // used for building generic widgets + widgetType: "Widget", + + // ns: String + // defaults to 'dojo'. "namespace" is a reserved word in JavaScript, so we abbreviate + ns: "dojo", + + getNamespacedType: function(){ + // summary: + // get the "full" name of the widget. If the widget comes from the + // "dojo" namespace and is a Button, calling this method will + // return "dojo:button", all lower-case + return (this.ns ? this.ns + ":" + this.widgetType : this.widgetType).toLowerCase(); // String + }, + + toString: function(){ + // summary: + // returns a string that represents the widget. When a widget is + // cast to a string, this method will be used to generate the + // output. Currently, it does not implement any sort of reversable + // serialization. + return '[Widget ' + this.getNamespacedType() + ', ' + (this.widgetId || 'NO ID') + ']'; // String + }, + + repr: function(){ + // summary: returns the string representation of the widget. + return this.toString(); // String + }, + + enable: function(){ + // summary: + // enables the widget, usually involving unmasking inputs and + // turning on event handlers. Not implemented here. + this.disabled = false; + }, + + disable: function(){ + // summary: + // disables the widget, usually involves masking inputs and + // unsetting event handlers. Not implemented here. + this.disabled = true; + }, + + // TODO: + // 1) this would be better in HtmlWidget rather than here? + // 2) since many widgets don't care if they've been resized, maybe this should be a mixin? + onResized: function(){ + // summary: + // A signal that widgets will call when they have been resized. + // Can be connected to for determining if a layout needs to be + // reflowed. Clients should override this function to do special + // processing, then call this.notifyChildrenOfResize() to notify + // children of resize. + this.notifyChildrenOfResize(); + }, + + notifyChildrenOfResize: function(){ + // summary: dispatches resized events to all children of this widget + for(var i=0; i mixInProperties"); + //dojo.profile.start(this.widgetType + " mixInProperties"); + this.mixInProperties(args, fragment, parent); + //dojo.profile.end(this.widgetType + " mixInProperties"); + // dojo.debug(this.widgetType, "-> postMixInProperties"); + //dojo.profile.start(this.widgetType + " postMixInProperties"); + this.postMixInProperties(args, fragment, parent); + //dojo.profile.end(this.widgetType + " postMixInProperties"); + // dojo.debug(this.widgetType, "-> dojo.widget.manager.add"); + dojo.widget.manager.add(this); + // dojo.debug(this.widgetType, "-> buildRendering"); + //dojo.profile.start(this.widgetType + " buildRendering"); + this.buildRendering(args, fragment, parent); + //dojo.profile.end(this.widgetType + " buildRendering"); + // dojo.debug(this.widgetType, "-> initialize"); + //dojo.profile.start(this.widgetType + " initialize"); + this.initialize(args, fragment, parent); + //dojo.profile.end(this.widgetType + " initialize"); + // dojo.debug(this.widgetType, "-> postInitialize"); + // postinitialize includes subcomponent creation + // profile is put directly to function + this.postInitialize(args, fragment, parent); + // dojo.debug(this.widgetType, "-> postCreate"); + //dojo.profile.start(this.widgetType + " postCreate"); + this.postCreate(args, fragment, parent); + //dojo.profile.end(this.widgetType + " postCreate"); + // dojo.debug(this.widgetType, "done!"); + + //dojo.profile.end(this.widgetType + " create"); + + return this; + }, + + destroy: function(finalize){ + // summary: + // Destroy this widget and it's descendants. This is the generic + // "destructor" function that all widget users should call to + // clealy discard with a widget. Once a widget is destroyed, it's + // removed from the manager object. + // finalize: Boolean + // is this function being called part of global environment + // tear-down? + + // FIXME: this is woefully incomplete + if(this.parent){ + this.parent.removeChild(this); + } + this.destroyChildren(); + this.uninitialize(); + this.destroyRendering(finalize); + dojo.widget.manager.removeById(this.widgetId); + }, + + destroyChildren: function(){ + // summary: + // Recursively destroy the children of this widget and their + // descendents. + var widget; + var i=0; + while(this.children.length > i){ + widget = this.children[i]; + if (widget instanceof dojo.widget.Widget) { // find first widget + this.removeChild(widget); + widget.destroy(); + continue; + } + + i++; // skip data object + } + + }, + + getChildrenOfType: function(/*String*/type, recurse){ + // summary: + // return an array of descendant widgets who match the passed type + // recurse: Boolean + // should we try to get all descendants that match? Defaults to + // false. + var ret = []; + var isFunc = dojo.lang.isFunction(type); + if(!isFunc){ + type = type.toLowerCase(); + } + for(var x=0; xsi)){ + this[x][pairs[y].substr(0, si).replace(/^\s+|\s+$/g, "")] = pairs[y].substr(si+1); + } + } + } + }else{ + // the default is straight-up string assignment. When would + // we ever hit this? + this[x] = args[x]; + } + } + }else{ + // collect any extra 'non mixed in' args + this.extraArgs[x.toLowerCase()] = args[x]; + } + } + // dojo.profile.end("mixInProperties"); + }, + + postMixInProperties: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ + // summary + // Called after the parameters to the widget have been read-in, + // but before the widget template is instantiated. + // Especially useful to set properties that are referenced in the widget template. + }, + + initialize: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ + // summary: stub function. + return false; + // dojo.unimplemented("dojo.widget.Widget.initialize"); + }, + + postInitialize: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ + // summary: stub function. + return false; + }, + + postCreate: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ + // summary: stub function. + return false; + }, + + uninitialize: function(){ + // summary: + // stub function. Over-ride to implement custom widget tear-down + // behavior. + return false; + }, + + buildRendering: function(/*Object*/args, /*Object*/frag, /*Widget*/parent){ + // summary: stub function. SUBCLASSES MUST IMPLEMENT + dojo.unimplemented("dojo.widget.Widget.buildRendering, on "+this.toString()+", "); + return false; + }, + + destroyRendering: function(){ + // summary: stub function. SUBCLASSES MUST IMPLEMENT + dojo.unimplemented("dojo.widget.Widget.destroyRendering"); + return false; + }, + + addedTo: function(parent){ + // summary: + // stub function this is just a signal that can be caught + // parent: Widget + // instance of dojo.widget.Widget that we were added to + }, + + addChild: function(child){ + // summary: stub function. SUBCLASSES MUST IMPLEMENT + dojo.unimplemented("dojo.widget.Widget.addChild"); + return false; + }, + + // Detach the given child widget from me, but don't destroy it + removeChild: function(/*Widget*/widget){ + // summary: + // removes the passed widget instance from this widget but does + // not destroy it + for(var x=0; x +dojo.widget.tags["dojo:connect"] = function(fragment, widgetParser, parentComp){ + var properties = widgetParser.parseProperties(fragment["dojo:connect"]); +} + +// FIXME: if we know the insertion point (to a reasonable location), why then do we: +// - create a template node +// - clone the template node +// - render the clone and set properties +// - remove the clone from the render tree +// - place the clone +// this is quite dumb +dojo.widget.buildWidgetFromParseTree = function(/*String*/ type, + /*Object*/ frag, + /*dojo.widget.Parse*/ parser, + /*Widget, optional*/ parentComp, + /*int, optional*/ insertionIndex, + /*Object*/ localProps){ + + // summary: creates a tree of widgets from the data structure produced by the first-pass parser (frag) + + // test for accessibility mode + dojo.a11y.setAccessibleMode(); + //dojo.profile.start("buildWidgetFromParseTree"); + // FIXME: for codepath from createComponentFromScript, we are now splitting a path + // that we already split and then joined + var stype = type.split(":"); + stype = (stype.length == 2) ? stype[1] : type; + + // FIXME: we don't seem to be doing anything with this! + // var propertySets = parser.getPropertySets(frag); + var localProperties = localProps || parser.parseProperties(frag[frag["ns"]+":"+stype]); + var twidget = dojo.widget.manager.getImplementation(stype,null,null,frag["ns"]); + if(!twidget){ + throw new Error('cannot find "' + type + '" widget'); + }else if (!twidget.create){ + throw new Error('"' + type + '" widget object has no "create" method and does not appear to implement *Widget'); + } + localProperties["dojoinsertionindex"] = insertionIndex; + // FIXME: we lose no less than 5ms in construction! + var ret = twidget.create(localProperties, frag, parentComp, frag["ns"]); + // dojo.profile.end("buildWidgetFromParseTree"); + return ret; +} + +dojo.widget.defineWidget = function(widgetClass, renderer, superclasses, init, props){ + // summary: Create a widget constructor function (aka widgetClass) + // widgetClass: String + // the location in the object hierarchy to place the new widget class constructor + // renderer: String + // usually "html", determines when this delcaration will be used + // superclasses: Function||Function[] + // can be either a single function or an array of functions to be + // mixed in as superclasses. If an array, only the first will be used + // to set prototype inheritance. + // init: Function + // an optional constructor function. Will be called after superclasses are mixed in. + // props: Object + // a map of properties and functions to extend the class prototype with + + // This meta-function does parameter juggling for backward compat and overloading + // if 4th argument is a string, we are using the old syntax + // old sig: widgetClass, superclasses, props (object), renderer (string), init (function) + if(dojo.lang.isString(arguments[3])){ + dojo.widget._defineWidget(arguments[0], arguments[3], arguments[1], arguments[4], arguments[2]); + }else{ + // widgetClass + var args = [ arguments[0] ], p = 3; + if(dojo.lang.isString(arguments[1])){ + // renderer, superclass + args.push(arguments[1], arguments[2]); + }else{ + // superclass + args.push('', arguments[1]); + p = 2; + } + if(dojo.lang.isFunction(arguments[p])){ + // init (function), props (object) + args.push(arguments[p], arguments[p+1]); + }else{ + // props (object) + args.push(null, arguments[p]); + } + dojo.widget._defineWidget.apply(this, args); + } +} + +dojo.widget.defineWidget.renderers = "html|svg|vml"; + +dojo.widget._defineWidget = function(widgetClass /*string*/, renderer /*string*/, superclasses /*function||array*/, init /*function*/, props /*object*/){ + // FIXME: uncomment next line to test parameter juggling ... remove when confidence improves + // dojo.debug('(c:)' + widgetClass + '\n\n(r:)' + renderer + '\n\n(i:)' + init + '\n\n(p:)' + props); + // widgetClass takes the form foo.bar.baz<.renderer>.WidgetName (e.g. foo.bar.baz.WidgetName or foo.bar.baz.html.WidgetName) + var module = widgetClass.split("."); + var type = module.pop(); // type <= WidgetName, module <= foo.bar.baz<.renderer> + var regx = "\\.(" + (renderer ? renderer + '|' : '') + dojo.widget.defineWidget.renderers + ")\\."; + var r = widgetClass.search(new RegExp(regx)); + module = (r < 0 ? module.join(".") : widgetClass.substr(0, r)); + + // deprecated in favor of namespace system, remove for 0.5 + dojo.widget.manager.registerWidgetPackage(module); + + var pos = module.indexOf("."); + var nsName = (pos > -1) ? module.substring(0,pos) : module; + + // FIXME: hrm, this might make things simpler + //dojo.widget.tags.addParseTreeHandler(nsName+":"+type.toLowerCase()); + + props=(props)||{}; + props.widgetType = type; + if((!init)&&(props["classConstructor"])){ + init = props.classConstructor; + delete props.classConstructor; + } + dojo.declare(widgetClass, superclasses, init, props); +} + +dojo.provide("dojo.widget.Parse"); + + + +// +// dojoML parser should be moved out of 'widget', codifying the difference between a 'component' +// and a 'widget'. A 'component' being anything that can be generated from a tag. +// +// a particular dojoML tag would be handled by a registered tagHandler with a hook for a default handler +// if the widget system is loaded, a widget builder would be attach itself as the default handler +// +// widget tags are no longer registered themselves: +// they are now arbitrarily namespaced, so we cannot register them all, and the non-prefixed portions +// are no longer guaranteed unique +// +// therefore dojo.widget.tags should go with this parser code out of the widget module +// + +dojo.widget.Parse = function(/*Object*/fragment){ + this.propertySetsList = []; + this.fragment = fragment; + + this.createComponents = function(/*Object*/frag, /*Object*/parentComp){ + var comps = []; + var built = false; + // if we have items to parse/create at this level, do it! + try{ + if(frag && frag.tagName && (frag != frag.nodeRef)){ + + // these are in fact, not ever for widgets per-se anymore, + // but for other markup elements (aka components) + var djTags = dojo.widget.tags; + + // we split so that you can declare multiple + // non-destructive components from the same ctor node + var tna = String(frag.tagName).split(";"); + for(var x=0; x -1) ? name.substring(0,pos) : "dojo"; + if(pos > -1){ name = name.substring(pos+1); } + var lowerCaseName = name.toLowerCase(); + var namespacedName = ns + ":" + lowerCaseName; + isNode = (dojo.byId(name) && !dojo.widget.tags[namespacedName]); + } + + if((arguments.length == 1) && (isNode || !isNameStr)){ + // we got a DOM node + var xp = new dojo.xml.Parse(); + // FIXME: we should try to find the parent! + var tn = isNode ? dojo.byId(name) : name; + return dojo.widget.getParser().createComponents(xp.parseElement(tn, null, true))[0]; + } + + function fromScript(placeKeeperNode, name, props, ns){ + props[namespacedName] = { + dojotype: [{value: lowerCaseName}], + nodeRef: placeKeeperNode, + fastMixIn: true + }; + props.ns = ns; + return dojo.widget.getParser().createComponentFromScript(placeKeeperNode, name, props, ns); + } + + props = props||{}; + var notRef = false; + var tn = null; + var h = dojo.render.html.capable; + if(h){ + tn = document.createElement("span"); + } + if(!refNode){ + notRef = true; + refNode = tn; + if(h){ + dojo.body().appendChild(refNode); + } + }else if(position){ + dojo.dom.insertAtPosition(tn, refNode, position); + }else{ // otherwise don't replace, but build in-place + tn = refNode; + } + var widgetArray = fromScript(tn, name.toLowerCase(), props, ns); + if( (!widgetArray)||(!widgetArray[0])|| + (typeof widgetArray[0].widgetType == "undefined") ){ + throw new Error("createWidget: Creation of \"" + name + "\" widget failed."); + } + try{ + if(notRef && widgetArray[0].domNode.parentNode){ + widgetArray[0].domNode.parentNode.removeChild(widgetArray[0].domNode); + } + }catch(e){ + /* squelch for Safari */ + dojo.debug(e); + } + return widgetArray[0]; // Widget +} + +dojo.provide("dojo.widget.DomWidget"); + + + + + + + + + + +dojo.widget._cssFiles = {}; +dojo.widget._cssStrings = {}; +dojo.widget._templateCache = {}; + +dojo.widget.defaultStrings = { + // summary: a mapping of strings that are used in template variable replacement + dojoRoot: dojo.hostenv.getBaseScriptUri(), + dojoWidgetModuleUri: dojo.uri.moduleUri("dojo.widget"), + baseScriptUri: dojo.hostenv.getBaseScriptUri() +}; + +dojo.widget.fillFromTemplateCache = function(obj, templatePath, templateString, avoidCache){ + // summary: + // static method to build from a template w/ or w/o a real widget in + // place + // obj: DomWidget + // an instance of dojo.widget.DomWidget to initialize the template for + // templatePath: String + // the URL to get the template from. dojo.uri.Uri is often passed as well. + // templateString: String? + // a string to use in lieu of fetching the template from a URL + // avoidCache: Boolean? + // should the template system not use whatever is in the cache and + // always use the passed templatePath or templateString? + + // dojo.debug("avoidCache:", avoidCache); + var tpath = templatePath || obj.templatePath; + + var tmplts = dojo.widget._templateCache; + if(!tpath && !obj["widgetType"]) { // don't have a real template here + 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)){ + // fetch a text fragment and assign it to templateString + // NOTE: we rely on blocking IO here! + 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(/*String*/tString){ + //summary: Strips declarations so that external SVG and XML + //documents can be added to a document without worry. Also, if the string + //is an HTML document, only the part inside the body tag is returned. + 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; //String +} + +dojo.widget._templateCache.dummyCount = 0; + +// Array: list of properties to search for node-to-property mappings +dojo.widget.attachProperties = ["dojoAttachPoint", "id"]; + +// String: name of the property to use for mapping DOM events to widget functions +dojo.widget.eventAttachProperty = "dojoAttachEvent"; + +// String: property name of code to evaluate when the widget is constructed +dojo.widget.onBuildProperty = "dojoOnBuild"; + +// Array: possible accessibility values to set on widget elements - role or state +dojo.widget.waiNames = ["waiRole", "waiState"]; + +dojo.widget.wai = { + // summary: Contains functions to set accessibility roles and states + // onto widget elements + waiRole: { + // name: String: + // information for mapping accessibility role + name: "waiRole", + // namespace: String: + // URI of the namespace for the set of roles + "namespace": "http://www.w3.org/TR/xhtml2", + // alias: String: + // The alias to assign the namespace + alias: "x2", + // prefix: String: + // The prefix to assign to the role value + prefix: "wairole:" + }, + waiState: { + // name: String: + // information for mapping accessibility state + name: "waiState", + // namespace: String: + // URI of the namespace for the set of states + "namespace": "http://www.w3.org/2005/07/aaa", + // alias: String: + // The alias to assign the namespace + alias: "aaa", + // prefix: String: + // empty string - state value does not require prefix + prefix: "" + }, + setAttr: function(/*DomNode*/node, /*String*/ ns, /*String*/ attr, /*String|Boolean*/value){ + // summary: Use appropriate API to set the role or state attribute onto the element. + // description: In IE use the generic setAttribute() api. Append a namespace + // alias to the attribute name and appropriate prefix to the value. + // Otherwise, use the setAttribueNS api to set the namespaced attribute. Also + // add the appropriate prefix to the attribute 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(/*DomNode*/ node, /*String*/ ns, /*String|Boolena*/ attr){ + // Summary: Use the appropriate API to retrieve the role or state value + // Description: In IE use the generic getAttribute() api. An alias value + // was added to the attribute name to simulate a namespace when the attribute + // was set. Otherwise use the getAttributeNS() api to retrieve the state value + if(dojo.render.html.ie){ + return node.getAttribute(this[ns].alias+":"+attr); + }else{ + return node.getAttributeNS(this[ns]["namespace"], attr); + } + }, + removeAttr: function(/*DomNode*/ node, /*String*/ ns, /*String|Boolena*/ attr){ + // summary: Use the appropriate API to remove the role or state value + // description: In IE use the generic removeAttribute() api. An alias value + // was added to the attribute name to simulate a namespace when the attribute + // was set. Otherwise use the removeAttributeNS() api to remove the state value + var success = true; //only IE returns a value + 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, /*Widget*/ targetObj, events ){ + // summary: + // map widget properties and functions to the handlers specified in + // the dom node and it's descendants. This function iterates over all + // nodes and looks for these properties: + // * dojoAttachPoint + // * dojoAttachEvent + // * waiRole + // * waiState + // * any "dojoOn*" proprties passed in the events array + // rootNode: DomNode + // the node to search for properties. All children will be searched. + // events: Array + // a list of properties generated from getDojoEventsFromStr. + + // FIXME: this method is still taking WAAAY too long. We need ways of optimizing: + // a.) what we are looking for on each node + // b.) the nodes that are subject to interrogation (use xpath instead?) + // c.) how expensive event assignment is (less eval(), more connect()) + // var start = new Date(); + 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; + } + // alert(events.length); + + var nodes = rootNode.all || rootNode.getElementsByTagName("*"); + var _this = targetObj; + for(var x=-1; x= 0){ + // oh, if only JS had tuple assignment + 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); + // dojo.event.browser.addListener(baseNode, tevt, dojo.lang.hitch(_this, thisFunc)); + } + } + + for(var y=0; y=0){ + funcs = dojo.lang.map(thisFunc.split(";"), trim); + } + for(var z=0; z0)&&(typeof arguments[0] == "object")){ + this.create(arguments[0]); + } + }, + { + // templateNode: DomNode + // a node that represents the widget template. Pre-empts both templateString and templatePath. + templateNode: null, + + // templateString String: + // a string that represents the widget template. Pre-empts the + // templatePath. In builds that have their strings "interned", the + // templatePath is converted to an inline templateString, thereby + // preventing a synchronous network call. + templateString: null, + + // templateCssString String: + // a string that represents the CSS for the widgettemplate. + // Pre-empts the templateCssPath. In builds that have their + // strings "interned", the templateCssPath is converted to an + // inline templateCssString, thereby preventing a synchronous + // network call. + templateCssString: null, + + // preventClobber Boolean: + // should the widget not replace the node from which it was + // constructed? Widgets that apply behaviors to pre-existing parts + // of a page can be implemented easily by setting this to "true". + // In these cases, the domNode property will point to the node + // which the widget was created from. + preventClobber: false, + + // domNode DomNode: + // this is our visible representation of the widget! Other DOM + // Nodes may by assigned to other properties, usually through the + // template system's dojoAttachPonit syntax, but the domNode + // property is the canonical "top level" node in widget UI. + domNode: null, + + // containerNode DomNode: + // holds child elements. "containerNode" is generally set via a + // dojoAttachPoint assignment and it designates where widgets that + // are defined as "children" of the parent will be placed + // visually. + containerNode: null, + + // widgetsInTemplate Boolean: + // should we parse the template to find widgets that might be + // declared in markup inside it? false by default. + widgetsInTemplate: false, + + addChild: function(/*Widget*/ widget, overrideContainerNode, pos, ref, insertIndex){ + // summary: + // Process the given child widget, inserting it's dom node as + // a child of our dom node + // overrideContainerNode: DomNode? + // a non-default container node for the widget + // pos: String? + // can be one of "before", "after", "first", or "last". This + // has the same meaning as in dojo.dom.insertAtPosition() + // ref: DomNode? + // a node to place the widget relative to + // insertIndex: int? + // DOM index, same meaning as in dojo.dom.insertAtIndex() + // returns: the widget that was inserted + + // FIXME: should we support addition at an index in the children arr and + // order the display accordingly? Right now we always append. + if(!this.isContainer){ // we aren't allowed to contain other widgets, it seems + 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; // Widget + }, + + addWidgetAsDirectChild: function(/*Widget*/ widget, overrideContainerNode, pos, ref, insertIndex){ + // summary: + // Process the given child widget, inserting it's dom node as + // a child of our dom node + // overrideContainerNode: DomNode + // a non-default container node for the widget + // pos: String? + // can be one of "before", "after", "first", or "last". This + // has the same meaning as in dojo.dom.insertAtPosition() + // ref: DomNode? + // a node to place the widget relative to + // insertIndex: int? + // DOM index, same meaning as in dojo.dom.insertAtIndex() + 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); + + // insert the child widget domNode directly underneath my domNode, in the + // specified position (by default, append to end) + if(!ref){ + cn.appendChild(widget.domNode); + }else{ + // FIXME: was this meant to be the (ugly hack) way to support insert @ index? + //dojo.dom[pos](widget.domNode, ref, insertIndex); + + // CAL: this appears to be the intended way to insert a node at a given position... + if (pos == 'insertAtIndex'){ + // dojo.debug("idx:", insertIndex, "isLast:", ref === cn.lastChild); + dojo.dom.insertAtIndex(widget.domNode, ref.parentNode, insertIndex); + }else{ + // dojo.debug("pos:", pos, "isLast:", ref === cn.lastChild); + if((pos == "after")&&(ref === cn.lastChild)){ + cn.appendChild(widget.domNode); + }else{ + dojo.dom.insertAtPosition(widget.domNode, cn, pos); + } + } + } + }, + + registerChild: function(widget, insertionIndex){ + // summary: record that given widget descends from me + // widget: Widget + // the widget that is now a child + // insertionIndex: int + // where in the children[] array to place it + + // we need to insert the child at the right point in the parent's + // 'children' array, based on the insertionIndex + + widget.dojoInsertionIndex = insertionIndex; + + var idx = -1; + for(var i=0; i node that can't be inserted back into the original DOM tree + parentComp.addWidgetAsDirectChild(this, "", "insertAtIndex", "", args["dojoinsertionindex"], sourceNodeRef); + } else if (sourceNodeRef){ + // Do in-place replacement of the my source node with my generated dom + if(this.domNode && (this.domNode !== sourceNodeRef)){ + this._sourceNodeRef = dojo.dom.replaceNode(sourceNodeRef, this.domNode); + } + } + + // Register myself with my parent, or with the widget manager if + // I have no parent + // TODO: the code below erroneously adds all programatically generated widgets + // to topWidgets (since we don't know who the parent is until after creation finishes) + 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; + //TODO: use xpath here? + var subnodes = this.domNode.getElementsByTagName("*"); + for(var i=0;i= 0){ + // oh, if only JS had tuple assignment + 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']){ + //don't attach widget.domNode here, as we do not know which + //dom node we should connect to (in checkbox widget case, + //it is inputNode). So we make the widget itself available + this[widget.extraArgs['dojoattachpoint']] = widget; + } + } + } + + //dojo.profile.end(this.widgetType + " postInitialize"); + + // Expand my children widgets + /* dojoDontFollow is important for a very special case + * basically if you have a widget that you instantiate from script + * and that widget is a container, and it contains a reference to a parent + * instance, the parser will start recursively parsing until the browser + * complains. So the solution is to set an initialization property of + * dojoDontFollow: true and then it won't recurse where it shouldn't + */ + if(this.isContainer && !frag["dojoDontFollow"]){ + //alert("recurse from " + this.widgetId); + // build any sub-components with us as the parent + dojo.widget.getParser().createSubComponents(frag, this); + } + }, + + // method over-ride + buildRendering: function(/*Object*/ args, /*Object*/ frag){ + // summary: + // Construct the UI for this widget, generally from a + // template. This can be over-ridden for custom UI creation to + // to side-step the template system. This is an + // implementation of the stub function defined in + // dojo.widget.Widget. + + // DOM widgets construct themselves from a template + var ts = dojo.widget._templateCache[this.widgetType]; + + // Handle style for this widget here, as even if templatePath + // is not set, style specified by templateCssString or templateCssPath + // should be applied. templateCssString has higher priority + // than templateCssPath + 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"]) ) + ) + ) + ){ + // if it looks like we can build the thing from a template, do it! + this.buildFromTemplate(args, frag); + }else{ + // otherwise, assign the DOM node that was the source of the widget + // parsing to be the root node + this.domNode = this.getFragNodeRef(frag); + } + this.fillInTemplate(args, frag); // this is where individual widgets + // will handle population of data + // from properties, remote data + // sets, etc. + }, + + buildFromTemplate: function(/*Object*/ args, /*Object*/ frag){ + // summary: + // Called by buildRendering, creates the actual UI in a DomWidget. + + // var start = new Date(); + // copy template properties if they're already set in the templates object + // dojo.debug("buildFromTemplate:", this); + var avoidCache = false; + if(args["templatepath"]){ +// avoidCache = true; + 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 = new String(this.templateString); + var tstr = this.templateString; + // attempt to clone a template node, if there is one + if((!this.templateNode)&&(this.templateString)){ + matches = this.templateString.match(/\$\{([^\}]+)\}/g); + if(matches) { + // if we do property replacement, don't create a templateNode + // to clone from. + var hash = this.strings || {}; + // FIXME: should this hash of default replacements be cached in + // templateString? + for(var key in dojo.widget.defaultStrings) { + if(dojo.lang.isUndefined(hash[key])) { + hash[key] = dojo.widget.defaultStrings[key]; + } + } + // FIXME: this is a lot of string munging. Can we make it faster? + 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); + // Safer substitution, see heading "Attribute values" in + // http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2 + while (value.indexOf("\"") > -1) { + value=value.replace("\"","""); + } + tstr = tstr.replace(matches[i], value); + } + } + }else{ + // otherwise, we are required to instantiate a copy of the template + // string if one is provided. + + // FIXME: need to be able to distinguish here what should be done + // or provide a generic interface across all DOM implementations + // FIMXE: this breaks if the template has whitespace as its first + // characters + // node = this.createNodesFromText(this.templateString, true); + // this.templateNode = node[0].cloneNode(true); // we're optimistic here + 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]; + } + + // recurse through the node, looking for, and attaching to, our + // attachment points which should be defined on the template node. + + this.domNode = node; + // dojo.profile.start("attachTemplateNodes"); + this.attachTemplateNodes(); + // dojo.profile.end("attachTemplateNodes"); + + // relocate source contents to templated container node + // this.containerNode must be able to receive children, or exceptions will be thrown + if (this.isContainer && this.containerNode){ + var src = this.getFragNodeRef(frag); + if (src){ + dojo.dom.moveChildren(src, this.containerNode); + } + } + }, + + attachTemplateNodes: function(baseNode, targetObj){ + // summary: + // hooks up event handlers and property/node linkages. Calls + // dojo.widget.attachTemplateNodes to do all the hard work. + // baseNode: DomNode + // defaults to "this.domNode" + // targetObj: Widget + // defaults to "this" + if(!baseNode){ baseNode = this.domNode; } + if(!targetObj){ targetObj = this; } + return dojo.widget.attachTemplateNodes(baseNode, targetObj, + dojo.widget.getDojoEventsFromStr(this.templateString)); + }, + + fillInTemplate: function(){ + // summary: + // stub function! sub-classes may use as a default UI + // initializer function. The UI rendering will be available by + // the time this is called from buildRendering. If + // buildRendering is over-ridden, this function may not be + // fired! + + // dojo.unimplemented("dojo.widget.DomWidget.fillInTemplate"); + }, + + // method over-ride + destroyRendering: function(){ + // summary: UI destructor. Destroy the dom nodes associated w/this widget. + try{ + dojo.dom.destroyNode(this.domNode); + delete this.domNode; + }catch(e){ /* squelch! */ } + if(this._sourceNodeRef){ + try{ + dojo.dom.destroyNode(this._sourceNodeRef); + }catch(e){ /* squelch! */ } + } + }, + + createNodesFromText: function(){ + // summary + // Attempts to create a set of nodes based on the structure of the passed text. + // Implemented in HtmlWidget and SvgWidget. + dojo.unimplemented("dojo.widget.DomWidget.createNodesFromText"); + } + } +); + +dojo.provide("dojo.html.util"); + + +dojo.html.getElementWindow = function(/* HTMLElement */element){ + // summary + // Get the window object where the element is placed in. + return dojo.html.getDocumentWindow( element.ownerDocument ); // Window +} + +dojo.html.getDocumentWindow = function(doc){ + // summary + // Get window object associated with document doc + + // With Safari, there is not wa to retrieve the window from the document, so we must fix it. + if(dojo.render.html.safari && !doc._parentWindow){ + /* + This is a Safari specific function that fix the reference to the parent + window from the document object. + */ + + var fix=function(win){ + win.document._parentWindow=win; + for(var i=0; i + // If you wanted to insert a node into a DOM tree based on the mouse + // position you might use the following code: + //
+	//	if (gravity(node, e) & gravity.NORTH) { [insert before]; }
+	//	else { [insert after]; }
+	//	
+ // + // @param node The node + // @param e The event containing the mouse coordinates + // @return The directions, NORTH or SOUTH and EAST or WEST. These + // are properties of the function. + node = dojo.byId(node); + var mouse = dojo.html.getCursorPosition(e); + + with (dojo.html) { + var absolute = getAbsolutePosition(node, true); + var bb = getBorderBox(node); + var nodecenterx = absolute.x + (bb.width / 2); + var nodecentery = absolute.y + (bb.height / 2); + } + + with (dojo.html.gravity) { + return ((mouse.x < nodecenterx ? WEST : EAST) | (mouse.y < nodecentery ? NORTH : SOUTH)); // integer + } +} + +dojo.html.gravity.NORTH = 1; +dojo.html.gravity.SOUTH = 1 << 1; +dojo.html.gravity.EAST = 1 << 2; +dojo.html.gravity.WEST = 1 << 3; + +dojo.html.overElement = function(/* HTMLElement */element, /* DOMEvent */e){ + // summary + // Returns whether the mouse is over the passed element. + // Element must be display:block (ie, not a ) + element = dojo.byId(element); + var mouse = dojo.html.getCursorPosition(e); + var bb = dojo.html.getBorderBox(element); + var absolute = dojo.html.getAbsolutePosition(element, true, dojo.html.boxSizing.BORDER_BOX); + var top = absolute.y; + var bottom = top + bb.height; + var left = absolute.x; + var right = left + bb.width; + + return (mouse.x >= left + && mouse.x <= right + && mouse.y >= top + && mouse.y <= bottom + ); // boolean +} + +dojo.html.renderedTextContent = function(/* HTMLElement */node){ + // summary + // Attempts to return the text as it would be rendered, with the line breaks + // sorted out nicely. Unfinished. + node = dojo.byId(node); + var result = ""; + if (node == null) { return result; } + for (var i = 0; i < node.childNodes.length; i++) { + switch (node.childNodes[i].nodeType) { + case 1: // ELEMENT_NODE + case 5: // ENTITY_REFERENCE_NODE + var display = "unknown"; + try { + display = dojo.html.getStyle(node.childNodes[i], "display"); + } catch(E) {} + switch (display) { + case "block": case "list-item": case "run-in": + case "table": case "table-row-group": case "table-header-group": + case "table-footer-group": case "table-row": case "table-column-group": + case "table-column": case "table-cell": case "table-caption": + // TODO: this shouldn't insert double spaces on aligning blocks + result += "\n"; + result += dojo.html.renderedTextContent(node.childNodes[i]); + result += "\n"; + break; + + case "none": break; + + default: + if(node.childNodes[i].tagName && node.childNodes[i].tagName.toLowerCase() == "br") { + result += "\n"; + } else { + result += dojo.html.renderedTextContent(node.childNodes[i]); + } + break; + } + break; + case 3: // TEXT_NODE + case 2: // ATTRIBUTE_NODE + case 4: // CDATA_SECTION_NODE + var text = node.childNodes[i].nodeValue; + var textTransform = "unknown"; + try { + textTransform = dojo.html.getStyle(node, "text-transform"); + } catch(E) {} + switch (textTransform){ + case "capitalize": + var words = text.split(' '); + for(var i=0; i]/i).test(txt.replace(/^\s+/))) { + txt = "" + txt + "
"; + tableType = "cell"; + } else if((/^]/i).test(txt.replace(/^\s+/))) { + txt = "" + txt + "
"; + tableType = "row"; + } else if((/^<(thead|tbody|tfoot)[\s\r\n>]/i).test(txt.replace(/^\s+/))) { + txt = "" + txt + "
"; + tableType = "section"; + } + tn.innerHTML = txt; + if(tn["normalize"]){ + tn.normalize(); + } + + var parent = null; + switch(tableType) { + case "cell": + parent = tn.getElementsByTagName("tr")[0]; + break; + case "row": + parent = tn.getElementsByTagName("tbody")[0]; + break; + case "section": + parent = tn.getElementsByTagName("table")[0]; + break; + default: + parent = tn; + break; + } + + /* this doesn't make much sense, I'm assuming it just meant trim() so wrap was replaced with trim + if(wrap){ + var ret = []; + // start hack + var fc = tn.firstChild; + ret[0] = ((fc.nodeValue == " ")||(fc.nodeValue == "\t")) ? fc.nextSibling : fc; + // end hack + // tn.style.display = "none"; + dojo.body().removeChild(tn); + return ret; + } + */ + var nodes = []; + for(var x=0; x view.width) { + x = view.width - w; + match = false; + } else { + x = tryX; + } + x = Math.max(padding[0], x) + scroll.x; + + var y = tryY + h; + if(y > view.height) { + y = view.height - h; + match = false; + } else { + y = tryY; + } + y = Math.max(padding[1], y) + scroll.y; + + if(match){ //perfect match, return now + bestx = x; + besty = y; + bestDistance = 0; + bestCorner = corner; + break; + }else{ + //not perfect, find out whether it is better than the saved one + var dist = Math.pow(x-tryX-scroll.x,2)+Math.pow(y-tryY-scroll.y,2); + if(bestDistance > dist){ + bestDistance = dist; + bestx = x; + besty = y; + bestCorner = corner; + } + } + } + + if(!tryOnly){ + node.style.left = bestx + "px"; + node.style.top = besty + "px"; + } + + return { left: bestx, top: besty, x: bestx, y: besty, dist: bestDistance, corner: bestCorner}; // object +} + +dojo.html.placeOnScreenPoint = function(node, desiredX, desiredY, padding, hasScroll) { + dojo.deprecated("dojo.html.placeOnScreenPoint", "use dojo.html.placeOnScreen() instead", "0.5"); + return dojo.html.placeOnScreen(node, desiredX, desiredY, padding, hasScroll, ['TL', 'TR', 'BL', 'BR']); +} + +dojo.html.placeOnScreenAroundElement = function( + /* HTMLElement */node, + /* HTMLElement */aroundNode, + /* integer */padding, + /* string? */aroundType, + /* string? */aroundCorners, + /* boolean? */tryOnly +){ + // summary + // Like placeOnScreen, except it accepts aroundNode instead of x,y + // and attempts to place node around it. aroundType (see + // dojo.html.boxSizing in html/layout.js) determines which box of the + // aroundNode should be used to calculate the outer box. + // aroundCorners specify Which corner of aroundNode should be + // used to place the node => which corner(s) of node to use (see the + // corners parameter in dojo.html.placeOnScreen) + // aroundCorners: {'TL': 'BL', 'BL': 'TL'} + + var best, bestDistance=Infinity; + aroundNode = dojo.byId(aroundNode); + var oldDisplay = aroundNode.style.display; + aroundNode.style.display=""; + var mb = dojo.html.getElementBox(aroundNode, aroundType); + var aroundNodeW = mb.width; + var aroundNodeH = mb.height; + var aroundNodePos = dojo.html.getAbsolutePosition(aroundNode, true, aroundType); + aroundNode.style.display=oldDisplay; + + for(var nodeCorner in aroundCorners){ + var pos, desiredX, desiredY; + var corners = aroundCorners[nodeCorner]; + + desiredX = aroundNodePos.x + (nodeCorner.charAt(1)=='L' ? 0 : aroundNodeW); + desiredY = aroundNodePos.y + (nodeCorner.charAt(0)=='T' ? 0 : aroundNodeH); + + pos = dojo.html.placeOnScreen(node, desiredX, desiredY, padding, true, corners, true); + if(pos.dist == 0){ + best = pos; + break; + }else{ + //not perfect, find out whether it is better than the saved one + if(bestDistance > pos.dist){ + bestDistance = pos.dist; + best = pos; + } + } + } + + if(!tryOnly){ + node.style.left = best.left + "px"; + node.style.top = best.top + "px"; + } + return best; // object +} + +dojo.html.scrollIntoView = function(/* HTMLElement */node){ + // summary + // Scroll the passed node into view, if it is not. + if(!node){ return; } + + // don't rely on that node.scrollIntoView works just because the function is there + // it doesnt work in Konqueror or Opera even though the function is there and probably + // not safari either + // dont like browser sniffs implementations but sometimes you have to use it + if(dojo.render.html.ie){ + //only call scrollIntoView if there is a scrollbar for this menu, + //otherwise, scrollIntoView will scroll the window scrollbar + if(dojo.html.getBorderBox(node.parentNode).height <= node.parentNode.scrollHeight){ + node.scrollIntoView(false); + } + }else if(dojo.render.html.mozilla){ + // IE, mozilla + node.scrollIntoView(false); + }else{ + var parent = node.parentNode; + var parentBottom = parent.scrollTop + dojo.html.getBorderBox(parent).height; + var nodeBottom = node.offsetTop + dojo.html.getMarginBox(node).height; + if(parentBottom < nodeBottom){ + parent.scrollTop += (nodeBottom - parentBottom); + }else if(parent.scrollTop > node.offsetTop){ + parent.scrollTop -= (parent.scrollTop - node.offsetTop); + } + } +} + +dojo.provide("dojo.lfx.toggle"); + + +dojo.lfx.toggle.plain = { + show: function(node, duration, easing, callback){ + dojo.html.show(node); + if(dojo.lang.isFunction(callback)){ callback(); } + }, + + hide: function(node, duration, easing, callback){ + dojo.html.hide(node); + if(dojo.lang.isFunction(callback)){ callback(); } + } +} + +dojo.lfx.toggle.fade = { + show: function(node, duration, easing, callback){ + dojo.lfx.fadeShow(node, duration, easing, callback).play(); + }, + + hide: function(node, duration, easing, callback){ + dojo.lfx.fadeHide(node, duration, easing, callback).play(); + } +} + +dojo.lfx.toggle.wipe = { + show: function(node, duration, easing, callback){ + dojo.lfx.wipeIn(node, duration, easing, callback).play(); + }, + + hide: function(node, duration, easing, callback){ + dojo.lfx.wipeOut(node, duration, easing, callback).play(); + } +} + +dojo.lfx.toggle.explode = { + show: function(node, duration, easing, callback, explodeSrc){ + dojo.lfx.explode(explodeSrc||{x:0,y:0,width:0,height:0}, node, duration, easing, callback).play(); + }, + + hide: function(node, duration, easing, callback, explodeSrc){ + dojo.lfx.implode(node, explodeSrc||{x:0,y:0,width:0,height:0}, duration, easing, callback).play(); + } +} + +dojo.provide("dojo.widget.HtmlWidget"); + + + + + + + + +dojo.declare("dojo.widget.HtmlWidget", dojo.widget.DomWidget, { + // summary + // Base class for all browser based widgets, or at least "html" widgets. + // The meaning of "html" has become unclear; in practice, all widgets derive from this class. + + // templateCssPath: String + // Path to CSS file for this widget + templateCssPath: null, + + // templatePath: String + // Path to template (HTML file) for this widget + templatePath: null, + + // lang: String + // Language to display this widget in (like en-us). + // Defaults to brower's specified preferred language (typically the language of the OS) + lang: "", + + // toggle: String + // Controls animation effect for when show() and hide() (or toggle()) are called. + // Possible values: "plain", "wipe", "fade", "explode" + toggle: "plain", + + // toggleDuration: Integer + // Number of milliseconds for toggle animation effect to complete + toggleDuration: 150, + + initialize: function(args, frag){ + // summary: called after the widget is rendered; most subclasses won't override or call this function + }, + + postMixInProperties: function(args, frag){ + if(this.lang === ""){this.lang = null;} + // now that we know the setting for toggle, get toggle object + // (default to plain toggler if user specified toggler not present) + this.toggleObj = + dojo.lfx.toggle[this.toggle.toLowerCase()] || dojo.lfx.toggle.plain; + }, + + createNodesFromText: function(txt, wrap){ + return dojo.html.createNodesFromText(txt, wrap); + }, + + destroyRendering: function(finalize){ + try{ + if(this.bgIframe){ + this.bgIframe.remove(); + delete this.bgIframe; + } + if(!finalize && this.domNode){ + dojo.event.browser.clean(this.domNode); + } + dojo.widget.HtmlWidget.superclass.destroyRendering.call(this); + }catch(e){ /* squelch! */ } + }, + + ///////////////////////////////////////////////////////// + // Displaying/hiding the widget + ///////////////////////////////////////////////////////// + isShowing: function(){ + // summary + // Tests whether widget is set to show-mode or hide-mode (see show() and + // hide() methods) + // + // This function is poorly named. Even if widget is in show-mode, + // if it's inside a container that's hidden + // (either a container widget, or just a domnode with display:none), + // then it won't be displayed + return dojo.html.isShowing(this.domNode); // Boolean + }, + + toggleShowing: function(){ + // summary: show or hide the widget, to switch it's state + if(this.isShowing()){ + this.hide(); + }else{ + this.show(); + } + }, + + show: function(){ + // summary: show the widget + if(this.isShowing()){ return; } + this.animationInProgress=true; + this.toggleObj.show(this.domNode, this.toggleDuration, null, + dojo.lang.hitch(this, this.onShow), this.explodeSrc); + }, + + onShow: function(){ + // summary: called after the show() animation has completed + this.animationInProgress=false; + this.checkSize(); + }, + + hide: function(){ + // summary: hide the widget (ending up with display:none) + if(!this.isShowing()){ return; } + this.animationInProgress = true; + this.toggleObj.hide(this.domNode, this.toggleDuration, null, + dojo.lang.hitch(this, this.onHide), this.explodeSrc); + }, + + onHide: function(){ + // summary: called after the hide() animation has completed + this.animationInProgress=false; + }, + + ////////////////////////////////////////////////////////////////////////////// + // Sizing related methods + // If the parent changes size then for each child it should call either + // - resizeTo(): size the child explicitly + // - or checkSize(): notify the child the the parent has changed size + ////////////////////////////////////////////////////////////////////////////// + + _isResized: function(w, h){ + // summary + // Test if my size has changed. + // If width & height are specified then that's my new size; otherwise, + // query outerWidth/outerHeight of my domNode + + // If I'm not being displayed then disregard (show() must + // check if the size has changed) + if(!this.isShowing()){ return false; } + + // If my parent has been resized and I have style="height: 100%" + // or something similar then my size has changed too. + var wh = dojo.html.getMarginBox(this.domNode); + var width=w||wh.width; + var height=h||wh.height; + if(this.width == width && this.height == height){ return false; } + + this.width=width; + this.height=height; + return true; + }, + + checkSize: function(){ + // summary + // Called when my parent has changed size, but my parent won't call resizeTo(). + // This is useful if my size is height:100% or something similar. + // Also called whenever I am shown, because the first time I am shown I may need + // to do size calculations. + if(!this._isResized()){ return; } + this.onResized(); + }, + + resizeTo: function(w, h){ + // summary: explicitly set this widget's size (in pixels). + dojo.html.setMarginBox(this.domNode, { width: w, height: h }); + + // can't do sizing if widget is hidden because referencing node.offsetWidth/node.offsetHeight returns 0. + // do sizing on show() instead. + if(this.isShowing()){ + this.onResized(); + } + }, + + resizeSoon: function(){ + // summary + // schedule onResized() to be called soon, after browser has had + // a little more time to calculate the sizes + if(this.isShowing()){ + dojo.lang.setTimeout(this, this.onResized, 0); + } + }, + + onResized: function(){ + // summary + // Called when my size has changed. + // Must notify children if their size has (possibly) changed. + dojo.lang.forEach(this.children, function(child){ if(child.checkSize){child.checkSize();} }); + } +}); + +dojo.kwCompoundRequire({ + common: ["dojo.xml.Parse", + "dojo.widget.Widget", + "dojo.widget.Parse", + "dojo.widget.Manager"], + browser: ["dojo.widget.DomWidget", + "dojo.widget.HtmlWidget"], + dashboard: ["dojo.widget.DomWidget", + "dojo.widget.HtmlWidget"], + svg: ["dojo.widget.SvgWidget"], + rhino: ["dojo.widget.SwtWidget"] +}); +dojo.provide("dojo.widget.*"); + +dojo.kwCompoundRequire({ + common: [ "dojo.html.common", + "dojo.html.style" ] +}); +dojo.provide("dojo.html.*"); + + +dojo.provide("dojo.html.selection"); + + + + +/** + * type of selection +**/ +dojo.html.selectionType = { + NONE : 0, //selection is empty + TEXT : 1, //selection contains text (may also contains CONTROL objects) + CONTROL : 2 //only one element is selected (such as img, table etc) +}; + +dojo.html.clearSelection = function(){ + // summary: deselect the current selection to make it empty + var _window = dojo.global(); + var _document = dojo.doc(); + try{ + if(_window["getSelection"]){ + if(dojo.render.html.safari){ + // pulled from WebCore/ecma/kjs_window.cpp, line 2536 + _window.getSelection().collapse(); + }else{ + _window.getSelection().removeAllRanges(); + } + }else if(_document.selection){ + if(_document.selection.empty){ + _document.selection.empty(); + }else if(_document.selection.clear){ + _document.selection.clear(); + } + } + return true; + }catch(e){ + dojo.debug(e); + return false; + } +} + +dojo.html.disableSelection = function(/*DomNode*/element){ + // summary: disable selection on a node + element = dojo.byId(element)||dojo.body(); + var h = dojo.render.html; + + if(h.mozilla){ + element.style.MozUserSelect = "none"; + }else if(h.safari){ + element.style.KhtmlUserSelect = "none"; + }else if(h.ie){ + element.unselectable = "on"; + }else{ + return false; + } + return true; +} + +dojo.html.enableSelection = function(/*DomNode*/element){ + // summary: enable selection on a node + element = dojo.byId(element)||dojo.body(); + + var h = dojo.render.html; + if(h.mozilla){ + element.style.MozUserSelect = ""; + }else if(h.safari){ + element.style.KhtmlUserSelect = ""; + }else if(h.ie){ + element.unselectable = "off"; + }else{ + return false; + } + return true; +} + +dojo.html.selectElement = function(/*DomNode*/element){ + dojo.deprecated("dojo.html.selectElement", "replaced by dojo.html.selection.selectElementChildren", 0.5); +} + +dojo.html.selectInputText = function(/*DomNode*/element){ + // summary: select all the text in an input element + var _window = dojo.global(); + var _document = dojo.doc(); + element = dojo.byId(element); + if(_document["selection"] && dojo.body()["createTextRange"]){ // IE + var range = element.createTextRange(); + range.moveStart("character", 0); + range.moveEnd("character", element.value.length); + range.select(); + }else if(_window["getSelection"]){ + var selection = _window.getSelection(); + // FIXME: does this work on Safari? + element.setSelectionRange(0, element.value.length); + } + element.focus(); +} + + +dojo.html.isSelectionCollapsed = function(){ + dojo.deprecated("dojo.html.isSelectionCollapsed", "replaced by dojo.html.selection.isCollapsed", 0.5); + return dojo.html.selection.isCollapsed(); +} + +dojo.lang.mixin(dojo.html.selection, { + getType: function() { + // summary: Get the selection type (like document.select.type in IE). + if(dojo.doc()["selection"]){ //IE + return dojo.html.selectionType[dojo.doc().selection.type.toUpperCase()]; + }else{ + var stype = dojo.html.selectionType.TEXT; + + // Check if the actual selection is a CONTROL (IMG, TABLE, HR, etc...). + var oSel; + try {oSel = dojo.global().getSelection();} + catch (e) {} + + if(oSel && oSel.rangeCount==1){ + var oRange = oSel.getRangeAt(0); + if (oRange.startContainer == oRange.endContainer && (oRange.endOffset - oRange.startOffset) == 1 + && oRange.startContainer.nodeType != dojo.dom.TEXT_NODE) { + stype = dojo.html.selectionType.CONTROL; + } + } + return stype; + } + }, + isCollapsed: function() { + // summary: return whether the current selection is empty + var _window = dojo.global(); + var _document = dojo.doc(); + if(_document["selection"]){ // IE + return _document.selection.createRange().text == ""; + }else if(_window["getSelection"]){ + var selection = _window.getSelection(); + if(dojo.lang.isString(selection)){ // Safari + return selection == ""; + }else{ // Mozilla/W3 + return selection.isCollapsed || selection.toString() == ""; + } + } + }, + getSelectedElement: function() { + // summary: + // Retrieves the selected element (if any), just in the case that a single + // element (object like and image or a table) is selected. + if ( dojo.html.selection.getType() == dojo.html.selectionType.CONTROL ){ + if(dojo.doc()["selection"]){ //IE + var range = dojo.doc().selection.createRange(); + + if ( range && range.item ){ + return dojo.doc().selection.createRange().item(0); + } + }else{ + var selection = dojo.global().getSelection(); + return selection.anchorNode.childNodes[ selection.anchorOffset ]; + } + } + }, + getParentElement: function() { + // summary: + // Get the parent element of the current selection + if(dojo.html.selection.getType() == dojo.html.selectionType.CONTROL){ + var p = dojo.html.selection.getSelectedElement(); + if(p){ return p.parentNode; } + }else{ + if(dojo.doc()["selection"]){ //IE + return dojo.doc().selection.createRange().parentElement(); + }else{ + var selection = dojo.global().getSelection(); + if(selection){ + var node = selection.anchorNode; + + while ( node && node.nodeType != dojo.dom.ELEMENT_NODE ){ + node = node.parentNode; + } + + return node; + } + } + } + }, + getSelectedText: function(){ + // summary: + // Return the text (no html tags) included in the current selection or null if no text is selected + if(dojo.doc()["selection"]){ //IE + if(dojo.html.selection.getType() == dojo.html.selectionType.CONTROL){ + return null; + } + return dojo.doc().selection.createRange().text; + }else{ + var selection = dojo.global().getSelection(); + if(selection){ + return selection.toString(); + } + } + }, + getSelectedHtml: function(){ + // summary: + // Return the html of the current selection or null if unavailable + if(dojo.doc()["selection"]){ //IE + if(dojo.html.selection.getType() == dojo.html.selectionType.CONTROL){ + return null; + } + return dojo.doc().selection.createRange().htmlText; + }else{ + var selection = dojo.global().getSelection(); + if(selection && selection.rangeCount){ + var frag = selection.getRangeAt(0).cloneContents(); + var div = document.createElement("div"); + div.appendChild(frag); + return div.innerHTML; + } + return null; + } + }, + hasAncestorElement: function(/*String*/tagName /* ... */){ + // summary: + // Check whether current selection has a parent element which is of type tagName (or one of the other specified tagName) + return (dojo.html.selection.getAncestorElement.apply(this, arguments) != null); + }, + getAncestorElement: function(/*String*/tagName /* ... */){ + // summary: + // Return the parent element of the current selection which is of type tagName (or one of the other specified tagName) + var node = dojo.html.selection.getSelectedElement() || dojo.html.selection.getParentElement(); + while(node /*&& node.tagName.toLowerCase() != 'body'*/){ + if(dojo.html.selection.isTag(node, arguments).length>0){ + return node; + } + node = node.parentNode; + } + return null; + }, + //modified from dojo.html.isTag to take an array as second parameter + isTag: function(/*DomNode*/node, /*Array*/tags) { + if(node && node.tagName) { + for (var i=0; i. + + Why do we want this? JavaScript has no threads, and even if it did, + threads are hard. Deferreds are a way of abstracting non-blocking + events, such as the final response to an XMLHttpRequest. + + The sequence of callbacks is internally represented as a list + of 2-tuples containing the callback/errback pair. For example, + the following call sequence:: + + var d = new Deferred(); + d.addCallback(myCallback); + d.addErrback(myErrback); + d.addBoth(myBoth); + d.addCallbacks(myCallback, myErrback); + + is translated into a Deferred with the following internal + representation:: + + [ + [myCallback, null], + [null, myErrback], + [myBoth, myBoth], + [myCallback, myErrback] + ] + + The Deferred also keeps track of its current status (fired). + Its status may be one of three things: + + -1: no value yet (initial condition) + 0: success + 1: error + + A Deferred will be in the error state if one of the following + three conditions are met: + + 1. The result given to callback or errback is "instanceof" Error + 2. The previous callback or errback raised an exception while + executing + 3. The previous callback or errback returned a value "instanceof" + Error + + Otherwise, the Deferred will be in the success state. The state of + the Deferred determines the next element in the callback sequence to + run. + + When a callback or errback occurs with the example deferred chain, + something equivalent to the following will happen (imagine that + exceptions are caught and returned):: + + // d.callback(result) or d.errback(result) + if(!(result instanceof Error)){ + result = myCallback(result); + } + if(result instanceof Error){ + result = myErrback(result); + } + result = myBoth(result); + if(result instanceof Error){ + result = myErrback(result); + }else{ + result = myCallback(result); + } + + The result is then stored away in case another step is added to the + callback sequence. Since the Deferred already has a value available, + any new callbacks added will be called immediately. + + There are two other "advanced" details about this implementation that + are useful: + + Callbacks are allowed to return Deferred instances themselves, so you + can build complicated sequences of events with ease. + + The creator of the Deferred may specify a canceller. The canceller + is a function that will be called if Deferred.cancel is called before + the Deferred fires. You can use this to implement clean aborting of + an XMLHttpRequest, etc. Note that cancel will fire the deferred with + a CancelledError (unless your canceller returns another kind of + error), so the errbacks should be prepared to handle that error for + cancellable Deferreds. + + */ + + this.chain = []; + this.id = this._nextId(); + this.fired = -1; + this.paused = 0; + this.results = [null, null]; + this.canceller = canceller; + this.silentlyCancelled = false; +}; + +dojo.lang.extend(dojo.Deferred, { + getFunctionFromArgs: function(){ + var a = arguments; + if((a[0])&&(!a[1])){ + if(dojo.lang.isFunction(a[0])){ + return a[0]; + }else if(dojo.lang.isString(a[0])){ + return dj_global[a[0]]; + } + }else if((a[0])&&(a[1])){ + return dojo.lang.hitch(a[0], a[1]); + } + return null; + }, + + makeCalled: function() { + var deferred = new dojo.Deferred(); + deferred.callback(); + return deferred; + }, + + 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: dojo.lang.forward("repr"), + + _nextId: (function(){ + var n = 1; + return function(){ return n++; }; + })(), + + cancel: function(){ + // summary: Cancels a Deferred that has not yet received a value, or is + // waiting on another Deferred as its value. + // description: + // If a canceller is defined, the canceller is called. If the + // canceller did not return an error, or there was no canceller, + // then the errback chain is started with CancelledError. + if(this.fired == -1){ + if (this.canceller){ + this.canceller(this); + }else{ + this.silentlyCancelled = true; + } + if(this.fired == -1){ + this.errback(new Error(this.repr())); + } + }else if( (this.fired == 0)&& + (this.results[0] instanceof dojo.Deferred)){ + this.results[0].cancel(); + } + }, + + + _pause: function(){ + // summary: Used internally to signal that it's waiting on another Deferred + this.paused++; + }, + + _unpause: function(){ + // summary: 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){ + // summary: 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){ + dojo.raise("already called!"); + } + this.silentlyCancelled = false; + return; + } + }, + + callback: function(res){ + // summary: Begin the callback sequence with a non-error value. + + /* + callback or errback should only be called once on a given + Deferred. + */ + this._check(); + this._resback(res); + }, + + errback: function(res){ + // summary: Begin the callback sequence with an error result. + this._check(); + if(!(res instanceof Error)){ + res = new Error(res); + } + this._resback(res); + }, + + addBoth: function(cb, cbfn){ + /* summary + Add the same function as both a callback and an errback as the + next element on the callback sequence. This is useful for code + that you want to guarantee to run, e.g. a finalizer. + */ + var enclosed = this.getFunctionFromArgs(cb, cbfn); + if(arguments.length > 2){ + enclosed = dojo.lang.curryArguments(null, enclosed, arguments, 2); + } + return this.addCallbacks(enclosed, enclosed); + }, + + addCallback: function(cb, cbfn){ + // summary: Add a single callback to the end of the callback sequence. + var enclosed = this.getFunctionFromArgs(cb, cbfn); + if(arguments.length > 2){ + enclosed = dojo.lang.curryArguments(null, enclosed, arguments, 2); + } + return this.addCallbacks(enclosed, null); + }, + + addErrback: function(cb, cbfn){ + // summary: Add a single callback to the end of the callback sequence. + var enclosed = this.getFunctionFromArgs(cb, cbfn); + if(arguments.length > 2){ + enclosed = dojo.lang.curryArguments(null, enclosed, arguments, 2); + } + return this.addCallbacks(null, enclosed); + return this.addCallbacks(null, cbfn); + }, + + addCallbacks: function (cb, eb) { + // summary: Add separate callback and errback to the end of the callback + // sequence. + this.chain.push([cb, eb]) + if (this.fired >= 0) { + this._fire(); + } + return this; + }, + + _fire: function(){ + // summary: 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 dojo.Deferred) { + cb = function(res){ + self._continue(res); + } + this._pause(); + } + }catch(err){ + fired = 1; + 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); + } + } +}); + + /* -*- tab-width: 4 -*- */ +dojo.provide("dojo.widget.RichText"); + + + + + + + + + + +// used to save content +// but do not try doing document.write if we are using xd loading. +// document.write will only work if RichText.js is included in the dojo.js +// file. If it is included in dojo.js and you want to allow rich text saving +// for back/forward actions, then set djConfig.allowXdRichTextSave = true. +if(!djConfig["useXDomain"] || djConfig["allowXdRichTextSave"]){ + if(dojo.hostenv.post_load_){ + (function(){ + var savetextarea = dojo.doc().createElement('textarea'); + savetextarea.id = "dojo.widget.RichText.savedContent"; + savetextarea.style = "display:none;position:absolute;top:-100px;left:-100px;height:3px;width:3px;overflow:hidden;"; + dojo.body().appendChild(savetextarea); + })(); + }else{ + //dojo.body() is not available before onLoad is fired + try { + dojo.doc().write(''); + }catch(e){ } + } +} + +dojo.widget.defineWidget( + "dojo.widget.RichText", + dojo.widget.HtmlWidget, + function(){ + // summary: + // dojo.widget.RichText is the core of the WYSIWYG editor in dojo, which + // provides the basic editing features. It also encapsulates the differences + // of different js engines for various browsers + + // contentPreFilters: Array + // pre content filter function register array + this.contentPreFilters = []; + + // contentPostFilters: Array + // post content filter function register array + this.contentPostFilters = []; + + // contentDomPreFilters: Array + // pre content dom filter function register array + this.contentDomPreFilters = []; + + // contentDomPostFilters: Array + // post content dom filter function register array + this.contentDomPostFilters = []; + + // editingAreaStyleSheets: Array + // array to store all the stylesheets applied to the editing area + this.editingAreaStyleSheets=[]; + + if(dojo.render.html.moz){ + this.contentPreFilters.push(this._fixContentForMoz); + } + + this._keyHandlers = {}; + + if(dojo.Deferred){ + this.onLoadDeferred = new dojo.Deferred(); + } + }, + { + // inheritWidth: Boolean + // whether to inherit the parent's width or simply use 100% + inheritWidth: false, + + // focusOnLoad: Boolean + // whether focusing into this instance of richtext when page onload + focusOnLoad: false, + + // saveName: String + // If a save name is specified the content is saved and restored when the user + // leave this page can come back, or if the editor is not properly closed after + // editing has started. + saveName: "", + + // styleSheets: String + // semicolon (";") separated list of css files for the editing area + styleSheets: "", + + // _content: String + // temporary content storage + _content: "", + + // height: String + // set height to fix the editor at a specific height, with scrolling + height: "", + + // minHeight: String + // The minimum height that the editor should have + minHeight: "1em", + + // isClosed: Boolean + isClosed: true, + + // isLoaded: Boolean + isLoaded: false, + + // useActiveX: Boolean + // whether to use the active-x object in IE + useActiveX: false, + + // relativeImageUrls: Boolean + // whether to use relative URLs for images - if this is enabled + // images will be given absolute URLs when inside the editor but + // will be changed to use relative URLs (to the current page) on save + relativeImageUrls: false, + + // _SEPARATOR: String + // used to concat contents from multiple textareas into a single string + _SEPARATOR: "@@**%%__RICHTEXTBOUNDRY__%%**@@", + + // onLoadDeferred: dojo.Deferred + // deferred that can be used to connect to the onLoad function. This + // will only be set if dojo.Deferred is required + onLoadDeferred: null, + + /* Init + *******/ + + fillInTemplate: function(){ + // summary: see dojo.widget.DomWidget + dojo.event.topic.publish("dojo.widget.RichText::init", this); + this.open(); + + + // backwards compatibility, needs to be removed + dojo.event.connect(this, "onKeyPressed", this, "afterKeyPress"); + dojo.event.connect(this, "onKeyPress", this, "keyPress"); + dojo.event.connect(this, "onKeyDown", this, "keyDown"); + dojo.event.connect(this, "onKeyUp", this, "keyUp"); + + this.setupDefaultShortcuts(); + }, + + setupDefaultShortcuts: function(){ + // summary: add some default key handlers + // description: + // Overwrite this to setup your own handlers. The default + // implementation does not use Editor2 commands, but directly + // executes the builtin commands within the underlying browser + // support. + var ctrl = this.KEY_CTRL; + var exec = function (cmd, arg) { + return arguments.length == 1 ? function () { this.execCommand(cmd); } : + function () { this.execCommand(cmd, arg); } + } + this.addKeyHandler("b", ctrl, exec("bold")); + this.addKeyHandler("i", ctrl, exec("italic")); + this.addKeyHandler("u", ctrl, exec("underline")); + this.addKeyHandler("a", ctrl, exec("selectall")); + this.addKeyHandler("s", ctrl, function () { this.save(true); }); + + this.addKeyHandler("1", ctrl, exec("formatblock", "h1")); + this.addKeyHandler("2", ctrl, exec("formatblock", "h2")); + this.addKeyHandler("3", ctrl, exec("formatblock", "h3")); + this.addKeyHandler("4", ctrl, exec("formatblock", "h4")); + + this.addKeyHandler("\\", ctrl, exec("insertunorderedlist")); + if(!dojo.render.html.ie){ + this.addKeyHandler("Z", ctrl, exec("redo")); + } + }, + + // events: Array + // events which should be connected to the underlying editing area + events: ["onBlur", "onFocus", "onKeyPress", "onKeyDown", "onKeyUp", "onClick"], + + /** + * Transforms the node referenced in this.domNode into a rich text editing + * node. This can result in the creation and replacement with an