Changeset 2654
- Timestamp:
- 10/05/06 02:41:54 (7 years ago)
- Files:
-
- freepbx/trunk/amp_conf/htdocs/admin/common/mainstyle.css (modified) (7 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/config.php (modified) (3 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/footer.php (modified) (2 diffs)
- freepbx/trunk/amp_conf/htdocs/admin/page.modules.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/htdocs/admin/common/mainstyle.css
r2643 r2654 1 div.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 1 8 body { 2 9 margin-top: 0px; … … 8 15 font-family: Verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular; 9 16 font-size: 13px; 17 position:relative; 18 } 19 .clear { 20 clear:both; 10 21 } 11 22 td { … … 30 41 padding-left: 20px; 31 42 padding-right: 20px; 43 position:relative; 32 44 /* border-left: 1px solid #B97054; 33 45 border-right: 1px solid #B97054; … … 84 96 85 97 div.nav { 86 float:left; 87 width:150px; 98 /*float:left; */ 99 position:absolute; 100 left:20px; 101 width:150px; 88 102 display: block; 89 103 } … … 219 233 } 220 234 221 span.footer {235 div.footer { 222 236 margin-top: 10px; 223 237 border-top: 1px dashed #808080; 224 238 padding-top:5px; 225 display:block;226 239 text-align:left; 227 240 font-size:xx-small; 241 clear:both; 228 242 } 229 243 … … 291 305 292 306 293 /* For modules page */ 307 /************************* For modules page *************************/ 308 #modulelist ul { 309 padding-left:0; 310 margin-left:0; 311 position:relative; 312 } 294 313 #modulelist li { 295 314 list-style-type: none; 296 } 297 #modulelist ul { 298 padding-left:0; 299 position:relative; 315 border:1px solid #808080; 300 316 } 301 317 #modulelist #modulelist-header { 302 318 position:relative; 303 319 } 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 } 304 329 #modulelist .modulename { 305 330 position:absolute; 306 left: 0em;331 left:2px; 307 332 } 308 333 #modulelist .moduletype { 309 334 position:absolute; 310 left: 2 0em;335 left: 230px; 311 336 } 312 337 #modulelist .moduleversion { 313 338 position:absolute; 314 left: 2 5em;339 left: 290px; 315 340 } 316 341 #modulelist .modulestatus { 317 342 position:absolute; 318 left: 3 0em;343 left: 360px; 319 344 320 345 } … … 322 347 clear:both; 323 348 } 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 97 97 98 98 if (!$quietmode) { 99 echo "<table width=\"100%\" cellspacing='0' cellpadding='0'><tr><td>";99 //echo "<table width=\"100%\" cellspacing='0' cellpadding='0'><tr><td>"; 100 100 // show menu 101 101 echo "<div class=\"nav\">\n"; … … 142 142 } 143 143 if (!$quietmode) { 144 echo '<div class="clear"></div>'; 144 145 echo "</div>\n<div class=\"content\">\n"; 145 146 } … … 282 283 283 284 ?> 284 </div> 285 < /td></tr></table>285 </div> <!-- /content --> 286 <?php // </td></tr></table> ?> 286 287 <?php include 'footer.php' ?> freepbx/trunk/amp_conf/htdocs/admin/footer.php
r2172 r2654 104 104 ?> 105 105 106 < spanclass="footer" style="text-align:center;">106 <div class="footer" style="text-align:center;"> 107 107 <!--<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>--> 108 108 <?php … … 126 126 <br> 127 127 <br> 128 </ span>128 </div> 129 129 <?php 130 130 } 131 131 ?> 132 </div>133 132 134 <br> 135 <br> 136 <br> 137 <br> 133 </div> <!-- /page --> 134 138 135 </body> 139 136 freepbx/trunk/amp_conf/htdocs/admin/page.modules.php
r2643 r2654 97 97 ?> 98 98 99 </div>100 99 <!-- <div class="rnav"> 101 100 <li><a id="<?php echo ($extdisplay=='' ? 'current':'') ?>" href="config.php?display=modules&type=tool&extdisplay="><?php echo _("Local Modules") ?></a></li> … … 103 102 </div> 104 103 --> 105 <div class="content"> 104 105 <script type="text/javascript" src="common/tabber-minimized.js"></script> 106 <script type="text/javascript"> 107 function 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> 106 116 107 117 <?php 118 119 108 120 $modules_local = module_getinfo(); 109 121 110 $modules_online = module_getonlinexml(); 111 112 $modules = $modules_local + $modules_online; 122 switch($extdisplay) { 123 case "online": 124 echo "<h2>" . _("Module Administration") . "</h2>"; 125 //echo "<a href='config.php?display=modules&type=tool&extdisplay=local'>"._("Terminate Connection to Online Module Repository")."</a><br />\n"; 126 //echo "<a href='config.php?display=modules&type=tool&extdisplay=online&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&type=tool&extdisplay=online'>"._("Check for updates online")."</a>\n"; 145 146 $modules = & $modules_local; 147 break; 148 } 149 echo "<br /><br />"; 113 150 114 151 function category_sort_callback($a, $b) { … … 123 160 uasort($modules, 'category_sort_callback'); 124 161 162 163 164 165 /** preps a string to use as an HTML id element 166 */ 167 function prep_id($name) { 168 return preg_replace("/[^a-z0-9]/i", "_", $name); 169 } 170 171 172 173 125 174 echo "<div id=\"modulelist\">\n"; 126 175 … … 145 194 // start a new category header, and associated html blocks 146 195 $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"; 148 197 echo "\t<ul>"; 149 198 } 150 199 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\">"; 157 209 switch ($modules[$name]['status']) { 158 210 case MODULE_STATUS_NOTINSTALLED: … … 160 212 echo '<span class="alert">Not Installed (Locally available)</span>'; 161 213 } 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'].')'; 163 215 } 164 216 break; 165 217 case MODULE_STATUS_DISABLED: 166 echo ' <span class="alert">Disabled</span>';218 echo 'Disabled'; 167 219 break; 168 220 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>'; 170 222 break; 171 223 case MODULE_STATUS_BROKEN: … … 173 225 break; 174 226 default: 227 // check for online upgrade 175 228 if (isset($modules_online[$name]['version'])) { 176 229 $vercomp = version_compare($modules[$name]['version'], $modules_online[$name]['version']); … … 179 232 } else if ($vercomp > 0) { 180 233 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\"> </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 />'; 181 300 } 182 301 } 183 break; 184 } 185 echo "</span>\n"; 186 187 echo "\t\t<span class=\"clear\"> </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 189 333 190 334 echo "\t\t</li>\n"; … … 193 337 echo "</div>"; 194 338 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&type=tool&extdisplay=local'>"._("Terminate Connection to Online Module Repository")."</a><br />\n";213 echo "<a href='config.php?display=modules&type=tool&extdisplay=online&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 to215 // 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.html219 $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 already231 $installed = find_allmodules();232 // determine what modules are available233 $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&type=tool&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 }248 339 ?> 249 250 <?php251 252 /* BEGIN FUNCTIONS */253 254 /* displays table of modules provided in the passed array255 * If displaying online modules, pass that array as the second arg256 */257 258 class displayModules {259 var $html;260 //constructor261 function displayModules($installed,$online=false) {262 // So, we have an array with several:263 /*264 [phpinfo] => Array265 (266 [displayName] => PHP Info267 [version] => 1.0268 [type] => tool269 [category] => Basic270 [info] => http://www.freepbx.org/wikiPage271 [items] => Array272 (273 [PHPINFO] => PHP Info274 [PHPINFO2] => PHP Info2275 )276 277 [requirements] => Array278 (279 [FILE] => /usr/sbin/asterisk280 [MODULE] => core281 )282 283 )284 */285 286 // if we are displaying online modules, determine which are installed287 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 local298 if(array_key_exists($arrkey,$installed)) {299 //check if online version is newer300 $newversion = $online[$arrkey]['version'];301 $oldversion = isset($installed[$arrkey]['version'])?$installed[$arrkey]['version']:'0';302 // version_compare returns 1 if new > old303 if (version_compare($newversion,$oldversion) == 1) {304 $modsOnlineUpdate[] = $online[$arrkey];305 } else {306 // we are not displaying this array .. it's just here for kicks307 $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 Updates318 */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 table329 $this->html .= $this->buildTable(_("Available Module Updates (online)"), $modsOnlineUpdate, $color, $options);330 }331 332 /*333 * Online Modules334 */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 table345 $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 status354 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 status370 /*371 * Modules Needing Update372 */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 table382 $this->html .= $this->buildTable(_("Enabled Modules Requiring Upgrade"), $modsUpdate, $color, $options);383 }384 385 /*386 * Enabled Modules387 */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 table399 $this->html .= $this->buildTable(_("Enabled Modules"), $modsEnabled, $color, $options);400 }401 402 /*403 * Disabled Modules404 */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 table416 $this->html .= $this->buildTable(_("Disabled Modules"), $modsDisabled, $color, $options);417 }418 419 /*420 * Local Modules Not Installed421 */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 table432 $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 table445 // 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 category454 function sortModules($array) {455 if (isset($array) && is_array($array)) {456 foreach($array as $key => $mod) {457 // sort the list in category / displayName order458 // this is the only way i know how to do this...surely there is another way?459 460 // fields for sort461 $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 array464 $newallmods[$key]['asort'] = $category.$displayName;465 466 // copy the rest of the array467 $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_Html494 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_Html511 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> </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
