Documentation Center

Configuring MetadataConfig.xml for cross reference title fill

Make Publication Manager fill the <navtitle> with the title of the logical object.

About this task

Location
The file MetadataConfig.xml is located on the web server in $\Author\ASP\ClientConfig.

Procedure

  1. Edit MetadataConfig.xml.
  2. Find the Dita.TopicRef.Form.Add DITA form definition and un-comment the code in the Form_Load script.
    By default:
    <script id="Dita.TopicRef.Form.Add.Script" language="Visual Basic">
              <![CDATA[
    		    Public Sub Form_Load(ByVal sender As Object, ByVal e As EventArgs)
    		        '*** Uncomment following code to set the navtitle to the logical object title, when dragging an object into a map in Publication Manager (TS-11798).
    		        'If (Me.Fields.Contains("HRefField")) Then
    		        '    Dim hrefField As Field = Me.Fields("HRefField")
    		        '    If (Me.Fields.Contains("NavTitleField")) Then
    		        '        Dim navTitleField As Field = Me.Fields("NavTitleField")
    		        '        If (String.IsNullOrEmpty(navTitleField.SerializedValue)) Then
    		        '            navTitleField.SerializedValue = hrefField.DisplayText
    		        '        End If
    		        '    End If
    		        'End If
    		    End Sub
    		    Public Sub Form_Validating(ByVal sender As Object, ByVal e As EventArgs)
    		        'Either HRef Field or KeyDef Field is mandatory, so at least one
    		        'field must have a value filled in!
    		        If (Me.Fields.Contains("HRefField")) AndAlso (Me.Fields.Contains("KeysField")) Then
    		            Dim hrefField As Field = Me.Fields("HRefField")
    		            Dim keysField As Field = Me.Fields("KeysField")
    		            If (String.IsNullOrEmpty(hrefField.SerializedValue)) AndAlso (String.IsNullOrEmpty(keysField.SerializedValue)) Then
    		                If keysField.IsHidden Then
    		                    Throw New Exception("No value specified for field HRef. A value must be specified for field HRef.")
    		                Else
    		                    Throw New Exception("No value specified for the fields HRef and Key Definition. A value must be specified for at least one of the fields HRef or Key Definition.")
    		                End If
    		            End If
    		        End If
    		    End Sub
    		]]>
            </script>
  3. Find the Dita.Part.Form.Add DITA form definition and un-comment the code in the Form_Load script.
    By default:
    <script id="Dita.Part.Form.Add.Script" language="Visual Basic">
              <![CDATA[
    		    Public Sub Form_Load(ByVal sender As Object, ByVal e As EventArgs)
    		        '*** Uncomment following code to set the navtitle to the logical object title, when dragging an object into a map in Publication Manager (TS-11798).
    		        'If (Me.Fields.Contains("HRefField")) Then
    		        '    Dim hrefField As Field = Me.Fields("HRefField")
    		        '    If (Me.Fields.Contains("NavTitleField")) Then
    		        '        Dim navTitleField As Field = Me.Fields("NavTitleField")
    		        '        If (String.IsNullOrEmpty(navTitleField.SerializedValue)) Then
    		        '            navTitleField.SerializedValue = hrefField.DisplayText
    		        '        End If
    		        '    End If
    		        'End If
    		    End Sub
    		]]>
            </script>
  4. Find the HRefField DITA field definition and un-comment the code in the Field_ValueChanged script.
    By default:
    <script language="Visual Basic">
              <![CDATA[
    		    Public Sub Field_Load(ByVal sender As Object, ByVal e As EventArgs)
    		        Me.UpdateFormatField()
    		    End Sub
    		    Public Sub Field_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
    		        '*** Uncomment following code to set the navtitle to the logical object title, when dragging an object into a map in Publication Manager (TS-11798).
    		        'If (Not String.IsNullOrEmpty(Me.DisplayText)) Then
    		        '    If (Me.Form.Fields.Contains("NavTitleField")) Then
    		        '        Dim navTitleField As Field = Me.Form.Fields("NavTitleField")
    		        '        navTitleField.SerializedValue = Me.DisplayText
    		        '    End If
    		        'End If
    		        Me.UpdateFormatField()
    		    End Sub
    		    Private Sub UpdateFormatField()
    		        If Me.Form.Fields.Contains("FormatField") Then
    		            Dim field As Field = Me.Form.Fields("FormatField")
    		            If Not Me.FieldValue Is Nothing Then
    		                Dim obj As Object = Me.FieldValue.Source
    		                If Not obj Is Nothing Then
    		                    If obj.ObjectType2.Name = "ISHMasterDoc" Then
    		                        field.SerializedValue = "ditamap"
    		                    ElseIf obj.ObjectType2.Name = "ISHModule" Then
    		                        field.SerializedValue = "dita"
    		                    ElseIf obj.ObjectType2.Name = "ISHLibrary" Then
    		                        field.SerializedValue = "dita"
    		                    Else
    		                        field.SerializedValue = obj.ContentType.DefaultExtension
    		                    End If 
    		                End If
    		            Else
    		                field.SerializedValue = ""
    		            End If
    		        End If
    		    End Sub
    		]]>
            </script>