diff --git a/pages/preferences.php b/pages/preferences.php index bcbfce1512..bd96c1d675 100644 --- a/pages/preferences.php +++ b/pages/preferences.php @@ -35,87 +35,10 @@ require_once(APPROOT.'/application/startup.inc.php'); function DisplayPreferences($oP) { $oAppContext = new ApplicationContext(); - + $sURL = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?'.$oAppContext->GetForLink(); + $oP->add('\n"); $oP->add('
'); - - ////////////////////////////////////////////////////////////////////////// - // - // Favorite Organizations - // - ////////////////////////////////////////////////////////////////////////// - - $oP->add('
'.Dict::S('UI:FavoriteOrganizations').''); - $oP->p(Dict::S('UI:FavoriteOrganizations+')); - $oP->add('
'); - // Favorite organizations: the organizations listed in the drop-down menu - $sOQL = ApplicationMenu::GetFavoriteSiloQuery(); - $oFilter = DBObjectSearch::FromOQL($sOQL); - $oBlock = new DisplayBlock($oFilter, 'list', false); - $oBlock->Display($oP, 1, array('menu' => false, 'selection_mode' => true, 'selection_type' => 'multiple', 'cssCount'=> '.selectedCount', 'table_id' => 'user_prefs')); - $oP->add($oAppContext->GetForForm()); - $oP->add(''); - $sURL = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?'.$oAppContext->GetForLink(); - $oP->add('

'); - $oP->add('  '); - $oP->add('

'); - $oP->add('
'); - $oP->add('
'); - - $aFavoriteOrgs = appUserPreferences::GetPref('favorite_orgs', null); - if ($aFavoriteOrgs == null) - { - // All checked - $oP->add_ready_script( -<< 0) - { - // paginated display, restore the selection - var pager = $('#user_prefs form .pager'); - $(':input[name=selectionMode]', pager).val('negative'); - $('#user_prefs table.listResults').trigger('load_selection'); - - } - else - { - $('#user_prefs table.listResults').trigger('check_all'); - } -EOF -); - - } - else - { - $sChecked = implode('","', $aFavoriteOrgs); - $oP->add_ready_script( -<< 0) - { - // paginated display, restore the selection - var pager = $('#user_prefs form .pager'); - $(':input[name=selectionMode]', pager).val('positive'); - for (i=0; i'); - } - $('#user_prefs table.listResults').trigger('load_selection'); - - } - else - { - $('#user_prefs form :checkbox[name^=selectObject]').each( function() - { - if ($.inArray($(this).val(), aChecked) > -1) - { - $(this).attr('checked', true); - $(this).trigger('change'); - } - }); - } -EOF -); - } ////////////////////////////////////////////////////////////////////////// // @@ -186,6 +109,83 @@ function ValidateOtherSettings() } EOF ); + + ////////////////////////////////////////////////////////////////////////// + // + // Favorite Organizations + // + ////////////////////////////////////////////////////////////////////////// + + $oP->add('
'.Dict::S('UI:FavoriteOrganizations').''); + $oP->p(Dict::S('UI:FavoriteOrganizations+')); + $oP->add('
'); + // Favorite organizations: the organizations listed in the drop-down menu + $sOQL = ApplicationMenu::GetFavoriteSiloQuery(); + $oFilter = DBObjectSearch::FromOQL($sOQL); + $oBlock = new DisplayBlock($oFilter, 'list', false); + $oBlock->Display($oP, 1, array('menu' => false, 'selection_mode' => true, 'selection_type' => 'multiple', 'cssCount'=> '.selectedCount', 'table_id' => 'user_prefs')); + $oP->add($oAppContext->GetForForm()); + $oP->add(''); + $oP->add('

'); + $oP->add('  '); + $oP->add('

'); + $oP->add('
'); + $oP->add('
'); + + $aFavoriteOrgs = appUserPreferences::GetPref('favorite_orgs', null); + if ($aFavoriteOrgs == null) + { + // All checked + $oP->add_ready_script( +<< 0) + { + // paginated display, restore the selection + var pager = $('#user_prefs form .pager'); + $(':input[name=selectionMode]', pager).val('negative'); + $('#user_prefs table.listResults').trigger('load_selection'); + + } + else + { + $('#user_prefs table.listResults').trigger('check_all'); + } +EOF +); + + } + else + { + $sChecked = implode('","', $aFavoriteOrgs); + $oP->add_ready_script( +<< 0) + { + // paginated display, restore the selection + var pager = $('#user_prefs form .pager'); + $(':input[name=selectionMode]', pager).val('positive'); + for (i=0; i'); + } + $('#user_prefs table.listResults').trigger('load_selection'); + + } + else + { + $('#user_prefs form :checkbox[name^=selectObject]').each( function() + { + if ($.inArray($(this).val(), aChecked) > -1) + { + $(this).attr('checked', true); + $(this).trigger('change'); + } + }); + } +EOF +); + } $oP->add('
'); $oP->add_ready_script("$('#fav_page_length').bind('keyup change', function(){ ValidateOtherSettings(); })");