/[drupal]/contributions/themes/marvin_2k/marvin_2k.theme
ViewVC logotype

Contents of /contributions/themes/marvin_2k/marvin_2k.theme

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


Revision 1.15 - (show annotations) (download) (as text)
Wed Aug 11 04:08:13 2004 UTC (5 years, 3 months ago) by gordon
Branch: MAIN
CVS Tags: HEAD
Changes since 1.14: +5 -9 lines
File MIME type: text/x-php
- added tab support
- added support for new theme_status_messages() function
1 <?php
2 /* $Id: marvin_2k.theme,v 1.14 2004/04/08 00:27:37 codemonkeyx Exp $ */
3 /**
4 An update to the original marvin theme, using the latest web standards.
5
6 A complete update to the original marvin theme, marvin_2k provides many
7 new features. Some of the features include a new tableless, CSS based
8 design which takes advantage of the latest web standards.
9
10 @author Nicholas Young-Soares
11 @package theme_marvin_2k
12 **/
13 if (!class_exists('Template')) {
14 require_once(realpath('themes/marvin_2k/template.php'));
15 }
16
17 function marvin_2k_settings() {
18 $output = form_textarea(t("Custom navigation links"), "marvin_2k_links", variable_get("marvin_2k_links", ""), 70, 6, t("Enter a list of html links separated by semi-colons (;) to override the default navigation links."));
19 $output .= form_radios(t("Display mission statement on front page"), "marvin_2k_display_mission", variable_get("marvin_2k_display_mission", "yes"), array("yes" => t("Yes."), "no" => t("No."), "custom" => t("Custom. Display the message defined below instead.")));
20 $output .= form_textarea(t("Alternative front page message"), "marvin_2k_message", variable_get("marvin_2k_message", "edit custom message"), 70, 6, t("if you have selected the custom option above, then this text will be displayed on the front page. It can be used to display a mission statement, announcement or site description."));
21 $output .= form_radios(t("Search box"), "marvin_2k_search_box", variable_get("marvin_2k_search_box", 1), array(t("Disabled"), t("Enabled")));
22 return $output;
23 }
24
25 function marvin_2k_help($section) {
26
27 $output = "";
28
29 switch ($section) {
30 case 'admin/themes#description':
31 $output = t("Tableless CSS theme, using web standards.");
32 break;
33 }
34
35 return $output;
36 }
37
38 function marvin_2k_page($content, $title = NULL, $breadcrumb = NULL) {
39 global $marvin_2k_tpath;
40
41 if (isset($title)) {
42 drupal_set_title($title);
43 }
44 if (isset($breadcrumb)) {
45 drupal_set_breadcrumb($breadcrumb);
46 }
47
48 $template = &new Template("themes/marvin_2k/templates/");
49
50 $sidebar_left = theme("blocks", "left");
51 if ($sidebar_left != "") {
52 $layout = "left";
53 }
54
55 $sidebar_right = theme("blocks", "right");
56 if ($sidebar_right != "") {
57 $layout = ($layout == "left") ? "both" : "right";
58 }
59
60 $custom_links = variable_get("marvin_2k_links", "");
61 if ($custom_links != "") {
62 $links = explode(";", $custom_links);
63 }
64 else {
65 $links = link_page();
66 }
67
68 if ($_GET["q"] == variable_get("site_frontpage", "node")) {
69 $mission = "";
70 switch (variable_get("marvin_2k_display_mission", "yes")) {
71 case "yes":
72 $mission = variable_get("site_mission", "");
73 break;
74 case "custom":
75 $mission = variable_get("marvin_2k_message", "");
76 break;
77 }
78 }
79
80 if ($title = drupal_get_title()) {
81 $breadcrumb = array_merge(drupal_get_breadcrumb(), array($title));
82 }
83 else {
84 $title = variable_get('site_name', 'Drupal');
85 }
86 $tabs = theme("menu_local_tasks");
87
88 $txt_message = theme_status_messages();
89
90 $template->set_vars( array(
91 "title" => $title,
92 "links" => $links,
93 "sidebar_left" => $sidebar_left,
94 "sidebar_right" => $sidebar_right,
95 "layout" => $layout,
96 "mission" => $mission,
97 "breadcrumb" => $breadcrumb ? theme("breadcrumb", $breadcrumb) : "",
98 "tabs" => $tabs,
99 "display_search" => (variable_get("marvin_2k_search_box", 1) && user_access("search content")),
100 "help" => menu_get_active_help(),
101 "message" => $txt_message
102 ));
103
104 $output = $template->fetch('header.tpl.php');
105 $output .= "\n<!-- begin content -->\n";
106 $output .= $content;
107 $output .= "\n<!-- end content -->\n";
108
109 $output .= " <div id=\"footer\">\n";
110
111 if ($footer_message = variable_get("site_footer", FALSE)) {
112 $output .= " <p>$footer_message</p>\n";
113 }
114
115 $output .= " </div><!-- footer -->\n";
116 $output .= " </div><!-- mainContent -->\n";
117 $output .= "</div><!-- pageFrame -->\n";
118 $output .= theme("closure");
119 $output .= "</body>\n</html>";
120 return $output;
121 }
122
123 function marvin_2k_block($block) {
124 $output = "<div class=\"block block-$block->module\">\n";
125 $output .= " <h2>$block->subject</h2>\n";
126 $output .= " <div class=\"content\">$block->content</div>\n";
127 $output .= "</div>\n\n";
128 return $output;
129 }
130
131 function marvin_2k_node($node, $main = 0, $page = 0) {
132 global $marvin_2k_tpath;
133 $template = &new Template("themes/marvin_2k/templates/");
134
135 if (module_exist("taxonomy") && ($taxonomy = taxonomy_link("taxonomy terms", $node))) {
136 $terms = "<span class=\"taxonomy\"> :: ". theme("links", $taxonomy) ."</span>\n";
137 }
138
139 $links = link_node($node, $main);
140
141 $template->set_vars( array(
142 "title" => $node->title,
143 "node_url" => url("node/view/$node->nid"),
144 "terms" => $terms,
145 "name" => format_name($node),
146 "date" => format_date($node->created),
147 "static" => $node->static,
148 "content" => ($main && $node->teaser) ? $node->teaser : $node->body,
149 "links" => ($links != "") ? theme("links", $links) : "",
150 "layout" => $layout,
151 "mission" => $mission,
152 "display_search" => ((variable_get("marvin_2k_search_box", 1) == 1) && (user_access("search content") == 1)),
153 "page" => $page,
154 ));
155
156 return $template->fetch('node.tpl.php');
157 }
158
159 function marvin_2k_box($subject, $content, $region = "main") {
160 $output = " <div class=\"box\">\n";
161 $output .= " <h2>$subject</h2>\n";
162 $output .= " <div class=\"content\">$content</div>\n";
163 $output .= " </div>\n";
164 return $output;
165 }
166
167 function marvin_2k_comment($comment, $link = "") {
168 $author = format_name($comment);
169 $date = format_date($comment->timestamp);
170
171 $output = "";
172
173 if ($comment->new) {
174 $output = "<a id=\"new\"></a>\n";
175 $t_class = " comment-new";
176 $t_span = " <span class=\"new\">new</span>\n";
177 }
178
179 $output .= " <a id=\"$comment->cid\"></a>\n";
180 $output .= " <div class=\"comment$t_class\">\n";
181 $output .= $t_span;
182 $output .= " <div class=\"title\">$comment->subject</div>\n";
183 $output .= " <div class=\"author\">Posted by $author on $date.</div>\n";
184 $output .= " <div class=\"content\">$comment->comment</div>\n";
185 $output .= " <div class=\"links\">$link</div>\n";
186 $output .= " </div>\n";
187
188 return $output;
189 }
190
191 function marvin_2k_comment_view($comment, $links = "", $visible = 1) {
192 $output = "";
193 if (node_is_new($comment->nid, $comment->timestamp)) {
194 $comment->new = 1;
195 }
196
197 if ($visible) {
198 $comment->comment = check_output($comment->comment);
199 $output .= theme("comment", $comment, $links);
200 }
201 else {
202 $output .= theme("comment_folded", $comment);
203 }
204 return $output;
205 }
206 function marvin_2k_comment_flat_collapsed($comment, $threshold) {
207 if (comment_visible($comment, $threshold)) {
208 if ($comment->selected) {
209 return theme("comment_view", $comment, comment_links($comment));
210 }
211 else {
212 return theme("comment_view", $comment, "", 0);
213 }
214 }
215 return "";
216 }
217
218 function marvin_2k_comment_thread_min($comment, $threshold, $pid = 0, $cid = 0) {
219 $output = "";
220 if (comment_visible($comment, $threshold)) {
221 $output = "<div style=\"margin-left: ". ($comment->depth * 10) ."px\">";
222 if ($comment->selected) {
223 $output .= theme("comment_view", $comment, comment_links($comment));
224 }
225 else {
226 $output .= theme("comment_view", $comment, "", 0);
227 }
228 $output .= "</div>\n";
229 }
230 return $output;
231 }
232
233 function marvin_2k_comment_folded($comment) {
234 if ($comment->new) {
235 $output = "<a id=\"new\"></a>\n";
236 $t_class = "comment-new ";
237 $t_span = " <span class=\"new\">new</span>\n";
238 }
239 $output .= " <a id=\"$comment->cid\"></a>\n";
240 return $output ."<div class=\"". $t_class ."comment-folded\">$t_span<span class=\"subject\">". l($comment->subject, comment_referer_load() ."/$comment->cid#$comment->cid") ."</span> <span class=\"credit\">". t("by") ." ". format_name($comment) ."</span></div>";
241 }
242
243 function marvin_2k_comment_thread_max($comment, $threshold, $level = 0) {
244 $output = "";
245 if ($comment->depth) {
246 $output .= "<div style=\"margin-left: ". ($comment->depth * 10) ."px\">";
247 }
248
249 $output .= theme("comment_view", $comment, theme('links', module_invoke_all('link', 'comment', $comment, 0)), comment_visible($comment, $threshold));
250
251 if ($comment->depth) {
252 $output .= "</div>\n";
253 }
254 return $output;
255 }
256
257 ?>

  ViewVC Help
Powered by ViewVC 1.1.2