aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js22
-rwxr-xr-xjs/io/system/coreioapi.js10
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.js11
3 files changed, 32 insertions, 11 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index f8507086..e279d5c5 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -70,7 +70,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
70 value: function (request) { 70 value: function (request) {
71 if (request.url.indexOf('js/document/templates/montage-html') !== -1) { 71 if (request.url.indexOf('js/document/templates/montage-html') !== -1) {
72 72
73 console.log(request); 73 //console.log(request);
74 74
75 //TODO: Figure out why active document is not available here 75 //TODO: Figure out why active document is not available here
76 76
@@ -98,18 +98,26 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
98 handleExecuteFileOpen: { 98 handleExecuteFileOpen: {
99 value: function(event) { 99 value: function(event) {
100 var pickerSettings = event._event.settings || {}; 100 var pickerSettings = event._event.settings || {};
101 pickerSettings.callback = this.openFileWithURI.bind(this); 101 //adding callback so that file picker can be opened after checking cloud status
102 pickerSettings.pickerMode = "read"; 102 this.application.ninja.coreIoApi.cloudAvailable(function(){
103 pickerSettings.inFileMode = true; 103 pickerSettings.callback = this.openFileWithURI.bind(this);
104 this.application.ninja.filePickerController.showFilePicker(pickerSettings); 104 pickerSettings.pickerMode = "read";
105 pickerSettings.inFileMode = true;
106 this.application.ninja.filePickerController.showFilePicker(pickerSettings);
107 }.bind(this));
108
105 } 109 }
106 }, 110 },
107 111
108 handleExecuteNewFile: { 112 handleExecuteNewFile: {
109 value: function(event) { 113 value: function(event) {
110 var newFileSettings = event._event.settings || {}; 114 var newFileSettings = event._event.settings || {};
111 newFileSettings.callback = this.createNewFile.bind(this); 115 //adding callback so that new file dialog can be opened after checking cloud status
112 this.application.ninja.newFileController.showNewFileDialog(newFileSettings); 116 this.application.ninja.coreIoApi.cloudAvailable(function(){
117 newFileSettings.callback = this.createNewFile.bind(this);
118 this.application.ninja.newFileController.showNewFileDialog(newFileSettings);
119 }.bind(this));
120
113 } 121 }
114 }, 122 },
115 123
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index 2051da43..1bc66532 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -234,18 +234,19 @@ exports.CoreIoApi = Montage.create(Component, {
234 //Method to check status of I/O API, will return false if not active 234 //Method to check status of I/O API, will return false if not active
235 cloudAvailable: { 235 cloudAvailable: {
236 enumerable: false, 236 enumerable: false,
237 value: function () { 237 value: function (callback) {
238 var cloud = this.getCloudStatus(); 238 var cloud = this.getCloudStatus();
239 // 239 //
240 if (this.rootUrl && cloud.status === 200) { 240 if (this.rootUrl && cloud.status === 200) {
241 //Active 241 //Active
242 this.cloudData.name = cloud.response['name']; 242 this.cloudData.name = cloud.response['name'];
243 this.cloudData.root = cloud.response['server-root']; 243 this.cloudData.root = cloud.response['server-root'];
244 return true; 244 if(!!callback){callback();}
245 else{return true};
245 } else { 246 } else {
246 //Inactive 247 //Inactive
247 if (!this._cloudDialogOpen && this.application.ninja) { 248 if (!this._cloudDialogOpen && this.application.ninja) {
248 this.showCloudDialog(); 249 this.showCloudDialog(callback);
249 } 250 }
250 return false; 251 return false;
251 } 252 }
@@ -273,7 +274,7 @@ exports.CoreIoApi = Montage.create(Component, {
273 // 274 //
274 showCloudDialog: { 275 showCloudDialog: {
275 enumerable: false, 276 enumerable: false,
276 value: function () { 277 value: function (callback) {
277 // 278 //
278 this._cloudDialogOpen = true; 279 this._cloudDialogOpen = true;
279 // 280 //
@@ -294,6 +295,7 @@ exports.CoreIoApi = Montage.create(Component, {
294 this._cloudDialogComponents.dialog.element = popup; 295 this._cloudDialogComponents.dialog.element = popup;
295 this._cloudDialogComponents.dialog.needsDraw = true; 296 this._cloudDialogComponents.dialog.needsDraw = true;
296 this._cloudDialogComponents.dialog.element.style.opacity = 0; 297 this._cloudDialogComponents.dialog.element.style.opacity = 0;
298 this._cloudDialogComponents.dialog.callback = callback;
297 // 299 //
298 this._cloudDialogComponents.dialog.addEventListener('firstDraw', this, false); 300 this._cloudDialogComponents.dialog.addEventListener('firstDraw', this, false);
299 } 301 }
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.js b/js/io/ui/cloudpopup.reel/cloudpopup.js
index a2283d46..8e24f1a1 100755
--- a/js/io/ui/cloudpopup.reel/cloudpopup.js
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.js
@@ -23,6 +23,12 @@ exports.CloudPopup = Montage.create(Component, {
23 }, 23 },
24 //////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////
25 // 25 //
26 callback:{
27 writable:true,
28 enumerable:true,
29 value:null
30 },
31 //
26 components: { 32 components: {
27 enumerable: false, 33 enumerable: false,
28 value: {test_btn: null, ok_btn: null, cancel_btn: null, download_btn: null, status: null, url: null} 34 value: {test_btn: null, ok_btn: null, cancel_btn: null, download_btn: null, status: null, url: null}
@@ -121,6 +127,10 @@ exports.CloudPopup = Montage.create(Component, {
121 value: function() { 127 value: function() {
122 // 128 //
123 this.application.ninja.coreIoApi.hideCloudDialog(); 129 this.application.ninja.coreIoApi.hideCloudDialog();
130 this.application.ninja.coreIoApi._cloudDialogOpen=false;
131 if(!!this.callback){
132 this.callback();
133 }
124 } 134 }
125 }, 135 },
126 //////////////////////////////////////////////////////////////////// 136 ////////////////////////////////////////////////////////////////////
@@ -131,6 +141,7 @@ exports.CloudPopup = Montage.create(Component, {
131 // 141 //
132 this.application.ninja.coreIoApi.rootUrl = null; 142 this.application.ninja.coreIoApi.rootUrl = null;
133 this.application.ninja.coreIoApi.hideCloudDialog(); 143 this.application.ninja.coreIoApi.hideCloudDialog();
144 this.application.ninja.coreIoApi._cloudDialogOpen=false;
134 } 145 }
135 } 146 }
136 //////////////////////////////////////////////////////////////////// 147 ////////////////////////////////////////////////////////////////////