Skip to content
This repository
Browse code

Initial ExtJS loader test program

  • Loading branch information...
commit 6b1744e2361b96629fcc08d26dab51cbb78afc52 1 parent e3f13b7
Christoph Dorn authored December 01, 2011
12  programs/extjs-loader-test/README.md
Source Rendered
... ...
@@ -0,0 +1,12 @@
  1
+
  2
+
  3
+Usage
  4
+=====
  5
+
  6
+    commonjs --script serve ./ -v ./
  7
+
  8
+    
  9
+Links
  10
+=====
  11
+
  12
+  * http://www.sencha.com/learn/sencha-class-system
29  programs/extjs-loader-test/package.json
... ...
@@ -0,0 +1,29 @@
  1
+{
  2
+    "uid": "http://github.com/pinf/loader-js/programs/extjs-loader-test/",
  3
+    "main": "server.js",
  4
+    "directories": {
  5
+        "lib": ""
  6
+    },
  7
+    "scripts": {
  8
+        "serve": {
  9
+            "id": "github.com/pinf/server-js/"
  10
+        }
  11
+    },
  12
+    "mappings": {
  13
+        "pinf": {
  14
+            "id": "pinf.org/loader/"
  15
+        },
  16
+        "nodejs": {
  17
+            "id": "nodejs.org/"
  18
+        },
  19
+        "modules": {
  20
+            "id": "github.com/pinf/modules-js/"
  21
+        },
  22
+        "server": {
  23
+            "id": "github.com/pinf/server-js/"
  24
+        },
  25
+        "extjs4": {
  26
+            "id": "sencha.com/products/extjs4/"
  27
+        }
  28
+    }
  29
+}
28  programs/extjs-loader-test/program.json
... ...
@@ -0,0 +1,28 @@
  1
+{
  2
+    "extends": [
  3
+        {
  4
+            "location": "https://raw.github.com/pinf/server-js/v0.1.19/program.packages.json"
  5
+        },
  6
+        {
  7
+            "location": "./program.packages.json"
  8
+        }
  9
+    ],
  10
+    "boot": "github.com/pinf/loader-js/programs/extjs-loader-test/",
  11
+    "implements": {
  12
+        "github.com/pinf/server-js/-meta/strawman/vhost/0.1": {
  13
+        }
  14
+    },
  15
+    "packages": {
  16
+        "github.com/pinf/loader-js/programs/extjs-loader-test/": {
  17
+            "locator": {
  18
+                "location": "./"
  19
+            }
  20
+        },
  21
+        "github.com/pinf/server-js/": {
  22
+            "locator": {
  23
+                "location": false,
  24
+                "archive": "https://github.com/pinf/server-js/zipball/v0.1.19"
  25
+            }
  26
+        }
  27
+    }
  28
+}
10  programs/extjs-loader-test/program.packages.json
... ...
@@ -0,0 +1,10 @@
  1
+{
  2
+    "packages": {
  3
+        "sencha.com/products/extjs4/": {
  4
+            "locator": {
  5
+                "archive": "http://extjs.cachefly.net/ext-4.0.2-commercial.zip",
  6
+                "resource": true
  7
+            }
  8
+        }
  9
+    }
  10
+}
36  programs/extjs-loader-test/server.js
... ...
@@ -0,0 +1,36 @@
  1
+
  2
+var JSGI = require("server/vendor/connect/middleware/jsgi"),
  3
+    JSGI_RELOAD = require("server/jsgi/reload"),
  4
+    PROGRAM_SERVER = require("pinf/program-server"),
  5
+    FILE = require("modules/file");
  6
+
  7
+exports.main = function(options)
  8
+{
  9
+    var CONNECT = options.stacks.connect.instance;
  10
+
  11
+    console.log("ExtJS source root path: " + require.pkg("extjs4").id());
  12
+    
  13
+    options.stacks.connect.start(
  14
+
  15
+        CONNECT()
  16
+	
  17
+	        .use('/extjs4', CONNECT.static(require.pkg("extjs4").id(), {
  18
+	            maxAge: 0
  19
+	        }))
  20
+	        .use('/ui', JSGI.jsgi(
  21
+	            new PROGRAM_SERVER.JSGI({
  22
+		            map: {
  23
+		                "/ui.js": {
  24
+		                    programPath: FILE.dirname(module.id) + "/ui/program.json"
  25
+		                }
  26
+		            },
  27
+		            trackRoutes: true
  28
+		        }).responder(null)
  29
+		    ))
  30
+	        .use('/', CONNECT.static(FILE.dirname(module.id) + "/www", {
  31
+	            maxAge: 0
  32
+	        }))
  33
+    );
  34
+
  35
+    module.print("Program server started! You can now browse to: http://localhost:" + options.port + "/\n");
  36
+}
60  programs/extjs-loader-test/ui/main.js
... ...
@@ -0,0 +1,60 @@
  1
