* Java notifier app from Stefan Werfling, added translation and egw-configuration on download

This commit is contained in:
Ralf Becker 2012-12-09 05:56:42 +00:00
parent 0be74c9b87
commit 3e3dda8149
86 changed files with 8379 additions and 18 deletions

View File

@ -0,0 +1,99 @@
<?php
/**
* EGroupware - download of customized java notifier
*
* @link http://www.egroupware.org
* @author RalfBecker-at-outdoor-training.de
* @copyright (c) 2012 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @version $Id$
*/
$GLOBALS['egw_info'] = array(
'flags' => array(
'currentapp' => 'notifications',
'noheader' => True,
'nonavbar' => True,
)
);
include('../header.inc.php');
check_load_extension('zip', true);
$document = EGW_SERVER_ROOT.'/notifications/java/full-eGwNotifier.jar';
$archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($document,'.jar').'-').'.jar';
$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;
function replace_callback($matches)
{
$replacement = $matches[3];
switch($matches[1])
{
case 'egw_dc_url':
$replacement = $GLOBALS['egw_info']['server']['webserver_url'];
if (empty($replacement) || $replacement[0] == '/')
{
$replacement = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$replacement;
}
break;
case 'egw_dc_logindomain':
$replacement = $GLOBALS['egw_info']['user']['domain'];
break;
case 'egw_dc_username':
$replacement = $GLOBALS['egw_info']['user']['account_lid'];
break;
case 'egw_dc_timeout_socket':
case 'egw_dc_timeout_notify':
break;
default:
$replacement = lang($r=$replacement);
/* uncomment this to have missing translations add to en langfile
// if no translation found, check if en langfile is writable and add phrase, if not already there
if ($r === $replacement)
{
static $langfile;
if (is_null($langfile)) $langfile = EGW_SERVER_ROOT.'/notifications/lang/egw_en.lang';
if (is_writable($langfile) || is_writable(dirname($langfile)))
{
$content = file_get_contents($langfile);
if (!preg_match('/^'.preg_quote($r)."\t/i", $content))
{
if (!is_writable($langfile)) unlink($langfile);
$content .= "$r\tnotifications\ten\t$r\n";
file_put_contents($langfile, $content);
}
}
}*/
break;
}
return '<'.$matches[1].'>'.htmlspecialchars($replacement, ENT_XML1, 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;
/* does NOT work, fails in addFromString :-(
$zip = new ZipArchive;
if ($zip->open($archive, ZIPARCHIVE::CHECKCONS) !== true)
{
error_log(__METHOD__.__LINE__." !ZipArchive::open('$archive',ZIPARCHIVE::CHECKCONS) failed. Trying open without validating");
if ($zip->open($archive) !== true) throw new Exception("!ZipArchive::open('$archive',|ZIPARCHIVE::CHECKCONS)");
}
if (($ret=$zip->addFromString($config_file, $xml)) !== true);// throw new Exception("ZipArchive::addFromString('$config_file', \$xml) returned ".array2string($ret));
if ($zip->close() !== true) throw new Exception("!ZipArchive::close()");
*/
check_load_extension('phar', true);
$zip = new PharData($archive);
$zip->addFromString($config_file, $xml);
unset($zip);
html::content_header('egroupware-notifier-'.$GLOBALS['egw_info']['user']['account_lid'].'.jar', 'application/x-java-archive', filesize($archive));
readfile($archive,'r');

View File

@ -45,7 +45,7 @@ final class notifications {
* registered backends
* @var array
*/
private $backends = array('popup', 'winpopup', 'email', 'sms');
private $backends = array('popup', 'winpopup', 'email', 'sms', 'jpopup');
/**
* backends to skip even if the user has chosen it
@ -80,6 +80,8 @@ final class notifications {
//'winpopup_or_sms' => array('winpopup' => 'fail', 'sms' => 'stop'),
'winpopup_and_email' => array('winpopup' => 'continue', 'email' => 'stop'),
'sms_only' => array('sms' => 'stop'),
'jpopup_only' => array('jpopup' => 'continue', 'popup' => 'stop'),
'jpopup_and_email' => array('jpopup' => 'continue', 'popup' => 'continue', 'email' => 'stop'),
);
/**
@ -100,6 +102,8 @@ final class notifications {
//'winpopup_or_sms' => 'Windows-Popup first, if that fails notify me by SMS',
'winpopup_and_email' => 'Windows-Popup and E-Mail',
'sms_only' => 'SMS only',
'jpopup_only' => 'Java-Windows-Popup and eGroupWare-Popup only',
'jpopup_and_email' => 'Java-Windows-Popup, eGroupWare-Popup and Email'
);
/**
@ -647,6 +651,7 @@ final class notifications {
switch($backend) {
case 'email':
case 'popup':
case 'jpopup':
$enabled_backends[$backend] = true; // fallback must always be enabled
break;
default:

View File

@ -32,6 +32,11 @@ class notifications_ajax {
*/
const _notification_table = 'egw_notificationpopup';
/**
* Notification type
*/
const _type = 'base';
/**
* holds account object for user to notify
*
@ -145,6 +150,7 @@ class notifications_ajax {
$this->db->delete(self::_notification_table,array(
'notify_id' => $notify_id,
'account_id' => $this->recipient->account_id,
'notify_type' => self::_type
),__LINE__,__FILE__,self::_appname);
}
}
@ -258,6 +264,7 @@ class notifications_ajax {
$message = '';
$rs = $this->db->select(self::_notification_table, '*', array(
'account_id' => $this->recipient->account_id,
'notify_type' => self::_type
),
__LINE__,__FILE__,false,'',self::_appname);
if ($rs->NumRows() > 0) {

View File

@ -0,0 +1,194 @@
<?php
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>, Maik H<EFBFBD>ttner <maik.huettner@hw-softwareentwicklung.de>
*/
/**
* jdesk Json methods for notifications
*/
class notifications_jdesk_ajax {
public $public_functions = array(
'get_notification' => true
);
/**
* Appname
*/
const _appname = 'notifications';
/**
* Notification table in SQL database
*/
const _notification_table = 'egw_notificationpopup';
/**
* Notification type
*/
const _type = 'jpopup';
/**
* holds account object for user to notify
*
* @var object
*/
private $recipient;
/**
* holds config object (sitewide application config)
*
* @var object
*/
private $config;
/**
* holds preferences array of user to notify
*
* @var array
*/
private $preferences;
/**
* reference to global db object
*
* @var egw_db
*/
private $db;
/**
* the xml response object
*
* @var xajaxResponse
*/
private $response;
/**
* constructor
*
*/
public function __construct()
{
if( class_exists('xajaxResponse') )
{
$this->response = new xajaxResponse();
}
$this->recipient = (object)$GLOBALS['egw']->accounts->read($GLOBALS['egw_info']['user']['account_id']);
$this->config = (object)config::read(self::_appname);
$prefs = new preferences($this->recipient->account_id);
$preferences = $prefs->read();
$this->preferences = $prefs->read();
$this->db = $GLOBALS['egw']->db;
}
/**
* destructor
*
*/
public function __destruct() {}
/**
* public AJAX trigger function to be called by the JavaScript client
*
* this function calls all other recurring AJAX notifications methods
* to have ONE single recurring AJAX call per user
*
* @return xajax response
*/
public function get_notifications($browserNotify = false)
{
//if ($GLOBALS['egw_info']['user']['apps']['felamimail']) $this->check_mailbox();
// update currentusers
/*if( $GLOBALS['egw_info']['user']['apps']['admin'] &&
$GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers'] )
{
$this->response->jquery('#currentusers', 'text',
array((string)$GLOBALS['egw']->session->session_count()));
}*/
$this->get_egwpopup($browserNotify);
/**
* $this->addGeneric('alert', array(
"message" => $message,
"details" => $details));
*/
return $this->response->getXML();
}
/**
* Let the user confirm that they have seen the message.
* After they've seen it, remove it from the database
*
* @param int|array $notify_id one or more notify_id's
*/
public function confirm_message($notify_id)
{
if ($notify_id)
{
$this->db->delete(self::_notification_table,array(
'notify_id' => $notify_id,
'account_id' => $this->recipient->account_id,
'notify_type' => self::_type
),__LINE__,__FILE__,self::_appname);
}
}
/**
* gets all egwpopup notifications for calling user
*
* @return boolean true or false
*/
private function get_egwpopup($browserNotify = false) {
$message = '';
$rs = $this->db->select(self::_notification_table, '*', array(
'account_id' => $this->recipient->account_id,
'notify_type' => self::_type
),
__LINE__,__FILE__,false,'',self::_appname);
if( $rs->NumRows() > 0 )
{
foreach ($rs as $notification)
{
$message = null;
$jmessage = unserialize($notification['notify_message']);
$jmessage['notify_id'] = $notification['notify_id'];
$this->response->data($jmessage);
}
switch( $this->preferences[self::_appname]['egwpopup_verbosity'] )
{
case 'low':
break;
case 'high':
break;
case 'medium':
default:
break;
}
}
return true;
}
}

View File

@ -0,0 +1,162 @@
<?php
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>, Maik H<EFBFBD>ttner <maik.huettner@hw-softwareentwicklung.de>
*/
class notifications_jpopup implements notifications_iface
{
/**
* Appname
*/
const _appname = 'notifications';
/**
* Notification table in SQL database
*/
const _notification_table = 'egw_notificationpopup';
/**
* Notification type
*/
const _type = 'jpopup';
/**
* holds account object for user who sends the message
*
* @var object
*/
private $sender;
/**
* holds account object for user to notify
*
* @var object
*/
private $recipient;
/**
* holds config object (sitewide application config)
*
* @var object
*/
private $config;
/**
* holds preferences object of user to notify
*
* @var object
*/
private $preferences;
/**
* holds db object of SQL database
*
* @var egw_db
*/
private $db;
/**
* constructor of notifications_egwpopup
*
* @param object $_sender
* @param object $_recipient
* @param object $_config
* @param object $_preferences
*/
public function __construct($_sender, $_recipient, $_config = null, $_preferences = null)
{
if( !is_object($_sender) ) { throw new Exception("no sender given."); }
if( !is_object($_recipient) ) { throw new Exception("no recipient given."); }
$this->sender = $_sender;
$this->recipient = $_recipient;
$this->config = $_config;
$this->preferences = $_preferences;
$this->db = $GLOBALS['egw']->db;
}
/**
* sends notification if user is online
*
* @param array $_messages
* @param string $_subject
* @param array $_links
* @param array $_attachments
*/
public function send(array $_messages, $_subject=false, $_links=false, $_attachments=false)
{
$jmessage = array();
// app-message
if( ($_links != null) && (count($_links) > 0) )
{
$tlink = $_links[0];
$appname = "";
if( key_exists('menuaction', $tlink->view) )
{
$tmp = explode(".", $tlink->view['menuaction']);
$appname = $tmp[0];
}
$link = array();
foreach( $tlink->view as $pkey => $pvalue )
{
$link[] = $pkey . '=' . $pvalue;
}
// TODO more links?
$jmessage['link'] = implode("&", $link);
}
$message = $this->render_infos($_subject)
.html::hr()
.$_messages['html'];
$jmessage['msghtml'] = $message;
$jmessage['app'] = $appname;
$this->save( serialize($jmessage) );
}
/**
* renders additional infos from sender and subject
*
* @param string $_subject
* @return html rendered info as complete string
*/
private function render_infos($_subject = false) {
$infos = array();
$newline = "<br />";
$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); }
return implode($newline,$infos);
}
/**
* saves notification into database so that the client can fetch it from there
*
* @param string $_message
* @param array $_user_sessions
*/
private function save( $_message ) {
$result = $this->db->insert( self::_notification_table, array(
'account_id' => $this->recipient->account_id,
'notify_message' => $_message,
'notify_type' => self::_type
), false,__LINE__,__FILE__,self::_appname);
if ($result === false) throw new Exception("Can't save notification into SQL table");
}
}

View File

@ -31,6 +31,11 @@ class notifications_popup implements notifications_iface {
*/
const _notification_table = 'egw_notificationpopup';
/**
* Notification type
*/
const _type = 'base';
/**
* holds account object for user who sends the message
*
@ -117,7 +122,8 @@ class notifications_popup implements notifications_iface {
private function save( $_message ) {
$result = $this->db->insert( self::_notification_table, array(
'account_id' => $this->recipient->account_id,
'notify_message' => $_message
'notify_message' => $_message,
'notify_type' => self::_type
), false,__LINE__,__FILE__,self::_appname);
if ($result === false) throw new Exception("Can't save notification into SQL table");
}

View File

@ -1,17 +1,19 @@
<?php
/**
* eGroupWare - Notifications
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @link http://www.egroupware.org
* @author Cornelius Weiss <nelius@cwtech.de>
* @version $Id$
*/
$file = Array( 'Preferences' => $GLOBALS['egw']->link('/index.php',array(
/**
* EGroupware - Notifications
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @link http://www.egroupware.org
* @author Cornelius Weiss <nelius@cwtech.de>
* @version $Id$
*/
$file = Array(
'Preferences' => egw::link('/index.php',array(
'menuaction' => 'preferences.uisettings.index',
'appname' => $appname,
)));
display_section($appname,$file);
?>
)),
'Java desktop notification app' => egw::link('/notifications/download.php'),
);
display_section($appname,$file);

Binary file not shown.

View File

@ -0,0 +1 @@
egroupwaretray.EgroupwareTrayApp

View File

@ -0,0 +1,539 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
/**
* BaseHttp
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class BaseHttp
{
private HttpURLConnection _con = null;
private boolean _isSSL = false;
private boolean _isAjax = false;
private String _cookie = "";
private int _sockettimeout = 10;
static private BaseHttpsTrustManager _bhtm = null;
static public BaseHttpsTrustManager getTrustManager()
{
return BaseHttp._bhtm;
}
/**
* setIsSSL
*
* @param enable boolean
*/
public void setIsSSL(boolean enable)
{
this._isSSL = enable;
}
/**
* setIsAjax
* setzt das Request als Ajax
*
* @param enable boolean
*/
public void setIsAjax(boolean enable)
{
this._isAjax = enable;
}
/**
* setSocketTimeOut
* set den Socket connection timeout
*
* @param timeout int
*/
public void setSocketTimeOut(int timeout)
{
this._sockettimeout = timeout;
}
/**
* openHttpSite
* open/load HTTP Site
*
* @param URL
* @return String
* @throws IOException
*/
public String openHttpSite(String URL) throws IOException
{
URL jtUrl = new URL(URL);
this._con = (HttpURLConnection) jtUrl.openConnection();
this._con.setConnectTimeout(this._sockettimeout);
DataInputStream dis = new DataInputStream(this._con.getInputStream());
String inputLine;
String buff = "";
while ((inputLine = dis.readLine()) != null)
{
buff = buff + "\r\n" + inputLine;
}
dis.close();
/**
* Schließen
*/
this._con.disconnect();
return buff;
}
/**
* openHttpContentSitePost
* open/load Site content (POST)
*
* @param URL
* @param post String
* @return String
* @throws Exception
*/
public String openHttpContentSitePost(String URL, String post) throws Exception
{
if( this._isSSL )
{
URL = "https://" + URL;
}
else
{
URL = "http://" + URL;
}
HttpURLConnection.setFollowRedirects(false);
URL jtUrl = new URL(URL);
if( this._isSSL )
{
SSLContext sslContext = SSLContext.getInstance("SSL");
if( BaseHttp._bhtm == null )
{
BaseHttp._bhtm = new BaseHttpsTrustManager();
}
sslContext.init(
null,
new javax.net.ssl.TrustManager[] { BaseHttp._bhtm },
new java.security.SecureRandom()
);
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
}
this._con = (HttpURLConnection) jtUrl.openConnection();
this._con.setConnectTimeout(this._sockettimeout);
if( !this._cookie.equals("") )
{
this._con.addRequestProperty("Cookie", this._cookie);
}
if( this._isAjax )
{
this._con.addRequestProperty("X-Requested-With", "XMLHttpRequest");
}
this._con.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(this._con.getOutputStream());
wr.write(post);
wr.flush();
wr.close();
if( this._con != null )
{
Map<String, List<String>> headers = this._con.getHeaderFields();
List<String> values = headers.get("Set-Cookie");
this._cookie = "";
if( values != null )
{
for(int i=0; i<values.size(); i++)
{
//this._con.setRequestProperty("Cookie", values.get(i));
if( !this._cookie.equals("") )
{
this._cookie += ";";
}
this._cookie += values.get(i);
}
}
}
String buff = "";
try
{
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(this._con.getInputStream()));
String line = bufferedReader.readLine();
while( line != null )
{
buff = buff + line + "\r\n";
line = bufferedReader.readLine();
}
bufferedReader.close();
/**
* close
*/
this._con.disconnect();
}
catch( Exception exp )
{
throw new Exception("NETERROR");
}
return buff;
}
/**
* openHttpContentSite
* open load Site content (GET)
*
* @param URL
* @return
* @throws Exception
*/
public String openHttpContentSite(String URL) throws Exception
{
if( this._isSSL )
{
URL = "https://" + URL;
}
else
{
URL = "http://" + URL;
}
HttpURLConnection.setFollowRedirects(false);
URL jtUrl = new URL(URL);
if( this._isSSL )
{
SSLContext sslContext = SSLContext.getInstance("SSL");
if( BaseHttp._bhtm == null )
{
BaseHttp._bhtm = new BaseHttpsTrustManager();
}
sslContext.init(
null,
new javax.net.ssl.TrustManager[] { BaseHttp._bhtm },
new java.security.SecureRandom()
);
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
}
this._con = (HttpURLConnection) jtUrl.openConnection();
this._con.setConnectTimeout(this._sockettimeout);
if( !this._cookie.equals("") )
{
this._con.addRequestProperty("Cookie", this._cookie);
}
if( this._isAjax )
{
this._con.addRequestProperty("X-Requested-With", "XMLHttpRequest");
}
if( this._con != null )
{
Map<String, List<String>> headers = this._con.getHeaderFields();
List<String> values = headers.get("Set-Cookie");
this._cookie = "";
if( values != null )
{
for(int i=0; i<values.size(); i++)
{
//this._con.setRequestProperty("Cookie", values.get(i));
if( !this._cookie.equals("") )
{
this._cookie += ";";
}
this._cookie += values.get(i);
}
}
}
String buff = "";
try
{
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(this._con.getInputStream()));
String line = bufferedReader.readLine();
while( line != null )
{
buff = buff + line + "\r\n";
line = bufferedReader.readLine();
}
bufferedReader.close();
/**
* close
*/
this._con.disconnect();
}
catch(Exception exp)
{
throw new Exception("NETERROR");
}
return buff;
}
/**
* getHeaderField
* get HTTP Header by name
*
* @param name String
* @return String
*/
public String getHeaderField(String name)
{
Map<String, List<String>> headers = this._con.getHeaderFields();
List<String> values = headers.get("Set-Cookie");
String v = "";
for(int i=0; i<values.size(); i++)
{
v = v + values.get(i);
}
int pos = v.indexOf(name + "=");
int end = v.indexOf(";", pos);
String back = v.substring( pos + name.length()+1, end);
return back;
}
/**
* getLinkVariable
*
*
* @param content
* @param field
* @return
*/
public String getLinkVariable(String content, String field)
{
String back = "";
int pos = content.indexOf(field + "=");
if(pos > -1)
{
int end = content.indexOf("&", pos);
int end2 = content.indexOf("\r\n", pos);
if( (end == -1) || (end2 < end))
{
end = end2;
}
back = content.substring( pos + field.length() +1, end);
}
return back;
}
/**
* getCookieVariable
*
*
* @param content
* @param field
* @return
*/
public String getCookieVariable(String content, String field)
{
String back = "";
int pos = content.indexOf(field + "=");
if(pos > -1)
{
int end = content.indexOf(";", pos);
int end2 = content.indexOf("\r\n", pos);
if( (end == -1) || ( ( end2 != -1 ) && (end2 < end) ))
{
end = end2;
}
if( end == -1 )
{
end = content.length();
}
back = content.substring( pos + field.length() +1, end);
}
return back;
}
/**
* getSocketHeaderField
*
* @param content
* @param field
* @return
*/
public String getSocketHeaderField(String content, String field)
{
String back = "";
int pos = content.indexOf(field + "=");
if(pos > -1)
{
int end = content.indexOf(";", pos);
//int end2 = content.indexOf("\r\n", pos);
int end2 = content.length();
if( (end == -1) || (end2 < end))
{
end = end2;
}
back = content.substring( pos + field.length() +1, end);
}
return back;
}
/**
* isHostMoved
* is server send host moved
*
* @param host
* @param path
* @return
* @throws Exception
*/
public String isHostMoved(String host, String path) throws Exception
{
if( path == null )
{
path = "/";
}
String back = "";
String buffer = this.openHttpContentSite(host + path);
HttpURLConnection tmp = (HttpURLConnection) this._con;
int httpcode = tmp.getResponseCode();
if( httpcode == HttpURLConnection.HTTP_MOVED_PERM )
{
back = tmp.getHeaderField("Location");
}
return back;
}
/**
* isNotFound
* server send site not found
*
* @return boolean
*/
public boolean isNotFound()
{
try
{
if( this._con.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND )
{
return true;
}
}
catch( IOException ex)
{
}
return false;
}
/**
* getLocation
* server send location (move)
*
* @return String
*/
public String getLocation()
{
return this._con.getHeaderField("Location");
}
/**
* getCookie
* get cookie in String
*
* @return String
*/
public String getCookie()
{
return this._cookie;
}
/**
* setCookie
* set cookie
*
* @param cookie String
*/
public void setCookie(String cookie)
{
this._cookie = cookie;
}
}

