addedd javascript support class

This commit is contained in:
Lars Kneschke 2003-08-30 08:44:51 +00:00
parent a4ecc1017c
commit cecef59550
11 changed files with 115 additions and 136 deletions

View File

@ -381,6 +381,7 @@
function check_owner($record,$link,$label,$extravars = '') function check_owner($record,$link,$label,$extravars = '')
{ {
$this->debug_info[] = 'check_owner() is a depreciated function - use ACL instead'; $this->debug_info[] = 'check_owner() is a depreciated function - use ACL instead';
/*
$s = '<a href="' . $GLOBALS['phpgw']->link($link,$extravars) . '"> ' . lang($label) . ' </a>'; $s = '<a href="' . $GLOBALS['phpgw']->link($link,$extravars) . '"> ' . lang($label) . ' </a>';
if (ereg('^[0-9]+$',$record)) if (ereg('^[0-9]+$',$record))
{ {
@ -398,6 +399,7 @@
} }
return $s; return $s;
*/
} }
/*! /*!
@ -665,16 +667,19 @@
return $list; return $list;
} }
/*! /**
@function list_templates * List available templates
@abstract list available templates *
* @returns array alphabetically sorted list of templates
*/ */
function list_templates() function list_templates()
{ {
$d = dir(PHPGW_SERVER_ROOT . '/phpgwapi/templates'); $d = dir(PHPGW_SERVER_ROOT . '/phpgwapi/templates');
while ($entry=$d->read()) while ($entry=$d->read())
{ {
if ($entry != 'CVS' && $entry != '.' && $entry != '..' && $entry != 'phpgw_website' && is_dir(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry)) if ($entry != 'CVS' && $entry != '.' && $entry != '..'
&& $entry != 'phpgw_website'
&& is_dir(PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry))
{ {
$list[$entry]['name'] = $entry; $list[$entry]['name'] = $entry;
$f = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry . '/details.inc.php'; $f = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry . '/details.inc.php';
@ -690,7 +695,7 @@
} }
} }
$d->close(); $d->close();
reset ($list); ksort($list);
return $list; return $list;
} }
@ -1122,38 +1127,96 @@
} }
} }
/**
* Used by template headers for including CSS in the header
*
* This first loads up the basic global CSS definitions, which support
* the selected user theme colors. Next we load up the app CSS. This is
* all merged into the selected theme's css.tpl file.
*
* @author Dave Hall (*based* on verdilak? css inclusion code)
*/
function get_css() function get_css()
{ {
$tpl = createObject('phpgwapi.Template', $this->get_tpl_dir('phpgwapi')); $tpl = createObject('phpgwapi.Template', $this->get_tpl_dir('phpgwapi'));
$tpl->set_file('css', 'css.tpl'); $tpl->set_file('css', 'css.tpl');
$tpl->set_var($GLOBALS['phpgw_info']['theme']); $tpl->set_var($GLOBALS['phpgw_info']['theme']);
$app_css = ''; $app_css = '';
if(@isset($_GET['menuaction']))
if(@isset($GLOBALS['HTTP_GET_VARS']['menuaction'])) {
{ list($app,$class,$method) = explode('.',$_GET['menuaction']);
list($app,$class,$method) = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']); if(is_array($GLOBALS[$class]->public_functions)
if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['css']) && $GLOBALS[$class]->public_functions['css'])
{ {
$app_css .= $GLOBALS[$class]->css(); $app_css .= $GLOBALS[$class]->css();
} }
if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['java_script']) }
{ if (isset($GLOBALS['phpgw_info']['flags']['css']))
$java_script = $GLOBALS[$class]->java_script(); {
} $app_css .= $GLOBALS['phpgw_info']['flags']['css'];
} }
if (isset($GLOBALS['phpgw_info']['flags']['css']))
{
$app_css .= $GLOBALS['phpgw_info']['flags']['css'];
}
$tpl->set_var('app_css', $app_css); $tpl->set_var('app_css', $app_css);
return $tpl->subst('css'); return $tpl->subst('css');
} }
/**
* Used by the template headers for including javascript in the header
*
* The method is included here to make it easier to change the js support
* in phpgw. One change then all templates will support it (as long as they
* include a call to this method).
*
* @author Dave Hall (*vaguely based* on verdilak? css inclusion code)
* @return string the javascript to be included
*/
function get_java_script()
{
$java_script = '';
if(@is_object($GLOBALS['phpgw']->js))
{
$java_script .= $GLOBALS['phpgw']->js->get_script_links();
}
if(@isset($_GET['menuaction']))
{
list($app,$class,$method) = explode('.',$_GET['menuaction']);
if(is_array($GLOBALS[$class]->public_functions)
&& $GLOBALS[$class]->public_functions['java_script'])
{
$java_script .= $GLOBALS[$class]->java_script();
}
}
//you never know - best to protect the stupid ;)
if (isset($GLOBALS['phpgw_info']['flags']['java_script']))
{
$java_script .= $GLOBALS['phpgw_info']['flags']['java_script'] . "\n";
}
return $java_script;
}
/**
* Returns on(Un)Load attributes from js class
*
*@author Dave Hall - skwashd at phpgroupware.org
*@returns string body attributes
*/
function get_body_attribs()
{
if(@is_object($GLOBALS['phpgw']->js))
{
return $GLOBALS['phpgw']->js->get_body_attribs();
}
else
{
return '';
}
}
function hex2bin($data) function hex2bin($data)
{ {
$len = strlen($data); $len = strlen($data);
return pack('H' . $len, $data); return @pack('H' . $len, $data);
} }
/*! /*!

View File

@ -11,20 +11,6 @@
/* $Id$ */ /* $Id$ */
$app_css = $java_script = '';
if(@isset($GLOBALS['HTTP_GET_VARS']['menuaction']))
{
list($app,$class,$method) = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['java_script'])
{
$java_script = $GLOBALS[$class]->java_script();
}
}
if (isset($GLOBALS['phpgw_info']['flags']['java_script']))
{
$java_script .= $GLOBALS['phpgw_info']['flags']['java_script'];
}
$bodyheader = 'BGCOLOR="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'"'; $bodyheader = 'BGCOLOR="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'"';
if ($GLOBALS['phpgw_info']['server']['htmlcompliant']) if ($GLOBALS['phpgw_info']['server']['htmlcompliant'])
{ {
@ -44,9 +30,9 @@
'charset' => lang('charset'), 'charset' => lang('charset'),
'font_family' => $GLOBALS['phpgw_info']['theme']['font'], 'font_family' => $GLOBALS['phpgw_info']['theme']['font'],
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app, 'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app,
'body_tags' => $bodyheader, 'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'css' => $GLOBALS['phpgw']->common->get_css(), 'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script 'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
); );
$tpl->set_var($var); $tpl->set_var($var);
$tpl->pfp('out','head'); $tpl->pfp('out','head');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -11,20 +11,6 @@
/* $Id$ */ /* $Id$ */
$app_css = $java_script = '';
if(@isset($GLOBALS['HTTP_GET_VARS']['menuaction']))
{
list($app,$class,$method) = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['java_script'])
{
$java_script = $GLOBALS[$class]->java_script();
}
}
if (isset($GLOBALS['phpgw_info']['flags']['java_script']))
{
$java_script .= $GLOBALS['phpgw_info']['flags']['java_script'];
}
$bodyheader = ' bgcolor="' . $GLOBALS['phpgw_info']['theme']['bg_color'] . '" alink="' $bodyheader = ' bgcolor="' . $GLOBALS['phpgw_info']['theme']['bg_color'] . '" alink="'
. $GLOBALS['phpgw_info']['theme']['alink'] . '" link="' . $GLOBALS['phpgw_info']['theme']['link'] . '" vlink="' . $GLOBALS['phpgw_info']['theme']['alink'] . '" link="' . $GLOBALS['phpgw_info']['theme']['link'] . '" vlink="'
. $GLOBALS['phpgw_info']['theme']['vlink'] . '"'; . $GLOBALS['phpgw_info']['theme']['vlink'] . '"';
@ -49,13 +35,13 @@
$var = Array ( $var = Array (
'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico', 'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico',
'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico', 'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico',
'charset' => lang('charset'), 'charset' => lang('charset'),
'font_family' => $GLOBALS['phpgw_info']['theme']['font'], 'font_family' => $GLOBALS['phpgw_info']['theme']['font'],
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'].$app, 'website_title' => $GLOBALS['phpgw_info']['server']['site_title'].$app,
'body_tags' => $bodyheader, 'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'theme_css' => $theme_css, 'theme_css' => $theme_css,
'css' => $GLOBALS['phpgw']->common->get_css(), 'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script 'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
); );
$tpl->set_var($var); $tpl->set_var($var);
$tpl->pfp('out','head'); $tpl->pfp('out','head');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -11,20 +11,6 @@
/* $Id$ */ /* $Id$ */
$java_script = '';
if(@isset($GLOBALS['HTTP_GET_VARS']['menuaction']))
{
list($app,$class,$method) = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['java_script'])
{
$java_script = $GLOBALS[$class]->java_script();
}
}
if (isset($GLOBALS['phpgw_info']['flags']['java_script']))
{
$java_script .= $GLOBALS['phpgw_info']['flags']['java_script'];
}
$bodyheader = 'bgcolor="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'" alink="'.$GLOBALS['phpgw_info']['theme']['alink'].'" link="'.$GLOBALS['phpgw_info']['theme']['link'].'" vlink="'.$GLOBALS['phpgw_info']['theme']['vlink'].'"'; $bodyheader = 'bgcolor="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'" alink="'.$GLOBALS['phpgw_info']['theme']['alink'].'" link="'.$GLOBALS['phpgw_info']['theme']['link'].'" vlink="'.$GLOBALS['phpgw_info']['theme']['vlink'].'"';
$app = $GLOBALS['phpgw_info']['flags']['currentapp']; $app = $GLOBALS['phpgw_info']['flags']['currentapp'];
@ -36,12 +22,12 @@
$var = Array ( $var = Array (
'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico', 'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico',
'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico', 'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico',
'charset' => lang('charset'), 'charset' => lang('charset'),
'font_family' => $GLOBALS['phpgw_info']['theme']['font'], 'font_family' => $GLOBALS['phpgw_info']['theme']['font'],
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app, 'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app,
'body_tags' => $bodyheader, 'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'css' => $GLOBALS['phpgw']->common->get_css(), 'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script 'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
); );
$tpl->set_var($var); $tpl->set_var($var);
$tpl->pfp('out','head'); $tpl->pfp('out','head');

