CGI-ProgressBar

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    It aims to require that the recipient client have a minimum of
    JavaScript 1.0, HTML 4.0, ancd CSS/1, but this has yet to be tested.

    All feedback would be most welcome. Address at the end of the POD.

  DEPENDENCIES
            CGI

  EXPORT
            progress_bar
            update_progress_bar
            hide_progress_bar

USE
    The module sub-classes CGI.pm, providing three additional methods (or
    functions, depending on your taste), each of which are detailed below.

    Simply replace your "use CGI qw//;" with "use CGI::ProgressBar qw//;".

    Make sure you are aware of your output buffer size: "$|=$smothingsmall".

    Treat each new function as any other CGI.pm HTML-producing routine with
    the exception that the arguments should be supplied as in OOP form. In
    other words, the following are all the same:

            my $html = $query->progress_bar;
            my $html = progress_bar;
            my $html = progress_bar(from=>1, to=>10);
            my $html = $query->progress_bar(from=>1, to=>10);
            my $html = $query->progress_bar(-to=>10);

    This will probably change if someone would like it to.

FUNCTIONS/METHODS
  FUNCTION/METHOD progress_bar
    Returns mark-up that instantiates a progress bar. Currently that is HTML
    and JS, but perhaps the JS ought to go into the head.

    The progress bar itself is an object in this class, stored in the
    calling ("CGI") object - specifically in the field "progress_bar", which
    we create. (TODO: Make this field an array to allow multiple bars per
    page.)

    from
    to  Values which the progress bar spans. Defaults: 0, 100.

    orientation
        If set to "vertical" displays the bar as a strip down the screen;
        otherwise, places it across the screen.

    blocks
        The number of blocks to appear in the progress bar. Default: 10. You
        probably want to link this to "from" and "to" or better still, leave
        it well alone: it may have been a mistake to even include it.
        "steps" is an alias for this attribute.

    width
    height
        The width and height of the progress bar, in pixels. Cannot accept
        percentages (yet). Defaults: 400, 20, unless you specify
        "orientation" as "vertical", in which case this is reversed.

    gap The amount of space between blocks, in pixels. Default: 1.

    label
        Supply this parameter with a true value to have a numerical display
        of progress. Default is not to display it.

    layer_id
        Most HTML elements on the page have "id" attributes. These can be
        accessed through the "layer_id" field, which is a hash with the
        follwoing keys relating to the "id" value:

    mycss
        Custom CSS to be written inline (ugh) after any system CSS.

        form
            The "form" which contains everything we display.

        container
            The "div" containing everything we display.

        block
            This value is used as a prefixed for the "id" of each block of
            the bar, with the suffix being a number incremented from 1.

        number
            The digits being updated as the bar progresses, if the option is
            enabled.

  FUNCTION/METHOD update_progress_bar
    Updates the progress bar.

  FUNCTION/METHOD hide_progress_bar
    Hides the progress bar.

CSS STYLE CLASS EMPLOYED
    You can add CSS to be output into the page body (ugh) in the "mycss"
    field. Bear in mind that the width and height settings are
    programatically assigned.

    pblib_bar
    A "DIV" containing the whole progress bar, including any accessories
    (such as the label). The only attribute used by this module is "width",
    which is set dynamically. The rest is up to you. A good start is:

            padding:    2 px;
            border:     solid black 1px;
            text-align: center;

    pblib_block_off, pblib_block_on
    An individual block within the status bar. The following attributes are
    set dynamically: "width", "height", "margin-right".

    pblib_number
    Formatting for the "label" text (part of which is actually an "input
    type='text'" element. "border" and "text-align" are used here, and the
    whole appears centred within a "table".

BUGS, CAVEATS, TODO



( run in 3.044 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )