liferay-ui:tabs not changing active - liferay-6

I'm having troubles with liferay-ui:tabs
I need to set an active tab depending on what link was previously clicked. I get this information though an String
String selectedTab = ParamUtil.getString(request, "valA", "generalSettings");
Then I create the tabs:
<liferay-ui:tabs
names="A,B,C,D,E"
tabsValues="valA,valB,valC,valD,valE" refresh="false"
value="<%=selectedTab%>" url="<%=tabURL.toString()%>" param="tab">
<liferay-ui:section>
<%# include file="a.jsp"%>
</liferay-ui:section>
<liferay-ui:section>
<%# include file="b.jsp"%>
</liferay-ui:section>
<liferay-ui:section>
<%# include file="c.jsp"%>
</liferay-ui:section>
<liferay-ui:section>
<%# include file="d.jsp"%>
</liferay-ui:section>
<liferay-ui:section>
<%# include file="c.jsp"%>
</liferay-ui:section>
The problem is that if use value parameter I this tab remains actived all the time although when I click other tabs I see the other imports.
Any idea?

I'll try to give you some hints here. I think you have a two typos.
Your parameter is called tab, not selectedTab (as defined in param attribute),
your allowed tab values (defined in tabsValues attribute) are: valA, valB etc.; generalSettings is not there.
Try this line:
String selectedTab = ParamUtil.getString(request, "tab", "valA");
If you just want the first tab to be selected it should be enough to remove value attribute of <liferay-ui:tabs> altogether. Check tabs implementation- when value is null it'll read parameter tab from request itself and select first tab by default when no value is provided.
With refresh set to false however you shouldn't get no page refresh that means selectedTab will not be initialized with every click on the tab. That's because all sections are pre-rendered on the page and only Liferay.Portal.Tabs.show is called to show the clicked one and hide the others.

I have found the answer by creating a RenderURL and to bind it to the url parameter. The only problem that I have now is that every time I change names and tabValues if they are distinct it doesn't show the section content.

Related

TinyMCE 5: Always add a class to blockquote element when inserting it (by clicking on the "blockquote" button on toolbar)

When user clicks on "blockquote" button (that is on toolbar) to insert blockquote element:
then TinyMCE will insert <blockquote> HTML element without any class. I want to change this so that it always inserts <blockquote> with class myClass (but only when blockquote is inserted by clicking on "toolbar" button, not when loaded):
<blockquote class="myClass">
...
</p>
</blockquote>
Do you know how this can be done/achieved?
I'm using TinyMCE 5.
Fiddle: http://fiddle.tinymce.com/Guhaab
UPDATE:
Sorry, my question wasn't precise enough: I want this class to be added just for elements added via the button, not when loaded.
Updated Answer:
The querent added:
I want this class to be added just for elements added via the button, not when loaded.
In that case:
Blockquotes are added to content by applying a predefined, default format called (you guessed it) "blockquote". You can override that default style to include a class when it is applied to content:
formats: {
// Changes the default format for blockquote to have a class of 'foo'
blockquote: { block: 'blockquote', classes: 'foo' }
},
Here is a Tiny Fiddle demonstration:
http://fiddle.tinymce.com/svhaab/1
Here's information about formats in TinyMCE:
https://www.tiny.cloud/docs/configure/content-formatting/
Original Answer:
One option would be to use a node filter to add this class to all <blockquote> elements:
https://www.tiny.cloud/docs/api/tinymce.dom/tinymce.dom.serializer/#addnodefilter
https://www.tiny.cloud/docs/api/tinymce.html/tinymce.html.domparser/#addnodefilter
Here is a Tiny Fiddle example:
http://fiddle.tinymce.com/hvhaab/1
(ETA correct Fiddle link)
Note: As seen in the Fiddle, this approach will also add the class to <blockquote> elements that are loaded or pasted in to the editor as existing content - not just <blockquote> elements added via the button.
Also, if a <blockquote> element already has a (different) class, this will add your custom class to the attribute.

TYPO3 hide content element options in wizard

