Skip to content

Commit

Permalink
* Proof status is calculated but only shown when "Check proof" is cli…
Browse files Browse the repository at this point in the history
…cked.
  • Loading branch information
spockz committed Jan 18, 2012
1 parent 0ce09c1 commit fe1f604
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions resources/static/brunch/build/web/css/main.css
Expand Up @@ -29,6 +29,7 @@ ul.tree,ul.tree ul{list-style-type:none;margin:0;padding:0}
.greenField{background-color:#7fff69}
.whiteField{background-color:#fff}
.blueField{background-color:#8fffff}
.noClue .redField, .noClue .yellowField, .noClue .greenField {background-color:#FEFEFE }
.box{width:12px;height:12px;border:1px solid #000;float:left;clear:both;margin-right:5px}
.rule-list-item{background-image:url("/img/drag.png");background-repeat:no-repeat;background-position:8px 8px;background-color:#fafafa;width:490px;padding:5px 5px 8px 5px;text-indent:30px;margin:0;border:1px solid #000;position:absolute !important}
#color-coding-list{margin-left:10px;padding-left:0}
Expand Down
2 changes: 1 addition & 1 deletion resources/static/hjs/Templates.hs
Expand Up @@ -2,7 +2,7 @@ module Templates where

import Prolog (Status(..))

home = "<div class=\"yui3-g\"> <div class=\"yui3-u-1-2\"> <div class=\"content\"> <h2>Proof Tree</h2> <div id=\"proof-tree-div\"><!-- TREE GOES HERE --></div> <div id=\"subst\">Substitute <input type=\"text\" id=\"txtSubstSub\" style=\"width: 50px\" /> for <input type=\"text\" id=\"txtSubstFor\" style=\"width: 50px\" /> <input type=\"button\" id=\"btnSubst\" value=\"Substitute\" /> (e.g. substitute bea for X0) </div> <input type=\"button\" id=\"btnCheck\" value=\"Check Proof\" /> <input type=\"button\" id=\"btnReset\" value=\"Reset Tree\" /> <!-- <h3>Note</h3> <p class=\"lhsText\">Due to limitations in the current version of the software, you might see variables with the same name in different text fields in the tree. However, these are not necessarily the same variable! Double-check to see which rules you can apply and which variables those rules have.</p> --> <h3>Color coding help</h3> <ul id=\"color-coding-list\"> <li><div class=\"box redField\"></div> Incorrect rule application</li> <li><div class=\"box yellowField\"></div> Incomplete proof</li> <li><div class=\"box greenField\"></div> Correct rule</li> <li><div class=\"box blueField\"></div> Syntax error</li> </ul> <h3>Example data</h3> <p class=\"lhsText\"> Example data containing the Dutch royal family, the list structure and lookup, and the natural numbers (as discussed in the JCU lecture notes) can be loaded by <a href=\"/load-example\">clicking this link</a>. Beware that this will replace all your existing rules! </p> </div> </div> <div class=\"yui3-u-1-2\"> <div class=\"content\"> <h2>Stored Rules</h2> <p>Drag a rule form the list below to a field containing a term in the tree on the left.</p> <div id=\"rules-list-div\"><!-- LIST GOES HERE --></div> <div id=\"divListAdd\"> <input type=\"text\" id=\"txtAddRule\" /> <input type=\"button\" value=\"Add\" id=\"btnAddRule\" /> </div> </div> </div></div>"
home = "<div class=\"yui3-g\"> <div class=\"yui3-u-1-2\"> <div class=\"content\"> <h2>Proof Tree</h2> <div id=\"proof-tree-div\" class=\"noClue\"><!-- TREE GOES HERE --></div> <div id=\"subst\">Substitute <input type=\"text\" id=\"txtSubstSub\" style=\"width: 50px\" /> for <input type=\"text\" id=\"txtSubstFor\" style=\"width: 50px\" /> <input type=\"button\" id=\"btnSubst\" value=\"Substitute\" /> (e.g. substitute bea for X0) </div> <input type=\"button\" id=\"btnCheck\" value=\"Check Proof\" /> <input type=\"button\" id=\"btnReset\" value=\"Reset Tree\" /> <!-- <h3>Note</h3> <p class=\"lhsText\">Due to limitations in the current version of the software, you might see variables with the same name in different text fields in the tree. However, these are not necessarily the same variable! Double-check to see which rules you can apply and which variables those rules have.</p> --> <h3>Color coding help</h3> <ul id=\"color-coding-list\"> <li><div class=\"box redField\"></div> Incorrect rule application</li> <li><div class=\"box yellowField\"></div> Incomplete proof</li> <li><div class=\"box greenField\"></div> Correct rule</li> <li><div class=\"box blueField\"></div> Syntax error</li> </ul> <h3>Example data</h3> <p class=\"lhsText\"> Example data containing the Dutch royal family, the list structure and lookup, and the natural numbers (as discussed in the JCU lecture notes) can be loaded by <a href=\"/load-example\">clicking this link</a>. Beware that this will replace all your existing rules! </p> </div> </div> <div class=\"yui3-u-1-2\"> <div class=\"content\"> <h2>Stored Rules</h2> <p>Drag a rule form the list below to a field containing a term in the tree on the left.</p> <div id=\"rules-list-div\"><!-- LIST GOES HERE --></div> <div id=\"divListAdd\"> <input type=\"text\" id=\"txtAddRule\" /> <input type=\"button\" value=\"Add\" id=\"btnAddRule\" /> </div> </div> </div></div>"

proof_tree_item term treeLbl disabled status =
"<div class=\"tree_item dropzone\"> " ++ treeLbl ++
Expand Down
8 changes: 6 additions & 2 deletions resources/static/hjs/jcu.hs
Expand Up @@ -81,7 +81,7 @@ initialize = do -- Rendering

addRuleTree

registerEvents $ [("#btnCheck" , "click" , noevent)
registerEvents $ [("#btnCheck" , "click" , toggleClue)
,("#btnAddRule", "click" , addRuleEvent)
,("#btnReset" , "click" , noevent)
,("#txtAddRule", "keypress", noevent)
Expand All @@ -92,6 +92,9 @@ initialize = do -- Rendering
noop = (\x y z -> return ())
noevent :: EventHandler
noevent x = return False
toggleClue :: EventHandler
toggleClue _ = do toggleClassString "#proof-tree-div" "noClue"
return True

emptyProof :: Proof
emptyProof = T.Node (Var "") []
Expand Down Expand Up @@ -156,7 +159,8 @@ buildRuleUl node status =
let term = fromJS elemVal :: String
case tryParseTerm term of
(Just t) -> replaceRuleTree $ T.Node t []
_ -> addClass this "blueField"
_ -> do removeClass this "blueField yellowField redField whiteField greenField"
addClass this "blueField"
return False

replaceRuleTree :: Proof -> IO ()
Expand Down

0 comments on commit fe1f604

Please sign in to comment.