From 510c4d84897cfe759c79e13b550eec80c403fc22 Mon Sep 17 00:00:00 2001 From: chriskl Date: Tue, 24 Aug 2004 08:59:51 +0000 Subject: [PATCH] put line numbers on funcs in a separate cell. someone probably wants to figure out how to not have the hard-coded styles --- BUGS | 1 + HISTORY | 1 + classes/Misc.php | 36 +++++++++++++++++++----------------- functions.php | 4 ++-- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/BUGS b/BUGS index cb0a8c09..4defb003 100644 --- a/BUGS +++ b/BUGS @@ -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 ------------- diff --git a/HISTORY b/HISTORY index fb904d86..0c7f7192 100644 --- a/HISTORY +++ b/HISTORY @@ -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}"; + $classattr = isset($class) ? " class=\"{$class}\"" : ''; + $out = "<{$tag}{$alignattr}{$classattr}>{$out}"; } - + + // 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 = "\n
";
+					for ($i = 1; $i <= $num; $i++) {
+						$temp .= $i . "\n";
+					}
+					$temp .= "
{$out}
\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 "", $misc->printVal($funcdata->f['prosrc']), "\n"; } else { echo "{$lang['strdefinition']}\n"; - echo "", $misc->printVal($funcdata->f['prosrc'], 'pre', array('lineno' => true)), "\n"; + echo "", $misc->printVal($funcdata->f['prosrc'], 'pre', array('lineno' => true, 'class' => 'data1')), "\n"; } // Show flags -- 2.39.5