From chuck at horde.org Mon Dec 2 21:21:25 2002 From: chuck at horde.org (Chuck Hagenbuch) Date: Mon, 2 Dec 2002 16:21:25 -0500 Subject: [klutz]Patch for a summary page of klutz In-Reply-To: <1038717305.3de991799f074@discovery.wild-e.com> References: <1038717305.3de991799f074@discovery.wild-e.com> Message-ID: <1038864085.3debced5642a7@marina.horde.org> Quoting Jon Knepher : > Attached is a patch to add a summary view of klutz. It will randomly > show one of today's comics, or display them all. This is a patch to todays > CVS HEAD. Committed, thanks! -chuck -- Charles Hagenbuch, "People ask me all the time what it will be like living without otters." - Google, thanks to Harpers From jbk at wild-e.com Wed Dec 4 07:43:53 2002 From: jbk at wild-e.com (Jon Knepher) Date: Tue, 3 Dec 2002 23:43:53 -0800 Subject: [klutz]Patch to my Patch for a klutz summary. Message-ID: <1038987833.3dedb239b9815@discovery.wild-e.com> 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 .= ''; - $summary .= ''; - $date = time(); + $summary .= ''; // 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 .= ''; + $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 .= ''; } } } 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 .= ''; - $summary .= ''; + $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 .= ''; + $summary .= ''; } } From chuck at horde.org Wed Dec 4 18:31:07 2002 From: chuck at horde.org (Chuck Hagenbuch) Date: Wed, 4 Dec 2002 13:31:07 -0500 Subject: [klutz]Patch to my Patch for a klutz summary. In-Reply-To: <1038987833.3dedb239b9815@discovery.wild-e.com> References: <1038987833.3dedb239b9815@discovery.wild-e.com> Message-ID: <1039026667.3dee49eb77b77@marina.horde.org> Quoting Jon Knepher : > 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... Committed, thanks! Not noise at all. -chuck -- Charles Hagenbuch, "People ask me all the time what it will be like living without otters." - Google, thanks to Harpers
Comics
'; + $summary .= Horde::link(Horde::url('comics.php', 1), 'Comics', 'header'); + $summary .= 'Comics - '; + $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
' . $name . '
' . $link . $img . '
' . $name . ' by ' . $author . '
' . $name . '
' . $link . $name . ' by ' . $author . '
' . $link . $img . '