tweaks.naml

<macro name="subapps_with_hidden_topics">
    <n.comment.>Comma-separated IDs of subapps whose topics are not displayed at the top level</n.comment.>
    3456798
</macro>

<!-- don't show topics from some subapps at the root level -->
<macro name="special_app_topic_filter" requires="node_page,servlet">
    <n.if.page_node.is_root>
        <then>
            <n.compress.>
                <n.separate>
                    <text1>
                        parent_id not in (<n.subapps_with_hidden_topics/>)
                    </text1>
                    <separator>
                        and
                    </separator>
                    <text2>
                        <n.hide_null.app_topic_filter />
                    </text2>
                </n.separate>
            </n.compress.>
        </then>
        <else.app_topic_filter/>
    </n.if.page_node.is_root>
</macro>

<!-- fix topic count in the root level -->
<override_macro name="app_topic_count" requires="node_page,servlet">
    <n.remove_spaces.>
        <n.if.page_node.is_root>
            <then>
                <n.set_var. name="count"><n.page_node.topic_count filter="[n.app_topic_filter/]"/></n.set_var.>
                <n.string_list. values="[n.subapps_with_hidden_topics/]" separator="," trim="[n.true/]">
                    <n.loop.>
                        <n.int>
                            <i.var name="count"/>
                            <do>
                                <n.set_var. name="count">
                                    <n.minus>
                                        <i.get_node_from_id. node_id="[n.current_string/]">
                                            <n.topic_count/>
                                        </i.get_node_from_id.>
                                    </n.minus>                                                                                
                                </n.set_var.>
                            </do>
                        </n.int>
                    </n.loop.>
                </n.string_list.>
                <n.var name="count"/>
            </then>
            <else.page_node.topic_count filter="[n.app_topic_filter/]" />
        </n.if.page_node.is_root>    
    </n.remove_spaces.>
</override_macro>

<override_macro name="topics_table" dot_parameter="columns">
    <div style="clear:both"></div>
    <table class="main medium-border-color">
        <n.table_header.>
            <tr class="header-row shaded-bg-color">
                <n.columns/>
            </tr>
        </n.table_header.>
        <n.page_node.topics_list.
        start="[n.app_index_record/]"
        length="[n.app_rows_per_page/]"
        sort="[n.topics_table_sort/]"
        filter="[n.special_app_topic_filter/]"
        >
            <n.loop.>
                <tr class="[n.even_row_background/] main-row">
                    <n.columns/>
                </tr>
                <n.if.next_node>
                    <then>
                        <tr class="[n.odd_row_background/] light-bg-color main-row">
                            <n.columns/>
                        </tr>
                    </then>
                </n.if.next_node>
            </n.loop.>
        </n.page_node.topics_list.>
        <n.if.not.page_node.has_topics filter="[n.app_topic_filter/]">
            <then>
                <tr>
                    <td></td>
                    <td colspan="10" style="padding:.8em 0">
                        <t>Empty</t>
                    </td>
                </tr>
            </then>
        </n.if.not.page_node.has_topics>
    </table>
    <div style="clear:both"></div>
</override_macro>