Author: jmorliaguet Date: Sun Feb 12 15:54:34 2006 New Revision: 2366 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chat.css (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chatinput.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt Log:
- updated the chat demo to make it work with templates Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chat.css ============================================================================== --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chat.css Sun Feb 12 15:54:34 2006 @@ -0,0 +1,55 @@ + +div.chatbox { + padding: 0.5em; + border: 1px solid #999; + background-color: #cd9; +} + +form { + border: 1px solid #ccc; + background-color: #eee; + padding: 0.7em; + margin: 1em 0; +} + +label { + font: 14px arial, sans-serif; +} + +input { + border: 1px solid #999; + padding: 0.2em; + margin: 0 1em 0 0; + font: 14px arial, sans-serif; +} + +input:focus { + background-color: #efc; +} + +button { + background-color: #efc; + border: 1px solid #999; + padding: 0.2em; + margin: 0 1em 0 0; + font: 15px arial, sans-serif; +} + +div.message { + border: 1px solid #999; + background-color: #efc; + padding: 0.5em; + margin: 0.2em; + font: 13px arial, sans-serif; +} + +div.status { + border: 1px solid #000; + background-color: #fc0; + padding: 0.5em; + margin: 0.3em 0; + margin-bottom: 1em; + position: absolute; + top: 40px; + right: 20px; +} Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chatinput.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chatinput.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/chatinput.pt Sun Feb 12 15:54:34 2006 @@ -1,3 +1,18 @@ -<form method="post"> - not done yet +<form action="" method="post" onsubmit="return false"> + + <div class="status" ctal:condition="status" + ctal:content="status">status message</div> + + <input type="hidden" name="status" value="Sending message..." /> + + <label>Your message: + <input id="messagearea" type="text" name="input" size="40" /> + </label> + + <label>Chat as: + <input type="text" name="user" ctal:attributes="value user" /> + </label> + + <button type="submit">SEND!</button> + </form> Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/configure.zcml Sun Feb 12 15:54:34 2006 @@ -1,9 +1,13 @@ <configure xmlns:browser="http://namespaces.zope.org/browser"> + <browser:resource + name="chat.css" file="chat.css" + layer="cpsskins-test" /> + <browser:page for="*" - layer="cpsskins" + layer="cpsskins-test" name="cpsskins_chat.html" permission="zope.Public" template="cpsskins_chat.pt" @@ -11,22 +15,22 @@ <browser:page for="*" - layer="cpsskins" - name="chatinput.html" + layer="cpsskins-test" + name="chatbox.html" permission="zope.Public" - template="chatinput.pt" + template="chatbox.pt" /> <browser:page for="*" - layer="cpsskins" - name="chatbox.html" + layer="cpsskins-test" + name="chatinput.html" permission="zope.Public" - template="chatbox.pt" + template="chatinput.pt" /> <browser:pages - layer="cpsskins" + layer="cpsskins-test" for="*" class=".browser.Views" permission="zope.Public"> Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt Sun Feb 12 15:54:34 2006 @@ -16,134 +16,8 @@ <link rel="stylesheet" type="text/css" href="/++skin++cpsskins/@@/++resource++cpsskins.css" /> - <style type="text/css"> - div.chatbox { - padding: 0.5em; - border: 1px solid #999; - background-color: #cd9; - } - - form { - padding: 1em 0; - } - - input { - border: 1px solid #999; - padding: 0.2em; - margin: 0 1em 0 0; - font: 15px verdana, arial, sans-serif; - } - - input:focus { - background-color: #efc; - } - - button { - background-color: #efc; - border: 1px solid #999; - padding: 0.2em; - margin: 0 1em 0 0; - font: 15px arial, sans-serif; - } - - div.message { - border: 1px solid #999; - background-color: #efc; - padding: 0.5em; - margin: 0.2em; - font: 13px verdana, arial, sans-serif; - } - - div.status { - border: 1px solid #000; - background-color: #fc0; - padding: 0.5em; - margin: 0.3em 0; - margin-bottom: 1em; - position: absolute; - top: 40px; - right: 20px; - } - - </style> - - <script type="text/javascript"> - - Object.extend(Widgets, { - - inputbox: function(def) { - var widget = Canvas.createNode({ - tag: "form", - classes: "inputbox", - attributes: {"method": "post"} - }); - return new InputBox(widget, def); - } - - }); - - InputBox = Class.create(); - InputBox.prototype = Object.extend(new CPSSkins.View(), { - - render: function(data) { - var widget = this.widget; - widget.innerHTML = ''; - - var status = data.status; - if (status) { - var statusbox = Canvas.createNode({ - tag: "div", - classes: "status", - text: status - }); - widget.appendChild(statusbox); - } - - var input = Canvas.createNode({ - tag: "input", - attributes: { - "name": "input", - "type": "text" - }, - "style": {"width": "400px"} - }); - widget.appendChild(input); - - var user = Canvas.createNode({ - tag: "input", - attributes: { - "name": "user", - "type": "text", - "value": data.user || "Guest" - } - }); - widget.appendChild(user); - - var status = Canvas.createNode({ - tag: "input", - attributes: { - "type": "hidden", - "name": "status", - "value": "Sending message ..." - } - }); - widget.appendChild(status); - - var button = Canvas.createNode({ - tag: "button", - attributes: { - "type": "submit" - }, - text: "SEND!" - }); - widget.appendChild(button); - - Form.focusFirstElement(widget); - } - - }); - - </script> + <link rel="stylesheet" type="text/css" + href="/++skin++cpsskins-test/@@/++resource++chat.css" /> </head> <body> @@ -258,7 +132,7 @@ <ins class="view"> {"widget": { - "type": "inputbox" + "template": "chatinput.html" }, "model": "form", "controller": "form-controller" -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins