westdc-zf1/application/default/views/scripts/author/news-edit.phtml

106 lines
3.8 KiB
PHTML
Raw Normal View History

2012-03-23 09:53:07 +00:00
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/static/js/kindeditor-min.js');
$this->headScript()->appendFile('/static/js/kindlang/zh_CN.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据新闻');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/news">数据新闻</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/news/ac/add">新闻发布</a></li>
</ul>
</div>
<!-- 新闻表单 -->
<div class="form" id="form">
<form name="form" id="newsadd" method="post" action="#">
<fieldset>
<legend>新闻信息</legend>
<p>
<label class="required" for="producttitle">标题</label><br/>
<input type="text" id="producttitle" class="half" value="<?php echo $this->info['title'];?>" name="title" maxlength="100"/>
<small>请准确概况新闻内容</small>
</p>
<p>
<label class="required" for="producttitle">标签</label><br/>
<input type="text" id="keyword" class="half" value="<?php echo $this->info['keywords'];?>" name="keyword"/>
<small>使用半角逗号","隔开,如 (冻土,冰川)</small>
</p>
<p>
<label for="body">新闻内容</label><br/>
<textarea id="body" class="large full" name="body"><?php echo $this->info['body'];?></textarea>
</p>
<input type="hidden" name="aid" value="<?php echo $this->info['id'];?>" />
<p class="box"><input type="button" onclick="addon();" id="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置" onclick="return confirm('确实要抛弃已经填写内容?');"/></p>
<div id="return"></div>
</fieldset>
</form>
</div>
<!-- //页面内容 -->
<script>
$(document).ready(function(){
$('#wapper').width($('body').width()-300);
KindEditor.ready(function(K) {
editor=K.create('textarea[name="body"]', {
cssPath : '/static/js/plugins/code/prettify.css',
uploadJson : '/plugins/upload_json.php',
allowFileManager : true
});
});
});
function addon(){
editor.sync();
$.ajax({
'type': "POST",
'url': "/author/news/ac/addnews",
'data': $("#newsadd").serialize(),
'success': function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined'){
alert(data.error);
}else{
if(data.status==1)
{
$('#form').html('<div class="box box-success">新闻编辑成功!<a href="/author/news">进入新闻列表</a></div>');
setTimeout("top.location='/author/news'",5000);
}
}
}else{
alert('出现错误,请稍候');
$('#return').html('');
}
},
'beforeSend':function(){
$('#submit').val('正在提交...');
$('#submit').attr("disabled","disabled");
},
'complete':function(){
$('#submit').val('提交');
$('#submit').removeAttr('disabled');
},
'timeout': 20000,
'error': function(){
alert('处理中出现问题,请重试');
$('#return').html('');
}
});
}
</script>