<!--{assign var='menuid' value=''}-->
<!--{assign var='usercpmod' value='yes'}-->
<!--{include file="<!--{$tplpath}-->cp/<!--{$tplpre}-->block_head.tpl"}-->
<body>
<!--{include file="<!--{$tplpath}--><!--{$tplpre}-->block_menu.tpl"}-->
<div id="page-index" class="page">
  <div class="zx">
    <!--{include file="<!--{$tplpath}--><!--{$tplpre}-->block_search.tpl"}-->
	<!--{include file="<!--{$tplpath}-->cp/<!--{$tplpre}-->block_menu.tpl"}-->
	
	<div class="zright">

	  <!--{if $a eq 'run'}--> 
      <div class="topmenu"> 
		<a href="<!--{$ucfile}-->?c=story" class='now'>成功故事</a>
		<a href="<!--{$ucfile}-->?c=story&a=add">发表成功故事</a>
	  </div>
      <div class="tb1 hy">
        <div class="htitle">
		 晒晒你和TA的幸福
		</div>
		<!-- 列表开始 -->
		<table cellpadding='0' cellspacing='0' border='0' class='tb' width='100%'>
		  <tr>
			<th width='12%' align='center'>幸福的你们</th>
			<th width='10%' align='center'>合影</th>
			<th width='20%' align='center'>标题</th>
			<th width='17%' align='center'>男会员</th>
			<th width='17%' align='center'>女会员</th>
			<th width='8%' align='center'>审核</th>
			<th align='center'>操作</th>
		  </tr>
		  <!--{foreach $story as $volist}-->
		  <tr onMouseOver='overColor(this)' onMouseOut='outColor(this)'>
			<td align='center' class='hback'><!--{$volist.catname}--></td>
			<td class='hback'><img src="<!--{$volist.thumbfiles}-->" width="139" height="96" /></td>
			<td class='hback'><a href="<!--{$volist.url}-->" target="_blank"><!--{$volist.title}--></a></td>
			<td align='center' class='hback'><a href="<!--{$volist.maleinfo.homeurl}-->" target="_blank"><!--{$volist.maleinfo.username}--></a> <!--{$volist.maleinfo.age}-->岁</td>
			<td align='center' class='hback'><a href="<!--{$volist.femaleinfo.homeurl}-->" target="_blank"><!--{$volist.femaleinfo.username}--></a> <!--{$volist.femaleinfo.age}-->岁</td>
			<td align='center' class='hback'>
			<!--{if $volist.flag == 1}-->
			<img src='<!--{$skinpath}-->cp/images/no1.gif' title="待审核" />
			<!--{else if $volist.flag == 2}-->
			<img src='<!--{$skinpath}-->cp/images/dui.gif' title="已通过" />
			<!--{else}-->
			<img src='<!--{$skinpath}-->cp/images/cuo.gif' title="未通过" />
			<!--{/if}-->
			</td>
			<td align='center' class='hback'><a href="<!--{$ucfile}-->?c=story&a=edit&id=<!--{$volist.storyid}-->">修改</a></td>
		  </tr>
		  <!--{foreachelse}-->
		  <tr>
			<td colspan="7" align="center" class='hback'>对不起，您还没有发布成功故事。</td>
		  </tr>
		  <!--{/foreach}-->
		</table>

		<!-- 分页 -->
		<!--{if $showpage!=""}-->
		<div class="page_digg" style="margin-top:10px"><!--{$showpage}--></div>
		<!--{/if}-->
	  
	  </div>
	  <!--{/if}-->

	  <!--{if $a eq 'add'}--> 
      <div class="topmenu"> 
		<a href="<!--{$ucfile}-->?c=story">成功故事</a>
		<a href="<!--{$ucfile}-->?c=story&a=add" class='now'>发表成功故事</a>
	  </div>
      <div class="tb1 hy">
        <div class="htitle">晒晒你和TA的幸福</div>

         <form action="<!--{$ucfile}-->?c=story&a=saveadd&uploadpart=sf_upfile" method="post" enctype="multipart/form-data" name="myform" id="myform">
		  <table cellpadding='3' cellspacing='3' border='0' class='tab'>
		      <!-- 标题 -->
              <tr>
                <td class='hback_b' width="15%">标题 <span class="f_red">*</span></td>
                <td class='hback'><input type="text" name="title" id="title" class="input-txt" maxlength="255" /> <span id="dtitle" class="f_red"></span></td>
              </tr>
			  <!-- 分类 -->
              <tr>
                <td class='hback_b'>幸福的你们 <span class="f_red">*</span></td>
                <td class='hback'><!--{hook mod='storycategory' type='select' name='catid' text='=请选择='}--> <span id="dcatid" class="f_red"></span></td>
              </tr>
			  <!-- 对方Email -->
              <tr>
                <td class='hback_b'>对方邮箱 <span class="f_red">*</span></td>
                <td class='hback'><input type="text" name="email" id="email" class="input-txt" maxlength="255" /> <font color='#999999'>对方(必须为异性且为本站会员，否则不给发布)</font> <span id="demail" class="f_red"></span></td>
              </tr>
			  <!-- 内容 -->
              <tr>
                <td class='hback_b'>故事内容 <span class="f_red">*</span></td>
                <td class='hback'><textarea name="content" id="content" style="width:98%;height:180px;display:;overflow:auto;font-size:13px;line-height:20px;"></textarea><br /><font color='#999999'>(抒写你们之间的情感故事)</font> <span id='dcontent' class='f_red'></span></td>
              </tr>

			  <!-- 选择照片 -->
			  <tr>
				<td class="hback_b">合 影 <span class="f_red">*</span></td>
				<td class="hback"><input name="sf_upfile" id="sf_upfile" type="file" class="filePrew" /> <span id="dsf_upfile" class="f_red"></span></td>
			  </tr>

			  <!-- 上传提示 -->
			  <tr id="id_loadingbar" style="display:none;">
				<td class="hback_b"></td>
				<td class="hback"><img src="<!--{$skinpath}-->cp/images/uploading.gif" width="220" height="19" border="0" /> 照片上传中，请稍后...</td>
			  </tr>
			  <tr>
				<td colspan="2" align="left" class="hback_none">
				温馨提示：<br />
				点击浏览，选择你们的幸福合影；<br />
				仅支持PNG，JPG，JPEG，GIF格式，5M以下文件；<br />
				</td>
			  </tr>
			  <!-- 提交保存 -->
			  <tr>
				<td class='hback'></td>
				<td class='hback'>
				<a href="###" class="btn_b2" onclick="return checkadd();"><span>发表保存</span></a>
				&nbsp;&nbsp;
				<a href="<!--{$ucfile}-->?c=story" class="btn_b3"><span>返回列表</span></a>
				</td>
			  </tr>
	      </table>
		  </form>
	  
	  </div>
	  <!--{/if}-->
		
	  <!-- 编辑页面 -->
	  <!--{if $a eq 'edit'}--> 
      <div class="topmenu"> 
		<a href="<!--{$ucfile}-->?c=story">成功故事</a>
		<a href="<!--{$ucfile}-->?c=story&a=add">发表成功故事</a>
		<a href='javascript:void(0);'>编辑成功故事</a>
	  </div>
      <div class="tb1 hy">
        <div class="htitle">晒晒你和TA的幸福</div>

         <form action="<!--{$ucfile}-->?c=story&a=saveedit" method="post" name="myform" id="myform">
		 <input type='hidden' name='id' id='id' value="<!--{$id}-->" />
		  <table cellpadding='3' cellspacing='3' border='0' class='tab'>
		      <!-- 标题 -->
              <tr>
                <td class='hback_b' width="15%">标题 <span class="f_red">*</span></td>
                <td class='hback'><input type="text" name="title" id="title" class="input-txt" maxlength="255" value="<!--{$story.title}-->" /> <span id="dtitle" class="f_red"></span></td>
              </tr>
			  <!-- 分类 -->
              <tr>
                <td class='hback_b'>幸福的你们 <span class="f_red">*</span></td>
                <td class='hback'><!--{hook mod='storycategory' type='select' name='catid' text='=请选择=' value=$story.catid}--> <span id="dcatid" class="f_red"></span></td>
              </tr>
			  <!-- 内容 -->
              <tr>
                <td class='hback_b'>故事内容 <span class="f_red">*</span></td>
                <td class='hback'><textarea name="content" id="content" style="width:98%;height:180px;display:;overflow:auto;font-size:13px;line-height:20px;"><!--{$story.content}--></textarea><br /><font color='#999999'>(抒写你们之间的情感故事)</font> <span id='dcontent' class='f_red'></span></td>
              </tr>

			  <!-- 选择照片 -->
			  <tr>
				<td class="hback_b">合 影 <span class="f_red"></span></td>
				<td class="hback"><img src="<!--{$story.thumbfiles}-->" border="0" /></td>
			  </tr>
			  <tr>
			    <td class="hback_b">收到祝福 </td>
				<td class='hback'><!--{$story.commentcount}--></td>
			  </tr>
			  <tr>
			    <td class="hback_b">浏览次数 </td>
				<td class='hback'><!--{$story.hits}--></td>
			  </tr>
			  <tr>
			    <td class="hback_b">发表时间 </td>
				<td class='hback'><!--{$story.addtime|date_format:"%m-%d"}--></td>
			  </tr>
			  <!-- 提交保存 -->
			  <tr>
				<td class='hback'></td>
				<td class='hback'>
				<a href="###" class="btn_b2" onclick="return checkedit();"><span>编辑保存</span></a>
				&nbsp;&nbsp;
				<a href="<!--{$ucfile}-->?c=story" class="btn_b3"><span>返回列表</span></a>
				</td>
			  </tr>
	      </table>
		  </form>
	  
	  </div>
	  <!--{/if}-->

    </div>
    <div style="clear:both;"></div>
  </div>
  <div style="clear:both;"></div>
