/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: JspC/ApacheTomcat9
 * Generated at: 2026-06-22 10:18:16 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.projectManager.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.silverpeas.core.util.MultiSilverpeasBundle;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Vector;
import java.util.Iterator;
import java.util.Collection;
import org.silverpeas.core.web.util.viewgenerator.html.Encode;
import org.silverpeas.core.web.util.viewgenerator.html.GraphicElementFactory;
import org.silverpeas.core.web.util.viewgenerator.html.window.Window;
import org.silverpeas.core.web.util.viewgenerator.html.operationpanes.OperationPane;
import org.silverpeas.core.web.util.viewgenerator.html.browsebars.BrowseBar;
import org.silverpeas.core.web.util.viewgenerator.html.frame.Frame;
import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayPane;
import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayLine;
import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayColumn;
import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayCellText;
import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayCellLink;
import org.silverpeas.core.web.util.viewgenerator.html.iconpanes.IconPane;
import org.silverpeas.core.web.util.viewgenerator.html.icons.Icon;
import org.silverpeas.core.web.util.viewgenerator.html.tabs.TabbedPane;
import org.silverpeas.core.web.util.viewgenerator.html.buttonpanes.ButtonPane;
import org.silverpeas.core.web.util.viewgenerator.html.buttons.Button;
import org.silverpeas.core.web.util.viewgenerator.html.board.Board;
import org.silverpeas.core.util.DateUtil;
import org.silverpeas.kernel.bundle.ResourceLocator;
import org.silverpeas.core.util.MultiSilverpeasBundle;
import org.silverpeas.core.util.URLUtil;
import org.silverpeas.components.projectmanager.model.TaskDetail;
import org.silverpeas.components.projectmanager.model.TaskResourceDetail;
import org.silverpeas.components.projectmanager.model.Filtre;

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



