aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/cloudpopup.reel/cloudpopup.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/ui/cloudpopup.reel/cloudpopup.js')
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.js170
1 files changed, 85 insertions, 85 deletions
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.js b/js/io/ui/cloudpopup.reel/cloudpopup.js
index c64d8974..7ae9e892 100755
--- a/js/io/ui/cloudpopup.reel/cloudpopup.js
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.js
@@ -30,136 +30,136 @@ POSSIBILITY OF SUCH DAMAGE.
30 30
31//////////////////////////////////////////////////////////////////////// 31////////////////////////////////////////////////////////////////////////
32// 32//
33var Montage = require("montage/core/core").Montage, 33var Montage = require("montage/core/core").Montage,
34 Component = require("montage/ui/component").Component; 34 Component = require("montage/ui/component").Component;
35//////////////////////////////////////////////////////////////////////// 35////////////////////////////////////////////////////////////////////////
36// 36//
37exports.CloudPopup = Montage.create(Component, { 37exports.CloudPopup = Montage.create(Component, {
38 //////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////
39 // 39 //
40 hasTemplate: { 40 hasTemplate: {
41 value: true 41 value: true
42 }, 42 },
43 //////////////////////////////////////////////////////////////////// 43 ////////////////////////////////////////////////////////////////////
44 // 44 //
45 _os: { 45 _os: {
46 value: null 46 value: null
47 }, 47 },
48 //////////////////////////////////////////////////////////////////// 48 ////////////////////////////////////////////////////////////////////
49 // 49 //
50 components: { 50 components: {
51 enumerable: false, 51 enumerable: false,
52 value: {test_btn: null, ok_btn: null, cancel_btn: null, download_btn: null, status: null, url: null} 52 value: {test_btn: null, ok_btn: null, cancel_btn: null, download_btn: null, status: null, url: null}
53 }, 53 },
54 //////////////////////////////////////////////////////////////////// 54 ////////////////////////////////////////////////////////////////////
55 // 55 //
56 prepareForDraw: { 56 prepareForDraw: {
57 enumerable: false, 57 enumerable: false,
58 value: function () { 58 value: function () {
59 // 59 //
60 this.components.test_btn = this.element.getElementsByClassName('btn_test nj-skinned')[0]; 60 this.components.test_btn = this.element.getElementsByClassName('btn_test nj-skinned')[0];
61 this.components.ok_btn = this.element.getElementsByClassName('btn_ok nj-skinned')[0]; 61 this.components.ok_btn = this.element.getElementsByClassName('btn_ok nj-skinned')[0];
62 this.components.cancel_btn = this.element.getElementsByClassName('btn_cancel nj-skinned')[0]; 62 this.components.cancel_btn = this.element.getElementsByClassName('btn_cancel nj-skinned')[0];
63 this.components.status = this.element.getElementsByClassName('status')[0]; 63 this.components.status = this.element.getElementsByClassName('status')[0];
64 this.components.url = this.element.getElementsByClassName('cloud_url')[0]; 64 this.components.url = this.element.getElementsByClassName('cloud_url')[0];
65 this.components.download_btn = this.element.getElementsByClassName('btn_download nj-skinned')[0]; 65 this.components.download_btn = this.element.getElementsByClassName('btn_download nj-skinned')[0];
66 } 66 }
67 }, 67 },
68 //////////////////////////////////////////////////////////////////// 68 ////////////////////////////////////////////////////////////////////
69 // 69 //
70 willDraw: { 70 willDraw: {
71 enumerable: false, 71 enumerable: false,
72 value: function() { 72 value: function() {
73 // 73 //
74 if (navigator.appVersion.indexOf("Win")!=-1) { 74 if (navigator.appVersion.indexOf("Win")!=-1) {
75 this._os = 'windows'; 75 this._os = 'windows';
76 } else if (navigator.appVersion.indexOf("Mac")!=-1) { 76 } else if (navigator.appVersion.indexOf("Mac")!=-1) {
77 this._os = 'mac'; 77 this._os = 'mac';
78 } else { 78 } else {
79 //Alternate message for no OS detected (probably Linux) 79 //Alternate message for no OS detected (probably Linux)
80 this.element.getElementsByTagName('section')[0].style.display = 'none'; 80 this.element.getElementsByTagName('section')[0].style.display = 'none';
81 } 81 }
82 } 82 }
83 }, 83 },
84 //////////////////////////////////////////////////////////////////// 84 ////////////////////////////////////////////////////////////////////
85 // 85 //
86 draw: { 86 draw: {
87 enumerable: false, 87 enumerable: false,
88 value: function() { 88 value: function() {
89 // 89 //
90 if (this.application.localStorage.getItem("ioRootUrl")) { 90 if (this.application.localStorage.getItem("ioRootUrl")) {
91 this.components.url.value = this.application.localStorage.getItem("ioRootUrl"); 91 this.components.url.value = this.application.localStorage.getItem("ioRootUrl");
92 } 92 }
93 // 93 //
94 this.testConnection(); 94 this.testConnection();
95 if (this.application.ninja.coreIoApi.cloudAvailable()) { 95 if (this.application.ninja.coreIoApi.cloudAvailable()) {
96 this.closeDialog(); 96 this.closeDialog();
97 } 97 }
98 } 98 }
99 }, 99 },
100 //////////////////////////////////////////////////////////////////// 100 ////////////////////////////////////////////////////////////////////
101 // 101 //
102 didDraw: { 102 didDraw: {
103 enumerable: false, 103 enumerable: false,
104 value: function() { 104 value: function() {
105 // 105 //
106 this.components.download_btn.addEventListener('click', this.downloadCloudApp.bind(this), false); 106 this.components.download_btn.addEventListener('click', this.downloadCloudApp.bind(this), false);
107 // 107 //
108 this.components.test_btn.addEventListener('click', this.testConnection.bind(this), false); 108 this.components.test_btn.addEventListener('click', this.testConnection.bind(this), false);
109 // 109 //
110 this.components.ok_btn.addEventListener('click', this.closeDialog.bind(this), false); 110 this.components.ok_btn.addEventListener('click', this.closeDialog.bind(this), false);
111 this.components.cancel_btn.addEventListener('click', this.cancelDialog.bind(this), false); 111 this.components.cancel_btn.addEventListener('click', this.cancelDialog.bind(this), false);
112 } 112 }
113 }, 113 },
114 //////////////////////////////////////////////////////////////////// 114 ////////////////////////////////////////////////////////////////////
115 // 115 //
116 downloadCloudApp: { 116 downloadCloudApp: {
117 enumerable: false, 117 enumerable: false,
118 value: function() { 118 value: function() {
119 if(this._os === 'mac') { 119 if(this._os === 'mac') {
120 location.href = '/ninja_localcloud_for_mac.zip'; 120 location.href = '/ninja_localcloud_for_mac.zip';
121 } else if (this._os === 'windows') { 121 } else if (this._os === 'windows') {
122 location.href = '/ninja_localcloud_for_windows.zip'; 122 location.href = '/ninja_localcloud_for_windows.zip';
123 } else { 123 } else {
124 alert('Your operating system is not supported by the Ninja Local Cloud App.'); 124 alert('Your operating system is not supported by the Ninja Local Cloud App.');
125 } 125 }
126 } 126 }
127 }, 127 },
128 //////////////////////////////////////////////////////////////////// 128 ////////////////////////////////////////////////////////////////////
129 // 129 //
130 testConnection: { 130 testConnection: {
131 enumerable: false, 131 enumerable: false,
132 value: function() { 132 value: function() {
133 // 133 //
134 this.application.ninja.coreIoApi.rootUrl = this.components.url.value; 134 this.application.ninja.coreIoApi.rootUrl = this.components.url.value;
135 // 135 //
136 if (this.application.ninja.coreIoApi.cloudAvailable()) { 136 if (this.application.ninja.coreIoApi.cloudAvailable()) {
137 this.components.status.style.color = '#77FF00'; 137 this.components.status.style.color = '#77FF00';
138 this.components.status.innerHTML = 'Connected to '+this.application.ninja.coreIoApi.cloudData.name; 138 this.components.status.innerHTML = 'Connected to '+this.application.ninja.coreIoApi.cloudData.name;
139 } else { 139 } else {
140 this.components.status.style.color = '#FF3A3A'; 140 this.components.status.style.color = '#FF3A3A';
141 this.components.status.innerHTML = 'Disconnected'; 141 this.components.status.innerHTML = 'Disconnected';
142 } 142 }
143 } 143 }
144 }, 144 },
145 //////////////////////////////////////////////////////////////////// 145 ////////////////////////////////////////////////////////////////////
146 // 146 //
147 closeDialog: { 147 closeDialog: {
148 enumerable: false, 148 enumerable: false,
149 value: function() { 149 value: function() {
150 // 150 //
151 this.application.ninja.coreIoApi.hideCloudDialog(); 151 this.application.ninja.coreIoApi.hideCloudDialog();
152 } 152 }
153 }, 153 },
154 //////////////////////////////////////////////////////////////////// 154 ////////////////////////////////////////////////////////////////////
155 // 155 //
156 cancelDialog: { 156 cancelDialog: {
157 enumerable: false, 157 enumerable: false,
158 value: function() { 158 value: function() {
159 // 159 //
160 this.application.ninja.coreIoApi.rootUrl = null; 160 this.application.ninja.coreIoApi.rootUrl = null;
161 this.application.ninja.coreIoApi.hideCloudDialog(); 161 this.application.ninja.coreIoApi.hideCloudDialog();
162 } 162 }
163 } 163 }
164 //////////////////////////////////////////////////////////////////// 164 ////////////////////////////////////////////////////////////////////
165 //////////////////////////////////////////////////////////////////// 165 ////////////////////////////////////////////////////////////////////