Compare commits

..

No commits in common. "main" and "1.0.0" have entirely different histories.
main ... 1.0.0

16 changed files with 58 additions and 411 deletions

View File

@ -1,87 +0,0 @@
<?php
namespace D3\CategoryLongtext\Application\Controllers\Admin;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Application\Model\Manufacturer;
use stdClass;
abstract class d3manufacturerlongtext extends AdminDetailsController
{
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, "oxmanufacturers__".$this->sFieldName, "list.tpl.css");
return $tpl;
}
public function save()
{
parent::save();
$soxId = $this->getEditObjectId();
$aParams = Registry::getRequest()->getRequestEscapedParameter("editval");
$manufacturer = oxNew( Manufacturer::class);
$selectedLang = Registry::getRequest()->getRequestEscapedParameter( "selectedlang");
$selectedLang = $selectedLang ?: 0;
if ($soxId != "-1") {
$manufacturer->loadInLang($selectedLang, $soxId);
} else {
$aParams['oxmanufacturers__oxid'] = null;
}
//Disable editing for derived items
if ($manufacturer->isDerived()) {
return;
}
$manufacturer->setLanguage(0);
$manufacturer->assign($aParams);
$manufacturer->setLanguage($selectedLang);
$manufacturer->save();
// set oxid if inserted
$this->setEditObjectId($manufacturer->getId());
}
public function getFieldName()
{
return $this->sFieldName;
}
}

View File

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

View File

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

View File

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

View File

@ -21,13 +21,13 @@
<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="d3clcategorylongtext">
<input type="hidden" name="cl" value="d3_categories_longdesc">
<input type="hidden" name="editlanguage" value="[{$editlanguage}]">
</form>
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" onSubmit="copyLongDesc( 'oxcategories__d3longdesc2' );" style="padding: 0px;margin: 0px;height:0px;">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="d3clcategorylongtext">
<input type="hidden" name="cl" value="d3_categories_longdesc">
<input type="hidden" name="fnc" value="">
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="voxid" value="[{$oxid}]">

View File

