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

130 lines
4.6 KiB
PHTML

<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$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 class="row">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-pills">
<li class=""><a class="" href="/author/news">数据新闻</a></li>
<li class="active"><a class="" href="/author/news/ac/add">新闻发布</a></li>
</ul>
</div>
<div class="form-horizontal" id="form">
<form name="form" id="newsadd" method="post" action="#">
<div class="control-group">
<label class="control-label" for="archivetitle">标题</label>
<div class="controls">
<input type="text" id="archivetitle" class="half" value="" name="title" maxlength="100"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="data">相关数据</label>
<div class="controls">
<ul style="height:100px;overflow-y:scroll;" class="span6 unstyled">
<?php
if(!empty($this->md))
{
foreach($this->md as $v)
{
echo '<li><input type="checkbox" value="'.$v['uuid'].'" name="uuid[]" />'.$v['title'].'</li>';
}
}
?>
</ul>
</div>
</div>
<div class="control-group">
<label class="control-label" for="tag">标签</label>
<div class="controls">
<input type="text" id="keyword" value="" name="keyword" style="width:96%" />
<small>使用半角逗号“,”隔开,如 (冻土,冰川)</small>
</div>
</div>
<div class="control-group">
<label class="control-label" for="tag">新闻内容</label>
<div class="controls">
<textarea id="body" name="body" style="width:98%;"></textarea>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="button" onclick="addon();" id="submit" class="btn btn-green big" value="提交"/> or
<input type="reset" class="btn" value="重置" onclick="return confirm('确实要抛弃已经填写内容?');"/>
</div>
</div>
</form>
</div>
</div>
</div>
<script>
$(document).ready(function(){
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>