1/** 2 * 3 * 구매íê° ì ë¡ë 4 * 5 * @date 2012-10-22 6 * @author ì ë³ì° 7 * @type {Object} 8 **/ 9var Opinion = { 10 /** 11 * 문ìë²í¸ 12 * @type {number|string} 13 */ 14 docSeq: '', 15 /** 16 * íê° ë²í¸ 17 * @type {number|string} 18 */ 19 docOpinionSeq: '', 20 /** 21 * íê°ëµë³ë²í¸ 22 * @type {number|string} 23 */ 24 docOpinionAnswerSeq: '', 25 /** 26 * íì´ì§ ë²í¸ 27 * @type {number} 28 */ 29 page: 1, 30 /** 31 * 리í´íì 32 * @type {string} 33 */ 34 returnType: '', 35 /** 36 * íê° ì ì를 ë³ê²½íë ê²½ì° ì ë ¥ ë´ì© íì¸ 37 * @param newPoint 38 * @returns {boolean} 39 */ 40 oldPoint: 10, // í´ë¦ ì íê° ì ì 41 changePoint: function(newPoint){ 42 var pointList = { 43 'point10': 'ìµê³ ìì! ì ë§ ë§ì¡±í©ëë¤.', 44 'point8': 'ì¢ìì! ë§ì ëìì´ ë§ì´ ëììµëë¤.', 45 'point6': 'ê´ì°®ìì! ê´ì°®ì ìë£ì ëë¤.', 46 'point4': 'ìì¬ìì! ëìì ë°ìì§ë§ ë¤ì ìì½ìµëë¤.', 47 'point2': 'ë³ë¡ìì! ë§ì ëìì´ ëì§ ìììµëë¤.' 48 }; 49 50 var $form = $('form[name="frm_opinion_insert"]'); 51 if(newPoint != Opinion.oldPoint) { // ì ê· ê°ì´ íì¬ ì íë ê°ê³¼ ë¬ë¼ì§ë ê²½ì°.. 52 var currentContents = $form.find('#contents').val(); 53 if(currentContents.length > 0) { 54 if (pointList['point' + Opinion.oldPoint] != currentContents) { // 기본ê°ê³¼ ë¤ë¥¸ ê²½ì°.. 55 if (!confirm("ì ë ¥ë ë´ì©ì´ ìì ë©ëë¤.\në³ê²½íìê² ìµëê¹?")) { 56 return false; 57 } 58 } 59 $form.find('#contents').val(pointList['point' + newPoint]); 60 return true; 61 } 62 } 63 return true; 64 }, 65 /** 66 * 구매íê° ë±ë¡ 67 */ 68 submitOpinion: function() 69 { 70 var that = Opinion; 71 72 //set vars: html element 73 var $obj = $('form[name="frm_opinion_insert"]'); 74 75 //set vars: form params 76 that.docSeq = $obj.find('input[name="docSeq"]').val(); 77 var writeCheck = $obj.find('input[name="writeCheck"]').val(); 78 var contents = $.trim($obj.find('textarea[name="contents"]').val()); 79 var totalPoint = $obj.find('input[name=totalPoint]:checked').val(); 80 if($('input[name=returnType]').length > 0) this.returnType = $('input[name=returnType]').val(); 81 82 if(contents == "" || writeCheck == 0) { 83 alert("ìì±ë ë´ì©ì´ ììµëë¤.\në´ì©ì ì ë ¥í´ì£¼ì¸ì."); 84 return false; 85 } 86 if(totalPoint == "") { 87 alert("ìë£í기 ì ì를 ì íí´ ì£¼ì¸ì."); 88 return false; 89 } 90 91 $.ajax({ 92 type:'POST', 93 dataType: 'json', 94 url:'/docOpinion/insert', 95 async:false, 96 data: { 97 "docSeq": that.docSeq, 98 "contents": contents, 99 "writeCheck": writeCheck, 100 "editPoint": totalPoint, 101 "qualityPoint": totalPoint, 102 "pricePoint": totalPoint, 103 "returnType": that.returnType 104 }, 105 /** 106 * @param {{error: {code: number, msg: string}, data: string, point: string, pointStr: string, point: number, count: number, issueTicketType: string}} json 107 * @return {boolean} 108 */ 109 success:function(json){ 110 if (json == null) return false; 111 if(json.error.code) { 112 alert(json.error.msg); 113 return false; 114 } 115 116 var alertMsg; 117 if (json.issueTicketType == 'DOC_OPINION') { 118 alertMsg = "<span class='f_txt' style='font-size:14px; margin-bottom: 25px; letter-spacing:-0.5px'>" + 119 " 룰ë ì´ë²¤í¸ ìëª¨ê¶ 1ì¥ì´ ì§ê¸ëììµëë¤.<br>" + 120 " ìë£í기를 ìì±í´ 주ì ì ê°ì¬í©ëë¤." + 121 "</span>"; 122 } else if (json.issueTicketType == 'DOC_OPINION2') { 123 alertMsg = "<span class='f_txt' style='font-size:14px; margin-bottom: 25px; letter-spacing:-0.5px'>" + 124 " 룰ë ì´ë²¤í¸ ìëª¨ê¶ 2ì¥ì´ ì§ê¸ëììµëë¤.<br>" + 125 " ìë£í기를 ìì±í´ 주ì ì ê°ì¬í©ëë¤." + 126 "</span>"; 127 } else { 128 alertMsg = "<div style='font-size: 12px;padding: 0 10px;'>ìë£í기 ë±ë¡ì´ ìë£ëììµëë¤.</div>"; 129 } 130 131 Common.closeLayerBox('buyOpinionDiv'); 132 $('#opinionListFilterBox').show(); 133 Common.divAlert(alertMsg, 300, 250, '', 'reload'); 134 }, 135 error: function(xhr, status, error) { 136 Common.ajaxErrorProcess(xhr, status, error); 137 } 138 }); 139 }, 140 /** 141 * ìê²¬ê¸ ì²´í¬ 142 */ 143 checkWrite: function() 144 { 145 if($("#writeCheck").val()==0) 146 { 147 $("#contents").html(""); 148 $('#contents').css({'font-size':'','color':''}); 149 $("#writeCheck").val(1); 150 } 151 }, 152 /** 153 * ìì í¼ ë¡ë© 154 * @param {number|string} docOpinionSeq 155 * @param {number|string} page 156 * @param {string} target 157 */ 158 loadDeleteForm: function(docOpinionSeq, page, target) { 159 this.docOpinionSeq = docOpinionSeq; 160 this.page = page; 161 this.returnType = target; 162
163 Common.openWindow('/docOpinion/loadDeleteForm?docSeq='+this.docSeq+"&docOpinionSeq="+docOpinionSeq+'&returnType='+this.returnType + '&page=' + this.page, 300, 170, 'opinionDelete'); 164 }, 165 /** 166 * ìì ìì² í¼ ë¡ë© (íì ) 167 * @param {number|string} docSeq 168 * @param {number|string} page 169 * @param {number|string} docOpinionSeq 170 * @param {string} target 171 * @param {string} [requestConfirm] 172 */ 173 loadDeleteRequestLayerForm: function(docSeq, page, docOpinionSeq, target, requestConfirm) { 174 this.docSeq = docSeq; 175 this.page = page; 176 this.docOpinionSeq = docOpinionSeq; 177 this.returnType = target; 178 179 var param = 'docSeq='+ docSeq +'&docOpinionSeq='+docOpinionSeq+'&page='+page+'&returnType=' + target + '&requestConfirm='+((requestConfirm) ? requestConfirm : 'no'); 180 181 $.get('/docOpinion/loadDeleteRequestLayerForm', param, function(data) { 182 Common.openLayerBox("div_opinionDeleteRequest", data, ((Common.isUrlMobileMode()) ? 300 : 460), 238, 'opinionDeleteRequestButton' + docOpinionSeq, true, 'left'); 183 }); 184 }, 185 186 /** 187 * ìì ì²ë¦¬ 188 */ 189 erase: function() { 190 if($('input[name=returnType]').length>0) this.returnType=$('input[name=returnType]').val(); 191 if($('input[name=docSeq]').length>0) this.docSeq=$('input[name=docSeq]').val(); 192 if($('input[name=page]').length>0) this.page=$('input[name=page]').val(); 193 if($('input[name=docOpinionSeq]').length>0) this.docOpinionSeq=$('input[name=docOpinionSeq]').val(); 194 195 var that = Opinion; 196 var param = { 197 docSeq: that.docSeq, 198 docOpinionSeq: that.docOpinionSeq, 199 returnType: that.returnType 200 }; 201 202 $.ajax({ 203 type:'POST', 204 dataType: 'json', 205 url:'/docOpinion/delete/', 206 async:false, 207 data: param, 208 success:function(json) { 209 if(json != null) { 210 if(json.error.code) { 211 alert(json.error.msg); 212 } 213 else { 214 if(that.returnType == 'view') { 215 window.close(); 216 opener.location.reload(); 217 } else { 218 document.location.reload(); 219 } 220 } 221 } 222 }, 223 error: function(xhr, status, error) { 224 Common.ajaxErrorProcess(xhr, status, error); 225 } 226 }); 227 }, 228 /** 229 * ëµë³ ìì ìì² í¼ ë¡ë© 230 * @deprecated 231 * @param {number|string} docOpinionSeq 232 * @param {number|string} page 233 * @param {number|string} docOpinionAnswerSeq 234 * @param {string} target 235 */ 236 loadAnswerForm: function(docOpinionSeq, page, docOpinionAnswerSeq, target) { 237 this.docOpinionSeq = docOpinionSeq; 238 this.returnType = target; 239 jQuery("a[name=opinionAnswerButton]").show(); 240 jQuery("a[name=opinionAnswerCancelButton]").hide(); 241 $.get('/docOpinion/loadAnswerForm', 'docSeq='+this.docSeq+"&docOpinionSeq="+docOpinionSeq+"&docOpinionAnswerSeq="+docOpinionAnswerSeq+"&kind=Update", function(data) { 242 if(data == "ParamError") { 243 alert("ëµë³ì ë³´ê° ì ì¡ëì§ ìììµëë¤."); 244 } 245 else if(data == "LoginError") { 246 alert("ë¡ê·¸ì¸ í ì´ì©íì¸ì."); 247 } 248 else if(data == "AuthError") { 249 alert("ê¶íì´ ììµëë¤."); 250 } 251 else { 252 jQuery("#opinionAnswerButton"+docOpinionSeq).hide(); 253 jQuery("#opinionAnswerCancelButton"+docOpinionSeq).show(); 254 } 255 $("#div_opinion_answer").remove(); 256 $("<div id='div_opinion_answer' class='clear'></div>").html(data).appendTo($("#data_list_view_"+ docOpinionSeq + "" + docOpinionAnswerSeq)); 257 }); 258 }, 259 /** 260 * ë²í¼ ì¤íì¼ ë¦¬ì 261 * @deprecated 262 */ 263 removeAnswerDiv: function(docOpinionSeq) { 264 $("#opinionAnswerCancelButton"+docOpinionSeq).hide(); 265 $("#opinionAnswerButton"+docOpinionSeq).show(); 266 $("#div_opinion_answer").remove(); 267 }, 268 /** 269 * ìì ìì² ì²ë¦¬ (íì ) 270 */ 271 deleteRequestLayer: function() { 272 var $obj = $('form[name="frm_opinion_delete_request"]'); 273 274 var that = Opinion; 275 that.docSeq = $obj.find('input[name="docSeq"]').val(); 276 that.docOpinionSeq = $obj.find('input[name="docOpinionSeq"]').val(); 277 var contents = $obj.find('textarea[name="contents"]').val(); 278 if($('input[name="returnType"]').length > 0) that.returnType = $obj.find('input[name="returnType"]').val(); 279 280 if(contents == '') { 281 alert("ìì ì¬ì 를 ì ë ¥íì¸ì"); 282 return; 283 } 284 285 $.ajax({ 286 type:'POST', 287 dataType: 'json', 288 url: '/docOpinion/deleteRequest', 289 async:false, 290 data: { 291 docSeq: that.docSeq, 292 docOpinionSeq: that.docOpinionSeq, 293 contents: contents, 294 page: that.page, 295 returnType: that.returnType 296 }, 297 success:function(json) { 298 if(json != null) { 299 if(json.error.code) { 300 alert(json.error.msg); 301 } 302 else { 303 Common.removeLayer("div_opinionDeleteRequest"); 304 305 if(that.returnType == 'mypage') { 306 location.reload(); 307 } 308 else if(that.returnType == 'view'){ 309 that.DocDetail.list(that.docSeq, that.page, false); 310 } 311 else { 312 location.reload(); 313 } 314 } 315 } 316 }, 317 error: function(xhr, status, error) { 318 Common.ajaxErrorProcess(xhr, status, error); 319 } 320 }); 321 }, 322 /** 323 * ëµë³ ë±ë¡/ìì 324 */ 325 answerInsert: function() { 326 var obj = null; 327 if($("#returnType").length > 0 && $("#returnType").val() == 'mypage') 328 obj = document.forms[arguments[0]]; 329 else 330 obj = document.frm_opinionAnswer; 331 332 var contents = obj.contents.value; 333 var docSeq = obj.docSeq.value; 334 var docOpinionSeq = obj.docOpinionSeq.value; 335 var docOpinionAnswerSeq = obj.docOpinionAnswerSeq.value; 336 var kind = obj.kind.value; 337 this.returnType = $("#returnType").val(); 338 339 if(contents == '') { 340 alert("ëµë³ì ì ë ¥íì¸ì"); 341 return; 342 } 343 344 // var param = "docSeq="+docSeq+"&docOpinionSeq="+docOpinionSeq+"&docOpinionAnswerSeq="+docOpinionAnswerSeq+"&kind="+kind+"&contents="+contents+"&returnType="+this.returnType; 345 var param = { 346 docSeq : docSeq, 347 docOpinionSeq : docOpinionSeq, 348 docOpinionAnswerSeq : docOpinionAnswerSeq, 349 kind : kind, 350 contents : contents, 351 returnType : this.returnType 352 }; 353 $.ajax({ 354 type:'POST', 355 dataType: 'json', 356 url: '/docOpinion/answerProcess', 357 async:false, 358 data: param, 359 success:function(json) { 360 if(json != null) { 361 if(json.error.code) { 362 alert(json.error.msg); 363 } 364 else { 365 if(Opinion.returnType == 'mypage' || Opinion.returnType == 'view') 366 location.reload(); 367 else 368 Opinion.opinionLoad(docSeq, Opinion.page); 369 } 370 } 371 }, 372 error: function(xhr, status, error) { 373 Common.ajaxErrorProcess(xhr, status, error); 374 } 375 }); 376 377 }, 378 /** 379 * ìì í¼ ë¡ë© 380 * @deprecated 381 */ 382 loadAnswerDeleteForm: function(docSeq, docOpinionSeq, page, docOpinionAnswerSeq, target) { 383 this.docOpinionSeq = docOpinionSeq; 384 this.page = page; 385 this.returnType = target; 386 Common.openWindow('/docOpinion/loadAnswerDeleteForm?docSeq='+docSeq+"&docOpinionSeq="+docOpinionSeq+"&docOpinionAnswerSeq="+docOpinionAnswerSeq+"&page="+page+"&returnType="+this.returnType, 350, 180, 'opinionAnswerDeleteForm'); 387 }, 388 loadAnswerDeleteRequestLayerForm: function(docSeq, docOpinionSeq, page, docOpinionAnswerSeq, target){ 389 this.docOpinionSeq = docOpinionSeq; 390 this.page = page; 391 this.returnType = target; 392 393 if($('#div_opinionAnswerDeleteRequest').length > 0){ 394 $('#div_opinionAnswerDeleteRequest').remove(); 395 } 396 397 var param = "docOpinionSeq="+docOpinionSeq; 398 399 $.ajax({ 400 type: 'POST', 401 dataType: 'json', 402 url: '/docOpinion/getDocOpinionDelRequest', 403 async: false, 404 data: param, 405 success: function (json) { 406 if(json.result == 'true'){ 407 var popupHtml = '<div class="popupFrame" style="border:1px solid #242d43;"><h1><img src="/images/document/2013/popup_t_seller_del.gif" alt="í매ì ëµë³ ìì "/></h1>' + 408 '<span class="p_logo"><img src="/images/document/2013/popup_logo.gif" alt="HappyCampus"/></span>' + 409 '<div class="containerPopup"><form name="frm_delete_opinion_answer"><input type="hidden" name="returnType" id="returnType" value="' + target + '">' + 410 '<input type="hidden" name="docSeq" id="docSeq" value="' + docSeq + '"><input type="hidden" name="docOpinionAnswerSeq" value="' + docOpinionAnswerSeq + '">' + 411 '<input type="hidden" name="docOpinionSeq" value="' + docOpinionSeq + '"><input type="hidden" name="page" id="page" value="' + page + '"></form>' + 412 '<p class="p_top10">ìë£í기 ìì ìì² ì¤ìë ëµë³ ìì ê° ë¶ê°ë¥í©ëë¤.</p></div>' + 413 '<div class="cBtns"><img src="/images/document/2013/btn_p_confirm.gif" alt="íì¸" onclick="Common.closeLayerBox();return false;" style="cursor:pointer;" /> ' + 414 '</div></div>'; 415 }else{ 416 var popupHtml = '<div class="popupFrame" style="border:1px solid #242d43;"><h1><img src="/images/document/2013/popup_t_seller_del.gif" alt="í매ì ëµë³ ìì "/></h1>' + 417 '<span class="p_logo"><img src="/images/document/2013/popup_logo.gif" alt="HappyCampus"/></span>' + 418 '<div class="containerPopup"><form name="frm_delete_opinion_answer"><input type="hidden" name="returnType" id="returnType" value="' + target + '">' + 419 '<input type="hidden" name="docSeq" id="docSeq" value="' + docSeq + '"><input type="hidden" name="docOpinionAnswerSeq" value="' + docOpinionAnswerSeq + '">' + 420 '<input type="hidden" name="docOpinionSeq" value="' + docOpinionSeq + '"><input type="hidden" name="page" id="page" value="' + page + '"></form>' +
421 '<p class="p_txt11 p_top10">ëµë³ì <strong>ìì </strong>íìê² ìµëê¹?</p></div>' + 422 '<div class="cBtns"><img src="/images/document/2013/btn_p_confirm.gif" alt="íì¸" onclick="Opinion.answerDelete();" style="cursor:pointer;" /> ' + 423 '<img src="/images/document/2013/btn_p_cancel.gif" alt="ì·¨ì" onclick="Common.closeLayerBox();return false;" style="cursor:pointer;"/></div></div>'; 424 } 425 426 Common.openLayerBox("div_opinionAnswerDeleteRequest", popupHtml, ((Common.isUrlMobileMode()) ? 300 : 460), 167, 'opinionAnswerDeleteRequestButton' + docOpinionAnswerSeq, true, 'right'); 427 } 428 }); 429 430 431 432 433 }, 434 /** 435 * ëµë³ ìì ì²ë¦¬ 436 */ 437 answerDelete: function() { 438 var that = Opinion; 439 var obj = document.frm_delete_opinion_answer; 440 if(jQuery('input[name=returnType]').length>0) this.returnType=jQuery('input[name=returnType]').val(); 441 var docSeq = obj.docSeq.value; 442 var docOpinionSeq = obj.docOpinionSeq.value; 443 var docOpinionAnswerSeq = obj.docOpinionAnswerSeq.value; 444 445 var param = "docSeq="+docSeq+"&docOpinionSeq="+docOpinionSeq+"&docOpinionAnswerSeq="+docOpinionAnswerSeq+"&kind=Delete"+"&returnType="+that.returnType; 446 447 $.ajax({ 448 type:'POST', 449 dataType: 'json', 450 url: '/docOpinion/answerProcess', 451 async:false, 452 data: param, 453 success:function(json) { 454 if(json != null) { 455 if(json.error.code) { 456 alert(json.error.msg); 457 } 458 else { 459 if(that.returnType == 'mypage' || that.returnType == 'view') { 460 location.reload(); 461 } 462 else { 463 /* 464 Common.removeLayer("data_list_view_"+ docOpinionSeq + "" + docOpinionAnswerSeq); 465 Common.removeLayer("dot_line_"+ docOpinionSeq + "" + docOpinionAnswerSeq); 466 */ 467 $(opener.location).attr("href", "javascript:location.reload();"); 468 window.close(); 469 } 470 Common.removeLayer('div_opinionAnswerDeleteForm'); 471 } 472 } 473 }, 474 error: function(xhr, status, error) { 475 Common.ajaxErrorProcess(xhr, status, error); 476 } 477 }); 478 479 }, 480 /** 481 * ë ì´ì´ í ê¸ 482 * @param {string} layerId 483 */ 484 toggleLayer: function(layerId) { 485 $("#"+layerId).toggle(); 486 }, 487 /** 488 * ëì íê° ë³´ê¸° 489 * @param {number} boughtDocSeq 490 * @param {number} docOpinionSeq 491 * @param {string} [from] 492 */ 493 viewMyOpinion: function(boughtDocSeq, docOpinionSeq, from){ 494 //from ê°ì ë°ë¼ ì²ë¦¬ ë¶ë¦¬ 495 var checkNewAnswer = false; 496 if (from == 'docOpinionList') { 497 Opinion.toggleLayer('opinionView' + boughtDocSeq + '_' + docOpinionSeq); 498 Opinion.toggleLayer('opinionAnswerView' + boughtDocSeq + '_' + docOpinionSeq); 499 if ($('#opinionNewAnswer' + docOpinionSeq).length > 0 && $('#opinionNewAnswer' + docOpinionSeq).val() == 'y') { 500 checkNewAnswer = true; 501 } 502 } else { 503 Opinion.toggleLayer('opinionView' + boughtDocSeq); 504 Opinion.toggleLayer('opinionAnswerView' + boughtDocSeq); 505 if ($('#newIcon' + docOpinionSeq).length > 0) { 506 checkNewAnswer = true; 507 } 508 } 509 510 if(checkNewAnswer) { 511 $.ajax({ 512 url: '/docOpinion/setReadOpinionAnswer/', 513 type: "POST", 514 dataType: 'json', 515 data: { 516 docOpinionSeq: docOpinionSeq 517 }, 518 success: function (json) { 519 if (json.errorMsg == 'success') { 520 $('#newIcon' + docOpinionSeq).remove(); 521 } 522 }, 523 error: function (xhr, status, error) { 524 Common.ajaxErrorProcess(xhr, status, error); 525 } 526 }); 527 } 528 }, 529 /** 530 * íê° ê°ë¥í ìíì¸ì§ ì²´í¬ 531 * @param {number} docSeq ìë£ë²í¸ 532 * @return {null|{result: boolean, description: string}} 533 */ 534 checkBuyDownloadCheck: function (docSeq) { 535 var returnVar = null; 536 537 $.ajax({ 538 url: '/mypage/buyDownloadCheck', 539 method: 'post', 540 data: {docSeq: docSeq}, 541 dataType: 'json', 542 async: false, 543 cache: false, 544 success: function (result) { 545 returnVar = result; 546 } 547 }); 548 549 return returnVar; 550 }, 551 /** 552 * ìë£ íê° form ë ì´ì´ íì ë ¸ì¶ 553 * @param {number|string} docSeq ìë£ ë²í¸ 554 * @param {boolean} [noAlertMsg] 555 * @param {string} type ë¶ë¬ì¤ë íì´ì§ 556 */ 557 showOpinionForm: function (docSeq, noAlertMsg,type) { 558 if (typeof noAlertMsg == 'undefined') noAlertMsg = false;
559 560 var check = this.checkBuyDownloadCheck(docSeq); 561 562 if (check.result == true) { 563 $.ajax({ 564 url: '/mypage/buyOpinion', 565 type: 'get', 566 dataType: 'json', 567 data: {docSeq: docSeq, type: type}, 568 success: function (response) { 569 if (response.result == false) { 570 alert(response.description); 571 return false; 572 } 573 574 Common.openLayerBox("buyOpinionDiv", response.data.html, 488, 800, '', false); 575 } 576 }); 577 } else { 578 // alert ë©ìì§ ì¶ë ¥ ì¬ë¶ ì¤ì 579 if( noAlertMsg != true ){ 580 alert( check.description ); 581 } 582 } 583 }, 584 /** 585 * ìë£ ìì¸ ì ì© ì½ë 586 * @type {Object} 587 */ 588 DocDetail: { 589 /** 590 * í´ëí° ì¸ì¦ íì ê²ë§ ë³¼ì§ ì¬ë¶ 591 * @type {boolean} 592 */ 593 filterMemberAuthPhone: false, 594 /** 595 * 구매íê° ë¦¬ì¤í¸ ì¶ë ¥ 596 * @param {number} docSeq ìë£ ë²í¸ 597 * @param {number|string} page íì´ì§ ë²í¸ 598 * @param {boolean} [isAppend] ì´ë¯¸ ì¡´ì¬íë 구매íê° ë¦¬ì¤í¸ì ì¶ê°í ì§ ì¬ë¶ 599 * @return {boolean} 600 */ 601 list: function (docSeq, page, isAppend) { 602 var _that = Opinion; 603 604 _that.docSeq = docSeq; 605 if (typeof _that.docSeq == 'undefined' || _that.docSeq == '' || _that.docSeq == 0) return false; 606 _that.page = (typeof page == 'undefined' || isNaN(parseInt(page))) ? 1 : parseInt(page); 607 608 $.ajax({ 609 url: '/docOpinion/list/', 610 type: 'get', 611 method: 'get', 612 dataType: 'json', 613 data: { 614 docSeq: _that.docSeq, 615 page: _that.page, 616 idBlind: 'y', 617 limit: 3, 618 memberAuthPhone: (_that.DocDetail.filterMemberAuthPhone == true ? 'y' : 'n') 619 }, 620 success: function (json) { 621 if (json == null) return false; 622 if (json.error.code) { 623 alert(json.error.msg); 624 return false; 625 } 626 627 //set vars: html element 628 var _$opinionArea = $('#docOpinionArea'); 629 if (!_$opinionArea.length) return false; 630 var _$opinionCount = _$opinionArea.find('#docOpinionCount'); 631 var _$opinionList = _$opinionArea.find('#docOpinionList'); 632 var _$btnMore = _$opinionArea.find('#btnDocOpinionMore'); 633 if (!_$opinionCount.length || !_$opinionList.length || !_$btnMore.length) return false; 634 635 //set vars: ì ì²´ íê°ì, íê· íê°, ë¤ì íì´ì§ ë²í¸ 636 var _totalCount = json.totalCount; 637 var _next = json.next; 638 639 //ë±ë¡ë íê° ìì¼ë©´ ëë 640 if (_totalCount < 1) { 641 _$opinionCount.empty(); 642 _$opinionList.empty().append('<p class="c_none">ì´ ìë£ì ëí´ ìì±ë íê¸°ê° ììµëë¤.</p>'); 643 _$btnMore.hide(); 644 return false; 645 } 646 647 //ë±ë¡ë íê° ê°¯ì ì¶ë ¥ 648 _$opinionCount.html('(' + _totalCount + ')'); 649 650 //ë보기 ë²í¼ ê´ë ¨ ì²ë¦¬ 651 if (typeof _next != 'undefined' && _next != '') { 652 _$btnMore.off('click'); 653 _$btnMore.on('click', function (e) { 654 e.preventDefault(); 655 Opinion.DocDetail.list(_that.docSeq, _next, true); 656 }); 657 _$btnMore.show(); 658 } else { 659 _$btnMore.hide(); 660 } 661 662 //리ì¤í¸ ì¶ë ¥ 663 var _html = ''; 664 $(json.list).each(function (k, v) { 665 //í매ì ëµë³ html ë¶ë¶ êµ¬ì± 666 var _answerHtml = ''; 667 if (v.isAnswer == 'y') { 668 $(v.answer).each(function (k2, v2) { 669 var _answerBtns = []; 670 if (json.ownerSeq == v.ownerSeq) { 671 _answerBtns.push('<a href="#" id="opinionAnswerModifyButton' + v.docOpinionSeq + '" onclick="Opinion.loadAnswerForm(' + v.docOpinionSeq + ', ' + page + ', ' + v2.docOpinionAnswerSeq + '); return false;">ìì </a>'); 672 _answerBtns.push('<a href="#" id="opinionAnswerDeleteButton' + v2.docOpinionAnswerSeq + '" onclick="Opinion.loadAnswerDeleteRequestLayerForm(' + docSeq + ', ' + v.docOpinionSeq + ', ' + page + ', ' + v2.docOpinionAnswerSeq + ', \'view\'); return false;">ìì </a>'); 673 } 674 675 _answerHtml += '<div class="reply_txt">' + 676 // ' <span class="s_data"><span class="ico_a">ëµë³</span><em>í매ì</em>' + v2.regDate + '</span>' + 677 ' <span class="s_data"><em>í매ì</em>' + v2.regDate + '</span>' + 678 (_answerBtns.length > 0 ? ('<span class="btn_reply">' + _answerBtns.join('ã £') + '</span>') : '') + 679 ' <p class="rp_comment" id="data_list_view_' + v.docOpinionSeq + v2.docOpinionAnswerSeq + '">' + v2.contents + '</p>' + 680 '</div>'; 681 }); 682 } 683 684 //ë²í¼ html êµ¬ì± 685 var _btns = []; 686 if (v.isDelete == 'y') { 687 _btns.push('<a href="#" id="opinionDeleteButton' + v.docOpinionSeq + '" onclick="Opinion.loadDeleteForm(' + v.docOpinionSeq + ',' + page + ', \'view\');return false;">ìì </a>'); 688 } 689 690 var _recommendHtml = ''; 691 var _recommendBtn = ''; 692 //if(Common.newDesign) { 693 if(v.recommendInfo.upCount > 0) 694 _recommendHtml = '<span class="recomm_t">ì¶ì²<em>' + Common.numberFormat(v.recommendInfo.upCount) + '</em></span>'; 695 696 if (json.isBuyer == 'yes' && json.ownerSeq != v.ownerSeq && json.currentMemberSeq > 0 && v.memberSeq != json.currentMemberSeq ) { 697 if(v.recommendInfo.myUpCount > 0) { 698 _recommendBtn = '<div class="btn_recomm"><a class="btn_like' + ((v.recommendInfo.myUpCount > 0) ? ' on' : '') + '" href="#" onclick="alert(\'ì´ë¯¸ ì¶ì²íì ¨ìµëë¤.\');return false;">ì¶ì²</a>'; 699 } else { 700 _recommendBtn = '<div class="btn_recomm"><a class="btn_like' + ((v.recommendInfo.myDownCount > 0) ? ' on' : '') + '" href="#" onclick="Opinion.DocDetail.recommendDocOpinion(' + v.docOpinionSeq + ', true);return false;">ì¶ì²</a>'; 701 } 702 } 703 //} 704 705 //ê° êµ¬ë§¤íê°ë³ html êµ¬ì± 706 _html += "<li id='data_list_view_" + v.docOpinionSeq + "'>" + 707 "<div class='s_con'>" + 708 "<span class='grade_a'>" + v.pointStr + "</span>" + 709 "<span class='s_data'>" + v.memberIdHtml + v.regDate + "</span>" +
710 _recommendHtml + 711 (_btns.length > 0 ? ('<span class="btn_reply">' + _btns.join('ã £') + '</span>') : '') + 712 "</div>" + 713 ($.trim(v.contents).length > 0 ? "<p class='s_comment' style='word-wrap: break-word;'>" + v.contents + "</p>" : '') + _recommendBtn + _answerHtml + 714 "</li>"; 715 }); 716 717 //ì¶ë ¥ ì²ë¦¬ 718 if (isAppend == true) { 719 _$opinionList.find('ul.s_list').append(_html); 720 } else { 721 //if(Common.newDesign){ 722 _html = '<ul class="s_list" style="border:none;">' + _html + '</ul>'; 723 /*} 724 else{ 725 _html = '<ul class="s_list">' + _html + '</ul>'; 726 }*/ 727 _$opinionList.empty(); 728 _$opinionList.append(_html); 729 } 730 }, 731 error: function(xhr, status, error) { 732 Common.ajaxErrorProcess(xhr, status, error); 733 } 734 }); 735 }, 736 /** 737 * 구매íê° ì¶ì², ë¹ì¶ì² 738 * @param {number} docOpinionSeq 739 * @param {boolean} isRecommend 740 */ 741 recommendDocOpinion: function(docOpinionSeq, isRecommend){ 742 var recommendType = ((isRecommend) ? 'up' : 'down'); 743 var recommendLabel = ((isRecommend) ? 'ì¶ì²' : 'ë°ë'); 744 if(confirm(recommendLabel + ' íìê² ìµëê¹?')) { 745 // íê° ê°ë¥í ìíì¸ì§ íì¸ 746 $.ajax({ 747 url: '/docOpinion/recommend', 748 method: 'POST', 749 data: { 750 docOpinionSeq: docOpinionSeq, 751 recommendType: recommendType 752 }, 753 dataType: 'JSON', 754 success: function (json) { 755 if (json.errorMsg != '') { 756 alert(json.errorMsg); 757 } else { 758 Opinion.DocDetail.list(Opinion.docSeq, 1); 759 } 760 } 761 }); 762 } 763 }, 764 /** 765 * ì ì²´íì/ì¸ì¦íì íí°ë§ í´ì 리ì¤í¸ ë³¼ì§ ì¤ì 766 * @param {boolean} flag ì¤ì ì¬ë¶ 767 */ 768 setFilterMemberAuthPhone: function (flag) { 769 this.filterMemberAuthPhone = (flag === true); 770 771 var $opinionArea = $('#docOpinionArea'); 772 if (this.filterMemberAuthPhone == true) { 773 $opinionArea.find('#docOpinionFilterAll').removeClass('on'); 774 $opinionArea.find('#docOpinionFilterAuthPhone').addClass('on'); 775 } else { 776 $opinionArea.find('#docOpinionFilterAll').addClass('on'); 777 $opinionArea.find('#docOpinionFilterAuthPhone').removeClass('on'); 778 } 779 780 this.list(Opinion.docSeq, 1, false); 781 } 782 } 783}; 784
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.