Skip to content

Commit fc6abb0

Browse files
committed
updates and happenings are now completely updated
1 parent 08d073b commit fc6abb0

7 files changed

Lines changed: 843 additions & 193 deletions

File tree

content/happenings.xml

Lines changed: 364 additions & 92 deletions
Large diffs are not rendered by default.

content/updates.xml

Lines changed: 420 additions & 44 deletions
Large diffs are not rendered by default.

generate/happenings.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ function get_happenings($num = 5)
3131
return $html;
3232
}
3333

34-
if (!defined('COVER')) {
35-
$benchmark_start = microtime_float();
34+
if (!defined('COVER')) {
35+
$benchmark_start = microtime_float();
3636

37-
$page = new Page('Happenings', 'Happenings');
38-
$page->subtemplate('template.happenings.html');
39-
$page->content(get_happenings('all'));
40-
writeFile("happenings.html", $page->out());
41-
37+
$page = new Page('Happenings', 'Happenings');
38+
$page->subtemplate('template.happenings.html');
39+
$page->content(get_happenings('all'));
40+
writeFile("happenings.html", $page->out());
41+
4242
$benchmark_end = microtime_float();
43-
$execution_time = round($benchmark_end - $benchmark_start, 4);
44-
45-
if (!defined('SUBMIT')) {
46-
echo <<<EOC
43+
$execution_time = round($benchmark_end - $benchmark_start, 4);
44+
45+
if (!defined('SUBMIT')) {
46+
echo <<<EOC
4747
<h2>Happenings.html Generation Successful</h2>
48-
<p>Generator took $execution_time seconds to execute</p>
49-
EOC;
48+
<p>Generator took $execution_time seconds to execute</p>
49+
EOC;
5050
}
5151
}
5252

generate/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function showloading()
8080
<li>Generate <a href="#" onclick="remote_link('exhibition.php'); return false;">Exhibition and archives</a></li>
8181
<li>Generate <a href="#" onclick="remote_link('courses.php'); return false;">Courses.html</a>
8282
<a href="#" onclick="remote_link('happenings.php'); return false;">Happenings.html</a>
83-
<a href="#" onclick="remote_link('updated.php'); return false;">Updates.html</a>
83+
<a href="#" onclick="remote_link('updates.php'); return false;">Updates.html</a>
8484
</li>
8585
<li>Environment pages in
8686
<form class="inline" action="#" method="post" onsubmit="new Ajax.Updater('status', 'environment.php',

generate/lib/Happening.class.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
<?
22

33
class Happening
4+
{
5+
var $date;
6+
var $description;
7+
8+
function Happening(&$xml)
9+
{
10+
$this->date = getValue($xml, 'date');
11+
$this->description = innerHTML($xml, 'description');
12+
}
13+
14+
function display()
15+
{
16+
$html = "<dt>{$this->date}</dt>\n";
17+
$html .= "\t<dd>{$this->description}</dd>\n";
18+
return $html;
19+
}
20+
}
21+
22+
/*class Happening
423
{
524
var $startdate;
625
var $enddate;
@@ -40,6 +59,6 @@ function display()
4059
$html .= "\t<dd>{$this->description}</dd>\n";
4160
return $html;
4261
}
43-
}
62+
}*/
4463

4564
?>

generate/updates.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ function get_updates($num = 5)
3030
return $html;
3131
}
3232

33-
if (!defined('COVER')) {
34-
$benchmark_start = microtime_float();
35-
36-
$page = new Page('Updates', 'Updates');
37-
$page->subtemplate('template.updates.html');
38-
$page->content(get_updates('all'));
39-
writeFile("updates.html", $page->out());
40-
33+
if (!defined('COVER')) {
34+
$benchmark_start = microtime_float();
35+
36+
$page = new Page('Updates', 'Updates');
37+
$page->subtemplate('template.updates.html');
38+
$page->content(get_updates('all'));
39+
writeFile("updates.html", $page->out());
40+
4141
$benchmark_end = microtime_float();
42-
$execution_time = round($benchmark_end - $benchmark_start, 4);
43-
44-
echo <<<EOC
42+
$execution_time = round($benchmark_end - $benchmark_start, 4);
43+
44+
echo <<<EOC
4545
<h2>Updates.html Generation Successful</h2>
46-
<p>Generator took $execution_time seconds to execute</p>
46+
<p>Generator took $execution_time seconds to execute</p>
4747
EOC;
4848
}
4949
?>

submit/happenings.php

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
$page = new Page('Add Happening', 'Happening');
99
$title = "<h2><img src=\"/img/processinghappenings.gif\" alt=\"Processing Happenings\" /></h2>";
1010

11-
$sdate = isset($_POST['sdate']) ? strtotime(trim($_POST['sdate'])) : false;
12-
$edate = isset($_POST['edate']) && $_POST['edate'] != '' ? strtotime(trim($_POST['edate'])) : false;
11+
$date = isset($_POST['date']) ? trim($_POST['date']) : false;
1312
$body = isset($_POST['body']) ? strip_tags($_POST['body'], '<a><b><strong><i><em>') : false;
1413

1514
if (!$_POST['preview'] &&
16-
$sdata !== false && $body !== false &&
17-
$sdata !== -1 && $edata !== -1) { // valid input
15+
$date !== false && $body !== false ) { // valid input
1816

1917
// let's first check back if he / she just added something and
2018
// politely ask to come back a little later ...
@@ -52,8 +50,7 @@
5250
// add data
5351
$newxml = <<<XML
5452
<item>
55-
<startdate></startdate>
56-
<enddate></enddate>
53+
<date></date>
5754
<description></description>
5855
</item>
5956
XML;
@@ -62,11 +59,9 @@
6259
$xml2 = $doc2->documentElement;
6360

6461
$one =& $xml2->childNodes[0];
65-
$one->setText(date($date_format, $sdate));
66-
$two =& $xml2->childNodes[1];
67-
$two->setText( $edate ? date($date_format, $edate) : '' );
68-
$three =& $xml2->childNodes[2];
69-
$three->setText($body);
62+
$one->setText($date);
63+
$two =& $xml2->childNodes[1];
64+
$two->setText($body);
7065

7166
$xml->appendChild($xml2);
7267

@@ -89,13 +84,8 @@
8984

9085
$msg = array();
9186
if (count($_POST) !== 0) {
92-
if (!$sdate) {
93-
$msg['sdate'] = 'Please enter a starting date';
94-
} else if ($sdate == -1) {
95-
$msg['sdate'] = 'Please enter a valid date';
96-
}
97-
if ($edate == -1) {
98-
$msg['edate'] = 'Please enter a valid date';
87+
if (!$date) {
88+
$msg['date'] = 'Please enter a date';
9989
}
10090
if (!$body) {
10191
$msg['body'] = 'Please fill in this field';
@@ -105,12 +95,9 @@
10595
$msg = array_map(create_function('$str', 'return "<p class=\"error\">$str</p>";'), $msg);
10696

10797
if ($_POST['preview']) { // preview
108-
$sdate = date($date_format, $sdate);
109-
$edate = $edate ? date($date_format, $edate) : '';
110-
$datestring = $sdate . ($edate ? " &ndash; $edate" : '');
11198
$preview = <<<PREV
11299
<dl>
113-
<dt>{$datestring}</dt>
100+
<dt>{$date}</dt>
114101
<dd>{$body}</dd>
115102
</dl>
116103
PREV;
@@ -120,13 +107,9 @@
120107
$happening_form = <<<H_FORM
121108
<form accept-charset="utf-8" action="{$_SERVER['PHP_SELF']}" method="post" name="mform">
122109
123-
<label>Start Date: <em>format: 01 January 05</em></label><br />
124-
<input name="sdate" type="text" size="12" value="{$sdate}" /><br />
125-
{$msg['sdate']}<br />
126-
127-
<label>End Date: <em>(Optional)</em></label><br />
128-
<input name="edate" type="text" size="12" value="{$edate}" /><br />
129-
{$msg['edate']}<br />
110+
<label>Date: <em>format: 01 January 05</em></label><br />
111+
<input name="date" type="text" size="12" value="{$date}" /><br />
112+
{$msg['date']}<br />
130113
131114
<label>What&rsquo;s Happening?: <em>Allowed html: &lt;a&gt;, &lt;strong&gt;, &lt;em&gt;</em></label><br />
132115
<textarea name="body" cols="40" rows="3">{$body}</textarea><br />
@@ -137,7 +120,7 @@
137120
<br />
138121
<br />
139122
140-
<input type="image" src="https://github.com/img/submit.gif" value="Submit" alt="Submit" /><input type="image" src="https://github.com/img/preview.gif" name="preview" value="Preview" alt="Preview" />
123+
<input type="image" src="https://github.com/img/submit.gif" value="Submit" alt="Submit" /> <input type="image" src="https://github.com/img/preview.gif" name="preview" value="Preview" alt="Preview" />
141124
142125
</form>
143126

0 commit comments

Comments
 (0)