From 506702c50b3a547ecce3472031bcdd6ee75c7c4a Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 5 Aug 2011 11:45:12 +0000 Subject: [PATCH] Enhancement: added the capability to filter (based on user's defined preferences the list of organizations displayed in the drop-down menu) SVN:trunk[1423] --- application/itopwebpage.class.inc.php | 15 +- dictionaries/dictionary.itop.ui.php | 4 + dictionaries/fr.dictionary.itop.ui.php | 4 + images/preferences.png | Bin 0 -> 5508 bytes pages/preferences.php | 186 +++++++++++++++++++++++++ 5 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 images/preferences.png create mode 100644 pages/preferences.php diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index c5c6534ca..4027276e1 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -443,11 +443,19 @@ EOF { // List of visible Organizations $iCount = 0; + $oSet = null; if (MetaModel::IsValidClass('Organization')) { + // Display the list of favorite organizations... but keeping in mind what is the real number of organizations + $aFavoriteOrgs = appUserPreferences::GetPref('favorite_orgs', null); $oSearchFilter = new DBObjectSearch('Organization'); $oSet = new CMDBObjectSet($oSearchFilter); - $iCount = $oSet->Count(); + $iCount = $oSet->Count(); // real number of visible orgs + if (!empty($aFavoriteOrgs)) + { + $oSearchFilter->AddCondition('id', $aFavoriteOrgs, 'IN'); + } + $oSet = new CMDBObjectSet($oSearchFilter); // List of favorite orgs } switch($iCount) { @@ -488,9 +496,9 @@ EOF } $sHtml .= ''; */ - $oAllowedValues = new DBObjectSet(DBObjectSearch::FromOQL('SELECT Organization')); + $sFavoriteOrgs = ''; $oWidget = new UIExtKeyWidget('Organization', 'org_id'); - $sHtml .= $oWidget->Display($this, 50, false, '', $oAllowedValues, $iCurrentOrganization, 'org_id', false, 'c[org_id]', '', array('iFieldSize' => 20, 'sDefaultValue' => Dict::S('UI:AllOrganizations')), $bSearchMode = true); + $sHtml .= $oWidget->Display($this, 50, false, '', $oSet, $iCurrentOrganization, 'org_id', false, 'c[org_id]', '', array('iFieldSize' => 20, 'sDefaultValue' => Dict::S('UI:AllOrganizations')), $bSearchMode = true); $this->add_ready_script('$("#org_id").bind("extkeychange", function() { $("#SiloSelection form").submit(); } )'); $this->add_ready_script("$('#label_org_id').click( function() { $(this).val(''); $('#org_id').val(''); return true; } );\n"); // Add other dimensions/context information to this form @@ -672,6 +680,7 @@ EOF } $sLogOffMenu = "