You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@esme.apache.org by rh...@apache.org on 2010/03/24 08:36:19 UTC

svn commit: r926961 - in /incubator/esme/trunk/server/src/main: scala/org/apache/esme/lib/TrackMgr.scala webapp/scripts/dialog_test.js webapp/track_view/index.html

Author: rhirsch
Date: Wed Mar 24 07:36:19 2010
New Revision: 926961

URL: http://svn.apache.org/viewvc?rev=926961&view=rev
Log:
[ESME-100] Finish web UI
Daily hour / modal dialog

Added:
    incubator/esme/trunk/server/src/main/webapp/scripts/dialog_test.js
Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala
    incubator/esme/trunk/server/src/main/webapp/track_view/index.html

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala?rev=926961&r1=926960&r2=926961&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/TrackMgr.scala Wed Mar 24 07:36:19 2010
@@ -113,7 +113,7 @@ object TrackMgr {
     }
 
     bind("main", in,
-         "track" -> text("", addTrack, "id" -> theInput)
+         "track" -%> text("", addTrack, "id" -> theInput)
     )
     
   }

Added: incubator/esme/trunk/server/src/main/webapp/scripts/dialog_test.js
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/scripts/dialog_test.js?rev=926961&view=auto
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/scripts/dialog_test.js (added)
+++ incubator/esme/trunk/server/src/main/webapp/scripts/dialog_test.js Wed Mar 24 07:36:19 2010
@@ -0,0 +1,85 @@
+// <![CDATA[
+/*
+ * displayMessages called by lift:comet, type="Timeline" and type="PublicTimeline"
+ */
+ 
+ 
+
+	$(function() {
+		// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
+		$("#dialog").dialog("destroy");
+		
+		var tracking_input = $("#tracking_input"),
+			allFields = $([]).add(tracking_input),
+			tips = $(".validateTips");
+
+		function updateTips(t) {
+			tips
+				.text(t)
+				.addClass('ui-state-highlight');
+			setTimeout(function() {
+				tips.removeClass('ui-state-highlight', 1500);
+			}, 500);
+		}
+		
+
+
+		function checkLength(o,n,min,max) {
+
+			if ( o.val().length > max || o.val().length < min ) {
+				o.addClass('ui-state-error');
+				updateTips("Length of " + n + " must be between "+min+" and "+max+".");
+				return false;
+			} else {
+				return true;
+			}
+
+		}
+
+		function checkRegexp(o,regexp,n) {
+
+			if ( !( regexp.test( o.val() ) ) ) {
+				o.addClass('ui-state-error');
+				updateTips(n);
+				return false;
+			} else {
+				return true;
+			}
+
+		}
+		
+		$("#dialog-form").dialog({
+			autoOpen: false,
+			height: 200,
+			width: 350,
+			modal: true,
+			buttons: {
+				'Create a new track': function() {
+					var bValid = true;
+					allFields.removeClass('ui-state-error');
+
+					bValid = bValid && checkLength(tracking_input,"tracking_input",3,16);
+
+					bValid = bValid && checkRegexp(tracking_input,/^[a-z]([0-9a-z_])+$/i,"Track may consist of a-z, 0-9, underscores, begin with a letter.");
+					
+					if (bValid) {
+						 //$('button[type=submit] .default').click(); 
+						 this.ownerDocument.forms[1].submit();   
+
+						$(this).dialog('close');
+					}
+				},
+				Cancel: function() {
+					$(this).dialog('close');
+				}
+			},
+			close: function() {
+				allFields.val('').removeClass('ui-state-error');
+			}
+		});
+		
+		
+	});
+
+// ]]>
+

Modified: incubator/esme/trunk/server/src/main/webapp/track_view/index.html
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/track_view/index.html?rev=926961&r1=926960&r2=926961&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/track_view/index.html (original)
+++ incubator/esme/trunk/server/src/main/webapp/track_view/index.html Wed Mar 24 07:36:19 2010
@@ -17,43 +17,20 @@
  under the License.                                           *
 -->
 <lift:surround with="base" at="left">
