update to use xslt

This commit is contained in:
ceb 2002-10-03 21:38:11 +00:00
parent b5abff2679
commit f684ccd732
4 changed files with 95 additions and 91 deletions

View File

@ -20,13 +20,10 @@
$portalbox = CreateObject('phpgwapi.listbox',
Array(
'title' => '<font color="#FFFFFF">'.lang('Infolog').'</font>',
'primary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'secondary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'tertiary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'],
'title' => lang('Infolog'),
'width' => '100%',
'outerborderwidth' => '0',
'header_background_image' => $GLOBALS['phpgw']->common->image('phpgwapi/templates/phpgw_website','bg_filler')
'header_background_image' => $GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler')
)
);
@ -50,9 +47,12 @@
$GLOBALS['HTTP_POST_VARS']['filter'] = $GLOBALS['filter'] = 'own-open-today';
$infolog = CreateObject('infolog.uiinfolog');
echo "\n".'<!-- BEGIN infolog info -->'."\n".
/*echo "\n".'<!-- BEGIN infolog info -->'."\n".
$portalbox->draw($infolog->get_list(2))."\n".
'<!-- END infolog info -->'."\n";
*/
$GLOBALS['phpgw']->template->set_var('phpgw_body',$portalbox->draw(),True);
unset($infolog);
$GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;

View File

@ -1,28 +1,27 @@
<?php
/**************************************************************************\
* phpGroupWare API - Link box generator *
* http://www.phpgroupware.org/api *
* This file written by Mark Peters <skeeter@phpgroupware.org> *
* Creates listboxes using templates *
* Copyright (C) 2000, 2001 Mark Peters *
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, *
* or any later version. *
* This library 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 Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
/**************************************************************************\
* phpGroupWare API - Link box generator *
* http://www.phpgroupware.org/api *
* Written by Mark Peters <skeeter@phpgroupware.org> *
* Creates listboxes using templates *
* Copyright (C) 2000 - 2002 Mark Peters *
* ------------------------------------------------------------------------ *
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, *
* or any later version. *
* This library 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 Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
CreateObject('phpgwapi.portalbox');
@ -70,20 +69,22 @@
{
if(count($this->data))
{
$this->p->parse('row','portal_listbox_header',True);
for ($x = 0; $x < count($this->data); $x++)
{
$var = Array(
'text' => $this->data[$x]['text'],
'link' => $this->data[$x]['link']
$var = array
(
'text' => $this->data[$x]['text'],
'link' => $this->data[$x]['link'],
'lang_link_statustext' => $this->data[$x]['lang_link_statustext']
);
$this->output['portal_row'] = array
(
'listbox' => $var
);
$this->p->set_var($var);
$this->p->parse('row','portal_listbox_link',True);
}
$this->p->parse('row','portal_listbox_footer',True);
}
$this->set_internal($extra_data);
return $this->draw_box();
}
}
?>

View File

@ -1,27 +1,26 @@
<?php
/**************************************************************************\
* phpGroupWare API - Portal Box manager *
* This file written by Joseph Engo <jengo@phpgroupware.org> *
* Helps manage the portal boxes for phpGroupWares main page *
* Copyright (C) 2000, 2001 Joseph Engo *
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, *
* or any later version. *
* This library 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 Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
/**************************************************************************\
* phpGroupWare API - Portal Box manager *
* Written by Joseph Engo <jengo@phpgroupware.org> *
* Helps manage the portal boxes for phpGroupWares main page *
* Copyright (C) 2000 - 2002 Joseph Engo *
* ------------------------------------------------------------------------ *
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, *
* or any later version. *
* This library 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 Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
class portalbox
{
@ -39,7 +38,8 @@
var $close;
var $question;
var $edit;
var $output;
var $data = Array();
// Textual variables
@ -88,37 +88,22 @@
function start_template()
{
$this->p = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('home'));
$this->p->set_file(
array(
'PORTAL' => 'portal.tpl'
)
);
$GLOBALS['phpgw']->xslttpl->add_file(array('portal'));
$this->p->set_block('PORTAL','portal_box','portal_box');
$this->p->set_block('PORTAL','portal_row','portal_row');
$this->p->set_block('PORTAL','portal_listbox_header','portal_listbox_header');
$this->p->set_block('PORTAL','portal_listbox_link','portal_listbox_link');
$this->p->set_block('PORTAL','portal_listbox_footer','portal_listbox_footer');
$this->p->set_block('PORTAL','portal_control','portal_control');
$this->p->set_block('PORTAL','link_field','link_field');
$var = Array(
$this->output = array
(
'outer_border' => $this->getvar('outerborderwidth'),
'outer_width' => $this->getvar('width'),
'title' => $this->getvar('title'),
'inner_width' => $this->getvar('width'),
'header_background_image' => $this->getvar('header_background_image'),
'control_link' => ''
'header_background_image' => $this->getvar('header_background_image')
);
$this->p->set_var($var);
$this->p->set_var('row','',False);
}
function set_controls($control='',$control_param='')
{
// echo '<br>Control: ' . $control . ', control_param="' . $control_param . '"';
// if($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));
@ -129,10 +114,13 @@
{
if($data=='' && !count($this->data))
{
$data = '<td>&nbsp;</td>';
$data = ' ';
}
$this->p->set_var('output',$data);
$this->p->parse('row','portal_row',true);
$this->output['portal_row']['extrabox'] = array
(
'data' => $data
);
}
function draw_box()
@ -140,7 +128,8 @@
$control = '';
if($this->up || $this->down || $this->close || $this->question || $this->edit)
{
$control_array = Array(
$control_array = array
(
'up',
'down',
'question',
@ -157,12 +146,20 @@
{
$image_width = 30;
}
$this->p->set_var('link_field_data','<a href="'.$this->$param.'"><img src="'.$GLOBALS['phpgw']->common->image('phpgwapi',$param.'.button.gif').'" border="0" width="'.$image_width.'" height="15" alt="'.lang($param).'"></a>');
$this->p->parse('control_link','link_field',True);
$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->p->parse('portal_controls','portal_control',True);
$this->output['control_link'] = $control_link;
}
return $this->p->fp('out','portal_box');
$GLOBALS['phpgw']->xslttpl->set_var('portal',$this->output);
return $GLOBALS['phpgw']->xslttpl->parse();
}
}

View File

@ -331,6 +331,9 @@
* These lines load up the templates class and set some default values *
\*************************************************************************/
$GLOBALS['phpgw']->template = CreateObject('phpgwapi.Template',PHPGW_TEMPLATE_DIR);
$GLOBALS['phpgw']->xslttpl = CreateObject('phpgwapi.xslttemplates',PHPGW_TEMPLATE_DIR);
/* load required tpl files */
$GLOBALS['phpgw']->template->set_file('common', 'common.tpl');
$GLOBALS['phpgw']->template->set_file('phpgw', 'phpgw.tpl');
@ -610,6 +613,9 @@
}
$GLOBALS['phpgw']->template->set_root(PHPGW_APP_TPL);
$GLOBALS['phpgw']->xslttpl->set_root(PHPGW_APP_TPL);
$GLOBALS['phpgw']->template->halt_on_error = 'report';
if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) && file_exists(PHPGW_APP_INC . '/functions.inc.php') && !MENUACTION)
{