By default, merge dialog box won't copy categories and keywords when merging wire stories. This is achieved by scripting, and it's ready-to-use in GN4 1.4.1643.x, 1.5.1643.x and 1.6.1643.x or newer.
This topic explains how it is done, and which changes you have to apply if you are using an earlier GN4 version than listed above, or custom ted4_Config.xml.
The ways to get this into your system:
•Upgrade your system to the above listed version of GN4: this will automatically use the updated system scripts, and - if you use the standard ted4_Config.xml, it will also automatically resolve the issue. If your ted4_Config.xml is custom, then you need to update the MergeToUI as explained below, and then load it in the database.
•Upgrade only system add-ins and configuration: Download the latest system add-ins for your version, compile them locally and load in the database. if you use the standard ted4_Config.xml, load it in your database. If your ted4_Config.xml is custom, then you need to update the MergeToUI as explained below, and then load it in the database.
•Apply all the changes manually on your system add-ins and configuration.
There are two parts to adjust: one in Ted.vb, modifying MergeToNewArticle script, and another in ted4_Config.xml in <objectUI name="MergeToUI". Both work together and both must be configured exactly as explained below.
In MergeToNewArticle the highlighted lines are to be added: <snip> ' read keywords and categories only from the first selected story Dim firstSourceId = selection.Ids(0) ' get the first selected wire story id If firstSourceId <= 0 Then Return ' just in case, the HasSelectedObject should manage it already
' return categories and keywords of the firstSourceId Dim ostoryattrs As List(Of Object) = UtilsBase.GetObjAttrValues(firstSourceId, New String() {"cats", "keywords"})
' prepare dialog Dim objType As Schema.ObjectType = GN4.Schema.Class.articleObj.ObjectType(DataConnection.Instance.Schema) Dim dlg As New NewArticleMergeDialog(Main.Window, articleMerge) dlg.ObjectUI = DataConnection.Instance.ObjectUIConfig.GetObjectUI("MergeToUI")
' define objects for categories and keywords Dim sourceCats As MultiCategoryValue = Nothing Dim sourceKeywords As KeywordsValue = Nothing
If Not ostoryattrs Is Nothing Then ' if there are categories and keywords in the source... sourceCats = CType(ostoryattrs(0), MultiCategoryValue) '... get the sourceCats object... sourceKeywords = CType(ostoryattrs(1), KeywordsValue) '... and the sourceKeywords object... If Not sourceCats Is Nothing Then For i = 0 To sourceCats.NValues - 1 '... and then parse all it's members and add it as a new parameter to the dialog - later processed by MergeTOUI init dlg.AddParameter("storyCats_" & CType(i, String), "obj" & sourceCats.Values(i).Id & "|" & sourceCats.Values(i).Weight) Next End If
If Not sourceKeywords Is Nothing Then For i = 0 To sourceKeywords.NValues - 1 '... and then parse all it's members and add it as a new parameter to the dialog - later processed by MergeTOUI init dlg.AddParameter("storyKeywords_" & CType(i, String), "obj" & sourceKeywords.Values(i).Keyword) Next End If
End If <snip> You can find the whole code of MergeToNewArticle in Ted.vb. |
In MergeToUI, the highlighted changes are to be done: <objectUI name="MergeToUI" useAttributesOrder="true" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gn4="urn:schemas-teradp-com:gn4tera"> <init> <gn4:folderObject> <snip> <xsl:if test="$pars and $pars/*/add[@key='storyCats_0']"> <gn4:cats> <xsl:for-each select="$pars/*/add[starts-with(@key,'storyCats_')]"> <gn4:ref idref="{substring-before(@value,'|')}" weight="{substring-after(@value,'|')}"/> </xsl:for-each> </gn4:cats> </xsl:if> <!--copying keywords from wires: added on 29/Nov/12 (BS)--> <xsl:if test="$pars and $pars/*/add[@key='storyKeywords_0']"> <gn4:keywords> <xsl:for-each select="$pars/*/add[starts-with(@key,'storyKeywords_')]"> <gn4:item> <xsl:value-of select="@value"/> </gn4:item> </xsl:for-each> </gn4:keywords> </xsl:if>
<snip> <attribute name="cats"> <ui mode="Normal" initMode="Value"> <template kind="Tree" xmlns="http://www.teradp.com/schemas/GN4/1/XmlSchemaExt.xsd"> <objectUI> <winclient> <Style xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Setter Property="FrameworkElement.MaxHeight" Value="170" /> <Setter Property="FrameworkElement.Width" Value="280" /> <Setter Property="FrameworkElement.HorizontalAlignment" Value="Left" /> </Style> </winclient> </objectUI> </template> </ui> </attribute>
<!--copying keywords from wires: added initMode="Value" on 29/Nov/12 (BS)--> <attribute name="keywords"> <ui mode="Normal" labelPosition="Side" orientation="Vertical" initMode="Value"/> </attribute> <snip>
|