Package net.sourceforge.pebble.domain

Examples of net.sourceforge.pebble.domain.Blog


  public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
    AbstractBlog abstractBlog = (AbstractBlog)request.getAttribute(Constants.BLOG_KEY);

    if (abstractBlog instanceof Blog) {
      Blog blog = (Blog)abstractBlog;
      if (SecurityUtils.isUserAuthorisedForBlogAsBlogOwner(blog)) {
        return EVAL_BODY_INCLUDE;
      }
    }
View Full Code Here


  public int vote(Authentication authentication, Object object, Collection<ConfigAttribute> config) {
    // Ok, the way this has been implemented is bad... but it's 2am and I'm not about to fix it.
    for (ConfigAttribute attribute : config) {
      if (attribute instanceof PrivateBlogConfigAttributeDefinition) {
        PrivateBlogConfigAttributeDefinition cad = (PrivateBlogConfigAttributeDefinition) attribute;
        Blog blog = cad.getBlog();
        if (SecurityUtils.isBlogAdmin(authentication)) {
          // admin users need access to all blogs
          return ACCESS_GRANTED;
        } else if (SecurityUtils.isUserAuthorisedForBlog(authentication, blog)) {
          // blog owners/publishers/contributors need access, if they have it
View Full Code Here

  public void trackBackAdded(TrackBackEvent event) {
    sendNotification(event.getTrackBack());
  }

  private void sendNotification(TrackBack trackBack) {
    Blog blog = trackBack.getBlogEntry().getBlog();

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

    String subject = MailUtils.getTrackbackPrefix(blog, trackBack.getState()) + " " + trackBack.getTitle();

    String message = "TrackBack from <a href=\"" + trackBack.getUrl() + "\">" + trackBack.getBlogName() + "</a> on " + sdf.format(trackBack.getDate());
    message += " in response to " + trackBack.getBlogEntry().getTitle();
    message += "\n\n<br><br>";
    message += trackBack.getExcerpt();
    message += "\n\n<br><br>";
    message += "<a href=\"" + trackBack.getPermalink() + "\">Permalink</a>";

    SecurityTokenValidator validator = new SecurityTokenValidatorImpl();

    if (trackBack.isPending()) {
      message += " | ";
      message += "<a href=\"" + blog.getUrl() + validator.generateSignedQueryString("manageResponses.secureaction",
              createMap("response", trackBack.getGuid(), "submit", "Approve"), blog.getXsrfSigningSalt()) + "\">Approve</a>";
      message += " | ";
      message += "<a href=\"" + blog.getUrl() + validator.generateSignedQueryString("manageResponses.secureaction",
              createMap("response", trackBack.getGuid(), "submit", "Reject"), blog.getXsrfSigningSalt()) + "\">Reject</a>";
    }

    message += " | ";
    message += "<a href=\"" + blog.getUrl() + validator.generateSignedQueryString("manageResponses.secureaction",
            createMap("response", trackBack.getGuid(), "submit", "Remove"), blog.getXsrfSigningSalt()) + "\">Remove</a>";

    Collection to = getEmailAddresses(trackBack);

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

   */
  public static void main(String[] args) throws Exception {
    File root = new File(args[0]);
    File sources[] = root.listFiles();
    DAOFactory.setConfiguredFactory(new FileDAOFactory());
    Blog blog = new Blog(args[1]);
    blog.setProperty(Blog.TIMEZONE_KEY, args[2]);

    for (int i = 0; i < sources.length; i++) {
      importFile(blog, sources[i]);
    }
  }
View Full Code Here

   */
  public void putStaticPage(StaticPage staticPage) throws StaticPageServiceException {
    ContentCache cache = ContentCache.getInstance();
    DAOFactory factory = DAOFactory.getConfiguredFactory();
    StaticPageDAO dao = factory.getStaticPageDAO();
    Blog blog = staticPage.getBlog();

    synchronized (blog) {
      try {
        StaticPage sp = getStaticPageById(blog, staticPage.getId());

View Full Code Here

   */
  public void removeStaticPage(StaticPage staticPage) throws StaticPageServiceException {
    ContentCache cache = ContentCache.getInstance();
    DAOFactory factory = DAOFactory.getConfiguredFactory();
    StaticPageDAO dao = factory.getStaticPageDAO();
    Blog blog = staticPage.getBlog();

    try {
      dao.removeStaticPage(staticPage);
      cache.removeStaticPage(staticPage);

View Full Code Here

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

    }
View Full Code Here

    log.debug("pebble.getRecentBlogEntries(" +
        blogid + ", " +
        username + ", " +
        "********)");

    Blog blog = getBlogWithBlogId(blogid);
    authenticate(blog, username, password);

    Vector posts = new Vector();
    Collection coll = blog.getRecentPublishedBlogEntries(numberOfPosts);
    Iterator it = coll.iterator();
    BlogEntry entry;
    while (it.hasNext()) {
      entry = (BlogEntry)it.next();
      posts.add(adaptBlogEntry(entry));
View Full Code Here

      return null;
    }
   
    AbstractBlog ab = (AbstractBlog)((FilterInvocation)object).getHttpRequest().getAttribute(Constants.BLOG_KEY);
    if (ab instanceof Blog) {
      Blog blog = (Blog)ab;
      List<String> blogReaders = blog.getBlogReaders();
      if (blogReaders != null && blogReaders.size() > 0) {
        return Arrays.<ConfigAttribute>asList(new PrivateBlogConfigAttributeDefinition(blog));
      }
    }
View Full Code Here

        log.error(nfe.getMessage());
        // do nothing, the value has already been defaulted
      }
    }

    Blog blog = blogEntry.getBlog();
    String body = blogEntry.getBody();

    if (body != null && body.trim().length() > 0) {

      StringBuffer buf = new StringBuffer();
      buf.append(body);
      buf.append("<p><b>" + I18n.getMessage(blog, "common.relatedPosts") + "</b><br />");

      // tags of the current entry
      List<Tag> currentEntryTags = blogEntry.getAllTags();

      // all blog entries of the current blog
      List<BlogEntry> allBlogEntries = (List<BlogEntry>) blog.getBlogEntries();

      // temporary holder for accumulated unique related posts.
      // using hash set assures that we wont have same related post twice for
      // different tags.
      Set<BlogEntry> relatedEntries = new HashSet<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.