How to add checkbox to hybris - sap-commerce-cloud

it might be simple question but I cannot do it for 6 hours.
I want to add checkbox to Backoffice > Catalog > Products Properties tab.
My question are
how to add checkbox
If it should be written into jsp file where to look for that file.
what file to write functionality of the checkbox

You need to add it in backoffice-config.xml files. You need to override properties tab and add your model attribute here. If your attribute type is boolean, zk framework automatically appear checkbox for this attribute. If it is in another type you need to add custom editor for this attribute.
For example below example ovveride tab.
<context type="Customer" merge-by="type" component="editor-area">
<editorArea:editorArea>
<editorArea:tab name="hmc.tab.common" position="1">
<editorArea:section name="hmc.properties">
<editorArea:attribute qualifier="myAttribute" />
</editorArea:section>
</editorArea:tab>
</editorArea:editorArea>
</context>
You can also view new attributes in Addmistration tab unbound section by default.

Related

How can I readonly attribute in Backoffice config.xml dynamic

I want to set/unset readonly attribute of certain field in backoffice editor area based upon the property that is defined in local.properties.
I tried doing following:
<editorArea:attribute qualifier="xyz" readonly="spring.getBean('configurationService').getConfiguration().getBoolean('make.me.readonly')"/>
but there was schema validation error and also it didn't change the field attribute.
First you need to register "configurationService" so that it could be used in config.xml.
By default only the services mentioned in,
platformbackoffice.available.bean.names.for.spel=labelService,enumerationService,exceptionTranslationService,backofficeTypeUtils can be used within config.xml.
To include "configurationService" add the below piece of code to your backoffice-spring.xml.
<cng:list-extender bean="fixedBeanResolver" property="availableBeanNames">
<cng:add value-type="java.lang.String">
<value>configurationService</value>
</cng:add>
</cng:list-extender>
And then make the service call from config.xml,
<editorArea:attribute qualifier="xyz" readonly="#configurationService.getConfiguration().getBoolean('make.me.readonly')"/>

What is that complex property "All properties > data > properties" good for?

This is just out of curiosity: looking for some other type of property inside an xpage I stumbled upon "All properties > data > properties". This is a complex prop, multiple parameter elements can be added in sets of name > value pairs.
I tried to add a sample parameter here resulting in
<xp:this.properties>
<xp:parameter
name="param"
value="val">
</xp:parameter>
</xp:this.properties>
Rendering that page in a browser shows no changes at all, neither in the page's html source nor somewhere in the http headers, DOM trees etc.
Can anyone shed a light what this property set could be used for?
The xp:view this.properties accepts xsp.properties options like the Xsp Properties editor in an application in Domino Designer, and like the options in the file C:\Domino\data\properties\xsp.properties.sample
For example:
<xp:this.properties>
<xp:parameter name="xsp.client.validation" value="false"></xp:parameter>
</xp:this.properties>
will disable client-side validation for the current XPage, so that only server-side validation occurs.
Some options will be ignored when set in the xp:view on an XPage, e.g.
xsp.theme=oneuiv3.0.2
can only be set in the application xsp.properties or in the server-wide xsp.properties, and will be ignored if it is set in the per-XPage xp:view this.properties.

How to modify attributes of Active directory which are not listed in attribute editor?

Suppose I want to edit the attribute ExtensionName of a user in Active Directory. This attribute is a part of the Object Class top. Also this attribute is listed in the user attributes of the User-msdn link.
But this aatribute is not listed in the attribute editor tab of the User properties in Active Directory Users and Computers. How to edit such attributes which are not a part of attribute editor?
This attribute should show in ADUC. Verify you don't have "Show only attributes that have values" checked in the filter options.

How do you keep Title Bar tabs active in the Application Layout Control?

