Procházet zdrojové kódy

메인전시 수정

bin2107 před 5 roky
rodič
revize
7b0eada99a

+ 92 - 41
src/main/webapp/WEB-INF/views/display/MainContentsPopupForm.html

@@ -207,18 +207,18 @@
 				html += '>';
 				html += '	<th>띠배너<br>이미지</th>';
 				html += '	<td><div class="uFile w300">';
-				html += '			<input id="filePop_0" name="file" type="file" class="uFileInput w300" onchange="fnPopFileUpload(this, 0)"/>';
-				html += '			<label for="filePop_0" class="uFileLabel">파일선택</label>';
+				html += '			<input id="filePop_'+i+'" name="file" type="file" class="uFileInput w300" onchange="fnGnbFileUpload(this, '+i+', 0)"/>';
+				html += '			<label for="filePop_'+i+'" class="uFileLabel">파일선택</label>';
 				html += '			<input type="hidden" name="imgPath" value="'+result[i].imgPath1+'"/>';
 				html += '			<input type="hidden" name="newImgFile" value="" />';
 				html += '		</div>';
-				html += '	<div id="imgViewPop_0" class=';
+				html += '	<div id="imgViewPop_'+i+'" class=';
 				if(src!=''){
 					html += '"on">';
 				}else{
 					html += '"off">';
 				}
-				html += '		<img id="bannerPreViewUrlPop_0" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
+				html += '		<img id="bannerPreViewUrlPop_'+i+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
 				html += '	</div></td>';
 				html += '</tr>';
 
@@ -240,24 +240,29 @@
 				html += '</tr>';
 
 				html += '<tr name="imgPopRow" id="openBanner1" ';
