forked from extern/egroupware
added msgbox and now have templates class auto add the navbar values
This commit is contained in:
parent
cf2a12ba1c
commit
88f19d299d
@ -49,9 +49,9 @@
|
||||
* root: template directory.
|
||||
* unknowns: how to handle unknown variables.
|
||||
*/
|
||||
function Template($root = '.', $unknowns = 'remove', $print = False)
|
||||
function Template($root = '.', $unknowns = 'remove')
|
||||
{
|
||||
if ($print)
|
||||
if(@isset($GLOBALS['phpgw_info']['flags']['printview']) && $GLOBALS['phpgw_info']['flags']['printview'] == True)
|
||||
{
|
||||
$this->print = True;
|
||||
}
|
||||
@ -62,6 +62,20 @@
|
||||
$this->set_file('common', 'common.tpl');
|
||||
}
|
||||
|
||||
/* This covers setting the theme values so that each app doesnt have to */
|
||||
$theme_data = $GLOBALS['phpgw_info']['theme'];
|
||||
unset($theme_data['css']);
|
||||
$this->set_var($theme_data);
|
||||
unset($theme_data);
|
||||
$this->update_css();
|
||||
|
||||
/* Now move on to loading up the requested template set */
|
||||
$this->set_root($root);
|
||||
$this->set_unknowns($unknowns);
|
||||
}
|
||||
|
||||
function update_css()
|
||||
{
|
||||
if(@is_array($GLOBALS['phpgw_info']['theme']['css']))
|
||||
{
|
||||
reset($GLOBALS['phpgw_info']['theme']['css']);
|
||||
@ -74,12 +88,8 @@
|
||||
//$css_string .= '</STYLE>'."\n";
|
||||
$this->set_var('phpgw_css',$css_string);
|
||||
}
|
||||
|
||||
/* Now move on to loading up the requested template set */
|
||||
$this->set_root($root);
|
||||
$this->set_unknowns($unknowns);
|
||||
}
|
||||
|
||||
|
||||
/* public: setroot(pathname $root)
|
||||
* root: new template directory.
|
||||
*/
|
||||
|
@ -966,6 +966,92 @@
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@function msgbox
|
||||
@abstract Generate a consistant msgbox for app apps to use
|
||||
@discussion makes it easier and more consistant to generate message boxes
|
||||
*/
|
||||
|
||||
function msgbox($text='',$type=True,$output='return')
|
||||
{
|
||||
if ($text=='' && @isset($GLOBALS['phpgw_info']['flags']['msgbox_data']))
|
||||
{
|
||||
$text = $GLOBALS['phpgw_info']['flags']['msgbox_data'];
|
||||
unset($GLOBALS['phpgw_info']['flags']['msgbox_data']);
|
||||
}
|
||||
elseif($text=='')
|
||||
{
|
||||
return;
|
||||
}
|
||||
$GLOBALS['phpgw']->template->set_block('common','msgbox_start');
|
||||
$GLOBALS['phpgw']->template->set_block('common','msgbox_row');
|
||||
$GLOBALS['phpgw']->template->set_block('common','msgbox_end');
|
||||
$GLOBALS['phpgw']->template->fp('msgbox','msgbox_start');
|
||||
|
||||
if (is_array($text))
|
||||
{
|
||||
reset($text);
|
||||
$row = 1;
|
||||
while (list($key,$value) = each($text))
|
||||
{
|
||||
if ($value == True)
|
||||
{
|
||||
$type_img = 'good';
|
||||
$type_img_alt = 'O';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type_img = 'bad';
|
||||
$type_img_alt = 'X';
|
||||
}
|
||||
if ($row == 1)
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('msgbox_row_color',$GLOBALS['phpgw_info']['theme']['row_on']);
|
||||
$row = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['phpgw']->template->set_var('msgbox_row_color',$GLOBALS['phpgw_info']['theme']['row_off']);
|
||||
$row = 1;
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('msgbox_text',$key);
|
||||
$GLOBALS['phpgw']->template->set_var('msgbox_img',$type_img);
|
||||
$GLOBALS['phpgw']->template->set_var('msgbox_img_alt',$type_img_alt);
|
||||
$GLOBALS['phpgw']->template->fp('msgbox','msgbox_row',True);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type == True)
|
||||
{
|
||||
$type_img = 'good';
|
||||
$type_img_alt = 'O';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type_img = 'bad';
|
||||
$type_img_alt = 'X';
|
||||
}
|
||||
$GLOBALS['phpgw']->template->set_var('msgbox_row_color',$GLOBALS['phpgw_info']['theme']['row_on']);
|
||||
$GLOBALS['phpgw']->template->set_var('msgbox_text',$text);
|
||||
$GLOBALS['phpgw']->template->set_var('msgbox_img',$type_img);
|
||||
$GLOBALS['phpgw']->template->set_var('msgbox_img_alt',$type_img_alt);
|
||||
$GLOBALS['phpgw']->template->fp('msgbox','msgbox_row',True);
|
||||
}
|
||||
$GLOBALS['phpgw']->template->fp('msgbox','msgbox_end',True);
|
||||
|
||||
if($output == 'out')
|
||||
{
|
||||
$GLOBALS['phpgw']->template->pfp('out', 'msgbox');
|
||||
return;
|
||||
}
|
||||
else /* covers the default of 'return' */
|
||||
{
|
||||
return $GLOBALS['phpgw']->template->varvals['msgbox'];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@function navbar
|
||||
@abstract Build the application navigation bar based on user's accessible applications
|
||||
@ -1100,8 +1186,8 @@
|
||||
//}
|
||||
if (!@$GLOBALS['phpgw_info']['flags']['noheader'] && !@$GLOBALS['phpgw_info']['flags']['nonavbar'])
|
||||
{
|
||||
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Access not permitted']=False;
|
||||
$GLOBALS['phpgw']->hooks->process('after_navbar');
|
||||
//echo '<table><tr><td>msgbox goes here</td></tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,11 +440,10 @@
|
||||
(@$GLOBALS['phpgw_info']['flags']['admin_only'] &&
|
||||
! $GLOBALS['phpgw_info']['user']['apps']['admin']))
|
||||
{
|
||||
$GLOBALS['phpgw']->common->phpgw_header(False, False);
|
||||
|
||||
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access %1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
|
||||
|
||||
echo '<p><center><b>'.lang('Access not permitted').'</b></center>';
|
||||
$GLOBALS['phpgw_info']['flags']['msgbox_data']['Access not permitted']=False;
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
$GLOBALS['phpgw']->common->phpgw_exit(True);
|
||||
}
|
||||
}
|
||||
|
@ -3,22 +3,25 @@
|
||||
<!-- END optionlist -->
|
||||
|
||||
<!-- BEGIN submit_button -->
|
||||
<input tabindex="{button_tabindex}" class="phpgw_buttontext" type="submit" value="{button_value}" name="{button_name}">
|
||||
<input tabindex="{button_tabindex}" type="submit" value="{button_value}" name="{button_name}">
|
||||
<!-- END submit_button -->
|
||||
|
||||
<!-- BEGIN msgbox_start -->
|
||||
<CENTER><TABLE border=1 bgcolor="{row_on}">
|
||||
<!-- END msgbox_start -->
|
||||
|
||||
<!-- BEGIN msgbox_row -->
|
||||
<TR><TD bgcolor="{msgbox_row_color}">[{msgbox_img_alt}] {msgbox_text}</TD></TR>
|
||||
<!-- END msgbox_row -->
|
||||
|
||||
<!-- BEGIN msgbox_end -->
|
||||
</TABLE></CENTER>
|
||||
<!-- END msgbox_end -->
|
||||
|
||||
<!-- BEGIN border_top_nohead -->
|
||||
<table border="0" cellspacing="0" cellpadding="0" width="{border_top_width}">
|
||||
<tr>
|
||||
<td width="5" height="5"><img src="/images/borders/topleft.png"></td>
|
||||
<td background="/images/borders/top.png"><img src="/images/borders/pixel.gif"></td>
|
||||
<td width="5" height="5"><img src="/images/borders/topright.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="5" background="/images/borders/leftside.png"><img src="/images/borders/pixel.gif"></td>
|
||||
<td bgcolor="{grey1}">
|
||||
<table border="0" cellspacing="2" cellpadding="2" width="100%">
|
||||
<tr>
|
||||
<td bgcolor="{grey1}">
|
||||
<td bgcolor="{row_on}">
|
||||
<!-- END border_top_nohead -->
|
||||
|
||||
<!-- BEGIN border_top -->
|
||||
@ -36,7 +39,7 @@
|
||||
<td bgcolor="{headerB}" class="phpgw_whitetext">{border_header_text}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="{grey1}">
|
||||
<td bgcolor="{row_on}">
|
||||
<!-- END border_top -->
|
||||
|
||||
<!-- BEGIN border_bottom -->
|
||||
|
@ -1,24 +1,15 @@
|
||||
<!-- BEGIN navbar -->
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr bgcolor="{navbar_color}">
|
||||
<td align="left"> </td>
|
||||
{applications}
|
||||
<td align="left" nowrap>{user_info}</td>
|
||||
<td align="right">{applications}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
{powered_by}
|
||||
</td>
|
||||
<td align="left">{powered_by}</td>
|
||||
<td align="right">{current_users}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2">
|
||||
{user_info}
|
||||
</td>
|
||||
<td align="right">
|
||||
{current_users}
|
||||
</td>
|
||||
</tr>
|
||||
</table><p>
|
||||
</table>
|
||||
<center>{messages}</center>
|
||||
<!-- END navbar -->
|
||||
|
Loading…
Reference in New Issue
Block a user