From 78ce67ae32d62269f920465da1161e07eade8033 Mon Sep 17 00:00:00 2001 From: Etienne Kneuss <ekneuss@gmail.com> Date: Tue, 11 Dec 2012 16:34:10 +0100 Subject: [PATCH] Make leon online more configurable so that it can run on laraserver --- web/app/controllers/Application.scala | 5 ++++- web/app/models/LeonConsole.scala | 3 --- web/app/views/index.scala.html | 6 +++--- web/app/views/main.scala.html | 10 +++++----- web/conf/application.conf | 5 +++++ web/public/stylesheets/leon.css | 4 ++-- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/web/app/controllers/Application.scala b/web/app/controllers/Application.scala index dbff3fa47..ccec9b1ad 100644 --- a/web/app/controllers/Application.scala +++ b/web/app/controllers/Application.scala @@ -15,7 +15,10 @@ object Application extends Controller { val examples = VerificationExamples.allExamples def index = Action { implicit request => - Ok(views.html.index(examples, VerificationExamples.default)) + val prefix = Play.current.configuration.getString("app.prefix").getOrElse("") + val wsURL = Play.current.configuration.getString("app.wsURL").getOrElse(routes.Application.openConsole().webSocketURL()) + + Ok(views.html.index(examples, VerificationExamples.default, prefix, wsURL)) } def getExample(id: Int) = Action { diff --git a/web/app/models/LeonConsole.scala b/web/app/models/LeonConsole.scala index eac20b8c5..ad26ea4f0 100644 --- a/web/app/models/LeonConsole.scala +++ b/web/app/models/LeonConsole.scala @@ -20,9 +20,6 @@ import leon.{LeonContext, Settings, Reporter} import leon.plugin.{TemporaryInputPhase, ExtractionPhase} import leon.verification.AnalysisPhase -import scala.tools.util.PathResolver - - object LeonConsole { def open: Promise[(Iteratee[JsValue,_],Enumerator[JsValue])] = { import ConsoleProtocol._ diff --git a/web/app/views/index.scala.html b/web/app/views/index.scala.html index 09e192c5e..66848e7e1 100644 --- a/web/app/views/index.scala.html +++ b/web/app/views/index.scala.html @@ -1,6 +1,6 @@ -@(exs: List[examples.Example], default: examples.Example)(implicit request: RequestHeader) +@(exs: List[examples.Example], default: examples.Example, prefix: String, websocketURL: String)(implicit request: RequestHeader) -@main("Leon Online") { +@main("Leon Online", prefix) { <div id="allcontent"> <div id="title" class="contentbox"></div> @@ -30,7 +30,7 @@ <script> $(document).ready(function() { var WS = window['MozWebSocket'] ? MozWebSocket : WebSocket - var leonSocket = new WS("@leon.web.controllers.routes.Application.openConsole().webSocketURL()") + var leonSocket = new WS("@websocketURL") var sendMessage = function() { } diff --git a/web/app/views/main.scala.html b/web/app/views/main.scala.html index dd6092d06..5700f9bbf 100644 --- a/web/app/views/main.scala.html +++ b/web/app/views/main.scala.html @@ -1,15 +1,15 @@ -@(title: String)(content: Html) +@(title: String, prefix: String)(content: Html) <!DOCTYPE html> <html> <head> <title>@title</title> - <link href="@routes.Assets.at("images/lambda-ico.png")" type="image/png" rel="icon"> - <link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/leon.css")"> - <script src="@routes.Assets.at("javascripts/jquery-1.8.3.min.js")" type="text/javascript"></script> + <link href="@prefix@routes.Assets.at("images/lambda-ico.png")" type="image/png" rel="icon"> + <link rel="stylesheet" media="screen" href="@prefix@routes.Assets.at("stylesheets/leon.css")"> + <script src="@prefix@routes.Assets.at("javascripts/jquery-1.8.3.min.js")" type="text/javascript"></script> <script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script> - <script src="@routes.Assets.at("javascripts/leon.js")" type="text/javascript"></script> + <script src="@prefix@routes.Assets.at("javascripts/leon.js")" type="text/javascript"></script> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body> diff --git a/web/conf/application.conf b/web/conf/application.conf index 15ffcdf26..4b8aada8e 100644 --- a/web/conf/application.conf +++ b/web/conf/application.conf @@ -45,3 +45,8 @@ logger.play=INFO # Logger provided to your application: logger.application=DEBUG +# This specifies the prefix under which the web page lies, used almost exclusively for the laraserver setup +# app.prefix=/leon + +# Defines a specific URL to the websocket service +# app.wsURL="ws://laraserver.epfl.ch:9000/openConsole" diff --git a/web/public/stylesheets/leon.css b/web/public/stylesheets/leon.css index c60ac9904..ba3362693 100644 --- a/web/public/stylesheets/leon.css +++ b/web/public/stylesheets/leon.css @@ -6,7 +6,7 @@ body { font-family: Arial, Helvetica, Sans-serif; margin: 0px; padding: 0px; - background-image: url('/assets/images/lionbkg.png'); + background-image: url('../images/lionbkg.png'); background-color: #FFFFFF; background-repeat: no-repeat; background-position: 25px 15px; @@ -52,7 +52,7 @@ div#title { width: 700px; min-height: 80px; max-height: 80px; - background-image: url('/assets/images/leonlogo.png'); + background-image: url('../images/leonlogo.png'); background-repeat: no-repeat; background-position: right bottom; } -- GitLab