From cee739e6278020dd4d79a5dcd86465c6c6a44a6c Mon Sep 17 00:00:00 2001 From: cweiske Date: Mon, 2 Nov 2009 09:38:02 +0000 Subject: [PATCH] add horizontal voting links and switch config setting git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@498 b3834d28-1941-0410-a4f8-b48e95affb8f --- data/config.default.php | 9 ++++ .../bookmarks-vote-horizontal.inc.tpl.php | 46 ++++++++++++++++++ data/templates/bookmarks-vote.inc.tpl.php | 2 +- www/ajaxVote.php | 11 ++++- www/images/vote-against-voted.png | Bin 0 -> 419 bytes www/images/vote-against.png | Bin 0 -> 495 bytes www/images/vote-for-voted.png | Bin 0 -> 415 bytes www/images/vote-for.png | Bin 0 -> 625 bytes www/scuttle.css | 28 +++++++++-- 9 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 data/templates/bookmarks-vote-horizontal.inc.tpl.php create mode 100644 www/images/vote-against-voted.png create mode 100644 www/images/vote-against.png create mode 100644 www/images/vote-for-voted.png create mode 100644 www/images/vote-for.png diff --git a/data/config.default.php b/data/config.default.php index 11aa997..4a17503 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -415,6 +415,15 @@ $enableCommonBookmarkDescription = true; */ $enableVoting = true; +/** + * Voting mode: + * 1 - voting badge + * 2 - voting links: hand up/down + * + * @var integer + */ +$votingMode = 2; + /**************************** * Website Thumbnails diff --git a/data/templates/bookmarks-vote-horizontal.inc.tpl.php b/data/templates/bookmarks-vote-horizontal.inc.tpl.php new file mode 100644 index 0000000..acdfbf7 --- /dev/null +++ b/data/templates/bookmarks-vote-horizontal.inc.tpl.php @@ -0,0 +1,46 @@ +'; +echo 'Voting ' . $row['bVoting'] . ' '; + +if (isset($row['hasVoted'])) { + if ($row['vote'] != 1) { + echo 'Vote for '; + } else { + echo 'Vote for '; + } + + + if ($row['vote'] != -1) { + echo 'Vote against'; + } else { + echo 'Vote against'; + } +} +echo ''; +?> \ No newline at end of file diff --git a/data/templates/bookmarks-vote.inc.tpl.php b/data/templates/bookmarks-vote.inc.tpl.php index e80c894..f65cf37 100644 --- a/data/templates/bookmarks-vote.inc.tpl.php +++ b/data/templates/bookmarks-vote.inc.tpl.php @@ -5,7 +5,7 @@ * against a bookmark. * Expects a $row variable with bookmark data */ -if (!$GLOBALS['enableVoting']) { +if (!$GLOBALS['enableVoting'] || $GLOBALS['votingMode'] != 1) { return; } if (isset($row['hasVoted']) && !$row['hasVoted']) { diff --git a/www/ajaxVote.php b/www/ajaxVote.php index 27eb62c..3e603da 100644 --- a/www/ajaxVote.php +++ b/www/ajaxVote.php @@ -9,12 +9,19 @@ $bs = SemanticScuttle_Service_Factory::get('Bookmark'); $ts = SemanticScuttle_Service_Factory::get('Template'); $bmrow = $bs->getBookmark($bookmark); +switch ($GLOBALS['votingMode']) { +case 2: + $template = 'bookmarks-vote-horizontal.inc.tpl.php'; + break; +default: + $template = 'bookmarks-vote.inc.tpl.php'; +} + header('Content-Type: text/xml; charset=utf-8'); echo '' . $bookmark . '' . ''; $ts->loadTemplate( - 'bookmarks-vote.inc.tpl.php', - array('row' => $bmrow) + $template, array('row' => $bmrow) ); echo ''; diff --git a/www/images/vote-against-voted.png b/www/images/vote-against-voted.png new file mode 100644 index 0000000000000000000000000000000000000000..740dfc82fdd3e7b344bb9df2108e9965f065b806 GIT binary patch literal 419 zcmeAS@N?(olHy`uVBq!ia0vp@KrFz)1|-ie{%Q%N7>k44ofy`glX(f`uqAoByDx`7I;J!Gca%qgD@k*tT_@uLG}_)Usv{<+>B!42D}xwP6JI*_H=O!(Kugw zX}_MUqX657`?lvqTb*#Yd7aL>8$EP5~3~_@4l2x*1Lb7H8-}_ZJhI2W}bnd``!&=euZ;_UUf5DK2MEF5M&NzN4><>c{?<%cz3*4B0eMaAueO)Vr7lurd`jWlo$m5j? z-;-o}6hlSB4!?ByvTWY13?8kRR%6MFuE)Km%H8|W(Jpm+$5FOv2EwIgUd($ERF{7F z^V?sw=v?{@eGl0+OQ)=BzkNeMYmIpDN7=~*xi0Uea}pJeejLm6dilivciW%C0WTlP zxG%nST`Oqzq3SE2x^AX99M@Vp#V+~O?j7>(5>xM~0eiv)BXY&f()Ln KelF{r5}E)y7O7MK literal 0 HcmV?d00001 diff --git a/www/images/vote-against.png b/www/images/vote-against.png new file mode 100644 index 0000000000000000000000000000000000000000..f15ea4d302e6fdc79a147a2c6f1a663870e8c076 GIT binary patch literal 495 zcmeAS@N?(olHy`uVBq!ia0vp@KrFz)1|-ie{%Q%N7>k44ofy`glX(f`uqAoBy8vk* z`02d69!PN(ctjR6FmMZlFeAgPITAoY_7YEDSN5CSjAFd17dnpo2AY!Z>EaloalUur zMsKDmTz_d8onEiMq6^=ey2K!(sBUzLDG_KOskH@9t@9V^Wh6tl=xhAS(xFi^n7 zBdc)d!U>!C_-sl7-apUYZ1HK&`7dqXYu_KPW~%E{nS8Rn#%{f@+T`~kTB_PzLir|A z{);bquqPaBXIYRV!KN-hEw#}1vK@oWFK6+oUa5(4|oo|j1qN_ zJ7C!`-EaBkZ*RZb(K_4FA#?oUOrK}M z2kIV(c}~h>Yi=~3>sM(u`!7?$hPMuD0yHdKT%HzH@;%51Ui@NpIm3e6Z}&03X#KTK jfg^m^y7Q9B*Bxu^ZGT9ot$vc=1&S(9S3j3^P6k44ofy`glX(f`uqAoByDx`7I;J!Gca%qgD@k*tT_@uLG}_)Usv{<+>B!4Qr8X(%K}Z2_jGX#(Kz3G z$yT2=P~h0d`|GYdxh$Hjq2e{a!6L(yYp>hFX&O_xS{Gc@aB+Xc9H8mlui^vv_ zJ+a}&vtCAT~JHg>F22zj_5$BFy=#jEXkXO16?4*YAoPx^PPL{Ivf zW0f*rT!XCd$=9FVcFa{}AIn00001b5ch_0Itp) z=>Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXe& z77GR>wGs~i00HqyL_t(2&yA8jsM=r@hEFtC8XVNYA`&5B)uo#isvs@spp8Eu2tuJa z3Kpk=n{I`wi$y3Xoy5{b3^+D|L%F&rE?QcL3c&*ycE#X_yu>%SyPk_^`$Z`W$I7gnp)==FMm zWm&3LtKq}pK)T(o2>@U;8sX(~N%i}E<@&&5x7+