From: <ru...@us...> - 2009-06-04 14:53:26
|
Revision: 6891 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6891&view=rev Author: rurban Date: 2009-06-04 13:34:57 +0000 (Thu, 04 Jun 2009) Log Message: ----------- find the wikilens.js in one place only Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2009-06-04 13:33:47 UTC (rev 6890) +++ trunk/lib/plugin/RateIt.php 2009-06-04 13:34:57 UTC (rev 6891) @@ -109,8 +109,9 @@ $js_globals = "var rateit_imgsrc = '".$img."'; var rateit_action = '".urlencode("RateIt")."'; "; - $WikiTheme->addMoreHeaders(JavaScript('', array - ('src' => $WikiTheme->_findData('wikilens.js')))); + $WikiTheme->addMoreHeaders + (JavaScript('', + array('src' => $WikiTheme->_findData('themes/wikilens/wikilens.js')))); return JavaScript($js_globals); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-04-06 14:58:48
|
Revision: 7319 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7319&view=rev Author: vargenau Date: 2010-04-06 14:58:41 +0000 (Tue, 06 Apr 2010) Log Message: ----------- Use base64 to make file UTF-8 clean Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2010-04-05 19:45:03 UTC (rev 7318) +++ trunk/lib/plugin/RateIt.php 2010-04-06 14:58:41 UTC (rev 7319) @@ -177,10 +177,8 @@ readfile($actionImg); } else { header('Content-type: image/png'); - echo '\x89PNG - - -IHDR ĉ IDATx^\xC0 \xC20\xEDz\xE7X \xFF7-` IEND\xAEB`\x82'; + echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAIAAAACAQMAAABIeJ9nAAAAA1BMVEX///' + .'+nxBvIAAAAAXRSTlMAQObYZgAAABNJREFUeF4NwAEBAAAAgJD+r5YGAAQAAXHhfPAAAAAASUVORK5CYII='); } exit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2010-06-26 14:55:13
|
Revision: 7577 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7577&view=rev Author: vargenau Date: 2010-06-26 14:55:07 +0000 (Sat, 26 Jun 2010) Log Message: ----------- name --> id Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2010-06-26 14:54:14 UTC (rev 7576) +++ trunk/lib/plugin/RateIt.php 2010-06-26 14:55:07 UTC (rev 7577) @@ -372,9 +372,8 @@ $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',0,0,1)"; } //$imgName = 'RateIt'.$reImgId.$i; - $img_attr['name'] = $imgId . $i; - $img_attr['alt'] = $img_attr['name']; - $img_attr['border'] = 0; + $img_attr['id'] = $imgId . $i; + $img_attr['alt'] = $img_attr['id']; $a1->pushContent(HTML::img($img_attr)); //$a1->addToolTip(_("Rate the topic of this page")); $html->pushContent($a1); @@ -388,8 +387,7 @@ ."'$reImgId','$dimension','X')")); $msg = _("Cancel your rating"); $imgprops = array('src' => $WikiTheme->getImageUrl("RateIt".$imgPrefix."Cancel"), - 'name' => $imgId.$imgPrefix.'Cancel', - 'border'=> 0, + 'id' => $imgId.$imgPrefix.'Cancel', 'alt' => $msg, 'title' => $msg); if (!$this->rating) @@ -401,16 +399,15 @@ /*} elseif ($pred) { $msg = _("No opinion"); $html->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateItCancelN"), - 'name'=> $imgPrefix.'Cancel', + 'id' => $imgPrefix.'Cancel', 'alt' => $msg))); //$a0->addToolTip($msg); //$html->pushContent($a0); }*/ $img_attr = array(); $img_attr['src'] = $WikiTheme->_findData("images/spacer.png"); - $img_attr['name'] = $actionImgName; - $img_attr['alt'] = $img_attr['name']; - $img_attr['border'] = 0; + $img_attr['id'] = $actionImgName; + $img_attr['alt'] = $img_attr['id']; $img_attr['height'] = 15; $img_attr['width'] = 20; $html->pushContent(HTML::img($img_attr)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2011-03-03 18:03:04
|
Revision: 7959 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7959&view=rev Author: vargenau Date: 2011-03-03 18:02:58 +0000 (Thu, 03 Mar 2011) Log Message: ----------- No tabs Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2011-03-03 17:52:53 UTC (rev 7958) +++ trunk/lib/plugin/RateIt.php 2011-03-03 18:02:58 UTC (rev 7959) @@ -177,7 +177,7 @@ } else { header('Content-type: image/png'); echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAIAAAACAQMAAABIeJ9nAAAAA1BMVEX///' - .'+nxBvIAAAAAXRSTlMAQObYZgAAABNJREFUeF4NwAEBAAAAgJD+r5YGAAQAAXHhfPAAAAAASUVORK5CYII='); + .'+nxBvIAAAAAXRSTlMAQObYZgAAABNJREFUeF4NwAEBAAAAgJD+r5YGAAQAAXHhfPAAAAAASUVORK5CYII='); } exit; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-22 16:44:16
|
Revision: 8525 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8525&view=rev Author: vargenau Date: 2012-11-22 16:44:03 +0000 (Thu, 22 Nov 2012) Log Message: ----------- Update phpdoc Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2012-11-22 13:17:20 UTC (rev 8524) +++ trunk/lib/plugin/RateIt.php 2012-11-22 16:44:03 UTC (rev 8525) @@ -309,18 +309,13 @@ * * This needs to be put in the <body> section of the page. * - * @param Name $pagename + * @param pagename Name of the page to rate * @param version Version of the page to rate (may be "" for current) - * @param Prefix $imgPrefix - * @param Id $dimension - * @param bool|Makes $small - * @return \HtmlElement - * @internal param \Name $pagename of the page to rate - * @internal param \Prefix $imgPrefix of the names of the images that display the rating + * @param imgPrefix Prefix of the names of the images that display the rating * You can have two widgets for the same page displayed at * once iff the imgPrefix-s are different. - * @internal param \Id $dimension of the dimension to rate - * @internal param \Makes $small a smaller ratings widget if non-false + * @param dimension Id of the dimension to rate + * @param small Makes a smaller ratings widget if non-false * * Limitations: Currently this can only print the current users ratings. * And only the widget, but no value (for buddies) also. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-22 16:51:33
|
Revision: 8526 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8526&view=rev Author: vargenau Date: 2012-11-22 16:51:27 +0000 (Thu, 22 Nov 2012) Log Message: ----------- Add variables Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2012-11-22 16:44:03 UTC (rev 8525) +++ trunk/lib/plugin/RateIt.php 2012-11-22 16:51:27 UTC (rev 8526) @@ -84,6 +84,9 @@ class WikiPlugin_RateIt extends WikiPlugin { + static $toBeUniq = 1; + var $idTop = ''; + function getName() { return _("RateIt"); @@ -151,6 +154,7 @@ $WikiTheme->addMoreHeaders(JavaScript( "var prediction = new Array; var rating = new Array; var avg = new Array; var numusers = new Array; +var canRate = new Array; var msg_rating_votes = '" . _("Rating: %.1f (%d votes)") . "'; var msg_curr_rating = '" . _("Your current rating: ") . "'; var msg_curr_prediction = '" . _("Your current prediction: ") . "'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2012-11-22 16:56:34
|
Revision: 8527 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8527&view=rev Author: vargenau Date: 2012-11-22 16:56:27 +0000 (Thu, 22 Nov 2012) Log Message: ----------- Remove commented code Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2012-11-22 16:51:27 UTC (rev 8526) +++ trunk/lib/plugin/RateIt.php 2012-11-22 16:56:27 UTC (rev 8527) @@ -286,8 +286,6 @@ sprintf(_("Prediction: %.1f"), $this->pred)); } - //$html->pushContent(HTML::p()); - //$html->pushContent(HTML::em("(Experimental: This might be entirely bogus data)")); return $html; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-01-03 18:01:40
|
Revision: 8847 http://sourceforge.net/p/phpwiki/code/8847 Author: vargenau Date: 2014-01-03 18:01:37 +0000 (Fri, 03 Jan 2014) Log Message: ----------- Update PHP Doc Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2013-12-11 15:07:12 UTC (rev 8846) +++ trunk/lib/plugin/RateIt.php 2014-01-03 18:01:37 UTC (rev 8847) @@ -309,16 +309,17 @@ * * This needs to be put in the <body> section of the page. * - * @param pagename Name of the page to rate - * @param version Version of the page to rate (may be "" for current) - * @param imgPrefix Prefix of the names of the images that display the rating + * @param $pagename Name of the page to rate + * @param $version Version of the page to rate (may be "" for current) + * @param $imgPrefix Prefix of the names of the images that display the rating * You can have two widgets for the same page displayed at * once iff the imgPrefix-s are different. - * @param dimension Id of the dimension to rate - * @param small Makes a smaller ratings widget if non-false + * @param $dimension Id of the dimension to rate + * @param $small Makes a smaller ratings widget if non-false * * Limitations: Currently this can only print the current users ratings. * And only the widget, but no value (for buddies) also. + * @return $this */ function RatingWidgetHtml($pagename, $version, $imgPrefix, $dimension, $small = false) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-08-27 10:04:46
|
Revision: 9055 http://sourceforge.net/p/phpwiki/code/9055 Author: vargenau Date: 2014-08-27 10:04:39 +0000 (Wed, 27 Aug 2014) Log Message: ----------- elseif Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2014-08-27 09:41:07 UTC (rev 9054) +++ trunk/lib/plugin/RateIt.php 2014-08-27 10:04:39 UTC (rev 9055) @@ -373,7 +373,7 @@ $img_attr['src'] = $ok[$i % 2]; $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,0,1)"; $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',$this->rating,0,1)"; - } else if (!$this->rating and $this->pred) { + } elseif (!$this->rating and $this->pred) { $img_attr['src'] = $rk[$i % 2]; $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,1,1)"; $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',$this->pred,1,1)"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-02-11 10:19:19
|
Revision: 9519 http://sourceforge.net/p/phpwiki/code/9519 Author: vargenau Date: 2015-02-11 10:19:11 +0000 (Wed, 11 Feb 2015) Log Message: ----------- Merge for plain Phpwiki and Fusionforge Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2015-02-11 10:00:13 UTC (rev 9518) +++ trunk/lib/plugin/RateIt.php 2015-02-11 10:19:11 UTC (rev 9519) @@ -152,8 +152,10 @@ { // early side-effects (before body) global $WikiTheme; static $_already; - if (!empty($_already)) return; - $_already = 1; + if (!(defined('FUSIONFORGE') && FUSIONFORGE)) { + if (!empty($_already)) return; + $_already = 1; + } $WikiTheme->addMoreHeaders(JavaScript( "var prediction = new Array; var rating = new Array; var avg = new Array; var numusers = new Array; @@ -211,14 +213,24 @@ //$this->_request = & $request; //$this->_dbi = & $dbi; $user = $request->getUser(); - //FIXME: fails on test with DumpHtml:RateIt - if (!is_object($user)) { - return HTML::raw(''); + if (defined('FUSIONFORGE') && FUSIONFORGE) { + if ($user && is_object($user) && $user->isAuthenticated()) { + //FIXME: fails on test with DumpHtml:RateIt + $this->userid = $user->getId(); + $isAuth = 1; + } else { + $isAuth = 0; + } + } else { + //FIXME: fails on test with DumpHtml:RateIt + if (!is_object($user)) { + return HTML::raw(''); + } + $this->userid = $user->getId(); + if (!$this->userid) { + return HTML::raw(''); + } } - $this->userid = $user->getId(); - if (!$this->userid) { - return HTML::raw(''); - } $args = $this->getArgs($argstr, $request); $this->dimension = $args['dimension']; $this->imgPrefix = $args['imgPrefix']; @@ -239,14 +251,16 @@ $rdbi = RatingsDb::getTheRatingsDb(); $this->_rdbi =& $rdbi; - if ($args['mode'] === 'add') { - //if (!$user->isSignedIn()) return $this->error(_("You must sign in")); + if (!(defined('FUSIONFORGE') && FUSIONFORGE)) { + $isAuth = true; + } + + if ($isAuth && $args['mode'] === 'add') { $this->rating = $request->getArg('rating'); $rdbi->addRating($this->rating, $this->userid, $this->pagename, $this->dimension); $this->displayActionImg('add'); - } elseif ($args['mode'] === 'delete') { - //if (!$user->isSignedIn()) return $this->error(_("You must sign in")); + } elseif ($isAuth && $args['mode'] === 'delete') { $rdbi->deleteRating($this->userid, $this->pagename, $this->dimension); unset($this->rating); $this->displayActionImg('delete'); @@ -254,28 +268,43 @@ return $this->RatingWidgetHtml($args['pagename'], $args['version'], $args['imgPrefix'], $args['dimension'], $args['small']); } else { - //if (!$user->isSignedIn()) return $this->error(_("You must sign in")); - //extract($args); - $this->rating = $rdbi->getRating($this->userid, $this->pagename, $this->dimension); + if ($isAuth) + $this->rating = $rdbi->getRating($this->userid, $this->pagename, $this->dimension); + else + $this->rating = 0; $this->avg = $rdbi->getAvg($this->pagename, $this->dimension); $this->numusers = $rdbi->getNumUsers($this->pagename, $this->dimension); // Update this text on rateit in javascript. needed: NumUsers, Avg - $html = HTML::div - ( + if (defined('FUSIONFORGE') && FUSIONFORGE) { + $html = HTML::span(); + } else { + $html = HTML::div(); + } + $html->pushContent( HTML::span(array('class' => 'rateit'), - sprintf(_("Rating: %.1f (%d votes)"), - $this->avg, $this->numusers))); + sprintf(_("Rating: %s (%d vote" . ($this->numusers > 1 ? 's' : '') . ")"), + round($this->avg, 1), round($this->numusers, 1)))); + if (defined('FUSIONFORGE') && FUSIONFORGE) { + $this->pred = ''; + } if ($args['show'] == 'top') { if (ENABLE_PAGE_PUBLIC) { $page = $dbi->getPage($this->pagename); if ($page->get('public')) $html->setAttr('class', "public"); } + if (defined('FUSIONFORGE') && FUSIONFORGE) { + $this->idTop = sprintf("%u", crc32($this->pagename)); + } $html->setAttr('id', 'rateit-widget-top'); - $html->pushContent(HTML::br(), - $this->RatingWidgetHtml($args['pagename'], $args['version'], - $args['imgPrefix'], - $args['dimension'], $args['small'])); + if (defined('FUSIONFORGE') && FUSIONFORGE) { + $html->pushContent(HTML::raw(' ')); + } else { + $html->pushContent(HTML::br()); + } + $html->pushContent($this->RatingWidgetHtml($args['pagename'], $args['version'], + $args['imgPrefix'], + $args['dimension'], $args['small'])); } elseif ($args['show'] == 'text') { if (!$WikiTheme->DUMP_MODE) $html->pushContent(HTML::br(), @@ -285,7 +314,7 @@ $html->pushContent(HTML::br(), sprintf(_("Your rating was %.1f"), $this->rating)); - } else { + } elseif (!(defined('FUSIONFORGE') && FUSIONFORGE)) { $this->pred = $rdbi->getPrediction($this->userid, $this->pagename, $this->dimension); if (is_string($this->pred)) $html->pushContent(HTML::br(), @@ -349,6 +378,18 @@ $dbi =& $request->_dbi; $version = $dbi->_backend->get_latest_version($pagename); $pageid = sprintf("%u", crc32($pagename)); // MangleXmlIdentifier($pagename) + if (defined('FUSIONFORGE') && FUSIONFORGE) { + if ($pageid == $this->idTop) { + $pageid .= '0'; + $jsIdTop = "idTop = '" . 'RateIt' . $pageid . "';\n"; + $canRate = 1; + } else { + $pageid .= self::$toBeUniq; + self::$toBeUniq++; + $jsIdTop = ''; + $canRate = 0; + } + } $imgId = 'RateIt' . $pageid; $actionImgName = 'RateIt' . $pageid . 'Action'; @@ -372,35 +413,87 @@ $nk[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Nk" . $i . ".png"); // rated $rk[$i] = $WikiTheme->_findData("images/RateIt" . $imgPrefix . "Rk" . $i . ".png"); // pred } + if (defined('FUSIONFORGE') && FUSIONFORGE) { + $user = $request->getUser(); + if ($user && is_object($user) && $user->isAuthenticated()) { + $canRate = 1 & $canRate; + if (empty($this->userid)) { + $this->userid = $user->getId(); + } + if (empty($this->rating)) { + $this->rating = $rdbi->getRating($this->userid, $pagename, $dimension); + if (!$this->rating and empty($this->pred)) { + $this->pred = $rdbi->getPrediction($this->userid, $pagename, $dimension); + } + } + } else $canRate = 0 & $canRate; - if (empty($this->userid)) { - $user = $request->getUser(); - $this->userid = $user->getId(); - } - if (empty($this->rating)) { - $this->rating = $rdbi->getRating($this->userid, $pagename, $dimension); - if (!$this->rating and empty($this->pred)) { - $this->pred = $rdbi->getPrediction($this->userid, $pagename, $dimension); + if (empty($this->avg)) + $this->avg = $rdbi->getAvg($pagename, $dimension); + if (!$this->avg) + $this->avg = 0; + if (empty($this->numusers)) + $this->numusers = $rdbi->getNumUsers($pagename, $dimension); + } else { + if (empty($this->userid)) { + $user = $request->getUser(); + $this->userid = $user->getId(); } + if (empty($this->rating)) { + $this->rating = $rdbi->getRating($this->userid, $pagename, $dimension); + if (!$this->rating and empty($this->pred)) { + $this->pred = $rdbi->getPrediction($this->userid, $pagename, $dimension); + } + } } - for ($i = 1; $i <= 10; $i++) { - $j = $i / 2; - $a1 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," - . "'$reImgId','$dimension',$j)")); + if (!defined('FUSIONFORGE') && FUSIONFORGE) { + $j = $i / 2; + $a1 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," + . "'$reImgId','$dimension',$j)")); + } $img_attr = array(); $img_attr['src'] = $nk[$i % 2]; - if ($this->rating) { - $img_attr['src'] = $ok[$i % 2]; - $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,0,1)"; - $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',$this->rating,0,1)"; - } elseif (!$this->rating and $this->pred) { - $img_attr['src'] = $rk[$i % 2]; - $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,1,1)"; - $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',$this->pred,1,1)"; + if (defined('FUSIONFORGE') && FUSIONFORGE) { + if ($canRate) { + $jsCanRate = "canRate['$reImgId'] = 1;\n"; + $a1 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," + . "'$reImgId','$dimension',$i / 2)", + 'style' => 'outline: 0')); + if ($this->avg) { + $img_attr['src'] = $ok[$i % 2]; + $img_attr['onmouseover'] = "displayRating2('$reImgId','$reImgPrefix',$i / 2,0,1)"; + $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',$this->avg,0,1)"; + } elseif (!$this->rating and $this->pred) { + $img_attr['src'] = $rk[$i % 2]; + $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$i / 2,1,1)"; + $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',$this->pred,1,1)"; + } else { + $img_attr['onmouseover'] = "displayRating2('$reImgId','$reImgPrefix',$i / 2,0,1)"; + $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',0,0,1)"; + } + } else { + $jsCanRate = "canRate['$reImgId'] = 0;\n"; + if ($this->avg) { + $img_attr['src'] = $ok[$i % 2]; + } elseif (!$this->rating and $this->pred) { + $img_attr['src'] = $rk[$i % 2]; + } + $a1 = HTML::span(); + } } else { - $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,0,1)"; - $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',0,0,1)"; + if ($this->rating) { + $img_attr['src'] = $ok[$i % 2]; + $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,0,1)"; + $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',$this->rating,0,1)"; + } elseif (!$this->rating and $this->pred) { + $img_attr['src'] = $rk[$i % 2]; + $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,1,1)"; + $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',$this->pred,1,1)"; + } else { + $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,0,1)"; + $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',0,0,1)"; + } } //$imgName = 'RateIt'.$reImgId.$i; $img_attr['id'] = $imgId . $i; @@ -413,54 +506,79 @@ //if (($i%2) == 0) $html->pushContent("\n"); } $html->pushContent(HTML::raw(" ")); + if (defined('FUSIONFORGE') && FUSIONFORGE) { + if ($canRate) { + $a0 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," + . "'$reImgId','$dimension','X')", + 'style' => 'outline: 0')); + $msg = _("Cancel your rating"); + $imgprops = array('src' => $WikiTheme->getImageUrl("RateIt" . $imgPrefix . "Cancel"), + 'id' => $imgId . $imgPrefix . 'Cancel', + 'alt' => $msg, + 'title' => $msg, + 'onmouseover' => "displayRating2('$reImgId','$reImgPrefix',0,0,1)", + 'onmouseout' => "displayRating('$reImgId','$reImgPrefix',$this->avg,0,1)"); + if (!$this->rating) + $imgprops['style'] = 'display:none'; + $a0->pushContent(HTML::img($imgprops)); + //$a0->addToolTip($msg); + $html->pushContent($a0); + } + } else { + $a0 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," + . "'$reImgId','$dimension','X')")); + $msg = _("Cancel your rating"); + $imgprops = array('src' => $WikiTheme->getImageUrl("RateIt" . $imgPrefix . "Cancel"), + 'id' => $imgId . $imgPrefix . 'Cancel', + 'alt' => $msg, + 'title' => $msg); + if (!$this->rating) + $imgprops['style'] = 'display:none'; + $a0->pushContent(HTML::img($imgprops)); + $a0->addToolTip($msg); + $html->pushContent($a0); + } - $a0 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," - . "'$reImgId','$dimension','X')")); - $msg = _("Cancel your rating"); - $imgprops = array('src' => $WikiTheme->getImageUrl("RateIt" . $imgPrefix . "Cancel"), - 'id' => $imgId . $imgPrefix . 'Cancel', - 'alt' => $msg, - 'title' => $msg); - if (!$this->rating) - $imgprops['style'] = 'display:none'; - $a0->pushContent(HTML::img($imgprops)); - $a0->addToolTip($msg); - $html->pushContent($a0); - - /*} elseif ($pred) { - $msg = _("No opinion"); - $html->pushContent(HTML::img(array('src' => $WikiTheme->getImageUrl("RateItCancelN"), - 'id' => $imgPrefix.'Cancel', - 'alt' => $msg))); - //$a0->addToolTip($msg); - //$html->pushContent($a0); - }*/ $img_attr = array(); $img_attr['src'] = $WikiTheme->_findData("images/spacer.png"); $img_attr['id'] = $actionImgName; $img_attr['alt'] = $img_attr['id']; $img_attr['height'] = 15; $img_attr['width'] = 20; + if (defined('FUSIONFORGE') && FUSIONFORGE) { + $img_attr['style'] = 'display: none;'; + } $html->pushContent(HTML::img($img_attr)); // Display your current rating if there is one, or the current prediction // or the empty widget. $pred = empty($this->pred) ? 0 : $this->pred; - $js = ''; + if (defined('FUSIONFORGE') && FUSIONFORGE) { + $js = $jsIdTop . $jsCanRate; + } else { + $js = ''; + } if (!empty($this->avg)) $js .= "avg['$reImgId']=$this->avg; numusers['$reImgId']=$this->numusers;\n"; if ($this->rating) { $js .= "rating['$reImgId']=$this->rating; prediction['$reImgId']=$pred;\n"; - $html->pushContent(JavaScript($js - . "displayRating('$reImgId','$reImgPrefix',$this->rating,0,1);")); + if (defined('FUSIONFORGE') && FUSIONFORGE) { + $js .= "var msg_chg_rating = 'Change your rating from ';\n"; + $html->pushContent(JavaScript($js."displayRating('$reImgId','$reImgPrefix',$this->avg,0,1);")); + } else { + $html->pushContent(JavaScript($js."displayRating('$reImgId','$reImgPrefix',$this->rating,0,1);")); + } } elseif (!empty($this->pred)) { $js .= "rating['$reImgId']=0; prediction['$reImgId']=$this->pred;\n"; $html->pushContent(JavaScript($js . "displayRating('$reImgId','$reImgPrefix',$this->pred,1,1);")); } else { $js .= "rating['$reImgId']=0; prediction['$reImgId']=0;\n"; - $html->pushContent(JavaScript($js - . "displayRating('$reImgId','$reImgPrefix',0,0,1);")); + if (defined('FUSIONFORGE') && FUSIONFORGE) { + $html->pushContent(JavaScript($js."displayRating('$reImgId','$reImgPrefix',$this->avg,0,1);")); + } else { + $html->pushContent(JavaScript($js."displayRating('$reImgId','$reImgPrefix',0,0,1);")); + } } return $html; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-02-11 13:33:05
|
Revision: 9521 http://sourceforge.net/p/phpwiki/code/9521 Author: vargenau Date: 2015-02-11 13:32:57 +0000 (Wed, 11 Feb 2015) Log Message: ----------- Merge for plain Phpwiki and Fusionforge Modified Paths: -------------- trunk/lib/plugin/RateIt.php Modified: trunk/lib/plugin/RateIt.php =================================================================== --- trunk/lib/plugin/RateIt.php 2015-02-11 10:21:22 UTC (rev 9520) +++ trunk/lib/plugin/RateIt.php 2015-02-11 13:32:57 UTC (rev 9521) @@ -179,7 +179,6 @@ ob_end_clean(); // discard any previous output // delete the cache $page = $request->getPage(); - //$page->set('_cached_html', false); $request->cacheControl('MUST-REVALIDATE'); $dbi = $request->getDbh(); $dbi->touch(); @@ -210,8 +209,6 @@ function run($dbi, $argstr, &$request, $basepage) { global $WikiTheme; - //$this->_request = & $request; - //$this->_dbi = & $dbi; $user = $request->getUser(); if (defined('FUSIONFORGE') && FUSIONFORGE) { if ($user && is_object($user) && $user->isAuthenticated()) { @@ -393,7 +390,6 @@ $imgId = 'RateIt' . $pageid; $actionImgName = 'RateIt' . $pageid . 'Action'; - //$rdbi =& $this->_rdbi; $rdbi = RatingsDb::getTheRatingsDb(); // check if the imgPrefix icons exist. @@ -405,7 +401,6 @@ $reImgId = $this->_javascript_quote_string($imgId); $reActionImgName = $this->_javascript_quote_string($actionImgName); $rePagename = $this->_javascript_quote_string($pagename); - //$dimension = $args['pagename'] . "rat"; $html = HTML::span(array("class" => "rateit-widget", "id" => $imgId)); for ($i = 0; $i < 2; $i++) { @@ -428,33 +423,13 @@ } } else $canRate = 0 & $canRate; - if (empty($this->avg)) - $this->avg = $rdbi->getAvg($pagename, $dimension); - if (!$this->avg) - $this->avg = 0; - if (empty($this->numusers)) - $this->numusers = $rdbi->getNumUsers($pagename, $dimension); - } else { - if (empty($this->userid)) { - $user = $request->getUser(); - $this->userid = $user->getId(); - } - if (empty($this->rating)) { - $this->rating = $rdbi->getRating($this->userid, $pagename, $dimension); - if (!$this->rating and empty($this->pred)) { - $this->pred = $rdbi->getPrediction($this->userid, $pagename, $dimension); - } - } - } - for ($i = 1; $i <= 10; $i++) { - if (!defined('FUSIONFORGE') && FUSIONFORGE) { - $j = $i / 2; - $a1 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," - . "'$reImgId','$dimension',$j)")); - } - $img_attr = array(); - $img_attr['src'] = $nk[$i % 2]; - if (defined('FUSIONFORGE') && FUSIONFORGE) { + if (empty($this->avg)) $this->avg = $rdbi->getAvg($pagename, $dimension); + if (!$this->avg) $this->avg = 0; + if (empty($this->numusers)) $this->numusers = $rdbi->getNumUsers($pagename, $dimension); + + for ($i = 1; $i <= 10; $i++) { + $img_attr = array(); + $img_attr['src'] = $nk[$i % 2]; if ($canRate) { $jsCanRate = "canRate['$reImgId'] = 1;\n"; $a1 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," @@ -481,7 +456,30 @@ } $a1 = HTML::span(); } - } else { + $img_attr['id'] = $imgId . $i; + $img_attr['alt'] = $img_attr['id']; + $a1->pushContent(HTML::img($img_attr)); + $html->pushContent($a1); + } + $html->pushContent(HTML::raw(" ")); + } else { + if (empty($this->userid)) { + $user = $request->getUser(); + $this->userid = $user->getId(); + } + if (empty($this->rating)) { + $this->rating = $rdbi->getRating($this->userid, $pagename, $dimension); + if (!$this->rating and empty($this->pred)) { + $this->pred = $rdbi->getPrediction($this->userid, $pagename, $dimension); + } + } + + for ($i = 1; $i <= 10; $i++) { + $j = $i / 2; + $a1 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," + . "'$reImgId','$dimension',$j)")); + $img_attr = array(); + $img_attr['src'] = $nk[$i % 2]; if ($this->rating) { $img_attr['src'] = $ok[$i % 2]; $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,0,1)"; @@ -494,18 +492,14 @@ $img_attr['onmouseover'] = "displayRating('$reImgId','$reImgPrefix',$j,0,1)"; $img_attr['onmouseout'] = "displayRating('$reImgId','$reImgPrefix',0,0,1)"; } + $img_attr['id'] = $imgId . $i; + $img_attr['alt'] = $img_attr['id']; + $a1->pushContent(HTML::img($img_attr)); + $html->pushContent($a1); } - //$imgName = 'RateIt'.$reImgId.$i; - $img_attr['id'] = $imgId . $i; - $img_attr['alt'] = $img_attr['id']; - $a1->pushContent(HTML::img($img_attr)); - //$a1->addToolTip(_("Rate the topic of this page")); - $html->pushContent($a1); + $html->pushContent(HTML::raw(" ")); + } - //This adds a space between the rating smilies: - //if (($i%2) == 0) $html->pushContent("\n"); - } - $html->pushContent(HTML::raw(" ")); if (defined('FUSIONFORGE') && FUSIONFORGE) { if ($canRate) { $a0 = HTML::a(array('href' => "javascript:clickRating('$reImgPrefix','$rePagename','$version'," @@ -521,7 +515,6 @@ if (!$this->rating) $imgprops['style'] = 'display:none'; $a0->pushContent(HTML::img($imgprops)); - //$a0->addToolTip($msg); $html->pushContent($a0); } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |