App-Chronicle

 view release on metacpan or  search on metacpan

bin/chronicle  view on Meta::CPAN


    #
    #  Is the entry present, but with a different mtime?
    #
    #  If so we need to delete the post, and the tags which are pointing
    # at it, otherwise we'll have orphaned tags.
    #
    my $sql = $dbh->prepare("SELECT id FROM blog WHERE file=?");
    $sql->execute($filename) or die "Failed to execute :" . $dbh->errstr();
    my $id;
    $sql->bind_columns( undef, \$id );

    while ( $sql->fetch() )
    {
        $CONFIG{ 'verbose' } && print "Replacing DB post: $id\n";

        #
        #  Delete the tags referring to this old post.
        #
        my $del_tags = $dbh->prepare("DELETE FROM tags WHERE blog_id=?") or
          die "Failed to prepare ";

bin/chronicle  view on Meta::CPAN

    #
    #  Get the tags, if any
    #
    $sql =
      $dbh->prepare("SELECT name FROM tags WHERE blog_id=? ORDER by name ASC")
      or
      die "Failed to prepare: " . $dbh->errstr();
    $sql->execute($id);

    my ( $tag, $tags );
    $sql->bind_columns( undef, \$tag );

    while ( $sql->fetch() )
    {
        push( @$tags, { tag => $tag } );
    }
    $sql->finish();

    # Save the tags, if we found some
    $data->{ 'tags' } = $tags if ( $tags && @$tags );

lib/Chronicle/Plugin/Generate/Archive.pm  view on Meta::CPAN

    my %index;

    my $all = $dbh->prepare(
         "SELECT strftime( '%m %Y', date, 'unixepoch') FROM blog ORDER BY date")
      or
      die "Failed to prepare";


    $all->execute() or die "Failed to execute:" . $dbh->errstr();
    my $dt;
    $all->bind_columns( undef, \$dt );

    while ( $all->fetch() )
    {
        if ( $dt =~ /([0-9]+) ([0-9]+)/ )
        {
            $hash{ $dt } += 1;

            $index{ $2 }{ $1 } += 1;
        }
    }

lib/Chronicle/Plugin/Generate/Archive.pm  view on Meta::CPAN

            $year = $2;
        }
        my $ids = $dbh->prepare(
            "SELECT id FROM blog WHERE strftime( '%m %Y', date, 'unixepoch') = ? ORDER BY date DESC"
          ) or
          die "Failed to prepare";

        $ids->execute($ym) or die "Failed to execute:" . $dbh->errstr();

        my $id;
        $ids->bind_columns( undef, \$id );

        my $ym_archive_path = "$config->{'output'}/archive/$year/$mon";

        # Make path unless it exists
        File::Path::make_path( $ym_archive_path,
                               {  verbose => 0,
                                  mode    => 0755,
                               } )
          unless -e $ym_archive_path;

