[ Index ]
 

Code source de WebCalendar 1.0.5

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables | Statistiques

title

Body

[fermer]

/includes/js/ -> usersel.php (source)

   1  <?php
   2      global $form,$listid,$groups;
   3      if (preg_match("/\/includes\//", $PHP_SELF)) {
   4          die ("You can't access this file directly!");
   5      }
   6      $form = clean_word($form);
   7      $listid = clean_int($listid);
   8  ?>
   9  <script type="text/javascript">
  10  <!-- <![CDATA[
  11  function OkButton () {
  12    var parentlist = window.opener.document.<?php echo $form?>.elements[<?php echo $listid?>];
  13    var thislist = document.userselform.elements[0];
  14  
  15    var found = "";
  16  
  17    // select/deselect all elements
  18    for ( i = 0; i < parentlist.length; i++ ) {
  19      var state = false;
  20      for ( j = 0; j < thislist.length; j++ ) {
  21        if ( thislist.options[j].value == parentlist.options[i].value ) {
  22          state = thislist.options[j].selected;
  23          found += " " + thislist.options[j].value;
  24        }
  25      }
  26      parentlist.options[i].selected = state;
  27    }
  28    //alert ( "Found: " + found );
  29    window.close ();
  30  }
  31  
  32  function selectAll() {
  33    var list = document.userselform.elements[0];
  34    var i;
  35    for ( i = 0; i < list.options.length; i++ ) {
  36      list.options[i].selected = true;
  37    }
  38  }
  39  
  40  function selectNone() {
  41    var list = document.userselform.elements[0];
  42    var i;
  43    for ( i = 0; i < list.options.length; i++ ) {
  44      list.options[i].selected = false;
  45    }
  46  }
  47  
  48  // set the state (selected or unselected) if a single
  49  // user in the list of users
  50  function selectByLogin ( login, state ) {
  51    //alert ( "selectByLogin ( " + login + ", " + state + " )" );
  52    var list = document.userselform.elements[0];
  53    var i;
  54    for ( i = 0; i < list.options.length; i++ ) {
  55      //alert ( "text: " + list.options[i].text );
  56      if ( list.options[i].value == login ) {
  57        list.options[i].selected = state;
  58        return;
  59      }
  60    }
  61  }
  62  
  63  function toggleGroup ( state ) {
  64    var list = document.userselform.elements[4];
  65    var selNum = list.selectedIndex;
  66    <?php
  67    for ( $i = 0; $i < count ( $groups ); $i++ ) {
  68      print "\n  if ( selNum == $i ) {\n";
  69      $res = dbi_query ( "SELECT cal_login from webcal_group_user " .
  70        "WHERE cal_group_id = " . $groups[$i]["cal_group_id"] );
  71      if ( $res ) {
  72        while ( $row = dbi_fetch_row ( $res ) ) {
  73          print "    selectByLogin ( \"$row[0]\", state );\n";
  74        }
  75        dbi_free_result ( $res );
  76        print "  }\n";
  77      }
  78    }
  79    ?>
  80  }
  81  
  82  // Select users from a group
  83  function selectGroupMembers () {
  84    toggleGroup ( true );
  85  }
  86  
  87  // De-select users from a group
  88  function deselectGroupMembers () {
  89    toggleGroup ( false );
  90  }
  91  //]]> -->
  92  </script>


Généré le : Fri Nov 30 19:09:19 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics