sub draw {
my $self = shift;
print "Notebook Page ", $self->{_nb};
my $notebook = $self->{_nb}->parent();
#$notebook->pageconfigure( 'page12', -raisecmd => sub { $self->_load_configs } );
#notebook portion
$self->{_subnb} = $self->{_nb}->NoteBook()->grid();
$self->{subnb_p1} = $self->{_subnb}->add( 'page1', -label => 'Prepare email message' );
$self->_draw_subnb_p1();
}
####
sub _draw_subnb_p1 {
my $self = shift;
# FRAME - top left side
$self->{subnb_p1}->Label( -text => 'Email Subject', )->grid(
$self->{subnb_p1}->Entry(
-width => 50,
-textvariable => \$::cini_global->{trickle}->{subject},
),
-padx => 5,
-pady => 5,
);
$self->{subnb_p1}->Label(
-text => 'Email template',
-width => '12',
)->grid(
$self->{subnb_p1}->Entry(
-width => '50',
-textvariable => \$::cini_global->{trickle}->{email_template_file}
),
$self->{subnb_p1}->Button(
-text => 'Browse',
-command => sub { $self->_getImportFile() },
),
$self->{_edemail_button} = $self->{subnb_p1}->Button(
-text => 'Edit',
-command => sub { $self->_edit_emailtemplate() },
),
-padx => 5,
-pady => 5,
);
my $top = $self->{subnb_p1}->Frame( -borderwidth => 2, -relief => 'raised' )->grid();
$top->Button(
-text => 'Preview Email',
-command => sub { $self->_preview_emailtemplate() },
)->grid(
$top->Button(
-text => 'Send Emails',
-command => sub { $self->_send_emails() },
),
-padx => 5,
-pady => 5,
);
}
##
##
sub _getImportFile {
my $self = shift;
# Get the name of the file we are going to import
my @types = ( [ "TMPL files", '.tmpl' ], [ "All Files", "*" ], );
$::cini_global->{trickle}->{email_template_file} = $self->{_nb}->getOpenFile( -filetypes => \@types );
if ( $::cini_global->{trickle}->{email_template_file} ) {
$self->{_edemail_button}->configure( -state => 'normal' );
}
WriteINI( $::CONFIG_FILE, $::cini_global );
print Dumper $::cini_global;
$self->{_mw}->update();
}