You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2013/04/26 19:10:18 UTC

svn commit: r1476299 - in /myfaces/tobago/trunk/tobago-example: tobago-example-addressbook-cdi/src/main/webapp/auth/ tobago-example-addressbook/src/main/webapp/auth/ tobago-example-demo/src/main/webapp/ tobago-example-demo/src/main/webapp/WEB-INF/ toba...

Author: lofwyr
Date: Fri Apr 26 17:10:13 2013
New Revision: 1476299

URL: http://svn.apache.org/r1476299
Log:
TOBAGO-1171: Support for the Content Security Policy (CSP)
TOBAGO-1219: Evaluate jQuery UI Widget Factory
TOBAGO-1258: New attribute "omit" for commands

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/demo.js
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/auth/login.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02-sheet/sheet.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03-tree/02-editor/tree-editor.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-object/object.xhtml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/auth/login.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/auth/login.xhtml?rev=1476299&r1=1476298&r2=1476299&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/auth/login.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-addressbook-cdi/src/main/webapp/auth/login.xhtml Fri Apr 26 17:10:13 2013
@@ -45,13 +45,13 @@
         </f:facet>
         <tc:out value="#{bundle.loginIntro}"/>
         <tc:link label="guest/guest" image="image/org/tango-project/tango-icon-theme/16x16/apps/system-users.png"
-                 onclick="/* fixme: avoid submit */">
+                 omit="true">
           <tc:dataAttribute name="login" value='{"username": "guest", "password": "guest"}'/>
         </tc:link>
 
         <tc:cell/>
         <tc:link label="admin/admin" image="image/org/tango-project/tango-icon-theme/16x16/apps/system-users.png"
-                 onclick="/* fixme: avoid submit */">
+                 omit="true">
           <tc:dataAttribute name="login" value='{"username": "admin", "password": "admin"}'/>
         </tc:link>
       </tc:panel>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml?rev=1476299&r1=1476298&r2=1476299&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml Fri Apr 26 17:10:13 2013
@@ -44,13 +44,13 @@
         </f:facet>
         <tc:out value="#{bundle.loginIntro}"/>
         <tc:link label="guest/guest" image="image/org/tango-project/tango-icon-theme/16x16/apps/system-users.png"
-                 onclick="/* fixme: avoid submit */">
+                 omit="true">
           <tc:dataAttribute name="login" value='{"username": "guest", "password": "guest"}'/>
         </tc:link>
 
         <tc:cell/>
         <tc:link label="admin/admin" image="image/org/tango-project/tango-icon-theme/16x16/apps/system-users.png"
-                 onclick="/* fixme: avoid submit */">
+                 omit="true">
           <tc:dataAttribute name="login" value='{"username": "admin", "password": "admin"}'/>
         </tc:link>
       </tc:panel>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml?rev=1476299&r1=1476298&r2=1476299&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml Fri Apr 26 17:10:13 2013
@@ -23,6 +23,9 @@
                 xmlns:ui="http://java.sun.com/jsf/facelets">
   <f:view locale="#{clientConfigController.locale}">
     <tc:page applicationIcon="icon/favicon.ico" label="#{overviewBundle.pageTitle} - #{title}" id="page">
+
+      <tc:script file="demo.js"/>
+
       <f:facet name="resize">
         <tc:command immediate="true"/>
       </f:facet>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml?rev=1476299&r1=1476298&r2=1476299&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml Fri Apr 26 17:10:13 2013
@@ -45,11 +45,10 @@
   <resource-dir>tobago-resource</resource-dir>
 
 <!-- uncomment this to enable CSP -->
-<!--
   <content-security-policy>
     <directive>default-src 'self'</directive>
+    <directive>frame-src http://maps.google.com</directive>
   </content-security-policy>
--->
 
 <!-- this may be an alternative way to define (not implemented)
   <content-security-policy>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02-sheet/sheet.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02-sheet/sheet.xhtml?rev=1476299&r1=1476298&r2=1476299&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02-sheet/sheet.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02-sheet/sheet.xhtml Fri Apr 26 17:10:13 2013
@@ -155,7 +155,8 @@
       <tc:column label="#{overviewBundle.solarArrayOrbit}" sortable="true" id="orbit">
         <f:facet name="dropDownMenu">
           <tc:menu>
-            <tc:menuCommand onclick="alert('Not implemented yet, only in Tobago 1.0.x')">
+            <tc:menuCommand omit="true">
+              <tc:dataAttribute name="alert-text" value="Not implemented yet, only in Tobago 1.0.x"/>
             </tc:menuCommand>
           </tc:menu>
         </f:facet>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03-tree/02-editor/tree-editor.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03-tree/02-editor/tree-editor.xhtml?rev=1476299&r1=1476298&r2=1476299&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03-tree/02-editor/tree-editor.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03-tree/02-editor/tree-editor.xhtml Fri Apr 26 17:10:13 2013
@@ -32,12 +32,24 @@
     <tc:toolBar iconSize="off">
       <tc:toolBarCommand label="New" action="#{treeEditor.create}"/>
       <tc:toolBarCommand label="Delete" action="#{treeEditor.delete}"/>