View File

@ -0,0 +1,138 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.Certificate;
import java.security.KeyStore;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
import sun.misc.BASE64Encoder;
import sun.security.provider.X509Factory;
/**
* BaseHttpsTrustManager
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class BaseHttpsTrustManager implements javax.net.ssl.X509TrustManager
{
private ArrayList<X509Certificate> acceptcerts = new ArrayList<X509Certificate>();
public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {
for( int i=0; i<xcs.length; i++ )
{
X509Certificate cs = xcs[i];
if( this.acceptcerts.indexOf(cs) != -1 )
{
return;
}
try
{
cs.checkValidity();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(
TrustManagerFactory.getDefaultAlgorithm());
tmf.init((KeyStore)null);
TrustManager[] tms = tmf.getTrustManagers();
if( tms.length > 0 )
{
X509TrustManager x509TrustManager = (X509TrustManager) tms[0];
x509TrustManager.checkServerTrusted(xcs, string);
}
}
catch(Exception exp)
{
String certinfo =
jegwConst.getConstTag("egw_txt_tm_certinfo") +
"\r\n" + jegwConst.getConstTag("egw_txt_tm_issuer_dn") +
" " + cs.getIssuerDN().toString() + "\r\n" +
jegwConst.getConstTag("egw_txt_tm_subject_dn") +
" " + cs.getSubjectDN().toString() + "\r\n";
String info = jegwConst.getConstTag("egw_msg_tm_certerror") +
"\r\n" + certinfo +
jegwConst.getConstTag("egw_msg_tm_connected");
if( jegwMain.confirmDialog(info,
jegwConst.getConstTag("egw_msg_tm_title_errorssl")) != 0 )
{
throw new CertificateException(exp.getMessage());
}
this.acceptcerts.add(cs);
}
}
}
public X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[] {};
}
/**
* getAcceptedCerts
* return all accepted Certs
*
* @return String Certs in PEM
* @throws CertificateEncodingException
*/
public String getAcceptedCerts() throws CertificateEncodingException
{
String certs = "";
for( int i=0; i<this.acceptcerts.size(); i++ )
{
X509Certificate cert = this.acceptcerts.get(i);
BASE64Encoder encoder = new BASE64Encoder();
certs += X509Factory.BEGIN_CERT;
certs += encoder.encodeBuffer(cert.getEncoded());
certs += X509Factory.END_CERT;
certs += "\r\n\r\n";
}
return certs;
}
public void setAcceptedCerts(String strcerts) throws CertificateException
{
String[] tmp = strcerts.split("\r\n\r\n");
for( int i=0; i<tmp.length; i++ )
{
CertificateFactory cf = CertificateFactory.getInstance("X.509");
InputStream is = new ByteArrayInputStream(tmp[i].getBytes());
X509Certificate cert = (X509Certificate) cf.generateCertificate(is);
this.acceptcerts.add(cert);
}
}
}

View File

@ -0,0 +1,55 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.Key;
import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
/**
* CryptDES
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class CryptDES
{
public void encode( byte[] bytes, OutputStream out, String pass ) throws Exception
{
Cipher c = Cipher.getInstance( "DES" );
Key k = new SecretKeySpec( pass.getBytes(), "DES" );
c.init( Cipher.ENCRYPT_MODE, k );
OutputStream cos = new CipherOutputStream( out, c );
cos.write( bytes );
cos.close();
}
public byte[] decode( InputStream is, String pass ) throws Exception
{
Cipher c = Cipher.getInstance( "DES" );
Key k = new SecretKeySpec( pass.getBytes(), "DES" );
c.init( Cipher.DECRYPT_MODE, k );
ByteArrayOutputStream bos = new ByteArrayOutputStream();
CipherInputStream cis = new CipherInputStream( is, c );
for(int b; (b = cis.read()) != -1; )
{
bos.write( b );
}
cis.close();
return bos.toByteArray();
}
}

View File

@ -0,0 +1,55 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;
/**
* EgroupwareTrayApp
* The main class of the application.
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class EgroupwareTrayApp extends SingleFrameApplication {
/**
* At startup create and show the main frame of the application.
*/
@Override protected void startup() {
}
/**
* This method is to initialize the specified window by injecting resources.
* Windows shown in our application come fully initialized from the GUI
* builder, so this additional configuration is not needed.
*/
@Override protected void configureWindow(java.awt.Window root) {
}
/**
* A convenient static getter for the application instance.
* @return the instance of EgroupwareTrayApp
*/
public static EgroupwareTrayApp getApplication() {
return Application.getInstance(EgroupwareTrayApp.class);
}
/**
* Main method launching the application.
*/
public static void main(String[] args)
{
// Trayer Main Classe erstellen
new jegwMain();
}
}

View File

@ -0,0 +1,210 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* HexString
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class HexString
{
public static boolean isTwoHexDigitsEncodable(String s)
{
for(int i=0; i<s.length(); i++)
{
if(s.charAt(i)>(char)0xFF)
{
return false;
}
}
return true;
}
public static String toHexString(String text)
{
StringBuilder builder=new StringBuilder(text.length()*2);
char c;
for(int i=0; i<text.length(); i++)
{
builder.append( ((c=text.charAt(i))<(char)0x10 ? "0" : "")+Integer.toHexString(c));
}
return builder.toString();
}
public static String fromHexString(String hex)
{
StringBuilder b=new StringBuilder(hex.length()/2);
for(int i=0; i<hex.length(); i+=2)
{
b.append((char)Integer.parseInt(hex.substring(i, i+2) , 16));
}
return b.toString();
}
public static String getMD5Hash(String string)
{
try
{
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(string.getBytes());
byte[] digest = md5.digest();
string = byteArrToHexString(digest);
}
catch (NoSuchAlgorithmException e1)
{
e1.printStackTrace();
}
return string;
}
public static String byteArrToHexString(byte[] bArr)
{
/*StringBuffer sb = new StringBuffer();
for (int i = 0; i < bArr.length; i++)
{
int unsigned = bArr[i] & 0xff;
sb.append(Integer.toHexString((unsigned)));
}
return sb.toString();*/
StringBuffer buf = new StringBuffer();
for( int i = 0; i < bArr.length; i++ )
{
int halfbyte = (bArr[i] >>> 4) & 0x0F;
int two_halfs = 0;
do
{
if ((0 <= halfbyte) && (halfbyte <= 9))
{
buf.append((char) ('0' + halfbyte));
}
else
{
buf.append((char) ('a' + (halfbyte - 10)));
}
halfbyte = bArr[i] & 0x0F;
}
while(two_halfs++ < 1);
}
return buf.toString();
}
public static byte[] hexStringToByteArray(String s)
{
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2)
{
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i+1), 16));
}
return data;
}
public static String IntToHexStr(int e, int length)
{
String tmp = Integer.toHexString(e);
for(int i = tmp.length(); i<length; i++)
{
tmp = "0" + tmp;
}
return tmp;
}
public static String IntToShortStr(int e)
{
String back = "";
String tmp = HexString.IntToHexStr(e, 4);
back = tmp.substring(2, 4);
back = back + tmp.substring(0, 2);
return back;
}
public static String IntToDWordStr(int e)
{
String back = "";
String tmp = HexString.IntToHexStr(e, 8);
back = tmp.substring(6, 8);
back = back + tmp.substring(4, 6);
back = back + tmp.substring(2, 4);
back = back + tmp.substring(0, 2);
return back;
}
public static Integer hexStrDWordToInt(String hex)
{
String tmp = "";
tmp = hex.substring(6, 8);
tmp = tmp + hex.substring(4, 6);
tmp = tmp + hex.substring(2, 4);
tmp = tmp + hex.substring(0, 2);
return Integer.parseInt(tmp, 16);
}
public static Integer hexStrWordToInt(String hex)
{
String tmp = "";
tmp = hex.substring(2, 4);
tmp = tmp + hex.substring(0, 2);
return Integer.parseInt(tmp, 16);
}
public static String IntToHexByteStr(Integer e)
{
return HexString.IntToHexStr(e, 2);
}
public static Integer byteHexStrToInt(String hex)
{
return Integer.parseInt(hex, 16);
}
public static String FillHexLengthRigth(String str, int slength)
{
String back = str;
for(int i = str.length(); i < slength; i++)
{
back = back + HexString.fromHexString("00");
}
return back;
}
}

View File

@ -0,0 +1,139 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* KeyArray
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class KeyArray
{
private String[] keys = {};
private ArrayList lkey = new ArrayList();
private ArrayList lvalue = new ArrayList();
public KeyArray(String[] keys)
{
this.keys = keys;
}
public void add(String key, Object o)
{
for(int i=0; i<this.lkey.size(); i++ )
{
String tkey = (String) this.lkey.get(i);
if(tkey.compareTo(key) == 0)
{
this.lvalue.set(i, o);
return;
}
}
this.lkey.add(key);
this.lvalue.add(o);
}
public Object get(String key)
{
for(int i=0; i<this.lkey.size(); i++ )
{
String tkey = (String) this.lkey.get(i);
if(tkey.compareTo(key) == 0)
{
return this.lvalue.get(i);
}
}
return null;
}
public String getString(String key)
{
String tmp = "";
try
{
Object tob = this.get(key);
if( tob != null )
{
tmp = tob.toString();
}
}
catch(Exception e)
{
Logger.getLogger(KeyArray.class.getName()).log(Level.SEVERE, null, e);
//Keine Meldung
}
return tmp;
}
public String[] getKeys()
{
return this.keys;
}
@Override
public Object clone()
{
/*try
{*/
KeyArray tmp = new KeyArray(this.keys);
for(int i=0; i<this.keys.length; i++)
{
tmp.add(this.keys[i], this.get(this.keys[i]));
}
return tmp;
/*}
catch (CloneNotSupportedException e)
{
throw new InternalError();
}*/
}
public Integer size()
{
Integer size = 0;
if(this.lkey.size() == this.lvalue.size())
{
size = this.lkey.size();
}
return size;
}
public Boolean existKey(String key)
{
for(int i=0; i<this.keys.length; i++ )
{
String tkey = (String) this.keys[i];
if(tkey.compareTo(key) == 0)
{
return true;
}
}
return false;
}
}

View File

@ -0,0 +1,29 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
/**
* ajax_responsdata
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class ajax_responsdata
{
private String _type;
private Object _data;
public String getType() { return this._type; }
public Object getData() { return this._data; }
public void setType(String n) { this._type = n; }
public void setData(Object n) { this._data = n; }
}

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>

View File

@ -0,0 +1,58 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
/*
* egwAbout.java
*
* Created on 11.12.2010, 00:32:35
*/
package egroupwaretray;
/**
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class egwAbout extends javax.swing.JPanel {
/** Creates new form egwAbout */
public egwAbout() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setName("Form"); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="name" type="java.lang.String" value="jScrollPane1" noResource="true"/>
</Properties>
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="jTable1">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="3" rowCount="4">
<Column editable="true" title="Programm" type="java.lang.Object"/>
<Column editable="true" title="Info" type="java.lang.Object"/>
<Column editable="true" title="Anzahl" type="java.lang.Object"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
</TableColumnModel>
</Property>
<Property name="enabled" type="boolean" value="false"/>
<Property name="name" type="java.lang.String" value="jTable1" noResource="true"/>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,73 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* egwAppList.java
*
* Created on 10.12.2010, 22:34:21
*/
package egroupwaretray;
/**
*
* @author swe
*/
public class egwAppList extends javax.swing.JPanel {
public egwAppList() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setName("Form"); // NOI18N
jScrollPane1.setName("jScrollPane1"); // NOI18N
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Programm", "Info", "Anzahl"
}
));
jTable1.setEnabled(false);
jTable1.setName("jTable1"); // NOI18N
jScrollPane1.setViewportView(jTable1);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(egroupwaretray.EgroupwareTrayApp.class).getContext().getResourceMap(egwAppList.class);
jTable1.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("jTable1.columnModel.title0")); // NOI18N
jTable1.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("jTable1.columnModel.title1")); // NOI18N
jTable1.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("jTable1.columnModel.title2")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,97 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* egwPasswordCrypt
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class egwPasswordCrypt
{
private String getMacAddress()
{
try
{
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
byte[] mac = network.getHardwareAddress();
StringBuilder sb = new StringBuilder();
for( int i=0; i<mac.length; i++ )
{
sb.append(String.format("%02X%s",
mac[i], (i < mac.length - 1) ? "-" : ""));
}
return sb.toString();
}
catch( Exception ex )
{
Logger.getLogger(egwPasswordCrypt.class.getName()).log(Level.SEVERE, null, ex);
}
return "00-00-00-00-00-00";
}
private String sysKey()
{
String systemkey = "";
systemkey += System.getProperty("os.name");
systemkey += System.getProperty("os.version");
systemkey += System.getProperty("os.arch");
systemkey += System.getProperty("user.name");
systemkey += System.getProperty("user.home");
systemkey += this.getMacAddress();
return HexString.getMD5Hash(systemkey);
}
public String encode(String password) throws Exception
{
String systemkey = this.sysKey();
ByteArrayOutputStream out = new ByteArrayOutputStream();
CryptDES des = new CryptDES();
des.encode(password.getBytes(), out, systemkey.substring(0, 8));
String back = HexString.byteArrToHexString(out.toByteArray());
return back;
}
public String decode(String password) throws Exception
{
String systemkey = this.sysKey();
byte[] decode = HexString.hexStringToByteArray(password);
CryptDES des = new CryptDES();
InputStream is = new ByteArrayInputStream(decode);
String back = new String(des.decode(is, systemkey.substring(0, 8)));
return back;
}
}

View File

