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

203 lines
9.8 KiB
PHTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->headLink()->appendStylesheet('/css/admin.css');
$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">
<div class="hidden-sm hidden-xs col-md-2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="col-md-10 col-sm-12">
<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" class="form-horizontal">
<div class="col-md-8">
<p></p>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputTitle">文章标题</label>
<div class="col-md-10 col-sm-10">
<input type="text" name="title" id="inputTitle" class="form-control" value="<?= isset($this->data['title']) ? $this->data['title']:" " ?>">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputYear">出版年份</label>
<div class="col-md-10 col-sm-10">
<input class="form-control" 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="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputYear">出版社/期刊</label>
<div class="col-md-10 col-sm-10">
<input type="text" name="publisher" id="inputYear" class="form-control" value="<?= isset($this->data['publisher']) ? $this->data['publisher']:" " ?>">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputReference">引用方式(前台显示)</label>
<div class="col-md-10 col-sm-10">
<textarea name="reference" id="inputReference" class="form-control"><?= isset($this->data['reference']) ? $this->data['reference']:"" ?></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputLink">链接(自动填写请留空)</label>
<div class="col-md-10 col-sm-10">
<input type="text" name="link" id="inputLink" class="form-control" value="<?= isset($this->data['link']) ? $this->data['link']:" " ?>" />
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputType">类型</label>
<div class="col-md-10 col-sm-10">
<input type="text" name="type" id="inputType" class="form-control" value="<?= isset($this->data['type']) ? $this->data['type']:" " ?>">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputLanguage">语言</label>
<div class="col-md-10 col-sm-10">
<input type="text" name="language" id="inputLanguage" class="form-control" value="<?= isset($this->data['language']) ? $this->data['language']:" " ?>">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputDoi">DOI</label>
<div class="col-md-10 col-sm-10">
<input type="text" name="doi" id="inputDoi" class="form-control" value="<?= isset($this->data['doi']) ? $this->data['doi']:" " ?>">
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputBibtex">ris</label>
<div class="col-md-10 col-sm-10">
<textarea name="ris" id="inputBibtex" class="form-control"><?= isset($this->data['ris']) ? $this->data['ris']:"" ?></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputAbstract">摘要</label>
<div class="col-md-10 col-sm-10">
<textarea name="abstract" id="inputAbstract" class="form-control"><?= isset($this->data['abstract']) ? $this->data['abstract']:"" ?></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputNote">备注</label>
<div class="col-md-10 col-sm-10">
<textarea name="note" id="inputNote" class="form-control"><?= isset($this->data['note']) ? $this->data['note']:"" ?></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 control-label" for="inputPDF">PDF</label>
<div class="col-md-10 col-sm-10">
<input type="file" name="Filedata" id="file_upload" />
<div id="uploadedFile"></div>
</div>
</div>
<div class="form-group">
<div class="col-md-2 col-sm-2"></div>
<div class="col-md-5 col-sm-5">
<input type="hidden" name="submit" value="1" />
<button type="submit" class="btn btn-primary">保存</button>
<button type="reset" class="btn btn-default">取消</button>
</div>
</div>
</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;*.caj',
'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 } ?>