Posted by
jsmoraes on
URL: https://support.nabble.com/Option-to-solve-topics-Give-XP-tp7588730.html
The user Nitemare post a question in
http://support.nabble.com/Option-to-solve-topics-amp-Give-XP-td7588566.html#a7588728 about the possibility to change the appearance of main page and topic page for support community/forums.
I tryied some lines of code, and got the following:


The ideia is to have icon that identify topics with solved questions in main page, and icon in topic page that identify the question and the message with answer.
The implematation of code to Give XP was ignored. This is another issue. Out of my scope.
An issue was found:
There isn't field to solved status, similar to pinned status in database. Therefore I decided to flag the subect of messages to identify them. And I am using the symbol ¬ for message with answer and .¬ to message with question. They will used to decisions in the code.
issue: I need trim them to show in the page, and other situations. Not only for better appearance, but as someone can reply the flagged message, this flag will propagate, and the icon too.
Up to now, I don't know how to trim them. The best position of the flag in the subject text should be the left side. And a kind of function left strig can be used to clearing.
I didn't find, and I don't know if exist, any macro that use this function in NAML. And I don't know how to call a JAVA function from a macro NAML, without be inside of HTML tag: as input button and under onclick event.
I need trim the text returned by macros:
n.title,
n.break_up.page_node.subject and
n.node_text.textAny information and help will be welcome ! 
I know that they aren't the best lines of code, and I don't know if they will cause any problem with the performance of the pages or speed to open them. I did the work in a small test forum.
The full code:
Icon in main page:
<override_macro name="smart_post_link" requires="node" dot_parameter="href" parameters="text, title, class">
<n.if.is_post>
<then>
<n.if.contains_substring string="[n.node_text.text/]" substring=" .¬">
<then>
<img src="http://jsmtstnaml.23557.n7.nabble.com/file/n83/checkmark.png" /> <a href="[n.node_href.href/]" title="[n.title/]" class="[n.hide_null.class/] post-link[n.topic_node.id/]" node-id="[n.id/]"><n.node_text.text/></a>
<n.call_later value="[n.topic_node.id/]" param="markUnreadTopics"/>
</then>
<else>
<a href="[n.node_href.href/]" title="[n.title/]" class="[n.hide_null.class/] post-link[n.topic_node.id/]" node-id="[n.id/]"><n.node_text.text/></a>
<n.call_later value="[n.topic_node.id/]" param="markUnreadTopics"/>
</else>
</n.if.contains_substring>
</then>
<else.node_link text="[n.text/]"/>
</n.if.is_post>
</override_macro>
Icon in title of topic page:
<override_macro name="topic_header">
<div id="topic-search-box" class="search-box float-right" style="padding:.5em 0">
<n.page_node.search_box/>
</div>
<n.if.contains_substring string="[n.break_up.page_node.subject/]" substring=" .¬">
<then>
<h1 id="post-title" class="adbayes-content" style="margin:0.25em 0 .8em"><img src="http://jsmtstnaml.23557.n7.nabble.com/file/n83/checkmark.png" /> <n.break_up.page_node.subject/></h1>
</then>
<else>
<h1 id="post-title" class="adbayes-content" style="margin:0.25em 0 .8em">
<n.break_up.page_node.subject/>
</h1>
</else>
</n.if.contains_substring>
</override_macro>
Icons of messages in topic page:
<override_macro name="classic_subject_line" requires="node">
<n.if.contains_substring string="[n.break_up.subject/]" substring="¬">
<then>
<n.if.contains_substring string="[n.break_up.subject/]" substring=" ¬">
<then>
<h2 class="post-subject float-left adbayes-content" style="width:30%;overflow:visible;font-family:inherit">
<img src="http://jsmtstnaml.23557.n7.nabble.com/file/n81/iconsolucionado.png" /> <n.break_up.subject/>
</h2>
</then>
<else>
<h2 class="post-subject float-left adbayes-content" style="width:30%;overflow:visible;font-family:inherit">
<img src="http://jsmtstnaml.23557.n7.nabble.com/file/n80/iconsolucionado2.png" /> <n.break_up.subject/>
</h2>
</else>
</n.if.contains_substring>
</then>
<else>
<h2 class="post-subject float-left adbayes-content" style="width:30%;overflow:visible;font-family:inherit">
<n.break_up.subject/>
</h2>
</else>
</n.if.contains_substring>
</override_macro>