@ -0,0 +1,188 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import javax.swing.* ;
import java.awt.* ;
import java.awt.event.* ;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
/**
* hwTrayIcon
*
* http://stackoverflow.com/questions/5057639/systemtray-based-application-without-window-on-mac-os-x
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class hwTrayIcon extends JFrame implements MouseMotionListener, MouseListener
{
private SystemTray stray;
private TrayIcon trayicon;
private Image imgicon;
private String tolltip;
private ArrayList popupitems = new ArrayList();
private ActionListener trayaction = null;
public hwTrayIcon(String tolltipe, String icon)
{
this.stray = SystemTray.getSystemTray();
this.tolltip = tolltipe;
try {
this.imgicon = hwTrayIcon.getImage(icon);
} catch (IOException ex) {
Logger.getLogger(hwTrayIcon.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static Image getImage(String file) throws IOException
{
InputStream iImg =
ClassLoader.getSystemClassLoader().getResourceAsStream(
file
);
return ImageIO.read(iImg);
}
public void createTrayIcon()
{
PopupMenu popup = new PopupMenu();
for(int i=0; i<this.popupitems.size(); i++)
{
popup.add((MenuItem)this.popupitems.get(i));
}
this.trayicon = new TrayIcon(this.imgicon, this.tolltip, popup);
if(this.trayaction != null)
{
this.trayicon.addActionListener(this.trayaction);
this.trayicon.addMouseListener(this);
this.trayicon.addMouseMotionListener(this);
}
try
{
this.stray.add(this.trayicon);
}
catch (AWTException e)
{
System.err.println(
jegwConst.getConstTag("egw_msg_trayicon_init_error"));
}
}
public void setDisableMenuItem(String name, boolean enable)
{
for(int i=0; i<this.trayicon.getPopupMenu().getItemCount(); i++ )
{
MenuItem tmp = this.trayicon.getPopupMenu().getItem(i);
if( tmp.getLabel().compareTo(name) == 0 )
{
tmp.setEnabled(enable);
}
}
}
public void addTrayAction(ActionListener action)
{
this.trayaction = action;
}
public void addMenuItem(String title, ActionListener lister)
{
MenuItem mItem = new MenuItem(title);
mItem.addActionListener(lister);
this.popupitems.add(mItem);
}
public void showBallon(String title, String text, TrayIcon.MessageType type)
{
this.trayicon.displayMessage(title, text, type);
}
public void changeIcon(String icon)
{
try {
this.imgicon = hwTrayIcon.getImage(icon);
} catch (IOException ex) {
Logger.getLogger(hwTrayIcon.class.getName()).log(Level.SEVERE, null, ex);
}
this.trayicon.setImage(this.imgicon);
this.trayicon.setImageAutoSize(true);
}
public String getTooltip()
{
return this.trayicon.getToolTip();
}
public void setTooltip(String text)
{
this.trayicon.setToolTip(text);
}
protected void action(String command)
{
ActionEvent e = new ActionEvent(
this,
ActionEvent.ACTION_PERFORMED,
command
);
this.trayaction.actionPerformed(e);
}
public void mouseDragged(MouseEvent e)
{
// nix
}
public void mouseMoved(MouseEvent e)
{
}
public void mouseClicked(MouseEvent e)
{
this.action("clicked");
}
public void mousePressed(MouseEvent e)
{
}
public void mouseReleased(MouseEvent e)
{
}
public void mouseEntered(MouseEvent e)
{
}
public void mouseExited(MouseEvent e)
{
}
}

View File

@ -0,0 +1,64 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.util.ArrayList;
/**
* hwTrayIconChanger
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class hwTrayIconChanger
{
private hwTrayIcon hwtray = null;
private int index = 0;
private ArrayList iconlist = new ArrayList();
public hwTrayIconChanger(hwTrayIcon hwtray)
{
this.hwtray = hwtray;
}
public void addIcon(String icon)
{
this.iconlist.add(icon);
}
public void clearIconList()
{
this.iconlist.clear();
}
public int getIconCount()
{
return this.iconlist.size();
}
public void changeIcon()
{
if( this.iconlist.size() == 0 )
{
return;
}
if( this.index >= this.iconlist.size() )
{
this.index = 0;
}
String icon = (String) this.iconlist.get(this.index);
this.hwtray.changeIcon(icon);
this.index++;
}
}

View File

@ -0,0 +1,176 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URL;
import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.events.Characters;
import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.StartDocument;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
/**
* hwxml
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class hwxml
{
private InputStream istream = null;
private String file = "";
private boolean newfile = false;
public hwxml(InputStream xmlfile) throws Exception
{
this.istream = xmlfile;
}
public hwxml(URL xmlfile) throws Exception
{
this.file = xmlfile.getFile();
File f = new File(xmlfile.toURI());
if(!f.exists())
{
f.createNewFile();
this.newfile = true;
}
if(f.length() == 0 )
{
this.newfile = true;
}
}
public hwxml(String xmlfile) throws Exception
{
this.file = xmlfile;
File f = new File(xmlfile);
if(!f.exists())
{
f.createNewFile();
this.newfile = true;
}
if(f.length() == 0 )
{
this.newfile = true;
}
}
public void read(boolean oneVarModus) throws Exception
{
if( !this.newfile )
{
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
InputStream in = null;
if( this.istream != null )
{
in = this.istream;
}
else
{
in = new FileInputStream(this.file);
}
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
while( eventReader.hasNext() )
{
XMLEvent event = eventReader.nextEvent();
if( this.mRead(event, eventReader) )
{
if( oneVarModus )
{
break;
}
}
}
}
}
protected boolean mRead(XMLEvent event, XMLEventReader eventReader)
{
return false;
// Override
}
public void write() throws Exception
{
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
FileOutputStream out = new FileOutputStream(this.file);
XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(out);
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\r\n");
StartDocument startDocument = eventFactory.createStartDocument();
eventWriter.add(startDocument);
eventWriter.add(end);
eventWriter.add(this.makeStartTag("root"));
eventWriter.add(end);
this.mWrite(eventFactory, eventWriter);
eventWriter.add(this.makeEndTag("root"));
eventWriter.add(end);
eventWriter.close();
this.newfile = false;
}
protected void mWrite(XMLEventFactory eventFactory, XMLEventWriter eventWriter)
{
// Override
}
protected StartElement makeStartTag(String name)
{
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
return eventFactory.createStartElement("", "", name);
}
protected EndElement makeEndTag(String name)
{
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
return eventFactory.createEndElement("", "", name);
}
protected Characters makeValue(String value)
{
if( value == null )
{
value = "";
}
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
return eventFactory.createCharacters(value);
}
}

View File

@ -0,0 +1,341 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.7" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<NonVisualComponents>
<Container class="javax.swing.JDialog" name="jDialog1">
<Properties>
<Property name="name" type="java.lang.String" value="jDialog1" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" min="-2" pref="229" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPaccountsetting" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="10" pref="10" max="10" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="455" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPaccountsetting" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="name" type="java.lang.String" value="jScrollPane1" noResource="true"/>
</Properties>
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTree" name="jTegwoverview">
<Properties>
<Property name="model" type="javax.swing.tree.TreeModel" editor="org.netbeans.modules.form.editors2.TreeModelEditor">
<TreeModel code="eGroupwares"/>
</Property>
<Property name="doubleBuffered" type="boolean" value="true"/>
<Property name="name" type="java.lang.String" value="jTegwoverview" noResource="true"/>
<Property name="showsRootHandles" type="boolean" value="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jTegwoverviewMouseClicked"/>
<EventHandler event="mouseDragged" listener="java.awt.event.MouseMotionListener" parameters="java.awt.event.MouseEvent" handler="jTegwoverviewMouseDragged"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPaccountsetting">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Account Einstellungen">
<Property name="titleX" resourceKey="jPaccountsetting.border.title"/>
</TitledBorder>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="jPaccountsetting" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jBsave" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLhost" alignment="0" pref="61" max="32767" attributes="1"/>
<Component id="jLabel1" alignment="0" pref="61" max="32767" attributes="1"/>
<Component id="jLabel2" alignment="0" pref="61" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLsamplehost" alignment="0" pref="238" max="32767" attributes="0"/>
<Component id="jTFhost" alignment="0" pref="238" max="32767" attributes="0"/>
<Component id="jTFusername" alignment="0" pref="238" max="32767" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="1" attributes="1">
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
<Component id="jBedit" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jBcancel" min="-2" pref="97" max="-2" attributes="0"/>
</Group>
<Component id="jLsampleuser" alignment="1" min="-2" pref="228" max="-2" attributes="0"/>
</Group>
<Component id="jLsamplepath" alignment="0" pref="238" max="32767" attributes="0"/>
<Component id="jTFegwurl" alignment="1" min="-2" pref="238" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLhost" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTFhost" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLsamplehost" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTFegwurl" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLsamplepath" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jTFusername" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLsampleuser" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="118" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jBsave" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jBedit" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jBcancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLhost">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLhost.text"/>
<Property name="name" type="java.lang.String" value="jLhost" noResource="true"/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" resourceKey="jLhost.AccessibleContext.accessibleName"/>
</AccessibilityProperties>
</Component>
<Component class="javax.swing.JTextField" name="jTFhost">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTFhost.text"/>
<Property name="name" type="java.lang.String" value="jTFhost" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLsamplehost">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLsamplehost.text"/>
<Property name="name" type="java.lang.String" value="jLsamplehost" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/>
<Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLsamplepath">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLsamplepath.text"/>
<Property name="name" type="java.lang.String" value="jLsamplepath" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel2.text"/>
<Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTFusername">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTFusername.text"/>
<Property name="name" type="java.lang.String" value="jTFusername" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLsampleuser">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLsampleuser.text"/>
<Property name="name" type="java.lang.String" value="jLsampleuser" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jBsave">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jBsave.text"/>
<Property name="name" type="java.lang.String" value="jBsave" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jBsaveMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jBcancel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jBcancel.text"/>
<Property name="name" type="java.lang.String" value="jBcancel" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jBcancelMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jBedit">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jBedit.text"/>
<Property name="name" type="java.lang.String" value="jBedit" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jBeditMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="jTFegwurl">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jTFegwurl.text"/>
<Property name="name" type="java.lang.String" value="jTFegwurl" noResource="true"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Aktiver Account">
<Property name="titleX" resourceKey="jPanel1.border.title"/>
</TitledBorder>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="jPanel1" noResource="true"/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" resourceKey="jPanel1.AccessibleContext.accessibleName"/>
</AccessibilityProperties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLuserstatus" alignment="0" pref="305" max="32767" attributes="0"/>
<Component id="lhoststatus" alignment="0" pref="305" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jBSelectActiv" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="73" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="lhoststatus" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLuserstatus" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jBSelectActiv" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="java.awt.Label" name="lhoststatus">
<Properties>
<Property name="name" type="java.lang.String" value="lhoststatus" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="lhoststatus.text"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLuserstatus">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLuserstatus.text"/>
<Property name="name" type="java.lang.String" value="jLuserstatus" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jBSelectActiv">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jBSelectActiv.text"/>
<Property name="name" type="java.lang.String" value="jBSelectActiv" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jBSelectActivMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,578 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
/*
* jegwConfigDialog.java
*
* Created on 19.05.2009, 14:23:15
*/
package egroupwaretray;
import java.awt.Component;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;
/**
* jegwConfigDialog
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwConfigDialog extends javax.swing.JDialog {
private jegwconfig config = null;
private Integer configindex = -1;
/** Creates new form jegwConfigDialog */
public jegwConfigDialog(java.awt.Frame parent, boolean modal, jegwconfig configmanager)
{
super(parent, modal);
initComponents();
this.config = configmanager;
this.showConfig();
this.jBcancel.setEnabled(false);
this.jBedit.setEnabled(false);
}
private void showConfig()
{
DefaultMutableTreeNode root = (DefaultMutableTreeNode)((DefaultTreeModel) jTegwoverview.getModel()).getRoot();
// Alle Nodes Löschen und Root Knoten wieder hinzufügen
((DefaultTreeModel)jTegwoverview.getModel()).setRoot(null);
javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("eGroupwares");
jTegwoverview.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
KeyArray aktivconf = this.config.getCXMLM().getActivConf();
if(aktivconf == null)
{
return;
}
// Aktiver User anzeigen
this.lhoststatus.setText(aktivconf.getString("host"));
this.jLuserstatus.setText(aktivconf.getString("user"));
this.jTegwoverview.setCellRenderer(new Renderer2());
for( int g=0; g<this.config.getCXMLM().countConf(); g++ )
{
root = (DefaultMutableTreeNode)((DefaultTreeModel) jTegwoverview.getModel()).getRoot();
KeyArray conf = this.config.getCXMLM().getConf(g);
DefaultMutableTreeNode subnode = null;
for( int i=0; i<root.getChildCount(); i++ )
{
DefaultMutableTreeNode node = (DefaultMutableTreeNode) root.getChildAt(i);
String nodename = (String) node.getUserObject();
if( nodename.compareTo(conf.getString("host")) == 0 )
{
subnode = node;
}
}
if(subnode == null)
{
DefaultMutableTreeNode host = new DefaultMutableTreeNode(conf.getString("host"));
((DefaultTreeModel) jTegwoverview.getModel()).insertNodeInto(host, root, 0);
subnode = host;
}
DefaultMutableTreeNode user = new DefaultMutableTreeNode(conf.getString("user"));
((DefaultTreeModel) jTegwoverview.getModel()).insertNodeInto(user, subnode, 0);
}
}
public void infoDialog(String str, String title)
{
JOptionPane.showMessageDialog(EgroupwareTrayApp.getApplication().getMainFrame(),
str, title, JOptionPane.INFORMATION_MESSAGE);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jDialog1 = new javax.swing.JDialog();
jScrollPane1 = new javax.swing.JScrollPane();
jTegwoverview = new javax.swing.JTree();
jPaccountsetting = new javax.swing.JPanel();
jLhost = new javax.swing.JLabel();
jTFhost = new javax.swing.JTextField();
jLsamplehost = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLsamplepath = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTFusername = new javax.swing.JTextField();
jLsampleuser = new javax.swing.JLabel();
jBsave = new javax.swing.JButton();
jBcancel = new javax.swing.JButton();
jBedit = new javax.swing.JButton();
jTFegwurl = new javax.swing.JTextField();
jPanel1 = new javax.swing.JPanel();
lhoststatus = new java.awt.Label();
jLuserstatus = new javax.swing.JLabel();
jBSelectActiv = new javax.swing.JButton();
jDialog1.setName("jDialog1"); // NOI18N
javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
jDialog1.getContentPane().setLayout(jDialog1Layout);
jDialog1Layout.setHorizontalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
jDialog1Layout.setVerticalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(egroupwaretray.EgroupwareTrayApp.class).getContext().getResourceMap(jegwConfigDialog.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setName("Form"); // NOI18N
jScrollPane1.setName("jScrollPane1"); // NOI18N
javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("eGroupwares");
jTegwoverview.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
jTegwoverview.setDoubleBuffered(true);
jTegwoverview.setName("jTegwoverview"); // NOI18N
jTegwoverview.setShowsRootHandles(true);
jTegwoverview.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTegwoverviewMouseClicked(evt);
}
});
jTegwoverview.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
jTegwoverviewMouseDragged(evt);
}
});
jScrollPane1.setViewportView(jTegwoverview);
jPaccountsetting.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPaccountsetting.border.title"))); // NOI18N
jPaccountsetting.setName("jPaccountsetting"); // NOI18N
jLhost.setText(resourceMap.getString("jLhost.text")); // NOI18N
jLhost.setName("jLhost"); // NOI18N
jTFhost.setText(resourceMap.getString("jTFhost.text")); // NOI18N
jTFhost.setName("jTFhost"); // NOI18N
jLsamplehost.setText(resourceMap.getString("jLsamplehost.text")); // NOI18N
jLsamplehost.setName("jLsamplehost"); // NOI18N
jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
jLabel1.setName("jLabel1"); // NOI18N
jLsamplepath.setText(resourceMap.getString("jLsamplepath.text")); // NOI18N
jLsamplepath.setName("jLsamplepath"); // NOI18N
jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
jLabel2.setName("jLabel2"); // NOI18N
jTFusername.setText(resourceMap.getString("jTFusername.text")); // NOI18N
jTFusername.setName("jTFusername"); // NOI18N
jLsampleuser.setText(resourceMap.getString("jLsampleuser.text")); // NOI18N
jLsampleuser.setName("jLsampleuser"); // NOI18N
jBsave.setText(resourceMap.getString("jBsave.text")); // NOI18N
jBsave.setName("jBsave"); // NOI18N
jBsave.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jBsaveMouseClicked(evt);
}
});
jBcancel.setText(resourceMap.getString("jBcancel.text")); // NOI18N
jBcancel.setName("jBcancel"); // NOI18N
jBcancel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jBcancelMouseClicked(evt);
}
});
jBedit.setText(resourceMap.getString("jBedit.text")); // NOI18N
jBedit.setName("jBedit"); // NOI18N
jBedit.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jBeditMouseClicked(evt);
}
});
jTFegwurl.setText(resourceMap.getString("jTFegwurl.text")); // NOI18N
jTFegwurl.setName("jTFegwurl"); // NOI18N
javax.swing.GroupLayout jPaccountsettingLayout = new javax.swing.GroupLayout(jPaccountsetting);
jPaccountsetting.setLayout(jPaccountsettingLayout);
jPaccountsettingLayout.setHorizontalGroup(
jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPaccountsettingLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jBsave, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPaccountsettingLayout.createSequentialGroup()
.addGroup(jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLhost, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLsamplehost, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
.addComponent(jTFhost, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
.addComponent(jTFusername, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPaccountsettingLayout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(jBedit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBcancel, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLsampleuser, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLsamplepath, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
.addComponent(jTFegwurl, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
);
jPaccountsettingLayout.setVerticalGroup(
jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPaccountsettingLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLhost)
.addComponent(jTFhost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLsamplehost)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTFegwurl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLsamplepath)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTFusername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLsampleuser)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 118, Short.MAX_VALUE)
.addGroup(jPaccountsettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBsave)
.addComponent(jBedit)
.addComponent(jBcancel))
.addContainerGap())
);
jLhost.getAccessibleContext().setAccessibleName(resourceMap.getString("jLhost.AccessibleContext.accessibleName")); // NOI18N
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
jPanel1.setName("jPanel1"); // NOI18N
lhoststatus.setName("lhoststatus"); // NOI18N
lhoststatus.setText(resourceMap.getString("lhoststatus.text")); // NOI18N
jLuserstatus.setText(resourceMap.getString("jLuserstatus.text")); // NOI18N
jLuserstatus.setName("jLuserstatus"); // NOI18N
jBSelectActiv.setText(resourceMap.getString("jBSelectActiv.text")); // NOI18N
jBSelectActiv.setName("jBSelectActiv"); // NOI18N
jBSelectActiv.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jBSelectActivMouseClicked(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLuserstatus, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
.addComponent(lhoststatus, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jBSelectActiv)
.addGap(73, 73, 73))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lhoststatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLuserstatus)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBSelectActiv)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPaccountsetting, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(10, 10, 10))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 455, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPaccountsetting, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
jPanel1.getAccessibleContext().setAccessibleName(resourceMap.getString("jPanel1.AccessibleContext.accessibleName")); // NOI18N
pack();
}// </editor-fold>//GEN-END:initComponents
private void jBsaveMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBsaveMouseClicked
this.showConfig();
if( this.configindex != -1 )
{
this.config.getCXMLM().deleteConf(this.configindex);
this.configindex = -1;
}
KeyArray conf = new KeyArray(jegwxmlconfig.CONF_STRUCT);
conf.add("host", this.jTFhost.getText());
conf.add("user", this.jTFusername.getText());
conf.add("egwurl", this.jTFegwurl.getText());
conf.add("password", "");
conf.add("logindomain", "");
conf.add("subdir", "");
this.config.getCXMLM().addConf(conf);
try
{
this.config.saveConfig();
this.showConfig();
this.jBcancelMouseClicked(null);
this.infoDialog("Ihre Einstellungen wurden erfolgreich gespeichert.", "Info");
}
catch (Exception ex)
{
Logger.getLogger(jegwConfigDialog.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jBsaveMouseClicked
private void jTegwoverviewMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTegwoverviewMouseClicked
if (evt.getClickCount() == 2)
{
try
{
TreeSelectionModel model = jTegwoverview.getSelectionModel();
String user = (String) model.getSelectionPath().getLastPathComponent().toString();
String host = (String) model.getSelectionPath().getParentPath().getLastPathComponent().toString();
for(int i=0; i<this.config.getCXMLM().countConf(); i++)
{
KeyArray conf = this.config.getCXMLM().getConf(i);
if( (conf.getString("user").compareTo(user) == 0) &&
(conf.getString("host").compareTo(host) == 0) )
{
this.jBsave.setEnabled(false);
this.jTFusername.setText(user);
this.jTFusername.setEnabled(false);
this.jTFhost.setText(host);
this.jTFhost.setEnabled(false);
this.jTFegwurl.setText(conf.getString("egwurl"));
this.jTFegwurl.setEnabled(false);
this.configindex = i;
//this.jTegwoverview.disable();
this.jBedit.setEnabled(true);
this.jBcancel.setEnabled(true);
return;
}
}
}
catch(Exception e)
{
// Keine meldung
Logger.getLogger(jegwConfigDialog.class.getName()).log(Level.SEVERE, null, e);
}
}
}//GEN-LAST:event_jTegwoverviewMouseClicked
private void jTegwoverviewMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTegwoverviewMouseDragged
// TODO add your handling code here:
}//GEN-LAST:event_jTegwoverviewMouseDragged
private void jBcancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBcancelMouseClicked
// TODO add your handling code here:
this.jTFhost.setText("");
this.jTFusername.setText("");
this.jTFegwurl.setText("");
this.jTFusername.setEnabled(true);
this.jTFhost.setEnabled(true);
this.jTFegwurl.setEnabled(true);
this.jBcancel.setEnabled(false);
this.jBsave.setEnabled(true);
this.jBedit.setEnabled(false);
//this.jTegwoverview.enable();
this.jTegwoverview.updateUI();
}//GEN-LAST:event_jBcancelMouseClicked
private void jBSelectActivMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBSelectActivMouseClicked
// TODO add your handling code here:
try
{
TreeSelectionModel model = jTegwoverview.getSelectionModel();
String user = (String) model.getSelectionPath().getLastPathComponent().toString();
String host = (String) model.getSelectionPath().getParentPath().getLastPathComponent().toString();
for(int i=0; i<this.config.getCXMLM().countConf(); i++)
{
KeyArray conf = this.config.getCXMLM().getConf(i);
if( (conf.getString("user").compareTo(user) == 0) &&
(conf.getString("host").compareTo(host) == 0) )
{
this.config.getCXMLM().setActivConf(i);
try
{
this.config.saveConfig();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(EgroupwareTrayApp.getApplication().getMainFrame(),
"Beim Speichern der Konfigurationsdatei trat ein Fehler auf!",
"Konfigurationsfehler", JOptionPane.ERROR_MESSAGE);
}
this.showConfig();
return;
}
}
throw new Exception("Bitte wählen Sie einen Account aus!");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(EgroupwareTrayApp.getApplication().getMainFrame(),
"Bitte wählen Sie einen Account aus!",
"Info", JOptionPane.INFORMATION_MESSAGE);
}
}//GEN-LAST:event_jBSelectActivMouseClicked
private void jBeditMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBeditMouseClicked
this.jTFusername.setEnabled(true);
this.jTFhost.setEnabled(true);
this.jTFegwurl.setEnabled(true);
this.jBsave.setEnabled(true);
this.jBedit.setEnabled(false);
}//GEN-LAST:event_jBeditMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
jegwConfigDialog dialog = new jegwConfigDialog(new javax.swing.JFrame(), true, null);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBSelectActiv;
private javax.swing.JButton jBcancel;
private javax.swing.JButton jBedit;
private javax.swing.JButton jBsave;
private javax.swing.JDialog jDialog1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLhost;
private javax.swing.JLabel jLsamplehost;
private javax.swing.JLabel jLsamplepath;
private javax.swing.JLabel jLsampleuser;
private javax.swing.JLabel jLuserstatus;
private javax.swing.JPanel jPaccountsetting;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTFegwurl;
private javax.swing.JTextField jTFhost;
private javax.swing.JTextField jTFusername;
private javax.swing.JTree jTegwoverview;
private java.awt.Label lhoststatus;
// End of variables declaration//GEN-END:variables
}
class Renderer2 extends DefaultTreeCellRenderer{
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus){
super.getTreeCellRendererComponent( tree, value, selected, expanded, leaf, row, hasFocus );
if(row == 0)
{
this.setIcon(new ImageIcon("img/fusion-icon2.png"));
}
else if(leaf)
{
this.setIcon(new ImageIcon("img/group.png"));
}
else
{
this.setIcon(new ImageIcon("img/favicon.png"));
}
return this;
}
}

View File