I have an application that makes use of the Application Layout Control. The UI has two tabs defined in the Title Bar section. The UI also contains a Navigator control in the sidebar that allows users to select links to open other pages. What I am having troubles with is keeping the current tab set as the active tab when users click on links in the current navigator.
The "configuration" property of the Application Layout Control is a complex type, which in turn supports all the properties that define the layout itself. One of those properties is "navigationPath". If Netflix used this control on their site, the value of that property when viewing the movie information page for Ghostbusters might look something like:
/home/genres/comedies/541018
So this property can be thought of as a way of describing the page's current location in the "site map" using *nix filepath syntax.
Each titleBarTab is also a complex type; one of its properties is "selection". This property is intended to be given a value that matches part or all of the current navigationPath for the overall layout. So, continuing the Netflix example, you might define your tabs like this:
<xe:this.titleBarTabs>
<xe:pageTreeNode
page="/genre.xsp"
label="Action"
queryString="genre=action"
selection="/home/genres/action/*" />
<xe:pageTreeNode
page="/genre.xsp"
label="Comedy"
queryString="genre=comedies"
selection="/home/genres/comedies/*" />
<xe:pageTreeNode
page="/genre.xsp"
label="Drama"
queryString="genre=dramas"
selection="/home/genres/dramas/*" />
</xe:this.titleBarTabs>
On the page for Ghostbusters, then, because navigationPath property for the layout matches the pattern defined for the selection property of the pageTreeNode with a label of "Comedy", that tab will appear selected, but the others will not.
Also perhaps worthy of note is that the layout configuration also includes a property called "defaultNavigationPath". The value of this property will be compared against the selection property of each titleBarTab if the navigationPath property has no value. So you typically want to set this to a path that would cause the first tab to appear selected.
Bruce, if I am reading this right, I ran into a similar problem a while back. Does this help at all? Setting a sessionScope variable for a TitleBar tab

How do you use the Selected property of the navigator?

I've spent days trying to figure this out and I give up.
I am a LotusScript programmer and have been trying to learn XPages. All of the examples and sample programs I've studied only touch on pieces of this.
Can someone explain to me step by step how to use the Selected property of the Extension Library Navigator control?
I have created my own custom control based on the layout control from the Extension Library and created a custom property called navigationPath. I also created a navigator custom control that has 5 Page Link Nodes. In the "Selected" property of each Page Link Node, I put the following SSJS:
if(compositeData.navigationPath == "/Home/ApplicationPool"){
return true
}else{
return false
}
/Home/ApplicationPool corresponds to the value I put in the "Selection" property of the particular Page Link Node.
In each layout custom control, I set the "navigationPath" property to compositeData.navigationPath.
What did I miss?
there is a selected and selection property and they mean very different things and can't be used at the same time. In the code example in your question above you are using the selected property which is the wrong one in this case.
Your treeNodes in the navigator should be setup to use the selection property, this is a RegEx value that is used to see if it matches the value passed into the application layout via the custom property.
<xe:navigator id="navigator1" expandable="true" expandEffect="wipe">
<xe:this.treeNodes>
<xe:pageTreeNode label="nodeName" page="/page.xsp" selection="/Home/ApplicationPool" />
</xe:this.treeNodes>
</xe:navigator>
As you can see you don't need to use any SSJS to evaluate a true/false outcome. Just match the value in the treeNode to the one in the XPage's applicationLayout control.
If your using tabs in the layout titleBar then you can set a selection property there also that uses the format /Home/.* which will make that tab highlighted for every XPage that have /Home/ at the start of it's navigationpath custom property. Don;t forget it is RegEx so any valid RegEx statement can be used here adding more power to this particular property.
For the tree nodes in the navigator control you define the name of the xpage to open and then the related selection. Example:
<xe:pageTreeNode page="/text.xsp" selection="/Home/Test" label="Test page">
</xe:pageTreeNode>
For the individual xpages using the applicationLayout you define a value for navigationPath. If this value matches an entry in one of the tree nodes the naviagor control, then the corresponding menu item will be highlighted in the browser. The best way to define the value of the navigationPath is by using a custom property (as you are using). Here's an example of that:
<xe:applicationLayout id="applicationLayout1">
<xe:this.configuration>
<xe:oneuiApplication navigationPath="${javascript:compositeData.navigationPath}" ...
You can see examples of using all this in the Extension Library Teamroom and Discussion templates.
Based on my explanation on how to use it, I can see that you are not using the selection property on the navigation control correct. You just need to define a unique value for each tree node (which then will be used if it matches navigationPath on the individual xpages).
So for your specific example change your selection property to just return: "/Home/ApplicationPool"

Resources