Просмотр исходного кода

동영상 확장자 체크 추가

bin2107 5 лет назад
Родитель
Сommit
df670e545c

+ 1 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaDsiplay.xml

@@ -1863,6 +1863,7 @@
 				  AND	BRAND_GROUP_NO = #{brandGroupNo}
 				  AND	BRAND_GROUP_NO = #{brandGroupNo}
 			  </if>
 			  </if>
 		  </if>
 		  </if>
+		ORDER BY DISP_ORD
 		;
 		;
 	</select>
 	</select>
 
 

+ 59 - 30
src/main/webapp/WEB-INF/views/display/MainContentsPopupForm.html

@@ -15,7 +15,7 @@
  * 1.0  2021.2.23    bin2107     최초 작성
  * 1.0  2021.2.23    bin2107     최초 작성
  *******************************************************************************
  *******************************************************************************
  -->
  -->
-<div class="modalPopup" data-width="1500" >
+<div class="modalPopup" data-width="1500" th:with="imgGoodsUrl=${@environment.getProperty('upload.goods.view')}, uxImgUrl=${@environment.getProperty('domain.uximage')}, imgUrl=${@environment.getProperty('upload.image.view')}">
 	<div class="panelStyle">
 	<div class="panelStyle">
 		<div class="panelTitle">
 		<div class="panelTitle">
 			<h2 id="popTitle" th:text="${contentsLoc}"></h2>
 			<h2 id="popTitle" th:text="${contentsLoc}"></h2>
@@ -159,11 +159,11 @@
 				html += '</tr>';
 				html += '</tr>';
 				if(result[i].strVar1=='M'){
 				if(result[i].strVar1=='M'){
 					html += '<tr class="cateTypeTr" name="tvM'+i+'">';
 					html += '<tr class="cateTypeTr" name="tvM'+i+'">';
-					html +='	<th>파일첨부<em className="required" title="필수"></em></th>';
-					html +='	<td className="infoTxt" colSpan="5">';
-					html +='		<div className="uFile w300">';
-					html +='			<input id="file'+i+'" name="file" type="file" className="uFileInput w300" onchange="fnVideoFileUpload(this, '+i+')"/>';
-					html +='			<label htmlFor="file'+i+'" className="uFileLabel">파일선택</label>';
+					html +='	<th>파일첨부<em class="required" title="필수"></em></th>';
+					html +='	<td class="infoTxt" colSpan="5">';
+					html +='		<div class="uFile w300">';
+					html +='			<input id="file'+i+'" name="file" type="file" class="uFileInput w300" onchange="fnVideoFileUpload(this, '+i+')"/>';
+					html +='			<label htmlFor="file'+i+'" class="uFileLabel">파일선택</label>';
 					html +='			<input type="hidden" name="kufKey" value="'+result[i].strVar3+'"/>';
 					html +='			<input type="hidden" name="kufKey" value="'+result[i].strVar3+'"/>';
 					html +='			<input type="hidden" name="kmcKey"/>';
 					html +='			<input type="hidden" name="kmcKey"/>';
 					html +='		</div>';
 					html +='		</div>';
@@ -252,7 +252,7 @@
 				html += '			<input type="hidden" name="newImgFile" value="" />';
 				html += '			<input type="hidden" name="newImgFile" value="" />';
 				html += '		</div>';
 				html += '		</div>';
 				html += '	<div id="imgViewPop_1" class=';
 				html += '	<div id="imgViewPop_1" class=';
-				if(src!=''){
+				if(src!='' && result[i].imgPath2 != ''){
 					html += '"on">';
 					html += '"on">';
 				}else{
 				}else{
 					html += '"off">';
 					html += '"off">';
@@ -403,8 +403,14 @@
 						html += fnAddTitlePopRow(strTitle);
 						html += fnAddTitlePopRow(strTitle);
 					}
 					}
 					if(contentsLoc!='SGNB001' && contentsLoc!='SGNB002'){
 					if(contentsLoc!='SGNB001' && contentsLoc!='SGNB002'){
-						if(imgPath!=null && imgPath!='null' && imgPath!='' ){
-							html += fnAddImgPopRow(imgPath, j);
+						if(contentsLoc=='SMM001' || contentsLoc=='SBM004' || contentsLoc=='SOM001'){
+							if(j<3){
+								html += fnAddImgPopRow(imgPath, j);
+							}
+						}else{
+							if(imgPath!=null && imgPath!='null' && imgPath!='' ){
+								html += fnAddImgPopRow(imgPath, j);
+							}
 						}
 						}
 					}
 					}
 					if(strVar!=null && strVar!='null' && strVar!='' ){
 					if(strVar!=null && strVar!='null' && strVar!='' ){
@@ -449,20 +455,12 @@
 			let idx = $(this).find('[name=tableIdx]').val();
 			let idx = $(this).find('[name=tableIdx]').val();
 			let bannerCateType = $("#mcTable"+idx).find('input:radio[name=cateType'+idx+']:checked').val();
 			let bannerCateType = $("#mcTable"+idx).find('input:radio[name=cateType'+idx+']:checked').val();
 
 
-			if(bannerCateType=='OPEN'){
+			// if(bannerCateType=='OPEN'){
 				let htmlDesc = $("#mcTable"+idx).find('input[name=htmlDesc'+idx+']').val();
 				let htmlDesc = $("#mcTable"+idx).find('input[name=htmlDesc'+idx+']').val();
 				var snOptions1 = gagaSn.getToolbarOptions('media');
 				var snOptions1 = gagaSn.getToolbarOptions('media');
 				gagaSn.createSummernote(snOptions1, '#openBannerDesc'+idx);
 				gagaSn.createSummernote(snOptions1, '#openBannerDesc'+idx);
 				// gagaSn.setContents('#openBannerDesc'+idx, '');
 				// gagaSn.setContents('#openBannerDesc'+idx, '');
 				$('#openBannerDesc'+idx).summernote('code', htmlDesc);
 				$('#openBannerDesc'+idx).summernote('code', htmlDesc);
-			}
-			// if(bannerCateType=='OPEN'){
-			// 	let bannerType = $("#mcTable"+idx).find('input:radio[name=openBannerType'+idx+']:checked').val();
-			// 	if(bannerType=='HTML'){
-			// 		let htmlDesc = $("#mcTable"+idx).find('input[name=htmlDesc'+idx+']').val();
-			// 		gagaSn.setContents('#openBannerDesc'+idx, '');
-			// 		$('#openBannerDesc'+idx).summernote('code', htmlDesc);
-			// 	}
 			// }
 			// }
 		});
 		});
 	}
 	}
