Changeset 11992 for trunk/www/db_po/po.js
- Timestamp:
- 09/06/11 22:35:05 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/db_po/po.js
r11976 r11992 84 84 prog="all"; 85 85 else 86 if (progselect. options[progselect.selectedIndex])86 if (progselect.selectedIndex>=0) 87 87 prog=progselect.options[progselect.selectedIndex].value; 88 88 else … … 92 92 key="all"; 93 93 else 94 if (keyselect. options[keyselect.selectedIndex])94 if (keyselect.selectedIndex>=0) 95 95 key=keyselect.options[keyselect.selectedIndex].value; 96 96 else … … 119 119 } 120 120 121 function addRow(addcase, prog, key, key1, key2, type, min, max )121 function addRow(addcase, prog, key, key1, key2, type, min, max, descr) 122 122 { 123 123 if (!prog) … … 157 157 for (var i = 1 ; i <= document.getElementById('maxindex').innerHTML ; i++) 158 158 if(document.getElementById('action'+i)) 159 //document.getElementById('action'+i).innerHTML = "";160 document.getElementById('action'+i).style.display = "none";159 document.getElementById('action'+i).innerHTML = ""; 160 //document.getElementById('action'+i).style.display = "none"; 161 161 162 162 tabBody=document.getElementById("valtable1"); … … 175 175 cell9 = document.createElement("TD"); 176 176 cell10 = document.createElement("TD"); 177 cell11 = document.createElement("TD"); 177 178 var updcase; 178 179 … … 181 182 // 2: add new key, val=NULL, prog=selected 182 183 // 3: add new val, prog=selected, key=selected, type/min/max fixed 184 185 //field descr 186 input4 = document.createElement("INPUT"); 187 input4.style.width = 200; 188 input4.id = 'newdescr0'; 183 189 switch(addcase) 184 190 { … … 253 259 input2.id = '1key0'; 254 260 input2.style.width = 100; 261 if (key1) 262 input2.value = key1; 255 263 cell2.appendChild(input2); 256 264 input10 = document.createElement("INPUT"); 257 265 input10.id = '2key0'; 258 266 input10.style.width = 100; 267 if (key2) 268 input10.value = key2; 259 269 cell10.appendChild(input10); 260 270 //field for val … … 295 305 input8.id = 'newmin0'; 296 306 input8.style.width = 50; 307 if (min) 308 input8.value = min; 297 309 cell8.appendChild(input8); 298 310 //field for max … … 300 312 input9.id = 'newmax0'; 301 313 input9.style.width = 50; 314 if (max) 315 input9.value = max; 302 316 cell9.appendChild(input9); 317 //field for descr 318 if (descr) 319 input4.value = descr; 303 320 break; 304 321 case 3: … … 337 354 } 338 355 339 //field descr 340 input4 = document.createElement("INPUT"); 341 input4.style.width = 200; 342 input4.id = 'newdescr0'; 356 //rest of field descr 343 357 cell4.appendChild(input4); 344 358 //field action … … 365 379 row.appendChild(cell4);//descr 366 380 row.appendChild(cell5);//action 381 row.appendChild(cell11);//user 367 382 tabBody.appendChild(row); 368 383 … … 417 432 for (var i = 1 ; i <= document.getElementById('maxindex').innerHTML ; i++) 418 433 if(document.getElementById('action'+i) && i!=index) 419 document.getElementById('action'+i).style.display = "none"; 434 //document.getElementById('action'+i).style.display = "none"; 435 document.getElementById('action'+i).innerHTML = ""; 420 436 document.getElementById('addrowvals').style.display = "none"; 421 437 document.getElementById('addrowvals2').style.display = "none"; … … 427 443 olddescr=document.getElementById('descr'+index).innerHTML; 428 444 oldtype=document.getElementById('type'+index).innerHTML; 445 // added to make min/max editable 446 oldmin=document.getElementById('min'+index).innerHTML; 447 oldmax=document.getElementById('max'+index).innerHTML; 429 448 if (!oldval) 430 449 delcase=6; … … 448 467 //set field for description 449 468 document.getElementById('descr'+index).innerHTML = "<input align='right' id='newdescr"+index+"' value='"+olddescr+"'>"; 469 // added to make min/max editable 470 document.getElementById('min'+index).innerHTML = "<input align='right' id='newmin"+index+"' value='"+oldmin+"'>"; 471 document.getElementById('max'+index).innerHTML = "<input align='right' id='newmax"+index+"' value='"+oldmax+"'>"; 450 472 /* 451 473 //set field for type … … 527 549 key2=document.getElementById('2key'+index).innerHTML; 528 550 type=document.getElementById('type'+index).innerHTML; 529 min=document.getElementById('min'+index).innerHTML; 530 max=document.getElementById('max'+index).innerHTML; 551 // changed to make min/max editable 552 //min=document.getElementById('min'+index).innerHTML; 553 //max=document.getElementById('max'+index).innerHTML; 554 min=document.getElementById('newmin'+index).value; 555 max=document.getElementById('newmax'+index).value; 531 556 val="hallo"; 532 557 if (type=="bool") … … 594 619 } 595 620 // check ranges for int 596 if ( type=='int' && parseInt(val)>parseInt(max))621 if (max && type=='int' && parseInt(val)>parseInt(max)) 597 622 { 598 623 alert("You cannot enter a value larger than "+max+"."); 599 624 return; 600 625 } 601 if ( type=='int' && parseInt(val)<parseInt(min))626 if (min && type=='int' && parseInt(val)<parseInt(min)) 602 627 { 603 628 alert("You cannot enter a value smaller than "+min+"."); … … 605 630 } 606 631 // check ranges for float 607 if ( type=='float' && parseFloat(val)>parseFloat(max))632 if (max && type=='float' && parseFloat(val)>parseFloat(max)) 608 633 { 609 634 alert("You cannot enter a value larger than "+max+"."); 610 635 return; 611 636 } 612 if ( type=='float' && parseFloat(val)<parseFloat(min))637 if (min && type=='float' && parseFloat(val)<parseFloat(min)) 613 638 { 614 639 alert("You cannot enter a value smaller than "+min+"."); … … 617 642 } 618 643 644 /* 619 645 if (!min && (type=='int' || type=='float')) 620 646 { … … 627 653 return; 628 654 } 655 */ 629 656 //check if min/max have correct type 630 657 // for string no check needed 631 658 if (updcase==1 || updcase==5) 632 659 { 633 if ( type=='int' && parseInt(min)!=min)660 if (min && type=='int' && parseInt(min)!=min) 634 661 { 635 662 alert("Minimum is not a int."); 636 663 return; 637 664 } 638 if ( type=='int' && parseInt(max)!=max)665 if (max && type=='int' && parseInt(max)!=max) 639 666 { 640 667 alert("Maximum is not a int."); 641 668 return; 642 669 } 643 if ( type=='float' && parseFloat(min)!=min)670 if (min && type=='float' && parseFloat(min)!=min) 644 671 { 645 672 alert("Minimum is not a float."); 646 673 return; 647 674 } 648 if ( type=='float' && parseFloat(max)!=max)675 if (max && type=='float' && parseFloat(max)!=max) 649 676 { 650 677 alert("Maximum is not a float."); 651 678 return; 652 679 } 653 if ( type=='float' && parseFloat(max)<parseFloat(min))680 if (min && max && type=='float' && parseFloat(max)<parseFloat(min)) 654 681 { 655 682 alert("Maximum cannot be smaller than minimum."); 656 683 return; 657 684 } 658 if ( type=='int' && parseInt(max)<parseInt(min))685 if (min && max && type=='int' && parseInt(max)<parseInt(min)) 659 686 { 660 687 alert("Maximum cannot be smaller than minimum."); … … 666 693 +"&fProgram="+prog+"&fKey1="+key1+"&fKey2="+key2+"&fValue="+val+"&fDescription="+descr 667 694 +"&fType="+type+"&fMin="+min+"&fMax="+max; 668 //alert(phpcall);695 alert(phpcall); 669 696 670 697 xmlhttp.open("GET", phpcall, false); … … 693 720 { 694 721 alert("User name is missing. Please give a user name when logging in."); 722 return; 723 } 724 if (xmlhttp.responseText=="type empty") 725 { 726 alert("Type is missing. Please select a type."); 695 727 return; 696 728 } … … 705 737 oldprog=prog; 706 738 else 707 if (progselect. options[progselect.selectedIndex])739 if (progselect.selectedIndex>=0) 708 740 oldprog=progselect.options[progselect.selectedIndex].value; 709 741 else … … 713 745 oldkey=key1+"."+key2; 714 746 else 715 if (keyselect. options[keyselect.selectedIndex])747 if (keyselect.selectedIndex>=0) 716 748 oldkey=keyselect.options[keyselect.selectedIndex].value; 717 749 else 718 750 oldkey=key1+"."+key2; 751 752 oldprog=prog; 753 oldkey=key1+"."+key2; 719 754 //reload progs and keys 720 755 get_progs(oldprog, "10", "edit");
Note:
See TracChangeset
for help on using the changeset viewer.