From aae72a0d8528e2bd25d9342ac637be6ac1e78341 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Wed, 2 Aug 2023 10:32:40 +0200 Subject: [PATCH] =?UTF-8?q?0012128:=20Beschreibung/Texte=20f=C3=BCr=20Hers?= =?UTF-8?q?teller-Seiten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit initial for adding longtexts to manufacturer --- .../Admin/d3manufacturerlongtext.php | 56 +++++++++++++++++ .../Admin/d3manufacturerlongtext1.php | 8 +++ .../Admin/d3manufacturerlongtext2.php | 8 +++ .../admin/de/d3_categorylongtext_lang.php | 2 + .../admin/tpl/d3_manufacturer_longtext.tpl | 59 ++++++++++++++++++ Setup/setup.sql | 12 ++++ composer.json | 2 +- menu.xml | 6 ++ metadata.php | 34 ++++++++--- migration/data/Version20230802094023.php | 61 +++++++++++++++++++ migration/data/Version20230802094252.php | 61 +++++++++++++++++++ 11 files changed, 299 insertions(+), 10 deletions(-) create mode 100644 Application/Controllers/Admin/d3manufacturerlongtext.php create mode 100644 Application/Controllers/Admin/d3manufacturerlongtext1.php create mode 100644 Application/Controllers/Admin/d3manufacturerlongtext2.php create mode 100644 Application/views/admin/tpl/d3_manufacturer_longtext.tpl create mode 100644 migration/data/Version20230802094023.php create mode 100644 migration/data/Version20230802094252.php diff --git a/Application/Controllers/Admin/d3manufacturerlongtext.php b/Application/Controllers/Admin/d3manufacturerlongtext.php new file mode 100644 index 0000000..72302c7 --- /dev/null +++ b/Application/Controllers/Admin/d3manufacturerlongtext.php @@ -0,0 +1,56 @@ +_aViewData['edit'] = $oManufacturer = oxNew(Manufacturer::class); + + $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId(); + if (isset($soxId) && $soxId != "-1") { + // load object + $selectedLang = Registry::getRequest()->getRequestEscapedParameter( "selectedlang"); + + if (!isset($selectedLang)) { + $selectedLang = $this->_iEditLang; + } + + $this->_aViewData["selectedlang"] = $selectedLang; + + $oManufacturer->loadInLang($selectedLang, $soxId); + + //Disable editing for derived items + if ($oManufacturer->isDerived()) { + $this->_aViewData['readonly'] = true; + } + + foreach ( Registry::getLang()->getLanguageNames() as $id => $language) { + $oLang = new stdClass(); + $oLang->sLangDesc = $language; + $oLang->selected = ($id == $this->_iEditLang); + $this->_aViewData["otherlang"][$id] = clone $oLang; + } + } + + $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 300, $oManufacturer, "oxmanufacturer__".$this->sFieldName, "list.tpl.css"); + + return $tpl; + } + + public function getFieldName() + { + return $this->sFieldName; + } +} diff --git a/Application/Controllers/Admin/d3manufacturerlongtext1.php b/Application/Controllers/Admin/d3manufacturerlongtext1.php new file mode 100644 index 0000000..c78224c --- /dev/null +++ b/Application/Controllers/Admin/d3manufacturerlongtext1.php @@ -0,0 +1,8 @@ + 'UTF-8', 'd3categorylongtext' => $logo.' zweiter Langtext', + 'd3manufacturerlongtext1' => $logo.' Langtext 1', + 'd3manufacturerlongtext2' => $logo.' Langtext 2', ]; diff --git a/Application/views/admin/tpl/d3_manufacturer_longtext.tpl b/Application/views/admin/tpl/d3_manufacturer_longtext.tpl new file mode 100644 index 0000000..7ccd412 --- /dev/null +++ b/Application/views/admin/tpl/d3_manufacturer_longtext.tpl @@ -0,0 +1,59 @@ +[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}] + + + +[{if $readonly}] + [{assign var="readonly" value="readonly disabled"}] +[{else}] + [{assign var="readonly" value=""}] +[{/if}] + +
+ [{$oViewConf->getHiddenSid()}] + + + +
+ +
+ [{$oViewConf->getHiddenSid()}] + + + + + + + + + [{$editor}] + + + + + + +
+ [{if $languages}][{oxmultilang ident="GENERAL_LANGUAGE"}] + + [{/if}] +
+ +
+
+ +[{include file="bottomnaviitem.tpl"}] +[{include file="bottomitem.tpl"}] \ No newline at end of file diff --git a/Setup/setup.sql b/Setup/setup.sql index fa46baf..ef0a263 100644 --- a/Setup/setup.sql +++ b/Setup/setup.sql @@ -2,4 +2,16 @@ ALTER TABLE `oxcategories` ADD `D3LONGDESC2` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL , ADD `D3LONGDESC2_1` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL , ADD `D3LONGDESC2_2` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL , +ADD `D3LONGDESC2_3` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL; + +ALTER TABLE `oxmanufacturers` + ADD `D3LONGDESC1` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL , +ADD `D3LONGDESC1_1` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL , +ADD `D3LONGDESC1_2` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL , +ADD `D3LONGDESC1_3` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL; + +ALTER TABLE `oxmanufacturers` + ADD `D3LONGDESC2` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL , +ADD `D3LONGDESC2_1` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL , +ADD `D3LONGDESC2_2` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL , ADD `D3LONGDESC2_3` TEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL; \ No newline at end of file diff --git a/composer.json b/composer.json index cd95339..fd93fba 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "d3/categorylongtext", - "description": "2. Kategorie Langtext", + "description": "weitere Langtexte", "type": "oxideshop-module", "keywords": [ "oxid", diff --git a/menu.xml b/menu.xml index 1fdc5d2..28f1d94 100644 --- a/menu.xml +++ b/menu.xml @@ -6,5 +6,11 @@ + + + + + + \ No newline at end of file diff --git a/metadata.php b/metadata.php index c28e974..40efbdb 100644 --- a/metadata.php +++ b/metadata.php @@ -13,15 +13,18 @@ declare(strict_types=1); use D3\CategoryLongtext\Application\Controllers\Admin\AdminDetailsController; +use D3\CategoryLongtext\Application\Controller\Admin\d3manufacturerlongtext1; +use D3\CategoryLongtext\Application\Controller\Admin\d3manufacturerlongtext2; $sMetadataVersion = '2.1'; $sModuleId = 'd3categorylongtext'; -$logo = '(D3)'; +$logo = '(D3)'; -$aModule = array( - 'id' => $sModuleId, - 'title' => $logo.' zweiter Kategorielangtext', - 'description' => 'Hinweise:' +$features = << +
  • #11735 - 2. Kategorielangtext + + Hinweise:' . 'Voraussetzungen:
    ' . 'Datenbank-Felder:
    ' . '- oxcategories__d3longdesc2
    ' @@ -29,17 +32,30 @@ $aModule = array( . '- oxcategories__d3longdesc2_2
    ' . '- oxcategories__d3longdesc2_3
    ' . 'Diese Erweiterung bietet einen zweiten Kategorielangtext.
    ' // - . 'Angezeigt wird der zweite Langtext unter der Artikelauflistung in der Listenansicht.', + . 'Angezeigt wird der zweite Langtext unter der Artikelauflistung in der Listenansicht. +
    +
  • +
  • #12128 - Herstellerlangtexte
  • + +FEATURES; + +$aModule = [ + 'id' => $sModuleId, + 'title' => $logo.' weitere Kategorie- und Herstellerlangtexte', + 'description' => $features, 'thumbnail' => 'picture.png', - 'version' => '1.4.0', + 'version' => '1.5.0', 'author' => $logo.' Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/', 'controllers' => [ - 'd3clcategorylongtext' => AdminDetailsController::class + 'd3clcategorylongtext' => AdminDetailsController::class, + 'd3manufacturerlongtext1' => d3manufacturerlongtext1::class, + 'd3manufacturerlongtext2' => d3manufacturerlongtext2::class, ], 'templates' => [ 'd3_categories_longtext.tpl' => 'd3/categorylongtext/Application/views/admin/tpl/d3_categories_longtext.tpl', + 'd3_manufacturer_longtext.tpl' => 'd3/categorylongtext/Application/views/admin/tpl/d3_manufacturer_longtext.tpl', ], 'blocks' => [ [ @@ -52,4 +68,4 @@ $aModule = array( 'onActivate' => '\D3\CategoryLongtext\Setup\Events::onActivate', //'onDeactivate' => '\D3\CategoryLongtext\Events\Events::onDeactivate' ] -); +]; diff --git a/migration/data/Version20230802094023.php b/migration/data/Version20230802094023.php new file mode 100644 index 0000000..3932d9e --- /dev/null +++ b/migration/data/Version20230802094023.php @@ -0,0 +1,61 @@ +connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); + + $table = $schema->getTable('oxmanufacturers'); + + $table->hasColumn('D3LONGDESC1') ?: + $table->addColumn('D3LONGDESC1', (Type::getType('text')->getName())) + ->setNotnull(true); + + $table->hasColumn('D3LONGDESC1_1') ?: + $table->addColumn('D3LONGDESC1_1', (Type::getType('text')->getName())) + ->setNotnull(true); + + $table->hasColumn('D3LONGDESC1_2') ?: + $table->addColumn('D3LONGDESC1_2', (Type::getType('text')->getName())) + ->setNotnull(true); + + $table->hasColumn('D3LONGDESC1_3') ?: + $table->addColumn('D3LONGDESC1_3', (Type::getType('text')->getName())) + ->setNotnull(true); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + + } +} diff --git a/migration/data/Version20230802094252.php b/migration/data/Version20230802094252.php new file mode 100644 index 0000000..7291b99 --- /dev/null +++ b/migration/data/Version20230802094252.php @@ -0,0 +1,61 @@ +connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); + + $table = $schema->getTable('oxmanufacturers'); + + $table->hasColumn('D3LONGDESC2') ?: + $table->addColumn('D3LONGDESC2', (Type::getType('text'))->getName()) + ->setNotnull(true); + + $table->hasColumn('D3LONGDESC2_1') ?: + $table->addColumn('D3LONGDESC2_1', (Type::getType('text'))->getName()) + ->setNotnull(true); + + $table->hasColumn('D3LONGDESC2_2') ?: + $table->addColumn('D3LONGDESC2_2', (Type::getType('text'))->getName()) + ->setNotnull(true); + + $table->hasColumn('D3LONGDESC2_3') ?: + $table->addColumn('D3LONGDESC2_3', (Type::getType('text'))->getName()) + ->setNotnull(true); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + + } +}