2001-10-19 03:46:03 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
2004-08-21 17:39:30 +02:00
|
|
|
* eGroupWare *
|
|
|
|
* http://www.egroupware.org *
|
2001-10-19 03:46:03 +02:00
|
|
|
* The file written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2005-07-08 07:00:14 +02:00
|
|
|
$GLOBALS['egw_info']['flags'] = Array(
|
|
|
|
'noheader' => True,
|
|
|
|
'nofooter' => True,
|
|
|
|
'currentapp' => 'home'
|
2001-10-19 03:46:03 +02:00
|
|
|
);
|
|
|
|
include('header.inc.php');
|
|
|
|
|
|
|
|
// if(basename($HTTP_REFERER) != 'home.php')
|
|
|
|
// {
|
2005-07-08 07:00:14 +02:00
|
|
|
// Header('Location: '.$GLOBALS['egw']->link('/home.php'));
|
|
|
|
// $GLOBALS['egw']->common->phpgw_exit();
|
2001-10-19 03:46:03 +02:00
|
|
|
// }
|
|
|
|
|
2005-07-08 07:00:14 +02:00
|
|
|
@reset($GLOBALS['egw_info']['user']['preferences']);
|
|
|
|
//_debug_array($GLOBALS['egw_info']['user']['preferences']['portal_order']);
|
|
|
|
// $GLOBALS['egw']->preferences->delete('portal_order');
|
|
|
|
// unset($GLOBALS['egw_info']['user']['preferences']['portal_order']);
|
|
|
|
// $GLOBALS['egw']->preferences->save_repository();
|
2001-10-19 03:46:03 +02:00
|
|
|
|
2001-10-23 13:00:50 +02:00
|
|
|
function move_boxes($curr_position,$new_order,$offset,$value_to_check,$max_num)
|
2001-10-19 03:46:03 +02:00
|
|
|
{
|
2003-12-08 07:21:12 +01:00
|
|
|
//echo "MOVE: $curr_position,$new_order,$offset,$value_to_check,$max_num<br>";
|
2005-07-08 07:00:14 +02:00
|
|
|
if(isset($GLOBALS['egw_info']['user']['preferences']['portal_order'][$new_order]))
|
2001-10-23 13:00:50 +02:00
|
|
|
{
|
|
|
|
if($new_order == $max_num)
|
2001-10-19 03:46:03 +02:00
|
|
|
{
|
2001-10-23 13:00:50 +02:00
|
|
|
if($offset < 0)
|
2001-10-19 03:46:03 +02:00
|
|
|
{
|
2005-07-08 07:00:14 +02:00
|
|
|
@ksort($GLOBALS['egw_info']['user']['preferences']['portal_order']);
|
2001-10-19 03:46:03 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-07-08 07:00:14 +02:00
|
|
|
@krsort($GLOBALS['egw_info']['user']['preferences']['portal_order']);
|
2001-10-23 13:00:50 +02:00
|
|
|
}
|
2005-07-08 07:00:14 +02:00
|
|
|
while(list($seq_order,$appid) = each($GLOBALS['egw_info']['user']['preferences']['portal_order']))
|
2001-10-23 13:00:50 +02:00
|
|
|
{
|
|
|
|
if($seq_order != $value_to_check)
|
|
|
|
{
|
|
|
|
$prev_seq = $seq_order + $offset;
|
2005-07-08 07:00:14 +02:00
|
|
|
$GLOBALS['egw']->preferences->delete('portal_order',$prev_seq);
|
|
|
|
$GLOBALS['egw']->preferences->add('portal_order',$prev_seq,$appid);
|
2001-10-23 13:00:50 +02:00
|
|
|
}
|
2001-10-19 03:46:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-07-08 07:00:14 +02:00
|
|
|
$GLOBALS['egw']->preferences->delete('portal_order',$curr_position);
|
|
|
|
$GLOBALS['egw']->preferences->add('portal_order',$curr_position,(int)$GLOBALS['egw_info']['user']['preferences']['portal_order'][$new_order]);
|
2001-10-19 03:46:03 +02:00
|
|
|
}
|
2001-10-23 13:00:50 +02:00
|
|
|
}
|
2005-07-08 07:00:14 +02:00
|
|
|
$GLOBALS['egw']->preferences->delete('portal_order',$new_order);
|
|
|
|
$GLOBALS['egw']->preferences->add('portal_order',$new_order,(int)$_GET['app']);
|
|
|
|
|
|
|
|
$GLOBALS['egw']->preferences->save_repository();
|
2001-10-23 13:00:50 +02:00
|
|
|
}
|
|
|
|
|
2003-10-26 16:55:41 +01:00
|
|
|
//error_reporting(E_ALL);
|
|
|
|
switch($_GET['control'])
|
2001-10-23 13:00:50 +02:00
|
|
|
{
|
2005-07-08 07:00:14 +02:00
|
|
|
//print_debug('set_box', $GLOBALS['egw_info']['user']['preferences']['portal_order']),'app',5);
|
2001-10-23 13:00:50 +02:00
|
|
|
case 'up':
|
2005-07-08 07:00:14 +02:00
|
|
|
$curr_position = $GLOBALS['egw']->common->find_portal_order((int)$_GET['app']);
|
|
|
|
$max_count = count($GLOBALS['egw_info']['user']['preferences']['portal_order']) - 1;
|
2001-10-23 13:00:50 +02:00
|
|
|
$offset = -1;
|
2003-12-08 07:21:12 +01:00
|
|
|
if($curr_position <= 0)
|
2001-10-23 13:00:50 +02:00
|
|
|
{
|
|
|
|
$new_order = $max_count;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$new_order = $curr_position + $offset;
|
|
|
|
}
|
|
|
|
move_boxes($curr_position,$new_order,$offset,0,$max_count);
|
2001-10-19 03:46:03 +02:00
|
|
|
break;
|
|
|
|
case 'down':
|
2005-07-08 07:00:14 +02:00
|
|
|
$curr_position = $GLOBALS['egw']->common->find_portal_order((int)$_GET['app']);
|
|
|
|
$max_count = count($GLOBALS['egw_info']['user']['preferences']['portal_order']) - 1;
|
2001-10-23 13:00:50 +02:00
|
|
|
$offset = 1;
|
2003-12-08 07:21:12 +01:00
|
|
|
if($curr_position >= $max_count)
|
2001-10-23 13:00:50 +02:00
|
|
|
{
|
|
|
|
$new_order = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$new_order = $curr_position + $offset;
|
|
|
|
}
|
|
|
|
move_boxes($curr_position,$new_order,$offset,$max_count,0);
|
|
|
|
break;
|
2001-10-19 03:46:03 +02:00
|
|
|
case 'edit':
|
|
|
|
case 'question':
|
|
|
|
case 'close':
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
2005-07-08 07:00:14 +02:00
|
|
|
header('Location: '.$GLOBALS['egw']->link('/home.php'));
|
|
|
|
$GLOBALS['egw']->common->phpgw_exit();
|
2001-10-19 03:46:03 +02:00
|
|
|
?>
|