cvsuser     03/06/22 16:47:45

  Modified:    App-Widget/lib/App/Widget RepositoryEditor.pm
  Log:
  sync
  
  Revision  Changes    Path
  1.6       +205 -500  p5ee/App-Widget/lib/App/Widget/RepositoryEditor.pm
  
  Index: RepositoryEditor.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Widget/lib/App/Widget/RepositoryEditor.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- RepositoryEditor.pm       21 May 2003 15:04:25 -0000      1.5
  +++ RepositoryEditor.pm       22 Jun 2003 23:47:45 -0000      1.6
  @@ -1,57 +1,27 @@
   
   ######################################################################
  -## $Id: RepositoryEditor.pm,v 1.5 2003/05/21 15:04:25 spadkins Exp $
  +## $Id: RepositoryEditor.pm,v 1.6 2003/06/22 23:47:45 spadkins Exp $
   ######################################################################
  -## x TODO: add "summary" feature
  -## x TODO: add cross-tabulation
  -## x TODO: add editing capability
  -## x TODO (edit): pass sort information into the edit rows screen
  -## x TODO (edit): check for formulas and primary key to determine read-only 
(Rep::DB.pm)
  -## o TODO (edit): don't allow editing for read-only fields
  -## o TODO (edit): only allow editable fields to be selected
  -## o TODO (edit): for selected rows screen, show all fields, allow editing on 
selected fields
  -## o TODO (edit): when no rows selected, use the selection criteria to get the new 
rows
  -## o TODO (export): allow exporting of data
  -## o TODO (import): allow importing of data
  -## o TODO (import): allow export/import of data
  -## o TODO (edit): include some column for modifying the size, maxlength of edit 
field
  -## o TODO (edit): include some column for validation rules
  -## o TODO (edit): include some column for drop-down selections
  -## o TODO: add report-saving feature
  -## x TODO: transform into a standard HTML::Widget::Base constructor interface
  -## o TODO: get context logic out of this class
  -## o TODO: can't edit "summary" data (what should I do when they try?)
  -## o TODO: add show/hide detail of report criteria screen
  -## x TODO: if sort column is chosen which is not in the list of selected columns
  -##   we add it to the list and use its alias
  -## x TODO: add primary key to the group-by clause whenever non-summary group-by is 
required
  -##   (or editing is required)
  -## x TODO: autogenerate missing aliases (i.e. col001) for use in group by, order by
  -## x TODO: only display the columns in the selected columns list (more will be 
