← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15446: New class for /api/schemas output, used instead of metadata class. Reworked dxf2 export list in i...

 

------------------------------------------------------------
revno: 15446
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-05-28 13:02:29 +0200
message:
  New class for /api/schemas output, used instead of metadata class. Reworked dxf2 export list in import-export module, now gets the list of types diretly from /api/schemas, so the list will be dynamic and grow/shrink according to SchemaDescriptors.
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schemas.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java
  dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataExportFormAction.java
  dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataExport.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaService.java	2014-03-27 10:14:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaService.java	2014-05-28 11:02:29 +0000
@@ -40,4 +40,6 @@
     Schema getSchemaBySingularName( String name );
 
     List<Schema> getSchemas();
+
+    List<Schema> getMetadataSchemas();
 }

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schemas.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schemas.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schemas.java	2014-05-28 11:02:29 +0000
@@ -0,0 +1,69 @@
+package org.hisp.dhis.schema;
+
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ */
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import com.google.common.collect.Lists;
+import org.hisp.dhis.common.DxfNamespaces;
+
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@JacksonXmlRootElement( localName = "schemas", namespace = DxfNamespaces.DXF_2_0 )
+public class Schemas
+{
+    private List<Schema> schemas = Lists.newArrayList();
+
+    public Schemas()
+    {
+    }
+
+    public Schemas( List<Schema> schemas )
+    {
+        this.schemas = schemas;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( localName = "schema", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlElementWrapper( localName = "schemas", namespace = DxfNamespaces.DXF_2_0, useWrapping = false )
+    public List<Schema> getSchemas()
+    {
+        return schemas;
+    }
+
+    public void setSchemas( List<Schema> schemas )
+    {
+        this.schemas = schemas;
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java	2014-03-28 03:28:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java	2014-05-28 11:02:29 +0000
@@ -33,6 +33,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 
 import javax.annotation.PostConstruct;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -107,4 +108,24 @@
     {
         return Lists.newArrayList( classSchemaMap.values() );
     }
+
+    @Override
+    public List<Schema> getMetadataSchemas()
+    {
+        List<Schema> schemas = getSchemas();
+
+        Iterator<Schema> iterator = schemas.iterator();
+
+        while ( iterator.hasNext() )
+        {
+            Schema schema = iterator.next();
+
+            if ( !schema.isMetadata() )
+            {
+                iterator.remove();
+            }
+        }
+
+        return schemas;
+    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java	2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchemaController.java	2014-05-28 11:02:29 +0000
@@ -28,10 +28,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.dxf2.metadata.MetaData;
+import org.hisp.dhis.dxf2.utils.JacksonUtils;
 import org.hisp.dhis.schema.Schema;
 import org.hisp.dhis.schema.SchemaService;
-import org.hisp.dhis.dxf2.utils.JacksonUtils;
+import org.hisp.dhis.schema.Schemas;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
@@ -41,7 +41,6 @@
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -53,18 +52,16 @@
     @Autowired
     private SchemaService schemaService;
 
-    @RequestMapping( value = "", method = RequestMethod.GET, produces = { "*/*" } )
+    @RequestMapping( value = "", method = RequestMethod.GET, produces = { "text/html", "*/*" } )
     public void getSchemasJson( HttpServletResponse response ) throws IOException
     {
-        List<Schema> schemas = schemaService.getSchemas();
-        MetaData metaData = new MetaData();
-        metaData.setSchemas( schemas );
+        Schemas schemas = new Schemas( schemaService.getSchemas() );
 
         response.setContentType( MediaType.APPLICATION_JSON_VALUE );
         JacksonUtils.toJson( response.getOutputStream(), schemas );
     }
 
-    @RequestMapping( value = "/{type}", method = RequestMethod.GET, produces = { "*/*" } )
+    @RequestMapping( value = "/{type}", method = RequestMethod.GET, produces = { "text/html", "*/*" } )
     public void getSchemaJson( @PathVariable String type, HttpServletResponse response ) throws IOException
     {
         Schema schema = schemaService.getSchemaBySingularName( type );
@@ -76,12 +73,10 @@
     @RequestMapping( value = "", method = RequestMethod.GET, produces = { MediaType.APPLICATION_XML_VALUE } )
     public void getSchemasXml( HttpServletResponse response ) throws IOException
     {
-        List<Schema> schemas = schemaService.getSchemas();
-        MetaData metaData = new MetaData();
-        metaData.setSchemas( schemas );
+        Schemas schemas = new Schemas( schemaService.getSchemas() );
 
         response.setContentType( MediaType.APPLICATION_XML_VALUE );
-        JacksonUtils.toXml( response.getOutputStream(), metaData );
+        JacksonUtils.toXml( response.getOutputStream(), schemas );
     }
 
     @RequestMapping( value = "/{type}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_XML_VALUE } )

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataExportFormAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataExportFormAction.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataExportFormAction.java	2014-05-28 11:02:29 +0000
@@ -28,13 +28,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.opensymphony.xwork2.Action;
 import org.apache.commons.lang3.StringUtils;
-import org.hisp.dhis.dxf2.metadata.ExchangeClasses;
+import org.hisp.dhis.schema.Schema;
+import org.hisp.dhis.schema.SchemaService;
+import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.ArrayList;
 import java.util.Collections;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -44,11 +46,14 @@
 public class MetaDataExportFormAction
     implements Action
 {
+    @Autowired
+    private SchemaService schemaService;
+
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
 
-    private Map<String, String> exportClasses = new LinkedHashMap<String, String>();
+    private Map<String, String> exportClasses = Maps.newLinkedHashMap();
 
     public Map<String, String> getExportClasses()
     {
@@ -62,7 +67,13 @@
     @Override
     public String execute() throws Exception
     {
-        List<String> values = new ArrayList<String>( ExchangeClasses.getExportMap().values() );
+        List<String> values = Lists.newArrayList();
+
+        for ( Schema schema : schemaService.getMetadataSchemas() )
+        {
+            values.add( schema.getPlural() );
+        }
+
         Collections.sort( values );
 
         for ( String key : values )

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataExport.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataExport.vm	2014-03-13 16:17:36 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataExport.vm	2014-05-28 11:02:29 +0000
@@ -1,162 +1,155 @@
 <script type="text/javascript">
-    jQuery(document).ready(function () {
-        selectAll();
+  jQuery(document).ready(function() {
+    $.ajax({
+      url: '../api/schemas.json',
+      dataType: 'json'
+    }).done(function( data ) {
+      var metadata = [];
+
+      $.each(data.schemas, function( idx ) {
+        if( this.metadata ) {
+          var o = {
+            name: this.plural,
+            id: this.plural
+          }
+
+          metadata.push(o);
+        }
+      });
+
+      metadata.sort(function( a, b ) {
+        if( a.name < b.name )
+          return -1;
+        if( a.name > b.name )
+          return 1;
+        return 0;
+      });
+
+      $.each(metadata, function( idx ) {
+        var type = $('<div />').css({
+          width: '200px',
+          float: 'left'
+        });
+
+        var checkbox = $('<input type="checkbox"/>').attr('id', this.id).attr('value', true);
+        var labelFor = $('<label />').attr('for', this.id).text(this.name);
+
+        type.append(checkbox).append(labelFor);
+        $('#metadata').append(type);
+      });
+
+      selectAll();
+    })
+  });
+
+  function selectAll() {
+    $("#exportForm").find("input:checkbox").attr("checked", true);
+  }
+
+  function selectNone() {
+    $("#exportForm").find("input:checkbox").attr("checked", false);
+  }
+
+  function exportMetaData() {
+    if( $('#dataSets').is(':checked') ) {
+      $('#sections').attr('checked', true);
+    }
+    else {
+      $('#sections').removeAttr('checked');
+    }
+
+    if( $('#categories').is(':checked') ) {
+      $('#categoryCombos').attr('checked', true);
+      $('#categoryOptionCombos').attr('checked', true);
+      $('#categoryOptions').attr('checked', true);
+    }
+    else {
+      $('#categoryCombos').removeAttr('checked');
+      $('#categoryOptionCombos').removeAttr('checked');
+      $('#categoryOptions').removeAttr('checked');
+    }
+
+    if( $('#mapLegendSets').is(':checked') ) {
+      $('#mapLegends').attr('checked', true);
+    }
+    else {
+      $('#mapLegends').removeAttr('checked');
+    }
+
+    if( $('#maps').is(':checked') ) {
+      $('#mapViews').attr('checked', true);
+    }
+    else {
+      $('#mapViews').removeAttr('checked');
+    }
+
+    var url = "../api/metaData";
+    var format = $("#format").val();
+    var compression = $("#compression").val();
+
+    url += "." + format;
+
+    if( compression == "zip" ) {
+      url += ".zip";
+    }
+    else if( compression == "gz" ) {
+      url += ".gz";
+    }
+
+    var selected = {};
+
+    $("#exportForm").find('input:checked').each(function( idx ) {
+      selected[this.id] = this.value;
     });
 
-    function selectAll()
-    {
-        $("#exportForm").find("input:checkbox").attr("checked", true);
-    }
-
-    function selectNone()
-    {
-        $("#exportForm").find("input:checkbox").attr("checked", false);
-    }
-
-    function exportMetaData()
-    {
-        if( $( '#dataSets' ).is(':checked'))
-        {
-            $( '#sections' ).attr( 'checked', true );
-        }
-        else
-        {
-            $( '#sections' ).removeAttr('checked');
-        }
-
-        if( $( '#categories' ).is(':checked'))
-        {
-            $( '#categoryCombos' ).attr('checked', true);
-            $( '#categoryOptionCombos' ).attr('checked', true);
-            $( '#categoryOptions' ).attr('checked', true);
-        }
-        else
-        {
-            $( '#categoryCombos' ).removeAttr( 'checked');
-            $( '#categoryOptionCombos' ).removeAttr('checked');
-            $( '#categoryOptions' ).removeAttr('checked');
-        }
-
-        if( $( '#mapLegendSets' ).is(':checked') )
-        {
-            $( '#mapLegends' ).attr('checked', true);
-        }
-        else
-        {
-            $( '#mapLegends' ).removeAttr('checked');
-        }
-
-        if( $( '#maps' ).is(':checked') )
-        {
-            $( '#mapViews' ).attr('checked', true);
-        }
-        else
-        {
-            $( '#mapViews' ).removeAttr('checked');
-        }
-
-        var url = "../api/metaData";
-        var format = $("#format").val();
-        var compression = $("#compression").val();
-
-        url += "." + format;
-
-        if(compression == "zip")
-        {
-            url += ".zip";
-        }
-        else if(compression == "gz")
-        {
-            url += ".gz";
-        }
-
-        url += "?assumeTrue=false&" + $("#exportForm").serialize();
-
-        log("url" + url);
-        window.location=url;
-    }
+    url += "?assumeTrue=false&" + $.param(selected);
+
+    log("url" + url);
+    window.location = url;
+  }
 </script>
 
 <h3>$i18n.getString( "metadata_export" )</h3>
 
 <form id="exportForm" name="exportForm">
-
-<input id="categoryCombos" name="categoryCombos" type="checkbox" value="true" style="display: none;" />
-<input id="categoryOptionCombos" name="categoryOptionCombos" type="checkbox" value="true" style="display: none;" />
-<input id="categoryOptions" name="categoryOptions" type="checkbox" value="true" style="display: none;" />
-<input id="sections" name="sections" type="checkbox" value="true" style="display: none;" />
-<input id="mapViews" name="mapViews" type="checkbox" value="true" style="display: none;" />
-<input id="mapLegends" name="mapLegends" type="checkbox" value="true" style="display: none;" />
-
-<fieldset style="width: 80%; border: 1px solid #ccc; padding: 15px;">
-    <div style="width: 200px; float: left;"><input id="attributes" name="attributes" type="checkbox" value="true" /> <label for="attributes"> Attribute Types</label></div>
-    <div style="width: 200px; float: left;"><input id="categories" name="categories" type="checkbox" value="true" /> <label for="categories">Categories</label></div>
-    <div style="width: 200px; float: left;"><input id="charts" name="charts" type="checkbox" value="true" /> <label for="charts">Charts</label></div>
-    <div style="width: 200px; float: left;"><input id="concepts" name="concepts" type="checkbox" value="true" /> <label for="concepts">Concepts</label></div>
-    <div style="width: 200px; float: left;"><input id="constants" name="constants" type="checkbox" value="true" /> <label for="constants">Constants</label></div>
-    <div style="width: 200px; float: left;"><input id="dataDictionaries" name="dataDictionaries" type="checkbox" value="true" /> <label for="dataDictionaries"> Data Dictionaries</label></div>
-    <div style="width: 200px; float: left;"><input id="dataElementGroupSets" name="dataElementGroupSets" type="checkbox" value="true" /> <label for="dataElementGroupSets"> Data Element Group Sets</label></div>
-    <div style="width: 200px; float: left;"><input id="dataElementGroups" name="dataElementGroups" type="checkbox" value="true" /> <label for="dataElementGroups"> Data Element Groups</label></div>
-    <div style="width: 200px; float: left;"><input id="dataElements" name="dataElements" type="checkbox" value="true" /> <label for="dataElements"> Data Elements</label></div>
-    <div style="width: 200px; float: left;"><input id="dataSets" name="dataSets" type="checkbox" value="true" /> <label for="dataSets"> Data Sets</label></div>
-    <div style="width: 200px; float: left;"><input id="documents" name="documents" type="checkbox" value="true" /> <label for="documents">Documents</label></div>
-    <div style="width: 200px; float: left;"><input id="indicatorGroupSets" name="indicatorGroupSets" type="checkbox" value="true" /> <label for="indicatorGroupSets"> Indicator Group Sets</label></div>
-    <div style="width: 200px; float: left;"><input id="indicatorGroups" name="indicatorGroups" type="checkbox" value="true" /> <label for="indicatorGroups"> Indicator Groups</label></div>
-    <div style="width: 200px; float: left;"><input id="indicatorTypes" name="indicatorTypes" type="checkbox" value="true" /> <label for="indicatorTypes"> Indicator Types</label></div>
-    <div style="width: 200px; float: left;"><input id="indicators" name="indicators" type="checkbox" value="true" /> <label for="indicators">Indicators</label></div>
-    <div style="width: 200px; float: left;"><input id="mapLegendSets" name="mapLegendSets" type="checkbox" value="true" /> <label for="mapLegendSets"> Map Legend Sets</label></div>
-    <div style="width: 200px; float: left;"><input id="maps" name="maps" type="checkbox" value="true" /> <label for="maps">Maps</label></div>
-    <div style="width: 200px; float: left;"><input id="optionSets" name="optionSets" type="checkbox" value="true" /> <label for="optionSets"> Option Sets</label></div>
-    <div style="width: 200px; float: left;"><input id="organisationUnitGroupSets" name="organisationUnitGroupSets" type="checkbox" value="true" /> <label for="organisationUnitGroupSets"> Organisation Unit Group Sets</label></div>
-    <div style="width: 200px; float: left;"><input id="organisationUnitGroups" name="organisationUnitGroups" type="checkbox" value="true" /> <label for="organisationUnitGroups"> Organisation Unit Groups</label></div>
-    <div style="width: 200px; float: left;"><input id="organisationUnitLevels" name="organisationUnitLevels" type="checkbox" value="true" /> <label for="organisationUnitLevels"> Organisation Unit Levels</label></div>
-    <div style="width: 200px; float: left;"><input id="organisationUnits" name="organisationUnits" type="checkbox" value="true" /> <label for="organisationUnits"> Organisation Units</label></div>
-    <div style="width: 200px; float: left;"><input id="reportTables" name="reportTables" type="checkbox" value="true" /> <label for="reportTables"> Report Tables</label></div>
-    <div style="width: 200px; float: left;"><input id="reports" name="reports" type="checkbox" value="true" /> <label for="reports">Reports</label></div>
-    <div style="width: 200px; float: left;"><input id="sqlViews" name="sqlViews" type="checkbox" value="true" /> <label for="sqlViews"> Sql Views</label></div>
-    <div style="width: 200px; float: left;"><input id="userGroups" name="userGroups" type="checkbox" value="true" /> <label for="userGroups"> User Groups</label></div>
-    <div style="width: 200px; float: left;"><input id="userRoles" name="userRoles" type="checkbox" value="true" /> <label for="userRoles"> User Roles</label></div>
-    <div style="width: 200px; float: left;"><input id="users" name="users" type="checkbox" value="true" /> <label for="users">Users</label></div>
-    <div style="width: 200px; float: left;"><input id="validationRuleGroups" name="validationRuleGroups" type="checkbox" value="true" /> <label for="validationRuleGroups"> Validation Rule Groups</label></div>
-    <div style="width: 200px; float: left;"><input id="validationRules" name="validationRules" type="checkbox" value="true" /> <label for="validationRules"> Validation Rules</label></div>
-</fieldset>
-
-<br />
-
-<table>
-<tr>
-    <td colspan="2">
-        <input type="button" value="$i18n.getString( 'select_all' )" style="width:100px;" onclick="selectAll();" />
-        <input type="button" value="$i18n.getString( 'select_none' )" style="width:100px;" onclick="selectNone();" />
-    </td>
-</tr>
-
-<tr>
-    <td colspan="2">
+  <fieldset id="metadata" style="width: 80%; border: 1px solid #ccc; padding: 15px;"></fieldset>
+
+  <br/>
+
+  <table>
+    <tr>
+      <td colspan="2">
+        <input type="button" value="$i18n.getString( 'select_all' )" style="width:100px;" onclick="selectAll();"/>
+        <input type="button" value="$i18n.getString( 'select_none' )" style="width:100px;" onclick="selectNone();"/>
+      </td>
+    </tr>
+
+    <tr>
+      <td colspan="2">
         <select id="format" style="width: 204px;">
-            <option value="xml">XML</option>
-            <option value="json">Json</option>
+          <option value="xml">XML</option>
+          <option value="json">Json</option>
         </select>
-    </td>
-</tr>
+      </td>
+    </tr>
 
-<tr>
-    <td colspan="2">
+    <tr>
+      <td colspan="2">
         <select id="compression" style="width: 204px;">
-            <option value="zip">Zipped</option>
-            <option value="gz">GZipped</option>
-            <option value="uncompressed">Uncompressed</option>
+          <option value="zip">Zipped</option>
+          <option value="gz">GZipped</option>
+          <option value="uncompressed">Uncompressed</option>
         </select>
-    </td>
-</tr>
-
-<tr>
-    <td colspan="2">
-        <input type="button" value="$i18n.getString( 'export' )" style="width:204px;" onclick="exportMetaData();" />
-    </td>
-</tr>
-
-</table>
+      </td>
+    </tr>
+
+    <tr>
+      <td colspan="2">
+        <input type="button" value="$i18n.getString( 'export' )" style="width:204px;" onclick="exportMetaData();"/>
+      </td>
+    </tr>
+
+  </table>
 </form>
 
 <span id="message"></span>