diff --git a/Classes/Controller/BuilderModuleController.php b/Classes/Controller/BuilderModuleController.php index e1d321198..e2b1af238 100644 --- a/Classes/Controller/BuilderModuleController.php +++ b/Classes/Controller/BuilderModuleController.php @@ -282,8 +282,14 @@ 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'); @@ -291,27 +297,26 @@ protected function addAssets(): void $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'); @@ -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 diff --git a/Classes/Domain/Validator/ExtensionValidator.php b/Classes/Domain/Validator/ExtensionValidator.php index fae2db8a7..392c38766 100644 --- a/Classes/Domain/Validator/ExtensionValidator.php +++ b/Classes/Domain/Validator/ExtensionValidator.php @@ -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'])) { @@ -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; } /** diff --git a/Configuration/JavaScriptModules.php b/Configuration/JavaScriptModules.php new file mode 100644 index 000000000..ad2355216 --- /dev/null +++ b/Configuration/JavaScriptModules.php @@ -0,0 +1,22 @@ + ['core', 'backend'], + 'imports' => [ + '@friendsoftypo3/extension-builder/' => 'EXT:extension_builder/Resources/Public/JavaScript/', + '@WireIt/js-domain-modeling/' => 'EXT:extension_builder/Resources/Public/jsDomainModeling/', + ], +]; diff --git a/Resources/Private/Templates/BuilderModule/Domainmodelling.html b/Resources/Private/Templates/BuilderModule/Domainmodelling.html index 6e140c087..bf7a39910 100644 --- a/Resources/Private/Templates/BuilderModule/Domainmodelling.html +++ b/Resources/Private/Templates/BuilderModule/Domainmodelling.html @@ -16,15 +16,15 @@ diff --git a/Resources/Public/JavaScript/example.js b/Resources/Public/JavaScript/example.js new file mode 100644 index 000000000..6c7133574 --- /dev/null +++ b/Resources/Public/JavaScript/example.js @@ -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("-------"); diff --git a/Resources/Public/JavaScript/extensionbuilder.js b/Resources/Public/JavaScript/extensionbuilder.js new file mode 100644 index 000000000..8d1502046 --- /dev/null +++ b/Resources/Public/JavaScript/extensionbuilder.js @@ -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('
')); + } +}); diff --git a/Resources/Public/JavaScript/init.js b/Resources/Public/JavaScript/init.js new file mode 100644 index 000000000..bc5c5ac2e --- /dev/null +++ b/Resources/Public/JavaScript/init.js @@ -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"); diff --git a/Resources/Public/jsDomainModeling/extbaseModeling.js b/Resources/Public/jsDomainModeling/extbaseModeling.js index 503464024..a3b994a2a 100644 --- a/Resources/Public/jsDomainModeling/extbaseModeling.js +++ b/Resources/Public/jsDomainModeling/extbaseModeling.js @@ -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 @@ -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 */ @@ -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 diff --git a/Resources/Public/jsDomainModeling/extended/ListField.js b/Resources/Public/jsDomainModeling/extended/ListField.js index bb883d780..9146f47a0 100755 --- a/Resources/Public/jsDomainModeling/extended/ListField.js +++ b/Resources/Public/jsDomainModeling/extended/ListField.js @@ -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 diff --git a/Resources/Public/jsDomainModeling/extensionProperties.js b/Resources/Public/jsDomainModeling/extensionProperties.js index 9727d6e42..97e1a02a3 100644 --- a/Resources/Public/jsDomainModeling/extensionProperties.js +++ b/Resources/Public/jsDomainModeling/extensionProperties.js @@ -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', diff --git a/Resources/Public/jsDomainModeling/layout.js b/Resources/Public/jsDomainModeling/layout.js index c43bc9a02..75003fab9 100644 --- a/Resources/Public/jsDomainModeling/layout.js +++ b/Resources/Public/jsDomainModeling/layout.js @@ -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: [ { diff --git a/Resources/Public/jsDomainModeling/modules/extendedModelObject.js b/Resources/Public/jsDomainModeling/modules/extendedModelObject.js index 2703dae87..a51de4f6d 100644 --- a/Resources/Public/jsDomainModeling/modules/extendedModelObject.js +++ b/Resources/Public/jsDomainModeling/modules/extendedModelObject.js @@ -1,3 +1,5 @@ +import { extbaseModeling_wiringEditorLanguage } from '../../JavaScript/init.js'; + var advancedFields = { type: 'group', inputParams: { @@ -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, diff --git a/Resources/Public/jsDomainModeling/modules/modelObject.js b/Resources/Public/jsDomainModeling/modules/modelObject.js index 154ae024a..7ffc21f25 100644 --- a/Resources/Public/jsDomainModeling/modules/modelObject.js +++ b/Resources/Public/jsDomainModeling/modules/modelObject.js @@ -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 diff --git a/Resources/Public/jsDomainModeling/wireit/js/WiringEditor.js b/Resources/Public/jsDomainModeling/wireit/js/WiringEditor.js index 107d3720d..a40cb78f6 100644 --- a/Resources/Public/jsDomainModeling/wireit/js/WiringEditor.js +++ b/Resources/Public/jsDomainModeling/wireit/js/WiringEditor.js @@ -80,6 +80,7 @@ WireIt.WiringEditor = function(options) { + console.log("Wiring ......."); // set the default options this.setOptions(options); @@ -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: diff --git a/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/TypeField.js b/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/TypeField.js index 2f43fe07d..9007f692f 100644 --- a/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/TypeField.js +++ b/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/fields/TypeField.js @@ -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); @@ -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}}, @@ -426,4 +429,4 @@ } -})(); \ No newline at end of file +})(); diff --git a/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/inputex.js b/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/inputex.js index 14fda2879..59a56da41 100644 --- a/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/inputex.js +++ b/Resources/Public/jsDomainModeling/wireit/lib/inputex/js/inputex.js @@ -3,6 +3,7 @@ */ (function() { + console.log("inputex", YAHOO); var lang = YAHOO.lang; /** diff --git a/Resources/Public/jsDomainModeling/wireit/lib/yui/resize/resize-min.js b/Resources/Public/jsDomainModeling/wireit/lib/yui/resize/resize-min.js index daff88cb8..93b7b0ce3 100644 --- a/Resources/Public/jsDomainModeling/wireit/lib/yui/resize/resize-min.js +++ b/Resources/Public/jsDomainModeling/wireit/lib/yui/resize/resize-min.js @@ -4,6 +4,7 @@ http://developer.yahoo.net/yui/license.txt version: 2.7.0 */ +console.log("Testing resize"); (function() { var E = YAHOO.util.Dom,A = YAHOO.util.Event,C = YAHOO.lang; var B = function(F, D) { @@ -803,4 +804,4 @@ }}); YAHOO.util.Resize = B; })(); -YAHOO.register("resize", YAHOO.util.Resize, {version:"2.7.0",build:"1799"}); \ No newline at end of file +YAHOO.register("resize", YAHOO.util.Resize, {version:"2.7.0",build:"1799"});