<!--<?php
require($this->getSegmentFile('manage.nav'));
print <<<EOT
-->
<div id="contentC" class="fl">
<div class="p15">
<div class="nav3 mb10">
<ul class="cc">
	<li class="current"><a href="{$_viewer->baseUrl}&dianpuid={$_viewer->dianpuid}">基本信息</a></li>
	<li><a href="{$_viewer->baseUrl}&a=map&dianpuid={$_viewer->dianpuid}">地理位置</a></li>
	<li><a href="{$_viewer->baseUrl}&a=style&dianpuid={$_viewer->dianpuid}">风格设置</a></li>
</ul>
</div>
<script type="text/javascript" src="mode/dianpu/js/tools.js"></script>
<form action="{$_viewer->baseUrl}&a=edit" enctype="multipart/form-data" method="post" name="FORM" onsubmit="return identify.submitRequest(document.FORM)">
<input type="hidden" name="dianpuid" value="{$_viewer->dianpuinfo->dianpuid}"/>
<input type="hidden" name="params[old_username]" value="{$_viewer->dianpuinfo->username}"/>
<input type="hidden" name="params[old_url]" value="{$_viewer->dianpuinfo->url}"/>
<h2 class="h1">基本信息</h2>
<div class="admin_table">
<table width="100%">
<!--
EOT;
if(isGM($_viewer->windid)){
print <<<EOT
-->
	<tr class="tr1 vt">
		<td class="td1">店铺组 </td>
		<td class="td2">{$_viewer->groupsSelectHtml}</td>
	</tr>
	<tr class="tr1 vt">
		<td class="td1">店铺认证</td>
		<td class="td2">{$_viewer->checkWaySelectHtml}</td>
	</tr>
<!--
EOT;
}
$url = ($_viewer->dianpuinfo->url) ? $_viewer->dianpuinfo->url : $_viewer->dianpuinfo->dianpuid;
print <<<EOT
-->
	<tr class="tr1 vt">
		<td class="td1">店铺名称<span class="s1">*</span></td>
		<td class="td2"><input onblur="identify.validation(document.FORM,this.id)" id="title" title="店铺名称" value="{$_viewer->dianpuinfo->title}" name="atc_title" type="text" class="input input_wa" /></td>
	</tr>
	<tr class="tr1 vt">
		<td class="td1">地区<span class="s1">*</span></td>
		<td class="td2">{$_viewer->areaSelectHtml}</td>
	</tr>
	<tr class="tr1 vt">
		<td class="td1">分类<span class="s1">*</span></td>
		<td class="td2">{$_viewer->parentCategorySelectHtml}<span id="optionitem"></span></td>
	</tr>
	<tr class="tr1 vt">
		<td class="td1">实体店地址<span class="s1">*</span></td>
		<td class="td2"><input onblur="identify.validation(document.FORM,this.id)" id="address" title="实体店地址" value="{$_viewer->dianpuinfo->address}" name="params[address]" type="text" class="input input_wb mb5" style="display:block;" />
		</td>
	</tr>
	<tr class="tr1 vt">
		<td class="td1">电话<span class="s1">*</span></td>
		<td class="td2"><input onblur="identify.validation(document.FORM,this.id)" id="areanumber" title="电话区号" value="{$_viewer->dianpuinfo->areanumber}" name="params[areanumber]" type="text" class="input input_wc" /><span
			class="p_lr_10">-</span><input onblur="identify.validation(document.FORM,this.id)" id="phone" title="电话号码" value="{$_viewer->dianpuinfo->phone}" name="params[phone]" type="text" class="input input_wa" /></td>
	</tr>
	<tbody id="dianpu_qq">
		<tr class="tr1">
			<td class="td1">QQ</td>
			<td class="td2"><input onblur="identify.validation(document.FORM,this.id)" id="qq" title="QQ号码" name="params[qq]" value="{$_viewer->dianpuinfo->qq}" type="text" class="input input_wa" /></td>
		</tr>
	</tbody>
	<tbody id="dianpu_wangwang">
		<tr class="tr1">
			<td class="td1">旺旺</td>
			<td class="td2"><input onblur="identify.validation(document.FORM,this.id)" id="wangwang" title="旺旺" name="params[wangwang]" value="{$_viewer->dianpuinfo->wangwang}" type="text" class="input input_wa" /></td>
		</tr>
	</tbody>
	<tbody id="dianpu_logo">
		<tr class="tr1 vt">
			<td class="td1">店铺LOGO</td>
			<td class="td2">
