protected void createPage(
      String url, final String user, final String errorMessage, HttpServletResponse response)
      throws IOException {
    final String userName = Tools.createXssSafeString(user);

    response.setContentType("text/html; charset=ISO-8859-1");
    PrintWriter out = response.getWriter();
    String linkPrefix = "../"; // request.getPathTranslated() != null ? "../" : "";

    out.println("<html>");
    out.println("  <head>");
    // add the link to the stylesheet for this page within the <head> tag
    out.println(
        "    <link REL=\"stylesheet\" href=\"" + linkPrefix + "login.css\" type=\"text/css\">");
    // tell the html page where its favourite icon is stored
    out.println(
        "    <link REL=\"shortcut icon\" type=\"image/x-icon\" href=\""
            + linkPrefix
            + "images/favicon.ico\">");
    out.println("    <title>");
    String title = null;
    final String defaultTitle = i18n.getString("rapla.title");
    try {
      final Preferences systemPreferences = facade.getSystemPreferences();
      title = systemPreferences.getEntryAsString(ContainerImpl.TITLE, defaultTitle);
    } catch (RaplaException e) {
      title = defaultTitle;
    }

    out.println(title);
    out.println("    </title>");
    out.println("  </head>");
    out.println("  <body>");
    out.println("    <form method=\"post\">");
    if (url != null) {
      out.println(
          "       <input type=\"hidden\" name=\"url\" value=\""
              + Tools.createXssSafeString(url)
              + "\"/>");
    }
    out.println("           <div class=\"loginOuterPanel\">");
    out.println("               <div class=\"loginInputPanel\">");
    final String userNameValue = userName != null ? userName : "";
    out.println(
        "                   <input name=\"userName\" type=\"text\" value=\""
            + userNameValue
            + "\">");
    out.println("                   <input name=\"password\"type=\"password\" >");
    out.println("               </div>");
    out.println("               <div class=\"loginCommandPanel\">");
    out.println("                   <button type=\"submit\" class=\"sendButton\">login</button>");
    out.println("               </div>");
    out.println("           </div>");
    if (errorMessage != null) {
      out.println("       <div class=\"errorMessage\">" + errorMessage + "</div>");
    }
    out.println("  </body>");
    out.println("</html>");
    out.close();
  }
  public Calendar createiCalender(Collection<Appointment> appointments, Preferences preferences) {

    boolean doExportAsMeeting =
        preferences == null
            ? global_export_attendees
            : preferences.getEntryAsBoolean(
                Export2iCalPlugin.EXPORT_ATTENDEES_PREFERENCE, global_export_attendees);

    String exportAttendeesParticipationStatus =
        preferences == null
            ? global_export_attendees_participation_status
            : preferences.getEntryAsString(
                Export2iCalPlugin.EXPORT_ATTENDEES_PARTICIPATION_STATUS_PREFERENCE,
                global_export_attendees_participation_status);

    // ensure the stored value is not empty string, if so, do not export attendees
    doExportAsMeeting =
        doExportAsMeeting
            && (exportAttendeesAttribute != null && exportAttendeesAttribute.trim().length() > 0);

    Calendar calendar = initiCalendar();
    addICalMethod(calendar, Method.PUBLISH);
    addVTimeZone(calendar);
    ComponentList components = calendar.getComponents();
    for (Appointment app : appointments) {
      VEvent event = createVEvent(app, doExportAsMeeting, exportAttendeesParticipationStatus);
      components.add(event);
    }
    return calendar;
  }
  public void testPreferenceDependencies() throws RaplaException {
    Allocatable allocatable = facade.newResource();
    facade.store(allocatable);

    CalendarSelectionModel calendar = facade.newCalendarModel(facade.getUser());
    calendar.setSelectedObjects(Collections.singleton(allocatable));
    calendar.setViewId(WeekViewFactory.WEEK_VIEW);
    CalendarModelConfiguration config = ((CalendarModelImpl) calendar).createConfiguration();

    RaplaMap<CalendarModelConfiguration> calendarList =
        facade.newRaplaMap(Collections.singleton(config));

    Preferences preferences = facade.getPreferences();
    Preferences editPref = facade.edit(preferences);
    TypedComponentRole<RaplaMap<CalendarModelConfiguration>> TEST_ENTRY =
        new TypedComponentRole<RaplaMap<CalendarModelConfiguration>>("TEST");
    editPref.putEntry(TEST_ENTRY, calendarList);
    facade.store(editPref);
    try {
      facade.remove(allocatable);
      fail("DependencyException should have thrown");
    } catch (DependencyException ex) {
    }

    calendarList = facade.newRaplaMap(new ArrayList<CalendarModelConfiguration>());
    editPref = facade.edit(preferences);
    editPref.putEntry(TEST_ENTRY, calendarList);
    facade.store(editPref);

    facade.remove(allocatable);
  }
Exemple #4
0
 public void commit() throws RaplaException {
   TypedComponentRole<RaplaConfiguration> configEntry = MailPlugin.MAILSERVER_CONFIG;
   RaplaConfiguration newConfig = new RaplaConfiguration("config");
   addChildren(newConfig);
   preferences.putEntry(configEntry, newConfig);
   preferences.putEntry(MailPlugin.DEFAULT_SENDER_ENTRY, defaultSender.getText());
 }
Exemple #5
0
 public void show() throws RaplaException {
   createPanel();
   config = preferences.getEntry(MailPlugin.MAILSERVER_CONFIG, null);
   if (config == null) {
     config = configService.getConfig();
   }
   readConfig(config);
   defaultSender.setText(
       preferences.getEntryAsString(MailPlugin.DEFAULT_SENDER_ENTRY, "rapla@domainname"));
 }
Exemple #6
0
 private RaplaMenuItem createMenuItem(SaveableToggleAction action) throws RaplaException {
   RaplaMenuItem menu = new RaplaMenuItem(action.getName());
   menu.setAction(new ActionWrapper(action, getI18n(), raplaImages));
   final User user = getUser();
   final Preferences preferences = getQuery().getPreferences(user);
   boolean selected = preferences.getEntryAsBoolean(action.getConfigEntry(), true);
   if (selected) {
     menu.setSelected(true);
     menu.setIcon(raplaImages.getIconFromKey("icon.checked"));
   } else {
     menu.setSelected(false);
     menu.setIcon(raplaImages.getIconFromKey("icon.unchecked"));
   }
   return menu;
 }
Exemple #7
0
  public void commit() {
    // Save the options

    boolean selected = showConflictWarningsField.isSelected();
    preferences.putEntry(CalendarOptionsImpl.SHOW_CONFLICT_WARNING, selected);
  }
Exemple #8
0
 public void show() throws RaplaException {
   // get the options
   boolean config = preferences.getEntryAsBoolean(CalendarOptionsImpl.SHOW_CONFLICT_WARNING, true);
   showConflictWarningsField.setSelected(config);
 }
Exemple #9
0
 public void commit() {
   preferences.putEntry(MY_OPTION, checkBox.isSelected());
 }
Exemple #10
0
 public void show() {
   checkBox.setSelected(preferences.getEntryAsBoolean(MY_OPTION, false));
 }
Exemple #11
0
 public void commit() {
   String language = languageChooser.getSelectedLanguage();
   preferences.putEntry(RaplaLocale.LANGUAGE_ENTRY, language);
 }
Exemple #12
0
 public void show() throws RaplaException {
   create();
   String language = preferences.getEntryAsString(RaplaLocale.LANGUAGE_ENTRY, null);
   languageChooser.setSelectedLanguage(language);
 }