/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: JspC/ApacheTomcat9
 * Generated at: 2026-05-07 07:01:29 UTC
 * Note: The last modified time of this file was set to
 *       the last modified time of the source file after
 *       generation to assist with modification tracking.
 */
package org.apache.jsp.kmelia.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.silverpeas.core.util.URLUtil;
import org.silverpeas.core.contribution.publication.model.PublicationDetail;
import org.silverpeas.components.kmelia.control.KmeliaSessionController;
import org.silverpeas.components.kmelia.model.KmeliaPublication;
import org.silverpeas.core.index.search.model.MatchingIndexEntry;
import org.silverpeas.core.util.MultiSilverpeasBundle;
import java.text.NumberFormat;
import java.util.Collection;
import java.util.Iterator;
import org.silverpeas.core.admin.user.model.User;
import org.silverpeas.core.util.WebEncodeHelper;
import org.silverpeas.core.util.DateUtil;

public final class publicationsList_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent,
                 org.apache.jasper.runtime.JspSourceImports {


String getUserName(KmeliaPublication kmeliaPub, KmeliaSessionController kmeliaScc)
{
	User user		= kmeliaPub.getCreator(); //contains creator
	PublicationDetail	pub			= kmeliaPub.getDetail();
	String 				updaterId	= pub.getUpdaterId();
	User			updater		= null;
	if (updaterId != null && !updaterId.isEmpty())
		updater = kmeliaScc.getUserDetail(updaterId);
	if (updater == null)
		updater = user;

	String userName = "";
	if (updater != null && (!updater.getFirstName().isEmpty() || !updater.getLastName().isEmpty()))
		userName = updater.getFirstName() + " " + updater.getLastName();
	else
		userName = kmeliaScc.getString("kmelia.UnknownUser");

	return userName;
}

void displaySameSubjectPublications(Collection pubs, String publicationLabel, KmeliaSessionController kmeliaScc, String currentPubId, boolean checkboxAllowed, MultiSilverpeasBundle resources, JspWriter out) throws IOException {

    PublicationDetail 	pub;
    KmeliaPublication 	kmeliaPub;
    User 			user;
   	String				language = kmeliaScc.getCurrentLanguage();

    Iterator iterator = pubs.iterator();

	out.println("<table border=\"0\" width=\"98%\" align=center>");
	out.println("<form name=\"seeAlsoForm\" Action=\"DeleteSeeAlso\" method=\"Post\"/>");
	out.println("<input type=\"hidden\" name=\"PubId\" value=\"\"/>");
    out.println("<tr>");
          out.println("<td>");
          out.println("<!-- Publications Header -->");
          out.println("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
            out.println("<tr>");
                out.println("<td width=\"40\"><img src=\""+resources.getIcon("kmelia.publication")+"\" border=0></td>");
                out.println("<td align=\"left\" width=\"100%\"><b>"+publicationLabel+"</b></td>");
            out.println("</tr>");
          if (iterator.hasNext()) {
           	out.println("<tr><td colspan=\"2\">&nbsp;</td></tr>");
            out.println("<!-- Publications Header End -->");
            while (iterator.hasNext()) {
                kmeliaPub = (KmeliaPublication) iterator.next();
                pub = kmeliaPub.getDetail();
                user = kmeliaPub.getCreator();
                out.println("<!-- Publication Body -->");
                  if ( pub.getStatus() != null && pub.getStatus().equals("Valid") && !pub.getPK().getId().equals(currentPubId)) {
                      out.println("<tr class=\"important\""+pub.getImportance()+">");
                        out.print("<td valign=\"top\" colspan=\"2\">");
                      	out.print("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"middle\">");
                      	if (checkboxAllowed)
                      		out.print("<td align=\"center\"><input type=\"checkbox\" name=\"PubIds\" value=\""+pub.getPK().getId()+"-"+pub.getPK().getInstanceId()+"\"></td>");
						out.print("<td width=\"1\">&#149;&nbsp;</td><td nowrap>");
						out.print("<a href=\""+
                URLUtil.getSimpleURL(URLUtil.URL_PUBLI, pub.getPK().getId(), pub.getPK().getInstanceId())+"\"><b>"+
                WebEncodeHelper.javaStringToHtmlString(pub.getName(language))+"</b></a>");
						out.print("&nbsp;</td><td width=\"100%\">");
						out.print("&nbsp;");
						out.println("</td>");
						out.println("</tr>");
						out.println("<tr>");
						if (checkboxAllowed)
							out.println("<td width=\"1\">&nbsp;</td>");
						out.println("<td width=\"1\">&nbsp;</td>");
						out.println("<td colspan=\"3\">"+getUserName(kmeliaPub, kmeliaScc)+" - "+resources.getOutputDate(pub.getLastUpdateDate())+"<br/>");
						out.println(WebEncodeHelper.javaStringToHtmlParagraphe(pub.getDescription(language))+"<br/><br/></td>");
						out.println("</td></tr></table>");
						out.println("</td>");
                      out.println("</tr>");
                  }
                out.println("<!-- Publication Body End -->");
            } // End while
            out.println("</table>");
          } // End if
          else
		  {
              out.println("<tr>");
              out.println("<td>&nbsp;</td>");
              out.println("<td>"+kmeliaScc.getString("PubAucune")+"</td>");
              out.println("</tr>");
              out.println("</table>");
          }
          out.println("</td>");
          out.println("<td valign=\"top\" colspan=\"2\" width=\"80\">");
					out.println("&nbsp;");
          out.println("</td>");
          out.println("</tr>");
          out.println("</form>");
out.println("</table>");
}

void displaySearchResults(List<MatchingIndexEntry> pubs, String publicationLabel, KmeliaSessionController kmeliaScc, String currentPubId, MultiSilverpeasBundle resources, JspWriter out) throws IOException, java.text.ParseException {

      out.println("<!-- Publications Header -->");
          out.println("<table width=\"98%\" align=center border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
            out.println("<tr>");
                out.println("<td width=\"80\"><img src=\""+resources.getIcon("kmelia.publication")+"\" border=0></td>");
                out.println("<td align=\"left\"><b>"+publicationLabel+"</b></td>");
          if (pubs!=null && !pubs.isEmpty()) {
                out.println("<td align=\"right\" valign=\"middle\">");
                out.println("&nbsp;");
                out.println("</td>");
            out.println("</tr>");
            out.println("<tr><td colspan=\"2\" >&nbsp;</td></tr>");
            out.println("<!-- Publications Header End -->");
            for (MatchingIndexEntry pub : pubs) {
                  out.println("<!-- Publication Body -->");
                  if (!pub.getObjectId().equals(currentPubId)) {
                      if (pub.getObjectType().equals("Publication")) {
							String userName = "";
							User user = User.getById(pub.getCreationUser());
							if (user != null) {
                userName = user.getDisplayedName();
              } else{
                userName = kmeliaScc.getString("UnknownAuthor");
              }
                          out.println("<tr>");
                            out.println("<td valign=\"top\" width=\"80\" align=\"center\"></td>");
                            out.println("<td valign=\"top\" colspan=\"2\">");
                             out.println("<p>&#149; <a href=\"javascript:onClick=publicationGoTo('"+pub.getObjectId()+"')\"><b>"+pub.getTitle()+"</b></a><br> "+userName+" - "+resources.getOutputDate(
                                 DateUtil.parseFromLucene(pub.getLastModificationDate()))+"<br/>");
                             out.println(""+Encode.forHtml(pub.getPreview())+"</p>");
                            out.println("</td>");
                          out.println("</tr>");
                      }
                   }
                  out.println("<!-- Publication Body End -->");
            } // End while
            out.println("</table>");
          } // End if
          else {
              out.println("<td align=\"right\" valign=\"middle\">&nbsp;</td>");
              out.println("<tr>");
              out.println("<td>&nbsp;</td>");
              out.println("<td>"+kmeliaScc.getString("PubAucune")+"</td>");
              out.println("</tr>");
              out.println("</table>");
          }
}

  private static final javax.servlet.jsp.JspFactory _jspxFactory =
          javax.servlet.jsp.JspFactory.getDefaultFactory();

  private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;

  private static final java.util.Set<java.lang.String> _jspx_imports_packages;

  private static final java.util.Set<java.lang.String> _jspx_imports_classes;

  static {
    _jspx_imports_packages = new java.util.LinkedHashSet<>(4);
    _jspx_imports_packages.add("javax.servlet");
    _jspx_imports_packages.add("javax.servlet.http");
    _jspx_imports_packages.add("javax.servlet.jsp");
    _jspx_imports_classes = new java.util.LinkedHashSet<>(16);
    _jspx_imports_classes.add("org.silverpeas.core.admin.user.model.User");
    _jspx_imports_classes.add("org.silverpeas.core.util.DateUtil");
    _jspx_imports_classes.add("org.silverpeas.core.index.search.model.MatchingIndexEntry");
    _jspx_imports_classes.add("java.util.Iterator");
    _jspx_imports_classes.add("org.silverpeas.components.kmelia.model.KmeliaPublication");
    _jspx_imports_classes.add("org.silverpeas.core.util.WebEncodeHelper");
    _jspx_imports_classes.add("java.util.Collection");
    _jspx_imports_classes.add("org.silverpeas.core.util.MultiSilverpeasBundle");
    _jspx_imports_classes.add("org.silverpeas.core.util.URLUtil");
    _jspx_imports_classes.add("org.silverpeas.components.kmelia.control.KmeliaSessionController");
    _jspx_imports_classes.add("org.silverpeas.core.contribution.publication.model.PublicationDetail");
    _jspx_imports_classes.add("java.text.NumberFormat");
  }

  private volatile javax.el.ExpressionFactory _el_expressionfactory;
  private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;

  public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
    return _jspx_dependants;
  }

  public java.util.Set<java.lang.String> getPackageImports() {
    return _jspx_imports_packages;
  }

  public java.util.Set<java.lang.String> getClassImports() {
    return _jspx_imports_classes;
  }

  public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
    if (_el_expressionfactory == null) {
      synchronized (this) {
        if (_el_expressionfactory == null) {
          _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
        }
      }
    }
    return _el_expressionfactory;
  }

  public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
    if (_jsp_instancemanager == null) {
      synchronized (this) {
        if (_jsp_instancemanager == null) {
          _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
        }
      }
    }
    return _jsp_instancemanager;
  }

  public void _jspInit() {
  }

  public void _jspDestroy() {
  }

  public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {

    if (!javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
      final java.lang.String _jspx_method = request.getMethod();
      if ("OPTIONS".equals(_jspx_method)) {
        response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
        return;
      }
      if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method)) {
        response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
        response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET, POST or HEAD. Jasper also permits OPTIONS");
        return;
      }
    }

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            if (response.isCommitted()) {
              out.flush();
            } else {
              out.clearBuffer();
            }
          } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
