aboutsummaryrefslogtreecommitdiff
path: root/js/components/ui/modalDialog/modal-dialog-manager.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-04-24 08:29:30 -0700
committerPushkar Joshi2012-04-24 08:29:30 -0700
commite7bbd9b08b4cd87530596b370366d994ca766650 (patch)
tree8862827848c55b36cc2e2bc0bb0c07a5e50dc1ca /js/components/ui/modalDialog/modal-dialog-manager.js
parentf57727d36709bbda03b45788dc12faf31a591b40 (diff)
parent55e6d621b9555abac06ab4adff44dfe29a78ec4e (diff)
downloadninja-e7bbd9b08b4cd87530596b370366d994ca766650.tar.gz
Merge branch 'master' into pentool
Diffstat (limited to 'js/components/ui/modalDialog/modal-dialog-manager.js')
-rwxr-xr-xjs/components/ui/modalDialog/modal-dialog-manager.js123
1 files changed, 0 insertions, 123 deletions
diff --git a/js/components/ui/modalDialog/modal-dialog-manager.js b/js/components/ui/modalDialog/modal-dialog-manager.js
deleted file mode 100755
index c06b35d6..00000000
--- a/js/components/ui/modalDialog/modal-dialog-manager.js
+++ /dev/null
@@ -1,123 +0,0 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Popup = require("js/components/popup.reel").Popup;
8var popupManagerModule = require("js/components/popup-manager.reel");
9var modalDialogHeader = require("js/components/ui/modalDialog/modalDialogHeader");
10
11exports.ModalDialogMananger = (require("montage/core/core").Montage).create(require("montage/ui/component").Component, {
12
13 _container: {
14 enumerable: false,
15 value: null
16 },
17
18 _blockScreen: {
19 enumerable: false,
20 value: null
21 },
22
23 /**
24 * Assign a container to be the block screen
25 *
26 * @param {Element} container
27 */
28 init: {
29 enumerable: true,
30 value: function (blockScreen, container) {
31 container.style.position = 'absolute';
32 container.style.top = 0;
33 container.style.left = 0;
34 container.style.width = '100%';
35 container.style.height = '100%';
36 container.style.display = "none";
37 this._container = container;
38
39 blockScreen.style.position = 'absolute';
40 blockScreen.style.top = 0;
41 blockScreen.style.left = 0;
42 blockScreen.style.width = '100%';
43 blockScreen.style.height = '100%';
44 blockScreen.style.backgroundColor = "#8c8c8c";
45 blockScreen.style.opacity = "0.8";
46 blockScreen.style.display = "none";
47 this._blockScreen = blockScreen;
48 }
49 },
50
51 /**
52 * Show a modal dialog at the center of the browser
53 */
54 showModalDialog:{
55 writable:false,
56 enumerable:true,
57 value: function(title, popupBackgroundColor, contentDiv){
58 //place block screen on top of everything
59 this._blockScreen.style.zIndex = popupManagerModule.PopupMananger._getNextHighestZindex(document.body);
60 this._blockScreen.style.display = "block";
61 this._container.style.zIndex = parseInt(this._blockScreen.style.zIndex) +1;
62
63
64 var modalContent = document.createElement("div");
65
66 //hack (elements needs to be on DOM to be drawn)
67 //add modal dialog header
68 var headerEl = document.createElement('div');
69 var header = modalDialogHeader.ModalDialogHeader.create();
70 header.element = headerEl;
71 if((typeof title === "undefined") || (title === null)){
72 header.showTitle = false;
73 }else{
74 header.title = title;
75 }
76 this._container.appendChild(headerEl);
77 header.needsDraw = true;
78
79 //add dialog content
80
81 modalContent.appendChild(contentDiv);
82
83// var that = this;
84// setTimeout(function(){that.closeModalDialog()}, 5000);//test
85
86 var popupEl = document.createElement('div');
87 var pop = Popup.create();
88 //Setting container and content
89 pop.element = popupEl;
90 pop.content = modalContent;
91 pop.position = {x:"30%", y:"15%"};//pass in real calculated center position
92 pop.zIndex = popupManagerModule.PopupMananger._getNextHighestZindex(this._container);
93 this._container.appendChild(popupEl);
94 popupEl.style.opacity = 1;
95 pop.needsDraw = true;
96
97 //overrride modal dialog background color
98 if((typeof popupBackgroundColor !== "undefined") || (popupBackgroundColor !== null)){
99 pop.element.style.backgroundColor = popupBackgroundColor;
100 }
101 //hack - place the rendered header in the right place now
102 this._container.removeChild(headerEl);
103 modalContent.insertBefore(headerEl, modalContent.firstChild);
104
105
106 this._container.style.display = "block";
107
108 }
109 },
110
111 closeModalDialog:{
112 writable:false,
113 enumerable:true,
114 value: function(){
115 //remove dialog
116 while(this._container.hasChildNodes()){
117 this._container.removeChild(this._container.lastChild);
118 }
119 this._container.style.display = "none";
120 this._blockScreen.style.display ="none";
121 }
122 }
123}); \ No newline at end of file