aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-27 10:51:15 -0800
committerValerio Virgillito2012-02-27 10:51:15 -0800
commitda60be29baab67440535b6b2b71fe7de989dfed0 (patch)
tree3cda434387f2aa6744808b2b0b4e7571d6d3a467
parenta5d635a29de97a7daa93b9036d7a7dce48f07670 (diff)
parent72baf1c366829ada6858097dd7553ee9988d6110 (diff)
downloadninja-da60be29baab67440535b6b2b71fe7de989dfed0.tar.gz
Merge branch 'local-storage-version' of https://github.com/mencio/ninja-internal into integration-candidate
-rwxr-xr-xcss/ninja.css2
-rwxr-xr-xjs/controllers/local-storage-controller.js67
-rwxr-xr-xjs/data/settings.js71
-rwxr-xr-xjs/io/system/coreioapi.js6
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.js4
-rwxr-xr-xjs/ninja.reel/ninja.html18
-rwxr-xr-xjs/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.html2
-rwxr-xr-xjs/panels/Panel.reel/Panel.html12
-rwxr-xr-xjs/panels/Panel.reel/Panel.js4
-rwxr-xr-xjs/panels/PanelBase.js49
-rwxr-xr-xjs/panels/PanelContainer/PanelContainer.reel/PanelContainer.js12
-rwxr-xr-xjs/panels/Resizer.js78
-rwxr-xr-xjs/panels/Splitter.js22
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html2
-rw-r--r--js/panels/presets/content.reel/content.js4
-rwxr-xr-xscss/imports/scss/_MainWindow.scss2
16 files changed, 171 insertions, 184 deletions
diff --git a/css/ninja.css b/css/ninja.css
index f085f6be..7baf4204 100755
--- a/css/ninja.css
+++ b/css/ninja.css
@@ -82,7 +82,7 @@ body { position: absolute; margin: 0px; width: 100%; height: 100%; background-co
82 82
83#bottomPanelContainer { background: transparent; height: 150px; min-height: 80px; max-height: 50%; overflow: auto; } 83#bottomPanelContainer { background: transparent; height: 150px; min-height: 80px; max-height: 50%; overflow: auto; }
84 84
85.panelContainer { display: block; -webkit-box-orient: vertical; position: relative; } 85.panelContainer { display: -webkit-box; -webkit-box-orient: vertical; position: relative; }
86 86
87#leftPanelContainer { width: 40px; -webkit-box-align: stretch; -webkit-box-sizing: border-box; margin-left: 2px; } 87#leftPanelContainer { width: 40px; -webkit-box-align: stretch; -webkit-box-sizing: border-box; margin-left: 2px; }
88 88
diff --git a/js/controllers/local-storage-controller.js b/js/controllers/local-storage-controller.js
index 6963b245..1388f3e5 100755
--- a/js/controllers/local-storage-controller.js
+++ b/js/controllers/local-storage-controller.js
@@ -7,44 +7,51 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component;
9 9
10exports.LocalStorage = Montage.create( Montage, { 10exports.LocalStorage = Montage.create( Component, {
11 11
12 getItem: { 12 canStore: {
13 value: function(item) { 13 value: null
14 var item; 14 },
15
16 if (window.localStorage) {
17 item = window.localStorage.getItem(item);
18 if(item !== null) return JSON.parse(item)
19 return null;
20 } else {
21 alert("Local Storage is not supported on your browser");
22 return null;
23 }
24 15
25 /* 16 deserializedFromTemplate: {
26 if (window.localStorage) { 17 value: function() {
27 this.getItem = function(item) { 18 this.canStore = window.localStorage;
28 return window.localStorage.getItem(item); 19 this.application.localStorage = this;
29 }(item); 20
30 } else { 21 // Redefine setItem and getItem if local storage is not available.
31 alert("Local Storage is not supported on your browser"); 22 if(!this.canStore) {
23 this.getItem = function() {
24 console.log("Local Storage is not supported on your browser");
25 return "";
26 };
27
28 this.setItem = function() {
29 console.log("Local Storage is not supported on your browser");
30 return false;
31 }
32 }
32 33
34 // Temporary clear the local storage if we find the version key
35 if(window.localStorage.version) {
36 window.localStorage.clear();
33 } 37 }
34 */ 38 }
39 },
40
41 getItem: {
42 value: function(key) {
43 var value = window.localStorage.getItem("ninja-" + key);
44 if(value !== null) value = JSON.parse(value);
45
46 return value;
35 } 47 }
36 }, 48 },
37 49
38 setItem: { 50 setItem: {
39 value: function(item, value) { 51 value: function(key, value) {
40 if (window.localStorage) { 52 window.localStorage.setItem("ninja-" + key, JSON.stringify(value));
41 window.localStorage.setItem(item, JSON.stringify(value)); 53
42 return true; 54 return value;
43 } else {
44 alert("Local Storage is not supported on your browser");
45 return false;
46 }
47 } 55 }
48 } 56 }
49
50}); \ No newline at end of file 57}); \ No newline at end of file
diff --git a/js/data/settings.js b/js/data/settings.js
deleted file mode 100755
index ffea2075..00000000
--- a/js/data/settings.js
+++ /dev/null
@@ -1,71 +0,0 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component,
9 LocalStorage = require("js/controllers/local-storage-controller").LocalStorage;
10
11exports.Settings = Montage.create( Component, {
12
13 version: {
14 value: "11.1213"
15 },
16
17 _settings: {
18 value: null
19 },
20
21 settings: {
22 get: function() { return this._settings; },
23 set: function(value) { this._settings = value; }
24 },
25
26 getSetting: {
27 value: function(objName, fieldName, namespace) {
28 try {
29 objName = objName.replace(/-/gi, "_").replace(/\//gi, "zzSlash");
30 return this.settings[objName][fieldName];
31 } catch(e) {
32 return null;
33 }
34 }
35 },
36
37 setSetting: {
38 value: function(objName, fieldName, value, namespace) {
39 try {
40 objName = objName.replace(/-/gi, "_").replace(/\//gi, "zzSlash");
41
42 if(this.settings === null) {
43 this.settings = {};
44 }
45
46 if (this.settings[objName] == null) {
47 this.settings[objName] = {};
48 }
49
50 this.settings[objName][fieldName] = value;
51
52 LocalStorage.setItem("settings", this.settings);
53 } catch(e) {
54 return null;
55 }
56 }
57 },
58
59 deserializedFromSerialization: {
60 value: function() {
61
62 if (LocalStorage.getItem("version") != this.version) {
63 this.settings = {}
64 LocalStorage.setItem("version",this.version);
65 } else {
66 this.settings = LocalStorage.getItem("settings");
67 }
68
69 }
70 }
71}); \ No newline at end of file
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index 2051da43..f428a229 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -28,9 +28,9 @@ exports.CoreIoApi = Montage.create(Component, {
28 value: function () { 28 value: function () {
29 //////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////
30 //Checking for local storage of URL for IO 30 //Checking for local storage of URL for IO
31 if (window.localStorage['ioRootUrl']) { 31 if (this.application.localStorage.getItem("ioRootUrl")) {
32 //Getting URL from local storage 32 //Getting URL from local storage
33 this.rootUrl = window.localStorage['ioRootUrl']; 33 this.rootUrl = this.application.localStorage.getItem("ioRootUrl");
34 //Checks for IO API to be active 34 //Checks for IO API to be active
35 this.ioServiceDetected = this.cloudAvailable(); 35 this.ioServiceDetected = this.cloudAvailable();
36 } else { 36 } else {
@@ -156,7 +156,7 @@ exports.CoreIoApi = Montage.create(Component, {
156 return this._rootUrl; 156 return this._rootUrl;
157 }, 157 },
158 set: function(value) { 158 set: function(value) {
159 this._rootUrl = window.localStorage["ioRootUrl"] = value; 159 this._rootUrl = this.application.localStorage.setItem("ioRootUrl", value);
160 } 160 }
161 }, 161 },
162 //////////////////////////////////////////////////////////////////// 162 ////////////////////////////////////////////////////////////////////
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.js b/js/io/ui/cloudpopup.reel/cloudpopup.js
index d2e82662..a4656bb5 100755
--- a/js/io/ui/cloudpopup.reel/cloudpopup.js
+++ b/js/io/ui/cloudpopup.reel/cloudpopup.js
@@ -63,8 +63,8 @@ exports.CloudPopup = Montage.create(Component, {
63 enumerable: false, 63 enumerable: false,
64 value: function() { 64 value: function() {
65 // 65 //
66 if (window.localStorage['ioRootUrl']) { 66 if (this.application.localStorage.getItem("ioRootUrl")) {
67 this.components.