[klutz]Patch to my Patch for a klutz summary.
Jon Knepher
jbk at wild-e.com
Wed Dec 4 07:43:53 2002
Sorry for the noise... I fixed up my summary to make it match the other
summaries, and to follow the coding standards better. Oh, and I had a stupid
off by one error on the rand line...
Thanks!
Jon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 967 bytes
Desc: PGP Public Key
Url : http://lists.horde.org/archives/klutz/attachments/20021203/0b5dab52/attachment.bin
-------------- next part --------------
Index: lib/api.php
===================================================================
RCS file: /repository/klutz/lib/api.php,v
retrieving revision 1.6
diff -u -r1.6 api.php
--- lib/api.php 2 Dec 2002 21:21:40 -0000 1.6
+++ lib/api.php 4 Dec 2002 07:31:31 -0000
@@ -25,6 +25,14 @@
'args' => array(),
'type' => 'string');
+/**
+ * Return a string summary
+ *
+ * Either return a random strip from the user's selected strips,
+ * or all of them if the user has selected that as a preference.
+ *
+ * @return string An HTML Table containing the comics
+ */
function _klutz_summary()
{
@define('KLUTZ_BASE', dirname(__FILE__) . '/..');
@@ -33,10 +41,19 @@
global $prefs;
$showall = $prefs->getValue('summ_showall');
+ $date = time();
+
$summary = '';
$summary .= '<table border="0" cellpadding="0" cellspacing="0" width="100%">';
- $summary .= '<tr><td class="header">Comics</td></tr>';
- $date = time();
+ $summary .= '<tr><td class="header">';
+ $summary .= Horde::link(Horde::url('comics.php', 1), 'Comics', 'header');
+ $summary .= 'Comics</a> - ';
+ $linkurl = Horde::url('comics.php', 1);
+ $linkurl = Horde::addParameter($linkurl, 'actionID=' . KLUTZ_DISPLAY_DAY);
+ $linkurl = Horde::addParameter($linkurl, "date=$date");
+ $summary .= Horde::link($linkurl, "Today's Comics");
+ $summary .= Horde::img('klutz.gif');
+ $summary .= ' Today</a></td></tr>';
// Get the list of comics to display.
$comics = explode("\t", $prefs->getValue('viewcomics'));
@@ -56,21 +73,33 @@
$url = Horde::addParameter($url, 'actionID=' . KLUTZ_DISPLAY_IMAGE);
$url = Horde::addParameter($url, "date=$date");
$url = Horde::addParameter($url, "index=$index");
- $summary .= '<tr><td><img alt="' . $name . '" src="' . $url . '" ' . $size . ' /></td></tr>';
+ $img = Horde::img($url, $name . ' by ' . $author, $size, '');
+ $linkurl = Horde::url('comics.php', 1);
+ $linkurl = Horde::addParameter($linkurl, 'actionID=' . KLUTZ_DISPLAY_COMIC);
+ $linkurl = Horde::addParameter($linkurl, "date=$date");
+ $linkurl = Horde::addParameter($linkurl, "index=$index");
+ $link = Horde::link($linkurl, $name . ' by ' . $author);
+ $summary .= '<tr><td>' . $link . $img . '</a></td></tr>';
}
}
} else {
- $index=$comicstoday[rand(0,count($comicstoday))];
- $name = $klutz->getProperty($index, 'name');
- $author = $klutz->getProperty($index, 'author');
- if ($storage->imageExists($index, $date)) {
- $size = $storage->imageSize($index, $date);
- $url = Horde::url('comics.php', 1);
- $url = Horde::addParameter($url, 'actionID=' . KLUTZ_DISPLAY_IMAGE);
- $url = Horde::addParameter($url, "date=$date");
- $url = Horde::addParameter($url, "index=$index");
- $summary .= '<tr><td class="text">' . $name . ' by ' . $author . '</td></tr>';
- $summary .= '<tr><td><img alt="' . $name . '" src="' . $url . '" ' . $size . ' /></td></tr>';
+ $index = $comicstoday[rand(0, count($comicstoday)-1)];
+ $name = $klutz->getProperty($index, 'name');
+ $author = $klutz->getProperty($index, 'author');
+ if ($storage->imageExists($index, $date)) {
+ $size = $storage->imageSize($index, $date);
+ $url = Horde::url('comics.php', 1);
+ $url = Horde::addParameter($url, 'actionID=' . KLUTZ_DISPLAY_IMAGE);
+ $url = Horde::addParameter($url, "date=$date");
+ $url = Horde::addParameter($url, "index=$index");
+ $img = Horde::img($url, $name . ' by ' . $author, $size, '');
+ $linkurl = Horde::url('comics.php', 1);
+ $linkurl = Horde::addParameter($linkurl, 'actionID=' . KLUTZ_DISPLAY_COMIC);
+ $linkurl = Horde::addParameter($linkurl, "date=$date");
+ $linkurl = Horde::addParameter($linkurl, "index=$index");
+ $link = Horde::link($linkurl, $name . ' by ' . $author);
+ $summary .= '<tr><td class="text">' . $link . $name . ' by ' . $author . '</a></td></tr>';
+ $summary .= '<tr><td>' . $link . $img . '</a></td></tr>';
}
}
More information about the klutz
mailing list