<?xml version="1.0" encoding="UTF-8"?>
<Module>

  <ModulePrefs
      title="__MSG_default_title__"
      description="__MSG_description__"
      author="Google Engineering"
      author_affiliation="Google Inc."
      author_email="visualization.api+orgchart@gmail.com"
      screenshot="http://www.google.com/ig/modules/orgchart.png"
      thumbnail="http://www.google.com/ig/modules/orgchart-thm.png">
    <Require feature="settitle" />
    <Require feature="idi" />
    <Require feature="locked-domain" />
    <Locale messages="http://www.google.com/ig/modules/orgchart_content/en_ALL.xml" />
    <Locale lang="ar" messages="http://www.google.com/ig/modules/orgchart_content/ar_ALL.xml" language_direction="rtl" />
    <Locale lang="bg" messages="http://www.google.com/ig/modules/orgchart_content/bg_ALL.xml" />
    <Locale lang="ca" messages="http://www.google.com/ig/modules/orgchart_content/ca_ALL.xml" />
    <Locale lang="cs" messages="http://www.google.com/ig/modules/orgchart_content/cs_ALL.xml" />
    <Locale lang="da" messages="http://www.google.com/ig/modules/orgchart_content/da_ALL.xml" />
    <Locale lang="de" messages="http://www.google.com/ig/modules/orgchart_content/de_ALL.xml" />
    <Locale lang="el" messages="http://www.google.com/ig/modules/orgchart_content/el_ALL.xml" />
    <Locale lang="en-GB" messages="http://www.google.com/ig/modules/orgchart_content/en_GB.xml" />
    <Locale lang="es" messages="http://www.google.com/ig/modules/orgchart_content/es_ALL.xml" />
    <Locale lang="et" messages="http://www.google.com/ig/modules/orgchart_content/et_ALL.xml" />
    <Locale lang="fi" messages="http://www.google.com/ig/modules/orgchart_content/fi_ALL.xml" />
    <Locale lang="fr" messages="http://www.google.com/ig/modules/orgchart_content/fr_ALL.xml" />
    <Locale lang="hi" messages="http://www.google.com/ig/modules/orgchart_content/hi_ALL.xml" />
    <Locale lang="hr" messages="http://www.google.com/ig/modules/orgchart_content/hr_ALL.xml" />
    <Locale lang="hu" messages="http://www.google.com/ig/modules/orgchart_content/hu_ALL.xml" />
    <Locale lang="hy" messages="http://www.google.com/ig/modules/orgchart_content/hy_ALL.xml" />
    <Locale lang="id" messages="http://www.google.com/ig/modules/orgchart_content/id_ALL.xml" />
    <Locale lang="is" messages="http://www.google.com/ig/modules/orgchart_content/is_ALL.xml" />
    <Locale lang="it" messages="http://www.google.com/ig/modules/orgchart_content/it_ALL.xml" />
    <Locale lang="iw" messages="http://www.google.com/ig/modules/orgchart_content/iw_ALL.xml" language_direction="rtl" />
    <Locale lang="ja" messages="http://www.google.com/ig/modules/orgchart_content/ja_ALL.xml" />
    <Locale lang="ko" messages="http://www.google.com/ig/modules/orgchart_content/ko_ALL.xml" />
    <Locale lang="lt" messages="http://www.google.com/ig/modules/orgchart_content/lt_ALL.xml" />
    <Locale lang="lv" messages="http://www.google.com/ig/modules/orgchart_content/lv_ALL.xml" />
    <Locale lang="ms" messages="http://www.google.com/ig/modules/orgchart_content/ms_ALL.xml" />
    <Locale lang="nl" messages="http://www.google.com/ig/modules/orgchart_content/nl_ALL.xml" />
    <Locale lang="no" messages="http://www.google.com/ig/modules/orgchart_content/no_ALL.xml" />
    <Locale lang="pl" messages="http://www.google.com/ig/modules/orgchart_content/pl_ALL.xml" />
    <Locale lang="pt-BR" messages="http://www.google.com/ig/modules/orgchart_content/pt_BR.xml" />
    <Locale lang="pt-PT" messages="http://www.google.com/ig/modules/orgchart_content/pt_PT.xml" />
    <Locale lang="ro" messages="http://www.google.com/ig/modules/orgchart_content/ro_ALL.xml" />
    <Locale lang="ru" messages="http://www.google.com/ig/modules/orgchart_content/ru_ALL.xml" />
    <Locale lang="sl" messages="http://www.google.com/ig/modules/orgchart_content/sl_ALL.xml" />
    <Locale lang="sk" messages="http://www.google.com/ig/modules/orgchart_content/sk_ALL.xml" />
    <Locale lang="sr" messages="http://www.google.com/ig/modules/orgchart_content/sr_ALL.xml" />
    <Locale lang="sv" messages="http://www.google.com/ig/modules/orgchart_content/sv_ALL.xml" />
    <Locale lang="th" messages="http://www.google.com/ig/modules/orgchart_content/th_ALL.xml" />
    <Locale lang="tl" messages="http://www.google.com/ig/modules/orgchart_content/tl_ALL.xml" />
    <Locale lang="tr" messages="http://www.google.com/ig/modules/orgchart_content/tr_ALL.xml" />
    <Locale lang="uk" messages="http://www.google.com/ig/modules/orgchart_content/uk_ALL.xml" />
    <Locale lang="vi" messages="http://www.google.com/ig/modules/orgchart_content/vi_ALL.xml" />
    <Locale lang="zh-CN" messages="http://www.google.com/ig/modules/orgchart_content/zh_CN.xml" />
    <Locale lang="zh-TW" messages="http://www.google.com/ig/modules/orgchart_content/zh_TW.xml" />
  </ModulePrefs>

  <UserPref name="_table_query_url" display_name="__MSG_tablequeryurl__" required="true" />
  <UserPref name="title" display_name="__MSG_title__" required="false" />
  <UserPref name="_table_query_refresh_interval" display_name="__MSG_tablequeryrefreshinterval__" default_value="300" datatype="enum" required="false">
    <EnumValue value="0" display_value="__MSG_never__" />
    <EnumValue value="60" display_value="1" />
    <EnumValue value="300" display_value="5" />
    <EnumValue value="1800" display_value="30" />
  </UserPref>

  <Content type="html"><![CDATA[

  <div id="loading"><img src="http://www.google.com/ig/images/spinner.gif" /></div>
  <div id="chart" style="overflow:auto;"></div>

  <script src="http://www.google.com/jsapi" type="text/javascript"></script>
  <script type="text/javascript">

    var prefs = new _IG_Prefs();
    var gadgetHelper;

    _IG_RegisterOnloadHandler(loadVisualizationAPI);

    function loadVisualizationAPI() {
      google.load('visualization', '1', {packages: ['orgchart']});
      google.setOnLoadCallback(initialize);
    };

    function initialize() {
      var title = prefs.getString('title');
      if (title) {
        _IG_SetTitle(title);
      }
      gadgetHelper = new google.visualization.GadgetHelper();
      var query = gadgetHelper.createQueryFromPrefs(prefs);
      query.send(responseHandler);
    };

    function responseHandler(response) {
      var loadingMsgContainer = document.getElementById('loading');
      if (loadingMsgContainer) {
        loadingMsgContainer.style.display = 'none';
      }
      if (!gadgetHelper.validateResponse(response)) {
        // Default error handling was done, just leave.
        return;
      }
      
      var container = document.getElementById('chart');
      container.style.width = document.body.clientWidth + 'px';
      container.style.height = document.body.clientHeight + 'px';
      var visualizationObject =
          new google.visualization.OrgChart(container);

      var dataTable = response.getDataTable();
      var options = null;
      visualizationObject.draw(dataTable, options);
    };

  </script>
  ]]>
  </Content>
</Module>
