Author: slaws
Date: Sun May 17 13:45:27 2009
New Revision: 775647

URL: http://svn.apache.org/viewvc?rev=775647&view=rev
Log:
Add ui contribution for the full travel booking application. This is just 
getting it basically working after the reorg of the code. Payment not fixed up 
yet. 

Added:
    tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/   (with 
props)
    tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/pom.xml  
 (with props)
    tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/
    tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/
    
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/
    
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/META-INF/
    
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/META-INF/sca-contribution.xml
   (with props)
    
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.composite
   (with props)
    
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.html
   (with props)
    
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.odg
   (with props)
    
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.png
   (with props)
    
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/style.css
   (with props)
Modified:
    
tuscany/sandbox/travelsample/contributions/payment-java-contribution/src/main/resources/definitions.xml
    tuscany/sandbox/travelsample/contributions/pom.xml

Propchange: tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun May 17 13:45:27 2009
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/pom.xml?rev=775647&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/pom.xml 
(added)
+++ tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/pom.xml 
Sun May 17 13:45:27 2009
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * 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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-sca</artifactId>
+        <version>1.5-SNAPSHOT</version>
+        <!--relativePath>../../pom.xml</relativePath-->
+    </parent>
+    <artifactId>scatours-fullapp-ui-contribution</artifactId>
+    <name>Apache Tuscany SCA Tours Full Application User Interface 
Contribution</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>1.5-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>1.5-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-axis2</artifactId>
+            <version>1.5-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>  
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-tomcat</artifactId>
+            <version>1.5-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency> 
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.5</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+       <finalName>${artifactId}</finalName>
+       <!--
+       <plugins>
+            <plugin>
+                <groupId>org.apache.tuscany.sca</groupId>
+                <artifactId>tuscany-maven-ant-generator</artifactId>
+                <version>1.5-SNAPSHOT</version>
+                <executions>
+                    <execution>
+                        <configuration>
+                            <mainClass>scatours.LaunchNode</mainClass>
+                        </configuration>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+       </plugins>
+       -->
+    </build>
+</project>

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/META-INF/sca-contribution.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/META-INF/sca-contribution.xml?rev=775647&view=auto
==============================================================================
--- 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/META-INF/sca-contribution.xml
 (added)
+++ 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/META-INF/sca-contribution.xml
 Sun May 17 13:45:27 2009
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * 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.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0";
+   xmlns:scatours="http://scatours";>
+   <deployable composite="scatours:scatours"/>
+   <import.java package="scatours.common"/>
+   <import.java package="scatours.currencyconverter"/>
+   <import.java package="scatours.hotel"/>
+   <import.java package="scatours.flight"/>
+   <import.java package="scatours.car"/>
+   <import.java package="scatours.trip"/>
+   <import.java package="scatours.tripbooking"/>
+   <import.java package="scatours.travelcatalog"/>
+   <import.java package="payment.creditcard"/>
+   <import.java package="payment"/>
+   <import.java package="scatours.emailgateway"/>
+   <import.java package="scatours.paymentprocess"/>
+   <import.java package="scatours.shoppingcart"/>
+   <import.java package="scatours"/>
+   <import namespace="http://www.example.org/PaymentProcess/"/>
+</contribution>
\ No newline at end of file

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.composite
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.composite?rev=775647&view=auto
==============================================================================
--- 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.composite
 (added)