-	<link rel="stylesheet" href="../style/dialog_test.css" type="text/css" media="screen" />
-	<lift:Style.header/>
-	<lift:TableSorterSnip/>
-	<!-- STYLESHEETS <lift:Style.header /> -->
-	<link rel="stylesheet" type="text/css" href="../style/reset.css" media="screen" />
-	<link rel="stylesheet" type="text/css" href="../style/text.css" media="screen" />
-	<link rel="stylesheet" type="text/css" href="../style/grid.css" media="screen" />
-	<link rel="stylesheet" type="text/css" href="../style/layout.css" media="screen" />
+<head>
+	<!-- STYLESHEETS  -->  
 	<link type="text/css" href="../style/smoothness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
-	<!--[if IE 6]>
-	<link rel="stylesheet" type="text/css" href="../style/ie6.css" media="screen" />
-	<![endif]-->
-	<!--[if gte IE 7]>
-	<link rel="stylesheet" type="text/css" href="../style/ie.css" media="screen" />
-	<![endif]-->
-	<!-- JAVASCRIPT -->
+	<link type="text/css" href="../style/jquery-ui.css" rel="stylesheet" />
+	<link type="text/css" href="../style/parseTheme.css" rel="stylesheet" />
+	<link rel="stylesheet" type="text/css" href="../style/test.css" media="screen" />
 	<script type="text/javascript" src="../scripts/jquery-ui-1.7.2.custom.min.js">    </script>
 	<script type="text/javascript" src="../scripts/dialog_test.js">    </script>
-	<script type="text/javascript" src="../scripts/esme.js">    </script>
-	<script type="text/javascript" src="../scripts/esme_table_sorter.js">    </script>
-	<div id="messages"></div>
-	<div class="demo">
-		<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
-			<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
-				<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active">
-					<a href="#tabs-1">
-						<lift:loc>ui_track_manage</lift:loc>
-					</a>
-				</li>
-				<li class="ui-state-default ui-corner-top">
-					<a href="#tabs-2">
-						<lift:loc>ui_track_new_track</lift:loc>
-					</a>
-				</li>
-			</ul>
-			<div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tabs-1">
-				<span id="TrackSpan">
+		<lift:TableSorterSnip/>
+	</head>
+	
+<div class="demo">
+
+<span id="TrackSpan">
 					<lift:ignore>
 						<!--                        The displayTracking snippet *MUST* appear on the page before                        the main snippet                        -->
 						</lift:ignore>
@@ -92,39 +69,23 @@
 						</table>
 					</lift:displayTracking>
 				</span>
-			</div>
-			<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tabs-2">
-				<lift:form>
-					<lift:main>
-						<table>
-							<tr>
-								<td>
-									<lift:loc>ui_track_new_track_what</lift:loc>
-								</td>
-								<td>
-									<main:track/>
-								</td>
-							</tr>
-							<tr>
-								<td>                                </td>
-								<td>
-									<input type="submit" value="Add" />
-								</td>
-							</tr>
-						</table>
-					</lift:main>
-				</lift:form>
-			</div>
-		</div>
-	</div>
-	<!-- End demo -->
-	<lift:Msgs>
-		<lift:error_msg>Error:</lift:error_msg>
-		<lift:notice_msg>FYI:</lift:notice_msg>
-		<lift:error_class>error_major</lift:error_class>
-		<lift:notice_msg>
-			<lift:loc>ui_base_note</lift:loc>
-		</lift:notice_msg>
-		<lift:notice_class>note_major</lift:notice_class>
-	</lift:Msgs>
+
+
+<div id="dialog-form" title="Create new track">
+	<p class="validateTips">All form fields are required.</p>
+
+      <lift:form>
+       <lift:main>
+	<fieldset>
+		<label for="name"><lift:loc>ui_track_new_track_what</lift:loc></label>
+		<main:track class="text ui-widget-content ui-corner-all" />
+	</fieldset>
+	</lift:main>
+       </lift:form>
+</div>
+
+
+<button onclick="javascript:$('#dialog-form').dialog('open')" id="create-user">Create new track</button>
+
+</div><!-- End demo -->
 </lift:surround>
\ No newline at end of file