[Lift] Re: ProtoUser and securing pages
I'd like to test the User for different access levels with functions for each menu item, looking at the User.scala mapped object. Is there some example code out there that does more than check for logged-in status? -Ketih On Jul 16, 5:43 am, Chris Lewis burningodzi...@gmail.com wrote: I did use an archetype, but it was a 1.0 and must have been the bare-bones (there were no models generated). David Pollak wrote: On Wed, Jul 15, 2009 at 3:17 AM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I didn't, but I'd been looking through liftweb/sites for examples to no avail. This one has helped out a good deal - now I know about the built in User.sitemenu. The only issue now is that the pages under /user_mgt aren't getting rendered in a layout template - ie, just partial content. And because they're XML docs, FF is rendering XML. I'm only assuming those templates surround their content at content (as they do in the 1_1 example). I don't think this is a 1.0 issue, but it's possible. In the User singleton, add the following line: override def screenWrap = Full(lift:surround with=default at=content lift:bind //lift:surround) All of this stuff is done for you when you use the Maven archetype to create a new project. thanks chris David Pollak wrote: On Tue, Jul 14, 2009 at 3:32 PM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I guess the first question I should have asked is how do I go about logging a user in. I have my user model, which now mixes in MegaProtoUser. I also persist instances, but I don't know how to start a user session. I noticed the logUserIn method - I assume that's where to start when I get back into the app later this evening, but I was wondering if there are any example apps that use this? I didnt see any in the current source, and, assuming it makes a difference, I'm using 1.0. thanks again, chris Chris, Did you start your app based on one of the Lift templates? If you take a look at line 27 of: http://github.com/dpp/lift_1_1_sample/blob/master/src/main/scala/boot... You'll see how the MegaProtoUser can manage its own menus. From that, you get login, logout, etc. Does this help? Thanks, David David Pollak wrote: On Tue, Jul 14, 2009 at 9:20 AM, glenn gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com wrote: I do something similar in menu items to hide them for different user roles, but the error message: No Navigation Defined, is displayed if the right user isn't logged in. How do I turn this off? Upgrade based on the fix I just checked in. :-) On Jul 14, 4:02 am, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: Too easy! Thanks for the help David - I'll msg the channel when the app is on github. Fine job with Lift - it's been a joy so far! David Pollak wrote: On Mon, Jul 13, 2009 at 8:57 PM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: That'll get me started. User there however, must mixin MegaProtoUser instead of ProtoUser right (getting compilation errors)? Yeah... you have to build your User from MegaProtoUser/MetaMegaProtoUser.
[Lift] MappedDateTime losing time?
Hello, I've extended MappedDateTime to override _toForm (to add a class=datepicker) and set my own DateFormat for the input/output. This is so that I could use a JQuerry datepicker which allows me to set the time as well as the date. Everything is working on the client, and the date with time is sent to the server fine, but upon retrieval from the database time is being lost. 08/25/2009 01:45 pm is what _toForm got sent from the form 08/25/2009 12:00 AM is what asHtml is printing back out. Time is always 12:00 AM To me, it looks as if the date is having the time stripped off the long value of the Date. Looking in the MappedDateTime source, I don't see anything that looks like it affects the long value of the Date other than toLong, which appears to only be used by asJsExp. (To be sure I've overwritten toLong with no affect.) MappedDateTime converts the Date into a Timestamp for the database to store. I know there are issues with Timestamp stripping off nanos, but I've never heard of them stripping off hours also. Any help would be appreciated. Thank You! Example source follows: class MyMappedDateTime[T:Mapper[T]](owner: T) extends MappedDateTime [T](owner) { ... // _toForm override def _toForm: Box[NodeSeq] = S.fmapFunc( {s: List[String] = printDateFormatter.parse(s(0))} ) { funcName = Full(input type='text' class={classValue} id={fieldId} name= {funcName} value={is match {case null = case s = printDate(s)}}/) } // asHtml override def asHtml: Node = Text(is match {case null = case s = printDate(s)}) //date format: val printDateFormatter = new SimpleDateFormat(MM/dd/ hh:mm aa) // format a given Date def printDate(in: Date) : String = printDateFormatter.format(in) ... } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: slow down ajax?
No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE onclick=jQuery('#'+'F111290299287IBE').hide(); jQuery('#'+'F1112902992880KN').show().each(function(i) { var t = this; setTimeout(function() { t.focus(); }, 200);});return false;; 1248493271843/span span style=display: none id=F1112902992880KN onblur=jQuery('#'+'F111290299287IBE').show(); jQuery('#'+'F1112902992880KN').hide(); input onblur=lift_ajaxHandler('F111290299286DL1=' + encodeURIComponent(this.value), null, null) type=text value=1248493271843 onkeypress=lift_blurIfReturn(event) size=10 / /span /span So, all the parts work well together, but Lift's ajax just takes off too quickly, and cannot read the new value. On Aug 16, 11:02 pm, marius d. marius.dan...@gmail.com wrote: You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc parameter. Essentially you are specifying your function call that may have one parameter. To your parameter list List we'll add a new parameter which is the ajax invocation function. In other words your code gets that function that does the ajax call meaning that you have the control over when the ajax call is made. Br's, Marius On Aug 17, 8:55 am, marius d. marius.dan...@gmail.com wrote:
[Lift] Re: PreCache's use of WHERE ... IN
David Pollak feeder.of.the.be...@gmail.com writes: On Tue, Aug 18, 2009 at 3:24 PM, harryh har...@gmail.com wrote: Because making things line up name-wise for joins (especially when you're joining to the same table) is a lot more difficult. All RDBMS except MySQL will optimize both inner queries and joins the same way. Interesting. I have been considering switching to PostgreSQL (for reasons unrelated to this), and this issue may speed up my move. What RDBMS are others generally using with Lift? Are there any general recommendations? I use PostgreSQL for all my production sites. It's amazingly solid. +1 /Jeppe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Relax method scope
Committed - I also added a dirty_? : Boolean method to Field.scala Cheers, Tim On Aug 18, 6:38 pm, David Pollak feeder.of.the.be...@gmail.com wrote: It's okay to relax it... maybe even make it public. On Tue, Aug 18, 2009 at 8:57 AM, Timothy Perrett timo...@getintheloop.euwrote: Guys, Is there a good reason that this method in MetaRecord is private [record]? private[record] def foreachCallback(inst: BaseRecord, f: LifecycleCallbacks = Any) { lifecycleCallbacks.foreach(m = f(m._2.invoke(inst).asInstanceOf [LifecycleCallbacks])) } Its a useful thing to want to implement in your custom record backends (DBRecord makes use of it for example) - can I relax it to: protected def foreachCallback(inst: BaseRecord, f: LifecycleCallbacks = Any) { lifecycleCallbacks.foreach(m = f(m._2.invoke(inst).asInstanceOf [LifecycleCallbacks])) } Cheers Tim -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] lift:with-params deprecation alternatives
As suggested in http://groups.google.com/group/liftweb/browse_thread/thread/d664b712d08fbf41 by Mr. Marius D., I should use lift:with-param in order to insert content into multiple bind points of template. But recently I read that this tag is deprecated. What alternatives are available? P.S. I would propose lift:insert at=bindPointName tag for this purpose. And the contents of lift:bind name=bindPointName tag should be assumed as default if none lift:insert ... tag overrides it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift:with-params deprecation alternatives
Its actually not deprecated! We did deprecate it for a while, then straight away un-deprecated it because people wanted it. So you can use it without any problems or concerns... Cheers, Tim On 19/08/2009 08:55, inca incarn...@whiteants.net wrote: As suggested in http://groups.google.com/group/liftweb/browse_thread/thread/d664b712d08fbf41 by Mr. Marius D., I should use lift:with-param in order to insert content into multiple bind points of template. But recently I read that this tag is deprecated. What alternatives are available? P.S. I would propose lift:insert at=bindPointName tag for this purpose. And the contents of lift:bind name=bindPointName tag should be assumed as default if none lift:insert ... tag overrides it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift:with-params deprecation alternatives
Yes we tried to deprecate it but later on we un-derprecate it :) So you can use lift:with-param safely. Purely for naming perspective lift:insert seems to me more intuitive than lift:with-param ... I'm not sure if this is a strong enough motivation to change the name hence inducing a breaking change. Br's, Marius On Aug 19, 10:55 am, inca incarn...@whiteants.net wrote: As suggested inhttp://groups.google.com/group/liftweb/browse_thread/thread/d664b712d... by Mr. Marius D., I should use lift:with-param in order to insert content into multiple bind points of template. But recently I read that this tag is deprecated. What alternatives are available? P.S. I would propose lift:insert at=bindPointName tag for this purpose. And the contents of lift:bind name=bindPointName tag should be assumed as default if none lift:insert ... tag overrides it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: This is the official support channel for Lift
If you haven't already David, you, may want to state where to go for Lift help in your Twitter Bio. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift:with-params deprecation alternatives
This is a decision that needs consensus ... and David's agreement. Personally I agree with it but others may not. Br's, Marius On Aug 19, 12:41 pm, inca incarn...@whiteants.net wrote: Why not just introduce the new tag, leaving the former alone (possibly deprecated in next major releases)? On 19 авг, 12:07, marius d. marius.dan...@gmail.com wrote: Yes we tried to deprecate it but later on we un-derprecate it :) So you can use lift:with-param safely. Purely for naming perspective lift:insert seems to me more intuitive than lift:with-param ... I'm not sure if this is a strong enough motivation to change the name hence inducing a breaking change. Br's, Marius On Aug 19, 10:55 am, inca incarn...@whiteants.net wrote: As suggested inhttp://groups.google.com/group/liftweb/browse_thread/thread/d664b712d... by Mr. Marius D., I should use lift:with-param in order to insert content into multiple bind points of template. But recently I read that this tag is deprecated. What alternatives are available? P.S. I would propose lift:insert at=bindPointName tag for this purpose. And the contents of lift:bind name=bindPointName tag should be assumed as default if none lift:insert ... tag overrides it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift:with-params deprecation alternatives
Why not just introduce the new tag, leaving the former alone (possibly deprecated in next major releases)? On 19 авг, 12:07, marius d. marius.dan...@gmail.com wrote: Yes we tried to deprecate it but later on we un-derprecate it :) So you can use lift:with-param safely. Purely for naming perspective lift:insert seems to me more intuitive than lift:with-param ... I'm not sure if this is a strong enough motivation to change the name hence inducing a breaking change. Br's, Marius On Aug 19, 10:55 am, inca incarn...@whiteants.net wrote: As suggested inhttp://groups.google.com/group/liftweb/browse_thread/thread/d664b712d... by Mr. Marius D., I should use lift:with-param in order to insert content into multiple bind points of template. But recently I read that this tag is deprecated. What alternatives are available? P.S. I would propose lift:insert at=bindPointName tag for this purpose. And the contents of lift:bind name=bindPointName tag should be assumed as default if none lift:insert ... tag overrides it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Include build # in LiftVersion?
Hi, When living on the bleeding edge (i.e. 1.1-SNAPSHOT) it is sometimes difficult to figure out which version of lift is in use and deployed. LiftRules.liftVersion only returns 1-1.0-SNAPSHOT. I could probably try to correlate liftBuildDate with hudson and github but this seem error prone :-) Would it be possible to: 1) Include the build # in liftVersion for the snapshot release? 2) Make it possible to identify the revision from this build # (e.g. push the hudson build tags to the github repo or something similar)? /Jeppe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift:with-params deprecation alternatives
Okay, thanks a lot! Let's hope the others will accept a proposal... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Has anyone tried Stax?
I'm not so concerned about the lack of session replication from a scalability point of view. Sticky sessions will get you a long way. Plus I've learned my lesson about over-engineering for scalability before you need to. However, it'd be nice to choose a path that could scale in the rare event it's needed. Stax, lacking sticky sessions, probably isn't such a path for a lift app. It seems GAE also does not support sticky sessions. If you need seamless fail over or need to do rolling updates, then lack of session replication becomes an issue (btw, I don't need either of these at the moment). Wicket is able to support session replication with its detachable models. The developer still needs to be careful about references when implementing a model's load method, but this is easily done by using @SpringBean to get weak references to Spring proxies. So, what are the differences between the wicket style - binding an anonymous inner class that extends a base component class - and the lift style - binding a function which is really just an anonymous inner class? One difference is that Wicket's base component classes do a good job of reinforcing the use of detachable models. A second difference is that lift doesn't have an easy built-in way to get weak references to unserializable resources such as mapper objects containing database connections. I don't have a solution, but thought I'd chime in since I have some Wicket experience. On Aug 18, 5:44 pm, Meredith Gregory lgreg.mered...@gmail.com wrote: Guys, This really seems like a weakness. Can someone walk me through the issues on the lift committers call, tomorrow? Best wishes, --greg On Tue, Aug 18, 2009 at 1:51 PM, Viktor Klang viktor.kl...@gmail.comwrote: On Tue, Aug 18, 2009 at 4:22 PM, marius d. marius.dan...@gmail.comwrote: On Aug 18, 5:05 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: You set whether you want a shared server, or dedicated/various speeds. In any case, is there room to entertain the thought of at some point adding support in Lift to propogate sessions across instances? (Is it easier now that it's been decoupled from servlets?) No it is not easier. The fundamental problem in distributing lift sessions is the bound functions. Sure, functions are serializable but their references may not be. For instance one can bind an ajax anonymous function and that functions can have a bunch of other references inside potentially other lambdas etc. Viktor was doing in the past some research to integrate with Terracotta but there were some issues. So consistently distributing Lift sessions in a clustered environment is a challenge but of course good ideas are more then welcome. Yeah, it really was a can of worms... - Ryan Donahuedonahu...@gmail.com wrote: Is anybody using Stax for anything more than prototyping or examples? If so, what has your experience been? Stax doesn't seem to fit lift very well, but I'd like to find out I'm wrong. Specifically, it does not support sticky sessions: http://developer.stax.net/forum/topics/initial-questions. I assume a Stax app shares resources with others on the same server, so you'd likely need to scale to additional servers sooner than normal. However, the lack of sticky sessions effectively caps a stateful lift app to one server. -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift:with-params deprecation alternatives
I'm not sure if my consensus matters or not, but I like lift:insert better than lift:with-param. -Ross On Aug 19, 2009, at 9:10 AM, inca wrote: Okay, thanks a lot! Let's hope the others will accept a proposal... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: MappedDateTime losing time?
Hi Grant, I'm afraid I don't have the answer for you, but perhaps my attempt at making a MappedTimestamp will prove useful to you: http://groups.google.com/group/liftweb/msg/84b1612953fe9ac0. Peter Robinett On Aug 18, 6:02 pm, Grant Wood smackt...@gmail.com wrote: Hello, I've extended MappedDateTime to override _toForm (to add a class=datepicker) and set my own DateFormat for the input/output. This is so that I could use a JQuerry datepicker which allows me to set the time as well as the date. Everything is working on the client, and the date with time is sent to the server fine, but upon retrieval from the database time is being lost. 08/25/2009 01:45 pm is what _toForm got sent from the form 08/25/2009 12:00 AM is what asHtml is printing back out. Time is always 12:00 AM To me, it looks as if the date is having the time stripped off the long value of the Date. Looking in the MappedDateTime source, I don't see anything that looks like it affects the long value of the Date other than toLong, which appears to only be used by asJsExp. (To be sure I've overwritten toLong with no affect.) MappedDateTime converts the Date into a Timestamp for the database to store. I know there are issues with Timestamp stripping off nanos, but I've never heard of them stripping off hours also. Any help would be appreciated. Thank You! Example source follows: class MyMappedDateTime[T:Mapper[T]](owner: T) extends MappedDateTime [T](owner) { ... // _toForm override def _toForm: Box[NodeSeq] = S.fmapFunc( {s: List[String] = printDateFormatter.parse(s(0))} ) { funcName = Full(input type='text' class={classValue} id={fieldId} name= {funcName} value={is match {case null = case s = printDate(s)}}/) } // asHtml override def asHtml: Node = Text(is match {case null = case s = printDate(s)}) //date format: val printDateFormatter = new SimpleDateFormat(MM/dd/ hh:mm aa) // format a given Date def printDate(in: Date) : String = printDateFormatter.format(in) ... } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] error while SHtml.ajaxInvoke call
Hi , i am trying to configure Ajax in my application using lift. I have : lift:DisplayResults.showFeeds table border=0 width=100% class = resultheader cellpadding=10 t:feedsResultRows/ /table /lift:DisplayResults.showFeeds snippet for given html code : def showFeeds(xhtml:NodeSeq):NodeSeq ={ println(Inside showFeeds); bind(t, xhtml,feedsResultRows - SHtml.ajaxInvoke (updateStartDate)._2) } def updateStartDate () : JsCmd= { JsCmds.SetHtml(resultsRow, displayResult(List(abc,xyz))) } def displayResult(rList:List[Object]):NodeSeq={ trtd table trtdrList(0).toString()}/ td /tr trtd{rList(1).toString()}/a / td /tr /table /td/tr } But its not working- Giving out put on html page like- lift_ajaxHandler('F966737512075R2E' + '=true', null, null) What is this How can i use Ajax in my application.I want to give asynchronous call (Ajax) for my above html component so it can get show list that i get from Db call . This all happening on submit button click Appreciate any pointer regarding this -Pravin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: CMS for Lift?
Wonderful! On Aug 19, 11:03 am, David Pollak feeder.of.the.be...@gmail.com wrote: FWIW... I got roped into hosting a CMS by the PTA of my kids' school. I may knock something together in Lift or leverage off the work Glenn has done. On Tue, Aug 18, 2009 at 3:26 PM, Timothy Perrett timo...@getintheloop.euwrote: Just my two cents, but I wouldn't use the lift namespace... If you use the lift tags OOTB, you risk designers shoving lots of comet actors on a single page. You would get more granular control if you created a special set of tags: cms:something .. / Cheers, Tim On 18/08/2009 23:00, Ewan ehar...@gmail.com wrote: I've been scratching my head about that one too. I have used both Alfresco and opencms to produce both dynamic and static and in the case of dynamic they have their own servlet/filter to render the content - I've not yet spent enough time working out how and if they can be fitted together. For me, having used Hybris (J2EE ecommerce engine with some CMS built in), I'd like to be able to have page fragments in a template served from the CMS (lift snippets presumably) that would be created/ maintained with some aspect of workflow by CMS user(s) in an associated CMS lift webapp with funky (X)HTML editor support. My web guys, non-lift devs, can then sprinkle cms tags where appropriate. A tag might be lift:cms contentId=news count=5 order=ascending/ which would render the last five news items in ascending order. Just some thoughts -- Ewan On Aug 18, 10:09 pm, Terry J. Leach terry.le...@gmail.com wrote: I would like to know how the Lift/Scala can leveraged to with Alfresco or any other open source Java based CMS. Terry J. Leach On Aug 17, 2:09 pm, Stefan Scott stefanscottal...@gmail.com wrote: I'll chime in here since I've been evaluating several CMSs lately. I previously used Drupal and WordPress as my CMSs - now however I'm moving everything to MODx because of the increased flexibility and more-logical organization, and I'm also impressed with the demos of SilverStripe, TypoLight Typo3 - and LifeRay, which is written in Java instead of PHP. (LifeRay seems to be much more than a CMS - it claims to offer collaboration and social networking.) Some on-line demos here: MODx -http://trymodx.com/ SilverStripe -http://demo.silverstripe.com/ TypoLight -http://www.typolight.org/demo.html Typo3 -http://testsite.punkt.de/ LifeRay -http://demo.liferay.net/web/guest/home It would be good to take a look at these additional CMSs as they offer some capabilities beyond WordPress and Drupal. Drupal in particular is wildly popular but it may no longer be the best candidate to imitate, as it is less well-organized and less flexible/customizable (compared say to MODx, which lets you take CSS from an existing site and use it for your site, and which lets you apply a template to a single document, unlike Drupal where a theme applies to the entire site). To keep up with advanced CMSs, Drupal has evolved to use a bunch of (often redundant or competing) modules which are not always compatible with current releases. Examples of things that Drupal treats as add-ons (modules) are: custom content (the CCK/Views modules, with their confusing albeit AJAX-y interface), multi-language, and photo galleries (I gave up on Drupal after a few days of trying out various photo gallery modules, none of which I could understand). Finally, it seems odd that Drupal, as a content management system, lacks something all advanced CMSs have: a *treeview* of the overall site content. Instead, it only has a jumbled *list* of content, sorted by not by location but by last edited (!), with all translations also scattered through the list based on last- edited date, and this list is buried several levels deep in the admin navigation system, unlike the site content treeview navigator which is prominently displayed (usually on the left) in advanced CMSs. (Of course, I don't want to veer off-topic here and start a CMS flame war here in this liftweb discussion. :-) Regarding dynamic site map creation - I do know that MODx has something like this, using WayFinder to create a menu from selected branches of the site's document tree, automatically including any updated sub-branches, and I believe most other advanced CMSs have something like this too. LifeRay seems very intriguing - it claims to do a lot beyond just CMS. Since it's written in Java (not PHP), who knows if some of its code could be leveraged in Scala. So these might be some additional interesting CMSs to keep in mind (beyond Drupal and WordPress) when building a new CMS using liftweb. - Stefan Scott On Aug 16, 3:13 pm, glenn gl...@exmbly.com wrote: Philip, I'm working on a cms system in Lift. Right now, it allows for content
[Lift] Re: Include build # in LiftVersion?
On Wed, Aug 19, 2009 at 5:44 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote: Hi, When living on the bleeding edge (i.e. 1.1-SNAPSHOT) it is sometimes difficult to figure out which version of lift is in use and deployed. LiftRules.liftVersion only returns 1-1.0-SNAPSHOT. I could probably try to correlate liftBuildDate with hudson and github but this seem error prone :-) Would it be possible to: 1) Include the build # in liftVersion for the snapshot release? Right now the version number is available in the manifest file. If you, or someone else, can suggest a way grab the Git fingerprint for the build release, I'm all for including that in the manifest as well. 2) Make it possible to identify the revision from this build # (e.g. push the hudson build tags to the github repo or something similar)? /Jeppe -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: More problems with CRUDify and SessionVars
On Wed, Aug 19, 2009 at 5:20 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote: Seems I missed this responsemore comments below On Wed, Aug 12, 2009 at 8:49 PM, David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 9:07 AM, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: David Pollak feeder.of.the.be...@gmail.com writes: (1) Don't use open_! unless you have a very, very, very good reason to do so. It defeats the purpose of Box. I'm aware of this. But in this situation, most Locs are protected, ie the user is always logged in, so the only alternatives I see are: 1) wrap the code in map or something similar which will then return Empty if no user is found. But this is dangerous, giving the user the impression that no data is found when in fact this is a coding error. User.currentUserId.map(... business logic here) openOr defaultValue But the problem arise when there is no good default to apply. I.e. suppose the business logic was list my items where my depends on currentUser. If, for all intents and purposes, this list is only available to signed in users, it doesn't really make sense to show no list or some random user's list. In general, it's good practice to comment the use of open_! as to why you are using it. For example Box tested at a level above this method or no alternative, so an exception should be thrown if the box is empty [...] The question comes down to: Why is User.currentUserId Empty when findForParam is called? Because this method is called during the re-writing phase. I've updated Lift to make the session available during the re-writing phase if there is a session (a new session will not be created) to deal with this situation. As noted above, I missed this post earlier and went ahead to create an example showing the problem. When I didn't succeed to show the error, I scratched my head a few times and went back to my app to see if it failed. Lo and behold, it worked! Thanks for the fix, sorry for the late reply :-) No worries. /Jeppe -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: ProtoUser and securing pages
On Tue, Aug 18, 2009 at 6:10 PM, Keith K quasike...@gmail.com wrote: I'd like to test the User for different access levels with functions for each menu item, looking at the User.scala mapped object. Is there some example code out there that does more than check for logged-in status? Can you create a method that returns a Boolean to indicate if a page is allowed to be accessed? If so, you've got everything you need... def canViewSecretPage_? : Boolean = // your logic here Loc(my secret page, List(secret :: Nil), Secret page, If(canViewSecretyPage_? _, Sorry dude, you can't go there)) Does this help? -Ketih On Jul 16, 5:43 am, Chris Lewis burningodzi...@gmail.com wrote: I did use an archetype, but it was a 1.0 and must have been the bare-bones (there were no models generated). David Pollak wrote: On Wed, Jul 15, 2009 at 3:17 AM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I didn't, but I'd been looking through liftweb/sites for examples to no avail. This one has helped out a good deal - now I know about the built in User.sitemenu. The only issue now is that the pages under /user_mgt aren't getting rendered in a layout template - ie, just partial content. And because they're XML docs, FF is rendering XML. I'm only assuming those templates surround their content at content (as they do in the 1_1 example). I don't think this is a 1.0 issue, but it's possible. In the User singleton, add the following line: override def screenWrap = Full(lift:surround with=default at=content lift:bind //lift:surround) All of this stuff is done for you when you use the Maven archetype to create a new project. thanks chris David Pollak wrote: On Tue, Jul 14, 2009 at 3:32 PM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I guess the first question I should have asked is how do I go about logging a user in. I have my user model, which now mixes in MegaProtoUser. I also persist instances, but I don't know how to start a user session. I noticed the logUserIn method - I assume that's where to start when I get back into the app later this evening, but I was wondering if there are any example apps that use this? I didnt see any in the current source, and, assuming it makes a difference, I'm using 1.0. thanks again, chris Chris, Did you start your app based on one of the Lift templates? If you take a look at line 27 of: http://github.com/dpp/lift_1_1_sample/blob/master/src/main/scala/boot... You'll see how the MegaProtoUser can manage its own menus. From that, you get login, logout, etc. Does this help? Thanks, David David Pollak wrote: On Tue, Jul 14, 2009 at 9:20 AM, glenn gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com wrote: I do something similar in menu items to hide them for different user roles, but the error message: No Navigation Defined, is displayed if the right user isn't logged in. How do I turn this off? Upgrade based on the fix I just checked in. :-) On Jul 14, 4:02 am, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: Too easy! Thanks for the help David - I'll msg the channel when the app is on github. Fine job with Lift - it's been a joy so far! David Pollak wrote: On Mon, Jul 13, 2009 at 8:57 PM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com
[Lift] Re: Wiki article - CRUD
On Wed, Aug 19, 2009 at 9:12 AM, Hannes hannes.flo...@gmx.li wrote: Hey Lifters, Again and again I'm having problems to do simple CRUD operations with mapped fields, especially referenced fields (foreign keys). Because I think everyone need those things and I couldn't find a simple way to do it (I still don't really know how to use .map(...) with openOr to get foreign key references out of the database...it's like stumbling around in the dark...), I would write an article for the wiki. For example, I've a class that extends LongKeyedMapper and mixes in a trait (that extends BaseLongKeyedMapper). When I want to access a foreign key that is defined inside the trait, I can't do it the way that is described in the Lift Book (from 10th of July) in Listing 6.9: Accessing Foreign Objects! Why? First, please take a look at http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-class-and-how-lift-uses-it.html It's a discussion about Option, which provides a subset of what Lift's Box provides. It's also based on Scala 2.3 syntax... but you'll get the idea of what Option/Box is all about. So, if you've got a LongKeyedMapper that is a target of a foreign key reference from another Mapper class: class Taget extends LongKeyedMapper[Target] with IdPK { ... object name extends MappedString(this, 64) } class RefersTo extends Mapper[RefersTo] { object target extends MappedLongForeignKey(this, Target) } So, if I've got a RefersTo instance and I want to get the name from the target foreign key reference: val rt: RefersTo = ... val target: Box[Target] = rt.target.obj // load the FK reference, if you can val nameBox: Box[String] = target.map(_.name.is) // you need the is part so you get the String, not the MappedString val name: String = nameBox openOr N/A But we can shorten the whole thing to: val name = rt.target.obj.map(_.name.is) openOr N/A In general, when you're starting out, write out the complex expressions as separate lines with the types explicitly declared. Then refactor over and over to make the code more concise. It might be worthwhile to leave the original code in a comment so you can remind yourself the exploded view of the expression. thanks -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Proposed internal changes on Mapper?
OK, changes have been added to 1.0.1-SNAPSHOT (and deployed on scala-tools.org) and I'll roll them into 1.1-SNAPSHOT (along with the Oracle and PostgreSQL fixes) this afternoon. Derek On Tue, Aug 18, 2009 at 3:16 PM, Derek Chen-Becker dchenbec...@gmail.comwrote: I'll go ahead and see what I can do, then. Derek On Tue, Aug 18, 2009 at 11:40 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Tue, Aug 18, 2009 at 7:12 AM, Derek Chen-Becker dchenbec...@gmail.com wrote: I'm trying to fix Mapper support for Oracle and I've run into an issue. Oracle's JDBC drivers support returning autoGenerated keys, but not the way that Lift expects. The way that Lift currently works, it just calls executeUpdate with Statement.RETURN_GENERATED_KEYS set. In Oracle, this will simply return the ROWID of the inserted row, which means that we would have to do a second select to get the actual value. Alternatively, Oracle does support fetching the inserted value from a column if you use the executeUpdate(String, Array[String]) method (the Array is a set of column names to fetch). What I'm getting at is that support for autogenerated keys is very driver-specific right now, but the DriverTypes class essentially is just using some flags to control behavior in MetaMapper. I'm wondering if it would make more sense to move the support for insert queries into DriverTypes so that we have things tied directly to the drivers instead of splitting it up between two files. I'm thinking of adding something like: def performUpdate(conn : Connection, stmt : String, primaryKeyColumn : String) def performUpdate(conn : Connection, stmt : PreparedStatement, primaryKeyColumn : String) to DriverTypes, which would then allow us to define driver-specific key fetching in place. I could move the base functionality into DriverTypes itself, and then we could override as needed on specific vendor classes. The current situation with flags for brokenAutogeneratedKeys_? and wickedBrokenAutogeneratedKeys_?, while amusingly named, feels untenable in the long term as we continue to find corner cases for vendor drivers. I could add a notQuiteBrokenButDifferentAutogeneratedKeys_? flag for Oracle, but that doesn't feel right. Thoughts? I think it's a good idea. It will also help with Record support for JDBC. Derek -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] AutoComplete IE bug?
Hi, The AutoComplete widget leaves a trailing , in the javascript that causes IE to complain and not function. Or, at least i think that's the only reason that it's not functioning in IE. Has anyone else noticed this problem? AutoComplete.scala:124 - Jon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Read context param
How can I read a context param (e.g. H2 sets connection param)? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: AutoComplete IE bug?
btw, i removed the trailing , and confirmed that it fixes the IE problem. - jon On Aug 19, 3:38 pm, marius d. marius.dan...@gmail.com wrote: If no other committer wants to look into this I'll look on it. Tim, would this interest you ? Br's, Marius On Aug 19, 9:13 pm, jon jonhoff...@gmail.com wrote: Hi, The AutoComplete widget leaves a trailing , in the javascript that causes IE to complain and not function. Or, at least i think that's the only reason that it's not functioning in IE. Has anyone else noticed this problem? AutoComplete.scala:124 - Jon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Read context param
I've got the quick-and-dirty: access HttpServletRequest and via the HttpSession to the ServletContext object. E.g., def fooParam = Text( S.servletRequest match { case Full(r) = r.getSession.getServletContext.getInitParameter (foo) case _ = } ) Best regards, inca On 19 авг, 22:29, Naftoli Gugenheim naftoli...@gmail.com wrote: How can I read a context param (e.g. H2 sets connection param)? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: MappedDateTime losing time?
Grant, What database are you using? What version of Lift? Thanks, David On Tue, Aug 18, 2009 at 6:02 PM, Grant Wood smackt...@gmail.com wrote: Hello, I've extended MappedDateTime to override _toForm (to add a class=datepicker) and set my own DateFormat for the input/output. This is so that I could use a JQuerry datepicker which allows me to set the time as well as the date. Everything is working on the client, and the date with time is sent to the server fine, but upon retrieval from the database time is being lost. 08/25/2009 01:45 pm is what _toForm got sent from the form 08/25/2009 12:00 AM is what asHtml is printing back out. Time is always 12:00 AM To me, it looks as if the date is having the time stripped off the long value of the Date. Looking in the MappedDateTime source, I don't see anything that looks like it affects the long value of the Date other than toLong, which appears to only be used by asJsExp. (To be sure I've overwritten toLong with no affect.) MappedDateTime converts the Date into a Timestamp for the database to store. I know there are issues with Timestamp stripping off nanos, but I've never heard of them stripping off hours also. Any help would be appreciated. Thank You! Example source follows: class MyMappedDateTime[T:Mapper[T]](owner: T) extends MappedDateTime [T](owner) { ... // _toForm override def _toForm: Box[NodeSeq] = S.fmapFunc( {s: List[String] = printDateFormatter.parse(s(0))} ) { funcName = Full(input type='text' class={classValue} id={fieldId} name= {funcName} value={is match {case null = case s = printDate(s)}}/) } // asHtml override def asHtml: Node = Text(is match {case null = case s = printDate(s)}) //date format: val printDateFormatter = new SimpleDateFormat(MM/dd/ hh:mm aa) // format a given Date def printDate(in: Date) : String = printDateFormatter.format(in) ... } -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: slow down ajax?
I quoted the def from net.liftweb.http.SHtml in: http://scala-tools.org/scaladocs/liftweb/1.0/ and when I tried the other version, my complier did not accept the extra param. That's why I thought I had to override something... Is there a newer version I should be using? On Aug 18, 10:38 pm, marius d. marius.dan...@gmail.com wrote: No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE onclick=jQuery('#'+'F111290299287IBE').hide(); jQuery('#'+'F1112902992880KN').show().each(function(i) { var t = this; setTimeout(function() { t.focus(); }, 200);});return false;; 1248493271843/span span style=display: none id=F1112902992880KN onblur=jQuery('#'+'F111290299287IBE').show(); jQuery('#'+'F1112902992880KN').hide(); input onblur=lift_ajaxHandler('F111290299286DL1=' + encodeURIComponent(this.value), null, null) type=text value=1248493271843 onkeypress=lift_blurIfReturn(event) size=10 / /span /span So, all the parts work well together, but Lift's ajax just takes off too quickly, and cannot read the new value. On Aug 16, 11:02 pm, marius d. marius.dan...@gmail.com wrote: You can probably use this definition of ajaxText: def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) See the jsFunc
[Lift] Re: ProtoUser and securing pages
I added a field and cooresponding function to the User.scala class of liftworkshop, as follows: def isApprover_? = { isApprover.is } object isApprover extends MappedBoolean(this) { override def defaultValue = false } It appears to create the proper column for it in the DB, etc. but when the security check in my Boot.java code is used, it doesn't find the user. This is probably a Scala misunderstanding on my part. Based on your example code, I put together these lines. def canViewSecretPage_? : Boolean = User.isApprover_?; val secretMenu = Menu(Loc(my secret page, List(secret, index), Secret page, If(canViewSecretPage_? _, Sorry dude, you can't go there))) The problem is that I don't know how to check the CURRENT user's permissions for approver state. I import com.liftworkshop.model.User, and things seem to compile, but it's not clear how I can look up the current session's user object to do the check. Could you help me understand how I would do the check on the User's field? Thanks! -K On Aug 19, 9:34 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Tue, Aug 18, 2009 at 6:10 PM, Keith K quasike...@gmail.com wrote: I'd like to test the User for different access levels with functions for each menu item, looking at the User.scala mapped object. Is there some example code out there that does more than check for logged-in status? Can you create a method that returns a Boolean to indicate if a page is allowed to be accessed? If so, you've got everything you need... def canViewSecretPage_? : Boolean = // your logic here Loc(my secret page, List(secret :: Nil), Secret page, If(canViewSecretyPage_? _, Sorry dude, you can't go there)) Does this help? -Ketih On Jul 16, 5:43 am, Chris Lewis burningodzi...@gmail.com wrote: I did use an archetype, but it was a 1.0 and must have been the bare-bones (there were no models generated). David Pollak wrote: On Wed, Jul 15, 2009 at 3:17 AM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I didn't, but I'd been looking through liftweb/sites for examples to no avail. This one has helped out a good deal - now I know about the built in User.sitemenu. The only issue now is that the pages under /user_mgt aren't getting rendered in a layout template - ie, just partial content. And because they're XML docs, FF is rendering XML. I'm only assuming those templates surround their content at content (as they do in the 1_1 example). I don't think this is a 1.0 issue, but it's possible. In the User singleton, add the following line: override def screenWrap = Full(lift:surround with=default at=content lift:bind //lift:surround) All of this stuff is done for you when you use the Maven archetype to create a new project. thanks chris David Pollak wrote: On Tue, Jul 14, 2009 at 3:32 PM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I guess the first question I should have asked is how do I go about logging a user in. I have my user model, which now mixes in MegaProtoUser. I also persist instances, but I don't know how to start a user session. I noticed the logUserIn method - I assume that's where to start when I get back into the app later this evening, but I was wondering if there are any example apps that use this? I didnt see any in the current source, and, assuming it makes a difference, I'm using 1.0. thanks again, chris Chris, Did you start your app based on one of the Lift templates? If you take a look at line 27 of: http://github.com/dpp/lift_1_1_sample/blob/master/src/main/scala/boot... You'll see how the MegaProtoUser can manage its own menus. From that, you get login, logout, etc. Does this help? Thanks, David David Pollak wrote: On Tue, Jul 14, 2009 at 9:20 AM, glenn gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com wrote: I do something similar in menu items to hide them for different user roles, but the error message: No Navigation Defined, is displayed if the right user isn't logged in. How do I turn this off? Upgrade based on the fix I just checked in. :-)
[Lift] Re: ProtoUser and securing pages
Okay, I think I may have figured out how to do this. I need to call User.currentUser and then call open_! on it. (I guess this loads it from the db). Then my canViewSecretPage_? func can work as follows. def canViewSecretPage_? : Boolean = { if (User.loggedIn_? ) { val user : User = User.currentUser.open_! // we can do this because the logged in test has happened user.isApprover.is } else { false } } val secretMenu = Menu(Loc(my secret page, List(secret, index), Secret page, If(canViewSecretPage_? _, Sorry dude, you can't go there))) Thanks for the help! On Aug 19, 11:52 am, Keith K quasike...@gmail.com wrote: I added a field and cooresponding function to the User.scala class of liftworkshop, as follows: def isApprover_? = { isApprover.is } object isApprover extends MappedBoolean(this) { override def defaultValue = false } It appears to create the proper column for it in the DB, etc. but when the security check in my Boot.java code is used, it doesn't find the user. This is probably a Scala misunderstanding on my part. Based on your example code, I put together these lines. def canViewSecretPage_? : Boolean = User.isApprover_?; val secretMenu = Menu(Loc(my secret page, List(secret, index), Secret page, If(canViewSecretPage_? _, Sorry dude, you can't go there))) The problem is that I don't know how to check the CURRENT user's permissions for approver state. I import com.liftworkshop.model.User, and things seem to compile, but it's not clear how I can look up the current session's user object to do the check. Could you help me understand how I would do the check on the User's field? Thanks! -K On Aug 19, 9:34 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Tue, Aug 18, 2009 at 6:10 PM, Keith K quasike...@gmail.com wrote: I'd like to test the User for different access levels with functions for each menu item, looking at the User.scala mapped object. Is there some example code out there that does more than check for logged-in status? Can you create a method that returns a Boolean to indicate if a page is allowed to be accessed? If so, you've got everything you need... def canViewSecretPage_? : Boolean = // your logic here Loc(my secret page, List(secret :: Nil), Secret page, If(canViewSecretyPage_? _, Sorry dude, you can't go there)) Does this help? -Ketih On Jul 16, 5:43 am, Chris Lewis burningodzi...@gmail.com wrote: I did use an archetype, but it was a 1.0 and must have been the bare-bones (there were no models generated). David Pollak wrote: On Wed, Jul 15, 2009 at 3:17 AM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I didn't, but I'd been looking through liftweb/sites for examples to no avail. This one has helped out a good deal - now I know about the built in User.sitemenu. The only issue now is that the pages under /user_mgt aren't getting rendered in a layout template - ie, just partial content. And because they're XML docs, FF is rendering XML. I'm only assuming those templates surround their content at content (as they do in the 1_1 example). I don't think this is a 1.0 issue, but it's possible. In the User singleton, add the following line: override def screenWrap = Full(lift:surround with=default at=content lift:bind //lift:surround) All of this stuff is done for you when you use the Maven archetype to create a new project. thanks chris David Pollak wrote: On Tue, Jul 14, 2009 at 3:32 PM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I guess the first question I should have asked is how do I go about logging a user in. I have my user model, which now mixes in MegaProtoUser. I also persist instances, but I don't know how to start a user session. I noticed the logUserIn method - I assume that's where to start when I get back into the app later this evening, but I was wondering if there are any example apps that use this? I didnt see any in the current source, and, assuming it makes a difference, I'm using 1.0. thanks again, chris Chris, Did you start your app based on one of the Lift templates? If you take a look at line 27 of: http://github.com/dpp/lift_1_1_sample/blob/master/src/main/scala/boot... You'll see how the MegaProtoUser can manage its own menus. From that, you get login, logout, etc. Does
[Lift] Re: ProtoUser and securing pages
On Wed, Aug 19, 2009 at 11:52 AM, Keith K quasike...@gmail.com wrote: I added a field and cooresponding function to the User.scala class of liftworkshop, as follows: def isApprover_? = { isApprover.is } object isApprover extends MappedBoolean(this) { override def defaultValue = false } It appears to create the proper column for it in the DB, etc. but when the security check in my Boot.java code is used, it doesn't find the user. This is probably a Scala misunderstanding on my part. Based on your example code, I put together these lines. def canViewSecretPage_? : Boolean = User.isApprover_?; def canViewSecretPage_? : Boolean = User.currentUser.map(_.isApprover_? ) openOr false val secretMenu = Menu(Loc(my secret page, List(secret, index), Secret page, If(canViewSecretPage_? _, Sorry dude, you can't go there))) The problem is that I don't know how to check the CURRENT user's permissions for approver state. I import com.liftworkshop.model.User, and things seem to compile, but it's not clear how I can look up the current session's user object to do the check. Could you help me understand how I would do the check on the User's field? Thanks! -K On Aug 19, 9:34 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Tue, Aug 18, 2009 at 6:10 PM, Keith K quasike...@gmail.com wrote: I'd like to test the User for different access levels with functions for each menu item, looking at the User.scala mapped object. Is there some example code out there that does more than check for logged-in status? Can you create a method that returns a Boolean to indicate if a page is allowed to be accessed? If so, you've got everything you need... def canViewSecretPage_? : Boolean = // your logic here Loc(my secret page, List(secret :: Nil), Secret page, If(canViewSecretyPage_? _, Sorry dude, you can't go there)) Does this help? -Ketih On Jul 16, 5:43 am, Chris Lewis burningodzi...@gmail.com wrote: I did use an archetype, but it was a 1.0 and must have been the bare-bones (there were no models generated). David Pollak wrote: On Wed, Jul 15, 2009 at 3:17 AM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I didn't, but I'd been looking through liftweb/sites for examples to no avail. This one has helped out a good deal - now I know about the built in User.sitemenu. The only issue now is that the pages under /user_mgt aren't getting rendered in a layout template - ie, just partial content. And because they're XML docs, FF is rendering XML. I'm only assuming those templates surround their content at content (as they do in the 1_1 example). I don't think this is a 1.0 issue, but it's possible. In the User singleton, add the following line: override def screenWrap = Full(lift:surround with=default at=content lift:bind //lift:surround) All of this stuff is done for you when you use the Maven archetype to create a new project. thanks chris David Pollak wrote: On Tue, Jul 14, 2009 at 3:32 PM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I guess the first question I should have asked is how do I go about logging a user in. I have my user model, which now mixes in MegaProtoUser. I also persist instances, but I don't know how to start a user session. I noticed the logUserIn method - I assume that's where to start when I get back into the app later this evening, but I was wondering if there are any example apps that use this? I didnt see any in the current source, and, assuming it makes a difference, I'm using 1.0. thanks again, chris Chris, Did you start your app based on one of the Lift templates? If you take a look at line 27 of: http://github.com/dpp/lift_1_1_sample/blob/master/src/main/scala/boot. .. You'll see how the MegaProtoUser can manage its own menus. From that, you get login, logout, etc. Does this help? Thanks, David David Pollak wrote: On Tue, Jul 14, 2009 at 9:20 AM, glenn gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com wrote: I do something similar in menu items to hide them for
[Lift] Re: how to do basic joins
On Sat, Aug 15, 2009 at 11:14 AM, harryh har...@gmail.com wrote: class Foo extends LongKeyedMapper[Foo] with IdPK { def getBazes = { Baz.findAll(In(Baz.barid, Bar.id, By(Bar.fooid, this))) } OK, upgrading to 1.1-M4 got rid of the NPE so I'm just gonna assume there was a bug that has been fixed. However the SQL query that lift is generating is no good. It's doing something like this: SELECT bazes.cityid, bazes.xdatetime, bazes.aliasid, bazes.userid, bazes.id FROM bazes WHERE barid IN (SELECT id FROM bars WHERE fooid = 22120 ); which is WAY WAY more inefficient than this (by a factor of like 100x): SELECT bazes.cityid, bazes.xdatetime, bazes.aliasid, bazes.userid, bazes.id FROM bazes, bars WHERE bazes.barid = bars.id AND bars.fooid = 22120; At least on MySQL (which is what I'm using). Is there any way to get Lift to use a query like the latter instead of the former? No. Lift uses IN ( ) rather than joins. I know that it's fairly recent that MySQL added nested queries, but I would have thought that they would have had a reasonable optimizer for them. -harryh -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Read context param
In 1.1-SNAPSHOT you don't have access to servletRequest. you have val r: HTTPRequest = S.containerRequest But currently HTTPRequest does not provide a way of getting the net.liftweb.http.provider.HTTPContext. I will add this support pretty soon. You can still do that by: import net.liftweb.http.provider.servlet._ S.containerRequest match { case Full(r: HTTPRequestServlet) = r.req.getSession.getServletContext.getInitParameter (foo) case _ = } ) But this is not elegant. I'll add this week (hopefully tomorrow) to HTTPContext trait the support for getting the init params. Br's, Marius On Aug 19, 9:45 pm, inca incarn...@whiteants.net wrote: I've got the quick-and-dirty: access HttpServletRequest and via the HttpSession to the ServletContext object. E.g., def fooParam = Text( S.servletRequest match { case Full(r) = r.getSession.getServletContext.getInitParameter (foo) case _ = } ) Best regards, inca On 19 авг, 22:29, Naftoli Gugenheim naftoli...@gmail.com wrote: How can I read a context param (e.g. H2 sets connection param)? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: AutoComplete IE bug?
If no other committer wants to look into this I'll look on it. Tim, would this interest you ? Br's, Marius On Aug 19, 9:13 pm, jon jonhoff...@gmail.com wrote: Hi, The AutoComplete widget leaves a trailing , in the javascript that causes IE to complain and not function. Or, at least i think that's the only reason that it's not functioning in IE. Has anyone else noticed this problem? AutoComplete.scala:124 - Jon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: SHtml.a generating an a with bad attributes
On Mon, Aug 17, 2009 at 1:19 PM, harryh har...@gmail.com wrote: Looks like a bug to me It does to me as well. And a somewhat serious one. FYI this bug (if it is indeed a bug) does *not* occur in Lift 1.0, but does in 1.1-M1 and later versions. It should be fixed in trunk. In 1.1, we made stuff like lift:surround/ real snippets... the lift:a/ as snippet causes the issue. I think I've fixed it. -harryh -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: ProtoUser and securing pages
That's what I call Code-for-Clunkers. Thanks, -Keith On Aug 19, 1:57 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Aug 19, 2009 at 11:52 AM, Keith K quasike...@gmail.com wrote: I added a field and cooresponding function to the User.scala class of liftworkshop, as follows: def isApprover_? = { isApprover.is } object isApprover extends MappedBoolean(this) { override def defaultValue = false } It appears to create the proper column for it in the DB, etc. but when the security check in my Boot.java code is used, it doesn't find the user. This is probably a Scala misunderstanding on my part. Based on your example code, I put together these lines. def canViewSecretPage_? : Boolean = User.isApprover_?; def canViewSecretPage_? : Boolean = User.currentUser.map(_.isApprover_? ) openOr false val secretMenu = Menu(Loc(my secret page, List(secret, index), Secret page, If(canViewSecretPage_? _, Sorry dude, you can't go there))) The problem is that I don't know how to check the CURRENT user's permissions for approver state. I import com.liftworkshop.model.User, and things seem to compile, but it's not clear how I can look up the current session's user object to do the check. Could you help me understand how I would do the check on the User's field? Thanks! -K On Aug 19, 9:34 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Tue, Aug 18, 2009 at 6:10 PM, Keith K quasike...@gmail.com wrote: I'd like to test the User for different access levels with functions for each menu item, looking at the User.scala mapped object. Is there some example code out there that does more than check for logged-in status? Can you create a method that returns a Boolean to indicate if a page is allowed to be accessed? If so, you've got everything you need... def canViewSecretPage_? : Boolean = // your logic here Loc(my secret page, List(secret :: Nil), Secret page, If(canViewSecretyPage_? _, Sorry dude, you can't go there)) Does this help? -Ketih On Jul 16, 5:43 am, Chris Lewis burningodzi...@gmail.com wrote: I did use an archetype, but it was a 1.0 and must have been the bare-bones (there were no models generated). David Pollak wrote: On Wed, Jul 15, 2009 at 3:17 AM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I didn't, but I'd been looking through liftweb/sites for examples to no avail. This one has helped out a good deal - now I know about the built in User.sitemenu. The only issue now is that the pages under /user_mgt aren't getting rendered in a layout template - ie, just partial content. And because they're XML docs, FF is rendering XML. I'm only assuming those templates surround their content at content (as they do in the 1_1 example). I don't think this is a 1.0 issue, but it's possible. In the User singleton, add the following line: override def screenWrap = Full(lift:surround with=default at=content lift:bind //lift:surround) All of this stuff is done for you when you use the Maven archetype to create a new project. thanks chris David Pollak wrote: On Tue, Jul 14, 2009 at 3:32 PM, Chris Lewis burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com mailto:burningodzi...@gmail.com wrote: I guess the first question I should have asked is how do I go about logging a user in. I have my user model, which now mixes in MegaProtoUser. I also persist instances, but I don't know how to start a user session. I noticed the logUserIn method - I assume that's where to start when I get back into the app later this evening, but I was wondering if there are any example apps that use this? I didnt see any in the current source, and, assuming it makes a difference, I'm using 1.0. thanks again, chris Chris, Did you start your app based on one of the Lift templates? If you take a look at line 27 of: http://github.com/dpp/lift_1_1_sample/blob/master/src/main/scala/boot. .. You'll see how the MegaProtoUser can manage its own menus. From that, you get login, logout, etc. Does this help? Thanks, David David Pollak wrote: On Tue, Jul 14, 2009 at 9:20 AM, glenn gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com mailto:gl...@exmbly.com
[Lift] Re: Read context param
Can you do that in Boot? That's where I need to access the connection. On Wed, Aug 19, 2009 at 2:45 PM, inca incarn...@whiteants.net wrote: I've got the quick-and-dirty: access HttpServletRequest and via the HttpSession to the ServletContext object. E.g., def fooParam = Text( S.servletRequest match { case Full(r) = r.getSession.getServletContext.getInitParameter (foo) case _ = } ) Best regards, inca On 19 авг, 22:29, Naftoli Gugenheim naftoli...@gmail.com wrote: How can I read a context param (e.g. H2 sets connection param)? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Sitemap and mapper dependency's effects on object reuse
Glenn, Lemme see if I can put together some abstractions that might help out. Thanks, David On Tue, Aug 18, 2009 at 4:58 PM, glenn gl...@exmbly.com wrote: I'm looking for some answers on best coding practices, particularly when it comes to object reuse. In a data-centric application, where the Sitemap is used to navigate through your mapper entities, has anyone given much thought to the object dependencies this can create. In the case of page specific rendering with SiteMap, for example, where should the Menu entries go - in their own object, or should they stay with the MetaMappers. And what about the templates, which can have dependencies on snippets, which reside elsewhere. In other words, it seems to me that good design requires managing the chain of dependencies that an ordinary Menu entry may require. A consistent approach is always best, and I admit that I don't have one at present. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Read context param
On Wed, Aug 19, 2009 at 11:29 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: How can I read a context param (e.g. H2 sets connection param)? Why is the context necessary to figure out the DB connection parameter? -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: MappedDateTime losing time?
Thank you Peter, In the process of trying to figure out the proper syntax to extend the MappedDateTime class I had run across your thread which had been very useful. After your comment, I grabbed your MappedTimestamp source from github and added code for my custom DateFormat. Works like a charm, thanks for the suggestion! Going line by line through the code, I'm not exactly sure how the minor differences between your class and Mine make it work properly, but I'm grateful that you contributed your code to community. As I become more comfortable with Scala it will hopefully become more clear. Thank You, and thanks to everyone who worked with you on it. Grant On Aug 19, 10:02 am, Peter Robinett pe...@bubblefoundry.com wrote: Hi Grant, I'm afraid I don't have the answer for you, but perhaps my attempt at making a MappedTimestamp will prove useful to you:http://groups.google.com/group/liftweb/msg/84b1612953fe9ac0. Peter Robinett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Git dumbitude
Well, I pushed the new Oracle/Mapper code to Git and then I realized that somehow I merged the code twice. The logs are going to look a little confusing but I've at least confirmed that everything is correct and working. Apologies for the mistake. In other news, I can't get into GitHub's web interface (although the backend is still working). I hope that I didn't cause this ;) Derek --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: CMS for Lift?
I think the trick to a really vibrant CMS is the ability to create plugins - modules in Lift that can be dynamically installed. I'm not sure how to affect this except through OSGi. On Aug 19, 8:55 am, TylerWeir tyler.w...@gmail.com wrote: Wonderful! On Aug 19, 11:03 am, David Pollak feeder.of.the.be...@gmail.com wrote: FWIW... I got roped into hosting a CMS by the PTA of my kids' school. I may knock something together in Lift or leverage off the work Glenn has done. On Tue, Aug 18, 2009 at 3:26 PM, Timothy Perrett timo...@getintheloop.euwrote: Just my two cents, but I wouldn't use the lift namespace... If you use the lift tags OOTB, you risk designers shoving lots of comet actors on a single page. You would get more granular control if you created a special set of tags: cms:something .. / Cheers, Tim On 18/08/2009 23:00, Ewan ehar...@gmail.com wrote: I've been scratching my head about that one too. I have used both Alfresco and opencms to produce both dynamic and static and in the case of dynamic they have their own servlet/filter to render the content - I've not yet spent enough time working out how and if they can be fitted together. For me, having used Hybris (J2EE ecommerce engine with some CMS built in), I'd like to be able to have page fragments in a template served from the CMS (lift snippets presumably) that would be created/ maintained with some aspect of workflow by CMS user(s) in an associated CMS lift webapp with funky (X)HTML editor support. My web guys, non-lift devs, can then sprinkle cms tags where appropriate. A tag might be lift:cms contentId=news count=5 order=ascending/ which would render the last five news items in ascending order. Just some thoughts -- Ewan On Aug 18, 10:09 pm, Terry J. Leach terry.le...@gmail.com wrote: I would like to know how the Lift/Scala can leveraged to with Alfresco or any other open source Java based CMS. Terry J. Leach On Aug 17, 2:09 pm, Stefan Scott stefanscottal...@gmail.com wrote: I'll chime in here since I've been evaluating several CMSs lately. I previously used Drupal and WordPress as my CMSs - now however I'm moving everything to MODx because of the increased flexibility and more-logical organization, and I'm also impressed with the demos of SilverStripe, TypoLight Typo3 - and LifeRay, which is written in Java instead of PHP. (LifeRay seems to be much more than a CMS - it claims to offer collaboration and social networking.) Some on-line demos here: MODx -http://trymodx.com/ SilverStripe -http://demo.silverstripe.com/ TypoLight -http://www.typolight.org/demo.html Typo3 -http://testsite.punkt.de/ LifeRay -http://demo.liferay.net/web/guest/home It would be good to take a look at these additional CMSs as they offer some capabilities beyond WordPress and Drupal. Drupal in particular is wildly popular but it may no longer be the best candidate to imitate, as it is less well-organized and less flexible/customizable (compared say to MODx, which lets you take CSS from an existing site and use it for your site, and which lets you apply a template to a single document, unlike Drupal where a theme applies to the entire site). To keep up with advanced CMSs, Drupal has evolved to use a bunch of (often redundant or competing) modules which are not always compatible with current releases. Examples of things that Drupal treats as add-ons (modules) are: custom content (the CCK/Views modules, with their confusing albeit AJAX-y interface), multi-language, and photo galleries (I gave up on Drupal after a few days of trying out various photo gallery modules, none of which I could understand). Finally, it seems odd that Drupal, as a content management system, lacks something all advanced CMSs have: a *treeview* of the overall site content. Instead, it only has a jumbled *list* of content, sorted by not by location but by last edited (!), with all translations also scattered through the list based on last- edited date, and this list is buried several levels deep in the admin navigation system, unlike the site content treeview navigator which is prominently displayed (usually on the left) in advanced CMSs. (Of course, I don't want to veer off-topic here and start a CMS flame war here in this liftweb discussion. :-) Regarding dynamic site map creation - I do know that MODx has something like this, using WayFinder to create a menu from selected branches of the site's document tree, automatically including any updated sub-branches, and I believe most other advanced CMSs have something like this too. LifeRay seems very intriguing - it claims to do a lot beyond just CMS. Since it's written in Java (not PHP), who knows if some of its code could be
[Lift] clue for the clueless?
Lifted, i readily confess to being a total idiot. i'm always running into this problem of not knowing when the namespace binding is in effect. i've cribbed Chat.scala and other files from liftweb/site/example and added it whole sale to my project.When i add val entries = ( Menu(Loc(Home, List(index), Home)) ... :: Menu(Loc(Chat.1, List(chat), Chat, If(User.loggedIn_? _, x))) ... :: User.sitemap ) to my site menu and fire things up i get 'namespace chat undefined'. This is despite override def render = bind(chat, bodyArea, name - userName, AttrBindParam(id, Text(infoId), id), list - displayList _) being defined in the chat class. Any body have a clue for the clueless? Best wishes, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: error while SHtml.ajaxInvoke call
Are you trying to create a link/button that someone clicks on to cause the Ajax call to be made? On Wed, Aug 19, 2009 at 8:43 AM, pravin pravinka...@gmail.com wrote: Hi , i am trying to configure Ajax in my application using lift. I have : lift:DisplayResults.showFeeds table border=0 width=100% class = resultheader cellpadding=10 t:feedsResultRows/ /table /lift:DisplayResults.showFeeds snippet for given html code : def showFeeds(xhtml:NodeSeq):NodeSeq ={ println(Inside showFeeds); bind(t, xhtml,feedsResultRows - SHtml.ajaxInvoke (updateStartDate)._2) } def updateStartDate () : JsCmd= { JsCmds.SetHtml(resultsRow, displayResult(List(abc,xyz))) } def displayResult(rList:List[Object]):NodeSeq={ trtd table trtdrList(0).toString()}/ td /tr trtd{rList(1).toString()}/a / td /tr /table /td/tr } But its not working- Giving out put on html page like- lift_ajaxHandler('F966737512075R2E' + '=true', null, null) What is this How can i use Ajax in my application.I want to give asynchronous call (Ajax) for my above html component so it can get show list that i get from Db call . This all happening on submit button click Appreciate any pointer regarding this -Pravin -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Sitemap and mapper dependency's effects on object reuse
David, Sounds like you know where I'm coming from on this. What got me was an attempt to write a Menu Loc for listing all registered users on the site. The Template for this contains a lift tag for a snippet in another class. I don't necessarily object to the dependency on a snippet class, but this does lead to reuse problems for my User MetaMapper. /** * The menu item for listing all users */ def listUsersMenuLoc: Box[Menu] = { Full(Menu(Loc(listUsers, listUsers :: Nil, S.??(List Users), listUsers, testLogginIn))) } def listUsers = Template({ () = lift:surround with=default at=content h3Site Users/h3 div id=entryform table tr thFirst Name/th thLast Name/th thEmail/th thRoles/th th/th th/th /tr lift:ManageUsers.list user:entry tr tduser:firstname //td tduser:lastname //td tduser:email //td tduser:roles//td tduser:actions//td /tr /user:entry /lift:ManageUsers.list /table /div hr / div id=user-edit/ /lift:surround }) On Aug 19, 3:08 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Glenn, Lemme see if I can put together some abstractions that might help out. Thanks, David On Tue, Aug 18, 2009 at 4:58 PM, glenn gl...@exmbly.com wrote: I'm looking for some answers on best coding practices, particularly when it comes to object reuse. In a data-centric application, where the Sitemap is used to navigate through your mapper entities, has anyone given much thought to the object dependencies this can create. In the case of page specific rendering with SiteMap, for example, where should the Menu entries go - in their own object, or should they stay with the MetaMappers. And what about the templates, which can have dependencies on snippets, which reside elsewhere. In other words, it seems to me that good design requires managing the chain of dependencies that an ordinary Menu entry may require. A consistent approach is always best, and I admit that I don't have one at present. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: clue for the clueless?
What does your template look like? I don't think that the error you're getting has anything to do with SiteMap (problems there would result in a 403 or 404 HTTP error). Derek On Wed, Aug 19, 2009 at 5:47 PM, Meredith Gregory lgreg.mered...@gmail.comwrote: Lifted, i readily confess to being a total idiot. i'm always running into this problem of not knowing when the namespace binding is in effect. i've cribbed Chat.scala and other files from liftweb/site/example and added it whole sale to my project.When i add val entries = ( Menu(Loc(Home, List(index), Home)) ... :: Menu(Loc(Chat.1, List(chat), Chat, If(User.loggedIn_? _, x))) ... :: User.sitemap ) to my site menu and fire things up i get 'namespace chat undefined'. This is despite override def render = bind(chat, bodyArea, name - userName, AttrBindParam(id, Text(infoId), id), list - displayList _) being defined in the chat class. Any body have a clue for the clueless? Best wishes, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Sitemap and mapper dependency's effects on object reuse
Complicating matters a bit, I decided to use the new ModelSnippet, which extends StatefulSniippet for my snippet class, so I'm not sure the Template can be refactored to not use it. Glenn... On Aug 19, 4:42 pm, glenn gl...@exmbly.com wrote: David, Sounds like you know where I'm coming from on this. What got me was an attempt to write a Menu Loc for listing all registered users on the site. The Template for this contains a lift tag for a snippet in another class. I don't necessarily object to the dependency on a snippet class, but this does lead to reuse problems for my User MetaMapper. /** * The menu item for listing all users */ def listUsersMenuLoc: Box[Menu] = { Full(Menu(Loc(listUsers, listUsers :: Nil, S.??(List Users), listUsers, testLogginIn))) } def listUsers = Template({ () = lift:surround with=default at=content h3Site Users/h3 div id=entryform table tr thFirst Name/th thLast Name/th thEmail/th thRoles/th th/th th/th /tr lift:ManageUsers.list user:entry tr tduser:firstname //td tduser:lastname //td tduser:email //td tduser:roles//td tduser:actions//td /tr /user:entry /lift:ManageUsers.list /table /div hr / div id=user-edit/ /lift:surround }) On Aug 19, 3:08 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Glenn, Lemme see if I can put together some abstractions that might help out. Thanks, David On Tue, Aug 18, 2009 at 4:58 PM, glenn gl...@exmbly.com wrote: I'm looking for some answers on best coding practices, particularly when it comes to object reuse. In a data-centric application, where the Sitemap is used to navigate through your mapper entities, has anyone given much thought to the object dependencies this can create. In the case of page specific rendering with SiteMap, for example, where should the Menu entries go - in their own object, or should they stay with the MetaMappers. And what about the templates, which can have dependencies on snippets, which reside elsewhere. In other words, it seems to me that good design requires managing the chain of dependencies that an ordinary Menu entry may require. A consistent approach is always best, and I admit that I don't have one at present. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift:with-params deprecation alternatives
On Wed, Aug 19, 2009 at 2:46 AM, marius d. marius.dan...@gmail.com wrote: This is a decision that needs consensus ... and David's agreement. I'm cool with it. It might also be worth thinking about creating some alias library so folks could change the default names of Lift's snippets. Or maybe that's just a bad idea. Personally I agree with it but others may not. Br's, Marius On Aug 19, 12:41 pm, inca incarn...@whiteants.net wrote: Why not just introduce the new tag, leaving the former alone (possibly deprecated in next major releases)? On 19 авг, 12:07, marius d. marius.dan...@gmail.com wrote: Yes we tried to deprecate it but later on we un-derprecate it :) So you can use lift:with-param safely. Purely for naming perspective lift:insert seems to me more intuitive than lift:with-param ... I'm not sure if this is a strong enough motivation to change the name hence inducing a breaking change. Br's, Marius On Aug 19, 10:55 am, inca incarn...@whiteants.net wrote: As suggested inhttp:// groups.google.com/group/liftweb/browse_thread/thread/d664b712d... by Mr. Marius D., I should use lift:with-param in order to insert content into multiple bind points of template. But recently I read that this tag is deprecated. What alternatives are available? P.S. I would propose lift:insert at=bindPointName tag for this purpose. And the contents of lift:bind name=bindPointName tag should be assumed as default if none lift:insert ... tag overrides it. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: PreCache's use of WHERE ... IN
And PostGIS rocks if you do any GIS-related stuff. On Tue, Aug 18, 2009 at 5:25 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Tue, Aug 18, 2009 at 3:24 PM, harryh har...@gmail.com wrote: Because making things line up name-wise for joins (especially when you're joining to the same table) is a lot more difficult. All RDBMS except MySQL will optimize both inner queries and joins the same way. Interesting. I have been considering switching to PostgreSQL (for reasons unrelated to this), and this issue may speed up my move. What RDBMS are others generally using with Lift? Are there any general recommendations? I use PostgreSQL for all my production sites. It's amazingly solid. -harryh -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Git dumbitude
GitHub's Front End has been crawling for a while now. Still, it's easier to blame you. :) On Aug 19, 6:25 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: Well, I pushed the new Oracle/Mapper code to Git and then I realized that somehow I merged the code twice. The logs are going to look a little confusing but I've at least confirmed that everything is correct and working. Apologies for the mistake. In other news, I can't get into GitHub's web interface (although the backend is still working). I hope that I didn't cause this ;) Derek --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: clue for the clueless?
what URL are you using? Can you include the full browser source? On Wed, Aug 19, 2009 at 4:47 PM, Meredith Gregory lgreg.mered...@gmail.comwrote: Lifted, i readily confess to being a total idiot. i'm always running into this problem of not knowing when the namespace binding is in effect. i've cribbed Chat.scala and other files from liftweb/site/example and added it whole sale to my project.When i add val entries = ( Menu(Loc(Home, List(index), Home)) ... :: Menu(Loc(Chat.1, List(chat), Chat, If(User.loggedIn_? _, x))) ... :: User.sitemap ) to my site menu and fire things up i get 'namespace chat undefined'. This is despite override def render = bind(chat, bodyArea, name - userName, AttrBindParam(id, Text(infoId), id), list - displayList _) being defined in the chat class. Any body have a clue for the clueless? Best wishes, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: PreCache's use of WHERE ... IN
And PostGIS rocks if you do any GIS-related stuff. Which I am (this was my other reason for planning on migrating over). I guess it's time to take the plunge. -harryh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: clue for the clueless?
That's probably a Firefox XML error - look at view source and see what the Elem label is that's not being bound. - Meredith Gregorylgreg.mered...@gmail.com wrote: Lifted, i readily confess to being a total idiot. i'm always running into this problem of not knowing when the namespace binding is in effect. i've cribbed Chat.scala and other files from liftweb/site/example and added it whole sale to my project.When i add val entries = ( Menu(Loc(Home, List(index), Home)) ... :: Menu(Loc(Chat.1, List(chat), Chat, If(User.loggedIn_? _, x))) ... :: User.sitemap ) to my site menu and fire things up i get 'namespace chat undefined'. This is despite override def render = bind(chat, bodyArea, name - userName, AttrBindParam(id, Text(infoId), id), list - displayList _) being defined in the chat class. Any body have a clue for the clueless? Best wishes, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: version issues for comet actor stuff
On Wed, Aug 19, 2009 at 3:03 PM, Meredith Gregory lgreg.mered...@gmail.comwrote: David, et al, i cribbed the Chat.scala and related files from the liftweb examples dir as a beginning for the Pixillion project. i'm getting issues compiling these files around missing defns for CometListener, deepFindKids and findKids. My lift version in the pom is 1.0. i thought that would be sufficient to get the CometActor stuff. However, when i issue a find . -exec grep CometListener '{}' \; -print in ~/.m2/repository/net/liftweb i get a big fat nada. A similar query in a snap of github has bash-3.2$ find . -exec grep CometListener '{}' \; -print trait CometListener extends CometListenee ./lift/src/main/scala/net/liftweb/http/CometActor.scala class Chat extends CometActor with CometListener { ./sites/example/src/main/scala/net/liftweb/example/comet/Chat.scala span class=keywordclass/span span class=typeChat/span span class=keywordextends/span span class=typeCometActor/span span class=keywordwith/span span class=typeCometListener/span { ./sites/example/src/main/webapp/chat.html bash-3.2$ So, what is the most conservative version of lift that gets me this version of CometActor? The most conservative version of Lift is 1.1-SNAPSHOT. The earliest version is likely 1.1-M2. Best wishes, --greg /Users/lgm/work/src/projex/biosimilarity/pixillion/src/main/scala/com/biosimilarity/games/comet/Chat.scala:32: error: not found: type CometListener class Chat extends CometActor with CometListener { ^ /Users/lgm/work/src/projex/biosimilarity/pixillion/src/main/scala/com/biosimilarity/games/comet/Chat.scala:37: error: not found: value findKids private lazy val inputArea = findKids(defaultXml, chat, input) ^ /Users/lgm/work/src/projex/biosimilarity/pixillion/src/main/scala/com/biosimilarity/games/comet/Chat.scala:38: error: not found: value findKids private lazy val bodyArea = findKids(defaultXml, chat, body) ^ /Users/lgm/work/src/projex/biosimilarity/pixillion/src/main/scala/com/biosimilarity/games/comet/Chat.scala:39: error: not found: value deepFindKids private lazy val singleLine = deepFindKids(bodyArea, chat, list) -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Git dumbitude
Mea culpa, mea culpa! On Wed, Aug 19, 2009 at 7:39 PM, TylerWeir tyler.w...@gmail.com wrote: GitHub's Front End has been crawling for a while now. Still, it's easier to blame you. :) On Aug 19, 6:25 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: Well, I pushed the new Oracle/Mapper code to Git and then I realized that somehow I merged the code twice. The logs are going to look a little confusing but I've at least confirmed that everything is correct and working. Apologies for the mistake. In other news, I can't get into GitHub's web interface (although the backend is still working). I hope that I didn't cause this ;) Derek --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: slow down ajax?
Well, I went down the rabbit hole on a quest for 1.1-SNAPSHOT - It is not visible, even though my pom points to it, and the .m2 repository shows a directory for it. .m2\repository\net\liftweb\lift-archetype-basic\1.1-SNAPSHOT Bottom line is : src\main\scala\bootstrap\liftweb\Boot.scala:11: error: value provider is not a member of package net.liftweb.http import http.provider._ and: error: wrong number of arguments for method ajaxText: (String,(String) = net.liftweb.http.js.JsCmd)scala.xml.Elem So Lift can't see the new stuff, and I also can't get an archetype created using the 1.1-SNAPSHOT, so I will keep hacking unless you have some further guidance for me. On Aug 19, 12:20 pm, marius d. marius.dan...@gmail.com wrote: Please use Lift 1.1-SNAPSHOT Br's, Marius On Aug 19, 10:06 pm, g-man gregor...@gmail.com wrote: I quoted the def from net.liftweb.http.SHtml in: http://scala-tools.org/scaladocs/liftweb/1.0/ and when I tried the other version, my complier did not accept the extra param. That's why I thought I had to override something... Is there a newer version I should be using? On Aug 18, 10:38 pm, marius d. marius.dan...@gmail.com wrote: No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text field .datepicker({dateFormat:'m-d-yy', minDate: +1}) .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); // works well to pick a new date and change it to millis for save Emitted XHTML: span span class=dueon id=F111290299287IBE
[Lift] Re: slow down ajax?
Are you using maven to compile? Delete any earlier jar so you rule out that possibility. Also, if you turn on debug output in maven (-X) it might tell you the path that it's using to invoke the compiler so you can see which jar it's using if any. - g-mangregor...@gmail.com wrote: Well, I went down the rabbit hole on a quest for 1.1-SNAPSHOT - It is not visible, even though my pom points to it, and the .m2 repository shows a directory for it. .m2\repository\net\liftweb\lift-archetype-basic\1.1-SNAPSHOT Bottom line is : src\main\scala\bootstrap\liftweb\Boot.scala:11: error: value provider is not a member of package net.liftweb.http import http.provider._ and: error: wrong number of arguments for method ajaxText: (String,(String) = net.liftweb.http.js.JsCmd)scala.xml.Elem So Lift can't see the new stuff, and I also can't get an archetype created using the 1.1-SNAPSHOT, so I will keep hacking unless you have some further guidance for me. On Aug 19, 12:20 pm, marius d. marius.dan...@gmail.com wrote: Please use Lift 1.1-SNAPSHOT Br's, Marius On Aug 19, 10:06 pm, g-man gregor...@gmail.com wrote: I quoted the def from net.liftweb.http.SHtml in: http://scala-tools.org/scaladocs/liftweb/1.0/ and when I tried the other version, my complier did not accept the extra param. That's why I thought I had to override something... Is there a newer version I should be using? On Aug 18, 10:38 pm, marius d. marius.dan...@gmail.com wrote: No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span class='dueon'{task.dueOn.toString}/span, span class='chgDueon'{ajaxText(task.dueOn.toString, v = { task.dueOn(v.toLong).save; reDrawTasks(); }) % (size - 10)}/span) JS: $chgDueon // jQuery selection for text
[Lift] Re: slow down ajax?
Or just checkout from git master and do a mvn clean:clean install Trust me it's all there :) Br's, Marius On Aug 20, 8:15 am, Naftoli Gugenheim naftoli...@gmail.com wrote: Are you using maven to compile? Delete any earlier jar so you rule out that possibility. Also, if you turn on debug output in maven (-X) it might tell you the path that it's using to invoke the compiler so you can see which jar it's using if any. - g-mangregor...@gmail.com wrote: Well, I went down the rabbit hole on a quest for 1.1-SNAPSHOT - It is not visible, even though my pom points to it, and the .m2 repository shows a directory for it. .m2\repository\net\liftweb\lift-archetype-basic\1.1-SNAPSHOT Bottom line is : src\main\scala\bootstrap\liftweb\Boot.scala:11: error: value provider is not a member of package net.liftweb.http import http.provider._ and: error: wrong number of arguments for method ajaxText: (String,(String) = net.liftweb.http.js.JsCmd)scala.xml.Elem So Lift can't see the new stuff, and I also can't get an archetype created using the 1.1-SNAPSHOT, so I will keep hacking unless you have some further guidance for me. On Aug 19, 12:20 pm, marius d. marius.dan...@gmail.com wrote: Please use Lift 1.1-SNAPSHOT Br's, Marius On Aug 19, 10:06 pm, g-man gregor...@gmail.com wrote: I quoted the def from net.liftweb.http.SHtml in: http://scala-tools.org/scaladocs/liftweb/1.0/ and when I tried the other version, my complier did not accept the extra param. That's why I thought I had to override something... Is there a newer version I should be using? On Aug 18, 10:38 pm, marius d. marius.dan...@gmail.com wrote: No you can't override it because SHtml is an object not a type. The function definition above (def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) ) already exists in SHtml. In fact we have this deferring mechanism for other functions like ajaxButton, a, etc. If you're still having trouble using this please let me know and I'll make and example app. for you. Br's, Marius On Aug 19, 5:42 am, g-man gregor...@gmail.com wrote: OK, seems like I have to learn a little more about Scala so I can override the ajaxText method, right? Here it is in the docs: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_* (value, SFuncHolder(func)) When I fumble around, it won't compile, because I'm just not doing it right. My project is a hobby, not mission-critical, so I'm under no pressure. For now, I will change to an ajaxForm, but the learning is all good, and if you want to keep teaching, I will listen! Thanks for your patience... On Aug 18, 12:41 pm, marius d. marius.dan...@gmail.com wrote: Having def ajaxText(value: String, jsFunc: Call, func: String = JsCmd) jsFunc parameter is a Call which is defined as: case class Call(function: String, params: JsExp*) extends JsExp So by this you represent a javascript function invocations. So assuming somewhere you have a javascript function like: function myFunc(myParam, callback) { // do some logic callback() } in the snippet we have something like: ajaxText(task.dueOn.toString, Call(myFunc, Str(some_param_value)) v = { task.dueOn(v.toLong).save; reDrawTasks();}) As you can see we called Call(myFunc, Str (some_param_value)) .. .we provided the JS function name and one parameter. Lift will add the second parameter which is the callback function. This callback function represents the actual ajax call and since it is a callback you can invoke it whenever you want inside 'myFunc' javascript function. In other words you can defer the actual ajax call as you see fit. Now myFunc function declaration can be: 1. In your own .js file 2. Written in the script tag inside your html 3. Generate using Lifts' JS absctrations using JsCmds.Function() object such as: JsCmds.Function(MyFunc, List(myParam, callback), a_JsCmd_expression_which_is_the_function_body) The main point in all this is that you can defer the actual ajax call. You know better if this fits your case. Br's, Marius On Aug 18, 10:21 pm, g-man gregor...@gmail.com wrote: No, this is the old way ...I am unsure how to invoke the ajax method -- could you enlighten me? On Aug 17, 12:26 pm, marius d. marius.dan...@gmail.com wrote: I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it? Marius On Aug 17, 10:20 pm, g-man gregor...@gmail.com wrote: OK, thanks for checking back... Snippet: swappable(span
[Lift] Re: Read context param
I think that regardless of Naftoli's particular case he brought up a valid point such as if when initializing a servlet user has a ServletConfig ... we could easily abstract things here as well to make it available in Boot as well. I'll noodle on this and see what I can do. Of course I would not recommend using web.xml init params (unless there are really compelling reasons to do so) but rather a Lift config or an application config ... but that's just me. Br's, Marius On Aug 20, 1:15 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Aug 19, 2009 at 11:29 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: How can I read a context param (e.g. H2 sets connection param)? Why is the context necessary to figure out the DB connection parameter? -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: error while SHtml.ajaxInvoke call
yes i have submit button. on click event of this i am doing other tasks. above data population for text is not on click submit button. On Aug 20, 2:56 am, David Pollak feeder.of.the.be...@gmail.com wrote: Are you trying to create a link/button that someone clicks on to cause the Ajax call to be made? On Wed, Aug 19, 2009 at 8:43 AM, pravin pravinka...@gmail.com wrote: Hi , i am trying to configure Ajax in my application using lift. I have : lift:DisplayResults.showFeeds table border=0 width=100% class = resultheader cellpadding=10 t:feedsResultRows/ /table /lift:DisplayResults.showFeeds snippet for given html code : def showFeeds(xhtml:NodeSeq):NodeSeq ={ println(Inside showFeeds); bind(t, xhtml,feedsResultRows - SHtml.ajaxInvoke (updateStartDate)._2) } def updateStartDate () : JsCmd= { JsCmds.SetHtml(resultsRow, displayResult(List(abc,xyz))) } def displayResult(rList:List[Object]):NodeSeq={ trtd table trtdrList(0).toString()}/ td /tr trtd{rList(1).toString()}/a / td /tr /table /td/tr } But its not working- Giving out put on html page like- lift_ajaxHandler('F966737512075R2E' + '=true', null, null) What is this How can i use Ajax in my application.I want to give asynchronous call (Ajax) for my above html component so it can get show list that i get from Db call . This all happening on submit button click Appreciate any pointer regarding this -Pravin -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Read context param
H2's DbStarter reads the url/username/password and stores a connection object back in the servlet context. - marius d.marius.dan...@gmail.com wrote: I think that regardless of Naftoli's particular case he brought up a valid point such as if when initializing a servlet user has a ServletConfig ... we could easily abstract things here as well to make it available in Boot as well. I'll noodle on this and see what I can do. Of course I would not recommend using web.xml init params (unless there are really compelling reasons to do so) but rather a Lift config or an application config ... but that's just me. Br's, Marius On Aug 20, 1:15 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Aug 19, 2009 at 11:29 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: How can I read a context param (e.g. H2 sets connection param)? Why is the context necessary to figure out the DB connection parameter? -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---