home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / system / viewmods.php < prev   
Encoding:
PHP Script  |  2003-12-21  |  4.9 KB  |  151 lines

  1. <?php /* SYSTEM $Id: viewmods.php,v 1.14 2003/12/21 11:52:23 gregorerhardt Exp $*/
  2.  
  3. $AppUI->savePlace();
  4.  
  5. $canEdit = !getDenyEdit( $m );
  6. $canRead = !getDenyRead( $m );
  7. if (!$canRead) {
  8.     $AppUI->redirect( "m=public&a=access_denied" );
  9. }
  10.  
  11. $sql = "SELECT * FROM modules ORDER BY mod_ui_order";
  12. $modules = db_loadList( $sql );
  13.  
  14. // get the modules actually installed on the file system
  15. $modFiles = $AppUI->readDirs( "modules" );
  16.  
  17. $titleBlock = new CTitleBlock( 'Modules', 'power-management.png', $m, "$m.$a" );
  18. $titleBlock->addCrumb( "?m=system", "System Admin" );
  19. $titleBlock->show();
  20. ?>
  21.  
  22. <table border="0" cellpadding="2" cellspacing="1" width="98%" class="tbl">
  23. <tr>
  24.     <th colspan="2"><?php echo $AppUI->_('Module');?></th>
  25.     <th><?php echo $AppUI->_('Status');?></th>
  26.     <th><?php echo $AppUI->_('Type');?></th>
  27.     <th><?php echo $AppUI->_('Version');?></th>
  28.     <th><?php echo $AppUI->_('Menu Text');?></th>
  29.     <th><?php echo $AppUI->_('Menu Icon');?></th>
  30.     <th><?php echo $AppUI->_('Menu Status');?></th>
  31. </tr>
  32. <?php
  33. // do the modules that are installed on the system
  34. foreach ($modules as $row) {
  35.     // clear the file system entry
  36.     if (isset( $modFiles[$row['mod_directory']] )) {
  37.         $modFiles[$row['mod_directory']] = '';
  38.     }
  39.     $query_string = "?m=$m&a=domodsql&mod_id={$row['mod_id']}";
  40.     $s = '';
  41.     // arrows
  42.     // TODO: sweep this block of code and add line returns to improve View Source readability [kobudo 14 Feb 2003]
  43.     // Line returns after </td> tags would be a good start [as well as <tr> and </tr> tags]
  44.     $s .= '<td>';
  45.     $s .= '<img src="./images/icons/updown.gif" width="10" height="15" border=0 usemap="#arrow'.$row["mod_id"].'" />';
  46.     if ($canEdit) {
  47.         $s .= '<map name="arrow'.$row["mod_id"].'">';
  48.         $s .= '<area coords="0,0,10,7" href="' . $query_string . '&cmd=moveup">';
  49.         $s .= '<area coords="0,8,10,14" href="'.$query_string . '&cmd=movedn">';
  50.         $s .= '</map>';
  51.     }
  52.     $s .= '</td>';
  53.  
  54.     $s .= '<td width="1%" nowrap="nowrap">'.$row['mod_name'].'</td>';
  55.     $s .= '<td>';
  56.     $s .= '<img src="./images/obj/dot'.($row['mod_active'] ? 'green' : 'yellowanim').'.gif" width="12" height="12" /> ';
  57.     // John changes Module Terminology to be more descriptive of current Module State... [14 Feb 2003]
  58.         // Status term "deactivate" changed to "Active"
  59.         // Status term "activate" changed to "Disabled"
  60.     //$s .= '<a href="'.$query_string . '&cmd=toggle&">'.($row['mod_active'] ? $AppUI->_('deactivate') : $AppUI->_('activate')).'</a>';
  61.     if ($canEdit) {
  62.         $s .= '<a href="'.$query_string . '&cmd=toggle&">';
  63.     }
  64.     $s .= ($row['mod_active'] ? $AppUI->_('active') : $AppUI->_('disabled'));
  65.     if ($canEdit) {
  66.         $s .= '</a>';
  67.     }
  68.     if ($row['mod_type'] != 'core' && $canEdit) {
  69.         $s .= ' | <a href="'.$query_string . '&cmd=remove" onclick="return window.confirm('."'"
  70.             .$AppUI->_('This will delete all data associated with the module!')."\\n\\n"
  71.             .$AppUI->_( 'Are you sure?' )."\\n"
  72.             ."'".');">'.$AppUI->_('remove').'</a>';
  73.     }
  74.  
  75. // check for upgrades
  76.  
  77.     $ok = @include_once( "{$AppUI->cfg['root_dir']}/modules/".$row['mod_directory']."/setup.php" );
  78.     if ( $ok )
  79.     {
  80.         if ( $config[ 'mod_version' ] != $row['mod_version'] && $canEdit )
  81.         {
  82.             $s .= ' | <a href="'.$query_string . '&cmd=upgrade" onclick="return window.confirm('."'"
  83.                 .$AppUI->_( 'Are you sure?')."'".');" >'.$AppUI->_('upgrade').'</a>';
  84.         }
  85.     }
  86.  
  87. // check for configuration
  88.  
  89.     if ( $ok )
  90.     {
  91.         if ( $config[ 'mod_config' ] == true && $canEdit )
  92.         {
  93.             $s .= ' | <a href="'.$query_string . '&cmd=configure">'.$AppUI->_('configure').'</a>';
  94.         }
  95.     }
  96.  
  97.  
  98.     $s .= '</td>';
  99.     $s .= '<td>'.$row['mod_type'].'</td>';
  100.     $s .= '<td>'.$row['mod_version'].'</td>';
  101.     $s .= '<td>'.$AppUI->_($row['mod_ui_name']).'</td>';
  102.     $s .= '<td>'.$row['mod_ui_icon'].'</td>';
  103.  
  104.     $s .= '<td>';
  105.     $s .= '<img src="./images/obj/'.($row['mod_ui_active'] ? 'dotgreen.gif' : 'dotredanim.gif').'" width="12" height="12" /> ';
  106. //    $s .= $row['mod_ui_active'] ? '<span style="color:green">'.$AppUI->_('on') : '<span style="color:red">'.$AppUI->_('off');
  107.     // John changes Module Terminology to be more descriptive of current Module State... [14 Feb 2003]
  108.         // Menu Status term "show" changed to "Visible"
  109.         // Menu Status term "activate" changed to "Disabled"
  110.     //$s .= '<a href="'.$query_string . '&cmd=toggleMenu">'.($row['mod_ui_active'] ? $AppUI->_('hide') : $AppUI->_('show')).'</a></td>';
  111.     if ($canEdit) {
  112.         $s .= '<a href="'.$query_string . '&cmd=toggleMenu">';
  113.     }
  114.     $s .= ($row['mod_ui_active'] ? $AppUI->_('visible') : $AppUI->_('hidden'));
  115.     if ($canEdit) {
  116.         $s .= '</a>';
  117.     }
  118.     $s .= '</td>';
  119.  
  120.     $s .= '<td>'.$row['mod_ui_order'].'</td>';
  121.  
  122.     echo "<tr>$s</tr>";
  123. }
  124.  
  125. foreach ($modFiles as $v) {
  126.     // clear the file system entry
  127.     if ($v) {
  128.         $s = '';
  129.         $s .= '<td></td>';
  130.         $s .= '<td>'.$v.'</td>';
  131.         $s .= '<td>';
  132.         $s .= '<img src="./images/obj/dotgrey.gif" width="12" height="12" /> ';
  133.         if ($canEdit) {
  134.             $s .= '<a href="?m=' . $m . '&a=domodsql&cmd=install&mod_directory=' . $v . '">';
  135.         }
  136.         $s .= $AppUI->_('install');
  137.         if ($canEdit) {
  138.             $s .= '</a>';
  139.         }
  140.         $s .= '</td>';
  141.         echo "<tr>$s</tr>";
  142.     }
  143.  
  144. }
  145. ?>
  146. </table>
  147.  
  148. </body>
  149. </html>
  150.  
  151.