WebCalendar PHP Cross Reference Groupware Applications

Source: /catsel.php - 103 lines - 3150 bytes - Summary - Text - Print

   1  <?php
   2  /* $Id: catsel.php,v 1.22.2.3 2008/02/08 04:27:05 cknudsen Exp $ */
   3  include_once  'includes/init.php';
   4  
   5  // load user and global cats
   6  load_user_categories ();
   7  
   8  $catList = $catNames = $error = '';
   9  
  10  if ( $CATEGORIES_ENABLED == 'N' )
  11    exit;
  12  
  13  $cats = getGetValue ( 'cats' );
  14  $form = getGetValue ( 'form' );
  15  
  16  $eventcats = explode ( ',', $cats );
  17  
  18  $availCatStr = translate ( 'AVAILABLE CATEGORIES' );
  19  $availCatFiller = str_repeat( '&nbsp;', ( 30 - strlen ( $availCatStr ) ) / 2 );
  20  if ( strlen ( $availCatStr ) < 30 )
  21    $availCatStr = $availCatFiller . $availCatStr . $availCatFiller ;
  22  
  23  $entryCatStr = translate ( 'ENTRY CATEGORIES' );
  24  $entryCatFiller = str_repeat( '&nbsp;', ( 30 - strlen ( $entryCatStr ) ) / 2 );
  25  if ( strlen ( $entryCatStr ) < 30 )
  26    $entryCatStr = $entryCatFiller . $entryCatStr . $entryCatFiller ;
  27  
  28  print_header ( array ( 'js/catsel.php/false/' . $form ),
  29    '', '', true, false, true );
  30  
  31  ob_start ();
  32  
  33  echo '
  34      <table align="center" border="0" width="90%">
  35        <tr>
  36          <th colspan="3">' . translate ( 'Categories' ) . '</th>
  37        </tr>
  38        <form action="" method="post" name="editCategories" '
  39   . 'onSubmit="sendCats( this )">
  40        <tr>
  41          <td valign="top">';
  42  
  43  if ( ! empty ( $categories ) ) {
  44    echo '
  45            <select name="cats[]" size="10">
  46              <option disabled>' . $availCatStr . '</option>';
  47  
  48    foreach ( $categories as $K => $V ) {
  49      // None is index -1 and needs to be ignored
  50      if ( $K > 0 && ( $V['cat_owner'] == $login || $is_admin ||
  51          substr ( $form, 0, 4 ) == 'edit' ) ) {
  52        $tmpStr = $K . '" name="' . $V['cat_name'] . '">' . $V['cat_name'];
  53        echo '
  54              <option value="' . ( empty ( $V['cat_owner'] )
  55          ? "-$tmpStr" . '<sup>*</sup>' : $tmpStr ) . '</option>';
  56      }
  57    }
  58    echo '
  59            </select>';
  60  }
  61  echo '
  62          </td>
  63          <td valign="center"><input type="button" value=">>" onclick="selAdd()"'
  64   . ' /></td>
  65          <td align="center" valign="top">
  66            <select name="eventcats[]" size="9" multiple>
  67              <option disabled>' . $entryCatStr . '</option>';
  68  
  69  if ( strlen ( $cats ) ) {
  70    foreach ( $eventcats as $K ) {
  71      // disable if not creator and category is Global
  72      $show_ast = '';
  73      $disabled = ( empty ( $categories[abs ( $K )]['cat_owner'] ) &&
  74        substr ( $form, 0, 4 ) != 'edit' ? 'disabled' : '' );
  75      if ( empty ( $categories[abs ( $K )]['cat_owner'] ) ) {
  76        $show_ast = '*';
  77      }
  78      echo '
  79              <option value="' . "$K\" $disabled>"
  80       . $categories[abs ( $K )]['cat_name'] . $show_ast . '</option>';
  81    }
  82  }
  83  
  84  ob_end_flush ();
  85  
  86  echo '
  87            </select>
  88            <input type="button" value="' . translate ( 'Remove' )
  89   . '" onclick="selRemove()" />
  90          </td>
  91        </tr>
  92        <tr>
  93          <td valign="top" align="right">*' . translate ( 'Global Category' )
  94   . '&nbsp;&nbsp;&nbsp;<input type="button" value="' . translate ( 'OK' )
  95   . '" onclick="sendCats()" /></td>
  96          <td colspan="2" align="left">&nbsp;&nbsp;<input type="button" value="'
  97   . translate ( 'Cancel' ) . '" onclick="window.close()" /></td>
  98        </tr>
  99        </form>
 100      </table>
 101      ' . print_trailer ( false, true, true );
 102  
 103  ?>

title

Description

title

Description

title

Description

title

title

Body