]> git.wh0rd.org - tt-rss.git/blame - lib/dijit/DialogUnderlay.js
remove call-by-reference to comply with php 5.4
[tt-rss.git] / lib / dijit / DialogUnderlay.js
CommitLineData
2f01fe57 1/*
81bea17a 2 Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
2f01fe57
AD
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
5*/
6
7
81bea17a
AD
8if(!dojo._hasResource["dijit.DialogUnderlay"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
9dojo._hasResource["dijit.DialogUnderlay"] = true;
2f01fe57
AD
10dojo.provide("dijit.DialogUnderlay");
11dojo.require("dojo.window");
12dojo.require("dijit._Widget");
13dojo.require("dijit._Templated");
81bea17a
AD
14
15
16dojo.declare(
17 "dijit.DialogUnderlay",
18 [dijit._Widget, dijit._Templated],
19 {
20 // summary:
21 // The component that blocks the screen behind a `dijit.Dialog`
22 //
23 // description:
24 // A component used to block input behind a `dijit.Dialog`. Only a single
25 // instance of this widget is created by `dijit.Dialog`, and saved as
26 // a reference to be shared between all Dialogs as `dijit._underlay`
27 //
28 // The underlay itself can be styled based on and id:
29 // | #myDialog_underlay { background-color:red; }
30 //
31 // In the case of `dijit.Dialog`, this id is based on the id of the Dialog,
32 // suffixed with _underlay.
33
34 // Template has two divs; outer div is used for fade-in/fade-out, and also to hold background iframe.
35 // Inner div has opacity specified in CSS file.
36 templateString: "<div class='dijitDialogUnderlayWrapper'><div class='dijitDialogUnderlay' dojoAttachPoint='node'></div></div>",
37
38 // Parameters on creation or updatable later
39
40 // dialogId: String
41 // Id of the dialog.... DialogUnderlay's id is based on this id
42 dialogId: "",
43
44 // class: String
45 // This class name is used on the DialogUnderlay node, in addition to dijitDialogUnderlay
46 "class": "",
47
48 attributeMap: { id: "domNode" },
49
50 _setDialogIdAttr: function(id){
51 dojo.attr(this.node, "id", id + "_underlay");
52 this._set("dialogId", id);
53 },
54
55 _setClassAttr: function(clazz){
56 this.node.className = "dijitDialogUnderlay " + clazz;
57 this._set("class", clazz);
58 },
59
60 postCreate: function(){
61 // summary:
62 // Append the underlay to the body
63 dojo.body().appendChild(this.domNode);
64 },
65
66 layout: function(){
67 // summary:
68 // Sets the background to the size of the viewport
69 //
70 // description:
71 // Sets the background to the size of the viewport (rather than the size
72 // of the document) since we need to cover the whole browser window, even
73 // if the document is only a few lines long.
74 // tags:
75 // private
76
77 var is = this.node.style,
78 os = this.domNode.style;
79
80 // hide the background temporarily, so that the background itself isn't
81 // causing scrollbars to appear (might happen when user shrinks browser
82 // window and then we are called to resize)
83 os.display = "none";
84
85 // then resize and show
86 var viewport = dojo.window.getBox();
87 os.top = viewport.t + "px";
88 os.left = viewport.l + "px";
89 is.width = viewport.w + "px";
90 is.height = viewport.h + "px";
91 os.display = "block";
92 },
93
94 show: function(){
95 // summary:
96 // Show the dialog underlay
97 this.domNode.style.display = "block";
98 this.layout();
99 this.bgIframe = new dijit.BackgroundIframe(this.domNode);
100 },
101
102 hide: function(){
103 // summary:
104 // Hides the dialog underlay
105 this.bgIframe.destroy();
106 delete this.bgIframe;
107 this.domNode.style.display = "none";
108 }
109 }
110);
111
2f01fe57 112}