Commit 0c4b2a08 authored by Edileuton Henrique de Oliveira's avatar Edileuton Henrique de Oliveira

Merge branch 'master' of git.c3sl.ufpr.br:./proinfodata/unstable

parents 61aa7df5 49d544f8
......@@ -3,6 +3,10 @@ package controllers;
import java.io.*;
import java.util.ArrayList;
import java.awt.*;
import javax.swing.JOptionPane;
import play.*;
import play.mvc.*;
import play.data.*;
......@@ -11,7 +15,8 @@ import models.*;
public class Install extends Controller {
private static String MAKE_PACKAGE_BIN = "/home/proinfodata/conf/make-package.sh";
private static String MAKE_PACKAGE_BIN_L = "/home/proinfodata/conf/make-package.sh";
private static String MAKE_PACKAGE_BIN_W = "/home/proinfodata/conf/build-windows-installer.sh";
private static String MAKE_OUTPUT_DIR = "/tmp/";
public static Result index() {
......@@ -31,8 +36,10 @@ public class Install extends Controller {
String proxyUser = requestData.get("proxyUser");
String proxyPass = requestData.get("proxyPass");
if ((inep == null) || (inep.length() < 6) || (inep.length() > 12))
return badRequest("Inep inválido");
if ((inep == null) || (inep.length() < 6) || (inep.length() > 12)) {
JOptionPane.showMessageDialog(null, "Inep Inválido", "INEP", JOptionPane.ERROR_MESSAGE);
return ok(views.html.install.index.render());
}
School school = null;
......@@ -44,12 +51,22 @@ public class Install extends Controller {
return internalServerError();
}
if (school == null)
return badRequest("Inep inválido");
if (school == null) {
JOptionPane.showMessageDialog(null, "Inep Inválido", "INEP", JOptionPane.ERROR_MESSAGE);
return ok(views.html.install.index.render());
}
// build the package
String command = "sh " + MAKE_PACKAGE_BIN + " " + inep;
String osStr = requestData.get("os");
boolean osLinux = false;
if (osStr.equals("true")) osLinux = true;
String command = "";
if (osLinux)
command = "sh " + MAKE_PACKAGE_BIN_L + " " + inep;
else
command = "sh " + MAKE_PACKAGE_BIN_W + " " + inep;
if (useProxy) {
command += " " + proxyHost + " " + proxyPort + " " +
proxyUser + " " + proxyPass;
......@@ -74,7 +91,12 @@ public class Install extends Controller {
return internalServerError();
}
String filename = "agent_"+inep+".run";
String filename = "";
if (osLinux)
filename = "agent_"+inep+".run";
else
filename = "ProInfoData-"+inep+".exe";
response().setHeader("Content-Disposition", "attachment; filename="+filename);
return ok(new File(MAKE_OUTPUT_DIR+filename));
}
......
......@@ -23,11 +23,6 @@
@install(scripts=scripts) {
<h1 class="title">Instalação</h1>
<p class="small indent4">
Se você está usando o Windows, para instalar o programa de
acompanhamento PROINFODATA, baixe o agente
<a href="/download/proinfodata_windows_1.0.0.exe">aqui</a>.
</p>
<p class="small indent4">
Caso você esteja usando o Linux, digite o código INEP referente
......@@ -93,6 +88,21 @@ para maiores detalhes.
</div>
</div>
<div class="well form-horizontal">
<div class="control-group">
<label class="control-label">Qual sistema utilizado?</label>
<div class="controls">
<label class="radio inline">
<input type="radio" name="os" id="useLinux" value="true" checked> Linux
</label>
<label class="radio inline">
<input type="radio" name="os" id="dontUseLinux" value="false"> Windows
</label>
</div>
</div>
</div>
<div class="pull-right">
<input type="submit" class="btn btn-primary" value="Gerar Pacote">
</div>
......
......@@ -5,7 +5,7 @@ import play.Project._
object ApplicationBuild extends Build {
val appName = "proinfodata-web"
val appVersion = "2.0.1"
val appVersion = "2.0.2"
val appDependencies = Seq(
javaCore,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment