Skip to content

Commit 2a5d2f6

Browse files
committed
Frontend part from 5374-mail-last-accessed branch
1 parent 7c9b206 commit 2a5d2f6

File tree

11 files changed

+38
-2
lines changed

11 files changed

+38
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
ALTER TABLE `mail_user` ADD `last_access` timestamp NULL DEFAULT NULL after `disabledoveadm`;

install/sql/ispconfig3.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,7 @@ CREATE TABLE `mail_user` (
10961096
`disablelda` enum('n','y') NOT NULL default 'n',
10971097
`disablelmtp` enum('n','y') NOT NULL default 'n',
10981098
`disabledoveadm` enum('n','y') NOT NULL default 'n',
1099+
`last_access` itimestamp NULL DEFAULT NULL,
10991100
`disablequota-status` enum('n','y') NOT NULL default 'n',
11001101
`disableindexer-worker` enum('n','y') NOT NULL default 'n',
11011102
`last_quota_notification` date NULL default NULL,

interface/lib/classes/quota_lib.inc.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,13 @@ public function get_mailquota_data($clientid = null, $readable = true) {
244244
for($i=0;$i<sizeof($emails);$i++){
245245
$email = $emails[$i]['email'];
246246

247+
if (empty($emails[$i]['last_access'])) {
248+
$emails[$i]['last_access'] = $app->lng('never_accessed_txt');
249+
}
250+
else {
251+
$emails[$i]['last_access'] = date($app->lng('conf_format_datetime'), $emails[$i]['last_access']);
252+
}
253+
247254
$emails[$i]['name'] = $app->functions->htmlentities($emails[$i]['name']);
248255
$emails[$i]['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
249256

interface/lib/lang/en.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,6 @@ $wb['server_id_0_error_txt'] = 'Please select a valid Server. Server ID must be
175175
$wb['datalog_changes_close_txt'] = 'Close';
176176
$wb['non_admin_error'] = 'Requires administrator level permissions';
177177
$wb['copy_to_clipboard_txt'] = 'Copy to clipboard';
178+
$wb['last_accessed_txt'] = 'Last accessed';
179+
$wb['never_accessed_txt'] = 'Never or unknown';
178180
?>

interface/lib/lang/nl.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,6 @@ $wb['server_id_0_error_txt'] = 'Please select a valid Server. Server ID must be
174174
$wb['datalog_changes_close_txt'] = 'Sluiten';
175175
$wb['non_admin_error'] = 'Requires administrator level permissions';
176176
$wb['copy_to_clipboard_txt'] = 'Kopieer naar klembord';
177+
$wb['last_accessed_txt'] = 'Laatst gebruikt';
178+
$wb['never_accessed_txt'] = 'Niet of onbekend';
177179
?>

interface/web/dashboard/dashlets/mailquota.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function show() {
1414
$wb = array();
1515
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_mailquota.lng';
1616
if(is_file($lng_file)) include $lng_file;
17+
$wb['last_accessed_txt'] = $app->lng('last_accessed_txt');
1718
$tpl->setVar($wb);
1819

1920
$emails = $app->quota_lib->get_mailquota_data( ($_SESSION["s"]["user"]["typ"] != 'admin') ? $_SESSION['s']['user']['client_id'] : null);
@@ -27,6 +28,7 @@ function show() {
2728
unset($email);
2829
// email username is quoted in quota.lib already, so no htmlentities here to prevent double encoding
2930
//$emails = $app->functions->htmlentities($emails);
31+
$email['last_access'] = date($app->lng('conf_format_datetime'), $email['last_access']);
3032
$tpl->setloop('mailquota', $emails);
3133
$has_mailquota = isset($emails[0]['used']);
3234
}

interface/web/dashboard/dashlets/templates/mailquota.htm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<th>{tmpl_var name='email_txt'}</th>
77
<th>{tmpl_var name='name_txt'}</th>
88
<th>{tmpl_var name='used_txt'}</th>
9+
<th>{tmpl_var name='last_accessed_txt'}</th>
910
<th colspan="2">{tmpl_var name='quota_txt'}</th>
1011
</tr>
1112
</thead>
@@ -15,6 +16,7 @@
1516
<td><a href="#" data-load-content="mail/mail_user_edit.php?id={tmpl_var name='mailuser_id'}" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="{tmpl_var name='email'}">{tmpl_var name='email'}</a></td>
1617
<td>{tmpl_var name='name'}</td>
1718
<td>{tmpl_var name='used'}</td>
19+
<td>{tmpl_var name='last_access'}</td>
1820
<td>{tmpl_var name='quota'}</td>
1921
{tmpl_if name="quota_raw" op="!=" value="-1"}<td>
2022
<div class='progress'>

interface/web/mail/list/mail_user.list.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,13 @@
133133
'suffix' => "",
134134
'width' => "",
135135
'value' => array('n' => $app->lng('yes_txt'), 'y' => $app->lng('no_txt')));
136+
$liste["item"][] = array( 'field' => "last_access",
137+
'datatype' => "DATE",
138+
'formtype' => "TEXT",
139+
'op' => "=",
140+
'prefix' => "",
141+
'suffix' => "",
142+
'width' => "",
143+
'value' => "");
136144

137145
?>

interface/web/mail/mail_user_edit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ function onShowEnd() {
136136
$app->tpl->setVar("enable_custom_login", 0);
137137
}
138138

139+
if (!empty($this->dataRecord['last_access'])) {
140+
$app->tpl->setVar("last_access", date($app->lng('conf_format_datetime'), $this->dataRecord['last_access']));
141+
}
142+
else {
143+
$app->tpl->setVar("last_access", $app->lng('never_accessed_txt'));
144+
}
145+
139146
$csrf_token = $app->auth->csrf_token_get('mail_user_del');
140147
$app->tpl->setVar('_csrf_id', $csrf_token['csrf_id']);
141148
$app->tpl->setVar('_csrf_key', $csrf_token['csrf_key']);

interface/web/mail/templates/mail_user_list.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ <h1><tmpl_var name="list_head_txt"></h1>
6161
<tbody>
6262
<tmpl_loop name="records">
6363
<tr>
64-
<td><a href="#" data-load-content="mail/mail_user_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="{tmpl_var name='email'}">{tmpl_var name="email"}</a></td>
64+
<td><a href="#" data-load-content="mail/mail_user_edit.php?id={tmpl_var name='id'}" data-toggle="tooltip" data-placement="bottom" title="<tmpl_if name="last_access">{tmpl_var name='last_accessed_txt'}: {tmpl_var name='last_access'}</tmpl_if>">{tmpl_var name="email"}</a></td>
6565
<tmpl_if name="enable_custom_login"><td><a href="#" data-load-content="mail/mail_user_edit.php?id={tmpl_var name='id'}">{tmpl_var name="login"}</a></td></tmpl_if>
6666
<td><a href="#" data-load-content="mail/mail_user_edit.php?id={tmpl_var name='id'}">{tmpl_var name="name"}</a></td>
6767
<td><a href="#" data-load-content="mail/mail_user_edit.php?id={tmpl_var name='id'}">{tmpl_var name="autoresponder"}</a></td>

0 commit comments

Comments
 (0)