? phpPgAdmin/trig_properties.php
Index: phpPgAdmin/db_details.php
===================================================================
RCS file: /usr/local/cvsroot/phppgadmin/phpPgAdmin/db_details.php,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 db_details.php
12c12
< 	switch($rel_type) {
---
> 	switch($rel_type) {		
54,118d53
< 		case "index":
< 			$indexs = pg_exec($link, "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relkind ='i' ORDER BY relname");
< 			$num_indexs = @pg_numrows($indexs);
< 			if ($num_indexs == 0) {
< 				echo "<br><b>$strNo $strIndicies $strFound</b><br>";
< 			} else {
< 				$i = 0;
< 				echo "<table border=$cfgBorder>\n<tr bgcolor=lightgrey><th align=center colspan=3>$strIndicies</th></tr>\n";
< 				while ($i < $num_indexs) {
< 					$bgcolor = $bgcolor_one;
< 					$i % 2 ? 0 : $bgcolor = $bgcolor_two;
< 					$index = pg_result($indexs, $i, 'relname');
< 					$query = "?db=$db&server=$server&rel_type=$rel_type&index=$index";
< 					$prop_query = "
< 					SELECT 
< 						ic.relname AS index_name, 
< 						bc.relname AS tab_name, 
< 						a.attname AS column_name,
< 						i.indisunique AS unique_key,
< 						i.indisprimary AS primary_key
< 					FROM 
< 						pg_class bc,
< 						pg_class ic,
< 						pg_index i,
< 						pg_attribute a
< 					WHERE 
< 						i.indrelid = bc.oid
< 						and i.indexrelid = ic.oid
< 						and 
< 						(
< 							i.indkey[0] = a.attnum 
< 							or
< 							i.indkey[1] = a.attnum
< 							or
< 							i.indkey[2] = a.attnum
< 							or
< 							i.indkey[3] = a.attnum
< 							or
< 							i.indkey[4] = a.attnum
< 							or
< 							i.indkey[5] = a.attnum
< 							or
< 							i.indkey[6] = a.attnum
< 							or
< 							i.indkey[7] = a.attnum
< 						)
< 						and a.attrelid = bc.oid
< 						and i.indproc = '0'::oid
< 						and ic.relname = '$index'
< 						ORDER BY index_name, tab_name, column_name;
< 					";
< 			?>
< 				<tr bgcolor=<?php echo $bgcolor; ?>>
< 				<td class=data><b><?php echo $index;?></b></td>
< 				<?php if (!$printview) { ?>
< 				<td><a href="sql.php<?php echo $query;?>&goto=db_details.php&sql_query=<?php echo urlencode($prop_query);?>&zero_rows=<?php echo urlencode("$strNo $strProperties.");?>"><?php echo $strProperties; ?></td>
< 				<td><a href="sql.php<?php echo $query;?>&goto=db_details.php&sql_query=<?php echo urlencode("DROP INDEX $cfgQuotes$index$cfgQuotes");?>&zero_rows=<?php echo urlencode("$strIndex $index $strHasBeenDropped.");?>"><?php echo $strDrop; ?></td>
< 				<?php } ?>
< 				</tr>
< 			<?php
< 				$i++;
< 				}
< 				echo "</table>\n";
< 			}
< 			break;
191a127,235
> 		case "trigger":	// Triggers
> 			$sql_get_trig = "
> 				SELECT ptr.*, pt.typname as result, pc.relname as relname
> 				FROM pg_trigger ptr, pg_type pt, pg_class pc
> 				WHERE ptr.tgtype=pt.oid 
> 				AND ptr.tgrelid=pc.oid
> 				AND tgname !~ 'pg_.*' 
> 				ORDER BY tgname
> 			";
> 			$triggers = pg_exec($link, $sql_get_trig);
> 			$num_triggers = @pg_numrows($triggers);
> 			if ($num_triggers == 0) {
> 				echo "<br><b>$strNo $strTriggers $strFound</b><br>";
> 			} else {
> 				echo "<table border=$cfgBorder>\n<tr bgcolor=lightgrey><th align=center>$strRetType</th><th align=center>$strTrigger</th>";
> 				echo "<th align=center>$strTable</th><th align=center>$strIsConstraint</th><th colspan=2>$strAction</th></tr>\n";
> 			
> 				for ($i = 0; $i < $num_triggers; $i++) {
> 					$trig_ary = pg_fetch_array($triggers, $i);
> 
> 					$bgcolor = $cfgBgcolorOne;
> 					$i % 2 ? 0 : $bgcolor = $cfgBgcolorTwo;
> 
> 					$classname = $trig_ary[relname];
> 					$trig_disp = "$trig_ary[tgname]";
> 					$trig_is_const = ($trig_ary[tgisconstraint] == 't') ? 'Y' : 'N';
> 					$trig_sql = "$cfgQuotes$trig_ary[tgname]$cfgQuotes";
> 					$query = "?db=$db&rel_type=$rel_type&trigger=" . urlencode($trig_ary[tgname]);
> 					?>
> 					<tr bgcolor=<?php echo $bgcolor; ?>>
> 					<td class=data><b><?php echo $trig_ary[result];?></b></td>
> 					<td class=data><b><?php echo $trig_disp;?></b></td>
> 					<td class=data><b><?php echo $classname;?></b></td>
> 					<td class=data align=center><b><?php echo $trig_is_const;?></b></td>
> 					<?php if (!$printview) { ?>
> 					<td><a href="trig_properties.php<?php echo $query; ?>"><?php echo $strProperties; ?></td>
> 					<td><a href="sql.php<?php echo $query;?>&goto=db_details.php&sql_query=<?php echo urlencode("DROP TRIGGER $trig_sql ON $classname");?>&zero_rows=<?php echo urlencode("$strTrigger $trigger $strHasBeenDropped");?>"><?php echo $strDrop; ?></td>
> 					<?php } ?>
> 					</tr>
> 					<?php
> 				}
> 				echo "</table>\n";
> 			}
> 			break;		
> 		case "index":
> 			$indexs = pg_exec($link, "SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relkind ='i' ORDER BY relname");
> 			$num_indexs = @pg_numrows($indexs);
> 			if ($num_indexs == 0) {
> 				echo "<br><b>$strNo $strIndicies $strFound</b><br>";
> 			} else {
> 				$i = 0;
> 				echo "<table border=$cfgBorder>\n<tr bgcolor=lightgrey><th align=center colspan=3>$strIndicies</th></tr>\n";
> 				while ($i < $num_indexs) {
> 					$bgcolor = $bgcolor_one;
> 					$i % 2 ? 0 : $bgcolor = $bgcolor_two;
> 					$index = pg_result($indexs, $i, 'relname');
> 					$query = "?db=$db&server=$server&rel_type=$rel_type&index=$index";
> 					$prop_query = "
> 					SELECT 
> 						ic.relname AS index_name, 
> 						bc.relname AS tab_name, 
> 						a.attname AS column_name,
> 						i.indisunique AS unique_key,
> 						i.indisprimary AS primary_key
> 					FROM 
> 						pg_class bc,
> 						pg_class ic,
> 						pg_index i,
> 						pg_attribute a
> 					WHERE 
> 						i.indrelid = bc.oid
> 						and i.indexrelid = ic.oid
> 						and 
> 						(
> 							i.indkey[0] = a.attnum 
> 							or
> 							i.indkey[1] = a.attnum
> 							or
> 							i.indkey[2] = a.attnum
> 							or
> 							i.indkey[3] = a.attnum
> 							or
> 							i.indkey[4] = a.attnum
> 							or
> 							i.indkey[5] = a.attnum
> 							or
> 							i.indkey[6] = a.attnum
> 							or
> 							i.indkey[7] = a.attnum
> 						)
> 						and a.attrelid = bc.oid
> 						and i.indproc = '0'::oid
> 						and ic.relname = '$index'
> 						ORDER BY index_name, tab_name, column_name;
> 					";
> 			?>
> 				<tr bgcolor=<?php echo $bgcolor; ?>>
> 				<td class=data><b><?php echo $index;?></b></td>
> 				<?php if (!$printview) { ?>
> 				<td><a href="sql.php<?php echo $query;?>&goto=db_details.php&sql_query=<?php echo urlencode($prop_query);?>&zero_rows=<?php echo urlencode("$strNo $strProperties.");?>"><?php echo $strProperties; ?></td>
> 				<td><a href="sql.php<?php echo $query;?>&goto=db_details.php&sql_query=<?php echo urlencode("DROP INDEX $cfgQuotes$index$cfgQuotes");?>&zero_rows=<?php echo urlencode("$strIndex $index $strHasBeenDropped.");?>"><?php echo $strDrop; ?></td>
> 				<?php } ?>
> 				</tr>
> 			<?php
> 				$i++;
> 				}
> 				echo "</table>\n";
> 			}
> 			break;
258a303,305
> }
> if ($rel_type != "trigger") {
> 	echo "<li><a href=db_details.php?db=$db&server=$server&rel_type=trigger>$strDisplay $strTriggers</a> ";
Index: phpPgAdmin/english.inc.php
===================================================================
RCS file: /usr/local/cvsroot/phppgadmin/phpPgAdmin/english.inc.php,v
retrieving revision 1.3
diff -r1.3 english.inc.php
15a16
> $strConstraintName	= "Constraint Name";
23a25
> $strDeferrable			= "Deferrable";
34a37
> $strEnabled				= "Enabled";
51a55
> $strInitDeferred		= "Init. Deferred";
55a60
> $strIsConstraint			= "Constraint";
182a188
> $strTable				= "Table";
183a190,191
> $strTrigger			= "Trigger";
> $strTriggers			= "Triggers";