aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/cloudpopup.reel/cloudpopup.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-15 17:04:39 -0800
committerValerio Virgillito2012-02-15 17:04:39 -0800
commitfe71cb9aa1700199c0089166ad54fc56eb760644 (patch)
treeb0c7c24b1f45a079e1c09312ca716e3d35aecad4 /js/io/ui/cloudpopup.reel/cloudpopup.js
parent747616980cad14f0b65fbcc7f497ed9680a39d29 (diff)
parentd366c0bd1af6471511217ed574083e15059519b5 (diff)
downloadninja-fe71cb9aa1700199c0089166ad54fc56eb760644.tar.gz
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'js/io/ui/cloudpopup.reel/cloudpopup.js')
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.js134
1 files changed, 134 insertions, 0 deletions
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.js b/js/io/ui/cloudpopup.reel/cloudpopup.js
new file mode 100755
index 00000000..e5bad98e
--- /dev/null
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.js
@@ -0,0 +1,134 @@
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
7////////////////////////////////////////////////////////////////////////
8//
9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component;
11////////////////////////////////////////////////////////////////////////
12//
13exports.CloudPopup = Montage.create(Component, {
14 ////////////////////////////////////////////////////////////////////
15 //
16 hasTemplate: {
17 value: true
18 },
19 ////////////////////////////////////////////////////////////////////
20 //
21 _os: {
22 value: null
23 },
24 ////////////////////////////////////////////////////////////////////
25 //
26 components: {
27 enumerable: false,
28 value: {test_btn: null, ok_btn: null, cancel_btn: null, download_btn: null, status: null, url: null}
29 },
30 ////////////////////////////////////////////////////////////////////
31 //
32 prepareForDraw: {
33 enumerable: false,
34 value: function () {
35 //
36 this.components.test_btn = this.element.getElementsByClassName('btn_test nj-skinned')[0];
37 this.components.ok_btn = this.element.getElementsByClassName('btn_ok nj-skinned')[0];
38 this.components.cancel_btn = this.element.getElementsByClassName('btn_cancel nj-skinned')[0];
39 this.components.status = this.element.getElementsByClassName('status')[0];
40 this.components.url = this.element.getElementsByClassName('cloud_url')[0];
41 this.components.download_btn = this.element.getElementsByClassName('btn_download nj-skinned')[0];
42 }
43 },
44 ////////////////////////////////////////////////////////////////////
45 //
46 willDraw: {
47 enumerable: false,
48 value: function() {
49 //
50 if (navigator.appVersion.indexOf("Win")!=-1) {
51 this._os = 'windows';
52 } else if (navigator.appVersion.indexOf("Mac")!=-1) {
53 this._os = 'mac';
54 } else {
55 //Alternate message for no OS detected (probably Linux)
56 this.element.getElementsByTagName('section')[0].style.display = 'none';
57 }
58 }
59 },
60 ////////////////////////////////////////////////////////////////////
61 //
62 draw: {
63 enumerable: false,
64 value: function() {
65 //
66 this.testConnection();
67 if (this.application.ninja.coreIoApi.cloudAvailable()) {
68 this.closeDialog();
69 }
70 }
71 },
72 ////////////////////////////////////////////////////////////////////
73 //
74 didDraw: {
75 enumerable: false,
76 value: function() {
77 //
78 this.components.download_btn.addEventListener('click', this.downloadCloudApp.bind(this), false);
79 //
80 this.components.test_btn.addEventListener('click', this.testConnection.bind(this), false);
81 //
82 this.components.ok_btn.addEventListener('click', this.closeDialog.bind(this), false);
83 this.components.cancel_btn.addEventListener('click', this.cancelDialog.bind(this), false);
84 }
85 },
86 ////////////////////////////////////////////////////////////////////
87 //
88 downloadCloudApp: {
89 enumerable: false,
90 value: function() {
91 console.log(this._os);
92 }
93 },
94 ////////////////////////////////////////////////////////////////////
95 //
96 testConnection: {
97 enumerable: false,
98 value: function() {
99 //
100 this.application.ninja.coreIoApi.rootUrl = this.components.url.value;
101 //
102 if (this.application.ninja.coreIoApi.cloudAvailable()) {
103 this.components.status.style.color = '#77FF00';
104 this.components.status.innerHTML = 'Connected to '+this.application.ninja.coreIoApi.cloudData.name;
105 } else {
106 this.components.status.style.color = '#FF3A3A';
107 this.components.status.innerHTML = 'Disconnected';
108 }
109 }
110 },
111 ////////////////////////////////////////////////////////////////////
112 //
113 closeDialog: {
114 enumerable: false,
115 value: function() {
116 //
117 this.application.ninja.coreIoApi.hideCloudDialog();
118 }
119 },
120 ////////////////////////////////////////////////////////////////////
121 //
122 cancelDialog: {
123 enumerable: false,
124 value: function() {
125 //
126 this.application.ninja.coreIoApi.rootUrl = null;
127 this.application.ninja.coreIoApi.hideCloudDialog();
128 }
129 }
130 ////////////////////////////////////////////////////////////////////
131 ////////////////////////////////////////////////////////////////////
132});
133////////////////////////////////////////////////////////////////////////
134//////////////////////////////////////////////////////////////////////// \ No newline at end of file