Deprecated: Optional parameter $state declared before required parameter $jtable is implicitly treated as a required parameter in /home/engageddev4/public_html/administrator/components/com_enmasse/helpers/EnmasseHelper.class.php on line 365
Warning: Cannot modify header information - headers already sent by (output started at /home/engageddev4/public_html/administrator/components/com_enmasse/helpers/EnmasseHelper.class.php:365) in /home/engageddev4/public_html/components/com_vreview/controller.php on line 4134
function Vreview( defaults ){
var merchantId = defaults.merchantId;
var profileid = defaults.profileid;
var xmlvalue = defaults.xmlvalue;
var lim = defaults.limit;
var off = defaults.offset;
var rowId = defaults.rowId;
var pagetitle = defaults.pagetitle;
var multi_star = defaults.multi_star;
var enable_rating = defaults.enable_rating;
var enable_comment = defaults.enable_comment;
var char_limit = defaults.char_limit;
var captcha = defaults.captcha;
var user = defaults.user;
var curr_link = defaults.curr_link;
var plgversion = defaults.plgversion;
var currentUrl = defaults.currentUrl;
var min_chars = 50;
var th = this;
//display records start
this.displayRecords = function(lim,off) {
var sort = jQuery('#sort').val();
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'displayRecords', 'limit':lim, 'offset':off, 'profileid':profileid, 'merchantId':merchantId, 'rowId':rowId, 'sort':sort},
async: false,
cache: false,
beforeSend: function() {
jQuery("#loader_message"+rowId).html("").hide();
jQuery('#loader_image'+rowId).show();
},
success: function(data){
if(data.result=="success"){
if(data.noVal){
var emVal = '
'+data.noVal+'
';
jQuery('.no_review'+rowId).html(emVal);
}
jQuery('#show-review'+rowId).append(data.commentVal);
jQuery('#loader_image'+rowId).hide();
}
if(data.countRev) {
if (data.revEnd == 1) {
jQuery("#loader_message"+rowId).html('אין עדיין המלצות').show();
} else {
limitstart = off + lim;
jQuery("#loader_message"+rowId).html('הצגת חוות דעת נוספות').show();
}
txt ="הצג המלצות נוספות (";
txt +=(data.countRev-limitstart);
txt +=")";
jQuery('.load-more').text(txt);
txt ="הצג המלצות נוספות (";
txt +=(data.countRev-limitstart);
txt +=")";
jQuery('.load-more').text(txt);
} else {
jQuery("#loader_message"+rowId).remove();
jQuery("#loader_image"+rowId).remove();
}
if (jQuery(window).height() > 480 && jQuery(".sidebar").length > 0) {
stickySidebar.hcSticky('refresh');
}
}
});
}
//displayrecords end
jQuery(document).ready(function() {
//th.displayRecords(lim, off);
jQuery(document).on('click','#loader_message'+rowId,function(event) {
event.preventDefault();
// if it has no more records no need to fire ajax request
//var d = jQuery('#loader_message'+rowId).find("a").attr("data-atr");
var d = jQuery(this).find("a").attr("data-atr");
if (d != "nodata") {
off = parseInt(d);
th.displayRecords(lim, off);
}
});
jQuery('#loadprev'+rowId).click(function(event) {
event.preventDefault();
// if it has no more records no need to fire ajax request
var d = jQuery('#loadprev'+rowId).find("a").attr("data-atr");
if (d != "nodata") {
off = off-lim;
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'displayRecords', 'limit':lim, 'offset':off, 'profileid':profileid, 'xmlvalue':xmlvalue, 'rowId':rowId},
async: false,
cache: false,
beforeSend: function() {
jQuery("#loadprev"+rowId).html("").hide();
jQuery('#loadpre_image'+rowId).show();
},
success: function(data){
if(data.result=="success"){
if(data.noVal){
var emVal = '
'+data.noVal+'
';
jQuery('.no_review'+rowId).html(emVal);
}
jQuery('#show-review'+rowId).prepend(data.commentVal);
jQuery('#loadpre_image'+rowId).hide();
}
if (data.revPrev == 1) {
jQuery("#loadprev"+rowId).html('טען מידע קודם').show();
} else {
jQuery("#loadprev"+rowId).remove();
jQuery("#loadpre_image"+rowId).remove();
}
}
});
}
});
});
jQuery(document).ready(function(){
// Check Radio-box
jQuery('form[name="adminForm'+rowId+'"] .rating'+rowId+' input:radio').attr('checked', false);
jQuery('form[name="adminForm'+rowId+'"] .rating'+rowId+' input').click(function () {
jQuery('form[name="adminForm'+rowId+'"] .rating'+rowId+' span').removeClass('checked');
jQuery(this).parent().addClass('checked');
});
});
jQuery(document).ready(function(){
//Check Radio-box
jQuery('form[name="adminForm'+rowId+'"] .mrt'+rowId+' input:radio').attr('checked', false);
jQuery(document).on('click','form[name="adminForm'+rowId+'"] .mrt'+rowId+' input',function () {
jQuery(this).parent().siblings().removeClass('checked');
jQuery(this).parent().addClass('checked');
});
});
//Click Event to Like
jQuery(document).on('click','.like'+rowId,function() {
var tl = this;
th.likePage(tl);
});
//Click Event to Dislike
jQuery(document).on('click','.dislike'+rowId,function() {
var tdl = this;
th.dislikePage(tdl);
});
//Click Event to Report
jQuery(document).on('click','.report'+rowId,function() {
var rth = this;
th.reportPage(rth);
});
//Click Event to Subscribe/Unsubscribe
jQuery(document).on('click','#subscribe'+rowId,function() {
var sbt = this;
th.subscribePage(sbt);
});
//Click Event for Comment Like
jQuery(document).on('click','.cmlike'+rowId,function() {
var cmlthis = this;
th.commentLike(cmlthis);
});
//Click Event for Comment Dislike
jQuery(document).on('click','.cmdislike'+rowId,function() {
var cmdlthis = this;
th.commentDislike(cmdlthis);
});
//Click Event for Comment Report
jQuery(document).on('click','.cmreport'+rowId,function() {
var cmrpthis = this;
th.commentReport(cmrpthis);
});
//Clicke event to delete
jQuery(document).on('click','.delete-review'+rowId,function() {
var dlt = this;
th.deleteReview(dlt);
});
jQuery('.smilies'+rowId).hide();
jQuery(document).on('click','.smiley'+rowId,function() {
jQuery('.smilies'+rowId).toggle();
});
var smileval;
var comments;
jQuery(document).on('click', '.smile'+rowId ,function(){
smileval = jQuery(this).attr('value');
var cmntTxt = jQuery('form[name="adminForm'+rowId+'"] #comments').val();
var char_length = cmntTxt.length;
if(char_limit!=0 && char_length==char_limit)
{
showError(rowId, 'הזנת מספר עודף של תווים');
return false;
}
jQuery('form[name="adminForm'+rowId+'"] #comments').val(cmntTxt+smileval);
comments = jQuery('form[name="adminForm'+rowId+'"] #comments').val();
});
jQuery(document).on('click','input ',function() {
//jQuery('.smilies'+rowId).hide();
jQuery('.reply-smilies'+rowId).hide();
});
jQuery(document).on('click','textarea',function() {
jQuery('.smilies'+rowId).hide();
//jQuery('.reply-smilies'+rowId).hide();
});
if(multi_star==1) {
var ratings= new Array();
jQuery('input:radio').change(function(){
var ids = jQuery(this).parent().parent().attr('mrid');
var level = jQuery(this).parent().parent().attr('level');
var counts = jQuery('#counts').attr('value');
//alert(ids);
for(var i=0;i0) {
jQuery( "#dialog"+rowId ).dialog( "open" );
return false;
}
//alert(profileid);alert(th.pagetitle);
//return false;
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'like', 'profileid':profileid, 'xmlvalue':xmlvalue, 'pagetitle':pagetitle, 'curr_link':curr_link},
async: false,
cache: false,
beforeSend: function() {
var htm = '';
jQuery(tl).append(htm);
},
complete: function() {
jQuery(tl).find('span.like-load').remove();
},
success: function(data){
if(data.result=="success"){
var totalLikes=''+data.totalLike+' '+data.likeTxt+' ';
jQuery(tl).html(totalLikes);
var totalDislikes=''+data.totalDislike+' '+data.dislikeTxt+' ';
jQuery(tl).parent().find('.dislike'+rowId).html(totalDislikes);
//alert(data.msg);
//jQuery('.like').off();
jQuery(tl).addClass('disabled');
jQuery(tl).parent().find('.dislike'+rowId).removeClass('disabled');
}
else if(data.result=="alreadyLiked")
{
var alrMsg = jQuery('.alr-msg'+rowId);
alrMsg.css('display','block').text(data.alertMsg);
jQuery(tl).addClass('disabled');
scrollToEl(alrMsg);
}
}
});
}
//Like End
//Dislike start
this.dislikePage = function(tdl) {
if(jQuery('#guest-user'+rowId).length>0) {
jQuery( "#dialog"+rowId ).dialog( "open" );
return false;
}
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data:{'option':'com_vreview', 'task':'dislike', 'profileid':profileid,'xmlvalue':xmlvalue, 'pagetitle':pagetitle, 'curr_link':curr_link},
async: false,
cache: false,
beforeSend: function() {
var htm = '';
jQuery(tdl).append(htm);
},
complete: function() {
jQuery(tdl).find('span.like-load').remove();
},
success: function(data){
if(data.result=="success"){
var totalLikes=''+data.totalLike+' '+data.likeTxt+' ';
jQuery(tdl).parent().find('.like'+rowId).html(totalLikes);
var totalDislikes=''+data.totalDislike+' '+data.dislikeTxt+' ';
jQuery(tdl).html(totalDislikes);
//alert(data.msg);
jQuery(tdl).addClass('disabled');
jQuery(tdl).parent().find('.like'+rowId).removeClass('disabled');
}
else if(data.result=="alreadyDisliked")
{
var alrMsg = jQuery('.alr-msg'+rowId);
alrMsg.css('display','block').text(data.alertMsg);
jQuery(tdl).addClass('disabled');
scrollToEl(alrMsg);
}
}
});
}
//Dislike End
//Report Start
this.reportPage = function(rth) {
if(jQuery('#guest-user'+rowId).length>0) {
jQuery( "#dialog"+rowId ).dialog( "open" );
return false;
}
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data:{'option':'com_vreview', 'task':'report', 'profileid':profileid, 'xmlvalue':xmlvalue,'pagetitle':pagetitle, 'curr_link':curr_link},
async: false,
cache: false,
beforeSend: function() {
var htm = '';
jQuery(rth).append(htm);
},
complete: function() {
jQuery(rth).find('span.like-load').remove();
},
success: function(data){
if(data.result=="success"){
var totalReports=''+data.totalReport+' '+data.reportTxt+' ';
jQuery(rth).html(totalReports);
//alert(data.msg);
jQuery(rth).addClass('disabled');
}
else if(data.result=="alreadyReport")
{
var alrMsg = jQuery('.alr-msg'+rowId);
alrMsg.css('display','block').text(data.alertMsg);
jQuery(rth).addClass('disabled');
scrollToEl(alrMsg);
}
}
});
}
//Report End
// Subscribe Start
this.subscribePage = function(sbt) {
if(jQuery('#guest-user'+rowId).length>0) {
jQuery( "#dialog"+rowId ).dialog( "open" );
return false;
}
jQuery.ajax({
//url:'index.php',
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'subscribe', 'profileid':profileid, 'xmlvalue':xmlvalue},
async: false,
cache: false,
beforeSend: function() {
var htm = '';
jQuery(sbt).append(htm);
},
complete: function() {
jQuery(sbt).find('span.like-load').remove();
},
success: function(data){
if(data.result=="success"){
if(data.subscribeVal==1) {
var subscribe = ''+data.subText+'';
//alert(data.subMsg);
}
else {
var subscribe = ''+data.subText+'';
//alert(data.subMsg);
}
jQuery('#subscribe'+rowId).html(subscribe);
}
}
});
}
// Subscribe End
//Delete Start
this.deleteReview = function(dlt) {
var reviewid = jQuery(dlt).attr('drid');
var commentid = jQuery(dlt).attr('dcid');
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'delete', 'reviewid':reviewid, 'commentid':commentid, 'profileid':profileid, 'xmlvalue':xmlvalue},
async: false,
cache: false,
beforeSend: function() {
var htm = '';
jQuery(dlt).append(htm);
},
complete: function() {
jQuery(dlt).find('span.like-load').remove();
},
success: function(data){
if(data.result=="success"){
jQuery(dlt).parent().parent().parent().remove();
jQuery('.disable').removeClass('disable');
jQuery('.smiley'+rowId).removeClass('disabled');
jQuery('.submitreview'+rowId).removeClass('disabled');
jQuery('form[name="adminForm'+rowId+'"] #comments').prop('disabled', false);
//alert( data.msg);
}
}
});
}
//Delete End
//Edit Start
this.editReview = function(thiseditClass) {
var eid = jQuery(thiseditClass).attr('eid');
rvId = jQuery(thiseditClass).attr('erid');
cmId = jQuery(thiseditClass).attr('cmid');
jQuery.ajax({
//url:'index.php',
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'editReview', 'rvId':rvId, 'cmId':cmId},
async: false,
cache: false,
beforeSend: function() {
var htm = '';
jQuery(thiseditClass).append(htm);
},
complete: function() {
jQuery(thiseditClass).find('span.like-load').remove();
},
success: function(data){
if(data.result=="success"){
jQuery('html,body').stop().animate({scrollTop: jQuery(jQuery('#adminForm'+rowId)).offset().top }, 1000);
jQuery('.disable').removeClass('disable');
jQuery('.smiley'+rowId).removeClass('disabled');
jQuery('.submitreview'+rowId).removeClass('disabled');
jQuery('form[name="adminForm'+rowId+'"] #comments').prop('disabled', false);
if(char_limit!=0) {
var max_length = 'maxlength='+char_limit+'';
} else {
var max_length = 'maxlength=""';
}
var inptext = '';
jQuery('.cmnt'+rowId).html(inptext);
}
}
});
}
//Edit End
//Submit Review Start
this.submitReview = function(submitClass) {
var errors = new Array;
var message;
if((jQuery('#guest-user'+rowId).length>0) && (!jQuery('#guest-user'+rowId).hasClass('guest-user'+rowId))) {
jQuery( "#dialog"+rowId ).dialog( "open" );
return false;
}
if(jQuery('.guest-form'+rowId).length>0)
{
//var emailReg = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
if (min_chars != 0) {
message = jQuery('form[name="adminForm'+rowId+'"] #comments').val();
if(message.length < min_chars)
{
errors.push('תוכן ההמלצה חייב לכלול לפחות 50 תווים');
}
}
if(jQuery('form[name="adminForm'+rowId+'"] #name').val()=='')
{
errors.push('עליך להכניס את שם הזוג');
}
/*
if(jQuery('form[name="adminForm'+rowId+'"] #email').val()=='')
{
showError(rowId,'אנא הכנס את כתובת הדוא\'\'ל שלך');
return false;
}
*/
if(rvId) {
var rId = rvId;
} else {
var rId = '';
}
if(cmId) {
var cmd = cmId;
}
else {
var cmd = '';
}
if(enable_rating==1 && multi_star==1)
{
if(ratings.length>0)
{
var rating = ratings;
}else {
var rating = '';
}
}
else if(enable_rating==1)
{
if(ratings)
{
var rating = ratings;
}else {
var rating = '';
}
} else {
var rating = '';
}
if(enable_rating==1)
{
if(rId=='' && rating=='')
{
errors.push('עליך לדרג את מספר הכוכבים לספק. דירוג מירבי: 5 כוכבים.');
}
}
if(jQuery('form[name="adminForm'+rowId+'"] #event_date').val()=='')
{
if (message.length > 50) {
errors.push('עליך להזין את תאריך האירוע');
}
}
/*
var email = jQuery('form[name="adminForm'+rowId+'"] #email').val();
var name = jQuery('form[name="adminForm'+rowId+'"] #name').val();
if (email != '') {
var valid = emailReg.test(email);
if(!valid) {
showError('אנא הכנס את כתובת הדוא\'\'ל שלך');
return false;
}
}
*/
}
else {
var email = '';
var name = '';
}
//jQuery('.smilies'+rowId).hide();
var challengeField = jQuery("input#recaptcha_challenge_field").val();
if(plgversion==1.0)
{
var recaptcha_response_field = jQuery("input#recaptcha_response_field").val();
} else if(plgversion==2.0) {
var recaptcha_response_field = jQuery("textarea#g-recaptcha-response").val();
}
if(enable_comment==1) {
var char_length = jQuery('form[name="adminForm'+rowId+'"] #comments').val().length;
}
if(char_limit!=0 && char_length>char_limit)
{
errors.push('הזנת מספר עודף של תווים');
}
/*if(comments)
{
var comment = comments;
}else {
var comment = jQuery('form[name="adminForm'+rowId+'"] #comments').val();
}*/
var comment = jQuery('form[name="adminForm'+rowId+'"] #comments').val();
var love = jQuery('form[name="adminForm'+rowId+'"] #love').val();
var improvement = jQuery('form[name="adminForm'+rowId+'"] #improvement').val();
var price = jQuery('form[name="adminForm'+rowId+'"] #price').val();
var event_date = jQuery('form[name="adminForm'+rowId+'"] #event_date').val();
/*
if(comment=='')
{
errors.push('הזן את תוכן חוות הדעת שלך');
}
*/
if (errors.length > 0) {
showErrors(rowId, errors);
return false;
}
var image = document.getElementById('image').files[0];
if (typeof image == "undefined" && !hideImageModal) {
jQuery('#reviewModal').modal('show');
return;
}
formData = new FormData(jQuery('#adminForm' + rowId)[0]);
formData.append('option', 'com_vreview');
formData.append('task', 'review');
formData.append('profileid', profileid);
formData.append('xmlvalue', JSON.stringify(xmlvalue));
formData.append('rating', rating);
formData.append('pagetitle', pagetitle);
formData.append('rid', rId);
formData.append('cmd', cmd);
formData.append('recaptcha_response_field', recaptcha_response_field);
formData.append('recaptcha_challenge_field', challengeField);
formData.append('curr_link', curr_link);
formData.append('plgversion', plgversion);
formData.append('rowId', rowId);
formData.append('merchantId', merchantId);
formData.append('currentUrl', currentUrl);
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data: formData,
processData: false,
contentType: false,
async: true,
cache: false,
beforeSend: function() {
jQuery(".loadingbox").show();
},
complete: function() {
jQuery(".loadingbox").hide();
hideImageModal = false;
},
success: function(data){
if(data.result=="success"){
if(data.cmd=="")
{
jQuery('#show-review'+rowId).prepend(data.commentVal);
}
else {
jQuery(thiseditClass).parent().parent().html(data.commentVal);
}
jQuery('form[name="adminForm'+rowId+'"] #comments').val('');
jQuery('form[name="adminForm'+rowId+'"] #love').val('');
jQuery('form[name="adminForm'+rowId+'"] #improvement').val('');
jQuery('form[name="adminForm'+rowId+'"] #event_date').val('');
jQuery('form[name="adminForm'+rowId+'"] #price').val('');
jQuery('form[name="adminForm'+rowId+'"] #name').val('');
//jQuery('form[name="adminForm'+rowId+'"] #email').val('');
jQuery('.mrt'+rowId+' input').parent().siblings().removeClass('checked');
jQuery('.rating'+rowId+' span').removeClass('checked');
cmId = '';
rvId = '';
comments = '';
var avg_ttl = '';
jQuery('form[name="adminForm'+rowId+'"] .avg-stars').html(avg_ttl);
jQuery('.no_review'+rowId).remove();
if(data.subVal==0 || data.subVal==null) {
var subscribe = ''+data.subsTxt+'';
jQuery('#sub'+rowId).html(subscribe);
}
else
{
var subscribe = ''+data.subsTxt+'';
jQuery('#sub').html(subscribe);
}
/*if(data.enbl_rating==0 && data.reviewLim==data.revCount && user!=0)
{
jQuery("#comments").prop('disabled', true);
jQuery('.smiley').addClass('disabled');
jQuery('.submitreview ').addClass('disabled');
alert('');
}*/
if(data.enbl_rating==1 && user!=0)
{
var htm='';
jQuery('.mrt'+rowId).append(htm);
jQuery('.rating'+rowId).append(htm);
jQuery('form[name="adminForm'+rowId+'"] #comments').prop('disabled', true);
jQuery('.smiley'+rowId).addClass('disabled');
jQuery('.submitreview'+rowId).addClass('disabled');
}
if(captcha==1 && enable_rating==1 && plgversion==1.0)
{
Recaptcha.reload();
}
var succMsg = jQuery('.msg'+rowId);
succMsg.addClass('succ-msg').css('display','block').text(data.succMsg);
scrollToEl(succMsg);
if(data.mod_msg){
var modMsg = jQuery('.mod-msg'+rowId);
modMsg.css('display','block').text(data.mod_msg);
scrollToEl(modMsg);
}
} else if(data.result=="captcha") {
showError(rowId, data.capErr);
if(plgversion==1.0)
{
Recaptcha.reload();
}
}else if(data.result=="censor") {
showError(rowId, data.censorErr);
}
/*
else if(data.result=="emailErr") {
showError(rowId, data.emailError);
}
*/
else if(data.result=="reviewLimit") {
jQuery('form[name="adminForm'+rowId+'"] #comments').val('');
showError(rowId, data.limErr);
}
else if(data.result=="charLimit") {
showError(rowId, data.charLimTxt);
}
else if(data.result=="reviewExist") {
showError(rowId, data.revExistTxt);
}
else if(data.result=="internalError") {
showError(rowId, data.uploadErrorTxt);
}
//location.reload();
}
});
}
//Submit Review End
var smileval;
var replies='';
jQuery(document).on('click','.reply-smile'+rowId,function(){
var rsd = this;
jQuery(this).parent().parent().parent().css('display','inline-block');
smileval = jQuery(this).attr('value');
var replyText = jQuery(this).parent().parent().parent().find('input').val();
var char_length = jQuery(this).parent().parent().parent().find('input').val().length;
if(char_limit!=0 && char_length==char_limit)
{
rMsg = jQuery(this).parent().parent().parent().parent().find("span.r-msg");
rMsg.addClass('r-err-msg').css('display','block').text('הזנת מספר עודף של תווים');
scrollToEl(rMsg);
//alert('You have entered excess number of characters');
return false;
}
jQuery(this).parent().parent().parent().find('input').val(replyText+smileval);
replies = jQuery(this).parent().parent().parent().find('input').val();
});
this.submitReply = function(thisClass) {
var ids = jQuery(thisClass).attr('rrid');
if((jQuery('#guest-user'+rowId).length>0) && (!jQuery('#guest-user'+rowId).hasClass('guest-user'+rowId))) {
jQuery( "#dialog"+rowId ).dialog( "open" );
return false;
}
jQuery(thisClass).parent().next("div").find(".rep").toggle();
jQuery(thisClass).parent().next("div").find('input').keypress(function(event){
var that = this;
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
th.sendReply(that,thisClass);
}
});
jQuery(thisClass).parent().next("div").find('span.send-reply').click(function(event){
var that = jQuery(this).prev('input[name="title"]');
jQuery(that).parent().next('div.reply-smilies').css('display','none');
th.sendReply(that,thisClass);
});
}
this.sendReply=function(that,thisClass){
//var reply = jQuery('#'+inputid+'').val();
var commentid = jQuery(that).attr('commentid');
var reply = jQuery(that).val();
if(reply=='')
{
var rMsg = jQuery(that).parent().parent().parent().find("span.r-msg");
rMsg.addClass('r-err-msg').css('display','block').text('הזן את תוכן חוות הדעת שלך');
scrollToEl(rMsg);
return false;
}
var char_length = jQuery(that).val().length;
if(char_limit!=0 && char_length>char_limit)
{
var rMsg = jQuery(that).parent().parent().parent().find("span.r-msg");
rMsg.addClass('r-err-msg').css('display','block').text('הזנת מספר עודף של תווים');
scrollToEl(rMsg);
return false;
}
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"json",
data: {'option':'com_vreview', 'task':'reply', 'reply':reply, 'commentid':commentid, 'profileid':profileid, 'xmlvalue':xmlvalue, 'curr_link':curr_link},
async: false,
cache: false,
beforeSend: function() {
jQuery(that).parent().parent().parent().parent().find('.reply-loader').show();
},
complete: function() {
jQuery(that).parent().parent().parent().parent().find('.reply-loader').hide();
},
success: function(data){
if(data.result=="success")
{
if(data.show_reply_time==1){
var reptime = ''+data.reply_time+'';
} else {
var reptime = '';
}
if(jQuery(thisClass).parent().parent().find('.review-panel-replies').find('span.rtext'+rowId).hasClass('open'))
{
var openClass = "open";
} else {
var openClass = "";
}
var countRep = ''+data.countReply+' '+data.repTxt+'';
jQuery(thisClass).parent().parent().find('.review-panel-replies').html(countRep);
var reply='
'+data.username+''+''+data.replies+''+reptime+'
';
if(jQuery(thisClass).parent().parent().find('.review-panel-replies').find('span.rtext'+rowId).hasClass('open')) {
jQuery(that).parent().parent().parent().next('div.review-rep').prepend(reply);
}
//jQuery('#show-review').html(data.commentVal);
jQuery(that).val('');
replies='';
var succMsg = jQuery(that).parent().parent().parent().find("span.r-msg");
succMsg.addClass('r-succ-msg').css('display','block').text(data.repSucc);
scrollToEl(succMsg);
//location.reload();
}
else if(data.result=="censor") {
var rMsg = jQuery(that).parent().parent().parent().find("span.r-msg");
rMsg.addClass('r-err-msg').css('display','block').text(data.censorErr);
scrollToEl(rMsg);
}
else if(data.result=="charRepLimit") {
var rErrMsg = jQuery(that).parent().parent().parent().find("span.r-msg");
rErrMsg.addClass('r-err-msg').css('display','block').text(data.charRepLimitTxt);
scrollToEl(rErrMsg);
}
else if(data.result=="commentLimit") {
var rErrMsg = jQuery(that).parent().parent().parent().find("span.r-msg");
jQuery(thisClass).parent().next("div").find('input').val('');
rErrMsg.addClass('r-err-msg').css('display','block').text(data.commentLimitTxt);
scrollToEl(rErrMsg);
}
}
});
};
var thisrtext;
var limits;
var offsets;
var limitstart = 0;
jQuery(document).on('click','.rtext'+rowId,function() {
if(jQuery(this).hasClass('open'))
{
jQuery(this).parent().parent().parent().find('.review-rep').toggle();
return false;
}
limits = lim;
offsets = 0;
jQuery(this).parent().parent().parent().find('.review-rep'+rowId).css('display','block');
var commentid = jQuery(this).attr('ccid');
thisrtext = this;
th.displayReply(limits, offsets, commentid, thisrtext);
});
jQuery(document).on('click','.loader_reply_message'+rowId,function() {
// if it has no more records no need to fire ajax request
var commentid = jQuery(this).attr('ccid');
var d = jQuery(this).find("button").attr("data-atr");
if (d != "nodata") {
offsets = limits + offsets;
th.displayReply(limits, offsets, commentid, thisrtext);
}
});
this.displayReply = function(lim, off, cmd, thr) {
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'displayReply', 'limit':lim, 'offset':off, 'commentid':cmd, 'profileid':profileid},
async: false,
cache: false,
beforeSend: function() {
jQuery(thr).parent().parent().parent().find(".loader_reply_message"+rowId).html("").hide();
jQuery(thr).parent().parent().parent().find(".loader_reply_image"+rowId).show();
},
success: function(data){
if(data.result=="success"){
//jQuery(thr).parent().parent().parent().find('.review-rep').css('display','block');
jQuery(thr).parent().parent().parent().find('.review-rep'+rowId).prepend(data.replyVal);
jQuery(thr).parent().parent().parent().find(".loader_reply_image"+rowId).hide();
if (data.replyVal == "") {
jQuery(thr).parent().parent().parent().find(".loader_reply_message"+rowId).html('').show()
} else {
jQuery(thr).parent().parent().parent().find(".loader_reply_message"+rowId).html('').show();
}
jQuery(thr).addClass('open');
}
}
});
}
jQuery('.reply-smilies'+rowId).hide();
jQuery(document).on('click','.reply-smiley'+rowId,function() {
jQuery(this).parent().next("div").toggle();
});
this.commentLike = function(cmlthis) {
var reviewid = jQuery(cmlthis).attr('rid');
var commentid = jQuery(cmlthis).attr('cid');
if(jQuery('#guest-user'+rowId).length>0) {
jQuery( "#dialog"+rowId ).dialog( "open" );
return false;
}
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'commentLike', 'reviewid':reviewid, 'commentid':commentid, 'profileid':profileid, 'curr_link':curr_link},
async: false,
cache: false,
beforeSend: function() {
var htm = '';
jQuery(cmlthis).append(htm);
},
complete: function() {
jQuery(cmlthis).find('span.like-load').remove();
},
success: function(data){
if(data.result=="success"){
var likecount=''+data.countLike+' '+data.likeTxt+' ';
jQuery(cmlthis).html(likecount);
var dislikecount=''+data.countDislike+' '+data.dislikeTxt+' ';
jQuery(cmlthis).parent().parent().find(".cmdislike"+rowId).html(dislikecount);
//alert( data.msg );
jQuery(cmlthis).addClass('disabled');
jQuery(cmlthis).parent().parent().find(".cmdislike"+rowId).removeClass('disabled');
}
}
});
}
this.commentDislike = function(cmdlthis) {
var reviewid = jQuery(cmdlthis).attr('rid');
var commentid = jQuery(cmdlthis).attr('cid');
if(jQuery('#guest-user'+rowId).length>0) {
jQuery( "#dialog"+rowId ).dialog( "open" );
return false;
}
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'commentDislike', 'reviewid':reviewid, 'commentid':commentid, 'profileid':profileid, 'curr_link':curr_link},
async: false,
cache: false,
beforeSend: function() {
var htm = '';
jQuery(cmdlthis).append(htm);
},
complete: function() {
jQuery(cmdlthis).find('span.like-load').remove();
},
success: function(data){
if(data.result=="success"){
var dislikecount=''+data.countDislike+' '+data.dislikeTxt+' ';
jQuery(cmdlthis).html(dislikecount);
var likecount=''+data.countLike+' '+data.likeTxt+' ';
jQuery(cmdlthis).parent().parent().find(".cmlike"+rowId).html(likecount);
//alert( data.msg );
jQuery(cmdlthis).addClass('disabled');
jQuery(cmdlthis).parent().parent().find(".cmlike"+rowId).removeClass('disabled');
}
}
});
}
this.commentReport = function(cmrpthis) {
var reviewid = jQuery(cmrpthis).attr('rid');
var commentid = jQuery(cmrpthis).attr('cid');
if(jQuery('#guest-user'+rowId).length>0) {
jQuery( "#dialog"+rowId ).dialog( "open" );
return false;
}
jQuery.ajax({
//url:"index.php",
type: "POST",
dataType:"JSON",
data: {'option':'com_vreview', 'task':'commentReport', 'reviewid':reviewid, 'commentid':commentid, 'profileid':profileid, 'xmlvalue':xmlvalue, 'curr_link':curr_link},
async: false,
cache: false,
beforeSend: function() {
var htm = '';
jQuery(cmrpthis).append(htm);
},
complete: function() {
jQuery(cmrpthis).find('span.like-load').remove();
},
success: function(data){
if(data.result=="success"){
var reportcount=''+data.countReport+' '+data.reportTxt+' ';
jQuery(cmrpthis).html(reportcount);
//alert( data.msg );
jQuery(cmrpthis).addClass('disabled');
}
}
});
}
}
function showError(rowId, error) {
var msg = jQuery('.msg' + rowId);
msg.addClass('error-msg').css('display','block').text(error);
jQuery('html, body').animate({ scrollTop: msg.offset().top - 200}, 1000);
}
function showErrors(rowId, errors) {
var msg = jQuery('.msg' + rowId);
msg.empty();
for (var i = 0; i < errors.length; i++) {
msg.append('