📄 ticketview.php
字号:
$i = $table_message_start;
while ($reply = $db->row_array()) {
$reply['message'] = wordwrap(trim($reply['message']), 78, "\n");
$i++;
$js .= "data[$reply[id]] = \"" . quotemessage($reply[message]) . "\";
";
// just in case two messages on same second
if (@in_array($reply[date], $time_array)) {
$reply[date]++;
}
$time_array[] = $reply[date];
$date = our_date($reply[date]);
if ($reply['techid']) {
$reply['username'] = $reply['t_username'];
$by = "<b>$reply[username] (tech) </b>";
} elseif ($reply['userid']) {
$reply['username'] = $reply['u_username'];
$by = "<b>$ticket[email] </b>";
if ($reply['ipaddress']) {
$by .= " [ip address = $reply[ipaddress]] ";
} elseif ($reply['sourceid']) {
$by .= " [sent by email] ";
} else {
$by .= " [entered by technician]";
}
} else {
$by = "<b>System (DeskPRO)</b>";
}
$bit = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">";
$bit .= "<tr><td><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><a name=\"$i\"/><tr><td><U><b>#$i</b> Message by $by on $date</U></td><td align=\"right\">";
$bit .= "<table cellpadding=\"2\" cellspacing=\"0\"><tr><td valign=\"middle\">" . html_image('tech/bul087.gif') . "</td><td valign=\"middle\"><a href=\"javascript:openWindow('popupactions.php?do=raw&id=$reply[id]', '', '')\">View Raw</a></td>";
// quote
$bit .= "<td valign=\"middle\">" . html_image('tech/bul106.gif') . "</td><td valign=\"middle\"><a href=\"javascript:quote('$reply[id]')\">Quote</a></td>";
// edit
$bit .= "<td valign=\"middle\">" . html_image('tech/bul108.gif') . "</td><td valign=\"middle\"><a href=\"javascript:openWindow('popupactions.php?do=editmessage&id=$reply[id]&num=$i', '', '')\">Edit Message</a></td>";
if ($reply[sourceid]) {
$bit .= "<td valign=\"middle\">" . html_image('tech/bul109.gif') . "</td><td valign=\"middle\"><a href=\"JavaScript:openWindow('popupactions.php?do=view_source&id=$reply[id]', '', '')\">View Email Source</a></td>";
}
$bit .= "</td></tr></table></td></tr></table></td></tr>";
$bit .= "<tr><td colspan=\"2\"><div name=\"reply_$reply[id]\">" . dp_code($reply['message']) . "</div></td></tr></table>";
$table_messages[$reply[date]] = $bit;
$table_message_count++;
}
$table_message_start++;
if ($_REQUEST[messages] == 'all') {
if ($table_message_count) {
$message_total = "($total_messages total)";
} else {
$message_total = "(no messages)";
}
$table_messages[0] = "<center>Showing all messages $message_total.
<A HREF=\"ticketview.php?id=$id\">Show Newest</A>.</center>";
} else {
if ($table_message_count) {
if ((($table_message_count - 1) + $table_message_start) == 1) {
$message_total = "(1 message total)";
} else {
$message_total = "(#$table_message_start to #$i; $total_messages messages total)";
}
} else {
$message_total = "(no messages)";
}
if ($total_messages > 10) {
$table_messages[0] = "<center>Showing up to the last 10 messages $message_total.
<a href=\"ticketview.php?id=$id&messages=all\">Show All</a>.";
} else {
$table_messages[0] = "<center>Showing $table_message_count message(s) $message_total.</center>";
}
}
$js .= "
top.center.document.dpreply.reply.value += data[id] + ' ';
top.center.document.dpreply.reply.focus();
}
</script>
";
echo $js;
############################### TICKET NOTES ###############################
$db->query("
SELECT ticket_notes.*, tech.username
FROM ticket_notes
LEFT JOIN tech ON ticket_notes.techid = tech.id
WHERE ticket_notes.ticketid = '$id'
ORDER BY id
");
while ($result = $db->row_array()) {
if (!$result['username']) {
$result['username'] = 'system';
}
$table_notes[] = array(our_date($result['date']) . iff(($result['techid'] == $user['id']),
" <A HREF=\"ticketview.php?do=delnote&id=$id¬eid=$result[id]\">Delete</A>"), $result['username']);
$table_notes_message[] = $result[note];
// in case message and note same second
if (@in_array($result['date'], $time_array)) {
$result['date']++;
}
$bit = "<U>Note by <B>$result[username]</B> (" . our_date($result['date']) . ")</U><BR>" . dp_code($result['note']);
while (@in_array($result['date'], $time_array)) {
$result['date']++;
}
$table_messages[$result['date']] = $bit;
}
ksort($table_messages);
############################### REPLY FORM ###############################
?>
<script language="javascript">
function isnote() {
var yesno;
if (document.dpreply.is_note.checked == true) {
yesno = 1;
}
if (yesno == '1') {
document.dpreply.emailuser.checked = false;
document.dpreply.emailuser.disabled = true;
document.dpreply.makefaq.checked = false;
document.dpreply.makefaq.disabled = true;
document.dpreply.close.checked = false;
document.dpreply.close.disabled = true;
document.dpreply.awaitinguser.checked = false;
document.dpreply.awaitinguser.disabled = true;
} else {
document.dpreply.emailuser.disabled = false;
document.dpreply.makefaq.disabled = false;
document.dpreply.close.disabled = false;
document.dpreply.awaitinguser.disabled = false;
}
}
</script>
<?php
if ($user['signature']) {
$user['signature'] = "\n\n--\n$user[signature]";
}
$help = thelp('Tickets - Viewing and Responding', 'Reply Actions and Options');
$table_reply[] = "
<table cellpadding=\"3\" width=\"00%\" cellspacing=\"1\"><tr valign=\"top\">
<td valign=\"top\"><br />
<table cellpadding=\"2\" cellspacing=\"0\">
<tr><td align=\"center\">" . html_image('tech/bul098.gif') . "</td><td><a href=\"javascript:openWindow('./faqpop.php', 700, 600, 'faq')\">FAQ</a></td></tr>
<tr><td align=\"center\"><br />" . html_image('tech/bul087.gif') . "</td><td><br /><a href=\"javascript:openWindow('./popupactions.php?do=largeedit', 700, 600, 'big')\">Large Edit</a></td></tr>
<tr><td align=\"center\"><br />" . html_image('tech/bul099.gif') . "</td><td><br />
<DIV ID=\"newattachments\">
<a href=\"javascript:openWindow('./addattachments.php?id=$ticket[id]', 350, 300, 'attachment')\">Add Attach</a>
</DIV></td></tr></table>
</td><td>" .
form_hidden('viewed', mktime()) . "
<TEXTAREA NAME=\"reply\" ROWS=\"10\" COLS=\"70\"
ONSELECT=\"top.empty.storeCaret(this);\"
ONCLICK=\"top.empty.storeCaret(this);\"
ONKEYUP=\"top.empty.storeCaret(this);\">$user[signature]
</TEXTAREA>
</td><td><br />".
form_checkbox_single('mail_cc', 'cc', 0) . " Cc: only this reply <BR>" .
form_checkbox_single('mail_digest', 'digest', 0) . " Mail a digest of this ticket <BR>" .
'<table><tr><td>To:</td><td>'. form_input('cc', NULL, '20') . '</td></tr><td colspan="2"><br></td></tr></table>
<center>'.thelp('Tickets - Viewing and Responding', "Cc's and Digests") . '</center>
</td><td rowspan="2"><center>
<select name="drop" style="width:150" onchange="top.empty.showdata(dpreply.drop.value)"></select><br /><br />
<select size="10" name="list3" style="width:150"></select>
<input type="hidden" name="category" value="1"><br /><br />
<input type="button" onClick="top.empty.godeep(dpreply.list3.value,dpreply.category.value)" value="Insert into Reply"><br /><br />
' . thelp('Quick Replies', 'Inserting into Tickets') . '
</center></td></tr>
<tr>
<td><center>'.$help.'</center></td>
<td colspan="2">
<table><tr>' . "
<td>" . form_checkbox_single('makefaq', '1', '') . " Create FAQ article from this ticket</td>
<td>" . form_checkbox_single('close', '1', '') . " Close the ticket</td></tr><tr>
<td>" . form_checkbox_single('emailuser', '1', '1') . " E-mail this reply to the user</td>
<td>" . form_checkbox_single('awaitinguser', '1', '1') . " Set 'awaiting a user response'</td></tr><tr>
<td><input type=\"checkbox\" name=\"is_note\" value=\"1\" onclick=\"javascript:isnote()\"> Message is a note (hidden from users)</td>
<td>" .
iff ($ticket[tech] != $user[id], form_checkbox_single('ownership', 1, 1) . " Claim ownership of this ticket") . "</td></tr>" .
iff ($settings['autostart_billing_timer'] AND feature_check('payments', 1) AND $settings['payments'], "<tr><td colspan=\"2\">" . form_checkbox_single('ignorebilling', 1) . " Don't automatically apply billing timer to the ticket for this response.</td></tr>") . "
</table></td></tr></table>" .
form_hidden('charge', '') .
form_hidden('hours', '') .
form_hidden('minutes', '') .
form_hidden('seconds', '') .
form_hidden('userid', $ticket['userid']);
############################### DISPLAY PAGE ###############################
echo "<table width=\"100%\"><tr><td valign=\"top\"><form method=\"post\" action=\"ticketedit.php\">" . form_hidden('id', $id);
$ticket_title = "(Ticket ID: $id, Ticket REF: $ticket[ref])";
table_header("Ticket Information $ticket_title");
table_content('', $table_ticket_fields);
if (p_ticket('edit')) {
table_footer('', '', "<input type=\"button\" value=\"Edit Ticket Data\" onclick=\"oc('Ticket Information $ticket_title'); oc('Edit Fields $ticket_title'); return true\">", 1);
} else {
table_footer();
}
if (p_ticket('edit')) {
echo form_hidden('searchid', $_REQUEST['searchid']);
echo form_hidden('num', $_REQUEST['num']);
table_header("Edit Fields $ticket_title");
table_content('', $table_ticket_fields2);
table_footer('', '', "<input type=\"submit\" name=\"Update Fields\" value=\"Update Fields\">" . " <input type=\"button\" value=\"View Ticket Fields\" onclick=\"oc('Ticket Information $ticket_title'); oc('Edit Fields $ticket_title'); return true\">", 1);
echo "<SCRIPT>oc('Edit Fields $ticket_title');</SCRIPT>";
}
echo "<br />";
table_header("Ticket Owner Details (User ID: $ticket_user[id])");
table_content('', $table_user);
if ($ticket['userid']) {
table_footer('', '', redirect_button('View / Edit User', "./../users/view.php?id=$ticket_user[id]"));
}
echo "<br />";
echo "</td></form><td valign=\"top\" align=\"right\">";
outline_table('Ticket Status', $ticket_status, '95%');
echo "<br />";
outline_table('Ticket Operations', $top_links, '95%');
echo "</td></tr></table>";
table_header($table_user_tickets_header);
if (is_array($table_user_tickets)) {
table_content(array('Ticket Subject', 'Status', 'Awaiting','Merge ' . thelp('Tickets - Viewing and Responding', 'Merging Tickets')), $table_user_tickets);
} else {
table_content('', array('User has no other tickets.'));
}
table_footer('', '', $table_user_tickets_footer);
echo "<table width=\"100%\"><tr><td valign=\"top\">";
table_header('Ticket Notes');
table_content(array('Date Written', 'Tech Writer'), $table_notes, '', '', '', $table_notes_message);
table_footer('', '', form_button('Add New Note', "onclick=\"openWindow('./popupactions.php?do=note&id=$ticket[id]', 450, 300, 'attachment')\""));
echo "</td><td valign=\"top\">";
table_header('Ticket Attachments');
table_content(array('Filename', 'Size', 'Download', 'Delete'), $table_attachments);
table_footer('', '', form_button('Add New Attachment(s)', "onclick=\"openWindow('./addattachments.php?id=$ticket[id]', 350, 300, 'attachment')\""));
echo "</td></tr></table>";
echo "<table width=\"100%\"><tr>";
if ($settings['payments'] AND feature_check('payments', 1)) {
echo "<form method=\"post\" action=\"ticketedit.php\" name=\"payment\" id=\"payment\"><td valign=\"top\">";
table_header('Payment Functions', '', '', !$settings['autostart_billing_timer']);
table_content('', $table_payment, '', '');
table_footer();
}
echo $timerjs;
echo "</td></form><form method=\"post\" action=\"ticketedit.php\" name=\"calendar\" id=\"calendar\"><td valign=\"top\">";
if (count($table_calendar) > 2) {
table_header('Calendar Functions', '', '', 0);
table_content('', $table_calendar);
table_footer();
} else {
table_header('Calendar Functions', '', '', 1);
table_content('', $table_calendar);
table_footer();
}
echo "</td></form><td valign=\"top\">";
echo "</td></tr></table>";
if ($settings['payments'] AND feature_check('payments', 1)) {
table_header(iff($billing, 'Billing Details', 'Billing Details (no items)'), '', '', (!$billing));
table_content($table_billing_cols, $table_billing);
table_footer();
$copybilling = "copyBilling();";
} else {
$copybilling = NULL;
}
table_header('Ticket Messages');
table_content('', $table_messages);
table_footer();
if (p_ticket('edit') AND $ticket['is_open']) {
table_header("Reply to Ticket (#$ticket[id], Ref #$ticket[ref])", 'ticketreply.php', array('do' => 'reply', 'id' => $id, 'searchid' => $_REQUEST['searchid'], 'num' => $_REQUEST['num']), '', 'dpreply', 1);
table_content('', $table_reply);
table_footer('Send Reply', '', spellcheck_button('dpreply', 'reply'), '', iff($user['copy_to_clipboard'], "onClick=\"copyText(document.dpreply.reply); $copybilling; return validate();\"", NULL), 'Submit');
}
$ticketlog_data = generate_ticketlog($id);
$cols = array('Date', 'Action', 'Tech/User');
table_header('Ticket Log', '', '', '');
table_content($cols, $ticketlog_data[0], '', '', '', $ticketlog_data[1]);
table_footer();
############################### END PAGE ###############################
if ($settings['autostart_billing_timer'] AND $settings['payments'] AND feature_check('payments', 1)) {
?>
<SCRIPT language="JavaScript">
timer_Start();
</SCRIPT>
<?php
}
if ($ticket['is_open'] AND p_ticket('edit')) {
?>
<SCRIPT language="javascript">
top.empty.buildselect();
top.empty.showdata('0');
function copyText(text) {
var agt=navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
if (is_ie) {
copied = text.createTextRange();
copied.execCommand("Copy");
}
}
function copyBilling() {
document.dpreply.charge.value = document.payment.charge.value;
document.dpreply.hours.value = document.payment.hours.value;
document.dpreply.minutes.value = document.payment.minutes.value;
document.dpreply.seconds.value = document.payment.seconds.value;
}
</SCRIPT>
<?php
};
tech_footer();
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -