{* <?php die('duotaopu');?> *}
{include file="common/header.php"}
<body class="body-main">
<div class="admin_notice"><span>管理操作：</span><a href="?m=gonggao&a=edit&id=0">添加公告</a>　┊　<a href="?m=gonggao">公告管理</a></div>
<br>
<ul id="admin_sub_title">
	<li class="sub"><a>{if $id==0}添加{else}编辑{/if}公告</a></li>
	<li class="unsub"><a class="hand" id="search">搜索公告</a></li>
</ul>
<script>
$(function() {
	$("#search").click(function(){
		art.dialog({
			id:'s',
			title:'搜索',
			content:'关键词：<input name="keyword" type="text" class="input" id="keyword" value="" />',
			ok: function(){
				if($('#keyword').val()!='') location.href="?m=gonggao&q="+$('#keyword').val();
			}
		});
	});
});
</script>
<div id="admin_right_b">
  <form method="post">
    <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" id="tagContent0">
	<tr>
      <td width="120" align="right" class="tdbg">标题：</td>
	  <input type="hidden" name="con[id]" value="{$id|default:0}">
      <td class="tdbg"><input name="con[title]" type="text" value="{$title}" class="input" size="50"></td>
    </tr>
	<tr>
      <td align="right" class="tdbg">标题样式：</td>
      <td class="tdbg"><select name="con[style1]">
				<option value="" >默认</option>
				<option value="color:#CC0000;" style="color:#CC0000;"{if stripos($style,'color:#CC0000;')>-1} selected{/if}>红色</option>
				<option value="color:#0000FF;" style="color:#0000FF;"{if stripos($style,'color:#0000FF;')>-1} selected{/if}>蓝色</option>
				<option value="color:#009900;" style="color:#009900;"{if stripos($style,'color:#009900;')>-1} selected{/if}>绿色</option>
				<option value="color:#996600;" style="color:#996600;"{if stripos($style,'color:#996600;')>-1} selected{/if}>咖啡色</option>
				<option value="color:#8142BF;" style="color:#8142BF;"{if stripos($style,'color:#8142BF;')>-1} selected{/if}>紫色</option>
				<option value="color:#FF6600;" style="color:#FF6600;"{if stripos($style,'color:#FF6600;')>-1} selected{/if}>橘黄色</option>
			</select>
			<select name="con[style2]">
				<option value="" >默认</option>
				<option value="font-weight:bold;"{if stripos($style,'font-weight:bold;')>-1} selected{/if}>加粗</option>
				<option value="text-decoration:underline;"{if stripos($style,'text-decoration:underline;')>-1} selected{/if}>下划线</option>
			</select>
	  </td>
    </tr>

    <tr class="tdbg">
      <td align="center"></td>
      <td valign="top"><textarea id="body" name="con[content]" style="width:630px;height:320px;" >{$content}</textarea>
	  </td>
    </tr>
	<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" >
		<tr class="tdbg">
		  <td width="100">&nbsp;</td>
		  <td><div class="aui_buttons"  style="text-align:left;"><button type="submit" id="dosave" class="aui_state_highlight">保存</button><button type="reset" class="aui_state_highlight">重置</button><button type="button" onClick="history.go(-1)" class="aui_state_highlight">返回</button></div></td>
		</tr>
	</table>
 </form>
<script type="text/javascript">
editor=KindEditor.create('#body',{
	resizeType : 1,
	allowPreviewEmoticons : false,
	allowImageUpload : true,
	fileManagerJson : 'public/js/keditor/php/file_manager_json.php',
	allowFileManager : true,
	items : [
		'source','preview','|','undo','redo', '|','fontname','fontsize', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
		'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'emoticons', 'image', 'multiimage', 'baidumap','|','link','unlink','fullscreen']
});
$("#dosave").click(function(){
		editor.sync('#body');
		showDialog();
		$.ajax({
			type:"post",
			url:"?m=gonggao&a=do&do=update&_t="+Math.random()*10,
			data:$("form").serialize(),
			dataType:'json',
			timeout:28000,
			global:false,
			success:function(data){
				if(data.status==1){
					showAlert('success','恭喜你，修改成功','?m=gonggao&p={$smarty.get.p}');
				}else{
					showAlert('error',data.info);
				}
			}
		});
	 return false;
	});
</script>
<div class="runtime"></div>  
</div>
</body>
</html>