You may want to create a variation of an existing navigator. The best method to do it is to duplicate an existing navigator, and then apply necessary adjustments to the copy.
For example, on the Pages main tab, you may want to duplicate the Pages navigator and create a 'page books' variation - that only lists edition templates.
Here are steps to follow:
Launch a GN4 application (in this case, Fred4). Select the source navigator, and then on the Help menu, click Configuration details. Read the report and then locate the name of the main tab in the MAIN TAB AND NAVIGATORS section of the report. In this example, the name of the main tab is Fred4Pages. |
Search through all configuration files for the x:name="Fred4Pages" string. In this example, it is found in Fred4_TabItems.xml. Expand the <l:ShellTabItem x:Name="Fred4Pages". |
In this example, the ShellData section of the Fred4Pages main tab is on the 2nd level of the <l:ShellTabItem x:Name="Fred4Pages". Expand it down to the <l:ShellData.SearchCriteria>. The section lists all the pointers to the search criteria and result listing, related to the defined navigators. In this example, we duplicated the first line <l:SearchCriteria Name="Search" BaseQueryName="Fred4Pages" SearchName="Browse" AutoApply="False" />, and modified the Name as SearchBooks and BaseQueryName as Fred4Books, leaving the rest as it was. Furthermore, we added a new line <l:SearchCriteria Name="BooksResultView" />. It provides for an unique name for results listing. However, make a note of the original name BaseQueryName="Fred4Pages" as you will need to look for it in the Fred4_Config.xml file when duplicating and adjusting the base query. <l:ShellData.ShellData> <l:ShellData> <l:ShellData.SearchCriteria> <l:SearchCriteria Name="Search" BaseQueryName="Fred4Pages" SearchName="Browse" AutoApply="False" /> <l:SearchCriteria Name="SearchBooks" BaseQueryName="Fred4Books" SearchName="Browse" AutoApply="False" /> <l:SearchCriteria Name="ArticleSearch" BaseQueryName="ArticlePicker" SearchName="Basic" AutoApply="False" /> <l:SearchCriteria Name="ContentSearch" BaseQueryName="ContentMainTab" SearchName="Basic" AutoApply="False" ItemsPerPage="100" /> <l:SearchCriteria Name="LibSearch" BaseQueryName="Fred4Libs" SearchName="Browse" AutoApply="True" /> <l:SearchCriteria Name="MasterSearch" BaseQueryName="Fred4Masters" SearchName="Browse" AutoApply="True" /> <l:SearchCriteria Name="AssetResultView" /> <l:SearchCriteria Name="LibResultView" /> <l:SearchCriteria Name="MasterResultView" /> <l:SearchCriteria Name="ArticleResultView" /> <l:SearchCriteria Name="BooksResultView" /> <l:SearchCriteria Name="ExtendConditions"/> <l:SearchCriteria Name="ExtendedConditionsView"/> <l:SearchCriteria Name="TasksSearch" BaseQueryName="Tasks" SearchName="Basic" AutoApply="False" ItemsPerPage="100"/> </l:ShellData.SearchCriteria> </l:ShellData> </l:ShellData.ShellData> |
In this example, the navigator is found by expanding <DockPanel Name="MainContainer", then <Grid Name="MainGrid"> then <Expander Style=" and finally the <l:NavigatorControl. Now, all the navigators, defined within that main tab, are listed one below each other. We selected the entire collapsed block of <TabItem Name="PagesTab" Header="Pages">, created an empty line, and pasted it there, renaming in the duplicate <TabItem Name="PagesTab" Header="Pages"> as <TabItem Name="BooksTab" Header="Books">. Now, there are all items we renamed in the duplicate, and all of them are marked with a green highlight. Please notice that in some of them we simply replaced the Pages string with the Books string. In others, we replaced the original string, e.g. Search (the name of the search criteria, defined in ShellData), with the new name (SearchBooks). Likewise, we replaced ResultView with BooksResultView. <TabItem Name="BooksTab" Header="Books"> <Grid Name="BooksGrid"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Expander HorizontalAlignment="Stretch" Name="BooksExpander" Grid.Row="0" Grid.Column="0" IsExpanded="True"> <Expander.Header> <Grid Width="{Binding Path=ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type Expander}}}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <l:RefreshButton IsDefault="True" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="2,2,2,2" Command="{x:Static l:Commands.Script}" CommandParameter="Refresh" /> <l:SavedSearchControl MinWidth="200" MaxWidth="300" Grid.Column="1" HorizontalAlignment="Left" SearchCriteriaTarget="{Binding Path=(l:ShellData.ShellData).SearchCriteria[SearchBooks],
RelativeSource={RelativeSource Self}}" /> <ComboBox Name="BooksSearchIndex" Grid.Column="2" ToolTip="Search Type" HorizontalAlignment="Right" Margin="2,2,30,2" ItemsSource="{Binding Path=(l:ShellData.ShellData).SearchCriteria[SearchBooks].BaseQuery.Searches, RelativeSource={RelativeSource Self}}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedValue="{Binding Path=(l:ShellData.ShellData).SearchCriteria[SearchBooks].SearchName, RelativeSource={RelativeSource Self}}" /> </Grid> </Expander.Header> <StackPanel Orientation="Horizontal"> <l:SearchConditionsControl SearchCriteriaTarget="{Binding Path=(l:ShellData.ShellData).SearchCriteria[SearchBooks], RelativeSource={RelativeSource Self}}" /> <Button Width="22" Height="22" Margin="0,0,0,2" VerticalAlignment="Bottom" HorizontalAlignment="Left" Command="{x:Static l:Commands.Script}" CommandParameter="ShowPageEditionPopup"> <Rectangle Width="8" Height="8" Fill="{StaticResource ResourceKey=TriangleDown}"> <Rectangle.RenderTransform> <RotateTransform Angle="-90" CenterX="4" CenterY="4" /> </Rectangle.RenderTransform> </Rectangle> </Button> </StackPanel> </Expander> <l:ShellResultView Style="{DynamicResource ShellResultView}" Grid.Row="1" Name="BooksResultView" l:DragDropHelper.IsDragSource="true" l:ShellData.IsRegistered="True" DirectoryStyleName="Thumbnails" LeftDoubleClickCommandParameter="OnPageDoubleClick" RightMouseClickCommandParameter="ShowPageNavigatorPopup" SearchCriteriaSource="{Binding Path=(l:ShellData.ShellData).SearchCriteria[SearchBooks], RelativeSource={RelativeSource Self}}" SearchCriteriaTarget="{Binding Path=(l:ShellData.ShellData).SearchCriteria[BooksResultView], RelativeSource={RelativeSource Self}}" /> <l:StyleTabStrip Grid.Row="2" ShellResultView="{Binding ElementName=BooksResultView}" /> </Grid> </TabItem> |
In this example, the base query, related to the Pages navigator is found in Fred4_Config.xml: Select entire section (from <BaseQuery Name="Fred4Pages" to </BaseQuery>, and copy it to the clipboard. Paste it in a new, empty line. Rename Fred4Books to Fred4Books. |
As we said above, the request is to display only edition templates. In order to do this, we need to remove the check-box control from the search fields, and add a hidden search criteria that lists only edition templates. Remove the check-box control The check-box control is: <attribute name="isTemplate" path="[page.editionRef.isTemplate]"> <ui > <template kind="CheckBox" opMode="Hidden"/> </ui> </attribute> Simply, delete entire above code. The original search condition is: <attribute path="[page.editionRef]"> <ui> <searchConditions> <SearchNode Op="And" xsi:type="ConditionSearchNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.teradp.com/schemas/GN4/1/SearchConditions.xsd"> <Left Op="Equal" xsi:type="ConditionSearchNode"> <Left xsi:type="AttributeSearchNode" Path="edition.isTemplate" /> <Right xsi:type="VariableSearchNode" Name="isTemplate" Type="Boolean" Optional="true"/> </Left> <Right Op="In" xsi:type="ConditionSearchNode"> <Left xsi:type="AttributeSearchNode" Path="edition.titleRef" /> <Right xsi:type="VariableSearchNode" Name="titleId" Type="IdList" Optional="true"/> </Right> </SearchNode> </searchConditions> <template kind="Single" opMode="Hidden"> <Sort> <SortDescription PropertyName="[edition.date]" IsAscending="false" /> </Sort> </template> </ui> </attribute>
Change the highlighted line to look like as below: <attribute path="[page.editionRef]"> <ui> <searchConditions> <SearchNode Op="And" xsi:type="ConditionSearchNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.teradp.com/schemas/GN4/1/SearchConditions.xsd"> <Left Op="Equal" xsi:type="ConditionSearchNode"> <Left xsi:type="AttributeSearchNode" Path="edition.isTemplate" /> <Right xsi:type="IntegerSearchNode" Value="1"/> </Left> <Right Op="In" xsi:type="ConditionSearchNode"> <Left xsi:type="AttributeSearchNode" Path="edition.titleRef" /> <Right xsi:type="VariableSearchNode" Name="titleId" Type="IdList" Optional="true"/> </Right> </SearchNode> </searchConditions> <template kind="Single" opMode="Hidden"> <Sort> <SortDescription PropertyName="[edition.date]" IsAscending="false" /> </Sort> </template> </ui> </attribute> |