Package net.sourceforge.pebble.domain

Examples of net.sourceforge.pebble.domain.Blog


    Comment comment = event.getComment();
    sendNotification(comment);
  }

  private void sendNotification(Comment comment) {
    Blog blog = comment.getBlogEntry().getBlog();

    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.DETAIL_VIEW);
    context.setMedia(ContentDecoratorContext.EMAIL);

    blog.getContentDecoratorChain().decorate(context, comment);

    SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z");
    sdf.setTimeZone(blog.getTimeZone());

    String subject = MailUtils.getCommentPrefix(blog) + " " + comment.getTitle();
    String author = StringUtils.transformHTML(comment.getAuthor());
    if (comment.getWebsite() != null) {
      author = "<a href=\"" + comment.getWebsite() + "\">" + author + "</a>";
    }

    String message = "Comment from " + author + " on " + sdf.format(comment.getDate());
    message += " in response to " + comment.getBlogEntry().getTitle();
    message += "\n\n<br><br>";
    message += comment.getBody();
    message += "\n\n<br><br>";
    message += "<a href=\"" + comment.getPermalink() + "\">Permalink</a>";
    message += " | ";
    message += "<a href=\"" + blog.getUrl() + "removeEmailAddress.action?entry=" + comment.getBlogEntry().getId() + "&email=" + EMAIL_ADDRESS_TOKEN + "\">Opt-out</a>";

    Collection to = getEmailAddresses(comment);
    Iterator it = comment.getBlogEntry().getComments().iterator();
    Comment blogComment;
    while (it.hasNext()) {
View Full Code Here


      e.printStackTrace();
    }
  }

  private void sendApprovalRequest(Comment comment) {
    Blog blog = comment.getBlogEntry().getBlog();

    SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z");
    sdf.setTimeZone(blog.getTimeZone());

    String subject = MailUtils.getCommentPrefix(blog, comment.getState()) + " " + comment.getTitle();

    String author = StringUtils.transformHTML(comment.getAuthor());
    if (comment.getWebsite() != null) {
      author = "<a href=\"" + comment.getWebsite() + "\">" + author + "</a>";
    }

    SecurityTokenValidator validator = new SecurityTokenValidatorImpl();

    String message = "Comment from " + author + " on " + sdf.format(comment.getDate());
    message += " in response to " + comment.getBlogEntry().getTitle();
    message += "\n\n<br><br>";
    message += comment.getBody();
    message += "\n\n<br><br>";
    message += "<a href=\"" + comment.getPermalink() + "\">Permalink</a>";
    message += " | ";
    message += "<a href=\"" + blog.getUrl() + validator.generateSignedQueryString("manageResponses.secureaction",
            createMap("response", comment.getGuid(), "submit", "Approve"), blog.getXsrfSigningSalt()) + "\">Approve</a>";
    message += " | ";
    message += "<a href=\"" + blog.getUrl() + validator.generateSignedQueryString("manageResponses.secureaction",
            createMap("response", comment.getGuid(), "submit", "Reject"), blog.getXsrfSigningSalt()) + "\">Reject</a>";
    message += " | ";
    message += "<a href=\"" + blog.getUrl() + validator.generateSignedQueryString("manageResponses.secureaction",
            createMap("response", comment.getGuid(), "submit", "Remove"), blog.getXsrfSigningSalt()) + "\">Remove</a>";

    Collection to = getEmailAddresses(comment);

    try {
      MailUtils.sendMail(MailUtils.createSession(), blog, to, subject, message);
View Full Code Here

   */
  public boolean confirmationRequired(Comment comment) {
    PluginProperties props = comment.getBlogEntry().getBlog().getPluginProperties();
    String required = props.getProperty(REQUIRED_KEY);

    Blog blog = comment.getBlogEntry().getBlog();
    if (SecurityUtils.isUserAuthorisedForBlog(blog)) {
      return false;
    } else {
      // run a subset of the default comment listeners to figure out whether
      // the comment is spam
View Full Code Here

     *
     * @param context the context in which the decoration is running
     * @param blogEntry the blog entry to be decorated
     */
    public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) {
        Blog blog = blogEntry.getBlog();
        PluginProperties props = blog.getPluginProperties();
        String suffix;
        synchronized(props) {
            suffix = props.getProperty(SUFFIX);
        }

View Full Code Here

      *
      * @param request the HttpServletRequest used in the confirmation
      */
     public void setupConfirmation(HttpServletRequest request) {
          
           Blog blog = (Blog)request.getAttribute(Constants.BLOG_KEY);
           PluginProperties props = blog.getPluginProperties();
          
           boolean keySuccess = true;
          
           if (!props.hasProperty(RECAPTCHA_PUBLIC_KEY)) {
               keySuccess = false;
View Full Code Here

      */
     public boolean isConfirmed(HttpServletRequest request) {
        
           String remoteAddr = request.getRemoteAddr();
          
           Blog blog = (Blog)request.getAttribute(Constants.BLOG_KEY);
           PluginProperties props = blog.getPluginProperties();
          
           if (!props.hasProperty(RECAPTCHA_PRIVATE_KEY)) {
               log.error("failed to retrieve reCAPTCHA private API key");
               return false;
           }
View Full Code Here

            sortBy + "\")");

        Vector posts = new Vector();
        try {

            Blog blog = getBlogWithBlogId(blogid);
            SearchResults result = blog.getSearchIndex().search( searchString );

            if ( sortBy != null && sortBy.equalsIgnoreCase("date") ) {
                result.sortByDateDescending();
            } else {
                result.sortByScoreDescending();
View Full Code Here


        Vector posts = new Vector();
        try {

            Blog blog = getBlogWithBlogId(blogid);
            SearchResults result = blog.getSearchIndex().search( searchString );
           
            if ( sortBy != null && sortBy.equalsIgnoreCase("date") ) {
                result.sortByDateDescending();
            } else {
                result.sortByScoreDescending();
View Full Code Here

   *
   * @param context   the context in which the decoration is running
   * @param blogEntry the blog entry to be decorated
   */
  public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) {
    Blog blog = blogEntry.getBlog();

    if ((blogEntry.getExcerpt() != null && blogEntry.getExcerpt().length() > 0 && context.getView() == ContentDecoratorContext.SUMMARY_VIEW)) {
      StringBuffer buf = new StringBuffer();
      buf.append(blogEntry.getExcerpt());

View Full Code Here

   *            the context in which the decoration is running
   * @param blogEntry
   *            the blog entry to be decorated
   */
  public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) {
    Blog blog = blogEntry.getBlog();
    ResourceBundle bundle = I18n.getBundle(blog.getLocale());

    String body = blogEntry.getBody();
    if (body != null && body.trim().length() > 0) {

      String html = generateDecorationHtml(bundle, blogEntry);
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.domain.Blog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.