returned)
  -## x TODO: add default {summary} formula as count(distinct COL) (for non-numbers)
  -## x TODO: add default {summary} formula as sum(COL)            (for numbers)
   
   package App::Widget::RepositoryEditor;
  -$VERSION = do { my @r=(q$Revision: 1.5 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
  +$VERSION = do { my @r=(q$Revision: 1.6 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
   
   use App;
  -use App::Widget;
  [EMAIL PROTECTED] = ( "App::Widget" );
  -
  -use App::Repository;
  +use App::Widget::AppFrame;
  [EMAIL PROTECTED] = ( "App::Widget::AppFrame" );
   
   use strict;
   
   =head1 NAME
   
  -App::Widget::RepositoryEditor - A widget allowing the user to browse and edit a 
repository
  +App::Widget::RepositoryEditor - An application frame.
   
   =head1 SYNOPSIS
   
  -   $name = "repedit";
  +   $name = "office";
   
      # official way
  -   use App;
  +   use Widget;
      $context = App->context();
      $w = $context->widget($name);
   
  @@ -73,7 +43,15 @@
   
   =head1 DESCRIPTION
   
  -This class implements a widget.
  +This class implements an application frame.
  +This includes a menu, an application toolbar, a screen selector, 
  +a screen title, a screen toolbar, and 
  +a screen frame.  The application is actually implemented by the set
  +of screens that the application frame is configured to allow navigation
  +to.
  +
  +The application frame can implement itself in frames if it is
  +configured to do so.  Otherwise, it implements itself as a table.
   
   =cut
   
  @@ -81,504 +59,231 @@
   # INITIALIZATION
   ######################################################################
   
  -sub init {
  -    my $self = shift;
  -    $self->SUPER::init(@_);
  -
  -    my ($context, $name, $rep, $repname, $table, $table_names);
  -
  -    $context = $self->{context};
  -    $name    = $self->{name};
  -    $repname = $self->get("repository");
  -    $rep     = $context->repository($repname);
  -
  -    $table = $self->get("table");
  -    if (! $table) {
  -        $table_names = $rep->get_table_names();
  -        $table = $table_names->[0];
  -        $self->set("table",$table);
  -    }
  -    $self->{columns} = [] if (!defined $self->{columns});
  -
  -    $context->widget("${name}_datatable",
  -        class => "App::Widget::DataTable",
  -        scrollable  => 1,
  -        sortable    => 1,
  -        filterable  => 1,
  -        repository  => $repname,
  -    );
  -}
  +# no special initialization
   
   ######################################################################
   # EVENTS
   ######################################################################
   
  -# Usage: $widget->handle_event($wname, $event, @args);
   sub handle_event {
       my ($self, $wname, $event, @args) = @_;
  -    my ($name, $table);
  +    my ($context, $name, $node);
  +    my ($selector_widget, $screen_wname, $screen_widget, $screen_settings);
  +    my ($screen_msg, $target);
   
       $name = $self->{name};
  -    
$self->{context}->dbgprint("RepositoryEditor($name)->handle_event($wname,$event,@args)")
  -        if ($App::DEBUG && $self->{context}->dbg(1));
  -
  -    if ($wname eq "$name.open_button") {
  -    }
  -    elsif ($wname eq "$name.save_button") {
  -    }
  -    elsif ($wname eq "$name.delete_button") {
  -    }
  -    elsif ($wname eq "$name.saveas_button") {
  -    }
  -    elsif ($wname eq "$name.view_button") {
  -        $self->set_mode("view", 0);
  -    }
  -    elsif ($wname eq "$name.edit_button") {
  -        $self->set_mode("edit", 1);
  -    }
  -    elsif ($wname eq "$name.select_button") {
  -        $table = $self->get("new_table");
  -        $self->set("table", $table);
  -        $self->set("columns",     []);
  -        $self->set("ordercols",   []);
  -        $self->set("directions",  []);
  -        $self->set("param",[]);
  -        $self->set("param_min",[]);
  -        $self->set("param_max",[]);
  -        $self->set("param_contains",[]);
  -    }
  -    else {
  -        return $self->SUPER::handle_event($wname, $event, @args);
  -    }
  -
  -    return 1;
  -}
  -
  -sub set_mode {
  -    my ($self, $mode, $editable) = @_;
  -
  -    my ($context, $name, $w);
  -
  -    $self->set("mode", $mode);
       $context = $self->{context};
  -    $name = $self->{name};
  -    $w = $context->widget("${name}_datatable");
  -    $w->set("table",       $self->get("table"));
  -    $w->set("columns",     $self->get("columns"));
  -    $w->set("ordercols",   $self->get("ordercols"));
  -    $w->set("directions",  $self->get("directions"));
  -    $w->set("paramvalues", $self->get("paramvalues"));
  -    $w->set("maxrows",     $self->get("maxrows"));
  -    $w->set("editable",    $editable);
  -
  -    my ($i, @params, %paramvalues, $param, $params, $param_min, $param_max, 
$param_contains);
  -    $params         = $self->get("param");
  -    $param_min      = $self->get("param_min",[]);
  -    $param_max      = $self->get("param_max",[]);
  -    $param_contains = $self->get("param_contains",[]);
  -    $paramvalues{"_query.critsense"} = $self->get("critsense");
  - 
  -    if ($params && ref($params) eq "ARRAY") {
  -        for ($i = 0; $i <= $#$params; $i++) {
  -            $param = $params->[$i];
  -            next if (!defined $param || $param eq "");
  -            if (defined $param_min->[$i] && $param_min->[$i] ne "") {
  -                push(@params, "${param}.ge");
  -                $paramvalues{"${param}.ge"} = $param_min->[$i];
  -            }
  -            if (defined $param_max->[$i] && $param_max->[$i] ne "") {
  -                push(@params, "${param}.le");
  -                $paramvalues{"${param}.le"} = $param_max->[$i];
  -            }
  -            if (defined $param_contains->[$i] && $param_contains->[$i] ne "") {
  -                push(@params, "${param}.contains");
  -                $paramvalues{"${param}.contains"} = $param_contains->[$i];
  -            }
  -        }
  -    }
   
  -    $w->set("params",      [EMAIL PROTECTED]);
  -    $w->set("paramvalues", \%paramvalues);
  +#print ">>> AppFrame->handle_event($wname, $event, @args) name=$name\n";
   
  -    if ($App::DEBUG && $self->{context}->dbg(2)) {
  -        my ($ref);
  -        $ref = $self->get("columns");
  -        $self->{context}->dbgprint("RepositoryEditor->set_mode(): columns=[", 
join(",", @$ref), "]") if ($ref);
  -        $ref = $self->get("ordercols");
  -        $self->{context}->dbgprint("RepositoryEditor->set_mode(): ordercols=[", 
join(",", @$ref), "]") if ($ref);
  -        $ref = $self->get("directions");
  -        $self->{context}->dbgprint("RepositoryEditor->set_mode(): directions=[", 
join(",", @$ref), "]") if ($ref);
  -        $ref = $params;
  -        $self->{context}->dbgprint("RepositoryEditor->set_mode(): params=[", 
join(",", @$ref), "]") if ($ref);
  -        $ref = $param_contains;
  -        $self->{context}->dbgprint("RepositoryEditor->set_mode(): 
param_contains=[", join(",", @$ref), "]") if ($ref);
  -        $self->{context}->dbgprint("RepositoryEditor->set_mode(): params=[", 
join(",", @params), "]");
  -        $self->{context}->dbgprint("RepositoryEditor->set_mode(): paramvalues=[", 
join(",", %paramvalues), "]");
  -    }
  +#    if ($wname eq "$name.selector" && $event eq "select") {
  +#        $selector_widget = $context->widget("$name.selector");
  +#        $screen_wname    = $selector_widget->get_selected("wname");
  +#        $screen_widget   = $context->widget($screen_wname);
  +#
  +#        $screen_settings = $selector_widget->get_selected("set");
  +#        $self->{context}->dbgprint("AppFrame->handle_event($wname, $event, @args): 
screen_settings=$screen_settings")
  +#            if ($App::DEBUG && $self->{context}->dbg(1));
  +#
  +#        if ($screen_settings) {
  +#            foreach (keys %$screen_settings) {
  +#                $screen_widget->set($_, $screen_settings->{$_});
  +#            }
  +#        }
  +#        else {
  +#            $screen_msg = $selector_widget->get_selected("send");
  +#            if ($screen_msg && ref($screen_msg) eq "ARRAY" && $#$screen_msg >= 1) {
  +#                my ($target_widget, $target_wname, $method, @args);
  +#                ($target_wname, $method, @args) = @$screen_msg;
  +#                $target_widget = $context->widget($target_wname);
  +#                $target_widget->$method(@args);
  +#            }
  +#        }
  +#
  +#        #my $frame = $selector_widget->get_selected("frame");
  +#        #if (defined $frame) {
  +#        #    my ($key);
  +#        #    foreach $key (keys %$frame) {
  +#        #        $self->set($key,$frame->{$key});
  +#        #    }
  +#        #}
  +#
  +#        #my $target = $selector_widget->get_selected("target");
  +#        #if ($target) {
  +#        #    $main::target = $target;
  +#        #}
  +#
  +#        #$self->{noframe} = $selector_widget->get_selected("noframe");
  +#
  +#        return 1;
  +#    }
  +#    else {
  +        return $self->SUPER::handle_event($wname, $event, @args);
  +#    }
   }
   
  +
   ######################################################################
   # OUTPUT METHODS
   ######################################################################
   
   sub html {
       my $self = shift;
  -    my ($context, $name, $mode);
  -
  -    $context = $self->{context};
  +    my ($context, $name, $html);
       $name    = $self->{name};
  -    $mode    = $self->get("mode","");
  -
  -    if ($mode eq "edit" || $mode eq "view") {
  -        return $context->widget("${name}_datatable")->html();
  -    }
  -    else {
  -        return $self->mk_criteria_html();
  -    }
  -}
  -
  -sub mk_criteria_html {
  -    my $self = shift;
  -
  -    my ($name, $context, $repname, $rep, $table, $table_names, 
$table_label_hashref, $table_label);
  -
       $context = $self->{context};
  -    $name    = $self->{name};
  -    $repname = $self->{repository};
  -    $rep     = $context->repository($repname);
  -    $self->{rep} = $rep;
  -    $rep = $self->{rep};
  -
  -    $table_names = $rep->get_table_names();
  -    $table_label_hashref = $rep->get_table_labels();
  -    $table = $self->get("table");
  -    $table_label = $table_label_hashref->{$table};
  -    $table_label = $table if (!$table_label);
  -
  -    $self->set("saveas_view","");
  -    $self->set("new_table",$table);
  -
  -    my ($html);
  -    my ($view, $saveas_view, $new_table, $maxrows);
  -    my ($open_button, $save_button, $delete_button, $saveas_button);
  -    my ($view_button, $edit_button, $select_button);
  -    my ($columns, $params);
  -
  -    $view          = $context->widget("$name.view",
  -                         class => "App::Widget::TextField",
  -                         size => 20,
  -                         maxwidth => 99,
  -                     )->html();
  -
  -    $saveas_view   = $context->widget("$name.saveas_view",
  -                         class => "App::Widget::TextField",
  -                         size => 20,
  -                         maxwidth => 99,
  -                     )->html();
  -
  -    $new_table     = $context->widget("$name.new_table",
  -                         class => "App::Widget::Select",
  -                         values => $table_names,
  -                         labels => $table_label_hashref,
  -                     )->html();
  -
  -    $self->set_default("maxrows",25);
   
  -    $maxrows       = $context->widget("$name.maxrows",
  -                         class => "App::Widget::TextField",
  -                         size => 4,
  -                         maxlength => 99,
  -                     )->html();
  -
  -    $open_button   = $context->widget("$name.open_button",
  -                         class => "App::Widget::ImageButton",
  -                         image_script => 'app-button',
  -                         label => "Open",
  -                         height => 17,
  -                         width => 50,
  -                         bevel => 2,
  -                     )->html();
  -
  -    $save_button   = $context->widget("$name.save_button",
  -                         class => "App::Widget::ImageButton",
  -                         image_script => 'app-button',
  -                         label => "Save",
  -                         height => 17,
  -                         width => 50,
  -                         bevel => 2,
  -                     )->html();
  -
  -    $delete_button = $context->widget("$name.delete_button",
  -                         class => "App::Widget::ImageButton",
  -                         image_script => 'app-button',
  -                         label => "Delete",
  -                         height => 17,
  -                         width => 50,
  -                         bevel => 2,
  -                     )->html();
  +    my ($menu, $toolbar, $screentitle, $screentoolbar);
  +    my ($selector_widget, $selector);
  +    my ($screen_wname, $screen, $screen_widget, $screen_bgcolor);
  +    my ($screentitle_widget, $screentitle_bgcolor, $screentitle_value);
   
  -    $saveas_button = $context->widget("$name.saveas_button",
  -                         class => "App::Widget::ImageButton",
  -                         image_script => 'app-button',
  -                         label => "Save As",
  -                         height => 17,
  -                         width => 50,
  -                         bevel => 2,
  -                     )->html();
  +    if (1) {     # view as table
   
  -    $view_button   = $context->widget("$name.view_button",
  -                         class => "App::Widget::ImageButton",
  -                         image_script => 'app-button',
  -                         label => "View",
  -                         height => 17,
  -                         width => 50,
  -                         bevel => 2,
  +        $menu            = $context->widget("$name.menu",
  +                               class => "App::Widget::Menu",
                        )->html();
   
  -    $edit_button   = $context->widget("$name.edit_button",
  -                         class => "App::Widget::ImageButton",
  -                         image_script => 'app-button',
  -                         label => 'Edit',
  -                         height => 17,
  -                         width => 50,
  -                         bevel => 2,
  +        $toolbar         = $context->widget("$name.toolbar",
  +                               class => "App::Widget::Toolbar",
                        )->html();
   
  -    $select_button = $context->widget("$name.select_button",
  -                         class => "App::Widget::ImageButton",
  -                         image_script => 'app-button',
  -                         label => "Select Table",
  -                         height => 17,
  -                         width => 100,
  -                         bevel => 2,
  +        $screentoolbar   = $context->widget("$name.screentoolbar",
  +                               class => "App::Widget::Toolbar",
                        )->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;
  -
  -    my ($context, $name, $repname, $rep, $table);
  -    $context = $self->{context};
  -    $name    = $self->{name};
  -    $repname = $self->get("repository");
  -    $rep     = $context->repository($repname);
  -    $table   = $self->get("table");
  -    return     "ERROR: No table specified" if (!$table);
  -
  -    my ($columns, $column_labels, $column_menu, $column_menu_html);
  -    $columns       = $rep->get_column_names($table);
  -    $column_labels = $rep->get_column_labels($table);
  -    $column_menu = $context->widget("$name.columns",
  -        override => 1,
  -        class => "App::Widget::Select",
  -        values => $columns,
  -        labels => $column_labels,
  -        size => 8,
  -        multiple => 1,
  +        $selector_widget = $context->widget("$name.selector",
  +                               class => "App::Widget::SelectorView",
       );
  -    $column_menu_html = $column_menu->html();
  -
  -    my (@order_menu, @dir_menu, @summ_checkbox, @xtab_checkbox, $i);
   
  -    for ($i = 0; $i < 5; $i++) {
  +        $selector        = $selector_widget->html();
  +        $screen_wname    = $selector_widget->get_selected("wname");
   
  -        $order_menu[$i]    = $context->widget("$name\{ordercols}[$i]",
  -                                 class => "App::Widget::Select",
  -                                 values => $columns,
  -                                 labels => $column_labels,
  -                                 size => 1,
  -                                 nullable => 1,
  -                             )->html();
  -
  -        $dir_menu[$i]      = $context->widget("$name\{directions}[$i]",
  -                                 class => "App::Widget::Select",
  -                                 values => [ '', 'UP', 'DOWN', ],
  -                                 labels => { '' => '', 'UP' => 'Up', 'DOWN' => 
'Down', },
  -                             )->html();
  -
  -        $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();
  +        if ($screen_wname) {
  +            $screen_widget     = $context->widget($screen_wname);
  +            $screentitle_value = $selector_widget->get_selected("value");
  +            $screentitle_value = $screen_widget->label() if (!$screentitle_value);
  +            $screen            = $screen_widget->html();
  +            $screen_bgcolor    = $screen_widget->get("bgcolor");
  +            $screen_bgcolor    = "#ffffff" if (!defined $screen_bgcolor);
       }
  -
  -    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> -->
  -      </tr>
  -      <tr>
  -        <td nowrap>$order_menu[2] $dir_menu[2]</td>
  -        <!-- <td align=center>$summ_checkbox[2]</td> -->
  -        <!-- <td align=center>$xtab_checkbox[2]</td> -->
  -      </tr>
  -      <tr>
  -        <td nowrap>$order_menu[3] $dir_menu[3]</td>
  -        <!-- <td align=center>$summ_checkbox[3]</td> -->
  -        <!-- <td align=center>$xtab_checkbox[3]</td> -->
  -      </tr>
  -      <tr>
  -        <td nowrap>$order_menu[4] $dir_menu[4]</td>
  -        <!-- <td align=center>$summ_checkbox[4]</td> -->
  -        <!-- <td align=center>$xtab_checkbox[4]</td> -->
  -      </tr>
  +        else {
  +            $screentitle_value = "&nbsp;";
  +            $screen            = "&nbsp;";
  +            $screen_bgcolor    = "#cccccc";
  +        }
  +
  +        #if ($self->{noframe}) {
  +        #    return $screen;    # no need to generate a frame
  +        #}
  +
  +        #$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>
  +#  </tr>
  +#  <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->{fontFace} || "verdana,geneva,arial,sans-serif";
  +            $fontSize  = $self->{fontSize} || "+1";
  +            $fontColor = $self->{fontColor};
  +            $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>
  +        <TR>
  +          <TD valign=top align=left class=body_sub2>
  +            $elem_begin$messages$elem_end
  +          </TD>
  +        </TR>
  +        <TR>
  +          <TD valign=top align=left height=4></TD>
  +        </TR>
       </table>
     </td>
   </tr>
   </table>
   EOF
  -    $html;
  -}
  -
  -sub param_selection_html {
  -    my $self = shift;
  -
  -    my ($context, $name, $repname, $rep, $table);
  -    $context = $self->{context};
  -    $name    = $self->{name};
  -    $repname = $self->get("repository");
  -    $rep     = $context->repository($repname);
  -    $table   = $self->get("table");
  -    return     "ERROR: No table specified" if (!$table);
  -
  -    my ($columns, $column_labels);
  -    $columns       = $rep->get_column_names($table);
  -    $column_labels = $rep->get_column_labels($table);
  -
  -    my ($critsense_menu);
  -    my (@critsense, %critsense);
  -    @critsense = ("AND", "OR", "NOT_AND", "NOT_OR");
  -    %critsense = (
  -        "AND"     => "All of the following conditions",
  -        "OR"      => "Any of the following conditions",
  -        "NOT_AND" => "Not all of the following conditions",
  -        "NOT_OR"  => "Not any of the following conditions",
  -    );
  -
  -    $critsense_menu = $context->widget("$name.critsense",
  -        class => "App::Widget::Select",
  -        values => [EMAIL PROTECTED],
  -        labels => \%critsense,
  -    )->html();
  -
  -    my (@param_menu, @param_min, @param_max, @param_contains, $i);
  -
  -    for ($i = 0; $i < 5; $i++) {
  -
  -        $param_menu[$i]    = $context->widget("$name\{param}[$i]",
  -                                 class => "App::Widget::Select",
  -                                 values => $columns,
  -                                 labels => $column_labels,
  -                                 nullable => 1,
  -                             )->html();
  -
  -        $param_min[$i]     = $context->widget("$name\{param_min}[$i]",
  -                                 class => "App::Widget::TextField",
  -                                 size => 8,
  -                                 maxlength => 99,
  -                             )->html();
  -
  -        $param_max[$i]     = $context->widget("$name\{param_max}[$i]",
  -                                 class => "App::Widget::TextField",
  -                                 size => 8,
  -                                 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>";
  +#        $html = <<EOF;
  +#<table width="100%" height="100%" border="2" cellspacing="2" cellpadding="0">
  +#  <tr>
  +#    <td rowspan="2" valign="top" bgcolor="$screentitle_bgcolor" width="1%" 
height="100%">
  +#      $selector
  +#    </td>
  +#    <td valign="top" bgcolor="$screentitle_bgcolor" height="1%" class="short">
  +#      $screentitle
  +#    </td>
  +#  </tr>
  +#  <tr>
  +#    <td valign="top" bgcolor="$screen_bgcolor" height="99%" class="tall">
  +#      $messagebox$screen
  +#    </td>
  +#  </tr>
  +#</table>
  +#EOF
   
  -    my $html = <<EOF;
  -<table border=0 cellspacing=0 cellpadding=3>
  +        $html = <<EOF;
  +<table width="100%" height="100%" border="2" cellspacing="2" cellpadding="0">
     <tr>
  -    <td valign="top" nowrap>${fontbegin}
  -      $critsense_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>
  +    <td rowspan="2" valign="top" bgcolor="$screentitle_bgcolor" width="1%">
  +      $selector
  +    </td>
  +    <td valign="top" bgcolor="$screentitle_bgcolor" height="1%">
  +      $screentitle
  +    </td>
  +  </tr>
  +  <tr>
  +    <td valign="top" bgcolor="$screen_bgcolor" height="99%">
  +      $messagebox$screen
  +    </td>
     </tr>
   </table>
   EOF
  -
  +    }
       $html;
   }
  +
   
   1;
   
  
  
  

Reply via email to