The Inline personalizations functionality in M3 Mashups can be used to deploy personalizations as part of a Mashup. Instead of relying on the personalizations for the regular programs you can create custom personalizations that are only used in Mashups and that do not affect the other personalizations.
Support for inline personalizations was added in Smart Office version 10.0.5.0 but there have been some fixes so this functionality should only be used with Smart Office 10.0.5.1 or later.
Personalizations in M3 Mashups are supported for the ListPanel but there are some issues you might run into.
- One issue is that in some cases you want to have one set of personalizations in the regular program and one set of personalizations in the Mashup. It might not be possible to find a compromise that works in both cases.
- Another issue is that the Mashup and the personalizations are deployed separately and these must be kept in sync when things are changed.
The inline personalization support was added to allow personalization data to be shipped and deployed as part of the Mashup. When inline personalizations are defined within a Mashup they will override any personalizations that are defined for the regular program. The other benefit is that the personalizations that are specific to the Mashup won’t affect the regular program.
One downside of the inline personalizations is that it is not possible have different ones for different users or roles. The personalizations are tied to the Mashup so if you need different personalizations for different users and roles the Inline personalization functionality is not the right choice.
The rest of this post will show how to create inline personalizations with conditional styles in the list.
Inline Conditional styles
Let’s say you want to create a Mashup that shows a list of customers and use some condtional style coloring for the Status column. I will assume that you already know how to create Mashup so we will start with a Mashup that contains a ListPanel for the M3 program CRS610.
The first step is to open the Settings dialog for the ListPanel and then change the Personalization type from Standard to Inline.
The next step is to actually create the personalizations and in this example I will use the capture mode. Make sure the the program name is correct and then press the Start Capture button.
After the program has started in Capture mode you should right-click in the white area above the list. In the context menu select Personalize and then select Conditional styles. Define some conditional styles, in my example I created three conditions for the Status column that changes the background color of the column depending on the status. When you are done with the conditional styles simply close the program and when the program has closed click the OK button in the Settings dialog.
In the generated XAML code you should see a new element called ListPanel.PersonalizationXml. The content of the element is a CDATA block that contains the personalization data serialized as XML. The XML format is the same that is used when storing personalizations on the MNE/MUA server and also the same format that is used when exporting/importing personalizations in MForms.
An observant reader may realize that it should be possible to just copy and paste personalization XML into the ListPanel.PersonalizationXml element and this is correct. As long as you keep the CDATA block you can copy personalization data from an exported file or from a file on the server. The important thing is that the personalization XML must be complete. The easiest way to ensure this is to use the Export personalization functionality in MForms found in the Tools menu.
Run the Mashup to verify that the inline personalizations work. Any personalizations done in the regular program should no longer be visible in the Mashup, only the ones defined inline should be visible. How my example looks can be seen in the image below.
This is the XAML code with the inline personalization XML.
<Grid Margin="0" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms"> <m3:ListPanel Name="CustomerList" PersonalizationType="Inline" Margin="15,10,15,15"> <m3:ListPanel.Events> <mashup:Events> <mashup:Event SourceEventName="Startup" TargetEventName="List"> <mashup:Parameter TargetKey="OKCONO" /> <mashup:Parameter TargetKey="OKCUNO" /> </mashup:Event> </mashup:Events> </m3:ListPanel.Events> <m3:ListPanel.Bookmark> <m3:Bookmark Program="CRS610" Table="OCUSMA" KeyNames="OKCONO,OKCUNO" /> </m3:ListPanel.Bookmark> <m3:ListPanel.PersonalizationXml><![CDATA[<?xml version="1.0" encoding="utf-16"?><Customization version="9.0.0" name="CRS610"><Panels><Panel name="CRA610BC"><ConditionalStyles><ConditionalStyle version="2" type="0" target="STAT" enabled="True" alignment="Right" hasForeground="True" foreground="#FF000000" hasBackground="True" background="#FFBAD661"><Condition type="1" field="STAT" operator="0" operand="1" value="20" /></ConditionalStyle><ConditionalStyle version="2" type="0" target="STAT" enabled="True" alignment="Right" hasForeground="True" foreground="#FF000000" hasBackground="True" background="#FFFD8F8F"><Condition type="1" field="STAT" operator="0" operand="1" value="90" /></ConditionalStyle><ConditionalStyle version="2" type="0" target="STAT" enabled="True" alignment="Right" hasForeground="True" foreground="#FF000000" hasBackground="True" background="#FFFEE488"><Condition type="1" field="STAT" operator="1" operand="1" value="20" /></ConditionalStyle></ConditionalStyles></Panel></Panels></Customization>]]></m3:ListPanel.PersonalizationXml> </m3:ListPanel> </Grid>