%@page session="true"%>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="com.edeal.frontline.Utils" pageEncoding="UTF-8" %>
<%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><%
FlRequest flRequest = new FlRequest(request);
String deleteMode = flRequest.getRequestParameterOrAttribute("deleteMode");
String crtID = flRequest.getRequestParameterOrAttribute("CrtID");
response.setContentType("application/x-javascript");
%>
function showFaq(id){
$.ajax({
url: "/get_faq_score.fl?FaqID="+id,
success:function(score){
$.openPopupLayer({
name: "Faq_"+id,
width: "auto",
height: "auto",
url: "/faq_popup.fl?id=" + id + "<%=(!Utils.isEmpty(deleteMode)? "&deleteMode="+deleteMode : "") %>" + "<%=(!Utils.isEmpty(crtID)? "&crtID="+crtID : "") %>" ,
cache: false,
success: function (data) {
_grid__FAQCMNTS_js_.render();
$('#popupLayerScreenLocker').height(($(document).height()) + "px");
$('#rating').ratings(5,score).bind('ratingchanged', function(event, data) {
$.ajax({
url:"/set_faq_score.fl?FaqID="+id+"&score="+data.rating,
success:function(result) {
$(".score_"+id).each(function(index){
$(this).html(result + " ");
});
}
});
});
},
error: function () {
alert("Erreur lors de l'ouverture de la popup !");
}
});
}
});
}
function addComment(id){
if(($("#CmtTitle").val() == "") && ($("#CmtContent").val() != "")){
alert('');
return;
} else if(($("#CmtContent").val() == "") && ($("#CmtTitle").val() != "")){
alert('');
return;
} else if(($("#CmtContent").val() == "") && ($("#CmtTitle").val() == "")){
$("#comments").attr("style","display:none;");
} else if(($("#CmtTitle").val() != "") && ($("#CmtContent").val() != "")){
var cmtTitle = encodeURI($("#CmtTitle").val());
var cmtContent = encodeURI($("#CmtContent").val());
var fields = {"CmtTitle": cmtTitle, "CmtContent": cmtContent};
var json = [];
json[0] = {"type":"Comments","id":"cmtID","fields":fields};
var jsondata = JSON.stringify(json);
$.ajax({
data: jsondata,
type: "POST",
timeout: 20000,
contentType: "application/json;charset=utf-8",
dataType: 'json',
async: false,
url: "/add_faq_comment.fl?FaqID="+id,
success:function(data){
//_grid__FAQCMNTS_js_.callAjaxForHtml(_grid__FAQCMNTS_js_.getAjaxUrl(),null,false,false,_grid__FAQCMNTS_js_callback,false,null);
//$('#popupLayerScreenLocker').height($(document).height() + "px");
$("#CmtTitle").val("");
$("#CmtContent").val("");
$("#comments").attr("style","display:none;");
$("#nb_comments").html("("+data.nbComments+")");
}
});
}
}
function showComments(){
_grid__FAQCMNTS_js_.callAjaxForHtml(_grid__FAQCMNTS_js_.getAjaxUrl(),null,false,false,_grid__FAQCMNTS_js_callback,false,null);
}
function _grid__FAQCMNTS_js_callback(arrIndex) {
//if (eDealXmlhttpArr[arrIndex].readyState == 4) {
$("#comments").attr("style","display:block;");
$("#popupLayerScreenLocker").height($(document).height() + "px");
$("#popup_closer").hide();
//}
}