Nicolas Malin created OFBIZ-12310: ------------------------------------- Summary: Rendering widget screen from ftl with the current context Key: OFBIZ-12310 URL: https://issues.apache.org/jira/browse/OFBIZ-12310 Project: OFBiz Issue Type: Improvement Components: framework/widget Affects Versions: Trunk Reporter: Nicolas Malin
Currently when you would be rendering a widget screen from a ftl template, you can use a element screen present on context to call the renderer : {code:java} ${screens.render("component://common/widget/CommonScreens.xml#countries")} {code} This rendering is realized with the context present when the object screen has been initialized. To simplify the screen call from freemarker template, I implemented a new macro *ofbizScreen* You can call a Ofbiz screen with the ftl context with simple macro {code:java} <@ofbizScreen>component://mycomponent/widget/MyComponentScreens.xml#MyScreen</@ofbizScreen>{code} You can also write {code:java} <@ofbizScreen location="component://mycomponent/widget/MyComponentScreens.xml" name="MyScreen"/>{code} Or set a default location on your context action : {code:java} context.defaultTemplateLocation = "component://mycomponent/widget/MyComponentScreens.xml"{code} widget : {code:java} <@ofbizScreen>MyScreen</@ofbizScreen>{code} When the screen would be call, the context to rendering the screen would be use the current context: {code:java} <#list contactMechs as contactMech> <#assign contactMechId = contactMech.contachMechId/> <@ofbizScreen>component://mycomponent/widget/MyComponentScreens.xml#DisplayContactMech</@ofbizScreen> </#list> {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)