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
<?
 
 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
25
26
    ?>
     <HTML>
     <HEAD>
27
      <TITLE><? print $sitename; ?></TITLE>
28
29
30
31
32
33
      <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
34
       TH { font-size: 10pt; font-family: Lucida,Verdana,Helvetica,Arial; }
35
36
37
38
39
40
41
42
43
44
45
46
      -->
     </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
47
        <TD VALIGN="top" WIDTH="470">
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
    <?
   }

   ######
   # 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";
     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) {
     $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.
Dries's avatar
   
Dries committed
114
   function commentControl($sid, $title, $threshold, $mode, $order) {
115
116
117
118
119
     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
120
     if (!isset($threshold)) $threshold = 0; 
121
122
123
124
125
126
127
128
129
130
     ?> 
     <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
131
           <FORM METHOD="post" ACTION="discussion.php">
132
            <SMALL> 
Dries's avatar
   
Dries committed
133
            <INPUT TYPE="hidden" NAME="id" VALUE="<? echo "$sid"; ?>"> 
Dries's avatar
   
Dries committed
134
135
136
137
138
139
140
141
            <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
142
143
144
145
146
147
148
149
150
151
152
            </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
153
            <INPUT TYPE="submit" NAME="op" VALUE="Save">
154
155
156
157
158
            </SMALL>
           </FORM>
          </TD>
         </TR>
         <?
Dries's avatar
   
Dries committed
159
          $result = db_query("SELECT COUNT(cid) FROM comments WHERE sid = $sid AND score < $threshold");
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
          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.
179
   function comment($poster, $subject, $comment, $timestamp, $url, $email, $score, $votes, $cid, $link, $thread = "") {
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
     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";
199
     display_comment_moderation($cid, $poster, $score, $votes);
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
     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) {
     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) { 
     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
285
       <TD VALIGN="top" WIDTH="180">
286
287
288
289
290
291
292
         <?
         global $PHP_SELF;  

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

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

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

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

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

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

?>