-      <tc:toolBarCommand label="Edit" onclick="alert('Not implemented yet')"/>
-      <tc:toolBarCommand label="Cut" onclick="alert('Not implemented yet')"/>
-      <tc:toolBarCommand label="Copy" onclick="alert('Not implemented yet')"/>
-      <tc:toolBarCommand label="Paste" onclick="alert('Not implemented yet')"/>
-      <tc:toolBarCommand label="Up" onclick="alert('Not implemented yet')"/>
-      <tc:toolBarCommand label="Down" onclick="alert('Not implemented yet')"/>
+      <tc:toolBarCommand label="Edit" omit="true">
+        <tc:dataAttribute name="alert-text" value="Not implemented yet"/>
+      </tc:toolBarCommand>
+      <tc:toolBarCommand label="Cut" omit="true">
+        <tc:dataAttribute name="alert-text" value="Not implemented yet"/>
+      </tc:toolBarCommand>
+      <tc:toolBarCommand label="Copy" omit="true">
+        <tc:dataAttribute name="alert-text" value="Not implemented yet"/>
+      </tc:toolBarCommand>
+      <tc:toolBarCommand label="Paste" omit="true">
+        <tc:dataAttribute name="alert-text" value="Not implemented yet"/>
+      </tc:toolBarCommand>
+      <tc:toolBarCommand label="Up" omit="true">
+        <tc:dataAttribute name="alert-text" value="Not implemented yet"/>
+      </tc:toolBarCommand>
+      <tc:toolBarCommand label="Down" omit="true">
+        <tc:dataAttribute name="alert-text" value="Not implemented yet"/>
+      </tc:toolBarCommand>
     </tc:toolBar>
 
     <tc:tree id="tree"

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml?rev=1476299&r1=1476298&r2=1476299&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml Fri Apr 26 17:10:13 2013
@@ -81,8 +81,12 @@
                            label="#{overviewBundle.toolbar_dropDownAction}">
           <f:facet name="dropDownMenu">
             <tc:menu>
-              <tc:menuCommand onclick="alert('test 1')" label="Alert 1"/>
-              <tc:menuCommand onclick="alert('test 2')" label="Alert 2"/>
+              <tc:menuCommand label="Alert 1" omit="true">
+                  <tc:dataAttribute name="alert-text" value="Test 1"/>
+              </tc:menuCommand>
+              <tc:menuCommand label="Alert 2" omit="true">
+                  <tc:dataAttribute name="alert-text" value="Test 2"/>
+              </tc:menuCommand>
               <tc:menuCommand action="#{overviewController.ping}" id="dropdown3"
                               actionListener="#{overviewController.click}" label="Action 3"/>
             </tc:menu>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-object/object.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-object/object.xhtml?rev=1476299&r1=1476298&r2=1476299&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-object/object.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-object/object.xhtml Fri Apr 26 17:10:13 2013
@@ -28,28 +28,26 @@
 
   <tc:panel>
     <f:facet name="layout">
-      <tc:gridLayout rows="auto;*"/>
+      <tc:gridLayout rows="35px;auto;*"/>
     </f:facet>
 
-    <tc:panel>
-      <f:facet name="layout">
-        <tc:gridLayout columns="80px;80px;80px;*"/>
-      </f:facet>
-      <tc:link label="Show Tobago" onclick="/* fixme */">
-          <tc:dataAttribute name="maps-position" value="11.249123,-60.687103"/>
-          <tc:dataAttribute name="maps-zoom" value="12"/>
-          <tc:dataAttribute name="maps-target" value="page:map"/>
-      </tc:link>
-      <tc:link label="Show Plane" onclick="/* fixme */">
-          <tc:dataAttribute name="maps-position" value="50.053839,8.624933"/>
-          <tc:dataAttribute name="maps-zoom" value="17"/>
-          <tc:dataAttribute name="maps-target" value="page:map"/>
-      </tc:link>
-      <tc:link label="Show World" onclick="/* fixme */">
-          <tc:dataAttribute name="maps-target" value="page:map"/>
-      </tc:link>
-      <tc:panel/>
-    </tc:panel>
+    <tc:out value="External objects can be included. When CSP is activated, you may add a frame-src policy to the tobago-config.xml"/>
+
+    <tc:toolBar iconSize="off" >
+      <tc:toolBarCommand label="Show Tobago" omit="true">
+        <tc:dataAttribute name="maps-position" value="11.249123,-60.687103"/>
+        <tc:dataAttribute name="maps-zoom" value="12"/>
+        <tc:dataAttribute name="maps-target" value="page:map"/>
+      </tc:toolBarCommand>
+      <tc:toolBarCommand label="Show Plane" omit="true">
+        <tc:dataAttribute name="maps-position" value="50.053839,8.624933"/>
+        <tc:dataAttribute name="maps-zoom" value="17"/>
+        <tc:dataAttribute name="maps-target" value="page:map"/>
+      </tc:toolBarCommand>
+      <tc:toolBarCommand label="Show World" omit="true">
+        <tc:dataAttribute name="maps-target" value="page:map"/>
+      </tc:toolBarCommand>
+    </tc:toolBar>
 
     <tc:object id="map"/>
 

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/demo.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/demo.js?rev=1476299&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/demo.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/demo.js Fri Apr 26 17:10:13 2013
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function ($) {
+
+
+  $.widget("demo.alert", {
+
+    _create: function () {
+      this._on({
+        click: function (event) {
+          var text = this.element.data("alert-text");
+          alert(text);
+        }
+      });
+    },
+
+    _setOption: function (key, value) {
+    },
+
+    _destroy: function () {
+    }
+
+  });
+
+}(jQuery));
+
+var initAlert = function () {
+  jQuery("[data-alert-text]").alert();
+};
+
+Tobago.registerListener(initAlert, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(initAlert, Tobago.Phase.AFTER_UPDATE);