productionPortraitView.php 11.2 KB
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminBoard.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftBoardManage.php" ?>
<?
	$obj		= new AdminBoard($_REQUEST, "");
	$info		= $obj->getInfoOfProductionPortrait();
	
	//$cateCodeList = $obj->getShopCategoryCodeList();
	//$shopImgList = $obj->getShopImgList($info["no"]);
	
	$admin_type = $obj->admUser["admin_type"]; 
	
	
	$rurl		= pack("H*", $_REQUEST["rurl"]) ;
?>
<script src="/admin/inc/fileUpload/fileUploadJS.js"></script>
<script type="text/javascript">
	var _rurl = "<?=$rurl?>";
	var _no = "<?=$_REQUEST[no]?>";
	var total = 10;

	function MultiArticle(sTitle, sC, sCt, sImg){
		this.title = sTitle;
		this.categoryNumber = sC;
		this.contents = sCt;
		this.imgContainer = sImg;
	}
	
	$(document).ready(function(){

		var multiArray = new Array();

		for(var i = 1; i <= total; i++){
			multiArray[i] = new MultiArticle("", i, "", 0);
		}


		$.ajax({
			url : "/action_front.php?cmd=AdminBoard.getInfoOfProductionPortraitForJson",
			dataType : "json",
			data : {no : $("#articleNum").val()},
			success : function(data){
				for(var i = 1; i <= total; i++){
					multiArray[i] = new MultiArticle(data['title'], i, data['content' + i], 0);
				}
				$("#mContent").val(multiArray[1].contents);
			},
			error : function(param1, param2, param3){
				alert(param1 + "<br>" + param2 + "<br>" + param3);
			}
		});

		init();
		
		<?if($admin_type == 3) { ?>
			setReadOnly();
		<?} ?>
		//=====프레입웤 변수들==================================================================================//
		var FORM_TARGET_CLS_NM		= ".data"	;		// 폼을 동적 wrap 할 타겟 ID이름
		var FORM_NAME				= "alf"		;		// 폼이름
		var FORM_METHOD				= "POST"		;		// 폼 메쏘드
		var FORM_USE_FILE			= false		;		// 파일폼 사용 여부
		var FORM_ACTION				= "/action_front.php" ; 
		
		
		var NEXT_CMD				= ""		;		// 다은 수행 할 cmd
		//=====================================================================================================//

		var jForm = $(FORM_TARGET_CLS_NM).mf({ "name" : FORM_NAME , "method" : FORM_METHOD , "action" : FORM_ACTION , "useFile" : FORM_USE_FILE }) ;

		$(".jCancel").click2(function(){
			location.href = _rurl;
		});

		var prev;

		function init(){
			initFileUpload(101);
			initFileUpload(102);
			initFileUpload(103);
			initFileUpload(104);
			initFileUpload(105);
			initFileUpload(106);
			initFileUpload(107);
			initFileUpload(108);
			initFileUpload(109);
			initFileUpload(110);

			toggleHide(1);
		}
		
		$("#category").click(function(){
			var currentNum = $(this).val();
			multiArray[currentNum].contents = $("#mContent").val();
		});
		
		$("#category").change(function(){
			var currentNum = $(this).val();
			$("#mContent").val(multiArray[currentNum].contents);
			toggleHide(currentNum);
			
		});

		function toggleHide(number){
			for(var q = 1; q <= 10; q++){
				if(q != number) $(".imgFiles[no="+q+"]").hide();
				else $(".imgFiles[no="+q+"]").show();
			}
		}

		function pickupRows(){
			var noArr = new Array();

			multiArray[$("#category").val()].contents=$("#mContent").val();
			
			for(var i = 1; i <= 10; i++ ){
				$("#content" + (i)).val(multiArray[i]["contents"]);
			}
			
		}
		
		
		$(".jSave").click2(function(){
			pickupRows();
			if(confirm("저장하시겠습니까?")){
				$("#jData").ajaxSubmit({
					url:"/action_front.php?cmd=AdminBoard.saveProductionPortrait",
					type : "post",
					forceSync : true,
					dataType : "json",
					success : function(data){
						alert(data.returnMessage);
						location.href = _rurl;
					}

				});
			}
		});

		$("#jCategorCd").change(function(){
			setPromotion();
		});

		setPromotion();

	}) ;



	function setPromotion()
	{
		if($("#jCategorCd").val() == "1")
		{
			$("#jPromotionSelect").val("1");
			$("#jPromotionSelect").prop("disabled", true);
			$("#jPromotionHidden").prop("disabled", false);
		}
		else
		{
			$("#jPromotionSelect").prop("disabled", false);
			$("#jPromotionHidden").prop("disabled", true);
		}
	}

	function setReadOnly(){
		$("[name=name]").attr("readonly", true);
		$("[name=tel]").attr("readonly", true);
		$("[name=addr_old]").attr("readonly", true);
		$("[name=addr_new]").attr("readonly", true);
		$("[name=discount_rate]").attr("readonly", true);
		$("[name=discount_desc]").attr("readonly", true);
	}

	
</script>

