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

140 lines
4.9 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="producttitle" class="half" value="<?php echo $this->info['title'];?>" 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 $vd)
{
echo '<li><input type="checkbox" name="uuid[]" value="'.$vd['uuid'].'"';
foreach($this->thismd as $v)
{
if($v['uuid'] == $vd['uuid'])
{
echo 'checked="checked"';
}
}
echo ' />'.$vd['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="<?php echo $this->info['keywords'];?>" 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%;"><?php echo $this->info['body'];?></textarea>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="aid" value="<?php echo $this->info['id'];?>" />
<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(){
$('#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>