splitbrain / dokuwiki-plugin-data

Add and query structured data in your DokuWiki
http://www.dokuwiki.org/plugin:data
GNU General Public License v2.0
50 stars 34 forks source link

Replace old form object #229

Closed annda closed 2 years ago

annda commented 2 years ago

Replaces usage of Doku_Form with \dokuwiki\Form\Form

Fixes #228

Klap-in commented 2 years ago

Hi @annda Thanks for the update! You also uses the new event, while disabling the older event. This means it is not compatible with the previous version (current stable) of DokuWiki. If you could keep the older version of the code and let it still be called by the old event, then we can remove that part in a later stage if the release after Igor is released, while now keeping backward compatibility.

annda commented 2 years ago

@Klap-in I switched to the convenience methods in some cases, where the element is being created and added at the same time.

In most cases, however, the elements are collected into an array and later, in an iteration, added to the form with surrounding HTML. I started changing that too, but didn't like how <td> and </td> were creeping into element definitions.

Klap-in commented 2 years ago

As mentioned (in meatspace) I don't care for backward compatibility here. This isn't adding any new feature. Users of older wikis can simply continue to use the old version of the plugin.

My request is about backwards compatibility with Hogfather. (It is now replaced=deleted). Just keep the previous version of that function is enough to have backwards compatibility for Hogfather. I think almost no work, and lot more convenient for users of current version of DokuWiki.

I will have a look into the code at a later moment.

Klap-in commented 2 years ago

Looks fine for me (however not tested). Thanks for the update!

Juergen-aus-Zuendorf commented 2 years ago

Sorry, but now I get the following error message:

InvalidArgumentException: Sorry, the dropdown element does not support the "multiple" attribute
An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the data plugin.
More info has been written to the DokuWiki error log.

The error log shows this messages:

2022-07-27 07:31:03
InvalidArgumentException: Sorry, the dropdown element does not support the "multiple" attribute
/var/www/html/wiki/inc/Form/DropdownElement.php(113)
#0 /var/www/html/wiki/inc/Form/Element.php(98): dokuwiki\Form\DropdownElement->attr('multiple', 'multiple')
#1 /var/www/html/wiki/lib/plugins/data/syntax/entry.php(500): dokuwiki\Form\Element->attrs(Array)
#2 /var/www/html/wiki/lib/plugins/data/syntax/entry.php(144): syntax_plugin_data_entry->_editData(Array, Object(Doku_Renderer_plugin_data_edit))
#3 /var/www/html/wiki/inc/parser/renderer.php(117): syntax_plugin_data_entry->render('plugin_data_edi...', Object(Doku_Renderer_plugin_data_edit), Array)
#4 /var/www/html/wiki/lib/plugins/data/action.php(100): Doku_Renderer->plugin('data_entry', Array, 5, '---- dataentry ...')
#5 /var/www/html/wiki/inc/Extension/EventHandler.php(81): action_plugin_data->_editform(Object(dokuwiki\Extension\Event), NULL)
#6 /var/www/html/wiki/inc/Extension/Event.php(74): dokuwiki\Extension\EventHandler->process_event(Object(dokuwiki\Extension\Event), 'BEFORE')
#7 /var/www/html/wiki/inc/Extension/Event.php(132): dokuwiki\Extension\Event->advise_before(true)
#8 /var/www/html/wiki/inc/Extension/Event.php(199): dokuwiki\Extension\Event->trigger(Array, true)
#9 /var/www/html/wiki/inc/Ui/Editor.php(86): dokuwiki\Extension\Event::createAndTrigger('EDIT_FORM_ADDTE...', Array, Array, true)
#10 /var/www/html/wiki/inc/Action/Edit.php(93): dokuwiki\Ui\Editor->show()
#11 /var/www/html/wiki/inc/template.php(100): dokuwiki\Action\Edit->tplContent()
#12 [internal function]: tpl_content_core('edit')
#13 /var/www/html/wiki/inc/Extension/Event.php(133): call_user_func_array('tpl_content_cor...', Array)
#14 /var/www/html/wiki/inc/Extension/Event.php(199): dokuwiki\Extension\Event->trigger('tpl_content_cor...', true)
#15 /var/www/html/wiki/inc/template.php(85): dokuwiki\Extension\Event::createAndTrigger('TPL_ACT_RENDER', 'edit', 'tpl_content_cor...')
#16 /var/www/html/wiki/lib/tpl/bootstrap3/main.php(117): tpl_content(false)
#17 /var/www/html/wiki/inc/actions.php(27): include('/var/www/html/w...')
#18 /var/www/html/wiki/doku.php(126): act_dispatch()
#19 {main}
annda commented 2 years ago

@Juergen-aus-Zuendorf What is the syntax that causes the error? Is it simple dataentry? The only dropdowns there are field types, so no multiple values can be assigned.

Do you maybe use type aliases? Or a bureaucracy form?

Juergen-aus-Zuendorf commented 2 years ago

Here is a small snippet:

---- dataentry normen ----
WN-Gruppe_norm-grps:            NTM
----

with

I hope it helps