[40455] trunk/dports/net/nedi

markd at macports.org markd at macports.org
Thu Oct 2 09:58:42 PDT 2008


Revision: 40455
          http://trac.macports.org/changeset/40455
Author:   markd at macports.org
Date:     2008-10-02 09:58:42 -0700 (Thu, 02 Oct 2008)
Log Message:
-----------
Add a developer patch to fix gui support for the ccc.pl (Cisco Contract Center) script.

Modified Paths:
--------------
    trunk/dports/net/nedi/Portfile

Added Paths:
-----------
    trunk/dports/net/nedi/files/patch-html-Reports-Modules.php-diff

Modified: trunk/dports/net/nedi/Portfile
===================================================================
--- trunk/dports/net/nedi/Portfile	2008-10-02 16:54:39 UTC (rev 40454)
+++ trunk/dports/net/nedi/Portfile	2008-10-02 16:58:42 UTC (rev 40455)
@@ -4,6 +4,7 @@
 
 name			nedi
 version			1.0
+revision		1
 categories		net
 maintainers		markd
 platforms		darwin
@@ -20,6 +21,7 @@
 extract.suffix		.tgz
 worksrcdir		${name}
 checksums		md5 adae0699ea6d010d6d92f807f04ca442
+patchfiles		patch-html-Reports-Modules.php-diff
 
 depends_lib		port:perl5.8 \
 			port:mysql5 \
@@ -54,7 +56,6 @@
 startupitem.executable	${nedidir}/${name}/moni.pl
 
 use_configure		no
-patch {}
 build {}
 
 post-patch {

Added: trunk/dports/net/nedi/files/patch-html-Reports-Modules.php-diff
===================================================================
--- trunk/dports/net/nedi/files/patch-html-Reports-Modules.php-diff	                        (rev 0)
+++ trunk/dports/net/nedi/files/patch-html-Reports-Modules.php-diff	2008-10-02 16:58:42 UTC (rev 40455)
@@ -0,0 +1,82 @@
+--- html/Reports-Modules.php.orig	2008-06-06 20:49:43.000000000 -0700
++++ html/Reports-Modules.php	2008-06-25 22:36:11.000000000 -0700
+@@ -10,6 +10,7 @@
+ # 03/07/07	minor changes & new inventory
+ # 04/09/07	implemented CSS scheme
+ # 20/09/07	implemented language support
++# 24/06/08	fixed ccc support (provided by Andreas Wassatsch)
+ */
+ 
+ error_reporting(E_ALL ^ E_NOTICE);
+@@ -190,20 +191,25 @@
+ 			echo "<tr class=\"imgb\" class=\"blu\"><th>\n";
+ 			echo "<a href=\"Devices-Status.php?dev=$ud\"><b>$d[0]</b></a></th>\n";
+ 
+-	//$query_ccc = "SELECT status,contract FROM cisco_contracts WHERE serial=\"$d[2]\"";
+-	$query_ccc = GenQuery('cisco_contracts','s','status,contract','','',array('serial'),array('='),array($d[2]));
++	//$query_ccc = GenQuery('cisco_contracts','s','service_level,contract_number,end_date,DATEDIFF(STR_TO_DATE(end_date, '%d-%b-%Y'),CURDATE())','','',array('serial'),array('='),array($d[2]));
++	$query_ccc = "SELECT service_level,contract_number,end_date,DATEDIFF(STR_TO_DATE(end_date, '%d-%b-%Y'),CURDATE()) FROM cisco_contracts WHERE serial_number=\"$d[2]\"";
+ 	$res_ccc = @DbQuery($query_ccc,$link_ccc);
+ 	$ccc = @DbFetchRow($res_ccc);
+-	if ($ccc[0] == 0) {
++	if ($ccc[3] > 30) {
+ 		$color = "green";
+-	} elseif ($ccc[0] == 1) {
++		$ccc_message = "$ccc[0]<br>Contract #$ccc[1] valid till $ccc[2]";
++	} elseif ($ccc[3] > 1) {
+ 		$color = "darkyellow";
+-	} elseif ($ccc[0] == 2) {
+-		$color = "red";
++		$ccc_message = "$ccc[0]<br>Contract #$ccc[1] valid till $ccc[2]";
+ 	} else {
+-		$color = "orange";
++		$color = "red";
++		$ccc_message = "$ccc[0]<br>Contract #$ccc[1] expired since $ccc[2] !";
++	}
++	if ($ccc[1] == "") {
++		$color = "blue";
++		$ccc_message = "Unknown";
+ 	}
+-			echo "<td align=right>-</td><td><b>$d[1]</b></td><td>$d[2]</td><td><font color=$color>$ccc[1]</font></td></tr>\n";
++			echo "<td align=right>-</td><td><b>$d[1]</b></td><td>$d[2]</td><td><font color=$color>$ccc_message</font></td></tr>\n";
+ 
+ 			$mquery	= GenQuery('modules','s','*','slot','',array('device'),array('='),array($d[0]));
+ 			$mres	= @DbQuery($mquery,$link);
+@@ -212,19 +218,24 @@
+ 					if ($row % 2){$bg = "txta";}else{$bg = "txtb";}
+ 					$row++;
+ 					echo "<tr class=\"$bg\"><th>\n";
+-	$query_ccc = "SELECT status,contract FROM cisco_contracts WHERE serial=\"$m[4]\"";
+-	$res_ccc = @DbQuery($query_ccc,$link_ccc);
+-	$ccc = @DbFetchRow($res_ccc);
+-	if ($ccc[0] == 0) {
+-		$color = "green";
+-	} elseif ($ccc[0] == 1) {
+-		$color = "darkyellow";
+-	} elseif ($ccc[0] == 2) {
+-		$color = "red";
+-	} else {
+-		$color = "orange";
+-	}
+-					echo "<td align=right>$m[1]</td><td><b>$m[2]</b> $m[3]</td><td>$m[4]</td><td><font color=$color>$ccc[1]</font></td></tr>\n";
++					$query_ccc = "SELECT service_level,contract_number,end_date,DATEDIFF(STR_TO_DATE(end_date, '%d-%b-%Y'),CURDATE()) FROM cisco_contracts WHERE serial_number=\"$m[2]\"";
++					$res_ccc = @DbQuery($query_ccc,$link_ccc);
++					$ccc = @DbFetchRow($res_ccc);
++					if ($ccc[3] > 30) {
++						$color = "green";
++						$ccc_message = "$ccc[0]<br>Contract #$ccc[1] valid till $ccc[2]";
++					} elseif ($ccc[3] > 1) {
++						$color = "darkyellow";
++						$ccc_message = "$ccc[0]<br>Contract #$ccc[1] valid till $ccc[2]";
++					} else {
++						$color = "red";
++						$ccc_message = "$ccc[0]<br>Contract #$ccc[1] expired since $ccc[2]";
++					}
++					if ($ccc[1] == "") {
++						$color = "blue";
++						$ccc_message = "Unknown";
++					}
++					echo "<td align=right>$m[1]</td><td><b>$m[2]</b> $m[3]</td><td>$m[4]</td><td><font color=$color>$ccc_message</font></td></tr>\n";
+ 				}
+ 				@DbFreeResult($mres);
+ 			}else{
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20081002/7709d9e5/attachment.html 


More information about the macports-changes mailing list