aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/ui/FilePicker/file-picker-controller.js9
-rwxr-xr-xjs/io/system/coreioapi.js3
-rwxr-xr-xjs/io/system/fileio.js11
3 files changed, 12 insertions, 11 deletions
diff --git a/js/components/ui/FilePicker/file-picker-controller.js b/js/components/ui/FilePicker/file-picker-controller.js
index f14857ac..e71d1460 100755
--- a/js/components/ui/FilePicker/file-picker-controller.js
+++ b/js/components/ui/FilePicker/file-picker-controller.js
@@ -8,7 +8,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
8var Montage = require("montage/core/core").Montage, 8var Montage = require("montage/core/core").Montage,
9 pickerNavigatorReel = require("js/components/ui/FilePicker/pickerNavigator.reel").PickerNavigator, 9 pickerNavigatorReel = require("js/components/ui/FilePicker/pickerNavigator.reel").PickerNavigator,
10 filePickerModelModule = require("js/components/ui/FilePicker/file-picker-model"), 10 filePickerModelModule = require("js/components/ui/FilePicker/file-picker-model"),
11 fileSystem = require("js/io/system/filesystem").FileSystem,
12 Popup = require("montage/ui/popup/popup.reel").Popup; 11 Popup = require("montage/ui/popup/popup.reel").Popup;
13 12
14//singleton with functions to create a new file picker instance and utilities to format or filter the model data 13//singleton with functions to create a new file picker instance and utilities to format or filter the model data
@@ -101,7 +100,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
101 var aModel = filePickerModelModule.FilePickerModel.create(); 100 var aModel = filePickerModelModule.FilePickerModel.create();
102 101
103 var topLevelDirectories = null; 102 var topLevelDirectories = null;
104 var driveData = fileSystem.shellApiHandler.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); 103 var driveData = this.application.ninja.coreIoApi.getDirectoryContents({uri:"", recursive:false, returnType:"all"});
105 if(driveData.success){ 104 if(driveData.success){
106 topLevelDirectories = (JSON.parse(driveData.content)).children; 105 topLevelDirectories = (JSON.parse(driveData.content)).children;
107 }else{ 106 }else{
@@ -244,7 +243,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
244 || !this._directoryContentCache[folderUri].children){ 243 || !this._directoryContentCache[folderUri].children){
245 //get data using IO api 244 //get data using IO api
246 try{ 245 try{
247 var iodata = fileSystem.shellApiHandler.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); 246 var iodata = this.application.ninja.coreIoApi.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"});
248 //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); 247 //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content);
249 if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ 248 if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){
250 folderContent = JSON.parse(iodata.content); 249 folderContent = JSON.parse(iodata.content);
@@ -456,7 +455,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
456 //check for directory staleness.... if stale query filesystem 455 //check for directory staleness.... if stale query filesystem
457 if((new Date()).getTime() > (this._directoryContentCache[folderUri].queriedTimeStamp + this.cacheStaleTime)){ 456 if((new Date()).getTime() > (this._directoryContentCache[folderUri].queriedTimeStamp + this.cacheStaleTime)){
458 try{ 457 try{
459 var ifModifiedResponse = fileSystem.shellApiHandler.isDirectoryModified({uri:folderUri, recursive:false, returnType:"all"}, this._directoryContentCache[folderUri].queriedTimeStamp); 458 var ifModifiedResponse = this.application.ninja.coreIoApi.isDirectoryModified({uri:folderUri, recursive:false, returnType:"all"}, this._directoryContentCache[folderUri].queriedTimeStamp);
460 //console.log("ifModifiedResponse"); 459 //console.log("ifModifiedResponse");
461 //console.log(ifModifiedResponse); 460 //console.log(ifModifiedResponse);
462 }catch(e){ 461 }catch(e){
@@ -468,7 +467,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
468 wasStale = true; 467 wasStale = true;
469 //uri has changed. so update cache 468 //uri has changed. so update cache
470 try{ 469 try{
471 var iodata = fileSystem.shellApiHandler.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); 470 var iodata = this.application.ninja.coreIoApi.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"});
472 //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); 471 //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content);
473 if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ 472 if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){
474 folderContent = JSON.parse(iodata.content); 473 folderContent = JSON.parse(iodata.content);
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index 74b066ac..7e883b81 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -207,6 +207,7 @@ exports.CoreIoApi = Montage.create(Component, {
207 directoryServiceURL: { 207 directoryServiceURL: {
208 enumerable: false, 208 enumerable: false,
209 get: function() { 209 get: function() {
210 console.log(this);
210 return String(this.rootUrl+this._directoryServiceURL); 211 return String(this.rootUrl+this._directoryServiceURL);
211 }, 212 },
212 set: function(value) { 213 set: function(value) {
@@ -1015,7 +1016,7 @@ exports.CoreIoApi = Montage.create(Component, {
1015 // 1016 //
1016 if (xhr.readyState === 4) { 1017 if (xhr.readyState === 4) {
1017 retValue.status = xhr.status; 1018 retValue.status = xhr.status;
1018 eval('retValue.response = '+xhr.response); 1019 retValue.response = JSON.parse(xhr.response);
1019 retValue.success = true; 1020 retValue.success = true;
1020 } 1021 }
1021 } 1022 }
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js
index 38ab05e8..ac5812e9 100755
--- a/js/io/system/fileio.js
+++ b/js/io/system/fileio.js
@@ -11,11 +11,12 @@ NOTES:
11 empty file will be created. 'contents' should be a string to be saved 11 empty file will be created. 'contents' should be a string to be saved
12 as the file. 'contentType' is the mime type of the file. 12 as the file. 'contentType' is the mime type of the file.
13 13
14 coreIoApi: this.application.ninja.coreIoApi
15
14//////////////////////////////////////////////////////////////////////// 16////////////////////////////////////////////////////////////////////////
15///////////////////////////////////////////////////////////////////// */ 17///////////////////////////////////////////////////////////////////// */
16// 18//
17var Montage = require("montage/core/core").Montage, 19var Montage = require("montage/core/core").Montage;
18 CoreIoApi = require("js/io/system/coreioapi").CoreIoApi;
19//////////////////////////////////////////////////////////////////////// 20////////////////////////////////////////////////////////////////////////
20//Exporting as File I/O 21//Exporting as File I/O
21exports.FileIo = Montage.create(Object.prototype, { 22exports.FileIo = Montage.create(Object.prototype, {
@@ -28,12 +29,12 @@ exports.FileIo = Montage.create(Object.prototype, {
28 enumerable: true, 29 enumerable: true,
29 value: function(file) { 30 value: function(file) {
30 //Checking for API to be available 31 //Checking for API to be available
31 if (!CoreIoApi.cloudAvailable()) { 32 if (!this.application.ninja.coreIoApi.cloudAvailable()) {
32 //API not available, no IO action taken 33 //API not available, no IO action taken
33 return null; 34 return null;
34 } 35 }
35 //Peforming check for file to exist 36 //Peforming check for file to exist
36 var check = CoreIoApi.fileExists(file.uri), status, create; 37 var check = this.application.ninja.coreIoApi.fileExists(file.uri), status, create;
37 //Upon successful check, handling results 38 //Upon successful check, handling results
38 if (check.success) { 39 if (check.success) {
39 //Handling status of check 40 //Handling status of check
@@ -44,7 +45,7 @@ exports.FileIo = Montage.create(Object.prototype, {
44 break; 45 break;
45 case 404: 46 case 404:
46 //File does not exists, ready to be created 47 //File does not exists, ready to be created
47 create = CoreIoApi.createFile(file); 48 create = this.application.ninja.coreIoApi.createFile(file);
48 //Storing status to be returned (for UI handling) 49 //Storing status to be returned (for UI handling)
49 if (create.success) { 50 if (create.success) {
50 status = check.status; 51 status = check.status;