-				if((result[i].contentsType!='IMG') || result[i].contentsType!='OPEN' && result[i].strVar7!='IMG'){
+				if(result[i].contentsType=='OPEN' && result[i].strVar7=='IMG'){
+					html += '	style="display:table-row;"';
+				}else{
 					html += '	style="display:none;"';
 				}
+				// if((result[i].contentsType!='IMG') || result[i].contentsType!='OPEN' && result[i].strVar7!='IMG'){
+				// 	html += '	style="display:none;"';
+				// }
 				html +='>';
 				html += '	<th>오픈배너<br>이미지</th>';
 				html += '	<td><div class="uFile w300">';
-				html += '			<input id="filePop_1" name="file" type="file" class="uFileInput w300" onchange="fnPopFileUpload(this, 1)"/>';
-				html += '			<label for="filePop_1" class="uFileLabel">파일선택</label>';
+				html += '			<input id="filePop_100'+i+'" name="file" type="file" class="uFileInput w300" onchange="fnGnbFileUpload(this, 100'+i+', 1)"/>';
+				html += '			<label for="filePop_100'+i+'" class="uFileLabel">파일선택</label>';
 				html += '			<input type="hidden" name="imgPath" value="'+result[i].imgPath2+'"/>';
 				html += '			<input type="hidden" name="newImgFile" value="" />';
 				html += '		</div>';
-				html += '	<div id="imgViewPop_1" class=';
+				html += '	<div id="imgViewPop_100'+i+'" class=';
 				if(src!='' && result[i].imgPath2 != ''){
 					html += '"on">';
 				}else{
 					html += '"off">';
 				}
-				html += '		<img id="bannerPreViewUrlPop_1" src="'+src2+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src2\'));"/>';
+				html += '		<img id="bannerPreViewUrlPop_100'+i+'" src="'+src2+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src2\'));"/>';
 				html += '	</div></td>';
 				html += '</tr>';
 
@@ -496,17 +501,24 @@
 			$(obj).closest("table").find("[name=tabBgColorRow"+idx+"]").show();
 			$(obj).closest("table").find("[name=tabShowYnRow"+idx+"]").show();
 			$(obj).closest("table").find("[name=openBannerTypeTr"+idx+"]").show();
-			$(obj).closest("table").find("input:radio[name=openBannerType"+idx+"]:input[value=IMG]").prop('checked',true);
+			console.log($(obj).closest("table").find("input:radio[name=openBannerType"+idx+"]:checked").val());
+			if($(obj).closest("table").find("input:radio[name=openBannerType"+idx+"]:checked").val()=='HTML'){
+				$(obj).closest("table").find("input:radio[name=openBannerType"+idx+"]:input[value=HTML]").prop('checked',true);
+				$(obj).closest("table").find("[id=openBanner2]").show();
+			}else{
+				$(obj).closest("table").find("input:radio[name=openBannerType"+idx+"]:input[value=IMG]").prop('checked',true);
+				$(obj).closest("table").find("[id=openBanner2]").hide();
+			}
 			$(obj).closest("table").find("[id=openBanner0]").show();
 			$(obj).closest("table").find("[id=openBanner1]").show();
-			$(obj).closest("table").find("[id=openBanner2]").hide();
-			$(obj).closest("table").find("[name=file]").closest('div').find('label').text('파일선택');
-			$(obj).closest("table").find("[name=imgPath]").val('');
-			$(obj).closest("table").find("[name=newImgFile]").val('');
-			$("#bannerPreViewUrlPop_0").attr('src', '');
-			$("#imgViewPop_0").removeClass("on").addClass("off");
-			$("#bannerPreViewUrlPop_1").attr('src', '');
-			$("#imgViewPop_1").removeClass("on").addClass("off");
+
+			// $(obj).closest("table").find("[name=file]").closest('div').find('label').text('파일선택');
+			// $(obj).closest("table").find("[name=imgPath]").val('');
+			// $(obj).closest("table").find("[name=newImgFile]").val('');
+			// $("#bannerPreViewUrlPop_0").attr('src', '');
+			// $("#imgViewPop_0").removeClass("on").addClass("off");
+			// $("#bannerPreViewUrlPop_1").attr('src', '');
+			// $("#imgViewPop_1").removeClass("on").addClass("off");
 		}else if(cateType=='IMG'){
 			$(obj).closest("table").find("[name=tabBgColorRow"+idx+"]").show();
 			$(obj).closest("table").find("[name=tabShowYnRow"+idx+"]").hide();
@@ -515,13 +527,13 @@
 			$(obj).closest("table").find("[id=openBanner0]").show();
 			$(obj).closest("table").find("[id=openBanner1]").hide();
 			$(obj).closest("table").find("[id=openBanner2]").hide();
-			$(obj).closest("table").find("[name=file]").closest('div').find('label').text('파일선택');
-			$(obj).closest("table").find("[name=imgPath]").val('');
-			$(obj).closest("table").find("[name=newImgFile]").val('');
-			$("#bannerPreViewUrlPop_0").attr('src', '');
-			$("#imgViewPop_0").removeClass("on").addClass("off");
-			$("#bannerPreViewUrlPop_1").attr('src', '');
-			$("#imgViewPop_1").removeClass("on").addClass("off");
+			// $(obj).closest("table").find("[name=file]").closest('div').find('label').text('파일선택');
+			// $(obj).closest("table").find("[name=imgPath]").val('');
+			// $(obj).closest("table").find("[name=newImgFile]").val('');
+			// $("#bannerPreViewUrlPop_0").attr('src', '');
+			// $("#imgViewPop_0").removeClass("on").addClass("off");
+			// $("#bannerPreViewUrlPop_1").attr('src', '');
+			// $("#imgViewPop_1").removeClass("on").addClass("off");
 		}else if(cateType=='TEXT'){
 			$(obj).closest("table").find("[name=tabBgColorRow"+idx+"]").hide();
 			$(obj).closest("table").find("[name=tabShowYnRow"+idx+"]").hide();
@@ -530,13 +542,19 @@
 			$(obj).closest("table").find("[id=openBanner0]").hide();
 			$(obj).closest("table").find("[id=openBanner1]").hide();
 			$(obj).closest("table").find("[id=openBanner2]").hide();
-			$(obj).closest("table").find("[name=file]").closest('div').find('label').text('파일선택');
-			$(obj).closest("table").find("[name=imgPath]").val('');
-			$(obj).closest("table").find("[name=newImgFile]").val('');
-			$("#bannerPreViewUrlPop_0").attr('src', '');
-			$("#imgViewPop_0").removeClass("on").addClass("off");
-			$("#bannerPreViewUrlPop_1").attr('src', '');
-			$("#imgViewPop_1").removeClass("on").addClass("off");
+			// $(obj).closest("table").find("[name=file]").closest('div').find('label').text('파일선택');
+			// $(obj).closest("table").find("[name=imgPath]").val('');
+			// $(obj).closest("table").find("[name=newImgFile]").val('');
+			// $("#bannerPreViewUrlPop_0").attr('src', '');
+			// $("#imgViewPop_0").removeClass("on").addClass("off");
+			// $("#bannerPreViewUrlPop_1").attr('src', '');
+			// $("#imgViewPop_1").removeClass("on").addClass("off");
+			if($(obj).closest("table").find("[name=title]").length < 1){
+				fnAddTitlePopRow($(obj));
+			}
+			if($(obj).closest("table").find("[name=link]").length < 1){
+				fnAddLinkPopRow($(obj));
+			}
 		}
 	}
 
@@ -669,18 +687,18 @@
 			html += '<tr name="imgPopRow" id="openBanner0">';
 			html += '	<th>띠배너<br>이미지</th>';
 			html += '	<td><div class="uFile w300">';
