[Lift] Re: [urgent bug] javascript escaping issue!!

2009-04-30 Thread Alexander Kellett

btw this is completely okay (no idea about valid) in a onclick for
example, just not in a script block.

On Thu, Apr 30, 2009 at 12:26 PM, Timothy Perrett
timo...@getintheloop.eu wrote:

 Guys,

 Maven just pulled the latest jars from hudson and ooops, now my
 project is broken! lol.

 The changes to the string helpers etc to move to double quotes not
 single quotes has broken my entire application which is due to go out
 tomorrow. For instance:

 {'useJSToGetCustomizationValues': 'false', . }

 has now become

 {quot;useJSToGetCustomizationValuesquot;: quot;falsequot;  }

 The latter is obviously totally invalid and just doesn't work - can we
 fix this ASAP please otherwise im going to get seriously bitch slapped
 by my boss ;-)

 Cheers, Tim
 


--~--~-~--~~~---~--~~
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: [urgent bug] javascript escaping issue!!

2009-04-30 Thread Timothy Perrett

David,

Thanks for your reply - so what your saying is that if I wrap it in a
CDATA block then issues will go away?

Thanks, Tim

On Apr 30, 1:02 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Thu, Apr 30, 2009 at 3:26 AM, Timothy Perrett 
 timo...@getintheloop.euwrote:



  Guys,

  Maven just pulled the latest jars from hudson and ooops, now my
  project is broken! lol.

  The changes to the string helpers etc to move to double quotes not
  single quotes has broken my entire application which is due to go out
  tomorrow. For instance:

  {'useJSToGetCustomizationValues': 'false', . }

  has now become

  {quot;useJSToGetCustomizationValuesquot;: quot;falsequot;  }

 This indicates a bug in your program (I'm not trying to be a jerk here).
 All JavaScript/JSON stuff should be in CDATA blocks.  Even with reverted
 code, you'll see a defect in your program if you have a , , , or  in any
 of the strings you pass as JSON.

 I'll revert the code (although it breaks another project), but it will
 change back to the double-quoted version after M1 is released on Friday.

 Thanks,

 David



  The latter is obviously totally invalid and just doesn't work - can we
  fix this ASAP please otherwise im going to get seriously bitch slapped
  by my boss ;-)

  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] Re: [urgent bug] javascript escaping issue!!

2009-04-30 Thread Timothy Perrett

Yeah of course - im already familiar with the Script object. My code
looks like:

  def show(xhtml: NodeSeq): NodeSeq = bind(uedit, xhtml,
application - Script(Run(script))
  )

And the rendered html looks like:

script type=text/javascript
// ![CDATA[

swfobject.embedSWF(
  '/classpath/uedit/uedit.swf',
  'ueditapp',
  '800',
  '500',
  '9.0.0',
  '/classpath/uedit/expressinstall.swf',
  {quot;useJSToGetCustomizationValuesquot;: quot;falsequot;,
quot;zoomquot;: quot;fitquot;, quot;scrollBarsquot;:
quot;bothquot; }, {}, {});
// ]]
/script

As you can see, the script items are still in place, yet its not
working correctly.

Thoughts?

Cheers, Tim

 Your code should look something like:

 import net.liftweb.http.js.JsCmds._

 span
 This is some stuff on my page
 {
 Script(myScriptWhichIsAJsCmd)}

 /span


--~--~-~--~~~---~--~~
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: [urgent bug] javascript escaping issue!!

2009-04-30 Thread David Pollak
On Thu, Apr 30, 2009 at 5:44 AM, Timothy Perrett timo...@getintheloop.euwrote:


 Yeah of course - im already familiar with the Script object. My code
 looks like:

  def show(xhtml: NodeSeq): NodeSeq = bind(uedit, xhtml,
application - Script(Run(script))
  )


script is a String.  How is it built?




 And the rendered html looks like:

 script type=text/javascript
 // ![CDATA[

