diff options
-rw-r--r-- | modules/gallery/controllers/upgrader.php | 21 | ||||
-rw-r--r-- | modules/gallery/views/upgrader.html.php | 54 |
2 files changed, 67 insertions, 8 deletions
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php index e8798de5..b8769b27 100644 --- a/modules/gallery/controllers/upgrader.php +++ b/modules/gallery/controllers/upgrader.php @@ -20,6 +20,27 @@ class Upgrader_Controller extends Controller { public function index() { $view = new View("upgrader.html"); + $view->available = module::available(); + $view->done = Input::instance()->get("done"); print $view; } + + public function upgrade() { + // Upgrade gallery and user first + module::install("gallery"); + module::install("user"); + + // Then upgrade the rest + foreach (module::available() as $id => $module) { + if ($id == "gallery") { + continue; + } + + if ($module->active && $module->code_version != $module->version) { + module::install($id); + } + } + + url::redirect("upgrader?done=1"); + } } diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php index ecf2e265..6b9a0110 100644 --- a/modules/gallery/views/upgrader.html.php +++ b/modules/gallery/views/upgrader.html.php @@ -36,9 +36,15 @@ color: #999; font-style: italic; } + tr.current td.gallery { + color: #00d; + } tr.upgradeable td { font-weight: bold; } + tr.upgradeable td.gallery { + color: #00d; + } table { width: 600px; margin-bottom: 10px; @@ -63,28 +69,60 @@ border: 1px solid #999; background: #eee; } + div.button a { + text-decoration: none; + } div.button:hover { background: #ccc; } + div#confirmation { + position: fixed; + top: 400px; + left: 325px; + background: blue; + z-index: 1000; + margin: 10px; + text-align: center; + } + div#confirmation div { + margin: 2px; + padding: 20px; + border: 2px solid #999; + background: white; + } + .gray_on_done { + opacity: <?= $done ? "0.5" : "1" ?>; + } </style> <body> <div id="outer"> <img src="<?= url::file("modules/gallery/images/gallery.png") ?>" /> <div id="inner"> - <p> + <? if ($done): ?> + <div id="confirmation"> + <div> + <h1> <?= t("That's it!") ?> </h1> + <p> + <?= t("Your <a href=\"%url\">Gallery</a> is up to date.", + array("url" => url::site("albums/1"))) ?> + </p> + </div> + </div> + <? endif ?> + <p class="gray_on_done"> <?= t("Welcome to the Gallery upgrader. One click and you're done!") ?> </p> <table> - <tr> + <tr class="gray_on_done"> <th> <?= t("Module name") ?> </th> <th> <?= t("Installed version") ?> </th> <th> <?= t("Available version") ?> </th> </tr> - <? foreach (module::available() as $module): ?> + <? foreach ($available as $id => $module): ?> <? if ($module->active): ?> <tr class="<?= $module->version == $module->code_version ? "current" : "upgradeable" ?>" > - <td class="name"> + <td class="name <?= $id ?>"> <?= $module->name ?> </td> <td> @@ -100,18 +138,18 @@ <? endforeach ?> </table> - <div class="button"> + <div class="button gray_on_done"> <a href="<?= url::site("upgrader/upgrade") ?>"> <?= t("Upgrade all") ?> </a> </div> <? if (@$inactive): ?> - <p> + <p class="gray_on_done"> <?= t("The following modules are inactive and don't require an upgrade.") ?> </p> - <ul> - <? foreach (module::available() as $module): ?> + <ul class="gray_on_done"> + <? foreach ($available as $module): ?> <? if (!$module->active): ?> <li> <?= $module->name ?> |