Example #1
0
 public function display()
 {
     $user = $GLOBALS["current_user"];
     $etag = $user->id . $user->getETagSeed("mainMenuETag");
     $etag .= $GLOBALS['current_language'];
     //Include fts engine name in etag so we don't cache searchbar.
     $etag .= SugarSearchEngineFactory::getFTSEngineNameFromConfig();
     $etag = md5($etag);
     generateEtagHeader($etag);
     //Prevent double footers
     $GLOBALS['app']->headerDisplayed = false;
 }
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     require_once 'modules/Home/UnifiedSearchAdvanced.php';
     $usa = new UnifiedSearchAdvanced();
     global $mod_strings, $app_strings, $app_list_strings, $current_user;
     $sugar_smarty = new Sugar_Smarty();
     $sugar_smarty->assign('APP', $app_strings);
     $sugar_smarty->assign('MOD', $mod_strings);
     $sugar_smarty->assign('moduleTitle', $this->getModuleTitle(false));
     $modules = $usa->retrieveEnabledAndDisabledModules();
     $sugar_smarty->assign('enabled_modules', json_encode($modules['enabled']));
     $sugar_smarty->assign('disabled_modules', json_encode($modules['disabled']));
     $defaultEngine = SugarSearchEngineFactory::getFTSEngineNameFromConfig();
     $config = $GLOBALS['sugar_config']['full_text_engine'][$defaultEngine];
     $justRequestedAScheduledIndex = !empty($_REQUEST['sched']) ? true : false;
     $hide_fts_config = isset($GLOBALS['sugar_config']['hide_full_text_engine_config']) ? $GLOBALS['sugar_config']['hide_full_text_engine_config'] : false;
     $showSchedButton = $defaultEngine != '' && $this->isFTSConnectionValid() ? true : false;
     $sugar_smarty->assign("showSchedButton", $showSchedButton);
     $sugar_smarty->assign("hide_fts_config", $hide_fts_config);
     $sugar_smarty->assign("fts_type", get_select_options_with_id($app_list_strings['fts_type'], $defaultEngine));
     $sugar_smarty->assign("fts_host", $config['host']);
     $sugar_smarty->assign("fts_port", $config['port']);
     $sugar_smarty->assign("fts_scheduled", !empty($schedulerID) && !$schedulerCompleted);
     $sugar_smarty->assign('justRequestedAScheduledIndex', $justRequestedAScheduledIndex);
     //End FTS
     if (is_admin($current_user)) {
         if (!empty($GLOBALS['sugar_config']['fts_disable_notification'])) {
             displayAdminError(translate('LBL_FTS_DISABLED', 'Administration'));
         }
         // if fts indexing is done, show the notification to admin
         $admin = Administration::getSettings();
         if (!empty($admin->settings['info_fts_index_done'])) {
             displayAdminError(translate('LBL_FTS_INDEXING_DONE', 'Administration'));
             // reset flag
             $admin->saveSetting('info', 'fts_index_done', 0);
         }
     }
     echo $sugar_smarty->fetch(SugarAutoLoader::existingCustomOne('modules/Administration/templates/GlobalSearchSettings.tpl'));
 }
Example #3
0
 /**
  * Toggle Favorites
  * @param SugarBean $module
  * @param type $favorite
  * @return bool
  */
 protected function toggleFavorites($bean, $favorite)
 {
     $reindexBean = false;
     $favorite = (bool) $favorite;
     $module = $bean->module_dir;
     $record = $bean->id;
     $fav_id = SugarFavorites::generateGUID($module, $record);
     // get it even if its deleted
     $fav = BeanFactory::getBean('SugarFavorites', $fav_id, array("deleted" => false));
     // already exists
     if (!empty($fav->id)) {
         $deleted = $favorite ? 0 : 1;
         $fav->toggleExistingFavorite($fav_id, $deleted);
         $reindexBean = true;
     } elseif ($favorite && empty($fav->id)) {
         $fav = BeanFactory::getBean('SugarFavorites');
         $fav->id = $fav_id;
         $fav->new_with_id = true;
         $fav->module = $module;
         $fav->record_id = $record;
         $fav->created_by = $GLOBALS['current_user']->id;
         $fav->assigned_user_id = $GLOBALS['current_user']->id;
         $fav->deleted = 0;
         $fav->save();
     }
     $bean->my_favorite = $favorite;
     // Bug59888 - If a Favorite is toggled, we need to reindex the bean for FTS engines so that the document will be updated with this change
     if ($reindexBean === true) {
         $searchEngine = SugarSearchEngineFactory::getInstance(SugarSearchEngineFactory::getFTSEngineNameFromConfig());
         if ($searchEngine instanceof SugarSearchEngineAbstractBase) {
             $searchEngine->indexBean($bean, false);
         }
     }
     return true;
 }
