UI to manage one to many relationship between classes in custom module in Kentico - kentico

I have created a Clinic module within Kentico V12 with two classes: Doctor and Appointment. There is a 1 to many relationship between Doctor and Appointment. How could I display the name and surname of the doctors in the Appointment grid?
<?xml version="1.0" encoding="utf-8" ?>
<grid>
<actions>
<action name="edit" caption="$General.Edit$" fonticonclass="icon-edit" fonticonstyle="allow" />
<action name="#delete" caption="$General.Delete$" fonticonclass="icon-bin" fonticonstyle="critical" confirmation="$General.ConfirmDelete$" />
</actions>
<columns>
<column source="AppointmentPatientFirstName" caption="First name" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientLastName" caption="Last name" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientEmail" caption="Email" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientPhoneNumber" caption="Phone Number" wrap="false" localize="true">
<filter type="text" size="15" />
</column>
<column source="Date" caption="Date" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientBirthDate" caption="BirthDate" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentDoctorID" caption="Doctor ID" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
</columns>
<options>
<key name="DisplayFilter" value="true" />
</options>
</grid>
Kind regards.
Appointment List: https://i.stack.imgur.com/Ft1pE.png

Using this column AppointmentDoctorID modify the XML to use a transformation like so:
<column source="AppointmentDoctorID" caption="Doctor" externalsourcename="#transform: yournamespace.doctor: {%FirstName%} {%LastName%}" wrap="false" localize="true"></column>
Check out more documentation on unigrids in the Kentico Documentation.

Related

TFS 2012 Process Template - Column Updates not Displaying for Product and Iteration Backlogs -

I've update the AgileConfiguration.xml process template to include specific columns, column order and widths to match how our teams work. After importing the process configuration, I was expecting the changes to be reflected in Web Access product and iteration backlog pages. The changes do not appear, rather I see my personal column changes I may have made over time. I've tested in a new Team Project, the changes appear.
How can I remove my personal modifications and test to ensure the changes are applied? Further, how can I ensure all users receive the updates if they have made their own changes?
Example of the template:
<?xml version="1.0" encoding="utf-16"?>
<AgileProjectConfiguration>
<IterationBacklog>
<Columns>
<Column width="65" refname="System.WorkItemType" />
<Column width="400" refname="System.Title" />
<Column width="60" refname="System.State" />
<Column width="45" refname="Microsoft.VSTS.Scheduling.RemainingWork" />
<Column width="90" refname="System.AssignedTo" />
<Column width="40" refname="Microsoft.VSTS.Common.Priority" />
<Column width="100" refname="Microsoft.VSTS.Common.Triage" />
<Column width="50" refname="Custom.SCRID" />
<Column width="250" refname="System.AreaPath" />
</Columns>
</IterationBacklog>
<ProductBacklog>
<AddPanel>
<Fields>
<Field refname="System.Title" />
</Fields>
</AddPanel>
<Columns>
<Column width="65" refname="System.WorkItemType" />
<Column width="400" refname="System.Title" />
<Column width="60" refname="System.State" />
<Column width="45" refname="Microsoft.VSTS.Scheduling.Effort" />
<Column width="90" refname="System.AssignedTo" />
<Column width="100" refname="Microsoft.VSTS.Common.Triage" />
<Column width="150" refname="System.IterationPath" />
<Column width="50" refname="Custom.SCRID" />
<Column width="50" refname="Microsoft.VSTS.Common.BacklogPriority" />
<Column width="250" refname="System.AreaPath" />
</Columns>
</ProductBacklog>
</AgileProjectConfiguration>

Ext Net TimeField in an editable grid

I have a grid panel which display two TimeSpans in two columns and all is well when I load the page but when I go server side the validation on my editors always fail. I don't understand why the store can display the TimeSpans but cannot return it after...
Here my code :
<ext:GridPanel ID="WeekParams" runat="server" >
<Store>
<ext:Store runat="server">
<Reader>
<ext:JsonReader IDProperty="GUID">
<Fields>
<ext:RecordField Name="Day" Type="String" />
<ext:RecordField Name="UATNumber" Type="int" />
<ext:RecordField Name="From" Type="Date" />
<ext:RecordField Name="To" Type="Date" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ColumnID="Day" DataIndex="Day" />
<ext:NumberColumn ColumnID="UATNumber" DataIndex="UATNumber" Format="0" />
<ext:DateColumn ColumnID="From" DataIndex="From" Format="dd/MM/yyyy" >
<Renderer Format="Date" FormatArgs="'HH:mm'" />
<Editor>
<ext:TimeField runat="server" />
</Editor>
</ext:DateColumn>
<ext:DateColumn ColumnID="To" DataIndex="To" Format="dd/MM/yyyy" >
<Renderer Format="Date" FormatArgs="'HH:mm'" />
<Editor>
<ext:TimeField runat="server" />
</Editor>
</ext:DateColumn>
</Columns>
</ColumnModel>
<Plugins>
<ext:EditableGrid runat="server" />
</Plugins>
</ext:GridPanel>
And here the result when I'm going to the server side :

