Added make_cli option for generating a zip containing all files necessary to do 'gridworks run' at the command line. This excludes Java source files but contains pretty much everything else.
Added make_all option that makes dmg, exe, and cli. Added html and xls exporters. Made exported files named after project names rather than project IDs. git-svn-id: http://google-refine.googlecode.com/svn/trunk@314 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
07945f9cde
commit
07cf85b2a5
44
build.xml
44
build.xml
@ -30,6 +30,7 @@
|
|||||||
<property name="tests_classes.dir" value="${tests.dir}/classes" />
|
<property name="tests_classes.dir" value="${tests.dir}/classes" />
|
||||||
<property name="bundle.dir" value="${build.dir}/bundle" />
|
<property name="bundle.dir" value="${build.dir}/bundle" />
|
||||||
<property name="exe.dir" value="${build.dir}/exe" />
|
<property name="exe.dir" value="${build.dir}/exe" />
|
||||||
|
<property name="cli.dir" value="${build.dir}/cli" />
|
||||||
|
|
||||||
<path id="class.path">
|
<path id="class.path">
|
||||||
<fileset dir="${lib.dir}">
|
<fileset dir="${lib.dir}">
|
||||||
@ -150,6 +151,49 @@
|
|||||||
<zip destfile="${dist.dir}/gridworks-${version}.zip" basedir="${exe.dir}"/>
|
<zip destfile="${dist.dir}/gridworks-${version}.zip" basedir="${exe.dir}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="cli" depends="jar">
|
||||||
|
<mkdir dir="${cli.dir}"/>
|
||||||
|
|
||||||
|
<copy todir="${cli.dir}/lib">
|
||||||
|
<fileset dir="${lib.dir}">
|
||||||
|
<include name="**/*.jar"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<copy todir="${cli.dir}/lib/native/windows">
|
||||||
|
<fileset dir="${lib.dir}/native/windows">
|
||||||
|
<include name="*.dll"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<copy todir="${cli.dir}/build/classes">
|
||||||
|
<fileset dir="${build.dir}/classes">
|
||||||
|
<include name="**"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<copy todir="${cli.dir}/src/main/webapp">
|
||||||
|
<fileset dir="${basedir}/src/main/webapp">
|
||||||
|
<include name="**/*"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<copy todir="${cli.dir}/thirdparty">
|
||||||
|
<fileset dir="${basedir}/thirdparty">
|
||||||
|
<include name="**/*"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<copy todir="${cli.dir}/licenses">
|
||||||
|
<fileset dir="${basedir}/licenses">
|
||||||
|
<include name="**/*"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<copy file="${basedir}/gridworks" tofile="${cli.dir}/gridworks"/>
|
||||||
|
<copy file="${basedir}/gridworks.bat" tofile="${cli.dir}/gridworks.bat"/>
|
||||||
|
<copy file="${basedir}/build.xml" tofile="${cli.dir}/build.xml"/>
|
||||||
|
<copy file="${basedir}/LICENSE.txt" tofile="${cli.dir}/LICENSE.txt"/>
|
||||||
|
<copy file="${basedir}/README.txt" tofile="${cli.dir}/README.txt"/>
|
||||||
|
|
||||||
|
<zip destfile="${dist.dir}/gridworks-${version}-cli.zip" basedir="${cli.dir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete file="${build.dir}/gridworks.jar" />
|
<delete file="${build.dir}/gridworks.jar" />
|
||||||
<delete dir="${classes.dir}" />
|
<delete dir="${classes.dir}" />
|
||||||
|
23
gridworks
23
gridworks
@ -49,6 +49,8 @@ and <action> is one of
|
|||||||
|
|
||||||
make_dmg <version> ........ Make MacOSX DMG distribution
|
make_dmg <version> ........ Make MacOSX DMG distribution
|
||||||
make_exe <version> ........ Make Windows EXE distribution
|
make_exe <version> ........ Make Windows EXE distribution
|
||||||
|
make_cli <version> ........ Make zip distribution to be run at command line
|
||||||
|
make_all <version> ........ Make all distributions
|
||||||
|
|
||||||
clean ..................... Clean compiled classes
|
clean ..................... Clean compiled classes
|
||||||
distclean ................. Remove all generated files
|
distclean ................. Remove all generated files
|
||||||
@ -147,6 +149,12 @@ get_version() {
|
|||||||
NUM_VERSION=`echo $VERSION | sed 's/[a-zA-Z]//g'`
|
NUM_VERSION=`echo $VERSION | sed 's/[a-zA-Z]//g'`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
make_all() {
|
||||||
|
make_dmg $1
|
||||||
|
make_exe $1
|
||||||
|
make_cli $1
|
||||||
|
}
|
||||||
|
|
||||||
make_exe() {
|
make_exe() {
|
||||||
check_macosx
|
check_macosx
|
||||||
dist_prepare
|
dist_prepare
|
||||||
@ -156,6 +164,15 @@ make_exe() {
|
|||||||
ant exe
|
ant exe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
make_cli() {
|
||||||
|
check_macosx
|
||||||
|
dist_prepare
|
||||||
|
launch4j_prepare
|
||||||
|
get_version $1
|
||||||
|
|
||||||
|
ant cli
|
||||||
|
}
|
||||||
|
|
||||||
make_dmg() {
|
make_dmg() {
|
||||||
check_macosx
|
check_macosx
|
||||||
dist_prepare
|
dist_prepare
|
||||||
@ -388,6 +405,12 @@ case "$ACTION" in
|
|||||||
make_exe)
|
make_exe)
|
||||||
make_exe $1;;
|
make_exe $1;;
|
||||||
|
|
||||||
|
make_cli)
|
||||||
|
make_cli $1;;
|
||||||
|
|
||||||
|
make_all)
|
||||||
|
make_all $1;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
usage; ;;
|
usage; ;;
|
||||||
esac
|
esac
|
||||||
|
@ -11,8 +11,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import com.metaweb.gridworks.browsing.Engine;
|
import com.metaweb.gridworks.browsing.Engine;
|
||||||
import com.metaweb.gridworks.commands.Command;
|
import com.metaweb.gridworks.commands.Command;
|
||||||
import com.metaweb.gridworks.exporters.Exporter;
|
import com.metaweb.gridworks.exporters.Exporter;
|
||||||
|
import com.metaweb.gridworks.exporters.HtmlTableExporter;
|
||||||
import com.metaweb.gridworks.exporters.TripleloaderExporter;
|
import com.metaweb.gridworks.exporters.TripleloaderExporter;
|
||||||
import com.metaweb.gridworks.exporters.TsvExporter;
|
import com.metaweb.gridworks.exporters.TsvExporter;
|
||||||
|
import com.metaweb.gridworks.exporters.XlsExporter;
|
||||||
import com.metaweb.gridworks.model.Project;
|
import com.metaweb.gridworks.model.Project;
|
||||||
|
|
||||||
public class ExportRowsCommand extends Command {
|
public class ExportRowsCommand extends Command {
|
||||||
@ -25,11 +27,14 @@ public class ExportRowsCommand extends Command {
|
|||||||
Engine engine = getEngine(request, project);
|
Engine engine = getEngine(request, project);
|
||||||
String format = request.getParameter("format");
|
String format = request.getParameter("format");
|
||||||
|
|
||||||
PrintWriter writer = response.getWriter();
|
|
||||||
|
|
||||||
Exporter exporter = null;
|
Exporter exporter = null;
|
||||||
if ("tripleloader".equalsIgnoreCase(format)) {
|
if ("tripleloader".equalsIgnoreCase(format)) {
|
||||||
exporter = new TripleloaderExporter();
|
exporter = new TripleloaderExporter();
|
||||||
|
} else if ("html".equalsIgnoreCase(format)) {
|
||||||
|
exporter = new HtmlTableExporter();
|
||||||
|
} else if ("xls".equalsIgnoreCase(format)) {
|
||||||
|
exporter = new XlsExporter();
|
||||||
} else {
|
} else {
|
||||||
exporter = new TsvExporter();
|
exporter = new TsvExporter();
|
||||||
}
|
}
|
||||||
@ -37,8 +42,12 @@ public class ExportRowsCommand extends Command {
|
|||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
response.setHeader("Content-Type", exporter.getContentType());
|
response.setHeader("Content-Type", exporter.getContentType());
|
||||||
|
|
||||||
exporter.export(project, new Properties(), engine, writer);
|
if (exporter.takeWriter()) {
|
||||||
|
PrintWriter writer = response.getWriter();
|
||||||
|
exporter.export(project, new Properties(), engine, writer);
|
||||||
|
} else {
|
||||||
|
exporter.export(project, new Properties(), engine, response.getOutputStream());
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
respondException(response, e);
|
respondException(response, e);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.metaweb.gridworks.exporters;
|
package com.metaweb.gridworks.exporters;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@ -10,5 +11,9 @@ import com.metaweb.gridworks.model.Project;
|
|||||||
public interface Exporter {
|
public interface Exporter {
|
||||||
public String getContentType();
|
public String getContentType();
|
||||||
|
|
||||||
|
public boolean takeWriter();
|
||||||
|
|
||||||
|
public void export(Project project, Properties options, Engine engine, OutputStream outputStream) throws IOException;
|
||||||
|
|
||||||
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException;
|
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
package com.metaweb.gridworks.exporters;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
|
|
||||||
|
import com.metaweb.gridworks.ProjectManager;
|
||||||
|
import com.metaweb.gridworks.browsing.Engine;
|
||||||
|
import com.metaweb.gridworks.browsing.FilteredRows;
|
||||||
|
import com.metaweb.gridworks.browsing.RowVisitor;
|
||||||
|
import com.metaweb.gridworks.model.Cell;
|
||||||
|
import com.metaweb.gridworks.model.Column;
|
||||||
|
import com.metaweb.gridworks.model.Project;
|
||||||
|
import com.metaweb.gridworks.model.Row;
|
||||||
|
|
||||||
|
public class HtmlTableExporter implements Exporter {
|
||||||
|
public String getContentType() {
|
||||||
|
return "text/html";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean takeWriter() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void export(Project project, Properties options, Engine engine,
|
||||||
|
OutputStream outputStream) throws IOException {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException {
|
||||||
|
writer.write("<html>\n");
|
||||||
|
writer.write("<head><title>");
|
||||||
|
writer.write(ProjectManager.singleton.getProjectMetadata(project.id).getName());
|
||||||
|
writer.write("</title></head>\n");
|
||||||
|
|
||||||
|
writer.write("<body>\n");
|
||||||
|
writer.write("<table>\n");
|
||||||
|
|
||||||
|
writer.write("<tr>");
|
||||||
|
{
|
||||||
|
for (Column column : project.columnModel.columns) {
|
||||||
|
writer.write("<th>");
|
||||||
|
writer.write(column.getName());
|
||||||
|
writer.write("</th>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writer.write("</tr>\n");
|
||||||
|
|
||||||
|
{
|
||||||
|
RowVisitor visitor = new RowVisitor() {
|
||||||
|
Writer writer;
|
||||||
|
|
||||||
|
public RowVisitor init(Writer writer) {
|
||||||
|
this.writer = writer;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean visit(Project project, int rowIndex, Row row, boolean contextual, boolean includeDependent) {
|
||||||
|
try {
|
||||||
|
writer.write("<tr>");
|
||||||
|
|
||||||
|
for (Column column : project.columnModel.columns) {
|
||||||
|
writer.write("<td>");
|
||||||
|
|
||||||
|
int cellIndex = column.getCellIndex();
|
||||||
|
if (cellIndex < row.cells.size()) {
|
||||||
|
Cell cell = row.cells.get(cellIndex);
|
||||||
|
if (cell != null && cell.value != null) {
|
||||||
|
Object v = cell.value;
|
||||||
|
writer.write(v instanceof String ? ((String) v) : v.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.write("</td>");
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.write("</tr>\n");
|
||||||
|
} catch (IOException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}.init(writer);
|
||||||
|
|
||||||
|
FilteredRows filteredRows = engine.getAllFilteredRows(true);
|
||||||
|
filteredRows.accept(project, visitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.write("</table>\n");
|
||||||
|
writer.write("</body>\n");
|
||||||
|
writer.write("</html>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,12 @@
|
|||||||
package com.metaweb.gridworks.exporters;
|
package com.metaweb.gridworks.exporters;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
|
|
||||||
import com.metaweb.gridworks.browsing.Engine;
|
import com.metaweb.gridworks.browsing.Engine;
|
||||||
import com.metaweb.gridworks.model.Project;
|
import com.metaweb.gridworks.model.Project;
|
||||||
import com.metaweb.gridworks.protograph.Protograph;
|
import com.metaweb.gridworks.protograph.Protograph;
|
||||||
@ -15,6 +18,15 @@ public class TripleloaderExporter implements Exporter {
|
|||||||
return "application/x-unknown";
|
return "application/x-unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean takeWriter() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void export(Project project, Properties options, Engine engine,
|
||||||
|
OutputStream outputStream) throws IOException {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public void export(Project project, Properties options, Engine engine,
|
public void export(Project project, Properties options, Engine engine,
|
||||||
Writer writer) throws IOException {
|
Writer writer) throws IOException {
|
||||||
|
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.metaweb.gridworks.exporters;
|
package com.metaweb.gridworks.exporters;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
|
|
||||||
import com.metaweb.gridworks.browsing.Engine;
|
import com.metaweb.gridworks.browsing.Engine;
|
||||||
import com.metaweb.gridworks.browsing.FilteredRows;
|
import com.metaweb.gridworks.browsing.FilteredRows;
|
||||||
import com.metaweb.gridworks.browsing.RowVisitor;
|
import com.metaweb.gridworks.browsing.RowVisitor;
|
||||||
@ -17,6 +20,15 @@ public class TsvExporter implements Exporter {
|
|||||||
return "text/plain";
|
return "text/plain";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean takeWriter() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void export(Project project, Properties options, Engine engine,
|
||||||
|
OutputStream outputStream) throws IOException {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException {
|
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException {
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (Column column : project.columnModel.columns) {
|
for (Column column : project.columnModel.columns) {
|
||||||
|
115
src/main/java/com/metaweb/gridworks/exporters/XlsExporter.java
Normal file
115
src/main/java/com/metaweb/gridworks/exporters/XlsExporter.java
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
package com.metaweb.gridworks.exporters;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFHyperlink;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
|
||||||
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
|
|
||||||
|
import com.metaweb.gridworks.ProjectManager;
|
||||||
|
import com.metaweb.gridworks.browsing.Engine;
|
||||||
|
import com.metaweb.gridworks.browsing.FilteredRows;
|
||||||
|
import com.metaweb.gridworks.browsing.RowVisitor;
|
||||||
|
import com.metaweb.gridworks.model.Cell;
|
||||||
|
import com.metaweb.gridworks.model.Column;
|
||||||
|
import com.metaweb.gridworks.model.Project;
|
||||||
|
import com.metaweb.gridworks.model.Row;
|
||||||
|
|
||||||
|
public class XlsExporter implements Exporter {
|
||||||
|
public String getContentType() {
|
||||||
|
return "application/xls";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean takeWriter() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void export(Project project, Properties options, Engine engine, Writer writer) throws IOException {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void export(Project project, Properties options, Engine engine,
|
||||||
|
OutputStream outputStream) throws IOException {
|
||||||
|
|
||||||
|
Workbook wb = new HSSFWorkbook();
|
||||||
|
Sheet s = wb.createSheet();
|
||||||
|
wb.setSheetName(0, ProjectManager.singleton.getProjectMetadata(project.id).getName());
|
||||||
|
|
||||||
|
int rowCount = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
org.apache.poi.ss.usermodel.Row r = s.createRow(rowCount++);
|
||||||
|
|
||||||
|
int cellCount = 0;
|
||||||
|
for (Column column : project.columnModel.columns) {
|
||||||
|
org.apache.poi.ss.usermodel.Cell c = r.createCell(cellCount++);
|
||||||
|
c.setCellValue(column.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
RowVisitor visitor = new RowVisitor() {
|
||||||
|
Sheet sheet;
|
||||||
|
int rowCount;
|
||||||
|
|
||||||
|
public RowVisitor init(Sheet sheet, int rowCount) {
|
||||||
|
this.sheet = sheet;
|
||||||
|
this.rowCount = rowCount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean visit(Project project, int rowIndex, Row row, boolean contextual, boolean includeDependent) {
|
||||||
|
org.apache.poi.ss.usermodel.Row r = sheet.createRow(rowCount++);
|
||||||
|
|
||||||
|
int cellCount = 0;
|
||||||
|
for (Column column : project.columnModel.columns) {
|
||||||
|
org.apache.poi.ss.usermodel.Cell c = r.createCell(cellCount++);
|
||||||
|
|
||||||
|
int cellIndex = column.getCellIndex();
|
||||||
|
if (cellIndex < row.cells.size()) {
|
||||||
|
Cell cell = row.cells.get(cellIndex);
|
||||||
|
if (cell != null && cell.value != null) {
|
||||||
|
Object v = cell.value;
|
||||||
|
if (v instanceof Number) {
|
||||||
|
c.setCellValue(((Number) v).doubleValue());
|
||||||
|
} else if (v instanceof Boolean) {
|
||||||
|
c.setCellValue(((Boolean) v).booleanValue());
|
||||||
|
} else if (v instanceof Date) {
|
||||||
|
c.setCellValue((Date) v);
|
||||||
|
} else if (v instanceof Calendar) {
|
||||||
|
c.setCellValue((Calendar) v);
|
||||||
|
} else if (v instanceof String) {
|
||||||
|
c.setCellValue((String) v);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cell.recon != null && cell.recon.match != null) {
|
||||||
|
HSSFHyperlink hl = new HSSFHyperlink(HSSFHyperlink.LINK_URL);
|
||||||
|
hl.setLabel(cell.recon.match.topicName);
|
||||||
|
hl.setAddress("http://www.freebase.com/view" + cell.recon.match.topicID);
|
||||||
|
|
||||||
|
c.setHyperlink(hl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}.init(s, rowCount);
|
||||||
|
|
||||||
|
FilteredRows filteredRows = engine.getAllFilteredRows(true);
|
||||||
|
filteredRows.accept(project, visitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
wb.write(outputStream);
|
||||||
|
outputStream.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -20,6 +20,15 @@ MenuBar.prototype._initializeUI = function() {
|
|||||||
"label": "Tab-Separated Value",
|
"label": "Tab-Separated Value",
|
||||||
"click": function() { self._doExportRows("tsv", "tsv"); }
|
"click": function() { self._doExportRows("tsv", "tsv"); }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "HTML Table",
|
||||||
|
"click": function() { self._doExportRows("html", "html"); }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Excel",
|
||||||
|
"click": function() { self._doExportRows("xls", "xls"); }
|
||||||
|
},
|
||||||
|
{},
|
||||||
{
|
{
|
||||||
"label": "Tripleloader",
|
"label": "Tripleloader",
|
||||||
"click": function() { self._doExportRows("tripleloader", "txt"); }
|
"click": function() { self._doExportRows("tripleloader", "txt"); }
|
||||||
@ -137,11 +146,12 @@ MenuBar.prototype._deactivateMenu = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
MenuBar.prototype._doExportRows = function(format, ext) {
|
MenuBar.prototype._doExportRows = function(format, ext) {
|
||||||
|
var name = $.trim(theProject.metadata.name.replace(/\W/g, ' ')).replace(/\s+/g, '-');
|
||||||
var form = document.createElement("form");
|
var form = document.createElement("form");
|
||||||
$(form)
|
$(form)
|
||||||
.css("display", "none")
|
.css("display", "none")
|
||||||
.attr("method", "post")
|
.attr("method", "post")
|
||||||
.attr("action", "/command/export-rows/gridworks_" + theProject.id + "." + ext)
|
.attr("action", "/command/export-rows/" + name + "." + ext)
|
||||||
.attr("target", "gridworks-export");
|
.attr("target", "gridworks-export");
|
||||||
|
|
||||||
$('<input />')
|
$('<input />')
|
||||||
@ -166,7 +176,7 @@ MenuBar.prototype._doExportRows = function(format, ext) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
MenuBar.prototype._exportProject = function() {
|
MenuBar.prototype._exportProject = function() {
|
||||||
var name = theProject.metadata.name.replace(/\W/g, ' ').replace(/\s+/g, '-');
|
var name = $(theProject.metadata.name.replace(/\W/g, ' ')).replace(/\s+/g, '-');
|
||||||
var form = document.createElement("form");
|
var form = document.createElement("form");
|
||||||
$(form)
|
$(form)
|
||||||
.css("display", "none")
|
.css("display", "none")
|
||||||
|
Loading…
Reference in New Issue
Block a user