Changeset 5270

Show
Ignore:
Timestamp:
11/19/07 08:22:13 (9 months ago)
Author:
p_lindheimer
Message:

change module_admin to report errors from dependencies but still list remaining selected modules that do not have errors and allow them to download while skipping the error ones

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/page.modules.php

    r4993 r5270  
    393393                foreach ($moduleaction as $module => $action) {  
    394394                        $text = false; 
     395                        $skipaction = false; 
    395396 
    396397                        // make sure name is set. This is a problem for broken modules 
     
    403404                                        if (!EXTERNAL_PACKAGE_MANAGEMENT) { 
    404405                                                if (is_array($errors = module_checkdepends($modules_online[$module]))) { 
     406                                                        $skipaction = true; 
    405407                                                        $errorstext[] = sprintf(_("%s cannot be upgraded: %s Please correct this error first."),   
    406408                                                                                $modules[$module]['name'], 
     
    408410                                                } else { 
    409411                                                        $actionstext[] = sprintf(_("%s %s will be upgraded to online version %s"), $modules[$module]['name'], $modules[$module]['dbversion'], $modules_online[$module]['version']); 
    410                                                          
    411412                                                } 
    412413                                        } 
     
    415416                                        if (!EXTERNAL_PACKAGE_MANAGEMENT) { 
    416417                                                if (is_array($errors = module_checkdepends($modules_online[$module]))) { 
     418                                                        $skipaction = true; 
    417419                                                        $errorstext[] = sprintf(_("%s cannot be installed: %s Please correct this error first."),   
    418420                                                                                $modules[$module]['name'], 
     
    426428                                        if (!EXTERNAL_PACKAGE_MANAGEMENT) { 
    427429                                                if (is_array($errors = module_checkdepends($modules[$module]))) { 
     430                                                        $skipaction = true; 
    428431                                                        $errorstext[] = sprintf((($modules[$module]['status'] == MODULE_STATUS_NEEDUPGRADE) ?  _("%s cannot be upgraded: %s Please correct this error first.") : _("%s cannot be installed: %s Please correct this error first.") ),   
    429432                                                                                $modules[$module]['name'], 
     
    440443                                case 'enable': 
    441444                                        if (is_array($errors = module_checkdepends($modules[$module]))) { 
     445                                                $skipaction = true; 
    442446                                                $errorstext[] = sprintf(_("%s cannot be enabled: %s Please correct this error first."),   
    443447                                                                        $modules[$module]['name'], 
     
    449453                                case 'disable': 
    450454                                        if (is_array($errors = module_reversedepends($modules[$module]))) { 
     455                                                $skipaction = true; 
    451456                                                $errorstext[] = sprintf(_("%s cannot be disabled because the following modules depend on it: %s Please correct this error first."),   
    452457                                                                        $modules[$module]['name'], 
     
    459464                                        if (!EXTERNAL_PACKAGE_MANAGEMENT) { 
    460465                                                if (is_array($errors = module_reversedepends($modules[$module]))) { 
     466                                                        $skipaction = true; 
    461467                                                        $errorstext[] = sprintf(_("%s cannot be uninstalled because the following modules depend on it: %s Please correct this error first."),   
    462468                                                                                $modules[$module]['name'], 
     
    468474                                break; 
    469475                        } 
    470                         //echo "\t<input type=\"hidden\" name=\"moduleaction[".$module."]\" value=\"".$action."\" />\n"; 
    471                         echo "\t<script type=\"text/javascript\"> moduleActions['".$module."'] = '".$action."'; </script>\n"; 
    472                 } 
    473                  
     476 
     477                        // If error above we skip this action so we can proceed with the others 
     478                        // 
     479                        if (!$skipaction) { //TODO 
     480                                echo "\t<script type=\"text/javascript\"> moduleActions['".$module."'] = '".$action."'; </script>\n"; 
     481                        } 
     482                } 
     483                 
     484                // Write out the erros, if there are additional actions that can be accomplished list those next with the choice to 
     485                // process which will ignore the ones with errors but process the rest. 
     486                // 
    474487                if (count($errorstext) > 0) { 
    475488                        echo "<h4>"._("Errors with selection:")."</h4>\n"; 
     
    479492                        } 
    480493                        echo "</ul>"; 
    481  
    482                 } else if (count($actionstext) > 0) { 
    483                         echo "<h4>"._("Please confirm the following actions:")."</h4>\n"; 
     494                }  
     495                if (count($actionstext) > 0) { 
     496                        if (count($errorstext) > 0) { 
     497                                echo "<h4>"._("You may confirm the remaining selection (errors will be skipped):")."</h4>\n"; 
     498                        } else { 
     499                                echo "<h4>"._("Please confirm the following actions:")."</h4>\n"; 
     500                        } 
    484501                        echo "<ul>\n"; 
    485502                        foreach ($actionstext as $text) { 
     
    487504                        } 
    488505                        echo "</ul>"; 
    489                          
    490                         //echo "\t<input type=\"submit\" value=\"Confirm\" name=\"process\" />"; 
    491506                        echo "\t<input type=\"button\" value=\"Confirm\" name=\"process\" onclick=\"process_module_actions(moduleActions);\" />"; 
    492507                } else { 
     
    495510                } 
    496511                echo "\t<input type=\"button\" value=\""._("Cancel")."\" onclick=\"location.href = 'config.php?display=modules&amp;type=tool&amp;online=".($_REQUEST['online']?1:0)."';\" />"; 
    497                  
    498512                echo "</form>"; 
    499513                 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads