Commit c94a42f0 authored by winddramon's avatar winddramon

insite message system v0.2

增加了彻底删除功能,现在应该差不多了
parent 86908ee2
......@@ -10,7 +10,7 @@ $messages_autocreatedb = 1;//自动建表功能,一个很丑陋的开关
//判定是邮箱页面还是垃圾箱页面,并拉取对应的站内信数据
function init_messages($mode){
if('showdel' == $mode || 'recover' == $mode) {
if('showdel' == $mode || 'recover' == $mode || 'del2' == $mode) {
return deleted_message_load();
}else{
return message_load();
......
......@@ -22,7 +22,6 @@ $messages = init_messages($mode);
$editflag = 0;
$info = array();
if($mode == 'del' || $mode == 'del2') {//删除
$dellist = array();
foreach(array_keys($messages) as $mi){
......@@ -63,20 +62,22 @@ if($editflag) {
}
if(!empty($dellist)){
$ins_arr = array();
foreach($dellist as $di){
$tmp = $messages[$di];
$tmp['dtimestamp'] = $now;
unset($tmp['mid']);
$ins_arr[] = $tmp;
if('del'==$mode) {//正常删除会添加到垃圾箱
foreach($dellist as $di){
$tmp = $messages[$di];
$tmp['dtimestamp'] = $now;
unset($tmp['mid']);
$ins_arr[] = $tmp;
}
if(!empty($ins_arr)) $db->array_insert("{$gtablepre}del_messages", $ins_arr);
}
if(!empty($ins_arr)) $db->array_insert("{$gtablepre}del_messages", $ins_arr);
$delc = implode(',',$dellist);
if('del' == $mode){
$db->query("DELETE FROM {$gtablepre}messages WHERE mid IN ($delc) AND receiver='$username'");
$dnum = $db->affected_rows();
$info[] = '已删除'.$dnum.'条消息!';
}elseif('del2' == $mode){
$db->query("DELETE FROM {$gtablepre}dmessages WHERE mid IN ($delc) AND receiver='$username'");
$db->query("DELETE FROM {$gtablepre}del_messages WHERE mid IN ($delc) AND receiver='$username'");
$dnum = $db->affected_rows();
$info[] = '已彻底删除'.$dnum.'条消息!';
}
......@@ -95,7 +96,9 @@ if($editflag) {
$rnum = $db->affected_rows();
$info[] = '已恢复'.$rnum.'条消息!';
}
if('recover' == $mode || 'del2' == $mode){//删除或者恢复命令,显示的是垃圾桶页面
$mode = 'showdel';
}
//重载一次信息
$messages = init_messages($mode);
}elseif(strpos($mode,'show') !== 0 && empty($info)){
......
<div style="position:relative">
<div id="loading"></div>
<div>
<!--{if 'showdel' == $mode && empty($info) }--><div class="grey b">系统会定期清空垃圾箱中1个月以上的邮件</div><!--{/if}-->
<!--{if 'showdel' == $mode && empty($info) }--><div><span class="yellow b">当前在垃圾箱。</span></div><!--{/if}-->
<!--{if 'showdel' == $mode || 'recover' == $mode}-->
<div style="display:inline-block;width:160px"></div>
<input type="button" class="b_button bc_black" value="返回邮箱" onclick="$('mode').value='showmail';postCmd('message_cmd', 'messages.php');this.disabled=true;" />&nbsp;&nbsp;&nbsp;
<!--{if !empty($messages)}-->
<!--<input type="button" class="b_button bc_black" value="全选/反选" onclick="jQuery('.message_sl').each(function(){this.click();});" />-->
<input type="button" class="b_button bc_black" value="全选/反选" onclick="jQuery('.message_sl').each(function(){this.click();});" />&nbsp;
<input type="button" class="b_button bc_black" style="width:114px" value="恢复" onclick="
var recflag=0;
jQuery('.message_sl').each(function(){
if(this.checked){recflag=1;return false;}
if(this.checked)recflag=1;
this.value=this.checked?1:0;
});
if(recflag){
if($('mode').value!='recover') {
$('rec_confirm').style.display='inline';
$('del2_confirm').style.display='none';
this.value='确认恢复';
$('mode').value='recover';
}else{
......@@ -23,10 +25,32 @@
$('mode').value='';
}
}
" />&nbsp;
<input type="button" class="b_button bc_black" style="width:114px" value="彻底删除" onclick="
var del2flag=0;
jQuery('.message_sl').each(function(){
if(this.checked)del2flag=1;
this.value=this.checked?1:0;
});
if(del2flag){
if($('mode').value!='del2') {
$('del2_confirm').style.display='inline';
$('rec_confirm').style.display='none';
this.value='确认删除';
$('mode').value='del2';
}else{
$('del2_confirm').style.display='none';
postCmd('message_cmd', 'messages.php');this.disabled=true;
$('mode').value='';
}
}
" />
<!--{/if}-->
<div style="display:inline-block;width:160px"><span class="yellow b" id="rec_confirm" style="display:none">每条{$message_rec_cost}切糕,确认恢复?</span></div>
<div style="display:inline-block;width:160px">
<span class="yellow b" id="rec_confirm" style="display:none">每条{$message_rec_cost}切糕,确认恢复?</span>
<span class="yellow b" id="del2_confirm" style="display:none">确认彻底删除?</span>
</div>
<!--{else}-->
<div style="display:inline-block;width:80px"></div>
<input type="button" class="b_button bc_black" value="查看已删邮件" onclick="$('mode').value='showdel';postCmd('message_cmd', 'messages.php');this.disabled=true;" />&nbsp;&nbsp;&nbsp;
......@@ -36,7 +60,8 @@
<input type="button" class="b_button bc_black" style="width:114px" value="删除" onclick="
var delflag=0;
jQuery('.message_sl').each(function(){
if(this.checked){delflag=1;return false;}
if(this.checked)delflag=1;
this.value=this.checked?1:0;
});
if(delflag){
if($('mode').value!='del') {
......@@ -67,7 +92,7 @@
<div class="message_box" onclick="$('message_sl$mi').click();if($('message_sl$mi').checked) {$('sign$mi').style.display='block';} else {$('sign$mi').style.display='none';}">
<div class="message_title_bar">
<img id="sign$mi" class="message_sign" src="img/message_sl_sign.png">
<input type="checkbox" name="sl$mi" id="message_sl$mi" style="display:none" class="message_sl" value="0" onclick="this.value=this.checked?1:0;"/>
<input type="checkbox" name="sl$mi" id="message_sl$mi" style="display:none" class="message_sl" value="0" />
<span class="message_title">$mv['title']</span> <div class="message_hint">$mv['hint']</div>
</div>
<div class="message_cont"><span>$mv['content']</span></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment