#!/usr/local/bin/ruby
#
# Copyright 2005 Perforce Software. All rights reserved.
#
#
# ejsjobdel delete job "job_delete.rb %user% %formfile%"
#
#
# Currently this function does nothing except to generate log entries
#
# This most likely should be used to reject deleting of jobs by
# anyone who is not on an approved list
#
if ARGV[0] == nil || ARGV[1] == nil then
print "Trigger Error: Missing argument\n"
exit 1
end
require "P4Form.rb"
logfile = nil
File.open( ##DEBUG
P4LOGDIR + "jobdelete.log", ##DEBUG
"a") do |logfile| ##DEBUG
user=ARGV[0]
jobfile=ARGV[1]
datestamp = Time.now.strftime("%Y/%m/%d %H:%M:%S")
logfile.printf("%s User(%s) JobFile(%s)\n", datestamp, user, jobfile) ##DEBUG
a_file = File.new(jobfile)
a_form = P4Form.new(a_file)
a_file.close
logfile.printf("\nTmpFile:\n") ##DEBUG
a_form.print(logfile) ##DEBUG
end # close logfile ##DEBUG
exit 0 # OK to proceed