From b8e75460a275aed7cd6b67ac6025c747fb92d73f Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 8 Nov 2005 10:43:49 +0000 Subject: [PATCH] make cats called via sidebox menu of an app, to behave like a part of that app --- preferences/inc/class.bocategories.inc.php | 7 +++---- preferences/inc/class.uicategories.inc.php | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/preferences/inc/class.bocategories.inc.php b/preferences/inc/class.bocategories.inc.php index 758d9068ad..7311ae2f8c 100644 --- a/preferences/inc/class.bocategories.inc.php +++ b/preferences/inc/class.bocategories.inc.php @@ -52,19 +52,18 @@ function save_sessiondata($data, $cats_app) { - $colum = $cats_app . '_cats'; - $GLOBALS['egw']->session->appsession('session_data',$column,$data); + $GLOBALS['egw']->session->appsession($cats_app . '_cats','preferences',$data); } function read_sessiondata($cats_app) { - $colum = $cats_app . '_cats'; - $data = $GLOBALS['egw']->session->appsession('session_data',$column); + $data = $GLOBALS['egw']->session->appsession($cats_app . '_cats','preferences'); $this->start = $data['start']; $this->query = $data['query']; $this->sort = $data['sort']; $this->order = $data['order']; + $this->referer = $data['referer']; } function get_list($global_cats) diff --git a/preferences/inc/class.uicategories.inc.php b/preferences/inc/class.uicategories.inc.php index 661b32d544..d9875b7b55 100644 --- a/preferences/inc/class.uicategories.inc.php +++ b/preferences/inc/class.uicategories.inc.php @@ -23,6 +23,7 @@ var $sort; var $order; var $cat_id; + var $referer; var $cats_app; @@ -46,6 +47,8 @@ $this->query = $this->bo->query; $this->sort = $this->bo->sort; $this->order = $this->bo->order; + $this->referer = $this->bo->referer; + echo '

'."referer='$this->referer'

\n"; $dir = dir(EGW_SERVER_ROOT.'/phpgwapi/images'); while($file = $dir->read()) @@ -67,7 +70,8 @@ 'start' => $this->start, 'query' => $this->query, 'sort' => $this->sort, - 'order' => $this->order + 'order' => $this->order, + 'referer' => $this->referer, ); $this->bo->save_sessiondata($data,$cats_app); } @@ -108,6 +112,19 @@ $global_cats = get_var('global_cats',array('GET','POST')); $cats_level = get_var('cats_level',array('GET','POST')); + // make categories called via sidebox menu of an app, to behave like a part of that app + list(,$referer) = explode($GLOBALS['egw_info']['server']['webserver_url'],$_SERVER['HTTP_REFERER']); + if (!$referer) $referer = '/preferences/index.php'; + if (!strstr($referer,'menuaction=preferences.uicategories')) + { + $this->referer = $referer; + echo '

'."referer='$this->referer'

\n"; + } + if ($this->referer != '/preferences/index.php') + { + $GLOBALS['egw_info']['flags']['currentapp'] = $cats_app; + } + $link_data = array ( 'menuaction' => 'preferences.uicategories.index', @@ -140,7 +157,7 @@ $GLOBALS['egw']->template->set_var('title_categories',lang('categories for')); $GLOBALS['egw']->template->set_var('lang_app',lang($cats_app)); $GLOBALS['egw']->template->set_var('actionurl',$GLOBALS['egw']->link('/index.php',$link_data)); - $GLOBALS['egw']->template->set_var('doneurl',$GLOBALS['egw']->link('/preferences/index.php')); + $GLOBALS['egw']->template->set_var('doneurl',$GLOBALS['egw']->link($this->referer)); if(!$this->start) {