From 33e655cbbb0816340c5a2e5d5cc0a6b0c7d9f53c Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 1 Feb 2012 23:31:36 -0800 Subject: File IO clean up and setting up Cleaned up file IO templates and removed app-caching from Ninja since it would be needed. Setting up io-mediator to hook up to controller. Still need to address naming conventions and clean up more in the io directory. --- js/io/system/projectio.js | 70 ++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 25 deletions(-) (limited to 'js/io/system') diff --git a/js/io/system/projectio.js b/js/io/system/projectio.js index 822fd385..ad4cf151 100755 --- a/js/io/system/projectio.js +++ b/js/io/system/projectio.js @@ -4,56 +4,76 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ -var FileIo = require("js/io/system/fileio").FileIo; //////////////////////////////////////////////////////////////////////// -//Exporting as Project I/O -exports.ProjectIo = (require("montage/core/core").Montage).create(Object.prototype, { +// +var Montage = require("montage/core/core").Montage, + FileIo = require("js/io/system/fileio").FileIo; +//////////////////////////////////////////////////////////////////////// +// +exports.ProjectIo = = Montage.create(Object.prototype, { //////////////////////////////////////////////////////////////////// // - create: { + newProject: { enumerable: false, value: function () { + //Checking for API to be available + if (!this.application.ninja.coreIoApi.cloudAvailable()) { + //API not available, no IO action taken + return null; + } + // } }, //////////////////////////////////////////////////////////////////// // - open: { + readProject: { enumerable: false, value: function(e) { - //TODO: Add functionality - console.log('ProjectIO: open'); + //Checking for API to be available + if (!this.application.ninja.coreIoApi.cloudAvailable()) { + //API not available, no IO action taken + return null; + } + // } }, //////////////////////////////////////////////////////////////////// // - save: { + saveProject: { enumerable: false, - value: function(type, id, components) { - // - var rObj; + value: function() { + //Checking for API to be available + if (!this.application.ninja.coreIoApi.cloudAvailable()) { + //API not available, no IO action taken + return null; + } // - switch (type) { - case 'montageapp': - // - var css = FileIo.save('css', id); - var html = FileIo.save('html', id, components); - // - rObj = {html: html, css: css}; - break; - default: - break; + } + }, + //////////////////////////////////////////////////////////////////// + // + copyProject: { + enumerable: false, + value: function(e) { + //Checking for API to be available + if (!this.application.ninja.coreIoApi.cloudAvailable()) { + //API not available, no IO action taken + return null; } // - return rObj; } }, //////////////////////////////////////////////////////////////////// // - saveAs: { + infoProject: { enumerable: false, value: function(e) { - //TODO: Add functionality - console.log('ProjectIO: saveAs'); + //Checking for API to be available + if (!this.application.ninja.coreIoApi.cloudAvailable()) { + //API not available, no IO action taken + return null; + } + // } } //////////////////////////////////////////////////////////////////// -- cgit v1.2.3