Skip to content

Instantly share code, notes, and snippets.

@cmhobbs
Created September 14, 2009 19:29
Show Gist options
  • Save cmhobbs/186871 to your computer and use it in GitHub Desktop.
Save cmhobbs/186871 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
# rtqc.pl - RT quick ticket idiot box
use Tk;
$RT_PATH = "FIXPATH";
$topWin = MainWindow -> new();
$topWin -> configure(-title => 'GENERAL QUEUE QUICK COMMIT');
# frames
my $frame1 = $topWin -> Frame();
my $frame2 = $topWin -> Frame();
# buttons
my $commit = $frame2 -> Button();
my $quit = $frame2 -> Button();
# label thing
#my $label = $topWin -> Label(-text => "GENERAL QUEUE FAST COMMIT") -> pack();
my $text = $frame1 -> Text();
$commit -> configure(-text => 'commit',
-command => [ \&HandleCommit, $text ]);
$quit -> configure(-text => 'quit',
-command => sub{exit} );
$text -> configure(-height => 5,
-width => 40,);
$text -> insert("end", "");
# pack.
$frame1 -> pack(-side => 'top');
$frame2 -> pack(-side => 'top');
$text -> pack();
$commit -> pack(-side => 'left');
$quit -> pack(-side => 'left');
MainLoop();
# commit to general queue, not ethat queue could easily
# be modified through a variable
sub HandleCommit {
# commit the ticket
my $text = $_[0];
chomp(my $content = $text->get("1.0", "end"));
system("$RT_PATH create -t ticket set subject=\"$content\" set queue=general");
#clear the box
$text -> delete('1.0','end');
$text -> insert("end", "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment