rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramin...@apache.org
Subject svn commit: r1157934 - in /incubator/rave/trunk/rave-portal: ./ src/main/resources/ src/main/webapp/WEB-INF/views/ src/main/webapp/css/ src/main/webapp/script/ src/test/java/org/apache/rave/portal/repository/
Date Mon, 15 Aug 2011 18:22:48 GMT
Author: raminder
Date: Mon Aug 15 18:22:48 2011
New Revision: 1157934

URL: http://svn.apache.org/viewvc?rev=1157934&view=rev
Log:
Tab support in user layout RAVE-96. You can see multiple tabs for canonical user

Added:
    incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_layout.js
Modified:
    incubator/rave/trunk/rave-portal/pom.xml
    incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql
    incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp
    incubator/rave/trunk/rave-portal/src/main/webapp/css/default.css
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java

Modified: incubator/rave/trunk/rave-portal/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/pom.xml?rev=1157934&r1=1157933&r2=1157934&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/pom.xml (original)
+++ incubator/rave/trunk/rave-portal/pom.xml Mon Aug 15 18:22:48 2011
@@ -16,7 +16,7 @@
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
-  
+
   $Id$
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -300,6 +300,9 @@
                         <configuration>
                             <jsSrcDir>${project.basedir}/src/main/webapp/script/</jsSrcDir>
                             <debug>true</debug>
+                            <sourceExcludes>
+                                  <exclude>rave_layout.js</exclude>
+                            </sourceExcludes>
                         </configuration>
                     </execution>
                 </executions>

Modified: incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql?rev=1157934&r1=1157933&r2=1157934&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql (original)
+++ incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql Mon Aug 15 18:22:48
2011
@@ -103,7 +103,7 @@ values (next value for page_layout_id_se
 
 --- Layout for user_id_1 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_1_id, next value for page_id_seq), 'main', @user_id_1, 1, @two_col_id);
+values (set(@page_1_id, next value for page_id_seq), 'Main', @user_id_1, 1, @two_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_1_region_1, next value for region_id_seq), @page_1_id);
@@ -119,11 +119,30 @@ INSERT INTO region_widget(id, widget_id,
 values (next value for region_widget_id_seq, @nyt_widget_id, @page_1_region_2, 0, 'N');
 INSERT INTO region_widget(id, widget_id, region_id, render_order, collapsed)
 values (next value for region_widget_id_seq, @tabnews_widget_id, @page_1_region_2, 1, 'N');
+
+INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
+values (set(@page_1_id, next value for page_id_seq), 'Social', @user_id_1, 1, @two_col_id);
+
+INSERT INTO region(id, page_id)
+values (set(@page_1_region_1, next value for region_id_seq), @page_1_id);
+INSERT INTO region(id, page_id)
+values (set(@page_1_region_2, next value for region_id_seq), @page_1_id);
+
+INSERT INTO region_widget(id, widget_id, region_id, render_order, collapsed)
+values (next value for region_widget_id_seq, @nyt_widget_id, @page_1_region_1, 0, 'N');
+INSERT INTO region_widget(id, widget_id, region_id, render_order, collapsed)
+values (next value for region_widget_id_seq, @translate_widget_id, @page_1_region_1, 1, 'N');
+
+INSERT INTO region_widget(id, widget_id, region_id, render_order, collapsed)
+values (next value for region_widget_id_seq, @wikipedia_widget_id, @page_1_region_2, 0, 'N');
+INSERT INTO region_widget(id, widget_id, region_id, render_order, collapsed)
+values (next value for region_widget_id_seq, @tabnews_widget_id, @page_1_region_2, 1, 'N');
+
 --- End canonical user_id_1 layout ---
 
 --- Layout for user_id_2 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_1_id, next value for page_id_seq), 'main', @user_id_2, 1, @two_col_id);
+values (set(@page_1_id, next value for page_id_seq), 'Main', @user_id_2, 1, @two_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_1_region_1, next value for region_id_seq), @page_1_id);
@@ -145,7 +164,7 @@ values (next value for region_widget_id_
 
 --- Layout for user_id_3 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_1_id, next value for page_id_seq), 'main', @user_id_3, 1, @two_col_id);
