home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 February (DVD) / PCWorld_2008-02_DVD.iso / v cisle / PHP / PHP.exe / EasyPHP-2.0b1-setup.exe / {app} / sqlitemanager / include / function.js < prev    next >
Encoding:
Text File  |  2006-04-18  |  3.5 KB  |  130 lines

  1. function setCheckBox(form, name, value){
  2.     elts = document.forms[form].elements;
  3.     if(typeof(elts)!='undefined'){
  4.         for(var i=0 ; i < elts.length ; i++) {
  5.             if(elts[i].name.indexOf(name)!=-1) elts[i].checked = value; 
  6.         }
  7.     }
  8. }
  9.  
  10. function cleanNullField(form, name){
  11.     elts = document.forms[form].elements;
  12.     if(typeof(elts)!='undefined'){
  13.         for(var i=0 ; i < elts.length ; i++) {
  14.             if(elts[i].name.indexOf(name)!=-1) elts[i].value = ''; 
  15.         }
  16.     }
  17. }
  18.  
  19. function setTableAction(form, index, action){
  20.     document.forms[form].elements['modify['+index+']'].checked=true;
  21.     document.forms[form].action.value=action;
  22.     document.forms[form].submit();
  23. }
  24.  
  25. function afficheCalque(calque){
  26.     if (document.getElementById){
  27.         document.getElementById(calque).style.visibility="visible";
  28.     } else {
  29.         eval(layerRef + '["' + calque +'"]' + styleRef + '.visibility = "visible"');
  30.     }
  31. }
  32.  
  33. function cacheCalque(calque){
  34.     if (document.getElementById){
  35.         document.getElementById(calque).style.visibility="hidden";
  36.     } else {
  37.         eval(layerRef + '["' + calque +'"]' + styleRef + '.visibility = "hidden"');
  38.     }
  39. }
  40.  
  41. function ftype(){
  42.     if(document.functprop.FunctType.selectedIndex==0){
  43.         cacheCalque('Pfinal1');
  44.         cacheCalque('Pfinal2');
  45.     } else {
  46.         afficheCalque('Pfinal1');
  47.         afficheCalque('Pfinal2');
  48.     }
  49. }
  50.  
  51. function checkPath(){
  52.     if(document.database.dbRealpath.value){
  53.         document.database.dbpath.value = document.database.dbRealpath.value;
  54.         document.database.dbRealpath.value = '';
  55.     }
  56. }
  57.  
  58. var tabRow = new Array;
  59. function setRowColor(RowObj, numRow, Action, OrigColor, OverColor, ClickColor, bUseClassName){
  60.     if (typeof(document.getElementsByTagName) != 'undefined') TheCells = RowObj.getElementsByTagName('td');
  61.     else return false;
  62.     if(!in_array(numRow, tabRow)){
  63.         if(Action=='over') setColor = OverColor;
  64.         else if(Action == 'out') setColor = OrigColor;
  65.         else if(Action == 'click') {
  66.             setColor = ClickColor;
  67.             tabRow.push(numRow);
  68.         }        
  69.     } else if(Action == 'click'){
  70.         tabIndex = in_array(numRow, tabRow);
  71.         if(tabIndex>0) {
  72.             tabRow[(tabIndex-1)] = '';
  73.             setColor = OrigColor;
  74.         }
  75.     } else return;
  76.     for(i=0 ; i<TheCells.length ; i++)
  77.     if (bUseClassName) {
  78.       if (bUseClassName && TheCells[i].className != setColor) 
  79.         TheCells[i].className = setColor; 
  80.     } else
  81.       if (TheCells[i].style.backgroundColor != setColor)
  82.         TheCells[i].style.backgroundColor = setColor; 
  83.     return;
  84. }
  85.  
  86. function in_array(needle, haystack){
  87.     for(i=0 ; i<haystack.length ; i++) 
  88.         if(haystack[i] == needle) return (i+1);
  89.     return false;
  90. }
  91.  
  92. function insertColumn(){
  93.     sourceSel = document.sql.columnTable;
  94.     destSQL = document.sql.DisplayQuery;
  95.     var i=sourceSel.options.length;
  96.     var first = true;
  97.     var stringToDisplay='';
  98.     while(i >= 0){
  99.         if(sourceSel.options[i] && sourceSel.options[i].selected){
  100.             if(first) {
  101.                 stringOut = '';
  102.                 first = false;
  103.             } else {
  104.                 stringOut = ', ';            
  105.             }
  106.             stringToDisplay += stringOut+sourceSel.options[i].value;
  107.             sourceSel.options[i].selected = false;
  108.         }    
  109.         i--;        
  110.     }
  111.     if(document.selection){
  112.         destSQL.focus();
  113.         selection = document.selection.createRange();
  114.         if (selection.findText('*'))
  115.           selection.text = stringToDisplay;
  116.         else if (selection.findText(' FROM'))
  117.           selection.text = ', '+stringToDisplay+' FROM';
  118.     else
  119.       selection.text = stringToDisplay;
  120.     selection.empty();
  121.          document.sql.insertButton.focus();
  122.     } else if(destSQL.selectionStart || destSQL.selectionStart == '0'){
  123.         destSQL.value = destSQL.value.substring(0, destSQL.selectionStart)
  124.                         + stringToDisplay
  125.                         + destSQL.value.substring(destSQL.selectionEnd, destSQL.value.length);
  126.     } else {
  127.         destSQL += stringToDisplay;
  128.     }
  129. }
  130.