mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 19:36:50 +00:00
Merge branch 'using_new_transaction_models'
This commit is contained in:
commit
15fb8ec2d3
@ -1,3 +1,30 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
|
||||
*/
|
||||
package bootstrap.liftweb
|
||||
|
||||
import net.liftweb._
|
||||
@ -10,6 +37,7 @@ import mapper._
|
||||
import code.model._
|
||||
import com.tesobe.utils._
|
||||
import myapp.model.MongoConfig
|
||||
import net.liftweb.util.Helpers._
|
||||
/**
|
||||
* A class that's instantiated early and run. It allows the application
|
||||
* to modify lift's environment
|
||||
@ -41,46 +69,26 @@ class Boot {
|
||||
LiftRules.addToPackages("code")
|
||||
|
||||
// For some restful stuff
|
||||
//LiftRules.dispatch.append(OBPRest) // stateful -- associated with a servlet container session
|
||||
LiftRules.statelessDispatchTable.append(OBPRest) // stateless -- no session created
|
||||
|
||||
// Build SiteMap
|
||||
def sitemap = SiteMap(
|
||||
//Menu.i("Home") / "index" >> User.AddUserMenusAfter //, // the simple way to declare a menu
|
||||
|
||||
// more complex because this menu allows anything in the
|
||||
// /static path to be visible
|
||||
//Menu(Loc("Static", Link(List("static"), true, "/static/index"),
|
||||
// "Static Content"))
|
||||
|
||||
// A menu with submenus
|
||||
/*, Menu.i("Info") / "info" submenus(
|
||||
Menu.i("About") / "about" >> Hidden >> LocGroup("bottom"),
|
||||
Menu.i("Contact") / "contact",
|
||||
Menu.i("Feedback") / "feedback" >> LocGroup("bottom")
|
||||
)*/
|
||||
// A Simon menu with submenus
|
||||
/*, Menu.i("Simon") / "simon" submenus(
|
||||
Menu.i("SAbout") / "sabout" >> Hidden >> LocGroup("bottom"),
|
||||
Menu.i("SContact") / "scontact",
|
||||
Menu.i("SFeedback") / "sfeedback" >> LocGroup("bottom")
|
||||
) */
|
||||
//, Menu.i("x") / "x" submenus(
|
||||
// Menu.i("y") / "y"
|
||||
// )
|
||||
Menu.i("Accounts") / "accounts" submenus(
|
||||
Menu.i("TESOBE") / "accounts" / "tesobe" submenus(
|
||||
Menu.i("Anonymous") / "accounts" / "tesobe" / "anonymous",
|
||||
Menu.i("Our Network") / "accounts" / "tesobe" / "our-network",
|
||||
Menu.i("Team") / "accounts" / "tesobe" / "team",
|
||||
Menu.i("Board") / "accounts" / "tesobe" / "board",
|
||||
Menu.i("Authorities") / "accounts" / "tesobe" / "authorities"
|
||||
Menu.i("Authorities") / "accounts" / "tesobe" / "authorities",
|
||||
Menu.i("Comments") / "comments" >> Hidden
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
LiftRules.statelessRewrite.append{
|
||||
case RewriteRequest(ParsePath("accounts" :: "tesobe" :: accessLevel :: "transactions" :: envelopeID :: "comments" :: Nil, "", true, _), _, therequest) =>
|
||||
RewriteResponse("comments" :: Nil, Map("envelopeID" -> envelopeID, "accessLevel" -> accessLevel))
|
||||
}
|
||||
|
||||
def sitemapMutators = User.sitemapMutator
|
||||
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -1,3 +1,30 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
|
||||
*/
|
||||
package myapp.model
|
||||
|
||||
import net.liftweb._
|
||||
|
||||
@ -1,10 +1,42 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
|
||||
*/
|
||||
package code.model
|
||||
|
||||
import net.liftweb.mongodb._
|
||||
import net.liftweb.record.MandatoryTypedField
|
||||
import net.liftweb.mongodb.record.field.{BsonRecordField, ObjectIdPk}
|
||||
import net.liftweb.mongodb.record.field.{BsonRecordField, ObjectIdPk, DateField, MongoListField}
|
||||
import net.liftweb.mongodb.record.{MongoMetaRecord, MongoRecord, BsonMetaRecord, BsonRecord}
|
||||
|
||||
import net.liftweb.common.{Box, Full, Empty, Failure}
|
||||
import java.util.Calendar
|
||||
import java.text.SimpleDateFormat
|
||||
import net.liftweb.json.DefaultFormats
|
||||
import java.util.Date
|
||||
import net.liftweb.record.field.{StringField}
|
||||
|
||||
import net.liftweb.json.JsonAST._
|
||||
|
||||
@ -99,41 +131,45 @@ object Location extends Location with BsonMetaRecord[Location]
|
||||
|
||||
/**
|
||||
* "Current Account View"
|
||||
{
|
||||
"obp_transaction":{
|
||||
"this_account":{
|
||||
"holder":"Music Pictures Limited",
|
||||
"number":"123567",
|
||||
"type":"current",
|
||||
"bank":{
|
||||
"IBAN":"DE1235123612",
|
||||
"national_identifier":"de.10010010",
|
||||
"name":"Postbank"
|
||||
}
|
||||
},
|
||||
"other_account":{
|
||||
"holder":"Client 1",
|
||||
"number":"123567",
|
||||
"type":"current",
|
||||
"bank":{
|
||||
"IBAN":"UK12222879",
|
||||
"national_identifier":"uk.10010010",
|
||||
"name":"HSBC"
|
||||
}
|
||||
},
|
||||
"details":{
|
||||
"type_en":"Transfer",
|
||||
"type_de":"Überweisung",
|
||||
"posted":"ISODate 2011-11-25T10:28:38.273Z",
|
||||
"completed":"ISODate 2011-11-26T10:28:38.273Z",
|
||||
"value":{
|
||||
"currency":"EUR",
|
||||
"amount":"123.45"
|
||||
},
|
||||
"other_data":"9Z65HCF/0723203600/68550030\nAU 100467978\nKD-Nr2767322"
|
||||
curl -i -H "Content-Type: application/json" -X POST -d '{
|
||||
"obp_transaction":{
|
||||
"this_account":{
|
||||
"holder":"Music Pictures Limited",
|
||||
"number":"123567",
|
||||
"kind":"current",
|
||||
"bank":{
|
||||
"IBAN":"DE1235123612",
|
||||
"national_identifier":"de.10010010",
|
||||
"name":"Postbank"
|
||||
}
|
||||
},
|
||||
"other_account":{
|
||||
"holder":"Simon Redfern",
|
||||
"number":"3225446882",
|
||||
"kind":"current",
|
||||
"bank":{
|
||||
"IBAN":"UK12789879",
|
||||
"national_identifier":"uk.10010010",
|
||||
"name":"HSBC"
|
||||
}
|
||||
},
|
||||
"details":{
|
||||
"type_en":"Transfer",
|
||||
"type_de":"Überweisung",
|
||||
"posted":"ISODate 2011-11-25T10:28:38.273Z",
|
||||
"completed":"ISODate 2011-11-26T10:28:38.273Z",
|
||||
"new_balance":{
|
||||
"currency":"EUR",
|
||||
"amount":"-354.99"
|
||||
},
|
||||
"value":{
|
||||
"currency":"EUR",
|
||||
"amount":"-354.99"
|
||||
},
|
||||
"other_data":"9Z65HCF/0723203600/68550030\nAU 100467978\nKD-Nr2767322"
|
||||
}
|
||||
}
|
||||
}
|
||||
}' http://localhost:8080/api/transactions
|
||||
*/
|
||||
|
||||
// Seems to map to a collection of the plural name
|
||||
@ -141,71 +177,112 @@ class OBPEnvelope private() extends MongoRecord[OBPEnvelope] with ObjectIdPk[OBP
|
||||
def meta = OBPEnvelope
|
||||
|
||||
// This creates a json attribute called "obp_transaction"
|
||||
object obp_transaction extends BsonRecordField(this, OBPTransact)
|
||||
|
||||
object obp_transaction extends BsonRecordField(this, OBPTransaction)
|
||||
|
||||
//TODO: We might want to move where comments are stored
|
||||
object comments extends MongoListField[OBPEnvelope, String](this)
|
||||
|
||||
def mediated_comments(user: String) : Box[List[String]] = {
|
||||
|
||||
user match{
|
||||
case "our-network" => Full(comments.get)
|
||||
case "team" => Full(comments.get)
|
||||
case "board" => Full(comments.get)
|
||||
case "authorities" => Full(comments.get)
|
||||
case _ => Empty
|
||||
}
|
||||
}
|
||||
|
||||
def asMediatedJValue(user: String) : JObject = {
|
||||
JObject(List(JField("obp_transaction", obp_transaction.get.asMediatedJValue(user)),
|
||||
JField("comments", JArray(comments.get.map(JString(_))))))
|
||||
}
|
||||
}
|
||||
|
||||
object OBPEnvelope extends OBPEnvelope with MongoMetaRecord[OBPEnvelope]
|
||||
|
||||
|
||||
class OBPTransact private() extends MongoRecord[OBPTransact] with ObjectIdPk[OBPTransact] {
|
||||
def meta = OBPTransact // what does meta do?
|
||||
class OBPTransaction private() extends BsonRecord[OBPTransaction]{
|
||||
def meta = OBPTransaction // what does meta do?
|
||||
|
||||
object this_account extends BsonRecordField(this, OBPAccount)
|
||||
object other_account extends BsonRecordField(this, OBPAccount)
|
||||
object details extends BsonRecordField(this, OBPDetails)
|
||||
|
||||
def asMediatedJValue(user: String) : JObject = {
|
||||
JObject(List(JField("this_account", this_account.get.asMediatedJValue(user)),
|
||||
JField("other_account", other_account.get.asMediatedJValue(user)),
|
||||
JField("details", details.get.asMediatedJValue(user))))
|
||||
}
|
||||
}
|
||||
|
||||
object OBPTransact extends OBPTransact with MongoMetaRecord[OBPTransact]
|
||||
|
||||
class OBPTransaction private() extends MongoRecord[OBPTransaction] with ObjectIdPk[OBPTransaction] {
|
||||
def meta = OBPTransaction // what does meta do?
|
||||
|
||||
|
||||
object obp_transaction_date_start extends net.liftweb.record.field.DateTimeField(this)
|
||||
object obp_transaction_date_complete extends net.liftweb.record.field.DateTimeField(this)
|
||||
|
||||
object obp_transaction_type_en extends net.liftweb.record.field.StringField(this, 255)
|
||||
object obp_transaction_type_de extends net.liftweb.record.field.StringField(this, 255)
|
||||
object obp_transaction_data_blob extends net.liftweb.record.field.StringField(this, 999999)
|
||||
object opb_transaction_other_account extends net.liftweb.record.field.StringField(this, 255)
|
||||
|
||||
object obp_transaction_currency extends net.liftweb.record.field.StringField(this, 10)
|
||||
object obp_transaction_amount extends net.liftweb.record.field.StringField(this, 20)
|
||||
object obp_transaction_new_balance extends net.liftweb.record.field.StringField(this, 20)
|
||||
|
||||
object obp_transaction_location extends BsonRecordField(this, Location)
|
||||
|
||||
|
||||
|
||||
object from_account extends BsonRecordField(this, OBPAccount)
|
||||
object to_account extends BsonRecordField(this, OBPAccount)
|
||||
object details extends BsonRecordField(this, OBPDetails)
|
||||
|
||||
object new_balance extends net.liftweb.record.field.StringField(this, 20)
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
object OBPTransaction extends OBPTransaction with MongoMetaRecord[OBPTransaction]
|
||||
object OBPTransaction extends OBPTransaction with BsonMetaRecord[OBPTransaction]
|
||||
|
||||
|
||||
///
|
||||
|
||||
|
||||
class OBPAccount private() extends MongoRecord[OBPAccount] with ObjectIdPk[OBPAccount] {
|
||||
class OBPAccount private() extends BsonRecord[OBPAccount]{
|
||||
def meta = OBPAccount
|
||||
|
||||
object holder extends net.liftweb.record.field.StringField(this, 255)
|
||||
object number extends net.liftweb.record.field.StringField(this, 255)
|
||||
object kind extends net.liftweb.record.field.StringField(this, 255)
|
||||
protected object holder extends net.liftweb.record.field.StringField(this, 255)
|
||||
protected object number extends net.liftweb.record.field.StringField(this, 255)
|
||||
protected object kind extends net.liftweb.record.field.StringField(this, 255)
|
||||
object bank extends BsonRecordField(this, OBPBank)
|
||||
|
||||
|
||||
def accountAliases : Map[String,String] = {
|
||||
Map("Neils Hapke" -> "The Chicken", "Yoav Aner" -> "Software Developer 1", "Jan Slabiak" -> "Alex")
|
||||
}
|
||||
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_holder(user: String) : Box[String] = {
|
||||
val theHolder = holder.get
|
||||
|
||||
def useAliases = {
|
||||
val alias = accountAliases.get(theHolder)
|
||||
if(alias.isDefined) Full(alias.get)
|
||||
else Full(theHolder)
|
||||
}
|
||||
|
||||
user match{
|
||||
case "team" => Full(theHolder)
|
||||
case "board" => Full(theHolder)
|
||||
case "authorities" => Full(theHolder)
|
||||
case "our-network" => useAliases
|
||||
case _ => Empty
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_number(user: String) : Box[String] = {
|
||||
user match{
|
||||
case "team" => Full(number.get)
|
||||
case "board" => Full(number.get)
|
||||
case "authorities" => Full(number.get)
|
||||
case _ => Empty
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_kind(user: String) : Box[String] = {
|
||||
user match{
|
||||
case "team" => Full(kind.get)
|
||||
case "board" => Full(kind.get)
|
||||
case "authorities" => Full(kind.get)
|
||||
case _ => Empty
|
||||
}
|
||||
}
|
||||
|
||||
def asMediatedJValue(user: String) : JObject = {
|
||||
JObject(List( JField("holder", JString(mediated_holder(user) getOrElse "---")),
|
||||
JField("number", JString(mediated_number(user) getOrElse "---")),
|
||||
JField("kind", JString(mediated_kind(user) getOrElse "---")),
|
||||
JField("bank", bank.get.asMediatedJValue(user))))
|
||||
}
|
||||
}
|
||||
|
||||
object OBPAccount extends OBPAccount with MongoMetaRecord[OBPAccount]
|
||||
object OBPAccount extends OBPAccount with BsonMetaRecord[OBPAccount]
|
||||
|
||||
|
||||
|
||||
@ -228,42 +305,179 @@ object OBPAccount extends OBPAccount with MongoMetaRecord[OBPAccount]
|
||||
|
||||
///////////
|
||||
|
||||
class OBPBank private() extends MongoRecord[OBPBank] with ObjectIdPk[OBPBank] {
|
||||
class OBPBank private() extends BsonRecord[OBPBank]{
|
||||
def meta = OBPBank
|
||||
|
||||
object IBAN extends net.liftweb.record.field.StringField(this, 255)
|
||||
object national_identifier extends net.liftweb.record.field.StringField(this, 255)
|
||||
object name extends net.liftweb.record.field.StringField(this, 255)
|
||||
protected object IBAN extends net.liftweb.record.field.StringField(this, 255)
|
||||
protected object national_identifier extends net.liftweb.record.field.StringField(this, 255)
|
||||
protected object name extends net.liftweb.record.field.StringField(this, 255)
|
||||
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_IBAN(user: String) : Box[String] = {
|
||||
user match{
|
||||
case "team" => Full(IBAN.get)
|
||||
case "board" => Full(IBAN.get)
|
||||
case "authorities" => Full(IBAN.get)
|
||||
case _ => Empty
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_national_identifier(user: String) : Box[String] = {
|
||||
user match{
|
||||
case "team" => Full(national_identifier.get)
|
||||
case "board" => Full(national_identifier.get)
|
||||
case "authorities" => Full(national_identifier.get)
|
||||
case _ => Empty
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_name(user: String) : Box[String] = {
|
||||
user match{
|
||||
case "team" => Full(name.get)
|
||||
case "board" => Full(name.get)
|
||||
case "authorities" => Full(name.get)
|
||||
case _ => Empty
|
||||
}
|
||||
}
|
||||
|
||||
def asMediatedJValue(user: String) : JObject = {
|
||||
JObject(List( JField("IBAN", JString(mediated_IBAN(user) getOrElse "---")),
|
||||
JField("national_identifier", JString(mediated_national_identifier(user) getOrElse "---")),
|
||||
JField("name", JString(mediated_name(user) getOrElse "---"))))
|
||||
}
|
||||
}
|
||||
|
||||
object OBPBank extends OBPBank with MongoMetaRecord[OBPBank]
|
||||
object OBPBank extends OBPBank with BsonMetaRecord[OBPBank]
|
||||
|
||||
|
||||
|
||||
class OBPDetails private() extends MongoRecord[OBPDetails] with ObjectIdPk[OBPDetails] {
|
||||
class OBPDetails private() extends BsonRecord[OBPDetails]{
|
||||
def meta = OBPDetails
|
||||
|
||||
object type_en extends net.liftweb.record.field.StringField(this, 255)
|
||||
object type_de extends net.liftweb.record.field.StringField(this, 255)
|
||||
object posted extends net.liftweb.record.field.DateTimeField(this)
|
||||
object completed extends net.liftweb.record.field.DateTimeField(this)
|
||||
protected object type_en extends net.liftweb.record.field.StringField(this, 255)
|
||||
protected object type_de extends net.liftweb.record.field.StringField(this, 255)
|
||||
protected object posted extends DateField(this)
|
||||
protected object completed extends DateField(this)
|
||||
protected object other_data extends net.liftweb.record.field.StringField(this, 5000)
|
||||
object new_balance extends BsonRecordField(this, OBPBalance)
|
||||
object value extends BsonRecordField(this, OBPValue)
|
||||
object other_data extends net.liftweb.record.field.StringField(this, 5000)
|
||||
|
||||
|
||||
|
||||
def formatDate(date : Box[Date]) : String = {
|
||||
date match{
|
||||
case Full(d) => OBPDetails.formats.dateFormat.format(d)
|
||||
case _ => "---"
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_type_en(user: String) : Box[String] = {
|
||||
user match{
|
||||
case _ => Full(type_en.get)
|
||||
}
|
||||
}
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_type_de(user: String) : Box[String] = {
|
||||
user match{
|
||||
case _ => Full(type_de.get)
|
||||
}
|
||||
}
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_posted(user: String) : Box[Date] = {
|
||||
user match{
|
||||
case _ => Full(posted.get)
|
||||
}
|
||||
}
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_completed(user: String) : Box[Date] = {
|
||||
user match{
|
||||
case _ => Full(completed.get)
|
||||
}
|
||||
}
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_other_data(user: String) : Box[String] = {
|
||||
user match{
|
||||
case "team" => Full(other_data.get)
|
||||
case "board" => Full(other_data.get)
|
||||
case "authorities" => Full(other_data.get)
|
||||
case _ => Empty
|
||||
}
|
||||
}
|
||||
|
||||
def asMediatedJValue(user: String) : JObject = {
|
||||
JObject(List( JField("type_en", JString(mediated_type_en(user) getOrElse "---")),
|
||||
JField("type_de", JString(mediated_type_de(user) getOrElse "---")),
|
||||
JField("posted", JString(formatDate(mediated_posted(user)))),
|
||||
JField("completed", JString(formatDate(mediated_completed(user)))),
|
||||
JField("other_data", JString(mediated_other_data(user) getOrElse "---")),
|
||||
JField("new_balance", new_balance.get.asMediatedJValue(user)),
|
||||
JField("value", value.get.asMediatedJValue(user))))
|
||||
}
|
||||
}
|
||||
|
||||
object OBPDetails extends OBPDetails with MongoMetaRecord[OBPDetails]
|
||||
object OBPDetails extends OBPDetails with BsonMetaRecord[OBPDetails]
|
||||
|
||||
|
||||
class OBPValue private() extends MongoRecord[OBPValue] with ObjectIdPk[OBPValue] {
|
||||
class OBPBalance private() extends BsonRecord[OBPBalance]{
|
||||
def meta = OBPBalance
|
||||
|
||||
protected object currency extends net.liftweb.record.field.StringField(this, 5)
|
||||
protected object amount extends net.liftweb.record.field.DecimalField(this, 0) // ok to use decimal?
|
||||
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_currency(user: String) : Box[String] = {
|
||||
user match{
|
||||
case _ => Full(currency.get.toString)
|
||||
}
|
||||
}
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
/**
|
||||
* TODO: This should probably return an actual decimal rather than a string -E.S.
|
||||
*/
|
||||
def mediated_amount(user: String) : Box[String] = {
|
||||
user match{
|
||||
case _ => Full(amount.get.toString)
|
||||
}
|
||||
}
|
||||
|
||||
def asMediatedJValue(user: String) : JObject = {
|
||||
JObject(List( JField("currency", JString(mediated_currency(user) getOrElse "---")),
|
||||
JField("amount", JString(mediated_amount(user) getOrElse "---"))))
|
||||
}
|
||||
}
|
||||
|
||||
object OBPBalance extends OBPBalance with BsonMetaRecord[OBPBalance]
|
||||
|
||||
class OBPValue private() extends BsonRecord[OBPValue]{
|
||||
def meta = OBPValue
|
||||
|
||||
object currency extends net.liftweb.record.field.StringField(this, 5)
|
||||
object amount extends net.liftweb.record.field.DecimalField(this, 0) // ok to use decimal?
|
||||
protected object currency extends net.liftweb.record.field.StringField(this, 5)
|
||||
protected object amount extends net.liftweb.record.field.DecimalField(this, 0) // ok to use decimal?
|
||||
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
def mediated_currency(user: String) : Box[String] = {
|
||||
user match{
|
||||
case _ => Full(currency.get.toString)
|
||||
}
|
||||
}
|
||||
//TODO: Access levels are currently the same across all transactions
|
||||
/**
|
||||
* TODO: This should probably return an actual decimal rather than a string -E.S.
|
||||
*/
|
||||
def mediated_amount(user: String) : Box[String] = {
|
||||
user match{
|
||||
case _ => Full(amount.get.toString)
|
||||
}
|
||||
}
|
||||
|
||||
def asMediatedJValue(user: String) : JObject = {
|
||||
JObject(List( JField("currency", JString(mediated_currency(user) getOrElse "---")),
|
||||
JField("amount", JString(mediated_amount(user) getOrElse "---"))))
|
||||
}
|
||||
}
|
||||
|
||||
object OBPValue extends OBPValue with MongoMetaRecord[OBPValue]
|
||||
object OBPValue extends OBPValue with BsonMetaRecord[OBPValue]
|
||||
|
||||
|
||||
|
||||
@ -1,3 +1,30 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
|
||||
*/
|
||||
package code
|
||||
package model
|
||||
|
||||
|
||||
145
MavLift/src/main/scala/code/snippet/Comments.scala
Normal file
145
MavLift/src/main/scala/code/snippet/Comments.scala
Normal file
@ -0,0 +1,145 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
|
||||
*/
|
||||
package code.snippet
|
||||
|
||||
import net.liftweb.util.Helpers._
|
||||
import net.liftweb.http.S
|
||||
import code.model.OBPEnvelope
|
||||
import net.liftweb.common.Full
|
||||
import scala.xml.NodeSeq
|
||||
import net.liftweb.http.SHtml
|
||||
import net.liftweb.common.Box
|
||||
import net.liftweb.http.js.JsCmd
|
||||
import net.liftweb.http.js.JsCmds.RedirectTo
|
||||
import net.liftweb.http.SessionVar
|
||||
import scala.xml.Text
|
||||
import net.liftweb.json.JsonAST.JObject
|
||||
import net.liftweb.json.JsonAST.JField
|
||||
import net.liftweb.json.JsonAST.JString
|
||||
import net.liftweb.json.JsonAST.JArray
|
||||
import net.liftweb.http.StringField
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
/**
|
||||
* This whole class is a rather hastily put together mess
|
||||
*/
|
||||
class Comments{
|
||||
|
||||
def commentPageTitle(xhtml: NodeSeq): NodeSeq = {
|
||||
val accessLevel = S.param("accessLevel") getOrElse "anonymous"
|
||||
val envelopeID = S.param("envelopeID") getOrElse ""
|
||||
|
||||
val envelope = OBPEnvelope.find(envelopeID)
|
||||
|
||||
envelope match {
|
||||
case Full(e) => {
|
||||
|
||||
val FORBIDDEN = "---"
|
||||
val dateFormat = new SimpleDateFormat("EEE MMM dd yyyy")
|
||||
|
||||
val transaction = e.obp_transaction.get
|
||||
val transactionDetails = transaction.details.get
|
||||
val transactionValue = transactionDetails.value.get
|
||||
val thisAccount = transaction.this_account.get
|
||||
val otherAccount = transaction.other_account.get
|
||||
|
||||
def formatDate(date: Box[Date]): String = {
|
||||
date match {
|
||||
case Full(d) => dateFormat.format(d)
|
||||
case _ => FORBIDDEN
|
||||
}
|
||||
}
|
||||
|
||||
(
|
||||
".amount *" #> transactionValue.mediated_amount(accessLevel).getOrElse(FORBIDDEN) &
|
||||
".other_account_holder *" #> otherAccount.mediated_holder(accessLevel).getOrElse(FORBIDDEN) &
|
||||
".currency *" #> transactionValue.mediated_currency(accessLevel).getOrElse(FORBIDDEN) &
|
||||
".date_cleared *" #> formatDate(transactionDetails.mediated_posted(accessLevel)) &
|
||||
".new_balance *" #> {
|
||||
transactionDetails.new_balance.get.mediated_amount(accessLevel).getOrElse(FORBIDDEN) + " " +
|
||||
transactionDetails.new_balance.get.mediated_currency(accessLevel).getOrElse(FORBIDDEN)
|
||||
}).apply(xhtml)
|
||||
|
||||
}
|
||||
case _ => Text("")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def showAll(xhtml: NodeSeq) : NodeSeq = {
|
||||
val accessLevel = S.param("accessLevel") getOrElse "anonymous"
|
||||
val envelopeID = S.param("envelopeID") getOrElse ""
|
||||
|
||||
val envelope = OBPEnvelope.find(envelopeID)
|
||||
|
||||
envelope match{
|
||||
case Full(e) => {
|
||||
e.mediated_comments(accessLevel).getOrElse(List()).flatMap(comment =>
|
||||
(".comment *" #> comment).apply(xhtml))
|
||||
}
|
||||
case _ => (".comment *" #> "No comments").apply(xhtml)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def addComment(xhtml: NodeSeq) : NodeSeq = {
|
||||
val accessLevel = S.param("accessLevel") getOrElse "anonymous"
|
||||
val envelopeID = S.param("envelopeID") getOrElse ""
|
||||
|
||||
val envelope = OBPEnvelope.find(envelopeID)
|
||||
|
||||
envelope match{
|
||||
case Full(e) => {
|
||||
e.mediated_comments(accessLevel) match{
|
||||
case Full(x) => {
|
||||
SHtml.ajaxForm(<p>{
|
||||
SHtml.text("",comment => {
|
||||
/**
|
||||
* This was badly hacked together to meet a deadline
|
||||
*/
|
||||
|
||||
val comments = e.comments.get
|
||||
val c2 = comments ++ List(comment)
|
||||
e.comments(c2)
|
||||
e.saveTheRecord()
|
||||
|
||||
})}</p> ++
|
||||
<input type="submit" onClick="history.go(0)" value="Add Comment"/>
|
||||
)
|
||||
}
|
||||
case _ => Text("Anonymous users may not view or submit comments")
|
||||
}
|
||||
|
||||
}
|
||||
case _ => Text("Cannot add comment to non-existant transaction")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
package code
|
||||
package snippet
|
||||
|
||||
import net.liftweb.util._
|
||||
import net.liftweb.common._
|
||||
import java.util.Date
|
||||
import code.lib._
|
||||
import Helpers._
|
||||
|
||||
class HelloWorld {
|
||||
lazy val date: Box[Date] = DependencyFactory.inject[Date] // inject the date
|
||||
|
||||
// replace the contents of the element with id "time" with the date
|
||||
def howdy = "#time *" #> date.map(_.toString)
|
||||
|
||||
/*
|
||||
lazy val date: Date = DependencyFactory.time.vend // create the date via factory
|
||||
|
||||
def howdy = "#time *" #> date.toString
|
||||
*/
|
||||
}
|
||||
|
||||
class MyFirstScalaClass {
|
||||
|
||||
// def yoyoyo = 123
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,3 +1,30 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
|
||||
*/
|
||||
package com.tesobe.utils {
|
||||
|
||||
import net.liftweb.http._
|
||||
@ -85,7 +112,7 @@ object OBPRest extends RestHelper {
|
||||
"this_account":{
|
||||
"holder":"Music Pictures Limited",
|
||||
"number":"123567",
|
||||
"type":"current",
|
||||
"kind":"current",
|
||||
"bank":{
|
||||
"IBAN":"DE1235123612",
|
||||
"national_identifier":"de.10010010",
|
||||
@ -95,7 +122,7 @@ object OBPRest extends RestHelper {
|
||||
"other_account":{
|
||||
"holder":"Client 1",
|
||||
"number":"123567",
|
||||
"type":"current",
|
||||
"kind":"current",
|
||||
"bank":{
|
||||
"IBAN":"UK12222879",
|
||||
"national_identifier":"uk.10010010",
|
||||
@ -105,211 +132,46 @@ object OBPRest extends RestHelper {
|
||||
"details":{
|
||||
"type_en":"Transfer",
|
||||
"type_de":"Überweisung",
|
||||
"posted":"ISODate 2011-11-25T10:28:38.273Z",
|
||||
"completed":"ISODate 2011-11-26T10:28:38.273Z",
|
||||
"posted":{
|
||||
"$dt":"2012-01-04T18:06:22.000Z"
|
||||
},
|
||||
"completed":{
|
||||
"$dt":"2012-09-04T18:52:13.000Z"
|
||||
},
|
||||
"new_balance":{
|
||||
"currency":"EUR",
|
||||
"amount":"4323.45"
|
||||
},
|
||||
"value":{
|
||||
"currency":"EUR",
|
||||
"amount":"123.45"
|
||||
},
|
||||
"other_data":"9Z65HCF/0723203600/68550030\nAU 100467978\nKD-Nr2767322"
|
||||
"other_data":"9"
|
||||
}
|
||||
}
|
||||
} ' http://localhost:8080/api/transactions
|
||||
} ' http://localhost:8080/api/transactions
|
||||
*/
|
||||
case "api" :: "transactions" :: Nil JsonPost json => {
|
||||
|
||||
for{
|
||||
t <- OBPEnvelope.fromJValue(json._1)
|
||||
saved <- t.saveTheRecord()
|
||||
} yield saved.asJValue
|
||||
} yield saved.asMediatedJValue("authorities") //this _should_ provide full access view, but with incorrect access settings it won't
|
||||
}
|
||||
|
||||
//curl -H "Accept: application/json" -H "Context-Type: application/json" -X GET "http://localhost:8080/api/accounts/tesobe/anonymous"
|
||||
//This is for demo purposes only, as it's showing every single transaction rather than everything tesobe specific. This will need
|
||||
//to be completely reworked.
|
||||
case "api" :: "accounts" :: "tesobe" :: accessLevel :: Nil JsonGet _ => {
|
||||
val allEnvelopes = OBPEnvelope.findAll(QueryBuilder.start().get)
|
||||
|
||||
//case Req("test" , "ping", _, _) => () => Full(PlainTextResponse("pong"))
|
||||
//case Req("xml" :: Nil, _, _) => Full(XmlResponse(<persons><name>Simon</name><name>John</name></persons>))
|
||||
//case Req("test" :: "static" :: _, "json", GetRequest) => JString("Static")
|
||||
//case Req("test" :: "static" :: _, "xml", GetRequest) => <b>Static Hello</b>
|
||||
//case Req("test":: "json", _, _) => () => Full(JsonResponse(List("simon","says")))
|
||||
case Req("api" :: "transactions" :: account_number, "", GetRequest) =>
|
||||
|
||||
// var transactions = OBPTransaction.findAll(QueryBuilder.start().get())
|
||||
|
||||
|
||||
|
||||
// just getting rid of simon test stuff.
|
||||
|
||||
|
||||
val qry = QueryBuilder.start("obp_data_blob").notEquals("simon-says").get
|
||||
var transactions = OBPTransaction.findAll(qry)
|
||||
|
||||
|
||||
JsonResponse(transactions.map(t => { t.asJValue }))
|
||||
|
||||
|
||||
case Req("create":: Nil, _, _) => () =>
|
||||
|
||||
|
||||
val cal = Calendar.getInstance
|
||||
cal.set(2009, 10, 2)
|
||||
|
||||
|
||||
|
||||
// but this creates an id_ which we don't need
|
||||
val from_account = OBPAccount.createRecord
|
||||
.holder("Simon Redfern")
|
||||
.kind("CURRENT")
|
||||
.number("344533456")
|
||||
|
||||
val tran = OBPTransaction.createRecord
|
||||
.obp_transaction_data_blob("created-test")
|
||||
.obp_transaction_amount("223344")
|
||||
.obp_transaction_date_complete(cal)
|
||||
.from_account(from_account)
|
||||
|
||||
|
||||
/* val env = OBPEnvelope.createRecord
|
||||
.obp_transaction(tran)
|
||||
.save
|
||||
*/
|
||||
|
||||
|
||||
val json_message = ("hello simon" -> 123)
|
||||
|
||||
// The last result of the function is returned.
|
||||
Full(JsonResponse(json_message))
|
||||
|
||||
|
||||
|
||||
case Req("mongodb":: Nil, _, _) => () =>
|
||||
|
||||
|
||||
|
||||
|
||||
// Create a location object
|
||||
val location = Location.createRecord.longitude(2).latitude(51)
|
||||
|
||||
|
||||
// don't seem to need parse. This is a query using the DSL (domain specific language)
|
||||
var simple_query = ("description" -> "simons another item") ~ ("price" -> 123.45)
|
||||
// JObject(List(JField(description,JString(simons another item)), JField(price,JDouble(123.45))))
|
||||
|
||||
|
||||
|
||||
println(simple_query)
|
||||
|
||||
// couldn't get this to work println(Printer.pretty(simple_query))
|
||||
|
||||
var string_query = """{ "description" : "simons another item" , "price" : 123.45 } """
|
||||
|
||||
|
||||
var location_query_string = """{ "location" : { "$near" : [2,2] } }"""
|
||||
|
||||
var location_query_json = parse(location_query_string)// ("location" -> ("$near" -> (2,2)))
|
||||
|
||||
|
||||
println(location_query_json)
|
||||
|
||||
|
||||
|
||||
|
||||
// See http://api.mongodb.org/java/2.3/com/mongodb/QueryBuilder.html
|
||||
|
||||
import com.mongodb._
|
||||
|
||||
var longitude = 2 // x
|
||||
var latitude = 51 // y
|
||||
|
||||
var earth_radius_km = 6378.137 // km
|
||||
var range_km = 5 // km
|
||||
var range_radians = range_km / earth_radius_km
|
||||
|
||||
|
||||
// .sort("description").is(-1)
|
||||
|
||||
|
||||
// To get records using mongodb record
|
||||
val qry = QueryBuilder.start("description").is("simons another item")
|
||||
.put("location")
|
||||
.withinCenter(longitude, latitude, range_radians)
|
||||
.get
|
||||
|
||||
val choose_items = OBPTransaction.findAll(qry)
|
||||
|
||||
|
||||
var some_json = """{"name":"joe","age":15}"""
|
||||
|
||||
var json_string = parse(some_json)
|
||||
|
||||
|
||||
|
||||
|
||||
println("here you are:")
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Using Casbah.....................
|
||||
|
||||
// Get a connection to MongoDB (note. Lift uses model/MongoConfig.scala for this config)
|
||||
val mongoConn = MongoConnection("obp_mongodb", 27017)
|
||||
|
||||
|
||||
// Get a mongodb database
|
||||
val mongoDB = mongoConn("OBP003")
|
||||
|
||||
|
||||
// Get a collection
|
||||
val obp_transactions_collection = mongoDB.getCollection("obptransactions")
|
||||
|
||||
// Print count of items in the collection
|
||||
println ("casbah thinks there are %d records in choose_items ".format(obp_transactions_collection.count()))
|
||||
|
||||
|
||||
// A Geo query!
|
||||
val my_query: DBObject = MongoDBObject("location" -> MongoDBObject(
|
||||
"$within" -> MongoDBObject(
|
||||
"$centerSphere" -> MongoDBList(
|
||||
MongoDBList(2, 51),
|
||||
0.1))))
|
||||
|
||||
// Define sort
|
||||
val my_sort: DBObject = MongoDBObject("description" -> -1)
|
||||
// Limit
|
||||
val my_limit = 5
|
||||
|
||||
|
||||
// Get the items, applying the sort and limit.
|
||||
val my_cursor = obp_transactions_collection.find(my_query).sort(my_sort).limit(my_limit)
|
||||
|
||||
|
||||
// Print the results.
|
||||
while(my_cursor.hasNext()) {
|
||||
println(my_cursor.next());
|
||||
|
||||
val envelopeJson = allEnvelopes.map(envelope => envelope.asMediatedJValue(accessLevel))
|
||||
|
||||
|
||||
JsonResponse(envelopeJson)
|
||||
}
|
||||
|
||||
println ("casbah thinks there are %d records in my_records ".format(my_cursor.count()))
|
||||
|
||||
|
||||
val mongoColl = MongoConnection()("chooseitems")
|
||||
|
||||
|
||||
val q = MongoDBObject("user" -> "someOtherUser")
|
||||
|
||||
|
||||
val items_count = choose_items.size
|
||||
|
||||
println("There are %d items in the list".format(items_count))
|
||||
|
||||
if (items_count > 0) {
|
||||
//println(choose_items.first.description)
|
||||
println("after--------")
|
||||
}
|
||||
|
||||
|
||||
//Full(XhtmlResponse(choose_item_1.toXHtml))
|
||||
//Full(JsonResponse(List("Count of items found", items_count)))
|
||||
|
||||
val json_message = ("items_count" -> items_count)
|
||||
|
||||
// The last result of the function is returned.
|
||||
Full(JsonResponse(json_message))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,30 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
|
||||
*/
|
||||
package code.snippet
|
||||
|
||||
import net.liftweb.http.{PaginatorSnippet, StatefulSnippet}
|
||||
@ -13,33 +40,17 @@ import net.liftweb.mongodb.Skip._
|
||||
import net.liftweb.util.Helpers._
|
||||
import net.liftweb.util._
|
||||
import scala.xml.Text
|
||||
|
||||
/**
|
||||
* A default implementation of DateTimeConverter that uses (Time)Helpers
|
||||
|
||||
object DefaultDateTimeConverter extends DateTimeConverter {
|
||||
def formatDateTime(d: Date) = internetDateFormat.format(d)
|
||||
def formatDate(d: Date) = dateFormat.format(d)
|
||||
/** Uses Helpers.hourFormat which includes seconds but not time zone */
|
||||
def formatTime(d: Date) = hourFormat.format(d)
|
||||
|
||||
def parseDateTime(s: String) = tryo { internetDateFormat.parse(s) }
|
||||
def parseDate(s: String) = tryo { dateFormat.parse(s) }
|
||||
/** Tries Helpers.hourFormat and Helpers.timeFormat */
|
||||
def parseTime(s: String) = tryo{hourFormat.parse(s)} or
|
||||
tryo{timeFormat.parse(s)}
|
||||
|
||||
}
|
||||
*/
|
||||
import net.liftweb.common.{Box, Failure, Empty, Full}
|
||||
import java.util.Date
|
||||
|
||||
class OBPTransactionSnippet extends StatefulSnippet with PaginatorSnippet[OBPEnvelope] {
|
||||
|
||||
override def count = OBPTransaction.count
|
||||
override def count = OBPEnvelope.count
|
||||
|
||||
|
||||
override def itemsPerPage = 5
|
||||
//override def page = OBPTransaction.findAll(QueryBuilder.start().get(), Limit(itemsPerPage), Skip(curPage*itemsPerPage))
|
||||
override def page = {
|
||||
override def page : List[OBPEnvelope]= {
|
||||
// TODO we need to get Rogue going otherwise its possible to write queries that don't make sense!
|
||||
// val qry = QueryBuilder.start("obp_transaction_data_blob").notEquals("simon-says").get
|
||||
|
||||
@ -64,7 +75,7 @@ class OBPTransactionSnippet extends StatefulSnippet with PaginatorSnippet[OBPEnv
|
||||
case "paginate" => paginate _
|
||||
//case "top" => top _
|
||||
}
|
||||
|
||||
|
||||
def showAll(xhtml: NodeSeq): NodeSeq = {
|
||||
|
||||
// To get records using mongodb record
|
||||
@ -73,233 +84,60 @@ class OBPTransactionSnippet extends StatefulSnippet with PaginatorSnippet[OBPEnv
|
||||
//val obp_transactions = OBPTransaction.findAll(qry)
|
||||
|
||||
def present_obp_transaction_new_balance(value: String, consumer: String): String = {
|
||||
val show: String =
|
||||
if(consumer == "team")
|
||||
value
|
||||
else if(consumer == "board")
|
||||
value
|
||||
else if(consumer == "our_network")
|
||||
(if (value.startsWith("-") ) "-" else "+")
|
||||
else if(consumer == "authorities")
|
||||
value
|
||||
else if(consumer == "anonymous")
|
||||
(if (value.startsWith("-") ) "-" else "+")
|
||||
else
|
||||
"---"
|
||||
show
|
||||
}
|
||||
|
||||
def present_obp_transaction_amount(value: String, consumer: String): String = {
|
||||
// How the other account is presented to others
|
||||
// Use an alias if shy wins
|
||||
val show: String =
|
||||
if(consumer == "team")
|
||||
value
|
||||
else if(consumer == "board")
|
||||
value
|
||||
else if(consumer == "our_network")
|
||||
value
|
||||
else if(consumer == "authorities")
|
||||
value
|
||||
else if(consumer == "anonymous")
|
||||
(if (value.startsWith("-") ) "-" else "+")
|
||||
else
|
||||
"---"
|
||||
show
|
||||
}
|
||||
|
||||
def present_obp_transaction_other_account(value: String, consumer: String): String = {
|
||||
// How the other account is presented to others
|
||||
// Use an alias if shy wins
|
||||
|
||||
//val result: String
|
||||
|
||||
val outsiders: List[String] = List("anonymous")
|
||||
|
||||
if (outsiders.contains(value)) {
|
||||
|
||||
|
||||
val showOnlyValueSign = if(value.startsWith("-")) "-" else "+"
|
||||
|
||||
consumer match {
|
||||
case "team" => value
|
||||
case "board" => value
|
||||
case "our_network" => showOnlyValueSign
|
||||
case "authorities" => showOnlyValueSign
|
||||
case "anonymous" => showOnlyValueSign
|
||||
case _ => "---"
|
||||
}
|
||||
|
||||
|
||||
if (other_account_is_shy(value, consumer)) other_account_alias(value) else value
|
||||
}
|
||||
|
||||
|
||||
|
||||
def other_account_is_a_client(value: String): Boolean = {
|
||||
// A list of clients
|
||||
val clients: List[String] = List("TXTR GMBH")
|
||||
clients.contains(value)
|
||||
}
|
||||
|
||||
def other_account_is_a_team_member(value: String): Boolean = {
|
||||
// A list of team members
|
||||
val team: List[String] = List("Simon Redfern", "Stefan Bethge", "Eveline M", "Ismail Chaib", "Tim Kleinschmidt", "Niels Hapke", "Yoav Aner")
|
||||
team.contains(value)
|
||||
}
|
||||
|
||||
def other_account_is_a_supplier(value: String): Boolean = {
|
||||
// A list of suppliers
|
||||
val suppliers: List[String] = List("HETZNER ONLINE AG", "Cyberport GmbH", "S-BAHN BERLIN GMBH")
|
||||
suppliers.contains(value)
|
||||
}
|
||||
|
||||
def other_account_is_shy(value: String, consumer: String): Boolean = {
|
||||
// A list of the financially shy (or just plain private)
|
||||
val the_shy: List[String] = List("Tim Kleinschmidt", "Jan Slabiak")
|
||||
// A list of those that can look anyway
|
||||
val the_gods: List[String] = List("team", "board", "authorities")
|
||||
// No one can be shy in front of the gods
|
||||
(the_shy.contains(value) && !(the_gods.contains(value)))
|
||||
}
|
||||
|
||||
def other_account_alias(value: String): String = {
|
||||
// A map of aliases (used if shyness wins)
|
||||
val aliases = Map("Neils Hapke" -> "The Chicken", "Yoav Aner" -> "Software Developer 1", "Jan Slabiak" -> "Alex")
|
||||
aliases.getOrElse(value, "Anon")
|
||||
}
|
||||
|
||||
|
||||
def other_account_is_known(value: String): Boolean = {
|
||||
// Do we know this other account?
|
||||
(other_account_is_a_team_member(value) ||
|
||||
other_account_is_a_client(value) ||
|
||||
other_account_is_a_supplier(value)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// xhtml
|
||||
val consumer = S.attr("consumer") openOr "no param consumer passed"
|
||||
|
||||
if (consumer == "anonymous") {
|
||||
}
|
||||
|
||||
// call anonymous function on every transaction in obp_transactions (i.e. what a map does)
|
||||
// the lambda function here replaces some stuff with the data
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
val formatter = new SimpleDateFormat ( "yyyy-MM-dd HH:mm" )
|
||||
val date = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2008-05-06 13:29")
|
||||
|
||||
|
||||
// Given a date in a string like this:
|
||||
val string_date = "30.09.11"
|
||||
// We can use a date formatter like this:
|
||||
val date_formatter = new SimpleDateFormat ( "dd.MM.yy" )
|
||||
|
||||
// Or in place like this.
|
||||
val date_x = new SimpleDateFormat("dd.MM.yy").parse(string_date)
|
||||
|
||||
|
||||
|
||||
println ("the date is")
|
||||
println (formatter.format(date.getTime))
|
||||
println ("here is a loop")
|
||||
|
||||
|
||||
val long_date_formatter = new SimpleDateFormat ( "yyyy-MM-dd HH:mm" )
|
||||
|
||||
val short_date_formatter = new SimpleDateFormat ( "yyyy-MM-dd" )
|
||||
|
||||
|
||||
// note: blob contains other account right now.
|
||||
|
||||
// page.foreach(p => println(formatter.format(p.obp_transaction_date_complete.value)))
|
||||
|
||||
|
||||
// right now, dates are stored like this: 30.09.11
|
||||
|
||||
//page.foreach(p => println(p.obp_transaction_date_complete))
|
||||
|
||||
|
||||
//net.liftweb.record.field.DateTimeField
|
||||
|
||||
println("before env ****************")
|
||||
/* for (envelope <- page) {
|
||||
println("here is an envelope")
|
||||
println(envelope.id)
|
||||
println(envelope.obp_transaction.get.obp_transaction_date_complete)
|
||||
println(envelope.obp_transaction.get.opb_transaction_other_account)
|
||||
println(envelope.obp_transaction.get.obp_transaction_data_blob)
|
||||
println("nope")
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
date_x match {
|
||||
case g2: Graphics2D => g2
|
||||
case _ => throw new ClassCastException
|
||||
}
|
||||
*/
|
||||
|
||||
val cal = Calendar.getInstance
|
||||
cal.set(2009, 10, 2)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* val tran = OBPTransaction.createRecord
|
||||
.obp_transaction_data_blob("simon-says")
|
||||
.obp_transaction_amount("2222222")
|
||||
.obp_transaction_date_complete(cal)
|
||||
|
||||
|
||||
val env = OBPEnvelope.createRecord
|
||||
.obp_transaction(tran)
|
||||
.save*/
|
||||
|
||||
|
||||
println( "xxxxx")
|
||||
println(formatter.format(cal.getTime))
|
||||
print("yyyyyyyy")
|
||||
|
||||
|
||||
//page.foreach(p => println(date_formatter.format(p.obp_transaction_date_complete)))
|
||||
|
||||
|
||||
println ("end of loop")
|
||||
|
||||
|
||||
// "EEE, d MMM yyyy HH:mm:ss Z"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Text("foo")
|
||||
|
||||
/* page.flatMap(obp_envelope => {
|
||||
(
|
||||
".obp_transaction_type_en *" #> obp_envelope.obp_transaction.get.obp_transaction_type_en &
|
||||
".obp_transaction_type_de *" #> obp_envelope.obp_transaction.get.obp_transaction_type_de &
|
||||
".obp_transaction_data_blob *" #> present_obp_transaction_other_account(obp_envelope.obp_transaction.get.obp_transaction_data_blob.value, consumer) &
|
||||
".obp_transaction_new_balance *" #> present_obp_transaction_new_balance(obp_envelope.obp_transaction.get.obp_transaction_new_balance.value, consumer) &
|
||||
".obp_transaction_amount *" #> present_obp_transaction_amount(obp_envelope.obp_transaction.get.obp_transaction_amount.value, consumer) &
|
||||
//".obp_transaction_currency *" #> obp_transaction.obp_transaction_currency &
|
||||
".obp_transaction_currency *" #> "EUR" &
|
||||
".obp_transaction_date_start *" #> (short_date_formatter.format(obp_envelope.obp_transaction.get.obp_transaction_date_start.value.getTime())) &
|
||||
//".obp_transaction_date_complete *" #> OBPTransaction.formats.dateFormat.format(obp_transaction.obp_transaction_date_complete.value.getTime()) &
|
||||
".obp_transaction_date_complete *" #> short_date_formatter.format(obp_envelope.obp_transaction.get.obp_transaction_date_complete.value.getTime()) &
|
||||
".opb_transaction_other_account *" #> present_obp_transaction_other_account(obp_envelope.obp_transaction.get.opb_transaction_other_account.value, consumer)).apply(xhtml)
|
||||
val consumer = S.uri match{
|
||||
case uri if uri.endsWith("authorities") => "authorities"
|
||||
case uri if uri.endsWith("board") => "board"
|
||||
case uri if uri.endsWith("our-network") => "our-network"
|
||||
case uri if uri.endsWith("team") => "team"
|
||||
case _ => "anonymous"
|
||||
}
|
||||
|
||||
page.flatMap(obpEnvelope => {
|
||||
val FORBIDDEN = "---"
|
||||
|
||||
val dateFormat = new SimpleDateFormat("EEE MMM dd yyyy")
|
||||
|
||||
val envelopeID = obpEnvelope.id
|
||||
|
||||
val transaction = obpEnvelope.obp_transaction.get
|
||||
val transactionDetails = transaction.details.get
|
||||
val transactionValue = transactionDetails.value.get
|
||||
val thisAccount = transaction.this_account.get
|
||||
val otherAccount = transaction.other_account.get
|
||||
|
||||
def formatDate(date : Box[Date]) : String = {
|
||||
date match{
|
||||
case Full(d) => dateFormat.format(d)
|
||||
case _ => FORBIDDEN
|
||||
}
|
||||
}
|
||||
)*/
|
||||
|
||||
(
|
||||
".amount *" #> transactionValue.mediated_amount(consumer).getOrElse(FORBIDDEN) &
|
||||
".other_account_holder *" #> otherAccount.mediated_holder(consumer).getOrElse(FORBIDDEN) &
|
||||
".currency *" #> transactionValue.mediated_currency(consumer).getOrElse(FORBIDDEN) &
|
||||
".date_cleared *" #> formatDate(transactionDetails.mediated_posted(consumer))&
|
||||
".new_balance *" #> {
|
||||
transactionDetails.new_balance.get.mediated_amount(consumer).getOrElse(FORBIDDEN) + " " +
|
||||
transactionDetails.new_balance.get.mediated_currency(consumer).getOrElse(FORBIDDEN)
|
||||
} &
|
||||
".comments_link *" #> <a href={consumer + "/transactions/" + envelopeID + "/comments"}>Comments ({(obpEnvelope.mediated_comments(consumer) getOrElse List()).size})</a>).apply(xhtml)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
def showAll(xhtml: NodeSeq): NodeSeq = {
|
||||
page.flatMap(OBPTransaction => {
|
||||
(".opb_transaction_other_account *" #> OBPTransaction.opb_transaction_other_account).apply(xhtml)
|
||||
})
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,30 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
|
||||
*/
|
||||
|
||||
//import au.com.bytecode.opencsv.CSVReader
|
||||
import java.io.FileReader
|
||||
|
||||
@ -1,3 +1,29 @@
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
@ -1,4 +1,29 @@
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -9,9 +34,6 @@
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<h2>This is tesobe</h2>
|
||||
<p>
|
||||
<span class="lift:helloWorld.howdy">
|
||||
Welcome. The time is <span id="time">Time goes here</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@ -1,52 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
|
||||
<title>For the Tax Payers</title>
|
||||
</head>
|
||||
<body class="lift:content_id=main">
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<h2>For the Tax Payers</h2>
|
||||
<p>
|
||||
<span class="lift:helloWorld.howdy">
|
||||
Welcome. The time is <span id="time">Time goes here</span>
|
||||
</span>
|
||||
</p>
|
||||
<div>
|
||||
<h3>Transactions</h3>
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
<br>
|
||||
</div>
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th class="span-1">Account</th>
|
||||
<th class="span-1">Posted</th> -->
|
||||
<th class="span-1">Cleared</th>
|
||||
<th class="span-1">Amount</th>
|
||||
<th class="span-1">Currency</th>
|
||||
<!-- <th class="span-1">Type</th> -->
|
||||
<th class="span-1">Info</th>
|
||||
<th class="span-1">Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lift:OBPTransactionSnippet.showAll?consumer=anonymous">
|
||||
<!-- <td class="opb_transaction_other_account">other account</td>
|
||||
<td class="obp_transaction_date_start">start date</td> -->
|
||||
<td class="obp_transaction_date_complete">completed date</td>
|
||||
<td class="obp_transaction_amount">obp_transaction_amount</td>
|
||||
<td class="obp_transaction_currency">obp_transaction_currency</td>
|
||||
<!-- <td class="obp_transaction_type_en">obp_transaction_type_en</td> -->
|
||||
<!-- <td class="obp_transaction_type_de">obp_transaction_type_de</td> -->
|
||||
<td class="obp_transaction_data_blob">obp_transaction_data_blob</td>
|
||||
<td class="obp_transaction_new_balance">obp_transaction_new_balance</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<div class="lift:surround?with=account;at=page_header">For the Tax Payers</div>
|
||||
@ -1,52 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
|
||||
<title>For the tax Authorities</title>
|
||||
</head>
|
||||
<body class="lift:content_id=main">
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<h2>For the tax Authorities</h2>
|
||||
<p>
|
||||
<span class="lift:helloWorld.howdy">
|
||||
Welcome. The time is <span id="time">Time goes here</span>
|
||||
</span>
|
||||
</p>
|
||||
<div>
|
||||
<h3>Transactions</h3>
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
<br>
|
||||
</div>
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th class="span-1">Account</th>
|
||||
<th class="span-1">Posted</th> -->
|
||||
<th class="span-1">Cleared</th>
|
||||
<th class="span-1">Amount</th>
|
||||
<th class="span-1">Currency</th>
|
||||
<!-- <th class="span-1">Type</th> -->
|
||||
<th class="span-1">Info</th>
|
||||
<th class="span-1">Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lift:OBPTransactionSnippet.showAll?consumer=authorities">
|
||||
<!-- <td class="opb_transaction_other_account">other account</td>
|
||||
<td class="obp_transaction_date_start">start date</td> -->
|
||||
<td class="obp_transaction_date_complete">completed date</td>
|
||||
<td class="obp_transaction_amount">obp_transaction_amount</td>
|
||||
<td class="obp_transaction_currency">obp_transaction_currency</td>
|
||||
<!-- <td class="obp_transaction_type_en">obp_transaction_type_en</td> -->
|
||||
<!-- <td class="obp_transaction_type_de">obp_transaction_type_de</td> -->
|
||||
<td class="obp_transaction_data_blob">obp_transaction_data_blob</td>
|
||||
<td class="obp_transaction_new_balance">obp_transaction_new_balance</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<div class="lift:surround?with=account;at=page_header">For the Tax Authorities</div>
|
||||
@ -1,52 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
|
||||
<title>For the Board</title>
|
||||
</head>
|
||||
<body class="lift:content_id=main">
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<h2>For the Board</h2>
|
||||
<p>
|
||||
<span class="lift:helloWorld.howdy">
|
||||
Welcome. The time is <span id="time">Time goes here</span>
|
||||
</span>
|
||||
</p>
|
||||
<div>
|
||||
<h3>Transactions</h3>
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
<br>
|
||||
</div>
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th class="span-1">Account</th>
|
||||
<th class="span-1">Posted</th> -->
|
||||
<th class="span-1">Cleared</th>
|
||||
<th class="span-1">Amount</th>
|
||||
<th class="span-1">Currency</th>
|
||||
<!-- <th class="span-1">Type</th> -->
|
||||
<th class="span-1">Info</th>
|
||||
<th class="span-1">Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lift:OBPTransactionSnippet.showAll?consumer=board">
|
||||
<!-- <td class="opb_transaction_other_account">other account</td>
|
||||
<td class="obp_transaction_date_start">start date</td> -->
|
||||
<td class="obp_transaction_date_complete">completed date</td>
|
||||
<td class="obp_transaction_amount">obp_transaction_amount</td>
|
||||
<td class="obp_transaction_currency">obp_transaction_currency</td>
|
||||
<!-- <td class="obp_transaction_type_en">obp_transaction_type_en</td> -->
|
||||
<!-- <td class="obp_transaction_type_de">obp_transaction_type_de</td> -->
|
||||
<td class="obp_transaction_data_blob">obp_transaction_data_blob</td>
|
||||
<td class="obp_transaction_new_balance">obp_transaction_new_balance</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<div class="lift:surround?with=account;at=page_header">For the Board</div>
|
||||
@ -1,52 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
|
||||
<title>For our Network</title>
|
||||
</head>
|
||||
<body class="lift:content_id=main">
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<h2>For our Network</h2>
|
||||
<p>
|
||||
<span class="lift:helloWorld.howdy">
|
||||
Welcome. The time is <span id="time">Time goes here</span>
|
||||
</span>
|
||||
</p>
|
||||
<div>
|
||||
<h3>Transactions</h3>
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
<br>
|
||||
</div>
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th class="span-1">Account</th>
|
||||
<th class="span-1">Posted</th> -->
|
||||
<th class="span-1">Cleared</th>
|
||||
<th class="span-1">Amount</th>
|
||||
<th class="span-1">Currency</th>
|
||||
<!-- <th class="span-1">Type</th> -->
|
||||
<th class="span-1">Info</th>
|
||||
<th class="span-1">Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lift:OBPTransactionSnippet.showAll?consumer=our_network">
|
||||
<!-- <td class="opb_transaction_other_account">other account</td>
|
||||
<td class="obp_transaction_date_start">start date</td> -->
|
||||
<td class="obp_transaction_date_complete">completed date</td>
|
||||
<td class="obp_transaction_amount">obp_transaction_amount</td>
|
||||
<td class="obp_transaction_currency">obp_transaction_currency</td>
|
||||
<!-- <td class="obp_transaction_type_en">obp_transaction_type_en</td> -->
|
||||
<!-- <td class="obp_transaction_type_de">obp_transaction_type_de</td> -->
|
||||
<td class="obp_transaction_data_blob">obp_transaction_data_blob</td>
|
||||
<td class="obp_transaction_new_balance">obp_transaction_new_balance</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<div class="lift:surround?with=account;at=page_header">For our Network</div>
|
||||
@ -1,52 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
|
||||
<title>For our Team</title>
|
||||
</head>
|
||||
<body class="lift:content_id=main">
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<h2>For our Team</h2>
|
||||
<p>
|
||||
<span class="lift:helloWorld.howdy">
|
||||
Welcome. The time is <span id="time">Time goes here</span>
|
||||
</span>
|
||||
</p>
|
||||
<div>
|
||||
<h3>Transactions</h3>
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
<br>
|
||||
</div>
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th class="span-1">Account</th>
|
||||
<th class="span-1">Posted</th> -->
|
||||
<th class="span-1">Cleared</th>
|
||||
<th class="span-1">Amount</th>
|
||||
<th class="span-1">Currency</th>
|
||||
<!-- <th class="span-1">Type</th> -->
|
||||
<th class="span-1">Info</th>
|
||||
<th class="span-1">Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lift:OBPTransactionSnippet.showAll?consumer=team">
|
||||
<!-- <td class="opb_transaction_other_account">other account</td>
|
||||
<td class="obp_transaction_date_start">start date</td> -->
|
||||
<td class="obp_transaction_date_complete">completed date</td>
|
||||
<td class="obp_transaction_amount">obp_transaction_amount</td>
|
||||
<td class="obp_transaction_currency">obp_transaction_currency</td>
|
||||
<!-- <td class="obp_transaction_type_en">obp_transaction_type_en</td> -->
|
||||
<!-- <td class="obp_transaction_type_de">obp_transaction_type_de</td> -->
|
||||
<td class="obp_transaction_data_blob">obp_transaction_data_blob</td>
|
||||
<td class="obp_transaction_new_balance">obp_transaction_new_balance</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<div class="lift:surround?with=account;at=page_header">For the team</div>
|
||||
76
MavLift/src/main/webapp/comments.html
Normal file
76
MavLift/src/main/webapp/comments.html
Normal file
@ -0,0 +1,76 @@
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
|
||||
<title>Accounts</title>
|
||||
</head>
|
||||
<body class="lift:content_id=main">
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th class="span-1">Account</th>
|
||||
<th class="span-1">Posted</th> -->
|
||||
<th class="span-1">Cleared</th>
|
||||
<th class="span-1">Amount</th>
|
||||
<th class="span-1">Currency</th>
|
||||
<!-- <th class="span-1">Type</th> -->
|
||||
<th class="span-1">To/From</th>
|
||||
<th class="span-1">Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class=lift:Comments.commentPageTitle>
|
||||
<!-- <td class="opb_transaction_other_account">other account</td>
|
||||
<td class="obp_transaction_date_start">start date</td> -->
|
||||
<td class="date_cleared">completed date</td>
|
||||
<td class="amount">obp_transaction_amount</td>
|
||||
<td class="currency">obp_transaction_currency</td>
|
||||
<!-- <td class="obp_transaction_type_en">obp_transaction_type_en</td> -->
|
||||
<!-- <td class="obp_transaction_type_de">obp_transaction_type_de</td> -->
|
||||
<td class="other_account_holder">obp_transaction_data_blob</td>
|
||||
<td class="new_balance">obp_transaction_new_balance</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<p>
|
||||
<div>Comments:</div>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr class="lift:Comments.showAll">
|
||||
<td class="comment">The comment goes here</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="lift:Comments.addComment"><span class="add">Add a comment here</span></div>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,25 +0,0 @@
|
||||
<lift:surround with="default" at="content">
|
||||
<p>
|
||||
This is the file upload sample page. You choose a file
|
||||
to upload and the application will tell you the file name, the mime type,
|
||||
the number of bytes in the file and the MD5 checksum.
|
||||
</p>
|
||||
|
||||
<lift:snippet type="misc:upload" form="post" multipart="true">
|
||||
<choose:post>
|
||||
<p>
|
||||
File name: <ul:file_name></ul:file_name><br >
|
||||
MIME Type: <ul:mime_type></ul:mime_type><br >
|
||||
File length: <ul:length></ul:length><br >
|
||||
MD5 Hash: <ul:md5></ul:md5><br >
|
||||
</p>
|
||||
</choose:post>
|
||||
|
||||
<choose:get>
|
||||
Select a file to upload: <ul:file_upload></ul:file_upload><br >
|
||||
<input type="submit" value="Upload File">
|
||||
</choose:get>
|
||||
|
||||
</lift:snippet>
|
||||
|
||||
</lift:surround>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 17 KiB |
@ -1,3 +1,29 @@
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -8,8 +34,8 @@
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<h2>Welcome to the Open Bank Project!</h2>
|
||||
<p>
|
||||
<span class="lift:helloWorld.howdy">
|
||||
Welcome to the Open Bank Project. the time is <span id="time">Time goes here</span>
|
||||
<span>
|
||||
Welcome to the Open Bank Project.
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -1,3 +1,29 @@
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
|
||||
<title>Simon</title>
|
||||
</head>
|
||||
<body class="bla">
|
||||
|
||||
<h2>Welcome to Simon! This is x/y.html</h2>
|
||||
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
Static content... everything you put in the /static
|
||||
directory will be served without additions to SiteMap
|
||||
</div>
|
||||
|
||||
76
MavLift/src/main/webapp/templates-hidden/account.html
Normal file
76
MavLift/src/main/webapp/templates-hidden/account.html
Normal file
@ -0,0 +1,76 @@
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
|
||||
</head>
|
||||
<body class="lift:content_id=main">
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<h2 class="page_header">The page header will get bound here</h2>
|
||||
<p>
|
||||
</p>
|
||||
<div>
|
||||
<h3>Transactions</h3>
|
||||
|
||||
<br>
|
||||
</div>
|
||||
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th class="span-1">Account</th>
|
||||
<th class="span-1">Posted</th> -->
|
||||
<th class="span-1">Cleared</th>
|
||||
<th class="span-1">Amount</th>
|
||||
<th class="span-1">Currency</th>
|
||||
<!-- <th class="span-1">Type</th> -->
|
||||
<th class="span-1">To/From</th>
|
||||
<th class="span-1">Balance</th>
|
||||
<th class="span-1">Comments</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class=lift:OBPTransactionSnippet.showAll>
|
||||
<!-- <td class="opb_transaction_other_account">other account</td>
|
||||
<td class="obp_transaction_date_start">start date</td> -->
|
||||
<td class="date_cleared">completed date</td>
|
||||
<td class="amount">obp_transaction_amount</td>
|
||||
<td class="currency">obp_transaction_currency</td>
|
||||
<!-- <td class="obp_transaction_type_en">obp_transaction_type_en</td> -->
|
||||
<!-- <td class="obp_transaction_type_de">obp_transaction_type_de</td> -->
|
||||
<td class="other_account_holder">obp_transaction_data_blob</td>
|
||||
<td class="new_balance">obp_transaction_new_balance</td>
|
||||
<td class="comments_link">link to comments</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,3 +1,29 @@
|
||||
<!--
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
Open Bank Project (http://www.openbankproject.com)
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
by
|
||||
Simon Redfern : simon AT tesobe DOT com
|
||||
Everett Sochowski: everett AT tesobe DOT com
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:lift="http://liftweb.net/">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
<div>
|
||||
<wizard:screen_info><div>Page <wizard:screen_number></wizard:screen_number> of <wizard:total_screens></wizard:total_screens></div></wizard:screen_info>
|
||||
<wizard:wizard_top> <div> <wizard:bind></wizard:bind> </div> </wizard:wizard_top>
|
||||
<wizard:screen_top> <div> <wizard:bind></wizard:bind> </div> </wizard:screen_top>
|
||||
<wizard:errors> <div> <ul> <wizard:item> <li> <wizard:bind></wizard:bind> </li> </wizard:item> </ul> </div> </wizard:errors>
|
||||
<div>
|
||||
<wizard:fields>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr lift:bind="wizard:line">
|
||||
<td>
|
||||
<wizard:label>
|
||||
<label wizard:for="">
|
||||
<wizard:bind></wizard:bind>
|
||||
</label>
|
||||
</wizard:label>
|
||||
<wizard:help>
|
||||
<span>
|
||||
<wizard:bind></wizard:bind>
|
||||
</span>
|
||||
</wizard:help>
|
||||
<wizard:field_errors>
|
||||
<ul>
|
||||
<wizard:error>
|
||||
<li>
|
||||
<wizard:bind></wizard:bind>
|
||||
</li>
|
||||
</wizard:error>
|
||||
</ul>
|
||||
</wizard:field_errors>
|
||||
</td>
|
||||
<td>
|
||||
<wizard:form></wizard:form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</wizard:fields>
|
||||
</div>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<wizard:prev></wizard:prev>
|
||||
</td>
|
||||
<td>
|
||||
<wizard:cancel></wizard:cancel>
|
||||
</td>
|
||||
<td>
|
||||
<wizard:next></wizard:next>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<wizard:screen_bottom> <div> <wizard:bind></wizard:bind> </div> </wizard:screen_bottom>
|
||||
<wizard:wizard_bottom> <div> <wizard:bind></wizard:bind> </div> </wizard:wizard_bottom>
|
||||
</div>
|
||||
@ -1,17 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
|
||||
<title>X</title>
|
||||
</head>
|
||||
<body class="bla">
|
||||
|
||||
<h2>This is x.html</h2>
|
||||
|
||||
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
*/
|
||||
import bootstrap.liftweb.Boot
|
||||
import scala.tools.nsc.MainGenericRunner
|
||||
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
import org.mortbay.jetty.Connector
|
||||
import org.mortbay.jetty.Server
|
||||
import org.mortbay.jetty.webapp.WebAppContext
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/**
|
||||
Open Bank Project
|
||||
|
||||
Copyright 2011,2012 TESOBE / Music Pictures Ltd.
|
||||
|
||||
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 code
|
||||
|
||||
import java.io.File
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
package code
|
||||
package snippet
|
||||
|
||||
import org.specs._
|
||||
import org.specs.runner.JUnit4
|
||||
import org.specs.runner.ConsoleRunner
|
||||
import net.liftweb._
|
||||
import http._
|
||||
import net.liftweb.util._
|
||||
import net.liftweb.common._
|
||||
import org.specs.matcher._
|
||||
import org.specs.specification._
|
||||
import Helpers._
|
||||
import lib._
|
||||
|
||||
|
||||
class HelloWorldTestSpecsAsTest extends JUnit4(HelloWorldTestSpecs)
|
||||
object HelloWorldTestSpecsRunner extends ConsoleRunner(HelloWorldTestSpecs)
|
||||
|
||||
object HelloWorldTestSpecs extends Specification {
|
||||
val session = new LiftSession("", randomString(20), Empty)
|
||||
val stableTime = now
|
||||
|
||||
override def executeExpectations(ex: Examples, t: =>Any): Any = {
|
||||
S.initIfUninitted(session) {
|
||||
DependencyFactory.time.doWith(stableTime) {
|
||||
super.executeExpectations(ex, t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
"HelloWorld Snippet" should {
|
||||
"Put the time in the node" in {
|
||||
val hello = new HelloWorld
|
||||
Thread.sleep(1000) // make sure the time changes
|
||||
|
||||
val str = hello.howdy(<span>Welcome to your Lift app at <span id="time">Time goes here</span></span>).toString
|
||||
|
||||
str.indexOf(stableTime.toString) must be >= 0
|
||||
str.indexOf("Hello at") must be >= 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user