String getHTMLMonthCalendar(Date date, MultiSilverpeasBundle resource, List holidays) {

		String  weekDayStyle 		= "class=\"txtnav\"";
	String  selectedDayStyle	= "class=\"intfdcolor3\"";

	StringBuffer result = new StringBuffer(255);
	result.append("<TABLE width=\"100%\" BORDER=0 CELLSPACING=\"0\" CELLPADDING=\"1\">");

        Calendar calendar = Calendar.getInstance();

        int firstDayOfWeek = Calendar.MONDAY;

        calendar.setTime(date);
        int month = calendar.get(Calendar.MONTH);
        int year = calendar.get(Calendar.YEAR);

        // calcul du nombre de jour dans le mois
        calendar.add(Calendar.MONTH, 1);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.add(Calendar.DATE, -1);
        int numDays = calendar.get(Calendar.DAY_OF_MONTH);

        // calcul du jour de depart
        calendar.setTime(date);
        int startDay = 1;

        calendar.set(Calendar.DAY_OF_MONTH, 1);
        while (calendar.get(Calendar.DAY_OF_WEEK) != firstDayOfWeek)
        {
            calendar.add(Calendar.DATE, -1);
            startDay++;
        }

        result.append("<TR class=\"txtnav2\"><TD COLSPAN=7>\n");
        result.append("<TABLE width=\"100%\" BORDER=0 CELLSPACING=\"0\" CELLPADDING=\"0\"><TR>");
        result.append("<TD class=\"intfdcolor3\" ALIGN=\"center\"><span class=txtNav4>").append(resource.getString("GML.mois" + month)).append(" ").append(year).append("</span></TD>");
        result.append("</TR></TABLE>\n");
        result.append("</TD></tr>");

        result.append("<TR class=\"intfdcolor2\">\n");

        do
        {
	        result.append("<TH ").append(weekDayStyle).append("><a href=\"javaScript:changeDayStatus('").append(year).append("', '").append(month).append("', '").append(calendar.get(Calendar.DAY_OF_WEEK)).append("');\">").append(resource.getString("GML.shortJour" + calendar.get(Calendar.DAY_OF_WEEK))).append("</a></TH>");
            calendar.add(Calendar.DATE, 1);
        }
        while (calendar.get(Calendar.DAY_OF_WEEK) != firstDayOfWeek);

        result.append("</TR>\n");

        // put blank table entries for days of week before beginning of the month
        result.append("<TR>\n");
        int column = 0;

        for (int i = 0; i < startDay - 1; i++)
        {
            result.append("<TD width=\"14%\">&nbsp;</TD>");
            column++;
        }

        calendar.setTime(date);

        Date 	currentDate 		= null;
        String 	sCurrentDate		= null;
        String 	currentDateStyle	= null;
        int		nextStatus			= 0;
        for (int i = 1; i <= numDays; i++)
        {
            calendar.set(Calendar.DAY_OF_MONTH, i);

            currentDate 	= calendar.getTime();
            sCurrentDate 	= resource.getInputDate(currentDate);

            if (holidays.contains(currentDate))
            {
		currentDateStyle 	= selectedDayStyle;
		nextStatus			= 0;
            }
            else
            {
				currentDateStyle 	= "";
				nextStatus			= 1;
			}

            result.append("<TD width=\"14%\" align=\"right\" ").append(currentDateStyle).append("><A HREF=\"javascript:changeDateStatus('").append(sCurrentDate).append("','").append(nextStatus).append("');\">").append(i).append("</A></TD>\n");

            // Check for end of week/row
            if ((++column == 7) && (numDays > i))
            {
                result.append("</TR>\n<TR>");
                column = 0;
            }
        }
        for (int i = column; i <= 6; i++)
        {
            result.append("<TD>&nbsp;</TD>\n");
        }
        result.append("</TR></TABLE>\n");

        return result.toString();
    }


  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;

  static {
    _jspx_dependants = new java.util.LinkedHashMap<java.lang.String,java.lang.Long>(3);
    _jspx_dependants.put("/projectManager/jsp/check.jsp", Long.valueOf(1708603024708L));
    _jspx_dependants.put("uri:silverpeas.tags.viewGenerator", Long.valueOf(1782120262148L));
    _jspx_dependants.put("uri:silverpeas.tags.viewGenerator!/META-INF/viewGenerator.tld", Long.valueOf(1782120236000L));
  }

  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<>(44);
    _jspx_imports_classes.add("org.silverpeas.core.util.MultiSilverpeasBundle");
    _jspx_imports_classes.add("java.net.URLEncoder");
    _jspx_imports_classes.add("java.text.SimpleDateFormat");
    _jspx_imports_classes.add("java.util.List");
    _jspx_imports_classes.add("java.util.Date");
    _jspx_imports_classes.add("java.util.Calendar");
    _jspx_imports_classes.add("java.util.GregorianCalendar");
    _jspx_imports_classes.add("java.util.Vector");
    _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.Encode");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.GraphicElementFactory");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.window.Window");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.operationpanes.OperationPane");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.browsebars.BrowseBar");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.frame.Frame");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayPane");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayLine");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayColumn");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayCellText");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayCellLink");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.iconpanes.IconPane");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.icons.Icon");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.tabs.TabbedPane");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.buttonpanes.ButtonPane");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.buttons.Button");
    _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.board.Board");
    _jspx_imports_classes.add("org.silverpeas.core.util.DateUtil");
    _jspx_imports_classes.add("org.silverpeas.kernel.bundle.ResourceLocator");
    _jspx_imports_classes.add("org.silverpeas.core.util.URLUtil");
    _jspx_imports_classes.add("org.silverpeas.components.projectmanager.model.TaskDetail");
    _jspx_imports_classes.add("org.silverpeas.components.projectmanager.model.TaskResourceDetail");
    _jspx_imports_classes.add("org.silverpeas.components.projectmanager.model.Filtre");
  }

  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,
      			"../../admin/jsp/errorpageMain.jsp", 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');
      out.write('\n');
      out.write('\n');
      out.write('\n');
      out.write('\n');
      out.write('\n');

response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache");        //HTTP 1.0
response.setDateHeader ("Expires",-1);          //prevents caching at the proxy server

      out.write("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");

GraphicElementFactory gef = (GraphicElementFactory) session.getAttribute("SessionGraphicElementFactory");

String m_context = ResourceLocator.getGeneralSettingBundle().getString("ApplicationURL");

MultiSilverpeasBundle resource = (MultiSilverpeasBundle)request.getAttribute("resources");
Window window = gef.getWindow();
BrowseBar browseBar = window.getBrowseBar();
OperationPane operationPane = window.getOperationPane();
Frame frame = gef.getFrame();

