[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] javassh/inc hook_admin.inc.php, 1.3 class.ui_jssh.inc
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] javassh/inc hook_admin.inc.php, 1.3 class.ui_jssh.inc.php, 1.2 hook_sidebox_menu.inc.php, 1.2 class.so_jssh.inc.php, 1.2 class.bo_jssh.inc.php, 1.2 class.ui.inc.php, 1.4 class.bo.inc.php, 1.4 class.so.inc.php, 1.3 |
Date: |
Sun, 15 May 2005 14:29:00 +0200 |
Update of javassh/inc
Modified Files:
Branch: MAIN
hook_admin.inc.php lines: +2 -2
Added Files:
Branch: MAIN
class.ui_jssh.inc.php lines: +227 -0
hook_sidebox_menu.inc.php lines: +71 -0
class.so_jssh.inc.php lines: +85 -0
class.bo_jssh.inc.php lines: +64 -0
Removed Files:
Branch: MAIN
class.ui.inc.php
class.bo.inc.php
class.so.inc.php
Log Message:
merged from 16
====================================================
Index: javassh/inc/hook_admin.inc.php
diff -u javassh/inc/hook_admin.inc.php:1.2 javassh/inc/hook_admin.inc.php:1.3
--- javassh/inc/hook_admin.inc.php:1.2 Sun Sep 7 02:26:45 2003
+++ javassh/inc/hook_admin.inc.php Sun May 15 12:29:54 2005
@@ -22,7 +22,7 @@
$title = $appname;
$file = Array(
'Site Configuration' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname='
. $appname),
- 'Manage Servers' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=javassh.ui.admin_list'),
+ 'Manage Servers' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=javassh.ui_jssh.admin_list'),
);
//Do not modify below this line
display_section($appname,$title,$file);
====================================================
Index: class.ui_jssh.inc.php
<?php
/**********************************************************************\
* phpGroupWare - JavaSSH *
* http://www.phpgroupware.org *
* This program is part of the GNU project, see http://www.gnu.org/ *
* *
* Copyright 2002, 2003 Free Software Foundation, Inc. *
* *
* Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
* -------------------------------------------- *
* Development Sponsored by Advantage Business Systems - abcsinc.com *
* -------------------------------------------- *
* This program is Free Software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* at your option) any later version. *
\**********************************************************************/
/* $Id: class.ui_jssh.inc.php,v 1.2 2005/05/15 12:29:54 skwashd Exp $ */
class ui_jssh
{
var $bo;
var $t;
var $public_functions = array('index' => True,
'connect' => True,
'css' => True,
'admin_list' => True,
'admin_delete' => True,
'admin_edit' => True,
'admin_save' => True,
'admin_view' => True,
);
function ui_jssh()
{
$this->bo = createObject('javassh.bo_jssh');
$this->t = $GLOBALS['phpgw']->template;
}
function admin_list()
{
if(!isset($GLOBALS['phpgw_info']['user']['apps']['admin']))
{
$GLOBALS['phpgw']->redirect_link('/home.php');
exit;
}
$GLOBALS['phpgw']->common->phpgw_header();
echo parse_navbar();
$this->t->set_file(array('admin' => 'admin.tpl'));
$this->t->set_block('admin','list');
$this->t->set_block('admin','row');
$this->t->set_block('admin','row_empty');
$this->t->set_var('title',lang('servers'));
$this->t->set_var('lang_server',lang('servers'));
$this->t->set_var('lang_edit',lang('Edit'));
$this->t->set_var('lang_delete',lang('Delete'));
$this->t->set_var('lang_view',lang('View'));
$this->t->set_var('lang_add',lang('Add'));
$servers = $this->bo->get_servers();
if(is_array($servers))
{
$i=1;
foreach($servers as $server_id => $server_vals)
{
$this->t->set_var('class_row', (($i++ %
2) ? 'rowon' : 'rowoff'));
$this->t->set_var('server_name',$server_vals['title']);
$this->t->set_var('row_edit',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' =>
'javassh.ui_jssh.admin_edit', 'id' => $server_id)));
$this->t->set_var('row_delete',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' =>
'javassh.ui_jssh.admin_delete', 'id' => $server_id)));
$this->t->set_var('row_view',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' =>
'javassh.ui_jssh.admin_view', 'id' => $server_id)));
$this->t->parse('rows','row',True);
}
}
else
{
$this->t->set_var('lang_row_empty',lang('no
servers found'));
$this->t->parse('rows','row_empty');
}
$this->t->set_var('add_url',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' =>
'javassh.ui_jssh.admin_edit')));
$this->t->pfp('out','list');
}
function admin_edit()
{
$this->admin_show_server('edit');
}
function admin_show_server($tpl)
{
if(!isset($GLOBALS['phpgw_info']['user']['apps']['admin']))
{
$GLOBALS['phpgw']->redirect_link('/home.php');
exit;
}
if(isset($_GET['id']))
{
$server =
$this->bo->find_server(trim($_GET['id']));
}
$GLOBALS['phpgw']->common->phpgw_header();
echo parse_navbar();
$this->t->set_file(array('show' => $tpl.'.tpl'));
$lang = array('lang_done' => lang('done'),
'lang_host' =>
lang('host'),
'lang_port' =>
lang('port'),
'lang_protocol' =>
lang('protocol'),
'lang_save' =>
lang('save'),
'lang_'.$tpl.'_server' =>
lang($tpl.'_server'),
);
$this->t->set_var($lang);
$this->t->set_var($server);
$this->t->set_var('server_id', $_GET['id']);
$this->t->set_var('action',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' =>
'javassh.ui_jssh.admin_save')));
$this->t->set_var('selected_' . $server['protocol'],
'selected');
$this->t->set_var('url_done',$GLOBALS['phpgw']->link('/index.php',
array('menuaction' =>
'javassh.ui_jssh.admin_list')));
$this->t->pfp('out', 'show');
}
function admin_save()
{
$server['id'] = $_POST['id'];
$server['host'] = $_POST['host'];
$server['port'] = $_POST['port'];
$server['protocol'] = $_POST['protocol'];
$id = $this->bo->save($server);
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' =>
'javassh.ui_jssh.admin_edit', 'id' => $id));
}
function admin_view()
{
$this->admin_show_server('view');
}
function index()
{
$GLOBALS['phpgw']->common->phpgw_header();
echo parse_navbar();
$servers = $this->bo->get_servers();
if(is_array($servers))
{
$this->t->set_file('index', 'index.tpl');
$this->t->set_block('index','server','servers');
$this->t->set_var('action',
$GLOBALS['phpgw']->link('/index.php',
array('menuaction' =>
'javassh.ui_jssh.connect')));
$lang = array('lang_javassh_connect'=>
lang('javassh login'),
'lang_server' =>
lang('server'),
'lang_connect' =>
lang('connect'),
'lang_clear' =>
lang('clear'),
);
foreach($servers as $server_id => $server_vals)
{
$this->t->set_var('server_id',
$server_id);
$this->t->set_var('server_name',
$server_vals['title']);
$this->t->set_var('selected','');
$this->t->parse('servers', 'server',
True);
}
$this->t->set_var($lang);
$this->t->set_var('user_val',
$GLOBALS['phpgw_info']['user']['account_lid']);
$this->t->pfp('out', 'index');
}
else
{
echo '<p>' . lang('not configured') . '</p>';
}
}
function connect()
{
$id = get_var('server', array('POST', 'GET'));
$server = $this->bo->find_server($id);
$applet = $this->bo->get_applet_info();
$this->t->set_file('connect', 'connect.tpl');
if($server['protocol'] == 'ssh')
{
$plugins = 'Status,Socket,SSH,Terminal';
}
else
{
$plugins = 'Status,Socket,Telnet,Terminal';
}
$this->t->set_var('css', $this->css());
$this->t->set_var('pgtitle',
htmlentities($GLOBALS['phpgw_info']['server']['title'] . ' ['
. lang('javassh') . '] - ' . $server['title']));
$this->t->set_var($applet);
$this->t->set_var('plugins', $plugins);
$this->t->set_var($server);
$this->t->set_var('lang_logout', lang('logout'));
$this->t->set_var('colorset', $applet['url'] .
'colorSet.conf');
$this->t->pfp('out', 'connect');
}
function css()
{
$css = 'tr.th { background-color:' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . "; font-weight: bold; }\n";
$css .= 'tr.rowon { background-color:' .
$GLOBALS['phpgw_info']['theme']['row_on'] . "; }\n";
$css .= 'tr.rowoff { background-color:' .
$GLOBALS['phpgw_info']['theme']['row_off'] . "; }\n";
if($_GET['menuaction'] == 'javassh.ui_jssh.connect')
{
$css .= "a, p, td {font-family: Arial,
Helvetica, Monaco, sana-serif; font-size: 11pt; text-decoration: none;}\n";
$css .= "a:hover {color:#FF0000;
text-decoration: underline;}\n";
}
return $css;
}
}
?>
====================================================
Index: hook_sidebox_menu.inc.php
<?php
/**************************************************************************\
* phpGroupWare - Calendar's Sidebox-Menu for idots-template *
* http://www.phpgroupware.org *
* Written by Pim Snel <address@hidden> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id: hook_sidebox_menu.inc.php,v 1.2 2005/05/15 12:29:54 skwashd Exp $ */
{
/*
This hookfile is for generating an app-specific side menu used in the
idots
template set.
$menu_title speaks for itself
$file is the array with link to app functions
display_sidebox can be called as much as you like
*/
$menu_title = $GLOBALS['phpgw_info']['apps'][$appname]['title'] . ' '.
lang('Menu');
$bo_jssh = createObject('javassh.bo_jssh');
$servers = $bo_jssh->get_servers();
if(!is_array($servers))
{
if(isset($GLOBALS['phpgw_info']['user']['apps']['admin']))
{
$file = array(
array(
'text' => 'no servers
available - please add one',
'url' =>
$GLOBALS['phpgw']->link('/index.php',
array('menuaction',
'javassh.ui_jssh.list_servers'))
)
);
}
else
{
$file = array('text' => 'javassh is not configured');
}
$servers = array();
}
foreach($servers as $server)
{
$file[] = array('text' => $server['title'],
'url' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'javassh.ui_jssh.connect',
'server' => $server['server_id']
)
)
);
}
display_sidebox($appname,$menu_title,$file);
if ($GLOBALS['phpgw_info']['user']['apps']['admin'])
{
$menu_title = lang('Administration');
$file = Array(
array('text' => 'Site Configuration',
'url' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=javassh')),
array('text' => 'Manage Servers',
'url' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=javassh.ui_jssh.admin_list')),
);
display_sidebox($appname,$menu_title,$file);
}
}
?>
====================================================
Index: class.so_jssh.inc.php
<?php
/**********************************************************************\
* phpGroupWare - JavaSSH *
* http://www.phpgroupware.org *
* This program is part of the GNU project, see http://www.gnu.org/ *
* *
* Copyright 2002, 2003 Free Software Foundation, Inc. *
* *
* Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
* -------------------------------------------- *
* Development Sponsored by Advantage Business Systems - abcsinc.com *
* -------------------------------------------- *
* This program is Free Software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* at your option) any later version. *
\**********************************************************************/
/* $Id: class.so_jssh.inc.php,v 1.2 2005/05/15 12:29:54 skwashd Exp $ */
class so_jssh
{
var $db;
function so_jssh()
{
$this->db =& $GLOBALS['phpgw']->db;
}
function get_servers()
{
$this->db->query('SELECT * FROM phpgw_javassh_servers
WHERE active=1');
while($this->db->next_record())
{
$servers[$this->db->f('server_id')] =
array('server_id' => $this->db->f('server_id'),
'host' => $this->db->f('host',
true),
'port' => $this->db->f('port'),
'protocol' =>
$this->db->f('protocol'),
'title' =>
$this->db->f('protocol').':'.$this->db->f('host',
true).':'.$this->db->f('port'),
);
}
return $servers;
}
function find_server($id)
{
$server = '';
$this->db->query('SELECT * FROM phpgw_javassh_servers '
. 'WHERE active=1 AND
server_id=' . intval($id));
if($this->db->next_record())
{
$server = array('server_id' =>
$this->db->f('server_id'),
'host'
=> $this->db->f('host', true),
'port'
=> $this->db->f('port'),
'protocol'
=> $this->db->f('protocol'),
'title'
=> $this->db->f('protocol').':'.$this->db->f('host',
true).':'.$this->db->f('port'),
);
}
return $server;
}
function save($data)
{
if(isset($data['id']) && @$data['id'])
{
$sql = 'UPDATE phpgw_javassh_servers ';
$sql .= "SET host='" .
$this->db->db_addslashes($data['host']) ."', ";
$sql .= 'port=' . intval($data['port']) . ', ';
$sql .= "protocol='" . ($data['protocol'] ==
'telnet' ? 'telnet' : 'ssh') . "' ";
$sql .= 'WHERE server_id=' .
intval($data['id']);
$this->db->query($sql);
return $data['id'];
}
else//must be new
{
$sql = 'INSERT INTO
phpgw_javassh_servers(host, port, protocol) ';
$sql .= "VALUES('" .
$this->db->db_addslashes($data['host']) ."', ";
$sql .= intval($data['port']) . ", '"
.($data['protocol'] == 'telnet' ? 'telnet' : 'ssh') . "') ";
$this->db->query($sql);
return
$this->db->get_last_insert_id('phpgw_javassh_servers', 'server_id');
}
}
}
?>
====================================================
Index: class.bo_jssh.inc.php
<?php
/**********************************************************************\
* phpGroupWare - JavaSSH *
* http://www.phpgroupware.org *
* This program is part of the GNU project, see http://www.gnu.org/ *
* *
* Copyright 2002, 2003 Free Software Foundation, Inc. *
* *
* Originally Written by Dave Hall - <skwashd at phpgroupware.org> *
* -------------------------------------------- *
* Development Sponsored by Advantage Business Systems - abcsinc.com *
* -------------------------------------------- *
* This program is Free Software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* at your option) any later version. *
\**********************************************************************/
/* $Id: class.bo_jssh.inc.php,v 1.2 2005/05/15 12:29:54 skwashd Exp $ */
class bo_jssh
{
var $servers;
var $so;
function bo_jssh()
{
$this->so = createObject('javassh.so_jssh');
}
function get_servers()
{
return $this->so->get_servers();
}
function find_server($id)
{
return $this->so->find_server($id);
}
function get_applet_info()
{
$config = createObject('phpgwapi.config');
$config->read_repository();
$config_vals = $config->config_data;
if(!(isset($config_vals['applet_url']) &&
isset($config_vals['applet_file'])))
{
$config_vals['applet_url'] =
(isset($config_vals['applet_url']) ? $config_vals['applet_url']
: $GLOBALS['phpgw_info']['server']['webserver_url'] .
'/javassh/applet/');
$config_vals['applet_file'] =
(isset($config_vals['applet_file']) ? $config_vals['applet_file']
: 'jta25.jar');
$config->config_data = $config_vals;
$config->save_repository();
}
return $config_vals;
}
function save($data)
{
return $this->so->save($data);
}
}
?>
- [Phpgroupware-cvs] javassh/inc hook_admin.inc.php, 1.3 class.ui_jssh.inc.php, 1.2 hook_sidebox_menu.inc.php, 1.2 class.so_jssh.inc.php, 1.2 class.bo_jssh.inc.php, 1.2 class.ui.inc.php, 1.4 class.bo.inc.php, 1.4 class.so.inc.php, 1.3, skwashd, 2005/05/16
- [Phpgroupware-cvs] javassh/inc hook_admin.inc.php, 1.3 class.ui_jssh.inc.php, 1.2 hook_sidebox_menu.inc.php, 1.2 class.so_jssh.inc.php, 1.2 class.bo_jssh.inc.php, 1.2 class.ui.inc.php, 1.4 class.bo.inc.php, 1.4 class.so.inc.php, 1.3,
skwashd <=
- [Phpgroupware-cvs] javassh/inc hook_admin.inc.php, 1.3 class.ui_jssh.inc.php, 1.2 hook_sidebox_menu.inc.php, 1.2 class.so_jssh.inc.php, 1.2 class.bo_jssh.inc.php, 1.2 class.ui.inc.php, 1.4 class.bo.inc.php, 1.4 class.so.inc.php, 1.3, skwashd, 2005/05/16
- [Phpgroupware-cvs] javassh/inc hook_admin.inc.php, 1.3 class.ui_jssh.inc.php, 1.2 hook_sidebox_menu.inc.php, 1.2 class.so_jssh.inc.php, 1.2 class.bo_jssh.inc.php, 1.2 class.ui.inc.php, 1.4 class.bo.inc.php, 1.4 class.so.inc.php, 1.3, skwashd, 2005/05/17
- Prev by Date:
[Phpgroupware-cvs] calendar/templates/idsociety header.inc.php, 1.29
- Next by Date:
[Phpgroupware-cvs] calendar/help/JA calendar.php, 1.5 add.php, 1.5 edit_delete.php, 1.5 view.php, 1.5
- Previous by thread:
[Phpgroupware-cvs] javassh/inc hook_admin.inc.php, 1.3 class.ui_jssh.inc.php, 1.2 hook_sidebox_menu.inc.php, 1.2 class.so_jssh.inc.php, 1.2 class.bo_jssh.inc.php, 1.2 class.ui.inc.php, 1.4 class.bo.inc.php, 1.4 class.so.inc.php, 1.3
- Next by thread:
[Phpgroupware-cvs] javassh/inc hook_admin.inc.php, 1.3 class.ui_jssh.inc.php, 1.2 hook_sidebox_menu.inc.php, 1.2 class.so_jssh.inc.php, 1.2 class.bo_jssh.inc.php, 1.2 class.ui.inc.php, 1.4 class.bo.inc.php, 1.4 class.so.inc.php, 1.3
- Index(es):