View File

@ -11,20 +11,6 @@
/* $Id$ */ /* $Id$ */
$app_css = $java_script = '';
if(@isset($GLOBALS['HTTP_GET_VARS']['menuaction']))
{
list($app,$class,$method) = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['java_script'])
{
$java_script = $GLOBALS[$class]->java_script();
}
}
if (isset($GLOBALS['phpgw_info']['flags']['java_script']))
{
$java_script .= $GLOBALS['phpgw_info']['flags']['java_script'];
}
$bodyheader = 'BGCOLOR="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'"'; $bodyheader = 'BGCOLOR="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'"';
$app = $GLOBALS['phpgw_info']['flags']['currentapp']; $app = $GLOBALS['phpgw_info']['flags']['currentapp'];
@ -38,18 +24,18 @@
'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico', 'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico',
'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico', 'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico',
'webserver_url' => $GLOBALS['phpgw_info']['server']['webserver_url'], 'webserver_url' => $GLOBALS['phpgw_info']['server']['webserver_url'],
'home' => $GLOBALS['phpgw']->link('/index.php'), 'home' => $GLOBALS['phpgw']->link('/index.php'),
'appt' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.day')), 'appt' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.day')),
'todo' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'todo.uitodo.add')), 'todo' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'todo.uitodo.add')),
'prefs' => $GLOBALS['phpgw']->link('/preferences/index.php'), 'prefs' => $GLOBALS['phpgw']->link('/preferences/index.php'),
'email' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'email.uipreferences.preferences')), 'email' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'email.uipreferences.preferences')),
'calendar' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uipreferences.preferences')), 'calendar' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uipreferences.preferences')),
'addressbook' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'addressbook.uiaddressbook.preferences')), 'addressbook' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'addressbook.uiaddressbook.preferences')),
'charset' => lang('charset'), 'charset' => lang('charset'),
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app, 'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app,
'body_tags' => $bodyheader, 'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'css' => $GLOBALS['phpgw']->common->get_css(), 'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script 'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
); );
$tpl->set_var($var); $tpl->set_var($var);
$tpl->pfp('out','head'); $tpl->pfp('out','head');

