App-Widget

 view release on metacpan or  search on metacpan

cgi-bin/app-button  view on Meta::CPAN

#!/usr/bin/perl -wT

#########################################################
# TODO
#########################################################
# o load image from file
# o load image from URL
#########################################################

BEGIN {
    #$ENV{GDFONTPATH} = "/usr/local/fonts";
    #$ENV{DEFAULT_FONTPATH} = "/usr/local/fonts";
}

use CGI;
$cgi = new CGI;

use GD;

#########################################################
# CREATE THE IMAGE
#########################################################

cgi-bin/app-button  view on Meta::CPAN

$bevel = $cgi->param("bevel");
$bevel = "2" if (! defined $bevel);

$mode = $cgi->param("mode");
if (! defined $mode) {
    $mode = $0;
    $mode =~ s!.*/!!;
    $mode =~ s!^app-!!;
}

$fontsize = $cgi->param("fontsize");
$fontsize = 8 if (! defined $fontsize);
$fontsize = 1 if ($fontsize <= 0);

$fontcolor = $cgi->param("fontcolor");
$fontcolor = "#000000" if (! defined $fontcolor);

$fontname = $cgi->param("fontname");
$fontname = "builtin" if (! defined $fontname);

@builtin_font = (
    gdTinyFont,       gdTinyFont,       gdTinyFont,       gdTinyFont,       gdTinyFont,       #  0- 4
    gdSmallFont,      gdSmallFont,      gdSmallFont,      gdSmallFont,                        #  5- 8
    gdMediumBoldFont, gdMediumBoldFont, gdMediumBoldFont, gdMediumBoldFont,                   #  9-12
    gdLargeFont,      gdLargeFont,      gdLargeFont,      gdLargeFont,                        # 13-16
    gdGiantFont,      gdGiantFont,      gdGiantFont,      gdGiantFont,                        # 17-20
);

if ($mode eq "button") {
    $im->fill(0,0,&color($bgcolor));

cgi-bin/app-button  view on Meta::CPAN

    $im->line(0       ,$height-1,$width-1,$height-1,&color("#888888"));  # bottom
    $im->line($width-1,0        ,$width-1,$height-1,&color("#888888"));  # right

    if ($bevel > 1) {
        $im->line(1       ,1        ,$width-2,1        ,&color("#dddddd"));  # top
        $im->line(1       ,1        ,1       ,$height-2,&color("#dddddd"));  # left
        $im->line(1       ,$height-2,$width-2,$height-2,&color("#aaaaaa"));  # bottom
        $im->line($width-2,1        ,$width-2,$height-2,&color("#aaaaaa"));  # right
    }

    if (defined $fontname && $fontname ne "" && $fontname ne "builtin") {
        $fontfile = lc($fontname);
        $fontfile .= ".ttf" if ($fontfile !~ /\.ttf$/);
        $fontfile = "/usr/local/fonts/$fontfile";
        @bounds = GD::Image->stringTTF(0,$fontfile,$fontsize,0,1,1,$text);
        if ($#bounds == 7) {
            $stringheight = $bounds[5] - $bounds[3];
            $stringwidth = $bounds[2] - $bounds[0];
            $x = int(($width - $stringwidth)/2);
            $y = int(($height - $stringheight)/2);
            $im->stringTTF(&color($fontcolor),$fontfile,$fontsize,0,$x,$y,$text);
        }
        else {
            $im->string(gdSmallFont,5,5,$@ . ": $fontfile",&color($fontcolor));
        }
    }
    else {
        $fontsize = $#builtin_font if ($fontsize > $#builtin_font);
        $font = $builtin_font[$fontsize];
        $fontheight = $font->height;
        $fontwidth = $font->width;
        $x = int(($width - $fontwidth*length($text))/2);
        $y = int(($height - $fontheight + 1)/2);
        $im->string($font,$x,$y,$text,&color($fontcolor));
    }
}
elsif ($mode eq "tab2") {
    $im->fill(0,0,&color($bgcolor));

    $im->line(0       ,0        ,$width-1,0        ,&color("#ffffff"));  # top
    $im->line(0       ,0        ,0       ,$height-1,&color("#ffffff"));  # left
    $im->line(0       ,$height-1,$width-1,$height-1,&color("#888888"));  # bottom
    $im->line($width-1,0        ,$width-1,$height-1,&color("#888888"));  # right

    if ($bevel > 1) {
        $im->line(1       ,1        ,$width-2,1        ,&color("#dddddd"));  # top
        $im->line(1       ,1        ,1       ,$height-2,&color("#dddddd"));  # left
        $im->line(1       ,$height-2,$width-2,$height-2,&color("#aaaaaa"));  # bottom
        $im->line($width-2,1        ,$width-2,$height-2,&color("#aaaaaa"));  # right
    }

    if (defined $fontname && $fontname ne "" && $fontname ne "builtin") {
        $fontfile = lc($fontname);
        $fontfile .= ".ttf" if ($fontfile !~ /\.ttf$/);
        $fontfile = "/usr/local/fonts/$fontfile";
        @bounds = GD::Image->stringTTF(0,$fontfile,$fontsize,0,1,1,$text);
        if ($#bounds == 7) {
            $stringheight = $bounds[5] - $bounds[3];
            $stringwidth = $bounds[2] - $bounds[0];
            $x = int(($width - $stringwidth)/2);
            $y = int(($height - $stringheight)/2);
            $im->stringTTF(&color($fontcolor),$fontfile,$fontsize,0,$x,$y,$text);
        }
        else {
            $im->string(gdSmallFont,5,5,$@ . ": $fontfile",&color($fontcolor));
        }
    }
    else {
        $fontsize = $#builtin_font if ($fontsize > $#builtin_font);
        $font = $builtin_font[$fontsize];
        $fontheight = $font->height;
        $fontwidth = $font->width;
        $x = int(($width - $fontwidth*length($text))/2);
        $y = int(($height - $fontheight + 1)/2);
        $im->string($font,$x,$y,$text,&color($fontcolor));
    }
}
elsif ($mode eq "tab") {
    $im->fill(0,0,&color($bgcolor));
    my $selected = $cgi->param("selected");
    my $corner = $cgi->param("corner");
    $corner = 6 if (!defined $corner);

    # Black Outline
    $im->line($corner+1      ,1        ,$width-$corner,1        ,&color("#000000"));  # top

cgi-bin/app-button  view on Meta::CPAN

    $im->line($corner+1      ,2        ,1             ,$corner+1,&color("#ffffff"));  # top-left corner
    $im->line(1              ,$height-1,1             ,$corner+1,&color("#ffffff"));  # left
    $im->line(0              ,$height-1,0             ,$height-2,&color("#ffffff"));  # bottom left
    $im->line($width-1       ,$height-1,$width-1      ,$height-2,&color("#ffffff"));  # bottom left

    # Gray shadow
    $im->line($width-$corner ,2        ,$width-1      ,$corner+1,&color("#888888"));  # top-right corner
    $im->line($width-1       ,$corner+1,$width-1      ,$height-3,&color("#888888"));  # right

    if ($selected) {
        $fontsize += 2;
    }
    else {
        $im->line(0              ,$height-1,$width-1      ,$height-1,&color("#ffffff"));  # bottom
        $im->line(0              ,$height-2,$width-1      ,$height-2,&color("#ffffff"));  # bottom
        $im->line(0              ,$height-3,$width-1      ,$height-3,&color("#000000"));  # bottom line
    }

    if (defined $fontname && $fontname ne "" && $fontname ne "builtin") {
        $fontfile = lc($fontname);
        $fontfile .= ".ttf" if ($fontfile !~ /\.ttf$/);
        $fontfile = "/usr/local/fonts/$fontfile";
        @bounds = GD::Image->stringTTF(0,$fontfile,$fontsize,0,1,1,$text);
        if ($#bounds == 7) {
            $stringheight = $bounds[5] - $bounds[3];
            $stringwidth = $bounds[2] - $bounds[0];
            $x = int(($width - $stringwidth)/2);
            $y = int(($height - $stringheight)/2);
            $im->stringTTF(&color($fontcolor),$fontfile,$fontsize,0,$x,$y,$text);
        }
        else {
            $im->string(gdSmallFont,5,5,$@ . ": $fontfile",&color($fontcolor));
        }
    }
    else {
        $fontsize = $#builtin_font if ($fontsize > $#builtin_font);
        $font = $builtin_font[$fontsize];
        $fontheight = $font->height;
        $fontwidth = $font->width;
        $x = int(($width - $fontwidth*length($text))/2);
        $y = int(($height - $fontheight + 1)/2);
        $im->string($font,$x,$y,$text,&color($fontcolor));
    }
}
else {
    $im->rectangle(0,0,99,99,&color("black"));  # Put a black frame around the picture
    $im->arc(50,50,95,75,0,360,&color("blue")); # Draw a blue oval
    $im->fill(50,50,&color("red"));             # And fill it with red
}