+values (set(@page_1_id, next value for page_id_seq), 'Main', @user_id_3, 1, @two_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_1_region_1, next value for region_id_seq), @page_1_id);
@@ -165,7 +184,7 @@ values (next value for region_widget_id_
 
 --- Layout for user_id_6 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_1_id, next value for page_id_seq), 'main', @user_id_6, 1, @two_col_id);
+values (set(@page_1_id, next value for page_id_seq), 'Main', @user_id_6, 1, @two_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_1_region_1, next value for region_id_seq), @page_1_id);
@@ -185,7 +204,7 @@ values (next value for region_widget_id_
 
 --- Layout for user_id_7 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_7_id, next value for page_id_seq), 'main', @user_id_7, 1, @one_col_id);
+values (set(@page_7_id, next value for page_id_seq), 'Main', @user_id_7, 1, @one_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_7_region_1, next value for region_id_seq), @page_7_id);
@@ -198,7 +217,7 @@ values (next value for region_widget_id_
 
 --- Layout for user_id_8 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_8_id, next value for page_id_seq), 'main', @user_id_8, 1, @twown_col_id);
+values (set(@page_8_id, next value for page_id_seq), 'Main', @user_id_8, 1, @twown_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_8_region_1, next value for region_id_seq), @page_8_id);
@@ -218,7 +237,7 @@ values (next value for region_widget_id_
 
 --- Layout for user_id_9 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_9_id, next value for page_id_seq), 'main', @user_id_9, 1, @three_col_id);
+values (set(@page_9_id, next value for page_id_seq), 'Main', @user_id_9, 1, @three_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_9_region_1, next value for region_id_seq), @page_9_id);
@@ -240,7 +259,7 @@ values (next value for region_widget_id_
 
 --- Layout for user_id_10 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_10_id, next value for page_id_seq), 'main', @user_id_10, 1, @threewn_col_id);
+values (set(@page_10_id, next value for page_id_seq), 'Main', @user_id_10, 1, @threewn_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_10_region_1, next value for region_id_seq), @page_10_id);
@@ -262,7 +281,7 @@ values (next value for region_widget_id_
 
 --- Layout for user_id_11 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_11_id, next value for page_id_seq), 'main', @user_id_11, 1, @four_col_id);
