/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: JspC/ApacheTomcat9
 * Generated at: 2026-02-11 20:30:10 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.node.model.NodeDetail;
import java.util.Collection;
import java.util.Iterator;
import org.silverpeas.components.kmelia.control.KmeliaSessionController;
import org.silverpeas.core.web.util.viewgenerator.html.GraphicElementFactory;
import org.silverpeas.core.web.util.viewgenerator.html.board.Board;
import org.silverpeas.core.web.util.viewgenerator.html.buttons.Button;
import org.silverpeas.core.web.util.viewgenerator.html.buttonpanes.ButtonPane;
import org.silverpeas.core.util.MultiSilverpeasBundle;
import org.silverpeas.core.i18n.I18NHelper;
import org.silverpeas.kernel.bundle.LocalizationBundle;
import java.util.ArrayList;
import org.owasp.encoder.Encode;

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



String m_context = ResourceLocator.getGeneralSettingBundle().getString("ApplicationURL");
//Icons
String axisUpdate = m_context + "/util/icons/update.gif";

String getAxisAllLabel(int valueMaxLength, KmeliaSessionController kmeliaScc) {

      int nbSpaces = (valueMaxLength - kmeliaScc.getString("AllComponents").length()) / 2;
      String allLabel = "";
      for (int i = 1; i <= nbSpaces; i++)
          allLabel += ".";
      allLabel = kmeliaScc.getString("AllComponents");
      for (int j = 1; j <= nbSpaces; j++)
          allLabel += ".";
      return allLabel;
}

String getTimeAxis(KmeliaSessionController kmeliaScc, LocalizationBundle timeSettings, String defaultValue) {

      List keys = kmeliaScc.getTimeAxisKeys();
      StringBuffer axis = new StringBuffer(1000);
			axis.append("<div class=\"oneAxis\"  id=\"axisTime\">");
				axis.append("<label for=\"timeAxis\">"+kmeliaScc.getString("TimeAxis")+"</label>");
					axis.append("<select id=\"timeAxis\" name=\"\" size=\"1\">");
						String key = "";
						StringBuffer values = new StringBuffer(1000);
						String value = "";
						String selectValue = ""; 
						int valueMaxLength = 0;
						
						for (int i = 0; i < keys.size(); i++) {
						selectValue = "";
						key = ((Integer) keys.get(i)).toString();
						value = timeSettings.getString(key);
						
						if (value.length() > valueMaxLength)
							valueMaxLength = value.length();
						
						if (key.equals(defaultValue))
							selectValue = "selected";
						   
						values.append("<option value=\""+key+"\""+selectValue+">"+value+"</option>");
						}
						
						axis.append("<option value=\"X\">"+kmeliaScc.getString("AllComponents")+"</option>");
						axis.append(values);
					axis.append("</select>");

			axis.append("</div>");
    return axis.toString();
}