@@ -612,7 +610,7 @@
 				html += ' id="addImg'+dataIdx+'" onclick="fnAddImgPopRow(this);">이미지추가</button>';
 				html += ' id="addImg'+dataIdx+'" onclick="fnAddImgPopRow(this);">이미지추가</button>';
 			}
 			}
 			if(contentsLoc=='SMM001' || contentsLoc=='SOM001' || contentsLoc=='SBM004'){
 			if(contentsLoc=='SMM001' || contentsLoc=='SOM001' || contentsLoc=='SBM004'){
-				html += '<button type="button" style="display: none;" class="btn btn-base btn-lg" id="addMobImg'+dataIdx+'" onclick="fnAddMobImgPopRow(this);">모바일이미지추가</button>';
+				html += '<button type="button" style="display: none;" class="btn btn-base btn-lg" id="addMobImg'+dataIdx+'" onclick="fnAddMobImgPopRow(this, '+dataIdx+');">모바일이미지추가</button>';
 			}
 			}
 			html += '<button type="button" class="btn btn-base btn-lg"';
 			html += '<button type="button" class="btn btn-base btn-lg"';
 			if(contentsLoc=='SMM001' || contentsLoc=='SOM001' || contentsLoc=='SBM004' || contentsLoc=='SCM001'){
 			if(contentsLoc=='SMM001' || contentsLoc=='SOM001' || contentsLoc=='SBM004' || contentsLoc=='SCM001'){
@@ -858,8 +856,8 @@
 		$("#mcTable"+tableDataId).find("tr[name=subTextPopRow]").find("input[name=subText]").val(result[0].dtlTitle1);
 		$("#mcTable"+tableDataId).find("tr[name=subTextPopRow]").find("input[name=subText]").val(result[0].dtlTitle1);
 		$("#mcTable"+tableDataId).find("tr[name=linkPopRow]").find("input[name=link]").val('/planning/detail/form?planSq='+result[0].planSq);
 		$("#mcTable"+tableDataId).find("tr[name=linkPopRow]").find("input[name=link]").val('/planning/detail/form?planSq='+result[0].planSq);
 		$("#mcTable"+tableDataId).find("tr[id=mobImgPop]").find("input[name=imgPath]").val(result[0].mainPimg);
 		$("#mcTable"+tableDataId).find("tr[id=mobImgPop]").find("input[name=imgPath]").val(result[0].mainPimg);
-		$("#mcTable"+tableDataId).find('.mobImg').find("#bannerPreViewUrlPop_0").attr('src',$("#uploadDefaultUrlPop").val().replace('/contents/', '')+result[0].mainPimg);
-		$("#mcTable"+tableDataId).find('.mobImg').find("#imgViewPop_0").removeClass("off").addClass("on");
+		$("#mcTable"+tableDataId).find('.mobImg').find("#bannerPreViewUrlPop_"+tableDataId).attr('src', $("#uploadDefaultUrlPop").val().replace('/contents/', '')+result[0].mainPimg);
+		$("#mcTable"+tableDataId).find('.mobImg').find("#imgViewPop_"+tableDataId).removeClass("off").addClass("on");
 
 
 		let stdt = result[0].dispStdt.split(" ");
 		let stdt = result[0].dispStdt.split(" ");
 		let eddt = result[0].dispEddt.split(" ");
 		let eddt = result[0].dispEddt.split(" ");
@@ -922,7 +920,7 @@
 			let fromDate = dispStdt.replace(/[^0-9]/g, '');
 			let fromDate = dispStdt.replace(/[^0-9]/g, '');
 			let toDate = dispEddt.replace(/[^0-9]/g, '');
 			let toDate = dispEddt.replace(/[^0-9]/g, '');
 			if(fromDate > toDate){
 			if(fromDate > toDate){
-				mcxDialog.alert("시작일자는 종료일자 보다 클 수 없습니다.");
+				mcxDialog.alert((i+1) +"번째 " +"시작일자는 종료일자 보다 클 수 없습니다.");
 				$(this).find('input[name=dispStdt]').focus();
 				$(this).find('input[name=dispStdt]').focus();
 				dateBool = false;
 				dateBool = false;
 			}
 			}
@@ -934,6 +932,29 @@
 		}
 		}
 	}
 	}
 
 
