AEM dialog using sling:resourceType include on the same component dialog twice - dialog

The requirement is, in a new component dialog, I need to have to tabs contains two generic CTA config , e.g:
currently , my new component dialog setting as below:
<tab3
jcr:description="Primary CTA items"
jcr:primaryType="nt:unstructured"
jcr:title="Primary CTA"
granite:class="tab-wrapper"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<columns
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns"
margin="{Boolean}true">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<cta
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/include"
path="myproject/folder/components/commons/cta/content/items/columns/items/column"/>
</items>
</column>
</items>
</columns>
</items>
</tab3>
<tab4
jcr:description="Secondary CTA items"
jcr:primaryType="nt:unstructured"
jcr:title="Secondary CTA"
granite:class="tab-wrapper"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<columns
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns"
margin="{Boolean}true">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<cta2
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/include"
name="./cta2/"
path="myproject/folder/components/commons/cta/content/items/columns/items/column"/>
</items>
</column>
</items>
</columns>
</items>
</tab4>
as you can see, I am using sling:resourceType="granite/ui/components/coral/foundation/container"
pointing to the generic cta dialog config path="myproject/folder/components/commons/cta/content/items/columns/items/column"
The issue is, after I built it, in the crx/de , I can only see one node object:
and my generic cta dialog config looks like this:
So as you can see, if I include the CTA diagloc using sling resource include, it always give me the object name CTA, and it is duplicated, so tab 3 and tab 4 dialog config in new component is overriding each other's value.
I am wondering has anyone experienced this issue before?
What is the best solution?
Some coding sample would be helpful
Thank

rename the variables before submit and save the data under separate tab nodes:
// add .tab-class and tab-name in dialog so they are available as html atribute on dialog render
$(document).on("click", ".cq-dialog-submit", function (e) {
var $tabs = $(".tab-class");
$tabs.each(function (i) {
var _this = $(this);
var tabName = _this.data("tabe-name");
_this.find("input").each(function () {
$input = $(this);
var existingName = $input.attr("name");
var newName = tabName + '/' + existingName;
$input.attr("name", newName);
});
});
});
also on dialog load call < componentNode >.json and populate the data from json into fields correctly, existing data would not be populated correctly anymore because of name mismatch

Related

SharePoint - Ribbon Button showing wrong LabelText

I have a Ribbon Button with the following XML:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Ribbon.Library.Actions.AddAButton"
Location="CommandUI.Ribbon"
RegistrationId="171"
RegistrationType="List"
Title="Change Email Ribbon Button">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ListForm.Edit.Commit.Controls._children">
<Button Id="Ribbon.ListForm.Edit.Commit.NewRibbonButton"
Command="ChangeEmailButtonCommand"
Image16by16="/_layouts/15/$Resources:core,Language;/images/formatmap16x16.png?rev=23" Image16by16Top="-127" Image16by16Left="-91"
Image32by32="/_layouts/15/$Resources:core,Language;/images/formatmap32x32.png?rev=23" Image32by32Top="-477" Image32by32Left="-307"
LabelText="$Resources:Toolkit,ChangeEmailButtonLabel"
TemplateAlias="o2" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="ChangeEmailButtonCommand"
CommandAction="javascript:
ChangeEmailAction();
" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="Ribbon.ListForm.Edit.Commit.Scripts" Location="ScriptLink" ScriptSrc="/_layouts/15/GOToolkit/JS/loadJsOrCssFile.js?version=1.7.3" />
</Elements>
Now, the LabelText on my button, shows the exact same text, as it does in the XML: "$Resources:Toolkit,ChangeemailButtonLabel", where I'd expect it to show the text that I have defined in the 'ChangeEmailButtonLabel', which looks like this:
<data name="ChangeEmailButtonLabel" xml:space="preserve">
<value>Change email</value>
</data>
Am I missing something here?
Check that your resources file is stored in the SharePoint Resources folder.
Also, don't know if it's a game changer but you can add ";" at the end of your syntax.

How to use custom dispForm in sharepoint list view?

I am using list view to show the list items in share point 2013. When user clicks the title the custom page should be shown instead of default display page(dispForm.aspx) of share-point.
Define XmlDocuments in contentType:
https://msdn.microsoft.com/en-us/library/office/aa543825.aspx
Example:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Workflow Task (0x010801) -->
<ContentType ID="0x010100AF4E4BE6CF8048959C4172F4298CE42A"
Name="MyName"
Group="MyGroup"
Description="MyDescription"
Version="0">
<FieldRefs>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI ="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<New>_layouts/MyFolder/New.aspx</New>
<Display>_layouts/MyFolder/New.aspx</Display>
<Edit>_layouts/MyFolder/Edit.aspx</Edit>
</FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
In code behind you get current item
SPListItem item = SPContext.Current.ListItem;

