Skip to content
Browse files

restructuring lift

- shove lift packages into top level 'categories' (lift-base, lift-persistence, lift-modules)
- have consistent names for top level categories (examples -> lift-examples)
- move stuff not part of framework to lift-varia
- remove runcoderun stuff for now
  • Loading branch information...
1 parent 7a5bc29 commit bb385cfd995c516adb5eee92ff84d39ecd46031d @indrajitr indrajitr committed Oct 23, 2009
Showing with 0 additions and 9,722 deletions.
  1. +0 −3 JPADemo/CONTRIBUTORS
  2. +0 −1 JPADemo/JPADemo-spa/.gitignore
  3. +0 −51 JPADemo/JPADemo-spa/pom.xml
  4. +0 −30 JPADemo/JPADemo-spa/src/main/resources/META-INF/orm.xml
  5. +0 −12 JPADemo/JPADemo-spa/src/main/resources/META-INF/persistence.xml
  6. +0 −45 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/AU.scala
  7. +0 −20 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/AUDUserType.scala
  8. +0 −34 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/Author.scala
  9. +0 −45 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/Book.scala
  10. +0 −73 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/CurrencyUserType.scala
  11. +0 −68 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/CurrencyZone.scala
  12. +0 −43 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/Enumv.scala
  13. +0 −73 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/EnumvType.scala
  14. +0 −28 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/Genre.scala
  15. +0 −9 JPADemo/JPADemo-spa/src/test/resources/log4j.properties
  16. +0 −95 JPADemo/JPADemo-spa/src/test/scala/net/liftweb/jpademo/model/TestJPAWeb.scala
  17. +0 −1 JPADemo/JPADemo-web/.gitignore
  18. +0 −84 JPADemo/JPADemo-web/pom.xml
  19. +0 −15 JPADemo/JPADemo-web/src/main/resources/lift_chef.properties
  20. +0 −78 JPADemo/JPADemo-web/src/main/scala/bootstrap/liftweb/Boot.scala
  21. 0 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/comet/.keep
  22. 0 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/model/.keep
  23. +0 −22 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/model/Model.scala
  24. 0 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/snippet/.keep
  25. +0 −70 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/snippet/Author.scala
  26. +0 −117 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/snippet/Books.scala
  27. 0 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/view/.keep
  28. +0 −21 JPADemo/JPADemo-web/src/main/webapp/WEB-INF/web.xml
  29. +0 −9 JPADemo/JPADemo-web/src/main/webapp/authors/add.html
  30. +0 −19 JPADemo/JPADemo-web/src/main/webapp/authors/list.html
  31. +0 −55 JPADemo/JPADemo-web/src/main/webapp/books/add.html
  32. +0 −23 JPADemo/JPADemo-web/src/main/webapp/books/list.html
  33. +0 −25 JPADemo/JPADemo-web/src/main/webapp/books/search.html
  34. +0 −117 JPADemo/JPADemo-web/src/main/webapp/css/datePicker.css
  35. +0 −5 JPADemo/JPADemo-web/src/main/webapp/index.html
  36. BIN JPADemo/JPADemo-web/src/main/webapp/scripts/calendar.png
  37. +0 −467 JPADemo/JPADemo-web/src/main/webapp/scripts/date.js
  38. +0 −100 JPADemo/JPADemo-web/src/main/webapp/scripts/jquery.bgiframe.js
  39. +0 −1,175 JPADemo/JPADemo-web/src/main/webapp/scripts/jquery.datePicker.js
  40. +0 −75 JPADemo/JPADemo-web/src/main/webapp/templates-hidden/default.html
  41. +0 −9 JPADemo/JPADemo-web/src/test/resources/log4j.properties
  42. +0 −15 JPADemo/JPADemo-web/src/test/scala/LiftConsole.scala
  43. +0 −32 JPADemo/JPADemo-web/src/test/scala/RunWebApp.scala
  44. +0 −44 JPADemo/JPADemo-web/src/test/scala/net/liftweb/jpademo/AppTest.scala
  45. +0 −79 JPADemo/LocKeyGrabber.scala
  46. +0 −98 JPADemo/pom.xml
  47. +0 −4 README.txt
  48. +0 −93 example/pom.xml
  49. +0 −288 example/src/main/scala/bootstrap/liftweb/Boot.scala
  50. +0 −30 example/src/main/scala/net/liftweb/example/comet/AskName.scala
  51. +0 −103 example/src/main/scala/net/liftweb/example/comet/Chat.scala
  52. +0 −60 example/src/main/scala/net/liftweb/example/comet/ChatServer.scala
  53. +0 −47 example/src/main/scala/net/liftweb/example/comet/Clock.scala
  54. +0 −94 example/src/main/scala/net/liftweb/example/comet/LongTime.scala
  55. +0 −22 example/src/main/scala/net/liftweb/example/lib/LoginStuff.scala
  56. +0 −65 example/src/main/scala/net/liftweb/example/lib/WebServices.scala
  57. +0 −183 example/src/main/scala/net/liftweb/example/lib/WikiStuff.scala
  58. +0 −49 example/src/main/scala/net/liftweb/example/lib/XmlServer.scala
  59. +0 −42 example/src/main/scala/net/liftweb/example/model/Person.scala
  60. +0 −45 example/src/main/scala/net/liftweb/example/model/User.scala
  61. +0 −41 example/src/main/scala/net/liftweb/example/model/WikiEntry.scala
  62. +0 −76 example/src/main/scala/net/liftweb/example/snippet/Ajax.scala
  63. +0 −329 example/src/main/scala/net/liftweb/example/snippet/AjaxForm.scala
  64. +0 −80 example/src/main/scala/net/liftweb/example/snippet/AllJson.scala
  65. +0 −65 example/src/main/scala/net/liftweb/example/snippet/ArcChallenge.scala
  66. +0 −59 example/src/main/scala/net/liftweb/example/snippet/Count.scala
  67. +0 −64 example/src/main/scala/net/liftweb/example/snippet/CountGame.scala
  68. +0 −48 example/src/main/scala/net/liftweb/example/snippet/Database.scala
  69. +0 −59 example/src/main/scala/net/liftweb/example/snippet/DivSelector.scala
  70. +0 −49 example/src/main/scala/net/liftweb/example/snippet/FormWithAjax.scala
  71. +0 −50 example/src/main/scala/net/liftweb/example/snippet/JSDialog.scala
  72. +0 −48 example/src/main/scala/net/liftweb/example/snippet/Json.scala
  73. +0 −148 example/src/main/scala/net/liftweb/example/snippet/Misc.scala
  74. +0 −49 example/src/main/scala/net/liftweb/example/snippet/RuntimeStats.scala
  75. +0 −91 example/src/main/scala/net/liftweb/example/snippet/SimpleWizard.scala
  76. +0 −61 example/src/main/scala/net/liftweb/example/snippet/Template.scala
  77. +0 −49 example/src/main/scala/net/liftweb/example/snippet/ValidateSession.scala
  78. +0 −116 example/src/main/scala/net/liftweb/example/snippet/Wiki.scala
  79. +0 −68 example/src/main/scala/net/liftweb/example/view/XmlFun.scala
  80. +0 −15 example/src/main/webapp/WEB-INF/appengine-web.xml
  81. +0 −24 example/src/main/webapp/WEB-INF/web.xml
  82. +0 −7 example/src/main/webapp/_jsdialog_confirm.html
  83. +0 −18 example/src/main/webapp/_simple_template.html
  84. +0 −84 example/src/main/webapp/ajax-form.html
  85. +0 −118 example/src/main/webapp/ajax.html
  86. +0 −82 example/src/main/webapp/arc.html
  87. +0 −169 example/src/main/webapp/chat.html
  88. +0 −73 example/src/main/webapp/count.html
  89. +0 −83 example/src/main/webapp/database.html
  90. +0 −25 example/src/main/webapp/file_upload.html
  91. +0 −10 example/src/main/webapp/form_ajax.html
  92. +0 −130 example/src/main/webapp/guess.html
  93. BIN example/src/main/webapp/images/ajax-loader.gif
  94. BIN example/src/main/webapp/images/lift.png
  95. BIN example/src/main/webapp/images/liftlogo.png
  96. +0 −58 example/src/main/webapp/index.html
  97. +0 −81 example/src/main/webapp/interactive.html
  98. +0 −71 example/src/main/webapp/json.html
  99. +0 −162 example/src/main/webapp/json_more.html
  100. +0 −55 example/src/main/webapp/lang.html
  101. +0 −12 example/src/main/webapp/lang_ca.html
  102. +0 −12 example/src/main/webapp/lang_de.html
  103. +0 −55 example/src/main/webapp/lang_en_CA.html
  104. +0 −55 example/src/main/webapp/lang_en_US.html
  105. +0 −12 example/src/main/webapp/lang_es.html
  106. +0 −12 example/src/main/webapp/lang_fr.html
  107. +0 −12 example/src/main/webapp/lang_it.html
  108. +0 −10 example/src/main/webapp/lang_no.html
  109. +0 −10 example/src/main/webapp/lang_sv.html
  110. +0 −9 example/src/main/webapp/login/index.html
  111. +0 −29 example/src/main/webapp/login/validate.html
  112. +0 −82 example/src/main/webapp/longtime.html
  113. +0 −3 example/src/main/webapp/menu/four.html
  114. +0 −3 example/src/main/webapp/menu/index.html
  115. +0 −3 example/src/main/webapp/menu/one.html
  116. +0 −3 example/src/main/webapp/menu/three.html
  117. +0 −3 example/src/main/webapp/menu/two.html
  118. +0 −3 example/src/main/webapp/menu/two_one.html
  119. +0 −3 example/src/main/webapp/menu/two_two.html
  120. +0 −9 example/src/main/webapp/misc.html
  121. +0 −7 example/src/main/webapp/persistence.html
  122. +0 −3 example/src/main/webapp/redirect.html
  123. +0 −68 example/src/main/webapp/rhodeisland.html
  124. +0 −403 example/src/main/webapp/scripts/jquery.blockUI.js
  125. +0 −91 example/src/main/webapp/simple.html
  126. +0 −5 example/src/main/webapp/simple/add.html
  127. +0 −6 example/src/main/webapp/simple/delete.html
  128. +0 −5 example/src/main/webapp/simple/edit.html
  129. +0 −6 example/src/main/webapp/simple/index.html
  130. +0 −3 example/src/main/webapp/simple_wizard.html
  131. +0 −3 example/src/main/webapp/template.html
  132. +0 −1 example/src/main/webapp/templates-hidden/ajax.html
  133. +0 −142 example/src/main/webapp/templates-hidden/default.html
  134. +0 −3 example/src/main/webapp/templating/_sample_embed.html
  135. +0 −113 example/src/main/webapp/templating/embed.html
  136. +0 −57 example/src/main/webapp/templating/eval_order.html
  137. +0 −68 example/src/main/webapp/templating/head.html
  138. +0 −152 example/src/main/webapp/templating/index.html
  139. +0 −10 example/src/main/webapp/templating/pageOne.html
  140. +0 −9 example/src/main/webapp/templating/pageThree.html
  141. +0 −9 example/src/main/webapp/templating/pageTwo.html
  142. +0 −94 example/src/main/webapp/templating/selectomatic.html
  143. +0 −110 example/src/main/webapp/templating/surround.html
  144. +0 −6 example/src/main/webapp/wiki.html
  145. +0 −19 example/src/main/webapp/wikibind.html
  146. +0 −106 example/src/main/webapp/ws.html
  147. +0 −124 example/src/test/scala/net/liftweb/example/snippet/WikiSpec.scala
  148. +0 −68 example/src/test/scala/webapptest/JettyTestServer.scala
  149. +0 −58 example/src/test/scala/webapptest/WikiUsages.scala
  150. +0 −20 examples-osgi/hello/hello.composite
  151. +0 −46 examples-osgi/hello/pom.xml
  152. +0 −4 examples-osgi/hello/src/main/resources/webapp/index.html
  153. +0 −29 examples-osgi/hello/src/main/scala/bootstrap/liftweb/Boot.scala
  154. +0 −22 examples-osgi/hello/src/main/scala/net/liftweb/examples/osgi/hello/snippet/Hello.scala
  155. +0 −21 examples-osgi/pom.xml
  156. +0 −57 flotDemo/pom.xml
  157. +0 −42 flotDemo/src/main/scala/bootstrap/liftweb/Boot.scala
  158. 0 flotDemo/src/main/scala/net/liftweb/flot_demo/web/comet/.keep
  159. +0 −67 flotDemo/src/main/scala/net/liftweb/flot_demo/web/comet/FlotCometExample.scala
  160. 0 flotDemo/src/main/scala/net/liftweb/flot_demo/web/model/.keep