+	// 동영상 확장자 체크
+	function videoValidation(){
+		var dataBool = true;
+		$(".mcTable").each(function(i){
+			var thisIdx = $(this).find("input[name=tableIdx]").val();
+			if($(this).find("input:radio[name=tvPlayer"+thisIdx+"]:checked").val()=='M'){
+				var fileName = $(this).find("input:file[name=file]").val();
+				var ext =  fileName.split('.').pop().toLowerCase();
+				if(ext!='mp4'&&ext!='MP4'){
+					mcxDialog.alert((i+1) +'번째 ' +ext+'파일은 업로드 하실 수 없습니다.');
+					$(this).find("input:radio[name=tvPlayer"+thisIdx+"]").focus();
+					dataBool = false;
+				}
+			}
+		});
+
+		if(!dataBool){
+			return false;
+		}else{
+			return true;
+		}
+	}
+
 	/**
 	/**
 	 * 임시저장
 	 * 임시저장
 	 */
 	 */
@@ -948,6 +969,12 @@
 			return false;
 			return false;
 		}
 		}
 
 
+		if(contentsLoc=='SMM011' || contentsLoc=='SBM012'){
+			if(!videoValidation()){
+				return false;
+			}
+		}
+
 		if(contentsLoc=='SMM001' || contentsLoc=='SOM001'){
 		if(contentsLoc=='SMM001' || contentsLoc=='SOM001'){
 			if(!smm001DataValidation()){
 			if(!smm001DataValidation()){
 				return false;
 				return false;
@@ -1197,7 +1224,7 @@
 		var html = '<tr name="linkPopRow">';
 		var html = '<tr name="linkPopRow">';
 		html += '<th>링크 (없으면 #)</th>';
 		html += '<th>링크 (없으면 #)</th>';
 		html += '<td><input name="link" type="text" maxlength="200" required="required" data-valid-name="링크" value="'+val+'"/></td>';
 		html += '<td><input name="link" type="text" maxlength="200" required="required" data-valid-name="링크" value="'+val+'"/></td>';
-		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001'){
+		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001' && contentsLoc!='SBM004'){
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 		}
 		}
 		html += '</tr>';
 		html += '</tr>';
@@ -1228,7 +1255,7 @@
 		var html = '<tr name="subTextPopRow">'
 		var html = '<tr name="subTextPopRow">'
 		html += '<th>서브텍스트</th>';
 		html += '<th>서브텍스트</th>';
 		html += '<td><input type="text" name="subText" maxlength="200" value="'+val+'"/></td>';
 		html += '<td><input type="text" name="subText" maxlength="200" value="'+val+'"/></td>';
-		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001'){
+		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001' && contentsLoc!='SBM004'){
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 		}
 		}
 		html += '</tr>';
 		html += '</tr>';
