<!--{assign var='menuid' value=''}-->
<!--{assign var='usercpmod' value='yes'}-->
<!--{include file="<!--{$tplpath}-->cp/<!--{$tplpre}-->block_head.tpl"}-->
<body>
<!--{include file="<!--{$tplpath}--><!--{$tplpre}-->block_menu_cp.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=diary" class='now'>我的日记</a>
		<a href="<!--{$ucfile}-->?c=diary&a=add">发表日记</a>
	  </div>
      <div class="tb1 hy">
        <div class="htitle">
		  <span class="left1">温馨提示：打勾
          <label class="gr">√</label>
          表示正常，打叉
          <label class="f_red">X</label>
          表示待审核或者锁定。</span><span class="right1">共发表了
          <label class="f_red"><!--{$total}--></label>
          篇日记 </span>
		</div>
		<!--{if !empty($diary)}-->
			<!--{foreach $diary as $volist}-->
			<div class="list_t">
			  <!-- 标题 -->
			  <h1>
			  &middot;<a href="<!--{$volist.url}-->" target="_blank"><!--{$volist.title}--></a>
			  &nbsp;&nbsp;
			  <!--{if $volist.flag==1}-->
			  <font color='green'>√</font>
			  <!--{else}-->
			  <font color='red'>X</font>
			  <!--{/if}-->

			  &nbsp;&nbsp;
			  <!--{if $volist.diaryopen=='1'}-->
			  <font color="green">公开</font>
			  <!--{else}-->
			  <font color="red">仅自己查看</font>
			  <!--{/if}-->
			  </h1>
			  <!-- 操作 -->
			  <h2>
			  <a href="<!--{$ucfile}-->?c=diary&a=edit&id=<!--{$volist.diaryid}-->&page=<!--{$page}-->">编辑</a>&nbsp;&nbsp;&nbsp;
			  <a href="<!--{$ucfile}-->?c=diary&a=del&id=<!--{$volist.diaryid}-->" onClick="{if(confirm('确定要删除吗？')){return true;} return false;}">删除</a>
			  </h2>
			  <!-- 时间 -->
			  <h3>
			  发表时间：<!--{$volist.timeline|date_format:"%Y-%m-%d %H:%M:%S"}-->&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			  分类：<!--{$volist.catname}-->
			  </h3>
			  <!-- 内容 -->
			  <h4><!--{$volist.content|filterhtml:120}-->...</h4>
			  <!-- 评论，点击 -->
			  <h5><a href="<!--{$volist.url}-->" target="_blank">查看全文</a></h5>
			  <h6>评论 &nbsp;(<!--{$volist.commentcount}-->)&nbsp;&nbsp;&nbsp;浏览 &nbsp;(<!--{$volist.hits}-->)</h6>
			</div>
			<!--{/foreach}-->
			<!-- 分页 -->
			<!--{if !empty($showpage)}-->
			<div style="clear:both;"></div>
			<div class="page_digg" style="margin-top:15px"><!--{$showpage}--></div>
			<!--{/if}-->
		  <!--{else}-->
		  <table cellpadding='5' cellspacing='5' border='0' class='tab'>
		    <tr>
			  <td class="hback" align="center">对不起，您还没发表日记。</td>
			</tr>
		  </table>
		  <!--{/if}-->
	  
	  </div>
	  <!--{/if}-->

	  <!--{if $a eq 'add'}--> 
      <div class="topmenu"> 
		<a href="<!--{$ucfile}-->?c=diary">我的日记</a>
		<a href="<!--{$ucfile}-->?c=diary&a=add" class='now'>发表日记</a>
	  </div>
      <div class="tb1 hy">

         <form name="myform" action="<!--{$ucfile}-->?c=diary" method="post" onSubmit="return checkform();" >
		 <input type="hidden" name="a" value="saveadd" />
		  <table cellpadding='3' cellspacing='3' border='0' class='tab'>
		      <!-- 标题 -->
              <tr>
                <td class='hback_b' width="12%">标 题 <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>
				&nbsp;&nbsp;天气&nbsp;<!--{hook mod='var' item='weather' name='weather' type='select' text=''}-->
				&nbsp;&nbsp;心情&nbsp;<!--{hook mod='var' item='feel' name='feel' type='select' text=''}-->
				</td>
              </tr>
			  <!-- 分类 -->
              <tr>
                <td class='hback_b'>分 类 <span class="f_red">*</span></td>
                <td class='hback'><!--{hook mod='diarycategory' type='select' name='catid' text='=请选择='}--> <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:300px;display:;overflow:auto;"></textarea> <span id='dcontent' class='f_red'></span></td>
              </tr>
			  <!-- 阅读权限 -->
              <tr>
                <td class='hback_b'>阅读权限 <span class="f_red"></span></td>
                <td class='hback'>
				<input type="radio" name="diaryopen" id="diaryopen" value="1" checked />公开&nbsp;&nbsp;
				<input type="radio" name="diaryopen" id="diaryopen" value="0"  />仅自己看&nbsp;&nbsp;
				</td>
              </tr>
			  <!-- 提交保存 -->
			  <tr>
				<td class='hback_none'></td>
				<td class='hback_none'>
				<input type="submit" name="btn_save" class="button_1" value=" 发 表 " />
				&nbsp;&nbsp;<input type="button" name="btn_return" class="button_1" value="返回列表" onClick="javascript:window.location.href='<!--{$ucfile}-->?c=diary';" />
				</td>
			  </tr>
	      </table>
		  </form>

	  </div>
	  <!--{/if}-->


	  <!--{if $a eq 'edit'}--> 
      <div class="topmenu"> 
		<a href="<!--{$ucfile}-->?c=diary">我的日记</a>
		<a href="<!--{$ucfile}-->?c=diary&a=add">发表日记</a>
		<a class='now'>编辑日记</a>
	  </div>
      <div class="tb1 hy">

         <form name="myform" action="<!--{$ucfile}-->?c=diary&<!--{$comeurl}-->" method="post" onSubmit="return checkform();" >
		 <input type="hidden" name="a" value="saveedit" />
		 <input type="hidden" name="id" value="<!--{$id}-->" />
		  <table cellpadding='3' cellspacing='3' border='0' class='tab'>
		      <!-- 标题 -->
              <tr>
                <td class='hback_b' width="12%">标 题 <span class="f_red">*</span></td>
                <td class='hback'><input type="text" name="title" id="title" value="<!--{$diary.title}-->" class="input-txt" maxlength="255" /> <span id="dtitle" class="f_red"></span>
				&nbsp;&nbsp;天气&nbsp;<!--{hook mod='var' type='select' item='weather' name='weather' text='' value=$diary.weather}-->
				&nbsp;&nbsp;心情&nbsp;<!--{hook mod='var' type='select' item='feel' name='feel' text='' value=$diary.feel}-->
				</td>
              </tr>
			  <!-- 分类 -->
              <tr>
                <td class='hback_b'>分 类 <span class="f_red">*</span></td>
                <td class='hback'><!--{hook mod='diarycategory' name='catid' type='select' text='=请选择=' value=$diary.catid}--> <span id="dcateid" 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:300px;display:;overflow:auto;"><!--{$diary.content}--></textarea>  <span id='dcontent' class='f_red'></span></td>
              </tr>
			  <!-- 阅读权限 -->
              <tr>
                <td class='hback_b'>阅读权限 <span class="f_red"></span></td>
                <td class='hback'>
				<input type="radio" name="diaryopen" id="diaryopen" value="1"<!--{if $diary.diaryopen==1}--> checked<!--{/if}--> />公开&nbsp;&nbsp;
				<input type="radio" name="diaryopen" id="diaryopen" value="0"<!--{if $diary.diaryopen==0}--> checked<!--{/if}-->  />仅自己看&nbsp;&nbsp;
				</td>
              </tr>
			  <!-- 提交保存 -->
			  <tr>
				<td class='hback_none'></td>
				<td class='hback_none'>
				<input type="submit" name="btn_save" class="button_1" value="编辑保存" />
				&nbsp;&nbsp;<input type="button" name="btn_return" class="button_1" value="返回列表" onClick="javascript:window.location.href='<!--{$ucfile}-->?c=diary&<!--{$comeurl}-->';" />
				</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 checkform() {
	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;
	}

	return true;
}
</script>