summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-03-26 07:10:47 +0000
committerBharat Mediratta <bharat@menalto.com>2009-03-26 07:10:47 +0000
commita142aee609ec078a45303184d8f24dba643249a6 (patch)
treeeeece11e339eb4414e91b1c12cff00d6b4a5fe73 /core
parent9f784818da36b7779cb9dec6622cdb32d943dbce (diff)
Convert language updates over to task form. It's still very rough,
the task only has one step from zero to 100.
Diffstat (limited to 'core')
-rw-r--r--core/controllers/admin_languages.php22
-rw-r--r--core/helpers/core_task.php16
-rw-r--r--core/views/admin_languages.html.php6
3 files changed, 20 insertions, 24 deletions
diff --git a/core/controllers/admin_languages.php b/core/controllers/admin_languages.php
index 98572fd8..52692ea9 100644
--- a/core/controllers/admin_languages.php
+++ b/core/controllers/admin_languages.php
@@ -22,7 +22,6 @@ class Admin_Languages_Controller extends Admin_Controller {
$v = new Admin_View("admin.html");
$v->content = new View("admin_languages.html");
$v->content->settings_form = $this->_languages_form();
- $v->content->update_translations_form = $this->_translation_updates_form();
if (empty($share_translations_form)) {
$share_translations_form = $this->_share_translations_form();
}
@@ -41,16 +40,6 @@ class Admin_Languages_Controller extends Admin_Controller {
url::redirect("admin/languages");
}
- public function fetch_updates() {
- $form = $this->_translation_updates_form();
- if ($form->validate()) {
- l10n_scanner::update_index();
- l10n_client::fetch_updates();
- message::success(t("Translations installed/updated"));
- }
- url::redirect("admin/languages");
- }
-
public function share() {
$form = $this->_share_translations_form();
if (!$form->validate()) {
@@ -119,17 +108,6 @@ class Admin_Languages_Controller extends Admin_Controller {
return $form;
}
- private function _translation_updates_form() {
- // TODO: Show a timestamp of the last update.
- // TODO: Show a note if you've changed the language settings but not fetched translations for
- // the selected languages yet.
- $form = new Forge("admin/languages/fetch_updates", "", "post", array("id" => "gLanguageUpdatesForm"));
- $group = $form->group("updates")
- ->label(t("Download translations for all selected languages from the Gallery Translation Server:"));
- $group->submit("update")->value(t("Get updates"));
- return $form;
- }
-
private function _outgoing_translations_count() {
return ORM::factory("outgoing_translation")->count_all();
}
diff --git a/core/helpers/core_task.php b/core/helpers/core_task.php
index 008c593f..b9d6253a 100644
--- a/core/helpers/core_task.php
+++ b/core/helpers/core_task.php
@@ -28,7 +28,12 @@ class core_task_Core {
"You have %count out of date photos",
$dirty_count)
: t("All your photos are up to date"))
- ->severity($dirty_count ? log::WARNING : log::SUCCESS));
+ ->severity($dirty_count ? log::WARNING : log::SUCCESS),
+ Task_Definition::factory()
+ ->callback("core_task::update_l10n")
+ ->name(t("Update translations"))
+ ->description(t("Download new and updated translated strings"))
+ ->severity(log::SUCCESS));
}
/**
@@ -73,4 +78,13 @@ class core_task_Core {
site_status::clear("graphics_dirty");
}
}
+
+ static function update_l10n($task) {
+ l10n_scanner::update_index();
+ l10n_client::fetch_updates();
+ $task->done = true;
+ $task->state = "success";
+ $task->percent_complete = 100;
+ $task->status = t("Translations installed/updated");
+ }
} \ No newline at end of file
diff --git a/core/views/admin_languages.html.php b/core/views/admin_languages.html.php
index abeaf362..2b43f1b4 100644
--- a/core/views/admin_languages.html.php
+++ b/core/views/admin_languages.html.php
@@ -4,7 +4,11 @@
<?= $settings_form ?>
- <?= $update_translations_form ?>
+ <h2> <?= t("Download translations") ?> </h2>
+ <a href="<?= url::site("admin/maintenance/start/core_task::update_l10n?csrf=$csrf") ?>"
+ class="gDialogLink">
+ <?= t("Get updates") ?>
+ </a>
<h2> <?= t("Your Own Translations") ?> </h2>
<?= $share_translations_form ?>