6.0.0-alpha12
6/7/25

[#2420] MIME_Viewer_source::lineNumber
Summary MIME_Viewer_source::lineNumber
Queue Horde Base
Queue Version 3.0.5
Type Bug
State Duplicate
Priority 1. Low
Owners Horde Developers (at)
Requester mboerger (at) ford (dot) com
Created 08/10/2005 (7241 days ago)
Due
Updated 02/25/2006 (7042 days ago)
Assigned 08/31/2005 (7220 days ago)
Resolved 02/25/2006 (7042 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
02/25/2006 07:28:07 PM Chuck Hagenbuch Comment #6
State ⇒ Duplicate
Reply to this comment
This was fixed in bug 3038.
08/31/2005 09:25:21 AM Jan Schneider Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
 
08/10/2005 02:48:06 PM mboerger (at) ford (dot) com Comment #5 Reply to this comment
Win2K, IE, enscript via mime handler
08/10/2005 02:40:41 PM Jan Schneider Comment #4 Reply to this comment
Which browser(s), and which source highlighting driver (in mime_drivers.php)?
08/10/2005 02:26:53 PM mboerger (at) ford (dot) com Comment #3 Reply to this comment
The temporary solution comes of course with another disadvantage that 
i am now no longer able to copy the source and have to srip out the 
line numbers of the page.



My original problem is that the lines and line number get out of synch 
(hight wise).



regards

marcus (helly)
08/10/2005 01:55:59 PM Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Hi Marcus,



the idea of the line numbering is to *not* use a table row for every 
line. That would explode the page sizes. What exactly is not working 
for you?
08/10/2005 12:11:21 PM mboerger (at) ford (dot) com Comment #1
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ MIME_Viewer_source::lineNumber
Queue ⇒ Horde Base
Reply to this comment
Line numbering does not work for me because line numbers and source 
are treated differently. The solution is to change the method as 
follows:



     /**

      * Add line numbers to a block of code.

      *

      * @param string $code  The code to number.

      */

     function lineNumber($code, $linebreak = "\n")

     {

         $code = explode($linebreak, $code);

         $html  = '<!--a75c305b1c0a6022--><table style="border: 1px 
solid black" cellspacing="0" cellpadding="0" width="100%">';

         foreach($code as $l => $text) {

             $html .= '<tr><td valign="top" 
style="background-color:#e9e9e9; padding-left:10px; 
padding-right:10px; text-align:right; font-family:monospace; 
font-size:12px;">';

             $html .= sprintf('<a style="font-family:monospace; 
font-size:12px;" name="%s" href="#%s">%s</a>', $l, $l, $l) . '</td>';

             $html .= '<td width="100%" valign="top" nowrap="nowrap" 
style="background-color:white; padding-left:10px; 
font-family:monospace; font-size:12px;">' . $text . '</td>';

             $html .= '</tr>';

         }

         return $html . '</table>';

     }


Saved Queries