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 | $toc = DOMDocument::load("WebTOC.xml"); |
||
31 | $navToc = new DOMXpath($toc); |
||
32 | $root = $navToc->query("//HelpTOCNode[@Id='" . $_GET["Id"] . "']/*" ); |
||
33 | |||
34 | if ($root->length == 0) { |
||
35 | print "<b>TOC node not found!</b>"; |
||
36 | die(); |
||
37 | } |
||
38 | |||
39 | foreach ($root as $node) { |
||
40 | |||
41 | if ($node->hasChildNodes()) { |
||
42 | $id = $node->getAttribute("Id"); |
||
43 | $title = $node->getAttribute("Title"); |
||
44 | $url = $node->getAttribute("Url"); |
||
45 | |||
46 | if ($url) { |
||
47 | $target = " target=\"TopicContent\""; |
||
48 | } else { |
||
49 | $url = "#"; |
||
50 | $target = ""; |
||
51 | } |
||
52 | |||
53 | $ret .= sprintf("<div class=\"TreeNode\">\r\n" . |
||
54 | "<img class=\"TreeNodeImg\" " . |
||
55 | "onclick=\"javascript: Toggle(this);\" " . |
||
56 | "src=\"Collapsed.gif\"/><a class=\"UnselectedNode\" " . |
||
57 | "onclick=\"javascript: return Expand(this);\" " . |
||
58 | "href=\"%s\"%s>%s</a>\r\n" . |
||
59 | "<div id=\"%s\" class=\"Hidden\"></div>\r\n</div>\r\n", |
||
60 | $url, $target, htmlentities($title), $id); |
||
61 | } else { |
||
62 | |||
63 | $title = $node->getAttribute("Title"); |
||
64 | $url = $node->getAttribute("Url"); |
||
65 | |||
66 | if (!$url) |
||
67 | $url = "about:blank"; |
||
68 | |||
69 | $ret .= sprintf("<div class=\"TreeItem\">\r\n" . |
||
70 | "<img src=\"Item.gif\"/>" . |
||
71 | "<a class=\"UnselectedNode\" " . |
||
72 | "onclick=\"javascript: return SelectNode(this);\" " . |
||
73 | "href=\"%s\" target=\"TopicContent\">%s</a>\r\n" . |
||
74 | "</div>\r\n", |
||
75 | $url, htmlentities($title)); |
||
76 | |||
77 | } |
||
78 | |||
79 | } |
||
80 | |||
81 | print $ret; |