From e1f2a5d4e60f431e0a94c998afc026f1136fb26b Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Thu, 11 Dec 2008 17:20:55 +0000
Subject: 1) Begins the creation of the local import module by adding the
administation component to the scaffolding Actions tab. The importing
functionality will follow shortly.
2) Defines a routining pattern for module administration controllers. URI's of the form admin/module/method/parameters gets remapped into module_admin/method/parameters. This will result in the lookup of the the controller Module_Admin_Controller
---
core/config/routes.php | 8 ++-
core/controllers/welcome.php | 11 ++++
core/views/welcome.html.php | 11 ++++
.../controllers/local_import_admin.php | 56 +++++++++++++++++
modules/local_import/helpers/local_import.php | 49 +++++++++++++++
.../local_import/helpers/local_import_block.php | 30 +++++++++
.../helpers/local_import_installer.php | 41 +++++++++++++
modules/local_import/images/bin_closed.png | Bin 0 -> 363 bytes
modules/local_import/js/local_import.js | 67 +++++++++++++++++++++
.../local_import/views/local_import_admin.html.php | 31 ++++++++++
.../views/local_import_dir_list.html.php | 28 +++++++++
11 files changed, 329 insertions(+), 3 deletions(-)
create mode 100644 modules/local_import/controllers/local_import_admin.php
create mode 100644 modules/local_import/helpers/local_import.php
create mode 100644 modules/local_import/helpers/local_import_block.php
create mode 100644 modules/local_import/helpers/local_import_installer.php
create mode 100644 modules/local_import/images/bin_closed.png
create mode 100644 modules/local_import/js/local_import.js
create mode 100644 modules/local_import/views/local_import_admin.html.php
create mode 100644 modules/local_import/views/local_import_dir_list.html.php
diff --git a/core/config/routes.php b/core/config/routes.php
index 9e36f881..9a802a27 100644
--- a/core/config/routes.php
+++ b/core/config/routes.php
@@ -19,10 +19,12 @@
*/
// The abstract REST_Controller is not directly routable.
-$config['^rest\b.*'] = null;
+$config["^rest\b.*"] = null;
// Redirect /form/add and /form/edit to REST_Controller.
-$config['^form/(edit|add)/(\w+)/(.*)$'] = '$2/form_$1/$3';
+$config["^form/(edit|add)/(\w+)/(.*)$"] = "$2/form_$1/$3";
+
+$config["^admin/(\w+)/(.*)$"] = "$1_admin/$2";
// For now our default page is the scaffolding.
-$config['_default'] = 'welcome';
+$config["_default"] = "welcome";
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php
index dacaa87f..bddca606 100644
--- a/core/controllers/welcome.php
+++ b/core/controllers/welcome.php
@@ -36,6 +36,11 @@ class Welcome_Controller extends Template_Controller {
$this->template->album_tree = $this->_load_album_tree();
$this->template->rearrange_html = new View("rearrange.html");
$this->template->add_photo_html = $this->_get_add_photo_html();
+ if (module::is_installed("local_import")) {
+ $this->template->local_import_html = $this->_get_local_import_html();
+ } else {
+ $this->template->local_import_html = "";
+ }
} catch (Exception $e) {
$this->template->album_count = 0;
$this->template->photo_count = 0;
@@ -43,6 +48,7 @@ class Welcome_Controller extends Template_Controller {
$this->template->album_tree = array();
$this->template->rearrange_html = "";
$this->template->add_photo_html = "";
+ $this->template->local_import_html = "";
}
$this->_load_user_info();
@@ -513,4 +519,9 @@ class Welcome_Controller extends Template_Controller {
$parent = ORM::factory("item", $parent_id);
return photo::get_add_form($parent);
}
+
+ public function _get_local_import_html($user_name="admin") {
+ $user = ORM::factory("user")->where("name", $user_name)->find();
+ return local_import::get_admin_page($user);
+ }
}
diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php
index 47d9bd84..c8352592 100644
--- a/core/views/welcome.html.php
+++ b/core/views/welcome.html.php
@@ -148,11 +148,18 @@
margin-left: -1.5em;
list-style-type: none;
}
+
+ .gHide {
+ display: none;
+ }
= html::script("lib/jquery.js") ?>
= html::script("lib/jquery.form.js") ?>
= html::script("lib/jquery.cookie.js") ?>
= html::script("lib/jquery.MultiFile.js") ?>
+ if (class_exists("local_import_block")): ?>
+ = local_import_block::head(null) ?>
+ endif ?>
if (class_exists("rearrange_block")): ?>
= rearrange_block::head(null) ?>
endif ?>
@@ -256,6 +263,10 @@
] tags
= $add_photo_html ?>
+