diff options
author | chriskl | 2004-08-24 08:59:51 +0000 |
---|---|---|
committer | chriskl | 2004-08-24 08:59:51 +0000 |
commit | 510c4d84897cfe759c79e13b550eec80c403fc22 (patch) | |
tree | 9451cdec37ebcb970b816ffbbea01406ca540ef2 | |
parent | e5389dc4a7ceaf79649ddf193cc51845fb9c06ae (diff) |
put line numbers on funcs in a separate cell. someone probably wants to figure out how to not have the hard-coded styles
-rw-r--r-- | BUGS | 1 | ||||
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | classes/Misc.php | 36 | ||||
-rw-r--r-- | functions.php | 4 |
4 files changed, 23 insertions, 19 deletions
@@ -17,6 +17,7 @@ Need to fix: * Report login errors * Don't offer owner change feature if user is not superuser * check use of apostrophes, etc. in tree menu +* add different null formats to import and export NEEDS TESTING ------------- @@ -22,6 +22,7 @@ Features * Allow creating and viewing composite types * pg_dumpall integration. Now you can download the entire cluster via phpPgAdmin. +* Show line numbers when viewing functions Translations * Arabic from Zaki diff --git a/classes/Misc.php b/classes/Misc.php index 553b763c..b0ee3116 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -2,7 +2,7 @@ /** * Class to hold various commonly used functions * - * $Id: Misc.php,v 1.84 2004/08/04 07:44:03 chriskl Exp $ + * $Id: Misc.php,v 1.85 2004/08/24 08:59:51 chriskl Exp $ */ class Misc { @@ -123,19 +123,6 @@ $str = substr($str, 0, $maxlen-1) . $ellipsis; } } - - // Add line numbers if 'lineno' param is true - if (isset($params['lineno']) && $params['lineno'] === true) { - $lines = explode("\n", $str); - // Determine max number of digits and create a formatting string - $format = '%' . strlen(count($lines)) . 'u: %s'; - $i = 1; - $str = ''; - foreach ($lines as $line) { - $str .= sprintf($format, $i++, $line) . "\n"; - } - unset($lines); - } $out = ''; @@ -212,10 +199,25 @@ if (isset($tag)) { $alignattr = isset($align) ? " align=\"{$align}\"" : ''; - $classattr = isset($class) ? " class=\"{$class}\"" : ''; - return "<{$tag}{$alignattr}{$classattr}>{$out}</{$tag}>"; + $classattr = isset($class) ? " class=\"{$class}\"" : ''; + $out = "<{$tag}{$alignattr}{$classattr}>{$out}</{$tag}>"; } - + + // Add line numbers if 'lineno' param is true + if (isset($params['lineno']) && $params['lineno'] === true) { + $lines = explode("\n", $str); + $num = count($lines); + if ($num > 0) { + $temp = "<table>\n<tr><td class=\"{$class}\" style=\"vertical-align: top; padding-right: 10px;\"><pre class=\"{$class}\">"; + for ($i = 1; $i <= $num; $i++) { + $temp .= $i . "\n"; + } + $temp .= "</pre></td><td class=\"{$class}\" style=\"vertical-align: top;\">{$out}</td></tr></table>\n"; + $out = $temp; + } + unset($lines); + } + return $out; } diff --git a/functions.php b/functions.php index 9afaf432..f0fcb002 100644 --- a/functions.php +++ b/functions.php @@ -3,7 +3,7 @@ /** * Manage functions in a database * - * $Id: functions.php,v 1.40 2004/07/22 08:50:01 jollytoad Exp $ + * $Id: functions.php,v 1.41 2004/08/24 08:59:51 chriskl Exp $ */ // Include application functions @@ -222,7 +222,7 @@ echo "<tr><td class=\"data1\" colspan=\"4\">", $misc->printVal($funcdata->f['prosrc']), "</td></tr>\n"; } else { echo "<tr><th class=\"data\" colspan=\"4\">{$lang['strdefinition']}</th></tr>\n"; - echo "<tr><td class=\"data1\" colspan=\"4\">", $misc->printVal($funcdata->f['prosrc'], 'pre', array('lineno' => true)), "</td></tr>\n"; + echo "<tr><td class=\"data1\" colspan=\"4\">", $misc->printVal($funcdata->f['prosrc'], 'pre', array('lineno' => true, 'class' => 'data1')), "</td></tr>\n"; } // Show flags |