@@ -1297,14 +1324,14 @@
 		html += '<input type="hidden" name="newImgFile" value="" />';
 		html += '<input type="hidden" name="newImgFile" value="" />';
 		html += '</div>';
 		html += '</div>';
 		html += '<div id="imgViewPop_'+imgIndex+'" class=';
 		html += '<div id="imgViewPop_'+imgIndex+'" class=';
-		if(src!=''){
+		if(src!='' && imgPath !=''){
 			html += '"on">';
 			html += '"on">';
 		}else{
 		}else{
 			html += '"off">';
 			html += '"off">';
 		}
 		}
 		html += '<img id="bannerPreViewUrlPop_'+imgIndex+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
 		html += '<img id="bannerPreViewUrlPop_'+imgIndex+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
 		html += '</div></td>';
 		html += '</div></td>';
-		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001'){
+		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001' && contentsLoc!='SBM004'){
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 		}
 		}
 		html += '</tr>';
 		html += '</tr>';
@@ -1322,6 +1349,7 @@
 			}
 			}
 			imgIndex++;
 			imgIndex++;
 			$(param).closest("table").find("tbody").append(html);
 			$(param).closest("table").find("tbody").append(html);
+			return html;
 		}else{
 		}else{
 			imgIndex++;
 			imgIndex++;
 			return html;
 			return html;
@@ -1331,8 +1359,9 @@
 	/**
 	/**
 	 * 모바일용 이미지 추가
 	 * 모바일용 이미지 추가
 	 */
 	 */
-	var imgMobIndex = 5000;
-	var fnAddMobImgPopRow = function (param){
+	var imgMobIndex = 0;
+	var fnAddMobImgPopRow = function (param , idx){
+		imgMobIndex = idx;
 		var src = '';
 		var src = '';
 		var imgPath = '';
 		var imgPath = '';
 		if(typeof param!='object'){
 		if(typeof param!='object'){
@@ -1356,7 +1385,7 @@
 		}
 		}
 		html += '<img id="bannerPreViewUrlPop_'+imgMobIndex+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
 		html += '<img id="bannerPreViewUrlPop_'+imgMobIndex+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'bannerPreimgViewPop\',$(this).attr(\'src\'));"/>';
 		html += '</div></td>';
 		html += '</div></td>';
-		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001'){
+		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001' && contentsLoc!='SBM004'){
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 		}
 		}
 		html += '</tr>';
 		html += '</tr>';
@@ -1388,7 +1417,7 @@
 		var html = '<tr name="titlePopRow">';
 		var html = '<tr name="titlePopRow">';
 		html += '<th>타이틀</th>';
 		html += '<th>타이틀</th>';
 		html += '<td><input name="title" type="text" maxlength="200" data-valid-name="타이틀" value="'+val+'"/></td>';
 		html += '<td><input name="title" type="text" maxlength="200" data-valid-name="타이틀" value="'+val+'"/></td>';
-		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001'){
+		if(contentsLoc!='SMM001' && contentsLoc!='SOM001' && contentsLoc!='SCM001' && contentsLoc!='SBM004'){
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 			html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
 		}
 		}
 		html += '</tr>';
 		html += '</tr>';