Example #4
0
 /**
  * Gets server information
  *
  * @return array of ServerInfo
  */
 public function getServerInfo()
 {
     $system_config = Administration::getSettings(false, true);
     $data['flavor'] = $GLOBALS['sugar_flavor'];
     $data['version'] = $GLOBALS['sugar_version'];
     $data['build'] = $GLOBALS['sugar_build'];
     // Product Name for Professional edition.
     $data['product_name'] = "SugarCRM Professional";
     // Product Name for Enterprise edition.
     $data['product_name'] = "SugarCRM Enterprise";
     if (file_exists('custom/version.php')) {
         include 'custom/version.php';
         $data['custom_version'] = $custom_version;
     }
     if (isset($system_config->settings['system_skypeout_on']) && $system_config->settings['system_skypeout_on'] == 1) {
         $data['system_skypeout_on'] = true;
     }
     if (isset($system_config->settings['system_tweettocase_on']) && $system_config->settings['system_tweettocase_on'] == 1) {
         $data['system_tweettocase_on'] = true;
     }
     $fts_enabled = SugarSearchEngineFactory::getFTSEngineNameFromConfig();
     if (!empty($fts_enabled) && $fts_enabled != 'SugarSearchEngine') {
         $data['fts'] = array('enabled' => true, 'type' => $fts_enabled);
     } else {
         $data['fts'] = array('enabled' => false);
     }
     //Adds the portal status to the server info collection.
     $admin = Administration::getSettings();
     //Property 'on' of category 'portal' must be a boolean.
     $data['portal_active'] = !empty($admin->settings['portal_on']);
     return $data;
 }
Example #5
0
function displayAdminError($errorString)
{
    $output = '<p class="error">' . $errorString . '</p>';
    if (!empty($GLOBALS['buffer_system_notifications'])) {
        $GLOBALS['system_notification_count']++;
        $GLOBALS['system_notification_buffer'][] = $output;
    } else {
        echo $output;
    }
}
if (!empty($_SESSION['display_lotuslive_alert'])) {
    displayAdminError(translate('MSG_RECONNECT_LOTUSLIVE', 'Administration'));
}
if (is_admin($current_user) && SugarAutoLoader::fileExists('include/SugarSearchEngine/SugarSearchEngineFactory.php')) {
    require_once 'include/SugarSearchEngine/SugarSearchEngineFactory.php';
    $ftsType = SugarSearchEngineFactory::getFTSEngineNameFromConfig();
    if (!empty($ftsType) && isset($GLOBALS['sugar_config']['full_text_engine'][$ftsType]['valid']) && !$GLOBALS['sugar_config']['full_text_engine'][$ftsType]['valid']) {
        displayAdminError(translate('LBL_FTS_CONNECTION_INVALID', 'Administration'));
    }
}
if (isset($_SESSION['rebuild_relationships'])) {
    displayAdminError(translate('MSG_REBUILD_RELATIONSHIPS', 'Administration'));
}
if (isset($_SESSION['rebuild_extensions'])) {
    displayAdminError(translate('MSG_REBUILD_EXTENSIONS', 'Administration'));
}
if (empty($license)) {
    $license = Administration::getSettings('license');
}
// This section of code is a portion of the code referred
// to as Critical Control Software under the End User
 /**
  * This function is used to determine the search engine to use
  * @param $api ServiceBase The API class of the request
  * @param $args array The arguments array passed in from the API
  * @param $options array An array of options to pass through to the search engine, they get translated to the $searchOptions array so you can see exactly what gets passed through
  * @return string name of the Search Engine
  */
 protected function determineSugarSearchEngine(ServiceBase $api, array $args, array $options)
 {
     require_once 'include/SugarSearchEngine/SugarSearchEngineMetadataHelper.php';
     /*
         How to determine which Elastic Search
         1 - Not Portal
         2 - All Modules are full_text_search = true
         4 - not order by
     */
     /*
      * If a module isn't FTS switch to spot search.  Global Search should be done with either the enabled modules
      * Using the new ServerInfo endpoint OR passing in a blank module list.
      */
     if (!empty($options['moduleList'])) {
         foreach ($options['moduleList'] as $module) {
             if (!SugarSearchEngineMetadataHelper::isModuleFtsEnabled($module)) {
                 return 'SugarSearchEngine';
             }
         }
     }
     /*
      * Currently we cannot do an order by in FTS.  Thus any ordering must be done using the Spot Search
      */
     if (isset($options['orderBySetByApi']) && $options['orderBySetByApi'] == true) {
         return 'SugarSearchEngine';
     }
     // if the query is empty no reason to pass through FTS they want a normal list view.
     if (empty($args['q'])) {
         return 'SugarSearchEngine';
     }
     $fts = SugarSearchEngineFactory::getFTSEngineNameFromConfig();
     //everything is groovy for FTS, get the FTS Engine Name from the conig
     if (!empty($fts)) {
         return $fts;
     }
     return 'SugarSearchEngine';
 }