Added more import features
authorMarcel Werk <burntime@woltlab.com>
Sun, 30 Jun 2013 18:36:27 +0000 (20:36 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sun, 30 Jun 2013 18:36:27 +0000 (20:36 +0200)
com.woltlab.wcf/objectType.xml
wcfsetup/install/files/acp/templates/dataImport.tpl
wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index e122687a126affaeb0f65398daef777bda17a891..e45c17a04926a45dc5c8aa6a8b1d66c8a229efce 100644 (file)
                        <name>com.woltlab.wcf.user.comment.response</name>
                        <definitionname>com.woltlab.wcf.importer</definitionname>
                        <classname><![CDATA[wcf\system\importer\UserCommentResponseImporter]]></classname>
-               </type>
+               </type>-->
                <type>
                        <name>com.woltlab.wcf.user.follower</name>
                        <definitionname>com.woltlab.wcf.importer</definitionname>
                        <name>com.woltlab.wcf.user.rank</name>
                        <definitionname>com.woltlab.wcf.importer</definitionname>
                        <classname><![CDATA[wcf\system\importer\UserRankImporter]]></classname>
-               </type>-->
+               </type>
                <!-- /importers -->
        </import>
 </data>
\ No newline at end of file
index 47d215fa95eec354d4789a2c0c3e321ca0d4a6a4..204ebfa5bd0233f5a6487229f0cf02175009c344 100644 (file)
@@ -42,6 +42,9 @@
 
 <header class="boxHeadline">
        <h1>{lang}wcf.acp.dataImport{/lang}</h1>
+       {if $exporterName}
+               <p>{lang}wcf.acp.dataImport.exporter.{@$exporterName}{/lang}</p>
+       {/if}
 </header>
 
 {if $errorField}
                                {/foreach}
                        </fieldset>
                        
-                       <fieldset>
+                       {*<fieldset>
                                <legend>{lang}wcf.acp.dataImport.configure.settings{/lang}</legend>
                                
                                
-                       </fieldset>
+                       </fieldset>*}
                        
                        <fieldset>
                                <legend>{lang}wcf.acp.dataImport.configure.database{/lang}</legend>
                                        <dt><label for="fileSystemPath">{lang}wcf.acp.dataImport.configure.fileSystem.path{/lang}</label></dt>
                                        <dd>
                                                <input type="text" id="fileSystemPath" name="fileSystemPath" value="{$fileSystemPath}" class="long" />
+                                               <small>{lang}wcf.acp.dataImport.configure.fileSystem.path.description{/lang}</small>
                                        </dd>
                                </dl>
                        </fieldset>
diff --git a/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php
new file mode 100644 (file)
index 0000000..626e06e
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+namespace wcf\system\importer;
+use wcf\data\user\follow\UserFollowAction;
+
+/**
+ * Imports followers.
+ *
+ * @author     Marcel Werk
+ * @copyright  2001-2013 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.importer
+ * @category   Community Framework
+ */
+class UserFollowerImporter implements IImporter {
+       /**
+        * @see wcf\system\importer::import()
+        */
+       public function import($oldID, array $data) {
+               $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
+               $data['followUserID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['followUserID']);
+               if (!$data['userID'] || !$data['followUserID']) return 0;
+               
+               $action = new UserFollowAction(array(), 'create', array(
+                       'data' => $data         
+               ));
+               $returnValues = $action->executeAction();
+               return $returnValues['returnValues']->followID;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php
new file mode 100644 (file)
index 0000000..f97b9f7
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+namespace wcf\system\importer;
+use wcf\data\user\group\UserGroup;
+use wcf\data\user\rank\UserRankAction;
+
+/**
+ * Imports user ranks.
+ *
+ * @author     Marcel Werk
+ * @copyright  2001-2013 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.importer
+ * @category   Community Framework
+ */
+class UserRankImporter implements IImporter {
+       /**
+        * @see wcf\system\importer::import()
+        */
+       public function import($oldID, array $data) {
+               $data['groupID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user.group', $data['groupID']);
+               if (!$data['groupID']) $data['groupID'] = UserGroup::getGroupByType(UserGroup::USERS)->groupID;
+               
+               $action = new UserRankAction(array(), 'create', array(
+                       'data' => $data         
+               ));
+               $returnValues = $action->executeAction();
+               $newID = $returnValues['returnValues']->rankID;
+               
+               ImportHandler::getInstance()->saveNewID('com.woltlab.wcf.user.rank', $oldID, $newID);
+               
+               return $newID;
+       }
+}
index 4598dd12becc78f7f767934f6254695a48c65b61..e68708797cee759dad027fd3b69eca1c8b1603a2 100644 (file)
                <item name="wcf.acp.dashboard.box.sort"><![CDATA[Sie können die Boxen durch Ziehen und Loslassen mit der Maus sortieren. Boxen können aktiviert bzw. deaktiviert werden, indem Sie die gewünschte Box in „Aktive Boxen“ bzw. „Deaktivierte Boxen“ verschieben.]]></item>
        </category>
        
+       <category name="wcf.acp.dataImport">
+               <item name="wcf.acp.dataImport"><![CDATA[Datenimport]]></item>
+               <item name="wcf.acp.dataImport.selectExporter"><![CDATA[Datenquelle wählen]]></item>
+               <item name="wcf.acp.dataImport.exporter"><![CDATA[Datenquelle]]></item>
+               <item name="wcf.acp.dataImport.configure.data"><![CDATA[Daten]]></item>
+               <item name="wcf.acp.dataImport.configure.data.description"><![CDATA[Folgende Daten importieren:]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user"><![CDATA[Benutzer]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.group"><![CDATA[Benutzergruppen]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.option"><![CDATA[Benutzerprofilfelder]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.follower"><![CDATA[TODO: Wer wem folgt]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.rank"><![CDATA[Benutzeränge]]></item>
+               <item name="wcf.acp.dataImport.configure.database"><![CDATA[Datenbank-Zugang]]></item>
+               <item name="wcf.acp.dataImport.configure.database.host"><![CDATA[Hostname]]></item>
+               <item name="wcf.acp.dataImport.configure.database.user"><![CDATA[Benutzername]]></item>
+               <item name="wcf.acp.dataImport.configure.database.password"><![CDATA[Password]]></item>
+               <item name="wcf.acp.dataImport.configure.database.name"><![CDATA[Datenbankname]]></item>
+               <item name="wcf.acp.dataImport.configure.database.prefix"><![CDATA[Tabellen-Präfix]]></item>
+               <item name="wcf.acp.dataImport.configure.fileSystem"><![CDATA[Datei-System-Zugang]]></item>
+               <item name="wcf.acp.dataImport.configure.fileSystem.path"><![CDATA[Pfad zur Installation]]></item>
+               <item name="wcf.acp.dataImport.configure.fileSystem.path.description"><![CDATA[Wird für den Import von Datei-basierten Inhalten (wie z.B. Avatare) benötigt.]]></item>
+       </category>
+       
        <category name="wcf.acp.exceptionLog">
                <item name="wcf.acp.exceptionLog"><![CDATA[Protokollierte Fehler]]></item>
                <item name="wcf.acp.exceptionLog.exception.file"><![CDATA[Datei (Zeile)]]></item>
                <item name="wcf.acp.menu.link.tag"><![CDATA[Tags]]></item>
                <item name="wcf.acp.menu.link.tag.add"><![CDATA[Tag hinzufügen]]></item>
                <item name="wcf.acp.menu.link.tag.list"><![CDATA[Tags auflisten]]></item>
+               <item name="wcf.acp.menu.link.maintenance.import"><![CDATA[Datenimport]]></item>
        </category>
        
        <category name="wcf.acp.option">
index d6098eb39251c71e2902bc0fc9ae5bed70eeb641..24fea6185e9fa98599f33eac8068a9df856e519f 100644 (file)
@@ -161,6 +161,28 @@ Examples for medium ID detection:
                <item name="wcf.acp.dashboard.box.sort"><![CDATA[Sort boxes to determine show order. You can enable or disable boxes by moving them between the boxes “Active Boxes” and “Disabled Boxes”.]]></item>
        </category>
        
+       <category name="wcf.acp.dataImport">
+               <item name="wcf.acp.dataImport"><![CDATA[TODO: Datenimport]]></item>
+               <item name="wcf.acp.dataImport.selectExporter"><![CDATA[TODO: Datenquelle wählen]]></item>
+               <item name="wcf.acp.dataImport.exporter"><![CDATA[TODO: Datenquelle]]></item>
+               <item name="wcf.acp.dataImport.configure.data"><![CDATA[TODO: Daten]]></item>
+               <item name="wcf.acp.dataImport.configure.data.description"><![CDATA[TODO: Folgende Daten importieren:]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user"><![CDATA[TODO: Benutzer]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.group"><![CDATA[TODO: Benutzergruppen]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.option"><![CDATA[TODO: Benutzerprofilfelder]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.follower"><![CDATA[TODO: Wer wem folgt]]></item>
+               <item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.rank"><![CDATA[TODO: Benutzeränge]]></item>
+               <item name="wcf.acp.dataImport.configure.database"><![CDATA[TODO: Datenbank-Zugang]]></item>
+               <item name="wcf.acp.dataImport.configure.database.host"><![CDATA[TODO: Hostname]]></item>
+               <item name="wcf.acp.dataImport.configure.database.user"><![CDATA[TODO: Benutzername]]></item>
+               <item name="wcf.acp.dataImport.configure.database.password"><![CDATA[TODO: Password]]></item>
+               <item name="wcf.acp.dataImport.configure.database.name"><![CDATA[TODO: Datenbankname]]></item>
+               <item name="wcf.acp.dataImport.configure.database.prefix"><![CDATA[TODO: Tabellen-Präfix]]></item>
+               <item name="wcf.acp.dataImport.configure.fileSystem"><![CDATA[TODO: Datei-System-Zugang]]></item>
+               <item name="wcf.acp.dataImport.configure.fileSystem.path"><![CDATA[TODO: Pfad zur Installation]]></item>
+               <item name="wcf.acp.dataImport.configure.fileSystem.path.description"><![CDATA[TODO: Wird für den Import von Datei-basierten Inhalten (wie z.B. Avatare) benötigt.]]></item>
+       </category>
+       
        <category name="wcf.acp.exceptionLog">
                <item name="wcf.acp.exceptionLog"><![CDATA[Logged errors]]></item>
                <item name="wcf.acp.exceptionLog.exception.file"><![CDATA[File (Line)]]></item>
@@ -492,6 +514,7 @@ Examples for medium ID detection:
                <item name="wcf.acp.menu.link.tag"><![CDATA[Tags]]></item>
                <item name="wcf.acp.menu.link.tag.add"><![CDATA[Add Tag]]></item>
                <item name="wcf.acp.menu.link.tag.list"><![CDATA[List Tags]]></item>
+               <item name="wcf.acp.menu.link.maintenance.import"><![CDATA[TODO: Datenimport]]></item>
        </category>
        
        <category name="wcf.acp.option">