diff options
author | John Mayhew | 2012-07-09 17:28:24 -0700 |
---|---|---|
committer | John Mayhew | 2012-07-09 17:28:24 -0700 |
commit | 770bcb52422742ff741a88a75ecefbeb90bc9247 (patch) | |
tree | 64cb3e09a8daeb340261dd7f3869c73f7b90b643 /js/document/models/base.js | |
parent | 8c5ecaf90062f9e030386f338bdc19fd62b826c8 (diff) | |
parent | 2b2b5fbb4b6a786daa4e9d4ee9eba9ac78924842 (diff) | |
download | ninja-770bcb52422742ff741a88a75ecefbeb90bc9247.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Conflicts:
manifest.json
Diffstat (limited to 'js/document/models/base.js')
-rwxr-xr-x | js/document/models/base.js | 471 |
1 files changed, 236 insertions, 235 deletions
diff --git a/js/document/models/base.js b/js/document/models/base.js index 97992324..c7e2de69 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js | |||
@@ -1,24 +1,25 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility LLC. |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | ||
5 | 4 | ||
6 | Redistribution and use in source and binary forms, with or without | 5 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met: | 6 | modification, are permitted provided that the following conditions are met: |
8 | 7 | ||
9 | - Redistributions of source code must retain the above copyright notice, | 8 | * Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. | 9 | this list of conditions and the following disclaimer. |
11 | - Redistributions in binary form must reproduce the above copyright | 10 | |
12 | notice, this list of conditions and the following disclaimer in the | 11 | * Redistributions in binary form must reproduce the above copyright notice, |
13 | documentation and/or other materials provided with the distribution. | 12 | this list of conditions and the following disclaimer in the documentation |
14 | - Neither the name of Motorola Mobility nor the names of its contributors | 13 | and/or other materials provided with the distribution. |
15 | may be used to endorse or promote products derived from this software | 14 | |
16 | without specific prior written permission. | 15 | * Neither the name of Motorola Mobility LLC nor the names of its |
16 | contributors may be used to endorse or promote products derived from this | ||
17 | software without specific prior written permission. | ||
17 | 18 | ||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
@@ -30,63 +31,63 @@ POSSIBILITY OF SUCH DAMAGE. | |||
30 | 31 | ||
31 | //////////////////////////////////////////////////////////////////////// | 32 | //////////////////////////////////////////////////////////////////////// |
32 | // | 33 | // |
33 | var Montage = require("montage/core/core").Montage, | 34 | var Montage = require("montage/core/core").Montage, |
34 | Component = require("montage/ui/component").Component, | 35 | Component = require("montage/ui/component").Component, |
35 | NinjaPrompt = require("js/components/prompt.reel").NinjaPrompt; | 36 | NinjaPrompt = require("js/components/prompt.reel").NinjaPrompt; |
36 | //////////////////////////////////////////////////////////////////////// | 37 | //////////////////////////////////////////////////////////////////////// |
37 | // | 38 | // |
38 | exports.BaseDocumentModel = Montage.create(Component, { | 39 | exports.BaseDocumentModel = Montage.create(Component, { |
39 | //////////////////////////////////////////////////////////////////// | 40 | //////////////////////////////////////////////////////////////////// |
40 | // | 41 | // |
41 | hasTemplate: { | 42 | hasTemplate: { |
42 | value: false | 43 | value: false |
43 | }, | 44 | }, |
44 | //////////////////////////////////////////////////////////////////// | 45 | //////////////////////////////////////////////////////////////////// |
45 | // | 46 | // |
46 | _file: { | 47 | _file: { |
47 | value: null | 48 | value: null |
48 | }, | 49 | }, |
49 | //////////////////////////////////////////////////////////////////// | 50 | //////////////////////////////////////////////////////////////////// |
50 | // | 51 | // |
51 | file: { | 52 | file: { |
52 | get: function() {return this._file;}, | 53 | get: function() {return this._file;}, |
53 | set: function(value) {this._file = value;} | 54 | set: function(value) {this._file = value;} |
54 | }, | 55 | }, |
55 | //////////////////////////////////////////////////////////////////// | 56 | //////////////////////////////////////////////////////////////////// |
56 | // | 57 | // |
57 | _isActive: { | 58 | _isActive: { |
58 | value: true | 59 | value: true |
59 | }, | 60 | }, |
60 | //////////////////////////////////////////////////////////////////// | 61 | //////////////////////////////////////////////////////////////////// |
61 | // | 62 | // |
62 | isActive: { | 63 | isActive: { |
63 | get: function() {return this._isActive;}, | 64 | get: function() {return this._isActive;}, |
64 | set: function(value) {this._isActive = value;} | 65 | set: function(value) {this._isActive = value;} |
65 | }, | 66 | }, |
66 | //////////////////////////////////////////////////////////////////// | 67 | //////////////////////////////////////////////////////////////////// |
67 | // | 68 | // |
68 | _needsSave: { | 69 | _needsSave: { |
69 | value: null | 70 | value: null |
70 | }, | 71 | }, |
71 | //////////////////////////////////////////////////////////////////// | 72 | //////////////////////////////////////////////////////////////////// |
72 | // | 73 | // |
73 | needsSave: { | 74 | needsSave: { |
74 | get: function() {return this._needsSave;}, | 75 | get: function() {return this._needsSave;}, |
75 | set: function(value) {this._needsSave = value;} | 76 | set: function(value) {this._needsSave = value;} |
76 | }, | 77 | }, |
77 | //////////////////////////////////////////////////////////////////// | 78 | //////////////////////////////////////////////////////////////////// |
78 | // | 79 | // |
79 | _currentView: { | 80 | _currentView: { |
80 | value: null | 81 | value: null |
81 | }, | 82 | }, |
82 | //////////////////////////////////////////////////////////////////// | 83 | //////////////////////////////////////////////////////////////////// |
83 | // | 84 | // |
84 | currentView: { | 85 | currentView: { |
85 | get: function() {return this._currentView;}, | 86 | get: function() {return this._currentView;}, |
86 | set: function(value) {this._currentView = value;} | 87 | set: function(value) {this._currentView = value;} |
87 | }, | 88 | }, |
88 | //////////////////////////////////////////////////////////////////// | 89 | //////////////////////////////////////////////////////////////////// |
89 | // | 90 | // |
90 | _selection: { | 91 | _selection: { |
91 | value: [] | 92 | value: [] |
92 | }, | 93 | }, |
@@ -105,18 +106,18 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
105 | value: null | 106 | value: null |
106 | }, | 107 | }, |
107 | //////////////////////////////////////////////////////////////////// | 108 | //////////////////////////////////////////////////////////////////// |
108 | // | 109 | // |
109 | parentContainer: { | 110 | parentContainer: { |
110 | value: null | 111 | value: null |
111 | }, | 112 | }, |
112 | //////////////////////////////////////////////////////////////////// | 113 | //////////////////////////////////////////////////////////////////// |
113 | // | 114 | // |
114 | views: { | 115 | views: { |
115 | value: null | 116 | value: null |
116 | }, | 117 | }, |
117 | //////////////////////////////////////////////////////////////////// | 118 | //////////////////////////////////////////////////////////////////// |
118 | // | 119 | // |
119 | libs: { | 120 | libs: { |
120 | value: null | 121 | value: null |
121 | }, | 122 | }, |
122 | 123 | ||
@@ -133,233 +134,233 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
133 | } | 134 | } |
134 | }, | 135 | }, |
135 | //////////////////////////////////////////////////////////////////// | 136 | //////////////////////////////////////////////////////////////////// |
136 | // | 137 | // |
137 | switchViewTo: { | 138 | switchViewTo: { |
138 | value: function (view) { | 139 | value: function (view) { |
139 | // | 140 | // |
140 | } | 141 | } |
141 | }, | 142 | }, |
142 | //////////////////////////////////////////////////////////////////// | 143 | //////////////////////////////////////////////////////////////////// |
143 | //TODO: Add API to allow other browser support | 144 | //TODO: Add API to allow other browser support |
144 | browserPreview: { | 145 | browserPreview: { |
145 | value: function (browser, screen, context) { | 146 | value: function (browser, screen, context) { |
146 | //Making call to show feedback screen | 147 | //Making call to show feedback screen |
147 | if (screen) screen.show(context); | 148 | if (screen) screen.show(context); |
148 | //Generating URL for document | 149 | //Generating URL for document |
149 | var url = this.application.ninja.coreIoApi.rootUrl + this.file.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]; | 150 | var url = this.application.ninja.coreIoApi.rootUrl + this.file.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]; |
150 | //TODO: Add logic to prompt user to save (all) before preview | 151 | //TODO: Add logic to prompt user to save (all) before preview |
151 | this.saveAll(null,function (success) { | 152 | this.saveAll(null,function (success) { |
152 | //Making call to show feedback screen | 153 | //Making call to show feedback screen |
153 | if (screen) screen.hide(context); | 154 | if (screen) screen.hide(context); |
154 | //TODO: Add error handling logic | 155 | //TODO: Add error handling logic |
155 | if (!success) { | 156 | if (!success) { |
156 | console.log('Error!'); | 157 | console.log('Error!'); |
157 | return; | 158 | return; |
158 | } | 159 | } |
159 | //Currently only supporting current browser (Chrome, obviously) | 160 | //Currently only supporting current browser (Chrome, obviously) |
160 | switch (this.browser) { | 161 | switch (this.browser) { |
161 | case 'chrome': | 162 | case 'chrome': |
162 | if (this.template && (this.template.type === 'banner' || this.template.type === 'animation')) { | 163 | if (this.template && (this.template.type === 'banner' || this.template.type === 'animation')) { |
163 | window.open('/js/document/templates/preview/banner.html?width='+this.template.size.width+'&height='+this.template.size.height+'&url='+this.url); | 164 | window.open('/js/document/templates/preview/banner.html?width='+this.template.size.width+'&height='+this.template.size.height+'&url='+this.url); |
164 | } else { | 165 | } else { |
165 | window.open(this.url); | 166 | window.open(this.url); |
166 | } | 167 | } |
167 | break; | 168 | break; |
168 | default: | 169 | default: |
169 | if (this.template && (this.template.type === 'banner' || this.template.type === 'animation')) { | 170 | if (this.template && (this.template.type === 'banner' || this.template.type === 'animation')) { |
170 | window.open('/js/document/templates/ |