Sorry, we could not display the entire diff because it was too big.
View
3 JPADemo/CONTRIBUTORS
@@ -1,3 +0,0 @@
-Derek Chen-Becker (Originating code monkey)
-Oliver Lambert (nice reworking of the JPA/EM wrapper classes, support for enums and user types)
-Charles "Chas" Munat (thanks for all of the feedback!)
View
1 JPADemo/JPADemo-spa/.gitignore
@@ -1 +0,0 @@
-lift_example
View
51 JPADemo/JPADemo-spa/pom.xml
@@ -1,51 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>net.liftweb</groupId>
- <artifactId>JPADemo-Master</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>JPADemo-spa</artifactId>
- <packaging>jar</packaging>
- <name>JPADemo-spa</name>
-
- <dependencies>
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-ejb</artifactId>
- <version>2.1-rc4</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>3.3.2.GA</version>
- <exclusions>
- <exclusion>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-jta</artifactId>
- <version>1.0.1B-rc4</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
View
30 JPADemo/JPADemo-spa/src/main/resources/META-INF/orm.xml
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
- http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" version="1.0">
-
- <package>net.liftweb.jpademo.model</package>
-
- <entity class="Book">
- <named-query name="findBooksByAuthor">
- <query><![CDATA[from Book b where b.author.id = :id order by b.title]]></query>
- </named-query>
- <named-query name="findBooksByDate">
- <query><![CDATA[from Book b where b.published between :startDate and :endDate]]></query>
- </named-query>
- <named-query name="findBooksByTitle">
- <query><![CDATA[from Book b where lower(b.title) like :title order by b.title]]></query>
- </named-query>
- <named-query name="findAllBooks">
- <query><![CDATA[from Book b order by b.title]]></query>
- </named-query>
- </entity>
-
- <entity class="Author">
- <named-query name="findAllAuthors">
- <query><![CDATA[from Author a order by a.name]]></query>
- </named-query>
- </entity>
-
-</entity-mappings>
View
12 JPADemo/JPADemo-spa/src/main/resources/META-INF/persistence.xml
@@ -1,12 +0,0 @@
-<persistence>
- <persistence-unit name="jpaweb" transaction-type="RESOURCE_LOCAL">
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
- <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
- <property name="hibernate.connection.url" value="jdbc:derby:lift_example;create=true"/>
- <property name="hibernate.max_fetch_depth" value="3"/>
- <property name="hibernate.show_sql" value="true" />
- <property name="hibernate.hbm2ddl.auto" value="update" />
- </properties>
- </persistence-unit>
-</persistence>
View
45 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/AU.scala
@@ -1,45 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-import _root_.java.util.Currency;
-import _root_.java.util.Locale;
-import _root_.java.text.NumberFormat;
-
-/* Australian Money */
-object AU extends CurrencyZone {
- type Currency = AUD
-
- abstract class AUD extends AbstractCurrency {
- override val designation = "AUD"
- override val numberOfFractionDigits = 2
- override val currencySymbol = "$"
- override val auLocale = new Locale("en", "AU")
- override val scale = 10
- }
-
- def make(x: BigDecimal) = new AUD {
- val amount = x
- }
-
- def apply(x: BigDecimal): AUD = make(x)
- def apply(x: String): AUD = make(BigDecimal(x))
- def apply(): AUD = make(BigDecimal(0))
-
- val Cent = make(.01)
- val Dollar = make(1)
- val CurrencyUnit = Dollar
-}
View
20 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/AUDUserType.scala
@@ -1,20 +0,0 @@
-/*
- * Copyright 2008 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-/* Australian Money Hibernate Mapper */
-class AUDUserType extends CurrencyUserType[AU.type](AU)
-
View
34 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/Author.scala
@@ -1,34 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-import _root_.javax.persistence._
-
-/**
- An author is someone who writes books.
-*/
-@Entity
-class Author {
- @Id
- @GeneratedValue(){val strategy = GenerationType.AUTO}
- var id : Long = _
-
- @Column{val unique = true, val nullable = false}
- var name : String = ""
-
- @OneToMany(){val mappedBy = "author", val targetEntity = classOf[Book]}
- var books : _root_.java.util.Set[Book] = new _root_.java.util.HashSet[Book]()
-}
View
45 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/Book.scala
@@ -1,45 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-import _root_.java.util.Date
-
-import _root_.javax.persistence._
-import _root_.org.hibernate.annotations.Type
-
-
-/**
- This class represents a book that we might want to read.
-*/
-@Entity
-class Book {
- @Id
- @GeneratedValue(){val strategy = GenerationType.AUTO}
- var id : Long = _
-
- @Column{val unique = true, val nullable = false}
- var title : String = ""
-
- @Temporal(TemporalType.DATE)
- @Column{val nullable = true}
- var published : Date = new Date()
-
- @Type{val `type` = "net.liftweb.jpademo.model.GenreType"}
- var genre : Genre.Value = Genre.unknown
-
- @ManyToOne{val optional = false}
- var author : Author = _
-}
View
73 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/CurrencyUserType.scala
@@ -1,73 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-import _root_.java.io.Serializable
-import _root_.java.sql.PreparedStatement
-import _root_.java.sql.ResultSet
-import _root_.java.sql.SQLException
-import _root_.java.sql.Types
-
-import _root_.org.hibernate.HibernateException
-import _root_.org.hibernate.usertype.UserType
-
-/**
- * Helper class to translate money amount for hibernate
- */
-abstract class CurrencyUserType[CZ <: CurrencyZone](cz: CZ) extends UserType {
-
- type MyCurrency = CZ#Currency
-
- val SQL_TYPES = Array(Types.NUMERIC.asInstanceOf[Int])
-
- override def sqlTypes() = SQL_TYPES
-
- override def returnedClass = cz.CurrencyUnit.getClass
-
- override def equals(x: Object, y: Object): Boolean = {
- if (x == null || y == null) return false
- else return x == y
- }
-
- override def hashCode(x: Object) = x.hashCode
-
- override def nullSafeGet(resultSet: ResultSet, names: Array[String], owner: Object): Object = {
- val dollarVal = resultSet.getBigDecimal(names(0))
- if (resultSet.wasNull()) return cz.make(0)
- else return cz.make(new BigDecimal(dollarVal))
- }
-
- override def nullSafeSet(statement: PreparedStatement, value: Object, index: Int): Unit = {
- if (value == null) {
- statement.setNull(index, Types.NUMERIC)
- } else {
- val dollarVal = value.asInstanceOf[MyCurrency]
- statement.setBigDecimal(index, dollarVal.amount.bigDecimal)
- }
- }
-
- override def deepCopy(value: Object): Object = value
-
- override def isMutable() = false
-
- override def disassemble(value: Object) = value.asInstanceOf[Serializable]
-
- override def assemble(cached: Serializable, owner: Object): Serializable = cached
-
- override def replace(original: Object, target: Object, owner: Object) = original
-
-}
-
View
68 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/CurrencyZone.scala
@@ -1,68 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-import _root_.java.util.Currency
-import _root_.java.util.Locale
-import _root_.java.text.NumberFormat
-
-/* currency factory*/
-abstract class CurrencyZone {
- type Currency <: AbstractCurrency
-
- def make(x: BigDecimal): Currency
-
- abstract class AbstractCurrency {
- val amount: BigDecimal
- val designation: String
- val currencySymbol: String
- val numberOfFractionDigits: Int
- val auLocale: Locale
- val scale: Int
-
- def +(that: Currency): Currency = this + that
-
- def *(that: Currency): Currency = this * that
-
- def -(that: Currency): Currency = this - that
-
- def /(that: Currency): Currency =
- make(new BigDecimal(this.amount.bigDecimal.divide(that.amount.bigDecimal, scale, _root_.java.math.BigDecimal.ROUND_HALF_UP)) )
-
- override def toString = format("", numberOfFractionDigits)
-
- def format: String = format(currencySymbol, numberOfFractionDigits)
-
- def format(currencySymbol: String, numberOfFractionDigits: Int): String = {
- var moneyValue = amount
- if (amount == null) moneyValue = 0
-
- moneyValue = moneyValue.setScale(numberOfFractionDigits, BigDecimal.RoundingMode.ROUND_HALF_UP);
- val numberFormat = NumberFormat.getInstance(auLocale);
- numberFormat.setMinimumFractionDigits(numberOfFractionDigits);
- numberFormat.setMaximumFractionDigits(numberOfFractionDigits);
- if (moneyValue.doubleValue() < 0) return "-"+currencySymbol+numberFormat.format(moneyValue.abs.doubleValue());
- else return currencySymbol+numberFormat.format(moneyValue.doubleValue());
- }
-
- def get: String = get(numberOfFractionDigits)
-
- def get(numberOfFractionDigits: Int): String = format("", numberOfFractionDigits).replaceAll(",", "");
-
- }
- val CurrencyUnit: Currency
-}
-
View
43 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/Enumv.scala
@@ -1,43 +0,0 @@
-/*
- * Copyright 2008 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-/* adds a valueOf function, assumes name is defined
-add optional description */
-trait Enumv {
-
- this: Enumeration =>
-
- private var nameDescriptionMap = scala.collection.mutable.Map[String, String]()
-
- /* store a name and description for forms */
- def Value(name: String, desc: String) : Value = {
- nameDescriptionMap += (name -> desc)
- new Val(name)
- }
-
- /* get description if it exists else name */
- def getDescriptionOrName(ev: this.Value) = {
- try {
- nameDescriptionMap(""+ev)
- } catch {
- case e: NoSuchElementException => ev.toString
- }
- }
-
- /* get name description pair list for forms */
- def getNameDescriptionList = this.elements.toList.map(v => (v.toString, getDescriptionOrName(v) ) ).toList
-}
View
73 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/EnumvType.scala
@@ -1,73 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-import _root_.java.io.Serializable
-import _root_.java.sql.PreparedStatement
-import _root_.java.sql.ResultSet
-import _root_.java.sql.SQLException
-import _root_.java.sql.Types
-
-import _root_.org.hibernate.HibernateException
-import _root_.org.hibernate.usertype.UserType
-
-/**
- * Helper class to translate enum for hibernate
- */
-abstract class EnumvType(val et: Enumeration with Enumv) extends UserType {
-
- val SQL_TYPES = Array({Types.VARCHAR})
-
- override def sqlTypes() = SQL_TYPES
-
- override def returnedClass = classOf[et.Value]
-
- override def equals(x: Object, y: Object): Boolean = {
- return x == y
- }
-
- override def hashCode(x: Object) = x.hashCode
-
- override def nullSafeGet(resultSet: ResultSet, names: Array[String], owner: Object): Object = {
- val value = resultSet.getString(names(0))
- if (resultSet.wasNull()) return null
- else {
- return et.valueOf(value).getOrElse(null)
- }
- }
-
- override def nullSafeSet(statement: PreparedStatement, value: Object, index: Int): Unit = {
- if (value == null) {
- statement.setNull(index, Types.VARCHAR)
- } else {
- val en = value.toString
- statement.setString(index, en)
- }
- }
-
- override def deepCopy(value: Object): Object = value
-
- override def isMutable() = false
-
- override def disassemble(value: Object) = value.asInstanceOf[Serializable]
-
- override def assemble(cached: Serializable, owner: Object): Serializable = cached
-
- override def replace(original: Object, target: Object, owner: Object) = original
-
-}
-
-
View
28 JPADemo/JPADemo-spa/src/main/scala/net/liftweb/jpademo/model/Genre.scala
@@ -1,28 +0,0 @@
-/*
- * Copyright 2008 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-object Genre extends Enumeration with Enumv {
- val Mystery = Value("Mystery", "Mystery")
- val SciFi = Value("SciFi", "SciFi")
- val Classic = Value("Classic", "Classic")
- val Childrens = Value("Childrens", "Childrens")
- val Horror = Value("Horror", "Horror")
- val Poetry = Value("Poetry", "Poetry")
- val unknown = Value("Unknown", "Unknown genre")
-}
-
-class GenreType extends EnumvType(Genre) {}
View
9 JPADemo/JPADemo-spa/src/test/resources/log4j.properties
@@ -1,9 +0,0 @@
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=DEBUG, A1
-
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
View
95 JPADemo/JPADemo-spa/src/test/scala/net/liftweb/jpademo/model/TestJPAWeb.scala
@@ -1,95 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-import org.junit.Test
-import org.junit.Before
-import org.junit.After
-import org.junit.Assert._
-
-import javax.persistence._
-
-class TestJPAWeb {
- var emf : EntityManagerFactory = _
-
- @Before
- def initEMF () = {
- try {
- emf = Persistence.createEntityManagerFactory("jpaweb")
- } catch {
- case e: Exception => {
- def printAndDescend(ex : Throwable) : Unit = {
- println(e.getMessage())
- if (ex.getCause() != null) {
- printAndDescend(ex.getCause())
- }
- }
- printAndDescend(e)
- }
- }
- }
-
- @After
- def closeEMF () = {
- if (emf != null) emf.close()
- }
-
- @Test
- def save_stuff () = {
- var em = emf.createEntityManager()
-
- val tx = em.getTransaction()
-
- tx.begin()
-
- val author = new Author
- author.name = "Chuck"
-
- em.persist(author)
-
- val book = new Book
- book.title = "Huh?"
- book.published = new _root_.java.util.Date
- book.author = author
- book.genre = Genre.Mystery
-
- em.persist(book)
-
- tx.commit()
-
- em.close()
-
- // Re-open and query
- em = emf.createEntityManager()
-
- val retrieved = em.createNamedQuery("findAllBooks").getResultList().asInstanceOf[java.util.List[Book]]
-
- assertEquals(1, retrieved.size())
- assertEquals(Genre.Mystery, retrieved.get(0).genre)
-
- println("Found " + retrieved.get(0).title)
-
- // clean up
- em.getTransaction().begin()
-
- em.remove(em.getReference(classOf[Book],book.id))
- em.remove(em.getReference(classOf[Author],author.id))
-
- em.getTransaction().commit()
-
- em.close()
- }
-}
View
1 JPADemo/JPADemo-web/.gitignore
@@ -1 +0,0 @@
-lift_example
View
84 JPADemo/JPADemo-web/pom.xml
@@ -1,84 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>net.liftweb</groupId>
- <artifactId>JPADemo-Master</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>JPADemo-web</artifactId>
- <packaging>war</packaging>
- <name>JPADemo-web</name>
-
- <dependencies>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>[6.1.6,6.1.19)</version>
- <scope>test</scope>
- </dependency>
- <!-- for LiftConsole -->
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-compiler</artifactId>
- <version>${scala.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>JPADemo-spa</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>lift-core</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>lift-jpa</artifactId>
- <version>${pom.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <configuration>
- <contextPath>/</contextPath>
- <scanIntervalSeconds>5</scanIntervalSeconds>
- <connectors>
- <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
- <port>9090</port>
- <maxIdleTime>60000</maxIdleTime>
- </connector>
- </connectors>
- </configuration>
- </plugin>
- <plugin>
- <groupId>net.sf.alchim</groupId>
- <artifactId>yuicompressor-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>compress</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <nosuffix>true</nosuffix>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
View
15 JPADemo/JPADemo-web/src/main/resources/lift_chef.properties
@@ -1,15 +0,0 @@
-emptyAuthor=Author Namen Gemissing, bork bork bork
-Add\ Author=Author Adden
-Add=Adden
-Author=Writeren
-Author\ List=Writeren Listen
-Book\ List=Booken Listen
-Book\ Search=Searchen Booken, bork bork
-Books\ published=Booken Publishen
-Edit=Slicen Dicen
-Name=Namen
-Published=Daten writtenen
-Save=Saven worken
-Search=Searchen booken
-Title=Booken namen
-Welcome=Welkomen to dee show! Bork bork bork
View
78 JPADemo/JPADemo-web/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -1,78 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package bootstrap.liftweb
-
-import _root_.java.util.Locale
-
-import _root_.net.liftweb.util.{LoanWrapper,LogBoot}
-import _root_.net.liftweb.common.{Box,Empty,Full}
-import _root_.net.liftweb.http._
-import _root_.net.liftweb.sitemap._
-import _root_.net.liftweb.sitemap.Loc._
-import _root_.net.liftweb.jpademo.model._
-import S.?
-import provider._
-
-/**
- * A class that's instantiated early and run. It allows the application
- * to modify lift's environment
- */
-class Boot {
- def boot {
- LogBoot.defaultProps =
- """<?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
- <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="appender" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.SimpleLayout"/>
- </appender>
- <root>
- <priority value ="DEBUG"/>
- <appender-ref ref="appender"/>
- </root>
- </log4j:configuration>
- """
-
- // where to search snippet
- LiftRules.addToPackages("net.liftweb.jpademo")
-
- // Set up a site map
- val entries = SiteMap(Menu(Loc("Home", "index" :: Nil , ?("Home"))),
- Menu(Loc("Authors", "authors" :: "list" :: Nil, ?("Author List"))),
- Menu(Loc("Add Author", "authors" :: "add" :: Nil, ?("Add Author"), Hidden)),
- Menu(Loc("Books", "books" :: "list" :: Nil, ?("Book List"))),
- Menu(Loc("Add Book", "books" :: "add" :: Nil, ?("Add Book"), Hidden)),
- Menu(Loc("BookSearch", "books" :: "search" :: Nil, ?("Book Search"))))
-
- LiftRules.setSiteMap(entries)
-
- // And now, for a little fun :)
- val swedishChef = new Locale("chef")
-
- object swedishOn extends SessionVar(false)
-
- def localeCalculator (request : Box[HTTPRequest]) : Locale =
- request.flatMap(_.param("swedish") match {
- case Nil if swedishOn.is == true => Full(swedishChef)
- case Nil => Full(LiftRules.defaultLocaleCalculator(request))
- case "true" :: _ => { swedishOn(true); Full(swedishChef) }
- case "false" :: _ => { swedishOn(false); Full(LiftRules.defaultLocaleCalculator(request)) }
- }).openOr(Locale.getDefault())
-
- LiftRules.localeCalculator = localeCalculator _
- }
-}
-
View
0 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/comet/.keep
No changes.
View
0 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/model/.keep
No changes.
View
22 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/model/Model.scala
@@ -1,22 +0,0 @@
-/*
- * Copyright 2008 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.model
-
-import _root_.org.scala_libs.jpa.LocalEMF
-import _root_.net.liftweb.jpa.RequestVarEM
-
-object Model extends LocalEMF("jpaweb") with RequestVarEM
-
View
0 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/snippet/.keep
No changes.
View
70 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/snippet/Author.scala
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.snippet
-
-import scala.xml.{NodeSeq,Text}
-
-import net.liftweb.http.{RequestVar,S,SHtml}
-import net.liftweb.util.{Helpers,Log}
-import S._
-import Helpers._
-
-import net.liftweb.jpademo.model._
-import Model._
-
-import javax.persistence.{EntityExistsException,PersistenceException}
-
-class AuthorOps {
- def list (xhtml : NodeSeq) : NodeSeq = {
- val authors = Model.createNamedQuery[Author]("findAllAuthors").getResultList()
-
- authors.flatMap(author =>
- bind("author", xhtml,
- "name" -> Text(author.name),
- "count" -> SHtml.link("/books/search.html", {() =>
- BookOps.resultVar(Model.createNamedQuery[Book]("findBooksByAuthor", "id" ->author.id).getResultList().toList)
- }, Text(author.books.size().toString)),
- "edit" -> SHtml.link("add.html", () => authorVar(author), Text(?("Edit")))))
- }
-
- // Set up a requestVar to track the author object for edits and adds
- object authorVar extends RequestVar(new Author())
- def author = authorVar.is
-
- def add (xhtml : NodeSeq) : NodeSeq = {
- def doAdd () = {
- if (author.name.length == 0) {
- error("emptyAuthor", "The author's name cannot be blank")
- } else {
- try {
- Model.mergeAndFlush(author)
- redirectTo("list.html")
- } catch {
- case ee : EntityExistsException => error("That author already exists.")
- case pe : PersistenceException => error("Error adding author"); Log.error("Author add failed", pe)
- }
- }
- }
-
- // Hold a val here so that the "id" closure holds it when we re-enter this method
- val currentId = author.id
-
- bind("author", xhtml,
- "id" -> SHtml.hidden(() => author.id = currentId),
- "name" -> SHtml.text(author.name, author.name = _),
- "submit" -> SHtml.submit(?("Save"), doAdd))
- }
-}
View
117 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/snippet/Books.scala
@@ -1,117 +0,0 @@
-/*
- * Copyright 2008-2009 WorldWide Conferencing, LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- */
-package net.liftweb.jpademo.snippet
-
-import _root_.java.text.{ParseException,SimpleDateFormat}
-
-import _root_.scala.xml.{NodeSeq,Text}
-
-import _root_.net.liftweb.http.{RequestVar,S,SHtml}
-import _root_.net.liftweb.util.{Helpers,Log}
-import _root_.net.liftweb.common.{Box,Empty,Full}
-import S._
-import Helpers._
-
-import _root_.net.liftweb.jpademo.model._
-import Model._
-
-import _root_.javax.persistence.{EntityExistsException,PersistenceException}
-
-// Make an object so that other pages can access (ie Authors)
-object BookOps {
- // Object to hold search results
- object resultVar extends RequestVar[List[Book]](Nil)
-}
-
-class BookOps {
- val formatter = new _root_.java.text.SimpleDateFormat("yyyyMMdd")
-
- def list (xhtml : NodeSeq) : NodeSeq = {
- val books = Model.createNamedQuery[Book]("findAllBooks").getResultList()
-
- books.flatMap(book =>
- bind("book", xhtml,
- "title" -> Text(book.title),
- "published" -> Text(formatter.format(book.published)),
- "genre" -> Text(if (book.genre != null) book.genre.toString else ""),
- "author" -> Text(book.author.name),
- "edit" -> SHtml.link("add.html", () => bookVar(book), Text(?("Edit")))))
- }
-
- // Set up a requestVar to track the book object for edits and adds
- object bookVar extends RequestVar(new Book())
- def book = bookVar.is
-
- // Utility methods for processing a submitted form
- def is_valid_Book_? (toCheck : Book) : Boolean =
- List((if (toCheck.title.length == 0) { S.error("You must provide a title"); false } else true),
- (if (toCheck.published == null) { S.error("You must provide a publish date"); false } else true),
- (if (toCheck.genre == null) { S.error("You must select a genre"); false } else true),
- (if (toCheck.author == null) { S.error("You must select an author"); false } else true)).forall(_ == true)
-
- def setDate (input : String, toSet : Book) {
- try {
- toSet.published = formatter.parse(input)
- } catch {
- case pe : ParseException => S.error("Error parsing the date")
- }
- }
-
- // The add snippet method
- def add (xhtml : NodeSeq) : NodeSeq = {
- def doAdd () =
- if (is_valid_Book_?(book)) {
- try {
- Model.mergeAndFlush(book)
- redirectTo("list.html")
- } catch {
- case ee : EntityExistsException => error("That book already exists.")
- case pe : PersistenceException => error("Error adding book"); Log.error("Book add failed", pe)
- }
- }
-
-
- // Hold a val here so that the closure holds it when we re-enter this method
- val current = book
-
- val authors = Model.createNamedQuery[Author]("findAllAuthors").getResultList()
- val choices = authors.map(author => (author.id.toString -> author.name)).toList
- val default = if (book.author != null) { Full(book.author.id.toString) } else { Empty }
-
- bind("book", xhtml,
- "id" -> SHtml.hidden(() => bookVar(current)),
- "title" -> SHtml.text(book.title, book.title = _),
- "published" -> SHtml.text(formatter.format(book.published), setDate(_, book)) % ("id" -> "published"),
- "genre" -> SHtml.select(Genre.getNameDescriptionList, (Box.legacyNullTest(book.genre).map(_.toString) or Full("")), choice => book.genre = Genre.valueOf(choice).getOrElse(null)),
- "author" -> SHtml.select(choices, default, {authId : String => book.author = Model.getReference(classOf[Author], authId.toLong)}),
- "save" -> SHtml.submit(?("Save"), doAdd))
- }
-
- def searchResults (xhtml : NodeSeq) : NodeSeq = BookOps.resultVar.is.flatMap(result =>
- bind("result", xhtml, "title" -> Text(result.title), "author" -> Text(result.author.name)))
-
- def search (xhtml : NodeSeq) : NodeSeq = {
- var title = ""
-
- def doSearch () = {
- BookOps.resultVar(Model.createNamedQuery[Book]("findBooksByTitle", "title" -> ("%" + title.toLowerCase + "%")).getResultList().toList)
- }
-
- bind("search", xhtml,
- "title" -> SHtml.text(title, title = _),
- "run" -> SHtml.submit(?("Search"), doSearch _))
- }
-}
View
0 JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/view/.keep
No changes.
View
21 JPADemo/JPADemo-web/src/main/webapp/WEB-INF/web.xml
@@ -1,21 +0,0 @@
-<?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/j2ee/dtds/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>
View
9 JPADemo/JPADemo-web/src/main/webapp/authors/add.html
@@ -1,9 +0,0 @@
-<lift:surround with="default" at="content">
- <head><title><lift:loc>Add Author</lift:loc></title></head>
-
- <lift:AuthorOps.add form="post">
- <author:id />
- <author:name />
- <author:submit />
- </lift:AuthorOps.add>
-</lift:surround>
View
19 JPADemo/JPADemo-web/src/main/webapp/authors/list.html
@@ -1,19 +0,0 @@
-<lift:surround with="default" at="content">
- <head><title><lift:loc>Author List</lift:loc></title></head>
-
- <table>
- <tr>
- <th><lift:loc>Name</lift:loc></th>
- <th><lift:loc>Books published</lift:loc></th>
- <th></th>
- </tr>
- <lift:AuthorOps.list>
- <tr>
- <td><author:name /></td>
- <td><author:count /></td>
- <td><author:edit /></td>
- </tr>
- </lift:AuthorOps.list>
- <a href="add"><lift:loc>Add</lift:loc></a>
- </table>
-</lift:surround>
View
55 JPADemo/JPADemo-web/src/main/webapp/books/add.html
@@ -1,55 +0,0 @@
-<lift:surround with="default" at="content">
- <head>
- <title><lift:loc>Add Book</lift:loc></title>
- <!-- required plugins -->
- <script type="text/javascript" src="/scripts/date.js"></script>
- <!--[if IE]><script type="text/javascript" src="/scripts/jquery.bgiframe.js"></script><![endif]-->
-
- <!-- jquery.datePicker.js -->
- <script type="text/javascript" src="/scripts/jquery.datePicker.js"></script>
-
- <link rel="stylesheet" type="text/css" href="/css/datePicker.css" />
- <style>
- a.dp-choose-date {
- float: left;
- width: 16px;
- height: 16px;
- padding: 0;
- margin: 5px 3px 0;
- display: block;
- text-indent: -2000px;
- overflow: hidden;
- background: url(/scripts/calendar.png) no-repeat;
- }
- a.dp-choose-date.dp-disabled {
- background-position: 0 -20px;
- cursor: default;
- }
- /* makes the input field shorter once the date picker code
- * has run (to allow space for the calendar icon
- */
- input.dp-applied {
- width: 140px;
- float: left;
- }
- </style>
- </head>
-
- <table>
- <lift:BookOps.add form="post">
- <book:id />
- <tr><td><label><lift:loc>Title</lift:loc></label></td><td><book:title /></td></tr>
- <tr><td><label><lift:loc>Published</lift:loc></label></td><td><book:published /></td></tr>
- <tr><td><label><lift:loc>Genre</lift:loc></label></td><td><book:genre /></td></tr>
- <tr><td><label><lift:loc>Author</lift:loc></label></td><td><book:author /></td></tr>
- <tr><td><book:save /></td></tr>
- </lift:BookOps.add>
- </table>
-
- <script type="text/javascript">
- Date.format = 'yyyymmdd';
- jQuery(function () {
- jQuery('#published').datePicker({startDate:'00010101'});
- })
- </script>
-</lift:surround>
View
23 JPADemo/JPADemo-web/src/main/webapp/books/list.html
@@ -1,23 +0,0 @@
-<lift:surround with="default" at="content">
- <head><title><lift:loc>Book List</lift:loc></title></head>
-
- <table>
- <tr>
- <th><lift:loc>Title</lift:loc></th>
- <th><lift:loc>Published</lift:loc></th>
- <th><lift:loc>Genre</lift:loc></th>
- <th><lift:loc>Author</lift:loc></th>
- <th></th>
- </tr>
- <lift:BookOps.list>
- <tr>
- <td><book:title /></td>
- <td><book:published /></td>
- <td><book:genre /></td>
- <td><book:author /></td>
- <td><book:edit /></td>
- </tr>
- </lift:BookOps.list>
- <a href="add"><lift:loc>Add</lift:loc></a>
- </table>
-</lift:surround>
View
25 JPADemo/JPADemo-web/src/main/webapp/books/search.html
@@ -1,25 +0,0 @@
-<lift:surround with="default" at="content">
- <head>
- <title><lift:loc>Book Search</lift:loc></title>
- </head>
-
- <table>
- <tr>
- <th><lift:loc>Title</lift:loc></th>
- <th><lift:loc>Author</lift:loc></th>
- </tr>
- <lift:BookOps.searchResults>
- <tr>
- <td><result:title/></td>
- <td><result:author/></td>
- </tr>
- </lift:BookOps.searchResults>
- </table>
-
- <lift:BookOps.search form="post">
- <table>
- <tr><td><search:title /><search:run /></td></tr>
- </table>
- </lift:BookOps.search>
-</lift:surround>
-
View
117 JPADemo/JPADemo-web/src/main/webapp/css/datePicker.css
@@ -1,117 +0,0 @@
-
-
-table.jCalendar {
- border: 1px solid #000;
- background: #aaa;
- border-collapse: separate;
- border-spacing: 2px;
-}
-table.jCalendar th {
- background: #333;
- color: #fff;
- font-weight: bold;
- padding: 3px 5px;
-}
-table.jCalendar td {
- background: #ccc;
- color: #000;
- padding: 3px 5px;
- text-align: center;
-}
-table.jCalendar td.other-month {
- background: #ddd;
- color: #aaa;
-}
-table.jCalendar td.today {
- background: #666;
- color: #fff;
-}
-table.jCalendar td.selected {
- background: #f66;
- color: #fff;
-}
-table.jCalendar td.selected:hover {
- background: #f33;
- color: #fff;
-}
-table.jCalendar td:hover, table.jCalendar td.dp-hover {
- background: #fff;
- color: #000;
-}
-table.jCalendar td.disabled, table.jCalendar td.disabled:hover {
- background: #bbb;
- color: #888;
-}
-
-/* For the popup */
-
-/* NOTE - you will probably want to style a.dp-choose-date - see how I did it in demo.css */
-
-div.dp-popup {
- position: relative;
- background: #ccc;
- font-size: 10px;
- font-family: arial, sans-serif;
- padding: 2px;
- width: 171px;
- line-height: 1.2em;
-}
-div#dp-popup {
- position: absolute;
- z-index: 199;
-}
-div.dp-popup h2 {
- font-size: 12px;
- text-align: center;
- margin: 2px 0;
- padding: 0;
-}
-a#dp-close {
- font-size: 11px;
- padding: 4px 0;
- text-align: center;
- display: block;
-}
-a#dp-close:hover {
- text-decoration: underline;
-}
-div.dp-popup a {
- color: #000;
- text-decoration: none;
- padding: 3px 2px 0;
-}
-div.dp-popup div.dp-nav-prev {
- position: absolute;
- top: 2px;
- left: 4px;
- width: 100px;
-}
-div.dp-popup div.dp-nav-prev a {
- float: left;
-}
-/* Opera needs the rules to be this specific otherwise it doesn't change the cursor back to pointer after you have disabled and re-enabled a link */
-div.dp-popup div.dp-nav-prev a, div.dp-popup div.dp-nav-next a {
- cursor: pointer;
-}
-div.dp-popup div.dp-nav-prev a.disabled, div.dp-popup div.dp-nav-next a.disabled {
- cursor: default;
-}
-div.dp-popup div.dp-nav-next {
- position: absolute;
- top: 2px;
- right: 4px;
- width: 100px;
-}
-div.dp-popup div.dp-nav-next a {
- float: right;
-}
-div.dp-popup a.disabled {
- cursor: default;
- color: #aaa;
-}
-div.dp-popup td {
- cursor: pointer;
-}
-div.dp-popup td.disabled {
- cursor: default;
-}
View
5 JPADemo/JPADemo-web/src/main/webapp/index.html
@@ -1,5 +0,0 @@
-<lift:surround with="default" at="content">
-<head><title><lift:loc>Super Duper Library Catalog</lift:loc></title></head>
- <h2><lift:loc locid="Welcome">Welcome to the super duper catalog!</lift:loc></h2>
-</lift:surround>
-
View
BIN JPADemo/JPADemo-web/src/main/webapp/scripts/calendar.png
Deleted file not rendered
View
467 JPADemo/JPADemo-web/src/main/webapp/scripts/date.js
@@ -1,467 +0,0 @@
-/*
- * Date prototype extensions. Doesn't depend on any
- * other code. Doens't overwrite existing methods.
- *
- * Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear,
- * isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear,
- * setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods
- *
- * Copyright (c) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
- *
- * Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString -
- * I've added my name to these methods so you know who to blame if they are broken!
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- */
-
-/**
- * An Array of day names starting with Sunday.
- *
- * @example dayNames[0]
- * @result 'Sunday'
- *
- * @name dayNames
- * @type Array
- * @cat Plugins/Methods/Date
- */
-Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
-
-/**
- * An Array of abbreviated day names starting with Sun.
- *
- * @example abbrDayNames[0]
- * @result 'Sun'
- *
- * @name abbrDayNames
- * @type Array
- * @cat Plugins/Methods/Date
- */
-Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
-
-/**
- * An Array of month names starting with Janurary.
- *
- * @example monthNames[0]
- * @result 'January'
- *
- * @name monthNames
- * @type Array
- * @cat Plugins/Methods/Date
- */
-Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
-
-/**
- * An Array of abbreviated month names starting with Jan.
- *
- * @example abbrMonthNames[0]
- * @result 'Jan'
- *
- * @name monthNames
- * @type Array
- * @cat Plugins/Methods/Date
- */
-Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
-
-/**
- * The first day of the week for this locale.
- *
- * @name firstDayOfWeek
- * @type Number
- * @cat Plugins/Methods/Date
- * @author Kelvin Luck
- */
-Date.firstDayOfWeek = 1;
-
-/**
- * The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc).
- *
- * @name format
- * @type String
- * @cat Plugins/Methods/Date
- * @author Kelvin Luck
- */
-Date.format = 'dd/mm/yyyy';
-//Date.format = 'mm/dd/yyyy';
-//Date.format = 'yyyy-mm-dd';
-//Date.format = 'dd mmm yy';
-
-/**
- * The first two numbers in the century to be used when decoding a two digit year. Since a two digit year is ambiguous (and date.setYear
- * only works with numbers < 99 and so doesn't allow you to set years after 2000) we need to use this to disambiguate the two digit year codes.
- *
- * @name format
- * @type String
- * @cat Plugins/Methods/Date
- * @author Kelvin Luck
- */
-Date.fullYearStart = '20';
-
-(function() {
-
- /**
- * Adds a given method under the given name
- * to the Date prototype if it doesn't
- * currently exist.
- *
- * @private
- */
- function add(name, method) {
- if( !Date.prototype[name] ) {
- Date.prototype[name] = method;
- }
- };
-
- /**
- * Checks if the year is a leap year.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.isLeapYear();
- * @result true
- *
- * @name isLeapYear
- * @type Boolean
- * @cat Plugins/Methods/Date
- */
- add("isLeapYear", function() {
- var y = this.getFullYear();
- return (y%4==0 && y%100!=0) || y%400==0;
- });
-
- /**
- * Checks if the day is a weekend day (Sat or Sun).
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.isWeekend();
- * @result false
- *
- * @name isWeekend
- * @type Boolean
- * @cat Plugins/Methods/Date
- */
- add("isWeekend", function() {
- return this.getDay()==0 || this.getDay()==6;
- });
-
- /**
- * Check if the day is a day of the week (Mon-Fri)
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.isWeekDay();
- * @result false
- *
- * @name isWeekDay
- * @type Boolean
- * @cat Plugins/Methods/Date
- */
- add("isWeekDay", function() {
- return !this.isWeekend();
- });
-
- /**
- * Gets the number of days in the month.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.getDaysInMonth();
- * @result 31
- *
- * @name getDaysInMonth
- * @type Number
- * @cat Plugins/Methods/Date
- */
- add("getDaysInMonth", function() {
- return [31,(this.isLeapYear() ? 29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];
- });
-
- /**
- * Gets the name of the day.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.getDayName();
- * @result 'Saturday'
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.getDayName(true);
- * @result 'Sat'
- *
- * @param abbreviated Boolean When set to true the name will be abbreviated.
- * @name getDayName
- * @type String
- * @cat Plugins/Methods/Date
- */
- add("getDayName", function(abbreviated) {
- return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()];
- });
-
- /**
- * Gets the name of the month.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.getMonthName();
- * @result 'Janurary'
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.getMonthName(true);
- * @result 'Jan'
- *
- * @param abbreviated Boolean When set to true the name will be abbreviated.
- * @name getDayName
- * @type String
- * @cat Plugins/Methods/Date
- */
- add("getMonthName", function(abbreviated) {
- return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()];
- });
-
- /**
- * Get the number of the day of the year.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.getDayOfYear();
- * @result 11
- *
- * @name getDayOfYear
- * @type Number
- * @cat Plugins/Methods/Date
- */
- add("getDayOfYear", function() {
- var tmpdtm = new Date("1/1/" + this.getFullYear());
- return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000);
- });
-
- /**
- * Get the number of the week of the year.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.getWeekOfYear();
- * @result 2
- *
- * @name getWeekOfYear
- * @type Number
- * @cat Plugins/Methods/Date
- */
- add("getWeekOfYear", function() {
- return Math.ceil(this.getDayOfYear() / 7);
- });
-
- /**
- * Set the day of the year.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.setDayOfYear(1);
- * dtm.toString();
- * @result 'Tue Jan 01 2008 00:00:00'
- *
- * @name setDayOfYear
- * @type Date
- * @cat Plugins/Methods/Date
- */
- add("setDayOfYear", function(day) {
- this.setMonth(0);
- this.setDate(day);
- return this;
- });
-
- /**
- * Add a number of years to the date object.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.addYears(1);
- * dtm.toString();
- * @result 'Mon Jan 12 2009 00:00:00'
- *
- * @name addYears
- * @type Date
- * @cat Plugins/Methods/Date
- */
- add("addYears", function(num) {
- this.setFullYear(this.getFullYear() + num);
- return this;
- });
-
- /**
- * Add a number of months to the date object.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.addMonths(1);
- * dtm.toString();
- * @result 'Tue Feb 12 2008 00:00:00'
- *
- * @name addMonths
- * @type Date
- * @cat Plugins/Methods/Date
- */
- add("addMonths", function(num) {
- var tmpdtm = this.getDate();
-
- this.setMonth(this.getMonth() + num);
-
- if (tmpdtm > this.getDate())
- this.addDays(-this.getDate());
-
- return this;
- });
-
- /**
- * Add a number of days to the date object.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.addDays(1);
- * dtm.toString();
- * @result 'Sun Jan 13 2008 00:00:00'
- *
- * @name addDays
- * @type Date
- * @cat Plugins/Methods/Date
- */
- add("addDays", function(num) {
- this.setDate(this.getDate() + num);
- return this;
- });
-
- /**
- * Add a number of hours to the date object.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.addHours(24);
- * dtm.toString();
- * @result 'Sun Jan 13 2008 00:00:00'
- *
- * @name addHours
- * @type Date
- * @cat Plugins/Methods/Date
- */
- add("addHours", function(num) {
- this.setHours(this.getHours() + num);
- return this;
- });
-
- /**
- * Add a number of minutes to the date object.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.addMinutes(60);
- * dtm.toString();
- * @result 'Sat Jan 12 2008 01:00:00'
- *
- * @name addMinutes
- * @type Date
- * @cat Plugins/Methods/Date
- */
- add("addMinutes", function(num) {
- this.setMinutes(this.getMinutes() + num);
- return this;
- });
-
- /**
- * Add a number of seconds to the date object.
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.addSeconds(60);
- * dtm.toString();
- * @result 'Sat Jan 12 2008 00:01:00'
- *
- * @name addSeconds
- * @type Date
- * @cat Plugins/Methods/Date
- */
- add("addSeconds", function(num) {
- this.setSeconds(this.getSeconds() + num);
- return this;
- });
-
- /**
- * Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant.
- *
- * @example var dtm = new Date();
- * dtm.zeroTime();
- * dtm.toString();
- * @result 'Sat Jan 12 2008 00:01:00'
- *
- * @name zeroTime
- * @type Date
- * @cat Plugins/Methods/Date
- * @author Kelvin Luck
- */
- add("zeroTime", function() {
- this.setMilliseconds(0);
- this.setSeconds(0);
- this.setMinutes(0);
- this.setHours(0);
- return this;
- });
-
- /**
- * Returns a string representation of the date object according to Date.format.
- * (Date.toString may be used in other places so I purposefully didn't overwrite it)
- *
- * @example var dtm = new Date("01/12/2008");
- * dtm.asString();
- * @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy'
- *
- * @name asString
- * @type Date
- * @cat Plugins/Methods/Date
- * @author Kelvin Luck
- */
- add("asString", function() {
- var r = Date.format;
- return r
- .split('yyyy').join(this.getFullYear())
- .split('yy').join((this.getFullYear() + '').substring(2))
- .split('mmm').join(this.getMonthName(true))
- .split('mm').join(_zeroPad(this.getMonth()+1))
- .split('dd').join(_zeroPad(this.getDate()));
- });
-
- /**
- * Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object
- * (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere)
- *
- * @example var dtm = Date.fromString("12/01/2008");
- * dtm.toString();
- * @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy'
- *
- * @name fromString
- * @type Date
- * @cat Plugins/Methods/Date
- * @author Kelvin Luck
- */
- Date.fromString = function(s)
- {
- var f = Date.format;
- var d = new Date('01/01/1977');
- var iY = f.indexOf('yyyy');
- if (iY > -1) {
- d.setFullYear(Number(s.substr(iY, 4)));
- } else {
- // TODO - this doesn't work very well - are there any rules for what is meant by a two digit year?
- d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2)));
- }
- var iM = f.indexOf('mmm');
- if (iM > -1) {
- var mStr = s.substr(iM, 3);
- for (var i=0; i<Date.abbrMonthNames.length; i++) {
- if (Date.abbrMonthNames[i] == mStr) break;
- }
- d.setMonth(i);
- } else {
- d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1);
- }
- d.setDate(Number(s.substr(f.indexOf('dd'), 2)));
- if (isNaN(d.getTime())) {
- return false;
- }
- return d;
- };
-
- // utility method
- var _zeroPad = function(num) {
- var s = '0'+num;
- return s.substring(s.length-2)
- //return ('0'+num).substring(-2); // doesn't work on IE :(
- };
-
-})();
View
100 JPADemo/JPADemo-web/src/main/webapp/scripts/jquery.bgiframe.js
@@ -1,100 +0,0 @@
-/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
- *
- * $LastChangedDate$
- * $Rev$
- *
- * Version 2.1.1
- */
-
-(function($){
-
-/**
- * The bgiframe is chainable and applies the iframe hack to get
- * around zIndex issues in IE6. It will only apply itself in IE6
- * and adds a class to the iframe called 'bgiframe'. The iframe
- * is appeneded as the first child of the matched element(s)
- * with a tabIndex and zIndex of -1.
- *
- * By default the plugin will take borders, sized with pixel units,
- * into account. If a different unit is used for the border's width,
- * then you will need to use the top and left settings as explained below.
- *
- * NOTICE: This plugin has been reported to cause perfromance problems
- * when used on elements that change properties (like width, height and
- * opacity) a lot in IE6. Most of these problems have been caused by
- * the expressions used to calculate the elements width, height and
- * borders. Some have reported it is due to the opacity filter. All
- * these settings can be changed if needed as explained below.
- *
- * @example $('div').bgiframe();
- * @before <div><p>Paragraph</p></div>
- * @result <div><iframe class="bgiframe".../><p>Paragraph</p></div>
- *
- * @param Map settings Optional settings to configure the iframe.
- * @option String|Number top The iframe must be offset to the top
- * by the width of the top border. This should be a negative
- * number representing the border-top-width. If a number is
- * is used here, pixels will be assumed. Otherwise, be sure
- * to specify a unit. An expression could also be used.
- * By default the value is "auto" which will use an expression
- * to get the border-top-width if it is in pixels.
- * @option String|Number left The iframe must be offset to the left
- * by the width of the left border. This should be a negative
- * number representing the border-left-width. If a number is
- * is used here, pixels will be assumed. Otherwise, be sure
- * to specify a unit. An expression could also be used.
- * By default the value is "auto" which will use an expression
- * to get the border-left-width if it is in pixels.
- * @option String|Number width This is the width of the iframe. If
- * a number is used here, pixels will be assume. Otherwise, be sure
- * to specify a unit. An experssion could also be used.
- * By default the value is "auto" which will use an experssion
- * to get the offsetWidth.
- * @option String|Number height This is the height of the iframe. If
- * a number is used here, pixels will be assume. Otherwise, be sure
- * to specify a unit. An experssion could also be used.
- * By default the value is "auto" which will use an experssion
- * to get the offsetHeight.
- * @option Boolean opacity This is a boolean representing whether or not
- * to use opacity. If set to true, the opacity of 0 is applied. If
- * set to false, the opacity filter is not applied. Default: true.
- * @option String src This setting is provided so that one could change
- * the src of the iframe to whatever they need.
- * Default: "javascript:false;"
- *
- * @name bgiframe
- * @type jQuery
- * @cat Plugins/bgiframe
- * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
- */
-$.fn.bgIframe = $.fn.bgiframe = function(s) {
- // This is only for IE6
- if ( $.browser.msie && /6.0/.test(navigator.userAgent) ) {
- s = $.extend({
- top : 'auto', // auto == .currentStyle.borderTopWidth
- left : 'auto', // auto == .currentStyle.borderLeftWidth
- width : 'auto', // auto == offsetWidth
- height : 'auto', // auto == offsetHeight
- opacity : true,
- src : 'javascript:false;'
- }, s || {});
- var prop = function(n){return n&&n.constructor==Number?n+'px':n;},
- html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+
- 'style="display:block;position:absolute;z-index:-1;'+
- (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
- 'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
- 'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
- 'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
- 'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
- '"/>';
- return this.each(function() {
- if ( $('> iframe.bgiframe', this).length == 0 )
- this.insertBefore( document.createElement(html), this.firstChild );
- });
- }
- return this;
-};
-
-})(jQuery);
View
1,175 JPADemo/JPADemo-web/src/main/webapp/scripts/jquery.datePicker.js
@@ -1,1175 +0,0 @@
-/**