@ -0,0 +1,119 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.io.InputStream;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.events.XMLEvent;
import sun.misc.Launcher;
/**
* jegwConst
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwConst extends hwxml
{
private String tag = "";
private String value = "";
public jegwConst(InputStream xmlfile, String tag) throws Exception
{
super(xmlfile);
this.tag = tag;
}
public jegwConst(URL xmlfile, String tag) throws Exception
{
super(xmlfile);
this.tag = tag;
}
public jegwConst(String xmlfile, String tag) throws Exception
{
super(xmlfile);
this.tag = tag;
}
public String getValue()
{
return this.value;
}
@Override protected boolean mRead(XMLEvent event, XMLEventReader eventReader)
{
if(this.value.length() > 0)
{
return false;
}
if(event.isStartElement())
{
String stag = event.asStartElement().getName().getLocalPart();
try
{
event = eventReader.nextEvent();
if( (!event.isEndElement()) && (!event.isStartElement()) )
{
if( this.tag.compareTo(stag) == 0 )
{
String svalue = event.asCharacters().getData();
this.value = svalue;
return true;
}
}
}
catch(Exception exp)
{
Logger.getLogger(jegwConst.class.getName()).log(Level.SEVERE, null, exp);
}
}
return false;
}
static public String getConstTag(String tag)
{
String re = "";
try
{
InputStream iConst =
ClassLoader.getSystemClassLoader().getResourceAsStream(
"lib/conf/egwnotifier.const.xml"
);
jegwConst sconst = new jegwConst(iConst, tag);
sconst.read(true);
re = sconst.getValue();
}
catch (Exception ex)
{
Logger.getLogger(jegwConst.class.getName()).log(Level.SEVERE, null, ex);
}
return re;
}
static public String getEGWStatus(String code)
{
String tag = "egw_sc_" + code;
return jegwConst.getConstTag(tag);
}
}

View File

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<NonVisualComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="name" type="java.lang.String" value="jPanel1" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="100" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="100" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
<Component id="jBOk" min="-2" pref="73" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jBOpenApp" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="32" max="32767" attributes="0"/>
</Group>
<Component id="jLinfoBox" alignment="0" pref="251" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLinfoBox" pref="79" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jBOk" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jBOpenApp" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLinfoBox">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLinfoBox.text"/>
<Property name="autoscrolls" type="boolean" value="true"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
<Property name="name" type="java.lang.String" value="jLinfoBox" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jBOk">
<Properties>
<Property name="font" type="java.awt.Font" resourceKey="jBOk.font"/>
<Property name="text" type="java.lang.String" resourceKey="jBOk.text"/>
<Property name="name" type="java.lang.String" value="jBOk" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jBOkMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jBOpenApp">
<Properties>
<Property name="font" type="java.awt.Font" resourceKey="jBOpenApp.font"/>
<Property name="text" type="java.lang.String" resourceKey="jBOpenApp.text"/>
<Property name="name" type="java.lang.String" value="jBOpenApp" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jBOpenAppMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,298 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
/*
* jegwInfoDialog.java
*
* Created on 23.05.2009, 00:32:16
*/
package egroupwaretray;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Timer;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.event.EventListenerList;
/**
* jegwInfoDialog
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwInfoDialog extends javax.swing.JDialog implements ActionListener
{
protected EventListenerList listenerList = new EventListenerList();
private Timer egwttask = new Timer(true);
private Integer uptime = 30;
private String notifiyid = "";
private Boolean isRead = false;
/** Creates new form jegwInfoDialog */
public jegwInfoDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.reSizeAndSetPos(400, 250);
jegwInfoDialogTask task = new jegwInfoDialogTask();
task.addActionListener(this);
this.jBOpenApp.setText(jegwConst.getConstTag("egw_msg_infodialog_runapp"));
this.isRead = false;
// Jeder Sekunde
this.egwttask.schedule(task, 1000, 1000);
}
public void reSizeAndSetPos(int w, int h)
{
// Dialog größe
// org w: 267, h: 155
//this.setPreferredSize();
this.setSize(new Dimension(w, h));
// Desktop Größe/App größe
Dimension desk = Toolkit.getDefaultToolkit().getScreenSize();
Dimension app = this.getSize();
Integer tw = desk.width - app.width;
Integer th = desk.height - app.height - 26;
this.setLocation(tw, th);
this.setAlwaysOnTop(true);
}
public Boolean isInfoRead()
{
return this.isRead;
}
public void setInfoDialog(String text)
{
this.jLinfoBox.setSize(new Dimension(400, 230));
this.reSizeAndSetPos(400, 250);
//this.jLinfoBox.setText("<html>" + text);
/*this.jLinfoBox.s
Font labelFont = this.jLinfoBox.getFont();
String labelText = this.jLinfoBox.getText();
int stringWidth = this.jLinfoBox.getFontMetrics(labelFont).stringWidth(labelText);
int componentWidth = this.jLinfoBox.getWidth();
double widthRatio = (double)componentWidth / (double)stringWidth;
int newFontSize = (int)(labelFont.getSize() * widthRatio);
int componentHeight = this.jLinfoBox.getHeight();
int fontSizeToUse = Math.min(newFontSize, componentHeight);
this.jLinfoBox.setFont(new Font(labelFont.getName(), Font.PLAIN, fontSizeToUse));
*/
JLabel textArea = new JLabel();
textArea.setSize(new Dimension(100, 175));
textArea.setMaximumSize(new Dimension(100, Integer.MAX_VALUE));
textArea.setText("<html>" + text);
//textArea.setEditable(false);
//textArea.setSize(new Dimension(400, 175));
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
scrollPane.getViewport().setView(textArea);
scrollPane.setSize(new Dimension(380, 175));
// wrap a scrollpane around it
//JScrollPane scrollPane = new JScrollPane(textArea);
jLinfoBox.add(scrollPane);
}
public void setNotifiyId(String id)
{
this.notifiyid = id;
}
public void addActionListener(ActionListener l)
{
listenerList.add(ActionListener.class, l);
}
protected void action(Object o, String command)
{
Object[] listeners = listenerList.getListenerList();
ActionEvent e = new ActionEvent(o, ActionEvent.ACTION_PERFORMED, command);
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==ActionListener.class) {
((ActionListener)listeners[i+1]).actionPerformed(e);
}
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLinfoBox = new javax.swing.JLabel();
jBOk = new javax.swing.JButton();
jBOpenApp = new javax.swing.JButton();
jPanel1.setName("jPanel1"); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setName("Form"); // NOI18N
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(egroupwaretray.EgroupwareTrayApp.class).getContext().getResourceMap(jegwInfoDialog.class);
jLinfoBox.setText(resourceMap.getString("jLinfoBox.text")); // NOI18N
jLinfoBox.setAutoscrolls(true);
jLinfoBox.setDoubleBuffered(true);
jLinfoBox.setName("jLinfoBox"); // NOI18N
jBOk.setFont(resourceMap.getFont("jBOk.font")); // NOI18N
jBOk.setText(resourceMap.getString("jBOk.text")); // NOI18N
jBOk.setName("jBOk"); // NOI18N
jBOk.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jBOkMouseClicked(evt);
}
});
jBOpenApp.setFont(resourceMap.getFont("jBOpenApp.font")); // NOI18N
jBOpenApp.setText(resourceMap.getString("jBOpenApp.text")); // NOI18N
jBOpenApp.setName("jBOpenApp"); // NOI18N
jBOpenApp.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jBOpenAppMouseClicked(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jBOk, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jBOpenApp)
.addContainerGap(32, Short.MAX_VALUE))
.addComponent(jLinfoBox, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLinfoBox, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBOk)
.addComponent(jBOpenApp))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jBOkMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBOkMouseClicked
this.isRead = true;
this.setVisible(false);
}//GEN-LAST:event_jBOkMouseClicked
private void jBOpenAppMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBOpenAppMouseClicked
//this.isRead = true;
// TODO add your handling code here:
// App Öffnen
this.action(this, "OPENAPP:" + this.notifiyid);
this.setVisible(false);
}//GEN-LAST:event_jBOpenAppMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
jegwInfoDialog dialog = new jegwInfoDialog(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBOk;
private javax.swing.JButton jBOpenApp;
private javax.swing.JLabel jLinfoBox;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
public void actionPerformed(ActionEvent e)
{
final jegwInfoDialog telement = this;
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if(telement.uptime > 0)
{
telement.uptime--;
telement.jBOk.setText(Integer.toString(telement.uptime) + " Ok");
}
if(telement.uptime <= 0)
{
telement.setVisible(false);
telement.egwttask.cancel();
}
}
});
}
}

View File

@ -0,0 +1,55 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.TimerTask;
import javax.swing.event.EventListenerList;
/**
* jegwInfoDialogTask
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwInfoDialogTask extends TimerTask
{
protected EventListenerList listenerList = new EventListenerList();
public static final String EGW_TASK_TIME_DOWN = new String("egwdialogtimedown");
public void addActionListener(ActionListener l)
{
listenerList.add(ActionListener.class, l);
}
protected void action(Object o, String command)
{
Object[] listeners = listenerList.getListenerList();
ActionEvent e = new ActionEvent(o, ActionEvent.ACTION_PERFORMED, command);
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==ActionListener.class) {
((ActionListener)listeners[i+1]).actionPerformed(e);
}
}
}
@Override
public void run() {
this.action(this, EGW_TASK_TIME_DOWN);
}
}

View File

@ -0,0 +1,709 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import edu.stanford.ejalbert.BrowserLauncher;
import egroupwaretray.settings.egwSettingUrl;
import java.awt.MenuItem;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Timer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
* jegwMain
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwMain implements ActionListener
{
private hwTrayIcon hwtray = new hwTrayIcon(
jegwConst.getConstTag("egwtitle"),
jegwConst.getConstTag("egwiconoff"));
private jegwconfig egwconfig = null;
private KeyArray activconf = null;
private jegwhttp egwhttp = new jegwhttp(this);
private KeyArray egwcookie = null;
private Timer egwttask = new Timer();
private Timer egwtcd = new Timer();
private jegwapplications applications = new jegwapplications(this);
private hwTrayIconChanger _iconchanger = null;
public jegwMain()
{
try
{
if( !SystemTray.isSupported() )
{
jegwMain.infoDialog("The system tray isnt supported!", "Error");
System.exit(0);
}
/**
* Einstellungen Laden
*/
try
{
this.egwconfig = new jegwconfig(
jegwConst.getConstTag("egwaccountfile"));
this.egwconfig.loadConfig();
}
catch( Exception exp )
{
jegwMain.infoDialog(
"Error on load const file: no such file.",
"Warning");
System.exit(0);
}
if( this.egwconfig.getCXMLM().countConf() < 1 )
{
String turl = jegwConst.getConstTag("egw_dc_url").trim();
String tlogindomain = jegwConst.getConstTag("egw_dc_logindomain").trim();
String tusername = jegwConst.getConstTag("egw_dc_username").trim();
if( (!turl.isEmpty()) &&
(!tlogindomain.isEmpty()) &&
(!tusername.isEmpty()) )
{
KeyArray config = new KeyArray(jegwxmlconfig.CONF_STRUCT);
config.add("host", "oneconfig");
config.add("user", tusername);
config.add("logindomain", tlogindomain);
config.add("egwurl", turl);
this.egwconfig.getCXMLM().addConf(config);
this.egwconfig.saveConfig();
}
else
{
jegwMain.infoDialog(
jegwConst.getConstTag("egw_msg_config_create"),
jegwConst.getConstTag("info_info")
);
JFrame jf = EgroupwareTrayApp.getApplication().getMainFrame();
JDialog dialog = new egwSettingUrl(jf, true, this.egwconfig);
try {
dialog.setIconImage(hwTrayIcon.getImage(jegwConst.getConstTag("egwicon")));
} catch (IOException ex) {
Logger.getLogger(hwTrayIcon.class.getName()).log(Level.SEVERE, null, ex);
}
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);
if( this.egwconfig.getCXMLM().countConf() < 1 )
{
jegwMain.infoDialog(
jegwConst.getConstTag("egw_msg_setting_aborting"),
jegwConst.getConstTag("info_info"));
System.exit(0);
}
}
}
else
{
// Certificates load and set
String sslcert = this.egwconfig.getCXMLM().getActivConf().getString("sslcert");
if( !sslcert.trim().isEmpty() )
{
BaseHttp.getTrustManager().setAcceptedCerts(sslcert);
}
}
// Tray Icon erstellen
//this.hwtray.AddMenuItem("InfoDialog", this);
this.hwtray.addMenuItem(jegwConst.getConstTag("MI_browser"), this);
this.hwtray.addMenuItem(jegwConst.getConstTag("MI_login"), this);
this.hwtray.addMenuItem(jegwConst.getConstTag("MI_logout"), this);
this.hwtray.addMenuItem(jegwConst.getConstTag("MI_settings"), this);
this.hwtray.addMenuItem(jegwConst.getConstTag("MI_exit"), this);
this.hwtray.addTrayAction(this);
this.hwtray.createTrayIcon();
this.hwtray.setDisableMenuItem(jegwConst.getConstTag("MI_login"), true);
this.hwtray.setDisableMenuItem(jegwConst.getConstTag("MI_logout"), false);
this._iconchanger = new hwTrayIconChanger(this.hwtray);
this.egwstart();
}
catch (Exception ex)
{
Logger.getLogger(jegwMain.class.getName()).log(Level.SEVERE, null, ex);
jegwMain.debugDialog(ex.getMessage());
}
}
private Locale getSystemLang()
{
return Locale.getDefault();
}
private void egwstart()
{
this.egwttask = new Timer();
this.egwtcd = new Timer();
// Task erstellen
jegwtask task = new jegwtask();
task.addActionListener(this);
// Automatisches Login
this.egwAutologin();
long period = Long.parseLong(jegwConst.getConstTag("egw_dc_timeout_notify"));
// Automatische Task starten
this.egwttask.schedule(task, 5000, period);
/**
* Info Time out task
*/
jegwTaskCoundownViewer tviewer = new jegwTaskCoundownViewer();
tviewer.addActionListener(this);
tviewer.setCounDown(4000);
this.egwtcd.schedule(tviewer, 0, 1000);
}
private void egwAutologin()
{
this.activconf = (KeyArray) this.egwconfig.getCXMLM().getActivConf().clone();
egwPasswordCrypt egwcp = new egwPasswordCrypt();
if( this.activconf.getString("password").length() != 0 )
{
try
{
this.activconf.add("password",
egwcp.decode(this.activconf.getString("password")));
}
catch(Exception exp)
{
this.activconf.add("password", "");
this.exceptionMsg(exp.getMessage(), exp);
}
}
if( this.activconf.getString("password").length() == 0 )
{
JFrame jf = EgroupwareTrayApp.getApplication().getMainFrame();
JDialog dialog = new jegwPasswordDialog(jf, true);
try {
dialog.setIconImage(hwTrayIcon.getImage(jegwConst.getConstTag("egwicon")));
} catch (IOException ex) {
Logger.getLogger(hwTrayIcon.class.getName()).log(Level.SEVERE, null, ex);
}
((jegwPasswordDialog) dialog).setUH(
this.activconf.getString("user"),
this.activconf.getString("host")
);
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);
String password = ((jegwPasswordDialog) dialog).getPassword();
if( password.length() != 0 )
{
this.activconf.add("password", password);
// Passwort Speichern
if( ((jegwPasswordDialog) dialog).isSavePassword() )
{
for(int i=0; i<this.egwconfig.getCXMLM().countConf(); i++)
{
KeyArray conf = this.egwconfig.getCXMLM().getConf(i);
if( (conf.getString("user").compareTo(
this.activconf.getString("user")) == 0) &&
(conf.getString("host").compareTo(
this.activconf.getString("host")) == 0) )
{
this.egwconfig.getCXMLM().deleteConf(i);
try
{
conf.add("password", egwcp.encode(password));
}
catch(Exception exp)
{
// passwort konnte nicht gespeichert werden
this.exceptionMsg(exp.getMessage(), exp);
}
this.egwconfig.getCXMLM().addConf(conf);
try
{
this.egwconfig.saveConfig();
}
catch(Exception exp)
{
this.exceptionMsg(exp.getMessage(), exp);
}
}
}
}
}
else
{
// Benutzerabbruch kein Passwort
if( jegwMain.confirmDialog(
jegwConst.getConstTag("egw_msg_login_aborting"),
jegwConst.getConstTag("info_info")) == 0 )
{
System.exit(0);
}
return;
}
}
try
{
this.hwtray.showBallon(jegwConst.getConstTag("info_info"),
jegwConst.getConstTag("egw_msg_login_start"),
TrayIcon.MessageType.INFO);
this.egwcookie = this.egwhttp.egwLogin(this.activconf);
}
catch( Exception ex)
{
this.exceptionMsg(ex.getMessage(), ex);
}
if( this.egwcookie != null )
{
this.hwtray.showBallon(
jegwConst.getConstTag("info_login"),
jegwConst.getConstTag("egw_txt_account") + " " +
this.activconf.getString("user") + " " +
jegwConst.getConstTag("egw_txt_login") + " " +
this.activconf.getString("host") + ".",
TrayIcon.MessageType.INFO);
// Icon ändern
this.hwtray.changeIcon(jegwConst.getConstTag("egwicon"));
this.hwtray.setDisableMenuItem(jegwConst.getConstTag("MI_login"), false);
this.hwtray.setDisableMenuItem(jegwConst.getConstTag("MI_logout"), true);
// Webdav mount
//this.mountEgwWebdav();
}
}
private void mountEgwWebdav()
{
KeyArray conf = this.activconf;
String apps = (String) conf.get("webdav_apps");
if( !apps.equals("") )
{
}
}
static public void debugDialog(String str)
{
JOptionPane.showMessageDialog(
EgroupwareTrayApp.getApplication().getMainFrame(),
str, "Debug", JOptionPane.ERROR_MESSAGE);
}
static public void infoDialog(String str, String title)
{
JOptionPane.showMessageDialog(
EgroupwareTrayApp.getApplication().getMainFrame(),
str, title, JOptionPane.INFORMATION_MESSAGE);
}
static public int confirmDialog(String str, String title)
{
return JOptionPane.showConfirmDialog(
EgroupwareTrayApp.getApplication().getMainFrame(),
str, title, JOptionPane.YES_NO_OPTION);
}
private void logout()
{
this.egwttask.cancel();
this.egwtcd.cancel();
this.hwtray.setDisableMenuItem(jegwConst.getConstTag("MI_login"), true);
this.hwtray.setDisableMenuItem(jegwConst.getConstTag("MI_logout"), false);
this.applications.clearApps();
try
{
this.egwhttp.egwLogout(this.activconf, this.egwcookie);
}
catch( Exception ex)
{
this.exceptionMsg(ex.getMessage(), ex);
}
}
/**
* openBrowser
* open Browser with address to Egroupware
*/
public void openBrowser()
{
if( (this.egwcookie != null) && (this.egwhttp.egwIsEGWLogin()) )
{
String openlink = this.egwhttp.egwGetOpenEGWLink(
this.activconf,
this.egwcookie,
""
);
try
{
BrowserLauncher launcher = new BrowserLauncher();
launcher.openURLinBrowser(openlink);
this.hwtray.showBallon(
jegwConst.getConstTag("info_info"),
jegwConst.getConstTag("egw_msg_start_browser"),
TrayIcon.MessageType.INFO);
}
catch( Exception exp )
{
// Error
this.hwtray.showBallon(
jegwConst.getConstTag("info_info"),
jegwConst.getConstTag("egw_msg_start_browser_error"),
TrayIcon.MessageType.ERROR);
}
}
}
/**
* checkIconChangeInfo
* check is icon change for information
*
*/
private void checkIconChangeInfo()
{
if( this.applications.getDBufferCount() > 0 )
{
if( this._iconchanger.getIconCount() == 0 )
{
this._iconchanger.addIcon(jegwConst.getConstTag("egwicon"));
this._iconchanger.addIcon(jegwConst.getConstTag("egwiconinfo"));
}
this._iconchanger.changeIcon();
}
else
{
this._iconchanger.clearIconList();
this.hwtray.changeIcon(jegwConst.getConstTag("egwicon"));
}
}
public void actionPerformed(ActionEvent e)
{
String sclass = e.getSource().getClass().getName();
Object cclass = e.getSource();
String cmd = e.getActionCommand();
/**
* Action Menu
*/
if( sclass.compareTo("java.awt.MenuItem") == 0 )
{
MenuItem item = (MenuItem) cclass;
/**
* Action Exit
*/
if(item.getLabel().compareTo(jegwConst.getConstTag("MI_exit")) == 0)
{
if( this.egwhttp.egwIsEGWLogin() )
{
this.logout();
}
System.exit(0);
}
/**
* Action Settings
*/
if( item.getLabel().compareTo(
jegwConst.getConstTag("MI_settings")) == 0 )
{
JFrame jf = EgroupwareTrayApp.getApplication().getMainFrame();
JDialog dialog = new egwSettingUrl(jf, true, this.egwconfig);
try {
dialog.setIconImage(hwTrayIcon.getImage(jegwConst.getConstTag("egwicon")));
} catch (IOException ex) {
Logger.getLogger(hwTrayIcon.class.getName()).log(Level.SEVERE, null, ex);
}
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);
// Aktuelle Config benutzen
this.egwAutologin();
}
/**
* Action Login
*/
if( item.getLabel().compareTo(jegwConst.getConstTag("MI_login") ) == 0)
{
this.egwstart();
}
/**
* Action Logout
*/
if( item.getLabel().compareTo(jegwConst.getConstTag("MI_logout") ) == 0)
{
this.logout();
}
/**
* Action Browser Open
*/
if( item.getLabel().compareTo(jegwConst.getConstTag("MI_browser") ) == 0)
{
this.openBrowser();
}
/**
* Action Info Dialog
*/
if( item.getLabel().compareTo("InfoDialog") == 0 )
{
JFrame jf = EgroupwareTrayApp.getApplication().getMainFrame();
JDialog dialog = new jegwInfoDialog(jf, true);
dialog.setVisible(true);
}
}
if( sclass.compareTo("egroupwaretray.hwTrayIcon") == 0 )
{
if( (cmd != null) && (cmd.compareTo("clicked") == 0) )
{
this.applications.showDialog(this);
}
}
if( sclass.compareTo("java.awt.TrayIcon") == 0 )
{
TrayIcon ticon = (TrayIcon) cclass;
this.openBrowser();
}
if( sclass.compareTo("egroupwaretray.jegwtask") == 0 )
{
if( this.egwhttp.egwIsEGWLogin() )
{
try
{
/**
* Info Time out task
*/
jegwTaskCoundownViewer tviewer = new jegwTaskCoundownViewer();
tviewer.addActionListener(this);
long period = Long.parseLong(jegwConst.getConstTag("egw_dc_timeout_notify"));
tviewer.setCounDown((int)period);
this.egwtcd.schedule(tviewer, 0, 1000);
/**
* Daten laden
*/
ArrayList data = this.egwhttp.egwLoadEGWData(this.activconf, this.egwcookie);
//System.out.print(data);
this.applications.setNewApplicationDatas(data, this);
}
catch( Exception ex)
{
this.exceptionMsg(ex.getMessage(), ex);
}
}
else
{
//
if( jegwMain.confirmDialog(
jegwConst.getConstTag("egw_msg_repeat_login"),
jegwConst.getConstTag("egw_txt_title_login")) == 0 )
{
this.egwAutologin();
}
}
}
/**
* Zeit anzeige updaten
*/
if( sclass.compareTo("egroupwaretray.jegwTaskCoundownViewer") == 0 )
{
this.hwtray.setTooltip(jegwConst.getConstTag("egwtitle") + " " +
String.format(jegwConst.getConstTag("egw_txt_update"),
(Object[]) new String[]{e.getActionCommand().toString()})
);
this.checkIconChangeInfo();
}
if( sclass.compareTo("egroupwaretray.jegwInfoDialog") == 0 )
{
String[] tmp = e.getActionCommand().toString().split(":");
if( tmp[0].compareTo("OPENAPP") == 0 )
{
if( (this.egwcookie != null) && (this.egwhttp.egwIsEGWLogin()) )
{
String menuaction = "";
KeyArray tmsg = this.applications.searchMsgById(tmp[1]);
if( tmsg != null )
{
this.applications.removeMsgById(tmp[1]);
menuaction = tmsg.getString("link");
}
String openlink = this.egwhttp.egwGetOpenEGWLink(
this.activconf,
this.egwcookie,
menuaction
);
try
{
BrowserLauncher launcher = new BrowserLauncher();
launcher.openURLinBrowser(openlink);
this.hwtray.showBallon(
jegwConst.getConstTag("info_info"),
jegwConst.getConstTag("egw_msg_start_browser"),
TrayIcon.MessageType.INFO);
}
catch(Exception exp)
{
// Fehler
this.hwtray.showBallon(
jegwConst.getConstTag("info_info"),
jegwConst.getConstTag("egw_msg_start_browser_error"),
TrayIcon.MessageType.ERROR);
}
}
}
}
}
private void exceptionMsg(String emsg, Exception ex)
{
String[] msg = emsg.split(":");
this.hwtray.changeIcon(jegwConst.getConstTag("egwiconerror"));
if( msg[0].compareTo("NETERROR") == 0 )
{
jegwMain.infoDialog(
jegwConst.getConstTag("egw_msg_connection_error"),
jegwConst.getConstTag("egw_txt_connection_error")
);
return;
}
else if( msg[0].compareTo("LOGIN") == 0 )
{
jegwMain.infoDialog(
jegwConst.getEGWStatus(msg[1]),
jegwConst.getConstTag("egw_txt_title_login")
);
if( jegwMain.confirmDialog(
jegwConst.getConstTag("egw_msg_repeat_login"),
jegwConst.getConstTag("egw_txt_title_login")) == 0 )
{
this.egwAutologin();
}
return;
}
else if( msg[0].compareTo("PERMISSIONDENIED") == 0 )
{
jegwMain.infoDialog(
jegwConst.getConstTag("egw_msg_premission_denied") +
"\r\n" +
jegwConst.getConstTag("egw_msg_contact_admin"),
jegwConst.getConstTag("egw_txt_title_premission"));
return;
}
else if( msg[0].compareTo("PAGENOTFOUND") == 0 )
{
jegwMain.infoDialog(
jegwConst.getConstTag("egw_msg_page_not_found"),
jegwConst.getConstTag("egw_txt_title_notifier")
);
return;
}
else if( msg[0].compareTo("HOSTNOTFOUND") == 0 )
{
jegwMain.infoDialog(
jegwConst.getConstTag("egw_msg_domain_not_found"),
jegwConst.getConstTag("egw_txt_title_notifier")
);
return;
}
else
{
jegwMain.debugDialog(msg[0]);
}
Logger.getLogger(jegwMain.class.getName()).log(Level.SEVERE, null, ex);
}
}

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Standardcursor"/>
</Property>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanelpassword" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanelpassword" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanelpassword">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder>
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Bitte geben Sie f&#xfc;r den folgenden Account das Passwort ein:">
<Property name="titleX" resourceKey="jPanelpassword.border.border.title"/>
</TitledBorder>
</Border>
</TitledBorder>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="jPanelpassword" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLaccount" alignment="0" min="-2" pref="291" max="-2" attributes="0"/>
<Component id="jLhost" alignment="0" min="-2" pref="281" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLpassword" min="-2" pref="64" max="-2" attributes="1"/>
<Component id="jCBpassword" min="-2" pref="129" max="-2" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jBLogin" min="-2" pref="84" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jBcancel" pref="94" max="32767" attributes="0"/>
</Group>
<Component id="jPFpassword" alignment="0" pref="188" max="32767" attributes="1"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLaccount" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLhost" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLpassword" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jPFpassword" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCBpassword" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jBLogin" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jBcancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLaccount">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLaccount.text"/>
<Property name="name" type="java.lang.String" value="jLaccount" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLhost">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLhost.text"/>
<Property name="name" type="java.lang.String" value="jLhost" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLpassword">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLpassword.text"/>
<Property name="name" type="java.lang.String" value="jLpassword" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JPasswordField" name="jPFpassword">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jPFpassword.text"/>
<Property name="name" type="java.lang.String" value="jPFpassword" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCBpassword">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jCBpassword.text"/>
<Property name="name" type="java.lang.String" value="jCBpassword" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jBLogin">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jBLogin.text"/>
<Property name="name" type="java.lang.String" value="jBLogin" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jBLoginMouseClicked"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jBcancel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jBcancel.text"/>
<Property name="name" type="java.lang.String" value="jBcancel" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jBcancelMouseClicked"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,222 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
/*
* jegwPasswordDialog.java
*
* Created on 20.05.2009, 16:40:31
*/
package egroupwaretray;
import javax.swing.BorderFactory;
/**
* jegwPasswordDialog
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwPasswordDialog extends javax.swing.JDialog {
private String password = "";
private boolean savepass = false;
/** Creates new form jegwPasswordDialog */
public jegwPasswordDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
this.jLpassword.setText(jegwConst.getConstTag("egw_txt_title_password"));
this.jBLogin.setText(jegwConst.getConstTag("egw_txt_title_login"));
this.jPanelpassword.setBorder(
BorderFactory.createTitledBorder(
jegwConst.getConstTag("egw_msg_password_enter")));
this.jBcancel.setText(jegwConst.getConstTag("egw_txt_cancel"));
this.jCBpassword.setText(jegwConst.getConstTag("egw_txt_save_password"));
this.setTitle(jegwConst.getConstTag("egw_txt_title_dialog_password"));
}
public String getPassword()
{
return this.password;
}
public boolean isSavePassword()
{
return this.savepass;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanelpassword = new javax.swing.JPanel();
jLaccount = new javax.swing.JLabel();
jLhost = new javax.swing.JLabel();
jLpassword = new javax.swing.JLabel();
jPFpassword = new javax.swing.JPasswordField();
jCBpassword = new javax.swing.JCheckBox();
jBLogin = new javax.swing.JButton();
jBcancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(egroupwaretray.EgroupwareTrayApp.class).getContext().getResourceMap(jegwPasswordDialog.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setName("Form"); // NOI18N
jPanelpassword.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanelpassword.border.border.title")))); // NOI18N
jPanelpassword.setName("jPanelpassword"); // NOI18N
jLaccount.setText(resourceMap.getString("jLaccount.text")); // NOI18N
jLaccount.setName("jLaccount"); // NOI18N
jLhost.setText(resourceMap.getString("jLhost.text")); // NOI18N
jLhost.setName("jLhost"); // NOI18N
jLpassword.setText(resourceMap.getString("jLpassword.text")); // NOI18N
jLpassword.setName("jLpassword"); // NOI18N
jPFpassword.setText(resourceMap.getString("jPFpassword.text")); // NOI18N
jPFpassword.setName("jPFpassword"); // NOI18N
jCBpassword.setText(resourceMap.getString("jCBpassword.text")); // NOI18N
jCBpassword.setName("jCBpassword"); // NOI18N
jBLogin.setText(resourceMap.getString("jBLogin.text")); // NOI18N
jBLogin.setName("jBLogin"); // NOI18N
jBLogin.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jBLoginMouseClicked(evt);
}
});
jBcancel.setText(resourceMap.getString("jBcancel.text")); // NOI18N
jBcancel.setName("jBcancel"); // NOI18N
jBcancel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jBcancelMouseClicked(evt);
}
});
javax.swing.GroupLayout jPanelpasswordLayout = new javax.swing.GroupLayout(jPanelpassword);
jPanelpassword.setLayout(jPanelpasswordLayout);
jPanelpasswordLayout.setHorizontalGroup(
jPanelpasswordLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelpasswordLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanelpasswordLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLaccount, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLhost, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanelpasswordLayout.createSequentialGroup()
.addGroup(jPanelpasswordLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLpassword, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCBpassword, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanelpasswordLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelpasswordLayout.createSequentialGroup()
.addComponent(jBLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jBcancel, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE))
.addComponent(jPFpassword, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE))))
.addGap(38, 38, 38))
);
jPanelpasswordLayout.setVerticalGroup(
jPanelpasswordLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanelpasswordLayout.createSequentialGroup()
.addComponent(jLaccount)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLhost)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanelpasswordLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLpassword)
.addComponent(jPFpassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanelpasswordLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCBpassword)
.addComponent(jBLogin)
.addComponent(jBcancel))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanelpassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanelpassword, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jBcancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBcancelMouseClicked
this.password = "";
this.setVisible(false);
}//GEN-LAST:event_jBcancelMouseClicked
private void jBLoginMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBLoginMouseClicked
this.savepass = jCBpassword.getModel().isSelected();
this.password = this.jPFpassword.getText();
this.setVisible(false);
}//GEN-LAST:event_jBLoginMouseClicked
public void setUH(String User, String Host)
{
this.jLhost.setText(jegwConst.getConstTag("egw_txt_host") + " " + Host);
this.jLaccount.setText(jegwConst.getConstTag("egw_txt_user") + " " + User);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
jegwPasswordDialog dialog = new jegwPasswordDialog(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBLogin;
private javax.swing.JButton jBcancel;
private javax.swing.JCheckBox jCBpassword;
private javax.swing.JLabel jLaccount;
private javax.swing.JLabel jLhost;
private javax.swing.JLabel jLpassword;
private javax.swing.JPasswordField jPFpassword;
private javax.swing.JPanel jPanelpassword;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,76 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.TimerTask;
import javax.swing.event.EventListenerList;
/**
* jegwTaskCoundownViewer
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwTaskCoundownViewer extends TimerTask
{
protected EventListenerList listenerList = new EventListenerList();
//verbleibende Millisekunden
private int timeInMs = 0;
//countdown Zeit in Millisekunden
private int countDownMs = 10000;
public void addActionListener(ActionListener l)
{
listenerList.add(ActionListener.class, l);
}
protected void action(Object o, String command)
{
Object[] listeners = listenerList.getListenerList();
ActionEvent e = new ActionEvent(o, ActionEvent.ACTION_PERFORMED, command);
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==ActionListener.class) {
((ActionListener)listeners[i+1]).actionPerformed(e);
}
}
}
public void setCounDown(int ms)
{
this.countDownMs = ms;
}
@Override
public void run()
{
//Falls Gesamtzeit - vergangener Zeit > 0
if( this.countDownMs - this.timeInMs > 0 )
{
//erhöhe Zeitcounter um 1000 ms
this.timeInMs += 1000;
//Zeit in Sekunden Updaten
this.action(this, " " + ( (countDownMs - timeInMs) / 1000 ) );
}
else
{
//Falls Gesamtzeit - vergangener Zeit <= 0
this.cancel();
}
}
}

View File

@ -0,0 +1,182 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JFrame;
/**
* jegwapplications
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwapplications
{
private ArrayList dialogbuff = new ArrayList();
public jegwapplications(ActionListener action){}
public void clearApps()
{
this.dialogbuff.clear();
}
public KeyArray searchMsgById(String id)
{
for(int i=0; i<this.dialogbuff.size(); i++ )
{
Object tob = this.dialogbuff.get(i);
String classname = tob.getClass().getName();
if(classname.compareTo("egroupwaretray.KeyArray")==0)
{
KeyArray app = (KeyArray) tob;
if( app.getString("notify_id").compareTo(id) == 0 )
{
return app;
}
}
}
return null;
}
public void updateApp(KeyArray app)
{
for(int i=0; i<this.dialogbuff.size(); i++ )
{
Object tob = this.dialogbuff.get(i);
String classname = tob.getClass().getName();
if(classname.compareTo("egroupwaretray.KeyArray")==0)
{
KeyArray appl = (KeyArray) tob;
if(appl.getString("notify_id").compareTo(app.getString("notify_id")) == 0)
{
this.dialogbuff.remove(i);
this.dialogbuff.add(app);
}
}
}
}
public void removeMsgById(String id)
{
for(int i=0; i<this.dialogbuff.size(); i++ )
{
Object tob = this.dialogbuff.get(i);
String classname = tob.getClass().getName();
if(classname.compareTo("egroupwaretray.KeyArray")==0)
{
KeyArray appl = (KeyArray) tob;
if(appl.getString("notify_id").compareTo(id) == 0)
{
this.dialogbuff.remove(i);
}
}
}
}
public void setNewApplicationDatas(ArrayList data, jegwMain mainobj)
{
for( int i=0; i<data.size(); i++ )
{
Object tob = data.get(i);
String classname = tob.getClass().getName();
if( classname.compareTo("egroupwaretray.KeyArray")==0 )
{
KeyArray app = (KeyArray) tob;
String notifyid = app.getString("notify_id");
KeyArray buffmsg = this.searchMsgById(notifyid);
if( buffmsg == null )
{
//this.appbuff.add(app);
this.dialogbuff.add(app);
continue;
}
else
{
this.dialogbuff.add(app);
this.updateApp(app);
}
}
}
this.showDialog(mainobj);
}
public int getDBufferCount()
{
return this.dialogbuff.size();
}
public void showDialog(jegwMain mainobj)
{
if( this.dialogbuff.size() > 0 )
{
ArrayList tmp = new ArrayList();
for( int i=0; i<this.dialogbuff.size(); i++ )
{
KeyArray app = (KeyArray) this.dialogbuff.get(i);
JFrame jf = EgroupwareTrayApp.getApplication().getMainFrame();
JDialog dialog = new jegwInfoDialog(jf, true);
try {
dialog.setIconImage(hwTrayIcon.getImage(jegwConst.getConstTag("egwicon")));
} catch (IOException ex) {
Logger.getLogger(hwTrayIcon.class.getName()).log(Level.SEVERE, null, ex);
}
((jegwInfoDialog)dialog).setNotifiyId(app.getString("notify_id"));
if( mainobj != null )
{
((jegwInfoDialog)dialog).addActionListener(mainobj);
}
((jegwInfoDialog)dialog).setInfoDialog(app.getString("msghtml"));
dialog.setAlwaysOnTop(true);
dialog.setFocusableWindowState(false);
dialog.setVisible(true); // Warten bis Ok dann nächsten anzeigen
/**
* wurde die Info gelesen dann raus damit
*/
if( !((jegwInfoDialog) dialog).isInfoRead() )
{
tmp.add(this.dialogbuff.get(i));
}
}
// Wenn fertig dann Leeren
this.dialogbuff.clear();
this.dialogbuff = tmp;
}
}
}