<div id="Contents"  class="notice">

	<h1>게시판 관리 -등록</h1>

	<!-- location area -->
	<h2>
		업체 관리 > 
		<?
		if($_REQUEST["boardType"] == "NO")
			echo "공지사항";
		else
			echo "이벤트"
		?>
		> 
		<span><?
		if($_REQUEST["no"]=="")
			echo "등록";
		else
			echo "상세보기";
		?></span>
	</h2>
	<!-- location area -->

	
	<div class="data" style="width:80%;">
		
		<form id="jData" method="post" enctype="multipart/form-data">
		
		
			<input type="hidden" name="no" id="articleNum" value="<?=$_REQUEST[no]?>" />
			<input type="hidden" id="content1" name="content1" value="" />
			<input type="hidden" id="content2" name="content2" value="" />
			<input type="hidden" id="content3" name="content3" value="" />
			<input type="hidden" id="content4" name="content4" value="" />
			<input type="hidden" id="content5" name="content5" value="" />
			<input type="hidden" id="content6" name="content6" value="" />
			<input type="hidden" id="content7" name="content7" value="" />
			<input type="hidden" id="content8" name="content8" value="" />
			<input type="hidden" id="content9" name="content9" value="" />
			<input type="hidden" id="content10" name="content10" value="" />
			
			<table class="datav" style="width:100%;">
				<colgroup>
					<col width="10%" />
					<col width="90%" />
				</colgroup>
				<tr>
					<th style="height:25px;">제목</th>
					<td class="l">
						<input type="text" name="title" id="mTitle" class="wl" style="width:70%;" value="<?=$info["title"]?>" />
					</td>
				</tr>
				<tr>
					<th style="height:25px;">카테고리</th>
					<td>
					<select id="category">
						<option value=1>컨텐츠1</option>
						<option value=2>컨텐츠2</option>
						<option value=3>컨텐츠3</option>
						<option value=4>컨텐츠4</option>
						<option value=5>컨텐츠5</option>
						<option value=6>컨텐츠6</option>
						<option value=7>컨텐츠7</option>
						<option value=8>컨텐츠8</option>
						<option value=9>컨텐츠9</option>
						<option value=10>컨텐츠10</option>
					</select>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">내용</th>
					<td class="l">
						<textarea rows="7" id="mContent" style="width:90%;resize:vertical;"><?=$info["special_contract"]?></textarea>
					</td>
				</tr>

				<tr>
					<th style="height:25px;">이미지</th>
					<td class="imgFiles" no=1>
						<?
							$fileIndex	= "101";
							$fileName	= "img01";
							$filePath	= ($info["imgPathPP1"] == "" ? "" : $info["imgPathPP1"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP1" value="<?=$info["imgPathPP1"]?>" />
					</td>
					<td class="imgFiles" no=2>
						<?
							$fileIndex	= "102";
							$fileName	= "img02";
							$filePath	= ($info["imgPathPP2"] == "" ? "" : $info["imgPathPP2"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP2" value="<?=$info["imgPathPP2"]?>" />
					</td>
					<td class="imgFiles" no=3>
						<?
							$fileIndex	= "103";
							$fileName	= "img03";
							$filePath	= ($info["imgPathPP3"] == "" ? "" : $info["imgPathPP3"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP3" value="<?=$info["imgPathPP3"]?>" />
					</td>
					<td class="imgFiles" no=4>
						<?
							$fileIndex	= "104";
							$fileName	= "img04";
							$filePath	= ($info["imgPathPP4"] == "" ? "" : $info["imgPathPP4"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP4" value="<?=$info["imgPathPP4"]?>" />
					</td>
					<td class="imgFiles" no=5>
						<?
							$fileIndex	= "105";
							$fileName	= "img05";
							$filePath	= ($info["imgPathPP5"] == "" ? "" : $info["imgPathPP5"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP5" value="<?=$info["imgPathPP5"]?>" />
					</td>
					<td class="imgFiles" no=6>
						<?
							$fileIndex	= "106";
							$fileName	= "img06";
							$filePath	= ($info["imgPathPP6"] == "" ? "" : $info["imgPathPP6"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP6" value="<?=$info["imgPathPP6"]?>" />
					</td>
					<td class="imgFiles" no=7>
						<?
							$fileIndex	= "107";
							$fileName	= "img07";
							$filePath	= ($info["imgPathPP7"] == "" ? "" : $info["imgPathPP7"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP7" value="<?=$info["imgPathPP7"]?>" />
					</td>
					<td class="imgFiles" no=8>
						<?
							$fileIndex	= "108";
							$fileName	= "img08";
							$filePath	= ($info["imgPathPP8"] == "" ? "" : $info["imgPathPP8"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP8" value="<?=$info["imgPathPP8"]?>" />
					</td>
					<td class="imgFiles" no=9>
						<?
							$fileIndex	= "109";
							$fileName	= "img09";
							$filePath	= ($info["imgPathPP9"] == "" ? "" : $info["imgPathPP9"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP9" value="<?=$info["imgPathPP9"]?>" />
					</td>
					<td class="imgFiles" no=10>
						<?
							$fileIndex	= "110";
							$fileName	= "img10";
							$filePath	= ($info["imgPathPP10"] == "" ? "" : $info["imgPathPP10"]);
							//$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
						<input type="hidden" name="imgPathPP10" value="<?=$info["imgPathPP10"]?>" />
					</td>
					
				</tr>
			</table>
		</form>
		
		<div class="btngroupcenter">
			<span class="button bigrounded blue jCancel">취소 </span>
			<span class="button bigrounded blue jSave" >저장</span>
		</div>

	</div>
</div>