Added quick access to related document(s) when viewing a message that has any.
[openemr.git] / interface / main / messages / messages.php
blobe085871e2db5acddeab4a5fa3dcf4e55ecc14719
1 <?php
2 /**
3 * Copyright (C) 2010 OpenEMR Support LLC
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * 2013/02/08 Minor tweaks by EMR Direct to allow integration with Direct messaging
12 //SANITIZE ALL ESCAPES
13 $sanitize_all_escapes=true;
15 //STOP FAKE REGISTER GLOBALS
16 $fake_register_globals=false;
18 require_once("../../globals.php");
19 require_once("$srcdir/pnotes.inc");
20 require_once("$srcdir/patient.inc");
21 require_once("$srcdir/acl.inc");
22 require_once("$srcdir/log.inc");
23 require_once("$srcdir/options.inc.php");
24 require_once("$srcdir/formdata.inc.php");
25 require_once("$srcdir/classes/Document.class.php");
26 require_once("$srcdir/gprelations.inc.php");
27 require_once("$srcdir/formatting.inc.php");
29 <html>
30 <head>
32 <?php html_header_show();?>
33 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
34 <script type="text/javascript" src="../../../library/dialog.js"></script>
35 <script type="text/javascript" src="../../../library/textformat.js"></script>
36 <script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/js/jquery.js"></script>
37 </head>
39 <body class="body_top">
41 <span class="title"><?php echo xlt('Message and Reminder Center'); ?></span>
42 <br /><br />
43 <span class="title"><?php echo xlt('Reminders'); ?></span>
45 <?php
47 // TajEmo Work by CB 2012/01/11 02:51:25 PM adding dated reminders
48 // I am asuming that at this point security checks have been performed
49 require_once '../dated_reminders/dated_reminders.php';
51 // Check to see if the user has Admin rights, and if so, allow access to See All.
52 $showall = isset($_GET['show_all']) ? $_GET['show_all'] : "" ;
53 if ($showall == "yes") {
54 $show_all = $showall;
56 else
58 $show_all= "no";
61 // Collect active variable and applicable html code for links
62 $form_active = $_REQUEST['form_active'];
63 $form_inactive = $_REQUEST['form_inactive'];
64 if ($form_active) {
65 $active = '1';
66 $activity_string_html = 'form_active=1';
68 else if ($form_inactive) {
69 $active = '0';
70 $activity_string_html = 'form_inactive=1';
72 else {
73 $active = 'all';
74 $activity_string_html = '';
77 //collect the task setting
78 $task= isset($_REQUEST['task']) ? $_REQUEST['task'] : "";
80 if (acl_check('admin', 'super' )) {
81 if ($show_all=='yes') {
82 $showall = "yes";
83 $lnkvar="'messages.php?show_all=no&$activity_string_html' name='Just Mine' onclick=\"top.restoreSession()\"> (".htmlspecialchars( xl('Just Mine'), ENT_NOQUOTES).")";
85 else {
86 $showall = "no";
87 $lnkvar="'messages.php?show_all=yes&$activity_string_html' name='See All' onclick=\"top.restoreSession()\"> (".htmlspecialchars( xl('See All'), ENT_NOQUOTES).")";
91 <br>
92 <table><tr><td><span class="title"><?php echo htmlspecialchars( xl('Messages'), ENT_NOQUOTES); ?></span> <a class='more' href=<?php echo $lnkvar; ?></a></td></tr></table>
93 <?php
94 //show the activity links
95 if (empty($task) || $task=="add" || $task=="delete") { ?>
96 <?php if ($active == "all") { ?>
97 <span><?php echo xlt('Show All'); ?></span>
98 <?php } else { ?>
99 <a href="messages.php" class="link" onclick="top.restoreSession()"><span><?php echo xlt('Show All'); ?></span></a>
100 <?php } ?>
102 <?php if ($active == '1') { ?>
103 <span><?php echo xlt('Show Active'); ?></span>
104 <?php } else { ?>
105 <a href="messages.php?form_active=1" class="link" onclick="top.restoreSession()"><span><?php echo xlt('Show Active'); ?></span></a>
106 <?php } ?>
108 <?php if ($active == '0') { ?>
109 <span><?php echo xlt('Show Inactive'); ?></span>
110 <?php } else { ?>
111 <a href="messages.php?form_inactive=1" class="link" onclick="top.restoreSession()"><span><?php echo xlt('Show Inactive'); ?></span></a>
112 <?php } ?>
113 <?php } ?>
115 <?php
116 switch($task) {
117 case "add" :
119 // Add a new message for a specific patient; the message is documented in Patient Notes.
120 // Add a new message; it's treated as a new note in Patient Notes.
121 $note = $_POST['note'];
122 $noteid = $_POST['noteid'];
123 $form_note_type = $_POST['form_note_type'];
124 $assigned_to = $_POST['assigned_to'];
125 $form_message_status = $_POST['form_message_status'];
126 $reply_to = $_POST['reply_to'];
127 $assigned_to_list = explode(';',$assigned_to);
128 foreach($assigned_to_list as $assigned_to){
129 if ($noteid && $assigned_to != '-patient-') {
130 updatePnote($noteid, $note, $form_note_type, $assigned_to, $form_message_status);
131 $noteid = '';
133 else {
134 if($noteid && $assigned_to == '-patient-'){
135 $row = getPnoteById($noteid);
136 if (! $row) die("getPnoteById() did not find id '".text($noteid)."'");
137 $pres = sqlQuery("SELECT lname, fname " .
138 "FROM patient_data WHERE pid = ?", array($reply_to) );
139 $patientname = $pres['lname'] . ", " . $pres['fname'];
140 $note .= "\n\n$patientname on ".$row['date']." wrote:\n\n";
141 $note .= $row['body'];
143 addPnote($reply_to, $note, $userauthorized, '1', $form_note_type, $assigned_to, '', $form_message_status);
146 } break;
147 case "savePatient":
148 case "save" : {
149 // Update alert.
150 $noteid = $_POST['noteid'];
151 $form_message_status = $_POST['form_message_status'];
152 $reply_to = $_POST['reply_to'];
153 if ($task=="save")
154 updatePnoteMessageStatus($noteid,$form_message_status);
155 else
156 updatePnotePatient($noteid,$reply_to);
157 $task = "edit";
158 $note = $_POST['note'];
159 $title = $_POST['form_note_type'];
160 $assigned_to = $_POST['assigned_to'];
162 case "edit" : {
163 if ($noteid == "") {
164 $noteid = $_GET['noteid'];
166 // Update the message if it already exists; it's appended to an existing note in Patient Notes.
167 $result = getPnoteById($noteid);
168 if ($result) {
169 if ($title == ""){
170 $title = $result['title'];
172 if ($assigned_to == ""){
173 $assigned_to = $result['assigned_to'];
175 $body = $result['body'];
176 if ($reply_to == ""){
177 $reply_to = $result['pid'];
179 $form_message_status = $result['message_status'];
181 } break;
182 case "delete" : {
183 // Delete selected message(s) from the Messages box (only).
184 $delete_id = $_POST['delete_id'];
185 for($i = 0; $i < count($delete_id); $i++) {
186 deletePnote($delete_id[$i]);
187 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "pnotes: id ".$delete_id[$i]);
189 } break;
192 if($task == "addnew" or $task == "edit") {
193 // Display the Messages page layout.
194 echo "
195 <form name=new_note id=new_note action=\"messages.php?showall=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($begin)."&$activity_string_html\" method=post>
196 <input type=hidden name=noteid id=noteid value=".htmlspecialchars( $noteid, ENT_QUOTES).">
197 <input type=hidden name=task id=task value=add>";
199 <div id="pnotes"><center>
200 <table border='0' cellspacing='8'>
201 <tr>
202 <td class='text'>
203 <b><?php echo htmlspecialchars( xl('Type'), ENT_NOQUOTES); ?>:</b>
204 <?php
205 if ($title == "") {
206 $title = "Unassigned";
208 // Added 6/2009 by BM to incorporate the patient notes into the list_options listings.
209 generate_form_field(array('data_type'=>1,'field_id'=>'note_type','list_id'=>'note_type','empty_title'=>'SKIP','order_by'=>'title'), $title);
211 &nbsp; &nbsp;
212 <?php if ($task != "addnew" && $result['pid'] != 0) { ?>
213 <a class="patLink" onclick="goPid('<?php echo attr($result['pid']);?>')"><?php echo htmlspecialchars( xl('Patient'), ENT_NOQUOTES); ?>:</a>
214 <?php } else { ?>
215 <b class='<?php echo ($task=="addnew"?"required":"") ?>'><?php echo htmlspecialchars( xl('Patient'), ENT_NOQUOTES); ?>:</b>
216 <?php
218 if ($reply_to) {
219 $prow = sqlQuery("SELECT lname, fname " .
220 "FROM patient_data WHERE pid = ?", array($reply_to) );
221 $patientname = $prow['lname'] . ", " . $prow['fname'];
223 if ($patientname == '') {
224 $patientname = xl('Click to select');
225 } ?>
226 <input type='text' size='10' name='form_patient' style='width:150px;<?php
227 echo ($task=="addnew"?"cursor:pointer;cursor:hand;":"") ?>' value='<?php
228 echo htmlspecialchars($patientname, ENT_QUOTES); ?>' <?php
229 echo (($task=="addnew" || $result['pid']==0) ? "onclick='sel_patient()' readonly":"disabled") ?> title='<?php
230 echo ($task=="addnew"?(htmlspecialchars( xl('Click to select patient'), ENT_QUOTES)):"") ?>' />
231 <input type='hidden' name='reply_to' id='reply_to' value='<?php echo htmlspecialchars( $reply_to, ENT_QUOTES) ?>' />
232 &nbsp; &nbsp;
233 <b><?php echo htmlspecialchars( xl('Status'), ENT_NOQUOTES); ?>:</b>
234 <?php
235 if ($form_message_status == "") {
236 $form_message_status = 'New';
238 generate_form_field(array('data_type'=>1,'field_id'=>'message_status','list_id'=>'message_status','empty_title'=>'SKIP','order_by'=>'title'), $form_message_status); ?>
239 </td>
240 </tr>
241 <tr>
242 <td class='text'>
243 <b><?php echo htmlspecialchars( xl('To'), ENT_QUOTES); ?>:</b>
244 <input type='textbox' name='assigned_to_text' id='assigned_to_text' size='40' readonly='readonly' value='<?php echo htmlspecialchars(xl("Select Users From The Dropdown List"), ENT_QUOTES)?>' >
245 <input type='hidden' name='assigned_to' id='assigned_to' >
246 <select name='users' id='users' onchange='addtolist(this);' >
247 <?php
248 echo "<option value='" . htmlspecialchars( '--', ENT_QUOTES) . "'";
249 echo ">" . htmlspecialchars( xl('Select User'), ENT_NOQUOTES);
250 echo "</option>\n";
251 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
252 "WHERE username != '' AND active = 1 AND " .
253 "( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
254 "ORDER BY lname, fname");
255 while ($urow = sqlFetchArray($ures)) {
256 echo " <option value='" . htmlspecialchars( $urow['username'], ENT_QUOTES) . "'";
257 if ($urow['username'] == $assigned_to) echo " selected";
258 echo ">" . htmlspecialchars( $urow['lname'], ENT_NOQUOTES);
259 if ($urow['fname']) echo ", " . htmlspecialchars( $urow['fname'], ENT_NOQUOTES);
260 echo "</option>\n";
262 echo "<option value='" . htmlspecialchars( '-patient-', ENT_QUOTES) . "'";
263 if ($assigned_to == '-patient-') echo " selected";
264 echo ">" . htmlspecialchars( '-Patient-', ENT_NOQUOTES);
265 echo "</option>\n";
267 </select>
268 </td>
269 </tr>
271 <?php
272 if ($noteid) {
273 // Get the related document IDs if any.
274 $tmp = sqlStatement("SELECT id1 FROM gprelations WHERE " .
275 "type1 = ? AND type2 = ? AND id2 = ?",
276 array('1', '6', $noteid));
277 if (sqlNumRows($tmp)) {
278 echo " <tr>\n";
279 echo " <td class='text'><b>";
280 echo xlt('Linked document') . ":</b>\n";
281 while ($gprow = sqlFetchArray($tmp)) {
282 $d = new Document($gprow['id1']);
283 echo " <a href='";
284 echo $GLOBALS['webroot'] . "/controller.php?document&retrieve";
285 echo "&patient_id=" . $d->get_foreign_id();
286 echo "&document_id=" . $d->get_id();
287 echo "&as_file=true' target='_blank' onclick='top.restoreSession()'>";
288 echo text($d->get_url_file());
289 echo "</a>\n";
291 echo " </td>\n";
292 echo " </tr>\n";
297 <tr>
298 <td>
300 <?php
302 if ($noteid) {
303 $body = preg_replace('/(:\d{2}\s\()'.$result['pid'].'(\sto\s)/','${1}'.$patientname.'${2}',$body);
304 $body = nl2br(htmlspecialchars( $body, ENT_NOQUOTES));
305 echo "<div class='text' style='background-color:white; color: gray; border:1px solid #999; padding: 5px; width: 640px;'>".$body."</div>";
309 <textarea name='note' id='note' rows='8' style="width: 660px; "><?php echo htmlspecialchars( $note, ENT_NOQUOTES) ?></textarea>
310 </td>
311 </tr>
312 </table>
314 <?php if ($noteid) { ?>
315 <!-- This is for displaying an existing note. -->
316 <input type="button" id="newnote" value="<?php echo htmlspecialchars( xl('Send message'), ENT_QUOTES); ?>">
317 <input type="button" id="printnote" value="<?php echo htmlspecialchars( xl('Print message'), ENT_QUOTES); ?>">
318 <input type="button" id="cancel" value="<?php echo htmlspecialchars( xl('Cancel'), ENT_QUOTES); ?>">
319 <?php } else { ?>
320 <!-- This is for displaying a new note. -->
321 <input type="button" id="newnote" value="<?php echo htmlspecialchars( xl('Send message'), ENT_QUOTES); ?>">
322 <input type="button" id="cancel" value="<?php echo htmlspecialchars( xl('Cancel'), ENT_QUOTES); ?>">
323 <?php }
326 <br>
327 </form></center></div>
328 <script language="javascript">
330 // jQuery stuff to make the page a little easier to use
332 $(document).ready(function(){
333 $("#newnote").click(function() { NewNote(); });
334 $("#printnote").click(function() { PrintNote(); });
335 obj = document.getElementById("form_message_status");
336 obj.onchange = function(){SaveNote();};
337 $("#cancel").click(function() { CancelNote(); });
338 $("#note").focus();
340 var NewNote = function () {
341 top.restoreSession();
342 if (document.forms[0].reply_to.value.length == 0 || document.forms[0].reply_to.value == '0') {
343 alert('<?php echo htmlspecialchars( xl('Please choose a patient'), ENT_QUOTES); ?>');
345 else if (document.forms[0].assigned_to.value.length == 0) {
346 alert('<?php echo addslashes(xl('Recipient List Is Empty')); ?>');
348 else
350 $("#new_note").submit();
354 var PrintNote = function () {
355 top.restoreSession();
356 window.open('../../patient_file/summary/pnotes_print.php?noteid=<?php echo htmlspecialchars( $noteid, ENT_QUOTES); ?>', '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
359 var SaveNote = function () {
360 <?php if ($noteid) { ?>
361 top.restoreSession();
362 $("#task").val("save");
363 $("#new_note").submit();
364 <?php } ?>
367 var CancelNote = function () {
368 top.restoreSession();
369 $("#task").val("");
370 $("#new_note").submit();
373 // This is for callback by the find-patient popup.
374 function setpatient(pid, lname, fname, dob) {
375 var f = document.forms[0];
376 f.form_patient.value = lname + ', ' + fname;
377 f.reply_to.value = pid;
378 <?php if ($noteid) { ?>
379 //used when direct messaging service inserts a pnote with indeterminate patient
380 //to allow the user to assign the message to a patient.
381 top.restoreSession();
382 $("#task").val("savePatient");
383 $("#new_note").submit();
384 <?php } ?>
387 // This invokes the find-patient popup.
388 function sel_patient() {
389 dlgopen('../../main/calendar/find_patient_popup.php', '_blank', 500, 400);
392 function addtolist(sel){
393 var itemtext = document.getElementById('assigned_to_text');
394 var item = document.getElementById('assigned_to');
395 if(sel.value != '--'){
396 if(item.value){
397 if(item.value.indexOf(sel.value) == -1){
398 itemtext.value = itemtext.value +' ; '+ sel.options[sel.selectedIndex].text;
399 item.value = item.value +';'+ sel.value;
401 }else{
402 itemtext.value = sel.options[sel.selectedIndex].text;
403 item.value = sel.value;
408 </script><?php
410 else {
412 // This is for sorting the records.
413 $sort = array("users.lname", "patient_data.lname", "pnotes.title", "pnotes.date", "pnotes.message_status");
414 $sortby = (isset($_REQUEST['sortby']) && ($_REQUEST['sortby']!="")) ? $_REQUEST['sortby'] : $sort[0];
415 $sortorder = (isset($_REQUEST['sortorder']) && ($_REQUEST['sortorder']!="")) ? $_REQUEST['sortorder'] : "asc";
416 $begin = isset($_REQUEST['begin']) ? $_REQUEST['begin'] : 0;
418 for($i = 0; $i < count($sort); $i++) {
419 $sortlink[$i] = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sort[$i])."&sortorder=asc&$activity_string_html\" onclick=\"top.restoreSession()\"><img src=\"../../../images/sortdown.gif\" border=0 alt=\"".htmlspecialchars( xl('Sort Up'), ENT_QUOTES)."\"></a>";
421 for($i = 0; $i < count($sort); $i++) {
422 if($sortby == $sort[$i]) {
423 switch($sortorder) {
424 case "asc" : $sortlink[$i] = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=desc&$activity_string_html\" onclick=\"top.restoreSession()\"><img src=\"../../../images/sortup.gif\" border=0 alt=\"".htmlspecialchars( xl('Sort Up'), ENT_QUOTES)."\"></a>"; break;
425 case "desc" : $sortlink[$i] = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=asc&$activity_string_html\" onclick=\"top.restoreSession()\"><img src=\"../../../images/sortdown.gif\" border=0 alt=\"".htmlspecialchars( xl('Sort Down'), ENT_QUOTES)."\"></a>"; break;
426 } break;
429 // Manage page numbering and display beneath the Messages table.
430 $listnumber = 25;
431 $total = getPnotesByUser($active,$show_all,$_SESSION['authUser'],true);
432 if($begin == "" or $begin == 0) {
433 $begin = 0;
435 $prev = $begin - $listnumber;
436 $next = $begin + $listnumber;
437 $start = $begin + 1;
438 $end = $listnumber + $start - 1;
439 if($end >= $total) {
440 $end = $total;
442 if($end < $start) {
443 $start = 0;
445 if($prev >= 0) {
446 $prevlink = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($prev)."&$activity_string_html\" onclick=\"top.restoreSession()\"><<</a>";
448 else {
449 $prevlink = "<<";
452 if($next < $total) {
453 $nextlink = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($next)."&$activity_string_html\" onclick=\"top.restoreSession()\">>></a>";
455 else {
456 $nextlink = ">>";
458 // Display the Messages table header.
459 echo "
460 <table width=100%><tr><td><table border=0 cellpadding=1 cellspacing=0 width=90% style=\"border-left: 1px #000000 solid; border-right: 1px #000000 solid; border-top: 1px #000000 solid;\">
461 <form name=MessageList action=\"messages.php?showall=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($begin)."&$activity_string_html\" method=post>
462 <input type=hidden name=task value=delete>
463 <tr height=\"24\" style=\"background:lightgrey\">
464 <td align=\"center\" width=\"25\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><input type=checkbox id=\"checkAll\" onclick=\"selectAll()\"></td>
465 <td width=\"20%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold>&nbsp;<b>" .
466 htmlspecialchars( xl('From'), ENT_NOQUOTES) . "</b> $sortlink[0]</td>
467 <td width=\"20%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold>&nbsp;<b>" .
468 htmlspecialchars( xl('Patient'), ENT_NOQUOTES) . "</b> $sortlink[1]</td>
469 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold>&nbsp;<b>" .
470 htmlspecialchars( xl('Type'), ENT_NOQUOTES) . "</b> $sortlink[2]</td>
471 <td width=\"15%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold>&nbsp;<b>" .
472 htmlspecialchars( xl('Date'), ENT_NOQUOTES) . "</b> $sortlink[3]</td>
473 <td width=\"15%\" style=\"border-bottom: 1px #000000 solid; \" class=bold>&nbsp;<b>" .
474 htmlspecialchars( xl('Status'), ENT_NOQUOTES) . "</b> $sortlink[4]</td>
475 </tr>";
476 // Display the Messages table body.
477 $count = 0;
478 $result = getPnotesByUser($active,$show_all,$_SESSION['authUser'],false,$sortby,$sortorder,$begin,$listnumber);
479 while ($myrow = sqlFetchArray($result)) {
480 $name = $myrow['user'];
481 $name = $myrow['users_lname'];
482 if ($myrow['users_fname']) {
483 $name .= ", " . $myrow['users_fname'];
485 $patient = $myrow['pid'];
486 if ($patient>0) {
487 $patient = $myrow['patient_data_lname'];
488 if ($myrow['patient_data_fname']) {
489 $patient .= ", " . $myrow['patient_data_fname'];
491 } else {
492 $patient = "* Patient must be set manually *";
494 $count++;
495 echo "
496 <tr id=\"row$count\" style=\"background:white\" height=\"24\">
497 <td align=\"center\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><input type=checkbox id=\"check$count\" name=\"delete_id[]\" value=\"" .
498 htmlspecialchars( $myrow['id'], ENT_QUOTES) . "\" onclick=\"if(this.checked==true){ selectRow('row$count'); }else{ deselectRow('row$count'); }\"></td>
499 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
500 htmlspecialchars( $name, ENT_NOQUOTES) . "</td><td width=5></td></tr></table></td>
501 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\"><a href=\"messages.php?showall=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($begin)."&task=edit&noteid=" .
502 htmlspecialchars( $myrow['id'], ENT_QUOTES) . "&$activity_string_html\" onclick=\"top.restoreSession()\">" .
503 htmlspecialchars( $patient, ENT_NOQUOTES) . "</a></td><td width=5></td></tr></table></td>
504 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
505 htmlspecialchars( $myrow['title'], ENT_NOQUOTES) . "</td><td width=5></td></tr></table></td>
506 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
507 htmlspecialchars( oeFormatShortDate(substr($myrow['date'], 0, strpos($myrow['date'], " "))), ENT_NOQUOTES) . "</td><td width=5></td></tr></table></td>
508 <td style=\"border-bottom: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
509 htmlspecialchars( $myrow['message_status'], ENT_NOQUOTES) . "</td><td width=5></td></tr></table></td>
510 </tr>";
512 // Display the Messages table footer.
513 echo "
514 </form></table>
515 <table border=0 cellpadding=5 cellspacing=0 width=90%>
516 <tr>
517 <td class=\"text\"><a href=\"messages.php?showall=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($begin)."&task=addnew&$activity_string_html\" onclick=\"top.restoreSession()\">" .
518 htmlspecialchars( xl('Add New'), ENT_NOQUOTES) . "</a> &nbsp; <a href=\"javascript:confirmDeleteSelected()\" onclick=\"top.restoreSession()\">" .
519 htmlspecialchars( xl('Delete'), ENT_NOQUOTES) . "</a></td>
520 <td align=right class=\"text\">$prevlink &nbsp; $end of $total &nbsp; $nextlink</td>
521 </tr>
522 </table></td></tr></table><br>";
524 <script language="javascript">
525 // This is to confirm delete action.
526 function confirmDeleteSelected() {
527 if(confirm("<?php echo htmlspecialchars( xl('Do you really want to delete the selection?'), ENT_QUOTES); ?>")) {
528 document.MessageList.submit();
531 // This is to allow selection of all items in Messages table for deletion.
532 function selectAll() {
533 if(document.getElementById("checkAll").checked==true) {
534 document.getElementById("checkAll").checked=true;<?php
535 for($i = 1; $i <= $count; $i++) {
536 echo "document.getElementById(\"check$i\").checked=true; document.getElementById(\"row$i\").style.background='#E7E7E7'; ";
537 } ?>
539 else {
540 document.getElementById("checkAll").checked=false;<?php
541 for($i = 1; $i <= $count; $i++) {
542 echo "document.getElementById(\"check$i\").checked=false; document.getElementById(\"row$i\").style.background='#F7F7F7'; ";
543 } ?>
546 // The two functions below are for managing row styles in Messages table.
547 function selectRow(row) {
548 document.getElementById(row).style.background = "#E7E7E7";
550 function deselectRow(row) {
551 document.getElementById(row).style.background = "#F7F7F7";
553 </script><?php
557 </body>
558 </html>