Skip to content
Snippets Groups Projects
Commit e784e2cf authored by Philippe Suter's avatar Philippe Suter
Browse files

many fixes. Now vaguely usable.

parent fdcf1309
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -31,36 +31,13 @@ class Boot {
DB.defineConnectionManager(DefaultConnectionIdentifier, vendor)
}
// Use Lift's Mapper ORM to populate the database
// you don't need to use Mapper to use Lift... use
// any ORM you want
// Schemifier.schemify(true, Schemifier.infoF _, User)
// where to search snippet
LiftRules.addToPackages("code")
// Build SiteMap
def sitemap = SiteMap(
Menu.i("Home") / "index", //>> User.AddUserMenusAfter, // the simple way to declare a menu
// more complex because this menu allows anything in the
// /static path to be visible
Menu(Loc("Static", Link(List("static"), true, "/static/index"),
"Static Content")))
//def sitemapMutators = User.sitemapMutator
// set the sitemap. Note if you don't want access control for
// each page, just comment this line out.
//LiftRules.setSiteMapFunc(() => sitemapMutators(sitemap))
//Show the spinny image when an Ajax call starts
LiftRules.ajaxStart =
Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
// Make the spinny image go away when it ends
LiftRules.ajaxEnd =
Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
Menu.i("Home") / "index"
)
// Force the request to be UTF-8
LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
......@@ -70,7 +47,11 @@ class Boot {
// Use HTML5 for rendering
LiftRules.htmlProperties.default.set((r: Req) =>
new Html5Properties(r.userAgent))
new Html5Properties(r.userAgent))
// Make laraserver happy with itself.
// LiftRules.ajaxPath = "leon/ajax_request"
// LiftRules.cometPath = "leon/comet_request"
// Make a transaction span the whole HTTP request
S.addAround(DB.buildLoanWrapper)
......
......@@ -27,16 +27,22 @@ case object Clear
// A funcheck/purescala compliant reporter that sends the
// strings to an actor rather than printing them.
class ActorReporter(dest : CodeProcessor) extends Reporter {
private val BUFSZ : Int = 3
private val BUFSZ : Int = 10
private val buffer : Array[String] = new Array[String](BUFSZ)
private var id : Int = 0
def output(msg : Any) : Unit = {
buffer(id) = msg.toString
id += 1
if(id == BUFSZ) {
send()
id = 0
val str = msg.toString
val trimmed = str.trim
val exclude = trimmed.startsWith("-") || trimmed.startsWith("Trying")
if(!exclude) {
buffer(id) = str
id += 1
if(id == BUFSZ) {
send()
id = 0
}
}
}
......@@ -91,23 +97,24 @@ object QueryHandler extends LiftActor {
class CodeProcessor extends CometActor {
override def defaultPrefix = Full("codeprocessor")
private var msgs : List[String] = Nil
private var msgXML : NodeSeq = Text("Waiting.")
override def lowPriority : PartialFunction[Any,Unit] = {
case Clear => {
msgs = Nil
msgXML = Text("Waiting.")
reRender()
partialUpdate(
SetValById("consolebox", "Cleared.")
)
}
case Message(msg) => {
msgs = msgs ::: msg.split('\n').toList
msgXML = msgs.flatMap(m => Seq(Text(m), <br/>))
reRender()
msgs = msg :: msgs
partialUpdate(
SetValById("consolebox", msgs.reverse.mkString("\n"))
)
}
}
def render = bind("consolelines" -> msgXML)
def render = <span></span>
override def fixedRender = bind("inputbox" ->
<lift:form>
......@@ -116,7 +123,12 @@ class CodeProcessor extends CometActor {
QueryHandler ! Query(this, s)
}, "id" -> "codebox")
}
<input type="submit" onClick="editor.save();" id="clicker" value="Groar !" />
{
SHtml.submit("Verify !", () => {}, "id" -> "clicker", "onClick" -> "editor.save();")
}
{
SHtml.textarea("Console.\n", s => {}, "id" -> "consolebox", "onChange" -> "document.getElementById('consolebox').scrollTop=document.getElementById('consolebox').scrollHeight;")
}
</lift:form>
, "consolelines" -> msgXML)
)
}
web/src/main/webapp/images/leonlogo.png

6.01 KiB | W: | H:

web/src/main/webapp/images/leonlogo.png

5.18 KiB | W: | H:

