/[openfoncier]/trunk/app/consultation_multiple.php
ViewVC logotype

Diff of /trunk/app/consultation_multiple.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 572 by vpihour, Wed Oct 31 15:34:17 2012 UTC revision 606 by vpihour, Tue Nov 6 09:57:46 2012 UTC
# Line 85  Line 85 
85                      $textIdsConsultations .= "&idxConsultations[]=$value";                      $textIdsConsultations .= "&idxConsultations[]=$value";
86                                    
87                  echo "                  echo "
88                      <script>                      <script language='javascript' type='text/javascript'>
89                          $.download('../app/pdfetat.php','obj=$obj$textIdsConsultations', 'POST', $obj);                          $.download('../app/pdfetat.php','obj=$obj$textIdsConsultations', 'POST', $obj);
90                      </script>                      </script>
91                  ";                  ";
92              }              }
93              /*Affichage du message d'information*/              /*Affichage du message d'information*/
94              $f->displayMessage("valid", count($donnees)._(' service(s) s&eacute;lectionn&eacute;(s) dont ').$nbConsPap._(' consultation(s) papier.'));              $f->displayMessage("valid", count($donnees)._(' service(s) selectionne(s) dont ').$nbConsPap._(' consultation(s) papier.'));
95          }          }
96                    
97      }      }
# Line 131  Line 131 
131                      $row['them_lib'].                      $row['them_lib'].
132                  '</div>                  '</div>
133                      <div                      <div
134                          class="liste_gauche_service '.$name.'"                          class="liste_gauche_service t'.$name.'"
135                          id="'.$name.'" >                          id="t'.$name.'" >
136                          '.$row['ser_lib'].'                          '.$row['ser_lib'].'
137                          <input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/>                          <input class="t'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked="checked"' ).'/>
138                      </div>                      </div>
139                  ';                  ';
140              }              }
# Line 144  Line 144 
144                                    
145                  $liste_gauche .= '                  $liste_gauche .= '
146                      <div                      <div
147                          class="liste_gauche_service '.$name.'"                          class="liste_gauche_service t'.$name.'"
148                          id="'.$name.'" >                          id="t'.$name.'" >
149                          '.$row['ser_lib'].'                          '.$row['ser_lib'].'
150                          <input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/>                          <input class="t'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked="checked"' ).'/>
151                      </div>                      </div>
152                  ';                  ';
153              }              }
# Line 184  Line 184 
184                      (($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_';                      (($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_';
185              $liste_gauche .= '              $liste_gauche .= '
186                  <div                  <div
187                      class="liste_gauche_service '.$name.'"                      class="liste_gauche_service t'.$name.'"
188                      id="'.$name.'" >                      id="t'.$name.'" >
189                      '.$row['libelle'].'&nbsp;                      '.$row['libelle'].'&nbsp;
190                      <input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/>                      <input class="t'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked="checked"' ).'/>
191                  </div>                  </div>
192              ';              ';
193          }          }
# Line 204  Line 204 
204              echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;"              echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;"
205                    method="get" action="" name="f2" id="form_val">';                    method="get" action="" name="f2" id="form_val">';
206                  echo '<div class="formEntete ui-corner-all">';                  echo '<div class="formEntete ui-corner-all">';
207                      echo "<div id='form-content'>";                      echo "<div>";
208                          echo '<div class="bloc">';                          echo '<div class="bloc">';
209                              echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n";                              echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n";
210                                  echo "\t<legend class='ui-corner-all ui-widget-content ui-state-active'>".                                  echo "\t<legend class='ui-corner-all ui-widget-content ui-state-active'>".
211                                      _("Consultation par th&eacute;matique ")."</legend>";                                      _("Consultation par thematique ")."</legend>";
212                                  echo "<div class='fieldsetContent' style='width:100%'>";                                  echo "<div class='fieldsetContent' style='width:100%'>";
213                                      echo '<div class="field-ser-them field-type-hiddenstatic">';                                      echo '<div class="field-ser-them field-type-hiddenstatic">';
214                                          echo '<div class="form-libelle">';                                          echo '<div class="form-libelle">';
# Line 218  Line 218 
218                                              echo '</label>';                                              echo '</label>';
219                                          echo '</div>';                                          echo '</div>';
220                                          echo '<div class="form-content">';                                          echo '<div class="form-content">';
221                                              echo '<input id="dossier" class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier">';                                              echo '<input class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier"/>';
222                                              echo $idx;                                              echo $idx;
223                                          echo '</div>';                                          echo '</div>';
224                                      echo '</div>';                                      echo '</div>';
# Line 238  Line 238 
238                                              echo '</ul>';                                              echo '</ul>';
239                                          echo '</div>';                                          echo '</div>';
240                                          echo '<div class="list-sel-ser-them">';                                          echo '<div class="list-sel-ser-them">';
241                                                echo '<div class=\'row\'>';
242                                                    echo '<div class=\'cell1 liste_droite_title list-sel-ser-them-title\'>'._('Service a consulter').'</div>';
243                                                    echo '<div class=\'cell2 liste_droite_title list-sel-ser-them-title\'>'._('Version papier').'</div>';
244                                                echo '</div>';
245                                          echo '</div>';                                          echo '</div>';
246                                      echo '</div>';                                      echo '</div>';
247                                      /* -- FIN --*/                                      /* -- FIN --*/
# Line 262  Line 266 
266                  echo '</div>';                  echo '</div>';
267                  echo '<div class="formControls">';                  echo '<div class="formControls">';
268                      echo '<input class="om-button ui-button ui-widget ui-state-default ui-corner-all"                      echo '<input class="om-button ui-button ui-widget ui-state-default ui-corner-all"
269                            type="button" onclick="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');"                            type="button" onclick="if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { ajaxIt(\'consultation\', \'../app/consultation_multiple.php\'); } else alert(\'Veuillez choisir au moins un service et une date d envoi\');"
270                            value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'"                            value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'"
271                            role="button" aria-disabled="false" id="button_val">';                            id="button_val">';
272                      echo '<a class="retour" onclick="ajaxIt(\'consultation\', \'../scr/soustab.php?obj='.$obj.'&retourformulaire='.$retourformulaire.'&idxformulaire='.$idx.'&premier=0&tricol=\');"                      echo '<a class="retour" onclick="ajaxIt(\'consultation\', \'../scr/soustab.php?obj='.$obj.'&retourformulaire='.$retourformulaire.'&idxformulaire='.$idx.'&premier=0&tricol=\');"
273                            href="#">';                            href="#">';
274                         echo 'Retour';                         echo 'Retour';
# Line 274  Line 278 
278          echo '</div>';          echo '</div>';
279                    
280          echo "          echo "
281          <script>          <script language='javascript' type='text/javascript'>
282              $(function(){              $(function(){
283                    
284                  /*                  /*
285                      Sélectionne tous les services d'un thème au clique sur celui ci.                      Sélectionne tous les services d'un thème au clique sur celui ci.
286                  */                  */
# Line 283  Line 288 
288                      function(){                      function(){
289                                                    
290                          var id = $(this).attr('id').split('_')[1];                          var id = $(this).attr('id').split('_')[1];
291                            var numSer = 0;
292                            var numSerWithClass = 0;
293                            
294                          $('.list-ser-them div').each(                          $('.list-ser-them div').each(
295                              function() {                              function() {
296                                            
297                                    if ( $(this).attr('id').indexOf('them') == -1 &&
298                                         $(this).attr('id').indexOf(id) == 1  &&
299                                         $(this).hasClass('liste_gauche_service_selected') )
300                                        
301                                         numSerWithClass++;                                    
302                                                                    
303                                  if ( $(this).attr('id').indexOf('them') == -1 &&                                  if ( $(this).attr('id').indexOf('them') == -1 &&
304                                       $(this).attr('id').indexOf(id) == 0 ){                                       $(this).attr('id').indexOf(id) == 1  )
305                                      $(this).toggleClass('liste_gauche_service_selected');                                      
306                                  }                                      numSer++;
307                              }                              }
308                          );                          );
309                            
310                            if ( numSerWithClass < numSer && numSerWithClass >= 0 ){
311                            
312                                 $('.list-ser-them div').each(
313                                    function() {
314                                        
315                                        if ( $(this).attr('id').indexOf('them') == -1 &&
316                                         $(this).attr('id').indexOf(id) == 1 &&
317                                         !$(this).hasClass('liste_gauche_service_selected') )
318                                        
319                                            $(this).addClass('liste_gauche_service_selected');
320                                    }
321                                );
322                            }
323                            
324                            else {
325                                
326                                $('.list-ser-them div').each(
327                                    function() {
328                                        
329                                       if ( $(this).attr('id').indexOf('them') == -1 &&
330                                        $(this).attr('id').indexOf(id) == 1  &&
331                                        $(this).hasClass('liste_gauche_service_selected') )
332                                        
333                                           $(this).removeClass('liste_gauche_service_selected');
334                                    }
335                               );
336                            }
337                      }                      }
338                  );                  );
339                                    
# Line 309  Line 351 
351                  */                  */
352                  $('.field-ser-them').on(                  $('.field-ser-them').on(
353                      'click',                      'click',
354                      '.liste_droite_service',                      '.cell1',
355                      function(){                      function(){
356                          $(this).toggleClass('liste_droite_service_selected');                          if ( !$(this).hasClass('liste_droite_title') )
357                                $(this).parent().toggleClass('liste_droite_service_selected');
358                      }                      }
359                  );                  );
360                                    
# Line 320  Line 363 
363                      'input[type=checkbox]',                      'input[type=checkbox]',
364                      function(){                      function(){
365                                                    
366                          old_id = $(this).attr('id');                          old_id = $(this).attr('class');
367                                                    
368                          tab_don = old_id.split('_');                          tab_don = old_id.split('_');
369                                                    
370                          new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[2] == 0 ) ? 1 : 0 ) + '_';                          new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[2] == 0 ) ? 1 : 0 ) + '_';
371    
372                          changeOneData( ';' + tab_don[1] + '_' + tab_don[2], ';' + tab_don[1] + '_' + ((tab_don[2] == 0) ? 1 : 0) );                          changeOneData( ';' + tab_don[1] + '_' + tab_don[2], ';' + tab_don[1] + '_' + ((tab_don[2] == 0) ? 1 : 0) );
373                          $('div[name=\"' + $(this).attr('class') + '\"]').attr('id', new_id);                          $('div[class=\"' + old_id + '\"]').attr('class', new_id);
374                          $(this).attr('id', new_id);                          $(this).attr('class', new_id);
375    
376                      }                      }
377                  );                  );
# Line 342  Line 385 
385                          $('.liste_gauche_service_selected').each(                          $('.liste_gauche_service_selected').each(
386                              function(i) {                              function(i) {
387                                                                    
388                                  var id = $(this).attr('id');                                  var name = $(this).attr('name');
                                   
389                                                                    
390                                  if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 )                                  if ( listServ.length > 0 && listServ.indexOf(name.split('_')[1]) != -1 )
391                                      return;                                      return;
392                                  listServ[i] = id.split('_')[1];                                  listServ[i] = name.split('_')[1];
393                                  data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ;                                  data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ;
394                                                                    
395                              }                              }
396                          );                          );
# Line 378  Line 420 
420                          $('.liste_droite_service_selected').each(                          $('.liste_droite_service_selected').each(
421                              function() {                              function() {
422                                                                    
423                                  var id = $('#'+ $(this).attr('id') + ' .cell1 div').attr('id');                                  var name = $('#'+ $(this).attr('id') + ' .cell1 div').attr('name');
424                                                                    
425                                  manageListServ('.list-ser-them div', id, 1);                                  manageListServ('.list-ser-them div', name, 1);
426                                  data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ;                                  data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ;
427                                                                    
428                                  $(this).remove();                                  $(this).remove();
429                              }                              }
# Line 403  Line 445 
445              /*              /*
446                  Affiche ou cache un élément qui n'est pas une thématique et dont son identifiant correspond.                  Affiche ou cache un élément qui n'est pas une thématique et dont son identifiant correspond.
447              */              */
448              function manageListServ( objet ,id, type){              function manageListServ( objet , name, type){
449            
450                  $(objet).each(                  $(objet).each(
451                      function() {                      function() {
452                                                    
453                          if ( isNotthemIsOneServ(this, id) ){                          if ( isNotthemIsOneServ(this, name) ){
454                              if ( type == 0 )                              if ( type == 0 )
455                                                            
456                                  $(this).hide() ;                                  $(this).hide() ;
# Line 427  Line 469 
469                  );                  );
470              }              }
471                            
472                /*
473                    Change les actions qui sont réalisées lors de la soumission du formulaire
474                */
475              function changeActionVal(data){              function changeActionVal(data){
476                  date = $('#date_envoi').val();                  date = $('#date_envoi').val();
477                                    
478                  $('#form_val').attr(                  $('#form_val').attr(
479                      'onsubmit',                      'onsubmit',
480                      'if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?obj=$obj&data='+data+'&idx=$idx&date_envoi='+date+'\',true);return false;' +                      'if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?obj=$obj&data='+data+'&idx=$idx&date_envoi='+date+'\',true);return false;' +
481                      'messageIt(\'consultation\', \'../scr/soustab.php?obj=$obj&retourformulaire=$retourformulaire&idxformulaire=$idx&premier=0&tricol=\',false);} else alert(\'Veuillez choisir une service et une date d envoi\');'                      'messageIt(\'consultation\', \'../scr/soustab.php?obj=$obj&retourformulaire=$retourformulaire&idxformulaire=$idx&premier=0&tricol=\',false);} else alert(\'Veuillez choisir au moins un service et une date d envoi\');'
482                                            
483                  );                  );
484                  $('#button_val').attr(                  $('#button_val').attr(
485                      'onclick',                      'onclick',
486                      'if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?obj=$obj&data='+data+'&idx=$idx&date_envoi='+date+'\',true);' +                      'if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?obj=$obj&data='+data+'&idx=$idx&date_envoi='+date+'\',true);' +
487                      'messageIt(\'consultation\', \'../scr/soustab.php?obj=$obj&retourformulaire=$retourformulaire&idxformulaire=$idx&premier=0&tricol=\',false);} else alert(\'Veuillez choisir une service et une date d envoi\');'                      'messageIt(\'consultation\', \'../scr/soustab.php?obj=$obj&retourformulaire=$retourformulaire&idxformulaire=$idx&premier=0&tricol=\',false);} else alert(\'Veuillez choisir au moins un service et une date d envoi\');'
488                                            
489                  );                  );
490              }              }
491                
492                /*
493                    Change les actions qui sont réalisées lors de la soumission du formulaire
494                */
495              function changeOneData( oldData, newData) {              function changeOneData( oldData, newData) {
496                                    
497                  date = $('#date_envoi').val();                  date = $('#date_envoi').val();
# Line 467  Line 515 
515                      $('.list-sel-ser-them').empty();                      $('.list-sel-ser-them').empty();
516                      $('.list-sel-ser-them').append(''+                      $('.list-sel-ser-them').append(''+
517                                  '<div class=\'row\'>'+                                  '<div class=\'row\'>'+
518                                      '<div class=\'cell1\' id=\'list-sel-ser-them-title\'>"._('Service à consulter')."</div>'+                                      '<div class=\'cell1 liste_droite_title list-sel-ser-them-title\'>"._('Service a consulter')."</div>'+
519                                      '<div class=\'cell2\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+                                      '<div class=\'cell2 liste_droite_title list-sel-ser-them-title\'>"._('Version papier')."</div>'+
520                                  '</div>') ;                                  '</div>') ;
521                  }                  }
522                                    
523                  $('.liste_gauche_service_selected').each(                  $('.liste_gauche_service_selected').each(
524                      function(i) {                      function(i) {
525                                                    
526                            var id = $(this).attr('id');
527                            data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ;
528                            
529                          if ( !$(this).is(':visible') )                          if ( !$(this).is(':visible') )
530                              return;                              return;
                               
                         var id = $(this).attr('id');  
531                                                    
532                          if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 )                          if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 )
533                              return;                              return;
534                          listServ[i] = id.split('_')[1];                          listServ[i] = id.split('_')[1];
535                          data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ;                          
536                                                    
537                          $('.list-sel-ser-them').append(                          $('.list-sel-ser-them').append(
538                              '<div class=\'row liste_droite_service\' id=\'' + i + '\'>'+                              '<div id=\'s' + i + '\' class=\'row liste_droite_service\'>'+
539                                  '<div class=\'cell1\'>'+                                  '<div class=\'cell1\'>'+
540                                      '<div name=\'' + $(this).attr('id') + '\' id=\'' + $(this).attr('id') + '\'>'+                                      '<div class=\'' + $(this).attr('id') + '\' name=\'' + $(this).attr('id') + '\'>'+
541                                          $(this).html().split('<')[0]+                                          $(this).html().split('<')[0]+
542                                      '</div>'+                                      '</div>'+
543                                  '</div>' +                                  '</div>' +

Legend:
Removed from v.572  
changed lines
  Added in v.606

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26