+++ 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.composite
 Sun May 17 13:45:27 2009
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
+           targetNamespace="http://scatours";
+           xmlns:scatours="http://scatours";
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0";
+           xmlns:pp="http://www.example.org/PaymentProcess";
+           name="scatours">
+           
+    <component name="scatours">
+        <tuscany:implementation.widget location="scatours.html"/>
+        <service name="Widget">
+            <tuscany:binding.http uri="/scatours"/>
+        </service>
+        <reference name="scaToursCatalog" 
target="SCAToursComponent/SCAToursSearch">
+            <tuscany:binding.jsonrpc/>
+        </reference> 
+        <reference name="scaToursBooking" 
target="SCAToursComponent/SCAToursBooking">
+            <tuscany:binding.jsonrpc/>
+        </reference>
+        <reference name="scaToursCart" target="SCAToursComponent/SCAToursCart">
+            <tuscany:binding.jsonrpc/>
+        </reference>        
+    </component>
+    
+    <component name="SCAToursComponent">
+        <implementation.java class="scatours.SCAToursImpl"/>
+        <service name="SCAToursSearch">
+            <tuscany:binding.jsonrpc/>
+        </service>
+        <service name="SCAToursBooking">
+            <tuscany:binding.jsonrpc/>
+        </service>
+        <service name="SCAToursCart">
+            <tuscany:binding.jsonrpc/>
+        </service>        
+        <reference name="travelCatalogSearch" 
target="TravelCatalogComponent/TravelCatalogSearch"/>
+        <reference name="tripBooking" 
target="TripBookingComponent/TripBooking"/>
+        <reference name="shoppingCart" 
target="ShoppingCartComponent/ShoppingCart"/>       
+    </component>
+    
+    <component name="TravelCatalogComponent">
+        <implementation.java class="scatours.travelcatalog.TravelCatalogImpl"/>
+        <service name="TravelCatalogSearch"/>
+        <reference name="hotelSearch" target="HotelComponent/Search">
+            <binding.sca/>
+        </reference>
+        <reference name="flightSearch">
+            <interface.java interface="scatours.common.Search" 
+                            
callbackInterface="scatours.common.SearchCallback"/>
+            <binding.ws uri="http://localhost:8080/Flight/Search"/>
+            <callback>
+                <binding.ws uri="http://localhost:8080/Flight/SearchCallback"/>
+            </callback>
+        </reference> 
+        <reference name="carSearch" target="CarComponent/Search">
+            <binding.sca/>
+        </reference>    
+        <reference name="tripSearch" target="TripComponent/Search">
+            <binding.sca/>
+        </reference>     
+        <reference name="currencyConverter" 
target="CurrencyConverterComponent">
+        </reference>
+        <property name="quoteCurrencyCode">GBP</property>
+    </component>
+    
+    <component name="TripBookingComponent">
+        <implementation.java class="scatours.tripbooking.TripBookingImpl"/>
+        <service name="TripBooking"/>
+        <reference name="hotelBook" target="HotelComponent/Book"/>
+        <reference name="flightBook" target="TripComponent/Book"/>
+        <reference name="carBook" target="CarComponent/Book"/>   
+        <reference name="tripBook" target="TripComponent/Book"/>  
+        <reference name="shoppingCart" 
target="ShoppingCartComponent/ShoppingCart"/>      
+    </component>    
+        
+    <component name="HotelComponent">
+        <implementation.java class="scatours.hotel.HotelImpl"/>
+        <service name="Search">
+            <binding.sca/>
+            <tuscany:binding.jsonrpc/>
+        </service>
+        <service name="Book"/>
+    </component>  
+    
+    <component name="FlightComponent">
+        <implementation.java class="scatours.flight.FlightImpl"/>
+        <service name="Search">
+            <interface.java interface="scatours.common.Search" 
+                            
callbackInterface="scatours.common.SearchCallback"/>
+            <binding.ws uri="http://localhost:8080/Flight/Search"/>
+            <tuscany:binding.jsonrpc/>
+            <callback>
+                <binding.ws uri="http://localhost:8080/Flight/SearchCallback"/>
+            </callback>            
+        </service>
+        <service name="Book"/>
+    </component> 
+    
+    <component name="CarComponent">
+        <implementation.java class="scatours.car.CarImpl"/>
+        <service name="Search">
+            <binding.sca/>
+            <tuscany:binding.jsonrpc/>
+        </service>
+        <service name="Book"/>        
+    </component>   
+    
+    <component name="TripComponent">
+        <implementation.java class="scatours.trip.TripImpl"/>
+        <service name="Search">
+            <binding.sca/>
+            <tuscany:binding.jsonrpc/>
+        </service>
+        <service name="Book"/>        
+    </component> 
+    
+    <component name="CurrencyConverterComponent">
+        <implementation.java 
class="scatours.currencyconverter.CurrencyConverterImpl"/>
+        <service name="CurrencyConverter">
+        </service>
+    </component>
+    
+    <component name="ShoppingCartComponent">
+        <implementation.java class="scatours.shoppingcart.ShoppingCartImpl"/>
+        <service name="ShoppingCart">
+        </service>
+        <reference name="payment">
+            <binding.ws uri="http://localhost:8080/Payment"; />
+        </reference> 
+    </component>   
+    
+    <!--component name="PaymentComponent">
+        <implementation.java class="payment.PaymentImpl" />
+        <service name="Payment">
+            <binding.ws uri="http://localhost:8080/Payment"; />
+        </service>
+        <reference name="creditCardPayment">
+            <binding.ws uri="http://localhost:8080/CreditCardPayment"; />
+        </reference>
+    </component>
+    
+    <component name="CreditCardPaymentComponent">
+        <implementation.java class="payment.creditcard.CreditCardPaymentImpl" 
/>
+        <service name="CreditCardPayment">
+            <binding.ws uri="http://localhost:8080/CreditCardPayment"; />
+        </service>
+    </component-->     
+
+</composite>

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.html
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.html?rev=775647&view=auto
==============================================================================
--- 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.html
 (added)
