aboutsummaryrefslogtreecommitdiff
path: root/js/io/system
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-01-31 15:59:46 -0800
committerJose Antonio Marquez2012-01-31 15:59:46 -0800
commite75223a2c4c1e13d66639841e6418e94fe9b726f (patch)
treea37a20b56ef597d8a83cdb71b0dbb2f3cc7f5842 /js/io/system
parent6dc03672707a91085954359d82c14bd876f85b12 (diff)
downloadninja-e75223a2c4c1e13d66639841e6418e94fe9b726f.tar.gz
Cloud IO Prompt
Setting up UI for the file IO prompt on initialization of Ninja and whenever a cloud IO call is made and the server is not detected.
Diffstat (limited to 'js/io/system')
-rwxr-xr-xjs/io/system/coreioapi.js84
1 files changed, 73 insertions, 11 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index 33c7bc28..4407d59a 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -10,7 +10,9 @@ NOTES:
10//////////////////////////////////////////////////////////////////////// 10////////////////////////////////////////////////////////////////////////
11///////////////////////////////////////////////////////////////////// */ 11///////////////////////////////////////////////////////////////////// */
12var Montage = require("montage/core/core").Montage, 12var Montage = require("montage/core/core").Montage,
13 Component = require("montage/ui/component").Component; 13 Component = require("montage/ui/component").Component,
14 Popup = require("js/components/popup.reel").Popup,
15 CloudPopup = require("js/io/ui/cloudpopup.reel").CloudPopup;
14//////////////////////////////////////////////////////////////////////// 16////////////////////////////////////////////////////////////////////////
15//Exporting as Project I/O 17//Exporting as Project I/O
16exports.CoreIoApi = Montage.create(Component, { 18exports.CoreIoApi = Montage.create(Component, {
@@ -26,16 +28,11 @@ exports.CoreIoApi = Montage.create(Component, {
26 //Checks for IO API to be active 28 //Checks for IO API to be active
27 this.ioServiceDetected = this.cloudAvailable(); 29 this.ioServiceDetected = this.cloudAvailable();
28 // 30 //
29 console.log('FileIO: localStorage URL detected | IO Service Detected: '+ this.ioServiceDetected); 31 console.log('Cloud Status: URL detected in localStorage as '+this.rootUrl);
30 //
31 } else { 32 } else {
32 //TODO: Remove, automatically prompt user on welcome
33 this.rootUrl = 'http://localhost:16380';
34 //TODO: Changed to false, welcome screen prompts user
35 this.ioServiceDetected = this.cloudAvailable();
36 //
37 console.log('FileIO: localStorage URL NOT detected | IO Service Detected: '+ this.ioServiceDetected);
38 // 33 //
34 this.ioServiceDetected = false;
35 console.log('Cloud Status: No URL detected in localStorage');
39 } 36 }
40 } 37 }
41 }, 38 },
@@ -45,18 +42,83 @@ exports.CoreIoApi = Montage.create(Component, {
45 enumerable: false, 42 enumerable: false,
46 value: function () { 43 value: function () {
47 // 44 //
48 if (this.getCloudStatus().status === 200) { 45 if (this.rootUrl && this.getCloudStatus().status === 200) {
49 //Active 46 //Active
50 return true; 47 return true;
51 } else { 48 } else {
52 //Inactive 49 //Inactive
53 //TODO: Logic to prompt the user for cloud, otherwise return false 50 if (!this._cloudDialogOpen || this.application.ninja) {
51 this.showCloudDialog();
52 }
54 return false; 53 return false;
55 } 54 }
56 } 55 }
57 }, 56 },
58 //////////////////////////////////////////////////////////////////// 57 ////////////////////////////////////////////////////////////////////
59 // 58 //
59 _cloudDialogOpen: {
60 enumerable: false,
61 value: false
62 },
63 ////////////////////////////////////////////////////////////////////
64 //
65 _cloudDialogComponents: {
66 enumerable: false,
67 value: {blackout: null, popup: null, dialog: null}
68 },
69 ////////////////////////////////////////////////////////////////////
70 //
71 showCloudDialog: {
72 enumerable: false,
73 value: function () {
74 //
75 this._cloudDialogComponents.blackout = document.createElement('div');
76 this._cloudDialogComponents.blackout.style.width = '100%';
77 this._cloudDialogComponents.blackout.style.height = '100%';
78 this._cloudDialogComponents.blackout.style.background = 'rgba(0, 0, 0, .6)';
79 this.application.ninja.popupManager.addPopup(this._cloudDialogComponents.blackout);
80 //
81 ////////////////////////////////////////////////////
82 //Creating popup from m-js component
83 var popup = document.createElement('div');
84 //
85 this._cloudDialogComponents.dialog = CloudPopup.create();
86 //
87 document.body.appendChild(popup);
88 //
89 this._cloudDialogComponents.dialog.element = popup;
90 this._cloudDialogComponents.dialog.needsDraw = true;
91 this._cloudDialogComponents.dialog.element.style.opacity = 0;
92 //
93 this._cloudDialogComponents.dialog.addEventListener('firstDraw', this, false);
94 }
95 },
96
97 handleFirstDraw: {
98 value: function (e) {
99 if (e._target._element.className === 'cloud_popup') {
100 this._cloudDialogComponents.dialog.removeEventListener('firstDraw', this, false);
101 //
102 this._cloudDialogComponents.popup = this.application.ninja.popupManager.createPopup(this._cloudDialogComponents.dialog.element, {x: '200px', y: '200px'});
103 this._cloudDialogComponents.popup.addEventListener('firstDraw', this, false);
104 } else {
105 //
106 this._cloudDialogComponents.dialog.element.style.opacity = 1;
107 this._cloudDialogComponents.popup.element.style.opacity = 1;
108 }
109 }
110 },
111
112
113 ////////////////////////////////////////////////////////////////////
114 //
115 hideCloudDialog: {
116 enumerable: false,
117 value: function () {
118 }
119 },
120 ////////////////////////////////////////////////////////////////////
121 //
60 _ioServiceDetected: { 122 _ioServiceDetected: {
61 enumerable: false, 123 enumerable: false,
62 value: false 124 value: false