mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 15:18:58 +01:00
Fix for non-numeric pref preventing homepage display; Cleanup for appbox layout
This commit is contained in:
parent
da6ba3797f
commit
de7f8f3182
54
home.php
54
home.php
@ -238,8 +238,14 @@
|
|||||||
'news_admin'
|
'news_admin'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//_debug_array($sorted_apps);
|
|
||||||
@reset($sorted_apps);
|
// Now add the rest of the user's apps, to make sure we pick up any additions to the home display
|
||||||
|
@reset($GLOBALS['phpgw_info']['user']['apps']);
|
||||||
|
while (list(,$p) = each($GLOBALS['phpgw_info']['user']['apps']))
|
||||||
|
{
|
||||||
|
$sorted_apps[] = $p['name'];
|
||||||
|
|
||||||
|
}
|
||||||
//$GLOBALS['phpgw']->hooks->process('home',$sorted_apps);
|
//$GLOBALS['phpgw']->hooks->process('home',$sorted_apps);
|
||||||
|
|
||||||
function migrate_pref($appname,$var_old,$var_new,$type='user')
|
function migrate_pref($appname,$var_old,$var_new,$type='user')
|
||||||
@ -275,27 +281,26 @@
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$portal_oldvarnames = array('mainscreen_showevents', 'homeShowEvents','homeShowLatest','mainscreen_showmail','mainscreen_showbirthdays','mainscreen_show_new_updated');
|
$portal_oldvarnames = array('mainscreen_showevents', 'homeShowEvents','homeShowLatest','mainscreen_showmail','mainscreen_showbirthdays','mainscreen_show_new_updated');
|
||||||
$migrate_oldvarnames = false;
|
$migrate_oldvarnames = false;
|
||||||
if($migrate_oldvarnames)
|
if($migrate_oldvarnames)
|
||||||
{
|
{
|
||||||
$_apps = $GLOBALS['phpgw_info']['user']['apps'];
|
$_apps = $GLOBALS['phpgw_info']['user']['apps'];
|
||||||
|
@reset($_apps);
|
||||||
foreach($_apps as $_appname)
|
foreach($_apps as $_appname)
|
||||||
{
|
{
|
||||||
|
@reset($portal_oldvarnames);
|
||||||
foreach($portal_oldvarnames as $varname)
|
foreach($portal_oldvarnames as $varname)
|
||||||
{
|
{
|
||||||
migrate_pref($appname,$varname,'homepage_display','all');
|
//echo "Want to migrate '$appname' from '$varname' to 'homepage_display'.<br>";
|
||||||
|
//migrate_pref($appname,$varname,'homepage_display','all');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$displayapps = $sorted_apps;
|
$neworder = array();
|
||||||
$_myapps = $GLOBALS['phpgw_info']['user']['apps'];
|
$done = array();
|
||||||
foreach($_myapps as $app)
|
|
||||||
{
|
|
||||||
$displayapps[] = $app['name'];
|
|
||||||
}
|
|
||||||
$shown = array();
|
|
||||||
// Display elements, within appropriate table cells
|
// Display elements, within appropriate table cells
|
||||||
print '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
|
print '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
|
||||||
$tropen=0;
|
$tropen=0;
|
||||||
@ -303,9 +308,10 @@
|
|||||||
$lastd = 0;
|
$lastd = 0;
|
||||||
$numcols = 2;
|
$numcols = 2;
|
||||||
$curcol = 1;
|
$curcol = 1;
|
||||||
foreach($displayapps as $appname)
|
@reset($sorted_apps);
|
||||||
|
foreach($sorted_apps as $appname)
|
||||||
{
|
{
|
||||||
if(intval($shown[$appname])==1)
|
if(intval($done[$appname])==1 || empty($appname))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -313,14 +319,25 @@
|
|||||||
$varnames[] = 'homepage_display';
|
$varnames[] = 'homepage_display';
|
||||||
$thisd = 0;
|
$thisd = 0;
|
||||||
foreach($varnames as $varcheck)
|
foreach($varnames as $varcheck)
|
||||||
|
{
|
||||||
|
//echo "$appname:$varcheck=".$GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]."<br>";
|
||||||
|
if($GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]=='True')
|
||||||
|
{
|
||||||
|
$thisd = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$_thisd = intval($GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]);
|
$_thisd = intval($GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]);
|
||||||
if($_thisd>0)
|
if($_thisd>0)
|
||||||
{
|
{
|
||||||
|
//echo "Found $appname=$_thisd through $varcheck<br>";
|
||||||
$thisd = $_thisd;
|
$thisd = $_thisd;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//echo "$appname: $thisd<br>";
|
||||||
if($thisd>0)
|
if($thisd>0)
|
||||||
{
|
{
|
||||||
if((($curcol++>$numcols) || ($thisd+$lastd==3)) && $tropen==1)
|
if((($curcol++>$numcols) || ($thisd+$lastd==3)) && $tropen==1)
|
||||||
@ -337,7 +354,6 @@
|
|||||||
$colspan = ($thisd==2)?'1':'2';
|
$colspan = ($thisd==2)?'1':'2';
|
||||||
print '<td valign="top" colspan="'.$colspan.'" width="'.$tdwidth.'%">';
|
print '<td valign="top" colspan="'.$colspan.'" width="'.$tdwidth.'%">';
|
||||||
$result = $GLOBALS['phpgw']->hooks->single('home',$appname);
|
$result = $GLOBALS['phpgw']->hooks->single('home',$appname);
|
||||||
$shown[$appname] = 1;
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if(($thisd!=2 || ($thisd==2&&$lastd==2)) && $tropen)
|
if(($thisd!=2 || ($thisd==2&&$lastd==2)) && $tropen)
|
||||||
{
|
{
|
||||||
@ -345,20 +361,24 @@
|
|||||||
$curcol = 1;
|
$curcol = 1;
|
||||||
}
|
}
|
||||||
$lastd = $thisd;
|
$lastd = $thisd;
|
||||||
|
$neworder[] = $appname;
|
||||||
}
|
}
|
||||||
|
$done[$appname] = 1;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// Update stored value of order
|
// Update stored value of order
|
||||||
if($GLOBALS['portal_order'])
|
//_debug_array($neworder);
|
||||||
|
if(count($neworder)>0)//$GLOBALS['portal_order'])
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->preferences->delete('portal_order');
|
$GLOBALS['phpgw']->preferences->delete('portal_order');
|
||||||
@reset($GLOBALS['portal_order']);
|
@reset($neworder);
|
||||||
while(list($app_order,$app_id) = each($GLOBALS['portal_order']))
|
while(list($app_order,$app_name) = each($neworder))
|
||||||
{
|
{
|
||||||
|
$app_id = $GLOBALS['phpgw']->applications->name2id($app_name);
|
||||||
$GLOBALS['phpgw']->preferences->add('portal_order',$app_order,$app_id);
|
$GLOBALS['phpgw']->preferences->add('portal_order',$app_order,$app_id);
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->preferences->save_repository();
|
$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->save_repository();
|
||||||
}
|
}
|
||||||
|
|
||||||
//$phpgw->common->debug_phpgw_info();
|
//$phpgw->common->debug_phpgw_info();
|
||||||
|
Loading…
Reference in New Issue
Block a user