[Lift] Re: Set a XML-Stylesheet in place
Hi David, thank you very much for the response, it worked. Regards, Gonzalo N On Jul 14, 1:56 pm, David Pollak wrote: > If you add the following to during the response cycle that contains the > MathML stuff, you'll get the correct headers: > > S.setDocType(Full(""" href="../classpath/css/mathml.xsl"?> > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>""")) > > It should work the way you want it to. > > > > On Mon, Jul 13, 2009 at 5:37 PM, Gonzalo N wrote: > > > Hello. > > I am using MathML to present some mathematical formulas in my page, > > but in order to do some of the mathematical render, I need to add in > > the top of the page this code: > > > > > > http://www.w3.org/ > > TR/xhtml11/DTD/xhtml11.dtd<http://www.w3.org/%0ATR/xhtml11/DTD/xhtml11.dtd> > > "> > > http://www.w3.org/1999/xhtml"; xmlns:lift="http:// > > liftweb.net/" xml:lang="en"> > > > > > > > When I am in the browser and see the source code of the page, it > > appears all the previous heading, except the xml-stylesheet tag, > > probably because I didn't defined it in the boot. > > Does anyone knows where and how do I set the in the > > Boot.scala class? > > > Thank you. > > > Regards, > > Gonzalo N > > -- > 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] Set a XML-Stylesheet in place
Hello. I am using MathML to present some mathematical formulas in my page, but in order to do some of the mathematical render, I need to add in the top of the page this code: http://www.w3.org/ TR/xhtml11/DTD/xhtml11.dtd"> http://www.w3.org/1999/xhtml"; xmlns:lift="http:// liftweb.net/" xml:lang="en"> When I am in the browser and see the source code of the page, it appears all the previous heading, except the xml-stylesheet tag, probably because I didn't defined it in the boot. Does anyone knows where and how do I set the in the Boot.scala class? Thank you. Regards, Gonzalo N --~--~-~--~~~---~--~~ 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: Using AJAX calls in Lift Snippets
Hi. Probably I didn't explain well and I am sorry for that. I've created a simple form in Lift processed via a snippet that contains 3 form attributes: function_definition(a textarea), buttonFunDef(ajaxButton) and save(submit) In the HTML file I made the call to those attributes of the snippet, in which one of those attributes is an ajaxButton that runs a JavaScript function. This button, when pressed will call the JavaScript function to add in the HTML the other attribute of the snippet (more precisely the function_definition textarea). It sends the POST into the server, but when the page reloads it doesn't appear the snippet attribute and I wanted to know why. Best regards, Gonzalo N On Jul 6, 3:56 pm, "marius d." wrote: > On Jul 6, 5:44 pm, Gonzalo N wrote: > > > > > Hello! > > > I am having a problem with a javascript function that creates a new > > textarea from a snippet. I am using the Lift 1.0-SNAPSHOT version and > > the Scala version 2.7.4. > > Basically, what I am doing is creating a ajaxButton in a snippet, that > > calls a JavaScript function to create new textareas, like this: > > Snippet -> Submit.scala > > class Submit { > > def createDescription (xhtml : NodeSeq) : NodeSeq = { > > > > def accept () = { > > . > > } > > > > bind("createDescription", xhtml, > > "function_definition" -> SHtml.textarea("", > > function_definition = _, ("id", "functionDefinitionArea"), ("rows", > > "6"), ("cols", "60"), ("maxlength", "1")), > > "buttonFunDef" -> SHtml.ajaxButton(Text("Add > > Function Definition"), JE.Call("AddFunctionDefinition"), () => {println > > ("pressed"); JsCmds.Noop}), > > "save" -> SHtml.submit("Submit", accept)) > > } > > > } > > > Then in the javascript file, I have the function > > AddFunctionDefinition.js that : > > function AddFunctionDefinition() { > > var container = document.getElementById('function_def'); > > var new_FD = document.createElement('li'); > > > new_FD.innerHTML = "" > > container.insertBefore(new_FD, container.firstChild); > > > } > > I'm a bit confused .. from a JS function you're trying to call a > snippet? ... Snippets are processed > on server side (in Lift rendering pipeine) not on client side. > > > > > Finally, in the html file, I call the Submit snippet and then creates > > the button: > > > > > > Functions: > > > > > > > > > > > > > > > > > > > This button will call the JavaScript AddFunctionDefinition function to > > insert in the "id = function_def" the > > , but it doesn't happen! Does > > anyone know why? > > > I've tried another alternative, I changed, in the JavaScript, the > > innerHTML to directly create a new textarea: > > new_FD.innerHTML = "Function Definition: > h3> > > > cols='120' maxlength='5' />"; > > > This alternative will render the new textarea! But then I don't know > > how to get the data inserted in the textarea inside the snippet, more > > precisely in the "accept" function of Submit snippet, because when I > > press the submit button, it will send all data to the "accept" > > function. > > Some help and/or hints, would be very much appreciated. > > > Regards, > > Gonzalo N --~--~-~--~~~---~--~~ 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] Using AJAX calls in Lift Snippets
Hello! I am having a problem with a javascript function that creates a new textarea from a snippet. I am using the Lift 1.0-SNAPSHOT version and the Scala version 2.7.4. Basically, what I am doing is creating a ajaxButton in a snippet, that calls a JavaScript function to create new textareas, like this: Snippet -> Submit.scala class Submit { def createDescription (xhtml : NodeSeq) : NodeSeq = { def accept () = { . } bind("createDescription", xhtml, "function_definition" -> SHtml.textarea("", function_definition = _, ("id", "functionDefinitionArea"), ("rows", "6"), ("cols", "60"), ("maxlength", "1")), "buttonFunDef" -> SHtml.ajaxButton(Text("Add Function Definition"), JE.Call("AddFunctionDefinition"), () => {println ("pressed"); JsCmds.Noop}), "save" -> SHtml.submit("Submit", accept)) } } Then in the javascript file, I have the function AddFunctionDefinition.js that : function AddFunctionDefinition() { var container = document.getElementById('function_def'); var new_FD = document.createElement('li'); new_FD.innerHTML = "" container.insertBefore(new_FD, container.firstChild); } Finally, in the html file, I call the Submit snippet and then creates the button: Functions: This button will call the JavaScript AddFunctionDefinition function to insert in the "id = function_def" the , but it doesn't happen! Does anyone know why? I've tried another alternative, I changed, in the JavaScript, the innerHTML to directly create a new textarea: new_FD.innerHTML = "Function Definition: "; This alternative will render the new textarea! But then I don't know how to get the data inserted in the textarea inside the snippet, more precisely in the "accept" function of Submit snippet, because when I press the submit button, it will send all data to the "accept" function. Some help and/or hints, would be very much appreciated. Regards, Gonzalo N --~--~-~--~~~---~--~~ 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: Problems with the MenuWidget
After using firebug and putting the URI "localhost:8080/classpath/menu/ superfish.js",as weel as the css and the jquery.hoverintent, all are being seen by the browser and in the terminal shell it doesn't return errors when reading/locating those files. In the pom I added the dependency: net.liftweb lift-widgets 1.1-M1 I've putted the version 1.1-M1, because it was the last I've search in the lift repo. Do you think I should change to another version? And also added the snapshot repository: scala-tools.org Scala-Tools Maven2 Repository http://scala-tools.org/repo-releases scala-tools.org.snapshots Scala Tools Maven2 Repository http://scala-tools.org/repo-snapshots Actually, I cannot see what am I doing wrong, that was why I was asking if there was a "step-by-step" tutorial to the menu widget only. In the Lift-book group, I've read the Exploring Lift tutorial and in the widgets section, there is no reference to this widget. Many thanks, GonzaloN On May 20, 7:24 pm, "marius d." wrote: > It looks like the CSS and potentially the JSdependecies are not seen > by the browser ... > > From your page rendered take the URI for the superfish CSS and JS and > put it in your browser and see if they are seen. Also firebug should > yell if the CSS/JS is can not be loaded > > I assume that lift-widgets is in your app pom :) (dumb question ...) > > Br's, > Marius > > On May 20, 8:58 pm, Gonzalo N wrote: > > > Thanks for the quick response. > > Yes, I've initialised the widget in the boot with Widget init > > > ** In boot.scala: * > > package bootstrap.liftweb > > > import _root_.net.liftweb.util._ > > import _root_.net.liftweb.http._ > > import _root_.net.liftweb.sitemap._ > > import _root_.net.liftweb.sitemap.Loc._ > > import Helpers._ > > import _root_.net.liftweb.widgets.menu.MenuWidget > > > object MenuInfo { > > import Loc._ > > > def menu: List[Menu] = Menu(Loc("Home", List("index"), "Home"), > > Menu(Loc("overview", List("overview"), > > "Overview")), > > Menu(Loc("documentation", List > > ("documentation"), "Documentation")), > > Menu(Loc("investigators", List > > ("investigators"), "Investigators"))) :: > > Menu(Loc("models", List("models","index"), "Models"), > > Menu(Loc("createM", List("models","create"), "Create > > Model")) :: > > Nil > > > } > > > class Boot { > > > def boot { > > // where to search snippet > > LiftRules.addToPackages("pt.cnbc.wikimodels") > > > // Build SiteMap > > LiftRules.setSiteMap(SiteMap(MenuInfo.menu:_*)) > > > MenuWidget init; > > } > > > } > > > ** In a snippet --> MenuSnippet.scala: *** > > package pt.cnbc.wikimodels.snippet > > > import _root_.scala.xml.NodeSeq > > import _root_.net.liftweb.widgets.menu._ > > > class MenuSnippet { > > > def render(xhtml: NodeSeq) :NodeSeq = { > > MenuWidget() > > } > > > } > > > * in "templates-hidden/default.html": * > > > > > > ... > > > > > > > > > > > > > > > > > > > > > It's basically equal with the example, just adapted to "/src/main" > > instead of "src/test" > > Do you think it's probably any error in my pom? Or with the reference > > in the css and js files (I've putted them in the path "/src/main/ > > webapp/classpath" and "../classpath/menu", or should I put them in the > > "../main/resources/toserve/menu" and reference them in the pom.xml)? > > Hope you understand. > > > Thanks, > > GonzaloN > > > On May 20, 6:26 pm, "marius d." wrote: > > > > Could you please post your code ? ... Are you initializing the widget > > > in your boot ? > > > > Br's, > > > Marius > > > > On May 20, 7:52 pm, Gonzalo N wrote: > > > > > Hi, > > > > > I've recently started using Lift in a project and probably my > > > > difficulty is basic, but I've tried the Widgets that are upload
[Lift] Re: Problems with the MenuWidget
Thanks for the quick response. Yes, I've initialised the widget in the boot with Widget init ** In boot.scala: * package bootstrap.liftweb import _root_.net.liftweb.util._ import _root_.net.liftweb.http._ import _root_.net.liftweb.sitemap._ import _root_.net.liftweb.sitemap.Loc._ import Helpers._ import _root_.net.liftweb.widgets.menu.MenuWidget object MenuInfo { import Loc._ def menu: List[Menu] = Menu(Loc("Home", List("index"), "Home"), Menu(Loc("overview", List("overview"), "Overview")), Menu(Loc("documentation", List ("documentation"), "Documentation")), Menu(Loc("investigators", List ("investigators"), "Investigators"))) :: Menu(Loc("models", List("models","index"), "Models"), Menu(Loc("createM", List("models","create"), "Create Model")) :: Nil } class Boot { def boot { // where to search snippet LiftRules.addToPackages("pt.cnbc.wikimodels") // Build SiteMap LiftRules.setSiteMap(SiteMap(MenuInfo.menu:_*)) MenuWidget init; } } ** In a snippet --> MenuSnippet.scala: *** package pt.cnbc.wikimodels.snippet import _root_.scala.xml.NodeSeq import _root_.net.liftweb.widgets.menu._ class MenuSnippet { def render(xhtml: NodeSeq) :NodeSeq = { MenuWidget() } } * in "templates-hidden/default.html": * ... It's basically equal with the example, just adapted to "/src/main" instead of "src/test" Do you think it's probably any error in my pom? Or with the reference in the css and js files (I've putted them in the path "/src/main/ webapp/classpath" and "../classpath/menu", or should I put them in the "../main/resources/toserve/menu" and reference them in the pom.xml)? Hope you understand. Thanks, GonzaloN On May 20, 6:26 pm, "marius d." wrote: > Could you please post your code ? ... Are you initializing the widget > in your boot ? > > Br's, > Marius > > On May 20, 7:52 pm, Gonzalo N wrote: > > > Hi, > > > I've recently started using Lift in a project and probably my > > difficulty is basic, but I've tried the Widgets that are uploaded in > > the github web page. When I run the example, it all worked fine, the > > menu did have the drop-down sub-menus, but when I integrate the code > > of the menu (to be more specific, I want to integrate the MenuWidget) > > to my project, it doesn't work like in the widgets example, ie it > > prints as a list of links with bullet-marks, like the basic menu style > > and I've changed the Boot.scala, added the snippet MenuSnippet.scala, > > added the "callback" in the default.html, added the respective css and > > js files in the respective folders and added the dependency: > > > > net.liftweb > > lift-widgets > > 1.1-SNAPSHOT > > > > , but still nothing. > > > I've noticed that the example is run under the "/src/test/" > > path and it is referenced in the pom.xml file, but in my project I > > wanted it to run in the "/src/main" path, so I didn't add > > that reference in my pom.xml. > > If possible, I really would like that someone could explain a working > > "step-by-step" of how to integrate the menu widget to a project in the > > "/src/main" path. > > > Sorry if this topic was already explained in another post, but I > > didn't found the solution after a search. The only thing I've found, > > was a brief reference to this problem, and I've done what was > > suggested, but it didn't worked. The > > link:http://groups.google.com/group/liftweb/browse_thread/thread/33b6f9f5e... > > > Thanks in advance for the help. > > > Cheers, > > GonzaloN --~--~-~--~~~---~--~~ 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] Problems with the MenuWidget
Hi, I've recently started using Lift in a project and probably my difficulty is basic, but I've tried the Widgets that are uploaded in the github web page. When I run the example, it all worked fine, the menu did have the drop-down sub-menus, but when I integrate the code of the menu (to be more specific, I want to integrate the MenuWidget) to my project, it doesn't work like in the widgets example, ie it prints as a list of links with bullet-marks, like the basic menu style and I've changed the Boot.scala, added the snippet MenuSnippet.scala, added the "callback" in the default.html, added the respective css and js files in the respective folders and added the dependency: net.liftweb lift-widgets 1.1-SNAPSHOT , but still nothing. I've noticed that the example is run under the "/src/test/" path and it is referenced in the pom.xml file, but in my project I wanted it to run in the "/src/main" path, so I didn't add that reference in my pom.xml. If possible, I really would like that someone could explain a working "step-by-step" of how to integrate the menu widget to a project in the "/src/main" path. Sorry if this topic was already explained in another post, but I didn't found the solution after a search. The only thing I've found, was a brief reference to this problem, and I've done what was suggested, but it didn't worked. The link: http://groups.google.com/group/liftweb/browse_thread/thread/33b6f9f5e6519d8d/7bec6e15c4ed95a7?hl=en&lnk=gst&q=dropdown#7bec6e15c4ed95a7 Thanks in advance for the help. Cheers, GonzaloN --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---