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 ++++++++++++++++++++------------ js/io/templates/descriptor.json | 51 +++++++++++++++++++++++ js/io/templates/files/_bin/template.css | 0 js/io/templates/files/_bin/template.html | 0 js/io/templates/files/_bin/template.js | 0 js/io/templates/files/_bin/template.json | 0 js/io/templates/files/_bin/template.php | 0 js/io/templates/files/_bin/template.pl | 0 js/io/templates/files/_bin/template.py | 0 js/io/templates/files/_bin/template.rb | 0 js/io/templates/files/_bin/template.xml | 0 js/io/templates/files/_bin/xml.txt | 0 12 files changed, 96 insertions(+), 25 deletions(-) create mode 100644 js/io/templates/descriptor.json delete mode 100755 js/io/templates/files/_bin/template.css delete mode 100755 js/io/templates/files/_bin/template.html delete mode 100755 js/io/templates/files/_bin/template.js delete mode 100755 js/io/templates/files/_bin/template.json delete mode 100755 js/io/templates/files/_bin/template.php delete mode 100755 js/io/templates/files/_bin/template.pl delete mode 100755 js/io/templates/files/_bin/template.py delete mode 100755 js/io/templates/files/_bin/template.rb delete mode 100755 js/io/templates/files/_bin/template.xml delete mode 100755 js/io/templates/files/_bin/xml.txt (limited to 'js/io') 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; + } + // } } //////////////////////////////////////////////////////////////////// diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json new file mode 100644 index 00000000..3d8391c5 --- /dev/null +++ b/js/io/templates/descriptor.json @@ -0,0 +1,51 @@ +{ + "categories":{ + "children":["newFile"] + }, + "newFile":{ + "name":"Blank Template", + "uri":"/", + "type":"directory", + "children":["html", "js", "css", "json", "php", "pl", "py", "rb"] + }, + "html":{ + "name":"HTML", + "uri":"files/html.txt", + "type":"file" + }, + "js":{ + "name":"JavaScript", + "uri":"files/js.txt", + "type":"file" + }, + "css":{ + "name":"Cascading Style Sheets", + "uri":"files/css.txt", + "type":"file" + }, + "json":{ + "name":"JSON", + "uri":"files/json.txt", + "type":"file" + }, + "php":{ + "name":"PHP", + "uri":"files/php.txt", + "type":"file" + }, + "pl":{ + "name":"Perl", + "uri":"files/pl.txt", + "type":"file" + }, + "py":{ + "name":"Python", + "uri":"files/py.txt", + "type":"file" + }, + "rb":{ + "name":"Ruby", + "uri":"files/rb.txt", + "type":"file" + } +} \ No newline at end of file diff --git a/js/io/templates/files/_bin/template.css b/js/io/templates/files/_bin/template.css deleted file mode 100755 index e69de29b..00000000 diff --git a/js/io/templates/files/_bin/template.html b/js/io/templates/files/_bin/template.html deleted file mode 100755 index e69de29b..00000000 diff --git a/js/io/templates/files/_bin/template.js b/js/io/templates/files/_bin/template.js deleted file mode 100755 index e69de29b..00000000 diff --git a/js/io/templates/files/_bin/template.json b/js/io/templates/files/_bin/template.json deleted file mode 100755 index e69de29b..00000000 diff --git a/js/io/templates/files/_bin/template.php b/js/io/templates/files/_bin/template.php deleted file mode 100755 index e69de29b..00000000 diff --git a/js/io/templates/files/_bin/template.pl b/js/io/templates/files/_bin/template.pl deleted file mode 100755 index e69de29b..00000000 diff --git a/js/io/templates/files/_bin/template.py b/js/io/templates/files/_bin/template.py deleted file mode 100755 index e69de29b..00000000 diff --git a/js/io/templates/files/_bin/template.rb b/js/io/templates/files/_bin/template.rb deleted file mode 100755 index e69de29b..00000000 diff --git a/js/io/templates/files/_bin/template.xml b/js/io/templates/files/_bin/template.xml deleted file mode 100755 index e69de29b..00000000 diff --git a/js/io/templates/files/_bin/xml.txt b/js/io/templates/files/_bin/xml.txt deleted file mode 100755 index e69de29b..00000000 -- cgit v1.2.3