private HtmlElement getTimeInput(HttpServletRequest request) {
   HtmlElement result = HtmlFactory.get("div");
   Integer interval = RequestInterpreter.getInterval(request);
   if (interval != null) {
     HtmlElement pStart = HtmlFactory.get("p");
     HtmlElement labeldiv = HtmlFactory.get("span", "Start time:"); // INTLANG
     pStart.add(labeldiv + HtmlFactory.get("br").toString());
     HtmlElement pEnd = HtmlFactory.get("p");
     labeldiv = HtmlFactory.get("span", "End time:"); // INTLANG
     pEnd.add(labeldiv + HtmlFactory.get("br").toString());
     Calendar today = Calendar.getInstance();
     if (interval.intValue() == FacilityAvailability.ONE_TIME) {
       pStart.add(
           FamCalendarHtmlFactory.getDateSelect(
               today, 365, QueryKeys.QUERY_KEY_FROM + QueryKeys.QUERY_KEY_DAY, 0, true));
       pEnd.add(
           FamCalendarHtmlFactory.getDateSelect(
               today, 365, QueryKeys.QUERY_KEY_TO + QueryKeys.QUERY_KEY_DAY, 1, true));
     } else if (interval.intValue() == FacilityAvailability.EACH_YEAR) {
       Calendar firstDayOfYear = Calendar.getInstance();
       firstDayOfYear.set(Calendar.DAY_OF_YEAR, 1);
       pStart.add(
           FamCalendarHtmlFactory.getDateSelect(
               firstDayOfYear,
               365,
               QueryKeys.QUERY_KEY_FROM + QueryKeys.QUERY_KEY_DAY,
               today.get(Calendar.DAY_OF_YEAR),
               false));
       pEnd.add(
           FamCalendarHtmlFactory.getDateSelect(
               firstDayOfYear,
               365,
               QueryKeys.QUERY_KEY_TO + QueryKeys.QUERY_KEY_DAY,
               today.get(Calendar.DAY_OF_YEAR) + 1,
               false));
     } else if (interval.intValue() == FacilityAvailability.EACH_MONTH) {
       int i = 1;
       Calendar firstDayOfMonth = Calendar.getInstance();
       firstDayOfMonth.set(Calendar.DAY_OF_MONTH, 1);
       List<String> optiontexts = new ArrayList<String>();
       while (i <= 28) {
         optiontexts.add(FamDateFormat.getNumeralFormat(i));
         i++;
       }
       pStart.add(
           FamCalendarHtmlFactory.getDateSelect(
               firstDayOfMonth,
               QueryKeys.QUERY_KEY_FROM + QueryKeys.QUERY_KEY_DAY,
               today.get(Calendar.DAY_OF_MONTH) - 1,
               optiontexts));
       pEnd.add(
           FamCalendarHtmlFactory.getDateSelect(
               firstDayOfMonth,
               QueryKeys.QUERY_KEY_TO + QueryKeys.QUERY_KEY_DAY,
               today.get(Calendar.DAY_OF_MONTH),
               optiontexts));
     } else if (interval.intValue() == FacilityAvailability.EACH_WEEK) {
       Calendar weekday = FamCalendar.getInstance();
       weekday.set(Calendar.DAY_OF_WEEK, weekday.getFirstDayOfWeek());
       int pointer = 0;
       List<String> optiontexts = new ArrayList<String>();
       while (pointer < 7) {
         optiontexts.add(
             weekday.getDisplayName(
                 Calendar.DAY_OF_WEEK, Calendar.LONG, FamRequestContainer.locale()));
         weekday.add(Calendar.DAY_OF_YEAR, 1);
         pointer++;
       }
       weekday.add(Calendar.DAY_OF_YEAR, -7);
       pStart.add(
           FamCalendarHtmlFactory.getDateSelect(
               weekday,
               QueryKeys.QUERY_KEY_FROM + QueryKeys.QUERY_KEY_DAY,
               today.get(Calendar.DAY_OF_WEEK) - 1,
               optiontexts));
       pEnd.add(
           FamCalendarHtmlFactory.getDateSelect(
               weekday,
               QueryKeys.QUERY_KEY_TO + QueryKeys.QUERY_KEY_DAY,
               today.get(Calendar.DAY_OF_WEEK),
               optiontexts));
     } else { // each day or each hour
       QueryString qs =
           QueryStringFactory.get(
               QueryKeys.QUERY_KEY_FROM + QueryKeys.QUERY_KEY_DAY,
               QueryKeys.getEncodeStringOfDate(today));
       pStart.add(qs.getAsHtmlInputsTypeHidden());
       List<String> optiontexts = new ArrayList<String>(2);
       optiontexts.add("same day"); // INTLANG
       optiontexts.add("next day"); // INTLANG
       pEnd.add(
           FamCalendarHtmlFactory.getDateSelect(
               today, QueryKeys.QUERY_KEY_TO + QueryKeys.QUERY_KEY_DAY, 0, optiontexts));
     }
     pStart.add(
         FamCalendarHtmlFactory.getTimeSelectCompact(
             QueryKeys.QUERY_KEY_FROM + QueryKeys.QUERY_KEY_HOUR_OF_DAY, 0));
     pEnd.add(
         FamCalendarHtmlFactory.getTimeSelectCompact(
             QueryKeys.QUERY_KEY_TO + QueryKeys.QUERY_KEY_HOUR_OF_DAY, 0));
     result.add(pStart);
     result.add(pEnd);
   }
   return result;
 }
  private HtmlElement getSummary(HttpServletRequest request) {
    HtmlElement result = HtmlFactory.get("ul").addClassName("asList");
    HtmlElement warningSpan = HtmlFactory.get("span").addClassName("warning");

    // summary availability
    Integer availability = RequestInterpreter.getAvailability(request);
    // is valid availability
    if (availability != null
        && (availability == COMPLETE_AVAILABLE
            || availability == GENERAL_NOT_AVAILABLE
            || availability == BOOKED_NOT_AVAILABLE
            || availability == MAINTENANCE_NOT_AVAILABLE
            || availability == BOOKING_MUST_NOT_START_HERE)) {
      result.add(
          HtmlFactory.get("li")
              .add(HtmlFactory.get("strong").add("Availability"))
              .add(": ")
              .add(FamText.facilityAvailability(availability))); // INTLANG;
    }

    // summary interval
    Integer interval = RequestInterpreter.getInterval(request);
    if (interval != null) {
      result.add(
          HtmlFactory.get("li")
              .add(HtmlFactory.get("strong").add("Interval"))
              .add(": ")
              .add(FamText.message("calendar.iteration." + interval))); // INTLANG;
    }

    // summary notice
    String notice = RequestInterpreter.getNotice(request);
    if (notice != null) {
      result.add(
          HtmlFactory.get("li")
              .add(HtmlFactory.get("strong").add("Notice"))
              .add(": ")
              .add(notice)); // INTLANG;
    }

    if (availability != null
        && availability.intValue() != FacilityAvailability.COMPLETE_AVAILABLE) {
      FacilityAvailability da =
          RequestInterpreter.getCompleteFacilityAvailabilityForInsertion(
              request, SessionAuth.user(request));
      if (da != null) {

        TimeFrame baseTimeFrame = da.getBasePeriodOfTime();
        if (baseTimeFrame != null) {
          String timeText =
              interval == FacilityAvailability.ONE_TIME
                  ? "Coming into effect"
                  : "First time coming into effect"; // INTLANG
          result.add(
              HtmlFactory.get("li")
                  .add(HtmlFactory.get("strong").add(timeText))
                  .add(": ")
                  .add(baseTimeFrame));

          // summarize bookings being canceled
          List<Facility> facilities = new ArrayList<Facility>();
          facilities.add(da.getFacility());
          List<Booking> bookings = FamDaoProxy.bookingDao().getAll(facilities);
          int negativeAnswers = 0;
          for (Booking booking : bookings) {
            if (!booking.isCanceled()
                && !booking.sessionAlreadyBegun()
                && booking.getIdBookedInBookingStrategy() != BookingStrategy.QUEUE_BASED
                && da.applicableTo(booking.getSessionTimeFrame())) {
              negativeAnswers++;
            }
          }

          result.add(
              HtmlFactory.get("li")
                  .add(
                      HtmlFactory.get("strong")
                          .add("Number of letters of refusal sent with this input"))
                  .add(": ")
                  .add(
                      negativeAnswers == 0
                          ? "no letter"
                          : warningSpan
                              .setContent(negativeAnswers + " letter(s)")
                              .toString())); // INTLANG;

          // warning on nothing set or left
          long durationOfBaseTime = baseTimeFrame.getDuration();
          long durationOfAnHour = 1000l * 60 * 60;
          boolean willBlockResource = false;
          boolean nothingSet = durationOfBaseTime <= 0;
          if (!nothingSet
              && interval != FacilityAvailability.ONE_TIME
              && availability != FacilityAvailability.COMPLETE_AVAILABLE) {
            if ((interval == FacilityAvailability.EACH_YEAR
                    && durationOfBaseTime >= durationOfAnHour * 24 * 365)
                || (interval == FacilityAvailability.EACH_MONTH
                    && durationOfBaseTime >= durationOfAnHour * 24 * 365 / 12)
                || (interval == FacilityAvailability.EACH_WEEK
                    && durationOfBaseTime >= durationOfAnHour * 24 * 7)
                || (interval == FacilityAvailability.EACH_DAY
                    && durationOfBaseTime >= durationOfAnHour * 24)
                || (interval == FacilityAvailability.EACH_HOUR
                    && durationOfBaseTime >= durationOfAnHour)) {
              willBlockResource = true;
            }
          }
          if (willBlockResource) {
            result.add(
                HtmlFactory.get("li")
                    .add(
                        warningSpan.setContent(
                            "If setting this, the facility will never ever be available!"))); // INTLANG;
          }
          if (nothingSet) {
            result.add(
                HtmlFactory.get("li")
                    .add(warningSpan.setContent("The duration of your setting is 0!"))); // INTLANG;
          }
        }
      }
    }
    return result;
  }