mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-21 22:27:23 +03:00
purge old conversations
This commit is contained in:
parent
2ff5ea3fb6
commit
9fae2d17bd
@ -19,6 +19,7 @@ button.online.top=Site consultant
|
|||||||
button.online=ONLINE
|
button.online=ONLINE
|
||||||
button.save=Save
|
button.save=Save
|
||||||
button.search=Search
|
button.search=Search
|
||||||
|
button.purge=Permanently delete selected conversations!
|
||||||
canned.actions.del=remove
|
canned.actions.del=remove
|
||||||
canned.actions.edit=edit
|
canned.actions.edit=edit
|
||||||
canned.actions=Modify
|
canned.actions=Modify
|
||||||
@ -244,6 +245,8 @@ menu.notifications=Notifications
|
|||||||
menu.operator=You are {0}
|
menu.operator=You are {0}
|
||||||
menu.profile.content=You can change your personal information on this page.
|
menu.profile.content=You can change your personal information on this page.
|
||||||
menu.profile=Profile
|
menu.profile=Profile
|
||||||
|
menu.purge.content=Remove old conversations.
|
||||||
|
menu.purge=Purge
|
||||||
menu.translate=Localize
|
menu.translate=Localize
|
||||||
menu.updates.content=Check for news and updates.
|
menu.updates.content=Check for news and updates.
|
||||||
menu.updates=Updates
|
menu.updates=Updates
|
||||||
@ -425,6 +428,8 @@ presurvey.name=Name:
|
|||||||
presurvey.question=Initial Question:
|
presurvey.question=Initial Question:
|
||||||
presurvey.submit=Start Chat
|
presurvey.submit=Start Chat
|
||||||
presurvey.title=Live support
|
presurvey.title=Live support
|
||||||
|
purge.search=Enter dates to search from and to:
|
||||||
|
purge.title=Purge
|
||||||
report.bydate.1=Date
|
report.bydate.1=Date
|
||||||
report.bydate.2=Chat threads
|
report.bydate.2=Chat threads
|
||||||
report.bydate.3=Messages from operators
|
report.bydate.3=Messages from operators
|
||||||
|
86
src/mibew/operator/purge.php
Normal file
86
src/mibew/operator/purge.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright 2005-2014 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once('../libs/common.php');
|
||||||
|
require_once('../libs/operator.php');
|
||||||
|
require_once('../libs/chat.php');
|
||||||
|
require_once('../libs/userinfo.php');
|
||||||
|
require_once('../libs/pagination.php');
|
||||||
|
|
||||||
|
$operator = check_login();
|
||||||
|
loadsettings();
|
||||||
|
|
||||||
|
setlocale(LC_TIME, getstring("time.locale"));
|
||||||
|
|
||||||
|
if (isset($_POST['thread'])) {
|
||||||
|
foreach ($_POST['thread'] as $t) {
|
||||||
|
if (! is_numeric($t)) {
|
||||||
|
die("Non-numeric thread id???");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$link = connect();
|
||||||
|
$threads = implode(",", $_POST['thread']);
|
||||||
|
mysql_query("delete from ${mysqlprefix}chatmessage where threadid in ($threads);");
|
||||||
|
mysql_query("delete from ${mysqlprefix}chatthread where threadid in ($threads);");
|
||||||
|
}
|
||||||
|
|
||||||
|
$page = array();
|
||||||
|
$page['formstart'] = $_GET['start'];
|
||||||
|
$page['formend'] = $_GET['end'];
|
||||||
|
|
||||||
|
$start = strlen($_GET['start']) ? strtotime(myiconv(getoutputenc(), $mibew_encoding, $_GET['start'])) : false;
|
||||||
|
$end = strlen($_GET['end']) ? strtotime(myiconv(getoutputenc(), $mibew_encoding, $_GET['end'])) : false;
|
||||||
|
|
||||||
|
if ($start !== false || $end !== false) {
|
||||||
|
$link = connect();
|
||||||
|
|
||||||
|
$result = mysql_query("select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname " .
|
||||||
|
"from ${mysqlprefix}chatgroup order by vclocalname", $link);
|
||||||
|
$groupName = array();
|
||||||
|
while ($group = mysql_fetch_array($result, MYSQL_ASSOC)) {
|
||||||
|
$groupName[$group['groupid']] = $group['vclocalname'];
|
||||||
|
}
|
||||||
|
mysql_free_result($result);
|
||||||
|
$page['groupName'] = $groupName;
|
||||||
|
|
||||||
|
$queryArray = array("${mysqlprefix}chatmessage.threadid = ${mysqlprefix}chatthread.threadid");
|
||||||
|
if ($start !== false) {
|
||||||
|
$queryArray[]= sprintf("unix_timestamp(${mysqlprefix}chatthread.dtmcreated) >= %d", $start);
|
||||||
|
}
|
||||||
|
if ($end !== false) {
|
||||||
|
$queryArray[]= sprintf("unix_timestamp(${mysqlprefix}chatthread.dtmcreated) < %d", $end);
|
||||||
|
}
|
||||||
|
|
||||||
|
select_with_pagintation("DISTINCT unix_timestamp(${mysqlprefix}chatthread.dtmcreated) as created, " .
|
||||||
|
"unix_timestamp(${mysqlprefix}chatthread.dtmmodified) as modified, ${mysqlprefix}chatthread.threadid, " .
|
||||||
|
"${mysqlprefix}chatthread.remote, ${mysqlprefix}chatthread.agentName, ${mysqlprefix}chatthread.userName, groupid, " .
|
||||||
|
"messageCount as size",
|
||||||
|
"${mysqlprefix}chatthread, ${mysqlprefix}chatmessage",
|
||||||
|
$queryArray,
|
||||||
|
"order by created DESC",
|
||||||
|
"DISTINCT ${mysqlprefix}chatthread.dtmcreated", $link);
|
||||||
|
|
||||||
|
mysql_close($link);
|
||||||
|
} else {
|
||||||
|
setup_empty_pagination();
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare_menu($operator);
|
||||||
|
start_html_output();
|
||||||
|
require('../view/thread_purge_search.php');
|
||||||
|
?>
|
@ -59,6 +59,9 @@ function tpl_menu() { global $page, $mibewroot, $errors;
|
|||||||
<li<?php menuli("translate")?>><a href="<?php echo $mibewroot ?>/operator/translate.php"><?php echo getlocal('menu.translate') ?></a></li>
|
<li<?php menuli("translate")?>><a href="<?php echo $mibewroot ?>/operator/translate.php"><?php echo getlocal('menu.translate') ?></a></li>
|
||||||
<li<?php menuli("updates")?>><a href="<?php echo $mibewroot ?>/operator/updates.php"><?php echo getlocal('menu.updates') ?></a></li>
|
<li<?php menuli("updates")?>><a href="<?php echo $mibewroot ?>/operator/updates.php"><?php echo getlocal('menu.updates') ?></a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<?php if(isset($page['showadmin']) && $page['showadmin']) { ?>
|
||||||
|
<li<?php menuli("purge")?>><a href="<?php echo $mibewroot ?>/operator/purge.php"><?php echo getlocal('menu.purge') ?></a></li>
|
||||||
|
<?php } ?>
|
||||||
<?php if(isset($page['showadmin']) && $page['showadmin'] || isset($page['shownotifications']) && $page['shownotifications']) { ?>
|
<?php if(isset($page['showadmin']) && $page['showadmin'] || isset($page['shownotifications']) && $page['shownotifications']) { ?>
|
||||||
<li<?php menuli("notifications")?>><a href="<?php echo $mibewroot ?>/operator/notifications.php"><?php echo getlocal('menu.notifications') ?></a></li>
|
<li<?php menuli("notifications")?>><a href="<?php echo $mibewroot ?>/operator/notifications.php"><?php echo getlocal('menu.notifications') ?></a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -163,6 +163,16 @@ $menuItemsCount = 2;
|
|||||||
<?php menuseparator(); ?>
|
<?php menuseparator(); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if( $page['showadmin'] ) { ?>
|
||||||
|
<td class="dashitem">
|
||||||
|
<img src="<?php echo $mibewroot ?>/images/dash/warn.gif" alt=""/>
|
||||||
|
<a href="<?php echo $mibewroot ?>/operator/purge.php">
|
||||||
|
<?php echo getlocal('menu.purge') ?></a>
|
||||||
|
<?php echo getlocal('menu.purge.content') ?>
|
||||||
|
</td>
|
||||||
|
<?php menuseparator(); ?>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?php if( $page['showadmin'] || $page['shownotifications'] ) { ?>
|
<?php if( $page['showadmin'] || $page['shownotifications'] ) { ?>
|
||||||
<td class="dashitem">
|
<td class="dashitem">
|
||||||
<img src="<?php echo $mibewroot ?>/images/dash/notifications.gif" alt=""/>
|
<img src="<?php echo $mibewroot ?>/images/dash/notifications.gif" alt=""/>
|
||||||
|
143
src/mibew/view/thread_purge_search.php
Normal file
143
src/mibew/view/thread_purge_search.php
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright 2005-2014 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once("inc_menu.php");
|
||||||
|
$page['title'] = getlocal("purge.title");
|
||||||
|
$page['menuid'] = "purge";
|
||||||
|
|
||||||
|
function tpl_content() { global $page, $mibewroot;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<form name="searchForm" method="get" action="<?php echo $mibewroot ?>/operator/purge.php">
|
||||||
|
<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">
|
||||||
|
|
||||||
|
<div class="fieldForm">
|
||||||
|
<div class="field">
|
||||||
|
<div class="flabel"><?php echo getlocal("purge.search") ?></div>
|
||||||
|
<div class="fvaluenodesc">
|
||||||
|
<div>
|
||||||
|
<input type="text" name="start" size="20" value="<?php echo(strlen(form_value('start')) ? form_value('start') : '1 Jan 1970') ?>" /> …
|
||||||
|
<input type="text" name="end" size="20" value="<?php echo(strlen(form_value('end')) ? form_value('end') : 'Yesterday') ?>"/>
|
||||||
|
</div>
|
||||||
|
<div id="searchbutton">
|
||||||
|
<input type="image" name="search" src="<?php echo $mibewroot . safe_htmlspecialchars(getlocal("image.button.search")) ?>" alt="<?php echo safe_htmlspecialchars(getlocal("button.search")) ?>"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br clear="all"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div><div class="formbottom"><div class="formbottomi"></div></div></div>
|
||||||
|
</form>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if( $page['pagination'] ) { ?>
|
||||||
|
|
||||||
|
<form name="searchForm" method="post" action="<?php echo $mibewroot ?>/operator/purge.php">
|
||||||
|
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr class="header">
|
||||||
|
<th>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function toggle_all (truth) {
|
||||||
|
var inputs = document.getElementsByTagName('input');
|
||||||
|
for (var i = 0; i < inputs.length; i++) {
|
||||||
|
var input = inputs[i];
|
||||||
|
if (input.name == 'thread[]') {
|
||||||
|
input.checked = truth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.write('<input type="checkbox" onclick="toggle_all(this.checked)">');
|
||||||
|
</script>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<?php echo getlocal("page.analysis.search.head_name") ?>
|
||||||
|
</th><th>
|
||||||
|
<?php echo getlocal("page.analysis.search.head_host") ?>
|
||||||
|
</th><th>
|
||||||
|
<?php echo getlocal("page.analysis.search.head_operator") ?>
|
||||||
|
</th><th>
|
||||||
|
<?php echo getlocal("page.analysis.search.head_messages") ?>
|
||||||
|
</th><th>
|
||||||
|
<?php echo getlocal("page.analysis.search.head_time") ?>
|
||||||
|
</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
if( $page['pagination.items'] ) {
|
||||||
|
foreach( $page['pagination.items'] as $chatthread ) { ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" name="thread[]" value="<?php echo $chatthread['threadid'] ?>">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="<?php echo $mibewroot ?>/operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']) ?>" target="_blank" onclick="this.newWindow = window.open('<?php echo $mibewroot ?>/operator/threadprocessor.php?threadid=<?php echo urlencode($chatthread['threadid']) ?>', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php echo topage(safe_htmlspecialchars($chatthread['userName'])) ?></a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php echo get_user_addr(topage($chatthread['remote'])) ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if( $chatthread['agentName'] ) {
|
||||||
|
echo topage(safe_htmlspecialchars($chatthread['agentName']));
|
||||||
|
} else if($chatthread['groupid'] && $chatthread['groupid'] != 0 && isset($page['groupName'][$chatthread['groupid']])) {
|
||||||
|
echo "- ".topage(safe_htmlspecialchars($page['groupName'][$chatthread['groupid']]))." -";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php echo topage(safe_htmlspecialchars($chatthread['size'])) ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php echo date_diff_to_text($chatthread['modified']-$chatthread['created']) ?>, <?php echo date_to_text($chatthread['created']) ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5">
|
||||||
|
<?php echo getlocal("tag.pagination.no_items") ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p><input type="submit" value="<?php echo safe_htmlspecialchars(getlocal("button.purge")) ?>"/></p>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if( $page['pagination.items'] ) {
|
||||||
|
echo "<br/>";
|
||||||
|
echo generate_pagination($page['pagination']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} /* content */
|
||||||
|
|
||||||
|
require_once('inc_main.php');
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user