Skip to content

Commit

Permalink
[TEMP] Include old Yahoo UI JS
Browse files Browse the repository at this point in the history
  • Loading branch information
PKuhlmay committed Aug 3, 2024
1 parent 6062e5d commit 5c6d750
Show file tree
Hide file tree
Showing 17 changed files with 201 additions and 51 deletions.
50 changes: 29 additions & 21 deletions Classes/Controller/BuilderModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,36 +282,41 @@ protected function getLanguageService(): LanguageService
protected function addAssets(): void
{
// SECTION: JAVASCRIPT FILES

// Initializing
$this->pageRenderer->loadJavaScriptModule('@friendsoftypo3/extension-builder/init.js');
// $this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/JavaScript/init.js'); // Yahoo Min Base

// YUI Basis Files
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/yui/utilities/utilities.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/extended/ListField.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/yui/resize/resize-min.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/yui/layout/layout-min.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/yui/container/container-min.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/yui/json/json-min.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/yui/button/button-min.js');

// YUI-RPC
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/yui-rpc.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/yui-rpc.js');

// InputEx with wirable options
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/inputex.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/Field.js');

// extended fields for enabling unique ids
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/extended/ListField.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/extended/Group.js');

$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/js/util/inputex/WirableField-beta.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/Visus.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/StringField.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/Textarea.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/SelectField.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/EmailField.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/UrlField.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/CheckBox.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/InPlaceEdit.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/MenuField.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/TypeField.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/extended/Group.js');

$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/js/util/inputex/WirableField-beta.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/Visus.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/fields/StringField.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/fields/Textarea.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/fields/SelectField.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/fields/EmailField.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/fields/UrlField.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/fields/CheckBox.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/fields/InPlaceEdit.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/fields/MenuField.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/wireit/lib/inputex/js/fields/TypeField.js');

// WireIt
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/js/WireIt.js');
Expand All @@ -325,17 +330,20 @@ protected function addAssets(): void
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/js/Layer.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/js/util/inputex/FormContainer-beta.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/js/LayerMap.js');

$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/wireit/js/WiringEditor.js');


// Extbase Modelling definition
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/extbaseModeling.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/layout.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/extensionProperties.js');
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/modules/modelObject.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/extbaseModeling.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/layout.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/extensionProperties.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/modules/modelObject.js');

// collapsible forms in relations
$this->pageRenderer->addJsFile('EXT:extension_builder/Resources/Public/jsDomainModeling/modules/extendedModelObject.js');
$this->pageRenderer->loadJavaScriptModule('@WireIt/js-domain-modeling/modules/extendedModelObject.js');

$this->pageRenderer->loadJavaScriptModule('@friendsoftypo3/extension-builder/example.js');
$this->pageRenderer->loadJavaScriptModule('@friendsoftypo3/extension-builder/extensionbuilder.js');

// SECTION: CSS Files
// YUI CSS
Expand Down
5 changes: 3 additions & 2 deletions Classes/Domain/Validator/ExtensionValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function injectExtensionBuilderConfigurationManager(
* @return array[]
* @throws Exception
*/
public function isValid($extension): array
public function isValid($extension): void
{
$extensionSettings = $extension->getSettings();
if (isset($extensionSettings['ignoreWarnings'])) {
Expand All @@ -222,7 +222,8 @@ public function isValid($extension): array
$this->validationResult['warnings'] = $warningsToKeep;
}

return $this->validationResult;
// TODO void must not return anything
// return $this->validationResult;
}

/**
Expand Down
22 changes: 22 additions & 0 deletions Configuration/JavaScriptModules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

return [
'dependencies' => ['core', 'backend'],
'imports' => [
'@friendsoftypo3/extension-builder/' => 'EXT:extension_builder/Resources/Public/JavaScript/',
'@WireIt/js-domain-modeling/' => 'EXT:extension_builder/Resources/Public/jsDomainModeling/',
],
];
16 changes: 8 additions & 8 deletions Resources/Private/Templates/BuilderModule/Domainmodelling.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
</div>
<script type="text/javascript">
// InputEx needs a correct path to this image
inputEx.spacerUrl = TYPO3.settings.extensionBuilder.publicResourcesUrl + '/jsDomainModeling/wireit/lib/inputex/images/space.gif';
// inputEx.spacerUrl = TYPO3.settings.extensionBuilder.publicResourcesUrl + '/jsDomainModeling/wireit/lib/inputex/images/space.gif';

YAHOO.util.Event.onDOMReady(function() {
const editor = new WireIt.WiringEditor(extbaseModeling_wiringEditorLanguage);
const initialWarnings = {initialWarnings -> f:format.json() -> f:format.raw()};
if (initialWarnings.length > 0) {
editor.alert('Warning', initialWarnings.join('<br />'));
}
});
// YAHOO.util.Event.onDOMReady(function() {
// const editor = new WireIt.WiringEditor(extbaseModeling_wiringEditorLanguage);
// const initialWarnings = {initialWarnings -> f:format.json() -> f:format.raw()};
// if (initialWarnings.length > 0) {
// editor.alert('Warning', initialWarnings.join('<br />'));
// }
// });
</script>
</f:section>
</html>
17 changes: 17 additions & 0 deletions Resources/Public/JavaScript/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
console.log("example.js");

if(typeof extbaseModeling_wiringEditorLanguage !== 'undefined') {
var extbaseModeling_wiringEditorLanguage = {
parentEl: 'domainModelEditor',
languageName: 'extbaseModeling',
smdUrl: TYPO3.settings.ajaxUrls['ExtensionBuilder::wiringEditorSmdEndpoint'],
layerOptions: {},
modules: []
};
}

console.log(TYPO3);
console.log(TYPO3.settings.extensionBuilder._LOCAL_LANG.add);
console.log(YAHOO);
console.log("extbaseModeling_wiringEditorLanguage", extbaseModeling_wiringEditorLanguage);
console.log("-------");
51 changes: 51 additions & 0 deletions Resources/Public/JavaScript/extensionbuilder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// InputEx needs a correct path to this image
console.log("extensibionbuilder.js");

if(typeof extbaseModeling_wiringEditorLanguage !== 'undefined') {
var extbaseModeling_wiringEditorLanguage = {
parentEl: 'domainModelEditor',
languageName: 'extbaseModeling',
smdUrl: TYPO3.settings.ajaxUrls['ExtensionBuilder::wiringEditorSmdEndpoint'],
layerOptions: {},
modules: []
};
}

// console.log("extbaseModeling.js", extbaseModeling_wiringEditorLanguage);

// if(typeof YAHOO !== 'undefined')
// console.log(YAHOO);
// else
// console.log('YAHOO is undefined');
//
// if(typeof TYPO3 !== 'undefined')
// console.log(TYPO3);
// else
// console.log('TYPO3 is undefined');
//
// if(typeof inputEx !== 'undefined')
// console.log(inputEx);
// else
// console.log('inputEx is undefined');

console.log("--------");

inputEx.spacerUrl = TYPO3.settings.extensionBuilder.publicResourcesUrl + '/jsDomainModeling/wireit/lib/inputex/images/space.gif';

// console.log(inputEx.spacerUrl);

document.addEventListener('DOMContentLoaded', function() {
// Annahme: WireIt und extbaseModeling_wiringEditorLanguage sind bereits definiert oder werden woanders importiert
const editor = new WireIt.WiringEditor(extbaseModeling_wiringEditorLanguage);

// Hier müssen Sie die initialWarnings als normales JavaScript-Array definieren
const initialWarnings = [
"TODO: Warnung 1",
"TODO: Warnung 2",
"TODO: Warnung 3"
];

if (initialWarnings.length > 0) {
editor.alert('Warning', initialWarnings.join('<br />'));
}
});
13 changes: 13 additions & 0 deletions Resources/Public/JavaScript/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
console.log("init.js");
// console.log(TYPO3);

export let extbaseModeling_wiringEditorLanguage = {
parentEl: 'domainModelEditor',
languageName: 'extbaseModeling',
smdUrl: TYPO3.settings.ajaxUrls['ExtensionBuilder::wiringEditorSmdEndpoint'],
layerOptions: {},
modules: []
};

// console.log(extbaseModeling_wiringEditorLanguage);
console.log("init.js ENDE");
47 changes: 30 additions & 17 deletions Resources/Public/jsDomainModeling/extbaseModeling.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
var extbaseModeling_wiringEditorLanguage = {
parentEl: 'domainModelEditor',
languageName: 'extbaseModeling',
smdUrl: TYPO3.settings.ajaxUrls['ExtensionBuilder::wiringEditorSmdEndpoint'],
layerOptions: {},
modules: []
};
import { extbaseModeling_wiringEditorLanguage } from '../JavaScript/init.js';

// console.log("extbaseModeling.js", extbaseModeling_wiringEditorLanguage);

/**
* @see https://gist.github.com/ziggi/2f15832b57398649ee9b and jQuery source code
Expand All @@ -30,6 +26,9 @@ Element.prototype.parents = function (selector) {
var inputEx = YAHOO.inputEx;
var renderFields = inputEx.Group.prototype.renderFields;

// console.log("extbaseModlline.js", inputEx);
// console.log("extbaseModlline.js", renderFields);

/**
* @param {Element} selectElement
*/
Expand Down Expand Up @@ -86,17 +85,31 @@ Element.prototype.parents = function (selector) {
/**
* @param {Element} parentEl
*/
inputEx.Group.prototype.renderFields = function (parentEl) {
renderFields.call(this, parentEl);
parentEl.querySelectorAll('fieldset select[name="relationType"]').forEach(function (element, i) {
// trigger options rendering & enabling for relationType selectors
addFieldsetClass(element);
});
};

inputEx.SelectField.prototype.onChange = function (evt) {
addFieldsetClass(evt.target);
};
// console.log("hier");
// console.log("prototype", inputEx.Group.prototype.renderFields);

if(typeof inputEx.Group.prototype.renderFields === 'undefined') {
console.log("inputEx.Group.prototype.renderFields ist undefined");
} else {
inputEx.Group.prototype.renderFields = function (parentEl) {
renderFields.call(this, parentEl);
parentEl.querySelectorAll('fieldset select[name="relationType"]').forEach(function (element, i) {
// trigger options rendering & enabling for relationType selectors
addFieldsetClass(element);
});
};
}

if(typeof inputEx.SelectField === 'undefined' || typeof inputEx.SelectField.prototype.onChange === 'undefined') {
console.log("inputEx.SelectField.prototype.onChange ist undefined");
} else {
inputEx.SelectField.prototype.onChange = function (evt) {
addFieldsetClass(evt.target);
};
}

// console.log("Hier ende");

/**
* add the selected propertyType as classname to all propertyGroup fieldsets
Expand Down
5 changes: 5 additions & 0 deletions Resources/Public/jsDomainModeling/extended/ListField.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
* value manipulation after a "Add" event
* (see line
**************************************************/
console.log("-----");
(function () {
var inputEx = YAHOO.inputEx, lang = YAHOO.lang, Event = YAHOO.util.Event, Dom = YAHOO.util.Dom;

console.log("ListField.js");
console.log("inputEx", inputEx);
console.log("YPAHOO", YAHOO);
console.log("TYPO3", TYPO3);
/**
* @class Meta field to create a list of other fields
* @extends inputEx.Field
Expand Down
5 changes: 5 additions & 0 deletions Resources/Public/jsDomainModeling/extensionProperties.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// console.log(TYPO3);

import { extbaseModeling_wiringEditorLanguage } from '../JavaScript/init.js';

// console.log("extbaseModeling_wiringEditorLanguage", extbaseModeling_wiringEditorLanguage);
extbaseModeling_wiringEditorLanguage.propertiesFields = [
{
type: 'string',
Expand Down
4 changes: 4 additions & 0 deletions Resources/Public/jsDomainModeling/layout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Configuration of the whole layout. See documentation of YUI's widget.Layout()
console.log("layout.js");
import { extbaseModeling_wiringEditorLanguage } from '../JavaScript/init.js';

// (extbaseModeling_wiringEditorLanguage);
extbaseModeling_wiringEditorLanguage.layoutOptions = {
units: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { extbaseModeling_wiringEditorLanguage } from '../../JavaScript/init.js';

var advancedFields = {
type: 'group',
inputParams: {
Expand Down Expand Up @@ -94,7 +96,7 @@ var advancedFields = {
}
};

var relationFieldSet = extbaseModeling_wiringEditorLanguage.modules[0].container.fields[4].inputParams.fields[0].inputParams.elementType.inputParams.fields;
var relationFieldSet = extbaseModeling_wiringEditorLanguage.modules[0].container.fields[4].inputParams.fields[0].inputParams.elementType.inputParams.fields ?? [];
relationFieldSet[5] = advancedFields;
Array.prototype.remove = function (from, to) {
this.splice(from,
Expand Down
2 changes: 2 additions & 0 deletions Resources/Public/jsDomainModeling/modules/modelObject.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { extbaseModeling_wiringEditorLanguage } from '../../JavaScript/init.js';

extbaseModeling_wiringEditorLanguage.modules.push({
name: 'New Model Object',
container: { // Configuration according to WireIt.Container.options
Expand Down
2 changes: 2 additions & 0 deletions Resources/Public/jsDomainModeling/wireit/js/WiringEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
WireIt.WiringEditor = function(options) {


console.log("Wiring .......");
// set the default options
this.setOptions(options);

Expand Down Expand Up @@ -243,6 +244,7 @@
var layerOptions = options.layerOptions || {};
this.options.layerOptions.parentEl = layerOptions.parentEl ? layerOptions.parentEl : Dom.get('modelingLayer');

console.log("..........");
this.dataToSubmit = {name: '', working: '', language: this.options.languageName };

// IS: Disable layer map:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @constructor
* @param {Object} options Standard inputEx inputParams definition
*/
console.log("TypeField", inputEx);
inputEx.TypeField = function(options) {
inputEx.TypeField.superclass.constructor.call(this, options);

Expand Down Expand Up @@ -268,6 +269,8 @@
{ type: "boolean", inputParams: {label: "Show messages",name: "showMsg", value: false} }
];

console.log("TypeField2", inputEx.StringField.superclass.constructor.groupOptions);

inputEx.StringField.groupOptions = inputEx.StringField.superclass.constructor.groupOptions.concat([
{ type: 'string', inputParams: { label: 'Type invite', name: 'typeInvite', value: ''}},
{ type: 'integer', inputParams: { label: 'Size', name: 'size', value: 20}},
Expand Down Expand Up @@ -426,4 +429,4 @@
}


})();
})();
Loading

0 comments on commit 5c6d750

Please sign in to comment.