String[] browseContext = (String[]) request.getAttribute("browseContext");
String spaceLabel 		= browseContext[0];
String componentLabel 	= browseContext[1];
String spaceId 			= browseContext[2];
String componentId 		= browseContext[3];

      out.write('\n');
      out.write('\n');

Date 				beginDate 	= (Date) request.getAttribute("BeginDate");
Date 				endDate		= (Date) request.getAttribute("EndDate");
List			 	holidays	= (List) request.getAttribute("HolidayDates");

      out.write("\n<html>\n<head>\n<title></title>\n");
      if (_jspx_meth_view_005flooknfeel_005f0(_jspx_page_context))
        return;
      out.write("\n<script language=\"javascript\">\nfunction changeDateStatus(day, status)\n{\n	document.calendarForm.Date.value = day;\n	document.calendarForm.Status.value = status;\n	document.calendarForm.submit();\n}\nfunction changeDayStatus(year, month, day)\n{\n	document.calendarDayForm.DayOfWeek.value = day;\n	document.calendarDayForm.Month.value = month;\n	document.calendarDayForm.Year.value = year;\n	document.calendarDayForm.submit();\n}\n</script>\n\n</head>\n<body>\n");

    browseBar.setDomainName(spaceLabel);
    browseBar.setComponentName(componentLabel, "Main");

    out.println(window.printBefore());

    TabbedPane tabbedPane = gef.getTabbedPane();

	tabbedPane.addTab(resource.getString("projectManager.Projet"), "ToProject", false);
	tabbedPane.addTab(resource.getString("projectManager.Taches"), "Main", false);
	tabbedPane.addTab(resource.getString("projectManager.Gantt"), "ToGantt", false);
	tabbedPane.addTab(resource.getString("projectManager.Calendrier"), "#", true);

    out.println(tabbedPane.print());

    out.println(frame.printBefore());

    Board board = gef.getBoard();
    out.println(board.printBefore());

    Calendar calendar = Calendar.getInstance();

    out.println("<center>");
    out.println("<table border=0 class=\"contourintfdcolor\" cellpadding=\"2\" cellspacing=\"2\">");
    
      out.write("\n\n	<tr><td colspan=4>");
      out.print(resource.getString("projectManager.calendarDays"));
      out.write("</td></tr>\n\n	");

    int i = 1;

    while (beginDate.before(endDate))
    {
	if (i==1)
		out.println("<tr>");

	if (i-4 > 0)
	{
		out.println("</tr>");
		i = 1;
	}

	out.println("<td valign=\"top\" class=\"contourintfdcolor\">");
	out.println(getHTMLMonthCalendar(beginDate, resource, holidays));
	out.println("</td>");

	calendar.setTime(beginDate);
	calendar.add(Calendar.MONTH, 1);
	beginDate = calendar.getTime();

	i++;
    }

	out.println("</table>");
	out.println("</center>");
	out.println(board.printAfter());
    out.println(frame.printAfter());
    out.println(window.printAfter());

      out.write("\n<form name=\"calendarForm\" action=\"ChangeDateStatus\" method=\"POST\">\n	<input type=\"hidden\" name=\"Date\">\n	<input type=\"hidden\" name=\"Status\">\n</form>\n<form name=\"calendarDayForm\" action=\"ChangeDayOfWeekStatus\" method=\"POST\">\n	<input type=\"hidden\" name=\"DayOfWeek\">\n	<input type=\"hidden\" name=\"Month\">\n	<input type=\"hidden\" name=\"Year\">\n</form>\n</body>\n</html>");
    } 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);
    }
  }

  private boolean _jspx_meth_view_005flooknfeel_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  view:looknfeel
    org.silverpeas.core.web.util.viewgenerator.html.LookAndStyleTag _jspx_th_view_005flooknfeel_005f0 = new org.silverpeas.core.web.util.viewgenerator.html.LookAndStyleTag();
    _jsp_getInstanceManager().newInstance(_jspx_th_view_005flooknfeel_005f0);
    try {
      _jspx_th_view_005flooknfeel_005f0.setPageContext(_jspx_page_context);
      _jspx_th_view_005flooknfeel_005f0.setParent(null);
      int _jspx_eval_view_005flooknfeel_005f0 = _jspx_th_view_005flooknfeel_005f0.doStartTag();
      if (_jspx_th_view_005flooknfeel_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } finally {
      org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_view_005flooknfeel_005f0, _jsp_getInstanceManager());
    }
    return false;
  }
}
