mibew/src/messenger/webim/view/notifications.php
2013-03-06 22:56:55 +01:00

132 lines
3.7 KiB
PHP

<?php
/*
* Copyright 2005-2013 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("page.notifications.title");
$page['menuid'] = "notifications";
function shorten($text,$len) {
if(strlen($text) > $len)
return substr($text,0,$len)."..";
return $text;
}
function tpl_header() { global $page, $webimroot;
?>
<script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/jquery-1.4.2.min.js"></script>
<?php
}
function tpl_content() { global $page, $webimroot, $errors;
?>
<?php echo getlocal("page.notifications.intro") ?>
<br />
<br />
<?php
require_once('inc_errors.php');
?>
<form name="notifyFilterForm" method="get" action="<?php echo $webimroot ?>/operator/notifications.php">
<div class="mform"><div class="formtop"><div class="formtopi"></div></div><div class="forminner">
<div class="packedFormField">
<?php echo getlocal("notifications.kind") ?><br/>
<select name="kind" onchange="this.form.submit();"><?php
foreach($page['allkinds'] as $k) {
echo "<option value=\"".$k."\"".($k == form_value("kind") ? " selected=\"selected\"" : "").">".getlocal("notifications.kind.".($k ? $k : "all"))."</option>";
} ?></select>
</div>
<div class="packedFormField">
<?php echo getlocal("notifications.locale") ?><br/>
<select name="lang" onchange="this.form.submit();"><?php
foreach($page['locales'] as $k) {
echo "<option value=\"".$k["id"]."\"".($k["id"] == form_value("lang") ? " selected=\"selected\"" : "").">".$k["name"]."</option>";
} ?></select>
</div>
<br clear="all"/>
</div><div class="formbottom"><div class="formbottomi"></div></div></div>
</form>
<br/>
<?php if( $page['pagination'] ) { ?>
<table class="list">
<thead>
<tr class="header">
<th>
<?php echo getlocal("notifications.head.to") ?>
</th><th>
<?php echo getlocal("notifications.head.subj") ?>
</th><th>
<?php echo getlocal("notifications.head.msg") ?>
</th><th>
<?php echo getlocal("notifications.head.time") ?>
</th>
</tr>
</thead>
<tbody>
<?php
if( $page['pagination.items'] ) {
foreach( $page['pagination.items'] as $b ) { ?>
<tr>
<td class="notlast">
<a href="<?php echo $webimroot ?>/operator/notification.php?id=<?php echo $b['id'] ?>" target="_blank" onclick="this.newWindow = window.open('<?php echo $webimroot ?>/operator/notification.php?id=<?php echo $b['id'] ?>', '', '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;" class="<?php echo $b['vckind'] == 'xmpp' ? 'xmpp' : 'mail' ?>">
<?php echo htmlspecialchars(shorten(topage($b['vcto']),30)) ?>
</a>
</td>
<td class="notlast">
<?php echo htmlspecialchars(shorten(topage($b['vcsubject']),30)) ?>
</td>
<td class="notlast">
<?php echo htmlspecialchars(shorten(topage($b['tmessage']),30)) ?>
</td>
<td>
<?php echo date_to_text($b['created']) ?>
</td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="4">
<?php echo getlocal("tag.pagination.no_items.elements") ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
if( $page['pagination.items'] ) {
echo "<br/>";
echo generate_pagination($page['pagination']);
}
}
?>
<?php
} /* content */
require_once('inc_main.php');
?>