I want to show only the column options from the grid elements tab to the editors group when they create a new content element. So I tried to edit the groups TSconfig.
tx_gridelements.setup.tabs4 >
tx_gridelements.setup.tabs6 >
This has no effect. How do I remove all but the column options?
Update: With your help I figured out that my problem is not about the text in the TSconfig but that it is not loaded from the backend user group nor the beuser.
The elements you want to disable are located in Page TSconfig under mod.wizards.newContentElement.wizardItems. You can see them in the "Info" module under "Page TSconfig" :
You can simply disable them by adding
# example for the given screenshot
mod.wizards.newContentElement.wizardItems.common.elements.header >
I don't think that the answer from #statix will work with grid elements.
But in the settings of your backend layout, you can define what type of content elements are allowed within a specific content area:
And within the settings of each grid element you can define again, which content elements are available, e.g. to prevent nesting of grid elements.
Put this code in root page tscPage TSConfig
tx_gridelements.excludeLayoutIds=your grid id
May It helps you!!

sap.uxap.ObjectPageLayout: How to set default section page on load?

I am using the sap.uxap.ObjectPageLayout with a bunch of ObjectPageSections. I would like to have the first section being displayed whenever I open the view containing the ObjectPageLayout. I have seen that there is association selectedSection but it needs a value of type sap.uxap.ObjectPageSection. Settings the ID of the first section does not help. So what am I supposed to enter there?
I guess you'll need to set it when you enter the route again of your ObjectPageLayout. Then this.byId("objectPageLayout").setSelectedSection(this.byId("sectionId")) should work.
You can pass the ID of the section in the XMLView as well, despite the API reference saying that the association awaits an object of type sap.uxap.ObjectPageSection.
<uxap:ObjectPageLayout selectedSection="firstSection">
<uxap:ObjectPageSection id="firstSection">
selectedSection: The section that is selected by default on load.

In CQ How to disable any field in child page properties dialog?

I have added a new selection type field "Theme" in page properties>Basic.
Now if I add a new page using the same template in WCM, there also I
am getting the option "Theme", which is quite obvious.
Is there any way by which I can hide the field in child page?
P.S this is happening because I am using the same template for the child page.
You can't use the same template and have the page property dialogs be different.
What you can do is overload the dialog
create a new template and corresponding resourceType component that
inherit from your current.
copy the dialog, or tab that you want to be different from the lowest parent of the component. Make sure the dialog is the only node under the component.
Make the changes you want to the dialog.
You would then have to include code in the page jsp to get the parent page property something like:
// if the parent page is always a certain level below the root you can use
// currentPage.getAbsoluteParent(3); to get the third page down from the top
// of the current path tree.
Page parentPage = currentPage.getParent();
ValueMap parentPageProperties;
if (parentPage != null) {
parentPageProperties = parentPage.getProperties();
}
// This tries to get the property 'theme' from the current page. If that fails
// then it tries to get the property from the parent page. If that fails it
// defaults to blank.
theme = properties.get("theme", parentPageProperties.get("theme", ""));
A quick solution would also be to create a second set of template / page component. Let's assume you've got template A, that uses page component B as resource type:
Create template X and play with allowedParents allowedChildren and allowedPaths properties so that the two are exclusive (actual solution depends on your content architecture)
Give X same title as A
Create page component Y that extends B, and defines it's own dialog
Make Y's dialog re-use any tabs from B using xtype=cqinclude (see foundation page's dialog for reference)

Setting the header of a content element to the page title

I have some subpages where there is a single content element with a header in HTML H1.
How can I set the header of this content element to the page's title?
We used a typoscript marker for that. Just define it in your page template and then fill it with the title like this:
PAGE-TITLE = TEXT
PAGE-TITLE.field = nav_title // subtitle // title
Instead of relying on Content Element (CE) (which de facto may exist OR not AND can have any header set OR not) it's better to... use Michael's suggestion and on the selected branch use the modified template, and place ###PAGE-TITLE### marker just before the marker where you are rendering-in your ContentElements.
In that case you don't need to modify the way that your <title> tag is created and you have sure that title always exists and you can be sure that there's always some title.
Of course you'll need to set the default header of the first CE as hidden (or leave it empty), however you can do it for whole branch with PageTS.