corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | <?php |
2 | |||
3 | //============================================================================= |
||
4 | // System : Sandcastle Help File Builder (PHP port) |
||
5 | // Author : Latif Khalifa <latifer@streamgrid.net>, All rights reserved |
||
6 | // Copyright (c) 2011, Latif Khalifa <latifer@streamgrid.net> |
||
7 | // |
||
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy |
||
9 | // of this software and associated documentation files (the "Software"), to deal |
||
10 | // in the Software without restriction, including without limitation the rights |
||
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||
12 | // copies of the Software, and to permit persons to whom the Software is |
||
13 | // furnished to do so, subject to the following conditions: |
||
14 | |||
15 | // The above copyright notice and this permission notice shall be included in |
||
16 | // all copies or substantial portions of the Software. |
||
17 | |||
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||
24 | // THE SOFTWARE. |
||
25 | // |
||
26 | // Based on C# version by Eric Woodruff (Eric@EWoodruff.us) from code by Ferdinand Prantl |
||
27 | // Copyright 2008, Eric Woodruff, All rights reserved |
||
28 | |||
29 | $ret = ""; |
||
30 | |||
31 | $ki = DOMDocument::load("WebKI.xml"); |
||
32 | $xpath = new DOMXpath($ki); |
||
33 | $root = $xpath->query("*" ); |
||
34 | |||
35 | $startIndex = 0; |
||
36 | |||
37 | if (isset($_GET["StartIndex"])) { |
||
38 | $startIndex = (int)$_GET["StartIndex"]; |
||
39 | } |
||
40 | |||
41 | $endIndex = $startIndex + 128; |
||
42 | |||
43 | if ($endIndex > $root->length) |
||
44 | $endIndex = $root->length; |
||
45 | |||
46 | if ($startIndex > 0) { |
||
47 | $prev = $startIndex - 128; |
||
48 | if ($prev < 0) $prev = 0; |
||
49 | $ret .= "<div class=\"IndexItem\">\r\n" . |
||
50 | "<span> </span><a class=\"UnselectedNode\" " . |
||
51 | "onclick=\"javascript: return PopulateIndex($prev);\" " . |
||
52 | "href=\"#\"><b><< Previous page</b></a>\r\n</div>\r\n"; |
||
53 | } |
||
54 | |||
55 | |||
56 | $title = ""; |
||
57 | |||
58 | while($startIndex < $endIndex) { |
||
59 | $node = $root->item($startIndex); |
||
60 | $url = $node->getAttribute("Url"); |
||
61 | |||
62 | if (!$url) { |
||
63 | $url = "#"; |
||
64 | $target = ""; |
||
65 | } else { |
||
66 | $target = " target=\"TopicContent\""; |
||
67 | } |
||
68 | |||
69 | $ret .= sprintf("<div class=\"IndexItem\">\r\n" . |
||
70 | "<span> </span><a class=\"UnselectedNode\" " . |
||
71 | "onclick=\"javascript: return SelectIndexNode(this);\" " . |
||
72 | "href=\"%s\"%s>%s</a>\r\n", $url, $target, |
||
73 | htmlentities($node->getAttribute("Title"))); |
||
74 | |||
75 | if ($node->hasChildNodes()) { |
||
76 | foreach($node->childNodes as $subNode) { |
||
77 | $ret .= sprintf("<div class=\"IndexSubItem\">\r\n" . |
||
78 | "<img src=\"Item.gif\"/><a class=\"UnselectedNode\" " . |
||
79 | "onclick=\"javascript: return SelectIndexNode(this);\" " . |
||
80 | "href=\"%s\" target=\"TopicContent\">%s</a>\r\n</div>\r\n", |
||
81 | $subNode->getAttribute("Url"), |
||
82 | htmlentities($subNode->getAttribute("Title"))); |
||
83 | } |
||
84 | } |
||
85 | |||
86 | $ret .= "</div>\r\n"; |
||
87 | |||
88 | $startIndex++; |
||
89 | } |
||
90 | |||
91 | if ($startIndex < $root->length) { |
||
92 | $ret .= "<div class=\"IndexItem\">\r\n" . |
||
93 | "<span> </span><a class=\"UnselectedNode\" " . |
||
94 | "onclick=\"javascript: return PopulateIndex($startIndex);\" " . |
||
95 | "href=\"#\"><b>Next page >></b></a>\r\n</div>\r\n"; |
||
96 | } |
||
97 | |||
98 | print $ret; |