Click to See Complete Forum and Search --> : onMouseClick


rodesignweb
November 11th, 2008, 05:57 PM
I have a dynamic generated table that has this format:

----------------------------------
- Column1 - Column2 - Column 3 -
----------------------------------
- - - -
----------------------------------
- - - -
----------------------------------
- - - -
----------------------------------
- - - -
----------------------------------
-
-
-
----------------------------------
- - - -
----------------------------------

3 columns, n rows

Content from Column2:

echo "<td height=\"25px\">";
if ($status[$user[$i_line]]==0)
{
echo '<img src="red-status.gif" width="20" height="20">';
echo " Disabled";
}
else
{
echo '<img src="green-status.gif" width="20" height="20">';
echo " Enabled";
$counter1++;
}

Content from Column3:

echo "<td height=\"25px\">";
if ($status[$user[$i_line]]==0)
echo "<center><form class=\"shell\" name=\"groovyform".$i_line."\"> <input type=\"button\" name=\"groovybtn1\" class=\"groovybutton\" value=\"Enable SecureJailShell\" onMouseOver=\"goLite(this.form.name,this.name)\" onMouseOut=\"goDim(this.form.name,this.name)\"></form></center>";
else
echo "<center><form class=\"shell\" name=\"groovyform2".$i_line."\"> <input type=\"button\" name=\"groovybtn1\" class=\"groovybutton\" value=\"Disable SecureJailShell\" onMouseOver=\"goLite(this.form.name,this.name)\" onMouseOut=\"goDim(this.form.name,this.name)\"></form></center>";

<script language="javascript">
function goLite(FRM,BTN){
window.document.forms[FRM].elements[BTN].style.color = "#CC9900";}
function goDim(FRM,BTN){
window.document.forms[FRM].elements[BTN].style.color = "#FFFFCC";}
</script>

where:

$counter = 0;
$counter1 = 0;
$shell = 0;
$users = array();
$value = 0;

while(false !== ($e = $d->read()))
{
if ($e != "." && $e != "..")
$user[] = $e;
$status[$e] = $shell;
}

where $d = dir("..."); (sample)

I would need some help to imprelement an OnMouseClick action that should do the following:

if value = Enable SecureJailShell
{
change value to Disable SecureJailShell;
change $status[$user[$i_line]] to 1
}

if value = Disable SecureJailShell
{
change value to Enable SecureJailShell;
change $status[$user[$i_line]] to 0
}

So this action should affect both: the button from Column3, where the action should be added; and the value from Column2

Could someone please help me?

rodesignweb
November 11th, 2008, 05:59 PM
I have also attached how my code looks so far, in case you need more details

PeejAvery
November 11th, 2008, 06:28 PM
I have never used JailShell before, but you are going to have to use some intermediate page which accomplishes the actions. Simply use a hidden iframe to load the following script. Or, you can use AJAX to call it.

<?php
if ($_GET['jailshell'] == 'enable') {
// enable jailshell
}
else {
// disable jailshell
}
?>