How to create listerners for Custom entity in liferay?

I have created custom entity employee. Now I want to add listeners for this entity so that I can track add/edit/delete employee operations.
In Liferay for portal enitites like Blogs, Group, User etc we can add properties like
value.object.listener.com.liferay.portal.model.Group=com.smb.test.hook.listeners.GroupListener
in portal.properties via hook-plugin.
But for custom entity this approach does not seem to work.
Any help would be appreciated.
For custom entity, we need to add the listener property in service-ext.properties instead of the portal.properties file.
For my employee entity I have added following property in service-ext.properties file:
value.object.listener.com.smb.employee.model.Employee=com.smb.employee.hook.listeners.EmployeeListener
Note: We need to manually create service-ext.properties file in src folder besides the service.properties file. We could have updated service.properties but since it auto-generates our changes would be lost and hence service-ext.properties is the correct liferay approach.
Here is the location of the service-ext.properties file:
Here is my service.xml:
<service-builder package-path="com.smb.employee">
<author>Suyash</author>
<namespace>smb</namespace>
<entity name="Employee" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="fooId" type="long" primary="true" />
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<!-- Other fields -->
<column name="field1" type="String" />
<column name="field2" type="boolean" />
<column name="field3" type="int" />
<column name="field4" type="Date" />
<column name="field5" type="String" />
<!-- Order -->
<order by="asc">
<order-column name="field1" />
</order>
<!-- Finder methods -->
<finder name="Field2" return-type="Collection">
<finder-column name="field2" />
</finder>
</entity>
</entity>
</service-builder>

NLog code line logging

I am using NLog to log error messages into csv:
<target name="csv" xsi:type="File"
fileName="${basedir}/Logs/log.csv"
archiveFileName="${basedir}/Logs/Archives/log.{#####}.csv"
archiveAboveSize="10240"
archiveNumbering="Sequence"
concurrentWrites="true"
keepFileOpen="false">
<layout xsi:type="CSVLayout" delimiter="Comma" withHeader="false">
<column name="time" layout="${longdate}" />
<column name="message" layout="${message}" />
<column name="logger" layout="${logger}"/>
<column name="level" layout="${level}"/>
</layout>
</target>
How can I add a column to track the code line number?
Thank you.
Try to add ${callsite} layout renderer.
<column name="source" layout="${callsite:fileName=true}" />

SharePoint. Change document icon in document library?