<!--
EOT;
if($_viewer->dianpuinfo->logo && strpos($_viewer->dianpuinfo->logo,'default.jpg') === false){
print <<<EOT
-->
				<div class="cc mb5">
					<img src="{$_viewer->dianpuinfo->logo}" class="B_img fl mr5" height="160" width="160" />
					<a href="{$_viewer->baseUrl}&a=deletelogo&dianpuid={$_viewer->dianpuinfo->dianpuid}">[删除]</a>
				</div>
<!--
EOT;
}print <<<EOT
-->
				<div><input name="logo" type="file" class="input" style="width:165px;" id="logo" title="店铺Logo" onblur="identify.validation(document.FORM,this.id)"/></div>
			</td>
		</tr>
	</tbody>
	<tr class="tr1 vt">
		<td class="td1">公交路线</td>
		<td class="td2"><input onblur="identify.validation(document.FORM,this.id)" id="businfo" title="公交路线" value="{$_viewer->dianpuinfo->businfo}" name="params[businfo]" type="text" class="input input_wa" />
		</td>
	</tr>
	<tr class="tr1 vt">
		<td class="td1">店铺公告</td>
		<td class="td2"><textarea onblur="identify.validation(document.FORM,this.id)" id="bulletin" title="店铺公告" cols="" rows="" class="textareaA mb5" name="bulletin" style="display:block;">{$_viewer->dianpuinfo->bulletin}</textarea>
	</tr>
	<tr class="tr1 vt">
			<td class="td1">店铺说明</td>
			<td class="td2">
				<div class="admin_table_b" style="width:auto;">
					<table cellpadding="0" cellspacing="0">
						<tr class="s6">
							<td width="40">序号</td>
							<td width="150">页面名称</td>
							<td>操作</td>
							<td><a href="javascript:;" onclick="addNewPage()"><span class="s2">[添加]</span></a></td>
						</tr>
<!--
EOT;
foreach($_viewer->dianpuinfo->contentorder as $key => $value){
$value[o] = $value[o] ? $value[o] : 0;
print <<<EOT
-->
						<tr id="order_{$key}">
							<td><input type="text" class="input" style="width:20px;" value="{$value[o]}" name="params[orders][{$key}]"/> </td>
							<td>{$value[t]}</td>
							<td><a href="{$_viewer->baseUrl}&a=addcontent&dianpuid={$_viewer->dianpuinfo->dianpuid}&contentid={$key}" class="mr5 s4">[编辑]</a></td>
							<td><a href="javascript:;" onclick="deletePage('order_{$key}','{$key}')" class="s4">[删除]</a></td>
						</tr>
<!--
EOT;
}print <<<EOT
-->
					</table>
				</div>
			</td>
	</tr>