List getAxis(KmeliaSessionController kmeliaScc, boolean axisLinked, List combination, String translation) {
      List list = kmeliaScc.getAxis();
      Iterator iterator = list.iterator();
      ArrayList axisList = new ArrayList();
      if (iterator.hasNext()) {
            String axisName = "";
            int axisNb = 0;
            StringBuffer axis = new StringBuffer(1000);
            String selectValue = "";
            while (iterator.hasNext()) {
                  NodeDetail node = (NodeDetail) iterator.next();
                  if (node.getLevel() == 2) {
                      //It's an axis
                      axisName = node.getName(translation);
                      axisNb++;
                      if (axis.length()>0) {
						axis.append("</select>");
			
				axis.append("</div>");
                          axisList.add(axis.toString());
                          axis = new StringBuffer(1000);
                      }
                      axis.append("<div  class=\"oneAxis\" id=\"axis"+node.getNodePK().getId()+"\">");
                              if (axisLinked)
                                  axis.append("<label onclick=\"axisManage('"+node.getNodePK().getId()+"')\" for=\"axe"+node.getNodePK().getId()+"\">"+ Encode.forHtml(node.getName(translation))+"</label><a  title=\""+kmeliaScc.getString("Update")+" \"  href=\"javaScript:axisManage('"+node.getNodePK().getId()+"')\" class=\"action\"><img alt=\""+kmeliaScc.getString("Update")+" \" src=\""+axisUpdate+"\"/></a>");
                              else
                                  axis.append("<label for=\"axe"+node.getNodePK().getId()+"\">"+
										  Encode.forHtml(node.getName(translation))+"</label>");
                              
                                        if (axisLinked)
                                          axis.append("<select class=\"axis\" id=\"axe"+node.getNodePK().getId()+"\" name=\""+node.getNodePK().getId()+"\" size=\"1\" onchange=\"positionManage(this)\">");
                                        else
                                          axis.append("<select class=\"axis\" id=\"axe"+node.getNodePK().getId()+"\" name=\""+node.getNodePK().getId()+"\" size=\"1\">");
                                        axis.append("<option value=\""+node.getPath()+node.getNodePK().getId()+"\">"+kmeliaScc.getString("AllComponents")+"</option>");
                  } else if (node.getLevel() == 3) {
                      selectValue = "";
										  if (combination.contains(node.getPath()+node.getId()))
                           selectValue = "selected";
						 				  axis.append("<option value=\""+node.getPath()+node.getNodePK().getId()+"|"+Encode.forHtml(axisName)+"\" class=\"intfdcolor51\" "+selectValue+">"+Encode.forHtml(node.getName(translation))+"</option>");
	                  } else {
	                      String spaces = "";
	                      for (int i=0; i<node.getLevel()-3; i++)
	                        spaces += "&nbsp;&nbsp;&nbsp;&nbsp;";
		                    selectValue = "";
											  if (combination.contains(node.getPath()+node.getId()))
	                            selectValue = "selected";
											  axis.append("<option value=\""+node.getPath()+node.getNodePK().getId()+"|"+Encode.forHtml(axisName)+"\" class=\"intfdcolor5\" "+selectValue+">"+spaces+Encode.forHtml(node.getName(translation))+"</option>");
	                  }
 			           }
						axis.append("</select>");
			
				axis.append("</div>");
      axisList.add(axis.toString());
      }

      return axisList;
}

String displayAxisCombinationToUsers(KmeliaSessionController kmeliaScc, GraphicElementFactory gef, List combination, String timeCriteria, String translation) {
    String result = displayAxis(kmeliaScc, gef, false, true, combination, timeCriteria, kmeliaScc.isTimeAxisUsed(), null, translation);
    return result;
}

String displayAxisToUsers(KmeliaSessionController kmeliaScc, GraphicElementFactory gef, String translation) {
    String result = displayAxis(kmeliaScc, gef, false, true, new ArrayList(), null, kmeliaScc.isTimeAxisUsed(), null, translation);
    return result;
}

String displayAxisToPublish(KmeliaSessionController kmeliaScc, GraphicElementFactory gef, String translation) {
	String result;
	List currentCombination = new ArrayList();
	if (kmeliaScc.getCurrentCombination() != null)
		currentCombination = kmeliaScc.getCurrentCombination();
    result = displayAxis(kmeliaScc, gef, false, true, currentCombination, null, false, null, translation);
    return result;
}

String displayAxisToAdmins(KmeliaSessionController kmeliaScc, GraphicElementFactory gef, String translation) {
    String result = displayAxis(kmeliaScc, gef, true, false, new ArrayList(), null, false, kmeliaScc.getString("AdminExplaination"), translation);
    return result;
}

