/[drupal]/contributions/sandbox/jeremy/4.4.0/kerneltrap/kt-theme/kt.theme
ViewVC logotype

Contents of /contributions/sandbox/jeremy/4.4.0/kerneltrap/kt-theme/kt.theme

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Sat May 29 16:41:16 2004 UTC (5 years, 6 months ago) by jeremy
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +110 -20 lines
File MIME type: text/x-php
Updated to display story icons with taxonomy_image.module.
1 <?php
2
3 function kt_help($section) {
4 switch ($section) {
5 case 'admin/system/themes#description':
6 return t("The default three column KernelTrap theme.");
7 }
8 }
9
10
11 function kt_page($content, $title = NULL, $breadcrumb = NULL) {
12 $theme_name = "kt";
13 $theme_author = "Jeremy Andrews";
14
15 if (isset($title)) {
16 drupal_set_title($title);
17 }
18 if (isset($breadcrumb)) {
19 drupal_set_breadcrumb($breadcrumb);
20 }
21
22
23 $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
24 $output .= "\n\n<!-- Drupal theme '$theme_name' written by '$theme_author' -->";
25 $output .= "\n<html>";
26 $output .= "\n<head>";
27 $output .= "\n<!-- BEGIN: Drupal module-generated headers -->\n";
28 $output .= drupal_get_html_head($main);
29 $output .= "<!-- END: Drupal module-generated headers -->";
30 if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
31 $output .= "\n <link rel=\"stylesheet\" type=\"text/css\" href=\"themes/$theme_name/$theme_name-ie.css\" title=\"Default\" />";
32 }
33 else {
34 $output .= "\n <link rel=\"stylesheet\" type=\"text/css\" href=\"themes/$theme_name/$theme_name-new.css\" title=\"Default\" />";
35 }
36 $output .= "\n <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"/node/feed\" />";
37 $output .= "\n <link rel=\"icon\" href=\"favicon.ico\" type=\"image/ico\" />";
38 $output .= "\n <title>". ($title ? $title : variable_get(site_name, "KernelTrap")) ."</title>";
39 $output .= "\n</head>";
40 $output .= "\n<body>";
41 $output .= "\n <center><table class=\"ktpage\">";
42
43 // Logo bar
44 $output .= "\n <tr><td colspan=\"3\" class=\"ktpagehead\">";
45 $output .= "\n <center><table><tr>";
46 $output .= "\n <td width=\"10%\"><a href=\"$base_url\"><img src=\"themes/$theme_name/images/logo.png\" border=0 alt=\"KernelTrap logo\" /></a></td>";
47 $output .= "\n <td colspan=2 width=\"70%\" align=\"center\">";
48 $output .= "\n <table><tr>";
49 $output .= "\n <td class=\"bannerad\"><a href=\"\">". banner_display(3) ."</a></td>";
50 $output .= "\n </tr><tr>";
51 $output .= "\n <td class=\"bannertag\"><a href=\"http://kerneltrap.org/ads\">Advertise on KernelTrap</a></td>";
52 $output .= "\n </tr></table>";
53 $output .= "\n </td>";
54 $output .= "\n </tr></table></center>";
55 $output .= "\n </td></tr>";
56 $output .= "\n </table>";
57 $output .= "\n <table class=\"ktpage\">";
58
59 // Navigation bar
60 $output .= "\n <tr><td colspan=\"3\" class=\"ktpagehead\">";
61 $output .= "\n <table class=\"kttable\">";
62 $output .= "\n <tr><td align=\"center\">";
63 $output .= navigation_display_tabs(1);
64 $output .= "\n </td><td align=\"right\">";
65 $output .= "\n <form action=\"?q=search\" method=\"post\"><input type=\"text\" size=\"10\" name=\"keys\" /><input type=\"submit\" value=\"Search\" /></form>";
66 $output .= "\n </td></tr>";
67 $output .= "\n </table>";
68 $output .= "\n </td></tr>";
69
70 // Left side blocks
71 $output .= "\n <tr><td valign=\"top\" width=\"10%\" align=\"center\" class=\"blockleft\">\n";
72 $output .= theme_blocks("left");
73 $output .= "\n </td>";
74
75 // Body
76 $output .= "\n <td valign=\"top\" width=\"70%\">\n";
77 // custom message: should be configurable
78 $uri = request_uri();
79 if ("$uri" == "/" || "$uri" == "/index.php") {
80 $output .= "\n <table class=\"kttable\">";
81 $output .= "\n <tr><td class=\"announcement\">";
82 $output .= "\nWelcome to KernelTrap.org. If you're new here and have questions, please first visit the <a href=\"http://kerneltrap.org/faq\">FAQ</a>. In addition to what you see here on the front page, news can also be found in the forums (<a href=\"http://kerneltrap.org/forum/linux\">Linux</a>, <a href=\"http://kerneltrap.org/forum/freebsd\">FreeBSD</a>, <a href=\"http://kerneltrap.org/forum/openbsd\">OpenBSD</a>, and <a href=\"http://kerneltrap.org/forum/\">more</a>). To see all content, click <a href=\"http://kerneltrap.org/all\">all</a>.";
83 $output .= "\n </td></tr>";
84 $output .= "\n </table>";
85 }
86
87 if ($title = drupal_get_title()) {
88 $output .= theme("breadcrumb", drupal_get_breadcrumb());
89 $path = explode("/", drupal_get_path_alias($_GET['q']));
90 $output .= '<h2>'. kt_custom_title($title, $path[0], $path[1]) .'</h2>';
91 }
92
93 if ($help = menu_get_active_help()) {
94 $output .= "<div class=\"help\">\n";
95 $output .= " <small>$help</small>\n";
96 $output .= "</div>\n";
97 }
98
99 foreach (drupal_get_messages() as $message) {
100 list($message, $type) = $message;
101 $output .= "<div class=\"status\">\n";
102 $output .= "<strong>". t("Status") ."</strong>: $message";
103 $output .= "</div>\n";
104 }
105
106 $output .= "\n<!-- BEGIN: content --><div id=\"bodycontent\">\n";
107 $output .= $content;
108 $output .= "\n</div><!-- END: content -->\n";
109 $output .= "\n </td>";
110
111 $output .= "\n <td valign=\"top\" width=\"20%\" align=\"center\" class=\"blockright\">";
112 $output .= theme_blocks("right");
113 $output .= "<center>
114 <script type=\"text/javascript\"><!--
115 google_ad_client = \"pub-0170664634264979\";
116 google_ad_width = 120;
117 google_ad_height = 600;
118 google_ad_format = \"120x600_as\";
119 google_ad_channel =\"2556213039\";
120 google_color_border = \"CCCCCC\";
121 google_color_bg = \"F0F0F0\";
122 google_color_link = \"0000FF\";
123 google_color_url = \"008000\";
124 google_color_text = \"000000\";
125 //--></script>
126 <script type=\"text/javascript\"
127 src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
128 </script>
129 </center>";
130 $output .= "\n </td>";
131 $output .= "\n </tr>";
132
133 // Footer
134 $output .= "\n <tr><td colspan=\"3\" class=\"ktpagefoot\">";
135 //$output .= "\n ". $this->links(link_page());
136 $output .= "\n </td></tr>";
137 $output .= "\n </table></center>";
138 $output .= "\n<!-- BEGIN: Configurable footer message -->\n";
139 $output .= "\n<center><div id=\"sitefooter\">". variable_get("site_footer","") ."</div></center>";
140 $output .= "\n<!-- END: Configurable footer message -->\n";
141 $output .= "\n<!-- BEGIN: Drupal module-generated footers -->\n";
142 $output .= theme_closure();
143 $output .= "\n<!-- END: Drupal module-generated footers -->";
144 $output .= "\n</body>";
145 $output .= "\n</html>";
146 return $output;
147 }
148
149
150 function kt_node($node, $main = 0, $page = 0) {
151 $output = "\n <!-- BEGIN: '$node->title' -->";
152 $output .= "\n <table class=\"kttable\">";
153 $output .= "\n <tr><td class=\"node\">";
154 $output .= "\n <table class=\"kttable\">";
155 $output .= "\n <tr><td class=\"nodehead\">";
156 if ($main) {
157 $output .= "\n <div class=\"nodeheadtitle\">$node->title</div>";
158 }
159 $output .= "<div class=\"nodeheadother\">Posted by ". format_name($node) ." on ". format_date($node->created, "large") ."</div>";
160 $output .= "\n </td></tr>";
161
162 // load appropriate icons
163 $section_img = array();
164 foreach (taxonomy_node_get_terms($node->nid) as $term) {
165 $section_img[] = taxonomy_image_display($term->tid, "border=0 align='right' hspace='5' alt='$term->name'");
166 }
167
168 // display node teaser or body
169 if ($main && $node->teaser) {
170 $output .= "\n <tr><td class=\"nodebody\">";
171 if ($section_img) {
172 foreach($section_img as $image)
173 $output .= "$image";
174 }
175 $output .= "\n$node->teaser</td></tr>";
176 }
177 else {
178 $output .= "\n <tr><td class=\"nodebody\">";
179 if ($section_img) {
180 foreach($section_img as $image)
181 $output .= "$image";
182 }
183 $output .= "\n$node->body</td></tr>";
184 }
185
186 // add links
187 if ($links = link_node($node, $main)) {
188 $output .= "\n <tr><td class=\"nodefoot\">[". theme('links', $links) ."]</td></tr>";
189 }
190
191 // closeout node
192 $output .= "\n </table>";
193 $output .= "\n </td></tr>";
194 $output .= "\n </table>";
195 $output .= "\n <!-- END: '$node->title' -->";
196
197 return $output;
198 }
199
200
201 function kt_comment($comment, $link) {
202 $output = "\n <!-- BEGIN: comment by $comment->name -->";
203 $output .= "\n <a name=\"$comment->cid\"></a>";
204 $output .= "\n <table>";
205 $output .= "\n <tr><td class=\"comment\">";
206 $output .= "\n <table class=\"kttable\">";
207 $output .= "\n <tr><td class=\"commenthead\">";
208 if ($comment->new) {
209 $output .= "\n <div class=\"commentheadtitlenew\">$comment->subject</div>";
210 }
211 else {
212 $output .= "\n <div class=\"commentheadtitle\">$comment->subject</div>";
213 }
214 $output .= "<div class=\"commentheadother\">". ($comment->rating ? "$comment->rating comment " : "Unrated comment ") ."posted by ". format_name($comment) ." on ". format_date($comment->timestamp, "large") ."</div>";
215 $output .= "\n </td></tr>";
216 $output .= "\n <tr><td class=\"commentbody\">";
217 $output .= "\n $comment->comment";
218 $output .= "\n </td></tr>";
219 $output .= "\n <tr><td class=\"commentfoot\">";
220 $output .= "\n [ $link ]";
221 $output .= "\n </td></tr>";
222 $output .= "\n </table>";
223 $output .= "\n </td></tr>";
224 $output .= "\n </table>";
225 $output .= "\n <!-- END: comment by $comment->name -->";
226
227 return $output;
228 }
229
230 function kt_comment_folded($comment) {
231 return "<div class=\"comment-folded\"><span class=\"subject\">". ($comment->rating ? "$comment->rating comment \"" : "Unrated comment \"") . l($comment->subject, comment_referer_load() ."/$comment->cid#$comment->cid") ."\"</span> <span class=\"credit\">". t("by") ." ". format_name($comment) ."</span></div>";
232 }
233
234 function kt_box($subject, $content, $region = "main") {
235 $output = "\n <!-- BEGIN: '$subject' Drupal box -->";
236 $output .= "\n <table>";
237 $output .= "\n <tr><td class=\"box\">";
238 $output .= "\n <table>";
239 $output .= "\n <tr><td class=\"boxhead\">$subject</td></tr>";
240 if ($subject == "Advertisement") {
241 $output .= "\n <tr><td class=\"boxadtext\">$content</td></tr>";
242 }
243 else if ( $subject == "") {
244 $output .= "\n <tr><td class=\"boxadgraphic\">$content</td></tr>";
245 }
246 else {
247 $output .= "\n <tr><td class=\"boxbody$region\">$content</td></tr>";
248 }
249 $output .= "\n </table>";
250 $output .= "\n </td></tr>";
251 $output .= "\n </table>";
252 $output .= "\n <!-- END: '$subject' Drupal box -->";
253
254 return $output;
255 }
256
257 function kt_custom_title($title, $main, $sub) {
258 // This is a kludge. The navigation.module should be able to set the
259 // title for a given link... (aka, coming soon)
260 switch ($main) {
261 case 'all':
262 switch ($sub) {
263 case '':
264 $title = 'All content.';
265 break;
266 case 'linux':
267 $title = 'All Linux content.';
268 break;
269 case 'freebsd':
270 $title = 'All FreeBSD content.';
271 break;
272 case 'openbsd':
273 $title = 'All OpenBSD content.';
274 break;
275 case 'netbsd':
276 $title = 'All NetBSD content.';
277 break;
278 case 'hurd':
279 $title = 'All GNU/Hurd content.';
280 break;
281 }
282 break;
283 case 'features':
284 switch ($sub) {
285 case '':
286 $title = 'All KernelTrap features.';
287 break;
288 case 'interviews':
289 $title = 'KernelTrap feature interviews.';
290 break;
291 case 'linux':
292 $title = 'KernelTrap Linux features.';
293 break;
294 case 'freebsd':
295 $title = 'KernelTrap FreeBSD features.';
296 break;
297 case 'openbsd':
298 $title = 'KernelTrap OpenBSD features.';
299 break;
300 case 'netbsd':
301 $title = 'KernelTrap NetBSD features.';
302 break;
303 case 'hurd':
304 $title = 'KernelTrap GNU/Hurd features.';
305 break;
306 }
307 break;
308 case 'journals':
309 switch ($sub) {
310 case '':
311 $title = 'All journals.';
312 break;
313 case 'hackers':
314 $title = 'Kernel hacker journals.';
315 break;
316 case 'computers':
317 $title = 'Computer related journal entries.';
318 break;
319 case 'personal':
320 $title = 'Personal journal entries.';
321 break;
322 case 'kerneltrap':
323 $title = 'KernelTrap related journal entries.';
324 break;
325 }
326 break;
327 }
328 drupal_set_title($title);
329 return $title;
330 }
331
332 ?>

  ViewVC Help
Powered by ViewVC 1.1.2