<%--
  Copyright 2003 Sun Microsystems, Inc. All rights reserved 
  Use is subject to license terms.
 --%>
<%-- @(#)feedbackDisplay.jsp --%>

<search:getResult id="resultstream"/> 
<search:getNextResult input="$resultstream">
    <%-- Display Title --%>
    <search:getURL id="url"/>
    <jx:declare id="url" type="java.lang.String"/>
    <tr><td colspan="2">
    <% if (url.startsWith("comment")) { %>
	<a href="<%=dpurl%>?<%=channelName%>_dmode=vl&did=<%=Encoder.urlEncode(url)%>"><span class="discTitleHeader"><search:getValue attribute="title" escape="true"/><span></a>
    <% } else { %>
	<a href="<%=url%>"><span class="discTitleHeader"><search:getValue attribute="title" escape="true"/><span></a>
    <% } %>
    </td>
    </tr>
    <tr><td colspan="2">
    <%-- Display Author --%>
    <search:getValue attribute="author" id="author"/> 
    <jx:if test="$author != ''">
	<jx:if test="$author == 'authlessanonymous'">
	    <jx:set var="author" value="$anonymousAuthor"/>
	</jx:if>
	<span class="discTitle">Posted by <%=pageContext.getAttribute("author")%></span>
    </jx:if>

    <%-- Display Date --%>
    <search:getValue attribute="rd-last-changed" id="lastPost"/>
    <jx:declare id="lastPost" type="java.lang.String" />

    <jx:if test="$lastPost != ''">
	<% DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, locale); 
	try {
	    Date d = DateParser.parse(lastPost); %>
	    <span class="discTitle">on <%=df.format(d)%></span>
        <% } catch (Exception e) { } %>
    </jx:if>

    <%-- Display rating --%>
    <search:getValue attribute="rd-rating" id="pkrating"/> 
    <jx:if test="$pkrating != ''">
    <% 
        String pkrating = (String)pageContext.getAttribute("pkrating");
	int rtg = Integer.parseInt(pkrating); 
        if (pkrating.equals("-1")) { 
	   pkrating = "Irrelevant"; 
	} else if (pkrating.equals("0")) { 
	   pkrating = "Routine"; 
	} else if (pkrating.equals("1")) { 
	   pkrating = "Interesting"; 
	} else if (pkrating.equals("2")) { 
	   pkrating = "Important"; 
	} else if (pkrating.equals("3")) { 
	   pkrating = "Must Read"; 
	} else { 
	   pkrating = "Routine"; 
        } 
       %> 
       <span class="discRating">(<%=pkrating%>)</span>
    </jx:if>
    </td>
    </tr>

    <tr><td colspan="2" img="<dt:scontent/>/images/spacer.gif" width="1" height="10"></td>
    </tr>

    <tr>
    <td colspan="2" class="discDesc">
    <search:getValue attribute= "description" escape="true"/>
    </td>
    </tr>

    <tr><td colspan="2" img="<dt:scontent/>/images/spacer.gif" width="1" height="10"></td>
    </tr>
</search:getNextResult> 
