mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +01:00
use new API for notifiations
This commit is contained in:
parent
8a24a16cb1
commit
c088495708
@ -10,6 +10,8 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
$GLOBALS['egw_info'] = array(
|
||||
'flags' => array(
|
||||
'currentapp' => 'notifications',
|
||||
@ -31,8 +33,8 @@ $ret=copy($document, $archive);
|
||||
error_log("copy('$document', '$archive' returned ".array2string($ret));
|
||||
$document = 'zip://'.$archive.'#'.($config_file = 'lib/conf/egwnotifier.const.xml');
|
||||
|
||||
$xml = file_get_contents($document);
|
||||
//html::content_header('egwnotifier.const.xml', 'application/xml', bytes($xml)); echo $xml; exit;
|
||||
$xml_in = file_get_contents($document);
|
||||
//Api\Header\Content::type('egwnotifier.const.xml', 'application/xml', bytes($xml_in)); echo $xml_in; exit;
|
||||
|
||||
function replace_callback($matches)
|
||||
{
|
||||
@ -90,11 +92,11 @@ function replace_callback($matches)
|
||||
$htmlscflags = 16; // #define ENT_XML1 16
|
||||
}
|
||||
|
||||
return '<'.$matches[1].'>'.htmlspecialchars($replacement, $htmlscflags, translation::charset()).'</'.$matches[1].'>';
|
||||
return '<'.$matches[1].'>'.htmlspecialchars($replacement, $htmlscflags, Api\Translation::charset()).'</'.$matches[1].'>';
|
||||
}
|
||||
|
||||
$xml = preg_replace_callback('/<((egw_|MI_)[^>]+)>(.*)<\/[a-z0-9_-]+>/iU', 'replace_callback', $xml);
|
||||
//html::content_header('egwnotifier.replace.xml', 'application/xml', bytes($xml)); echo $xml; exit;
|
||||
$xml = preg_replace_callback('/<((egw_|MI_)[^>]+)>(.*)<\/[a-z0-9_-]+>/iU', 'replace_callback', $xml_in);
|
||||
//Api\Header\Content::type('egwnotifier.const.xml', 'application/xml', bytes($xml)); echo $xml; exit;
|
||||
|
||||
/* does NOT work, fails in addFromString :-(
|
||||
$zip = new ZipArchive;
|
||||
@ -115,7 +117,7 @@ unset($zip);
|
||||
clearstatcache();
|
||||
ob_end_clean();
|
||||
|
||||
html::content_header('egroupware-notifier-'.$GLOBALS['egw_info']['user']['account_lid'].'.jar', 'application/x-java-archive', filesize($archive));
|
||||
Api\Header\Content::type('egroupware-notifier-'.$GLOBALS['egw_info']['user']['account_lid'].'.jar', 'application/x-java-archive', filesize($archive));
|
||||
readfile($archive,'rb');
|
||||
|
||||
@unlink($archive);
|
||||
|
@ -9,7 +9,7 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
if (!defined('SEP')) define('SEP','/');
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Notifies users according to their preferences.
|
||||
@ -179,13 +179,13 @@ final class notifications {
|
||||
*
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->config = (object) config::read(self::_appname);
|
||||
$this->config = (object) Api\Config::read(self::_appname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return notification errors
|
||||
*
|
||||
* @param boolean $reset=false true: reset all errors
|
||||
* @param boolean $reset =false true: reset all errors
|
||||
* @return array
|
||||
*/
|
||||
public static function errors($reset=false)
|
||||
@ -480,9 +480,9 @@ final class notifications {
|
||||
$ids[] = $receiver->account_id;
|
||||
if ($GLOBALS['egw']->acl->get_specific_rights_for_account($ids,'run','notifications')) {
|
||||
// read the users notification chain
|
||||
$prefs = new preferences($receiver->account_id);
|
||||
$preferences = $prefs->read();
|
||||
$preferences = (object)$preferences[self::_appname];
|
||||
$prefs = new Api\Preferences($receiver->account_id);
|
||||
$preferences_all = $prefs->read();
|
||||
$preferences = (object)$preferences_all[self::_appname];
|
||||
if($preferences->notification_chain) {
|
||||
// fallback: admin disabled user-chosen chain
|
||||
if(!$notification_chain = $available_chains[$preferences->notification_chain]) {
|
||||
@ -508,6 +508,7 @@ final class notifications {
|
||||
}
|
||||
|
||||
foreach($notification_chain as $backend => $action) {
|
||||
$notification_backend = null;
|
||||
try {
|
||||
// check if backend should be skipped
|
||||
if( in_array($backend, $this->skip_backends) ) {
|
||||
@ -517,7 +518,7 @@ final class notifications {
|
||||
}
|
||||
|
||||
$notification_backend = self::_appname.'_'.$backend;
|
||||
if(!file_exists(EGW_INCLUDE_ROOT. SEP. self::_appname. SEP. 'inc'. SEP. 'class.'. $notification_backend. '.inc.php')) {
|
||||
if(!file_exists(EGW_INCLUDE_ROOT.'/'. self::_appname.'/inc/class.'. $notification_backend. '.inc.php')) {
|
||||
throw new Exception('file for '.$notification_backend. ' does not exist');
|
||||
}
|
||||
$obj = new $notification_backend( $this->sender, $receiver, $this->config, $preferences );
|
||||
@ -581,7 +582,7 @@ final class notifications {
|
||||
if(!empty($_message_plain)) {
|
||||
$messages['plain'] = $_message_plain;
|
||||
} else {
|
||||
$messages['plain'] = translation::convertHTMLToText($_message_html, false, true);
|
||||
$messages['plain'] = Api\Mail\Html::convertHTMLToText($_message_html, false, true);
|
||||
}
|
||||
|
||||
if(!empty($_message_html)) {
|
||||
@ -601,7 +602,7 @@ final class notifications {
|
||||
*/
|
||||
public static function plain2html($_plain)
|
||||
{
|
||||
return html::activate_links(nl2br(html::htmlspecialchars($_plain, true)));
|
||||
return Api\Html::activate_links(nl2br(Api\Html::htmlspecialchars($_plain, true)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -638,7 +639,9 @@ final class notifications {
|
||||
* @param string $_part
|
||||
* @return string chosen part of the address
|
||||
*/
|
||||
private function get_addresspart($_address, $_part='email') {
|
||||
private function get_addresspart($_address, $_part='email')
|
||||
{
|
||||
$parts = null;
|
||||
if(strpos($_address,'<') && preg_match('/^(.*)\S?\<(.*)\>/',$_address, $parts)) { // _address contains a fullname part
|
||||
$fullname = trim(trim($parts[1]),'\"');
|
||||
$email = $parts[2];
|
||||
@ -649,11 +652,9 @@ final class notifications {
|
||||
switch($_part) {
|
||||
case 'fullname':
|
||||
return $fullname;
|
||||
break;
|
||||
case 'email':
|
||||
default:
|
||||
return $email;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -668,9 +669,9 @@ final class notifications {
|
||||
* @return array containing notification chains, output like given in $_output
|
||||
*/
|
||||
public function get_available_chains($_output = 'routing') {
|
||||
// determine enabled backends from config
|
||||
// determine enabled backends from Api\Config
|
||||
$enabled_backends = array();
|
||||
foreach($this->backends as $id => $backend) {
|
||||
foreach($this->backends as $backend) {
|
||||
switch($backend) {
|
||||
case 'email':
|
||||
case 'popup':
|
||||
@ -689,7 +690,7 @@ final class notifications {
|
||||
foreach($this->notification_chains as $key => $chain) {
|
||||
$allow_chain = true;
|
||||
if(is_array($chain)) {
|
||||
foreach($chain as $name => $action) {
|
||||
foreach(array_keys($chain) as $name) {
|
||||
if(!$enabled_backends[$name]) {
|
||||
$allow_chain = false; // disable whole chain if one backend is disabled
|
||||
}
|
||||
@ -728,7 +729,7 @@ final class notifications {
|
||||
// create descriptions for each chain key in each group
|
||||
foreach($chain_groups as $name => $arr_name) {
|
||||
${$arr_name.$suffix} = array();
|
||||
foreach(${$arr_name} as $key => $value) {
|
||||
foreach(array_keys(${$arr_name}) as $key) {
|
||||
if($arr_name == 'disabled_chains') {
|
||||
${$arr_name.$suffix}[$key] = '('.lang('Disabled').') '.lang($this->chains_descriptions[$key]);
|
||||
} else {
|
||||
@ -744,12 +745,10 @@ final class notifications {
|
||||
}
|
||||
}
|
||||
return $chains_final;
|
||||
break;
|
||||
|
||||
case 'routing':
|
||||
default:
|
||||
return array_merge($common_chains, $enabled_chains);
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -10,6 +10,8 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Ajax methods for notifications
|
||||
*/
|
||||
@ -58,7 +60,7 @@ class notifications_ajax {
|
||||
/**
|
||||
* reference to global db object
|
||||
*
|
||||
* @var egw_db
|
||||
* @var Api\Db
|
||||
*/
|
||||
private $db;
|
||||
|
||||
@ -81,7 +83,7 @@ class notifications_ajax {
|
||||
/**
|
||||
* the xml response object
|
||||
*
|
||||
* @var egw_json_response
|
||||
* @var Api\Json\Response
|
||||
*/
|
||||
private $response;
|
||||
|
||||
@ -90,12 +92,12 @@ class notifications_ajax {
|
||||
*
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->response = egw_json_response::get();
|
||||
$this->response = Api\Json\Response::get();
|
||||
$this->recipient = (object)$GLOBALS['egw']->accounts->read($GLOBALS['egw_info']['user']['account_id']);
|
||||
|
||||
$this->config = (object)config::read(self::_appname);
|
||||
$this->config = (object)Api\Config::read(self::_appname);
|
||||
|
||||
$prefs = new preferences($this->recipient->account_id);
|
||||
$prefs = new Api\Preferences($this->recipient->account_id);
|
||||
$this->preferences = $prefs->read();
|
||||
|
||||
$this->db = $GLOBALS['egw']->db;
|
||||
@ -116,7 +118,7 @@ class notifications_ajax {
|
||||
|
||||
// call a hook for notifications on new mail
|
||||
//if ($GLOBALS['egw_info']['user']['apps']['mail']) $this->check_mailbox();
|
||||
$GLOBALS['egw']->hooks->process('check_notify');
|
||||
Api\Hooks::process('check_notify');
|
||||
|
||||
// update currentusers
|
||||
if ($GLOBALS['egw_info']['user']['apps']['admin'] &&
|
||||
@ -170,11 +172,11 @@ class notifications_ajax {
|
||||
{
|
||||
$message = substr_replace($message, '', strpos($message, lang('Linked entries:')));
|
||||
}
|
||||
$message = preg_replace('#</?a[^>]*>#is','',$message);
|
||||
$message2 = preg_replace('#</?a[^>]*>#is','',$message);
|
||||
|
||||
$message = 'data:text/html;charset=' . translation::charset() .';base64,'.base64_encode($message);
|
||||
$message3 = 'data:text/html;charset=' . Api\Translation::charset() .';base64,'.base64_encode($message2);
|
||||
}
|
||||
$this->response->apply('app.notifications.append',array($notification['notify_id'],$notification['notify_message'],$message));
|
||||
$this->response->apply('app.notifications.append',array($notification['notify_id'],$notification['notify_message'],$message3));
|
||||
}
|
||||
|
||||
switch($this->preferences[self::_appname]['egwpopup_verbosity']) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - Notifications
|
||||
* EGroupware - Notifications
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package notifications
|
||||
@ -10,6 +10,8 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* User notification via email.
|
||||
*/
|
||||
@ -44,7 +46,7 @@ class notifications_email implements notifications_iface {
|
||||
/**
|
||||
* holds preferences object of user to notify
|
||||
*
|
||||
* @var preferences
|
||||
* @var Api\Preferences
|
||||
*/
|
||||
private $preferences;
|
||||
|
||||
@ -74,7 +76,7 @@ class notifications_email implements notifications_iface {
|
||||
{
|
||||
unset($this->mail);
|
||||
}
|
||||
$this->mail = new egw_mailer();
|
||||
$this->mail = new Api\Mailer();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,13 +141,13 @@ class notifications_email implements notifications_iface {
|
||||
if(is_null($_render_html)) { $_render_html = false; }
|
||||
if(is_null($_render_external)) { $_render_external = true; }
|
||||
$newline = $_render_html ? "<br />" : "\n";
|
||||
$hruler = $_render_html ? html::hr() : '';
|
||||
$hruler = $_render_html ? Api\Html::hr() : '';
|
||||
|
||||
$rendered_links = array();
|
||||
foreach($_links as $link) {
|
||||
if($_render_external || ! $link->popup) { $link->view['no_popup'] = 1; }
|
||||
// do not expose sensitive data
|
||||
$url = preg_replace('/(sessionid|kp3|domain)=[^&]+&?/','',html::link('/index.php', $link->view));
|
||||
$url = preg_replace('/(sessionid|kp3|domain)=[^&]+&?/','',Api\Html::link('/index.php', $link->view));
|
||||
// complete missing protocol and domain part if needed
|
||||
if ($url{0} == '/' && $_render_external) {
|
||||
$url = ($_SERVER['HTTPS'] || $GLOBALS['egw_info']['server']['enforce_ssl'] ? 'https://' : 'http://').
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - Notifications
|
||||
* EGroupware - Notifications
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package notifications
|
||||
@ -15,7 +15,7 @@
|
||||
interface notifications_iface {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* constructor
|
||||
*
|
||||
* @param object $_sender
|
||||
* @param object $_recipient
|
||||
@ -23,7 +23,7 @@ interface notifications_iface {
|
||||
* @param object $_preferences
|
||||
*/
|
||||
public function __construct($_sender, $_recipient, $_config = null, $_preferences = null);
|
||||
|
||||
|
||||
/**
|
||||
* sends one notification to one recipient
|
||||
*
|
||||
|
@ -9,6 +9,8 @@
|
||||
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>, Maik H<EFBFBD>ttner <maik.huettner@hw-softwareentwicklung.de>
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* jdesk Json methods for notifications
|
||||
*/
|
||||
@ -57,14 +59,14 @@ class notifications_jdesk_ajax {
|
||||
/**
|
||||
* reference to global db object
|
||||
*
|
||||
* @var egw_db
|
||||
* @var Api\Db
|
||||
*/
|
||||
private $db;
|
||||
|
||||
/**
|
||||
* the xml response object
|
||||
*
|
||||
* @var xajaxResponse
|
||||
* @var Api\Json\Response
|
||||
*/
|
||||
private $response;
|
||||
|
||||
@ -74,17 +76,13 @@ class notifications_jdesk_ajax {
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if( class_exists('xajaxResponse') )
|
||||
{
|
||||
$this->response = new xajaxResponse();
|
||||
}
|
||||
$this->response = new Api\Json\Response();
|
||||
|
||||
$this->recipient = (object)$GLOBALS['egw']->accounts->read($GLOBALS['egw_info']['user']['account_id']);
|
||||
|
||||
$this->config = (object)config::read(self::_appname);
|
||||
$this->config = (object)Api\Config::read(self::_appname);
|
||||
|
||||
$prefs = new preferences($this->recipient->account_id);
|
||||
$preferences = $prefs->read();
|
||||
$prefs = new Api\Preferences($this->recipient->account_id);
|
||||
$this->preferences = $prefs->read();
|
||||
|
||||
$this->db = $GLOBALS['egw']->db;
|
||||
@ -123,8 +121,6 @@ class notifications_jdesk_ajax {
|
||||
"message" => $message,
|
||||
"details" => $details));
|
||||
*/
|
||||
|
||||
return $this->response->getXML();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +146,9 @@ class notifications_jdesk_ajax {
|
||||
*
|
||||
* @return boolean true or false
|
||||
*/
|
||||
private function get_egwpopup($browserNotify = false) {
|
||||
private function get_egwpopup($browserNotify = false)
|
||||
{
|
||||
unset($browserNotify); // not used
|
||||
|
||||
$message = '';
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* EGroupware - Notifications Java Desktop App
|
||||
*
|
||||
@ -10,6 +9,8 @@
|
||||
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>, Maik H<EFBFBD>ttner <maik.huettner@hw-softwareentwicklung.de>
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
class notifications_jpopup implements notifications_iface
|
||||
{
|
||||
|
||||
@ -59,7 +60,7 @@ class notifications_jpopup implements notifications_iface
|
||||
/**
|
||||
* holds db object of SQL database
|
||||
*
|
||||
* @var egw_db
|
||||
* @var Api\Db
|
||||
*/
|
||||
private $db;
|
||||
|
||||
@ -93,6 +94,8 @@ class notifications_jpopup implements notifications_iface
|
||||
*/
|
||||
public function send(array $_messages, $_subject=false, $_links=false, $_attachments=false)
|
||||
{
|
||||
unset($_attachments); // not used
|
||||
|
||||
$jmessage = array();
|
||||
|
||||
// app-message
|
||||
@ -119,7 +122,7 @@ class notifications_jpopup implements notifications_iface
|
||||
}
|
||||
|
||||
$message = $this->render_infos($_subject)
|
||||
.html::hr()
|
||||
.Api\Html::hr()
|
||||
.$_messages['html'];
|
||||
|
||||
$jmessage['msghtml'] = $message;
|
||||
@ -133,7 +136,7 @@ class notifications_jpopup implements notifications_iface
|
||||
* renders additional infos from sender and subject
|
||||
*
|
||||
* @param string $_subject
|
||||
* @return html rendered info as complete string
|
||||
* @return string html rendered info as complete string
|
||||
*/
|
||||
private function render_infos($_subject = false) {
|
||||
$infos = array();
|
||||
@ -141,7 +144,7 @@ class notifications_jpopup implements notifications_iface
|
||||
|
||||
$sender = $this->sender->account_fullname ? $this->sender->account_fullname : $this->sender_account_email;
|
||||
$infos[] = lang('Message from').': '.$sender;
|
||||
if(!empty($_subject)) { $infos[] = html::bold($_subject); }
|
||||
if(!empty($_subject)) { $infos[] = Api\Html::bold($_subject); }
|
||||
return implode($newline,$infos);
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Instant user notification with egroupware popup.
|
||||
*
|
||||
@ -67,7 +69,7 @@ class notifications_popup implements notifications_iface {
|
||||
/**
|
||||
* holds db object of SQL database
|
||||
*
|
||||
* @var egw_db
|
||||
* @var Api\Db
|
||||
*/
|
||||
private $db;
|
||||
|
||||
@ -98,15 +100,17 @@ class notifications_popup implements notifications_iface {
|
||||
* @param array $_links
|
||||
* @param array $_attachments
|
||||
*/
|
||||
public function send(array $_messages, $_subject = false, $_links = false, $_attachments = false) {
|
||||
public function send(array $_messages, $_subject = false, $_links = false, $_attachments = false)
|
||||
{
|
||||
unset($_attachments); // not used
|
||||
// Check access log to see if user is still logged in
|
||||
if ( !egw_session::notifications_active($this->recipient->account_id) )
|
||||
if ( !Api\Session::notifications_active($this->recipient->account_id) )
|
||||
{
|
||||
throw new Exception("User {$this->recipient->account_lid} isn't online. Can't send notification via popup");
|
||||
}
|
||||
|
||||
$message = $this->render_infos($_subject)
|
||||
.html::hr()
|
||||
.Api\Html::hr()
|
||||
.(isset($_messages['popup'])&&!empty($_messages['popup'])?$_messages['popup']:$_messages['html'])
|
||||
.$this->render_links($_links);
|
||||
|
||||
@ -133,7 +137,7 @@ class notifications_popup implements notifications_iface {
|
||||
* should be moved to the ajax class later - like mentioned in the Todo
|
||||
*
|
||||
* @param array $_links
|
||||
* @return html rendered link(s) as complete string with jspopup or a new window
|
||||
* @return string html rendered link(s) as complete string with jspopup or a new window
|
||||
*/
|
||||
private function render_links($_links = false) {
|
||||
if(!is_array($_links) || count($_links) == 0) { return false; }
|
||||
@ -143,20 +147,19 @@ class notifications_popup implements notifications_iface {
|
||||
foreach($_links as $link) {
|
||||
if(!$link->popup) { $link->view['no_popup'] = 1; }
|
||||
|
||||
$url = html::link('/index.php', $link->view);
|
||||
// do not expose sensitive data
|
||||
$url = preg_replace('/(sessionid|kp3|domain)=[^&]+&?/','',$url);
|
||||
$url = preg_replace('/(sessionid|kp3|domain)=[^&]+&?/','',
|
||||
Api\Html::link('/index.php', $link->view));
|
||||
// extract application-icon from menuaction
|
||||
if($link->view['menuaction']) {
|
||||
$menuaction_arr = explode('.',$link->view['menuaction']);
|
||||
$application = $menuaction_arr[0];
|
||||
$image = $application ? html::image($application,'navbar',$link->text,'align="middle" style="width: 24px; margin-right: 0.5em;"') : '';
|
||||
$image = $application ? Api\Html::image($application,'navbar',$link->text,'align="middle" style="width: 24px; margin-right: 0.5em;"') : '';
|
||||
} else {
|
||||
$image = '';
|
||||
}
|
||||
if($link->popup && !$GLOBALS['egw_info']['user']['preferences']['notifications']['external_mailclient'])
|
||||
{
|
||||
$dimensions = explode('x', $link->popup);
|
||||
$data = array(
|
||||
"data-app = '{$link->app}'",
|
||||
"data-id = '{$link->id}'",
|
||||
@ -164,14 +167,14 @@ class notifications_popup implements notifications_iface {
|
||||
"data-popup = '{$link->popup}'"
|
||||
);
|
||||
|
||||
$rendered_links[] = html::div($image.$link->text,implode(' ',$data),'link');
|
||||
$rendered_links[] = Api\Html::div($image.$link->text,implode(' ',$data),'link');
|
||||
} else {
|
||||
$rendered_links[] = html::div('<a href="'.$url.'" target="_blank">'.$image.$link->text.'</a>','','link');
|
||||
$rendered_links[] = Api\Html::div('<a href="'.$url.'" target="_blank">'.$image.$link->text.'</a>','','link');
|
||||
}
|
||||
|
||||
}
|
||||
if(count($rendered_links) > 0) {
|
||||
return html::hr().html::bold(lang('Linked entries:')).$newline.implode($newline,$rendered_links);
|
||||
return Api\Html::hr().Api\Html::bold(lang('Linked entries:')).$newline.implode($newline,$rendered_links);
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,9 +182,9 @@ class notifications_popup implements notifications_iface {
|
||||
* returns javascript to open a popup window: window.open(...)
|
||||
*
|
||||
* @param string $link link or this.href
|
||||
* @param string $target='_blank' name of target or this.target
|
||||
* @param int $width=750 width of the window
|
||||
* @param int $height=400 height of the window
|
||||
* @param string $target ='_blank' name of target or this.target
|
||||
* @param int $width =750 width of the window
|
||||
* @param int $height =400 height of the window
|
||||
* @return string javascript (using single quotes)
|
||||
*/
|
||||
private function jspopup($link,$target='_blank',$width=750,$height=410)
|
||||
@ -202,7 +205,7 @@ class notifications_popup implements notifications_iface {
|
||||
* renders additional infos from sender and subject
|
||||
*
|
||||
* @param string $_subject
|
||||
* @return html rendered info as complete string
|
||||
* @return string html rendered info as complete string
|
||||
*/
|
||||
private function render_infos($_subject = false) {
|
||||
$infos = array();
|
||||
@ -210,7 +213,7 @@ class notifications_popup implements notifications_iface {
|
||||
|
||||
$sender = $this->sender->account_fullname ? $this->sender->account_fullname : $this->sender_account_email;
|
||||
$infos[] = lang('Message from').': '.$sender;
|
||||
if(!empty($_subject)) { $infos[] = html::bold($_subject); }
|
||||
if(!empty($_subject)) { $infos[] = Api\Html::bold($_subject); }
|
||||
return implode($newline,$infos);
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,8 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api\Json;
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Json;
|
||||
|
||||
/**
|
||||
* Class to push via notification polling and other json requests from client-side
|
||||
@ -34,7 +33,7 @@ class notifications_push implements Json\PushBackend
|
||||
/**
|
||||
* Reference to global DB object
|
||||
*
|
||||
* @var egw_db
|
||||
* @var Api\Db
|
||||
*/
|
||||
public static $db;
|
||||
|
||||
@ -113,7 +112,7 @@ class notifications_push implements Json\PushBackend
|
||||
{
|
||||
self::$db->delete(self::TABLE, array(
|
||||
'notify_type' => self::TYPE,
|
||||
'notify_created < '.self::$db->from_unixtime(egw_session::heartbeat_limit()),
|
||||
'notify_created < '.self::$db->from_unixtime(Api\Session::heartbeat_limit()),
|
||||
), __LINE__, __FILE__, self::APP);
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* User notification via winpopup.
|
||||
*/
|
||||
@ -100,9 +102,12 @@ class notifications_winpopup implements notifications_iface {
|
||||
* @param array $_links
|
||||
* @param array $_attachments
|
||||
*/
|
||||
public function send(array $_messages, $_subject = false, $_links = false, $_attachments = false) {
|
||||
public function send(array $_messages, $_subject = false, $_links = false, $_attachments = false)
|
||||
{
|
||||
unset($_links, $_attachments); // not used
|
||||
|
||||
$user_sessions = array();
|
||||
foreach (egw_session::session_list(0, 'asc', 'session_dla', true) as $session) {
|
||||
foreach (Api\Session::session_list(0, 'asc', 'session_dla', true) as $session) {
|
||||
if ($session['session_lid'] == $this->recipient->account_lid. '@'. $GLOBALS['egw_info']['user']['domain']) {
|
||||
if($this->valid_ip($session['session_ip'])) {
|
||||
$user_sessions[] = $session['session_ip'];
|
||||
@ -138,6 +143,7 @@ class notifications_winpopup implements notifications_iface {
|
||||
'/\[SENDER\]/' => $this->sender->account_fullname ? escapeshellarg($this->sender->account_fullname) : escapeshellarg($this->sender->account_email),
|
||||
);
|
||||
$command = preg_replace(array_keys($placeholders), $placeholders, $this->netbios_command);
|
||||
$output = $returncode = null;
|
||||
exec($command,$output,$returncode);
|
||||
if($returncode != 0) {
|
||||
throw new Exception("Failed sending notification message via winpopup. Error while executing the specified command.");
|
||||
|
@ -9,7 +9,9 @@
|
||||
* @version $Id: hook_preferences.inc.php 22498 2006-09-25 10:20:46Z jaytraxx $
|
||||
*/
|
||||
|
||||
$file = Array( 'Site Configuration' => egw::link('/index.php', array(
|
||||
use EGroupware\Api\Egw;
|
||||
|
||||
$file = Array( 'Site Configuration' => Egw::link('/index.php', array(
|
||||
'menuaction' => 'admin.admin_config.index',
|
||||
'appname' => $appname,
|
||||
'ajax' => 'true',
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - Notifications
|
||||
* EGroupware - Notifications
|
||||
*
|
||||
* serves the hook "after_navbar" to create the notificationwindow
|
||||
*
|
||||
* @abstract notificatonwindow is an empty and non displayed 1px div which gets rezised
|
||||
@ -12,17 +13,19 @@
|
||||
* @author Cornelius Weiss <nelius@cwtech.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
use EGroupware\Api;
|
||||
if ($GLOBALS['egw_info']['user']['apps']['notifications'])
|
||||
{
|
||||
$notification_config = config::read('notifications');
|
||||
translation::add_app('notifications');
|
||||
$notification_config = Api\Config::read('notifications');
|
||||
Api\Translation::add_app('notifications');
|
||||
$popup_poll_interval = empty($notification_config['popup_poll_interval']) ? 60 : $notification_config['popup_poll_interval'];
|
||||
echo '<script src="'. $GLOBALS['egw_info']['server']['webserver_url']. '/notifications/js/notificationajaxpopup.js?'.
|
||||
filemtime(EGW_SERVER_ROOT.'/notifications/js/notificationajaxpopup.js'). '" type="text/javascript" id="notifications_script_id" data-poll-interval="'.$popup_poll_interval.'"></script>';
|
||||
echo '
|
||||
<div id="egwpopup" style="display: none; z-index: 999;">
|
||||
<div id="egwpopup_header">'.lang('Notification'). '<span style="float:right;">'.
|
||||
html::submit_button('egwpopup_close_button', 'X', '', true, 'id="egwpopup_close_button"', 'close.button') .
|
||||
Api\Html::submit_button('egwpopup_close_button', 'X', '', true, 'id="egwpopup_close_button"', 'close.button') .
|
||||
'</span></div>
|
||||
<div id="egwpopup_message"></div>
|
||||
<div id="egwpopup_footer">
|
||||
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - eTemplates for Application notifications
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() 2009-02-14 18:23
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package notifications
|
||||
* @subpackage setup
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
$templ_version=1;
|
||||
|
||||
$templ_data[] = array('name' => 'notifications.checkmailbox','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:2:{s:2:"c1";s:2:"th";s:2:"c2";s:7:"row,top";}i:1;a:4:{s:1:"A";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"type";s:5:"label";s:5:"label";s:6:"Folder";}}s:1:"B";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"type";s:5:"label";s:5:"label";s:7:"Subject";}}s:1:"C";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"type";s:5:"label";s:5:"label";s:4:"From";}}s:1:"D";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:8:"readonly";s:4:"true";s:4:"type";s:5:"label";s:5:"label";s:8:"Received";}}}i:2;a:4:{s:1:"A";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:2:{s:4:"name";s:19:"${row}[mail_folder]";s:4:"type";s:5:"label";}}s:1:"B";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:20:"${row}[mail_subject]";s:4:"size";s:103:"b,felamimail.uidisplay.display&uid=$row_cont[mail_uid]&mailbox=$row_cont[mail_folder_base64],,,,750x500";s:4:"type";s:5:"label";}}s:1:"C";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:3:{s:7:"no_lang";s:1:"1";s:4:"name";s:17:"${row}[mail_from]";s:4:"type";s:5:"label";}}s:1:"D";a:3:{s:4:"size";s:6:"1,,0,0";s:4:"type";s:4:"vbox";i:1;a:4:{s:8:"readonly";s:4:"true";s:4:"name";s:21:"${row}[mail_received]";s:4:"size";s:2:",8";s:4:"type";s:9:"date-time";}}}}s:4:"cols";i:4;s:4:"rows";i:2;}}','size' => '','style' => '','modified' => '1234631988',);
|
||||
|
@ -15,7 +15,7 @@ if (!defined('NOTIFICATION_APP'))
|
||||
}
|
||||
|
||||
$setup_info[NOTIFICATION_APP]['name'] = NOTIFICATION_APP;
|
||||
$setup_info[NOTIFICATION_APP]['version'] = '14.3';
|
||||
$setup_info[NOTIFICATION_APP]['version'] = '16.1';
|
||||
$setup_info[NOTIFICATION_APP]['app_order'] = 1;
|
||||
$setup_info[NOTIFICATION_APP]['tables'] = array('egw_notificationpopup');
|
||||
$setup_info[NOTIFICATION_APP]['enable'] = 2;
|
||||
@ -37,11 +37,6 @@ $setup_info[NOTIFICATION_APP]['hooks']['deleteaccount'] = 'notifications.notific
|
||||
|
||||
/* Dependencies for this app to work */
|
||||
$setup_info[NOTIFICATION_APP]['depends'][] = array(
|
||||
'appname' => 'phpgwapi',
|
||||
'versions' => Array('14.1')
|
||||
'appname' => 'api',
|
||||
'versions' => Array('16.1')
|
||||
);
|
||||
$setup_info[NOTIFICATION_APP]['depends'][] = array(
|
||||
'appname' => 'etemplate',
|
||||
'versions' => Array('14.1')
|
||||
);
|
||||
|
||||
|
@ -123,3 +123,7 @@ function notifications_upgrade14_1()
|
||||
return $GLOBALS['setup_info']['notifications']['currentver'] = '14.3';
|
||||
}
|
||||
|
||||
function notifications_upgrade14_3()
|
||||
{
|
||||
return $GLOBALS['setup_info']['notifications']['currentver'] = '16.1';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user