source: Dev/branches/rest-dojo-ui/client/dijit/_base/popup.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.6 KB
Line 
1define([
2        "dojo/dom-class", // domClass.contains
3        "../popup",
4        "../BackgroundIframe"   // just loading for back-compat, in case client code is referencing it
5], function(domClass, popup){
6
7// module:
8//              dijit/_base/popup
9// summary:
10//              Old module for popups, new code should use dijit/popup directly
11
12
13// Hack support for old API passing in node instead of a widget (to various methods)
14var origCreateWrapper = popup._createWrapper;
15popup._createWrapper = function(widget){
16        if(!widget.declaredClass){
17                // make fake widget to pass to new API
18                widget = {
19                        _popupWrapper: (widget.parentNode && domClass.contains(widget.parentNode, "dijitPopup")) ?
20                                widget.parentNode : null,
21                        domNode: widget,
22                        destroy: function(){}
23                };
24        }
25        return origCreateWrapper.call(this, widget);
26};
27
28// Support old format of orient parameter
29var origOpen = popup.open;
30popup.open = function(/*dijit.popup.__OpenArgs*/ args){
31        // Convert old hash structure (ex: {"BL": "TL", ...}) of orient to format compatible w/new popup.open() API.
32        // Don't do conversion for:
33        //              - null parameter (that means to use the default positioning)
34        //              - "R" or "L" strings used to indicate positioning for context menus (when there is no around node)
35        //              - new format, ex: ["below", "above"]
36        //              - return value from deprecated dijit.getPopupAroundAlignment() method,
37        //                      ex: ["below", "above"]
38        if(args.orient && typeof args.orient != "string" && !("length" in args.orient)){
39                var ary = [];
40                for(var key in args.orient){
41                        ary.push({aroundCorner: key, corner: args.orient[key]});
42                }
43                args.orient = ary;
44        }
45
46        return origOpen.call(this, args);
47};
48
49return popup;
50});
Note: See TracBrowser for help on using the repository browser.