Changeset 2654

Show
Ignore:
Timestamp:
10/05/06 02:41:54 (7 years ago)
Author:
gregmac
Message:

More work on new modules page layout (still not functional yet);
changed some of the main layout to avoid some css issues;
footer temporarily disabled

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/common/mainstyle.css

    r2643 r2654  
     1div.footer { 
     2  /** TODO !! nav is no longer a float, so footer doesn't stay below it! we need a way to fix this.. 
     3   * until then, I'm disabling footer 
     4  */ 
     5  display:none; 
     6} 
     7 
    18body { 
    29  margin-top: 0px; 
     
    815  font-family: Verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular; 
    916  font-size: 13px; 
     17  position:relative; 
     18} 
     19.clear { 
     20  clear:both; 
    1021} 
    1122td { 
     
    3041    padding-left: 20px; 
    3142    padding-right: 20px; 
     43  position:relative; 
    3244   /* border-left: 1px solid #B97054; 
    3345    border-right: 1px solid #B97054; 
     
    8496 
    8597div.nav { 
    86     float:left; 
    87     width:150px; 
     98    /*float:left; */ 
     99  position:absolute; 
     100  left:20px; 
     101  width:150px; 
    88102  display: block; 
    89103} 
     
    219233} 
    220234 
    221 span.footer { 
     235div.footer { 
    222236  margin-top: 10px; 
    223237    border-top: 1px dashed #808080; 
    224238    padding-top:5px; 
    225     display:block; 
    226239    text-align:left; 
    227240    font-size:xx-small; 
     241  clear:both; 
    228242} 
    229243 
     
    291305 
    292306 
    293 /* For modules page */ 
     307/************************* For modules page *************************/ 
     308#modulelist ul { 
     309  padding-left:0; 
     310  margin-left:0; 
     311  position:relative; 
     312
    294313#modulelist li { 
    295314    list-style-type: none; 
    296 
    297 #modulelist ul { 
    298   padding-left:0; 
    299   position:relative; 
     315  border:1px solid #808080; 
    300316} 
    301317#modulelist #modulelist-header { 
    302318  position:relative; 
    303319} 
     320#modulelist #modulelist-header span { 
     321  font-size:120%; 
     322  font-weight:bold; 
     323  color:#4f3e73; 
     324} 
     325#modulelist .moduleheader { 
     326  background:#ccc; 
     327  padding:2px; 
     328} 
    304329#modulelist .modulename { 
    305330  position:absolute; 
    306   left:0em
     331  left:2px
    307332} 
    308333#modulelist .moduletype { 
    309334  position:absolute; 
    310   left: 20em
     335  left: 230px
    311336} 
    312337#modulelist .moduleversion { 
    313338  position:absolute; 
    314   left: 25em
     339  left: 290px
    315340} 
    316341#modulelist .modulestatus { 
    317342  position:absolute; 
    318   left: 30em
     343  left: 360px
    319344 
    320345} 
     
    322347  clear:both; 
    323348} 
     349 
     350/* for the tabber */ 
     351#modulelist .tabber, #modulelist .tabberlive { 
     352  /* position:relative; */ 
     353  /*margin-left:130px; */ 
     354   
     355} 
     356#modulelist div.moduleinfopane { 
     357  display:none; /* hide the information pane by default */ 
     358  background: #eee; 
     359} 
     360#modulelist ul.tabbernav { 
     361  width:8em; 
     362  float:left; 
     363  margin-left:0em; 
     364  margin-bottom:1em; 
     365} 
     366#modulelist ul.tabbernav li { 
     367  text-align:right; 
     368  padding:2px 7px 2px 2px; 
     369   
     370    border-right: 5px solid #808080; 
     371    border-left: 1px solid #ccc; 
     372    border-bottom: 1px solid #ccc; 
     373   
     374} 
     375#modulelist ul.tabbernav li.tabberactive a { 
     376  color: #E87B41; 
     377  font-weight:bold; 
     378} 
     379#modulelist ul.tabbernav li a { 
     380  text-decoration : none; 
     381} 
     382#modulelist div.tabbertab { 
     383  margin-left:8.5em; 
     384} 
     385#modulelist h5 { 
     386  margin-top: 0; 
     387  margin-bottom: 0.5em; 
     388} 
     389#modulelist .alert { 
     390  color:#a00; 
     391} 
     392#modulelist div.moduleinfopane .actiontab { 
     393  padding-left:10px; 
     394} 
     395 
     396/************************* For tabber *************************/ 
     397/*-------------------------------------------------- 
     398  REQUIRED to hide the non-active tab content. 
     399  But do not hide them in the print stylesheet! 
     400  --------------------------------------------------*/ 
     401.tabberlive .tabbertabhide { 
     402 display:none; 
     403} 
     404 
     405/**************************************************************/ 
  • freepbx/trunk/amp_conf/htdocs/admin/config.php

    r2645 r2654  
    9797 
    9898if (!$quietmode) { 
    99   echo "<table width=\"100%\" cellspacing='0' cellpadding='0'><tr><td>"; 
     99  //echo "<table width=\"100%\" cellspacing='0' cellpadding='0'><tr><td>"; 
    100100  // show menu 
    101101  echo "<div class=\"nav\">\n"; 
     
    142142} 
    143143if (!$quietmode) {   
     144  echo '<div class="clear"></div>'; 
    144145  echo "</div>\n<div class=\"content\">\n"; 
    145146} 
     
    282283   
    283284?> 
    284 </div> 
    285 </td></tr></table
     285</div> <!-- /content --> 
     286<?php // </td></tr></table> ?
    286287<?php include 'footer.php' ?> 
  • freepbx/trunk/amp_conf/htdocs/admin/footer.php

    r2172 r2654  
    104104?> 
    105105     
    106     <span class="footer" style="text-align:center;"> 
     106    <div class="footer" style="text-align:center;"> 
    107107    <!--<a target="_blank" href="http://sourceforge.net/donate/index.php?group_id=121515"><img border="0" style="float:left;" alt="Donate to the Asterisk Management Portal project" src="http://images.sourceforge.net/images/project-support.jpg"></a>--> 
    108108  <?php 
     
    126126    <br> 
    127127    <br> 
    128     </span
     128    </div
    129129<?php  
    130130} 
    131131?> 
    132 </div> 
    133132 
    134 <br> 
    135 <br> 
    136 <br> 
    137 <br> 
     133</div> <!-- /page --> 
     134 
    138135</body> 
    139136 
  • freepbx/trunk/amp_conf/htdocs/admin/page.modules.php

    r2643 r2654  
    9797?> 
    9898 
    99 </div> 
    10099<!-- <div class="rnav"> 
    101100  <li><a id="<?php echo ($extdisplay=='' ? 'current':'') ?>" href="config.php?display=modules&type=tool&extdisplay="><?php echo _("Local Modules") ?></a></li> 
     
    103102</div> 
    104103--> 
    105 <div class="content"> 
     104 
     105<script type="text/javascript" src="common/tabber-minimized.js"></script> 
     106<script type="text/javascript"> 
     107function toggleInfoPane(pane) { 
     108  var style = document.getElementById(pane).style; 
     109  if (style.display == 'none' || style.display == '') { 
     110    style.display = 'block'; 
     111  } else { 
     112    style.display = 'none'; 
     113  } 
     114
     115</script> 
    106116 
    107117<?php 
     118 
     119 
    108120$modules_local = module_getinfo(); 
    109121 
    110 $modules_online = module_getonlinexml(); 
    111  
    112 $modules = $modules_local + $modules_online; 
     122switch($extdisplay) { 
     123  case "online":  
     124    echo "<h2>" . _("Module Administration") . "</h2>"; 
     125    //echo "<a href='config.php?display=modules&amp;type=tool&amp;extdisplay=local'>"._("Terminate Connection to Online Module Repository")."</a><br />\n"; 
     126    //echo "<a href='config.php?display=modules&amp;type=tool&amp;extdisplay=online&amp;refresh=true'>"._("Force Refresh of Local Module Cache")."</a>\n"; 
     127     
     128    if (isset($amp_conf['AMPMODULEMSG'])) { 
     129      $announcements = @ file_get_contents($amp_conf['AMPMODULEMSG']."/version-$version.html"); 
     130    } else { 
     131      $announcements = @ file_get_contents("http://mirror.freepbx.org/version-$version.html"); 
     132    } 
     133    if (isset($announcements) && !empty($announcements)) { 
     134      echo '<div class="announcements">$announcements</div>'; 
     135    } 
     136     
     137    $modules_online = module_getonlinexml(); 
     138     
     139    $modules = $modules_local + $modules_online; 
     140     
     141  break; 
     142  default: 
     143    echo "<h2>" . _("Module Administration") . "</h2>"; 
     144    echo "<a href='config.php?display=modules&amp;type=tool&amp;extdisplay=online'>"._("Check for updates online")."</a>\n"; 
     145     
     146    $modules = & $modules_local; 
     147  break; 
     148
     149echo "<br /><br />"; 
    113150 
    114151function category_sort_callback($a, $b) { 
     
    123160uasort($modules, 'category_sort_callback'); 
    124161 
     162 
     163 
     164 
     165/** preps a string to use as an HTML id element 
     166 */ 
     167function prep_id($name) { 
     168  return preg_replace("/[^a-z0-9]/i", "_", $name); 
     169} 
     170 
     171 
     172 
     173 
    125174echo "<div id=\"modulelist\">\n"; 
    126175 
     
    145194    // start a new category header, and associated html blocks 
    146195    $category = $modules[$name]['category']; 
    147     echo "\t<div class=\"category\" id=\"category_".$category."\"><h3>".$category."</h3>\n"; 
     196    echo "\t<div class=\"category\" id=\"category_".prep_id($category)."\"><h3>".$category."</h3>\n"; 
    148197    echo "\t<ul>"; 
    149198  } 
    150199   
    151   echo "\t\t<li>\n"; 
    152   echo "\t\t<span class=\"modulename\">".$modules[$name]['name']."</span>\n"; 
    153   echo "\t\t<span class=\"moduletype\">".$modules[$name]['type']."</span>\n"; 
    154   echo "\t\t<span class=\"moduleversion\">".$modules[$name]['dbversion']."</span>\n"; 
    155    
    156   echo "\t\t<span class=\"modulestatus\">"; 
     200  echo "\t\t<li id=\"module_".prep_id($name)."\">\n"; 
     201   
     202  // ---- module header  
     203  echo "\t\t<div class=\"moduleheader\" onclick=\"toggleInfoPane('infopane_".prep_id($name)."');\" >\n"; 
     204  echo "\t\t\t<span class=\"modulename\"><a href=\"javascript:void(null);\">".$modules[$name]['name']."</a></span>\n"; 
     205  echo "\t\t\t<span class=\"moduletype\">".$modules[$name]['type']."</span>\n"; 
     206  echo "\t\t\t<span class=\"moduleversion\">".$modules[$name]['dbversion']."</span>\n"; 
     207   
     208  echo "\t\t\t<span class=\"modulestatus\">"; 
    157209  switch ($modules[$name]['status']) { 
    158210    case MODULE_STATUS_NOTINSTALLED: 
     
    160212        echo '<span class="alert">Not Installed (Locally available)</span>'; 
    161213      } else { 
    162         echo '<span class="alert">Not Installed (Available online: '.$modules_online[$name]['version'].')</span>'; 
     214        echo 'Not Installed (Available online: '.$modules_online[$name]['version'].')'; 
    163215      } 
    164216    break; 
    165217    case MODULE_STATUS_DISABLED: 
    166       echo '<span class="alert">Disabled</span>'; 
     218      echo 'Disabled'; 
    167219    break; 
    168220    case MODULE_STATUS_NEEDUPGRADE: 
    169       echo '<span class="alert">Awaiting upgrade ('.$modules[$name]['version'].' ready)</span>'; 
     221      echo '<span class="alert">Disabled; Pending upgrade to '.$modules[$name]['version'].'</span>'; 
    170222    break; 
    171223    case MODULE_STATUS_BROKEN: 
     
    173225    break; 
    174226    default: 
     227      // check for online upgrade 
    175228      if (isset($modules_online[$name]['version'])) { 
    176229        $vercomp = version_compare($modules[$name]['version'], $modules_online[$name]['version']); 
     
    179232        } else if ($vercomp > 0) { 
    180233          echo 'Newer than online version ('.$modules_online[$name]['version'].')'; 
     234        } else { 
     235          echo 'Enabled and up to date'; 
     236        } 
     237      } else if (isset($modules_online)) { 
     238        // we're connected to online, but didn't find this module 
     239        echo 'Enabled; Not available online'; 
     240      } else { 
     241        echo 'Enabled'; 
     242      } 
     243    break; 
     244  } 
     245  echo "</span>\n"; 
     246   
     247   
     248  echo "\t\t\t<span class=\"clear\">&nbsp;</span>\n"; 
     249  echo "\t\t</div>\n"; 
     250   
     251  // ---- end of module header 
     252   
     253   
     254  // ---- drop-down tab box thingy: 
     255   
     256  echo "\t\t<div class=\"moduleinfopane\" id=\"infopane_".prep_id($name)."\" >\n"; 
     257  echo "\t\t\t<div class=\"tabber\">\n"; 
     258   
     259  if (isset($modules_online[$name]['attention']) && !empty($modules_online[$name]['attention'])) { 
     260    echo "\t\t\t\t<div class=\"tabbertab\" title=\"Attention\">\n"; 
     261    echo nl2br($modules[$name]['attention']); 
     262    echo "\t\t\t\t</div>\n"; 
     263  } 
     264   
     265  echo "\t\t\t\t<div class=\"tabbertab actiontab\" title=\"Action\">\n"; 
     266   
     267  echo '<input type="radio" checked="CHECKED" id="noaction_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="0" /> '. 
     268       '<label for="noaction_'.prep_id($name).'">No Action</label> <br />';  
     269  switch ($modules[$name]['status']) { 
     270   
     271    case MODULE_STATUS_NOTINSTALLED: 
     272      echo '<input type="radio" id="install_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="install" /> '. 
     273           '<label for="install_'.prep_id($name).'">Install</label> <br />'; 
     274    break; 
     275    case MODULE_STATUS_DISABLED: 
     276      echo '<input type="radio" id="enable_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="enable" /> '. 
     277           '<label for="enable_'.prep_id($name).'">Enable</label> <br />'; 
     278      echo '<input type="radio" id="uninstall_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="uninstall" /> '. 
     279           '<label for="uninstall_'.prep_id($name).'">Uninstall</label> <br />'; 
     280    break; 
     281    case MODULE_STATUS_NEEDUPGRADE: 
     282      echo '<input type="radio" id="install_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="install" /> '. 
     283           '<label for="install_'.prep_id($name).'">Upgrade to '.$modules_local[$name]['version'].' and Enable</label> <br />'; 
     284      echo '<input type="radio" id="uninstall_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="uninstall" /> '. 
     285           '<label for="uninstall_'.prep_id($name).'">Uninstall</label> <br />'; 
     286    break; 
     287    case MODULE_STATUS_BROKEN: 
     288      echo '<input type="radio" id="install_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="install" /> '. 
     289           '<label for="install_'.prep_id($name).'">Install</label> <br />'; 
     290      echo '<input type="radio" id="uninstall_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="uninstall" /> '. 
     291           '<label for="uninstall_'.prep_id($name).'">Uninstall</label> <br />'; 
     292    break; 
     293    default: 
     294      // check for online upgrade 
     295      if (isset($modules_online[$name]['version'])) { 
     296        $vercomp = version_compare($modules[$name]['version'], $modules_online[$name]['version']); 
     297        if ($vercomp < 0) { 
     298          echo '<input type="radio" id="install_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="install" /> '. 
     299               '<label for="install_'.prep_id($name).'">Upgrade to '.$modules_online[$name]['version'].'</label> <br />'; 
    181300        } 
    182301      } 
    183     break; 
    184   } 
    185   echo "</span>\n"; 
    186    
    187   echo "\t\t<span class=\"clear\">&nbsp;</span>\n"; 
    188    
     302      echo '<input type="radio" id="disable_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="disable" /> '. 
     303           '<label for="disable_'.prep_id($name).'">Disable</label> <br />'; 
     304      echo '<input type="radio" id="uninstall_'.prep_id($name).'" name="moduleaction['.prep_id($name).']" value="uninstall" /> '. 
     305           '<label for="uninstall_'.prep_id($name).'">Uninstall</label> <br />'; 
     306    break; 
     307  } 
     308  echo "\t\t\t\t</div>\n"; 
     309   
     310  echo "\t\t\t\t<div class=\"tabbertab\" title=\"Description\">\n"; 
     311  if (isset($modules[$name]['description']) && !empty($modules[$name]['description'])) { 
     312    echo nl2br($modules[$name]['description']); 
     313  } else { 
     314    echo "No description is available."; 
     315  } 
     316  if (isset($modules[$name]['info']) && !empty($modules[$name]['info'])) { 
     317    echo '<p>More info: <a href="'.$modules[$name]['info'].'" target="_new">'.$modules[$name]['info'].'</a></p>'; 
     318  } 
     319  echo "\t\t\t\t</div>\n"; 
     320   
     321  if (isset($modules_online[$name]['changelog']) && !empty($modules_online[$name]['changelog'])) { 
     322    echo "\t\t\t\t<div class=\"tabbertab\" title=\"Changelog\">\n"; 
     323    echo "<h5>Change Log for version ".$modules_online[$name]['version']."</h5>"; 
     324    // convert "1.x.x:" into bold, and do nl2br 
     325    echo preg_replace('/(\d+(\.\d+)+):/', '<strong>$0</strong>', nl2br($modules[$name]['changelog'])); 
     326    echo "\t\t\t\t</div>\n"; 
     327  } 
     328   
     329  echo "\t\t\t</div>\n"; 
     330  echo "\t\t</div>\n"; 
     331   
     332  // ---- end of drop-down tab box  
    189333   
    190334  echo "\t\t</li>\n"; 
     
    193337echo "</div>"; 
    194338 
    195  
    196  
    197 echo '<pre>'; 
    198  
    199  
    200  
    201  
    202  
    203  
    204  
    205 exit; 
    206  
    207 switch($extdisplay) { 
    208   case "online":  
    209     echo "<h2>"; 
    210     echo _("Module Administration (online)"); 
    211     echo "</h2>"; 
    212     echo "<a href='config.php?display=modules&amp;type=tool&amp;extdisplay=local'>"._("Terminate Connection to Online Module Repository")."</a><br />\n"; 
    213     echo "<a href='config.php?display=modules&amp;type=tool&amp;extdisplay=online&amp;refresh=true'>"._("Force Refresh of Local Module Cache")."</a>\n"; 
    214     // If 'refresh' is set to 'true' then truncate the modules_xml table so it doesn't try to  
    215     // use the cached XML file. 
    216     if ($refresh !== false) 
    217       sql("truncate module_xml;"); 
    218     // Check for a warning or text message at mirror.freepbx.org/version-$version.html 
    219     $version = getversion(); 
    220     $version = $version[0][0]; 
    221  
    222     if (isset($amp_conf['AMPMODULEMSG'])) { 
    223       $announcements = file_get_contents($amp_conf['AMPMODULEMSG']."/version-$version.html"); 
    224     } else { 
    225       $announcements = file_get_contents("http://mirror.freepbx.org/version-$version.html"); 
    226     } 
    227  
    228     print "$announcements"; 
    229  
    230     // determine which modules we have installed already 
    231     $installed = find_allmodules(); 
    232     // determine what modules are available 
    233     $online = module_getonlinexml(); 
    234     $dispMods = new displayModules($installed,$online); 
    235     echo $dispMods->drawModules(); 
    236   break; 
    237   default: 
    238     echo "<h2>"; 
    239     echo _("Module Administration"); 
    240     echo "</h2>"; 
    241     echo "<a href='config.php?display=modules&amp;type=tool&amp;extdisplay=online'>"._("Connect to Online Module Repository")."</a>\n"; 
    242     $installed = find_allmodules(); 
    243     $dispMods = new displayModules($installed); 
    244     echo $dispMods->drawModules(); 
    245  
    246   break; 
    247 } 
    248339?> 
    249  
    250 <?php 
    251  
    252 /* BEGIN FUNCTIONS */ 
    253  
    254 /* displays table of modules provided in the passed array 
    255  * If displaying online modules, pass that array as the second arg  
    256 */ 
    257  
    258 class displayModules { 
    259   var $html; 
    260   //constructor 
    261   function displayModules($installed,$online=false) { 
    262     // So, we have an array with several: 
    263   /* 
    264     [phpinfo] => Array 
    265       ( 
    266         [displayName] => PHP Info 
    267         [version] => 1.0 
    268         [type] => tool 
    269         [category] => Basic 
    270         [info] => http://www.freepbx.org/wikiPage 
    271         [items] => Array 
    272           ( 
    273             [PHPINFO] => PHP Info 
    274             [PHPINFO2] => PHP Info2 
    275           ) 
    276    
    277         [requirements] => Array 
    278           ( 
    279             [FILE] => /usr/sbin/asterisk 
    280             [MODULE] => core 
    281           ) 
    282    
    283       ) 
    284   */ 
    285    
    286     // if we are displaying online modules, determine which are installed 
    287     if($online) { 
    288        
    289       $online = $this->sortModules($online); 
    290       foreach(array_keys($online) as $arrkey) { 
    291        
    292         if (!is_array($installed)) 
    293         { 
    294             continue; 
    295         } 
    296              
    297         // Determine if module is already local 
    298         if(array_key_exists($arrkey,$installed)) { 
    299           //check if online version is newer 
    300           $newversion = $online[$arrkey]['version']; 
    301           $oldversion = isset($installed[$arrkey]['version'])?$installed[$arrkey]['version']:'0'; 
    302           // version_compare returns 1 if new > old 
    303           if (version_compare($newversion,$oldversion) == 1) { 
    304             $modsOnlineUpdate[] = $online[$arrkey]; 
    305           } else { 
    306             // we are not displaying this array .. it's just here for kicks 
    307             $modsOnlineInstalled[] = $online[$arrkey]; 
    308           } 
    309         } else { 
    310           $modsOnlineOnly[] = $online[$arrkey]; 
    311         } 
    312          
    313         //$this->html .= $this->tableHtml($online[$arrkey],$status,$action); 
    314       } 
    315        
    316       /*  
    317        *  Available Module Updates 
    318        */ 
    319       if(isset($modsOnlineUpdate) && is_array($modsOnlineUpdate)) { 
    320         $color = "orange"; 
    321         $this->options = " 
    322           <select name=\"modaction\"> 
    323             <option value=\"downloadupdate\">"._("Download and Update selected")." 
    324             <option value=\"download\">"._("Download selected")." 
    325           </select> 
    326           <input type=\"submit\" name=\"submit\" value=\""._("Submit")."\"> 
    327           "; 
    328         // build the table 
    329         $this->html .= $this->buildTable(_("Available Module Updates (online)"), $modsOnlineUpdate, $color, $options); 
    330       } 
    331        
    332       /*  
    333        *  Online Modules 
    334        */      
    335       if(isset($modsOnlineOnly) && is_array($modsOnlineOnly)) { 
    336         $color = "white"; 
    337         $this->options = " 
    338           <select name=\"modaction\"> 
    339             <option value=\"downloadinstall\">"._("Download and Install selected")." 
    340             <option value=\"download\">"._("Download selected")." 
    341           </select> 
    342           <input type=\"submit\" name=\"submit\" value=\""._("Submit")."\"> 
    343           "; 
    344         // build the table 
    345         $this->html .= $this->buildTable(_("Modules Available (online)"), $modsOnlineOnly, $color, $options); 
    346       }      
    347        
    348     } 
    349        
    350     $installed = $this->sortModules($installed); 
    351     if (isset($installed) && is_array($installed)) { 
    352       foreach($installed as $mod) { 
    353         //create seperate arrays based on module status 
    354         if ($mod['status'] == 0) { 
    355           $modsNotinstalled[] = $mod; 
    356         } else if($mod['status'] == 1){ 
    357           $modsDisabled[] = $mod; 
    358         } else if($mod['status'] == 2){ 
    359           $modsEnabled[] = $mod; 
    360         } else if($mod['status'] == 3){ 
    361           $modsUpdate[] = $mod; 
    362         } else if($mod['status'] == -1){ 
    363           $modsBroken[] = $mod; 
    364         } 
    365  
    366         //$this->html .= $this->tableHtml($mod,$status,$color); 
    367       } 
    368        
    369       // draw a form and list for each module status 
    370       /*  
    371        *  Modules Needing Update 
    372        */ 
    373       if(isset($modsUpdate) && is_array($modsUpdate)) { 
    374         $color = "#CCFF00"; 
    375         $options = " 
    376           <select name=\"modaction\"> 
    377             <option value=\"upgrade\">"._("Upgrade Selected")." 
    378           </select> 
    379           <input type=\"submit\" name=\"submit\" value=\""._("Submit")."\"> 
    380           "; 
    381         // build the table 
    382         $this->html .= $this->buildTable(_("Enabled Modules Requiring Upgrade"), $modsUpdate, $color, $options); 
    383       } 
    384        
    385       /*  
    386        *  Enabled Modules 
    387        */      
    388       if(isset($modsEnabled) && is_array($modsEnabled)) { 
    389         $color = "white"; 
    390         $this->options = " 
    391           <select name=\"modaction\"> 
    392             <option value=\"disable\">"._("Disable Selected")." 
    393             <option value=\"uninstall\">"._("Uninstall Selected")." 
    394             <option value=\"uninstalldelete\">"._("Uninstall and Delete Selected")." 
    395           </select> 
    396           <input type=\"submit\" name=\"submit\" value=\""._("Submit")."\"> 
    397           "; 
    398         // build the table 
    399         $this->html .= $this->buildTable(_("Enabled Modules"), $modsEnabled, $color, $options); 
    400       } 
    401        
    402       /*  
    403        *  Disabled Modules 
    404        */      
    405       if(isset($modsDisabled) && is_array($modsDisabled)) { 
    406         $color = "white"; 
    407         $this->options = " 
    408           <select name=\"modaction\"> 
    409             <option value=\"enable\">"._("Enable Selected")." 
    410             <option value=\"uninstall\">"._("Uninstall Selected")." 
    411             <option value=\"uninstalldelete\">"._("Uninstall and Delete Selected")." 
    412           </select> 
    413           <input type=\"submit\" name=\"submit\" value=\""._("Submit")."\"> 
    414           "; 
    415         // build the table 
    416         $this->html .= $this->buildTable(_("Disabled Modules"), $modsDisabled, $color, $options); 
    417       } 
    418  
    419       /*  
    420        *  Local Modules Not Installed 
    421        */      
    422       if(isset($modsNotinstalled) && is_array($modsNotinstalled)) { 
    423         $color = "white"; 
    424         $this->options = " 
    425           <select name=\"modaction\"> 
    426             <option value=\"installenable\">"._("Enable Selected")." 
    427             <option value=\"delete\">"._("Delete Selected")." 
    428           </select> 
    429           <input type=\"submit\" name=\"submit\" value=\""._("Submit")."\"> 
    430           "; 
    431         // build the table 
    432         $this->html .= $this->buildTable(_("Not Installed Local Modules"), $modsNotinstalled, $color, $options); 
    433       } 
    434        
    435       if(isset($modsBroken) && is_array($modsBroken)) { 
    436         $color = "#FFFFFF"; 
    437           //$rows .= $this->tableHtmlBroken($mod,$color); 
    438         $this->options = " 
    439           <select name=\"modaction\"> 
    440             <option value=\"delete\">"._("Delete Selected")." 
    441           </select> 
    442           <input type=\"submit\" name=\"submit\" value=\""._("Submit")."\"> 
    443           "; 
    444         // build the table 
    445         // BROKEN modname instead of rawname ??  
    446         $this->html .= $this->buildTable(_("Not Installed Local Modules"), $modsBroken, $color, $options); 
    447       } 
    448        
    449     } 
    450      
    451   } 
    452    
    453   //sorts the modules by category 
    454   function sortModules($array) { 
    455     if (isset($array) && is_array($array)) { 
    456       foreach($array as $key => $mod) { 
    457         // sort the list in category / displayName order 
    458         // this is the only way i know how to do this...surely there is another way? 
    459          
    460         // fields for sort 
    461         $displayName = isset($mod['displayName']) ? $mod['displayName'] : 'unknown'; 
    462         $category = isset($mod['category']) ? $mod['category'] : 'unknown';  
    463         // we want to sort on this so make it first in the new array 
    464         $newallmods[$key]['asort'] = $category.$displayName; 
    465        
    466         // copy the rest of the array 
    467         $newallmods[$key]['modname'] = $key; 
    468         $newallmods[$key]['displayName'] = $displayName; 
    469         $newallmods[$key]['category'] = $category; 
    470         $newallmods[$key]['rawname'] = isset($mod['rawname'])?$mod['rawname'] : null; 
    471         $newallmods[$key]['info'] = isset($mod['info'])?$mod['info'] : null; 
    472         $newallmods[$key]['location'] = isset($mod['location']) ? $mod['location'] : null ; 
    473         $newallmods[$key]['version'] = isset($mod['version']) ? $mod['version'] : 'unknown'; 
    474         $newallmods[$key]['type'] = isset($mod['type']) ? $mod['type'] : 'unknown'; 
    475         $newallmods[$key]['status'] = isset($mod['status']) ? $mod['status'] : 0; 
    476          
    477         asort($newallmods);  
    478       } 
    479       return $newallmods; 
    480     } 
    481   } 
    482    
    483   // tableRow($color, $mod['rawname'], $mod['version'], $mod['type'], $mod['categrory'], $mod['displayName'], $mod['info'] 
    484   function tableRow($color, $rawname, $version, $type, $category, $displayname, $infourl) { 
    485     $out = '<tr bgcolor="'.$color.'">'; 
    486     $out .= '<td><input type="checkbox" name="modules[]" value="'.$rawname.'">'. 
    487             '<input type="hidden" name="'.$rawname.'_version" value="'.$version.'"></td>'; 
    488     $out .= '<td><a target="_BLANK" href="'.$infourl.'">'.$displayname.' ('.$rawname.')</a></td>'; 
    489     $out .= '<td>'.$version.'</td>'; 
    490     $out .= '<td>'.$type.'</td>'; 
    491     $out .= '</tr>'; 
    492     return $out; 
    493     return <<< End_of_Html 
    494        
    495       <tr bgcolor={$color}> 
    496         <td> 
    497           <input type="checkbox" name="modules[]" value="{$arrRow['rawname']}"> 
    498           <input type="hidden" name="{$arrRow['rawname']}_version" value="{$arrRow['version']}"> 
    499         </td> 
    500         <td><a target=_BLANK href={$arrRow['info']}>{$arrRow['displayName']} ({$arrRow['rawname']})</a></td> 
    501         <td>{$arrRow['version']}</td> 
    502         <td>{$arrRow['type']}</td> 
    503         <td>{$arrRow['category']}</td> 
    504       </tr> 
    505        
    506 End_of_Html; 
    507   } 
    508  
    509   function tableHtmlBroken($arrRow,$color) { 
    510     return <<< End_of_Html 
    511        
    512       <tr bgcolor={$color}> 
    513         <td> 
    514           <input type="checkbox" name="modules[]" value="{$arrRow['modname']}"> 
    515           <input type="hidden" name="{$arrRow['modname']}_version" value="{$arrRow['version']}"> 
    516         </td> 
    517         <td><a target=_BLANK href={$arrRow['info']}>{$arrRow['displayName']} ({$arrRow['modname']})</a></td> 
    518         <td>{$arrRow['version']}</td> 
    519         <td>{$arrRow['type']}</td> 
    520         <td>{$arrRow['category']}</td> 
    521       </tr> 
    522        
    523 End_of_Html; 
    524   } 
    525    
    526   function formStart($title = "") { 
    527     $uri = preg_replace("/&refresh=true/", "//", $_SERVER['REQUEST_URI']); 
    528     return " 
    529       <h4>{$title}</h4> 
    530       <form method=\"POST\" action=\"{$uri}\"> 
    531       <table border=1><tr><th>&nbsp;</th><th>". _("Module")."</th><th>". _("Version")."</th><th>". _("Type") ."</th><th>". _("Category") ."</th></tr> 
    532         "; 
    533   } 
    534  
    535   function formEnd() { 
    536     return "</table>{$this->options}</form><hr>"; 
    537   } 
    538      
    539   function drawModules() { 
    540     return $this->html; 
    541   } 
    542    
    543    
    544   function buildTable($title, $rows, $color, $options) { 
    545     $out = $this->formStart($title); 
    546     foreach($rows as $mod) { 
    547       $out .= $this->tableRow($mod); 
    548     } 
    549     $out .= $this->formEnd(); 
    550     return $out; 
    551   } 
    552 } 
    553  
    554 ?> 
    555