+++ 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.html
 Sun May 17 13:45:27 2009
@@ -0,0 +1,391 @@
+<!--
+    * 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.    
+-->
+<html>
+<head>
+<title>SCA Tours</title>
+
+<link rel="stylesheet" type="text/css" href="style.css" />
+
+<script type="text/javascript" src="scatours.js"></script>
+
+<script language="JavaScript">   
+       
+    //@Reference
+    var scaToursCatalog = new tuscany.sca.Reference("scaToursCatalog");
+    
+    //@Reference
+    var scaToursBooking = new tuscany.sca.Reference("scaToursBooking");
+    
+    //@Reference
+    var scaToursCart = new tuscany.sca.Reference("scaToursCart");    
+        
+    //local state
+    var packagedItems;
+    var bespokeItems;
+    var cartId;
+         
+    //the constructor for trip leg beans
+    function TripLegType(id,
+                         fromLocation,
+                         toLocation,
+                         fromDate,
+                         toDate,
+                         noOfPeople) {
+          this.id           = id;
+          this.fromLocation = fromLocation;
+          this.toLocation   = toLocation;
+          this.fromDate     = fromDate;
+          this.toDate       = toDate;
+          this.noOfPeople   = noOfPeople;
+    }
+    
+    function getTripLeg(){
+        return new TripLegType(cartId,
+                               document.searchForm.fromLocation.value,
+                               document.searchForm.toLocation.value,
+                               document.searchForm.fromDate.value,
+                               document.searchForm.toDate.value,
+                               document.searchForm.noOfPeople.value);
+    }
+    
+    //the constructor for bespoke trip beans
+    function TripType() {
+          this.id           = cartId;
+          this.type         = "Bespoke";
+          this.tripItems    = new Array();
+          // json databinding can't tolerate having a class hint set as the 
+          // databinding transformer is not in the right classloader to load 
+          // the class pointed to by the hint
+          //this.javaClass    = "scatours.common.TripItem";
+    }
+    
+    function getTrip(){
+        return new TripType();
+    }    
+    
+    // remove class hint from the trip object
+    // can also be used to limit the amount of 
+    // data returned to the server
+    function copyTrip(trip){
+        var tripCopy = new TripType();
+        
+        tripCopy.id = trip.id;
+        tripCopy.tripId = trip.tripId;
+        tripCopy.type = trip.type;
+        tripCopy.name = trip.name;
+        tripCopy.description = trip.description;
+        tripCopy.location = trip.location;
+        tripCopy.fromDate = trip.fromDate;
+        tripCopy.toDate = trip.toDate;
+        tripCopy.price = trip.price;
+        tripCopy.currency = trip.currency;
+        tripCopy.link = trip.link;
+        
+        return tripCopy;
+    }   
+               
+    function init() {
+          try {
+           newCart(); 
+          }
+          catch(e) {
+              alert(e);
+          }
+    }
+    
+    function reset() { 
+        document.getElementById('packagedTripItems').innerHTML = "";
+        document.getElementById('bespokeTripItems').innerHTML = "";
+        document.getElementById('cartItems').innerHTML = "";
+        document.getElementById('cartPrice').innerHTML = "";
+        packagedItems = new Array();
+        bespokeItems = new Array();
+    }
+       
+    function newCart() { 
+        scaToursCart.newCart(newCart_response);
+        reset();
+    }
+    
+    function newCart_response(newCartId, exception) { 
+        if(exception){
+            alert(exception.javaStack);
+            return;
+        }
+        cartId = newCartId
+    }        
+            
+    function searchTravelCatalog() {        
+        scaToursCatalog.search(getTripLeg(), search_response);
+    }
+        
+    function search_response(items, exception) {
+        if(exception){
+            alert(exception.javaStack);
+            return;
+        }
+        
+        var packagedHTML = '<h3>Packaged Trip Items</h3>';
+        packagedHTML    += '<table border="0">';
+        packagedHTML    += '<tr>';
+        packagedHTML    += 
'<td>Select</td><td>Name</td><td>Description</td><td>Location</td><td>From - 
To</td><td>Price</td>';
+        packagedHTML    += '</tr>'; 
+             
+        var bespokeHTML = '<h3>Bespoke Trip Items</h3>'; 
+        bespokeHTML    += '<table border="0">';
+        bespokeHTML    += '<tr>';
+        bespokeHTML    += 
'<td>Select</td><td>Name</td><td>Description</td><td>Location</td><td>From - 
To</td><td>Price</td>';
+        bespokeHTML    += '</tr>';       
+        
+        for (var i=0; i<items.length; i++) {
+            if (items[i].type == "Trip") {
+                packagedHTML += '<tr>';
+                packagedHTML += '<td><input 
onClick="processPackagedSelection()" name="packagedTripItemSelection" 
type="checkbox" value="' + items[i].id + '"></td>'
+                packagedHTML += '<td>' +  items[i].name + '</td>';
+                packagedHTML += '<td>' +  items[i].description + '</td>';
+                packagedHTML += '<td>' +  items[i].location + '</td>';
+                packagedHTML += '<td>' +  items[i].fromDate + ' - ' + 
items[i].toDate +'</td>';
+                packagedHTML += '<td>' +  items[i].price + ' ' + 
items[i].currency + '</td>';
+                packagedHTML += '</tr>';
+                packagedItems.push(items[i]);
+            } else {
+                bespokeHTML += '<tr>';
+                bespokeHTML += '<td><input onClick="processBespokeSelection()" 
name="bespokeTripItemSelection" type="checkbox" value="' + items[i].id + 
'"></td>'
+                bespokeHTML += '<td>' +  items[i].name + '</td>';
+                bespokeHTML += '<td>' +  items[i].description + '</td>';
+                bespokeHTML += '<td>' +  items[i].location + '</td>';
+                bespokeHTML += '<td>' +  items[i].fromDate + ' - ' + 
items[i].toDate +'</td>';
+                bespokeHTML += '<td>' +  items[i].price + ' ' + 
items[i].currency + '</td>';
+                bespokeHTML += '</tr>';  
+                bespokeItems.push(items[i]);          
+            }
+        }
+        
+        packagedHTML    += '</table>'; 
+        packagedHTML    += '<input type="button" onClick="bookPackagedTrip()" 
value="Book Packaged Trip">'; 
+        
+        bespokeHTML    += '<tr><td/><td/><td>Total 
Price</td><td/><td/><td><div id="bespokeTripPrice"></div> </td></tr>';
+        bespokeHTML    += '</table>';
+        bespokeHTML    += '<input type="button" onClick="bookBespokeTrip()" 
value="Book Bespoke Trip">';       
+        
+        if (packagedItems.length > 0){
+            document.getElementById('packagedTripItems').innerHTML = 
packagedHTML;
+        }
+        
+        if (bespokeItems.length > 0){
+            document.getElementById('bespokeTripItems').innerHTML = 
bespokeHTML;
+        }
+    }  
+    
+    function processPackagedSelection() {
+        // do nothing at the moment
+    }
+    
+    function processBespokeSelection() {
+        // calculate total price
+        var items  = document.getElementsByName("bespokeTripItemSelection");
+        var totalPrice = 0.0;
+        for (var i=0; i<items.length; i++) {
+            
+            // find the items that are checked
+            if (items[i].checked == true) {
+                totalPrice = totalPrice + bespokeItems[i].price;
+            } 
+        }
+        document.getElementById('bespokeTripPrice').innerHTML = totalPrice + ' 
' + bespokeItems[0]. currency;
+    }        
+    
+    function bookPackagedTrip() {   
+        // find first selected trip item
+        var trip = null;
+        var items  = document.getElementsByName("packagedTripItemSelection");
+        for (var i=0; i<items.length; i++) {
+            
+            // find the items that are checked
+            if (items[i].checked == true) {
+                trip = copyTrip(packagedItems[i]);
+                break;
+            } 
+        }
+            
+        if (trip != null) { 
+            // book trip        
+            scaToursBooking.bookTrip(cartId, trip);
+            
+            // reset the display
+            reset();
+            
+            // re-populate the cart with all entries
+            getCartTrips();
+        } else {
+            alert ("Please select a trip")
+        }
+    }   
+    
+    function bookBespokeTrip() {
+        // create a trip object
+        var trip = getTrip();    
+        
+        // add selected trip items to trip
+        var items  = document.getElementsByName("bespokeTripItemSelection");
+        for (var i=0; i<items.length; i++) {
+            
+            // find the items that are checked
+            if (items[i].checked == true) {
+                trip.tripItems.push(copyTrip(bespokeItems[i]));
+            } 
+        }
+            
+        if (trip.tripItems.length > 0) { 
+            // book trip        
+            scaToursBooking.bookTrip(cartId, trip);
+            
+            // reset the display
+            reset();
+            
+            // re-populate the cart with all entries
+            getCartTrips();
+        } else {
+            alert ("Please select some trip items!")
+        }
+    } 
+    
+    function getCartTrips() {
+        scaToursCart.getTrips(cartId, getCartTrips_response);
+    }
+    
+    function getCartTrips_response(trips, exception) {
+        if(exception){
+            alert(exception.javaStack);
+            return;
+        }
+        var itemsHTML = '';
+        var totalPrice  = 0.0;
+        
+        for (var x=0; x<trips.length; x++){
+            itemsHTML += '<h3>Trip - ' + trips[x].id + '</h3>';
+            itemsHTML += '<table border="0">';
+            itemsHTML += '<tr>';
+            itemsHTML += '<td>Booking 
Ref</td><td>Name</td><td>Description</td><td>Location</td><td>From - 
To</td><td>Price</td>';
+            itemsHTML += '</tr>';
+            
+            if (trips[x].type == "Trip") {
+                itemsHTML += '<tr>';
+                itemsHTML += '<td>' +  trips[x].bookingCode + '</td>';
+                itemsHTML += '<td>' +  trips[x].name + '</td>';
+                itemsHTML += '<td>' +  trips[x].description + '</td>';
+                itemsHTML += '<td>' +  trips[x].location + '</td>';
+                itemsHTML += '<td>' +  trips[x].fromDate + ' - ' + 
trips[x].toDate +'</td>';
+                itemsHTML += '<td>' +  trips[x].price + ' ' + 
trips[x].currency + '</td>';
+                itemsHTML += '</tr>';
+                totalPrice = totalPrice + trips[x].price;
+            
+            } else {
+                var tripItems = trips[x].tripItems;
+            
+                for (var i=0; i<tripItems.length; i++) {
+                    itemsHTML += '<tr>';
+                    itemsHTML += '<td>' +  tripItems[i].bookingCode + '</td>';
+                    itemsHTML += '<td>' +  tripItems[i].name + '</td>';
+                    itemsHTML += '<td>' +  tripItems[i].description + '</td>';
+                    itemsHTML += '<td>' +  tripItems[i].location + '</td>';
+                    itemsHTML += '<td>' +  tripItems[i].fromDate + ' - ' + 
tripItems[i].toDate +'</td>';
+                    itemsHTML += '<td>' +  tripItems[i].price + ' ' + 
tripItems[i].currency + '</td>';
+                    itemsHTML += '</tr>';
+                    totalPrice = totalPrice + tripItems[i].price;
+                }
+            }
+            
+            itemsHTML    += '</table>';
+        }
+        
+        document.getElementById('cartItems').innerHTML = itemsHTML;  
+        document.getElementById('cartPrice').innerHTML = totalPrice + ' ' + 
trips[0].currency; 
+    }     
+    
+    function checkout() {        
+        scaToursCart.checkout(cartId);
+        
+        document.getElementById('packagedTripItems').innerHTML = "";
+        document.getElementById('bespokeTripItems').innerHTML = "";
+        document.getElementById('cartItems').innerHTML = "Thank you for 
shopping with SCA Tours";
+        document.getElementById('cartPrice').innerHTML = "";
+        searchResponseItems = null;
+        tripItems = null;
+    }   
+    
+    function purchase() { 
+    }
+       
+</script>
+
+</head>
+
+<body onload="init()" background="">
+       <img src="scatours.png" border="0" />
+       <div id="scatours">
+        <form name="searchForm"> 
+            <h3>Search for trips, hotels, flights and cars</h3>
+            <br/>
+            <table border="0">
+                <tr>
+                    <td>From Location:</td>
+                    <td><input type="text" name="fromLocation" 
value="LGW"></td>
+                    <td>To Location:</td>
+                    <td><input type="text" name="toLocation" value="FLR"></td>
+                </tr>
+                <tr>
+                    <td>Start Date:</td>
+                    <td><input type="text" name="fromDate" 
value="06/12/09"></td>
+                    <td>End Date:</td>
+                    <td><input type="text" name="toDate" value="13/12/09"></td>
+                </tr>
+                <tr>
+                    <td>Number of people:</td>
+                    <td><select name="noOfPeople">
+                        <option>1
+                        <option selected>2
+                        <option>3
+                        <option>4
+                    </select></td>
+                    <td/>
+                    <td/>
+                </tr>
+            </table>
+            <br/>
+            <input type="button" onClick="searchTravelCatalog()" 
value="Search"> 
+        </form>
+        <form name="packagedTripForm">
+            <div id="packagedTripItems"></div>    
+        </form>         
+        <form name="bespokeTripForm">
+            <div id="bespokeTripItems"></div>    
+        </form> 
+        <form name="cartForm">
+            <h3>Shopping Cart</h3>
+            <div id="cartItems"></div>
+            <br/>  
+            Total Price: <div id="cartPrice"></div>
+            <br/>          
+            <input type="button" onClick="checkout()" value="Checkout"> 
+        </form>         
+       </div>
+  
+</body>
+</html>

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.html
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.odg
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.odg?rev=775647&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.odg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.png
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.png?rev=775647&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/scatours.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/style.css
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/style.css?rev=775647&view=auto
==============================================================================
--- 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/style.css
 (added)