String displayAxis(KmeliaSessionController kmeliaScc, GraphicElementFactory gef, boolean axisLinked, boolean searchEnabled, List combination,  String timeCriteriaValue, boolean timeAxisEnabled, String explaination, String translation) {
    StringBuffer result = new StringBuffer(1000);
    List axisList = getAxis(kmeliaScc, axisLinked, combination, translation);
    
    if (timeAxisEnabled && axisList.size() > 0) {
        //get the time axis
        LocalizationBundle timeSettings = ResourceLocator.getLocalizationBundle("org.silverpeas.kmelia.multilang.timeAxisBundle", kmeliaScc.getLanguage());
        axisList.add(getTimeAxis(kmeliaScc, timeSettings,  timeCriteriaValue));
    }
    
    Board board = gef.getBoard();

    int nbCol = 3;
    result.append("<form name=\"axisForm\" action=\"\" method=\"post\">");
	if (axisLinked) {
		result.append("<div class=\"axisManagment\">");
	} else {
		result.append("<div class=\"sousNavBulle\">");
	}
	    
			    Iterator i = axisList.iterator();
			    if (i.hasNext()) {
			        
			          while (i.hasNext()) {
			            String axis = (String) i.next();
			            result.append(axis);
			          }
			         
			    }
			

	
		if (searchEnabled && (axisList.size() > 0)) {
	    ButtonPane lebouton = gef.getButtonPane();
        Button validerButton = gef.getFormButton(kmeliaScc.getString("Validate"), "javaScript:search()", false);
        lebouton.addButton(validerButton);
        lebouton.setVerticalPosition();
        lebouton.setHorizontalPosition();
		result.append("<div id=\"btnForm\">");
		result.append(lebouton.print());
		result.append("</div>");}
	
	result.append("<br clear=\"all\"/>");
	result.append("</div>");
	


	result.append("</form>");
	result.append("<br clear=\"all\"/>");
	return result.toString();
}

String displayAxisManageView(KmeliaSessionController kmeliaScc, GraphicElementFactory gef, String axisId, String mandatoryFieldSrc, MultiSilverpeasBundle resources, String translation) {
    NodeDetail axis = kmeliaScc.getNodeHeader(axisId);
    StringBuffer result = new StringBuffer(1000);
    
    Board board = gef.getBoard();
    result.append(board.printBefore());

		result.append("<form name=\"axisManagerForm\" method=\"post\">");
			result.append("<input type=\"hidden\" name=\"Id\" value=\""+axisId+"\"/>");
			
			result.append("<table align=\"center\" cellpading=\"5\" cellspacing=\"5\" border=\"0\" width=\"100%\">");
				result.append("<tr>");
					result.append("<td>&nbsp;</td><td colspan=\"5\" class=\"txtnav\"><b>"+kmeliaScc.getString("AxisInformations")+" </b></td>");
	            result.append("</tr>");
	
	            result.append(I18NHelper.getFormLine(resources, axis, translation));
	            
	            result.append("<tr>");
					result.append("<td width=\"20%\" class=\"txtlibform\">"+kmeliaScc.getString("AxisTitle")+" : </td>");
					result.append("<td>"); 
						result.append("<input type=\"text\" id=\"nodeNameValue\" name=\"Name\" value=\""+Encode.forHtml(axis.getName(translation))+"\" size=\"61\" maxlength=\"50\">&nbsp;<img alt=\"\" src=\""+mandatoryFieldSrc+"\" border=\"0\"  width=\"5px\"  height=\"5px\" />");
					result.append("</td>");
					result.append("<td>&nbsp;</td>");
					result.append("<td>&nbsp;</td>");
					result.append("<td>&nbsp;</td>");
					result.append("<td>&nbsp;</td>");
				result.append("</tr>");
	            result.append("<tr>"); 
					result.append("<td width=\"20%\" class=\"txtlibform\">"+kmeliaScc.getString("AxisDescription")+" : </td>");
					result.append("<td>"); 
						result.append("<textarea id=\"nodeDesc\" name=\"Description\" cols=\"60\" rows=\"5\" wrap=\"physical\">"+axis.getDescription(translation)+"</textarea>");
					result.append("</td>");
					result.append("<td colspan=\"4\">&nbsp;");
					result.append("</td>");
				result.append("</tr>");
	            result.append("<tr>");
					result.append("<td colspan=\"6\"t>( <img alt=\" \" border=\"0\" src=\""+mandatoryFieldSrc+"\" width=\"5px\" height=\"5px\" /> : "+kmeliaScc.getString("ChampsObligatoires")+" ) </td>");
	            result.append("</tr>");
	            result.append("<tr>"); 
					result.append("<td colspan=\"6\">"); 
	
	                ButtonPane lebouton = gef.getButtonPane();
	                Button ajouterButton = gef.getFormButton(kmeliaScc.getString("AddComponent"), "javaScript:addPositionToAxis('"+axisId+"')", false);
	                Button validerButton = gef.getFormButton(kmeliaScc.getString("Validate"), "javaScript:axisUpdate()", false);
	                Button supprimerButton = gef.getFormButton(kmeliaScc.getString("DeleteAxis"), "javaScript:axisDelete()", false);
	
	                lebouton.addButton(validerButton);
	                lebouton.addButton(ajouterButton);
	                lebouton.addButton(supprimerButton);
	
	                lebouton.setVerticalPosition();
	                lebouton.setHorizontalPosition();
	
					result.append("</td>");
				result.append("</tr>");
			result.append("</table>");
		
		result.append("</form>");

        result.append(board.printAfter());
          
	result.append("<center><br/>");
	result.append(lebouton.print());
	result.append("</br></center>");
	result.append("<script language=\"javascript\">document.axisManagerForm.Name.focus();</script>");
    return result.toString();
}

