From a61323f98c3449eb8e935446a3c4695b5554dd19 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 12 Jul 2023 15:47:54 -0600 Subject: [PATCH] Disable kanban column if user does not have access to kanban --- addressbook/inc/class.addressbook_ui.inc.php | 12 +++++++++- addressbook/templates/default/index.xet | 2 +- filemanager/inc/class.filemanager_ui.inc.php | 18 +++++++++++---- filemanager/templates/default/index.xet | 2 +- infolog/inc/class.infolog_ui.inc.php | 24 +++++++++++++------- infolog/templates/default/index.xet | 2 +- resources/inc/class.resources_ui.inc.php | 13 ++++++++--- resources/templates/default/show.xet | 2 +- timesheet/inc/class.timesheet_ui.inc.php | 21 ++++++++++++----- timesheet/templates/default/index.xet | 2 +- 10 files changed, 71 insertions(+), 27 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index f2ffc22c4e..e9107dfd88 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -280,7 +280,17 @@ class addressbook_ui extends addressbook_bo if ($_GET['search']) { $content['nm']['search'] = $_GET['search']; } - if (isset($typeselection)) $content['nm']['col_filter']['tid'] = $typeselection; + if(isset($typeselection)) + { + $content['nm']['col_filter']['tid'] = $typeselection; + } + + // disable kanban column if we have no kanban + if(empty($GLOBALS['egw_info']['user']['apps']['kanban'])) + { + $content['nm']['no_kanban'] = true; + } + // save the tid for use in creating new addressbook entrys via UI. Current tid is to be used as type of new entrys //error_log(__METHOD__.__LINE__.' '.$content['nm']['col_filter']['tid']); Api\Cache::setSession('addressbook','active_tid',$content['nm']['col_filter']['tid']); diff --git a/addressbook/templates/default/index.xet b/addressbook/templates/default/index.xet index bfc8009233..ddf3d9bd1d 100644 --- a/addressbook/templates/default/index.xet +++ b/addressbook/templates/default/index.xet @@ -16,7 +16,7 @@ - + diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index 7412c6242e..2239f81f2d 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -410,17 +410,27 @@ class filemanager_ui $content['nm']['actions'] = static::get_actions(); $content['nm']['home_dir'] = static::get_home_dir(); $content['nm']['view'] = $GLOBALS['egw_info']['user']['preferences']['filemanager']['nm_view']; - $content['nm']['placeholder_actions'] = array('mkdir','paste','share','file_drop_mail','file_drop_move','file_drop_copy','file_drop_symlink'); + $content['nm']['placeholder_actions'] = array('mkdir', 'paste', 'share', 'file_drop_mail', 'file_drop_move', + 'file_drop_copy', 'file_drop_symlink'); - if (isset($_GET['msg'])) $msg = $_GET['msg']; + // disable kanban column if we have no kanban + if(empty($GLOBALS['egw_info']['user']['apps']['kanban'])) + { + $content['nm']['no_kanban'] = true; + } + + if(isset($_GET['msg'])) + { + $msg = $_GET['msg']; + } // Blank favorite set via GET needs special handling for path - if (isset($_GET['favorite']) && $_GET['favorite'] == 'blank') + if(isset($_GET['favorite']) && $_GET['favorite'] == 'blank') { $content['nm']['path'] = static::get_home_dir(); } // switch to projectmanager folders - if (isset($_GET['pm_id'])) + if(isset($_GET['pm_id'])) { $_GET['path'] = '/apps/projectmanager'.((int)$_GET['pm_id'] ? '/'.(int)$_GET['pm_id'] : ''); } diff --git a/filemanager/templates/default/index.xet b/filemanager/templates/default/index.xet index 5f286f3050..b2417a307b 100644 --- a/filemanager/templates/default/index.xet +++ b/filemanager/templates/default/index.xet @@ -15,7 +15,7 @@ - + diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 9f23dd75bc..d933ceb64b 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -998,16 +998,24 @@ class infolog_ui $readonlys['cancel'] = $action != 'sp'; $this->tmpl->read('infolog.index'); - $values['nm']['disable_autorefresh'] = true; // we have push + $values['nm']['disable_autorefresh'] = true; // we have push + + // disable kanban column if we have no kanban + if(empty($GLOBALS['egw_info']['user']['apps']['kanban'])) + { + $values['nm']['no_kanban'] = true; + } + $values['nm']['options-filter'] = $this->filters; $values['nm']['get_rows'] = 'infolog.infolog_ui.get_rows'; $values['nm']['add_on_top_sort_field'] = 'info_datemodified'; - $values['nm']['options-filter2'] = (in_array($this->prefs['show_links'],array('all','no_describtion')) ? array() : array( - '' => 'default', - )) + array( - 'no_describtion' => 'no details', - 'all' => 'details', - ); + $values['nm']['options-filter2'] = (in_array($this->prefs['show_links'], array('all', + 'no_describtion')) ? array() : array( + '' => 'default', + )) + array( + 'no_describtion' => 'no details', + 'all' => 'details', + ); //apply infolog_filter_change javascript method (hide/show of date filter form) over onchange filter $values['nm']['filter_onchange'] = "app.infolog.filter_change();"; @@ -1016,7 +1024,7 @@ class infolog_ui $values['nm']['filter2_onchange'] = "return app.infolog.filter2_change(ev, widget)"; // disable favories dropdown button, if not running as infolog - if ($called_as && $called_as != 'infolog') + if($called_as && $called_as != 'infolog') { $values['nm']['favorites'] = false; } diff --git a/infolog/templates/default/index.xet b/infolog/templates/default/index.xet index 255f3c9f98..492a2aff48 100644 --- a/infolog/templates/default/index.xet +++ b/infolog/templates/default/index.xet @@ -16,7 +16,7 @@ - + diff --git a/resources/inc/class.resources_ui.inc.php b/resources/inc/class.resources_ui.inc.php index 1bbef26ef7..94218251e2 100755 --- a/resources/inc/class.resources_ui.inc.php +++ b/resources/inc/class.resources_ui.inc.php @@ -140,16 +140,23 @@ class resources_ui $content['nm']['options-filter2'][resources_bo::DELETED] = lang('Deleted'); } - if($_GET['search']) { + if($_GET['search']) + { $content['nm']['search'] = $_GET['search']; } if($_GET['view_accs_of']) { $content['nm']['filter2'] = (int)$_GET['view_accs_of']; } - $content['nm']['actions'] = $this->get_actions(); + $content['nm']['actions'] = $this->get_actions(); $content['nm']['placeholder_actions'] = array('add'); + // disable kanban column if we have no kanban + if(empty($GLOBALS['egw_info']['user']['apps']['kanban'])) + { + $content['nm']['no_kanban'] = true; + } + // check if user is permitted to add resources // If they can't read any categories, they won't be able to save it if(!$this->bo->acl->get_cats(Acl::ADD) || !$this->bo->acl->get_cats(Acl::READ)) @@ -159,7 +166,7 @@ class resources_ui $no_button['back'] = true; $GLOBALS['egw_info']['flags']['app_header'] = lang('resources'); - Framework::includeJS('.','resources','resources'); + Framework::includeJS('.', 'resources', 'resources'); if($content['nm']['filter2'] > 0) { diff --git a/resources/templates/default/show.xet b/resources/templates/default/show.xet index 764f2b1eae..31291b24f5 100644 --- a/resources/templates/default/show.xet +++ b/resources/templates/default/show.xet @@ -12,7 +12,7 @@ - + diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index d9c7c55cd6..162053850a 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -1015,17 +1015,26 @@ class timesheet_ui extends timesheet_bo { $content['nm']['col_filter']['linked'] = array( 'app' => $_GET['link_app'], - 'id' => $_GET['link_id'] + 'id' => $_GET['link_id'] ); } + // disable kanban column if we have no kanban + if(empty($GLOBALS['egw_info']['user']['apps']['kanban'])) + { + $content['nm']['no_kanban'] = true; + } $read_grants = $this->grant_list(Acl::READ); $content['nm']['no_owner_col'] = count($read_grants) == 1; - if ($GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']) $content['nm']['selectcols'] = $GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']; + if($GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']) + { + $content['nm']['selectcols'] = $GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']; + } $sel_options = array( - 'ts_owner' => $read_grants, - 'pm_id' => array(lang('No project')), - 'cat_id' => array(array('value' => '', 'label' => lang('all categories')), array('value' => 0, 'label'=>lang('None'))), - 'ts_status' => $this->status_labels+array(lang('No status')), + 'ts_owner' => $read_grants, + 'pm_id' => array(lang('No project')), + 'cat_id' => array(array('value' => '', 'label' => lang('all categories')), + array('value' => 0, 'label' => lang('None'))), + 'ts_status' => $this->status_labels + array(lang('No status')), ); if($this->config_data['history']) { diff --git a/timesheet/templates/default/index.xet b/timesheet/templates/default/index.xet index 1f3be64c9c..f4d6e31fc8 100644 --- a/timesheet/templates/default/index.xet +++ b/timesheet/templates/default/index.xet @@ -27,7 +27,7 @@ - +