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. |