diff -ur eventum-20060328.orig/include/class.attachment.php eventum-20060328/include/class.attachment.php
--- eventum-20060328.orig/include/class.attachment.php	2006-03-28 21:59:24.000000000 +0300
+++ eventum-20060328/include/class.attachment.php	2006-03-28 22:07:37.000000000 +0300
@@ -403,7 +403,7 @@
             return "";
         } else {
             for ($i = 0; $i < count($res); $i++) {
-                $res[$i]["iat_description"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(Misc::activateLinks(htmlspecialchars($res[$i]["iat_description"]))));
+                $res[$i]["iat_description"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["iat_description"])));
                 $res[$i]["files"] = Attachment::getFileList($res[$i]["iat_id"]);
                 $res[$i]["iat_created_date"] = Date_API::getFormattedDate($res[$i]["iat_created_date"]);
 
diff -ur eventum-20060328.orig/include/class.draft.php eventum-20060328/include/class.draft.php
--- eventum-20060328.orig/include/class.draft.php	2006-03-28 21:59:24.000000000 +0300
+++ eventum-20060328/include/class.draft.php	2006-03-28 22:07:36.000000000 +0300
@@ -46,7 +46,7 @@
         $fp = @fopen($path . $filename, 'w');
         @fwrite($fp, $message);
         @fclose($fp);
-        @chmod($path . $filename, 0777);
+        @chmod($path . $filename, 0750);
     }
 
 
diff -ur eventum-20060328.orig/include/class.mail.php eventum-20060328/include/class.mail.php
--- eventum-20060328.orig/include/class.mail.php	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/include/class.mail.php	2006-03-28 22:07:37.000000000 +0300
@@ -786,10 +786,10 @@
     function getReferenceMessageID($text_headers)
     {
         $references = array();
-        if (preg_match('/^In-Reply-To: (.*)/m', $text_headers, $matches)) {
+        if (preg_match('/^In-Reply-To: (.*)/mi', $text_headers, $matches)) {
             return trim($matches[1]);
         }
-        if (preg_match('/^References: (.+?)(\r?\n\r?\n|\r?\n\r?\S)/sm', $text_headers, $matches)) {
+        if (preg_match('/^References: (.+?)(\r?\n\r?\n|\r?\n\r?\S)/smi', $text_headers, $matches)) {
             $references = explode(" ", Mail_API::unfold(trim($matches[1])));
             $references = array_map('trim', $references);
             // return the first message-id in the list of references
@@ -809,10 +809,10 @@
     function getAllReferences($text_headers)
     {
         $references = array();
-        if (preg_match('/^In-Reply-To: (.*)/m', $text_headers, $matches)) {
+        if (preg_match('/^In-Reply-To: (.*)/mi', $text_headers, $matches)) {
             $references[] = trim($matches[1]);
         }
-        if (preg_match('/^References: (.+?)(\r?\n\r?\n|\r?\n\r?\S)/sm', $text_headers, $matches)) {
+        if (preg_match('/^References: (.+?)(\r?\n\r?\n|\r?\n\r?\S)/smi', $text_headers, $matches)) {
             $references = array_merge($references, explode(" ", Mail_API::unfold(trim($matches[1]))));
             $references = array_map('trim', $references);
             $references = array_unique($references);
@@ -863,20 +863,20 @@
             $headers['message-id'] = $msg_id;
         }
 
-        if (preg_match('/^In-Reply-To: (.*)/m', $text_headers) > 0) {
+        if (preg_match('/^In-Reply-To: (.*)/mi', $text_headers) > 0) {
             // replace existing header
-            $text_headers = preg_replace('/^In-Reply-To: (.*)/m', 'In-Reply-To: ' . $reference_msg_id, $text_headers, 1);
+            $text_headers = preg_replace('/^In-Reply-To: (.*)/mi', 'In-Reply-To: ' . $reference_msg_id, $text_headers, 1);
         } else {
             // add new header after message ID
-            $text_headers = preg_replace('/^Message-ID: (.*)$/m', "Message-ID: $1\r\nIn-Reply-To: $reference_msg_id", $text_headers, 1);
+            $text_headers = preg_replace('/^Message-ID: (.*)$/mi', "Message-ID: $1\r\nIn-Reply-To: $reference_msg_id", $text_headers, 1);
         }
         $headers['in-reply-to'] = $reference_msg_id;
-        if (preg_match('/^References: (.*)/m', $text_headers) > 0) {
+        if (preg_match('/^References: (.*)/mi', $text_headers) > 0) {
             // replace existing header
-            $text_headers = preg_replace('/^References: (.*)/m', 'References: ' . Mail_API::fold(join(' ', $references)), $text_headers, 1);
+            $text_headers = preg_replace('/^References: (.*)/mi', 'References: ' . Mail_API::fold(join(' ', $references)), $text_headers, 1);
         } else {
             // add new header after In-Reply-To
-            $text_headers = preg_replace('/^In-Reply-To: (.*)$/m', "In-Reply-To: $1\r\nReferences: " . Mail_API::fold(join(' ', $references)), $text_headers, 1);
+            $text_headers = preg_replace('/^In-Reply-To: (.*)$/mi', "In-Reply-To: $1\r\nReferences: " . Mail_API::fold(join(' ', $references)), $text_headers, 1);
         }
         $headers['references'] = Mail_API::fold(join(' ', $references));
         return array($text_headers . "\r\n\r\n" . $body, $headers);
@@ -976,11 +976,10 @@
     function getMessageID($headers, $body)
     {
         // try to parse out actual message-id header
-        if (preg_match('/^Message-ID: (.*)/m', $headers, $matches)) {
+        if (preg_match('/^Message-ID: (.*)/mi', $headers, $matches)) {
             return trim($matches[1]);
         } else {
             // no match, calculate hash to make fake message ID
-            $md5 = md5($headers.$body);
             $first = base_convert(md5($headers), 10, 36);
             $second = base_convert(md5($body), 10, 36);
             return "<eventum.md5." . $first . "." . $second . "@" . APP_HOSTNAME . ">";
diff -ur eventum-20060328.orig/include/class.mail_queue.php eventum-20060328/include/class.mail_queue.php
--- eventum-20060328.orig/include/class.mail_queue.php	2006-03-28 21:59:24.000000000 +0300
+++ eventum-20060328/include/class.mail_queue.php	2006-03-28 22:07:36.000000000 +0300
@@ -381,6 +381,7 @@
             for ($i = 0; $i < count($res); $i++) {
                 $res[$i]['maq_recipient'] = Mime_Helper::decodeAddress($res[$i]['maq_recipient']);
                 $res[$i]['maq_queued_date'] = Date_API::getFormattedDate(Date_API::getUnixTimestamp($res[$i]['maq_queued_date'], 'GMT'));
+                $res[$i]['maq_subject'] = Mime_Helper::fixEncoding($res[$i]['maq_subject']);
             }
         }
         return $res;
diff -ur eventum-20060328.orig/include/class.mime_helper.php eventum-20060328/include/class.mime_helper.php
--- eventum-20060328.orig/include/class.mime_helper.php	2006-03-28 21:59:24.000000000 +0300
+++ eventum-20060328/include/class.mime_helper.php	2006-03-28 22:07:37.000000000 +0300
@@ -100,9 +100,6 @@
             $str = str_replace("</DIV><DIV>", "\n", $str);
             $str = str_replace(array("<br>", "<br />", "<BR>", "<BR />"), "\n", $str);
         }
-        if (@$output->headers['content-transfer-encoding'] == 'quoted-printable') {
-            $str = Mime_Helper::decodeBody($str, 'quoted-printable');
-        }
         // XXX: do we also need to do something here about base64 encoding?
         if ($is_html) {
             $str = strip_tags($str);
@@ -660,35 +657,6 @@
 
 
     /**
-     * Method used to decode the body of a MIME encoded message.
-     *
-     * @access  public
-     * @param   string $input The full body of the message
-     * @param   string $encoding The encoding used in the message
-     * @return  string The decoded message body
-     */
-    function decodeBody($input, $encoding = '7bit')
-    {
-        switch ($encoding) {
-            case '7bit':
-                return $input;
-                break;
-
-            case 'quoted-printable':
-                return Mime_Helper::_quotedPrintableDecode($input);
-                break;
-
-            case 'base64':
-                return base64_decode($input);
-                break;
-
-            default:
-                return $input;
-        }
-    }
-
-
-    /**
      * Given a quoted-printable string, this
      * function will decode and return it.
      *
diff -ur eventum-20060328.orig/include/class.misc.php eventum-20060328/include/class.misc.php
--- eventum-20060328.orig/include/class.misc.php	2006-03-28 21:59:24.000000000 +0300
+++ eventum-20060328/include/class.misc.php	2006-03-28 22:07:37.000000000 +0300
@@ -502,10 +502,15 @@
      * @param   string $class The CSS class to use on the actual links
      * @return  string The parsed string
      */
-    function activateLinks($text, $class = "link")
+    function activateLinks($text, $class = 'link')
     {
-        $text = preg_replace("'(\w+)://([\w\+\-\@\=\?\.\%\/\:\&\;~\|]+)(\.)?'", "<a title=\"open \\1://\\2 in a new window\" class=\"$class\" href=\"\\1://\\2\" target=\"_\\2\">\\1://\\2</a>", $text);
-        $text = preg_replace("'(\s+)www\.([\w\+\-\@\=\?\.\%\/\:\&\;~\|]+)(\.\s|\s)'", "\\1<a title=\"open http://www.\\2 in a new window\" class=\"$class\" href=\"http://www.\\2\" target=\"_\\2\">www.\\2</a>\\3" , $text);
+        $range = '[-\w+@=?.%/:&;~|,#]+';
+        $text = preg_replace("'(\w+)://($range)(\.)?'", '<a title="open $1://$2 in a new window" class="' . $class . '" href="$1://$2" target="_$2">$1://$2</a>', $text);
+        $text = preg_replace("'(\s+)(www\.$range)(\.\s|\s)'", '$1<a title="open http://$2 in a new window" class="' . $class . '" href="http://$2" target="_$2">$2</a>$3' , $text);
+
+        $mail_pat = '/([-+a-z0-9_.]+@(?:[-a-z0-9_.]{2,63}\.)+[a-z]{2,6})/i';
+        $text = preg_replace($mail_pat, '<a title="open mailto:$1 in a new window" class="' . $class . '" href="mailto:$1" target="_$1">$1</a>' , $text);
+
         return $text;
     }
 
@@ -575,7 +580,7 @@
         if (!is_writable($file)) {
             if (!stristr(PHP_OS, "win")) {
                 // let's try to change the permissions ourselves
-                @chmod($file, 0777);
+                @chmod($file, 0750);
                 clearstatcache();
                 if (!is_writable($file)) {
                     return false;
diff -ur eventum-20060328.orig/include/class.note.php eventum-20060328/include/class.note.php
--- eventum-20060328.orig/include/class.note.php	2006-03-28 21:59:24.000000000 +0300
+++ eventum-20060328/include/class.note.php	2006-03-28 22:07:36.000000000 +0300
@@ -261,7 +261,7 @@
         $fp = @fopen($path . $filename, 'w');
         @fwrite($fp, $message);
         @fclose($fp);
-        @chmod($path . $filename, 0777);
+        @chmod($path . $filename, 0750);
     }
 
 
diff -ur eventum-20060328.orig/include/class.support.php eventum-20060328/include/class.support.php
--- eventum-20060328.orig/include/class.support.php	2006-03-28 21:59:24.000000000 +0300
+++ eventum-20060328/include/class.support.php	2006-03-28 22:07:37.000000000 +0300
@@ -264,7 +264,6 @@
         $fp = @fopen($path . $filename, 'w');
         @fwrite($fp, $message);
         @fclose($fp);
-        @chmod($path . $filename, 0777);
         return $filename;
     }
 
@@ -568,7 +567,6 @@
                         return $return;
                     }
                 }
-                return false;
             }
 
             $sender_email = Mail_API::getEmailAddress($email->fromaddress);
diff -ur eventum-20060328.orig/include/jpgraph/jpgraph.php eventum-20060328/include/jpgraph/jpgraph.php
--- eventum-20060328.orig/include/jpgraph/jpgraph.php	2006-03-28 21:59:24.000000000 +0300
+++ eventum-20060328/include/jpgraph/jpgraph.php	2006-03-28 22:07:36.000000000 +0300
@@ -4086,7 +4086,7 @@
 	    $aFile = dirname($aFile);
 	}
 	for ($i = sizeof($dirs)-1; $i>=0; $i--) {
-	    if(! @mkdir($dirs[$i],0777) )
+	    if(! @mkdir($dirs[$i],0750) )
 		JpGraphError::Raise("<b>JpGraph Error:</b> Can't create directory in $aFile. Permission problems?");
 				
 	    // We also specify mode here after we have changed group. 
@@ -4096,7 +4096,7 @@
 	    if( CACHE_FILE_GROUP != "" ) {
 		$res=true;
 		$res =@chgrp($dirs[$i],CACHE_FILE_GROUP);
-		$res &= @chmod($dirs[$i],0777);
+		$res &= @chmod($dirs[$i],0750);
 		if( !$res )
 		    JpGraphError::Raise("<b>JpGraph Error:</b> Can't set permissions for $aFile. Permission problems?");
 	    }
diff -ur eventum-20060328.orig/misc/cli/eventum eventum-20060328/misc/cli/eventum
--- eventum-20060328.orig/misc/cli/eventum	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/misc/cli/eventum	2006-03-28 22:07:36.000000000 +0300
@@ -218,15 +218,19 @@
         }
         Command_Line::lookupCustomer(&$client, $auth, $HTTP_SERVER_VARS['argv'][2], $HTTP_SERVER_VARS['argv'][3]);
     } elseif (($HTTP_SERVER_VARS['argv'][1] == 'weekly-report') || ($HTTP_SERVER_VARS['argv'][1] == 'wr')) {
-        if (count(@$HTTP_SERVER_VARS['argv']) == 4) {
+        if (count(@$HTTP_SERVER_VARS['argv']) >= 4 and $HTTP_SERVER_VARS['argv'][3] != '--separate-closed') {
+            $separate_closed = (@$HTTP_SERVER_VARS['argv'][4] == '--separate-closed');
             // date range
-            Command_Line::getWeeklyReport(&$client, $auth, 0, $HTTP_SERVER_VARS['argv'][2], $HTTP_SERVER_VARS['argv'][3]);
+            Command_Line::getWeeklyReport(&$client, $auth, 0, $HTTP_SERVER_VARS['argv'][2], $HTTP_SERVER_VARS['argv'][3], $separate_closed);
         } else {
             // weekly
             if (@$HTTP_SERVER_VARS['argv'][2] == '') {
+                $separate_closed = false;
                 @$HTTP_SERVER_VARS['argv'][2] = 0;
+            } else {
+                $separate_closed = (@$HTTP_SERVER_VARS['argv'][3] == '--separate-closed' or @$HTTP_SERVER_VARS['argv'][2] == '--separate-closed');
             }
-            Command_Line::getWeeklyReport(&$client, $auth, $HTTP_SERVER_VARS['argv'][2]);
+            Command_Line::getWeeklyReport(&$client, $auth, $HTTP_SERVER_VARS['argv'][2], '', '', $separate_closed);
         }
     } elseif ($HTTP_SERVER_VARS['argv'][1] == 'clock') {
         Command_Line::timeClock(&$client, $auth, @$HTTP_SERVER_VARS['argv'][2]);
diff -ur eventum-20060328.orig/misc/cli/include/class.command_line.php eventum-20060328/misc/cli/include/class.command_line.php
--- eventum-20060328.orig/misc/cli/include/class.command_line.php	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/misc/cli/include/class.command_line.php	2006-03-28 22:07:36.000000000 +0300
@@ -1144,15 +1144,17 @@
      * @param   integer $week The week for the report. If start and end date are set, this is ignored.
      * @param   string $start_date The start date of the report. (optional)
      * @param   string $end_date The end_date of the report. (optional)
+     * @param   boolean If closed issues should be separated from other issues. 
      */
-    function getWeeklyReport($rpc_conn, $auth, $week, $start_date = '', $end_date = '')
+    function getWeeklyReport($rpc_conn, $auth, $week, $start_date = '', $end_date = '', $separate_closed = false)
     {
         $msg = new XML_RPC_Message("getWeeklyReport", array(
             new XML_RPC_Value($auth[0], 'string'), 
             new XML_RPC_Value($auth[1], 'string'),
             new XML_RPC_Value($week, "int"), 
             new XML_RPC_Value($start_date, "string"), 
-            new XML_RPC_Value($end_date, "string")
+            new XML_RPC_Value($end_date, "string"),
+            new XML_RPC_Value($separate_closed ? 1 : 0, 'int'), 
         ));
         $result = $rpc_conn->send($msg);
         if ($result->faultCode()) {
@@ -1687,7 +1689,7 @@
             "help"      =>  "Looks up a customer's record information."
         );
         $usage[] = array(
-            "command"   =>  array("weekly-report ([<week>])|([<start>] [<end>])", "wr ([<week>])|([<start>] [<end>])"),
+            "command"   =>  array("weekly-report ([<week>] [--separate-closed])|([<start>] [<end>] [--separate-closed])", "wr ([<week>])|([<start>] [<end>] [--separate-closed])"),
             "help"      =>  "Fetches the weekly report. Week is specified as an integer with 0 representing
      the current week, -1 the previous week and so on. If the week is omitted it defaults 
      to the current week. Alternately, a date range can be set. Dates should be in the format 'YYYY-MM-DD'."
diff -ur eventum-20060328.orig/misc/route_drafts.php eventum-20060328/misc/route_drafts.php
--- eventum-20060328.orig/misc/route_drafts.php	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/misc/route_drafts.php	2006-03-28 22:07:37.000000000 +0300
@@ -27,6 +27,7 @@
 //
 // @(#) $Id$
 //
+ini_set('memory_limit', '16M');
 include_once("../config.inc.php");
 include_once(APP_INC_PATH . "db_access.php");
 include_once(APP_INC_PATH . "class.routing.php");
diff -ur eventum-20060328.orig/misc/route_emails.php eventum-20060328/misc/route_emails.php
--- eventum-20060328.orig/misc/route_emails.php	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/misc/route_emails.php	2006-03-28 22:07:37.000000000 +0300
@@ -27,6 +27,7 @@
 //
 // @(#) $Id: s.route_emails.php 1.23 04/01/26 20:37:04-06:00 joao@kickass. $
 //
+ini_set('memory_limit', '16M');
 include_once("../config.inc.php");
 include_once(APP_INC_PATH . "db_access.php");
 include_once(APP_INC_PATH . "class.routing.php");
diff -ur eventum-20060328.orig/misc/route_notes.php eventum-20060328/misc/route_notes.php
--- eventum-20060328.orig/misc/route_notes.php	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/misc/route_notes.php	2006-03-28 22:07:37.000000000 +0300
@@ -27,6 +27,7 @@
 //
 // @(#) $Id: s.route_notes.php 1.5 04/01/26 20:37:04-06:00 joao@kickass. $
 //
+ini_set('memory_limit', '16M');
 include_once("../config.inc.php");
 include_once(APP_INC_PATH . "db_access.php");
 include_once(APP_INC_PATH . "class.routing.php");
diff -ur eventum-20060328.orig/misc/scm/process_cvs_commits.php eventum-20060328/misc/scm/process_cvs_commits.php
--- eventum-20060328.orig/misc/scm/process_cvs_commits.php	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/misc/scm/process_cvs_commits.php	2006-03-28 22:07:37.000000000 +0300
@@ -68,23 +68,25 @@
 $commit_msg = substr($input, strpos($input, 'Log Message:')+strlen('Log Message:')+1);
 
 // parse the commit message and get the first issue number we can find
-$pattern = "/(?:issue|bug) ?:? ?#?(\d+)/i";
-preg_match($pattern, $commit_msg, $matches);
+$pattern = "/(?:issue|bug|close[ds]?|fix(?:e[ds])?) ?:? ?#?(\d+)/i";
+preg_match_all($pattern, $commit_msg, $matches);
 
 if (count($matches) > 1) {
     // need to encode all of the url arguments
-    $issue_id = base64_encode($matches[1]);
-    $commit_msg = base64_encode($commit_msg);
-    $cvs_module = base64_encode($cvs_module);
-    $username = base64_encode($username);
+    $commit_msg = rawurlencode($commit_msg);
+    $cvs_module = rawurlencode($cvs_module);
+    $username = rawurlencode($username);
 
     // build the GET url to use
     $ping_url = $eventum_relative_url . "scm_ping.php?module=$cvs_module&username=$username&commit_msg=$commit_msg";
-    $ping_url .= "&issue[]=$issue_id";
+    foreach ($matches[1] as $issue_id) {
+        $ping_url .= "&issue[]=$issue_id";
+    }
+
     for ($i = 0; $i < count($modified_files); $i++) {
-        $ping_url .= "&files[$i]=" . base64_encode($modified_files[$i]['filename']);
-        $ping_url .= "&old_versions[$i]=" . base64_encode($modified_files[$i]['old_revision']);
-        $ping_url .= "&new_versions[$i]=" . base64_encode($modified_files[$i]['new_revision']);
+        $ping_url .= "&files[$i]=" . rawurlencode($modified_files[$i]['filename']);
+        $ping_url .= "&old_versions[$i]=" . rawurlencode($modified_files[$i]['old_revision']);
+        $ping_url .= "&new_versions[$i]=" . rawurlencode($modified_files[$i]['new_revision']);
     }
 
     $fp = fsockopen($eventum_domain, $eventum_port, $errno, $errstr, 30);
@@ -96,6 +98,11 @@
         $msg .= "Host: $eventum_domain\r\n";
         $msg .= "Connection: Close\r\n\r\n";
         fwrite($fp, $msg);
+        $buf = fgets($fp, 4096);
+        list($proto, $status, $msg) = explode(' ', trim($buf));
+        if ($status != '200') {
+            echo "Error: Could not ping the Eventum SCM handler script: HTTP status code: $status $msg\n";
+        }
         fclose($fp);
     }
 }
diff -ur eventum-20060328.orig/rpc/xmlrpc.php eventum-20060328/rpc/xmlrpc.php
--- eventum-20060328.orig/rpc/xmlrpc.php	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/rpc/xmlrpc.php	2006-03-28 22:07:36.000000000 +0300
@@ -653,7 +653,7 @@
     }
 }
 
-$getWeeklyReport_sig = array(array($XML_RPC_String, $XML_RPC_String, $XML_RPC_String, $XML_RPC_Int, $XML_RPC_String, $XML_RPC_String));
+$getWeeklyReport_sig = array(array($XML_RPC_String, $XML_RPC_String, $XML_RPC_String, $XML_RPC_Int, $XML_RPC_String, $XML_RPC_String, $XML_RPC_Int));
 function getWeeklyReport($p)
 {
     $email = XML_RPC_decode($p->getParam(0));
@@ -665,6 +665,7 @@
     $week = abs(XML_RPC_decode($p->getParam(2)));
     $start = XML_RPC_decode($p->getParam(3));
     $end = XML_RPC_decode($p->getParam(4));
+    $separate_closed = XML_RPC_decode($p->getParam(5));
     
     // we have to set a project so the template class works, even though the weekly report doesn't actually need it
     $projects = Project::getAssocList(Auth::getUserID());
@@ -680,9 +681,14 @@
         $start = date("Y-m-d", $start);
     }
     
+    if ($separate_closed) {
+        // emulate smarty value for reports/weekly_data.tpl.tmpl:
+        // {if $smarty.post.separate_closed == 1}
+        $_POST['separate_closed'] = true;
+    }
     $tpl = new Template_API();
     $tpl->setTemplate("reports/weekly_data.tpl.html");
-    $tpl->assign("data", Report::getWeeklyReport(User::getUserIDByEmail($email), $start, $end));
+    $tpl->assign("data", Report::getWeeklyReport(User::getUserIDByEmail($email), $start, $end, $separate_closed));
     
     $ret = $tpl->getTemplateContents(). "\n";
     return new XML_RPC_Response(XML_RPC_Encode(base64_encode($ret)));
diff -ur eventum-20060328.orig/scm_ping.php eventum-20060328/scm_ping.php
--- eventum-20060328.orig/scm_ping.php	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/scm_ping.php	2006-03-28 22:07:37.000000000 +0300
@@ -33,8 +33,6 @@
 include_once(APP_INC_PATH . "class.workflow.php");
 include_once(APP_INC_PATH . "db_access.php");
 
-$HTTP_GET_VARS = Misc::array_map_deep($HTTP_GET_VARS, 'base64_decode');
-
 foreach ($HTTP_GET_VARS['issue'] as $issue_id) {
     $files = array();
     for ($y = 0; $y < count($HTTP_GET_VARS['files']); $y++) {
diff -ur eventum-20060328.orig/send.php eventum-20060328/send.php
--- eventum-20060328.orig/send.php	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/send.php	2006-03-28 22:07:36.000000000 +0300
@@ -134,6 +134,11 @@
             "email"           => $email,
             "parent_email_id" => $HTTP_GET_VARS["id"]
         ));
+    } else {
+        $email["reply_subject"] = "[#" . @$HTTP_GET_VARS['issue_id'] . "] ";
+        $tpl->bulkAssign(array(
+            "email"           => $email,
+        ));
     }
 }
 
diff -ur eventum-20060328.orig/setup/index.php eventum-20060328/setup/index.php
--- eventum-20060328.orig/setup/index.php	2006-03-28 21:59:23.000000000 +0300
+++ eventum-20060328/setup/index.php	2006-03-28 22:07:36.000000000 +0300
@@ -68,7 +68,7 @@
     if (!is_writable($file)) {
         if (!stristr(PHP_OS, "win")) {
             // let's try to change the permissions ourselves
-            @chmod($file, 0777);
+            @chmod($file, 0750);
             clearstatcache();
             if (!is_writable($file)) {
                 return "$desc is not writable";
diff -ur eventum-20060328.orig/templates/en/add_phone_entry.tpl.html eventum-20060328/templates/en/add_phone_entry.tpl.html
--- eventum-20060328.orig/templates/en/add_phone_entry.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/add_phone_entry.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -65,10 +65,10 @@
           <td>
             <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2">
               {if $current_role > $roles.customer}
-              <tr id="phone_support2" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td colspan="2" class="default"><b>Record Phone Call:</b></td>
               </tr>
-              <tr id="phone_support3" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Date of Call:</b></td>
                 <td bgcolor="{$light_color}" width="100%">
                   {html_select_date start_year='-1' day_value_format='%02d' field_array='date' prefix='' all_extra=' class="default"'}&nbsp;
@@ -76,7 +76,7 @@
                   <a href="javascript:void(null);" onClick="javascript:updateTimeFields('add_phone_form', 'date[Year]', 'date[Month]', 'date[Day]', 'date[Hour]', 'date[Minute]');"><img src="images/icons/refresh.gif" border="0"></a>
                 </td>
               </tr>
-              <tr id="phone_support4" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Reason:</b></td>
                 <td bgcolor="{$light_color}" width="100%">
                   <select name="phone_category" class="default">
@@ -85,21 +85,21 @@
                   {include file="error_icon.tpl.html" field="phone_category"}
                 </td>
               </tr>
-              <tr id="phone_support5" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Call From:</b></td>
                 <td bgcolor="{$light_color}" width="100%">
                   <input type="text" class="default" name="from_lname" value="last name" onFocus="javascript:if (this.value == 'last name') this.value='';"><span class="default">,</span>
                   <input type="text" class="default" name="from_fname" value="first name" onFocus="javascript:if (this.value == 'first name') this.value='';">
                 </td>
               </tr>
-              <tr id="phone_support6" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Call To:</b></td>
                 <td bgcolor="{$light_color}" width="100%">
                   <input type="text" class="default" name="to_lname" value="last name" onFocus="javascript:if (this.value == 'last name') this.value='';"><span class="default">,</span>
                   <input type="text" class="default" name="to_fname" value="first name" onFocus="javascript:if (this.value == 'first name') this.value='';">
                 </td>
               </tr>
-              <tr id="phone_support7" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Type:</b></td>
                 <td bgcolor="{$light_color}" width="100%">
                   <select class="default" name="type">
@@ -108,7 +108,7 @@
                   </select>
                 </td>
               </tr>
-              <tr id="phone_support8" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Customer Phone Number:</b></td>
                 <td bgcolor="{$light_color}" width="100%">
                   <input type="text" size="20" maxlength="32" name="phone_number" class="default">
@@ -122,18 +122,18 @@
                   </select>
                 </td>
               </tr>
-              <tr id="phone_support9" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Time Spent:</b></td>
                 <td bgcolor="{$light_color}" width="100%"><input type="text" size="5" name="call_length" class="default"> {include file="error_icon.tpl.html" field="call_length"} <span class="small_default"><i>(in minutes)</i></span></td>
               </tr>
-              <tr id="phone_support10" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Description:</b></td>
                 <td bgcolor="{$light_color}">
                   <textarea name="description" rows="8" style="width: 97%"></textarea>
                   {include file="error_icon.tpl.html" field="description"}
                 </td>
               </tr>
-              <tr id="phone_support11" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td colspan="2" bgcolor="{$internal_color}" align="center">
                   <input type="submit" value="Save Phone Call" class="button">
                 </td>
diff -ur eventum-20060328.orig/templates/en/add_time_tracking.tpl.html eventum-20060328/templates/en/add_time_tracking.tpl.html
--- eventum-20060328.orig/templates/en/add_time_tracking.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/add_time_tracking.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -65,14 +65,14 @@
           <td width="100%">
             <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2">
               {if $current_role > $roles.viewer}
-              <tr id="time_tracker2" {get_display_style element_name="time_tracker"}>
+              <tr>
                 <td colspan="2" class="default"><b>Record Time Worked:</b></td>
               </tr>
-              <tr id="time_tracker3" {get_display_style element_name="time_tracker"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Summary:</b></td>
                 <td bgcolor="{$light_color}" width="100%"><input class="default" type="text" name="summary" size="40">{include file="error_icon.tpl.html" field="summary"}</td>
               </tr>
-              <tr id="time_tracker4" {get_display_style element_name="time_tracker"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Category:</b></td>
                 <td bgcolor="{$light_color}" width="100%">
                   <select name="category" class="default">
@@ -82,11 +82,11 @@
                   {include file="error_icon.tpl.html" field="category"}
                 </td>
               </tr>
-              <tr id="time_tracker5" {get_display_style element_name="time_tracker"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Time Spent:</b></td>
                 <td bgcolor="{$light_color}" width="100%"><input class="default" type="text" size="5" name="time_spent" class="default"> <span class="default">(in minutes)</span>{include file="error_icon.tpl.html" field="time_spent"}</td>
               </tr>
-              <tr id="time_tracker6" {get_display_style element_name="time_tracker"}>
+              <tr>
                 <td bgcolor="{$internal_color}" class="default_white" width="190" nowrap><b>Date of Work:</b></td>
                 <td bgcolor="{$light_color}" width="100%">
                   {html_select_date start_year='-1' day_value_format='%02d' field_array='date' prefix='' all_extra=' class="default"'}&nbsp;
@@ -94,7 +94,7 @@
                   <a href="javascript:void(null);" onClick="javascript:updateTimeFields('add_time_form', 'date[Year]', 'date[Month]', 'date[Day]', 'date[Hour]', 'date[Minute]');"><img src="images/icons/refresh.gif" border="0"></a>
                 </td>
               </tr>
-              <tr id="time_tracker7" {get_display_style element_name="time_tracker"}>
+              <tr>
                 <td colspan="2" bgcolor="{$internal_color}" align="center" width="100%" nowrap>
                   <input type="submit" value="Add Time Entry" class="button">
                 </td>
diff -ur eventum-20060328.orig/templates/en/attachments.tpl.html eventum-20060328/templates/en/attachments.tpl.html
--- eventum-20060328.orig/templates/en/attachments.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/attachments.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -46,10 +46,10 @@
             {/if}
           </td>
         </tr>
-        <tr id="attachments1" {get_display_style element_name="attachments"}>
+        <tr>
           <td colspan="2">
             <table width="100%" cellpadding="2" cellspacing="1">
-              <tr>
+              <tr id="attachments1" {get_display_style element_name="attachments"}>
                 <td class="default_white" bgcolor="{$cell_color}">Files</td>
                 <td class="default_white" bgcolor="{$cell_color}">Owner</td>
                 {if $current_role > $roles.customer}
@@ -60,7 +60,7 @@
               </tr>
               {section name="i" loop=$files}
               {cycle values=$cycle assign="row_color"}
-              <tr bgcolor="{$row_color}">
+              <tr id="attachments{$smarty.section.i.iteration+1}" {get_display_style element_name="attachments"} bgcolor="{$row_color}">
                 <td class="default">
                   {section name="y" loop=$files[i].files}
                   <a title="download file ({$files[i].files[y].iaf_filename|escape:"html"} - {$files[i].files[y].iaf_filesize})" href="download.php?cat=attachment&id={$files[i].files[y].iaf_id}"><img width="17" height="17" src="{$rel_url}images/file.gif" border="0"></a>
@@ -86,7 +86,7 @@
                 <td class="default" width="45%">{$files[i].iat_description}</td>
               </tr>
               {sectionelse}
-              <tr>
+              <tr id="attachments2" {get_display_style element_name="attachments"}>
                 <td colspan="{if $current_role > $roles.customer}5{else}4{/if}" bgcolor="{$light_color}" align="center" class="default">
                   <i>No attachments could be found.</i>
                 </td>
diff -ur eventum-20060328.orig/templates/en/custom_fields.tpl.html eventum-20060328/templates/en/custom_fields.tpl.html
--- eventum-20060328.orig/templates/en/custom_fields.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/custom_fields.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -27,12 +27,12 @@
             {/if}
           </td>
         </tr>
-        <tr id="custom_fields1" {get_display_style element_name="custom_fields" total=$custom_fields|@count}>
+        <tr>
           <td colspan="2">
             <table width="100%" cellpadding="2" cellspacing="1">
               {section name="i" loop=$custom_fields}
               {cycle values=$cycle assign="row_color"}
-              <tr {if $custom_fields[i].hide_when_no_options == 1 && $custom_fields[i].icf_value == ''}style="display: none"{/if}>
+              <tr id="custom_fields{$smarty.section.i.iteration}" {get_display_style element_name="custom_fields" total=$custom_fields|@count} {if $custom_fields[i].hide_when_no_options == 1 && $custom_fields[i].icf_value == ''}style="display: none"{/if}>
                 <td bgcolor="{if $custom_fields[i].fld_min_role > $roles.customer}{$internal_color}{else}{$cell_color}{/if}" class="default_white">
                   <nobr><b>{$custom_fields[i].fld_title}:</b>&nbsp;</nobr>
                 </td>
@@ -45,14 +45,14 @@
                 </td>
               </tr>
               {sectionelse}
-              <tr>
+              <tr id="custom_fields1" {get_display_style element_name="custom_fields" total=$custom_fields|@count}>
                 <td colspan="2" bgcolor="{$light_color}" align="center" class="default">
                   <i>No custom fields could be found.</i>
                 </td>
               </tr>
               {/section}
               {if $current_role > $roles.reporter and $custom_fields != ""}
-              <tr id="custom_fields2" {get_display_style element_name="custom_fields"}>
+              <tr>
                 <td align="center" colspan="2" bgcolor="{$cell_color}">
                   <input class="button" type="button" value="Update" onClick="javascript:updateCustomFields({$smarty.get.id});">
                 </td>
diff -ur eventum-20060328.orig/templates/en/email_drafts.tpl.html eventum-20060328/templates/en/email_drafts.tpl.html
--- eventum-20060328.orig/templates/en/email_drafts.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/email_drafts.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -49,10 +49,10 @@
             {/if}
           </td>
         </tr>
-        <tr id="drafts1" {get_display_style element_name="drafts" total=$drafts|@count}>
+        <tr>
           <td colspan="2">
             <table width="100%" cellpadding="2" cellspacing="1">
-              <tr bgcolor="{$internal_color}">
+              <tr id="drafts1" {get_display_style element_name="drafts" total=$drafts|@count} bgcolor="{$internal_color}">
                 <td class="default_white" NOWRAP>{include file="expandable_cell/buttons.tpl.html" remote_func="getDraft" ec_id="draft"}</td>
                 <td width="5" class="default_white" align="center">#</td>
                 {if $smarty.request.show_all_drafts == 1}
@@ -65,7 +65,7 @@
               </tr>
               {section name="i" loop=$drafts}
               {cycle values=$cycle assign="row_color"}
-              <tr {if $drafts[i].emd_status != 'pending'}style="text-decoration: line-through;"{/if}>
+              <tr id="drafts{$smarty.section.i.iteration+1}" {get_display_style element_name="drafts" total=$drafts|@count} {if $drafts[i].emd_status != 'pending'}style="text-decoration: line-through;"{/if}>
                 <td class="default" NOWRAP bgcolor="{$row_color}">{include file="expandable_cell/buttons.tpl.html" ec_id="draft" list_id=$drafts[i].emd_id}</td>
                 <td width="5" class="default" bgcolor="{$row_color}" align="center">{$smarty.section.i.iteration}</td>
                 {if $smarty.request.show_all_drafts == 1}
@@ -80,7 +80,7 @@
               </tr>
               {include file="expandable_cell/body.tpl.html" ec_id="draft" list_id=$drafts[i].emd_id colspan=$draft_col_count}
               {sectionelse}
-              <tr>
+              <tr id="drafts2" {get_display_style element_name="drafts" total=$drafts|@count}>
                 <td colspan="{$draft_col_count}" bgcolor="{$light_color}" class="default" align="center">
                   <i>No email drafts could be found.</i>
                 </td>
diff -ur eventum-20060328.orig/templates/en/file_upload.tpl.html eventum-20060328/templates/en/file_upload.tpl.html
--- eventum-20060328.orig/templates/en/file_upload.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/file_upload.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -15,7 +15,7 @@
     </center>
     <script language="JavaScript">
     <!--
-    {if $current_user_prefs.close_popup_windows == '1'}
+    {if $current_user_prefs.close_popup_windows == '1' && $upload_file_result == 1}
     setTimeout('closeAndRefresh()', 2000);
     {/if}
     //-->
diff -ur eventum-20060328.orig/templates/en/lookup_layer.tpl.html eventum-20060328/templates/en/lookup_layer.tpl.html
--- eventum-20060328.orig/templates/en/lookup_layer.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/lookup_layer.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -1 +1 @@
-<select size=\'6\' {if $multiple}multiple{/if} name=\'lookup{if $multiple}[]{/if}\' class=\'default_overlib\'>{foreach key=key item=item from=$list}<option value=\'{$key|replace:"'":"&#146;"|replace:"\"":"&quot;"}\'>{$item|replace:"'":"&#146;"|replace:"\"":"&quot;"|htmlspecialchars}</option>{/foreach}</select>
\ No newline at end of file
+<select size=\'6\' {if $multiple}multiple{/if} name=\'lookup{if $multiple}[]{/if}\' class=\'default_overlib\'>{foreach key=key item=item from=$list}<option value=\'{$key|replace:"'":"&#146;"|replace:"\"":"&quot;"}\'>{$item|truncate:70|replace:"'":"&#146;"|replace:"\"":"&quot;"|htmlspecialchars}</option>{/foreach}</select>
diff -ur eventum-20060328.orig/templates/en/mail_queue.tpl.html eventum-20060328/templates/en/mail_queue.tpl.html
--- eventum-20060328.orig/templates/en/mail_queue.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/mail_queue.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -14,7 +14,7 @@
         <b>Mail Queue for Issue #{$issue_id}</b>
       </td>
     </tr>
-    <tr id="drafts1" {get_display_style element_name="drafts"}>
+    <tr>
       <td>
         <table width="100%" cellpadding="2" cellspacing="1">
           <tr bgcolor="{$cell_color}">
diff -ur eventum-20060328.orig/templates/en/manage/reminders.tpl.html eventum-20060328/templates/en/manage/reminders.tpl.html
--- eventum-20060328.orig/templates/en/manage/reminders.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/manage/reminders.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -227,7 +227,7 @@
                       {/if}
                       <td>
                         <select name="issues[]" class="default" size="4" multiple>
-                          {html_options options=$issues selected=$info.rer_iss_id}
+                          {html_options options=$issues|truncate:70 selected=$info.rer_iss_id}
                         </select>
                       </td>
                     </tr>
diff -ur eventum-20060328.orig/templates/en/notes.tpl.html eventum-20060328/templates/en/notes.tpl.html
--- eventum-20060328.orig/templates/en/notes.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/notes.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -59,10 +59,10 @@
             {/if}
           </td>
         </tr>
-        <tr id="notes1" {get_display_style element_name="notes" total=$notes|@count}>
+        <tr>
           <td colspan="2">
             <table width="100%" cellpadding="2" cellspacing="1">
-              <tr bgcolor="{$internal_color}">
+              <tr id="notes1" {get_display_style element_name="notes" total=$notes|@count} bgcolor="{$internal_color}">
                 <td class="default_white" NOWRAP>{include file="expandable_cell/buttons.tpl.html" remote_func="getNote" ec_id="note"}</td>
                 <td class="default_white" align="center">#</td>
                 <td class="default_white">Reply</td>
@@ -72,7 +72,7 @@
               </tr>
               {section name="i" loop=$notes}
               {cycle values=$cycle assign="row_color"}
-              <tr bgcolor="{$row_color}">
+              <tr id="notes{$smarty.section.i.iteration+1}" {get_display_style element_name="notes" total=$notes|@count} bgcolor="{$row_color}">
                 <td class="default" NOWRAP>{include file="expandable_cell/buttons.tpl.html" ec_id="note" list_id=$notes[i].not_id}</td>
                 <td class="default" align="center">{$smarty.section.i.iteration}</td>
                 <td align="center">
@@ -90,7 +90,7 @@
               </tr>
               {include file="expandable_cell/body.tpl.html" ec_id="note" list_id=$notes[i].not_id colspan="6"}
               {sectionelse}
-              <tr>
+              <tr id="notes2" {get_display_style element_name="notes" total=$notes|@count}>
                 <td colspan="6" bgcolor="{$light_color}" align="center" class="default">
                   <i>No internal notes could be found.</i>
                 </td>
diff -ur eventum-20060328.orig/templates/en/phone_support.tpl.html eventum-20060328/templates/en/phone_support.tpl.html
--- eventum-20060328.orig/templates/en/phone_support.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/phone_support.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -39,10 +39,10 @@
             {/if}
         </td>
         </tr>
-        <tr id="phone_support1" {get_display_style element_name="phone_support" total=$phone_entries|@count}>
+        <tr>
           <td colspan="2">
             <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2">
-              <tr bgcolor="{$internal_color}">
+              <tr id="phone_support1" {get_display_style element_name="phone_support" total=$phone_entries|@count} bgcolor="{$internal_color}">
                 <td class="default_white" NOWRAP>{include file="expandable_cell/buttons.tpl.html" remote_func="getPhoneSupport" ec_id="phone"}</td>
                 <td width="5" class="default_white" align="center">#</td>
                 <td width="20%" class="default_white" nowrap>Recorded Date</td>
@@ -55,7 +55,7 @@
               </tr>
               {section name="i" loop=$phone_entries}
               {cycle values=$cycle assign="row_color"}
-              <tr bgcolor="{$row_color}">
+              <tr id="phone_support{$smarty.section.i.iteration+1}" {get_display_style element_name="phone_support" total=$phone_entries|@count} bgcolor="{$row_color}">
                 <td class="default" NOWRAP>{include file="expandable_cell/buttons.tpl.html" ec_id="phone" list_id=$phone_entries[i].phs_id}</td>
                 <td class="default" nowrap>{$smarty.section.i.iteration}</td>
                 <td class="default" nowrap>{$phone_entries[i].phs_created_date}</td>
@@ -73,14 +73,14 @@
               </tr>
               {include file="expandable_cell/body.tpl.html" ec_id="phone" list_id=$phone_entries[i].phs_id colspan="9"}
               {sectionelse}
-              <tr>
+              <tr id="phone_support2" {get_display_style element_name="phone_support" total=$phone_entries|@count}>
                 <td colspan="9" bgcolor="{$light_color}" class="default" align="center">
                   <i>No phone calls recorded yet.</i>
                 </td>
               </tr>
               {/section}
               {if $current_role > $roles.customer}
-              <tr id="phone_support11" {get_display_style element_name="phone_support"}>
+              <tr>
                 <td colspan="9" bgcolor="{$internal_color}" align="center">
                   <input type="submit" value="Add Phone Call" class="button" onClick="javascript:addPhoneCall();">
                 </td>
diff -ur eventum-20060328.orig/templates/en/reports/recent_activity.tpl.html eventum-20060328/templates/en/reports/recent_activity.tpl.html
--- eventum-20060328.orig/templates/en/reports/recent_activity.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/reports/recent_activity.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -143,7 +143,7 @@
         <tr>
           <td class="default" bgcolor="{$row_color}" NOWRAP>{include file="expandable_cell/buttons.tpl.html" ec_id="phone" list_id=$row.phs_id}</td>
           <td class="default" bgcolor="{$row.sta_color}" align="right">
-            <a href="{$rel_url}view.php?id={$row.phs_iss_id}" class="link">{$row.phs_iss_id}</a>
+            <a target="_blank" href="{$rel_url}view.php?id={$row.phs_iss_id}" class="link">{$row.phs_iss_id}</a>
           </td>
           {if $has_customer_integration}
           <td class="default" bgcolor="{$row_color}">{$row.customer}</td>
@@ -192,7 +192,7 @@
         <tr>
           <td class="default" bgcolor="{$row_color}" NOWRAP>{include file="expandable_cell/buttons.tpl.html" ec_id="note" list_id=$row.not_id}</td>
           <td class="default" bgcolor="{$row.sta_color}" align="right">
-            <a href="{$rel_url}view.php?id={$row.not_iss_id}" class="link">{$row.not_iss_id}</a>
+            <a target="_blank" href="{$rel_url}view.php?id={$row.not_iss_id}" class="link" title="{$row.iss_summary|htmlspecialchars}">{$row.not_iss_id}</a>
           </td>
           {if $has_customer_integration}
           <td class="default" bgcolor="{$row_color}">{$row.customer}</td>
@@ -242,7 +242,7 @@
             {include file="expandable_cell/buttons.tpl.html" ec_id="email" list_id=$row.composite_id}
           </td>
           <td class="default" bgcolor="{$row.sta_color}" align="right">
-            <a href="{$rel_url}view.php?id={$row.sup_iss_id}" class="link">{$row.sup_iss_id}</a>
+            <a target="_blank" href="{$rel_url}view.php?id={$row.sup_iss_id}" class="link" title="{$row.iss_summary|htmlspecialchars}">{$row.sup_iss_id}</a>
           </td>
           {if $has_customer_integration}
           <td class="default" bgcolor="{$row_color}">{$row.customer}</td>
@@ -298,7 +298,7 @@
         <tr {if $row.emd_status != 'pending'}style="text-decoration: line-through;"{/if}>
           <td class="default" NOWRAP bgcolor="{$row_color}">{include file="expandable_cell/buttons.tpl.html" ec_id="draft" list_id=$row.emd_id}</td>
           <td class="default" bgcolor="{$row.sta_color}" align="right">
-            <a href="{$rel_url}view.php?id={$row.emd_iss_id}" class="link">{$row.emd_iss_id}</a>
+            <a target="_blank" href="{$rel_url}view.php?id={$row.emd_iss_id}" class="link">{$row.emd_iss_id}</a>
           </td>
           {if $has_customer_integration}
           <td class="default" bgcolor="{$row_color}">{$row.customer}</td>
@@ -348,7 +348,7 @@
         {cycle values=$cycle assign="row_color"}
         <tr>
           <td class="default" bgcolor="{$row.sta_color}" align="right">
-            <a href="{$rel_url}view.php?id={$row.ttr_iss_id}" class="link">{$row.ttr_iss_id}</a>
+            <a target="_blank" href="{$rel_url}view.php?id={$row.ttr_iss_id}" class="link" title="{$row.iss_summary|htmlspecialchars}">{$row.ttr_iss_id}</a>
           </td>
           {if $has_customer_integration}
           <td class="default" bgcolor="{$row_color}">{$row.customer}</td>
@@ -393,7 +393,7 @@
         {cycle values=$cycle assign="row_color"}
         <tr>
           <td class="default" bgcolor="{$row.sta_color}" align="right">
-            <a href="{$rel_url}view.php?id={$row.rmh_iss_id}" class="link">{$row.rmh_iss_id}</a>
+            <a target="_blank" href="{$rel_url}view.php?id={$row.rmh_iss_id}" class="link">{$row.rmh_iss_id}</a>
           </td>
           {if $has_customer_integration}
           <td class="default" bgcolor="{$row_color}">{$row.customer}</td>
diff -ur eventum-20060328.orig/templates/en/support_emails.tpl.html eventum-20060328/templates/en/support_emails.tpl.html
--- eventum-20060328.orig/templates/en/support_emails.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/support_emails.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -65,10 +65,10 @@
             {/if}
           </td>
         </tr>
-        <tr id="support_emails1" {get_display_style element_name="support_emails" total=$emails|@count}>
+        <tr>
           <td colspan="2">
             <table width="100%" cellpadding="2" cellspacing="1">
-              <tr bgcolor="{$cell_color}">
+              <tr id="support_emails1" {get_display_style element_name="support_emails" total=$emails|@count} bgcolor="{$cell_color}">
                 {if $emails != "" and $current_role > $roles.viewer and $current_role != $roles.customer}
                 <td width="5"><input type="button" value="All" class="shortcut" onClick="javascript:toggleSelectAll(this.form, 'item[]');"></td>
                 {/if}
@@ -82,7 +82,7 @@
               </tr>
               {section name="i" loop=$emails}
               {cycle values=$cycle assign="row_color"}
-              <tr>
+              <tr id="support_emails{$smarty.section.i.iteration+1}" {get_display_style element_name="support_emails" total=$emails|@count}>
                 {if $current_role > $roles.viewer and $current_role != $roles.customer}
                 <td align="center" bgcolor="{$row_color}">
                   <input type="checkbox" name="item[]" value="{$emails[i].sup_id}">
@@ -113,7 +113,7 @@
               </tr>
               {include file="expandable_cell/body.tpl.html" ec_id="email" list_id=$emails[i].composite_id colspan=$email_col_count row_color=$row_color}
               {sectionelse}
-              <tr>
+              <tr id="support_emails2" {get_display_style element_name="support_emails" total=$emails|@count}>
                 <td colspan="{$email_col_count}" bgcolor="{$light_color}" class="default" align="center">
                   <i>No associated emails could be found.</i>
                 </td>
diff -ur eventum-20060328.orig/templates/en/time_tracking.tpl.html eventum-20060328/templates/en/time_tracking.tpl.html
--- eventum-20060328.orig/templates/en/time_tracking.tpl.html	2006-03-28 21:59:25.000000000 +0300
+++ eventum-20060328/templates/en/time_tracking.tpl.html	2006-03-28 22:07:37.000000000 +0300
@@ -40,10 +40,10 @@
             {/if}
           </td>
         </tr>
-        <tr id="time_tracker1" {get_display_style element_name="time_tracker" total=$time_entries|@count}>
+        <tr>
           <td colspan="2" class="default" width="100%">
             <table width="100%" cellpadding="2" cellspacing="1">
-              <tr bgcolor="{$internal_color}">
+              <tr id="time_tracker1" {get_display_style element_name="time_tracker" total=$time_entries|@count} bgcolor="{$internal_color}">
                 <td class="default_white" align="center" width="5">#</td>
                 <td class="default_white" nowrap>Date of Work</td>
                 <td class="default_white" nowrap>User</td>
@@ -53,7 +53,7 @@
               </tr>
               {section name="i" loop=$time_entries}
               {cycle values=$cycle assign="row_color"}
-              <tr bgcolor="{$row_color}">
+              <tr id="time_tracker{$smarty.section.i.iteration+1}" {get_display_style element_name="time_tracker" total=$time_entries|@count} bgcolor="{$row_color}">
                 <td class="default" align="center">{$smarty.section.i.iteration}</td>
                 <td class="default" nowrap>{$time_entries[i].ttr_created_date}</td>
                 <td class="default" nowrap>
@@ -65,13 +65,13 @@
                 <td class="default">{$time_entries[i].ttr_summary}</td>
               </tr>
               {if $smarty.section.i.last}
-              <tr>
+              <tr id="time_tracker{math equation="2 + x" x=$time_entries|@count}" {get_display_style element_name="time_tracker" total=$time_entries|@count}>
                 <td bgcolor="{$internal_color}" colspan="3" class="default_white" align="right">Total Time Spent:</td>
                 <td bgcolor="{$dark_color}" colspan="3" class="default">{$total_time_spent}</td>
               </tr>
               {/if}
               {sectionelse}
-              <tr>
+              <tr id="time_tracker2" {get_display_style element_name="time_tracker" total=$time_entries|@count}>
                 <td colspan="6" bgcolor="{$light_color}" align="center" class="default">
                   <i>No time tracking entries could be found.</i>
                 </td>