View File

@ -11,20 +11,6 @@
/* $Id$ */ /* $Id$ */
$java_script = '';
if(@isset($GLOBALS['HTTP_GET_VARS']['menuaction']))
{
list($app,$class,$method) = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['java_script'])
{
$java_script = $GLOBALS[$class]->java_script();
}
}
if (isset($GLOBALS['phpgw_info']['flags']['java_script']))
{
$java_script .= $GLOBALS['phpgw_info']['flags']['java_script'];
}
$bodyheader = 'bgcolor="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'" alink="'.$GLOBALS['phpgw_info']['theme']['alink'].'" link="'.$GLOBALS['phpgw_info']['theme']['link'].'" vlink="'.$GLOBALS['phpgw_info']['theme']['vlink'].'"'; $bodyheader = 'bgcolor="'.$GLOBALS['phpgw_info']['theme']['bg_color'].'" alink="'.$GLOBALS['phpgw_info']['theme']['alink'].'" link="'.$GLOBALS['phpgw_info']['theme']['link'].'" vlink="'.$GLOBALS['phpgw_info']['theme']['vlink'].'"';
if ($fp = @fopen(PHPGW_APP_TPL."/app.css","r")) if ($fp = @fopen(PHPGW_APP_TPL."/app.css","r"))
@ -52,11 +38,11 @@
'charset' => lang('charset'), 'charset' => lang('charset'),
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'], 'website_title' => $GLOBALS['phpgw_info']['server']['site_title'],
'app_name' => $app, 'app_name' => $app,
'body_tags' => $bodyheader, 'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'], 'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'],
'refreshTime' => $refreshTime, 'refreshTime' => $refreshTime,
'css' => $GLOBALS['phpgw']->common->get_css(), 'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script 'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
); );
$tpl->set_var($var); $tpl->set_var($var);
$tpl->pfp('out','head'); $tpl->pfp('out','head');

