From a7f345476f80cde43589069825a256534de7745c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 15 Apr 2009 07:23:22 +0000 Subject: Very early round of Gallery 2 import code. It can import users (with the wrong password) and import groups, with a basic UI. Needs a ton more work. --- modules/g2_import/controllers/admin_g2_import.php | 62 +++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 modules/g2_import/controllers/admin_g2_import.php (limited to 'modules/g2_import/controllers') diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php new file mode 100644 index 00000000..6197240b --- /dev/null +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -0,0 +1,62 @@ +content = new View("admin_g2_import.html"); + $view->content->form = $this->_get_import_form(); + print $view; + } + + public function save() { + $form = $this->_get_import_form(); + if ($form->validate()) { + $embed_path = $form->configure_g2_import->embed_path->value; + if (g2_import::is_valid_embed_path($embed_path)) { + message::success("Gallery 2 path saved."); + module::set_var("g2_import", "embed_path", $embed_path); + url::redirect("admin/g2_import"); + } else { + $form->configure_g2_import->embed_path->add_error("invalid", 1); + } + } + + $view = new Admin_View("admin.html"); + $view->content = new View("admin_g2_import.html"); + $view->content->form = $form; + print $view; + } + + private function _get_import_form() { + $form = new Forge( + "admin/g2_import/save", "", "post", array("id" => "gAdminConfigureG2ImportForm")); + $group = $form->group("configure_g2_import")->label(t("Configure Gallery 2 Import")); + $group->input("embed_path")->label(t("Filesystem path to your Gallery 2 embed.php file")) + ->value(module::get_var("g2_import", "embed_path", "")); + $group->embed_path->error_messages( + "invalid", t("The path you entered is not a Gallery 2 installation.")); + $group->submit("")->value(t("Save")); + return $form; + } +} \ No newline at end of file -- cgit v1.2.3