lib/Chronicle/Plugin/Generate/Index.pm  view on Meta::CPAN

    #  The number of posts to show on the front-page
    #
    my $count = $config->{ 'entry-count' } || 10;

    my $recent =
      $dbh->prepare("SELECT id FROM blog ORDER BY date DESC LIMIT 0,$count") or
      die "Failed to find recent posts";

    $recent->execute() or die "Failed to execute:" . $dbh->errstr();
    my $id;
    $recent->bind_columns( undef, \$id );


    my $entries;

    while ( $recent->fetch() )
    {
        my $post =
          Chronicle::getBlog( dbh    => $dbh,
                              id     => $id,
                              config => $config

lib/Chronicle/Plugin/Generate/LowerCase.pm  view on Meta::CPAN


    my $all = $dbh->prepare("SELECT id FROM blog ORDER BY date ASC") or
      die "Failed to find posts";

    my $now = time;

    my @all = ();

    $all->execute() or die "Failed to execute:" . $dbh->errstr();
    my $id;
    $all->bind_columns( undef, \$id );

    #
    # Build up the list of all the post IDs
    #
    # We could build these on-demand, but instead maintain a list
    # such that we can add next_link, next_title, etc, and allow
    # paging through blog-entries.
    #
    while ( $all->fetch() )
    {

lib/Chronicle/Plugin/Generate/Pages.pm  view on Meta::CPAN


    my $all = $dbh->prepare("SELECT id FROM blog ORDER BY date ASC") or
      die "Failed to find posts";

    my $now = time;

    my @all = ();

    $all->execute() or die "Failed to execute:" . $dbh->errstr();
    my $id;
    $all->bind_columns( undef, \$id );

    #
    # Build up the list of all the post IDs
    #
    # We could build these on-demand, but instead maintain a list
    # such that we can add next_link, next_title, etc, and allow
    # paging through blog-entries.
    #
    while ( $all->fetch() )
    {

lib/Chronicle/Plugin/Generate/RSS.pm  view on Meta::CPAN

    my $dbh    = $args{ 'dbh' };
    my $config = $args{ 'config' };

    my $recent = $dbh->prepare(
        "SELECT id FROM blog ORDER BY date DESC LIMIT 0,$config->{'rss-count'}")
      or
      die "Failed to find recent posts";

    $recent->execute() or die "Failed to execute:" . $dbh->errstr();
    my $id;
    $recent->bind_columns( undef, \$id );


    my $entries;

    while ( $recent->fetch() )
    {
        my $post =
          Chronicle::getBlog( dbh    => $dbh,
                              id     => $id,
                              config => $config

lib/Chronicle/Plugin/Generate/Sitemap.pm  view on Meta::CPAN

    #  This is the file we're going to write.
    #
    my $output = $config->{ 'output' } . "/sitemap.xml";

    my $sql = $dbh->prepare("SELECT link FROM blog") or
      die "Failed to prepare: " . $dbh->errstr();

    my $link;
    $sql->execute();

    $sql->bind_columns( undef, \$link );

    my $urls;

    while ( $sql->fetch() )
    {
        # Handle down-cased sites.
        $link = lc($link) if ( $config->{ 'lower-case' } );

        push( @$urls, { url => $config->{ 'top' } . $link } );
    }

lib/Chronicle/Plugin/Generate/Tags.pm  view on Meta::CPAN

        "SELECT DISTINCT(name) FROM tags GROUP BY name ORDER by name COLLATE nocase"
      ) or
      die "Failed to find all tags";
    my $ids = $dbh->prepare(
        "SELECT DISTINCT(a.blog_id) FROM tags AS a JOIN blog AS b WHERE ( a.blog_id = b.id AND a.name=? ) ORDER BY b.date DESC"
      ) or
      die "Failed to find all blog posts with given tag";

    $all->execute() or die "Failed to execute:" . $dbh->errstr();
    my $tag;
    $all->bind_columns( undef, \$tag );


    while ( $all->fetch() )
    {
        #
        #  The output file to generate
        #
        my $index = $config->{ 'index_filename' } || "index.html";

        $config->{ 'verbose' } &&

lib/Chronicle/Plugin/Generate/Tags.pm  view on Meta::CPAN

        #
        #  Data for HTML::Template
        #
        my $entries;

        #
        #  For this tag get the posts associated with it.
        #
        $ids->execute($tag) or die "Failed to execute: " . $dbh->errstr();
        my $id;
        $ids->bind_columns( undef, \$id );

        while ( $ids->fetch() )
        {
            my $post =
              Chronicle::getBlog( dbh    => $dbh,
                                  id     => $id,
                                  config => $config
                                );
            if ( $config->{ 'lower-case' } )
            {

lib/Chronicle/Plugin/Generate/Tags.pm  view on Meta::CPAN

    my ( $dbh, $tag ) = (@_);

    my $ret;

    my $sql = $dbh->prepare(
        "SELECT DISTINCT(a.name) FROM tags AS a JOIN tags b ON b.blog_id=a.blog_id WHERE b.name=? AND a.name != b.name ORDER BY a.name;"
    );
    $sql->execute($tag) or die "Failed to execute:" . $dbh->errstr();

    my $found;
    $sql->bind_columns( undef, \$found );

    while ( $sql->fetch() )
    {
        push( @$ret, { tag => $found } );
    }
    $sql->finish();

    return ($ret);
}

lib/Chronicle/Plugin/Generate/Tags.pm  view on Meta::CPAN

    #
    # Now the tags.
    #
    my $sql = $dbh->prepare(
        "SELECT DISTINCT(name),COUNT(name) AS runningtotal FROM tags GROUP BY name COLLATE nocase"
      ) or
      die "Failed to prepare tag cloud";
    $sql->execute() or die "Failed to execute: " . $dbh->errstr();

    my ( $tag, $count );
    $sql->bind_columns( undef, \$tag, \$count );

    #
    # Process the results.
    #
    while ( $sql->fetch() )
    {
        my $size = $count * $step + $min;
        $size = $max if ( $size > $max );

        push( @$tags,

lib/Chronicle/Plugin/Snippets/AllTags.pm  view on Meta::CPAN

    #
    # Get the tags, and their count.
    #
    my $sql = $dbh->prepare(
        'SELECT DISTINCT(name),COUNT(name) AS runningtotal FROM tags GROUP BY name ORDER BY name'
      ) or
      die "Failed to prepare tag cloud";
    $sql->execute() or die "Failed to execute: " . $dbh->errstr();

    my ( $tag, $count );
    $sql->bind_columns( undef, \$tag, \$count );

    my $tags;

    # Default sizing options
    my $min  = $config->{ 'tag_cloud_size_min' }  || 5;
    my $max  = $config->{ 'tag_cloud_size_max' }  || 60;
    my $step = $config->{ 'tag_cloud_size_step' } || 5;

    #
    # Process the results.

lib/Chronicle/Plugin/Snippets/Archives.pm  view on Meta::CPAN

    #
    #  Find each year.
    #
    my $years = $dbh->prepare(
        "SELECT DISTINCT(strftime( '%Y', date, 'unixepoch')) FROM blog ORDER BY strftime( '%s', date, 'unixepoch' ) DESC"
      ) or
      die "Failed to prepare query";

    $years->execute() or die "Failed to execute:" . $dbh->errstr();
    my $year;
    $years->bind_columns( undef, \$year );


    while ( $years->fetch() )
    {
        push( @results, $year );
    }

    $years->finish();

    return (@results);

lib/Chronicle/Plugin/Snippets/Archives.pm  view on Meta::CPAN

    #
    #  Find each year.
    #
    my $s = $dbh->prepare(
        "SELECT DISTINCT(strftime( '%m', date, 'unixepoch')) FROM blog WHERE (strftime('%Y',date,'unixepoch') = ?) ORDER BY strftime( '%s', date, 'unixepoch' ) DESC"
      ) or
      die "Failed to prepare query";

    $s->execute($year) or die "Failed to execute:" . $dbh->errstr();
    my $mon;
    $s->bind_columns( undef, \$mon );

    while ( $s->fetch() )
    {
        push( @results, $mon );
    }

    $s->finish();

    return (@results);
}

lib/Chronicle/Plugin/Snippets/RecentPosts.pm  view on Meta::CPAN

    #  The number of posts to include.
    #
    my $count = $config->{ 'recent-post-count' } || 10;

    my $recent =
      $dbh->prepare("SELECT id FROM blog ORDER BY date DESC LIMIT 0,$count") or
      die "Failed to find recent posts";

    $recent->execute() or die "Failed to execute:" . $dbh->errstr();
    my $id;
    $recent->bind_columns( undef, \$id );


    my $entries = undef;

    while ( $recent->fetch() )
    {
        my $data = Chronicle::getBlog( dbh    => $dbh,
                                       id     => $id,
                                       config => $config
                                     );

lib/Chronicle/Plugin/Snippets/RecentTags.pm  view on Meta::CPAN

    #
    $count = $dbh->prepare("SELECT COUNT(name) FROM tags WHERE name=?") or
      die "Failed to count tag-usage: " . $dbh->errstr();


    #
    #  Look for the recent tags
    #
    $recent->execute() or die "Failed to execute:" . $dbh->errstr();
    my $tag;
    $recent->bind_columns( undef, \$tag );


    my $entries = undef;
    my %SEEN;

    while ( $recent->fetch() )
    {
        # Count prior-uses
        $count->execute($tag);
        my $c = $count->fetchrow_array();

lib/Chronicle/Plugin/StaticPages.pm  view on Meta::CPAN

    #
    #  Fetch all the static-pages.
    #
    my $pages =
      $dbh->prepare("SELECT filename,title,content,template FROM pages") or
      die "Failed to find static-pages";
    $pages->execute() or die "Failed to execute query";


    my ( $filename, $content, $title, $template );
    $pages->bind_columns( undef, \$filename, \$title, \$content, \$template );

    #
    #  Build each page.
    #
    while ( my $page = $pages->fetch() )
    {

        $config->{ 'verbose' } &&
          print
          "Generating static-page: Title:$title -> $config->{'output'}/$filename\n";

themes/bs2/static/js/jquery-1.7.1.min.js  view on Meta::CPAN

/*! jQuery v1.7.1 jquery.com | jquery.org/license */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("ifram...
f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){ret...
{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this...



( run in 3.502 seconds using v1.01-cache-2.11-cpan-2398b32b56e )