Reimplement subject_link hook and add some new link attribute variables
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 24 Nov 2005 01:13:56 +0000 (01:13 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 24 Nov 2005 01:13:56 +0000 (01:13 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10403 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox_display.php
templates/default/message_list.tpl

index e590ae90879c279e06d4faa5d58dadec9bb99c8a..43b98f758183e4d2ef00b4bf5749e76f9e38ab0e 100644 (file)
@@ -514,7 +514,7 @@ function prepareMessageList(&$aMailbox, $aProps) {
         if (isset($aId[$i])) {
 
             $bHighLight = false;
         if (isset($aId[$i])) {
 
             $bHighLight = false;
-            $value = $title = $link = $target = '';
+            $value = $title = $link = $target = $onclick = $link_extra = '';
             $aQuery = ($aInitQuery !== false) ? $aInitQuery : false;
             $aMsg = $aHeaders[$aId[$i]];
             if (isset($aSearch) && count($aSearch) > 1 && $aQuery) {
             $aQuery = ($aInitQuery !== false) ? $aInitQuery : false;
             $aMsg = $aHeaders[$aId[$i]];
             if (isset($aSearch) && count($aSearch) > 1 && $aQuery) {
@@ -528,7 +528,7 @@ function prepareMessageList(&$aMailbox, $aProps) {
             }
 
             foreach ($aCol as $k => $v) {
             }
 
             foreach ($aCol as $k => $v) {
-                $link = $target = $title = '';
+                $title = $link = $target = $onclick = $link_extra = '';
                 $aColumns[$k] = array();
                 $value = (isset($aMsg[$v]))  ? $aMsg[$v]  : '';
                 $sUnknown = _("Unknown recipient");
                 $aColumns[$k] = array();
                 $value = (isset($aMsg[$v]))  ? $aMsg[$v]  : '';
                 $sUnknown = _("Unknown recipient");
@@ -597,6 +597,12 @@ function prepareMessageList(&$aMailbox, $aProps) {
                     if ($aQuery) {
                         // TODO, $sTargetModule should be a query parameter so that we can use a single entrypoint
                         $link = $sTargetModule.'.php?' . implode('&amp;',$aQuery);
                     if ($aQuery) {
                         // TODO, $sTargetModule should be a query parameter so that we can use a single entrypoint
                         $link = $sTargetModule.'.php?' . implode('&amp;',$aQuery);
+
+                        // globalize link attributes so plugins can share in 
+                        // modifying them; plugins are responsible for sharing 
+                        // nicely (such as for setting the target, etc)
+                        global $link, $title, $target, $onclick, $link_extra;
+                        do_hook('subject_link', array($iPageOffset, $sSearch, $aSearch));
                     }
                     $value = (trim($value)) ? $value : _("(no subject)");
                     /* add thread indentation */
                     }
                     $value = (trim($value)) ? $value : _("(no subject)");
                     /* add thread indentation */
@@ -640,9 +646,11 @@ function prepareMessageList(&$aMailbox, $aProps) {
                     break;
                 default : break;
                 }
                     break;
                 default : break;
                 }
-                if ($title)  { $aColumns[$k]['title']  = $title;  }
-                if ($link)   { $aColumns[$k]['link']   = $link;   }
-                if ($target) { $aColumns[$k]['target'] = $target; }
+                if ($title)      { $aColumns[$k]['title']      = $title;      }
+                if ($link)       { $aColumns[$k]['link']       = $link;       }
+                if ($link_extra) { $aColumns[$k]['link_extra'] = $link_extra; }
+                if ($onclick)    { $aColumns[$k]['onclick']    = $onclick;    }
+                if ($target)     { $aColumns[$k]['target']     = $target;     }
                 $aColumns[$k]['value']  = $value;
             }
             /* columns which will not be displayed but should be inspected
                 $aColumns[$k]['value']  = $value;
             }
             /* columns which will not be displayed but should be inspected
@@ -1431,4 +1439,4 @@ function attachSelectedMessages($imapConnection,$aMsgHeaders) {
     return $composesession;
 }
 
     return $composesession;
 }
 
-?>
\ No newline at end of file
+?>
index ed21ce0c34fabdf045739f0c68e6068c505e8b59..d1ab6d7a8b5ad863f91b201ae3f83084a845e006 100644 (file)
@@ -459,11 +459,14 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
             $sLabelStart = '';
             $sLabelEnd = '';
         }
             $sLabelStart = '';
             $sLabelEnd = '';
         }
-        $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : array();
-        $title  = (isset($aCol['title']))  ? $aCol['title']  : '';
-        $link   = (isset($aCol['link']))   ? $aCol['link']   : '';
-        $value  = (isset($aCol['value']))  ? $aCol['value']  : '';
-        $target = (isset($aCol['target'])) ? $aCol['target'] : '';
+        $aCol       = (isset($aColumns[$iCol]))    ? $aColumns[$iCol]    : array();
+        $title      = (isset($aCol['title']))      ? $aCol['title']      : '';
+        $link       = (isset($aCol['link']))       ? $aCol['link']       : '';
+        $link_extra = (isset($aCol['link_extra'])) ? $aCol['link_extra'] : '';
+        $onclick    = (isset($aCol['onclick']))    ? $aCol['onclick']    : '';
+        $link       = (isset($aCol['link']))       ? $aCol['link']       : '';
+        $value      = (isset($aCol['value']))      ? $aCol['value']      : '';
+        $target     = (isset($aCol['target']))     ? $aCol['target']     : '';
         if ($iCol !== SQM_COL_CHECK) {
             $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
         }
         if ($iCol !== SQM_COL_CHECK) {
             $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
         }
@@ -482,8 +485,10 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
                 $sText .= str_repeat('&nbsp;&nbsp;',$indent);
             }
             $sText .= "<a href=\"$link\"";
                 $sText .= str_repeat('&nbsp;&nbsp;',$indent);
             }
             $sText .= "<a href=\"$link\"";
-            if ($target) { $sText .= " target=\"$target\"";}
-            if ($title)  { $sText .= " title=\"$title\""  ;}
+            if ($target)     { $sText .= " target=\"$target\"";   }
+            if ($title)      { $sText .= " title=\"$title\"";     }
+            if ($onclick)    { $sText .= " onclick=\"$onclick\""; }
+            if ($link_extra) { $sText .= " $link_extra";          }
             if ($javascript_on && $fancy_index_highlite) {
                   $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
                             'parentNode.parentNode, ' . $i . ', \'click\', \'' . $bgcolor . '\', \'' . $mouseoverColor . '\', \'' .
             if ($javascript_on && $fancy_index_highlite) {
                   $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
                             'parentNode.parentNode, ' . $i . ', \'click\', \'' . $bgcolor . '\', \'' . $mouseoverColor . '\', \'' .