Revision: 2888
          http://ipcop.svn.sourceforge.net/ipcop/?rev=2888&view=rev
Author:   owes
Date:     2009-05-22 11:50:00 +0000 (Fri, 22 May 2009)

Log Message:
-----------
Add option to get service status without memory size, useful in several CGIs to 
easily show STOPPED vs. RUNNING.

Modified Paths:
--------------
    ipcop/trunk/html/cgi-bin/ovpnmain.cgi
    ipcop/trunk/src/libs/general-functions.pl

Modified: ipcop/trunk/html/cgi-bin/ovpnmain.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/ovpnmain.cgi       2009-05-22 06:12:56 UTC (rev 
2887)
+++ ipcop/trunk/html/cgi-bin/ovpnmain.cgi       2009-05-22 11:50:00 UTC (rev 
2888)
@@ -1740,11 +1740,10 @@
     &Header::closebox();
 }
 
-my $sactive = "<table cellpadding='2' cellspacing='0' 
bgcolor='${Header::colourred}' width='50%'><tr><td align='center'><b><font 
color='#FFFFFF'>$Lang::tr{'stopped'}</font></b></td></tr></table>";
+my $sactive = &General::isrunning('openvpn', 'nosize');
 my $srunning = "no";
 my $activeonrun = "";
 if (-e "/var/run/openvpn.pid") {
-    $sactive = "<table cellpadding='2' cellspacing='0' 
bgcolor='${Header::colourgreen}' width='50%'><tr><td align='center'><b><font 
color='#FFFFFF'>$Lang::tr{'running'}</font></b></td></tr></table>";
     $srunning ="yes";
     $activeonrun = "";
 }
@@ -1762,8 +1761,8 @@
 print <<END
 <form method='post' action='$ENV{'SCRIPT_NAME'}'><table width='100%'>
 <tr>
-    <td class='base' width='25%'>$Lang::tr{'ovpn server status'}:</td>
-    <td align='left' width='25%'>$sactive</td>
+    <td class='base' width='25%'>$Lang::tr{'openvpn server'}:</td>
+    $sactive
     <td width='25%'>&nbsp;</td>
     <td width='25%'>&nbsp;</td>
 </tr><tr>

Modified: ipcop/trunk/src/libs/general-functions.pl
===================================================================
--- ipcop/trunk/src/libs/general-functions.pl   2009-05-22 06:12:56 UTC (rev 
2887)
+++ ipcop/trunk/src/libs/general-functions.pl   2009-05-22 11:50:00 UTC (rev 
2888)
@@ -746,12 +746,16 @@
 sub isrunning($)
 {
     my $cmd     = $_[0];
-    my $status  = "<td>&nbsp;</td><th align='center' 
class='ipcop_stopped'>$Lang::tr{'stopped'}</th>";
+    my $status  = "<th align='center' 
class='ipcop_stopped'>$Lang::tr{'stopped'}</th>";
     my $pid     = '';
     my $testcmd = '';
     my $exename;
     my $vmsize;
+    my $showsize = 1;
 
+    $showsize = 0 if (defined($_[1]));
+    $status = "<td>&nbsp;</td>".$status if ($showsize);
+
     $cmd =~ /(^[a-z]+)/;
     $exename = $1;
 
@@ -788,7 +792,12 @@
             }
             close FILE;
             if ($testcmd =~ /$exename/) {
-                $status = "<td align='center' >$vmsize</td>";
+                if ($showsize) {
+                    $status = "<td align='center' >$vmsize</td>";
+                }
+                else {
+                    $status = "";
+                }
                 $status .= "<th align='center' 
class='ipcop_running'>$Lang::tr{'running'}</th>";
             }
         }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to