swfobject.embedSWF(
  '/classpath/uedit/uedit.swf',
  'ueditapp',
  '800',
  '500',
  '9.0.0',
  '/classpath/uedit/expressinstall.swf',
  {quot;useJSToGetCustomizationValuesquot;: quot;falsequot;,
 quot;zoomquot;: quot;fitquot;, quot;scrollBarsquot;:
 quot;bothquot; }, {}, {});
 // ]]
 /script

 As you can see, the script items are still in place, yet its not
 working correctly.

 Thoughts?

 Cheers, Tim

  Your code should look something like:
 
  import net.liftweb.http.js.JsCmds._
 
  span
  This is some stuff on my page
  {
  Script(myScriptWhichIsAJsCmd)}
 
  /span


 



-- 
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: [urgent bug] javascript escaping issue!!

2009-04-30 Thread Timothy Perrett

The items with ‘item’ single quotes are just concatenated strings as
they are fixed paths etc. Its not those which are causing the problem
– its the serialization of JsObj that appears to be the issue here. If
you remember some time ago I was asking about JsObj and Map
[String,String], anyway I ended up having a toJs method on the object
containing that map. Said method looks like this:

def toJs: JsObj = JsObj((for((key, value) - is) yield (key, Str
(value))).toList : _*)

Its that which is outputing:

{quot;useJSToGetCustomizationValuesquot;: quot;falsequot;,
quot;zoomquot;: quot;fitquot;, quot;scrollBarsquot;:
quot;bothquot; }

Does that help?

Cheers, Tim
--~--~-~--~~~---~--~~
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: [urgent bug] javascript escaping issue!!

2009-04-30 Thread Timothy Perrett


The items with Œitem¹ single quotes are just concatenated strings as they
are fixed paths etc. Its not those which are causing the problem ­ its the
serialization of JsObj that appears to be the issue here. If you remember
some time ago I was asking about JsObj and Map[String,String], anyway I
ended up having a toJs method on the object containing that map. Said method
looks like this:

def toJs: JsObj = JsObj((for((key, value) - is) yield (key,
Str(value))).toList : _*)

Its that which is outputing:

{quot;useJSToGetCustomizationValuesquot;: quot;falsequot;,
quot;zoomquot;: quot;fitquot;, quot;scrollBarsquot;:
quot;bothquot; }

Does that help?

Cheers, Tim

On 30/04/2009 13:47, David Pollak feeder.of.the.be...@gmail.com wrote:

 script is a String.  How is it built?



--~--~-~--~~~---~--~~
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: [urgent bug] javascript escaping issue!!

2009-04-30 Thread David Pollak
On Thu, Apr 30, 2009 at 6:13 AM, Timothy Perrett timo...@getintheloop.euwrote:


 The items with ‘item’ single quotes are just concatenated strings as
 they are fixed paths etc. Its not those which are causing the problem
 – its the serialization of JsObj that appears to be the issue here. If
 you remember some time ago I was asking about JsObj and Map
 [String,String], anyway I ended up having a toJs method on the object
 containing that map. Said method looks like this:

 def toJs: JsObj = JsObj((for((key, value) - is) yield (key, Str
 (value))).toList : _*)

 Its that which is outputing:

 {quot;useJSToGetCustomizationValuesquot;: quot;falsequot;,
 quot;zoomquot;: quot;fitquot;, quot;scrollBarsquot;:
 quot;bothquot; }


Are you doing a toJsCmd on the JsObj that you're creating or a toString?





 Does that help?

 Cheers, Tim
 



-- 
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: [urgent bug] javascript escaping issue!!

2009-04-30 Thread Timothy Perrett

The latter, its a toString

 Are you doing a toJsCmd on the JsObj that you're creating or a toString?

--~--~-~--~~~---~--~~
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: [urgent bug] javascript escaping issue!!

2009-04-30 Thread David Pollak
On Thu, Apr 30, 2009 at 6:44 AM, Timothy Perrett timo...@getintheloop.euwrote:


 The latter, its a toString


That's the problem.  JsExp (JsObj is a JsExp) are NodeSeq as well (this is
to support the ability to render XML literals and JavaScript into
client-side node building).  toString on a JsExp results in the XML-encoded
String.  In order to get the JavaScript executable string, you must do a
toJsCmd.

Thanks,

David




  Are you doing a toJsCmd on the JsObj that you're creating or a
 toString?

 



-- 
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
-~--~~~~--~~--~--~---