Permalink
Browse files

Signed-off-by: PHN <nguyen.philip.h@gmail.com>

  • Loading branch information...
0 parents commit c6840a98e0e3b48750dcd0b2c0eedb0dc85c9244 @DoomPirate committed Apr 10, 2011
@@ -0,0 +1,55 @@
+# use glob syntax.
+syntax: glob
+*.ser
+*.class
+*~
+*.bak
+*.off
+*.old
+.DS_Store
+
+# logs
+derby.log
+
+# eclipse conf file
+.settings
+.classpath
+.project
+.manager
+.externalToolBuilders
+
+# ensime/emacs conf files
+.ensime
+.scala_dependencies
+
+# building
+target
+null
+tmp*
+dist
+test-output
+
+# sbt
+target
+lib_managed
+src_managed
+project/boot
+
+# other scm
+.svn
+.CVS
+.hg*
+
+# switch to regexp syntax.
+# syntax: regexp
+# ^\.pc/
+
+# IntelliJ
+*.iml
+*.ipr
+*.iws
+.idea
+
+# Pax Runner (for easy OSGi launching)
+runner
+
@@ -0,0 +1,9 @@
+#Project properties
+#Fri Apr 23 11:24:20 PDT 2010
+project.organization=Lift
+project.name=Lift SBT Template
+sbt.version=0.7.5
+project.version=0.1
+def.scala.version=2.7.7
+build.scala.versions=2.8.1
+project.initialize=false
@@ -0,0 +1,20 @@
+import sbt._
+
+class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) {
+ val liftVersion = "2.3"
+
+ // uncomment the following if you want to use the snapshot repo
+ // val scalatoolsSnapshot = ScalaToolsSnapshots
+
+ // If you're using JRebel for Lift development, uncomment
+ // this line
+ // override def scanDirectories = Nil
+
+ override def libraryDependencies = Set(
+ "net.liftweb" %% "lift-webkit" % liftVersion % "compile",
+ "org.mortbay.jetty" % "jetty" % "6.1.22" % "test",
+ "junit" % "junit" % "4.5" % "test",
+ "ch.qos.logback" % "logback-classic" % "0.9.26",
+ "org.scala-tools.testing" %% "specs" % "1.6.6" % "test"
+ ) ++ super.libraryDependencies
+}
1 sbt
@@ -0,0 +1 @@
+java -Xmx512M -Xss2M -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launcher.jar "$@"
Binary file not shown.
@@ -0,0 +1,2 @@
+set SCRIPT_DIR=%~dp0
+java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -jar "%SCRIPT_DIR%\sbt-launcher.jar" %*
No changes.
No changes.
@@ -0,0 +1,47 @@
+package bootstrap.liftweb
+
+import net.liftweb._
+import util._
+import Helpers._
+
+import common._
+import http._
+import sitemap._
+import Loc._
+
+
+/**
+ * A class that's instantiated early and run. It allows the application
+ * to modify lift's environment
+ */
+class Boot {
+ def boot {
+ // where to search snippet
+ LiftRules.addToPackages("code")
+
+
+
+ //def menu:List[Menu] = code.snippet.MenuStatic.menus ::: code.snippet.MenuParam.menus
+ def menu:List[Menu] = code.snippet.MenuStatic.menus ::: code.snippet.MenuImmediateParam.menus ::: code.snippet.MenuParam.menus// ::: code.snippet.MenuTwoParam.menus
+ //def sitemap = SiteMap(menu:_*)
+
+ // set the sitemap. Note if you don't want access control for
+ // each page, just comment this line out.
+ LiftRules.setSiteMap(SiteMap(menu:_*))
+
+ //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)
+
+ // Use jQuery 1.4
+ LiftRules.jsArtifacts = net.liftweb.http.js.jquery.JQuery14Artifacts
+
+ // Force the request to be UTF-8
+ LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
+
+ }
+}
No changes.
@@ -0,0 +1,55 @@
+package code
+package lib
+
+import net.liftweb._
+import http._
+import util._
+import common._
+import java.util.Date
+
+/**
+ * A factory for generating new instances of Date. You can create
+ * factories for each kind of thing you want to vend in your application.
+ * An example is a payment gateway. You can change the default implementation,
+ * or override the default implementation on a session, request or current call
+ * stack basis.
+ */
+object DependencyFactory extends Factory {
+ implicit object time extends FactoryMaker(Helpers.now _)
+
+ /**
+ * objects in Scala are lazily created. The init()
+ * method creates a List of all the objects. This
+ * results in all the objects getting initialized and
+ * registering their types with the dependency injector
+ */
+ private def init() {
+ List(time)
+ }
+ init()
+}
+
+/*
+/**
+ * Examples of changing the implementation
+ */
+sealed abstract class Changer {
+ def changeDefaultImplementation() {
+ DependencyFactory.time.default.set(() => new Date())
+ }
+
+ def changeSessionImplementation() {
+ DependencyFactory.time.session.set(() => new Date())
+ }
+
+ def changeRequestImplementation() {
+ DependencyFactory.time.request.set(() => new Date())
+ }
+
+ def changeJustForCall(d: Date) {
+ DependencyFactory.time.doWith(d) {
+ // perform some calculations here
+ }
+ }
+}
+*/
No changes.
@@ -0,0 +1,28 @@
+package code
+package snippet
+
+import scala.xml.{NodeSeq, Text}
+import net.liftweb.util._
+import net.liftweb.common._
+import net.liftweb.sitemap._
+import code.lib._
+import Helpers._
+import net.liftweb._
+import net.liftweb.http._
+
+
+case class Param(name: String)
+
+object MenuImmediateParam {
+
+//def parse(b: String) = {if (b == "index") Empty else Full(Param(b))}
+def parse(b: String) = Full(Param(b))
+def encode(c: Param) = c.name;
+
+def menus: List[Menu] = List(m)
+
+def m = Menu.param[Param]("Immediate", "Immediate", parse _, encode _) / * >> Loc.Template(() => TemplateFinder.findAnyTemplate(List("immediate")) openOr <div>Parameter tested</div>)
+
+}
+
+
@@ -0,0 +1,30 @@
+package code
+package snippet
+
+import scala.xml.{NodeSeq, Text}
+import net.liftweb.util._
+import net.liftweb.common._
+import net.liftweb.sitemap._
+import code.lib._
+import Helpers._
+import net.liftweb._
+import net.liftweb.http._
+
+
+case class ImmediateParam(name: String)
+
+object MenuImmediateParam {
+
+val exceptions = List("index", "test", "param")
+
+def parse(b: String) = {if (exceptions.contains(b)) Empty else Full(ImmediateParam(b))}
+//def parse(b: String) = Full(ImmediateParam(b))
+def encode(c: ImmediateParam) = c.name;
+
+def menus: List[Menu] = List(m)
+
+def m = Menu.param[ImmediateParam]("Immediate", "Immediate", parse _, encode _) / * >> Loc.Template(() => TemplateFinder.findAnyTemplate(List("immediate")) openOr <div>Parameter tested</div>)
+
+}
+
+
@@ -0,0 +1,29 @@
+package code
+package snippet
+
+import scala.xml.{NodeSeq, Text}
+import net.liftweb.util._
+import net.liftweb.common._
+import net.liftweb.sitemap._
+import code.lib._
+import Helpers._
+import net.liftweb._
+import net.liftweb.http._
+
+
+case class Param(name: String)
+
+object MenuParam {
+
+def parse(b: String) = {if (b == "except" || b == "") Empty else Full(Param(b))}
+def encode(c: Param) = c.name;
+
+def menus: List[Menu] = List(m_community_item)
+
+def m_community_item = Menu.param[Param]("Param", "Param", parse _, encode _) / "param" / * >> Loc.Template(() => TemplateFinder.findAnyTemplate(List("abc")) openOr <div>Parameter tested</div>)
+
+//
+
+}
+
+
@@ -0,0 +1,21 @@
+package code
+package snippet
+
+import scala.xml.{NodeSeq, Text}
+import net.liftweb.util._
+import net.liftweb.common._
+import net.liftweb.sitemap._
+import code.lib._
+import Helpers._
+import net.liftweb.http._
+
+
+object MenuStatic {
+
+def menus: List[Menu] = List(m_home, m_test,m_param_except)
+
+def m_home = Menu.i("Home") / "index"
+def m_test = Menu.i("Test") / "test"
+def m_param = Menu.i("Param") / "param" >> Loc.Template(() => TemplateFinder.findAnyTemplate(List("param")) openOr <div>Parameter tested</div>)
+def m_param_except = Menu.i("Paramexcept") / "param" / "except"
+}
No changes.
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+"http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+<filter>
+ <filter-name>LiftFilter</filter-name>
+ <display-name>Lift Filter</display-name>
+ <description>The Filter that intercepts lift calls</description>
+ <filter-class>net.liftweb.http.LiftFilter</filter-class>
+</filter>
+
+
+<filter-mapping>
+ <filter-name>LiftFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+</filter-mapping>
+
+</web-app>
@@ -0,0 +1,7 @@
+<lift:surround with="default" at="content">
+
+ <h1>This is abc.html </h1>
+
+
+
+</lift:surround>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,7 @@
+<lift:surround with="default" at="content">
+
+ <h1>This is immediate.html </h1>
+
+
+
+</lift:surround>
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><title>Home</title></head>
+ <body class="lift:content_id=main">
+ <div id="main" class="lift:surround?with=default;at=content">
+ <h2>This is index.html</h2>
+
+ <p> http://localhost:8080/index matches to the index.html template.</p>
+ <p> http://localhost:8080/test matches to the test.html template.</p>
+ <p> http://localhost:8080/"some value" matches to the immediate.html template.</p>
+
+ <p> Try going http://localhost:8080/stuff and see what template is served.</p>
+
+ <p> http://localhost:8080/param/"some value" matches to the abc.html template.</p>
+ <p> http://localhost:8080/param/except matches to the except.html template.</p>
+ <p> http://localhost:8080/param matches to the param.html template.</p>
+
+
+ </div>
+ </body>
+</html>
+
@@ -0,0 +1,7 @@
+<lift:surround with="default" at="content">
+
+ <h1>This is Param.html </h1>
+
+
+
+</lift:surround>
@@ -0,0 +1,7 @@
+<lift:surround with="default" at="content">
+
+ <h1>This is except.html </h1>
+
+
+
+</lift:surround>
Oops, something went wrong.

0 comments on commit c6840a9

Please sign in to comment.