"Fossies" - the Fresh Open Source Software Archive

Member "ZoneMaster-0.99.2/lib/ZoneMaster/View/JobList.pm" (5 May 2003, 2874 Bytes) of package /linux/misc/dns/old/ZoneMaster-0.99.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/local/bin/perl -w
    2 ######################################################################
    3 #
    4 # ZoneMaster/View/JobList.pm
    5 #
    6 # $Id: JobList.pm,v 1.10 2003/05/05 13:10:58 aw Exp $
    7 # $Revision: 1.10 $
    8 # $Author: aw $
    9 # $Date: 2003/05/05 13:10:58 $
   10 #
   11 # The ZoneMaster project
   12 # Management of zonefiles and nameservers.
   13 #
   14 # ZoneMaster is a nameserver management system written
   15 # entirely in perl. It provides a web-based user-interface
   16 # and uses a SQL-database to store all relevant information.
   17 #
   18 # Copyright (C)2001-2003 Andy Wolf. All rights reserved.
   19 #
   20 # This program is free software; you can redistribute it and/or
   21 # modify it under the terms of the GNU General Public License as
   22 # published by the Free Software Foundation; either version 2 of
   23 # the License, or (at your option) any later version.
   24 #
   25 ######################################################################
   26 
   27 package ZoneMaster::View::JobList;
   28 
   29 no warnings 'portable';
   30 use 5.6.0;
   31 use strict;
   32 use warnings;
   33 
   34 my $REVISION  = sprintf("%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/);
   35 
   36 use vars qw(@ISA);
   37 use ZoneMaster::View;
   38 
   39 @ISA = qw(ZoneMaster::View);
   40 
   41 sub new {
   42     my($pkg, $db) = @_;
   43     my $class = ref($pkg) || $pkg;
   44 
   45     my $self = $class->SUPER::new("JobListView.xsl");
   46 
   47     $self->{'DB'} = $db;
   48     
   49     bless $self, $class;
   50 
   51     return $self;
   52 }
   53 
   54 sub execute {
   55     my($self, $query, $session) = @_;
   56 
   57     my $keyword   = $query->param('keyword') || '';
   58     my $limit     = 20;     # max. entries per page (->user configuration)
   59     my $sort      = 'zone'; # primary sort column   (->user configuration)
   60     my $order     = 'asc';  # sort order            (->user configuration)
   61     my $pageindex = $query->param('pageindex') || 1;    # page index
   62 
   63     $self->add("<JobListView>");
   64 
   65     my $cp = $self->{'DB'}->map_adaptor('ZoneMaster::Job')->count_pages($limit, $keyword);
   66 
   67     $self->add($self->get_options_xml($query, $session, "", $keyword, $pageindex, $cp, $limit));
   68     $self->add("<JobList>");
   69     $self->add($self->{'DB'}->xmlquery({
   70         '_CLASS'    => 'ZoneMaster::Job',
   71         'KEYWORD'   => $keyword,
   72         'PAGESIZE'  => $limit,
   73         'SORT'      => $sort,
   74         'ORDER'     => $order,
   75         'PAGEINDEX' => $pageindex
   76     }));
   77     $self->add("</JobList>");
   78     $self->add("</JobListView>");
   79 
   80     $self->print();
   81 
   82     return;
   83 }
   84 
   85 1;
   86 
   87 __END__
   88 
   89 =pod
   90 
   91 =head1 NAME
   92 
   93 ZoneMaster::View::JobList - Implements business logic for listing jobs
   94 
   95 =head1 DESCRIPTION
   96 
   97 This class implements a command design pattern. It provides the logic required
   98 to list jobs.
   99 
  100 =head1 AUTHOR
  101 
  102 Copyright (C)2001-2003, Andy Wolf. All rights reserved.
  103 
  104 This program is free software; you can redistribute it and/or
  105 modify it under the terms of the GNU General Public License as
  106 published by the Free Software Foundation; either version 2 of
  107 the License, or (at your option) any later version.
  108 
  109 Please address bug reports and comments to: 
  110 zonemaster@users.sourceforge.net
  111 
  112 =head1 SEE ALSO
  113 
  114 L<ZoneMaster::View>
  115 
  116 =cut
  117 
  118