diff options
author | Jose Antonio Marquez | 2012-02-15 23:07:00 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-15 23:07:00 -0800 |
commit | 075252ad893452df446566f01d0b26eeab08be3d (patch) | |
tree | b688e0ad1cd3ceefaa182058c85798644d28ff4a | |
parent | cdd36ed6c789886657c967e72ec2dcd49c6c5a76 (diff) | |
download | ninja-075252ad893452df446566f01d0b26eeab08be3d.tar.gz |
Setting up webGL library copy on save
-rwxr-xr-x | js/document/html-document.js | 36 | ||||
-rwxr-xr-x | js/io/system/coreioapi.js | 20 | ||||
-rw-r--r-- | js/io/system/ninjalibrary.js | 25 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 12 |
4 files changed, 45 insertions, 48 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js index bf9bba76..ad5417a9 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -12,7 +12,7 @@ var Montage = require("montage/core/core").Montage, | |||
12 | //////////////////////////////////////////////////////////////////////// | 12 | //////////////////////////////////////////////////////////////////////// |
13 | // | 13 | // |
14 | exports.HTMLDocument = Montage.create(TextDocument, { | 14 | exports.HTMLDocument = Montage.create(TextDocument, { |
15 | // PRIVATE MEMBERS | 15 | |
16 | _selectionExclude: { value: null, enumerable: false }, | 16 | _selectionExclude: { value: null, enumerable: false }, |
17 | _htmlTemplateUrl: { value: "user-document-templates/montage-application-cloud/index.html", enumerable: false}, | 17 | _htmlTemplateUrl: { value: "user-document-templates/montage-application-cloud/index.html", enumerable: false}, |
18 | _iframe: { value: null, enumerable: false }, | 18 | _iframe: { value: null, enumerable: false }, |
@@ -41,7 +41,6 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
41 | 41 | ||
42 | _zoomFactor: { value: 100, enumerable: false }, | 42 | _zoomFactor: { value: 100, enumerable: false }, |
43 | 43 | ||
44 | // PUBLIC MEMBERS | ||
45 | cssLoadInterval: { value: null, enumerable: false }, | 44 | cssLoadInterval: { value: null, enumerable: false }, |
46 | 45 | ||
47 | _savedLeftScroll: {value:null}, | 46 | _savedLeftScroll: {value:null}, |
@@ -53,9 +52,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
53 | value:null | 52 | value:null |
54 | }, | 53 | }, |
55 | 54 | ||
56 | /* | 55 | |
57 | * PUBLIC API | ||
58 | */ | ||
59 | 56 | ||
60 | // GETTERS / SETTERS | 57 | // GETTERS / SETTERS |
61 | 58 | ||
@@ -231,9 +228,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
231 | } | 228 | } |
232 | } | 229 | } |
233 | }, | 230 | }, |
234 | 231 | ||
235 | //****************************************// | ||
236 | // PUBLIC METHODS | ||
237 | 232 | ||
238 | 233 | ||
239 | //////////////////////////////////////////////////////////////////// | 234 | //////////////////////////////////////////////////////////////////// |
@@ -357,19 +352,8 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
357 | return this._window.getElement(x,y); | 352 | return this._window.getElement(x,y); |
358 | } | 353 | } |
359 | }, | 354 | }, |
360 | 355 | ||
361 | /* | 356 | |
362 | // Private | ||
363 | _loadDocument: { | ||
364 | value: function(uri) { | ||
365 | // Load the document into the Iframe | ||
366 | this.iframe.src = uri; | ||
367 | this.iframe.addEventListener("load", this, true); | ||
368 | } | ||
369 | }, | ||
370 | */ | ||
371 | |||
372 | |||
373 | 357 | ||
374 | //////////////////////////////////////////////////////////////////// | 358 | //////////////////////////////////////////////////////////////////// |
375 | // | 359 | // |
@@ -475,11 +459,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
475 | } | 459 | } |
476 | } | 460 | } |
477 | }, | 461 | }, |
478 | 462 | ||
479 | /** | ||
480 | * public method | ||
481 | * | ||
482 | */ | ||
483 | //////////////////////////////////////////////////////////////////// | 463 | //////////////////////////////////////////////////////////////////// |
484 | // | 464 | // |
485 | save: { | 465 | save: { |
@@ -487,12 +467,12 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
487 | value: function () { | 467 | value: function () { |
488 | //TODO: Add code view logic and also styles for HTML | 468 | //TODO: Add code view logic and also styles for HTML |
489 | if (this.currentView === 'design') { | 469 | if (this.currentView === 'design') { |
490 | return {mode: 'html', document: this._userDocument, style: this._styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; | 470 | return {mode: 'html', document: this._userDocument, webgl: this.glData, style: this._styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; |
491 | } else if (this.currentView === "code"){ | 471 | } else if (this.currentView === "code"){ |
492 | //TODO: Would this get call when we are in code of HTML? | 472 | //TODO: Would this get call when we are in code of HTML? |
493 | } else { | 473 | } else { |
494 | //Error | 474 | //Error |
495 | } | 475 | } |
496 | } | 476 | } |
497 | } | 477 | } |
498 | //////////////////////////////////////////////////////////////////// | 478 | //////////////////////////////////////////////////////////////////// |
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index 507804fd..a75b59bb 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -40,6 +40,7 @@ exports.CoreIoApi = Montage.create(Component, { | |||
40 | //////////////////////////////////////////////////////////// | 40 | //////////////////////////////////////////////////////////// |
41 | //Instance of ninja library | 41 | //Instance of ninja library |
42 | this.ninjaLibrary = NinjaLibrary; | 42 | this.ninjaLibrary = NinjaLibrary; |
43 | this.ninjaLibrary.coreApi = this; | ||
43 | //Getting reference of chrome file system API | 44 | //Getting reference of chrome file system API |
44 | this.chromeFileSystem = ChromeApi; | 45 | this.chromeFileSystem = ChromeApi; |
45 | //Sending size in MBs for file system storage | 46 | //Sending size in MBs for file system storage |
@@ -62,6 +63,7 @@ exports.CoreIoApi = Montage.create(Component, { | |||
62 | this.chromeFileSystem.removeEventListener('ready', this, false); | 63 | this.chromeFileSystem.removeEventListener('ready', this, false); |
63 | //Listening for library to be copied event (builds list) | 64 | //Listening for library to be copied event (builds list) |
64 | this.chromeFileSystem.addEventListener('library', this, false); | 65 | this.chromeFileSystem.addEventListener('library', this, false); |
66 | //TODO: Add sync loading screen logic (Add screen here) | ||
65 | } | 67 | } |
66 | }, | 68 | }, |
67 | //////////////////////////////////////////////////////////////////// | 69 | //////////////////////////////////////////////////////////////////// |
@@ -86,23 +88,7 @@ exports.CoreIoApi = Montage.create(Component, { | |||
86 | console.log('Ninja Local Library: Ready'); | 88 | console.log('Ninja Local Library: Ready'); |
87 | //Removing events | 89 | //Removing events |
88 | this.ninjaLibrary.removeEventListener('sync', this, false); | 90 | this.ninjaLibrary.removeEventListener('sync', this, false); |
89 | this.ninjaLibrary.coreApi = this; | 91 | //TODO: Add sync loading screen logic (Remove screen here) |
90 | //TODO: Add sync loading screen logic | ||
91 | |||
92 | //TODO: Remove test | ||
93 | //this.ninjaLibrary.copyLibToCloud('Users/kgq387/Desktop/Ninja Cloud/Disk', 'montage0.6.0'); | ||
94 | //this.ninjaLibrary.deleteLibraries(); | ||
95 | /* | ||
96 | window.hack = function (name, type) { | ||
97 | this.application.ninja.ioMediator.fileNew('Users/kgq387/Desktop/Ninja Cloud/Disk/'+name+'.'+type, '/js/io/templates/files/'+type+'.txt', function (status) {console.log(status)}); | ||
98 | }.bind(this); | ||
99 | */ | ||
100 | /* | ||
101 | window.hack = function (path) { | ||
102 | // | ||
103 | this.application.ninja.ioMediator.fileOpen('Users/kgq387/Desktop/Ninja Cloud/Disk/'+path, function (result) {console.log(result)}); | ||
104 | }.bind(this); | ||
105 | */ | ||
106 | } | 92 | } |
107 | }, | 93 | }, |
108 | //////////////////////////////////////////////////////////////////// | 94 | //////////////////////////////////////////////////////////////////// |
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js index fc943323..8c58883a 100644 --- a/js/io/system/ninjalibrary.js +++ b/js/io/system/ninjalibrary.js | |||
@@ -51,6 +51,23 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
51 | }, | 51 | }, |
52 | //////////////////////////////////////////////////////////////////// | 52 | //////////////////////////////////////////////////////////////////// |
53 | // | 53 | // |
54 | _libs: { | ||
55 | enumerable: false, | ||
56 | value: null | ||
57 | }, | ||
58 | //////////////////////////////////////////////////////////////////// | ||
59 | // | ||
60 | libs: { | ||
61 | enumerable: false, | ||
62 | get: function() { | ||
63 | return this._libs; | ||
64 | }, | ||
65 | set: function(value) { | ||
66 | this._libs = value; | ||
67 | } | ||
68 | }, | ||
69 | //////////////////////////////////////////////////////////////////// | ||
70 | // | ||
54 | _libsToSync: { | 71 | _libsToSync: { |
55 | enumerable: false, | 72 | enumerable: false, |
56 | value: 0 | 73 | value: 0 |
@@ -67,14 +84,14 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
67 | enumerable: false, | 84 | enumerable: false, |
68 | value: function (path, libName) { | 85 | value: function (path, libName) { |
69 | // | 86 | // |
70 | if(this.coreApi.directoryExists({uri: '/'+path+'/'+libName+'/'}).status === 404) { | 87 | if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { |
71 | this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { | 88 | this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { |
72 | for (var i in contents) { | 89 | for (var i in contents) { |
73 | if (libName === contents[i].name) { | 90 | if (libName === contents[i].name) { |
74 | //Getting contents of library to be copied | 91 | //Getting contents of library to be copied |
75 | this.chromeApi.directoryContents(contents[i], function (lib) { | 92 | this.chromeApi.directoryContents(contents[i], function (lib) { |
76 | //Creating directory structure from subfolders | 93 | //Creating directory structure from subfolders |
77 | this.copyDirectoryToCloud(path, contents[i], '/'+path, function (status) {console.log(status)}); | 94 | this.copyDirectoryToCloud(path, contents[i], path, function (status) {console.log(status)}); |
78 | }.bind(this)); | 95 | }.bind(this)); |
79 | break; | 96 | break; |
80 | } | 97 | } |
@@ -99,7 +116,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
99 | dir = folder.name; | 116 | dir = folder.name; |
100 | } | 117 | } |
101 | // | 118 | // |
102 | if (!this.coreApi.createDirectory({uri: '/'+dir+'/'})) { | 119 | if (!this.coreApi.createDirectory({uri: dir})) { |
103 | //Error occured while creating folders | 120 | //Error occured while creating folders |
104 | return; | 121 | return; |
105 | } | 122 | } |
@@ -140,6 +157,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
140 | //Parsing json libraries | 157 | //Parsing json libraries |
141 | libs = JSON.parse(xhr.response); | 158 | libs = JSON.parse(xhr.response); |
142 | // | 159 | // |
160 | this.libs = libs.libraries; | ||
161 | // | ||