Просмотр исходного кода

Improved look of reporting context UI

peter_backlund 16 лет назад
Родитель
Сommit
f7d3e1100a

dddsample/external/reporting/src/test/resources/context-test-setup.xml → dddsample/external/reporting/src/main/resources/context-test-setup.xml Просмотреть файл

9
     <constructor-arg value="classpath:sample_data.sql"/>
9
     <constructor-arg value="classpath:sample_data.sql"/>
10
   </bean>
10
   </bean>
11
 
11
 
12
-
13
 </beans>
12
 </beans>

+ 1
- 0
dddsample/external/reporting/src/main/webapp/WEB-INF/web.xml Просмотреть файл

29
     <param-value>
29
     <param-value>
30
       classpath:context.xml
30
       classpath:context.xml
31
       classpath:context-cxf.xml
31
       classpath:context-cxf.xml
32
+      classpath:context-test-setup.xml
32
     </param-value>
33
     </param-value>
33
   </context-param>
34
   </context-param>
34
 
35
 

+ 19
- 44
dddsample/external/reporting/src/main/webapp/index.jsp Просмотреть файл

4
 <head>
4
 <head>
5
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
5
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
6
   <script type="text/javascript" src="jquery-1.3.2.js"></script>
6
   <script type="text/javascript" src="jquery-1.3.2.js"></script>
7
-  <title>Reporting</title>
7
+  <script type="text/javascript" src="reporting.js"></script>
8
+  <link rel="stylesheet" type="text/css" href="main.css"/> 
9
+  <title>DDDSample Reporting</title>
8
 </head>
10
 </head>
9
 <body>
11
 <body>
10
-  <h1 id="apa">Reporting</h1>
11
-  <div>
12
-    <form action="" method="get" onsubmit="search(); return false;">
13
-      Search:
14
-      <input id="query" name="query" type="text"/>
15
-      <input id="submit" name="submit" type="submit" value="Search"/>
16
-    </form>
12
+  <img id="background" src="background.png" alt=""/>
13
+  <div id="content">
14
+    <div id="header">
15
+      <img src="dddsample.png" alt="dddsample"/>
16
+    </div>
17
+    <div id="form">
18
+      <form action="" method="get" onsubmit="search(); return false;">
19
+        Track cargo or voyage:
20
+        <input id="query" name="query" type="text" size="30" value="ABC"/>
21
+        <input id="submit" name="submit" type="submit" value="Track"/>
22
+      </form>
23
+    </div>
24
+    <div id="result"></div>
25
+    <div id="footer">
26
+      Created by <a href="http://www.citerus.se">Citerus</a> and <a href="http://www.domainlanguage.com">Domain Language</a>
27
+    </div>
17
   </div>
28
   </div>
18
-  <div id="result"></div>
19
   <script type="text/javascript">
29
   <script type="text/javascript">
20
     $('#query').focus();
30
     $('#query').focus();
21
-
22
-    function search() {
23
-      $.ajax({
24
-          url: "http://localhost:8080/reporting/rest/cargo/" + $("#query").val() + ".json",
25
-          type: 'GET',
26
-          contentType: 'application/json',
27
-          success: function(response) {
28
-            var json = eval('(' + response + ')');
29
-            var cargo = json.cargoReport.cargo;
30
-            $('#result').empty();
31
-            var pdfUrl = "http://localhost:8080/reporting/rest/cargo/" + $("#query").val() + ".pdf"
32
-            $('#result').
33
-              append('<p><a href="' + pdfUrl + '">Download PDF</a></p>').
34
-              append('<h2>Cargo ' + cargo.trackingId + '</h2>').
35
-              append('<p>Destination: ' + cargo.finalDestination + ' (at ' + cargo.arrivalDeadline + ')</p>')
36
-
37
-            if (cargo.currentLocation) {
38
-              $('#result').append('<p>Status: ' + cargo.currentStatus + ' ' + cargo.currentLocation + '</p>');
39
-            } else if (cargo.currentVoyage) {
40
-              $('#result').append('<p>Status: ' + cargo.currentStatus + ' ' + cargo.currentVoyage + '</p>');
41
-            }
42
-
43
-            $('#result').append('<p>Updated on: ' + cargo.lastUpdatedOn + '</p>');
44
-
45
-            for (var handling in json.cargoReport.handlings) {
46
-              $('#result').append('<p>' + handling['location'] + '</p>');
47
-            }
48
-          },
49
-          error: function(response) {
50
-            if (response.status == 404) {
51
-              $('#result').text('No cargo with tracking id ' + $("#query").val());
52
-            }
53
-          }
54
-      });
55
-    }
56
   </script>
31
   </script>
