2013-05-06 09:01:14 +00:00
|
|
|
$(document).ready(function(e) {
|
|
|
|
$('.edit').click(function(e) {
|
|
|
|
$(this).litedit({'id':$(this).attr('rel')});
|
|
|
|
});
|
|
|
|
$('.order').click(function(e) {
|
|
|
|
$(this).litorder({'id':$(this).attr('rel')});
|
|
|
|
});
|
2014-06-06 01:02:29 +00:00
|
|
|
$('.insert').click(function(e) {
|
|
|
|
$(this).litinsert({'id':$(this).attr('rel'),'uuid':$(this).attr('uuid')});
|
|
|
|
});
|
2013-05-06 09:01:14 +00:00
|
|
|
});
|
|
|
|
// JavaScript Document
|
|
|
|
(function( $ ){
|
|
|
|
|
|
|
|
$.fn.litedit = function( options ) {
|
|
|
|
|
|
|
|
var settings = $.extend( {
|
|
|
|
id:'',
|
|
|
|
content : '',
|
2013-06-29 14:40:59 +00:00
|
|
|
uuid:''
|
2013-05-06 09:01:14 +00:00
|
|
|
}, options);
|
|
|
|
|
|
|
|
var methods = {
|
|
|
|
edit : function(id)
|
|
|
|
{
|
|
|
|
methods.creatWindow(id);
|
|
|
|
},
|
2013-06-29 14:40:59 +00:00
|
|
|
creatWindow : function(id,html){
|
2013-05-06 09:01:14 +00:00
|
|
|
$.colorbox({
|
|
|
|
initialHeight: '0',
|
|
|
|
initialWidth: '0',
|
2013-06-29 14:40:59 +00:00
|
|
|
html: html,
|
2013-05-06 09:01:14 +00:00
|
|
|
opacity: '0.3',
|
|
|
|
onComplete: function(){
|
|
|
|
$('.confirm_yes').click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
methods.submited(id);
|
|
|
|
$.colorbox.close();
|
|
|
|
});
|
|
|
|
$('.confirm_no').click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
$.colorbox.close();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
submited : function(id){
|
|
|
|
$.ajax({
|
|
|
|
'type':"POST",
|
|
|
|
'url':'/author/literature/',
|
2013-06-29 14:40:59 +00:00
|
|
|
'data':'ac=edit&'+$('#edit-mdref').serialize(),
|
2013-05-06 09:01:14 +00:00
|
|
|
'success':function(data){
|
|
|
|
if (typeof(data)=='object')
|
|
|
|
{
|
|
|
|
if(typeof(data.error)!='undefined')
|
|
|
|
{alert(data.error);}
|
|
|
|
if(typeof(data.success)!='undefined')
|
|
|
|
{
|
|
|
|
window.location.reload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
alert('出现错误,请稍候再试');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'timeout': 30000,
|
|
|
|
'error': function(){
|
|
|
|
alert('出现错误,请刷新后重试');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2013-06-29 14:40:59 +00:00
|
|
|
loadinfo : function(id){
|
|
|
|
$.ajax({
|
|
|
|
'type':"POST",
|
|
|
|
'url':'/author/literature/',
|
|
|
|
'data':'ac=get&id='+id,
|
|
|
|
'success':function(data){
|
|
|
|
html = methods.dialog(data);
|
|
|
|
methods.creatWindow(id,html);
|
|
|
|
},
|
|
|
|
'timeout': 30000,
|
|
|
|
'error': function(){
|
|
|
|
alert('出现错误,请刷新后重试');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
dialog : function(data){
|
2013-05-06 09:01:14 +00:00
|
|
|
HTML = '<div class=""><div class="modal-header"><h3>修改文献</h3></div>'
|
2013-06-29 14:40:59 +00:00
|
|
|
+ '<div class="modal-body"><form id="edit-mdref">'
|
|
|
|
+ '<div><textarea class="span8" id="content_input_area" name="content">'+data.reference+'</textarea></div>'
|
|
|
|
+ '<div><input type="text" name="link" value="'+((data.link == null) ? "":data.link)+'" class="span8" placeholder="链接" /></div>'
|
|
|
|
+ '<div><label class="radio"><input type="radio" name="reftype" value="0" '+ ((data.reftype == 0) ? "checked":"") +'>作者文献</label></div>'
|
|
|
|
+ '<div><label class="radio"><input type="radio" name="reftype" value="1" '+ ((data.reftype == 1) ? "checked":"") +'>用户文献</label></div>'
|
|
|
|
+ '<div><label class="radio"><input type="radio" name="reftype" value="2" '+ ((data.reftype == 2) ? "checked":"") +'>数据的参考文献</label></div>'
|
|
|
|
+ '<div><label class="radio"><input type="radio" name="reftype" value="3" '+ ((data.reftype == 3) ? "checked":"") +'>作者要求的文献引用方式(多篇)</label></div>'
|
|
|
|
+ '<input type="hidden" name="refid" value="'+data.refid+'" />'
|
|
|
|
+ '<input type="hidden" name="uuid" value="'+settings.uuid+'" />'
|
|
|
|
+ '<input type="hidden" name="id" value="'+settings.id+'" />'
|
|
|
|
+ '</form></div>'
|
2013-05-06 09:01:14 +00:00
|
|
|
+ '<div class="modal-footer"><a href="javascript:void(0);" class="btn btn-primary confirm_yes">是</a><a href="javascript:void(0);" class="btn confirm_no">否</a></div></div>';
|
|
|
|
return HTML;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.each(function() {
|
|
|
|
if( settings.id == '')
|
|
|
|
{
|
|
|
|
alert('参数错误');
|
|
|
|
}
|
|
|
|
|
2013-06-29 14:40:59 +00:00
|
|
|
settings.uuid = $(this).attr('rev');
|
2013-05-06 09:01:14 +00:00
|
|
|
|
2013-06-29 14:40:59 +00:00
|
|
|
methods.loadinfo(settings.id);
|
2013-05-06 09:01:14 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
})( jQuery );
|
|
|
|
|
|
|
|
(function( $ ){
|
|
|
|
|
|
|
|
$.fn.litorder = function( options ) {
|
|
|
|
|
|
|
|
var settings = $.extend( {
|
|
|
|
id:'',
|
|
|
|
order : '',
|
|
|
|
}, options);
|
|
|
|
|
|
|
|
var methods = {
|
|
|
|
edit : function(id)
|
|
|
|
{
|
|
|
|
methods.creatWindow(id);
|
|
|
|
},
|
|
|
|
creatWindow : function(id){
|
|
|
|
$.colorbox({
|
|
|
|
initialHeight: '0',
|
|
|
|
initialWidth: '0',
|
|
|
|
html: methods.dialog,
|
|
|
|
opacity: '0.3',
|
|
|
|
onComplete: function(){
|
|
|
|
$('.confirm_yes').click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
methods.submited(id);
|
|
|
|
$.colorbox.close();
|
|
|
|
});
|
|
|
|
$('.confirm_no').click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
$.colorbox.close();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
submited : function(id){
|
|
|
|
$.ajax({
|
|
|
|
'type':"POST",
|
|
|
|
'url':'/author/literature/',
|
|
|
|
'data':'ac=order&id='+id+'&order='+$('#order_input').val(),
|
|
|
|
'success':function(data){
|
|
|
|
if (typeof(data)=='object')
|
|
|
|
{
|
|
|
|
if(typeof(data.error)!='undefined')
|
|
|
|
{alert(data.error);}
|
|
|
|
if(typeof(data.success)!='undefined')
|
|
|
|
{
|
|
|
|
window.location.reload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
alert('出现错误,请稍候再试');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'timeout': 30000,
|
|
|
|
'error': function(){
|
|
|
|
alert('出现错误,请刷新后重试');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
dialog : function(content){
|
|
|
|
HTML = '<div class=""><div class="modal-header"><h3>修改排序</h3></div>'
|
|
|
|
+ '<div class="modal-body">数字越小排序越靠前<br />'
|
|
|
|
+ '请输入排序数字<input type="text" id="order_input" value="'+settings.order+'"/></div>'
|
|
|
|
+ '<div class="modal-footer"><a href="javascript:void(0);" class="btn btn-primary confirm_yes">是</a><a href="javascript:void(0);" class="btn confirm_no">否</a></div></div>';
|
|
|
|
return HTML;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.each(function() {
|
|
|
|
if( settings.id == '')
|
|
|
|
{
|
|
|
|
alert('参数错误');
|
|
|
|
}
|
|
|
|
settings.order = $(this).attr('rev');
|
|
|
|
methods.edit(settings.id);
|
|
|
|
});
|
|
|
|
|
2014-06-06 01:02:29 +00:00
|
|
|
};
|
|
|
|
})( jQuery );
|
|
|
|
|
|
|
|
(function( $ ){
|
|
|
|
|
|
|
|
$.fn.litinsert = function( options ) {
|
|
|
|
|
|
|
|
var settings = $.extend( {
|
|
|
|
id:'',
|
|
|
|
order : '',
|
|
|
|
uuid:'',
|
|
|
|
}, options);
|
|
|
|
|
|
|
|
var methods = {
|
|
|
|
edit : function(id,uuid)
|
|
|
|
{
|
|
|
|
methods.creatWindow(id,uuid);
|
|
|
|
},
|
|
|
|
creatWindow : function(id,uuid){
|
|
|
|
$.colorbox({
|
|
|
|
initialHeight: '0',
|
|
|
|
initialWidth: '0',
|
|
|
|
html: methods.dialog,
|
|
|
|
opacity: '0.3',
|
|
|
|
onComplete: function(){
|
|
|
|
$('.confirm_yes').click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
methods.submited(id,uuid);
|
|
|
|
$.colorbox.close();
|
|
|
|
});
|
|
|
|
$('.confirm_no').click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
$.colorbox.close();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
submited : function(id,uuid){
|
|
|
|
$.ajax({
|
|
|
|
'type':"POST",
|
|
|
|
'url':'/author/literature/',
|
|
|
|
'data':'ac=insert&id='+id+'&uuid='+uuid+'&order='+$('#order_input').val(),
|
|
|
|
'success':function(data){
|
|
|
|
if (typeof(data)=='object')
|
|
|
|
{
|
|
|
|
if(typeof(data.error)!='undefined')
|
|
|
|
{alert(data.error);}
|
|
|
|
if(typeof(data.success)!='undefined')
|
|
|
|
{
|
|
|
|
window.location.reload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
alert('出现错误,请稍候再试');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'timeout': 30000,
|
|
|
|
'error': function(){
|
|
|
|
alert('出现错误,请刷新后重试');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
dialog : function(content){
|
|
|
|
HTML = '<div class=""><div class="modal-header"><h3>添加文献并修改排序</h3></div>'
|
|
|
|
+ '<div class="modal-body">数字越小排序越靠前<br />'
|
|
|
|
+ '请输入排序数字<input type="text" id="order_input" value="'+settings.order+'"/></div>'
|
|
|
|
+ '<div class="modal-footer"><a href="javascript:void(0);" class="btn btn-primary confirm_yes">是</a><a href="javascript:void(0);" class="btn confirm_no">否</a></div></div>';
|
|
|
|
return HTML;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.each(function() {
|
|
|
|
if( settings.id == '')
|
|
|
|
{
|
|
|
|
alert('参数错误');
|
|
|
|
}
|
|
|
|
settings.order = $(this).attr('rev');
|
|
|
|
settings.uuid = $(this).attr('uuid');
|
|
|
|
methods.edit(settings.id,settings.uuid);
|
|
|
|
});
|
|
|
|
|
2013-05-06 09:01:14 +00:00
|
|
|
};
|
|
|
|
})( jQuery );
|