bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/0.1
1
by Henrik G.
First seed of Lenasys ... Needs to be Organized Further |
1 |
<?php
|
2 |
||
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
3 |
function menulayout($forward, $backward, $downloadlink, $heading, $headinglink, $filecontent) { |
4.3.1
by a11vikob
In "Code Viewer Alt": |
4 |
echo "<body onload='resize();' onresize='resize();'>"; |
5 |
echo "<script language=\"javascript\" src=\"../jquery/jquery-1.8.2.min.js\"></script>"; |
|
1
by Henrik G.
First seed of Lenasys ... Needs to be Organized Further |
6 |
|
4.3.1
by a11vikob
In "Code Viewer Alt": |
7 |
echo "<div class='Topmenu'>"; |
8 |
echo "<table style='width:100%;height:100%;border:solid 1px;'>"; |
|
9 |
echo "<tr>"; |
|
10 |
echo "<td class='buttonstyle'>"; |
|
1
by Henrik G.
First seed of Lenasys ... Needs to be Organized Further |
11 |
echo "<a href='http://wwwlab.iki.his.se/~gush/Webbprogrammering/' title='Back to examples page'><img src='../img/back.png'></a>"; |
4.3.1
by a11vikob
In "Code Viewer Alt": |
12 |
echo "</td>"; |
13 |
||
14 |
if($backward != "") { |
|
15 |
echo "<td class='buttonstyle'>"; |
|
16 |
echo "<a href='".$backward."'><img src='../img/prev.png'></a>"; |
|
17 |
echo "</td>"; |
|
18 |
}
|
|
19 |
||
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
20 |
if($forward != "") { |
4.3.1
by a11vikob
In "Code Viewer Alt": |
21 |
echo "<td class='buttonstyle'>"; |
22 |
echo "<a href='".$forward."'><img src='../img/next.png'></a>"; |
|
23 |
echo "</td>"; |
|
24 |
}
|
|
25 |
||
26 |
echo "<td class='verticalaligntext'>"; |
|
27 |
echo "<a STYLE='text-decoration:none'>".$heading."</a>"; |
|
28 |
echo "</td>"; |
|
29 |
||
30 |
echo "<td class='buttonstyle'>"; |
|
31 |
echo "<a href=\"$headinglink\"><img src='../img/play.png'></a>"; |
|
32 |
echo "</td>"; |
|
33 |
||
34 |
echo "<td class='buttonstyle'>"; |
|
35 |
echo "<img src='../img/code.png' onclick=\"$('.lineno').toggle();$('.linenointeresting').toggle();$('.panel').toggle();\">"; |
|
36 |
echo "</td>"; |
|
37 |
||
38 |
echo "</tr>"; |
|
1
by Henrik G.
First seed of Lenasys ... Needs to be Organized Further |
39 |
echo "</table>"; |
40 |
||
4.3.1
by a11vikob
In "Code Viewer Alt": |
41 |
echo "</div>"; |
42 |
||
43 |
echo "<div id='bottom' class='RestContainer'>"; |
|
44 |
||
45 |
echo "<div style='float:left;'>"; |
|
46 |
echo "<div id='panel' class='panel' onmousemove='resizepanel(event)' onmousedown='mdpanel(event)' onmouseup='mupanel(event)'>"; |
|
47 |
include($filecontent); |
|
48 |
echo "</div>"; |
|
49 |
echo "</div>"; |
|
50 |
echo "<div class='codecontent'>"; |
|
1
by Henrik G.
First seed of Lenasys ... Needs to be Organized Further |
51 |
}
|
52 |
||
4.3.1
by a11vikob
In "Code Viewer Alt": |
53 |
function menulayoutend() { |
1
by Henrik G.
First seed of Lenasys ... Needs to be Organized Further |
54 |
echo "</div>"; |
55 |
echo "</div>"; |
|
56 |
echo "<div style='clear:both;'></div>"; |
|
57 |
echo "</body>"; |
|
58 |
}
|
|
59 |
||
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
60 |
function showfile($interestingrows, $keywords, $highlight, $filename) { |
4.3.1
by a11vikob
In "Code Viewer Alt": |
61 |
echo "<pre>"; |
62 |
$handle = @fopen($filename, "r"); |
|
63 |
if ($handle) { |
|
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
64 |
$lineno = 1; |
4.3.1
by a11vikob
In "Code Viewer Alt": |
65 |
while (($buffer = fgets($handle, 4096)) !== false) { |
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
66 |
$buffer = str_replace("\n", "", $buffer); |
67 |
$buffer = str_replace("\r", "", $buffer); |
|
68 |
$buffer = str_pad($buffer, 150, " ", STR_PAD_RIGHT); |
|
69 |
$buffer = str_replace("<", "<", $buffer); |
|
70 |
$buffer = str_replace(">", ">", $buffer); |
|
71 |
$buffer = str_replace("\t", " " , $buffer); |
|
4.3.1
by a11vikob
In "Code Viewer Alt": |
72 |
|
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
73 |
$interesting = 0; |
74 |
$startspan = 0; |
|
4.3.1
by a11vikob
In "Code Viewer Alt": |
75 |
foreach($interestingrows as $row) { |
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
76 |
if($lineno >= $row[0] && $lineno <= $row[1]){ |
4.3.1
by a11vikob
In "Code Viewer Alt": |
77 |
$interesting = true; |
78 |
}
|
|
79 |
}
|
|
80 |
||
81 |
foreach($keywords as $keyword) { |
|
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
82 |
if($interesting) { |
83 |
$buffer = str_replace($keyword, "<span class='keywordinteresting'>".$keyword."</span>", $buffer); |
|
4.3.1
by a11vikob
In "Code Viewer Alt": |
84 |
} else { |
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
85 |
$buffer = str_replace($keyword, "<span class='keyword'>".$keyword."</span>", $buffer); |
4.3.1
by a11vikob
In "Code Viewer Alt": |
86 |
}
|
87 |
}
|
|
88 |
||
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
89 |
$commentpos = strpos($buffer, "//"); |
4.3.1
by a11vikob
In "Code Viewer Alt": |
90 |
if(!$commentpos) { |
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
91 |
$commentpos = 5000; |
4.3.1
by a11vikob
In "Code Viewer Alt": |
92 |
}
|
93 |
foreach($highlight as $highlightkeyword) { |
|
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
94 |
$foundpos = strpos($buffer, $highlightkeyword[0]); |
4.3.1
by a11vikob
In "Code Viewer Alt": |
95 |
if($foundpos <= $commentpos) { |
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
96 |
$buffer = str_replace($highlightkeyword[0], "<span class='".$highlightkeyword[1]."'>".$highlightkeyword[0]."</span>", $buffer); |
4.3.1
by a11vikob
In "Code Viewer Alt": |
97 |
}
|
98 |
}
|
|
99 |
||
4.3.3
by a11vikob
Indentation etc fixed |
100 |
if($commentpos < 5000) { |
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
101 |
$buffer = str_replace("//","<span class='commented'>//", $buffer); |
102 |
$buffer .= "</span>"; |
|
4.3.1
by a11vikob
In "Code Viewer Alt": |
103 |
}
|
104 |
||
105 |
$linenostr = $lineno; |
|
4.2.9
by c11emian
Adjusted the file showcode.php so that it conforms to our code standard. |
106 |
$linenostr = str_pad($linenostr, 3, " ", STR_PAD_RIGHT); |
4.3.1
by a11vikob
In "Code Viewer Alt": |
107 |
|
4.3.3
by a11vikob
Indentation etc fixed |
108 |
if($interesting) { |
4.3.1
by a11vikob
In "Code Viewer Alt": |
109 |
echo "<span class='interesting'>"; |
110 |
echo "<span class='linenointeresting'>".$linenostr."</span> "; |
|
111 |
$startspan = 1; |
|
112 |
} else { |
|
113 |
echo "<span class='lineno'>".$linenostr."</span> "; |
|
114 |
}
|
|
115 |
||
116 |
echo $buffer; |
|
117 |
||
118 |
if($startspan) { |
|
119 |
echo "</span>"; |
|
120 |
}
|
|
121 |
$lineno++; |
|
122 |
||
123 |
echo "<br>"; |
|
124 |
}
|
|
125 |
if (!feof($handle)) { |
|
126 |
echo "Error: unexpected fgets() fail\n"; |
|
127 |
}
|
|
128 |
fclose($handle); |
|
129 |
}
|
|
130 |
echo "</pre>"; |
|
1
by Henrik G.
First seed of Lenasys ... Needs to be Organized Further |
131 |
}
|
132 |
?>
|