Skip to content
Permalink
Browse files

Add a developer patch to fix gui support for the ccc.pl (Cisco Contra…

…ct Center) script.

git-svn-id: https://svn.macports.org/repository/macports/trunk/dports@40455 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Mark Duling
Mark Duling committed Oct 2, 2008
1 parent 45917e1 commit c7cdd3199e7ea8af41bbd26765ba824f10b85ce0
Showing with 84 additions and 1 deletion.
  1. +2 −1 net/nedi/Portfile
  2. +82 −0 net/nedi/files/patch-html-Reports-Modules.php-diff
@@ -4,6 +4,7 @@ PortSystem 1.0

name nedi
version 1.0
revision 1
categories net
maintainers markd
platforms darwin
@@ -20,6 +21,7 @@ distname ${name}-${version}
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.name nedimonitor
startupitem.executable ${nedidir}/${name}/moni.pl

use_configure no
patch {}
build {}

post-patch {
@@ -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{

0 comments on commit c7cdd31

Please sign in to comment.
You can’t perform that action at this time.