changeset 346:f05634287ac7

working on the view concept
author cin
date Mon, 30 Sep 2013 01:37:50 +0400
parents 72799d1211c5
children 3eafa6fefa9f
files Lib/IMPL/Web/View/TTContext.pm Lib/IMPL/Web/View/TTControl.pm _test/Resources/TTView.Output/Panel.txt _test/Resources/TTView.Output/complex.default.txt _test/Resources/TTView.Output/derived.txt _test/Resources/TTView.Output/simple.txt _test/Resources/TTView/Layout/default.tt _test/Resources/TTView/Layout/print.tt _test/Resources/TTView/My/Org/Base.tt _test/Resources/TTView/My/Org/Derived.tt _test/Resources/TTView/My/Org/Derived2.tt _test/Resources/TTView/My/Org/Panel.tt _test/Resources/TTView/My/Org/TextPreview.tt _test/Resources/TTView/complex.tt _test/Resources/TTView/derived.tt _test/Resources/TTView/global.tt _test/Resources/TTView/simple.tt _test/Resources/view/packages/dojo/form/Button.tt _test/Resources/view/packages/dojo/form/Form.tt _test/Resources/view/site/index.tt _test/Resources/view/site/product/_base.tt _test/Resources/view/site/product/create.tt _test/Resources/view/site/product/edit.tt _test/Resources/view/site/product/view.tt _test/Resources/view/site/product/view.tt.labels nohup.out
diffstat 25 files changed, 63 insertions(+), 186 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/TTContext.pm	Fri Sep 27 16:28:27 2013 +0400
+++ b/Lib/IMPL/Web/View/TTContext.pm	Mon Sep 30 01:37:50 2013 +0400
@@ -87,60 +87,30 @@
 
 @startuml
 
-object FooContext {
-	document
-	this
-	model
-}
-
-object BarContext {
+object SharedContext {
     document
-    this
-    model
-}
-
-object FooFactoryContext {
-	require = function(){}
-	include = function(){}
-	labels = {...}
-	base = "my/app/view"
-	extends = "my/app/view/bar"
-}
-
-object BarFactoryContext {
-	require = function(){}
-	include = function(){}
-	base = "my/app/view"
-	labels = {...}
-	extends = undefined
-}
-
-object RegistryContext {
-	registry
-}
-
-object DocumentFactoryContext {
-	require = function() {}
-    include = function() {}
-    labels = {...}
-    base = ""
-    extends = undefined
+    globals
 }
 
 object DocumentContext {
-	this
+    base
+    extends
+}
+
+object ControlContext {
+    base
+    extends
 }
 
-FooFactoryContext --o BarFactoryContext
-BarFactoryContext --o RegistryContext
+SharedContext o-- DocumentContext 
+SharedContext o-- ControlContext 
 
-FooContext -right-o FooFactoryContext
-BarContext -right-o BarFactoryContext
+Document -- DocumentContext
+Control - ControlContext
 
-DocumentFactoryContext -up-o RegistryContext
-DocumentContext -left-o DocumentFactoryContext
-
-Document --> DocumentContext
+Loader . SharedContext: <<creates>>
+Loader . Document: <<creates>>
+Loader -up- Registry
 
 @enduml
 
--- a/Lib/IMPL/Web/View/TTControl.pm	Fri Sep 27 16:28:27 2013 +0400
+++ b/Lib/IMPL/Web/View/TTControl.pm	Mon Sep 30 01:37:50 2013 +0400
@@ -19,7 +19,8 @@
 	   id => PROP_RO,
 	   attributes => PROP_RW,
 	   context => PROP_RO,
-	   template => PROP_RO
+	   template => PROP_RO,
+	   parents => PROP_RO
 	]
 };
 
