Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

the_slycer's scratchpad

by the_slycer (Chaplain)
on Jun 10, 2004 at 21:01 UTC ( [id://363196]=scratchpad: print w/replies, xml ) Need Help??

#!/usr/bin/perl -w use strict; use ARS; die 'Usage is get_flds.pl "username" "password" "server" and optionall +y "schema"\n' unless $ARGV[2]; my $user=$ARGV[0]; my $pass=$ARGV[1]; my $server=$ARGV[2]; my $schema =$ARGV[3]; print "Logging on to $server\n"; my $ctrl=ars_Login( $server, $user, $pass ) || die "Doh! Could not login to server!"; my %fields; (%fields=ars_GetFieldTable($ctrl,$schema)) || die "Whoops: $ars_errstr +"; #This gets the fields from the schema print $_ . "\t\t:\t\t" . $fields{$_} . "\n" foreach sort keys (%fields +);

And some more - this is HTMLized display of the "work log" field of a particual ticket, the work log is a diary field, which are stored as a hash with timestamp, userid, and comments as the info.
#!/usr/bin/perl -w use strict; use ARS; use CGI; ############################################### # First bit is pure perl code - set some vars # and make the Remedy request # ############################################### my $page=CGI->new(); my $user ="USERNAME"; my $pass ="USERNAME"; my $server ="servername"; my $ticket = $page->param("TicketNumber"); #get the passed ticket n +umber my $schema ="HPD:HelpDesk"; #this is the schema to query my $ctrl=ars_Login( #login to the server $server, # . $user, # . $pass # . ) || die "Doh: $ars_errstr"; #or print the error my %tick_inf; (%tick_inf = ars_GetEntry($ctrl,$schema,$ticket)); #this function grab +s the whole ticket ################################################## # Now - to create the page this is more or less # HTML ;-) # ################################################## print $page->header(); print $page->start_html( -title => "Work log" ); #table the results: print '<blockquote>'; print '<div align="justify">'; print '<center>'; print '<table border="2" width="80%" cellpadding="3">'; foreach (@{ $tick_inf{"240000008"} }){ #OUR work log is field number 2 +40000008 on this schema print '<tr>'; print qq(<td width="20%" height="20"><strong><span style="font-var +iant: small-caps">$_->{user}</span></strong></td>);; print qq(<td width="70%" height="19">$_->{"value"}</td>); print '<tr>'; } print '</tr>'; print '</table>'; print '</center>'; print '</div>'; print '</blockquote>'; print $page->end_html();
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-28 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found