View File

@ -0,0 +1,42 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
/**
* jegwconfig
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwconfig
{
private jegwxmlconfig configmanager = null;
public jegwconfig(String file) throws Exception
{
this.configmanager = new jegwxmlconfig(file);
}
public jegwxmlconfig getCXMLM()
{
return this.configmanager;
}
public void loadConfig() throws Exception
{
this.configmanager.read(false);
}
public void saveConfig() throws Exception
{
this.configmanager.write();
}
}

View File

@ -0,0 +1,840 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.awt.event.ActionListener;
import java.net.InetAddress;
import java.util.*;
import org.json.simple.parser.ContainerFactory;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
/**
* jegwhttp
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwhttp
{
public static final String EGWHTTP_INDEXSCRIPT = "index.php";
public static final String EGWHTTP_LOGINSCRIPT = "login.php";
public static final String EGWHTTP_LOGOUTSCRIPT = "logout.php";
public static final String EGWHTTP_TRAYMODUL = "egwnotifier/index.php";
public static final String EGWHTTP_TRAYLOGIN = "notifierlogin.php";
public static final String EGWHTTP_LOGINLINK = "login.php?cd=";
public static final String EGWHTTP_POST_VAR_PASSWORD_TYPE = "passwd_type";
public static final String EGWHTTP_POST_VAR_ACCOUNT_TYPE = "account_type";
public static final String EGWHTTP_POST_VAR_LOGINDOMAIN = "logindomain";
public static final String EGWHTTP_POST_VAR_LOGIN = "login";
public static final String EGWHTTP_POST_VAR_PASSWD = "passwd";
public static final String EGWHTTP_POST_VAR_SUBMITIT = "submitit";
public static final String EGWHTTP_POST_PASSWORD_TYPE_TEXT = "text";
public static final String EGWHTTP_POST_ACCOUNT_TYPE_U = "u";
public static final String EGWHTTP_POST_LOGINDOMAIN_DEFAULT = "default";
public static final String EGWHTTP_POST_SUBMITIT = "++Anmelden++";
public static final String EGWHTTP_TAG_SECURITYID = "egwcheckid";
public static final String EGWHTTP_GET_VAR_MAKE_SECURITYID = "makecheck";
public static final String EGWHTTP_GET_VAR_SECURITYID = "checkid";
public static final String EGWHTTP_GET_MAKE_SECURITYID = "1";
public static final String EGWHTTP_GET_PHPGW_FORWARD = "phpgw_forward";
// new EPL Notifications
public static final String EGWHTTP_GET_NOTIFICATIONS_ACTION =
"json.php?menuaction=notifications.notifications_jdesk_ajax.get_notifications";
// new EPL Notifications
public static final String EGWHTTP_GET_NOTIFICATIONS_ACTION_CONFIRM =
"json.php?menuaction=notifications.notifications_jdesk_ajax.confirm_message";
public static final String[] EGWHTTP_EGW_COOKIE = new String[]{
"sessionid", "kp3", "last_loginid", "last_domain", "domain"};
public static final String[] EGWHTTP_EGW_APP = new String[]{
"name", "title", "infotext", "variables", "appdialogtext" };
public static final String[] EGWHTTP_EGW_NOTIFY = new String[]{
"app", "title", "msghtml", "link", "notify_id" };
public static final String[] EGWHTTP_EGW_APP_VAR = new String[]{
"vname", "value", "vtype" };
private BaseHttp httpcon = new BaseHttp();
private Boolean loginstatus = false;
public jegwhttp(ActionListener lister) {
this.httpcon.setSocketTimeOut(
Integer.parseInt(
jegwConst.getConstTag("egw_dc_timeout_socket")));
}
/**
* CheckDir
* Überprüft ob hinten ein String (wie bei Verzeichnisen mit "/" abschließt),
* wenn nicht wird dieser hinten drangesetzt und der String zurück geben
*
* @param dir
* @return
*/
static public String checkDir(String dir)
{
if(dir.length() > 0)
{
if(dir.charAt(dir.length()-1) != "/".charAt(0) )
{
dir = dir + "/";
}
}
return dir;
}
public void egwUrlLinkParser(KeyArray Config) throws Exception
{
String url = Config.getString("egwurl");
boolean ssl = false;
if( url.indexOf("https://") > -1 )
{
ssl = true;
url = url.replaceAll("https://", "");
}
else
{
url = url.replaceAll("http://", "");
}
if( url.length() == 0 )
{
throw new Exception("NOURL");
}
String[] tmp = url.split("/");
String host = tmp[0];
String port = "";
String paht = "";
if( tmp[0].indexOf(":") != -1 )
{
String[] ttmp = tmp[0].split(":");
host = ttmp[0];
port = ttmp[1];
}
/**
* Host auflösen
*/
try
{
InetAddress addr = InetAddress.getByName(host);
}
catch( Exception exp)
{
throw new Exception("HOSTNOTFOUND");
}
for( int i=1; i<tmp.length; i++ )
{
paht = paht + tmp[i] + "/";
}
/*if( paht.length() == 0 )
{
paht = "/";
}*/
Config.add("host", host);
if( port.length() != 0 )
{
Config.add("port", port);
}
Config.add("subdir", paht);
Config.add("ssl", ssl);
/**
* SSL Enable
*/
this.httpcon.setIsSSL(ssl);
if( port.length() != 0 )
{
host = host + ":" + port;
}
String moved = this.httpcon.isHostMoved(host, "/" + paht);
if( !moved.equals("") )
{
Config.add("egwurl", moved);
this.egwUrlLinkParser(Config);
}
}
public String[] getEgwLoginDomains(KeyArray Config) throws Exception
{
this.egwUrlLinkParser(Config);
String urlhost = Config.getString("host");
if( Config.getString("port").length() > 0 )
{
urlhost = urlhost + ":" + Config.getString("port");
}
String urllink = "/" + jegwhttp.checkDir(Config.getString("subdir")) +
EGWHTTP_LOGINSCRIPT + "?" + EGWHTTP_GET_PHPGW_FORWARD + "=";
String buffer = this.httpcon.openHttpContentSite(urlhost + urllink);
/**
* Hidden Logindomain
*/
int begin = -1;
int end = -1;
String search = "<input type=\"hidden\" name=\"logindomain\" value=\"";
if( (begin = buffer.indexOf(search)) > -1 )
{
end = buffer.indexOf("\"", begin + search.length());
if( (begin != -1) && (end != -1) )
{
String tmp = buffer.substring( begin +
search.length(), end);
return new String[]{tmp};
}
}
/**
* Select Logindomain
*/
begin = -1;
end = -1;
search = "<select name=\"logindomain\"";
if( (begin = buffer.indexOf(search)) > -1 )
{
end = buffer.indexOf("</select>", begin + search.length());
if( (begin != -1) && (end != -1) )
{
String tmp = buffer.substring( begin +
search.length(), end);
tmp = tmp.trim();
String ltmp[] = tmp.split("</option>");
String treturn[] = new String[ltmp.length];
for( int i=0; i<ltmp.length; i++ )
{
String tbuffer = ltmp[i];
String tsearch = "value=\"";
int tbegin = -1;
int tend = -1;
if( (tbegin = tbuffer.indexOf(tsearch)) > -1 )
{
tend = tbuffer.indexOf("\"", tbegin + tsearch.length());
if( (begin != -1) && (tend != -1) )
{
String ttmp = tbuffer.substring( tbegin +
tsearch.length(), tend);
treturn[i] = ttmp;
}
}
}
return treturn;
}
}
return null;
}
public void egwCheckLoginDomains(KeyArray Config) throws Exception
{
String urlhost = Config.getString("host");
if( Config.getString("port").length() > 0 )
{
urlhost = urlhost + ":" + Config.getString("port");
}
String urllink = "/" + jegwhttp.checkDir(Config.getString("subdir")) +
EGWHTTP_LOGINSCRIPT + "?" + EGWHTTP_GET_PHPGW_FORWARD + "=";
String buffer = this.httpcon.openHttpContentSite(urlhost + urllink);
/**
* Hidden Logindomain
*/
int begin = -1;
int end = -1;
String search = "<input type=\"hidden\" name=\"logindomain\" value=\"";
if( (begin = buffer.indexOf(search)) > -1 )
{
end = buffer.indexOf("\"", begin + search.length());
if( (begin != -1) && (end != -1) )
{
String tmp = buffer.substring( begin +
search.length(), end);
Config.add("logindomain", tmp);
return;
}
}
/**
* Select Logindomain
*/
begin = -1;
end = -1;
search = "<select name=\"logindomain\"";
if( (begin = buffer.indexOf(search)) > -1 )
{
end = buffer.indexOf("</select>", begin + search.length());
if( (begin != -1) && (end != -1) )
{
String tmp = buffer.substring( begin +
search.length(), end);
System.out.println(tmp);
}
}
//Config.Add("logindomain", EGWHTTP_POST_LOGINDOMAIN_DEFAULT);
Config.add("logindomain", urlhost);
}
/**
* egwLogin
* logt sich im eGroupware ein mit den Benutzerdaten aus einer Config
* und gibt den Cookieinhalt zurück
*
* @param Config Konfigurations Einstellungen
* @return Cookieinhalt
*/
public KeyArray egwLogin(KeyArray Config) throws Exception
{
this.egwUrlLinkParser(Config);
//this.egwCheckLoginDomains(Config);
String urlhost = Config.getString("host");
if( Config.getString("port").length() > 0 )
{
urlhost = urlhost + ":" + Config.getString("port");
}
String urllink = "/" + jegwhttp.checkDir(Config.getString("subdir")) +
EGWHTTP_LOGINSCRIPT + "?" + EGWHTTP_GET_PHPGW_FORWARD + "=";
String urlpost = EGWHTTP_POST_VAR_PASSWORD_TYPE + "=" +
EGWHTTP_POST_PASSWORD_TYPE_TEXT + "&" + EGWHTTP_POST_VAR_ACCOUNT_TYPE +
"=" + EGWHTTP_POST_ACCOUNT_TYPE_U + "&" + EGWHTTP_POST_VAR_LOGINDOMAIN +
"=" + Config.getString("logindomain") + "&" + EGWHTTP_POST_VAR_LOGIN +
"=" + Config.getString("user") + "&" + EGWHTTP_POST_VAR_PASSWD + "=" +
Config.getString("password") + "&" + EGWHTTP_POST_VAR_SUBMITIT + "=" +
EGWHTTP_POST_SUBMITIT;
String buffer = this.httpcon.openHttpContentSitePost(urlhost + urllink, urlpost);
if( buffer.length() == 0 )
{
// Verbindungsfehler
throw new Exception("NETERROR");
}
if( this.httpcon.isNotFound() )
{
throw new Exception("PAGENOTFOUND");
}
int status = this.egwCheckLoginStatus();
if( status > -1 )
{
throw new Exception("LOGIN:" + Integer.toString(status));
}
KeyArray egwcookie = new KeyArray(EGWHTTP_EGW_COOKIE);
String[] keys = egwcookie.getKeys();
for( int i=0; i<keys.length; i++ )
{
String value = this.httpcon.getSocketHeaderField(this.httpcon.getCookie(), keys[i]);
if( value.length() == 0 )
{
// Login fehlgeschlagen
return null;
}
egwcookie.add(keys[i], value);
}
this.loginstatus = true;
return egwcookie;
}
/**
* egwIsLogin
* Überprüft ob eine egw Benutzer noch angemeldet ist
*
* @param buffer Rückgabe eines HTTP aufrufes muss hier angeben werden,
* der Inhalt würd dann drauf überprüft
* @param cookie Cookie Informationen zum Überprüfen
* @return true = noch Angemeldet, false = nicht mehr Angemeldet
*/
private boolean egwIsLogin(KeyArray cookie)
{
String sess = this.httpcon.getCookieVariable(this.httpcon.getCookie(), "sessionid");
String location = this.httpcon.getLocation();
if( sess.length() > 0 )
{
if( sess.compareTo(cookie.getString("sessionid")) != 0 )
{
this.loginstatus = false;
return false;
}
}
else if( (location != null) && (location.indexOf("login.php") != -1) )
{
this.loginstatus = false;
return false;
}
this.loginstatus = true;
return true;
}
private int egwCheckLoginStatus()
{
String back = "";
String buffer = this.httpcon.getLocation();
if( buffer == null )
{
buffer = "";
}
int pos = buffer.indexOf(jegwhttp.EGWHTTP_LOGINLINK);
int end = buffer.length();
if( (pos != -1) && (end != -1) )
{
back = buffer.substring( pos +
jegwhttp.EGWHTTP_LOGINLINK.length(), end);
}
else if( (buffer.indexOf("http://") != -1) || (buffer.indexOf("https://") != -1) )
{
if( buffer.indexOf("index.php?cd=yes") == -1 )
{
return 999;
}
else
{
return -1;
}
}
else
{
return -1;
}
return Integer.valueOf(back).intValue();
}
public boolean egwIsEGWLogin()
{
return this.loginstatus;
}
/**
* egwGetTagValue
* Sucht Inhalte erraus (nach der notation vom html/xml)
*
* @param buff HTTP Inhalt
* @param tag Inhalt umschließer
* @return Inhalt
*/
private String egwGetTagValue(String buff, String tag)
{
String back = "";
int pos = buff.indexOf("<" + tag + ">");
int end = buff.indexOf("</" + tag + ">", pos);
if( (pos != -1) && (end != -1) )
{
back = buff.substring( pos + tag.length() +2, end);
}
return back;
}
private String egwGetTagValueWithTag(String buff, String tag)
{
String back = "";
int pos = buff.indexOf("<" + tag + ">");
int end = buff.indexOf("</" + tag + ">", pos);
if( (pos != -1) && (end != -1) )
{
back = buff.substring( pos, end + tag.length() +3);
}
return back;
}
private String egwGetNoneTagText(String buff, String tag)
{
String back = "";
int pos = buff.indexOf("<" + tag + ">");
int end = buff.indexOf("</" + tag + ">", pos);
if( (pos != -1) && (end != -1) )
{
back = buff.substring( 0, pos);
back = back + buff.substring( end + tag.length() +3, buff.length()-1);
}
return back;
}
/**
* egwGetEGWCookieStr
* erstellt den Cookie String aus dem cookie(Array)
*
* @param cookie
* @return
*/
private String egwGetEGWCookieStr(KeyArray cookie)
{
String cookiestr = "";
String[] keys = cookie.getKeys();
for( int i=0; i<cookie.size(); i++ )
{
String tmp = keys[i] + "=" + cookie.getString(keys[i]) + ";";
if(cookiestr.length() == 0)
{
cookiestr = cookiestr + tmp;
}
else
{
cookiestr = cookiestr + " " + tmp;
}
}
cookiestr = cookiestr + " storedlang=de; last_loginid=; last_domain=default; ConfigLang=de";
return cookiestr;
}
public ArrayList egwLoadEGWData(KeyArray Config, KeyArray cookie) throws Exception
{
ArrayList msglist = new ArrayList();
String urlhost = Config.getString("host");
if( Config.getString("port").length() > 0 )
{
urlhost = urlhost + ":" + Config.getString("port");
}
String urllink = "/" + jegwhttp.checkDir(Config.getString("subdir")) +
EGWHTTP_GET_NOTIFICATIONS_ACTION;
this.httpcon.setIsAjax(true);
this.httpcon.setCookie(this.egwGetEGWCookieStr(cookie));
//String buffer = this.httpcon.openHttpContentSite(urlhost + urllink);
String buffer = this.httpcon.openHttpContentSitePost(
urlhost + urllink,
"json_data={\"request\":{\"parameters\":[null]}}"
);
this.httpcon.setIsAjax(false);
/**
* Fehler Behandlung
*/
/*if( buffer.length() == 0 )
{
// Verbindungsfehler
throw new Exception("NETERROR");
}*/
if( this.egwIsLogin(cookie) )
{
int status = this.egwCheckLoginStatus();
if( status > -1 )
{
throw new Exception("LOGIN:" + Integer.toString(status));
}
/**
* Check auf Rechte (Permission denied!)
*/
String permission = "<title>Permission denied!</title>";
if( buffer.indexOf(permission) > -1 )
{
throw new Exception("PERMISSIONDENIED");
}
/**
* JSON
*/
JSONParser parser = new JSONParser();
ContainerFactory containerFactory = new ContainerFactory(){
public List creatArrayContainer() {
return new LinkedList();
}
public Map createObjectContainer() {
return new LinkedHashMap();
}
};
try
{
Map json = (Map)parser.parse(buffer.trim(), containerFactory);
Iterator iter = json.entrySet().iterator();
while( iter.hasNext() )
{
Map.Entry entry = (Map.Entry)iter.next();
if( entry.getKey().toString().compareTo("response") == 0 )
{
LinkedList response = (LinkedList) entry.getValue();
for( Integer i=0; i<response.size(); i++ )
{
Map jmsg = (Map) response.get(i);
Iterator jmsgiter = jmsg.entrySet().iterator();
while( jmsgiter.hasNext() )
{
Map.Entry jmsgentry = (Map.Entry)jmsgiter.next();
if( (jmsgentry.getKey().toString().compareTo("type") == 0) &&
(jmsgentry.getValue().toString().compareTo("data") == 0) &&
jmsgiter.hasNext() )
{
jmsgentry = (Map.Entry)jmsgiter.next();
if( jmsgentry.getKey().toString().compareTo("data") == 0 )
{
KeyArray notifymsg = new KeyArray(EGWHTTP_EGW_NOTIFY);
Map msgdata = (Map) jmsgentry.getValue();
Iterator dataiter = msgdata.entrySet().iterator();
while( dataiter.hasNext() )
{
Map.Entry dataentry = (Map.Entry)dataiter.next();
String tkey = dataentry.getKey().toString();
Object tovalue = dataentry.getValue();
String tvalue = "";
if( tovalue != null )
{
tvalue = tovalue.toString();
}
if( notifymsg.existKey(tkey) )
{
notifymsg.add(tkey, tvalue);
}
}
if( notifymsg.get("notify_id") != null )
{
msglist.add(notifymsg);
this.egwRemoveEGWData(
Config, cookie, notifymsg.getString("notify_id"));
}
}
}
}
}
}
}
}
catch( ParseException pe )
{
throw new Exception("NOAPPS");
}
}
return msglist;
}
public Boolean egwRemoveEGWData(KeyArray Config, KeyArray cookie, String notifiy_id) throws Exception
{
String urlhost = Config.getString("host");
if( Config.getString("port").length() > 0 )
{
urlhost = urlhost + ":" + Config.getString("port");
}
String urllink = "/" + jegwhttp.checkDir(Config.getString("subdir")) +
EGWHTTP_GET_NOTIFICATIONS_ACTION_CONFIRM;
this.httpcon.setIsAjax(true);
this.httpcon.setCookie(this.egwGetEGWCookieStr(cookie));
//String buffer = this.httpcon.openHttpContentSite(urlhost + urllink);
String buffer = this.httpcon.openHttpContentSitePost(
urlhost + urllink,
"json_data={\"request\":{\"parameters\":[\"" + notifiy_id + "\"]}}"
);
this.httpcon.setIsAjax(false);
return true;
}
/**
* egwGetSecurityID
* beantragt eine Sicherheitsid zum Einlogen
*
* @param Config Konfiguration eines Accounts
* @param cookie Cookie vom einlogen
* @return Sicherheitsid, war man nicht eingelogt so ist der String Leer
*/
public String egwGetSecurityID(KeyArray Config, KeyArray cookie) throws Exception
{
String urlhost = Config.getString("host");
if( Config.getString("port").length() > 0 )
{
urlhost = urlhost + ":" + Config.getString("port");
}
String urllink = "/" + jegwhttp.checkDir(Config.getString("subdir")) +
EGWHTTP_TRAYMODUL + "?" + EGWHTTP_GET_VAR_MAKE_SECURITYID +
"=" + EGWHTTP_GET_MAKE_SECURITYID;
String securityid = "";
this.httpcon.setCookie(this.egwGetEGWCookieStr(cookie));
String buffer = this.httpcon.openHttpContentSite(urlhost + urllink);
if( this.egwIsLogin(cookie) )
{
securityid = this.egwGetTagValue(buffer, EGWHTTP_TAG_SECURITYID);
}
return securityid;
}
public String egwGetOpenEGWLink(KeyArray Config, KeyArray cookie, String menuaction)
{
String urllink = "";
String urlhost = Config.getString("host");
String protocol = "http://";
if( Config.getString("egwurl").startsWith("https") )
{
protocol = "https://";
}
if( Config.getString("port").length() > 0 )
{
urlhost = urlhost + ":" + Config.getString("port");
}
urllink = urllink + protocol + jegwhttp.checkDir(urlhost) +
jegwhttp.checkDir(Config.getString("subdir")) + EGWHTTP_INDEXSCRIPT;
urllink = urllink + "?notifiy=1";
if( (menuaction != null) && (menuaction.length() > 0) )
{
urllink = urllink + "&" + menuaction;
}
String[] keys = cookie.getKeys();
for( int i=0; i<cookie.size(); i++ )
{
urllink = urllink + "&" + keys[i] + "=" + cookie.getString(keys[i]);
}
return urllink;
}
public boolean egwLogout(KeyArray Config, KeyArray cookie) throws Exception
{
String urlhost = Config.getString("host");
if( Config.getString("port").length() > 0 )
{
urlhost = urlhost + ":" + Config.getString("port");
}
String urllink = jegwhttp.checkDir(urlhost) +
jegwhttp.checkDir(Config.getString("subdir")) +
EGWHTTP_LOGOUTSCRIPT;
this.httpcon.setCookie(this.egwGetEGWCookieStr(cookie));
String buffer = this.httpcon.openHttpContentSite(urllink);
if( buffer.length() == 0 )
{
// Verbindungsfehler
throw new Exception("NETERROR");
}
if( !this.egwIsLogin(cookie) )
{
return true;
}
return false;
}
}