--- a/_test/Resources/TTView.Output/Panel.txt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<div class="simple" data-dojo-type="dijit.form.Input">
-                <div data-dojo-type="dijit.layout.ContentPane">one</div>
-        <hr />
-                <div data-dojo-type="dijit.layout.ContentPane">two</div>
-        <hr />
-                <div data-dojo-type="dijit.layout.ContentPane">hello world</div>
-        <hr />
-    </div>
\ No newline at end of file
--- a/_test/Resources/TTView.Output/complex.default.txt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<html>
-    <head>
-        <title>Test Site - my document 2</title>
-                <script type="text/javascript">
-            require([ "dijit.form.Input", "dijit.layout.ContentPane" ]);
-        </script>
-            </head>
-    <body>
-            <div><div class="classic" data-dojo-type="dijit.form.Input">
-                <div data-dojo-type="dijit.layout.ContentPane">one</div>
-        <hr />
-                <div data-dojo-type="dijit.layout.ContentPane">two</div>
-        <hr />
-                <div data-dojo-type="dijit.layout.ContentPane">three</div>
-        <hr />
-    </div></div>
-    </body>
-</html>
\ No newline at end of file
--- a/_test/Resources/TTView.Output/derived.txt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-BEGIN DERIVED 2 DOCUMENT
-BEGIN DERIVED DOCUMENT
-BEGIN BASE DOCUMENT
-LABEL: derived 2 label
-base document body
-FOOTER: base footer
-END OF BASE DOCUMENT
-END OF DERIVED DOCUMENT
-END OF DERIVED 2 DOCUMENTEND OF DOCUMENT
\ No newline at end of file
--- a/_test/Resources/TTView.Output/simple.txt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-test_user - Документ 1
\ No newline at end of file
--- a/_test/Resources/TTView/Layout/default.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-[% view.mode = 'default' %]
-[%
-    BLOCK INIT;
-        dojo = { require => [] };
-    END;
-%]
-<html>
-    <head>
-        <title>$site.name - [% document.title || template.title %]</title>
-        [% IF dojo.require.size;
-            modules = [];
-            modules.push('"' _ item _ '"') FOREACH item IN dojo.require.unique();
-        %]
-        <script type="text/javascript">
-            require([ [% modules.join(', ') %] ]);
-        </script>
-        [% END %]
-    </head>
-    <body>
-        [% content %]
-    </body>
-</html>
\ No newline at end of file
--- a/_test/Resources/TTView/My/Org/Base.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-[% BLOCK LABEL %]
-base label
-[% END %]
-[% BLOCK FOOTER %]
-base footer
-[% END %]
-BEGIN BASE DOCUMENT
-LABEL: [% INCLUDE LABEL %]
-base document body
-FOOTER: [% INCLUDE FOOTER %]
-END OF BASE DOCUMENT
--- a/_test/Resources/TTView/My/Org/Derived.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-[% META extends='./Base' %]
-[% BLOCK LABEL %]
-derived label
-[% END %]
-BEGIN DERIVED DOCUMENT
-[% INCLUDE BASE %]
-END OF DERIVED DOCUMENT
--- a/_test/Resources/TTView/My/Org/Derived2.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-[% META extends='./Derived'%]
-[% BLOCK LABEL %]
-derived 2 label
-[% END %]
-BEGIN DERIVED 2 DOCUMENT
-[% INCLUDE BASE %]
-END OF DERIVED 2 DOCUMENT
\ No newline at end of file
--- a/_test/Resources/TTView/My/Org/Panel.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-[%
-    META version = 1;
-    BLOCK INIT;
-    # this is a document scope
-        dojoDefaultClass = 'dijit.form.Input'; 
-        dojo.require.push( dojoDefaultClass );
-    END;
-    
-    TPreview = require('My/Org/TextPreview');
-    this.dojoClass = this.dojoClass || dojoDefaultClass;
-    this.visualClass = this.visualClass || 'classic';
-    this.childNodes = [];
-    FOREACH text IN this.data;
-        this.childNodes.push( TPreview.new(nodeValue = text ) );
-    END;
-    
-%]
-<div class="$this.visualClass" data-dojo-type="$this.dojoClass">
-    [% FOREACH node IN this.childNodes %]
-        [% node.Render() %]
-        <hr />
-    [% END %]
-</div>
\ No newline at end of file
--- a/_test/Resources/TTView/My/Org/TextPreview.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-[%
-    BLOCK INIT;
-        dojo.require.push("dijit.layout.ContentPane");
-    END;
-%]
-<div data-dojo-type="dijit.layout.ContentPane">$this.nodeValue</div>
\ No newline at end of file
--- a/_test/Resources/TTView/complex.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-[%
-    META version = 1, title = "my document 2", layout="default";
-
-    TPanel = require('My/Org/Panel');
-    this.childNodes = [ TPanel.new(data = data ) ];
-
-%]
-[% FOREACH node IN this.childNodes() %]
-	<div>[% node.Render() %]</div>
-[% END %]
--- a/_test/Resources/TTView/derived.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-[%
-    Ctl = require('My/Org/Derived2');
-    
-    Ctl.Render( model = { id = '23f0', text = 'test' } );
-%]
-END OF DOCUMENT
\ No newline at end of file
--- a/_test/Resources/TTView/global.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-[% META version = 1;
-
-    user = 'test_user';
-    dojo.require = [];
-
-%]
\ No newline at end of file
--- a/_test/Resources/TTView/simple.tt	Fri Sep 27 16:28:27 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-[% META title = "Документ 1", version = 10 %]
-[% BLOCK CTOR;
-    templateVar = "initialized by the constructor";
-END; %]
-$user - $template.title
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Resources/view/packages/dojo/form/Button.tt	Mon Sep 30 01:37:50 2013 +0400
@@ -0,0 +1,6 @@
+[%
+    dojo = require('dojo/base');
+    dojo.require('dijit/form/Button');
+    dojo.instantiate(this);
+%]
+<input id='$this.id' type='button' value='$this.title' />
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Resources/view/packages/dojo/form/Form.tt	Mon Sep 30 01:37:50 2013 +0400
@@ -0,0 +1,9 @@
+[% META class='IMPL::Web::View::TTForm';
+ 
+    dojo = require('dojo/base');
+    dojo.require('dijit/form/Form');
+    
+%]
+<form id="$this.id" method="$this.method" action="$this.action">
+    $content
+</form>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Resources/view/site/index.tt	Mon Sep 30 01:37:50 2013 +0400
@@ -0,0 +1,1 @@
+<h1>hello</h1>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Resources/view/site/product/_base.tt	Mon Sep 30 01:37:50 2013 +0400
@@ -0,0 +1,8 @@
+[%
+    document.menu = [
+        { title = Edit, href = location.edit },
+        { title = View, href = location.view },
+        { title = Create, href = container.create },
+        { title = List, href = container }
+    ];
+%]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Resources/view/site/product/create.tt	Mon Sep 30 01:37:50 2013 +0400
@@ -0,0 +1,3 @@
+<h1>New object</h1>
+[% display('name') %]
+[% display('address','address_group') %]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Resources/view/site/product/edit.tt	Mon Sep 30 01:37:50 2013 +0400
@@ -0,0 +1,1 @@
+[% display(form) %]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Resources/view/site/product/view.tt	Mon Sep 30 01:37:50 2013 +0400
@@ -0,0 +1,10 @@
+[% display('name') %]
+[% display('description') %]
+<div>
+    <div>
+        $AddressLabel
+    </div>
+    <div>
+        [% display('address', 'templates/My_App_Model_Address', { nolinks => 1 } ) %]
+    </div>
+</div>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Resources/view/site/product/view.tt.labels	Mon Sep 30 01:37:50 2013 +0400
@@ -0,0 +1,1 @@
+AddressLabel = Address
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nohup.out	Mon Sep 30 01:37:50 2013 +0400
@@ -0,0 +1,6 @@
+Oracle VM VirtualBox Headless Interface 4.2.6
+(C) 2008-2012 Oracle Corporation
+All rights reserved.
+
+VRDE server is listening on port 5002.
+VRDE server is inactive.