时间:2021-07-01 10:21:17 帮助过:5人阅读
//化蝶自在飞 add 2011-11-12 自动保存数据
var timer = counttimer = '30';//每?秒保存一次
var delays = 10;//延迟多少秒执行,因为firefox下无法显示,建议设置为10000
var editorid = 'content';
var fromid = 'myform';
$(function(){
var str = '恢复数据'+timer+'秒后自动保存';
setTimeout('$(".cke_footer").append(\''+str+'\')',delays*1000);
setInterval('tuzwu_posts()',timer*1000);
setInterval('tuzwu_timer()',1000);
});
function tuzwu_posts(){ //post提交数据
var editor = CKEDITOR.instances[editorid];
data = editor.getData();
$('#'+editorid).val(data);
$.post("api.php?op=editor_data", $("#"+fromid).serializeArray(),function(data){
$('#'+editorid).val();
});
}
function tuzwu_timer(){ //每秒执行1次,倒数计时
if(timer<=0) timer = counttimer;
$('#tuzwu_timer').html(--timer);
}
function open_databak(){
omnipotent('databak_area','?m=content&c=databak&a=init&target=dialog','恢复数据',1,600,400);
}
CREATE TABLE `v9_editor_data` ( `id` mediumint(8) NOT NULL auto_increment, `data` mediumtext character set gbk NOT NULL COMMENT '数据', `time` int(10) NOT NULL, `userid` mediumint(8) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
db_config = pc_base::load_config('database'); $this->db_setting = 'default'; $this->table_name = 'editor_data'; parent::__construct(); } } ?>
$postdata, 'userid'=>$_userid, 'time'=>SYS_TIME ); $r = $db->get_one( array('userid'=>$_userid,'data'=>$postdata),'id' );//如果没有改变就不用备份 if($r) exit('0'); $db->insert($posts); exit('1'); ?>
db = pc_base::load_model('editor_data_model'); $this->_userid = param::get_cookie('userid')?param::get_cookie('userid'):param::get_cookie('admin_userid'); $this->_username = param::get_cookie('_username'); $this->_groupid = param::get_cookie('_groupid'); } public function init() { if(!$this->_userid) exit('用户ID校验失败'); $page = $_GET['page']?$_GET['page']:1; $infos = $this->db->listinfo( array('userid'=>$this->_userid),'time DESC',$page,20,'',10 ); $pages = $this->db->pages; $target = $_GET['target']; include $this->admin_tpl('databak'); } } ?>
class="addbg">reset.css" rel="stylesheet" type="text/css" /> -system.css" rel="stylesheet" type="text/css" /> table_form.css" rel="stylesheet" type="text/css" /> dialog.css" rel="stylesheet" type="text/css" /> style/-styles1.css" title="styles1" media="screen" /> style/-styles2.css" title="styles2" media="screen" /> style/-styles3.css" title="styles3" media="screen" /> style/-styles4.css" title="styles4" media="screen" /> 备份生成时间 标题 by 化蝶自在飞