/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to Code Viewer Alt/AJAX/AjaxDemoApp2_getCustomerBookings_description.html

  • Committer: gustav.hartvigsson at gmail
  • Date: 2013-04-04 09:35:11 UTC
  • mfrom: (12.1.2 pvp2)
  • Revision ID: gustav.hartvigsson@gmail.com-20130404093511-gqti3jli2ogy16nv
merged. critial, due to files became missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<span class="description">
 
2
<br>
 
3
<div class="descriptionheading">Overview</div>
 
4
 
 
5
The bookings list is a variation on the traditional shopping cart model that lists all bookings made by a certain user. 
 
6
A form contains a field for writing the customer ID, and a list of bookings made by the customer with that ID is retrieved.
 
7
 
 
8
<div class="descriptionheading">processinputbox</div>
 
9
The function called <span class="interestingdescription">processinputbox</span> is executed by the keyup and onchange events for the text box in the form. 
 
10
Events connected to a specific dialog component are suitable for this type of application since attaching code to those events allows the capture of text written 
 
11
into a dialog box while the user keeps typing.<br>
 
12
 
 
13
<div class="descriptionheading">ResultCustomer</div>
 
14
 
 
15
The other function <span class="interestingdescription">ResultCustomer</span> is called automatically by jQuery when the data has been returned.
 
16
<br>
 
17
The function it iterates over the Booking elements that have been returned and adds an on-screen table row (composed of the attributes of the booking) for each of the bookings.
 
18
<br> 
 
19
The result is placed in a div with the ID <span class="interestingdescription">OutputDiv</span>
 
20
 
 
21
<br><br><div class="descriptionheading">booking/getcustomerbookings_XML.php</div>
 
22
 
 
23
The <span class="interestingdescription">getCustomerBookings</span> function collects all bookings made by a certain customer. No error handling is performed at all. If the ResourceType (i.e. application name) 
 
24
"None" is given, all bookings for the customer is returned including bookings made in other applications.<br>
 
25
 
 
26
<br><div class='exampleheading'>Call Example:<br><br>
 
27
<pre class="codeexample">
 
28
$.ajax({
 
29
        type: 'POST',
 
30
        url: 'booking/getcustomerbookings_XML.php',
 
31
        data: {
 
32
                customerID: escape(customer)
 
33
        },
 
34
        success:  ResultBookingCustomer,
 
35
});
 
36
</pre>
 
37
</div>
 
38
 
 
39
<br>
 
40
 
 
41
<br><div class='exampleheading'>Returned Data Example:<br>
 
42
<pre><span class="codeexample">
 
43
&lt;bookings&gt;
 
44
&lt;booking 
 
45
    application='Hotell_Demo'
 
46
    customerID='Haakon'
 
47
    resourceID='1008'
 
48
    name='Karl Hotel and Resort'
 
49
    company='Karls'
 
50
    location='Exmouth'
 
51
    date='2001-07-20 00:00:00'
 
52
    position='13'
 
53
    cost='280'
 
54
 /&gt;
 
55
&lt;/bookings&gt;
 
56
</span>
 
57
</div>
 
58
                                                                                                                                        
 
59
</span></pre>
 
60
 
 
61