PageRenderTime 27ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/website/lib/vendor/pChart2.1.3/examples/imageMap/index.php

https://github.com/rbolliger/otokou
PHP | 186 lines | 155 code | 24 blank | 7 comment | 17 complexity | aea67cfec309f785cd86052dda36506c MD5 | raw file
  1. <?php if ( isset($_GET["Action"]) && $_GET["Action"] == "ViewPHP") { $Script = $_GET["Script"]; highlight_file($Script); exit(); } ?>
  2. <?php if ( isset($_GET["Action"]) && $_GET["Action"] == "ViewHTML") { $Script = $_GET["Script"]; writeHTML($Script); exit(); } ?>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5. <head>
  6. <script src='imagemap.js' type="text/javascript"></script>
  7. <title>pChart 2.x - Image map</title>
  8. <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
  9. <style>
  10. body { background-color: #F0F0F0; font-family: tahoma; font-size: 14px;}
  11. td { font-family: tahoma; font-size: 11px; }
  12. div.txt { font-family: tahoma; font-size: 11px; width: 660px; padding: 15px; }
  13. div.folder { cursor: hand; cursor: pointer; }
  14. a.smallLink:link { text-decoration: none; color: #6A6A6A; }
  15. a.smallLink:visited { text-decoration: none; color: #6A6A6A; }
  16. a.smallLink:hover { text-decoration: underline; color: #6A6A6A; }
  17. a.smallLinkGrey:link { text-decoration: none; color: #6A6A6A; }
  18. a.smallLinkGrey:visited { text-decoration: none; color: #6A6A6A; }
  19. a.smallLinkGrey:hover { text-decoration: underline; color: #6A6A6A; }
  20. a.smallLinkBlack:link { text-decoration: none; color: #000000; }
  21. a.smallLinkBlack:visited { text-decoration: none; color: #000000; }
  22. a.smallLinkBlack:hover { text-decoration: underline; color: #000000; }
  23. a.pChart { text-decoration: none; color: #6A6A6A; }
  24. a img, img { border: none; }
  25. </style>
  26. </head>
  27. <body>
  28. <?php
  29. /* Files that we don't want to see in the tree */
  30. $Exclusion = array(".","..");
  31. /* Determine the current package version */
  32. $FileHandle = fopen("../../readme.txt", "r");
  33. for ($i=0; $i<=5; $i++) { $buffer = fgets($FileHandle, 4096); }
  34. fclose($FileHandle);
  35. $Values = preg_split("/:/",$buffer);
  36. $Values = preg_split("/ /",$Values[1]);
  37. $Version = strip_tags($Values[1]);
  38. /* Build a list of the examples & categories */
  39. $DirectoryHandle = opendir("scripts");
  40. {
  41. $Tree = "";
  42. while (($FileName = readdir($DirectoryHandle)) !== false)
  43. {
  44. if ( !in_array($FileName,$Exclusion))
  45. $Tree[] = str_replace(".php","",$FileName);
  46. }
  47. }
  48. ?>
  49. <table style='border: 2px solid #FFFFFF;'><tr><td>
  50. <div style='font-size: 11px; padding: 2px; color: #FFFFFF; background-color: #666666; border-bottom: 3px solid #484848;'>&nbsp;Navigation</div>
  51. <table style='padding: 1px; background-color: #E0E0E0; border: 1px solid #D0D0D0; border-top: 1px solid #FFFFFF;'><tr>
  52. <td width=16><img src='../resources/application_view_tile.png' width=16 height=16 alt=''/></td>
  53. <td width=100>&nbsp;<a class=smallLinkGrey href='../'>Examples</a></td>
  54. <td width=16><img src='../resources/application_view_list.png' width=16 height=16 alt=''/></td>
  55. <td width=100>&nbsp;<a class=smallLinkGrey href='../sandbox/'>Sandbox</a></td>
  56. <td width=16><img src='../resources/application_view_list.png' width=16 height=16 alt=''/></td>
  57. <td width=100>&nbsp;<a class=smallLinkGrey href='../delayedLoader/'>Delayed loader</a></td>
  58. <td width=16><img src='../resources/application_view_list.png' width=16 height=16 alt=''/></td>
  59. <td width=100>&nbsp;<b>Image Map</b></td>
  60. </tr></table>
  61. </td></tr></table>
  62. <br/>
  63. <table><tr><td valign='top'>
  64. <table style='border: 2px solid #FFFFFF;'><tr><td>
  65. <div style='font-size: 11px; padding: 2px; color: #FFFFFF; background-color: #666666; border-bottom: 3px solid #484848; width: 222px;'>&nbsp;Release <?php echo $Version; ?></div>
  66. <div style='border: 3px solid #D0D0D0; border-top: 1px solid #FFFFFF; background-color: #FAFAFA; width: 220px; overflow: auto'>
  67. <div style='padding: 1px; padding-bottom: 3px; color: #000000; background-color:#D0D0D0;'>
  68. <table><tr>
  69. <td><img src='../resources/application_view_list.png' width=16 height=16 alt=''/></td>
  70. <td>&nbsp;Examples folder contents</td>
  71. </tr></table>
  72. </div>
  73. <?php
  74. foreach($Tree as $Key => $Element)
  75. {
  76. if ( $Key == count($Tree)-1 ) { $Icon = "../resources/dash-explorer-last.png"; } else { $Icon = "../resources/dash-explorer.png"; }
  77. echo "<table noborder cellpadding=0 cellspacing=0>\r\n";
  78. echo " <tr valign=middle>\r\n";
  79. echo " <td><img src='".$Icon."' width=16 height=20 alt=''/></td>\r\n";
  80. echo " <td><img src='../resources/application_view_tile.png' width=16 height=16 alt=''/></td>\r\n";
  81. echo " <td><div class=folder onclick='showExample(".chr(34).$Element.chr(34).");'>&nbsp;".$Element."</div></td>\r\n";
  82. echo " </tr>\r\n";
  83. echo "</table>\r\n";
  84. }
  85. ?>
  86. </div>
  87. </td></tr></table>
  88. </td><td width=20></td><td valign='top' style='padding-top: 5px; font-size: 12px;'>
  89. <table><tr>
  90. <td><img src='../resources/chart_bar.png' width=16 height=16 alt=''/></td>
  91. <td>&nbsp;Rendering area</td>
  92. </tr></table>
  93. <div style='display:table-cell; padding: 10px; border: 2px solid #FFFFFF; vertical-align: middle; overflow: auto; background-image: url("resources/dash.png");'>
  94. <div style='font-size: 10px;' id=render>
  95. <table><tr><td><img src='../resources/accept.png' width=16 height=16 alt=""/></td><td>Click on an example to render it!</td></tr></table>
  96. </div>
  97. </div>
  98. <br/><br/>
  99. <table><tr>
  100. <td><img src='../resources/application_view_list.png' width=16 height=16 alt=''/></td>
  101. <td>&nbsp;HTML Source area</td>
  102. </tr></table>
  103. <div style='display:table-cell; padding: 10px; border: 2px solid #FFFFFF; vertical-align: middle; overflow: auto; background-image: url("resources/dash.png");'>
  104. <div id=htmlsource style='width: 700px; font-size: 13px; font-family: Lucida Console'>
  105. &lt;html&gt;<br/>
  106. &lt;head&gt;<br/>
  107. &nbsp;&nbsp; &lt;style&gt;<br/>
  108. &nbsp;&nbsp;&nbsp;&nbsp; div.pChartPicture { border: 0px; }<br/>
  109. &nbsp;&nbsp; &lt;/style&gt;<br/>
  110. &lt;/head&gt;<br/>
  111. &lt;body&gt;<br/>
  112. &nbsp;&nbsp; &lt;script src="imagemap.js" type="text/javascript"&gt;&lt;/script&gt;<br/>
  113. &nbsp;&nbsp; &lt;img src="draw.php" id="testPicture" alt="" class="pChartPicture"/&gt;<br/>
  114. &lt;/body&gt;<br/>
  115. &lt;script&gt;<br/>
  116. &nbsp;&nbsp; addImage("testPicture","pictureMap","draw.php?ImageMap=get");<br/>
  117. &lt;/script&gt;<br/>
  118. </div>
  119. </div>
  120. <br/><br/>
  121. <table><tr>
  122. <td><img src='../resources/application_view_list.png' width=16 height=16 alt=''/></td>
  123. <td>&nbsp;PHP Source area</td>
  124. </tr></table>
  125. <div style='display:table-cell; padding: 10px; border: 2px solid #FFFFFF; vertical-align: middle; overflow: auto; background-image: url("resources/dash.png");'>
  126. <div style='font-size: 10px;' id=source style='width: 700px;'>
  127. <table><tr><td><img src='../resources/accept.png' width=16 height=16 alt=""/></td><td>Click on an example to get its source!</td></tr></table>
  128. </div>
  129. </div>
  130. </td></tr></table>
  131. </body>
  132. </html>
  133. <script>
  134. function showExample(FileName)
  135. {
  136. document.getElementById("render").innerHTML = "<img src='scripts/"+FileName+".php?Seed="+Math.random(100)+"' id='testPicture' alt='' class='pChartPicture'/>";
  137. viewPHP("scripts/"+FileName+".php");
  138. addImage('testPicture','pictureMap','scripts/'+FileName+'.php?ImageMap=get');
  139. }
  140. function viewPHP(URL)
  141. {
  142. var xmlhttp=false;
  143. /*@cc_on @*/
  144. /*@if (@_jscript_version >= 5)
  145. try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } }
  146. @end @*/
  147. URL = "index.php?Action=ViewPHP&Script=" + URL;
  148. if (!xmlhttp && typeof XMLHttpRequest!='undefined')
  149. { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } }
  150. if (!xmlhttp && window.createRequest)
  151. { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } }
  152. xmlhttp.open("GET", URL,true);
  153. xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { Result = xmlhttp.responseText; document.getElementById("source").innerHTML = Result.replace("/\<BR\>/"); } }
  154. xmlhttp.send(null)
  155. }
  156. </script>
  157. <?php
  158. function writeHTML($Script)
  159. {
  160. echo $Script;
  161. }
  162. ?>