228 lines
8.7 KiB
PHTML
228 lines
8.7 KiB
PHTML
|
<?php
|
|||
|
$this->headTitle($this->config->title->site);
|
|||
|
$this->headTitle('后台管理');
|
|||
|
$this->headTitle()->setSeparator(' - ');
|
|||
|
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
|||
|
$this->headLink()->appendStylesheet('/css/admin.css');
|
|||
|
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js');
|
|||
|
$this->headScript()->appendFile('/static/js/kindeditor-min.js');
|
|||
|
$this->headScript()->appendFile('/static/js/kindlang/zh_CN.js');
|
|||
|
$this->headLink()->appendStylesheet('/static/css/kindskin/default/default.css');
|
|||
|
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
|||
|
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
|
|||
|
$this->breadcrumb('新闻编辑');
|
|||
|
?>
|
|||
|
<?php
|
|||
|
$auth = Zend_Auth::getInstance();
|
|||
|
if($auth->hasIdentity())
|
|||
|
{
|
|||
|
$user = $auth->getIdentity();
|
|||
|
$uname=$user->username;
|
|||
|
$realname = $user->realname;
|
|||
|
}
|
|||
|
?>
|
|||
|
<style>
|
|||
|
.tagInput {}
|
|||
|
.tagInputDiv {display:none;background-color:white;position:absolute;overflow:auto;border:1px solid lightgray;margin-top:-1px;}
|
|||
|
.tagInputLine {color:black;font-weight:normal;padding:4px;}
|
|||
|
.tagInputSel {background-color:gray;color:white;}
|
|||
|
.tagInputLineTag {min-width:150px;display:inline-block;}
|
|||
|
.tagInputLineFreq {min-width:50px;text-align:right;display:inline-block;float:right;}
|
|||
|
.tagInputSuggestedTags {font-size: 11px;}
|
|||
|
.tagInputSuggestedTags .label{display:block;background:0 none;color:#666;padding:0;margin-top:4px;}
|
|||
|
.tagInputSuggestedTagList{}
|
|||
|
.tagInputSuggestedTagList .tag{ padding:1px 4px;cursor:pointer;display:inline-block;margin:2px 1px;border:1px solid #bbb;}
|
|||
|
.tagInputSuggestedTagList span.tag:hover{background-color:#bbb;color:#fff;}
|
|||
|
.tagInputSuggestedTagList .tagUsed{border:1px solid #999;background-color:#999;color:#fff;}
|
|||
|
</style>
|
|||
|
<script type="text/javascript">
|
|||
|
/* sample tags */
|
|||
|
var tags=[
|
|||
|
{tag:"冻土",freq:30},{tag:"寒旱所",freq:25}, {tag:"大气",freq:10},{tag:"高原",freq:4},
|
|||
|
{tag:"西部",freq:3},{tag:"地理",freq:8}, {tag:"环境",freq:3},{tag:"地质",freq:20}
|
|||
|
];
|
|||
|
|
|||
|
$(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',
|
|||
|
fileManagerJson : '/plugins/file_manager_json.php',
|
|||
|
allowFileManager : true
|
|||
|
});
|
|||
|
});
|
|||
|
|
|||
|
/* tag input field */
|
|||
|
$("#keyword").tagInput({
|
|||
|
tags:tags,
|
|||
|
//jsonUrl:"tags.json",
|
|||
|
sortBy:"frequency",
|
|||
|
suggestedTags:["冻土","寒旱所","大气","高原","西部","环境"],
|
|||
|
tagSeparator:",",
|
|||
|
autoFilter:true,
|
|||
|
autoStart:false,
|
|||
|
//suggestedTagsPlaceHolder:$("#suggested"),
|
|||
|
boldify:true
|
|||
|
});
|
|||
|
});
|
|||
|
</script>
|
|||
|
<div id="leftPanel">
|
|||
|
<?= $this->partial('news/left.phtml'); ?>
|
|||
|
</div>
|
|||
|
<div id="rightPanel">
|
|||
|
<section class="column width6">
|
|||
|
|
|||
|
<h3>发布新闻</h3>
|
|||
|
|
|||
|
<form name="form" id="archivesadd" method="post" action="#">
|
|||
|
|
|||
|
<fieldset>
|
|||
|
<legend>新闻信息</legend>
|
|||
|
<input type="hidden" id="image" class="half title" value="" name="image"/>
|
|||
|
<p>
|
|||
|
<label class="required" for="producttitle">标题</label><br/>
|
|||
|
<input type="text" id="producttitle" class="half title" value="<?php echo $this->ev['title']; ?>" name="title"/>
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
<label class="required" for="writer">作者</label><br/>
|
|||
|
<input type="text" id="writer" class="half title" value="<?php echo $this->ev['author']; ?>" name="writer"/>
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
<label for="source" class="required">来源</label><br/>
|
|||
|
<input type="text" id="source" class="half title" value="<?php echo $this->ev['source']; ?>" name="source"/>
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
<label for="description">内容简介(描述)</label><br/>
|
|||
|
<textarea id="description" class="small half" name="description"><?php echo $this->ev['description']; ?></textarea>
|
|||
|
<small id="enablelen"></small>
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
<label for="body">新闻内容</label><br/>
|
|||
|
<textarea id="body" class="large full" name="body"><?php echo $this->ev['body']; ?></textarea>
|
|||
|
</p>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<div class="clearfix leading">
|
|||
|
<div class="column width3 first">
|
|||
|
<p>
|
|||
|
<label for="type" class="required">新闻栏目</label><br/>
|
|||
|
<select id="type" class="full" name="typeid">
|
|||
|
<option value="0">请选择栏目</option>
|
|||
|
<?php
|
|||
|
foreach($this->types as $v)
|
|||
|
{
|
|||
|
if($this->ev['typeid']==$v['id'])
|
|||
|
echo '<option value="'.$v['id'].'" selected="selected">'.$v['title'].'</option>';
|
|||
|
else
|
|||
|
echo '<option value="'.$v['id'].'">'.$v['title'].'</option>';
|
|||
|
}
|
|||
|
|
|||
|
?>
|
|||
|
</select>
|
|||
|
<small>e.g. 研究成果</small>
|
|||
|
</p>
|
|||
|
<p><a href="/admin/news/catlog/add/1" target="_blank">+ 添加新栏目</a></p>
|
|||
|
|
|||
|
<p>
|
|||
|
<select id="pub" class="full" name="pub">
|
|||
|
<option value="1" <?php if($this->ev['pub']>=1) echo 'selected="selected"'; ?>>立即发布</option>
|
|||
|
<option value="0" <?php if($this->ev['pub']==0) echo 'selected="selected"'; ?>>存草稿</option>
|
|||
|
<option value="-1" <?php if($this->ev['pub']<0) echo 'selected="selected"'; ?>>不发布</option>
|
|||
|
</select>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="column width3">
|
|||
|
<p>
|
|||
|
<input type="checkbox" id="pubtimeturn" name="pubtimer" value="1" /><label id="pubtimelable" for="productcat">定时发布?</label><br/>
|
|||
|
<input type="text" name="pubtime" id="pubtime" value="<?php echo date("Y-m-d H:i",strtotime($this->ev['ts_published']));?>" readonly="readonly" />
|
|||
|
<small>e.g. 2011-10-28 9:35 or 2011-10-28 21:35</small>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="content-box">
|
|||
|
<header>
|
|||
|
<h3>新闻标签</h3>
|
|||
|
</header>
|
|||
|
<section>
|
|||
|
输入Tag标签,多个用半角逗号 " , "隔开,每个Tag标签长度小于6个汉字
|
|||
|
<p><textarea id="keyword" class="small full" name="keyword"><?php echo $this->ev['keyword']; ?></textarea></p>
|
|||
|
</section>
|
|||
|
</div>
|
|||
|
<div id="return"></div>
|
|||
|
|
|||
|
<p class="box"><input type="button" onclick="addon();" id="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
|
|||
|
|
|||
|
</fieldset>
|
|||
|
|
|||
|
</form>
|
|||
|
</section>
|
|||
|
</div>
|
|||
|
<script type="text/javascript">
|
|||
|
$(function(){
|
|||
|
$("#pubtimeturn").click( function () {
|
|||
|
if($(this).is(":checked"))
|
|||
|
{
|
|||
|
$('#pubtimelable').html('定时发布时间');
|
|||
|
$('#pubtime').removeAttr('readonly');
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
$('#pubtimelable').html('定时发布?');
|
|||
|
$('#pubtime').attr("readonly","readonly");
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
function addon(){
|
|||
|
editor.sync();
|
|||
|
var url = "/admin/news/archivesedit/id/<?php echo $this->ev['id']; ?>";
|
|||
|
var data = $("#archivesadd").serialize()+'&keyword='+$('#keyword').val();
|
|||
|
$.ajax({
|
|||
|
type: "POST",
|
|||
|
url: url,
|
|||
|
data: data,
|
|||
|
success: function(html){
|
|||
|
$('#return').html(html);
|
|||
|
},
|
|||
|
beforeSend:function(){
|
|||
|
$('#submit').val('正在提交...');
|
|||
|
$('#submit').attr("disabled","disabled");
|
|||
|
},
|
|||
|
complete:function(){
|
|||
|
$('#submit').val('提交');
|
|||
|
$('#submit').removeAttr('disabled');
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
var limitNum = 200;
|
|||
|
var pattern = '还可以输入' + (limitNum-getByteLen($('#description').val())) + '字';
|
|||
|
$('#enablelen').html(pattern);
|
|||
|
$('#description').keyup(
|
|||
|
function() {
|
|||
|
var remain = getByteLen($(this).val());
|
|||
|
if (remain > limitNum) {
|
|||
|
var result = remain -limitNum;
|
|||
|
pattern = '字数超过限制,请适当删除部分内容(超出了'+result+'字)';
|
|||
|
}else{
|
|||
|
var result = limitNum - remain;
|
|||
|
pattern = '还可以输入' + result + '字';
|
|||
|
}
|
|||
|
$('#enablelen').html(pattern);
|
|||
|
}
|
|||
|
);
|
|||
|
function getByteLen(val) {
|
|||
|
var len = 0;
|
|||
|
for (var i = 0; i < val.length; i++) {
|
|||
|
if (val[i].match(/[^\x00-\xff]/ig) != null) //全角
|
|||
|
len += 2;
|
|||
|
else
|
|||
|
len += 1;
|
|||
|
}
|
|||
|
return len;
|
|||
|
}
|
|||
|
</script>
|