started updating help system

This commit is contained in:
ceb 2002-11-30 02:02:32 +00:00
parent c6ebdf7193
commit 4fa662a569
5 changed files with 412 additions and 49 deletions

View File

@ -661,7 +661,7 @@
{
$appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
}
if ($appname == 'home' || $appname == 'logout' || $appname == 'login' || $appname == 'about')
if ($appname == 'home' || $appname == 'logout' || $appname == 'login' || $appname == 'about' || $appname == 'help')
{
$appname = 'phpgwapi';
}
@ -1069,7 +1069,14 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
'app_tpl' => $app_tpl
);
$GLOBALS['phpgw']->xslttpl->add_file($this->get_tpl_dir('phpgwapi') . SEP . 'phpgw');
if ($GLOBALS['phpgw_info']['flags']['headonly'] == True)
{
$GLOBALS['phpgw']->xslttpl->add_file($this->get_tpl_dir('phpgwapi','default') . SEP . 'phpgw_header');
}
else
{
$GLOBALS['phpgw']->xslttpl->add_file($this->get_tpl_dir('phpgwapi') . SEP . 'phpgw');
}
$cur_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
@ -1137,15 +1144,15 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$var['about_img_hover'] = $this->image('phpgwapi','question_mark2');
}
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'manual')
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'help')
{
$var['manual_img'] = $this->image('manual','manual');
$var['manual_img_hover'] = $this->image_on('manual','manual','_over');
$var['help_img'] = $this->image('phpgwapi','help');
$var['help_img_hover'] = $this->image_on('phpgwapi','help','_over');
}
else
{
$var['manual_img'] = $this->image_on('manual','manual','_over');
$var['manual_img_hover'] = $this->image('manual','manual');
$var['help_img'] = $this->image_on('phpgwapi','help','_over');
$var['help_img_hover'] = $this->image('phpgwapi','help');
}
$var['logo_img'] = $this->image('phpgwapi','logo2');
@ -1159,7 +1166,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$var['prefs_img'] = $this->image('preferences','preferences-'.($app=='preferences' ? 'red' : 'grey'));
$var['logout_img'] = $this->image('phpgwapi','logout');
$var['about_img'] = $this->image('phpgwapi','about-'.($app=='about' ? 'red' : 'grey'));
$var['manual_img'] = $this->image('manual','help');
$var['help_img'] = $this->image('phpgwapi','help');
$var['greybar'] = $this->image('phpgwapi','greybar');
break;
case 'justweb':
@ -1168,32 +1175,32 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$var['prefs_img'] = $this->image('preferences','tab_prefs');
$var['logout_img'] = $this->image('phpgwapi','tab_logout');
$var['about_img'] = $this->image('phpgwapi','tab_help');
$var['manual_img'] = $this->image('manual','tab_manual');
$var['help_img'] = $this->image('phpgwapi','tab_help');
break;
case 'funkwerk':
$var['about_img'] = '!';
$var['manual_img'] = '?';
$var['help_img'] = '?';
switch ($cur_app)
{
case 'home':
$var['top_css_home'] = 'top_menu_selected';
$var['top_css'] = $var['top_css_prefs'] = $var['top_css_about'] = $var['top_css_manual'] = 'top_menu';
$var['top_css'] = $var['top_css_prefs'] = $var['top_css_about'] = $var['top_css_help'] = 'top_menu';
break;
case 'preferences':
$var['top_css_prefs'] = 'top_menu_selected';
$var['top_css'] = $var['top_css_home'] = $var['top_css_about'] = $var['top_css_manual'] = 'top_menu';
$var['top_css'] = $var['top_css_home'] = $var['top_css_about'] = $var['top_css_help'] = 'top_menu';
break;
case 'about':
$var['top_css_about'] = 'top_menu_selected';
$var['top_css'] = $var['top_css_home'] = $var['top_css_prefs'] = $var['top_css_manual'] = 'top_menu';
$var['top_css'] = $var['top_css_home'] = $var['top_css_prefs'] = $var['top_css_help'] = 'top_menu';
break;
case 'manual':
$var['top_css_manual'] = 'top_menu_selected';
case 'help':
$var['top_css_help'] = 'top_menu_selected';
$var['top_css'] = $var['top_css_home'] = $var['top_css_prefs'] = $var['top_css_about'] = 'top_menu';
break;
default:
$var['top_css'] = $var['top_css_home'] = $var['top_css_prefs'] = $var['top_css_about'] = $var['top_css_manual'] = 'top_menu';
$var['top_css'] = $var['top_css_home'] = $var['top_css_prefs'] = $var['top_css_about'] = $var['top_css_help'] = 'top_menu';
break;
}
break;
@ -1202,7 +1209,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$var['prefs_img'] = $GLOBALS['phpgw_info']['navbar']['preferences']['icon'];
$var['logout_img'] = $GLOBALS['phpgw_info']['navbar']['logout']['icon'];
$var['about_img'] = $GLOBALS['phpgw_info']['navbar']['about']['icon'];
$var['manual_img'] = $GLOBALS['phpgw_info']['navbar']['manual']['icon'];
$var['help_img'] = $GLOBALS['phpgw_info']['navbar']['help']['icon'];
break;
}
@ -1210,19 +1217,19 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$var['prefs_link'] = $GLOBALS['phpgw_info']['navbar']['preferences']['url'];
$var['logout_link'] = $GLOBALS['phpgw_info']['navbar']['logout']['url'];
$var['about_link'] = $GLOBALS['phpgw_info']['navbar']['about']['url'];
$var['manual_link'] = $GLOBALS['phpgw_info']['navbar']['manual']['url'];
$var['help_link'] = $GLOBALS['phpgw_info']['navbar']['help']['url'];
$var['home_title'] = $GLOBALS['phpgw_info']['navbar']['home']['title'];
$var['prefs_title'] = $GLOBALS['phpgw_info']['navbar']['preferences']['title'];
$var['logout_title'] = $GLOBALS['phpgw_info']['navbar']['logout']['title'];
$var['about_title'] = $GLOBALS['phpgw_info']['navbar']['about']['title'];
$var['manual_title'] = $GLOBALS['phpgw_info']['navbar']['manual']['title'];
$var['help_title'] = $GLOBALS['phpgw_info']['navbar']['help']['title'];
$var['home_statustext'] = $GLOBALS['phpgw_info']['navbar']['home']['title'];
$var['prefs_statustext'] = $GLOBALS['phpgw_info']['navbar']['preferences']['title'];
$var['logout_statustext'] = $GLOBALS['phpgw_info']['navbar']['logout']['title'];
$var['about_statustext'] = $GLOBALS['phpgw_info']['navbar']['about']['title'];
$var['manual_statustext'] = $GLOBALS['phpgw_info']['navbar']['manual']['title'];
$var['help_statustext'] = $GLOBALS['phpgw_info']['navbar']['help']['title'];
if (isset($GLOBALS['phpgw_ifo']['navbar']['admin']) && isset($GLOBALS['phpgw_info']['user']['preferences']['common']['show_currentusers']))
{
@ -1249,7 +1256,7 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$app_css = 'left';
}
if ($app != 'home' && $app != 'preferences' && $app != 'about' && $app != 'logout' && $app != 'manual')
if ($app != 'home' && $app != 'preferences' && $app != 'about' && $app != 'logout' && $app != 'help')
{
$var['applications'][] = array
(
@ -1306,26 +1313,16 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$this->msgbox('',False,'phpgw');
}
$var['app_tpl'] = '';
$var['app_tpl'] = '';
$var['current_app'] = $GLOBALS['phpgw_info']['flags']['currentapp'];
switch($GLOBALS['phpgw_info']['flags']['currentapp'])
$menuaction = get_var('menuaction',Array('GET'));
$xslt_app = get_var('xslt_app',Array('GET'));
if ($menuaction && $GLOBALS['phpgw_info']['flags']['xslt_app'])
{
case 'home':
$var['home'] = True;
break;
case 'about':
$var['about'] = True;
break;
default:
$menuaction = get_var('menuaction',Array('GET'));
$xslt_app = get_var('xslt_app',Array('GET'));
if ($menuaction && $GLOBALS['phpgw_info']['flags']['xslt_app'])
{
$app_function = strrchr($menuaction,'.');
$var['app_tpl'] = substr($app_function,1,strlen($app_function));
}
break;
$app_function = strrchr($menuaction,'.');
$var['app_tpl'] = substr($app_function,1,strlen($app_function));
}
$var['lang_powered_by'] = lang('powered by');
@ -1411,10 +1408,10 @@ if (!@is_file(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info'
$GLOBALS['phpgw_info']['navbar']['preferences']['icon'] = $this->image('preferences',Array('navbar','nonav'));
$GLOBALS['phpgw_info']['navbar']['preferences']['icon_hover'] = $this->image_on('preferences',Array('navbar','nonav'),'-over');
$GLOBALS['phpgw_info']['navbar']['manual']['title'] = lang('manual');
$GLOBALS['phpgw_info']['navbar']['manual']['url'] = $GLOBALS['phpgw']->link('/manual/index.php');
$GLOBALS['phpgw_info']['navbar']['manual']['icon'] = $this->image('manual',Array('navbar','nonav'));
$GLOBALS['phpgw_info']['navbar']['manual']['icon_hover'] = $this->image_on('manual',Array('navbar','nonav'),'-over');
$GLOBALS['phpgw_info']['navbar']['help']['title'] = lang('manual');
$GLOBALS['phpgw_info']['navbar']['help']['url'] = $GLOBALS['phpgw']->link('/help.php');
$GLOBALS['phpgw_info']['navbar']['help']['icon'] = $this->image('phpgwapi',Array('help','nonav'));
$GLOBALS['phpgw_info']['navbar']['help']['icon_hover'] = $this->image_on('phpgwapi',Array('help','nonav'),'-over');
if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') //|| $GLOBALS['phpgw_info']['flags']['currentapp'] == 'preferences')
{

View File

@ -0,0 +1,256 @@
<?php
/*******************************************************************\
* phpGroupWare API - help system manager *
* Written by Bettina Gille [ceb@phpgroupware.org] *
* Manager for the phpGroupWare help system *
* Copyright (C) 2002 Bettina Gille *
* ----------------------------------------------------------------- *
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/theapi *
* ----------------------------------------------------------------- *
* This library 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\*******************************************************************/
/* $Id$ */
class help
{
var $lang;
var $app_name;
var $app_id;
var $up;
var $down;
var $close;
var $question;
var $edit;
var $extrabox;
var $xextrabox;
var $listbox;
var $output;
var $data;
var $title;
/* This is the constructor for the object. */
function help($reset = False)
{
$this->lang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
$this->title = '';
$this->app_name = '';
$this->app_id = 0;
$this->up = '';
$this->down = '';
$this->close = '';
$this->question = '';
$this->edit = '';
$this->extrabox = '';
$this->xextrabox = '';
$this->listbox = '';
$this->data = array();
if (!$reset)
{
$this->output = array();
}
$GLOBALS['phpgw']->xslttpl->add_file('help');
}
/*
Use these functions to get and set the values of this
object's variables. This is good OO practice, as it means
that datatype checking can be completed and errors raised accordingly.
*/
function setvar($var,$value='')
{
if ($value=='')
{
global $$var;
$value = $$var;
}
$this->$var = $value;
// echo $var." = ".$this->$var."<br>\n";
}
function getvar($var='')
{
if ($var=='' || !isset($this->$var))
{
echo 'Programming Error: '.$this->getvar('classname').'->getvar('.$var.')!<br>'."\n";
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
exit;
}
//echo "Var = ".$var."<br>\n";
//echo $var." = ".$this->$var."<br>\n";
return $this->$var;
}
function start_template($extra = '')
{
if ($extra && $this->app_name)
{
$GLOBALS['phpgw']->xslttpl->add_file($GLOBALS['phpgw']->common->get_tpl_dir($this->app_name,'default') . SEP . 'extrahelp');
}
}
function set_controls($control='',$control_param='')
{
//echo '<br>Control: ' . $control . ', control_param="' . $control_param . '"';
if($control != '' && is_array($control_param))
{
$this->setvar($control,$GLOBALS['phpgw']->link($control_param['url'],'app='.$control_param['app'].'&control='.$control));
}
}
function set_internal($extra_data = '')
{
if($extra_data !='')
{
$this->extrabox = $extra_data;
}
}
function set_xinternal($extra_data='')
{
if($extra_data !='')
{
$this->xextrabox = $extra_data;
}
}
function draw_box()
{
if($this->up || $this->down || $this->close || $this->question || $this->edit)
{
$control_array = array
(
'up',
'down',
'question',
'close',
'edit'
);
@reset($control_array);
while(list($key,$param) = each($control_array))
{
if(isset($this->$param) && $this->$param)
{
$image_width = 15;
if($param == 'edit')
{
$image_width = 30;
}
$control_link[] = array
(
'param_url' => $this->$param,
'link_img' => $GLOBALS['phpgw']->common->image('phpgwapi',$param.'.button'),
'img_width' => $image_width,
'lang_param_statustext' => lang($param)
);
}
}
$this->output['help_data'][] = array
(
'title' => $this->title,
'control_link' => $control_link,
'listbox' => $this->listbox,
'extrabox' => $this->extrabox,
'xextrabox' => $this->xextrabox
);
}
}
function check_file($file)
{
$check_file = PHPGW_SERVER_ROOT . $file;
if(@is_file($check_file))
{
return $file;
}
else
{
return '';
}
}
function check_help_file($file)
{
$lang = strtoupper($this->lang);
$help_file = $this->check_file('/' . $this->app_name . '/help/'. $lang . '/' . $file);
if($help_file == '')
{
$help_file = $this->check_file('/' . $this->app_name . '/help/EN/' . $file);
}
if ($help_file)
{
return $GLOBALS['phpgw']->link($help_file);
}
return False;
}
/*function display_manual_section($appname,$file)
{
$font = $GLOBALS['phpgw_info']['theme']['font'];
$navbar = $GLOBALS['phpgw_info']['user']['preferences']['common']['navbar_format'];
$lang = strtoupper($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']);
$GLOBALS['treemenu'][] = '..'.($navbar != 'text'?'<img src="'.$GLOBALS['phpgw']->common->image($appname,'navbar').'" border="0" alt="'.ucwords($appname).'">':'').($navbar != 'icons'?'<font face="'.$font.'">'.lang($appname).'</font>':'').'|'.$GLOBALS['phpgw']->link('/'.$appname.'/help/index.php');
$help_file = check_help_file($appname,$lang,$appname.'.php');
if($help_file != '')
{
$GLOBALS['treemenu'][] = '...<font face="'.$font.'">'.lang('Overview').'</font>|'.$GLOBALS['phpgw']->link($help_file);
}
while(list($title,$filename) = each($file))
{
$help_file = check_help_file($appname,$lang,$filename);
if($help_file != '')
{
$GLOBALS['treemenu'][] = '...<font face="'.$font.'">'.lang($title).'</font>|'.$GLOBALS['phpgw']->link($help_file);
}
}
}
function show_menu($expandlevels)
{
$menutree = CreateObject('phpgwapi.menutree','text');
$menutree->set_lcs(300);
$str = '<table cellpadding="10" width="20%"><td>';
$str .= '<font face="'.$GLOBALS['phpgw_info']['theme']['font'].'" size="2">';
$str .= 'Note: Some of this information is out of date<br>';
$GLOBALS['treemenu'] = Array();
$GLOBALS['phpgw']->hooks->process('manual',array('manual','preferences'));
reset($GLOBALS['treemenu']);
$str .= $menutree->showtree($GLOBALS['treemenu'],$expandlevels).'</td></table>';
return $str;
}*/
}
?>

View File

@ -0,0 +1,113 @@
<?php
/*******************************************************************\
* phpGroupWare API - help system manager *
* Written by Bettina Gille [ceb@phpgroupware.org] *
* Manager for the phpGroupWare help system *
* Copyright (C) 2002 Bettina Gille *
* ----------------------------------------------------------------- *
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/theapi *
* ----------------------------------------------------------------- *
* This library 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\*******************************************************************/
/* $Id$ */
require_once('class.help.inc.php');
class help_helper extends help
{
function help_helper()
{
$this->help();
}
function set_params($param)
{
$this->help(True);
@reset($param);
while(list($key,$value) = each($param))
{
if($key != 'title')
{
//echo 'Setting '.$key.':'.$value."<br>\n";
$this->setvar($key,$value);
}
}
$this->title = $param['title'];
if($param['app_id'])
{
$app_id = $this->getvar('app_id');
$var = Array
(
'up' => Array('url' => '/set_box.php', 'app' => $app_id),
'down' => Array('url' => '/set_box.php', 'app' => $app_id),
'close' => Array('url' => '/set_box.php', 'app' => $app_id),
'question' => Array('url' => '/set_box.php', 'app' => $app_id),
'edit' => Array('url' => '/set_box.php', 'app' => $app_id)
);
while(list($key,$value) = each($var))
{
$this->set_controls($key,$value);
}
}
}
function draw($extra_data='')
{
if(is_array($this->data) && !empty($this->data))
{
for ($x = 0; $x < count($this->data); $x++)
{
$var[] = array
(
'text' => $this->data[$x]['text'],
'link' => $this->data[$x]['link'],
'lang_link_statustext' => $this->data[$x]['lang_link_statustext']
);
}
$this->listbox = $var;
}
$this->set_internal($extra_data);
$this->draw_box();
}
function xdraw($extra_data='')
{
if ($extra_data)
{
$this->start_template(True);
}
if(is_array($this->data) && !empty($this->data))
{
for ($x = 0; $x < count($this->data); $x++)
{
$var[] = array
(
'text' => $this->data[$x]['text'],
'link' => $this->data[$x]['link'],
'lang_link_statustext' => $this->data[$x]['lang_link_statustext']
);
}
$this->listbox = $var;
}
$this->set_xinternal($extra_data);
$this->draw_box();
}
}
?>

View File

@ -86,7 +86,6 @@
*/
function draw($extra_data='')
{
$this->start_template();
if(is_array($this->data) && !empty($this->data))
{
for ($x = 0; $x < count($this->data); $x++)
@ -110,10 +109,7 @@
{
$this->start_template(True);
}
else
{
$this->start_template();
}
if(is_array($this->data) && !empty($this->data))
{
for ($x = 0; $x < count($this->data); $x++)

View File

@ -370,7 +370,8 @@
$continue_app_data = True;
if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'preferences' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'help')
{
// This will need to use ACL in the future
if (! $GLOBALS['phpgw_info']['user']['apps'][$GLOBALS['phpgw_info']['flags']['currentapp']] ||