+
  2
+exports.main = function(env)
  3
+{
  4
+
  5
+	
  6
+	Ext.require('Ext.tab.*');
  7
+
  8
+	Ext.onReady(function(){
  9
+	    // basic tabs 1, built from existing content
  10
+	    var tabs = Ext.createWidget('tabpanel', {
  11
+	        renderTo: 'tabs1',
  12
+	        width: 450,
  13
+	        activeTab: 0,
  14
+	        defaults :{
  15
+	            bodyPadding: 10
  16
+	        },
  17
+	        items: [{
  18
+	            contentEl:'script', 
  19
+	            title: 'Short Text',
  20
+	            closable: true
  21
+	        },{
  22
+	            contentEl:'markup', 
  23
+	            title: 'Long Text'
  24
+	        }]
  25
+	    });
  26
+	    
  27
+	    // second tabs built from JS
  28
+	    var tabs2 = Ext.createWidget('tabpanel', {
  29
+	        renderTo: document.body,
  30
+	        activeTab: 0,
  31
+	        width: 600,
  32
+	        height: 250,
  33
+	        plain: true,
  34
+	        defaults :{
  35
+	            autoScroll: true,
  36
+	            bodyPadding: 10
  37
+	        },
  38
+	        items: [{
  39
+	                title: 'Normal Tab',
  40
+	                html: "My content was added during construction."
  41
+	            },{
  42
+	                title: 'Event Tab',
  43
+	                listeners: {
  44
+	                    activate: function(tab){
  45
+	                        alert(tab.title + ' was activated.');
  46
+	                    }
  47
+	                },
  48
+	                html: "I am tab 4's content. I also have an event listener attached."
  49
+	            },{
  50
+	                title: 'Disabled Tab',
  51
+	                disabled: true,
  52
+	                html: "Can't see me cause I'm disabled"
  53
+	            }
  54
+	        ]
  55
+	    });
  56
+	});
  57
+
  58
+
  59
+}
  60
+
9  programs/extjs-loader-test/ui/package.json
... ...
@@ -0,0 +1,9 @@
  1
+{
  2
+    "uid": "http://github.com/pinf/loader-js/programs/extjs-loader-test/ui/",
  3
+    "main": "main.js",
  4
+    "mappings": {
  5
+        "extjs4": {
  6
+            "id": "sencha.com/products/extjs4/"
  7
+        }
  8
+    }
  9
+}
18  programs/extjs-loader-test/ui/program.json
... ...
@@ -0,0 +1,18 @@
  1
+{
  2
+    "extends": {
  3
+        "location": "../program.packages.json"
  4
+    },
  5
+    "boot": "github.com/pinf/loader-js/programs/extjs-loader-test/ui/",
  6
+    "contexts": {
  7
+        "top": {
  8
+            "github.com/pinf/loader-js/programs/extjs-loader-test/ui/": {}
  9
+        }
  10
+    },
  11
+    "packages": {
  12
+        "github.com/pinf/loader-js/programs/extjs-loader-test/ui/": {
  13
+            "locator": {
  14
+                "location": "./"
  15
+            }
  16
+        }
  17
+    }
  18
+}
47  programs/extjs-loader-test/www/index.html
... ...
@@ -0,0 +1,47 @@
  1
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2
+<html>
  3
+<head>
  4
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5
+    <title>ExtJS PINF Loader Test</title>
  6
+    <link rel="stylesheet" type="text/css" href="/extjs4/resources/css/ext-all.css" />
  7
+    <script type="text/javascript" src="/extjs4/ext-all.js"></script>
  8
+    <script type="text/javascript" src="/ui.js"></script>
  9
+    <style>
  10
+        .list {
  11
+            padding-left: 16px;
  12
+            padding-bottom: 10px;
  13
+        }
  14
+        .list li{
  15
+            list-style: square;
  16
+            padding: 2px;
  17
+        }
  18
+        
  19
+        pre {
  20
+            font-size: 11px; 
  21
+        }    
  22
+    </style>
  23
+</head>
  24
+<body>
  25
+
  26
+    <div id="tabs1">
  27
+        <div id="script" class="x-hide-display">
  28
+            <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate 
  29
+            eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus.
  30
+            <br/><br/> 
  31
+            Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis 
  32
+            vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.</p>
  33
+        </div>
  34
+        <div id="markup" class="x-hide-display">
  35
+            <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate 
  36
+            eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. 
  37
+            Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis 
  38
+            vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.
  39
+            <br/><br/>
  40
+            Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, 
  41
+            adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget 
  42
+            quam. Vivamus tincidunt diam nec urna. Curabitur velit.</p>
  43
+        </div>
  44
+    </div>
  45
+
  46
+</body>
  47
+</html>

0 notes on commit 6b1744e

Please sign in to comment.
Something went wrong with that request. Please try again.