Index: /trunk/www/db_po/get_values.php
===================================================================
--- /trunk/www/db_po/get_values.php	(revision 11988)
+++ /trunk/www/db_po/get_values.php	(revision 11989)
@@ -45,12 +45,15 @@
 
     //get key1 and key2 separately from DB (for function AddRow())
-    $query2 = "SELECT fKey1, SUBSTRING(fKey2,2), fType, fMin, fMax FROM ProgramOption WHERE Concat(fKey1,fKey2)='".$_GET["fKey"]."'";
+    $query2  = "SELECT fKey1, SUBSTRING(fKey2,2), fType, fMin, fMax, fDescription ";
+    $query2 .= "FROM ProgramOption WHERE Concat(fKey1,fKey2)='".$_GET["fKey"]."' ORDER BY fValidFrom DESC LIMIT 0,1";
     $result2=mysql_query($query2, $db_id);
     $row2 = mysql_fetch_row($result2);
-    $key1=$row2[0];
-    $key2=$row2[1];
-    $type=$row2[2];
-    $min=$row2[3];
-    $max=$row2[4];
+    //get values from result
+    $key1  =$row2[0];
+    $key2  = $row2[1];
+    $type  = $row2[2];
+    $min   = $row2[3];
+    $max   = $row2[4];
+    $descr = $row2[5];
     mysql_free_result($result2);
 
@@ -78,6 +81,6 @@
         printf("<button onClick='ShowCurrent();' id='showcurrent' style='display:none'>Show Current</button>\n");
         printf("<button onClick='ShowAll();' id='showall' style='display:inline'>Show History</button>\n");
-        printf("<button onClick='addRow(3, \"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals' style='display:inline'>Add Value</button>\n",
-               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type, $min, $max);
+        printf("<button onClick='addRow(3, \"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals' style='display:inline'>Add Value</button>\n",
+               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type, $min, $max, $descr);
     }
 
@@ -145,5 +148,13 @@
             {
                 if ($row0[6]==$counter)
-                    printf("<td id='action%s'><input type='button' value='Edit' onclick='EditRow(\"%s\")'></td>\n", $row0[0], $row0[0]);
+                {
+                    printf("<td id='action%s'>\n", $row0[0]);
+                    printf("<input type='button' value='Edit' onclick='EditRow(\"%s\")'>\n", $row0[0]);
+                    printf("<input type='button' value='Copy Key' onclick='addRow(2,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='copyval' style='display:inline'>\n",
+                           $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type, $min, $max, $descr);
+                    //missing here descr(, key1, key2, val?)
+                    // in po.js: add descr, key1, key2, min, max in AddRow
+                    printf("</td>\n");
+                }
                 else
                     printf("<td id='action%s'></td>\n", $row0[0]);
@@ -160,6 +171,6 @@
         printf("<button onClick='ShowCurrent();' id='showcurrent2' style='display:none'>Show Current</button>\n");
         printf("<button onClick='ShowAll();' id='showall2' style='display:inline'>Show History</button>\n");
-        printf("<button onClick='addRow(3,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals2' style='display:inline'>Add Value</button>\n",
-               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type, $min, $max);
+        printf("<button onClick='addRow(3,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\");' id='addrowvals2' style='display:inline'>Add Value</button>\n",
+               $_GET["fProgram"], $_GET["fKey"], $key1, $key2, $type, $min, $max, $descr);
     }
     /*
