WebsiteBaker Community Forum

WebsiteBaker Support (2.11.x) => Modules => Topic started by: astricia on October 31, 2018, 09:04:56 AM

Title: Drag and Drop not working in OFA when modulename contains hyphens
Post by: astricia on October 31, 2018, 09:04:56 AM
Just noticed this bug - when the name for an OneForAll-module contains a hyphen (-), the Drag and Drop function for Fields and Entries does not work .... ! Anybody can confirm?

Astrid
Title: Re: Drag and Drop not working in OFA when modulename contains hyphens
Post by: dbs on October 31, 2018, 10:23:10 AM
Can't install a module with modulname and directoryname "one-for-all".
Invalid chars.
Title: Re: Drag and Drop not working in OFA when modulename contains hyphens
Post by: astricia on October 31, 2018, 10:51:02 AM
Hmm... in the info.php it says, that hyphens and underscores are allowed. And I could install it. And it seemed to work fine. Until I tried to change the order of some fields....
Title: Re: Drag and Drop not working in OFA when modulename contains hyphens
Post by: dbs on October 31, 2018, 11:29:58 AM
Dietmar will have a look. But today some problems with internet (Unitymedia).
Title: Re: Drag and Drop not working in OFA when modulename contains hyphens
Post by: astricia on October 31, 2018, 11:41:07 AM
And some other strange behaviour:

When I have two sections of the same OFA module - and I call them via SectionPicker on another page - then the first one will be in the correct order, the second one will be in reversed order! Why is that???

Noch mal auf Deutsch, weil es vielleicht sonst zu kompliziert ist: Ich habe zwei Abschnitte des gleichen OFA-Moduls auf verschiedenen Seiten. Auf einer Übersichtsseite rufe ich diese beiden Abschnitte mit dem SectionPicker auf. Der erste Abschnitt wird genauso dargestellt wie auf der Original-Seite. Aber beim zweiten Abschnitt ist die Reihenfolge vertauscht - das letzte Element steht oben, und das erste unten. Wieso???

LG,
Astrid
Title: Re: Drag and Drop not working in OFA when modulename contains hyphens
Post by: DarkViper on October 31, 2018, 11:44:02 AM
it's a rule and not a bug.
Quote from: https://secure.php.net/manual/en/language.variables.basics.php
Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
Unfortunately, I do not know OFA to the last detail but only from a short review of the code. Especially not the JS parts.
However, I have seen that in different places the module name is also used as a variable name. As well as table names and field names in the database.
At least in PHP are hyphens in variable names not allowed (see Quote). Likewise, mySql can cause problems in strict mode. Also, I can vaguely remember that JS has several problems here too.
The simplest and most important solution is not to use hyphens in module names. There are absolutely no factual reasons for their use.

Manuela
Title: Re: Drag and Drop not working in OFA when modulename contains hyphens
Post by: dbs on October 31, 2018, 11:50:53 AM
Quote
At least in PHP are hyphens in variable names not allowed
Therefore the info.php rename whitespaces and hyphens to underscore. But something work not right in my test.
Maybe the installer can't do it right in the zip.
Title: Re: Drag and Drop not working in OFA when modulename contains hyphens
Post by: dbs on November 01, 2018, 07:38:59 PM
The new version 2.0.2.22 should solv the problem.
https://addon.WebsiteBaker.org/pages/en/browse-add-ons.php?id=04238F62