marvin.theme 15.5 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
<?
 
 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) {
23
     global $sitename;
24
    ?>
Dries's avatar
   
Dries committed
25
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 
26
27
     <HTML>
     <HEAD>
28
      <TITLE><? print $sitename; ?></TITLE>
29
30
31
32
33
34
      <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
35
       TH { font-size: 10pt; font-family: Lucida,Verdana,Helvetica,Arial; }
36
37
38
39
40
41
42
43
44
45
46
47
      -->
     </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
48
        <TD VALIGN="top" WIDTH="470">
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    <?
   }

   ######
   # Syntax.......: abstract(...);
   # Description..: a function to draw an abstract story box, that is the
   #                boxes displayed on the main page.
   function abstract($story) {
     $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";
Dries's avatar
   
Dries committed
71
72
     if ($story->abstract) print "   <P>". nl2br($story->abstract) ."</P>\n";
     if ($story->updates) print "   <P><FONT COLOR=\"$this->bgcolor2\">Editor's note:</FONT> ". nl2br($story->updates) ."</P>\n";
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
     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) {
     $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";
Dries's avatar
   
Dries committed
101
102
103
     if ($story->abstract) print "   <P>". nl2br($story->abstract) ."</P>\n";
     if ($story->updates) print "   <P><FONT COLOR=\"$this->bgcolor2\">Editor's note:</FONT>". nl2br($story->updates) ."</P>\n";
     if ($story->article) print "   <P>". nl2br($story->article) ."</P>\n";
104
105
106
107
108
109
110
111
112
113
114
     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.
Dries's avatar
   
Dries committed
115
   function commentControl($sid, $title, $threshold, $mode, $order) {
116
117
118
119
120
     global $user;
  
     $query = db_query("SELECT sid FROM comments WHERE sid = $sid");

     if (!$query) $count = 0; else $count = db_num_rows($query);
Dries's avatar
   
Dries committed
121
     if (!isset($threshold)) $threshold = 0; 
122
123
124
125
126
127
128
129
130
131
     ?> 
     <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
132
           <FORM METHOD="post" ACTION="discussion.php">
133
            <SMALL> 
Dries's avatar
   
Dries committed
134
            <INPUT TYPE="hidden" NAME="id" VALUE="<? echo "$sid"; ?>"> 
Dries's avatar
   
Dries committed
135
136
137
138
139
140
141
142
            <SELECT NAME="threshold">
             <OPTION VALUE="-1" <? if ($threshold == -1) { echo "SELECTED"; } ?>>Threshold: -1
             <OPTION VALUE="0" <? if ($threshold == 0) { echo "SELECTED"; } ?>>Threshold: 0
             <OPTION VALUE="1" <? if ($threshold == 1) { echo "SELECTED"; } ?>>Threshold: 1
             <OPTION VALUE="2" <? if ($threshold == 2) { echo "SELECTED"; } ?>>Threshold: 2
             <OPTION VALUE="3" <? if ($threshold == 3) { echo "SELECTED"; } ?>>Threshold: 3
             <OPTION VALUE="4" <? if ($threshold == 4) { echo "SELECTED"; } ?>>Threshold: 4
             <OPTION VALUE="5" <? if ($threshold == 5) { echo "SELECTED"; } ?>>Threshold: 5
143
144
145
146
147
148
149
150
151
152
153
            </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
154
            <INPUT TYPE="submit" NAME="op" VALUE="Save">
155
156
157
158
159
            </SMALL>
           </FORM>
          </TD>
         </TR>
         <?
Dries's avatar
   
Dries committed
160
          $result = db_query("SELECT COUNT(cid) FROM comments WHERE sid = $sid AND score < $threshold");
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
          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.
180
   function comment($poster, $subject, $comment, $timestamp, $url, $email, $score, $votes, $cid, $link, $thread = "") {
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
     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";
200
     display_comment_moderation($cid, $poster, $score, $votes);
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
     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:
Dries's avatar
   
Dries committed
219
     if ($comment) print "    <TR><TD BGCOLOR=\"#FFFFFF\">". nl2br($comment) ."</TD></TR>\n";
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

     ### 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) {
     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\">";
Dries's avatar
   
Dries committed
251
252
253
     if ($abstract) print "<P>". nl2br($abstract) ."</P>";
     if ($comments) print "<P><FONT COLOR=\"$this->bgcolor2\">Editor's note:</FONT> ". nl2br($comments) ."</P>";
     if ($article) print "<P>". nl2br($article) ."</P>";
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
     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) { 
     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
286
       <TD VALIGN="top" WIDTH="180">
287
288
289
290
291
292
293
         <?
         global $PHP_SELF;  

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

           ### Display account:
294
           display_account($this);
295
296

           ### Display calendar:
297
           display_old_headlines($this);
298
299

           ### Display calendar:
300
           display_calendar($this, $date);
301
302

           ### Display new diary entries:
303
           display_new_diaries($this);           
304
305
306
         }
         elseif (strstr($PHP_SELF, "account.php")) {
           ### Display account:
307
           display_account($this);
308
309
310
         }
         elseif (strstr($PHP_SELF, "diary.php")) {
           ### Display account:
311
           display_account($this);
312
313
 
           ### Display new diary entries:
314
           display_new_diaries($this);
315
316
317
         }
         elseif (strstr($PHP_SELF, "submission.php")) {
           ### Display account:
318
           display_account($this);
319
320
321
         }
         elseif (strstr($PHP_SELF, "submit.php")) {
           ### Display new headlines:
322
           display_new_headlines($this);
323
324
325
326
327
328
329
         }
         elseif (strstr($PHP_SELF, "discussion.php")) {
           global $id;
           
           if ($id && $story = id2story($id)) {
             if ($story->status == 2) {
               ### Display new headlines:
330
               display_new_headlines($this);
331
332
333
             }
             else {
               ### Display results of moderation:
334
               display_moderation_results($this, $story);
335
336
337
338
             }
           }
           else {
             ### Display account:
339
             display_account($this);
340
341

             ### Display new headlines:
342
             display_new_headlines($this);
343
344
345
346
           }
         }
         else {
           ### Display new headlines:
347
           display_new_headlines($this);
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
         }
        ?>
       </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>
    <?
   }
 }

?>