westdc-zf1/application/admin/views/scripts/data/ref-add.phtml

198 lines
8.0 KiB
PHTML

<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('文献管理');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,"uploadify");
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<?= $this->partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?>
</div>
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<form class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label" for="inputTitle">文章标题</label>
<div class="controls">
<input type="text" name="title" id="inputTitle" class="input-block-level" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputYear">出版年份</label>
<div class="controls">
<input type="text" name="year" id="inputYear" value="<?= isset($this->data['year']) ? $this->data['year']:"" ?>">
<select class="span2">
<?php for($i=2000;$i<=(int)date("Y");$i++) {?>
<option value="<?= $i ?>" onclick="$('#inputYear').val(this.value)"><?= $i ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputYear">出版社/期刊</label>
<div class="controls">
<input type="text" name="publisher" id="inputYear" class="input-block-level" value="<?= isset($this->data['publisher']) ? $this->data['publisher']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputReference">引用方式(前台显示)</label>
<div class="controls">
<textarea name="reference" id="inputReference" class="input-block-level"><?= isset($this->data['reference']) ? $this->data['reference']:"" ?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputLink">链接(自动填写请留空)</label>
<div class="controls">
<input type="text" name="link" id="inputLink" class="input-block-level" value="<?= isset($this->data['link']) ? $this->data['link']:"" ?>"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputType">类型</label>
<div class="controls">
<input type="text" name="type" id="inputType" class="input-block-level" value="<?= isset($this->data['type']) ? $this->data['type']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputLanguage">语言</label>
<div class="controls">
<input type="text" name="language" id="inputLanguage" class="input-block-level" value="<?= isset($this->data['language']) ? $this->data['language']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputDoi">DOI</label>
<div class="controls">
<input type="text" name="doi" id="inputDoi" class="input-block-level" value="<?= isset($this->data['doi']) ? $this->data['doi']:"" ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputBibtex">ris</label>
<div class="controls">
<textarea name="ris" id="inputBibtex" class="input-block-level"><?= isset($this->data['ris']) ? $this->data['ris']:"" ?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputAbstract">摘要</label>
<div class="controls">
<textarea name="abstract" id="inputAbstract" class="input-block-level"><?= isset($this->data['abstract']) ? $this->data['abstract']:"" ?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputNote">备注</label>
<div class="controls">
<textarea name="note" id="inputNote" class="input-block-level"><?= isset($this->data['note']) ? $this->data['note']:"" ?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPDF">PDF</label>
<div class="controls">
<input type="file" name="Filedata" id="file_upload" />
<div id="uploadedFile"></div>
</div>
</div>
<div class="form-actions">
<input type="hidden" name="submit" value="1" />
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="reset" class="btn">Cancel</button>
</div>
</form>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
$(document).ready(function(e) {
$('#btn-add-author').click(function(e) {
html = '';
$('#author_inputs').append('');
});
});
var _this = {
SessionID : '<?php echo session_id(); ?>'
};
var uploader;
var param;
param = {
"PHPSESSID" : _this.SessionID,
};
$(function() {
$('#file_upload').uploadify({
'swf' : '/js/lib/uploadify/uploadify.swf',
'uploader' : '/admin/data/ref/ac/pdfupload',
'multi' : false,
'auto' : true,
'fileTypeExts' : '*.pdf',
'onUploadSuccess' : function(file, data, response) {
upload.onsuccess(file, data, response);
},
'onUploadStart' : function(file) {
$('#file_upload').uploadify('settings','formData',param);
}
});
});
var upload = {
onsuccess : function(file, data, response){
_data = $.parseJSON(data);
if(!$.isEmptyObject(_data.error))
{
alert(_data.error);
}else{
$('#uploadedFile').html(upload.makeFileHtml(_data));
}
},
makeFileHtml : function(data){
return '<div class="alert alert-success">'
+'<button type="button" class="close" data-dismiss="alert" onclick="upload.deleteFile('+data.id+')"><i class="icon-trash icon-white"></i></button>'
+ data.realname
+'<input type="hidden" name="attid" value="'+data.id+'"></input>'
+'</div>';
},
deleteFile : function(id){
$.ajax({
'type':"POST",
'url':'/admin/data/ref/ac/delete',
'data':'attid=' + id,
'success':function(data){
if(typeof(data) == 'undefined')
{
alert("数据源错误,请联系管理员");
return false;
}
if(!$.isEmptyObject(data.error))
{
alert(data.error);
return false;
}
},
'timeout': 30000,
'error': function(){
alert('附件删除出错');
}
});
}
};
</script>
<?php if(isset($this->data['attid']) && !empty($this->data['attid'])){ ?>
<input type="hidden" id="reference_file_content" value='<?= json_encode($this->data['file']) ?>' />
<script>
upload.onsuccess('',$('#reference_file_content').val(),"");
</script>
<?php } ?>