diff options
Diffstat (limited to 'js/io/ui/cloudpopup.reel/cloudpopup.js')
-rwxr-xr-x | js/io/ui/cloudpopup.reel/cloudpopup.js | 98 |
1 files changed, 98 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..f81dc93c --- /dev/null +++ b/js/io/ui/cloudpopup.reel/cloudpopup.js | |||
@@ -0,0 +1,98 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | // | ||
9 | var Montage = require("montage/core/core").Montage, | ||
10 | Component = require("montage/ui/component").Component; | ||
11 | //////////////////////////////////////////////////////////////////////// | ||
12 | // | ||
13 | exports.CloudPopup = Montage.create(Component, { | ||
14 | //////////////////////////////////////////////////////////////////// | ||
15 | // | ||
16 | hasTemplate: { | ||
17 | value: true | ||
18 | }, | ||
19 | //////////////////////////////////////////////////////////////////// | ||
20 | // | ||
21 | components: { | ||
22 | enumerable: false, | ||
23 | value: {test_btn: null, ok_btn: null, cancel_btn: null, status: null, url: null} | ||
24 | }, | ||
25 | //////////////////////////////////////////////////////////////////// | ||
26 | // | ||
27 | prepareForDraw: { | ||
28 | enumerable: false, | ||
29 | value: function () { | ||
30 | // | ||
31 | this.components.test_btn = this.element.getElementsByClassName('btn_test')[0]; | ||
32 | this.components.ok_btn = this.element.getElementsByClassName('btn_ok')[0]; | ||
33 | this.components.cancel_btn = this.element.getElementsByClassName('btn_cancel')[0]; | ||
34 | this.components.status = this.element.getElementsByClassName('status')[0]; | ||
35 | this.components.url = this.element.getElementsByClassName('cloud_url')[0]; | ||
36 | } | ||
37 | }, | ||
38 | //////////////////////////////////////////////////////////////////// | ||
39 | // | ||
40 | willDraw: { | ||
41 | enumerable: false, | ||
42 | value: function() { | ||
43 | // | ||
44 | |||
45 | } | ||
46 | }, | ||
47 | //////////////////////////////////////////////////////////////////// | ||
48 | // | ||
49 | draw: { | ||
50 | enumerable: false, | ||
51 | value: function() { | ||
52 | // | ||
53 | this.testConnection(); | ||
54 | } | ||
55 | }, | ||
56 | //////////////////////////////////////////////////////////////////// | ||
57 | // | ||
58 | didDraw: { | ||
59 | enumerable: false, | ||
60 | value: function() { | ||
61 | // | ||
62 | this.components.test_btn.addEventListener('click', this.testConnection.bind(this), false); | ||
63 | // | ||
64 | this.components.ok_btn.addEventListener('click', this.closeDialog.bind(this), false); | ||
65 | this.components.cancel_btn.addEventListener('click', this.closeDialog.bind(this), false); | ||
66 | } | ||
67 | }, | ||
68 | //////////////////////////////////////////////////////////////////// | ||
69 | //this.application.ninja.coreIoApi.hideCloudDialog | ||
70 | testConnection: { | ||
71 | enumerable: false, | ||
72 | value: function() { | ||
73 | // | ||
74 | this.application.ninja.coreIoApi.rootUrl = this.components.url.value; | ||
75 | // | ||
76 | if (this.application.ninja.coreIoApi.cloudAvailable()) { | ||
77 | this.components.status.style.color = '#77FF00'; | ||
78 | this.components.status.innerHTML = 'Connected'; | ||
79 | } else { | ||
80 | this.components.status.style.color = '#FF3A3A'; | ||
81 | this.components.status.innerHTML = 'Disconnected'; | ||
82 | } | ||
83 | } | ||
84 | }, | ||
85 | //////////////////////////////////////////////////////////////////// | ||
86 | // | ||
87 | closeDialog: { | ||
88 | enumerable: false, | ||
89 | value: function() { | ||
90 | // | ||
91 | this.application.ninja.coreIoApi.hideCloudDialog(); | ||
92 | } | ||
93 | } | ||
94 | //////////////////////////////////////////////////////////////////// | ||
95 | //////////////////////////////////////////////////////////////////// | ||
96 | }); | ||
97 | //////////////////////////////////////////////////////////////////////// | ||
98 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | ||