mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-10-06 02:02:24 +02:00
- Added server side implementation of application sorting
- Filtering "remove"-function from arrays before sending them via json
This commit is contained in:
parent
e5552d1b45
commit
c953709866
@ -507,6 +507,30 @@ abstract class egw_framework
|
|||||||
return egw::link($index,$GLOBALS['egw_info']['flags']['params'][$app]);
|
return egw::link($index,$GLOBALS['egw_info']['flags']['params'][$app]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal usort callback function used to sort an array according to the
|
||||||
|
* user sort order
|
||||||
|
*/
|
||||||
|
private static function _sort_apparray($a, $b)
|
||||||
|
{
|
||||||
|
//Unserialize the user_apporder array
|
||||||
|
$arr = unserialize($GLOBALS['egw_info']['user']['preferences']['common']['user_apporder']);
|
||||||
|
|
||||||
|
$ind_a = isset($arr[$a['name']]) ? $arr[$a['name']] : null;
|
||||||
|
$ind_b = isset($arr[$b['name']]) ? $arr[$b['name']] : null;
|
||||||
|
|
||||||
|
if ($ind_a == $ind_b)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ($ind_a == null)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if ($ind_b == null)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return $ind_a > $ind_b ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare an array with apps used to render the navbar
|
* Prepare an array with apps used to render the navbar
|
||||||
*
|
*
|
||||||
@ -578,6 +602,15 @@ abstract class egw_framework
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Sort the applications accordingly to their user sort setting
|
||||||
|
if ($GLOBALS['egw_info']['user']['preferences']['common']['user_apporder'])
|
||||||
|
{
|
||||||
|
//Sort the application array using the user_apporder array as sort index
|
||||||
|
uasort($apps, 'egw_framework::_sort_apparray');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($GLOBALS['egw_info']['flags']['currentapp'] == 'preferences' || $GLOBALS['egw_info']['flags']['currentapp'] == 'about')
|
if ($GLOBALS['egw_info']['flags']['currentapp'] == 'preferences' || $GLOBALS['egw_info']['flags']['currentapp'] == 'about')
|
||||||
{
|
{
|
||||||
$app = $app_title = 'EGroupware';
|
$app = $app_title = 'EGroupware';
|
||||||
|
@ -87,11 +87,13 @@ function egw_json_encode(input)
|
|||||||
{
|
{
|
||||||
switch (input.constructor)
|
switch (input.constructor)
|
||||||
{
|
{
|
||||||
case Array:
|
case Array:
|
||||||
var buf = [];
|
var buf = [];
|
||||||
for (var k in input)
|
for (var k in input)
|
||||||
{
|
{
|
||||||
buf.push(egw_json_encode(input[k]));
|
//Filter the remove function, which is added to arrays in egw_fw_classes
|
||||||
|
if (k != 'remove')
|
||||||
|
buf.push(egw_json_encode(input[k]));
|
||||||
}
|
}
|
||||||
return '[' + buf.join(',') + ']';
|
return '[' + buf.join(',') + ']';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user