web/src/main/webapp/images/leonlogo.png
web/src/main/webapp/images/leonlogo.png
web/src/main/webapp/images/leonlogo.png
web/src/main/webapp/images/leonlogo.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -16,24 +16,7 @@
<lift:comet type="CodeProcessor">
<div class="contentbox" id="leonmain">
<br />
<codeprocessor:inputbox></codeprocessor:inputbox>
<!--
<form>
<textarea id="codebox">
object Main {
sealed abstract class List
case class Cons(head : Int, tail : List) extends List
case class Nil() extends List
def size(lst : List) : Int = (lst match {
case Cons(_, xs) => 1 + size(xs)
case Nil() => 0
}) ensuring(_ >= 0)
}
</textarea>
<input type="submit" id="clicker" value="Roar!" />
</form> -->
<script type="text/javascript">
// <![CDATA[
var editor = new CodeMirror.fromTextArea("codebox", {
......@@ -45,14 +28,8 @@ stylesheet: "codemirror/scalacolors.css"
});
// ]]>
</script>
</div>
<div class="contentbox" id="console">
<div id="consoletext">
I am the console.</br>
<lift:snippet type="Z3Snippet:versionString"></lift:snippet></br>
<codeprocessor:consolelines>Additional console lines</codeprocessor:consolelines>
</div>
<!-- Server is running <lift:snippet type="Z3Snippet:versionString"></lift:snippet>
<codeprocessor:consolelines>Additional console lines</codeprocessor:consolelines> -->
</div>
</lift:comet>
......
html {
height: 100%;
}
body {
font-family: Arial, Helvetica, Sans-serif;
margin: 0px;
......@@ -6,6 +10,7 @@ body {
background-color: #FFFFFF;
background-repeat: no-repeat;
background-position: 25px 15px;
height: 100%;
}
h2 {
......@@ -39,33 +44,24 @@ div.contentbox {
position: relative;
left: 320px;
width: 700px;
padding: 0px;
margin: 0px;
}
div#title {
top: 10px;
text-align: right;
padding: 0px;
margin: 0px;
height: 80px;
min-height: 80px;
max-height: 80px;
background-image: url('images/leonlogo.png');
background-repeat: no-repeat;
background-position: right bottom;
}
div#leonmain {
position: absolute;
top: 60px;
}
div#console {
position: absolute;
top: 550px;
display: inline;
}
div#logo {
position: absolute;
top: 15px;
left: 25px;
width: 290px;
height: 400px;
background-image: url('images/lionbkg.png');
background-color: #EEEEEE;
}
div#contact {
......@@ -75,21 +71,20 @@ div#contact {
width: 290px;
}
div#allcontent {
height: 100%;
min-height: 100%;
}
div#poweredby {
position: absolute;
position: fixed;
left: 0px;
bottom: 0px;
width: 1020px;
height: 50px;
text-align: center;
display: table-cell;
}
div#ghost {
height: 650px;
z-index: -1000;
}
.middiv {
vertical-align: middle;
background-color: #FFFFFF;
}
.smallnote {
......@@ -119,35 +114,12 @@ li {
}
#clicker {
margin-top: 5px 0px;
margin: 5px 0px;
background-color: transparent;
border: 1px solid #666666;
width: 100%;
}
div#consoletext {
background-color: #EEEEEE;
width: 100%;
font-family: "Lucida Console", monospace;
font-size: 10px;
}
table.consoletable {
width: 32%;
margin: 0px;
padding: 0px;
}
tr.consolerow {
border: none;
border-bottom: 1px dashed #000;
}
td.contacttype {
text-align:right;
vertical-align: top;
}
td.date {
text-align:right;
}
......@@ -158,3 +130,20 @@ textarea#codebox {
width: 700px;
height: 450px;
}
textarea#consolebox {
font-family: "Lucida Console", monospace;
font-size: 11px;
width: 700px;
height: 250px;
border: none;
background-color: #EEEEEE;
padding: 0px;
margin: 0px;
resize: vertical;
}
.consoletext {
font-family: "Lucida Console", monospace;
font-size: 11px;
}
......@@ -3,15 +3,14 @@
<link rel="stylesheet" href="style.css" />
<link rel="icon" type="image/png" href="images/lambda-ico.png" />
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
<script id="json" src="/classpath/json.js" type="text/javascript"></script>
<script id="jquery" src="classpath/jquery.js" type="text/javascript"></script>
<script id="json" src="classpath/json.js" type="text/javascript"></script>
</head>
<body>
<div class="contentbox" id="title">
<img src="images/leonlogo.png" alt="LeonOnline" />
</div>
<div id="allcontent">
<div id="beforefooter">
<div id="logo">&nbsp;</div>
<div class="contentbox" id="title"></div>
<div id="contact">
<p><i>Leon</i> is developed by the <a href="http://lara.epfl.ch" alt="LARA Group EPFL">LARA</a> group at <a href="http://www.epfl.ch">EPFL</a>.</p>
......@@ -19,7 +18,7 @@
<div id="content">The main content will get bound here</div>
<div class="contentbox" id="ghost"></div>
</div>
<div id="poweredby">
<hr />
......@@ -30,5 +29,6 @@
<a href="http://codemirror.net"><img class="middiv" alt="CodeMirror" src="images/codemirrorlogo.png" /></a>&nbsp;&nbsp;&nbsp;
<a href="http://www.epfl.ch"><img class="middiv" alt="EPFL" src="images/epfllogo.png" /></a>
</div>
</div>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment