Skip to content

Commit beae459

Browse files
committed
Moved debug info to an include file
1 parent 2fd66f1 commit beae459

10 files changed

Lines changed: 29 additions & 153 deletions

File tree

inc/bottom.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,22 @@
88
$("input[name='showdebug']").change(function() {
99
var sel = $(this).val();
1010
11-
switch (self) {
11+
switch (sel) {
1212
case "rawxml":
13-
$(".simplexml").hide();
14-
$(".rawxml").show();
15-
break;
13+
$(".simplexml").slideUp('fast', function() {
14+
$(".rawxml").slideDown("slow");
15+
});
16+
break;
1617
case "simplexml":
17-
$(".rawxml").hide();
18-
$(".simplexml").show();
18+
$(".rawxml").slideUp('fast', function() {
19+
$(".simplexml").slideDown("slow");
20+
});
1921
break;
2022
default:
21-
$(".rawxml").hide();
22-
$(".simplexml").hide();
23+
$(".rawxml").slideUp('fast');
24+
$(".simplexml").slideUp('fast');
2325
break;
2426
}
25-
26-
if( sel == "none") {
27-
} else {
28-
$("." + sel).show();
29-
$("." + sel).show();
30-
}
3127
});
3228
});
3329
</script>

inc/config-example.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
// Include the TourCMS API wrapper
3+
include_once($_SERVER['DOCUMENT_ROOT'] . '/tourcms.php');
4+
25
// Marketplace account ID
36
// Leave this as zero if you are a supplier (i.e. not a Marketplace partner)
47
$marketplace_account_id = 0;

inc/top.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
55
<title>List of Tours/Hotels</title>
6-
<link rel="stylesheet" href="style.css" />
6+
<link rel="stylesheet" href="inc/style.css" />
77
</head>
88
<body>

step0.php

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
include('inc/config.php');
1919

2020
// Search all Tours/Hotels
21-
$result = $tourcms->search_tours("", $channel);
21+
$result = $tourcms->search_tours("", $channel_id);
2222

2323
// Print out an error if there is one
2424
// Otherwise loop through Tours/Hotels and display them
@@ -35,25 +35,8 @@
3535

3636
?>
3737
</ul>
38-
39-
<!-- Debug -->
40-
<div id="debug">
41-
<form>
42-
<label><input type="radio" name="showdebug" value="none" checked /> Hide debug info</label>
43-
<label><input type="radio" name="showdebug" value="simplexml" /> Show SimpleXML object</label>
44-
<label><input type="radio" name="showdebug" value="rawxml" /> Show raw XML</label>
45-
</form>
46-
<pre class="simplexml"><?php print_r($result); ?></pre>
47-
<pre class="rawxml"><?php
48-
// Add indentation to XML output
49-
$dom = new DOMDocument('1.0');
50-
$dom->preserveWhiteSpace = false;
51-
$dom->formatOutput = true;
52-
$dom->loadXML($result->asXML());
53-
echo htmlspecialchars($dom->saveXML());
54-
?></pre>
55-
</div>
56-
38+
5739
<?php
40+
include_once("inc/debug.php");
5841
include_once("inc/bottom.php");
5942
?>

step1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
$url_data->addChild('response_url', str_replace("{tour_id}", (int)$_GET['tour'], $response_url));
2020

2121
// Send the response URL to TourCMS
22-
$result = $tourcms->get_booking_redirect_url($url_data, $channel);
22+
$result = $tourcms->get_booking_redirect_url($url_data, $channel_id);
2323

2424
// TourCMS should have returned a URL back to us, get that
2525
$redirect_url = $result->url->redirect_url;

step2.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
isset($_GET['tour']) ? $tour = (int)$_GET['tour'] : exit();
2222

2323
// Query the TourCMS API, get back all the info on this Tour/Hotel
24-
$result = $tourcms->show_tour($tour, $channel);
24+
$result = $tourcms->show_tour($tour, $channel_id);
2525

2626
// Jump straight to the bit of XML related to making a new booking panel
2727
// includes rate and date info
@@ -91,26 +91,8 @@
9191

9292
<input type="submit" name="submit" value="Go" />
9393
</form>
94-
95-
96-
<!-- Debug -->
97-
<div id="debug">
98-
<form>
99-
<label><input type="radio" name="showdebug" value="none" checked /> Hide debug info</label>
100-
<label><input type="radio" name="showdebug" value="simplexml" /> Show SimpleXML object</label>
101-
<label><input type="radio" name="showdebug" value="rawxml" /> Show raw XML</label>
102-
</form>
103-
<pre class="simplexml"><?php print_r($result); ?></pre>
104-
<pre class="rawxml"><?php
105-
// Add indentation to XML output
106-
$dom = new DOMDocument('1.0');
107-
$dom->preserveWhiteSpace = false;
108-
$dom->formatOutput = true;
109-
$dom->loadXML($result->asXML());
110-
echo htmlspecialchars($dom->saveXML());
111-
?></pre>
112-
</div>
11394

11495
<?php
96+
include_once("inc/debug.php");
11597
include_once("inc/bottom.php");
11698
?>

step3.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
}
4848
}
4949

50-
$result = $tourcms->check_tour_availability($qs, $tour, $channel);
50+
$result = $tourcms->check_tour_availability($qs, $tour, $channel_id);
5151

5252

5353
isset($result->available_components->component) ? $num_components = count($result->available_components->component) : $num_components = 0;
@@ -110,24 +110,9 @@
110110
?>
111111
<input type="submit" name="submit" value="Go" />
112112
</form>
113-
<!-- Debug -->
114-
<div id="debug">
115-
<form>
116-
<label><input type="radio" name="showdebug" value="none" checked /> Hide debug info</label>
117-
<label><input type="radio" name="showdebug" value="simplexml" /> Show SimpleXML object</label>
118-
<label><input type="radio" name="showdebug" value="rawxml" /> Show raw XML</label>
119-
</form>
120-
<pre class="simplexml"><?php print_r($result); ?></pre>
121-
<pre class="rawxml"><?php
122-
// Add indentation to XML output
123-
$dom = new DOMDocument('1.0');
124-
$dom->preserveWhiteSpace = false;
125-
$dom->formatOutput = true;
126-
$dom->loadXML($result->asXML());
127-
echo htmlspecialchars($dom->saveXML());
128-
?></pre>
129-
</div>
113+
130114

131115
<?php
116+
include_once("inc/debug.php");
132117
include_once("inc/bottom.php");
133118
?>

step4.php

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -64,35 +64,17 @@
6464
$customer->addChild('email', $email);
6565
}
6666

67-
$result = $tourcms->start_new_booking($booking, $channel);
67+
$result = $tourcms->start_new_booking($booking, $channel_id);
6868

6969
?>
70-
<h1>Temporary booking, prompt for creation of confirmed booking</h1>
70+
<h1>Temporary booking created, prompt for creation of confirmed booking</h1>
7171
<p>Are you sure you wish to book this Tour?</p>
7272
<form method="post" action="step5.php">
7373
<input type="hidden" name="booking_id" value="<?php print $result->booking->booking_id; ?>" />
7474
<input type="submit" name="submit" value="Go" />
7575
</form>
76-
77-
<!--pre><?php print(htmlentities($booking->asXML())); ?></pre><br /-->
78-
<!-- Debug -->
79-
<div id="debug">
80-
<form>
81-
<label><input type="radio" name="showdebug" value="none" checked /> Hide debug info</label>
82-
<label><input type="radio" name="showdebug" value="simplexml" /> Show SimpleXML object</label>
83-
<label><input type="radio" name="showdebug" value="rawxml" /> Show raw XML</label>
84-
</form>
85-
<pre class="simplexml"><?php print_r($result); ?></pre>
86-
<pre class="rawxml"><?php
87-
// Add indentation to XML output
88-
$dom = new DOMDocument('1.0');
89-
$dom->preserveWhiteSpace = false;
90-
$dom->formatOutput = true;
91-
$dom->loadXML($result->asXML());
92-
echo htmlspecialchars($dom->saveXML());
93-
?></pre>
94-
</div>
9576

9677
<?php
78+
include_once("inc/debug.php");
9779
include_once("inc/bottom.php");
9880
?>

step5.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,15 @@
1919
$booking = new SimpleXMLElement('<booking />');
2020
$booking->addChild('booking_id', $booking_id);
2121

22-
$result = $tourcms->commit_new_booking($booking, $channel);
22+
$result = $tourcms->commit_new_booking($booking, $channel_id);
2323

2424
}
2525

2626
?>
2727
<h1>Booking <?php print $result->booking->booking_id; ?> complete</h1>
28-
<!-- Debug -->
29-
<div id="debug">
30-
<form>
31-
<label><input type="radio" name="showdebug" value="none" checked /> Hide debug info</label>
32-
<label><input type="radio" name="showdebug" value="simplexml" /> Show SimpleXML object</label>
33-
<label><input type="radio" name="showdebug" value="rawxml" /> Show raw XML</label>
34-
</form>
35-
<pre class="simplexml"><?php print_r($result); ?></pre>
36-
<pre class="rawxml"><?php
37-
// Add indentation to XML output
38-
$dom = new DOMDocument('1.0');
39-
$dom->preserveWhiteSpace = false;
40-
$dom->formatOutput = true;
41-
$dom->loadXML($result->asXML());
42-
echo htmlspecialchars($dom->saveXML());
43-
?></pre>
44-
</div>
28+
4529

4630
<?php
31+
include_once("inc/debug.php");
4732
include_once("inc/bottom.php");
4833
?>

style.css

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)