summaryrefslogtreecommitdiff
path: root/modules/g2_import
diff options
context:
space:
mode:
Diffstat (limited to 'modules/g2_import')
-rw-r--r--modules/g2_import/controllers/admin_g2_import.php2
-rw-r--r--modules/g2_import/css/g2_import.css30
-rw-r--r--modules/g2_import/helpers/g2_import.php25
-rw-r--r--modules/g2_import/helpers/g2_import_theme.php28
-rw-r--r--modules/g2_import/views/admin_g2_import.html.php144
5 files changed, 144 insertions, 85 deletions
diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php
index 18d09363..1c65f482 100644
--- a/modules/g2_import/controllers/admin_g2_import.php
+++ b/modules/g2_import/controllers/admin_g2_import.php
@@ -68,7 +68,7 @@ class Admin_g2_import_Controller extends Admin_Controller {
private function _get_import_form() {
$form = new Forge(
- "admin/g2_import/save", "", "post", array("id" => "gAdminConfigureG2ImportForm"));
+ "admin/g2_import/save", "", "post", array("id" => "g-admin-configure-g2-import-form"));
$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", ""));
diff --git a/modules/g2_import/css/g2_import.css b/modules/g2_import/css/g2_import.css
new file mode 100644
index 00000000..d53564d7
--- /dev/null
+++ b/modules/g2_import/css/g2_import.css
@@ -0,0 +1,30 @@
+#g-admin-g2-import-notes {
+ padding-bottom: 20px;
+}
+
+#g-admin-g2-import-details {
+ padding-top: 20px;
+}
+
+#g-admin-g2-import-details .g-warning {
+ margin-top: 4px;
+}
+
+#g-admin-g2-import-details .g-info {
+ padding: 2px;
+ border: 1px solid #999;
+ margin-bottom: 10px;
+}
+
+#g-admin-g2-import-notes p,
+#g-admin-g2-import-details .g-info p {
+ padding: 0;
+ margin: 0;
+}
+
+#g-admin-g2-import-notes ul li,
+#g-admin-g2-import .g-info ul li {
+ padding-left: 0;
+ margin-left: 20px;
+ list-style-type: disc;
+}
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 7e5c6f75..202a0e92 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -217,7 +217,7 @@ class g2_import_Core {
static function import_group(&$queue) {
$g2_group_id = array_shift($queue);
if (self::map($g2_group_id)) {
- return t("Group with id: %id already imported, skipping", array("id" => $g2_group_id));
+ return;
}
try {
@@ -230,16 +230,16 @@ class g2_import_Core {
switch ($g2_group->getGroupType()) {
case GROUP_NORMAL:
try {
- $group = group::create($g2_group->getGroupName());
+ $group = identity::create_group($g2_group->getGroupName());
} catch (Exception $e) {
// @todo For now we assume this is a "duplicate group" exception
- $group = group::lookup_by_name($g2_group->getGroupname());
+ $group = identity::lookup_user_by_name($g2_group->getGroupname());
}
$message = t("Group '%name' was imported", array("name" => $g2_group->getGroupname()));
break;
case GROUP_ALL_USERS:
- $group = group::registered_users();
+ $group = identity::registered_users();
$message = t("Group 'Registered' was converted to '%name'", array("name" => $group->name));
break;
@@ -248,7 +248,7 @@ class g2_import_Core {
break; // This is not a group in G3
case GROUP_EVERYBODY:
- $group = group::everybody();
+ $group = identity::everybody();
$message = t("Group 'Everybody' was converted to '%name'", array("name" => $group->name));
break;
}
@@ -270,8 +270,8 @@ class g2_import_Core {
}
if (g2(GalleryCoreApi::isAnonymousUser($g2_user_id))) {
- self::set_map($g2_user_id, user::guest()->id);
- return t("Skipping Anonymous User");
+ self::set_map($g2_user_id, identity::guest()->id);
+ return t("Skipping anonymous user");
}
$g2_admin_group_id =
@@ -285,11 +285,11 @@ class g2_import_Core {
$g2_groups = g2(GalleryCoreApi::fetchGroupsForUser($g2_user->getId()));
try {
- $user = user::create($g2_user->getUsername(), $g2_user->getfullname(), "");
+ $user = identity::create_user($g2_user->getUsername(), $g2_user->getfullname(), "");
$message = t("Created user: '%name'.", array("name" => $user->name));
} catch (Exception $e) {
// @todo For now we assume this is a "duplicate user" exception
- $user = user::lookup_by_name($g2_user->getUsername());
+ $user = identity::lookup_user_by_name($g2_user->getUsername());
$message = t("Loaded existing user: '%name'.", array("name" => $user->name));
}
@@ -301,7 +301,7 @@ class g2_import_Core {
$user->admin = true;
$message .= t("\n\tAdded 'admin' flag to user");
} else {
- $group = ORM::factory("group", self::map($g2_group_id));
+ $group = identity::lookup_group(self::map($g2_group_id));
$user->add($group);
$message .= t("\n\tAdded user to group '%group'.", array("group" => $group->name));
}
@@ -313,7 +313,6 @@ class g2_import_Core {
return $message;
}
-
/**
* Import a single album.
*/
@@ -331,7 +330,7 @@ class g2_import_Core {
}
if (self::map($g2_album_id)) {
- return t("Album with id: %id already imported, skipping", array("id" => $g2_album_id));
+ return;
}
try {
@@ -425,7 +424,7 @@ class g2_import_Core {
$g2_item_id = array_shift($queue);
if (self::map($g2_item_id)) {
- return t("Item with id: %id already imported, skipping", array("id" => $g2_item_id));
+ return;
}
try {
diff --git a/modules/g2_import/helpers/g2_import_theme.php b/modules/g2_import/helpers/g2_import_theme.php
new file mode 100644
index 00000000..b1aaac00
--- /dev/null
+++ b/modules/g2_import/helpers/g2_import_theme.php
@@ -0,0 +1,28 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class g2_import_theme_Core {
+ static function head($theme) {
+ $theme->css("g2_import.css");
+ }
+
+ static function admin_head($theme) {
+ $theme->css("g2_import.css");
+ }
+} \ No newline at end of file
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index 23ff27a8..b2665a5f 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -1,94 +1,96 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<div id="gAdminG2Import">
- <h1> <?= t("Gallery 2 Import") ?> </h1>
+<div id="g-admin-g2-import" class="g-block">
+ <h1> <?= t("Gallery 2 import") ?> </h1>
<p>
<?= t("Import your Gallery 2 users, photos, movies, comments and tags into your new Gallery 3 installation.") ?>
</p>
- <div id="gAdminG2ImportNotes">
- <h2> <?= t("Notes") ?> </h2>
- <p>
- <?= t("The import process is a work in progress with some known issues:") ?>
- </p>
- <ul>
- <li>
- <?= t("Permissions are <b>not imported</b>. You will have to set them again manually (for now).") ?>
- </li>
- <li>
- <?= t("The only supported image formats are JPG, PNG and GIF. Other formats will be skipped.") ?>
- </li>
- <li>
- <?= t("The only supported movie formats are FLV and MP4. Other formats will be skipped.") ?>
- </li>
- <li>
- <?= t("The eAccelerator PHP performance extension is known to cause issues. If you're using eAccelerator and having problems, please disable it while you do your import. One way to do that is to put <code>php_value eaccelerator.enable 0</code> in gallery3/.htaccess") ?>
- </li>
- </ul>
- </div>
- <?= $form ?>
-
- <? if (g2_import::is_initialized()): ?>
- <div id="gAdminG2ImportDetails">
- <h2> <?= t("Import") ?> </h2>
- <ul id="gMessage">
- <li class="gSuccess">
- <?= t("Gallery version %version detected", array("version" => g2_import::version())) ?>
- </li>
- <? if ($g2_sizes["thumb"]["size"] && $thumb_size != $g2_sizes["thumb"]["size"]): ?>
- <li class="gWarning">
- <?= t("Your most common thumbnail size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. <a href=\"%url\">Using the same value</a> will speed up your import.",
- array("g2_pixels" => $g2_sizes["thumb"]["size"],
- "g3_pixels" => $thumb_size,
- "url" => html::mark_clean(url::site("admin/theme_options")))) ?>
- </li>
- <? endif ?>
-
- <? if ($g2_sizes["resize"]["size"] && $resize_size != $g2_sizes["resize"]["size"]): ?>
- <li class="gWarning">
- <?= t("Your most common intermediate size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. <a href=\"%url\">Using the same value</a> will speed up your import.",
- array("g2_pixels" => $g2_sizes["resize"]["size"],
- "g3_pixels" => $resize_size,
- "url" => html::mark_clean(url::site("admin/theme_options")))) ?>
- </li>
- <? endif ?>
- </ul>
-
- <div class="gInfo">
+ <div class="g-block-content">
+ <div id="g-admin-g2-import-notes">
+ <h2> <?= t("Notes") ?> </h2>
<p>
- <?= t("Your Gallery 2 has the following importable data in it") ?>
+ <?= t("The import process is a work in progress with some known issues:") ?>
</p>
<ul>
<li>
- <?= t2("1 user", "%count users", $g2_stats["users"]) ?>
+ <?= t("Permissions are <b>not imported</b>. You will have to set them again manually (for now).") ?>
</li>
<li>
- <?= t2("1 group", "%count groups", $g2_stats["groups"]) ?>
+ <?= t("The only supported image formats are JPG, PNG and GIF. Other formats will be skipped.") ?>
</li>
<li>
- <?= t2("1 album", "%count albums", $g2_stats["albums"]) ?>
+ <?= t("The only supported movie formats are FLV and MP4. Other formats will be skipped.") ?>
</li>
<li>
- <?= t2("1 photo", "%count photos", $g2_stats["photos"]) ?>
+ <?= t("The eAccelerator PHP performance extension is known to cause issues. If you're using eAccelerator and having problems, please disable it while you do your import. One way to do that is to put <code>php_value eaccelerator.enable 0</code> in gallery3/.htaccess") ?>
</li>
- <li>
- <?= t2("1 movie", "%count movies", $g2_stats["movies"]) ?>
+ </ul>
+ </div>
+ <?= $form ?>
+
+ <? if (g2_import::is_initialized()): ?>
+ <div id="g-admin-g2-import-details">
+ <h2> <?= t("Import") ?> </h2>
+ <ul id="g-action-status" class="g-message-block">
+ <li class="g-success">
+ <?= t("Gallery version %version detected", array("version" => g2_import::version())) ?>
</li>
- <li>
- <?= t2("1 comment", "%count comments", $g2_stats["comments"]) ?>
+ <? if ($g2_sizes["thumb"]["size"] && $thumb_size != $g2_sizes["thumb"]["size"]): ?>
+ <li class="g-warning">
+ <?= t("Your most common thumbnail size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. <a href=\"%url\">Using the same value</a> will speed up your import.",
+ array("g2_pixels" => $g2_sizes["thumb"]["size"],
+ "g3_pixels" => $thumb_size,
+ "url" => html::mark_clean(url::site("admin/theme_options")))) ?>
</li>
- <li>
- <?= t2("1 tagged photo/movie/album",
- "%count tagged photos/movies/albums", $g2_stats["tags"]) ?>
+ <? endif ?>
+
+ <? if ($g2_sizes["resize"]["size"] && $resize_size != $g2_sizes["resize"]["size"]): ?>
+ <li class="g-warning">
+ <?= t("Your most common intermediate size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. <a href=\"%url\">Using the same value</a> will speed up your import.",
+ array("g2_pixels" => $g2_sizes["resize"]["size"],
+ "g3_pixels" => $resize_size,
+ "url" => html::mark_clean(url::site("admin/theme_options")))) ?>
</li>
+ <? endif ?>
</ul>
- </div>
- <p>
- <a class="gButtonLink gDialogLink ui-state-default ui-corner-all"
- href="<?= url::site("admin/maintenance/start/g2_import_task::import?csrf=$csrf") ?>">
- <?= t("Begin import!") ?>
- </a>
- </p>
+ <div class="g-info">
+ <p>
+ <?= t("Your Gallery 2 has the following importable data in it") ?>
+ </p>
+ <ul>
+ <li>
+ <?= t2("1 user", "%count users", $g2_stats["users"]) ?>
+ </li>
+ <li>
+ <?= t2("1 group", "%count groups", $g2_stats["groups"]) ?>
+ </li>
+ <li>
+ <?= t2("1 album", "%count albums", $g2_stats["albums"]) ?>
+ </li>
+ <li>
+ <?= t2("1 photo", "%count photos", $g2_stats["photos"]) ?>
+ </li>
+ <li>
+ <?= t2("1 movie", "%count movies", $g2_stats["movies"]) ?>
+ </li>
+ <li>
+ <?= t2("1 comment", "%count comments", $g2_stats["comments"]) ?>
+ </li>
+ <li>
+ <?= t2("1 tagged photo/movie/album",
+ "%count tagged photos/movies/albums", $g2_stats["tags"]) ?>
+ </li>
+ </ul>
+ </div>
+
+ <p>
+ <a class="g-button g-dialog-link ui-state-default ui-corner-all"
+ href="<?= url::site("admin/maintenance/start/g2_import_task::import?csrf=$csrf") ?>">
+ <?= t("Begin import!") ?>
+ </a>
+ </p>
+ </div>
+ <? endif ?>
</div>
- <? endif ?>
</div>