From 04d375a02e44d1c11054ace16cd243ada8e6bd23 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 9 Feb 2012 00:05:25 -0800 Subject: Fixing URI for templates, need UI to use correct data --- js/io/system/coreioapi.js | 2 +- js/io/templates/descriptor.json | 16 ++++++++-------- js/mediators/io-mediator.js | 37 ++++++++++++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 12 deletions(-) (limited to 'js') diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index 0e721500..bdba5240 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js @@ -16,7 +16,7 @@ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, Popup = require("js/components/popup.reel").Popup, CloudPopup = require("js/io/ui/cloudpopup.reel").CloudPopup, - ChromeApi = require("js/io/system/chromeapi").ChromeApi; + ChromeApi = require("js/io/system/chromeapi").ChromeApi, NinjaLibrary = require("js/io/system/ninjalibrary").NinjaLibrary; //////////////////////////////////////////////////////////////////////// //Exporting as Project I/O diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json index d8fb7da4..f28455fa 100644 --- a/js/io/templates/descriptor.json +++ b/js/io/templates/descriptor.json @@ -10,56 +10,56 @@ }, "files/html.txt":{ "name":"HTML", - "uri":"files/html.txt", + "uri":"/js/io/templates/files/html.txt", "type":"file", "fileExtension":".html", "children":["defaultTemplate"] }, "files/js.txt":{ "name":"JavaScript", - "uri":"files/js.txt", + "uri":"/js/io/templates/files/files/js.txt", "type":"file", "fileExtension":".js", "children":["defaultTemplate"] }, "files/css.txt":{ "name":"Cascading Style Sheets", - "uri":"files/css.txt", + "uri":"/js/io/templates/files/css.txt", "type":"file", "fileExtension":".css", "children":["defaultTemplate"] }, "files/json.txt":{ "name":"JSON", - "uri":"files/json.txt", + "uri":"/js/io/templates/files/json.txt", "type":"file", "fileExtension":".json", "children":["defaultTemplate"] }, "files/php.txt":{ "name":"PHP", - "uri":"files/php.txt", + "uri":"/js/io/templates/files/php.txt", "type":"file", "fileExtension":".php", "children":["defaultTemplate"] }, "files/pl.txt":{ "name":"Perl", - "uri":"files/pl.txt", + "uri":"/js/io/templates/files/pl.txt", "type":"file", "fileExtension":".pl", "children":["defaultTemplate"] }, "files/py.txt":{ "name":"Python", - "uri":"files/py.txt", + "uri":"/js/io/templates/files/py.txt", "type":"file", "fileExtension":".py", "children":["defaultTemplate"] }, "files/rb.txt":{ "name":"Ruby", - "uri":"files/rb.txt", + "uri":"/js/io/templates/files/rb.txt", "type":"file", "fileExtension":".rb", "children":["defaultTemplate"] diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index fbabd780..b6d0e598 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -7,21 +7,52 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot //////////////////////////////////////////////////////////////////////// // var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component, FileIo = require("js/io/system/fileio").FileIo, ProjectIo = require("js/io/system/projectio").ProjectIo; //////////////////////////////////////////////////////////////////////// // -exports.IoMediator = Montage.create(require("montage/ui/component").Component, { +exports.IoMediator = Montage.create(Component, { + //////////////////////////////////////////////////////////////////// + // + deserializedFromTemplate: { + enumerable: false, + value: function () { + } + }, + //////////////////////////////////////////////////////////////////// + // + fio: { + enumerable: false, + value: FileIo + }, //////////////////////////////////////////////////////////////////// // fileNew: { enumerable: false, value: function (file, template, callback) { // + var xhr = new XMLHttpRequest(); + xhr.open("GET", template, false); + xhr.send(); + if (xhr.readyState === 4) { + // + console.log(this.fio.newFile({uri: file, contents: xhr.response})); + } else { + //Error + } + + + + + + - - var returnObj = null; //like {"uri": "/gfdg/gdf/dfg.js", "success": true,...} + //callback('win'); + /* +var returnObj = null; //like {"uri": "/gfdg/gdf/dfg.js", "success": true,...} callback(returnObj); +*/ } }, //////////////////////////////////////////////////////////////////// -- cgit v1.2.3