String displayComponentManageView(KmeliaSessionController kmelia, GraphicElementFactory gef, String componentId, String path, String mandatoryFieldSrc, MultiSilverpeasBundle resources, String translation) {
    NodeDetail nodeDetail = kmelia.getNodeHeader(componentId);
    StringBuffer result = new StringBuffer(1000);
    Board board = gef.getBoard();
    result.append(board.printBefore());
		
    result.append("<form name=\"axisManagerForm\" method=\"post\">");
		result.append("<input type=\"hidden\" name=\"Id\" value=\""+componentId+"\">");
		result.append("<table align=\"center\" cellpading=\"5\" cellspacing=\"5\" border=\"0\" width=\"100%\">");
			result.append("<tr>");
				result.append("<td>&nbsp;</td><td colspan=\"5\"  class=\"txtnav\"><b>"+kmelia.getString("ComponentInformations")+" </b></td>");
			result.append("</tr>");
            result.append("<tr>"); 
				result.append("<td width=\"20%\" class=\"txtlibform\">"+kmelia.getString("ComponentFather")+ " : </td>");
				result.append("<td>"); 
				result.append(path);
				result.append("</td>");
				result.append("<td>&nbsp;</td>");
				result.append("<td>&nbsp;</td>");
				result.append("<td>&nbsp;</td>");
				result.append("<td>&nbsp;</td>");
            result.append("</tr>");
            result.append(I18NHelper.getFormLine(resources, nodeDetail, translation));
            result.append("<tr>"); 
				result.append("<td width=\"20%\" class=\"txtlibform\">"+kmelia.getString("ComponentTitle")+" : </td>");
				result.append("<td>"); 
					result.append("<input type=\"text\" id=\"nodeNameValue\" name=\"Name\" value=\""+Encode.forHtml(nodeDetail.getName(translation))+"\" size=\"61\" maxlength=\"50\">&nbsp;<img alt=\"  \" src=\""+mandatoryFieldSrc+"\" border=\"0\"  width=\"5px\" height=\"5px\" />");
				result.append("</td>");
				result.append("<td>&nbsp;</td>");
				result.append("<td>&nbsp;</td>");
				result.append("<td>&nbsp;</td>");
				result.append("<td>&nbsp;</td>");
            result.append("</tr>");
            result.append("<tr>"); 
				result.append("<td width=\"20%\" class=\"txtlibform\">"+kmelia.getString("ComponentDescription")+" : </td>");
				result.append("<td>"); 
					result.append("<textarea id=\"nodeDesc\" name=\"Description\" cols=\"60\" rows=\"5\" wrap=\"PHYSICAL\">"+nodeDetail.getDescription(translation)+"</textarea>");
				result.append("</td>");
				result.append("<td colspan=\"4\">&nbsp;");
				result.append("</td>");
			result.append("</tr>");
            result.append("<tr>");
				result.append("<td colspan=\"6\" >( <img  alt=\" \"  border=\"0\" src=\""+mandatoryFieldSrc+"\" width=\"5px\" height=\"5px\" /> : "+kmelia.getString("ChampsObligatoires")+" ) </td>");
            result.append("</tr>");
          
            result.append("<tr>");
				result.append("<td colspan=\"6\">"); 

                ButtonPane lebouton = gef.getButtonPane();
                Button ajouterButton = gef.getFormButton(kmelia.getString("AddComponent"), "javaScript:addPositionToPosition('"+componentId+"')", false);
                Button validerButton = gef.getFormButton(kmelia.getString("Validate"), "javaScript:positionUpdate()", false);
                Button supprimerButton = gef.getFormButton(kmelia.getString("DeleteComponent"), "javaScript:positionDelete()", false);

                lebouton.addButton(validerButton);
                lebouton.addButton(ajouterButton);
                lebouton.addButton(supprimerButton);

                lebouton.setVerticalPosition();
                lebouton.setHorizontalPosition();

                result.append("</td>");
            result.append("</tr>");
   		 result.append("</table>");
	result.append("</form>");

    result.append(board.printAfter());
	result.append("<center><br>");
	result.append(lebouton.print());
	result.append("</br></center>");
	result.append("<script language=\"javascript\">document.axisManagerForm.Name.focus();</script>");
    return result.toString();
}