</table>
</div>
<div class="p10 tac"><span class="btn"><span><button type="submit" name="Submit">提 交</button></span></span></div>
</form>
</div>
</div>
</div>
</div>
<!--
EOT;
$_maxCount = $_viewer->groupinfo['configinfo']['maxexplain'];
print <<<EOT
-->
<script type="text/javascript">
var identify = {
	submitRequest : function (form) {
		if (!this.validation(form,'')) return false;
	},
	
	validation : function (form,type) {
		if(form == null || form == undefined || form == "") {
			DP.tips('error','非法的请求，请检查后再提交');
			return false;
		}
	
		if(type == ''){
			VALIDATOR.init(form);
		}else{
			VALIDATOR.init_2(form,type);
		}
		//required validate
		//店铺名称验证
		if(type == '' || type == 'title') {
			VALIDATOR.isRequired('title');//必须填写
			VALIDATOR.isLetter('title');//必须输入除换行外的任意字符
			VALIDATOR.isLength('title', 1 , 30);//店铺名称长度0-30个字节
		}
		
		if(type == '' || type == 'areaid') VALIDATOR.isRequired('areaid');
		if(type == '' || type == 'categoryid') VALIDATOR.isRequired('categoryid');
		if(type == '' || type == 'childid') VALIDATOR.isRequired('childid');
		if(type == '' || type == 'logo') VALIDATOR.uploadsize('logo');
		
		//店铺实体地址
		if(type == '' || type == "address") {
			VALIDATOR.isRequired('address');
			VALIDATOR.isLetter('address');
			VALIDATOR.isLength('address', 0, 255);
		}
		//区号
		if(type == '' || type == 'areanumber') {
			VALIDATOR.isRequired('areanumber');
			VALIDATOR.isInt('areanumber');
			VALIDATOR.isLength('areanumber', 2, 4);
		}
		//电话号码
		if(type == '' || type == 'phone') {
			VALIDATOR.isRequired('phone');
			VALIDATOR.isInt('phone');
			VALIDATOR.isLength('phone', 5 , 11);
		}
		//QQ验证
		if(type == '' || type == 'qq') {
			VALIDATOR.isInt('qq');
			VALIDATOR.isLength('phone', 5, 15);
		}
		//店铺旺旺
		if(type == '' || type == 'wangwang') {
			VALIDATOR.isLetter('wangwang');
			VALIDATOR.isLength('phone' , 0, 100);
		}
		//店铺公交
		if(type == '' || type == 'businfo') {
			VALIDATOR.isLetter('businfo');
			VALIDATOR.isLength('phone', 0, 255);
		}
		//店铺公告		
		if(type == '' || type == 'bulletin') VALIDATOR.isLength('bulletin' , 0, 500);
		
		if(!VALIDATOR.result)return false;
		return true;
	}
};

function addNewPage() {
	var count = '{$_viewer->countexplain}';
	var maxcount = '{$_maxCount}';
	if(count >= maxcount){
		DP.tips('error','您所在的用户组最多可添加店铺说明'+maxcount+'页');
		return false;
	}
	var url = "{$_viewer->baseUrl}&a=addcontent&dianpuid={$_viewer->dianpuinfo->dianpuid}";
	setTimeout(function(){
		window.location.href = url;
	},200);
}

function deletePage(pageid,contentid){
	var obj = getObj(pageid);
	if (obj == null) return false;
	var url = '{$_viewer->baseUrl}&a=deletepage&dianpuid={$_viewer->dianpuinfo->dianpuid}&contentid=' + contentid;
	DP.post(url,'',function(){
		if(ajax.request.responseText == 'success'){
			DP.tips('success', '操作成功！', '2');
			var objparent = obj.parentNode;
			setTimeout(function(){
				objparent.removeChild(obj);
			},1000);
		}else{
			DP.tips('error', '操作失败！', '2');
		}
	});
}

DP.baseUrl = '{$_viewer->baseUrl}&a=getgroupinfo&dianpuid={$_viewer->dianpuinfo->dianpuid}&gid='; 
DP.showManagePane('{$_viewer->groupinfo[configinfo][qq]}','dianpu_qq');
DP.showManagePane('{$_viewer->groupinfo[configinfo][wangwang]}','dianpu_wangwang');
DP.showManagePane('{$_viewer->groupinfo[configinfo][uploadlogo]}','dianpu_logo');
DP.setDianpuGroupsEvent();
</script>
<script language='javascript' type="text/javascript">
window.onload = function(){
    tools.getChildCategory('index.php?m=dianpu&c=checkin&a=categorychildlist', getObj('categoryid'), '{$_viewer->categoryid}');
}
</script>
<!--
EOT;
?>