- Fehler bei Doppelbewertungen gefixed
- Deaktivieren von Bewertungen gefixed - JavaScript-Fehler im Safari gefixed
This commit is contained in:
parent
e2a1ac4dbf
commit
0bcf4fbed4
@ -90,7 +90,7 @@ class DcaHelper extends \Backend
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->Database->prepare("UPDATE tl_rateit_items SET active='' WHERE rkey=? and typ=?")
|
$this->Database->prepare("UPDATE tl_rateit_items SET active='' WHERE rkey=? and typ=?")
|
||||||
->execute($dc->activeRecord->id, $typ)
|
->execute($dc->activeRecord->id, $type)
|
||||||
->updatedId;
|
->updatedId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -312,9 +312,10 @@ function doRateIt() {
|
|||||||
el.data('selected', el.find('.rateItRating-selected'));
|
el.data('selected', el.find('.rateItRating-selected'));
|
||||||
el.data('hover', el.find('.rateItRating-hover'));
|
el.data('hover', el.find('.rateItRating-hover'));
|
||||||
|
|
||||||
var backgroundImage = self.getBackgroundImage(el.data('wrapper'));
|
jQuery.when(self.getBackgroundImage(el.data('wrapper'))).done(function(backgroundImageSize) {
|
||||||
self.options.starwidth = backgroundImage.width;
|
self.options.starwidth = backgroundImageSize[0];
|
||||||
self.options.starheight = backgroundImage.height / 3; // da immer drei Sterne "übereinander" gebraucht werden
|
self.options.starheight = backgroundImageSize[1] / 3; // da immer drei Sterne "übereinander" gebraucht werden
|
||||||
|
});
|
||||||
if (self.options.starwidth === undefined || self.options.starwidth < 16) {
|
if (self.options.starwidth === undefined || self.options.starwidth < 16) {
|
||||||
self.options.starwidth = 16;
|
self.options.starwidth = 16;
|
||||||
}
|
}
|
||||||
@ -498,13 +499,21 @@ function doRateIt() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getBackgroundImage: function(el) {
|
getBackgroundImage: function(el) {
|
||||||
|
var dfd = jQuery.Deferred();
|
||||||
|
var backgroundImageSize = new Array();
|
||||||
var reg_imgFile = /url\s*\(["']?(.*)["']?\)/i;
|
var reg_imgFile = /url\s*\(["']?(.*)["']?\)/i;
|
||||||
var dummy = document.createElement('img');
|
|
||||||
var string = this.getBackgroundImagePath(el);
|
var string = this.getBackgroundImagePath(el);
|
||||||
string = string.match(reg_imgFile)[1];
|
string = string.match(reg_imgFile)[1];
|
||||||
string = string.replace('\"', '');
|
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) {
|
updateText: function(el, text) {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -133,8 +133,19 @@ class RateIt extends \Frontend {
|
|||||||
->count();
|
->count();
|
||||||
|
|
||||||
// Die with an error if the insert fails (duplicate IP or duplicate member id for a vote).
|
// Die with an error if the insert fails (duplicate IP or duplicate member id for a vote).
|
||||||
if (((!$this->allowDuplicates && $countIp == 0) || $this->allowDuplicates) ||
|
if ((!$this->allowDuplicatesForMembers && (isset($countUser) ? $countUser == 0 : false)) || ($this->allowDuplicatesForMembers && isset($userId))) {
|
||||||
((!$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.
|
// Insert the data.
|
||||||
$arrSet = array('pid' => $ratableKeyId['id'],
|
$arrSet = array('pid' => $ratableKeyId['id'],
|
||||||
'tstamp' => time(),
|
'tstamp' => time(),
|
||||||
|
Loading…
Reference in New Issue
Block a user