@ -1,59 +0,0 @@
[{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

@ -1,23 +1,5 @@
[{assign var="oPageNavigation" value=$oView->getPageNavigation()}]
[{if $oViewConf->getActiveClassName() == 'manufacturerlist' &&
$actCategory && $actCategory->oxmanufacturers__d3longdesc1->value &&
$oPageNavigation->actPage == 1
}]
<div class="manufacturerDescription desc1" id="mnfLongDesc1">[{oxeval var=$actCategory->oxmanufacturers__d3longdesc1}]</div>
[{/if}]
[{$smarty.block.parent}]
[{if $oViewConf->getActiveClassName() == 'alist' &&
$actCategory && $actCategory->oxcategories__d3longdesc2->value &&
$oPageNavigation->actPage == 1
}]
[{if $actCategory && $actCategory->oxcategories__d3longdesc2->value }]
<div class="categoryDescription" id="catLongDesc">[{oxeval var=$actCategory->oxcategories__d3longdesc2}]</div>
[{/if}]
[{if $oViewConf->getActiveClassName() == 'manufacturerlist' &&
$actCategory && $actCategory->oxmanufacturers__d3longdesc2->value &&
$oPageNavigation->actPage == 1
}]
<div class="manufacturerDescription desc2" id="mnfLongDesc2">[{oxeval var=$actCategory->oxmanufacturers__d3longdesc2}]</div>
[{/if}]

View File

@ -1,37 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased](https://git.d3data.de/D3Private/SecondLongDesc/compare/1.4.0...rel_1.x)
## [1.5.0](https://git.d3data.de/D3Private/SecondLongDesc/compare/1.4.0...1.5.0) - 2023-08-02
### Added
- 2 longtexts for manufacturers
## [1.4.0](https://git.d3data.de/D3Private/SecondLongDesc/compare/1.3.0...1.4.0) - 2023-04-04
### Removed
- composer.json version entry
### Added
- composer.json php requirement
## [1.3.0](https://git.d3data.de/D3Private/SecondLongDesc/compare/1.2.1...1.3.0) - 2023-04-03
### Removed
- migration additional method
## [1.2.1](https://git.d3data.de/D3Private/SecondLongDesc/compare/1.1.0...1.2.1) - 2023-04-03
### Fixed
- migration-file
- wrong class call in migration-file
- file extension use-call
## [1.1.0](https://git.d3data.de/D3Private/SecondLongDesc/compare/1.0.0...1.1.0) - 2023-04-03
### Added
- changelog
### Fixed
- wrong cl-call in templates
## [1.0.0](https://git.d3data.de/D3Private/SecondLongDesc/releases/tag/1.0.0) - 2023-04-03
### Added
- implemented module

View File

@ -2,12 +2,11 @@
# ![D3 Logo](https://logos.oxidmodule.com/d3logo_24x24.svg) Zweiter Langtext fĂĽr OXID eShop
zusätzliche Langtexte
Zweiter Kategorielangtext
## Inhaltsverzeichnis
- [Installation](#installation)
- [Changelog](#changelog)
- [Beitragen](#beitragen)
- [Lizenz](#lizenz)
@ -19,17 +18,14 @@ Dieses Paket erfordert einen mit Composer installierten OXID eShop in einer in d
```bash
php composer require d3/categorylongtext:"^1"
php composer config repositories.hele vcs gitfhfac@git.d3data.de:Customers/hele.de.git
php composer require d3/categorylongtext:"dev-modules/rel_categorylongtext"
```
Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code auszuführen.
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
## Changelog
Siehe [CHANGELOG](CHANGELOG.md) fĂĽr weitere Informationen.
## Beitragen
Wenn Sie eine Verbesserungsvorschlag haben, legen Sie einen Fork des Repositories an und erstellen Sie einen Pull Request. Alternativ können Sie einfach ein Issue erstellen. Fügen Sie das Projekt zu Ihren Favoriten hinzu. Vielen Dank.

View File

@ -2,16 +2,4 @@ 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,7 +1,8 @@
{
"name": "d3/categorylongtext",
"description": "weitere Langtexte",
"description": "2. Kategorie Langtext",
"type": "oxideshop-module",
"version": "1.0.0",
"keywords": [
"oxid",
"modules",
@ -29,7 +30,6 @@
}
},
"require": {
"php": "^7",
"oxid-esales/oxideshop-ce":"^6"
},
"autoload": {

View File

@ -6,11 +6,5 @@
<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,59 +13,43 @@
declare(strict_types=1);
use D3\CategoryLongtext\Application\Controllers\Admin\AdminDetailsController;
use D3\CategoryLongtext\Application\Controllers\Admin\d3manufacturerlongtext1;
use D3\CategoryLongtext\Application\Controllers\Admin\d3manufacturerlongtext2;
$sMetadataVersion = '2.1';
$sModuleId = 'd3categorylongtext';
$logo = '<img src="https://logos.oxidmodule.com/d3logo_individual.svg" alt="(D3)" style="height:1em;width:1em">';
$logo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em">';
$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>
- oxcategories__d3longdesc2_1<br>
- 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.
</quote>
</li>
<li><a href="https://manager.oxidmodule.com/view.php?id=12128">#12128 - Herstellerlangtexte</a></li>
</ul>
FEATURES;
$aModule = [
$aModule = array(
'id' => $sModuleId,
'title' => $logo.' weitere Kategorie- und Herstellerlangtexte',
'description' => $features,
'title' => $logo.' zweiter Kategorielangtext',
'description' => '<strong>Hinweise:</strong>'
. '<b>Voraussetzungen:</b><br>'
. 'Datenbank-Felder: <br>'
. '- oxcategories__d3longdesc2<br>'
. '- oxcategories__d3longdesc2_1<br>'
. '- 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.',
'thumbnail' => 'picture.png',
'version' => '1.5.0',
'version' => '1.0.0',
'author' => $logo.' Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',
'controllers' => [
'd3clcategorylongtext' => AdminDetailsController::class,
'd3manufacturerlongtext1' => d3manufacturerlongtext1::class,
'd3manufacturerlongtext2' => d3manufacturerlongtext2::class,
'd3clcategorylongtext' => AdminDetailsController::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' => [
[
'template' => 'page/list/list.tpl',
'block' => 'page_list_listbody',
'file' => 'Application/views/blocks/list_second_longdescription.tpl',
]
],
],
'events' => [
'onActivate' => '\D3\CategoryLongtext\Setup\Events::onActivate',
//'onDeactivate' => '\D3\CategoryLongtext\Events\Events::onDeactivate'
]
];
);

View File

@ -5,11 +5,11 @@ declare(strict_types=1);
namespace D3\CategoryLongtext\Migrations;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Types\Type;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\TextType;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
@ -26,6 +26,8 @@ final class Version20230403083243 extends AbstractMigration
/**
* @throws SchemaException
* @throws DBALException
* @throws DatabaseErrorException
* @throws DatabaseConnectionException
*/
public function up(Schema $schema) : void
{
@ -33,22 +35,46 @@ final class Version20230403083243 extends AbstractMigration
$table = $schema->getTable('oxcategories');
if (!$table->hasColumn('D3LONGDESC2')){
$table->addColumn('D3LONGDESC2', (Type::getType('text')->getName()))
$table->hasColumn('D3LONGDESC2') ?:
$table->addColumn('D3LONGDESC2', (new TextType::class)->getName())
->setNotnull(true);
}
$table->hasColumn('D3LONGDESC2_1') ?:
$table->addColumn('D3LONGDESC2_1', (Type::getType('text')->getName()))
$table->addColumn('D3LONGDESC2_1', (new TextType::class)->getName())
->setNotnull(true);
$table->hasColumn('D3LONGDESC2_2') ?:
$table->addColumn('D3LONGDESC2_2', (Type::getType('text')->getName()))
$table->addColumn('D3LONGDESC2_2', (new TextType::class)->getName())
->setNotnull(true);
$table->hasColumn('D3LONGDESC2_3') ?:
$table->addColumn('D3LONGDESC2_3', (Type::getType('text')->getName()))
$table->addColumn('D3LONGDESC2_3', (new TextType::class)->getName())
->setNotnull(true);
$this->postProcesses();
}
/**
* @throws DatabaseErrorException
* @throws DatabaseConnectionException
*/
public function postProcesses(){
$sAltering = 'ALTER TABLE oxcategories MODIFY
? text
CHARACTER SET latin1
COLLATE latin1_swedish_ci;';
$aAlterColumns = [
'D3LONGDESC2',
'D3LONGDESC2_1',
'D3LONGDESC2_2',
'D3LONGDESC2_3'
];
foreach ($aAlterColumns as $column){
DatabaseProvider::getDb()->execute($sAltering, $column);
}
}
public function down(Schema $schema) : void

View File

@ -1,61 +0,0 @@
<?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

@ -1,61 +0,0 @@
<?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
}
}