SNI.Community.Toolbox.ie=document.all;
SNI.Community.Toolbox.ns6=document.getElementById&&!document.all;
SNI.Community.Toolbox.dName;
SNI.Community.Toolbox.dCaption;
SNI.Community.Toolbox.dText;
SNI.Community.Toolbox.posted;
SNI.Community.Toolbox.commentsId;
SNI.Community.Toolbox.commentsUserid ;
SNI.Community.Toolbox.userCity;
SNI.Community.Toolbox.userState;
SNI.Community.Toolbox.userCountry;
SNI.Community.Toolbox.userLocation;
SNI.Community.Toolbox.pageLen = 10;
SNI.Community.Toolbox.totCommentsPages = 0;
SNI.Community.Toolbox.globalPostCommentStatus = true;
SNI.Community.Toolbox.flagTmpDiv = 0;
SNI.Community.Widgets.temp1 = 0;
SNI.Community.Widgets.trim = function(str){
try{
return str.replace(/^\s*|\s*$/g,'')
}catch(e){}
}
SNI.Community.Widgets.DA = function(url,callBack)
{
var locationUrl = document.location+"";
if(locationUrl.indexOf(":80")==-1 && url.indexOf(":80")!=-1)
{
var temp = url.substring(0,url.indexOf(":80"));
var temp1 = url.substring(url.indexOf(":80")+3,url.length);
url = temp + temp1;
}
var request=document.all?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
request.onreadystatechange=function()
{
if(request.readyState==4)
{
if(request.status==200)
{
try{eval(callBack);}catch(e){}
}
}
}
request.open("POST",url,true);
request.setRequestHeader("content-type","text/plain;charset=UTF-8");
request.send('');
}
SNI.Community.Widgets.includeCss = function(hrefLink){
var links = document.getElementsByTagName("link");
var found = false;
for(i=0;i");
}
}
SNI.Community.Widgets.numberFormat = function(nStr,prefix)
{
var prefix = prefix || '';
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1))
x1 = x1.replace(rgx, '$1' + ',' + '$2');
return prefix + x1 + x2;
}
SNI.Community.Widgets.isEmail = function(obj)
{
var string = obj.value
var emailerror=false;
if (SNI.Community.Widgets.trim(string).search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
{
emailerror=false;
}
else
{
emailerror=true;
//alert('Enter Valid User Name !!!');
obj.focus();
obj.select();
}
return emailerror;
}
SNI.Community.Widgets.replaceAll = function(OldString,FindString,ReplaceString)
{
var SearchIndex = 0;
var NewString = "";
while (OldString.indexOf(FindString,SearchIndex) != -1)
{
NewString += OldString.substring(SearchIndex,OldString.indexOf(FindString,SearchIndex));
NewString += ReplaceString;
SearchIndex = (OldString.indexOf(FindString,SearchIndex) + FindString.length);
}
NewString += OldString.substring(SearchIndex,OldString.length);
return NewString;
}
SNI.Community.Widgets.Set_Cookie = function( name, value, expires, path, domain, secure )
{
var today = new Date();
today.setTime( today.getTime() );
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24 * 1000;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
SNI.Community.Widgets.Get_Cookie = function( name ) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
SNI.Community.Widgets.Delete_Cookie = function( name, path, domain ) {
if ( SNI.Community.Widgets.Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
SNI.Community.Widgets.setPickleCookie = function(type,itemid)
{
var currval = SNI.Community.Widgets.Get_Cookie(type);
if(currval){
SNI.Community.Widgets.Delete_Cookie(type, '/', '');
currval = currval + ',' + itemid ;
}
else{
currval = itemid;
}
SNI.Community.Widgets.Set_Cookie( type,currval, '365', '/', '', '' );
}
SNI.Community.Widgets.displayOn = function(objId){
if( document.getElementById(objId) ){
document.getElementById(objId).style.display = "block";
}
}
SNI.Community.Widgets.displayOff = function(objId){
if( document.getElementById(objId) ){
document.getElementById(objId).style.display = "none";
}
}
SNI.Community.Widgets.layerOn = function(objId){
if( document.getElementById(objId) ){
document.getElementById(objId).style.visibility = "visible";
}
}
SNI.Community.Widgets.layerOff = function(objId){
if( document.getElementById(objId) ){
document.getElementById(objId).style.visibility = "hidden";
}
}
SNI.Community.Widgets.ismaxlength = function(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : "";
if (obj.getAttribute && obj.value.length>mlength){
obj.value=obj.value.substring(0,mlength)
obj.scrollLeft = obj.scrollWidth;
obj.scrollTop = obj.scrollHeight;
}
}
SNI.Community.Widgets.changeText = function(odjId)
{
document.getElementById(odjId).style.backgroundColor = '#712014';//'#F00';
document.getElementById(odjId).style.color = '#FFF';
document.getElementById(odjId).style.paddingLeft = '2px';
}
SNI.Community.Widgets.changeBack = function(odjId)
{
document.getElementById(odjId).style.backgroundColor = '#f7f7f7';
document.getElementById(odjId).style.color = '#323232';
document.getElementById(odjId).style.paddingLeft = '0px';
}
SNI.Community.Widgets.showCommentsPopUp_cp = function(){
SNI.Community.Widgets.displayOn('pcw-ttop');
SNI.Community.Widgets.displayOff('pcw-ttopa');
}
/*
SNI.Community.Toolbox.checkandshow = function()
{
secureComponent("SNI.Community.Widgets.displayOn('com-add-comment'); SNI.Community.Widgets.layerOff('cgp-id-comment-ad');","You Need To Be SIgned In To Do That.");
}
*/
SNI.Community.Widgets.showCommentsPopUp = function(){
SNI.Community.Widgets.displayOn('com-add-comment');
SNI.Community.Widgets.layerOff('cgp-id-comment-ad');
}
SNI.Community.Widgets.drawVotingWidgets = function()
{
if(document.getElementById('toolbox-v-05_'+SNI.Community.Toolbox.cAssetId))
{
//utilizing the decorator widget js methods
SNI.Community.Toolbox.executeCode = "renderVote('toolbox-v-05_"+SNI.Community.Toolbox.cAssetId+"','votingType3','"+SNI.Community.Toolbox.cAssetId+"','"+SNI.Community.Toolbox.csoFarVoteval+"','"+SNI.Community.Toolbox.cGlobalUserId+"','"+SNI.Community.Toolbox.cObjectType+"','"+escape(SNI.Community.Toolbox.cAssetUrl)+"','"+SNI.Community.Toolbox.cWidgetNameUsedInApp+"','"+SNI.Community.Toolbox.cGlobalOrigWidgetProjectId+"');";
//renderVote('toolbox-v-05_'+SNI.Community.Toolbox.cAssetId,"votingType3",SNI.Community.Toolbox.cAssetId,SNI.Community.Toolbox.csoFarVoteval,SNI.Community.Toolbox.cGlobalUserId,SNI.Community.Toolbox.cObjectType,SNI.Community.Toolbox.cAssetUrl);
}
if(document.getElementById('toolbox-v-03_'+SNI.Community.Toolbox.cAssetId))
{
//utilizing the decorator widget js methods
SNI.Community.Toolbox.executeCode += "renderVote('toolbox-v-03_"+SNI.Community.Toolbox.cAssetId+"','votingType6','"+SNI.Community.Toolbox.cAssetId+"','"+SNI.Community.Toolbox.csoFarVoteval+"','"+SNI.Community.Toolbox.cGlobalUserId+"','"+SNI.Community.Toolbox.cObjectType+"','"+escape(SNI.Community.Toolbox.cAssetUrl)+"','"+SNI.Community.Toolbox.cWidgetNameUsedInApp+"','"+SNI.Community.Toolbox.cGlobalOrigWidgetProjectId+"');";
//renderVote('toolbox-v-03_'+SNI.Community.Toolbox.cAssetId,"votingType6",SNI.Community.Toolbox.cAssetId,SNI.Community.Toolbox.csoFarVoteval,SNI.Community.Toolbox.cGlobalUserId,SNI.Community.Toolbox.cObjectType,SNI.Community.Toolbox.cAssetUrl);
}
try{
renderMethods();
}catch(e){}
}
SNI.Community.Widgets.afterPost = function(request)
{
try{
document.getElementById('commentsshell').innerHTML=request.responseText;
}catch(e){}
try{
SNI.Community.Widgets.drawVotingWidgets();
}catch(e){}
if(document.getElementById('totcom'))
{
var count = document.getElementById('totcom').value;
//var counth2Text = document.getElementById('counth2').innerHTML;
var counth2Text = SNI.Community.Toolbox.cGlobalCounterText;
if(counth2Text.indexOf("(")!=-1)
counth2Text = counth2Text.substring(0,counth2Text.indexOf("("));
if(document.getElementById('counth2')){
if(parseInt(count)==1)
document.getElementById('counth2').innerHTML = counth2Text+" ("+count+" Comment)";
else
document.getElementById('counth2').innerHTML = counth2Text+" ("+count+" Comments)";
}
if(document.getElementById('comment_count_header')){
if(parseInt(count)==1)
document.getElementById('comment_count_header').innerHTML = counth2Text+" ("+count+" Comment)";
else
document.getElementById('comment_count_header').innerHTML = counth2Text+" ("+count+" Comments)";
}
}
}
SNI.Community.Widgets.reloadcomments = function(url)
{
SNI.Community.Widgets.DA(url,"SNI.Community.Widgets.afterPost(request)");
}
SNI.Community.Widgets.moveToPageInternal = function(val)
{
var url2 = "";
if(SNI.Community.Toolbox.ur){
url2 = SNI.Community.Toolbox.rootUrl+"/getcommentscommon.do?cpageno="+val+"&layout=internal&nonur=false&id="+SNI.Community.Toolbox.cSelectedId+"&wid="+SNI.Community.Toolbox.cWidInsId;
}else{
url2 = SNI.Community.Toolbox.rootUrl+"/getcommentscommon.do?cpageno="+val+"&layout=internalnonur&nonur=true&id="+SNI.Community.Toolbox.cSelectedId+"&wid="+SNI.Community.Toolbox.cWidInsId;
}
SNI.Community.Widgets.reloadcomments(url2);
return false;
}
SNI.Community.Widgets.postInternalComment = function()
{
if(SNI.Community.Toolbox.globalPostCommentStatus==false){
return;
}
if(document.getElementById("ispv")){
//isPVProject = true;
SNI.Community.Toolbox.cSelectedId = document.getElementById("gObjId").value;
}
var userInfo = "";
var userId = SNI.Community.Toolbox.cGlobalUserId;
var yournameVal = SNI.Community.Toolbox.cGlobalUserDisplayName;
var yourEmailVal = SNI.Community.Toolbox.cGlobalUserEmail;
var commenttext = document.getElementById("commenttext").value;
var nonurSiteId = SNI.Community.Toolbox.cSiteId;
var nonurWid = SNI.Community.Toolbox.cWidInsId;
var nonurCId = SNI.Community.Toolbox.cCollId;
var oc = document.getElementById("objCaption_h1").innerHTML;
var wpid = document.getElementById("wpid").value;
var channelName = SNI.Community.channelName;
if(SNI.Community.Widgets.Get_Cookie('AJAX_LOGIN_RESPONSE'))
{
userInfo = SNI.Community.Widgets.Get_Cookie('AJAX_LOGIN_RESPONSE').split("||");
if(userInfo.length>0){
userId = userInfo[0];
yourEmailVal = userInfo[1];
yournameVal = userInfo[2];
}
}else if(SNI.Community.Widgets.Get_Cookie('picklecookie')){
userInfo = SNI.Community.Widgets.Get_Cookie('picklecookie').split(",");
if(userInfo.length>0)
{
yournameVal = userInfo[6];
yourEmailVal = userInfo[1];
userId = userInfo[0];
}
}
if(SNI.Community.Widgets.trim(commenttext)!=''){
commenttext =encodeURIComponent(commenttext);
}else if(commenttext == ''){
alert("Please enter a comment.");
return;
}else if(document.getElementById('commenttext').value.length > 1000){
alert("Please limit comments to 1000 characters.");
return;
}
SNI.Community.Widgets.displayOn('com-post-comment-content02');
SNI.Community.Widgets.displayOff('com-post-comment-content');
SNI.Community.Widgets.displayOn('com-add-button-container02');
SNI.Community.Widgets.displayOff('com-add-button-container');
var request=SNI.Community.Toolbox.ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
var url= SNI.Community.Toolbox.rootUrl+"/postcomment.do";
var url2 = SNI.Community.Toolbox.rootUrl+"/getcommentscommon.do?page=1&layout=internal&nonur=false&id="+SNI.Community.Toolbox.cSelectedId+"&wid="+nonurWid;
//var reqParameters = "nonur=false&user_name="+escape(yournameVal)+"&user_email="+yourEmailVal+"&comment="+commenttext+"&object_id="+SNI.Community.Toolbox.cSelectedId+"&user_id="+userId+"&site_id="+nonurSiteId+"&wid="+nonurWid+"&collectionsId="+nonurCId+"&sourceurl="+escape(document.location)+"&oc="+oc+"&wpid="+wpid+"&channelName="+channelName;
var reqParameters = "nonur=false&user_name="+escape(yournameVal)+"&user_email="+yourEmailVal+"&comment="+commenttext+"&object_id="+SNI.Community.Toolbox.cSelectedId+"&site_id="+nonurSiteId+"&wid="+nonurWid+"&collectionsId="+nonurCId+"&sourceurl="+escape(document.location)+"&oc="+oc+"&wpid="+wpid+"&channelName="+channelName;
SNI.Community.Toolbox.globalPostCommentStatus = false;
request.onreadystatechange=function()
{
if(request.readyState==4)
{
if(request.status==200)
{
SNI.Community.Toolbox.globalPostCommentStatus=true;
SNI.Community.Widgets.reloadcomments(url2);
}else if(request.status==12152){
SNI.Community.Toolbox.globalPostCommentStatus=true;
SNI.Community.Widgets.reloadcomments(url2);
}
else if(request.status==500)
{
SNI.Community.Toolbox.globalPostCommentStatus=true;
alert("You found an opportunity for improvement! Please try again later");
}
else{
SNI.Community.Toolbox.globalPostCommentStatus=true;
SNI.Community.Widgets.reloadcomments(url2);
}
}
}
request.open("POST",url,true);
request.setRequestHeader("content-type","application/x-www-form-urlencoded");
request.send(reqParameters);
}
SNI.Community.Widgets.postInternalNonUrComment = function()
{
if(SNI.Community.Toolbox.globalPostCommentStatus==false){
return;
}
if(document.getElementById("ispv")){
//isPVProject = true;
SNI.Community.Toolbox.cSelectedId = document.getElementById("gObjId").value;
}
//1,nishant@one-i.net,0,null,null,Sys_Admin
var userInfo = "";
var userId = SNI.Community.Toolbox.cGlobalUserId;
var yournameVal = document.getElementById("commentYourName").value;
var yourEmailVal = document.getElementById("commentEmail").value;
var commenttext = document.getElementById("commenttext").value;
var emailCheck = SNI.Community.Widgets.isEmail(document.getElementById("commentEmail"));
if(commenttext!=''){
commenttext =encodeURIComponent(commenttext);
}
if(SNI.Community.Widgets.trim(commenttext) == ''){
alert("Please enter a comment.");
return;
}else if(document.getElementById('commenttext').value.length > 1000){
alert("Please limit comments to 1000 characters.");
return;
}else if(SNI.Community.Widgets.trim(yournameVal) == ''){
alert("Please enter your name.");
return;
}else if(SNI.Community.Widgets.trim(yourEmailVal) == ''){
alert("Please enter your e-mail address.");
return;
}else if(emailCheck==true){
alert("Please enter a valid e-mail address.");
return;
}
var nonurSiteId = SNI.Community.Toolbox.cSiteId;
var nonurWid = SNI.Community.Toolbox.cWidInsId;
var nonurCId = SNI.Community.Toolbox.cCollId;
var wpid = document.getElementById("wpid").value;
var request=SNI.Community.Toolbox.ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
var url= baseUrl + "postcommentnonur.do";
var url2 = SNI.Community.Toolbox.rootUrl+"/getcommentscommon.do?page=1&layout=internalnonur&nonur=true&id="+SNI.Community.Toolbox.cSelectedId+"&wid="+nonurWid;
var reqParameters = "nonur=true&user_name="+escape(yournameVal)+"&user_email="+yourEmailVal+"&comment="+commenttext+"&object_id="+SNI.Community.Toolbox.cSelectedId+"&user_id="+userId+"&site_id="+nonurSiteId+"&wid="+nonurWid+"&collectionsId="+nonurCId+"&sourceurl="+escape(document.location);
reqParameters += "&wpid="+wpid;
SNI.Community.Widgets.displayOn('com-noURpost-comment-content02');
SNI.Community.Widgets.displayOff('com-noURpost-comment-content');
SNI.Community.Widgets.displayOn('com-noUR-button-container02');
SNI.Community.Widgets.displayOff('com-noUR-button-container');
SNI.Community.Toolbox.globalPostCommentStatus = false;
request.onreadystatechange=function()
{
if(request.readyState==4)
{
SNI.Community.Toolbox.globalPostCommentStatus=true;
if(request.status==200)
{
SNI.Community.Widgets.reloadcomments(url2);
}else if(request.status==12152){
SNI.Community.Widgets.reloadcomments(url2);
}
else if(request.status==500)
{
alert("You found an opportunity for improvement! Please try again later");
}
else{
SNI.Community.Widgets.reloadcomments(url2);
}
}
}
request.open("POST",url,true);
request.setRequestHeader("content-type","application/x-www-form-urlencoded");
request.send(reqParameters);
}
SNI.Community.Widgets.cancelComment = function(){
SNI.Community.Toolbox.globalPostCommentStatus = true;
SNI.Community.Widgets.displayOn('pcw-pre-tab');
SNI.Community.Widgets.displayOff('pcw-pre-tab2');
SNI.Community.Widgets.displayOff('pcw-pre-loading');
}
SNI.Community.Toolbox.postExternalComment = function()
{
if(SNI.Community.Toolbox.globalPostCommentStatus==false){
return;
}
//1,nishant@one-i.net,0,null,null,Sys_Admin
var userInfo = "";
var userId = SNI.Community.Toolbox.cGlobalUserId;
var yournameVal = SNI.Community.Toolbox.cGlobalUserDisplayName;
var yourEmailVal = SNI.Community.Toolbox.cGlobalUserEmail;
var commenttext = document.getElementById("commenttext").value;
var commentcaption = document.getElementById("commentcaption").value;
var nonurSiteId = SNI.Community.Toolbox.cSiteId;
var nonurWid = SNI.Community.Toolbox.cWidInsId;
var nonurCId = SNI.Community.Toolbox.cCollId;
var wpid = SNI.Community.Toolbox.cGlobalOrigWidgetProjectId;
SNI.Community.Widgets.changeBack('headline');
SNI.Community.Widgets.changeBack('comment');
SNI.Community.Widgets.displayOff('deletediv');
document.getElementById('E_message').innerHTML = "";
if(SNI.Community.Widgets.Get_Cookie('AJAX_LOGIN_RESPONSE'))
{
userInfo = SNI.Community.Widgets.Get_Cookie('AJAX_LOGIN_RESPONSE').split("||");
if(userInfo.length>0){
userId = userInfo[0];
yourEmailVal = userInfo[1];
yournameVal = userInfo[2];
}
}else if(SNI.Community.Widgets.Get_Cookie('picklecookie')){
userInfo = SNI.Community.Widgets.Get_Cookie('picklecookie').split(",");
if(userInfo.length>0)
{
yournameVal = userInfo[6];
yourEmailVal = userInfo[1];
userId = userInfo[0];
}
}
if(SNI.Community.Widgets.trim(commenttext)!=''){
commenttext =encodeURIComponent(commenttext);
}
if(SNI.Community.Widgets.trim(commentcaption)!=''){
commentcaption =encodeURIComponent(commentcaption);
}
document.getElementById('E_message').innerHTML = "";
SNI.Community.Widgets.displayOff('deletediv');
if(SNI.Community.Widgets.trim(commentcaption) == ''){
SNI.Community.Widgets.displayOn('deletediv');
SNI.Community.Widgets.changeText('headline');
document.getElementById('E_message').innerHTML = "Please enter a headline.";
return;
}else if(commentcaption.length > 255){
document.getElementById('E_message').innerHTML = "Please limit headline to 255 characters.";
SNI.Community.Widgets.displayOn('deletediv');
SNI.Community.Widgets.changeText('headline');
return;
}
if(SNI.Community.Widgets.trim(commenttext) == ''){
document.getElementById('E_message').innerHTML = "Please enter a comment.";
SNI.Community.Widgets.displayOn('deletediv');
SNI.Community.Widgets.changeText('comment');
return;
}else if(document.getElementById('commenttext').value.length > 1000){
document.getElementById('E_message').innerHTML = "Please limit comments to 1000 characters.";
SNI.Community.Widgets.displayOn('deletediv');
SNI.Community.Widgets.changeText('comment');
return;
}
SNI.Community.Widgets.displayOff('pcw-pre-tab');
SNI.Community.Widgets.displayOn('pcw-pre-tab2');
SNI.Community.Widgets.displayOn('pcw-pre-loading');
var request=SNI.Community.Toolbox.ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
var url= SNI.Community.Toolbox.subPath + "/postcomment.do";
var url2 = SNI.Community.Toolbox.subPath + "/getcommentscommon.do?page=1&layout=external&nonur=false&id="+SNI.Community.Toolbox.cSelectedId+"&wid="+nonurWid+"&clientUrl="+escape(SNI.Community.Toolbox.cClientUrl)+"&assetId="+SNI.Community.Toolbox.cAssetId;
var reqParameters = "nonur=false&user_name="+escape(yournameVal)+"&user_email="+yourEmailVal+"&comment="+commenttext+"&object_id="+SNI.Community.Toolbox.cSelectedId+"&user_id="+userId+"&site_id="+nonurSiteId+"&wid="+nonurWid+"&collectionsId="+nonurCId+"&sourceurl="+escape(document.location)+"&wpid="+wpid;
reqParameters += "&commentcaption="+commentcaption;
SNI.Community.Toolbox.globalPostCommentStatus = false;
request.onreadystatechange=function()
{
if(request.readyState==4)
{
SNI.Community.Widgets.displayOn('pcw-pre-tab');
SNI.Community.Widgets.displayOff('pcw-pre-tab2');
SNI.Community.Widgets.displayOff('pcw-pre-loading');
if(request.status==200)
{
SNI.Community.Toolbox.globalPostCommentStatus=true;
SNI.Community.Widgets.reloadcomments(url2);
}else if(request.status==12152){
SNI.Community.Widgets.reloadcomments(url2);
}
else if(request.status==500)
{
SNI.Community.Toolbox.globalPostCommentStatus=true;
alert("You found an opportunity for improvement! Please try again later");
}
else{
SNI.Community.Toolbox.globalPostCommentStatus=true;
SNI.Community.Widgets.reloadcomments(url2);
}
}
}
request.open("POST",url,true);
request.setRequestHeader("content-type","application/x-www-form-urlencoded");
request.send(reqParameters);
}
SNI.Community.Toolbox.checkandshow = function()
{
secureComponent("SNI.Community.Widgets.displayOn('com-add-comment'); SNI.Community.Widgets.layerOff('cgp-id-comment-ad');","You Need To Be SIgned In To Do That.","cgp-id-comment-ad",5);
}
SNI.Community.Toolbox.doComment = function(curObj){
var result = secureComponent("","You Need To Be SIgned In To Do That.",curObj,5);
if(result == "found"){
SNI.Community.Widgets.showCommentsPopUp_cp();
}
}
SNI.Community.Toolbox.doCommentsFlag = function(objId,curObj){
SNI.Community.Toolbox.flagTmpDiv = objId;
SNI.Community.Widgets.temp1 = objId;
var result = secureComponent("","You Need To Be SIgned In To Do That.",curObj,7);
if(result == "found"){
SNI.Community.Widgets.flagComment();
}
}
SNI.Community.Widgets.flagCommentNoUr = function(cmtId)
{
SNI.Community.Toolbox.flagTmpDiv = cmtId;
SNI.Community.Widgets.temp1 = cmtId;
SNI.Community.Widgets.displayOn('cgp-flyout-'+cmtId);
document.getElementById("comment_flag_reason_error_"+cmtId).innerHTML = "";
SNI.Community.Widgets.displayOff("comment_flag_reason_error_"+cmtId);
}
SNI.Community.Widgets.flagComment = function()
{
SNI.Community.Widgets.displayOn('cgp-flyout-'+SNI.Community.Toolbox.flagTmpDiv);
document.getElementById("comment_flag_reason_error_"+SNI.Community.Toolbox.flagTmpDiv).innerHTML = "";
SNI.Community.Widgets.displayOff("comment_flag_reason_error_"+SNI.Community.Toolbox.flagTmpDiv);
}
SNI.Community.Widgets.flagAsInappropriate = function(id,flagType,obj,commentsId)
{
var flagReason = "";
var request=SNI.Community.Toolbox.ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
var comments = "";
var caption = "";
var uploadBy = "";
var description = "";
var uploadbyurl = "";
var modId = id;
var d2cLink = window.location.href;
d2cLink = d2cLink.replace(/#/g, "");
var sendalertemailValue=document.getElementById("sendalertemailextCommentValue").value;
var deactivateItemValue=document.getElementById("deactivateextCommentValue").value;
var sendalertemailthreshold=document.getElementById("sendalertemailextCommentthreshold").value;
var deactivateItemthreshold=document.getElementById("deactivateextCommentthreshold").value;
if(document.getElementById("comment_flag_reason_"+SNI.Community.Toolbox.flagTmpDiv)){
flagReason = document.getElementById("comment_flag_reason_"+SNI.Community.Toolbox.flagTmpDiv).value;
}
if(trim(flagReason) == ""){
SNI.Community.Widgets.displayOn("comment_flag_reason_error_"+SNI.Community.Toolbox.flagTmpDiv);
document.getElementById("comment_flag_reason_error_"+SNI.Community.Toolbox.flagTmpDiv).innerHTML = "You must provide a reason for flagging this comment.";
return;
}else{
SNI.Community.Widgets.displayOff('cgp-flyout-'+SNI.Community.Toolbox.flagTmpDiv);
}
//d2cLink += "&cObjId="+SNI.Community.Toolbox.cSelectedId;
if(commentsId!='null'){
comments = document.getElementById(commentsId).innerHTML;
comments = comments.replace('
','');
comments = comments.replace('
','');
}
var url= SNI.Community.Toolbox.subPath + "/flagasinappropriate.do";
var params = "id="+id+"&obj_type="+flagType;
params += "&d2c_link="+escape(d2cLink);
params += "&moderationurl="+escape(""+SNI.Community.Toolbox.cAdminRootUrl+"/moderation.do?oid="+id+"&statusId=1&objectType=pva&flag="+flagType+"&pid="+SNI.Community.Toolbox.cAssetId+"&ht="+SNI.Community.Toolbox.cSelectedId);
params += "&inappropriateurl="+escape(SNI.Community.Toolbox.cAdminRootUrl+"/loadCMS.do?cmsId="+SNI.Community.Toolbox.cSelectedId+"&assetid="+SNI.Community.Toolbox.cAssetId);
params += "&comments="+escape(comments)+"&caption="+escape(SNI.Community.Toolbox.cAssetTitle);
params += "&sendalertemailValue="+escape(sendalertemailValue);
params += "&deactivateItemValue="+escape(deactivateItemValue);
params += "&sendalertemailthreshold="+escape(sendalertemailthreshold);
params += "&deactivateItemthreshold="+escape(deactivateItemthreshold);
params += "&reason="+escape(flagReason);
request.onreadystatechange=function()
{
if(request.readyState==4)
{
if(request.status==200 ||request.status==12152)
{
obj = document.getElementById(obj);
SNI.Community.Widgets.setPickleCookie("pickle_comments_inapp",id);
obj.parentNode.innerHTML = " Flagged";
}
else if(request.status==500){
alert("You found an opportunity for improvement! Please try again later");
}
else{
alert("There appears to be a connectivity problem. Please check your internet connection and try again.");
}
}
}
request.open("POST",url,true);
request.setRequestHeader("content-type","application/x-www-form-urlencoded");
request.setRequestHeader("Content-length", params.length);
request.send(params);
}
SNI.Community.Toolbox.onCommenting = function()
{
document.getElementById('pcw-ttop').style.display = 'block';
document.getElementById('c-comment-up').id = "c-comment-down";
document.getElementById('c-comment-down').onclick = new Function("SNI.Community.Toolbox.offCommenting()");
}
SNI.Community.Toolbox.offCommenting = function()
{
document.getElementById('pcw-ttop').style.display = 'none';
document.getElementById('c-comment-down').id = "c-comment-up";
document.getElementById('c-comment-up').onclick = new Function("SNI.Community.Toolbox.onCommenting()");
}