summaryrefslogtreecommitdiff
path: root/modules/gallery/views
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/views')
-rw-r--r--modules/gallery/views/admin_advanced_settings.html.php34
-rw-r--r--modules/gallery/views/admin_block_log_entries.html.php11
-rw-r--r--modules/gallery/views/admin_block_news.html.php11
-rw-r--r--modules/gallery/views/admin_block_photo_stream.html.php14
-rw-r--r--modules/gallery/views/admin_block_platform.html.php18
-rw-r--r--modules/gallery/views/admin_block_stats.html.php12
-rw-r--r--modules/gallery/views/admin_block_welcome.html.php20
-rw-r--r--modules/gallery/views/admin_dashboard.html.php38
-rw-r--r--modules/gallery/views/admin_graphics.html.php28
-rw-r--r--modules/gallery/views/admin_graphics_gd.html.php29
-rw-r--r--modules/gallery/views/admin_graphics_graphicsmagick.html.php21
-rw-r--r--modules/gallery/views/admin_graphics_imagemagick.html.php21
-rw-r--r--modules/gallery/views/admin_graphics_none.html.php7
-rw-r--r--modules/gallery/views/admin_languages.html.php15
-rw-r--r--modules/gallery/views/admin_maintenance.html.php181
-rw-r--r--modules/gallery/views/admin_maintenance_task.html.php32
-rw-r--r--modules/gallery/views/admin_modules.html.php32
-rw-r--r--modules/gallery/views/admin_theme_details.html.php6
-rw-r--r--modules/gallery/views/admin_themes.html.php89
-rw-r--r--modules/gallery/views/admin_themes_preview.html.php7
-rw-r--r--modules/gallery/views/after_install.html.php29
-rw-r--r--modules/gallery/views/after_install_loader.html.php7
-rw-r--r--modules/gallery/views/form.html.php75
-rw-r--r--modules/gallery/views/kohana_error_page.php118
-rw-r--r--modules/gallery/views/kohana_profiler.php35
-rw-r--r--modules/gallery/views/l10n_client.html.php31
-rw-r--r--modules/gallery/views/maintenance.html.php50
-rw-r--r--modules/gallery/views/move_browse.html.php47
-rw-r--r--modules/gallery/views/move_tree.html.php19
-rw-r--r--modules/gallery/views/permissions_browse.html.php56
-rw-r--r--modules/gallery/views/permissions_form.html.php94
-rw-r--r--modules/gallery/views/quick_pane.html.php108
-rw-r--r--modules/gallery/views/scaffold.html.php169
-rw-r--r--modules/gallery/views/simple_uploader.html.php249
34 files changed, 1713 insertions, 0 deletions
diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php
new file mode 100644
index 00000000..1f3825bd
--- /dev/null
+++ b/modules/gallery/views/admin_advanced_settings.html.php
@@ -0,0 +1,34 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="gAdminAdvancedSettings">
+ <h1> <?= t("Advanced Settings") ?> </h1>
+ <p>
+ <?= t("Here are internal Gallery configuration settings. Most of these settings are accessible elsewhere in the administrative console.") ?>
+ </p>
+ <ul id="gMessage">
+ <li class="gWarning">
+ <b><?= t("Change these values at your own risk!</b>") ?>
+ </li>
+ </ul>
+
+ <table>
+ <tr>
+ <th> <?= t("Module") ?> </th>
+ <th> <?= t("Name") ?> </th>
+ <th> <?= t("Value") ?></th>
+ </tr>
+ <? foreach ($vars as $var): ?>
+ <? if ($var->module_name == "core" && $var->name == "_cache") continue ?>
+ <tr class="setting">
+ <td> <?= $var->module_name ?> </td>
+ <td> <?= $var->name ?> </td>
+ <td>
+ <a href="<?= url::site("admin/advanced_settings/edit/$var->module_name/$var->name") ?>"
+ class="gDialogLink"
+ title="<?= t("Edit %var (%module_name)", array("var" => $var->name, "module_name" => $var->module_name)) ?>">
+ <?= $var->value ?>
+ </a>
+ </td>
+ </tr>
+ <? endforeach ?>
+ </table>
+</div>
diff --git a/modules/gallery/views/admin_block_log_entries.html.php b/modules/gallery/views/admin_block_log_entries.html.php
new file mode 100644
index 00000000..db6313e1
--- /dev/null
+++ b/modules/gallery/views/admin_block_log_entries.html.php
@@ -0,0 +1,11 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<ul>
+ <? foreach ($entries as $entry): ?>
+ <li class="<?= log::severity_class($entry->severity) ?>">
+ <a href="<?= url::site("user/$entry->user_id") ?>"><?= $entry->user->name ?></a>
+ <?= date("Y-M-d H:i:s", $entry->timestamp) ?>
+ <?= $entry->message ?>
+ <?= $entry->html ?>
+ </li>
+ <? endforeach ?>
+</ul>
diff --git a/modules/gallery/views/admin_block_news.html.php b/modules/gallery/views/admin_block_news.html.php
new file mode 100644
index 00000000..cb276ae5
--- /dev/null
+++ b/modules/gallery/views/admin_block_news.html.php
@@ -0,0 +1,11 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<ul>
+ <? foreach ($feed as $entry): ?>
+ <li>
+ <a href="<?= $entry["link"] ?>"><?= $entry["title"] ?></a>
+ <p>
+ <?= text::limit_words(strip_tags($entry["description"]), 25); ?>
+ </p>
+ </li>
+ <? endforeach ?>
+</ul>
diff --git a/modules/gallery/views/admin_block_photo_stream.html.php b/modules/gallery/views/admin_block_photo_stream.html.php
new file mode 100644
index 00000000..e8a4d933
--- /dev/null
+++ b/modules/gallery/views/admin_block_photo_stream.html.php
@@ -0,0 +1,14 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<ul>
+<? foreach ($photos as $photo): ?>
+ <li class="gItem gPhoto">
+ <a href="<?= url::site("photos/$photo->id") ?>" title="<?= $photo->title ?>">
+ <img <?= photo::img_dimensions($photo->width, $photo->height, 72) ?>
+ src="<?= $photo->thumb_url() ?>" alt="<?= $photo->title ?>" />
+ </a>
+ </li>
+<? endforeach ?>
+</ul>
+<p>
+ <?= t("Recent photos added to your Gallery") ?>
+</p>
diff --git a/modules/gallery/views/admin_block_platform.html.php b/modules/gallery/views/admin_block_platform.html.php
new file mode 100644
index 00000000..6b79f047
--- /dev/null
+++ b/modules/gallery/views/admin_block_platform.html.php
@@ -0,0 +1,18 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<ul>
+ <li>
+ <?= t("Operating System: %operating_system", array("operating_system" => PHP_OS)) ?>
+ </li>
+ <li>
+ <?= t("Apache: %apache_version", array("apache_version" => function_exists("apache_get_version") ? apache_get_version() : t("Unknown"))) ?>
+ </li>
+ <li>
+ <?= t("PHP: %php_version", array("php_version" => phpversion())) ?>
+ </li>
+ <li>
+ <?= t("MySQL: %mysql_version", array("mysql_version" => Database::instance()->query("SELECT version() as v")->current()->v)) ?>
+ </li>
+ <li>
+ <?= t("Server load: %load_average", array("load_average" => $load_average)) ?>
+ </li>
+</ul>
diff --git a/modules/gallery/views/admin_block_stats.html.php b/modules/gallery/views/admin_block_stats.html.php
new file mode 100644
index 00000000..2d975073
--- /dev/null
+++ b/modules/gallery/views/admin_block_stats.html.php
@@ -0,0 +1,12 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<ul>
+ <li>
+ <?= t("Version: %version", array("version" => module::get_var("core", "version"))) ?>
+ </li>
+ <li>
+ <?= t("Albums: %count", array("count" => $album_count)) ?>
+ </li>
+ <li>
+ <?= t("Photos: %count", array("count" => $photo_count)) ?>
+ </li>
+</ul>
diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php
new file mode 100644
index 00000000..488fa908
--- /dev/null
+++ b/modules/gallery/views/admin_block_welcome.html.php
@@ -0,0 +1,20 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<p>
+ <?= t("This is your administration dashboard and it provides a quick overview of status messages, recent updates, and frequently used options. Add or remove blocks and rearrange them to tailor to your needs. The admin menu provides quick access to all of Gallery 3's options and settings. Here are a few of the most used options to get you started.") ?>
+</p>
+<ul>
+ <li>
+ <?= t("General Settings - choose your <a href=\"%graphics_url\">graphics</a> and <a href=\"%language_url\">language</a> settings.",
+ array("graphics_url" => url::site("admin/graphics"),
+ "language_url" => url::site("admin/languages"))) ?>
+ </li>
+ <li>
+ <?= t("Appearance - <a href=\"%theme_url\">choose a theme</a>, or <a href=\"%theme_details_url\">customize the way it looks</a>.",
+ array("theme_url" => url::site("admin/theme"),
+ "theme_details_url" => url::site("admin/theme_details"))) ?>
+ </li>
+ <li>
+ <?= t("Customize - <a href=\"%modules_url\">install modules</a> to add cool features!",
+ array("modules_url" => url::site("admin/modules"))) ?>
+ </li>
+</ul>
diff --git a/modules/gallery/views/admin_dashboard.html.php b/modules/gallery/views/admin_dashboard.html.php
new file mode 100644
index 00000000..c266d7e1
--- /dev/null
+++ b/modules/gallery/views/admin_dashboard.html.php
@@ -0,0 +1,38 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<script type="text/javascript">
+ update_blocks = function() {
+ $.get("<?= url::site("admin/dashboard/reorder") ?>",
+ {"csrf": "<?= $csrf ?>",
+ "dashboard_center[]": $("#gAdminDashboard").sortable(
+ "toArray", {attribute: "block_id"}),
+ "dashboard_sidebar[]": $("#gAdminDashboardSidebar").sortable(
+ "toArray", {attribute: "block_id"})});
+ };
+
+ $(document).ready(function(){
+ $("#gAdminDashboard .gBlock *:first").addClass("gDraggable");
+ $("#gAdminDashboard").sortable({
+ connectWith: ["#gAdminDashboardSidebar"],
+ containment: "document",
+ cursor: "move",
+ handle: $("div:first"),
+ opacity: 0.6,
+ placeholder: "gDropTarget",
+ stop: update_blocks
+ });
+
+ $("#gAdminDashboardSidebar .gBlock *:first").addClass("gDraggable");
+ $("#gAdminDashboardSidebar").sortable({
+ connectWith: ["#gAdminDashboard"],
+ containment: "document",
+ cursor: "move",
+ handle: $("div:first"),
+ opacity: 0.6,
+ placeholder: "gDropTarget",
+ stop: update_blocks
+ });
+ });
+</script>
+<div id="gAdminDashboard">
+ <?= $blocks ?>
+</div>
diff --git a/modules/gallery/views/admin_graphics.html.php b/modules/gallery/views/admin_graphics.html.php
new file mode 100644
index 00000000..08374471
--- /dev/null
+++ b/modules/gallery/views/admin_graphics.html.php
@@ -0,0 +1,28 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<script type="text/javascript">
+ $(document).ready(function() {
+ select_toolkit = function(el) {
+ if (!$(this).hasClass("gUnavailable")) {
+ window.location = '<?= url::site("admin/graphics/choose/__TK__?csrf=$csrf") ?>'
+ .replace("__TK__", $(this).attr("id"));
+ }
+ };
+ $("#gAdminGraphics div.gAvailable .gBlock").click(select_toolkit);
+ });
+
+</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>
+
+ <h2> <?= t("Active Toolkit") ?> </h2>
+ <?= $active ?>
+
+ <div class="gAvailable">
+ <h2> <?= t("Available Toolkits") ?> </h2>
+ <?= $available ?>
+ </div>
+</div>
+
diff --git a/modules/gallery/views/admin_graphics_gd.html.php b/modules/gallery/views/admin_graphics_gd.html.php
new file mode 100644
index 00000000..cae68b74
--- /dev/null
+++ b/modules/gallery/views/admin_graphics_gd.html.php
@@ -0,0 +1,29 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="gd" class="gBlock<?= $is_active ? " gSelected" : "" ?><?= $tk->gd["GD Version"] ? " gInstalledToolkit" : " gUnavailable" ?>">
+ <img class="logo" width="170" height="110" src="<?= url::file("core/images/gd.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>
+ <p>
+ <a class="gButtonLink ui-state-default ui-corner-all"><?= t("Activate GD") ?></a>
+ </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>
+ <p>
+ <a class="gButtonLink ui-state-default ui-corner-all"><?= t("Activate GD") ?></a>
+ </p>
+ <? else: ?>
+ <p class="gInfo">
+ <?= t("You do not have GD installed.") ?>
+ </p>
+ <? endif ?>
+</div>
diff --git a/modules/gallery/views/admin_graphics_graphicsmagick.html.php b/modules/gallery/views/admin_graphics_graphicsmagick.html.php
new file mode 100644
index 00000000..720a9459
--- /dev/null
+++ b/modules/gallery/views/admin_graphics_graphicsmagick.html.php
@@ -0,0 +1,21 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="graphicsmagick" class="gBlock<?= $is_active ? " gSelected" : "" ?><?= $tk->graphicsmagick ? " gInstalledToolkit" : " gUnavailable" ?>">
+ <h3> <?= t("GraphicsMagick") ?> </h3>
+ <img class="logo" width="107" height="76" src="<?= url::file("core/images/graphicsmagick.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>
+ <p>
+ <a class="gButtonLink ui-state-default ui-corner-all"><?= t("Activate Graphics Magic") ?></a>
+ </p>
+ <? else: ?>
+ <p class="gInfo">
+ <?= t("GraphicsMagick is not available on your system.") ?>
+ </p>
+ <? endif ?>
+</div>
diff --git a/modules/gallery/views/admin_graphics_imagemagick.html.php b/modules/gallery/views/admin_graphics_imagemagick.html.php
new file mode 100644
index 00000000..c7468eed
--- /dev/null
+++ b/modules/gallery/views/admin_graphics_imagemagick.html.php
@@ -0,0 +1,21 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="imagemagick" class="gBlock<?= $is_active ? " gSelected" : "" ?><?= $tk->imagemagick ? " gInstalledToolkit" : " gUnavailable" ?>">
+ <h3> <?= t("ImageMagick") ?> </h3>
+ <img class="logo" width="114" height="118" src="<?= url::file("core/images/imagemagick.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>
+ <p>
+ <a class="gButtonLink ui-state-default ui-corner-all"><?= t("Activate ImageMagick") ?></a>
+ </p>
+ <? else: ?>
+ <p class="gInfo">
+ <?= t("ImageMagick is not available on your system.") ?>
+ </p>
+ <? endif ?>
+</div>
diff --git a/modules/gallery/views/admin_graphics_none.html.php b/modules/gallery/views/admin_graphics_none.html.php
new file mode 100644
index 00000000..5306a70d
--- /dev/null
+++ b/modules/gallery/views/admin_graphics_none.html.php
@@ -0,0 +1,7 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="none" class="gBlock">
+ <h3 class="gWarning"> <?= t("No Active Toolkit") ?> </h3>
+ <p>
+ <?= t("We were unable to detect a graphics program. You must install one of the toolkits below in order to many Gallery features.") ?>
+ </p>
+</div>
diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php
new file mode 100644
index 00000000..2b43f1b4
--- /dev/null
+++ b/modules/gallery/views/admin_languages.html.php
@@ -0,0 +1,15 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="gLanguages">
+ <h2> <?= t("Languages") ?> </h2>
+
+ <?= $settings_form ?>
+
+ <h2> <?= t("Download translations") ?> </h2>
+ <a href="<?= url::site("admin/maintenance/start/core_task::update_l10n?csrf=$csrf") ?>"
+ class="gDialogLink">
+ <?= t("Get updates") ?>
+ </a>
+
+ <h2> <?= t("Your Own Translations") ?> </h2>
+ <?= $share_translations_form ?>
+</div>
diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php
new file mode 100644
index 00000000..bc060a7b
--- /dev/null
+++ b/modules/gallery/views/admin_maintenance.html.php
@@ -0,0 +1,181 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="gAdminMaintenance">
+ <h1> <?= t("Maintenance Tasks") ?> </h1>
+ <p>
+ <?= t("Occasionally your Gallery will require some maintenance. Here are some tasks you can use to keep it running smoothly.") ?>
+ </p>
+
+ <div id="gAvailableTasks">
+ <h2> <?= t("Available Tasks") ?> </h2>
+ <table>
+ <tr>
+ <th>
+ <?= t("Name") ?>
+ </th>
+ <th>
+ <?= t("Description") ?>
+ </th>
+ <th>
+ <?= t("Action") ?>
+ </th>
+ </tr>
+ <? foreach ($task_definitions as $task): ?>
+ <tr class="<?= log::severity_class($task->severity) ?>">
+ <td>
+ <?= $task->name ?>
+ </td>
+ <td>
+ <?= $task->description ?>
+ </td>
+ <td>
+ <a href="<?= url::site("admin/maintenance/start/$task->callback?csrf=$csrf") ?>"
+ class="gDialogLink">
+ <?= t("run") ?>
+ </a>
+ </td>
+ </tr>
+ <? endforeach ?>
+ </table>
+ </div>
+
+ <? if ($running_tasks->count()): ?>
+ <div id="gRunningTasks">
+ <h2> <?= t("Running Tasks") ?> </h2>
+ <a href="<?= url::site("admin/maintenance/cancel_running_tasks?csrf=$csrf") ?>"
+ class="gButtonLink ui-icon-left ui-state-default ui-corner-all right">
+ <?= t("cancel all") ?></a>
+
+ <table>
+ <tr>
+ <th>
+ <?= t("Last Updated") ?>
+ </th>
+ <th>
+ <?= t("Name") ?>
+ </th>
+ <th>
+ <?= t("Status") ?>
+ </th>
+ <th>
+ <?= t("Info") ?>
+ </th>
+ <th>
+ <?= t("Owner") ?>
+ </th>
+ <th>
+ <?= t("Action") ?>
+ </th>
+ </tr>
+ <? foreach ($running_tasks as $task): ?>
+ <tr class="<?= $task->state == "stalled" ? "gWarning" : "" ?>">
+ <td>
+ <?= date("M j, Y H:i:s", $task->updated) ?>
+ </td>
+ <td>
+ <?= $task->name ?>
+ </td>
+ <td>
+ <? if ($task->done): ?>
+ <? if ($task->state == "cancelled"): ?>
+ <?= t("Cancelled") ?>
+ <? endif ?>
+ <?= t("Done") ?>
+ <? elseif ($task->state == "stalled"): ?>
+ <?= t("Stalled") ?>
+ <? else: ?>
+ <?= t("%percent_complete% Complete", array("percent_complete" => $task->percent_complete)) ?>
+ <? endif ?>
+ </td>
+ <td>
+ <?= $task->status ?>
+ </td>
+ <td>
+ <?= $task->owner()->name ?>
+ </td>
+ <td>
+ <? if ($task->state == "stalled"): ?>
+ <a class="gDialogLink" href="<?= url::site("admin/maintenance/resume/$task->id?csrf=$csrf") ?>">
+ <?= t("resume") ?>
+ </a>
+ <? endif ?>
+ <a href="<?= url::site("admin/maintenance/cancel/$task->id?csrf=$csrf") ?>">
+ <?= t("cancel") ?>
+ </a>
+ </td>
+ </tr>
+ <? endforeach ?>
+ </table>
+ </div>
+ <? endif ?>
+
+ <? if ($finished_tasks->count()): ?>
+ <div id="gFinishedTasks">
+ <a href="<?= url::site("admin/maintenance/remove_finished_tasks?csrf=$csrf") ?>"
+ class="gButtonLink ui-icon-left ui-state-default ui-corner-all right">
+ <span class="ui-icon ui-icon-trash"></span><?= t("remove all finished") ?></a>
+
+ <h2> <?= t("Finished Tasks") ?> </h2>
+ <table>
+ <tr>
+ <th>
+ <?= t("Last Updated") ?>
+ </th>
+ <th>
+ <?= t("Name") ?>
+ </th>
+ <th>
+ <?= t("Status") ?>
+ </th>
+ <th>
+ <?= t("Info") ?>
+ </th>
+ <th>
+ <?= t("Owner") ?>
+ </th>
+ <th>
+ <?= t("Action") ?>
+ </th>
+ </tr>
+ <? foreach ($finished_tasks as $task): ?>
+ <tr class="<?= $task->state == "success" ? "gSuccess" : "gError" ?>">
+ <td>
+ <?= date("M j, Y H:i:s", $task->updated) ?>
+ </td>
+ <td>
+ <?= $task->name ?>
+ </td>
+ <td>
+ <? if ($task->state == "success"): ?>
+ <?= t("Success") ?>
+ <? elseif ($task->state == "error"): ?>
+ <?= t("Failed") ?>
+ <? elseif ($task->state == "cancelled"): ?>
+ <?= t("Cancelled") ?>
+ <? endif ?>
+ </td>
+ <td>
+ <?= $task->status ?>
+ </td>
+ <td>
+ <?= $task->owner()->name ?>
+ </td>
+ <td>
+ <? if ($task->done): ?>
+ <a href="<?= url::site("admin/maintenance/remove/$task->id?csrf=$csrf") ?>">
+ <?= t("remove") ?>
+ </a>
+ <? else: ?>
+ <a class="gDialogLink" href="<?= url::site("admin/maintenance/resume/$task->id?csrf=$csrf") ?>">
+ <?= t("resume") ?>
+ </a>
+ <a href="<?= url::site("admin/maintenance/cancel/$task->id?csrf=$csrf") ?>">
+ <?= t("cancel") ?>
+ </a>
+ <? endif ?>
+ </td>
+ </tr>
+ <? endforeach ?>
+ </table>
+ </div>
+ <? endif ?>
+</div>
diff --git a/modules/gallery/views/admin_maintenance_task.html.php b/modules/gallery/views/admin_maintenance_task.html.php
new file mode 100644
index 00000000..1ee02311
--- /dev/null
+++ b/modules/gallery/views/admin_maintenance_task.html.php
@@ -0,0 +1,32 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<script type="text/javascript">
+ update = function() {
+ $.ajax({
+ url: "<?= url::site("admin/maintenance/run/$task->id?csrf=$csrf") ?>",
+ dataType: "json",
+ success: function(data) {
+ $(".gProgressBar").progressbar("value", data.task.percent_complete);
+ $("#gStatus").html("" + data.task.status);
+ if (data.task.done) {
+ $("#gPauseButton").hide();
+ $("#gDoneButton").show();
+ } else {
+ setTimeout(update, 100);
+ }
+ }
+ });
+ }
+ $(".gProgressBar").progressbar({value: 0});
+ update();
+ dismiss = function() {
+ window.location.reload();
+ }
+</script>
+<div id="gProgress">
+ <div class="gProgressBar"></div>
+ <div id="gStatus"></div>
+ <div>
+ <button id="gPauseButton" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Pause") ?></button>
+ <button id="gDoneButton" class="ui-state-default ui-corner-all" style="display: none" onclick="dismiss()"><?= t("Done") ?></button>
+ </div>
+</div>
diff --git a/modules/gallery/views/admin_modules.html.php b/modules/gallery/views/admin_modules.html.php
new file mode 100644
index 00000000..3fddd6cd
--- /dev/null
+++ b/modules/gallery/views/admin_modules.html.php
@@ -0,0 +1,32 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="gModules">
+ <h1> <?= t("Gallery Modules") ?> </h1>
+ <p>
+ <?= t("Power up your Gallery by adding more modules! Each module provides new cool features.") ?>
+ </p>
+
+ <form method="post" action="<?= url::site("admin/modules/save") ?>">
+ <?= access::csrf_form_field() ?>
+ <table>
+ <tr>
+ <th> <?= t("Installed") ?> </th>
+ <th> <?= t("Name") ?> </th>
+ <th> <?= t("Version") ?> </th>
+ <th> <?= t("Description") ?> </th>
+ </tr>
+ <? $i = 0 ?>
+ <? foreach ($available as $module_name => $module_info): ?>
+ <tr class="<?= ($i % 2 == 0) ? "gEvenRow" : "gOddRow" ?>">
+ <? $data = array("name" => $module_name); ?>
+ <? if ($module_info->locked) $data["disabled"] = 1; ?>
+ <td> <?= form::checkbox($data, '1', module::is_active($module_name)) ?> </td>
+ <td> <?= t($module_info->name) ?> </td>
+ <td> <?= $module_info->version ?> </td>
+ <td> <?= t($module_info->description) ?> </td>
+ </tr>
+ <? $i++ ?>
+ <? endforeach ?>
+ </table>
+ <input type="submit" value="<?= t("Update") ?>"/>
+ </form>
+</div>
diff --git a/modules/gallery/views/admin_theme_details.html.php b/modules/gallery/views/admin_theme_details.html.php
new file mode 100644
index 00000000..eb450b16
--- /dev/null
+++ b/modules/gallery/views/admin_theme_details.html.php
@@ -0,0 +1,6 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="gAdminThemeDetails">
+ <h1> <?= t("Theme Details") ?> </h1>
+
+ <?= $form ?>
+</div>
diff --git a/modules/gallery/views/admin_themes.html.php b/modules/gallery/views/admin_themes.html.php
new file mode 100644
index 00000000..f85bce70
--- /dev/null
+++ b/modules/gallery/views/admin_themes.html.php
@@ -0,0 +1,89 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<script type="text/javascript">
+ var select_url = "<?= url::site("admin/themes/choose") ?>";
+ select = function(type, id) {
+ $.post(select_url, {"type": type, "id": id, "csrf": '<?= $csrf ?>'},
+ function() { load(type) });
+ }
+</script>
+
+<h1> <?= t("Theme Administration") ?> </h1>
+<p>
+ <?= t("Gallery allows you to choose a theme for browsing your Gallery, as well as a special theme for the administration interface. Click a theme to preview and activate it.") ?>
+</p>
+
+<div id="gSiteTheme">
+ <h2> <?= t("Gallery theme") ?> </h2>
+ <div class="gBlock gSelected">
+ <img src="<?= url::file("themes/{$site}/thumbnail.png") ?>"
+ alt="<?= $themes[$site]->name ?>" />
+ <h3> <?= $themes[$site]->name ?> </h3>
+ <p>
+ <?= $themes[$site]->description ?>
+ </p>
+ </div>
+
+ <h2> <?= t("Available Gallery themes") ?> </h2>
+ <div class="gAvailable">
+ <? $count = 0 ?>
+ <? foreach ($themes as $id => $info): ?>
+ <? if (!$info->site) continue ?>
+ <? if ($id == $site) continue ?>
+ <div class="gBlock">
+ <a href="<?= url::site("admin/themes/preview/site/$id") ?>" class="gDialogLink" title="<?= t("Theme Preview: %theme_name", array("theme_name" => $info->name)) ?>">
+ <img src="<?= url::file("themes/{$id}/thumbnail.png") ?>"
+ alt="<?= $info->name ?>" />
+ <h3> <?= $info->name ?> </h3>
+ <p>
+ <?= $info->description ?>
+ </p>
+ </a>
+ </div>
+ <? $count++ ?>
+ <? endforeach ?>
+
+ <? if (!$count): ?>
+ <p>
+ <?= t("There are no other site themes available.") ?>
+ </p>
+ <? endif ?>
+ </div>
+</div>
+
+<div id="gAdminTheme">
+ <h2> <?= t("Admin theme") ?> </h2>
+ <div class="gBlock gSelected">
+ <img src="<?= url::file("themes/{$admin}/thumbnail.png") ?>"
+ alt="<?= $themes[$admin]->name ?>" />
+ <h3> <?= $themes[$admin]->name ?> </h3>
+ <p>
+ <?= $themes[$admin]->description ?>
+ </p>
+ </div>
+
+ <h2> <?= t("Available admin themes") ?> </h2>
+ <div class="gAvailable">
+ <? $count = 0 ?>
+ <? foreach ($themes as $id => $info): ?>
+ <? if (!$info->admin) continue ?>
+ <? if ($id == $admin) continue ?>
+ <div class="gBlock">
+ <a href="<?= url::site("admin/themes/preview/admin/$id") ?>" class="gDialogLink" title="<?= t("Theme Preview: %theme_name", array("theme_name" => $info->name)) ?>">
+ <img src="<?= url::file("themes/{$id}/thumbnail.png") ?>"
+ alt="<?= $info->name ?>" />
+ <h3> <?= $info->name ?> </h3>
+ <p>
+ <?= $info->description ?>
+ </p>
+ </a>
+ </div>
+ <? $count++ ?>
+ <? endforeach ?>
+
+ <? if (!$count): ?>
+ <p>
+ <?= t("There are no other admin themes available.") ?>
+ </p>
+ <? endif ?>
+ </div>
+</div> \ No newline at end of file
diff --git a/modules/gallery/views/admin_themes_preview.html.php b/modules/gallery/views/admin_themes_preview.html.php
new file mode 100644
index 00000000..a7aea172
--- /dev/null
+++ b/modules/gallery/views/admin_themes_preview.html.php
@@ -0,0 +1,7 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<p>
+ <a href="<?= url::site("admin/themes/choose/$type/$theme_name?csrf=$csrf") ?>">
+ <?= t("Activate <strong>%theme_name</strong>", array("theme_name" => $info->name)) ?>
+ </a>
+</p>
+<iframe src="<?= $url ?>" style="width: 900px; height: 450px"></iframe>
diff --git a/modules/gallery/views/after_install.html.php b/modules/gallery/views/after_install.html.php
new file mode 100644
index 00000000..aa26858a
--- /dev/null
+++ b/modules/gallery/views/after_install.html.php
@@ -0,0 +1,29 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<h1 style="display: none">
+ <?= t("Welcome to Gallery 3!") ?>
+</h1>
+
+<p>
+ <?= t("Congratulations on choosing Gallery to host your photos. We're confident that you're going to have a great experience.") ?>
+</p>
+
+<p>
+ <?= t("You're logged in to the <b>%user_name</b> account. The very first thing you should do is to change your password to something that you'll remember.", array("user_name" => $user->name)) ?>
+</p>
+
+<p>
+ <a href="<?= url::site("form/edit/users/{$user->id}") ?>"
+ title="<?= t("Edit Your Profile") ?>"
+ id="gAfterInstallChangePasswordLink" class="gButtonLink ui-state-default ui-corners-all"><?= t("Change Password Now") ?></a>
+ <script>
+ $("#gAfterInstallChangePasswordLink").bind("click", handleDialogEvent);
+ </script>
+</p>
+
+<p>
+ <?= t("Want to learn more? The <a href=\"%url\">Gallery website</a> has news and information about Gallery Project and community.", array("url" => "http://gallery.menalto.com")) ?>
+</p>
+
+<p>
+ <?= t("Having problems? There's lots of information in our <a href=\"%codex_url\">documentation site</a> or you can <a href=\"%forum_url\">ask for help in the forums!</a>", array("codex_url" => "http://codex.gallery2.org/Main_Page", "forum_url" => "http://gallery.menalto.com/forum")) ?>
+</ul>
diff --git a/modules/gallery/views/after_install_loader.html.php b/modules/gallery/views/after_install_loader.html.php
new file mode 100644
index 00000000..baf91eed
--- /dev/null
+++ b/modules/gallery/views/after_install_loader.html.php
@@ -0,0 +1,7 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<span id="gAfterInstall"
+ title="<?= t("Welcome to Gallery 3") ?>"
+ href="<?= url::site("after_install") ?>"/>
+<script type="text/javascript">
+ $(document).ready(function(){openDialog($("#gAfterInstall"));});
+</script>
diff --git a/modules/gallery/views/form.html.php b/modules/gallery/views/form.html.php
new file mode 100644
index 00000000..ec2a56a9
--- /dev/null
+++ b/modules/gallery/views/form.html.php
@@ -0,0 +1,75 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?
+print($open);
+
+// Not sure what to do with these, but at least show that we received them.
+if ($class) {
+ print "<!-- unused class in form.html.php: $class -->";
+}
+if ($title) {
+ print $title;
+}
+
+if (!function_exists("DrawForm")) {
+ function DrawForm($inputs, $level=1) {
+ $error_messages = array();
+ $prefix = str_repeat(" ", $level);
+ $haveGroup = false;
+ // On the first level, make sure we have a group if not add the <ul> tag now
+ if ($level == 1) {
+ foreach ($inputs as $input) {
+ $haveGroup |= $input->type == 'group';
+ }
+ if (!$haveGroup) {
+ print "$prefix<ul>\n";
+ }
+ }
+
+ foreach ($inputs as $input) {
+ if ($input->type == 'group') {
+ print "$prefix<fieldset>\n";
+ print "$prefix <legend>{$input->label}</legend>\n";
+ print "$prefix <ul>\n";
+
+ DrawForm($input->inputs, $level + 2);
+ print "$prefix </ul>\n";
+
+ // Since hidden fields can only have name and value attributes lets just render it now
+ $hidden_prefix = "$prefix ";
+ foreach ($input->hidden as $hidden) {
+ print "$prefix {$hidden->render()}\n";
+ }
+ print "$prefix</fieldset>\n";
+ } else {
+ if ($input->error_messages()) {
+ print "$prefix<li class=\"gError\">\n";
+ } else {
+ print "$prefix<li>\n";
+ }
+
+ if ($input->label()) {
+ print "$prefix {$input->label()}\n";
+ }
+ print "$prefix {$input->render()}\n";
+ if ($input->message()) {
+ print "$prefix <p>{$input->message()}</p>\n";
+ }
+ if ($input->error_messages()) {
+ foreach ($input->error_messages() as $error_message) {
+ print "$prefix <p class=\"gError\">\n";
+ print "$prefix $error_message\n";
+ print "$prefix </p>\n";
+ }
+ }
+ print "$prefix</li>\n";
+ }
+ }
+ if ($level == 1 && !$haveGroup) {
+ print "$prefix</ul>\n";
+ }
+ }
+}
+DrawForm($inputs);
+
+print($close);
+?>
diff --git a/modules/gallery/views/kohana_error_page.php b/modules/gallery/views/kohana_error_page.php
new file mode 100644
index 00000000..d9bf9698
--- /dev/null
+++ b/modules/gallery/views/kohana_error_page.php
@@ -0,0 +1,118 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <style type="text/css">
+ body {
+ background: #fff;
+ font-size: 14px;
+ line-height: 130%;
+ }
+
+ div.big_box {
+ padding: 10px;
+ background: #eee;
+ border: solid 1px #ccc;
+ font-family: sans-serif;
+ color: #111;
+ width: 42em;
+ margin: 20px auto;
+ }
+
+ div#framework_error {
+ text-align: center;
+ }
+
+ div#error_details {
+ text-align: left;
+ }
+
+ code {
+ font-family: monospace;
+ font-size: 12px;
+ margin: 20px;
+ color: #333;
+ white-space: pre-wrap;
+ white-space: -moz-pre-wrap;
+ word-wrap: break-word;
+ }
+
+ h3 {
+ font-family: sans-serif;
+ margin: 2px 0px 0px 0px;
+ padding: 8px 0px 0px 0px;
+ border-top: 1px solid #ddd;
+ }
+
+ p {
+ padding: 0px;
+ margin: 0px 0px 10px 0px;
+ }
+
+ li, pre {
+ padding: 0px;
+ margin: 0px;
+ }
+ </style>
+ <script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title><?= t("Something went wrong!") ?></title>
+ </head>
+ <body>
+ <? try { $user = user::active(); } catch (Exception $e) { } ?>
+ <? $admin = isset($user) && $user->admin ?>
+ <div class="big_box" id="framework_error">
+ <h1>
+ <?= t("Dang... Something went wrong!") ?>
+ </h1>
+ <h2>
+ <?= t("We tried really hard, but it's broken.") ?>
+ </h2>
+ <? if (!$admin): ?>
+ <p>
+ <?= t("Talk to your Gallery administrator for help fixing this!") ?>
+ </p>
+ <? endif ?>
+ </div>
+ <? if ($admin): ?>
+ <div class="big_box" id="error_details">
+ <h2>
+ <?= t("Hey wait, you're an admin! We can tell you stuff.") ?>
+ </h2>
+ <a id="toggle" href=""
+ onclick="javascript:$('#stuff').slideDown('slow'); $('#toggle').slideUp(); return false">
+ <b><?= t("Ok.. tell me stuff!") ?></b>
+ </a>
+ <div id="stuff" style="display: none">
+ <? if (!empty($line) and !empty($file)): ?>
+ <div id="summary">
+ <h3>
+ <?= t("Help!") ?>
+ </h3>
+ <p>
+ <?= t("If this stuff doesn't make any sense to you, <a href=\"%url\">ask for help in the Gallery forums</a>!", array("url" => "http://gallery.menalto.com/forum/96")) ?>
+ </p>
+ <h3>
+ <?= t("So here's the error:") ?>
+ </h3>
+
+ <code class="block"><?= $message ?></code>
+ <p>
+ <?= t("File: <b>%file</b>, line: <b>%line</b>", array("file" => $file, "line" => $line)) ?>
+ </p>
+ </div>
+ <? endif ?>
+
+ <? $trace = $PHP_ERROR ? array_slice(debug_backtrace(), 1) : $exception->getTrace(); ?>
+ <? $trace = Kohana::backtrace($trace); ?>
+ <? if (!empty($trace)): ?>
+ <div id="stack_trace">
+ <h3>
+ <?= t("And here's how we got there:") ?>
+ </h3>
+ <?= $trace ?>
+ <? endif ?>
+ </div>
+ </div>
+ <? endif ?>
+ </body>
+</html>
diff --git a/modules/gallery/views/kohana_profiler.php b/modules/gallery/views/kohana_profiler.php
new file mode 100644
index 00000000..c7534349
--- /dev/null
+++ b/modules/gallery/views/kohana_profiler.php
@@ -0,0 +1,35 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<style type="text/css">
+ #kohana-profiler {
+ background-color: #F8FFF8;
+ border: 1px solid #E5EFF8;
+ clear: both;
+ font-family: Monaco, 'Courier New';
+ margin-top: 20px;
+ padding: 10px 10px 0;
+ text-align: left;
+ }
+ #kohana-profiler pre {
+ font: inherit;
+ margin: 0;
+ }
+ #kohana-profiler .kp-meta {
+ background: #fff;
+ border: 1px solid #E5EFF8;
+ color: #A6B0B8;
+ margin: 0 0 10px;
+ padding: 4px;
+ text-align: center;
+ }
+ #kohana-profiler td {
+ padding-right: 1em;
+ }
+ <? echo $styles ?>
+</style>
+
+<div id="kohana-profiler">
+ <? foreach ($profiles as $profile): ?>
+ <?= $profile->render(); ?>
+ <? endforeach; ?>
+ <p class="kp-meta"><?= t("Profiler executed in ") . number_format($execution_time, 3) ?>s</p>
+</div>
diff --git a/modules/gallery/views/l10n_client.html.php b/modules/gallery/views/l10n_client.html.php
new file mode 100644
index 00000000..8f4092c7
--- /dev/null
+++ b/modules/gallery/views/l10n_client.html.php
@@ -0,0 +1,31 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="l10n-client" class="hidden">
+ <div class="labels">
+ <span class="toggle"><?= t("Translate Text") ?></span>
+ <div class="label strings"><h2><?= t("Page Text") ?></h2></div>
+ <div class="label source"><h2><?= t("Source") ?></div>
+ <div class="label translation"><h2><?= t("Translation to %language",
+ array("language" => locale::display_name())) ?></h2></div>
+ </div>
+ <div id="l10n-client-string-select">
+ <ul class="string-list">
+ <? foreach ($string_list as $string): ?>
+ <li class="<?= $string["translation"] === "" ? "untranslated" : "translated" ?>">
+ <?= $string["source"] ?>
+ </li>
+ <? endforeach; ?>
+ </ul>
+ <?= $l10n_search_form ?>
+ </div>
+ <div id="l10n-client-string-editor">
+ <div class="source">
+ <div class="source-text"></div>
+ </div>
+ <div class="translation">
+ <?= $l10n_form ?>
+ </div>
+ </div>
+ <script type="text/javascript">
+ var l10n_client_data = <?= json_encode($string_list) ?>;
+ </script>
+</div>
diff --git a/modules/gallery/views/maintenance.html.php b/modules/gallery/views/maintenance.html.php
new file mode 100644
index 00000000..f80b6e7a
--- /dev/null
+++ b/modules/gallery/views/maintenance.html.php
@@ -0,0 +1,50 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<html>
+ <head>
+ <title>
+ <?= t("Gallery - Maintenance Mode") ?>
+ </title>
+ <style>
+ body {
+ background: #ccc;
+ }
+ form {
+ border: 1px solid #555;
+ background: #999;
+ width: 300px;
+ }
+ fieldset {
+ border: none;
+ }
+ fieldset legend {
+ font-size: 24px;
+ display: none !important;
+ padding-left: 0px;
+ }
+ ul {
+ list-style-type: none;
+ margin-top: 0px;
+ padding-left: 0px;
+ bullet-style: none;
+ }
+ ul li {
+ margin-left: 0px;
+ }
+ label {
+ width: 60px;
+ display: block;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>
+ <?= t("Gallery - Maintenance Mode") ?>
+ </h1>
+ <p>
+ <?= t("This site is currently only accessible by site administrators.") ?>
+ </p>
+ <?= user::get_login_form("login/auth_html") ?>
+ </body>
+</html>
+
+
diff --git a/modules/gallery/views/move_browse.html.php b/modules/gallery/views/move_browse.html.php
new file mode 100644
index 00000000..4f69c0e9
--- /dev/null
+++ b/modules/gallery/views/move_browse.html.php
@@ -0,0 +1,47 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<script type="text/javascript">
+ var load_tree = function(target_id, locked) {
+ var load_url = "<?= url::site("move/show_sub_tree/{$source->id}/__TARGETID__") ?>";
+ var node = $("#node_" + target_id);
+ $("#gMove .node a").removeClass("selected");
+ node.find("a:first").addClass("selected");
+ if (locked) {
+ $("#gMoveButton").attr("disabled", "disabled");
+ $("#gMove form input[name=target_id]").attr("value", "");
+ } else {
+ $("#gMoveButton").removeAttr("disabled");
+ $("#gMove form input[name=target_id]").attr("value", target_id);
+ }
+ var sub_tree = $("#tree_" + target_id);
+ if (sub_tree.length) {
+ sub_tree.toggle();
+ } else {
+ $.get(load_url.replace("__TARGETID__", target_id), {},
+ function(data) {
+ node.html(data);
+ node.find("a:first").addClass("selected");
+ });
+ }
+ }
+</script>
+<h1 style="display: none">
+ <? if ($source->type == "photo"): ?>
+ <? t("Move this photo to a new album") ?>
+ <? elseif ($source->type == "movie"): ?>
+ <? t("Move this movie to a new album") ?>
+ <? elseif ($source->type == "album"): ?>
+ <? t("Move this album to a new album") ?>
+ <? endif ?>
+</h1>
+<div id="gMove">
+ <ul id="tree_0">
+ <li id="node_1" class="node">
+ <?= $tree ?>
+ </li>
+ </ul>
+ <form method="post" action="<?= url::site("move/save/$source->id") ?>">
+ <?= access::csrf_form_field() ?>
+ <input type="hidden" name="target_id" value="" />
+ <input type="submit" id="gMoveButton" value="<?= t("Move") ?>" disabled="disabled"/>
+ </form>
+</div>
diff --git a/modules/gallery/views/move_tree.html.php b/modules/gallery/views/move_tree.html.php
new file mode 100644
index 00000000..a3a4bc8f
--- /dev/null
+++ b/modules/gallery/views/move_tree.html.php
@@ -0,0 +1,19 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?= $parent->thumb_tag(array(), 25); ?>
+<? if (!access::can("edit", $parent) || $source->is_descendant($parent)): ?>
+<a href="javascript:load_tree('<?= $parent->id ?>',1)"> <?= $parent->title ?> <?= t("(locked)") ?> </a>
+<? else: ?>
+<a href="javascript:load_tree('<?= $parent->id ?>',0)"> <?= $parent->title ?></a>
+<? endif ?>
+<ul id="tree_<?= $parent->id ?>">
+ <? foreach ($children as $child): ?>
+ <li id="node_<?= $child->id ?>" class="node">
+ <?= $child->thumb_tag(array(), 25); ?>
+ <? if (!access::can("edit", $child) || $source->is_descendant($child)): ?>
+ <a href="javascript:load_tree('<?= $child->id ?>',1)"> <?= $child->title ?> <?= t("(locked)") ?></a>
+ <? else: ?>
+ <a href="javascript:load_tree('<?= $child->id ?>',0)"> <?= $child->title ?> </a>
+ <? endif ?>
+ </li>
+ <? endforeach ?>
+</ul>
diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php
new file mode 100644
index 00000000..afd87c2b
--- /dev/null
+++ b/modules/gallery/views/permissions_browse.html.php
@@ -0,0 +1,56 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<script type="text/javascript">
+ var form_url = "<?= url::site("permissions/form/__ITEM__") ?>";
+ show = function(id) {
+ $.ajax({
+ url: form_url.replace("__ITEM__", id),
+ success: function(data) {
+ $("div.form").slideUp();
+ $("div#edit-" + id).html(data).slideDown();
+ }
+ });
+ }
+
+ var action_url =
+ "<?= url::site("permissions/change/__CMD__/__GROUP__/__PERM__/__ITEM__?csrf=$csrf") ?>";
+ set = function(cmd, group_id, perm_id, item_id) {
+ $.ajax({
+ url: action_url.replace("__CMD__", cmd).replace("__GROUP__", group_id).
+ replace("__PERM__", perm_id).replace("__ITEM__", item_id),
+ success: function(data) {
+ $("div#edit-" + item_id).load(form_url.replace("__ITEM__", item_id));
+ }
+ });
+ }
+</script>
+<div id="gPermissions">
+ <? if (!$htaccess_works): ?>
+ <ul id="gMessage">
+ <li class="gError">
+ <?= t("Oh no! Your server needs a configuration change in order for you to hide photos! Ask your server administrator to set <a href=\"%url\"><i>AllowOverride FileInfo Options</i></a> to fix this.", array("url" => "http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride")) ?>
+ </li>
+ </ul>
+ <? endif ?>
+ <ul>
+ <? foreach ($parents as $parent): ?>
+ <li>
+ <a href="javascript:show(<?= $parent->id ?>)">
+ <?= $parent->title ?>
+ </a>
+ <div class="form" id="edit-<?= $parent->id ?>"></div>
+ <ul>
+ <? endforeach ?>
+ <li>
+ <a href="javascript:show(<?= $item->id ?>)">
+ <?= $item->title ?>
+ </a>
+ <div class="form" id="edit-<?= $item->id ?>">
+ <?= $form ?>
+ </div>
+ </li>
+ <? foreach ($parents as $parent): ?>
+ </ul>
+ </li>
+ </ul>
+ <? endforeach ?>
+</div>
diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php
new file mode 100644
index 00000000..3dbd0d98
--- /dev/null
+++ b/modules/gallery/views/permissions_form.html.php
@@ -0,0 +1,94 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<form method="post" action="<?= url::site('permissions/edit/$item->id') ?>">
+ <?= access::csrf_form_field() ?>
+ <fieldset>
+ <legend> <?= t('Edit Permissions') ?> </legend>
+
+ <table>
+ <tr>
+ <th> </th>
+ <? foreach ($groups as $group): ?>
+ <th> <?= $group->name ?> </th>
+ <? endforeach ?>
+ </tr>
+
+ <? foreach ($permissions as $permission): ?>
+ <tr>
+ <td> <?= t($permission->display_name) ?> </td>
+ <? foreach ($groups as $group): ?>
+ <? $intent = access::group_intent($group, $permission->name, $item) ?>
+ <? $allowed = access::group_can($group, $permission->name, $item) ?>
+ <? $lock = access::locked_by($group, $permission->name, $item) ?>
+
+ <? if ($lock): ?>
+ <td class="gDenied">
+ <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" title="<?= t('denied and locked through parent album') ?>" alt="<?= t('denied icon') ?>" />
+ <a href="javascript:show(<?= $lock->id ?>)" title="<?= t('click to go to parent album') ?>">
+ <img src="<?= url::file('themes/default/images/ico-lock.png') ?>" alt="<?= t('locked icon') ?>" />
+ </a>
+ </td>
+ <? else: ?>
+ <? if ($intent === null): ?>
+ <? if ($allowed): ?>
+ <td class="gAllowed">
+ <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
+ title="<?= t('allowed through parent album, click to allow explicitly') ?>">
+ <img src="<?= url::file('themes/default/images/ico-success-pale.png') ?>" alt="<?= t('passive allowed icon') ?>" />
+ </a>
+ <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
+ title="<?= t('click to deny') ?>">
+ <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon') ?>" />
+ </a>
+ </td>
+ <? else: ?>
+ <td class="gDenied">
+ <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
+ title="<?= t('click to allow') ?>">
+ <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon') ?>" />
+ </a>
+ <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
+ title="<?= t('denied through parent album, click to deny explicitly') ?>">
+ <img src="<?= url::file('themes/default/images/ico-denied-pale.png') ?>" alt="<?= t('passive denied icon') ?>" />
+ </a>
+ </td>
+ <? endif ?>
+
+ <? elseif ($intent === access::DENY): ?>
+ <td class="gDenied">
+ <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
+ title="<?= t('click to allow') ?>">
+ <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon') ?>" />
+ </a>
+ <? if ($item->id == 1): ?>
+ <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon') ?>" title="<?= t('denied') ?>"/>
+ <? else: ?>
+ <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
+ title="<?= t('denied, click to reset') ?>">
+ <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon') ?>" />
+ </a>
+ <? endif ?>
+ </td>
+ <? elseif ($intent === access::ALLOW): ?>
+ <td class="gAllowed">
+ <? if ($item->id == 1): ?>
+ <img src="<?= url::file('themes/default/images/ico-success.png') ?>" title="allowed" alt="<?= t('allowed icon') ?>" />
+ <? else: ?>
+ <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
+ title="<?= t('allowed, click to reset') ?>">
+ <img src="<?= url::file('themes/default/images/ico-success.png') ?>" alt="<?= t('allowed icon') ?>" />
+ </a>
+ <? endif ?>
+ <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)"
+ title="<?= t('click to deny') ?>">
+ <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon') ?>" />
+ </a>
+ </td>
+ <? endif ?>
+ <? endif ?>
+ </td>
+ <? endforeach ?>
+ </tr>
+ <? endforeach ?>
+ </table>
+ </fieldset>
+</form>
diff --git a/modules/gallery/views/quick_pane.html.php b/modules/gallery/views/quick_pane.html.php
new file mode 100644
index 00000000..95de972b
--- /dev/null
+++ b/modules/gallery/views/quick_pane.html.php
@@ -0,0 +1,108 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<? if ($item->type == "photo"): ?>
+<? $title = t("Edit this photo") ?>
+<? elseif ($item->type == "movie"): ?>
+<? $title = t("Edit this movie") ?>
+<? elseif ($item->type == "album"): ?>
+<? $title = t("Edit this album") ?>
+<? endif ?>
+<a class="gDialogLink gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/form_edit/$item->id?page_type=$page_type") ?>"
+ title="<?= $title ?>">
+ <span class="ui-icon ui-icon-pencil">
+ <?= $title ?>
+ </span>
+</a>
+
+<? if ($item->is_photo() && graphics::can("rotate")): ?>
+<a class="gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type") ?>"
+ title="<?= t("Rotate 90 degrees counter clockwise") ?>">
+ <span class="ui-icon ui-icon-rotate-ccw">
+ <?= t("Rotate 90 degrees counter clockwise") ?>
+ </span>
+</a>
+
+<a class="gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type") ?>"
+ title="<?= t("Rotate 90 degrees clockwise") ?>">
+ <span class="ui-icon ui-icon-rotate-cw">
+ <?= t("Rotate 90 degrees clockwise") ?>
+ </span>
+</a>
+<? endif ?>
+
+<? // Don't move photos from the photo page; we don't yet have a good way of redirecting after move ?>
+<? if ($page_type == "album"): ?>
+<? if ($item->type == "photo"): ?>
+<? $title = t("Move this photo to another album") ?>
+<? elseif ($item->type == "movie"): ?>
+<? $title = t("Move this movie to another album") ?>
+<? elseif ($item->type == "album"): ?>
+<? $title = t("Move this album to another album") ?>
+<? endif ?>
+<a class="gDialogLink gButtonLink ui-corner-all ui-state-default" href="<?= url::site("move/browse/$item->id") ?>"
+ title="<?= $title ?>">
+ <span class="ui-icon ui-icon-folder-open">
+ <?= $title ?>
+ </span>
+</a>
+<? endif ?>
+
+<? $disabledState = "" ?>
+<? if (access::can("edit", $item->parent())): ?>
+<? if ($item->type == "photo"): ?>
+<? $title = t("Choose this photo as the album cover") ?>
+<? elseif ($item->type == "movie"): ?>
+<? $title = t("Choose this movie as the album cover") ?>
+<? elseif ($item->type == "album"): ?>
+<? if (empty($item->album_cover_item_id)): ?>
+<? $disabledState = empty($item->album_cover_item_id) ? " ui-state-disabled" : "" ?>
+<? endif ?>
+<? $title = t("Choose this album as the album cover") ?>
+<? endif ?>
+<a class="gButtonLink ui-corner-all ui-state-default<?= $disabledState ?>" href="<?= url::site("quick/make_album_cover/$item->id?csrf=$csrf&page_type=$page_type") ?>"
+ title="<?= $title ?>">
+ <span class="ui-icon ui-icon-star">
+ <?= $title ?>
+ </span>
+</a>
+
+<? if ($item->type == "photo"): ?>
+<? $title = t("Delete this photo") ?>
+<? $message = t("Do you really want to delete this photo") ?>
+<? elseif ($item->type == "movie"): ?>
+<? $title = t("Delete this movie") ?>
+<? $message = t("Do you really want to delete this movie") ?>
+<? elseif ($item->type == "album"): ?>
+<? $title = t("Delete this album") ?>
+<? $message = t("Do you really want to delete this album") ?>
+<? endif ?>
+<a class="gButtonLink ui-corner-all ui-state-default" href="<?= url::site("quick/delete/$item->id?csrf=$csrf&page_type=$page_type") ?>" ref="<?= $message ?>" id="gQuickDelete" title="<?= $title ?>">
+ <span class="ui-icon ui-icon-trash">
+ <?= $title ?>
+ </span>
+</a>
+<? endif ?>
+
+<? if ($item->is_album()): ?>
+<a class="gButtonLink ui-corner-all ui-state-default options" href="#" title="<?= t("additional options") ?>">
+ <span class="ui-icon ui-icon-triangle-1-s">
+ <?= t("Additional options") ?>
+ </span>
+</a>
+
+<ul id="gQuickPaneOptions" style="display: none">
+ <li><a class="add_item gDialogLink" href="<?= url::site("simple_uploader/app/$item->id") ?>"
+ title="<?= t("Add a photo") ?>">
+ <?= t("Add a photo") ?>
+ </a></li>
+
+ <li><a class="add_album gDialogLink" href="<?= url::site("form/add/albums/$item->id?type=album") ?>"
+ title="<?= t("Add an album") ?>">
+ <?= t("Add an album") ?>
+ </a></li>
+
+ <li><a class="permissions gDialogLink" href="<?= url::site("permissions/browse/$item->id") ?>"
+ title="<?= t("Edit permissions") ?>">
+ <?= t("Edit permissions") ?>
+ </a></li>
+</ul>
+<? endif ?>
diff --git a/modules/gallery/views/scaffold.html.php b/modules/gallery/views/scaffold.html.php
new file mode 100644
index 00000000..765464b5
--- /dev/null
+++ b/modules/gallery/views/scaffold.html.php
@@ -0,0 +1,169 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<html>
+ <head>
+ <title>Gallery3 Scaffold</title>
+ <style>
+ body {
+ background: #999;
+ font-family: Trebuchet MS;
+ }
+
+ div.outer {
+ width: 650px;
+ background: white;
+ border: 1px solid black;
+ margin: 0 auto;
+ padding: -10px;
+ }
+
+ div.inner {
+ padding: 0 1em 0 1em;
+ margin: 0px;
+ }
+
+ h1, h2, h3 {
+ margin-bottom: .1em;
+ }
+
+ p {
+ margin: 0 0 0 0;
+ padding-left: 1em;
+ }
+
+ table {
+ padding-left: 1em;
+ }
+
+ pre {
+ border: 1px solid #666;
+ margin: 1em 0;
+ padding: .5em;
+ overflow: scroll;
+ }
+
+ .error {
+ color: red;
+ }
+
+ .success {
+ color: green;
+ }
+
+ p.success {
+ font-weight: bold;
+ }
+
+ div.block {
+ padding: 0px;
+ margin: 0px;
+ }
+
+ ul {
+ margin-top: -.25em;
+ }
+
+ fieldset {
+ margin-left: 1em;
+ margin-bottom: 1em;
+ padding-bottom: 0;
+ }
+
+ a {
+ text-decoration: none;
+ }
+
+ a:hover {
+ text-decoration: underline;
+ }
+
+ a.allowed {
+ color: green;
+ font-size: 110%;
+ }
+
+ a.denied {
+ color: red;
+ font-size: 90%;
+ }
+
+ .gHide {
+ display: none;
+ }
+
+ div#browse {
+ border: 1px solid black;
+ background: #eee;
+ width: 450px;
+ padding: 2px;
+ margin: 5px 0px 0px 1em;
+ }
+ </style>
+ </head>
+ <body>
+ <div class="outer">
+ <center>
+ <img src="<?= url::file("core/images/gallery.png") ?>"/>
+ </center>
+ <div class="inner">
+ <h1>Gallery3 Scaffold</h1>
+ <p>
+ This is
+ a <b><a href="http://www.google.com/images?q=scaffold">scaffold</a></b>:
+ a <i>temporary structure built to support the developers as
+ they create the real product</i>. As we flesh out Gallery 3,
+ we'll make it possible for you to peer inside and see the
+ application taking shape. Eventually, this page will go
+ away and you'll start in the application itself. In the
+ meantime, here are some useful links to get you started.
+ </p>
+
+ <? if ($album_count > 0): ?>
+ <div id="browse">
+ <p>
+ <?= html::anchor("albums/1", "Browse Gallery") ?>
+ <i>(<?= $album_count ?> albums, <?= $photo_count ?> photos, <?= $comment_count ?> comments, <?= $tag_count ?> tags)</i>
+ </p>
+ </div>
+ <? endif ?>
+
+ <div id="actions" class="activity">
+ <fieldset>
+ <legend>Generate Test Data</legend>
+ <p>
+ add: [
+ <? foreach (array(1, 10, 50, 100, 500, 1000) as $count): ?>
+ <?= html::anchor("scaffold/add_albums_and_photos/$count", "$count") ?>
+ <? endforeach ?>
+ ] photos and albums
+ </p>
+ <p>
+ add: [
+ <? foreach (array(1, 10, 50, 100, 500, 1000) as $count): ?>
+ <?= html::anchor("scaffold/add_albums_and_photos/$count/album", "$count") ?>
+ <? endforeach ?>
+ ] albums only
+ </p>
+ <p>
+ add: [
+ <? foreach (array(1, 10, 50, 100, 500, 1000) as $count): ?>
+ <?= html::anchor("scaffold/add_comments/$count", "$count") ?>
+ <? endforeach ?>
+ ] comments
+ </p>
+ <p>
+ add: [
+ <? foreach (array(1, 10, 50, 100, 500, 1000) as $count): ?>
+ <?= html::anchor("scaffold/add_tags/$count", "$count") ?>
+ <? endforeach ?>
+ ] tags
+ </p>
+ </fieldset>
+ <fieldset>
+ <legend>Packaging</legend>
+ <a href="<?= url::site("scaffold/package") ?>">Make Package</a>
+ </fieldset>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php
new file mode 100644
index 00000000..b6725c31
--- /dev/null
+++ b/modules/gallery/views/simple_uploader.html.php
@@ -0,0 +1,249 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<script type="text/javascript" src="<?= url::file("lib/swfupload/swfupload.js") ?>"></script>
+<script type="text/javascript" src="<?= url::file("lib/swfupload/swfupload.queue.js") ?>"></script>
+
+<!-- hack to set the title for the dialog -->
+<form id="gAddPhotosForm" action="<?= url::site("simple_uploader/finish") ?>">
+ <fieldset>
+ <legend> <?= t("Add photos to %album_title", array("album_title" => $item->title)) ?> </legend>
+ </fieldset>
+</form>
+
+<div id="gAddPhotos">
+ <? if (ini_get("suhosin.session.encrypt")): ?>
+ <ul id="gMessage">
+ <li class="gError">
+ <?= t("Error: your server is configured to use the <a href=\"%encrypt_url\"><code>suhosin.session.encrypt</code></a> setting from <a href=\"%suhosin_url\">Suhosin</a>. You must disable this setting to upload photos.",
+ array("encrypt_url" => "http://www.hardened-php.net/suhosin/configuration.html#suhosin.session.encrypt",
+ "suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?>
+ </li>
+ </ul>
+ <? endif ?>
+
+ <p>
+ <?= t("Photos will be uploaded to album: ") ?>
+ </p>
+ <ul class="gBreadcrumbs">
+ <? foreach ($item->parents() as $parent): ?>
+ <li> <?= $parent->title ?> </li>
+ <? endforeach ?>
+ <li class="active"> <?= $item->title ?> </li>
+ </ul>
+
+ <p><?= t("Upload Queue") ?></p>
+ <div id="gAddPhotosCanvas" style="text-align: center;">
+ <div id="gAddPhotosQueue"></div>
+ <div id="gEditPhotosQueue"></div>
+ <span id="gChooseFilesButtonPlaceholder"></span>
+ </div>
+ <button id="gUploadCancel" class="ui-state-default ui-corner-all" type="button"
+ onclick="swfu.cancelQueue();"
+ disabled="disabled">
+ <?= t("Cancel all") ?>
+ </button>
+
+ <!-- Proxy the done request back to our form, since its been ajaxified -->
+ <button class="ui-state-default ui-corner-all" onclick="$('#gAddPhotosForm').submit()">
+ <?= t("Done") ?>
+ </button>
+</div>
+
+<style>
+ #SWFUpload_0 {
+ margin-top: 100px;
+ }
+ #gAddPhotos .gBreadcrumbs {
+ border: 0;
+ margin: 0;
+ padding-left:10px;
+ }
+ #gAddPhotosCanvas {
+ border: 1px solid #CCCCCC;
+ margin: .5em 0 .5em 0;
+ width: 469px;
+ }
+ #gAddPhotos button {
+ margin-bottom: .5em;
+ float: right;
+ }
+ #gAddPhotos #gUploadCancel {
+ float: left;
+ }
+</style>
+
+<script type="text/javascript">
+ var swfu = new SWFUpload({
+ flash_url : "<?= url::file("lib/swfupload/swfupload.swf") ?>",
+ upload_url: "<?= url::site("simple_uploader/add_photo/$item->id") ?>",
+ post_params: {
+ "g3sid": "<?= Session::instance()->id() ?>",
+ "user_agent": "<?= Input::instance()->server("HTTP_USER_AGENT") ?>",
+ "csrf": "<?= $csrf ?>"
+ },
+ file_size_limit : "100 MB",
+ file_types : "*.gif;*.jpg;*.jpeg;*.png;*.flv;*.mp4;*.GIF;*.JPG;*.JPEG;*.PNG;*.FLV;*.MP4",
+ file_types_description : "<?= t("Photos and Movies") ?>",
+ file_upload_limit : 1000,
+ file_queue_limit : 0,
+ custom_settings : { },
+ debug: false,
+
+ // Button settings
+ button_image_url: "<?= url::file("themes/default/images/select-photos-backg.png") ?>",
+ button_width: "202",
+ button_height: "45",
+ button_placeholder_id: "gChooseFilesButtonPlaceholder",
+ button_text: '<span class="swfUploadFont">Select photos...</span>',
+ button_text_style: ".swfUploadFont { color: #2E6E9E; font-size: 16px; font-family: Lucida Grande,Lucida Sans,Arial,sans-serif; font-weight: bold; }",
+ button_text_left_padding: 30,
+ button_text_top_padding: 10,
+
+ // The event handler functions are defined in handlers.js
+ file_queued_handler : file_queued,
+ file_queue_error_handler : file_queue_error,
+ file_dialog_complete_handler : file_dialog_complete,
+ upload_start_handler : upload_start,
+ upload_progress_handler : upload_progress,
+ upload_error_handler : upload_error,
+ upload_success_handler : upload_success,
+ upload_complete_handler : upload_complete,
+ queue_complete_handler : queue_complete
+ });
+
+ // @todo add support for cancelling individual uploads
+ function File_Progress(file) {
+ this.box = $("#" + file.id);
+ if (!this.box.length) {
+ $("#gAddPhotosQueue").append(
+ "<div class=\"box\" id=\"" + file.id + "\">" +
+ "<div class=\"title\"></div>" +
+ "<div class=\"status\"></div>" +
+ "<div class=\"progressbar\"></div></div>");
+ this.box = $("#" + file.id);
+ }
+ this.title = this.box.find(".title");
+ this.status = this.box.find(".status");
+ this.progress_bar = this.box.find(".progressbar");
+ this.progress_bar.progressbar();
+ this.progress_bar.css("visibility", "hidden");
+ }
+
+ File_Progress.prototype.set_status = function(status_class, msg) {
+ this.box.removeClass("pending error uploading complete").addClass(status_class);
+ this.status.html(msg);
+ }
+
+ function file_queued(file) {
+ var fp = new File_Progress(file);
+ fp.title.html(file.name);
+ fp.set_status("pending", "<?= t("Pending...") ?>");
+ // @todo add cancel button to call this.cancelUpload(file.id)
+ }
+
+ function file_queue_error(file, error_code, message) {
+ if (error_code === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
+ alert("<?= t("You have attempted to queue too many files.") ?>");
+ return;
+ }
+
+ var fp = new File_Progress(file);
+ switch (error_code) {
+ case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
+ fp.set_status("error", "<?= t("File is too big.") ?>");
+ break;
+ case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
+ fp.set_status("error", "<?= t("Cannot upload empty files.") ?>");
+ break;
+ case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
+ fp.set_status("error", "<?= t("Invalid file type.") ?>");
+ break;
+ default:
+ if (file !== null) {
+ fp.set_status("error", "<?= t("Unknown error") ?>");
+ }
+ break;
+ }
+ }
+
+ function file_dialog_complete(num_files_selected, num_files_queued) {
+ if (num_files_selected > 0) {
+ $("#gUploadCancel").enable(true);
+ }
+
+ // Auto start the upload
+ this.startUpload();
+ }
+
+ function upload_start(file) {
+ // Do all file validation on the server side. Update the UI here because in Linux
+ // no uploadProgress events are called (limitation in the Linux Flash VM).
+ var fp = new File_Progress(file);
+ fp.title.html(file.name);
+ fp.set_status("uploading", "<?= t("Uploading...") ?>");
+ return true;
+ // @todo add cancel button to call this.cancelUpload(file.id)
+ }
+
+ function upload_progress(file, bytes_loaded, bytes_total) {
+ var percent = Math.ceil((bytes_loaded / bytes_total) * 100);
+ var fp = new File_Progress(file);
+ fp.set_status("uploading", "<?= t("Uploading...") ?>");
+ fp.progress_bar.css("visibility", "visible");
+ fp.progress_bar.progressbar("value", percent);
+ }
+
+ function upload_success(file, serverData) {
+ var fp = new File_Progress(file);
+ fp.progress_bar.progressbar("value", 100);
+ fp.set_status("complete", "<?= t("Complete.") ?>");
+ }
+
+ function upload_error(file, error_code, message) {
+ var fp = new File_Progress(file);
+ switch (error_code) {
+ case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
+ fp.set_status("error", "<?= t("Upload error: ") ?>" + message);
+ break;
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
+ fp.set_status("error", "<?= t("Upload failed") ?>");
+ break;
+ case SWFUpload.UPLOAD_ERROR.IO_ERROR:
+ fp.set_status("error", "<?= t("Server error") ?>");
+ break;
+ case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
+ fp.set_status("error", "<?= t("Security error") ?>");
+ break;
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
+ fp.set_status("error", "<?= t("Upload limit exceeded") ?>");
+ break;
+ case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
+ fp.set_status("error", "<?= t("Failed validation. File skipped") ?>");
+ break;
+ case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
+ // If there aren't any files left (they were all cancelled) disable the cancel button
+ if (this.getStats().files_queued === 0) {
+ $("#gUploadCancel").enable(false);
+ }
+ fp.set_status("error", "<?= t("Cancelled") ?>");
+ break;
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
+ fp.set_status("error", "<?= t("Stopped") ?>");
+ break;
+ default:
+ fp.set_status("error", "<?= t("Unknown error: ") ?>" + error_code);
+ break;
+ }
+ }
+
+ function upload_complete(file) {
+ if (this.getStats().files_queued === 0) {
+ $("#gUploadCancel").enable(false);
+ }
+ }
+
+ // This event comes from the Queue Plugin
+ function queue_complete(num_files_uploaded) {
+ var status_msg = "<?= t("Uploaded: __COUNT__") ?>";
+ $("#gUploadStatus").html(status_msg.replace("__COUNT__", num_files_uploaded));
+ }
+</script>