Index: /trunk/www/db_po/po.js
===================================================================
--- /trunk/www/db_po/po.js	(revision 11991)
+++ /trunk/www/db_po/po.js	(revision 11992)
@@ -84,5 +84,5 @@
             prog="all";
         else
-            if (progselect.options[progselect.selectedIndex])
+            if (progselect.selectedIndex>=0)
                 prog=progselect.options[progselect.selectedIndex].value;
             else
@@ -92,5 +92,5 @@
             key="all";
         else
-            if (keyselect.options[keyselect.selectedIndex])
+            if (keyselect.selectedIndex>=0)
                 key=keyselect.options[keyselect.selectedIndex].value;
             else
@@ -119,5 +119,5 @@
 }
 
-function addRow(addcase, prog, key, key1, key2, type, min, max)
+function addRow(addcase, prog, key, key1, key2, type, min, max, descr)
 {
     if (!prog)
@@ -157,6 +157,6 @@
     for (var i = 1 ; i <= document.getElementById('maxindex').innerHTML ; i++)
         if(document.getElementById('action'+i))
-            //document.getElementById('action'+i).innerHTML = "";
-            document.getElementById('action'+i).style.display = "none";
+            document.getElementById('action'+i).innerHTML = "";
+            //document.getElementById('action'+i).style.display = "none";
 
     tabBody=document.getElementById("valtable1");
@@ -175,4 +175,5 @@
     cell9 = document.createElement("TD");
     cell10 = document.createElement("TD");
+    cell11 = document.createElement("TD");
     var updcase;
 
@@ -181,4 +182,9 @@
     // 2: add new key, val=NULL, prog=selected
     // 3: add new val, prog=selected, key=selected, type/min/max fixed
+
+    //field descr
+    input4 = document.createElement("INPUT");
+    input4.style.width = 200;
+    input4.id = 'newdescr0';
     switch(addcase)
     {
@@ -253,8 +259,12 @@
         input2.id = '1key0';
         input2.style.width = 100;
+        if (key1)
+            input2.value = key1;
         cell2.appendChild(input2);
         input10 = document.createElement("INPUT");
         input10.id = '2key0';
         input10.style.width = 100;
+        if (key2)
+            input10.value = key2;
         cell10.appendChild(input10);
         //field for val
@@ -295,4 +305,6 @@
         input8.id = 'newmin0';
         input8.style.width = 50;
+        if (min)
+            input8.value = min;
         cell8.appendChild(input8);
         //field for max
@@ -300,5 +312,10 @@
         input9.id = 'newmax0';
         input9.style.width = 50;
+        if (max)
+            input9.value = max;
         cell9.appendChild(input9);
+        //field for descr
+        if (descr)
+            input4.value = descr;
         break;
     case 3:
@@ -337,8 +354,5 @@
     }
 
-    //field descr
-    input4 = document.createElement("INPUT");
-    input4.style.width = 200;
-    input4.id = 'newdescr0';
+    //rest of field descr
     cell4.appendChild(input4);
     //field action
@@ -365,4 +379,5 @@
     row.appendChild(cell4);//descr
     row.appendChild(cell5);//action
+    row.appendChild(cell11);//user
     tabBody.appendChild(row);
 
@@ -417,5 +432,6 @@
     for (var i = 1 ; i <= document.getElementById('maxindex').innerHTML ; i++)
         if(document.getElementById('action'+i) && i!=index)
-            document.getElementById('action'+i).style.display = "none";
+            //document.getElementById('action'+i).style.display = "none";
+            document.getElementById('action'+i).innerHTML = "";
     document.getElementById('addrowvals').style.display = "none";
     document.getElementById('addrowvals2').style.display = "none";
@@ -427,4 +443,7 @@
     olddescr=document.getElementById('descr'+index).innerHTML;
     oldtype=document.getElementById('type'+index).innerHTML;
+    // added to make min/max editable
+    oldmin=document.getElementById('min'+index).innerHTML;
+    oldmax=document.getElementById('max'+index).innerHTML;
     if (!oldval)
         delcase=6;
@@ -448,4 +467,7 @@
     //set field for description
     document.getElementById('descr'+index).innerHTML = "<input align='right' id='newdescr"+index+"' value='"+olddescr+"'>";
+    // added to make min/max editable
+    document.getElementById('min'+index).innerHTML = "<input align='right' id='newmin"+index+"' value='"+oldmin+"'>";
+    document.getElementById('max'+index).innerHTML = "<input align='right' id='newmax"+index+"' value='"+oldmax+"'>";
     /*
     //set field for type
@@ -527,6 +549,9 @@
         key2=document.getElementById('2key'+index).innerHTML;
         type=document.getElementById('type'+index).innerHTML;
-        min=document.getElementById('min'+index).innerHTML;
-        max=document.getElementById('max'+index).innerHTML;
+        // changed to make min/max editable
+        //min=document.getElementById('min'+index).innerHTML;
+        //max=document.getElementById('max'+index).innerHTML;
+        min=document.getElementById('newmin'+index).value;
+        max=document.getElementById('newmax'+index).value;
         val="hallo";
         if (type=="bool")
@@ -594,10 +619,10 @@
         }
         // check ranges for int
-        if (type=='int' && parseInt(val)>parseInt(max))
+        if (max && type=='int' && parseInt(val)>parseInt(max))
         {
             alert("You cannot enter a value larger than "+max+".");
             return;
         }
-        if (type=='int' && parseInt(val)<parseInt(min))
+        if (min && type=='int' && parseInt(val)<parseInt(min))
         {
             alert("You cannot enter a value smaller than "+min+".");
@@ -605,10 +630,10 @@
         }
         // check ranges for float
-        if (type=='float' && parseFloat(val)>parseFloat(max))
+        if (max && type=='float' && parseFloat(val)>parseFloat(max))
         {
             alert("You cannot enter a value larger than "+max+".");
             return;
         }
-        if (type=='float' && parseFloat(val)<parseFloat(min))
+        if (min && type=='float' && parseFloat(val)<parseFloat(min))
         {
             alert("You cannot enter a value smaller than "+min+".");
@@ -617,4 +642,5 @@
     }
 
+    /*
     if (!min && (type=='int' || type=='float'))
     {
@@ -627,34 +653,35 @@
         return;
     }
+    */
     //check if min/max have correct type
     //  for string no check needed
     if (updcase==1 || updcase==5)
     {
-        if (type=='int' && parseInt(min)!=min)
+        if (min && type=='int' && parseInt(min)!=min)
         {
             alert("Minimum is not a int.");
             return;
         }
-        if (type=='int' && parseInt(max)!=max)
+        if (max && type=='int' && parseInt(max)!=max)
         {
             alert("Maximum is not a int.");
             return;
         }
-        if (type=='float' && parseFloat(min)!=min)
+        if (min && type=='float' && parseFloat(min)!=min)
         {
             alert("Minimum is not a float.");
             return;
         }
-        if (type=='float' && parseFloat(max)!=max)
+        if (max && type=='float' && parseFloat(max)!=max)
         {
             alert("Maximum is not a float.");
             return;
         }
-        if (type=='float' && parseFloat(max)<parseFloat(min))
+        if (min && max && type=='float' && parseFloat(max)<parseFloat(min))
         {
             alert("Maximum cannot be smaller than minimum.");
             return;
         }
-        if (type=='int' && parseInt(max)<parseInt(min))
+        if (min && max && type=='int' && parseInt(max)<parseInt(min))
         {
             alert("Maximum cannot be smaller than minimum.");
@@ -666,5 +693,5 @@
         +"&fProgram="+prog+"&fKey1="+key1+"&fKey2="+key2+"&fValue="+val+"&fDescription="+descr
         +"&fType="+type+"&fMin="+min+"&fMax="+max;
-    //alert(phpcall);
+    alert(phpcall);
 
     xmlhttp.open("GET", phpcall, false);
@@ -693,4 +720,9 @@
         {
             alert("User name is missing. Please give a user name when logging in.");
+            return;
+        }
+        if (xmlhttp.responseText=="type empty")
+        {
+            alert("Type is missing. Please select a type.");
             return;
         }
@@ -705,5 +737,5 @@
         oldprog=prog;
     else
-        if (progselect.options[progselect.selectedIndex])
+        if (progselect.selectedIndex>=0)
             oldprog=progselect.options[progselect.selectedIndex].value;
         else
@@ -713,8 +745,11 @@
         oldkey=key1+"."+key2;
     else
-        if (keyselect.options[keyselect.selectedIndex])
+        if (keyselect.selectedIndex>=0)
             oldkey=keyselect.options[keyselect.selectedIndex].value;
         else
             oldkey=key1+"."+key2;
+
+    oldprog=prog;
+    oldkey=key1+"."+key2;
     //reload progs and keys
     get_progs(oldprog, "10", "edit");
