diff options
Diffstat (limited to 'modules/gallery/views')
31 files changed, 384 insertions, 250 deletions
diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php index b37c1c73..c3595da5 100644 --- a/modules/gallery/views/admin_advanced_settings.html.php +++ b/modules/gallery/views/admin_advanced_settings.html.php @@ -20,13 +20,13 @@ <? if ($var->module_name == "gallery" && $var->name == "_cache") continue ?> <tr class="setting"> <td> <?= $var->module_name ?> </td> - <td> <?= p::clean($var->name) ?> </td> + <td> <?= html::clean($var->name) ?> </td> <td> - <a href="<?= url::site("admin/advanced_settings/edit/$var->module_name/" . p::clean($var->name)) ?>" + <a href="<?= url::site("admin/advanced_settings/edit/$var->module_name/" . html::clean($var->name)) ?>" class="gDialogLink" - title="<?= t("Edit %var (%module_name)", array("var" => p::clean($var->name), "module_name" => $var->module_name)) ?>"> + title="<?= t("Edit %var (%module_name)", array("var" => $var->name, "module_name" => $var->module_name))->for_html_attr() ?>"> <? if ($var->value): ?> - <?= p::clean($var->value) ?> + <?= html::clean($var->value) ?> <? else: ?> <i> <?= t("empty") ?> </i> <? endif ?> diff --git a/modules/gallery/views/admin_block_log_entries.html.php b/modules/gallery/views/admin_block_log_entries.html.php index 44c1657f..780ff2d0 100644 --- a/modules/gallery/views/admin_block_log_entries.html.php +++ b/modules/gallery/views/admin_block_log_entries.html.php @@ -2,7 +2,7 @@ <ul> <? foreach ($entries as $entry): ?> <li class="<?= log::severity_class($entry->severity) ?>" style="direction: ltr"> - <a href="<?= url::site("user/$entry->user_id") ?>"><?= p::clean($entry->user->name) ?></a> + <a href="<?= url::site("user/$entry->user_id") ?>"><?= html::clean($entry->user->name) ?></a> <?= gallery::date_time($entry->timestamp) ?> <?= $entry->message ?> <?= $entry->html ?> diff --git a/modules/gallery/views/admin_block_photo_stream.html.php b/modules/gallery/views/admin_block_photo_stream.html.php index 1e1329d1..4968c39b 100644 --- a/modules/gallery/views/admin_block_photo_stream.html.php +++ b/modules/gallery/views/admin_block_photo_stream.html.php @@ -2,9 +2,9 @@ <ul> <? foreach ($photos as $photo): ?> <li class="gItem gPhoto"> - <a href="<?= url::site("photos/$photo->id") ?>" title="<?= p::clean($photo->title) ?>"> + <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="<?= p::clean($photo->title) ?>" /> + src="<?= $photo->thumb_url() ?>" alt="<?= html::purify($photo->title)->for_html_attr() ?>" /> </a> </li> <? endforeach ?> diff --git a/modules/gallery/views/admin_block_platform.html.php b/modules/gallery/views/admin_block_platform.html.php index 6b79f047..f27b9e7a 100644 --- a/modules/gallery/views/admin_block_platform.html.php +++ b/modules/gallery/views/admin_block_platform.html.php @@ -1,7 +1,10 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <ul> <li> - <?= t("Operating System: %operating_system", array("operating_system" => PHP_OS)) ?> + <?= 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"))) ?> diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php index 38d2bd56..d8c96187 100644 --- a/modules/gallery/views/admin_block_welcome.html.php +++ b/modules/gallery/views/admin_block_welcome.html.php @@ -5,16 +5,16 @@ <ul> <li> <?= t("General Settings - choose your <a href=\"%graphics_url\">graphics</a> and <a href=\"%language_url\">language</a> settings.", - array("graphics_url" => url::site("admin/graphics"), - "language_url" => url::site("admin/languages"))) ?> + 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" => url::site("admin/themes"), - "theme_options_url" => url::site("admin/theme_options"))) ?> + 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" => url::site("admin/modules"))) ?> + 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 index a2d22ab6..148de65f 100644 --- a/modules/gallery/views/admin_dashboard.html.php +++ b/modules/gallery/views/admin_dashboard.html.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <script type="text/javascript"> update_blocks = function() { - $.get("<?= url::site("admin/dashboard/reorder") ?>", + $.get(<?= html::js_string(url::site("admin/dashboard/reorder")) ?>, {"csrf": "<?= $csrf ?>", "dashboard_center[]": $("#gAdminDashboard").sortable( "toArray", {attribute: "block_id"}), diff --git a/modules/gallery/views/admin_graphics.html.php b/modules/gallery/views/admin_graphics.html.php index 08374471..f64c7f80 100644 --- a/modules/gallery/views/admin_graphics.html.php +++ b/modules/gallery/views/admin_graphics.html.php @@ -3,14 +3,14 @@ $(document).ready(function() { select_toolkit = function(el) { if (!$(this).hasClass("gUnavailable")) { - window.location = '<?= url::site("admin/graphics/choose/__TK__?csrf=$csrf") ?>' + window.location = <?= html::js_string(url::site("admin/graphics/choose/__TK__?csrf=$csrf")) ?> .replace("__TK__", $(this).attr("id")); } }; $("#gAdminGraphics div.gAvailable .gBlock").click(select_toolkit); }); - </script> + <div id="gAdminGraphics"> <h1> <?= t("Graphics Settings") ?> </h1> <p> @@ -18,11 +18,19 @@ </p> <h2> <?= t("Active Toolkit") ?> </h2> - <?= $active ?> + <? 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="gAvailable"> <h2> <?= t("Available Toolkits") ?> </h2> - <?= $available ?> + <? 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> diff --git a/modules/gallery/views/admin_graphics_gd.html.php b/modules/gallery/views/admin_graphics_gd.html.php index b77da8e3..010a31b4 100644 --- a/modules/gallery/views/admin_graphics_gd.html.php +++ b/modules/gallery/views/admin_graphics_gd.html.php @@ -1,29 +1,30 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<div id="gd" class="gBlock<?= $is_active ? " gSelected" : "" ?><?= $tk->gd["GD Version"] ? " gInstalledToolkit" : " gUnavailable" ?>"> +<div id="gd" class="gBlock<?= $is_active ? " gSelected" : "" ?><?= $tk->installed ? " gInstalledToolkit" : " gUnavailable" ?>"> <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->gd["GD Version"] && function_exists('imagerotate')): ?> - <p class="gSuccess"> - <?= t("You have GD version %version.", array("version" => $tk->gd["GD Version"])) ?> - </p> + <? if ($tk->installed && $tk->rotate): ?> + <div class="gModuleStatus gInfo"> + <?= t("You have GD version %version.", array("version" => $tk->version)) ?> + </div> <p> <a class="gButtonLink ui-state-default ui-corner-all"><?= t("Activate GD") ?></a> </p> - <? elseif ($tk->gd["GD Version"]): ?> - <p class="gWarning"> - <?= t("You have GD version %version, but it lacks image rotation.", - array("version" => $tk->gd["GD Version"])) ?> + <? elseif ($tk->installed): ?> + <? if ($tk->error): ?> + <p class="gModuleStatus gWarning"> + <?= $tk->error ?> </p> + <? endif ?> <p> <a class="gButtonLink ui-state-default ui-corner-all"><?= t("Activate GD") ?></a> </p> <? else: ?> - <p class="gInfo"> + <div class="gModuleStatus gInfo"> <?= t("You do not have GD installed.") ?> - </p> + </div> <? endif ?> </div> diff --git a/modules/gallery/views/admin_graphics_graphicsmagick.html.php b/modules/gallery/views/admin_graphics_graphicsmagick.html.php index e2cd0777..97624850 100644 --- a/modules/gallery/views/admin_graphics_graphicsmagick.html.php +++ b/modules/gallery/views/admin_graphics_graphicsmagick.html.php @@ -1,21 +1,21 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<div id="graphicsmagick" class="gBlock<?= $is_active ? " gSelected" : "" ?><?= $tk->graphicsmagick ? " gInstalledToolkit" : " gUnavailable" ?>"> - <h3> <?= t("GraphicsMagick") ?> </h3> +<div id="graphicsmagick" class="gBlock<?= $is_active ? " gSelected" : "" ?><?= $tk->installed ? " gInstalledToolkit" : " gUnavailable" ?>"> <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->graphicsmagick): ?> - <p class="gSuccess"> - <?= t("GraphicsMagick is available in %path", array("path" => $tk->graphicsmagick)) ?> - </p> + <? if ($tk->installed): ?> + <div class="gModuleStatus gInfo"> + <?= t("GraphicsMagick version %version is available in %dir", array("version" => $tk->version, "dir" => $tk->dir)) ?> + </div> <p> <a class="gButtonLink ui-state-default ui-corner-all"><?= t("Activate Graphics Magic") ?></a> </p> <? else: ?> - <p class="gInfo"> - <?= t("GraphicsMagick is not available on your system.") ?> - </p> + <div class="gModuleStatus gWarning"> + <?= $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 index 081ddc15..cdff7c2c 100644 --- a/modules/gallery/views/admin_graphics_imagemagick.html.php +++ b/modules/gallery/views/admin_graphics_imagemagick.html.php @@ -1,21 +1,21 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<div id="imagemagick" class="gBlock<?= $is_active ? " gSelected" : "" ?><?= $tk->imagemagick ? " gInstalledToolkit" : " gUnavailable" ?>"> - <h3> <?= t("ImageMagick") ?> </h3> +<div id="imagemagick" class="gBlock<?= $is_active ? " gSelected" : "" ?><?= $tk->installed ? " gInstalledToolkit" : " gUnavailable" ?>"> <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->imagemagick): ?> - <p class="gSuccess"> - <?= t("ImageMagick is available in %path", array("path" => $tk->imagemagick)) ?> - </p> + <? if ($tk->installed): ?> + <div class="gModuleStatus gInfo"> + <?= t("ImageMagick version %version is available in %dir", array("version" => $tk->version, "dir" => $tk->dir)) ?> + </div> <p> <a class="gButtonLink ui-state-default ui-corner-all"><?= t("Activate ImageMagick") ?></a> </p> - <? else: ?> - <p class="gInfo"> - <?= t("ImageMagick is not available on your system.") ?> - </p> + <? elseif ($tk->error): ?> + <div class="gModuleStatus gWarning"> + <?= $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 index 5306a70d..e6923a5a 100644 --- a/modules/gallery/views/admin_graphics_none.html.php +++ b/modules/gallery/views/admin_graphics_none.html.php @@ -1,7 +1,8 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<div id="none" class="gBlock"> - <h3 class="gWarning"> <?= t("No Active Toolkit") ?> </h3> + +<div id="none" class="gModuleStatus gWarning gBlock"> + <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 many Gallery features.") ?> + <?= 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 index f41694b4..fa97d299 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -1,15 +1,103 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <div id="gLanguages"> - <h2> <?= t("Languages") ?> </h2> + <h1> <?= t("Languages") ?> </h1> + <p> + <?= t("Install new languages, update installed ones and set the default language for your Gallery.") ?> + </p> - <?= $settings_form ?> + <form id="gLanguagesForm" method="post" action="<?= url::site("admin/languages/save") ?>"> + <?= access::csrf_form_field() ?> + <table> + <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 == (count($available_locales)/2)): ?> + <table> + <tr> + <th> <?= t("Installed") ?> </th> + <th> <?= t("Language") ?> </th> + <th> <?= t("Default language") ?> </th> + </tr> + <? endif ?> - <h2> <?= t("Download translations") ?> </h2> - <a href="<?= url::site("admin/maintenance/start/gallery_task::update_l10n?csrf=$csrf") ?>" - class="gDialogLink"> - <?= t("Get updates") ?> - </a> + <tr class="<?= (isset($installed_locales[$code])) ? "installed" : "" ?><?= ($default_locale == $code) ? " default" : "" ?>"> + <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++ ?> - <h2> <?= t("Your Own Translations") ?> </h2> + <? endforeach ?> + </table> + <input type="submit" value="<?= t("Update languages")->for_html_attr() ?>" /> + </form> + + <script type="text/javascript"> + var old_default_locale = <?= html::js_string($default_locale) ?>; + + $("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"); + } + }); + + $("#gLanguagesForm").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> + +<div id="gTranslations"> + <h1> <?= t("Translations") ?> </h1> + <p> + <?= t("Create your own translations and share them with the rest of the Gallery community.") ?> + </p> + + <h3><?= t("Translating Gallery") ?></h3> + + <div class="gBlock"> + <a href="http://codex.gallery2.org/Gallery3:Localization" target="_blank" + class="gDocLink ui-state-default ui-corner-all ui-icon ui-icon-help" + title="<?= t("Localization documentation")->for_html_attr() ?>"> + <?= t("Localization documentation") ?> + </a> + + <p><?= t("<strong>Step 1:</strong> Make sure the target language is installed and up to date (check above).") ?></p> + + <p><?= t("<strong>Step 2:</strong> Make sure you have selected the right target language (currently %default_locale).", + array("default_locale" => locales::display_name())) ?></p> + + <p><?= t("<strong>Step 3:</strong> Start the translation mode and the translation interface will appear at the bottom of each Gallery page.") ?></p> + + <a href="<?= url::site("l10n_client/toggle_l10n_mode?csrf=".access::csrf_token()) ?>" + class="gButtonLink 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> +</div> + +<h3>Sharing your translations</h3> <?= $share_translations_form ?> </div> diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php index 450eb754..ce693d73 100644 --- a/modules/gallery/views/admin_maintenance.html.php +++ b/modules/gallery/views/admin_maintenance.html.php @@ -19,9 +19,10 @@ <?= t("Action") ?> </th> </tr> + <? $i = 0; ?> <? foreach ($task_definitions as $task): ?> - <tr class="<?= log::severity_class($task->severity) ?>"> - <td> + <tr class="<?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?> <?= log::severity_class($task->severity) ?>"> + <td class="<?= log::severity_class($task->severity) ?>"> <?= $task->name ?> </td> <td> @@ -34,6 +35,7 @@ </a> </td> </tr> + <? $i++ ?> <? endforeach ?> </table> </div> @@ -41,10 +43,6 @@ <? if ($running_tasks->count()): ?> <div id="gRunningTasks"> <h2> <?= t("Running Tasks") ?> </h2> - <a href="<?= url::site("admin/maintenance/cancel_running_tasks?csrf=$csrf") ?>" - class="gButtonLink ui-icon-left ui-state-default ui-corner-all right"> - <?= t("cancel all") ?></a> - <table> <tr> <th> @@ -64,11 +62,15 @@ </th> <th> <?= t("Action") ?> + <a href="<?= url::site("admin/maintenance/cancel_running_tasks?csrf=$csrf") ?>" + class="gButtonLink ui-icon-left ui-state-default ui-corner-all right"> + <?= t("cancel all") ?></a> </th> </tr> + <? $i = 0; ?> <? foreach ($running_tasks as $task): ?> - <tr class="<?= $task->state == "stalled" ? "gWarning" : "" ?>"> - <td> + <tr class="<?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?> <?= $task->state == "stalled" ? "gWarning" : "" ?>"> + <td class="<?= $task->state == "stalled" ? "gWarning" : "" ?>"> <?= gallery::date_time($task->updated) ?> </td> <td> @@ -90,7 +92,7 @@ <?= $task->status ?> </td> <td> - <?= p::clean($task->owner()->name) ?> + <?= html::clean($task->owner()->name) ?> </td> <td> <? if ($task->state == "stalled"): ?> @@ -105,6 +107,7 @@ </a> </td> </tr> + <? $i++ ?> <? endforeach ?> </table> </div> @@ -112,10 +115,6 @@ <? if ($finished_tasks->count()): ?> <div id="gFinishedTasks"> - <a href="<?= url::site("admin/maintenance/remove_finished_tasks?csrf=$csrf") ?>" - class="gButtonLink ui-icon-left ui-state-default ui-corner-all right"> - <span class="ui-icon ui-icon-trash"></span><?= t("remove all finished") ?></a> - <h2> <?= t("Finished Tasks") ?> </h2> <table> <tr> @@ -136,11 +135,15 @@ </th> <th> <?= t("Action") ?> + <a href="<?= url::site("admin/maintenance/remove_finished_tasks?csrf=$csrf") ?>" + class="gButtonLink ui-icon-left ui-state-default ui-corner-all right"> + <span class="ui-icon ui-icon-trash"></span><?= t("remove all finished") ?></a> </th> </tr> + <? $i = 0; ?> <? foreach ($finished_tasks as $task): ?> - <tr class="<?= $task->state == "success" ? "gSuccess" : "gError" ?>"> - <td> + <tr class="<?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?> <?= $task->state == "success" ? "gSuccess" : "gError" ?>"> + <td class="<?= $task->state == "success" ? "gSuccess" : "gError" ?>"> <?= gallery::date_time($task->updated) ?> </td> <td> @@ -159,7 +162,7 @@ <?= $task->status ?> </td> <td> - <?= $task->owner()->name ?> + <?= html::clean($task->owner()->name) ?> </td> <td> <? if ($task->done): ?> @@ -183,6 +186,7 @@ </td> </tr> <? endforeach ?> + <? $i++ ?> </table> </div> <? endif ?> diff --git a/modules/gallery/views/admin_maintenance_show_log.html.php b/modules/gallery/views/admin_maintenance_show_log.html.php index 9d850986..8ea1beb6 100644 --- a/modules/gallery/views/admin_maintenance_show_log.html.php +++ b/modules/gallery/views/admin_maintenance_show_log.html.php @@ -12,7 +12,7 @@ appendTo('body').submit().remove(); <div id="gTaskLogDialog"> <h1> <?= $task->name ?> </h1> <div class="gTaskLog"> - <pre><?= p::purify($task->get_log()) ?></pre> + <pre><?= html::purify($task->get_log()) ?></pre> </div> <button id="gCloseButton" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Close") ?></button> <button id="gSaveButton" class="ui-state-default ui-corner-all" onclick="download()"><?= t("Save") ?></button> diff --git a/modules/gallery/views/admin_maintenance_task.html.php b/modules/gallery/views/admin_maintenance_task.html.php index 5c2c03a1..ddd5bd17 100644 --- a/modules/gallery/views/admin_maintenance_task.html.php +++ b/modules/gallery/views/admin_maintenance_task.html.php @@ -1,11 +1,40 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <script type="text/javascript"> + var target_value; + var animation = null; + var delta = 1; + animate_progress_bar = function() { + var current_value = parseInt($(".gProgressBar 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) { + $(".gProgressBar").progressbar("value", 100); + } else if (current_value != target_value || delta != 1) { + var new_value = Math.min(current_value + delta, target_value); + $(".gProgressBar").progressbar("value", new_value); + animation = setTimeout(function() { animate_progress_bar(target_value); }, 100); + } else { + animation = null; + delta = 1; + } + $.fn.gallery_hover_init(); + } + update = function() { $.ajax({ - url: "<?= url::site("admin/maintenance/run/$task->id?csrf=$csrf") ?>", + url: <?= html::js_string(url::site("admin/maintenance/run/$task->id?csrf=$csrf")) ?>, dataType: "json", success: function(data) { - $(".gProgressBar").progressbar("value", data.task.percent_complete); + target_value = data.task.percent_complete; + if (!animation) { + animate_progress_bar(); + } $("#gStatus").html("" + data.task.status); if (data.task.done) { $("#gPauseButton").hide(); @@ -28,7 +57,7 @@ <div id="gStatus"> <?= t("Starting up...") ?> </div> - <div> + <div class="txtright"> <button id="gPauseButton" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Pause") ?></button> <button id="gDoneButton" class="ui-state-default ui-corner-all" style="display: none" onclick="dismiss()"><?= t("Close") ?></button> </div> diff --git a/modules/gallery/views/admin_modules.html.php b/modules/gallery/views/admin_modules.html.php index 3fddd6cd..9cf03cb3 100644 --- a/modules/gallery/views/admin_modules.html.php +++ b/modules/gallery/views/admin_modules.html.php @@ -16,7 +16,7 @@ </tr> <? $i = 0 ?> <? foreach ($available as $module_name => $module_info): ?> - <tr class="<?= ($i % 2 == 0) ? "gEvenRow" : "gOddRow" ?>"> + <tr class="<?= ($i % 2 == 0) ? "gOddRow" : "gEvenRow" ?>"> <? $data = array("name" => $module_name); ?> <? if ($module_info->locked) $data["disabled"] = 1; ?> <td> <?= form::checkbox($data, '1', module::is_active($module_name)) ?> </td> @@ -27,6 +27,6 @@ <? $i++ ?> <? endforeach ?> </table> - <input type="submit" value="<?= t("Update") ?>"/> + <input type="submit" value="<?= t("Update")->for_html_attr() ?>"/> </form> </div> diff --git a/modules/gallery/views/admin_themes.html.php b/modules/gallery/views/admin_themes.html.php index dc13a6a0..0aac4717 100644 --- a/modules/gallery/views/admin_themes.html.php +++ b/modules/gallery/views/admin_themes.html.php @@ -16,7 +16,7 @@ <h2> <?= t("Gallery theme") ?> </h2> <div class="gBlock gSelected"> <img src="<?= url::file("themes/{$site}/thumbnail.png") ?>" - alt="<?= $themes[$site]->name ?>" /> + alt="<?= html::clean_attribute($themes[$site]->name) ?>" /> <h3> <?= $themes[$site]->name ?> </h3> <p> <?= $themes[$site]->description ?> @@ -30,9 +30,9 @@ <? if (!$info->site) continue ?> <? if ($id == $site) continue ?> <div class="gBlock"> - <a href="<?= url::site("admin/themes/preview/site/$id") ?>" class="gDialogLink" title="<?= t("Theme Preview: %theme_name", array("theme_name" => $info->name)) ?>"> + <a href="<?= url::site("admin/themes/preview/site/$id") ?>" class="gDialogLink" title="<?= t("Theme Preview: %theme_name", array("theme_name" => $info->name))->for_html_attr() ?>"> <img src="<?= url::file("themes/{$id}/thumbnail.png") ?>" - alt="<?= $info->name ?>" /> + alt="<?= html::clean_attribute($info->name) ?>" /> <h3> <?= $info->name ?> </h3> <p> <?= $info->description ?> @@ -54,7 +54,7 @@ <h2> <?= t("Admin theme") ?> </h2> <div class="gBlock gSelected"> <img src="<?= url::file("themes/{$admin}/thumbnail.png") ?>" - alt="<?= $themes[$admin]->name ?>" /> + alt="<?= html::clean_attribute($themes[$admin]->name) ?>" /> <h3> <?= $themes[$admin]->name ?> </h3> <p> <?= $themes[$admin]->description ?> @@ -68,9 +68,9 @@ <? if (!$info->admin) continue ?> <? if ($id == $admin) continue ?> <div class="gBlock"> - <a href="<?= url::site("admin/themes/preview/admin/$id") ?>" class="gDialogLink" title="<?= t("Theme Preview: %theme_name", array("theme_name" => $info->name)) ?>"> + <a href="<?= url::site("admin/themes/preview/admin/$id") ?>" class="gDialogLink" title="<?= t("Theme Preview: %theme_name", array("theme_name" => $info->name))->for_html_attr() ?>"> <img src="<?= url::file("themes/{$id}/thumbnail.png") ?>" - alt="<?= $info->name ?>" /> + alt="<?= html::clean_attribute($info->name) ?>" /> <h3> <?= $info->name ?> </h3> <p> <?= $info->description ?> diff --git a/modules/gallery/views/after_install.html.php b/modules/gallery/views/after_install.html.php deleted file mode 100644 index d6ba8e7c..00000000 --- a/modules/gallery/views/after_install.html.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<h1 style="display: none"> - <?= t("Welcome to Gallery 3!") ?> -</h1> - -<p> - <?= t("Congratulations on choosing Gallery to host your photos. We're confident that you're going to have a great experience.") ?> -</p> - -<p> - <?= t("You're logged in to the <b>%user_name</b> account. The very first thing you should do is to change your password to something that you'll remember.", array("user_name" => p::clean($user->name))) ?> -</p> - -<p> - <a href="<?= url::site("form/edit/users/{$user->id}") ?>" - title="<?= t("Edit Your Profile") ?>" - id="gAfterInstallChangePasswordLink" class="gButtonLink ui-state-default ui-corners-all"><?= t("Change Password Now") ?></a> - <script> - $("#gAfterInstallChangePasswordLink").bind("click", handleDialogEvent); - </script> -</p> - -<p> - <?= t("Want to learn more? The <a href=\"%url\">Gallery website</a> has news and information about Gallery Project and community.", array("url" => "http://gallery.menalto.com")) ?> -</p> - -<p> - <?= t("Having problems? There's lots of information in our <a href=\"%codex_url\">documentation site</a> or you can <a href=\"%forum_url\">ask for help in the forums!</a>", array("codex_url" => "http://codex.gallery2.org/Main_Page", "forum_url" => "http://gallery.menalto.com/forum")) ?> -</ul> diff --git a/modules/gallery/views/after_install_loader.html.php b/modules/gallery/views/after_install_loader.html.php deleted file mode 100644 index baf91eed..00000000 --- a/modules/gallery/views/after_install_loader.html.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<span id="gAfterInstall" - title="<?= t("Welcome to Gallery 3") ?>" - href="<?= url::site("after_install") ?>"/> -<script type="text/javascript"> - $(document).ready(function(){openDialog($("#gAfterInstall"));}); -</script> diff --git a/modules/gallery/views/form.html.php b/modules/gallery/views/form.html.php index ec2a56a9..730d77cb 100644 --- a/modules/gallery/views/form.html.php +++ b/modules/gallery/views/form.html.php @@ -40,6 +40,8 @@ if (!function_exists("DrawForm")) { 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=\"gError\">\n"; diff --git a/modules/gallery/views/l10n_client.html.php b/modules/gallery/views/l10n_client.html.php index c0cbbfa2..b0f424be 100644 --- a/modules/gallery/views/l10n_client.html.php +++ b/modules/gallery/views/l10n_client.html.php @@ -1,7 +1,11 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <div id="l10n-client" class="hidden"> <div class="labels"> - <span id="l10n-client-toggler">X</span> + <span id="l10n-client-toggler"> + <a id="gMinimizeL10n">_</a> + <a id="gCloseL10n" 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> @@ -9,7 +13,7 @@ </h2></div> <div class="label source"><h2><?= t("Source") ?></div> <div class="label translation"><h2><?= t("Translation to %language", - array("language" => locale::display_name())) ?></h2></div> + array("language" => locales::display_name())) ?></h2></div> </div> <div id="l10n-client-string-select"> <ul class="string-list"> @@ -62,16 +66,17 @@ (<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") ?>"/> + <input type="submit" name="l10n-edit-save" value="<?= t("Save translation")->for_html_attr() ?>"/> <a href="javascript: Gallery.l10nClient.copySourceText()" class="gButtonLink 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") ?>"; - var MSG_CLOSE_X = "<?= t("X") ?>"; + 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/move_browse.html.php b/modules/gallery/views/move_browse.html.php index 4f69c0e9..99728ecc 100644 --- a/modules/gallery/views/move_browse.html.php +++ b/modules/gallery/views/move_browse.html.php @@ -42,6 +42,6 @@ <form method="post" action="<?= url::site("move/save/$source->id") ?>"> <?= access::csrf_form_field() ?> <input type="hidden" name="target_id" value="" /> - <input type="submit" id="gMoveButton" value="<?= t("Move") ?>" disabled="disabled"/> + <input type="submit" id="gMoveButton" value="<?= t("Move")->for_html_attr() ?>" disabled="disabled"/> </form> </div> diff --git a/modules/gallery/views/move_tree.html.php b/modules/gallery/views/move_tree.html.php index 5f70cf67..e629e1bb 100644 --- a/modules/gallery/views/move_tree.html.php +++ b/modules/gallery/views/move_tree.html.php @@ -1,18 +1,18 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <?= $parent->thumb_img(array(), 25); ?> -<? if (!access::can("edit", $parent) || $source->is_descendant($parent)): ?> -<a href="javascript:load_tree('<?= $parent->id ?>',1)"> <?= p::clean($parent->title) ?> <?= t("(locked)") ?> </a> +<? if (!access::can("edit", $parent) || $source->contains($parent)): ?> +<a href="javascript:load_tree('<?= $parent->id ?>',1)"> <?= html::clean($parent->title) ?> <?= t("(locked)") ?> </a> <? else: ?> -<a href="javascript:load_tree('<?= $parent->id ?>',0)"> <?= p::clean($parent->title) ?></a> +<a href="javascript:load_tree('<?= $parent->id ?>',0)"> <?= html::clean($parent->title) ?></a> <? endif ?> <ul id="tree_<?= $parent->id ?>"> <? foreach ($children as $child): ?> <li id="node_<?= $child->id ?>" class="node"> <?= $child->thumb_img(array(), 25); ?> - <? if (!access::can("edit", $child) || $source->is_descendant($child)): ?> - <a href="javascript:load_tree('<?= $child->id ?>',1)"> <?= p::clean($child->title) ?> <?= t("(locked)") ?></a> + <? if (!access::can("edit", $child) || $source->contains($child)): ?> + <a href="javascript:load_tree('<?= $child->id ?>',1)"> <?= html::clean($child->title) ?> <?= t("(locked)") ?></a> <? else: ?> - <a href="javascript:load_tree('<?= $child->id ?>',0)"> <?= p::clean($child->title) ?> </a> + <a href="javascript:load_tree('<?= $child->id ?>',0)"> <?= html::clean($child->title) ?> </a> <? endif ?> </li> <? endforeach ?> diff --git a/modules/gallery/views/movieplayer.html.php b/modules/gallery/views/movieplayer.html.php index e8cabd31..e9783eb8 100644 --- a/modules/gallery/views/movieplayer.html.php +++ b/modules/gallery/views/movieplayer.html.php @@ -1,15 +1,22 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <?= html::anchor($item->file_url(true), "", $attrs) ?> <script> - flowplayer("<?= $attrs["id"] ?>", "<?= url::abs_file("lib/flowplayer.swf") ?>", { - plugins: { - h264streaming: { - url: "<?= url::abs_file("lib/flowplayer.h264streaming.swf") ?>" - }, - controls: { - autoHide: 'always', - hideDelay: 2000 + flowplayer( + "<?= $attrs["id"] ?>", + { + src: "<?= url::abs_file("lib/flowplayer.swf") ?>", + wmode: "transparent" + }, + { + plugins: { + h264streaming: { + url: "<?= url::abs_file("lib/flowplayer.h264streaming.swf") ?>" + }, + controls: { + autoHide: 'always', + hideDelay: 2000 + } } } - }) + ) </script> diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php index 888a27f7..519734d6 100644 --- a/modules/gallery/views/permissions_browse.html.php +++ b/modules/gallery/views/permissions_browse.html.php @@ -5,8 +5,9 @@ $.ajax({ url: form_url.replace("__ITEM__", id), success: function(data) { - $("div.form").slideUp(); - $("div#edit-" + id).html(data).slideDown(); + $("#gEditPermissionForm").html(data); + $(".active").removeClass("active"); + $("#item-" + id).addClass("active"); } }); } @@ -18,7 +19,7 @@ url: action_url.replace("__CMD__", cmd).replace("__GROUP__", group_id). replace("__PERM__", perm_id).replace("__ITEM__", item_id), success: function(data) { - $("div#edit-" + item_id).load(form_url.replace("__ITEM__", item_id)); + $("#gEditPermissionForm").load(form_url.replace("__ITEM__", item_id)); } }); } @@ -27,30 +28,35 @@ <? if (!$htaccess_works): ?> <ul id="gMessage"> <li class="gError"> - <?= t("Oh no! Your server needs a configuration change in order for you to hide photos! Ask your server administrator to 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" => "href=\"http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html\" target=\"_blank\"", "apache_attrs" => "href=\"http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride\" target=\"_blank\"")) ?> + <?= 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 ?> - <ul> + + <p><?= t("Edit permissions for album:") ?></p> + + <ul class="gBreadcrumbs"> <? foreach ($parents as $parent): ?> - <li> + <li id="item-<?= $parent->id ?>"> + <? if (access::can("edit", $parent)): ?> <a href="javascript:show(<?= $parent->id ?>)"> - <?= p::clean($parent->title) ?> + <?= html::purify($parent->title) ?> + </a> + <? else: ?> + <?= html::purify($parent->title) ?> + <? endif ?> + </li> + <? endforeach ?> + <li class="active" id="item-<?= $item->id ?>"> + <a href="javascript:show(<?= $item->id ?>)"> + <?= html::purify($item->title) ?> </a> - <div class="form" id="edit-<?= $parent->id ?>"></div> - <ul> - <? endforeach ?> - <li> - <a href="javascript:show(<?= $item->id ?>)"> - <?= p::purify($item->title) ?> - </a> - <div class="form" id="edit-<?= $item->id ?>"> - <?= $form ?> - </div> - </li> - <? foreach ($parents as $parent): ?> - </ul> </li> </ul> - <? endforeach ?> + + <div id="gEditPermissionForm"> + <?= $form ?> + </div> </div> diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php index 0f60070a..a0bb35f2 100644 --- a/modules/gallery/views/permissions_form.html.php +++ b/modules/gallery/views/permissions_form.html.php @@ -6,7 +6,7 @@ <tr> <th> </th> <? foreach ($groups as $group): ?> - <th> <?= p::clean($group->name) ?> </th> + <th> <?= html::clean($group->name) ?> </th> <? endforeach ?> </tr> @@ -20,33 +20,33 @@ <? if ($lock): ?> <td class="gDenied"> - <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" title="<?= t('denied and locked through parent album') ?>" alt="<?= t('denied icon') ?>" /> - <a href="javascript:show(<?= $lock->id ?>)" title="<?= t('click to go to parent album') ?>"> - <img src="<?= url::file('themes/default/images/ico-lock.png') ?>" alt="<?= t('locked icon') ?>" /> + <img src="<?= url::file('themes/default/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('themes/default/images/ico-lock.png') ?>" alt="<?= t('locked icon')->for_html_attr() ?>" /> </a> </td> <? else: ?> - <? if ($intent === null): ?> + <? if ($intent === access::INHERIT): ?> <? if ($allowed): ?> <td class="gAllowed"> <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('allowed through parent album, click to allow explicitly') ?>"> - <img src="<?= url::file('themes/default/images/ico-success-pale.png') ?>" alt="<?= t('passive allowed icon') ?>" /> + title="<?= t('allowed through parent album, click to allow explicitly')->for_html_attr() ?>"> + <img src="<?= url::file('themes/default/images/ico-success-pale.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') ?>"> - <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon') ?>" /> + title="<?= t('click to deny')->for_html_attr() ?>"> + <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> </a> </td> <? else: ?> <td class="gDenied"> <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('click to allow') ?>"> - <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon') ?>" /> + title="<?= t('click to allow')->for_html_attr() ?>"> + <img src="<?= url::file('themes/default/images/ico-success-gray.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') ?>"> - <img src="<?= url::file('themes/default/images/ico-denied-pale.png') ?>" alt="<?= t('passive denied icon') ?>" /> + title="<?= t('denied through parent album, click to deny explicitly')->for_html_attr() ?>"> + <img src="<?= url::file('themes/default/images/ico-denied-pale.png') ?>" alt="<?= t('passive denied icon')->for_html_attr() ?>" /> </a> </td> <? endif ?> @@ -54,31 +54,31 @@ <? elseif ($intent === access::DENY): ?> <td class="gDenied"> <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('click to allow') ?>"> - <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon') ?>" /> + title="<?= t('click to allow')->for_html_attr() ?>"> + <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> </a> <? if ($item->id == 1): ?> - <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon') ?>" title="<?= t('denied') ?>"/> + <img src="<?= url::file('themes/default/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') ?>"> - <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon') ?>" /> + title="<?= t('denied, click to reset')->for_html_attr() ?>"> + <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon')->for_html_attr() ?>" /> </a> <? endif ?> </td> <? elseif ($intent === access::ALLOW): ?> <td class="gAllowed"> <? if ($item->id == 1): ?> - <img src="<?= url::file('themes/default/images/ico-success.png') ?>" title="<?= t("allowed") ?>" alt="<?= t('allowed icon') ?>" /> + <img src="<?= url::file('themes/default/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') ?>"> - <img src="<?= url::file('themes/default/images/ico-success.png') ?>" alt="<?= t('allowed icon') ?>" /> + title="<?= t('allowed, click to reset')->for_html_attr() ?>"> + <img src="<?= url::file('themes/default/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') ?>"> - <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon') ?>" /> + title="<?= t('click to deny')->for_html_attr() ?>"> + <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> </a> </td> <? endif ?> diff --git a/modules/gallery/views/quick_pane.html.php b/modules/gallery/views/quick_pane.html.php deleted file mode 100644 index eabf4a67..00000000 --- a/modules/gallery/views/quick_pane.html.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<? foreach ($button_list->main as $button): ?> -<a class="<?= $button->class ?> ui-corner-all ui-state-default" href="<?= $button->href ?>" - title="<?= $button->title ?>"> - <span class="ui-icon <?= $button->icon ?>"> - <?= $button->title ?> - </span> -</a> -<? endforeach ?> - -<? if (!empty($button_list->additional)): ?> -<a class="gButtonLink ui-corner-all ui-state-default options" href="#" title="<?= t("additional options") ?>"> - <span class="ui-icon ui-icon-triangle-1-s"> - <?= t("Additional options") ?> - </span> -</a> - -<ul id="gQuickPaneOptions" style="display: none"> - <? foreach ($button_list->additional as $button): ?> - <li><a class="<?= $button->class ?>" href="<?= $button->href ?>" - title="<?= $button->title ?>"> - <?= $button->title ?> - </a></li> - <? endforeach ?> -</ul> -<? endif ?> diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php index 38ac518c..7f8a96df 100644 --- a/modules/gallery/views/simple_uploader.html.php +++ b/modules/gallery/views/simple_uploader.html.php @@ -6,7 +6,7 @@ <!-- hack to set the title for the dialog --> <form id="gAddPhotosForm" action="<?= url::site("simple_uploader/finish?csrf=$csrf") ?>"> <fieldset> - <legend> <?= t("Add photos to %album_title", array("album_title" => p::purify($item->title))) ?> </legend> + <legend> <?= t("Add photos to %album_title", array("album_title" => html::purify($item->title))) ?> </legend> </fieldset> </form> @@ -26,16 +26,16 @@ </p> <ul class="gBreadcrumbs"> <? foreach ($item->parents() as $parent): ?> - <li> <?= p::clean($parent->title) ?> </li> + <li> <?= html::clean($parent->title) ?> </li> <? endforeach ?> - <li class="active"> <?= p::purify($item->title) ?> </li> + <li class="active"> <?= html::purify($item->title) ?> </li> </ul> <p> <span id="gUploadQueueInfo"> <?= t("Upload Queue") ?> </span> - <a id="gUploadCancel" title="<?= t("Cancel all the pending uploads") ?>" onclick="swfu.cancelQueue();"><?= t("cancel") ?></a> + <a id="gUploadCancel" title="<?= t("Cancel all the pending uploads")->for_html_attr() ?>" onclick="swfu.cancelQueue();"><?= t("cancel") ?></a> </p> <div id="gAddPhotosCanvas" style="text-align: center;"> <div id="gAddPhotosQueue"></div> @@ -82,27 +82,26 @@ <script type="text/javascript"> var swfu = new SWFUpload({ - flash_url: "<?= url::file("lib/swfupload/swfupload.swf") ?>", - upload_url: "<?= url::site("simple_uploader/add_photo/$item->id") ?>", - post_params: { - "g3sid": "<?= Session::instance()->id() ?>", - "user_agent": "<?= Input::instance()->server("HTTP_USER_AGENT") ?>", - "csrf": "<?= $csrf ?>" - }, - file_size_limit: "<?= ini_get("upload_max_filesize") ? num::convert_to_bytes(ini_get("upload_max_filesize"))."B" : "100MB" ?>", + flash_url: <?= html::js_string(url::file("lib/swfupload/swfupload.swf")) ?>, + upload_url: <?= html::js_string(url::site("simple_uploader/add_photo/$item->id")) ?>, + post_params: <?= json_encode(array( + "g3sid" => Session::instance()->id(), + "user_agent" => Input::instance()->server("HTTP_USER_AGENT"), + "csrf" => $csrf)) ?>, + file_size_limit: <?= html::js_string(ini_get("upload_max_filesize") ? num::convert_to_bytes(ini_get("upload_max_filesize"))."B" : "100MB") ?>, file_types: "*.gif;*.jpg;*.jpeg;*.png;*.flv;*.mp4;*.GIF;*.JPG;*.JPEG;*.PNG;*.FLV;*.MP4", - file_types_description: "<?= t("Photos and Movies") ?>", + file_types_description: <?= t("Photos and Movies")->for_js() ?>, file_upload_limit: 1000, file_queue_limit: 0, custom_settings: { }, debug: false, // Button settings - button_image_url: "<?= url::file("themes/default/images/select-photos-backg.png") ?>", + button_image_url: <?= html::js_string(url::file("themes/default/images/select-photos-backg.png")) ?>, button_width: "202", button_height: "45", button_placeholder_id: "gChooseFilesButtonPlaceholder", - button_text: '<span class="swfUploadFont"><?= t("Select photos...") ?></span>', + button_text: <?= json_encode('<span class="swfUploadFont">' . t("Select photos...") . '</span>') ?>, button_text_style: ".swfUploadFont { color: #2E6E9E; font-size: 16px; font-family: Lucida Grande,Lucida Sans,Arial,sans-serif; font-weight: bold; }", button_text_left_padding: 30, button_text_top_padding: 10, @@ -146,13 +145,13 @@ function file_queued(file) { var fp = new File_Progress(file); fp.title.html(file.name); - fp.set_status("pending", "<?= t("Pending...") ?>"); + fp.set_status("pending", <?= t("Pending...")->for_js() ?>); // @todo add cancel button to call this.cancelUpload(file.id) } function file_queue_error(file, error_code, message) { if (error_code === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) { - alert("<?= t("You have attempted to queue too many files.") ?>"); + alert(<?= t("You have attempted to queue too many files.")->for_js() ?>); return; } @@ -160,20 +159,20 @@ switch (error_code) { case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: fp.title.html(file.name); - fp.set_status("error", "<?= t("<strong>File is too big.</strong> A likely error source is a too low value for <em>upload_max_filesize</em> (%upload_max_filesize) in your <em>php.ini</em>.", array("upload_max_filesize" => ini_get("upload_max_filesize"))) ?>"); + fp.set_status("error", <?= t("<strong>File is too big.</strong> A likely error source is a too low value for <em>upload_max_filesize</em> (%upload_max_filesize) in your <em>php.ini</em>.", array("upload_max_filesize" => ini_get("upload_max_filesize")))->for_js() ?>); break; case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: fp.title.html(file.name); - fp.set_status("error", "<?= t("Cannot upload empty files.") ?>"); + fp.set_status("error", <?= t("Cannot upload empty files.")->for_js() ?>); break; case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: fp.title.html(file.name); - fp.set_status("error", "<?= t("Invalid file type.") ?>"); + fp.set_status("error", <?= t("Invalid file type.")->for_js() ?>); break; default: if (file !== null) { fp.title.html(file.name); - fp.set_status("error", "<?= t("Unknown error") ?>"); + fp.set_status("error", <?= t("Unknown error")->for_js() ?>); } break; } @@ -194,7 +193,7 @@ // no uploadProgress events are called (limitation in the Linux Flash VM). var fp = new File_Progress(file); fp.title.html(file.name); - fp.set_status("uploading", "<?= t("Uploading...") ?>"); + fp.set_status("uploading", <?= t("Uploading...")->for_js() ?>); $("#gAddPhotosCanvas").scrollTo(fp.box, 1000); return true; // @todo add cancel button to call this.cancelUpload(file.id) @@ -203,7 +202,7 @@ function upload_progress(file, bytes_loaded, bytes_total) { var percent = Math.ceil((bytes_loaded / bytes_total) * 100); var fp = new File_Progress(file); - fp.set_status("uploading", "<?= t("Uploading...") ?>"); + fp.set_status("uploading", <?= t("Uploading...")->for_js() ?>); fp.progress_bar.css("visibility", "visible"); fp.progress_bar.progressbar("value", percent); } @@ -211,42 +210,42 @@ function upload_success(file, serverData) { var fp = new File_Progress(file); fp.progress_bar.progressbar("value", 100); - fp.set_status("complete", "<?= t("Complete.") ?>"); + fp.set_status("complete", <?= t("Complete.")->for_js() ?>); } function upload_error(file, error_code, message) { var fp = new File_Progress(file); switch (error_code) { case SWFUpload.UPLOAD_ERROR.HTTP_ERROR: - fp.set_status("error", "<?= t("Upload error: ") ?>" + message); + fp.set_status("error", <?= t("Upload error: bad image file")->for_js() ?>); break; case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED: - fp.set_status("error", "<?= t("Upload failed") ?>"); + fp.set_status("error", <?= t("Upload failed")->for_js() ?>); break; case SWFUpload.UPLOAD_ERROR.IO_ERROR: - fp.set_status("error", "<?= t("Server error") ?>"); + fp.set_status("error", <?= t("Server error")->for_js() ?>); break; case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR: - fp.set_status("error", "<?= t("Security error") ?>"); + fp.set_status("error", <?= t("Security error")->for_js() ?>); break; case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: - fp.set_status("error", "<?= t("Upload limit exceeded") ?>"); + fp.set_status("error", <?= t("Upload limit exceeded")->for_js() ?>); break; case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED: - fp.set_status("error", "<?= t("Failed validation. File skipped") ?>"); + fp.set_status("error", <?= t("Failed validation. File skipped")->for_js() ?>); break; case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: // If there aren't any files left (they were all cancelled) disable the cancel button if (this.getStats().files_queued === 0) { $("#gUploadCancel").hide(); } - fp.set_status("error", "<?= t("Cancelled") ?>"); + fp.set_status("error", <?= t("Cancelled")->for_js() ?>); break; case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: - fp.set_status("error", "<?= t("Stopped") ?>"); + fp.set_status("error", <?= t("Stopped")->for_js() ?>); break; default: - fp.set_status("error", "<?= t("Unknown error: ") ?>" + error_code); + fp.set_status("error", <?= t("Unknown error: ")->for_js() ?> + error_code); break; } } @@ -260,7 +259,7 @@ } function get_completed_status_msg(stats) { - var msg = "<?= t("Upload Queue (completed %completed of %total)", array("completed" => "__COMPLETED__", "total" => "__TOTAL__")) ?>"; + var msg = <?= t("Upload Queue (completed %completed of %total)", array("completed" => "__COMPLETED__", "total" => "__TOTAL__"))->for_js() ?>; msg = msg.replace("__COMPLETED__", stats.successful_uploads); msg = msg.replace("__TOTAL__", stats.files_queued + stats.successful_uploads + stats.upload_errors + stats.upload_cancelled + stats.queue_errors); @@ -269,7 +268,7 @@ // This event comes from the Queue Plugin function queue_complete(num_files_uploaded) { - var status_msg = "<?= t("Uploaded: __COUNT__") ?>"; + var status_msg = <?= t("Uploaded: __COUNT__")->for_js() ?>; $("#gUploadStatus").html(status_msg.replace("__COUNT__", num_files_uploaded)); } </script> diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php index 37578855..5f93c2d5 100644 --- a/modules/gallery/views/upgrader.html.php +++ b/modules/gallery/views/upgrader.html.php @@ -18,7 +18,7 @@ <h1> <?= t("That's it!") ?> </h1> <p> <?= t("Your <a href=\"%url\">Gallery</a> is up to date.", - array("url" => url::site("albums/1"))) ?> + array("url" => html::mark_clean(item::root()->url()))) ?> </p> </div> </div> diff --git a/modules/gallery/views/welcome_message.html.php b/modules/gallery/views/welcome_message.html.php new file mode 100644 index 00000000..5515c3dc --- /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="gWelcomeMessage"> + <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("form/edit/users/{$user->id}") ?>" + title="<?= t("Edit Your Profile")->for_html_attr() ?>" + id="gAfterInstallChangePasswordLink" + class="gButtonLink ui-state-default ui-corners-all"> + <?= t("Change Password Now") ?> + </a> + <script> + $("#gAfterInstallChangePasswordLink").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://gallery.menalto.com")) ?> + </p> + + <p> + <?= t("Having problems? There's lots of information in our <a href=\"%codex_url\">documentation site</a> or you can <a href=\"%forum_url\">ask for help in the forums!</a>", array("codex_url" => "http://codex.gallery2.org/Main_Page", "forum_url" => "http://gallery.menalto.com/forum")) ?> + </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 00000000..2c6bffca --- /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="gWelcomeMessageLink" + title="<?= t("Welcome to Gallery 3")->for_html_attr() ?>" + href="<?= url::site("welcome_message") ?>"/> +<script type="text/javascript"> + $(document).ready(function(){$("#gWelcomeMessageLink").gallery_dialog({immediate: true});}); +</script> |