You are here

function lingotek_get_dashboard_code in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lingotek.dashboard.inc \lingotek_get_dashboard_code()
  2. 7.2 lingotek.dashboard.inc \lingotek_get_dashboard_code()
  3. 7.4 lingotek.dashboard.inc \lingotek_get_dashboard_code()
  4. 7.5 lingotek.dashboard.inc \lingotek_get_dashboard_code()
  5. 7.6 lingotek.dashboard.inc \lingotek_get_dashboard_code()

Generates the code for the embedded Javascript dashboard.

1 call to lingotek_get_dashboard_code()
lingotek_dashboard in ./lingotek.dashboard.inc
Tab: Dashboard - The main Lingotek dashboard page.

File

./lingotek.dashboard.inc, line 66
Lingotek Dashboard.

Code

function lingotek_get_dashboard_code() {
  global $base_url;
  $output = '';
  $guid = lingotek_get_guid();

  // 16 char string
  $totals = lingotek_get_target_status();
  $script = '
      <script src="' . LINGOTEK_GMC_SERVER . '/js/lingotek.min.js"></script>
      <script>
        require(["lingotek"],function(lingotek){
        var containerId = "dashboard";
        var config = {
          // lingotek
          "community": "%s",
          "oauth_key": "%s",
          "oauth_secret": "%s",
          "external_id": "%s",
          "tm_vault_id": "%s",
          "workflow_id": "%s",
          "project_id": "%s",
          "first_name": "%s",
          "last_name": "%s",
          "email": "%s",
          // cms
          "cms_site_id": "%s",
          "cms_site_key": "%s",
          "cms_site_name": "%s",
          "cms_type": "%s",
          "cms_version": "%s",
          "cms_tag": "%s",
          "module_version": %s,
          "endpoint_url": "%s",
          "sync_url": "%s",
          // data
          "source_language":%s ,
          "localization_languages": %s,
          "target_languages": %s
        };
         lingotek.dashboard(containerId,config);
        });
      </script>
    ';
  $endpoint = $base_url . '/lingotek/target';

  //(variable_get('clean_url', 0) ? '' : '?q=') . '/lingotek/target';
  $sync_url = $base_url . '/' . LINGOTEK_MENU_LANG_BASE_URL . '/sync';

  //(variable_get('clean_url', 0) ? '' : '?q=') . '/' . LINGOTEK_MENU_LANG_BASE_URL . '/sync';
  $output .= sprintf($script, variable_get('lingotek_community_identifier', ''), variable_get('lingotek_oauth_consumer_id', ''), variable_get('lingotek_oauth_consumer_secret', ''), variable_get('lingotek_login_id', ''), variable_get('lingotek_vault', ''), variable_get('lingotek_workflow', ''), variable_get('lingotek_project', ''), variable_get('lingotek_activation_first_name', ''), variable_get('lingotek_activation_last_name', ''), variable_get('lingotek_activation_email', ''), $guid, url('<front>', array(
    'absolute' => TRUE,
  )), variable_get('site_name', 'Unidentified Drupal Site'), 'Drupal', VERSION, variable_get('install_profile', ''), json_encode(lingotek_get_module_info('version')), $endpoint, $sync_url, lingotek_get_source_language_json(), json_encode(Lingotek::availableLanguageTargets('lingotek_locale', TRUE)), json_encode($totals));
  return $output;
}