diff options
Diffstat (limited to 'modules/gallery/views')
56 files changed, 2699 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 0000000..6745f0d --- /dev/null +++ b/modules/gallery/views/admin_advanced_settings.html.php @@ -0,0 +1,57 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-admin-advanced-settings" class="g-block"> + <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="g-action-status" class="g-message-block"> + <li class="g-warning"><?= t("Change these values at your own risk!") ?></li> + </ul> + + <?= t("Filter:") ?> <input id="g-admin-advanced-settings-filter" type="text"></input> + <div class="g-block-content"> + <table> + <tr> + <th> <?= t("Module") ?> </th> + <th> <?= t("Name") ?> </th> + <th> <?= t("Value") ?></th> + </tr> + <? foreach ($vars as $var): ?> + <tr class="setting-row <?= text::alternate("g-odd", "g-even") ?>"> + <td> <?= html::clean($var->module_name) ?> </td> + <td> <?= html::clean($var->name) ?> </td> + <td> + <a href="<?= url::site("admin/advanced_settings/edit/$var->module_name/" . html::clean($var->name)) ?>" + class="g-dialog-link" + title="<?= t("Edit %var (%module_name)", array("var" => $var->name, "module_name" => $var->module_name))->for_html_attr() ?>"> + <? if (!isset($var->value) || $var->value === ""): ?> + <i> <?= t("empty") ?> </i> + <? else: ?> + <?= html::clean($var->value) ?> + <? endif ?> + </a> + </td> + </tr> + <? endforeach ?> + </table> + </div> + + <script> + $(document).ready(function() { + $("#g-admin-advanced-settings-filter").keyup(function() { + var filter = $(this).attr("value"); + if (filter) { + $("tr.setting-row").fadeOut("fast"); + $("tr.setting-row").each(function() { + if ($(this).text().indexOf(filter) > 0) { + $(this).stop().show(); + } + }); + } else { + $("tr.setting-row").show(); + } + }); + }); + </script> +</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 0000000..5a8ed23 --- /dev/null +++ b/modules/gallery/views/admin_block_log_entries.html.php @@ -0,0 +1,15 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<ul> + <? foreach ($entries as $entry): ?> + <li class="<?= log::severity_class($entry->severity) ?>" style="direction: ltr"> + <? if ($entry->user->guest): ?> + </span><?= html::clean($entry->user->name) ?></span> + <? else: ?> + <a href="<?= user_profile::url($entry->user->id) ?>"><?= html::clean($entry->user->name) ?></a> + <? endif ?> + <?= gallery::date_time($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 0000000..cb276ae --- /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 0000000..f9725ee --- /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="g-item g-photo"> + <a href="<?= $photo->url() ?>" title="<?= html::purify($photo->title)->for_html_attr() ?>"> + <img <?= photo::img_dimensions($photo->width, $photo->height, 72) ?> + src="<?= $photo->thumb_url() ?>" alt="<?= html::purify($photo->title)->for_html_attr() ?>" /> + </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 0000000..9a594fa --- /dev/null +++ b/modules/gallery/views/admin_block_platform.html.php @@ -0,0 +1,24 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<ul> + <li> + <?= t("Host name: %host_name", array("host_name" => php_uname("n"))) ?> + </li> + <li> + <?= t("Operating system: %os %version", array("os" => php_uname("s"), "version" => php_uname("r"))) ?> + </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" => join(" ", sys_getloadavg()))) ?> + </li> + <li> + <?= t("Graphics toolkit: %toolkit", array("toolkit" => module::get_var("gallery", "graphics_toolkit"))) ?> + </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 0000000..c8c5476 --- /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" => gallery::version_string())) ?> + </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 0000000..d3765d1 --- /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 class="g-text"> + <li> + <?= t("General Settings - choose your <a href=\"%graphics_url\">graphics</a> and <a href=\"%language_url\">language</a> settings.", + array("graphics_url" => html::mark_clean(url::site("admin/graphics")), + "language_url" => html::mark_clean(url::site("admin/languages")))) ?> + </li> + <li> + <?= t("Appearance - <a href=\"%theme_url\">choose a theme</a>, or <a href=\"%theme_options_url\">customize the way it looks</a>.", + array("theme_url" => html::mark_clean(url::site("admin/themes")), + "theme_options_url" => html::mark_clean(url::site("admin/theme_options")))) ?> + </li> + <li> + <?= t("Customize - <a href=\"%modules_url\">install modules</a> to add cool features!", + array("modules_url" => html::mark_clean(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 0000000..cf90ef2 --- /dev/null +++ b/modules/gallery/views/admin_dashboard.html.php @@ -0,0 +1,43 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + update_blocks = function() { + $.get(<?= html::js_string(url::site("admin/dashboard/reorder")) ?>, + {"csrf": "<?= $csrf ?>", + "dashboard_center[]": $("#g-admin-dashboard").sortable( + "toArray", {attribute: "block_id"}), + "dashboard_sidebar[]": $("#g-admin-dashboard-sidebar").sortable( + "toArray", {attribute: "block_id"})}); + }; + + $(document).ready(function(){ + $("#g-admin-dashboard .g-block .ui-widget-header").addClass("g-draggable"); + $("#g-admin-dashboard").sortable({ + connectWith: ["#g-admin-dashboard-sidebar"], + cursor: "move", + handle: $(".ui-widget-header"), + opacity: 0.6, + placeholder: "g-target", + stop: update_blocks + }); + + $("#g-admin-dashboard-sidebar .g-block .ui-widget-header").addClass("g-draggable"); + $("#g-admin-dashboard-sidebar").sortable({ + connectWith: ["#g-admin-dashboard"], + cursor: "move", + handle: $(".ui-widget-header"), + opacity: 0.6, + placeholder: "g-target", + stop: update_blocks + }); + }); +</script> +<div> + <? if ($obsolete_modules_message): ?> + <p class="g-warning"> + <?= $obsolete_modules_message ?> + </p> + <? endif ?> +</div> +<div id="g-admin-dashboard"> + <?= $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 0000000..1f45bb1 --- /dev/null +++ b/modules/gallery/views/admin_graphics.html.php @@ -0,0 +1,40 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + $(document).ready(function() { + $(".g-available .g-block").equal_heights(); + select_toolkit = function(el) { + if (!$(this).hasClass("g-unavailable")) { + window.location = <?= html::js_string(url::site("admin/graphics/choose/__TK__?csrf=$csrf")) ?> + .replace("__TK__", $(this).attr("id")); + } + }; + $("#g-admin-graphics div.g-available .g-block").click(select_toolkit); + }); +</script> + +<div id="g-admin-graphics" class="g-block ui-helper-clearfix"> + <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.") ?> + <?= t("Can't decide which toolkit to choose? <a href=\"%url\">We can help!</a>", array("url" => "http://codex.galleryproject.org/Gallery3:Choosing_A_Graphics_Toolkit")) ?> + </p> + + <div class="g-block-content"> + <h2> <?= t("Active toolkit") ?> </h2> + <? if ($active == "none"): ?> + <?= new View("admin_graphics_none.html") ?> + <? else: ?> + <?= new View("admin_graphics_$active.html", array("tk" => $tk->$active, "is_active" => true)) ?> + <? endif ?> + + <div class="g-available"> + <h2> <?= t("Available toolkits") ?> </h2> + <? foreach (array_keys((array)$tk) as $id): ?> + <? if ($id != $active): ?> + <?= new View("admin_graphics_$id.html", array("tk" => $tk->$id, "is_active" => false)) ?> + <? endif ?> + <? endforeach ?> + </div> + </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 0000000..1cc9dc9 --- /dev/null +++ b/modules/gallery/views/admin_graphics_gd.html.php @@ -0,0 +1,30 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="gd" class="g-block<?= $is_active ? " g-selected" : "" ?><?= $tk->installed ? " g-installed-toolkit" : " g-unavailable" ?>"> + <img class="logo" width="170" height="110" src="<?= url::file("modules/gallery/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->installed && $tk->rotate): ?> + <div class="g-module-status g-info"> + <?= t("You have GD version %version.", array("version" => $tk->version)) ?> + </div> + <p> + <a class="g-button ui-state-default ui-corner-all"><?= t("Activate GD") ?></a> + </p> + <? elseif ($tk->installed): ?> + <? if ($tk->error): ?> + <p class="g-module-status g-warning"> + <?= $tk->error ?> + </p> + <? endif ?> + <p> + <a class="g-button ui-state-default ui-corner-all"><?= t("Activate GD") ?></a> + </p> + <? else: ?> + <div class="g-module-status g-info"> + <?= t("You do not have GD installed.") ?> + </div> + <? 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 0000000..5dae144 --- /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="g-block<?= $is_active ? " g-selected" : "" ?><?= $tk->installed ? " g-installed-toolkit" : " g-unavailable" ?>"> + <img class="logo" width="107" height="76" src="<?= url::file("modules/gallery/images/graphicsmagick.png"); ?>" alt="<? t("Visit the GraphicsMagick project site") ?>" /> + <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->installed): ?> + <div class="g-module-status g-info"> + <?= t("GraphicsMagick version %version is available in %dir", array("version" => $tk->version, "dir" => $tk->dir)) ?> + </div> + <p> + <a class="g-button ui-state-default ui-corner-all"><?= t("Activate Graphics Magic") ?></a> + </p> + <? else: ?> + <div class="g-module-status g-warning"> + <?= $tk->error ?> + </div> + <? 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 0000000..9c1a990 --- /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="g-block<?= $is_active ? " g-selected" : "" ?><?= $tk->installed ? " g-installed-toolkit" : " g-unavailable" ?>"> + <img class="logo" width="114" height="118" src="<?= url::file("modules/gallery/images/imagemagick.jpg"); ?>" alt="<? t("Visit the ImageMagick project site") ?>" /> + <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->installed): ?> + <div class="g-module-status g-info"> + <?= t("ImageMagick version %version is available in %dir", array("version" => $tk->version, "dir" => $tk->dir)) ?> + </div> + <p> + <a class="g-button ui-state-default ui-corner-all"><?= t("Activate ImageMagick") ?></a> + </p> + <? elseif ($tk->error): ?> + <div class="g-module-status g-warning"> + <?= $tk->error ?> + </div> + <? 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 0000000..e0fc417 --- /dev/null +++ b/modules/gallery/views/admin_graphics_none.html.php @@ -0,0 +1,8 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> + +<div id="none" class="g-module-status g-warning g-block"> + <h3> <?= 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 use 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 0000000..d6a9c22 --- /dev/null +++ b/modules/gallery/views/admin_languages.html.php @@ -0,0 +1,118 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + var old_default_locale = <?= html::js_string($default_locale) ?>; + + $("#g-languages-form").ready(function() { + $("input[name='installed_locales[]']").change(function (event) { + if (this.checked) { + $("input[type='radio'][value='" + this.value + "']").enable(); + } else { + if ($("input[type='radio'][value='" + this.value + "']").selected()) { // if you deselect your default language, switch to some other installed language + $("input[type='radio'][value='" + old_default_locale + "']").attr("checked", "checked"); + } + $("input[type='radio'][value='" + this.value + "']").attr("disabled", "disabled"); + } + }); + + $("#g-languages-form").ajaxForm({ + dataType: "json", + success: function(data) { + if (data.result == "success") { + el = $('<a href="' + <?= html::js_string(url::site("admin/maintenance/start/gallery_task::update_l10n?csrf=$csrf")) ?> + '"></a>'); // this is a little hack to trigger the update_l10n task in a dialog + el.gallery_dialog(); + el.trigger('click'); + } + } + }); + }); +</script> + +<div class="g-block"> + <h1> <?= t("Languages and translation") ?> </h1> + + <div class="g-block-content"> + + <div id="g-languages" class="g-block"> + <h2> <?= t("Languages") ?> </h2> + <p> + <?= t("Install new languages, update installed ones and set the default language for your Gallery.") ?> + </p> + + <div class="g-block-content ui-helper-clearfix"> + <form id="g-languages-form" method="post" action="<?= url::site("admin/languages/save") ?>"> + <?= access::csrf_form_field() ?> + <table class="g-left"> + <tr> + <th> <?= t("Installed") ?> </th> + <th> <?= t("Language") ?> </th> + <th> <?= t("Default language") ?> </th> + </tr> + <? $i = 0 ?> + <? foreach ($available_locales as $code => $display_name): ?> + <? if ($i == (int) (count($available_locales)/2)): ?> + </table> + <table class="g-left"> + <tr> + <th> <?= t("Installed") ?> </th> + <th> <?= t("Language") ?> </th> + <th> <?= t("Default language") ?> </th> + </tr> + <? endif ?> + <tr class="<?= (isset($installed_locales[$code])) ? "g-available" : "" ?><?= ($default_locale == $code) ? " g-selected" : "" ?>"> + <td> <?= form::checkbox("installed_locales[]", $code, isset($installed_locales[$code])) ?> </td> + <td> <?= $display_name ?> </td> + <td> + <?= form::radio("default_locale", $code, ($default_locale == $code), ((isset($installed_locales[$code]))?'':'disabled="disabled"') ) ?> + </td> + </tr> + <? $i++ ?> + <? endforeach ?> + </table> + <input type="submit" value="<?= t("Update languages")->for_html_attr() ?>" /> + </form> + </div> + </div> + + <div id="g-translations" class="g-block"> + <h2> <?= t("Translations") ?> </h2> + <p> + <?= t("Create your own translations and share them with the rest of the Gallery community.") ?> + </p> + + <div class="g-block-content"> + <a href="http://codex.galleryproject.org/Gallery3:Localization" target="_blank" + class="g-right ui-state-default ui-corner-all ui-icon ui-icon-help" + title="<?= t("Localization documentation")->for_html_attr() ?>"> + <?= t("Localization documentation") ?> + </a> + + <h3><?= t("Translating Gallery") ?></h3> + + <p><?= t("Follow these steps to begin translating Gallery.") ?></p> + + <ol> + <li><?= t("Make sure the target language is installed and up to date (check above).") ?></li> + <li><?= t("Make sure you have selected the right target language (currently %default_locale).", + array("default_locale" => locales::display_name())) ?></li> + <li><?= t("Start the translation mode and the translation interface will appear at the bottom of each Gallery page.") ?></li> + </ol> + <a href="<?= url::site("l10n_client/toggle_l10n_mode?csrf=".access::csrf_token()) ?>" + class="g-button ui-state-default ui-corner-all ui-icon-left"> + <span class="ui-icon ui-icon-power"></span> + <? if (Session::instance()->get("l10n_mode", false)): ?> + <?= t("Stop translation mode") ?> + <? else: ?> + <?= t("Start translation mode") ?> + <? endif ?> + </a> + + <h3><?= t("Sharing your translations") ?></h3> + <p> + <?= t("Sharing your own translations with the Gallery community is easy. Please do!") ?> + </p> + <?= $share_translations_form ?> + </div> + </div> + + </div> +</div> diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php new file mode 100644 index 0000000..230e935 --- /dev/null +++ b/modules/gallery/views/admin_maintenance.html.php @@ -0,0 +1,212 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-admin-maintenance" class="g-block"> + <h1> <?= t("Maintenance") ?> </h1> + <div class="g-block-content"> + <div id="g-maintenance-mode"> + <p> + <?= t("When you're performing maintenance on your Gallery, you can enable <b>maintenance mode</b> which prevents any non-admin from accessing your Gallery. Some of the tasks below will automatically put your Gallery in maintenance mode for you.") ?> + </p> + <ul id="g-action-status" class="g-message-block"> + <? if (module::get_var("gallery", "maintenance_mode")): ?> + <li class="g-warning"> + <?= t("Maintenance mode is <b>on</b>. Non admins cannot access your Gallery. <a href=\"%enable_maintenance_mode_url\">Turn off maintenance mode</a>", array("enable_maintenance_mode_url" => url::site("admin/maintenance/maintenance_mode/0?csrf=$csrf"))) ?> + </li> + <? else: ?> + <li class="g-info"> + <?= t("Maintenance mode is off. User access is permitted. <a href=\"%enable_maintenance_mode_url\">Turn on maintenance mode</a>", array("enable_maintenance_mode_url" => url::site("admin/maintenance/maintenance_mode/1?csrf=$csrf"))) ?> + </li> + <? endif ?> + </ul> + </div> + </div> + + <div class="g-block-content"> + <div id="g-available-tasks"> + <h2> <?= t("Maintenance tasks") ?> </h2> + <p> + <?= t("Occasionally your Gallery will require some maintenance. Here are some tasks you can use to keep it running smoothly.") ?> + </p> + <table> + <tr> + <th> + <?= t("Name") ?> + </th> + <th> + <?= t("Description") ?> + </th> + <th> + <?= t("Action") ?> + </th> + </tr> + <? foreach ($task_definitions as $task): ?> + <tr class="<?= text::alternate("g-odd", "g-even") ?> <?= log::severity_class($task->severity) ?>"> + <td class="<?= log::severity_class($task->severity) ?>"> + <?= $task->name ?> + </td> + <td> + <?= $task->description ?> + </td> + <td> + <a href="<?= url::site("admin/maintenance/start/$task->callback?csrf=$csrf") ?>" + class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all"> + <?= t("run") ?> + </a> + </td> + </tr> + <? endforeach ?> + </table> + </div> + + <? if ($running_tasks->count()): ?> + <div id="g-running-tasks"> + <a href="<?= url::site("admin/maintenance/cancel_running_tasks?csrf=$csrf") ?>" + class="g-button g-right ui-icon-left ui-state-default ui-corner-all"> + <?= t("cancel all running") ?></a> + <h2> <?= t("Running 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 ($running_tasks as $task): ?> + <tr class="<?= text::alternate("g-odd", "g-even") ?> <?= $task->state == "stalled" ? "g-warning" : "" ?>"> + <td class="<?= $task->state == "stalled" ? "g-warning" : "" ?>"> + <?= gallery::date_time($task->updated) ?> + </td> + <td> + <?= $task->name ?> + </td> + <td> + <? if ($task->done): ?> + <? if ($task->state == "cancelled"): ?> + <?= t("Cancelled") ?> + <? endif ?> + <?= t("Close") ?> + <? elseif ($task->state == "stalled"): ?> + <?= t("Stalled") ?> + <? else: ?> + <?= t("%percent_complete% Complete", array("percent_complete" => $task->percent_complete)) ?> + <? endif ?> + </td> + <td> + <?= $task->status ?> + </td> + <td> + <?= html::clean($task->owner()->name) ?> + </td> + <td> + <? if ($task->state == "stalled"): ?> + <a class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all" + href="<?= url::site("admin/maintenance/resume/$task->id?csrf=$csrf") ?>"> + <?= t("resume") ?> + </a> + <? endif ?> + <? if ($task->get_log()): ?> + <a href="<?= url::site("admin/maintenance/show_log/$task->id?csrf=$csrf") ?>" class="g-dialog-link g-button ui-state-default ui-corner-all"> + <?= t("view log") ?> + </a> + <? endif ?> + <a href="<?= url::site("admin/maintenance/cancel/$task->id?csrf=$csrf") ?>" + class="g-button ui-icon-left ui-state-default ui-corner-all"> + <?= t("cancel") ?> + </a> + </td> + </tr> + <? endforeach ?> + </table> + </div> + <? endif ?> + + <? if ($finished_tasks->count()): ?> + <div id="g-finished-tasks"> + <a href="<?= url::site("admin/maintenance/remove_finished_tasks?csrf=$csrf") ?>" + class="g-button g-right ui-icon-left ui-state-default ui-corner-all"> + <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="<?= text::alternate("g-odd", "g-even") ?> <?= $task->state == "success" ? "g-success" : "g-error" ?>"> + <td class="<?= $task->state == "success" ? "g-success" : "g-error" ?>"> + <?= gallery::date_time($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> + <?= html::clean($task->owner()->name) ?> + </td> + <td> + <? if ($task->done): ?> + <a href="<?= url::site("admin/maintenance/remove/$task->id?csrf=$csrf") ?>" class="g-button ui-state-default ui-corner-all"> + <?= t("remove") ?> + </a> + <? if ($task->get_log()): ?> + <a href="<?= url::site("admin/maintenance/show_log/$task->id?csrf=$csrf") ?>" class="g-dialog-link g-button ui-state-default ui-corner-all"> + <?= t("view log") ?> + </a> + <? endif ?> + <? else: ?> + <a href="<?= url::site("admin/maintenance/resume/$task->id?csrf=$csrf") ?>" class="g-dialog-link g-button" ui-state-default ui-corner-all> + <?= t("resume") ?> + </a> + <a href="<?= url::site("admin/maintenance/cancel/$task->id?csrf=$csrf") ?>" class="g-button ui-state-default ui-corner-all"> + <?= t("cancel") ?> + </a> + <? endif ?> + </ul> + </td> + </tr> + <? endforeach ?> + </table> + </div> + <? endif ?> + </div> +</div> diff --git a/modules/gallery/views/admin_maintenance_show_log.html.php b/modules/gallery/views/admin_maintenance_show_log.html.php new file mode 100644 index 0000000..ecf882f --- /dev/null +++ b/modules/gallery/views/admin_maintenance_show_log.html.php @@ -0,0 +1,19 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + dismiss = function() { + window.location.reload(); + }; + download = function() { + // send request + $('<form action="<?= url::site("admin/maintenance/save_log/$task->id?csrf=$csrf") ?>" method="post"></form>'). +appendTo('body').submit().remove(); + }; +</script> +<div id="g-task-log-dialog"> + <h1> <?= $task->name ?> </h1> + <div class="g-task-log g-text-small"> + <pre><?= html::purify($task->get_log()) ?></pre> + </div> + <button id="g-close" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Close") ?></button> + <button id="g-save" class="ui-state-default ui-corner-all" onclick="download()"><?= t("Download") ?></button> +</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 0000000..013ac01 --- /dev/null +++ b/modules/gallery/views/admin_maintenance_task.html.php @@ -0,0 +1,84 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + var target_value; + var animation = null; + var delta = 1; + var consecutive_error_count = 0; + animate_progress_bar = function() { + var current_value = parseInt($(".g-progress-bar div").css("width").replace("%", "")); + if (target_value > current_value) { + // speed up + delta = Math.min(delta + 0.04, 3); + } else { + // slow down + delta = Math.max(delta - 0.05, 1); + } + + if (target_value == 100) { + $(".g-progress-bar").progressbar("value", 100); + } else if (current_value != target_value || delta != 1) { + var new_value = Math.min(current_value + delta, target_value); + $(".g-progress-bar").progressbar("value", new_value); + animation = setTimeout(function() { animate_progress_bar(target_value); }, 100); + } else { + animation = null; + delta = 1; + } + $.fn.gallery_hover_init(); + } + + var FAILED_MSG = <?= t("Something went wrong...sorry! <a>Retry</a> or check the task log for details")->for_js() ?>; + var ERROR_MSG = <?= t("Something went wrong! Trying again in a moment... (__COUNT__)")->for_js() ?>; + update = function() { + $.ajax({ + url: <?= html::js_string(url::site("admin/maintenance/run/$task->id?csrf=$csrf")) ?>, + dataType: "json", + success: function(data) { + target_value = data.task.percent_complete; + consecutive_error_count = 0; + if (!animation) { + animate_progress_bar(); + } + $("#g-status").html("" + data.task.status); + if (data.task.done) { + $("#g-pause-button").hide(); + $("#g-done-button").show(); + } else { + setTimeout(update, 100); + } + }, + error: function(req, textStatus, errorThrown) { + if (textStatus == "timeout" || textStatus == "parsererror") { + consecutive_error_count++; + if (consecutive_error_count == 5) { + $("#g-status").html(FAILED_MSG); + $("#g-pause-button").hide(); + $("#g-done-button").show(); + consecutive_error_count = 0; // in case of a manual retry + $("#g-status a").attr("href", "javascript:update()"); + } else { + $("#g-status").html(ERROR_MSG.replace("__COUNT__", consecutive_error_count)); + // Give a little time to back off before retrying + setTimeout(update, 1500 * consecutive_error_count); + } + } + } + }); + } + $(".g-progress-bar").progressbar({value: 0}); + update(); + dismiss = function() { + window.location.reload(); + } +</script> +<div id="g-progress"> + <h1> <?= $task->name ?> </h1> + <div class="g-progress-bar"></div> + <div id="g-status"> + <?= t("Starting up...") ?> + </div> + <div class="g-text-right"> + <button id="g-pause-button" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Pause") ?></button> + <button id="g-done-button" class="ui-state-default ui-corner-all" style="display: none" onclick="dismiss()"><?= t("Close") ?></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 0000000..96576ae --- /dev/null +++ b/modules/gallery/views/admin_modules.html.php @@ -0,0 +1,129 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div class="g-block ui-helper-clearfix"> + <script type="text/javascript"> + $("#g-module-update-form").ready(function() { + $("#g-module-update-form").ajaxForm({ + dataType: "json", + success: function(data) { + if (data.reload) { + window.location = "<? url::site("/admin/modules") ?>"; + } else { + $("body").append('<div id="g-dialog">' + data.dialog + '</div>'); + $("#g-dialog").dialog({ + bgiframe: true, + autoOpen: true, + autoResize: true, + modal: true, + resizable: false, + height: 400, + width: 500, + position: "center", + title: <?= t("Confirm module activation")->for_js() ?>, + buttons: { + <?= t("Continue")->for_js() ?>: function() { + $("form", this).submit(); + $(".ui-dialog-buttonpane button:contains(" + <?= t("Continue")->for_js() ?> + ")") + .attr("disabled", "disabled") + .addClass("ui-state-disabled"); + }, + <?= t("Cancel")->for_js() ?>: function() { + $(this).dialog("destroy").remove(); + } + } + }); + if (!data.allow_continue) { + $(".ui-dialog-buttonpane button:contains(" + <?= t("Continue")->for_js() ?> + ")") + .attr("disabled", "disabled") + .addClass("ui-state-disabled"); + } + } + } + }); + }); + </script> + <h1> <?= t("Gallery Modules") ?> </h1> + <p> + <?= t("Power up your Gallery by <a href=\"%url\">adding more modules</a>! Each module provides new cool features.", array("url" => "http://codex.galleryproject.org/Category:Gallery_3:Modules")) ?> + </p> + + <? if ($obsolete_modules_message): ?> + <p class="g-warning"> + <?= $obsolete_modules_message ?> + </p> + <? endif ?> + + <div class="g-block-content"> + <form id="g-module-update-form" method="post" action="<?= url::site("admin/modules/confirm") ?>"> + <?= access::csrf_form_field() ?> + <table> + <tr> + <th> <?= t("Installed") ?> </th> + <th style="width: 8em"> <?= t("Name") ?> </th> + <th> <?= t("Version") ?> </th> + <th> <?= t("Description") ?> </th> + <th style="width: 60px"> <?= t("Details") ?> </th> + </tr> + <? foreach ($available as $module_name => $module_info): ?> + <tr class="<?= text::alternate("g-odd", "g-even") ?>"> + <? $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> + <td style="white-space: nowrap"> + <ul class="g-buttonset"> + <li> + <a target="_blank" + <? if (isset($module_info->author_url)): ?> + class="ui-state-default ui-icon ui-icon-person ui-corner-left" + href="<?= $module_info->author_url ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-person ui-corner-left" + href="#" + <? endif ?> + + <? if (isset($module_info->author_name)): ?> + title="<?= $module_info->author_name ?>" + <? endif ?> + > + <? if (isset($module_info->author_name)): ?> + <?= $module_info->author_name ?> + <? endif ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($module_info->info_url)): ?> + class="ui-state-default ui-icon ui-icon-info" + href="<?= $module_info->info_url ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-info" + href="#" + <? endif ?> + > + <?= t("info") ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($module_info->discuss_url)): ?> + class="ui-state-default ui-icon ui-icon-comment ui-corner-right" + href="<?= $module_info->discuss_url ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-comment ui-corner-right" + href="#" + <? endif ?> + > + <?= t("discuss") ?> + </a> + </li> + </ul> + </td> + </tr> + <? endforeach ?> + </table> + <input type="submit" value="<?= t("Update")->for_html_attr() ?>" /> + </form> + </div> +</div> diff --git a/modules/gallery/views/admin_modules_confirm.html.php b/modules/gallery/views/admin_modules_confirm.html.php new file mode 100644 index 0000000..8c4cb2b --- /dev/null +++ b/modules/gallery/views/admin_modules_confirm.html.php @@ -0,0 +1,22 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div class="ui-helper-clearfix"> + <p> + <?= t("The following issue(s) have been identified:") ?> + </p> + + <div id="g-admin-modules-messages" class="g-block-content"> + <ul> + <? foreach (array("error" => "g-error", "warn" => "g-warning") as $type => $css_class): ?> + <? foreach ($messages[$type] as $message): ?> + <li class="<?= $css_class ?>" style="padding-bottom: 0"><?= $message ?></li> + <? endforeach ?> + <? endforeach ?> + </ul> + <form method="post" action="<?= url::site("admin/modules/save") ?>"> + <?= access::csrf_form_field() ?> + <? foreach ($modules as $module): ?> + <?= form::hidden($module, 1) ?> + <? endforeach ?> + </form> + </div> +</div> diff --git a/modules/gallery/views/admin_movies.html.php b/modules/gallery/views/admin_movies.html.php new file mode 100644 index 0000000..abf8fb2 --- /dev/null +++ b/modules/gallery/views/admin_movies.html.php @@ -0,0 +1,44 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-movies-admin" class="g-block ui-helper-clearfix"> + <h1> <?= t("Movies settings") ?> </h1> + <p> + <?= t("Gallery comes with everything it needs to upload and play movies.") ?> + <?= t("However, it needs the FFmpeg toolkit to extract thumbnails and size information from them.") ?> + </p> + <p> + <?= t("Although popular, FFmpeg is not installed on all Linux systems.") ?> + <?= t("To use FFmpeg without fully installing it, download a pre-compiled, <b>static build</b> of FFmpeg from one of the links <a href=\"%url\">here</a>.", array("url" => "http://ffmpeg.org/download.html")) ?> + <?= t("Then, put the \"ffmpeg\" file in Gallery's \"bin\" directory (e.g. \"/gallery3/bin\"), where Gallery will auto-detect it.") ?> + </p> + <p> + <?= t("Movies will work without FFmpeg, but their thumbnails will be placeholders.") ?> + </p> + <p> + <?= t("Can't get FFmpeg configured on your system? <a href=\"%url\">We can help!</a>", + array("url" => "http://codex.galleryproject.org/Gallery3:FAQ#Why_does_it_say_I.27m_missing_ffmpeg.3F")) ?> + </p> + + <div class="g-available"> + <h2> <?= t("Current configuration") ?> </h2> + <div id="g-ffmpeg" class="g-block"> + <img class="logo" width="284" height="70" src="<?= url::file("modules/gallery/images/ffmpeg.png") ?>" alt="<? t("Visit the FFmpeg project site") ?>" /> + <p> + <?= t("FFmpeg is a cross-platform standalone audio/video program.") ?><br/> + <?= t("Please refer to the <a href=\"%url\">FFmpeg website</a> for more information.", array("url" => "http://ffmpeg.org")) ?> + </p> + <div class="g-module-status g-info"> + <? if ($ffmpeg_dir): ?> + <? if ($ffmpeg_version): ?> + <p><?= t("FFmpeg version %version was found in %dir", array("version" => $ffmpeg_version, "dir" => $ffmpeg_dir)) ?></p> + <? else: ?> + <p><?= t("FFmpeg (of unknown version) was found in %dir", array("dir" => $ffmpeg_dir)) ?></p> + <? endif ?> + <? else: ?> + <p><?= t("We could not locate FFmpeg on your system.") ?></p> + <? endif ?> + </div> + </div> + </div> + + <?= $form ?> +</div> diff --git a/modules/gallery/views/admin_sidebar.html.php b/modules/gallery/views/admin_sidebar.html.php new file mode 100644 index 0000000..75499cb --- /dev/null +++ b/modules/gallery/views/admin_sidebar.html.php @@ -0,0 +1,64 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + $(document).ready(function(){ + $(".g-admin-blocks-list").equal_heights(); + var extra_ht = $(".g-admin-blocks-list li").length * $(".g-admin-blocks-list li:first").height(); + $(".g-admin-blocks-list").height($(".g-admin-blocks-list").height() + extra_ht); + }); + + $(function() { + $(".g-admin-blocks-list ul").sortable({ + connectWith: ".g-sortable-blocks", + opacity: .7, + placeholder: "g-target", + update: function(event,ui) { + if ($(this).attr("id") == "g-active-blocks") { + var active_blocks = ""; + $("ul#g-active-blocks li").each(function(i) { + active_blocks += "&block["+i+"]="+$(this).attr("ref"); + }); + $.getJSON($("#g-site-blocks").attr("ref").replace("__ACTIVE__", active_blocks), function(data) { + if (data.result == "success") { + $("ul#g-available-blocks").html(data.available); + $("ul#g-active-blocks").html(data.active); + $("#g-action-status").remove(); + var message = "<ul id=\"g-action-status\" class=\"g-message-block\">"; + message += "<li class=\"g-success\">" + data.message + "</li>"; + message += "</ul>"; + $("#g-block-admin").before(message); + $("#g-action-status li").gallery_show_message(); + } + }); + } + } + }).disableSelection(); + }); +</script> + +<div id="g-block-admin" class="g-block ui-helper-clearfix"> + <h1> <?= t("Manage sidebar") ?> </h1> + <p> + <?= t("Select and drag blocks from the available column to the active column to add to the sidebar; remove by dragging the other way.") ?> + </p> + + <div class="g-block-content"> + <div id="g-site-blocks" ref="<?= url::site("admin/sidebar/update?csrf={$csrf}__ACTIVE__") ?>"> + <div class="g-admin-blocks-list g-left"> + <h3><?= t("Available blocks") ?></h3> + <div> + <ul id="g-available-blocks" class="g-sortable-blocks"> + <?= $available ?> + </ul> + </div> + </div> + <div class="g-admin-blocks-list g-left"> + <h3><?= t("Active blocks") ?></h3> + <div> + <ul id="g-active-blocks" class="g-sortable-blocks"> + <?= $active ?> + </ul> + </div> + </div> + </div> + </div> +</div> diff --git a/modules/gallery/views/admin_sidebar_blocks.html.php b/modules/gallery/views/admin_sidebar_blocks.html.php new file mode 100644 index 0000000..48aa3f0 --- /dev/null +++ b/modules/gallery/views/admin_sidebar_blocks.html.php @@ -0,0 +1,5 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> + +<? foreach ($blocks as $ref => $text): ?> +<li class="g-draggable" ref="<?= $ref ?>"><?= $text ?></li> +<? endforeach ?> diff --git a/modules/gallery/views/admin_theme_options.html.php b/modules/gallery/views/admin_theme_options.html.php new file mode 100644 index 0000000..e452913 --- /dev/null +++ b/modules/gallery/views/admin_theme_options.html.php @@ -0,0 +1,7 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div class="g-block"> + <h1> <?= t("Theme options") ?> </h1> + <div class="g-block-content"> + <?= $form ?> + </div> +</div> diff --git a/modules/gallery/views/admin_themes.html.php b/modules/gallery/views/admin_themes.html.php new file mode 100644 index 0000000..547f27d --- /dev/null +++ b/modules/gallery/views/admin_themes.html.php @@ -0,0 +1,98 @@ +<?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> + +<div class="g-block ui-helper-clearfix"> + <h1> <?= t("Theme choice") ?> </h1> + <p> + <?= t("Make your Gallery beautiful <a href=\"%url\">with a new theme</a>! There are separate themes for the regular site and for the administration interface. Click a theme below to preview and activate it.", array("url" => "http://codex.galleryproject.org/Category:Gallery_3:Themes")) ?> + </p> + + <div class="g-block-content"> + <div id="g-site-theme"> + <h2> <?= t("Gallery theme") ?> </h2> + <div class="g-block g-selected ui-helper-clearfix"> + <img src="<?= url::file("themes/{$site}/thumbnail.png") ?>" + alt="<?= html::clean_attribute($themes[$site]->name) ?>" /> + <h3> <?= $themes[$site]->name ?> </h3> + <p> + <?= $themes[$site]->description ?> + </p> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $themes[$site]; print $v; ?> + </div> + + <h2> <?= t("Available Gallery themes") ?> </h2> + <div class="g-available"> + <? $count = 0 ?> + <? foreach ($themes as $id => $info): ?> + <? if (!$info->site) continue ?> + <? if ($id == $site) continue ?> + <div class="g-block ui-helper-clearfix"> + <a href="<?= url::site("admin/themes/preview/site/$id") ?>" class="g-dialog-link" title="<?= t("Theme Preview: %theme_name", array("theme_name" => $info->name))->for_html_attr() ?>"> + <img src="<?= url::file("themes/{$id}/thumbnail.png") ?>" + alt="<?= html::clean_attribute($info->name) ?>" /> + <h3> <?= $info->name ?> </h3> + <p> + <?= $info->description ?> + </p> + </a> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $info; print $v; ?> + </div> + <? $count++ ?> + <? endforeach ?> + + <? if (!$count): ?> + <p> + <?= t("There are no other site themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.galleryproject.org/Category:Gallery_3:Themes")) ?> + </p> + <? endif ?> + </div> + </div> + + <div id="g-admin-theme"> + <h2> <?= t("Admin theme") ?> </h2> + <div class="g-block g-selected ui-helper-clearfix"> + <img src="<?= url::file("themes/{$admin}/thumbnail.png") ?>" + alt="<?= html::clean_attribute($themes[$admin]->name) ?>" /> + <h3> <?= $themes[$admin]->name ?> </h3> + <p> + <?= $themes[$admin]->description ?> + </p> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $themes[$admin]; print $v; ?> + </div> + + <h2> <?= t("Available admin themes") ?> </h2> + <div class="g-available"> + <? $count = 0 ?> + <? foreach ($themes as $id => $info): ?> + <? if (!$info->admin) continue ?> + <? if ($id == $admin) continue ?> + <div class="g-block ui-helper-clearfix"> + <a href="<?= url::site("admin/themes/preview/admin/$id") ?>" class="g-dialog-link" title="<?= t("Theme Preview: %theme_name", array("theme_name" => $info->name))->for_html_attr() ?>"> + <img src="<?= url::file("themes/{$id}/thumbnail.png") ?>" + alt="<?= html::clean_attribute($info->name) ?>" /> + <h3> <?= $info->name ?> </h3> + <p> + <?= $info->description ?> + </p> + </a> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $info; print $v; ?> + </div> + <? $count++ ?> + <? endforeach ?> + + <? if (!$count): ?> + <p> + <?= t("There are no other admin themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.galleryproject.org/Category:Gallery_3:Themes")) ?> + </p> + <? endif ?> + </div> + </div> + + </div> +</div> diff --git a/modules/gallery/views/admin_themes_buttonset.html.php b/modules/gallery/views/admin_themes_buttonset.html.php new file mode 100644 index 0000000..bf474a2 --- /dev/null +++ b/modules/gallery/views/admin_themes_buttonset.html.php @@ -0,0 +1,48 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<ul class="g-buttonset"> + <li> + <a target="_blank" + <? if (isset($info['author_url'])): ?> + class="ui-state-default ui-icon ui-icon-person ui-corner-left" + href="<?= $info['author_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-person ui-corner-left" + href="#" + <? endif ?> + + <? if (isset($info['author_name'])): ?> + title="<?= $info['author_name'] ?>" + <? endif ?> + > + <? if (isset($info['author_name'])): ?> + <?= $info['author_name'] ?> + <? endif ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($info['info_url'])): ?> + class="ui-state-default ui-icon ui-icon-info" + href="<?= $info['info_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-info" + href="#" + <? endif ?> + > + <?= t("info") ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($info['discuss_url'])): ?> + class="ui-state-default ui-icon ui-icon-comment ui-corner-right" + href="<?= $info['discuss_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-comment ui-corner-right" + href="#" + <? endif ?> + > + <?= t("discuss") ?> + </a> + </li> +</ul> 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 0000000..80a6158 --- /dev/null +++ b/modules/gallery/views/admin_themes_preview.html.php @@ -0,0 +1,8 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<h1><?= t("Preview of the %theme_name theme", array("theme_name" => $info->name)) ?></h1> +<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/error.html.php b/modules/gallery/views/error.html.php new file mode 100644 index 0000000..5d81b65 --- /dev/null +++ b/modules/gallery/views/error.html.php @@ -0,0 +1,12 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-error"> + <h1> + <?= t("Dang... Something went wrong!") ?> + </h1> + <h2> + <?= t("We tried really hard, but it's broken.") ?> + </h2> + <p> + <?= t("Talk to your Gallery administrator for help fixing this!") ?> + </p> +</div>
\ No newline at end of file diff --git a/modules/gallery/views/error_404.html.php b/modules/gallery/views/error_404.html.php new file mode 100644 index 0000000..42f62b6 --- /dev/null +++ b/modules/gallery/views/error_404.html.php @@ -0,0 +1,26 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-error"> + <h1> + <?= t("Dang... Page not found!") ?> + </h1> + <? if ($is_guest): ?> + <h2> + <?= t("Hey wait, you're not signed in yet!") ?> + </h2> + <p> + <?= t("Maybe the page exists, but is only visible to authorized users.") ?> + <?= t("Please sign in to find out.") ?> + </p> + <?= $login_form ?> + <script type="text/javascript"> + $(document).ready(function() { + $("#g-username").focus(); + }); + </script> + <? else: ?> + <p> + <?= t("Maybe the page exists, but is only visible to authorized users.") ?> + <?= t("If you think this is an error, talk to your Gallery administrator!") ?> + </p> + <? endif; ?> +</div> diff --git a/modules/gallery/views/error_admin.html.php b/modules/gallery/views/error_admin.html.php new file mode 100644 index 0000000..036e204 --- /dev/null +++ b/modules/gallery/views/error_admin.html.php @@ -0,0 +1,307 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<? $error_id = uniqid("error") ?> +<? if (!function_exists("t")) { function t($msg) { return $msg; } } ?> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <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: 60em; + margin: 20px auto; + } + + #framework_error { + height: 6em; + } + + #framework_error .crashlogo { + position: relative; + top: .3em; + font-size: 6.0em; + } + + #framework_error .title { + position: relative; + top: -2.5em; + padding: 0px; + text-align: center; + } + + div#error_details { + text-align: left; + } + + code { + font-family: monospace; + font-size: 12px; + margin: 20px 20px 20px 0px; + color: #333; + white-space: pre-wrap; + white-space: -moz-pre-wrap; + word-wrap: break-word; + } + + code .line { + padding-left: 10px; + } + + 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; + } + + .collapsed { + display: none; + } + + .highlight { + font-weight: bold; + color: darkred; + } + + #kohana_error .message { + display: block; + padding-bottom: 10px; + } + + .source { + border: solid 1px #ccc; + background: #efe; + margin-bottom: 5px; + } + + table { + width: 100%; + display: block; + margin: 0 0 0.4em; + padding: 0; + border-collapse: collapse; + background: #efe; + } + + table td { + border: solid 1px #ddd; + text-align: left; + vertical-align: top; + padding: 0.4em; + } + + .args table td.key { + width: 200px; + } + + .number { + padding-right: 1em; + } + + #g-platform h2, #g-stats h2 { + font-size: 1.1em; + } + </style> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <title><?= t("Something went wrong!") ?></title> + + <script type="text/javascript"> + function koggle(elem) { + elem = document.getElementById(elem); + if (elem.style && elem.style["display"]) { + // Only works with the "style" attr + var disp = elem.style["display"]; + } else { + if (elem.currentStyle) { + // For MSIE, naturally + var disp = elem.currentStyle["display"]; + } else { + if (window.getComputedStyle) { + // For most other browsers + var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display'); + } + } + } + + // Toggle the state of the "display" style + elem.style.display = disp == 'block' ? 'none' : 'block'; + return false; + } + </script> + </head> + <body> + <? try { $user = identity::active_user(); } catch (Exception $e) { } ?> + <div class="big_box" id="framework_error"> + <div class="crashlogo"> + :-( + </div> + <div class="title"> + <h1> + <?= t("Dang... Something went wrong!") ?> + </h1> + <h2> + <?= t("We tried really hard, but it's broken.") ?> + </h2> + </div> + </div> + <div class="big_box" id="error_details"> + <h2> + <?= t("Hey wait, you're an admin! We can tell you stuff.") ?> + </h2> + <p> + There's an error message below and you can find more details + in gallery3/var/logs (look for the file with the most recent + date on it). Stuck? Stop by the <a href="http://galleryproject.org/forum/96">Gallery 3 + Forums</a> and ask for help. You can also look at our list + of <a href="http://sourceforge.net/apps/trac/gallery/roadmap">open + tickets</a> to see if the problem you're seeing has been + reported. If you post a request, here's some useful + information to include: + <?= @gallery_block::get("platform_info") ?> + <?= @gallery_block::get("stats") ?> + </p> + <div id="kohana_error"> + <h3> + <span class="type"> + <?= $type?> [ <?= $code ?> ]: + </span> + <span class="message"> + <?= html::purify($message) ?> + </span> + </h3> + <div id="<?= $error_id ?>" class="content"> + <ol class="trace"> + <li class="snippet"> + <p> + <span class="file"> + <?= Kohana_Exception::debug_path($file)?>[ <?= $line?> ] + </span> + </p> + + <div class="source"> + <? if (Kohana_Exception::$source_output and $source_code = Kohana_Exception::debug_source($file, $line)): ?><code><? foreach ($source_code as $num => $row): ?><span class="line <?= ($num == $line) ? "highlight" : ""?>"><span class="number"><?= $num ?></span><?= htmlspecialchars($row, ENT_NOQUOTES, Kohana::CHARSET) ?></span><? endforeach ?></code> + <? endif ?> + </div> + </li> + + <? if (Kohana_Exception::$trace_output): ?> + <? foreach (Kohana_Exception::trace($trace) as $i => $step): ?> + <li class="snippet"> + <p> + <span class="file"> + <? if ($step["file"]): $source_id = "$error_id.source.$i" ?> + <? if (Kohana_Exception::$source_output and $step["source"]): ?> + <a href="#<?= $source_id ?>" onclick="return koggle('<?= $source_id ?>')"><?= Kohana_Exception::debug_path($step["file"])?>[ <?= $step["line"]?> ]</a> + <? else: ?> + <span class="file"><?= Kohana_Exception::debug_path($step["file"])?>[ <?= $step["line"]?> ]</span> + <? endif ?> + <? else: ?> + {<?= t("PHP internal call")?>} + <? endif?> + </span> + » + <?= $step["function"]?>(<? if ($step["args"]): $args_id = "$error_id.args.$i" ?> + <a href="#<?= $args_id ?>" onclick="return koggle('<?= $args_id ?>')"><?= t("arguments")?></a> + <? endif?>) + </p> + <? if (isset($args_id)): ?> + <div id="<?= $args_id ?>" class="args collapsed"> + <table cellspacing="0"> + <? foreach ($step["args"] as $name => $arg): ?> + <tr> + <td class="key"> + <pre><?= $name?></pre> + </td> + <td class="value"> + <pre><?= Kohana_Exception::safe_dump($arg, $name) ?></pre> + </td> + </tr> + <? endforeach?> + </table> + </div> + <? endif?> + <? if (Kohana_Exception::$source_output and $step["source"] and isset($source_id)): ?> + <pre id="<?= $source_id ?>" class="source collapsed"><code><? foreach ($step["source"] as $num => $row): ?><span class="line <?= ($num == $step["line"]) ? "highlight" : "" ?>"><span class="number"><?= $num ?></span><?= htmlspecialchars($row, ENT_NOQUOTES, Kohana::CHARSET) ?></span><? endforeach ?></code></pre> + <? endif?> + </li> + <? unset($args_id, $source_id) ?> + <? endforeach?> + </ol> + <? endif ?> + + </div> + <h2> + <a href="#<?= $env_id = $error_id."environment" ?>" onclick="return koggle('<?= $env_id ?>')"><?= t("Environment")?></a> + </h2> + <div id="<?= $env_id ?>" class="content collapsed"> + <? $included = get_included_files()?> + <h3><a href="#<?= $env_id = $error_id."environment_included" ?>" onclick="return koggle('<?= $env_id ?>')"><?= t("Included files")?></a>(<?= count($included)?>)</h3> + <div id="<?= $env_id ?>" class="collapsed"> + <table cellspacing="0"> + <? foreach ($included as $file): ?> + <tr> + <td> + <pre><?= Kohana_Exception::debug_path($file)?></pre> + </td> + </tr> + <? endforeach?> + </table> + </div> + <? $included = get_loaded_extensions()?> + <h3><a href="#<?= $env_id = $error_id."environment_loaded" ?>" onclick="return koggle('<?= $env_id ?>')"><?= t("Loaded extensions")?></a>(<?= count($included)?>)</h3> + <div id="<?= $env_id ?>" class="collapsed"> + <table cellspacing="0"> + <? foreach ($included as $file): ?> + <tr> + <td> + <pre><?= Kohana_Exception::debug_path($file)?></pre> + </td> + </tr> + <? endforeach?> + </table> + </div> + <? foreach (array("_SESSION", "_GET", "_POST", "_FILES", "_COOKIE", "_SERVER") as $var): ?> + <? if ( empty($GLOBALS[$var]) OR ! is_array($GLOBALS[$var])) continue ?> + <h3><a href="#<?= $env_id = "$error_id.environment" . strtolower($var) ?>" + onclick="return koggle('<?= $env_id ?>')">$<?= $var?></a></h3> + <div id="<?= $env_id ?>" class="collapsed"> + <table cellspacing="0"> + <? foreach ($GLOBALS[$var] as $key => $value): ?> + <tr> + <td class="key"> + <code> + <?= html::purify($key) ?> + </code> + </td> + <td class="value"> + <pre><?= Kohana_Exception::safe_dump($value, $key) ?></pre> + </td> + </tr> + <? endforeach?> + </table> + </div> + <? endforeach?> + </div> + </div> + </div> + </body> +</html> diff --git a/modules/gallery/views/error_cli.txt.php b/modules/gallery/views/error_cli.txt.php new file mode 100644 index 0000000..9f476f5 --- /dev/null +++ b/modules/gallery/views/error_cli.txt.php @@ -0,0 +1,3 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<? echo Kohana_Exception::text($e), "\n"; + diff --git a/modules/gallery/views/error_user.html.php b/modules/gallery/views/error_user.html.php new file mode 100644 index 0000000..09ab752 --- /dev/null +++ b/modules/gallery/views/error_user.html.php @@ -0,0 +1,60 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<? if (!function_exists("t")) { function t($msg) { return $msg; } } ?> +<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: 60em; + margin: 20px auto; + } + + #framework_error { + height: 8em; + } + + #framework_error .crashlogo { + position: relative; + top: .3em; + font-size: 6em; + } + + #framework_error .title { + position: relative; + top: -3em; + text-align: center; + margin: 0 auto; + } + </style> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <title><?= t("Something went wrong!") ?></title> + </head> + <body> + <div class="big_box" id="framework_error"> + <div class="crashlogo"> + :-( + </div> + <div class="title"> + <h1> + <?= t("Dang... Something went wrong!") ?> + </h1> + <h2> + <?= t("We tried really hard, but it's broken.") ?> + </h2> + <p> + <?= t("Talk to your Gallery administrator for help fixing this!") ?> + </p> + </div> + </div> + </body> +</html> diff --git a/modules/gallery/views/form.html.php b/modules/gallery/views/form.html.php new file mode 100644 index 0000000..abc3216 --- /dev/null +++ b/modules/gallery/views/form.html.php @@ -0,0 +1,77 @@ +<?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->type == 'script') { + print $input->render(); + } else { + if ($input->error_messages()) { + print "$prefix<li class=\"g-error\">\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=\"g-message g-error\">\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/form_uploadify.html.php b/modules/gallery/views/form_uploadify.html.php new file mode 100644 index 0000000..bba6db7 --- /dev/null +++ b/modules/gallery/views/form_uploadify.html.php @@ -0,0 +1,167 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript" src="<?= url::file("lib/swfobject.js") ?>"></script> +<script type="text/javascript" src="<?= url::file("lib/uploadify/jquery.uploadify.min.js") ?>"></script> +<script type="text/javascript"> + <? $flash_minimum_version = "9.0.24" ?> + var success_count = 0; + var error_count = 0; + var updating = 0; + $("#g-add-photos-canvas").ready(function () { + var update_status = function() { + if (updating) { + // poor man's mutex + setTimeout(function() { update_status(); }, 500); + } + updating = 1; + $.get("<?= url::site("uploader/status/_S/_E") ?>" + .replace("_S", success_count).replace("_E", error_count), + function(data) { + $("#g-add-photos-status-message").html(data); + updating = 0; + }); + }; + + if (swfobject.hasFlashPlayerVersion("<?= $flash_minimum_version ?>")) { + $("#g-uploadify").uploadify({ + width: 298, + height: 32, + uploader: "<?= url::file("lib/uploadify/uploadify.swf.php") ?>", + script: "<?= url::site("uploader/add_photo/{$album->id}") ?>", + scriptData: <?= json_encode($script_data) ?>, + fileExt: "<?= implode(";", $extensions) ?>", + fileDesc: <?= t("Photos and movies")->for_js() ?>, + cancelImg: "<?= url::file("lib/uploadify/cancel.png") ?>", + simUploadLimit: <?= $simultaneous_upload_limit ?>, + sizeLimit: <?= $size_limit_bytes ?>, + wmode: "transparent", + hideButton: true, /* should be true */ + auto: true, + multi: true, + onAllComplete: function(filesUploaded, errors, allbytesLoaded, speed) { + $("#g-upload-cancel-all") + .addClass("ui-state-disabled") + .attr("disabled", "disabled"); + $("#g-upload-done") + .removeClass("ui-state-disabled") + .attr("disabled", null); + return true; + }, + onClearQueue: function(event) { + $("#g-upload-cancel-all") + .addClass("ui-state-disabled") + .attr("disabled", "disabled"); + $("#g-upload-done") + .removeClass("ui-state-disabled") + .attr("disabled", null); + return true; + }, + onComplete: function(event, queueID, fileObj, response, data) { + var re = /^error: (.*)$/i; + var msg = re.exec(response); + $("#g-add-photos-status ul").append( + "<li id=\"q" + queueID + "\" class=\"g-success\"><span></span> - " + + <?= t("Completed")->for_js() ?> + "</li>"); + $("#g-add-photos-status li#q" + queueID + " span").text(fileObj.name); + setTimeout(function() { $("#q" + queueID).slideUp("slow").remove() }, 5000); + success_count++; + update_status(); + return true; + }, + onError: function(event, queueID, fileObj, errorObj) { + if (errorObj.type == "HTTP") { + if (errorObj.info == "500") { + error_msg = <?= t("Unable to process this photo")->for_js() ?>; + } else if (errorObj.info == "404") { + error_msg = <?= t("The upload script was not found")->for_js() ?>; + } else if (errorObj.info == "400") { + error_msg = <?= t("This photo is too large (max is %size bytes)", + array("size" => $size_limit))->for_js() ?>; + } else { + msg += (<?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?> + .replace("__INFO__", errorObj.info) + .replace("__TYPE__", errorObj.type)); + } + } else if (errorObj.type == "File Size") { + error_msg = <?= t("This photo is too large (max is %size bytes)", + array("size" => $size_limit))->for_js() ?>; + } else { + error_msg = <?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?> + .replace("__INFO__", errorObj.info) + .replace("__TYPE__", errorObj.type); + } + msg = " - <a target=\"_blank\" href=\"http://codex.galleryproject.org/Gallery3:Troubleshooting:Uploading\">" + + error_msg + "</a>"; + + $("#g-add-photos-status ul").append( + "<li id=\"q" + queueID + "\" class=\"g-error\"><span></span>" + msg + "</li>"); + $("#g-add-photos-status li#q" + queueID + " span").text(fileObj.name); + $("#g-uploadify").uploadifyCancel(queueID); + error_count++; + update_status(); + }, + onSelect: function(event) { + if ($("#g-upload-cancel-all").hasClass("ui-state-disabled")) { + $("#g-upload-cancel-all") + .removeClass("ui-state-disabled") + .attr("disabled", null); + $("#g-upload-done") + .addClass("ui-state-disabled") + .attr("disabled", "disabled"); + } + return true; + } + }); + } else { + $(".requires-flash").hide(); + $(".no-flash").show(); + } + }); +</script> + +<div class="requires-flash"> + <? if ($suhosin_session_encrypt || (identity::active_user()->admin && !$movies_allowed)): ?> + <div class="g-message-block g-info"> + <? if ($suhosin_session_encrypt): ?> + <p class="g-error"> + <?= 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/")) ?> + </p> + <? endif ?> + + <? if (identity::active_user()->admin && !$movies_allowed): ?> + <p class="g-warning"> + <?= t("Movie uploading is disabled on your system. <a href=\"%help_url\">Help!</a>", array("help_url" => url::site("admin/movies"))) ?> + </p> + <? endif ?> + </div> + <? endif ?> + + <div> + <ul class="g-breadcrumbs"> + <? foreach ($album->parents() as $i => $parent): ?> + <li<? if ($i == 0) print " class=\"g-first\"" ?>> <?= html::clean($parent->title) ?> </li> + <? endforeach ?> + <li class="g-active"> <?= html::purify($album->title) ?> </li> + </ul> + </div> + + <div id="g-add-photos-canvas"> + <button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos (%size max per file)...", array("size" => $size_limit)) ?></button> + <span id="g-uploadify"></span> + </div> + <div id="g-add-photos-status"> + <ul id="g-action-status" class="g-message-block"> + </ul> + </div> +</div> + +<div class="no-flash" style="display: none"> + <p> + <?= t("Your browser must have Adobe Flash Player version %flash_minimum_version or greater installed to use this feature.", array("flash_minimum_version" => $flash_minimum_version)) ?> + </p> + <a href="http://www.adobe.com/go/getflashplayer"> + <img src="<?= request::protocol() ?>://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" + alt=<?= t("Get Adobe Flash Player")->for_js() ?> /> + </a> +</div> diff --git a/modules/gallery/views/form_uploadify_buttons.html.php b/modules/gallery/views/form_uploadify_buttons.html.php new file mode 100644 index 0000000..e002d82 --- /dev/null +++ b/modules/gallery/views/form_uploadify_buttons.html.php @@ -0,0 +1,11 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div class="requires-flash"> + <!-- Proxy the done request back to our form, since its been ajaxified --> + <button id="g-upload-done" class="ui-state-default ui-corner-all" onclick="$('#g-add-photos-form').submit();return false;"> + <?= t("Done") ?> + </button> + <button id="g-upload-cancel-all" class="ui-state-default ui-corner-all ui-state-disabled" onclick="$('#g-uploadify').uploadifyClearQueue();return false;" disabled="disabled"> + <?= t("Cancel uploads") ?> + </button> + <span id="g-add-photos-status-message" /> +</div> diff --git a/modules/gallery/views/in_place_edit.html.php b/modules/gallery/views/in_place_edit.html.php new file mode 100644 index 0000000..2d6cbe9 --- /dev/null +++ b/modules/gallery/views/in_place_edit.html.php @@ -0,0 +1,21 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<?= form::open($action, array("method" => "post", "id" => "g-in-place-edit-form", "class" => "g-short-form")) ?> + <?= access::csrf_form_field() ?> + <ul> + <li<? if (!empty($errors["input"])): ?> class="g-error"<? endif ?>> + <?= form::input("input", $form["input"], " class=\"textbox\"") ?> + </li> + <li> + <?= form::submit(array("class" => "submit ui-state-default"), t("Save")) ?> + </li> + <li><a href="#" class="g-cancel"><?= t("Cancel") ?></a></li> + <? if (!empty($errors["input"])): ?> + <li> + <p id="g-in-place-edit-message" class="g-error"><?= $errors["input"] ?></p> + </li> + <? endif ?> + </ul> +</form> + + + diff --git a/modules/gallery/views/kohana/error.php b/modules/gallery/views/kohana/error.php new file mode 100644 index 0000000..0e84f09 --- /dev/null +++ b/modules/gallery/views/kohana/error.php @@ -0,0 +1,46 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<? +// This is the template for all HTML errors. If you're throwing an exception and you want your +// error to appear differently, extend Kohana_Exception and specify a different template. + +// Log validation exceptions to ease debugging +if ($e instanceof ORM_Validation_Exception) { + Kohana_Log::add("error", "Validation errors: " . print_r($e->validation->errors(), 1)); +} + +if (php_sapi_name() == "cli") { + include Kohana::find_file("views", "error_cli.txt"); + return; +} + +try { + // Admins get a special error page + $user = identity::active_user(); + if ($user && $user->admin) { + include Kohana::find_file("views", "error_admin.html"); + return; + } +} catch (Exception $ignored) { +} + +// Try to show a themed error page for 404 errors +if ($e instanceof Kohana_404_Exception) { + if (Router::$controller == "file_proxy") { + print "File not found"; + } else { + $view = new Theme_View("page.html", "other", "error"); + $view->page_title = t("Dang... Page not found!"); + $view->content = new View("error_404.html"); + $user = identity::active_user(); + $view->content->is_guest = $user && $user->guest; + if ($view->content->is_guest) { + $view->content->login_form = new View("login_ajax.html"); + $view->content->login_form->form = auth::get_login_form("login/auth_html"); + } + print $view; + } + return; +} + +header("HTTP/1.1 500 Internal Server Error"); +include Kohana::find_file("views", "error_user.html"); diff --git a/modules/gallery/views/kohana_profiler.php b/modules/gallery/views/kohana_profiler.php new file mode 100644 index 0000000..c753434 --- /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 0000000..47a45e2 --- /dev/null +++ b/modules/gallery/views/l10n_client.html.php @@ -0,0 +1,82 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="l10n-client" class="hidden"> + <div class="labels"> + <span id="l10n-client-toggler"> + <a id="g-minimize-l10n">_</a> + <a id="g-close-l10n" title="<?= t("Stop the translation mode")->for_html_attr() ?>" + href="<?= html::clean_attribute(url::site("l10n_client/toggle_l10n_mode?csrf=".access::csrf_token())) ?>">X</a> + </span> + <div class="label strings"><h2><?= t("Page text") ?> + <? if (!Input::instance()->get('show_all_l10n_messages')): ?> + <a style="background-color:#fff" href="<?= url::site("admin/languages?show_all_l10n_messages=1") ?>"><?= t("(Show all)") ?></a> + <? endif; ?> + </h2></div> + <div class="label source"><h2><?= t("Source") ?></div> + <div class="label translation"><h2><?= t("Translation to %language", + array("language" => locales::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" ?>"> + <? if (is_array($string["source"])): ?> + [one] - <?= $string["source"]["one"] ?><br/> + [other] - <?= $string["source"]["other"] ?> + <? else: ?> + <?= $string["source"] ?> + <? endif; ?> + </li> + <? endforeach; ?> + </ul> + + <?= $l10n_search_form ?> + </div> + <div id="l10n-client-string-editor"> + <div class="source"> + <p class="source-text"></p> + <p id="source-text-tmp-space" style="display:none"></p> + </div> + <div class="translation"> + <form method="post" action="<?= url::site("l10n_client/save") ?>" id="g-l10n-client-save-form"> + <?= access::csrf_form_field() ?> + <?= form::hidden("l10n-message-key") ?> + <?= form::textarea("l10n-edit-translation", "", ' id="l10n-edit-translation" rows="5" class="translationField"') ?> + <div id="plural-zero" class="translationField hidden"> + <label for="l10n-edit-plural-translation-zero">[zero]</label> + <?= form::textarea("l10n-edit-plural-translation-zero", "", ' rows="2"') ?> + </div> + <div id="plural-one" class="translationField hidden"> + <label for="l10n-edit-plural-translation-one">[one]</label> + <?= form::textarea("l10n-edit-plural-translation-one", "", ' rows="2"') ?> + </div> + <div id="plural-two" class="translationField hidden"> + <label for="l10n-edit-plural-translation-two">[two]</label> + <?= form::textarea("l10n-edit-plural-translation-two", "", ' rows="2"') ?> + </div> + <div id="plural-few" class="translationField hidden"> + <label for="l10n-edit-plural-translation-few">[few]</label> + <?= form::textarea("l10n-edit-plural-translation-few", "", ' rows="2"') ?> + </div> + <div id="plural-many" class="translationField hidden"> + <label for="l10n-edit-plural-translation-many">[many]</label> + <?= form::textarea("l10n-edit-plural-translation-many", "", ' rows="2"') ?> + </div> + <div id="plural-other" class="translationField hidden"> + <label for="l10n-edit-plural-translation-other">[other]</label> + (<a href="http://www.unicode.org/cldr/data/charts/supplemental/language_plural_rules.html"><?= t("learn more about plural forms") ?></a>) + <?= form::textarea("l10n-edit-plural-translation-other", "", ' rows="2"') ?> + </div> + <input type="submit" name="l10n-edit-save" value="<?= t("Save translation")->for_html_attr() ?>"/> + <a href="javascript: Gallery.l10nClient.copySourceText()" + class="g-button ui-state-default ui-corner-all"><?= t("Copy source text") ?></a> + </form> + </div> + </div> + <script type="text/javascript"> + var MSG_TRANSLATE_TEXT = <?= t("Translate text")->for_js() ?>; + var l10n_client_data = <?= json_encode($string_list) ?>; + var plural_forms = <?= json_encode($plural_forms) ?>; + var toggle_l10n_mode_url = <?= html::js_string(url::site("l10n_client/toggle_l10n_mode")) ?>; + var csrf = <?= html::js_string(access::csrf_token()) ?>; + </script> +</div> diff --git a/modules/gallery/views/login_ajax.html.php b/modules/gallery/views/login_ajax.html.php new file mode 100644 index 0000000..a40d195 --- /dev/null +++ b/modules/gallery/views/login_ajax.html.php @@ -0,0 +1,52 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + $("#g-login-form").ready(function() { + $("#g-password-reset").click(function() { + $.ajax({ + url: "<?= url::site("password/reset") ?>", + success: function(data) { + $("#g-login").html(data); + $("#ui-dialog-title-g-dialog").html(<?= t("Reset password")->for_js() ?>); + $(".submit").addClass("g-button ui-state-default ui-corner-all"); + $(".submit").gallery_hover_init(); + ajaxify_login_reset_form(); + + // See comment about IE7 below + setTimeout('$("#g-name").focus()', 100); + } + }); + }); + + // Setting the focus here doesn't work on IE7, perhaps because the field is + // not ready yet? So set a timeout and do it the next time we're idle + setTimeout('$("#g-username").focus()', 100); + }); + + function ajaxify_login_reset_form() { + $("#g-login form").ajaxForm({ + dataType: "json", + success: function(data) { + if (data.form) { + $("#g-login form").replaceWith(data.form); + ajaxify_login_reset_form(); + } + if (data.result == "success") { + $("#g-dialog").dialog("close"); + window.location.reload(); + } + } + }); + }; +</script> +<div id="g-login"> + <ul> + <li id="g-login-form"> + <?= $form ?> + </li> + <? if (identity::is_writable() && !module::get_var("gallery", "maintenance_mode")): ?> + <li> + <a href="#" id="g-password-reset" class="g-right g-text-small"><?= t("Forgot your password?") ?></a> + </li> + <? endif ?> + </ul> +</div> diff --git a/modules/gallery/views/login_current_user.html.php b/modules/gallery/views/login_current_user.html.php new file mode 100644 index 0000000..9452557 --- /dev/null +++ b/modules/gallery/views/login_current_user.html.php @@ -0,0 +1,7 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<li> + <? $name = $menu->label->for_html() ?> + <? $hover_text = t("Your profile")->for_html_attr() ?> + <?= t("Logged in as %name", array("name" => html::mark_clean( + "<a href='$menu->url' title='$hover_text' id='$menu->id'>{$name}</a>"))) ?> +</li> diff --git a/modules/gallery/views/menu.html.php b/modules/gallery/views/menu.html.php new file mode 100644 index 0000000..17a249d --- /dev/null +++ b/modules/gallery/views/menu.html.php @@ -0,0 +1,24 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<? if (!$menu->is_empty()): // Don't show the menu if it has no choices ?> +<? if ($menu->is_root): ?> +<ul <?= $menu->css_id ? "id='$menu->css_id'" : "" ?> class="<?= $menu->css_class ?>"> + <? foreach ($menu->elements as $element): ?> + <?= $element->render() ?> + <? endforeach ?> +</ul> + +<? else: ?> + +<li title="<?= $menu->label->for_html_attr() ?>"> + <a href="#"> + <?= $menu->label->for_html() ?> + </a> + <ul> + <? foreach ($menu->elements as $element): ?> + <?= $element->render() ?> + <? endforeach ?> + </ul> +</li> + +<? endif ?> +<? endif ?> diff --git a/modules/gallery/views/menu_ajax_link.html.php b/modules/gallery/views/menu_ajax_link.html.php new file mode 100644 index 0000000..06cd6f9 --- /dev/null +++ b/modules/gallery/views/menu_ajax_link.html.php @@ -0,0 +1,10 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<li> + <a <?= $menu->css_id ? "id='{$menu->css_id}'" : "" ?> + class="g-ajax-link <?= $menu->css_class ?>" + href="<?= $menu->url ?>" + title="<?= $menu->label->for_html_attr() ?>" + ajax_handler="<?= $menu->ajax_handler ?>"> + <?= $menu->label->for_html() ?> + </a> +</li> diff --git a/modules/gallery/views/menu_dialog.html.php b/modules/gallery/views/menu_dialog.html.php new file mode 100644 index 0000000..b44080c --- /dev/null +++ b/modules/gallery/views/menu_dialog.html.php @@ -0,0 +1,9 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<li> + <a <?= $menu->css_id ? "id='{$menu->css_id}'" : "" ?> + class="g-dialog-link <?= $menu->css_class ?>" + href="<?= $menu->url ?>" + title="<?= $menu->label->for_html_attr() ?>"> + <?= $menu->label->for_html() ?> + </a> +</li> diff --git a/modules/gallery/views/menu_link.html.php b/modules/gallery/views/menu_link.html.php new file mode 100644 index 0000000..a36d275 --- /dev/null +++ b/modules/gallery/views/menu_link.html.php @@ -0,0 +1,9 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<li> + <a <?= $menu->css_id ? "id='{$menu->css_id}'" : "" ?> + class="g-menu-link <?= $menu->css_class ?>" + href="<?= $menu->url ?>" + title="<?= $menu->label->for_html_attr() ?>"> + <?= $menu->label->for_html() ?> + </a> +</li> diff --git a/modules/gallery/views/movieplayer.html.php b/modules/gallery/views/movieplayer.html.php new file mode 100644 index 0000000..3cf5d17 --- /dev/null +++ b/modules/gallery/views/movieplayer.html.php @@ -0,0 +1,50 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<?= html::anchor($url, "", $attrs) ?> +<script type="text/javascript"> + var id = "<?= $attrs["id"] ?>"; + var max_size = <?= $max_size ?>; + // set the size of the movie html anchor, taking into account max_size and height of control bar + function set_movie_size(width, height) { + if((width > max_size) || (height > max_size)) { + if (width > height) { + height = Math.ceil(height * max_size / width); + width = max_size; + } else { + width = Math.ceil(width * max_size / height); + height = max_size; + } + } + height += flowplayer(id).getConfig().plugins.controls.height; + $("#" + id).css({width: width, height: height}); + }; + // setup flowplayer + flowplayer(id, + $.extend(true, { + "src": "<?= url::abs_file("lib/flowplayer.swf.php") ?>", + "wmode": "transparent", + "provider": "pseudostreaming" + }, <?= json_encode($fp_params) ?>), + $.extend(true, { + "plugins": { + "pseudostreaming": { + "url": "<?= url::abs_file("lib/flowplayer.pseudostreaming-byterange.swf.php") ?>" + }, + "controls": { + "autoHide": "always", + "hideDelay": 2000, + "height": 24, + "url": "<?= url::abs_file("lib/flowplayer.controls.swf.php") ?>" + } + }, + "clip": { + "scaling": "fit", + "onMetaData": function(clip) { + // set movie size a second time using actual size from metadata + set_movie_size(parseInt(clip.metaData.width), parseInt(clip.metaData.height)); + } + } + }, <?= json_encode($fp_config) ?>) + ).ipad(); + // set movie size using width and height passed from movie_img function + $("document").ready(set_movie_size(<?= $width ?>, <?= $height ?>)); +</script> diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php new file mode 100644 index 0000000..0b27336 --- /dev/null +++ b/modules/gallery/views/permissions_browse.html.php @@ -0,0 +1,62 @@ +<?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) { + $("#g-edit-permissions-form").html(data); + $(".g-active").removeClass("g-active"); + $("#item-" + id).addClass("g-active"); + } + }); + } + + 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) { + $("#g-edit-permissions-form").load(form_url.replace("__ITEM__", item_id)); + } + }); + } +</script> +<div id="g-permissions"> + <? if (!$htaccess_works): ?> + <ul id="g-action-status" class="g-message-block"> + <li class="g-error"> + <?= t("Oh no! Your server needs a configuration change in order for you to hide photos! Ask your server administrator to enable <a %mod_rewrite_attrs>mod_rewrite</a> and set <a %apache_attrs><i>AllowOverride FileInfo Options</i></a> to fix this.", + array("mod_rewrite_attrs" => html::mark_clean('href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html" target="_blank"'), + "apache_attrs" => html::mark_clean('href="http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride" target="_blank"'))) ?> + </li> + </ul> + <? endif ?> + + <p><?= t("Edit permissions for album:") ?></p> + + <ul class="g-breadcrumbs"> + <? $i = 0 ?> + <? foreach ($parents as $parent): ?> + <li id="item-<?= $parent->id ?>"<? if ($i == 0) print " class=\"g-first\"" ?>> + <? if (access::can("edit", $parent)): ?> + <a href="javascript:show(<?= $parent->id ?>)"> <?= html::purify($parent->title) ?> </a> + <? else: ?> + <?= html::purify($parent->title) ?> + <? endif ?> + </li> + <? $i++ ?> + <? endforeach ?> + <li class="g-active" id="item-<?= $item->id ?>"> + <a href="javascript:show(<?= $item->id ?>)"> + <?= html::purify($item->title) ?> + </a> + </li> + </ul> + + <div id="g-edit-permissions-form"> + <?= $form ?> + </div> +</div> diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php new file mode 100644 index 0000000..f171411 --- /dev/null +++ b/modules/gallery/views/permissions_form.html.php @@ -0,0 +1,92 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<fieldset> + <legend> <?= t('Edit Permissions') ?> </legend> + <table> + <tr> + <th> </th> + <? foreach ($groups as $group): ?> + <th> <?= html::clean($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="g-denied"> + <img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" + title="<?= t('denied and locked through parent album')->for_html_attr() ?>" + alt="<?= t('denied icon')->for_html_attr() ?>" /> + <a href="javascript:show(<?= $lock->id ?>)" title="<?= t('click to go to parent album')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-lock.png")) ?>" alt="<?= t('locked icon')->for_html_attr() ?>" /> + </a> + </td> + <? else: ?> + <? if ($intent === access::INHERIT): ?> + <? if ($allowed): ?> + <td class="g-allowed"> + <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('allowed through parent album, click to allow explicitly')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-success-passive.png")) ?>" alt="<?= t('passive allowed icon')->for_html_attr() ?>" /> + </a> + <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('click to deny')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-denied-inactive.png")) ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> + </a> + </td> + <? else: ?> + <td class="g-denied"> + <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('click to allow')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-success-inactive.png")) ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> + </a> + <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('denied through parent album, click to deny explicitly')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-denied-passive.png")) ?>" alt="<?= t('passive denied icon')->for_html_attr() ?>" /> + </a> + </td> + <? endif ?> + + <? elseif ($intent === access::DENY): ?> + <td class="g-denied"> + <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('click to allow')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-success-inactive.png")) ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> + </a> + <? if ($item->id == 1): ?> + <img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" alt="<?= t('denied icon')->for_html_attr() ?>" title="<?= t('denied')->for_html_attr() ?>"/> + <? else: ?> + <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('denied, click to reset')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" alt="<?= t('denied icon')->for_html_attr() ?>" /> + </a> + <? endif ?> + </td> + <? elseif ($intent === access::ALLOW): ?> + <td class="g-allowed"> + <? if ($item->id == 1): ?> + <img src="<?= url::file(gallery::find_file("images", "ico-success.png")) ?>" title="<?= t("allowed")->for_html_attr() ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> + <? else: ?> + <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('allowed, click to reset')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-success.png")) ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> + </a> + <? endif ?> + <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" + title="<?= t('click to deny')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-denied-inactive.png")) ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> + </a> + </td> + <? endif ?> + <? endif ?> + </td> + <? endforeach ?> + </tr> + <? endforeach ?> + </table> +</fieldset> diff --git a/modules/gallery/views/quick_delete_confirm.html.php b/modules/gallery/views/quick_delete_confirm.html.php new file mode 100644 index 0000000..176ffb9 --- /dev/null +++ b/modules/gallery/views/quick_delete_confirm.html.php @@ -0,0 +1,12 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div class="ui-helper-clearfix"> + <p> + <? if ($item->is_album()): ?> + <?= t("Delete the album <b>%title</b>? All photos and movies in the album will also be deleted.", + array("title" => html::purify($item->title))) ?> + <? else: ?> + <?= t("Are you sure you want to delete <b>%title</b>?", array("title" => html::purify($item->title))) ?> + <? endif ?> + </p> + <?= $form ?> +</div> diff --git a/modules/gallery/views/reauthenticate.html.php b/modules/gallery/views/reauthenticate.html.php new file mode 100644 index 0000000..9a6696f --- /dev/null +++ b/modules/gallery/views/reauthenticate.html.php @@ -0,0 +1,15 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div> + <p> + <?= t("The administration session has expired, please re-authenticate to access the administration area.") ?> + </p> + <p> + <?= t("You are currently logged in as %user_name.", array("user_name" => $user_name)) ?> + </p> + <?= $form ?> + <script type="text/javascript"> + $("#g-reauthenticate-form").ready(function() { + $("#g-password").focus(); + }); + </script> +</div>
\ No newline at end of file diff --git a/modules/gallery/views/upgrade_checker_block.html.php b/modules/gallery/views/upgrade_checker_block.html.php new file mode 100644 index 0000000..c984d99 --- /dev/null +++ b/modules/gallery/views/upgrade_checker_block.html.php @@ -0,0 +1,55 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<p> + <?= t("Gallery can check to see if there is a new version available for you to use. It is a good idea to upgrade your Gallery to get the latest features and security fixes. Your privacy is important so no information about your Gallery is shared during this process. You can disable this feature below.") ?> +</p> + +<p> + <? if (gallery::RELEASE_CHANNEL == "release"): ?> + <?= t("You are using the official Gallery %version release, code named <i>%code_name</i>.", array("version" => gallery::VERSION, "code_name" => gallery::CODE_NAME)) ?> + <? elseif (isset($build_number)): ?> + <?= t("You are using an experimental snapshot of Gallery %version (build %build_number on branch %branch).", array("version" => gallery::VERSION, "branch" => gallery::RELEASE_BRANCH, "build_number" => $build_number)) ?> + <? else: ?> + <?= t("You are using an experimental snapshot of Gallery %version (branch %branch) but your gallery3/.build_number file is missing so we don't know what build you have. You should probably upgrade so that you have that file.", array("version" => gallery::VERSION, "branch" => gallery::RELEASE_BRANCH, "build_number" => $build_number)) ?> + <? endif ?> +</p> + +<? if ($new_version): ?> +<ul class="g-message-block"> + <li class="g-message g-info"> + <?= $new_version ?> + </li> +</ul> +<? endif ?> + +<p> + <a class="g-button ui-state-default ui-corner-all" + href="<?= url::site("admin/upgrade_checker/check_now?csrf=$csrf") ?>"> + <?= t("Check now") ?> + </a> + <? if ($auto_check_enabled): ?> + <a class="g-button ui-state-default ui-corner-all" + href="<?= url::site("admin/upgrade_checker/set_auto/0?csrf=$csrf") ?>"> + <?= t("Disable automatic checking") ?> + </a> + <? else: ?> + <a class="g-button ui-state-default ui-corner-all" + href="<?= url::site("admin/upgrade_checker/set_auto/1?csrf=$csrf") ?>"> + <?= t("Enable automatic checking") ?> + </a> + <? endif ?> +</p> + +<p class="g-text-small"> + <? if ($auto_check_enabled): ?> + <?= t("Automatic upgrade checking is enabled.") ?> + <? else: ?> + <?= t("Automatic upgrade checking is disabled.") ?> + <? endif ?> + <? if (!$version_info): ?> + <?= t("No upgrade checks have been made yet.") ?> + <? else: ?> + <?= t("The last upgrade check was made on %date.", + array("date" => gallery::date_time($version_info->timestamp))) ?> + <? endif ?> +</p> + diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php new file mode 100644 index 0000000..4c611f7 --- /dev/null +++ b/modules/gallery/views/upgrader.html.php @@ -0,0 +1,163 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> + <head> + <title><?= t("Gallery 3 upgrader") ?></title> + <link rel="stylesheet" type="text/css" href="<?= url::file("modules/gallery/css/upgrader.css") ?>" + media="screen,print,projection" /> + <script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script> + </head> + <body<? if (locales::is_rtl()) { echo ' class="rtl"'; } ?>> + <div id="outer"> + <img id="logo" src="<?= url::file("modules/gallery/images/gallery.png") ?>" /> + <div id="inner"> + <? if ($can_upgrade): ?> + <div id="dialog" style="visibility: hidden"> + <a id="dialog_close_link" style="display: none" onclick="$('#dialog').fadeOut(); return false;" href="#" class="close">[x]</a> + <div id="busy" style="display: none"> + <h1> + <img width="16" height="16" src="<?= url::file("themes/wind/images/loading-small.gif") ?>"/> + <?= t("Upgrade in progress!") ?> + </h1> + <p> + <?= t("Please don't refresh or leave the page.") ?> + </p> + </div> + <div id="done" style="display: none"> + <h1> <?= t("That's it!") ?> </h1> + <p> + <?= t("Your Gallery is up to date.<br/><a href=\"%url\">Return to your Gallery</a>", + array("url" => html::mark_clean(url::base()))) ?> + </p> + </div> + <div id="failed" style="display: none"> + <h1> <?= t("Some modules failed to upgrade!") ?> </h1> + <p> + <?= t("Failed modules are <span class=\"failed\">highlighted</span>. Try getting newer versions or <a href=\"%admin_modules\">deactivating those modules</a>.", array("admin_modules" => url::site("admin/modules"))) ?> + </p> + </div> + </div> + <script type="text/javascript"> + $(document).ready(function() { + $("#dialog").css("left", Math.round(($(window).width() - $("#dialog").width()) / 2)); + $("#dialog").css("top", Math.round(($(window).height() - $("#dialog").height()) / 2)); + $("#upgrade_link").click(function(event) { show_busy() }); + + <? if ($done): ?> + show_done(); + <? endif ?> + + <? if ($failed): ?> + show_failed(); + <? endif ?> + }); + + var show_busy = function() { + $("#dialog").css("visibility", "visible"); + $("#busy").show(); + $("#upgrade_link").parent().removeClass("button-active"); + $("#upgrade_link").replaceWith($("#upgrade_link").html()) + } + + var show_done = function() { + $("#dialog").css("visibility", "visible"); + $("#done").show(); + $("#dialog_close_link").show(); + } + + var show_failed = function() { + $("#dialog").css("visibility", "visible"); + $("#failed").show(); + $("#dialog_close_link").show(); + } + </script> + <div id="welcome_message"> + <p class="<?= $done ? "muted" : "" ?>"> + <?= t("Welcome to the Gallery upgrader. One click and you're done!") ?> + </p> + </div> + + <? if ($done): ?> + <div id="upgrade_button" class="button muted"> + <?= t("Upgrade all") ?> + </div> + <? else: ?> + <div id="upgrade_button" class="button button-active"> + <a id="upgrade_link" href="<?= url::site("upgrader/upgrade?csrf=" . access::csrf_token()) ?>"> + <?= t("Upgrade all") ?> + </a> + </div> + <? endif ?> + + <? if ($obsolete_modules_message): ?> + <div id="obsolete_modules_message"> + <p> + <span class="failed"><?= t("Warning!") ?></span> + <?= $obsolete_modules_message ?> + </p> + </div> + <? endif ?> + + <table> + <tr class="<?= $done ? "muted" : "" ?>"> + <th class="name"> <?= t("Module name") ?> </th> + <th> <?= t("Installed version") ?> </th> + <th> <?= t("Available version") ?> </th> + </tr> + + <? foreach ($available as $id => $module): ?> + <? if ($module->active): ?> + <tr class="<?= $module->version == $module->code_version ? "current" : "upgradeable" ?> <?= in_array($id, $failed) ? "failed" : "" ?>" > + <td class="name <?= $id ?>"> + <?= t($module->name) ?> + </td> + <td> + <?= $module->version ?> + </td> + <td> + <?= $module->code_version ?> + </td> + </tr> + <? else: ?> + <? @$inactive++ ?> + <? endif ?> + <? endforeach ?> + </table> + + <? if (@$inactive): ?> + <p class="<?= $done ? "muted" : "" ?>"> + <?= t("The following modules are inactive and don't require an upgrade.") ?> + </p> + <ul class="<?= $done ? "muted" : "" ?>"> + <? foreach ($available as $module): ?> + <? if (!$module->active): ?> + <li> + <?= t($module->name) ?> + </li> + <? endif ?> + <? endforeach ?> + </ul> + <? endif ?> + <? else: // can_upgrade ?> + <h1> <?= t("Who are you?") ?> </h1> + <p> + <?= t("You're not logged in as an administrator, so we have to verify you to make sure it's ok for you to do an upgrade. To prove you can run an upgrade, create a file called <b> %name </b> in your <b>%tmp_dir_path</b> directory.", + array("name" => "$upgrade_token", + "tmp_dir_path" => "gallery3/var/tmp")) ?> + </p> + <a href="<?= url::site("upgrader?") ?>"><?= t("Ok, I've done that") ?></a> + <? endif // can_upgrade ?> + </div> + <div id="footer"> + <p> + <em> + <?= t("Did something go wrong? Try the <a href=\"%faq_url\">FAQ</a> or ask in the <a href=\"%forums_url\">Gallery forums</a>.", + array("faq_url" => "http://codex.galleryproject.org/Gallery3:FAQ", + "forums_url" => "http://galleryproject.org/forum")) ?> + </em> + </p> + </div> + </div> + </body> +</html> diff --git a/modules/gallery/views/user_languages_block.html.php b/modules/gallery/views/user_languages_block.html.php new file mode 100644 index 0000000..3776ca1 --- /dev/null +++ b/modules/gallery/views/user_languages_block.html.php @@ -0,0 +1,19 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<?= form::dropdown("g-select-session-locale", $installed_locales, $selected) ?> +<script type="text/javascript"> + $("select[name=g-select-session-locale]").change(function() { + var old_locale_preference = <?= html::js_string($selected) ?>; + var locale = $(this).val(); + if (old_locale_preference == locale) { + return; + } + + var expires = -1; + if (locale) { + expires = 365; + } + $.cookie("g_locale", locale, {"expires": expires, "path": "/"}); + window.location.reload(true); + }); +</script> + diff --git a/modules/gallery/views/user_profile.html.php b/modules/gallery/views/user_profile.html.php new file mode 100644 index 0000000..257bd7c --- /dev/null +++ b/modules/gallery/views/user_profile.html.php @@ -0,0 +1,47 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + $(document).ready(function() { + $("#g-profile-return").click(function(event) { + history.go(-1); + return false; + }) + }); +</script> +<div id="g-user-profile"> + <div class="ui-helper-clearfix"> + <a id="g-profile-return" class="g-button g-right ui-state-default ui-corner-all" href="#"> + <?= t("Return") ?> + </a> + <? if ($editable): ?> + <a class="g-button g-right ui-state-default ui-corner-all g-dialog-link" href="<?= url::site("users/form_change_email/{$user->id}") ?>"> + <?= t("Change email") ?> + </a> + <a class="g-button g-right ui-state-default ui-corner-all g-dialog-link" href="<?= url::site("users/form_change_password/{$user->id}") ?>"> + <?= t("Change password") ?> + </a> + <a class="g-button g-right ui-state-default ui-corner-all g-dialog-link" href="<?= url::site("form/edit/users/{$user->id}") ?>"> + <?= t("Edit") ?> + </a> + <? endif ?> + <? if ($contactable): ?> + <a class="g-button g-right ui-state-default ui-corner-all g-dialog-link" + href="<?= url::site("user_profile/contact/{$user->id}") ?>"> + <?= t("Contact") ?> + </a> + <? endif ?> + </div> + <h1> + <img src="<?= $user->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>" + alt="<?= html::clean_attribute($user->display_name()) ?>" + class="g-avatar g-left" width="40" height="40" /> + <?= t("User profile: %name", array("name" => $user->display_name())) ?> + </h1> + <? foreach ($info_parts as $info): ?> + <div class="g-block"> + <h2><?= html::purify($info->title) ?></h2> + <div class="g-block-content"> + <?= $info->view ?> + </div> + </div> + <? endforeach ?> +</div> diff --git a/modules/gallery/views/user_profile_info.html.php b/modules/gallery/views/user_profile_info.html.php new file mode 100644 index 0000000..e559abd --- /dev/null +++ b/modules/gallery/views/user_profile_info.html.php @@ -0,0 +1,9 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<table> + <? foreach ($user_profile_data as $label => $value): ?> + <tr> + <th><?= html::clean($label) ?></th> + <td><?= html::purify($value) ?></td> + </tr> + <? endforeach ?> +</table> diff --git a/modules/gallery/views/welcome_message.html.php b/modules/gallery/views/welcome_message.html.php new file mode 100644 index 0000000..bb6b4a8 --- /dev/null +++ b/modules/gallery/views/welcome_message.html.php @@ -0,0 +1,36 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="g-welcome-message"> + <h1 style="display: none"> + <?= t("Welcome to Gallery 3!") ?> + </h1> + + <p> + <h2> + <?= t("Congratulations on choosing Gallery to host your photos. You're going to have a great experience!") ?> + </h2> + </p> + + <p> + <?= t("First things first. You're logged in to the <b>%user_name</b> account. You should change your password to something that you'll remember.", array("user_name" => $user->name)) ?> + </p> + + <p> + <a href="<?= url::site("admin/users/edit_user_form/{$user->id}") ?>" + title="<?= t("Edit your profile")->for_html_attr() ?>" + id="g-after-install-change-password-link" + class="g-button ui-state-default ui-corner-all"> + <?= t("Change password and email now") ?> + </a> + <script type="text/javascript"> + $("#g-after-install-change-password-link").gallery_dialog(); + </script> + </p> + + <p> + <?= t("Want to learn more? The <a href=\"%url\">Gallery website</a> has news and information about the Gallery project and community.", array("url" => "http://galleryproject.org")) ?> + </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.galleryproject.org/Main_Page", "forum_url" => "http://galleryproject.org/forum")) ?> + </p> +</div> diff --git a/modules/gallery/views/welcome_message_loader.html.php b/modules/gallery/views/welcome_message_loader.html.php new file mode 100644 index 0000000..d1ff2f3 --- /dev/null +++ b/modules/gallery/views/welcome_message_loader.html.php @@ -0,0 +1,7 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<span id="g-welcome-message-link" + title="<?= t("Welcome to Gallery 3")->for_html_attr() ?>" + href="<?= url::site("welcome_message") ?>"/> +<script type="text/javascript"> + $(document).ready(function(){$("#g-welcome-message-link").gallery_dialog({immediate: true});}); +</script> |
