Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # File: record-time.pl
- #
- # Parameters:
- #
- # task_title
- # task_desc
- # task_hrs_alloc
- # task_hrs_rec
- # task_hrs_left
- # task_ref (required)
- # task_user (required)
- # task_conf
- # task_percent
- #
- # form_start
- # form_end
- # form_date_sel
- #
- # tms_date_to
- # tms_date_for
- # tms_conf
- # tms_hourstorec
- # tms_hourstoshow
- #
- # Exit Status:
- #
- # 1/0
- #
- # Description:
- # Displays a popup window that allows the user to record time against a task.
- # Hours can be recorded for a single day or x hours to each day in a range.
- #
- #
- ################################################################################
- use strict;
- use File::Basename;
- use CGI;
- use CGImis;
- use Dates;
- use TMS;
- use Userblog;
- use Randomtask;
- use Blog;
- use Taskdiary;
- use Authenticate;
- use myDBob;
- use Debug;
- use CGI qw(:standard escapeHTML);
- use URI::Escape;
- use Date::Calc qw(Add_Delta_Days Add_Delta_DHMS Day_of_Week);
- #Start the web page
- $CGI_mis::query = CGI::new();
- print $CGI_mis::query->header();
- $Utils::HTML = 1;
- $Debug::HTML = 1;
- CGI_mis::PrintHeader("Record Time", undef, 1);
- my $script = basename($0);
- my $all_params_ref = CGI_mis::GetAllParams($script);
- my $user = Authenticate::GetUser();
- my $numb_days;
- my $extra_js;
- #
- # Check the required parameters
- #
- # New code to attempt to have # symbols not break the url
- if (defined $all_params_ref->{'task_desc'})
- {
- $all_params_ref->{'task_desc'} = uri_escape($all_params_ref->{'task_desc'});
- }
- if(! defined $all_params_ref->{'task_ref'})
- {
- error("No task ref - Cannot log time");
- }
- if(! defined $all_params_ref->{'task_user'})
- {
- error("No task user - Cannot log time");
- }
- #
- # Display the page
- #
- my ($title, $param, $date_sel);
- my ($newhrsinput, $forinput, $toinput, $confidenceinput);
- my $calendar = 1;
- my $confidence = 1;
- my $taskdiary = 0;
- if($all_params_ref->{'task_ref'} =~ /^(CPO|RFR|RND)/)
- {
- $confidence = 0;
- $taskdiary = 1;
- }
- elsif($all_params_ref->{'task_ref'} =~ /^BUG/)
- {
- $taskdiary = 1;
- }
- # Display the task title, but if not defined use the task_ref
- $title = $all_params_ref->{'task_title'} || $all_params_ref->{'task_ref'};
- # add on the description if defined
- if(defined $all_params_ref->{'task_desc'})
- {
- $title .= "<br>".escapeHTML($all_params_ref->{'task_desc'});
- }
- print "<h3 class='tmstitle'>$title</h3>\n";
- # We'll need to escape anything which may have 'odd' characters
- $all_params_ref->{'task_title'} = escapeHTML($all_params_ref->{'task_title'})
- if defined $all_params_ref->{'task_title'};
- $all_params_ref->{'task_desc'} = escapeHTML($all_params_ref->{'task_desc'})
- if defined $all_params_ref->{'task_desc'};
- ##################################
- #
- # error
- #
- # Simple function to display an
- # error, add a close window link
- # and finish the page off.
- #
- ##################################
- sub error
- {
- my $text = shift || "Unknown";
- Utils::Error('ERROR', $text);
- print "<a href='javascript:void(null)' ".
- "onclick='javascript:window.close()'>Close Window</a>";
- print "</body></html>\n";
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement