| Server IP : 165.22.154.248 / Your IP : 216.73.217.0 [ Web Server : Apache/2.4.29 (Ubuntu) System : Linux droplet-integra 4.15.0-197-generic #208-Ubuntu SMP Tue Nov 1 17:23:37 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 7.2.24-0ubuntu0.18.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/avanza-lms.old.bak9874115/rating/ |
Upload File : |
M.core_rating = {
Y : null,
api: M.cfg.wwwroot + '/rating/rate_ajax.php',
init : function(Y){
this.Y = Y;
Y.all('select.postratingmenu').each(this.attach_rating_events, this);
//hide the submit buttons
this.Y.all('input.postratingmenusubmit').setStyle('display', 'none');
},
attach_rating_events : function(selectnode) {
selectnode.on('change', this.submit_rating, this, selectnode);
},
submit_rating : function(e, selectnode){
var theinputs = selectnode.ancestor('form').all('.ratinginput');
var thedata = [];
var inputssize = theinputs.size();
for (var i = 0; i < inputssize; i++) {
if(theinputs.item(i).get("name") != "returnurl") { // Dont include return url for ajax requests.
thedata[theinputs.item(i).get("name")] = theinputs.item(i).get("value");
}
}
var scope = this;
var cfg = {
method: 'POST',
on: {
complete : function(tid, outcome, args) {
try {
if (!outcome) {
alert('IO FATAL');
return false;
}
var data = scope.Y.JSON.parse(outcome.responseText);
if (data.success){
//if the user has access to the aggregate then update it
if (data.itemid) { //do not test data.aggregate or data.count otherwise it doesn't refresh value=0 or no value
var itemid = data.itemid;
var node = scope.Y.one('#ratingaggregate' + itemid);
node.set('innerHTML',data.aggregate);
// Empty the count value if no ratings.
var node = scope.Y.one('#ratingcount' + itemid);
if (data.count > 0) {
node.set('innerHTML', "(" + data.count + ")");
} else {
node.set('innerHTML', "");
}
}
return true;
}
else if (data.error) {
alert(data.error);
}
} catch(e) {
alert(e.message + " " + outcome.responseText);
}
return false;
}
},
arguments: {
scope: scope
},
headers: {
},
data: build_querystring(thedata)
};
this.Y.io(this.api, cfg);
}
};