String displayPath(Collection path, boolean linked, int beforeAfter, String translation) {
      String linkedPathString = new String();
      String pathString = new String();
      int nbItemInPath = path.size();
      Iterator iterator = path.iterator();
      boolean alreadyCut = false;
      int i = 0;
      while (iterator.hasNext()) {
            NodeDetail nodeInPath = (NodeDetail) iterator.next();
            if (nodeInPath.getLevel() != 1) {
              if ((i <= beforeAfter) || (i + beforeAfter >= nbItemInPath - 1)){
                  linkedPathString +=
						  "<a href=\"javascript:onClick=topicGoTo('"+nodeInPath.getNodePK().getId()+"')\">"+Encode.forHtml(nodeInPath.getName(translation))+"</a>";
                  pathString += Encode.forHtml(nodeInPath.getName(translation));
                  if (iterator.hasNext()) {
                        linkedPathString += " > ";
                        pathString += " > ";
                  }
             } else {
                  if (!alreadyCut) {
                        linkedPathString += " ... > ";
                        pathString += " ... > ";
                        alreadyCut = true;
                  }
             }
             i++;
           }
      }
      if (linked)
          return linkedPathString;
      else
          return pathString;
}



  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<>(18);
    _jspx_imports_classes.add("java.util.Iterator");
    _jspx_imports_classes.add("java.util.Collection");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.GraphicElementFactory");
    _jspx_imports_classes.add("org.silverpeas.core.util.MultiSilverpeasBundle");
    _jspx_imports_classes.add("org.silverpeas.components.kmelia.control.KmeliaSessionController");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.board.Board");
    _jspx_imports_classes.add("org.silverpeas.core.node.model.NodeDetail");
    _jspx_imports_classes.add("java.util.ArrayList");
    _jspx_imports_classes.add("org.silverpeas.kernel.bundle.LocalizationBundle");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.buttonpanes.ButtonPane");
    _jspx_imports_classes.add("org.owasp.encoder.Encode");
    _jspx_imports_classes.add("org.silverpeas.core.i18n.I18NHelper");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.buttons.Button");
  }

  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\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);
    }
  }
}
