diff options
author | root <root@sleepydogs.net> | 2009-09-13 09:01:55 -0700 |
---|---|---|
committer | root <root@sleepydogs.net> | 2009-09-13 09:01:55 -0700 |
commit | c62d1f440f077ba806b7ff0c6b90ef89c79b2fd3 (patch) | |
tree | b64f05e2a7bd8db7200e3c407904e255826b4cf2 /modules/g2_import | |
parent | b96ac1eb81b7ccd5bd050ffab0ca9ce1feec8f4f (diff) | |
parent | caa2002d7777e0ceb884d4c628650804620ca2b6 (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/g2_import')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 24 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import_event.php | 11 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import_installer.php | 2 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import_menu.php | 29 | ||||
-rw-r--r-- | modules/g2_import/views/admin_g2_import.html.php | 10 |
5 files changed, 20 insertions, 56 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 8b4169dd..7e5c6f75 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -376,12 +376,10 @@ class g2_import_Core { } $album->save(); - $message[] = t("Album '%name' imported.", array("name" => $album->name)); - $message[] = self::import_keywords_as_tags($g2_album->getKeywords(), $album); + self::import_keywords_as_tags($g2_album->getKeywords(), $album); self::set_map($g2_album_id, $album->id); // @todo import album highlights - return $message; } /** @@ -401,7 +399,6 @@ class g2_import_Core { } $table = g2(GalleryCoreApi::fetchThumbnailsByItemIds(array($g2_album_id))); - $message = ""; if (isset($table[$g2_album_id])) { // Backtrack the source id to an item $g2_source = $table[$g2_album_id]; @@ -417,10 +414,8 @@ class g2_import_Core { $g2_album->view_count = g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); $g2_album->save(); graphics::generate($g2_album); - $message = t("Highlight created for album '%name'", array("name" => $g2_album->name)); } } - return $message; } /** @@ -478,7 +473,6 @@ class g2_import_Core { self::_decode_html_special_chars($g2_item->getTitle()), self::_decode_html_special_chars(self::extract_description($g2_item)), self::map($g2_item->getOwnerId())); - $message[].= t("Imported photo: '%title'", array("title" => p::purify($item->title))); } catch (Exception $e) { Kohana::log( "alert", "Corrupt image $g2_path\n" . $e->__toString()); @@ -499,7 +493,6 @@ class g2_import_Core { self::_decode_html_special_chars($g2_item->getTitle()), self::_decode_html_special_chars(self::extract_description($g2_item)), self::map($g2_item->getOwnerId())); - $message[] = t("Imported movie: '%title'", array("title" => p::purify($item->title))); } catch (Exception $e) { Kohana::log("alert", "Corrupt movie $g2_path\n" . $e->__toString()); $message[] = t("Corrupt movie '%path'", array("path" => $g2_path)); @@ -520,14 +513,13 @@ class g2_import_Core { } if (!empty($item)) { - $message[] = self::import_keywords_as_tags($g2_item->getKeywords(), $item); + self::import_keywords_as_tags($g2_item->getKeywords(), $item); } if (isset($item)) { self::set_map($g2_item_id, $item->id); $item->view_count = g2(GalleryCoreApi::fetchItemViewCount($g2_item_id)); $item->save(); - $message[] = t("View count updated: %count", array("count" => $item->view_count)); } if ($corrupt) { @@ -598,7 +590,7 @@ class g2_import_Core { self::map($g2_comment->getId(), $comment->id); return t("Imported comment '%comment' for item with id: %id", array("id" => $comment->item_id, - "comment" => text::limit_words(nl2br(p::purify($comment->text)), 50))); + "comment" => text::limit_words(nl2br(html::purify($comment->text)), 50))); } /** @@ -624,20 +616,14 @@ class g2_import_Core { // Multiword tags have the space changed to dots.s foreach ($tag_names as $tag_name) { $tags .= (strlen($tags) ? ", " : "") . - tag::add($g3_item, preg_replace('/\s+/', '.', $tag_name)); + tag::add($g3_item, $tag_name); } // Tag operations are idempotent so we don't need to map them. Which is good because we don't // have an id for each individual tag mapping anyway so it'd be hard to set up the mapping. - return t("Added '%tags' to '%title'", array("tags" => $tags, - "title" => p::purify($item->title))); } static function import_keywords_as_tags($keywords, $item) { - if (!module::is_active("tag")) { - return t("Gallery 3 tag module is inactive, no keywords will be imported"); - } - // Keywords in G2 are free form. So we don't know what our user used as a separator. Try to // be smart about it. If we see a comma or a semicolon, expect the keywords to be separated // by that delimeter. Otherwise, use space as the delimiter. @@ -656,8 +642,6 @@ class g2_import_Core { $tags .= (strlen($tags) ? ", " : "") . tag::add($item, $keyword); } } - return strlen($tags) ? t("Added '%keywords' to '%title'", - array("keywords" => $tags, "title" => p::purify($item->title))) : ""; } /** diff --git a/modules/g2_import/helpers/g2_import_event.php b/modules/g2_import/helpers/g2_import_event.php index 13f5b1a0..609e1a45 100644 --- a/modules/g2_import/helpers/g2_import_event.php +++ b/modules/g2_import/helpers/g2_import_event.php @@ -18,11 +18,20 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class g2_import_event_Core { - static function item_before_delete($item) { + static function item_deleted($item) { Database::instance()->delete("g2_maps", array("g3_id" => $item->id)); } static function item_created($item) { g2_import::copy_matching_thumbnails_and_resizes($item); } + + static function admin_menu($menu, $theme) { + $menu + ->get("settings_menu") + ->append(Menu::factory("link") + ->id("g2_import") + ->label(t("Gallery 2 Import")) + ->url(url::site("admin/g2_import"))); + } } diff --git a/modules/g2_import/helpers/g2_import_installer.php b/modules/g2_import/helpers/g2_import_installer.php index 0f87da6c..feacb518 100644 --- a/modules/g2_import/helpers/g2_import_installer.php +++ b/modules/g2_import/helpers/g2_import_installer.php @@ -26,7 +26,7 @@ class g2_import_installer { `g3_id` int(9) NOT NULL, PRIMARY KEY (`id`), KEY (`g2_id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + DEFAULT CHARSET=utf8;"); module::set_version("g2_import", 1); mkdir(VARPATH . "modules/g2_import"); diff --git a/modules/g2_import/helpers/g2_import_menu.php b/modules/g2_import/helpers/g2_import_menu.php deleted file mode 100644 index 68d75cb4..00000000 --- a/modules/g2_import/helpers/g2_import_menu.php +++ /dev/null @@ -1,29 +0,0 @@ -<?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_menu_Core { - static function admin($menu, $theme) { - $menu - ->get("settings_menu") - ->append(Menu::factory("link") - ->id("g2_import") - ->label(t("Gallery 2 Import")) - ->url(url::site("admin/g2_import"))); - } -} diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index da2bb5d1..23ff27a8 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -37,9 +37,9 @@ <? 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" => url::site("admin/theme_options"))) ?> + array("g2_pixels" => $g2_sizes["thumb"]["size"], + "g3_pixels" => $thumb_size, + "url" => html::mark_clean(url::site("admin/theme_options")))) ?> </li> <? endif ?> @@ -47,8 +47,8 @@ <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" => url::site("admin/theme_options"))) ?> + "g3_pixels" => $resize_size, + "url" => html::mark_clean(url::site("admin/theme_options")))) ?> </li> <? endif ?> </ul> |