]> 91.132.146.200 Git - klimbim.git/commitdiff
cookie storage working
authorBanana <banana@starscream.de>
Mon, 1 Aug 2011 11:56:53 +0000 (13:56 +0200)
committerBanana <banana@starscream.de>
Mon, 1 Aug 2011 11:56:53 +0000 (13:56 +0200)
javascript/mif-tree/Demos/CookieStorage/demo.css [new file with mode: 0755]
javascript/mif-tree/Demos/CookieStorage/demo.js [new file with mode: 0755]
javascript/mif-tree/Demos/CookieStorage/index.html [new file with mode: 0755]
javascript/mif-tree/Demos/index.html

diff --git a/javascript/mif-tree/Demos/CookieStorage/demo.css b/javascript/mif-tree/Demos/CookieStorage/demo.css
new file mode 100755 (executable)
index 0000000..1a963ac
--- /dev/null
@@ -0,0 +1,295 @@
+#tree_container{
+height:200px;
+width:200px;
+position:relative;
+border:solid 1px #b7b7b7;
+}
+
+#tree_container2{
+height:200px;
+width:200px;
+position:relative;
+border:solid 1px #b7b7b7;
+margin-top:10px;
+}
+
+/*@global*/
+
+.mif-tree-wrapper{
+position: absolute;
+width: 100%;
+height:100%;
+margin:0;
+padding:0;
+overflow:auto;
+font-family:sans-serif;
+font-size:11px;
+line-height:18px;/******Tree node height******/
+white-space:nowrap;
+cursor:default;
+}
+
+.mif-tree-bg{
+width:100%;
+height:100%;
+position:absolute;
+overflow:hidden;
+}
+
+.mif-tree-bg-container{
+width:100%;
+display:none;
+}
+
+.mif-tree-bg-node{
+width:100%;
+height:18px;
+}
+
+.mif-tree-bg-selected{
+background-color:#dcd7ab;
+}
+
+.mif-tree-wrapper:focus{
+outline:0;
+}
+
+.mif-tree-wrapper span{
+padding-bottom:2px;
+padding-top:2px;
+cursor:inherit;
+}
+
+.mif-tree-children{
+padding-left:18px;
+width:18px;
+}
+
+.mif-tree-node{
+width:18px;
+background:url('../assets/images/line.gif') repeat-y 8px 0px;
+}
+
+.mif-tree-node-last{
+background:url('../assets/images/line.gif') no-repeat 8px 0px;
+}
+
+.mif-tree-name{
+cursor: default;
+overflow:hidden;
+margin-left:4px;
+}
+
+.mif-tree-name a{
+color:red;
+}
+
+.mif-tree-name a:hover{
+color:blue;
+}
+
+
+.mif-tree-node-wrapper{
+background:url('../assets/images/horizontal-line.gif') no-repeat 9px center;
+}
+
+/*@gadjets*/
+
+.mif-tree-gadjet{
+background-image:url('../assets/images/gadjets.gif');
+padding-right: 16px;
+z-index:1;
+overflow:hidden;
+background-repeat:no-repeat;
+cursor:default;
+}
+
+.mif-tree-gadjet-none{
+background:none;
+}
+
+.mif-tree-gadjet-minus{
+background-position: 0px 50%;
+}
+
+.mif-tree-gadjet-plus{
+background-position: -18px 50%;
+}
+
+
+.mif-tree-gadjet-hover .mif-tree-gadjet-minus{
+background-position: -54px 50%;
+}
+
+.mif-tree-gadjet-hover .mif-tree-gadjet-plus{
+background-position: -72px 50%;
+}
+
+
+
+
+/*.mif-tree-gadjet-hover{
+background-image:url('../assets/images/gadjets-hover.gif');
+}*/
+
+
+
+
+/*@icons*/
+.mif-tree-icon{
+padding-right:18px;
+background-position:0 50%;
+background-repeat:no-repeat;
+cursor:inherit;
+}
+
+.mif-tree-open-icon{
+background-image:url('../assets/images/openicon.gif')
+}
+
+.mif-tree-close-icon{
+background-image:url('../assets/images/closeicon.gif')
+}
+
+
+.mif-tree-loader-open-icon,.mif-tree-loader-close-icon{
+background-image:url('../assets/images/mootree_loader.gif');
+}
+
+.mif-tree-book-icon{
+background-image:url('../assets/images/book_icon.gif');
+}
+
+.mif-tree-bin-open-icon{
+background-image:url('../assets/images/bin_open_icon.gif');
+}
+
+.mif-tree-bin-close-icon{
+background-image:url('../assets/images/bin_close_icon.gif');
+}
+
+
+
+
+
+/*@selection*/
+
+.mif-tree-node-selected .mif-tree-name{
+background-color: #010161;
+color:#fff;
+text-transform:italic;
+}
+
+.mif-tree-highlighter{
+height:18px;
+overflow:hidden;
+width:100%;
+background:#b64553;
+position:absolute;
+}
+
+
+
+/*@d'n'd*/
+.mif-tree-pointer{
+height:1px;
+overflow: hidden;
+position: absolute;
+background-image:url('../assets/images/1.gif');
+background-repeat:repeat-x;
+background-color:#292fef;
+}
+
+
+.mif-tree-ghost{
+background-color:#fff;
+border:solid 2px #e8e8f7;
+padding-left:2px;
+}
+
+.mif-tree-ghost .mif-tree-node-wrapper{
+background:none;
+}
+
+.mif-tree-ghost span.mif-tree-text{
+padding-top:1px;
+padding-bottom:1px;
+}
+
+.mif-tree-ghost-icon{
+padding-left:16px;
+background-color:#fff;
+background-repeat:no-repeat;
+background-image:url('../assets/images/dropzone.gif');
+}
+
+.mif-tree-ghost-after{
+background-position:-64px 2px;
+}
+
+.mif-tree-ghost-before{
+background-position:-48px 2px;
+}
+
+.mif-tree-ghost-between{
+background-position:-16px 2px;
+}
+
+.mif-tree-ghost-inside{
+background-position:-0px 2px;
+}
+
+.mif-tree-ghost-notAllowed{
+background-position:-32px 2px;
+}
+
+.mif-tree-drag-current{
+background-color:#cfcfd8;
+}
+
+.mif-tree-replace{
+background-color:#99c8fb;
+}
+
+
+/*@checkbox*/
+.mif-tree-checkbox{
+padding-left:18px;
+background-image:url('../assets/images/checkboxes.gif');
+background-repeat: no-repeat;
+}
+
+.mif-tree-node-checked{
+background-position:0px center;
+}
+
+.mif-tree-node-unchecked{
+background-position:-18px center;
+}
+
+.mif-tree-node-nochecked{
+background-position:-108px center;
+}
+
+.mif-tree-hover-checkbox .mif-tree-node-checked{
+background-position:-36px center;
+}
+
+.mif-tree-hover-checkbox .mif-tree-node-unchecked{
+background-position:-54px center;
+}
+
+
+
+/*@rename*/
+.mif-tree-rename{
+display: inline;
+line-height: 14px;
+height:14px;
+cursor: default;
+overflow:hidden;
+font-family:sans-serif;
+font-size:11px;
+padding:1px 0;
+border:solid 1px black;
+}
\ No newline at end of file
diff --git a/javascript/mif-tree/Demos/CookieStorage/demo.js b/javascript/mif-tree/Demos/CookieStorage/demo.js
new file mode 100755 (executable)
index 0000000..77de025
--- /dev/null
@@ -0,0 +1,281 @@
+window.addEvent('domready',function(){\r
+\r
+       Mif.Tree.Node.implement({\r
+       \r
+               switchSelect: function(state){\r
+                       this.tree[state ? 'select' : 'unselect'](this);\r
+               }\r
+               \r
+       });\r
+\r
+       tree = new Mif.Tree({\r
+               id: 'tree1',\r
+               container: $('tree_container'),// tree container\r
+               initialize: function(){\r
+                       this.initCheckbox('simple');\r
+                       var storage = new Mif.Tree.CookieStorage(this);\r
+                       var switchStorage = new Mif.Tree.CookieStorage(this, {event: 'switch', action: 'switch'});\r
+                       var selectStorage = new Mif.Tree.CookieStorage(this, {event: 'selectChange', action: 'switchSelect'});\r
+                       this.addEvent('load', function(){\r
+                               storage.restore();\r
+                               switchStorage.restore();\r
+                               selectStorage.restore();\r
+                       }).addEvent('loadChildren', function(){\r
+                               storage.restore();\r
+                               switchStorage.restore();\r
+                               selectStorage.restore();\r
+                       });\r
+               },\r
+               types: {// node types\r
+                       folder: {\r
+                               openIcon: 'mif-tree-open-icon',//css class open icon\r
+                               closeIcon: 'mif-tree-close-icon'// css class close icon\r
+                       }\r
+               },\r
+               dfltType: 'folder',//default node type\r
+               height: 18//node height\r
+       });\r
+       \r
+       tree2 = new Mif.Tree({\r
+               id: 'tree2',\r
+               container: $('tree_container2'),// tree container\r
+               initialize: function(){\r
+                       this.initCheckbox('simple');\r
+                       var storage = new Mif.Tree.CookieStorage(this);\r
+                       var switchStorage = new Mif.Tree.CookieStorage(this, {event: 'switch', action: 'switch'});\r
+                       var selectStorage = new Mif.Tree.CookieStorage(this, {event: 'selectChange', action: 'switchSelect'});\r
+                       this.addEvent('load', function(){\r
+                               storage.restore();\r
+                               switchStorage.restore();\r
+                               selectStorage.restore();\r
+                       }).addEvent('loadChildren', function(){\r
+                               storage.restore();\r
+                               switchStorage.restore();\r
+                               selectStorage.restore();\r
+                       });\r
+               },\r
+               types: {// node types\r
+                       folder: {\r
+                               openIcon: 'mif-tree-open-icon',//css class open icon\r
+                               closeIcon: 'mif-tree-close-icon'// css class close icon\r
+                       }\r
+               },\r
+               dfltType: 'folder',//default node type\r
+               height: 18//node height\r
+       });\r
+       \r
+       var children = [\r
+               {\r
+                       "property": {\r
+                               "name": "cnode1",\r
+                               "id": "cnode1"\r
+                       }\r
+               },\r
+               {\r
+                       "property": {\r
+                               "name": "cnode2",\r
+                               "id": "cnode2"\r
+                       },\r
+                       "children":     [\r
+                               {\r
+                                       "property":{\r
+                                               "name": "cnodeX",\r
+                                               "id": "cnodeXXXX"\r
+                                       }\r
+                               },\r
+                               {\r
+                                       "property":{\r
+                                               "name": "cnodeY",\r
+                                               "id": "cnodeY"\r
+                                       },\r
+                                       "children":[\r
+                                               {\r
+                                                       "property":{\r
+                                                               "name": "cnodeZ",\r
+                                                               "id": "cnodeZ"\r
+                                                       }\r
+                                               },\r
+                                               {\r
+                                                       "property":{\r
+                                                               "name": "cnodeL",\r
+                                                               "id": "cnodeL"\r
+                                                       }\r
+                                               }\r
+                                       ]\r
+                               }\r
+                       ]\r
+               },\r
+               {\r
+                       "property":{\r
+                               "name": "cnode3",\r
+                               "id": "cnode3"\r
+                       }\r
+               }\r
+       ];\r
+\r
+       var json = [\r
+               {\r
+                       "property": {\r
+                               "name": "root",\r
+                               "id": "root"\r
+                       },\r
+                       "children": [\r
+                               {\r
+                                       "property": {\r
+                                               "name": "node1",\r
+                                               "id": "node1"\r
+                                       }\r
+                               },\r
+                               {\r
+                                       "property": {\r
+                                               "name": "node2",\r
+                                               "id": "node2"\r
+                                       },\r
+                                       "children":[\r
+                                               {\r
+                                                       "property": {\r
+                                                               "name": "node2.1",\r
+                                                               "id": "node2.1"\r
+                                                       }\r
+                                               },\r
+                                               {\r
+                                                       "property": {\r
+                                                               "name": "node2.2",\r
+                                                               "id": "node2.2"\r
+                                                       },\r
+                                                       "children":[\r
+                                                               {\r
+                                                                       "property": {\r
+                                                                               "name": "node2.2.1",\r
+                                                                               "id": "node2.2.1"\r
+                                                                       }\r
+                                                               },\r
+                                                               {\r
+                                                                       "property": {\r
+                                                                               "name": "node2.2.2",\r
+                                                                               "id": "node2.2.2"\r
+                                                                       }\r
+                                                               }\r
+                                                       ]\r
+                                               }\r
+                                       ]\r
+                               },\r
+                               {\r
+                                       "property": {\r
+                                               "name": "node4",\r
+                                               "id": "node4"\r
+                                       },\r
+                                       "children":     [\r
+                                               {\r
+                                                       "property":{\r
+                                                               "name": "nodeX",\r
+                                                               "id": "nodeXXXX"\r
+                                                       }\r
+                                               },\r
+                                               {\r
+                                                       "property":{\r
+                                                               "name": "nodeY",\r
+                                                               "id": "nodeY"\r
+                                                       }\r
+                                               }\r
+                                       ]\r
+                               },\r
+                               {\r
+                                       "property": {\r
+                                               "name": "node3 loadable",\r
+                                               "id": "node3",\r
+                                               "loadable": true,\r
+                                               "loadOptions": {"json": children}\r
+                                       }\r
+                               }\r
+                       ]\r
+               }\r
+       ];\r
+       \r
+       var json2 = [\r
+               {\r
+                       "property": {\r
+                               "name": "root",\r
+                               "id": "root_2"\r
+                       },\r
+                       "children": [\r
+                               {\r
+                                       "property": {\r
+                                               "name": "node1",\r
+                                               "id": "node1_2"\r
+                                       }\r
+                               },\r
+                               {\r
+                                       "property": {\r
+                                               "name": "node2",\r
+                                               "id": "node2_2"\r
+                                       },\r
+                                       "children":[\r
+                                               {\r
+                                                       "property": {\r
+                                                               "name": "node2.1",\r
+                                                               "id": "node2.1_2"\r
+                                                       }\r
+                                               },\r
+                                               {\r
+                                                       "property": {\r
+                                                               "name": "node2.2",\r
+                                                               "id": "node2.2_2"\r
+                                                       },\r
+                                                       "children":[\r
+                                                               {\r
+                                                                       "property": {\r
+                                                                               "name": "node2.2.1",\r
+                                                                               "id": "node2.2.1_2"\r
+                                                                       }\r
+                                                               },\r
+                                                               {\r
+                                                                       "property": {\r
+                                                                               "name": "node2.2.2",\r
+                                                                               "id": "node2.2.2_2"\r
+                                                                       }\r
+                                                               }\r
+                                                       ]\r
+                                               }\r
+                                       ]\r
+                               },\r
+                               {\r
+                                       "property": {\r
+                                               "name": "node4",\r
+                                               "id": "node4_2"\r
+                                       },\r
+                                       "children":     [\r
+                                               {\r
+                                                       "property":{\r
+                                                               "name": "nodeX",\r
+                                                               "id": "nodeXXXX_2"\r
+                                                       }\r
+                                               },\r
+                                               {\r
+                                                       "property":{\r
+                                                               "name": "nodeY",\r
+                                                               "id": "nodeY_2"\r
+                                                       }\r
+                                               }\r
+                                       ]\r
+                               },\r
+                               {\r
+                                       "property": {\r
+                                               "name": "node3 loadable",\r
+                                               "id": "node3_2"\r
+                                       }\r
+                               }\r
+                       ]\r
+               }\r
+       ];\r
+       \r
+       // load tree from json.\r
+       tree.load({\r
+               json: json\r
+       });\r
+       \r
+       tree2.load({\r
+               json: json2\r
+       });\r
+       \r
+});
\ No newline at end of file
diff --git a/javascript/mif-tree/Demos/CookieStorage/index.html b/javascript/mif-tree/Demos/CookieStorage/index.html
new file mode 100755 (executable)
index 0000000..4761b1c
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+       <link rel="stylesheet" href="../assets/styles/demos.css" type="text/css" />
+       <link rel="stylesheet" href="demo.css" type="text/css" />
+       <script type="text/javascript" src="../../mootools-core-1.3.2-full-nocompat.js"></script>
+       <script type="text/javascript" src="../../mootools-more-1.3.2.1.js"></script>
+       <script type="text/javascript" src="../../mif.tree_for-mt-1.3.2.js"></script>
+       <script type="text/javascript" src="demo.js"></script>
+       <title>Mif.Tree Demo</title>
+</head>
+<body>
+       <h1>Cookie Storage example</h1>
+       <div id="tree_container"></div>
+       <div id="tree_container2"></div>
+       <p>
+               <a href="../index.html">Back</a>
+       </p>
+</body>
+</html>
index 2882041bb13e81fabd95ff8651ca095a878cfa04..ddaf1b4a18062511520696ee078a1634451a6c0e 100755 (executable)
@@ -40,6 +40,7 @@
                                        <li><a href="AddNode/index.html">Add node</a></li>
                                        <li><a href="AddNode2/index.html">Another add node demo</a></li>
                                        <li><a href="reloadChildren/index.html">reload children and update clicked node name</a></li>
+                                       <li><a href="CookieStorage/index.html">cookie storage</a></li>
                                </ul>
                        </div>
                        <div id="footer">