View File

@ -0,0 +1,56 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.TimerTask;
import javax.swing.event.EventListenerList;
/**
* jegwtask
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwtask extends TimerTask
{
protected EventListenerList listenerList = new EventListenerList();
public static final String EGW_TASK_RUN_UPDATE = new String("egwrunupdate");
public void addActionListener(ActionListener l)
{
listenerList.add(ActionListener.class, l);
}
protected void action(Object o, String command)
{
Object[] listeners = listenerList.getListenerList();
ActionEvent e = new ActionEvent(o, ActionEvent.ACTION_PERFORMED, command);
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==ActionListener.class) {
((ActionListener)listeners[i+1]).actionPerformed(e);
}
}
}
@Override
public void run()
{
this.action(this, EGW_TASK_RUN_UPDATE);
}
}

View File

@ -0,0 +1,228 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
/**
* jegwxmlconfig
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class jegwxmlconfig extends hwxml
{
public static final String CONF_CONFIGURATIONS = new String("configurations");
public static final String CONF_CONFIG = new String("config");
public static final String CONF_ACTIVCONFIG = new String("activconfig");
public static final String[] CONF_STRUCT = new String[]{
"host", "user", "password", "subdir", "egwurl", "logindomain",
"sslcert", "port"};
private ArrayList ConfigList = new ArrayList();
private KeyArray tmpConfig = new KeyArray(jegwxmlconfig.CONF_STRUCT);
private Boolean tagstatus = false;
private Integer activconfig = 0;
public jegwxmlconfig(String xmlfile) throws Exception
{
super(xmlfile);
}
public void addConf(KeyArray conf)
{
this.ConfigList.add(conf);
}
public void setActivConf(Integer index)
{
if( index < this.ConfigList.size() )
{
this.activconfig = index;
}
}
public KeyArray getActivConf()
{
return this.getConf(this.activconfig);
}
public KeyArray getConf(Integer index)
{
if( index < this.ConfigList.size() )
{
return (KeyArray) this.ConfigList.get(index);
}
return null;
}
public Integer countConf()
{
Integer i = this.ConfigList.size();
return i;
}
public void deleteConf(Integer index)
{
if( index < this.ConfigList.size() )
{
ArrayList newlist = new ArrayList();
for(int i=0; i<this.ConfigList.size(); i++ )
{
if(i != index)
{
newlist.add(this.ConfigList.get(i));
}
}
this.ConfigList = newlist;
}
}
@Override protected boolean mRead(XMLEvent event, XMLEventReader eventReader)
{
if( event.isStartElement() )
{
String tag = event.asStartElement().getName().getLocalPart();
if(tag.compareTo(jegwxmlconfig.CONF_CONFIG) == 0)
{
this.tagstatus = true;
// Config Leeren für neue Config
this.tmpConfig = new KeyArray(this.tmpConfig.getKeys());
return false;
}
// Aktive Configuration
if(tag.compareTo(jegwxmlconfig.CONF_ACTIVCONFIG) == 0)
{
try
{
event = eventReader.nextEvent();
String value = event.asCharacters().getData();
this.activconfig = Integer.parseInt(value);
return false;
}
catch (XMLStreamException ex)
{
Logger.getLogger(jegwxmlconfig.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(!this.tagstatus)
{
// Andere Elemente Interessieren nicht
return false;
}
String[] keys = this.tmpConfig.getKeys();
for(int i=0; i<keys.length; i++)
{
if(tag.compareTo(keys[i]) == 0)
{
try
{
event = eventReader.nextEvent();
String value = "";
if((!event.isEndElement()) && (!event.isStartElement()))
{
value = event.asCharacters().getData();
}
this.tmpConfig.add(keys[i], value);
}
catch (XMLStreamException ex)
{
Logger.getLogger(jegwxmlconfig.class.getName()).log(Level.SEVERE, null, ex);
}
return false;
}
}
}
else if(event.isEndElement())
{
String tag = event.asEndElement().getName().getLocalPart();
if(tag.compareTo(jegwxmlconfig.CONF_CONFIG) == 0)
{
this.tagstatus = false;
this.ConfigList.add(this.tmpConfig.clone());
return false;
}
}
return false;
}
@Override protected void mWrite(XMLEventFactory eventFactory, XMLEventWriter eventWriter)
{
XMLEvent end = eventFactory.createDTD("\r\n");
XMLEvent tab = eventFactory.createDTD("\t");
try
{
eventWriter.add(this.makeStartTag(jegwxmlconfig.CONF_CONFIGURATIONS));
eventWriter.add(end);
for( int i=0; i<this.ConfigList.size(); i++ )
{
KeyArray conf = (KeyArray) this.ConfigList.get(i);
String[] keys = conf.getKeys();
eventWriter.add(tab);
eventWriter.add(this.makeStartTag(jegwxmlconfig.CONF_CONFIG));
eventWriter.add(end);
for( int e=0; e<keys.length; e++ )
{
eventWriter.add(tab);
eventWriter.add(tab);
eventWriter.add(this.makeStartTag(keys[e]));
eventWriter.add(this.makeValue(conf.getString(keys[e])));
eventWriter.add(this.makeEndTag(keys[e]));
eventWriter.add(end);
}
eventWriter.add(tab);
eventWriter.add(this.makeEndTag(jegwxmlconfig.CONF_CONFIG));
eventWriter.add(end);
}
eventWriter.add(this.makeEndTag(jegwxmlconfig.CONF_CONFIGURATIONS));
eventWriter.add(end);
// Aktiv Config
eventWriter.add(this.makeStartTag(jegwxmlconfig.CONF_ACTIVCONFIG));
eventWriter.add(this.makeValue(Integer.toString(this.activconfig)));
eventWriter.add(this.makeEndTag(jegwxmlconfig.CONF_ACTIVCONFIG));
eventWriter.add(end);
}
catch (XMLStreamException ex)
{
Logger.getLogger(jegwxmlconfig.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

View File

@ -0,0 +1,14 @@
title = About: ${Application.title} ${Application.version}
closeAboutBox.Action.text = &Close
appDescLabel.text=<html>${Application.description}
versionLabel.text=Product Version\:
vendorLabel.text=Vendor\:
homepageLabel.text=Homepage\:
#NOI18N
imageLabel.icon=about.png

View File

@ -0,0 +1,11 @@
# Application global resources
Application.name = egroupwareTray v2
Application.title = eGwNotifier
Application.version = 1.0
Application.vendor = H\u00FCttner & Werfling Softwareentwicklung GbR
Application.homepage = http://www.hw-softwareentwicklung.de
Application.description = Notifier Java App for egroupware
Application.vendorId = HW
Application.id = eGwNotifier
Application.lookAndFeel = system

View File

@ -0,0 +1,32 @@
# Resources for the EgroupwareTrayView class
# top-level menus
fileMenu.text = File
helpMenu.text = Help
# @Action resources
showAboutBox.Action.text = &About...
showAboutBox.Action.shortDescription = Show the application's information dialog
# status bar resources
StatusBar.messageTimeout = 5000
StatusBar.busyAnimationRate = 30
StatusBar.idleIcon = busyicons/idle-icon.png
StatusBar.busyIcons[0] = busyicons/busy-icon0.png
StatusBar.busyIcons[1] = busyicons/busy-icon1.png
StatusBar.busyIcons[2] = busyicons/busy-icon2.png
StatusBar.busyIcons[3] = busyicons/busy-icon3.png
StatusBar.busyIcons[4] = busyicons/busy-icon4.png
StatusBar.busyIcons[5] = busyicons/busy-icon5.png
StatusBar.busyIcons[6] = busyicons/busy-icon6.png
StatusBar.busyIcons[7] = busyicons/busy-icon7.png
StatusBar.busyIcons[8] = busyicons/busy-icon8.png
StatusBar.busyIcons[9] = busyicons/busy-icon9.png
StatusBar.busyIcons[10] = busyicons/busy-icon10.png
StatusBar.busyIcons[11] = busyicons/busy-icon11.png
StatusBar.busyIcons[12] = busyicons/busy-icon12.png
StatusBar.busyIcons[13] = busyicons/busy-icon13.png
StatusBar.busyIcons[14] = busyicons/busy-icon14.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,7 @@
# To change this template, choose Tools | Templates
# and open the template in the editor.
jTable1.columnModel.title3=Title 4
jTable1.columnModel.title2=Anzahl
jTable1.columnModel.title1=Info
jTable1.columnModel.title0=Programm

View File

@ -0,0 +1,20 @@
jPaccountsetting.border.title=Account Einstellungen
jLhost.text=Name:
jTFhost.text=
jLsamplehost.text=Beispiel: Mein Egroupware
jLabel1.text=URL:
jLsamplepath.text=Beispiel: http://www.domain.de/egroupware/
jLabel2.text=Username:
jTFusername.text=
jLsampleuser.text=Beispiel: muster.mueller
Form.title=Konfiguration
jBsave.text=Speichern
jPanel1.border.title=Aktiver Account
jPanel1.AccessibleContext.accessibleName=Aktiver Account
lhoststatus.text=Host:
jLuserstatus.text=User:
jBcancel.text=Abbrechen
jBSelectActiv.text=Ausgew\u00E4hlter Account Aktivieren
jBedit.text=Bearbeiten
jTFegwurl.text=
jLhost.AccessibleContext.accessibleName=Name:

View File

@ -0,0 +1,8 @@
jLinfoBox.text=
jBOk.text=Ok
jBOpenApp.text=run application
#NOI18N
jBOpenApp.font=Arial-Plain-10
#NOI18N
jBOk.font=Arial-Plain-10

View File

@ -0,0 +1,9 @@
jLpassword.text=Passwort:
jPFpassword.text=
jBLogin.text=Login
jPanelpassword.border.border.title=Bitte geben Sie f\u00FCr den folgenden Account das Passwort ein:
jLaccount.text=Account:
jLhost.text=Host:
jCBpassword.text=Passwort Speichern
jBcancel.text=Abbrechen
Form.title=Passwort Abfrage

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabelTitleDomain" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jComboBoxDomain" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabelStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabelInfoText1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="61" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jButtonBack" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jButtonCancel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonNext" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabelStep" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabelInfoText1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabelTitleDomain" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBoxDomain" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButtonNext" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonBack" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonCancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabelStep">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Schritt 2."/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelInfoText1">
<Properties>
<Property name="text" type="java.lang.String" value="Es wurden folgende Logindomains gefunden. W&#xe4;hlen Sie bitte Ihre"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelTitleDomain">
<Properties>
<Property name="text" type="java.lang.String" value="Egroupware Logindomain:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBoxDomain">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="1">
<StringItem index="0" value="default"/>
</StringArray>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="egwSettingDomain_jComboBoxDomain"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="jButtonNext">
<Properties>
<Property name="text" type="java.lang.String" value="Weiter"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mouseClickedNext"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButtonBack">
<Properties>
<Property name="text" type="java.lang.String" value="Zur&#xfc;ck"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mouseClickedBack"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButtonCancel">
<Properties>
<Property name="text" type="java.lang.String" value="Abbrechen"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mouseClickedCancel"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,304 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray.settings;
import egroupwaretray.*;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
/**
* egwSettingDomain
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class egwSettingDomain extends javax.swing.JDialog {
private jegwconfig _config = null;
private Boolean _isClickedBack = false;
/**
* Creates new form egwSettingDomain
*/
public egwSettingDomain(java.awt.Frame parent, boolean modal, jegwconfig configmanager) {
super(parent, modal);
initComponents();
this._config = configmanager;
this.jButtonNext.setText(jegwConst.getConstTag("egw_txt_next"));
this.jButtonCancel.setText(jegwConst.getConstTag("egw_txt_cancel"));
this.jButtonBack.setText(jegwConst.getConstTag("egw_txt_back"));
this.jLabelStep.setText(jegwConst.getConstTag("egw_txt_step") + " 2.");
this.jLabelTitleDomain.setText(jegwConst.getConstTag("egw_txt_egroupware_domain"));
this.jLabelInfoText1.setText(jegwConst.getConstTag("egw_msg_info_logindomains"));
}
public void updateCombobox()
{
if( this._config.getCXMLM().countConf() > 0 )
{
KeyArray aktivconf = this._config.getCXMLM().getActivConf();
if( aktivconf != null )
{
String lastlogindomain = aktivconf.getString("logindomain");
for( int i=0; i<this.jComboBoxDomain.getItemCount(); i++ )
{
Object item = this.jComboBoxDomain.getItemAt(i);
if( item.toString().compareTo(lastlogindomain) == 0 )
{
this.jComboBoxDomain.setSelectedIndex(i);
return;
}
}
}
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabelStep = new javax.swing.JLabel();
jLabelInfoText1 = new javax.swing.JLabel();
jLabelTitleDomain = new javax.swing.JLabel();
jComboBoxDomain = new javax.swing.JComboBox();
jButtonNext = new javax.swing.JButton();
jButtonBack = new javax.swing.JButton();
jButtonCancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
jLabelStep.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabelStep.setText("Schritt 2.");
jLabelInfoText1.setText("Es wurden folgende Logindomains gefunden. Wählen Sie bitte Ihre");
jLabelTitleDomain.setText("Egroupware Logindomain:");
jComboBoxDomain.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "default" }));
jButtonNext.setText("Weiter");
jButtonNext.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mouseClickedNext(evt);
}
});
jButtonBack.setText("Zurück");
jButtonBack.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mouseClickedBack(evt);
}
});
jButtonCancel.setText("Abbrechen");
jButtonCancel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mouseClickedCancel(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelTitleDomain)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jComboBoxDomain, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelStep)
.addComponent(jLabelInfoText1))
.addGap(0, 61, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jButtonBack)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonCancel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonNext)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabelStep)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabelInfoText1)
.addGap(38, 38, 38)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabelTitleDomain)
.addComponent(jComboBoxDomain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButtonNext)
.addComponent(jButtonBack)
.addComponent(jButtonCancel))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void mouseClickedBack(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedBack
this._isClickedBack = true;
this.setVisible(false);
}//GEN-LAST:event_mouseClickedBack
private void mouseClickedCancel(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedCancel
// TODO add your handling code here:
if( jegwMain.confirmDialog(
jegwConst.getConstTag("egw_msg_cancal_setting"),
jegwConst.getConstTag("egw_txt_cancal2") ) == 0 )
{
this.setVisible(false);
}
}//GEN-LAST:event_mouseClickedCancel
private void mouseClickedNext(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedNext
// TODO add your handling code here:
String logindomain = this.jComboBoxDomain.getSelectedItem().toString();
KeyArray config = null;
if( this._config.getCXMLM().countConf() > 0 )
{
KeyArray aktivconf = this._config.getCXMLM().getActivConf();
if( aktivconf != null )
{
config = aktivconf;
}
}
if( config== null )
{
// Config erzeugen
config = new KeyArray(jegwxmlconfig.CONF_STRUCT);
}
config.add("logindomain", logindomain);
this._config.getCXMLM().deleteConf(0);
this._config.getCXMLM().addConf(config);
JFrame jf = EgroupwareTrayApp.getApplication().getMainFrame();
egwSettingUsername dialog = new egwSettingUsername(jf, true, this._config);
try {
dialog.setIconImage(hwTrayIcon.getImage(jegwConst.getConstTag("egwicon")));
} catch (IOException ex) {
Logger.getLogger(hwTrayIcon.class.getName()).log(Level.SEVERE, null, ex);
}
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);
if( !dialog.isClickedBack() )
{
this.setVisible(false);
}
}//GEN-LAST:event_mouseClickedNext
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(egwSettingDomain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(egwSettingDomain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(egwSettingDomain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(egwSettingDomain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the dialog
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
egwSettingDomain dialog = new egwSettingDomain(new javax.swing.JFrame(), true, null);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonBack;
private javax.swing.JButton jButtonCancel;
private javax.swing.JButton jButtonNext;
private javax.swing.JComboBox jComboBoxDomain;
private javax.swing.JLabel jLabelInfoText1;
private javax.swing.JLabel jLabelStep;
private javax.swing.JLabel jLabelTitleDomain;
// End of variables declaration//GEN-END:variables
public void clearSelect()
{
this.jComboBoxDomain.removeAllItems();
}
public void addSelect(String entry)
{
this.jComboBoxDomain.addItem(entry);
}
public Boolean isClickedBack()
{
return this._isClickedBack;
}
}

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabelTitleUrl" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jTextFieldUrl" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabelStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabelInfoText" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jButtonCancel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonNext" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabelStep" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabelInfoText" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabelTitleUrl" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextFieldUrl" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButtonNext" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonCancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabelStep">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Schritt 1."/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelInfoText">
<Properties>
<Property name="text" type="java.lang.String" value="Geben Sie bitte die URL zu Ihren Egroupware an, achten Sie auf die"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelTitleUrl">
<Properties>
<Property name="text" type="java.lang.String" value="Egroupware URL:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldUrl">
<Properties>
<Property name="text" type="java.lang.String" value="https://my.domain.de/egroupware/"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButtonNext">
<Properties>
<Property name="text" type="java.lang.String" value="Weiter"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mouseClickedNext"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButtonCancel">
<Properties>
<Property name="text" type="java.lang.String" value="Abbrechen"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mouseClickedCancel"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,314 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray.settings;
import egroupwaretray.*;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
* egwSettingUrl
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class egwSettingUrl extends javax.swing.JDialog {
private jegwconfig _config = null;
/**
* Creates new form egwSettingUrl
*/
public egwSettingUrl(java.awt.Frame parent, boolean modal, jegwconfig configmanager)
{
super(parent, modal);
initComponents();
this._config = configmanager;
if( this._config.getCXMLM().countConf() > 0 )
{
KeyArray aktivconf = this._config.getCXMLM().getActivConf();
if( aktivconf != null )
{
this.jTextFieldUrl.setText(aktivconf.getString("egwurl"));
}
}
this.jButtonNext.setText(jegwConst.getConstTag("egw_txt_next"));
this.jButtonCancel.setText(jegwConst.getConstTag("egw_txt_cancel"));
this.jLabelStep.setText(jegwConst.getConstTag("egw_txt_step") + " 1.");
this.jLabelInfoText.setText(jegwConst.getConstTag("egw_msg_info_url"));
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabelStep = new javax.swing.JLabel();
jLabelInfoText = new javax.swing.JLabel();
jLabelTitleUrl = new javax.swing.JLabel();
jTextFieldUrl = new javax.swing.JTextField();
jButtonNext = new javax.swing.JButton();
jButtonCancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabelStep.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabelStep.setText("Schritt 1.");
jLabelInfoText.setText("Geben Sie bitte die URL zu Ihren Egroupware an, achten Sie auf die");
jLabelTitleUrl.setText("Egroupware URL:");
jTextFieldUrl.setText("https://my.domain.de/egroupware/");
jButtonNext.setText("Weiter");
jButtonNext.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mouseClickedNext(evt);
}
});
jButtonCancel.setText("Abbrechen");
jButtonCancel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mouseClickedCancel(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelTitleUrl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextFieldUrl))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelStep)
.addComponent(jLabelInfoText))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButtonCancel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonNext)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabelStep)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabelInfoText)
.addGap(38, 38, 38)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabelTitleUrl)
.addComponent(jTextFieldUrl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButtonNext)
.addComponent(jButtonCancel))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void mouseClickedNext(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedNext
this.jButtonCancel.setEnabled(false);
this.jButtonNext.setEnabled(false);
this.repaint();
String url = this.jTextFieldUrl.getText();
if( url != null )
{
jegwhttp egwhttp = new jegwhttp(null);
KeyArray config = null;
if( this._config.getCXMLM().countConf() > 0 )
{
KeyArray aktivconf = this._config.getCXMLM().getActivConf();
if( aktivconf != null )
{
config = aktivconf;
}
}
if( config== null )
{
// Config erzeugen
config = new KeyArray(jegwxmlconfig.CONF_STRUCT);
config.add("host", "oneconfig");
}
// is "/" on end?
url = jegwhttp.checkDir(url);
config.add("egwurl", url);
try
{
String[] domains = egwhttp.getEgwLoginDomains(config);
if( BaseHttp.getTrustManager() != null )
{
// TODO add read out config
config.add("sslcert",
BaseHttp.getTrustManager().getAcceptedCerts());
}
if( (domains == null) || (domains.length==0) )
{
JOptionPane.showMessageDialog(
EgroupwareTrayApp.getApplication().getMainFrame(),
jegwConst.getConstTag("egw_msg_egroupware_not_found"),
jegwConst.getConstTag("egw_txt_setting"),
JOptionPane.INFORMATION_MESSAGE
);
}
else
{
this._config.getCXMLM().deleteConf(0);
this._config.getCXMLM().addConf(config);
JFrame jf = EgroupwareTrayApp.getApplication().getMainFrame();
egwSettingDomain dialog = new egwSettingDomain(jf, true, this._config);
dialog.clearSelect();
for( int i=0; i<domains.length; i++ )
{
dialog.addSelect(domains[i]);
}
dialog.updateCombobox();
try {
dialog.setIconImage(hwTrayIcon.getImage(jegwConst.getConstTag("egwicon")));
} catch (IOException ex) {
Logger.getLogger(hwTrayIcon.class.getName()).log(Level.SEVERE, null, ex);
}
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);
if( !dialog.isClickedBack() )
{
this.setVisible(false);
}
}
}
catch( Exception ex )
{
Logger.getLogger(egwSettingUrl.class.getName()).log(Level.SEVERE, null, ex);
jegwMain.infoDialog(
jegwConst.getConstTag("egw_msg_egroupware_not_found_con_lost"),
jegwConst.getConstTag("egw_txt_setting"));
}
}
this.jButtonNext.setEnabled(true);
this.jButtonCancel.setEnabled(true);
}//GEN-LAST:event_mouseClickedNext
private void mouseClickedCancel(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedCancel
if( jegwMain.confirmDialog(
jegwConst.getConstTag("egw_msg_cancal_setting"),
jegwConst.getConstTag("egw_txt_cancal2") ) == 0 )
{
this.setVisible(false);
}
}//GEN-LAST:event_mouseClickedCancel
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(egwSettingUrl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(egwSettingUrl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(egwSettingUrl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(egwSettingUrl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the dialog
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
egwSettingUrl dialog = new egwSettingUrl(new javax.swing.JFrame(), true, null);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonCancel;
private javax.swing.JButton jButtonNext;
private javax.swing.JLabel jLabelInfoText;
private javax.swing.JLabel jLabelStep;
private javax.swing.JLabel jLabelTitleUrl;
private javax.swing.JTextField jTextFieldUrl;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabelInfo" pref="380" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jButtonBack" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jButtonCancel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonSave" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabelStep" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabelTitle" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jTextFieldUsername" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabelStep" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabelInfo" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabelTitle" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextFieldUsername" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButtonBack" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonSave" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonCancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabelStep">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Schritt 3."/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelInfo">
<Properties>
<Property name="text" type="java.lang.String" value="Bitte geben Sie den Egroupware Benutzernamen an."/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabelTitle">
<Properties>
<Property name="text" type="java.lang.String" value="Benutzer:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldUsername">
</Component>
<Component class="javax.swing.JButton" name="jButtonBack">
<Properties>
<Property name="text" type="java.lang.String" value="Zur&#xfc;ck"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mouseClickedBack"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButtonSave">
<Properties>
<Property name="text" type="java.lang.String" value="Speichern"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mouseClickedSave"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButtonCancel">
<Properties>
<Property name="text" type="java.lang.String" value="Abbrechen"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mouseClickedCancel"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,267 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray.settings;
import egroupwaretray.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
* egwSettingUsername
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class egwSettingUsername extends javax.swing.JDialog {
private jegwconfig _config = null;
private Boolean _isClickedBack = false;
/**
* Creates new form egwSettingUsername
*/
public egwSettingUsername(java.awt.Frame parent, boolean modal, jegwconfig configmanager) {
super(parent, modal);
initComponents();
this._config = configmanager;
this.jButtonCancel.setText(jegwConst.getConstTag("egw_txt_cancel"));
this.jButtonBack.setText(jegwConst.getConstTag("egw_txt_back"));
this.jLabelStep.setText(jegwConst.getConstTag("egw_txt_step") + " 3.");
this.jButtonSave.setText(jegwConst.getConstTag("egw_txt_save"));
this.jLabelTitle.setText(jegwConst.getConstTag("egw_txt_user"));
this.jLabelInfo.setText(jegwConst.getConstTag("egw_msg_info_username"));
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabelStep = new javax.swing.JLabel();
jLabelInfo = new javax.swing.JLabel();
jLabelTitle = new javax.swing.JLabel();
jTextFieldUsername = new javax.swing.JTextField();
jButtonBack = new javax.swing.JButton();
jButtonSave = new javax.swing.JButton();
jButtonCancel = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabelStep.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabelStep.setText("Schritt 3.");
jLabelInfo.setText("Bitte geben Sie den Egroupware Benutzernamen an.");
jLabelTitle.setText("Benutzer:");
jButtonBack.setText("Zurück");
jButtonBack.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mouseClickedBack(evt);
}
});
jButtonSave.setText("Speichern");
jButtonSave.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mouseClickedSave(evt);
}
});
jButtonCancel.setText("Abbrechen");
jButtonCancel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mouseClickedCancel(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelInfo, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jButtonBack)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonCancel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonSave))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelStep)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelTitle)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextFieldUsername)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabelStep)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabelInfo)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabelTitle)
.addComponent(jTextFieldUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButtonBack)
.addComponent(jButtonSave)
.addComponent(jButtonCancel))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void mouseClickedBack(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedBack
// TODO add your handling code here:
this._isClickedBack = true;
this.setVisible(false);
}//GEN-LAST:event_mouseClickedBack
private void mouseClickedCancel(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedCancel
// TODO add your handling code here:
if( jegwMain.confirmDialog(
jegwConst.getConstTag("egw_msg_cancal_setting"),
jegwConst.getConstTag("egw_txt_cancal2") ) == 0 )
{
this.setVisible(false);
}
}//GEN-LAST:event_mouseClickedCancel
private void mouseClickedSave(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedSave
// TODO add your handling code here:
String username = this.jTextFieldUsername.getText();
if( username.trim().isEmpty() )
{
JOptionPane.showMessageDialog(
EgroupwareTrayApp.getApplication().getMainFrame(),
jegwConst.getConstTag("egw_msg_info_username"),
jegwConst.getConstTag("egw_txt_setting"),
JOptionPane.INFORMATION_MESSAGE
);
}
else
{
KeyArray config = null;
if( this._config.getCXMLM().countConf() > 0 )
{
KeyArray aktivconf = this._config.getCXMLM().getActivConf();
if( aktivconf != null )
{
config = aktivconf;
}
}
if( config== null )
{
// Config erzeugen
config = new KeyArray(jegwxmlconfig.CONF_STRUCT);
}
config.add("user", username);
this._config.getCXMLM().deleteConf(0);
this._config.getCXMLM().addConf(config);
try {
this._config.saveConfig();
this.setVisible(false);
} catch (Exception ex) {
Logger.getLogger(egwSettingUsername.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_mouseClickedSave
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(egwSettingUsername.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(egwSettingUsername.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(egwSettingUsername.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(egwSettingUsername.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the dialog
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
egwSettingUsername dialog = new egwSettingUsername(new javax.swing.JFrame(), true, null);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonBack;
private javax.swing.JButton jButtonCancel;
private javax.swing.JButton jButtonSave;
private javax.swing.JLabel jLabelInfo;
private javax.swing.JLabel jLabelStep;
private javax.swing.JLabel jLabelTitle;
private javax.swing.JTextField jTextFieldUsername;
// End of variables declaration//GEN-END:variables
public Boolean isClickedBack()
{
return this._isClickedBack;
}
}

View File

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" alignment="0" min="-2" pref="95" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTextField1" pref="281" max="32767" attributes="0"/>
<Component id="jComboBox1" max="32767" attributes="0"/>
<Component id="jTextField2" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jComboBox1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Egroupware URL:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField1">
<Properties>
<Property name="text" type="java.lang.String" value="http://meine.domain.de/egroupware/"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Schritt 1."/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="URL erreichbarkeit pr&#xfc;fen"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Schritt 2."/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Login Domain:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="jComboBox1">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Schritt 3."/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="Benutzername:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField2">
<Properties>
<Property name="text" type="java.lang.String" value="benutzer.name"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" value="Speichern und Schlie&#xdf;en"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -0,0 +1,214 @@
/**
* EGroupware - Notifications Java Desktop App
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package notifications
* @subpackage jdesk
* @link http://www.egroupware.org
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
* @author Maik Hüttner <maik.huettner@hw-softwareentwicklung.de>
*/
package egroupwaretray.settings;
/**
* egwSettings
*
* @author Stefan Werfling <stefan.werfling@hw-softwareentwicklung.de>
*/
public class egwSettings extends javax.swing.JDialog {
/**
* Creates new form egwSettings
*/
public egwSettings(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
jLabel1.setText("Egroupware URL:");
jTextField1.setText("http://meine.domain.de/egroupware/");
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel2.setText("Schritt 1.");
jButton1.setText("URL erreichbarkeit prüfen");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel3.setText("Schritt 2.");
jLabel4.setText("Login Domain:");
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel5.setText("Schritt 3.");
jLabel6.setText("Benutzername:");
jTextField2.setText("benutzer.name");
jButton2.setText("Speichern und Schließen");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)
.addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField2)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton2)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(egwSettings.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(egwSettings.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(egwSettings.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(egwSettings.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the dialog
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
egwSettings dialog = new egwSettings(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,97 @@
<?xml version="1.0"?>
<root>
<config>
<appversionnum>1915</appversionnum>
<appversion>1.9.15</appversion>
<egwtitle>eGroupware Notifier</egwtitle>
<icons>
<egwicon>lib/img/favicon.png</egwicon>
<egwiconoff>lib/img/favicon_g.png</egwiconoff>
<egwiconinfo>lib/img/favicon_info.png</egwiconinfo>
<egwiconerror>lib/img/favicon_error.png</egwiconerror>
</icons>
<egwaccountfile>egwnotifier.conf.xml</egwaccountfile>
<egwdefaultconfig>
<egw_dc_url></egw_dc_url>
<egw_dc_logindomain></egw_dc_logindomain>
<egw_dc_username></egw_dc_username>
<egw_dc_timeout_socket>10</egw_dc_timeout_socket>
<egw_dc_timeout_notify>30000</egw_dc_timeout_notify>
</egwdefaultconfig>
<ShowBallonInfo>
<info_login>Login</info_login>
<info_info>Info</info_info>
</ShowBallonInfo>
<MenuItem>
<MI_browser>Browser</MI_browser>
<MI_login>Login</MI_login>
<MI_logout>Logout</MI_logout>
<MI_settings>Settings</MI_settings>
<MI_exit>Exit</MI_exit>
</MenuItem>
<egwstatuscodes>
<egw_sc_1>You have been successfully logged out</egw_sc_1>
<egw_sc_2>Sorry, your login has expired</egw_sc_2>
<egw_sc_4>Cookies are required to login to this site.</egw_sc_4>
<egw_sc_5>Bad login or password</egw_sc_5>
<egw_sc_10>Your session could not be verified.</egw_sc_10>
<egw_sc_11>Your session could not be verified.</egw_sc_11>
<egw_sc_98>Account is expired</egw_sc_98>
<egw_sc_99>Blocked, too many attempts</egw_sc_99>
</egwstatuscodes>
<egwmesssage>
<egw_msg_tm_certerror>The server certificate is not a valid trust center certificate!</egw_msg_tm_certerror>
<egw_msg_tm_connected>Continue to connect?</egw_msg_tm_connected>
<egw_msg_tm_title_errorssl>Error SSL</egw_msg_tm_title_errorssl>
<egw_msg_trayicon_init_error>Error on loading Tray icon</egw_msg_trayicon_init_error>
<egw_msg_infodialog_runapp>run application</egw_msg_infodialog_runapp>
<egw_msg_title_warning>Warning</egw_msg_title_warning>
<egw_msg_config_create>Info on load config file: create config file.</egw_msg_config_create>
<egw_msg_setting_aborting>Setting aborted, application exit</egw_msg_setting_aborting>
<egw_msg_login_aborting>Login aborted, application exit?</egw_msg_login_aborting>
<egw_msg_login_start>Egroupware login is starting, please wait.</egw_msg_login_start>
<egw_msg_start_browser>Browser is starting.</egw_msg_start_browser>
<egw_msg_start_browser_error>Error Browser can`t start.</egw_msg_start_browser_error>
<egw_msg_repeat_login>Repeat Login?</egw_msg_repeat_login>
<egw_msg_connection_error>Connection error. Please check connection to server.</egw_msg_connection_error>
<egw_msg_premission_denied>Permission denied for notifications application.</egw_msg_premission_denied>
<egw_msg_contact_admin>Please contact your EGroupware admin.</egw_msg_contact_admin>
<egw_msg_page_not_found>Page not found, please check Serveraddress.</egw_msg_page_not_found>
<egw_msg_domain_not_found>Domain not found, please check Serveraddress.</egw_msg_domain_not_found>
<egw_msg_password_enter>Please enter your password</egw_msg_password_enter>
<egw_msg_egroupware_not_found>Egroupware not found by URL.</egw_msg_egroupware_not_found>
<egw_msg_egroupware_not_found_con_lost>Egroupware not found by URL or connection lost to server.</egw_msg_egroupware_not_found_con_lost>
<egw_msg_cancal_setting>Cancal settings?</egw_msg_cancal_setting>
<egw_msg_info_url>Please enter the URL of your Egroupware.</egw_msg_info_url>
<egw_msg_info_logindomains>Egroupware Logindomains founds, please select.</egw_msg_info_logindomains>
<egw_msg_info_username>Please enter your Egroupware username.</egw_msg_info_username>
</egwmesssage>
<egwtext>
<egw_txt_tm_certinfo>Certification-information:</egw_txt_tm_certinfo>
<egw_txt_tm_issuer_dn>Issuer DN:</egw_txt_tm_issuer_dn>
<egw_txt_tm_subject_dn>Subject DN:</egw_txt_tm_subject_dn>
<egw_txt_account>Account:</egw_txt_account>
<egw_txt_login>login in EGroupware:</egw_txt_login>
<egw_txt_title_login>Login</egw_txt_title_login>
<egw_txt_title_premission>Permission</egw_txt_title_premission>
<egw_txt_title_notifier>Notifier</egw_txt_title_notifier>
<egw_txt_update>(Update in sec. %s)</egw_txt_update>
<egw_txt_connection_error>Connection error.</egw_txt_connection_error>
<egw_txt_title_password>Password:</egw_txt_title_password>
<egw_txt_cancel>Cancel</egw_txt_cancel>
<egw_txt_save_password>save password</egw_txt_save_password>
<egw_txt_title_dialog_password>Password</egw_txt_title_dialog_password>
<egw_txt_host>Host:</egw_txt_host>
<egw_txt_user>User:</egw_txt_user>
<egw_txt_setting>Setting</egw_txt_setting>
<egw_txt_error>Error</egw_txt_error>
<egw_txt_cancal2>Cancal?</egw_txt_cancal2>
<egw_txt_next>Next</egw_txt_next>
<egw_txt_step>Step</egw_txt_step>
<egw_txt_back>Back</egw_txt_back>
<egw_txt_save>Save</egw_txt_save>
<egw_txt_user>User:</egw_txt_user>
<egw_txt_egroupware_domain>Egroupware Logindomain:</egw_txt_egroupware_domain>
</egwtext>
</config>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

View File

@ -1,12 +1,29 @@
(update in sec. %s) notifications de (Aktualisierung in sec. %s)
account: notifications de Benutzername:
all possible notification backends notifications de alle verfügbaren Benachrichtigungs-Schnittstellen
browser notifications de Browser
browser is starting. notifications de Browser ist am starten.
cancal settings? notifications de Einstellungen abbrechen?
cancal? notifications de Abbrechen?
certification-information: notifications de Informationen zum Zertifikat:
check both (first try (active) user defined account, if none use emailadmin profile) admin de Prüfe beides (wenn vorhanden verwende das aktive Benutzerdefinierte Konto, sonst das Email-adminprofil)
choose a notification-chain. you will be notified over the backends included in the chain.<br />note: if a notification-chain is marked as "disabled", your administrator does not allow one or more of the backends included in the chain and notifications falls back to "e-mail" while notifying you. notifications de Wählen Sie eine Benachrichtigungskette. Sie werden über die Schnittstellen benachrichtigt, die in der Kette enthalten sind.<br />Bitte beachten: Wenn eine Benachrichtigungskette als "deaktiviert" markiert ist oder Ihr Administrator erlaubt ein oder mehrere Schnittstellen nicht, die in der Kette enthalten sind, so weicht die EGroupware-Benachrichtigung auf die Methode "E-Mail" aus.
choose from mailsettings used for notification admin de Auswahl der für die Benachrichtigung per E-Mail verwendeten Mailprofile
common chains notifications de Einfache Ketten
connection error. notifications de Verbindungsfehler.
connection error. please check connection to server. notifications de Verbindungsfehler. Bitte überprüfen Sie die Verbindung zum Server.
continue to connect? notifications de Weiter versuche zu Verbinden?
cookies are required to login to this site. notifications de Cookies werden zum Login auf diese Seite benötigt.
disabled chains notifications de Deaktivierte Ketten
do not notify me at all notifications de benachrichtige mich niemals
domain not found, please check serveraddress. notifications de Domain nicht gefunden, bitte Serveradresse überprüfen.
e-mail only notifications de nur E-Mail
egroupware has notifications for you notifications de EGroupware hat Benachrichtigungen für Sie
egroupware login is starting, please wait. notifications de EGroupware Login wird ausgeführt, bitte warten.
egroupware logindomain: notifications de EGroupware Logindomain:
egroupware logindomains founds, please select. notifications de Folgende EGroupware Logindomains gefunden, bitte auswählen.
egroupware not found by url or connection lost to server. notifications de Keine EGroupware Installation unter der Adresse gefunden oder Verbindung zum Server verloren.
egroupware not found by url. notifications de Keine EGroupware Installation unter der Adresse gefunden.
egroupware-popup and e-mail notifications de EGroupware-Popup und E-Mail
egroupware-popup and windows-popup notifications de EGroupware-Popup und Windows-Popup
egroupware-popup backend admin de EGroupware-Popup Schnittstelle
@ -19,27 +36,60 @@ enable egroupware-popup backend admin de EGroupware-Popup Schnittstelle aktivier
enable sms backend admin de SMS Schnittstelle aktivieren
enable windows-popup backend admin de Windows-Popup Schnittstelle aktivieren
enabled chains notifications de Aktivierte Ketten
error browser can`t start. notifications de Fehler beim Starten des Browsers.
error on loading tray icon notifications de Fehler beim Laden des Icons für die Taskleiste
error ssl notifications de SSL Fehler
exit notifications de Beenden
folder notifications de Ordner
from notifications de von
host: notifications de Server:
how verbose should the egroupware-popup behave if a notification is sent to the user:<br />low: just display the notification bell in the topmenu - topmenu must be enabled!<br />medium: bring notification window to front<br />high: bring notification window to front and let the browser do something to announce itself notifications de Wie hoch soll das EGroupware-Popup die Priorität setzen wenn eine Benachrichtigung an den Benutzer gesendet wird:<br />Niedrig: Es wird nur die Benachrichtigungsglocke im Topmenü angezeigt - das Topmenü muss hierfür eingeschaltet sein!<br />Mittel: Holt das Benachrichtigungsfenster in den Vordergrund<br />Hoch: Holt das Benachrichtigungsfenster in den Vordergrund und aktiviert den Browser zur besseren Erkennung der Benachrichtigung.
if set, embedded links get rendered special for external clients notifications de Wenn diese Option aktiviert ist, werden "eingebettete Links" besser graphisch aufbereitet.
info on load config file: create config file. notifications de Information zum Laden der Konfigurationsdatei: Datei wird angelegt.
issuer dn: notifications de Herausgeber:
java desktop notification app preferences de Java Anwendung für Desktop Benachrichtigungen
linked entries: common de Verknüpfte Einträge:
login aborted, application exit? notifications de Login abgebrochen, Anwendung beenden?
login in egroupware: notifications de Login in EGroupware
mail backend admin de E-Mail Schnittstelle
maximum sms messages per notification admin de Maximale Anzahl an SMS Nachrichten pro Benachrichtigung
message from notifications de Nachricht von
minutes notifications de Minuten
notification common de Benachrichtigung
notifier notifications de Benachrichtiger
notify me by notifications de Benachrichtige mich per
optimize e-mails for external mail client notifications de Optimiere E-Mails für externe Mailclients
page not found, please check serveraddress. notifications de Seite nicht gefunden, bitte überprüfen Sie die Serveradresse
password: notifications de Passwort:
permission notifications de Berechtigung
permission denied for notifications application. notifications de Zugriff verweigert zur Benachrichtigungen Anwendung.
please contact your egroupware admin. notifications de Bitte kontaktieren Sie Ihren EGroupware Administrator
please enter the url of your egroupware. notifications de Bitte geben Sie die Serveradresse (URL) Ihre EGroupware ein.
please enter your egroupware username. notifications de Bitte geben Sie Ihren EGroupware Benutzernamen ein.
please enter your password notifications de Bitte geben Sie Ihr Passwort ein.
poll interval notifications de Abfrageintervall
preferences for notification notifications de Benachrichtigungs-Einstellungen
received notifications de Erhalten
repeat login? notifications de Anmeldung erneut versuchen?
run application notifications de Anwendung ausführen
save password notifications de Passwort speichern
setting notifications de Einstellung
setting aborted, application exit notifications de Einstellungen abgebrochen, Anwendung beenden
settings notifications de Einstellungen
sms backend admin de SMS Schnittstelle
sms only notifications de nur SMS
sorry, your login has expired notifications de Entschuldigung, Ihre Benutzerkennung ist abgelaufen
step notifications de Schritt
subject dn: notifications de Serveradresse
the server certificate is not a valid trust center certificate! notifications de Das Zertifikat des Webservers ist nicht vertrauenswürdig!
this egroupware notification has been sent to you by mail because your chosen notification-chain has been disabled by the administrator. please choose another notification-chain in your preferences! notifications de Diese EGroupware-Benachrichtigung wurde Ihnen per Mail zugesandt, da Ihre gewählte Benachrichtigungskette vom Administrator deaktiviert wurde. Bitte wählen Sie eine andere Benachrichtigungskette in Ihren Einstellungen!
user: notifications de Benutzer:
warning notifications de Warnung
windows-popup and e-mail notifications de Windows-Popup und E-Mail
windows-popup backend admin de Windows-Popup Schnittstelle
windows-popup first, if that fails notify me by e-mail notifications de Zuerst Windows-Popup. Wenn dies fehl schlägt, benachrichtige mich per E-Mail.
windows-popup first, if that fails notify me by sms notifications de Zuerst Windows-Popup. Wenn dies fehl schlägt, benachrichtige mich per SMS.
windows-popup only notifications de nur Windows-Popup
you have been successfully logged out notifications de Sie wurde erfolgreich abgemeldet
you've got new mail notifications de Sie haben neue E-Mails
your session could not be verified. notifications de Ihre Sitzung konnte nicht verifiziert werden.

View File

@ -1,12 +1,29 @@
(update in sec. %s) notifications en (Update in sec. %s)
account: notifications en Account:
all possible notification backends notifications en All possible notification backends
browser notifications en Browser
browser is starting. notifications en Browser is starting.
cancal settings? notifications en Cancal settings?
cancal? notifications en Cancal?
certification-information: notifications en Certification-information:
check both (first try (active) user defined account, if none use emailadmin profile) admin en Check both. First try active user defined account, if none, use eMailAdmin profile.
choose a notification-chain. you will be notified over the backends included in the chain.<br />note: if a notification-chain is marked as "disabled", your administrator does not allow one or more of the backends included in the chain and notifications falls back to "e-mail" while notifying you. notifications en Choose a notification chain. You will be notified over the back ends included in the chain.<br />Note: If a notification chain is marked as "disabled", your administrator does not allow one or more of the back ends included in the chain, the notifications falls back to "Email" while notifying you.
choose from mailsettings used for notification admin en Choose mail settings used for email notification
common chains notifications en Common chains
connection error. notifications en Connection error.
connection error. please check connection to server. notifications en Connection error. Please check connection to server.
continue to connect? notifications en Continue to connect?
cookies are required to login to this site. notifications en Cookies are required to login to this site.
disabled chains notifications en Disabled chains
do not notify me at all notifications en Do not notify me at all
domain not found, please check serveraddress. notifications en Domain not found, please check Serveraddress.
e-mail only notifications en Email only
egroupware has notifications for you notifications en EGroupware has notifications for you
egroupware login is starting, please wait. notifications en EGroupware login is starting, please wait.
egroupware logindomain: notifications en EGroupware Logindomain:
egroupware logindomains founds, please select. notifications en EGroupware Logindomains founds, please select.
egroupware not found by url or connection lost to server. notifications en Egroupware not found by URL or connection lost to server.
egroupware not found by url. notifications en EGroupware not found by URL.
egroupware-popup and e-mail notifications en EGroupware popup and email
egroupware-popup and windows-popup notifications en EGroupware popup and Windows popup
egroupware-popup backend admin en EGroupware popup back end
@ -19,27 +36,60 @@ enable egroupware-popup backend admin en Enable EGroupware popup back end
enable sms backend admin en Enable SMS backend
enable windows-popup backend admin en Enable Windows popup back end
enabled chains notifications en Enabled chains
error browser can`t start. notifications en Error Browser can`t start.
error on loading tray icon notifications en Error on loading Tray icon
error ssl notifications en Error SSL
exit notifications en Exit
folder notifications en Folder
from notifications en From
host: notifications en Host:
how verbose should the egroupware-popup behave if a notification is sent to the user:<br />low: just display the notification bell in the topmenu - topmenu must be enabled!<br />medium: bring notification window to front<br />high: bring notification window to front and let the browser do something to announce itself notifications en How verbose should the EGroupware-Popup behave if a notification is sent to the user:<br />low: just display the notification bell in the top menu - top menu must be enabled!<br />medium: bring notification window to front<br />high: bring notification window to front and let the browser do something to announce itself
if set, embedded links get rendered special for external clients notifications en If set, embedded links get rendered special for external clients
info on load config file: create config file. notifications en Info on load config file: create config file.
issuer dn: notifications en Issuer DN:
java desktop notification app preferences en Java desktop notification app
linked entries: common en Linked entries:
login aborted, application exit? notifications en Login aborted, application exit?
login in egroupware: notifications en login in EGroupware:
mail backend admin en Mail backend
maximum sms messages per notification admin en Maximum SMS messages per notification
message from notifications en Message from
minutes notifications en Minutes
notification common en Notification
notifier notifications en Notifier
notify me by notifications en Notify me by
optimize e-mails for external mail client notifications en Optimize emails for external email client
page not found, please check serveraddress. notifications en Page not found, please check Serveraddress.
password: notifications en Password:
permission notifications en Permission
permission denied for notifications application. notifications en Permission denied for notifications application.
please contact your egroupware admin. notifications en Please contact your EGroupware admin.
please enter the url of your egroupware. notifications en Please enter the URL of your Egroupware.
please enter your egroupware username. notifications en Please enter your Egroupware username.
please enter your password notifications en Please enter your password
poll interval notifications en Poll interval
preferences for notification notifications en Preferences for notification
received notifications en Received
repeat login? notifications en Repeat Login?
run application notifications en run application
save password notifications en save password
setting notifications en Setting
setting aborted, application exit notifications en Setting aborted, application exit
settings notifications en Settings
sms backend admin en SMS back end
sms only notifications en SMS only
sorry, your login has expired notifications en Sorry, your login has expired
step notifications en Step
subject dn: notifications en Subject DN:
the server certificate is not a valid trust center certificate! notifications en The server certificate is not a valid trust center certificate!
this egroupware notification has been sent to you by mail because your chosen notification-chain has been disabled by the administrator. please choose another notification-chain in your preferences! notifications en This EGroupware notification has been sent to you by mail because your chosen notification chain has been disabled by the administrator. Please choose another notification chain in your preferences!
user: notifications en User:
warning notifications en Warning
windows-popup and e-mail notifications en Windows popup and email
windows-popup backend admin en Windows popup back end
windows-popup first, if that fails notify me by e-mail notifications en Windows popup first, if that fails notify me by email
windows-popup first, if that fails notify me by sms notifications en Windows popup first, if that fails notify me by SMS
windows-popup only notifications en Windows popup only
you have been successfully logged out notifications en You have been successfully logged out
you've got new mail notifications en You've got a new mail
your session could not be verified. notifications en Your session could not be verified.

View File

@ -15,7 +15,7 @@ if (!defined('NOTIFICATION_APP'))
}
$setup_info[NOTIFICATION_APP]['name'] = NOTIFICATION_APP;
$setup_info[NOTIFICATION_APP]['version'] = '1.9.003';
$setup_info[NOTIFICATION_APP]['version'] = '1.9.004';
$setup_info[NOTIFICATION_APP]['app_order'] = 1;
$setup_info[NOTIFICATION_APP]['tables'] = array('egw_notificationpopup');
$setup_info[NOTIFICATION_APP]['enable'] = 2;
@ -45,3 +45,4 @@ $setup_info[NOTIFICATION_APP]['depends'][] = array(
'appname' => 'etemplate',
'versions' => Array('1.7','1.8','1.9')
);

View File

@ -15,7 +15,8 @@ $phpgw_baseline = array(
'notify_id' => array('type' => 'auto','nullable' => False,'comment' => 'primary key'),
'account_id' => array('type' => 'int','precision' => '20','nullable' => False,'comment' => 'user to notify'),
'notify_message' => array('type' => 'text','comment' => 'notification message'),
'notify_created' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'creation time of notification')
'notify_created' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'creation time of notification'),
'notify_type' => array('type' => 'varchar','precision' => '32','comment' => 'notification type')
),
'pk' => array('notify_id'),
'fk' => array(),

View File

@ -89,3 +89,15 @@ function notifications_upgrade1_9_002()
return $GLOBALS['setup_info']['notifications']['currentver'] = '1.9.003';
}
function notifications_upgrade1_9_003()
{
$GLOBALS['egw_setup']->oProc->AddColumn('egw_notificationpopup','notify_type',array(
'type' => 'varchar',
'precision' => '32',
'comment' => 'notification type'
));
return $GLOBALS['setup_info']['notifications']['currentver'] = '1.9.004';
}