0012128: Beschreibung/Texte für Hersteller-Seiten

initial for adding longtexts to manufacturer
This commit is contained in:
Daniel Seifert 2023-08-02 10:32:40 +02:00
parent ab27b8cfed
commit aae72a0d85
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
11 changed files with 299 additions and 10 deletions

View File

@ -0,0 +1,56 @@
<?php
namespace D3\CategoryLongtext\Application\Controller\Admin;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Application\Controller\Admin\CategoryText;
use OxidEsales\Eshop\Application\Model\Manufacturer;
use stdClass;
abstract class d3manufacturerlongtext extends CategoryText
{
public $sFieldName = 'd3longdesc1';
public $_sThisTemplate = 'd3_manufacturer_longtext.tpl';
public function render()
{
$tpl = parent::render();
$this->_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;
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace D3\CategoryLongtext\Application\Controller\Admin;
class d3manufacturerlongtext1 extends d3manufacturerlongtext
{
public $sFieldName = 'd3longdesc1';
}

View File

@ -0,0 +1,8 @@
<?php
namespace D3\CategoryLongtext\Application\Controller\Admin;
class d3manufacturerlongtext2 extends d3manufacturerlongtext
{
public $sFieldName = 'd3longdesc2';
}

View File

@ -24,4 +24,6 @@ $aLang = [
//Navigation
'charset' => 'UTF-8',
'd3categorylongtext' => $logo.' zweiter Langtext',
'd3manufacturerlongtext1' => $logo.' Langtext 1',
'd3manufacturerlongtext2' => $logo.' Langtext 2',
];

View File

@ -0,0 +1,59 @@
[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
<script type="text/javascript">
<!--
function loadLang(obj)
{
var langvar = document.getElementById("selectedlang");
if (langvar != null )
langvar.value = obj.value;
document.myedit.submit();
}
//-->
</script>
[{if $readonly}]
[{assign var="readonly" value="readonly disabled"}]
[{else}]
[{assign var="readonly" value=""}]
[{/if}]
<form name="transfer" id="transfer" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="editlanguage" value="[{$editlanguage}]">
</form>
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" onSubmit="copyLongDesc( 'oxmanufacturers__[{$oView->getFieldName()}]' );" style="padding: 0;margin: 0;height:0;">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="fnc" value="">
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="voxid" value="[{$oxid}]">
<input type="hidden" name="editval[oxmanufacturers__oxid]" value="[{$oxid}]">
<input type="hidden" name="selectedlang" value="[{$selectedlang}]">
<input type="hidden" value="" name="editval[oxmanufacturers__[{$oView->getFieldName()}]]">
[{$editor}]
<table cellspacing="0" cellpadding="0" border="0" style="width:99%;">
<tr>
<td valign="top" class="edittext">
[{if $languages}]<strong>[{oxmultilang ident="GENERAL_LANGUAGE"}]</strong>
<select name="selectedlang" class="editinput" onchange="loadLang(this)" [{$readonly}]>
[{foreach key=key item=item from=$languages}]
<option value="[{$key}]"[{if $selectedlang == $key}] SELECTED[{/if}]>[{$item->name}]</option>
[{/foreach}]
</select>
[{/if}]
</td>
<tr>
<td>
<input type="submit" class="edittext" name="save" value="[{oxmultilang ident="CATEGORY_TEXT_SAVE"}]" onClick="document.myedit.fnc.value='save'">
</td>
</tr>
</table>
</form>
[{include file="bottomnaviitem.tpl"}]
[{include file="bottomitem.tpl"}]

View File

@ -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;

View File

@ -1,6 +1,6 @@
{
"name": "d3/categorylongtext",
"description": "2. Kategorie Langtext",
"description": "weitere Langtexte",
"type": "oxideshop-module",
"keywords": [
"oxid",

View File

@ -6,5 +6,11 @@
<TAB id="d3categorylongtext" cl="d3clcategorylongtext"/>
</SUBMENU>
</MAINMENU>
<MAINMENU id="mxmainmenu">
<SUBMENU id="mxmanufacturer" cl="manufacturer" list="manufacturer_list">
<TAB id="d3manufacturerlongtext1" cl="d3manufacturerlongtext1"/>
<TAB id="d3manufacturerlongtext2" cl="d3manufacturerlongtext2"/>
</SUBMENU>
</MAINMENU>
</OXMENU>
</OX>

View File

@ -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 = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em">';
$logo = '<img src="https://logos.oxidmodule.com/d3logo_individual.svg" alt="(D3)" style="height:1em;width:1em">';
$aModule = array(
'id' => $sModuleId,
'title' => $logo.' zweiter Kategorielangtext',
'description' => '<strong>Hinweise:</strong>'
$features = <<<FEATURES
<ul>
<li><a href="https://manager.oxidmodule.com/view.php?id=11735">#11735 - 2. Kategorielangtext</a>
<quote>
<strong>Hinweise:</strong>'
. '<b>Voraussetzungen:</b><br>'
. 'Datenbank-Felder: <br>'
. '- oxcategories__d3longdesc2<br>'
@ -29,17 +32,30 @@ $aModule = array(
. '- oxcategories__d3longdesc2_2<br>'
. '- oxcategories__d3longdesc2_3<br>'
. 'Diese Erweiterung bietet einen zweiten Kategorielangtext.<br>' //
. 'Angezeigt wird der zweite Langtext unter der Artikelauflistung in der Listenansicht.',
. 'Angezeigt wird der zweite Langtext unter der Artikelauflistung in der Listenansicht.
</quote>
</li>
<li><a href="https://manager.oxidmodule.com/view.php?id=12128">#12128 - Herstellerlangtexte</a></li>
</ul>
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'
]
);
];

View File

@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
namespace D3\CategoryLongtext\Migrations;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\TextType;
use Doctrine\DBAL\Types\Type;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230802094023 extends AbstractMigration
{
public function getDescription() : string
{
return 'add longtext 1 field in manufacturer table';
}
/**
* @throws SchemaException
* @throws DBALException
* @throws DatabaseErrorException
* @throws DatabaseConnectionException
*/
public function up(Schema $schema) : void
{
$this->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
}
}

View File

@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
namespace D3\CategoryLongtext\Migrations;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\TextType;
use Doctrine\DBAL\Types\Type;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230802094252 extends AbstractMigration
{
public function getDescription() : string
{
return 'add longtext 2 field in manufacturer table';
}
/**
* @throws SchemaException
* @throws DBALException
* @throws DatabaseErrorException
* @throws DatabaseConnectionException
*/
public function up(Schema $schema) : void
{
$this->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
}
}