57
 </body>
32
 </body>
58
 </html>
33
 </html>

+ 74
- 0
dddsample/external/reporting/src/main/webapp/main.css Просмотреть файл

1
+html {
2
+  overflow-y: scroll;
3
+}
4
+
5
+a {
6
+  text-decoration: none;
7
+  color: #234;
8
+}
9
+
10
+a:hover {
11
+  color: #123;
12
+}
13
+
14
+body {
15
+  font-family: Helvetica, Arial, sans-serif;
16
+  font-size: large;
17
+  background: rgb(11,19,36);
18
+  margin: 0;
19
+  padding: 20px;
20
+}
21
+
22
+img#background {
23
+  width: 98%;
24
+  z-index: -1;
25
+  position: absolute;
26
+  bottom: 0;
27
+}
28
+
29
+h1, h2 {
30
+  margin: 15px 0;
31
+  padding: 0;
32
+  font-size: x-large;
33
+}
34
+
35
+div#header {
36
+  margin: 30px 0;
37
+}
38
+
39
+div#content {
40
+  -moz-border-radius: 10px;
41
+  -webkit-border-radius: 10px;
42
+  background-color: rgb(255, 157, 84);
43
+  width: 600px;
44
+  padding: 10px 20px;
45
+  margin: auto;
46
+  border: 2px solid;
47
+}
48
+
49
+div#footer {
50
+  text-align: center;
51
+  font-size: x-small;
52
+  padding-top: 10px;
53
+  width: 100%;
54
+  margin-top: 20px;
55
+}
56
+
57
+input#query {
58
+  padding: 5px;
59
+  font-size: large;
60
+}
61
+
62
+input#submit {
63
+  padding: 5px 10px;
64
+  font-size: large;
65
+  border: 2px solid;
66
+  background-color: rgb(255, 203, 134);
67
+}
68
+
69
+table {
70
+}
71
+
72
+td {
73
+  padding: 8px;
74
+}

+ 56
- 0
dddsample/external/reporting/src/main/webapp/reporting.js Просмотреть файл

1
+function search() {
2
+  $('#result').empty();
3
+  if (!$("#query").val()) {
4
+    return;
5
+  }
6
+  
7
+  $.ajax({
8
+      url: 'http://localhost:8080/reporting/rest/cargo/' + $("#query").val() + '.json',
9
+      type: 'GET',
10
+      contentType: 'application/json',
11
+      success: function(response) {
12
+        var json = eval('(' + response + ')');
13
+        var cargo = json.cargoReport.cargo;
14
+        var pdfUrl = 'http://localhost:8080/reporting/rest/cargo/' + $("#query").val() + '.pdf';
15
+        $('#result').append('<h2>Cargo: ' + cargo.trackingId + '</h2>').append('<table>');
16
+
17
+        if (cargo.currentLocation) {
18
+          $('#result').append('<tr><td>Status</td><td>' + cargo.currentStatus + ' ' + cargo.currentLocation + '</td></tr>');
19
+        } else if (cargo.currentVoyage) {
20
+          $('#result').append('<tr><td>Status</td><td>' + cargo.currentStatus + ' ' + cargo.currentVoyage + '</td></tr>');
21
+        }
22
+
23
+        $('#result').
24
+          append('<tr><td>Destination</td><td>' + cargo.finalDestination + ' by ' + cargo.arrivalDeadline + '</td></tr>').
25
+          append('<tr><td>ETA</td><td>' + cargo.eta + '</td></tr>');
26
+
27
+
28
+        $('#result').
29
+          append('<tr><td>Updated on</td><td>' + cargo.lastUpdatedOn + '</td></tr>').
30
+          append('</table>');
31
+
32
+        $('#result').append(json.cargoReport.misdirected);
33
+
34
+        $('#result').
35
+          append('<h2>Handling history</h2>');
36
+        for (i in json.cargoReport.handlings) {
37
+          var handling = json.cargoReport.handlings[i];
38
+          $('#result').
39
+            append('<tr>').
40
+            append('<td>' + handling.completedOn + '</td>').
41
+            append('<td>' + handling.type + '</td>').
42
+            append('<td>' + handling.voyage + '</td>').
43
+            append('<td>' + handling.location + '</td>').
44
+            append('</tr>');
45
+        }
46
+        $('#result').
47
+          append('</table>').
48
+          append('<p><a href="' + pdfUrl + '">Download as PDF</a></p>');
49
+      },
50
+      error: function(response) {
51
+        if (response.status == 404) {
52
+          $('#result').append('<p>No cargo found with tracking ID ' + $("#query").val() + '</p>');
53
+        }
54
+      }
55
+  });
56
+}