This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready( function() { | |
$('#container_id').fileTree({ | |
root: '/some/folder/', | |
script: 'jqueryFileTree.asp', | |
expandSpeed: 1000, | |
collapseSpeed: 1000, | |
multiFolder: false | |
}, function(file) { | |
alert(file); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a utility class for building up the bits that encodes a char as we trawl down the CodeTree | |
case class Coding(char: Char, bits: List[Bit]) { | |
def addBit(b: Bit): Coding = this.copy(bits = b :: bits) | |
} | |
// this method builds up a list of codings for each character in the tree. E.g | |
// for a input of Fork(Fork(Leaf('a', 2), Leaf('b', 3), List('a', 'b'), 5), Leaf('d', 4), List('a', 'b', 'd'), 9) | |
// it returns List(Coding(a,List(0, 0)), Coding(b,List(0, 1)), Coding(d,List(1))) | |
// | |
// recurse down the tree, at each fork, add '0' to each bit pattern from the codings formed from the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val MustBeAdmin = If(() => User.superUser_?, "") | |
val entries = List(Menu("Home") / "index" >> LocGroup("main"), | |
Menu("Page 3") / "page3" >> LocGroup("main") >> PlaceHolder submenus ( | |
Menu("Page 3a") / "page3a" , | |
Menu("Page 3b") / "page3b" , | |
Menu("Page 3c") / "page3c", | |
Menu("Admin 4") / "admin4" >> MustBeAdmin ), | |
Menu("Admin") / "dummyAdmin" >> MustBeAdmin >> LocGroup("main") >> PlaceHolder submenus ( | |
Menu("Admin 1") / "admin1" , |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def signupMailBody(user: User, validationLink: String): Elem = { | |
val templatePath = List("user", "signupmailbody") | |
val template = Templates.findRawTemplate(templatePath, S.locale) | |
template.map(t => { | |
val out = ("#dear" #> user.shortName & | |
"#validationLink [href]" #> validationLink)(t) | |
out.head.asInstanceOf[Elem] | |
}).openOr { | |
val msg = "template: " + templatePath + " not found" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val contextPath = LiftRules.context match { | |
case c: HTTPServletContext => Full(c.path) | |
case _ => Empty | |
} | |
info("Context Path is: " + contextPath ) | |
val jettyResourceDir = Box.!!(System.getProperty("jetty.resource.dir")) | |
info("got jetty.resource.dir from system properties: " + jettyResourceDir) | |
val whereToLook = jettyResourceDir.flatMap( dir => { | |
contextPath.map( cp => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val contextPath = LiftRules.context match { | |
case c: HTTPServletContext => Full(c.path) | |
case _ => Empty | |
} | |
info("Context Path is: " + contextPath ) | |
val jettyResourceDir = Box.!!(System.getProperty("jetty.resource.dir")) | |
info("got jetty.resource.dir from system properties: " + jettyResourceDir) | |
val whereToLook = jettyResourceDir.flatMap( dir => { | |
contextPath.map( cp => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def buynow(xhtml: NodeSeq): NodeSeq = | |
<form name="_xclick" | |
action={PaypalRules.connection.vend().protocol+"://"+PaypalRules.mode.vend().domain+"/cgi-bin/webscr"} | |
method="post"> | |
<input type="hidden" name="cmd" value="_xclick" /> | |
<input type="hidden" name="amount" value={amount.toString} /> | |
<input type="hidden" name="currency_code" value={PaypalRules.currency.vend()} /> | |
{ values.-("amount","currency_code","cmd","submit") | |
.map(x => <input type="hidden" name={x._1} value={x._2} />) } | |
<input type="image" src={PaypalRules.button.vend()} name="submit" alt="" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object PaypalTransactionStatus extends Enumeration { | |
val CancelledReversalPayment = Value(1, "Cancelled_Reversal") | |
val ClearedPayment = Value(2, "Cleared") | |
val CompletedPayment = Value(3, "Completed") | |
val DeniedPayment = Value(4, "Denied") | |
val ExpiredPayment = Value(5, "Expired") | |
val FailedPayment = Value(6, "Failed") | |
val PendingPayment = Value(7, "Pending") | |
val RefundedPayment = Value(8, "Refunded") | |
val ReturnedPayment = Value(9, "Returned") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def createNotFound(f: Failure): LiftResponse = | |
NamedPF((this, Full(f)), LiftRules.uriNotFound.toList) match { | |
case DefaultNotFound => Req.defaultCreateNotFound(this) | |
case NotFoundAsTemplate(path) => notFoundViaTemplate(path) | |
case NotFoundAsResponse(resp) => resp | |
case NotFoundAsNode(node) => LiftRules.convertResponse((node, 404), | |
S.getHeaders(LiftRules.defaultHeaders((node, this))), | |
S.responseCookies, | |
this) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S.functionLifespan(true) { | |
pf(toMatch)() match { | |
... | |
case f: Failure => | |
(true, Full(liftSession.checkRedirect(req.createNotFound(f)))) | |
} | |
} |
NewerOlder