Skip to content

Commit

Permalink
finalize version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasKrais committed Mar 14, 2024
1 parent c06baed commit 427b9f2
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 63 deletions.
8 changes: 0 additions & 8 deletions boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
rex_extension::register('CLANG_DELETED', 'rex_d2u_guestbook_clang_deleted');
}

rex_extension::register('PACKAGES_INCLUDED', static function ($params) {
/** @deprecated starting with version 2, class alias will be removed */
class_alias(FriendsOfREDAXO\D2UGuestbook\BackendHelper::class, D2U_Guestbook\d2u_guestbook_backend_helper::class);
class_alias(FriendsOfREDAXO\D2UGuestbook\Entry::class, D2U_Guestbook\Entry::class);
class_alias(FriendsOfREDAXO\D2UGuestbook\LangHelper::class, d2u_guestbook_lang_helper::class);
class_alias(FriendsOfREDAXO\D2UGuestbook\Modules::class, D2UGuestbookModules::class);
});

/**
* Deletes language specific configurations and objects.
* @param rex_extension_point<array<string>> $ep Redaxo extension point
Expand Down
17 changes: 3 additions & 14 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,9 @@
}

// Update modules
if (class_exists(TobiasKrais\D2UHelper\ModuleManager::class)) {
$modules = [];
$modules[] = new \TobiasKrais\D2UHelper\Module('60-1',
'D2U Guestbook - Gästebuch mit Bootstrap 4 Tabs',
16);
$modules[] = new \TobiasKrais\D2UHelper\Module('60-2',
'D2U Guestbook - Infobox Bewertung',
5);
$modules[] = new \TobiasKrais\D2UHelper\Module('60-3',
'D2U Guestbook - Gästebuch ohne Tabs',
13);
$d2u_module_manager = new \TobiasKrais\D2UHelper\ModuleManager($modules, '', 'd2u_guestbook');
$d2u_module_manager->autoupdate();
}
include __DIR__ . DIRECTORY_SEPARATOR .'lib'. DIRECTORY_SEPARATOR .'Module.php';
$d2u_module_manager = new \TobiasKrais\D2UHelper\ModuleManager(\FriendsOfREDAXO\D2UGuestbook\Module::getModules(), '', 'd2u_guestbook');
$d2u_module_manager->autoupdate();

// Update language replacements
if (!class_exists(FriendsOfREDAXO\D2UGuestbook\LangHelper::class)) {
Expand Down
6 changes: 3 additions & 3 deletions lang/de_de.lang
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
d2u_guestbook = D2U Gästebuch
d2u_guestbook = Gästebuch
d2u_guestbook_clang = Sprache
d2u_guestbook_date = Datum
d2u_guestbook_description = Nachricht
Expand All @@ -11,8 +11,8 @@ d2u_guestbook_rating = Bewertung (1=schlecht / 5=sgt)
d2u_guestbook_recommendation = Empfehlung
d2u_guestbook_url = Webseite

d2u_guestbook_rights = D2U Gästebuch Addon
d2u_guestbook_rights_settings = D2U Gästebuch Addon: Einstellungen
d2u_guestbook_rights = Gästebuch Addon
d2u_guestbook_rights_settings = Gästebuch Addon: Einstellungen

d2u_guestbook_settings_allow_answer = E-Mailadresse von Einträgen geschützt veröffentlichen um Antworten zu erlauben?
d2u_guestbook_settings_article = Gästebuch Artikel
Expand Down
6 changes: 3 additions & 3 deletions lang/en_gb.lang
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
d2u_guestbook = D2U Guestbook
d2u_guestbook = Guestbook
d2u_guestbook_clang = Language
d2u_guestbook_date = Date
d2u_guestbook_description = Message
Expand All @@ -11,8 +11,8 @@ d2u_guestbook_rating = Rating (1=bad / 5=best)
d2u_guestbook_recommendation = recommendation
d2u_guestbook_url = Website

d2u_guestbook_rights = D2U Guestbook Addon
d2u_guestbook_rights_settings = D2U Guestbook Addon: Settings
d2u_guestbook_rights = Guestbook Addon
d2u_guestbook_rights_settings = Guestbook Addon: Settings

d2u_guestbook_settings_allow_answer = Do not show email address and thus allow answering to entries
d2u_guestbook_settings_article = Guestbook redaxo article
Expand Down
2 changes: 1 addition & 1 deletion lib/BackendHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ public static function sendAdminNotification($yform):void
$mail->send();
}
}
}
}
2 changes: 1 addition & 1 deletion lib/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@ public function save()

return $error;
}
}
}
7 changes: 5 additions & 2 deletions lib/LangHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace FriendsOfREDAXO\D2UGuestbook;

use rex_clang;
use rex_config;

/**
* @api
* Offers helper functions for language issues.
Expand Down Expand Up @@ -77,7 +80,7 @@ class LangHelper extends \TobiasKrais\D2UHelper\ALangHelper

/**
* Factory method.
* @return d2u_guestbook_lang_helper Object
* @return self Object
*/
public static function factory()
{
Expand Down Expand Up @@ -105,4 +108,4 @@ public function install(): void
}
}
}
}
}
4 changes: 2 additions & 2 deletions lib/Modules.php → lib/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @author Tobias Krais
*/
class Modules
class Module
{
/**
* Get modules offered by this addon.
Expand All @@ -27,4 +27,4 @@ public static function getModules()
13);
return $modules;
}
}
}
4 changes: 2 additions & 2 deletions package.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package: d2u_guestbook
version: '1.1.0'
author: FriendsOfREDAXO
version: '2.0.0'
author: Friends Of REDAXO
supportpage: http://github.com/FriendsOfREDAXO/d2u_guestbook

page:
Expand Down
32 changes: 5 additions & 27 deletions pages/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Modules
*/
$d2u_module_manager = new \TobiasKrais\D2UHelper\ModuleManager(D2UGuestbookModules::getModules(), 'modules/', 'd2u_guestbook');
$d2u_module_manager = new \TobiasKrais\D2UHelper\ModuleManager(\FriendsOfREDAXO\D2UGuestbook\Module::getModules(), 'modules/', 'd2u_guestbook');

// \TobiasKrais\D2UHelper\ModuleManager actions
$d2u_module_id = rex_request('d2u_module_id', 'string');
Expand All @@ -15,29 +15,6 @@
// \TobiasKrais\D2UHelper\ModuleManager show list
$d2u_module_manager->showManagerList();

// Import from TVS Guestbook
$sql = rex_sql::factory();
$sql->setQuery("SHOW TABLES LIKE '". rex::getTablePrefix() ."771_entries'");
$tvsgb_available = $sql->getRows() > 0 ? true : false;
if ('tvsgb' === rex_request('import', 'string') && $tvsgb_available) {
$sql->setQuery('UPDATE `'. rex::getTablePrefix() ."771_entries` SET description = REPLACE(description, '\r\n', '<br>');
INSERT INTO ". rex::getTablePrefix() .'d2u_guestbook (`name`, `email`, `description`, `clang_id`, `online_status`, `create_date`)
SELECT `create_user`, `email`, `description`, `clang`, `status`, FROM_UNIXTIME(`create_date`) FROM '. rex::getTablePrefix() .'771_entries;
UPDATE `'. rex::getTablePrefix() ."d2u_guestbook` SET `online_status` = 'online' WHERE `online_status` = '1';
UPDATE `". rex::getTablePrefix() ."d2u_guestbook` SET `online_status` = 'offline' WHERE `online_status` = '0';
UPDATE `". rex::getTablePrefix() .'d2u_guestbook` SET rating = 0 WHERE rating = NULL;
DROP TABLE `'. rex::getTablePrefix() .'771_entries`;');
if ($sql->hasError()) {
echo rex_view::error('Fehler beim Import: '. $sql->getError());
} else {
echo rex_view::success('Daten aus TVS Gästebucherfolgreich importiert und alte Tabelle gelöscht.');
}
} elseif ($tvsgb_available) {
echo '<h2>Import aus Redaxo 4 TVS Gästebuch</h2>';
echo '<p>Es wurde eine TVS Gästebuch Tabelle aus Redaxo 4 in der Datenbank gefunden.'
. 'Sollen die Daten importiert werden und die alte Tabelle gelöscht werden?</p>';
echo '<a href="'. rex_url::currentBackendPage(['import' => 'tvsgb'], false) .'"><button class="btn btn-save">Import</button></a>';
}
?>
<h2>Installation der Module</h2>
<p>Die zu den obigen Modulen gehörenden CSS Vorlagen befinden sich im Addon
Expand All @@ -57,19 +34,20 @@
<h2>Support</h2>
<p>Fehlermeldungen bitte im <a href="https://github.com/FriendsOfREDAXO/d2u_guestbook" target="_blank">GitHub Repository</a> melden.</p>
<h2>Changelog</h2>
<p>1.1.0:</p>
<p>2.0.0:</p>
<ul>
<li>Vorbereitung auf R6: Folgende Klassen werden ab Version 2 dieses Addons umbenannt. Schon jetzt stehen die neuen Klassen für die Übergangszeit zur Verfügung:
<li>Vorbereitung auf R6: Folgende Klassen wurden umbenannt:
<ul>
<li><code>D2U_Guestbook\d2u_guestbook_backend_helper</code> wird zu <code>FriendsOfREDAXO\D2UGuestbook\BackendHelper</code>.</li>
<li><code>d2u_guestbook_lang_helper</code> wird zu <code>FriendsOfREDAXO\D2UGuestbook\LangHelper</code>.</li>
<li><code>D2UGuestbookModules</code> wird zu <code>FriendsOfREDAXO\D2UGuestbook\Modules</code>.</li>
<li><code>D2UGuestbookModules</code> wird zu <code>FriendsOfREDAXO\D2UGuestbook\Module</code>.</li>
<li><code>D2U_Guestbook\Entry</code> wird zu <code>FriendsOfREDAXO\D2UGuestbook\Entry</code>.</li>
</ul>
</li>
<li>Projekt an FriendsOfREDAXO übergeben.</li>
<li>Modul "60-2 D2U Guestbook - Infobox Bewertung": Berechnung der Sterne korrigiert.</li>
<li>Anpassungen an kommende d2u_helper 2.x Version</li>
<li>Import aus TVSGB von Redaxo 4 entfernt.</li>
</ul>
<p>1.0.12:</p>
<ul>
Expand Down

0 comments on commit 427b9f2

Please sign in to comment.