+values (set(@page_11_id, next value for page_id_seq), 'Main', @user_id_11, 1, @four_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_11_region_1, next value for region_id_seq), @page_11_id);
@@ -286,7 +305,7 @@ values (next value for region_widget_id_
 
 --- Layout for user_id_12 ---
 INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
-values (set(@page_12_id, next value for page_id_seq), 'main', @user_id_12, 1, @fourwn_col_id);
+values (set(@page_12_id, next value for page_id_seq), 'Main', @user_id_12, 1, @fourwn_col_id);
 
 INSERT INTO region(id, page_id)
 values (set(@page_12_region_1, next value for region_id_seq), @page_12_id);

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp?rev=1157934&r1=1157933&r2=1157934&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp Mon Aug 15 18:22:48
2011
@@ -15,7 +15,7 @@
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
-  
+
   $Id$
 
 --%>
@@ -39,8 +39,36 @@
         </div>
         <h1>Hello ${defaultPage.owner.username}, welcome to Rave!</h1>
     </div>
-    <div id="content">
-        <c:forEach var="region" items="${defaultPage.regions}">
+    <div id="dialog" title="Tab data" class="dialog">
+		<form>
+			<fieldset class="ui-helper-reset">
+				<label for="tab_title">Title</label>
+				<input type="text" name="tab_title" id="tab_title" value="" class="ui-widget-content
ui-corner-all" />
+				<label for="pageLayoutField">Select Page Layout:</label>
+            	<select>
+            		<option value="columns_1" id="columns_1_id">One Column</option>
+            		<option value="columns_2" id="columns_2_id" selected="selected">Two Columns</option>
+            		<option value="columns_2wn" id="columns_2wn_id">Two Columns (wide/narrow)</option>
+            		<option value="columns_3" id="columns_3_id">Three Columns</option>
+            		<option value="columns_3nwn" id="columns_3nwn_id">Three Columns (narrow/wide/narrow)</option>
+            		<option value="columns_4" id="columns_4_id">Four Columns</option>
+            		<option value="columns_3nwn_1_bottom" id="columns_3nwn_1_bottom">Four
Columns (narrow/wide/narrow/bottom)</option>
+            	</select>
+			</fieldset>
+		</form>
+	</div>
+	<button id="add_tab">Add Tab</button>
+      <div id="tabs" class="rave-ui-tabs">
+    <ul class="rave-ui-tabs ui-tabs-nav">
+	<c:forEach var="page" items="${pages}">
+    		<li>
+				<a href="#page-${page.id}-id">${page.name}</a> <span class="ui-icon ui-icon-close">Remove
Tab</span>
+			</li>
+	</c:forEach>
+	</ul>
+   <c:forEach var="page" items="${pages}">
+    	<div id="page-${page.id}-id">
+	    <c:forEach var="region" items="${page.regions}">
             <div class="region" id="region-${region.id}-id">
                 <c:forEach var="regionWidget" items="${region.regionWidgets}">
                     <div class="widget-wrapper" id="widget-${regionWidget.id}-wrapper">
@@ -67,6 +95,8 @@
                 </c:forEach>
             </div>
         </c:forEach>
+    	</div>
+         </c:forEach>
         <div class="clear-float">&nbsp;</div>
     </div>
     <script src="//cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
@@ -77,6 +107,7 @@
     <script src="<spring:url value="/script/rave_api.js"/>"></script>
     <script src="<spring:url value="/script/rave_opensocial.js"/>"></script>
     <script src="<spring:url value="/script/rave_wookie.js"/>"></script>
+    <script src="<spring:url value="/script/rave_layout.js"/>"></script>
     <script>
         //Define the global widgets variable
         //This array will be populated by RegionWidgetRender providers.
@@ -85,17 +116,21 @@
            Among other things, the render-widget tag will populate the widgets[] array.
            See the markup text in OpenSocialWidgetRenderer.java, for example.
         --%>
-        <c:forEach var="region" items="${defaultPage.regions}">
+        <c:forEach var="page" items="${pages}">
+        <c:forEach var="region" items="${page.regions}">
         <c:forEach var="regionWidget" items="${region.regionWidgets}">
         <portal:render-widget regionWidget="${regionWidget}" />
         </c:forEach>
         </c:forEach>
-
+        </c:forEach>
         $(function() {
             rave.setContext("<spring:url value="/app/" />");
             rave.initProviders();
             rave.initWidgets(widgets);
             rave.initUI();
         });
+        $(function() {
+    		$( "#tabs" ).tabs();
+    	});
     </script>
 </rave:rave_generic_page>

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/css/default.css
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/css/default.css?rev=1157934&r1=1157933&r2=1157934&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/css/default.css (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/css/default.css Mon Aug 15 18:22:48 2011
@@ -22,8 +22,8 @@
 
 body {
     color: #000000;
+    font-size: 62.5%;
     font-family: Arial, Helvetica, sans-serif;
-    font-size: 12pt;
     filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#D7D7D3", endColorstr="#EBEBEB");
     background: -moz-linear-gradient(center top , #D7D7D3 0%, #EBEBEB 50%) repeat scroll
0 0 transparent;
     background: -webkit-gradient(linear, left top, left bottom, from(#D7D7D3), to(#EBEBEB));
@@ -229,6 +229,7 @@ h1, h2, h3, h4, h5, h6 {
     padding: 5px 5px 100px 5px; /*** bottom padding is needed for dnd when region is empty
***/
     margin-right: 20px;
     width:300px;
+    height: 100%;
 }
 
 .region-dragging {
@@ -423,4 +424,21 @@ label.error {
     display: block;
     float: none;
     margin: 0.5em 0 auto 120px;
-}
\ No newline at end of file
+}
+
+.rave-ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background:
#F2F2F2; height: 800px; }
+.rave-ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; background: #666666}
+.rave-ui-tabs add_tab { cursor: pointer; }
+#tabs { margin-top: 1em; length: 95%; }
+#tabs li .ui-icon-close { float: left; margin: 0.4em 0.2em 0 0; cursor: pointer; }
+#dialog {
+    width:400px;
+}
+#dialog label { display:block; }
+#dialog input { display:block; }
+#dialog label { margin-top: 0.5em; }
+#dialog input { width: 95%; }
+#dialog textarea { width: 95%; }
+#add_tab { cursor: pointer; }
+
+

Added: incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_layout.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_layout.js?rev=1157934&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_layout.js (added)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_layout.js Mon Aug 15 18:22:48
2011
@@ -0,0 +1,80 @@
+/*
+ * 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() {
+    		var $tab_title_input = $( "#tab_title"),
+    			$tab_content_input = $( "#tab_content" );
+    		var tab_counter = 2;
+    		// tabs init with a custom tab template and an "add" callback filling in the content
+    		var $tabs = $( "#tabs").tabs({
+    			tabTemplate: "<li><a href='#{href}'>#{label}</a> <span class='ui-icon
ui-icon-close'>Remove Tab</span></li>",
+    			add: function( event, ui ) {
+    				var tab_content = $tab_content_input.val() || "Tab " + tab_counter + " content.";
+    				$( ui.panel ).append( "<p>" + tab_content + "</p>" );
+    			}
+    		});
+
+    		// modal dialog init: custom buttons and a "close" callback reseting the form inside
+    		var $dialog = $( "#dialog" ).dialog({
+    			autoOpen: false,
+    			modal: true,
+    			buttons: {
+    				Add: function() {
+    					addTab();
+    					$( this ).dialog( "close" );
+    				},
+    				Cancel: function() {
+    					$( this ).dialog( "close" );
+    				}
+    			},
+    			open: function() {
+    				$tab_title_input.focus();
+    			},
+    			close: function() {
+    				$form[ 0 ].reset();
+    			}
+    		});
+
+    		// addTab form: calls addTab function on submit and closes the dialog
+    		var $form = $( "form", $dialog ).submit(function() {
+    			addTab();
+    			$dialog.dialog( "close" );
+    			return false;
+    		});
+
+    		// actual addTab function: adds new tab using the title input from the form above
+    		function addTab() {
+    			var tab_title = $tab_title_input.val() || "Tab " + tab_counter;
+    			$tabs.tabs( "add", "#tabs-" + tab_counter, tab_title );
+    			tab_counter++;
+    		}
+
+    		// addTab button: just opens the dialog
+    		$( "#add_tab" )
+    			.button()
+    			.click(function() {
+    				$dialog.dialog( "open" );
+    			});
+
+    		// close icon: removing the tab on click
+    		// note: closable tabs gonna be an option in the future - see http://dev.jqueryui.com/ticket/3924
+    		$( "#tabs span.ui-icon-close" ).live( "click", function() {
+    			var index = $( "li", $tabs ).index( $( this ).parent() );
+    			$tabs.tabs( "remove", index );
+    		});
+});
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java?rev=1157934&r1=1157933&r2=1157934&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
Mon Aug 15 18:22:48 2011
@@ -52,7 +52,7 @@ public class JpaPageRepositoryTest {
     public void getAllPages_validUser_validPageSet() {
         List<Page> pages = repository.getAllPages(USER_ID);
         assertThat(pages, is(notNullValue()));
-        assertThat(pages.size(), equalTo(1));
+        assertThat(pages.size(), equalTo(2));
         assertThat(pages.get(0).getRegions().size(), equalTo(2));
         assertThat(pages.get(0).getRegions().get(0).getRegionWidgets().size(), equalTo(2));
         assertThat(pages.get(0).getRegions().get(0).getRegionWidgets().get(0).getWidget().getUrl(),
equalTo(WIDGET_URL));



Mime
View raw message