binmode STDOUT;   # make sure we are writing to a binary stream

lib/App/Widget.pm  view on Meta::CPAN

        $msg =~ s{>}{&gt;}gso;
        $msg =~ s{\"}{&quot;}gso;
        $msg =~ s{\n}{<br>\n}gso;
        $name = $self->{name};
        $html = <<EOF;
<table border="1" cellspacing="0">
<tr><td bgcolor="#aaaaaa">
<b>Widget Display Error: $name</b><br>
</td></tr>
<tr><td bgcolor="#ffaaaa">
<font size="-1" face="sans-serif">
$msg
</font>
</td></tr>
</table>
EOF
    }

    if (defined $self->{content}) {
        my $content = $self->{content};
        $self->{content} = "";
        &App::sub_exit($content) if ($App::trace);
        return($content);

lib/App/Widget/AppFrame.pm  view on Meta::CPAN

        #}

        #$screentitle_widget = $context->widget("$name-screentitle",
        #    -label     => $screentitle_value,
        #    -bgcolor   => "#888888",
        #);
        #$screentitle_bgcolor = $screentitle_widget->get("bgcolor");
        #$screentitle = $screentitle_widget->html();

        $screentitle_bgcolor = "#888888";
        $screentitle = "<font face=verdana,geneva,arial,sans-serif size=+1 color=#ffffff>$screentitle_value</font>";

#  <tr>
#    <td colspan="2" valign="top" height="1%">
#      $menu
#    </td>
#  </tr>
#  <tr>
#    <td colspan="2" valign="top" height="1%">
#      $toolbar
#    </td>

lib/App/Widget/AppFrame.pm  view on Meta::CPAN

#    <td valign="top" height="1%">
#      $screentoolbar
#    </td>
#  </tr>

        my ($messages, $messagebox);
        $messages = $context->get_messages();
        $messages =~ s/\n/<br>\n/g;
        $messagebox = "";
        if (defined $messages && $messages ne "") {
            my ($elem_begin, $elem_end, $font_face, $font_size, $font_color);
            $font_face  = $self->{font_face} || "verdana,geneva,arial,sans-serif";
            $font_size  = $self->{font_size} || "+1";
            $font_color = $self->{font_color};
            $elem_begin = "";
            $elem_end = "";
            if ($font_face || $font_size || $font_color) {
                $elem_begin = "<font";
                $elem_begin .= " face=\"$font_face\""   if ($font_face);
                $elem_begin .= " size=\"" . ($font_size+1) . "\""   if ($font_size);
                $elem_begin .= " color=\"$font_color\"" if ($font_color);
                $elem_begin .= ">";
                $elem_end = "</font>";
            }

            $messagebox = <<EOF;
<table width=100% border=0 cellspacing=0 cellpadding=4>
  <TR>
    <TD>
      <table width=100% border=0 cellspacing=0 cellpadding=4>
        <TR>
          <TD class=body_sub1 valign=top align=left bgcolor=#ffaaaa>$elem_begin<B>Messages</B>$elem_end</TD>
        </TR>

lib/App/Widget/DataTable.pm  view on Meta::CPAN


######################################################################
# ATTRIBUTES
######################################################################
# {border}            = 0;
# {cellspacing}       = 2;
# {cellpadding}       = 0;
# {width}             = "";
# {bgcolor}           = "";
# {nowrap}            = "1";
# {font_face}         = "verdana,geneva,arial,sans-serif";
# {font_size}         = "-2";
# {font_color}        = "";
# {heading_bgcolor}   = "#cccccc";
# {heading_nowrap}    = 0;
# {heading_align}     = 0;
# {heading_valign}    = 0;
# {column_selectable} = 1;
# {row_selectable}    = 0;
# {row_single_selectable} = 0;
# {columns}           = [ "Name", "Address", "City", "State", "Country", "Home Phone" ];
# {headings}          = [ "Name", "Address", "City", "State", "Country", "Home Phone" ];
# {data}              = [ [ "Smith, Harold", "1215 Interloke Pass", "Jonesboro", "GA", "US", "770-603-1810" ],

lib/App/Widget/DataTable.pm  view on Meta::CPAN


    my ($context, $name, $data);
    $context   = $self->{context};
    $name = $self->{name};

    my ($key, $column);

    my ($numcols, $table, $title);
    my ($width, $border, $cellspacing, $cellpadding);
    my ($bgcolor, $align, $valign, $nowrap);
    my ($font_face, $font_size, $font_color);
    my ($heading_bgcolor, $heading_align, $heading_valign, $heading_nowrap);
    my ($columns, $headings, $scrollable, $sortable, $filterable, $editable);
    my ($startrow, $numrow, $numbered);
    my ($keys, $mode, $sql);
    my ($column_selectable, $row_selectable, $row_single_selectable, $elem_selected, $single_row_select);
    my (@edit_style, @column_length);
    my ($rowactions, $rowactiondefs, $rowaction, $rowactiondef);
    my (@select_actions, @single_select_actions, @row_actions);

    $table             = $self->get("table");
    return "No table defined." if (!$table);
    $columns           = $self->get_columns();
    return "No columns defined for table [$table]. (maybe it doesn't exist)" if (!$columns || $#$columns == -1);
    $headings          = $self->get_headings();
    $data              = $self->get_data();
    $startrow          = $self->get("startrow",         1);
    $title             = $self->get("title");
    $width             = $self->get("width");
    $bgcolor           = $self->get("bgcolor");
    $font_color        = $self->get("font_color");
    $border            = $self->get("border",           0);
    $cellspacing       = $self->get("cellspacing",      2);
    $cellpadding       = $self->get("cellpadding",      2);
    $align             = $self->get("align",            "");
    $valign            = $self->get("valign",           "top");
    $nowrap            = $self->get("nowrap",           1);
    $font_face         = $self->get("font_face",         "verdana,geneva,arial,sans-serif");
    $font_size         = $self->get("font_size",         -2);
    $heading_bgcolor   = $self->get("heading_bgcolor",   "#cccccc");
    $heading_align     = $self->get("heading_align",     $align);
    $heading_valign    = $self->get("heading_valign",    "bottom");
    $heading_nowrap    = $self->get("heading_nowrap",    $nowrap);
    $mode              = $self->get("mode",             "view");
    $scrollable        = $self->get("scrollable",       0);
    $sortable          = $self->get("sortable",         0);
    $filterable        = $self->get("filterable",       0);
    $editable          = $self->get("editable",         0);
    $numbered          = $self->get("numbered",         1);

lib/App/Widget/DataTable.pm  view on Meta::CPAN

        $title = $context->substitute($title);
        $html .= $title;
    }

    $numcols = $self->{numcols} || $#$headings + 1;

    if ($scrollable || $sortable || $filterable || $mode eq "edit") {

        $elem_begin = "";
        $elem_end = "";
        if ($font_face || $font_size || $font_color) {
            $elem_begin = "<font";
            $elem_begin .= " face=\"$font_face\""   if ($font_face);
            $elem_begin .= " size=\"" . ($font_size+1) . "\""   if ($font_size);
            $elem_begin .= " color=\"$font_color\"" if ($font_color);
            $elem_begin .= ">";
            $elem_end = "</font>";
        }

        if ($scrollable) {
            $html .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\"><tr><td>\n";
            $html .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td valign=\"middle\" nowrap>&nbsp;\n";
            $html .= $context->widget("$name-view",
                         class => "App::Widget::ImageButton",
                         image_script => 'app-button',
                         #volatile => 1,
                         label => 'View',

lib/App/Widget/DataTable.pm  view on Meta::CPAN

            }
            $html .= "</tr>\n";
        }
    }
    else {
        $html .= $table_begin;
    }

    $elem_begin = "";
    $elem_end = "";
    if ($font_face || $font_size || $font_color) {
        $elem_begin = "<font";
        $elem_begin .= " face=\"$font_face\""   if ($font_face);
        $elem_begin .= " size=\"$font_size\""   if ($font_size);
        $elem_begin .= " color=\"$font_color\"" if ($font_color);
        $elem_begin .= ">";
        $elem_end = "</font>";
    }

    $td_row_attrib = "";
    $td_row_attrib .= " bgcolor=\"$heading_bgcolor\"" if ($heading_bgcolor);
    $td_row_attrib .= " align=\"$heading_align\""     if ($heading_align);
    $td_row_attrib .= " valign=\"$heading_valign\""   if ($heading_valign);
    $td_row_attrib .= " nowrap" if ($heading_nowrap);

    $html .= "<tr>\n";
    $html .= "  <td bgcolor=\"$heading_bgcolor\">&nbsp;</td>\n" if ($numbered);

lib/App/Widget/DataTable.pm  view on Meta::CPAN

    $td_row_attrib .= " valign=\"$valign\"" if ($valign);
    $td_row_attrib .= " nowrap" if ($nowrap);

    # since we are editing, we need to prepare these two arrays...
    @edit_style = ();
    @column_length = ();

    if ($mode eq "edit") {

        # prepare the style attribute arrays
        push(@edit_style, "font_family", $font_face)  if ($font_face);
        push(@edit_style, "color",      $font_color) if ($font_color);

        # This seems to cause <input> elements to take on the font size
        # currently active for text that surrounds them
        # i.e. <font size="-2"><input type="text" style="font-size: 100%;"></font>
        push(@edit_style, "font_size",   "100%")     if ($font_size);

        # border_style",
        # border_width",
        # border_color",
        # padding",
        # background_color",

        # any columns we are editing, we need to compute max width (size) for textfield
        for ($col = 0; $col < $numcols; $col++) {
            $column_length[$col] = 5;  # minimum length

lib/App/Widget/DataTable2.pm  view on Meta::CPAN


######################################################################
# ATTRIBUTES
######################################################################
# {border}            = 0;
# {cellspacing}       = 2;
# {cellpadding}       = 0;
# {width}             = "";
# {bgcolor}           = "";
# {nowrap}            = "1";
# {font_face}         = "verdana,geneva,arial,sans-serif";
# {font_size}         = "-2";
# {font_color}        = "";
# {heading_bgcolor}   = "#cccccc";
# {heading_nowrap}    = 0;
# {heading_align}     = 0;
# {heading_valign}    = 0;
# {column_selectable} = 1;
# {row_selectable}    = 0;
# {row_single_selectable} = 0;
# {columns}           = [ "Name", "Address", "City", "State", "Country", "Home Phone" ];
# {headings}          = [ "Name", "Address", "City", "State", "Country", "Home Phone" ];
# {data}              = [ [ "Smith, Harold", "1215 Interloke Pass", "Jonesboro", "GA", "US", "770-603-1810" ],

lib/App/Widget/DataTable2.pm  view on Meta::CPAN


    my ($context, $name, $data);
    $context   = $self->{context};
    $name = $self->{name};

    my ($key, $column);

    my ($numcols, $table, $title);
    my ($width, $border, $cellspacing, $cellpadding);
    my ($bgcolor, $align, $valign, $nowrap);
    my ($font_face, $font_size, $font_color);
    my ($heading_bgcolor, $heading_align, $heading_valign, $heading_nowrap);
    my ($columns, $headings, $scrollable, $sortable, $filterable, $editable);
    my ($startrow, $numrow, $numbered);
    my ($keys, $mode, $sql);
    my ($column_selectable, $row_selectable, $row_single_selectable, $elem_selected, $single_row_select);
    my (@edit_style, @column_length);
    my ($rowactions, $rowactiondefs, $rowaction, $rowactiondef);
    my (@select_actions, @single_select_actions, @row_actions);

    $table             = $self->{table};
    $columns           = $self->get_columns();
    return "No columns defined for table [$table]. (maybe it doesn't exist)" if (!$columns || $#$columns == -1);
    $headings          = $self->get_headings();
    $data              = $self->get_data();
    my $compatibility  = $self->{compatibility}  || "";  # values: [HTML32]
    $startrow          = $self->{startrow}          || 1;
    $title             = $self->{title};
    $width             = $self->{width};
    $bgcolor           = $self->{bgcolor};
    $font_color        = $self->{font_color};
    $border            = $self->{border}            || 0;
    $cellspacing       = $self->{cellspacing}       || 2;
    $cellpadding       = $self->{cellpadding}       || 2;
    $align             = $self->{align}             || "";
    $valign            = $self->{valign}            || "top";
    $nowrap            = (defined $self->{nowrap}) ? $self->{nowrap} : 1;
    $font_face         = $self->{font_face}         || "verdana,geneva,arial,sans-serif";
    $font_size         = $self->{font_size}         || -2;
    $heading_bgcolor   = $self->{heading_bgcolor}   || "#cccccc";
    $heading_align     = $self->{heading_align}     || $align;
    $heading_valign    = $self->{heading_valign}    || "bottom";
    $heading_nowrap    = $self->{heading_nowrap}    || $nowrap;
    $mode              = $self->{mode}              || "view";
    $scrollable        = $self->{scrollable}        || 0;
    $sortable          = $self->{sortable}          || 0;
    $filterable        = $self->{filterable}        || 0;
    $editable          = $self->{editable}          || 0;
    my $deletable      = $self->{deletable};

lib/App/Widget/DataTable2.pm  view on Meta::CPAN

        $html .= $title;
    }

    $numcols = $self->{numcols} || $#$headings + 1;

    if ($scrollable || $sortable || $filterable || $mode eq "edit") {

        $elem_begin = "";
        $elem_end = "";
        if ($compatibility eq "HTML32") {
            if ($font_face || $font_size || $font_color) {
                $elem_begin = "<font";
                $elem_begin .= " face=\"$font_face\""   if ($font_face);
                $elem_begin .= " size=\"" . ($font_size+1) . "\""   if ($font_size);
                $elem_begin .= " color=\"$font_color\"" if ($font_color);
                $elem_begin .= ">";
                $elem_end = "</font>";
            }
        }

        if ($scrollable) {
            $html .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\"><tr><td>\n";
            $html .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td valign=\"middle\" nowrap>&nbsp;\n";
            $html .= $context->widget("$name-refresh",
                         class => "App::Widget::ImageButton",
                         image_script => 'App/app-button',
                         #volatile => 1,

lib/App/Widget/DataTable2.pm  view on Meta::CPAN

            $html .= "</tr>\n";
        }
    }
    else {
        $html .= $table_begin;
    }

    $elem_begin = "";
    $elem_end = "";
    if ($compatibility eq "HTML32") {
        if ($font_face || $font_size || $font_color) {
            $elem_begin = "<font";
            $elem_begin .= " face=\"$font_face\""   if ($font_face);
            $elem_begin .= " size=\"$font_size\""   if ($font_size);
            $elem_begin .= " color=\"$font_color\"" if ($font_color);
            $elem_begin .= ">";
            $elem_end = "</font>";
        }
    }
    $td_row_attrib = "";
    $td_row_attrib .= " bgcolor=\"$heading_bgcolor\"" if ($heading_bgcolor);
    $td_row_attrib .= " align=\"$heading_align\""     if ($heading_align);
    $td_row_attrib .= " valign=\"$heading_valign\""   if ($heading_valign);
    $td_row_attrib .= " nowrap" if ($heading_nowrap);

    $html .= "<tr>\n";
    $html .= "  <td bgcolor=\"$heading_bgcolor\">&nbsp;</td>\n" if ($numbered);

lib/App/Widget/DataTable2.pm  view on Meta::CPAN

    $td_row_attrib .= " nowrap" if ($nowrap);

    # since we are editing, we need to prepare these two arrays...
    @edit_style = ();
    @column_length = ();

    my ($view_widget_args, $view_widget, $view_width);

    if ($mode eq "edit") {
        # prepare the style attribute arrays
        push(@edit_style, "font_family", $font_face)  if ($font_face);
        push(@edit_style, "color",      $font_color)  if ($font_color);

        # This seems to cause <input> elements to take on the font size
        # currently active for text that surrounds them
        # i.e. <font size="-2"><input type="text" style="font-size: 100%;"></font>
        push(@edit_style, "font_size",   "100%")      if ($font_size);

        # border_style",
        # border_width",
        # border_color",
        # padding",
        # background_color",

        # any columns we are editing, we need to compute max width (size) for textfield
        for ($col = 0; $col < $numcols; $col++) {
            $column_length[$col] = 5;  # minimum length

lib/App/Widget/DateField.pm  view on Meta::CPAN

   use App;
   $context = App->context();
   $w = $context->widget($name);
   # OR ...
   $w = $context->widget($name,
      class => "App::Widget::DateField",
      size  => 8,                 # from HTML spec
      maxlength => 18,            # from HTML spec
      style => "mystyle",         # from HTML to support CSS
      color => "#6666CC",         # from CSS spec
      font_size => "10px",        # from CSS spec
      border_style => "solid",    # from CSS spec
      border_width => "1px",      # from CSS spec
      border_color => "#6666CC",  # from CSS spec
      padding => "2px",           # from CSS spec
      background_color => "#ccffcc",           # from CSS spec
      font_family => "Verdana, Geneva, Arial", # from CSS spec
      override => 1,              # increase precedence of following options to "override" from "default"
      #validate => "date",         # not impl. yet ("date", "time", "datetime", "enum", "number", "integer", ":regexp")
      #autocomplete => \@previous_choices,  # not impl. yet
   );

   # internal way
   use App::Widget::DateField;
   $w = App::Widget::DateField->new($name);

=cut

lib/App/Widget/IconPaneSelector.pm  view on Meta::CPAN

# OUTPUT METHODS
######################################################################

sub html {
    my $self = shift;
    my ($html, $label, $icon);
    my $context = $self->{context};
    my $name    = $self->{name};
    my $node    = $self->node_list();

    my ($bgcolor, $fontface, $fontsize, $fontcolor, $fontbegin, $fontend);

    $bgcolor   = $self->get("bgcolor",   "#888888");
    $fontface  = $self->get("fontface",  "verdana,geneva,arial,sans-serif");
    $fontsize  = $self->get("fontsize",  "-2");
    $fontcolor = $self->get("fontcolor", "#ffffff");

    $fontbegin = "<font face=\"$fontface\" size=\"$fontsize\" color=\"$fontcolor\">";
    $fontend   = "</font>";

    my ($nodebase, $nodeidx, $nodenumber, $nodelabel, $parentnodenumber, $nodelevel, $opennodenumber);
    my (@nextnodebase, @nextnodeidx, @nextnodelevel);

    @nextnodebase  = ("");   # the next nodenumber to check is "$nodebase$nodeidx" (nodenumber = "1" is first)
    @nextnodeidx   = (1);    # check nodenumber "1" next
    @nextnodelevel = (1);    # index into the resulting table that the folder icon will go

    $html = <<EOF;
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="1%">
  <tr>
    <td bgcolor="$bgcolor" align="center" valign="top">$fontbegin
EOF

    $opennodenumber = 9999;

    while ($#nextnodebase > -1) {
        $nodebase  = pop(@nextnodebase);   # get info about next node to check
        $nodeidx   = pop(@nextnodeidx);
        $nodelevel = pop(@nextnodelevel);
        $nodenumber = "$nodebase$nodeidx"; # create its node number

        if (defined $node->{$nodenumber}) {      # if the node exists...

            if ($nodelevel == 1) {
                
                $opennodenumber = $nodenumber if ($node->{$nodenumber}{open});
                if ($nodenumber == $opennodenumber+1) {
                    $html .= <<EOF;
    <p>&nbsp;$fontend</td>
  </tr>
  <tr>
    <td bgcolor="$bgcolor" align="center" valign="bottom">$fontbegin
EOF
                }

                $label = $node->{$nodenumber}{label};
                $label = $node->{$nodenumber}{value} if (!defined $label);
                $label = "" if (!defined $label);
                $html .= $context->widget("$name-button$nodenumber",
                    class => "App::Widget::ImageButton",
                    image_script => "app-button",
                    volatile     => 1,

lib/App/Widget/IconPaneSelector.pm  view on Meta::CPAN


            if ($node->{$nodenumber}{open} || $nodelevel > 1) {
                push(@nextnodebase,  "${nodenumber}."); #   let's search for the node's children (1 deeper, idx 1)
                push(@nextnodeidx,   1);                #   (idx is 1)
                push(@nextnodelevel, $nodelevel+1);     #   (1 deeper)
            }
        }
    }

    $html .= <<EOF;
    $fontend</td>
  </tr>
</table>
EOF

    $html;
}

1;

lib/App/Widget/Password.pm  view on Meta::CPAN

   $context = App->context();
   $w = $context->widget($name);
   # OR ...
   $w = $context->widget($name,
      class => "App::Widget::Password",
      size  => 8,                 # from HTML spec
      maxlength => 18,            # from HTML spec
      tabindex => 1,              # from HTML spec
      style => "mystyle",         # from HTML to support CSS
      color => "#6666CC",         # from CSS spec
      font_size => "10px",        # from CSS spec
      border_style => "solid",    # from CSS spec
      border_width => "1px",      # from CSS spec
      border_color => "#6666CC",  # from CSS spec
      padding => "2px",           # from CSS spec
      background_color => "#ccffcc",           # from CSS spec
      font_family => "Verdana, Geneva, Arial", # from CSS spec
      override => 1,              # increase precedence of following options to "override" from "default"
      #validate => "date",         # not impl. yet ("date", "time", "datetime", "enum", "number", "integer", ":regexp")
      #autocomplete => \@previous_choices,  # not impl. yet
   );

   # internal way
   use App::Widget::Password;
   $w = App::Widget::Password->new($name);

=cut

lib/App/Widget/RepositoryEditor.pm  view on Meta::CPAN

                         image_script => 'app-button',
                         label => "Select Table",
                         height => 17,
                         width => 100,
                         bevel => 2,
                     )->html();

    $columns       = $self->column_selection_html();
    $params        = $self->param_selection_html();

    my ($fontbegin, $fontend);
    $fontbegin = "<font face=\"verdana,geneva,arial,sans-serif\" size=-1>";
    $fontend = "</font>";

    $html = <<EOF;
<table border=0 cellspacing=0 cellpadding=3 width=100%>
<tr>
  <td nowrap width="2%">${fontbegin}Select View: ${fontend}</td>
  <td nowrap>${fontbegin}$view $open_button $save_button $delete_button
    : $saveas_button $saveas_view
  ${fontend}</td>
</tr>
<tr>
  <td nowrap width="2%">${fontbegin}Select Table: ${fontend}</td>
  <td nowrap>${fontbegin}$new_table $select_button${fontend}</td>
</tr>
<tr>
  <td colspan=2><hr size=1></td>
</tr>
<tr>
  <td nowrap width="2%">${fontbegin}Table:${fontend}</td>
  <td nowrap>${fontbegin}<b>$table_label</b>${fontend}</td>
</tr>
<tr>
  <td nowrap width="2%">${fontbegin}Query: ${fontend}</td>
  <td nowrap>${fontbegin}$view_button $edit_button Max Rows: $maxrows${fontend}</td>
</tr>
<tr>
  <td nowrap valign="top" width="2%">${fontbegin}Columns: ${fontend}</td>
  <td nowrap valign="top">${fontbegin}$columns${fontend}</td>
</tr>
<tr>
  <td nowrap valign="top" width="2%">${fontbegin}Criteria: ${fontend}</td>
  <td nowrap valign="top">${fontbegin}$params${fontend}</td>
</tr>
</table>
EOF

    $html;
}

sub column_selection_html {
    my $self = shift;

lib/App/Widget/RepositoryEditor.pm  view on Meta::CPAN


        $summ_checkbox[$i] = $context->widget("$name\{summarize\}[$i]",
                                 class => "App::Widget::Checkbox",
                             )->html();

        $xtab_checkbox[$i] = $context->widget("$name\{crosstabulate}[$i]",
                                 class => "App::Widget::Checkbox",
                             )->html();
    }

    my ($fontbegin, $fontend);
    $fontbegin = "<font face=\"verdana,geneva,arial,sans-serif\" size=-1>";
    $fontend = "</font>";

    my $html = <<EOF;
<table border=0 cellspacing=0 cellpadding=3>
<tr>
  <td valign=top width=2%>$column_menu_html</td>
  <td valign=top nowrap>
    <table border=0 cellpadding=0 cellspacing=1>
      <tr>
        <td>${fontbegin}Sort Order:${fontend}</td>
        <!-- <td align=center>${fontbegin}&nbsp;Summarize&nbsp;${fontend}</td> -->
        <!-- <td align=center nowrap>${fontbegin}&nbsp;Cross-tabulate&nbsp;${fontend}</td> -->
      </tr>
      <tr>
        <td nowrap>$order_menu[0] $dir_menu[0]</td>
        <!-- <td align=center>$summ_checkbox[0]</td> -->
        <!-- <td align=center>$xtab_checkbox[0]</td> -->
      </tr>
      <tr>
        <td nowrap>$order_menu[1] $dir_menu[1]</td>
        <!-- <td align=center>$summ_checkbox[1]</td> -->
        <!-- <td align=center>$xtab_checkbox[1]</td> -->

lib/App/Widget/RepositoryEditor.pm  view on Meta::CPAN

                                 maxlength => 99,
                             )->html();

        $param_contains[$i]= $context->widget("$name\{param_contains}[$i]",
                                 class => "App::Widget::TextField",
                                 size => 8,
                                 maxlength => 99,
                             )->html();
    }

    my ($fontbegin, $fontend);
    $fontbegin = "<font face=\"verdana,geneva,arial,sans-serif\" size=-1>";
    $fontend = "</font>";

    my $html = <<EOF;
<table border=0 cellspacing=0 cellpadding=3>
  <tr>
    <td valign="top" nowrap>${fontbegin}
      $conjunction_menu<br>
      $param_menu[0] Min: $param_min[0] Max: $param_max[0] Contains: $param_contains[0]<br>
      $param_menu[1] Min: $param_min[1] Max: $param_max[1] Contains: $param_contains[1]<br>
      $param_menu[2] Min: $param_min[2] Max: $param_max[2] Contains: $param_contains[2]<br>
      $param_menu[3] Min: $param_min[3] Max: $param_max[3] Contains: $param_contains[3]<br>
      $param_menu[4] Min: $param_min[4] Max: $param_max[4] Contains: $param_contains[4]${fontend}</td>
  </tr>
</table>
EOF

    $html;
}

1;

lib/App/Widget/Stylizable.pm  view on Meta::CPAN


=cut

######################################################################
# CONSTANTS
######################################################################

# These are the valid style sheet attributes
my @style_attrib = (
    "color",
    "font_size",
    "border_style",
    "border_width",
    "border_color",
    "padding",
    "background_color",
    "font_family",
);

my %style_attrib = (
    "color"            => "color",
    "font_size"        => "font-size",
    "border_style"     => "border-style",
    "border_width"     => "border-width",
    "border_color"     => "border-color",
    "padding"          => "padding",
    "background_color" => "background-color",
    "font_family"      => "font-family",
);

# TODO: consider getting list of ("lang") from parent
my @absorbable_attrib = (
    "lang",            # language (en, de, fr, en_us, en_ca, etc.)
    @style_attrib,
);

######################################################################
# ATTRIBUTES

lib/App/Widget/StylizableContainer.pm  view on Meta::CPAN


=cut

######################################################################
# CONSTANTS
######################################################################

# These are the valid style sheet attributes
my @style_attrib = (
    "color",
    "font_size",
    "border_style",
    "border_width",
    "border_color",
    "padding",
    "background_color",
    "font_family",
);

# TODO: consider getting list of ("lang") from parent
my @absorbable_attrib = (
    "lang",            # language (en, de, fr, en_us, en_ca, etc.)
    @style_attrib,
);

######################################################################
# ATTRIBUTES

lib/App/Widget/TabbedAppFrame.pm  view on Meta::CPAN

        }

        #$screentitle_widget = $context->widget("$name-screentitle",
        #    -label     => $screentitle_value,
        #    -bgcolor   => "#888888",
        #);
        #$screentitle_bgcolor = $screentitle_widget->get("bgcolor");
        #$screentitle = $screentitle_widget->html();

        $screentitle_bgcolor = "#888888";
        $screentitle = "<font face=verdana,geneva,arial,sans-serif size=+1 color=#ffffff>$screentitle_value</font>";

#  <tr>
#    <td colspan="2" valign="top" height="1%">
#      $menu
#    </td>
#  </tr>
#  <tr>
#    <td colspan="2" valign="top" height="1%">
#      $toolbar
#    </td>

lib/App/Widget/TabbedAppFrame.pm  view on Meta::CPAN

#  <tr>
#    <td valign="top" height="1%">
#      $screentoolbar
#    </td>
#  </tr>

        my ($messages, $messagebox);
        $messages = $context->{messages};
        $messagebox = "";
        if (defined $messages && $messages ne "") {
            my ($elem_begin, $elem_end, $fontFace, $fontSize, $fontColor);
            $fontFace  = $self->{font_face} || "verdana,geneva,arial,sans-serif";
            $fontSize  = $self->{font_size} || "+1";
            $fontColor = $self->{font_color};
            $elem_begin = "";
            $elem_end = "";
            if ($fontFace || $fontSize || $fontColor) {
                $elem_begin = "<font";
                $elem_begin .= " face=\"$fontFace\""   if ($fontFace);
                $elem_begin .= " size=\"" . ($fontSize+1) . "\""   if ($fontSize);
                $elem_begin .= " color=\"$fontColor\"" if ($fontColor);
                $elem_begin .= ">";
                $elem_end = "</font>";
            }

            $messagebox = <<EOF;
<table width=100% border=0 cellspacing=0 cellpadding=4>
  <TR>
    <TD>
      <table width=100% border=0 cellspacing=0 cellpadding=4>
        <TR>
          <TD class=body_sub1 valign=top align=left bgcolor=#ffaaaa>$elem_begin<B>Messages</B>$elem_end</TD>
        </TR>

lib/App/Widget/TabbedSelector.pm  view on Meta::CPAN

# OUTPUT METHODS
######################################################################

sub html {
    my $self = shift;
    my ($html, $label, $icon);
    my $context = $self->{context};
    my $name    = $self->{name};
    my $node    = $self->node_list();

    my ($bgcolor, $width, $fontface, $fontsize, $fontcolor, $fontbegin, $fontend);
    my ($html_url_dir, $xgif);

    $bgcolor   = $self->{bgcolor}   || "#cccccc";
    $width     = $self->{width}     || "100%";
    $fontface  = $self->{fontface}  || "verdana,geneva,arial,sans-serif";
    $fontsize  = $self->{fontsize}  || "-2";
    $fontcolor = $self->{fontcolor} || "#ffffff";

    $bgcolor = " bgcolor=\"$bgcolor\"";

    #$fontbegin = "<font face=\"$fontface\" size=\"$fontsize\" color=\"$fontcolor\">";
    #$fontend   = "</font>";

    my ($nodebase, $nodeidx, $nodenumber, $nodelabel, $parentnodenumber, $nodelevel, $opennodenumber);
    my (@nodeidx, $selected_nodenumber, $w);

    $selected_nodenumber = $self->{selected};
    @nodeidx = split(/\./,$selected_nodenumber);

    $html_url_dir = $context->get_option("html_url_dir");
    $xgif = "$html_url_dir/images/Widget/dot_clear.gif";

lib/App/Widget/TablessSelector.pm  view on Meta::CPAN

# OUTPUT METHODS
######################################################################

sub html {
    my $self = shift;
    my ($html, $label, $icon);
    my $context = $self->{context};
    my $name    = $self->{name};
    my $node    = $self->node_list();

    my ($bgcolor, $width, $fontface, $fontsize, $fontcolor, $fontbegin, $fontend);
    my ($html_url_dir, $xgif);

    $bgcolor   = $self->{bgcolor}   || "#cccccc";
    $width     = $self->{width}     || "100%";
    $fontface  = $self->{fontface}  || "verdana,geneva,arial,sans-serif";
    $fontsize  = $self->{fontsize}  || "-2";
    $fontcolor = $self->{fontcolor} || "#ffffff";

    $bgcolor = "";

    my ($nodebase, $nodeidx, $nodenumber, $nodelabel, $parentnodenumber, $nodelevel, $opennodenumber);
    my (@nodeidx, $selected_nodenumber, $w);

    $selected_nodenumber = $self->{selected};
    @nodeidx = split(/\./,$selected_nodenumber);

    $html_url_dir = $context->get_option("html_url_dir");

lib/App/Widget/TextArea.pm  view on Meta::CPAN

   $w = $context->widget($name);
   # OR ...
   $w = $context->widget($name,
      class => "App::Widget::TextArea",
      size  => 8,                 # from HTML spec
      maxlength => 18,            # from HTML spec
      tabindex => 1,              # from HTML spec
      readonly => 1,              # from HTML spec
      style => "mystyle",         # from HTML to support CSS
      color => "#6666CC",         # from CSS spec
      font_size => "10px",        # from CSS spec
      border_style => "solid",    # from CSS spec
      border_width => "1px",      # from CSS spec
      border_color => "#6666CC",  # from CSS spec
      padding => "2px",           # from CSS spec
      background_color => "#ccffcc",           # from CSS spec
      font_family => "Verdana, Geneva, Arial", # from CSS spec
      override => 1,              # increase precedence of following options to "override" from "default"
      #validate => "date",         # not impl. yet ("date", "time", "datetime", "enum", "number", "integer", ":regexp")
      #autocomplete => \@previous_choices,  # not impl. yet
   );

   # internal way
   use App::Widget::TextArea;
   $w = App::Widget::TextArea->new($name);

=cut

lib/App/Widget/TextField.pm  view on Meta::CPAN

   $context = App->context();
   $w = $context->widget($name);
   # OR ...
   $w = $context->widget($name,
      class => "App::Widget::TextField",
      size  => 8,                 # from HTML spec
      maxlength => 18,            # from HTML spec
      tabindex => 1,              # from HTML spec
      style => "mystyle",         # from HTML to support CSS
      color => "#6666CC",         # from CSS spec
      font_size => "10px",        # from CSS spec
      border_style => "solid",    # from CSS spec
      border_width => "1px",      # from CSS spec
      border_color => "#6666CC",  # from CSS spec
      padding => "2px",           # from CSS spec
      background_color => "#ccffcc",           # from CSS spec
      font_family => "Verdana, Geneva, Arial", # from CSS spec
      override => 1,              # increase precedence of following options to "override" from "default"
      #validate => "date",         # not impl. yet ("date", "time", "datetime", "enum", "number", "integer", ":regexp")
      #autocomplete => \@previous_choices,  # not impl. yet
   );

   # internal way
   use App::Widget::TextField;
   $w = App::Widget::TextField->new($name);

=cut

lib/App/Widget/TreeSelector.pm  view on Meta::CPAN

                }
                else {
                    $html .= "    <td>${imgbuttonstart}cfolder.gif name=\"app.event.$name.select($nodenumber)\" ${imgbuttonend}</td>\n";
                }
            }
            else {
                $colspan = $maxnodelevel - $nodelevel;
                $label = $node->{$nodenumber}{label};
                $label = $node->{$nodenumber}{value} if (!defined $label);
                $label = "" if (!defined $label);
                $html .= "    <td nowrap colspan=\"$colspan\"><font face=\"verdana,geneva,arial,sans-serif\" size=\"-2\">$label</font></td>\n";
                last;
            }
        }
        $html .= "  </tr>\n";
    }

    $html .= "</table>\n";
    $html;
}

lib/App/Widget/ValidatedTextField.pm  view on Meta::CPAN

   $context = App->context();
   $w = $context->widget($name);
   # OR ...
   $w = $context->widget($name,
      class => "App::Widget::ValidatedTextField",
      size  => 8,                 # from HTML spec
      maxlength => 18,            # from HTML spec
      tabindex => 1,              # from HTML spec
      style => "mystyle",         # from HTML to support CSS
      color => "#6666CC",         # from CSS spec
      font_size => "10px",        # from CSS spec
      border_style => "solid",    # from CSS spec
      border_width => "1px",      # from CSS spec
      border_color => "#6666CC",  # from CSS spec
      padding => "2px",           # from CSS spec
      background_color => "#ccffcc",           # from CSS spec
      font_family => "Verdana, Geneva, Arial", # from CSS spec
      override => 1,              # increase precedence of following options to "override" from "default"
      validate => "date",         # not impl. yet ("date", "time", "datetime", "enum", "number", "integer", ":regexp")
      #autocomplete => \@previous_choices,  # not impl. yet
   );

   # internal way
   use App::Widget::ValidatedTextField;
   $w = App::Widget::ValidatedTextField->new($name);

=cut

lib/App/Widget/WizardSelector.pm  view on Meta::CPAN

# OUTPUT METHODS
######################################################################

sub html {
    my $self = shift;
    my ($html, $label, $icon);
    my $context = $self->{context};
    my $name    = $self->{name};
    my $node    = $self->node_list();

    my ($bgcolor, $width, $fontface, $fontsize, $fontcolor, $fontbegin, $fontend);
    my ($html_url_dir, $xgif);

    $bgcolor   = $self->{bgcolor}   || "#cccccc";
    $width     = $self->{width}     || "100%";
    $fontface  = $self->{fontface}  || "verdana,geneva,arial,sans-serif";
    $fontsize  = $self->{fontsize}  || "-2";
    $fontcolor = $self->{fontcolor} || "#ffffff";

    $bgcolor = " bgcolor=\"$bgcolor\"";

    #$fontbegin = "<font face=\"$fontface\" size=\"$fontsize\" color=\"$fontcolor\">";
    #$fontend   = "</font>";

    my ($nodebase, $nodeidx, $nodenumber, $nodelabel, $parentnodenumber, $nodelevel, $opennodenumber);
    my (@nodeidx, $selected_nodenumber, $w);

    $selected_nodenumber = $self->{selected};
    @nodeidx = split(/\./,$selected_nodenumber);

    $html_url_dir = $context->get_option("html_url_dir");
    $xgif = "$html_url_dir/images/Widget/dot_clear.gif";



( run in 1.772 second using v1.01-cache-2.11-cpan-ceb78f64989 )