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

124 lines
4.2 KiB
PHTML

<?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 active"><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>
<input type="hidden" id="image" class="half title" value="" name="image"/>
<p>
<label class="required" for="archivetitle">标题</label><br/>
<input type="text" id="archivetitle" class="half" value="" name="title" maxlength="100"/>
<small>请准确概况新闻内容</small>
</p>
<p>
<label class="required" for="data">相关数据</label><br/>
<select id="data" name="uuid">
<option value="0">请选择相关数据</option>
<?php
if(!empty($this->md))
{
foreach($this->md as $v)
{
echo '<option value="'.$v['uuid'].'">'.$v['title'].'</option>';
}
}
?>
</select>
<small>从数据中选择一条</small>
</p>
<p>
<label class="required" for="tag">标签</label><br/>
<input type="text" id="keyword" class="half" value="" name="keyword"/>
<small>使用半角逗号“,”隔开,如 (冻土,冰川)</small>
</p>
<p>
<label for="body">新闻内容</label><br/>
<textarea id="body" class="large full" name="body"></textarea>
</p>
<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>
</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>