XH 1.6: Different Kinds of Inputs for Config Forms

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by manu » Thu Dec 20, 2012 10:17 am

I suppose the actual voting's subject is to introduce metaconfig.php.
This is a good proposal since Jerry's solution as formatting integrated in the config field could be realized in a further step after metaconfig.php has well established to users and plugins.
regards
manu

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by cmb » Thu Dec 20, 2012 11:27 am

Hi manu,
manu wrote:I suppose the actual voting's subject is to introduce metaconfig.php.
Actually it is about introducing this "typed" config at all, which format to use for the storage and which field types to offer. Some short notes of every voter (in the notes field in the roadmap or in this thread might be in place).

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by cmb » Sat Jan 05, 2013 9:57 pm

Hello Community,

this is now implemented in the 1.6 branch (r421). The following types are available:
  • string (text input)
  • text (textarea)
  • bool (checkbox)
  • enum (selectbox)
  • hidden (hidden)
  • password (text input)
For plugins this can be configured in a file metaconfig.php. E.g. plugins/pagemanager/config/metaconfig.php could be:

Code: Select all

<?php

$plugin_mcf['pagemanager']['verbose']="bool";
$plugin_mcf['pagemanager']['treeview_theme']="enum:cmsimple,apple";
$plugin_mcf['pagemanager']['utf8_marker']="hidden";

?>
The types of the core config and LANGconfig are hardcoded now, but could easily be moved to files also. We should consider to make the metaconfig available for plugin language files also, to cater for some language specific settings. At least to possibility to hide some language strings in the form could be interesting.

Regarding the password type: I have implemented this particularly for the core (security->password), which means the password are hashed directly on saving. This might not make sense for plugins, but actually I don't see any use for this field type in plugins, so we can leave it as it is.

Regarding other types: these can simply be catered for by adding an appropriate case clause to XH_ArrayFileEdit::formField(). We can add them for XH 1.6 or delay it, to see what's actually needed.

Regarding the selectbox vs. radiobuttons: I still prefer the selectbox as it takes less space, but changing it to radiobuttons can easily be done. We might even make that configurable in the core, so every user can choose his preference.

Regarding the look of the config/language forms: this has to be improved! ;) I've implemented them as tables as that was done so formerly; perhaps even that should be changed. But at least some styling seems very appropriate. Any volunteers?

Anybody interested in having look at the development and doesn't have a SVN client available, can always download the latest development snapshot.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by manu » Mon Aug 05, 2013 3:16 pm

Not sure if this is the correct location to address to:
When saving config I get this error/warning:
ERROR/WARNING
New password is invalid
even if I don't change password.
CMSimple 1.6 r816
regards
manu

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by cmb » Mon Aug 05, 2013 3:35 pm

That's strange. svasti reported the same problem some weeks ago. I was not able to reproduce it. I replied:
Ich hab's gerade mal mit FF 22 unter PHP 5.4.7 probiert: egal was ich
mache -- keine Meldung wegen eines falschen Passwords. Ich glaube aber
eigentlich nicht, dass es am Browser liegt (da könnte es höchstens mit
dem Password-Änderungsdialog Probleme geben).

Die Fehlermeldung "New password is invalid" dürfte eigentlich gar nicht
von PHP gemeldet werden. Das habe ich nur sicherheitshalber noch einmal
serverseitig implementiert. Eigentlich müsste schon im Password-Dialog
die entsprechende Meldung erscheinen, aber eben nur dann, wenn man kein
neues Kennwort einträgt.

Jedenfalls ist es so, dass es drei Eingabefelder gibt (die kann man im
Password-Dialog auch sehen): PL3bbeec384_security_password_OLD,
PL3bbeec384_security_password_NEW und
PL3bbeec384_security_password_CONFIRM. Diese sind immer leer wenn das
Formular ausgeliefert wird, und bleiben auch leer, wenn der
Passworddialog nicht erfolgreich ausgefüllt wird. In
cmsimple/classes/FileEdit.php XH_ArrayFileEdit::submitPassword() wird
dann geprüft, ob $_POST[PL3bbeec384_security_password_OLD] == '' ist,
und falls ja wird einfach das gespeicherte Kennwort genommen.

Anscheinend ist dieser Wert bei Dir aber nicht leer. Aber wieso? Schau
doch bitte mal nach, welchen Wert er hat. Im Zweifel mal in der besagten
Methode zu Beginn:

var_dump($_POST[$iname . '_OLD']);
Could you please check this?
Christoph M. Becker – Plugins for CMSimple_XH

manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by manu » Mon Aug 05, 2013 4:19 pm

var_dump outputs "test".
This comes from the FF form autocomplete feature.
After deletion of this certain password it worked well.
How about a password_OLD field with

Code: Select all

autocomplete="off"
?

manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by manu » Mon Aug 05, 2013 4:23 pm

Isn't there any success msg like "edit succeeded"?

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by cmb » Mon Aug 05, 2013 4:53 pm

manu wrote:This comes from the FF form autocomplete feature.
Indeed! I have overlooked this. I would have thought the specs take care for setting autocomplete to off for all password inputs. Obviously they don't.

To be on the safe side, I suggest setting autocomplete="off" for all three password inputs.
manu wrote:Isn't there any success msg like "edit succeeded"?
Not yet--I completely had forgotten that; thanks for the reminder.[1]

PS: I have implemented that now (r825).

[1] The respective discussion about this issue is in http://cmsimpleforum.com/viewtopic.php?f=29&t=5567.
Last edited by cmb on Mon Aug 05, 2013 7:12 pm, edited 1 time in total.
Reason: added PS
Christoph M. Becker – Plugins for CMSimple_XH

manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by manu » Mon Aug 05, 2013 8:49 pm

Thanks Christoph
It all works.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.6: Different Kinds of Inputs for Config Forms

Post by cmb » Fri Sep 06, 2013 6:50 pm

svasti was not too happy about the fact, that the config options of the plugins are now displayed as input fields by default. Formerly they have been textareas, what was fine for long option values. Of course, it's possible to add a metaconfig.php now, but what about plugins which do not have one?

Basically it's possible to use textareas per default for the plugin configuration, which will behave exactly the same as for the language strings (see http://cmsimpleforum.com/viewtopic.php?f=29&t=5556). The necessary modification can be made in cmsimple/classes/FileEdit.php in XH_PluginConfigFileEdit() (currently line 1034):

Code: Select all

$omcf = isset($mcf[$key]) ? $mcf[$key] : 'text';
An alternative would be to use inputs for options which have a short value currently, and textareas for those with a long value:

Code: Select all

            $omcf = isset($mcf[$key])
                ? $mcf[$key]
                : (utf8_strlen($val) <= 50 ? 'string' : 'text');
What do others think about it?
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply