Author Topic: Drag and Drop not working in OFA when modulename contains hyphens  (Read 155 times)

Offline astricia

  • Posts: 473
  • Gender: Female
    • netSchmiede24
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

Offline dbs

  • Betatester
  • **
  • Posts: 7527
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Drag and Drop not working in OFA when modulename contains hyphens
« Reply #1 on: October 31, 2018, 10:23:10 AM »
Can't install a module with modulname and directoryname "one-for-all".
Invalid chars.

Offline astricia

  • Posts: 473
  • Gender: Female
    • netSchmiede24
Re: Drag and Drop not working in OFA when modulename contains hyphens
« Reply #2 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....

Offline dbs

  • Betatester
  • **
  • Posts: 7527
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Drag and Drop not working in OFA when modulename contains hyphens
« Reply #3 on: October 31, 2018, 11:29:58 AM »
Dietmar will have a look. But today some problems with internet (Unitymedia).

Offline astricia

  • Posts: 473
  • Gender: Female
    • netSchmiede24
Re: Drag and Drop not working in OFA when modulename contains hyphens
« Reply #4 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

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 2976
  • Gender: Female
Re: Drag and Drop not working in OFA when modulename contains hyphens
« Reply #5 on: October 31, 2018, 11:44:02 AM »
it's a rule and not a bug.
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
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"You have to take the men as they are… but you can not leave them like that !" :-P
Das tägliche Stoßgebet: Oh Herr, wirf ihnen Hirn vom Himmel !

Offline dbs

  • Betatester
  • **
  • Posts: 7527
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Drag and Drop not working in OFA when modulename contains hyphens
« Reply #6 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.

Offline dbs

  • Betatester
  • **
  • Posts: 7527
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Drag and Drop not working in OFA when modulename contains hyphens
« Reply #7 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

 

postern-length