View File

@ -11,20 +11,6 @@
/* $Id$ */ /* $Id$ */
$app_css = $java_script = '';
if(@isset($GLOBALS['HTTP_GET_VARS']['menuaction']))
{
list($app,$class,$method) = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']);
if(is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions['java_script'])
{
$java_script = $GLOBALS[$class]->java_script();
}
}
if (isset($GLOBALS['phpgw_info']['flags']['java_script']))
{
$java_script .= $GLOBALS['phpgw_info']['flags']['java_script'];
}
$bodyheader = ' bgcolor="' . $GLOBALS['phpgw_info']['theme']['bg_color'] . '" alink="' $bodyheader = ' bgcolor="' . $GLOBALS['phpgw_info']['theme']['bg_color'] . '" alink="'
. $GLOBALS['phpgw_info']['theme']['alink'] . '" link="' . $GLOBALS['phpgw_info']['theme']['link'] . '" vlink="' . $GLOBALS['phpgw_info']['theme']['alink'] . '" link="' . $GLOBALS['phpgw_info']['theme']['link'] . '" vlink="'
. $GLOBALS['phpgw_info']['theme']['vlink'] . '"'; . $GLOBALS['phpgw_info']['theme']['vlink'] . '"';
@ -38,11 +24,11 @@
$var = Array ( $var = Array (
'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico', 'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico',
'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico', 'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico',
'charset' => lang('charset'), 'charset' => lang('charset'),
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app, 'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app,
'body_tags' => $bodyheader, 'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'css' => $GLOBALS['phpgw']->common->get_css(), 'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script 'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
); );
$tpl->set_var($var); $tpl->set_var($var);
$tpl->pfp('out','head'); $tpl->pfp('out','head');