How to access design dialog parameters in sightly html (AEM 6.1) - aem

I have defined few parameters in the design dialog of a component. Can somebody please let me know how can i get those parameters in sightly html? In JSP we used to do like below, but how can we do the same thing in the sightly?
int startLevel = currentStyle.get("link", 3);

The same thing (well, nearly the same) would work in sightly. You can see the objects which are available in every sightly file here: https://docs.adobe.com/docs/en/aem/6-1/develop/sightly/global-objects.html
One of them is the same currentStyle object available to JSPs.
${currentStyle.link}

Related

Sightly - accessing jcr:content values

From a components JavaScript, how do I access values inside jcr:content for the containing page?
I was expecting pageProperties to help but it seems not ... It gives me "title" but other things (custom values for the page, for example) it doesn't work?
Take a look at https://docs.adobe.com/docs/en/cq/5-6-1/developing/sightly/use-api-in-javascript.html
There are various examples on how to read content with JS in CQ 5.6.1.
If it still doesn't work, you might want to post your code snippet so we can better help you find the problem.

where does "request" come from in CQ5?

I am new to CQ5.
While I was trying to follow the official guide of how to create a website at
[https://docs.adobe.com/docs/en/cq/5-6-1/howto/website.html], the following code confused me.
Iterator<Page> children = rootPage.listChildren(new PageFilter(request));
I did not find any reference of "request". Can someone tell me where it comes from?
Thanks in advance.
Well request is an instance of the HttpServletRequest that is available implicitly in any JSP file. (Full list here).
Hence you can use them directly without explicitly declaring them.
In AEM (CQ5), apart from the JSP implicit objects, you can get quick access to few AEM, Sling and JCR specific objects by including the global.jsp file in your JSP as shown below.
<%#include file="/libs/foundation/global.jsp"%>
This entire list of objects and tag libraries that would be available through your global.jsp can be found here.

Adding attributes to cq5 form using FormsHelper

I'm trying to add an attribute to the form tag of a cq5 form. I noticed that the output is generated using
FormsHelper.startForm(slingRequest, new JspSlingHttpServletResponseWrapper(pageContext));
I was curious how I can either:
alter the request so that the formHelper prints the form w/ the attributes I need
Hook into the actual print out to include the attributes I need.
Any help or direction would be good.
note:
I've already checkout out the javadoc for formshelper, done some searching via goolgle, and dev.day.com including the dev.day.com doc on developing forms.
thank you
API doesn't allow you to add any attributes to this tag. You can only specify desired CSS classes adding css property to the form component. Of course, you can also create component sling filter and response wrapper to rewrite created form, but it seems to be an overkill. I think better solution is using JS to add attributes client-side.

Applet and JSF Integration - example

Can we implement javascript into applet/swing?If yes how? please give some basic/small example.
You can't "implement" it as in manipulating its components, you can however use JavaScript to dynamically change the <param> tags of the <applet> element, and define the applet to respond to that.

How to extract labels from Symfony forms I18n Extract Task

I am quite aware that the extract task accepts application as a parameter, and thus one can't expect it too look into the forms folder.
However, I referred the link (below) and tried a couple of ways:
1. defining my proxy __() method
2. including the I18n helper in App Configuration
However, both aren't working.
Can anyone tell me how to extract these from the form classes?
Thanks
http://groups.google.com/group/symfony-devs/browse_thread/thread/1d034f5f7367fe0c
You need to use the i18n helper and add the translated strings manually to your XML/XLIFF files. The translations themselves work, it's just the i18n:extract task that doesn't look inside form classes so it has to be done manually. I hope they add this feature in Symfony 2.0.
See the first few paragraphs here: http://www.symfony-project.org/forms/1_4/en/08-Internationalisation-and-Localisation
There's a way to extract it altough it's not recommended by the developers:
In lib/i18n/extract/sfI18nApplicationExtract.class.php add:
$this->extractFromPhpFiles(sfConfig::get('sf_lib_dir').'/form');
to function extract()
In your form class's configure method add:
sfLoader::loadHelpers('I18N');
This way you can use the __() function in your form class.
I'm currently testing it. Will share my findings.