</div>
<!--{include file="<!--{$tplpath}--><!--{$tplpre}-->block_footer.tpl"}-->
</body>
</html>
<script type="text/javascript">
//发表
function checkadd() {
	var t = '';
	var v = '';
    
	//标题
	t = 'title';
	v = $('#'+t).val();
	if (v == '') {
		dmsg('标题不能为空', t);
		$('#'+t).focus();
		return false;
	}
	//分类
	t = 'catid';
	v = $('#'+t).val();
	if (v == '') {
		dmsg('请选择分类', t);
		$('#'+t).focus();
		return false;
	}

	//邮箱
	t = 'email';
	v = $('#'+t).val();
	if(v == '') {
		dmsg('对方邮箱不能为空', t);
		$('#'+t).focus();
		return false;
	}

	//内容
	t = 'content';
	v = $('#'+t).val();
	if(v == '') {
		dmsg('故事内容不能为空', t);
		$('#'+t).focus();
		return false;
	}

    /* 选择图片 */
    if ($('#sf_upfile').val() == '') {
		alert('请选择要上传的合影');
		return false;
	}
	/* 判断格式 */
	if (false == validImageType($('#sf_upfile').val())) {
		alert('合影格式不正确，只能上传jpg,jpeg,png和gif格式图片。');
		return false;
	}
	/* 显示隐藏 */
	$('#id_uploadbox').hide();
	$('#id_loadingbar').show();
	
	$('#myform').submit();
	return true;
}
//编辑
function checkedit() {
	var t = '';
	var v = '';
    
	//标题
	t = 'title';
	v = $('#'+t).val();
	if (v == '') {
		dmsg('标题不能为空', t);
		$('#'+t).focus();
		return false;
	}
	//分类
	t = 'catid';
	v = $('#'+t).val();
	if (v == '') {
		dmsg('请选择分类', t);
		$('#'+t).focus();
		return false;
	}

	//内容
	t = 'content';
	v = $('#'+t).val();
	if(v == '') {
		dmsg('故事内容不能为空', t);
		$('#'+t).focus();
		return false;
	}
	
	$('#myform').submit();
	return true
}
</script>