diff options
author | Andy Staudacher <andy.st@gmail.com> | 2009-06-09 22:07:57 -0700 |
---|---|---|
committer | Andy Staudacher <andy.st@gmail.com> | 2009-06-09 22:07:57 -0700 |
commit | 9ecd2ac0e95b3045e763742073d6e6ca1c69832a (patch) | |
tree | 4a3d360728329b43ee331df93f51e599d3d411e5 | |
parent | 03e9cefa17f1170c8414da672f5fbc3bba9ad56c (diff) | |
parent | f41a232730b02b3fc123aacfacf3dabff46153ae (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3
-rw-r--r-- | modules/gallery/controllers/upgrader.php | 31 | ||||
-rw-r--r-- | modules/gallery/helpers/module.php | 2 | ||||
-rw-r--r-- | modules/gallery/views/admin_dashboard.html.php | 8 | ||||
-rw-r--r-- | modules/gallery/views/upgrader.html.php | 54 | ||||
-rw-r--r-- | themes/admin_default/css/screen.css | 3 |
5 files changed, 83 insertions, 15 deletions
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php index e8798de5..0d5bb4f6 100644 --- a/modules/gallery/controllers/upgrader.php +++ b/modules/gallery/controllers/upgrader.php @@ -19,7 +19,38 @@ */ class Upgrader_Controller extends Controller { public function index() { + // Todo: give the admin a chance to log in here + if (!user::active()->admin) { + access::forbidden(); + } + $view = new View("upgrader.html"); + $view->available = module::available(); + $view->done = Input::instance()->get("done"); print $view; } + + public function upgrade() { + // Todo: give the admin a chance to log in here + if (!user::active()->admin) { + access::forbidden(); + } + + // 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/helpers/module.php b/modules/gallery/helpers/module.php index 58f9b20d..dea8e22c 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -40,7 +40,7 @@ class module_Core { $module->name = $module_name; $module->active = $module_name == "gallery"; // only gallery is active by default } - $module->version = 1; + $module->version = $version; $module->save(); Kohana::log("debug", "$module_name: version is now $version"); } diff --git a/modules/gallery/views/admin_dashboard.html.php b/modules/gallery/views/admin_dashboard.html.php index c266d7e1..5b8cae2e 100644 --- a/modules/gallery/views/admin_dashboard.html.php +++ b/modules/gallery/views/admin_dashboard.html.php @@ -10,23 +10,23 @@ }; $(document).ready(function(){ - $("#gAdminDashboard .gBlock *:first").addClass("gDraggable"); + $("#gAdminDashboard .gBlock .ui-widget-header").addClass("gDraggable"); $("#gAdminDashboard").sortable({ connectWith: ["#gAdminDashboardSidebar"], containment: "document", cursor: "move", - handle: $("div:first"), + handle: $(".ui-widget-header"), opacity: 0.6, placeholder: "gDropTarget", stop: update_blocks }); - $("#gAdminDashboardSidebar .gBlock *:first").addClass("gDraggable"); + $("#gAdminDashboardSidebar .gBlock .ui-widget-header").addClass("gDraggable"); $("#gAdminDashboardSidebar").sortable({ connectWith: ["#gAdminDashboard"], containment: "document", cursor: "move", - handle: $("div:first"), + handle: $(".ui-widget-header"), opacity: 0.6, placeholder: "gDropTarget", stop: update_blocks 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 ?> diff --git a/themes/admin_default/css/screen.css b/themes/admin_default/css/screen.css index 1ad64fa1..82f85f21 100644 --- a/themes/admin_default/css/screen.css +++ b/themes/admin_default/css/screen.css @@ -327,8 +327,7 @@ li.gDefaultGroup h4, li.gDefaultGroup .gUser { border: none; } -.ui-draggable, -.ui-sortable { +.ui-draggable { cursor: move; } |