/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: JspC/ApacheTomcat9
 * Generated at: 2025-10-31 18:26:33 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 java.util.List;
import org.silverpeas.core.node.model.NodeDetail;
import org.silverpeas.core.contribution.publication.model.Location;
import org.silverpeas.core.util.MultiSilverpeasBundle;
import org.silverpeas.kernel.util.Mutable;
import org.apache.ecs.xhtml.input;
import org.owasp.encoder.Encode;

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

  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<>(10);
    _jspx_imports_classes.add("java.util.List");
    _jspx_imports_classes.add("org.owasp.encoder.Encode");
    _jspx_imports_classes.add("org.silverpeas.kernel.util.Mutable");
    _jspx_imports_classes.add("org.apache.ecs.xhtml.input");
    _jspx_imports_classes.add("org.silverpeas.core.contribution.publication.model.Location");
    _jspx_imports_classes.add("org.silverpeas.core.util.MultiSilverpeasBundle");
    _jspx_imports_classes.add("org.silverpeas.core.node.model.NodeDetail");
  }

  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; charset=UTF-8");
      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");

MultiSilverpeasBundle resources = (MultiSilverpeasBundle)request.getAttribute("resources");

//noinspection unchecked
  List<NodeDetail> 	otherTree 	= (List<NodeDetail>) request.getAttribute("Tree");
String	currentLang = (String) request.getAttribute("Language");
//noinspection unchecked
  List<Location>	locations		= (List<Location>) request.getAttribute("Locations");

      out.write('\n');
      out.write('\n');
 if (otherTree != null) { 
      out.write("\n<table>\n  <caption>");
      out.print(resources.getMultilangBundle().getString("kmelia.publication.locations"));
      out.write("</caption>\n	<th id=\"locations\"></th>\n");

  for (NodeDetail topic : otherTree) {
    if (!topic.isBin() && !topic.isUnclassified()) {
      String name = Encode.forHtml(topic.getName(currentLang));

      StringBuilder ind = new StringBuilder();
      if(topic.getLevel() > 2) { // calcul chemin arbre
        int sizeOfInd = topic.getLevel() - 2;
        if(sizeOfInd > 0) {
          ind.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".repeat(sizeOfInd));
        }
      }
      name = ind + name;

      // recherche si ce dossier est dans la liste des dossiers de la publication
      final Mutable<String> aliasDecoration = Mutable.of("");
      final input topicChoiceInput = new input().setType("checkbox").setName("topicChoice").setValue(topic.getId()+","+topic.getNodePK().getInstanceId());
      topicChoiceInput.setClass(topic.getId()+"-"+topic.getNodePK().getInstanceId());
      topicChoiceInput.addAttribute("valign","absmiddle");
      topicChoiceInput.setOnClick("manageLocation('"+topic.getId()+"','"+topic.getNodePK().getInstanceId()+"', this)");
      locations.stream()
          .filter(l -> topic.getNodePK().equals(l))
          .findFirst()
          .ifPresent(l -> {
            topicChoiceInput.setChecked(true);
            if (l.isAlias()) {
              aliasDecoration.set("<span>&nbsp;</span><i>"+l.getAlias().getUserName()+" - "+resources.getOutputDateAndHour(l.getAlias().getDate())+"</i>");
            } else {
              topicChoiceInput.setReadOnly(true);
              topicChoiceInput.setDisabled(true);
              topicChoiceInput.setOnClick("return false");
            }
          });
      boolean displayCheckbox = false;
      if (topic.getUserRole()==null || !topic.getUserRole().equals("user")) {
        displayCheckbox = true;
        if ("writer".equals(topic.getUserRole())) {
          topicChoiceInput.setReadOnly(true);
          topicChoiceInput.setDisabled(true);
          topicChoiceInput.setOnClick("return false");
        }
      }
      out.println("<tr><td width=\"10px\">");
      if (displayCheckbox) {
        out.println(topicChoiceInput.toString());
      } else {
        out.println("&nbsp;");
      }
      out.println("</td><td nowrap=\"nowrap\">"+name+"</td><td align=\"right\">"+aliasDecoration.get()+"</td></tr>");
    }

  }

      out.write("\n</table>\n");
 } else {
    out.println(resources.getMultilangBundle().getString("kmelia.paths.app.noPublish"));
   }
      out.write('\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);
    }
  }
}
