# -*- Perl -*-
#
# This is part of X-RUST 1.0 Beta 4.
#
# Copyright (C) 1996 Craig Ruefenacht <ruefenac@cs.utah.edu> and the
#                    University of Utah, Department of Computer Scinece
#
#                    Shawn T. Amundson <amundson@cs.umn.edu> and the
#                    University of Minnesota Computer Science Department
#
# Abstract: This file contains definitions and subroutines which deal with
#           commenting a request in X-Rust.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with the source distribution of Inquire, in the license
# directory. If you don't have a copy of it, write to: 
#
# Free Software Foundation, Inc.
# 675 Mass Ave
# Cambridge, MA 02139, USA.
#

#
# $Id: xrust_merge.pl,v 1.1.1.1 2000/05/03 19:54:39 wright Exp $
#

use strict;
use vars qw($MGMW $MW %QUEUE_INDEX %BIN);

sub merge_func {

    #
    # Abstract: Merge two tickets    my $queue_name = shift;

    if (!$MGMW) {
 
        my ($tomerge_number, $mergeinto_number, $queue_name);
 
	my $MGMW = $MW->Toplevel;
	$MGMW->title('Merge Tickets');

        my $merge_info = $MGMW->Frame;
        $merge_info->pack(
			-side => 'top', 
			-fill => 'x',
			-pady => 4,
			-padx => 4
		       );	

        my ($action_set) = $MGMW->Frame;
        $action_set->pack(-side => 'top', fill => 'x');
 
        my (@pl) = (-side => 'top', -padx => 10, -pady => 5, -fill => 'x');

#        my ($action_set_t2) = $action_set->Label(-text => "Merge Tickets");
#	$action_set_t2->pack(-side => 'top');

        my ($action_set_t3) = $action_set->Label(-text => "Queue Name");
	$action_set_t3->pack(-side => 'top');

        my ($action_set_e3) = $action_set->Entry(-relief => 'sunken', -width => 25,
						 -textvariable => \$queue_name);

        $action_set_e3->pack(@pl);

        my ($action_set_t4) = $action_set->Label(-text => "Merge From");
	$action_set_t4->pack(-side => 'top');

        my ($action_set_e4) = $action_set->Entry(-relief => 'sunken', -width => 25,
						 -textvariable => \$tomerge_number);
        $action_set_e4->pack(@pl);

        my ($action_set_t5) = $action_set->Label(-text => "Merge To");
	$action_set_t5->pack(-side => 'top');

        my ($action_set_e5) = $action_set->Entry(-relief => 'sunken', -width => 25,
						 -textvariable => \$mergeinto_number);
        $action_set_e5->pack(@pl);

        my ($action_set_buttons) = $MGMW->Frame;
        $action_set_buttons->pack(-side => 'bottom', fill => 'x');
 

        my ($action_set_buttons_1) = $action_set_buttons->Button(
								 -text => "Execute",
								 -width => 10,
								 -command => sub {
								     my $index = &set_queue_index(0, $queue_name);
								     my @array = do_merge($caller, $tomerge_number, $mergeinto_number, $index);
								     if (!$array[0]) {
									 $MGMW->destroy;
									 $MGMW = "";}
								     &set_status_bar('main',"$array[1]");}
								 );
 
        $action_set_buttons_1->pack(-side => 'left', -expand => 'yes', -pady => 2);

	my ($action_set_buttons_2) = $action_set_buttons->Button(
								 -text => "Abort",
								 -width => 10,
								 -command => sub { $MGMW->destroy;
										   $MGMW = "";}
								 );

        $action_set_buttons_2->pack(-side => 'right', -expand => 'yes', -pady => 2);
    }
}

1;




