How to add question mark popup to Liferay control panel portlet? - popup

I want to add question mark icon and help popup to my custom control panel portlet. How is it possible? Thanks

Are you using normal JSPs? In that case you can just use the <liferay-ui:icon-help/> tag:
<liferay-ui:icon-help message="Help me!"/>
Note: You also need add the following to your JSP before using <liferay-ui:icon-help/>
<%# taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%>
<liferay-theme:defineObjects />

Try adding the help mode for the portlet. In order to add the help mode. In your portlet.xml you should have the following
<init-param>
<name>view-jsp</name>
<value>/view.jsp</value>
</init-param>
<init-param>
<name>help-jsp</name>
<value>/help.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>help</portlet-mode>
</supports>
I am assuming you are having MVCPortlet and you will place the help.jsp inside docroot folder

Related

Customizing AEM dialog - increasing all field's sizes

I have a carousel component for which there is a touch UI dialog naming '''cq:dialog''' .I need to increase size of all the fields of AEM dialog. Can anybody help me with this?
You can extend the aem style sheets by creating a clientLib:
Create a folder on file system. In this folder put a file with name content.xml.
The content of this must be
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
categories="[coralui3]" />
The most important thing is categories=[...]. The name of categoriy must be "coralui3".
During deployment your own css styles will be virtuelly added to your enviroment.
Then put two files into the folder. One file must be named with css.txt. The name for your other one can be named by your own. In example 'myown.css'. Open css.txtand put the name of your css file into it. See also this video on youtube.
If you want to apply your style on all dialog widgets, you style classes must be named like the classes from AEM itself.
In case you want to apply partially, you have create your own css class. Then open your dialogs xmls and add the keyword "granitCss=" to you prefered widget. See also here.

How to use children editor on a list component's dialog on AEM?

I am trying to enable children editor on a list component's dialog to allow users to add custom component into it, like the carousel component from core.
I use AEM 6.5, and the sling:resourceSuperType is list from core.
My .context.xml of the component is as follow:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:isContainer="{Boolean}true"
jcr:primaryType="cq:Component"
jcr:title="List"
sling:resourceSuperType="core/wcm/components/list/v2/list"
componentGroup="MyContent"
teaserDelegate="thisPackage/components/content/teaser/v1/teaser" />
The HTML file of the list component, which is named "list.html" is as follow:
<sly data-sly-use.list="com.thisPackage.aem.dna.core.models.v1.List"
data-sly-use.template="core/wcm/components/commons/v1/templates.html">
<sly data-sly-resource="${resource.path # resourceType='wcm/foundation/components/parsys/newpar', appendPath='/*', decorationTagName='div', cssClassName='new section aem-Grid-newComponent'}"
data-sly-test="${wcmmode.edit || wcmmode.preview}">
</sly>
</sly>
I could open the component's dialog on edit mode. however, if I add new components to the new children editor on dialog and try to close the dialog. I can't close the dialog.
The error message is:
org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session
I followed the example in "github.com/adobe/aem-core-wcm-components/issues/696", and move editConfig from carousel to my list component. But, it didn't solve the issue.
What can I do?
This is not working because the servlet which is responsible for updating data is of resourceType = core/wcm/components/carousel/v1/carousel
You can see in the network call that XHR request is sent to the server which has url like :
http://localhost:4202/content/we-retail/language-masters/en/jcr:content/root/responsivegrid/carousel.container.html
As you can see a selector container is sent and underlaying servlet :
https://github.com/adobe/aem-core-wcm-components/blob/master/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/servlets/ContainerServlet.java
is listening to only core component resource-type.
In your case it is custom component, hence resource type does not match and hence you get the error.
Two things are possible:
1: Quick and easy is to just use sling:resourceSuperType = core/wcm/components/carousel/v1/carousel
Create custom clientlibs same as this:
/apps/core/wcm/components/commons/editor/dialog/childreneditor/v1/childreneditor/clientlibs
but change var POST_SUFFIX = ".container.html"; to your own selector
and then create your own servlet (registered to your own defined selector) same as the core component.
Hope it helps!
This is a bug on AEM 6.5, and the team is working on it.
https://github.com/adobe/aem-core-wcm-components/issues/985

is there any way using gwt canvas in domino-ui other than HTMLCanvasElement