+++ 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/style.css
 Sun May 17 13:45:27 2009
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+
+
+/*******************************************/
+
+p,table,li,h1,h2,h3
+{
+font-family: verdana, arial, 'sans serif'; 
+}
+
+p, h1, h2, h3, table, li, hr
+{
+margin-left: 10pt;
+}
+
+table
+{
+border-color: black;
+border-collapse: separate;
+border-spacing: 0px 1px;
+
+margin-right: 10pt;
+margin-left: 10pt;
+width: 800px;
+}
+
+.sourceDetailsTable
+{
+width: 600px;
+}
+
+tr, td
+{
+margin-left: 0pt;
+margin-right: 0pt;
+padding-left: 10pt;
+font-size: 90%;
+}
+
+p,li,th
+{
+font-size: 90%;
+margin-left: 10pt;
+}
+
+pre
+{
+margin-left: 10pt;
+}
+
+body
+{
+#ffffff;
+}
+
+h1,h2,h3,hr
+{
+color: firebrick;
+}
+
+a:link {COLOR: firebrick;}
+a:visited {COLOR: firebrick;}
+a:active {COLOR: navy;}
+
+.link
+{
+COLOR: firebrick;
+text-decoration: underline;
+}
+
+.clickable
+{
+cursor: pointer
+}
+
+.unread_title
+{
+font-weight: bold;
+}
+
+.read_title
+{
+font-weight: normal;
+}
+
+.summary
+{
+color: DimGrey;
+}
+
+.hidden
+{
+display: none;
+}
+
+.source_name
+{
+width: 600px;
+}
+
+.alert_text
+{
+width: 600px;
+}
+
+.alert_data
+{
+margin-left: 10px;
+width: 800px;
+height: 800px;
+}
+
+.source_0
+{
+background-color: LightGreen;
+}    
+

