cvsuser 04/02/09 14:05:45
Modified: App-Widget Makefile.PL
App-Widget/lib/App/Widget ImageButton.pm RepositoryEditor.pm
Log:
cleanup
Revision Changes Path
1.3 +8 -67 p5ee/App-Widget/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /cvs/public/p5ee/App-Widget/Makefile.PL,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- Makefile.PL 22 Mar 2003 04:04:36 -0000 1.2
+++ Makefile.PL 9 Feb 2004 22:05:45 -0000 1.3
@@ -1,6 +1,6 @@
######################################################################
-## File: $Id: Makefile.PL,v 1.2 2003/03/22 04:04:36 spadkins Exp $
+## File: $Id: Makefile.PL,v 1.3 2004/02/09 22:05:45 spadkins Exp $
######################################################################
use ExtUtils::MakeMaker;
@@ -13,19 +13,15 @@
# * I borrowed the technique for putting the correct interpreter line
# at the top of scripts from the libwww-perl distribution.
-my @bin_programs = qw(app);
-my @sbin_programs = qw(perldocs);
-my @cgibin_programs = qw(p5x ttx button);
+my @programs = (
+ "cgi-bin/app-button",
+);
%opts = (
- #'INSTALLDIRS' => 'perl',
'NAME' => 'App-Widget',
'DISTNAME' => 'App-Widget',
'VERSION' => '0.01',
- #'PL_FILES' => { (map {("sbin/$_.PL" => "sbin/$_")} @sbin_programs),
- # (map {("cgi-bin/$_.PL" => "cgi-bin/$_")} @cgibin_programs),
- # (map {("bin/$_.PL" => "bin/$_")} @bin_programs )},
- #'EXE_FILES' => [ (map {"bin/$_"} @bin_programs) ],
+ 'EXE_FILES' => [ @programs ],
'PREREQ_PM' => { # I haven't yet determined what the minimum versions should
be
#'Aspect' => 0, # used for debugging
#'Class::MethodMaker' => 0, # [prereq for Aspect]
auto-generate methods
@@ -42,78 +38,23 @@
'MIME::Base64' => "2.1", # used for turning
binary (serialized?) data into text (Sessions)
'Storable' => 0, # used for serialization
everywhere
},
- #'clean' => { FILES => '$(EXE_FILES)' },
- 'linkext' => { LINKTYPE=>'' }, # no link needed
+ 'clean' => { FILES => '$(EXE_FILES)' },
'dist' => {'COMPRESS'=>'gzip -9f', 'SUFFIX' => 'gz',
'ZIP'=>'/usr/bin/zip','ZIPFLAGS'=>'-rl'},
);
######################################################################
-# PREFIX
-######################################################################
-
-# I like setting the PREFIX variable in the environment,
-# so I write my Makefile.PL to use it as a valid alternative
-# to specifying it on the command line with
-# "perl Makefile.PL PREFIX=/usr/foo".
-
-if ($ENV{PREFIX}) {
- $PREFIX = $ENV{PREFIX};
- $opts{PREFIX} = $PREFIX;
-}
-else {
- $PREFIX = "/usr/local";
-}
-
-######################################################################
-# HTML FILES
-######################################################################
-
-if ($ENV{HTMLDIR}) {
- $HTMLDIR = $ENV{HTMLDIR};
-}
-else {
- $HTMLDIR = "$PREFIX/htdocs";
-}
-#$opts{'INST_HTMLLIBDIR'} = 'htdocs'; # local build area
-#$opts{'INSTALLHTMLPRIVLIBDIR'} = "$HTMLDIR/$opts{NAME}"; # install area
-
-######################################################################
-# CGI SCRIPTS
-######################################################################
-
-if ($ENV{CGIDIR}) {
- $CGIDIR = $ENV{CGIDIR};
-}
-else {
- $CGIDIR = "$PREFIX/cgi-bin";
-}
-#$opts{'INST_HTMLSCRIPTDIR'} = 'bin'; # local build area
-#$opts{'INSTALLHTMLSCRIPTDIR'} = "$CGIDIR"; # install area
-
-######################################################################
# MAKE THE MAKEFILE
######################################################################
WriteMakefile(%opts);
-sub MY::htmlifypods {
- my($self) = shift;
- return "\nhtmlifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
-}
-
-sub MY::manifypods {
- my($self) = shift;
- return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
-}
-
sub MY::postamble {
-
return <<EOF;
install ::
- cp -rf htdocs $HTMLDIR/App
- cp -rf cgi-bin $CGIDIR/App
+ @\$(MOD_INSTALL) cgi-bin "\$(PREFIX)/cgi-bin"
+ @\$(MOD_INSTALL) htdocs "\$(PREFIX)/htdocs"
EOF
}
1.4 +4 -4 p5ee/App-Widget/lib/App/Widget/ImageButton.pm
Index: ImageButton.pm
===================================================================
RCS file: /cvs/public/p5ee/App-Widget/lib/App/Widget/ImageButton.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- ImageButton.pm 21 May 2003 15:04:25 -0000 1.3
+++ ImageButton.pm 9 Feb 2004 22:05:45 -0000 1.4
@@ -1,10 +1,10 @@
######################################################################
-## $Id: ImageButton.pm,v 1.3 2003/05/21 15:04:25 spadkins Exp $
+## $Id: ImageButton.pm,v 1.4 2004/02/09 22:05:45 spadkins Exp $
######################################################################
package App::Widget::ImageButton;
-$VERSION = do { my @r=(q$Revision: 1.3 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
+$VERSION = do { my @r=(q$Revision: 1.4 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
use App;
use App::Widget;
@@ -79,7 +79,7 @@
$url = $image;
}
else {
- $html_url_dir = $self->{context}->iget("htmlUrlDir");
+ $html_url_dir = $self->{context}->iget("html_url_dir");
$url = "$html_url_dir/$image";
}
@@ -96,7 +96,7 @@
$url = $image_script; # absolute URL
}
else {
- $script_url_dir = $self->{context}->iget("scriptUrlDir");
+ $script_url_dir = $self->{context}->iget("script_url_dir");
$url = "$script_url_dir/$image_script";
}
$url .=
"?mode=$type&width=$width&height=$height&bevel=$bevel&text=$url_label$selected";
1.7 +500 -207 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.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- RepositoryEditor.pm 22 Jun 2003 23:47:45 -0000 1.6
+++ RepositoryEditor.pm 9 Feb 2004 22:05:45 -0000 1.7
@@ -1,27 +1,57 @@
######################################################################
-## $Id: RepositoryEditor.pm,v 1.6 2003/06/22 23:47:45 spadkins Exp $
+## $Id: RepositoryEditor.pm,v 1.7 2004/02/09 22:05: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.6 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
+$VERSION = do { my @r=(q$Revision: 1.7 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
use App;
-use App::Widget::AppFrame;
[EMAIL PROTECTED] = ( "App::Widget::AppFrame" );
+use App::Widget;
[EMAIL PROTECTED] = ( "App::Widget" );
+
+use App::Repository;
use strict;
=head1 NAME
-App::Widget::RepositoryEditor - An application frame.
+App::Widget::RepositoryEditor - A widget allowing the user to browse and edit a
repository
=head1 SYNOPSIS
- $name = "office";
+ $name = "repedit";
# official way
- use Widget;
+ use App;
$context = App->context();
$w = $context->widget($name);
@@ -43,15 +73,7 @@
=head1 DESCRIPTION
-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.
+This class implements a widget.
=cut
@@ -59,69 +81,141 @@
# INITIALIZATION
######################################################################
-# no special 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,
+ );
+}
######################################################################
# EVENTS
######################################################################
+# Usage: $widget->handle_event($wname, $event, @args);
sub handle_event {
my ($self, $wname, $event, @args) = @_;
- my ($context, $name, $node);
- my ($selector_widget, $screen_wname, $screen_widget, $screen_settings);
- my ($screen_msg, $target);
+ my ($name, $table);
$name = $self->{name};
- $context = $self->{context};
+
$self->{context}->dbgprint("RepositoryEditor($name)->handle_event($wname,$event,@args)")
+ if ($App::DEBUG && $self->{context}->dbg(1));
-#print ">>> AppFrame->handle_event($wname, $event, @args) name=$name\n";
-
-# 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 {
+ 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{"_conjunction"} = $self->get("conjunction");
+
+ 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);
+
+ 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), "]");
+ }
+}
######################################################################
# OUTPUT METHODS
@@ -129,161 +223,360 @@
sub html {
my $self = shift;
- my ($context, $name, $html);
+ my ($context, $name, $mode);
+
+ $context = $self->{context};
$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();
- my ($menu, $toolbar, $screentitle, $screentoolbar);
- my ($selector_widget, $selector);
- my ($screen_wname, $screen, $screen_widget, $screen_bgcolor);
- my ($screentitle_widget, $screentitle_bgcolor, $screentitle_value);
+ $self->set_default("maxrows",25);
- if (1) { # view as table
+ $maxrows = $context->widget("$name.maxrows",
+ class => "App::Widget::TextField",
+ size => 4,
+ maxlength => 99,
+ )->html();
- $menu = $context->widget("$name.menu",
- class => "App::Widget::Menu",
+ $open_button = $context->widget("$name.open_button",
+ class => "App::Widget::ImageButton",
+ image_script => 'app-button',
+ label => "Open",
+ height => 17,
+ width => 50,
+ bevel => 2,
)->html();
- $toolbar = $context->widget("$name.toolbar",
- class => "App::Widget::Toolbar",
+ $save_button = $context->widget("$name.save_button",
+ class => "App::Widget::ImageButton",
+ image_script => 'app-button',
+ label => "Save",
+ height => 17,
+ width => 50,
+ bevel => 2,
)->html();
- $screentoolbar = $context->widget("$name.screentoolbar",
- class => "App::Widget::Toolbar",
+ $delete_button = $context->widget("$name.delete_button",
+ class => "App::Widget::ImageButton",
+ image_script => 'app-button',
+ label => "Delete",
+ height => 17,
+ width => 50,
+ bevel => 2,
)->html();
- $selector_widget = $context->widget("$name.selector",
- class => "App::Widget::SelectorView",
- );
+ $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();
- $selector = $selector_widget->html();
- $screen_wname = $selector_widget->get_selected("wname");
+ $view_button = $context->widget("$name.view_button",
+ class => "App::Widget::ImageButton",
+ image_script => 'app-button',
+ label => "View",
+ height => 17,
+ width => 50,
+ bevel => 2,
+ )->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);
- }
- else {
- $screentitle_value = " ";
- $screen = " ";
- $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>
+ $edit_button = $context->widget("$name.edit_button",
+ class => "App::Widget::ImageButton",
+ image_script => 'app-button',
+ label => 'Edit',
+ height => 17,
+ width => 50,
+ bevel => 2,
+ )->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,
+ )->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;
}
-# $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
+sub column_selection_html {
+ my $self = shift;
- $html = <<EOF;
-<table width="100%" height="100%" border="2" cellspacing="2" cellpadding="0">
+ 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,
+ );
+ $column_menu_html = $column_menu->html();
+
+ my (@order_menu, @dir_menu, @summ_checkbox, @xtab_checkbox, $i);
+
+ for ($i = 0; $i < 5; $i++) {
+
+ $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();
+ }
+
+ 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 rowspan="2" valign="top" bgcolor="$screentitle_bgcolor" width="1%">
- $selector
- </td>
- <td valign="top" bgcolor="$screentitle_bgcolor" height="1%">
- $screentitle
- </td>
+ <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} Summarize ${fontend}</td> -->
+ <!-- <td align=center
nowrap>${fontbegin} Cross-tabulate ${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 valign="top" bgcolor="$screen_bgcolor" height="99%">
- $messagebox$screen
+ <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>
+ </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 ($conjunction_menu);
+ my (@conjunction, %conjunction);
+ @conjunction = ("AND", "OR", "NOT_AND", "NOT_OR");
+ %conjunction = (
+ "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",
+ );
+
+ $conjunction_menu = $context->widget("$name.conjunction",
+ class => "App::Widget::Select",
+ values => [EMAIL PROTECTED],
+ labels => \%conjunction,
+ )->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>";
+
+ 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;