I have a big project using other UI which has a big portion of it using the GWT canvas and if I am thinking to use the domino-ui I prefer to keep the GWT canvas code.
Yes you can.
Either you use elemental2 canvas, Or you use GWT canvas and wrap it as an element.
you need to include this dependency
<dependency>
<groupId>org.jboss.gwt.elemento</groupId>
<artifactId>elemento-widget</artifactId>
<version>${use elemento version here}</version>
</dependency>
Then you can wrap a canvas as element using this
Widgets.asElement(myGwtCanvas)
And don't forget about the inheritance of this GWT module

How to include container into another container dynamically in Hippo CMS, by drag'n'dropping them from catalog toolbar?

I'm using Hippo CMS 10. Through console, in hst:catalog I've created hst:containeritemcomponent with hst:xtype, hst:referencecomponent, hst:iconpath, hst:label.
hst:referencecomponent references to hst:containercomponentfolder at hst:workspace/hst:containers/, which contain hst:containercomponent with hst:xtype set to HST.Span
I need container, that can contain (dynamically) variable amount of another different containers. For example, I want to be able to create this structure by drag'n'dropping components from catalog toolbar:
<!-- this must be main container, already positioned in page -->
<div class="content">
<!-- this should appear when I drag'n'drop component from toolbar -->
<!-- at the same time, it must be container for other components itself -->
<div class="row">...</div>
<!-- this also comes from drag'n'dropped component from toolbar -->
<!-- and also container for other components -->
<div class="home banner">...</div>
<!-- any amount of containers -->
...
...
</div>
By this way, I should be able to create some page structure dynamically. Is it possible? If yes, how can I achieve it? If no, how to bypass it, what's the idea?
HippoCMS's site is very poor for such kind of examples, and there is no information about hippocms except for this site.
I think I know the problem: please have a look at this documentation that explains the configuration:
http://www.onehippo.org/library/concepts/hst-configuration-model/containers-configuration.html
This documentation page explains how to customize the HTML rendered by the containers:
http://www.onehippo.org/library/concepts/template-composer/how-to-prevent-additional-html-elements-for-containers.html
The problems I see:
you are missing an hst:include in your template. Such as for example:
<hst:include ref="mycontainer" />
you've created the hst:containeritemcomponent in the hst:catalog but to be editable containers must also be created in the hst:workspace.
in your HST configuration you must also configure a reference to the container you have in the workspace. Such as this example:
The catalog is a palette of components. The components you see in the toolbar can only be drag&dropped on a template which have containers to handle those components. The xtype defines the kind of container that will handle the component(s) you drag&drop (table, , etc.). So you can do stuff like stacking.
You cannot include a container into another container dynamically.

CQ5 preload a parsys with components

I'm curious if anyone knows how to have a parsys load w/ default components already in it.
What I'd like to accomplish is the following:
Form Component
- form-parsys
- input component
- input component
For the most part this was pretty straight forward. I created a "form" component that has a parsys in it. What I would like is for this form component to load with a few default input components already set. These input components would need to be a part of the form-parsys node, so that they can be reorganized amongst user added input components.
Not sure if there is any documentation out on this as I couldn't find any, but I'm sure it's not entirely impossible and wanted to see if anyone has done anything like this before, before I go ahead and start hacking away.
thank you
Brodie
I think what you are looking for are templates.
In CQ5, templates can be used to create pages with a predefined content, this can be a parsys (with components) or any other node you might want in your page when it is created.
In your case, you can define a template that includes a parsys component and whatever you want inside that parsys. You can also set rules for where a page can be created using that template.
After you have created (or edited, since you might already have one) the template, you can use the siteadmin to create a new page using your template. The page will be created and all the content below the jcr:content of the template will be copied into the new page. You can even have several templates for the same kind of page, if you need different types of 'initial contents'
An example of a template that includes a parsys with some content might look like this (I'm writing this mostly from memory, might have errors):
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:description="A form"
jcr:primaryType="cq:Template"
jcr:title="A form"
allowedChildren="/apps/app1/templates/home_page"
allowedParents="/apps/app1/templates/form_page"
allowedPaths="[/content(/.*)*]"
ranking="{Long}100">
<jcr:content
jcr:primaryType="cq:PageContent"
sling:resourceType="app1/pages/form_page">
<parsys
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/parsys" >
<component
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/text"
text="here is some text"/>
<!-- more components here-->
</parsys>
</jcr:content>
</jcr:root>