Forum Discussion
xorrkaz
15 years agoGenius
We took this example, and added a widget that does both questions without reply and questions without solutions. Here's our combined code.
<div class="lia-panel lia-panel-standard custom-combined-unresolved-issues-wrapper">
<form>
<select style="margin: 0 0 10px 5px; background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #808080; color: #333333;font-family: Arial; font-size: 12px; font-weight: normal;" id="combined_unresolved_select" name="unresolved_type" onchange="combined_handle_change(this.options[this.selectedIndex].value);">
<option id="unresolved_issues_option" value="no_solutions">Questions Without Solutions</option>
<option id="no_reply_option" value="no_replies">Questions Without Replies</option>
</select>
</form>
</div>
<div id="combined_no_replies_div" class="lia-panel lia-panel-standard top-fifteen-threads-with-no-replies-wrapper" style="visibility: hidden; display: none;">
<#assign pid = coreNode.id />
<#if pid != "">
<#assign messages = rest("/boards/id/" + pid + "/search/messages?openresponse=true&include_forums=true&sort_by=-topicPostDate&page_size=15&restapi.response_style=view").messages />
<ul>
<#list messages.message as message>
<li style="margin: 0 0 5px 10px;"><a href="${message.@view_href}"><img src="${skin.images.icon_thread.url}" class="lia-node-icon" style="float: left; margin-right: 10px;"/> ${message.subject}</a></li>
</#list>
</ul>
</#if>
</div>
<div id="combined_no_solutions_div" class="unresolved-issues-wrapper">
<#if pid != "">
<#assign threads = rest("/boards/id/" + pid + "/threads/recent?restapi.response_style=view&page_size=15").threads />
<ul>
<#list threads.thread as thread>
<#if thread.solutions?size == 0 || thread.solutions.solution?size == 0>
<li style="margin: 0 0 5px 10px;"><a href="${thread.@view_href}"><img src="${skin.images.icon_thread.url}" class="lia-node-icon" style="float: left; margin-right: 10px;"/> ${thread.messages.topic.subject}</a></li>
</#if>
</#list>
</ul>
</#if>
</div>
</div>
<@liaAddScript>
function combined_handle_change(option) {
var no_replies_div = document.getElementById("combined_no_replies_div");
var no_solutions_div = document.getElementById("combined_no_solutions_div");
if (option == "no_solutions") {
no_solutions_div.style.visibility = "visible";
no_solutions_div.style.display = "inline";
no_replies_div.style.visibility = "hidden";
no_replies_div.style.display = "none";
} else {
no_replies_div.style.visibility = "visible";
no_replies_div.style.display = "inline";
no_solutions_div.style.visibility = "hidden";
no_solutions_div.style.display = "none";
}
}
</@liaAddScript>