OK, I think I've fixed the bugs I found in the description. First, I reverted the last two commits which were trying to solve the problem in a purely JavaScript fashion. Next I committed a change which sends a "root" variable from the server to the frontend so that JavaScript knows the context root it's operating with. From then on URL construction is easy.
Please give this a proper testing and let me know if you find any problems! Thanks, Vassil On Sun, Feb 27, 2011 at 4:37 PM, Richard Hirsch <[email protected]> wrote: > On Sun, Feb 27, 2011 at 3:35 PM, Vassil Dichev <[email protected]> wrote: >> I see now. But I still think that we should solve this at the >> server-side. There, we have internal knowledge what the context root >> is, and at the client we don't know which part of the path is what. > > Exactly > >> >> Thanks for working on this and let me see if I can help with some of >> these issues tonight. > > thanks > >> >> Vassil >> >> >> On Sun, Feb 27, 2011 at 9:52 AM, Richard Hirsch <[email protected]> >> wrote: >>> @Vassil - with your patch, we resolved the issue that was present in >>> the message content. We still have the problem, however, during the >>> creation of the messages that are posted via comet. For this >>> functionality, the code that deals with the path resolution is in >>> javascript (the pathAdjust function). The ideal solution would be to >>> use your patch to adjust the URLs before they are sent to the browser >>> - we could then simplify the javascript code. Currently, the URL for >>> the user page and the URL for the default avatar (when there is no >>> avatar URL that has been set) are being set in javascript. I think >>> the URL for the default avatar could easily be set in Scala. I'm not >>> so sure about the URL for the user's page, since this is built in >>> javascript based on the user id. >>> >>> D. >>> >>> On Sat, Feb 26, 2011 at 9:16 PM, Vassil Dichev <[email protected]> wrote: >>>> I think now that we've resolved the Tomcat issue (hopefully), we can >>>> revert the pathAdjust function in display_messages_top.js. Not only is >>>> it not necessary now but some strange bugs like the one with the >>>> username path have appeared. >>>> >>>> Vassil >>>> >>>> >>>> On Sat, Feb 26, 2011 at 7:45 PM, Richard Hirsch <[email protected]> >>>> wrote: >>>>> @Ethan saw that as well. Also broken avatar links mess up the UI (see >>>>> the avatar links from SAP that are internal SAP). >>>>> >>>>> D. >>>>> >>>>> On Sat, Feb 26, 2011 at 6:22 PM, Ethan Jewett <[email protected]> wrote: >>>>>> Hmmm, an additional related issue is that we appear to not have a >>>>>> proper CSS "height" attribute on the "avatar" class right now, so when >>>>>> the avatar doesn't show up or the avatar image that the user is using >>>>>> is an unexpected height we have a situation where the user timeline >>>>>> gets out of whack. (See Dick's messages on the Stax instance as an >>>>>> example.) >>>>>> >>>>>> I'm not spending very much time with my computer this weekend, but >>>>>> I'll try to put in the fix on Monday evening. >>>>>> >>>>>> Cheers, >>>>>> Ethan >>>>>> >>>>>> On Fri, Feb 25, 2011 at 10:46 PM, Vladimir Ivanov >>>>>> <[email protected]> wrote: >>>>>>> Hmm... It appears some problems exist. When I click on 'Home' link and >>>>>>> try >>>>>>> to view any user's profile page, 'The Requested URL /index/user/vivanov >>>>>>> was >>>>>>> not found on this server' message is shown. Also UI formatting is >>>>>>> broken for >>>>>>> user that doesn't have avatar on the same page due to default avatar.jpg >>>>>>> hasn't been loaded. >>>>>>> >>>>>>> 2011/2/26 Vladimir Ivanov <[email protected]> >>>>>>> >>>>>>>> Sorry, >>>>>>>> >>>>>>>> It seems it is my local problem - I've just tried to post new messages >>>>>>>> on >>>>>>>> Stax, UI is ok. >>>>>>>> >>>>>>>> 2011/2/26 Vladimir Ivanov <[email protected]> >>>>>>>> >>>>>>>> Good work guys! >>>>>>>>> >>>>>>>>> Btw, it might be my local checkout is broken, but after today's >>>>>>>>> update UI >>>>>>>>> on user's personal timeline screen is broken. >>>>>>>>> >>>>>>>>> 2011/2/25 Ethan Jewett <[email protected]> >>>>>>>>> >>>>>>>>> Thanks Dick and Vassil! >>>>>>>>>> >>>>>>>>>> On Fri, Feb 25, 2011 at 9:31 AM, Richard Hirsch >>>>>>>>>> <[email protected]> >>>>>>>>>> wrote: >>>>>>>>>> > Thanks. >>>>>>>>>> > >>>>>>>>>> > I've fixed this problem and have committed everything to SVN. >>>>>>>>>> > Deployed >>>>>>>>>> > everything to stax. >>>>>>>>>> > >>>>>>>>>> > I discovered a new bug during testing (unable to post from streams >>>>>>>>>> > / >>>>>>>>>> > public page) so we aren't finished with the release yet. >>>>>>>>>> > >>>>>>>>>> > D. >>>>>>>>>> > >>>>>>>>>> > On Fri, Feb 25, 2011 at 6:28 AM, Vassil Dichev <[email protected]> >>>>>>>>>> wrote: >>>>>>>>>> >> OK, I've committed a fix, and it works with Jetty. I think you've >>>>>>>>>> >> also >>>>>>>>>> >> forgotten to mention that shortened URLs must also have the >>>>>>>>>> >> prepended >>>>>>>>>> >> context root. >>>>>>>>>> >> >>>>>>>>>> >> Now it's time to go to the kindergarten with my son, feel free to >>>>>>>>>> test. >>>>>>>>>> >> >>>>>>>>>> >> Vassil >>>>>>>>>> >> >>>>>>>>>> >> >>>>>>>>>> >> On Fri, Feb 25, 2011 at 6:56 AM, Vassil Dichev >>>>>>>>>> >> <[email protected]> >>>>>>>>>> wrote: >>>>>>>>>> >>> Since the context root doesn't change for the lifetime of the >>>>>>>>>> >>> application, I would define a val somewhere in object Message: >>>>>>>>>> >>> >>>>>>>>>> >>> val root = LiftRules.context.path >>>>>>>>>> >>> >>>>>>>>>> >>> and then prepend root to these URLs. Give me half an hour and >>>>>>>>>> >>> I'll do >>>>>>>>>> >>> it and test that at least it works on Jetty (should be empty >>>>>>>>>> >>> context >>>>>>>>>> >>> root). >>>>>>>>>> >>> >>>>>>>>>> >>> >>>>>>>>>> >>> On Fri, Feb 25, 2011 at 6:46 AM, Richard Hirsch < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>> If you just change the two lines of codes accordingly, I can >>>>>>>>>> >>>> test it >>>>>>>>>> >>>> on Tomcat. I kept getting Scala errors while compiling >>>>>>>>>> >>>> >>>>>>>>>> >>>> map(nickname => >>>>>>>>>> >>>> <xml:group> @<a >>>>>>>>>> >>>> href={"/user/"+urlEncode(nickname.text)}>{nickname}</a> >>>>>>>>>> </xml:group>). >>>>>>>>>> >>>> getOrElse(Text("")) >>>>>>>>>> >>>> >>>>>>>>>> >>>> case e: Elem if e.label == "tag" => >>>>>>>>>> >>>> e.attribute("name").map(tag => >>>>>>>>>> >>>> <xml:group> #<a >>>>>>>>>> >>>> href={"/tag/"+urlEncode(tag.text)}>{tag}</a> </xml:group>). >>>>>>>>>> >>>> getOrElse(Text("")) >>>>>>>>>> >>>> >>>>>>>>>> >>>> >>>>>>>>>> >>>> D. >>>>>>>>>> >>>> On Fri, Feb 25, 2011 at 5:43 AM, Vassil Dichev >>>>>>>>>> >>>> <[email protected]> >>>>>>>>>> wrote: >>>>>>>>>> >>>>> A quick look at the Scaladocs >>>>>>>>>> >>>>> ( >>>>>>>>>> http://scala-tools.org/mvnsites/liftweb-2.2/framework/scaladocs/index.html >>>>>>>>>> ) >>>>>>>>>> >>>>> shows it should be easy: >>>>>>>>>> >>>>> >>>>>>>>>> >>>>> LiftRules.context.path >>>>>>>>>> >>>>> >>>>>>>>>> >>>>> Unfortunately I won't have the time to test it with Tomcat now, >>>>>>>>>> could >>>>>>>>>> >>>>> you give this a try? Otherwise I'll check it tonight. >>>>>>>>>> >>>>> >>>>>>>>>> >>>>> Vassil >>>>>>>>>> >>>>> >>>>>>>>>> >>>>> >>>>>>>>>> >>>>> On Fri, Feb 25, 2011 at 6:33 AM, Richard Hirsch < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>> @Vassil - that would be great >>>>>>>>>> >>>>>> >>>>>>>>>> >>>>>> Thanks. >>>>>>>>>> >>>>>> >>>>>>>>>> >>>>>> D. >>>>>>>>>> >>>>>> >>>>>>>>>> >>>>>> On Fri, Feb 25, 2011 at 5:31 AM, Vassil Dichev < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>> Dick, >>>>>>>>>> >>>>>>> >>>>>>>>>> >>>>>>> This could be done with Javascript, but now that I look at >>>>>>>>>> >>>>>>> the >>>>>>>>>> problem >>>>>>>>>> >>>>>>> more closely I think it should be done in Scala. We need to >>>>>>>>>> >>>>>>> get >>>>>>>>>> the >>>>>>>>>> >>>>>>> servlet context name and prepend it to the URL via the >>>>>>>>>> >>>>>>> Servlet >>>>>>>>>> API. >>>>>>>>>> >>>>>>> Let me check how to do that. >>>>>>>>>> >>>>>>> >>>>>>>>>> >>>>>>> Vassil >>>>>>>>>> >>>>>>> >>>>>>>>>> >>>>>>> On Thu, Feb 24, 2011 at 7:22 PM, Richard Hirsch < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>>> Moving ahead with the last item for the 1.2 release. >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> I'm getting there - I've cleared up most of the issues via >>>>>>>>>> various >>>>>>>>>> >>>>>>>> JavaScript changes. I'll check in the code tomorrow. >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> Now I'm trying to figure out how to make the message >>>>>>>>>> >>>>>>>> contents >>>>>>>>>> deal >>>>>>>>>> >>>>>>>> with the relative paths as well. The problem occurs when >>>>>>>>>> >>>>>>>> tags or >>>>>>>>>> @user >>>>>>>>>> >>>>>>>> URLs are included in messages. >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> The code is in model/Message.scala >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> map(nickname => >>>>>>>>>> >>>>>>>> <xml:group> @<a >>>>>>>>>> >>>>>>>> href={"/user/"+urlEncode(nickname.text)}>{nickname}</a> >>>>>>>>>> </xml:group>). >>>>>>>>>> >>>>>>>> getOrElse(Text("")) >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> case e: Elem if e.label == "tag" => >>>>>>>>>> >>>>>>>> e.attribute("name").map(tag => >>>>>>>>>> >>>>>>>> <xml:group> #<a >>>>>>>>>> >>>>>>>> href={"/tag/"+urlEncode(tag.text)}>{tag}</a> </xml:group>). >>>>>>>>>> >>>>>>>> getOrElse(Text("")) >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> We have the same problem here that the href is not correct >>>>>>>>>> >>>>>>>> when >>>>>>>>>> using Tomcat. >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> I have a javascript method which I call to adjust the path >>>>>>>>>> >>>>>>>> but I >>>>>>>>>> >>>>>>>> haven't been able to get the Scala syntax right. For >>>>>>>>>> >>>>>>>> example, >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> <xml:group> @<a >>>>>>>>>> >>>>>>>> >>>>>>>>>> href={"javascript:pathAdjust('/user/'+urlEncode(nickname.text))"}>{nickname}</a> >>>>>>>>>> >>>>>>>> </xml:group>). >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> Maybe, someone with more Scala experience can show me how >>>>>>>>>> >>>>>>>> this >>>>>>>>>> work. >>>>>>>>>> >>>>>>>> If you want just use the javascript alert method. >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> D. >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>>> On Tue, Feb 22, 2011 at 9:33 AM, Richard Hirsch < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>>>> Yep - try it with IE and create a message with a tag - the >>>>>>>>>> >>>>>>>>> tag >>>>>>>>>> no >>>>>>>>>> >>>>>>>>> longer appears 2x :-> >>>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>> D. >>>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>> On Tue, Feb 22, 2011 at 9:21 AM, Ethan Jewett < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>>>>> This is great Dick. Thanks! Is the new version now >>>>>>>>>> >>>>>>>>>> deployed at >>>>>>>>>> >>>>>>>>>> http://esmecloudserverapache.dickhirsch.staxapps.net/ ? It >>>>>>>>>> looks like >>>>>>>>>> >>>>>>>>>> there is a new deploy up there. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Cheers, >>>>>>>>>> >>>>>>>>>> Ethan >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Mon, Feb 21, 2011 at 9:42 AM, Richard Hirsch < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>>>>>> 295 is finished and the JIRA issue is closed. >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> One more JIRA issue to go.... >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> On Sun, Feb 20, 2011 at 11:21 AM, Richard Hirsch < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>>>>>>> just FYI >>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>> >>>>>>>>>>>> I'm currently working on the last two issues for the 1.2 >>>>>>>>>> release. I've >>>>>>>>>> >>>>>>>>>>>> already solved >>>>>>>>>> https://issues.apache.org/jira/browse/ESME-295 and am >>>>>>>>>> >>>>>>>>>>>> now working on >>>>>>>>>> https://issues.apache.org/jira/browse/ESME-327. >>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>> >>>>>>>>>>>> D. >>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>> >>>>>>>>>> >>>>>>> >>>>>>>>>> >>>>>> >>>>>>>>>> >>>>> >>>>>>>>>> >>>> >>>>>>>>>> >>> >>>>>>>>>> >> >>>>>>>>>> > >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Best Regards, >>>>>>>>> Vladimir Ivanov >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Best Regards, >>>>>>>> Vladimir Ivanov >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Best Regards, >>>>>>> Vladimir Ivanov >>>>>>> >>>>>> >>>>> >>>> >>> >> >
