Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
0bcf4fbed4 | |||
e2a1ac4dbf | |||
19feefda83 |
@ -90,7 +90,7 @@ class DcaHelper extends \Backend
|
||||
}
|
||||
} else {
|
||||
$this->Database->prepare("UPDATE tl_rateit_items SET active='' WHERE rkey=? and typ=?")
|
||||
->execute($dc->activeRecord->id, $typ)
|
||||
->execute($dc->activeRecord->id, $type)
|
||||
->updatedId;
|
||||
|
||||
}
|
||||
|
@ -634,8 +634,8 @@ class rateitBackendModule extends \BackendModule
|
||||
$cntSql = str_replace('%s', $where, $cntSql);
|
||||
|
||||
$count = $this->Database->prepare($cntSql)
|
||||
->execute()
|
||||
->fetchRow();
|
||||
->execute()
|
||||
->fetchRow();
|
||||
|
||||
$arrRatingItems = $this->Database->prepare($sql)
|
||||
->execute()
|
||||
|
41
composer.json
Normal file
41
composer.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name":"cgo-it/rate-it",
|
||||
"description":"RateIt extension for the Contao Open Source CMS",
|
||||
"keywords":["contao", "rating", "rateit", "bewertung"],
|
||||
"type":"contao-module",
|
||||
"license":"LGPL-3.0+",
|
||||
"authors":[
|
||||
{
|
||||
"name":"cgo IT",
|
||||
"email":"info@cgo-it.de",
|
||||
"homepage":"https://cgo-it.de",
|
||||
"role":"Developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"email": "info@cgo-it.de",
|
||||
"issues": "https://bitbucket.org/cgo-it/contao-rate-it/issues?status=new&status=open",
|
||||
"forum": "https://community.contao.org/de/showthread.php?38471-Rate-It",
|
||||
"source": "https://bitbucket.org/cgo-it/contao-rate-it/src"
|
||||
},
|
||||
"require":{
|
||||
"php":">=5.3",
|
||||
"contao/core":">=3.0",
|
||||
"contao-community-alliance/composer-plugin": "~2.0",
|
||||
"cgo-it/simple_ajax":"1.0.1",
|
||||
"cgo-it/xls_export":"3.0.0"
|
||||
},
|
||||
"replace": {
|
||||
"cgo-it/rate-it": "self.version"
|
||||
},
|
||||
"conflict": {
|
||||
"contao/core": "2.11.*"
|
||||
},
|
||||
"extra":{
|
||||
"contao": {
|
||||
"sources":{
|
||||
"":"system/modules/rateit"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -67,6 +67,7 @@ $GLOBALS['TL_LANG']['tl_rateit_type_options']['faq'] = 'FAQ';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['ce'] = 'Inhaltselement';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['module'] = 'Modul';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['galpic'] = 'Galerie-Bild';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['news4ward'] = 'Beitrag';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['rating desc'] = 'Bewertung';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['title'] = 'Titel';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['typ'] = 'Typ';
|
||||
|
@ -67,6 +67,7 @@ $GLOBALS['TL_LANG']['tl_rateit_type_options']['faq'] = 'FAQ';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['ce'] = 'Content element';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['module'] = 'Module';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['galpic'] = 'Gallery picture';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['news4ward'] = 'Blog entry';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['rating desc'] = 'Rating';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['title'] = 'Title';
|
||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['typ'] = 'Type';
|
||||
|
@ -90,6 +90,7 @@
|
||||
.mod_rateit table.rating td.type-faq { background-color:#ffe0aa; }
|
||||
.mod_rateit table.rating td.type-article { background-color:#ffcce0; }
|
||||
.mod_rateit table.rating td.type-galpic { background-color:#ffe066; }
|
||||
.mod_rateit table.rating td.type-news4ward { background-color:#ffe011; }
|
||||
.mod_rateit table.rating td.active-1, .mod_rateit table.rating td.type-page { background-color:#e0ffe0; }
|
||||
.mod_rateit table.rating td.
|
||||
|
||||
|
@ -212,7 +212,7 @@ function doRateIt() {
|
||||
getStarPercent: function(id) {
|
||||
/* Format = anyStringHere-<id>-<float(currentStars)>_(scale);
|
||||
* Example: RateItRatings-5-3_5 //Primary key id = 5, 3/5 stars. */
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
if (stars != null) {
|
||||
var score = stars[3].toFloat();
|
||||
var scale = stars[4].toFloat();
|
||||
@ -236,17 +236,17 @@ function doRateIt() {
|
||||
},
|
||||
|
||||
getRatableId: function(id) {
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
return stars != null ? stars[1] : '';
|
||||
},
|
||||
|
||||
getRatableType: function(id) {
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
return stars != null ? stars[2] : '';
|
||||
},
|
||||
|
||||
getRatableMaxValue: function(id) {
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
return stars != null ? stars[4].toInt() : 0;
|
||||
},
|
||||
|
||||
@ -312,9 +312,10 @@ function doRateIt() {
|
||||
el.data('selected', el.find('.rateItRating-selected'));
|
||||
el.data('hover', el.find('.rateItRating-hover'));
|
||||
|
||||
var backgroundImage = self.getBackgroundImage(el.data('wrapper'));
|
||||
self.options.starwidth = backgroundImage.width;
|
||||
self.options.starheight = backgroundImage.height / 3; // da immer drei Sterne "übereinander" gebraucht werden
|
||||
jQuery.when(self.getBackgroundImage(el.data('wrapper'))).done(function(backgroundImageSize) {
|
||||
self.options.starwidth = backgroundImageSize[0];
|
||||
self.options.starheight = backgroundImageSize[1] / 3; // da immer drei Sterne "übereinander" gebraucht werden
|
||||
});
|
||||
if (self.options.starwidth === undefined || self.options.starwidth < 16) {
|
||||
self.options.starwidth = 16;
|
||||
}
|
||||
@ -451,7 +452,7 @@ function doRateIt() {
|
||||
getStarPercent: function(id) {
|
||||
/* Format = anyStringHere-<id>-<float(currentStars)>_(scale);
|
||||
* Example: RateItRatings-5-3_5 //Primary key id = 5, 3/5 stars. */
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
if (stars != null) {
|
||||
var score = parseFloat(stars[3]);
|
||||
var scale = parseFloat(stars[4]);
|
||||
@ -475,17 +476,17 @@ function doRateIt() {
|
||||
},
|
||||
|
||||
getRatableId: function(id) {
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
return stars != null ? stars[1] : '';
|
||||
},
|
||||
|
||||
getRatableType: function(id) {
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
return stars != null ? stars[2] : '';
|
||||
},
|
||||
|
||||
getRatableMaxValue: function(id) {
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||
return stars != null ? parseInt(stars[4]) : 0;
|
||||
},
|
||||
|
||||
@ -498,13 +499,21 @@ function doRateIt() {
|
||||
},
|
||||
|
||||
getBackgroundImage: function(el) {
|
||||
var dfd = jQuery.Deferred();
|
||||
var backgroundImageSize = new Array();
|
||||
var reg_imgFile = /url\s*\(["']?(.*)["']?\)/i;
|
||||
var dummy = document.createElement('img');
|
||||
var string = this.getBackgroundImagePath(el);
|
||||
string = string.match(reg_imgFile)[1];
|
||||
string = string.replace('\"', '');
|
||||
dummy.src = string;
|
||||
return dummy;
|
||||
|
||||
jQuery('<img/>')
|
||||
.attr('src', string)
|
||||
.load(function() {
|
||||
backgroundImageSize.push(this.width);
|
||||
backgroundImageSize.push(this.height);
|
||||
dfd.resolve(backgroundImageSize);
|
||||
});
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
updateText: function(el, text) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -98,7 +98,7 @@ class RateIt extends \Frontend {
|
||||
}
|
||||
|
||||
//Make sure that the ratable type is 'page' or 'ce' or 'module'
|
||||
if (!($type === 'page' || $type === 'article' || $type === 'ce' || $type === 'module' || $type === 'news' || $type === 'faq' || $type === 'galpic')) {
|
||||
if (!($type === 'page' || $type === 'article' || $type === 'ce' || $type === 'module' || $type === 'news' || $type === 'faq' || $type === 'galpic' || $type === 'news4ward')) {
|
||||
header(RETURN_AJAX_HEADER);
|
||||
echo $GLOBALS['TL_LANG']['rateit']['error']['invalid_type'];
|
||||
exit;
|
||||
@ -133,8 +133,19 @@ class RateIt extends \Frontend {
|
||||
->count();
|
||||
|
||||
// Die with an error if the insert fails (duplicate IP or duplicate member id for a vote).
|
||||
if (((!$this->allowDuplicates && $countIp == 0) || $this->allowDuplicates) ||
|
||||
((!$this->allowDuplicatesForMembers && (isset($countUser) ? $countUser == 0 : false)) || ($this->allowDuplicatesForMembers && isset($userId)))) {
|
||||
if ((!$this->allowDuplicatesForMembers && (isset($countUser) ? $countUser == 0 : false)) || ($this->allowDuplicatesForMembers && isset($userId))) {
|
||||
// Insert the data.
|
||||
$arrSet = array('pid' => $ratableKeyId['id'],
|
||||
'tstamp' => time(),
|
||||
'ip_address' => $ip,
|
||||
'memberid' => isset($userId) ? $userId : null,
|
||||
'rating' => $rating,
|
||||
'createdat'=> time()
|
||||
);
|
||||
$this->Database->prepare('INSERT INTO tl_rateit_ratings %s')
|
||||
->set($arrSet)
|
||||
->execute();
|
||||
} elseif (!isset($countUser) && ((!$this->allowDuplicates && $countIp == 0) || $this->allowDuplicates)) {
|
||||
// Insert the data.
|
||||
$arrSet = array('pid' => $ratableKeyId['id'],
|
||||
'tstamp' => time(),
|
||||
@ -147,7 +158,7 @@ class RateIt extends \Frontend {
|
||||
->set($arrSet)
|
||||
->execute();
|
||||
} else {
|
||||
header(RETURN_AJAX_HEADER);
|
||||
header(RETURN_AJAX_HEADER);
|
||||
echo $GLOBALS['TL_LANG']['rateit']['error']['duplicate_vote'];
|
||||
exit;
|
||||
}
|
||||
|
@ -66,25 +66,17 @@
|
||||
</div>
|
||||
<?php if ($this->rateit_rating_after): ?>
|
||||
<!-- indexer::stop -->
|
||||
<div itemtype="http://data-vocabulary.org/Review-aggregate" itemscope="" class="rating-microdata">
|
||||
<div id="<?php echo $this->id; ?>" class="<?php echo $this->class; ?> <?php echo $this->rateit_class; ?>">
|
||||
<?php if ($this->showBefore) : ?>
|
||||
<div id="<?php echo $this->descriptionId; ?>" class="ratingText"><?php echo $this->description; ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="wrapper">
|
||||
<div class="rateItRating-selected" style="display: block;"></div>
|
||||
<div class="rateItRating-hover"></div>
|
||||
</div>
|
||||
<?php if ($this->showAfter) : ?>
|
||||
<div id="<?php echo $this->descriptionId; ?>" class="ratingText"><?php echo $this->description; ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<span class="rating-microdata" itemprop="itemreviewed"><?php echo $this->itemreviewed; ?></span>
|
||||
<span class="rating-microdata" itemtype="http://data-vocabulary.org/Rating" itemscope="" itemprop="rating">
|
||||
<span itemprop="average"><?php echo $this->actRating; ?></span>
|
||||
<span itemprop="best"><?php echo $this->maxRating; ?></span>
|
||||
</span>
|
||||
<span class="rating-microdata" itemprop="votes"><?php echo $this->votes; ?></span>
|
||||
<div id="<?php echo $this->id; ?>" class="<?php echo $this->class; ?> <?php echo $this->rateit_class; ?>">
|
||||
<?php if ($this->showBefore) : ?>
|
||||
<div id="<?php echo $this->descriptionId; ?>" class="ratingText"><?php echo $this->description; ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="wrapper">
|
||||
<div class="rateItRating-selected" style="display: block;"></div>
|
||||
<div class="rateItRating-hover"></div>
|
||||
</div>
|
||||
<?php if ($this->showAfter) : ?>
|
||||
<div id="<?php echo $this->descriptionId; ?>" class="ratingText"><?php echo $this->description; ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<!-- indexer::continue -->
|
||||
<?php endif; ?>
|
||||
|
Reference in New Issue
Block a user