I would like to change document icon in document library at runtime. Icon should be changed based on some condition I have in code. There is no difference what extension of file is (txt, doc, pdf, etc..). Currently I use HTTP module to parse server response and change icon in runtime. However this solution is not reliable as page HTML markup may be changed, different views has different behavior and there are issues with registration HTTP module in SharePoint 2010.
Is there any API or any other reliable way to change document's icon at runtime?
I would appreciate any help.
Thanks beforehand,
-Petro
Here is the schema of Sharepoint 2010 standard DocIcon Field (its quite huge):
<Field ID="{081c6e4c-5c14-4f20-b23e-1a71ceb6a67c}" Type="Computed" ReadOnly="TRUE" Name="DocIcon" DisplayName="Тип" TextOnly="TRUE" ClassInfo="Icon" AuthoringInfo="(значок связи с документом)" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="DocIcon" FromBaseType="TRUE">
<FieldRefs>
<FieldRef Name="File_x0020_Type" />
<FieldRef Name="FSObjType" />
<FieldRef Name="FileRef" />
<FieldRef Name="FileLeafRef" />
<FieldRef Name="HTML_x0020_File_x0020_Type" />
<FieldRef Name="PermMask" />
<FieldRef Name="CheckoutUser" ShowField="Title" />
<FieldRef Name="IsCheckedoutToLocal" />
<FieldRef Name="ServerUrl" />
<FieldRef Name="IconOverlay" />
</FieldRefs>
<DisplayPattern>
<SetVar Name="DocIconImg">
<SetVar Name="DocIconAltText">
<IfEqual>
<Expr1>
<LookupColumn Name="FSObjType" />
</Expr1>
<Expr2>1</Expr2>
<Then>
<IfSubString>
<Expr1>0x0120D5</Expr1>
<Expr2>
<Column Name="ContentTypeId" />
</Expr2>
<Then>
<HTML>Коллекция документов: </HTML>
<LookupColumn Name="FileLeafRef" HTMLEncode="TRUE" />
</Then>
<Else>
<HTML>Папка: </HTML>
<LookupColumn Name="FileLeafRef" HTMLEncode="TRUE" />
</Else>
</IfSubString>
</Then>
<Else>
<LookupColumn Name="FileLeafRef" HTMLEncode="TRUE" />
</Else>
</IfEqual>
</SetVar>
<SetVar Name="DocIconFileName">
<IfEqual>
<Expr1>
<Column Name="IconOverlay" />
</Expr1>
<Expr2 />
<Then>
<IfEqual>
<Expr1>
<LookupColumn Name="FSObjType" />
</Expr1>
<Expr2>1</Expr2>
<Then>
<IfEqual>
<Expr1>
<Column Name="HTML_x0020_File_x0020_Type" />
<HTML>|</HTML>
<Column Name="File_x0020_Type" />
</Expr1>
<Expr2>
<HTML>|</HTML>
</Expr2>
<Then>
<HTML>folder.gif</HTML>
</Then>
<Else>
<SetVar Name="FolderIconFromMap">
<MapToIcon>
<Column Name="HTML_x0020_File_x0020_Type" />
<HTML>|</HTML>
<Column Name="File_x0020_Type" />
</MapToIcon>
</SetVar>
<IfEqual>
<Expr1>
<GetVar Name="FolderIconFromMap" />
</Expr1>
<Expr2>
<MapToIcon />
</Expr2>
<Then>
<HTML>folder.gif</HTML>
</Then>
<Else>
<GetVar Name="FolderIconFromMap" />
</Else>
</IfEqual>
</Else>
</IfEqual>
</Then>
<Else>
<MapToIcon>
<Column Name="HTML_x0020_File_x0020_Type" />
<HTML>|</HTML>
<Column Name="File_x0020_Type" />
</MapToIcon>
</Else>
</IfEqual>
</Then>
<Else>
<MapToIcon>
<Column Name="IconOverlay" />
</MapToIcon>
</Else>
</IfEqual>
</SetVar>
<HTML><![CDATA[<img border="0" alt="]]></HTML>
<GetVar Name="DocIconAltText" />
<HTML><![CDATA[" title="]]></HTML>
<GetVar Name="DocIconAltText" />
<HTML><![CDATA[" src="/_layouts/images/]]></HTML>
<GetVar Name="DocIconFileName" />
<HTML><![CDATA[" />]]></HTML>
</SetVar>
<SetVar Name="DocIconOverlayImg">
<IfEqual>
<Expr1>
<Column Name="IconOverlay" />
</Expr1>
<Expr2 />
<Then>
<IfEqual>
<Expr1>
<Column Name="CheckoutUser" />
</Expr1>
<Expr2 />
<Else>
<SetVar Name="DocIconOverlayAltText">
<LookupColumn Name="FileLeafRef" HTMLEncode="TRUE" />
<HTML><![CDATA[
Кем извлечено: ]]></HTML>
<LookupColumn Name="CheckoutUser" ShowField="Title" HTMLEncode="TRUE" />
</SetVar>
<HTML><![CDATA[<img class="ms-vb-icon-overlay" alt="]]></HTML>
<GetVar Name="DocIconOverlayAltText" />
<HTML><![CDATA[" title="]]></HTML>
<GetVar Name="DocIconOverlayAltText" />
<HTML><![CDATA[" src="/_layouts/images/checkoutoverlay.gif" />]]></HTML>
</Else>
</IfEqual>
</Then>
<Else>
<HTML><![CDATA[<img class="ms-vb-icon-overlay" alt="*" src="/_layouts/images/]]></HTML>
<MapToOverlay>
<Column Name="IconOverlay" />
</MapToOverlay>
<HTML><![CDATA[" />]]></HTML>
</Else>
</IfEqual>
</SetVar>
<IfEqual>
<Expr1>
<LookupColumn Name="FSObjType" />
</Expr1>
<Expr2>1</Expr2>
<Then>
<FieldSwitch>
<Expr>
<GetVar Name="RecursiveView" />
</Expr>
<Case Value="1">
<GetVar Name="DocIconImg" />
<GetVar Name="DocIconOverlayImg" />
</Case>
<Default>
<SetVar Name="UnencodedFilterLink">
<SetVar Name="RootFolder">
<HTML>/</HTML>
<LookupColumn Name="FileRef" />
</SetVar>
<SetVar Name="SkipHost">1</SetVar>
<SetVar Name="FolderCTID">
<FieldSwitch>
<Expr>
<ListProperty Select="EnableContentTypes" />
</Expr>
<Case Value="1">
<Column Name="ContentTypeId" />
</Case>
</FieldSwitch>
</SetVar>
<FilterLink Default="" Paged="FALSE" />
</SetVar>
<FieldSwitch>
<Expr>
<GetVar Name="FileDialog" />
</Expr>
<Case Value="1">
<GetVar Name="DocIconImg" />
<GetVar Name="DocIconOverlayImg" />
</Case>
<Default>
<HTML><![CDATA[<a href="]]></HTML>
<GetVar Name="UnencodedFilterLink" HTMLEncode="TRUE" />
<HTML><![CDATA[" onmousedown="javascript:VerifyFolderHref(this,event, ']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<GetVar Name="UnencodedFilterLink" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="HtmlTrProgId">
<Column Name="File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ListProperty Select="DefaultItemOpen" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<MapToControl>
<Column Name="HTML_x0020_File_x0020_Type" />
<HTML>|</HTML>
<Column Name="File_x0020_Type" />
</MapToControl>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<Column Name="HTML_x0020_File_x0020_Type" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="GetServerFileRedirect">
<Field Name="ServerUrl" />
<HTML>|</HTML>
<Column Name="HTML_x0020_File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[')"]]></HTML>
<HTML><![CDATA[" onclick="return HandleFolder(this,event, ']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<GetVar Name="UnencodedFilterLink" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="HtmlTransform" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="HtmlTrAcceptType">
<Column Name="File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="HtmlTrHandleUrl">
<Column Name="File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="HtmlTrProgId">
<Column Name="File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ListProperty Select="DefaultItemOpen" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<MapToControl>
<Column Name="HTML_x0020_File_x0020_Type" />
<HTML>|</HTML>
<Column Name="File_x0020_Type" />
</MapToControl>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<Column Name="HTML_x0020_File_x0020_Type" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="GetServerFileRedirect">
<Field Name="ServerUrl" />
<HTML>|</HTML>
<Column Name="HTML_x0020_File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<Column Name="CheckoutUser" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<UserID AllowAnonymous="TRUE" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ListProperty Select="ForceCheckout" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<Field Name="IsCheckedoutToLocal" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<Field Name="PermMask" />
</ScriptQuote>
<HTML><![CDATA[');">]]></HTML>
<GetVar Name="DocIconImg" />
<GetVar Name="DocIconOverlayImg" />
<HTML><![CDATA[</a>]]></HTML>
</Default>
</FieldSwitch>
</Default>
</FieldSwitch>
</Then>
<Else>
<HTML><![CDATA[<a href="]]></HTML>
<Field Name="ServerUrl" URLEncodeAsURL="TRUE" />
<HTML><![CDATA[" onclick="return DispEx(this,event,']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="HtmlTransform" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="HtmlTrAcceptType">
<Column Name="File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="HtmlTrHandleUrl">
<Column Name="File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="HtmlTrProgId">
<Column Name="File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ListProperty Select="DefaultItemOpen" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<MapToControl>
<Column Name="HTML_x0020_File_x0020_Type" />
<HTML>|</HTML>
<Column Name="File_x0020_Type" />
</MapToControl>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<Column Name="HTML_x0020_File_x0020_Type" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ServerProperty Select="GetServerFileRedirect">
<Field Name="ServerUrl" />
<HTML>|</HTML>
<Column Name="HTML_x0020_File_x0020_Type" />
</ServerProperty>
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<Column Name="CheckoutUser" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<UserID AllowAnonymous="TRUE" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<ListProperty Select="ForceCheckout" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<Field Name="IsCheckedoutToLocal" />
</ScriptQuote>
<HTML><![CDATA[',']]></HTML>
<ScriptQuote NotAddingQuote="TRUE">
<Field Name="PermMask" />
</ScriptQuote>
<HTML><![CDATA[')">]]></HTML>
<GetVar Name="DocIconImg" />
<GetVar Name="DocIconOverlayImg" />
<HTML><![CDATA[</a>]]></HTML>
</Else>
</IfEqual>
</DisplayPattern>
</Field>
You can get DocIcon field of a library you want to modify icons for (through code) and modify its schema. As you can see there are a lot of XSLT in section, but it's quite simple and new patterns can be added without big problems (and old ones can be removed). Another way is to create your own custom field type and use it instead of standard one to display an icon.

Resources