From 0efbbf8287517b755be1774f6aa49947bed50a0d Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 7 Jun 2012 11:24:29 -0700 Subject: Adding unique ID to canvas data folders Also set up for tracking ID created, will be adding support for parsing files without saving later, but flag is now present. --- js/document/models/base.js | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'js/document/models') diff --git a/js/document/models/base.js b/js/document/models/base.js index a3644815..c69c54a9 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js @@ -90,6 +90,11 @@ exports.BaseDocumentModel = Montage.create(Component, { views: { value: null }, + //////////////////////////////////////////////////////////////////// + // + libs: { + value: {montage: false, canvas: false, montageId: null, canvasId: null} + }, //////////////////////////////////////////////////////////////////// // switchViewTo: { @@ -167,8 +172,9 @@ exports.BaseDocumentModel = Montage.create(Component, { // if (this.currentView === this.views.design) { // - this.application.ninja.ioMediator.fileSave({ + var save = this.application.ninja.ioMediator.fileSave({ mode: 'html', + libs: this.libs, file: this.file, webgl: this.webGlHelper.glData, styles: this.getStyleSheets(), @@ -178,6 +184,17 @@ exports.BaseDocumentModel = Montage.create(Component, { body: this.views.design.iframe.contentWindow.document.body, mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); + //TODO: Improve detection during save routine + if (save) { + if (save.montageId) { + this.libs.montageId = save.montageId; + this.libs.montage = true; + } + if (save.canvasId) { + this.libs.canvasId = save.canvasId; + this.libs.canvas = true; + } + } } else { //TODO: Add logic to save code view data } @@ -196,8 +213,9 @@ exports.BaseDocumentModel = Montage.create(Component, { // if (this.currentView === this.views.design) { // - this.application.ninja.ioMediator.fileSave({ + var save = this.application.ninja.ioMediator.fileSave({ mode: 'html', + libs: this.libs, file: this.file, webgl: this.webGlHelper.glData, css: this.getStyleSheets(), @@ -207,6 +225,17 @@ exports.BaseDocumentModel = Montage.create(Component, { body: this.views.design.iframe.contentWindow.document.body, mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); + //TODO: Improve detection during save routine + if (save) { + if (save.montageId) { + this.libs.montageId = save.montageId; + this.libs.montage = true; + } + if (save.canvasId) { + this.libs.canvasId = save.canvasId; + this.libs.canvas = true; + } + } } else { //TODO: Add logic to save code view data } -- cgit v1.2.3