".Input("", "normal", "form_type", "hidden", "", ""); if (empty($queue) || !empty($allqueues) || !empty($limitqueues)) { $output .= OpenTable("Queue").""; $status = "New"; $output .= ''; } else { $output .= CreateSelectOptions(GetQueuesUserCanSee($username), "", $queue).""; $output .= ''; } } if(!empty($queue) && empty($allqueues) && empty($limitqueues)) $output .= OpenTable("Queue").FontBold($queue); $output .= CloseTable().OpenTable("ID of user").FontBold($user_id) .CloseTable().Input("ID of user", $user_id, "user_id", "hidden", "") .OpenTable("Requester") ."" .CloseTable().OpenTable("Status")."" .CloseTable().OpenTable("Owner") ."" .CloseTable().OpenTable("Cc") ."" .Font("(use a space and a comma to add others)") .CloseTable().OpenTable("Admin Cc") ."" .Font("(use a space and a comma to add others)") .CloseTable().OpenTable("Subject") ."" .CloseTable().OpenTable("Describe
the Issue") ."" .CloseTable().OpenTable("Send Preset Email Message To User") ."" .CloseTable().""; return $output; } //----------------------------------------------------------------------------- // // Function: NewTicketSpecialFieldsForm // Description: // Generate HTML to allow input of special fields on ticket creation. // Parameters: // string $queue Queue of ticket. // string $requester Requester of ticket. // string $status Ticket status. // string $owner Owner of ticket. // string $cc CC of ticket. // string $admin_cc Admin CC of ticket. // string $subject Subject of ticket. // string $attach Not Used. // string $content Initial comment for ticket. // string $special_fields_count Number of special fields. // string $email_user Email user? // Return Values: // // Remarks: // //----------------------------------------------------------------------------- function NewTicketSpecialFieldsForm($queue = "", $requester = "", $status = "", $owner = "", $cc = "", $admin_cc = "", $subject = "", $attach = "", $content = "", $special_fields_count = "", $email_user = "") { global $user_id; $clean_queue = str_replace("_", " ", $queue); $disabled = "disabled"; $output = ""; if ($special_fields_count > 0) { $output .= Input("", $email_user, "email_user", "hidden", "", "") .Input("", "special", "form_type", "hidden", "", "") .Input("", $queue, "queue", "hidden", "", "") .Input("", $user_id, "user_id", "hidden", "", "") .Input("", $requester, "requester", "hidden", "", "") .Input("", $status, "status", "hidden", "", "") .Input("", $owner, "owner", "hidden", "", "") .Input("", $cc, "cc", "hidden", "", "") .Input("", $admin_cc, "admin_cc", "hidden", "", "") .InputSpecialFields($queue) .OpenTable("Subject") ."" .CloseTable().OpenTable("Describe
the Issue") ."" .CloseTable(); } else { $output .= "Ticket about to be created by $requester.
" .Input("", $queue, "queue", "hidden", "", "") .Input("", $user_id, "user_id", "hidden", "", "") .Input("", $requester, "requester", "hidden", "", "") .Input("", $status, "status", "hidden", "", "") .Input("", $owner, "owner", "hidden", "", "") .Input("", $cc, "cc", "hidden", "", "") .Input("", $admin_cc, "admin_cc", "hidden", "", "") .Input("", $subject, "subject", "hidden", "", "") .Input("", $content, "content", "hidden", "", ""); } $output .= "
"; return $output; } //----------------------------------------------------------------------------- // // Function: TicketFormBasics // Description: // Allows editing of ticket "basics". // Parameters: // string $priority Current priority of ticket. // string $final_priority Current final priority of ticket. // string $time_worked Current time worked of ticket. // string $time_left Current time left of ticket. // Return Values: // Returns HTML to output. // Remarks: // None. //----------------------------------------------------------------------------- function TicketFormBasics($priority = "", $final_priority = "", $time_worked = "", $time_left = "") { return "".OpenTable("Priority") ."" .CloseTable().OpenTable("Final Priority") ."" .CloseTable().OpenTable("Time Worked") ."" .CloseTable().OpenTable("Time Left") ."" .CloseTable()."
"; } //----------------------------------------------------------------------------- // // Function: TicketFormDates // Description: // Allows editing of ticket dates. // Parameters: // string $starts Current start date. // string $due Current due date. // Return Values: // HTML to output. // Remarks: // None. //----------------------------------------------------------------------------- function TicketFormDates($starts = "", $due = "") { return "".OpenTable("Starts") ."" .DateWarning().CloseTable().OpenTable("Due") ."" .DateWarning().CloseTable()."
"; } //----------------------------------------------------------------------------- // // Function: TicketFormRelationships // Description: // Allows editing of ticket relationships. // Parameters: // string $depends_on Current depends on. // string $depended_on_by Current depended on by. // string $parents Current parents. // string $children Current children. // string $refers_to Current refers to. // string $refered_to_by Current refered to by. // Return Values: // HTML to output. // Remarks: // None. //----------------------------------------------------------------------------- function TicketFormRelationships($depends_on = "", $depended_on_by = "", $parents = "", $children = "", $refers_to = "", $refered_to_by = "") { return "".OpenTable("Depends on") ."" .CloseTable().OpenTable("Depended on by") ."" .CloseTable().OpenTable("Parents") ."" .CloseTable().OpenTable("Children") ."" .CloseTable().OpenTable("Refers to") ."" .CloseTable().OpenTable("Refered to by") ."" .CloseTable()."
"; } //----------------------------------------------------------------------------- // // Function: NewTicketShowForm // Description: // Generates the HTML to display to create a new ticket. // Parameters: // string $username Username. // string $id ID of user. // string $button Label of additional button, if any. // string $queue Queue of ticket. // string $requester Requestor of ticket. // string $status Status of ticket. // string $owner Owner of ticket. // string $cc CC of ticket. // string $admin_cc AdminCC of ticket. // string $subject Subject of first comment. // string $attach Not used. // string $content Body of first coment. // string $priority Priority of ticket. // string $final_priority Final Priority of ticket. // string $time_worked Time worked on ticket. // string $time_left Time remaining on ticket. // string $starts Date ticket starts. // string $due Date ticket due. // string $depends_on Tickets ticket depends on. // string $depended_on_by Tickets ticket depended on by. // string $parents Parents of ticket. // string $children Children of ticket. // string $refers_to Tickets ticket refers to. // string $refered_to_by Tickets ticket is refered to by. // string $special_fields_count Number of special fields for $queue. // string $email_user Email user? // string $form_type Type of form to show. // Return Values: // HTML to output. // Remarks: // None. //----------------------------------------------------------------------------- function NewTicketShowForm($username = "", $id = "", $button = "", $queue = "", $requester = "", $status = "", $owner = "", $cc = "", $admin_cc = "", $subject = "", $attach = "", $content = "", $priority = "", $final_priority = "", $time_worked = "", $time_left = "", $starts = "", $due = "", $depends_on = "", $depended_on_by = "", $parents = "", $children = "", $refers_to = "", $refered_to_by = "", $special_fields_count = "", $email_user = "", $form_type = "") { global $self,$detail_state,$user_id; $queue = str_replace(" ", "_", $queue); // $output = "
" if ($special_fields_count > 0) { $id = " id='special_fields' "; } $output = "\n\n\n"; $output .= "\n
\n" .OpenColorTable("green", "Create a new ticket", "100%")."\n"; $requester = GetStaffEmail($username); if (empty($requester)) $requester = $username; if (empty($button)) { $output .= NewTicketForm($queue, $requester, $status,$owner, $cc, $admin_cc, $subject, $attach, $content, $email_user); } elseif($button == "Show-Details" or $button == "Hide-Details") { $errmsg = CheckInputNewTicket($username, $status, $subject, $content, $starts, $due, $requester, $cc, $admin_cc, $user_id); if (!empty($errmsg)) { if (empty($subject) or empty($content)) { $output .= NewTicketForm($queue, $requester, $status, $owner, $cc, $admin_cc, $subject, $attach, $content, $email_user); } elseif(!empty($subject) and !empty($content) and $form_type == "normal" and ($button == "Show-Details" or $button == "Hide-Details")) { $output .= NewTicketForm($queue, $requester, $status, $owner, $cc, $admin_cc, $subject, $attach, $content, $email_user); } else { $output .= NewTicketSpecialFieldsForm($queue, $requester, $status, $owner, $cc, $admin_cc, $subject, $attach, $content, $special_fields_count, $email_user); } } elseif ($form_type == "special" and empty($errmsg)) { $output .= NewTicketSpecialFieldsForm($queue, $requester, $status, $owner, $cc, $admin_cc, $subject, $attach, $content, $special_fields_count, $email_user); } else { $output .= NewTicketForm($queue, $requester, $status, $owner, $cc, $admin_cc, $subject, $attach, $content, $email_user); } } elseif($button == "Continue") { $errmsg = CheckInputNewTicket($username, $status, $subject, $content, $starts, $due, $requester, $cc, $admin_cc, $user_id); if (!empty($errmsg)) { if (empty($subject) or empty($content)) { $output .= NewTicketForm($queue, $requester, $status, $owner, $cc, $admin_cc, $subject, $attach, $content, $email_user); } else { $output .= NewTicketSpecialFieldsForm($queue, $requester, $status, $owner, $cc, $admin_cc, $subject, $attach, $content, $special_fields_count, $email_user); } } else { $output .= NewTicketSpecialFieldsForm($queue, $requester, $status, $owner, $cc, $admin_cc, $subject, $attach, $content, $special_fields_count, $email_user); } } elseif($button == "Create Ticket") { $errmsg = CheckInputNewTicket($username, $status, $subject, $content, $starts, $due, $requester, $cc, $admin_cc, $user_id); if (!empty($errmsg)) { $output .= NewTicketSpecialFieldsForm($queue, $requester, $status, $owner, $cc, $admin_cc, $subject, $attach, $content, $special_fields_count, $email_user); } } $output .= CloseColorTable()."
" .""; if ($detail_state == "Show-Details") { $output .= '
' .OpenColorTable("yellow", "The Basics", "100%") .TicketFormBasics($priority, $final_priority,$time_worked, $time_left) .CloseColorTable()."" .OpenColorTable("blue", "Dates", "100%") .TicketFormDates($starts, $due) .CloseColorTable() .'
'; } else { $output .= "" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."" .""; } $output .= "
" ."
" .OpenColorTable("red", "Control", "100%"); if ($detail_state == "Hide-Details") { $output .= ''; } elseif ($detail_state == "Show-Details") { $output .= ''; } SetNoBack("CreateTicket", "reset"); if (empty($queue)) { $output .= ''; } else { if ($form_type == "normal" and $button == "Continue" and !empty($subject) and !empty($content)) { $jscript = "onClick=\"enable()\""; $output .= ''; } else if($form_type == "special") { $jscript = "onClick=\"enable()\""; $output .= ''; } else { $output .= ''; } } $output .= CloseColorTable()."
"; return $output; } //----------------------------------------------------------------------------- // // Function: CheckInputNewTicket // Description: // Checks the input for a new ticket. // Parameters: // string $requester Requester of new ticket. // string $status Status to create with. // string $subject Subject of ticket. // string $content Initial comment of ticket. // string $starts Date ticket start. // string $due Date ticket due. // string $requester Requester of new ticket. // string $cc CC of ticket. // string $admin_cc Admin CC of ticket. // string $user_id User ID. // string $queue Queue to create in. // Return Values: // HTML to output (Includes errors if need be). // Remarks: // None. //----------------------------------------------------------------------------- function CheckInputNewTicket($requester = "", $status = "", $subject = "", $content = "", $starts = "", $due = "", $requester = "", $cc = "", $admin_cc = "", $user_id = "", $queue = "") { $output = ""; if (empty($requester)) $output .= "Please fill in the requester field.
"; if (empty($queue)) $output .= "Please select a queue.
"; if (empty($status)) $output .= "Please select a status.
"; if (empty($subject)) $output .= "Please fill in the subject field.
"; if (empty($content)) $output .= "Please describe the issue.
"; if ((empty($user_id)) || (!UserExists($user_id))) $output .= "Please enter a correct user id
"; if (!empty($requester)) { if (!EmailGood($requester)) { $output .= "Requester: $requester is not a valid "; $output .= "email address.
"; } } if (!empty($output)) { global $button; $button = ""; } if (!empty($cc)) { $cc = str_replace(" ", "*", $cc); if ($cc != "**") { if (!EmailGood($cc)) { $output .= "Cc: $cc is not a valid "; $output .= "email address.
"; } } } if (!empty($admin_cc)) { $admin_cc = str_replace(" ", "*", $admin_cc); if ($admin_cc != "**") { if (!EmailGood($admin_cc)) { $output .= "Admin Cc: $admin_cc is not a valid "; $output .= "email address.
"; } } } $flag = 0; if (!empty($starts)) { if (!date_good($starts)) { $flag = 1; $output .= "$starts does not conform to "; $output .= "yyyy-mm-dd format.
"; } } if (!empty($due)) { if (!date_good($due)) { $flag = 1; $output .= "$due does not conform to "; $output .= "yyyy-mm-dd format.
"; } } if ($flag) { global $detail_state; if ($detail_state == "Hide-Details") { $output .= "

Click the \"Show-Details\" button "; $output .= "so you can fix the date format problem."; } } $output .= CheckRequiredFields(); return $output; } ?>