function starsRate(pagePk){ var result = 0; $.ajax({ async: false, type: "GET", url: comunidadDomain + "/votacionContentPageController/get", data: "content=" + pagePk, dataType: "json", success: function(json){ result = json.points; } }); $('#valoracion_'+pagePk).html(''); $('#valoracion_'+pagePk).raty({ showHalf:true, number: 5, start: result, path:"/static/images/", onClick: function(score) { if(!connected){ openOverlay() }else{ $.ajax({ type: "GET", url: comunidadDomain + "/votacionContentPageController/set", data: "content=" + pagePk + "&votos=" + score, dataType: "json" }); } } }); } function starsRateNoRecord(pageFichaPk,fichaSection,fichaConcursoPk,voteWithLogging){ var result = 0; $.ajax({ async: false, type: "GET", url: comunidadDomain + "/voteCardCompetition/getMedia", data: "contentPk=" + pageFichaPk, dataType: "json", success: function(json){ result = json.points; $('#valoraMedia').html("Valoración media: "+result+""); } }); if(pintarFichaConcursoVotada(pageFichaPk)==false){ $('#valoracionNoRecord_'+pageFichaPk).html(''); $('#valoracionNoRecord_'+pageFichaPk).raty({ showHalf:true, number: 5, start: result, path:"/static/images/", onClick: function(score) { if(voteWithLogging == 'true'){ if(!connected){ openOverlay() }else{ $.cookie(pageFichaPk,true); $.ajax({ type: "GET", url: comunidadDomain + "/voteCardCompetition/setSecure", data: "contentPk=" + pageFichaPk + "&fichaConcursoPk=" + fichaConcursoPk + "§ionId=" + fichaSection + "&votos=" + score, dataType: "json", success: function(json){ result = json.points; $('#valoraMedia').html("Valoración media: "+result+""); $('#valoracionNoRecord_'+pageFichaPk).html("
Gracias por votar
"); } }); } } else{ $.cookie(pageFichaPk,true); $.ajax({ type: "GET", url: comunidadDomain + "/voteCardCompetition/set", data: "contentPk=" + pageFichaPk + "&fichaConcursoPk=" + fichaConcursoPk + "§ionId=" + fichaSection + "&votos=" + score, dataType: "json", success: function(json){ result = json.points; $('#valoraMedia').html("Valoración media: "+result+""); $('#valoracionNoRecord_'+pageFichaPk).html("Gracias por votar
"); } }); } } }); } } function pintarFichaConcursoVotada(pageFichaPk){ if(checkIfExistFicha(pageFichaPk)==true){ $('#valoracionNoRecord_'+pageFichaPk).html("Gracias por votar
"); return true; }else{ return false; } } function checkIfExistFicha(pageFichaPk){ var exist = false; value = $.cookie(pageFichaPk); if(value!=null){ exist = true; } return exist; }