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 = '')
{
$this->debug_info[] = 'check_owner() is a depreciated function - use ACL instead';
/*
$s = '<a href="' . $GLOBALS['phpgw']->link($link,$extravars) . '"> ' . lang($label) . ' </a>';
if (ereg('^[0-9]+$',$record))
{
@ -398,6 +399,7 @@
}
return $s;
*/
}
/*!
@ -665,16 +667,19 @@
return $list;
}
/*!
@function list_templates
@abstract list available templates
/**
* List available templates
*
* @returns array alphabetically sorted list of templates
*/
function list_templates()
{
$d = dir(PHPGW_SERVER_ROOT . '/phpgwapi/templates');
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;
$f = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry . '/details.inc.php';
@ -690,7 +695,7 @@
}
}
$d->close();
reset ($list);
ksort($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()
{
$tpl = createObject('phpgwapi.Template', $this->get_tpl_dir('phpgwapi'));
$tpl->set_file('css', 'css.tpl');
$tpl->set_var($GLOBALS['phpgw_info']['theme']);
$app_css = '';
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['css'])
{
$app_css .= $GLOBALS[$class]->css();
}
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']['css']))
{
$app_css .= $GLOBALS['phpgw_info']['flags']['css'];
}
if(@isset($_GET['menuaction']))
{
list($app,$class,$method) = explode('.',$_GET['menuaction']);
if(is_array($GLOBALS[$class]->public_functions)
&& $GLOBALS[$class]->public_functions['css'])
{
$app_css .= $GLOBALS[$class]->css();
}
}
if (isset($GLOBALS['phpgw_info']['flags']['css']))
{
$app_css .= $GLOBALS['phpgw_info']['flags']['css'];
}
$tpl->set_var('app_css', $app_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)
{
$len = strlen($data);
return pack('H' . $len, $data);
return @pack('H' . $len, $data);
}
/*!

View File

@ -11,20 +11,6 @@
/* $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'].'"';
if ($GLOBALS['phpgw_info']['server']['htmlcompliant'])
{
@ -44,9 +30,9 @@
'charset' => lang('charset'),
'font_family' => $GLOBALS['phpgw_info']['theme']['font'],
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app,
'body_tags' => $bodyheader,
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script
'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
);
$tpl->set_var($var);
$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$ */
$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="'
. $GLOBALS['phpgw_info']['theme']['alink'] . '" link="' . $GLOBALS['phpgw_info']['theme']['link'] . '" vlink="'
. $GLOBALS['phpgw_info']['theme']['vlink'] . '"';
@ -49,13 +35,13 @@
$var = Array (
'img_icon' => 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'],
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'].$app,
'body_tags' => $bodyheader,
'theme_css' => $theme_css,
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script
'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'theme_css' => $theme_css,
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
);
$tpl->set_var($var);
$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$ */
$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'].'"';
$app = $GLOBALS['phpgw_info']['flags']['currentapp'];
@ -36,12 +22,12 @@
$var = Array (
'img_icon' => 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'],
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'] . $app,
'body_tags' => $bodyheader,
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script
'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
);
$tpl->set_var($var);
$tpl->pfp('out','head');

View File

@ -11,20 +11,6 @@
/* $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'].'"';
$app = $GLOBALS['phpgw_info']['flags']['currentapp'];
@ -38,18 +24,18 @@
'img_icon' => PHPGW_IMAGES_DIR . '/favicon.ico',
'img_shortcut' => PHPGW_IMAGES_DIR . '/favicon.ico',
'webserver_url' => $GLOBALS['phpgw_info']['server']['webserver_url'],
'home' => $GLOBALS['phpgw']->link('/index.php'),
'appt' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.day')),
'todo' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'todo.uitodo.add')),
'prefs' => $GLOBALS['phpgw']->link('/preferences/index.php'),
'email' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'email.uipreferences.preferences')),
'calendar' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uipreferences.preferences')),
'home' => $GLOBALS['phpgw']->link('/index.php'),
'appt' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.day')),
'todo' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'todo.uitodo.add')),
'prefs' => $GLOBALS['phpgw']->link('/preferences/index.php'),
'email' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'email.uipreferences.preferences')),
'calendar' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uipreferences.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,
'body_tags' => $bodyheader,
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script
'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
);
$tpl->set_var($var);
$tpl->pfp('out','head');

View File

@ -11,20 +11,6 @@
/* $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'].'"';
if ($fp = @fopen(PHPGW_APP_TPL."/app.css","r"))
@ -52,11 +38,11 @@
'charset' => lang('charset'),
'website_title' => $GLOBALS['phpgw_info']['server']['site_title'],
'app_name' => $app,
'body_tags' => $bodyheader,
'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'],
'refreshTime' => $refreshTime,
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
);
$tpl->set_var($var);
$tpl->pfp('out','head');

View File

@ -11,20 +11,6 @@
/* $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="'
. $GLOBALS['phpgw_info']['theme']['alink'] . '" link="' . $GLOBALS['phpgw_info']['theme']['link'] . '" vlink="'
. $GLOBALS['phpgw_info']['theme']['vlink'] . '"';
@ -38,11 +24,11 @@
$var = Array (
'img_icon' => 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,
'body_tags' => $bodyheader,
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $java_script
'body_tags' => $bodyheader . $GLOBALS['phpgw']->common->get_body_attribs(),
'css' => $GLOBALS['phpgw']->common->get_css(),
'java_script' => $GLOBALS['phpgw']->common->get_java_script(),
);
$tpl->set_var($var);
$tpl->pfp('out','head');