summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-01-13 04:56:29 +0000
committerBharat Mediratta <bharat@menalto.com>2009-01-13 04:56:29 +0000
commit16bebdca068eebedb1eea71e04d986936561e8fc (patch)
treed05e749eae20ae07aa74a94f1f518f1fc09569d4 /core
parentac59df23958d206956e92b4761c70214f8ffee8e (diff)
Make the admin/graphics UI mimic admin/themes with a single selected
toolkit above, and other available ones below.
Diffstat (limited to 'core')
-rw-r--r--core/controllers/admin_graphics.php19
-rw-r--r--core/views/admin_graphics.html.php96
-rw-r--r--core/views/admin_graphics_gd.html.php22
-rw-r--r--core/views/admin_graphics_graphicsmagick.html.php17
-rw-r--r--core/views/admin_graphics_imagemagick.html.php17
5 files changed, 89 insertions, 82 deletions
diff --git a/core/controllers/admin_graphics.php b/core/controllers/admin_graphics.php
index ba1c7569..69a83575 100644
--- a/core/controllers/admin_graphics.php
+++ b/core/controllers/admin_graphics.php
@@ -21,8 +21,20 @@ class Admin_Graphics_Controller extends Admin_Controller {
public function index() {
$view = new Admin_View("admin.html");
$view->content = new View("admin_graphics.html");
- $view->content->tk = new ArrayObject(graphics::detect_toolkits(), ArrayObject::ARRAY_AS_PROPS);
- $view->content->active = module::get_var("core", "graphics_toolkit");
+
+ $tk = new ArrayObject(graphics::detect_toolkits(), ArrayObject::ARRAY_AS_PROPS);
+ $active = module::get_var("core", "graphics_toolkit");
+ foreach (array("gd", "imagemagick", "graphicsmagick") as $id) {
+ if ($id == $active) {
+ $view->content->active = new View("admin_graphics_$id.html");
+ $view->content->active->tk = $tk;
+ } else {
+ $v = new View("admin_graphics_$id.html");
+ $v->tk = $tk;
+ $view->content->available .= $v;
+ }
+ }
+
print $view;
}
@@ -38,7 +50,8 @@ class Admin_Graphics_Controller extends Admin_Controller {
site_status::clear("missing_graphics_toolkit");
message::success(t("Updated Graphics Toolkit"));
- log::success("graphics", t("Changed graphics toolkit to: {{toolkit}}", array("toolkit" => $toolkit)));
+ log::success("graphics", t("Changed graphics toolkit to: {{toolkit}}",
+ array("toolkit" => $toolkit)));
}
url::redirect("admin/graphics");
diff --git a/core/views/admin_graphics.html.php b/core/views/admin_graphics.html.php
index 22108cd7..c5e32320 100644
--- a/core/views/admin_graphics.html.php
+++ b/core/views/admin_graphics.html.php
@@ -2,91 +2,29 @@
<script type="text/javascript">
$(document).ready(function() {
select_toolkit = function(el) {
- if (!$(this).hasClass("selected")) {
+ if (!$(this).hasClass("unavailable")) {
window.location = '<?= url::site("admin/graphics/choose/__TK__?csrf=" . access::csrf_token()) ?>'
.replace("__TK__", $(this).attr("id"));
}
};
- $("#gAdminGraphics table tr").click(select_toolkit);
+ $("#gAvailableToolkits div.gBlock").click(select_toolkit);
});
-</script>
-
-<h1> <?= t("Graphics Settings") ?> </h1>
-<p>
- <?= t("Gallery needs a graphics toolkit in order to manipulate your photos. Please choose one from the list below.") ?>
-</p>
-<h2> <?= t("Graphics Toolkits") ?> </h2>
+</script>
+<div id="gAdminGraphics">
+ <h1> <?= t("Graphics Settings") ?> </h1>
+ <p>
+ <?= t("Gallery needs a graphics toolkit in order to manipulate your photos. Please choose one from the list below.") ?>
+ </p>
-<table id="gAdminGraphics">
- <tr id="gd" <?= ($active == "gd") ? "class=\"selected\"" : "" ?>>
- <td valign="top">
- <img width="170" height="110" src="http://www.libgd.org/skins/libgd/gdlogosmall.png" alt="<? t("Visit the GD lib project site") ?>" />
- </td>
- <td>
- <h3> <?= t("GD") ?> </h3>
- <p>
- <?= t("The GD graphics library is an extension to PHP commonly installed most webservers. Please refer to the <a href=\"{{url}}\">GD website</a> for more information.",
- array("url" => "http://www.boutell.com/gd")) ?>
- </p>
- <? if ($tk->gd["GD Version"] && function_exists('imagerotate')): ?>
- <p class="gSuccess">
- <?= t("You have GD version {{version}}.", array("version" => $tk->gd["GD Version"])) ?>
- </p>
- <? elseif ($tk->gd["GD Version"]): ?>
- <p class="gWarning">
- <?= t("You have GD version {{version}}, but it lacks image rotation.",
- array("version" => $tk->gd["GD Version"])) ?>
- </p>
- <? else: ?>
- <p class="gInfo">
- <?= t("You do not have GD installed.") ?>
- </p>
- <? endif ?>
- </td>
- </tr>
+ <div id="gSelectedToolkit">
+ <h2> <?= t("Active Toolkit") ?> </h2>
+ <?= $active ?>
+ </div>
- <tr id="imagemagick" <?= ($active == "imagemagick") ? "class=\"selected\"" : "" ?>>
- <td valign="top">
- <img width="114" height="118" src="http://www.imagemagick.org/image/logo.jpg" alt="<? t("Visit the ImageMagick project site") ?>" />
- </td>
- <td>
- <h3> <?= t("ImageMagick") ?> </h3>
- <p>
- <?= t("ImageMagick is a standalone graphics program available on most Linux systems. Please refer to the <a href=\"{{url}}\">ImageMagick website</a> for more information.",
- array("url" => "http://www.imagemagick.org")) ?>
- </p>
- <? if ($tk->imagemagick): ?>
- <p class="gSuccess">
- <?= t("You have ImageMagick installed in {{path}}", array("path" => $tk->imagemagick)) ?>
- </p>
- <? else: ?>
- <p class="gInfo">
- <?= t("ImageMagick is not available on your system.") ?>
- </p>
- <? endif ?>
- </td>
- </tr>
+ <div id="gAvailableToolkits">
+ <h2> <?= t("Available Toolkits") ?> </h2>
+ <?= $available ?>
+ </div>
+</div>
- <tr id="graphicsmagick" <?= ($active == "graphicsmagick") ? "class=\"selected\"" : "" ?>>
- <td valign="top">
- <img width="107" height="76" src="http://www.graphicsmagick.org/images/gm-107x76.png" alt="<? t("Visit the GraphicsMagick project site") ?>" />
- </td>
- <td>
- <h3> <?= t("GraphicsMagick") ?> </h3>
- <p>
- <?= t("GraphicsMagick is a standalone graphics program available on most Linux systems. Please refer to the <a href=\"{{url}}\">GraphicsMagick website</a> for more information.",
- array("url" => "http://www.graphicsmagick.org")) ?>
- </p>
- <? if ($tk->graphicsmagick): ?>
- <p class="gSuccess">
- <?= t("You have GraphicsMagick installed in {{path}}", array("path" => $tk->graphicsmagick)) ?>
- </p>
- <? else: ?>
- <p class="gInfo">
- <?= t("GraphicsMagick is not available on your system.") ?>
- </p>
- <? endif ?>
- </td>
- </tr>
-</table>
diff --git a/core/views/admin_graphics_gd.html.php b/core/views/admin_graphics_gd.html.php
new file mode 100644
index 00000000..822c63b0
--- /dev/null
+++ b/core/views/admin_graphics_gd.html.php
@@ -0,0 +1,22 @@
+<div id="gd" class="gBlock <?= $tk->gd["GD Version"] ? "" : "unavailable" ?>">
+ <img class="logo" width="170" height="110" src="http://www.libgd.org/skins/libgd/gdlogosmall.png" alt="<? t("Visit the GD lib project site") ?>" />
+ <h3> <?= t("GD") ?> </h3>
+ <p>
+ <?= t("The GD graphics library is an extension to PHP commonly installed most webservers. Please refer to the <a href=\"{{url}}\">GD website</a> for more information.",
+ array("url" => "http://www.boutell.com/gd")) ?>
+ </p>
+ <? if ($tk->gd["GD Version"] && function_exists('imagerotate')): ?>
+ <p class="gSuccess">
+ <?= t("You have GD version {{version}}.", array("version" => $tk->gd["GD Version"])) ?>
+ </p>
+ <? elseif ($tk->gd["GD Version"]): ?>
+ <p class="gWarning">
+ <?= t("You have GD version {{version}}, but it lacks image rotation.",
+ array("version" => $tk->gd["GD Version"])) ?>
+ </p>
+ <? else: ?>
+ <p class="gInfo">
+ <?= t("You do not have GD installed.") ?>
+ </p>
+ <? endif ?>
+</div>
diff --git a/core/views/admin_graphics_graphicsmagick.html.php b/core/views/admin_graphics_graphicsmagick.html.php
new file mode 100644
index 00000000..d65a1d3c
--- /dev/null
+++ b/core/views/admin_graphics_graphicsmagick.html.php
@@ -0,0 +1,17 @@
+<div id="graphicsmagick" class="gBlock <?= $tk->graphicsmagick ? "" : "unavailable" ?>">
+ <h3> <?= t("GraphicsMagick") ?> </h3>
+ <img class="logo" width="107" height="76" src="http://www.graphicsmagick.org/images/gm-107x76.png" alt="<? t("Visit the GraphicsMagick project site") ?>" />
+ <p>
+ <?= t("GraphicsMagick is a standalone graphics program available on most Linux systems. Please refer to the <a href=\"{{url}}\">GraphicsMagick website</a> for more information.",
+ array("url" => "http://www.graphicsmagick.org")) ?>
+ </p>
+ <? if ($tk->graphicsmagick): ?>
+ <p class="gSuccess">
+ <?= t("GraphicsMagick is available in {{path}}", array("path" => $tk->graphicsmagick)) ?>
+ </p>
+ <? else: ?>
+ <p class="gInfo">
+ <?= t("GraphicsMagick is not available on your system.") ?>
+ </p>
+ <? endif ?>
+</div>
diff --git a/core/views/admin_graphics_imagemagick.html.php b/core/views/admin_graphics_imagemagick.html.php
new file mode 100644
index 00000000..24cdfb02
--- /dev/null
+++ b/core/views/admin_graphics_imagemagick.html.php
@@ -0,0 +1,17 @@
+<div id="imagemagick" class="gBlock <?= $tk->imagemagick ? "" : "unavailable" ?>">
+ <h3> <?= t("ImageMagick") ?> </h3>
+ <img class="logo" width="114" height="118" src="http://www.imagemagick.org/image/logo.jpg" alt="<? t("Visit the ImageMagick project site") ?>" />
+ <p>
+ <?= t("ImageMagick is a standalone graphics program available on most Linux systems. Please refer to the <a href=\"{{url}}\">ImageMagick website</a> for more information.",
+ array("url" => "http://www.imagemagick.org")) ?>
+ </p>
+ <? if ($tk->imagemagick): ?>
+ <p class="gSuccess">
+ <?= t("ImageMagick is available in {{path}}", array("path" => $tk->imagemagick)) ?>
+ </p>
+ <? else: ?>
+ <p class="gInfo">
+ <?= t("ImageMagick is not available on your system.") ?>
+ </p>
+ <? endif ?>
+</div>