From d74910a897f2db920f6f67d922532d245074c8f7 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 1 Feb 2012 11:51:24 -0800 Subject: Fixing coreIO API referencing --- js/io/system/coreioapi.js | 3 ++- js/io/system/fileio.js | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'js/io') 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, { directoryServiceURL: { enumerable: false, get: function() { + console.log(this); return String(this.rootUrl+this._directoryServiceURL); }, set: function(value) { @@ -1015,7 +1016,7 @@ exports.CoreIoApi = Montage.create(Component, { // if (xhr.readyState === 4) { retValue.status = xhr.status; - eval('retValue.response = '+xhr.response); + retValue.response = JSON.parse(xhr.response); retValue.success = true; } } 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: empty file will be created. 'contents' should be a string to be saved as the file. 'contentType' is the mime type of the file. + coreIoApi: this.application.ninja.coreIoApi + //////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// */ // -var Montage = require("montage/core/core").Montage, - CoreIoApi = require("js/io/system/coreioapi").CoreIoApi; +var Montage = require("montage/core/core").Montage; //////////////////////////////////////////////////////////////////////// //Exporting as File I/O exports.FileIo = Montage.create(Object.prototype, { @@ -28,12 +29,12 @@ exports.FileIo = Montage.create(Object.prototype, { enumerable: true, value: function(file) { //Checking for API to be available - if (!CoreIoApi.cloudAvailable()) { + if (!this.application.ninja.coreIoApi.cloudAvailable()) { //API not available, no IO action taken return null; } //Peforming check for file to exist - var check = CoreIoApi.fileExists(file.uri), status, create; + var check = this.application.ninja.coreIoApi.fileExists(file.uri), status, create; //Upon successful check, handling results if (check.success) { //Handling status of check @@ -44,7 +45,7 @@ exports.FileIo = Montage.create(Object.prototype, { break; case 404: //File does not exists, ready to be created - create = CoreIoApi.createFile(file); + create = this.application.ninja.coreIoApi.createFile(file); //Storing status to be returned (for UI handling) if (create.success) { status = check.status; -- cgit v1.2.3