Propchange: 
tuscany/sandbox/travelsample/contributions/fullapp-ui-contribution/src/main/resources/style.css
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
tuscany/sandbox/travelsample/contributions/payment-java-contribution/src/main/resources/definitions.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/payment-java-contribution/src/main/resources/definitions.xml?rev=775647&r1=775646&r2=775647&view=diff
==============================================================================
--- 
tuscany/sandbox/travelsample/contributions/payment-java-contribution/src/main/resources/definitions.xml
 (original)
+++ 
tuscany/sandbox/travelsample/contributions/payment-java-contribution/src/main/resources/definitions.xml
 Sun May 17 13:45:27 2009
@@ -28,6 +28,6 @@
     <!-- Policy intents -->
     <policySet name="ps1" provides="sca:authorization" 
appliesTo="sca:implementation.java"/>
     
-    <policySet name="ps2" provides="sca:managedTransaction.global" 
appliesTo="sca:implementation.java"/>
+    <!-- policySet name="ps2" provides="sca:managedTransaction.global" 
appliesTo="sca:implementation.java"/-->
        
 </definitions>

Modified: tuscany/sandbox/travelsample/contributions/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/pom.xml?rev=775647&r1=775646&r2=775647&view=diff
==============================================================================
--- tuscany/sandbox/travelsample/contributions/pom.xml (original)
+++ tuscany/sandbox/travelsample/contributions/pom.xml Sun May 17 13:45:27 2009
@@ -43,8 +43,8 @@
                 <module>currency-contribution</module>
                 <module>emailgateway-contribution</module>
                 <module>flight-contribution</module>
+                <module>fullapp-ui-contribution</module>
                 <module>hotel-contribution</module>
-                <module>interaction-ui-contribution</module>
                 <module>introducing-client-contribution</module>
                 <module>introducing-goodvaluetrips-contribution</module>
                 <module>introducing-tuscanyscatours-contribution</module>


Reply via email to