-			html += '			<input id="filePop_0" name="file" type="file" class="uFileInput w300" onchange="fnPopFileUpload(this, 0)"/>';
-			html += '			<label for="filePop_0" class="uFileLabel">파일선택</label>';
+			html += '			<input id="filePop_'+dataIdx+'" name="file" type="file" class="uFileInput w300" onchange="fnGnbFileUpload(this, '+dataIdx+', 0)"/>';
+			html += '			<label for="filePop_'+dataIdx+'" class="uFileLabel">파일선택</label>';
 			html += '			<input type="hidden" name="imgPath" value=""/>';
 			html += '			<input type="hidden" name="newImgFile" value="" />';
 			html += '		</div>';
-			html += '	<div id="imgViewPop_0" class=';
+			html += '	<div id="imgViewPop_'+dataIdx+'" class=';
 			if(src!=''){
 				html += '"on">';
 			}else{
 				html += '"off">';
 			}
-			html += '		<img id="bannerPreViewUrlPop_0" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
+			html += '		<img id="bannerPreViewUrlPop_'+dataIdx+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
 			html += '	</div></td>';
 			html += '</tr>';
 
@@ -695,18 +713,18 @@
 			html += '<tr name="imgPopRow" id="openBanner1">';
 			html += '	<th>오픈배너<br>이미지</th>';
 			html += '	<td><div class="uFile w300">';
-			html += '			<input id="filePop_1" name="file" type="file" class="uFileInput w300" onchange="fnPopFileUpload(this, 1)"/>';
-			html += '			<label for="filePop_1" class="uFileLabel">파일선택</label>';
+			html += '			<input id="filePop_100'+dataIdx+'" name="file" type="file" class="uFileInput w300" onchange="fnGnbFileUpload(this, 100'+dataIdx+', 1)"/>';
+			html += '			<label for="filePop_100'+dataIdx+'" class="uFileLabel">파일선택</label>';
 			html += '			<input type="hidden" name="imgPath" value=""/>';
 			html += '			<input type="hidden" name="newImgFile" value="" />';
 			html += '		</div>';
-			html += '	<div id="imgViewPop_1" class=';
+			html += '	<div id="imgViewPop_100'+dataIdx+'" class=';
 			if(src!=''){
 				html += '"on">';
 			}else{
 				html += '"off">';
 			}
-			html += '		<img id="bannerPreViewUrlPop_1" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
+			html += '		<img id="bannerPreViewUrlPop_100'+dataIdx+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
 			html += '	</div></td>';
 			html += '</tr>';
 
@@ -803,6 +821,10 @@
 				$("#addMobImg"+dataIdx).click();
 			}
 		}
+		if(contentsLoc=='SGNB002'){
+			$("#addTitle"+dataIdx).click();
+			$("#addLink"+dataIdx).click();
+		}
 
 		if(contentsLoc=='SGNB001'){
 			gagaSn.setContents('#openBannerDesc'+dataIdx, '');
@@ -1078,7 +1100,11 @@
 				strVar5 = $(this).find("input[name=gnbBgColor"+thisIdx+"]").val();
 				strVar6 = $(this).find("input[name=gnbTextColor"+thisIdx+"]").val();
 				strVar8 = $(this).find("input:radio[name=todayYn"+thisIdx+"]:checked").val();
-				strVar7 = $(this).find("input:radio[name=openBannerType"+thisIdx+"]:checked").val();
+				if(contentsType=='OPEN'){
+					strVar7 = $(this).find("input:radio[name=openBannerType"+thisIdx+"]:checked").val();
+				}else{
+					strVar7 = '';
+				}
 				if($(this).find("input:radio[name=openBannerType"+thisIdx+"]:checked").val() == 'HTML'){
 					html = $(this).find("textarea[name=openBannerDesc"+thisIdx+"]").val();
 				}
@@ -1204,6 +1230,31 @@
 		if (typeof(file) == 'undefined'){
 			return;
 		}
+		console.log('ind>>>>'+ind);
+		// 파일 업로드
+		gagajf.ajaxFileUpload('/common/file/upload?subDir=/contents'
+				, file
+				, function(result) {
+					$(obj).closest('div').find('input:hidden[name=newImgFile]').val(result.newFileName);
+					$("#bannerPreViewUrlPop_"+ind).attr('src', $("#uploadDefaultUrlPop").val()+result.newFileName);
+					$("#imgViewPop_"+ind).removeClass("off").addClass("on");
+				}
+				, 'image'
+		);
+	}
+
+	/**
+	 * GNB배너 파일 첨부
+	 */
+	var fnGnbFileUpload = function (obj, ind, num){
+		var file = obj.files[0];
+		file.name = 'test';
+		if (typeof(file) == 'undefined'){
+			return;
+		}
+		var $obj = $(obj);
+		console.log('data-id::'+$("#mcTable"+ind).find('input[name=tableIdx]').val());
+
 		// 파일 업로드
 		gagajf.ajaxFileUpload('/common/file/upload?subDir=/contents'
 				, file