marvin.theme 15.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?
 
 class Theme {
   ### color set #1:
   var $bgcolor1 = "#EAEAEA";   // background color
   var $fgcolor1 = "#404040";   // table body color
   var $hlcolor1 = "#666699";   // high-light color

   ### color set #2:
   var $bgcolor2 = "#666699";
   var $fgcolor2 = "#666699";
   var $hlcolor2 = "#666699";

   ### color set #3:
   var $bgcolor3 = "#EFEFEF";
   var $fgcolor3 = "yellow";
   var $hlcolor3 = "yellow";

   ######
   # Syntax.......: header($title);
   # Description..: a function to draw the page header.
   function header($title) {
    ?>
     <HTML>
     <HEAD>
      <TITLE><? include "config.inc"; print $sitename; ?></TITLE>
      <META NAME="description" CONTENT="drop.org">
      <META NAME="keywords" CONTENT="drop, weblog, portal, community, news, article, announcements, stories, story, computer, science, space, hype, cult, geek, nerd, foo, bar">
     </HEAD>
     <STYLE type="text/css"> 
      <!--
       BODY,TD,P,UL,LI,DIV,FORM,EM,BLOCKQUOTE { font-size: 10pt; font-family: Lucida,Verdana,Helvetica,Arial; }
Dries's avatar
   
Dries committed
33
       TH { font-size: 10pt; font-family: Lucida,Verdana,Helvetica,Arial; }
34
35
36
37
38
39
40
41
42
43
44
45
      -->
     </STYLE>
     <BODY TEXT="#000000" BGCOLOR="#FFFFFF" ALINK="#CCCCCC" LINK="#665555" VLINK="#665555">
      <TABLE BORDER="0" CELLPADDING="8" CELLSPACING="0">
       <TR>
        <TD ROWSPAN="3" WIDTH="30">&nbsp;</TD>
        <TD COLSPAN="2"><A HREF="" ><IMG SRC="themes/marvin/images/logo.gif" ALT="drop.org" BORDER="0"></A></TD>
       </TR>
       <TR>
        <TD ALIGN="right" COLSPAN="2"><SMALL><A HREF="">home</A> | <A HREF="faq.php">faq</A> | <A HREF="diary.php">diary</A> | <A HREF="search.php">search</A> | <A HREF="submit.php">submit news</A> | <A HREF="account.php">user account</A></SMALL></TD>
       </TR>
       <TR>
Dries's avatar
   
Dries committed
46
        <TD VALIGN="top" WIDTH="470">
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
    <?
   }

   ######
   # Syntax.......: abstract(...);
   # Description..: a function to draw an abstract story box, that is the
   #                boxes displayed on the main page.
   function abstract($story) {
     include "config.inc";

     $story->timestamp = date("l, F d, Y - h:i:s A", $story->timestamp);

     print "\n<!-- story: \"$story->subject\" -->\n";     
     print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">\n";
     print " <TR><TD COLSPAN=\"2\"><IMG SRC=\"themes/marvin/images/drop.gif\" ALT=\"\"> &nbsp; <B>$story->subject</B></TD></TR>\n";
     print " <TR VALIGN=\"bottom\"><TD COLSPAN=\"2\" BGCOLOR=\"#000000\" WIDTH=\"100%\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"1\" HEIGHT=\"0\" ALT=\"\"></TD></TR>\n";
     print " <TR>\n";
     print "  <TD>\n";
     print "   <FONT COLOR=\"#7C7C7C\"><SMALL>Posted by ". format_username($story->userid) ." on $story->timestamp"; ?><? if ($story->department) print "<BR>from the $story->department dept."; ?><? print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL><A HREF=\"search.php?category=". urlencode($story->category) ."\"><FONT COLOR=\"#83997A\">$story->category</FONT></A></SMALL>\n";
     print "  </TD>\n";
     print " </TR>\n";
     print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
     print " <TR>\n";
     print "  <TD COLSPAN=\"2\">\n";
     if ($story->abstract) print "   <P>$story->abstract</P>\n";
     if ($story->updates) print "   <P><FONT COLOR=\"$this->bgcolor2\">Editor's note:</FONT> $story->updates</P>\n";
     print "  </TD>\n";
     print " </TR>\n";
     print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
     print " <TR><TD COLSPAN=\"2\">". display_morelink($this, $story) ."</TD></TR>\n";
     print "</TABLE>\n";
     print "<BR><BR>\n\n";
   }

   ######
   # Syntax.......: article(...);
   # Description..: a function to dispay a complete article (without user 
   #                comments).  It's what you get when you followed for
   #                instance one of read-more links on the main page.
   function article($story, $reply) {
     include "config.inc";

     $story->timestamp = date("l, F d, Y - h:i:s A", $story->timestamp);

     print "\n<!-- story: \"$story->subject\" -->\n";     
     print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">\n";
     print " <TR><TD COLSPAN=\"2\"><IMG SRC=\"themes/marvin/images/drop.gif\" ALT=\"\"> &nbsp; <B>$story->subject</B></TD></TR>\n";
     print " <TR VALIGN=\"bottom\"><TD COLSPAN=\"2\" BGCOLOR=\"#000000\" WIDTH=\"100%\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"1\" HEIGHT=\"0\" ALT=\"\"></TD></TR>\n";
     print " <TR>\n";
     print "  <TD>\n";
     print "   <FONT COLOR=\"#7C7C7C\"><SMALL>Posted by ". format_username($story->userid) ." on $story->timestamp"; ?><? if ($story->department) print "<BR>from the $story->department dept."; ?><? print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL><A HREF=\"search.php?category=". urlencode($story->category) ."\"><FONT COLOR=\"#83997A\">$story->category</FONT></A></SMALL>\n"; 
     print "  </TD>\n";
     print " </TR>\n";
     print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
     print " <TR>\n";
     print "  <TD COLSPAN=\"2\">\n";
     if ($story->abstract) print "   <P>$story->abstract</P>\n";
     if ($story->updates) print "   <P><FONT COLOR=\"$this->bgcolor2\">Editor's note:</FONT> $story->updates</P>\n";
     if ($story->article) print "   <P>$story->article</P>\n";
     print "  </TD>\n";
     print " </TR>\n";
     print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
     print " <TR><TD ALIGN=\"right\" COLSPAN=\"2\">". $reply ."</TD></TR>\n";
     print "</TABLE>\n";
     print "<BR><BR>\n\n";
   }

   ######
   # Syntax.......: commentControl(...);
   # Description..: this function is used to theme the comment control box.
   function commentControl($sid, $title, $thold, $mode, $order) {
     global $user;
  
     $query = db_query("SELECT sid FROM comments WHERE sid = $sid");

     if (!$query) $count = 0; else $count = db_num_rows($query);
     if (!isset($thold)) $thold = 0; 
     ?> 
     <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" BGCOLOR="#000000" WIDTH="100%">
      <TR>
       <TD>
        <TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2">
         <TR>
          <TD ALIGN="center" BGCOLOR="<? echo "$this->bgcolor2"; ?>"><FONT COLOR="<? echo "$this->bgcolor1" ?>"><B>Comment control</B></FONT></TD>
         </TR>
         <TR>
          <TD ALIGN="center" BGCOLOR="<? echo "$this->bgcolor1"; ?>">
Dries's avatar
   
Dries committed
134
           <FORM METHOD="post" ACTION="discussion.php">
135
            <SMALL> 
Dries's avatar
   
Dries committed
136
            <INPUT TYPE="hidden" NAME="id" VALUE="<? echo "$sid"; ?>"> 
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
            <SELECT NAME="thold">
             <OPTION VALUE="-1" <? if ($thold == -1) { echo "SELECTED"; } ?>>Threshold: -1
             <OPTION VALUE="0" <? if ($thold == 0) { echo "SELECTED"; } ?>>Threshold: 0
             <OPTION VALUE="1" <? if ($thold == 1) { echo "SELECTED"; } ?>>Threshold: 1
             <OPTION VALUE="2" <? if ($thold == 2) { echo "SELECTED"; } ?>>Threshold: 2
             <OPTION VALUE="3" <? if ($thold == 3) { echo "SELECTED"; } ?>>Threshold: 3
             <OPTION VALUE="4" <? if ($thold == 4) { echo "SELECTED"; } ?>>Threshold: 4
             <OPTION VALUE="5" <? if ($thold == 5) { echo "SELECTED"; } ?>>Threshold: 5
            </SELECT> 
            <SELECT NAME="mode">
             <OPTION VALUE="nested" <? if ($mode == "nested") { echo "SELECTED"; } ?>>Nested
             <OPTION VALUE="flat" <? if ($mode == "flat") { echo "SELECTED"; } ?>>Flat
             <OPTION VALUE="threaded" <? if (!isset($mode) || $mode=='threaded' || $mode=="") { echo "SELECTED"; } ?>>Threaded
            </SELECT> 
            <SELECT NAME="order">
             <OPTION VALUE="0" <? if (!$order) { echo "SELECTED"; } ?>>Oldest first
             <OPTION VALUE="1" <? if ($order==1) { echo "SELECTED"; } ?>>Newest first
             <OPTION VALUE="2" <? if ($order==2) { echo "SELECTED"; } ?>>Highest scoring first
            </SELECT> 
Dries's avatar
   
Dries committed
156
            <INPUT TYPE="submit" NAME="op" VALUE="Save">
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
            </SMALL>
           </FORM>
          </TD>
         </TR>
         <?
          $result = db_query("SELECT COUNT(cid) FROM comments WHERE sid = $sid AND score < $thold");
          if ($result && $number = db_result($result, 0)) {
         ?>
         <TR>
          <TD ALIGN="center" BGCOLOR="<? echo "$this->bgcolor2"; ?>"><SMALL><FONT COLOR="<? echo "$this->fgcolor2"; ?>">There are at least <? echo $number; ?> comments below your threshold.</FONT></SMALL></TD>
         </TR>
         <?
          }
         ?> 
        </TABLE>
       </TD>
      </TR>
     </TABLE>
     <BR><BR>
    <?
   }

   ######
   # Syntax.......: comment(...);
   # Description..: this function is used to theme user comments.
   function comment($poster, $subject, $comment, $timestamp, $url, $email, $score, $cid, $link, $thread = "") {
     include "config.inc";

     print "\n<!-- Comment: \"$subject\" by $poster -->\n";
     print "<A NAME=\"$cid\">\n";

     ### Create comment header:
     print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" BGCOLOR=\"#000000\" WIDTH=\"100%\">\n";
     print " <TR BGCOLOR=\"#000000\">\n";
     print "  <TD>\n";
     print "   <TABLE BORDER=\"0\" CELLPADDING=\"3\" CELLSPACING=\"1\" WIDTH=\"100%\">\n";
     print "    <TR>\n";
     print "     <TD BGCOLOR=\"$this->bgcolor1\">\n";
     print "      <TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"1\" WIDTH=\"100%\">\n";
     print "       <TR>\n";

     ### Subject:
     print "        <TD ALIGN=\"right\" WIDTH=\"5%\"><B>Subject:</FONT></TD>\n";
     print "        <TD WIDTH=\"80%\"><B><FONT COLOR=\"$this->hlcolor1\">$subject</FONT></B></TD>\n";

     ### Moderation:
     print "        <TD ALIGN=\"right\" ROWSPAN=\"3\" VALIGN=\"middle\" WIDTH=\"15%\">\n";
     displayCommentModeration($cid);
     print "        </TD>\n";
     print "       </TR>\n";

     ### Author:
     print "       <TR>\n";
     print "        <TD ALIGN=\"right\" VALIGN=\"top\">Author:</TD><TD>". format_username($poster) ."</TD>\n";
     print "       </TR>\n";

     ### Date
     print "       <TR>\n";
     print "        <TD ALIGN=\"right\">Date:</TD><TD>". format_date($timestamp) ."</TD>\n";
     print "       </TR>\n";

     print "      </TABLE>\n";
     print "     </TD>\n";
     print "    </TR>\n";

     ### Print body of comment:
     if ($comment) print "    <TR><TD BGCOLOR=\"#FFFFFF\">$comment</TD></TR>\n";

     ### Print thread (if any):
     if ($thread) print "    <TR><TD BGCOLOR=\"$this->bgcolor1\">$thread</TD></TR>\n";

     ### Print bottom link(s):
     print "    <TR><TD ALIGN=\"right\" BGCOLOR=\"$this->bgcolor1\">[ $link ]</TD></TR>\n";
     print "   </TABLE>\n";
     print "  </TD>\n";
     print " </TR>\n";
     print "</TABLE>\n";
     print "<BR>\n\n";
   }

   ######
   # Syntax.......: preview(...);
   # Description..: this function is used to preview a story and is used at
   #                different parts of the homepage: when a visitors sumbits
   #                news, when an editor wants to post news, when people
   #                check the entries in the sumbission queue, etc.
   function preview($author, $subject, $abstract, $updates, $article, $timestamp, $category, $department) {
     include "config.inc";

     print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">";
     print " <TR><TD COLSPAN=\"2\"><B>$subject</B></TD></TR>";
     print " <TR VALIGN=\"bottom\"><TD COLSPAN=\"2\" BGCOLOR=\"#000000\" WIDTH=\"100%\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"1\" HEIGHT=\"0\" ALT=\"\"></TD></TR>";
     print " <TR>";
     print "  <TD>";
     print "   <FONT COLOR=\"#7C7C7C\"><SMALL>Posted by ". format_username($author) ." on $timestamp"; ?><? if ($department) print "<BR>from the $department dept."; ?><? print "</SMALL></FONT></TD><TD ALIGN=\"right\" VALIGN=\"top\" NOWRAP><SMALL><A HREF=\"search.php?category=". urlencode($category) ."\"><FONT COLOR=\"#83997A\">$category</FONT></A></SMALL>\n";
     print "  </TD>";
     print " </TR>";
     print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>";
     print " <TR>";
     print "  <TD COLSPAN=\"2\">";
     if ($abstract) print "<P>$abstract</P>";
     if ($comments) print "<P><FONT COLOR=\"$this->bgcolor2\">Editor's note:</FONT> $comments</P>";
     if ($article) print "<P>$article</P>";
     print "  </TD>";
     print " </TR>";
     print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>";
     print " <TR><TD COLSPAN=\"2\">$link</TD></TR>";
     print "</TABLE>";
     print "<BR><BR>";
   }
 
   ######
   # Syntax.......: box($subject, $body);
   # Description..: a function to draw a box/block.
   function box($subject, $content) { 
     include "config.inc";
     print "\n<!-- box: \"$subject\" -->\n";
     print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" BGCOLOR=\"#000000\" WIDTH=\"100%\">\n";
     print " <TR>\n";
     print "  <TD>\n";
     print "   <TABLE BORDER=\"0\" CELLPADDING=\"5\" CELLSPACING=\"1\" WIDTH=\"100%\">\n";
     print "    <TR><TD ALIGN=\"center\" BGCOLOR=\"$this->bgcolor1\" WIDTH=\"100%\"><FONT COLOR=\"$this->fgcolor1\"><B>$subject</B></FONT></TD></TR>\n";
     print "    <TR><TD BGCOLOR=\"#FFFFFF\">$content</TD></TR>\n";
     print "   </TABLE>\n";
     print "  </TD>\n";
     print " </TR>\n";
     print "</TABLE>\n";
     print "<BR>\n\n";
   }

   ######
   # Syntax.......: footer();
   # Description..: a function to draw the page footer.
   function footer() {
     ?>
       </TD>
Dries's avatar
   
Dries committed
293
       <TD VALIGN="top" WIDTH="180">
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
         <?
         global $PHP_SELF;  

         if (strstr($PHP_SELF, "index.php")) {
           global $user, $date;

           ### Display account:
           displayAccount($this);

           ### Display calendar:
           displayOldHeadlines($this);

           ### Display calendar:
           displayCalendar($this, $date);

           ### Display new diary entries:
           displayNewDiaries($this);           
         }
         elseif (strstr($PHP_SELF, "account.php")) {
           ### Display account:
           displayAccount($this);
         }
         elseif (strstr($PHP_SELF, "diary.php")) {
           ### Display account:
           displayAccount($this);
 
           ### Display new diary entries:
           displayNewDiaries($this);
         }
         elseif (strstr($PHP_SELF, "submission.php")) {
           ### Display account:
           displayAccount($this);
         }
         elseif (strstr($PHP_SELF, "submit.php")) {
           ### Display new headlines:
           displayNewHeadlines($this);
         }
         elseif (strstr($PHP_SELF, "discussion.php")) {
           global $id;
           
           if ($id && $story = id2story($id)) {
             if ($story->status == 2) {
               ### Display new headlines:
               displayNewHeadlines($this);
             }
             else {
               ### Display results of moderation:
               displayModerationResults($this, $story);
             }
           }
           else {
             ### Display account:
             displayAccount($this);

             ### Display new headlines:
             displayNewHeadlines($this);
           }
         }
         else {
           ### Display new headlines:
           displayNewHeadlines($this);
         }
        ?>
       </TD>
      </TR>
      <TR>
       <TD ALIGN="center" COLSPAN="3">
        <SMALL>[ <A HREF="">home</A> | <A HREF="faq.php">faq</A> | <A HREF="diary.php">diary</A> | <A HREF="search.php">search</A> | <A HREF="submit.php">submit news</A> | <A HREF="account.php">user account</A> ]</SMALL>
       </TD>
      </TR>
     </TABLE>
    </BODY> 
    </HTML>
    <?
   }
 }

?>