protected void doMakeWebPart(UserSession us, WebPart part) {
    String photoId = (String) us.getSavedArg("photoId");
    Photo photo = PhotoManager.getInstance().getPhoto(photoId);
    part.addString(Photo.THUMB, getPhotoThumb(us, photo));

    part.addString("photoId", photoId);
    part.addString(Photo.ID, photo.getId().asString());
    part.addSelect(Photo.STATUS, PhotoStatus.class, (String) us.getSavedArg(Photo.STATUS));
    part.maskAndAddStringFromArgsWithDefault(
        us.getSavedArgs(), Photo.TAGS, photo.getTags().asString());
  }
  protected String doHandleGet(UserSession ctx, String link, Map args) {
    PhotoFilter filter = ctx.getPhotoFilter();

    String un = ctx.getAsString(args, PhotoFilter.USER_NAME);
    if (StringUtil.isLegalUserName(un)) {
      filter.setUserName(un);
    }

    String tags = ctx.getAsString(args, PhotoFilter.TAGS);
    if (StringUtil.isLegalTagsString(tags)) {
      filter.setTags(new Tags(tags));
    }

    return PartUtil.SHOW_PHOTO_PAGE_NAME;
  }
  protected String doHandlePost(UserSession us, Map args) {
    PhotoFilter filter = us.getPhotoFilter();

    String un = us.getAsString(args, PhotoFilter.USER_NAME);
    if (StringUtil.isLegalUserName(un)) {
      filter.setUserName(un);
    }

    String tags = us.getAsString(args, PhotoFilter.TAGS);
    if (StringUtil.isLegalTagsString(tags)) {
      filter.setTags(new Tags(tags));
    }

    log.info(
        LogBuilder.createUserMessage()
            .addAction("Filter Photos")
            .addParameter("Tags", filter.getTags().asString())
            .toString());

    return PartUtil.SHOW_PHOTO_PAGE_NAME;
  }
  protected String doHandlePost(UserSession us, Map args) {
    String id = us.getAndSaveAsString(args, "photoId");
    Photo photo = PhotoManager.getInstance().getPhoto(id);

    String tags = us.getAndSaveAsString(args, Photo.TAGS);
    photo.setTags(new Tags(tags));
    String status = us.getAndSaveAsString(args, Photo.STATUS);
    photo.setStatus(PhotoStatus.getFromString(status));

    AsyncTaskExecutor.savePhotoAsync(id);

    log.info(
        LogBuilder.createUserMessage()
            .addAction("AdminUserPhoto")
            .addParameter("Photo", photo.getId().asString())
            .toString());

    us.setMessage(us.getClient().getLanguageConfiguration().getPhotoUpdateSucceeded());

    return PartUtil.SHOW_ADMIN_PAGE_NAME;
  }
Beispiel #5
0
  public void emailWelcomeMessage(UserSession us, User user) {
    ModelConfig config = us.getClient().getLanguageConfiguration();
    EmailAddress from = config.getAdministratorEmailAddress();
    EmailAddress to = user.getEmailAddress();

    String emailSubject = config.getWelcomeEmailSubject();
    String emailBody = config.getWelcomeEmailBody() + "\n\n";
    emailBody += config.getWelcomeEmailUserName() + user.getNickName() + "\n\n";
    emailBody += config.getGeneralEmailRegards() + "\n\n----\n";
    emailBody += config.getGeneralEmailFooter() + "\n\n";

    EmailService emailService = EmailServiceManager.getDefaultService();
    emailService.sendEmailIgnoreException(
        from, to, config.getAuditEmailAddress(), emailSubject, emailBody);
  }
  protected void doMakeWebPart(UserSession us, WebPart part) {
    PhotoFilter filter = us.getPhotoFilter();

    part.maskAndAddString(PhotoFilter.USER_NAME, filter.getUserName());
    part.maskAndAddString(PhotoFilter.TAGS, filter.getTags().asString());
  }
 protected void makeWebPageBody(UserSession ctx, WebPart page) {
   page.addString("noteHeading", ctx.cfg().getInformation());
   String msg1 = ctx.cfg().getContinueWithShowPhoto();
   page.addString("note", msg1);
 }