[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-internet/sources/www/se3/se3-internet/ -> connexions_plages.js (source)

   1  /**
   2     * Page pour fixer les plages horaires du squidguard sur le proxy
   3     * @Version $Id: connexions_plages.js 3462 2009-01-08 16:26:38Z misterT $
   4     
   5     * @Projet LCS-SE3
   6     * @auteurs MrT
   7     * @Licence Distribue sous  la licence GPL
   8  */
   9  
  10  /**    
  11      * @Repertoire se3-internet/
  12      * file connexions_plages.js
  13  */    
  14  	function readConf() {
  15          new Ajax.Request('/cgi-bin/getSquidConf',{ method: 'post', onComplete: function(requester) {
  16                  var rep = requester.responseText;
  17          rep = rep.replace(/[\n]/gi,"<br />");
  18          rep = rep.replace(/[\t]/gi,"&nbsp;&nbsp;&nbsp;&nbsp;");
  19          $('container').innerHTML= '<br /><br /><strong>CONFIGURATION GENEREE:</strong><br /><br />'+rep+'<br /><A target="main" href="config_time.php">Retour</A>';
  20  
  21          }});
  22      }
  23  
  24  	function saveModifs() {
  25          
  26          listeFrom = document.getElementsByClassName('from');
  27          listeTo = document.getElementsByClassName('to');
  28          listeDays = document.getElementsByClassName('days');
  29          for (var i=0;i<listeFrom.length;i++) {
  30              var url = './getTimes.php';
  31              var params = '?mode=update&id_hor='+encodeURI(listeFrom[i].id)+'&from='+encodeURI(listeFrom[i].value)+'&to='+encodeURI(listeTo[i].value)+'&days='+encodeURI(listeDays[i].value);
  32              new Ajax.Request(url,{ method: 'post', parameters: params, onComplete: function(requester) { 
  33                  //update();
  34              }});
  35          }        
  36      }
  37  
  38  
  39  	function update() {
  40  
  41          if ($('save_modifs')) {
  42              Event.observe($('save_modifs'),'click',saveModifs,false);
  43          }
  44  
  45          var liste1 = document.getElementsByClassName('add_cren');
  46          if (liste1.length) {
  47              liste1[0].onclick= function() {
  48                  var id = this.id;
  49                  
  50                  var de=$('new_from').value;
  51                  var a=$('new_to').value;
  52                  var jours=$('new_days').value;
  53                  var params='?mode=add_cren&plage='+id+'&from='+de+'&to='+a+'&days='+jours;
  54              
  55                  var url = 'getTimes.php';
  56                          new Ajax.Request(url,{ method: 'post', parameters: params, onComplete: function(requester) {
  57                              var params = '?mode=modify&plage='+id;
  58                              var url = 'getTimes.php';
  59                              new Ajax.Updater('container',url,{ method: 'post', parameters: params, onComplete: function(requester) {
  60                                  update();
  61                              }});
  62  
  63                          }});
  64  
  65              }
  66          }
  67          
  68          var liste1 = document.getElementsByClassName('del_cren');
  69          for (var i=0; i<liste1.length; i++) {
  70              liste1[i].onclick = function() {
  71                  var id=this.id;
  72                  var plage ='plage_'+$('nom_plage').innerHTML.stripTags();
  73                  
  74                  
  75                  var params='?mode=del_cren&id='+id;
  76                  var url = 'getTimes.php';
  77                          new Ajax.Request(url,{ method: 'post', parameters: params, onComplete: function(requester) {
  78                              var params = '?mode=modify&plage='+plage;
  79                              var url = 'getTimes.php';
  80                              new Ajax.Updater('container',url,{ method: 'post', parameters: params, onComplete: function(requester) {
  81                                  update();
  82                              }});
  83  
  84                          }});
  85                  
  86  
  87              }
  88          }
  89  
  90  
  91          
  92  
  93          $('btn_add_plage').onclick = function() {
  94                  var params= '?mode=add_plage&new_plage='+$('new_plage').value;
  95                  var url = 'getTimes.php';
  96                  new Ajax.Request(url,{ method: 'post', parameters: params, onComplete: function(requester) {
  97                          
  98                          var params = '?mode=show_plages';
  99                          var url = 'getTimes.php';
 100                          new Ajax.Updater('container',url,{ method: 'post', parameters: params, onComplete: function(requester) {
 101                              update();
 102                          }});
 103  
 104                  }});
 105                  return true
 106  
 107  
 108          }
 109  
 110          var liste = document.getElementsByClassName('link_delete');
 111              
 112                              for (var i=0; i<liste.length; i++) {
 113                                  liste[i].onclick = function() {
 114                                      var params = '?mode=delete&plage='+this.id;
 115                                      var url = 'getTimes.php';
 116  
 117                                      new Ajax.Request(url,{ method: 'post', parameters: params, onComplete: function(requester) {
 118                                          var params = '?mode=show_plages';
 119                                          var url = 'getTimes.php';
 120                                          new Ajax.Updater('container',url,{ method: 'post', parameters: params, onComplete: function(requester) {
 121                                              update();
 122                                          }});
 123  
 124                                      }});
 125  
 126                                      return true
 127                                  }
 128                  
 129                              }
 130  
 131                              var liste = document.getElementsByClassName('link_modify');
 132                              for (var i=0; i<liste.length; i++) {
 133                                  liste[i].onclick = function() {
 134                                      var params = '?mode=modify&plage='+this.id;
 135                                      var url = 'getTimes.php';
 136                                      new Ajax.Updater('container',url,{ method: 'post', parameters: params, onComplete: function(requester) {
 137                                          update();
 138                                      }});
 139                                      return true
 140                                  }
 141                              }    
 142      
 143      
 144  
 145      }
 146  
 147  
 148  	function init() {
 149          //recupérer les plages SQL et les afficher au fur et à mesure
 150          var params = '?mode=show_plages';
 151          var url = 'getTimes.php';
 152          new Ajax.Updater('container',url,{ method: 'post', parameters: params, onComplete: function(requester) {
 153              update();
 154              
 155  
 156          }});
 157      }
 158      Event.observe(window,'load',init,false);
 159  


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1