Is it possible to add a separator in a javafx choicebox in FXML?

This document describes how to add a separator to a javafx 2 choicebox by code:
http://docs.oracle.com/javafx/2/ui_controls/choice-box.htm
I would like to achieve the same using a FXML layout. Any ideas?
.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.HBox?>
<?import java.lang.*?>
<HBox xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2">
<ChoiceBox>
<String fx:value="Item 1" />
<String fx:value="Item 2" />
<Separator />
<String fx:value="Item 3" />
</ChoiceBox>
</HBox>
Don't forget to import the correct Class. With importing the correct classpath you can include any class and try to display it, even your self-made. Just open the FXML in your SceneBuilder and use Preview to see it in action without building a custom fxml loader for it.
This should do it. Replace the "Items" with your own content. Also, take a look at the FXML reference found here for more information on using FXML.
<ChoiceBox>
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="Item 1" />
<String fx:value="Item 2" />
<Separator fx:id="separator"/>
<String fx:value="Item 3" />
</FXCollections>
</items>
</ChoiceBox>

List menu by Parse XML in J2ME

I want to create menu from XMLFile. My xml is like this
<?xml version="1.0" encoding="UTF-8"?>
<root>
<parent title="Layanan Anda">
<menu title="Info Kartu">
<submenu title="Informasi Saldo">
<input type="numberpassword" length="4">Kode </input>
</submenu>
<submenu title="Mutasi Kartu Utama">
<input type="numberpassword" length="4">Kode </input>
</submenu>
<submenu title="Mutasi Kartu Lain">
<input type="number" length="10">Kartu</input>
<input type="numberpassword" length="4">Kode </input>
</submenu>
<submenu title="Deposito">
<input type="number" length="10">Bilyet</input>
<input type="numberpassword" length="4">Kode </input>
</submenu>
</menu>
<menu title="Kartu Anda">
</menu>
<menu title="Other Info">
</menu>
<menu title="Isi">
</menu>
</parent>
<parent title="Menu Favorit">
</parent>
<parent title="Recent Menu">
</parent>
<parent title="Setting">
</parent>
</root>
In HomeScreen, list menu parent will show first. And when I click parent menu, application will show list menu from "menu" tag. When I click menu again, application will show list menu from submenu. And vice versa when I want to back to parent menu.
How can I implement this in J2ME?
Parse your XML file and create a tree structure to hold the menu/submenu items. Each node should hold the items of a single level. For example:
root: Layanan Anda, Menu Favorit, Recent Menu, Setting
menu: Info Kartu, Kartu Anda, Other Info, Isi
submenu: Informasi Saldo, Mutasi Kartu Utama, Mutasi Kartu Lain, Deposito
Then use a graphical List to show the items of a node.

Custom SharePoint 2010 Documentset contenttype

I'm working on a custom contenttype of the type Documentset.
I want to set the alllowed contenttypes, but this is not working, it's only showing the defeult document. I read several blogs but i can't find my solution.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Document Set (0x0120D520) -->
<ContentType ID="0x0120D520008d2ff418027e4c31b54d155b98596748"
Overwrite="True"
Name="Custom Dossier"
Group="Custom group"
Description="Custom dossier"
Inherits="True"
Version="0">
<FieldRefs>
<FieldRef ID="{8D6C094C-3E1F-41f4-BEE3-25B27EE09702}" Name="Dossier_Nummer" DisplayName="Dossiernummer" Required="True" />
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/office/documentsets/allowedcontenttypes">
<act:AllowedContentTypes xmlns:act="http://schemas.microsoft.com/office/documentsets/allowedcontenttypes" LastModified="05/31/2012 08:46:56">
<AllowedContentType id="0x0101" />
<AllowedContentType id="0x0101000490d50c50624b6ca21c637ef39cd89b" />
</act:AllowedContentTypes>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
You can use ContentType binding element for assigning CTs to document library.
Have you tried adding all the nodes necessary for the document set template? A great example is located here: http://code.msdn.microsoft.com/office/Create-Custom-Document-Set-318393ce/sourcecode?fileId=57420&pathId=1173424883

Resources